hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5c81f2bfdbd2eaa7d298b615226cb1c401f3ca0b | 187 | py | Python | necromancer/cli/shell_command.py | SeedyROM/necromancer | 3a5d669bf7f6efb97e904431fc2bcce0fd2bc45f | [
"MIT"
] | null | null | null | necromancer/cli/shell_command.py | SeedyROM/necromancer | 3a5d669bf7f6efb97e904431fc2bcce0fd2bc45f | [
"MIT"
] | 11 | 2018-09-29T05:45:19.000Z | 2021-06-01T22:39:29.000Z | necromancer/cli/shell_command.py | SeedyROM/necromancer | 3a5d669bf7f6efb97e904431fc2bcce0fd2bc45f | [
"MIT"
] | 1 | 2018-09-29T05:40:45.000Z | 2018-09-29T05:40:45.000Z | '''
Usage: necro shell|s USER_COMMAND
Options
USER_COMMAND a command in the .necro.toml
'''
from docopt import docopt
if __name__ == '__main__':
print(docopt(__doc__))
| 14.384615 | 52 | 0.679144 | 25 | 187 | 4.52 | 0.76 | 0.19469 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.219251 | 187 | 12 | 53 | 15.583333 | 0.773973 | 0.508021 | 0 | 0 | 0 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
5c86464a3d05f2b2a5448d49a0741fcc1ad75863 | 787 | py | Python | lib/utils.py | ngshiheng/six-percent | 4c99d8f5f51bebd528097a1e8c3ac59cd56c3774 | [
"MIT"
] | 16 | 2019-06-02T08:01:49.000Z | 2022-02-28T00:28:21.000Z | src/utils/encryption.py | ksern94/six-percent | a3eb637d72d47f396945a4488222d63ae93df53d | [
"MIT"
] | 17 | 2019-12-12T10:28:08.000Z | 2022-03-02T01:12:55.000Z | src/utils/encryption.py | ksern94/six-percent | a3eb637d72d47f396945a4488222d63ae93df53d | [
"MIT"
] | 12 | 2019-12-12T10:32:01.000Z | 2021-12-31T15:31:14.000Z | from cryptography.fernet import Fernet
def generate_key() -> None:
"""
Generates a key and save it into a file
"""
key = Fernet.generate_key()
with open("secret.key", "wb") as key_file:
key_file.write(key)
def load_key() -> bytes:
"""
Loads the key named `secret.key` from the current directory
"""
return open("secret.key", "rb").read()
def encrypt_password(password: str) -> str:
"""
Returns an encrypted password
"""
encoded_password = password.encode()
f = Fernet(load_key())
return f.encrypt(encoded_password).decode()
def decrypt_password(hashed_password: str) -> str:
"""
Returns a decrypted password
"""
f = Fernet(load_key())
return f.decrypt(hashed_password.encode()).decode()
| 20.179487 | 63 | 0.635324 | 100 | 787 | 4.87 | 0.44 | 0.055441 | 0.053388 | 0.086242 | 0.086242 | 0.086242 | 0 | 0 | 0 | 0 | 0 | 0 | 0.229987 | 787 | 38 | 64 | 20.710526 | 0.80363 | 0.200762 | 0 | 0.142857 | 1 | 0 | 0.042254 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.357143 | 0.071429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
5c9ae0e7e2b1d18da7e081cb6e3269620f60cbc6 | 210 | py | Python | app/main/errors.py | youhaowei/ifriends-api | 4f4483d91ec7e726a5c301a0c3cc1db1b6592f8f | [
"MIT"
] | null | null | null | app/main/errors.py | youhaowei/ifriends-api | 4f4483d91ec7e726a5c301a0c3cc1db1b6592f8f | [
"MIT"
] | null | null | null | app/main/errors.py | youhaowei/ifriends-api | 4f4483d91ec7e726a5c301a0c3cc1db1b6592f8f | [
"MIT"
] | null | null | null | from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return "404", 404
@main.app_errorhandler(500)
def internal_server_error(e):
return "500", 500
| 16.153846 | 33 | 0.747619 | 32 | 210 | 4.6875 | 0.59375 | 0.093333 | 0.253333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101124 | 0.152381 | 210 | 12 | 34 | 17.5 | 0.741573 | 0 | 0 | 0 | 0 | 0 | 0.028571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
5ca0875014df8ac0785a6721681b3daab627d633 | 1,365 | py | Python | electrum/coins.py | wagerrdeveloper/WagerrElectrum | 06b082a1aa3e831f648c2d27ca35150c8aea97a4 | [
"MIT"
] | null | null | null | electrum/coins.py | wagerrdeveloper/WagerrElectrum | 06b082a1aa3e831f648c2d27ca35150c8aea97a4 | [
"MIT"
] | 2 | 2021-06-02T00:29:07.000Z | 2021-11-15T17:49:27.000Z | electrum/coins.py | wagerrdeveloper/WagerrElectrum | 06b082a1aa3e831f648c2d27ca35150c8aea97a4 | [
"MIT"
] | null | null | null | import sys
class Coin(object):
@classmethod
def static_header_offset(cls, height):
raise Exception('Not implemented')
class Wagerr(Coin):
PRE_ZEROCOIN_BLOCKS = 1
PRE_ZEROCOIN_HEADER_SIZE = 80
ZEROCOIN_HEADER_SIZE = 112
@classmethod
def static_header_offset(cls, height):
if height >= cls.PRE_ZEROCOIN_BLOCKS:
return cls.PRE_ZEROCOIN_HEADER_SIZE * cls.PRE_ZEROCOIN_BLOCKS + cls.ZEROCOIN_HEADER_SIZE * (height - cls.PRE_ZEROCOIN_BLOCKS)
return cls.PRE_ZEROCOIN_HEADER_SIZE * height
def get_header_size(self, header: bytes):
hex_to_int = lambda s: int.from_bytes(s, byteorder='little')
if hex_to_int(header[0:4]) > 3:
return self.ZEROCOIN_HEADER_SIZE
return self.PRE_ZEROCOIN_HEADER_SIZE
@classmethod
def get_header_size_height(cls, height: int):
if height in [1052605]:
return cls.PRE_ZEROCOIN_HEADER_SIZE
return cls.ZEROCOIN_HEADER_SIZE if height >= cls.PRE_ZEROCOIN_BLOCKS else cls.PRE_ZEROCOIN_HEADER_SIZE
def check_header_size(self, header: bytes):
size = self.get_header_size(header)
if len(header) == self.PRE_ZEROCOIN_HEADER_SIZE:
return True
if len(header) == size:
return True
return False
class WagerrTestnet(Wagerr):
PRE_ZEROCOIN_BLOCKS = 1
| 31.744186 | 137 | 0.69011 | 182 | 1,365 | 4.851648 | 0.263736 | 0.1812 | 0.224236 | 0.166478 | 0.441676 | 0.287656 | 0.219706 | 0.12684 | 0.12684 | 0.12684 | 0 | 0.016299 | 0.235897 | 1,365 | 42 | 138 | 32.5 | 0.830297 | 0 | 0 | 0.272727 | 0 | 0 | 0.015385 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.151515 | false | 0 | 0.030303 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5cae12109771869a6ab7219474335cee226eaba9 | 81,854 | py | Python | python/mxnet/symbol/gen_sparse.py | sneaxiy/NVIDIA-MxNet | ce30b18212fbf23f68c006a02cc034e417bb5518 | [
"Apache-2.0"
] | null | null | null | python/mxnet/symbol/gen_sparse.py | sneaxiy/NVIDIA-MxNet | ce30b18212fbf23f68c006a02cc034e417bb5518 | [
"Apache-2.0"
] | null | null | null | python/mxnet/symbol/gen_sparse.py | sneaxiy/NVIDIA-MxNet | ce30b18212fbf23f68c006a02cc034e417bb5518 | [
"Apache-2.0"
] | 3 | 2021-07-20T07:40:15.000Z | 2021-08-03T08:39:17.000Z | # coding: utf-8# File content is auto-generated. Do not modify.
# pylint: skip-file
from ._internal import SymbolBase
from ..base import _Null
def ElementWiseSum(*args, **kwargs):
r"""Adds all input arguments element-wise.
.. math::
add\_n(a_1, a_2, ..., a_n) = a_1 + a_2 + ... + a_n
``add_n`` is potentially more efficient than calling ``add`` by `n` times.
The storage type of ``add_n`` output depends on storage types of inputs
- add_n(row_sparse, row_sparse, ..) = row_sparse
- add_n(default, csr, default) = default
- add_n(any input combinations longer than 4 (>4) with at least one default type) = default
- otherwise, ``add_n`` falls all inputs back to default storage and generates default storage
Defined in ../src/operator/tensor/elemwise_sum.cc:L156
This function support variable length of positional input.
Parameters
----------
args : Symbol[]
Positional input arguments
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def Embedding(data=None, weight=None, input_dim=_Null, output_dim=_Null, dtype=_Null, sparse_grad=_Null, name=None, attr=None, out=None, **kwargs):
r"""Maps integer indices to vector representations (embeddings).
This operator maps words to real-valued vectors in a high-dimensional space,
called word embeddings. These embeddings can capture semantic and syntactic properties of the words.
For example, it has been noted that in the learned embedding spaces, similar words tend
to be close to each other and dissimilar words far apart.
For an input array of shape (d1, ..., dK),
the shape of an output array is (d1, ..., dK, output_dim).
All the input values should be integers in the range [0, input_dim).
If the input_dim is ip0 and output_dim is op0, then shape of the embedding weight matrix must be
(ip0, op0).
When "sparse_grad" is False, if any index mentioned is too large, it is replaced by the index that
addresses the last vector in an embedding matrix.
When "sparse_grad" is True, an error will be raised if invalid indices are found.
Examples::
input_dim = 4
output_dim = 5
// Each row in weight matrix y represents a word. So, y = (w0,w1,w2,w3)
y = [[ 0., 1., 2., 3., 4.],
[ 5., 6., 7., 8., 9.],
[ 10., 11., 12., 13., 14.],
[ 15., 16., 17., 18., 19.]]
// Input array x represents n-grams(2-gram). So, x = [(w1,w3), (w0,w2)]
x = [[ 1., 3.],
[ 0., 2.]]
// Mapped input x to its vector representation y.
Embedding(x, y, 4, 5) = [[[ 5., 6., 7., 8., 9.],
[ 15., 16., 17., 18., 19.]],
[[ 0., 1., 2., 3., 4.],
[ 10., 11., 12., 13., 14.]]]
The storage type of weight can be either row_sparse or default.
.. Note::
If "sparse_grad" is set to True, the storage type of gradient w.r.t weights will be
"row_sparse". Only a subset of optimizers support sparse gradients, including SGD, AdaGrad
and Adam. Note that by default lazy updates is turned on, which may perform differently
from standard updates. For more details, please check the Optimization API at:
https://mxnet.incubator.apache.org/api/python/optimization/optimization.html
Defined in ../src/operator/tensor/indexing_op.cc:L598
Parameters
----------
data : Symbol
The input array to the embedding operator.
weight : Symbol
The embedding weight matrix.
input_dim : int, required
Vocabulary size of the input indices.
output_dim : int, required
Dimension of the embedding vectors.
dtype : {'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
Data type of weight.
sparse_grad : boolean, optional, default=0
Compute row sparse gradient in the backward calculation. If set to True, the grad's storage type is row_sparse.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def FullyConnected(data=None, weight=None, bias=None, num_hidden=_Null, no_bias=_Null, cublas_algo_verbose=_Null, cublas_off=_Null, cublas_tensor_core=_Null, cublas_algo_fwd=_Null, cublas_algo_bwd_data=_Null, cublas_algo_bwd_weights=_Null, cublas_algo_fwd_prec=_Null, cublas_algo_bwd_prec=_Null, flatten=_Null, name=None, attr=None, out=None, **kwargs):
r"""Applies a linear transformation: :math:`Y = XW^T + b`.
If ``flatten`` is set to be true, then the shapes are:
- **data**: `(batch_size, x1, x2, ..., xn)`
- **weight**: `(num_hidden, x1 * x2 * ... * xn)`
- **bias**: `(num_hidden,)`
- **out**: `(batch_size, num_hidden)`
If ``flatten`` is set to be false, then the shapes are:
- **data**: `(x1, x2, ..., xn, input_dim)`
- **weight**: `(num_hidden, input_dim)`
- **bias**: `(num_hidden,)`
- **out**: `(x1, x2, ..., xn, num_hidden)`
The learnable parameters include both ``weight`` and ``bias``.
If ``no_bias`` is set to be true, then the ``bias`` term is ignored.
.. Note::
The sparse support for FullyConnected is limited to forward evaluation with `row_sparse`
weight and bias, where the length of `weight.indices` and `bias.indices` must be equal
to `num_hidden`. This could be useful for model inference with `row_sparse` weights
trained with importance sampling or noise contrastive estimation.
To compute linear transformation with 'csr' sparse data, sparse.dot is recommended instead
of sparse.FullyConnected.
Defined in ../src/operator/nn/fully_connected.cc:L287
Parameters
----------
data : Symbol
Input data.
weight : Symbol
Weight matrix.
bias : Symbol
Bias parameter.
num_hidden : int, required
Number of hidden nodes of the output.
no_bias : boolean, optional, default=0
Whether to disable bias parameter.
cublas_algo_verbose : boolean, optional, default=0
Verboseness of algo selection. true = output selection, false = no output
cublas_off : boolean, optional, default=0
Turn off full-control cublas for this layer.
cublas_tensor_core : boolean or None, optional, default=None
Allow Tensor Core math for default-chosen algos.
cublas_algo_fwd : int or None, optional, default='None'
Specified Forward GEMM Algorithm.
cublas_algo_bwd_data : int or None, optional, default='None'
Specified Backprop-to-Data GEMM Algorithm.
cublas_algo_bwd_weights : int or None, optional, default='None'
Specified Backprop-to-Weights GEMM Algorithm.
cublas_algo_fwd_prec : {'None', 'float16', 'float32', 'float64'},optional, default='None'
Precision of the computation of the forward GEMM kernel.
Default is the tensor data type, or float32 if the tensor data
type is float16.
cublas_algo_bwd_prec : {'None', 'float16', 'float32', 'float64'},optional, default='None'
Precision of the computation of the back-prop kernels.
Default is the tensor data type, or float32 if the tensor data
type is float16.
flatten : boolean, optional, default=1
Whether to collapse all but the first axis of the input data tensor.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def LinearRegressionOutput(data=None, label=None, grad_scale=_Null, name=None, attr=None, out=None, **kwargs):
r"""Computes and optimizes for squared loss during backward propagation.
Just outputs ``data`` during forward propagation.
If :math:`\hat{y}_i` is the predicted value of the i-th sample, and :math:`y_i` is the corresponding target value,
then the squared loss estimated over :math:`n` samples is defined as
:math:`\text{SquaredLoss}(\textbf{Y}, \hat{\textbf{Y}} ) = \frac{1}{n} \sum_{i=0}^{n-1} \lVert \textbf{y}_i - \hat{\textbf{y}}_i \rVert_2`
.. note::
Use the LinearRegressionOutput as the final output layer of a net.
The storage type of ``label`` can be ``default`` or ``csr``
- LinearRegressionOutput(default, default) = default
- LinearRegressionOutput(default, csr) = default
By default, gradients of this loss function are scaled by factor `1/m`, where m is the number of regression outputs of a training example.
The parameter `grad_scale` can be used to change this scale to `grad_scale/m`.
Defined in ../src/operator/regression_output.cc:L92
Parameters
----------
data : Symbol
Input data to the function.
label : Symbol
Input label to the function.
grad_scale : float, optional, default=1
Scale the gradient by a float factor
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def LogisticRegressionOutput(data=None, label=None, grad_scale=_Null, name=None, attr=None, out=None, **kwargs):
r"""Applies a logistic function to the input.
The logistic function, also known as the sigmoid function, is computed as
:math:`\frac{1}{1+exp(-\textbf{x})}`.
Commonly, the sigmoid is used to squash the real-valued output of a linear model
:math:`wTx+b` into the [0,1] range so that it can be interpreted as a probability.
It is suitable for binary classification or probability prediction tasks.
.. note::
Use the LogisticRegressionOutput as the final output layer of a net.
The storage type of ``label`` can be ``default`` or ``csr``
- LogisticRegressionOutput(default, default) = default
- LogisticRegressionOutput(default, csr) = default
The loss function used is the Binary Cross Entropy Loss:
:math:`-{(y\log(p) + (1 - y)\log(1 - p))}`
Where `y` is the ground truth probability of positive outcome for a given example, and `p` the probability predicted by the model. By default, gradients of this loss function are scaled by factor `1/m`, where m is the number of regression outputs of a training example.
The parameter `grad_scale` can be used to change this scale to `grad_scale/m`.
Defined in ../src/operator/regression_output.cc:L152
Parameters
----------
data : Symbol
Input data to the function.
label : Symbol
Input label to the function.
grad_scale : float, optional, default=1
Scale the gradient by a float factor
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def MAERegressionOutput(data=None, label=None, grad_scale=_Null, name=None, attr=None, out=None, **kwargs):
r"""Computes mean absolute error of the input.
MAE is a risk metric corresponding to the expected value of the absolute error.
If :math:`\hat{y}_i` is the predicted value of the i-th sample, and :math:`y_i` is the corresponding target value,
then the mean absolute error (MAE) estimated over :math:`n` samples is defined as
:math:`\text{MAE}(\textbf{Y}, \hat{\textbf{Y}} ) = \frac{1}{n} \sum_{i=0}^{n-1} \lVert \textbf{y}_i - \hat{\textbf{y}}_i \rVert_1`
.. note::
Use the MAERegressionOutput as the final output layer of a net.
The storage type of ``label`` can be ``default`` or ``csr``
- MAERegressionOutput(default, default) = default
- MAERegressionOutput(default, csr) = default
By default, gradients of this loss function are scaled by factor `1/m`, where m is the number of regression outputs of a training example.
The parameter `grad_scale` can be used to change this scale to `grad_scale/m`.
Defined in ../src/operator/regression_output.cc:L120
Parameters
----------
data : Symbol
Input data to the function.
label : Symbol
Input label to the function.
grad_scale : float, optional, default=1
Scale the gradient by a float factor
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def _contrib_round_ste(data=None, name=None, attr=None, out=None, **kwargs):
r"""Straight-through-estimator of `round()`.
In forward pass, returns element-wise rounded value to the nearest integer of the input (same as `round()`).
In backward pass, returns gradients of ``1`` everywhere (instead of ``0`` everywhere as in `round()`):
:math:`\frac{d}{dx}{round\_ste(x)} = 1` vs. :math:`\frac{d}{dx}{round(x)} = 0`.
This is useful for quantized training.
Reference: Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation.
Example::
x = round_ste([-1.5, 1.5, -1.9, 1.9, 2.7])
x.backward()
x = [-2., 2., -2., 2., 3.]
x.grad() = [1., 1., 1., 1., 1.]
The storage type of ``round_ste`` output depends upon the input storage type:
- round_ste(default) = default
- round_ste(row_sparse) = row_sparse
- round_ste(csr) = csr
Defined in ../src/operator/contrib/stes_op.cc:L55
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def _contrib_sign_ste(data=None, name=None, attr=None, out=None, **kwargs):
r"""Straight-through-estimator of `sign()`.
In forward pass, returns element-wise sign of the input (same as `sign()`).
In backward pass, returns gradients of ``1`` everywhere (instead of ``0`` everywhere as in ``sign()``):
:math:`\frac{d}{dx}{sign\_ste(x)} = 1` vs. :math:`\frac{d}{dx}{sign(x)} = 0`.
This is useful for quantized training.
Reference: Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation.
Example::
x = sign_ste([-2, 0, 3])
x.backward()
x = [-1., 0., 1.]
x.grad() = [1., 1., 1.]
The storage type of ``sign_ste`` output depends upon the input storage type:
- round_ste(default) = default
- round_ste(row_sparse) = row_sparse
- round_ste(csr) = csr
Defined in ../src/operator/contrib/stes_op.cc:L80
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def abs(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise absolute value of the input.
Example::
abs([-2, 0, 3]) = [2, 0, 3]
The storage type of ``abs`` output depends upon the input storage type:
- abs(default) = default
- abs(row_sparse) = row_sparse
- abs(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L720
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def adagrad_update(weight=None, grad=None, history=None, lr=_Null, epsilon=_Null, wd=_Null, rescale_grad=_Null, clip_gradient=_Null, name=None, attr=None, out=None, **kwargs):
r"""Update function for AdaGrad optimizer.
Referenced from *Adaptive Subgradient Methods for Online Learning and Stochastic Optimization*,
and available at http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf.
Updates are applied by::
rescaled_grad = clip(grad * rescale_grad, clip_gradient)
history = history + square(rescaled_grad)
w = w - learning_rate * rescaled_grad / sqrt(history + epsilon)
Note that non-zero values for the weight decay option are not supported.
Defined in ../src/operator/optimizer_op.cc:L978
Parameters
----------
weight : Symbol
Weight
grad : Symbol
Gradient
history : Symbol
History
lr : float, required
Learning rate
epsilon : float, optional, default=1.00000001e-07
epsilon
wd : float, optional, default=0
weight decay
rescale_grad : float, optional, default=1
Rescale gradient to grad = rescale_grad*grad.
clip_gradient : float, optional, default=-1
Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def adam_update(weight=None, grad=None, mean=None, var=None, lr=_Null, beta1=_Null, beta2=_Null, epsilon=_Null, wd=_Null, rescale_grad=_Null, clip_gradient=_Null, lazy_update=_Null, name=None, attr=None, out=None, **kwargs):
r"""Update function for Adam optimizer. Adam is seen as a generalization
of AdaGrad.
Adam update consists of the following steps, where g represents gradient and m, v
are 1st and 2nd order moment estimates (mean and variance).
.. math::
g_t = \nabla J(W_{t-1})\\
m_t = \beta_1 m_{t-1} + (1 - \beta_1) g_t\\
v_t = \beta_2 v_{t-1} + (1 - \beta_2) g_t^2\\
W_t = W_{t-1} - \alpha \frac{ m_t }{ \sqrt{ v_t } + \epsilon }
It updates the weights using::
m = beta1*m + (1-beta1)*grad
v = beta2*v + (1-beta2)*(grad**2)
w += - learning_rate * m / (sqrt(v) + epsilon)
However, if grad's storage type is ``row_sparse``, ``lazy_update`` is True and the storage
type of weight is the same as those of m and v,
only the row slices whose indices appear in grad.indices are updated (for w, m and v)::
for row in grad.indices:
m[row] = beta1*m[row] + (1-beta1)*grad[row]
v[row] = beta2*v[row] + (1-beta2)*(grad[row]**2)
w[row] += - learning_rate * m[row] / (sqrt(v[row]) + epsilon)
Defined in ../src/operator/optimizer_op.cc:L686
Parameters
----------
weight : Symbol
Weight
grad : Symbol
Gradient
mean : Symbol
Moving mean
var : Symbol
Moving variance
lr : float, required
Learning rate
beta1 : float, optional, default=0.899999976
The decay rate for the 1st moment estimates.
beta2 : float, optional, default=0.999000013
The decay rate for the 2nd moment estimates.
epsilon : float, optional, default=9.99999994e-09
A small constant for numerical stability.
wd : float, optional, default=0
Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.
rescale_grad : float, optional, default=1
Rescale gradient to grad = rescale_grad*grad.
clip_gradient : float, optional, default=-1
Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).
lazy_update : boolean, optional, default=1
If true, lazy updates are applied if gradient's stype is row_sparse and all of w, m and v have the same stype
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def add_n(*args, **kwargs):
r"""Adds all input arguments element-wise.
.. math::
add\_n(a_1, a_2, ..., a_n) = a_1 + a_2 + ... + a_n
``add_n`` is potentially more efficient than calling ``add`` by `n` times.
The storage type of ``add_n`` output depends on storage types of inputs
- add_n(row_sparse, row_sparse, ..) = row_sparse
- add_n(default, csr, default) = default
- add_n(any input combinations longer than 4 (>4) with at least one default type) = default
- otherwise, ``add_n`` falls all inputs back to default storage and generates default storage
Defined in ../src/operator/tensor/elemwise_sum.cc:L156
This function support variable length of positional input.
Parameters
----------
args : Symbol[]
Positional input arguments
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def arccos(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise inverse cosine of the input array.
The input should be in range `[-1, 1]`.
The output is in the closed interval :math:`[0, \pi]`
.. math::
arccos([-1, -.707, 0, .707, 1]) = [\pi, 3\pi/4, \pi/2, \pi/4, 0]
The storage type of ``arccos`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L233
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def arccosh(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns the element-wise inverse hyperbolic cosine of the input array, \
computed element-wise.
The storage type of ``arccosh`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L535
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def arcsin(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise inverse sine of the input array.
The input should be in the range `[-1, 1]`.
The output is in the closed interval of [:math:`-\pi/2`, :math:`\pi/2`].
.. math::
arcsin([-1, -.707, 0, .707, 1]) = [-\pi/2, -\pi/4, 0, \pi/4, \pi/2]
The storage type of ``arcsin`` output depends upon the input storage type:
- arcsin(default) = default
- arcsin(row_sparse) = row_sparse
- arcsin(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L187
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def arcsinh(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns the element-wise inverse hyperbolic sine of the input array, \
computed element-wise.
The storage type of ``arcsinh`` output depends upon the input storage type:
- arcsinh(default) = default
- arcsinh(row_sparse) = row_sparse
- arcsinh(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L494
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def arctan(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise inverse tangent of the input array.
The output is in the closed interval :math:`[-\pi/2, \pi/2]`
.. math::
arctan([-1, 0, 1]) = [-\pi/4, 0, \pi/4]
The storage type of ``arctan`` output depends upon the input storage type:
- arctan(default) = default
- arctan(row_sparse) = row_sparse
- arctan(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L282
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def arctanh(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns the element-wise inverse hyperbolic tangent of the input array, \
computed element-wise.
The storage type of ``arctanh`` output depends upon the input storage type:
- arctanh(default) = default
- arctanh(row_sparse) = row_sparse
- arctanh(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L579
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def broadcast_add(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise sum of the input arrays with broadcasting.
`broadcast_plus` is an alias to the function `broadcast_add`.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_add(x, y) = [[ 1., 1., 1.],
[ 2., 2., 2.]]
broadcast_plus(x, y) = [[ 1., 1., 1.],
[ 2., 2., 2.]]
Supported sparse operations:
broadcast_add(csr, dense(1D)) = dense
broadcast_add(dense(1D), csr) = dense
Defined in ../src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L58
Parameters
----------
lhs : Symbol
First input to the function
rhs : Symbol
Second input to the function
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def broadcast_div(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise division of the input arrays with broadcasting.
Example::
x = [[ 6., 6., 6.],
[ 6., 6., 6.]]
y = [[ 2.],
[ 3.]]
broadcast_div(x, y) = [[ 3., 3., 3.],
[ 2., 2., 2.]]
Supported sparse operations:
broadcast_div(csr, dense(1D)) = csr
Defined in ../src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L187
Parameters
----------
lhs : Symbol
First input to the function
rhs : Symbol
Second input to the function
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def broadcast_minus(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise difference of the input arrays with broadcasting.
`broadcast_minus` is an alias to the function `broadcast_sub`.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_sub(x, y) = [[ 1., 1., 1.],
[ 0., 0., 0.]]
broadcast_minus(x, y) = [[ 1., 1., 1.],
[ 0., 0., 0.]]
Supported sparse operations:
broadcast_sub/minus(csr, dense(1D)) = dense
broadcast_sub/minus(dense(1D), csr) = dense
Defined in ../src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L106
Parameters
----------
lhs : Symbol
First input to the function
rhs : Symbol
Second input to the function
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def broadcast_mul(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise product of the input arrays with broadcasting.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_mul(x, y) = [[ 0., 0., 0.],
[ 1., 1., 1.]]
Supported sparse operations:
broadcast_mul(csr, dense(1D)) = csr
Defined in ../src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L146
Parameters
----------
lhs : Symbol
First input to the function
rhs : Symbol
Second input to the function
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def broadcast_plus(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise sum of the input arrays with broadcasting.
`broadcast_plus` is an alias to the function `broadcast_add`.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_add(x, y) = [[ 1., 1., 1.],
[ 2., 2., 2.]]
broadcast_plus(x, y) = [[ 1., 1., 1.],
[ 2., 2., 2.]]
Supported sparse operations:
broadcast_add(csr, dense(1D)) = dense
broadcast_add(dense(1D), csr) = dense
Defined in ../src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L58
Parameters
----------
lhs : Symbol
First input to the function
rhs : Symbol
Second input to the function
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def broadcast_sub(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise difference of the input arrays with broadcasting.
`broadcast_minus` is an alias to the function `broadcast_sub`.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_sub(x, y) = [[ 1., 1., 1.],
[ 0., 0., 0.]]
broadcast_minus(x, y) = [[ 1., 1., 1.],
[ 0., 0., 0.]]
Supported sparse operations:
broadcast_sub/minus(csr, dense(1D)) = dense
broadcast_sub/minus(dense(1D), csr) = dense
Defined in ../src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L106
Parameters
----------
lhs : Symbol
First input to the function
rhs : Symbol
Second input to the function
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def cast_storage(data=None, stype=_Null, name=None, attr=None, out=None, **kwargs):
r"""Casts tensor storage type to the new type.
When an NDArray with default storage type is cast to csr or row_sparse storage,
the result is compact, which means:
- for csr, zero values will not be retained
- for row_sparse, row slices of all zeros will not be retained
The storage type of ``cast_storage`` output depends on stype parameter:
- cast_storage(csr, 'default') = default
- cast_storage(row_sparse, 'default') = default
- cast_storage(default, 'csr') = csr
- cast_storage(default, 'row_sparse') = row_sparse
- cast_storage(csr, 'csr') = csr
- cast_storage(row_sparse, 'row_sparse') = row_sparse
Example::
dense = [[ 0., 1., 0.],
[ 2., 0., 3.],
[ 0., 0., 0.],
[ 0., 0., 0.]]
# cast to row_sparse storage type
rsp = cast_storage(dense, 'row_sparse')
rsp.indices = [0, 1]
rsp.values = [[ 0., 1., 0.],
[ 2., 0., 3.]]
# cast to csr storage type
csr = cast_storage(dense, 'csr')
csr.indices = [1, 0, 2]
csr.values = [ 1., 2., 3.]
csr.indptr = [0, 1, 3, 3, 3]
Defined in ../src/operator/tensor/cast_storage.cc:L71
Parameters
----------
data : Symbol
The input.
stype : {'csr', 'default', 'row_sparse'}, required
Output storage type.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def cbrt(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise cube-root value of the input.
.. math::
cbrt(x) = \sqrt[3]{x}
Example::
cbrt([1, 8, -125]) = [1, 2, -5]
The storage type of ``cbrt`` output depends upon the input storage type:
- cbrt(default) = default
- cbrt(row_sparse) = row_sparse
- cbrt(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_pow.cc:L270
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def ceil(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise ceiling of the input.
The ceil of the scalar x is the smallest integer i, such that i >= x.
Example::
ceil([-2.1, -1.9, 1.5, 1.9, 2.1]) = [-2., -1., 2., 2., 3.]
The storage type of ``ceil`` output depends upon the input storage type:
- ceil(default) = default
- ceil(row_sparse) = row_sparse
- ceil(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L815
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def clip(data=None, a_min=_Null, a_max=_Null, name=None, attr=None, out=None, **kwargs):
r"""Clips (limits) the values in an array.
Given an interval, values outside the interval are clipped to the interval edges.
Clipping ``x`` between `a_min` and `a_max` would be::
.. math::
clip(x, a_min, a_max) = \max(\min(x, a_max), a_min))
Example::
x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
clip(x,1,8) = [ 1., 1., 2., 3., 4., 5., 6., 7., 8., 8.]
The storage type of ``clip`` output depends on storage types of inputs and the a_min, a_max \
parameter values:
- clip(default) = default
- clip(row_sparse, a_min <= 0, a_max >= 0) = row_sparse
- clip(csr, a_min <= 0, a_max >= 0) = csr
- clip(row_sparse, a_min < 0, a_max < 0) = default
- clip(row_sparse, a_min > 0, a_max > 0) = default
- clip(csr, a_min < 0, a_max < 0) = csr
- clip(csr, a_min > 0, a_max > 0) = csr
Defined in ../src/operator/tensor/matrix_op.cc:L693
Parameters
----------
data : Symbol
Input array.
a_min : float, required
Minimum value
a_max : float, required
Maximum value
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def concat(*data, **kwargs):
r"""Joins input arrays along a given axis.
.. note:: `Concat` is deprecated. Use `concat` instead.
The dimensions of the input arrays should be the same except the axis along
which they will be concatenated.
The dimension of the output array along the concatenated axis will be equal
to the sum of the corresponding dimensions of the input arrays.
The storage type of ``concat`` output depends on storage types of inputs
- concat(csr, csr, ..., csr, dim=0) = csr
- otherwise, ``concat`` generates output with default storage
Example::
x = [[1,1],[2,2]]
y = [[3,3],[4,4],[5,5]]
z = [[6,6], [7,7],[8,8]]
concat(x,y,z,dim=0) = [[ 1., 1.],
[ 2., 2.],
[ 3., 3.],
[ 4., 4.],
[ 5., 5.],
[ 6., 6.],
[ 7., 7.],
[ 8., 8.]]
Note that you cannot concat x,y,z along dimension 1 since dimension
0 is not the same for all the input arrays.
concat(y,z,dim=1) = [[ 3., 3., 6., 6.],
[ 4., 4., 7., 7.],
[ 5., 5., 8., 8.]]
Defined in ../src/operator/nn/concat.cc:L385
This function support variable length of positional input.
Parameters
----------
data : Symbol[]
List of arrays to concatenate
dim : int, optional, default='1'
the dimension to be concated.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def cos(data=None, name=None, attr=None, out=None, **kwargs):
r"""Computes the element-wise cosine of the input array.
The input should be in radians (:math:`2\pi` rad equals 360 degrees).
.. math::
cos([0, \pi/4, \pi/2]) = [1, 0.707, 0]
The storage type of ``cos`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L90
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def cosh(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns the hyperbolic cosine of the input array, computed element-wise.
.. math::
cosh(x) = 0.5\times(exp(x) + exp(-x))
The storage type of ``cosh`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L409
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def degrees(data=None, name=None, attr=None, out=None, **kwargs):
r"""Converts each element of the input array from radians to degrees.
.. math::
degrees([0, \pi/2, \pi, 3\pi/2, 2\pi]) = [0, 90, 180, 270, 360]
The storage type of ``degrees`` output depends upon the input storage type:
- degrees(default) = default
- degrees(row_sparse) = row_sparse
- degrees(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L332
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def dot(lhs=None, rhs=None, transpose_a=_Null, transpose_b=_Null, forward_stype=_Null, name=None, attr=None, out=None, **kwargs):
r"""Dot product of two arrays.
``dot``'s behavior depends on the input array dimensions:
- 1-D arrays: inner product of vectors
- 2-D arrays: matrix multiplication
- N-D arrays: a sum product over the last axis of the first input and the first
axis of the second input
For example, given 3-D ``x`` with shape `(n,m,k)` and ``y`` with shape `(k,r,s)`, the
result array will have shape `(n,m,r,s)`. It is computed by::
dot(x,y)[i,j,a,b] = sum(x[i,j,:]*y[:,a,b])
Example::
x = reshape([0,1,2,3,4,5,6,7], shape=(2,2,2))
y = reshape([7,6,5,4,3,2,1,0], shape=(2,2,2))
dot(x,y)[0,0,1,1] = 0
sum(x[0,0,:]*y[:,1,1]) = 0
The storage type of ``dot`` output depends on storage types of inputs, transpose option and
forward_stype option for output storage type. Implemented sparse operations include:
- dot(default, default, transpose_a=True/False, transpose_b=True/False) = default
- dot(csr, default, transpose_a=True) = default
- dot(csr, default, transpose_a=True) = row_sparse
- dot(csr, default) = default
- dot(csr, row_sparse) = default
- dot(default, csr) = csr (CPU only)
- dot(default, csr, forward_stype='default') = default
- dot(default, csr, transpose_b=True, forward_stype='default') = default
If the combination of input storage types and forward_stype does not match any of the
above patterns, ``dot`` will fallback and generate output with default storage.
.. Note::
If the storage type of the lhs is "csr", the storage type of gradient w.r.t rhs will be
"row_sparse". Only a subset of optimizers support sparse gradients, including SGD, AdaGrad
and Adam. Note that by default lazy updates is turned on, which may perform differently
from standard updates. For more details, please check the Optimization API at:
https://mxnet.incubator.apache.org/api/python/optimization/optimization.html
Defined in ../src/operator/tensor/dot.cc:L77
Parameters
----------
lhs : Symbol
The first input
rhs : Symbol
The second input
transpose_a : boolean, optional, default=0
If true then transpose the first input before dot.
transpose_b : boolean, optional, default=0
If true then transpose the second input before dot.
forward_stype : {None, 'csr', 'default', 'row_sparse'},optional, default='None'
The desired storage type of the forward output given by user, if thecombination of input storage types and this hint does not matchany implemented ones, the dot operator will perform fallback operationand still produce an output of the desired storage type.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def elemwise_add(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Adds arguments element-wise.
The storage type of ``elemwise_add`` output depends on storage types of inputs
- elemwise_add(row_sparse, row_sparse) = row_sparse
- elemwise_add(csr, csr) = csr
- elemwise_add(default, csr) = default
- elemwise_add(csr, default) = default
- elemwise_add(default, rsp) = default
- elemwise_add(rsp, default) = default
- otherwise, ``elemwise_add`` generates output with default storage
Parameters
----------
lhs : Symbol
first input
rhs : Symbol
second input
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def elemwise_div(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Divides arguments element-wise.
The storage type of ``elemwise_div`` output is always dense
Parameters
----------
lhs : Symbol
first input
rhs : Symbol
second input
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def elemwise_mul(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Multiplies arguments element-wise.
The storage type of ``elemwise_mul`` output depends on storage types of inputs
- elemwise_mul(default, default) = default
- elemwise_mul(row_sparse, row_sparse) = row_sparse
- elemwise_mul(default, row_sparse) = row_sparse
- elemwise_mul(row_sparse, default) = row_sparse
- elemwise_mul(csr, csr) = csr
- otherwise, ``elemwise_mul`` generates output with default storage
Parameters
----------
lhs : Symbol
first input
rhs : Symbol
second input
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def elemwise_sub(lhs=None, rhs=None, name=None, attr=None, out=None, **kwargs):
r"""Subtracts arguments element-wise.
The storage type of ``elemwise_sub`` output depends on storage types of inputs
- elemwise_sub(row_sparse, row_sparse) = row_sparse
- elemwise_sub(csr, csr) = csr
- elemwise_sub(default, csr) = default
- elemwise_sub(csr, default) = default
- elemwise_sub(default, rsp) = default
- elemwise_sub(rsp, default) = default
- otherwise, ``elemwise_sub`` generates output with default storage
Parameters
----------
lhs : Symbol
first input
rhs : Symbol
second input
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def exp(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise exponential value of the input.
.. math::
exp(x) = e^x \approx 2.718^x
Example::
exp([0, 1, 2]) = [1., 2.71828175, 7.38905621]
The storage type of ``exp`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_logexp.cc:L64
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def expm1(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns ``exp(x) - 1`` computed element-wise on the input.
This function provides greater precision than ``exp(x) - 1`` for small values of ``x``.
The storage type of ``expm1`` output depends upon the input storage type:
- expm1(default) = default
- expm1(row_sparse) = row_sparse
- expm1(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_logexp.cc:L244
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def fix(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise rounded value to the nearest \
integer towards zero of the input.
Example::
fix([-2.1, -1.9, 1.9, 2.1]) = [-2., -1., 1., 2.]
The storage type of ``fix`` output depends upon the input storage type:
- fix(default) = default
- fix(row_sparse) = row_sparse
- fix(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L872
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def floor(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise floor of the input.
The floor of the scalar x is the largest integer i, such that i <= x.
Example::
floor([-2.1, -1.9, 1.5, 1.9, 2.1]) = [-3., -2., 1., 1., 2.]
The storage type of ``floor`` output depends upon the input storage type:
- floor(default) = default
- floor(row_sparse) = row_sparse
- floor(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L834
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def ftrl_update(weight=None, grad=None, z=None, n=None, lr=_Null, lamda1=_Null, beta=_Null, wd=_Null, rescale_grad=_Null, clip_gradient=_Null, name=None, attr=None, out=None, **kwargs):
r"""Update function for Ftrl optimizer.
Referenced from *Ad Click Prediction: a View from the Trenches*, available at
http://dl.acm.org/citation.cfm?id=2488200.
It updates the weights using::
rescaled_grad = clip(grad * rescale_grad, clip_gradient)
z += rescaled_grad - (sqrt(n + rescaled_grad**2) - sqrt(n)) * weight / learning_rate
n += rescaled_grad**2
w = (sign(z) * lamda1 - z) / ((beta + sqrt(n)) / learning_rate + wd) * (abs(z) > lamda1)
If w, z and n are all of ``row_sparse`` storage type,
only the row slices whose indices appear in grad.indices are updated (for w, z and n)::
for row in grad.indices:
rescaled_grad[row] = clip(grad[row] * rescale_grad, clip_gradient)
z[row] += rescaled_grad[row] - (sqrt(n[row] + rescaled_grad[row]**2) - sqrt(n[row])) * weight[row] / learning_rate
n[row] += rescaled_grad[row]**2
w[row] = (sign(z[row]) * lamda1 - z[row]) / ((beta + sqrt(n[row])) / learning_rate + wd) * (abs(z[row]) > lamda1)
Defined in ../src/operator/optimizer_op.cc:L945
Parameters
----------
weight : Symbol
Weight
grad : Symbol
Gradient
z : Symbol
z
n : Symbol
Square of grad
lr : float, required
Learning rate
lamda1 : float, optional, default=0.00999999978
The L1 regularization coefficient.
beta : float, optional, default=1
Per-Coordinate Learning Rate beta.
wd : float, optional, default=0
Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.
rescale_grad : float, optional, default=1
Rescale gradient to grad = rescale_grad*grad.
clip_gradient : float, optional, default=-1
Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def gamma(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns the gamma function (extension of the factorial function \
to the reals), computed element-wise on the input array.
The storage type of ``gamma`` output is always dense
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def gammaln(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise log of the absolute value of the gamma function \
of the input.
The storage type of ``gammaln`` output is always dense
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def log(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise Natural logarithmic value of the input.
The natural logarithm is logarithm in base *e*, so that ``log(exp(x)) = x``
The storage type of ``log`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_logexp.cc:L77
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def log10(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise Base-10 logarithmic value of the input.
``10**log10(x) = x``
The storage type of ``log10`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_logexp.cc:L94
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def log1p(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise ``log(1 + x)`` value of the input.
This function is more accurate than ``log(1 + x)`` for small ``x`` so that
:math:`1+x\approx 1`
The storage type of ``log1p`` output depends upon the input storage type:
- log1p(default) = default
- log1p(row_sparse) = row_sparse
- log1p(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_logexp.cc:L199
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def log2(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise Base-2 logarithmic value of the input.
``2**log2(x) = x``
The storage type of ``log2`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_logexp.cc:L106
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def make_loss(data=None, name=None, attr=None, out=None, **kwargs):
r"""Make your own loss function in network construction.
This operator accepts a customized loss function symbol as a terminal loss and
the symbol should be an operator with no backward dependency.
The output of this function is the gradient of loss with respect to the input data.
For example, if you are a making a cross entropy loss function. Assume ``out`` is the
predicted output and ``label`` is the true label, then the cross entropy can be defined as::
cross_entropy = label * log(out) + (1 - label) * log(1 - out)
loss = make_loss(cross_entropy)
We will need to use ``make_loss`` when we are creating our own loss function or we want to
combine multiple loss functions. Also we may want to stop some variables' gradients
from backpropagation. See more detail in ``BlockGrad`` or ``stop_gradient``.
The storage type of ``make_loss`` output depends upon the input storage type:
- make_loss(default) = default
- make_loss(row_sparse) = row_sparse
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L358
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def mean(data=None, axis=_Null, keepdims=_Null, exclude=_Null, name=None, attr=None, out=None, **kwargs):
r"""Computes the mean of array elements over given axes.
Defined in ../src/operator/tensor/./broadcast_reduce_op.h:L84
Parameters
----------
data : Symbol
The input
axis : Shape or None, optional, default=None
The axis or axes along which to perform the reduction.
The default, `axis=()`, will compute over all elements into a
scalar array with shape `(1,)`.
If `axis` is int, a reduction is performed on a particular axis.
If `axis` is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.
If `exclude` is true, reduction will be performed on the axes that are
NOT in axis instead.
Negative values means indexing from right to left.
keepdims : boolean, optional, default=0
If this is set to `True`, the reduced axes are left in the result as dimension with size one.
exclude : boolean, optional, default=0
Whether to perform reduction on axis that are NOT in axis instead.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def negative(data=None, name=None, attr=None, out=None, **kwargs):
r"""Numerical negative of the argument, element-wise.
The storage type of ``negative`` output depends upon the input storage type:
- negative(default) = default
- negative(row_sparse) = row_sparse
- negative(csr) = csr
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def norm(data=None, ord=_Null, axis=_Null, out_dtype=_Null, keepdims=_Null, name=None, attr=None, out=None, **kwargs):
r"""Computes the norm on an NDArray.
This operator computes the norm on an NDArray with the specified axis, depending
on the value of the ord parameter. By default, it computes the L2 norm on the entire
array. Currently only ord=2 supports sparse ndarrays.
Examples::
x = [[[1, 2],
[3, 4]],
[[2, 2],
[5, 6]]]
norm(x, ord=2, axis=1) = [[3.1622777 4.472136 ]
[5.3851647 6.3245554]]
norm(x, ord=1, axis=1) = [[4., 6.],
[7., 8.]]
rsp = x.cast_storage('row_sparse')
norm(rsp) = [5.47722578]
csr = x.cast_storage('csr')
norm(csr) = [5.47722578]
Defined in ../src/operator/tensor/broadcast_reduce_norm_value.cc:L89
Parameters
----------
data : Symbol
The input
ord : int, optional, default='2'
Order of the norm. Currently ord=1 and ord=2 is supported.
axis : Shape or None, optional, default=None
The axis or axes along which to perform the reduction.
The default, `axis=()`, will compute over all elements into a
scalar array with shape `(1,)`.
If `axis` is int, a reduction is performed on a particular axis.
If `axis` is a 2-tuple, it specifies the axes that hold 2-D matrices,
and the matrix norms of these matrices are computed.
out_dtype : {None, 'float16', 'float32', 'float64', 'int32', 'int64', 'int8'},optional, default='None'
The data type of the output.
keepdims : boolean, optional, default=0
If this is set to `True`, the reduced axis is left in the result as dimension with size one.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def radians(data=None, name=None, attr=None, out=None, **kwargs):
r"""Converts each element of the input array from degrees to radians.
.. math::
radians([0, 90, 180, 270, 360]) = [0, \pi/2, \pi, 3\pi/2, 2\pi]
The storage type of ``radians`` output depends upon the input storage type:
- radians(default) = default
- radians(row_sparse) = row_sparse
- radians(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L351
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def relu(data=None, name=None, attr=None, out=None, **kwargs):
r"""Computes rectified linear activation.
.. math::
max(features, 0)
The storage type of ``relu`` output depends upon the input storage type:
- relu(default) = default
- relu(row_sparse) = row_sparse
- relu(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L85
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def retain(data=None, indices=None, name=None, attr=None, out=None, **kwargs):
r"""Pick rows specified by user input index array from a row sparse matrix
and save them in the output sparse matrix.
Example::
data = [[1, 2], [3, 4], [5, 6]]
indices = [0, 1, 3]
shape = (4, 2)
rsp_in = row_sparse_array(data, indices)
to_retain = [0, 3]
rsp_out = retain(rsp_in, to_retain)
rsp_out.data = [[1, 2], [5, 6]]
rsp_out.indices = [0, 3]
The storage type of ``retain`` output depends on storage types of inputs
- retain(row_sparse, default) = row_sparse
- otherwise, ``retain`` is not supported
Defined in ../src/operator/tensor/sparse_retain.cc:L53
Parameters
----------
data : Symbol
The input array for sparse_retain operator.
indices : Symbol
The index array of rows ids that will be retained.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def rint(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise rounded value to the nearest integer of the input.
.. note::
- For input ``n.5`` ``rint`` returns ``n`` while ``round`` returns ``n+1``.
- For input ``-n.5`` both ``rint`` and ``round`` returns ``-n-1``.
Example::
rint([-1.5, 1.5, -1.9, 1.9, 2.1]) = [-2., 1., -2., 2., 2.]
The storage type of ``rint`` output depends upon the input storage type:
- rint(default) = default
- rint(row_sparse) = row_sparse
- rint(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L796
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def round(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise rounded value to the nearest integer of the input.
Example::
round([-1.5, 1.5, -1.9, 1.9, 2.1]) = [-2., 2., -2., 2., 2.]
The storage type of ``round`` output depends upon the input storage type:
- round(default) = default
- round(row_sparse) = row_sparse
- round(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L775
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def rsqrt(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise inverse square-root value of the input.
.. math::
rsqrt(x) = 1/\sqrt{x}
Example::
rsqrt([4,9,16]) = [0.5, 0.33333334, 0.25]
The storage type of ``rsqrt`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_pow.cc:L221
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def sgd_mom_update(weight=None, grad=None, mom=None, lr=_Null, momentum=_Null, wd=_Null, rescale_grad=_Null, clip_gradient=_Null, lazy_update=_Null, name=None, attr=None, out=None, **kwargs):
r"""Momentum update function for Stochastic Gradient Descent (SGD) optimizer.
Momentum update has better convergence rates on neural networks. Mathematically it looks
like below:
.. math::
v_1 = \nabla J(W_0)\\
v_t = \gamma v_{t-1} - \nabla J(W_{t-1})\\
W_t = W_{t-1} + \alpha * v_t
It updates the weights using::
v = momentum * v - gradient
weight += learning_rate * v
Where the parameter ``momentum`` is the decay rate of momentum estimates at each epoch.
However, if grad's storage type is ``row_sparse``, ``lazy_update`` is True and weight's storage
type is the same as momentum's storage type,
only the row slices whose indices appear in grad.indices are updated (for both weight and momentum)::
for row in gradient.indices:
v[row] = momentum[row] * v[row] - gradient[row]
weight[row] += learning_rate * v[row]
Defined in ../src/operator/optimizer_op.cc:L563
Parameters
----------
weight : Symbol
Weight
grad : Symbol
Gradient
mom : Symbol
Momentum
lr : float, required
Learning rate
momentum : float, optional, default=0
The decay rate of momentum estimates at each epoch.
wd : float, optional, default=0
Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.
rescale_grad : float, optional, default=1
Rescale gradient to grad = rescale_grad*grad.
clip_gradient : float, optional, default=-1
Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).
lazy_update : boolean, optional, default=1
If true, lazy updates are applied if gradient's stype is row_sparse and both weight and momentum have the same stype
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def sgd_update(weight=None, grad=None, lr=_Null, wd=_Null, rescale_grad=_Null, clip_gradient=_Null, lazy_update=_Null, name=None, attr=None, out=None, **kwargs):
r"""Update function for Stochastic Gradient Descent (SGD) optimizer.
It updates the weights using::
weight = weight - learning_rate * (gradient + wd * weight)
However, if gradient is of ``row_sparse`` storage type and ``lazy_update`` is True,
only the row slices whose indices appear in grad.indices are updated::
for row in gradient.indices:
weight[row] = weight[row] - learning_rate * (gradient[row] + wd * weight[row])
Defined in ../src/operator/optimizer_op.cc:L522
Parameters
----------
weight : Symbol
Weight
grad : Symbol
Gradient
lr : float, required
Learning rate
wd : float, optional, default=0
Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.
rescale_grad : float, optional, default=1
Rescale gradient to grad = rescale_grad*grad.
clip_gradient : float, optional, default=-1
Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).
lazy_update : boolean, optional, default=1
If true, lazy updates are applied if gradient's stype is row_sparse.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def sigmoid(data=None, name=None, attr=None, out=None, **kwargs):
r"""Computes sigmoid of x element-wise.
.. math::
y = 1 / (1 + exp(-x))
The storage type of ``sigmoid`` output is always dense
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L119
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def sign(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise sign of the input.
Example::
sign([-2, 0, 3]) = [-1, 0, 1]
The storage type of ``sign`` output depends upon the input storage type:
- sign(default) = default
- sign(row_sparse) = row_sparse
- sign(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L758
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def sin(data=None, name=None, attr=None, out=None, **kwargs):
r"""Computes the element-wise sine of the input array.
The input should be in radians (:math:`2\pi` rad equals 360 degrees).
.. math::
sin([0, \pi/4, \pi/2]) = [0, 0.707, 1]
The storage type of ``sin`` output depends upon the input storage type:
- sin(default) = default
- sin(row_sparse) = row_sparse
- sin(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L47
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def sinh(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns the hyperbolic sine of the input array, computed element-wise.
.. math::
sinh(x) = 0.5\times(exp(x) - exp(-x))
The storage type of ``sinh`` output depends upon the input storage type:
- sinh(default) = default
- sinh(row_sparse) = row_sparse
- sinh(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L371
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def slice(data=None, begin=_Null, end=_Null, step=_Null, name=None, attr=None, out=None, **kwargs):
r"""Slices a region of the array.
.. note:: ``crop`` is deprecated. Use ``slice`` instead.
This function returns a sliced array between the indices given
by `begin` and `end` with the corresponding `step`.
For an input array of ``shape=(d_0, d_1, ..., d_n-1)``,
slice operation with ``begin=(b_0, b_1...b_m-1)``,
``end=(e_0, e_1, ..., e_m-1)``, and ``step=(s_0, s_1, ..., s_m-1)``,
where m <= n, results in an array with the shape
``(|e_0-b_0|/|s_0|, ..., |e_m-1-b_m-1|/|s_m-1|, d_m, ..., d_n-1)``.
The resulting array's *k*-th dimension contains elements
from the *k*-th dimension of the input array starting
from index ``b_k`` (inclusive) with step ``s_k``
until reaching ``e_k`` (exclusive).
If the *k*-th elements are `None` in the sequence of `begin`, `end`,
and `step`, the following rule will be used to set default values.
If `s_k` is `None`, set `s_k=1`. If `s_k > 0`, set `b_k=0`, `e_k=d_k`;
else, set `b_k=d_k-1`, `e_k=-1`.
The storage type of ``slice`` output depends on storage types of inputs
- slice(csr) = csr
- otherwise, ``slice`` generates output with default storage
.. note:: When input data storage type is csr, it only supports
step=(), or step=(None,), or step=(1,) to generate a csr output.
For other step parameter values, it falls back to slicing
a dense tensor.
Example::
x = [[ 1., 2., 3., 4.],
[ 5., 6., 7., 8.],
[ 9., 10., 11., 12.]]
slice(x, begin=(0,1), end=(2,4)) = [[ 2., 3., 4.],
[ 6., 7., 8.]]
slice(x, begin=(None, 0), end=(None, 3), step=(-1, 2)) = [[9., 11.],
[5., 7.],
[1., 3.]]
Defined in ../src/operator/tensor/matrix_op.cc:L498
Parameters
----------
data : Symbol
Source input
begin : Shape(tuple), required
starting indices for the slice operation, supports negative indices.
end : Shape(tuple), required
ending indices for the slice operation, supports negative indices.
step : Shape(tuple), optional, default=[]
step for the slice operation, supports negative values.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def sqrt(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise square-root value of the input.
.. math::
\textrm{sqrt}(x) = \sqrt{x}
Example::
sqrt([4, 9, 16]) = [2, 3, 4]
The storage type of ``sqrt`` output depends upon the input storage type:
- sqrt(default) = default
- sqrt(row_sparse) = row_sparse
- sqrt(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_pow.cc:L170
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def square(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns element-wise squared value of the input.
.. math::
square(x) = x^2
Example::
square([2, 3, 4]) = [4, 9, 16]
The storage type of ``square`` output depends upon the input storage type:
- square(default) = default
- square(row_sparse) = row_sparse
- square(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_pow.cc:L119
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def stop_gradient(data=None, name=None, attr=None, out=None, **kwargs):
r"""Stops gradient computation.
Stops the accumulated gradient of the inputs from flowing through this operator
in the backward direction. In other words, this operator prevents the contribution
of its inputs to be taken into account for computing gradients.
Example::
v1 = [1, 2]
v2 = [0, 1]
a = Variable('a')
b = Variable('b')
b_stop_grad = stop_gradient(3 * b)
loss = MakeLoss(b_stop_grad + a)
executor = loss.simple_bind(ctx=cpu(), a=(1,2), b=(1,2))
executor.forward(is_train=True, a=v1, b=v2)
executor.outputs
[ 1. 5.]
executor.backward()
executor.grad_arrays
[ 0. 0.]
[ 1. 1.]
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L325
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def sum(data=None, axis=_Null, keepdims=_Null, exclude=_Null, name=None, attr=None, out=None, **kwargs):
r"""Computes the sum of array elements over given axes.
.. Note::
`sum` and `sum_axis` are equivalent.
For ndarray of csr storage type summation along axis 0 and axis 1 is supported.
Setting keepdims or exclude to True will cause a fallback to dense operator.
Example::
data = [[[1, 2], [2, 3], [1, 3]],
[[1, 4], [4, 3], [5, 2]],
[[7, 1], [7, 2], [7, 3]]]
sum(data, axis=1)
[[ 4. 8.]
[ 10. 9.]
[ 21. 6.]]
sum(data, axis=[1,2])
[ 12. 19. 27.]
data = [[1, 2, 0],
[3, 0, 1],
[4, 1, 0]]
csr = cast_storage(data, 'csr')
sum(csr, axis=0)
[ 8. 3. 1.]
sum(csr, axis=1)
[ 3. 4. 5.]
Defined in ../src/operator/tensor/broadcast_reduce_sum_value.cc:L67
Parameters
----------
data : Symbol
The input
axis : Shape or None, optional, default=None
The axis or axes along which to perform the reduction.
The default, `axis=()`, will compute over all elements into a
scalar array with shape `(1,)`.
If `axis` is int, a reduction is performed on a particular axis.
If `axis` is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.
If `exclude` is true, reduction will be performed on the axes that are
NOT in axis instead.
Negative values means indexing from right to left.
keepdims : boolean, optional, default=0
If this is set to `True`, the reduced axes are left in the result as dimension with size one.
exclude : boolean, optional, default=0
Whether to perform reduction on axis that are NOT in axis instead.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def tan(data=None, name=None, attr=None, out=None, **kwargs):
r"""Computes the element-wise tangent of the input array.
The input should be in radians (:math:`2\pi` rad equals 360 degrees).
.. math::
tan([0, \pi/4, \pi/2]) = [0, 1, -inf]
The storage type of ``tan`` output depends upon the input storage type:
- tan(default) = default
- tan(row_sparse) = row_sparse
- tan(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L140
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def tanh(data=None, name=None, attr=None, out=None, **kwargs):
r"""Returns the hyperbolic tangent of the input array, computed element-wise.
.. math::
tanh(x) = sinh(x) / cosh(x)
The storage type of ``tanh`` output depends upon the input storage type:
- tanh(default) = default
- tanh(row_sparse) = row_sparse
- tanh(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_trig.cc:L451
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def trunc(data=None, name=None, attr=None, out=None, **kwargs):
r"""Return the element-wise truncated value of the input.
The truncated value of the scalar x is the nearest integer i which is closer to
zero than x is. In short, the fractional part of the signed number x is discarded.
Example::
trunc([-2.1, -1.9, 1.5, 1.9, 2.1]) = [-2., -1., 1., 1., 2.]
The storage type of ``trunc`` output depends upon the input storage type:
- trunc(default) = default
- trunc(row_sparse) = row_sparse
- trunc(csr) = csr
Defined in ../src/operator/tensor/elemwise_unary_op_basic.cc:L854
Parameters
----------
data : Symbol
The input array.
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def where(condition=None, x=None, y=None, name=None, attr=None, out=None, **kwargs):
r"""Return the elements, either from x or y, depending on the condition.
Given three ndarrays, condition, x, and y, return an ndarray with the elements from x or y,
depending on the elements from condition are true or false. x and y must have the same shape.
If condition has the same shape as x, each element in the output array is from x if the
corresponding element in the condition is true, and from y if false.
If condition does not have the same shape as x, it must be a 1D array whose size is
the same as x's first dimension size. Each row of the output array is from x's row
if the corresponding element from condition is true, and from y's row if false.
Note that all non-zero values are interpreted as ``True`` in condition.
Examples::
x = [[1, 2], [3, 4]]
y = [[5, 6], [7, 8]]
cond = [[0, 1], [-1, 0]]
where(cond, x, y) = [[5, 2], [3, 8]]
csr_cond = cast_storage(cond, 'csr')
where(csr_cond, x, y) = [[5, 2], [3, 8]]
Defined in ../src/operator/tensor/control_flow_op.cc:L57
Parameters
----------
condition : Symbol
condition array
x : Symbol
y : Symbol
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
def zeros_like(data=None, name=None, attr=None, out=None, **kwargs):
r"""Return an array of zeros with the same shape, type and storage type
as the input array.
The storage type of ``zeros_like`` output depends on the storage type of the input
- zeros_like(row_sparse) = row_sparse
- zeros_like(csr) = csr
- zeros_like(default) = default
Examples::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
zeros_like(x) = [[ 0., 0., 0.],
[ 0., 0., 0.]]
Parameters
----------
data : Symbol
The input
name : string, optional.
Name of the resulting symbol.
Returns
-------
Symbol
The result symbol.
"""
return (0,)
__all__ = ['ElementWiseSum', 'Embedding', 'FullyConnected', 'LinearRegressionOutput', 'LogisticRegressionOutput', 'MAERegressionOutput', '_contrib_round_ste', '_contrib_sign_ste', 'abs', 'adagrad_update', 'adam_update', 'add_n', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh', 'broadcast_add', 'broadcast_div', 'broadcast_minus', 'broadcast_mul', 'broadcast_plus', 'broadcast_sub', 'cast_storage', 'cbrt', 'ceil', 'clip', 'concat', 'cos', 'cosh', 'degrees', 'dot', 'elemwise_add', 'elemwise_div', 'elemwise_mul', 'elemwise_sub', 'exp', 'expm1', 'fix', 'floor', 'ftrl_update', 'gamma', 'gammaln', 'log', 'log10', 'log1p', 'log2', 'make_loss', 'mean', 'negative', 'norm', 'radians', 'relu', 'retain', 'rint', 'round', 'rsqrt', 'sgd_mom_update', 'sgd_update', 'sigmoid', 'sign', 'sin', 'sinh', 'slice', 'sqrt', 'square', 'stop_gradient', 'sum', 'tan', 'tanh', 'trunc', 'where', 'zeros_like'] | 28.128522 | 903 | 0.603367 | 11,113 | 81,854 | 4.371097 | 0.079996 | 0.016366 | 0.027421 | 0.033514 | 0.656353 | 0.614254 | 0.591403 | 0.54529 | 0.523757 | 0.509593 | 0 | 0.024746 | 0.27229 | 81,854 | 2,910 | 903 | 28.128522 | 0.790753 | 0.795441 | 0 | 0.328889 | 1 | 0 | 0.066555 | 0.005128 | 0 | 0 | 0 | 0 | 0 | 1 | 0.328889 | false | 0 | 0.008889 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5cb850670717d98eb2c3c0d61bd2ce612b6a60ae | 297 | py | Python | demo/__init__.py | astropenguin/demo-flake8-black | dc2cc44114f30ef622d820c58dea4824f6dcbdf8 | [
"MIT"
] | null | null | null | demo/__init__.py | astropenguin/demo-flake8-black | dc2cc44114f30ef622d820c58dea4824f6dcbdf8 | [
"MIT"
] | 6 | 2019-08-22T07:49:37.000Z | 2021-02-02T22:50:13.000Z | demo/__init__.py | astropenguin/demo-flake8-black | dc2cc44114f30ef622d820c58dea4824f6dcbdf8 | [
"MIT"
] | null | null | null | __version__ = "0.0.1"
def func(a: int, b: int = 0, c: int = 0) -> int:
"""Test function.
Args:
a (int): Parameter A.
b (int, optional): Parameter B.
c (int, optional): Parameter C.
Returns:
sum: The sum of A, B, and C.
"""
return a + b + c
| 17.470588 | 48 | 0.488215 | 45 | 297 | 3.133333 | 0.444444 | 0.042553 | 0.283688 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026178 | 0.356902 | 297 | 16 | 49 | 18.5625 | 0.712042 | 0.545455 | 0 | 0 | 0 | 0 | 0.050505 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5ccbd87770a98d41b63d8a21877f8c6267509406 | 274 | py | Python | OpenGLCffi/EGL/EXT/MESA/drm_image.py | cydenix/OpenGLCffi | c78f51ae5e6b655eb2ea98f072771cf69e2197f3 | [
"MIT"
] | null | null | null | OpenGLCffi/EGL/EXT/MESA/drm_image.py | cydenix/OpenGLCffi | c78f51ae5e6b655eb2ea98f072771cf69e2197f3 | [
"MIT"
] | null | null | null | OpenGLCffi/EGL/EXT/MESA/drm_image.py | cydenix/OpenGLCffi | c78f51ae5e6b655eb2ea98f072771cf69e2197f3 | [
"MIT"
] | null | null | null | from OpenGLCffi.EGL import params
@params(api='egl', prms=['dpy', 'attrib_list'])
def eglCreateDRMImageMESA(dpy, attrib_list):
pass
@params(api='egl', prms=['dpy', 'image', 'name', 'handle', 'stride'])
def eglExportDRMImageMESA(dpy, image, name, handle, stride):
pass
| 22.833333 | 69 | 0.70438 | 35 | 274 | 5.457143 | 0.514286 | 0.094241 | 0.125654 | 0.167539 | 0.434555 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.109489 | 274 | 11 | 70 | 24.909091 | 0.782787 | 0 | 0 | 0.285714 | 0 | 0 | 0.161765 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.285714 | 0.142857 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
7a306d1792d25c0de90ce79847ff8e01d61ae0dd | 285 | py | Python | User/admin.py | orik3ll0/generate_Csv | 49902b1ddbe341e8c65fc453bfb0b5d807de1563 | [
"MIT"
] | null | null | null | User/admin.py | orik3ll0/generate_Csv | 49902b1ddbe341e8c65fc453bfb0b5d807de1563 | [
"MIT"
] | null | null | null | User/admin.py | orik3ll0/generate_Csv | 49902b1ddbe341e8c65fc453bfb0b5d807de1563 | [
"MIT"
] | null | null | null | from django.contrib import admin
from User.models import *
# Register your models here.
admin.site.register(Separator)
admin.site.register(StringCharacter)
admin.site.register(SchemaColumn)
admin.site.register(Schema)
admin.site.register(InputType)
admin.site.register(Generated_csv) | 25.909091 | 36 | 0.82807 | 38 | 285 | 6.184211 | 0.473684 | 0.229787 | 0.434043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070175 | 285 | 11 | 37 | 25.909091 | 0.886792 | 0.091228 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7a4f4b92bad79a1056bcae996e212d9032e90ba6 | 5,218 | py | Python | autoviml/custom_scores.py | goparajug/AutoML_Install | 3091148bb1a26b5fc9ccf67658c376adb1df9890 | [
"Apache-2.0"
] | 1 | 2019-12-02T18:24:27.000Z | 2019-12-02T18:24:27.000Z | autoviml/custom_scores.py | goparajug/AutoML_Install | 3091148bb1a26b5fc9ccf67658c376adb1df9890 | [
"Apache-2.0"
] | null | null | null | autoviml/custom_scores.py | goparajug/AutoML_Install | 3091148bb1a26b5fc9ccf67658c376adb1df9890 | [
"Apache-2.0"
] | null | null | null | import numpy as np
from sklearn import model_selection
from sklearn.metrics import confusion_matrix, mean_squared_error
from sklearn import metrics
from sklearn import model_selection, metrics #Additional sklearn functions
from sklearn.metrics import accuracy_score,f1_score,roc_auc_score,log_loss
from sklearn.metrics import mean_squared_error,median_absolute_error,mean_absolute_error
from sklearn.metrics import classification_report, confusion_matrix,mean_squared_log_error
from sklearn.metrics import precision_recall_curve
from sklearn.model_selection import cross_val_score, StratifiedKFold, KFold
from sklearn.metrics import make_scorer
from sklearn.metrics import accuracy_score
from sklearn.metrics import average_precision_score
from sklearn.metrics import f1_score
from sklearn.metrics import log_loss
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import roc_auc_score
#####################################################################################
from sklearn.metrics import confusion_matrix
def balanced_accuracy_score(y_true, y_pred, sample_weight=None,
adjusted=False):
C = confusion_matrix(y_true, y_pred, sample_weight=sample_weight)
with np.errstate(divide='ignore', invalid='ignore'):
per_class = np.diag(C) / C.sum(axis=1)
if np.any(np.isnan(per_class)):
warnings.warn('y_pred contains classes not in y_true')
per_class = per_class[~np.isnan(per_class)]
score = np.mean(per_class)
if adjusted:
n_classes = len(per_class)
chance = 1 / n_classes
score -= chance
score /= 1 - chance
return score
def accu(results, y_cv):
return (results==y_cv).astype(int).sum(axis=0)/(y_cv.shape[0])
def rmse(results, y_cv):
return np.sqrt(np.mean((results - y_cv)**2, axis=0))
######## Defining objective functions for HyperOpt here ######################
def gini(truth, predictions):
g = np.asarray(np.c_[truth, predictions, np.arange(len(truth)) ], dtype=np.float)
g = g[np.lexsort((g[:,2], -1*g[:,1]))]
gs = g[:,0].cumsum().sum() / g[:,0].sum()
gs -= (len(truth) + 1) / 2.
return gs / len(truth)
def gini_sklearn(truth, predictions):
return gini(truth, predictions) / gini(truth, truth)
def gini_meae(truth, predictions):
score = median_absolute_error(truth, predictions)
return score
def gini_msle(truth, predictions):
score = mean_squared_log_error(truth, predictions)
return score
def gini_mae(truth, predictions):
score = mean_absolute_error(truth, predictions)
return score
def gini_mse(truth, predictions):
score = mean_squared_error(truth, predictions)
return score
def gini_rmse(truth, predictions):
score = np.sqrt(mean_squared_error(truth, predictions))
return score
def gini_accuracy(truth, predictions):
return accuracy_score(truth, predictions)
def gini_bal_accuracy(truth, predictions):
try:
return balanced_accuracy_score(truth, predictions)
except:
return accuracy_score(truth, predictions)
def gini_roc(truth, predictions):
return roc_auc_score(truth, predictions)
def gini_precision(truth, predictions,pos_label=1):
return precision_score(truth, predictions,average=None)[pos_label]
def gini_average_precision(truth, predictions):
return average_precision_score(truth, predictions.argmax(axis=1),average='weighted')
def gini_weighted_precision(truth, predictions):
return precision_score(truth, predictions.argmax(axis=1),average='weighted')
def gini_macro_precision(truth, predictions):
return precision_score(truth, predictions.argmax(axis=1),average='macro')
def gini_micro_precision(truth, predictions):
return precision_score(truth, predictions.argmax(axis=1),average='micro')
def gini_samples_precision(truth, predictions):
return precision_score(truth, predictions.argmax(axis=1),average='samples')
def gini_f1(truth, predictions,pos_label=1):
return f1_score(truth, predictions,average=None)[pos_label]
def gini_weighted_f1(truth, predictions):
return f1_score(truth, predictions.argmax(axis=1),average='weighted')
def gini_macro_f1(truth, predictions):
return f1_score(truth, predictions.argmax(axis=1),average='macro')
def gini_micro_f1(truth, predictions):
return f1_score(truth, predictions.argmax(axis=1),average='micro')
def gini_samples_f1(truth, predictions):
return f1_score(truth, predictions.argmax(axis=1),average='samples')
def gini_log_loss(truth, predictions):
return log_loss(truth, predictions,normalize=True)
def gini_recall(truth, predictions,pos_label=1):
return recall_score(truth, predictions,average=None)[pos_label]
def gini_weighted_recall(truth, predictions):
return recall_score(truth, predictions.argmax(axis=1),average='weighted')
def gini_samples_recall(truth, predictions):
return recall_score(truth, predictions.argmax(axis=1),average='samples')
def gini_macro_recall(truth, predictions):
return recall_score(truth, predictions.argmax(axis=1),average='macro')
def gini_micro_recall(truth, predictions):
return recall_score(truth, predictions.argmax(axis=1),average='micro')
| 38.940299 | 90 | 0.746838 | 707 | 5,218 | 5.305516 | 0.15983 | 0.234604 | 0.129032 | 0.089576 | 0.623034 | 0.539323 | 0.425487 | 0.392695 | 0.366302 | 0.327113 | 0 | 0.009253 | 0.130126 | 5,218 | 133 | 91 | 39.233083 | 0.81714 | 0.014373 | 0 | 0.076923 | 0 | 0 | 0.026269 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.288462 | false | 0 | 0.182692 | 0.211538 | 0.769231 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
7a81a416c589b0a26bf90dd8ef75fbd62821c188 | 854 | py | Python | oracle-linux-image-tools/bin/mkpasswd.py | MarkkuPekkarinen/oracle-linux | 72d45e8d4b6b0276a919040b293ef3acbcbe5349 | [
"UPL-1.0"
] | null | null | null | oracle-linux-image-tools/bin/mkpasswd.py | MarkkuPekkarinen/oracle-linux | 72d45e8d4b6b0276a919040b293ef3acbcbe5349 | [
"UPL-1.0"
] | null | null | null | oracle-linux-image-tools/bin/mkpasswd.py | MarkkuPekkarinen/oracle-linux | 72d45e8d4b6b0276a919040b293ef3acbcbe5349 | [
"UPL-1.0"
] | null | null | null | #!/usr/bin/env python3
"""
Simple wrapper to generate SHA512 hash for a password.
Copyright (c) 2019-2022 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at
https://oss.oracle.com/licenses/upl.
Description: Python < 3.3 does not have crypt.mksalt() we mimmic
https://github.com/python/cpython/blob/master/Lib/crypt.py
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
"""
from crypt import crypt
from random import SystemRandom
from string import ascii_letters, digits
from sys import argv, exit
def mksalt():
"""Generate SHA512 salt."""
sr = SystemRandom()
return '$6$' + ''.join(sr.choice(ascii_letters + digits + './')
for char in range(16))
if len(argv) != 2:
print("Usage: " + argv[0] + " password")
exit(1)
print(crypt(argv[1], mksalt()))
| 25.117647 | 67 | 0.685012 | 126 | 854 | 4.626984 | 0.698413 | 0.048027 | 0.06175 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037572 | 0.189696 | 854 | 33 | 68 | 25.878788 | 0.804913 | 0.514052 | 0 | 0 | 1 | 0 | 0.052239 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0.083333 | 0.333333 | 0 | 0.5 | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
7a9fbe968399595af1514397f7891e565af0ad26 | 736 | py | Python | python/testData/refactoring/argumentList/addKeyArgument/addArgumentFile.after.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2018-12-29T09:53:39.000Z | 2018-12-29T09:53:42.000Z | python/testData/refactoring/argumentList/addKeyArgument/addArgumentFile.after.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/refactoring/argumentList/addKeyArgument/addArgumentFile.after.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | from stub import *
import stub
class MyOldClass(metaclass=ABCMeta):
pass
class MyNewClass(object,metaclass=ABCMeta):
pass
class MyNewClass_2(object, datetime,metaclass=ABCMeta):
pass
class NewClass_3(stub.object,metaclass=ABCMeta):
pass
class NewClass_4(stub.object, stub.datetime,metaclass=ABCMeta):
pass
class NewClass_5(stub.datetime, foo=stub.object,metaclass=ABCMeta):
pass
spam = "new_param"
my_function(new_param=spam)
my_function_1("some_param",new_param=spam)
my_function_2(named_param="ham",new_param=spam)
my_function_3("some_param", "some_param_2", named_param="ham",new_param=spam)
my_function_4("some_param", "some_param_2", named_param=stub.object, named_param_2="eggs",new_param=spam) | 23 | 105 | 0.779891 | 111 | 736 | 4.891892 | 0.243243 | 0.176796 | 0.220994 | 0.230203 | 0.725599 | 0.370166 | 0.219153 | 0.132597 | 0.132597 | 0 | 0 | 0.016641 | 0.101902 | 736 | 32 | 105 | 23 | 0.804841 | 0 | 0 | 0.3 | 0 | 0 | 0.09905 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.3 | 0.1 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
7aaf3a39e8ad728f3ec63ff595de86dd72e5dafe | 1,562 | py | Python | application/core/models.py | vfabi/passreset | 5f37c6efa0c1b01e2526c80a4c8d729831b7b235 | [
"Apache-2.0"
] | null | null | null | application/core/models.py | vfabi/passreset | 5f37c6efa0c1b01e2526c80a4c8d729831b7b235 | [
"Apache-2.0"
] | null | null | null | application/core/models.py | vfabi/passreset | 5f37c6efa0c1b01e2526c80a4c8d729831b7b235 | [
"Apache-2.0"
] | 1 | 2021-01-26T13:51:20.000Z | 2021-01-26T13:51:20.000Z | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@project: passreset
@component: core
@copyright: © 2020 by vfabi
@author: vfabi
@support: vfabi
@initial date: 2020-05-08 21:08:07
@license: this file is subject to the terms and conditions defined
in file 'LICENSE', which is part of this source code package
@description:
@todo:
"""
import json
import random
from datetime import datetime, timedelta
from jsondb import Database
from .utils import variables
class ResetLinkModel:
"""Database model to store generated reset links."""
def __init__(self):
self.db = Database(variables['db'])
def generate(self):
random_string = ''.join(random.choice('abcdefghijklmnopqrstuvwxyz1234567890') for _ in range(30))
dt = datetime.now() + timedelta(days=+1)
dt_string = dt.strftime("%Y%m%d%H%M%S")
reset_string = f'{random_string}-{dt_string}'
return reset_string
def _check_expire(self, resetlink):
now = datetime.now()
dt_expire_string = resetlink.split('-')[1]
dt_expire = datetime.strptime(dt_expire_string, "%Y%m%d%H%M%S")
return dt_expire > now
def add(self, resetlink, email):
self.db.data(key=resetlink, value=email)
def get(self, resetlink):
return self.db.data(key=resetlink)
def exists(self, resetlink):
if resetlink in self.db:
return self._check_expire(resetlink)
return False
def delete(self, resetlink):
self.db.delete(resetlink)
| 27.892857 | 105 | 0.645967 | 202 | 1,562 | 4.89604 | 0.49505 | 0.030334 | 0.006067 | 0.008089 | 0.056623 | 0.012133 | 0 | 0 | 0 | 0 | 0 | 0.028571 | 0.238156 | 1,562 | 55 | 106 | 28.4 | 0.801681 | 0.238796 | 0 | 0 | 0 | 0 | 0.079295 | 0.055507 | 0 | 0 | 0 | 0.018182 | 0 | 1 | 0.241379 | false | 0 | 0.172414 | 0.034483 | 0.62069 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8fa72bb1f2333c32b795f832c72fa33dbc5625ee | 724 | py | Python | chigre/models/pub.py | javiercp/holdmybeer | 1b8f847c9a9d35880b8461c16c6ec7630bde86f5 | [
"MIT"
] | null | null | null | chigre/models/pub.py | javiercp/holdmybeer | 1b8f847c9a9d35880b8461c16c6ec7630bde86f5 | [
"MIT"
] | 53 | 2018-06-14T16:17:51.000Z | 2021-07-21T04:31:55.000Z | chigre/models/pub.py | javiercp/holdmybeer | 1b8f847c9a9d35880b8461c16c6ec7630bde86f5 | [
"MIT"
] | null | null | null | from django.conf import settings
from django.db import models
from .singletonmodel import SingletonModel
from .common import get_sentinel_user
class Pub(SingletonModel):
name = models.CharField(max_length=100, blank=True, default='')
motto = models.TextField(blank=True, default='')
description = models.TextField(blank=True, default='')
address = models.TextField(blank=True, default='')
lat = models.DecimalField(max_digits=20, decimal_places=16, null=True, blank=True)
lng = models.DecimalField(max_digits=20, decimal_places=16, null=True, blank=True)
telephone = models.CharField(max_length=50, blank=True, default='')
logo = models.CharField(max_length=100, blank=True, default='')
| 48.266667 | 86 | 0.747238 | 94 | 724 | 5.659574 | 0.404255 | 0.135338 | 0.180451 | 0.135338 | 0.565789 | 0.390977 | 0.390977 | 0.390977 | 0.229323 | 0.229323 | 0 | 0.025397 | 0.129834 | 724 | 15 | 87 | 48.266667 | 0.819048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.307692 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
8fab62ee81519b42fa0d118cb8800e7a75d0c32e | 198 | py | Python | app/admin/forms.py | MikeLing/Simpleblog | 457a73fc6558c75f19020627f3f85e18b0009aa7 | [
"MIT"
] | 81 | 2017-06-30T03:21:08.000Z | 2021-02-24T09:02:04.000Z | app/admin/forms.py | Ayx03/Simpleblog | 94c8e14729d837395de419043df7fbf6b44469c2 | [
"MIT"
] | 3 | 2020-03-24T17:27:46.000Z | 2021-02-02T22:07:09.000Z | app/admin/forms.py | pauldevsodre412/quokka-master | 7a508f8d7f1a9068c16ce0f1a308c7702b6f96cf | [
"MIT"
] | 34 | 2017-06-28T13:16:42.000Z | 2021-01-10T10:31:50.000Z | from flask_wtf import FlaskForm
from wtforms.validators import Length
from wtforms import TextAreaField
class NoticeForm(FlaskForm):
body = TextAreaField('notice', validators=[Length(0, 25)])
| 24.75 | 62 | 0.792929 | 24 | 198 | 6.5 | 0.625 | 0.141026 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017341 | 0.126263 | 198 | 7 | 63 | 28.285714 | 0.884393 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8fb4af0bcd6165ba24860f7dc0cb3905e3da1677 | 157 | py | Python | src/favorites/urls.py | PhaseDMS/phase | 4f776d0b1b5e7916a3e26aee890b3c2b9454ef0e | [
"MIT"
] | 2 | 2021-09-10T19:40:30.000Z | 2022-01-31T07:15:51.000Z | src/favorites/urls.py | PhaseDMS/phase | 4f776d0b1b5e7916a3e26aee890b3c2b9454ef0e | [
"MIT"
] | null | null | null | src/favorites/urls.py | PhaseDMS/phase | 4f776d0b1b5e7916a3e26aee890b3c2b9454ef0e | [
"MIT"
] | 1 | 2021-09-10T19:40:42.000Z | 2021-09-10T19:40:42.000Z | from django.urls import path
from .views import FavoriteList
urlpatterns = [
# Favorites
path("", FavoriteList.as_view(), name="favorite_list"),
]
| 17.444444 | 59 | 0.707006 | 18 | 157 | 6.055556 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.171975 | 157 | 8 | 60 | 19.625 | 0.838462 | 0.057325 | 0 | 0 | 0 | 0 | 0.089041 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8fc6ea7f97fd4789158601fc6f18da89e6c3ad4b | 385 | py | Python | mne/channels/data/neighbors/__init__.py | dgwakeman/mne-python | 3cc7a3f8456d78c828355f1860dd7e0297e59c73 | [
"BSD-3-Clause"
] | 4 | 2017-01-08T15:36:30.000Z | 2022-03-08T13:07:27.000Z | mne/channels/data/neighbors/__init__.py | dgwakeman/mne-python | 3cc7a3f8456d78c828355f1860dd7e0297e59c73 | [
"BSD-3-Clause"
] | 4 | 2015-04-20T16:10:47.000Z | 2016-11-01T13:32:48.000Z | mne/channels/data/neighbors/__init__.py | dgwakeman/mne-python | 3cc7a3f8456d78c828355f1860dd7e0297e59c73 | [
"BSD-3-Clause"
] | 2 | 2018-04-02T06:45:11.000Z | 2018-07-16T23:39:02.000Z | # Neighbor definitions for clustering permutation analysis.
# This is a selection of files from http://fieldtrip.fcdonders.nl/template
# Additional definitions can be obtained through the FieldTrip software.
# For additional information on how these definitions were computed, please
# consider the related fieldtrip documentation:
# http://fieldtrip.fcdonders.nl/template/neighbours.
| 55 | 75 | 0.820779 | 48 | 385 | 6.583333 | 0.75 | 0.082278 | 0.139241 | 0.151899 | 0.202532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116883 | 385 | 6 | 76 | 64.166667 | 0.929412 | 0.966234 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8fc778aac183397dcb802d425bf802394a183781 | 63 | py | Python | src/Exercises/__init__.py | juliendroletnoel/ExercisesGenerator | 15e9156d17c853ea338a8cf3499e877a5bdf28b2 | [
"MIT"
] | null | null | null | src/Exercises/__init__.py | juliendroletnoel/ExercisesGenerator | 15e9156d17c853ea338a8cf3499e877a5bdf28b2 | [
"MIT"
] | null | null | null | src/Exercises/__init__.py | juliendroletnoel/ExercisesGenerator | 15e9156d17c853ea338a8cf3499e877a5bdf28b2 | [
"MIT"
] | null | null | null | __all__ = ['ExerciseGenerator']
from . import ExerciseGenerator | 31.5 | 31 | 0.809524 | 5 | 63 | 9.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 63 | 2 | 32 | 31.5 | 0.824561 | 0 | 0 | 0 | 0 | 0 | 0.265625 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8fcc362c64c779accc8f2b03b72b0dff442edbbc | 202 | py | Python | sc2clanman/apps.py | paskausks/sc2cm | 9c80e581933531496333d4a54c40174d4fb583a5 | [
"MIT"
] | null | null | null | sc2clanman/apps.py | paskausks/sc2cm | 9c80e581933531496333d4a54c40174d4fb583a5 | [
"MIT"
] | null | null | null | sc2clanman/apps.py | paskausks/sc2cm | 9c80e581933531496333d4a54c40174d4fb583a5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from django.apps import AppConfig
class ClanManConfig(AppConfig):
name = 'sc2clanman'
verbose_name = 'Clan Manager'
version_id = '0.1.7beta'
| 20.2 | 33 | 0.673267 | 26 | 202 | 5.153846 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036364 | 0.183168 | 202 | 9 | 34 | 22.444444 | 0.775758 | 0.212871 | 0 | 0 | 0 | 0 | 0.197452 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8fcd257a922a7bab9431def39dd03e7cb93b5353 | 221 | py | Python | features/steps/common_steps.py | kirbycope/altunity-headspin-python | a2c272fa561cad7b2ed9c463f3060420dea48d6f | [
"MIT"
] | null | null | null | features/steps/common_steps.py | kirbycope/altunity-headspin-python | a2c272fa561cad7b2ed9c463f3060420dea48d6f | [
"MIT"
] | null | null | null | features/steps/common_steps.py | kirbycope/altunity-headspin-python | a2c272fa561cad7b2ed9c463f3060420dea48d6f | [
"MIT"
] | null | null | null | from behave import *
import test_data
# I open the <name> scene
@given('I open the {name} scene')
def step_impl(context, name):
# Loads the scene mentioned by its name.
test_data.altUnityDriver.load_scene(name)
| 22.1 | 45 | 0.728507 | 35 | 221 | 4.485714 | 0.6 | 0.101911 | 0.101911 | 0.152866 | 0.216561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 221 | 9 | 46 | 24.555556 | 0.862637 | 0.280543 | 0 | 0 | 0 | 0 | 0.147436 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
8fcf92cad2287bb49192176b798d2daa7d72abae | 1,308 | py | Python | examples/Oscillators/MallsOscillator/plotresults.py | doublefloyd/beluga | 740bda376634945ef51bf1cf946fcbe002e9bc7f | [
"MIT"
] | 20 | 2017-10-02T13:09:58.000Z | 2022-03-28T20:50:35.000Z | examples/Oscillators/MallsOscillator/plotresults.py | doublefloyd/beluga | 740bda376634945ef51bf1cf946fcbe002e9bc7f | [
"MIT"
] | 187 | 2018-02-04T20:35:03.000Z | 2021-01-27T15:04:18.000Z | examples/Oscillators/MallsOscillator/plotresults.py | doublefloyd/beluga | 740bda376634945ef51bf1cf946fcbe002e9bc7f | [
"MIT"
] | 12 | 2018-01-19T04:00:09.000Z | 2022-03-28T16:44:17.000Z | from beluga.utils import load
import matplotlib.pyplot as plt
data = load('data.beluga')
sol_set = data['solutions']
traj = sol_set[-1][-1]
continuation = sol_set[-1]
L = len(continuation)
plt.figure()
for ind, sol in enumerate(continuation):
plt.plot(sol.y[:, 0], sol.y[:, 1], linestyle='-', color=(1*(ind/L), 0, 1*(L-ind)/L))
plt.title('Phase Plot')
plt.xlabel('$x_1$')
plt.ylabel('$x_2$')
plt.grid(True)
plt.figure()
for ind, sol in enumerate(continuation):
plt.plot(sol.t, sol.u[:, 0], linestyle='-', color=(1*(ind/L), 0, 1*(L-ind)/L))
plt.plot([traj.t[0], traj.t[-1]], [1, 1], color='k', linestyle='--')
plt.plot([traj.t[0], traj.t[-1]], [-1, -1], color='k', linestyle='--')
plt.title('Control History Plot')
plt.xlabel('Time [s]')
plt.ylabel('Control, $u$')
plt.grid(True)
plt.figure()
for ind, sol in enumerate(continuation):
plt.plot(sol.t, sol.dual[:, 0], linestyle='-', color=(1*(ind/L), 0, 1*(L-ind)/L))
plt.title('$\\lambda_{x1}$ History Plot')
plt.xlabel('Time [s]')
plt.ylabel('$\\lambda_{x1}$')
plt.grid(True)
plt.figure()
for ind, sol in enumerate(continuation):
plt.plot(sol.t, sol.dual[:, 1], linestyle='-', color=(1*(ind/L), 0, 1*(L-ind)/L))
plt.title('$\\lambda_{x2}$ History Plot')
plt.xlabel('Time [s]')
plt.ylabel('$\\lambda_{x2}$')
plt.grid(True)
plt.show()
| 26.693878 | 88 | 0.626147 | 224 | 1,308 | 3.616071 | 0.214286 | 0.039506 | 0.059259 | 0.074074 | 0.728395 | 0.728395 | 0.728395 | 0.728395 | 0.68642 | 0.587654 | 0 | 0.02916 | 0.108563 | 1,308 | 48 | 89 | 27.25 | 0.665523 | 0 | 0 | 0.394737 | 0 | 0 | 0.146789 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052632 | 0 | 0.052632 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8fe0c57b4dacd83a912f33306a528fea61f29b2f | 238 | py | Python | stix_shifter/stix_transmission/src/modules/async_dummy/async_dummy_ping.py | kant/stix-shifter | 164ea13c4fc34815df786897c8d882dcdc499680 | [
"Apache-2.0"
] | null | null | null | stix_shifter/stix_transmission/src/modules/async_dummy/async_dummy_ping.py | kant/stix-shifter | 164ea13c4fc34815df786897c8d882dcdc499680 | [
"Apache-2.0"
] | null | null | null | stix_shifter/stix_transmission/src/modules/async_dummy/async_dummy_ping.py | kant/stix-shifter | 164ea13c4fc34815df786897c8d882dcdc499680 | [
"Apache-2.0"
] | null | null | null | from ..base.base_ping import BasePing
class AsyncDummyPing(BasePing):
def __init__(self, host, port, path):
self.host = host
self.port = port
self.path = path
def ping(self):
return 'async ping'
| 19.833333 | 41 | 0.617647 | 30 | 238 | 4.733333 | 0.5 | 0.112676 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 238 | 11 | 42 | 21.636364 | 0.835294 | 0 | 0 | 0 | 0 | 0 | 0.042017 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8ff821ae1f01b4b8acfd674e95d5625f1b2bd735 | 150 | py | Python | src/account/urls.py | Jlopezjlx/devhub | 73e1a4ad89464e5c5462df3c9f1a0e611c40b85e | [
"Apache-2.0"
] | null | null | null | src/account/urls.py | Jlopezjlx/devhub | 73e1a4ad89464e5c5462df3c9f1a0e611c40b85e | [
"Apache-2.0"
] | null | null | null | src/account/urls.py | Jlopezjlx/devhub | 73e1a4ad89464e5c5462df3c9f1a0e611c40b85e | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from account import views
urlpatterns = [
path('', views.index, name='index'),
path(r'login/', views.login)
]
| 15 | 40 | 0.666667 | 20 | 150 | 5 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186667 | 150 | 9 | 41 | 16.666667 | 0.819672 | 0 | 0 | 0 | 0 | 0 | 0.073333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8ff96309128ff88e13401a9415e689150bad9e8e | 1,238 | py | Python | home/tests/login-logout.py | caggri/FOFviz | 776ab387d832a86eea1a1b9064040d9b012494a7 | [
"MIT"
] | 2 | 2020-05-24T22:28:53.000Z | 2020-05-25T21:58:24.000Z | home/tests/login-logout.py | caggri/FOFviz | 776ab387d832a86eea1a1b9064040d9b012494a7 | [
"MIT"
] | null | null | null | home/tests/login-logout.py | caggri/FOFviz | 776ab387d832a86eea1a1b9064040d9b012494a7 | [
"MIT"
] | 1 | 2021-10-16T12:26:29.000Z | 2021-10-16T12:26:29.000Z | from selenium import webdriver
import time
chromedriver = "C:/Users/deniz/chromedriver/chromedriver"
driver = webdriver.Chrome(chromedriver)
driver.get('http://127.0.0.1:8000/')
usr = "hasan"
pwd = "123456"
user_dropdown = '//*[@id="userDropdown"]'
username_input = '//*[@id="id_username"]'
password_input = '//*[@id="id_password"]'
login_submit = '//*[@id="loginBtn"]'
logout_btn = '//*[@id="content"]/nav/ul/li[4]/div/a[4]'
logout = '//*[@id="logoutModal"]/div/div/div[3]/a'
time.sleep(3)
driver.find_element_by_xpath(user_dropdown).click()
time.sleep(3)
driver.find_element_by_xpath(username_input).send_keys("asafsdasdaf")
time.sleep(1)
driver.find_element_by_xpath(password_input).send_keys("afsdsafasdfa")
time.sleep(1)
driver.find_element_by_xpath(login_submit).click()
time.sleep(3)
driver.find_element_by_xpath(username_input).clear()
driver.find_element_by_xpath(username_input).send_keys(usr)
time.sleep(1)
driver.find_element_by_xpath(password_input).send_keys(pwd)
time.sleep(1)
driver.find_element_by_xpath(login_submit).click()
time.sleep(5)
driver.find_element_by_xpath(user_dropdown).click()
time.sleep(2)
driver.find_element_by_xpath(logout_btn).click()
time.sleep(2)
driver.find_element_by_xpath(logout).click()
| 29.47619 | 70 | 0.771405 | 190 | 1,238 | 4.742105 | 0.289474 | 0.122087 | 0.207547 | 0.231964 | 0.602664 | 0.602664 | 0.602664 | 0.602664 | 0.591565 | 0.532741 | 0 | 0.024723 | 0.052504 | 1,238 | 41 | 71 | 30.195122 | 0.743393 | 0 | 0 | 0.382353 | 0 | 0 | 0.210824 | 0.150242 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.088235 | 0.058824 | 0 | 0.058824 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
890064321f80e3774ced8084d0bb7197a0b5c92d | 366 | py | Python | tests/test_percent.py | dillonm197/pytest.percent | b41d1751a169fc56f4bda0af4af566e36b11914a | [
"MIT"
] | 2 | 2020-08-16T17:14:27.000Z | 2020-08-20T21:50:26.000Z | tests/test_percent.py | dillonm197/pytest.percent | b41d1751a169fc56f4bda0af4af566e36b11914a | [
"MIT"
] | 1 | 2020-11-17T14:27:21.000Z | 2020-11-17T14:27:21.000Z | tests/test_percent.py | dillonm197/pytest.percent | b41d1751a169fc56f4bda0af4af566e36b11914a | [
"MIT"
] | 1 | 2020-11-17T14:25:46.000Z | 2020-11-17T14:25:46.000Z | import pytest
def test_1(required_percent):
assert isinstance(required_percent, int)
def test_2():
assert True
def test_3():
assert True
def test_4():
assert True
def test_5():
assert False
@pytest.mark.skip
def test_6():
pass
@pytest.mark.xfail
def test_7():
assert False
@pytest.mark.xfail
def test_8():
assert True
| 9.891892 | 44 | 0.669399 | 55 | 366 | 4.272727 | 0.418182 | 0.238298 | 0.165957 | 0.217021 | 0.187234 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02847 | 0.23224 | 366 | 36 | 45 | 10.166667 | 0.807829 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | 1 | 0.4 | false | 0.05 | 0.05 | 0 | 0.45 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8900e6f125f10a41f7d95e9ebdc91b298264598f | 1,951 | py | Python | async_gui/gevent_tasks.py | timeyyy/async_gui | 805a3c016055885dc4449a8718fa397547bae2d8 | [
"BSD-2-Clause"
] | 38 | 2015-01-13T01:23:03.000Z | 2022-01-20T11:04:23.000Z | async_gui/gevent_tasks.py | robertpro/async_gui | df0fcf1a44c693860f1ae57d9d3bcc1541aec1b8 | [
"BSD-2-Clause"
] | 5 | 2016-12-23T10:12:30.000Z | 2019-04-16T17:17:42.000Z | async_gui/gevent_tasks.py | robertpro/async_gui | df0fcf1a44c693860f1ae57d9d3bcc1541aec1b8 | [
"BSD-2-Clause"
] | 14 | 2015-12-04T02:56:21.000Z | 2020-11-17T05:10:50.000Z | """
gevent_tasks
~~~~~~~~~~~~
Tasks executing in ``gevent`` Pool
.. note:: You need to apply gevent monkey-patch yourself, see
`docs <http://www.gevent.org/gevent.monkey.html>`_
"""
from concurrent import futures
from gevent.pool import Pool
import gevent
from .tasks import Task, MultiTask
# TODO docs about monkey_patch
class GeventPoolExecutor(futures.Executor):
""" Wrapper for `gevent.pool.Pool`
"""
def __init__(self, max_workers):
self.max_workers = max_workers
self._pool = Pool(max_workers)
def submit(self, fn, *args, **kwargs):
greenlet = self._pool.spawn(fn, *args, **kwargs)
return GeventFuture(greenlet)
def shutdown(self, wait=True):
self._pool.kill(block=wait)
# TODO more greenlet methods, also check not overridden Future methods
class GeventFuture(futures.Future):
""" Wrapper for `Greenlet`
"""
def __init__(self, greenlet):
super(GeventFuture, self).__init__()
#self._greenlet = gevent.Greenlet()
self._greenlet = greenlet
def result(self, timeout=None):
try:
return self._greenlet.get(timeout=timeout)
except gevent.Timeout as e:
raise futures.TimeoutError(e)
def exception(self, timeout=None):
# todo timeout
return self._greenlet.exception
def running(self):
return not self.done()
def done(self):
return self._greenlet.ready()
class GTask(Task):
""" Task executed in `gevent` Pool
"""
executor_class = GeventPoolExecutor
class MultiGTask(MultiTask):
""" Multiple tasks executed in `gevent` Pool simultaneously
"""
executor_class = GeventPoolExecutor
def wait(self, executor, spawned_futures, timeout=None):
executor._pool.join(timeout)
return all(f.done() for f in spawned_futures)
| 26.013333 | 71 | 0.630446 | 219 | 1,951 | 5.47032 | 0.369863 | 0.0601 | 0.03005 | 0.033389 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.262942 | 1,951 | 74 | 72 | 26.364865 | 0.833102 | 0.248078 | 0 | 0.057143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040541 | 0 | 1 | 0.257143 | false | 0 | 0.114286 | 0.085714 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
891800f1fc8a6a00b4f678969ab0561ce763b1dd | 2,601 | py | Python | nba_data/data/players.py | jaebradley/nba_data | 30d817bbc1c5474774f97f3800354492e382d206 | [
"MIT"
] | 8 | 2017-01-07T13:32:16.000Z | 2019-08-08T17:36:26.000Z | nba_data/data/players.py | jaebradley/nba_data | 30d817bbc1c5474774f97f3800354492e382d206 | [
"MIT"
] | 72 | 2016-09-01T01:21:07.000Z | 2021-03-25T21:41:38.000Z | nba_data/data/players.py | jaebradley/nba_data | 30d817bbc1c5474774f97f3800354492e382d206 | [
"MIT"
] | 4 | 2016-12-06T10:30:59.000Z | 2021-09-08T21:23:43.000Z | from nba_data.data.base_query_parameter import BaseQueryParameter
class Player(BaseQueryParameter):
def __init__(self, name, id):
self.name = name
self.id = id
def __unicode__(self):
return '{0} | {1}'.format(self.get_additional_unicode(), self.get_base_unicode())
def get_base_unicode(self):
return 'name: {name} | id: {id}'.format(name=self.name, id=self.id)
def get_additional_unicode(self):
raise NotImplementedError('Implement in concrete classes')
@staticmethod
def get_query_parameter_name():
return "PlayerId"
class TeamPlayer(Player):
def __init__(self, name, id, team):
self.team = team
Player.__init__(self, name, id)
def get_base_unicode(self):
return 'team: {team} | {base_unicode}'.format(team=self.team, base_unicode=Player.get_base_unicode(self))
def get_additional_unicode(self):
raise NotImplementedError('Implement in concrete classes')
class SeasonPlayer(Player):
def __init__(self, id, name, jersey, team_seasons):
self.jersey = jersey
self.team_seasons = team_seasons
Player.__init__(self, name=name, id=id)
def get_additional_unicode(self):
return 'jersey: {jersey} | team seasons: {team_seasons}'.format(jersey=self.jersey,
team_seasons=self.team_seasons)
class CommonAllPlayer(TeamPlayer):
def __init__(self, name, id, team):
TeamPlayer.__init__(self, name, id, team)
def get_additional_unicode(self):
return ''
class DetailedPlayer(TeamPlayer):
def __init__(self, name, team, id, birth_date, height, weight, jersey, position):
self.birth_date = birth_date
self.height = height
self.weight = weight
self.jersey = jersey
self.position = position
self.jersey = jersey
TeamPlayer.__init__(self, name=name, id=id, team=team)
def get_additional_unicode(self):
return 'birth date: {birth_date} | height: {height} | weight: {weight} | ' 'jersey: {jersey} | ' \
'position: {position}'.format(birth_data=self.birth_date, height=self.height, weight=self.weight,
jersey=self.jersey, position=self.position)
class BoxScorePlayer(TeamPlayer):
def __init__(self, name, team, id, status):
self.status = status
TeamPlayer.__init__(self, name=name, id=id, team=team)
def get_additional_unicode(self):
return 'status: {status}'.format(status=self.status)
| 33.346154 | 113 | 0.646674 | 305 | 2,601 | 5.219672 | 0.144262 | 0.060302 | 0.075377 | 0.105528 | 0.368719 | 0.342965 | 0.248116 | 0.18593 | 0.18593 | 0.18593 | 0 | 0.001016 | 0.242983 | 2,601 | 77 | 114 | 33.779221 | 0.807517 | 0 | 0 | 0.314815 | 0 | 0 | 0.113033 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0 | 0.018519 | 0.148148 | 0.574074 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
64e90358930ed919c419c63d29d6e6958127dd1c | 153 | py | Python | app/api/data/__init__.py | nccr-itmo/FEDOT.Web | 9b6f7b66de277ea34d6d5ed621b99a3f938db61b | [
"BSD-3-Clause"
] | 23 | 2020-12-24T11:05:01.000Z | 2022-03-31T20:29:12.000Z | app/api/data/__init__.py | nccr-itmo/FedotWeb | 763fb1f39ad2b69104b6568e6f941c4c67762e34 | [
"BSD-3-Clause"
] | 42 | 2021-01-11T09:38:31.000Z | 2022-03-25T17:19:05.000Z | app/api/data/__init__.py | nccr-itmo/FedotWeb | 763fb1f39ad2b69104b6568e6f941c4c67762e34 | [
"BSD-3-Clause"
] | 5 | 2021-03-31T04:38:31.000Z | 2022-03-31T20:29:26.000Z | BASE_ROUTE = 'data'
def register_routes(api, app):
from .controller import api as data_api
api.add_namespace(data_api, path=f"/{BASE_ROUTE}")
| 19.125 | 54 | 0.718954 | 24 | 153 | 4.333333 | 0.666667 | 0.173077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163399 | 153 | 7 | 55 | 21.857143 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
64e9570b103bac8198b8f1abd0ee6f32b9bfc554 | 906 | py | Python | src/backend/common/sitevars/tests/google_analytics_id_test.py | ofekashery/the-blue-alliance | df0e47d054161fe742ac6198a6684247d0713279 | [
"MIT"
] | 266 | 2015-01-04T00:10:48.000Z | 2022-03-28T18:42:05.000Z | src/backend/common/sitevars/tests/google_analytics_id_test.py | ofekashery/the-blue-alliance | df0e47d054161fe742ac6198a6684247d0713279 | [
"MIT"
] | 2,673 | 2015-01-01T20:14:33.000Z | 2022-03-31T18:17:16.000Z | src/backend/common/sitevars/tests/google_analytics_id_test.py | ofekashery/the-blue-alliance | df0e47d054161fe742ac6198a6684247d0713279 | [
"MIT"
] | 230 | 2015-01-04T00:10:48.000Z | 2022-03-26T18:12:04.000Z | from backend.common.sitevars.google_analytics_id import ContentType, GoogleAnalyticsID
def test_key():
assert GoogleAnalyticsID.key() == "google_analytics.id"
def test_description():
assert (
GoogleAnalyticsID.description()
== "Google Analytics ID for logging API requests"
)
def test_default_sitevar():
default_sitevar = GoogleAnalyticsID._fetch_sitevar()
assert default_sitevar is not None
default_json = {"GOOGLE_ANALYTICS_ID": ""}
assert default_sitevar.contents == default_json
assert default_sitevar.description == "Google Analytics ID for logging API requests"
def test_google_analytics_id_empty():
assert GoogleAnalyticsID.google_analytics_id() is None
def test_google_analytics_id():
test_id = "abc"
GoogleAnalyticsID.put(ContentType(GOOGLE_ANALYTICS_ID=test_id))
assert GoogleAnalyticsID.google_analytics_id() == test_id
| 28.3125 | 88 | 0.760486 | 105 | 906 | 6.247619 | 0.285714 | 0.228659 | 0.259146 | 0.096037 | 0.408537 | 0.170732 | 0.170732 | 0.170732 | 0.170732 | 0.170732 | 0 | 0 | 0.15894 | 906 | 31 | 89 | 29.225806 | 0.860892 | 0 | 0 | 0 | 0 | 0 | 0.142384 | 0 | 0 | 0 | 0 | 0 | 0.35 | 1 | 0.25 | false | 0 | 0.05 | 0 | 0.3 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
64f4c8372cbf8ee1403d1e103b769998af62d436 | 2,688 | py | Python | lib/temporal.py | dpla/zen | 4bd3c3621aa8fa82e22b2514b93a0978a3179771 | [
"Apache-2.0"
] | 3 | 2016-01-31T02:55:07.000Z | 2022-03-17T17:49:49.000Z | lib/temporal.py | dpla/zen | 4bd3c3621aa8fa82e22b2514b93a0978a3179771 | [
"Apache-2.0"
] | null | null | null | lib/temporal.py | dpla/zen | 4bd3c3621aa8fa82e22b2514b93a0978a3179771 | [
"Apache-2.0"
] | null | null | null | '''
'''
# Useful resources:
# http://wiki.python.org/moin/WorkingWithTime
# http://seehuhn.de/pages/pdate
#Other tools we can use:
# http://code.google.com/p/parsedatetime/
#
import feedparser
import datetime
from zen import dateparser, iso8601
from amara.lib.date import timezone, UTC
def mods_convention_date(d):
#Feedparser extension to parse a date format idiosyncratic to MODS
if len(d) == 14:
try:
#FIXME: converting via tuple to datetime, then back to tuple. Wasteful.
return datetime.datetime(int(d[0:4]), int(d[4:6]), int(d[6:8]), int(d[8:10]), int(d[10:12]), int(d[12:]), 0, UTC).timetuple() #.utctimetuple()
except ValueError:
return None
return None
#
def plain_year(d):
if len(d) == 4:
try:
#FIXME: converting via tuple to datetime, then back to tuple. Wasteful.
return datetime.datetime(int(d[0:4]), 1, 1).timetuple()
except ValueError:
return None
return None
feedparser.registerDateHandler(mods_convention_date)
feedparser.registerDateHandler(plain_year)
def smart_parse_date(date):
'''
Accepts a string or unicode date to be parsed and returns a datetime.datetime result
A very restrictive list of dates that can be parsed (i.e. some date formats not
listed here should work):
W3C dates, documented here:
http://www.w3.org/TR/NOTE-datetime
A subset of undelimited ISO-8601 dates work (as prevalent in LC MODS).
YYYYDDMM
YYYYDDMMhhmmss
In general the dates have to be internationally unambiguous, Y2K-safe
One exception is support for US convention, Y2K-safe year dates.
MM/DD/YYYY
'''
date = date.strip()
#FIXME: Yes, layers on layers. Streamline it.
try:
dt = iso8601.parse_date(dateparser.to_iso8601(date))
return dt
except (KeyboardInterrupt, SystemExit):
raise
except Exception, e:
pass
#try:
# date = unicode(date, 'utf-8')
#
try:
if len(date) == 4:
try:
return datetime.datetime(int(date), 1, 1)
except ValueError:
pass
parts = date.split(u'/')
if len(parts) == 3:
return datetime.datetime(int(parts[2]), int(parts[0]), int(parts[1]))
except (KeyboardInterrupt, SystemExit):
raise
except Exception, e:
pass
try:
dt = datetime.datetime(*feedparser._parse_date(date)[:7])
except (KeyboardInterrupt, SystemExit):
raise
except Exception, e:
dt = None
return dt
smart_parse_date.serviceid = u'http://purl.org/com/zepheira/zen/smartparsedate'
| 27.71134 | 154 | 0.635045 | 354 | 2,688 | 4.782486 | 0.426554 | 0.016539 | 0.051979 | 0.059067 | 0.249262 | 0.249262 | 0.206734 | 0.174838 | 0.174838 | 0.102776 | 0 | 0.026065 | 0.257813 | 2,688 | 96 | 155 | 28 | 0.822556 | 0.170759 | 0 | 0.54 | 0 | 0 | 0.029197 | 0 | 0 | 0 | 0 | 0.020833 | 0 | 0 | null | null | 0.06 | 0.08 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
8f09778495c98e4ab900c67c78630fbb8930e2f2 | 68 | py | Python | youtube_dl/version.py | builder07/ytdl | 2c0a5d50af7ecc7302c813d649ee72dcd457a50a | [
"Unlicense"
] | null | null | null | youtube_dl/version.py | builder07/ytdl | 2c0a5d50af7ecc7302c813d649ee72dcd457a50a | [
"Unlicense"
] | null | null | null | youtube_dl/version.py | builder07/ytdl | 2c0a5d50af7ecc7302c813d649ee72dcd457a50a | [
"Unlicense"
] | null | null | null | from __future__ import unicode_literals
__version__ = '2015.09.28'
| 17 | 39 | 0.808824 | 9 | 68 | 5.111111 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 0.117647 | 68 | 3 | 40 | 22.666667 | 0.633333 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8f1bc690c415488050f5924c443ab06d236df132 | 245 | py | Python | tests/test_cards.py | tarasivashchuk/portfolio | 74939e175c77e2e5b3e428eda6319fe016e0ddf4 | [
"Unlicense",
"MIT"
] | null | null | null | tests/test_cards.py | tarasivashchuk/portfolio | 74939e175c77e2e5b3e428eda6319fe016e0ddf4 | [
"Unlicense",
"MIT"
] | null | null | null | tests/test_cards.py | tarasivashchuk/portfolio | 74939e175c77e2e5b3e428eda6319fe016e0ddf4 | [
"Unlicense",
"MIT"
] | null | null | null | from portfolio import cards
def test_get_projects_markdown():
projects = cards.get_projects_markdown()
assert isinstance(projects, list)
assert len(projects) > 0
for project in projects:
assert isinstance(project, str)
| 24.5 | 44 | 0.730612 | 30 | 245 | 5.8 | 0.6 | 0.126437 | 0.218391 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005102 | 0.2 | 245 | 9 | 45 | 27.222222 | 0.882653 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f3524b310a52302e44c0802fe16e68ded00e12e | 215 | py | Python | tests/fixtures/defxmlschema/chapter10/example1004.py | nimish/xsdata | 7afe2781b66982428cc1731f53c065086acd35c1 | [
"MIT"
] | null | null | null | tests/fixtures/defxmlschema/chapter10/example1004.py | nimish/xsdata | 7afe2781b66982428cc1731f53c065086acd35c1 | [
"MIT"
] | null | null | null | tests/fixtures/defxmlschema/chapter10/example1004.py | nimish/xsdata | 7afe2781b66982428cc1731f53c065086acd35c1 | [
"MIT"
] | null | null | null | from enum import Enum
class SmallSizeType(Enum):
"""
:cvar VALUE_2:
:cvar VALUE_4:
:cvar VALUE_6:
:cvar SMALL:
"""
VALUE_2 = "2"
VALUE_4 = "4"
VALUE_6 = "6"
SMALL = "small"
| 14.333333 | 26 | 0.539535 | 29 | 215 | 3.793103 | 0.37931 | 0.245455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062069 | 0.325581 | 215 | 14 | 27 | 15.357143 | 0.696552 | 0.265116 | 0 | 0 | 0 | 0 | 0.061538 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8f35e1d43c53b4f4dab150b5f9efd9020027a54c | 847 | py | Python | source/upload_user_stats.py | CheyenneNS/metrics | cfeeac6d01d99679897a998b193d630ada169c61 | [
"MIT"
] | null | null | null | source/upload_user_stats.py | CheyenneNS/metrics | cfeeac6d01d99679897a998b193d630ada169c61 | [
"MIT"
] | null | null | null | source/upload_user_stats.py | CheyenneNS/metrics | cfeeac6d01d99679897a998b193d630ada169c61 | [
"MIT"
] | null | null | null | import time
import methods_upload_user_stats
import datetime
print("############################################")
print("User Stats Upload (UTC): " + str(datetime.datetime.utcnow()))
start_time = time.time()
user_stats_dict = methods_upload_user_stats.get_user_info_from_auth2()
user_stats_dict = methods_upload_user_stats.get_internal_users(user_stats_dict)
user_stats_dict = methods_upload_user_stats.get_user_orgs_count(user_stats_dict)
user_stats_dict = methods_upload_user_stats.get_user_narrative_stats(user_stats_dict)
user_stats_dict = methods_upload_user_stats.get_institution_and_country(user_stats_dict)
print("--- gather data %s seconds ---" % (time.time() - start_time))
methods_upload_user_stats.upload_user_data(user_stats_dict)
print("--- including user info and user_stats upload %s seconds ---" % (time.time() - start_time))
| 47.055556 | 98 | 0.781582 | 123 | 847 | 4.878049 | 0.243902 | 0.285 | 0.216667 | 0.256667 | 0.485 | 0.485 | 0.401667 | 0.401667 | 0.338333 | 0.268333 | 0 | 0.001271 | 0.070838 | 847 | 17 | 99 | 49.823529 | 0.761118 | 0 | 0 | 0 | 0 | 0 | 0.188389 | 0.052133 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.214286 | 0 | 0.214286 | 0.285714 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f3b9fa42cb03da28c10b740dee72b4fc3af278a | 1,482 | py | Python | app/stats/data.py | projectweekend/THPL-Data-API | 28995ad93d5d16cb9da10f52f30ae16d34c4c5c3 | [
"MIT"
] | null | null | null | app/stats/data.py | projectweekend/THPL-Data-API | 28995ad93d5d16cb9da10f52f30ae16d34c4c5c3 | [
"MIT"
] | null | null | null | app/stats/data.py | projectweekend/THPL-Data-API | 28995ad93d5d16cb9da10f52f30ae16d34c4c5c3 | [
"MIT"
] | null | null | null | from app import db
def latest_reading(sensor):
query = """
WITH result AS (
SELECT *
FROM thpl_data
WHERE sensor = %s
ORDER BY logged_at DESC
LIMIT 1
)
SELECT ROW_TO_JSON(result.*)
FROM result;
"""
with db.cursor() as cursor:
cursor.execute(query, (sensor, ))
result = cursor.fetchone()
return result[0] if result else None
def hourly_stats(sensor, start_day, end_day):
query = """
WITH result AS (
SELECT *
FROM thpl_hourly_agg
WHERE sensor = %s AND
hour >= %s AND
hour < %s
ORDER BY hour DESC
)
SELECT JSON_AGG(result.*)
FROM result;
"""
with db.cursor() as cursor:
cursor.execute(query, (sensor, start_day, end_day, ))
result = cursor.fetchone()
return result[0] if result else None
def daily_stats(sensor, start_day, end_day):
query = """
WITH result AS (
SELECT *
FROM thpl_daily_agg
WHERE sensor = %s AND
day >= %s AND
day < %s
ORDER BY day DESC
)
SELECT JSON_AGG(result.*)
FROM result;
"""
with db.cursor() as cursor:
cursor.execute(query, (sensor, start_day, end_day, ))
result = cursor.fetchone()
return result[0] if result else None
| 25.551724 | 61 | 0.509447 | 170 | 1,482 | 4.317647 | 0.258824 | 0.059946 | 0.076294 | 0.092643 | 0.782016 | 0.73297 | 0.73297 | 0.690736 | 0.690736 | 0.690736 | 0 | 0.004525 | 0.403509 | 1,482 | 57 | 62 | 26 | 0.825792 | 0 | 0 | 0.588235 | 0 | 0 | 0.533738 | 0.01417 | 0 | 0 | 0 | 0 | 0 | 1 | 0.058824 | false | 0 | 0.019608 | 0 | 0.137255 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f45f2a335cb11b4d642185ee87044a60a1ba434 | 518 | py | Python | apps/users/migrations/0017_auto_20200807_1727.py | lucasjaroszewski/incremental-game | bae8823f986be0fd046bd50195d43fbc548fad90 | [
"MIT"
] | null | null | null | apps/users/migrations/0017_auto_20200807_1727.py | lucasjaroszewski/incremental-game | bae8823f986be0fd046bd50195d43fbc548fad90 | [
"MIT"
] | 5 | 2021-06-09T17:54:51.000Z | 2022-03-12T00:46:49.000Z | apps/users/migrations/0017_auto_20200807_1727.py | lucasjaroszewski/incremental-game | bae8823f986be0fd046bd50195d43fbc548fad90 | [
"MIT"
] | 1 | 2020-09-27T18:26:15.000Z | 2020-09-27T18:26:15.000Z | # Generated by Django 3.0.6 on 2020-08-07 20:27
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0016_auto_20200807_1719'),
]
operations = [
migrations.RenameField(
model_name='fish',
old_name='man_eating_swamp',
new_name='man_eating_marsh',
),
migrations.RenameField(
model_name='fish',
old_name='rinde_port',
new_name='rinde',
),
]
| 21.583333 | 47 | 0.567568 | 55 | 518 | 5.090909 | 0.672727 | 0.15 | 0.185714 | 0.214286 | 0.292857 | 0.292857 | 0.292857 | 0 | 0 | 0 | 0 | 0.088319 | 0.322394 | 518 | 23 | 48 | 22.521739 | 0.709402 | 0.086873 | 0 | 0.352941 | 1 | 0 | 0.176221 | 0.048832 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f4ec9ee4cd0d2d6b3b82e7717f7eecb86c43dce | 212 | py | Python | Semester.py | griffincosgrove/frat-cash | 0b658e99d606ddf208c3179493bb1b24b95a7f4f | [
"Apache-2.0"
] | null | null | null | Semester.py | griffincosgrove/frat-cash | 0b658e99d606ddf208c3179493bb1b24b95a7f4f | [
"Apache-2.0"
] | null | null | null | Semester.py | griffincosgrove/frat-cash | 0b658e99d606ddf208c3179493bb1b24b95a7f4f | [
"Apache-2.0"
] | null | null | null | class Semester:
def __init__(self, season:str, year:int, brother_id:int, amount:float):
self.season = season
self.year = year
self.brother_id = brother_id
self.amount = amount | 30.285714 | 75 | 0.641509 | 28 | 212 | 4.607143 | 0.464286 | 0.209302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.264151 | 212 | 7 | 76 | 30.285714 | 0.826923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f5fcdce435474efded83e8603d4446f32162c98 | 749 | py | Python | twitoff/app.py | dmhliu/twitoff | 4c880eedf0a0925fe9200b1cf2a09d555a372adc | [
"MIT"
] | null | null | null | twitoff/app.py | dmhliu/twitoff | 4c880eedf0a0925fe9200b1cf2a09d555a372adc | [
"MIT"
] | 4 | 2021-06-08T22:12:41.000Z | 2022-03-12T00:48:37.000Z | twitoff/app.py | dmhliu/twitoff | 4c880eedf0a0925fe9200b1cf2a09d555a372adc | [
"MIT"
] | null | null | null | import os
from os import getenv
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from .models import DB, User,Tweet, add_test_users
from .twitter import add_or_update_user, add_users, update_all_users
from .predict import predict_user
from .admin.routes import admin
from .main.routes import main
def create_app(): # TODO add config from file
app = Flask(__name__) # create Flask instance
Bootstrap(app) # create bootstrap instance
app.config['SQLALCHEMY_DATABASE_URI'] = getenv('DATABASE_URL')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.register_blueprint(main)
app.register_blueprint(admin)
DB.init_app(app) # db instance setup
return app
| 34.045455 | 68 | 0.748999 | 103 | 749 | 5.213592 | 0.417476 | 0.03352 | 0.070764 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.184246 | 749 | 21 | 69 | 35.666667 | 0.878887 | 0.124166 | 0 | 0 | 0 | 0 | 0.1 | 0.081538 | 0 | 0 | 0 | 0.047619 | 0 | 1 | 0.055556 | false | 0 | 0.5 | 0 | 0.611111 | 0.111111 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
8f6b2959d73d9d52381f20389378e8944866a3c4 | 5,179 | py | Python | up_revendas/cars/migrations/0008_auto_20210126_2052.py | MikaelSantilio/uprevendas-api | f04312988ffe3231f68ae0ebeaed9eaf0a7914b0 | [
"MIT"
] | 1 | 2021-08-24T00:32:12.000Z | 2021-08-24T00:32:12.000Z | up_revendas/cars/migrations/0008_auto_20210126_2052.py | MikaelSantilio/uprevendas-api | f04312988ffe3231f68ae0ebeaed9eaf0a7914b0 | [
"MIT"
] | null | null | null | up_revendas/cars/migrations/0008_auto_20210126_2052.py | MikaelSantilio/uprevendas-api | f04312988ffe3231f68ae0ebeaed9eaf0a7914b0 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.11 on 2021-01-26 23:52
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import up_revendas.cars.validators
class Migration(migrations.Migration):
dependencies = [
('cars', '0007_auto_20210126_1543'),
]
operations = [
migrations.AlterField(
model_name='brand',
name='name',
field=models.CharField(max_length=32, verbose_name='Nome'),
),
migrations.AlterField(
model_name='car',
name='active',
field=models.BooleanField(default=True, verbose_name='Ativo'),
),
migrations.AlterField(
model_name='car',
name='brand',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cars', to='cars.Brand', verbose_name='Marca'),
),
migrations.AlterField(
model_name='car',
name='car_type',
field=models.CharField(choices=[('hatch', 'Hatch'), ('sedan', 'Sedã'), ('suv', 'SUV'), ('van', 'Van/Utilitário'), ('pick-up', 'Pick-Up'), ('convertible', 'Conversível'), ('sport', 'Sport'), ('luxury', 'Luxo')], max_length=12, verbose_name='Tipo do carro'),
),
migrations.AlterField(
model_name='car',
name='color',
field=models.CharField(choices=[('black', 'Preto'), ('white', 'Branco'), ('silver', 'Prata'), ('red', 'Vermelho'), ('cinza', 'Cinza'), ('blue', 'Azul'), ('yellow', 'Amarelo'), ('green', 'Verde'), ('orange', 'Laranja'), ('other', 'Outra')], max_length=12, verbose_name='Cor'),
),
migrations.AlterField(
model_name='car',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='Criado em'),
),
migrations.AlterField(
model_name='car',
name='license_plate',
field=models.CharField(max_length=8, validators=[up_revendas.cars.validators.validateCarLicensePlate], verbose_name='Placa'),
),
migrations.AlterField(
model_name='car',
name='mileage',
field=models.IntegerField(validators=[django.core.validators.MinValueValidator(0)], verbose_name='Quilometragem'),
),
migrations.AlterField(
model_name='car',
name='min_sale_value',
field=models.FloatField(validators=[django.core.validators.MinValueValidator(0)], verbose_name='Valor min. de venda'),
),
migrations.AlterField(
model_name='car',
name='model',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cars', to='cars.Model', verbose_name='Modelo'),
),
migrations.AlterField(
model_name='car',
name='sold',
field=models.BooleanField(default=False, verbose_name='Vendido'),
),
migrations.AlterField(
model_name='car',
name='transmission',
field=models.CharField(choices=[('M', 'Manual'), ('AT', 'Automatic'), ('SA', 'Semi Automatic')], max_length=14, verbose_name='Transmissão'),
),
migrations.AlterField(
model_name='car',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='Atualizado em'),
),
migrations.AlterField(
model_name='car',
name='version',
field=models.CharField(max_length=255, verbose_name='Versão'),
),
migrations.AlterField(
model_name='car',
name='year',
field=models.IntegerField(choices=[(1951, 1951), (1952, 1952), (1953, 1953), (1954, 1954), (1955, 1955), (1956, 1956), (1957, 1957), (1958, 1958), (1959, 1959), (1960, 1960), (1961, 1961), (1962, 1962), (1963, 1963), (1964, 1964), (1965, 1965), (1966, 1966), (1967, 1967), (1968, 1968), (1969, 1969), (1970, 1970), (1971, 1971), (1972, 1972), (1973, 1973), (1974, 1974), (1975, 1975), (1976, 1976), (1977, 1977), (1978, 1978), (1979, 1979), (1980, 1980), (1981, 1981), (1982, 1982), (1983, 1983), (1984, 1984), (1985, 1985), (1986, 1986), (1987, 1987), (1988, 1988), (1989, 1989), (1990, 1990), (1991, 1991), (1992, 1992), (1993, 1993), (1994, 1994), (1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021)], verbose_name='Ano'),
),
migrations.AlterField(
model_name='model',
name='brand',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='models', to='cars.Brand', verbose_name='Marca'),
),
migrations.AlterField(
model_name='model',
name='name',
field=models.CharField(max_length=32, verbose_name='Nome'),
),
]
| 50.77451 | 1,062 | 0.579649 | 558 | 5,179 | 5.270609 | 0.367384 | 0.058143 | 0.144509 | 0.16763 | 0.428086 | 0.393404 | 0.222033 | 0.196192 | 0.156069 | 0.156069 | 0 | 0.156544 | 0.240201 | 5,179 | 101 | 1,063 | 51.277228 | 0.590851 | 0.008882 | 0 | 0.589474 | 1 | 0 | 0.121029 | 0.004483 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.042105 | 0 | 0.073684 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
56c5e20da2cd5885b05e167a228b34272f42dc84 | 667 | py | Python | anormbookmarker/cli/visualization/sa_display.py | jakeogh/anormbookmarker | d8516cc47dd7e5a5484eb9c1e8f44155b7663897 | [
"MIT"
] | 2 | 2017-05-08T04:44:56.000Z | 2017-08-21T06:41:05.000Z | anormbookmarker/cli/visualization/sa_display.py | jakeogh/anormbookmarker | d8516cc47dd7e5a5484eb9c1e8f44155b7663897 | [
"MIT"
] | null | null | null | anormbookmarker/cli/visualization/sa_display.py | jakeogh/anormbookmarker | d8516cc47dd7e5a5484eb9c1e8f44155b7663897 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import click
from anormbookmarker.model.__model__ import *
from anormbookmarker.model.BookmarkClassConstructor import tagbookmarks_table
from anormbookmarker.model.Word import WordMisSpelling
from anormbookmarker.test.test_enviroment import Tag
from anormbookmarker.test.test_enviroment import Bookmark
from kcl.sqlalchemy.model.Filename import Filename
#from kcl.sqlalchemy.model.FileRecord import Filename
#from kcl.sqlalchemy.model.FileRecord import Path
from kcl.sqlalchemy.visualization.sa_display import sa_display as kcl_sa_display
@click.command()
def sa_display():
#import IPython; IPython.embed()
kcl_sa_display(globals())
| 35.105263 | 80 | 0.841079 | 85 | 667 | 6.435294 | 0.376471 | 0.173675 | 0.124314 | 0.120658 | 0.33638 | 0.33638 | 0.179159 | 0.179159 | 0 | 0 | 0 | 0.001647 | 0.089955 | 667 | 18 | 81 | 37.055556 | 0.899506 | 0.227886 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | true | 0 | 0.727273 | 0 | 0.818182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
56d4ae2516a02d22b9e5eaeff2eea0ceaa9d5529 | 558 | py | Python | dadvisor/datatypes/dataflow.py | dadvisor/core | 31d59707eb9bf33f5bea4a8fb6fb1f0de9a37eba | [
"MIT"
] | null | null | null | dadvisor/datatypes/dataflow.py | dadvisor/core | 31d59707eb9bf33f5bea4a8fb6fb1f0de9a37eba | [
"MIT"
] | null | null | null | dadvisor/datatypes/dataflow.py | dadvisor/core | 31d59707eb9bf33f5bea4a8fb6fb1f0de9a37eba | [
"MIT"
] | null | null | null | from dadvisor.datatypes.address import Address
class DataFlow(object):
"""
stores the transmission of a certain amount of data from the source to the destination
"""
def __init__(self, src: Address, dst: Address, size: int):
self.src = src
self.dst = dst
self.size = size
def __str__(self):
return '{} > {}: {}'.format(self.src, self.dst, self.size)
def __dict__(self):
return {'src': self.src.__dict__(),
'dst': self.dst.__dict__(),
'size': self.size}
| 26.571429 | 94 | 0.578853 | 68 | 558 | 4.455882 | 0.441176 | 0.092409 | 0.066007 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.292115 | 558 | 20 | 95 | 27.9 | 0.767089 | 0.154122 | 0 | 0 | 0 | 0 | 0.04646 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.083333 | 0.166667 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
56eb48b793e4e92c70b2a1ae53c67089c5aafd3a | 2,090 | py | Python | programs/sparse.py | thinkmoore/das | d9faabf3de987b890a5079b914f5aba597215b14 | [
"CC0-1.0"
] | 35 | 2019-04-16T19:37:01.000Z | 2022-02-14T20:33:41.000Z | programs/sparse.py | thinkmoore/das | d9faabf3de987b890a5079b914f5aba597215b14 | [
"CC0-1.0"
] | 6 | 2019-06-05T19:41:15.000Z | 2020-08-19T19:04:59.000Z | programs/sparse.py | thinkmoore/das | d9faabf3de987b890a5079b914f5aba597215b14 | [
"CC0-1.0"
] | 12 | 2019-05-02T19:38:06.000Z | 2021-09-11T22:02:03.000Z | import scipy.sparse as ss
import numpy as np
class multiSparse:
"""
This class is used to store a multi-dimensional numpy array as a sparse array and transform it back to a dense array when needed.
"""
def __init__(self, array):
if isinstance(array, np.ndarray): # a numpy ndarray is expected to initialize multiSparse
self.sparse_array = ss.csr_matrix(array.flatten())
self.shape = array.shape
else:
raise TypeError("array must be of class numpy.ndarray")
def toDense(self):
temp = np.array(self.sparse_array.todense())
dense_array = temp.reshape(self.shape)
return(dense_array)
def __add__(self, b):
assert self.shape == b.shape
tmp = multiSparse(np.array([0]))
tmp.shape = self.shape
tmp.sparse_array = self.sparse_array + b.sparse_array
return tmp
def sum(self, dims = None):
if dims:
out = self.toDense().sum(dims)
else:
out = np.array(self.sparse_array.sum())
return out
def __sub__(self, b):
assert self.shape == b.shape
tmp = multiSparse(np.array([0]))
tmp.shape = self.shape
tmp.sparse_array = self.sparse_array - b.sparse_array
return tmp
def __eq__(self, other):
assert self.shape == other.shape
if np.issubdtype(self.sparse_array.dtype, float):
return np.isclose(np.array(self.sparse_array.todense()), np.array(other.sparse_array.todense()), equal_nan=True).all()
else:
return not (self.sparse_array != other.sparse_array).todense().any()
def abs(self):
self.sparse_array.data = np.abs(self.sparse_array.data)
return self
def sqrt(self):
self.sparse_array = self.sparse_array.sqrt()
return self
def square(self):
self.sparse_array.data = np.square(self.sparse_array.data)
return self
def max(self):
self.sparse_array = self.sparse_array.max()
return self
| 32.65625 | 133 | 0.609091 | 275 | 2,090 | 4.476364 | 0.269091 | 0.205524 | 0.194963 | 0.113729 | 0.450041 | 0.386678 | 0.298944 | 0.191714 | 0.191714 | 0.191714 | 0 | 0.001343 | 0.28756 | 2,090 | 63 | 134 | 33.174603 | 0.825386 | 0.088038 | 0 | 0.306122 | 0 | 0 | 0.019048 | 0 | 0 | 0 | 0 | 0 | 0.061224 | 1 | 0.204082 | false | 0 | 0.040816 | 0 | 0.44898 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
56f00acee7e799d52a86853be1de7f00199a53e7 | 79 | py | Python | feelsbook/__init__.py | LionKingSimba/FeelsBook | c2c912a7d64f25de755c5fa7597779a3f74038f5 | [
"MIT"
] | null | null | null | feelsbook/__init__.py | LionKingSimba/FeelsBook | c2c912a7d64f25de755c5fa7597779a3f74038f5 | [
"MIT"
] | 2 | 2019-01-19T21:58:16.000Z | 2019-01-20T01:49:53.000Z | feelsbook/__init__.py | LionKingSimba/FeelsBook | c2c912a7d64f25de755c5fa7597779a3f74038f5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# TODO: doc
"""feelsbook
"""
__version__ = (0, 0, 0)
| 9.875 | 23 | 0.506329 | 10 | 79 | 3.6 | 0.8 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064516 | 0.21519 | 79 | 7 | 24 | 11.285714 | 0.516129 | 0.531646 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
710180788e46fb9672dd2581b521808730d01041 | 347 | py | Python | src/onegov/ticket/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/ticket/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/ticket/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from onegov.ticket.handler import Handler, HandlerRegistry
handlers = HandlerRegistry() # noqa
from onegov.ticket.model import Ticket
from onegov.ticket.model import TicketPermission
from onegov.ticket.collection import TicketCollection
__all__ = [
'Handler',
'handlers',
'Ticket',
'TicketCollection',
'TicketPermission'
]
| 21.6875 | 58 | 0.755043 | 34 | 347 | 7.588235 | 0.382353 | 0.155039 | 0.248062 | 0.162791 | 0.209302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158501 | 347 | 15 | 59 | 23.133333 | 0.883562 | 0.011527 | 0 | 0 | 0 | 0 | 0.155425 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
71052b040ab325664a81c80da34dc4d6f0a370d7 | 35 | py | Python | src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/test/python/scripts/res_test_robot_session_server/c/__init__.py | puraner/RED | d41b7c244ff2e449c541fd0691213fcf5a3b30c1 | [
"Apache-2.0"
] | 375 | 2015-11-02T19:15:30.000Z | 2022-03-19T03:32:10.000Z | src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/test/python/scripts/res_test_robot_session_server/c/__init__.py | puraner/RED | d41b7c244ff2e449c541fd0691213fcf5a3b30c1 | [
"Apache-2.0"
] | 433 | 2015-11-03T13:24:40.000Z | 2022-03-30T11:20:14.000Z | src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/test/python/scripts/res_test_robot_session_server/c/__init__.py | puraner/RED | d41b7c244ff2e449c541fd0691213fcf5a3b30c1 | [
"Apache-2.0"
] | 133 | 2016-05-02T02:20:06.000Z | 2022-01-06T06:01:28.000Z | i = 1
while i > 0:
print("true")
| 8.75 | 14 | 0.514286 | 7 | 35 | 2.571429 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 0.285714 | 35 | 4 | 15 | 8.75 | 0.64 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
711baab41335aca75dd12ccc4d7f5df54ec9cd35 | 228 | py | Python | spidermon/contrib/monitors/mixins/stats.py | zanachka/spidermon | d2840b6bbb6ba6d8a0ef633deac66588d243e615 | [
"BSD-3-Clause"
] | 405 | 2019-01-10T13:06:09.000Z | 2022-03-30T20:14:58.000Z | spidermon/contrib/monitors/mixins/stats.py | zanachka/spidermon | d2840b6bbb6ba6d8a0ef633deac66588d243e615 | [
"BSD-3-Clause"
] | 226 | 2019-01-04T13:31:17.000Z | 2022-03-28T21:06:10.000Z | spidermon/contrib/monitors/mixins/stats.py | zanachka/spidermon | d2840b6bbb6ba6d8a0ef633deac66588d243e615 | [
"BSD-3-Clause"
] | 87 | 2019-01-07T10:23:26.000Z | 2022-02-22T04:38:04.000Z | from spidermon.exceptions import NotConfigured
class StatsMonitorMixin:
@property
def stats(self):
if not self.data.stats:
raise NotConfigured("Stats not available!")
return self.data.stats
| 22.8 | 55 | 0.684211 | 25 | 228 | 6.24 | 0.68 | 0.102564 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.245614 | 228 | 9 | 56 | 25.333333 | 0.906977 | 0 | 0 | 0 | 0 | 0 | 0.087719 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
713b63ae10a24f820ddf86ecff7bd7e2005a2760 | 313 | py | Python | app/admin.py | beedev-services/dragonsEdgeCreations | 13a80c96feb5c7eaf4823b0e039dec30e791c7b0 | [
"MIT"
] | null | null | null | app/admin.py | beedev-services/dragonsEdgeCreations | 13a80c96feb5c7eaf4823b0e039dec30e791c7b0 | [
"MIT"
] | null | null | null | app/admin.py | beedev-services/dragonsEdgeCreations | 13a80c96feb5c7eaf4823b0e039dec30e791c7b0 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import *
admin.site.register(User)
admin.site.register(Profile)
admin.site.register(Customer)
admin.site.register(Account)
admin.site.register(Event)
admin.site.register(Format)
admin.site.register(Language)
admin.site.register(Product)
admin.site.register(Picture)
| 24.076923 | 32 | 0.817891 | 44 | 313 | 5.818182 | 0.386364 | 0.316406 | 0.597656 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057508 | 313 | 12 | 33 | 26.083333 | 0.867797 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.181818 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
71415563b5394f16e97a62d06268a2caa9c29e62 | 274 | py | Python | Leetcode/191. Number of 1 Bits/solution5.py | asanoviskhak/Outtalent | c500e8ad498f76d57eb87a9776a04af7bdda913d | [
"MIT"
] | 51 | 2020-07-12T21:27:47.000Z | 2022-02-11T19:25:36.000Z | Leetcode/191. Number of 1 Bits/solution5.py | CrazySquirrel/Outtalent | 8a10b23335d8e9f080e5c39715b38bcc2916ff00 | [
"MIT"
] | null | null | null | Leetcode/191. Number of 1 Bits/solution5.py | CrazySquirrel/Outtalent | 8a10b23335d8e9f080e5c39715b38bcc2916ff00 | [
"MIT"
] | 32 | 2020-07-27T13:54:24.000Z | 2021-12-25T18:12:50.000Z | TABLE8 = [0] * 2 ** 8
for index in range(len(TABLE8)):
TABLE8[index] = (index & 1) + TABLE8[index >> 1]
class Solution:
def hammingWeight(self, n: int) -> int:
return TABLE8[n & 0xff] + TABLE8[(n >> 8) & 0xff] + TABLE8[(n >> 16) & 0xff] + TABLE8[n >> 24]
| 27.4 | 102 | 0.558394 | 40 | 274 | 3.825 | 0.525 | 0.183007 | 0.215686 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101449 | 0.244526 | 274 | 9 | 103 | 30.444444 | 0.637681 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043796 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0.166667 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
856055b3f5bec174b12284852d80f1f727aef354 | 169 | py | Python | config/settings/local.py | simongawlik/collect-and-share | 7a2e3c549726b3321dcb914c7d184fa8442f683d | [
"MIT"
] | null | null | null | config/settings/local.py | simongawlik/collect-and-share | 7a2e3c549726b3321dcb914c7d184fa8442f683d | [
"MIT"
] | null | null | null | config/settings/local.py | simongawlik/collect-and-share | 7a2e3c549726b3321dcb914c7d184fa8442f683d | [
"MIT"
] | null | null | null | from .base import *
SECRET_KEY = env('DJANGO_SECRET_KEY', default='b(sx)ez5cca37%)_&p(lv-6)r(8-d+x06_$t19500ij+hf$#tp')
DEBUG = env.bool('DJANGO_DEBUG', default=True)
| 28.166667 | 99 | 0.715976 | 30 | 169 | 3.833333 | 0.8 | 0.156522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077419 | 0.08284 | 169 | 5 | 100 | 33.8 | 0.664516 | 0 | 0 | 0 | 0 | 0.333333 | 0.467456 | 0.295858 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8565686454c13d3eef7860491b2b4992e21fe8c1 | 94 | py | Python | Crudapp/apps.py | snragund/Student_System | 5daffb3163ce9b1b96d5439ed38afce254b28d02 | [
"MIT"
] | null | null | null | Crudapp/apps.py | snragund/Student_System | 5daffb3163ce9b1b96d5439ed38afce254b28d02 | [
"MIT"
] | null | null | null | Crudapp/apps.py | snragund/Student_System | 5daffb3163ce9b1b96d5439ed38afce254b28d02 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class CrudappConfig(AppConfig):
name = 'Crudapp'
| 15.666667 | 34 | 0.712766 | 10 | 94 | 6.7 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212766 | 94 | 5 | 35 | 18.8 | 0.905405 | 0 | 0 | 0 | 0 | 0 | 0.078652 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8583b3844de422ac6bf9937a4040bc2a1b10d443 | 144 | py | Python | app/__init__.py | jwestgard/cost-calc | 87482ea58735f8fa3109cdfe897785db96f7cef3 | [
"MIT"
] | null | null | null | app/__init__.py | jwestgard/cost-calc | 87482ea58735f8fa3109cdfe897785db96f7cef3 | [
"MIT"
] | null | null | null | app/__init__.py | jwestgard/cost-calc | 87482ea58735f8fa3109cdfe897785db96f7cef3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from flask import Flask
app = Flask(__name__)
from app import views
if __name__ == "__main__":
app.run(debug=True)
| 16 | 26 | 0.715278 | 22 | 144 | 4.136364 | 0.681818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008333 | 0.166667 | 144 | 8 | 27 | 18 | 0.75 | 0.145833 | 0 | 0 | 0 | 0 | 0.065574 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
85b0c0d3fe274f3a277dcbab698996d7ef042a04 | 1,297 | py | Python | aiotdlib/api/types/chat_event.py | mostafa-arshadi/aiotdlib | 59f430a65dfb424fc69d471a0d7bcd77ad7acf08 | [
"MIT"
] | 37 | 2021-05-04T10:41:41.000Z | 2022-03-30T13:48:05.000Z | aiotdlib/api/types/chat_event.py | mostafa-arshadi/aiotdlib | 59f430a65dfb424fc69d471a0d7bcd77ad7acf08 | [
"MIT"
] | 13 | 2021-07-17T19:54:51.000Z | 2022-02-26T06:50:00.000Z | aiotdlib/api/types/chat_event.py | mostafa-arshadi/aiotdlib | 59f430a65dfb424fc69d471a0d7bcd77ad7acf08 | [
"MIT"
] | 7 | 2021-09-22T21:27:11.000Z | 2022-02-20T02:33:19.000Z | # =============================================================================== #
# #
# This file has been generated automatically!! Do not change this manually! #
# #
# =============================================================================== #
from __future__ import annotations
from pydantic import Field
from .chat_event_action import ChatEventAction
from .message_sender import MessageSender
from ..base_object import BaseObject
class ChatEvent(BaseObject):
"""
Represents a chat event
:param id: Chat event identifier
:type id: :class:`int`
:param date: Point in time (Unix timestamp) when the event happened
:type date: :class:`int`
:param member_id: Identifier of the user or chat who performed the action
:type member_id: :class:`MessageSender`
:param action: The action
:type action: :class:`ChatEventAction`
"""
ID: str = Field("chatEvent", alias="@type")
id: int
date: int
member_id: MessageSender
action: ChatEventAction
@staticmethod
def read(q: dict) -> ChatEvent:
return ChatEvent.construct(**q)
| 30.880952 | 83 | 0.508096 | 117 | 1,297 | 5.538462 | 0.504274 | 0.041667 | 0.040123 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.303007 | 1,297 | 41 | 84 | 31.634146 | 0.716814 | 0.585968 | 0 | 0 | 1 | 0 | 0.030568 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.357143 | 0.071429 | 0.928571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a413705953f574eaf6e7f8f64d88bbde43219a1b | 683 | py | Python | ravendb/documents/operations/etl/sql/__init__.py | ravendb/RavenDB-Python-Client | 6286b459b501e755fe8e8591a48acf8616605ccd | [
"MIT"
] | 8 | 2016-10-08T17:45:44.000Z | 2018-05-29T12:16:43.000Z | ravendb/documents/operations/etl/sql/__init__.py | ravendb/RavenDB-Python-Client | 6286b459b501e755fe8e8591a48acf8616605ccd | [
"MIT"
] | 5 | 2017-02-12T15:50:53.000Z | 2017-09-18T12:25:01.000Z | ravendb/documents/operations/etl/sql/__init__.py | ravendb/RavenDB-Python-Client | 6286b459b501e755fe8e8591a48acf8616605ccd | [
"MIT"
] | 8 | 2016-07-03T07:59:12.000Z | 2017-09-18T11:22:23.000Z | from typing import Optional
from ravendb.documents.operations.connection_strings import ConnectionString
import ravendb.serverwide
from ravendb.documents.operations.etl.configuration import EtlConfiguration
class SqlConnectionString(ConnectionString):
def __init__(self, name: str, connection_string: Optional[str] = None, factory_name: Optional[str] = None):
super().__init__(name)
self.connection_string = connection_string
self.factory_name = factory_name
@property
def get_type(self):
return ravendb.serverwide.ConnectionStringType.SQL
# todo: implement
class SqlEtlConfiguration(EtlConfiguration[SqlConnectionString]):
pass
| 31.045455 | 111 | 0.781845 | 71 | 683 | 7.295775 | 0.492958 | 0.092664 | 0.07722 | 0.11583 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146413 | 683 | 21 | 112 | 32.52381 | 0.888508 | 0.021962 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 0 | 1 | 0.142857 | false | 0.071429 | 0.285714 | 0.071429 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
a4185610e31412a11ecc50c89da1ecb84b3a69e4 | 4,264 | py | Python | SJM/m6A_peak_call_hg38.py | jhfoxliu/mod_RIP_peakcall_traditional | 0dd141d7d830f6509c7c348483f0849b1462e9d4 | [
"MIT"
] | null | null | null | SJM/m6A_peak_call_hg38.py | jhfoxliu/mod_RIP_peakcall_traditional | 0dd141d7d830f6509c7c348483f0849b1462e9d4 | [
"MIT"
] | null | null | null | SJM/m6A_peak_call_hg38.py | jhfoxliu/mod_RIP_peakcall_traditional | 0dd141d7d830f6509c7c348483f0849b1462e9d4 | [
"MIT"
] | null | null | null | import sys,os
from sjm_tools import job,check_env
if not sys.argv[1]:
print "Usage: python %s [Sample Sheet]" % (sys.argv[0])
windows_file = check_env("/share/public1/data/liujh/database/human/ensembl_release104_GRCh38/sliding_window/Homo_sapiens.GRCh38.104.chr_patch_hapl_scaff.noheader.exons.w50s25.chr.txt")
python = check_env('/share/public/apps/bin/python')
bedtools = check_env('/share/public/apps/bedtools/2.29.2/bin/bedtools')
perl = check_env('/share/public1/data/liujh/software/perlbrew/perls/perl-5.24.1/bin/perl')
chr_size = "/share/public1/data/liujh/database/human/ensembl_release104_GRCh38/genome/Homo_sapiens.GRCh38.dna_sm.primary_assembly.chr.size"
script_prefix = '/share/public1/data/liujh/script/m5C-seq/'
PATH = "./"
with open(sys.argv[1], "r") as input:
for line in input.readlines():
if not line:
continue
name, input_prefix, input_winsize, ip_prefix, ip_winsize = line.strip().split("\t")
SJM = name + "_call_peak.sjm"
workpath = PATH + "/" + name + "_call_peak/"
if os.path.isdir(workpath) == False:
os.mkdir(workpath)
JOB = job(workpath,SJM)
JOB.step_start(step_name="CallPeak",memory="50G")
JOB.add_process("{perl} {script_prefix}/rnaexp_rpkm_strand_ZH.pl {windows_file} {chr_size} ../{prefix}/{prefix}.minus.bedGraph ../{prefix}/{prefix}.plus.bedGraph {prefix}_window_rpkm.txt {winsize}".format(script_prefix=script_prefix,perl=perl, chr_size=chr_size, windows_file=windows_file, winsize=input_winsize, prefix=input_prefix))
JOB.add_process("{perl} {script_prefix}/rnaexp_rpkm_strand_ZH.pl {windows_file} {chr_size} ../{prefix}/{prefix}.minus.bedGraph ../{prefix}/{prefix}.plus.bedGraph {prefix}_window_rpkm.txt {winsize}".format(script_prefix=script_prefix,perl=perl, chr_size=chr_size, windows_file=windows_file, winsize=ip_winsize, prefix=ip_prefix))
JOB.add_process("{python} {script_prefix}/merge_input_eluate_win_RPKM.py {prefix_input}_window_rpkm.txt {prefix_ip}_window_rpkm.txt {name}_eluate_win_rpkm.txt".format(script_prefix=script_prefix,python=python, prefix_input=input_prefix, prefix_ip=ip_prefix, name=name))
JOB.add_process("{perl} {script_prefix}/calculate_winscore.pl {name}_eluate_win_rpkm.txt".format(script_prefix=script_prefix,perl=perl, name=name))
JOB.add_process("{perl} {script_prefix}/remove_data_RPKM1.pl {name}_eluate_win_rpkm_winscore.txt {name}_winscore_filtered.txt".format(script_prefix=script_prefix,perl=perl, name=name))
JOB.add_process("{perl} {script_prefix}/match_two_files.pl {name}_winscore_filtered.txt {windows_file} {name}_winscore_filtered_matched.txt".format(script_prefix=script_prefix,perl=perl, name=name, windows_file=windows_file))
JOB.add_process("cut -f 3,5,6,17,18 {name}_winscore_filtered_matched.txt > {name}_winscore_filtered_matched_formated.txt".format(script_prefix=script_prefix,name=name))
JOB.add_process("{python} {script_prefix}/m6A_add_strand.py {name}_winscore_filtered_matched_formated.txt > {name}_winscore_filtered_matched_formated.bed".format(script_prefix=script_prefix,python=python, name=name))
JOB.add_process("{perl} {script_prefix}/combine_peak.0.5.pl {name}_winscore_filtered_matched_formated.txt".format(script_prefix=script_prefix,perl=perl, name=name))
JOB.add_process("{perl} {script_prefix}/combine_peak2.pl {name}_winscore_filtered_matched_formated.txt".format(script_prefix=script_prefix,perl=perl, name=name))
JOB.add_process("grep -P 'Y$' {name}_winscore_filtered_matched_formated.txt.co.pk | cut -f 1-5 > {name}_winscore_filtered_matched_formated_greped.txt".format(script_prefix=script_prefix,name=name))
JOB.add_process("cat {name}_winscore_filtered_matched_formated_greped.txt {name}_winscore_filtered_matched_formated.txt.co.pk2 > {name}_peaklist.txt".format(script_prefix=script_prefix,name=name))
JOB.add_process("{python} {script_prefix}/add_strand_to_final_peaks.py {windows_file} {name}_peaklist.txt {name}_final_peaks_with_strand.bed".format(script_prefix=script_prefix,python=python, windows_file=windows_file, name=name))
JOB.step_end()
JOB.job_finish()
JOB.submit()
| 73.517241 | 342 | 0.75985 | 622 | 4,264 | 4.879421 | 0.231511 | 0.146293 | 0.055684 | 0.102801 | 0.627677 | 0.587809 | 0.539374 | 0.480066 | 0.438221 | 0.383855 | 0 | 0.014132 | 0.103893 | 4,264 | 57 | 343 | 74.807018 | 0.780162 | 0 | 0 | 0 | 0 | 0.342105 | 0.501876 | 0.415103 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.052632 | null | null | 0.026316 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a4213442082b8b5dae80dbe7ae44c394b7a9c097 | 965 | py | Python | band.py | Scuba-Chris/pythonic_garage_band | f09ae265e8069b4abacd3e8fcb4f12bd96149cb3 | [
"MIT"
] | null | null | null | band.py | Scuba-Chris/pythonic_garage_band | f09ae265e8069b4abacd3e8fcb4f12bd96149cb3 | [
"MIT"
] | null | null | null | band.py | Scuba-Chris/pythonic_garage_band | f09ae265e8069b4abacd3e8fcb4f12bd96149cb3 | [
"MIT"
] | null | null | null |
class Bands:
all_bands = []
def __init__(self, band_name, members):
self.band_name = 'band_name'
self.members = members
self.__class__.all_bands.append(self)
def to_list(self):
return self.all_bands
def __str__(self):
return f'the band name is {self.band_name}'
def __repr__(self):
return f'band: {self.band_name}'
class Musician:
def __init__(self, name, insturment):
self.name = name
self.insturment = insturment
def __str__(self):
return f'I am the {self.insturment}'
def __repr__(self):
return f'band member is: {self.insturment}'
class Guitarist(Musician):
def __init__(self, name):
super().__init__(name, 'guitarist')
class Singer(Musician):
def __init__(self, name):
super().__init__(name, 'singer')
class Drummer(Musician):
def __init__(self, name):
super().__init__(name, 'drummer')
| 21.931818 | 51 | 0.620725 | 119 | 965 | 4.521008 | 0.226891 | 0.089219 | 0.10223 | 0.141264 | 0.388476 | 0.282528 | 0.200743 | 0.200743 | 0 | 0 | 0 | 0 | 0.262176 | 965 | 43 | 52 | 22.44186 | 0.755618 | 0 | 0 | 0.241379 | 0 | 0 | 0.150571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.344828 | false | 0 | 0 | 0.172414 | 0.724138 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a42741f55fc1fc05cc1858ffac20225e8bf9f136 | 187 | py | Python | tests/services/invalid_service.py | 0x1EE7/tomodachi | 8147b16d8be19b80b3bd7c5d8ed21c9863eaaa83 | [
"MIT"
] | null | null | null | tests/services/invalid_service.py | 0x1EE7/tomodachi | 8147b16d8be19b80b3bd7c5d8ed21c9863eaaa83 | [
"MIT"
] | null | null | null | tests/services/invalid_service.py | 0x1EE7/tomodachi | 8147b16d8be19b80b3bd7c5d8ed21c9863eaaa83 | [
"MIT"
] | null | null | null | # flake8: noqa
import tomodachi
@tomodachi.service
class InvalidService(tomodachi.Service):
name = 'test_invalid'
def syntax_error(self) -> error: # type: ignore
pass
| 17 | 52 | 0.695187 | 21 | 187 | 6.095238 | 0.809524 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006757 | 0.208556 | 187 | 10 | 53 | 18.7 | 0.858108 | 0.13369 | 0 | 0 | 0 | 0 | 0.075472 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.166667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a443894583d10265cfb128c8e3cf976cf4716477 | 154 | py | Python | nonebot_plugin_7s_roll/__init__.py | 7sDream/nonebot-plugin-7s-roll | 113278f7d722a7c63d1b3a7f230be0d4c8db004c | [
"MIT"
] | null | null | null | nonebot_plugin_7s_roll/__init__.py | 7sDream/nonebot-plugin-7s-roll | 113278f7d722a7c63d1b3a7f230be0d4c8db004c | [
"MIT"
] | null | null | null | nonebot_plugin_7s_roll/__init__.py | 7sDream/nonebot-plugin-7s-roll | 113278f7d722a7c63d1b3a7f230be0d4c8db004c | [
"MIT"
] | null | null | null | from .command import cmd_roll, message_cmd_roll
from .roll import roll as _roll
__version__ = "0.1.2"
from nonebot import export
export().roll = _roll
| 17.111111 | 47 | 0.766234 | 25 | 154 | 4.36 | 0.52 | 0.12844 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023077 | 0.155844 | 154 | 8 | 48 | 19.25 | 0.815385 | 0 | 0 | 0 | 0 | 0 | 0.032468 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a4458d38625a2eefdacbfee10a17746570de51b4 | 217 | py | Python | 08_String/Step03/gamjapark.py | StudyForCoding/BEAKJOON | 84e1c5e463255e919ccf6b6a782978c205420dbf | [
"MIT"
] | null | null | null | 08_String/Step03/gamjapark.py | StudyForCoding/BEAKJOON | 84e1c5e463255e919ccf6b6a782978c205420dbf | [
"MIT"
] | 3 | 2020-11-04T05:38:53.000Z | 2021-03-02T02:15:19.000Z | 08_String/Step03/gamjapark.py | StudyForCoding/BEAKJOON | 84e1c5e463255e919ccf6b6a782978c205420dbf | [
"MIT"
] | null | null | null | a = list(map(lambda i: ord(i) - 97, list(input())))
idx_array = [-1 for _ in range(26)]
for i in range(len(a)):
if idx_array[a[i]] == -1:
idx_array[a[i]] = i
for idx in idx_array:
print(idx, end=' ') | 24.111111 | 51 | 0.562212 | 42 | 217 | 2.785714 | 0.452381 | 0.273504 | 0.153846 | 0.17094 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035928 | 0.230415 | 217 | 9 | 52 | 24.111111 | 0.664671 | 0 | 0 | 0 | 0 | 0 | 0.004587 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.142857 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a494565751882f72557759dd933a7b257d6100a8 | 982 | py | Python | raspy/io/raspi_gpio.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | raspy/io/raspi_gpio.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | raspy/io/raspi_gpio.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | """A Raspberry Pi GPIO Interface."""
from raspy import board_revision
from raspy.io import gpio_pins
from raspy.io.gpio import Gpio
class RaspiGpio(Gpio):
"""A Raspberry Pi GPIO interface."""
def __init__(self):
"""Initialize a new instance of the raspy.io.raspi_gpio.RaspiGpio class."""
super(Gpio, self).__init__()
@property
def revision(self):
"""Get the board revision.
:returns: The board revision.
:rtype: int
"""
return board_revision.REV2
@property
def inner_pin(self):
"""Get the inner pin being represented by this instance.
:returns: The underlying physical pin.
:rtype: RasPy.io.GpioPins
"""
return gpio_pins.GpioNone()
def on_pin_state_change(self, psce):
"""Fire the pin state change event.
:param raspy.io.pin_state_change_event.PinStateChangeEvent psce: The
pin state change event.
"""
pass
| 23.95122 | 83 | 0.631365 | 122 | 982 | 4.918033 | 0.409836 | 0.058333 | 0.093333 | 0.095 | 0.156667 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001401 | 0.272912 | 982 | 40 | 84 | 24.55 | 0.838936 | 0.453157 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.071429 | 0.214286 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
a4957887385473489f2cb3339696ea87605c81e8 | 115 | py | Python | test/secrets-example.py | dsalisky/EdgeAuth-Token-Python | f0d3ee42b61887ec6890bcc4b907c6ff0d687db7 | [
"Apache-2.0"
] | 19 | 2018-05-13T04:07:29.000Z | 2022-01-29T18:48:30.000Z | test/secrets-example.py | dsalisky/EdgeAuth-Token-Python | f0d3ee42b61887ec6890bcc4b907c6ff0d687db7 | [
"Apache-2.0"
] | 4 | 2018-06-15T12:59:15.000Z | 2021-01-11T07:47:58.000Z | test/secrets-example.py | dsalisky/EdgeAuth-Token-Python | f0d3ee42b61887ec6890bcc4b907c6ff0d687db7 | [
"Apache-2.0"
] | 12 | 2018-07-05T08:46:01.000Z | 2022-02-14T16:37:20.000Z | AT_HOSTNAME = "hostname"
AT_ENCRYPTION_KEY = "encryption key"
AT_TRANSITION_KEY = "transition key"
AT_SALT = "salt" | 28.75 | 36 | 0.782609 | 16 | 115 | 5.25 | 0.375 | 0.309524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113043 | 115 | 4 | 37 | 28.75 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0.344828 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f12313132092f47744037a168883927d77ca58af | 2,708 | py | Python | src/sima/simo/blueprints/liftlinecoupling.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/simo/blueprints/liftlinecoupling.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/simo/blueprints/liftlinecoupling.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | #
# Generated with LiftLineCouplingBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from .simplecoupling import SimpleCouplingBlueprint
class LiftLineCouplingBlueprint(SimpleCouplingBlueprint):
""""""
def __init__(self, name="LiftLineCoupling", package_path="sima/simo", description=""):
super().__init__(name,package_path,description)
self.attributes.append(Attribute("name","string","",default=""))
self.attributes.append(Attribute("description","string","",default=""))
self.attributes.append(Attribute("_id","string","",default=""))
self.attributes.append(BlueprintAttribute("scriptableValues","sima/sima/ScriptableValue","",True,Dimension("*")))
self.attributes.append(BlueprintAttribute("endPoint1","sima/simo/SIMOBodyPoint","",False))
self.attributes.append(BlueprintAttribute("endPoint2","sima/simo/SIMOBodyPoint","",False))
self.attributes.append(EnumAttribute("failureMode","sima/simo/ActivationFailureMode","Failure mode of coupling element"))
self.attributes.append(Attribute("failureTime","number","Earliest possible time of failure",default=0.0))
self.attributes.append(Attribute("breakingStrength","number","Breaking strength",default=0.0))
self.attributes.append(Attribute("numElements","integer","Number of elements",default=0))
self.attributes.append(Attribute("accIncluded","boolean","Flag for including acceleration of the line",default=True))
self.attributes.append(Attribute("diameter","number","Segment diameter",default=0.0))
self.attributes.append(Attribute("eMod","number","Modulus of elasticity",default=0.0))
self.attributes.append(Attribute("emFac","integer","Factor of elasticity - 2 for chains - 1 for other segment types",default=1))
self.attributes.append(Attribute("length","number","Initial, unstretched wire length",default=0.0))
self.attributes.append(Attribute("flexibility","number","Connection flexibility",default=0.0))
self.attributes.append(Attribute("damping","number","Material damping",default=0.0))
self.attributes.append(Attribute("uwia","number","Unit weight in air",default=0.0))
self.attributes.append(Attribute("watfac","number","The ratio of weight in water to weight in air",default=0.0))
self.attributes.append(Attribute("transverseDrag","number","Transverse drag coefficient",default=0.0))
self.attributes.append(Attribute("longitudinalDrag","number","Longitudinal drag coefficient",default=0.0)) | 77.371429 | 136 | 0.740399 | 299 | 2,708 | 6.662207 | 0.334448 | 0.14759 | 0.210843 | 0.24749 | 0.341365 | 0.290161 | 0.247992 | 0.049197 | 0.049197 | 0.049197 | 0 | 0.011618 | 0.110044 | 2,708 | 35 | 137 | 77.371429 | 0.814938 | 0.014771 | 0 | 0 | 1 | 0 | 0.322678 | 0.03836 | 0 | 0 | 0 | 0 | 0 | 1 | 0.033333 | false | 0 | 0.2 | 0 | 0.266667 | 0.233333 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f123676bea07e4cffd2bdf3c30d3734c6726cbba | 777 | py | Python | src/domain/video.py | wlsouza/py-video-maker | 7e39b884db8f6159489157e077705a68433a48c9 | [
"MIT"
] | 3 | 2020-02-16T18:28:29.000Z | 2020-07-16T22:53:08.000Z | src/domain/video.py | wlsouza/py-video-maker | 7e39b884db8f6159489157e077705a68433a48c9 | [
"MIT"
] | 10 | 2020-02-16T01:26:39.000Z | 2022-03-12T00:58:39.000Z | src/domain/video.py | wlsouza/py-video-maker | 7e39b884db8f6159489157e077705a68433a48c9 | [
"MIT"
] | null | null | null | # !usr/bin/python
# -*- coding: UTF-8 -*-
import copy
class Video:
def __init__(self, search_prefix=None, search_term=None, language_prefix='en', state=0, resolution=(1920, 1080), sentences=[]):
self.search_prefix = search_prefix
self.search_term = search_term
self.language_prefix = language_prefix
self.state = state
self.resolution = resolution
self.sentences = sentences
@property
def title(self):
return f'{self.search_prefix} {self.search_term}'
@property
def path(self):
return f'../storage/{self.title} {self.language_prefix}'
@property
def video_width(self):
return self.resolution[0]
@property
def video_height(self):
return self.resolution[1]
| 25.064516 | 131 | 0.648649 | 94 | 777 | 5.170213 | 0.361702 | 0.102881 | 0.098765 | 0.090535 | 0.106996 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020202 | 0.235521 | 777 | 30 | 132 | 25.9 | 0.79798 | 0.047619 | 0 | 0.190476 | 0 | 0 | 0.118046 | 0.061058 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.047619 | 0.190476 | 0.52381 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f12d920ea4520b7984bf41de9f0343691a28c9cf | 160 | py | Python | nexus/summa/schema/scimag.py | leoll2/hyperboria | 30a0ae466b290208f690560160ef1f5c16e4a744 | [
"Unlicense"
] | null | null | null | nexus/summa/schema/scimag.py | leoll2/hyperboria | 30a0ae466b290208f690560160ef1f5c16e4a744 | [
"Unlicense"
] | null | null | null | nexus/summa/schema/scimag.py | leoll2/hyperboria | 30a0ae466b290208f690560160ef1f5c16e4a744 | [
"Unlicense"
] | null | null | null | import yaml
from tantipy import TantivyCoder
with open('nexus/summa/schema/scimag.yaml') as file:
scimag_coder = TantivyCoder(yaml.safe_load(file.read()))
| 26.666667 | 60 | 0.775 | 23 | 160 | 5.304348 | 0.73913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1125 | 160 | 5 | 61 | 32 | 0.859155 | 0 | 0 | 0 | 0 | 0 | 0.1875 | 0.1875 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f138f62266750737c77c82331e4369a082747f86 | 834 | py | Python | agsadmin/sharing_admin/community/users/User.py | christopherblanchfield/agsadmin | 989cb3795aacf285ccf74ee51b0de26bf2f48bc3 | [
"BSD-3-Clause"
] | 2 | 2015-12-07T05:53:29.000Z | 2020-09-13T18:12:15.000Z | agsadmin/sharing_admin/community/users/User.py | christopherblanchfield/agsadmin | 989cb3795aacf285ccf74ee51b0de26bf2f48bc3 | [
"BSD-3-Clause"
] | 4 | 2015-03-09T05:59:14.000Z | 2018-01-09T00:12:56.000Z | agsadmin/sharing_admin/community/users/User.py | christopherblanchfield/agsadmin | 989cb3795aacf285ccf74ee51b0de26bf2f48bc3 | [
"BSD-3-Clause"
] | 5 | 2015-03-09T01:05:24.000Z | 2019-09-09T23:01:21.000Z | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
from ...._utils import send_session_request
from ..._PortalEndpointBase import PortalEndpointBase
class User(PortalEndpointBase):
@property
def username(self):
return self._pdata["username"]
@property
def _url_full(self):
return "{0}/{1}".format(self._url_base, self.username)
def __init__(self, requests_session, url_base, username):
super().__init__(requests_session, url_base)
self._pdata = {"username": username}
def get_properties(self):
"""
Gets the properties of the item.
"""
return self._get() | 30.888889 | 117 | 0.664269 | 97 | 834 | 5.391753 | 0.56701 | 0.040153 | 0.06501 | 0.08413 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003096 | 0.22542 | 834 | 27 | 118 | 30.888889 | 0.806502 | 0.038369 | 0 | 0.117647 | 0 | 0 | 0.029525 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.235294 | 0.117647 | 0.705882 | 0.058824 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f13c7ea45ae78526a09b9934bfcd395214f7800f | 48 | py | Python | better_profanity/__init__.py | davidmcclure/better_profanity | b6f8ccbaffa9ef99321d81ed5290337c011b58fc | [
"MIT"
] | null | null | null | better_profanity/__init__.py | davidmcclure/better_profanity | b6f8ccbaffa9ef99321d81ed5290337c011b58fc | [
"MIT"
] | null | null | null | better_profanity/__init__.py | davidmcclure/better_profanity | b6f8ccbaffa9ef99321d81ed5290337c011b58fc | [
"MIT"
] | null | null | null | name = "better_profanity"
__version__ = "0.4.0"
| 16 | 25 | 0.708333 | 7 | 48 | 4.142857 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 0.125 | 48 | 2 | 26 | 24 | 0.619048 | 0 | 0 | 0 | 0 | 0 | 0.4375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f14486be05daf31b9e2e4904d9c36ae798b8e8b8 | 164 | py | Python | module/setup.py | mrdragonbear/covid-tracking | 59db8f4268172b13e5e72f5edd3cc8b0019b6eb9 | [
"MIT"
] | 1 | 2021-04-29T07:45:51.000Z | 2021-04-29T07:45:51.000Z | module/setup.py | mrdragonbear/covid-tracking | 59db8f4268172b13e5e72f5edd3cc8b0019b6eb9 | [
"MIT"
] | 3 | 2021-05-21T15:44:45.000Z | 2021-05-21T15:45:27.000Z | module/setup.py | mrdragonbear/covid-tracking | 59db8f4268172b13e5e72f5edd3cc8b0019b6eb9 | [
"MIT"
] | 1 | 2020-07-16T01:41:00.000Z | 2020-07-16T01:41:00.000Z | import setuptools as st
st.setup(name='tracking',
version='0.1',
author='Benjamin Levy, Matthew Stewart',
packages=st.find_packages())
| 20.5 | 49 | 0.628049 | 20 | 164 | 5.1 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016129 | 0.243902 | 164 | 7 | 50 | 23.428571 | 0.806452 | 0 | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f153f9cedce4728dcd08bfc4f5587ef3d801b97d | 110 | py | Python | hidrocomp/eflow/__init__.py | clebsonpy/HydroComp | 9d17fa533e8a15c760030df5246ff531ddb4cb22 | [
"MIT"
] | 4 | 2020-05-14T20:03:49.000Z | 2020-05-22T19:56:43.000Z | hidrocomp/eflow/__init__.py | clebsonpy/HydroComp | 9d17fa533e8a15c760030df5246ff531ddb4cb22 | [
"MIT"
] | 19 | 2019-06-27T18:12:27.000Z | 2020-04-28T13:28:03.000Z | hidrocomp/eflow/__init__.py | clebsonpy/HydroComp | 9d17fa533e8a15c760030df5246ff531ddb4cb22 | [
"MIT"
] | null | null | null | from .era import Era
from .rva import RVA
from .iha import IHA
__all__ = ['exceptions', 'IHA', 'Era', 'RVA']
| 18.333333 | 45 | 0.672727 | 17 | 110 | 4.117647 | 0.411765 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172727 | 110 | 5 | 46 | 22 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0.172727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f168fc195692cd4d8b23d36b750b92e23db9091a | 179 | py | Python | ReportApi/login/urls.py | Antrony/ReportGen | a7f6e8e6c16e9c52fd00ec042dd1f904f11a91b1 | [
"MIT"
] | null | null | null | ReportApi/login/urls.py | Antrony/ReportGen | a7f6e8e6c16e9c52fd00ec042dd1f904f11a91b1 | [
"MIT"
] | null | null | null | ReportApi/login/urls.py | Antrony/ReportGen | a7f6e8e6c16e9c52fd00ec042dd1f904f11a91b1 | [
"MIT"
] | null | null | null | from django.conf.urls import url
from . import views
urlpatterns = [
url('^$', views.Invalid, name='invalid'),
url('^login/$', views.login_authenticate, name='login'),
]
| 22.375 | 60 | 0.664804 | 22 | 179 | 5.363636 | 0.545455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150838 | 179 | 7 | 61 | 25.571429 | 0.776316 | 0 | 0 | 0 | 0 | 0 | 0.122905 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f17c980cd2c61c89f34b7832f3ee1d1eabb34ac4 | 362 | py | Python | projects/crontab/model/mysql/sku_unit_cost/purchase_order.py | kingking888/crawler-pyspider | 29ba13905c73081097df9ef646a5c8194eb024be | [
"Apache-2.0"
] | 1 | 2021-12-07T15:48:51.000Z | 2021-12-07T15:48:51.000Z | projects/crontab/model/mysql/sku_unit_cost/purchase_order.py | GongSong/crawler-pyspider | b6dcec4afa4e1cd393f94627290a21ed95238676 | [
"Apache-2.0"
] | null | null | null | projects/crontab/model/mysql/sku_unit_cost/purchase_order.py | GongSong/crawler-pyspider | b6dcec4afa4e1cd393f94627290a21ed95238676 | [
"Apache-2.0"
] | 1 | 2021-11-10T07:12:02.000Z | 2021-11-10T07:12:02.000Z | from pyspider.core.model.mysql_base import *
"""
采购入库单
"""
class PurchaseOrder(Model):
warehouseOrderId = IntegerField(verbose_name='主键, 采购入库自增id', primary_key=True)
purchaseId = IntegerField(verbose_name='采购单Id')
submitTime = IntegerField(verbose_name='提交时间')
class Meta:
database = tg_common_db
db_table = 'warehouse_order'
| 22.625 | 82 | 0.71547 | 40 | 362 | 6.25 | 0.775 | 0.228 | 0.276 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176796 | 362 | 15 | 83 | 24.133333 | 0.838926 | 0 | 0 | 0 | 0 | 0 | 0.103152 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
f180e07d71498e4b2561c8dc6da263c0bf5eb661 | 10,747 | py | Python | core/tests/test_helper.py | rodolfolotte/tec | b97c39db7c90b87b5fe61888cf63111b2a32df5a | [
"MIT"
] | 4 | 2019-08-15T17:27:02.000Z | 2022-03-15T13:36:26.000Z | core/tests/test_helper.py | rodolfolotte/tec | b97c39db7c90b87b5fe61888cf63111b2a32df5a | [
"MIT"
] | null | null | null | core/tests/test_helper.py | rodolfolotte/tec | b97c39db7c90b87b5fe61888cf63111b2a32df5a | [
"MIT"
] | 2 | 2022-01-05T10:56:27.000Z | 2022-03-03T14:20:11.000Z | import os
import unittest
import settings as settings
import urllib.request
from helper import InputFiles
class FindOrbitReferenceHelperTest(unittest.TestCase):
pass
# def test_find_orbit_reference_default(self):
# """ Passing all arguments as default, must return igr18471.sp3.Z """
# self.assertEqual(self._find_orbit_reference(), "igr18471.sp3.Z")
#
# def test_find_orbit_reference_R(self):
# """ Passing the correspondent arguments as chpi1521.15o, 2015, R, must return igl18471.sp3.Z """
# self.assertEqual(self._find_orbit_reference(orbit_type="R"), "igl18471.sp3.Z")
#
# def test_find_year_orbit_reference_year(self):
# """ Passing the correspondent arguments as chpi1521.15o, 2016, G, must return igr18992.sp3.Z """
# self.assertEqual(self._find_orbit_reference(year=2016), "igr18992.sp3.Z")
#
# def test_find_orbit_reference_R_year(self):
# """ Passing the correspondent arguments as chpi1521.15o, 2016, R, must return igl18992.sp3.Z """
# self.assertEqual(self._find_orbit_reference(year=2016, orbit_type="R"), "igl18992.sp3.Z")
#
# def test_find_orbit_reference_wrong_year_2_digits(self):
# """ Passing year 2 digits, must return None """
# self.assertEqual(self._find_orbit_reference(year=16), None)
#
# def test_find_orbit_reference_wrong_year_5_digits(self):
# """ Passing year with 5 digits, must return None """
# self.assertEqual(self._find_orbit_reference(year=20164), None)
#
# def test_find_orbit_reference_rinex_no_station(self):
# """ Passing rinex_name with wrong station iaga code, must return None """
# self.assertEqual(self._find_orbit_reference(rinex_name='chp1521.15o'), None)
#
# def test_find_orbit_reference_rinex_no_extension(self):
# """ Passing rinex_name with no extension, must return None """
# self.assertEqual(self._find_orbit_reference(rinex_name='chpi1521'), None)
#
# def test_find_orbit_reference_rinex_empty(self):
# """ Passing rinex_name empty, must return None """
# self.assertEqual(self._find_orbit_reference(rinex_name=''), None)
#
# def test_find_orbit_reference_rinex_with_incorrect_doy(self):
# """ Passing rinex_name with wrong doy, must return None """
# self.assertEqual(self._find_orbit_reference(rinex_name='chpi3681.15o'), None)
#
# def test_find_orbit_reference_orbit_type_invalid(self):
# """ Passing orbit_type invalid, must return None """
# self.assertEqual(self._find_orbit_reference(orbit_type='X'), None)
#
# def test_find_orbit_reference_orbit_type_empty(self):
# """ Passing rinex_name with no extension, must return None """
# self.assertEqual(self._find_orbit_reference(orbit_type=''), None)
#
# def _find_orbit_reference(self, **kwargs):
# input_files = InputFiles()
# default = dict(
# rinex_name='chpi1521.15o',
# year=2015,
# orbit_type='G'
# )
# data = dict(default, **kwargs)
# find = input_files._find_orbit_reference(data['rinex_name'], data['year'], data['orbit_type'])
# return find
class ChannelsURLHelperTest(unittest.TestCase):
def test_download_channels_url_response(self):
"""HTML must contain text """
response = urllib.request.urlopen(settings.URL_GLONASS_CHANNELS).getcode()
self.assertEqual(response, 200)
class CheckURLExist(unittest.TestCase):
pass
# def test_url_download_exist(self):
# url = urlopen(settings.URL_ORBIT + '1847/igr18471.sp3.Z')
# if url != URLError:
# return True
# self.assertEqual(url, True)
# class SetupFileAndDownloadHelperTest(unittest.TestCase):
# def _setup_file_and_download(self, **kwargs):
# input_files = InputFiles()
# default = dict(
# year=2015,
# month=6,
# file='chpi1521.15o',
# file_type='DCB',
# rinex_interval=30
# )
# data = dict(default, **kwargs)
# find = input_files._setup_file_and_download(data['year'], data['month'], data['file'], data['file_type'],
# data['rinex_interval'])
# return find
class DownloadFileHelperTest(unittest.TestCase):
pass
# def test_download_file_default(self):
# """ Passing all arguments as default, must return complete path of igl18471.sp3.Z"""
# self.assertEqual(self._download_file(), settings.PATH_ORBIT + '2015/igl18471.sp3.Z')
#
# def _download_file(self, **kwargs):
# input_files = InputFiles()
# default = dict(
# year=2015,
# filename='/home/lotte/embrace/tec/orbit/1847/igl18471.sp3.Z',
# orbit_name='igl18471.sp3.Z',
# gnss_week='1847',
# what_to_download='Orbit',
# )
# data = dict(default, **kwargs)
# find = input_files._download_file(data)
# return find
# def test_download_orbit_default(self):
# """ Passing uncompressed orbit_name, must return igl18471.sp3"""
# self.assertEqual(self._download_orbit(), settings.PATH_ORBIT + '2015/igl18471.sp3')
#
# def test_download_orbit_with_orbit_name_empty(self):
# """ Passing orbit_name empty must return None"""
# self.assertEqual(self._download_orbit(orbit_name=''), None)
#
# def test_download_orbit_with_orbit_name_with_wrong_extension(self):
# """ Passing orbit_name with wrong extension must return None """
# self.assertEqual(self._download_orbit(orbit_name='igl18471.sp5'), None)
#
# def test_download_orbit_with_orbit_name_with_uppercase(self):
# """ Passing orbit_name with upper case, must return the same orbit_name in lower case: igl18471.sp3.Z"""
# self.assertEqual(self._download_orbit(orbit_name='IGL18471.SP3.Z'), settings.PATH_ORBIT
# + '2015/igl18471.sp3')
#
# def test_download_orbit_with_year_empty(self):
# """ Passing year empty must return ..."""
# self.assertEqual(self._download_orbit(year=''), settings.PATH_ORBIT + '...')
#
# def test_download_orbit_with_year_with_1_digit(self):
# """ Passing year with one single digit, must return the empty orbit path"""
# self.assertEqual(self._download_orbit(year=5), '')
#
# def test_download_orbit_with_year_with_3_digits(self):
# """ Passing year with three digits, must return the empty orbit path"""
# self.assertEqual(self._download_orbit(year=105), '')
#
# def test_download_orbit_with_year_with_2_digits(self):
# """ Passing year with only two digits, must return the saved orbit path with correct 4-digits year folder"""
# self.assertEqual(self._download_orbit(year=15), settings.PATH_ORBIT + '2015/igl18471.sp3.Z')
#
# def test_download_orbit_with_year_with_more_than_4_digits(self):
# """ Passing year with more than 4 digits, must return the empty orbit path"""
# self.assertEqual(self._download_orbit(year=20159), '')
#
# def test_download_orbit_with_year_as_string(self):
# """ Passing year as string, must return the empty orbit path"""
# self.assertEqual(self._download_orbit(year='2015a'), '')
class CheckFilesExistHelperTest(unittest.TestCase):
pass
# def delete_all(self, folder):
# for the_file in os.listdir(folder):
# file_path = os.path.join(folder, the_file)
# try:
# if os.path.isfile(file_path):
# os.unlink(file_path)
# except Exception as e:
# print(e)
#
# def create_file(self, folder, filename):
# tmp_file = os.path.join(folder, filename)
# with open(tmp_file, 'w+') as f:
# f.write('Python mock testing. Delete me later!')
#
# def test_dcb_compressed_and_uncompressed_exists_return_uncompressed(self):
# """ Passing default DCB, check if it exists, if so, returns absolute path of the uncompressed file """
# self.create_file(settings.PATH_DCB, 'P1C11506.DCB')
# self.create_file(settings.PATH_DCB, 'P1C11506.DCB.Z')
# self.assertTrue(os.path.isfile(settings.PATH_DCB + 'P1C11506.DCB'))
# self.assertTrue(os.path.isfile(settings.PATH_DCB + 'P1C11506.DCB.Z'))
# self.assertEqual(self._check_files_already_exist(), (False, settings.PATH_DCB + 'P1C11506.DCB'))
# self.delete_all(settings.PATH_DCB)
#
# def test_dcb_only_compressed_exists_return_compressed(self):
# """ Passing the DCB only with the P1C11506.DCB.Z file, make sure it exists, if it does,
# returns the absolute path of the compressed file """
# self.create_file(settings.PATH_DCB, 'P1C11506.DCB.Z')
# self.assertTrue(os.path.isfile(settings.PATH_DCB + 'P1C11506.DCB.Z'))
# self.assertFalse(os.path.isfile(settings.PATH_DCB + 'P1C11506.DCB'))
# self.assertEqual(self._check_files_already_exist(), (False, settings.PATH_DCB + 'P1C11506.DCB.Z'))
# self.delete_all(settings.PATH_DCB)
#
# def test_dcb_no_file_exists(self):
# """ Passing the DCB without any files, check if there is any file, if so,
# returns the absolute path of the compressed file """
# self.assertFalse(os.path.isfile(settings.PATH_DCB + 'P1C11506.DCB.Z'))
# self.assertFalse(os.path.isfile(settings.PATH_DCB + 'P1C11506.DCB'))
# self.assertEqual(self._check_files_already_exist(), (True, settings.PATH_DCB + 'P1C11506.DCB.Z'))
# self.delete_all(settings.PATH_DCB)
#
# def test_dcb_only_decompressed_exists_return_decompressed(self):
# """ Passing the DCB only with the P1C11506.DCB file, make sure the file exists,
# if so, returns the absolute path of the uncompressed file """
# self.create_file(settings.PATH_DCB, 'P1C11506.DCB')
# self.assertTrue(os.path.isfile(settings.PATH_DCB + 'P1C11506.DCB'))
# self.assertFalse(os.path.isfile(settings.PATH_DCB + 'P1C11506.DCB.Z'))
# self.assertEqual(self._check_files_already_exist(), (False, settings.PATH_DCB + 'P1C11506.DCB'))
# self.delete_all(settings.PATH_DCB)
#
# def _check_files_already_exist(self, **kwargs):
# input_files = InputFiles()
# default = dict(
# path=settings.PATH_DCB,
# filename='P1C11506.DCB.Z',
# )
# data = dict(default, **kwargs)
# find = input_files._check_files_already_exist(data['path'], data['filename'])
# return find
| 48.192825 | 118 | 0.656741 | 1,327 | 10,747 | 5.051997 | 0.135644 | 0.03028 | 0.076521 | 0.054893 | 0.662291 | 0.605459 | 0.574732 | 0.490901 | 0.414379 | 0.349045 | 0 | 0.045259 | 0.222853 | 10,747 | 222 | 119 | 48.40991 | 0.757423 | 0.843956 | 0 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 1 | 0.058824 | false | 0.235294 | 0.294118 | 0 | 0.647059 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
f185314c22cdcd972b44d35430bcac14b0576997 | 2,693 | py | Python | src/pycolocstats/tools/jobparamsdict.py | hyperbrowser/conglomerate | 7996f222a38d11d0cc69fdc1ec05e8645fa44a30 | [
"Apache-2.0"
] | 2 | 2019-05-23T10:11:20.000Z | 2020-02-04T11:36:06.000Z | src/pycolocstats/tools/jobparamsdict.py | hyperbrowser/conglomerate | 7996f222a38d11d0cc69fdc1ec05e8645fa44a30 | [
"Apache-2.0"
] | 1 | 2020-02-03T10:41:18.000Z | 2020-02-03T11:56:28.000Z | src/pycolocstats/tools/jobparamsdict.py | hyperbrowser/pycolocstats | 7996f222a38d11d0cc69fdc1ec05e8645fa44a30 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import, division, print_function, unicode_literals
from pycolocstats.core.types import PathStr, PathStrList
from past.builtins import basestring
from collections import MutableMapping
__metaclass__ = type
class JobParamsDict(MutableMapping):
def __init__(self, paramDefDict):
self._paramDefDict = paramDefDict
self._params = dict()
def __getitem__(self, key):
return self._params[key]
def __setitem__(self, key, val):
assert key in self.getAllowedKeys(), \
'"{}" not in allowed keys: {}'.format(key, ', '.join(self.getAllowedKeys()))
allowedType = self.getType(key)
if allowedType == PathStr:
assert isinstance(val, basestring), '"{}" not of correct type: {}'.format(val, str)
#assert os.path.exists(val), 'File "{}" does not exist'.format(val) #TODO: Had to temporarily disable due to generic copying from dat to bed..
val = PathStr(val)
elif allowedType == PathStrList:
assert isinstance(val, list), '"{}" not of correct type: {}'.format(val, list)
assert all(isinstance(f, basestring) for f in val), \
'Some of the entries of "{}" are not of correct type: {}'.format(val, str)
# assert all(os.path.exists(f) for f in val), \
# 'Some of the entries of "{}" do not exist'.format(val) #TODO: disabled due to dat to bed..
val = PathStrList(val)
else:
assert isinstance(val, allowedType), '"{}" (type:{}) not of correct type: {}'.format(val, type(val), allowedType)
self._params[key] = val
def __delitem__(self, key):
del self._params[key]
def __iter__(self):
return iter(self._params)
def __len__(self):
return len(self._params)
def getAllowedKeys(self):
return self._paramDefDict.keys()
def getType(self, key):
return self._paramDefDict[key]['type']
def isMandatory(self, key):
return self._paramDefDict[key]['mandatory']
def getAbsentMandatoryParameters(self):
absentMandatoryParameters = []
for key in self.getAllowedKeys():
if self.isMandatory(key) and key not in self:
absentMandatoryParameters.append(key)
return absentMandatoryParameters
def __repr__(self):
retStr = repr(self._params)
retStr += '\nAllowed params:\n'
for key in self.getAllowedKeys():
retStr += '\t%s: %s %s\n' % (key, self.getType(key), '[x]' if self.isMandatory(key) else '[ ]')
retStr += '[ ] for optional parameter, [x] for mandatory parameter'
return retStr
| 37.929577 | 154 | 0.625325 | 310 | 2,693 | 5.270968 | 0.309677 | 0.04284 | 0.029376 | 0.039168 | 0.201958 | 0.144431 | 0.074663 | 0.074663 | 0.033048 | 0 | 0 | 0 | 0.254735 | 2,693 | 70 | 155 | 38.471429 | 0.81415 | 0.103973 | 0 | 0.039216 | 0 | 0 | 0.118771 | 0 | 0 | 0 | 0 | 0.014286 | 0.098039 | 1 | 0.215686 | false | 0 | 0.078431 | 0.117647 | 0.470588 | 0.019608 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
f18849b52c2d1fd1bf363b3942dbbd3fc5cbbaf8 | 647 | py | Python | dda_cert/tests/test_meta.py | emburse/dda-certification-test | 6fc0ff93a07b5277d81de60ba45d3dc2e16eecb4 | [
"BSD-2-Clause"
] | null | null | null | dda_cert/tests/test_meta.py | emburse/dda-certification-test | 6fc0ff93a07b5277d81de60ba45d3dc2e16eecb4 | [
"BSD-2-Clause"
] | null | null | null | dda_cert/tests/test_meta.py | emburse/dda-certification-test | 6fc0ff93a07b5277d81de60ba45d3dc2e16eecb4 | [
"BSD-2-Clause"
] | null | null | null | import json
import unittest
import requests
from ofxtools.Parser import OFXTree
from ..settings import DDA_ACCOUNT_TRANSACTIONS, OFX_FILE_PATH, ACCESS_TOKEN, DDA_ACCOUNTSDETAILS
class TestMeta(unittest.TestCase):
def setUp(self):
pass
def test_connection(self):
pass
def test_dda_interactionid(self):
pass
def test_authorization(self):
self.auth_headers = {"Authorization": "Bearer {}".format(ACCESS_TOKEN)}
request = requests.get(DDA_ACCOUNTSDETAILS, headers=self.auth_headers)
self.assertEqual(request.status_code, 200)
def test_content_negotiation(self):
pass | 23.962963 | 97 | 0.723338 | 76 | 647 | 5.934211 | 0.539474 | 0.070953 | 0.073171 | 0.099778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00578 | 0.197836 | 647 | 27 | 98 | 23.962963 | 0.863198 | 0 | 0 | 0.222222 | 0 | 0 | 0.033951 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 1 | 0.277778 | false | 0.222222 | 0.277778 | 0 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
f191253e22b12d294a990e1d3e6d7c156656a702 | 428 | py | Python | test/python/PostingTest.py | sanel/ledger | 81e1b4ff3c78cd18e5d8c3844eb8e406dc3c8836 | [
"BSD-3-Clause"
] | 3,509 | 2015-01-01T11:47:51.000Z | 2022-03-30T09:22:43.000Z | test/python/PostingTest.py | sanel/ledger | 81e1b4ff3c78cd18e5d8c3844eb8e406dc3c8836 | [
"BSD-3-Clause"
] | 651 | 2015-01-09T16:18:10.000Z | 2022-03-26T23:52:00.000Z | test/python/PostingTest.py | sanel/ledger | 81e1b4ff3c78cd18e5d8c3844eb8e406dc3c8836 | [
"BSD-3-Clause"
] | 440 | 2015-01-02T21:28:11.000Z | 2022-03-25T05:38:08.000Z | # -*- coding: utf-8 -*-
import unittest
import exceptions
import operator
from ledger import *
from StringIO import *
from datetime import *
class PostingTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_(self):
pass
def suite():
return unittest.TestLoader().loadTestsFromTestCase(PostingTestCase)
if __name__ == '__main__':
unittest.main()
| 16.461538 | 71 | 0.679907 | 46 | 428 | 6.130435 | 0.586957 | 0.085106 | 0.117021 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003003 | 0.221963 | 428 | 25 | 72 | 17.12 | 0.843844 | 0.049065 | 0 | 0.176471 | 0 | 0 | 0.019753 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0.176471 | 0.352941 | 0.058824 | 0.705882 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
74c4676f24e22e0fbe2e97e1cd4c947ca214bbc2 | 153 | py | Python | oarepo_oai_pmh_harvester/proxies.py | oarepo/invenio-oarepo-oai-pmh-harvester | 399ef743ac9da23d36e655e072aa72ee1b332372 | [
"MIT"
] | null | null | null | oarepo_oai_pmh_harvester/proxies.py | oarepo/invenio-oarepo-oai-pmh-harvester | 399ef743ac9da23d36e655e072aa72ee1b332372 | [
"MIT"
] | 13 | 2020-11-04T13:47:55.000Z | 2021-04-15T17:56:33.000Z | oarepo_oai_pmh_harvester/proxies.py | oarepo/oarepo-oai-pmh-harvester | 399ef743ac9da23d36e655e072aa72ee1b332372 | [
"MIT"
] | 1 | 2020-05-14T07:59:12.000Z | 2020-05-14T07:59:12.000Z | from flask import current_app
from werkzeug.local import LocalProxy
current_oai_client = LocalProxy(lambda: current_app.extensions['oarepo-oai-client']) | 38.25 | 84 | 0.843137 | 21 | 153 | 5.952381 | 0.619048 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078431 | 153 | 4 | 84 | 38.25 | 0.886525 | 0 | 0 | 0 | 0 | 0 | 0.11039 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
74d547cfd391fb9d14089dda6d5f5fbef6a3f8a5 | 3,427 | py | Python | img_favicon.py | folkengine/JetCreator | 2003704c531ca9a6730dbd8d7f2c879312d944ef | [
"Apache-2.0"
] | null | null | null | img_favicon.py | folkengine/JetCreator | 2003704c531ca9a6730dbd8d7f2c879312d944ef | [
"Apache-2.0"
] | null | null | null | img_favicon.py | folkengine/JetCreator | 2003704c531ca9a6730dbd8d7f2c879312d944ef | [
"Apache-2.0"
] | null | null | null | #----------------------------------------------------------------------
# This file was generated by C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\tools\img2py.py
#
from wx import Image, Bitmap, Icon
import cStringIO, zlib
def getData():
return zlib.decompress(
'x\xda\x01\xd4\x03+\xfc\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\
\x00\x00 \x08\x06\x00\x00\x00szz\xf4\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\
\x08d\x88\x00\x00\x03\x8bIDATX\x85\xc5\x97klSe\x18\xc7\x7f\xef9\xed\xda\xb5\
\xdd\xa8\xeb\xec\x9cd\xc9\xe6\xb0&\x18#\xc6(\xd1\xb0(\n\x0eG\xb8\x05GLX\xe2\
\x17\xa3\x04\xd4hP\x13t&\x98\r\xbf\x90h\xe2\x06Y\xf8`d\x18!r\t\xa0f\xb0\xa0s\
\xea\xbc\x8d\xc5!c\x85Ywi\xe9\xd8\xad[\xaf\xf3\xf4z\xfc\xe2t\x10l\xc7\xba\
\xd6\xff\xc7s\x9e\xff\xf3\xfe\xce\xfb\xbe\xcf\x93\xe7\x08!\xc9\xfc\x9f\xd2\
\x00$\xe21u\xbe\t\xa2\xfc\x8e\x8a\x96\x1cJ\xe7\xe5\x97\xe6\xbb0\x80\xcb\xe9b\
[\xfdS\xf4xN\xcf;GZ\x00\xa1\xa0\x82\xe3\xd28\xae\xc0\xb7\xc0\xfc61-\x00I\x96\
\xc83\xdc\xc6h\xf0\x02\xed\x83u\xd9\x07\x00PU\x15\x93\xc1\x8c\xdd\x7f\x90\
\xf6\xc1\xfa\xec\x03\xe8\x8d2mGGq\xfc,\xe8\x8f6\xf3\xd5\xc0.Tu\xee\xc7\x916\
\x80\x90\x12X,\x054\xbd:\xc2\xe9F\x0f\xfd\xcag\xb4\xbbj\xb3\x070\x1d\x88\xf3\
P\x95\x91\xc3g\xdf\xe3\xf2\x17e4l\xbf\x8a}\xeaSz=G\xb2\x03 !\x11\x0c\x06\x88\
\x96\xb4\xd0\xda\xd5\x88nb\x05Mo8\xe9\xf1\x1f@\x89y\xb3\x00 \x0b\xc6\x06TF\
\xc6\x878\x1f|\x87\x83gw\xe2\xe9\xb6\xd1r\xbc\x93\xf1\xf8\x8f\x99\x070\xe4\
\xcbt\x9d\xf3\xb1\xa7\xe6\n=\xdd\x7fp5\xaf\x81\x17k+\xe8\xfa2\x8e\'|)\xf3\
\x00\x01\x9fB\xf5\xf6{yv\xfd\xcb\xec\xd92\xc4\xe7\x87z(\xad\xec\xa6\xd0\x9a\
\xcf\xc4X\xea#\xd0\xa4\x0b@B\x837<\xc8\x0bu\x1bX\xf9h\x0b\xeb7\xadE\xda/\xb1\
\xe95\x0b"\x91\x93\xd2\xbe \x8d\xc8\xa03\xf1M\xdf\x07\xdc\xb7\xd6\xc3\xf1c\'\
i|\xc5I(\xe4\xe7N\xeb\x92\xcc\x03\x18\xf2\xb4\x1cmt`\xef\x08\xd36\xb4\x9b\
\x077O\xb2\xb5\xfay\x8e5\xb8\x91\xf5J\xa6\x01T\x0cfXv\xd7j\x9a\xdf\xf2\xd1\
\xbc\xdb\xcd\xd7}{Y\xb9-\x84\x7f8\x07\xf7x_\xa6\x01\xc0\xe7\xf3\xf2\xfa\x8e\
\x9dtv\x9e\'2\xf0\x00o>}\x11\xaf\xda\xcd\x86\x97,(\x81\xd4\xfe\xf4[\xb1\x10L\
(\x1e\xca\xcb\xcb\xf9\xbe\xe3;\xaa+w\xf0\xf6F;\xd6R\r\x8b\x8b\xeeN\xe9O\xbf\
\n\xfe\x86\x98\xd1\xbe\xfd\x8d\xa0\n>\xaam\xa2\xe2d?**\x02\xf1\x9f\xde\xb4w\
\xe0f\xfap\xdf\xfb\x14\xe9\x96\xd1\xf5k\'q\x82Ic3\x02 KZ\xaa\xd6l\xe4\xda`\
\x08A$\xfb\x00\x006\xdb\x124\x1a\x19\t}\xe6\x00\xb4\xc2D4|\xf3\xe1cl\xca\x89\
>W\x87\xc0\x984\xc7-_\xc2\xc9?\x1d8&\xcf\xe0\x8f\xb8\xf0\xfb\xe2\x94\xd8\x0c\
\xc4c\x80\xee\xfa8\x87\xfb\'V\xad{2e\xbe[\x02\xe8p\xee\xe5\xb7\xd1C\x84\xe3\
\x01$\xa1A\x96%\xee\x7f\xdcDTQ\x99\xfd\xa1\xc3\xc3nb\xdaQ*\x96>\xb70\x00*\tZ\
\xaf\xec\xa2w\xea0\xb9\x9a\x02\x0cZ\xcb?\xef\x94\x88\x97\x1bG\xf2~\xd7E\xb6\
\xae\xa9\'W*^\x18\x80\x8fO\xd43b\xfe\x84Bs1\xb3\xe7M\x95\x04\x92\xd0\xb0H_z]\
\xfc\x8a\xe5\x95\x90\xa4\xf6g+\xe5%\xbc\xe6\x1e\xe5\xc8\x89\x03\xdcQl%\x91\
\xf8\xf7\xb9\x10\x02%\xe6\xc1fY\xc7\xed\xc6\xa57\xb8\xe6\xb6\xf8\x9c\x00"\
\xb1i.\xfc0\xc2\xb47\x81\xb9PK\xaeIFgT\x99\xf4\r\xb38g5O\x94\xd5%\xedt\xa9$\
\x84$\'\xfd9U\xd58\xcfTo\xa6\xed\x97S\xac\xaa\xc9gQA\x0e\t\xc5\xc4\xf2{\xb6P\
S\xf5.\x06c\xf2:O\x1b`F\xad\xe7\xce`\xef\xbdLiY\t\x8f<\xfc\x18\xd6\xa2\xc2\
\xb4\x16\x9e\xd1_\xa4\x9cO6P\x7f\x0e\x9e\x00\x00\x00\x00IEND\xaeB`\x82\x80\
\xab\xe3<' )
def getBitmap():
return Bitmap(getImage())
def getImage():
stream = cStringIO.StringIO(getData())
return Image(stream)
def getIcon():
icon = Icon()
icon.CopyFromBitmap(getBitmap())
return icon
| 55.274194 | 96 | 0.702072 | 709 | 3,427 | 3.38787 | 0.499295 | 0.032473 | 0.026228 | 0.014988 | 0.007494 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212039 | 0.035308 | 3,427 | 61 | 97 | 56.180328 | 0.514519 | 0.048147 | 0 | 0 | 1 | 0.673077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.038462 | 0.038462 | 0.192308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
74fe802d64e89eb6d40cc2d28b2a50ac8cdab9b5 | 134 | py | Python | deploy/utils/__init__.py | Maozu/keybrl-tools | 280d8c2eb36863ce33e4f57ac1829aa93daf3e0a | [
"MIT"
] | 2 | 2020-11-25T06:14:33.000Z | 2021-01-19T13:39:07.000Z | deploy/utils/__init__.py | Maozu/keybrl-tools | 280d8c2eb36863ce33e4f57ac1829aa93daf3e0a | [
"MIT"
] | null | null | null | deploy/utils/__init__.py | Maozu/keybrl-tools | 280d8c2eb36863ce33e4f57ac1829aa93daf3e0a | [
"MIT"
] | null | null | null | from .file_manager import FileManager
from .oss_synchronizer import OSSSynchronizer
__all__ = ['FileManager', 'OSSSynchronizer']
| 26.8 | 46 | 0.798507 | 13 | 134 | 7.769231 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126866 | 134 | 4 | 47 | 33.5 | 0.863248 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2d0b8588b4436816bfeec6c0fb9ca00aaaf96775 | 118 | py | Python | django/dashboard/views/logout.py | aistairc/voteclustering_aist | f1ee7409698a05a99ce40cdccbe4c2b1f8f81b4c | [
"MIT"
] | null | null | null | django/dashboard/views/logout.py | aistairc/voteclustering_aist | f1ee7409698a05a99ce40cdccbe4c2b1f8f81b4c | [
"MIT"
] | null | null | null | django/dashboard/views/logout.py | aistairc/voteclustering_aist | f1ee7409698a05a99ce40cdccbe4c2b1f8f81b4c | [
"MIT"
] | null | null | null | from django.shortcuts import redirect
def logout(request):
request.session.flush()
return redirect("login")
| 16.857143 | 37 | 0.737288 | 14 | 118 | 6.214286 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161017 | 118 | 6 | 38 | 19.666667 | 0.878788 | 0 | 0 | 0 | 0 | 0 | 0.042373 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2d1cd9cadeb744fd019b43771b85ff1de70127f4 | 208 | py | Python | src/settings.py | juanmanuelcarrera/parking-butler | c856328660ef1ac5eab735c87d8d8a7e4cbc1a06 | [
"MIT"
] | null | null | null | src/settings.py | juanmanuelcarrera/parking-butler | c856328660ef1ac5eab735c87d8d8a7e4cbc1a06 | [
"MIT"
] | null | null | null | src/settings.py | juanmanuelcarrera/parking-butler | c856328660ef1ac5eab735c87d8d8a7e4cbc1a06 | [
"MIT"
] | null | null | null | from mongoengine import connect, register_connection
MONGO_URL = "mongodb://localhost:27017/parking_butler"
#connect('chatemtbot', host=os.getenv('MONGO_URL'))
register_connection('default', host=MONGO_URL) | 34.666667 | 54 | 0.807692 | 26 | 208 | 6.230769 | 0.692308 | 0.148148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.0625 | 208 | 6 | 55 | 34.666667 | 0.805128 | 0.240385 | 0 | 0 | 0 | 0 | 0.297468 | 0.253165 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2d34499a8939085f312a6f4702683ca378d10581 | 289 | py | Python | src/cpp/setup.py | jxgu1016/BinActivateFunc_PyTorch | 43d13d5ba1d62b9f8c249bfe31894883e50c0f6f | [
"MIT"
] | 6 | 2018-06-08T16:06:24.000Z | 2019-12-06T11:12:54.000Z | src/cpp/setup.py | jxgu1016/BinActivateFunc_PyTorch | 43d13d5ba1d62b9f8c249bfe31894883e50c0f6f | [
"MIT"
] | null | null | null | src/cpp/setup.py | jxgu1016/BinActivateFunc_PyTorch | 43d13d5ba1d62b9f8c249bfe31894883e50c0f6f | [
"MIT"
] | null | null | null | from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CppExtension
setup(
name='BinActivateFunc_cpp',
ext_modules=[
CppExtension('BinActivateFunc_cpp', ['BinActivateFunc.cpp']),
],
cmdclass={
'build_ext': BuildExtension
})
| 24.083333 | 69 | 0.702422 | 27 | 289 | 7.333333 | 0.592593 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.193772 | 289 | 11 | 70 | 26.272727 | 0.849785 | 0 | 0 | 0 | 0 | 0 | 0.228374 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2d435a602818f1c711e3b322cc41bbbac154a1cd | 3,611 | py | Python | htm_rl/htm_rl/tests.py | pkuderov/htm_rl | 00512efdbc052b48dfbe2f041b8713e2df90b735 | [
"MIT"
] | null | null | null | htm_rl/htm_rl/tests.py | pkuderov/htm_rl | 00512efdbc052b48dfbe2f041b8713e2df90b735 | [
"MIT"
] | null | null | null | htm_rl/htm_rl/tests.py | pkuderov/htm_rl | 00512efdbc052b48dfbe2f041b8713e2df90b735 | [
"MIT"
] | null | null | null | from inspect import ismethod
import numpy as np
from htm.bindings.sdr import SDR
#
# from mdp_planner import DataEncoder, DataMultiEncoder, TemporalMemory, HtmAgent
#
#
# class TestDataEncoder:
# def __init__(self):
# self.encoder = DataEncoder('-', n_vals=2, value_bits=3, activation_threshold=2)
#
# def test_encode_dense(self):
# result = self.encoder.encode_dense(1)
# expected = np.array([0, 0, 0, 1, 1, 1], dtype=np.int8)
# assert np.array_equal(result, expected)
#
# def test_encode_sparse(self):
# arr_sparse = self.encoder.encode_sparse(1)
# assert arr_sparse == [3, 4, 5]
#
# def test_str_from_dense(self):
# arr_dense = np.array([0, 0, 0, 1, 1, 1], dtype=np.int8)
# res = self.encoder.str_from_dense(arr_dense)
# assert res == '000 111'
#
# def test_decode_dense(self):
# decoded = self.encoder.decode_dense(np.array([0, 1, 1, 0, 1, 0]))
# assert decoded == [0]
#
# decoded = self.encoder.decode_dense(np.array([0, 1, 1, 1, 1, 1]))
# assert decoded == [0, 1]
#
# def test_decode_sparse(self):
# decoded = self.encoder.decode_sparse([1, 2, 4])
# assert decoded == [0]
#
# decoded = self.encoder.decode_sparse([1, 2, 3, 4, 5])
# assert decoded == [0, 1]
#
# def test_to_str(self):
# assert str(self.encoder) == 'DataEncoder("-", v2 x b3)'
#
#
# class TestDataMultiEncoder:
# def __init__(self):
# self.encoder = DataMultiEncoder((
# DataEncoder('1', 2, 4),
# DataEncoder('2', 3, 2)
# ))
#
# def test_encode_dense(self):
# result = self.encoder.encode_dense((0, 2))
# expected = np.array([1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], dtype=np.int8)
# assert np.array_equal(result, expected)
#
# def test_encode_sparse(self):
# result = self.encoder.encode_sparse((1, 1))
# expected = [4, 5, 6, 7, 10, 11]
# assert result == expected
#
# def test_str_from_dense(self):
# test_arr = np.array([1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], dtype=np.int8)
# result = self.encoder.str_from_dense(test_arr)
# expected = '1111 0000 00 00 11'
# assert result == expected
#
#
# class TestHtmAgent:
# def __init__(self):
# self.encoder = DataMultiEncoder((
# DataEncoder('1', 2, 4),
# DataEncoder('2', 3, 2)
# ))
# # total_bits == 14
# self.tm = TemporalMemory(
# n_columns=self.encoder.total_bits,
# cells_per_column=2,
# activation_threshold=5, learning_threshold=3,
# initial_permanence=.5, connected_permanence=.5
# )
# self.agent = HtmAgent(self.tm, self.encoder)
#
# def test_str_from_cells(self):
# active_cells = SDR((self.tm.n_columns, self.tm.cells_per_column))
# active_cells.dense[5, 0] = 1
# active_cells.dense[9, 1] = 1
#
# result = self.agent._str_from_cells(active_cells, 'test_name')
# expected = '''0000 0100 00 00 00 test_name
# 0000 0000 01 00 00'''
#
# assert result == expected
#
#
# def _test_all(*objects):
# def test_all_for_obj(obj):
# for name in dir(obj):
# attribute = getattr(obj, name)
# if ismethod(attribute) and name.startswith('test_'):
# attribute()
#
# for obj in objects:
# test_all_for_obj(obj)
#
#
# def test_all():
# _test_all(
# TestDataEncoder(),
# TestDataMultiEncoder(),
# TestHtmAgent()
# )
| 31.955752 | 89 | 0.572141 | 469 | 3,611 | 4.208955 | 0.198294 | 0.01925 | 0.021277 | 0.020263 | 0.468085 | 0.362209 | 0.316616 | 0.27001 | 0.27001 | 0.27001 | 0 | 0.063462 | 0.279978 | 3,611 | 112 | 90 | 32.241071 | 0.695769 | 0.916921 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7413963657b14349c16034f26631cccd24607f46 | 723 | py | Python | calculations.py | CharlesJ-ABu/MindMap | e067975fd90a842d20ca60b6a8deddae26cf4caa | [
"MIT"
] | null | null | null | calculations.py | CharlesJ-ABu/MindMap | e067975fd90a842d20ca60b6a8deddae26cf4caa | [
"MIT"
] | null | null | null | calculations.py | CharlesJ-ABu/MindMap | e067975fd90a842d20ca60b6a8deddae26cf4caa | [
"MIT"
] | 1 | 2019-03-19T19:56:28.000Z | 2019-03-19T19:56:28.000Z | import math
def dist(p1, p2):
v = (p1[0]-p2[0], p1[1]-p2[1])
l = math.sqrt(sum([a*a for a in v]))
return l
def length(v):
return dist((0,0,0), v)
def normalize(v, thresold=0.0001):
# normalize vector v
l = math.sqrt(sum([a*a for a in v]))
if l <= thresold:
return (0,0)
v = tuple([a/l for a in v])
return v
def getDir(p1, p2):
v = (p2[0]-p1[0], p2[1]-p1[1])
return v
def luminance(c):
luminance = 0.299*c[0] + 0.587*c[1] + 0.114*c[2]
return luminance
def clamp(x, bounds=[0,1]):
return max(min(x, bounds[1]), bounds[0])
def dot(v1, v2):
return sum([a*b for a, b in zip(v1, v2)])
def cosSim(v1, v2):
N = dot(v1, v2)
D = dist((0,0), v1)*dist((0,0), v2)
if D <= 0.01: D = 0.01
return N/D | 15.382979 | 49 | 0.571231 | 160 | 723 | 2.58125 | 0.275 | 0.029056 | 0.043584 | 0.050847 | 0.1477 | 0.101695 | 0.101695 | 0.101695 | 0.101695 | 0.101695 | 0 | 0.120209 | 0.206086 | 723 | 47 | 50 | 15.382979 | 0.599303 | 0.024896 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.035714 | 0.107143 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
745677f726259ed680216f22d768bd3095775c46 | 96 | py | Python | while_Schleife.py | ostseegloeckchen/basics | 218b29c62f575d88c27104c05fee917b3466e8d0 | [
"bzip2-1.0.6"
] | null | null | null | while_Schleife.py | ostseegloeckchen/basics | 218b29c62f575d88c27104c05fee917b3466e8d0 | [
"bzip2-1.0.6"
] | null | null | null | while_Schleife.py | ostseegloeckchen/basics | 218b29c62f575d88c27104c05fee917b3466e8d0 | [
"bzip2-1.0.6"
] | null | null | null | current_number=0
while current_number <=5:
current_number +=1
print(current_number)
| 19.2 | 26 | 0.71875 | 13 | 96 | 5 | 0.538462 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038961 | 0.197917 | 96 | 4 | 27 | 24 | 0.805195 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
745cb74dcec4628f09604c5ccd5d900c4f4989eb | 3,263 | py | Python | utils_assembly_operation.py | ikuroNoriiwa/shellcode_transform | fac7d04168d9f3888a63c7ce76cc93bc8bef0058 | [
"Apache-2.0"
] | 2 | 2021-09-13T09:40:12.000Z | 2021-09-13T11:37:54.000Z | utils_assembly_operation.py | ikuroNoriiwa/shellcode_transform | fac7d04168d9f3888a63c7ce76cc93bc8bef0058 | [
"Apache-2.0"
] | null | null | null | utils_assembly_operation.py | ikuroNoriiwa/shellcode_transform | fac7d04168d9f3888a63c7ce76cc93bc8bef0058 | [
"Apache-2.0"
] | 1 | 2021-07-09T17:06:46.000Z | 2021-07-09T17:06:46.000Z | #!/usr/bin/python3
def add_sub(shellcode: bytes, add_or_sub: bool=True, to_num: int=1, decode: bool=False) -> bytes:
"""Perform a add or sub encoding scheme on `shellcode`.
:return: bytes object
"""
shellcode = bytearray(shellcode)
encoded_payload = bytearray()
calculated_num = (int(add_or_sub)*2-1) * to_num*(int(decode)*-2+1)
for byte in shellcode:
encoded_payload.append(byte + calculated_num)
return bytes(encoded_payload)
def right_left_rotation_bit(shellcode: bytes, right_or_left: bool=True, n: int=1) -> bytes:
# print(bin(byte<<n>>8<<8), bin(byte<<n), bin((byte<<n)-(byte<<n>>8<<8)), bin(byte>>8-n), bin((byte<<n)-(byte<<n>>8<<8) + (byte>>(8-n))))
# print(bin(byte), bin(byte<<(8-n)), bin(byte>>n<<8), bin(byte>>n), bin((byte<<(8-n)) - (byte>>n<<8) + (byte>>n)))
shellcode = bytearray(shellcode)
encoded_payload = bytearray()
for byte in shellcode:
if right_or_left:
encoded_payload.append((byte<<(8-n)) - (byte>>n<<8) + (byte>>n))
## right
else:
## left
encoded_payload.append((byte<<n)-(byte<<n>>8<<8) + (byte>>(8-n)))
return bytes(encoded_payload)
def rolling_rotation(shellcode: bytes, right_or_left: bool=True, decode: bool=False) -> bytes:
""" Perform a rolling xor encoding scheme on `shellcode`.
:param shellcode: bytes object; data to be [en,de]coded
:param decode: boolean, decrypt previously xor'd data
:return: bytes object
"""
shellcode = bytearray(shellcode)
if decode:
shellcode.reverse()
encoded_payload = bytearray()
for i, byte in enumerate(shellcode):
if i == len(shellcode) - 1:
encoded_payload.append(shellcode[i]) # last byte doesn't need xor'd, common to system call Ox80 generally
else:
encoded_payload.append(shellcode[i] ^ shellcode[i + 1])
encoded_payload.reverse()
else:
encoded_payload = bytearray([shellcode.pop(0)]) # first byte left as is in the ciphertext
for i, byte in enumerate(shellcode):
encoded_payload+=bytearray(right_left_rotation_bit( bytes(byte), right_or_left, int(encoded_payload[i])%8))
return bytes(encoded_payload)
def rolling_xor(shellcode: bytes, decode: bool=False) -> bytes:
""" Perform a rolling xor encoding scheme on `shellcode`.
:param shellcode: bytes object; data to be [en,de]coded
:param decode: boolean, decrypt previously xor'd data
:return: bytes object
"""
shellcode = bytearray(shellcode)
if decode:
shellcode.reverse()
encoded_payload = bytearray()
for i, byte in enumerate(shellcode):
if i == len(shellcode) - 1:
encoded_payload.append(shellcode[i]) # last byte doesn't need xor'd, common to system call Ox80 generally
else:
encoded_payload.append(shellcode[i] ^ shellcode[i + 1])
encoded_payload.reverse()
else:
encoded_payload = bytearray([shellcode.pop(0)]) # first byte left as is in the ciphertext
for i, byte in enumerate(shellcode):
encoded_payload.append(byte ^ encoded_payload[i])
return bytes(encoded_payload)
| 35.857143 | 141 | 0.630708 | 437 | 3,263 | 4.599542 | 0.169336 | 0.160199 | 0.079602 | 0.017413 | 0.812438 | 0.753234 | 0.633333 | 0.58806 | 0.561194 | 0.543284 | 0 | 0.014 | 0.233834 | 3,263 | 90 | 142 | 36.255556 | 0.79 | 0.288691 | 0 | 0.770833 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
745f3417083f56ba3a1170d3dedfc8b9679054f8 | 425 | py | Python | rwa/__init__.py | DecBayComp/RWA-python | caf7a96a7edd0397887429f52800e72fdf29434d | [
"Apache-2.0"
] | 1 | 2018-06-20T15:59:38.000Z | 2018-06-20T15:59:38.000Z | rwa/__init__.py | DecBayComp/RWA-python | caf7a96a7edd0397887429f52800e72fdf29434d | [
"Apache-2.0"
] | 2 | 2018-06-11T16:15:01.000Z | 2019-11-22T15:57:38.000Z | rwa/__init__.py | DecBayComp/RWA-python | caf7a96a7edd0397887429f52800e72fdf29434d | [
"Apache-2.0"
] | null | null | null |
from . import storable
from . import generic
from . import lazy
from . import sequence
from .storable import Storable, StorableHandler
from .generic import rwa_params, default_storable, namedtuple_storable, not_storable
from .lazy import islazy, lazytype, lazyvalue
try:
from . import hdf5
from .hdf5 import hdf5_storable, hdf5_not_storable, hdf5_agnostic_modules, HDF5Store
except ImportError:
#pass
raise
| 26.5625 | 88 | 0.790588 | 54 | 425 | 6.055556 | 0.444444 | 0.152905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016807 | 0.16 | 425 | 15 | 89 | 28.333333 | 0.89916 | 0.009412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.833333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
746f42faf0f3abf28755341e97b870eb4ad0a5d1 | 2,069 | py | Python | kombu/utils/functional.py | expa/kombu | 528ac975bd3b815ebe7d1b5f92126d5abd01c6cc | [
"BSD-3-Clause"
] | 39 | 2016-12-05T14:36:37.000Z | 2021-07-29T18:22:34.000Z | kombu/utils/functional.py | alex/kombu | 3cb79f9c8c4db3c47c66b5419fd7a40d09758b87 | [
"BSD-3-Clause"
] | 68 | 2016-12-12T20:38:47.000Z | 2020-07-26T18:28:49.000Z | kombu/utils/functional.py | alex/kombu | 3cb79f9c8c4db3c47c66b5419fd7a40d09758b87 | [
"BSD-3-Clause"
] | 120 | 2016-08-18T14:53:03.000Z | 2020-06-16T13:27:20.000Z | from __future__ import absolute_import
import sys
from collections import Iterable, Mapping
from kombu.five import string_t
__all__ = ['lazy', 'maybe_evaluate', 'is_list', 'maybe_list']
class lazy(object):
"""Holds lazy evaluation.
Evaluated when called or if the :meth:`evaluate` method is called.
The function is re-evaluated on every call.
Overloaded operations that will evaluate the promise:
:meth:`__str__`, :meth:`__repr__`, :meth:`__cmp__`.
"""
def __init__(self, fun, *args, **kwargs):
self._fun = fun
self._args = args
self._kwargs = kwargs
def __call__(self):
return self.evaluate()
def evaluate(self):
return self._fun(*self._args, **self._kwargs)
def __str__(self):
return str(self())
def __repr__(self):
return repr(self())
def __eq__(self, rhs):
return self() == rhs
def __ne__(self, rhs):
return self() != rhs
def __deepcopy__(self, memo):
memo[id(self)] = self
return self
def __reduce__(self):
return (self.__class__, (self._fun, ), {'_args': self._args,
'_kwargs': self._kwargs})
if sys.version_info[0] < 3:
def __cmp__(self, rhs):
if isinstance(rhs, self.__class__):
return -cmp(rhs, self())
return cmp(self(), rhs)
def maybe_evaluate(value):
"""Evaluates if the value is a :class:`lazy` instance."""
if isinstance(value, lazy):
return value.evaluate()
return value
def is_list(l, scalars=(Mapping, string_t), iters=(Iterable, )):
"""Return true if the object is iterable (but not
if object is a mapping or string)."""
return isinstance(l, iters) and not isinstance(l, scalars or ())
def maybe_list(l, scalars=(Mapping, string_t)):
"""Return list of one element if ``l`` is a scalar."""
return l if l is None or is_list(l, scalars) else [l]
# Compat names (before kombu 3.0)
promise = lazy
maybe_promise = maybe_evaluate
| 24.927711 | 73 | 0.615273 | 269 | 2,069 | 4.401487 | 0.304833 | 0.059122 | 0.047297 | 0.028716 | 0.08277 | 0.08277 | 0 | 0 | 0 | 0 | 0 | 0.002626 | 0.263896 | 2,069 | 82 | 74 | 25.231707 | 0.774787 | 0.222813 | 0 | 0 | 0 | 0 | 0.030109 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.302326 | false | 0 | 0.093023 | 0.162791 | 0.744186 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
748ed28868581a95b707b4d1a4f4d1ceb756396d | 401 | py | Python | arcade_solutions/intro/alternating_sums.py | nickaigi/automatic-dollop | eb8222475c7871c1d5710242c5aed8c70ea0d2c8 | [
"Unlicense"
] | null | null | null | arcade_solutions/intro/alternating_sums.py | nickaigi/automatic-dollop | eb8222475c7871c1d5710242c5aed8c70ea0d2c8 | [
"Unlicense"
] | null | null | null | arcade_solutions/intro/alternating_sums.py | nickaigi/automatic-dollop | eb8222475c7871c1d5710242c5aed8c70ea0d2c8 | [
"Unlicense"
] | null | null | null | def alternating_sums(a):
even, odd = [], []
for i in range(len(a)):
if i % 2 == 0:
even.append(a[i])
else:
odd.append(a[i])
return [sum(even), sum(odd)]
def alternating_sums_short(a):
return [
sum(a[::2]), sum(a[1::2])
]
if __name__ == '__main__':
a = [50, 60, 60, 45, 70]
alternating_sums(a)
alternating_sums_short(a)
| 21.105263 | 33 | 0.511222 | 59 | 401 | 3.237288 | 0.440678 | 0.314136 | 0.188482 | 0.219895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054348 | 0.311721 | 401 | 18 | 34 | 22.277778 | 0.637681 | 0 | 0 | 0 | 0 | 0 | 0.01995 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0.0625 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
74a635f2da3700c5b426525ef1a2e1bd84bb4147 | 420 | py | Python | common_configs/base.py | nigma/django-common-configs | b4499415c71ffd317f395896f97b0fc96b1ad7bd | [
"BSD-3-Clause"
] | 5 | 2015-01-07T22:27:47.000Z | 2017-07-23T12:15:45.000Z | common_configs/base.py | nigma/django-common-configs | b4499415c71ffd317f395896f97b0fc96b1ad7bd | [
"BSD-3-Clause"
] | null | null | null | common_configs/base.py | nigma/django-common-configs | b4499415c71ffd317f395896f97b0fc96b1ad7bd | [
"BSD-3-Clause"
] | null | null | null | #-*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from configurations import Configuration as _Configuration, values
class Configuration(_Configuration):
@property
def INSTALLED_APPS(self):
return []
@property
def MIDDLEWARE_CLASSES(self):
return []
@property
def TEMPLATE_CONTEXT_PROCESSORS(self):
return []
| 20 | 82 | 0.704762 | 42 | 420 | 6.738095 | 0.666667 | 0.116608 | 0.127208 | 0.14841 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00303 | 0.214286 | 420 | 20 | 83 | 21 | 0.854545 | 0.05 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.166667 | 0.25 | 0.75 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
776bc32e2b2eee2412e69059442ef1f37aff8e70 | 146 | py | Python | Scripts/all-fonts/close.py | miguelsousa/hTools2 | eab400677c1b21bb2519a7354a142e167c2b39ba | [
"BSD-3-Clause"
] | null | null | null | Scripts/all-fonts/close.py | miguelsousa/hTools2 | eab400677c1b21bb2519a7354a142e167c2b39ba | [
"BSD-3-Clause"
] | null | null | null | Scripts/all-fonts/close.py | miguelsousa/hTools2 | eab400677c1b21bb2519a7354a142e167c2b39ba | [
"BSD-3-Clause"
] | null | null | null | # [h] close all fonts
'''Close all open fonts.'''
all_fonts = AllFonts()
if len(all_fonts) > 0:
for font in all_fonts:
font.close() | 16.222222 | 27 | 0.616438 | 23 | 146 | 3.782609 | 0.521739 | 0.367816 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009009 | 0.239726 | 146 | 9 | 28 | 16.222222 | 0.774775 | 0.287671 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
777a6cf14d1f1795816ae487b69dc32e762df3e3 | 179 | py | Python | log_filter.py | oldacre/Who-The-Hill | 22b67424f95687aa62718337f5df333dd2b653f8 | [
"Apache-2.0"
] | null | null | null | log_filter.py | oldacre/Who-The-Hill | 22b67424f95687aa62718337f5df333dd2b653f8 | [
"Apache-2.0"
] | 4 | 2021-06-08T19:35:40.000Z | 2022-03-11T23:18:30.000Z | log_filter.py | oldacre/Who-The-Hill | 22b67424f95687aa62718337f5df333dd2b653f8 | [
"Apache-2.0"
] | null | null | null | import logging
class HealthcheckFilter(logging.Filter):
def filter(self, log_record):
if 'healthcheck' in log_record.msg:
return False
return True | 25.571429 | 43 | 0.670391 | 21 | 179 | 5.619048 | 0.761905 | 0.152542 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.26257 | 179 | 7 | 44 | 25.571429 | 0.893939 | 0 | 0 | 0 | 0 | 0 | 0.061111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
777ed8b99f3018b91a2821a6fceffa31b3074a5c | 125 | py | Python | with_op/__init__.py | apiology/with_op | eb77469a296d2facf11a039fda3c25d0d2142a75 | [
"MIT"
] | 1 | 2019-07-24T19:35:19.000Z | 2019-07-24T19:35:19.000Z | with_op/__init__.py | apiology/with_op | eb77469a296d2facf11a039fda3c25d0d2142a75 | [
"MIT"
] | 231 | 2018-09-12T17:09:46.000Z | 2021-07-11T20:07:05.000Z | with_op/__init__.py | apiology/with_op | eb77469a296d2facf11a039fda3c25d0d2142a75 | [
"MIT"
] | null | null | null | """Top-level package for with-op script."""
__author__ = """Vince Broz"""
__email__ = 'vince@broz.cc'
__version__ = '1.1.1'
| 20.833333 | 43 | 0.664 | 18 | 125 | 3.944444 | 0.777778 | 0.253521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027523 | 0.128 | 125 | 5 | 44 | 25 | 0.623853 | 0.296 | 0 | 0 | 0 | 0 | 0.341463 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7797511096f6c510538ad668a695179836c38f99 | 239 | py | Python | pysofe/quadrature/__init__.py | pysofe/pysofe | 088d4061fcf194a85ff3332e7bdd3bde095e4f69 | [
"BSD-3-Clause"
] | null | null | null | pysofe/quadrature/__init__.py | pysofe/pysofe | 088d4061fcf194a85ff3332e7bdd3bde095e4f69 | [
"BSD-3-Clause"
] | null | null | null | pysofe/quadrature/__init__.py | pysofe/pysofe | 088d4061fcf194a85ff3332e7bdd3bde095e4f69 | [
"BSD-3-Clause"
] | null | null | null | """
Provides the data structure for numerical integration.
The purpose of these data structures is to give access
to the quadrature points and weights for several spatial domains.
"""
import gaussian
from .gaussian import GaussQuadSimp
| 21.727273 | 65 | 0.803347 | 33 | 239 | 5.818182 | 0.787879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158996 | 239 | 10 | 66 | 23.9 | 0.955224 | 0.736402 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
77af3a9dc1269362de9d3927b1bcf0c929023c1d | 185 | py | Python | pytest-verbose-parametrize/tests/integration/parametrize_ids/tests/unit/test_example.py | RaiVaibhav/pytest-plugins | b21eef7fb2d876b3910f4a476875f9f157275b49 | [
"MIT"
] | 282 | 2015-12-01T12:40:31.000Z | 2019-10-30T23:30:54.000Z | pytest-verbose-parametrize/tests/integration/parametrize_ids/tests/unit/test_example.py | RaiVaibhav/pytest-plugins | b21eef7fb2d876b3910f4a476875f9f157275b49 | [
"MIT"
] | 126 | 2015-09-02T14:31:02.000Z | 2019-10-21T20:32:18.000Z | pytest-verbose-parametrize/tests/integration/parametrize_ids/tests/unit/test_example.py | RaiVaibhav/pytest-plugins | b21eef7fb2d876b3910f4a476875f9f157275b49 | [
"MIT"
] | 55 | 2015-09-21T09:11:05.000Z | 2019-10-27T00:44:32.000Z | import pytest
@pytest.mark.parametrize(('f', 't'), [(sum, list), (len, int)])
def test_foo(f, t):
assert isinstance(f([[1], [2]]), t)
def test_bar(): # unparametrized
pass
| 16.818182 | 63 | 0.594595 | 27 | 185 | 4 | 0.740741 | 0.037037 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013158 | 0.178378 | 185 | 10 | 64 | 18.5 | 0.697368 | 0.075676 | 0 | 0 | 0 | 0 | 0.011834 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.333333 | false | 0.166667 | 0.166667 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
77dcf06a61fa8a09b95eb69913271f8cbf85fdb9 | 1,162 | py | Python | tests/test_container.py | sturmianseq/pythondi | bfb538540f3119d79e68e07572bc6e2f9573d3bc | [
"Apache-2.0"
] | 34 | 2019-11-12T08:45:16.000Z | 2022-02-05T19:11:08.000Z | tests/test_container.py | sturmianseq/pythondi | bfb538540f3119d79e68e07572bc6e2f9573d3bc | [
"Apache-2.0"
] | 2 | 2021-08-23T09:23:57.000Z | 2021-12-13T04:41:24.000Z | tests/test_container.py | sturmianseq/pythondi | bfb538540f3119d79e68e07572bc6e2f9573d3bc | [
"Apache-2.0"
] | 3 | 2020-09-22T16:10:35.000Z | 2021-08-24T01:19:53.000Z | from pythondi import Container, Provider
def test_has_shared_state():
c1 = Container
c2 = Container
assert c1.get() == c2.get()
p1 = Provider(cls=int, new_cls=str)
c1.set(provider=p1)
assert c1.get() == c2.get()
p2 = Provider(cls=str, new_cls=int)
c2.set(provider=p2)
assert c1.get() == c2.get()
def test_has_shared_state_with_instance():
c1 = Container()
c2 = Container()
assert id(c1) != id(c2)
assert c1.get() == c2.get()
p1 = Provider(cls=int, new_cls=str)
c1.set(provider=p1)
assert c1.get() == c2.get()
p2 = Provider(cls=str, new_cls=int)
c2.set(provider=p2)
assert c1.get() == c2.get()
def test_clear():
Container.set(provider=Provider())
assert Container.get() is not None
Container.clear()
assert Container.get() is None
def test_set():
Container.clear()
assert Container.get() is None
provider = Provider()
Container.set(provider=provider)
assert Container.get() == provider
def test_get():
Container.clear()
assert Container.get() is None
Container.set(provider=Provider())
assert Container.get() is not None
| 21.924528 | 42 | 0.640275 | 164 | 1,162 | 4.445122 | 0.170732 | 0.105624 | 0.090535 | 0.106996 | 0.857339 | 0.740741 | 0.740741 | 0.521262 | 0.521262 | 0.521262 | 0 | 0.032967 | 0.216867 | 1,162 | 52 | 43 | 22.346154 | 0.768132 | 0 | 0 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.342105 | 1 | 0.131579 | false | 0 | 0.026316 | 0 | 0.157895 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7adc57c668f27576fa0782daf119f72088b096fd | 53 | py | Python | persession/__init__.py | rishabhsingh971/login-session | b551798d4ca1f8e9f97f94cfc0c45ba2c52b07ba | [
"MIT"
] | 3 | 2019-09-14T21:43:58.000Z | 2019-10-13T08:43:40.000Z | persession/__init__.py | rishabhsingh971/login-session | b551798d4ca1f8e9f97f94cfc0c45ba2c52b07ba | [
"MIT"
] | 1 | 2020-03-31T07:06:56.000Z | 2020-03-31T07:06:56.000Z | persession/__init__.py | rishabhsingh971/login-session | b551798d4ca1f8e9f97f94cfc0c45ba2c52b07ba | [
"MIT"
] | null | null | null | """ init """
from .main import *
name = "persession"
| 13.25 | 19 | 0.603774 | 6 | 53 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188679 | 53 | 3 | 20 | 17.666667 | 0.744186 | 0.075472 | 0 | 0 | 0 | 0 | 0.243902 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7afde0ad53fdb9ffc7ce39693d2278734e22b12f | 303 | py | Python | gaphor/RAAML/toolbox.py | mrmonkington/gaphor | f0fcd4deb90d24b14723840a689fac901f645a43 | [
"Apache-2.0"
] | 867 | 2018-01-09T00:19:09.000Z | 2022-03-31T02:49:23.000Z | gaphor/RAAML/toolbox.py | mrmonkington/gaphor | f0fcd4deb90d24b14723840a689fac901f645a43 | [
"Apache-2.0"
] | 790 | 2018-01-13T23:47:07.000Z | 2022-03-31T16:04:27.000Z | gaphor/RAAML/toolbox.py | sitedata/gaphor | c83eff0bd595d1a8e766a157f0268e5206eed22c | [
"Apache-2.0"
] | 117 | 2018-01-09T02:24:49.000Z | 2022-03-23T08:07:42.000Z | """The action definition for the RAAML toolbox."""
from gaphor.diagram.diagramtoolbox import ToolboxDefinition, general_tools
from gaphor.RAAML.fta.ftatoolbox import fta
from gaphor.RAAML.stpa.stpatoolbox import stpa
raaml_toolbox_actions: ToolboxDefinition = (
general_tools,
fta,
stpa,
)
| 27.545455 | 74 | 0.788779 | 37 | 303 | 6.351351 | 0.513514 | 0.12766 | 0.246809 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135314 | 303 | 10 | 75 | 30.3 | 0.896947 | 0.145215 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.375 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bb0f5f3ad883aa6a144c404a7c47daf79faf456c | 197 | py | Python | setup.py | socc-io/Naver-VISION_AI_contest | e9961c8a42af952cc1367ce0b14a1b31ebe0d8f7 | [
"Unlicense"
] | null | null | null | setup.py | socc-io/Naver-VISION_AI_contest | e9961c8a42af952cc1367ce0b14a1b31ebe0d8f7 | [
"Unlicense"
] | null | null | null | setup.py | socc-io/Naver-VISION_AI_contest | e9961c8a42af952cc1367ce0b14a1b31ebe0d8f7 | [
"Unlicense"
] | null | null | null | #nsml: soonmok/socc_image:v_4
from distutils.core import setup
setup(
name='nsml vision hackathon',
version='1.0',
description='nsml vision hackathon',
install_requires=[
]
)
| 16.416667 | 40 | 0.685279 | 25 | 197 | 5.28 | 0.8 | 0.151515 | 0.287879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018987 | 0.19797 | 197 | 11 | 41 | 17.909091 | 0.816456 | 0.142132 | 0 | 0 | 0 | 0 | 0.267857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.125 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb1361e77a08fcddc05d2b095409daa573b2c907 | 497 | py | Python | bubble_sort/main.py | TJHomer/itp-w1-bubble-sort | c5959fe3df3e6344a963e6a92a50e16341d3f055 | [
"MIT"
] | null | null | null | bubble_sort/main.py | TJHomer/itp-w1-bubble-sort | c5959fe3df3e6344a963e6a92a50e16341d3f055 | [
"MIT"
] | null | null | null | bubble_sort/main.py | TJHomer/itp-w1-bubble-sort | c5959fe3df3e6344a963e6a92a50e16341d3f055 | [
"MIT"
] | 1 | 2020-10-19T04:19:53.000Z | 2020-10-19T04:19:53.000Z | """This is the entry point of the program."""
def bubble_sort(list_of_numbers):
for i in range(len(list_of_numbers)-1,0,-1):
for j in range(i):
if list_of_numbers[j] > list_of_numbers[j+1]:
placeholder = list_of_numbers[j]
list_of_numbers[j] = list_of_numbers[j+1]
list_of_numbers[j+1] = placeholder
return list_of_numbers
if __name__ == '__main__':
print(bubble_sort([9, 1, 3, 11, 7, 2, 42, 111]))
| 27.611111 | 57 | 0.591549 | 78 | 497 | 3.410256 | 0.423077 | 0.203008 | 0.43985 | 0.315789 | 0.409774 | 0.409774 | 0.270677 | 0.270677 | 0.218045 | 0 | 0 | 0.050847 | 0.287726 | 497 | 17 | 58 | 29.235294 | 0.700565 | 0.078471 | 0 | 0 | 0 | 0 | 0.017699 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.2 | 0.1 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb2071b583422ebbc3dcf7f992247801c566262b | 288 | py | Python | django/b3_propagation/middleware.py | ueni-ltd/istio-integration | 34c1845858279ffc5354341d5c1088d1105e6dea | [
"MIT"
] | 1 | 2018-11-19T10:18:47.000Z | 2018-11-19T10:18:47.000Z | django/b3_propagation/middleware.py | ueni-ltd/istio-integration | 34c1845858279ffc5354341d5c1088d1105e6dea | [
"MIT"
] | null | null | null | django/b3_propagation/middleware.py | ueni-ltd/istio-integration | 34c1845858279ffc5354341d5c1088d1105e6dea | [
"MIT"
] | 1 | 2018-11-19T10:21:16.000Z | 2018-11-19T10:21:16.000Z | from b3_propagation import local_storage
def request_store_middleware(get_response):
def middleware(request):
local_storage.request = request
try:
return get_response(request)
finally:
del local_storage.request
return middleware
| 22.153846 | 43 | 0.684028 | 31 | 288 | 6.096774 | 0.516129 | 0.190476 | 0.201058 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004762 | 0.270833 | 288 | 12 | 44 | 24 | 0.895238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
bb301763790dd58890166561711890489371e8be | 1,980 | py | Python | downloads/managers.py | akondasif/Clone-test-repo | 8a6fc17dc904015db76d4fe81965765466adfc55 | [
"Apache-2.0"
] | null | null | null | downloads/managers.py | akondasif/Clone-test-repo | 8a6fc17dc904015db76d4fe81965765466adfc55 | [
"Apache-2.0"
] | 1 | 2019-03-28T22:12:58.000Z | 2019-03-28T22:12:58.000Z | downloads/managers.py | akondasif/Clone-test-repo | 8a6fc17dc904015db76d4fe81965765466adfc55 | [
"Apache-2.0"
] | 1 | 2019-04-03T20:26:54.000Z | 2019-04-03T20:26:54.000Z | from django.db.models import Manager
from django.db.models.query import QuerySet
class ReleaseQuerySet(QuerySet):
def published(self):
return self.filter(is_published=True)
def draft(self):
return self.filter(is_published=False)
def downloads(self):
""" For the main downloads landing page """
return self.select_related('release_page').filter(
is_published=True,
show_on_download_page=True,
).order_by('-release_date')
def python2(self):
return self.filter(version=2, is_published=True)
def python3(self):
return self.filter(version=3, is_published=True)
def latest_python2(self):
return self.python2().filter(is_latest=True)
def latest_python3(self):
return self.python3().filter(is_latest=True)
def pre_release(self):
return self.filter(pre_release=True)
def released(self):
return self.filter(is_published=True, pre_release=False)
class ReleaseManager(Manager):
def get_queryset(self):
return ReleaseQuerySet(self.model, using=self._db)
def published(self):
return self.get_queryset().published()
def draft(self):
return self.get_queryset().draft()
def downloads(self):
""" For the main downloads landing page """
return self.get_queryset().downloads()
def python2(self):
return self.get_queryset().python2()
def python3(self):
return self.get_queryset().python3()
def latest_python2(self):
qs = self.get_queryset().latest_python2()
if qs:
return qs[0]
else:
return None
def latest_python3(self):
qs = self.get_queryset().latest_python3()
if qs:
return qs[0]
else:
return None
def pre_release(self):
return self.get_queryset().pre_release()
def released(self):
return self.get_queryset().released()
| 25.714286 | 64 | 0.638384 | 242 | 1,980 | 5.070248 | 0.210744 | 0.130399 | 0.159739 | 0.119804 | 0.577832 | 0.308068 | 0.197229 | 0.140179 | 0.140179 | 0.09128 | 0 | 0.012195 | 0.254545 | 1,980 | 76 | 65 | 26.052632 | 0.819106 | 0.036364 | 0 | 0.490566 | 0 | 0 | 0.0132 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.358491 | false | 0 | 0.037736 | 0.283019 | 0.830189 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bb3864161bf7cbcfde75ee32a663134f851edc59 | 189 | py | Python | extract_links_from_html.py | unbiased-coder/python-extract-text | 3f98a2c1f7a325691e0021d20fd4defedd969ab1 | [
"Unlicense"
] | null | null | null | extract_links_from_html.py | unbiased-coder/python-extract-text | 3f98a2c1f7a325691e0021d20fd4defedd969ab1 | [
"Unlicense"
] | null | null | null | extract_links_from_html.py | unbiased-coder/python-extract-text | 3f98a2c1f7a325691e0021d20fd4defedd969ab1 | [
"Unlicense"
] | null | null | null | from bs4 import BeautifulSoup
html = open('sample.html', 'r').read()
soup = BeautifulSoup(html, features="lxml")
for element in soup.find_all('a', href=True):
print (element['href'])
| 23.625 | 45 | 0.693122 | 27 | 189 | 4.814815 | 0.777778 | 0.261538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006098 | 0.132275 | 189 | 7 | 46 | 27 | 0.786585 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb59f22b4ccf6393306c8b7bdaab55f4c952a159 | 150 | py | Python | templates/apps.py | DeeMATT/studious-waffle-website-builder | 5077af0edae7a3fef74ceae0d7bad9ace28a3834 | [
"MIT"
] | null | null | null | templates/apps.py | DeeMATT/studious-waffle-website-builder | 5077af0edae7a3fef74ceae0d7bad9ace28a3834 | [
"MIT"
] | 1 | 2021-12-12T03:13:49.000Z | 2021-12-12T03:13:49.000Z | templates/apps.py | DeeMATT/studious-waffle-website-builder | 5077af0edae7a3fef74ceae0d7bad9ace28a3834 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class TemplatesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'templates'
| 21.428571 | 56 | 0.766667 | 17 | 150 | 6.647059 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146667 | 150 | 6 | 57 | 25 | 0.882813 | 0 | 0 | 0 | 0 | 0 | 0.253333 | 0.193333 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.