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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7a5b2d6409f3089199962be2437ffc2922d1f6ba
| 181
|
py
|
Python
|
sheet_disk/cli.py
|
vinay-deshmukh/Sheet-Disk
|
8948afe870c92a2a85ea5c281c66ce9ff15290c2
|
[
"MIT"
] | 20
|
2018-12-06T17:54:08.000Z
|
2021-11-11T06:48:56.000Z
|
sheet_disk/cli.py
|
vinay-deshmukh/Sheet-Disk
|
8948afe870c92a2a85ea5c281c66ce9ff15290c2
|
[
"MIT"
] | 1
|
2020-11-22T19:35:39.000Z
|
2020-11-22T19:53:02.000Z
|
sheet_disk/cli.py
|
vinay-deshmukh/Sheet-Disk
|
8948afe870c92a2a85ea5c281c66ce9ff15290c2
|
[
"MIT"
] | 2
|
2020-11-22T19:32:00.000Z
|
2020-11-30T02:05:37.000Z
|
'''Wrapper file around the main function
in sheet_disk, so module can be called from Command Line Interface'''
from .sheet_disk import main
if __name__ == '__main__':
main()
| 22.625
| 69
| 0.734807
| 27
| 181
| 4.555556
| 0.777778
| 0.146341
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.18232
| 181
| 7
| 70
| 25.857143
| 0.831081
| 0.580111
| 0
| 0
| 0
| 0
| 0.114286
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
7a8f069fb3c9a16b0bb938d24755cb9333c6a4d2
| 384
|
py
|
Python
|
descwl_shear_sims/__init__.py
|
aguinot/descwl-shear-sims
|
a808ffb377b1936964db312e87bd72299268ff2e
|
[
"BSD-3-Clause"
] | 5
|
2020-11-30T17:40:00.000Z
|
2021-07-13T22:27:30.000Z
|
descwl_shear_sims/__init__.py
|
aguinot/descwl-shear-sims
|
a808ffb377b1936964db312e87bd72299268ff2e
|
[
"BSD-3-Clause"
] | 128
|
2020-01-06T21:21:56.000Z
|
2022-02-07T14:02:28.000Z
|
descwl_shear_sims/__init__.py
|
aguinot/descwl-shear-sims
|
a808ffb377b1936964db312e87bd72299268ff2e
|
[
"BSD-3-Clause"
] | 1
|
2021-07-11T13:40:49.000Z
|
2021-07-11T13:40:49.000Z
|
# flake8: noqa
from .version import __version__
from . import sim
from .sim import make_sim
from . import constants
from .constants import *
from . import lsst_bits
from . import psfs
from . import stars
from . import galaxies
from . import objlists
from . import surveys
from . import shifts
from . import constants
from . import artifacts
from . import masking
from . import wcs
| 18.285714
| 32
| 0.768229
| 54
| 384
| 5.351852
| 0.351852
| 0.449827
| 0.131488
| 0.15917
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003185
| 0.182292
| 384
| 20
| 33
| 19.2
| 0.917197
| 0.03125
| 0
| 0.125
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
7aba7572fe35fca3c8c872a4f9ced73860ac5613
| 577
|
py
|
Python
|
src/ggrc_risks/views/__init__.py
|
mikecb/ggrc-core
|
1cda560cb0920021416e07740c6cca1acba56268
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
src/ggrc_risks/views/__init__.py
|
mikecb/ggrc-core
|
1cda560cb0920021416e07740c6cca1acba56268
|
[
"ECL-2.0",
"Apache-2.0"
] | 1
|
2021-03-26T00:24:35.000Z
|
2021-03-26T00:24:35.000Z
|
src/ggrc_risks/views/__init__.py
|
mikecb/ggrc-core
|
1cda560cb0920021416e07740c6cca1acba56268
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
from ggrc.app import app
from ggrc.login import login_required
from ggrc_risks.views import converters
from flask import render_template
def risk_admin():
"""Special admin page to show risks
TODO: Dry this up, override existing admin url.
"""
return render_template("admin/risk_index.haml")
def init_extra_views(app):
pass
| 26.227273
| 78
| 0.769497
| 86
| 577
| 5.069767
| 0.686047
| 0.055046
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012097
| 0.140381
| 577
| 21
| 79
| 27.47619
| 0.866935
| 0.538995
| 0
| 0
| 0
| 0
| 0.083333
| 0.083333
| 0
| 0
| 0
| 0.047619
| 0
| 1
| 0.25
| false
| 0.125
| 0.5
| 0
| 0.875
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 0
|
0
| 4
|
8ff67313954f1156817972280a42d16667d7fe90
| 200
|
py
|
Python
|
bitswap/message/proto_buff.py
|
VladislavSufyanov/py-bitswap
|
875d15944e485c33b16af9965f24c1d85cb34c55
|
[
"MIT"
] | null | null | null |
bitswap/message/proto_buff.py
|
VladislavSufyanov/py-bitswap
|
875d15944e485c33b16af9965f24c1d85cb34c55
|
[
"MIT"
] | null | null | null |
bitswap/message/proto_buff.py
|
VladislavSufyanov/py-bitswap
|
875d15944e485c33b16af9965f24c1d85cb34c55
|
[
"MIT"
] | null | null | null |
from .pb.message_pb2 import Message
class ProtoBuff:
Message = Message
WantList = Message.Wantlist
WantType = Message.Wantlist.WantType
BlockPresenceType = Message.BlockPresenceType
| 22.222222
| 49
| 0.765
| 20
| 200
| 7.6
| 0.5
| 0.296053
| 0.302632
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006098
| 0.18
| 200
| 8
| 50
| 25
| 0.920732
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 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
| 0
| 0
|
0
| 4
|
8902b3f108032e70fe6040fb44b22ed0ebd6b05d
| 176
|
py
|
Python
|
fftbg/progress.py
|
rainbowbismuth/birb-brains-bot
|
f168ec06c5c5cc8d41589437c6f91f0d97289167
|
[
"MIT"
] | 1
|
2020-12-01T01:31:31.000Z
|
2020-12-01T01:31:31.000Z
|
fftbg/progress.py
|
rainbowbismuth/birb-brains-bot
|
f168ec06c5c5cc8d41589437c6f91f0d97289167
|
[
"MIT"
] | 2
|
2021-05-30T21:10:16.000Z
|
2021-05-30T21:10:44.000Z
|
fftbg/progress.py
|
rainbowbismuth/birb-brains-bot
|
f168ec06c5c5cc8d41589437c6f91f0d97289167
|
[
"MIT"
] | null | null | null |
import os
def progress_bar(iterable):
if int(os.environ.get('PROGRESS_BAR', 0)):
import tqdm
return tqdm.tqdm(iterable)
else:
return iterable
| 17.6
| 46
| 0.630682
| 23
| 176
| 4.73913
| 0.608696
| 0.201835
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007813
| 0.272727
| 176
| 9
| 47
| 19.555556
| 0.84375
| 0
| 0
| 0
| 0
| 0
| 0.068182
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.285714
| 0
| 0.714286
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
890350df306446d9bcf80ceab96b626666996412
| 120
|
py
|
Python
|
peek_at_cocktails.py
|
bethskw/botcocktails
|
1090d6e85161efb174891911a4cdb4523c97719a
|
[
"MIT"
] | 3
|
2019-02-20T21:47:08.000Z
|
2021-03-19T19:23:17.000Z
|
peek_at_cocktails.py
|
bethskw/botcocktails
|
1090d6e85161efb174891911a4cdb4523c97719a
|
[
"MIT"
] | null | null | null |
peek_at_cocktails.py
|
bethskw/botcocktails
|
1090d6e85161efb174891911a4cdb4523c97719a
|
[
"MIT"
] | 1
|
2018-11-27T22:03:24.000Z
|
2018-11-27T22:03:24.000Z
|
from textgenrnn import textgenrnn
textgen = textgenrnn('textgenrnn_weights.hdf5')
textgen.generate(20, temperature=0.5)
| 30
| 47
| 0.825
| 15
| 120
| 6.533333
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.045045
| 0.075
| 120
| 3
| 48
| 40
| 0.837838
| 0
| 0
| 0
| 1
| 0
| 0.191667
| 0.191667
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
8913764ae1093fca1eae7d23c60bf06ae48567d3
| 1,764
|
py
|
Python
|
django_app/migrations/0016_auto_20210127_1728.py
|
jorgeassis/darwinCoreGUI
|
3cfd1752acb77fd56ad4511d9e1a83bc86252449
|
[
"CC0-1.0"
] | null | null | null |
django_app/migrations/0016_auto_20210127_1728.py
|
jorgeassis/darwinCoreGUI
|
3cfd1752acb77fd56ad4511d9e1a83bc86252449
|
[
"CC0-1.0"
] | null | null | null |
django_app/migrations/0016_auto_20210127_1728.py
|
jorgeassis/darwinCoreGUI
|
3cfd1752acb77fd56ad4511d9e1a83bc86252449
|
[
"CC0-1.0"
] | null | null | null |
# Generated by Django 3.1.3 on 2021-01-27 17:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_app', '0015_auto_20201111_0927'),
]
operations = [
migrations.AddField(
model_name='speciesrecords',
name='conservationIUCNEurope',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='speciesrecords',
name='conservationIUCNGlobal',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='speciesrecords',
name='conservationN2000',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='speciesrecords',
name='conservationN2000Code',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='speciesrecords',
name='conservationRedBookPt',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='speciesrecords',
name='description',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='speciesrecords',
name='descriptionSource',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='speciesrecords',
name='mainMediaFile',
field=models.CharField(blank=True, max_length=255, null=True),
),
]
| 32.666667
| 74
| 0.590703
| 160
| 1,764
| 6.4
| 0.2875
| 0.140625
| 0.179688
| 0.210938
| 0.710938
| 0.710938
| 0.666992
| 0.666992
| 0.666992
| 0.666992
| 0
| 0.045968
| 0.297052
| 1,764
| 53
| 75
| 33.283019
| 0.779839
| 0.02551
| 0
| 0.680851
| 1
| 0
| 0.168317
| 0.063483
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.021277
| 0
| 0.085106
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
64e46001ed797e0054233ca4cb53d6aedb49bef2
| 1,731
|
py
|
Python
|
tests/v1/conftest.py
|
PWRScript/GlobalProgramLib
|
bb297355dfa9dba20106879bfbd839eb45f2569e
|
[
"MIT"
] | null | null | null |
tests/v1/conftest.py
|
PWRScript/GlobalProgramLib
|
bb297355dfa9dba20106879bfbd839eb45f2569e
|
[
"MIT"
] | 2
|
2021-11-18T10:27:29.000Z
|
2021-11-22T21:20:37.000Z
|
tests/v1/conftest.py
|
PWRScript/GlobalProgramLib
|
bb297355dfa9dba20106879bfbd839eb45f2569e
|
[
"MIT"
] | null | null | null |
import pytest
from globalprogramlib.v1 import Language, Translator
@pytest.fixture()
def sync_pt_language():
pt = Language()
pt.name = "Portugu\u00eas"
pt.code = "pt"
pt.version = 1
pt.revision = 1
pt.authors = ["PWRScript"]
pt.contributors = []
pt.translations = {"bot.bye_message": "Adeus", "bot.thank_message": "Obrigado"}
return pt
@pytest.fixture()
async def async_pt_language():
pt = await Language()
pt.name = "Portugu\u00eas"
pt.code = "pt"
pt.version = 1
pt.revision = 1
pt.authors = ["PWRScript"]
pt.contributors = []
pt.translations = {"bot.bye_message": "Adeus", "bot.thank_message": "Obrigado"}
return pt
@pytest.fixture()
def sync_en_language():
en = Language()
en.name = "English"
en.code = "en"
en.version = 1
en.revision = 1
en.authors = ["PWRScript"]
en.contributors = []
en.translations = {"bot.thank_message": "Thanks"}
return en
@pytest.fixture()
async def async_en_language():
en = await Language()
en.name = "English"
en.code = "en"
en.version = 1
en.revision = 1
en.authors = ["PWRScript"]
en.contributors = []
en.translations = {"bot.thank_message": "Thanks"}
return en
@pytest.fixture()
def translator():
tr = Translator()
tr.load_file("tests/data/pt.json")
tr.load_file("tests/data/en.json")
tr.DefaultLanguageCode = "en"
tr.SelectedLanguageCode = "pt"
return tr
@pytest.fixture()
async def async_translator():
tr = await Translator()
await tr.async_load_file("tests/data/en.json")
await tr.async_load_file("tests/data/pt.json")
tr.DefaultLanguageCode = "en"
tr.SelectedLanguageCode = "pt"
return tr
| 23.08
| 83
| 0.636626
| 217
| 1,731
| 4.981567
| 0.193548
| 0.072155
| 0.055504
| 0.062905
| 0.819611
| 0.769658
| 0.746531
| 0.6679
| 0.6679
| 0.558742
| 0
| 0.009587
| 0.216638
| 1,731
| 74
| 84
| 23.391892
| 0.787611
| 0
| 0
| 0.709677
| 0
| 0
| 0.174466
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.048387
| false
| 0
| 0.032258
| 0
| 0.177419
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
8f445950ec9c15ec01cd4f7bee28a11d1e4b7bee
| 1,483
|
py
|
Python
|
tests/test_mli.py
|
jcalendo/autolung
|
9a3a10d2f4d5618e91d7c805b04211faa6f54300
|
[
"MIT"
] | null | null | null |
tests/test_mli.py
|
jcalendo/autolung
|
9a3a10d2f4d5618e91d7c805b04211faa6f54300
|
[
"MIT"
] | null | null | null |
tests/test_mli.py
|
jcalendo/autolung
|
9a3a10d2f4d5618e91d7c805b04211faa6f54300
|
[
"MIT"
] | null | null | null |
"""
unit test for the Mean Linear Intercept function
input images to this function are all binary and thus can be tested using np.arrays
"""
import numpy as np
from autolung.measure import mli
# test on full array simulated as 100x100 image
img_100 = np.ones((100,100))
def test_1():
assert mli(img_100) == 100.0
# test on array with varying lengths of consecutive 'pixels'
img_threes = np.array([[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 1, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 1, 1]])
def test_2():
assert mli(img_threes) == 3.0
# test on array where consecutive stretches differ in length
img_scattered = np.array([[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 0, 1, 1, 1, 0, 0, 0],
[0, 1, 0, 1, 1, 0, 0, 0, 1, 1]])
# function should return the mean of the consecutive lengths [2,4,1,6,2,3,1,2,2]
def test_3():
assert mli(img_scattered) == np.mean([[2,4,1,6,2,3,1,2,2]])
| 37.075
| 84
| 0.436952
| 267
| 1,483
| 2.393258
| 0.23221
| 0.247261
| 0.309859
| 0.338028
| 0.247261
| 0.233177
| 0.233177
| 0.233177
| 0.233177
| 0.175274
| 0
| 0.206704
| 0.396494
| 1,483
| 39
| 85
| 38.025641
| 0.507263
| 0.254214
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 1
| 0.130435
| false
| 0
| 0.086957
| 0
| 0.217391
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
8f59bf06b138a67ea9cd1c3ae622bf0ab6b91265
| 383
|
py
|
Python
|
src/bitcoin/utils/__init__.py
|
trevormcguire/pybitcoin
|
32ff859f4e51e5349fb70ca3c8a8782fd8cad25f
|
[
"MIT"
] | 1
|
2022-02-09T16:06:49.000Z
|
2022-02-09T16:06:49.000Z
|
src/bitcoin/utils/__init__.py
|
trevormcguire/pybitcoin
|
32ff859f4e51e5349fb70ca3c8a8782fd8cad25f
|
[
"MIT"
] | 2
|
2022-02-09T17:59:57.000Z
|
2022-02-09T18:00:27.000Z
|
src/bitcoin/utils/__init__.py
|
trevormcguire/pybitcoin
|
32ff859f4e51e5349fb70ca3c8a8782fd8cad25f
|
[
"MIT"
] | null | null | null |
"""
-----------------
Utility Functions for Bitcoin
-----------------
Note the functions in base58 shouldn't be imported by themselves, as encode and decode will be methods of many
different objects in the bitcoin library.
So to use the encode of base58, we want to call base58.encode, not just utils.encode
"""
from .hashfns import *
from .ints import *
from . import base58
| 29.461538
| 110
| 0.689295
| 56
| 383
| 4.714286
| 0.678571
| 0.075758
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025316
| 0.174935
| 383
| 12
| 111
| 31.916667
| 0.810127
| 0.806789
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
8f6c68736528a61c9e9ca6549d1f0a2f4b6898e0
| 819
|
py
|
Python
|
tests/test_2063.py
|
sungho-joo/leetcode2github
|
ce7730ef40f6051df23681dd3c0e1e657abba620
|
[
"MIT"
] | 2
|
2020-12-08T13:59:10.000Z
|
2021-05-01T05:07:39.000Z
|
tests/test_2063.py
|
sungho-joo/leetcode2github
|
ce7730ef40f6051df23681dd3c0e1e657abba620
|
[
"MIT"
] | null | null | null |
tests/test_2063.py
|
sungho-joo/leetcode2github
|
ce7730ef40f6051df23681dd3c0e1e657abba620
|
[
"MIT"
] | 1
|
2021-05-02T17:42:02.000Z
|
2021-05-02T17:42:02.000Z
|
#!/usr/bin/env python
import pytest
"""
Test 2063. Vowels of All Substrings
"""
@pytest.fixture(scope="session")
def init_variables_2063():
from src.leetcode_2063_vowels_of_all_substrings import Solution
solution = Solution()
def _init_variables_2063():
return solution
yield _init_variables_2063
class TestClass2063:
def test_solution_0(self, init_variables_2063):
assert init_variables_2063().countVowels("aba") == 6
def test_solution_1(self, init_variables_2063):
assert init_variables_2063().countVowels("abc") == 3
def test_solution_2(self, init_variables_2063):
assert init_variables_2063().countVowels("ltcd") == 0
def test_solution_3(self, init_variables_2063):
assert init_variables_2063().countVowels("noosabasboosa") == 237
| 24.088235
| 72
| 0.726496
| 104
| 819
| 5.365385
| 0.375
| 0.256272
| 0.335125
| 0.150538
| 0.483871
| 0.394265
| 0.394265
| 0.394265
| 0.394265
| 0
| 0
| 0.097489
| 0.173382
| 819
| 33
| 73
| 24.818182
| 0.726736
| 0.02442
| 0
| 0
| 0
| 0
| 0.039735
| 0
| 0
| 0
| 0
| 0
| 0.235294
| 1
| 0.352941
| false
| 0
| 0.117647
| 0.058824
| 0.588235
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
8f719e52178c41985d3aa06e3ba048073dd243a6
| 38
|
py
|
Python
|
snmp/__init__.py
|
stanislavb/snmp-lldp
|
66d1f418a05de3b3d74685a069b5a84035178b38
|
[
"Unlicense"
] | 25
|
2015-02-10T18:38:33.000Z
|
2021-07-31T11:22:37.000Z
|
snmp/__init__.py
|
tsingliu1007/snmp-lldp
|
66d1f418a05de3b3d74685a069b5a84035178b38
|
[
"Unlicense"
] | 1
|
2015-07-03T18:01:29.000Z
|
2015-07-03T18:01:29.000Z
|
snmp/__init__.py
|
tsingliu1007/snmp-lldp
|
66d1f418a05de3b3d74685a069b5a84035178b38
|
[
"Unlicense"
] | 7
|
2017-05-25T07:02:28.000Z
|
2020-10-05T07:36:55.000Z
|
__all__ = ['snmp']
from snmp import *
| 12.666667
| 18
| 0.657895
| 5
| 38
| 4.2
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.184211
| 38
| 2
| 19
| 19
| 0.677419
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
56cd653b9908e8962be63dfc566ba558c4be590a
| 643
|
py
|
Python
|
test/_example/bright_color/full_text.py
|
jakob-bagterp/colorist-for-python
|
6e9f9cc3a345cac7459cdc494f5fd635aecf19f7
|
[
"MIT"
] | null | null | null |
test/_example/bright_color/full_text.py
|
jakob-bagterp/colorist-for-python
|
6e9f9cc3a345cac7459cdc494f5fd635aecf19f7
|
[
"MIT"
] | null | null | null |
test/_example/bright_color/full_text.py
|
jakob-bagterp/colorist-for-python
|
6e9f9cc3a345cac7459cdc494f5fd635aecf19f7
|
[
"MIT"
] | null | null | null |
from colorist import (bright_black, bright_blue, bright_cyan, bright_green,
bright_magenta, bright_red, bright_white, bright_yellow)
if __name__ == "__main__":
print("")
bright_green("This is BRIGHT GREEN!")
print("")
bright_yellow("This is BRIGHT YELLOW!")
print("")
bright_red("This is BRIGHT RED!")
print("")
bright_magenta("This is BRIGHT MAGENTA!")
print("")
bright_blue("This is BRIGHT BLUE!")
print("")
bright_cyan("This is BRIGHT CYAN!")
print("")
bright_white("This is BRIGHT WHITE!")
print("")
bright_black("This is BRIGHT BLACK!")
print("")
| 29.227273
| 78
| 0.631415
| 79
| 643
| 4.835443
| 0.227848
| 0.230366
| 0.251309
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.228616
| 643
| 21
| 79
| 30.619048
| 0.770161
| 0
| 0
| 0.45
| 0
| 0
| 0.272162
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.05
| 0
| 0.05
| 0.45
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
56f674df4d25082d94c7115358f7c23cfd72ddb6
| 4,974
|
py
|
Python
|
tests/test_cvss.py
|
sthagen/turvallisuusneuvonta
|
503e6026463e475b02cb75fd23ae3faeb5f25b11
|
[
"MIT"
] | 1
|
2021-12-08T11:12:30.000Z
|
2021-12-08T11:12:30.000Z
|
tests/test_cvss.py
|
sthagen/turvallisuusneuvonta
|
503e6026463e475b02cb75fd23ae3faeb5f25b11
|
[
"MIT"
] | 2
|
2022-02-14T15:43:08.000Z
|
2022-02-14T21:22:13.000Z
|
tests/test_cvss.py
|
sthagen/turvallisuusneuvonta
|
503e6026463e475b02cb75fd23ae3faeb5f25b11
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long,missing-docstring,reimported,unused-import,unused-variable
import pytest
from pydantic.error_wrappers import ValidationError
from tests import conftest
from turvallisuusneuvonta.csaf.cvss.cvss import (
CVSS2,
CVSS30,
CVSS31,
SeverityType as CvssSeverityType,
Version as CvssVersion,
)
CVSS31_BASE_SEVERITY_LOG4J = CvssSeverityType.critical
CVSS30_BASE_SEVERITY_LOG4J = CvssSeverityType.critical
def test_cvss2_empty():
message = '2 validation errors for CVSS2'
with pytest.raises(ValidationError, match=message) as err:
_ = CVSS2() # type: ignore
assert '\nvector_string\n field required' in str(err.value)
assert '\nbase_score\n field required' in str(err.value)
def test_cvss2_wrong_version():
data = {
'version': '42',
'vector_string': conftest.CVSS2_VECTOR_STRING_LOG4J,
'base_score': conftest.CVSS2_BASE_SCORE_LOG4J,
}
message = '1 validation error for CVSS'
with pytest.raises(ValidationError, match=message) as err:
_ = CVSS2(**data)
assert '\nversion\n value is not a valid enumeration member' in str(err.value)
def test_cvss20_log4j_cve_2021_44228():
data = {
'version': CvssVersion.two,
'vector_string': conftest.CVSS2_VECTOR_STRING_LOG4J,
'base_score': conftest.CVSS2_BASE_SCORE_LOG4J,
}
cvss_cve_2021_44228 = CVSS2(**data)
assert isinstance(cvss_cve_2021_44228, CVSS2)
assert cvss_cve_2021_44228.version == CvssVersion.two
assert cvss_cve_2021_44228.vector_string == conftest.CVSS2_VECTOR_STRING_LOG4J
assert cvss_cve_2021_44228.base_score.__root__ == float(conftest.CVSS2_BASE_SCORE_LOG4J)
assert cvss_cve_2021_44228.confidentiality_requirement is None
def test_cvss30_empty():
message = '3 validation errors for CVSS30'
with pytest.raises(ValidationError, match=message) as err:
_ = CVSS30() # type: ignore
assert '\nvector_string\n field required' in str(err.value)
assert '\nbase_score\n field required' in str(err.value)
assert '\nbase_severity\n field required' in str(err.value)
def test_cvss30_wrong_version():
data = {
'version': '42',
'vector_string': conftest.CVSS30_VECTOR_STRING_LOG4J,
'base_score': conftest.CVSS30_BASE_SCORE_LOG4J,
'base_severity': CVSS30_BASE_SEVERITY_LOG4J,
}
message = '1 validation error for CVSS'
with pytest.raises(ValidationError, match=message) as err:
_ = CVSS30(**data)
assert '\nversion\n value is not a valid enumeration member' in str(err.value)
def test_cvss30_log4j_cve_2021_44228():
data = {
'version': CvssVersion.three_zero,
'vector_string': conftest.CVSS30_VECTOR_STRING_LOG4J,
'base_score': conftest.CVSS30_BASE_SCORE_LOG4J,
'base_severity': CVSS30_BASE_SEVERITY_LOG4J,
}
cvss_cve_2021_44228 = CVSS30(**data)
assert isinstance(cvss_cve_2021_44228, CVSS30)
assert cvss_cve_2021_44228.version == CvssVersion.three_zero
assert cvss_cve_2021_44228.vector_string == conftest.CVSS30_VECTOR_STRING_LOG4J
assert cvss_cve_2021_44228.base_score.__root__ == float(conftest.CVSS30_BASE_SCORE_LOG4J)
assert cvss_cve_2021_44228.base_severity.critical == CVSS30_BASE_SEVERITY_LOG4J
assert cvss_cve_2021_44228.confidentiality_requirement is None
def test_cvss31_empty():
message = '3 validation errors for CVSS31'
with pytest.raises(ValidationError, match=message) as err:
_ = CVSS31() # type: ignore
assert '\nvector_string\n field required' in str(err.value)
assert '\nbase_score\n field required' in str(err.value)
assert '\nbase_severity\n field required' in str(err.value)
def test_cvss31_wrong_version():
data = {
'version': '42',
'vector_string': conftest.CVSS31_VECTOR_STRING_LOG4J,
'base_score': conftest.CVSS31_BASE_SCORE_LOG4J,
'base_severity': CVSS31_BASE_SEVERITY_LOG4J,
}
message = '1 validation error for CVSS'
with pytest.raises(ValidationError, match=message) as err:
_ = CVSS31(**data)
assert '\nversion\n value is not a valid enumeration member' in str(err.value)
def test_cvss31_log4j_cve_2021_44228():
data = {
'version': CvssVersion.three_wun,
'vector_string': conftest.CVSS31_VECTOR_STRING_LOG4J,
'base_score': conftest.CVSS31_BASE_SCORE_LOG4J,
'base_severity': CVSS31_BASE_SEVERITY_LOG4J,
}
cvss_cve_2021_44228 = CVSS31(**data)
assert isinstance(cvss_cve_2021_44228, CVSS31)
assert cvss_cve_2021_44228.version == CvssVersion.three_wun
assert cvss_cve_2021_44228.vector_string == conftest.CVSS31_VECTOR_STRING_LOG4J
assert cvss_cve_2021_44228.base_score.__root__ == float(conftest.CVSS31_BASE_SCORE_LOG4J)
assert cvss_cve_2021_44228.base_severity.critical == CVSS31_BASE_SEVERITY_LOG4J
assert cvss_cve_2021_44228.confidentiality_requirement is None
| 39.165354
| 93
| 0.737234
| 648
| 4,974
| 5.310185
| 0.137346
| 0.046789
| 0.080209
| 0.092996
| 0.88608
| 0.839291
| 0.820692
| 0.745132
| 0.632374
| 0.578611
| 0
| 0.083211
| 0.176116
| 4,974
| 126
| 94
| 39.47619
| 0.756467
| 0.029956
| 0
| 0.461538
| 0
| 0
| 0.169952
| 0
| 0
| 0
| 0
| 0
| 0.269231
| 1
| 0.086538
| false
| 0
| 0.038462
| 0
| 0.125
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
56f754ba13bca663971616d909e1094e2114fe46
| 284
|
py
|
Python
|
lib/oeqa/runtime/cases/rubygems_rubygems_rubocop_ast.py
|
tuxable-ltd/meta-rubygems
|
e80630e79b64e1be8339e1add0ab07644ec99425
|
[
"BSD-2-Clause"
] | null | null | null |
lib/oeqa/runtime/cases/rubygems_rubygems_rubocop_ast.py
|
tuxable-ltd/meta-rubygems
|
e80630e79b64e1be8339e1add0ab07644ec99425
|
[
"BSD-2-Clause"
] | null | null | null |
lib/oeqa/runtime/cases/rubygems_rubygems_rubocop_ast.py
|
tuxable-ltd/meta-rubygems
|
e80630e79b64e1be8339e1add0ab07644ec99425
|
[
"BSD-2-Clause"
] | null | null | null |
from rubygems_utils import RubyGemsTestUtils
class RubyGemsTestrubygems_rubocop_ast(RubyGemsTestUtils):
def test_gem_list_rubygems_rubocop_ast(self):
self.gem_is_installed("rubocop-ast")
def test_load_rubocop_ast(self):
self.gem_is_loadable("rubocop-ast")
| 25.818182
| 58
| 0.785211
| 36
| 284
| 5.777778
| 0.5
| 0.240385
| 0.134615
| 0.173077
| 0.221154
| 0.221154
| 0
| 0
| 0
| 0
| 0
| 0
| 0.140845
| 284
| 10
| 59
| 28.4
| 0.852459
| 0
| 0
| 0
| 0
| 0
| 0.077739
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.166667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
710eb35da5fa163f13900416e0d15620d92a4d13
| 330
|
py
|
Python
|
posts/api/pagination.py
|
AlineCelestrini/blog_python
|
2b995f1dfb2f8002982f93118f0cd0b779e386f3
|
[
"MIT"
] | null | null | null |
posts/api/pagination.py
|
AlineCelestrini/blog_python
|
2b995f1dfb2f8002982f93118f0cd0b779e386f3
|
[
"MIT"
] | 3
|
2020-05-08T14:05:21.000Z
|
2021-06-10T22:52:50.000Z
|
posts/api/pagination.py
|
AlineCelestrini/blog_python
|
2b995f1dfb2f8002982f93118f0cd0b779e386f3
|
[
"MIT"
] | 1
|
2020-05-08T18:13:25.000Z
|
2020-05-08T18:13:25.000Z
|
from rest_framework.pagination import PageNumberPagination
class PostPageNumberPagination(PageNumberPagination):
"""
Custom pagination for posts
"""
page_size = 5 # for testing
class UserPageNumberPagination(PageNumberPagination):
"""
Custom pagination for users
"""
page_size = 5 # for testing
| 22
| 58
| 0.727273
| 30
| 330
| 7.9
| 0.566667
| 0.219409
| 0.303797
| 0.329114
| 0.160338
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007605
| 0.20303
| 330
| 14
| 59
| 23.571429
| 0.893536
| 0.242424
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 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
| 0
| 0
| 1
| 0
|
0
| 4
|
71112a26d415ec91c2b49b0873ee1cb2b11b6058
| 323
|
py
|
Python
|
linode/__init__.py
|
awiddersheim/linode-api-python
|
4bb0dba0cc76321b9ca760e85d164b750cc95fa6
|
[
"BSD-3-Clause"
] | null | null | null |
linode/__init__.py
|
awiddersheim/linode-api-python
|
4bb0dba0cc76321b9ca760e85d164b750cc95fa6
|
[
"BSD-3-Clause"
] | null | null | null |
linode/__init__.py
|
awiddersheim/linode-api-python
|
4bb0dba0cc76321b9ca760e85d164b750cc95fa6
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import absolute_import # python2 imports should be absolute
from linode.objects import *
from linode.errors import ApiError, UnexpectedResponseError
from linode.linode_client import LinodeClient
from linode.login_client import LinodeLoginClient, OAuthScopes
from linode.paginated_list import PaginatedList
| 40.375
| 75
| 0.869969
| 39
| 323
| 7
| 0.538462
| 0.18315
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003448
| 0.102167
| 323
| 7
| 76
| 46.142857
| 0.937931
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
8543fe9f067cadbe0a541bd893d92381158aaf44
| 633
|
py
|
Python
|
unravel/admin/__init__.py
|
cofiem/logomachy
|
fed77dc4b821f25a60fd9b9474c232107fe98f53
|
[
"Apache-2.0"
] | null | null | null |
unravel/admin/__init__.py
|
cofiem/logomachy
|
fed77dc4b821f25a60fd9b9474c232107fe98f53
|
[
"Apache-2.0"
] | 1
|
2017-10-29T08:16:02.000Z
|
2017-10-30T14:19:59.000Z
|
unravel/admin/__init__.py
|
cofiem/logomachy
|
fed77dc4b821f25a60fd9b9474c232107fe98f53
|
[
"Apache-2.0"
] | null | null | null |
from .document_admin import DocumentAdmin
from .document_result_admin import DocumentResultAdmin
from .document_tag_admin import DocumentTagAdmin
from .document_version_admin import DocumentVersionAdmin
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from unravel import models as app_models
admin.site.register(app_models.User, UserAdmin)
admin.site.register(app_models.Document, DocumentAdmin)
admin.site.register(app_models.DocumentResult, DocumentResultAdmin)
admin.site.register(app_models.DocumentTag, DocumentTagAdmin)
admin.site.register(app_models.DocumentVersion, DocumentVersionAdmin)
| 37.235294
| 69
| 0.870458
| 77
| 633
| 6.987013
| 0.324675
| 0.100372
| 0.157993
| 0.185874
| 0.241636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.06951
| 633
| 16
| 70
| 39.5625
| 0.913413
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.583333
| 0
| 0.583333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
856480b43f4ac53503f8c438ca363a9d253a1850
| 185
|
py
|
Python
|
lawliet/effect/__init__.py
|
Ryuk17/lawliet
|
ba4734557260b255896707210fca3e2fff311e87
|
[
"Apache-2.0"
] | 2
|
2021-04-20T03:51:32.000Z
|
2021-06-16T11:48:06.000Z
|
lawliet/watermarking/__init__.py
|
Ryuk17/lawliet
|
ba4734557260b255896707210fca3e2fff311e87
|
[
"Apache-2.0"
] | null | null | null |
lawliet/watermarking/__init__.py
|
Ryuk17/lawliet
|
ba4734557260b255896707210fca3e2fff311e87
|
[
"Apache-2.0"
] | null | null | null |
"""
@FileName: __init__.py.py
@Description: Implement __init__.py
@Author: Ryuk
@CreateDate: 2021/06/27
@LastEditTime: 2021/06/27
@LastEditors: Please set LastEditors
@Version: v0.1
"""
| 20.555556
| 36
| 0.751351
| 25
| 185
| 5.24
| 0.72
| 0.091603
| 0.122137
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107784
| 0.097297
| 185
| 9
| 37
| 20.555556
| 0.676647
| 0.956757
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
856e6d8ddb6296624dbe0255f988d480878213e7
| 939
|
py
|
Python
|
fluentcheck/assertions_is/types.py
|
jstoebel/fluentcheck
|
9258dab4f46776b5df50528f5028ce2d11a443c5
|
[
"MIT"
] | 83
|
2018-05-31T13:21:06.000Z
|
2022-03-20T14:27:49.000Z
|
fluentcheck/assertions_is/types.py
|
jstoebel/fluentcheck
|
9258dab4f46776b5df50528f5028ce2d11a443c5
|
[
"MIT"
] | 20
|
2019-02-10T15:07:44.000Z
|
2021-04-02T13:18:52.000Z
|
fluentcheck/assertions_is/types.py
|
jstoebel/fluentcheck
|
9258dab4f46776b5df50528f5028ce2d11a443c5
|
[
"MIT"
] | 11
|
2019-02-16T21:33:11.000Z
|
2022-03-25T03:39:52.000Z
|
from fluentcheck.assertions_is.base_is import IsBase
class __IsTypes(IsBase):
def subtype_of(self, class_type) -> "Is":
self.check.is_subtype_of(class_type)
return self
def not_subtype_of(self, class_type) -> "Is":
self.check.is_not_subtype_of(class_type)
return self
def of_type(self, class_type) -> "Is":
self.check.is_of_type(class_type)
return self
def not_of_type(self, class_type) -> "Is":
self.check.is_not_of_type(class_type)
return self
@property
def module(self) -> "Is":
self.check.is_module()
return self
@property
def not_module(self) -> "Is":
self.check.is_not_module()
return self
@property
def runnable(self) -> "Is":
self.check.is_runnable()
return self
@property
def not_runnable(self) -> "Is":
self.check.is_not_runnable()
return self
| 23.475
| 52
| 0.620873
| 127
| 939
| 4.307087
| 0.15748
| 0.131627
| 0.160878
| 0.190128
| 0.8117
| 0.66362
| 0.369287
| 0.255942
| 0.244973
| 0
| 0
| 0
| 0.271566
| 939
| 39
| 53
| 24.076923
| 0.799708
| 0
| 0
| 0.4
| 0
| 0
| 0.017039
| 0
| 0
| 0
| 0
| 0
| 0.033333
| 1
| 0.266667
| false
| 0
| 0.033333
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
8578c2a00de1ae6518c127b5b6b277375906516a
| 523
|
py
|
Python
|
tests/book_Python-unittest/tests/calc_tests.py
|
suroegin-learning/learn-python
|
be5bda86add0dcd6f2fd3db737bb7d0d3ec5f853
|
[
"MIT"
] | null | null | null |
tests/book_Python-unittest/tests/calc_tests.py
|
suroegin-learning/learn-python
|
be5bda86add0dcd6f2fd3db737bb7d0d3ec5f853
|
[
"MIT"
] | null | null | null |
tests/book_Python-unittest/tests/calc_tests.py
|
suroegin-learning/learn-python
|
be5bda86add0dcd6f2fd3db737bb7d0d3ec5f853
|
[
"MIT"
] | null | null | null |
import unittest
import calc
class CalcTests(unittest.TestCase):
def test_add(self):
self.assertEqual(calc.add(1, 2), 3)
def test_mul(self):
self.assertEqual(calc.mul(2, 2), 4)
@unittest.skip("Temporary ignoring...")
def test_sub(self):
self.assertEqual(calc.sub(5, 1), 4)
@unittest.skip("TEMP DECIDE")
class CalcExTests(unittest.TestCase):
def test_sqrt(self):
self.assertEqual(calc.sqrt(4), 2)
def test_pow(self):
self.assertEqual(calc.pow(3, 3), 27)
| 21.791667
| 44
| 0.648184
| 74
| 523
| 4.513514
| 0.364865
| 0.10479
| 0.284431
| 0.344311
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.036058
| 0.204589
| 523
| 23
| 45
| 22.73913
| 0.766827
| 0
| 0
| 0
| 0
| 0
| 0.061185
| 0
| 0
| 0
| 0
| 0
| 0.3125
| 1
| 0.3125
| false
| 0
| 0.125
| 0
| 0.5625
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
85859e6a9d761f74f3e58528577fa1bcf5be0f8e
| 92
|
py
|
Python
|
mokitou/config/__init__.py
|
lishulong16/mokitou
|
96c5af6f86b2786ffda203f023b4a5f11015853f
|
[
"MIT"
] | 1
|
2018-04-25T01:32:15.000Z
|
2018-04-25T01:32:15.000Z
|
mokitou/config/__init__.py
|
lishulong16/mokitou
|
96c5af6f86b2786ffda203f023b4a5f11015853f
|
[
"MIT"
] | null | null | null |
mokitou/config/__init__.py
|
lishulong16/mokitou
|
96c5af6f86b2786ffda203f023b4a5f11015853f
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
@contact: lishulong.never@gmail.com
@time: 2018/3/25 上午11:07
"""
| 18.4
| 35
| 0.608696
| 14
| 92
| 4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.148148
| 0.119565
| 92
| 5
| 36
| 18.4
| 0.54321
| 0.902174
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
858bff3eacc76fcf98e0fbfaea9d39ca6cf709f4
| 224
|
py
|
Python
|
backend/database/tests/factories.py
|
JMSoler7/database
|
b90326a8f3929d1bad9a810fcbe91d9bb2c3d5f4
|
[
"MIT"
] | null | null | null |
backend/database/tests/factories.py
|
JMSoler7/database
|
b90326a8f3929d1bad9a810fcbe91d9bb2c3d5f4
|
[
"MIT"
] | null | null | null |
backend/database/tests/factories.py
|
JMSoler7/database
|
b90326a8f3929d1bad9a810fcbe91d9bb2c3d5f4
|
[
"MIT"
] | null | null | null |
import factory # NOQA F401
from database import models # NOQA F401
# Insert Factory Boy factories here. Remember that if it escalates,
# you may create a factories folder with an __init__ importing all
# the factories 😜
| 28
| 67
| 0.772321
| 34
| 224
| 5
| 0.823529
| 0.094118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.033149
| 0.191964
| 224
| 7
| 68
| 32
| 0.900552
| 0.741071
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
85c1c045204b2a3549fe0d3baa9b61215a04d065
| 409
|
py
|
Python
|
quantlib/instruments/api.py
|
yuyingfeng/pyql
|
ceb838581ad4db73a0208bc51bde2771bb534e5f
|
[
"BSD-3-Clause"
] | null | null | null |
quantlib/instruments/api.py
|
yuyingfeng/pyql
|
ceb838581ad4db73a0208bc51bde2771bb534e5f
|
[
"BSD-3-Clause"
] | null | null | null |
quantlib/instruments/api.py
|
yuyingfeng/pyql
|
ceb838581ad4db73a0208bc51bde2771bb534e5f
|
[
"BSD-3-Clause"
] | 2
|
2016-08-24T20:56:14.000Z
|
2022-01-03T05:58:42.000Z
|
from .bonds import FixedRateBond, ZeroCouponBond, FloatingRateBond
from .credit_default_swap import CreditDefaultSwap, SELLER, BUYER
from .option import EuropeanExercise, AmericanExercise, VanillaOption
from .option import DividendVanillaOption, EuropeanOption
from .payoffs import Put, Call, PlainVanillaPayoff, PAYOFF_TO_STR
from .instrument import Instrument
from .swap import VanillaSwap, Payer, Receiver
| 51.125
| 69
| 0.855746
| 44
| 409
| 7.863636
| 0.659091
| 0.057803
| 0.092486
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0978
| 409
| 7
| 70
| 58.428571
| 0.937669
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
a4175b8c84b7eadf1887887ac18fb8361b4ac6df
| 249
|
py
|
Python
|
merinjeiweb/CONSTANTS.py
|
ivanmilevtues/merinjei_bot
|
d2e75d3f5630d804c9095f3783d06ba6c23a391e
|
[
"MIT"
] | 4
|
2017-11-08T15:50:42.000Z
|
2019-11-04T05:34:31.000Z
|
merinjeiweb/CONSTANTS.py
|
ivanmilevtues/merinjei_bot
|
d2e75d3f5630d804c9095f3783d06ba6c23a391e
|
[
"MIT"
] | 1
|
2017-11-15T14:29:11.000Z
|
2017-11-15T14:29:56.000Z
|
merinjeiweb/CONSTANTS.py
|
ivanmilevtues/merinjei_bot
|
d2e75d3f5630d804c9095f3783d06ba6c23a391e
|
[
"MIT"
] | 1
|
2017-11-14T21:38:40.000Z
|
2017-11-14T21:38:40.000Z
|
APP_ID = '390093838084850'
DOMAIN = 'https://ef1ac6ba.ngrok.io'
COMMENTS_CALLBACK = DOMAIN + \
'/webhook_handler/'
MESSENGER_CALLBACK = DOMAIN + \
'/webhook_handler/'
VERIFY_TOKEN = '19990402'
APP_SECRET = 'e3d24fecd0c82e3c558d9cca9c6edad7'
| 27.666667
| 47
| 0.746988
| 24
| 249
| 7.458333
| 0.75
| 0.156425
| 0.234637
| 0.312849
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179724
| 0.128514
| 249
| 8
| 48
| 31.125
| 0.645161
| 0
| 0
| 0.25
| 0
| 0
| 0.457831
| 0.128514
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 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
| 0
|
0
| 4
|
a44a42b27464c5d04ff2d124e628750b32d34050
| 61
|
py
|
Python
|
runp.py
|
lefttree/flaskApp
|
363da4fb60a7a31beb4d7947b9688fa3f07f205b
|
[
"MIT"
] | null | null | null |
runp.py
|
lefttree/flaskApp
|
363da4fb60a7a31beb4d7947b9688fa3f07f205b
|
[
"MIT"
] | null | null | null |
runp.py
|
lefttree/flaskApp
|
363da4fb60a7a31beb4d7947b9688fa3f07f205b
|
[
"MIT"
] | null | null | null |
#!flask/bin/python
from app import app
app.run(debug=False)
| 12.2
| 20
| 0.754098
| 11
| 61
| 4.181818
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114754
| 61
| 4
| 21
| 15.25
| 0.851852
| 0.278689
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
a4690c073db028c0f174f0d8e01e16642acb0687
| 70
|
py
|
Python
|
tests/gui/test_gtextfield.py
|
sredmond/campy
|
a082985375abf382341d226fc52300818f9dffe6
|
[
"MIT"
] | 5
|
2018-12-03T19:18:50.000Z
|
2021-05-31T07:17:06.000Z
|
tests/gui/test_gtextfield.py
|
sredmond/campy
|
a082985375abf382341d226fc52300818f9dffe6
|
[
"MIT"
] | 1
|
2020-02-13T20:56:05.000Z
|
2020-02-19T18:32:56.000Z
|
tests/gui/test_gtextfield.py
|
sredmond/acmpy
|
a082985375abf382341d226fc52300818f9dffe6
|
[
"MIT"
] | 1
|
2017-06-06T07:29:07.000Z
|
2017-06-06T07:29:07.000Z
|
"""Tests for the :class:`campy.gui.ginteractors.GTextField` class."""
| 35
| 69
| 0.728571
| 9
| 70
| 5.666667
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071429
| 70
| 1
| 70
| 70
| 0.784615
| 0.9
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a484b6c24828eaedf6c14fffedb6b57919c3196f
| 15,282
|
py
|
Python
|
app/core/tests/test_utils_unit.py
|
OpenLXP/openlxp-xis
|
b15244d5885c4367d661247462d865e7a30d8996
|
[
"Apache-2.0"
] | null | null | null |
app/core/tests/test_utils_unit.py
|
OpenLXP/openlxp-xis
|
b15244d5885c4367d661247462d865e7a30d8996
|
[
"Apache-2.0"
] | 17
|
2020-12-15T18:33:30.000Z
|
2022-03-18T02:46:15.000Z
|
app/core/tests/test_utils_unit.py
|
OpenLXP/openlxp-xis
|
b15244d5885c4367d661247462d865e7a30d8996
|
[
"Apache-2.0"
] | null | null | null |
from unittest.mock import patch
from ddt import data, ddt
from django.test import tag
from core.management.utils.xis_internal import (dict_flatten,
flatten_dict_object,
flatten_list_object,
required_recommended_logs,
update_flattened_object)
from core.management.utils.xse_client import (get_elasticsearch_endpoint,
get_elasticsearch_index)
from core.management.utils.xss_client import (
aws_get, get_required_recommended_fields_for_validation,
get_target_validation_schema)
from core.models import XISConfiguration
from .test_setup import TestSetUp
@tag('unit')
@ddt
class UtilsTests(TestSetUp):
"""This cases for xis_internal.py"""
def test_required_recommended_logs_required(self):
"""Test for logs the missing required """
with patch('core.management.utils.xis_internal'
'.logger.error',
return_value=None) as mock_logger_error:
required_recommended_logs(123, 'Required', 'test_field')
self.assertEqual(
mock_logger_error.call_count, 1)
def test_required_recommended_logs_recommended(self):
"""Test for logs the missing recommended"""
with patch('core.management.utils.xis_internal'
'.logger.warning',
return_value=None) as mock_logger_warning:
required_recommended_logs(123, 'Recommended', 'test_field')
self.assertEqual(
mock_logger_warning.call_count, 1)
def test_dict_flatten(self):
"""Test function to navigate to value in source
metadata to be validated"""
test_data_dict = {"key1": "value1",
"key2": {"sub_key1": "sub_value1"},
"key3": [{"sub_key2": "sub_value2"},
{"sub_key3": "sub_value3"}]}
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_flatten_list
mock_flatten_list.return_value = None
mock_flatten_dict.return_value = mock_flatten_dict
mock_flatten_dict.return_value = None
mock_update_flattened.return_value = mock_update_flattened
mock_update_flattened.return_value = None
return_value = dict_flatten(test_data_dict,
self.test_required_column_names)
self.assertTrue(return_value)
@data(
([{'a.b': None, 'a.c': 'value2', 'd': None},
{'a.b': 'value1', 'a.c': 'value2', 'd': None}]))
def test_flatten_list_object_loop(self, value):
"""Test the looping od the function to flatten
list object when the value is list"""
prefix = 'a'
flatten_dict = {}
required_list = ['a.b', 'a.c', 'd']
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_flatten_list
mock_flatten_list.return_value = None
mock_flatten_dict.return_value = mock_flatten_dict
mock_flatten_dict.return_value = None
mock_update_flattened.side_effect = flatten_dict = \
{'a.b': None, 'a.c': 'value2'}
flatten_list_object(value, prefix, flatten_dict, required_list)
self.assertEqual(mock_flatten_dict.call_count, 2)
@data(
([{'b': [None]}]))
def test_flatten_list_object_multilevel(self, value):
"""Test the function to flatten list object
when the value is list for multilevel lists"""
prefix = 'a'
flatten_dict = {}
required_list = ['a.b', 'd']
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_update_flattened
mock_flatten_dict.return_value = mock_flatten_list()
mock_update_flattened.side_effect = flatten_dict = \
{'a.b': None}
flatten_list_object(value, prefix, flatten_dict, required_list)
self.assertEqual(mock_flatten_list.call_count, 1)
@data(([{'A': 'a'}]), ([{'B': 'b', 'C': 'c'}]))
def test_flatten_list_object_list(self, value):
"""Test the function to flatten list object when the value is list"""
prefix = 'test'
flatten_dict = []
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_flatten_list
mock_flatten_list.return_value = None
mock_flatten_dict.return_value = mock_flatten_dict
mock_flatten_dict.return_value = None
mock_update_flattened.return_value = mock_update_flattened
mock_update_flattened.return_value = None
flatten_list_object(value, prefix, flatten_dict,
self.test_required_column_names)
self.assertEqual(mock_flatten_dict.call_count, 1)
@data(([{'A': 'a'}]), ([{'B': 'b', 'C': 'c'}]))
def test_flatten_list_object_dict(self, value):
"""Test the function to flatten list object when the value is dict"""
prefix = 'test'
flatten_dict = []
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_flatten_list
mock_flatten_list.return_value = None
mock_flatten_dict.return_value = mock_flatten_dict
mock_flatten_dict.return_value = None
mock_update_flattened.return_value = mock_update_flattened
mock_update_flattened.return_value = None
flatten_list_object(value, prefix, flatten_dict,
self.test_required_column_names)
self.assertEqual(mock_flatten_dict.call_count, 1)
@data((['hello']), (['hi']))
def test_flatten_list_object_str(self, value):
"""Test the function to flatten list object when the value is string"""
prefix = 'test'
flatten_dict = []
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_flatten_list
mock_flatten_list.return_value = None
mock_flatten_dict.return_value = mock_flatten_dict
mock_flatten_dict.return_value = None
mock_update_flattened.return_value = mock_update_flattened
mock_update_flattened.return_value = None
flatten_list_object(value, prefix, flatten_dict,
self.test_required_column_names)
self.assertEqual(mock_update_flattened.call_count, 1)
@data(({'abc': {'A': 'a'}}), ({'xyz': {'B': 'b'}}))
def test_flatten_dict_object_dict(self, value):
"""Test the function to flatten dictionary object when input value is
a dict"""
prefix = 'test'
flatten_dict = []
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_flatten_list
mock_flatten_list.return_value = None
mock_flatten_dict.return_value = mock_flatten_dict
mock_flatten_dict.return_value = None
mock_update_flattened.return_value = mock_update_flattened
mock_update_flattened.return_value = None
flatten_dict_object(value, prefix, flatten_dict,
self.test_required_column_names)
self.assertEqual(mock_flatten_dict.call_count, 1)
@data(({'abc': [1, 2, 3]}), ({'xyz': [1, 2, 3, 4, 5]}))
def test_flatten_dict_object_list(self, value):
"""Test the function to flatten dictionary object when input value is
a list"""
prefix = 'test'
flatten_dict = []
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_flatten_list
mock_flatten_list.return_value = None
mock_flatten_dict.return_value = mock_flatten_dict
mock_flatten_dict.return_value = None
mock_update_flattened.return_value = mock_update_flattened
mock_update_flattened.return_value = None
flatten_dict_object(value, prefix, flatten_dict,
self.test_required_column_names)
self.assertEqual(mock_flatten_list.call_count, 1)
@data(({'abc': 'A'}), ({'xyz': 'B'}))
def test_flatten_dict_object_str(self, value):
"""Test the function to flatten dictionary object when input value is
a string"""
prefix = 'test'
flatten_dict = []
with patch('core.management.utils.xis_internal.flatten_list_object') \
as mock_flatten_list, \
patch('core.management.utils.xis_internal.flatten_dict_'
'object') as mock_flatten_dict, \
patch('core.management.utils.xis_internal.update_flattened_'
'object') as mock_update_flattened:
mock_flatten_list.return_value = mock_flatten_list
mock_flatten_list.return_value = None
mock_flatten_dict.return_value = mock_flatten_dict
mock_flatten_dict.return_value = None
mock_update_flattened.return_value = mock_update_flattened
mock_update_flattened.return_value = None
flatten_dict_object(value, prefix, flatten_dict,
self.test_required_column_names)
self.assertEqual(mock_update_flattened.call_count, 1)
@data('', 'str1')
def test_update_flattened_object(self, value):
"""Test the function which returns the source bucket name"""
prefix = 'test'
flatten_dict = {}
update_flattened_object(value, prefix, flatten_dict)
self.assertTrue(flatten_dict)
"""This cases for xse_client.py"""
def test_get_elasticsearch_endpoint(self):
"""This test is to check if function returns the elasticsearch
endpoint """
with patch('core.management.utils.xse_client.XISConfiguration.objects'
) as xis_config:
configObj = XISConfiguration(target_schema="test.json",
xse_host="host:8080",
xse_index="test-index")
xis_config.first.return_value = configObj
result_api_es_endpoint = get_elasticsearch_endpoint()
self.assertTrue(result_api_es_endpoint)
def test_get_elasticsearch_index(self):
"""This test is to check if function returns the elasticsearch index"""
with patch('core.management.utils.xse_client.XISConfiguration.objects'
) as xis_config:
configObj = XISConfiguration(target_schema="test.json",
xse_host="host:8080",
xse_index="test-index")
xis_config.first.return_value = configObj
result_api_es_index = get_elasticsearch_index()
self.assertTrue(result_api_es_index)
# Test cases for XSS
def test_aws_get(self):
"""Test for the function to get aws bucket name from env file"""
result_bucket = aws_get()
self.assertTrue(result_bucket)
def test_get_target_validation_schema(self):
"""Test to retrieve target_metadata_schema from XIS configuration"""
with patch('core.management.utils.xss_client'
'.XISConfiguration.objects') as xisconfigobj, \
patch('core.management.utils.xss_client'
'.read_json_data') as read_obj:
xisConfig = XISConfiguration(
target_schema='p2881_schema.json')
xisconfigobj.return_value = xisConfig
read_obj.return_value = read_obj
read_obj.return_value = self.target_data_dict
return_from_function = get_target_validation_schema()
self.assertEqual(read_obj.return_value,
return_from_function)
def test_get_required_recommended_fields_for_validation(self):
"""Test for Creating list of fields which are Required """
with patch('core.management.utils.xss_client'
'.get_target_validation_schema',
return_value=self.target_data_dict):
required_column_name, recommended_column_name = \
get_required_recommended_fields_for_validation()
self.assertTrue(required_column_name)
self.assertTrue(recommended_column_name)
| 47.312693
| 79
| 0.619945
| 1,707
| 15,282
| 5.183363
| 0.080844
| 0.093241
| 0.064421
| 0.092224
| 0.806962
| 0.766501
| 0.710556
| 0.682414
| 0.665687
| 0.658002
| 0
| 0.004737
| 0.295511
| 15,282
| 322
| 80
| 47.459627
| 0.817109
| 0.074728
| 0
| 0.648221
| 0
| 0
| 0.157114
| 0.123084
| 0
| 0
| 0
| 0
| 0.071146
| 1
| 0.067194
| false
| 0
| 0.031621
| 0
| 0.102767
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
f100357cab4eec51fa8a1f9b061cfd171f77143b
| 73
|
py
|
Python
|
zxp/trainers/__init__.py
|
tomsherborne/zx-parse
|
574b2d7618ad6981cd59d42842e6d1dceddfdc8e
|
[
"MIT"
] | 7
|
2022-02-28T11:49:35.000Z
|
2022-03-11T06:14:33.000Z
|
zxp/trainers/__init__.py
|
tomsherborne/zx-parse
|
574b2d7618ad6981cd59d42842e6d1dceddfdc8e
|
[
"MIT"
] | null | null | null |
zxp/trainers/__init__.py
|
tomsherborne/zx-parse
|
574b2d7618ad6981cd59d42842e6d1dceddfdc8e
|
[
"MIT"
] | null | null | null |
from zxp.trainers.gradient_descent_lambda import GradientLambdaCallback
| 24.333333
| 71
| 0.90411
| 8
| 73
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068493
| 73
| 2
| 72
| 36.5
| 0.941176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
f101286b14a1f9aeadae62fbba87493d39b4ce95
| 203
|
py
|
Python
|
api/db/db_config.py
|
BastianHofmann/bedtime-skill
|
023d471c5f468560a4e84ed7a30912fae841f718
|
[
"MIT"
] | null | null | null |
api/db/db_config.py
|
BastianHofmann/bedtime-skill
|
023d471c5f468560a4e84ed7a30912fae841f718
|
[
"MIT"
] | null | null | null |
api/db/db_config.py
|
BastianHofmann/bedtime-skill
|
023d471c5f468560a4e84ed7a30912fae841f718
|
[
"MIT"
] | null | null | null |
import os
DB_TYPE = os.environ['DB_TYPE']
DB_HOST = os.environ['DB_HOST']
DB_PORT = os.environ['DB_PORT']
DB_USER = os.environ['DB_USER']
DB_PASS = os.environ['DB_PASS']
DB_NAME = os.environ['DB_NAME']
| 25.375
| 32
| 0.719212
| 38
| 203
| 3.526316
| 0.263158
| 0.402985
| 0.492537
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103448
| 203
| 8
| 33
| 25.375
| 0.736264
| 0
| 0
| 0
| 0
| 0
| 0.205882
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.142857
| 0.142857
| 0
| 0.142857
| 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
f10fce623d797002b4820b50b515f76c16135437
| 138
|
py
|
Python
|
tests/context.py
|
shffrror/isdi
|
0e6da392d61ed462ebbc5bf5b45bec6c11f5f941
|
[
"MIT"
] | 85
|
2019-08-15T15:10:39.000Z
|
2022-03-21T21:36:44.000Z
|
tests/context.py
|
stefftw/isdi
|
0e6da392d61ed462ebbc5bf5b45bec6c11f5f941
|
[
"MIT"
] | 23
|
2019-08-02T15:59:33.000Z
|
2022-03-30T14:34:45.000Z
|
tests/context.py
|
stefftw/isdi
|
0e6da392d61ed462ebbc5bf5b45bec6c11f5f941
|
[
"MIT"
] | 28
|
2019-09-08T16:09:47.000Z
|
2022-03-23T15:34:58.000Z
|
import os, sys
from pathlib import Path
BASEDIR = Path(__file__).absolute().parent.parent
sys.path.append(str(BASEDIR))
import parse_dump
| 23
| 49
| 0.797101
| 21
| 138
| 5
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094203
| 138
| 5
| 50
| 27.6
| 0.84
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
f1131125b709fbb5e491b7860c270f91ce3cfc5b
| 237
|
py
|
Python
|
Python/tdw/FBOutput/PassMask.py
|
instbldrjems/tdw
|
6d200d8431db4e752c8ec91191d8ba55e15f1b8a
|
[
"BSD-2-Clause"
] | null | null | null |
Python/tdw/FBOutput/PassMask.py
|
instbldrjems/tdw
|
6d200d8431db4e752c8ec91191d8ba55e15f1b8a
|
[
"BSD-2-Clause"
] | null | null | null |
Python/tdw/FBOutput/PassMask.py
|
instbldrjems/tdw
|
6d200d8431db4e752c8ec91191d8ba55e15f1b8a
|
[
"BSD-2-Clause"
] | null | null | null |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: FBOutput
class PassMask(object):
_img = 1
_id = 2
_category = 4
_mask = 8
_depth = 16
_normals = 32
_flow = 64
| 16.928571
| 69
| 0.603376
| 28
| 237
| 4.857143
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.063694
| 0.337553
| 237
| 13
| 70
| 18.230769
| 0.802548
| 0.362869
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.125
| 0
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
f1320247bc1e7bda23d507001450fac548aa058e
| 1,171
|
py
|
Python
|
blog_generator/tests.py
|
berstearns/pret-a-lod-blog
|
c39058b3f8d944d9c3f852074747c5d4d13b3a19
|
[
"MIT"
] | null | null | null |
blog_generator/tests.py
|
berstearns/pret-a-lod-blog
|
c39058b3f8d944d9c3f852074747c5d4d13b3a19
|
[
"MIT"
] | null | null | null |
blog_generator/tests.py
|
berstearns/pret-a-lod-blog
|
c39058b3f8d944d9c3f852074747c5d4d13b3a19
|
[
"MIT"
] | null | null | null |
import pytest
import os
from os.path import join, abspath, dirname
from blog_generator import Builder
def test_generate_files_structure_empty_blog():
reference_folder = "testing_inputs/empty_blog"
destination_folder = "output"
blog_builder = Builder(reference_folder,destination_folder)
blog_builder.build_blog()
expected_paths = [
destination_folder,
join(destination_folder,"static"),
join(destination_folder,"pages"),
join(destination_folder,"posts")
]
for path in expected_paths:
assert(os.path.exists(path))
def test_generate_files_structure_blog_with_index_page():
reference_folder = "testing_inputs/index_blog"
destination_folder = "output"
blog_builder = Builder(reference_folder,destination_folder)
blog_builder.build_blog()
expected_paths = [
destination_folder,
join(destination_folder,"static"),
join(destination_folder,"pages"),
join(destination_folder,"posts"),
join(destination_folder,"index.html")
]
for path in expected_paths:
assert(os.path.exists(path))
| 34.441176
| 63
| 0.690009
| 129
| 1,171
| 5.922481
| 0.286822
| 0.289267
| 0.192408
| 0.052356
| 0.730366
| 0.65445
| 0.65445
| 0.65445
| 0.65445
| 0.65445
| 0
| 0
| 0.224594
| 1,171
| 33
| 64
| 35.484848
| 0.84141
| 0
| 0
| 0.580645
| 1
| 0
| 0.088813
| 0.042699
| 0
| 0
| 0
| 0
| 0.064516
| 1
| 0.064516
| false
| 0
| 0.129032
| 0
| 0.193548
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
f138465311c096c86a425d94350b5c276445f21c
| 184
|
py
|
Python
|
content/tampers/modsec.py
|
officialhocc/WhatWaf
|
0ca5c7f1ffc6dfba05e2d0a29799c023c4c6337f
|
[
"MIT"
] | null | null | null |
content/tampers/modsec.py
|
officialhocc/WhatWaf
|
0ca5c7f1ffc6dfba05e2d0a29799c023c4c6337f
|
[
"MIT"
] | null | null | null |
content/tampers/modsec.py
|
officialhocc/WhatWaf
|
0ca5c7f1ffc6dfba05e2d0a29799c023c4c6337f
|
[
"MIT"
] | 1
|
2018-12-27T23:18:44.000Z
|
2018-12-27T23:18:44.000Z
|
__example_payload__ = "AND 1=1"
__type__ = "putting the payload in-between a comment with obfuscation in it"
def tamper(payload, **kwargs):
return "/*!00000{}*/".format(payload)
| 26.285714
| 76
| 0.711957
| 25
| 184
| 4.88
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.044586
| 0.146739
| 184
| 6
| 77
| 30.666667
| 0.732484
| 0
| 0
| 0
| 0
| 0
| 0.445652
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0.25
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
f142e9d9b14444ff4f1a0d48cbeca3d83e976eee
| 170
|
py
|
Python
|
src/visualization/lcx/__init__.py
|
HRI-EU/newbee_dataset
|
27f69c388974882b2f797507d4eaa7442f74fa8c
|
[
"MIT"
] | null | null | null |
src/visualization/lcx/__init__.py
|
HRI-EU/newbee_dataset
|
27f69c388974882b2f797507d4eaa7442f74fa8c
|
[
"MIT"
] | null | null | null |
src/visualization/lcx/__init__.py
|
HRI-EU/newbee_dataset
|
27f69c388974882b2f797507d4eaa7442f74fa8c
|
[
"MIT"
] | null | null | null |
# Copyright (C)
# Honda Research Institute Europe GmbH
# Carl-Legien-Str. 30
# 63073 Offenbach/Main
# Germany
#
# UNPUBLISHED PROPRIETARY MATERIAL.
# ALL RIGHTS RESERVED.
| 21.25
| 38
| 0.758824
| 21
| 170
| 6.142857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.048276
| 0.147059
| 170
| 8
| 39
| 21.25
| 0.841379
| 0.905882
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
f151a90ca3292ab66062f70253b42974dc9c840a
| 94
|
py
|
Python
|
lesson_two/apps.py
|
erdyneevzt/courses_django
|
8b8baf58f30a4cbf91a46ce3709b87abed70d230
|
[
"MIT"
] | null | null | null |
lesson_two/apps.py
|
erdyneevzt/courses_django
|
8b8baf58f30a4cbf91a46ce3709b87abed70d230
|
[
"MIT"
] | null | null | null |
lesson_two/apps.py
|
erdyneevzt/courses_django
|
8b8baf58f30a4cbf91a46ce3709b87abed70d230
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class LessonTwoConfig(AppConfig):
name = 'lesson_two'
| 15.666667
| 33
| 0.765957
| 11
| 94
| 6.454545
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.159574
| 94
| 5
| 34
| 18.8
| 0.898734
| 0
| 0
| 0
| 0
| 0
| 0.106383
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
f1528b89c5180eb191a0035075b05db7eb977623
| 50
|
py
|
Python
|
sharpspringclient/exceptions.py
|
oneilinteractive/SharpSpring-Client
|
f9c664c6315927013c566f04fa076903847f0fad
|
[
"MIT"
] | null | null | null |
sharpspringclient/exceptions.py
|
oneilinteractive/SharpSpring-Client
|
f9c664c6315927013c566f04fa076903847f0fad
|
[
"MIT"
] | 4
|
2017-01-31T14:26:49.000Z
|
2021-01-02T02:02:16.000Z
|
sharpspringclient/exceptions.py
|
oneilinteractive/SharpSpring-Client
|
f9c664c6315927013c566f04fa076903847f0fad
|
[
"MIT"
] | 4
|
2017-01-31T05:27:43.000Z
|
2019-05-07T14:07:36.000Z
|
class SharpSpringException(Exception):
pass
| 10
| 38
| 0.76
| 4
| 50
| 9.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.18
| 50
| 4
| 39
| 12.5
| 0.926829
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
f174ce42ba32132b408fcc3b131abd7684a5f03d
| 180
|
py
|
Python
|
tests/conftest.py
|
geometry-labs/icon-api
|
f2e6395b3ec19a21f88d5d554f3ddd2d5e7e936f
|
[
"Apache-2.0"
] | 4
|
2021-04-08T09:16:54.000Z
|
2022-02-07T14:20:45.000Z
|
tests/conftest.py
|
geometry-labs/icon-api
|
f2e6395b3ec19a21f88d5d554f3ddd2d5e7e936f
|
[
"Apache-2.0"
] | 43
|
2021-02-24T04:56:57.000Z
|
2022-02-08T22:57:31.000Z
|
tests/conftest.py
|
geometry-labs/icon-api
|
f2e6395b3ec19a21f88d5d554f3ddd2d5e7e936f
|
[
"Apache-2.0"
] | null | null | null |
import pytest
import requests
@pytest.fixture()
def get_rest():
def get_response(url):
return requests.get('http://localhost/api/v1/' + url)
return get_response
| 16.363636
| 61
| 0.688889
| 24
| 180
| 5.041667
| 0.583333
| 0.099174
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006849
| 0.188889
| 180
| 10
| 62
| 18
| 0.821918
| 0
| 0
| 0
| 0
| 0
| 0.133333
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.285714
| 0.142857
| 0.857143
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
f1910684b74cd2059722cd3ca4d4bc71884783d6
| 2,232
|
py
|
Python
|
toughradius/manage/system/operator_form.py
|
geosson/GSRadius
|
5870e3d055e8366f98b8e65220a1520b5da22f6d
|
[
"Apache-2.0"
] | 1
|
2019-05-12T15:06:58.000Z
|
2019-05-12T15:06:58.000Z
|
toughradius/manage/system/operator_form.py
|
geosson/GSRadius
|
5870e3d055e8366f98b8e65220a1520b5da22f6d
|
[
"Apache-2.0"
] | null | null | null |
toughradius/manage/system/operator_form.py
|
geosson/GSRadius
|
5870e3d055e8366f98b8e65220a1520b5da22f6d
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
# coding=utf-8
from toughlib import btforms
from toughlib.btforms import rules
from toughlib.btforms.rules import button_style, input_style
opr_status_dict = {0: u'正常', 1: u"停用"}
def operator_add_form(nodes=[], products=[]):
return btforms.Form(
btforms.Textbox("operator_name", rules.len_of(2, 32), description=u"操作员名称", required="required", **input_style),
btforms.Textbox("operator_desc", rules.len_of(0, 255), description=u"操作员姓名", **input_style),
btforms.Password("operator_pass", rules.len_of(6, 128), description=u"操作员密码", required="required",**input_style),
btforms.Dropdown("operator_status", description=u"操作员状态", args=opr_status_dict.items(), required="required",**input_style),
btforms.Dropdown("operator_nodes", description=u"关联区域(多选)", args=nodes, required="required",multiple="multiple", size=4, **input_style),
btforms.Dropdown("operator_products", description=u"关联资费(多选)", args=products, required="required",multiple="multiple", size=6, **input_style),
btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style),
title=u"增加操作员",
action="/admin/operator/add"
)
def operator_update_form(nodes=[], products=[]):
return btforms.Form(
btforms.Hidden("id", description=u"编号"),
btforms.Textbox("operator_name", description=u"操作员名称", readonly="readonly", **input_style),
btforms.Textbox("operator_desc", rules.len_of(0, 255), description=u"操作员姓名", **input_style),
btforms.Password("operator_pass", rules.len_of(0, 128), description=u"操作员密码(留空不修改)", autocomplete="off",**input_style),
btforms.Dropdown("operator_status", description=u"操作员状态", args=opr_status_dict.items(), required="required",**input_style),
btforms.Dropdown("operator_nodes", description=u"关联区域(多选)", args=nodes, required="required",multiple="multiple", size=4, **input_style),
btforms.Dropdown("operator_products", description=u"关联资费(多选)", args=products, required="required",multiple="multiple", size=6, **input_style),
btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style),
title=u"修改操作员",
action="/admin/operator/update"
)
| 63.771429
| 150
| 0.696685
| 288
| 2,232
| 5.25
| 0.260417
| 0.085979
| 0.134921
| 0.099206
| 0.714286
| 0.703704
| 0.703704
| 0.638889
| 0.638889
| 0.638889
| 0
| 0.013333
| 0.126344
| 2,232
| 35
| 151
| 63.771429
| 0.762051
| 0.014785
| 0
| 0.413793
| 0
| 0
| 0.207916
| 0.010009
| 0
| 0
| 0
| 0
| 0
| 1
| 0.068966
| false
| 0.068966
| 0.103448
| 0.068966
| 0.241379
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
74b6a920e894bf30ee9600df16390cfb83b27d6d
| 51
|
py
|
Python
|
public/api/rainbowbox/build/lib/rainbowbox/test2.py
|
gaoussoucamara/simens-cerpad
|
c3aece80c519c4d662db091abfccbc0b63f23405
|
[
"BSD-3-Clause"
] | null | null | null |
public/api/rainbowbox/build/lib/rainbowbox/test2.py
|
gaoussoucamara/simens-cerpad
|
c3aece80c519c4d662db091abfccbc0b63f23405
|
[
"BSD-3-Clause"
] | 2
|
2018-02-15T13:31:13.000Z
|
2018-10-17T15:01:40.000Z
|
public/api/rainbowbox/test2.py
|
gaoussoucamara/simens-cerpad
|
c3aece80c519c4d662db091abfccbc0b63f23405
|
[
"BSD-3-Clause"
] | 3
|
2016-08-12T17:56:22.000Z
|
2020-11-11T08:04:47.000Z
|
# coding: utf-8
def ajoute_deux(v):
return v + 12
| 12.75
| 19
| 0.666667
| 10
| 51
| 3.3
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.073171
| 0.196078
| 51
| 4
| 20
| 12.75
| 0.731707
| 0.254902
| 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
| 0
| 0
|
0
| 4
|
74ba3e7b54437837924cf0427a557adbdeef604e
| 515
|
py
|
Python
|
services/merge/ccp_merge_ceil.py
|
lbouma/Cyclopath
|
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
|
[
"Apache-2.0"
] | 15
|
2015-05-06T05:11:48.000Z
|
2021-12-03T14:56:58.000Z
|
services/merge/ccp_merge_ceil.py
|
landonb/Cyclopath
|
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
|
[
"Apache-2.0"
] | null | null | null |
services/merge/ccp_merge_ceil.py
|
landonb/Cyclopath
|
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
|
[
"Apache-2.0"
] | 8
|
2015-05-06T05:11:36.000Z
|
2020-11-04T05:11:22.000Z
|
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
import conf
import g
log = g.log.getLogger('ccp_mrg_ceil')
from merge.ccp_merge_layer_base import Ccp_Merge_Layer_Base
class Ccp_Merge_Ceil(Ccp_Merge_Layer_Base):
def __init__(self, mjob, branch_defs):
Ccp_Merge_Layer_Base.__init__(self, mjob, branch_defs)
# ***
#
def reinit(self):
Ccp_Merge_Layer_Base.reinit(self)
# ***
# ***
if (__name__ == '__main__'):
pass
| 17.758621
| 65
| 0.71068
| 75
| 515
| 4.386667
| 0.52
| 0.145897
| 0.197568
| 0.258359
| 0.133739
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019002
| 0.182524
| 515
| 28
| 66
| 18.392857
| 0.76247
| 0.229126
| 0
| 0
| 0
| 0
| 0.051414
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.181818
| false
| 0.090909
| 0.272727
| 0
| 0.545455
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
74c14c99e806c0ca9fc7710bd3e098222de71192
| 419
|
py
|
Python
|
pysachi/test/sample.py
|
Nauja/pyrabbit
|
43d4b958d7f0afd34d5eb2451086d0d9dc7f288a
|
[
"MIT"
] | 1
|
2020-11-29T19:13:56.000Z
|
2020-11-29T19:13:56.000Z
|
pysachi/test/sample.py
|
Nauja/pysachi
|
43d4b958d7f0afd34d5eb2451086d0d9dc7f288a
|
[
"MIT"
] | null | null | null |
pysachi/test/sample.py
|
Nauja/pysachi
|
43d4b958d7f0afd34d5eb2451086d0d9dc7f288a
|
[
"MIT"
] | null | null | null |
class User:
def __init__(self, login, password):
self._login = login
self._password = password
@property
def login(self):
return self._login
@property
def password(self):
return self._password
class Operation:
def __init__(self, a, func, b):
self._a = a
self._func = func
self._b = b
def result():
return self._func(a, b)
| 18.217391
| 40
| 0.570406
| 51
| 419
| 4.372549
| 0.27451
| 0.121076
| 0.098655
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.334129
| 419
| 22
| 41
| 19.045455
| 0.799283
| 0
| 0
| 0.117647
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.294118
| false
| 0.235294
| 0
| 0.176471
| 0.588235
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
741b7a84ea05f1831356af7d6ade4280347bed16
| 212
|
py
|
Python
|
src/core/classes/pieces/__init__.py
|
javgomzar/chess
|
e40f784af4b8fb11e29c9c60b75ebd5800c7f643
|
[
"MIT"
] | null | null | null |
src/core/classes/pieces/__init__.py
|
javgomzar/chess
|
e40f784af4b8fb11e29c9c60b75ebd5800c7f643
|
[
"MIT"
] | null | null | null |
src/core/classes/pieces/__init__.py
|
javgomzar/chess
|
e40f784af4b8fb11e29c9c60b75ebd5800c7f643
|
[
"MIT"
] | null | null | null |
from .bishop import Bishop
from .king import King
from .knight import Knight
from .piece import Piece
from .pawn import Pawn
from .queen import Queen
from .rook import Rook
from .piece_manager import PieceManager
| 26.5
| 39
| 0.816038
| 33
| 212
| 5.212121
| 0.333333
| 0.104651
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.146226
| 212
| 8
| 39
| 26.5
| 0.950276
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
741dbd89280f4b65384610335b6a0ddfdb45da30
| 57
|
py
|
Python
|
src/accedian_sshhelper/gcloud/zone.py
|
vivienm/acdn-sshelper
|
3154fc6199f51a1388cee291fd20d12f74f2d1f2
|
[
"MIT"
] | 1
|
2021-12-15T18:14:10.000Z
|
2021-12-15T18:14:10.000Z
|
src/accedian_sshhelper/gcloud/zone.py
|
vivienm/acdn-sshelper
|
3154fc6199f51a1388cee291fd20d12f74f2d1f2
|
[
"MIT"
] | null | null | null |
src/accedian_sshhelper/gcloud/zone.py
|
vivienm/acdn-sshelper
|
3154fc6199f51a1388cee291fd20d12f74f2d1f2
|
[
"MIT"
] | null | null | null |
from typing import NewType
Zone = NewType("Zone", str)
| 11.4
| 27
| 0.719298
| 8
| 57
| 5.125
| 0.75
| 0.536585
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.175439
| 57
| 4
| 28
| 14.25
| 0.87234
| 0
| 0
| 0
| 0
| 0
| 0.070175
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
742ee985279349a9bbfdb111ae896ec7cd53a394
| 46
|
py
|
Python
|
misso/__init__.py
|
AntixK/MISSO
|
67a6cb7e149a7da14733f931e21afb887af92f57
|
[
"MIT"
] | 1
|
2020-11-12T14:12:36.000Z
|
2020-11-12T14:12:36.000Z
|
misso/__init__.py
|
AntixK/MISSO
|
67a6cb7e149a7da14733f931e21afb887af92f57
|
[
"MIT"
] | 1
|
2020-12-09T03:52:16.000Z
|
2020-12-10T03:12:29.000Z
|
misso/__init__.py
|
AntixK/MISSO
|
67a6cb7e149a7da14733f931e21afb887af92f57
|
[
"MIT"
] | null | null | null |
from .misso import MISSO
__version__ = "0.1"
| 11.5
| 24
| 0.717391
| 7
| 46
| 4.142857
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.052632
| 0.173913
| 46
| 3
| 25
| 15.333333
| 0.710526
| 0
| 0
| 0
| 0
| 0
| 0.065217
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
744c7968e5834a5d1f2529a010cf7e20eeaab260
| 220
|
py
|
Python
|
pcep/progs/main3.py
|
gliverm/devnet-study-group
|
28aecef8207cfeb8f10dc375c22e5ec953d6762b
|
[
"MIT"
] | 1
|
2020-07-30T15:23:55.000Z
|
2020-07-30T15:23:55.000Z
|
pcep/progs/main3.py
|
gliverm/devnet-study-group
|
28aecef8207cfeb8f10dc375c22e5ec953d6762b
|
[
"MIT"
] | null | null | null |
pcep/progs/main3.py
|
gliverm/devnet-study-group
|
28aecef8207cfeb8f10dc375c22e5ec953d6762b
|
[
"MIT"
] | null | null | null |
# main.py
from sys import path
path.append('../packages')
import extra.iota
import extra.good.best.sigma
from extra.good.best.tau import FunT
print(extra.iota.FunI())
print(extra.good.best.sigma.FunS())
print(FunT())
| 16.923077
| 36
| 0.745455
| 36
| 220
| 4.555556
| 0.5
| 0.164634
| 0.237805
| 0.219512
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095455
| 220
| 13
| 37
| 16.923077
| 0.824121
| 0.031818
| 0
| 0
| 0
| 0
| 0.051887
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0.375
| 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
| 0
| 0
|
0
| 4
|
7460dd150aa082b0968d907e76ecff9cb0db9128
| 6,914
|
py
|
Python
|
wiktfinnish/tests/test_formnames.py
|
EvoluzTampere/wiktfinnish
|
88ff81d999d9bdbddc62cc62618c97fbdf17560e
|
[
"MIT"
] | 16
|
2019-01-05T22:58:57.000Z
|
2022-02-07T06:57:11.000Z
|
wiktfinnish/tests/test_formnames.py
|
EvoluzTampere/wiktfinnish
|
88ff81d999d9bdbddc62cc62618c97fbdf17560e
|
[
"MIT"
] | 1
|
2019-12-30T21:42:13.000Z
|
2019-12-31T17:26:10.000Z
|
wiktfinnish/tests/test_formnames.py
|
EvoluzTampere/wiktfinnish
|
88ff81d999d9bdbddc62cc62618c97fbdf17560e
|
[
"MIT"
] | 2
|
2019-05-04T12:31:59.000Z
|
2019-11-06T11:56:43.000Z
|
# Tests for grammatical form names.
#
# Copyright (c) 2018 Tatu Ylonen. See https://ylonen.org
import unittest
import wiktfinnish
class TestDecode(unittest.TestCase):
def test_comp_forms(self):
lst = wiktfinnish.COMPARATIVE_FORMS
assert isinstance(lst, (list, tuple, set))
for x in lst:
assert isinstance(x, str)
assert "" in lst
assert "comp" in lst
assert "sup" in lst
def test_case_forms(self):
lst = wiktfinnish.CASE_FORMS
assert isinstance(lst, (list, tuple, set))
for x in lst:
assert isinstance(x, str)
assert "" in lst
assert "nom-pl" in lst
assert "ill-pl" in lst
assert "acc-sg" in lst
assert "acc-pl" in lst
def test_poss_forms(self):
lst = wiktfinnish.POSSESSIVE_FORMS
assert isinstance(lst, (list, tuple, set))
for x in lst:
assert isinstance(x, str)
assert "" in lst
assert "1s" in lst
assert "2p" in lst
assert "3x" in lst
assert "3p" not in lst
def test_clitic_forms(self):
lst = wiktfinnish.CLITIC_FORMS
assert isinstance(lst, (list, tuple, set))
for x in lst:
assert isinstance(x, str)
assert "" in lst
assert "kO" in lst
assert "pAhAn" in lst
def test_clitic_forms(self):
lst = wiktfinnish.VERB_FORMS
assert isinstance(lst, (list, tuple, set))
for x in lst:
assert isinstance(x, str)
assert "" in lst
assert "pres-1sg" in lst
assert "past-part" in lst
def test_iter_noun(self):
cnt = 0
for form in wiktfinnish.all_forms_iter("noun"):
cnt += 1
vform, comp, case, poss, clitic = form
assert vform == ""
assert comp == ""
assert case in wiktfinnish.CASE_FORMS
assert poss in wiktfinnish.POSSESSIVE_FORMS
assert clitic in wiktfinnish.CLITIC_FORMS
assert cnt > 1000 and cnt < 3000
def test_iter_adj(self):
cnt = 0
num_comp = 0
for form in wiktfinnish.all_forms_iter("adj"):
cnt += 1
vform, comp, case, poss, clitic = form
assert vform == ""
assert comp in wiktfinnish.COMPARATIVE_FORMS
if comp != "":
num_comp += 1
assert case in wiktfinnish.CASE_FORMS
assert poss in wiktfinnish.POSSESSIVE_FORMS
assert clitic in wiktfinnish.CLITIC_FORMS
assert cnt > 3000 and cnt < 9000
assert num_comp > 0
for form in wiktfinnish.all_forms_iter("adj", no_comp=True):
cnt += 1
vform, comp, case, poss, clitic = form
assert vform == ""
assert comp == ""
assert case in wiktfinnish.CASE_FORMS
assert poss in wiktfinnish.POSSESSIVE_FORMS
assert clitic in wiktfinnish.CLITIC_FORMS
for form in wiktfinnish.all_forms_iter("adj", no_comp=True,
no_clitic=True):
cnt += 1
vform, comp, case, poss, clitic = form
assert vform == ""
assert comp == ""
assert case in wiktfinnish.CASE_FORMS
assert poss in wiktfinnish.POSSESSIVE_FORMS
assert clitic == ""
num_comp = 0
for form in wiktfinnish.all_forms_iter("adj", no_clitic=True):
cnt += 1
vform, comp, case, poss, clitic = form
assert vform == ""
assert comp in wiktfinnish.COMPARATIVE_FORMS
if comp != "":
num_comp += 1
assert case in wiktfinnish.CASE_FORMS
assert poss in wiktfinnish.POSSESSIVE_FORMS
assert clitic == ""
assert num_comp > 0
def test_iter_verb(self):
cnt = 0
num_comp = 0
for form in wiktfinnish.all_forms_iter("verb"):
cnt += 1
vform, comp, case, poss, clitic = form
assert vform != "" and vform in wiktfinnish.VERB_FORMS
assert comp in wiktfinnish.COMPARATIVE_FORMS
if comp != "":
num_comp += 1
assert case == "" or case in wiktfinnish.CASE_FORMS
assert poss == "" or poss in wiktfinnish.POSSESSIVE_FORMS
assert clitic in wiktfinnish.CLITIC_FORMS
assert cnt > 10000 and cnt < 50000
assert num_comp > 0
def test_iter_adv(self):
cnt = 0
num_comp = 0
for form in wiktfinnish.all_forms_iter("adv"):
cnt += 1
vform, comp, case, poss, clitic = form
assert vform == ""
assert comp in wiktfinnish.COMPARATIVE_FORMS
if comp != "":
num_comp += 1
assert case == ""
assert poss == ""
assert clitic in wiktfinnish.CLITIC_FORMS
assert cnt >= len(wiktfinnish.COMPARATIVE_FORMS)
assert cnt <= (len(wiktfinnish.COMPARATIVE_FORMS) *
len(wiktfinnish.CLITIC_FORMS))
assert num_comp > 1
def test_iter_bogus(self):
lst = list(wiktfinnish.all_forms_iter("bogus-nonex"))
assert lst == [("", "", "", "", "")]
def test_list_verb(self):
x = list(wiktfinnish.all_forms_iter("verb"))
xx = wiktfinnish.all_forms_list("verb")
assert list(sorted(x)) == list(sorted(xx))
y = wiktfinnish.all_forms_list("verb", no_comp=True)
assert len(x) > len(y)
for form in y:
assert form in x
y = wiktfinnish.all_forms_list("verb", no_case=True)
assert len(x) > len(y)
for form in y:
assert form in x
y = wiktfinnish.all_forms_list("verb", no_poss=True)
assert len(x) > len(y)
# In this case, some of the forms may not be in x
y = wiktfinnish.all_forms_list("verb", no_clitic=True)
assert len(x) > len(y)
for form in y:
assert form in x
def test_list_adj(self):
x = wiktfinnish.all_forms_list("adj")
assert isinstance(x, (list, tuple))
y = wiktfinnish.all_forms_list("adj", no_comp=True)
assert isinstance(y, (list, tuple))
assert len(x) > len(y)
for form in y:
assert form in x
z = wiktfinnish.all_forms_list("adj", no_comp=True, no_case=True)
assert len(y) > len(z)
for form in z:
assert form in y
def test_list_noun(self):
x = wiktfinnish.all_forms_list("noun")
y = wiktfinnish.all_forms_list("noun", no_case=True)
assert len(x) > len(y)
for form in y:
assert form in x
z = wiktfinnish.all_forms_list("noun", no_case=True, no_poss=True)
assert len(y) > len(z)
for form in z:
assert form in y
| 35.096447
| 74
| 0.560457
| 871
| 6,914
| 4.30884
| 0.102181
| 0.100453
| 0.101252
| 0.067413
| 0.775913
| 0.745537
| 0.725819
| 0.676525
| 0.631761
| 0.601119
| 0
| 0.012949
| 0.352184
| 6,914
| 196
| 75
| 35.27551
| 0.824961
| 0.019815
| 0
| 0.60452
| 0
| 0
| 0.020969
| 0
| 0
| 0
| 0
| 0
| 0.519774
| 1
| 0.073446
| false
| 0
| 0.011299
| 0
| 0.090395
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7489127c43b0004f91ab406122422c843a532df4
| 69
|
py
|
Python
|
amocrm_asterisk_ng/infrastructure/event_bus/__init__.py
|
iqtek/amocrn_asterisk_ng
|
429a8d0823b951c855a49c1d44ab0e05263c54dc
|
[
"MIT"
] | null | null | null |
amocrm_asterisk_ng/infrastructure/event_bus/__init__.py
|
iqtek/amocrn_asterisk_ng
|
429a8d0823b951c855a49c1d44ab0e05263c54dc
|
[
"MIT"
] | null | null | null |
amocrm_asterisk_ng/infrastructure/event_bus/__init__.py
|
iqtek/amocrn_asterisk_ng
|
429a8d0823b951c855a49c1d44ab0e05263c54dc
|
[
"MIT"
] | null | null | null |
from .events import BaseEvent
from .startup import event_bus_startup
| 23
| 38
| 0.855072
| 10
| 69
| 5.7
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115942
| 69
| 2
| 39
| 34.5
| 0.934426
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
778980738e28ee35de8aaac53e9abc8728e32fd0
| 264
|
py
|
Python
|
aprendizado/curso_em_video/desafios/desafio047.py
|
renatodev95/Python
|
2adee4a01de41f8bbb68fce563100c135a5ab549
|
[
"MIT"
] | null | null | null |
aprendizado/curso_em_video/desafios/desafio047.py
|
renatodev95/Python
|
2adee4a01de41f8bbb68fce563100c135a5ab549
|
[
"MIT"
] | null | null | null |
aprendizado/curso_em_video/desafios/desafio047.py
|
renatodev95/Python
|
2adee4a01de41f8bbb68fce563100c135a5ab549
|
[
"MIT"
] | null | null | null |
# Crie um programa que mostre na tela todos os números pares que estão no intervalo entre 1 e 50.
print('Os números PARES que estão no intervalo entre 1 e 50 são: ')
for c in range(2, 51, 2):
print('.', end='')
print(c, end=' ')
print('Acabou...')
| 33
| 98
| 0.640152
| 46
| 264
| 3.673913
| 0.608696
| 0.106509
| 0.16568
| 0.201183
| 0.497041
| 0.497041
| 0.497041
| 0.497041
| 0.497041
| 0.497041
| 0
| 0.049261
| 0.231061
| 264
| 7
| 99
| 37.714286
| 0.783251
| 0.359848
| 0
| 0
| 0
| 0
| 0.43125
| 0
| 0
| 0
| 0
| 0.142857
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.8
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
779e1fee0c45343024c41dcd006fd92c34345cf8
| 95
|
py
|
Python
|
saefportal/datastores/apps.py
|
harry-consulting/SAEF1
|
055d6e492ba76f90e3248b9da2985fdfe0c6b430
|
[
"BSD-2-Clause"
] | null | null | null |
saefportal/datastores/apps.py
|
harry-consulting/SAEF1
|
055d6e492ba76f90e3248b9da2985fdfe0c6b430
|
[
"BSD-2-Clause"
] | null | null | null |
saefportal/datastores/apps.py
|
harry-consulting/SAEF1
|
055d6e492ba76f90e3248b9da2985fdfe0c6b430
|
[
"BSD-2-Clause"
] | 1
|
2020-12-16T15:02:52.000Z
|
2020-12-16T15:02:52.000Z
|
from django.apps import AppConfig
class DatastoresConfig(AppConfig):
name = 'datastores'
| 15.833333
| 34
| 0.768421
| 10
| 95
| 7.3
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 95
| 5
| 35
| 19
| 0.9125
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
77ccabc8049478823634ba111a55020d3f0ae63c
| 89
|
py
|
Python
|
ShopApp/apps.py
|
Sabrinax3/Pet-Clinic-1
|
776955d118a46c8d4eaa74de22ea0280b82debc9
|
[
"MIT"
] | 2
|
2020-04-13T14:26:54.000Z
|
2022-01-19T01:30:25.000Z
|
ShopApp/apps.py
|
Sabrinax3/Pet-Clinic-1
|
776955d118a46c8d4eaa74de22ea0280b82debc9
|
[
"MIT"
] | 2
|
2020-05-29T18:52:55.000Z
|
2020-05-30T02:06:28.000Z
|
ShopApp/apps.py
|
Sabrinax3/Pet-Clinic-1
|
776955d118a46c8d4eaa74de22ea0280b82debc9
|
[
"MIT"
] | 8
|
2020-04-11T08:30:44.000Z
|
2020-05-30T03:26:13.000Z
|
from django.apps import AppConfig
class ShopappConfig(AppConfig):
name = 'ShopApp'
| 14.833333
| 33
| 0.752809
| 10
| 89
| 6.7
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168539
| 89
| 5
| 34
| 17.8
| 0.905405
| 0
| 0
| 0
| 0
| 0
| 0.078652
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
77e4c403ba5897f8c73a8ced889396929c04c95e
| 64
|
py
|
Python
|
kojistatus/__main__.py
|
befeleme/kojistatus
|
a93bdff6aee5cd07129e6d9e828716fa8841f77a
|
[
"MIT"
] | null | null | null |
kojistatus/__main__.py
|
befeleme/kojistatus
|
a93bdff6aee5cd07129e6d9e828716fa8841f77a
|
[
"MIT"
] | 5
|
2018-01-23T10:39:12.000Z
|
2021-05-03T12:01:17.000Z
|
kojistatus/__main__.py
|
befeleme/kojistatus
|
a93bdff6aee5cd07129e6d9e828716fa8841f77a
|
[
"MIT"
] | 1
|
2019-04-25T11:26:29.000Z
|
2019-04-25T11:26:29.000Z
|
from kojistatus import application
application.run(debug=True)
| 16
| 34
| 0.84375
| 8
| 64
| 6.75
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09375
| 64
| 3
| 35
| 21.333333
| 0.931034
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
77f814d2cfea15aab2c08d619ecbb6b0248f4687
| 105
|
py
|
Python
|
cacheq/__init__.py
|
misterte/django-cacheq
|
9d0430fe32cc8a327b5a64d14266032cdd42ab96
|
[
"BSD-3-Clause"
] | 3
|
2015-07-28T14:21:29.000Z
|
2015-07-30T09:57:40.000Z
|
cacheq/__init__.py
|
misterte/django-cacheq
|
9d0430fe32cc8a327b5a64d14266032cdd42ab96
|
[
"BSD-3-Clause"
] | null | null | null |
cacheq/__init__.py
|
misterte/django-cacheq
|
9d0430fe32cc8a327b5a64d14266032cdd42ab96
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import absolute_import
from .base import CacheQ, Worker, get_worker
__version__ = '0.1.1'
| 35
| 44
| 0.809524
| 16
| 105
| 4.6875
| 0.6875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.032258
| 0.114286
| 105
| 3
| 45
| 35
| 0.774194
| 0
| 0
| 0
| 0
| 0
| 0.04717
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
77faf920373ab1a0dff0cb61632734591ec47ec6
| 41
|
py
|
Python
|
src/project poker/bet_log.py
|
acc-cosc-1336/cosc-1336-spring-2018-EricScotty
|
80c0249a583dc178cfc7bb95b851d7f3240dc3e9
|
[
"MIT"
] | null | null | null |
src/project poker/bet_log.py
|
acc-cosc-1336/cosc-1336-spring-2018-EricScotty
|
80c0249a583dc178cfc7bb95b851d7f3240dc3e9
|
[
"MIT"
] | null | null | null |
src/project poker/bet_log.py
|
acc-cosc-1336/cosc-1336-spring-2018-EricScotty
|
80c0249a583dc178cfc7bb95b851d7f3240dc3e9
|
[
"MIT"
] | null | null | null |
rosha = bet_log[-1]
bet_log = []
| 6.833333
| 20
| 0.487805
| 6
| 41
| 3
| 0.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037037
| 0.341463
| 41
| 5
| 21
| 8.2
| 0.62963
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
77ff10192fd9ca9b6da47d99f0d63d0b953ac83e
| 26
|
py
|
Python
|
pws_tiltmeter_cos/mbc_pws_sensor_cos/__init__.py
|
stop-it-h2020-project/PublicWarningNotificationSystem
|
b2d5e80a10dcb40e7638e36613fa0c1a6cb95939
|
[
"CC-BY-4.0"
] | null | null | null |
pws_tiltmeter_cos/mbc_pws_sensor_cos/__init__.py
|
stop-it-h2020-project/PublicWarningNotificationSystem
|
b2d5e80a10dcb40e7638e36613fa0c1a6cb95939
|
[
"CC-BY-4.0"
] | null | null | null |
pws_tiltmeter_cos/mbc_pws_sensor_cos/__init__.py
|
stop-it-h2020-project/PublicWarningNotificationSystem
|
b2d5e80a10dcb40e7638e36613fa0c1a6cb95939
|
[
"CC-BY-4.0"
] | null | null | null |
__version__ = "1.0.3-RC1"
| 13
| 25
| 0.653846
| 5
| 26
| 2.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173913
| 0.115385
| 26
| 1
| 26
| 26
| 0.391304
| 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
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7af1d3314e736f8cac696577b72de7c9ee460294
| 841
|
py
|
Python
|
src/configuration/config_provider.py
|
vkhaydarov/PlantEye
|
bfc4f59023cfa97012ce0e5ca1b94f97b88b6f69
|
[
"MIT"
] | null | null | null |
src/configuration/config_provider.py
|
vkhaydarov/PlantEye
|
bfc4f59023cfa97012ce0e5ca1b94f97b88b6f69
|
[
"MIT"
] | null | null | null |
src/configuration/config_provider.py
|
vkhaydarov/PlantEye
|
bfc4f59023cfa97012ce0e5ca1b94f97b88b6f69
|
[
"MIT"
] | null | null | null |
from abc import ABC, abstractmethod
from yaml import safe_load
class ConfigProvider(ABC):
@abstractmethod
def provide_config(self):
pass
@abstractmethod
def provide_name(self):
pass
class FileConfigProvider(ConfigProvider):
def __init__(self, cfg_name, cfg_file):
self.cfg_name = cfg_name
self.cfg_file = cfg_file
def provide_config(self):
with open(self.cfg_file) as config_file:
cfg = safe_load(config_file)
return cfg
def provide_name(self):
return self.cfg_name
class DictConfigProvider(ConfigProvider):
def __init__(self, cfg_name, cfg_dict):
self.cfg_name = cfg_name
self.cfg_dict = cfg_dict
def provide_config(self):
return self.cfg_dict
def provide_name(self):
return self.cfg_name
| 21.564103
| 48
| 0.673008
| 108
| 841
| 4.925926
| 0.231481
| 0.131579
| 0.12406
| 0.105263
| 0.357143
| 0.357143
| 0.357143
| 0.131579
| 0
| 0
| 0
| 0
| 0.258026
| 841
| 38
| 49
| 22.131579
| 0.852564
| 0
| 0
| 0.518519
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.296296
| false
| 0.074074
| 0.074074
| 0.111111
| 0.62963
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
7afd68a43fc6361236f838c7be698206c295dac8
| 111
|
py
|
Python
|
airports/apps.py
|
vlinhart/django-airports
|
c58c67540498c177f7c3d373d3a84b2abd944241
|
[
"MIT"
] | null | null | null |
airports/apps.py
|
vlinhart/django-airports
|
c58c67540498c177f7c3d373d3a84b2abd944241
|
[
"MIT"
] | null | null | null |
airports/apps.py
|
vlinhart/django-airports
|
c58c67540498c177f7c3d373d3a84b2abd944241
|
[
"MIT"
] | 1
|
2020-06-06T00:18:41.000Z
|
2020-06-06T00:18:41.000Z
|
# -*- coding: utf-8
from django.apps import AppConfig
class AirportsConfig(AppConfig):
name = 'airports'
| 15.857143
| 33
| 0.711712
| 13
| 111
| 6.076923
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.01087
| 0.171171
| 111
| 6
| 34
| 18.5
| 0.847826
| 0.153153
| 0
| 0
| 0
| 0
| 0.086957
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
bb18a6dedff78399cdf7bb8e52d961df00d22c64
| 254
|
py
|
Python
|
saturns_rings/ringer/admin.py
|
AjaySRathore/saturnsrings
|
76e17e2ee9252841cf1e406f4ad271b8ffedef38
|
[
"BSD-3-Clause"
] | 1
|
2020-11-08T06:58:20.000Z
|
2020-11-08T06:58:20.000Z
|
saturns_rings/ringer/admin.py
|
AjaySRathore/saturnsrings
|
76e17e2ee9252841cf1e406f4ad271b8ffedef38
|
[
"BSD-3-Clause"
] | null | null | null |
saturns_rings/ringer/admin.py
|
AjaySRathore/saturnsrings
|
76e17e2ee9252841cf1e406f4ad271b8ffedef38
|
[
"BSD-3-Clause"
] | null | null | null |
from django.contrib import admin
from ringer.models import Ringer, Education, PastJob, Certification
# Register your models here.
admin.site.register(Ringer)
admin.site.register(Education)
admin.site.register(PastJob)
admin.site.register(Certification)
| 28.222222
| 67
| 0.826772
| 33
| 254
| 6.363636
| 0.424242
| 0.171429
| 0.32381
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.082677
| 254
| 8
| 68
| 31.75
| 0.901288
| 0.102362
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
24743de4dba809de131fc86ac9c837eeab6d48d4
| 89
|
py
|
Python
|
tests/basic/none.py
|
treeform/pystorm
|
3a2224bcdaccc5a2abf6a820c0bcf7afa3e6fed4
|
[
"MIT"
] | 50
|
2015-03-24T19:45:34.000Z
|
2022-02-20T04:34:26.000Z
|
tests/basic/none.py
|
MoonStarCZW/py2js
|
6cda2b1d3cf281a5ca92c18b08ac9fa1c389cbea
|
[
"MIT"
] | 2
|
2017-02-26T09:43:07.000Z
|
2017-03-06T20:04:24.000Z
|
tests/basic/none.py
|
Slater-Victoroff/pyjaco
|
89c4e3c46399c5023b0e160005d855a01241c58a
|
[
"MIT"
] | 12
|
2016-03-07T09:30:49.000Z
|
2021-09-05T20:38:47.000Z
|
x = None
if x == None:
print "x is None/null"
else:
print "x is not None/null"
| 11.125
| 30
| 0.573034
| 17
| 89
| 3
| 0.470588
| 0.196078
| 0.313725
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.303371
| 89
| 7
| 31
| 12.714286
| 0.822581
| 0
| 0
| 0
| 0
| 0
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.4
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
249965a4142ba0bbd232807771c15b88343fb0b2
| 194
|
py
|
Python
|
ois_api_client/serialization/hash_password.py
|
peterkulik/ois_api_client
|
51dabcc9f920f89982c4419bb058f5a88193cee0
|
[
"MIT"
] | 7
|
2020-10-22T08:15:29.000Z
|
2022-01-27T07:59:39.000Z
|
ois_api_client/serialization/hash_password.py
|
peterkulik/ois_api_client
|
51dabcc9f920f89982c4419bb058f5a88193cee0
|
[
"MIT"
] | null | null | null |
ois_api_client/serialization/hash_password.py
|
peterkulik/ois_api_client
|
51dabcc9f920f89982c4419bb058f5a88193cee0
|
[
"MIT"
] | null | null | null |
from hashlib import sha512
def hash_password(password: str) -> str:
ut8_encoded = password.encode('UTF-8', 'strict')
result = sha512(ut8_encoded).hexdigest().upper()
return result
| 24.25
| 52
| 0.706186
| 25
| 194
| 5.36
| 0.72
| 0.149254
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.055556
| 0.164948
| 194
| 7
| 53
| 27.714286
| 0.771605
| 0
| 0
| 0
| 0
| 0
| 0.056701
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0.4
| 0.2
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
24ed2063c20ee45988ca9179e92d18be5b7c4436
| 431
|
py
|
Python
|
fundamentals-of-programming/labs/lab_5-11/repository/filerent.py
|
vampy/university
|
9496cb63594dcf1cc2cec8650b8eee603f85fdab
|
[
"MIT"
] | 6
|
2015-06-22T19:43:13.000Z
|
2019-07-15T18:08:41.000Z
|
fundamentals-of-programming/labs/lab_5-11/repository/filerent.py
|
vampy/university
|
9496cb63594dcf1cc2cec8650b8eee603f85fdab
|
[
"MIT"
] | null | null | null |
fundamentals-of-programming/labs/lab_5-11/repository/filerent.py
|
vampy/university
|
9496cb63594dcf1cc2cec8650b8eee603f85fdab
|
[
"MIT"
] | 1
|
2015-09-26T09:01:54.000Z
|
2015-09-26T09:01:54.000Z
|
#!/usr/bin/python
from domain.rent import Rent
from filerepository import FileRepository
from repository import RepositoryException
class FileRentRepository(FileRepository):
def _validate_instance(self, rent):
if not isinstance(rent, Rent):
raise RepositoryException("Not a rent")
def _get_table_header(self):
return "Client ID\t\t\tMovie ID\t\t\tStart date\t\t\tEnd date\t\t\tReturned Date"
| 30.785714
| 89
| 0.740139
| 58
| 431
| 5.413793
| 0.568966
| 0.025478
| 0.025478
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.171694
| 431
| 13
| 90
| 33.153846
| 0.879552
| 0.037123
| 0
| 0
| 0
| 0.111111
| 0.198068
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.333333
| 0.111111
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
7009f7377e45e246e5bc3703e0b0c68ab709c1de
| 266
|
py
|
Python
|
desafios/desafio002.py
|
genisyskernel/cursoemvideo-python
|
dec301e33933388c886fe78010f38adfb24dae82
|
[
"MIT"
] | 1
|
2020-10-26T04:33:14.000Z
|
2020-10-26T04:33:14.000Z
|
desafios/desafio002.py
|
genisyskernel/cursoemvideo-python
|
dec301e33933388c886fe78010f38adfb24dae82
|
[
"MIT"
] | null | null | null |
desafios/desafio002.py
|
genisyskernel/cursoemvideo-python
|
dec301e33933388c886fe78010f38adfb24dae82
|
[
"MIT"
] | null | null | null |
dia = int(input("\033[1;31mDia\033[m = "))
mes = str(input("\033[1;32mMês\033[m = "))
ano = int(input("\033[1;36mAno\033[m = "))
print("Você nasceu no dia\033[1;36m", dia, "\033[mde \033[1;32m" + mes + "\033[m de\033[1;31m", ano, "\033[m. \033[4;37mCerto!?\033[m")
| 44.333333
| 135
| 0.590226
| 53
| 266
| 2.962264
| 0.433962
| 0.152866
| 0.171975
| 0.152866
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.268085
| 0.116541
| 266
| 5
| 136
| 53.2
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0.612782
| 0.086466
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 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
| 0
|
0
| 4
|
7048c1d48e1125770b69cedf82f4a37c40435402
| 156
|
py
|
Python
|
examples/06here/here_is_cwd.py
|
podhmo/magicalimport
|
b9c516d9d134ca578a85f934caa8c9f9ce6b4fa9
|
[
"MIT"
] | null | null | null |
examples/06here/here_is_cwd.py
|
podhmo/magicalimport
|
b9c516d9d134ca578a85f934caa8c9f9ce6b4fa9
|
[
"MIT"
] | 9
|
2016-10-01T15:25:20.000Z
|
2021-02-18T05:25:43.000Z
|
examples/06here/here_is_cwd.py
|
podhmo/magicalimport
|
b9c516d9d134ca578a85f934caa8c9f9ce6b4fa9
|
[
"MIT"
] | 1
|
2017-07-19T12:38:56.000Z
|
2017-07-19T12:38:56.000Z
|
from magicalimport import import_module
try:
config = import_module("config.py", cwd=True)
print(config.NAME)
except Exception as e:
print(e)
| 17.333333
| 49
| 0.717949
| 22
| 156
| 5
| 0.681818
| 0.218182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.185897
| 156
| 8
| 50
| 19.5
| 0.866142
| 0
| 0
| 0
| 0
| 0
| 0.057692
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
70531ed9cb2996fff266a20b5695c7f521ce1526
| 145
|
py
|
Python
|
photos/urls.py
|
Noble-mungu/gallery-app
|
840d1abba2d1d97e7e920485a402cf6eb82da285
|
[
"Unlicense"
] | null | null | null |
photos/urls.py
|
Noble-mungu/gallery-app
|
840d1abba2d1d97e7e920485a402cf6eb82da285
|
[
"Unlicense"
] | 6
|
2021-03-30T14:17:57.000Z
|
2022-01-13T03:10:49.000Z
|
photos/urls.py
|
Noble-mungu/gallery-app
|
840d1abba2d1d97e7e920485a402cf6eb82da285
|
[
"Unlicense"
] | 1
|
2020-08-11T12:55:40.000Z
|
2020-08-11T12:55:40.000Z
|
from django.conf.urls import url
from .views import index, show_image
urlpatterns = [
url(r'^<int:id>$', show_image, name='show_image')
]
| 16.111111
| 53
| 0.696552
| 22
| 145
| 4.454545
| 0.681818
| 0.27551
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.158621
| 145
| 8
| 54
| 18.125
| 0.803279
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
7054b8078eb4e368e6ca9786831c742ca9b134d5
| 854
|
py
|
Python
|
03-Arithmetic-Operators/challenges/challenge-1-4-18.py
|
upALX/CEV-pythonWorld-One
|
166ee9c22833763daf5ffd6a951ef357dabf4172
|
[
"MIT"
] | null | null | null |
03-Arithmetic-Operators/challenges/challenge-1-4-18.py
|
upALX/CEV-pythonWorld-One
|
166ee9c22833763daf5ffd6a951ef357dabf4172
|
[
"MIT"
] | null | null | null |
03-Arithmetic-Operators/challenges/challenge-1-4-18.py
|
upALX/CEV-pythonWorld-One
|
166ee9c22833763daf5ffd6a951ef357dabf4172
|
[
"MIT"
] | null | null | null |
#Escreva um programa que pergunte a quantidade de Km percorridos por um carro alugado e a quantidade de dias pelos quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro custa 60 reais por dia, e 0,15 centavos por Km rodado.
name = input('Olá, e bem vindo ao último challenge da aula, e mais uma vez, me fala o seu nome: ')
kmPercorridos = float(input('Shoow, {}! É ótimo você estar aqui até agora! Por favor, me fala quantos km o seu carro percorreu: '.format(name)))
daysRented = int(input('{}, agora me fala por quantos dias você ficou com esse carro: '.format(name)))
priceCalc = (60 * daysRented) + (kmPercorridos * 0.15)
print('{}, você me falou que ficou com o carro durante {} dias, e percorreu durante esse tempo um total de {} kilometros, logo o total a pagar é de R$ {} reais!'.format(name, daysRented, kmPercorridos, priceCalc ))
| 142.333333
| 237
| 0.737705
| 144
| 854
| 4.375
| 0.534722
| 0.028571
| 0.04127
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014124
| 0.17096
| 854
| 6
| 238
| 142.333333
| 0.875706
| 0.276347
| 0
| 0
| 0
| 0.6
| 0.640777
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.2
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
705987f5232407680a05763b43a6334280e8ad20
| 226
|
py
|
Python
|
django_eveonline_buyback/admin.py
|
b5n/django-eveonline-buyback
|
d6d882b9600daf472cfc853c5fbe42b454687c6a
|
[
"MIT"
] | 1
|
2021-09-14T21:57:53.000Z
|
2021-09-14T21:57:53.000Z
|
django_eveonline_buyback/admin.py
|
b5n/django-eveonline-buyback
|
d6d882b9600daf472cfc853c5fbe42b454687c6a
|
[
"MIT"
] | 5
|
2020-08-30T17:52:13.000Z
|
2021-02-20T21:26:17.000Z
|
django_eveonline_buyback/admin.py
|
b5n/django-eveonline-buyback
|
d6d882b9600daf472cfc853c5fbe42b454687c6a
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from django_eveonline_buyback.models import BuybackSettings
from django_singleton_admin.admin import DjangoSingletonModelAdmin
admin.site.register(BuybackSettings, DjangoSingletonModelAdmin)
| 32.285714
| 66
| 0.893805
| 24
| 226
| 8.25
| 0.541667
| 0.151515
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.070796
| 226
| 6
| 67
| 37.666667
| 0.942857
| 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
| 0
| 0
|
0
| 4
|
707c675ccdb7dd0c51685b165cf5c8f97cb660a1
| 376
|
py
|
Python
|
core/exchange/InstrumentExchange.py
|
eugene-the-red/automata-core
|
8470232ac17410fb907cb285b8102c1712699740
|
[
"Unlicense"
] | null | null | null |
core/exchange/InstrumentExchange.py
|
eugene-the-red/automata-core
|
8470232ac17410fb907cb285b8102c1712699740
|
[
"Unlicense"
] | null | null | null |
core/exchange/InstrumentExchange.py
|
eugene-the-red/automata-core
|
8470232ac17410fb907cb285b8102c1712699740
|
[
"Unlicense"
] | null | null | null |
from dataclasses import dataclass
@dataclass
class InstrumentExchange:
instrument: str
to_instrument: str
def invert(self):
return InstrumentExchange(self.to_instrument, self.instrument)
def __iter__(self):
return iter((self.instrument, self.to_instrument))
def __repr__(self):
return f'{self.instrument}/{self.to_instrument}'
| 22.117647
| 70
| 0.712766
| 42
| 376
| 6.095238
| 0.380952
| 0.1875
| 0.1875
| 0.15625
| 0.234375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.196809
| 376
| 16
| 71
| 23.5
| 0.847682
| 0
| 0
| 0
| 0
| 0
| 0.101064
| 0.101064
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.090909
| 0.272727
| 0.909091
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
5643290703aaff5fdf033fc3538c373002e50a00
| 14,516
|
py
|
Python
|
examples/RodContactCase/post_processing.py
|
yeonsu-jung/PyElastica
|
fee87b9da22e310ff925c16fdc839bf8405c51a4
|
[
"MIT"
] | null | null | null |
examples/RodContactCase/post_processing.py
|
yeonsu-jung/PyElastica
|
fee87b9da22e310ff925c16fdc839bf8405c51a4
|
[
"MIT"
] | 1
|
2022-01-06T11:30:20.000Z
|
2022-02-07T07:11:22.000Z
|
examples/RodContactCase/post_processing.py
|
yeonsu-jung/PyElastica
|
fee87b9da22e310ff925c16fdc839bf8405c51a4
|
[
"MIT"
] | null | null | null |
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import to_rgb
from mpl_toolkits.mplot3d import proj3d, Axes3D
from tqdm import tqdm
from typing import Dict, Sequence
def plot_video_with_surface(
rods_history: Sequence[Dict],
video_name="video.mp4",
fps=60,
step=1,
vis2D=True,
**kwargs,
):
plt.rcParams.update({"font.size": 22})
# 2d case <always 2d case for now>
import matplotlib.animation as animation
# simulation time
sim_time = np.array(rods_history[0]["time"])
# Rod
n_visualized_rods = len(rods_history) # should be one for now
# Rod info
rod_history_unpacker = lambda rod_idx, t_idx: (
rods_history[rod_idx]["position"][t_idx],
rods_history[rod_idx]["radius"][t_idx],
)
# Rod center of mass
com_history_unpacker = lambda rod_idx, t_idx: rods_history[rod_idx]["com"][time_idx]
# video pre-processing
print("plot scene visualization video")
FFMpegWriter = animation.writers["ffmpeg"]
metadata = dict(title="Movie Test", artist="Matplotlib", comment="Movie support!")
writer = FFMpegWriter(fps=fps, metadata=metadata)
dpi = kwargs.get("dpi", 100)
xlim = kwargs.get("x_limits", (-1.0, 1.0))
ylim = kwargs.get("y_limits", (-1.0, 1.0))
zlim = kwargs.get("z_limits", (-0.05, 1.0))
difference = lambda x: x[1] - x[0]
max_axis_length = max(difference(xlim), difference(ylim))
# The scaling factor from physical space to matplotlib space
scaling_factor = (2 * 0.1) / max_axis_length # Octopus head dimension
scaling_factor *= 2.6e3 # Along one-axis
if kwargs.get("vis3D", True):
fig = plt.figure(1, figsize=(10, 8), frameon=True, dpi=dpi)
ax = plt.axes(projection="3d")
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_zlabel("z")
ax.set_xlim(*xlim)
ax.set_ylim(*ylim)
ax.set_zlim(*zlim)
time_idx = 0
rod_lines = [None for _ in range(n_visualized_rods)]
rod_com_lines = [None for _ in range(n_visualized_rods)]
rod_scatters = [None for _ in range(n_visualized_rods)]
for rod_idx in range(n_visualized_rods):
inst_position, inst_radius = rod_history_unpacker(rod_idx, time_idx)
if not inst_position.shape[1] == inst_radius.shape[0]:
inst_position = 0.5 * (inst_position[..., 1:] + inst_position[..., :-1])
rod_scatters[rod_idx] = ax.scatter(
inst_position[0],
inst_position[1],
inst_position[2],
s=np.pi * (scaling_factor * inst_radius) ** 2,
)
# ax.set_aspect("equal")
video_name_3D = "3D_" + video_name
with writer.saving(fig, video_name_3D, dpi):
with plt.style.context("seaborn-whitegrid"):
for time_idx in tqdm(range(0, sim_time.shape[0], int(step))):
for rod_idx in range(n_visualized_rods):
inst_position, inst_radius = rod_history_unpacker(
rod_idx, time_idx
)
if not inst_position.shape[1] == inst_radius.shape[0]:
inst_position = 0.5 * (
inst_position[..., 1:] + inst_position[..., :-1]
)
rod_scatters[rod_idx]._offsets3d = (
inst_position[0],
inst_position[1],
inst_position[2],
)
# rod_scatters[rod_idx].set_offsets(inst_position[:2].T)
rod_scatters[rod_idx].set_sizes(
np.pi * (scaling_factor * inst_radius) ** 2
)
writer.grab_frame()
# Be a good boy and close figures
# https://stackoverflow.com/a/37451036
# plt.close(fig) alone does not suffice
# See https://github.com/matplotlib/matplotlib/issues/8560/
plt.close(plt.gcf())
if kwargs.get("vis2D", True):
fig = plt.figure(2, figsize=(10, 8), frameon=True, dpi=dpi)
ax = fig.add_subplot(111)
ax.set_xlim(*xlim)
ax.set_ylim(*ylim)
time_idx = 0
rod_lines = [None for _ in range(n_visualized_rods)]
rod_com_lines = [None for _ in range(n_visualized_rods)]
rod_scatters = [None for _ in range(n_visualized_rods)]
for rod_idx in range(n_visualized_rods):
inst_position, inst_radius = rod_history_unpacker(rod_idx, time_idx)
if not inst_position.shape[1] == inst_radius.shape[0]:
inst_position = 0.5 * (inst_position[..., 1:] + inst_position[..., :-1])
rod_lines[rod_idx] = ax.plot(
inst_position[0], inst_position[1], "r", lw=0.5
)[0]
inst_com = com_history_unpacker(rod_idx, time_idx)
rod_com_lines[rod_idx] = ax.plot(inst_com[0], inst_com[1], "k--", lw=2.0)[0]
rod_scatters[rod_idx] = ax.scatter(
inst_position[0],
inst_position[1],
s=np.pi * (scaling_factor * inst_radius) ** 2,
)
ax.set_aspect("equal")
video_name_2D = "2D_xy_" + video_name
with writer.saving(fig, video_name_2D, dpi):
with plt.style.context("seaborn-whitegrid"):
for time_idx in tqdm(range(0, sim_time.shape[0], int(step))):
for rod_idx in range(n_visualized_rods):
inst_position, inst_radius = rod_history_unpacker(
rod_idx, time_idx
)
if not inst_position.shape[1] == inst_radius.shape[0]:
inst_position = 0.5 * (
inst_position[..., 1:] + inst_position[..., :-1]
)
rod_lines[rod_idx].set_xdata(inst_position[0])
rod_lines[rod_idx].set_ydata(inst_position[1])
com = com_history_unpacker(rod_idx, time_idx)
rod_com_lines[rod_idx].set_xdata(com[0])
rod_com_lines[rod_idx].set_ydata(com[1])
rod_scatters[rod_idx].set_offsets(inst_position[:2].T)
rod_scatters[rod_idx].set_sizes(
np.pi * (scaling_factor * inst_radius) ** 2
)
writer.grab_frame()
# Be a good boy and close figures
# https://stackoverflow.com/a/37451036
# plt.close(fig) alone does not suffice
# See https://github.com/matplotlib/matplotlib/issues/8560/
plt.close(plt.gcf())
# Plot zy
fig = plt.figure(2, figsize=(10, 8), frameon=True, dpi=dpi)
ax = fig.add_subplot(111)
ax.set_xlim(*xlim)
ax.set_ylim(*ylim)
time_idx = 0
rod_lines = [None for _ in range(n_visualized_rods)]
rod_com_lines = [None for _ in range(n_visualized_rods)]
rod_scatters = [None for _ in range(n_visualized_rods)]
for rod_idx in range(n_visualized_rods):
inst_position, inst_radius = rod_history_unpacker(rod_idx, time_idx)
if not inst_position.shape[1] == inst_radius.shape[0]:
inst_position = 0.5 * (inst_position[..., 1:] + inst_position[..., :-1])
rod_lines[rod_idx] = ax.plot(
inst_position[2], inst_position[1], "r", lw=0.5
)[0]
inst_com = com_history_unpacker(rod_idx, time_idx)
rod_com_lines[rod_idx] = ax.plot(inst_com[2], inst_com[1], "k--", lw=2.0)[0]
rod_scatters[rod_idx] = ax.scatter(
inst_position[2],
inst_position[1],
s=np.pi * (scaling_factor * inst_radius) ** 2,
)
ax.set_aspect("equal")
video_name_2D = "2D_zy_" + video_name
with writer.saving(fig, video_name_2D, dpi):
with plt.style.context("seaborn-whitegrid"):
for time_idx in tqdm(range(0, sim_time.shape[0], int(step))):
for rod_idx in range(n_visualized_rods):
inst_position, inst_radius = rod_history_unpacker(
rod_idx, time_idx
)
if not inst_position.shape[1] == inst_radius.shape[0]:
inst_position = 0.5 * (
inst_position[..., 1:] + inst_position[..., :-1]
)
rod_lines[rod_idx].set_xdata(inst_position[2])
rod_lines[rod_idx].set_ydata(inst_position[1])
com = com_history_unpacker(rod_idx, time_idx)
rod_com_lines[rod_idx].set_xdata(com[2])
rod_com_lines[rod_idx].set_ydata(com[1])
rod_scatters[rod_idx].set_offsets(
np.vstack((inst_position[2], inst_position[1])).T
)
rod_scatters[rod_idx].set_sizes(
np.pi * (scaling_factor * inst_radius) ** 2
)
writer.grab_frame()
# Be a good boy and close figures
# https://stackoverflow.com/a/37451036
# plt.close(fig) alone does not suffice
# See https://github.com/matplotlib/matplotlib/issues/8560/
plt.close(plt.gcf())
# Plot xz
fig = plt.figure(2, figsize=(10, 8), frameon=True, dpi=dpi)
ax = fig.add_subplot(111)
ax.set_xlim(-1.0, 1.0)
ax.set_ylim(-1.0, 1.0)
time_idx = 0
rod_lines = [None for _ in range(n_visualized_rods)]
rod_com_lines = [None for _ in range(n_visualized_rods)]
rod_scatters = [None for _ in range(n_visualized_rods)]
for rod_idx in range(n_visualized_rods):
inst_position, inst_radius = rod_history_unpacker(rod_idx, time_idx)
if not inst_position.shape[1] == inst_radius.shape[0]:
inst_position = 0.5 * (inst_position[..., 1:] + inst_position[..., :-1])
rod_lines[rod_idx] = ax.plot(
inst_position[0], inst_position[2], "r", lw=0.5
)[0]
inst_com = com_history_unpacker(rod_idx, time_idx)
rod_com_lines[rod_idx] = ax.plot(inst_com[0], inst_com[2], "k--", lw=2.0)[0]
rod_scatters[rod_idx] = ax.scatter(
inst_position[0],
inst_position[2],
s=np.pi * (scaling_factor * inst_radius) ** 2,
)
ax.set_aspect("equal")
video_name_2D = "2D_xz_" + video_name
with writer.saving(fig, video_name_2D, dpi):
with plt.style.context("seaborn-whitegrid"):
for time_idx in tqdm(range(0, sim_time.shape[0], int(step))):
for rod_idx in range(n_visualized_rods):
inst_position, inst_radius = rod_history_unpacker(
rod_idx, time_idx
)
if not inst_position.shape[1] == inst_radius.shape[0]:
inst_position = 0.5 * (
inst_position[..., 1:] + inst_position[..., :-1]
)
rod_lines[rod_idx].set_xdata(inst_position[0])
rod_lines[rod_idx].set_ydata(inst_position[2])
com = com_history_unpacker(rod_idx, time_idx)
rod_com_lines[rod_idx].set_xdata(com[0])
rod_com_lines[rod_idx].set_ydata(com[2])
rod_scatters[rod_idx].set_offsets(
np.vstack((inst_position[0], inst_position[2])).T
)
rod_scatters[rod_idx].set_sizes(
np.pi * (scaling_factor * inst_radius) ** 2
)
writer.grab_frame()
# Be a good boy and close figures
# https://stackoverflow.com/a/37451036
# plt.close(fig) alone does not suffice
# See https://github.com/matplotlib/matplotlib/issues/8560/
plt.close(plt.gcf())
def plot_velocity(
plot_params_rod_one: dict,
plot_params_rod_two: dict,
filename="velocity.png",
SAVE_FIGURE=False,
):
time = np.array(plot_params_rod_one["time"])
avg_velocity_rod_one = np.array(plot_params_rod_one["com_velocity"])
avg_velocity_rod_two = np.array(plot_params_rod_two["com_velocity"])
total_energy_rod_one = np.array(plot_params_rod_one["total_energy"])
total_energy_rod_two = np.array(plot_params_rod_two["total_energy"])
fig = plt.figure(figsize=(12, 10), frameon=True, dpi=150)
axs = []
axs.append(plt.subplot2grid((4, 1), (0, 0)))
axs.append(plt.subplot2grid((4, 1), (1, 0)))
axs.append(plt.subplot2grid((4, 1), (2, 0)))
axs.append(plt.subplot2grid((4, 1), (3, 0)))
axs[0].plot(time[:], avg_velocity_rod_one[:, 0], linewidth=3, label="rod_one")
axs[0].plot(time[:], avg_velocity_rod_two[:, 0], linewidth=3, label="rod_two")
axs[0].set_ylabel("x velocity", fontsize=20)
axs[1].plot(
time[:], avg_velocity_rod_one[:, 1], linewidth=3,
)
axs[1].plot(
time[:], avg_velocity_rod_two[:, 1], linewidth=3,
)
axs[1].set_ylabel("y velocity", fontsize=20)
axs[2].plot(
time[:], avg_velocity_rod_one[:, 2], linewidth=3,
)
axs[2].plot(
time[:], avg_velocity_rod_two[:, 2], linewidth=3,
)
axs[2].set_ylabel("z velocity", fontsize=20)
axs[3].semilogy(
time[:], total_energy_rod_one[:], linewidth=3,
)
axs[3].semilogy(
time[:], total_energy_rod_two[:], linewidth=3,
)
axs[3].semilogy(
time[:],
np.abs(total_energy_rod_one[:] - total_energy_rod_two[:]),
"--",
linewidth=3,
)
axs[3].set_ylabel("total_energy", fontsize=20)
axs[3].set_xlabel("time [s]", fontsize=20)
plt.tight_layout()
# fig.align_ylabels()
fig.legend(prop={"size": 20})
# fig.savefig(filename)
plt.show()
plt.close(plt.gcf())
if SAVE_FIGURE:
# fig.savefig(filename)
plt.savefig(filename)
| 38.606383
| 88
| 0.549049
| 1,850
| 14,516
| 4.02973
| 0.115135
| 0.112676
| 0.043595
| 0.04829
| 0.783233
| 0.764051
| 0.746881
| 0.708786
| 0.672569
| 0.667337
| 0
| 0.033888
| 0.329154
| 14,516
| 375
| 89
| 38.709333
| 0.73167
| 0.071507
| 0
| 0.541516
| 0
| 0
| 0.029827
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.00722
| false
| 0
| 0.025271
| 0
| 0.032491
| 0.00361
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
564a3d058998b4c562ed848d22e00bee0ec2fd7c
| 127
|
py
|
Python
|
cm/file.py
|
BlueWhaleMain/cipher-manager
|
80f82119f60fba753db7ab1b697c2746c8e4538f
|
[
"MIT"
] | 1
|
2022-01-28T06:07:29.000Z
|
2022-01-28T06:07:29.000Z
|
cm/file.py
|
BlueWhaleMain/cipher-manager
|
80f82119f60fba753db7ab1b697c2746c8e4538f
|
[
"MIT"
] | null | null | null |
cm/file.py
|
BlueWhaleMain/cipher-manager
|
80f82119f60fba753db7ab1b697c2746c8e4538f
|
[
"MIT"
] | null | null | null |
import pydantic
class CipherFile(pydantic.BaseModel):
# 使用的编码
encoding: str
# 使用的加密算法
encrypt_algorithm: str
| 14.111111
| 37
| 0.700787
| 13
| 127
| 6.769231
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.23622
| 127
| 8
| 38
| 15.875
| 0.907216
| 0.102362
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.25
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
5654041867b7cab6d5deac0d05da79571ee8641b
| 108
|
py
|
Python
|
create_db.py
|
isabella232/pygate-webapp
|
c6ebfd0ca29457d3d39e97df1ba8ad16999ad913
|
[
"MIT"
] | 6
|
2020-07-07T05:43:56.000Z
|
2020-10-14T23:23:58.000Z
|
create_db.py
|
isabella232/pygate-webapp
|
c6ebfd0ca29457d3d39e97df1ba8ad16999ad913
|
[
"MIT"
] | 9
|
2020-07-28T21:52:15.000Z
|
2020-09-24T16:51:37.000Z
|
create_db.py
|
isabella232/pygate-webapp
|
c6ebfd0ca29457d3d39e97df1ba8ad16999ad913
|
[
"MIT"
] | 2
|
2020-08-18T18:36:56.000Z
|
2022-03-24T07:23:28.000Z
|
"""
Create the application database if it doesn't already exist
"""
from pygate import db
db.create_all()
| 13.5
| 59
| 0.740741
| 17
| 108
| 4.647059
| 0.882353
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 108
| 7
| 60
| 15.428571
| 0.877778
| 0.546296
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
5668e6754bad43684deac3627e23ca2b46440bdc
| 87
|
py
|
Python
|
4_fourthproject/myinfo/apps.py
|
LikeLionSCH/Django_Example
|
6a851c8c2321a5f600d3ba62ca30e4c97d06d06b
|
[
"MIT"
] | 1
|
2019-12-30T04:55:23.000Z
|
2019-12-30T04:55:23.000Z
|
4_fourthproject/myinfo/apps.py
|
LikeLionSCH/Django_Example
|
6a851c8c2321a5f600d3ba62ca30e4c97d06d06b
|
[
"MIT"
] | null | null | null |
4_fourthproject/myinfo/apps.py
|
LikeLionSCH/Django_Example
|
6a851c8c2321a5f600d3ba62ca30e4c97d06d06b
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class MyinfoConfig(AppConfig):
name = 'myinfo'
| 14.5
| 33
| 0.747126
| 10
| 87
| 6.5
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172414
| 87
| 5
| 34
| 17.4
| 0.902778
| 0
| 0
| 0
| 0
| 0
| 0.068966
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
5673ba65a2d13df43306975e65e8e71a8cd265a9
| 111
|
py
|
Python
|
restaurant_project/sales/urls.py
|
deepaksood619/Projects
|
93f09db22ad65e72e2a2ffc909b2bb3e1e5c5fa7
|
[
"MIT"
] | null | null | null |
restaurant_project/sales/urls.py
|
deepaksood619/Projects
|
93f09db22ad65e72e2a2ffc909b2bb3e1e5c5fa7
|
[
"MIT"
] | 5
|
2021-03-19T03:52:50.000Z
|
2022-02-10T11:43:51.000Z
|
sales/urls.py
|
deepchatterjeevns/SmartQHiringChallenge
|
1151e8ac69325461179a7c15dec2e7709b811a74
|
[
"MIT"
] | null | null | null |
from django.urls import path
from . import views
urlpatterns = [
path('total_sale/', views.total_sale)
]
| 13.875
| 41
| 0.711712
| 15
| 111
| 5.133333
| 0.6
| 0.233766
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.18018
| 111
| 7
| 42
| 15.857143
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0.099099
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
56755a9a99569c35aeb1ed5465bd172d06c723ce
| 102
|
py
|
Python
|
{{cookiecutter.project_slug}}/test/context.py
|
blueskyideas/cookiecutter-python
|
754c1c7f457e3cd13918308a4b946eaeac5b2529
|
[
"MIT"
] | 1
|
2018-01-18T12:54:03.000Z
|
2018-01-18T12:54:03.000Z
|
{{cookiecutter.project_slug}}/test/context.py
|
blueskyideas/cookiecutter-python
|
754c1c7f457e3cd13918308a4b946eaeac5b2529
|
[
"MIT"
] | null | null | null |
{{cookiecutter.project_slug}}/test/context.py
|
blueskyideas/cookiecutter-python
|
754c1c7f457e3cd13918308a4b946eaeac5b2529
|
[
"MIT"
] | null | null | null |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import {{ cookiecutter.project_slug }}
| 20.4
| 41
| 0.72549
| 15
| 102
| 4.866667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.01087
| 0.098039
| 102
| 5
| 42
| 20.4
| 0.782609
| 0
| 0
| 0
| 0
| 0
| 0.019417
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.75
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
56a4c96037f0c98a293c3b3fb163f40021e021fe
| 2,720
|
py
|
Python
|
program/modes.py
|
peter2141/IBT
|
8e6b1ac68680152ad744007aaf2b9e0a6d070d80
|
[
"Apache-2.0"
] | null | null | null |
program/modes.py
|
peter2141/IBT
|
8e6b1ac68680152ad744007aaf2b9e0a6d070d80
|
[
"Apache-2.0"
] | null | null | null |
program/modes.py
|
peter2141/IBT
|
8e6b1ac68680152ad744007aaf2b9e0a6d070d80
|
[
"Apache-2.0"
] | null | null | null |
from myparser import *
import global_var
from getvalues import *
from foreach_fn_checks import *
# funkcie pre mod single, vyhodnocuje jednotlive vyrazy,uklada vysledky
# vstupom su vyrazy danej slabiny, pri uspesnom vyhodnoteni kazdeho vyrazu vrati True, inak False
def modeSingle(expressions):
iterator = 0
for expression in expressions: # iteracia vyraz po vyraze
# kontrola foreach
expression = checkForeach(expression, 'single')
# kontrola pomocnych funkcii
expression = checkFunctions(expression, 'single')
# ak vrati false, tak nie su hodnoty pre field vo funkciach - ide sa na dalsiu slabinu
if not expression:
return False
# ak syntakticka alebo sematicka chyba tak nekontrolujeme dalej
if not myparse(expression):
return False
# vytvorenie yoynamu hodnot o velkosti poctu atributov paketu
values = [[] for _ in range(len(global_var.fields))]
# wrapping - zoznam sa moze menit
tmpexp = [expression]
# vyhladanie hodnot v danom pakete
success = getValuesSingle(tmpexp, values, False)
# ak su hodnoty tak vyhodnoti sa vyraz
expression = tmpexp[0]
# ak sa nasli hodnoty vtedy sa iba vyhodnoti vyraz
if success:
myEval(values, expression, iterator) # vyhodnotenie vyrazu
else:
return False
iterator += 1
return True
# funkcie pre mod all, vyhodnocuje jednotlive vyrazy,uklada vysledky
# vstupom su vyrazy danej slabiny, pri uspesnom vyhodnoteni kazdeho vyrazu vrati True, inak False
def modeAll(expressions):
iterator = 0
for expression in expressions: # kontrol vsetkych vyrazov
# kontrola foreach
expression = checkForeach(expression, 'all')
# kontrola pomocnych funkcii
expression = checkFunctions(expression, 'all')
# ak nie su hodnoty pre field ide sa na dalsiu slabinu
if not expression:
return False
# ak syntakticka alebo sematicka chyba tak nekontrolujeme dalej
if not myparse(expression):
return False
# vytvorenie yoynamu hodnot o velkosti poctu atributov paketu
values = [[] for _ in range(len(global_var.fields))]
# wrapping - zoznam sa moze menit
tmpexp = [expression]
# vyhladanie hodnot v celom subore
success = getValuesAll(tmpexp, values)
expression = tmpexp[0]
# ak sa nasli hodnoty vtedy sa iba vyhodnoti vyraz
if success:
myEval(values, expression, iterator) # vyhodnotenie vyrazu
else:
return False
iterator += 1
return True
| 29.565217
| 97
| 0.656985
| 302
| 2,720
| 5.89404
| 0.360927
| 0.037079
| 0.047191
| 0.037079
| 0.808989
| 0.733708
| 0.668539
| 0.616854
| 0.616854
| 0.616854
| 0
| 0.003115
| 0.291912
| 2,720
| 91
| 98
| 29.89011
| 0.92108
| 0.423897
| 0
| 0.714286
| 0
| 0
| 0.011681
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.047619
| false
| 0
| 0.095238
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 0
| 0
| 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
| 4
|
3b32cf41601548babf82e04a634b9d1273efe3aa
| 178
|
py
|
Python
|
gs/option/__init__.py
|
groupserver/gs.option
|
297e7997feb8c26d74bd32d21eccf92ee4d33a89
|
[
"ZPL-2.1"
] | null | null | null |
gs/option/__init__.py
|
groupserver/gs.option
|
297e7997feb8c26d74bd32d21eccf92ee4d33a89
|
[
"ZPL-2.1"
] | null | null | null |
gs/option/__init__.py
|
groupserver/gs.option
|
297e7997feb8c26d74bd32d21eccf92ee4d33a89
|
[
"ZPL-2.1"
] | null | null | null |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
#lint:disable
from .converter import OptionLookupError
from .componentoptions import ComponentOptions
#lint:enable
| 25.428571
| 46
| 0.808989
| 20
| 178
| 6.95
| 0.65
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006289
| 0.106742
| 178
| 6
| 47
| 29.666667
| 0.867925
| 0.247191
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
3b53b2f77cc7ef240bfdb1805008452489d7c314
| 242
|
py
|
Python
|
tests/py-buffer-test.py
|
swarren/nestedlog
|
5f2cf9f103c735c4e5f48779f7b17324d883870c
|
[
"MIT"
] | 1
|
2021-03-14T17:01:43.000Z
|
2021-03-14T17:01:43.000Z
|
tests/py-buffer-test.py
|
swarren/nestedlog
|
5f2cf9f103c735c4e5f48779f7b17324d883870c
|
[
"MIT"
] | 10
|
2021-03-14T19:44:35.000Z
|
2021-06-07T19:37:47.000Z
|
tests/py-buffer-test.py
|
swarren/nestedlog
|
5f2cf9f103c735c4e5f48779f7b17324d883870c
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
# echo -n 0 | ./nestedlog-helper ./examples/py-buffer-test.py | hexdump -C
import sys
print('line 1')
print('line 2')
print('line 3', file=sys.stderr)
print('line 4')
print('line 5', file=sys.stderr)
print('line 6')
| 18.615385
| 74
| 0.669421
| 42
| 242
| 3.857143
| 0.642857
| 0.333333
| 0.160494
| 0.222222
| 0.271605
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037915
| 0.128099
| 242
| 12
| 75
| 20.166667
| 0.729858
| 0.38843
| 0
| 0
| 0
| 0
| 0.246575
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.142857
| 0
| 0.142857
| 0.857143
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
3b628372221dd2f914711c90e92aecc089b051db
| 715
|
py
|
Python
|
koicore/other/koi_variable.py
|
koi-lang/koi-python
|
e4f5d5fc095654b51b2956e932beb5bd7c9b4a3c
|
[
"BSD-3-Clause"
] | null | null | null |
koicore/other/koi_variable.py
|
koi-lang/koi-python
|
e4f5d5fc095654b51b2956e932beb5bd7c9b4a3c
|
[
"BSD-3-Clause"
] | null | null | null |
koicore/other/koi_variable.py
|
koi-lang/koi-python
|
e4f5d5fc095654b51b2956e932beb5bd7c9b4a3c
|
[
"BSD-3-Clause"
] | null | null | null |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""""""
from koicore import KoiObject
from koicore.enums import Visibility
class KoiVariable(KoiObject):
def __init__(self, value: KoiObject):
super().__init__()
self.name = ""
self.value = value
self.type_ = type(self.value)
self.privacy = Visibility.PUBLIC
self.final = False
self.const = False
self.access = Visibility.INTERNAL
def to_boolean(self):
return self.value.to_boolean()
def to_character(self):
return self.value.to_character()
def to_integer(self):
return self.value.to_integer()
def to_string(self):
return self.value.to_string()
| 22.34375
| 41
| 0.626573
| 86
| 715
| 5.011628
| 0.406977
| 0.146172
| 0.12993
| 0.176334
| 0.194896
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003766
| 0.257343
| 715
| 31
| 42
| 23.064516
| 0.80791
| 0.06014
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.1
| 0.2
| 0.6
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
3b64538d29b0d77f505d4cc637265fc002dcccb8
| 759
|
py
|
Python
|
bot/commands/admin/kick.py
|
mik3sw/GoogleAssistantBot
|
5a5a617ace94b320d6bf4810a4e277d303d7db21
|
[
"Apache-2.0"
] | 4
|
2020-07-29T22:53:04.000Z
|
2021-11-08T23:09:05.000Z
|
bot/commands/admin/kick.py
|
mik3sw/GoogleAssistantBot
|
5a5a617ace94b320d6bf4810a4e277d303d7db21
|
[
"Apache-2.0"
] | 3
|
2020-10-04T15:26:30.000Z
|
2021-05-02T20:17:30.000Z
|
bot/commands/admin/kick.py
|
mik3sw/GoogleAssistantBot
|
5a5a617ace94b320d6bf4810a4e277d303d7db21
|
[
"Apache-2.0"
] | 6
|
2020-08-23T18:08:45.000Z
|
2020-09-12T09:46:03.000Z
|
from utils import decorator
@decorator.general_admin
@decorator.cancellacomandi
def init(update, context):
pass
bot = context.bot
try:
bot.kick_chat_member(update.message.chat.id, update.message.reply_to_message.from_user.id, timeout=None, until_date=None)
bot.unban_chat_member(update.message.chat.id, update.message.reply_to_message.from_user.id)
bot.send_message(update.message.chat_id, text="User: [{}][{}][{}]\nSuccesfully kicked".format(update.message.reply_to_message.from_user.id, update.message.reply_to_message.from_user.first_name, update.message.reply_to_message.from_user.username))
except:
print("an error occurred [KICK] function")
update.message.reply_text("Error during kick operation")
| 58.384615
| 254
| 0.761528
| 107
| 759
| 5.168224
| 0.401869
| 0.211573
| 0.195298
| 0.180832
| 0.432188
| 0.432188
| 0.432188
| 0.368897
| 0.238698
| 0.238698
| 0
| 0
| 0.119895
| 759
| 13
| 255
| 58.384615
| 0.827844
| 0
| 0
| 0
| 0
| 0
| 0.128947
| 0.032895
| 0
| 0
| 0
| 0
| 0
| 1
| 0.076923
| false
| 0.076923
| 0.076923
| 0
| 0.153846
| 0.076923
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
8e87313725f3cc234c67458a2f0f74793e42a634
| 202
|
py
|
Python
|
Scripts_simulate_data/entire_simulate_qdot_workflow.py
|
AMOLFResonantNanophotonics/CPA
|
da665fa0fe3c90b1fcd87236e018a44f3fe8b2e0
|
[
"CC0-1.0"
] | 4
|
2021-02-27T15:01:43.000Z
|
2022-02-28T23:12:15.000Z
|
Scripts_simulate_data/entire_simulate_qdot_workflow.py
|
AMOLFResonantNanophotonics/CPA
|
da665fa0fe3c90b1fcd87236e018a44f3fe8b2e0
|
[
"CC0-1.0"
] | null | null | null |
Scripts_simulate_data/entire_simulate_qdot_workflow.py
|
AMOLFResonantNanophotonics/CPA
|
da665fa0fe3c90b1fcd87236e018a44f3fe8b2e0
|
[
"CC0-1.0"
] | 2
|
2021-03-29T04:51:06.000Z
|
2021-04-02T12:34:54.000Z
|
import simulate_qdot
import plot_simulateddata
from importlib import reload
reload(simulate_qdot)
reload(plot_simulateddata)
simulate_qdot.MakeSimulatedData()
plot_simulateddata.PlotSimulatedTrace()
| 18.363636
| 39
| 0.876238
| 22
| 202
| 7.772727
| 0.454545
| 0.210526
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074257
| 202
| 11
| 39
| 18.363636
| 0.914439
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.428571
| 0
| 0.428571
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
8ebb3ad598820181418da4825012a9ef63b12c59
| 403
|
py
|
Python
|
corehq/apps/commtrack/dbaccessors/supply_point_case_by_domain_external_id.py
|
johan--/commcare-hq
|
86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd
|
[
"BSD-3-Clause"
] | null | null | null |
corehq/apps/commtrack/dbaccessors/supply_point_case_by_domain_external_id.py
|
johan--/commcare-hq
|
86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd
|
[
"BSD-3-Clause"
] | 1
|
2022-03-12T01:03:25.000Z
|
2022-03-12T01:03:25.000Z
|
corehq/apps/commtrack/dbaccessors/supply_point_case_by_domain_external_id.py
|
johan--/commcare-hq
|
86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd
|
[
"BSD-3-Clause"
] | null | null | null |
from corehq.apps.commtrack.models import SupplyPointCase
def get_supply_point_case_by_domain_external_id(domain, external_id):
return SupplyPointCase.view('hqcase/by_domain_external_id',
key=[domain, str(external_id)],
reduce=False,
include_docs=True,
limit=1).first()
| 40.3
| 69
| 0.560794
| 40
| 403
| 5.325
| 0.725
| 0.187793
| 0.225352
| 0.169014
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003922
| 0.367246
| 403
| 9
| 70
| 44.777778
| 0.831373
| 0
| 0
| 0
| 0
| 0
| 0.069479
| 0.069479
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.142857
| 0.142857
| 0.428571
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
8ec02990b2892c66ae537b60ff4f8abcdd30e92b
| 163
|
py
|
Python
|
apps/django_extensions/management/signals.py
|
rapidsms/rapidsms-legacy
|
43c2ecd41fd1541a2538326edee3d9e816d84529
|
[
"BSD-3-Clause"
] | null | null | null |
apps/django_extensions/management/signals.py
|
rapidsms/rapidsms-legacy
|
43c2ecd41fd1541a2538326edee3d9e816d84529
|
[
"BSD-3-Clause"
] | null | null | null |
apps/django_extensions/management/signals.py
|
rapidsms/rapidsms-legacy
|
43c2ecd41fd1541a2538326edee3d9e816d84529
|
[
"BSD-3-Clause"
] | 1
|
2019-11-02T19:35:54.000Z
|
2019-11-02T19:35:54.000Z
|
"""
signals we use to trigger regular batch jobs
"""
run_hourly_jobs = object()
run_daily_jobs = object()
run_weekly_jobs = object()
run_monthly_jobs = object()
| 16.3
| 44
| 0.742331
| 24
| 163
| 4.708333
| 0.583333
| 0.353982
| 0.345133
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147239
| 163
| 9
| 45
| 18.111111
| 0.81295
| 0.269939
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
8ed10548877bcd24e0602f340979aabc9108bc7a
| 26,018
|
py
|
Python
|
nonebot_plugin_abstract/emoji.py
|
CherryCherries/nonebot-plugin-abstract
|
89623bb753e21af2807b6bb15f95dc0262a1aefa
|
[
"MIT"
] | 1
|
2022-03-28T05:11:34.000Z
|
2022-03-28T05:11:34.000Z
|
nonebot_plugin_abstract/emoji.py
|
CherryCherries/nonebot-plugin-abstract
|
89623bb753e21af2807b6bb15f95dc0262a1aefa
|
[
"MIT"
] | null | null | null |
nonebot_plugin_abstract/emoji.py
|
CherryCherries/nonebot-plugin-abstract
|
89623bb753e21af2807b6bb15f95dc0262a1aefa
|
[
"MIT"
] | null | null | null |
emoji = { "笑": "😁", "笑哭": "😂", "色": "😍", "亲": "💋", "哭": "😭", "晕": "😵", "愤怒": "👿", "生气": "👿", "怒": "💢", "死": "💀", "鬼": "👻", "外星人": "👽", "屎": "💩", "男孩": "👦", "哥哥": "👦", "男生": "👦", "男人": "👨", "男": "👨", "女孩": "👧", "女生": "👧", "女人": "👩", "女": "👩", "爷爷": "👴", "爷": "👴", "老人": "👴", "老子": "👴", "弟弟": "👶", "警察": "👮", "工人": "👷", "农民工": "👷", "秃子": "👨", "圣诞": "🎅", "圣诞老人": "🎅", "走": "🚶", "跑": "🏃", "跳舞": "💃", "舞": "💃", "家人": "👪", "强壮": "💪", "强": "💪", "壮": "💪", "肌肉": "💪", "腿": "🦵", "脚": "🦶", "足": "🦶", "指": "👈", "左": "⬅", "右": "➡", "上": "⬆", "下": "⬇", "耶": "✌️", "剪刀手": "✌️", "比心": "🤞", "笔芯": "🤞", "手掌": "🖐️", "手": "🖐️", "ok": "👌", "好的": "👌", "好": "👍", "点": "丶", "点赞": "丶👍", "赞": "👍", "棒": "👍", "差": "👎", "坏": "👎", "拳": "👊", "不": "8️⃣", "挥手": "👋", "鼓掌": "👏", "啪": "👏", "举手": "🙌", "合十": "🈴", "祈祷": "🙏", "握手": "🤝", "耳朵": "👂", "耳": "👂", "鼻": "👃", "鼻子": "👃", "眼睛": "👀", "脚印": "👣", "足迹": "👣", "大脑": "🧠", "智": "🧠", "骨头": "🦴", "骨": "🦴", "牙齿": "🦷", "齿": "🦷", "舔": "👅", "嘴": "👄", "眼镜": "👓", "太阳镜": "🕶️", "T恤": "👕", "袜子": "🧦", "袜": "🧦", "裙子": "👗", "裙": "👗", "比基尼": "👙", "女装": "👚", "钱包": "👛", "手提袋": "👜", "包": "📦", "鞋": "👞", "鞋子": "👞", "高跟鞋": "👠", "帽子": "🎩", "口红": "💄", "行李": "🧳", "雨伞": "☂️", "伞": "☂️", "蒙眼": "🙈","看":"👀", "没眼看": "🙈", "不听": "🙉", "不说话": "🙊", "禁言": "🙊", "爆炸": "💥", "炸": "💥", "滴": "💦", "奔": "💨", "奔跑": "🏃💨", "猴": "🐵", "猴子": "🐵", "狗": "🐶", "猫": "🐱", "浣熊": "🦝", "狮子": "🦁", "狮": "🦁", "马": "🐴", "妈": "🐴", "老虎": "🐯", "虎": "🐯", "斑马": "🦓", "牛": "🐮", "猪": "🐷", "猪鼻": "🐽", "骆驼": "🐫", "驼": "🐫", "长颈鹿": "🦒", "大象": "🐘", "象": "🐘", "老鼠": "🐭", "鼠": "🐭", "兔子": "🐰", "兔": "🐰", "熊": "🐻", "考拉": "🐨", "熊猫": "🐼", "袋鼠": "🦘", "鸡": "🐔", "公鸡": "🐓", "鸟": "🐦", "鸽子": "🕊️", "鸽": "🕊️", "企鹅": "🐧", "腾讯": "🐧", "老鹰": "🦅", "鹰": "🦅", "鸭子": "🦆", "鸭": "🦆", "天鹅": "🦢", "鹦鹉": "🦜", "蛤蟆": "🐸", "蛤": "🐸", "龟": "🐢", "乖": "🐢", "蛇": "🐍", "射": "🐍", "农民": "🐲鸣", "龙": "🐲", "鲸鱼": "🐋", "鲸": "🐋", "海豚": "🐬", "豚": "🐬", "带鱼": "🐠","评论":"🍎🚢", "鲨鱼": "🦈", "鲨": "🦈", "章鱼": "🐙", "章": "🐙", "螃蟹": "🦀", "蟹": "🦀", "龙虾": "🦞", "虾": "🦐", "乌贼": "🦑", "蜗牛": "🐌", "蝴蝶": "🦋", "蝶": "🦋", "虫": "🐛", "虫子": "🐛", "蚂蚁": "🐜", "蚁": "🐜", "蜜蜂": "🐝", "蜂": "🐝", "瓢虫": "🐞", "嫖": "🐞", "瓢": "🐞", "蜘蛛": "🕷️", "蛛": "🕷️", "蛛网": "🕸️", "花朵": "🌸", "鲜花": "🌸", "花": "🌸", "玫瑰": "🌹", "向日葵": "🌻", "树": "🌲", "仙人掌": "🌵", "四叶草": "🍀", "枫叶": "🍁", "落叶": "🍂", "地球": "🌏", "世界": "🌏", "月亮": "🌙", "日": "☀️", "太阳": "☀️", "星": "⭐", "明星": "🌟", "云": "☁️", "多云": "⛅", "下雨": "🌧️", "雨": "🌧️", "下雪": "🌨️", "龙卷风": "🌪️", "雾": "🌫️", "彩虹": "🌈", "闪电": "⚡", "高压电": "⚡", "电": "⚡", "雪花": "❄️", "雪": "❄️", "雪人": "☃️","的": "💧", "水": "💧", "火": "🔥", "波浪": "🌊", "波": "🌊", "圣诞树": "🎄", "闪": "✨", "葡萄": "🍇", "西瓜": "🍉", "瓜": "🍉", "柠檬": "🍋", "酸": "🍋", "香蕉": "🍌", "蕉": "🍌", "菠萝": "🍍", "凤梨": "🍍", "苹果": "🍎", "梨": "🍐", "梨子": "🍐", "桃子": "🍑", "桃": "🍑", "樱桃": "🍒", "草莓": "🍓", "猕猴桃": "🥝", "西红柿": "🍅", "茄子": "🍆", "茄": "🍆", "土豆": "🥔", "番薯": "🥔", "胡萝卜": "🥕", "萝卜": "🥕", "辣椒": "🌶️", "了": "🌶️", "那": "🌶️", "辣": "🌶️", "黄瓜": "🥒", "蘑菇": "🍄", "花生": "🥜", "面包": "🍞", "煎饼": "🥞", "烙饼": "🥞", "奶酪": "🧀", "肉": "🍖", "鸡腿": "🍗", "培根": "🥓", "盐": "🧂", "爆米花": "🍿", "汤": "🥣", "煎": "🍳", "三明治": "🥪", "热狗": "🌭", "火腿": "🌭", "披萨": "🍕", "薯条": "🍟", "汉堡": "🍔", "汉堡包": "🍔", "牛奶": "🥛", "奶瓶": "🍼", "甜甜圈": "🍭", "糖": "🍬", "巧克力棒": "🍫", "巧克力": "🍫", "生日蛋糕": "🎂", "蛋糕": "🎂", "曲奇": "🍪", "冰淇淋": "🍦", "饺子": "🥟", "月饼": "🥮", "寿司": "🍣", "面条": "🍜", "面": "🍜", "饭": "🍚", "米饭": "🍚", "饭团": "🍙", "餐具": "🍴", "惨剧": "🍴", "勺子": "🥄", "筷子": "🥢", "筷": "🥢", "干杯": "🍻", "啤酒": "🍺", "啤": "🍺", "酒": "🍺", "批": "🍺", "逼": "🍺", "酒杯": "🍷", "飞机": "✈️", "船": "🚢", "红绿灯": "🚦", "加油": "⛽", "单车": "🚲", "自行车": "🚲", "拖拉机": "🚜", "车": "🚗", "汽车": "🚗", "出租车": "🚕", "警车": "🚓", "消防车": "🚒", "急救车": "🚑", "公交车": "🚌", "公共汽车": "🚌", "地铁": "🚇", "火车": "🚆", "高铁": "🚄", "学校": "🏫", "旅馆": "🏨", "宾馆": "🏨", "银行": "🏦", "医院": "🏥", "房子": "🏠", "家庭": "🏠", "好死": "🏠", "不得好死": "不得🏠", "火山": "🌋", "山": "⛰️", "摩托": "🏍️", "摩托车": "🏍️", "赛车": "🏎️", "石像": "🗿", "烟花": "🎆", "流星": "🌠", "飞碟": "🛸", "火箭": "🚀", "人造卫星": "🛰️", "卫星": "🛰️", "座位": "💺", "爬": "爪巴", "骑马": "🏇", "滑雪": "⛷️", "游泳": "🏊", "游": "🏊", "打球": "⛹️", "举重": "🏋️", "骑车": "🚴", "票": "🎫", "勋章": "🎖️", "奖杯": "🏆", "奖牌": "🏅", "足球": "⚽", "棒球": "⚾", "篮球": "🏀", "排球": "🏐", "橄榄球": "🏈", "网球": "🎾", "保龄球": "🎳", "乒乓球": "🏓", "羽毛球": "🏸", "拳击": "🥊", "鱼竿": "🎣", "钓鱼": "🎣", "游戏": "🎮", "打游戏": "🎮", "骰子": "🎲", "色子": "🎲", "画板": "🎨", "画": "🎨", "艺术": "🎨", "毛线": "🧶", "话筒": "🎤", "耳机": "🎧", "萨克斯": "🎷", "吉他": "🎸", "钢琴": "🎹", "喇叭": "📢", "小提琴": "🎻", "剪辑": "🎬", "电影": "🎬", "射箭": "🏹", "情书": "💌", "洞": "🕳️", "炸弹": "💣", "洗澡": "🛀", "睡觉": "🛌", "睡": "🛌", "刀": "🔪", "世界地图": "🗺", "指南针": "🧭", "砖": "🧱", "油": "🛢", "铃": "🛎", "响铃": "🛎", "沙漏": "⌛", "沙": "⌛", "表": "⌚", "闹钟": "⏰", "钟": "⏰", "温度计": "🌡", "灭火器": "🧨", "气球": "🎈", "恭喜": "🎉", "祝贺": "🎉", "日本人": "🎎", "鲤鱼旗": "🎏", "红包": "🧧", "蝴蝶结": "🎀", "结": "🎀", "礼物": "🎁", "礼": "🎁", "水晶球": "🔮", "泰迪熊": "🧸", "线": "🧵", "购物袋": "🛍", "钻石": "💎", "钻": "💎", "收音机": "📻", "收听": "📻", "手机": "📱", "电话": "☎", "电池": "🔋", "插头": "🔌", "电脑": "💻", "键盘": "⌨", "打印机": "🖨", "打印": "🖨", "鼠标": "🖱", "硬盘": "💽", "光盘": "💿", "DVD": "📀", "算盘": "🧮", "摄影机": "🎥", "放映": "📽", "上映": "📽", "电视": "📺", "相机": "📷", "照相机": "📷", "录像机": "📹", "放大镜": "🔍", "放大": "🔍", "蜡烛": "🕯", "灯": "💡", "亮": "💡", "手电筒": "🔦", "笔记本": "📔", "本": "📕", "书": "📕", "纸": "📄", "报纸": "📰", "书签": "📑", "标签": "🏷", "钱袋": "💰", "日元": "💴", "美元": "💵", "欧元": "💶", "信用卡": "💳", "收据": "🧾", "信封": "✉", "信": "✉", "邮件": "📧", "发送": "📤", "接收": "📥", "收到": "📥", "邮箱": "📮", "铅笔": "✏", "钢笔": "🖊", "笔": "🖊", "画笔": "🖌", "蜡笔": "🖍", "备忘录": "📝", "便签": "📝", "记": "📝", "文件夹": "📁", "日历": "📅", "增长": "📈", "增加": "📈", "增大": "📈", "增": "📈", "下降": "📉", "降低": "📉", "减少": "📉", "降": "📉", "图钉": "📌", "回形针": "📎", "尺子": "📏", "尺": "📏", "剪刀": "✂", "剪": "✂", "垃圾桶": "🗑", "锁": "🔒", "钥匙": "🔑", "锤子": "🔨", "匕首": "🗡", "手枪": "🔫", "盾牌": "🛡", "修理": "🔧", "修": "🔧", "扳手": "🔧", "齿轮": "⚙", "天平": "⚖", "连接": "🔗", "锁链": "⛓", "工具箱": "🧰", "磁力": "🧲", "磁": "🧲", "磁铁": "🧲", "试管": "🧪", "DNA": "🧬", "基因": "🧬", "显微镜": "🔬", "望远镜": "🔭", "雷达": "📡", "针": "💉", "药": "💊", "要": "💊", "门": "🚪", "们": "🚪", "床": "🛏", "厕所": "🚾", "马桶": "🚽", "淋浴": "🚿", "浴缸": "🛁", "洗洁精": "🧴", "扫": "🧹", "扫帚": "🧹", "扫把": "🧹", "篮子": "🧺", "卷纸": "🧻", "卫生纸": "🧻", "肥皂": "🧼", "皂": "🧼", "海绵": "🧽", "烟": "🚬", "香烟": "🚬", "扎心": "💘", "心动": "💓", "爱": "💓", "心跳": "💓", "心心相印": "💕", "心相印": "💕", "心碎": "💔", "黑心": "🖤", "满分": "💯", "100分": "💯", "信息": "💬", "想法": "💭", "昏睡": "💤", "困": "💤", "蒸": "♨", "停": "🛑", "旋风": "🌀", "飓风": "🌀", "黑桃": "♠", "红桃": "♥", "方块": "♦", "梅花": "♣", "牌": "🃏", "扑克": "🃏", "中": "🀄", "红中": "🀄", "静音": "🔇", "音量": "🔈", "铃铛": "🔔", "音乐": "🎵", "音": "🎵", "ATM": "🏧", "轮椅": "♿", "残疾人": "♿", "男厕": "🚹", "女厕": "🚺", "婴儿": "🚼", "警告": "⚠", "禁止进入": "⛔", "禁止": "🚫", "成人": "🔞", "色情": "🔞", "辐射": "☢", "上下": "↕", "左右": "↔", "循环": "🔄", "绕圈": "🔄", "绕": "🔄", "返回": "🔙", "原子": "⚛", "阴阳": "☯", "清真": "☪", "伊斯兰": "☪", "穆斯林": "☪", "白羊座": "♈", "金牛座": "♉", "双子座": "♊", "巨蟹座": "♋", "狮子座": "♌", "处女座": "♍", "天秤座": "♎", "天蝎座": "♏", "射手座": "♐", "摩羯座": "♑", "水瓶座": "♒", "双鱼座": "♓", "蛇夫座": "⛎", "重放": "🔁", "单曲循环": "🔂", "播放": "▶", "快进": "⏩", "返回键": "◀", "快退": "⏪", "暂停": "⏹", "退出": "⏏", "电影院": "🎦", "信号": "📶", "大师": "带师", "大哥": "带哥", "无穷": "♾", "无限": "♾", "回收": "♻", "三叉戟": "🔱", "环": "⭕", "圈": "⭕", "圆": "⭕", "对": "✅", "错": "❌", "必死": "biss", "搞快点": "GKD", "加": "➕", "减": "➖", "除": "➗", "?": "¿", "!": "❗", "井": "", "0": "0️⃣", "1": "1️⃣", "2": "2️⃣", "3": "3️⃣", "4": "4️⃣", "5": "5️⃣", "6": "6️⃣", "7": "7️⃣", "8": "8️⃣", "您": "宁", "9": "9️⃣", "10": "🔟", "酷": "🆒", "免费": "🆓", "新": "🆕", "月": "🈷", "有": "🈶", "得": "🉐", "割": "🈹", "无": "🈚", "禁": "🈲", "可": "🉑", "申": "🈸", "空": "🈳", "祝": "㊗", "秘": "㊙", "满": "🈵", "零": "0️⃣", "一": "1️⃣", "二": "2️⃣", "三": "3️⃣", "四": "4️⃣", "服": "佛", "五": "5️⃣", "六": "6️⃣", "七": "7️⃣", "八": "8️⃣", "九": "9️⃣", "十": "🔟", "?": "¿", "啊": "嗷", "哦": "嗷", "呀": "嗷", "阿森松岛": "🇦🇨", "安道尔": "🇦🇩", "阿联酋": "🇦🇪", "阿富汗": "🇦🇫", "安提瓜和巴布达": "🇦🇬", "安圭拉": "🇦🇮", "阿尔巴尼亚": "🇦🇱", "亚美尼亚": "🇦🇲", "安哥拉": "🇦🇴", "南极洲": "🇦🇶", "阿根廷": "🇦🇷", "美属萨摩亚群岛": "🇦🇸", "奥地利": "🇦🇹", "澳大利亚": "🇦🇺", "阿鲁巴": "🇦🇼", "奥兰群岛": "🇦🇽", "阿塞拜疆": "🇦🇿", "波黑": "🇧🇦", "巴多斯": "🇧🇧", "孟加拉国": "🇧🇩", "为比利时": "🇧🇪", "布基纳法索": "🇧🇫", "保加利亚": "🇧🇬", "巴林": "🇧🇭", "布隆迪": "🇧🇮", "贝宁": "🇧🇯", "圣巴泰勒米": "🇧🇱", "百慕大": "🇧🇲", "文莱": "🇧🇳", "玻利维亚": "🇧🇴", "荷兰加勒比": "🇧🇶", "巴西": "🇧🇷", "巴哈马": "🇧🇸", "不丹": "🇧🇹", "布维岛": "🇧🇻", "博茨瓦纳": "🇧🇼", "白俄罗斯": "🇧🇾", "伯利兹": "🇧🇿", "加拿大": "🇨🇦", "科科斯群岛": "🇨🇨", "刚果金": "🇨🇩", "中非共和国": "🇨🇫", "刚果布": "🇨🇬", "瑞士": "🇨🇭", "科特迪瓦": "🇨🇮", "库克群岛": "🇨🇰", "智利": "🇨🇱", "喀麦隆": "🇨🇲", "中国": "🇨🇳", "哥伦比亚": "🇨🇴", "克利珀顿岛": "🇨🇵", "哥斯达黎加": "🇨🇷", "古巴": "🇨🇺", "佛得角": "🇨🇻", "库拉索": "🇨🇼", "圣诞岛": "🇨🇽", "塞浦路斯": "🇨🇾", "捷克共和国": "🇨🇿", "德国": "🇩🇪", "迪戈加西亚": "🇩🇬", "吉布提": "🇩🇯", "丹麦": "🇩🇰", "多米尼加": "🇩🇲", "多明尼加共和国": "🇩🇴", "阿尔及利亚": "🇩🇿", "休达和梅利利亚": "🇪🇦", "厄瓜多尔": "🇪🇨", "爱沙尼亚": "🇪🇪", "埃及": "🇪🇬", "西撒哈拉": "🇪🇭", "厄立特里亚": "🇪🇷", "西班牙": "🇪🇸", "埃塞俄比亚": "🇪🇹", "欧盟": "🇪🇺", "芬兰": "🇫🇮", "斐济": "🇫🇯", "福克兰群岛": "🇫🇰", "密克罗尼西亚": "🇫🇲", "法罗群岛": "🇫🇴", "法国": "🇫🇷", "加蓬": "🇬🇦", "英国": "🇬🇧", "格林纳达": "🇬🇩", "格鲁吉亚": "🇬🇪", "法属圭亚那": "🇬🇫", "根西岛": "🇬🇬", "加纳": "🇬🇭", "直布罗陀": "🇬🇮", "格陵兰": "🇬🇱", "冈比亚": "🇬🇲", "几内亚": "🇬🇳", "瓜德罗普岛": "🇬🇵", "赤道几内亚": "🇬🇶", "希腊": "🇬🇷", "南乔治亚岛和南桑威奇群岛": "🇬🇸", "危地马拉": "🇬🇹", "关岛": "🇬🇺", "几内亚比绍": "🇬🇼", "圭亚那": "🇬🇾", "香港": "🇭🇰", "赫德与麦克唐纳群岛": "🇭🇲", "洪都拉斯": "🇭🇳", "克罗地亚": "🇭🇷", "海地": "🇭🇹", "匈牙利": "🇭🇺", "加那利群岛": "🇮🇨", "印尼": "🇮🇩", "爱尔兰": "🇮🇪", "为以色列": "🇮🇱", "曼岛": "🇮🇲", "印度": "🇮🇳", "英属印度洋领地": "🇮🇴", "伊拉克": "🇮🇶", "伊朗": "🇮🇷", "冰岛": "🇮🇸", "意大利": "🇮🇹", "泽西": "🇯🇪", "牙买加": "🇯🇲", "约旦": "🇯🇴", "日本": "🇯🇵", "肯尼亚": "🇰🇪", "吉尔吉斯斯坦": "🇰🇬", "柬埔寨": "🇰🇭", "基里巴斯": "🇰🇮", "科摩罗": "🇰🇲", "圣基茨和尼维斯": "🇰🇳", "朝鲜": "🇰🇵", "韩国": "🇰🇷", "科威特": "🇰🇼", "开曼群岛": "🇰🇾", "哈萨克斯坦": "🇰🇿", "老挝": "🇱🇦", "黎巴嫩": "🇱🇧", "圣卢西亚": "🇱🇨", "列支敦士登": "🇱🇮", "斯里兰卡": "🇱🇰", "利比里亚": "🇱🇷", "莱索托": "🇱🇸", "立陶宛": "🇱🇹", "卢森堡": "🇱🇺", "拉脱维亚": "🇱🇻", "利比亚": "🇱🇾", "摩洛哥": "🇲🇦", "摩纳哥": "🇲🇨", "摩尔多瓦": "🇲🇩", "黑山": "🇲🇪", "圣马丁": "🇲🇫", "马达加斯加": "🇲🇬", "马绍尔群岛": "🇲🇭", "马其顿": "🇲🇰", "马里": "🇲🇱", "缅甸": "🇲🇲", "蒙古": "🇲🇳", "澳门": "🇲🇴", "北马里亚纳群岛": "🇲🇵", "马提尼克岛": "🇲🇶", "毛里塔尼亚": "🇲🇷", "蒙特塞拉特": "🇲🇸", "马耳他": "🇲🇹", "毛里求斯": "🇲🇺", "马尔代夫": "🇲🇻", "马拉维": "🇲🇼", "墨西哥": "🇲🇽", "马来西亚": "🇲🇾", "莫桑比克": "🇲🇿", "纳米比亚": "🇳🇦", "新喀里多尼亚": "🇳🇨", "尼日尔": "🇳🇪", "诺福克岛": "🇳🇫", "尼日利亚": "🇳🇬", "尼加拉瓜": "🇳🇮", "荷兰": "🇳🇱", "挪威": "🇳🇴", "尼泊尔": "🇳🇵", "瑙鲁": "🇳🇷", "纽埃": "🇳🇺", "新西兰": "🇳🇿", "阿曼": "🇴🇲", "巴拿马": "🇵🇦", "秘鲁": "🇵🇪", "法属波利尼西亚": "🇵🇫", "巴布亚新几内亚": "🇵🇬", "菲律宾": "🇵🇭", "巴基斯坦": "🇵🇰", "波兰": "🇵🇱", "圣皮埃尔和密克隆群岛": "🇵🇲", "皮特凯恩群岛": "🇵🇳", "波多黎各": "🇵🇷", "巴勒斯坦领土": "🇵🇸", "葡萄牙": "🇵🇹", "帕劳": "🇵🇼", "巴拉圭": "🇵🇾", "卡塔尔": "🇶🇦", "团圆": "🇷🇪", "罗马尼亚": "🇷🇴", "塞尔维亚": "🇷🇸", "俄罗斯": "🇷🇺", "卢旺达": "🇷🇼", "沙特阿拉伯": "🇸🇦", "所罗门群岛": "🇸🇧", "塞舌尔": "🇸🇨", "苏丹": "🇸🇩", "瑞典": "🇸🇪", "新加坡": "🇸🇬", "圣赫勒拿": "🇸🇭", "斯洛文尼亚": "🇸🇮", "斯瓦尔巴群岛和扬马延": "🇸🇯", "斯洛伐克": "🇸🇰", "塞拉利昂": "🇸🇱", "圣马力诺": "🇸🇲", "塞内加尔": "🇸🇳", "索马里": "🇸🇴", "苏里南": "🇸🇷", "南苏丹": "🇸🇸", "圣多美和普林西比": "🇸🇹", "萨尔瓦多": "🇸🇻", "圣马丁岛": "🇸🇽", "叙利亚": "🇸🇾", "斯威士兰": "🇸🇿", "特里斯坦达库尼亚群岛": "🇹🇦", "特克斯和凯科斯群岛": "🇹🇨", "乍得": "🇹🇩", "法国南方的领土": "🇹🇫", "多哥": "🇹🇬", "泰国": "🇹🇭", "塔吉克斯坦": "🇹🇯", "托克劳": "🇹🇰", "东帝汶": "🇹🇱", "土库曼斯坦": "🇹🇲", "突尼斯": "🇹🇳", "汤加": "🇹🇴", "土耳其": "🇹🇷", "特立尼达和多巴哥": "🇹🇹", "图瓦卢": "🇹🇻", "台湾": "🇹🇼", "坦桑尼亚": "🇹🇿", "乌克兰": "🇺🇦", "乌干达": "🇺🇬", "美国离岛": "🇺🇲", "美国": "🇺🇸", "乌拉圭": "🇺🇾", "乌兹别克斯坦": "🇺🇿", "梵蒂冈城": "🇻🇦", "圣文森特和格林纳丁斯": "🇻🇨", "委内瑞拉": "🇻🇪", "英属维尔京群岛": "🇻🇬", "美属维尔京群岛": "🇻🇮", "越南": "🇻🇳", "瓦努阿图": "🇻🇺", "瓦利斯和富图纳群岛": "🇼🇫", "萨摩亚": "🇼🇸", "科索沃": "🇽🇰", "也门": "🇾🇪", "马约特": "🇾🇹", "南非": "🇿🇦", "赞比亚": "🇿🇲", "津巴布韦": "🇿🇼","内":"👙","流批":"🐮🍺","行":"⭐","尼哥":"👨🏿","黑人":"👨🏿","樱花":"🌸","铁":"Fe","奶":"🍼","憨":"🍔","还行":"🌊⭐","虾仁":"🍤","杀人": "🍤","钱":"💰","废物":"five","球":"⚽","吐":"🤮","二次元":"二刺螈","草":"🌿","果子":"果汁","斧":"🪓","苹":"🍎","孙笑川":"孙🐶","透你妈":"tony🐎","蚊子":"🦟"}
emoji_py = {'xiao': '😁', 'xiaoku': '😂', 'se': '😍', 'qin': '💋', 'ku': '🆒', 'yun': '☁️', 'fennu': '👿', 'shengqi': '👿', 'nu': '💢', 'si': '4️⃣', 'gui': '🐢', 'waixingren': '👽', 'shi': '🔟', 'nanhai': '👦', 'gege': '👦', 'nansheng': '👦', 'nanren': '👨', 'nan': '👨', 'nvhai': '👧', 'nvsheng': '👧', 'nvren': '👩', 'nv': '👩', 'yeye': '👴', 'ye': '✌️', 'laoren': '👴', 'laozi': '👴', 'didi': '👶', 'jingcha': '👮', 'gongren': '👷', 'nongmingong': '👷', 'tuzi': '🐰', 'shengdan': '🎅', 'shengdanlaoren': '🎅', 'zou': '🚶', 'pao': '🏃', 'tiaowu': '💃', 'wu': '5️⃣', 'jiaren': '👪', 'qiangzhuang': '💪', 'qiang': '💪', 'zhuang': '💪', 'jirou': '💪', 'tui': '🦵', 'jiao': '🍌', 'zu': '🦶', 'zhi': '📄', 'zuo': '⬅', 'you': '🈶', 'shang': '⬆', 'xia': '🦐', 'jiandaoshou': '✌️', 'bixin': '🤞', 'shouzhang': '🖐️', 'shou': '🖐️', 'ok': '👌', 'haode': '👌', 'hao': '👍', 'dian': '⚡', 'dianzan': '丶👍', 'zan': '👍', 'bang': '👍', 'cha': '👎', 'huai': '👎', 'quan': '⭕', 'bu': '8️⃣', 'huishou': '♻', 'guzhang': '👏', 'pa': '爪巴', 'jushou': '🙌', 'heshi': '🈴', 'qidao': '🙏', 'woshou': '🤝', 'erduo': '👂', 'er': '2️⃣', 'bi': '🖊', 'bizi': '👃', 'yanjing': '👓', 'jiaoyin': '👣', 'zuji': '👣', 'danao': '🧠', 'gutou': '🦴', 'gu': '🦴', 'yachi': '🦷', 'chi': '📏', 'tian': '👅', 'zui': '👄', 'taiyangjing': '🕶️', 'Txu': '👕', 'wazi':'🧦', 'wa': '🧦', 'qunzi': '👗', 'qun': '👗', 'bijini': '👙', 'nvzhuang': '👚', 'qianbao': '👛', 'shoutidai': '👜', 'bao': '📦', 'xie': '🦀', 'xiezi': '👞', 'gaogenxie': '👠', 'maozi': '🎩', 'kouhong': '💄', 'xingli': '🧳', 'yusan': '☂️', 'san': '3️⃣', 'mengyan': '🙈', 'kan': '👀', 'meiyankan': '🙈', 'buting': '🙉', 'bushuohua': '🙊', 'jinyan': '🙊', 'baozha': '💥', 'zha': '💥', 'di': '💦', 'ben': '📕', 'benpao': '🏃💨', 'hou': '🐵', 'houzi': '🐵', 'gou': '🐶', 'mao': '🐱', 'wanxiong': '🦝', 'shizi': '🦁', 'ma': '🐴', 'laohu': '🐯', 'hu': '🐯', 'banma': '🦓', 'niu': '🐮', 'zhu': '㊗', 'zhubi': '🐽', 'luotuo': '🐫', 'tuo': '🐫', 'changjinglu': '🦒', 'daxiang': '🐘', 'xiang': '🐘', 'laoshu': '🐭', 'shu': '📕', 'tu': '🤮', 'xiong': '🐻', 'kaola': '🐨', 'xiongmao': '🐼', 'daishu': '🦘', 'ji': '🐔', 'gongji': '🐓', 'niao': '🐦', 'gezi': '🕊️', 'ge': '🈹', 'qie': '🍆', 'tengxun': '🐧', 'laoying': '🦅', 'ying': '🦅', 'yazi': '🦆', 'ya': '嗷', 'tiane': '🦢', 'yingwu': '🦜', 'hama': '🐸', 'ha': '🐸', 'guai': '🐢', 'she': '🐍', 'nongmin': '🐲鸣', 'long': '🐲', 'jingyu': '🐋', 'jing': '', 'haitun': '🐬', 'tun': '🐬', 'daiyu': '🐠', 'pinglun': '🍎🚢', 'shayu': '🦈', 'sha': '⌛', 'zhangyu': '🐙', 'zhang': '🐙', 'pangxie': '🦀', 'longxia': '🦞', 'wuzei': '🦑', 'guaniu': '🐌', 'hudie': '🦋', 'die': '🦋', 'chong': '🐛', 'chongzi': '🐛', 'mayi': '🐜', 'yi': '1️⃣', 'mifeng': '🐝', 'feng': '🐝', 'piaochong': '🐞', 'piao': '🎫', 'zhizhu': '🕷️', 'zhuwang': '🕸️', 'huaduo': '🌸', 'xianhua': '🌸', 'hua': '🎨', 'meigui': '🌹', 'xiangrikui': '🌻', 'xianrenzhang': '🌵', 'siyecao': '🍀', 'fengye': '🍁', 'luoye': '🍂', 'diqiu': '🌏', 'shijie': '🌏', 'yueliang': '🌙', 'ri': '☀️', 'taiyang': '☀️', 'xing': '⭐', 'mingxing': '🌟', 'duoyun': '⛅', 'xiayu': '🌧️', 'yu': '🌧️', 'xiaxue': '🌨️', 'longjuanfeng': '🌪️', 'caihong': '🌈', 'shandian': '⚡', 'gaoyadian': '⚡', 'xuehua': '❄️', 'xue': '❄️', 'xueren': '☃️', 'de':'🉐', 'shui': '🛌', 'huo': '🔥', 'bolang': '🌊', 'bo': '🌊', 'shengdanshu': '🎄', 'shan': '⛰️', 'putao': '🍇', 'xigua': '🍉', 'gua': '🍉', 'ningmeng': '🍋', 'suan': '🍋', 'xiangjiao': '🍌', 'boluo': '🍍', 'fengli': '🍍', 'pingguo': '🍎', 'li': '🎁', 'lizi': '🍐', 'taozi': '🍑', 'tao': '🍑', 'yingtao': '🍒', 'caomei': '🍓', 'mihoutao': '🥝', 'xihongshi': '🍅', 'qiezi': '🍆', 'tudou': '🥔', 'fanshu': '🥔', 'huluobu': '🥕', 'luobu': '🥕', 'lajiao': '🌶️', 'le': '🌶️', 'na': '🌶️', 'la': '🌶️', 'huanggua': '🥒', 'mogu': '🍄', 'huasheng': '🥜', 'mianbao': '🍞', 'jianbing': '🥞', 'luobing': '🥞', 'nailao': '🧀', 'rou': '🍖', 'jitui': '🍗', 'peigen': '🥓', 'yan': '🚬', 'baomihua': '🍿', 'tang': '🍬', 'jian': '➖', 'sanmingzhi': '🥪', 'regou': '🌭', 'huotui': '🌭', 'pisa': '🍕', 'shutiao': '🍟', 'hanbao': '🍔', 'hanbaobao': '🍔', 'niunai': '🥛', 'naiping': '🍼', 'tiantianquan': '🍭', 'qiaokelibang': '🍫', 'qiaokeli': '🍫', 'shengridangao': '🎂', 'dangao': '🎂', 'quqi': '🍪', 'bingqilin': '🍦', 'jiaozi': '🥟', 'yuebing': '🥮', 'shousi': '🍣', 'miantiao': '🍜', 'mian': '🍜', 'fan': '🍚', 'mifan': '🍚', 'fantuan': '🍙', 'canju': '🍴', 'shaozi': '🥄', 'kuaizi': '🥢', 'kuai': '🥢', 'ganbei': '🍺', 'pijiu': '🍺', 'pi': '🍺', 'jiu': '9️⃣', 'jiubei': '🍷', 'feiji': '🇫🇯', 'chuan': '🚢', 'honglvdeng': '🚦', 'jiayou': '⛽', 'danche': '🚲', 'zixingche': '🚲', 'tuolaji': '🚜', 'che': '🚗', 'qiche': '🚴', 'chuzuche': '🚕', 'jingche': '🚓', 'xiaofangche': '🚒', 'jijiuche': '🚑', 'gongjiaoche': '🚌', 'gonggongqiche': '🚌', 'ditie': '🚇', 'huoche': '🚆', 'gaotie': '🚄', 'xuexiao': '🏫', 'lvguan': '🏨', 'binguan': '🏨', 'yinxing': '🏦', 'yiyuan': '🏥', 'fangzi': '🏠', 'jiating': '🏠', 'haosi': '🏠', 'budehaosi': '不得🏠', 'huoshan': '🌋', 'motuo': '🏍️', 'motuoche': '🏍️', 'saiche': '🏎️', 'shixiang': '🗿', 'yanhua': '🎆', 'liuxing': '🌠', 'feidie': '🛸', 'huojian': '🚀', 'renzaoweixing': '🛰️', 'weixing': '🛰️', 'zuowei': '💺', 'qima': '🏇', 'huaxue': '⛷️', 'youyong': '🏊', 'daqiu': '⛹️', 'juzhong': '🏋️', 'xunzhang': '🎖️', 'jiangbei': '🏆', 'jiangpai': '🏅', 'zuqiu': '⚽', 'bangqiu': '⚾', 'lanqiu': '🏀', 'paiqiu': '🏐', 'ganlanqiu': '🏈', 'wangqiu': '🎾', 'baolingqiu': '🎳', 'pingpangqiu': '🏓', 'yumaoqiu': '🏸', 'quanji': '🥊', 'yugan': '🎣', 'diaoyu': '🎣', 'youxi': '🎮', 'dayouxi': '🎮', 'touzi': '🎲', 'sezi': '🎲', 'huaban': '🎨', 'yizhu': '🎨', 'maoxian': '🧶', 'huatong': '🎤', 'erji': '🎧', 'sakesi': '🎷', 'jita': '🎸', 'gangqin': '🎹', 'laba': '📢', 'xiaotiqin': '🎻', 'jianji': '🎬', 'dianying': '🎬', 'shejian': '🏹', 'qingshu': '💌', 'dong': '🕳️', 'zhadan': '💣', 'xizao': '🛀', 'shuijue': '🛌', 'dao': '🔪', 'shijieditu': '🗺', 'zhinanzhen': '🧭', 'zhuan': '🧱', 'ling': '0️⃣', 'xiangling': '🛎', 'shalou': '⌛', 'biao': '⌚', 'naozhong': '⏰', 'zhong': '🀄', 'wenduji': '🌡', 'miehuoqi': '🧨', 'qiqiu': '🎈', 'gongxi': '🎉', 'zhuhe': '🎉', 'ribenren': '🎎', 'liyuqi': '🎏', 'hongbao': '🧧', 'hudiejie': '🎀', 'jie': '🎀', 'liwu': '🎁', 'shuijingqiu': '🔮', 'taidixiong': '🧸', 'xian': '🧵', 'gouwudai': '🛍', 'zuanshi': '💎', 'zuan': '💎', 'shouyinji': '📻', 'shouting': '📻', 'shouji': '📱', 'dianhua': '☎', 'dianchi': '🔋', 'chatou': '🔌', 'diannao': '💻', 'jianpan': '⌨', 'dayinji': '🖨', 'dayin': '🖨', 'shubiao': '🖱', 'yingpan': '💽', 'guangpan': '💿', 'DVD': '📀', 'suanpan': '🧮', 'sheyingji': '🎥', 'fangying': '📽', 'shangying': '📽', 'dianshi': '📺', 'xiangji': '📷', 'zhaoxiangji': '📷', 'luxiangji': '📹', 'fangdajing': '🔍', 'fangda': '🔍', 'lazhu': '🕯', 'deng': '💡', 'liang': '💡', 'shoudiantong': '🔦', 'bijiben': '📔', 'baozhi': '📰', 'shuqian': '📑', 'biaoqian': '🏷', 'qiandai': '💰', 'riyuan': '💴', 'meiyuan': '💵', 'ouyuan': '💶', 'xinyongqia': '💳', 'shouju': '🧾', 'xinfeng': '✉', 'xin': '🆕', 'youjian': '📧', 'fasong': '📤', 'jieshou': '📥', 'shoudao': '📥', 'youxiang': '📮', 'qianbi': '✏', 'gangbi': '🖊', 'huabi': '🖌', 'labi': '🖍', 'beiwanglu': '📝', 'bianqian': '📝', 'wenjianjia': '📁', 'rili': '📅', 'zengchang': '📈', 'zengjia': '📈', 'zengda': '📈', 'zeng': '📈', 'xiajiang': '📉', 'jiangdi': '📉', 'jianshao': '📉', 'jiang': '📉', 'tuding': '📌', 'huixingzhen': '📎', 'chizi': '📏', 'jiandao': '✂', 'lajitong': '🗑', 'suo':'🔒', 'yaochi': '🔑', 'chuizi': '🔨', 'bishou': '🗡', 'shouqiang': '🔫', 'dunpai': '🛡', 'xiuli': '🔧', 'xiu': '🔧', 'banshou': '🔧', 'chilun': '⚙', 'tianping': '⚖', 'lianjie': '🔗', 'suolian': '⛓', 'gongjuxiang': '🧰', 'cili': '🧲', 'ci': '🧲', 'citie': '🧲', 'shiguan': '🧪', 'DNA': '🧬', 'jiyin': '🧬', 'xianweijing': '🔬', 'wangyuanjing': '🔭', 'leida': '📡', 'zhen': '💉', 'yao': '💊', 'men': '🚪', 'chuang': '🛏', 'cesuo': '🚾', 'matong': '🚽', 'linyu': '🚿', 'yugang': '🛁', 'xijiejing': '🧴', 'sao': '🧹', 'saozhou': '🧹', 'saoba': '🧹', 'lanzi': '🧺', 'juanzhi': '🧻', 'weishengzhi': '🧻', 'feizao': '🧼', 'zao': '🧼', 'haimian': '🧽', 'xiangyan': '🚬', 'zhaxin': '💘', 'xindong': '💓', 'ai': '💓', 'xintiao': '💓', 'xinxinxiangyin': '💕', 'xinxiangyin': '💕', 'xinsui': '💔', 'heixin': '🖤', 'manfen': '💯', '100fen': '💯', 'xinxi': '💬', 'xiangfa': '💭', 'hunshui': '💤', 'kun': '💤', 'zheng': '♨', 'ting': '🛑', 'xuanfeng': '🌀', 'jufeng': '🌀', 'heitao': '♠', 'hongtao': '♥', 'fangkuai': '♦', 'meihua': '♣', 'pai': '🃏', 'puke': '🃏', 'hongzhong': '🀄', 'jingyin': '🔇', 'yinliang': '🔈', 'lingdang': '🔔', 'yinle': '🎵', 'yin': '🎵', 'ATM': '🏧', 'lunyi': '♿', 'canjiren': '♿', 'nance': '🚹', 'nvce': '🚺', 'yinger': '🚼', 'jinggao': '⚠', 'jinzhijinru': '⛔', 'jinzhi': '🚫', 'chengren': '🔞', 'seqing': '🔞', 'fushe': '☢', 'shangxia': '↕', 'zuoyou': '↔', 'xunhuan': '🔄', 'raoquan': '🔄', 'rao': '🔄', 'fanhui': '🔙', 'yuanzi': '⚛', 'yinyang': '☯', 'qingzhen': '☪', 'yisilan': '☪', 'musilin': '☪', 'baiyangzuo': '♈', 'jinniuzuo': '♉', 'shuangzizuo': '♊', 'juxiezuo': '♋', 'shizizuo': '♌', 'chunvzuo': '♍', 'tianchengzuo': '♎', 'tianhezuo': '♏', 'sheshouzuo': '♐', 'mojiezuo': '♑', 'shuipingzuo': '♒', 'shuangyuzuo': '♓', 'shefuzuo': '⛎', 'zhongfang': '🔁', 'danquxunhuan': '🔂', 'bofang': '▶', 'kuaijin': '⏩', 'fanhuijian': '◀', 'kuaitui': '⏪', 'zanting': '⏹', 'tuichu': '⏏', 'dianyingyuan': '🎦', 'xinhao': '📶', 'dashi': '带师', 'dage': '带哥', 'wuqiong': '♾', 'wuxian': '♾', 'sanchaji': '🔱', 'huan': '⭕', 'yuan': '⭕', 'dui': '✅', 'cuo': '❌', 'bisi': 'biss', 'gaokuaidian': 'GKD', 'jia': '➕', 'chu': '➗', '?': '¿', '!': '❗', '0': '0️⃣', '1': '1️⃣', '2': '2️⃣', '3': '3️⃣', '4': '4️⃣', '5': '5️⃣', '6': '6️⃣', '7': '7️⃣', '8': '8️⃣', 'nin': '宁', '9': '9️⃣', '10': '🔟', 'mianfei': '🆓', 'yue': '🈷', 'jin': '🈲', 'ke': '🉑', 'shen': '🈸', 'kong': '🈳', 'mi': '㊙', 'man': '🈵', 'fu': '🪓', 'liu': '6️⃣', 'qi': '7️⃣', 'ba': '8️⃣', '?': '¿', 'a': '嗷', 'e': '嗷', 'asensongdao': '🇦🇨', 'andaoer': '🇦🇩', 'alianqiu': '🇦🇪', 'afuhan': '🇦🇫', 'antiguahebabuda': '🇦🇬', 'anguila': '🇦🇮', 'aerbaniya': '🇦🇱', 'yameiniya': '🇦🇲', 'angela': '🇦🇴', 'nanjizhou': '🇦🇶', 'agenting': '🇦🇷', 'meishusamoyaqundao': '🇦🇸', 'aodili': '🇦🇹', 'aodaliya': '🇦🇺', 'aluba': '🇦🇼', 'aolanqundao': '🇦🇽', 'asaibaijiang': '🇦🇿', 'bohei': '🇧🇦', 'baduosi': '🇧🇧', 'mengjialaguo': '🇧🇩', 'weibilishi': '🇧🇪', 'bujinafasuo': '🇧🇫', 'baojialiya': '🇧🇬', 'balin': '🇧🇭', 'bulongdi': '🇧🇮', 'beining': '🇧🇯', 'shengbatailemi': '🇧🇱', 'baimuda': '🇧🇲', 'wenlai': '🇧🇳', 'boliweiya': '🇧🇴', 'helanjialebi': '🇧🇶', 'baxi': '🇧🇷', 'bahama': '🇧🇸', 'budan': '🇧🇹', 'buweidao': '🇧🇻', 'bociwana': '🇧🇼', 'baieluosi': '🇧🇾', 'bolizi': '🇧🇿', 'jianada': '🇨🇦', 'kekesiqundao': '🇨🇨', 'gangguojin': '🇨🇩', 'zhongfeigongheguo': '🇨🇫', 'gangguobu': '🇨🇬', 'ruishi': '🇨🇭', 'ketediwa': '🇨🇮', 'kukequndao': '🇨🇰', 'zhili': '🇨🇱', 'kamailong': '🇨🇲', 'zhongguo': '🇨🇳', 'gelunbiya': '🇨🇴', 'kelipodundao': '🇨🇵', 'gesidalijia': '🇨🇷', 'guba': '🇨🇺', 'fodejiao': '🇨🇻', 'kulasuo': '🇨🇼', 'shengdandao': '🇨🇽', 'saipulusi': '🇨🇾', 'jiekegongheguo': '🇨🇿', 'deguo': '🇩🇪', 'digejiaxiya': '🇩🇬', 'jibuti': '🇩🇯', 'danmai': '🇩🇰', 'duominijia': '🇩🇲', 'duomingnijiagongheguo': '🇩🇴', 'aerjiliya': '🇩🇿', 'xiudahemeililiya': '🇪🇦', 'eguaduoer': '🇪🇨', 'aishaniya': '🇪🇪', 'aiji': '🇪🇬', 'xisahala': '🇪🇭', 'eliteliya': '🇪🇷', 'xibanya': '🇪🇸', 'aisaiebiya': '🇪🇹', 'oumeng': '🇪🇺', 'fenlan': '🇫🇮', 'fukelanqundao': '🇫🇰', 'mikeluonixiya': '🇫🇲', 'faluoqundao': '🇫🇴', 'faguo': '🇫🇷', 'jiapeng': '🇬🇦', 'yingguo': '🇬🇧', 'gelinnada': '🇬🇩', 'gelujiya': '🇬🇪', 'fashuguiyana': '🇬🇫', 'genxidao': '🇬🇬', 'jiana': '🇬🇭', 'zhibuluotuo': '🇬🇮', 'gelinglan': '🇬🇱', 'gangbiya': '🇬🇲', 'jineiya': '🇬🇳', 'guadeluopudao': '🇬🇵', 'chidaojineiya': '🇬🇶', 'xila': '🇬🇷', 'nanqiaozhiyadaohenansangweiqiqundao': '🇬🇸', 'weidimala': '🇬🇹', 'guandao': '🇬🇺', 'jineiyabishao': '🇬🇼', 'guiyana': '🇬🇾', 'xianggang': '🇭🇰', 'hedeyumaiketangnaqundao': '🇭🇲', 'hongdulasi': '🇭🇳', 'keluodiya': '🇭🇷', 'haidi': '🇭🇹', 'xiongyali': '🇭🇺', 'jianaliqundao': '🇮🇨', 'yinni': '🇮🇩', 'aierlan': '🇮🇪', 'weiyiselie': '🇮🇱', 'mandao': '🇮🇲', 'yindu': '🇮🇳', 'yingshuyinduyanglingdi': '🇮🇴', 'yilake': '🇮🇶', 'yilang': '🇮🇷', 'bingdao': '🇮🇸', 'yidali': '🇮🇹', 'zexi': '🇯🇪', 'yamaijia': '🇯🇲', 'yuedan': '🇯🇴', 'riben': '🇯🇵', 'kenniya': '🇰🇪', 'jierjisisitan': '🇰🇬', 'jianpuzhai': '🇰🇭', 'jilibasi': '🇰🇮', 'kemoluo': '🇰🇲', 'shengjiciheniweisi': '🇰🇳', 'zhaoxian': '🇰🇵', 'hanguo': '🇰🇷', 'keweite': '🇰🇼', 'kaimanqundao': '🇰🇾', 'hasakesitan': '🇰🇿', 'laozhua': '🇱🇦', 'libanen': '🇱🇧', 'shengluxiya': '🇱🇨', 'liezhidunshideng': '🇱🇮', 'sililanqia': '🇱🇰', 'libiliya': '🇱🇷', 'laisuotuo': '🇱🇸', 'litaowan': '🇱🇹', 'lusenbao': '🇱🇺', 'latuoweiya': '🇱🇻', 'libiya': '🇱🇾', 'moluoge': '🇲🇦', 'monage': '🇲🇨', 'moerduowa': '🇲🇩', 'heishan': '🇲🇪', 'shengmading': '🇲🇫', 'madajiasijia': '🇲🇬', 'mashaoerqundao': '🇲🇭', 'maqidun': '🇲🇰', 'mali': '🇲🇱', 'miandian': '🇲🇲', 'menggu': '🇲🇳', 'aomen': '🇲🇴', 'beimaliyanaqundao': '🇲🇵', 'matinikedao': '🇲🇶', 'maolitaniya': '🇲🇷', 'mengtesailate': '🇲🇸', 'maerta': '🇲🇹', 'maoliqiusi': '🇲🇺', 'maerdaifu': '🇲🇻', 'malawei': '🇲🇼', 'moxige': '🇲🇽', 'malaixiya': '🇲🇾', 'mosangbike': '🇲🇿', 'namibiya': '🇳🇦', 'xinkaliduoniya': '🇳🇨', 'nirier': '🇳🇪', 'nuofukedao': '🇳🇫', 'niriliya': '🇳🇬', 'nijialagua': '🇳🇮', 'helan': '🇳🇱', 'nuowei': '🇳🇴', 'niboer': '🇳🇵', 'naolu': '🇳🇷', 'niuai': '🇳🇺', 'xinxilan': '🇳🇿', 'aman': '🇴🇲', 'banama': '🇵🇦', 'milu': '🇵🇪', 'fashubolinixiya': '🇵🇫', 'babuyaxinjineiya': '🇵🇬', 'feilvbin': '🇵🇭', 'bajisitan': '🇵🇰', 'bolan': '🇵🇱', 'shengpiaierhemikelongqundao': '🇵🇲', 'pitekaienqundao': '🇵🇳', 'boduolige': '🇵🇷', 'balesitanlingtu': '🇵🇸', 'putaoya': '🇵🇹', 'palao': '🇵🇼', 'balagui': '🇵🇾', 'qiataer': '🇶🇦', 'tuanyuan': '🇷🇪', 'luomaniya': '🇷🇴', 'saierweiya': '🇷🇸', 'eluosi': '🇷🇺', 'luwangda': '🇷🇼', 'shatealabo': '🇸🇦', 'suoluomenqundao': '🇸🇧', 'saisheer': '🇸🇨', 'sudan': '🇸🇩', 'ruidian': '🇸🇪', 'xinjiapo': '🇸🇬', 'shenghelena': '🇸🇭', 'siluowenniya': '🇸🇮', 'siwaerbaqundaoheyangmayan': '🇸🇯', 'siluofake': '🇸🇰', 'sailaliang': '🇸🇱', 'shengmalinuo': '🇸🇲', 'saineijiaer': '🇸🇳', 'suomali': '🇸🇴', 'sulinan': '🇸🇷', 'nansudan': '🇸🇸', 'shengduomeihepulinxibi': '🇸🇹', 'saerwaduo': '🇸🇻', 'shengmadingdao': '🇸🇽', 'xuliya': '🇸🇾', 'siweishilan': '🇸🇿', 'telisitandakuniyaqundao': '🇹🇦', 'tekesihekaikesiqundao': '🇹🇨', 'zhade': '🇹🇩', 'faguonanfangdelingtu': '🇹🇫', 'duoge': '🇹🇬', 'taiguo': '🇹🇭', 'tajikesitan': '🇹🇯', 'tuokelao': '🇹🇰', 'dongdiwen': '🇹🇱', 'tukumansitan': '🇹🇲', 'tunisi': '🇹🇳', 'tangjia': '🇹🇴', 'tuerqi': '🇹🇷', 'telinidaheduobage': '🇹🇹', 'tuwalu': '🇹🇻', 'taiwan': '🇹🇼', 'tansangniya': '🇹🇿', 'wukelan': '🇺🇦', 'wuganda': '🇺🇬', 'meiguolidao': '🇺🇲', 'meiguo': '🇺🇸', 'wulagui': '🇺🇾', 'wuzibiekesitan': '🇺🇿', 'fandigangcheng': '🇻🇦', 'shengwensentehegelinnadingsi': '🇻🇨', 'weineiruila': '🇻🇪', 'yingshuweierjingqundao': '🇻🇬', 'meishuweierjingqundao': '🇻🇮', 'yuenan': '🇻🇳', 'wanuatu': '🇻🇺', 'walisihefutunaqundao': '🇼🇫', 'samoya': '🇼🇸', 'kesuowo': '🇽🇰', 'yemen': '🇾🇪', 'mayuete': '🇾🇹', 'nanfei': '🇿🇦', 'zanbiya': '🇿🇲', 'jinbabuwei': '🇿🇼', 'nei': '👙', 'liupi': '🐮🍺', 'nige': '👨🏿', 'heiren': '👨🏿', 'yinghua': '🌸', 'tie': 'Fe', 'nai': '🍼', 'han': '🍔', 'huanxing': '🌊⭐', 'xiaren': '🍤', 'sharen': '👨🏿', 'qian': '💰', 'feiwu': 'five', 'qiu': '⚽', 'erciyuan': '二刺螈', 'cao': '🌿', 'guozi': '果汁', 'ping': '🍎', 'sunxiaochuan': '孙🐶', 'tounima': 'tony🐎', 'wenzi': '🦟'}
| 13,009
| 14,674
| 0.32908
| 3,799
| 26,018
| 2.908397
| 0.687023
| 0.001629
| 0.000905
| 0.000905
| 0.007965
| 0.007965
| 0.006516
| 0.006516
| 0.006516
| 0.006516
| 0
| 0.003226
| 0.142286
| 26,018
| 2
| 14,674
| 13,009
| 0.3804
| 0
| 0
| 0
| 0
| 0
| 0.424437
| 0.011146
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
8edc7a23b99a5a28b9c569cd1a887b4a907261ed
| 58
|
py
|
Python
|
app/core/tests/__init__.py
|
AryanGodara/recipe-app-api
|
95a8024708389fa2c4eb9f34d6f86d87ffa26e10
|
[
"MIT"
] | null | null | null |
app/core/tests/__init__.py
|
AryanGodara/recipe-app-api
|
95a8024708389fa2c4eb9f34d6f86d87ffa26e10
|
[
"MIT"
] | null | null | null |
app/core/tests/__init__.py
|
AryanGodara/recipe-app-api
|
95a8024708389fa2c4eb9f34d6f86d87ffa26e10
|
[
"MIT"
] | null | null | null |
# We write our tests first, and implement our models later
| 58
| 58
| 0.793103
| 10
| 58
| 4.6
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172414
| 58
| 1
| 58
| 58
| 0.958333
| 0.965517
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
8ee8b20c61545665e5ee43d6fcc71167ac45211f
| 85
|
py
|
Python
|
banda/apps.py
|
LuisHenrique01/music-api
|
fb71c918625e61ae6ace3c14784ea1281287580f
|
[
"MIT"
] | 1
|
2021-02-02T03:58:48.000Z
|
2021-02-02T03:58:48.000Z
|
banda/apps.py
|
LuisHenrique01/music-api
|
fb71c918625e61ae6ace3c14784ea1281287580f
|
[
"MIT"
] | null | null | null |
banda/apps.py
|
LuisHenrique01/music-api
|
fb71c918625e61ae6ace3c14784ea1281287580f
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class BandaConfig(AppConfig):
name = 'banda'
| 14.166667
| 33
| 0.741176
| 10
| 85
| 6.3
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 85
| 5
| 34
| 17
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
d93308a51b1c73bd32f9d74b99c6296b1e209566
| 97
|
py
|
Python
|
Backend/onduty/allocations/apps.py
|
marsh69/Beats-Allocation-SIH
|
597121dcd1d4259d9a1df394ef09891757df6895
|
[
"MIT"
] | 1
|
2020-08-12T03:19:22.000Z
|
2020-08-12T03:19:22.000Z
|
django_xsede_warehouse/allocations/apps.py
|
XSEDE/XSEDE_Information_Warehouse
|
8b3aab42b7afd70ce69b9bf44551a0ded4491831
|
[
"Apache-2.0"
] | null | null | null |
django_xsede_warehouse/allocations/apps.py
|
XSEDE/XSEDE_Information_Warehouse
|
8b3aab42b7afd70ce69b9bf44551a0ded4491831
|
[
"Apache-2.0"
] | 2
|
2020-08-11T08:04:15.000Z
|
2020-10-02T08:20:41.000Z
|
from django.apps import AppConfig
class AllocationsConfig(AppConfig):
name = 'allocations'
| 16.166667
| 35
| 0.773196
| 10
| 97
| 7.5
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.154639
| 97
| 5
| 36
| 19.4
| 0.914634
| 0
| 0
| 0
| 0
| 0
| 0.113402
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
d966ba258586224f6a4987d8fc56fc2f6218245b
| 1,262
|
py
|
Python
|
JTP Recap./2.Program_IO/File_IO.py
|
SNP0301/Study_Python
|
bb7ce7a0d915131c281152e7faee5b57c290df6b
|
[
"MIT"
] | null | null | null |
JTP Recap./2.Program_IO/File_IO.py
|
SNP0301/Study_Python
|
bb7ce7a0d915131c281152e7faee5b57c290df6b
|
[
"MIT"
] | null | null | null |
JTP Recap./2.Program_IO/File_IO.py
|
SNP0301/Study_Python
|
bb7ce7a0d915131c281152e7faee5b57c290df6b
|
[
"MIT"
] | null | null | null |
"""
File IO
1.Create
-------------------
f = open('file_name.txt','w')
f.close()
-------------------
2.Write
-------------------
f = open('file_name.txt','w')
data = 'hi'
f.write(data)
f.close()
-------------------
3.Read
1) Readline
-------------------
f = open('file_name.txt','r')
line = f.readline()
print(line)
f.close()
-------------------
-------------------
f = open('file_name.txt','r')
while True:
line = f.readline()
if not line: break
print(line)
f.close
-------------------
---> if readline() has nothing to read, it returns ''(False).
2) Readlines
3) Read
4. Add new data
1) with mode 'a'
-------------------
f = open('file_name.txt','a')
data = 'hi'
f.write(data)
f.close()
-------------------
5. With : autoclose
-------------------
f = open('file_name.txt','w')
f.write('SNP what you want to SNP')
f.close
-------------------
equals to
-------------------
with open('file_name.txt','w') as f:
f.write('SNP what you want to SNP')
-------------------
"""
| 21.033333
| 69
| 0.354992
| 134
| 1,262
| 3.291045
| 0.343284
| 0.126984
| 0.190476
| 0.238095
| 0.480726
| 0.408163
| 0.292517
| 0.113379
| 0
| 0
| 0
| 0.010502
| 0.320919
| 1,262
| 60
| 70
| 21.033333
| 0.504084
| 0.993661
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 0
| 0
| 0
| null | 0
| 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
| 4
|
d968e2703900a4c3359cfc05d1d031a97b6372a0
| 31
|
py
|
Python
|
homeassistant/components/monoprice/__init__.py
|
itewk/home-assistant
|
769cf19052f8c9ef374d8ba8ae7705ccc7bf4cf4
|
[
"Apache-2.0"
] | 23
|
2017-11-15T21:03:53.000Z
|
2021-03-29T21:33:48.000Z
|
homeassistant/components/monoprice/__init__.py
|
itewk/home-assistant
|
769cf19052f8c9ef374d8ba8ae7705ccc7bf4cf4
|
[
"Apache-2.0"
] | 39
|
2016-12-16T12:40:34.000Z
|
2017-02-13T17:53:42.000Z
|
homeassistant/components/monoprice/__init__.py
|
itewk/home-assistant
|
769cf19052f8c9ef374d8ba8ae7705ccc7bf4cf4
|
[
"Apache-2.0"
] | 10
|
2018-01-01T00:12:51.000Z
|
2021-12-21T23:08:05.000Z
|
"""The monoprice component."""
| 15.5
| 30
| 0.677419
| 3
| 31
| 7
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.096774
| 31
| 1
| 31
| 31
| 0.75
| 0.774194
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d9700165a73e9ca3d2b5b097d27af50c96b5e4c9
| 224
|
py
|
Python
|
HackerRank/Python/Easy/E0034.py
|
Mohammed-Shoaib/HackerRank-Problems
|
ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b
|
[
"MIT"
] | 54
|
2019-05-13T12:13:09.000Z
|
2022-02-27T02:59:00.000Z
|
HackerRank/Python/Easy/E0034.py
|
Mohammed-Shoaib/HackerRank-Problems
|
ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b
|
[
"MIT"
] | 2
|
2020-10-02T07:16:43.000Z
|
2020-10-19T04:36:19.000Z
|
HackerRank/Python/Easy/E0034.py
|
Mohammed-Shoaib/HackerRank-Problems
|
ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b
|
[
"MIT"
] | 20
|
2020-05-26T09:48:13.000Z
|
2022-03-18T15:18:27.000Z
|
# Problem Statement: https://www.hackerrank.com/challenges/symmetric-difference/problem
_, M = int(input()), set(map(int, input().split()))
_, N = int(input()), set(map(int, input().split()))
print(*sorted(M ^ N), sep='\n')
| 44.8
| 87
| 0.660714
| 32
| 224
| 4.5625
| 0.59375
| 0.219178
| 0.150685
| 0.191781
| 0.369863
| 0.369863
| 0.369863
| 0
| 0
| 0
| 0
| 0
| 0.089286
| 224
| 5
| 88
| 44.8
| 0.715686
| 0.379464
| 0
| 0
| 0
| 0
| 0.014493
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0.333333
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d9843c433faea853302346eab0e03b9ad27f52dc
| 190
|
py
|
Python
|
tests/admin_scripts/custom_templates/project_template/manage.py
|
bpeschier/django
|
f54c0ec06e390dc5bce95fdccbcb51d6423da4f9
|
[
"BSD-3-Clause"
] | 790
|
2015-01-03T02:13:39.000Z
|
2020-05-10T19:53:57.000Z
|
AppServer/lib/django-1.5/tests/regressiontests/admin_scripts/custom_templates/project_template/manage.py
|
nlake44/appscale
|
6944af660ca4cb772c9b6c2332ab28e5ef4d849f
|
[
"Apache-2.0"
] | 1,361
|
2015-01-08T23:09:40.000Z
|
2020-04-14T00:03:04.000Z
|
AppServer/lib/django-1.5/tests/regressiontests/admin_scripts/custom_templates/project_template/manage.py
|
nlake44/appscale
|
6944af660ca4cb772c9b6c2332ab28e5ef4d849f
|
[
"Apache-2.0"
] | 155
|
2015-01-08T22:59:31.000Z
|
2020-04-08T08:01:53.000Z
|
# The manage.py of the {{ project_name }} test project
# template context:
project_name = '{{ project_name }}'
project_directory = '{{ project_directory }}'
secret_key = '{{ secret_key }}'
| 27.142857
| 54
| 0.694737
| 23
| 190
| 5.434783
| 0.521739
| 0.264
| 0.288
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.152632
| 190
| 6
| 55
| 31.666667
| 0.776398
| 0.368421
| 0
| 0
| 0
| 0
| 0.487179
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
795cf1d315af326cda693e24ee95466d078bbeec
| 263
|
py
|
Python
|
packages/Python/lldbsuite/test/lang/swift/member_lookup_crash/TestMemberLookupCrash.py
|
enterstudio/swift-lldb
|
af85d636d230da2460f91938b1ff734b0fb64b42
|
[
"Apache-2.0"
] | 2
|
2019-05-24T14:10:24.000Z
|
2019-05-24T14:27:38.000Z
|
packages/Python/lldbsuite/test/lang/swift/member_lookup_crash/TestMemberLookupCrash.py
|
enterstudio/swift-lldb
|
af85d636d230da2460f91938b1ff734b0fb64b42
|
[
"Apache-2.0"
] | null | null | null |
packages/Python/lldbsuite/test/lang/swift/member_lookup_crash/TestMemberLookupCrash.py
|
enterstudio/swift-lldb
|
af85d636d230da2460f91938b1ff734b0fb64b42
|
[
"Apache-2.0"
] | null | null | null |
"""
Test that member lookup inside of generic container doesn't crash
"""
import lldbsuite.test.lldbinline as lldbinline
import lldbsuite.test.decorators as decorators
lldbinline.MakeInlineTest(
__file__, globals(), decorators=[decorators.skipUnlessDarwin])
| 29.222222
| 66
| 0.806084
| 30
| 263
| 6.933333
| 0.666667
| 0.144231
| 0.182692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.110266
| 263
| 8
| 67
| 32.875
| 0.888889
| 0.247148
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
797e99d522535dce297387073c1a52e6ca054637
| 69
|
py
|
Python
|
TP/TP1/Code/Python/3.py
|
sumaxime/LIFAP1
|
b5da0395de9775cd8b319b56af7a6d0257d542db
|
[
"MIT"
] | 1
|
2019-06-19T08:40:24.000Z
|
2019-06-19T08:40:24.000Z
|
TP/TP1/Code/Python/3.py
|
sumaxime/LIFAP1
|
b5da0395de9775cd8b319b56af7a6d0257d542db
|
[
"MIT"
] | 13
|
2016-11-15T16:44:23.000Z
|
2016-12-16T09:42:48.000Z
|
TP/TP1/Code/Python/3.py
|
sumaxime/LIFAP1
|
b5da0395de9775cd8b319b56af7a6d0257d542db
|
[
"MIT"
] | 1
|
2019-12-06T11:48:09.000Z
|
2019-12-06T11:48:09.000Z
|
#!/usr/bin/python
# Premier programme en C++
print('Hello, World !')
| 17.25
| 26
| 0.666667
| 10
| 69
| 4.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 69
| 3
| 27
| 23
| 0.766667
| 0.594203
| 0
| 0
| 0
| 0
| 0.538462
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
7995775831a1a0c872e8039810e90e0281710e66
| 157
|
py
|
Python
|
webcomix/scrapy/verification/web_page.py
|
J-CPelletier/WebComicToCBZ
|
f845697beb15fa7b1fa3454bcfc18bcafa2e9961
|
[
"MIT"
] | 29
|
2017-12-06T19:52:07.000Z
|
2022-02-02T04:56:13.000Z
|
webcomix/scrapy/verification/web_page.py
|
J-CPelletier/webcomix
|
748f98c1e18aa5bd631b27a2b76b16d02640c392
|
[
"MIT"
] | 35
|
2018-06-15T04:20:13.000Z
|
2021-10-11T17:28:20.000Z
|
webcomix/scrapy/verification/web_page.py
|
J-CPelletier/WebComicToCBZ
|
f845697beb15fa7b1fa3454bcfc18bcafa2e9961
|
[
"MIT"
] | 2
|
2020-06-25T21:24:28.000Z
|
2020-06-30T19:17:13.000Z
|
import scrapy
class WebPage(scrapy.Item):
url = scrapy.Field()
page = scrapy.Field()
image_urls = scrapy.Field()
alt_text = scrapy.Field()
| 17.444444
| 31
| 0.656051
| 20
| 157
| 5.05
| 0.6
| 0.435644
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.216561
| 157
| 8
| 32
| 19.625
| 0.821138
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
79b860937ddeeaccf132a45ddfb390961f09aeda
| 942
|
py
|
Python
|
lang/py/pylib/code/filecmp/filecmp_cmp.py
|
ch1huizong/learning
|
632267634a9fd84a5f5116de09ff1e2681a6cc85
|
[
"MIT"
] | 13
|
2020-01-04T07:37:38.000Z
|
2021-08-31T05:19:58.000Z
|
lang/py/pylib/code/filecmp/filecmp_cmp.py
|
ch1huizong/learning
|
632267634a9fd84a5f5116de09ff1e2681a6cc85
|
[
"MIT"
] | 3
|
2020-06-05T22:42:53.000Z
|
2020-08-24T07:18:54.000Z
|
lang/py/pylib/code/filecmp/filecmp_cmp.py
|
ch1huizong/learning
|
632267634a9fd84a5f5116de09ff1e2681a6cc85
|
[
"MIT"
] | 9
|
2020-10-19T04:53:06.000Z
|
2021-08-31T05:20:01.000Z
|
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Compare two files.
"""
__version__ = "$Id$"
#end_pymotw_header
import filecmp
print 'common_file:',
print filecmp.cmp('example/dir1/common_file',
'example/dir2/common_file'),
print filecmp.cmp('example/dir1/common_file',
'example/dir2/common_file',
shallow=False)
print 'not_the_same:',
print filecmp.cmp('example/dir1/not_the_same',
'example/dir2/not_the_same'),
print filecmp.cmp('example/dir1/not_the_same',
'example/dir2/not_the_same',
shallow=False)
print 'identical:',
print filecmp.cmp('example/dir1/file_only_in_dir1',
'example/dir1/file_only_in_dir1'),
print filecmp.cmp('example/dir1/file_only_in_dir1',
'example/dir1/file_only_in_dir1',
shallow=False)
| 26.914286
| 55
| 0.629512
| 118
| 942
| 4.745763
| 0.338983
| 0.157143
| 0.160714
| 0.235714
| 0.675
| 0.675
| 0.675
| 0.675
| 0.675
| 0.675
| 0
| 0.029453
| 0.2431
| 942
| 34
| 56
| 27.705882
| 0.755961
| 0.113588
| 0
| 0.45
| 0
| 0
| 0.442092
| 0.393524
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.05
| null | null | 0.45
| 0
| 0
| 0
| null | 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
8dc8a18b90f44e811d0446f1e03a035926efd89e
| 661
|
py
|
Python
|
tests/test_DirInit.py
|
IceBerge421/URS
|
fd36cfe5b63c3d3e57fd879979c4d2256145ccac
|
[
"MIT"
] | 4
|
2021-02-15T02:02:38.000Z
|
2022-03-04T16:38:44.000Z
|
tests/test_DirInit.py
|
IceBerge421/URS
|
fd36cfe5b63c3d3e57fd879979c4d2256145ccac
|
[
"MIT"
] | null | null | null |
tests/test_DirInit.py
|
IceBerge421/URS
|
fd36cfe5b63c3d3e57fd879979c4d2256145ccac
|
[
"MIT"
] | 2
|
2021-02-11T01:10:27.000Z
|
2021-02-25T19:20:04.000Z
|
from urs.utils import DirInit
### Function names are pretty self-explanatory, so I will not be adding comments
### above the functions.
### Includes a total of 4 tests.
class TestInitializeDirectoryMakeDirectoryMethod():
"""
Testing InitializeDirectory class make_directory() method found on line 16 in
DirInit.py.
"""
def test_make_directory_scrapes_directory_does_not_exist(self):
pass
def test_make_directory_scrapes_directory_already_exists(self):
pass
def test_make_directory_date_directory_does_not_exist(self):
pass
def test_make_directory_date_directory_already_exists(self):
pass
| 26.44
| 81
| 0.748865
| 84
| 661
| 5.571429
| 0.583333
| 0.138889
| 0.094017
| 0.17094
| 0.470085
| 0.397436
| 0.305556
| 0.305556
| 0.209402
| 0.209402
| 0
| 0.005618
| 0.192133
| 661
| 24
| 82
| 27.541667
| 0.870787
| 0.329803
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0.4
| 0.1
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
8de431c8640c4cef1f15cb3559eb284e0847f9e6
| 116,112
|
py
|
Python
|
src/test/dhcpl2relay/dhcpl2relayTest.py
|
huseyinbolt/cord-tester
|
ed9b79916e6326a45bfaf3227b8ff922d76df4f1
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
src/test/dhcpl2relay/dhcpl2relayTest.py
|
huseyinbolt/cord-tester
|
ed9b79916e6326a45bfaf3227b8ff922d76df4f1
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
src/test/dhcpl2relay/dhcpl2relayTest.py
|
huseyinbolt/cord-tester
|
ed9b79916e6326a45bfaf3227b8ff922d76df4f1
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
# Copyright 2017-present Open Networking Foundation
#
# 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.
#
# Copyright 2016-present Ciena Corporation
#
# 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 AeY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import unittest
from nose.tools import *
from nose.twistedtools import reactor, deferred
from twisted.internet import defer
import time
import os, sys, re, json
from DHCP import DHCPTest
from CordTestUtils import get_mac, log_test, getstatusoutput, get_controller
from SSHTestAgent import SSHTestAgent
from OnosCtrl import OnosCtrl
from onosclidriver import OnosCliDriver
from OltConfig import OltConfig
from CordTestServer import cord_test_onos_restart, cord_test_ovs_flow_add,cord_test_onos_shutdown
from CordTestConfig import setup_module, teardown_module
from CordLogger import CordLogger
from portmaps import g_subscriber_port_map
from CordContainer import Onos
from VolthaCtrl import VolthaCtrl
import threading, random
from threading import current_thread
import requests
log_test.setLevel('INFO')
class dhcpl2relay_exchange(CordLogger):
VOLTHA_HOST = None
VOLTHA_REST_PORT = VolthaCtrl.REST_PORT
VOLTHA_ENABLED = bool(int(os.getenv('VOLTHA_ENABLED', 0)))
VOLTHA_OLT_TYPE = 'simulated_olt'
VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
TAGGED_TRAFFIC = False
app = 'org.opencord.dhcpl2relay'
sadis_app = 'org.opencord.sadis'
app_dhcp = 'org.onosproject.dhcp'
app_olt = 'org.onosproject.olt'
relay_interfaces = ()
relay_interfaces_last = ()
interface_to_mac_map = {}
relay_vlan_map = {}
host_ip_map = {}
test_path = os.path.dirname(os.path.realpath(__file__))
dhcp_data_dir = os.path.join(test_path, '..', 'setup')
dhcpl2_app_file = os.path.join(test_path, '..', 'apps/dhcpl2relay-1.0.0.oar')
olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-3.0-SNAPSHOT.oar')
sadis_app_file = os.path.join(test_path, '..', 'apps/sadis-app-1.0.0-SNAPSHOT.oar')
olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config_voltha_local.json'))
default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
default_options = [ ('subnet-mask', '255.255.255.0'),
('broadcast-address', '192.168.1.255'),
('domain-name-servers', '192.168.1.1'),
('domain-name', '"mydomain.cord-tester"'),
]
default_subnet_config = [ ('192.168.1.2',
'''
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
}
'''), ]
lock = threading.Condition()
ip_count = 0
failure_count = 0
start_time = 0
diff = 0
transaction_count = 0
transactions = 0
running_time = 0
total_success = 0
total_failure = 0
#just in case we want to reset ONOS to default network cfg after relay tests
onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
configs = {}
sadis_configs = {}
default_onos_netcfg = {}
voltha_switch_map = None
remote_dhcpd_cmd = []
ONOS_INSTANCES = 3
relay_device_id = None
@classmethod
def update_apps_version(cls):
version = Onos.getVersion()
major = int(version.split('.')[0])
minor = int(version.split('.')[1])
dhcpl2_app_version = '1.0.0'
sadis_app_version = '3.0-SNAPSHOT'
cls.dhcpl2_app_file = os.path.join(cls.test_path, '..', 'apps/dhcpl2relay-{}.oar'.format(dhcpl2_app_version))
cls.sadis_app_file = os.path.join(cls.test_path, '..', 'apps/sadis-app-{}.oar'.format(sadis_app_version))
@classmethod
def setUpClass(cls):
''' Activate the cord dhcpl2relay app'''
cls.update_apps_version()
OnosCtrl(cls.app_dhcp).deactivate()
time.sleep(3)
cls.onos_ctrl = OnosCtrl(cls.app)
status, _ = cls.onos_ctrl.activate()
#assert_equal(status, True)
time.sleep(3)
status, _ = OnosCtrl(cls.sadis_app).activate()
#assert_equal(status, True)
time.sleep(3)
cls.setup_dhcpd()
cls.default_onos_netcfg = OnosCtrl.get_config()
def setUp(self):
super(dhcpl2relay_exchange, self).setUp()
#self.dhcp_l2_relay_setup()
#self.cord_sadis_load()
#self.cord_l2_relay_load()
def tearDown(self):
super(dhcpl2relay_exchange, self).tearDown()
#OnosCtrl.uninstall_app(self.dhcpl2_app_file)
#OnosCtrl.uninstall_app(self.sadis_app_file)
#OnosCtrl.uninstall_app(self.olt_app_file)
@classmethod
def tearDownClass(cls):
'''Deactivate the cord dhcpl2relay app'''
cls.onos_load_config(cls.default_onos_netcfg)
#cls.onos_ctrl.deactivate()
#OnosCtrl(cls.sadis_app).deactivate()
#OnosCtrl(cls.app_olt).deactivate()
@classmethod
def setup_dhcpd(cls, boot_delay = 5):
device_details = OnosCtrl.get_devices(mfr = 'Nicira')
## Assuming only one OVS is detected on ONOS and its for external DHCP server connect point...
if device_details is not None:
did_ovs = device_details[0]['id']
else:
log_test.info('On this DHCPl2relay setup, onos does not have ovs device where external DHCP server is have connect point, so return with false status')
return False
cls.relay_device_id = did_ovs
device_details = OnosCtrl.get_devices()
if device_details is not None:
for device in device_details:
if device['available'] is True and device['driver'] == 'voltha':
cls.olt_serial_id = "{}".format(device['serial'])
break
else:
cls.olt_serial_id = " "
else:
log_test.info('On this DHCPl2relay setup, onos does not have ovs device where external DHCP server is have connect point, so return with false status')
return False
if cls.service_running("/usr/sbin/dhcpd"):
print('DHCPD already running in container')
return True
setup_for_relay = cls.dhcp_l2_relay_setup()
cls.cord_l2_relay_load()
cls.voltha_setup()
return True
# dhcp_start_status = cls.dhcpd_start()
# if setup_for_relay and dhcp_start_status:
# return True
# return False
@classmethod
def config_olt(cls, switch_map):
controller = get_controller()
auth = ('karaf', 'karaf')
#configure subscriber for every port on all the voltha devices
for device, device_map in switch_map.iteritems():
uni_ports = device_map['ports']
uplink_vlan = device_map['uplink_vlan']
for port in uni_ports:
vlan = port
rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
device,
port,
vlan)
requests.post(rest_url, auth = auth)
@classmethod
def voltha_setup(cls):
s_tag_map = {}
#configure olt app to provision dhcp flows
cls.config_olt(cls.voltha_switch_map)
for switch, switch_map in cls.voltha_switch_map.iteritems():
s_tag_map[int(switch_map['uplink_vlan'])] = map(lambda p: int(p), switch_map['ports'])
cmd_list = []
relay_interface = cls.relay_interfaces[0]
cls.relay_vlan_map[relay_interface] = []
for s_tag, ports in s_tag_map.iteritems():
vlan_stag_intf = '{}.{}'.format(relay_interface, s_tag)
cmd = 'ip link add link %s name %s type vlan id %d' %(relay_interface, vlan_stag_intf, s_tag)
cmd_list.append(cmd)
cmd = 'ip link set %s up' %(vlan_stag_intf)
cmd_list.append(cmd)
for port in ports:
vlan_ctag_intf = '{}.{}.{}'.format(relay_interface, s_tag, port)
cmd = 'ip link add link %s name %s type vlan id %d' %(vlan_stag_intf, vlan_ctag_intf, port)
cmd_list.append(cmd)
cmd = 'ip link set %s up' %(vlan_ctag_intf)
cmd_list.append(cmd)
cls.relay_vlan_map[relay_interface].append(vlan_ctag_intf)
cls.relay_vlan_map[relay_interface].append(vlan_stag_intf)
for cmd in cmd_list:
log_test.info('Running command: %s' %cmd)
os.system(cmd)
cord_test_ovs_flow_add(cls.relay_interface_port)
for s_tag in s_tag_map.keys():
log_test.info('Configuring OVS flow for port %d, s_tag %d' %(cls.relay_interface_port, s_tag))
cord_test_ovs_flow_add(cls.relay_interface_port, s_tag)
@classmethod
def service_running(cls, pattern):
st, output = getstatusoutput('pgrep -f "{}"'.format(pattern))
return True if st == 0 else False
@classmethod
def dhcpd_conf_generate(cls, config = default_config, options = default_options,
subnet = default_subnet_config):
conf = ''
for k, v in config.items():
conf += '{} {};\n'.format(k, v)
opts = ''
for k, v in options:
opts += 'option {} {};\n'.format(k, v)
subnet_config = ''
for _, v in subnet:
subnet_config += '{}\n'.format(v)
return '{}{}{}'.format(conf, opts, subnet_config)
@classmethod
def dhcpd_start(cls, intf_list = None,
config = default_config, options = default_options,
subnet = default_subnet_config):
'''Start the dhcpd server by generating the conf file'''
if intf_list is None:
intf_list = cls.relay_interfaces
intf_list = list(intf_list)
##stop dhcpd if already running
#cls.dhcpd_stop()
dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
subnet = subnet)
##first touch dhcpd.leases if it doesn't exist
lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
if os.access(lease_file, os.F_OK) is False:
with open(lease_file, 'w') as fd: pass
lease_file_tagged = '{}/dhcpd-tagged.leases'.format(cls.dhcp_data_dir)
if os.access(lease_file_tagged, os.F_OK) is False:
with open(lease_file_tagged, 'w') as fd: pass
conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
with open(conf_file, 'w') as fd:
fd.write(dhcp_conf)
conf_file_tagged = '{}/dhcpd-tagged.conf'.format(cls.dhcp_data_dir)
with open(conf_file_tagged, 'w') as fd:
fd.write(dhcp_conf)
#now configure the dhcpd interfaces for various subnets
index = 0
intf_info = []
vlan_intf_list = []
for ip,_ in subnet:
vlan_intf = None
intf = intf_list[index]
if intf in cls.relay_vlan_map:
vlan_intf = cls.relay_vlan_map[intf][0]
vlan_intf_list.append(vlan_intf)
mac = cls.get_mac(intf)
intf_info.append((ip, mac))
index += 1
cmd = 'ifconfig {} {}'.format(intf, ip)
status = os.system(cmd)
if vlan_intf:
cmd = 'ifconfig {} {}'.format(vlan_intf, ip)
os.system(cmd)
intf_str = ','.join(intf_list)
dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format('/root/test/src/test/setup/dhcpd.conf','/root/test/src/test/setup/dhcpd.leases', intf_str)
print('Starting DHCPD server with command: %s' %dhcpd_cmd)
status = os.system(dhcpd_cmd)
vlan_intf_str = ','.join(vlan_intf_list)
dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format('/root/test/src/test/setup/dhcpd-tagged.conf','/root/test/src/test/setup/dhcpd-tagged.leases', vlan_intf_str)
print('Starting DHCPD server with command: %s' %dhcpd_cmd)
status = os.system(dhcpd_cmd)
if status > 255:
status = 1
else:
return False
time.sleep(3)
cls.relay_interfaces_last = cls.relay_interfaces
cls.relay_interfaces = intf_list
return True
@classmethod
def get_dhcpd_process(cls):
docker_cmd = 'docker exec cord-tester1'
cmd = '{} ps -eaf | grep dhcpd'.format(docker_cmd)
dhcpd_server_ip = get_controller()
server_user = 'ubuntu'
server_pass = 'ubuntu'
ssh_agent = SSHTestAgent(host = dhcpd_server_ip, user = server_user, password = server_user)
status, output = ssh_agent.run_cmd(cmd)
assert_equal(status, True)
if output:
cls.remote_dhcpd_cmd = re.findall('(?<=/)\w+.*', output)
log_test.info('DHCP server running on remote host and list of service commands are \n %s'%cls.remote_dhcpd_cmd)
assert_equal(status, True)
return cls.remote_dhcpd_cmd
def dhcpd_stop(self, remote_controller = False, dhcpd = None):
if remote_controller is not True:
if cls.service_running("/usr/sbin/dhcpd"):
cmd = 'pkill -9 dhcpd'
st, _ = getstatusoutput(cmd)
return True if st == 0 else False
else:
docker_cmd = 'docker exec cord-tester1'
dhcpd_server_ip = get_controller()
server_user = 'ubuntu'
server_pass = 'ubuntu'
service_satatus = True
ssh_agent = SSHTestAgent(host = dhcpd_server_ip, user = server_user, password = server_user)
if dhcpd == 'stop':
status, output = ssh_agent.run_cmd('{} pkill -9 dhcpd'.format(docker_cmd))
service_satatus = status and True
elif dhcpd == 'start':
for cmd in self.remote_dhcpd_cmd:
dhcpd_cmd = ' {0} /{1}'.format(docker_cmd,cmd)
status, output = ssh_agent.run_cmd(dhcpd_cmd)
service_satatus = status and True
elif dhcpd == 'restart':
status, output = ssh_agent.run_cmd('{} pkill -9 dhcpd'.format(docker_cmd))
service_satatus = status and True
for cmd in self.remote_dhcpd_cmd:
dhcpd_cmd = ' {0} /{1}'.format(docker_cmd,cmd)
status, output = ssh_agent.run_cmd(dhcpd_cmd)
service_satatus = status and True
return service_satatus
@classmethod
def dhcp_l2_relay_setup(cls):
device_details = OnosCtrl.get_devices(mfr = 'Nicira')
if device_details is not None:
did_ovs = device_details[0]['id']
else:
log_test.info('On this DHCPl2relay setup, onos does not have ovs device where external DHCP server is have connect point, so return with false status')
return False
cls.relay_device_id = did_ovs
cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
cls.port_map, _ = cls.olt.olt_port_map()
if cls.port_map:
##Per subscriber, we use 1 relay port
try:
relay_port = cls.port_map[cls.port_map['relay_ports'][0]]
except:
relay_port = cls.port_map['uplink']
cls.relay_interface_port = relay_port
cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
else:
cls.relay_interface_port = 100
cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
cls.relay_interfaces_last = cls.relay_interfaces
if cls.port_map:
##generate a ip/mac client virtual interface config for onos
interface_list = []
for port in cls.port_map['ports']:
port_num = cls.port_map[port]
if port_num == cls.port_map['uplink']:
continue
ip = cls.get_host_ip(port_num)
mac = cls.get_mac(port)
interface_list.append((port_num, ip, mac))
#configure dhcp server virtual interface on the same subnet as first client interface
relay_ip = cls.get_host_ip(interface_list[0][0])
relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
cls.onos_interface_load(interface_list)
@classmethod
def dhcp_l2_relay_cleanup(cls):
##reset the ONOS port configuration back to default
for config in cls.configs.items():
OnosCtrl.delete(config)
cls.onos_load_config(cls.default_onos_config)
# if cls.onos_restartable is True:
# log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
# return cord_test_onos_restart(config = {})
@classmethod
def onos_load_config(cls, config):
status, code = OnosCtrl.config(config)
if status is False:
log_test.info('JSON request returned status %d' %code)
assert_equal(status, True)
time.sleep(3)
@classmethod
def onos_delete_config(cls, config):
status, code = OnosCtrl.delete(config)
if status is False:
log_test.info('JSON request returned status %d' %code)
assert_equal(status, True)
time.sleep(3)
@classmethod
def onos_interface_load(cls, interface_list):
interface_dict = { 'ports': {} }
for port_num, ip, mac in interface_list:
port_map = interface_dict['ports']
port = '{}/{}'.format(cls.relay_device_id, port_num)
port_map[port] = { 'interfaces': [] }
interface_list = port_map[port]['interfaces']
interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
'mac' : mac,
'name': 'vir-{}'.format(port_num)
}
interface_list.append(interface_map)
cls.onos_load_config(interface_dict)
cls.configs['interface_config'] = interface_dict
@classmethod
def cord_l2_relay_load(cls, dhcp_server_connectPoint = None, delete = False):
##read the current config
current_netcfg = OnosCtrl.get_config()
connect_points = set([])
try:
connect_points = set(current_netcfg['apps']['org.opencord.dhcpl2relay']['dhcpl2relay']['dhcpServerConnectPoints'])
except KeyError, e:
pass
OnosCtrl.uninstall_app(cls.dhcpl2_app_file)
relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
#### We have to work on later versions by removing these hard coded values
if dhcp_server_connectPoint is None:
relay_device_present = filter(lambda cp: cp.split('/')[0] == cls.relay_device_id, connect_points)
if not relay_device_present:
connect_points.add(relay_device_map)
else:
cps_unused = map(lambda cp: connect_points.add(cp), dhcp_server_connectPoint)
connect_points = list(connect_points)
dhcp_dict = { "apps" : { "org.opencord.dhcpl2relay" : {"dhcpl2relay" :
{"dhcpServerConnectPoints": connect_points}
}
}
}
#OnosCtrl.uninstall_app(cls.dhcpl2_app_file)
OnosCtrl.install_app(cls.dhcpl2_app_file)
if delete == False:
cls.onos_load_config(dhcp_dict)
else:
cls.onos_delete_config(dhcp_dict)
cls.onos_load_config(cls.default_onos_config)
cls.configs['relay_config'] = dhcp_dict
@classmethod
def cord_sadis_load(cls, sadis_info = None):
relay_device_id = '{}'.format(cls.relay_device_id)
device_details = OnosCtrl.get_devices()
if device_details is not None:
for device in device_details:
## Assuming only one OVS is detected on ONOS and its for external DHCP server connect point...
if device['available'] is True and device['driver'] == 'voltha':
cls.olt_serial_id = "{}".format(device['serial'])
else:
cls.olt_serial_id = " "
else:
log_test.info('On this DHCPl2relay setup, onos does not have Tibit device where DHCP client is connected on UNI point, so return with false status')
return False
sadis_dict = { "apps": {
"org.opencord.sadis": {
"sadis": {
"integration": {
"cache": {
"enabled": "true",
"maxsize": 50,
"ttl": "PT1m"
}
},
"entries": [{
"id": "uni-254",
"cTag": 202,
"sTag": 222,
"nasPortId": "uni-254"
},
{
"id": cls.olt_serial_id,
"hardwareIdentifier": "00:0c:e2:31:05:00",
"ipAddress": "172.17.0.1",
"nasId": "B100-NASID"
}
]
}
}
}
}
#OnosCtrl.uninstall_app(cls.olt_app_file)
OnosCtrl.install_app(cls.olt_app_file)
time.sleep(5)
#OnosCtrl.uninstall_app(cls.sadis_app_file)
OnosCtrl.install_app(cls.sadis_app_file)
if sadis_info:
sadis_dict = sadis_info
cls.onos_load_config(sadis_dict)
cls.sadis_configs['relay_config'] = sadis_dict
def sadis_info_dict(self, subscriber_port_id =None, c_tag = None, s_tag = None, nas_port_id =None,olt_serial_id =None,olt_mac=None,olt_ip =None,olt_nas_id=None):
### Need to work on these hard coded values on later merges
if subscriber_port_id is None:
subscriber_port_id = "uni-254"
if c_tag is None:
c_tag = 202
if s_tag is None:
s_tag = 222
if nas_port_id is None:
nas_port_id = "uni-254"
if olt_serial_id is None:
olt_serial_id = self.olt_serial_id
if olt_mac is None:
olt_mac = "00:0c:e2:31:05:00"
if olt_ip is None:
olt_ip = "172.17.0.1"
if olt_nas_id is None:
olt_nas_id = "B100-NASID"
sadis_dict = { "apps": {
"org.opencord.sadis": {
"sadis": {
"integration": {
"cache": {
"enabled": "true",
"maxsize": 50,
"ttl": "PT1m"
}
},
"entries": [{
"id": subscriber_port_id,
"cTag": c_tag,
"sTag": s_tag,
"nasPortId": nas_port_id
},
{
"id": olt_serial_id,
"hardwareIdentifier": olt_mac,
"ipAddress": olt_ip,
"nasId": olt_nas_id
}
]
}
}
}
}
return sadis_dict
@classmethod
def get_host_ip(cls, port):
if cls.host_ip_map.has_key(port):
return cls.host_ip_map[port]
cls.host_ip_map[port] = '192.168.100.{}'.format(port)
return cls.host_ip_map[port]
@classmethod
def host_load(cls, iface):
'''Have ONOS discover the hosts for dhcp-relay responses'''
port = g_subscriber_port_map[iface]
host = '173.17.1.{}'.format(port)
cmds = ( 'ifconfig {} 0'.format(iface),
'ifconfig {0} {1}'.format(iface, host),
'arping -I {0} {1} -c 2'.format(iface, host),
'ifconfig {} 0'.format(iface), )
for c in cmds:
os.system(c)
@classmethod
def get_mac(cls, iface):
if cls.interface_to_mac_map.has_key(iface):
return cls.interface_to_mac_map[iface]
mac = get_mac(iface, pad = 0)
cls.interface_to_mac_map[iface] = mac
return mac
def dhcpl2relay_stats_calc(self, success_rate = False, only_discover = False, iface = 'veth0'):
self.ip_count = 0
self.failure_count = 0
self.start_time = 0
self.diff = 0
self.transaction_count = 0
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
self.start_time = time.time()
while self.diff <= 60:
if only_discover:
cip, sip, mac, _ = self.dhcp.only_discover(multiple = True)
log_test.info('Got dhcp client IP %s from server %s for mac %s' %
(cip, sip, mac))
else:
cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False)
if cip:
self.ip_count +=1
elif cip == None:
self.failure_count += 1
log_test.info('Failed to get ip')
if success_rate and self.ip_count > 0:
break
self.diff = round(time.time() - self.start_time, 0)
self.transaction_count = round((self.ip_count+self.failure_count)/self.diff, 2)
self.transactions += (self.ip_count+self.failure_count)
self.running_time += self.diff
self.total_success += self.ip_count
self.total_failure += self.failure_count
def send_recv(self, mac=None, update_seed = False, validate = True):
cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
if validate:
assert_not_equal(cip, None)
assert_not_equal(sip, None)
log_test.info('Got dhcp client IP %s from server %s for mac %s' %
(cip, sip, self.dhcp.get_mac(cip)[0]))
return cip,sip
def cliEnter(self, controller = None):
retries = 0
while retries < 30:
self.cli = OnosCliDriver(controller = controller, connect = True)
if self.cli.handle:
break
else:
retries += 1
time.sleep(2)
def cliExit(self):
self.cli.disconnect()
def verify_cluster_status(self,controller = None,onos_instances=ONOS_INSTANCES,verify=False):
tries = 0
try:
self.cliEnter(controller = controller)
while tries <= 10:
cluster_summary = json.loads(self.cli.summary(jsonFormat = True))
if cluster_summary:
log_test.info("cluster 'summary' command output is %s"%cluster_summary)
nodes = cluster_summary['nodes']
if verify:
if nodes == onos_instances:
self.cliExit()
return True
else:
tries += 1
time.sleep(1)
else:
if nodes >= onos_instances:
self.cliExit()
return True
else:
tries += 1
time.sleep(1)
else:
tries += 1
time.sleep(1)
self.cliExit()
return False
except:
raise Exception('Failed to get cluster members')
return False
def get_cluster_current_member_ips(self, controller = None, nodes_filter = None):
tries = 0
cluster_ips = []
try:
self.cliEnter(controller = controller)
while tries <= 10:
cluster_nodes = json.loads(self.cli.nodes(jsonFormat = True))
if cluster_nodes:
log_test.info("cluster 'nodes' output is %s"%cluster_nodes)
if nodes_filter:
cluster_nodes = nodes_filter(cluster_nodes)
cluster_ips = map(lambda c: c['id'], cluster_nodes)
self.cliExit()
cluster_ips.sort(lambda i1,i2: int(i1.split('.')[-1]) - int(i2.split('.')[-1]))
return cluster_ips
else:
tries += 1
self.cliExit()
return cluster_ips
except:
raise Exception('Failed to get cluster members')
return cluster_ips
def get_cluster_container_names_ips(self,controller=None):
onos_names_ips = {}
controllers = get_controllers()
i = 0
for controller in controllers:
if i == 0:
name = Onos.NAME
else:
name = '{}-{}'.format(Onos.NAME, i+1)
onos_names_ips[controller] = name
onos_names_ips[name] = controller
i += 1
return onos_names_ips
def get_cluster_current_master_standbys(self,controller=None,device_id=relay_device_id):
master = None
standbys = []
tries = 0
try:
cli = self.cliEnter(controller = controller)
while tries <= 10:
roles = json.loads(self.cli.roles(jsonFormat = True))
log_test.info("cluster 'roles' command output is %s"%roles)
if roles:
for device in roles:
log_test.info('Verifying device info in line %s'%device)
if device['id'] == device_id:
master = str(device['master'])
standbys = map(lambda d: str(d), device['standbys'])
log_test.info('Master and standbys for device %s are %s and %s'%(device_id, master, standbys))
self.cliExit()
return master, standbys
break
self.cliExit()
return master, standbys
else:
tries += 1
time.sleep(1)
self.cliExit()
return master,standbys
except:
raise Exception('Failed to get cluster members')
return master,standbys
def get_cluster_current_master_standbys_of_connected_devices(self,controller=None):
''' returns master and standbys of all the connected devices to ONOS cluster instance'''
device_dict = {}
tries = 0
try:
cli = self.cliEnter(controller = controller)
while tries <= 10:
device_dict = {}
roles = json.loads(self.cli.roles(jsonFormat = True))
log_test.info("cluster 'roles' command output is %s"%roles)
if roles:
for device in roles:
device_dict[str(device['id'])]= {'master':str(device['master']),'standbys':device['standbys']}
for i in range(len(device_dict[device['id']]['standbys'])):
device_dict[device['id']]['standbys'][i] = str(device_dict[device['id']]['standbys'][i])
log_test.info('master and standbys for device %s are %s and %s'%(device['id'],device_dict[device['id']]['master'],device_dict[device['id']]['standbys']))
self.cliExit()
return device_dict
else:
tries += 1
time.sleep(1)
self.cliExit()
return device_dict
except:
raise Exception('Failed to get cluster members')
return device_dict
def get_number_of_devices_of_master(self,controller=None):
'''returns master-device pairs, which master having what devices'''
master_count = {}
try:
cli = self.cliEnter(controller = controller)
masters = json.loads(self.cli.masters(jsonFormat = True))
if masters:
for master in masters:
master_count[str(master['id'])] = {'size':int(master['size']),'devices':master['devices']}
return master_count
else:
return master_count
except:
raise Exception('Failed to get cluster members')
return master_count
def change_master_current_cluster(self,new_master=None,device_id=relay_device_id,controller=None):
if new_master is None: return False
self.cliEnter(controller=controller)
cmd = 'device-role' + ' ' + device_id + ' ' + new_master + ' ' + 'master'
command = self.cli.command(cmd = cmd, jsonFormat = False)
self.cliExit()
time.sleep(60)
master, standbys = self.get_cluster_current_master_standbys(controller=controller,device_id=device_id)
assert_equal(master,new_master)
log_test.info('Cluster master changed to %s successfully'%new_master)
def withdraw_cluster_current_mastership(self,master_ip=None,device_id=relay_device_id,controller=None):
'''current master looses its mastership and hence new master will be elected'''
self.cliEnter(controller=controller)
cmd = 'device-role' + ' ' + device_id + ' ' + master_ip + ' ' + 'none'
command = self.cli.command(cmd = cmd, jsonFormat = False)
self.cliExit()
time.sleep(60)
new_master_ip, standbys = self.get_cluster_current_master_standbys(controller=controller,device_id=device_id)
assert_not_equal(new_master_ip,master_ip)
log_test.info('Device-role of device %s successfully changed to none for controller %s'%(device_id,master_ip))
log_test.info('Cluster new master is %s'%new_master_ip)
return True
def cluster_controller_restarts(self, graceful = False):
controllers = get_controllers()
ctlr_len = len(controllers)
if ctlr_len <= 1:
log_test.info('ONOS is not running in cluster mode. This test only works for cluster mode')
assert_greater(ctlr_len, 1)
#this call would verify the cluster for once
onos_map = self.get_cluster_container_names_ips()
def check_exception(iteration, controller = None):
adjacent_controller = None
adjacent_controllers = None
if controller:
adjacent_controllers = list(set(controllers) - set([controller]))
adjacent_controller = adjacent_controllers[0]
for node in controllers:
onosLog = OnosLog(host = node)
##check the logs for storage exception
_, output = onosLog.get_log(('ERROR', 'Exception',))
if output and output.find('StorageException$Timeout') >= 0:
log_test.info('\nStorage Exception Timeout found on node: %s\n' %node)
log_test.info('Dumping the ERROR and Exception logs for node: %s\n' %node)
log_test.info('\n' + '-' * 50 + '\n')
log_test.info('%s' %output)
log_test.info('\n' + '-' * 50 + '\n')
failed = self.verify_leaders(controllers)
if failed:
log_test.info('Leaders command failed on nodes: %s' %failed)
log_test.error('Test failed on ITERATION %d' %iteration)
CordLogger.archive_results(self._testMethodName,
controllers = controllers,
iteration = 'FAILED',
archive_partition = self.ARCHIVE_PARTITION)
assert_equal(len(failed), 0)
return controller
try:
ips = self.get_cluster_current_member_ips(controller = adjacent_controller)
log_test.info('ONOS cluster formed with controllers: %s' %ips)
st = True
except:
st = False
failed = self.verify_leaders(controllers)
if failed:
log_test.error('Test failed on ITERATION %d' %iteration)
CordLogger.archive_results(self._testMethodName,
controllers = controllers,
iteration = 'FAILED',
archive_partition = self.ARCHIVE_PARTITION)
assert_equal(len(failed), 0)
if st is False:
log_test.info('No storage exception and ONOS cluster was not formed successfully')
else:
controller = None
return controller
next_controller = None
tries = self.ITERATIONS
for num in range(tries):
index = num % ctlr_len
#index = random.randrange(0, ctlr_len)
controller_name = onos_map[controllers[index]] if next_controller is None else onos_map[next_controller]
controller = onos_map[controller_name]
log_test.info('ITERATION: %d. Restarting Controller %s' %(num + 1, controller_name))
try:
#enable debug log for the other controllers before restarting this controller
adjacent_controllers = list( set(controllers) - set([controller]) )
self.log_set(controllers = adjacent_controllers)
self.log_set(app = 'io.atomix', controllers = adjacent_controllers)
if graceful is True:
log_test.info('Gracefully shutting down controller: %s' %controller)
self.onos_shutdown(controller)
cord_test_onos_restart(node = controller, timeout = 0)
self.log_set(controllers = controller)
self.log_set(app = 'io.atomix', controllers = controller)
time.sleep(60)
except:
time.sleep(5)
continue
#first archive the test case logs for this run
CordLogger.archive_results(self._testMethodName,
controllers = controllers,
iteration = 'iteration_{}'.format(num+1),
archive_partition = self.ARCHIVE_PARTITION)
next_controller = check_exception(num, controller = controller)
def onos_shutdown(self, controller = None):
status = True
self.cliEnter(controller = controller)
try:
self.cli.shutdown(timeout = 10)
except:
log_test.info('Graceful shutdown of ONOS failed for controller: %s' %controller)
status = False
self.cliExit()
return status
def test_dhcpl2relay_initialize(self):
'''Configure the DHCP L2 relay app and start dhcpd'''
self.dhcpd_start()
def test_dhcpl2relay_with_one_request(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
self.send_recv(mac=mac)
def test_dhcpl2relay_app_install(self, iface = 'veth0'):
mac = self.get_mac(iface)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.dhcpl2relay'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
app_status = True
if app_status is not True:
log_test.info('%s app is not being installed'%app_name)
assert_equal(True, app_status)
def test_dhcpl2relay_sadis_app_install(self, iface = 'veth0'):
mac = self.get_mac(iface)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
app_status = True
if app_status is not True:
log_test.info('%s app is not being installed'%app_name)
assert_equal(True, app_status)
def test_dhcpl2relay_netcfg(self, iface = 'veth0'):
mac = self.get_mac(iface)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.dhcpl2relay'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
else:
log_test.info('The network configuration is shown = %s'%onos_netcfg['apps'][app_name])
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown'%app_name)
assert_equal(True, False)
def test_dhcpl2relay_sadis_netcfg(self, iface = 'veth0'):
mac = self.get_mac(iface)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
else:
log_test.info('The network configuration is shown = %s'%(onos_netcfg['apps'][app_name]))
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown'%app_name)
assert_equal(True, False)
def test_dhcpl2relay_with_array_of_connect_points_for_dhcp_server(self, iface = 'veth0'):
connect_point = self.default_onos_netcfg['apps']['org.opencord.dhcpl2relay']['dhcpl2relay']['dhcpServerConnectPoints']
log_test.info('Existing connect point of dhcp server is %s'%connect_point)
relay_device_map1 = '{}/{}'.format(self.relay_device_id, random.randrange(1,5, 1))
relay_device_map2 = '{}/{}'.format(self.relay_device_id, random.randrange(6,10, 1))
relay_device_map3 = '{}/{}'.format(self.relay_device_id, random.randrange(10,16, 1))
relay_device_map4 = '{}/{}'.format(self.relay_device_id, random.randrange(17,23, 1))
dhcp_server_array_connectPoints = [connect_point[0],relay_device_map1,relay_device_map2,relay_device_map3,relay_device_map4]
log_test.info('Added array of connect points of dhcp server is %s'%dhcp_server_array_connectPoints)
mac = self.get_mac(iface)
self.onos_load_config(self.default_onos_netcfg)
dhcp_dict = { "apps" : { "org.opencord.dhcpl2relay" : {"dhcpl2relay" :
{"dhcpServerConnectPoints": dhcp_server_array_connectPoints}
}
}
}
self.onos_load_config(dhcp_dict)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.dhcpl2relay'
for app in onos_netcfg['apps']:
if app == app_name and onos_netcfg['apps'][app] != {}:
log_test.info('%s app is being installed'%app)
log_test.info('The network configuration is shown %s'%onos_netcfg['apps'][app])
x = set(onos_netcfg['apps'][app_name]['dhcpl2relay']['dhcpServerConnectPoints']) & set(dhcp_server_array_connectPoints)
if len(x) == len(dhcp_server_array_connectPoints):
log_test.info('The loaded onos network configuration is = %s'%dhcp_server_array_connectPoints)
app_status = True
break
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown'%app_name)
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
self.send_recv(mac=mac)
def test_dhcpl2relay_with_subscriber_configured_with_ctag_stag_as_per_sadis(self, iface = 'veth0'):
mac = self.get_mac(iface)
c_tag = 600
invalid_sadis_info = self.sadis_info_dict(c_tag = 600,s_tag = 500)
self.cord_sadis_load(sadis_info = invalid_sadis_info)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
elif onos_netcfg['apps'][app_name]['sadis']['entries'][0]['cTag'] == c_tag:
log_test.info('The S Tag and C Tag info from network configuration are %s and %s respectively '%(onos_netcfg['apps'][app_name]['sadis']['entries'][0]['sTag'],onos_netcfg['apps'][app_name]['sadis']['entries'][0]['cTag']))
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown '%app_name)
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_app_activation_and_deactivation_multiple_times(self, iface = 'veth0'):
iterations = 15
for i in range(iterations):
self.onos_ctrl.deactivate()
time.sleep(3)
self.onos_ctrl.activate()
log_test.info('Dhcpl2relay app is activated and deactivated multiple times around %s, now sending DHCP discover'%iterations)
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
self.send_recv(mac=mac)
def test_dhcpl2relay_without_sadis_app(self, iface = 'veth0'):
mac = self.get_mac(iface)
OnosCtrl.uninstall_app(self.sadis_app_file)
OnosCtrl(self.sadis_app).deactivate()
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_delete_and_add_sadis_app(self, iface = 'veth0'):
mac = self.get_mac(iface)
log_test.info('Uninstall the sadis app from onos ,app version = %s '%self.sadis_app_file)
OnosCtrl.uninstall_app(self.sadis_app_file)
OnosCtrl(self.sadis_app).deactivate()
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
log_test.info('Installing the sadis app in onos again, app version = %s '%self.sadis_app_file)
OnosCtrl.install_app(self.sadis_app_file)
OnosCtrl(self.sadis_app).activate()
OnosCtrl(self.app).activate()
#self.onos_load_config(self.sadis_configs['relay_config'])
self.send_recv(mac=mac)
def test_dhcpl2relay_with_option_82(self, iface = 'veth0'):
pass
def test_dhcpl2relay_without_option_82(self, iface = 'veth0'):
pass
def test_dhcl2relay_for_option82_without_configuring_dhcpserver_to_accept_option82(self, iface = 'veth0'):
pass
def test_dhcpl2relay_with_different_uni_port_entry_sadis_config(self, iface = 'veth0'):
mac = self.get_mac(iface)
subscriber_port_id = "uni-200"
invalid_sadis_info = self.sadis_info_dict(subscriber_port_id = "uni-200")
self.cord_sadis_load(sadis_info = invalid_sadis_info)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
elif onos_netcfg['apps'][app_name]['sadis']['entries'][0]['id'] == subscriber_port_id:
log_test.info('The network configuration is shown = %s'%(onos_netcfg['apps'][app_name]['sadis']['entries'][0]['id']))
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown '%app_name)
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_with_different_ctag_options(self, iface = 'veth0'):
mac = self.get_mac(iface)
c_tag = 600
invalid_sadis_info = self.sadis_info_dict(c_tag = 600)
self.cord_sadis_load(sadis_info = invalid_sadis_info)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
elif onos_netcfg['apps'][app_name]['sadis']['entries'][0]['cTag'] == c_tag:
log_test.info('The C Tag info from network configuration is = %s'%(onos_netcfg['apps'][app_name]['sadis']['entries'][0]['cTag']))
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown '%app_name)
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_with_different_stag_options(self, iface = 'veth0'):
mac = self.get_mac(iface)
s_tag = 600
invalid_sadis_info = self.sadis_info_dict(s_tag = 600)
self.cord_sadis_load(sadis_info = invalid_sadis_info)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
elif onos_netcfg['apps'][app_name]['sadis']['entries'][0]['sTag'] == s_tag:
log_test.info('The S Tag info from the network configuration is = %s'%(onos_netcfg['apps'][app_name]['sadis']['entries'][0]['sTag']))
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown '%app_name)
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_without_nasportid_option_in_sadis(self, iface = 'veth0'):
mac = self.get_mac(iface)
invalid_sadis_info = self.sadis_info_dict(nas_port_id = " ")
self.cord_sadis_load(sadis_info = invalid_sadis_info)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
elif onos_netcfg['apps'][app_name]['sadis']['entries'][0]['nasPortId'] == " ":
log_test.info('The nasPortId info from network configuration is shown = %s'%(onos_netcfg['apps'][app_name]['sadis']['entries'][0]['nasPortId']))
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown '%app_name)
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_with_nasportid_different_from_id(self, iface = 'veth0'):
mac = self.get_mac(iface)
nas_port_id = "uni-509"
invalid_sadis_info = self.sadis_info_dict(nas_port_id = "uni-509")
self.cord_sadis_load(sadis_info = invalid_sadis_info)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
elif onos_netcfg['apps'][app_name]['sadis']['entries'][0]['nasPortId'] == nas_port_id:
log_test.info('The nasPortId info from network configuration is shown = %s'%(onos_netcfg['apps'][app_name]['sadis']['entries'][0]['nasPortId']))
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown '%app_name)
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_without_serial_id_of_olt(self, iface = 'veth0'):
mac = self.get_mac(iface)
invalid_sadis_info = self.sadis_info_dict(olt_serial_id = " ")
self.cord_sadis_load(sadis_info = invalid_sadis_info)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
elif onos_netcfg['apps'][app_name]['sadis']['entries'][1]['id'] == " ":
log_test.info('The serial Id info from network configuration is shown = %s'%(onos_netcfg['apps'][app_name]['sadis']['entries'][1]['id']))
app_status = True
if app_status is not True:
log_test.info('%s app is not installed or network configuration is not shown '%app_name)
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_with_wrong_serial_id_of_olt(self, iface = 'veth0'):
mac = self.get_mac(iface)
olt_serial_id = "07f20d06696041febf974ccdhdhhjh37"
invalid_sadis_info = self.sadis_info_dict(olt_serial_id = "07f20d06696041febf974ccdhdhhjh37")
self.cord_sadis_load(sadis_info = invalid_sadis_info)
onos_netcfg = OnosCtrl.get_config()
app_status = False
app_name = 'org.opencord.sadis'
for app in onos_netcfg['apps']:
if app == app_name:
log_test.info('%s app is being installed'%app)
if onos_netcfg['apps'][app_name] == {}:
log_test.info('The network configuration is not shown'%onos_netcfg['apps'][app_name])
elif onos_netcfg['apps'][app_name]['sadis']['entries'][1]['id'] == olt_serial_id:
log_test.info('The serial Id info from network configuration is shown = %s'%(onos_netcfg['apps'][app_name]['sadis']['entries'][1]['id']))
app_status = True
if app_status is not True:
assert_equal(True, False)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(cip,None)
def test_dhcpl2relay_for_one_request_with_invalid_source_mac_broadcast(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
assert_equal(cip,None)
log_test.info('Dhcp server rejected client discover with invalid source mac, as expected')
def test_dhcpl2relay_for_one_request_with_invalid_source_mac_multicast(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:01:98:05')
assert_equal(cip,None)
log_test.info('Dhcp server rejected client discover with invalid source mac, as expected')
def test_dhcpl2relay_for_one_request_with_invalid_source_mac_zero(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
assert_equal(cip,None)
log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
### We can't test this on single uni port setup, hence its not to test
@nottest
def test_dhcpl2relay_with_N_requests(self, iface = 'veth0',requests=10):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
ip_map = {}
for i in range(requests):
#mac = RandMAC()._fix()
#log_test.info('mac is %s'%mac)
cip, sip = self.send_recv(mac=mac, update_seed = True)
if ip_map.has_key(cip):
log_test.info('IP %s given out multiple times' %cip)
assert_equal(False, ip_map.has_key(cip))
ip_map[cip] = sip
time.sleep(1)
def test_dhcpl2relay_with_one_release(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
@nottest
def test_dhcpl2relay_with_Nreleases(self, iface = 'veth0'):
mac = None
self.dhcp = DHCPTest(seed_ip = '192.170.1.10', iface = iface)
ip_map = {}
for i in range(10):
cip, sip = self.send_recv(mac=mac, update_seed = True)
if ip_map.has_key(cip):
log_test.info('IP %s given out multiple times' %cip)
assert_equal(False, ip_map.has_key(cip))
ip_map[cip] = sip
for ip in ip_map.keys():
log_test.info('Releasing IP %s' %ip)
assert_equal(self.dhcp.release(ip), True)
ip_map2 = {}
log_test.info('Triggering DHCP discover again after release')
self.dhcp = DHCPTest(seed_ip = '192.170.1.10', iface = iface)
for i in range(len(ip_map.keys())):
cip, sip = self.send_recv(mac=mac, update_seed = True)
ip_map2[cip] = sip
log_test.info('Verifying released IPs were given back on rediscover')
if ip_map != ip_map2:
log_test.info('Map before release %s' %ip_map)
log_test.info('Map after release %s' %ip_map2)
assert_equal(ip_map, ip_map2)
@nottest
def test_dhcpl2relay_starvation(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
log_test.info('Verifying 1 ')
count = 0
while True:
#mac = RandMAC()._fix()
cip, sip = self.send_recv(mac=mac,update_seed = True,validate = False)
if cip is None:
break
else:
count += 1
assert_equal(count,91)
log_test.info('Verifying 2 ')
cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False)
assert_equal(cip, None)
assert_equal(sip, None)
def test_dhcpl2relay_with_same_client_and_multiple_discovers(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
(cip, sip, mac) )
assert_not_equal(cip, None)
log_test.info('Triggering DHCP discover again.')
new_cip, new_sip, new_mac, _ = self.dhcp.only_discover(mac=mac)
assert_equal(new_cip, cip)
log_test.info('got same ip to smae the client when sent discover again, as expected')
def test_dhcpl2relay_with_same_client_and_multiple_requests(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
log_test.info('Sending DHCP discover and DHCP request.')
cip, sip = self.send_recv(mac=mac)
mac = self.dhcp.get_mac(cip)[0]
log_test.info("Sending DHCP request again.")
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
log_test.info('got same ip to smae the client when sent request again, as expected')
def test_dhcpl2relay_with_clients_desired_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac,desired = True)
assert_equal(cip,self.dhcp.seed_ip)
log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
(cip, sip, mac) )
def test_dhcpl2relay_with_clients_desired_address_out_of_pool(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac,desired = True)
assert_not_equal(cip,None)
assert_not_equal(cip,self.dhcp.seed_ip)
log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
def test_dhcpl2relay_nak_packet(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip, None)
new_cip, new_sip = self.dhcp.only_request('20.20.20.31', mac)
assert_equal(new_cip, None)
log_test.info('server sent NAK packet when requested other IP than that server offered')
def test_dhcpl2relay_client_requests_with_specific_lease_time_in_discover_message(self, iface = 'veth0',lease_time=700):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.70', iface = iface)
self.dhcp.return_option = 'lease'
cip, sip, mac, lval = self.dhcp.only_discover(mac=mac,lease_time=True,lease_value=lease_time)
assert_equal(lval, lease_time)
log_test.info('dhcp server offered IP address with client requested lease time')
def test_dhcpl2relay_with_client_request_after_reboot(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip, None)
new_cip, new_sip = self.dhcp.only_request(cip, mac)
log_test.info('client rebooting...')
os.system('ifconfig '+iface+' down')
time.sleep(5)
os.system('ifconfig '+iface+' up')
new_cip2, new_sip = self.dhcp.only_request(cip, mac, cl_reboot = True)
assert_equal(new_cip2, cip)
log_test.info('client got same IP after reboot, as expected')
def test_dhcpl2relay_after_server_shutting_down(self, iface = 'veth0'):
self.get_dhcpd_process()
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip, None)
new_cip, new_sip = self.dhcp.only_request(cip, mac)
log_test.info('server rebooting...')
try:
if self.dhcpd_stop(remote_controller = True, dhcpd = 'stop'):
time.sleep(5)
log_test.info('DHCP server is stopped ')
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip,None)
else:
log_test.info('DHCP server is not stopped' )
assert_equal(new_cip,None)
finally:
self.dhcpd_stop(remote_controller = True, dhcpd = 'restart')
def test_dhcpl2relay_after_server_reboot(self, iface = 'veth0'):
self.get_dhcpd_process()
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip, None)
new_cip, new_sip = self.dhcp.only_request(cip, mac)
log_test.info('server rebooting...')
try:
if self.dhcpd_stop(remote_controller = True, dhcpd = 'restart'):
time.sleep(5)
log_test.info('DHCP server is rebooted')
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip,cip)
else:
log_test.info('DHCP server is not stopped' )
assert_equal(new_cip,None)
finally:
self.dhcpd_stop(remote_controller = True, dhcpd = 'restart')
def test_dhcpl2relay_after_server_stop_start(self, iface = 'veth0'):
self.get_dhcpd_process()
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip, None)
new_cip, new_sip = self.dhcp.only_request(cip, mac)
log_test.info('server rebooting...')
try:
if self.dhcpd_stop(remote_controller = True, dhcpd = 'stop'):
time.sleep(5)
log_test.info('DHCP server is stopped ')
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip,None)
else:
log_test.info('DHCP server is not stoppped' )
assert_equal(new_cip,None)
self.dhcpd_stop(remote_controller = True, dhcpd = 'start')
log_test.info('DHCP server is started ')
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
log_test.info('client got same IP after server rebooted, as expected')
finally:
self.dhcpd_stop(remote_controller = True, dhcpd = 'restart')
def test_dhcpl2relay_with_specific_lease_time_in_discover_and_without_in_request_packet(self, iface = 'veth0',lease_time=700):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
self.dhcp.return_option = 'lease'
log_test.info('Sending DHCP discover with lease time of 700')
cip, sip, mac, lval = self.dhcp.only_discover(mac=mac,lease_time = True, lease_value=lease_time)
assert_equal(lval,lease_time)
new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, lease_time = True)
assert_equal(new_cip,cip)
assert_not_equal(lval, lease_time) #Negative Test Case
log_test.info('client requested lease time in discover packer is not seen in server ACK packet as expected')
def test_dhcpl2relay_with_specific_lease_time_in_request_and_without_in_discover_packet(self, iface = 'veth0',lease_time=800):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, lease_time = True,lease_value=lease_time)
assert_equal(new_cip,cip)
assert_equal(lval, lease_time)
log_test.info('client requested lease time in request packet seen in servre replied ACK packet as expected')
@nottest
def test_dhcpl2relay_with_client_renew_time(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
log_test.info('waiting for renew time.. a= %s b= %s c= %s'%(new_cip,new_sip,lval))
time.sleep(lval)
latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
assert_equal(latest_cip, cip)
log_test.info('server renewed client IP when client sends request after renew time, as expected')
@nottest
def test_dhcpl2relay_with_client_rebind_time(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
log_test.info('waiting for rebind time..')
time.sleep(lval)
latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
assert_equal(latest_cip, cip)
log_test.info('server renewed client IP when client sends request after rebind time, as expected')
def test_dhcpl2relay_with_client_expected_subnet_mask(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
expected_subnet = '255.255.255.0'
self.dhcp.return_option = 'subnet'
cip, sip, mac, subnet_mask = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_equal(subnet_mask,expected_subnet)
log_test.info('subnet mask in server offer packet is same as configured subnet mask in dhcp server')
def test_dhcpl2relay_with_client_sending_dhcp_request_with_wrong_subnet_mask(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
self.dhcp.send_different_option = 'subnet'
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
log_test.info("Got DHCP Ack despite of specifying wrong Subnet Mask in DHCP Request.")
@nottest
def test_dhcpl2relay_with_client_expected_router_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
expected_router_address = '20.20.20.1'
self.dhcp.return_option = 'router'
cip, sip, mac, router_address_value = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_equal(expected_router_address, router_address_value)
log_test.info('router address in server offer packet is same as configured router address in dhcp server')
@nottest
def test_dhcpl2relay_with_client_sends_dhcp_request_with_wrong_router_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
self.dhcp.send_different_option = 'router'
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
log_test.info("Got DHCP Ack despite of specifying wrong Router Address in DHCP Request.")
def test_dhcpl2relay_with_client_expecting_broadcast_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
expected_broadcast_address = '192.168.1.255'
self.dhcp.return_option = 'broadcast_address'
cip, sip, mac, broadcast_address_value = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_equal(expected_broadcast_address, broadcast_address_value)
log_test.info('broadcast address in server offer packet is same as configured broadcast address in dhcp server')
def test_dhcpl2relay_by_client_sending_dhcp_request_with_wrong_broadcast_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
self.dhcp.send_different_option = 'broadcast_address'
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
log_test.info("Got DHCP Ack despite of specifying wrong Broadcast Address in DHCP Request.")
def test_dhcpl2relay_with_client_expecting_dns_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
expected_dns_address = '192.168.1.1'
self.dhcp.return_option = 'dns'
cip, sip, mac, dns_address_value = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_equal(expected_dns_address, dns_address_value)
log_test.info('dns address in server offer packet is same as configured dns address in dhcp server')
def test_dhcpl2relay_by_client_sending_request_with_wrong_dns_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
self.dhcp.send_different_option = 'dns'
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
log_test.info("Got DHCP Ack despite of specifying wrong DNS Address in DHCP Request.")
def test_dhcpl2relay_transactions_per_second(self, iface = 'veth0'):
for i in range(1,4):
self.dhcpl2relay_stats_calc()
log_test.info("Statistics for run %d",i)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of transactions No. of successes No. of failures Running Time ")
log_test.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of transactions per second in run %d:%f" %(i, self.transaction_count))
log_test.info("Final Statistics for total transactions")
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Total transactions Total No. of successes Total No. of failures Running Time ")
log_test.info(" %d %d %d %d" %(self.transactions,
self.total_success, self.total_failure, self.running_time))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Average no. of transactions per second: %d", round(self.transactions/self.running_time,0))
def test_dhcpl2relay_consecutive_successes_per_second(self, iface = 'veth0'):
for i in range(1,4):
self.dhcpl2relay_stats_calc(success_rate = True)
log_test.info("Statistics for run %d",i)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of consecutive successful transactions Running Time ")
log_test.info(" %d %d " %(self.ip_count, self.diff))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of successful transactions per second in run %d:%f" %(i, self.transaction_count))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Final Statistics for total successful transactions")
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Total transactions Total No. of consecutive successes Running Time ")
log_test.info(" %d %d %d " %(self.transactions,
self.total_success, self.running_time))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Average no. of consecutive successful transactions per second: %d", round(self.total_success/self.running_time,0))
log_test.info("----------------------------------------------------------------------------------")
def test_dhcpl2relay_with_max_clients_per_second(self, iface = 'veth0'):
for i in range(1,4):
self.dhcpl2relay_stats_calc(only_discover = True)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Statistics for run %d of sending only DHCP Discover",i)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of transactions No. of successes No. of failures Running Time ")
log_test.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of clients per second in run %d:%f "
%(i, self.transaction_count))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Final Statistics for total transactions of sending only DHCP Discover")
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Total transactions Total No. of successes Total No. of failures Running Time ")
log_test.info(" %d %d %d %d" %(self.transactions,
self.total_success, self.total_failure, self.running_time))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Average no. of clients per second: %d ",
round(self.transactions/self.running_time,0))
log_test.info("----------------------------------------------------------------------------------")
def test_dhcpl2relay_consecutive_successful_clients_per_second(self, iface = 'veth0'):
for i in range(1,4):
self.dhcpl2relay_stats_calc(success_rate = True, only_discover = True)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Statistics for run %d for sending only DHCP Discover",i)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of consecutive successful transactions Running Time ")
log_test.info(" %d %d " %(self.ip_count, self.diff))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of consecutive successful clients per second in run %d:%f" %(i, self.transaction_count))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Final Statistics for total successful transactions")
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Total transactions Total No. of consecutive successes Running Time ")
log_test.info(" %d %d %d " %(self.transactions,
self.total_success, self.running_time))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Average no. of consecutive successful clients per second: %d", round(self.total_success/self.running_time,0))
log_test.info("----------------------------------------------------------------------------------")
def test_dhcpl2relay_concurrent_transactions_per_second(self, iface = 'veth0'):
for key in (key for key in g_subscriber_port_map if key < 100):
self.host_load(g_subscriber_port_map[key])
def thread_fun(i):
mac = self.get_mac('veth{}'.format(i))
cip, sip = DHCPTest(iface = 'veth{}'.format(i)).discover(mac = mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
self.lock.acquire()
if cip:
self.ip_count += 1
elif cip is None:
self.failure_count += 1
self.lock.notify_all()
self.lock.release()
for i in range (1,4):
self.ip_count = 0
self.failure_count = 0
self.start_time = 0
self.diff = 0
self.transaction_count = 0
self.start_time = time.time()
while self.diff <= 60:
t = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(0, random.randrange(1,40,1), 1)})
t1 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(42, random.randrange(43,80,1), 1)})
t2 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(82, random.randrange(83,120,1), 1)})
t3 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(122, random.randrange(123,160,1), 1)})
t4 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(162, random.randrange(163,180,1), 1)})
t5 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(182, random.randrange(183,196,1), 1)})
t.start()
t1.start()
t2.start()
t3.start()
t4.start()
t5.start()
t.join()
t1.join()
t2.join()
t3.join()
t4.join()
t5.join()
self.diff = round(time.time() - self.start_time, 0)
self.transaction_count = round((self.ip_count+self.failure_count)/self.diff, 2)
self.transactions += (self.ip_count+self.failure_count)
self.running_time += self.diff
self.total_success += self.ip_count
self.total_failure += self.failure_count
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Statistics for run %d",i)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of transactions No. of successes No. of failures Running Time ")
log_test.info(" %d %d %d %d"
%(self.ip_count+self.failure_count,self.ip_count, self.failure_count, self.diff))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of transactions per second in run %d:%f" %(i, self.transaction_count))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Final Statistics for total transactions")
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Total transactions Total No. of successes Total No. of failures Running Time ")
log_test.info(" %d %d %d %d" %(self.transactions,
self.total_success, self.total_failure, self.running_time))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Average no. of transactions per second: %d", round(self.transactions/self.running_time,0))
log_test.info("----------------------------------------------------------------------------------")
@nottest
def test_dhcpl2relay_concurrent_consecutive_successes_per_second(self, iface = 'veth0'):
failure_dir = {}
for key in (key for key in g_subscriber_port_map if key != 100):
self.host_load(g_subscriber_port_map[key])
def thread_fun(i, j):
# log_test.info("Thread Name:%s",current_thread().name)
# failure_dir[current_thread().name] = True
while failure_dir.has_key(current_thread().name) is False:
mac = RandMAC()._fix()
cip, sip = DHCPTest(iface = 'veth{}'.format(i)).discover(mac = mac)
i += 2
log_test.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
self.lock.acquire()
if cip:
self.ip_count += 1
self.lock.notify_all()
self.lock.release()
elif cip is None:
self.failure_count += 1
failure_dir[current_thread().name] = True
self.lock.notify_all()
self.lock.release()
break
# self.lock.notify_all()
# self.lock.release()
for i in range (1,4):
failure_dir = {}
self.ip_count = 0
self.failure_count = 0
self.start_time = 0
self.diff = 0
self.transaction_count = 0
self.start_time = time.time()
while len(failure_dir) != 6:
t = threading.Thread(target = thread_fun, kwargs = {'i': 0, 'j': 2})
t1 = threading.Thread(target = thread_fun, kwargs = {'i': 0, 'j': 2})
t2 = threading.Thread(target = thread_fun, kwargs = {'i': 0, 'j': 2})
t3 = threading.Thread(target = thread_fun, kwargs = {'i': 0, 'j': 2})
t4 = threading.Thread(target = thread_fun, kwargs = {'i': 0, 'j': 2})
t5 = threading.Thread(target = thread_fun, kwargs = {'i': 0, 'j': 2})
t.start()
t1.start()
t2.start()
t3.start()
t4.start()
t5.start()
t.join()
t1.join()
t2.join()
t3.join()
t4.join()
t5.join()
self.diff = round(time.time() - self.start_time, 0)
self.transaction_count = round((self.ip_count)/self.diff, 2)
self.transactions += (self.ip_count+self.failure_count)
self.running_time += self.diff
self.total_success += self.ip_count
self.total_failure += self.failure_count
log_test.info("Statistics for run %d",i)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of consecutive successful transactions Running Time ")
log_test.info(" %d %d " %(self.ip_count, self.diff))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of successful transactions per second in run %d:%f" %(i, self.transaction_count))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Final Statistics for total successful transactions")
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Total transactions Total No. of consecutive successes Running Time ")
log_test.info(" %d %d %d " %(self.transactions,
self.total_success, self.running_time))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Average no. of consecutive successful transactions per second: %d", round(self.total_success/self.running_time,2))
log_test.info("----------------------------------------------------------------------------------")
@nottest
def test_dhcpl2relay_for_concurrent_clients_per_second(self, iface = 'veth0'):
for key in (key for key in g_subscriber_port_map if key < 100):
self.host_load(g_subscriber_port_map[key])
def thread_fun(i):
# mac = self.get_mac('veth{}'.format(i))
cip, sip, mac, _ = DHCPTest(iface = 'veth{}'.format(i)).only_discover(mac = RandMAC()._fix())
log_test.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
self.lock.acquire()
if cip:
self.ip_count += 1
elif cip is None:
self.failure_count += 1
self.lock.notify_all()
self.lock.release()
for i in range (1,4):
self.ip_count = 0
self.failure_count = 0
self.start_time = 0
self.diff = 0
self.transaction_count = 0
self.start_time = time.time()
while self.diff <= 60:
t = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(0, random.randrange(1,40,1), 1)})
t1 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(42, random.randrange(43,80,1), 1)})
t2 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(82, random.randrange(83,120,1), 1)})
t3 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(122, random.randrange(123,160,1), 1)})
t4 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(162, random.randrange(163,180,1), 1)})
t5 = threading.Thread(target = thread_fun, kwargs = {'i': random.randrange(182, random.randrange(183,196,1), 1)})
t.start()
t1.start()
t2.start()
t3.start()
t4.start()
t5.start()
t.join()
t1.join()
t2.join()
t3.join()
t4.join()
t5.join()
self.diff = round(time.time() - self.start_time, 0)
self.transaction_count = round((self.ip_count+self.failure_count)/self.diff, 2)
self.transactions += (self.ip_count+self.failure_count)
self.running_time += self.diff
self.total_success += self.ip_count
self.total_failure += self.failure_count
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Statistics for run %d of sending only DHCP Discover",i)
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of transactions No. of successes No. of failures Running Time ")
log_test.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("No. of clients per second in run %d:%f "
%(i, self.transaction_count))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Final Statistics for total transactions of sending only DHCP Discover")
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Total transactions Total No. of successes Total No. of failures Running Time ")
log_test.info(" %d %d %d %d" %(self.transactions,
self.total_success, self.total_failure, self.running_time))
log_test.info("----------------------------------------------------------------------------------")
log_test.info("Average no. of clients per second: %d ",
round(self.transactions/self.running_time,0))
log_test.info("----------------------------------------------------------------------------------")
@nottest
def test_dhcpl2relay_with_client_conflict(self, iface = 'veth0'):
mac = self.get_mac(iface)
self.host_load(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
log_test.info('Got dhcp client IP %s from server %s for mac %s.' %
(cip, sip, mac) )
self.dhcp1 = DHCPTest(seed_ip = cip, iface = iface)
new_cip, new_sip, new_mac, _ = self.dhcp1.only_discover(desired = True)
new_cip, new_sip = self.dhcp1.only_request(new_cip, new_mac)
log_test.info('Got dhcp client IP %s from server %s for mac %s.' %
(new_cip, new_sip, new_mac) )
log_test.info("IP %s alredy consumed by mac %s." % (new_cip, new_mac))
log_test.info("Now sending DHCP Request for old DHCP discover.")
new_cip, new_sip = self.dhcp.only_request(cip, mac)
if new_cip is None:
log_test.info('Got dhcp client IP %s from server %s for mac %s.Which is expected behavior.'
%(new_cip, new_sip, new_mac) )
elif new_cip:
log_test.info('Got dhcp client IP %s from server %s for mac %s.Which is not expected behavior as IP %s is already consumed.'
%(new_cip, new_sip, new_mac, new_cip) )
assert_equal(new_cip, None)
##### All cluster scenarios on dhcpl2relay has to validate on voltha-setup from client server.
@nottest
def test_dhcpl2relay_releasing_dhcp_ip_after_cluster_master_change(self, iface = 'veth0',onos_instances=ONOS_INSTANCES):
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_master_standbys(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Changing cluster current master from %s to %s'%(master, standbys[0]))
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=standbys[0])
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_releasing_dhcp_ip_after_cluster_master_withdraw_membership(self, iface = 'veth0',onos_instances=ONOS_INSTANCES):
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_member_ips(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Changing cluster current master from %s to %s'%(master, standbys[0]))
self.withdraw_cluster_current_mastership(device_id = self.relay_device_id,master_ip=master)
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_releasing_dhcp_ip_after_restart_cluster(self, iface = 'veth0',onos_instances=ONOS_INSTANCES):
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_master_standbys(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Restarting cluster whose master cluster= %s standby = %s'%(master, standbys))
self.cord_test_onos_restart()
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_releasing_dhcp_ip_after_cluster_master_down(self, iface = 'veth0',onos_instances=ONOS_INSTANCES):
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_master_standbys(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Restarting cluster whose master cluster= %s standby = %s'%(master, standbys))
cord_test_onos_shutdown(node = master)
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_releasing_dhcp_ip_after_cluster_standby_down(self, iface = 'veth0',onos_instances=ONOS_INSTANCES):
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_master_standbys(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Changing cluster current master from %s to %s'%(master, standbys[0]))
cord_test_onos_shutdown(node = standbys[0])
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_releasing_dhcp_ip_after_adding_two_members_to_cluster(self, iface = 'veth0',onos_instances=ONOS_INSTANCES):
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_master_standbys(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Changing cluster current master from %s to %s'%(master, standbys[0]))
cord_test_onos_shutdown(node = standbys[0])
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_releasing_dhcp_ip_after_restart_cluster_for_10_times(self, iface = 'veth0',onos_instances=ONOS_INSTANCES):
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_master_standbys(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Restarting cluster whose master cluster= %s standby = %s'%(master, standbys))
for i in range(10):
self.cord_test_onos_restart()
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_on_cluster_with_master_controller_only_restarts(self, iface = 'veth0'):
pass
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_master_standbys(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Restarting cluster whose master cluster= %s standby = %s'%(master, standbys))
self.cord_test_onos_restart(node = master)
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_on_cluster_with_standby_controller_only_restarts(self, iface = 'veth0'):
pass
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_master_standbys(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Restarting cluster whose master cluster= %s standby = %s'%(master, standbys))
self.cord_test_onos_restart(node = standbys[0])
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_by_removing_master_onos_instance(self, iface = 'veth0'):
pass
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_member_ips(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Changing cluster current master from %s to %s'%(master, standbys[0]))
self.withdraw_cluster_current_mastership(device_id = self.relay_device_id,master_ip=master)
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_by_removing_onos_instance_member(self, iface = 'veth0'):
pass
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_member_ips(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Changing cluster current master from %s to %s'%(master, standbys[0]))
self.withdraw_cluster_current_mastership(device_id = self.relay_device_id,master_ip=standbys[0])
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_by_toggle_master_onos_instance_membership(self, iface = 'veth0'):
pass
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_member_ips(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Changing cluster current master from %s to %s'%(master, standbys[0]))
self.withdraw_cluster_current_mastership(device_id = self.relay_device_id,master_ip=master)
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_by_toggle_standby_onos_instance_membership(self, iface = 'veth0'):
pass
status = self.verify_cluster_status(onos_instances=onos_instances)
assert_equal(status, True)
master,standbys = self.get_cluster_current_member_ips(device_id=self.relay_device_id)
assert_equal(len(standbys),(onos_instances-1))
mac = self.get_mac(iface)
self.cord_l2_relay_load
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip = self.send_recv(mac=mac)
log_test.info('Changing cluster current master from %s to %s'%(master, standbys[0]))
self.withdraw_cluster_current_mastership(device_id = self.relay_device_id,master_ip=master)
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
self.cord_l2_relay_load
log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcprelay.dhcp.release(cip), True)
try:
assert_equal(self.dhcp.release(cip), True)
log_test.info('Triggering DHCP discover again after release')
self.cord_l2_relay_load
cip2, sip2 = self.send_recv(mac=mac)
log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
finally:
self.change_master_current_cluster(device_id = self.relay_device_id,new_master=master)
@nottest
def test_dhcpl2relay_by_adding_onos_instance_member(self, iface = 'veth0'):
pass
| 48.35985
| 238
| 0.600196
| 14,869
| 116,112
| 4.458336
| 0.04923
| 0.035586
| 0.055256
| 0.012159
| 0.768128
| 0.732784
| 0.708497
| 0.679549
| 0.655202
| 0.63357
| 0
| 0.018734
| 0.263074
| 116,112
| 2,400
| 239
| 48.38
| 0.756001
| 0.03004
| 0
| 0.642241
| 0
| 0.003831
| 0.204406
| 0.039815
| 0.000958
| 0
| 0
| 0
| 0.079502
| 0
| null | null | 0.008142
| 0.010057
| null | null | 0.001437
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
8df435886e1e4f05252c9577209d66e279919c25
| 306
|
py
|
Python
|
mlbpool/data/leagueinfo.py
|
prcutler/mlbpool2
|
7e65d2470fd9da514a0d7bb7f9d30f12d33fff5d
|
[
"MIT"
] | 2
|
2018-01-10T02:33:39.000Z
|
2018-04-02T00:07:59.000Z
|
mlbpool/data/leagueinfo.py
|
prcutler/mlbpool2
|
7e65d2470fd9da514a0d7bb7f9d30f12d33fff5d
|
[
"MIT"
] | 114
|
2018-03-06T19:44:32.000Z
|
2020-03-11T19:06:19.000Z
|
mlbpool/data/leagueinfo.py
|
prcutler/mlbpool2
|
7e65d2470fd9da514a0d7bb7f9d30f12d33fff5d
|
[
"MIT"
] | 1
|
2019-06-04T17:23:51.000Z
|
2019-06-04T17:23:51.000Z
|
from mlbpool.data.modelbase import SqlAlchemyBase
import sqlalchemy
# Point values for each category
class LeagueInfo(SqlAlchemyBase):
__tablename__ = "LeagueInfo"
league_id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True, default=0)
league = sqlalchemy.Column(sqlalchemy.String(8))
| 30.6
| 82
| 0.79085
| 35
| 306
| 6.742857
| 0.742857
| 0.135593
| 0.220339
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007491
| 0.127451
| 306
| 9
| 83
| 34
| 0.876404
| 0.098039
| 0
| 0
| 0
| 0
| 0.036496
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
5c04feb04f8c5131c089dc669ff6caa949ec8b45
| 97
|
py
|
Python
|
python/python_threading_note.py
|
tszandy/notes
|
70dfa43252ade1efabfd39ee7c178250f06721e8
|
[
"MIT"
] | null | null | null |
python/python_threading_note.py
|
tszandy/notes
|
70dfa43252ade1efabfd39ee7c178250f06721e8
|
[
"MIT"
] | null | null | null |
python/python_threading_note.py
|
tszandy/notes
|
70dfa43252ade1efabfd39ee7c178250f06721e8
|
[
"MIT"
] | null | null | null |
# run in parallel with threading
import threading
# Synchronization Using Lock
threading.Lock()
| 16.166667
| 32
| 0.804124
| 12
| 97
| 6.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.14433
| 97
| 5
| 33
| 19.4
| 0.939759
| 0.587629
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
5c12796b23aefb2dcb795a08e990fb0a22d5614a
| 168
|
py
|
Python
|
exercise/ch03/step_function.py
|
HFTshoon/deep-learning-from-scratch
|
c7c85abb33fbb710f055daec6d2c31322401fa02
|
[
"MIT"
] | null | null | null |
exercise/ch03/step_function.py
|
HFTshoon/deep-learning-from-scratch
|
c7c85abb33fbb710f055daec6d2c31322401fa02
|
[
"MIT"
] | null | null | null |
exercise/ch03/step_function.py
|
HFTshoon/deep-learning-from-scratch
|
c7c85abb33fbb710f055daec6d2c31322401fa02
|
[
"MIT"
] | null | null | null |
"""
def step_function(x):
return 1 if x>0 else 0
"""
# 이경우 인수를 하나만 받을 수 있고 numpy에서 쓸 행렬은 불가능
import numpy as np
def step_function(x):
y=x>0
return y.astype(np.int)
| 15.272727
| 39
| 0.678571
| 37
| 168
| 3.027027
| 0.702703
| 0.125
| 0.267857
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.029851
| 0.202381
| 168
| 11
| 40
| 15.272727
| 0.80597
| 0.541667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
5c3c27c45206089a33b5547c3d896aed3c16e349
| 35
|
py
|
Python
|
카카오인턴하계/tempCodeRunnerFile.py
|
seunghwanly/CODING-TEST
|
a820da950c163d399594770199aa2e782d1fbbde
|
[
"MIT"
] | null | null | null |
카카오인턴하계/tempCodeRunnerFile.py
|
seunghwanly/CODING-TEST
|
a820da950c163d399594770199aa2e782d1fbbde
|
[
"MIT"
] | null | null | null |
카카오인턴하계/tempCodeRunnerFile.py
|
seunghwanly/CODING-TEST
|
a820da950c163d399594770199aa2e782d1fbbde
|
[
"MIT"
] | null | null | null |
and visited[nextY][nextX] == False
| 35
| 35
| 0.714286
| 5
| 35
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114286
| 35
| 1
| 35
| 35
| 0.806452
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
5c45cc86c6a4df9c721b20023b5bb3718226d860
| 335
|
py
|
Python
|
src/__init__.py
|
saurabh1e/flask-mongo-starter
|
8bceac18bddb0b4c6632940cb6a41220fa338a16
|
[
"MIT"
] | 1
|
2016-08-13T11:30:48.000Z
|
2016-08-13T11:30:48.000Z
|
src/__init__.py
|
saurabh1e/flask-mongo-starter
|
8bceac18bddb0b4c6632940cb6a41220fa338a16
|
[
"MIT"
] | null | null | null |
src/__init__.py
|
saurabh1e/flask-mongo-starter
|
8bceac18bddb0b4c6632940cb6a41220fa338a16
|
[
"MIT"
] | null | null | null |
from .utils.api import api, BaseResource, BaseResourceView
from .utils import create_app, elastic_store, mail, dc, BaseDocument, bp, limiter, redis
from .config import configs
from .user import views
from .utils.security import security
from .elasticsearch import apiv1
from .utils import admin
from .admin_panel import admin_manager
| 33.5
| 88
| 0.81791
| 47
| 335
| 5.744681
| 0.553191
| 0.133333
| 0.111111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003413
| 0.125373
| 335
| 9
| 89
| 37.222222
| 0.918089
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.