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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9c94a0de5038451af1385da98feee270cb58e8f7 | 98 | py | Python | Exercise_4_14.py | kushrami/Python-Crash-Course-book-Excersice | 7093181940a90d9f4bab5775ef56f57963450393 | [
"Apache-2.0"
] | null | null | null | Exercise_4_14.py | kushrami/Python-Crash-Course-book-Excersice | 7093181940a90d9f4bab5775ef56f57963450393 | [
"Apache-2.0"
] | null | null | null | Exercise_4_14.py | kushrami/Python-Crash-Course-book-Excersice | 7093181940a90d9f4bab5775ef56f57963450393 | [
"Apache-2.0"
] | null | null | null | #PEP
# you can see whats is there to PEP 8 style guide at https://python.org/dev/peps/pep-0008/.
| 24.5 | 91 | 0.714286 | 20 | 98 | 3.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060976 | 0.163265 | 98 | 3 | 92 | 32.666667 | 0.792683 | 0.94898 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 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 | 4 |
9cbac13cfdf52bfb075f7dcee8fb9e5c2d65ba7c | 91 | py | Python | boilerplate/treaties/apps.py | imciflam/electronic-document-management-system | f4db6be1e93204a3d09f0ebc09b7ba8bbdd90f77 | [
"MIT"
] | 1 | 2019-08-11T21:23:59.000Z | 2019-08-11T21:23:59.000Z | boilerplate/treaties/apps.py | imciflam/electronic-document-management-system | f4db6be1e93204a3d09f0ebc09b7ba8bbdd90f77 | [
"MIT"
] | 5 | 2020-06-05T21:28:14.000Z | 2021-06-10T18:21:18.000Z | boilerplate/treaties/apps.py | imciflam/electronic-document-management-system | f4db6be1e93204a3d09f0ebc09b7ba8bbdd90f77 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class TreatiesConfig(AppConfig):
name = 'treaties'
| 15.166667 | 33 | 0.758242 | 10 | 91 | 6.9 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 91 | 5 | 34 | 18.2 | 0.907895 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 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 | 1 | 0 | 0 | 4 |
9cd111750af3ab1ddb84e3fabca690fa7d62f848 | 899 | py | Python | Proctorexam/Classes/Institute.py | gbaelen/ProctorExam-python-api-wrapper | 1ee346e36db1f4c98df2f1a74eefdb86ff453958 | [
"MIT"
] | null | null | null | Proctorexam/Classes/Institute.py | gbaelen/ProctorExam-python-api-wrapper | 1ee346e36db1f4c98df2f1a74eefdb86ff453958 | [
"MIT"
] | null | null | null | Proctorexam/Classes/Institute.py | gbaelen/ProctorExam-python-api-wrapper | 1ee346e36db1f4c98df2f1a74eefdb86ff453958 | [
"MIT"
] | 1 | 2019-12-17T12:55:06.000Z | 2019-12-17T12:55:06.000Z | class Institute():
def __init__(self, connector=None):
self.connector = connector
@staticmethod
def generate_institute_from_response(data, connector=None):
return Institute(**data, connector=connector)
class InstituteList():
def __init__(self):
self.__id = 0
self.__institutes = []
def __iter(self):
self.__id = 0
return self
def __next__(self):
if self.__id < len(self.__institutes):
institute = self.__institutes[self.__id]
self.__id += 1
return institute
else:
raise StopIteration
def __getitem__(self, key):
return self.__institutes[key]
def add(self, institute):
self.__institutes.append(institute)
def remove_at(self, index):
self.__institutes.pop(index)
def size(self):
return len(self.__institutes)
| 24.297297 | 63 | 0.617353 | 96 | 899 | 5.302083 | 0.354167 | 0.192534 | 0.043222 | 0.043222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00468 | 0.286986 | 899 | 36 | 64 | 24.972222 | 0.789392 | 0 | 0 | 0.071429 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.321429 | false | 0 | 0 | 0.107143 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
142065f59e0f1797bdbb389dfc7c4700a99ce605 | 322 | py | Python | venv/Lib/site-packages/setuptools_scm/scm_workdir.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | 579 | 2015-06-11T17:16:44.000Z | 2022-03-30T17:40:07.000Z | activate/Lib/site-packages/setuptools_scm/scm_workdir.py | Tanushree28/Cyberbullying-Detection | 3a69ade5cf068b640a0d6d1f176ff0d0e2040501 | [
"MIT"
] | 515 | 2015-06-11T17:39:47.000Z | 2022-03-30T08:35:21.000Z | activate/Lib/site-packages/setuptools_scm/scm_workdir.py | Tanushree28/Cyberbullying-Detection | 3a69ade5cf068b640a0d6d1f176ff0d0e2040501 | [
"MIT"
] | 193 | 2015-06-13T13:27:44.000Z | 2022-03-16T18:41:59.000Z | from .utils import do
from .utils import do_ex
from .utils import require_command
class Workdir:
def __init__(self, path):
require_command(self.COMMAND)
self.path = path
def do_ex(self, cmd):
return do_ex(cmd, cwd=self.path)
def do(self, cmd):
return do(cmd, cwd=self.path)
| 20.125 | 40 | 0.652174 | 49 | 322 | 4.102041 | 0.326531 | 0.159204 | 0.223881 | 0.169154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.251553 | 322 | 15 | 41 | 21.466667 | 0.834025 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.272727 | 0.181818 | 0.818182 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
1442a23f4273ec7116b39ecc0e5c35ff6d27b9b5 | 1,254 | py | Python | main_app/models.py | AdityaGoyal1999/SigmaHacks | 80c8b60af5786ab6c2c8048d48808d78f253f5f9 | [
"RSA-MD"
] | null | null | null | main_app/models.py | AdityaGoyal1999/SigmaHacks | 80c8b60af5786ab6c2c8048d48808d78f253f5f9 | [
"RSA-MD"
] | 5 | 2021-03-30T14:01:30.000Z | 2022-01-13T03:07:38.000Z | main_app/models.py | AdityaGoyal1999/SigmaHacks | 80c8b60af5786ab6c2c8048d48808d78f253f5f9 | [
"RSA-MD"
] | null | null | null | from django.db import models
from django.core.files.storage import FileSystemStorage
# Create your models here.
# fs = FileSystemStorage(location='/main_app/static/images')
class User(models.Model):
name = models.CharField(max_length=500)
email = models.CharField(max_length=500)
password = models.CharField(max_length=500)
category = models.CharField(max_length=500)
def __str__(self):
return '{}'.format(self.name)
class Property(models.Model):
owner = models.CharField(max_length=500, null=True)
number_and_street = models.CharField(max_length=500, null=True)
pincode = models.CharField(max_length=100, null=True)
city = models.CharField(max_length=100, null=True)
state = models.CharField(max_length=100, null=True)
country = models.CharField(max_length=100, null=True)
occupied = models.CharField(max_length=100, null=True)
rent = models.DecimalField(max_digits=10, decimal_places=2, null=True)
notes = models.CharField(max_length=200, null=True)
def __str__(self):
return self.owner+"\'s property"
class Image(models.Model):
post = models.ForeignKey(Property, default=None, on_delete=models.CASCADE)
photo = models.ImageField(upload_to='static/images/')
| 33.891892 | 78 | 0.733652 | 168 | 1,254 | 5.315476 | 0.410714 | 0.201568 | 0.241881 | 0.322508 | 0.395297 | 0.274356 | 0.274356 | 0 | 0 | 0 | 0 | 0.036415 | 0.145933 | 1,254 | 36 | 79 | 34.833333 | 0.797386 | 0.066188 | 0 | 0.083333 | 0 | 0 | 0.023973 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0.041667 | 0.083333 | 0.083333 | 1 | 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 | 1 | 0 | 0 | 4 |
1475d5a43d0953c01ed874aaee9b4a990dd237b3 | 150 | py | Python | AnimeAvatarGenerator/modules/networks/__init__.py | CharlesPikachu/GAN | 98944f0a095cd7b5a7d75f60d2c5794f264669b6 | [
"MIT"
] | 4 | 2020-05-25T09:54:31.000Z | 2021-10-31T21:52:55.000Z | AnimeAvatarGenerator/modules/networks/__init__.py | CharlesPikachu/GAN | 98944f0a095cd7b5a7d75f60d2c5794f264669b6 | [
"MIT"
] | null | null | null | AnimeAvatarGenerator/modules/networks/__init__.py | CharlesPikachu/GAN | 98944f0a095cd7b5a7d75f60d2c5794f264669b6 | [
"MIT"
] | null | null | null | '''import all'''
from .generator import Generator
from .discriminator import Discriminator
'''define all'''
__all__ = ['Generator', 'Discriminator'] | 21.428571 | 40 | 0.74 | 15 | 150 | 7.133333 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113333 | 150 | 7 | 41 | 21.428571 | 0.804511 | 0.066667 | 0 | 0 | 0 | 0 | 0.184874 | 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 | 1 | 0 | 0 | 4 |
14a02f343d06b82a5852c556ac7818110830b718 | 170 | py | Python | python_structure/data_structures/linked_list/node.py | bangyen/pascal-triangle | 0831348e93c274bdd38bba5c3aeeda7596ab97ee | [
"MIT"
] | 1 | 2020-03-11T10:20:53.000Z | 2020-03-11T10:20:53.000Z | python_structure/data_structures/linked_list/node.py | bangyen/pascal-triangle | 0831348e93c274bdd38bba5c3aeeda7596ab97ee | [
"MIT"
] | 1 | 2020-07-06T15:45:01.000Z | 2020-07-06T15:50:32.000Z | python_structure/data_structures/linked_list/node.py | bangyen/pascal-triangle | 0831348e93c274bdd38bba5c3aeeda7596ab97ee | [
"MIT"
] | 1 | 2020-07-02T05:21:58.000Z | 2020-07-02T05:21:58.000Z | class Node:
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
def print_node(self):
print(self.data)
| 21.25 | 50 | 0.611765 | 24 | 170 | 4.041667 | 0.375 | 0.247423 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.282353 | 170 | 7 | 51 | 24.285714 | 0.795082 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.5 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
14ab41eaa6347ff5629e43c10f9b3e50eb5f1d94 | 396 | py | Python | build/lib/zorb/layers/ReLU.py | varunranga/zorb | ffad98d15c3200eafc1b10c68860ce34ebf78f62 | [
"MIT"
] | 3 | 2021-05-13T16:28:39.000Z | 2022-02-18T23:10:35.000Z | src/zorb/layers/ReLU.py | varunranga/zorb | ffad98d15c3200eafc1b10c68860ce34ebf78f62 | [
"MIT"
] | null | null | null | src/zorb/layers/ReLU.py | varunranga/zorb | ffad98d15c3200eafc1b10c68860ce34ebf78f62 | [
"MIT"
] | null | null | null | from jax import numpy as jnp
from jax.nn import relu
from jax.lax import cond
from .. import enum
class ReLU():
def __init__(self):
self.types = {enum.ReLU, enum.Activation, enum.NonParametric}
def __call__(self, input_shape):
self.input_shape = input_shape
self.output_shape = (None, *input_shape[1:])
def forward(self, X): return relu(X)
def backward(self, Y): return relu(Y)
| 18.857143 | 63 | 0.719697 | 63 | 396 | 4.31746 | 0.460317 | 0.147059 | 0.102941 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003021 | 0.164141 | 396 | 20 | 64 | 19.8 | 0.818731 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.166667 | 0.75 | 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 | 1 | 1 | 1 | 0 | 0 | 4 |
1ae85189e27b0ac2e27c365773fdfb30bc02d4a1 | 305 | py | Python | npyreader.py | Sura-IIT-DELHI/Autonomous-Driving-Robot-Car | 44756265948af96735637bb743dab9a0b68351a8 | [
"MIT"
] | null | null | null | npyreader.py | Sura-IIT-DELHI/Autonomous-Driving-Robot-Car | 44756265948af96735637bb743dab9a0b68351a8 | [
"MIT"
] | null | null | null | npyreader.py | Sura-IIT-DELHI/Autonomous-Driving-Robot-Car | 44756265948af96735637bb743dab9a0b68351a8 | [
"MIT"
] | null | null | null | import numpy as np
from PIL import Image
import pandas as pd
image=np.load('./data_cooked/image.npy')
previous_state=np.load('./data_cooked/previous_state.npy')
label=np.load('./data_cooked/label.npy')
print image.shape
print previous_state.shape
print label.shape
print previous_state[0]
print label[0]
| 23.461538 | 58 | 0.793443 | 52 | 305 | 4.519231 | 0.365385 | 0.221277 | 0.12766 | 0.204255 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007168 | 0.085246 | 305 | 12 | 59 | 25.416667 | 0.835125 | 0 | 0 | 0 | 0 | 0 | 0.255738 | 0.255738 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.272727 | null | null | 0.454545 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
1ae8dcbea91798e5afd8bf758cf635f569a3b0bc | 5,769 | py | Python | h1st_contrib/iot_mgmt/maint_ops/querysets.py | h1st-ai/h1st-contrib | 38fbb1fff4513bb3433bc12f2b436836e5e51c80 | [
"Apache-2.0"
] | 1 | 2022-02-19T18:55:43.000Z | 2022-02-19T18:55:43.000Z | h1st_contrib/iot_mgmt/maint_ops/querysets.py | h1st-ai/h1st-contrib | 38fbb1fff4513bb3433bc12f2b436836e5e51c80 | [
"Apache-2.0"
] | null | null | null | h1st_contrib/iot_mgmt/maint_ops/querysets.py | h1st-ai/h1st-contrib | 38fbb1fff4513bb3433bc12f2b436836e5e51c80 | [
"Apache-2.0"
] | null | null | null | """H1st IoT Maintenance Operations: querysets."""
from django.db.models import Prefetch
from h1st_contrib.iot_mgmt.maint_ops.models import (
EquipmentInstanceDailyRiskScore,
EquipmentProblemType,
EquipmentInstanceAlarmPeriod,
AlertDiagnosisStatus,
EquipmentInstanceAlertPeriod,
EquipmentInstanceProblemDiagnosis,
)
EQUIPMENT_INSTANCE_DAILY_RISK_SCORE = \
EquipmentInstanceDailyRiskScore.objects \
.select_related(
'equipment_unique_type_group',
'equipment_instance') \
.defer(
'equipment_unique_type_group__equipment_general_type',
'equipment_instance__equipment_general_type',
'equipment_instance__equipment_unique_type',
'equipment_instance__equipment_facility',
'equipment_instance__info')
EQUIPMENT_PROBLEM_TYPE_QUERYSET = \
EquipmentProblemType.objects.all()
EQUIPMENT_INSTANCE_ALARM_PERIOD_STR_QUERYSET = \
EquipmentInstanceAlarmPeriod.objects \
.defer(
'date_range',
'has_associated_equipment_instance_alert_periods',
'has_associated_equipment_instance_problem_diagnoses') \
.select_related(
'equipment_instance',
'equipment_instance__equipment_general_type',
'equipment_instance__equipment_unique_type',
'alarm_type') \
.defer(
'equipment_instance__equipment_facility',
'equipment_instance__info') \
.order_by(
'from_utc_date_time')
EQUIPMENT_INSTANCE_ALARM_PERIOD_FULL_QUERYSET = \
EquipmentInstanceAlarmPeriod.objects \
.defer(
'date_range') \
.select_related(
'equipment_instance',
'alarm_type') \
.defer(
'equipment_instance__equipment_general_type',
'equipment_instance__equipment_unique_type',
'equipment_instance__equipment_facility',
'equipment_instance__info') \
.order_by(
'from_utc_date_time')
ALERT_DIAGNOSIS_STATUS_REST_API_QUERYSET = \
AlertDiagnosisStatus.objects.all()
EQUIPMENT_INSTANCE_ALERT_PERIOD_STR_QUERYSET = \
EquipmentInstanceAlertPeriod.objects \
.defer(
'date_range',
'info',
'has_associated_equipment_instance_alarm_periods',
'has_associated_equipment_instance_problem_diagnoses') \
.select_related(
'equipment_unique_type_group',
'equipment_unique_type_group__equipment_general_type',
'equipment_instance',
'diagnosis_status') \
.defer(
'equipment_instance__equipment_general_type',
'equipment_instance__equipment_unique_type',
'equipment_instance__equipment_facility',
'equipment_instance__info',
'diagnosis_status__index')
EQUIPMENT_INSTANCE_ALERT_PERIOD_FULL_QUERYSET = \
EquipmentInstanceAlertPeriod.objects \
.defer(
'date_range') \
.select_related(
'equipment_unique_type_group',
'equipment_instance',
'diagnosis_status') \
.defer(
'equipment_unique_type_group__equipment_general_type',
'equipment_instance__equipment_general_type',
'equipment_instance__equipment_unique_type',
'equipment_instance__equipment_facility',
'equipment_instance__info',
'diagnosis_status__index')
EQUIPMENT_INSTANCE_PROBLEM_DIAGNOSIS_ID_ONLY_UNORDERED_QUERYSET = \
EquipmentInstanceProblemDiagnosis.objects \
.only('id') \
.order_by()
EQUIPMENT_INSTANCE_PROBLEM_DIAGNOSIS_STR_QUERYSET = \
EquipmentInstanceProblemDiagnosis.objects \
.defer(
'date_range',
'duration',
'has_equipment_problems',
'comments',
'has_associated_equipment_instance_alarm_periods',
'has_associated_equipment_instance_alert_periods') \
.select_related(
'equipment_instance',
'equipment_instance__equipment_general_type',
'equipment_instance__equipment_unique_type') \
.defer(
'equipment_instance__equipment_facility',
'equipment_instance__info') \
.prefetch_related(
'equipment_problem_types')
EQUIPMENT_INSTANCE_PROBLEM_DIAGNOSIS_FULL_QUERYSET = \
EquipmentInstanceProblemDiagnosis.objects \
.defer(
'date_range') \
.select_related(
'equipment_instance') \
.defer(
'equipment_instance__equipment_general_type',
'equipment_instance__equipment_unique_type',
'equipment_instance__equipment_facility',
'equipment_instance__info') \
.prefetch_related(
'equipment_problem_types')
EQUIPMENT_INSTANCE_ALARM_PERIOD_REST_API_QUERYSET = \
EQUIPMENT_INSTANCE_ALARM_PERIOD_FULL_QUERYSET \
.prefetch_related(
Prefetch(
lookup='equipment_instance_alert_periods',
queryset=EQUIPMENT_INSTANCE_ALERT_PERIOD_FULL_QUERYSET),
Prefetch(
lookup='equipment_instance_problem_diagnoses',
queryset=EQUIPMENT_INSTANCE_PROBLEM_DIAGNOSIS_FULL_QUERYSET))
EQUIPMENT_INSTANCE_ALERT_PERIOD_REST_API_QUERYSET = \
EQUIPMENT_INSTANCE_ALERT_PERIOD_FULL_QUERYSET \
.prefetch_related(
Prefetch(
lookup='equipment_instance_alarm_periods',
queryset=EQUIPMENT_INSTANCE_ALARM_PERIOD_FULL_QUERYSET),
Prefetch(
lookup='equipment_instance_problem_diagnoses',
queryset=EQUIPMENT_INSTANCE_PROBLEM_DIAGNOSIS_FULL_QUERYSET))
EQUIPMENT_INSTANCE_PROBLEM_DIAGNOSIS_REST_API_QUERYSET = \
EQUIPMENT_INSTANCE_PROBLEM_DIAGNOSIS_FULL_QUERYSET \
.prefetch_related(
Prefetch(
lookup='equipment_instance_alarm_periods',
queryset=EQUIPMENT_INSTANCE_ALARM_PERIOD_FULL_QUERYSET),
Prefetch(
lookup='equipment_instance_alert_periods',
queryset=EQUIPMENT_INSTANCE_ALERT_PERIOD_FULL_QUERYSET))
| 32.05 | 73 | 0.728376 | 517 | 5,769 | 7.427466 | 0.129594 | 0.296615 | 0.155729 | 0.109375 | 0.818229 | 0.810938 | 0.68776 | 0.667708 | 0.597396 | 0.567708 | 0 | 0.000434 | 0.201768 | 5,769 | 179 | 74 | 32.22905 | 0.833442 | 0.007454 | 0 | 0.731544 | 0 | 0 | 0.375699 | 0.323951 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.013423 | 0 | 0.013423 | 0 | 0 | 0 | 0 | null | 1 | 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 | 4 |
1aea6e5d8e6948ec8becc4f2d642b5afabd1596e | 111 | py | Python | services/spoonacular/__init__.py | Ovakefali13/buerro | 1476f6e708f95a09a2d73f67ae8aa2cb3bb836af | [
"MIT"
] | 2 | 2020-03-26T19:20:31.000Z | 2020-03-30T13:09:07.000Z | services/spoonacular/__init__.py | Ovakefali13/buerro | 1476f6e708f95a09a2d73f67ae8aa2cb3bb836af | [
"MIT"
] | 51 | 2020-03-05T09:04:21.000Z | 2021-12-13T20:34:22.000Z | services/spoonacular/__init__.py | Ovakefali13/buerro | 1476f6e708f95a09a2d73f67ae8aa2cb3bb836af | [
"MIT"
] | null | null | null | from .spoonacular_service import (
SpoonacularJSONRemote,
SpoonacularRemote,
SpoonacularService,
)
| 18.5 | 34 | 0.765766 | 7 | 111 | 12 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.18018 | 111 | 5 | 35 | 22.2 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 1 | 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 | 4 |
21435b87eac6f76b462c7430c4a66248187034d4 | 44 | py | Python | python/ql/test/2/library-tests/ControlFlow/dominators/test.py | vadi2/codeql | a806a4f08696d241ab295a286999251b56a6860c | [
"MIT"
] | 4,036 | 2020-04-29T00:09:57.000Z | 2022-03-31T14:16:38.000Z | python/ql/test/2/library-tests/ControlFlow/dominators/test.py | vadi2/codeql | a806a4f08696d241ab295a286999251b56a6860c | [
"MIT"
] | 2,970 | 2020-04-28T17:24:18.000Z | 2022-03-31T22:40:46.000Z | python/ql/test/2/library-tests/ControlFlow/dominators/test.py | ScriptBox99/github-codeql | 2ecf0d3264db8fb4904b2056964da469372a235c | [
"MIT"
] | 794 | 2020-04-29T00:28:25.000Z | 2022-03-30T08:21:46.000Z |
def j():
raise Exception, "Exception"
| 8.8 | 32 | 0.613636 | 5 | 44 | 5.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 44 | 4 | 33 | 11 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
dcf6fa61ab2a744896e6b6e0701a4377922df3d2 | 148 | py | Python | recipes/apps.py | Panda4817/MySousChef | 64c3967566b3834d578406884ee6b4a3807b21f8 | [
"MIT"
] | 1 | 2021-02-25T17:54:28.000Z | 2021-02-25T17:54:28.000Z | recipes/apps.py | Panda4817/MySousChef | 64c3967566b3834d578406884ee6b4a3807b21f8 | [
"MIT"
] | null | null | null | recipes/apps.py | Panda4817/MySousChef | 64c3967566b3834d578406884ee6b4a3807b21f8 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class RecipesConfig(AppConfig):
name = 'recipes'
def ready(self):
import recipes.signals | 18.5 | 34 | 0.668919 | 16 | 148 | 6.1875 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.256757 | 148 | 8 | 35 | 18.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0.049296 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 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 | 1 | 0 | 0 | 4 |
dcfac24f30229dfee59a7d9935f9f0e927ab782b | 2,732 | py | Python | learning-mongodb.2nd-edition.using-php-and-python-class-code-master/Python Files/Models/HelperModel.py | PacktPublishing/Learning-Programmatic-Access-to-MongoDB | e6cb459f44616d6629962501447dc031cda166ea | [
"MIT"
] | 1 | 2021-10-05T19:45:42.000Z | 2021-10-05T19:45:42.000Z | learning-mongodb.2nd-edition.using-php-and-python-class-code-master/Python Files/Models/HelperModel.py | PacktPublishing/Learning-Programmatic-Access-to-MongoDB | e6cb459f44616d6629962501447dc031cda166ea | [
"MIT"
] | null | null | null | learning-mongodb.2nd-edition.using-php-and-python-class-code-master/Python Files/Models/HelperModel.py | PacktPublishing/Learning-Programmatic-Access-to-MongoDB | e6cb459f44616d6629962501447dc031cda166ea | [
"MIT"
] | 1 | 2021-04-22T18:17:01.000Z | 2021-04-22T18:17:01.000Z | import uuid
import bcrypt
"""
HelpModel.py
This is a python include file for various helper functions -- sometimes, I want functions to be re-usable for
more than one application, or more than Model/Module within an application - in these situations, I create a
helper file, like this one, to store these multi-use type functions.
@author mshallop@linux.com
@version 1.0
HISTORY:
========
01-06-19 mks original coding
"""
def generate_guid():
"""
generate_guid() -- helper function
This function generates a 36-character GUID (with hashes... GUIDs without hashes are 32-characters) and converts
the alpha chars to upper-case.
@author mshallop@linux.com
@version 1.0
:return: returns a 36-character GUID (with hashes) converted to upper case letters
HISTORY:
========
01-06-19 mks original coding
"""
return str(uuid.uuid4()).upper()
def hash_string(some_string):
"""
hash_string() -- helper function
This function requires a single input parameter to the method:
a string value that should be the user's password -- this is the value that will be encrypted.
The function returns the encrypted password.
@author mshallop@linux.com
@version 1.0
:param some_string: the string to be bcrypt'd-hashed
:return: returns the encrypted strung
HISTORY:
========
01-06-19 mks original coding
"""
return bcrypt.hashpw(some_string.encode(), bcrypt.gensalt())
def validate_password_length(password):
"""
validate_password_length() -- general function
This method requires one input parameter - a string containing the user's clear-text password.
The method simply validates the password based on length - the password must be more than 7 characters and less
than 16 characters to be accepted by the system.
todo -- replace the numeric constraints with self-descriptive constants
todo -- other validations (special chars, num, upper & lower-case, etc.)
@author mshallop@linux.com
@version 1.0
:param password: string value containing the user's clear-text password
:return: boolean value indicating if the password meets minimum validation requirements and, if the password failed
validation, then also return a diagnostic message.
HISTORY:
========
01-06-19 mks original coding
"""
return_value = True
return_message = None
if len(password) < 8 or len(password) > 16:
return_message = 'Password incorrect length - must be between 8 and 16 chars!'
return_value = False
return return_value, return_message
| 28.164948 | 119 | 0.67716 | 365 | 2,732 | 5.021918 | 0.419178 | 0.030551 | 0.041462 | 0.048009 | 0.214948 | 0.214948 | 0.186579 | 0.0982 | 0 | 0 | 0 | 0.023301 | 0.245974 | 2,732 | 96 | 120 | 28.458333 | 0.866505 | 0.588214 | 0 | 0 | 0 | 0 | 0.118474 | 0 | 0 | 0 | 0 | 0.020833 | 0 | 1 | 0.230769 | false | 0.230769 | 0.153846 | 0 | 0.615385 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
0d28f5e829879ad6534e5c352fb22f01d659dbc8 | 231 | py | Python | heaps/utils/depend.py | riteme/toys | abd9e76bd8b15e01d94e3ccdf638e10141042fc8 | [
"MIT"
] | 12 | 2017-10-21T16:05:01.000Z | 2021-03-08T14:08:23.000Z | heaps/utils/depend.py | riteme/toys | abd9e76bd8b15e01d94e3ccdf638e10141042fc8 | [
"MIT"
] | 1 | 2017-10-27T11:03:58.000Z | 2017-10-27T11:38:32.000Z | heaps/utils/depend.py | riteme/toys | abd9e76bd8b15e01d94e3ccdf638e10141042fc8 | [
"MIT"
] | 6 | 2018-10-20T01:17:08.000Z | 2020-08-12T15:27:03.000Z | from sys import argv
from subprocess import check_output
source = argv[2]
out = check_output(argv[1:] + ['-MM'])
_, tail = out.split(':')
print "build/"+source.replace('.cpp', '.o'), "deps/"+source.replace('.cpp', '.d'), ':', tail | 33 | 92 | 0.636364 | 33 | 231 | 4.363636 | 0.636364 | 0.152778 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009804 | 0.116883 | 231 | 7 | 92 | 33 | 0.696078 | 0 | 0 | 0 | 0 | 0 | 0.12069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 0.166667 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
0d2e3e026a587d72dc68625642c8d0d94358375e | 55 | py | Python | tests/modules/with_all.py | ZYAZP/python2 | 7dc3b62eff51e1decb4a408122e77630fdc1687d | [
"MIT"
] | 1,062 | 2015-11-18T01:04:33.000Z | 2022-03-29T07:13:30.000Z | tests/modules/with_all.py | ArrowSides/onelinerizer | 7dc3b62eff51e1decb4a408122e77630fdc1687d | [
"MIT"
] | 26 | 2015-11-17T06:58:07.000Z | 2022-01-15T18:11:16.000Z | tests/modules/with_all.py | ArrowSides/onelinerizer | 7dc3b62eff51e1decb4a408122e77630fdc1687d | [
"MIT"
] | 100 | 2015-11-17T09:01:22.000Z | 2021-09-12T13:58:28.000Z | a = 1
b = 1
c = 1
_d = 1
__e = 1
__all__ = ['a', 'b']
| 6.875 | 20 | 0.4 | 13 | 55 | 1.153846 | 0.538462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 0.363636 | 55 | 7 | 21 | 7.857143 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0.036364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
0d2f520cb08d4dc713722f44e7a1fbaad6b1a671 | 184 | py | Python | trajnetplusplustools/__init__.py | pedro-mgb/trajnetplusplustools | 1e0dbf3dc3b79d58fc617401a08385876aa05b1c | [
"MIT"
] | 35 | 2020-01-15T15:16:19.000Z | 2022-03-31T19:37:57.000Z | trajnetplusplustools/__init__.py | pedro-mgb/trajnetplusplustools | 1e0dbf3dc3b79d58fc617401a08385876aa05b1c | [
"MIT"
] | 4 | 2020-04-12T12:36:49.000Z | 2021-03-07T01:39:03.000Z | trajnetplusplustools/__init__.py | pedro-mgb/trajnetplusplustools | 1e0dbf3dc3b79d58fc617401a08385876aa05b1c | [
"MIT"
] | 22 | 2020-04-05T05:39:59.000Z | 2022-03-20T16:03:49.000Z | __version__ = '0.3.0'
from . import metrics
from .reader import Reader
from . import writers
from .data import TrackRow, SceneRow
from .dataset import load_all
from . import kalman
| 16.727273 | 36 | 0.766304 | 27 | 184 | 5.037037 | 0.555556 | 0.220588 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019608 | 0.168478 | 184 | 10 | 37 | 18.4 | 0.869281 | 0 | 0 | 0 | 0 | 0 | 0.027174 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.857143 | 0 | 0.857143 | 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 | 1 | 0 | 1 | 0 | 0 | 4 |
b4c4b06c63eb7d123eb59f0841f5b56543b76ea4 | 71 | py | Python | packages/calc/arithmetic/add.py | karan1276/learning-python | 9f0791370fbdf9e1d5b94ef874f8eb403d34c22c | [
"MIT"
] | null | null | null | packages/calc/arithmetic/add.py | karan1276/learning-python | 9f0791370fbdf9e1d5b94ef874f8eb403d34c22c | [
"MIT"
] | null | null | null | packages/calc/arithmetic/add.py | karan1276/learning-python | 9f0791370fbdf9e1d5b94ef874f8eb403d34c22c | [
"MIT"
] | null | null | null | def add(num1,num2):
ans = num1 + num2
print ans
return ans
| 14.2 | 21 | 0.591549 | 11 | 71 | 3.818182 | 0.636364 | 0.380952 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0.323944 | 71 | 4 | 22 | 17.75 | 0.791667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
b4c4bff797a98cbf480400b60e3b1e2900246044 | 520 | py | Python | tests/mocks/mock_presenter_transaction.py | ALonelyTower/BudgetApp | e040f763a5e621c4e997c7d051078ba960ba58ff | [
"MIT"
] | null | null | null | tests/mocks/mock_presenter_transaction.py | ALonelyTower/BudgetApp | e040f763a5e621c4e997c7d051078ba960ba58ff | [
"MIT"
] | null | null | null | tests/mocks/mock_presenter_transaction.py | ALonelyTower/BudgetApp | e040f763a5e621c4e997c7d051078ba960ba58ff | [
"MIT"
] | null | null | null | from presenters.presenter_transaction import TransactionPresenter
class MockTransactionPresenter(TransactionPresenter):
def __init__(self, category_presenter):
super().__init__(category_presenter)
def create_new_transaction(self, trans_view):
return super()._create_new_transactions(trans_view)
def populate_category_dropdown(self, transaction_view):
super()._populate_category_dropdown(transaction_view)
def _populate_category_dropdown(self, transaction_view):
pass
| 32.5 | 65 | 0.786538 | 53 | 520 | 7.169811 | 0.415094 | 0.126316 | 0.189474 | 0.121053 | 0.263158 | 0.263158 | 0.263158 | 0.263158 | 0 | 0 | 0 | 0 | 0.146154 | 520 | 15 | 66 | 34.666667 | 0.855856 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0.1 | 0.1 | 0.1 | 0.7 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
b4ca8632ac5fed68b9b569a8fa568f50828276a0 | 6,130 | py | Python | sugarpy/SugarCubeParserVisitor.py | Braza/sugarpy | 4c3ba3351387f36c2644d109f65307227ade129d | [
"MIT"
] | null | null | null | sugarpy/SugarCubeParserVisitor.py | Braza/sugarpy | 4c3ba3351387f36c2644d109f65307227ade129d | [
"MIT"
] | 1 | 2021-03-10T11:07:13.000Z | 2021-03-10T11:07:13.000Z | sugarpy/SugarCubeParserVisitor.py | Braza/sugarpy | 4c3ba3351387f36c2644d109f65307227ade129d | [
"MIT"
] | null | null | null | # Generated from SugarCubeParser.g4 by ANTLR 4.7.1
from antlr4 import *
if __name__ is not None and "." in __name__:
from .SugarCubeParser import SugarCubeParser
else:
from SugarCubeParser import SugarCubeParser
# This class defines a complete generic visitor for a parse tree produced by SugarCubeParser.
class SugarCubeParserVisitor(ParseTreeVisitor):
# Visit a parse tree produced by SugarCubeParser#parse.
def visitParse(self, ctx:SugarCubeParser.ParseContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#block.
def visitBlock(self, ctx:SugarCubeParser.BlockContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#statement.
def visitStatement(self, ctx:SugarCubeParser.StatementContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#backLinkMacro.
def visitBackLinkMacro(self, ctx:SugarCubeParser.BackLinkMacroContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#returnLinkMacro.
def visitReturnLinkMacro(self, ctx:SugarCubeParser.ReturnLinkMacroContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#actionsLinkMacro.
def visitActionsLinkMacro(self, ctx:SugarCubeParser.ActionsLinkMacroContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#choiceVarsMacro.
def visitChoiceVarsMacro(self, ctx:SugarCubeParser.ChoiceVarsMacroContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#link.
def visitLink(self, ctx:SugarCubeParser.LinkContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#assignment.
def visitAssignment(self, ctx:SugarCubeParser.AssignmentContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#if_stat.
def visitIf_stat(self, ctx:SugarCubeParser.If_statContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#stat_block.
def visitStat_block(self, ctx:SugarCubeParser.Stat_blockContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#notExpr.
def visitNotExpr(self, ctx:SugarCubeParser.NotExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#funcExpr.
def visitFuncExpr(self, ctx:SugarCubeParser.FuncExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#unaryMinusExpr.
def visitUnaryMinusExpr(self, ctx:SugarCubeParser.UnaryMinusExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#multiplicationExpr.
def visitMultiplicationExpr(self, ctx:SugarCubeParser.MultiplicationExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#atomExpr.
def visitAtomExpr(self, ctx:SugarCubeParser.AtomExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#atonExpr.
def visitAtonExpr(self, ctx:SugarCubeParser.AtonExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#orExpr.
def visitOrExpr(self, ctx:SugarCubeParser.OrExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#additiveExpr.
def visitAdditiveExpr(self, ctx:SugarCubeParser.AdditiveExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#relationalExpr.
def visitRelationalExpr(self, ctx:SugarCubeParser.RelationalExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#equalityExpr.
def visitEqualityExpr(self, ctx:SugarCubeParser.EqualityExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#andExpr.
def visitAndExpr(self, ctx:SugarCubeParser.AndExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#varAtom.
def visitVarAtom(self, ctx:SugarCubeParser.VarAtomContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#stringAtom.
def visitStringAtom(self, ctx:SugarCubeParser.StringAtomContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#parExpr.
def visitParExpr(self, ctx:SugarCubeParser.ParExprContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#numberAtom.
def visitNumberAtom(self, ctx:SugarCubeParser.NumberAtomContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#booleanAtom.
def visitBooleanAtom(self, ctx:SugarCubeParser.BooleanAtomContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#nilAtom.
def visitNilAtom(self, ctx:SugarCubeParser.NilAtomContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#randomFunc.
def visitRandomFunc(self, ctx:SugarCubeParser.RandomFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#arguments.
def visitArguments(self, ctx:SugarCubeParser.ArgumentsContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#linktext.
def visitLinktext(self, ctx:SugarCubeParser.LinktextContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#text.
def visitText(self, ctx:SugarCubeParser.TextContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by SugarCubeParser#log.
def visitLog(self, ctx:SugarCubeParser.LogContext):
return self.visitChildren(ctx)
del SugarCubeParser | 34.438202 | 93 | 0.756281 | 648 | 6,130 | 7.132716 | 0.208333 | 0.044137 | 0.073561 | 0.13241 | 0.478364 | 0.478364 | 0.470792 | 0.462138 | 0.462138 | 0.462138 | 0 | 0.00099 | 0.176509 | 6,130 | 178 | 94 | 34.438202 | 0.91462 | 0.331648 | 0 | 0.452055 | 1 | 0 | 0.000248 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.452055 | false | 0 | 0.041096 | 0.452055 | 0.958904 | 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 | 1 | 1 | 0 | 0 | 4 |
b4d36608bf298f8be9c2879d28258ddfeb2c502b | 383 | py | Python | static/imports.py | mindsy/mindsy-microservice-register | 44c122f30e0edd41f0c64655ba9bab27e228d8d8 | [
"MIT"
] | null | null | null | static/imports.py | mindsy/mindsy-microservice-register | 44c122f30e0edd41f0c64655ba9bab27e228d8d8 | [
"MIT"
] | 2 | 2019-04-22T15:05:48.000Z | 2019-04-27T18:43:44.000Z | static/imports.py | mindsy/mindsy-microservice-psychologist | 44c122f30e0edd41f0c64655ba9bab27e228d8d8 | [
"MIT"
] | null | null | null | from models.person import PersonModel
from models.telephone import TelephoneModel
from models.psychologist import PsychologistModel
from models.hospital import HospitalModel
from models.psychologist_hospital import PsychologistHospitalModel
from models.accountable import AccountableModel
from models.patient import PatientModel
from models.pat_psycho_hosp import PatPsychoHospModel
| 42.555556 | 66 | 0.895561 | 43 | 383 | 7.906977 | 0.465116 | 0.235294 | 0.129412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083551 | 383 | 8 | 67 | 47.875 | 0.968661 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
b4e7309e4be8356a17dc97601b894f8c4b6be557 | 134 | py | Python | robloxapi/utils/xcsrf.py | TheFutureKnight/robloxapi | b3486207654b0a81ff512d2cdb14b58d6054bb06 | [
"MIT"
] | 2 | 2020-08-05T02:53:29.000Z | 2020-12-08T15:04:29.000Z | robloxapi/utils/xcsrf.py | TheFutureKnight/robloxapi | b3486207654b0a81ff512d2cdb14b58d6054bb06 | [
"MIT"
] | 1 | 2020-01-26T15:33:57.000Z | 2020-01-26T15:33:57.000Z | robloxapi/utils/xcsrf.py | TheFutureKnight/robloxapi | b3486207654b0a81ff512d2cdb14b58d6054bb06 | [
"MIT"
] | 2 | 2020-01-26T15:16:44.000Z | 2020-12-08T15:04:31.000Z | import requests
def get_xcsrf():
r = requests.post('https://www.roblox.com/favorite/toggle').headers
return r['X-CSRF-TOKEN']
| 26.8 | 71 | 0.701493 | 20 | 134 | 4.65 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126866 | 134 | 4 | 72 | 33.5 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0.373134 | 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 | 1 | 0 | 0 | 4 |
b4f0f364a62b747591f4acff9e04c59b0d36c212 | 2,327 | py | Python | web/web_tracker/migrations/0001_initial.py | igorxxl8/Calistra | ced32a53f42a8d7a2309a1eb15acef42418a3ecb | [
"MIT"
] | null | null | null | web/web_tracker/migrations/0001_initial.py | igorxxl8/Calistra | ced32a53f42a8d7a2309a1eb15acef42418a3ecb | [
"MIT"
] | null | null | null | web/web_tracker/migrations/0001_initial.py | igorxxl8/Calistra | ced32a53f42a8d7a2309a1eb15acef42418a3ecb | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-09-03 11:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Plan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('author', models.CharField(max_length=100)),
('name', models.CharField(max_length=100)),
('time', models.CharField(max_length=30)),
('reminder', models.CharField(max_length=200)),
('key', models.CharField(max_length=10)),
],
),
migrations.CreateModel(
name='Queue',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('key', models.CharField(max_length=10)),
('owner', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='Task',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('queue', models.CharField(max_length=10)),
('description', models.CharField(max_length=200)),
('parent', models.CharField(max_length=10)),
('related', models.CharField(max_length=10)),
('author', models.CharField(max_length=100)),
('priority', models.IntegerField()),
('progress', models.IntegerField()),
('start', models.CharField(max_length=30)),
('deadline', models.CharField(max_length=30)),
('reminder', models.CharField(max_length=200)),
('status', models.CharField(max_length=10)),
('key', models.CharField(max_length=10)),
('creating_time', models.CharField(max_length=30)),
('editing_time', models.CharField(max_length=30)),
],
),
]
| 40.12069 | 114 | 0.547056 | 224 | 2,327 | 5.517857 | 0.285714 | 0.254854 | 0.305825 | 0.407767 | 0.690129 | 0.541262 | 0.340615 | 0.340615 | 0.340615 | 0.340615 | 0 | 0.041409 | 0.304684 | 2,327 | 57 | 115 | 40.824561 | 0.722497 | 0.028363 | 0 | 0.510204 | 1 | 0 | 0.076174 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.040816 | 0 | 0.122449 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
b4f2ae426c56a839f6facae56bdd4a5deefce0a7 | 269 | py | Python | src/intelliflow/core/platform/drivers/storage/local.py | amzn/rheoceros | 5e8f79d97f8b21d693d3c869b0df70de3d5fd068 | [
"Apache-2.0",
"MIT-0"
] | 4 | 2022-03-24T04:39:02.000Z | 2022-03-31T16:41:50.000Z | src/intelliflow/core/platform/drivers/storage/local.py | amzn/rheoceros | 5e8f79d97f8b21d693d3c869b0df70de3d5fd068 | [
"Apache-2.0",
"MIT-0"
] | null | null | null | src/intelliflow/core/platform/drivers/storage/local.py | amzn/rheoceros | 5e8f79d97f8b21d693d3c869b0df70de3d5fd068 | [
"Apache-2.0",
"MIT-0"
] | null | null | null | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from ...constructs import Storage
class LocalStorageImpl(Storage):
"""Storage impl to support local (dev machine) testing and experimentation"""
pass
| 24.454545 | 81 | 0.747212 | 34 | 269 | 5.911765 | 0.941176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008811 | 0.156134 | 269 | 10 | 82 | 26.9 | 0.876652 | 0.650558 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
3716a978d4e965defe98f9b6cf55deb471b93ec6 | 47 | py | Python | jobs/__init__.py | buketkonuk/pythondotorg | 4d8d9728eea7c7b2fef32eb6f24fda409cf24a06 | [
"Apache-2.0"
] | 911 | 2015-01-03T22:16:06.000Z | 2022-03-31T23:56:22.000Z | jobs/__init__.py | buketkonuk/pythondotorg | 4d8d9728eea7c7b2fef32eb6f24fda409cf24a06 | [
"Apache-2.0"
] | 1,342 | 2015-01-02T16:14:45.000Z | 2022-03-28T08:01:20.000Z | jobs/__init__.py | buketkonuk/pythondotorg | 4d8d9728eea7c7b2fef32eb6f24fda409cf24a06 | [
"Apache-2.0"
] | 551 | 2015-01-04T02:17:31.000Z | 2022-03-23T11:59:25.000Z | default_app_config = 'jobs.apps.JobsAppConfig'
| 23.5 | 46 | 0.829787 | 6 | 47 | 6.166667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06383 | 47 | 1 | 47 | 47 | 0.840909 | 0 | 0 | 0 | 0 | 0 | 0.489362 | 0.489362 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2e9a9fb6b8392f81a70eb8e649cdfb169084a292 | 207 | py | Python | models/Word.py | adtraub/isThatAWord | 3cca0c932e47917ae5e23b413799b8691cb3187d | [
"MIT"
] | 1 | 2016-09-21T18:33:06.000Z | 2016-09-21T18:33:06.000Z | models/Word.py | adtraub/isThatAWord | 3cca0c932e47917ae5e23b413799b8691cb3187d | [
"MIT"
] | 3 | 2015-04-15T02:29:29.000Z | 2015-04-21T16:34:28.000Z | models/Word.py | adtraub/isthatawordadam | 3cca0c932e47917ae5e23b413799b8691cb3187d | [
"MIT"
] | null | null | null | from google.appengine.ext import db
class Word(db.Model):
"""Simple Word Model"""
word_str = db.StringProperty(required=True)
in_scrabble = db.BooleanProperty()
in_wwf = db.BooleanProperty() | 29.571429 | 47 | 0.714976 | 27 | 207 | 5.37037 | 0.666667 | 0.234483 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164251 | 207 | 7 | 48 | 29.571429 | 0.83815 | 0.082126 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 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 | 1 | 0 | 0 | 4 |
2ebda5580a52bc9b60b6223be62dd09cdbe4d839 | 266 | py | Python | examples/try_except_pass.py | mikelolasagasti/bandit | 3dca7820158ea04668878186a29d34e81bbd7fe3 | [
"Apache-2.0"
] | 4,016 | 2018-04-26T13:01:54.000Z | 2022-03-31T15:57:41.000Z | examples/try_except_pass.py | lweslen/bandit | 2bd1ffaae1b83102af8587dcbeecd0b402dbec4e | [
"Apache-2.0"
] | 570 | 2018-04-26T10:07:41.000Z | 2022-03-29T18:55:09.000Z | examples/try_except_pass.py | lweslen/bandit | 2bd1ffaae1b83102af8587dcbeecd0b402dbec4e | [
"Apache-2.0"
] | 484 | 2018-04-26T09:59:46.000Z | 2022-03-31T18:00:50.000Z | # bad
try:
a = 1
except:
pass
# bad
try:
a = 1
except Exception:
pass
# bad
try:
a = 1
except ZeroDivisionError:
pass
except:
a = 2
# good
try:
a = 1
except:
a = 2
# silly, but ok
try:
a = 1
except:
pass
a = 2
| 7.189189 | 25 | 0.496241 | 40 | 266 | 3.3 | 0.325 | 0.151515 | 0.189394 | 0.416667 | 0.492424 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0.050955 | 0.409774 | 266 | 36 | 26 | 7.388889 | 0.789809 | 0.112782 | 0 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
2ec0a269e0cfd83370d28be75fd68a04fd4e4955 | 1,480 | py | Python | old/pepper1/src/libpepper/vals/control_flow/peprange.py | andybalaam/pepper | f0d12379c7c6e2d82003c0c1d6130bfac685e1c3 | [
"MIT"
] | 2 | 2018-12-19T16:32:46.000Z | 2019-01-10T09:00:33.000Z | old/pepper1/src/libpepper/vals/control_flow/peprange.py | andybalaam/pepper | f0d12379c7c6e2d82003c0c1d6130bfac685e1c3 | [
"MIT"
] | null | null | null | old/pepper1/src/libpepper/vals/control_flow/peprange.py | andybalaam/pepper | f0d12379c7c6e2d82003c0c1d6130bfac685e1c3 | [
"MIT"
] | null | null | null | # Copyright (C) 2012 Andy Balaam and The Pepper Developers
# Released under the MIT License. See the file COPYING.txt for details.
from libpepper.all_known import all_known
from libpepper.vals.numbers import PepInt
from libpepper.values import PepValue
class Iter( object ):
def __init__( self, peprange ):
# TODO: handle large numbers
self.index = int( peprange.begin.value )
self.end = int( peprange.end.value )
self.step = int( peprange.step.value )
def __iter__( self ):
return self
def next( self ):
# TODO: handle large numbers
if self.index >= self.end:
raise StopIteration()
ret = PepInt( str( self.index ) )
self.index += self.step
return ret
class PepRange( PepValue ):
def __init__( self, begin, end, step ):
PepValue.__init__( self )
self.begin = begin
self.end = end
self.step = step
def construction_args( self ):
return ( self.begin, self.end, self.step, )
def do_evaluate( self, env ):
return PepRange(
self.begin.evaluate( env ),
self.end.evaluate( env ),
self.step.evaluate( env )
)
def is_known( self, env ):
return all_known( ( self.begin, self.end, self.step ), env )
@staticmethod
def init( begin, end, step ):
return PepRange( begin, end, step )
def __iter__( self ):
return Iter( self )
| 26.428571 | 72 | 0.600676 | 181 | 1,480 | 4.767956 | 0.325967 | 0.048667 | 0.045191 | 0.050985 | 0.05562 | 0.05562 | 0 | 0 | 0 | 0 | 0 | 0.003884 | 0.304054 | 1,480 | 55 | 73 | 26.909091 | 0.833981 | 0.122297 | 0 | 0.054054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018182 | 0 | 1 | 0.243243 | false | 0 | 0.081081 | 0.162162 | 0.567568 | 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 | 1 | 1 | 0 | 0 | 4 |
2ed818a070235b1da88c3682751c61f7917fdd1b | 247 | py | Python | apps/core/constants.py | matheuslins/cuzjobs | 0f46402d534fefaef394ccd09b454fe361bb36f2 | [
"MIT"
] | 1 | 2018-07-10T20:30:52.000Z | 2018-07-10T20:30:52.000Z | apps/core/constants.py | matheuslins/cuscuzjobs | 0f46402d534fefaef394ccd09b454fe361bb36f2 | [
"MIT"
] | 10 | 2019-04-25T00:01:29.000Z | 2021-04-08T18:52:52.000Z | apps/core/constants.py | matheuslins/cuzjobs | 0f46402d534fefaef394ccd09b454fe361bb36f2 | [
"MIT"
] | null | null | null | REPOS_URL = 'https://api.github.com/users/{user}/repos?client_id={id}&client_secret={secret}'.format
COUNT_FILES_URL = 'https://api.github.com/search/code?q=repo:{user}/{reponame}+{lang}&client_id={client_id}&client_secret={client_secret}'.format | 82.333333 | 145 | 0.765182 | 39 | 247 | 4.615385 | 0.512821 | 0.133333 | 0.122222 | 0.188889 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024292 | 247 | 3 | 145 | 82.333333 | 0.746888 | 0 | 0 | 0 | 0 | 1 | 0.794355 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2c086605f7705ef54c9f55176bdbe20fe9a443a9 | 111 | py | Python | test.py | atakanozguryildiz/bridge | ec85e3303c05a8f24e0e0efeca13701d55034418 | [
"MIT"
] | null | null | null | test.py | atakanozguryildiz/bridge | ec85e3303c05a8f24e0e0efeca13701d55034418 | [
"MIT"
] | null | null | null | test.py | atakanozguryildiz/bridge | ec85e3303c05a8f24e0e0efeca13701d55034418 | [
"MIT"
] | null | null | null | import bridge
import unittest
class BridgeTestCase(unittest.TestCase):
def testDaysBetweenDates(self):
| 12.333333 | 40 | 0.792793 | 11 | 111 | 8 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144144 | 111 | 8 | 41 | 13.875 | 0.926316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.5 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
2c1f05c0cf64d6e581d09d86262a74fbe0e29391 | 218 | py | Python | config_loader.py | senjianlu/dmarket-trading-bot | 0a4193662b2041f46bfea24250930e77f3a506b1 | [
"MIT"
] | null | null | null | config_loader.py | senjianlu/dmarket-trading-bot | 0a4193662b2041f46bfea24250930e77f3a506b1 | [
"MIT"
] | null | null | null | config_loader.py | senjianlu/dmarket-trading-bot | 0a4193662b2041f46bfea24250930e77f3a506b1 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
#
# @AUTHOR: Rabbir
# @FILE: /root/Github/dmarket-trading-bot/config_loader.py
# @DATE: 2020/12/29 Tue
# @TIME: 16:46:47
#
# @DESCRIPTION: 机器人配置文件读取模块
import configparser
| 16.769231 | 58 | 0.678899 | 31 | 218 | 4.741935 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078947 | 0.12844 | 218 | 12 | 59 | 18.166667 | 0.694737 | 0.816514 | 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 | 1 | 0 | 0 | 4 |
2c31f85925dde9eefd16060cc5cfe21bfa25e39a | 23 | py | Python | XTBApi/__version__.py | doruirimescu/XTBApi | 0778e6af09d1787f3bee98b858e777c92186539a | [
"MIT"
] | null | null | null | XTBApi/__version__.py | doruirimescu/XTBApi | 0778e6af09d1787f3bee98b858e777c92186539a | [
"MIT"
] | null | null | null | XTBApi/__version__.py | doruirimescu/XTBApi | 0778e6af09d1787f3bee98b858e777c92186539a | [
"MIT"
] | null | null | null | __version__ = "v1.0a9"
| 11.5 | 22 | 0.695652 | 3 | 23 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 0.130435 | 23 | 1 | 23 | 23 | 0.45 | 0 | 0 | 0 | 0 | 0 | 0.26087 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
257512dff73d1984d0dd7303dacaabf00a492364 | 72 | py | Python | src/gocept/pagelet/__init__.py | gocept/gocept.pagelet | 00c2b528e1701443a81b7246c8ac2b1aba948a54 | [
"ZPL-2.1"
] | null | null | null | src/gocept/pagelet/__init__.py | gocept/gocept.pagelet | 00c2b528e1701443a81b7246c8ac2b1aba948a54 | [
"ZPL-2.1"
] | 6 | 2021-01-27T16:42:03.000Z | 2022-01-03T21:47:15.000Z | src/gocept/pagelet/__init__.py | gocept/gocept.pagelet | 00c2b528e1701443a81b7246c8ac2b1aba948a54 | [
"ZPL-2.1"
] | null | null | null | # Copyright (c) 2007 gocept gmbh & co. kg
# See also LICENSE.txt
# $Id$
| 18 | 41 | 0.652778 | 12 | 72 | 3.916667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070175 | 0.208333 | 72 | 3 | 42 | 24 | 0.754386 | 0.902778 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 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 | 4 |
257d72cd6a8649ac8e991eac293b12669cf01d7e | 59 | py | Python | app/models/guides_schools.py | WildflowerSchools/wf-airtable-api | 963021e5108462d33efa222fedb00890e1788ad6 | [
"MIT"
] | null | null | null | app/models/guides_schools.py | WildflowerSchools/wf-airtable-api | 963021e5108462d33efa222fedb00890e1788ad6 | [
"MIT"
] | null | null | null | app/models/guides_schools.py | WildflowerSchools/wf-airtable-api | 963021e5108462d33efa222fedb00890e1788ad6 | [
"MIT"
] | null | null | null | from wf_airtable_api_schema.models.guides_schools import *
| 29.5 | 58 | 0.881356 | 9 | 59 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.067797 | 59 | 1 | 59 | 59 | 0.872727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
25bffdb1b377969d2d0abe74bec328984ac89f90 | 205 | py | Python | tests/test_logistic.py | rbturnbull/fastapp | 6f55c474b91c63ce7b968638b811fbdeb0761b97 | [
"Apache-2.0"
] | 1 | 2022-03-28T13:12:58.000Z | 2022-03-28T13:12:58.000Z | tests/test_logistic.py | rbturnbull/fastapp | 6f55c474b91c63ce7b968638b811fbdeb0761b97 | [
"Apache-2.0"
] | null | null | null | tests/test_logistic.py | rbturnbull/fastapp | 6f55c474b91c63ce7b968638b811fbdeb0761b97 | [
"Apache-2.0"
] | null | null | null | from fastapp.testing import FastAppTestCase
from fastapp.examples.logistic_regression import LogisticRegressionApp
class TestLogisticRegressionApp(FastAppTestCase):
app_class = LogisticRegressionApp
| 29.285714 | 70 | 0.873171 | 18 | 205 | 9.833333 | 0.666667 | 0.124294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092683 | 205 | 6 | 71 | 34.166667 | 0.951613 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 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 | 1 | 0 | 0 | 4 |
25c2c45846ef2ca07519c03fbc9e2e7239ed7780 | 149 | py | Python | test/__init__.py | javister/krista-backup | f8852c20afdf483e842ff22497bdd80eedc30c78 | [
"Apache-2.0"
] | 7 | 2020-07-28T06:53:02.000Z | 2022-03-18T05:23:03.000Z | test/__init__.py | javister/krista-backup | f8852c20afdf483e842ff22497bdd80eedc30c78 | [
"Apache-2.0"
] | 1 | 2020-11-25T16:13:26.000Z | 2020-11-25T16:13:26.000Z | test/__init__.py | javister/krista-backup | f8852c20afdf483e842ff22497bdd80eedc30c78 | [
"Apache-2.0"
] | 1 | 2020-07-28T13:47:09.000Z | 2020-07-28T13:47:09.000Z | # -*- encoding: utf-8 -*-
import os
current_filepath = os.path.realpath(__file__)
test_dir = os.path.dirname(current_filepath)
os.chdir(test_dir)
| 16.555556 | 45 | 0.738255 | 22 | 149 | 4.636364 | 0.636364 | 0.294118 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007576 | 0.114094 | 149 | 8 | 46 | 18.625 | 0.765152 | 0.154362 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 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 | 0 | 0 | 0 | 0 | 4 |
25d981afe4ccfd469c1324a70efae80c35b13274 | 2,468 | py | Python | PI/Events/MouseEvent.py | HotShot0901/PI | 7e6fd0f68b4222e09ea825f27709ec5b1e51e928 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"MIT-0",
"bzip2-1.0.6",
"BSD-3-Clause"
] | null | null | null | PI/Events/MouseEvent.py | HotShot0901/PI | 7e6fd0f68b4222e09ea825f27709ec5b1e51e928 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"MIT-0",
"bzip2-1.0.6",
"BSD-3-Clause"
] | null | null | null | PI/Events/MouseEvent.py | HotShot0901/PI | 7e6fd0f68b4222e09ea825f27709ec5b1e51e928 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"MIT-0",
"bzip2-1.0.6",
"BSD-3-Clause"
] | null | null | null | from .Event import Event, EventType, EventCategory
class MouseEvent(Event):
def __init__(self) -> None:
pass
@property
def CategoryFlags(self) -> int:
return EventCategory.Mouse | EventCategory.Input
class MouseButtonPressedEvent(MouseEvent):
__slots__ = "__ButtonCode"
def __init__(self, buttonCode: int) -> None:
self.__ButtonCode = buttonCode
@property
def ButtonCode(self) -> int:
return self.__ButtonCode
@property
def EventType(self) -> int:
return EventType.MouseButtonPressed
@property
def CategoryFlags(self) -> int:
return super().CategoryFlags | EventCategory.MouseButton
def ToString(self) -> str:
return "<MouseButtonPressedEvent: {}>".format(self.__ButtonCode)
class MouseButtonReleasedEvent(MouseEvent):
__slots__ = "__ButtonCode"
def __init__(self, buttonCode: int) -> None:
self.__ButtonCode = buttonCode
@property
def ButtonCode(self) -> int:
return self.__ButtonCode
@property
def EventType(self) -> int:
return EventType.MouseButtonReleased
@property
def CategoryFlags(self) -> int:
return super().CategoryFlags | EventCategory.MouseButton
def ToString(self) -> str:
return "<MouseButtonReleasedEvent: {}>".format(self.__ButtonCode)
class MouseMovedEvent(MouseEvent):
__slots__ = "__OffsetX", "__OffsetY"
def __init__(self, offsetX: int, offsetY: int) -> None:
self.__OffsetX = offsetX
self.__OffsetY = offsetY
@property
def OffsetX(self) -> int:
return self.__OffsetX
@property
def OffsetY(self) -> int:
return self.__OffsetY
@property
def EventType(self) -> int:
return EventType.MouseMoved
def ToString(self) -> str:
return "<MouseMovedEvent: {}, {}>".format(self.__OffsetX, self.__OffsetY)
class MouseScrolledEvent(MouseEvent):
__slots__ = "__OffsetX", "__OffsetY"
def __init__(self, offsetY: int, offsetX: int=0) -> None:
self.__OffsetX = offsetX
self.__OffsetY = offsetY
@property
def OffsetX(self) -> int:
return self.__OffsetX
@property
def OffsetY(self) -> int:
return self.__OffsetY
@property
def EventType(self) -> int:
return EventType.MouseScrolled
def ToString(self) -> str:
return "<MouseScrolledEvent: {}, {}>".format(self.__OffsetX, self.__OffsetY)
| 25.708333 | 84 | 0.654376 | 233 | 2,468 | 6.570815 | 0.154506 | 0.093403 | 0.110385 | 0.066623 | 0.713912 | 0.645983 | 0.621816 | 0.569562 | 0.569562 | 0.569562 | 0 | 0.000533 | 0.23987 | 2,468 | 95 | 85 | 25.978947 | 0.815565 | 0 | 0 | 0.724638 | 0 | 0 | 0.069692 | 0.020665 | 0 | 0 | 0 | 0 | 0 | 1 | 0.318841 | false | 0.014493 | 0.014493 | 0.246377 | 0.710145 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
25e043636b5d63fe6ee0134995d44ebec6afeafb | 155 | py | Python | shamir/argument_error.py | JPYamamoto/secret_sharing_shamir | b73abc7e721ad52b6b22571b0427cb72f6d9a7c2 | [
"MIT"
] | null | null | null | shamir/argument_error.py | JPYamamoto/secret_sharing_shamir | b73abc7e721ad52b6b22571b0427cb72f6d9a7c2 | [
"MIT"
] | null | null | null | shamir/argument_error.py | JPYamamoto/secret_sharing_shamir | b73abc7e721ad52b6b22571b0427cb72f6d9a7c2 | [
"MIT"
] | null | null | null | class ArgumentError(ValueError):
"""Exception raised for errors on the arguments passed to
the program from the command line.
"""
pass
| 22.142857 | 61 | 0.683871 | 19 | 155 | 5.578947 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.251613 | 155 | 6 | 62 | 25.833333 | 0.913793 | 0.574194 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
25e18a8412106432110f76e0b692112c48869849 | 143 | py | Python | third_party/rl_example/ch4/4_2_3.py | jayhenry/rlpyt | c4b4a5fe302b99751dbc440fcb75cbe5d9cc52e4 | [
"MIT"
] | 2 | 2019-10-21T17:59:46.000Z | 2020-07-24T15:42:37.000Z | third_party/rl_example/ch4/4_2_3.py | jayhenry/rlpyt | c4b4a5fe302b99751dbc440fcb75cbe5d9cc52e4 | [
"MIT"
] | null | null | null | third_party/rl_example/ch4/4_2_3.py | jayhenry/rlpyt | c4b4a5fe302b99751dbc440fcb75cbe5d9cc52e4 | [
"MIT"
] | null | null | null | import tensorflow as tf
a = tf.get_variable('a',1)
b = tf.get_variable('b',2)
c = a + b
g = tf.get_default_graph()
print g.get_operations()[-1] | 23.833333 | 28 | 0.685315 | 29 | 143 | 3.206897 | 0.551724 | 0.16129 | 0.27957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024194 | 0.132867 | 143 | 6 | 28 | 23.833333 | 0.725806 | 0 | 0 | 0 | 0 | 0 | 0.013889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.166667 | null | null | 0.166667 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
25e62222bd78e70ff6bd7696d04988de1c7ad21c | 48 | py | Python | __init__.py | Phomint/pylookdata | 3dd7581248afd6bb972970c897d1cc66998677d6 | [
"MIT"
] | null | null | null | __init__.py | Phomint/pylookdata | 3dd7581248afd6bb972970c897d1cc66998677d6 | [
"MIT"
] | null | null | null | __init__.py | Phomint/pylookdata | 3dd7581248afd6bb972970c897d1cc66998677d6 | [
"MIT"
] | null | null | null | from .handler import Config
__all__ = [Config] | 16 | 28 | 0.75 | 6 | 48 | 5.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 48 | 3 | 29 | 16 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
d30c93a09404e83488491951ea639f6221072a8a | 3,006 | py | Python | vgazer/exceptions.py | edomin/vgazer | 3ffe64f2517cbfbe0b0292bacc9fbf7391687e76 | [
"CC0-1.0"
] | 2 | 2020-10-09T13:51:04.000Z | 2020-11-11T12:29:41.000Z | vgazer/exceptions.py | edomin/vgazer | 3ffe64f2517cbfbe0b0292bacc9fbf7391687e76 | [
"CC0-1.0"
] | null | null | null | vgazer/exceptions.py | edomin/vgazer | 3ffe64f2517cbfbe0b0292bacc9fbf7391687e76 | [
"CC0-1.0"
] | null | null | null | class AlpineReleaseDataNotFound(Exception):
def __init__(self, message):
super().__init__(message)
class CommandError(Exception):
def __init__(self, message, command, errorcode):
super().__init__(message)
self.command = command
self.errorcode = errorcode
class CompatibleProjectNotFound(Exception):
def __init__(self, message):
super().__init__(message)
class DebianPackageUnavailable(Exception):
def __init__(self, message):
super().__init__(message)
class DebianReleaseDataNotFound(Exception):
def __init__(self, message):
super().__init__(message)
class DirectoryUnavailable(Exception):
def __init__(self, message):
super().__init__(message)
class DirNameEngaged(Exception):
def __init__(self, message):
super().__init__(message)
class FilenameEngaged(Exception):
def __init__(self, message):
super().__init__(message)
class FileNotFound(Exception):
def __init__(self, message):
super().__init__(message)
class GithubApiRateLimitExceeded(Exception):
def __init__(self, message):
super().__init__(message)
class InstallError(Exception):
def __init__(self, message):
super().__init__(message)
class MissingArgument(Exception):
def __init__(self, message):
super().__init__(message)
class MissingChecker(Exception):
def __init__(self, message):
super().__init__(message)
class MissingInstaller(Exception):
def __init__(self, message):
super().__init__(message)
class NoSuitableMirrors(Exception):
def __init__(self, message):
super().__init__(message)
class OsDataNotFound(Exception):
def __init__(self, message):
super().__init__(message)
class ProjectPubNotFound(Exception):
def __init__(self, message):
super().__init__(message)
class SourceforgeReleaseArchiveLost(Exception):
def __init__(self, message):
super().__init__(message)
class TarballLost(Exception):
def __init__(self, message):
super().__init__(message)
class UnknownInstaller(Exception):
def __init__(self, message):
super().__init__(message)
class UnexpectedOsType(Exception):
def __init__(self, message):
super().__init__(message)
class UnknownOs(Exception):
def __init__(self, message):
super().__init__(message)
class UnknownPlatform(Exception):
def __init__(self, message):
super().__init__(message)
class UnknownProtocol(Exception):
def __init__(self, message):
super().__init__(message)
class UnknownSoftware(Exception):
def __init__(self, message):
super().__init__(message)
class UnknownTargetArch(Exception):
def __init__(self, message):
super().__init__(message)
class UnknownVersionChecker(Exception):
def __init__(self, message):
super().__init__(message)
class VersionCheckError(Exception):
def __init__(self, message):
super().__init__(message)
| 26.368421 | 52 | 0.701597 | 288 | 3,006 | 6.545139 | 0.128472 | 0.178249 | 0.237666 | 0.297082 | 0.699204 | 0.684881 | 0.684881 | 0.684881 | 0.662069 | 0 | 0 | 0 | 0.184631 | 3,006 | 113 | 53 | 26.60177 | 0.769074 | 0 | 0 | 0.639535 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.325581 | false | 0 | 0 | 0 | 0.651163 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
d30f5c08d43f44b713860548176fe10a3383ed0a | 319 | py | Python | units/temperature/celsius.py | putridparrot/PyUnits | 4f1095c6fc0bee6ba936921c391913dbefd9307c | [
"MIT"
] | null | null | null | units/temperature/celsius.py | putridparrot/PyUnits | 4f1095c6fc0bee6ba936921c391913dbefd9307c | [
"MIT"
] | null | null | null | units/temperature/celsius.py | putridparrot/PyUnits | 4f1095c6fc0bee6ba936921c391913dbefd9307c | [
"MIT"
] | null | null | null | # <auto-generated>
# This code was generated by the UnitCodeGenerator tool
#
# Changes to this file will be lost if the code is regenerated
# </auto-generated>
def to_fahrenheit(value):
return value * 1.8 + 32.0
def to_kelvin(value):
return value + 273.15
def to_rankine(value):
return value * 9.0/5.0 + 491.67
| 22.785714 | 62 | 0.717868 | 54 | 319 | 4.185185 | 0.62963 | 0.066372 | 0.212389 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072519 | 0.178683 | 319 | 13 | 63 | 24.538462 | 0.790076 | 0.467085 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
d315e15c0fdfb66deacba7a7ad9c436b8adde0c8 | 284 | py | Python | darts/base_games/__init__.py | GabrielAmare/Darts | 182748d821b8c1838071f3b28724d0d9b095dcf9 | [
"MIT"
] | null | null | null | darts/base_games/__init__.py | GabrielAmare/Darts | 182748d821b8c1838071f3b28724d0d9b095dcf9 | [
"MIT"
] | null | null | null | darts/base_games/__init__.py | GabrielAmare/Darts | 182748d821b8c1838071f3b28724d0d9b095dcf9 | [
"MIT"
] | null | null | null | from .BaseConfig import BaseConfig
from .BaseParty import BaseParty
from .BasePlayer import BasePlayer
from .BaseScore import BaseScore
from .BooleanOption import BooleanOption
from .IntegerOption import IntegerOption
from .Option import Option
from .StringOption import StringOption
| 31.555556 | 40 | 0.859155 | 32 | 284 | 7.625 | 0.3125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112676 | 284 | 8 | 41 | 35.5 | 0.968254 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
d320d4eba0d54b310261f9b0f164cb26eadb02f5 | 44 | py | Python | dveo/__init__.py | madeddie/dveo | 8beaff0e86c09d783feb75b0c07191163a18107e | [
"MIT"
] | null | null | null | dveo/__init__.py | madeddie/dveo | 8beaff0e86c09d783feb75b0c07191163a18107e | [
"MIT"
] | 2 | 2021-03-20T00:28:51.000Z | 2021-06-14T19:21:39.000Z | dveo/__init__.py | madeddie/dveo | 8beaff0e86c09d783feb75b0c07191163a18107e | [
"MIT"
] | null | null | null | from dveo.api import API
__all__ = ["API"]
| 11 | 24 | 0.681818 | 7 | 44 | 3.714286 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 44 | 3 | 25 | 14.666667 | 0.722222 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
d34540dc8e48a317e679452680ffb6d149ffeead | 135 | py | Python | metanic/core/context_processors.py | LimpidTech/melody | a00b99f9b697864a078e2cb886be4d75c10458a9 | [
"BSD-3-Clause"
] | null | null | null | metanic/core/context_processors.py | LimpidTech/melody | a00b99f9b697864a078e2cb886be4d75c10458a9 | [
"BSD-3-Clause"
] | 1 | 2020-02-11T21:34:24.000Z | 2020-02-11T21:34:24.000Z | metanic/core/context_processors.py | LimpidTech/melody | a00b99f9b697864a078e2cb886be4d75c10458a9 | [
"BSD-3-Clause"
] | null | null | null | from django.conf import settings
def frontend_url(request):
return {
'frontend_url': settings.FRONTEND_URL,
}
| 16.875 | 47 | 0.651852 | 15 | 135 | 5.666667 | 0.666667 | 0.388235 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | 135 | 7 | 48 | 19.285714 | 0.858586 | 0 | 0 | 0 | 0 | 0 | 0.09375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.6 | 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 | 1 | 0 | 0 | 0 | 4 |
d36a0c07a1ab91d9853dba7d38bdd95aa33165f5 | 113 | py | Python | old_django_malliva/marketplaceAccounts/apps.py | olubiyiontheweb/malliva | b212e6b359eed54c92533f0a02afe3c0042150e2 | [
"MIT"
] | null | null | null | old_django_malliva/marketplaceAccounts/apps.py | olubiyiontheweb/malliva | b212e6b359eed54c92533f0a02afe3c0042150e2 | [
"MIT"
] | null | null | null | old_django_malliva/marketplaceAccounts/apps.py | olubiyiontheweb/malliva | b212e6b359eed54c92533f0a02afe3c0042150e2 | [
"MIT"
] | 1 | 2021-07-19T12:15:52.000Z | 2021-07-19T12:15:52.000Z | from django.apps import AppConfig
class MarketplaceaccountsConfig(AppConfig):
name = 'marketplaceAccounts'
| 18.833333 | 43 | 0.80531 | 10 | 113 | 9.1 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.132743 | 113 | 5 | 44 | 22.6 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0.168142 | 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 | 1 | 0 | 0 | 4 |
d3732068e867f4fd6f6d7667ac57301a303d5b89 | 1,222 | py | Python | fem/gui/vtk_widget/vtk_graphics/rendering/vtk_pv_trackball_pan_old2.py | mjredmond/FEMApp | dd8cc53acf80d0a1bb83ce9c89bcfd51e85c6be8 | [
"MIT"
] | 1 | 2019-08-03T21:40:26.000Z | 2019-08-03T21:40:26.000Z | fem/gui/vtk_widget/vtk_graphics/rendering/vtk_pv_trackball_pan_old2.py | mjredmond/FEMApp | dd8cc53acf80d0a1bb83ce9c89bcfd51e85c6be8 | [
"MIT"
] | null | null | null | fem/gui/vtk_widget/vtk_graphics/rendering/vtk_pv_trackball_pan_old2.py | mjredmond/FEMApp | dd8cc53acf80d0a1bb83ce9c89bcfd51e85c6be8 | [
"MIT"
] | null | null | null | from __future__ import print_function, absolute_import
import numpy as np
import vtk
from vtk_camera_manipulator import vtkCameraManipulator
np_array = np.array
np_cross = np.cross
class vtkPVTrackballPan2(vtkCameraManipulator):
def __init__(self):
vtkCameraManipulator.__init__(self)
self._interactor_style = vtk.vtkInteractorStyleTrackballCamera()
def OnMouseMove(self, x, y, ren, iren):
self._interactor_style.SetInteractor(iren)
self._interactor_style.SetCurrentRenderer(ren)
self._interactor_style.OnMouseMove()
def OnButtonDown(self, x, y, ren, iren):
self._interactor_style.SetInteractor(iren)
self._interactor_style.SetCurrentRenderer(ren)
self._interactor_style.OnMiddleButtonDown()
def OnButtonUp(self, x, y, ren, iren):
self._interactor_style.SetInteractor(iren)
self._interactor_style.SetCurrentRenderer(ren)
self._interactor_style.OnMiddleButtonUp()
def OnKeyUp(self, iren):
self._interactor_style.SetInteractor(iren)
self._interactor_style.OnKeyUp()
def OnKeyDown(self, iren):
self._interactor_style.SetInteractor(iren)
self._interactor_style.OnKeyDown() | 32.157895 | 72 | 0.738953 | 130 | 1,222 | 6.592308 | 0.276923 | 0.228705 | 0.310385 | 0.268378 | 0.525088 | 0.525088 | 0.525088 | 0.525088 | 0.525088 | 0.525088 | 0 | 0.000997 | 0.179214 | 1,222 | 38 | 73 | 32.157895 | 0.85344 | 0 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.142857 | 0 | 0.392857 | 0.035714 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
d391758d6cf96ec10fdb6f9099a8b471ed5efd9d | 34 | py | Python | tests/__init__.py | Wikia/ask-fandom | cc1d6f9b73a41c0e67b62512c8c0731d340b3015 | [
"MIT"
] | 5 | 2019-03-09T11:25:47.000Z | 2021-11-03T09:44:03.000Z | tests/__init__.py | Wikia/ask-fandom | cc1d6f9b73a41c0e67b62512c8c0731d340b3015 | [
"MIT"
] | 11 | 2019-03-08T17:58:25.000Z | 2019-03-24T10:57:26.000Z | tests/__init__.py | Wikia/ask-fandom | cc1d6f9b73a41c0e67b62512c8c0731d340b3015 | [
"MIT"
] | 1 | 2019-03-18T17:39:55.000Z | 2019-03-18T17:39:55.000Z | """
Unit tests for ask-fandom
"""
| 8.5 | 25 | 0.617647 | 5 | 34 | 4.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 34 | 3 | 26 | 11.333333 | 0.75 | 0.735294 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
6ca7379be5b40312a42e886ad6d40e4bbfe28909 | 197 | py | Python | oosc/oosc/reason/serializers.py | C4DLabOrg/da_api | 3d876576a189ce35c6b4b2f1c728f4b91e4b2ed0 | [
"MIT"
] | null | null | null | oosc/oosc/reason/serializers.py | C4DLabOrg/da_api | 3d876576a189ce35c6b4b2f1c728f4b91e4b2ed0 | [
"MIT"
] | null | null | null | oosc/oosc/reason/serializers.py | C4DLabOrg/da_api | 3d876576a189ce35c6b4b2f1c728f4b91e4b2ed0 | [
"MIT"
] | null | null | null | from oosc.reason.models import Reason
from rest_framework import serializers
class ReasonSerializer(serializers.ModelSerializer):
class Meta:
model=Reason
fields=('id','name')
| 24.625 | 52 | 0.741117 | 22 | 197 | 6.590909 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177665 | 197 | 7 | 53 | 28.142857 | 0.895062 | 0 | 0 | 0 | 0 | 0 | 0.030457 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 1 | 0 | 0 | 4 |
6cb897e8c1590e884fbb62d47eb41d0c808a8186 | 104 | py | Python | src/yammy/utils.py | xmnlab/pyge | 3c36dd399b0d75c4989e3b04c10a84bf71884949 | [
"BSD-3-Clause"
] | null | null | null | src/yammy/utils.py | xmnlab/pyge | 3c36dd399b0d75c4989e3b04c10a84bf71884949 | [
"BSD-3-Clause"
] | null | null | null | src/yammy/utils.py | xmnlab/pyge | 3c36dd399b0d75c4989e3b04c10a84bf71884949 | [
"BSD-3-Clause"
] | null | null | null | import yaml
def read_config(filepath):
with open(filepath, "r") as f:
return yaml.load(f)
| 14.857143 | 34 | 0.644231 | 16 | 104 | 4.125 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.240385 | 104 | 6 | 35 | 17.333333 | 0.835443 | 0 | 0 | 0 | 0 | 0 | 0.009615 | 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 | 1 | 0 | 0 | 4 |
6cbea4adfb452e7dfb768b3b3a074ce975ddede7 | 166 | py | Python | fltk/util/config/definitions/dataset.py | AbeleMM/fltk-testbed | 307b6f192c06a76d9e9017039596d1a96ebdadfb | [
"BSD-2-Clause"
] | null | null | null | fltk/util/config/definitions/dataset.py | AbeleMM/fltk-testbed | 307b6f192c06a76d9e9017039596d1a96ebdadfb | [
"BSD-2-Clause"
] | null | null | null | fltk/util/config/definitions/dataset.py | AbeleMM/fltk-testbed | 307b6f192c06a76d9e9017039596d1a96ebdadfb | [
"BSD-2-Clause"
] | null | null | null | from enum import unique, Enum
@unique
class Dataset(Enum):
cifar10 = 'cifar10'
cifar100 = 'cifar100'
fashion_mnist = 'fashion-mnist'
mnist = 'mnist' | 18.444444 | 35 | 0.668675 | 19 | 166 | 5.789474 | 0.526316 | 0.218182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077519 | 0.222892 | 166 | 9 | 36 | 18.444444 | 0.775194 | 0 | 0 | 0 | 0 | 0 | 0.197605 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.857143 | 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 | 1 | 0 | 0 | 4 |
6ce0d4c78ec4538a4001fc9d088c6304d7581f58 | 1,760 | py | Python | src/old/py4e/regex.py | smorenburg/python | 74b1e72944dfd244f0169e8a7adb9e29ed1a7d27 | [
"MIT"
] | null | null | null | src/old/py4e/regex.py | smorenburg/python | 74b1e72944dfd244f0169e8a7adb9e29ed1a7d27 | [
"MIT"
] | null | null | null | src/old/py4e/regex.py | smorenburg/python | 74b1e72944dfd244f0169e8a7adb9e29ed1a7d27 | [
"MIT"
] | null | null | null | import re
handle = open('mbox-short.txt')
for line in handle:
line = line.rstrip()
if line.find('From:') >= 0:
print(line)
handle = open('mbox-short.txt')
for line in handle:
line = line.rstrip()
if re.search(r'From:', line):
print(line)
handle = open('mbox-short.txt')
for line in handle:
line = line.rstrip()
if line.startswith('From:'):
print(line)
handle = open('mbox-short.txt')
for line in handle:
line = line.rstrip()
if re.search(r'^From:', line):
print(line)
handle = open('mbox-short.txt')
for line in handle:
line = line.rstrip()
if re.search(r'^X.*:', line):
print(line)
handle = open('mbox-short.txt')
for line in handle:
line = line.rstrip()
if re.search(r'^X-\S+:', line):
print(line)
s = 'A message from csev@umich.edu to cwen@iupui.edu about meeting @2PM'
lst = re.findall(r'\S+@\S+', s)
print(lst)
x = 'My 2 favorite numbers are 19 and 42'
y = re.findall(r'[0-9]+', x)
print(y)
y = re.findall(r'[AEIOU]+', x)
print(y)
x = 'From: Using the : character'
y = re.findall(r'^F.+:', x)
print(y)
x = 'From: Using the : character'
y = re.findall(r'^F.+?:', x)
print(y)
handle = open('mbox-short.txt')
content = handle.read()
handle.close()
matches = re.findall(r'From (\S+@\S+)', content)
print(matches)
handle = open('mbox-short.txt')
content = handle.read()
handle.close()
matches = re.findall(r'^From .*@([^ ]*)', content)
print(matches)
handle = open('mbox-short.txt')
numlist = list()
for line in handle:
line = line.rstrip()
matches = re.findall(r'^X-DSPAM-Confidence: ([0-9.]+)', line)
if len(matches) != 1:
continue
num = float(matches[0])
numlist.append(num)
print('Maximum:', max(numlist))
| 19.130435 | 72 | 0.604545 | 273 | 1,760 | 3.897436 | 0.238095 | 0.084586 | 0.118421 | 0.160714 | 0.703947 | 0.703947 | 0.703947 | 0.676692 | 0.620301 | 0.620301 | 0 | 0.009233 | 0.2 | 1,760 | 91 | 73 | 19.340659 | 0.746449 | 0 | 0 | 0.630769 | 0 | 0 | 0.235227 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.015385 | 0 | 0.015385 | 0.215385 | 0 | 0 | 0 | null | 0 | 0 | 1 | 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 | 4 |
9f438946866fef14d1eb0ed6c5f6199f572b35eb | 76 | py | Python | pyphony/parser/__init__.py | ynop/pyphony | bc63e3c4a69c2f82cd02019a155c5838136d999b | [
"MIT"
] | null | null | null | pyphony/parser/__init__.py | ynop/pyphony | bc63e3c4a69c2f82cd02019a155c5838136d999b | [
"MIT"
] | null | null | null | pyphony/parser/__init__.py | ynop/pyphony | bc63e3c4a69c2f82cd02019a155c5838136d999b | [
"MIT"
] | null | null | null | """
Contains classes to parse/crawl specific source for pronunciations.
"""
| 19 | 67 | 0.763158 | 9 | 76 | 6.444444 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131579 | 76 | 3 | 68 | 25.333333 | 0.878788 | 0.881579 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 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 | 4 |
9f5075a1ea2f927759d0094e463d7cccc02fabc5 | 1,090 | py | Python | skdecide/builders/discrete_optimization/generic_tools/policy_sk.py | galleon/bug-free-invention | 37bcea112da39d1390ff2b30951b36ee5dbc0e6d | [
"MIT"
] | null | null | null | skdecide/builders/discrete_optimization/generic_tools/policy_sk.py | galleon/bug-free-invention | 37bcea112da39d1390ff2b30951b36ee5dbc0e6d | [
"MIT"
] | null | null | null | skdecide/builders/discrete_optimization/generic_tools/policy_sk.py | galleon/bug-free-invention | 37bcea112da39d1390ff2b30951b36ee5dbc0e6d | [
"MIT"
] | null | null | null | from skdecide.builders.solver.policy import DeterministicPolicies
from skdecide import Domain
from skdecide.domains import SingleAgent, Sequential, EnumerableTransitions,\
Actions, Goals, Markovian, FullyObservable, PositiveCosts, GoalMDPDomain, DeterministicInitialized
from typing import Dict
class D(Domain, SingleAgent, Sequential, EnumerableTransitions, Actions,
Goals, Markovian, FullyObservable,
PositiveCosts, DeterministicInitialized):
pass
class LookUpPolicy(DeterministicPolicies):
""" A solver which is initialized with a stochastic policy but provides
interfaces for deterministic policies.
"""
T_domain = D
def __init__(self, policy_dict):
self.policy_dict = policy_dict
def reset(self):
pass
def _get_next_action(self, observation: D.T_agent[D.T_observation]) -> D.T_agent[D.T_concurrency[D.T_event]]:
return self.policy_dict.get(observation, None)
def _is_policy_defined_for(self, observation: D.T_agent[D.T_observation]) -> bool:
return observation in self.policy_dict
| 35.16129 | 113 | 0.750459 | 125 | 1,090 | 6.352 | 0.432 | 0.017632 | 0.070529 | 0.06801 | 0.328715 | 0.328715 | 0.31738 | 0.31738 | 0 | 0 | 0 | 0 | 0.175229 | 1,090 | 30 | 114 | 36.333333 | 0.883204 | 0.097248 | 0 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0.105263 | 0.210526 | 0.105263 | 0.684211 | 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 | 1 | 1 | 0 | 0 | 4 |
9f50e18be9429008b6dc2fc519c1ec5c5ca8ffa0 | 141 | py | Python | isoenum/exceptions.py | MoseleyBioinformaticsLab/isoenum | 45164438142ecdde08ffb8cb15d0b3fd3c14f78f | [
"BSD-3-Clause-Clear"
] | 3 | 2019-04-08T14:40:05.000Z | 2021-04-21T12:58:31.000Z | isoenum/exceptions.py | MoseleyBioinformaticsLab/isoenum | 45164438142ecdde08ffb8cb15d0b3fd3c14f78f | [
"BSD-3-Clause-Clear"
] | null | null | null | isoenum/exceptions.py | MoseleyBioinformaticsLab/isoenum | 45164438142ecdde08ffb8cb15d0b3fd3c14f78f | [
"BSD-3-Clause-Clear"
] | null | null | null | """
isoenum.exceptions
~~~~~~~~~~~~~~~~~~
Custom exceptions.
"""
class EmptyCTFileError(Exception):
"""Invalid CTFile object error."""
| 14.1 | 38 | 0.617021 | 11 | 141 | 7.909091 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12766 | 141 | 9 | 39 | 15.666667 | 0.707317 | 0.609929 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
9f549dcfcda9b48cecabdc0d58374d4605097282 | 308 | py | Python | Day04/closure02.py | DongHenry/Py71 | 6e06cc4cda62daecba34ffbea4a8f03590a9098f | [
"MIT"
] | null | null | null | Day04/closure02.py | DongHenry/Py71 | 6e06cc4cda62daecba34ffbea4a8f03590a9098f | [
"MIT"
] | null | null | null | Day04/closure02.py | DongHenry/Py71 | 6e06cc4cda62daecba34ffbea4a8f03590a9098f | [
"MIT"
] | null | null | null | def counter(FIRST=0):
cnt = [FIRST]
def add_one():
cnt[0] += 1
return cnt[0]
return add_one
num5 = counter(5)
num28 = counter(28)
print(num5())
print(num5())
print(num5())
print(num5())
print(num28())
print(num28())
print(num28())
print(num28())
print(num28())
print(num28())
| 13.391304 | 21 | 0.597403 | 44 | 308 | 4.136364 | 0.318182 | 0.32967 | 0.412088 | 0.549451 | 0.527473 | 0.527473 | 0.527473 | 0.32967 | 0.32967 | 0.32967 | 0 | 0.105691 | 0.201299 | 308 | 22 | 22 | 14 | 0.634146 | 0 | 0 | 0.555556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0 | 0.222222 | 0.555556 | 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 | 1 | 0 | 4 |
9f604221100a0505c75dc47ddaf0c2aa05ea00a6 | 1,332 | py | Python | ekohms/views.py | samsonosiomwan/Hotels-Management-System | d37bc13faafd2cfc2f0ad4cbe56bc83b64eded36 | [
"MIT"
] | null | null | null | ekohms/views.py | samsonosiomwan/Hotels-Management-System | d37bc13faafd2cfc2f0ad4cbe56bc83b64eded36 | [
"MIT"
] | null | null | null | ekohms/views.py | samsonosiomwan/Hotels-Management-System | d37bc13faafd2cfc2f0ad4cbe56bc83b64eded36 | [
"MIT"
] | null | null | null | from django.shortcuts import get_object_or_404, render
from .models import *
from django.urls import reverse
# Create your views here.
room_types = RoomType.objects.all()
room=Room.objects.all()
room_status=RoomStatus.objects.all()
context = {'rooms': room_types,'room_status':room_status,'room_no':room}
def index(request):
return render(request, 'ekohms/index.html', context)
def rooms(request):
return render(request, 'ekohms/rooms.html', context)
def contact(request):
return render(request, 'ekohms/contact.html')
def about(request):
context = {'title': 'About',
'info': 'A fairy tale where your wishes come true'}
return render(request, 'ekohms/about.html', context)
def rooms_detailed_view(request, room_id):
room_detail = get_object_or_404(RoomType, pk=room_id)
return render(request, 'ekohms/rooms_views.html',{'room': room_detail,'rooms': room_types,'room_no':room})
def booking(request,room_id):
room_detail = get_object_or_404(RoomType, pk=room_id)
return render(request, 'ekohms/booking.html',{'room': room_detail,'rooms': room_types,'room_no':room})
def payment(request,room_id):
room_detail = get_object_or_404(RoomType, pk=room_id)
return render(request, 'ekohms/payment.html',{'room': room_detail,'rooms': room_types,'room_no':room})
| 28.340426 | 110 | 0.728979 | 190 | 1,332 | 4.905263 | 0.263158 | 0.090129 | 0.142704 | 0.187768 | 0.506438 | 0.392704 | 0.392704 | 0.392704 | 0.392704 | 0.392704 | 0 | 0.010399 | 0.133634 | 1,332 | 46 | 111 | 28.956522 | 0.797227 | 0.017267 | 0 | 0.115385 | 0 | 0 | 0.196169 | 0.017625 | 0 | 0 | 0 | 0 | 0 | 1 | 0.269231 | false | 0 | 0.115385 | 0.115385 | 0.653846 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
9f76054c6031704fab9fb508c4edf18f021cf433 | 170 | py | Python | pyearth/__init__.py | ktanishqk/py-earth | 1d8b7f76d4af873cce03772daace2254a9313871 | [
"BSD-3-Clause"
] | 360 | 2016-03-30T23:44:51.000Z | 2022-03-26T07:54:29.000Z | pyearth/__init__.py | ktanishqk/py-earth | 1d8b7f76d4af873cce03772daace2254a9313871 | [
"BSD-3-Clause"
] | 129 | 2016-03-24T21:21:01.000Z | 2022-01-01T17:35:11.000Z | pyearth/__init__.py | ktanishqk/py-earth | 1d8b7f76d4af873cce03772daace2254a9313871 | [
"BSD-3-Clause"
] | 92 | 2016-04-01T04:43:11.000Z | 2022-03-16T06:37:28.000Z | '''
Created on Feb 16, 2013
@author: jasonrudy
'''
from .earth import Earth
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
| 15.454545 | 39 | 0.752941 | 23 | 170 | 5.217391 | 0.608696 | 0.275 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041096 | 0.141176 | 170 | 10 | 40 | 17 | 0.780822 | 0.252941 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
9f82d651a832b47ad2a9a96086ef677d365a5d94 | 1,425 | py | Python | MyAwsomeCart/mac/shop/migrations/0003_contact_orders.py | rohitagrawal2299/E-Commerce | 84c4e33d07993c95a8ecab51d9704bb4532ad02d | [
"MIT"
] | null | null | null | MyAwsomeCart/mac/shop/migrations/0003_contact_orders.py | rohitagrawal2299/E-Commerce | 84c4e33d07993c95a8ecab51d9704bb4532ad02d | [
"MIT"
] | null | null | null | MyAwsomeCart/mac/shop/migrations/0003_contact_orders.py | rohitagrawal2299/E-Commerce | 84c4e33d07993c95a8ecab51d9704bb4532ad02d | [
"MIT"
] | null | null | null | # Generated by Django 3.0 on 2019-12-23 14:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0002_auto_20191217_2308'),
]
operations = [
migrations.CreateModel(
name='Contact',
fields=[
('msg_id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=50)),
('email', models.CharField(default='', max_length=70)),
('phone', models.CharField(default='', max_length=70)),
('desc', models.CharField(default='', max_length=500)),
],
),
migrations.CreateModel(
name='Orders',
fields=[
('order_id', models.AutoField(primary_key=True, serialize=False)),
('items_json', models.CharField(max_length=5000)),
('name', models.CharField(max_length=90)),
('email', models.CharField(max_length=111)),
('address', models.CharField(max_length=111)),
('city', models.CharField(max_length=111)),
('state', models.CharField(max_length=111)),
('zip_code', models.CharField(max_length=111)),
('phone', models.CharField(default='', max_length=111)),
],
),
]
| 37.5 | 83 | 0.528421 | 134 | 1,425 | 5.462687 | 0.440299 | 0.245902 | 0.196721 | 0.262295 | 0.572404 | 0.269126 | 0.122951 | 0.122951 | 0 | 0 | 0 | 0.065489 | 0.324912 | 1,425 | 37 | 84 | 38.513514 | 0.695426 | 0.030175 | 0 | 0.258065 | 1 | 0 | 0.089352 | 0.017126 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.032258 | 0 | 0.129032 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
9fba802d1489d74cb90e4aec600d161440cb6216 | 52 | py | Python | conftest.py | natsuite/NatMLX-Py | 3bb7785d9b49cf488e633649187bdd183c1a9ebd | [
"Apache-2.0"
] | null | null | null | conftest.py | natsuite/NatMLX-Py | 3bb7785d9b49cf488e633649187bdd183c1a9ebd | [
"Apache-2.0"
] | null | null | null | conftest.py | natsuite/NatMLX-Py | 3bb7785d9b49cf488e633649187bdd183c1a9ebd | [
"Apache-2.0"
] | null | null | null | #
# NatMLX
# Copyright (c) 2021 Yusuf Olokoba.
# | 13 | 37 | 0.615385 | 6 | 52 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102564 | 0.25 | 52 | 4 | 38 | 13 | 0.717949 | 0.807692 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 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 | 4 |
4c8769dee29dd23d567e2770dedb5934b4ef4a29 | 300 | py | Python | ex2.py | KhaingNyoThein/python-exercises | 60fa59230a638619e0d9655fea2911563749562e | [
"MIT"
] | null | null | null | ex2.py | KhaingNyoThein/python-exercises | 60fa59230a638619e0d9655fea2911563749562e | [
"MIT"
] | null | null | null | ex2.py | KhaingNyoThein/python-exercises | 60fa59230a638619e0d9655fea2911563749562e | [
"MIT"
] | null | null | null | # A comment, this is so you can read ypur program later.
#Anything after the # is ignored by python.
print ("I could have code like this.") # and the comment after is ignored
#You can also use a comment to "disable" or comment out a piece of code:
#print ("This won"t run.")
print ("This will run.")
| 42.857143 | 73 | 0.716667 | 55 | 300 | 3.909091 | 0.654545 | 0.074419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19 | 300 | 6 | 74 | 50 | 0.884774 | 0.746667 | 0 | 0 | 0 | 0 | 0.608696 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
4cd16d076686170cde4c6e57e1d48f6d1bbe8fa5 | 183 | py | Python | exterminate/AltRange.py | adtac/exterminate | dc4bc76004b610b57b1b3e783d9efc97a2b3a294 | [
"MIT"
] | 194 | 2017-03-10T20:35:35.000Z | 2022-02-28T05:46:17.000Z | exterminate/AltRange.py | adtac/exterminate | dc4bc76004b610b57b1b3e783d9efc97a2b3a294 | [
"MIT"
] | 7 | 2017-03-10T19:56:45.000Z | 2017-08-25T19:52:51.000Z | exterminate/AltRange.py | adtac/destruction | dc4bc76004b610b57b1b3e783d9efc97a2b3a294 | [
"MIT"
] | 10 | 2017-01-25T04:59:25.000Z | 2017-03-08T20:18:11.000Z | from exterminate.Utilities import builtins
_range = range
def alt_range(start, stop, step=1):
return _range(start-2, stop+2, max(1, int(step/2)))
builtins.range = alt_range
| 15.25 | 55 | 0.721311 | 29 | 183 | 4.413793 | 0.551724 | 0.203125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032468 | 0.15847 | 183 | 11 | 56 | 16.636364 | 0.798701 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.6 | 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 | 1 | 1 | 0 | 0 | 4 |
4cd3a0c22c8139a13677b2486aac43f27acffc4b | 88 | py | Python | solutions/4_Using_ITK_in_Python_real_world_filters_mean.py | vicory/CourseInBiomedicalImageAnalysisVisualizationAndArtificialIntelligence | ed848e8d7cb781019adb453660535f184f2a15d6 | [
"Apache-2.0"
] | 13 | 2019-03-17T04:34:21.000Z | 2022-02-06T06:58:19.000Z | solutions/4_Using_ITK_in_Python_real_world_filters_mean.py | vicory/CourseInBiomedicalImageAnalysisVisualizationAndArtificialIntelligence | ed848e8d7cb781019adb453660535f184f2a15d6 | [
"Apache-2.0"
] | 27 | 2019-03-01T14:39:38.000Z | 2019-07-30T04:44:48.000Z | solutions/4_Using_ITK_in_Python_real_world_filters_mean.py | vicory/CourseInBiomedicalImageAnalysisVisualizationAndArtificialIntelligence | ed848e8d7cb781019adb453660535f184f2a15d6 | [
"Apache-2.0"
] | 7 | 2019-03-01T19:14:05.000Z | 2020-11-05T09:43:20.000Z | mean_filtered_image = itk.mean_image_filter(image, radius = 5)
view(mean_filtered_image) | 44 | 62 | 0.840909 | 14 | 88 | 4.857143 | 0.571429 | 0.352941 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012195 | 0.068182 | 88 | 2 | 63 | 44 | 0.817073 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 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 | 0 | 0 | 0 | 0 | 4 |
4cded37011ac41bf1a98c848065a9041d01160d5 | 242 | py | Python | tests/test_utils.py | andniz/temperature-controller | 7b92032ae8ff3f257681cd7474c834011f0e72fb | [
"MIT"
] | null | null | null | tests/test_utils.py | andniz/temperature-controller | 7b92032ae8ff3f257681cd7474c834011f0e72fb | [
"MIT"
] | null | null | null | tests/test_utils.py | andniz/temperature-controller | 7b92032ae8ff3f257681cd7474c834011f0e72fb | [
"MIT"
] | null | null | null | from decimal import Decimal
from temperature_controller.utils import read_temperature
class TestReadTemperature:
def test_read_temperature(self):
temperature = read_temperature()
assert temperature == Decimal('20.375')
| 24.2 | 57 | 0.764463 | 26 | 242 | 6.923077 | 0.576923 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025 | 0.173554 | 242 | 9 | 58 | 26.888889 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0.024793 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
9812a22fb802066e9c60641bebf8c5665d00c67a | 463 | py | Python | ansiblediscover/entity/tasklist.py | uSpike/ansible-discover | 74ed24d01bf305f45d0bb3485846291d8b3ca473 | [
"MIT"
] | null | null | null | ansiblediscover/entity/tasklist.py | uSpike/ansible-discover | 74ed24d01bf305f45d0bb3485846291d8b3ca473 | [
"MIT"
] | null | null | null | ansiblediscover/entity/tasklist.py | uSpike/ansible-discover | 74ed24d01bf305f45d0bb3485846291d8b3ca473 | [
"MIT"
] | null | null | null | import os
from ansiblediscover.entity import EntityFactoryABC
class Tasklist:
pass
class TasklistFactory(EntityFactoryABC):
def __init__(self, path: str):
self._path = path
@property
def path(self):
return self._path
@property
def name(self) -> str:
return os.path.basename(self.path)
@property
def typestring(self) -> str:
return 'tasklist'
def build(self) -> 'Tasklist':
pass
| 16.535714 | 51 | 0.632829 | 51 | 463 | 5.627451 | 0.411765 | 0.111498 | 0.156794 | 0.132404 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.274298 | 463 | 27 | 52 | 17.148148 | 0.854167 | 0 | 0 | 0.277778 | 0 | 0 | 0.034557 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0.111111 | 0.111111 | 0.166667 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 4 |
e21b6fe1059fa591791f513e1821e9adabe2260e | 61 | py | Python | business/products/__init__.py | daniel-waruo/e-commerse-api | 6b080039398fb4099a34335317d649dd67783f63 | [
"Apache-2.0"
] | 6 | 2019-11-21T10:09:49.000Z | 2021-06-19T09:52:59.000Z | business/products/__init__.py | daniel-waruo/e-commerse-api | 6b080039398fb4099a34335317d649dd67783f63 | [
"Apache-2.0"
] | null | null | null | business/products/__init__.py | daniel-waruo/e-commerse-api | 6b080039398fb4099a34335317d649dd67783f63 | [
"Apache-2.0"
] | null | null | null | default_app_config = 'business.products.apps.ProductsConfig'
| 30.5 | 60 | 0.852459 | 7 | 61 | 7.142857 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04918 | 61 | 1 | 61 | 61 | 0.862069 | 0 | 0 | 0 | 0 | 0 | 0.606557 | 0.606557 | 0 | 0 | 0 | 0 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e21c94be24cf016cc89371e9a500635af37ba550 | 1,734 | py | Python | touchdown/tests/test_utils.py | yaybu/touchdown | 70ecda5191ce2d095bc074dcb23bfa1584464814 | [
"Apache-2.0"
] | 14 | 2015-01-05T18:18:04.000Z | 2022-02-07T19:35:12.000Z | touchdown/tests/test_utils.py | yaybu/touchdown | 70ecda5191ce2d095bc074dcb23bfa1584464814 | [
"Apache-2.0"
] | 106 | 2015-01-06T00:17:13.000Z | 2019-09-07T00:35:32.000Z | touchdown/tests/test_utils.py | yaybu/touchdown | 70ecda5191ce2d095bc074dcb23bfa1584464814 | [
"Apache-2.0"
] | 5 | 2015-01-30T10:18:24.000Z | 2022-02-07T19:35:13.000Z | # Copyright 2014 Isotoma Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
from touchdown.core.utils import force_bytes, force_str, force_unicode
class TestStringHelpers(unittest.TestCase):
def test_str_str(self):
self.assertEqual(force_str("foo"), "foo")
def test_str_u(self):
self.assertEqual(force_str(u"foo"), "foo")
def test_str_b(self):
self.assertEqual(force_str(b"foo"), "foo")
def test_str_exception(self):
self.assertRaises(ValueError, force_str, [])
def test_unicode_str(self):
self.assertEqual(force_unicode("foo"), u"foo")
def test_unicode_u(self):
self.assertEqual(force_unicode(u"foo"), u"foo")
def test_unicode_b(self):
self.assertEqual(force_unicode(b"foo"), u"foo")
def test_unicode_exception(self):
self.assertRaises(ValueError, force_unicode, [])
def test_bytes_str(self):
self.assertEqual(force_bytes("foo"), b"foo")
def test_bytes_u(self):
self.assertEqual(force_bytes(u"foo"), b"foo")
def test_bytes_b(self):
self.assertEqual(force_bytes(b"foo"), b"foo")
def test_bytes_exception(self):
self.assertRaises(ValueError, force_bytes, [])
| 30.964286 | 74 | 0.706459 | 248 | 1,734 | 4.782258 | 0.346774 | 0.070826 | 0.144182 | 0.182125 | 0.485666 | 0.212479 | 0 | 0 | 0 | 0 | 0 | 0.005646 | 0.182814 | 1,734 | 55 | 75 | 31.527273 | 0.831334 | 0.317186 | 0 | 0 | 0 | 0 | 0.046154 | 0 | 0 | 0 | 0 | 0 | 0.444444 | 1 | 0.444444 | false | 0 | 0.074074 | 0 | 0.555556 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
e23fa02784984bdc0417835e414f3845671cfbfb | 91 | py | Python | blue_st_sdk/features/standard_characteristics/__init__.py | cchangeur/BlueSTSDK_Python | e5c6e4bc5a58680bad0d867633dd9d92012b9baf | [
"BSD-3-Clause"
] | 43 | 2019-03-08T08:03:19.000Z | 2022-01-20T11:51:11.000Z | blue_st_sdk/features/standard_characteristics/__init__.py | cchangeur/BlueSTSDK_Python | e5c6e4bc5a58680bad0d867633dd9d92012b9baf | [
"BSD-3-Clause"
] | 24 | 2019-04-01T20:50:40.000Z | 2022-03-16T17:00:54.000Z | blue_st_sdk/features/standard_characteristics/__init__.py | cchangeur/BlueSTSDK_Python | e5c6e4bc5a58680bad0d867633dd9d92012b9baf | [
"BSD-3-Clause"
] | 19 | 2019-02-20T08:41:20.000Z | 2021-11-21T11:39:50.000Z | __all__ = [
'feature_heart_rate', \
'standard_characteristic_to_feature_map'
]
| 18.2 | 45 | 0.692308 | 9 | 91 | 5.888889 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208791 | 91 | 4 | 46 | 22.75 | 0.736111 | 0 | 0 | 0 | 0 | 0 | 0.643678 | 0.436782 | 0 | 0 | 0 | 0 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e240998762f35228a0ec572a2aafc3753eb9377c | 206 | py | Python | example/examplewebsite/examplewebsite/views.py | Correct-Syntax/Keep-Sabbath | 90d981b7e2c01c7ed8feaf4ab1213730fe87677e | [
"BSD-3-Clause"
] | 3 | 2021-08-31T17:47:17.000Z | 2021-08-31T20:26:47.000Z | example/examplewebsite/examplewebsite/views.py | Correct-Syntax/Keep-Sabbath | 90d981b7e2c01c7ed8feaf4ab1213730fe87677e | [
"BSD-3-Clause"
] | null | null | null | example/examplewebsite/examplewebsite/views.py | Correct-Syntax/Keep-Sabbath | 90d981b7e2c01c7ed8feaf4ab1213730fe87677e | [
"BSD-3-Clause"
] | null | null | null | from django.shortcuts import render
from keep_sabbath import redirect_if_sabbath
@redirect_if_sabbath
def home_page_view(request):
context = {}
return render(request, "home.html", context)
| 12.875 | 48 | 0.757282 | 27 | 206 | 5.518519 | 0.62963 | 0.134228 | 0.228188 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169903 | 206 | 15 | 49 | 13.733333 | 0.871345 | 0 | 0 | 0 | 0 | 0 | 0.045 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
e2611e82a3770f12895be1b3abf8656725b6d860 | 461 | py | Python | igneous/__init__.py | igneous-systems/python-igneous | 61f5d3c4c242e8d23f9de545a2778f1a9330dd7d | [
"Apache-2.0"
] | null | null | null | igneous/__init__.py | igneous-systems/python-igneous | 61f5d3c4c242e8d23f9de545a2778f1a9330dd7d | [
"Apache-2.0"
] | null | null | null | igneous/__init__.py | igneous-systems/python-igneous | 61f5d3c4c242e8d23f9de545a2778f1a9330dd7d | [
"Apache-2.0"
] | null | null | null | """
The Rubrik NAS Cloud Direct API Client SDK
This is the Python client library for Igneous' APIs.
Please refer to the Igneous API documentation at https://kb.igneous.io/docs for an introduction ;
For examples on how to use this SDK, see examples under `igneous/examples`, and also
`tools/ig.py` , a command line tool for interacting with NCD' APIs,
written with this very `igneous` package
"""
from .client import Client
from .util import pretty_format
| 27.117647 | 97 | 0.765727 | 75 | 461 | 4.693333 | 0.693333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167028 | 461 | 16 | 98 | 28.8125 | 0.916667 | 0.845987 | 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 | 1 | 0 | 0 | 4 |
2c4f063d3afd3ac6c4a15b7ab101452b2e912d7e | 16,718 | py | Python | unittest_binance_manager.py | Snufkin0866/unicorn-binance-websocket-api | 428f5d9b92882f14e832aeafcd3b8cf9e2d6692d | [
"MIT"
] | 1 | 2021-04-12T00:26:40.000Z | 2021-04-12T00:26:40.000Z | unittest_binance_manager.py | Snufkin0866/unicorn-binance-websocket-api | 428f5d9b92882f14e832aeafcd3b8cf9e2d6692d | [
"MIT"
] | null | null | null | unittest_binance_manager.py | Snufkin0866/unicorn-binance-websocket-api | 428f5d9b92882f14e832aeafcd3b8cf9e2d6692d | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: unittest_binance_manager.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api
# PyPI: https://pypi.org/project/unicorn-binance-websocket-api/
#
# Author: Oliver Zehentleitner
# https://about.me/oliver-zehentleitner
#
# Copyright (c) 2019, Oliver Zehentleitner
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# tribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the fol-
# lowing conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from unicorn_binance_websocket_api.unicorn_binance_websocket_api_manager import BinanceWebSocketApiManager
import unittest
import uuid
BINANCE_COM_API_KEY = ""
BINANCE_COM_API_SECRET = ""
BINANCE_JE_API_KEY = ""
BINANCE_JE_API_SECRET = ""
class TestBinanceComManager(unittest.TestCase):
# Test binance.com (Binance)
def setUp(self):
self.binance_com_api_key = BINANCE_COM_API_KEY
self.binance_com_api_secret = BINANCE_COM_API_SECRET
self.binance_com_websocket_api_manager = BinanceWebSocketApiManager(exchange="binance.com")
def test_create_uri_miniticker_regular_com(self):
self.assertEqual(self.binance_com_websocket_api_manager.create_websocket_uri(["!miniTicker"], ["arr"]),
'wss://stream.binance.com:9443/ws/!miniTicker@arr')
def test_create_uri_miniticker_reverse_com(self):
self.assertEqual(self.binance_com_websocket_api_manager.create_websocket_uri(["arr"], ["!miniTicker"]),
'wss://stream.binance.com:9443/ws/!miniTicker@arr')
def test_create_uri_ticker_regular_com(self):
self.assertEqual(self.binance_com_websocket_api_manager.create_websocket_uri(["!ticker"], ["arr"]),
'wss://stream.binance.com:9443/ws/!ticker@arr')
def test_create_uri_ticker_reverse_com(self):
self.assertEqual(self.binance_com_websocket_api_manager.create_websocket_uri(["arr"], ["!ticker"]),
'wss://stream.binance.com:9443/ws/!ticker@arr')
def test_create_uri_userdata_regular_false_com(self):
self.assertFalse(self.binance_com_websocket_api_manager.create_websocket_uri(["!userData"], ["arr"]))
def test_create_uri_userdata_reverse_false_com(self):
self.assertFalse(self.binance_com_websocket_api_manager.create_websocket_uri(["arr"], ["!userData"]))
def test_create_uri_userdata_regular_com(self):
if len(self.binance_com_api_key) == 0 or len(self.binance_com_api_secret) == 0:
print("\r\nempty API key and/or secret: can not successfully test test_create_uri_userdata_regular_com() "
"for binance.com")
stream_id = uuid.uuid4()
self.binance_com_websocket_api_manager._add_socket_to_socket_list(stream_id, ["!userData"], ["arr"])
self.assertRegex(self.binance_com_websocket_api_manager.create_websocket_uri(["!userData"], ["arr"],
stream_id,
self.binance_com_api_key,
self.binance_com_api_secret),
r'wss://stream.binance.com:9443/ws/.')
def test_create_uri_userdata_reverse_com(self):
if len(self.binance_com_api_key) == 0 or len(self.binance_com_api_secret) == 0:
print("\r\nempty API key and/or secret: can not successfully test test_create_uri_userdata_reverse_com() "
"for binance.com")
stream_id = uuid.uuid4()
self.binance_com_websocket_api_manager._add_socket_to_socket_list(stream_id, ["arr"], ["!userData"])
self.assertRegex(self.binance_com_websocket_api_manager.create_websocket_uri(["arr"], ["!userData"],
stream_id,
self.binance_com_api_key,
self.binance_com_api_secret),
r'wss://stream.binance.com:9443/ws/.')
def test_create_uri_single_com(self):
self.assertEqual(self.binance_com_websocket_api_manager.create_websocket_uri(["trade"], ["bnbbtc"]),
'wss://stream.binance.com:9443/stream?streams=bnbbtc@trade/')
def test_create_uri_multi_com(self):
self.assertEqual(self.binance_com_websocket_api_manager.create_websocket_uri(['trade', 'kline_1h'],
['bnbbtc', 'ethbtc']),
'wss://stream.binance.com:9443/stream?streams=bnbbtc@trade/ethbtc@trade/'
'bnbbtc@kline_1h/ethbtc@kline_1h/')
def test_create_uri_multi_with_ticker_com(self):
self.assertFalse(self.binance_com_websocket_api_manager.create_websocket_uri(['trade', 'kline_1h', '!ticker'],
['bnbbtc', 'ethbtc']))
def tearDown(self):
self.binance_com_websocket_api_manager.stop_manager_with_all_streams()
class TestBinanceJeManager(unittest.TestCase):
# Test binance.je (Binance Jersey)
def setUp(self):
self.binance_je_api_key = BINANCE_JE_API_KEY
self.binance_je_api_secret = BINANCE_JE_API_SECRET
self.binance_je_websocket_api_manager = BinanceWebSocketApiManager(exchange="binance.je")
def test_create_uri_miniticker_regular_je(self):
self.assertEqual(self.binance_je_websocket_api_manager.create_websocket_uri(["!miniTicker"], ["arr"]),
'wss://stream.binance.je:9443/ws/!miniTicker@arr')
def test_create_uri_miniticker_reverse_je(self):
self.assertEqual(self.binance_je_websocket_api_manager.create_websocket_uri(["arr"], ["!miniTicker"]),
'wss://stream.binance.je:9443/ws/!miniTicker@arr')
def test_create_uri_ticker_regular_je(self):
self.assertEqual(self.binance_je_websocket_api_manager.create_websocket_uri(["!ticker"], ["arr"]),
'wss://stream.binance.je:9443/ws/!ticker@arr')
def test_create_uri_ticker_reverse_je(self):
self.assertEqual(self.binance_je_websocket_api_manager.create_websocket_uri(["arr"], ["!ticker"]),
'wss://stream.binance.je:9443/ws/!ticker@arr')
def test_create_uri_userdata_regular_false_je(self):
self.assertFalse(self.binance_je_websocket_api_manager.create_websocket_uri(["!userData"], ["arr"]))
def test_create_uri_userdata_reverse_false_je(self):
self.assertFalse(self.binance_je_websocket_api_manager.create_websocket_uri(["arr"], ["!userData"]))
def test_create_uri_userdata_regular_je(self):
if len(self.binance_je_api_key) == 0 or len(self.binance_je_api_secret) == 0:
print("\r\nempty API key and/or secret: can not successfully test test_create_uri_userdata_regular_je() "
"for binance.com")
stream_id = uuid.uuid4()
self.binance_je_websocket_api_manager._add_socket_to_socket_list(stream_id, ["!userData"], ["arr"])
self.assertRegex(self.binance_je_websocket_api_manager.create_websocket_uri(["!userData"], ["arr"],
stream_id,
self.binance_je_api_key,
self.binance_je_api_secret),
r'wss://stream.binance.je:9443/ws/.')
def test_create_uri_userdata_reverse_je(self):
if len(self.binance_je_api_key) == 0 or len(self.binance_je_api_secret) == 0:
print("\r\nempty API key and/or secret: can not successfully test test_create_uri_userdata_reverse_je() "
"for binance.com")
stream_id = uuid.uuid4()
self.binance_je_websocket_api_manager._add_socket_to_socket_list(stream_id, ["arr"], ["!userData"])
self.assertRegex(self.binance_je_websocket_api_manager.create_websocket_uri(["arr"], ["!userData"],
stream_id,
self.binance_je_api_key,
self.binance_je_api_secret),
r'wss://stream.binance.je:9443/ws/.')
def test_create_uri_single_je(self):
self.assertEqual(self.binance_je_websocket_api_manager.create_websocket_uri(["trade"], ["bnbbtc"]),
'wss://stream.binance.je:9443/stream?streams=bnbbtc@trade/')
def test_create_uri_multi_je(self):
self.assertEqual(self.binance_je_websocket_api_manager.create_websocket_uri(['trade', 'kline_1h'],
['bnbbtc', 'ethbtc']),
'wss://stream.binance.je:9443/stream?streams=bnbbtc@trade/ethbtc@trade/'
'bnbbtc@kline_1h/ethbtc@kline_1h/')
def test_create_uri_multi_with_miniTicker_je(self):
self.assertFalse(self.binance_je_websocket_api_manager.create_websocket_uri(['trade', 'kline_1h', '!miniTicker'],
['bnbbtc', 'ethbtc']))
def tearDown(self):
self.binance_je_websocket_api_manager.stop_manager_with_all_streams()
class TestBinanceOrgManager(unittest.TestCase):
# Test binance.org (Binance Chain Dex)
def setUp(self):
self.binance_org_websocket_api_manager = BinanceWebSocketApiManager(exchange="binance.org")
def test_create_uri_alltickers_regular_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["$all"], ["allTickers"]),
'wss://dex.binance.org/api/ws/$all@allTickers')
def test_create_uri_alltickers_reverse_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["allTickers"], ["$all"]),
'wss://dex.binance.org/api/ws/$all@allTickers')
def test_create_uri_allminitickers_regular_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["$all"], ["allMiniTickers"]),
'wss://dex.binance.org/api/ws/$all@allMiniTickers')
def test_create_uri_allminitickers_reverse_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["allMiniTickers"], ["$all"]),
'wss://dex.binance.org/api/ws/$all@allMiniTickers')
def test_create_uri_blockheight_regular_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["$all"], ["blockheight"]),
'wss://dex.binance.org/api/ws/$all@blockheight')
def test_create_uri_blockheight_reverse_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["blockheight"], ["$all"]),
'wss://dex.binance.org/api/ws/$all@blockheight')
def test_create_uri_single_trades_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["trades"], ["RAVEN-F66_BNB"]),
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@trades')
def test_create_uri_single_marketdepth_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["marketDepth"], ["RAVEN-F66_BNB"]),
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@marketDepth')
def test_create_uri_single_kline_1h_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["kline_1h"], ["RAVEN-F66_BNB"]),
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@kline_1h')
def test_create_uri_single_ticker_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["ticker"], ["RAVEN-F66_BNB"]),
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@ticker')
def test_create_uri_single_miniTicker_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(["miniTicker"], ["RAVEN-F66_BNB"]),
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@miniTicker')
def test_create_uri_multi_org(self):
self.assertEqual(self.binance_org_websocket_api_manager.create_websocket_uri(['trades', 'kline_1h'],
['RAVEN-F66_BNB', 'ANKR-E97_BNB']),
'wss://dex.binance.org/api/ws')
stream_id = self.binance_org_websocket_api_manager.create_stream(['trades', 'kline_1h'],
['RAVEN-F66_BNB', 'ANKR-E97_BNB'])
self.assertEqual(str(self.binance_org_websocket_api_manager.stream_list[stream_id]["payload"]),
"[{'method': 'subscribe', 'topic': 'trades', 'symbols': ['RAVEN-F66_BNB', 'ANKR-E97_BNB']}, "
"{'method': 'subscribe', 'topic': 'kline_1h', 'symbols': ['RAVEN-F66_BNB', 'ANKR-E97_BNB']}]")
def test_create_uri_user_address_orders_single_org(self):
self.assertEqual(
self.binance_org_websocket_api_manager.create_websocket_uri('orders',
'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6'),
'wss://dex.binance.org/api/ws/bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6')
def test_create_uri_user_address_accounts_single_org(self):
self.assertEqual(
self.binance_org_websocket_api_manager.create_websocket_uri('accounts',
'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6'),
'wss://dex.binance.org/api/ws/bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6')
def test_create_uri_user_address_transfers_single_org(self):
self.assertEqual(
self.binance_org_websocket_api_manager.create_websocket_uri('transfers',
'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6'),
'wss://dex.binance.org/api/ws/bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6')
def test_create_uri_user_address_multi_org(self):
stream_id = self.binance_org_websocket_api_manager.create_stream(['orders', 'transfers', 'accounts'],
'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6')
self.assertEqual(str(self.binance_org_websocket_api_manager.stream_list[stream_id]["payload"]),
"[{'method': 'subscribe', 'topic': 'orders', 'address': 'bnb1v566f3avl2ud5z0jepazsrguzkj3"
"67snlx4jm6'}, {'method': 'subscribe', 'topic': 'transfers', 'address': 'bnb1v566f3avl2ud"
"5z0jepazsrguzkj367snlx4jm6'}, {'method': 'subscribe', 'topic': 'accounts', 'address': 'b"
"nb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6'}]")
def tearDown(self):
self.binance_org_websocket_api_manager.stop_manager_with_all_streams()
if __name__ == '__main__':
unittest.main()
| 58.659649 | 121 | 0.633987 | 1,881 | 16,718 | 5.272727 | 0.112706 | 0.078746 | 0.099617 | 0.098306 | 0.787457 | 0.760436 | 0.730692 | 0.698125 | 0.689756 | 0.664953 | 0 | 0.021138 | 0.258584 | 16,718 | 284 | 122 | 58.866197 | 0.779024 | 0.095047 | 0 | 0.340314 | 0 | 0.020942 | 0.228929 | 0.133382 | 0 | 0 | 0 | 0 | 0.204188 | 1 | 0.230366 | false | 0 | 0.015707 | 0 | 0.26178 | 0.020942 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2cb1a1a1fcafd7b22e288337a86ce86bbf4519e4 | 202 | py | Python | osr2mp4/ImageProcess/PrepareFrames/RankingScreens/RankingTitle.py | siveroo/osr2mp4-core | 7aaf33e7b4798634bb4151a8246dbf2d5ef49cf9 | [
"MIT"
] | 103 | 2020-06-07T15:28:41.000Z | 2022-03-01T17:07:35.000Z | osr2mp4/ImageProcess/PrepareFrames/RankingScreens/RankingTitle.py | siveroo/osr2mp4-core | 7aaf33e7b4798634bb4151a8246dbf2d5ef49cf9 | [
"MIT"
] | 50 | 2020-06-07T10:53:21.000Z | 2021-12-19T14:47:47.000Z | osr2mp4/ImageProcess/PrepareFrames/RankingScreens/RankingTitle.py | siveroo/osr2mp4-core | 7aaf33e7b4798634bb4151a8246dbf2d5ef49cf9 | [
"MIT"
] | 21 | 2020-07-12T16:02:35.000Z | 2022-03-01T17:07:37.000Z | from osr2mp4.ImageProcess.PrepareFrames.YImage import YImage
rankingtitle = "ranking-title"
def prepare_rankingtitle(scale, settings):
img = YImage(rankingtitle, settings, scale).img
return [img]
| 20.2 | 60 | 0.792079 | 23 | 202 | 6.913043 | 0.652174 | 0.226415 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011173 | 0.113861 | 202 | 9 | 61 | 22.444444 | 0.877095 | 0 | 0 | 0 | 0 | 0 | 0.064356 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 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 | 1 | 0 | 0 | 4 |
2cbc3e6a173a7a870aeace42c9f67f1017d8bab2 | 47,173 | py | Python | bot.py | 6dba/async-telegram-bot | 3950f5bc51be9f2f93924442948a98db52332d8e | [
"MIT"
] | null | null | null | bot.py | 6dba/async-telegram-bot | 3950f5bc51be9f2f93924442948a98db52332d8e | [
"MIT"
] | null | null | null | bot.py | 6dba/async-telegram-bot | 3950f5bc51be9f2f93924442948a98db52332d8e | [
"MIT"
] | null | null | null | import time
import random
import re
from datetime import datetime, timedelta
from aiogram import Bot, types, asyncio
from aiogram.contrib.middlewares.logging import LoggingMiddleware
from aiogram.dispatcher import Dispatcher, FSMContext
from aiogram.types.message import ContentType
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from aiogram.contrib.fsm_storage.memory import MemoryStorage
import functions
from config import API_TOKEN
from dialogs import message as dialog
from database import database_ as db
from keyboards import keyboard
from states import DataState
from main import logging
# ОПРЕДЕЛЕНИЕ БОТА. ДИСПЕТЧЕРА
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot, storage=MemoryStorage())
dp.middleware.setup(LoggingMiddleware())
# ОБРАБОТЧИКИ КОЛБЕКОВ
@dp.callback_query_handler(lambda call: call.data == 'menu')
async def menu_button(callback_query: types.CallbackQuery):
"""Вывод главного меню, через callback"""
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.mainMenu,reply_markup=keyboard.MainMenu_keyboard)
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{menu_button.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data == 'mypills')
async def get_mypills(callback_query: types.CallbackQuery):
"""Вывод всех таблеток"""
pills_list = await db.get_mypills(callback_query.from_user.id)
# ЕСЛИ ПОЛУЧЕННЫЙ СПИСОК ПУСТОЙ - РЕДАКТИРУЕМ СООБЩЕНИЕ МОЛ НИЧЕГО НЕТ + КНОПКА ГЛ МЕНЮ
# ЕСЛИ ЕСТЬ - ВЫВОДИМ СПИСОК ПОКА ОН НЕ БОЛЬШЕ 6
if not pills_list:
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.None_pills,reply_markup=keyboard.to_main_keyboard, parse_mode='html')
else:
text = "<b>Мои препараты</b>\n\n"
for item in pills_list:
text += f"<a href='https://apteka.ru/search/?q={item[1]}'><b>{item[1]}</b></a>:\nКурс длится <b>{item[2]}/{item[3]}</b> дней 🗓\nПринято в день: <b>{item[4]}/{item[5]}</b> 💊\n"
if item[6] != 0:
text += f"Дозировка: <b>{item[6]}</b> мг 💉\n"
text += f"Время напоминания: <b>{item[7]}</b> ⏳\n"
if item[8]: # если примечания не пустые, то выводим
text += f"Примечание: <b>{item[8]}</b> 🗒\n"
text += '\n'
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=text,reply_markup=keyboard.to_main_keyboard, parse_mode='html', disable_web_page_preview=True)
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{get_mypills.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data == 'planconfirm')
async def confirm_plan(callback_query: types.CallbackQuery):
"""Выгрузка части данных о таблетка + возможность их подтверждения"""
pills_list = await db.get_mypills(callback_query.from_user.id)
# ЕСЛИ ПОЛУЧЕННЫЙ СПИСОК ПУСТОЙ - РЕДАКТИРУЕМ СООБЩЕНИЕ МОЛ НИЧЕГО НЕТ + КНОПКА ГЛ. МЕНЮ
# ЕСЛИ ЕСТЬ - ВЫВОДИМ КОЛ-ВО КНОПОК = КОЛ-ВО ТАБЛЕТОК ЮЗЕРА И ОСНОВНЫЕ ДАННЫЕ О ТОМ, СКОЛЬКО В ДЕНЬ ОСТАЛОСЬ ВЫПИТЬ
if not pills_list:
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.None_pills,reply_markup=keyboard.to_main_keyboard, parse_mode='html')
else:
text = "<b>Подтвердить приём</b>\n\n"
keyboard.confirm_keyboard = InlineKeyboardMarkup(row_width=2)
for item in pills_list:
text += f"<a href='https://apteka.ru/search/?q={item[1]}'><b>{item[1]}</b></a>:\nКурс длится <b>{item[2]}/{item[3]}</b> дней 🗓\nПринято в день: <b>{item[4]}/{item[5]}</b> 💊\n"
if item[6] != 0:
text += f"Дозировка: <b>{item[6]}</b> мг 💉\n"
text +='\n'
keyboard.confirm_keyboard.insert(InlineKeyboardButton(f"{item[1]}",callback_data=f"confirm#{item[1]}"))
keyboard.confirm_keyboard.add(InlineKeyboardButton('Главное меню 🏛', callback_data= 'menu'))
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=text,reply_markup=keyboard.confirm_keyboard, parse_mode='html',disable_web_page_preview=True)
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{confirm_plan.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data.startswith('confirm#'))
async def confirm_button(callback_query: types.CallbackQuery):
"""Подтверждение выпитой таблетки"""
# ДЕЛАЕМ СПЛИТ КОЛБЕКА И БЕРЕМ ПОСЛЕДНЮЮ ЕГО ЧАСТЬ - НАЗВАНИЕ ПРЕПАРАТА
# ДАЛЕЕ ЗАПРОС В БД, БЕРЕМ ДАННЫЕ ПРЕПАРАТА И МЕНЯЕМ ЗНАЧЕНИЕ ВЫПИТОГО В ДЕНЬ
pill_data = await db.get_concreteness_pilldata(callback_query.from_user.id, callback_query.data.split("#")[-1])
taken_changed = pill_data[0][4] + 1
if taken_changed == pill_data[0][5]: # если кол-во выпитого = кол-ву необходимого в день, то день курса ++ и кол-во выпитого ++ -> запись данных
course_InDay_taken = pill_data[0][2] + 1
if course_InDay_taken == pill_data[0][3]: # если кол-во пропитых дней курса == небходимому кол-ву дней, тогда удаляем напоминание
await bot.answer_callback_query(callback_query.id, show_alert=True, text=f"{pill_data[0][1]}: поздравляем, вы завершили приём курса! {course_InDay_taken}/{pill_data[0][3]} дней! 🥳")
await db.set_countInDay_taken(callback_query.from_user.id,callback_query.data.split("#")[-1], taken_changed)
await db.set_course_taken(callback_query.from_user.id,callback_query.data.split("#")[-1], course_InDay_taken)
await db.delete_user_drug(callback_query.from_user.id,callback_query.data.split("#")[-1])
await confirm_plan(callback_query)
else:
await bot.answer_callback_query(callback_query.id, text=f"{pill_data[0][1]}: cуточная норма принята! ✅")
await db.set_countInDay_taken(callback_query.from_user.id,callback_query.data.split("#")[-1], taken_changed)
await db.set_course_taken(callback_query.from_user.id,callback_query.data.split("#")[-1], course_InDay_taken)
await confirm_plan(callback_query)
elif taken_changed < pill_data[0][5]:
taken_changed = pill_data[0][4] + 1
await bot.answer_callback_query(callback_query.id, text=f"{pill_data[0][1]}: приём подтвержден! 👌")
await db.set_countInDay_taken(callback_query.from_user.id,callback_query.data.split("#")[-1], taken_changed)
await confirm_plan(callback_query)
else:
await bot.answer_callback_query(callback_query.id, text="Хэй, не много ли будет? ⛔️")
logging.info(f'Callback Query ~ Catched by <{confirm_button.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data == 'delplan')
async def delete_plan(callback_query: types.CallbackQuery):
"""Удаление данных о таблетках"""
pills_list = await db.get_mypills(callback_query.from_user.id)
# ЕСЛИ ПОЛУЧЕННЫЙ СПИСОК ПУСТОЙ - РЕДАКТИРУЕМ СООБЩЕНИЕ МОЛ НИЧЕГО НЕТ + КНОПКА ГЛ МЕНЮ
# ЕСЛИ ЕСТЬ - ВЫВОДИМ КОЛ-ВО КНОПОК = КОЛ-ВО ТАБЛЕТОК ЮЗЕРА И ОСНОВНЫЕ ИХ ДАННЫЕ
if not pills_list:
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.None_pills,reply_markup=keyboard.to_main_keyboard, parse_mode='html')
else:
text = "<b>Удалить напоминание</b>\n\n"
keyboard.delete_keyboard = InlineKeyboardMarkup(row_width=2)
for item in pills_list:
pill = f"<a href='https://apteka.ru/search/?q={item[1]}'><b>{item[1]}</b></a>:\nКурс длится <b>{item[2]}/{item[3]}</b> дней 🗓\n\n"
text += pill
keyboard.delete_keyboard.insert(InlineKeyboardButton(f"{item[1]}",callback_data=f"delete#{item[1]}"))
keyboard.delete_keyboard.add(InlineKeyboardButton('Главное меню 🏛', callback_data= 'menu'))
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id, text=text, reply_markup=keyboard.delete_keyboard, parse_mode='html', disable_web_page_preview=True)
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{delete_plan.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data == ('edit'))
async def edit_plan(callback_query: types.CallbackQuery):
"""Меню изменения напоминаний"""
if await db.get_user_allday(callback_query.from_user.id):
await bot.edit_message_text(chat_id=callback_query.from_user.id,message_id=callback_query.message.message_id, text=dialog.edit, reply_markup=keyboard.edit_true_keyboard)
else:
await bot.edit_message_text(chat_id=callback_query.from_user.id,message_id=callback_query.message.message_id, text=dialog.edit, reply_markup=keyboard.edit_false_keyboard)
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{edit_plan.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
# FSM ОБРАБОТЧИКИ КОЛБЕКОВ
@dp.callback_query_handler(lambda call: call.data.startswith('note#'))
async def edit_note(callback_query: types.CallbackQuery, state: FSMContext):
"""Состояние редактирования заметок таблетки"""
# СПЛИТ КОЛБЕКА И РАБОТАЕМ С НАЗВАНИЕМ ПРЕПАРАТА
drug_name = callback_query.data.split("#")[-1]
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id, text="Напиши заметки для напоминаний 📝\nНапример: <u>пить после еды</u> 🍜", reply_markup=keyboard.to_main_keyboard, parse_mode='html')
await state.update_data(message_id=callback_query.message.message_id,drug_name=drug_name)
await DataState.edit_note.set()
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{edit_note.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data.startswith('delete#') or call.data.startswith('yes#') or call.data.startswith('no'))
async def delete_button(callback_query: types.CallbackQuery):
"""Запрос на удаление + обработка подтверждения удаления"""
# ЕСЛИ КОЛБЕК НАЧИНАЕТСЯ С DELETE, ТО РЕДАКТИРУЕМ СООБЩЕНИЯ, ТЕМ САМЫМ СПРАШИВАЮ ПОДТВЕРЖДЕНИЕ У ПОЛЬЗОВАТЕЛЯ, МОЛ, УДАЛИТЬ?
# ЕСЛИ ПОЛЬЗОВАТЕЛЬ НАЖИНАЕМ НА КНОПКИ ПОДТВЕРЖДЕНИЯ, ТО ПРОИСХОДИТ ДЕЙСТВИЕ
if callback_query.data.startswith('delete#'):
yes_no = InlineKeyboardMarkup(row_width=2).insert(InlineKeyboardButton('Нет 🙅♀️',callback_data='no')).insert(InlineKeyboardButton('Да 👌', callback_data=f'yes#{callback_query.data.split("#")[-1]}'))
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,
text=f'<b>{callback_query.data.split("#")[-1]}</b>: удалить напоминание? 🤔',
reply_markup=yes_no, parse_mode='html')
elif callback_query.data.startswith('yes#'):
await db.delete_user_drug(callback_query.from_user.id, callback_query.data.split("#")[-1])
await bot.answer_callback_query(callback_query.id, text=f'{callback_query.data.split("#")[-1]}: напоминание удалено! ✅')
await menu_button(callback_query)
else:
await delete_plan(callback_query)
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{delete_button.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data == 'addplan')
async def add_plan(callback_query: types.CallbackQuery, state: FSMContext):
"""Начало процесса добавления препарата"""
# ВЫВОД НАЧАЛЬНЫХ СООБЩЕНИЙ + УСТАНОВКА СОСТОЯНИЯ ДОБАВЛЕНИЯ
drugs_count = await db.count_user_drugs(callback_query.from_user.id) # Берем кол-во напоминаний пользователя -> возваращает список кортежей -> берем нужное число
if drugs_count[0][0] < 6:
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.start_addplan)
time.sleep(1.5)
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.drug_name_addplan, reply_markup=keyboard.to_main_keyboard)
await state.update_data(message_id=callback_query.message.message_id)
await DataState.wait_drug_name.set()
else:
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.pills_limit, reply_markup=keyboard.to_main_keyboard)
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{add_plan.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data.startswith('time#'))
async def edit_time(callback_query: types.CallbackQuery, state: FSMContext):
"""Перенаправление на состояния редактирования времени"""
# БЕРЕМ НАЗВАНИЕ ПРЕПАРАТА, И ID СООБЩЕНИЯ С КОТОРОГО НАЧАЛОСЬ РЕДАКТИРОВАНИЕ - СУЕМ В КЭШ
# ДАЛЕЕ УСТАНАВЛИВАЕМ СОСТОЯНИЯ ИЗМЕНЕНИЯ ВРЕМЕНИ - СРАБОТАЕТ ФУНКЦИЯ стр.622 - <course_time_written>
drug_name = callback_query.data.split("#")[-1]
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id, text="Когда тебе напомнить? ⏳", reply_markup=keyboard.to_main_keyboard)
await state.update_data(message_id=callback_query.message.message_id,drug_name=drug_name)
await DataState.edit_time.set()
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{edit_time.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data.startswith('edit#'))
async def edit_button(callback_query: types.CallbackQuery, state: FSMContext):
"""Обработчик колбеков из меню редактирования"""
# ПЕРВОЕ - ИЗМЕНЕНИЕ ПАРАМЕТРА ALLDAY, ЕСЛИ ЕСТЬ НУЖНЫЙ НАМ КОЛБЕК И БАЗА ДАННЫХ ВОЗВРАЩАЕТ ПАРАМЕТР ALLDAY ЮЗЕРА TRUE - МЕНЯЕМ НА FALSE
# ВЫЗЫВАЕМ МЕНЮ EDIT СНОВА, ГДЕ МЕНЯЕТСЯ ВИД КНОПКИ
data = callback_query.data.split("#")[-1]
if data == 'allday' and await db.get_user_allday(callback_query.from_user.id):
await db.set_allday(callback_query.from_user.id, False)
await edit_plan(callback_query)
elif data == 'allday':
await db.set_allday(callback_query.from_user.id, True)
await bot.answer_callback_query(callback_query_id=callback_query.id,show_alert=True, text=dialog.allday_message)
await edit_plan(callback_query)
# ВТОРОЕ - РЕДАКТИРОВАНИЕ ВРЕМЕНИ НАПОМИНАНИЯ ПРЕПАРАТА
if data == 'time':
pills_list = await db.get_mypills(callback_query.from_user.id)
if not pills_list:
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.None_pills,reply_markup=keyboard.to_main_keyboard, parse_mode='html')
else:
text = "<b>Редактировать время</b>\n\n"
keyboard.confirm_keyboard = InlineKeyboardMarkup(row_width=2)
for item in pills_list:
pill = f"<a href='https://apteka.ru/search/?q={item[1]}'><b>{item[1]}</b></a>:\nКурс длится <b>{item[2]}/{item[3]}</b> дней 🗓\nВремя напоминания: <b>{item[7]}</b> ⏳\n\n"
text += pill
keyboard.confirm_keyboard.insert(InlineKeyboardButton(f"{item[1]}",callback_data=f"time#{item[1]}"))
keyboard.confirm_keyboard.add(InlineKeyboardButton('Назад', callback_data= 'edit'))
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=text,reply_markup=keyboard.confirm_keyboard, parse_mode='html',disable_web_page_preview=True)
# ТРЕТЬЕ - РЕДАКТИРОВАНИЕ ПРИМЕЧАНИЙ ПРЕПАРАТА
if data == 'note':
pills_list = await db.get_mypills(callback_query.from_user.id)
if not pills_list:
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=dialog.None_pills,reply_markup=keyboard.to_main_keyboard, parse_mode='html')
else:
text = "<b>Редактировать примечание</b>\n\n"
keyboard.confirm_keyboard = InlineKeyboardMarkup(row_width=2)
for item in pills_list:
if item[8]: # если примечания не пустые, то выводим
text += f"<a href='https://apteka.ru/search/?q={item[1]}'><b>{item[1]}</b></a>:\nПримечание: <b>{item[8]}</b> 🗒\n\n"
keyboard.confirm_keyboard.insert(InlineKeyboardButton(f"{item[1]}",callback_data=f"note#{item[1]}"))
keyboard.confirm_keyboard.add(InlineKeyboardButton('Назад', callback_data= 'edit'))
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text=text,reply_markup=keyboard.confirm_keyboard, parse_mode='html',disable_web_page_preview=True)
if data == 'UTC':
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=callback_query.message.message_id,text="Какое время у тебя сейчас? 🙃\n" + f"Например, у меня: <b>{time.strftime('%H:%M',time.localtime())}</b> 🕙" ,
reply_markup=keyboard.to_edit_keyboard, parse_mode='html')
await state.update_data(message_id=callback_query.message.message_id)
await DataState.edit_utc.set()
await bot.answer_callback_query(callback_query.id)
logging.info(f'Callback Query ~ Catched by <{edit_time.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
# ОБРАБОТЧИКИ КОМАНД
@dp.message_handler(commands=['start'], state = '*')
async def start_handler(message: types.Message, state: FSMContext):
"""Обработка команды start. Вывод текста и меню"""
# ВСЕ НАЧИНАЕТСЯ С КОМАНДЫ СТАРТ, ПРИ НАЖАТИИ ПРОВЕРКА НА НАЛИЧИЕ ПОЛЬЗОВАТЕЛЯ В БД
# ПРИ ОТСУТСТВИЕ ПОЛЬЗОВАТЕЛЯ - ДОБАВЛЯЕМ
if not await db.exist_user(user_id=message.from_user.id):
await db.insert_new_user(user_id=message.from_user.id)
await bot.send_message(message.chat.id,dialog.start_html.format(first_name=message.from_user.first_name),parse_mode='html',reply_markup=keyboard.replMenu_keyboard)
await menu_handler(message, state)
logging.info(f'Message Handler ~ Catched by <{start_handler.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(commands=['help'], state = '*')
async def help_handler(message: types.Message, state: FSMContext):
"""Обработка команды help. Вывод текста и меню"""
await bot.send_message(chat_id=message.chat.id,text=dialog.help,parse_mode='html')
await state.finish()
logging.info(f'Message Handler ~ Catched by <{help_handler.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(lambda message: message.text == "Главное меню 🏛", state = '*')
@dp.message_handler(commands=['menu'], state = '*')
async def menu_handler(message: types.Message,state: FSMContext):
"""Главное меню"""
# ДАБЫ НЕ ПЛОДИТЬ КУЧУ 'ГЛАВНЫХ МЕНЮ' - ПРИДУМАНА СИЕ КОНСТРУКЦИЯ, ПОПЫТКА УДАЛЕНИЕ СТАРОГО СООБЩЕНИЯ ГЛАВНОГО МЕНЮ
# ID КОТОРОГО ХРАНИТЬСЯ В БД, ПРИ НЕУДАЧЕ - ПРОДОЛЖАЕМ РАБОТУ И ПРОСТО ЗАСЫЛАЕМ НОВОЕ ГЛАВНОЕ МЕНЮ -> ЗАПИСЫВАЕМ ЕГО ID В БД
if await state.get_state() == 'DataState:menu_exec':
if message.text == "Главное меню 🏛" or message.text == "/menu":
await bot.delete_message(message.from_user.id,message.message_id)
return
else:
await DataState.menu_exec.set()
try:
main_id = await db.get_main_message_id(message.from_user.id)
await bot.delete_message(chat_id=message.from_user.id, message_id=main_id[0])
except:
pass
if message.text == "Главное меню 🏛" or message.text == "/menu":
await bot.delete_message(message.from_user.id,message.message_id)
shipped = await bot.send_message(message.from_user.id,dialog.mainMenu,reply_markup=keyboard.MainMenu_keyboard)
await db.set_main_message_id(message_id=shipped.message_id, user_id=message.from_user.id)
await state.finish()
logging.info(f'Message Handler ~ Catched by <{menu_handler.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
# FSM ОБРАБОТЧИКИ addplan
# обработчики команд во время состояния добавления
@dp.callback_query_handler(lambda call: call.data == 'exit' or call.data == 'add',state = DataState.wait_choose)
async def callback_choose(callback_query: types.CallbackQuery, state: FSMContext):
"""Разветвление при добавлении заметок"""
# ПОЛЬЗОВАТЕЛЮ БЫЛ ПРЕДЛОЖЕНО - ДОБАВИТЬ ЗАМЕТКИ ИЛИ НЕТ
# ДА - УСТАНАВЛИВАЕМ СЛЕДУЮЩУЮ СТАДИЮ
# НЕТ - СОХРАНЯЕМ
addplan_id_message = await state.get_data('message_id')
if callback_query.data == 'add':
await bot.answer_callback_query(callback_query.id)
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=addplan_id_message['message_id'],text="Напиши заметки для напоминаний 📝\nНапример: <u>пить после еды</u> 🍜"
,reply_markup=keyboard.to_main_keyboard, parse_mode='html')
await DataState.next()
elif callback_query.data == 'exit':
user_data = await state.get_data()
await db.insert_new_data(user_id=callback_query.from_user.id,
drug_name=user_data['drug_name'],
course_taking=user_data['course_taking'],
course_taken=user_data['course_taken'],
count_day=user_data['course_inday'],
dose=user_data['dose'],
time=user_data['time'],
note='')
await bot.edit_message_text(chat_id=callback_query.from_user.id,message_id=addplan_id_message['message_id'], text="<b>Напоминание добавлено!</b> 🎉",parse_mode='html')
time.sleep(1.5)
await bot.edit_message_text(chat_id=callback_query.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.mainMenu, reply_markup=keyboard.MainMenu_keyboard)
await state.finish()
logging.info(f'FSM Callback Query ~ Catched by <{callback_choose.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
@dp.callback_query_handler(lambda call: call.data == 'menu' or call.data == 'edit', state='*')
async def callback_fsm_menu_edit(callback_query: types.CallbackQuery, state: FSMContext):
"""Вывод главного меню, через callback"""
# ОБНУЛЕНИЕ СОСТОНИЯ, ВЫВОД ГЛАВНОГО МЕНЮ / НАСТРОЕК
await state.finish()
if callback_query.data == 'menu':
await menu_button(callback_query)
if callback_query.data == 'edit':
await edit_plan(callback_query)
logging.info(f'FSM Callback Query ~ Catched by <{callback_fsm_menu_edit.__name__}> func ~ From {callback_fsm_menu_edit.from_user.id} : @{callback_fsm_menu_edit.from_user.username}')
async def utc_exist(user_id: int, state: FSMContext):
addplan_id_message = await state.get_data('message_id')
utc_exist = await db.get_user_utc(user_id)
if not utc_exist:
await bot.edit_message_text(chat_id=user_id, message_id=addplan_id_message['message_id'],text="Какое время у тебя сейчас? 🙃\n" + f"Например, у меня: <b>{time.strftime('%H:%M',time.localtime())}</b> 🕙"
, reply_markup=keyboard.to_main_keyboard, parse_mode='html')
await DataState.next() # <user_utc_written>
else:
await bot.edit_message_text(chat_id=user_id, message_id=addplan_id_message['message_id'],text="Укажи время, когда тебе лучше напоминать.. ⏳"
, reply_markup=keyboard.to_main_keyboard)
await DataState.wait_time.set()
@dp.callback_query_handler(lambda call: call.data == 'skip', state= DataState.wait_dose)
async def skip_dose(callback_query: types.CallbackQuery, state: FSMContext):
"""Пропуск дозировки"""
await bot.answer_callback_query(callback_query.id)
await state.update_data(dose=0)
await utc_exist(callback_query.from_user.id,state)
logging.info(f'FSM Message Handler ~ Catched by <{skip_dose.__name__}> func ~ From {callback_query.from_user.id} : @{callback_query.from_user.username}')
# обработчики состояния добавления
@dp.message_handler(state = DataState.wait_drug_name)
async def drug_name_written(message: types.Message, state: FSMContext):
"""Обработка ввода препарата"""
addplan_id_message = await state.get_data('message_id') # id сообщения из которого вызвалось меню добавления - для последующего редактирования сообщения
# НЕМНОГО КОСТЫЛЬНАЯ ЛОГИКА, НО ПО ДРУГОМУ СООБЩЕНИЯ НЕ ОТРЕДАКТИРУЕШЬ
# ЕСЛИ ВВОД НЕПРАВИЛЬНЫЙ -> РЕДАКТИРУЕТСЯ СООБЩЕНИЕ И ОЖИДАНИЕ ПОВТОРНОГО ВВОДА, ЧТОБЫ НЕ БЫЛО ИСКЛЮЧЕНИЙ ИЗ-ЗА ТОГО, ЧТО СООБЩЕНИЕ ОДИНАКОВОЕ, К СООБЩЕНИЮ ДОБАВЛЯЕТСЯ РАНДОМНЫЙ СМАЙЛИК :)
if message.text.isdigit() or not set(".,:;!?_*+=<>()/@$'#^¤%&){}\"\\").isdisjoint(message.text) or len(message.text) > 60: # если строка не только буквы или в строке превышена допустимая длина
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{drug_name_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
elif await db.exist_drug(message.from_user.id, message.text):
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.drug_exist + random.choice(dialog.SMILE), reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.drug_exist + random.choice(dialog.SMILE), reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{drug_name_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
# ЕСЛИ ВСЕ ПРОВЕРКИ ПРОЙДЕНЫ - ВВЕДЕНЫЙ ПРЕПАРАТ ЗАНОСИТСЯ В КЭШ
await state.update_data(drug_name=message.text)
await bot.delete_message(message.from_user.id, message.message_id)
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text="Теперь напиши, сколько дней длится полный курс? 🗓",reply_markup=keyboard.to_main_keyboard)
# Для последовательных шагов можно не указывать название состояния, обходясь next()
await DataState.next()
logging.info(f'FSM Message Handler ~ Catched by <{drug_name_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(state = DataState.wait_course_taking)
async def course_taking_written(message: types.Message, state: FSMContext):
"""Обработка ввода дней курса препарата"""
addplan_id_message = await state.get_data('message_id')
if not message.text.isdigit():
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{course_taking_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
elif int(message.text) == 0 or int(message.text) > 365:
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_unreal + random.choice(dialog.SMILE), reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_unreal + random.choice(dialog.SMILE), reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{course_taking_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
await state.update_data(course_taking=int(message.text))
await bot.delete_message(message.from_user.id, message.message_id)
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text="Сколько дней курса уже прошло? 📆",reply_markup=keyboard.to_main_keyboard)
await DataState.next()
logging.info(f'FSM Message Handler ~ Catched by <{course_taking_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(state = DataState.wait_course_taken)
async def course_taken_written(message: types.Message, state: FSMContext):
"""Обработка ввода уже прошедних дней курса препарата"""
addplan_id_message = await state.get_data('message_id')
course_taking = await state.get_data('course_taking')
if not message.text.isdigit():
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{course_taken_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
elif int(message.text) >= int(course_taking['course_taking']):
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_more_than_need + random.choice(dialog.SMILE), reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_more_than_need + random.choice(dialog.SMILE), reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{course_taken_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
await state.update_data(course_taken=int(message.text))
await bot.delete_message(message.from_user.id, message.message_id)
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text="Сколько таблеток нужно пить в день? 💊",reply_markup=keyboard.to_main_keyboard)
await DataState.next()
logging.info(f'FSM Message Handler ~ Catched by <{course_taken_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(state = DataState.wait_inday)
async def course_inday_written(message: types.Message, state: FSMContext):
"""Обработка ввода необходимого кол-ва таблеток в день"""
addplan_id_message = await state.get_data('message_id')
if not message.text.isdigit():
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{course_inday_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
elif int(message.text) == 0 or int(message.text) > 30:
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_unreal + random.choice(dialog.SMILE), reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_unreal + random.choice(dialog.SMILE), reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{course_inday_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
await state.update_data(course_inday=int(message.text))
await bot.delete_message(message.from_user.id, message.message_id)
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text="Напиши дозировку препарата в мг 💉",reply_markup=keyboard.skip_dose)
await DataState.next()
logging.info(f'FSM Message Handler ~ Catched by <{course_inday_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(state = DataState.wait_dose)
async def course_dose_written(message: types.Message, state: FSMContext):
"""Обработка ввода дозировки"""
addplan_id_message = await state.get_data('message_id')
try:
float(message.text)
except:
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error_dose + random.choice(dialog.SMILE), reply_markup=keyboard.skip_dose,parse_mode='html')
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error_dose + random.choice(dialog.SMILE), reply_markup=keyboard.skip_dose,parse_mode='html')
logging.exception(f'FSM Message Handler Edit ~ Catched by <{course_dose_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
await bot.delete_message(message.from_user.id, message.message_id)
await state.update_data(dose=float(message.text))
# ЕСЛИ У ПОЛЬЗОВАТЕЛЯ ЕЩЕ НЕ ЗАДАН ЧАСОВОЙ ПОЯС - ПЕРЕВОДИМ СОСТОНИЯ НА ВВОД ЛОКАЛЬНОГО ВРЕМЕНИ
await utc_exist(message.from_user.id, state)
logging.info(f'FSM Message Handler ~ Catched by <{course_dose_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(state = DataState.edit_utc)
@dp.message_handler(state = DataState.wait_utc)
async def user_utc_written(message: types.Message, state: FSMContext):
"""Обработка ввода времени, для определения часового пояса"""
addplan_id_message = await state.get_data('message_id')
if re.search(r'^(([0,1][0-9])|(2[0-3])):[0-5][0-9]$', message.text):
await bot.delete_message(message.from_user.id, message.message_id)
await db.set_utc(message.from_user.id,functions.utc_delta(message))
else:
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error_time + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard,parse_mode='html')
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error_time + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard,parse_mode='html')
logging.exception(f'FSM Message Handler Edit ~ Catched by <{user_utc_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
if await state.get_state() == 'DataState:edit_utc':
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'], text="<b>Часовой пояс обновлен!</b> 🎉", parse_mode='html')
time.sleep(1.5)
if await db.get_user_allday(message.from_user.id):
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'], text=dialog.edit, reply_markup=keyboard.edit_true_keyboard)
else:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'], text=dialog.edit, reply_markup=keyboard.edit_false_keyboard)
await state.finish()
logging.info(f'FSM Message Handler ~ Catched by <{user_utc_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text="Укажи время, когда тебе напомнить.. ⏳"
,reply_markup=keyboard.to_main_keyboard)
await DataState.next()
logging.info(f'FSM Message Handler ~ Catched by <{user_utc_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(state = DataState.edit_time)
@dp.message_handler(state = DataState.wait_time)
async def course_time_written(message: types.Message, state: FSMContext):
"""Обработка ввода времени напоминания"""
addplan_id_message = await state.get_data('message_id')
if re.search(r'^(([0,1][0-9])|(2[0-3])):[0-5][0-9]$', message.text):
await bot.delete_message(message.from_user.id, message.message_id)
await state.update_data(time=message.text)
else:
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error_time + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard,parse_mode='html')
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error_time + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard,parse_mode='html')
logging.exception(f'FSM Message Handler Edit ~ Catched by <{course_time_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
### РАЗВИЛКА ПРИ РАЗЛИЧНЫХ СОСТОЯНИЯХ: РЕДАКТИРОВАНИE ВРЕМЕНИ ИЛИ ОЖИДАНИE ВРЕМЕНИ ПРИ ДОБАВЛЕНИИ НОВОГО ПРЕПАРАТА
if await state.get_state() == 'DataState:wait_time':
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text="По желанию можешь добавить примечания 🗒"
, reply_markup=keyboard.exit_or_add_keyboard)
await DataState.next()
elif await state.get_state() == 'DataState:edit_time':
edit_time = await state.get_data()
await db.set_time(user_id=message.from_user.id,hh_mm=edit_time['time'],drug_name=edit_time['drug_name'])
await bot.edit_message_text(chat_id=message.from_user.id,message_id=addplan_id_message['message_id'], text="<b>Время напоминания обновлено!</b> 🎉", parse_mode='html')
time.sleep(1.5)
await bot.edit_message_text(chat_id=message.from_user.id,message_id=addplan_id_message['message_id'],text=dialog.mainMenu, reply_markup=keyboard.MainMenu_keyboard)
await state.finish()
logging.info(f'FSM Message Handler ~ Catched by <{course_time_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(state = DataState.edit_note)
@dp.message_handler(state = DataState.wait_note)
async def course_note_written(message: types.Message, state: FSMContext):
"""Обработка ввода заметок"""
addplan_id_message = await state.get_data('message_id')
await state.update_data(note=message.text)
user_data = await state.get_data()
if len(message.text) > 70:
await bot.delete_message(message.from_user.id, message.message_id)
try:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
except:
await bot.edit_message_text(chat_id=message.from_user.id, message_id=addplan_id_message['message_id'],text=dialog.input_error + random.choice(dialog.SMILE),reply_markup=keyboard.to_main_keyboard)
logging.exception(f'FSM Message Handler Edit ~ Catched by <{drug_name_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
return
# РАЗВИЛКА, ЕСЛИ СОСТОЯНИЕ ДОБАВЛЕНИЕ - БЕРЕМ ВСЕ ВНЕСЕННЫЕ ДАННЫЕ ИЗ КЭША И СОХРАНЯЕМ КАК НОВОЕ НАПОМИНАНИЕ
# ЕСЛИ СОСТОЯНИЕ РЕДАКТИРОВАНИЯ - ОБНОВЛЯЕМ ПРИМЕЧАНИЯ У НАПОМИНАНИЯ
# СБРАСЫВАЕМ СОСТОЯНИЕ И КЭШ
if await state.get_state() == 'DataState:wait_note':
await db.insert_new_data(user_id=message.from_user.id,
drug_name=user_data['drug_name'],
course_taking=user_data['course_taking'],
course_taken=user_data['course_taken'],
count_day=user_data['course_inday'],
dose=user_data['dose'],
time=user_data['time'],
note=user_data['note'])
await bot.delete_message(message.from_user.id,message.message_id)
await bot.edit_message_text(chat_id=message.from_user.id,message_id=addplan_id_message['message_id'], text="<b>Напоминание добавлено!</b> 🎉",parse_mode='html')
elif await state.get_state() == 'DataState:edit_note':
edit_note = await state.get_data()
await db.set_note(user_id=message.from_user.id, drug_name=edit_note['drug_name'],note=edit_note['note'])
await bot.delete_message(message.from_user.id,message.message_id)
await bot.edit_message_text(chat_id=message.from_user.id,message_id=addplan_id_message['message_id'], text="<b>Примечание обновлено!</b> 🎉",parse_mode='html')
time.sleep(1.5)
await bot.edit_message_text(chat_id=message.from_user.id,message_id=addplan_id_message['message_id'],text=dialog.mainMenu, reply_markup=keyboard.MainMenu_keyboard)
await state.finish()
logging.info(f'FSM Message Handler ~ Catched by <{course_note_written.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
# ОБРАБОТЧИКИ КОНТЕНТА
@dp.message_handler(content_types=['sticker'])
async def sticker_message(message: types.Message):
"""Удаляет стикеры, дабы не было спама"""
await bot.delete_message(message.from_user.id, message.message_id)
logging.info(f'Content Message Handler ~ Catched by <{sticker_message.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(content_types=['sticker'], state = '*')
async def sticker_message_fsm(message: types.Message):
"""Удаляет стикеры, дабы не было спама. При состоянии."""
await bot.delete_message(message.from_user.id, message.message_id)
logging.info(f'FSM Content Message Handler ~ Catched by <{sticker_message_fsm.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(content_types=['text'])
async def echo_message(message: types.Message):
"""Удаляет текст, дабы не было спама"""
await bot.delete_message(message.from_user.id, message.message_id)
logging.info(f'Content Message Handler ~ Catched by <{echo_message.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(content_types=ContentType.ANY)
async def unknown_message(message: types.Message):
"""Ответ на любой присланный контент, кроме 'text'"""
await message.reply(dialog.idontknow, parse_mode='html')
logging.info(f'FSM Content Message Handler ~ Catched by <{unknown_message.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
@dp.message_handler(content_types=ContentType.ANY, state = '*')
async def unknown_message_fsm(message: types.Message):
"""Ответ на любой присланный контент, кроме 'text'. При состоянии."""
await bot.delete_message(message.from_user.id, message.message_id)
logging.info(f'FSM Content Message Handler ~ Catched by <{unknown_message_fsm.__name__}> func ~ From {message.from_user.id} : @{message.from_user.username}')
| 62.897333 | 250 | 0.72232 | 6,558 | 47,173 | 4.932296 | 0.084477 | 0.06177 | 0.050702 | 0.062543 | 0.795276 | 0.769771 | 0.73904 | 0.72182 | 0.696531 | 0.672943 | 0 | 0.003437 | 0.161215 | 47,173 | 749 | 251 | 62.981308 | 0.812753 | 0.074407 | 0 | 0.50499 | 0 | 0.183633 | 0.225435 | 0.099827 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.001996 | 0.033932 | 0 | 0.061876 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 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 | 4 |
e2c45f2fe3800000fa64589322e60a88212137d8 | 246 | py | Python | sample/sample.py | Braza/sugarpy | 4c3ba3351387f36c2644d109f65307227ade129d | [
"MIT"
] | null | null | null | sample/sample.py | Braza/sugarpy | 4c3ba3351387f36c2644d109f65307227ade129d | [
"MIT"
] | 1 | 2021-03-10T11:07:13.000Z | 2021-03-10T11:07:13.000Z | sample/sample.py | Braza/sugarpy | 4c3ba3351387f36c2644d109f65307227ade129d | [
"MIT"
] | null | null | null | from sugarpy.story import Story
fname = './sample.xml'
with open(fname, "r") as f:
test_story_string = f.read()
test_story = Story(test_story_string, {})
print(test_story.get_raw_scene())
print(test_story.get_processed_scene())
| 24.6 | 45 | 0.707317 | 37 | 246 | 4.405405 | 0.540541 | 0.276074 | 0.184049 | 0.208589 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158537 | 246 | 9 | 46 | 27.333333 | 0.78744 | 0 | 0 | 0 | 0 | 0 | 0.052846 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.285714 | 0 | 0 | 0 | null | 1 | 1 | 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 | 4 |
e2dc25cb0e53ccecefdea74f25948b1ebe1b45ac | 503 | py | Python | aiocometd/__init__.py | robertmrk/aiocometd | 6c69ba505d02df334ebc551695d05c0427b92daf | [
"MIT"
] | 14 | 2018-12-02T17:15:59.000Z | 2022-02-27T12:37:50.000Z | aiocometd/__init__.py | robertmrk/aiocometd | 6c69ba505d02df334ebc551695d05c0427b92daf | [
"MIT"
] | 14 | 2019-02-11T13:06:59.000Z | 2022-02-14T18:04:16.000Z | aiocometd/__init__.py | robertmrk/aiocometd | 6c69ba505d02df334ebc551695d05c0427b92daf | [
"MIT"
] | 16 | 2019-03-11T13:13:29.000Z | 2022-02-27T11:30:59.000Z | """CometD client for asyncio"""
import logging
from aiocometd._metadata import VERSION as __version__ # noqa: F401
from aiocometd.client import Client # noqa: F401
from aiocometd.constants import ConnectionType # noqa: F401
from aiocometd.extensions import Extension, AuthExtension # noqa: F401
from aiocometd import transports # noqa: F401
# Create a default handler to avoid warnings in applications without logging
# configuration
logging.getLogger(__name__).addHandler(logging.NullHandler())
| 38.692308 | 76 | 0.805169 | 61 | 503 | 6.491803 | 0.557377 | 0.164141 | 0.121212 | 0.212121 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034325 | 0.131213 | 503 | 12 | 77 | 41.916667 | 0.871854 | 0.337972 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.857143 | 0 | 0.857143 | 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 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
39327f806b9c604e26c6496191f4834af4fc00d5 | 284 | py | Python | src/modax/utils/utils.py | GJBoth/modax | c7e1c128d4dd48b776f8ec4fa724c2e4b6e13c82 | [
"MIT"
] | 2 | 2021-12-10T14:36:37.000Z | 2022-02-10T11:47:03.000Z | src/modax/utils/utils.py | GJBoth/modax | c7e1c128d4dd48b776f8ec4fa724c2e4b6e13c82 | [
"MIT"
] | null | null | null | src/modax/utils/utils.py | GJBoth/modax | c7e1c128d4dd48b776f8ec4fa724c2e4b6e13c82 | [
"MIT"
] | 2 | 2020-12-22T14:49:13.000Z | 2021-04-09T08:52:08.000Z | from jax import custom_vjp
@custom_vjp
def no_grad(x):
return x
def no_grad_fwd(x):
# Returns primal output and residuals to be used in backward pass by f_bwd.
return no_grad(x), ()
def no_grad_bwd(res, g):
return None
no_grad.defvjp(no_grad_fwd, no_grad_bwd)
| 14.947368 | 79 | 0.714789 | 53 | 284 | 3.566038 | 0.54717 | 0.222222 | 0.142857 | 0.10582 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207746 | 284 | 18 | 80 | 15.777778 | 0.84 | 0.257042 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.333333 | 0.777778 | 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 | 1 | 0 | 0 | 4 |
393afa1aee8df482eaa8f09deb9c9cd1163ec00f | 220 | py | Python | src/anchor_python_training/visualize/__init__.py | anchoranalysis/anchor-python-training | f2089540b381cba8b2188a15797912f984d39f6c | [
"MIT"
] | null | null | null | src/anchor_python_training/visualize/__init__.py | anchoranalysis/anchor-python-training | f2089540b381cba8b2188a15797912f984d39f6c | [
"MIT"
] | null | null | null | src/anchor_python_training/visualize/__init__.py | anchoranalysis/anchor-python-training | f2089540b381cba8b2188a15797912f984d39f6c | [
"MIT"
] | null | null | null | """Routines for visualizing different aspects of training or its final outputs."""
from .comparison import plot_images_two_rows # noqa: F401
from .reconstruction import plot_reconstruction_on_first_batch # noqa: F401
| 44 | 82 | 0.813636 | 30 | 220 | 5.733333 | 0.8 | 0.116279 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 0.127273 | 220 | 4 | 83 | 55 | 0.864583 | 0.45 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
394106fc0816229d6ae73a6791eea48a64ee821b | 285 | py | Python | backend/endpoints.py | lpwgroup/forcebalance-manager | 85e067b07b5c703110deabf4f07d879182790429 | [
"MIT"
] | 2 | 2019-08-16T15:38:04.000Z | 2019-12-12T14:09:02.000Z | backend/endpoints.py | lpwgroup/forcebalance-manager | 85e067b07b5c703110deabf4f07d879182790429 | [
"MIT"
] | 8 | 2020-09-04T10:50:12.000Z | 2022-02-26T04:34:51.000Z | backend/endpoints.py | lpwgroup/forcebalance-manager | 85e067b07b5c703110deabf4f07d879182790429 | [
"MIT"
] | null | null | null | from flask import send_from_directory
from backend import app
from backend.fb_manager import manager
@app.route('/')
def index():
return send_from_directory('../frontend/build', 'index.html')
@app.route('/<path:path>')
def send_file(path):
return app.send_static_file(path)
| 21.923077 | 65 | 0.74386 | 42 | 285 | 4.857143 | 0.452381 | 0.078431 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119298 | 285 | 12 | 66 | 23.75 | 0.812749 | 0 | 0 | 0 | 0 | 0 | 0.140351 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.333333 | 0.222222 | 0.777778 | 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 | 1 | 1 | 1 | 0 | 0 | 4 |
1a9b174d53f2d2c20c218c0e2d09d217855c321e | 121 | py | Python | python/testData/inspections/PyStringFormatInspection/ByteString.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/inspections/PyStringFormatInspection/ByteString.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/inspections/PyStringFormatInspection/ByteString.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | print(b'Hello %b!' % b'World')
print(<warning descr="Unsupported format character 'b'">'Hello %b!'</warning> % b'World')
| 40.333333 | 89 | 0.669421 | 18 | 121 | 4.5 | 0.5 | 0.148148 | 0.17284 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099174 | 121 | 2 | 90 | 60.5 | 0.743119 | 0 | 0 | 0 | 0 | 0 | 0.495868 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
1a9c813ebae43f611fb9b971d90b8284c6fcc56a | 8,561 | py | Python | notifier/migrations/0002_auto__add_field_sentnotification_read.py | cmyers734/django-notifier | ed4a300cb3795e2705f96a6fea4df506a826b543 | [
"BSD-2-Clause"
] | 13 | 2015-07-21T09:07:06.000Z | 2021-12-10T16:45:04.000Z | notifier/migrations/0002_auto__add_field_sentnotification_read.py | Jbdealord/django-notifier | ed4a300cb3795e2705f96a6fea4df506a826b543 | [
"BSD-2-Clause"
] | 6 | 2015-01-17T03:31:29.000Z | 2021-06-10T18:50:06.000Z | notifier/migrations/0002_auto__add_field_sentnotification_read.py | Jbdealord/django-notifier | ed4a300cb3795e2705f96a6fea4df506a826b543 | [
"BSD-2-Clause"
] | 14 | 2017-01-12T11:11:08.000Z | 2019-04-19T10:01:45.000Z | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'SentNotification.read'
db.add_column(u'notifier_sentnotification', 'read',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
def backwards(self, orm):
# Deleting field 'SentNotification.read'
db.delete_column(u'notifier_sentnotification', 'read')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'notifier.backend': {
'Meta': {'object_name': 'Backend'},
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
'description': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True'}),
'display_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True'}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'klass': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200', 'db_index': 'True'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'})
},
u'notifier.groupprefs': {
'Meta': {'unique_together': "(('group', 'notification', 'backend'),)", 'object_name': 'GroupPrefs'},
'backend': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['notifier.Backend']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.Group']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'notification': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['notifier.Notification']"}),
'notify': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'})
},
u'notifier.notification': {
'Meta': {'object_name': 'Notification'},
'backends': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['notifier.Backend']", 'symmetrical': 'False', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
'display_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200', 'db_index': 'True'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'})
},
u'notifier.sentnotification': {
'Meta': {'object_name': 'SentNotification'},
'backend': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['notifier.Backend']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'notification': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['notifier.Notification']"}),
'read': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'success': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
},
u'notifier.userprefs': {
'Meta': {'unique_together': "(('user', 'notification', 'backend'),)", 'object_name': 'UserPrefs'},
'backend': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['notifier.Backend']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'notification': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['notifier.Notification']"}),
'notify': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
}
}
complete_apps = ['notifier'] | 75.096491 | 187 | 0.573882 | 874 | 8,561 | 5.528604 | 0.127002 | 0.10596 | 0.182533 | 0.260762 | 0.765728 | 0.74255 | 0.74255 | 0.672185 | 0.635555 | 0.56519 | 0 | 0.006747 | 0.18631 | 8,561 | 114 | 188 | 75.096491 | 0.686908 | 0.01133 | 0 | 0.300971 | 0 | 0 | 0.592601 | 0.358705 | 0 | 0 | 0 | 0 | 0 | 1 | 0.019417 | false | 0.009709 | 0.038835 | 0 | 0.087379 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 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 | 4 |
46b9cbc27b7eac2f4d339c2aa8b65b9ef4d3c9ae | 599 | py | Python | apps.py | harvest-project/redacted_uploader | f26e34afd802b1e9173aa8ab8123100f37067f9e | [
"Apache-2.0"
] | null | null | null | apps.py | harvest-project/redacted_uploader | f26e34afd802b1e9173aa8ab8123100f37067f9e | [
"Apache-2.0"
] | null | null | null | apps.py | harvest-project/redacted_uploader | f26e34afd802b1e9173aa8ab8123100f37067f9e | [
"Apache-2.0"
] | null | null | null | from django.apps import AppConfig
from upload_studio.executor_registry import ExecutorRegistry
class RedactedUploaderConfig(AppConfig):
name = 'plugins.redacted_uploader'
def ready(self):
from .executors import redacted_torrent_source, redacted_upload_transcode, redacted_check_file_tags
ExecutorRegistry.register_executor(redacted_torrent_source.RedactedTorrentSourceExecutor)
ExecutorRegistry.register_executor(redacted_upload_transcode.RedactedUploadTranscodeExecutor)
ExecutorRegistry.register_executor(redacted_check_file_tags.RedactedCheckFileTags)
| 42.785714 | 107 | 0.841402 | 57 | 599 | 8.491228 | 0.526316 | 0.14876 | 0.198347 | 0.247934 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113523 | 599 | 13 | 108 | 46.076923 | 0.911488 | 0 | 0 | 0 | 0 | 0 | 0.041736 | 0.041736 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 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 | 1 | 0 | 1 | 0 | 0 | 4 |
46e999fa9b58ff0eb8ad2b09881de551d80e3e08 | 1,574 | py | Python | apiserver/apiserver/api/permissions.py | protodarkstar/spaceport | ce28444765208f6c90bd32dcafed2aa4404e76a0 | [
"MIT"
] | null | null | null | apiserver/apiserver/api/permissions.py | protodarkstar/spaceport | ce28444765208f6c90bd32dcafed2aa4404e76a0 | [
"MIT"
] | null | null | null | apiserver/apiserver/api/permissions.py | protodarkstar/spaceport | ce28444765208f6c90bd32dcafed2aa4404e76a0 | [
"MIT"
] | null | null | null | from rest_framework.permissions import BasePermission, IsAuthenticated, SAFE_METHODS
class AllowMetadata(BasePermission):
def has_permission(self, request, view):
return request.method in ['OPTIONS', 'HEAD']
def is_admin_director(user):
return bool(user.is_staff or user.member.is_director or user.member.is_staff)
class IsObjOwnerOrAdmin(BasePermission):
def has_object_permission(self, request, view, obj):
return bool(request.user
and (obj.user == request.user
or is_admin_director(request.user)
)
)
class IsSessionInstructorOrAdmin(BasePermission):
def has_object_permission(self, request, view, obj):
return bool(request.user
and (obj.session.instructor == request.user
or is_admin_director(request.user)
)
)
class ReadOnly(BasePermission):
def has_permission(self, request, view):
return bool(request.method in SAFE_METHODS)
def has_object_permission(self, request, view, obj):
return bool(request.method in SAFE_METHODS)
class IsAdminOrReadOnly(BasePermission):
def has_permission(self, request, view):
return bool(
request.method in SAFE_METHODS
or request.user
and is_admin_director(request.user)
)
class IsInstructorOrReadOnly(BasePermission):
def has_permission(self, request, view):
return bool(
request.method in SAFE_METHODS
or request.user
and request.user.member.is_instructor
)
| 33.489362 | 84 | 0.675349 | 178 | 1,574 | 5.814607 | 0.224719 | 0.10628 | 0.142029 | 0.169082 | 0.659903 | 0.659903 | 0.629952 | 0.611594 | 0.562319 | 0.477295 | 0 | 0 | 0.247141 | 1,574 | 46 | 85 | 34.217391 | 0.873418 | 0 | 0 | 0.487179 | 0 | 0 | 0.006989 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.205128 | false | 0 | 0.025641 | 0.205128 | 0.589744 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
201b5fbad77b186b61455368b7cc0dd73b395d28 | 902 | py | Python | pipeline/circrange.py | Voineagulab/NeuroCirc | c35a544010a4d77ab4008490f39780b70d17d7d9 | [
"CNRI-Python"
] | null | null | null | pipeline/circrange.py | Voineagulab/NeuroCirc | c35a544010a4d77ab4008490f39780b70d17d7d9 | [
"CNRI-Python"
] | null | null | null | pipeline/circrange.py | Voineagulab/NeuroCirc | c35a544010a4d77ab4008490f39780b70d17d7d9 | [
"CNRI-Python"
] | null | null | null | class CircRange:
def __init__(self, start, end):
self.start = start
self.end = end
def __str__(self):
return '(' + str(self.start) + '-' + str(self.end) + ')'
def __len__(self):
return self.end - self.start
def __lt__(self, other):
if not isinstance(other, CircRange):
raise NotImplementedError
return (self.start, self.end) < (other.start, other.end)
def __gt__(self, other):
if not isinstance(other, CircRange):
raise NotImplementedError
return (self.start, self.end) > (other.start, other.end)
def __eq__(self, other):
if not isinstance(other, CircRange):
raise NotImplementedError
return (self.start, self.end) == (other.start, other.end)
def __hash__(self):
return hash(self.start) ^ hash(self.end)
| 27.333333 | 66 | 0.573171 | 101 | 902 | 4.841584 | 0.19802 | 0.147239 | 0.09816 | 0.08589 | 0.644172 | 0.644172 | 0.644172 | 0.644172 | 0.644172 | 0.644172 | 0 | 0 | 0.309313 | 902 | 32 | 67 | 28.1875 | 0.784912 | 0 | 0 | 0.272727 | 0 | 0 | 0.003452 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.318182 | false | 0 | 0 | 0.136364 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 4 |
201d40057ad075a15beb5c95bab77492bbb5fa57 | 62 | py | Python | coherence/__init__.py | Renata1995/Topic-Distance-and-Coherence | d567d5b3ef71ea5654f214aa3736add7f3ac94bc | [
"Apache-2.0"
] | 5 | 2018-08-25T07:16:31.000Z | 2020-11-12T00:36:15.000Z | coherence/__init__.py | Renata1995/Topic-Distance-and-Coherence | d567d5b3ef71ea5654f214aa3736add7f3ac94bc | [
"Apache-2.0"
] | 1 | 2018-09-24T16:17:47.000Z | 2018-09-24T16:17:47.000Z | coherence/__init__.py | Renata1995/Topic-Distance-and-Coherence | d567d5b3ef71ea5654f214aa3736add7f3ac94bc | [
"Apache-2.0"
] | 4 | 2018-05-07T07:52:10.000Z | 2020-11-12T00:36:18.000Z | # This package includes different measures to evaluate topics
| 31 | 61 | 0.83871 | 8 | 62 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145161 | 62 | 1 | 62 | 62 | 0.981132 | 0.951613 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 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 | 4 |
202628230e7c2a654490134966f893175f68d7e7 | 85 | py | Python | projects/examples/__init__.py | fgoettel/knx | 23cc02043a68528c0400ec7af0c626be3d528e75 | [
"Unlicense"
] | null | null | null | projects/examples/__init__.py | fgoettel/knx | 23cc02043a68528c0400ec7af0c626be3d528e75 | [
"Unlicense"
] | null | null | null | projects/examples/__init__.py | fgoettel/knx | 23cc02043a68528c0400ec7af0c626be3d528e75 | [
"Unlicense"
] | null | null | null | """Some basic examples how to extract information from different project exports."""
| 42.5 | 84 | 0.788235 | 11 | 85 | 6.090909 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129412 | 85 | 1 | 85 | 85 | 0.905405 | 0.917647 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 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 | 4 |
2029d804f8b9a4d359cb25713f4eddb97782bdd2 | 91 | py | Python | cmc/modules/cryptocurrency/__init__.py | Devansh3712/cmc-py | e3f9687914d92cd95bd5a7c04e6103345ba43a3d | [
"MIT"
] | 2 | 2022-02-19T15:51:22.000Z | 2022-02-20T18:26:14.000Z | cmc/modules/cryptocurrency/__init__.py | Devansh3712/py-cmc | e3f9687914d92cd95bd5a7c04e6103345ba43a3d | [
"MIT"
] | 6 | 2022-02-21T10:50:43.000Z | 2022-03-03T15:44:09.000Z | cmc/modules/cryptocurrency/__init__.py | Devansh3712/py-cmc | e3f9687914d92cd95bd5a7c04e6103345ba43a3d | [
"MIT"
] | 2 | 2022-02-20T01:43:35.000Z | 2022-03-13T09:34:51.000Z | #!/usr/bin/env python
"""Module for classes fetching data related to CryptoCurrencies."""
| 22.75 | 67 | 0.747253 | 12 | 91 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120879 | 91 | 3 | 68 | 30.333333 | 0.85 | 0.901099 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 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 | 4 |
64503dc33d6f192c7d5375e86ba4a6fd0a98944f | 1,315 | py | Python | setup.py | yilbegan/vbio | 5041a1ac6e554a107f57433372bcdfad6a6a4e0b | [
"MIT"
] | 19 | 2019-04-14T14:52:27.000Z | 2022-01-03T19:16:42.000Z | setup.py | yilbegan/vbio | 5041a1ac6e554a107f57433372bcdfad6a6a4e0b | [
"MIT"
] | 3 | 2019-05-04T15:41:35.000Z | 2019-09-09T22:42:25.000Z | setup.py | yilbegan/vbio | 5041a1ac6e554a107f57433372bcdfad6a6a4e0b | [
"MIT"
] | 4 | 2019-08-20T10:33:01.000Z | 2021-08-31T07:57:41.000Z | # -*- coding: utf-8 -*-
import setuptools
import vbio
setuptools.setup(
name="vbio",
version=vbio.__version__,
author=vbio.__author__,
description=u'Python модуль для написания скриптов, использующих '
u'Callback API для социальной сети '
u'Вконтакте (vk.com)',
url='https://github.com/yilbegan/vbio',
license='MIT',
long_description=open('README.md', encoding='utf-8').read(),
long_description_content_type='text/markdown',
packages=['vbio', 'vbio.handlers'],
install_requires=['requests'],
extras_require={
'webhook': ['Flask'],
'color': ['colorama']
},
classifiers=[
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: Implementation :: CPython',
]
)
| 29.222222 | 70 | 0.601521 | 128 | 1,315 | 6.070313 | 0.5625 | 0.24453 | 0.32175 | 0.16731 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014199 | 0.25019 | 1,315 | 44 | 71 | 29.886364 | 0.773834 | 0.01597 | 0 | 0 | 0 | 0 | 0.543344 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.058824 | 0 | 0.058824 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
645a2fbcd32a5084209b0cd0728bb1f7370278da | 251 | py | Python | ver1_0/openassembly/oa_cache/admin.py | fragro/Open-Assembly | e9679ff5e7ae9881fa5781d763288ed2f40b014d | [
"BSD-3-Clause"
] | 1 | 2015-11-05T08:22:19.000Z | 2015-11-05T08:22:19.000Z | ver1_0/openassembly/oa_cache/admin.py | fragro/Open-Assembly | e9679ff5e7ae9881fa5781d763288ed2f40b014d | [
"BSD-3-Clause"
] | null | null | null | ver1_0/openassembly/oa_cache/admin.py | fragro/Open-Assembly | e9679ff5e7ae9881fa5781d763288ed2f40b014d | [
"BSD-3-Clause"
] | 1 | 2018-02-03T18:25:41.000Z | 2018-02-03T18:25:41.000Z | from django.contrib import admin
from oa_cache.models import UserSaltCache, ListCache, ModelCache, SideEffectCache
admin.site.register(UserSaltCache)
admin.site.register(ListCache)
admin.site.register(ModelCache)
admin.site.register(SideEffectCache)
| 31.375 | 81 | 0.85259 | 30 | 251 | 7.1 | 0.466667 | 0.169014 | 0.319249 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063745 | 251 | 7 | 82 | 35.857143 | 0.906383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
6485c4129ed444b245701ff6f59c3948f228799b | 101 | py | Python | Luck/urls.py | MasoudHeidary/django-telegram-bot-trade | 7032428e5e04cb02bb081dcc4d86a585a773ada0 | [
"MIT"
] | null | null | null | Luck/urls.py | MasoudHeidary/django-telegram-bot-trade | 7032428e5e04cb02bb081dcc4d86a585a773ada0 | [
"MIT"
] | null | null | null | Luck/urls.py | MasoudHeidary/django-telegram-bot-trade | 7032428e5e04cb02bb081dcc4d86a585a773ada0 | [
"MIT"
] | null | null | null | from django.urls import path
from .views import luck_page
urlpatterns = [
path('', luck_page),
] | 16.833333 | 28 | 0.712871 | 14 | 101 | 5 | 0.642857 | 0.228571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178218 | 101 | 6 | 29 | 16.833333 | 0.843373 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 4 |
64c39711d48a6a1ffa9cc9191054b1c8c622e1b0 | 110 | py | Python | waio/factory/models/webhook.py | dotX12/waio | 6bc41df2d650f31fdb11a1a2b67c6149afa0e11a | [
"MIT"
] | 24 | 2021-11-08T13:37:05.000Z | 2022-03-24T12:49:54.000Z | waio/factory/models/webhook.py | dotX12/waio | 6bc41df2d650f31fdb11a1a2b67c6149afa0e11a | [
"MIT"
] | 1 | 2022-01-19T03:11:58.000Z | 2022-01-19T03:13:30.000Z | waio/factory/models/webhook.py | dotX12/waio | 6bc41df2d650f31fdb11a1a2b67c6149afa0e11a | [
"MIT"
] | 5 | 2021-11-11T04:11:12.000Z | 2022-02-15T10:41:58.000Z | # from dataclasses import dataclass
#
#
# @dataclass
# class PayloadWebhook:
# phone: str
# type: str
| 13.75 | 35 | 0.663636 | 11 | 110 | 6.636364 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.236364 | 110 | 7 | 36 | 15.714286 | 0.869048 | 0.863636 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 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 | 4 |
64de3f7b8e5be6a133536eac5667a8e9e431d98f | 125 | py | Python | solution/practice/algorithms/warmup/solve-me-first/solution.py | satyam857/HackerRank | b6c0c199a5e320b1b59fdedafda2630258314b76 | [
"MIT"
] | 158 | 2017-03-17T19:43:14.000Z | 2022-03-23T04:10:33.000Z | solution/practice/algorithms/warmup/solve-me-first/solution.py | skatsd/HackerRank | 74918aa46144150f4da0986c27d6762afe7c4ef3 | [
"MIT"
] | 2 | 2018-06-13T02:41:19.000Z | 2020-06-03T19:43:58.000Z | solution/practice/algorithms/warmup/solve-me-first/solution.py | skatsd/HackerRank | 74918aa46144150f4da0986c27d6762afe7c4ef3 | [
"MIT"
] | 67 | 2017-08-03T02:52:24.000Z | 2022-03-25T03:22:01.000Z | # Not that much to say here.
# * input() * 2
# * map to int
# * sum them
# * print
print(sum(map(int, (input(), input()))))
| 15.625 | 40 | 0.56 | 20 | 125 | 3.5 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010309 | 0.224 | 125 | 7 | 41 | 17.857143 | 0.71134 | 0.576 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 4 |
b37886c05585fff6f9135b66334b37d783029463 | 316 | py | Python | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/apps.py | julianwagle/cookiecutter-django-react | bce2e264cc90bfe89bb7f6f1300441f725731b12 | [
"BSD-3-Clause"
] | 2 | 2021-08-10T18:33:49.000Z | 2021-11-09T15:37:51.000Z | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/apps.py | julianwagle/cookiecutter-django-react | bce2e264cc90bfe89bb7f6f1300441f725731b12 | [
"BSD-3-Clause"
] | 1 | 2022-03-10T23:38:06.000Z | 2022-03-11T15:22:48.000Z | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/apps.py | julianwagle/cookiecutter-django-react | bce2e264cc90bfe89bb7f6f1300441f725731b12 | [
"BSD-3-Clause"
] | 1 | 2021-08-13T21:34:33.000Z | 2021-08-13T21:34:33.000Z | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class UsersConfig(AppConfig):
name = "{{ cookiecutter.project_slug }}.users"
label = 'users'
verbose_name = _("Users")
def ready(self):
import {{cookiecutter.project_slug}}.users.signals # noqa F401
| 26.333333 | 71 | 0.708861 | 37 | 316 | 5.891892 | 0.675676 | 0.091743 | 0.211009 | 0.256881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011628 | 0.183544 | 316 | 11 | 72 | 28.727273 | 0.833333 | 0.028481 | 0 | 0 | 0 | 0 | 0.154098 | 0.081967 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.375 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
b3b25da3f0da36a03ce2f0cc74795250c734af5d | 106 | py | Python | pytnyu/__init__.py | TechAtNYU/api-python | 26cfa78208f30c41095484422cd1232aeddbfcb2 | [
"MIT"
] | null | null | null | pytnyu/__init__.py | TechAtNYU/api-python | 26cfa78208f30c41095484422cd1232aeddbfcb2 | [
"MIT"
] | null | null | null | pytnyu/__init__.py | TechAtNYU/api-python | 26cfa78208f30c41095484422cd1232aeddbfcb2 | [
"MIT"
] | null | null | null | __import__('pkg_resources').declare_namespace(__name__)
TNYU_API_VERSION = 'v3'
from .api import TNYUAPI
| 21.2 | 55 | 0.811321 | 14 | 106 | 5.285714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010309 | 0.084906 | 106 | 4 | 56 | 26.5 | 0.752577 | 0 | 0 | 0 | 0 | 0 | 0.141509 | 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 | 1 | 0 | 0 | 4 |
37332b698822c83d595f3cf05905f52fca690a55 | 104 | py | Python | src/common.py | gridsmartercities/python-serverless-template | a9f5d91cd5a83ecf17ca4e5e26f594e963164e20 | [
"MIT"
] | 9 | 2020-08-07T18:04:02.000Z | 2022-02-24T14:34:24.000Z | src/common.py | gridsmartercities/python-serverless-template | a9f5d91cd5a83ecf17ca4e5e26f594e963164e20 | [
"MIT"
] | 1 | 2019-07-30T12:16:24.000Z | 2019-08-02T12:54:45.000Z | src/common.py | gridsmartercities/python-serverless-template | a9f5d91cd5a83ecf17ca4e5e26f594e963164e20 | [
"MIT"
] | 2 | 2020-08-05T10:27:17.000Z | 2022-02-24T14:37:35.000Z | def hello_func(name: str) -> dict:
msg = "HELLO FROM %s" % name.upper()
return {"message": msg}
| 26 | 40 | 0.596154 | 15 | 104 | 4.066667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221154 | 104 | 3 | 41 | 34.666667 | 0.753086 | 0 | 0 | 0 | 0 | 0 | 0.192308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
374c7a7800f14012a02374e1c4c0dd686f547d78 | 659 | py | Python | packages/vaex-core/vaex/arrow/opener.py | cyrusradfar/vaex | 6a37bd4509c9a0823b4f01075049f3331fabea77 | [
"MIT"
] | 1 | 2020-08-31T17:53:01.000Z | 2020-08-31T17:53:01.000Z | packages/vaex-core/vaex/arrow/opener.py | cyrusradfar/vaex | 6a37bd4509c9a0823b4f01075049f3331fabea77 | [
"MIT"
] | null | null | null | packages/vaex-core/vaex/arrow/opener.py | cyrusradfar/vaex | 6a37bd4509c9a0823b4f01075049f3331fabea77 | [
"MIT"
] | null | null | null | import vaex.file
class ArrowOpener:
@staticmethod
def can_open(path, *args, **kwargs):
return path.rpartition('.')[2] == 'arrow'
@staticmethod
def open(path, *args, **kwargs):
from .dataset import open
return open(path, *args, **kwargs)
class ParquetOpener:
@staticmethod
def can_open(path, *args, **kwargs):
return path.rpartition('.')[2] == 'parquet'
@staticmethod
def open(path, *args, **kwargs):
from .dataset import open_parquet
return open_parquet(path, *args, **kwargs)
def register_opener():
vaex.file.register(ArrowOpener)
vaex.file.register(ParquetOpener)
| 25.346154 | 51 | 0.640364 | 74 | 659 | 5.635135 | 0.297297 | 0.115108 | 0.201439 | 0.215827 | 0.532374 | 0.532374 | 0.532374 | 0.532374 | 0.532374 | 0.532374 | 0 | 0.003906 | 0.223065 | 659 | 25 | 52 | 26.36 | 0.810547 | 0 | 0 | 0.4 | 0 | 0 | 0.021244 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.15 | 0.1 | 0.7 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
375bd03d0d0a628b4f27dc561248bb518d6c6abd | 190 | py | Python | src/9sem/dict.py | freepvps/hsesamples | adbf35c1c94521d78fb75f72287512a37e49bdc8 | [
"MIT"
] | 2 | 2019-10-19T22:29:50.000Z | 2019-10-19T22:29:52.000Z | src/9sem/dict.py | freepvps/hsesamples | adbf35c1c94521d78fb75f72287512a37e49bdc8 | [
"MIT"
] | null | null | null | src/9sem/dict.py | freepvps/hsesamples | adbf35c1c94521d78fb75f72287512a37e49bdc8 | [
"MIT"
] | null | null | null | a = {1: '1', 2: '10', 3: '11'}
a[4] = '100'
a[2] = 'mwlde'
a.setdefault(5, '23')
a.setdefault(2, '23')
print(a[3])
print(a[5])
print(a.get(6))
print(a.pop(5))
print(a.pop(5, None))
print(a)
| 15.833333 | 30 | 0.542105 | 42 | 190 | 2.452381 | 0.404762 | 0.349515 | 0.135922 | 0.194175 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145455 | 0.131579 | 190 | 11 | 31 | 17.272727 | 0.478788 | 0 | 0 | 0 | 0 | 0 | 0.089474 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.545455 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
3766d99e3c35a257c5fff90ba3b9e5a265025fda | 183 | py | Python | solution/lc980.py | sth4nothing/pyleetcode | 70ac2dc55b0cbcd243b38103a96dd796538a3c05 | [
"MIT"
] | null | null | null | solution/lc980.py | sth4nothing/pyleetcode | 70ac2dc55b0cbcd243b38103a96dd796538a3c05 | [
"MIT"
] | null | null | null | solution/lc980.py | sth4nothing/pyleetcode | 70ac2dc55b0cbcd243b38103a96dd796538a3c05 | [
"MIT"
] | null | null | null | #
# @lc app=leetcode.cn id=943 lang=python3
#
# [943] 最短超级串
#
# @lc code=start
class Solution:
def shortestSuperstring(self, A: 'List[str]') -> str:
pass
# @lc code=end
| 14.076923 | 57 | 0.617486 | 26 | 183 | 4.346154 | 0.807692 | 0.106195 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048951 | 0.218579 | 183 | 12 | 58 | 15.25 | 0.741259 | 0.431694 | 0 | 0 | 0 | 0 | 0.094737 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.333333 | 0 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 4 |
3771aed62aa3595a20b822b67c8961b4ecb16fb0 | 263 | py | Python | App/models.py | Super-6-Group/AXF | 97836333d4ca7d1763ff8f89cfb03538c2268d68 | [
"Apache-2.0"
] | null | null | null | App/models.py | Super-6-Group/AXF | 97836333d4ca7d1763ff8f89cfb03538c2268d68 | [
"Apache-2.0"
] | null | null | null | App/models.py | Super-6-Group/AXF | 97836333d4ca7d1763ff8f89cfb03538c2268d68 | [
"Apache-2.0"
] | null | null | null | from App.ext import db
class HomeBanner(db.Model):
__tablename__ = 'axf_wheel'
id = db.Column(db.Integer,autoincrement=True,primary_key=True)
img = db.Column(db.String(200))
name = db.Column(db.String(200))
trackid = db.Column(db.String(16)) | 29.222222 | 66 | 0.695817 | 40 | 263 | 4.425 | 0.6 | 0.180791 | 0.225989 | 0.271186 | 0.214689 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036199 | 0.159696 | 263 | 9 | 67 | 29.222222 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0.034091 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 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 | 1 | 0 | 0 | 4 |
3772bf29571be3ed11a4ba010ace385c873f7d85 | 151 | py | Python | giant_time_series/__init__.py | earthobservatory/giant_time_series | eb6fc839f62da74e82a417e404ec0d65ceacd559 | [
"Apache-2.0"
] | null | null | null | giant_time_series/__init__.py | earthobservatory/giant_time_series | eb6fc839f62da74e82a417e404ec0d65ceacd559 | [
"Apache-2.0"
] | null | null | null | giant_time_series/__init__.py | earthobservatory/giant_time_series | eb6fc839f62da74e82a417e404ec0d65ceacd559 | [
"Apache-2.0"
] | null | null | null | __version__ = "0.0.1"
__url__ = "https://github.com/hysds/giant_time_series"
__description__ = "GIAnT time series processing of ISCEv2 interferograms"
| 37.75 | 73 | 0.788079 | 20 | 151 | 5.25 | 0.8 | 0.171429 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0.099338 | 151 | 3 | 74 | 50.333333 | 0.742647 | 0 | 0 | 0 | 0 | 0 | 0.662252 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
378da389f4064b579f75746acf332b9320870c60 | 7,769 | py | Python | exasol_integration_test_docker_environment/test/test_test_environment_docker_runtime.py | exasol/integration-test-docker-environment | 35850f67cd4cde010f03dd556d1a0f74b3291eb8 | [
"MIT"
] | 4 | 2020-06-25T20:47:31.000Z | 2021-09-10T15:22:51.000Z | exasol_integration_test_docker_environment/test/test_test_environment_docker_runtime.py | exasol/integration-test-docker-environment | 35850f67cd4cde010f03dd556d1a0f74b3291eb8 | [
"MIT"
] | 113 | 2020-06-02T08:51:08.000Z | 2022-03-31T08:47:41.000Z | exasol_integration_test_docker_environment/test/test_test_environment_docker_runtime.py | exasol/integration-test-docker-environment | 35850f67cd4cde010f03dd556d1a0f74b3291eb8 | [
"MIT"
] | 2 | 2020-05-19T10:57:47.000Z | 2020-06-22T13:32:20.000Z | import unittest
from exasol_integration_test_docker_environment.lib.docker import ContextDockerClient
from exasol_integration_test_docker_environment.testing import utils
from exasol_integration_test_docker_environment.testing.exaslct_test_environment import ExaslctTestEnvironment
def assert_container_runtime(self, container_name, expected_runtime):
on_host_docker_environment = self.spawned_docker_test_environments.on_host_docker_environment
with ContextDockerClient() as docker_client:
try:
container = docker_client.containers.get(container_name)
container.reload()
actual_runtime = container.attrs['HostConfig']['Runtime']
except Exception as e:
startup_log = on_host_docker_environment.completed_process.stdout.decode("utf8")
raise Exception(f"Startup log: {startup_log}") from e
self.assertEqual(actual_runtime, expected_runtime,
f"{container_name} has the wrong runtime expected {expected_runtime} got {actual_runtime}."
f"\n Startup log is "
f"{on_host_docker_environment.completed_process.stdout.decode('utf8')}")
def get_default_docker_runtime():
with ContextDockerClient() as docker_client:
tmp_container = docker_client.containers.create("ubuntu:18.04", "echo")
try:
tmp_container.reload()
default_docker_runtime = tmp_container.attrs['HostConfig']['Runtime']
finally:
tmp_container.remove(force=True)
return default_docker_runtime
class DockerTestEnvironmentDockerRuntimeNoRuntimeGivenTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
print(f"SetUp {cls.__name__}")
# We can't use start-test-env. because it only mounts ./ and
# doesn't work with --build_ouput-directory
cls.test_environment = \
ExaslctTestEnvironment(
cls,
utils.INTEGRATION_TEST_DOCKER_ENVIRONMENT_DEFAULT_BIN,
clean_images_at_close=False)
cls.docker_environment_name = "test_no_runtime_given"
cls.spawned_docker_test_environments = \
cls.test_environment.spawn_docker_test_environments(name=cls.docker_environment_name,
additional_parameter=[
"--deactivate-database-setup"
])
cls.default_docker_runtime = get_default_docker_runtime()
@classmethod
def tearDownClass(cls):
utils.close_environments(cls.spawned_docker_test_environments, cls.test_environment)
def test_test_container_runtime(self):
try:
environment_info = self.spawned_docker_test_environments.on_host_docker_environment.environment_info
test_container_name = environment_info.test_container_info.container_name
except Exception as e:
startup_log = self.spawned_docker_test_environments\
.on_host_docker_environment.completed_process.stdout.decode("utf8")
raise Exception(f"Startup log: {startup_log}") from e
assert_container_runtime(self, test_container_name, self.default_docker_runtime)
def test_database_container_runtime(self):
try:
environment_info = self.spawned_docker_test_environments.on_host_docker_environment.environment_info
database_container_name = environment_info.database_info.container_info.container_name
except Exception as e:
startup_log = \
self.spawned_docker_test_environments.on_host_docker_environment.completed_process.stdout.decode("utf8")
raise Exception(f"Startup log: {startup_log}") from e
assert_container_runtime(self, database_container_name, self.default_docker_runtime)
class DockerTestEnvironmentDockerRuntimeDefaultRuntimeGivenTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
print(f"SetUp {cls.__name__}")
# We can't use start-test-env. because it only mounts ./ and
# doesn't work with --build_ouput-directory
cls.test_environment = \
ExaslctTestEnvironment(
cls,
utils.INTEGRATION_TEST_DOCKER_ENVIRONMENT_DEFAULT_BIN,
clean_images_at_close=False)
cls.default_docker_runtime = get_default_docker_runtime()
cls.docker_environment_name = "test_default_runtime_given"
cls.spawned_docker_test_environments = cls.test_environment.spawn_docker_test_environments(
cls.docker_environment_name,
additional_parameter=[
"--docker-runtime", cls.default_docker_runtime,
"--deactivate-database-setup",
])
@classmethod
def tearDownClass(cls):
utils.close_environments(cls.spawned_docker_test_environments, cls.test_environment)
def test_test_container_runtime(self):
on_host_docker_environment = self.spawned_docker_test_environments.on_host_docker_environment
try:
environment_info = on_host_docker_environment.environment_info
test_container_name = environment_info.test_container_info.container_name
except Exception as e:
startup_log = on_host_docker_environment.completed_process.stdout.decode("utf8")
raise Exception(f"Startup log: {startup_log}") from e
assert_container_runtime(self, test_container_name, self.default_docker_runtime)
def test_database_container_runtime(self):
on_host_docker_environment = self.spawned_docker_test_environments.on_host_docker_environment
try:
environment_info = on_host_docker_environment.environment_info
database_container_name = environment_info.database_info.container_info.container_name
except Exception as e:
startup_log = on_host_docker_environment.completed_process.stdout.decode("utf8")
raise Exception(f"Startup log: {startup_log}") from e
assert_container_runtime(self, database_container_name, self.default_docker_runtime)
class DockerTestEnvironmentDockerRuntimeInvalidRuntimeGivenTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
print(f"SetUp {cls.__name__}")
# We can't use start-test-env. because it only mounts ./ and
# doesn't work with --build_ouput-directory
cls.test_environment = \
ExaslctTestEnvironment(
cls,
utils.INTEGRATION_TEST_DOCKER_ENVIRONMENT_DEFAULT_BIN,
clean_images_at_close=False)
cls.default_docker_runtime = get_default_docker_runtime()
cls.docker_environment_name = "test_default_runtime_given"
cls.docker_environments = ()
try:
cls.spawned_docker_test_environments = cls.test_environment.spawn_docker_test_environments(
cls.docker_environment_name,
additional_parameter=[
"--docker-runtime", "AAAABBBBCCCC_INVALID_RUNTIME_111122223333",
"--deactivate-database-setup",
])
except Exception as e:
pass
@classmethod
def tearDownClass(cls):
try:
utils.close_environments(cls.spawned_docker_test_environments)
except Exception as e:
print(e)
utils.close_environments(cls.test_environment)
def test_docker_environment_not_available(self):
self.assertFalse("spawned_docker_test_environments" in self.__dict__)
if __name__ == '__main__':
unittest.main()
| 47.084848 | 120 | 0.689149 | 820 | 7,769 | 6.119512 | 0.143902 | 0.098246 | 0.074532 | 0.073336 | 0.771821 | 0.752092 | 0.72778 | 0.70825 | 0.688322 | 0.677362 | 0 | 0.003747 | 0.244304 | 7,769 | 164 | 121 | 47.371951 | 0.850962 | 0.038872 | 0 | 0.69403 | 0 | 0 | 0.093968 | 0.039544 | 0 | 0 | 0 | 0 | 0.052239 | 1 | 0.097015 | false | 0.007463 | 0.029851 | 0 | 0.156716 | 0.029851 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 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 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.