repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
signalfx/signalfx-python
signalfx/signalflow/ws.py
WebSocketTransport.opened
def opened(self): """Handler called when the WebSocket connection is opened. The first thing to do then is to authenticate ourselves.""" request = { 'type': 'authenticate', 'token': self._token, 'userAgent': '{} ws4py/{}'.format(version.user_agent, ...
python
def opened(self): """Handler called when the WebSocket connection is opened. The first thing to do then is to authenticate ourselves.""" request = { 'type': 'authenticate', 'token': self._token, 'userAgent': '{} ws4py/{}'.format(version.user_agent, ...
Handler called when the WebSocket connection is opened. The first thing to do then is to authenticate ourselves.
https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/ws.py#L146-L155
signalfx/signalfx-python
signalfx/signalflow/ws.py
WebSocketTransport.closed
def closed(self, code, reason=None): """Handler called when the WebSocket is closed. Status code 1000 denotes a normal close; all others are errors.""" if code != 1000: self._error = errors.SignalFlowException(code, reason) _logger.info('Lost WebSocket connection with %s ...
python
def closed(self, code, reason=None): """Handler called when the WebSocket is closed. Status code 1000 denotes a normal close; all others are errors.""" if code != 1000: self._error = errors.SignalFlowException(code, reason) _logger.info('Lost WebSocket connection with %s ...
Handler called when the WebSocket is closed. Status code 1000 denotes a normal close; all others are errors.
https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/ws.py#L276-L288
signalfx/signalfx-python
signalfx/aws.py
get_aws_unique_id
def get_aws_unique_id(timeout=DEFAULT_AWS_TIMEOUT): """Determine the current AWS unique ID Args: timeout (int): How long to wait for a response from AWS metadata IP """ try: resp = requests.get(AWS_ID_URL, timeout=timeout).json() except requests.exceptions.ConnectTimeout: _l...
python
def get_aws_unique_id(timeout=DEFAULT_AWS_TIMEOUT): """Determine the current AWS unique ID Args: timeout (int): How long to wait for a response from AWS metadata IP """ try: resp = requests.get(AWS_ID_URL, timeout=timeout).json() except requests.exceptions.ConnectTimeout: _l...
Determine the current AWS unique ID Args: timeout (int): How long to wait for a response from AWS metadata IP
https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/aws.py#L37-L53
adafruit/Adafruit_CircuitPython_PCA9685
adafruit_pca9685.py
PWMChannel.duty_cycle
def duty_cycle(self): """16 bit value that dictates how much of one cycle is high (1) versus low (0). 0xffff will always be high, 0 will always be low and 0x7fff will be half high and then half low.""" pwm = self._pca.pwm_regs[self._index] if pwm[0] == 0x1000: return 0xfff...
python
def duty_cycle(self): """16 bit value that dictates how much of one cycle is high (1) versus low (0). 0xffff will always be high, 0 will always be low and 0x7fff will be half high and then half low.""" pwm = self._pca.pwm_regs[self._index] if pwm[0] == 0x1000: return 0xfff...
16 bit value that dictates how much of one cycle is high (1) versus low (0). 0xffff will always be high, 0 will always be low and 0x7fff will be half high and then half low.
https://github.com/adafruit/Adafruit_CircuitPython_PCA9685/blob/7693aa8d6bc2934943bd511dea347ed5c61d5488/adafruit_pca9685.py#L78-L84
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
fft
def fft(a, n=None, axis=-1, norm=None): """ Compute the one-dimensional discrete Fourier Transform. This function computes the one-dimensional *n*-point discrete Fourier Transform (DFT) with the efficient Fast Fourier Transform (FFT) algorithm [CT]. Parameters ---------- a : array_like...
python
def fft(a, n=None, axis=-1, norm=None): """ Compute the one-dimensional discrete Fourier Transform. This function computes the one-dimensional *n*-point discrete Fourier Transform (DFT) with the efficient Fast Fourier Transform (FFT) algorithm [CT]. Parameters ---------- a : array_like...
Compute the one-dimensional discrete Fourier Transform. This function computes the one-dimensional *n*-point discrete Fourier Transform (DFT) with the efficient Fast Fourier Transform (FFT) algorithm [CT]. Parameters ---------- a : array_like Input array, can be complex. n : int, o...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L73-L161
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
ifft
def ifft(a, n=None, axis=-1, norm=None): """ Compute the one-dimensional inverse discrete Fourier Transform. This function computes the inverse of the one-dimensional *n*-point discrete Fourier transform computed by `fft`. In other words, ``ifft(fft(a)) == a`` to within numerical accuracy. For...
python
def ifft(a, n=None, axis=-1, norm=None): """ Compute the one-dimensional inverse discrete Fourier Transform. This function computes the inverse of the one-dimensional *n*-point discrete Fourier transform computed by `fft`. In other words, ``ifft(fft(a)) == a`` to within numerical accuracy. For...
Compute the one-dimensional inverse discrete Fourier Transform. This function computes the inverse of the one-dimensional *n*-point discrete Fourier transform computed by `fft`. In other words, ``ifft(fft(a)) == a`` to within numerical accuracy. For a general description of the algorithm and definitio...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L164-L247
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
rfft
def rfft(a, n=None, axis=-1, norm=None): """ Compute the one-dimensional discrete Fourier Transform for real input. This function computes the one-dimensional *n*-point discrete Fourier Transform (DFT) of a real-valued array by means of an efficient algorithm called the Fast Fourier Transform (FFT)...
python
def rfft(a, n=None, axis=-1, norm=None): """ Compute the one-dimensional discrete Fourier Transform for real input. This function computes the one-dimensional *n*-point discrete Fourier Transform (DFT) of a real-valued array by means of an efficient algorithm called the Fast Fourier Transform (FFT)...
Compute the one-dimensional discrete Fourier Transform for real input. This function computes the one-dimensional *n*-point discrete Fourier Transform (DFT) of a real-valued array by means of an efficient algorithm called the Fast Fourier Transform (FFT). Parameters ---------- a : array_like ...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L250-L334
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
irfft
def irfft(a, n=None, axis=-1, norm=None): """ Compute the inverse of the n-point DFT for real input. This function computes the inverse of the one-dimensional *n*-point discrete Fourier Transform of real input computed by `rfft`. In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical ...
python
def irfft(a, n=None, axis=-1, norm=None): """ Compute the inverse of the n-point DFT for real input. This function computes the inverse of the one-dimensional *n*-point discrete Fourier Transform of real input computed by `rfft`. In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical ...
Compute the inverse of the n-point DFT for real input. This function computes the inverse of the one-dimensional *n*-point discrete Fourier Transform of real input computed by `rfft`. In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical accuracy. (See Notes below for why ``len(a)`` is ne...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L337-L419
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
hfft
def hfft(a, n=None, axis=-1, norm=None): """ Compute the FFT of a signal which has Hermitian symmetry (real spectrum). Parameters ---------- a : array_like The input array. n : int, optional Length of the transformed axis of the output. For `n` output points, ``n//2+1`` ...
python
def hfft(a, n=None, axis=-1, norm=None): """ Compute the FFT of a signal which has Hermitian symmetry (real spectrum). Parameters ---------- a : array_like The input array. n : int, optional Length of the transformed axis of the output. For `n` output points, ``n//2+1`` ...
Compute the FFT of a signal which has Hermitian symmetry (real spectrum). Parameters ---------- a : array_like The input array. n : int, optional Length of the transformed axis of the output. For `n` output points, ``n//2+1`` input points are necessary. If the input is ...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L422-L496
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
ihfft
def ihfft(a, n=None, axis=-1, norm=None): """ Compute the inverse FFT of a signal which has Hermitian symmetry. Parameters ---------- a : array_like Input array. n : int, optional Length of the inverse FFT. Number of points along transformation axis in the input to use. ...
python
def ihfft(a, n=None, axis=-1, norm=None): """ Compute the inverse FFT of a signal which has Hermitian symmetry. Parameters ---------- a : array_like Input array. n : int, optional Length of the inverse FFT. Number of points along transformation axis in the input to use. ...
Compute the inverse FFT of a signal which has Hermitian symmetry. Parameters ---------- a : array_like Input array. n : int, optional Length of the inverse FFT. Number of points along transformation axis in the input to use. If `n` is smaller than the length of the input...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L499-L555
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
fftn
def fftn(a, s=None, axes=None, norm=None): """ Compute the N-dimensional discrete Fourier Transform. This function computes the *N*-dimensional discrete Fourier Transform over any number of axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). Parameters ----------...
python
def fftn(a, s=None, axes=None, norm=None): """ Compute the N-dimensional discrete Fourier Transform. This function computes the *N*-dimensional discrete Fourier Transform over any number of axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). Parameters ----------...
Compute the N-dimensional discrete Fourier Transform. This function computes the *N*-dimensional discrete Fourier Transform over any number of axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). Parameters ---------- a : array_like Input array, can be complex...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L584-L679
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
ifftn
def ifftn(a, s=None, axes=None, norm=None): """ Compute the N-dimensional inverse discrete Fourier Transform. This function computes the inverse of the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). In other ...
python
def ifftn(a, s=None, axes=None, norm=None): """ Compute the N-dimensional inverse discrete Fourier Transform. This function computes the inverse of the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). In other ...
Compute the N-dimensional inverse discrete Fourier Transform. This function computes the inverse of the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). In other words, ``ifftn(fftn(a)) == a`` to within numerical a...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L682-L778
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
fft2
def fft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional discrete Fourier Transform This function computes the *n*-dimensional discrete Fourier Transform over any axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). By default, the transform is compute...
python
def fft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional discrete Fourier Transform This function computes the *n*-dimensional discrete Fourier Transform over any axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). By default, the transform is compute...
Compute the 2-dimensional discrete Fourier Transform This function computes the *n*-dimensional discrete Fourier Transform over any axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). By default, the transform is computed over the last two axes of the input array, i.e., a 2-...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L781-L867
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
ifft2
def ifft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional inverse discrete Fourier Transform. This function computes the inverse of the 2-dimensional discrete Fourier Transform over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). In ot...
python
def ifft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional inverse discrete Fourier Transform. This function computes the inverse of the 2-dimensional discrete Fourier Transform over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). In ot...
Compute the 2-dimensional inverse discrete Fourier Transform. This function computes the inverse of the 2-dimensional discrete Fourier Transform over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). In other words, ``ifft2(fft2(a)) == a`` to within numerical a...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L870-L953
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
rfftn
def rfftn(a, s=None, axes=None, norm=None): """ Compute the N-dimensional discrete Fourier Transform for real input. This function computes the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional real array by means of the Fast Fourier Transform (FFT). By default, ...
python
def rfftn(a, s=None, axes=None, norm=None): """ Compute the N-dimensional discrete Fourier Transform for real input. This function computes the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional real array by means of the Fast Fourier Transform (FFT). By default, ...
Compute the N-dimensional discrete Fourier Transform for real input. This function computes the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional real array by means of the Fast Fourier Transform (FFT). By default, all axes are transformed, with the real transform pe...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L956-L1047
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
rfft2
def rfft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional FFT of a real array. Parameters ---------- a : array Input array, taken to be real. s : sequence of ints, optional Shape of the FFT. axes : sequence of ints, optional Axes over which to com...
python
def rfft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional FFT of a real array. Parameters ---------- a : array Input array, taken to be real. s : sequence of ints, optional Shape of the FFT. axes : sequence of ints, optional Axes over which to com...
Compute the 2-dimensional FFT of a real array. Parameters ---------- a : array Input array, taken to be real. s : sequence of ints, optional Shape of the FFT. axes : sequence of ints, optional Axes over which to compute the FFT. norm : {None, "ortho"}, optional ....
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L1050-L1083
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
irfftn
def irfftn(a, s=None, axes=None, norm=None): """ Compute the inverse of the N-dimensional FFT of real input. This function computes the inverse of the N-dimensional discrete Fourier Transform for real input over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FF...
python
def irfftn(a, s=None, axes=None, norm=None): """ Compute the inverse of the N-dimensional FFT of real input. This function computes the inverse of the N-dimensional discrete Fourier Transform for real input over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FF...
Compute the inverse of the N-dimensional FFT of real input. This function computes the inverse of the N-dimensional discrete Fourier Transform for real input over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). In other words, ``irfftn(rfftn(a), a.shape) == a...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L1086-L1173
IntelPython/mkl_fft
mkl_fft/_numpy_fft.py
irfft2
def irfft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional inverse FFT of a real array. Parameters ---------- a : array_like The input array s : sequence of ints, optional Shape of the inverse FFT. axes : sequence of ints, optional The axes over w...
python
def irfft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional inverse FFT of a real array. Parameters ---------- a : array_like The input array s : sequence of ints, optional Shape of the inverse FFT. axes : sequence of ints, optional The axes over w...
Compute the 2-dimensional inverse FFT of a real array. Parameters ---------- a : array_like The input array s : sequence of ints, optional Shape of the inverse FFT. axes : sequence of ints, optional The axes over which to compute the inverse fft. Default is the last ...
https://github.com/IntelPython/mkl_fft/blob/54b3271d64666f9af9f11418b4ca43d69054eb94/mkl_fft/_numpy_fft.py#L1176-L1209
alerta/python-alerta-client
alertaclient/commands/cmd_blackout.py
cli
def cli(obj, environment, service, resource, event, group, tags, customer, start, duration, text, delete): """Suppress alerts for specified duration based on alert attributes.""" client = obj['client'] if delete: client.delete_blackout(delete) else: if not environment: raise ...
python
def cli(obj, environment, service, resource, event, group, tags, customer, start, duration, text, delete): """Suppress alerts for specified duration based on alert attributes.""" client = obj['client'] if delete: client.delete_blackout(delete) else: if not environment: raise ...
Suppress alerts for specified duration based on alert attributes.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_blackout.py#L19-L43
alerta/python-alerta-client
alertaclient/commands/cmd_key.py
cli
def cli(obj, username, scopes, duration, text, customer, delete): """Create or delete an API key.""" client = obj['client'] if delete: client.delete_key(delete) else: try: expires = datetime.utcnow() + timedelta(seconds=duration) if duration else None key = client...
python
def cli(obj, username, scopes, duration, text, customer, delete): """Create or delete an API key.""" client = obj['client'] if delete: client.delete_key(delete) else: try: expires = datetime.utcnow() + timedelta(seconds=duration) if duration else None key = client...
Create or delete an API key.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_key.py#L15-L27
alerta/python-alerta-client
alertaclient/commands/cmd_customer.py
cli
def cli(obj, customer, match, delete): """Add group/org/domain/role-to-customer or delete lookup entry.""" client = obj['client'] if delete: client.delete_customer(delete) else: if not customer: raise click.UsageError('Missing option "--customer".') if not match: ...
python
def cli(obj, customer, match, delete): """Add group/org/domain/role-to-customer or delete lookup entry.""" client = obj['client'] if delete: client.delete_customer(delete) else: if not customer: raise click.UsageError('Missing option "--customer".') if not match: ...
Add group/org/domain/role-to-customer or delete lookup entry.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_customer.py#L11-L26
alerta/python-alerta-client
alertaclient/commands/cmd_user.py
cli
def cli(obj, id, name, email, password, status, roles, text, email_verified, delete): """Create user or update user details, including password reset.""" client = obj['client'] if delete: client.delete_user(delete) elif id: if not any([name, email, password, status, roles, text, email_ve...
python
def cli(obj, id, name, email, password, status, roles, text, email_verified, delete): """Create user or update user details, including password reset.""" client = obj['client'] if delete: client.delete_user(delete) elif id: if not any([name, email, password, status, roles, text, email_ve...
Create user or update user details, including password reset.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_user.py#L32-L66
alerta/python-alerta-client
alertaclient/commands/cmd_version.py
cli
def cli(ctx, obj): """Show Alerta server and client versions.""" client = obj['client'] click.echo('alerta {}'.format(client.mgmt_status()['version'])) click.echo('alerta client {}'.format(client_version)) click.echo('requests {}'.format(requests_version)) click.echo('click {}'.format(click.__ve...
python
def cli(ctx, obj): """Show Alerta server and client versions.""" client = obj['client'] click.echo('alerta {}'.format(client.mgmt_status()['version'])) click.echo('alerta client {}'.format(client_version)) click.echo('requests {}'.format(requests_version)) click.echo('click {}'.format(click.__ve...
Show Alerta server and client versions.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_version.py#L11-L18
alerta/python-alerta-client
alertaclient/commands/cmd_whoami.py
cli
def cli(obj, show_userinfo): """Display logged in user or full userinfo.""" client = obj['client'] userinfo = client.userinfo() if show_userinfo: for k, v in userinfo.items(): if isinstance(v, list): v = ', '.join(v) click.echo('{:20}: {}'.format(k, v)) ...
python
def cli(obj, show_userinfo): """Display logged in user or full userinfo.""" client = obj['client'] userinfo = client.userinfo() if show_userinfo: for k, v in userinfo.items(): if isinstance(v, list): v = ', '.join(v) click.echo('{:20}: {}'.format(k, v)) ...
Display logged in user or full userinfo.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_whoami.py#L8-L18
alerta/python-alerta-client
alertaclient/commands/cmd_config.py
cli
def cli(obj): """Display client config downloaded from API server.""" for k, v in obj.items(): if isinstance(v, list): v = ', '.join(v) click.echo('{:20}: {}'.format(k, v))
python
def cli(obj): """Display client config downloaded from API server.""" for k, v in obj.items(): if isinstance(v, list): v = ', '.join(v) click.echo('{:20}: {}'.format(k, v))
Display client config downloaded from API server.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_config.py#L7-L12
alerta/python-alerta-client
alertaclient/commands/cmd_users.py
cli
def cli(obj, roles): """List users.""" client = obj['client'] query = [('roles', r) for r in roles] if obj['output'] == 'json': r = client.http.get('/users', query) click.echo(json.dumps(r['users'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezon...
python
def cli(obj, roles): """List users.""" client = obj['client'] query = [('roles', r) for r in roles] if obj['output'] == 'json': r = client.http.get('/users', query) click.echo(json.dumps(r['users'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezon...
List users.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_users.py#L11-L25
alerta/python-alerta-client
alertaclient/commands/cmd_delete.py
cli
def cli(obj, ids, query, filters): """Delete alerts.""" client = obj['client'] if ids: total = len(ids) else: if not (query or filters): click.confirm('Deleting all alerts. Do you want to continue?', abort=True) if query: query = [('q', query)] els...
python
def cli(obj, ids, query, filters): """Delete alerts.""" client = obj['client'] if ids: total = len(ids) else: if not (query or filters): click.confirm('Deleting all alerts. Do you want to continue?', abort=True) if query: query = [('q', query)] els...
Delete alerts.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_delete.py#L11-L28
alerta/python-alerta-client
alertaclient/commands/cmd_uptime.py
cli
def cli(obj): """Display API server uptime in days, hours.""" client = obj['client'] status = client.mgmt_status() now = datetime.fromtimestamp(int(status['time']) / 1000.0) uptime = datetime(1, 1, 1) + timedelta(seconds=int(status['uptime']) / 1000.0) click.echo('{} up {} days {:02d}:{:02d}'....
python
def cli(obj): """Display API server uptime in days, hours.""" client = obj['client'] status = client.mgmt_status() now = datetime.fromtimestamp(int(status['time']) / 1000.0) uptime = datetime(1, 1, 1) + timedelta(seconds=int(status['uptime']) / 1000.0) click.echo('{} up {} days {:02d}:{:02d}'....
Display API server uptime in days, hours.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_uptime.py#L9-L20
alerta/python-alerta-client
alertaclient/commands/cmd_query.py
cli
def cli(obj, ids, query, filters, display, from_date=None): """Query for alerts based on search filter criteria.""" client = obj['client'] timezone = obj['timezone'] if ids: query = [('id', x) for x in ids] elif query: query = [('q', query)] else: query = build_query(filt...
python
def cli(obj, ids, query, filters, display, from_date=None): """Query for alerts based on search filter criteria.""" client = obj['client'] timezone = obj['timezone'] if ids: query = [('id', x) for x in ids] elif query: query = [('q', query)] else: query = build_query(filt...
Query for alerts based on search filter criteria.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_query.py#L28-L112
alerta/python-alerta-client
alertaclient/commands/cmd_untag.py
cli
def cli(obj, ids, query, filters, tags): """Remove tags from alerts.""" client = obj['client'] if ids: total = len(ids) else: if query: query = [('q', query)] else: query = build_query(filters) total, _, _ = client.get_count(query) ids = [a...
python
def cli(obj, ids, query, filters, tags): """Remove tags from alerts.""" client = obj['client'] if ids: total = len(ids) else: if query: query = [('q', query)] else: query = build_query(filters) total, _, _ = client.get_count(query) ids = [a...
Remove tags from alerts.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_untag.py#L12-L27
alerta/python-alerta-client
alertaclient/commands/cmd_watch.py
cli
def cli(ctx, ids, query, filters, details, interval): """Watch for new alerts.""" if details: display = 'details' else: display = 'compact' from_date = None auto_refresh = True while auto_refresh: try: auto_refresh, from_date = ctx.invoke(query_cmd, ids=ids, ...
python
def cli(ctx, ids, query, filters, details, interval): """Watch for new alerts.""" if details: display = 'details' else: display = 'compact' from_date = None auto_refresh = True while auto_refresh: try: auto_refresh, from_date = ctx.invoke(query_cmd, ids=ids, ...
Watch for new alerts.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_watch.py#L17-L32
alerta/python-alerta-client
alertaclient/commands/cmd_status.py
cli
def cli(obj): """Display API server switch status and usage metrics.""" client = obj['client'] metrics = client.mgmt_status()['metrics'] headers = {'title': 'METRIC', 'type': 'TYPE', 'name': 'NAME', 'value': 'VALUE', 'average': 'AVERAGE'} click.echo(tabulate([{ 'title': m['title'], '...
python
def cli(obj): """Display API server switch status and usage metrics.""" client = obj['client'] metrics = client.mgmt_status()['metrics'] headers = {'title': 'METRIC', 'type': 'TYPE', 'name': 'NAME', 'value': 'VALUE', 'average': 'AVERAGE'} click.echo(tabulate([{ 'title': m['title'], '...
Display API server switch status and usage metrics.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_status.py#L8-L19
alerta/python-alerta-client
alertaclient/commands/cmd_update.py
cli
def cli(obj, ids, query, filters, attributes): """Update alert attributes.""" client = obj['client'] if ids: total = len(ids) else: if query: query = [('q', query)] else: query = build_query(filters) total, _, _ = client.get_count(query) id...
python
def cli(obj, ids, query, filters, attributes): """Update alert attributes.""" client = obj['client'] if ids: total = len(ids) else: if query: query = [('q', query)] else: query = build_query(filters) total, _, _ = client.get_count(query) id...
Update alert attributes.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_update.py#L12-L27
alerta/python-alerta-client
alertaclient/commands/cmd_perms.py
cli
def cli(obj, scopes): """List permissions.""" client = obj['client'] query = [('scopes', s) for s in scopes] if obj['output'] == 'json': r = client.http.get('/perms', query) click.echo(json.dumps(r['permissions'], sort_keys=True, indent=4, ensure_ascii=False)) else: headers ...
python
def cli(obj, scopes): """List permissions.""" client = obj['client'] query = [('scopes', s) for s in scopes] if obj['output'] == 'json': r = client.http.get('/perms', query) click.echo(json.dumps(r['permissions'], sort_keys=True, indent=4, ensure_ascii=False)) else: headers ...
List permissions.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_perms.py#L11-L21
alerta/python-alerta-client
alertaclient/commands/cmd_login.py
cli
def cli(obj, username): """Authenticate using Azure, Github, Gitlab, Google OAuth2, OpenID or Basic Auth username/password instead of using an API key.""" client = obj['client'] provider = obj['provider'] client_id = obj['client_id'] try: if provider == 'azure': token = azur...
python
def cli(obj, username): """Authenticate using Azure, Github, Gitlab, Google OAuth2, OpenID or Basic Auth username/password instead of using an API key.""" client = obj['client'] provider = obj['provider'] client_id = obj['client_id'] try: if provider == 'azure': token = azur...
Authenticate using Azure, Github, Gitlab, Google OAuth2, OpenID or Basic Auth username/password instead of using an API key.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_login.py#L15-L53
alerta/python-alerta-client
alertaclient/auth/utils.py
dump_netrc
def dump_netrc(self): """Dump the class data in the format of a .netrc file.""" rep = '' for host in self.hosts.keys(): attrs = self.hosts[host] rep = rep + 'machine ' + host + '\n\tlogin ' + str(attrs[0]) + '\n' if attrs[1]: rep = rep + 'account ' + str(attrs[1]) ...
python
def dump_netrc(self): """Dump the class data in the format of a .netrc file.""" rep = '' for host in self.hosts.keys(): attrs = self.hosts[host] rep = rep + 'machine ' + host + '\n\tlogin ' + str(attrs[0]) + '\n' if attrs[1]: rep = rep + 'account ' + str(attrs[1]) ...
Dump the class data in the format of a .netrc file.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/auth/utils.py#L53-L67
alerta/python-alerta-client
alertaclient/commands/cmd_heartbeat.py
cli
def cli(obj, origin, tags, timeout, customer, delete): """Send or delete a heartbeat.""" client = obj['client'] if delete: client.delete_heartbeat(delete) else: try: heartbeat = client.heartbeat(origin=origin, tags=tags, timeout=timeout, customer=customer) except Exce...
python
def cli(obj, origin, tags, timeout, customer, delete): """Send or delete a heartbeat.""" client = obj['client'] if delete: client.delete_heartbeat(delete) else: try: heartbeat = client.heartbeat(origin=origin, tags=tags, timeout=timeout, customer=customer) except Exce...
Send or delete a heartbeat.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_heartbeat.py#L17-L28
alerta/python-alerta-client
alertaclient/commands/cmd_customers.py
cli
def cli(obj): """List customer lookups.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/customers') click.echo(json.dumps(r['customers'], sort_keys=True, indent=4, ensure_ascii=False)) else: headers = {'id': 'ID', 'customer': 'CUSTOMER', 'match': 'GRO...
python
def cli(obj): """List customer lookups.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/customers') click.echo(json.dumps(r['customers'], sort_keys=True, indent=4, ensure_ascii=False)) else: headers = {'id': 'ID', 'customer': 'CUSTOMER', 'match': 'GRO...
List customer lookups.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_customers.py#L10-L19
alerta/python-alerta-client
alertaclient/commands/cmd_send.py
cli
def cli(obj, resource, event, environment, severity, correlate, service, group, value, text, tags, attributes, origin, type, timeout, raw_data, customer): """Send an alert.""" client = obj['client'] def send_alert(resource, event, **kwargs): try: id, alert, message = client.send_alert( ...
python
def cli(obj, resource, event, environment, severity, correlate, service, group, value, text, tags, attributes, origin, type, timeout, raw_data, customer): """Send an alert.""" client = obj['client'] def send_alert(resource, event, **kwargs): try: id, alert, message = client.send_alert( ...
Send an alert.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_send.py#L27-L97
alerta/python-alerta-client
alertaclient/commands/cmd_keys.py
cli
def cli(obj): """List API keys.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/keys') click.echo(json.dumps(r['keys'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] headers = { 'id': 'ID', 'key': ...
python
def cli(obj): """List API keys.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/keys') click.echo(json.dumps(r['keys'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] headers = { 'id': 'ID', 'key': ...
List API keys.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_keys.py#L10-L23
alerta/python-alerta-client
alertaclient/commands/cmd_perm.py
cli
def cli(obj, role, scopes, delete): """Add or delete role-to-permission lookup entry.""" client = obj['client'] if delete: client.delete_perm(delete) else: if not role: raise click.UsageError('Missing option "--role".') if not scopes: raise click.UsageErro...
python
def cli(obj, role, scopes, delete): """Add or delete role-to-permission lookup entry.""" client = obj['client'] if delete: client.delete_perm(delete) else: if not role: raise click.UsageError('Missing option "--role".') if not scopes: raise click.UsageErro...
Add or delete role-to-permission lookup entry.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_perm.py#L11-L26
alerta/python-alerta-client
alertaclient/commands/cmd_top.py
cli
def cli(obj): """Display alerts like unix "top" command.""" client = obj['client'] timezone = obj['timezone'] screen = Screen(client, timezone) screen.run()
python
def cli(obj): """Display alerts like unix "top" command.""" client = obj['client'] timezone = obj['timezone'] screen = Screen(client, timezone) screen.run()
Display alerts like unix "top" command.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_top.py#L9-L15
alerta/python-alerta-client
alertaclient/commands/cmd_heartbeats.py
cli
def cli(obj, alert, severity, timeout, purge): """List heartbeats.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/heartbeats') click.echo(json.dumps(r['heartbeats'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] ...
python
def cli(obj, alert, severity, timeout, purge): """List heartbeats.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/heartbeats') click.echo(json.dumps(r['heartbeats'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] ...
List heartbeats.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_heartbeats.py#L16-L93
alerta/python-alerta-client
alertaclient/commands/cmd_housekeeping.py
cli
def cli(obj, expired=None, info=None): """Trigger the expiration and deletion of alerts.""" client = obj['client'] client.housekeeping(expired_delete_hours=expired, info_delete_hours=info)
python
def cli(obj, expired=None, info=None): """Trigger the expiration and deletion of alerts.""" client = obj['client'] client.housekeeping(expired_delete_hours=expired, info_delete_hours=info)
Trigger the expiration and deletion of alerts.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_housekeeping.py#L10-L13
alerta/python-alerta-client
alertaclient/commands/cmd_blackouts.py
cli
def cli(obj, purge): """List alert suppressions.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/blackouts') click.echo(json.dumps(r['blackouts'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] headers = { ...
python
def cli(obj, purge): """List alert suppressions.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/blackouts') click.echo(json.dumps(r['blackouts'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] headers = { ...
List alert suppressions.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_blackouts.py#L11-L33
alerta/python-alerta-client
alertaclient/commands/cmd_signup.py
cli
def cli(obj, name, email, password, status, text): """Create new Basic Auth user.""" client = obj['client'] if not email: raise click.UsageError('Need "--email" to sign-up new user.') if not password: raise click.UsageError('Need "--password" to sign-up new user.') try: r = c...
python
def cli(obj, name, email, password, status, text): """Create new Basic Auth user.""" client = obj['client'] if not email: raise click.UsageError('Need "--email" to sign-up new user.') if not password: raise click.UsageError('Need "--password" to sign-up new user.') try: r = c...
Create new Basic Auth user.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_signup.py#L15-L30
alerta/python-alerta-client
alertaclient/cli.py
cli
def cli(ctx, config_file, profile, endpoint_url, output, color, debug): """ Alerta client unified command-line tool. """ config = Config(config_file) config.get_config_for_profle(profile) config.get_remote_config(endpoint_url) ctx.obj = config.options # override current options with co...
python
def cli(ctx, config_file, profile, endpoint_url, output, color, debug): """ Alerta client unified command-line tool. """ config = Config(config_file) config.get_config_for_profle(profile) config.get_remote_config(endpoint_url) ctx.obj = config.options # override current options with co...
Alerta client unified command-line tool.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/cli.py#L48-L72
alerta/python-alerta-client
alertaclient/commands/cmd_raw.py
cli
def cli(obj, ids, query, filters): """Show raw data for alerts.""" client = obj['client'] if ids: query = [('id', x) for x in ids] elif query: query = [('q', query)] else: query = build_query(filters) alerts = client.search(query) headers = {'id': 'ID', 'rawData': 'R...
python
def cli(obj, ids, query, filters): """Show raw data for alerts.""" client = obj['client'] if ids: query = [('id', x) for x in ids] elif query: query = [('q', query)] else: query = build_query(filters) alerts = client.search(query) headers = {'id': 'ID', 'rawData': 'R...
Show raw data for alerts.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_raw.py#L13-L26
alerta/python-alerta-client
alertaclient/commands/cmd_me.py
cli
def cli(obj, name, email, password, status, text): """Update current user details, including password reset.""" if not any([name, email, password, status, text]): click.echo('Nothing to update.') sys.exit(1) client = obj['client'] try: r = client.update_me(name=name, email=email...
python
def cli(obj, name, email, password, status, text): """Update current user details, including password reset.""" if not any([name, email, password, status, text]): click.echo('Nothing to update.') sys.exit(1) client = obj['client'] try: r = client.update_me(name=name, email=email...
Update current user details, including password reset.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_me.py#L15-L30
alerta/python-alerta-client
alertaclient/commands/cmd_history.py
cli
def cli(obj, ids, query, filters): """Show status and severity changes for alerts.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/alerts/history') click.echo(json.dumps(r['history'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj...
python
def cli(obj, ids, query, filters): """Show status and severity changes for alerts.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/alerts/history') click.echo(json.dumps(r['history'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj...
Show status and severity changes for alerts.
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_history.py#L15-L36
antiboredom/audiogrep
audiogrep/audiogrep.py
convert_to_wav
def convert_to_wav(files): '''Converts files to a format that pocketsphinx can deal wtih (16khz mono 16bit wav)''' converted = [] for f in files: new_name = f + '.temp.wav' print(new_name) if (os.path.exists(f + '.transcription.txt') is False) and (os.path.exists(new_name) is False):...
python
def convert_to_wav(files): '''Converts files to a format that pocketsphinx can deal wtih (16khz mono 16bit wav)''' converted = [] for f in files: new_name = f + '.temp.wav' print(new_name) if (os.path.exists(f + '.transcription.txt') is False) and (os.path.exists(new_name) is False):...
Converts files to a format that pocketsphinx can deal wtih (16khz mono 16bit wav)
https://github.com/antiboredom/audiogrep/blob/0553d5429e1035d7482a2498759523e67cdd2568/audiogrep/audiogrep.py#L21-L30
antiboredom/audiogrep
audiogrep/audiogrep.py
transcribe
def transcribe(files=[], pre=10, post=50): '''Uses pocketsphinx to transcribe audio files''' total = len(files) for i, f in enumerate(files): filename = f.replace('.temp.wav', '') + '.transcription.txt' if os.path.exists(filename) is False: print(str(i+1) + '/' + str(total) + ...
python
def transcribe(files=[], pre=10, post=50): '''Uses pocketsphinx to transcribe audio files''' total = len(files) for i, f in enumerate(files): filename = f.replace('.temp.wav', '') + '.transcription.txt' if os.path.exists(filename) is False: print(str(i+1) + '/' + str(total) + ...
Uses pocketsphinx to transcribe audio files
https://github.com/antiboredom/audiogrep/blob/0553d5429e1035d7482a2498759523e67cdd2568/audiogrep/audiogrep.py#L33-L48
antiboredom/audiogrep
audiogrep/audiogrep.py
convert_timestamps
def convert_timestamps(files): '''Converts pocketsphinx transcriptions to usable timestamps''' sentences = [] for f in files: if not f.endswith('.transcription.txt'): f = f + '.transcription.txt' if os.path.exists(f) is False: continue with open(f, 'r') a...
python
def convert_timestamps(files): '''Converts pocketsphinx transcriptions to usable timestamps''' sentences = [] for f in files: if not f.endswith('.transcription.txt'): f = f + '.transcription.txt' if os.path.exists(f) is False: continue with open(f, 'r') a...
Converts pocketsphinx transcriptions to usable timestamps
https://github.com/antiboredom/audiogrep/blob/0553d5429e1035d7482a2498759523e67cdd2568/audiogrep/audiogrep.py#L67-L110
antiboredom/audiogrep
audiogrep/audiogrep.py
text
def text(files): '''Returns the whole transcribed text''' sentences = convert_timestamps(files) out = [] for s in sentences: out.append(' '.join([w[0] for w in s['words']])) return '\n'.join(out)
python
def text(files): '''Returns the whole transcribed text''' sentences = convert_timestamps(files) out = [] for s in sentences: out.append(' '.join([w[0] for w in s['words']])) return '\n'.join(out)
Returns the whole transcribed text
https://github.com/antiboredom/audiogrep/blob/0553d5429e1035d7482a2498759523e67cdd2568/audiogrep/audiogrep.py#L113-L119
antiboredom/audiogrep
audiogrep/audiogrep.py
search
def search(query, files, mode='sentence', regex=False): '''Searches for words or sentences containing a search phrase''' out = [] sentences = convert_timestamps(files) if mode == 'fragment': out = fragment_search(query, sentences, regex) elif mode == 'word': out = word_search(query,...
python
def search(query, files, mode='sentence', regex=False): '''Searches for words or sentences containing a search phrase''' out = [] sentences = convert_timestamps(files) if mode == 'fragment': out = fragment_search(query, sentences, regex) elif mode == 'word': out = word_search(query,...
Searches for words or sentences containing a search phrase
https://github.com/antiboredom/audiogrep/blob/0553d5429e1035d7482a2498759523e67cdd2568/audiogrep/audiogrep.py#L122-L137
antiboredom/audiogrep
audiogrep/audiogrep.py
extract_words
def extract_words(files): ''' Extracts individual words form files and exports them to individual files. ''' output_directory = 'extracted_words' if not os.path.exists(output_directory): os.makedirs(output_directory) for f in files: file_format = None source_segment = None ...
python
def extract_words(files): ''' Extracts individual words form files and exports them to individual files. ''' output_directory = 'extracted_words' if not os.path.exists(output_directory): os.makedirs(output_directory) for f in files: file_format = None source_segment = None ...
Extracts individual words form files and exports them to individual files.
https://github.com/antiboredom/audiogrep/blob/0553d5429e1035d7482a2498759523e67cdd2568/audiogrep/audiogrep.py#L140-L180
antiboredom/audiogrep
audiogrep/audiogrep.py
compose
def compose(segments, out='out.mp3', padding=0, crossfade=0, layer=False): '''Stiches together a new audiotrack''' files = {} working_segments = [] audio = AudioSegment.empty() if layer: total_time = max([s['end'] - s['start'] for s in segments]) * 1000 audio = AudioSegment.silen...
python
def compose(segments, out='out.mp3', padding=0, crossfade=0, layer=False): '''Stiches together a new audiotrack''' files = {} working_segments = [] audio = AudioSegment.empty() if layer: total_time = max([s['end'] - s['start'] for s in segments]) * 1000 audio = AudioSegment.silen...
Stiches together a new audiotrack
https://github.com/antiboredom/audiogrep/blob/0553d5429e1035d7482a2498759523e67cdd2568/audiogrep/audiogrep.py#L314-L359
yueyoum/social-oauth
example/_bottle.py
cookie_encode
def cookie_encode(data, key): ''' Encode and sign a pickle-able object. Return a (byte) string ''' msg = base64.b64encode(pickle.dumps(data, -1)) sig = base64.b64encode(hmac.new(tob(key), msg).digest()) return tob('!') + sig + tob('?') + msg
python
def cookie_encode(data, key): ''' Encode and sign a pickle-able object. Return a (byte) string ''' msg = base64.b64encode(pickle.dumps(data, -1)) sig = base64.b64encode(hmac.new(tob(key), msg).digest()) return tob('!') + sig + tob('?') + msg
Encode and sign a pickle-able object. Return a (byte) string
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1939-L1943
yueyoum/social-oauth
example/_bottle.py
cookie_decode
def cookie_decode(data, key): ''' Verify and decode an encoded string. Return an object or None.''' data = tob(data) if cookie_is_encoded(data): sig, msg = data.split(tob('?'), 1) if _lscmp(sig[1:], base64.b64encode(hmac.new(tob(key), msg).digest())): return pickle.loads(base64.b...
python
def cookie_decode(data, key): ''' Verify and decode an encoded string. Return an object or None.''' data = tob(data) if cookie_is_encoded(data): sig, msg = data.split(tob('?'), 1) if _lscmp(sig[1:], base64.b64encode(hmac.new(tob(key), msg).digest())): return pickle.loads(base64.b...
Verify and decode an encoded string. Return an object or None.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1946-L1953
yueyoum/social-oauth
example/_bottle.py
load
def load(target, **namespace): """ Import a module or fetch an object from a module. * ``package.module`` returns `module` as a module object. * ``pack.mod:name`` returns the module variable `name` from `pack.mod`. * ``pack.mod:func()`` calls `pack.mod.func()` and returns the result. ...
python
def load(target, **namespace): """ Import a module or fetch an object from a module. * ``package.module`` returns `module` as a module object. * ``pack.mod:name`` returns the module variable `name` from `pack.mod`. * ``pack.mod:func()`` calls `pack.mod.func()` and returns the result. ...
Import a module or fetch an object from a module. * ``package.module`` returns `module` as a module object. * ``pack.mod:name`` returns the module variable `name` from `pack.mod`. * ``pack.mod:func()`` calls `pack.mod.func()` and returns the result. The last form accepts not only funct...
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L2316-L2333
yueyoum/social-oauth
example/_bottle.py
Router.add
def add(self, rule, method, target, name=None): ''' Add a new route or replace the target for an existing route. ''' if rule in self.rules: self.rules[rule][method] = target if name: self.builder[name] = self.builder[rule] return target = self.rules[rule] = {...
python
def add(self, rule, method, target, name=None): ''' Add a new route or replace the target for an existing route. ''' if rule in self.rules: self.rules[rule][method] = target if name: self.builder[name] = self.builder[rule] return target = self.rules[rule] = {...
Add a new route or replace the target for an existing route.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L338-L400
yueyoum/social-oauth
example/_bottle.py
Router.match
def match(self, environ): ''' Return a (target, url_agrs) tuple or raise HTTPError(400/404/405). ''' path, targets, urlargs = environ['PATH_INFO'] or '/', None, {} if path in self.static: targets = self.static[path] else: for combined, rules in self.dynamic: ...
python
def match(self, environ): ''' Return a (target, url_agrs) tuple or raise HTTPError(400/404/405). ''' path, targets, urlargs = environ['PATH_INFO'] or '/', None, {} if path in self.static: targets = self.static[path] else: for combined, rules in self.dynamic: ...
Return a (target, url_agrs) tuple or raise HTTPError(400/404/405).
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L413-L439
yueyoum/social-oauth
example/_bottle.py
Route.all_plugins
def all_plugins(self): ''' Yield all Plugins affecting this route. ''' unique = set() for p in reversed(self.app.plugins + self.plugins): if True in self.skiplist: break name = getattr(p, 'name', False) if name and (name in self.skiplist or name in unique): co...
python
def all_plugins(self): ''' Yield all Plugins affecting this route. ''' unique = set() for p in reversed(self.app.plugins + self.plugins): if True in self.skiplist: break name = getattr(p, 'name', False) if name and (name in self.skiplist or name in unique): co...
Yield all Plugins affecting this route.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L499-L508
yueyoum/social-oauth
example/_bottle.py
Bottle.reset
def reset(self, route=None): ''' Reset all routes (force plugins to be re-applied) and clear all caches. If an ID or route object is given, only that specific route is affected. ''' if route is None: routes = self.routes elif isinstance(route, Route): routes = [route] ...
python
def reset(self, route=None): ''' Reset all routes (force plugins to be re-applied) and clear all caches. If an ID or route object is given, only that specific route is affected. ''' if route is None: routes = self.routes elif isinstance(route, Route): routes = [route] ...
Reset all routes (force plugins to be re-applied) and clear all caches. If an ID or route object is given, only that specific route is affected.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L624-L634
yueyoum/social-oauth
example/_bottle.py
Bottle.route
def route(self, path=None, method='GET', callback=None, name=None, apply=None, skip=None, **config): """ A decorator to bind a function to a request URL. Example:: @app.route('/hello/:name') def hello(name): return 'Hello %s' % name ...
python
def route(self, path=None, method='GET', callback=None, name=None, apply=None, skip=None, **config): """ A decorator to bind a function to a request URL. Example:: @app.route('/hello/:name') def hello(name): return 'Hello %s' % name ...
A decorator to bind a function to a request URL. Example:: @app.route('/hello/:name') def hello(name): return 'Hello %s' % name The ``:name`` part is a wildcard. See :class:`Router` for syntax details. :param path: Request path o...
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L654-L696
yueyoum/social-oauth
example/_bottle.py
Bottle._cast
def _cast(self, out, request, response, peek=None): """ Try to convert the parameter into something WSGI compatible and set correct HTTP headers when possible. Support: False, str, unicode, dict, HTTPResponse, HTTPError, file-like, iterable of strings and iterable of unicodes """...
python
def _cast(self, out, request, response, peek=None): """ Try to convert the parameter into something WSGI compatible and set correct HTTP headers when possible. Support: False, str, unicode, dict, HTTPResponse, HTTPError, file-like, iterable of strings and iterable of unicodes """...
Try to convert the parameter into something WSGI compatible and set correct HTTP headers when possible. Support: False, str, unicode, dict, HTTPResponse, HTTPError, file-like, iterable of strings and iterable of unicodes
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L758-L823
yueyoum/social-oauth
example/_bottle.py
Bottle.wsgi
def wsgi(self, environ, start_response): """ The bottle WSGI-interface. """ try: environ['bottle.app'] = self request.bind(environ) response.bind() out = self._cast(self._handle(environ), request, response) # rfc2616 section 4.3 if ...
python
def wsgi(self, environ, start_response): """ The bottle WSGI-interface. """ try: environ['bottle.app'] = self request.bind(environ) response.bind() out = self._cast(self._handle(environ), request, response) # rfc2616 section 4.3 if ...
The bottle WSGI-interface.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L825-L852
yueyoum/social-oauth
example/_bottle.py
BaseRequest.get_cookie
def get_cookie(self, key, default=None, secret=None): """ Return the content of a cookie. To read a `Signed Cookie`, the `secret` must match the one used to create the cookie (see :meth:`BaseResponse.set_cookie`). If anything goes wrong (missing cookie or wrong signature), re...
python
def get_cookie(self, key, default=None, secret=None): """ Return the content of a cookie. To read a `Signed Cookie`, the `secret` must match the one used to create the cookie (see :meth:`BaseResponse.set_cookie`). If anything goes wrong (missing cookie or wrong signature), re...
Return the content of a cookie. To read a `Signed Cookie`, the `secret` must match the one used to create the cookie (see :meth:`BaseResponse.set_cookie`). If anything goes wrong (missing cookie or wrong signature), return a default value.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L913-L922
yueyoum/social-oauth
example/_bottle.py
BaseRequest.forms
def forms(self): """ Form values parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The result is retuned as a :class:`FormsDict`. All keys and values are strings. File uploads are stored separately in :attr:`files`. """ forms = Fo...
python
def forms(self): """ Form values parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The result is retuned as a :class:`FormsDict`. All keys and values are strings. File uploads are stored separately in :attr:`files`. """ forms = Fo...
Form values parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The result is retuned as a :class:`FormsDict`. All keys and values are strings. File uploads are stored separately in :attr:`files`.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L937-L946
yueyoum/social-oauth
example/_bottle.py
BaseRequest.params
def params(self): """ A :class:`FormsDict` with the combined values of :attr:`query` and :attr:`forms`. File uploads are stored in :attr:`files`. """ params = FormsDict() for key, value in self.query.iterallitems(): params[key] = value for key, value in self.forms...
python
def params(self): """ A :class:`FormsDict` with the combined values of :attr:`query` and :attr:`forms`. File uploads are stored in :attr:`files`. """ params = FormsDict() for key, value in self.query.iterallitems(): params[key] = value for key, value in self.forms...
A :class:`FormsDict` with the combined values of :attr:`query` and :attr:`forms`. File uploads are stored in :attr:`files`.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L949-L957
yueyoum/social-oauth
example/_bottle.py
BaseRequest.files
def files(self): """ File uploads parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The values are instances of :class:`cgi.FieldStorage`. The most important attributes are: filename The filename, if specified; otherwise ...
python
def files(self): """ File uploads parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The values are instances of :class:`cgi.FieldStorage`. The most important attributes are: filename The filename, if specified; otherwise ...
File uploads parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The values are instances of :class:`cgi.FieldStorage`. The most important attributes are: filename The filename, if specified; otherwise None; this is the client ...
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L960-L980
yueyoum/social-oauth
example/_bottle.py
BaseRequest.json
def json(self): ''' If the ``Content-Type`` header is ``application/json``, this property holds the parsed content of the request body. Only requests smaller than :attr:`MEMFILE_MAX` are processed to avoid memory exhaustion. ''' if 'application/json' in self.environ.g...
python
def json(self): ''' If the ``Content-Type`` header is ``application/json``, this property holds the parsed content of the request body. Only requests smaller than :attr:`MEMFILE_MAX` are processed to avoid memory exhaustion. ''' if 'application/json' in self.environ.g...
If the ``Content-Type`` header is ``application/json``, this property holds the parsed content of the request body. Only requests smaller than :attr:`MEMFILE_MAX` are processed to avoid memory exhaustion.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L983-L991
yueyoum/social-oauth
example/_bottle.py
BaseRequest.POST
def POST(self): """ The values of :attr:`forms` and :attr:`files` combined into a single :class:`FormsDict`. Values are either strings (form values) or instances of :class:`cgi.FieldStorage` (file uploads). """ post = FormsDict() # We default to application/x-www-...
python
def POST(self): """ The values of :attr:`forms` and :attr:`files` combined into a single :class:`FormsDict`. Values are either strings (form values) or instances of :class:`cgi.FieldStorage` (file uploads). """ post = FormsDict() # We default to application/x-www-...
The values of :attr:`forms` and :attr:`files` combined into a single :class:`FormsDict`. Values are either strings (form values) or instances of :class:`cgi.FieldStorage` (file uploads).
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1021-L1048
yueyoum/social-oauth
example/_bottle.py
BaseRequest.auth
def auth(self): """ HTTP authentication data as a (user, password) tuple. This implementation currently supports basic (not digest) authentication only. If the authentication happened at a higher level (e.g. in the front web-server or a middleware), the password field is None...
python
def auth(self): """ HTTP authentication data as a (user, password) tuple. This implementation currently supports basic (not digest) authentication only. If the authentication happened at a higher level (e.g. in the front web-server or a middleware), the password field is None...
HTTP authentication data as a (user, password) tuple. This implementation currently supports basic (not digest) authentication only. If the authentication happened at a higher level (e.g. in the front web-server or a middleware), the password field is None, but the user f...
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1138-L1149
yueyoum/social-oauth
example/_bottle.py
BaseRequest.remote_route
def remote_route(self): """ A list of all IPs that were involved in this request, starting with the client IP and followed by zero or more proxies. This does only work if all proxies support the ```X-Forwarded-For`` header. Note that this information can be forged by maliciou...
python
def remote_route(self): """ A list of all IPs that were involved in this request, starting with the client IP and followed by zero or more proxies. This does only work if all proxies support the ```X-Forwarded-For`` header. Note that this information can be forged by maliciou...
A list of all IPs that were involved in this request, starting with the client IP and followed by zero or more proxies. This does only work if all proxies support the ```X-Forwarded-For`` header. Note that this information can be forged by malicious clients.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1152-L1160
yueyoum/social-oauth
example/_bottle.py
BaseResponse.headers
def headers(self): ''' An instance of :class:`HeaderDict`, a case-insensitive dict-like view on the response headers. ''' self.__dict__['headers'] = hdict = HeaderDict() hdict.dict = self._headers return hdict
python
def headers(self): ''' An instance of :class:`HeaderDict`, a case-insensitive dict-like view on the response headers. ''' self.__dict__['headers'] = hdict = HeaderDict() hdict.dict = self._headers return hdict
An instance of :class:`HeaderDict`, a case-insensitive dict-like view on the response headers.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1303-L1308
yueyoum/social-oauth
example/_bottle.py
BaseResponse.get_header
def get_header(self, name, default=None): ''' Return the value of a previously defined header. If there is no header with that name, return a default value. ''' return self._headers.get(_hkey(name), [default])[-1]
python
def get_header(self, name, default=None): ''' Return the value of a previously defined header. If there is no header with that name, return a default value. ''' return self._headers.get(_hkey(name), [default])[-1]
Return the value of a previously defined header. If there is no header with that name, return a default value.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1315-L1318
yueyoum/social-oauth
example/_bottle.py
BaseResponse.set_header
def set_header(self, name, value, append=False): ''' Create a new response header, replacing any previously defined headers with the same name. ''' if append: self.add_header(name, value) else: self._headers[_hkey(name)] = [str(value)]
python
def set_header(self, name, value, append=False): ''' Create a new response header, replacing any previously defined headers with the same name. ''' if append: self.add_header(name, value) else: self._headers[_hkey(name)] = [str(value)]
Create a new response header, replacing any previously defined headers with the same name.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1320-L1326
yueyoum/social-oauth
example/_bottle.py
BaseResponse.iter_headers
def iter_headers(self): ''' Yield (header, value) tuples, skipping headers that are not allowed with the current response status code. ''' headers = self._headers.iteritems() bad_headers = self.bad_headers.get(self.status_code) if bad_headers: headers = [h for h i...
python
def iter_headers(self): ''' Yield (header, value) tuples, skipping headers that are not allowed with the current response status code. ''' headers = self._headers.iteritems() bad_headers = self.bad_headers.get(self.status_code) if bad_headers: headers = [h for h i...
Yield (header, value) tuples, skipping headers that are not allowed with the current response status code.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1332-L1344
yueyoum/social-oauth
example/_bottle.py
BaseResponse.COOKIES
def COOKIES(self): """ A dict-like SimpleCookie instance. This should not be used directly. See :meth:`set_cookie`. """ depr('The COOKIES dict is deprecated. Use `set_cookie()` instead.') # 0.10 if not self._cookies: self._cookies = SimpleCookie() return self._coo...
python
def COOKIES(self): """ A dict-like SimpleCookie instance. This should not be used directly. See :meth:`set_cookie`. """ depr('The COOKIES dict is deprecated. Use `set_cookie()` instead.') # 0.10 if not self._cookies: self._cookies = SimpleCookie() return self._coo...
A dict-like SimpleCookie instance. This should not be used directly. See :meth:`set_cookie`.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1366-L1372
yueyoum/social-oauth
example/_bottle.py
HooksPlugin.remove
def remove(self, name, func): ''' Remove a callback from a hook. ''' was_empty = self._empty() if name in self.hooks and func in self.hooks[name]: self.hooks[name].remove(func) if self.app and not was_empty and self._empty(): self.app.reset()
python
def remove(self, name, func): ''' Remove a callback from a hook. ''' was_empty = self._empty() if name in self.hooks and func in self.hooks[name]: self.hooks[name].remove(func) if self.app and not was_empty and self._empty(): self.app.reset()
Remove a callback from a hook.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1512-L1517
yueyoum/social-oauth
example/_bottle.py
HooksPlugin.trigger
def trigger(self, name, *a, **ka): ''' Trigger a hook and return a list of results. ''' hooks = self.hooks[name] if ka.pop('reversed', False): hooks = hooks[::-1] return [hook(*a, **ka) for hook in hooks]
python
def trigger(self, name, *a, **ka): ''' Trigger a hook and return a list of results. ''' hooks = self.hooks[name] if ka.pop('reversed', False): hooks = hooks[::-1] return [hook(*a, **ka) for hook in hooks]
Trigger a hook and return a list of results.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1519-L1523
yueyoum/social-oauth
example/_bottle.py
MultiDict.get
def get(self, key, default=None, index=-1, type=None): ''' Return the most recent value for a key. :param default: The default value to be returned if the key is not present or the type conversion fails. :param index: An index for the list of available values. ...
python
def get(self, key, default=None, index=-1, type=None): ''' Return the most recent value for a key. :param default: The default value to be returned if the key is not present or the type conversion fails. :param index: An index for the list of available values. ...
Return the most recent value for a key. :param default: The default value to be returned if the key is not present or the type conversion fails. :param index: An index for the list of available values. :param type: If defined, this callable is used to cast the val...
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1621-L1636
yueyoum/social-oauth
example/_bottle.py
BaseTemplate.search
def search(cls, name, lookup=[]): """ Search name in all directories specified in lookup. First without, then with common extensions. Return first hit. """ if os.path.isfile(name): return name for spath in lookup: fname = os.path.join(spath, name) if os.path.isfil...
python
def search(cls, name, lookup=[]): """ Search name in all directories specified in lookup. First without, then with common extensions. Return first hit. """ if os.path.isfile(name): return name for spath in lookup: fname = os.path.join(spath, name) if os.path.isfil...
Search name in all directories specified in lookup. First without, then with common extensions. Return first hit.
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L2524-L2534
yueyoum/social-oauth
socialoauth/sites/base.py
OAuth2.authorize_url
def authorize_url(self): """Rewrite this property method If there are more arguments need attach to the url. Like bellow: class NewSubClass(OAuth2): @property def authorize_url(self): url = super(NewSubClass, self).authorize_url ...
python
def authorize_url(self): """Rewrite this property method If there are more arguments need attach to the url. Like bellow: class NewSubClass(OAuth2): @property def authorize_url(self): url = super(NewSubClass, self).authorize_url ...
Rewrite this property method If there are more arguments need attach to the url. Like bellow: class NewSubClass(OAuth2): @property def authorize_url(self): url = super(NewSubClass, self).authorize_url url += '&blabla' ...
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/socialoauth/sites/base.py#L105-L124
yueyoum/social-oauth
socialoauth/sites/base.py
OAuth2.get_access_token
def get_access_token(self, code, method='POST', parse=True): """parse is True means that the api return a json string. So, the result will be parsed by json library. Most sites will follow this rule, return a json string. But some sites (e.g. Tencent), Will return an non json string, ...
python
def get_access_token(self, code, method='POST', parse=True): """parse is True means that the api return a json string. So, the result will be parsed by json library. Most sites will follow this rule, return a json string. But some sites (e.g. Tencent), Will return an non json string, ...
parse is True means that the api return a json string. So, the result will be parsed by json library. Most sites will follow this rule, return a json string. But some sites (e.g. Tencent), Will return an non json string, This sites MUST set parse=False when call this method, And...
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/socialoauth/sites/base.py#L127-L153
facebookarchive/react-python
react/jsx.py
JSXTransformer.transform_string
def transform_string(self, jsx, harmony=False, strip_types=False): """ Transform ``jsx`` JSX string into javascript :param jsx: JSX source code :type jsx: basestring :keyword harmony: Transform ES6 code into ES3 (default: False) :type harmony: bool :keyword strip_types: ...
python
def transform_string(self, jsx, harmony=False, strip_types=False): """ Transform ``jsx`` JSX string into javascript :param jsx: JSX source code :type jsx: basestring :keyword harmony: Transform ES6 code into ES3 (default: False) :type harmony: bool :keyword strip_types: ...
Transform ``jsx`` JSX string into javascript :param jsx: JSX source code :type jsx: basestring :keyword harmony: Transform ES6 code into ES3 (default: False) :type harmony: bool :keyword strip_types: Strip type declarations (default: False) :type harmony: bool :r...
https://github.com/facebookarchive/react-python/blob/9cf987067a8750b3540adbcac2798e2284391446/react/jsx.py#L28-L47
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.pool
def pool(self, host, port, db, pools={}, **options): ''' Fetch a redis conenction pool for the unique combination of host and port. Will create a new one if there isn't one already. ''' key = (host, port, db) rval = pools.get(key) if not isinstance(rval, Connectio...
python
def pool(self, host, port, db, pools={}, **options): ''' Fetch a redis conenction pool for the unique combination of host and port. Will create a new one if there isn't one already. ''' key = (host, port, db) rval = pools.get(key) if not isinstance(rval, Connectio...
Fetch a redis conenction pool for the unique combination of host and port. Will create a new one if there isn't one already.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L35-L46
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.rank_member
def rank_member(self, member, score, member_data=None): ''' Rank a member in the leaderboard. @param member [String] Member name. @param score [float] Member score. @param member_data [String] Optional member data. ''' self.rank_member_in(self.leaderboard_name, m...
python
def rank_member(self, member, score, member_data=None): ''' Rank a member in the leaderboard. @param member [String] Member name. @param score [float] Member score. @param member_data [String] Optional member data. ''' self.rank_member_in(self.leaderboard_name, m...
Rank a member in the leaderboard. @param member [String] Member name. @param score [float] Member score. @param member_data [String] Optional member data.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L117-L125
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.rank_member_in
def rank_member_in( self, leaderboard_name, member, score, member_data=None): ''' Rank a member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @param score [float] Member score. @param m...
python
def rank_member_in( self, leaderboard_name, member, score, member_data=None): ''' Rank a member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @param score [float] Member score. @param m...
Rank a member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @param score [float] Member score. @param member_data [String] Optional member data.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L127-L147
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.rank_member_if
def rank_member_if( self, rank_conditional, member, score, member_data=None): ''' Rank a member in the leaderboard based on execution of the +rank_conditional+. The +rank_conditional+ is passed the following parameters: member: Member name. current_score: Current...
python
def rank_member_if( self, rank_conditional, member, score, member_data=None): ''' Rank a member in the leaderboard based on execution of the +rank_conditional+. The +rank_conditional+ is passed the following parameters: member: Member name. current_score: Current...
Rank a member in the leaderboard based on execution of the +rank_conditional+. The +rank_conditional+ is passed the following parameters: member: Member name. current_score: Current score for the member in the leaderboard. score: Member score. member_data: Optional membe...
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L172-L194
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.rank_member_if_in
def rank_member_if_in( self, leaderboard_name, rank_conditional, member, score, member_data=None): ''' Rank a member in the named leaderboard based on execution of the +rank_conditional+. The +rank_conditional+ is passed th...
python
def rank_member_if_in( self, leaderboard_name, rank_conditional, member, score, member_data=None): ''' Rank a member in the named leaderboard based on execution of the +rank_conditional+. The +rank_conditional+ is passed th...
Rank a member in the named leaderboard based on execution of the +rank_conditional+. The +rank_conditional+ is passed the following parameters: member: Member name. current_score: Current score for the member in the leaderboard. score: Member score. member_data: Optional...
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L196-L224
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.rank_members_in
def rank_members_in(self, leaderboard_name, members_and_scores): ''' Rank an array of members in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param members_and_scores [Array] Variable list of members and scores. ''' pipeline = self.re...
python
def rank_members_in(self, leaderboard_name, members_and_scores): ''' Rank an array of members in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param members_and_scores [Array] Variable list of members and scores. ''' pipeline = self.re...
Rank an array of members in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param members_and_scores [Array] Variable list of members and scores.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L234-L247
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.member_data_for_in
def member_data_for_in(self, leaderboard_name, member): ''' Retrieve the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @return String of optional member data. ...
python
def member_data_for_in(self, leaderboard_name, member): ''' Retrieve the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @return String of optional member data. ...
Retrieve the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @return String of optional member data.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L258-L267
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.members_data_for_in
def members_data_for_in(self, leaderboard_name, members): ''' Retrieve the optional member data for a given list of members in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param members [Array] Member names. @return Array of strings of option...
python
def members_data_for_in(self, leaderboard_name, members): ''' Retrieve the optional member data for a given list of members in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param members [Array] Member names. @return Array of strings of option...
Retrieve the optional member data for a given list of members in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param members [Array] Member names. @return Array of strings of optional member data.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L278-L287
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.update_member_data
def update_member_data(self, member, member_data): ''' Update the optional member data for a given member in the leaderboard. @param member [String] Member name. @param member_data [String] Optional member data. ''' self.update_member_data_in(self.leaderboard_name, membe...
python
def update_member_data(self, member, member_data): ''' Update the optional member data for a given member in the leaderboard. @param member [String] Member name. @param member_data [String] Optional member data. ''' self.update_member_data_in(self.leaderboard_name, membe...
Update the optional member data for a given member in the leaderboard. @param member [String] Member name. @param member_data [String] Optional member data.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L289-L296
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.update_member_data_in
def update_member_data_in(self, leaderboard_name, member, member_data): ''' Update the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @param member_data [String] Opti...
python
def update_member_data_in(self, leaderboard_name, member, member_data): ''' Update the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @param member_data [String] Opti...
Update the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. @param member_data [String] Optional member data.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L298-L309
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.remove_member_data_in
def remove_member_data_in(self, leaderboard_name, member): ''' Remove the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. ''' self.redis_connection.hdel( ...
python
def remove_member_data_in(self, leaderboard_name, member): ''' Remove the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. ''' self.redis_connection.hdel( ...
Remove the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L319-L328
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.remove_member_from
def remove_member_from(self, leaderboard_name, member): ''' Remove the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. ''' pipeline = self.redis_connection.pip...
python
def remove_member_from(self, leaderboard_name, member): ''' Remove the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name. ''' pipeline = self.redis_connection.pip...
Remove the optional member data for a given member in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param member [String] Member name.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L355-L365
agoragames/leaderboard-python
leaderboard/leaderboard.py
Leaderboard.total_pages_in
def total_pages_in(self, leaderboard_name, page_size=None): ''' Retrieve the total number of pages in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param page_size [int, nil] Page size to be used when calculating the total number of pages. @re...
python
def total_pages_in(self, leaderboard_name, page_size=None): ''' Retrieve the total number of pages in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param page_size [int, nil] Page size to be used when calculating the total number of pages. @re...
Retrieve the total number of pages in the named leaderboard. @param leaderboard_name [String] Name of the leaderboard. @param page_size [int, nil] Page size to be used when calculating the total number of pages. @return the total number of pages in the named leaderboard.
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L376-L390