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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a2f2a145959a5b67c4a941d7de2a0c6623acd87d | 242 | py | Python | processing/espa_exception.py | djzelenak/espa-worker | c970a35036a9b54b4cc2b4a0c25d7f5f165bebb0 | [
"Unlicense"
] | null | null | null | processing/espa_exception.py | djzelenak/espa-worker | c970a35036a9b54b4cc2b4a0c25d7f5f165bebb0 | [
"Unlicense"
] | 1 | 2021-03-31T19:39:55.000Z | 2021-03-31T19:39:55.000Z | processing/espa_exception.py | djzelenak/espa-worker | c970a35036a9b54b4cc2b4a0c25d7f5f165bebb0 | [
"Unlicense"
] | null | null | null | """
Description: Provides ESPA specific exceptions to the processing code.
License: NASA Open Source Agreement 1.3
"""
class ESPAException(Exception):
"""Provides an ESPA specific exception specifically for ESPA processing"""
pass
| 22 | 78 | 0.756198 | 29 | 242 | 6.310345 | 0.793103 | 0.131148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009901 | 0.165289 | 242 | 10 | 79 | 24.2 | 0.89604 | 0.743802 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
0c20775d4871e0c7ba35d7fa3059f6c506829c3e | 233 | py | Python | output/models/nist_data/atomic/int_pkg/schema_instance/nistschema_sv_iv_atomic_int_pattern_3_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/nist_data/atomic/int_pkg/schema_instance/nistschema_sv_iv_atomic_int_pattern_3_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/nist_data/atomic/int_pkg/schema_instance/nistschema_sv_iv_atomic_int_pattern_3_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.nist_data.atomic.int_pkg.schema_instance.nistschema_sv_iv_atomic_int_pattern_3_xsd.nistschema_sv_iv_atomic_int_pattern_3 import NistschemaSvIvAtomicIntPattern3
__all__ = [
"NistschemaSvIvAtomicIntPattern3",
]
| 38.833333 | 178 | 0.88412 | 29 | 233 | 6.413793 | 0.655172 | 0.145161 | 0.150538 | 0.215054 | 0.333333 | 0.333333 | 0.333333 | 0 | 0 | 0 | 0 | 0.018265 | 0.060086 | 233 | 5 | 179 | 46.6 | 0.83105 | 0 | 0 | 0 | 0 | 0 | 0.133047 | 0.133047 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0c22c97e1cfc839f7f99d26031c19d686ddfddc7 | 151 | py | Python | Chapter 01/Chap01_Example1.133.py | Anancha/Programming-Techniques-using-Python | e80c329d2a27383909d358741a5cab03cb22fd8b | [
"MIT"
] | null | null | null | Chapter 01/Chap01_Example1.133.py | Anancha/Programming-Techniques-using-Python | e80c329d2a27383909d358741a5cab03cb22fd8b | [
"MIT"
] | null | null | null | Chapter 01/Chap01_Example1.133.py | Anancha/Programming-Techniques-using-Python | e80c329d2a27383909d358741a5cab03cb22fd8b | [
"MIT"
] | null | null | null | #list example for insertion order and the dupicates
l1 = []
print(type(l1))
l1.append(1)
l1.append(2)
l1.append(3)
l1.append(4)
l1.append(1)
print(l1)
| 15.1 | 51 | 0.715232 | 29 | 151 | 3.724138 | 0.551724 | 0.37037 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097744 | 0.119205 | 151 | 9 | 52 | 16.777778 | 0.714286 | 0.331126 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0c30a8c59a6f006b396b0a70e20239fcf93e8d9d | 403 | py | Python | prettytabletest.py | tachijuan/python | b4b9e9ce75b5e8426af9df41427fff659ff0cc60 | [
"MIT"
] | null | null | null | prettytabletest.py | tachijuan/python | b4b9e9ce75b5e8426af9df41427fff659ff0cc60 | [
"MIT"
] | null | null | null | prettytabletest.py | tachijuan/python | b4b9e9ce75b5e8426af9df41427fff659ff0cc60 | [
"MIT"
] | null | null | null | import prettytable
x = prettytable.PrettyTable(['Name','Parent','Child'])
x.add_row(['Juan','x',''])
x.add_row(['Michele','x',''])
x.add_row(['Jordan','','x'])
x.add_row(['Claire','','x'])
x.add_row(['Christopher','','x'])
x.align['Name']='l'
x.align['in']='c'
x.align['out']='c'
print x
x.add_column("Grandparent",['','','','',''])
print x
x.add_row(['Nona','','','x'])
print x.get_html_string()
| 18.318182 | 54 | 0.575682 | 63 | 403 | 3.539683 | 0.396825 | 0.125561 | 0.188341 | 0.179372 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066998 | 403 | 21 | 55 | 19.190476 | 0.593085 | 0 | 0 | 0.133333 | 0 | 0 | 0.203474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.066667 | null | null | 0.2 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0c58e8d0f6fffc499cfa6a5a291fe3515941aeaa | 862 | py | Python | weather/migrations/0001_initial.py | BianSuma/weather_prediction | ab4b9744fef5ceb8cfdf9d06439ae849c132736e | [
"Unlicense"
] | 1 | 2021-06-28T14:47:25.000Z | 2021-06-28T14:47:25.000Z | weather/migrations/0001_initial.py | BianSuma/weather_prediction | ab4b9744fef5ceb8cfdf9d06439ae849c132736e | [
"Unlicense"
] | null | null | null | weather/migrations/0001_initial.py | BianSuma/weather_prediction | ab4b9744fef5ceb8cfdf9d06439ae849c132736e | [
"Unlicense"
] | null | null | null | # Generated by Django 3.1 on 2020-09-22 19:57
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Weathers',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tanggal', models.DateField()),
('temp_maks', models.FloatField(max_length=5)),
('temp_min', models.FloatField(max_length=5)),
('temp_med', models.FloatField(max_length=5)),
('hum_rel', models.FloatField(max_length=5)),
('wind_speed', models.FloatField(max_length=5)),
('weather_summary', models.TextField(max_length=56)),
],
),
]
| 30.785714 | 114 | 0.567285 | 89 | 862 | 5.325843 | 0.595506 | 0.113924 | 0.200422 | 0.263713 | 0.291139 | 0.126582 | 0 | 0 | 0 | 0 | 0 | 0.034653 | 0.296984 | 862 | 27 | 115 | 31.925926 | 0.747525 | 0.049884 | 0 | 0 | 1 | 0 | 0.093023 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.05 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0c606ed1bfa2a22347abd9bde03bf6ce80684d5a | 616 | py | Python | telethon/tl/functions/test.py | yande-eghosa/Telegram-Click-Bot | d2905373b93475ea3b4562128f84a66aee0eb7a0 | [
"MIT"
] | 1 | 2020-11-22T20:30:27.000Z | 2020-11-22T20:30:27.000Z | telethon/tl/functions/test.py | yande-eghosa/Telegram-Click-Bot | d2905373b93475ea3b4562128f84a66aee0eb7a0 | [
"MIT"
] | null | null | null | telethon/tl/functions/test.py | yande-eghosa/Telegram-Click-Bot | d2905373b93475ea3b4562128f84a66aee0eb7a0 | [
"MIT"
] | null | null | null | """File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
from ...tl.tlobject import TLRequest
from typing import Optional, List, Union, TYPE_CHECKING
import os
import struct
from datetime import datetime
class DummyFunctionRequest(TLRequest):
CONSTRUCTOR_ID = 0x56137993
SUBCLASS_OF_ID = 0x53299ae6
def to_dict(self):
return {
'_': 'DummyFunctionRequest'
}
def __bytes__(self):
return b''.join((
b'\x93y\x13V',
))
@classmethod
def from_reader(cls, reader):
return cls()
| 22 | 72 | 0.659091 | 69 | 616 | 5.724638 | 0.652174 | 0.03038 | 0.070886 | 0.101266 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04329 | 0.25 | 616 | 27 | 73 | 22.814815 | 0.811688 | 0.107143 | 0 | 0 | 1 | 0 | 0.05709 | 0 | 0 | 0 | 0.036832 | 0 | 0 | 1 | 0.15 | false | 0 | 0.3 | 0.15 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a75baaf06d1126115819a22d1ec9781b8f407cbc | 288 | py | Python | lib/vdlib/scrappers/base.py | vadyur/script.module.vd-common | c88cde1d2838e5d33d1e446f3bcc9518b20f2fc0 | [
"MIT"
] | null | null | null | lib/vdlib/scrappers/base.py | vadyur/script.module.vd-common | c88cde1d2838e5d33d1e446f3bcc9518b20f2fc0 | [
"MIT"
] | null | null | null | lib/vdlib/scrappers/base.py | vadyur/script.module.vd-common | c88cde1d2838e5d33d1e446f3bcc9518b20f2fc0 | [
"MIT"
] | null | null | null | import re
def remove_script_tags(file):
pattern = re.compile(r'<script[\s\S]+?/script>')
subst = ""
return re.sub(pattern, subst, file)
def clean_html(page):
page = remove_script_tags(page)
return page.replace("</sc'+'ript>", "").replace('</bo"+"dy>', '').replace('</ht"+"ml>', '')
| 28.8 | 92 | 0.638889 | 42 | 288 | 4.261905 | 0.571429 | 0.134078 | 0.178771 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104167 | 288 | 9 | 93 | 32 | 0.693798 | 0 | 0 | 0 | 0 | 0 | 0.190972 | 0.079861 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0 | 0.625 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
a7891807c4769ba6b48161fb697c592fbf073334 | 401 | py | Python | integration_tests/gdk/components/test_integ_list.py | sorint-lab-us/aws-greengrass-gdk-cli | 7508c7f62dcee1638cfc895ea38f3842e0072f0e | [
"Apache-2.0"
] | null | null | null | integration_tests/gdk/components/test_integ_list.py | sorint-lab-us/aws-greengrass-gdk-cli | 7508c7f62dcee1638cfc895ea38f3842e0072f0e | [
"Apache-2.0"
] | null | null | null | integration_tests/gdk/components/test_integ_list.py | sorint-lab-us/aws-greengrass-gdk-cli | 7508c7f62dcee1638cfc895ea38f3842e0072f0e | [
"Apache-2.0"
] | null | null | null | import gdk.CLIParser as CLIParser
import gdk.common.exceptions.error_messages as error_messages
import gdk.common.parse_args_actions as parse_args_actions
import pytest
def test_list_run():
with pytest.raises(Exception) as e:
parse_args_actions.run_command(CLIParser.cli_parser.parse_args(["component", "list", "-d"]))
assert e.value.args[0] == error_messages.LIST_WITH_INVALID_ARGS
| 36.454545 | 100 | 0.793017 | 60 | 401 | 5.016667 | 0.483333 | 0.119601 | 0.159468 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002809 | 0.112219 | 401 | 10 | 101 | 40.1 | 0.842697 | 0 | 0 | 0 | 0 | 0 | 0.037406 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.125 | true | 0 | 0.5 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a78f39074a16aae09ece4115d463134319d70904 | 59 | py | Python | code/answer_2-1-43.py | KoyanagiHitoshi/AtCoder-Python-Introduction | 6d014e333a873f545b4d32d438e57cf428b10b96 | [
"MIT"
] | 1 | 2022-03-29T13:50:12.000Z | 2022-03-29T13:50:12.000Z | code/answer_2-1-43.py | KoyanagiHitoshi/AtCoder-Python-Introduction | 6d014e333a873f545b4d32d438e57cf428b10b96 | [
"MIT"
] | null | null | null | code/answer_2-1-43.py | KoyanagiHitoshi/AtCoder-Python-Introduction | 6d014e333a873f545b4d32d438e57cf428b10b96 | [
"MIT"
] | null | null | null | N = int(input())
print("White" if N % 2 == 0 else "Black")
| 19.666667 | 41 | 0.559322 | 11 | 59 | 3 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.20339 | 59 | 2 | 42 | 29.5 | 0.659574 | 0 | 0 | 0 | 0 | 0 | 0.169492 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
a799725f988a35d17ec1cd13ca97ad44e5c84b93 | 103 | py | Python | public/peppertalk/pepperhello.py | ka2le/pepperpages | e126d066ac14cf08c1ff1dc26384833678b57c75 | [
"Apache-2.0"
] | null | null | null | public/peppertalk/pepperhello.py | ka2le/pepperpages | e126d066ac14cf08c1ff1dc26384833678b57c75 | [
"Apache-2.0"
] | null | null | null | public/peppertalk/pepperhello.py | ka2le/pepperpages | e126d066ac14cf08c1ff1dc26384833678b57c75 | [
"Apache-2.0"
] | null | null | null | from naoqi import ALProxy
tts = ALProxy("ALTextToSpeech", "127.0.0.1", 53119)
tts.say("Hello, world!")
| 25.75 | 51 | 0.708738 | 16 | 103 | 4.5625 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119565 | 0.106796 | 103 | 3 | 52 | 34.333333 | 0.673913 | 0 | 0 | 0 | 0 | 0 | 0.349515 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a7abb34511acde07fe02f19aabe878ae27377784 | 153 | py | Python | dash_berkay/apps.py | efebuyuk/jd_intern_project | a8db7ddc8f434d6148b743f6c8c6b071f29e1a41 | [
"MIT"
] | 1 | 2021-06-28T07:20:03.000Z | 2021-06-28T07:20:03.000Z | dash_berkay/apps.py | efebuyuk/jd_intern_project | a8db7ddc8f434d6148b743f6c8c6b071f29e1a41 | [
"MIT"
] | null | null | null | dash_berkay/apps.py | efebuyuk/jd_intern_project | a8db7ddc8f434d6148b743f6c8c6b071f29e1a41 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class DashBerkayConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'dash_berkay'
| 21.857143 | 56 | 0.771242 | 18 | 153 | 6.388889 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143791 | 153 | 6 | 57 | 25.5 | 0.877863 | 0 | 0 | 0 | 0 | 0 | 0.261438 | 0.189542 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
a7af415d704753eccad26a3c2f5d47237ca45c3e | 143 | py | Python | output/models/sun_data/elem_decl/target_ns/target_ns00101m/target_ns00101m_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/sun_data/elem_decl/target_ns/target_ns00101m/target_ns00101m_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/sun_data/elem_decl/target_ns/target_ns00101m/target_ns00101m_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.sun_data.elem_decl.target_ns.target_ns00101m.target_ns00101m_xsd.target_ns00101m import Number
__all__ = [
"Number",
]
| 23.833333 | 113 | 0.811189 | 20 | 143 | 5.25 | 0.7 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116279 | 0.097902 | 143 | 5 | 114 | 28.6 | 0.697674 | 0 | 0 | 0 | 0 | 0 | 0.041958 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a7c5faae192afb3e9235579e235402e5cd7bd8cd | 1,825 | py | Python | chapter3/starbucks.py | rongpenl/design-patterns-python | cbe7e6da6ae94604abad256bd807af1642fee915 | [
"MIT"
] | 1 | 2020-09-21T14:33:55.000Z | 2020-09-21T14:33:55.000Z | chapter3/starbucks.py | rongpenl/design-patterns-python | cbe7e6da6ae94604abad256bd807af1642fee915 | [
"MIT"
] | null | null | null | chapter3/starbucks.py | rongpenl/design-patterns-python | cbe7e6da6ae94604abad256bd807af1642fee915 | [
"MIT"
] | null | null | null | # Decorator pattern
from abc import ABC, abstractclassmethod
class Beverage(ABC):
def __init__(self):
self.description = "Unknown Beverage"
def get_description(self) -> str:
return self.description
@abstractclassmethod
def cost(self) -> float:
pass
class CondimentDecorator(Beverage):
pass
class Espresso(Beverage):
def __init__(self):
self.description = "Espresso"
def cost(self) -> float:
return 1.99
class HomeBlend(Beverage):
def __init__(self):
self.description = "HomeBlend"
def cost(self) -> float:
return 0.89
class Mocha(CondimentDecorator):
def __init__(self, beverage: Beverage):
self.beverage = beverage
self._cost = 0.20
def get_description(self):
return self.beverage.get_description() + ", Mocha"
def cost(self):
return self.beverage.cost() + self._cost
class Soy(CondimentDecorator):
def __init__(self, beverage: Beverage):
self.beverage = beverage
self._cost = 0.15
def get_description(self):
return self.beverage.get_description() + ", Soy"
def cost(self):
return self.beverage.cost() + self._cost
class Whip(CondimentDecorator):
def __init__(self, beverage: Beverage):
self.beverage = beverage
self._cost = 0.10
def get_description(self):
return self.beverage.get_description() + ", Whip"
def cost(self):
return self.beverage.cost() + self._cost
if __name__ == "__main__":
beverage = Espresso()
beverage = Mocha(beverage)
beverage = Soy(beverage)
beverage = Whip(beverage)
print(beverage.get_description(), beverage.cost())
beverage = HomeBlend()
beverage = Whip(beverage)
print(beverage.get_description(), beverage.cost())
| 22.256098 | 58 | 0.649863 | 200 | 1,825 | 5.695 | 0.18 | 0.126427 | 0.057946 | 0.126427 | 0.676032 | 0.614574 | 0.554873 | 0.554873 | 0.554873 | 0.27568 | 0 | 0.01083 | 0.241096 | 1,825 | 81 | 59 | 22.530864 | 0.811552 | 0.009315 | 0 | 0.5 | 0 | 0 | 0.032669 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0.037037 | 0.018519 | 0.166667 | 0.611111 | 0.037037 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a7d7a6e0a3b4336c95fa7ee30a4efe22030ddc43 | 307 | py | Python | abhisek/Extract_year_ month_date_from_url.py | abhisek-technicise/Python-Training | 35d773b529bd6f3961787c9ddb54c4a1e8cc227a | [
"MIT"
] | 1 | 2017-09-20T18:28:19.000Z | 2017-09-20T18:28:19.000Z | abhisek/Extract_year_ month_date_from_url.py | backup1-technicise/Python-Training | 35d773b529bd6f3961787c9ddb54c4a1e8cc227a | [
"MIT"
] | 3 | 2017-06-16T07:01:57.000Z | 2017-06-16T07:31:05.000Z | abhisek/Extract_year_ month_date_from_url.py | backup1-technicise/Python-Training | 35d773b529bd6f3961787c9ddb54c4a1e8cc227a | [
"MIT"
] | null | null | null | '''
Write a Python program to extract year, month and date from a url.
'''
import re
url1= "https://www.washingtonpost.com/news/football-insider/wp/2016/09/02/odell-beckhams-fame-rests-on-one-stupid-" \
"little-ball-josh-norman-tells-author/"
List = re.findall(r'\d{4}/\d{2}/\d{2}', url1)
print List
| 30.7 | 117 | 0.700326 | 53 | 307 | 4.056604 | 0.867925 | 0.018605 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 0.110749 | 307 | 9 | 118 | 34.111111 | 0.739927 | 0 | 0 | 0 | 0 | 0.2 | 0.690987 | 0.158798 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 0.2 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
38fa354ce04a55c8de96ee0e51cf14254e2d69b6 | 70 | py | Python | cnn_visualization/backprop/__init__.py | nkennek/pytorch-cnn-visualizations | 54699710b1beae1edae4bc12e9403080191c40ed | [
"MIT"
] | null | null | null | cnn_visualization/backprop/__init__.py | nkennek/pytorch-cnn-visualizations | 54699710b1beae1edae4bc12e9403080191c40ed | [
"MIT"
] | null | null | null | cnn_visualization/backprop/__init__.py | nkennek/pytorch-cnn-visualizations | 54699710b1beae1edae4bc12e9403080191c40ed | [
"MIT"
] | null | null | null | from . import (
base,
guidedbp,
smoothgrad,
vanilla
)
| 10 | 15 | 0.557143 | 6 | 70 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | 70 | 6 | 16 | 11.666667 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ac0306cedf9a00d0ec455a032f7eb4eca84172ea | 1,412 | py | Python | src/model/model.py | filipfur/smoothsource | 5a63079b790bd95dbb892c5a5dfdbfbeba010db9 | [
"Apache-2.0"
] | null | null | null | src/model/model.py | filipfur/smoothsource | 5a63079b790bd95dbb892c5a5dfdbfbeba010db9 | [
"Apache-2.0"
] | null | null | null | src/model/model.py | filipfur/smoothsource | 5a63079b790bd95dbb892c5a5dfdbfbeba010db9 | [
"Apache-2.0"
] | null | null | null | class Model:
def __init__(self):
self._classes = {}
self._relations = {}
self._generalizations = {}
self._associationLinks = {}
def addClass(self, _class):
self._classes[_class.uid()] = _class
def classByUid(self, uid):
return self._classes[uid]
def addRelation(self, relation):
lClass = relation.leftAssociation()._class().relate(relation)
rClass = relation.rightAssociation()._class().relate(relation)
self._relations[relation.uid()] = relation
def addGeneralization(self, generalization):
self._generalizations[generalization.uid()] = generalization
def addAssociationLink(self, assoclink):
self._associationLinks[assoclink.uid()] = assoclink
def relationByUid(self, uid):
return self._relations[uid]
def classes(self):
return self._classes
def relations(self):
return self._relations
def generalizations(self):
return self._generalizations
def associationLinks(self):
return self._associationLinks
def superClassOf(self, _class):
superclass = None
for generalization in self._generalizations.values():
if generalization.subclass() == _class:
superclass = generalization.superclass()
break
return superclass | 30.042553 | 71 | 0.626771 | 123 | 1,412 | 6.98374 | 0.276423 | 0.069849 | 0.065192 | 0.039581 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.278329 | 1,412 | 47 | 72 | 30.042553 | 0.842983 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.342857 | false | 0 | 0 | 0.171429 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ac27beba0b452cfde7f473700b638e39077e01c6 | 2,575 | py | Python | TASSELpy/java/util/Set.py | er432/TASSELpy | 2273d2252786679e023d1279f0c717a29ddd6d35 | [
"BSD-3-Clause"
] | 1 | 2015-11-30T21:54:19.000Z | 2015-11-30T21:54:19.000Z | TASSELpy/java/util/Set.py | er432/TASSELpy | 2273d2252786679e023d1279f0c717a29ddd6d35 | [
"BSD-3-Clause"
] | null | null | null | TASSELpy/java/util/Set.py | er432/TASSELpy | 2273d2252786679e023d1279f0c717a29ddd6d35 | [
"BSD-3-Clause"
] | null | null | null | from TASSELpy.java.util.Collection import Collection
from TASSELpy.utils.Overloading import javaConstructorOverload
java_imports = {'Set':'java/util/Set'}
class Set(Collection):
"""
From docs.oracle.com:
public interface Set<E>
extends Collection<E>
A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction.
The Set interface places additional stipulations, beyond those inherited from the Collection interface, on the contracts of all constructors and on the contracts of the add, equals and hashCode methods. Declarations for other inherited methods are also included here for convenience. (The specifications accompanying these declarations have been tailored to the Set interface, but they do not contain any additional stipulations.)
The additional stipulation on constructors is, not surprisingly, that all constructors must create a set that contains no duplicate elements (as defined above).
Note: Great care must be exercised if mutable objects are used as set elements. The behavior of a set is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is an element in the set. A special case of this prohibition is that it is not permissible for a set to contain itself as an element.
Some set implementations have restrictions on the elements that they may contain. For example, some implementations prohibit null elements, and some have restrictions on the types of their elements. Attempting to add an ineligible element throws an unchecked exception, typically NullPointerException or ClassCastException. Attempting to query the presence of an ineligible element may throw an exception, or it may simply return false; some implementations will exhibit the former behavior and some will exhibit the latter. More generally, attempting an operation on an ineligible element whose completion would not result in the insertion of an ineligible element into the set may throw an exception or it may succeed, at the option of the implementation. Such exceptions are marked as "optional" in the specification for this interface.
This interface is a member of the Java Collections Framework.
"""
_java_name=java_imports['Set']
@javaConstructorOverload(java_imports['Set'])
def __init__(self, *args, **kwargs):
super(Set, self).__init__(*args, **kwargs)
| 91.964286 | 843 | 0.791845 | 380 | 2,575 | 5.331579 | 0.442105 | 0.011846 | 0.037512 | 0.036525 | 0.056269 | 0.025666 | 0.025666 | 0 | 0 | 0 | 0 | 0.001867 | 0.167767 | 2,575 | 27 | 844 | 95.37037 | 0.943537 | 0.838835 | 0 | 0 | 0 | 0 | 0.059946 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.625 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
ac29682dc81a1e2ce7a0a53b573644ba72ff0934 | 786 | py | Python | servo/data/amenia_inas.py | neverware-mirrors/hdctools | dd7f911bb9051e615af7fcb71d921bd481f934fb | [
"BSD-3-Clause"
] | null | null | null | servo/data/amenia_inas.py | neverware-mirrors/hdctools | dd7f911bb9051e615af7fcb71d921bd481f934fb | [
"BSD-3-Clause"
] | null | null | null | servo/data/amenia_inas.py | neverware-mirrors/hdctools | dd7f911bb9051e615af7fcb71d921bd481f934fb | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
inas = [('ina219', '0x40', 'pp1050_s', 1.05, 0.010, 'rem', True),
('ina219', '0x41', 'pp1800_a', 1.80, 0.010, 'rem', True),
('ina219', '0x42', 'pp1200_vddq', 1.20, 0.010, 'rem', True),
('ina219', '0x43', 'pp3300_a', 3.30, 0.010, 'rem', True),
('ina219', '0x44', 'ppvbat', 7.50, 0.010, 'rem', True),
('ina219', '0x47', 'ppvccgi', 1.00, 0.010, 'rem', True),
('ina219', '0x49', 'ppvnn', 1.00, 0.010, 'rem', True),
('ina219', '0x4a', 'pp1240_a', 1.24, 0.010, 'rem', True),
('ina219', '0x4b', 'pp5000_a', 5.00, 0.010, 'rem', True)]
| 60.461538 | 72 | 0.529262 | 117 | 786 | 3.504274 | 0.547009 | 0.087805 | 0.153659 | 0.241463 | 0.378049 | 0.097561 | 0.097561 | 0 | 0 | 0 | 0 | 0.239933 | 0.24173 | 786 | 12 | 73 | 65.5 | 0.447987 | 0.201018 | 0 | 0 | 0 | 0 | 0.298077 | 0 | 0 | 0 | 0.057692 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ac2b724dfa7ea1a72058026d3b39eaca4ac3d88a | 25 | py | Python | src/az/__init__.py | yaroslavNikolaev/A.R.M.O.R. | 443b50ad39b7ada7562db62c36824c7c4edb842b | [
"MIT"
] | 1 | 2020-03-29T20:53:28.000Z | 2020-03-29T20:53:28.000Z | src/az/__init__.py | yaroslavNikolaev/A.R.M.O.R. | 443b50ad39b7ada7562db62c36824c7c4edb842b | [
"MIT"
] | null | null | null | src/az/__init__.py | yaroslavNikolaev/A.R.M.O.R. | 443b50ad39b7ada7562db62c36824c7c4edb842b | [
"MIT"
] | null | null | null | __all__ = ['kubernetes']
| 12.5 | 24 | 0.68 | 2 | 25 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 25 | 1 | 25 | 25 | 0.590909 | 0 | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ac5c7d0704b4fe232e563b70f6857676ad830763 | 56 | py | Python | Programs/tupels.py | iamsanidhya/Python-Basic-Tutorial | c4d75496a0ab6ebbea80c772ee051ffb73761080 | [
"Apache-2.0"
] | 1 | 2020-09-06T14:49:12.000Z | 2020-09-06T14:49:12.000Z | Programs/tupels.py | iamsanidhya/Python-Basic-Tutorial | c4d75496a0ab6ebbea80c772ee051ffb73761080 | [
"Apache-2.0"
] | null | null | null | Programs/tupels.py | iamsanidhya/Python-Basic-Tutorial | c4d75496a0ab6ebbea80c772ee051ffb73761080 | [
"Apache-2.0"
] | null | null | null | coordinates = [(7,8),(6,7),(9,0)]
print(coordinates[2]) | 28 | 34 | 0.607143 | 10 | 56 | 3.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134615 | 0.071429 | 56 | 2 | 35 | 28 | 0.519231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
ac628d86d26f9c32a44463377492ac68d3a22698 | 7,157 | py | Python | cfnlp/mappings/iam.py | andrew-kline/aws-leastprivilege | 648862b8f3c782729ef010a0ee7494ae23e1ade0 | [
"MIT"
] | 60 | 2020-03-19T06:40:16.000Z | 2022-03-23T05:57:15.000Z | cfnlp/mappings/iam.py | andrew-kline/aws-leastprivilege | 648862b8f3c782729ef010a0ee7494ae23e1ade0 | [
"MIT"
] | 5 | 2020-09-28T11:53:54.000Z | 2022-01-19T10:45:58.000Z | cfnlp/mappings/iam.py | andrew-kline/aws-leastprivilege | 648862b8f3c782729ef010a0ee7494ae23e1ade0 | [
"MIT"
] | 8 | 2020-04-12T04:56:18.000Z | 2022-01-18T22:46:18.000Z | import json
import sys
class AWSIAMRolePermissions:
def get_permissions(self, resname, res):
rolename = self._get_property_or_default(res, "*", "RoleName")
permissionsboundary = self._get_property_or_default(res, None, "PermissionsBoundary")
description = self._get_property_or_default(res, None, "Description")
maxsessionduration = self._get_property_or_default(res, None, "MaxSessionDuration")
policies_len = self._get_property_array_length(res, None, "Policies")
managedpolicyarns = self._get_property_or_default(res, None, "ManagedPolicyArns")
tags_len = self._get_property_array_length(res, None, "Tags")
path = self._get_property_or_default(res, "/", "Path")
if path == "*":
path = "/"
condition = None
if permissionsboundary and permissionsboundary != "*":
condition = {
'StringEquals': {
'iam:PermissionsBoundary': permissionsboundary
}
}
self.permissions.add(
resname=resname,
lifecycle='Create',
actions=[
'iam:CreateRole'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
],
conditions=condition
)
if rolename != "*":
self.permissions.add(
resname=resname,
lifecycle='Create',
actions=[
'iam:GetRole'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
]
)
if managedpolicyarns:
condition = {
'StringEquals': {}
}
if permissionsboundary and permissionsboundary != "*":
condition['StringEquals']['iam:PermissionsBoundary'] = permissionsboundary
if managedpolicyarns != "*":
condition['StringEquals']['iam:PolicyARN'] = managedpolicyarns
if not condition['StringEquals']:
condition = None
self.permissions.add(
resname=resname,
lifecycle='Create',
actions=[
'iam:AttachRolePolicy'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
],
conditions=condition
)
self.permissions.add(
resname=resname,
lifecycle='Update',
actions=[
'iam:DetachRolePolicy'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
]
)
self.permissions.add(
resname=resname,
lifecycle='Delete',
actions=[
'iam:DetachRolePolicy'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
],
conditions=condition
)
if policies_len:
self.permissions.add(
resname=resname,
lifecycle='Create',
actions=[
'iam:GetRolePolicy'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
],
nonmandatory=True
)
condition = None
if permissionsboundary and permissionsboundary != "*":
condition = {
'StringEquals': {
'iam:PermissionsBoundary': permissionsboundary
}
}
self.permissions.add(
resname=resname,
lifecycle='Create',
actions=[
'iam:PutRolePolicy'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
],
conditions=condition
)
self.permissions.add(
resname=resname,
lifecycle='Delete',
actions=[
'iam:DeleteRolePolicy'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
],
conditions=condition
)
if tags_len:
self.permissions.add(
resname=resname,
lifecycle='Create',
actions=[
'iam:TagRole'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
],
nonmandatory=True
)
self.permissions.add(
resname=resname,
lifecycle='Update',
actions=[
'iam:UntagRole'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
],
nonmandatory=True
)
self.permissions.add(
resname=resname,
lifecycle='Update',
actions=[
'iam:UpdateAssumeRolePolicy'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
]
)
if description:
self.permissions.add(
resname=resname,
lifecycle='Update',
actions=[
'iam:UpdateRoleDescription'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
]
)
if maxsessionduration:
self.permissions.add(
resname=resname,
lifecycle='Update',
actions=[
'iam:UpdateRole'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
]
)
if permissionsboundary:
self.permissions.add( # TODO: Dangerous?
resname=resname,
lifecycle='Update',
actions=[
'iam:PutRolePermissionsBoundary'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
]
)
self.permissions.add(
resname=resname,
lifecycle='Delete',
actions=[
'iam:DeleteRole'
],
resources=[
'arn:aws:iam::{}:role{}{}'.format(self.accountid, path, rolename)
]
)
| 34.742718 | 93 | 0.43929 | 467 | 7,157 | 6.653105 | 0.137045 | 0.072417 | 0.086901 | 0.086901 | 0.780818 | 0.780818 | 0.750885 | 0.7084 | 0.685227 | 0.570969 | 0 | 0 | 0.450887 | 7,157 | 205 | 94 | 34.912195 | 0.790585 | 0.002236 | 0 | 0.673267 | 0 | 0 | 0.136434 | 0.071439 | 0 | 0 | 0 | 0.004878 | 0 | 1 | 0.004951 | false | 0 | 0.009901 | 0 | 0.019802 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ac63f136ba3bc9f4e965b4a58da923d524188f62 | 177 | py | Python | onebuild/help_command.py | AdeshAtole/1build | da89642e417c2004bda375f4a819dda4f9c6a203 | [
"MIT"
] | null | null | null | onebuild/help_command.py | AdeshAtole/1build | da89642e417c2004bda375f4a819dda4f9c6a203 | [
"MIT"
] | null | null | null | onebuild/help_command.py | AdeshAtole/1build | da89642e417c2004bda375f4a819dda4f9c6a203 | [
"MIT"
] | null | null | null | from onebuild.command import Command
class HelpCommand(Command):
def execute(self, arg_parser, arguments, build_file_name, command_name):
arg_parser.print_help()
| 22.125 | 76 | 0.762712 | 23 | 177 | 5.608696 | 0.73913 | 0.139535 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158192 | 177 | 7 | 77 | 25.285714 | 0.865772 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ac6ec57b5d00639a3c34af0d8105b4fc58d7217e | 1,147 | py | Python | api/models.py | MassDo/massdo-api | 6bd3d3435c6ebf1284b21b19730d830e09044a5f | [
"MIT"
] | null | null | null | api/models.py | MassDo/massdo-api | 6bd3d3435c6ebf1284b21b19730d830e09044a5f | [
"MIT"
] | null | null | null | api/models.py | MassDo/massdo-api | 6bd3d3435c6ebf1284b21b19730d830e09044a5f | [
"MIT"
] | null | null | null | from django.db import models
class Farmer(models.Model):
nom = models.CharField(max_length=50)
numero_siret = models.IntegerField() # 14 chiffres (9 siren + 5 NIC)
adresse = models.CharField(max_length=500)
def __str__(self):
return self.nom
class Product(models.Model):
nom = models.CharField(max_length=50)
unite = models.CharField(max_length=50)
codification_internationnale = models.CharField(max_length=50)
producteurs = models.ManyToManyField(Farmer)
def __str__(self):
return f'{self.nom} ({", ".join(p.nom for p in self.producteurs.all())})' # a optimiser avec prefetch_related
class Certificate(models.Model):
TYPE_CHOICES = [
('biologique', 'biologique'),
('sans ogm', 'sans ogm'),
('origine', 'origine'),
]
nom = models.CharField(max_length=50)
type = models.CharField(max_length=50, choices=TYPE_CHOICES) # biologique, sans ogm, origine
farmer_certifie = models.ForeignKey(Farmer, on_delete=models.CASCADE) # suppression de l'enregistrement certificat si le farmer associé est supprimé
def __str__(self):
return self.nom | 35.84375 | 152 | 0.6966 | 144 | 1,147 | 5.368056 | 0.465278 | 0.135834 | 0.163001 | 0.217335 | 0.301423 | 0.200517 | 0.103493 | 0.103493 | 0 | 0 | 0 | 0.020386 | 0.187446 | 1,147 | 32 | 153 | 35.84375 | 0.809013 | 0.148213 | 0 | 0.32 | 0 | 0.04 | 0.116136 | 0.025694 | 0 | 0 | 0 | 0 | 0 | 1 | 0.12 | false | 0 | 0.04 | 0.12 | 0.84 | 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 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ac71a13e063defdee8ea0c45517c48e762cea09f | 83 | py | Python | docs/src/development/logging/logging0.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 13 | 2021-01-21T12:43:10.000Z | 2022-03-23T11:11:59.000Z | docs/src/development/logging/logging0.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 259 | 2020-02-26T08:51:03.000Z | 2022-03-23T11:08:36.000Z | docs/src/development/logging/logging0.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 5 | 2019-12-02T16:19:22.000Z | 2021-11-22T20:33:34.000Z | from loguru import logger
from botx import Bot
bot = Bot()
logger.enable("botx")
| 11.857143 | 25 | 0.73494 | 13 | 83 | 4.692308 | 0.538462 | 0.196721 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168675 | 83 | 6 | 26 | 13.833333 | 0.884058 | 0 | 0 | 0 | 0 | 0 | 0.048193 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ac886954222bc2275f12da1a6fd1d935cc0d5971 | 7,162 | py | Python | censere/utils/random.py | nhi-vanye/mars-censere | 65678b7bc102e2adff2f78f8b3a13ba84cdf0a01 | [
"BSD-4-Clause"
] | null | null | null | censere/utils/random.py | nhi-vanye/mars-censere | 65678b7bc102e2adff2f78f8b3a13ba84cdf0a01 | [
"BSD-4-Clause"
] | null | null | null | censere/utils/random.py | nhi-vanye/mars-censere | 65678b7bc102e2adff2f78f8b3a13ba84cdf0a01 | [
"BSD-4-Clause"
] | null | null | null | ## Copyright (c) 2019 Richard Offer. All right reserved.
#
# see LICENSE.md for license details
#
## Wrapper around random routines to make it easier to re-implement
import logging
import numpy.random as NPRND
import censere.utils as UTILS
# Life table for the total population: United States, 2006
cdc_2006 = [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
]
# 4.696378 is the sum of all probablilities
#
cdc_2006_weights = [
0.006713 / 4.696378 ,
0.000444 / 4.696378,
0.000300 / 4.696378,
0.000216 / 4.696378,
0.000179 / 4.696378,
0.000168 / 4.696378,
0.000156 / 4.696378,
0.000143 / 4.696378,
0.000125 / 4.696378,
0.000103 / 4.696378,
0.000086 / 4.696378,
0.000088 / 4.696378,
0.000125 / 4.696378,
0.000206 / 4.696378,
0.000317 / 4.696378,
0.000438 / 4.696378,
0.000552 / 4.696378,
0.000657 / 4.696378,
0.000747 / 4.696378,
0.000825 / 4.696378,
0.000905 / 4.696378,
0.000983 / 4.696378,
0.001033 / 4.696378,
0.001049 / 4.696378,
0.001038 / 4.696378,
0.001019 / 4.696378,
0.001006 / 4.696378,
0.000998 / 4.696378,
0.001002 / 4.696378,
0.001018 / 4.696378,
0.001042 / 4.696378,
0.001072 / 4.696378,
0.001113 / 4.696378,
0.001156 / 4.696378,
0.001212 / 4.696378,
0.001276 / 4.696378,
0.001355 / 4.696378,
0.001456 / 4.696378,
0.001585 / 4.696378,
0.001739 / 4.696378,
0.001903 / 4.696378,
0.002077 / 4.696378,
0.002268 / 4.696378,
0.002479 / 4.696378,
0.002706 / 4.696378,
0.002943 / 4.696378,
0.003190 / 4.696378,
0.003453 / 4.696378,
0.003741 / 4.696378,
0.004057 / 4.696378,
0.004405 / 4.696378,
0.004778 / 4.696378,
0.005166 / 4.696378,
0.005554 / 4.696378,
0.005939 / 4.696378,
0.006335 / 4.696378,
0.006760 / 4.696378,
0.007234 / 4.696378,
0.007796 / 4.696378,
0.008470 / 4.696378,
0.009282 / 4.696378,
0.010204 / 4.696378,
0.011178 / 4.696378,
0.012118 / 4.696378,
0.013024 / 4.696378,
0.013999 / 4.696378,
0.014995 / 4.696378,
0.016161 / 4.696378,
0.017527 / 4.696378,
0.019109 / 4.696378,
0.020890 / 4.696378,
0.022925 / 4.696378,
0.025280 / 4.696378,
0.027972 / 4.696378,
0.030997 / 4.696378,
0.034386 / 4.696378,
0.038027 / 4.696378,
0.042036 / 4.696378,
0.046447 / 4.696378,
0.051297 / 4.696378,
0.056623 / 4.696378,
0.062465 / 4.696378,
0.068867 / 4.696378,
0.075871 / 4.696378,
0.083524 / 4.696378,
0.091872 / 4.696378,
0.100962 / 4.696378,
0.110842 / 4.696378,
0.121558 / 4.696378,
0.133155 / 4.696378,
0.145675 / 4.696378,
0.159156 / 4.696378,
0.173631 / 4.696378,
0.189127 / 4.696378,
0.205661 / 4.696378,
0.223242 / 4.696378,
0.241869 / 4.696378,
0.261527 / 4.696378,
0.282188 / 4.696378,
0.303810 / 4.696378,
1.0000 / 4.6963780
]
def seed( seed ):
return NPRND.seed( seed )
def set_state( st ):
return NPRND.set_state( st )
def get_state( ):
return NPRND.get_state( )
# return a string of random bytes
# We use this rather than UUID so that
# we can get the same IDs if the same seed is used
#
# uuid.uuid() uses the os.urandom() and can't be replayed.
#
def id():
return NPRND.bytes(16).hex()
def random():
return NPRND.random()
## return a random number between start and stop
#
# Return a random integer N such that a <= N < b.
#
def randrange( start, stop ):
return NPRND.randint( start, stop )
##
#
# Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1)
#
def randint( start, stop ):
if start == stop:
return start
return randrange( start, stop + 1 )
def gauss( mean, sigma):
return mean + ( NPRND.randn() * sigma )
def triangle( minimum, peak, maximum):
return NPRND.triangular( minimum, peak, maximum )
def choice( lst):
return NPRND.choice( lst )
def choices( lst, weights=None ):
return NPRND.choice( lst, None, p=[ (i/100.0) for i in weights ] )
def life_expectancy():
return NPRND.choice( cdc_2006, None, p=cdc_2006_weights )
##
# tables: prefix is only valid for life-expectancy values
#
# Difference between randint and randrange is that randint only returns int
# and handles the case where MIN == MAX, randrange will error in that case
# TODO
# * handle sexes life expectancy independently
#
def parse_random_value( key, default_value=None, key_in_earth_years=False ):
val = key.split(":")
value = default_value
if val[0] == "cdc":
value = life_expectancy()
elif val[0] == "triangular" or val[0] == "triangle" :
values = [ float(i) for i in val[1].split(",") ]
value = triangle( values[0], values[1], values[2] )
elif val[0] == "gauss":
values = [ float(i) for i in val[1].split(",") ]
value = gauss( values[0], values[1] ),
elif val[0] == "randint":
values = [ int(i) for i in val[1].split(",") ]
value = randint( values[0], values[1] )
elif val[0] == "randrange":
values = [float(i) for i in val[1].split(",") ]
value = randrange( values[0], values[1] )
elif val[0] == "half":
values = [ float(i) for i in val[1].split(",") ]
r = random()
if r < 0.5:
value = ( values[0] ) + ( values[1] * random() )
elif r < 0.75:
value = ( values[0] + ( values[1] ) ) + ( values[1] * random() )
elif r < 0.875:
value = ( values[0] + ( values[1] * 2 ) ) + ( values[1] * random() )
elif r < 0.925:
value = ( values[0] + ( values[1] * 3 ) ) + ( values[1] * random() )
elif r < 0.9625:
value = ( values[0] + ( values[1] * 4 ) ) + ( values[1] * random() )
elif r < 0.98125:
value = ( values[0] + ( values[1] * 5 ) ) + ( values[1] * random() )
elif r < 0.990625:
value = ( values[0] + ( values[1] * 6 ) ) + ( values[1] * random() )
elif r < 0.9953125:
value = ( values[0] + ( values[1] * 7 ) ) + ( values[1] * random() )
else:
value = ( values[0] + ( values[1] * 8 ) ) + ( values[1] * random() )
else:
logging.fatal( 'Invalid value %s', key )
if key_in_earth_years:
return UTILS.years_to_sols( value )
return value
| 19.568306 | 80 | 0.533371 | 1,043 | 7,162 | 3.639501 | 0.336529 | 0.186249 | 0.208641 | 0.047945 | 0.169389 | 0.120917 | 0.08588 | 0.056902 | 0.05137 | 0.044257 | 0 | 0.356221 | 0.318766 | 7,162 | 365 | 81 | 19.621918 | 0.421808 | 0.119101 | 0 | 0.028777 | 0 | 0 | 0.010842 | 0 | 0 | 0 | 0 | 0.00274 | 0 | 1 | 0.046763 | false | 0 | 0.010791 | 0.039568 | 0.111511 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3bafa2d205472f0b0471e1b9b4ae049dcd0e8cdb | 771 | py | Python | electricipy/src/electricipy/optics/optical_tube.py | obulka/pilectric | eadc51e36bceae5b4eb84d5b642e6899362fe49b | [
"Apache-2.0"
] | null | null | null | electricipy/src/electricipy/optics/optical_tube.py | obulka/pilectric | eadc51e36bceae5b4eb84d5b642e6899362fe49b | [
"Apache-2.0"
] | null | null | null | electricipy/src/electricipy/optics/optical_tube.py | obulka/pilectric | eadc51e36bceae5b4eb84d5b642e6899362fe49b | [
"Apache-2.0"
] | null | null | null | """
Copyright 2021 Owen Bulka
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from dataclasses import dataclass
@dataclass
class OpticalTube:
""" Class to repressent an optical tube eg. camera lens, telescope """
focal_length: float # millimeters
aperture: float # millimeters
| 32.125 | 74 | 0.773022 | 114 | 771 | 5.219298 | 0.710526 | 0.10084 | 0.043697 | 0.053782 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0125 | 0.169909 | 771 | 23 | 75 | 33.521739 | 0.917188 | 0.827497 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.8 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
3bb10eeab703bb0404fe52c72bfd604537a725e7 | 594 | py | Python | mdpage/feeds.py | dakrauth/markdown-page | 711888a9465602fa09927e73f509a4f5586cad29 | [
"MIT"
] | 1 | 2020-05-21T08:00:24.000Z | 2020-05-21T08:00:24.000Z | mdpage/feeds.py | dakrauth/django-markdown-page | 711888a9465602fa09927e73f509a4f5586cad29 | [
"MIT"
] | null | null | null | mdpage/feeds.py | dakrauth/django-markdown-page | 711888a9465602fa09927e73f509a4f5586cad29 | [
"MIT"
] | null | null | null | from django.contrib.syndication.feeds import Feed
from django.utils.feedgenerator import Atom1Feed
from .models import MarkdownPageArchive
class AtomMarkdownPageFeed(Feed):
feed_type = Atom1Feed
title = 'Markdown Page RSS'
description = 'Latest page changes'
subtitle = description
link = ''
def item_title(self, item):
return item.page.title
def item_pubdate(self, item):
return item.created
def item_link(self, item):
return item.page.get_absolute_url()
def items(self):
return MarkdownPageArchive.objects.all()[:25]
| 23.76 | 53 | 0.703704 | 70 | 594 | 5.885714 | 0.528571 | 0.050971 | 0.101942 | 0.131068 | 0.106796 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008565 | 0.213805 | 594 | 24 | 54 | 24.75 | 0.873662 | 0 | 0 | 0 | 0 | 0 | 0.060606 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.176471 | 0.235294 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
3bd6827f587cbb471cc1bfebdf4966a02f779872 | 463 | py | Python | drned-skeleton/src/test_incomplete.py | micnovak/drned-xmnr | af68d4ab1162b7cdcda61da6e825b61ba0069c66 | [
"Apache-2.0"
] | 7 | 2019-05-21T22:25:16.000Z | 2022-01-24T16:06:02.000Z | drned-skeleton/src/test_incomplete.py | micnovak/drned-xmnr | af68d4ab1162b7cdcda61da6e825b61ba0069c66 | [
"Apache-2.0"
] | 45 | 2018-10-16T14:35:40.000Z | 2022-03-24T16:11:25.000Z | drned-skeleton/src/test_incomplete.py | micnovak/drned-xmnr | af68d4ab1162b7cdcda61da6e825b61ba0069c66 | [
"Apache-2.0"
] | 6 | 2019-06-17T20:35:19.000Z | 2021-05-12T13:21:50.000Z | import drned
import pytest
import common.test_incomplete as common
config = {}
config["CMD_FOOBAR"] = (
[
# Prefix
],
[
# Avoid
],
[
# Test
]
)
@pytest.mark.parametrize("name", config)
def test_incomplete_single(device, name, iteration):
common.test_incomplete_single(device, config, name, iteration)
def test_incomplete_union(device, iteration):
common.test_incomplete_union(device, config, iteration)
| 18.52 | 66 | 0.669546 | 50 | 463 | 6 | 0.4 | 0.233333 | 0.2 | 0.173333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222462 | 463 | 24 | 67 | 19.291667 | 0.833333 | 0.036717 | 0 | 0.117647 | 0 | 0 | 0.031674 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0 | 0.176471 | 0 | 0.294118 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3bd9891efbedd6a59cd40abe7a6667ddca9bdd20 | 1,181 | py | Python | nodes/input_logx3dpro.py | WisconsinRobotics/wreadinput | 8d63d130dd2e6a8e440b9ca1cee571c01d4091ea | [
"MIT"
] | null | null | null | nodes/input_logx3dpro.py | WisconsinRobotics/wreadinput | 8d63d130dd2e6a8e440b9ca1cee571c01d4091ea | [
"MIT"
] | 1 | 2022-03-16T06:49:21.000Z | 2022-03-16T06:49:21.000Z | nodes/input_logx3dpro.py | WisconsinRobotics/wreadinput | 8d63d130dd2e6a8e440b9ca1cee571c01d4091ea | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from wreadinput import DeviceAxis, DeviceShape, DeviceKey, default_node
# TODO check to make sure these are what actually get mapped by evdev
SHAPE_LOGX3DPRO = DeviceShape()\
.with_axis(DeviceAxis.ABS_X, 'stick_x', deadband = 0.1)\
.with_axis(DeviceAxis.ABS_Y, 'stick_y', 1, -1, deadband = 0.1)\
.with_axis(DeviceAxis.ABS_RZ, 'stick_twist')\
.with_axis(DeviceAxis.ABS_THROTTLE, 'throttle', 0, 1)\
.with_axis(DeviceAxis.ABS_HAT0X, 'pov_x')\
.with_axis(DeviceAxis.ABS_HAT0Y, 'pov_y')\
.with_key(DeviceKey.BTN_TRIGGER, 'trigger')\
.with_key(DeviceKey.BTN_THUMB, 'thumb')\
.with_key(DeviceKey.BTN_THUMB2, '3')\
.with_key(DeviceKey.BTN_TOP, '4')\
.with_key(DeviceKey.BTN_TOP2, '5')\
.with_key(DeviceKey.BTN_PINKIE, '6')\
.with_key(DeviceKey.BTN_BASE, '7')\
.with_key(DeviceKey.BTN_BASE2, '8')\
.with_key(DeviceKey.BTN_BASE3, '9')\
.with_key(DeviceKey.BTN_BASE4, '10')\
.with_key(DeviceKey.BTN_BASE5, '11')\
.with_key(DeviceKey.BTN_BASE6, '12')
# see `wreadinput.default_node` for implementation details
if __name__ == '__main__':
default_node.main('input_logx3dpro', SHAPE_LOGX3DPRO)
| 40.724138 | 71 | 0.707875 | 168 | 1,181 | 4.64881 | 0.440476 | 0.107554 | 0.245839 | 0.291933 | 0.108835 | 0.108835 | 0.079385 | 0 | 0 | 0 | 0 | 0.033399 | 0.138019 | 1,181 | 28 | 72 | 42.178571 | 0.733792 | 0.123624 | 0 | 0 | 0 | 0 | 0.088178 | 0 | 0 | 0 | 0 | 0.035714 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.045455 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3bea62150fc2e8c2425a04150256af3e03fafc3c | 739 | py | Python | evaluate_models.py | Shiyang-Yan/Discrete-continous-PG-for-Retrieval | 39fd7a81f732ae043c2ea20352a0c55b72834639 | [
"Apache-2.0"
] | 8 | 2021-09-14T03:14:48.000Z | 2022-02-01T17:34:41.000Z | evaluate_models.py | Shiyang-Yan/Discrete-continous-PG-for-Retrieval | 39fd7a81f732ae043c2ea20352a0c55b72834639 | [
"Apache-2.0"
] | 4 | 2021-08-31T07:51:09.000Z | 2022-02-02T08:24:12.000Z | evaluate_models.py | Shiyang-Yan/Discrete-continous-PG-for-Retrieval | 39fd7a81f732ae043c2ea20352a0c55b72834639 | [
"Apache-2.0"
] | 2 | 2021-11-26T03:49:20.000Z | 2022-03-08T06:51:34.000Z | from vocab import Vocabulary
import visual_att_2
#visual_att_2.evalrank('runs/runX_coco_test/model_best.pth.tar', data_path='data/data/data', split="testall", fold5=False)
import torch
from vocab import Vocabulary
import evaluation_models
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
# for coco
print('Evaluation on COCO:')
evaluation_models.evalrank('runs/runX_f30_rebuttal2/model_best.pth.tar', "runs/runX_30k_post_rebuttal/model_best.pth.tar", data_path='data/data/data/', split="test", fold5=False)# for flickr
#print('Evaluation on Flickr30K:')
#evaluation_models.evalrank("runs/runX_f30_rebuttal2/model_best.pth.tar", "runs/runX_f30_rebuttal_glove/model_best.pth.tar", data_path='data/data/data/', split="test", fold5=False) | 56.846154 | 190 | 0.803789 | 117 | 739 | 4.820513 | 0.367521 | 0.085106 | 0.106383 | 0.132979 | 0.609929 | 0.5 | 0.5 | 0.5 | 0.5 | 0.5 | 0 | 0.024425 | 0.058187 | 739 | 13 | 191 | 56.846154 | 0.78592 | 0.477673 | 0 | 0.222222 | 0 | 0 | 0.39267 | 0.230366 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0.111111 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
ce13b9b9314edca450ae406e1f4e5c120b4fa949 | 583 | py | Python | Dart2/ProcessHelper.py | mcskik/Python | 4fe2100e4964f5d34d5b9f44184a06d8c9cf47e5 | [
"Apache-2.0"
] | null | null | null | Dart2/ProcessHelper.py | mcskik/Python | 4fe2100e4964f5d34d5b9f44184a06d8c9cf47e5 | [
"Apache-2.0"
] | null | null | null | Dart2/ProcessHelper.py | mcskik/Python | 4fe2100e4964f5d34d5b9f44184a06d8c9cf47e5 | [
"Apache-2.0"
] | null | null | null | import os
import subprocess
notepad = "C:\\WINDOWS\\SYSTEM32\\Notepad.exe"
def view(file_spec):
run1(notepad, file_spec)
def run1(program_spec, file_spec):
command = program_spec + " " + file_spec
os.system(command)
def run(program_spec, file_spec):
cmd = [program_spec, file_spec]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
def runAndCaptureOutput(program_spec, file_spec):
cmd = [program_spec, file_spec]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
process.wait()
for line in process.stdout:
print(line)
| 22.423077 | 59 | 0.71012 | 77 | 583 | 5.194805 | 0.363636 | 0.16 | 0.225 | 0.285 | 0.43 | 0.43 | 0.43 | 0.43 | 0.43 | 0.43 | 0 | 0.008333 | 0.176672 | 583 | 25 | 60 | 23.32 | 0.825 | 0 | 0 | 0.235294 | 0 | 0 | 0.060034 | 0.058319 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.117647 | 0 | 0.352941 | 0.058824 | 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 | 0 | 0 | 0 | 3 |
ce3959d335c31055b36df94109c137b27fbf30bb | 149 | py | Python | Python-codes-CeV/21-Mp3.py | engcristian/Python | 726a53e9499fd5d0594572298e59e318f98e2d36 | [
"MIT"
] | 1 | 2021-02-22T03:53:23.000Z | 2021-02-22T03:53:23.000Z | Python-codes-CeV/21-Mp3.py | engcristian/Python | 726a53e9499fd5d0594572298e59e318f98e2d36 | [
"MIT"
] | null | null | null | Python-codes-CeV/21-Mp3.py | engcristian/Python | 726a53e9499fd5d0594572298e59e318f98e2d36 | [
"MIT"
] | null | null | null | '''
Playing a mp3 using the mixer from pygame lib
'''
from pygame import mixer
mixer.init()
mixer.music.load("music.mp3")
mixer.music.play()
input()
| 16.555556 | 45 | 0.724832 | 24 | 149 | 4.5 | 0.625 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015385 | 0.127517 | 149 | 8 | 46 | 18.625 | 0.815385 | 0.302013 | 0 | 0 | 0 | 0 | 0.09375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cbe9b47f1e8c4468c27aa8ac616149ff63e5468d | 620 | py | Python | Problems/49.py | matejbolta/project-euler | 33a99de4c4d51d45f5168fb146e68ff46a1ad337 | [
"MIT"
] | null | null | null | Problems/49.py | matejbolta/project-euler | 33a99de4c4d51d45f5168fb146e68ff46a1ad337 | [
"MIT"
] | null | null | null | Problems/49.py | matejbolta/project-euler | 33a99de4c4d51d45f5168fb146e68ff46a1ad337 | [
"MIT"
] | null | null | null | '''
2969
6299
9629
'''
def prime(n):
if n <= 2:
return n == 2
elif n % 2 == 0:
return False
else: #vsa liha ostanejo
d = 3
while d ** 2 <= n:
if n % d == 0:
return False
d += 2
return True
for x in range(1000, 10000-2*3330):
if sorted(list(str(x))) == sorted(list(str(x + 3330))) == sorted(list(str(x + 2*3330))):
if prime(x):
if prime(x + 3330):
if prime(x + 2*3330):
print(f'{x}{x+3330}{x+2*3330}')
'''
148748178147
296962999629
'''
| 20 | 93 | 0.420968 | 84 | 620 | 3.107143 | 0.404762 | 0.076628 | 0.149425 | 0.16092 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.238764 | 0.425806 | 620 | 30 | 94 | 20.666667 | 0.494382 | 0.051613 | 0 | 0.111111 | 0 | 0 | 0.040619 | 0.040619 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0 | 0 | 0.277778 | 0.055556 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cbf13c83a3febd812f0c5b7dac33a580d8a55858 | 2,266 | py | Python | test.py | RuthFeng/BFS_Robot_movethrough_Maze | 3f8e08a60c8fbef17a0e423c48f7a558049d1b09 | [
"bzip2-1.0.6"
] | null | null | null | test.py | RuthFeng/BFS_Robot_movethrough_Maze | 3f8e08a60c8fbef17a0e423c48f7a558049d1b09 | [
"bzip2-1.0.6"
] | null | null | null | test.py | RuthFeng/BFS_Robot_movethrough_Maze | 3f8e08a60c8fbef17a0e423c48f7a558049d1b09 | [
"bzip2-1.0.6"
] | null | null | null | import unittest
class RobotControllortTestCase(unittest.TestCase):
"""Test for Robot Controller project"""
def test_cal_barriers(self):
self.assertEqual(number_of_barriers_row1, 7)
self.assertEqual(number_of_barriers_col3, 3)
def test_cal_loc_map(self):
self.assertEqual(loc_map["start"], (0, 8))
self.assertEqual(loc_map["destination"], (0, 0))
def test_is_move_valid(self):
self.assertEqual(is_move_valid(env_data, (0, 0), 'u'), False)
self.assertEqual(is_move_valid(env_data, (0, 0), 'l'), False)
self.assertEqual(is_move_valid(env_data, (4, 0), 'd'), False)
self.assertEqual(is_move_valid(env_data, (0, 8), 'r'), False)
self.assertEqual(is_move_valid(env_data, (0, 0), 'r'), False)
self.assertEqual(is_move_valid(env_data, (1, 0), 'd'), False)
self.assertEqual(is_move_valid(env_data, (1, 7), 'd'), True)
self.assertEqual(is_move_valid(env_data, (3, 5), 'r'), True)
self.assertEqual(is_move_valid(env_data, (1, 0), 'u'), True)
def test_is_move_valid_special(self):
self.assertEqual(is_move_valid_special((0, 0), 'u'), False)
self.assertEqual(is_move_valid_special((0, 0), 'l'), False)
self.assertEqual(is_move_valid_special((4, 0), 'd'), False)
self.assertEqual(is_move_valid_special((0, 8), 'r'), False)
self.assertEqual(is_move_valid_special((0, 0), 'r'), False)
self.assertEqual(is_move_valid_special((1, 0), 'd'), False)
self.assertEqual(is_move_valid_special((1, 7), 'd'), True)
self.assertEqual(is_move_valid_special((3, 5), 'r'), True)
self.assertEqual(is_move_valid_special((1, 0), 'u'), True)
def test_valid_actions(self):
self.assertEqual(valid_actions(env_data, (0, 8)), ['d'])
result_list = valid_actions(env_data, (1, 0))
self.assertTrue(['u', 'r'] == result_list or ['r', 'u'] == result_list)
def test_move_robot(self):
self.assertEqual(move_robot((1, 0), 'u'), (0, 0))
self.assertEqual(move_robot((0, 8), 'd'), (1, 8))
self.assertEqual(move_robot((3, 3), 'l'), (3, 2))
self.assertEqual(move_robot((1, 0), 'r'), (1, 1))
if __name__ == '__main__':
unittest.main()
| 36.548387 | 79 | 0.632392 | 331 | 2,266 | 4.036254 | 0.154079 | 0.303144 | 0.164671 | 0.282934 | 0.671407 | 0.603293 | 0.540419 | 0.52994 | 0.482784 | 0.11976 | 0 | 0.035049 | 0.194175 | 2,266 | 61 | 80 | 37.147541 | 0.696605 | 0.014563 | 0 | 0 | 0 | 0 | 0.022901 | 0 | 0 | 0 | 0 | 0 | 0.717949 | 1 | 0.153846 | false | 0 | 0.025641 | 0 | 0.205128 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0204a9ed5eb305de2dcc5eeae9d2338c32e3deca | 275 | py | Python | create_python_app/create_readme_file.py | xuchaoqian/create-python-app | 70745432b972b96a3faf95a378d54d922b77f2be | [
"MIT"
] | null | null | null | create_python_app/create_readme_file.py | xuchaoqian/create-python-app | 70745432b972b96a3faf95a378d54d922b77f2be | [
"MIT"
] | null | null | null | create_python_app/create_readme_file.py | xuchaoqian/create-python-app | 70745432b972b96a3faf95a378d54d922b77f2be | [
"MIT"
] | null | null | null | from create_python_app.path_utils import *
_file_name= "README.md"
def _get_file_content(app_name):
return f"""README for {app_name} app."""
def create_readme_file(base_dir, **kwargs):
create_file(base_dir, _file_name, content=_get_file_content(kwargs["app_name"])) | 34.375 | 84 | 0.770909 | 44 | 275 | 4.340909 | 0.454545 | 0.109948 | 0.146597 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101818 | 275 | 8 | 84 | 34.375 | 0.773279 | 0 | 0 | 0 | 0 | 0 | 0.155797 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0.166667 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
023c8768f70588ce90446c11083d5f698d41a80c | 6,219 | py | Python | src/toy/datasets.py | ychnlgy/Chebyshev-Lagrange | 74292e72b83f992d6c42a2f2db04dfdce5a52aea | [
"MIT"
] | 1 | 2021-08-19T14:28:45.000Z | 2021-08-19T14:28:45.000Z | src/toy/datasets.py | ychnlgy/Chebyshev-Lagrange | 74292e72b83f992d6c42a2f2db04dfdce5a52aea | [
"MIT"
] | null | null | null | src/toy/datasets.py | ychnlgy/Chebyshev-Lagrange | 74292e72b83f992d6c42a2f2db04dfdce5a52aea | [
"MIT"
] | 1 | 2022-03-11T07:20:06.000Z | 2022-03-11T07:20:06.000Z | import torch, math, random, time
VISUALIZE_POINTS = 100
CONSTANT_SLICE = 0.5
TRUE_MASK = None
def create_from_str(dataname, N, D, noise):
dataset = search(dataname)
return create_from_dataset(dataset, N, D, noise)
def create_from_dataset(dataset, N, D, noise):
torch.manual_seed(5)
T = dataset.get_num_true_features()
if D == 0:
D = T
assert D >= T
D_cols = shuffle_data_cols(D, T)
global TRUE_MASK
TRUE_MASK = [0] + D_cols
X_data = blank(N*2, D)
Y_data = dataset.calc_Y(X_data, D_cols)
X_view = visual(X_data, D_cols, VISUALIZE_POINTS)
Y_view = dataset.calc_Y(X_view, D_cols)
out = (
(
X_data[:N],
add_noise(Y_data[:N], noise)
),
(
X_data[N:],
Y_data[N:]
),
(
X_view,
Y_view
),
dataset.get_lr()
)
torch.manual_seed(time.time())
return out
def get_all():
return [
DatasetLinear(),
DatasetForce(),
DatasetGravity(),
DatasetKinematics(),
DatasetPendulum(),
DatasetArrhenius(),
DatasetSigmoid(),
DatasetBogo(),
DatasetMany(),
DatasetPReLU(),
DatasetAbs(),
DatasetSharp(),
DatasetStep()
]
def search(dataset):
datasets = get_all()
fmap = {d.get_nickname(): d for d in datasets}
if dataset not in fmap:
options = "\n\t".join(sorted([d.get_nickname() for d in datasets]))
raise SystemExit("Choose from the following datasets:\n\t%s\n" % options)
return fmap[dataset]
# === PRIVATE ===
def shuffle_data_cols(D, T):
D_cols = list(range(1, D))
random.shuffle(D_cols)
return D_cols[:T-1]
def visual(X, D_cols, n_points):
X_view = blank(n_points, X.size(-1))
for i in D_cols:
X_view[:,i] = CONSTANT_SLICE
X_view[:,0] = torch.linspace(-1, 1, n_points)
return X_view
def add_noise(M, noise):
return M + torch.zeros_like(M).normal_(mean=0, std=noise)
def blank(N, D):
return torch.rand(N, D)*2-1
class Dataset:
def get_nickname(self):
raise NotImplementedError
def get_num_true_features(self):
raise NotImplementedError
def calc_Y(self, X, D_cols):
return self.determine_output(X[:,0], *[X[:,i] for i in D_cols])
def determine_output(self, *args):
raise NotImplementedError
def get_equation(self):
return self.__doc__
def get_lr(self):
return 0.01
class DatasetMany(Dataset):
"Sum of 28 features."
def get_nickname(self):
return "many"
def get_num_true_features(self):
return 28
def determine_output(self, *args):
return sum(args)
class DatasetBogo(Dataset):
"f(X) = x*p | x < N or (x+N/2)*p*discount | x >= N"
def get_nickname(self):
return "bogo"
def get_num_true_features(self):
return 4
def determine_output(self, x, p, N, discount):
p = p * 4
N = N - 0.75
out = x*p
i = x>=N
out[i] = ((out-N/2)*discount*0.1)[i]
return out
class DatasetPReLU(Dataset):
"f(X) = a*0.1*X if x < 0 else b*X"
def get_nickname(self):
return "prelu"
def get_num_true_features(self):
return 3
def determine_output(self, x, a, b):
out = x*b
out[x < 0] = (x*a)[x < 0]*0.1
return out
class DatasetAbs(Dataset):
"f(X) = |X|"
def get_nickname(self):
return "abs"
def get_num_true_features(self):
return 1
def determine_output(self, x):
return x.abs()
class DatasetSharp(Dataset):
"f(X) = X * a if X > 0 else X*b - c"
def get_nickname(self):
return "sharp"
def get_num_true_features(self):
return 4
def determine_output(self, x, a, b, c):
out = x*a
out[x < 0] = (x*b-c)[x<0]
return out
class DatasetStep(Dataset):
"f(X) = -0.8 if X < -0.8, -0.4 elif X < -0.4, 0 elif X < 0.4, 0.4 elif X < 0.4, 1 else"
def get_nickname(self):
return "step"
def get_num_true_features(self):
return 1
def determine_output(self, x):
out = x.clone()
out[x < -0.8] = -0.8
out[(x >= -0.8) & (x < -0.4)] = -0.4
out[(x >= -0.4) & (x < 0.4)] = 0
out[(x >= 0.4) & (x < 0.8)] = 0.4
out[x >= 0.8] = 0.8
return out
class DatasetLinear(Dataset):
"f(x) = 2a + b - 0.1x"
def get_nickname(self):
return "linear"
def get_num_true_features(self):
return 3
def determine_output(self, x, a, b):
return 2*a + b -0.1*x
class DatasetSigmoid(Dataset):
"s(x) = c/(1+e^(-k(x-x0))) + y0"
def get_nickname(self):
return "sigmoid"
def get_num_true_features(self):
return 5
def determine_output(self, x, c, k, x0, y0):
return 2*c/(1+torch.exp(-k*10*(x-x0+0.5))) + y0 - 0.5
class DatasetGravity(Dataset):
"G(r) = G*m1*m2/r^2"
def get_nickname(self):
return "gravity"
def get_num_true_features(self):
return 4
def determine_output(self, r, G, m1, m2):
EPS = 0.2
return G*m1*m2/(r**2+EPS)
class DatasetForce(Dataset):
"F(m) = m*a"
def get_nickname(self):
return "force"
def get_num_true_features(self):
return 2
def determine_output(self, m, a):
return m*a
class DatasetKinematics(Dataset):
"d(t) = t*v0 + 0.5*a*t^2"
def get_nickname(self):
return "kinematics"
def get_num_true_features(self):
return 3
def determine_output(self, t, v, a):
return t*v + 0.5*a*t**2
class DatasetPendulum(Dataset):
"f(t) = -g/l*sin(PI*t)"
def get_nickname(self):
return "pendulum"
def get_num_true_features(self):
return 3
def determine_output(self, t, g, l_inv):
return -g*l_inv*torch.sin(math.pi*2*t)
class DatasetArrhenius(Dataset):
"k(T) = A*e^(-Ea*T/R)"
def get_nickname(self):
return "arrhenius"
def get_num_true_features(self):
return 3
def determine_output(self, T, A, Ea):
return A*torch.exp(-Ea*T)/4.0
| 21.153061 | 91 | 0.565043 | 937 | 6,219 | 3.595518 | 0.160085 | 0.055209 | 0.044524 | 0.080142 | 0.377857 | 0.262689 | 0.210745 | 0.164144 | 0.164144 | 0.164144 | 0 | 0.031608 | 0.297958 | 6,219 | 293 | 92 | 21.225256 | 0.740037 | 0.064319 | 0 | 0.2657 | 0 | 0.009662 | 0.079813 | 0 | 0 | 0 | 0 | 0 | 0.004831 | 1 | 0.256039 | false | 0 | 0.004831 | 0.193237 | 0.570048 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
023ca1456be6a4b1d310a0cb01ed9981899dbf3b | 545 | py | Python | rpy/cli/commands/create_password.py | riccardodivirgilio/rpy | 95682fbd25b55a6ea8db36d9ebfb54ce64380bc1 | [
"MIT"
] | null | null | null | rpy/cli/commands/create_password.py | riccardodivirgilio/rpy | 95682fbd25b55a6ea8db36d9ebfb54ce64380bc1 | [
"MIT"
] | null | null | null | rpy/cli/commands/create_password.py | riccardodivirgilio/rpy | 95682fbd25b55a6ea8db36d9ebfb54ce64380bc1 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from rpy.cli.utils import SimpleCommand
from rpy.functions.api import fernet
from rpy.functions.encoding import force_text
class Command(SimpleCommand):
dependencies = (('cryptography', None), )
def handle(self,
name=None,
new_password=None,
default_password=None,
default_location=None,
**opts):
self.print(force_text(fernet.Fernet.generate_key()))
| 24.772727 | 72 | 0.655046 | 60 | 545 | 5.733333 | 0.616667 | 0.061047 | 0.093023 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002445 | 0.249541 | 545 | 21 | 73 | 25.952381 | 0.838631 | 0.038532 | 0 | 0 | 0 | 0 | 0.022989 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0.153846 | 0.307692 | 0 | 0.538462 | 0.153846 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
0242548e2ed92a9d50d1f4036bc00d865eb1db35 | 387 | py | Python | utils.py | cs481-ekh/s21-team-ion | 7b6e6d4301e210899f8013a5893ce714e41ba9f6 | [
"MIT"
] | 1 | 2021-03-10T00:30:14.000Z | 2021-03-10T00:30:14.000Z | utils.py | cs481-ekh/s21-team-ion | 7b6e6d4301e210899f8013a5893ce714e41ba9f6 | [
"MIT"
] | 35 | 2021-02-23T18:05:04.000Z | 2021-04-24T19:28:04.000Z | utils.py | cs481-ekh/s21-team-ion | 7b6e6d4301e210899f8013a5893ce714e41ba9f6 | [
"MIT"
] | null | null | null | from tkinter import filedialog
class Callbacks:
__file_str = None
def __init__(self):
pass
def browse_files(self):
self.__file_str = filedialog.askopenfilename(initialdir="~", title="Select a File",
filetypes=(("CSV files", "*.csv"), ("All files", "*.*")))
def get_file(self):
return self.__file_str
| 24.1875 | 99 | 0.571059 | 41 | 387 | 5.02439 | 0.609756 | 0.101942 | 0.106796 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.302326 | 387 | 15 | 100 | 25.8 | 0.762963 | 0 | 0 | 0 | 0 | 0 | 0.103359 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0.1 | 0.1 | 0.1 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
0251accf8d6f541bf40558b54d03015f3f5e3473 | 7,673 | py | Python | hw/code/search/test_berlitz.py | skrilladeville/msds692 | 1690846e7299819cd5b1b24a56968bf1074e16bf | [
"MIT"
] | 87 | 2018-08-10T23:27:24.000Z | 2022-03-29T05:07:45.000Z | hw/code/search/test_berlitz.py | skrilladeville/msds692 | 1690846e7299819cd5b1b24a56968bf1074e16bf | [
"MIT"
] | 1 | 2019-10-06T15:45:03.000Z | 2019-10-06T15:45:03.000Z | hw/code/search/test_berlitz.py | skrilladeville/msds692 | 1690846e7299819cd5b1b24a56968bf1074e16bf | [
"MIT"
] | 171 | 2018-08-20T23:59:43.000Z | 2022-03-31T16:21:52.000Z | import sys
from linear_search import linear_search
from index_search import index_search, create_index
from myhtable_search import myhtable_index_search, myhtable_create_index
from words import filelist, words, filenames
"""
Run with
$ python -m pytest -v test_berlitz.py berlitz1rootdir
...
test_berlitz.py::test_linear_berlitz_none PASSED
test_berlitz.py::test_index_berlitz_none PASSED
test_berlitz.py::test_myhtable_berlitz_none PASSED
test_berlitz.py::test_linear_berlitz PASSED
test_berlitz.py::test_index_berlitz PASSED
test_berlitz.py::test_myhtable_berlitz PASSED
...
$
"""
rootdir = sys.argv[len(sys.argv) - 1]
print("testing with dir", rootdir)
def test_linear_berlitz_none():
terms = "missspellinnng"
files = filelist(rootdir)
terms = words(terms)
linear_docs = linear_search(files, terms)
expected = []
assert filenames(linear_docs) == expected
def test_index_berlitz_none():
terms = "missspellinnng"
files = filelist(rootdir)
terms = words(terms)
index = create_index(files)
index_docs = index_search(files, index, terms)
expected = []
assert filenames(index_docs) == expected
def test_myhtable_berlitz_none():
terms = "missspellinnng"
files = filelist(rootdir)
terms = words(terms)
index = myhtable_create_index(files)
myhtable_docs = myhtable_index_search(files, index, terms)
expected = []
assert filenames(myhtable_docs) == expected
def dotest(terms, expected, which):
files = filelist(rootdir)
terms = words(terms)
# print(terms)
if which == 0:
linear_docs = linear_search(files, terms)
# print(filenames(linear_docs))
names = filenames(linear_docs)
names.sort()
expected.sort()
#assert filenames(linear_docs) == expected
assert names == expected, "found "+str(names)+" != expected "+str(expected)
elif which == 1:
index = create_index(files)
index_docs = index_search(files, index, terms)
# print(filenames(index_docs))
names = filenames(index_docs)
names.sort()
expected.sort()
#assert filenames(index_docs) == expected
assert names == expected, "found "+str(names)+" != expected "+str(expected)
else:
index = myhtable_create_index(files)
index_docs = myhtable_index_search(files, index, terms)
# print(filenames(index_docs))
names = filenames(index_docs)
names.sort()
expected.sort()
#assert filenames(index_docs) == expected
assert names == expected, "found "+str(names)+" != expected "+str(expected)
def threetest(terms, expected):
for i in range(3):
dotest(terms=terms, expected=expected, which=i)
def test_hawaii_linear():
dotest(terms="hawaii travel", expected=['HistoryHawaii.txt'], which=0)
def test_hawaii_index():
dotest(terms="hawaii travel", expected=['HistoryHawaii.txt'], which=1)
def test_hawaii_myhtable():
dotest(terms="hawaii travel", expected=['HistoryHawaii.txt'], which=2)
def test_greek_linear():
dotest(terms="greek travel",
expected=['WhatToGreek.txt', 'WhereToLosAngeles.txt', 'WhereToFrance.txt',
'WhatToJapan.txt', 'WhereToMadrid.txt', 'WhereToDublin.txt',
'WhereToEdinburgh.txt', 'WhereToEgypt.txt', 'HistoryGreek.txt',
'WhereToGreek.txt', 'WhereToIndia.txt', 'WhereToIsrael.txt',
'WhereToIstanbul.txt', 'WhereToItaly.txt', 'WhereToJapan.txt',
'WhereToJerusalem.txt'], which=0)
def test_greek_index():
dotest(terms="greek travel",
expected=['WhatToGreek.txt', 'WhereToLosAngeles.txt', 'WhereToFrance.txt',
'WhatToJapan.txt', 'WhereToMadrid.txt', 'WhereToDublin.txt',
'WhereToEdinburgh.txt', 'WhereToEgypt.txt', 'HistoryGreek.txt',
'WhereToGreek.txt', 'WhereToIndia.txt', 'WhereToIsrael.txt',
'WhereToIstanbul.txt', 'WhereToItaly.txt', 'WhereToJapan.txt',
'WhereToJerusalem.txt'], which=1)
def test_greek_myhtable():
dotest(terms="greek travel",
expected=['WhatToGreek.txt', 'WhereToLosAngeles.txt', 'WhereToFrance.txt',
'WhatToJapan.txt', 'WhereToMadrid.txt', 'WhereToDublin.txt',
'WhereToEdinburgh.txt', 'WhereToEgypt.txt', 'HistoryGreek.txt',
'WhereToGreek.txt', 'WhereToIndia.txt', 'WhereToIsrael.txt',
'WhereToIstanbul.txt', 'WhereToItaly.txt', 'WhereToJapan.txt',
'WhereToJerusalem.txt'], which=2)
def test_lisbon_linear():
dotest(terms="lisbon",
expected=['HistoryMadeira.txt', 'HandRLisbon.txt', 'IntroMadeira.txt',
'WhereToMadeira.txt'], which=0)
def test_lisbon_index():
dotest(terms="lisbon",
expected=['HistoryMadeira.txt', 'HandRLisbon.txt', 'IntroMadeira.txt',
'WhereToMadeira.txt'], which=1)
def test_lisbon_myhtable():
dotest(terms="lisbon",
expected=['HistoryMadeira.txt', 'HandRLisbon.txt', 'IntroMadeira.txt',
'WhereToMadeira.txt'], which=2)
def test_india_linear():
dotest(terms="india", expected=['WhereToLosAngeles.txt', 'HistoryMalaysia.txt',
'WhereToMalaysia.txt', 'WhatToIndia.txt',
'IntroIndia.txt', 'WhereToEgypt.txt',
'WhatToMalaysia.txt', 'HistoryEgypt.txt',
'HistoryFrance.txt', 'HistoryFWI.txt',
'HistoryGreek.txt', 'HistoryHongKong.txt',
'WhereToIndia.txt', 'HistoryIndia.txt',
'HistoryIstanbul.txt'], which=0)
def test_india_index():
dotest(terms="india", expected=['WhereToLosAngeles.txt', 'HistoryMalaysia.txt',
'WhereToMalaysia.txt', 'WhatToIndia.txt',
'IntroIndia.txt', 'WhereToEgypt.txt',
'WhatToMalaysia.txt', 'HistoryEgypt.txt',
'HistoryFrance.txt', 'HistoryFWI.txt',
'HistoryGreek.txt', 'HistoryHongKong.txt',
'WhereToIndia.txt', 'HistoryIndia.txt',
'HistoryIstanbul.txt'], which=1)
def test_india_myhtable():
dotest(terms="india", expected=['WhereToLosAngeles.txt', 'HistoryMalaysia.txt',
'WhereToMalaysia.txt', 'WhatToIndia.txt',
'IntroIndia.txt', 'WhereToEgypt.txt',
'WhatToMalaysia.txt', 'HistoryEgypt.txt',
'HistoryFrance.txt', 'HistoryFWI.txt',
'HistoryGreek.txt', 'HistoryHongKong.txt',
'WhereToIndia.txt', 'HistoryIndia.txt',
'HistoryIstanbul.txt'], which=2)
def test_dublin_and_hawaii_linear():
dotest(terms="hawaii dublin", expected=[], which=0)
def test_dublin_and_hawaii_index():
dotest(terms="hawaii dublin", expected=[], which=1)
def test_dublin_and_hawaii_myhtable():
dotest(terms="hawaii dublin", expected=[], which=2)
#test_lisbon_myhtable()
#test_hawaii()
#test_greek()
#test_lisbon()
#test_india()
#test_dublin_and_hawaii()
| 37.79803 | 88 | 0.595204 | 726 | 7,673 | 6.128099 | 0.129477 | 0.028321 | 0.020454 | 0.022927 | 0.834794 | 0.761744 | 0.707125 | 0.650483 | 0.599236 | 0.599236 | 0 | 0.003634 | 0.28268 | 7,673 | 202 | 89 | 37.985149 | 0.804688 | 0.041314 | 0 | 0.59542 | 0 | 0 | 0.301003 | 0.018052 | 0 | 0 | 0 | 0 | 0.045802 | 1 | 0.152672 | false | 0 | 0.038168 | 0 | 0.19084 | 0.007634 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
026c0c3c892860a6414c04416b16765fe050b29c | 1,541 | py | Python | warehouse.py | kingeta/VOPP | 2d1b80cf9be9f035cb9bda7f0b8f82fbda9bf226 | [
"MIT"
] | 4 | 2020-10-24T18:37:06.000Z | 2020-10-25T19:48:17.000Z | warehouse.py | kingeta/VOPP | 2d1b80cf9be9f035cb9bda7f0b8f82fbda9bf226 | [
"MIT"
] | null | null | null | warehouse.py | kingeta/VOPP | 2d1b80cf9be9f035cb9bda7f0b8f82fbda9bf226 | [
"MIT"
] | null | null | null | """Classes used in warehouse"""
class ItemSet:
"""A set of identical items.
The dimensions is a tuple (x, y, z) of the dimensions of a single item.
The weight is a weight of a single member"""
def __init__(self, dimensions, weight, ref_id, quantity, colour):
self.dimensions = dimensions
self.weight = weight
self.ref_id = ref_id
self.quantity = quantity
self.colour = colour
def __str__(self):
return f"An ItemSet of {self.quantity} individual items of size {self.dimensions}, individual weight {self.weight}, id {self.ref_id}, colour {self.colour}"
class Box:
"""A Box dimensions is a tuple of (x, y, z)"""
def __init__(self, name, dimensions, max_weight):
self.name = name
self.dimensions = dimensions
self.max_weight = max_weight
def __str__(self):
return f'A {self.name} Box of size {self.dimensions} and maximum weight {self.max_weight}'
class Package:
"""A Package corresponds to one Box that contains
items of class ItemSet of quantity 1.
itemsets_and_locations is a list of tuples ordered by the order of packages being put in the box
each tuple contains a ItemSet class and a """
def __init__(self, itemsets_and_locations, box, image):
self.itemsets_and_locations = itemsets_and_locations
self.box = box
self.image = image
def __str__(self):
return f'Package of Box {self.box} containing ItemSets at locations {self.itemsets_and_locations}'
| 35.837209 | 163 | 0.674238 | 220 | 1,541 | 4.531818 | 0.277273 | 0.070211 | 0.100301 | 0.048144 | 0.051153 | 0 | 0 | 0 | 0 | 0 | 0 | 0.000857 | 0.2427 | 1,541 | 42 | 164 | 36.690476 | 0.85347 | 0.280337 | 0 | 0.217391 | 0 | 0.086957 | 0.294173 | 0.027256 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0 | 0.130435 | 0.521739 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
027328256c49eb137b7a4d65aee02263b9e3d230 | 1,355 | py | Python | python_backend/covidManager/models.py | KedarKshatriya/HackOn_Hackathon | d18fabac56240c054fb8dea3fba9dfff019682dd | [
"MIT"
] | null | null | null | python_backend/covidManager/models.py | KedarKshatriya/HackOn_Hackathon | d18fabac56240c054fb8dea3fba9dfff019682dd | [
"MIT"
] | null | null | null | python_backend/covidManager/models.py | KedarKshatriya/HackOn_Hackathon | d18fabac56240c054fb8dea3fba9dfff019682dd | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
class Covidiot(models.Model):
mob = models.CharField(max_length=100)
fever = models.IntegerField()
cough = models.IntegerField(default=1)
breathlessness = models.IntegerField(default=1)
smell = models.BooleanField(default=False)
appetite = models.BooleanField(default=False)
tired = models.BooleanField(default=False)
throat = models.BooleanField(default=False)
bodypain = models.BooleanField(default=False)
invisit = models.BooleanField(default=False)
pubvisit = models.BooleanField(default=False)
hivisit = models.BooleanField(default=False)
xray = models.BooleanField(default=False)
ctscan = models.BooleanField(default=False)
pending_in = models.CharField(max_length=4000,null=True, blank=True)
pending_out = models.CharField(max_length=4000,null=True, blank=True)
friends = models.CharField(max_length=4000,null=True, blank=True)
iv = models.CharField(max_length=200,null=True, blank=True)
lat = models.CharField(max_length=2000,null=True,blank=True)
lon = models.CharField(max_length=2000,null=True,blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Zones(models.Model):
opac = models.CharField(max_length=100, default=0.05) | 39.852941 | 73 | 0.750554 | 172 | 1,355 | 5.825581 | 0.337209 | 0.179641 | 0.249501 | 0.299401 | 0.334331 | 0.224551 | 0.224551 | 0.224551 | 0.224551 | 0 | 0 | 0.029085 | 0.137269 | 1,355 | 34 | 74 | 39.852941 | 0.828058 | 0.017712 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.038462 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
0289fb52cebffa12a0d39879dfe99e58162e8edf | 6,239 | py | Python | src/test/python/test_scc_attribute_codes.py | xchange11/ttconv-1 | 6e67172af126fa0e90690044848f300c0173715c | [
"BSD-2-Clause"
] | 66 | 2020-09-25T11:38:28.000Z | 2022-03-23T15:15:34.000Z | src/test/python/test_scc_attribute_codes.py | xchange11/ttconv-1 | 6e67172af126fa0e90690044848f300c0173715c | [
"BSD-2-Clause"
] | 217 | 2020-09-22T22:45:22.000Z | 2022-03-31T23:02:15.000Z | src/test/python/test_scc_attribute_codes.py | xchange11/ttconv-1 | 6e67172af126fa0e90690044848f300c0173715c | [
"BSD-2-Clause"
] | 5 | 2020-09-25T09:24:17.000Z | 2021-08-08T20:52:26.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2020, Sandflow Consulting LLC
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Unit tests for the SCC Control codes"""
# pylint: disable=R0201,C0115,C0116
import unittest
from ttconv.scc.codes.attribute_codes import SccAttributeCode
VALID_VALUES = [0x1020, 0x1820, 0x1021, 0x1821, 0x1022, 0x1822, 0x1023, 0x1823, 0x1024, 0x1824, 0x1025, 0x1825,
0x1026, 0x1826, 0x1027, 0x1827, 0x1028, 0x1828, 0x1029, 0x1829, 0x102A, 0x182A, 0x102B, 0x182B,
0x102C, 0x182C, 0x102D, 0x182D, 0x102E, 0x182E, 0x102F, 0x182F, 0x172D, 0x1F2D, 0x172E, 0x1F2E,
0x172F, 0x1F2F]
class TestSccAttributeCode(unittest.TestCase):
def test_scc_attribute_codes(self):
self.assertEqual(SccAttributeCode.BWO,
SccAttributeCode.find(VALID_VALUES[0]))
self.assertEqual(SccAttributeCode.BWO,
SccAttributeCode.find(VALID_VALUES[1]))
self.assertEqual(SccAttributeCode.BWS,
SccAttributeCode.find(VALID_VALUES[2]))
self.assertEqual(SccAttributeCode.BWS,
SccAttributeCode.find(VALID_VALUES[3]))
self.assertEqual(SccAttributeCode.BGO,
SccAttributeCode.find(VALID_VALUES[4]))
self.assertEqual(SccAttributeCode.BGO,
SccAttributeCode.find(VALID_VALUES[5]))
self.assertEqual(SccAttributeCode.BGS,
SccAttributeCode.find(VALID_VALUES[6]))
self.assertEqual(SccAttributeCode.BGS,
SccAttributeCode.find(VALID_VALUES[7]))
self.assertEqual(SccAttributeCode.BBO,
SccAttributeCode.find(VALID_VALUES[8]))
self.assertEqual(SccAttributeCode.BBO,
SccAttributeCode.find(VALID_VALUES[9]))
self.assertEqual(SccAttributeCode.BBS,
SccAttributeCode.find(VALID_VALUES[10]))
self.assertEqual(SccAttributeCode.BBS,
SccAttributeCode.find(VALID_VALUES[11]))
self.assertEqual(SccAttributeCode.BCO,
SccAttributeCode.find(VALID_VALUES[12]))
self.assertEqual(SccAttributeCode.BCO,
SccAttributeCode.find(VALID_VALUES[13]))
self.assertEqual(SccAttributeCode.BCS,
SccAttributeCode.find(VALID_VALUES[14]))
self.assertEqual(SccAttributeCode.BCS,
SccAttributeCode.find(VALID_VALUES[15]))
self.assertEqual(SccAttributeCode.BRO,
SccAttributeCode.find(VALID_VALUES[16]))
self.assertEqual(SccAttributeCode.BRO,
SccAttributeCode.find(VALID_VALUES[17]))
self.assertEqual(SccAttributeCode.BRS,
SccAttributeCode.find(VALID_VALUES[18]))
self.assertEqual(SccAttributeCode.BRS,
SccAttributeCode.find(VALID_VALUES[19]))
self.assertEqual(SccAttributeCode.BYO,
SccAttributeCode.find(VALID_VALUES[20]))
self.assertEqual(SccAttributeCode.BYO,
SccAttributeCode.find(VALID_VALUES[21]))
self.assertEqual(SccAttributeCode.BYS,
SccAttributeCode.find(VALID_VALUES[22]))
self.assertEqual(SccAttributeCode.BYS,
SccAttributeCode.find(VALID_VALUES[23]))
self.assertEqual(SccAttributeCode.BMO,
SccAttributeCode.find(VALID_VALUES[24]))
self.assertEqual(SccAttributeCode.BMO,
SccAttributeCode.find(VALID_VALUES[25]))
self.assertEqual(SccAttributeCode.BMS,
SccAttributeCode.find(VALID_VALUES[26]))
self.assertEqual(SccAttributeCode.BMS,
SccAttributeCode.find(VALID_VALUES[27]))
self.assertEqual(SccAttributeCode.BAO,
SccAttributeCode.find(VALID_VALUES[28]))
self.assertEqual(SccAttributeCode.BAO,
SccAttributeCode.find(VALID_VALUES[29]))
self.assertEqual(SccAttributeCode.BAS,
SccAttributeCode.find(VALID_VALUES[30]))
self.assertEqual(SccAttributeCode.BAS,
SccAttributeCode.find(VALID_VALUES[31]))
self.assertEqual(SccAttributeCode.BT,
SccAttributeCode.find(VALID_VALUES[32]))
self.assertEqual(SccAttributeCode.BT,
SccAttributeCode.find(VALID_VALUES[33]))
self.assertEqual(SccAttributeCode.FA,
SccAttributeCode.find(VALID_VALUES[34]))
self.assertEqual(SccAttributeCode.FA,
SccAttributeCode.find(VALID_VALUES[35]))
self.assertEqual(SccAttributeCode.FAU,
SccAttributeCode.find(VALID_VALUES[36]))
self.assertEqual(SccAttributeCode.FAU,
SccAttributeCode.find(VALID_VALUES[37]))
def test_scc_attribute_codes_invalid(self):
other_code_values = [code for code in range(0x0000, 0xFFFF) if code not in VALID_VALUES]
for cc in other_code_values:
self.assertIsNone(SccAttributeCode.find(cc))
if __name__ == '__main__':
unittest.main()
| 48.742188 | 111 | 0.686168 | 652 | 6,239 | 6.473926 | 0.368098 | 0.104241 | 0.279081 | 0.279081 | 0.639185 | 0.616442 | 0.616442 | 0.616442 | 0.03222 | 0.03222 | 0 | 0.053942 | 0.22744 | 6,239 | 127 | 112 | 49.125984 | 0.821784 | 0.224074 | 0 | 0.422222 | 0 | 0 | 0.001663 | 0 | 0 | 0 | 0.049875 | 0 | 0.433333 | 1 | 0.022222 | false | 0 | 0.022222 | 0 | 0.055556 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
65f7a7111a9c5acf9cc83b112eebd0a16ff0a19e | 93 | py | Python | tests/test_wine.py | rayrapetyan/adventum_ark | a37140fef8e846aa3dd3e60d3c10e43f6607dd82 | [
"Unlicense"
] | null | null | null | tests/test_wine.py | rayrapetyan/adventum_ark | a37140fef8e846aa3dd3e60d3c10e43f6607dd82 | [
"Unlicense"
] | null | null | null | tests/test_wine.py | rayrapetyan/adventum_ark | a37140fef8e846aa3dd3e60d3c10e43f6607dd82 | [
"Unlicense"
] | null | null | null | from runners.wine import Wine
def test_run():
wine = Wine("ace_ventura")
wine.run()
| 15.5 | 30 | 0.666667 | 14 | 93 | 4.285714 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204301 | 93 | 5 | 31 | 18.6 | 0.810811 | 0 | 0 | 0 | 0 | 0 | 0.11828 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5a36a43e9df5c3ab41652b9f89e7ca5db38a9134 | 315 | py | Python | terrascript/pagerduty/d.py | vfoucault/python-terrascript | fe82b3d7e79ffa72b7871538f999828be0a115d0 | [
"BSD-2-Clause"
] | null | null | null | terrascript/pagerduty/d.py | vfoucault/python-terrascript | fe82b3d7e79ffa72b7871538f999828be0a115d0 | [
"BSD-2-Clause"
] | null | null | null | terrascript/pagerduty/d.py | vfoucault/python-terrascript | fe82b3d7e79ffa72b7871538f999828be0a115d0 | [
"BSD-2-Clause"
] | null | null | null | from terrascript import _data
class pagerduty_escalation_policy(_data): pass
escalation_policy = pagerduty_escalation_policy
class pagerduty_schedule(_data): pass
schedule = pagerduty_schedule
class pagerduty_user(_data): pass
user = pagerduty_user
class pagerduty_vendor(_data): pass
vendor = pagerduty_vendor
| 22.5 | 47 | 0.847619 | 39 | 315 | 6.435897 | 0.307692 | 0.223108 | 0.199203 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101587 | 315 | 13 | 48 | 24.230769 | 0.886926 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.444444 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
5a483a43480943f79441decd0d566b62c588931f | 1,401 | py | Python | survae/transforms/cond_base.py | alisiahkoohi/survae_flows | e1747b05524c7ab540a211ed360ab3e67bc3e96d | [
"MIT"
] | 262 | 2020-07-05T20:57:44.000Z | 2022-03-28T02:24:43.000Z | survae/transforms/cond_base.py | alisiahkoohi/survae_flows | e1747b05524c7ab540a211ed360ab3e67bc3e96d | [
"MIT"
] | 17 | 2020-08-15T05:43:34.000Z | 2022-01-31T12:24:21.000Z | survae/transforms/cond_base.py | alisiahkoohi/survae_flows | e1747b05524c7ab540a211ed360ab3e67bc3e96d | [
"MIT"
] | 35 | 2020-08-24T06:55:37.000Z | 2022-02-11T05:17:58.000Z | import torch
from torch import nn
from collections.abc import Iterable
from survae.transforms import Transform
class ConditionalTransform(Transform):
"""Base class for ConditionalTransform"""
has_inverse = True
@property
def bijective(self):
raise NotImplementedError()
@property
def stochastic_forward(self):
raise NotImplementedError()
@property
def stochastic_inverse(self):
raise NotImplementedError()
@property
def lower_bound(self):
return self.stochastic_forward
def forward(self, x, context):
"""
Forward transform.
Computes `z = f(x|context)` and `log|det J|` for `J = df(x|context)/dx`
such that `log p_x(x|context) = log p_z(f(x|context)) + log|det J|`.
Args:
x: Tensor, shape (batch_size, ...)
context: Tensor, shape (batch_size, ...).
Returns:
z: Tensor, shape (batch_size, ...)
ldj: Tensor, shape (batch_size,)
"""
raise NotImplementedError()
def inverse(self, z, context):
"""
Inverse transform.
Computes `x = f^{-1}(z|context)`.
Args:
z: Tensor, shape (batch_size, ...)
context: Tensor, shape (batch_size, ...).
Returns:
x: Tensor, shape (batch_size, ...)
"""
raise NotImplementedError()
| 24.578947 | 79 | 0.5803 | 149 | 1,401 | 5.362416 | 0.33557 | 0.09637 | 0.140175 | 0.175219 | 0.446809 | 0.36796 | 0.135169 | 0.135169 | 0.135169 | 0.135169 | 0 | 0.001022 | 0.301927 | 1,401 | 56 | 80 | 25.017857 | 0.815951 | 0.404711 | 0 | 0.409091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.181818 | 0.045455 | 0.590909 | 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 | 0 | 1 | 0 | 0 | 3 |
5a4bc0a46dbeea4bcd95517c29775094a6bb3476 | 5,186 | py | Python | sos_trades_core/tests/l0_test_32_extend_float.py | os-climate/sostrades-core | bcaa9b5e393ffbd0963e75a9315b27caf8b0abd9 | [
"Apache-2.0"
] | 8 | 2022-01-10T14:44:28.000Z | 2022-03-31T08:57:14.000Z | sos_trades_core/tests/l0_test_32_extend_float.py | os-climate/sostrades-core | bcaa9b5e393ffbd0963e75a9315b27caf8b0abd9 | [
"Apache-2.0"
] | null | null | null | sos_trades_core/tests/l0_test_32_extend_float.py | os-climate/sostrades-core | bcaa9b5e393ffbd0963e75a9315b27caf8b0abd9 | [
"Apache-2.0"
] | 1 | 2022-02-21T14:51:45.000Z | 2022-02-21T14:51:45.000Z | '''
Copyright 2022 Airbus SAS
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.
'''
'''
mode: python; py-indent-offset: 4; tab-width: 4; coding: utf-8
'''
import unittest
from numpy import int32 as np_int32, float64 as np_float64, int64 as np_int64, ndarray
import os
from sos_trades_core.execution_engine.execution_engine import ExecutionEngine
class TestExtendFloat(unittest.TestCase):
"""
Extend float type for GEMSEO test class
"""
def setUp(self):
self.name = 'study'
self.ee = ExecutionEngine(self.name)
def test_01_int_and_float_coupling_variables(self):
self.ee.ns_manager.add_ns('ns_disc1', f'{self.name}.Disc1')
mod_list = 'sos_trades_core.sos_wrapping.test_discs.disc0.Disc0'
disc0_builder = self.ee.factory.get_builder_from_module(
'Disc0', mod_list)
mod_list = 'sos_trades_core.sos_wrapping.test_discs.disc1_all_types.Disc1'
disc1_builder = self.ee.factory.get_builder_from_module(
'Disc1', mod_list)
self.ee.factory.set_builders_to_coupling_builder(
[disc0_builder, disc1_builder])
self.ee.configure()
b = 5
values_dict = {}
values_dict['study.Disc1.b'] = b
values_dict['study.Disc1.name'] = 'A1'
self.ee.load_study_from_input_dict(values_dict)
# float
r = 3.22222222222222222222222
x = 0.22222222222222222222222
a = 3
values_dict['study.Disc0.r'] = r
self.ee.load_study_from_input_dict(values_dict)
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc0.r'), float))
self.ee.execute()
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc0.r'), type(r)))
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc1.b'), type(b)))
self.assertEqual(self.ee.dm.get_value('study.Disc1.y'), a * x + b)
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc0.r'], ndarray))
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc1.x'], ndarray))
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc1.y'], ndarray))
b = np_int32(5)
values_dict['study.Disc1.b'] = b
self.ee.load_study_from_input_dict(values_dict)
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc1.b'), type(b)))
self.ee.execute()
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc0.r'), type(r)))
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc1.b'), type(b)))
self.assertEqual(self.ee.dm.get_value('study.Disc1.y'), a * x + b)
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc0.r'], ndarray))
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc1.x'], ndarray))
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc1.y'], ndarray))
# np_int64
b = np_int64(5)
values_dict['study.Disc1.b'] = b
self.ee.load_study_from_input_dict(values_dict)
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc1.b'), type(b)))
self.ee.execute()
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc1.b'), type(b)))
self.assertEqual(self.ee.dm.get_value('study.Disc1.y'), a * x + b)
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc0.r'], ndarray))
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc1.x'], ndarray))
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc1.y'], ndarray))
# np_float64
r = np_float64(3.22222222222222222222222)
x = 0.22222222222222222222222
a = 3
values_dict['study.Disc0.r'] = r
self.ee.load_study_from_input_dict(values_dict)
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc0.r'), type(r)))
self.ee.execute()
self.assertTrue(isinstance(
self.ee.dm.get_value('study.Disc0.r'), type(r)))
self.assertEqual(self.ee.dm.get_value('study.Disc1.y'), a * x + b)
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc0.r'], ndarray))
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc1.x'], ndarray))
self.assertTrue(isinstance(
self.ee.root_process.local_data['study.Disc1.y'], ndarray))
| 35.040541 | 87 | 0.648669 | 703 | 5,186 | 4.615932 | 0.211949 | 0.075809 | 0.162712 | 0.189831 | 0.669029 | 0.669029 | 0.66225 | 0.66225 | 0.637596 | 0.601233 | 0 | 0.045115 | 0.226379 | 5,186 | 147 | 88 | 35.278912 | 0.763709 | 0.118974 | 0 | 0.706522 | 0 | 0 | 0.128073 | 0.025034 | 0 | 0 | 0 | 0 | 0.282609 | 1 | 0.021739 | false | 0 | 0.043478 | 0 | 0.076087 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 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 | 3 |
ce4ffd31f937cc355d35160f3169fc1e1c2e7756 | 654 | py | Python | easytext/data/__init__.py | freedomkite/easytext | ef83261a366bd8d7c259aa112da14f3fa7cdf918 | [
"MIT"
] | null | null | null | easytext/data/__init__.py | freedomkite/easytext | ef83261a366bd8d7c259aa112da14f3fa7cdf918 | [
"MIT"
] | null | null | null | easytext/data/__init__.py | freedomkite/easytext | ef83261a366bd8d7c259aa112da14f3fa7cdf918 | [
"MIT"
] | null | null | null | #!/usr/bin/env python 3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
#
"""
数据相关定义
Authors: panxu(panxu@baidu.com)
Date: 2020/05/13 15:04:00
"""
from .instance import Instance
from .vocabulary import Vocabulary, LabelVocabulary
from .model_collate import ModelCollate, ModelInputs
from .pretrained_vocabulary import PretrainedVocabulary
from .pretrained_word_embedding_loader import GeneralPretrainedWordEmbeddingLoader
from .pretrained_word_embedding_loader import PretrainedWordEmbeddingLoader
from .pretrained_word_embedding_loader import GloveLoader
from .pretrained_word_embedding_loader import SGNSLoader
| 29.727273 | 82 | 0.824159 | 78 | 654 | 6.730769 | 0.564103 | 0.133333 | 0.137143 | 0.205714 | 0.297143 | 0.297143 | 0 | 0 | 0 | 0 | 0 | 0.034072 | 0.102446 | 654 | 21 | 83 | 31.142857 | 0.860307 | 0.256881 | 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 | 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 | 3 |
ce6def89d42757e8171fbcc3bab9c0a5e8c2c783 | 446 | bzl | Python | third_party/org_xerial_snappy.bzl | wix/wix-oss-infra | b57ac2f0f66487cfdd08293a8fa389efe3d42c43 | [
"MIT"
] | 3 | 2020-01-14T12:57:31.000Z | 2021-06-06T20:47:57.000Z | third_party/org_xerial_snappy.bzl | wix/wix-oss-infra | b57ac2f0f66487cfdd08293a8fa389efe3d42c43 | [
"MIT"
] | 20 | 2020-04-02T13:08:43.000Z | 2020-11-05T11:27:40.000Z | third_party/org_xerial_snappy.bzl | wix/wix-oss-infra | b57ac2f0f66487cfdd08293a8fa389efe3d42c43 | [
"MIT"
] | 1 | 2021-04-02T09:32:35.000Z | 2021-04-02T09:32:35.000Z | load("@wix_oss_infra//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "org_xerial_snappy_snappy_java",
artifact = "org.xerial.snappy:snappy-java:1.1.7.1",
artifact_sha256 = "bb52854753feb1919f13099a53475a2a8eb65dbccd22839a9b9b2e1a2190b951",
srcjar_sha256 = "a01c58c2af4bf16d2b841c74f76d98489bc03b5f9cf63aea33a8cb14ce376258",
)
| 40.545455 | 102 | 0.766816 | 41 | 446 | 7.95122 | 0.585366 | 0.171779 | 0.092025 | 0.128834 | 0.153374 | 0 | 0 | 0 | 0 | 0 | 0 | 0.234375 | 0.139013 | 446 | 10 | 103 | 44.6 | 0.614583 | 0 | 0 | 0 | 0 | 0 | 0.596413 | 0.596413 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0 | 0.25 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ce767ae42d74e9307bbb2392d22fed908ae7570f | 471 | py | Python | svb/webstreaming.py | insung3511/social-distance | 0d02cfd436ba9562f4cda7a8589be453fb2e4d64 | [
"WTFPL"
] | 3 | 2020-09-30T13:04:28.000Z | 2021-11-08T08:48:09.000Z | svb/webstreaming.py | insung3511/social-distance | 0d02cfd436ba9562f4cda7a8589be453fb2e4d64 | [
"WTFPL"
] | 13 | 2021-05-21T20:08:24.000Z | 2022-03-31T20:18:19.000Z | svb/webstreaming.py | insung3511/social-distance | 0d02cfd436ba9562f4cda7a8589be453fb2e4d64 | [
"WTFPL"
] | null | null | null | '''from flask import render_template
from flask import Response
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return render_template('streaming2.html')
def generate(camera):
while True:
frame = camera.get_frame()
yield (b'--frame\r\n'
b'Content-Type: image/jpg\r\n\r\n' + frame + b'\r\n\r\n')
@app.route('/video_feed')
def video_feed():
return Response(gen(),
mimetype='multipart/x-mixed-replace;
boundary=frame')''' | 22.428571 | 61 | 0.687898 | 71 | 471 | 4.43662 | 0.521127 | 0.031746 | 0.142857 | 0.025397 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002475 | 0.142251 | 471 | 21 | 62 | 22.428571 | 0.777228 | 1.278132 | 0 | null | 1 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ce7830825426ff368f5b39faf52680e64c74eb37 | 152 | py | Python | tests/test_filter.py | natanfeitosa/pyfunctools | b5354e0d737542b03049eb3e347d6ca1ccceb164 | [
"MIT"
] | 4 | 2021-11-17T15:26:11.000Z | 2022-03-12T01:30:55.000Z | tests/test_filter.py | natanfeitosa/pyfunctools | b5354e0d737542b03049eb3e347d6ca1ccceb164 | [
"MIT"
] | null | null | null | tests/test_filter.py | natanfeitosa/pyfunctools | b5354e0d737542b03049eb3e347d6ca1ccceb164 | [
"MIT"
] | null | null | null | from pyfunctools.filter import filter
def test_filter():
func = lambda item, *args: item % 2 == 0
assert filter([1, 2, 3, 4], func) == [2, 4]
| 21.714286 | 47 | 0.611842 | 24 | 152 | 3.833333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068376 | 0.230263 | 152 | 6 | 48 | 25.333333 | 0.717949 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ce8946b4300d5614c31a73ddd96dcd27dde27e57 | 80 | py | Python | ex.py | Kim-dilettante/Priv_Kim | 79b0a839648c2d30acb491cfc03a1098a2e0fab2 | [
"Unlicense"
] | null | null | null | ex.py | Kim-dilettante/Priv_Kim | 79b0a839648c2d30acb491cfc03a1098a2e0fab2 | [
"Unlicense"
] | null | null | null | ex.py | Kim-dilettante/Priv_Kim | 79b0a839648c2d30acb491cfc03a1098a2e0fab2 | [
"Unlicense"
] | null | null | null | number = int( input("enter a number:"))
print("The number is {}".format(number)) | 40 | 40 | 0.675 | 12 | 80 | 4.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1125 | 80 | 2 | 40 | 40 | 0.760563 | 0 | 0 | 0 | 0 | 0 | 0.382716 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
ce99279d7645f79901b47ca71ead7e3f380b7983 | 233 | py | Python | test.py | Will-jing/pspnet-pytorch | 0bc2249e03809511dca1ad19c6a4156d636fdbd6 | [
"MIT"
] | 1 | 2020-12-30T09:28:11.000Z | 2020-12-30T09:28:11.000Z | test.py | Will-jing/pspnet-pytorch | 0bc2249e03809511dca1ad19c6a4156d636fdbd6 | [
"MIT"
] | null | null | null | test.py | Will-jing/pspnet-pytorch | 0bc2249e03809511dca1ad19c6a4156d636fdbd6 | [
"MIT"
] | null | null | null | import torch
from nets.pspnet import PSPNet
from torchsummary import summary
model = PSPNet(num_classes=21,backbone="mobilenet",downsample_factor=16,aux_branch=False,pretrained=False).train().cuda()
summary(model,(3,473,473)) | 33.285714 | 122 | 0.7897 | 33 | 233 | 5.484848 | 0.727273 | 0.132597 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051887 | 0.090129 | 233 | 7 | 123 | 33.285714 | 0.801887 | 0 | 0 | 0 | 0 | 0 | 0.039474 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
cec959f74c62b228af0b05f4d3bbfcf71d7b9d6a | 298 | py | Python | tests/project/apps/catalogue/managers.py | fourdigits/django-oscar-wagtail | 818c8ac93a7854c7837043d145e36d8177f29a70 | [
"MIT"
] | 48 | 2018-07-12T21:55:33.000Z | 2022-03-23T08:09:01.000Z | tests/project/apps/catalogue/managers.py | fourdigits/django-oscar-wagtail | 818c8ac93a7854c7837043d145e36d8177f29a70 | [
"MIT"
] | 7 | 2018-12-05T07:33:58.000Z | 2021-12-20T08:32:02.000Z | tests/project/apps/catalogue/managers.py | fourdigits/django-oscar-wagtail | 818c8ac93a7854c7837043d145e36d8177f29a70 | [
"MIT"
] | 32 | 2018-09-09T09:38:51.000Z | 2022-02-14T22:49:56.000Z | from oscar.apps.catalogue import managers as _managers
class ProductQuerySet(_managers.ProductQuerySet):
def available_in_cms(self):
return self
class ProductManager(_managers.ProductManager):
def get_queryset(self):
return ProductQuerySet(self.model, using=self._db)
| 21.285714 | 58 | 0.761745 | 34 | 298 | 6.470588 | 0.617647 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16443 | 298 | 13 | 59 | 22.923077 | 0.883534 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.285714 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
cecf3d2bb4fc90c7baf253ba294d8b1e016ce3ef | 270 | py | Python | typed_models/fields/integer.py | lockhaty/typed-models | 75005b84cf78bc58d9a760eef34d42095ca4f726 | [
"MIT"
] | 1 | 2020-09-06T13:55:58.000Z | 2020-09-06T13:55:58.000Z | typed_models/fields/integer.py | lockhaty/typed-models | 75005b84cf78bc58d9a760eef34d42095ca4f726 | [
"MIT"
] | 3 | 2020-09-06T13:54:33.000Z | 2020-10-13T10:57:15.000Z | typed_models/fields/integer.py | lockhaty/typed-models | 75005b84cf78bc58d9a760eef34d42095ca4f726 | [
"MIT"
] | 1 | 2020-10-05T11:29:17.000Z | 2020-10-05T11:29:17.000Z | from ..base import Field
class IntegerField(Field):
def parse(self, value):
try:
return int(value)
except (TypeError, ValueError):
self._raise_value_error(value)
def default_serializer(self, value):
return value | 22.5 | 42 | 0.622222 | 30 | 270 | 5.466667 | 0.666667 | 0.109756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.292593 | 270 | 12 | 43 | 22.5 | 0.858639 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0.111111 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
0c71ea960277f22da25fe98509fbf6340fd88a67 | 1,036 | py | Python | into/__init__.py | jreback/into | 0b2a0b26d66c2cbc5fc9e66f64255cf4d4adb007 | [
"BSD-3-Clause"
] | null | null | null | into/__init__.py | jreback/into | 0b2a0b26d66c2cbc5fc9e66f64255cf4d4adb007 | [
"BSD-3-Clause"
] | null | null | null | into/__init__.py | jreback/into | 0b2a0b26d66c2cbc5fc9e66f64255cf4d4adb007 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import, division, print_function
from multipledispatch import halt_ordering, restart_ordering
halt_ordering() # Turn off multipledispatch ordering
from .convert import convert
from .append import append
from .create import create
from .resource import resource
from .into import into
from .drop import drop
from .chunks import chunks, Chunks
from datashape import discover, dshape
try:
from .backends.pandas import pd
except:
pass
try:
from .backends.bcolz import bcolz
except:
pass
try:
from .backends.h5py import h5py
except:
pass
try:
from .backends.pytables import tables
except:
pass
try:
from .backends.dynd import nd
except:
pass
try:
from .backends import sql
except:
pass
try:
from .backends import mongo
except:
pass
try:
from .backends.csv import CSV
except:
pass
try:
from .backends import sql_csv
except:
pass
restart_ordering() # Restart multipledispatch ordering and do ordering
__version__ = '0.1.3'
| 18.175439 | 70 | 0.740347 | 137 | 1,036 | 5.489051 | 0.321168 | 0.083777 | 0.179521 | 0.180851 | 0.297872 | 0.131649 | 0.090426 | 0 | 0 | 0 | 0 | 0.006075 | 0.205598 | 1,036 | 56 | 71 | 18.5 | 0.907655 | 0.081081 | 0 | 0.55102 | 0 | 0 | 0.005269 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.183673 | 0.387755 | 0 | 0.387755 | 0.020408 | 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 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
0c72b7dfdee08e93fa3efebfb163c7176f86cae0 | 273 | py | Python | backend/history/migrations/0002_change_history_name.py | glproj/tictactoe-online | 4a99cda10f3112fb83f6f55b95b2c98a030c1658 | [
"MIT"
] | null | null | null | backend/history/migrations/0002_change_history_name.py | glproj/tictactoe-online | 4a99cda10f3112fb83f6f55b95b2c98a030c1658 | [
"MIT"
] | null | null | null | backend/history/migrations/0002_change_history_name.py | glproj/tictactoe-online | 4a99cda10f3112fb83f6f55b95b2c98a030c1658 | [
"MIT"
] | null | null | null | from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("history", "0001_initial"),
]
operations = [migrations.RenameModel("History", "Game")]
| 24.818182 | 60 | 0.717949 | 29 | 273 | 6.724138 | 0.62069 | 0.102564 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017544 | 0.164835 | 273 | 10 | 61 | 27.3 | 0.837719 | 0 | 0 | 0 | 0 | 0 | 0.10989 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0c87f0daf6d2ba9a3e55def949970f68aea2027b | 231 | py | Python | anyflow/__init__.py | Cologler/anyflow-python | cde20b0c74faf18cb7dc503072d4c2f99d5681de | [
"MIT"
] | null | null | null | anyflow/__init__.py | Cologler/anyflow-python | cde20b0c74faf18cb7dc503072d4c2f99d5681de | [
"MIT"
] | null | null | null | anyflow/__init__.py | Cologler/anyflow-python | cde20b0c74faf18cb7dc503072d4c2f99d5681de | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright (c) 2020~2999 - Cologler <skyoflw@gmail.com>
# ----------
#
# ----------
from .ctx import FlowContext
from .flow import Flow
from .err import Abort
__all__ = ['FlowContext', 'Flow', 'Abort']
| 17.769231 | 56 | 0.597403 | 27 | 231 | 4.962963 | 0.703704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046392 | 0.160173 | 231 | 12 | 57 | 19.25 | 0.64433 | 0.424242 | 0 | 0 | 0 | 0 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0c9293ae4a6eb3787b9190ac2a6515193f18079b | 192 | py | Python | tests/test_app.py | nickfrostatx/corral | be7c70ed4e0f40c8bcd6b1dc0c5ac2f1aa410842 | [
"MIT"
] | 1 | 2015-10-22T17:46:06.000Z | 2015-10-22T17:46:06.000Z | tests/test_app.py | nickfrostatx/corral | be7c70ed4e0f40c8bcd6b1dc0c5ac2f1aa410842 | [
"MIT"
] | null | null | null | tests/test_app.py | nickfrostatx/corral | be7c70ed4e0f40c8bcd6b1dc0c5ac2f1aa410842 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Test the scaffolding of the app."""
from flask import Flask
import corral.app
def test_app():
app = corral.app.create_app()
assert isinstance(app, Flask)
| 17.454545 | 38 | 0.666667 | 28 | 192 | 4.5 | 0.571429 | 0.174603 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00641 | 0.1875 | 192 | 10 | 39 | 19.2 | 0.801282 | 0.286458 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0c9a59aed3225a67b1fab9c09808cc6c3ceeede1 | 1,687 | py | Python | canarymd/__init__.py | canaryhealth/canarymd-python | 58ebfa60805084a1369944e884436e34eb73338c | [
"MIT"
] | null | null | null | canarymd/__init__.py | canaryhealth/canarymd-python | 58ebfa60805084a1369944e884436e34eb73338c | [
"MIT"
] | null | null | null | canarymd/__init__.py | canaryhealth/canarymd-python | 58ebfa60805084a1369944e884436e34eb73338c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: Philip J Grabner <phil@canary.md>
# date: 2014/12/03
# copy: (C) Copyright 2014-EOT Canary Health, Inc., All Rights Reserved.
#------------------------------------------------------------------------------
'''
This is the Python client library for the Canary Health API. The
following on-line resources are available if you need further
information than what is available in the pydocs:
* Homepage: https://github.com/canaryhealth/canarymd-python
* Bugs: https://github.com/canaryhealth/canarymd-python/issues
Typical Usage
-------------
.. code-block:: python
import canarymd
client = canarymd.Client(principal='{USERNAME}', credential='{PASSWORD}')
selection = client.select(
context = '{CONTEXT}',
peo = {
'transport' : canarymd.Transport.SITE,
'purpose' : canarymd.Purpose.PREPARE,
'recipient' : recipient.toHL7(),
'appointment' : {
'time' : '2014-12-02T18:20:06Z',
'patients' : [patient.toHL7() for patient in patients],
'provider' : provider.toHL7(),
'type' : 'new',
'reason' : 'us/namcs:5035.0',
'policy' : policy.toHL7(),
},
},
)
# now do something with the HTML message in `selection.content`!...
'''
#------------------------------------------------------------------------------
from .client import *
#------------------------------------------------------------------------------
# end of $Id$
#------------------------------------------------------------------------------
| 32.442308 | 79 | 0.460581 | 146 | 1,687 | 5.321918 | 0.691781 | 0.015444 | 0.036036 | 0.066924 | 0.10296 | 0.10296 | 0 | 0 | 0 | 0 | 0 | 0.026374 | 0.190871 | 1,687 | 51 | 80 | 33.078431 | 0.542857 | 0.966212 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0ca4b7f42105e0c97c8a7b688d939d0279816510 | 781 | py | Python | mokapot/__init__.py | mobiusklein/mokapot | 5148da1c09cfc92f9b776ae8306619429d0656cb | [
"Apache-2.0"
] | 14 | 2019-09-14T19:47:58.000Z | 2021-07-25T21:10:50.000Z | mokapot/__init__.py | mobiusklein/mokapot | 5148da1c09cfc92f9b776ae8306619429d0656cb | [
"Apache-2.0"
] | 28 | 2020-09-29T19:38:29.000Z | 2022-03-30T05:02:56.000Z | mokapot/__init__.py | mobiusklein/mokapot | 5148da1c09cfc92f9b776ae8306619429d0656cb | [
"Apache-2.0"
] | 6 | 2020-09-29T19:12:02.000Z | 2022-03-18T17:39:16.000Z | """Initialize the mokapot package."""
try:
from importlib.metadata import version, PackageNotFoundError
try:
__version__ = version(__name__)
except PackageNotFoundError:
pass
except ImportError:
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
pass
from .dataset import LinearPsmDataset
from .model import Model, PercolatorModel, save_model, load_model
from .brew import brew
from .parsers.pin import read_pin, read_percolator
from .parsers.pepxml import read_pepxml
from .parsers.fasta import read_fasta, make_decoys, digest
from .writers import to_flashlfq, to_txt
from .confidence import LinearConfidence, plot_qvalues
| 30.038462 | 68 | 0.778489 | 89 | 781 | 6.505618 | 0.494382 | 0.056995 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167734 | 781 | 25 | 69 | 31.24 | 0.890769 | 0.039693 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.1 | 0.55 | 0 | 0.55 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
0cb152d7b9bcf12788125f40c77c6cab0f519b90 | 101 | py | Python | 10952.py | pgw00/Beakjoon-python | 677bf6ece5be4843a37aace02edaa29c532721fb | [
"MIT"
] | null | null | null | 10952.py | pgw00/Beakjoon-python | 677bf6ece5be4843a37aace02edaa29c532721fb | [
"MIT"
] | null | null | null | 10952.py | pgw00/Beakjoon-python | 677bf6ece5be4843a37aace02edaa29c532721fb | [
"MIT"
] | null | null | null | while True:
x,y=map(int,input().split())
if x==0 and y==0:
break
print(x+y)
| 14.428571 | 32 | 0.475248 | 18 | 101 | 2.666667 | 0.722222 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029851 | 0.336634 | 101 | 6 | 33 | 16.833333 | 0.686567 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0cbc8be5dfaa44ae7a01adfd50af5eec4f2a9b71 | 638 | py | Python | test.py | MicroBitcoinOrg/RainforestPython | 3de0b9731880792d8ad08396f13e479e63fdb8a1 | [
"MIT"
] | 3 | 2019-03-06T03:06:09.000Z | 2019-04-22T01:26:26.000Z | test.py | MicroBitcoinOrg/RainforestPython | 3de0b9731880792d8ad08396f13e479e63fdb8a1 | [
"MIT"
] | 1 | 2019-02-28T08:33:56.000Z | 2019-04-15T04:19:01.000Z | test.py | MicroBitcoinOrg/RainforestPython | 3de0b9731880792d8ad08396f13e479e63fdb8a1 | [
"MIT"
] | null | null | null | import rainforest_hash
header = bytes.fromhex("000000203925e0a940a13beaadba13c8a94c93f1b020a966867bc1334a8f5fdc8c000000b41136b86741ba61ade8e73f3740ffb012564c045c9ee2f2dcd418f29ce47b11e1c36f5cffff001e00124b98")
result_v1 = rainforest_hash.get(header, 80)
result_v2 = rainforest_hash.get_v2(header, 80)
assert(result_v1 == b'\x15|N\xb3\x89!\xc1Ab\xf0\x14\x04\xad\xf0aJ\xd4\x8d\xdfu\xab}^\xc1\xa8I]f%\x00\x00\x00')
assert(result_v2 == b'>ct\x1b \x9f\xeaH#\x96\x11v\xfdp\xe4m\xac\xbbl\xd2\x82\xbe\xf0B\x05\x96\xad\xbb\x83\xe2\xd87')
print(rainforest_hash.get(header, 80)[::-1].hex())
print(rainforest_hash.get_v2(header, 80)[::-1].hex())
| 49.076923 | 186 | 0.796238 | 88 | 638 | 5.647727 | 0.613636 | 0.140845 | 0.136821 | 0.092555 | 0.209256 | 0.108652 | 0 | 0 | 0 | 0 | 0 | 0.262295 | 0.043887 | 638 | 12 | 187 | 53.166667 | 0.552459 | 0 | 0 | 0 | 0 | 0.25 | 0.529781 | 0.517241 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0.25 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0cca33db0e4cf96734436d4e3d7453c5dfa8884d | 2,175 | py | Python | dodo_commands/framework/config_layers.py | mnieber/dodo-commands | 82330006af2c6739b030ce932ba1ff9078b241ee | [
"MIT"
] | 8 | 2016-12-01T16:45:45.000Z | 2020-05-05T20:56:57.000Z | dodo_commands/framework/config_layers.py | mnieber/dodo-commands | 82330006af2c6739b030ce932ba1ff9078b241ee | [
"MIT"
] | 75 | 2017-01-29T19:25:45.000Z | 2020-01-28T09:40:47.000Z | dodo_commands/framework/config_layers.py | mnieber/dodo-commands | 82330006af2c6739b030ce932ba1ff9078b241ee | [
"MIT"
] | 2 | 2017-06-01T09:55:20.000Z | 2017-06-08T14:45:08.000Z | import os
from collections import OrderedDict
from dodo_commands.framework import ramda as R
def layer_filename_superset(layer_filenames, config_io):
selected_layer_by_path = OrderedDict()
def load_layers(layer_paths):
def map_to_layer_filenames(layer_paths):
return config_io.glob(layer_paths)
def map_to_filename_and_layer(layer_filename):
return layer_filename, config_io.load(layer_filename)
def do_store(layer_filename, layer):
selected_layer_by_path[layer_filename] = layer
def map_to_nested_layer_paths(layer_filename, layer):
return R.path_or([], "LAYERS")(layer)
def get_flat_list(list_of_lists):
return R.uniq(R.flatten(list_of_lists))
x = map_to_layer_filenames(layer_paths)
# [[layer_filename]]
x = R.map(map_to_filename_and_layer)(x)
# [layer_filename, layer]
x = R.for_each(R.ds(do_store))(x)
# [layer_filename, layer]
x = R.map(R.ds(map_to_nested_layer_paths))(x)
# [[layer_filename]]
x = get_flat_list(x)
# [layer_filename, layer]
if x:
load_layers(x)
load_layers(layer_filenames)
return list(selected_layer_by_path.keys())
def get_conflicts_in_layer_paths(layer_paths):
generic_paths = {}
def map_to_layer_path_and_parts(path):
parts = os.path.basename(path).split(".")
return path, parts
def has_flavours(path, parts):
return len(parts) == 3
def map_to_path_and_generic_path(path, parts):
generic_path = os.path.join(os.path.dirname(path), parts[0])
return path, generic_path
def is_conflict(path, generic_path):
result = bool(generic_paths.get(generic_path, None))
if not result:
generic_paths[generic_path] = path
return result
x = layer_paths
# [path]
x = R.map(map_to_layer_path_and_parts)(x)
# [(path, parts)]
x = R.filter(R.ds(has_flavours))(x)
# [(path, parts)]
x = R.map(R.ds(map_to_path_and_generic_path))(x)
# [(path, generic_path)]
x = R.filter(R.ds(is_conflict))(x)
return x
| 29.391892 | 68 | 0.653333 | 309 | 2,175 | 4.249191 | 0.213592 | 0.118812 | 0.082254 | 0.043412 | 0.284844 | 0.159177 | 0.019802 | 0 | 0 | 0 | 0 | 0.00121 | 0.24 | 2,175 | 73 | 69 | 29.794521 | 0.793103 | 0.078621 | 0 | 0 | 0 | 0 | 0.003511 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0.065217 | 0.108696 | 0.543478 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
0cd31ca521f62b0ced8fec980071867734129c77 | 170 | py | Python | mestr/__init__.py | Scille/butler | 344092aac77ad222fb6cd62927c7801c2ece33fc | [
"0BSD"
] | null | null | null | mestr/__init__.py | Scille/butler | 344092aac77ad222fb6cd62927c7801c2ece33fc | [
"0BSD"
] | null | null | null | mestr/__init__.py | Scille/butler | 344092aac77ad222fb6cd62927c7801c2ece33fc | [
"0BSD"
] | null | null | null | from .mestr import MestrSession, authenticate
__author__ = 'Scille SAS'
__email__ = 'contact@scille.fr'
__version__ = '1.0.6'
__all__ = ('MestrSession', 'authenticate')
| 24.285714 | 45 | 0.747059 | 19 | 170 | 5.842105 | 0.842105 | 0.432432 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02 | 0.117647 | 170 | 6 | 46 | 28.333333 | 0.72 | 0 | 0 | 0 | 0 | 0 | 0.329412 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0b2468f8088e46911786b693757278d3fe9d6fdb | 642 | py | Python | xiaomirouter/client/statistic.py | RiRomain/python-xiaomi-router | 36867d077349a70678db75cf261428cdd80a0c51 | [
"MIT"
] | null | null | null | xiaomirouter/client/statistic.py | RiRomain/python-xiaomi-router | 36867d077349a70678db75cf261428cdd80a0c51 | [
"MIT"
] | null | null | null | xiaomirouter/client/statistic.py | RiRomain/python-xiaomi-router | 36867d077349a70678db75cf261428cdd80a0c51 | [
"MIT"
] | null | null | null | """ Connected client statistics """
class Statistics(object):
""" A connected client statistics """
def __init__(self, downspeed, online, upspeed):
self._downspeed = downspeed
self._online = online
self._upspeed = upspeed
def get_downspeed(self):
return self._downspeed
def get_online(self):
return self._online
def get_upspeed(self):
return self._upspeed
def create_statistic_from_json(json_entry):
# json_entry = json.loads(json_entry_as_string)
return Statistics(json_entry['downspeed'], json_entry['online'],
json_entry['upspeed'])
| 24.692308 | 68 | 0.660436 | 72 | 642 | 5.555556 | 0.305556 | 0.135 | 0.105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.241433 | 642 | 25 | 69 | 25.68 | 0.821355 | 0.165109 | 0 | 0 | 0 | 0 | 0.042065 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.357143 | false | 0 | 0 | 0.285714 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
0b2972337135863e1ccbf5b5b64430df5a6a08ca | 72 | py | Python | test.py | mythezone/ZMY-music | cd6511d7a89f9e6309861aca666fc8063fa0e344 | [
"MIT"
] | null | null | null | test.py | mythezone/ZMY-music | cd6511d7a89f9e6309861aca666fc8063fa0e344 | [
"MIT"
] | null | null | null | test.py | mythezone/ZMY-music | cd6511d7a89f9e6309861aca666fc8063fa0e344 | [
"MIT"
] | null | null | null | from music21 import *
b=corpus.parse('bach/bwv66.6')
b.show('musicxml') | 18 | 30 | 0.722222 | 12 | 72 | 4.333333 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075758 | 0.083333 | 72 | 4 | 31 | 18 | 0.712121 | 0 | 0 | 0 | 0 | 0 | 0.273973 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0b2dda597ed97560b2238119ccb257e1bb41f0a2 | 203 | py | Python | tests/demoproject/demo/urls.py | roman-karpovich/etools-validator | e5050a675d506f3d18a4703e8b73425d93919f0c | [
"Apache-2.0"
] | null | null | null | tests/demoproject/demo/urls.py | roman-karpovich/etools-validator | e5050a675d506f3d18a4703e8b73425d93919f0c | [
"Apache-2.0"
] | null | null | null | tests/demoproject/demo/urls.py | roman-karpovich/etools-validator | e5050a675d506f3d18a4703e8b73425d93919f0c | [
"Apache-2.0"
] | null | null | null | from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^sample/', include("demo.sample.urls", namespace="sample")),
url(r'^admin/', admin.site.urls),
]
| 25.375 | 70 | 0.694581 | 28 | 203 | 5.035714 | 0.535714 | 0.141844 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133005 | 203 | 7 | 71 | 29 | 0.801136 | 0 | 0 | 0 | 0 | 0 | 0.182266 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0b31dce3e651294d618ede3adc677cdad9b8f762 | 223 | py | Python | treasury_prime/models/person.py | odubno/treasury-prime-api | 89529ba478537fd9fdc5d2616faa7e6d3781cbe7 | [
"MIT"
] | null | null | null | treasury_prime/models/person.py | odubno/treasury-prime-api | 89529ba478537fd9fdc5d2616faa7e6d3781cbe7 | [
"MIT"
] | null | null | null | treasury_prime/models/person.py | odubno/treasury-prime-api | 89529ba478537fd9fdc5d2616faa7e6d3781cbe7 | [
"MIT"
] | null | null | null | import json
from treasury_prime.config import SANDBOX
import requests
def get_person_information(s: requests.Session, person_id: str) -> json:
person = s.get(SANDBOX + f"/person/{person_id}")
return person.json()
| 24.777778 | 72 | 0.748879 | 32 | 223 | 5.0625 | 0.5625 | 0.098765 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143498 | 223 | 8 | 73 | 27.875 | 0.848168 | 0 | 0 | 0 | 0 | 0 | 0.085202 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0b32e7eac6b47e20d35fc9c9d8c0c9f48a45e56a | 923 | py | Python | pycoin/ecdsa/encrypt.py | jaschadub/pycoin | 1e8d0d9fe20ce0347b97847bb529cd1bd84c7442 | [
"MIT"
] | 1,210 | 2015-01-02T13:36:28.000Z | 2022-03-30T00:52:22.000Z | pycoin/ecdsa/encrypt.py | impactog/pycoin | 3db6f82afa3054d8d07caca4909e1aed3de2fceb | [
"MIT"
] | 280 | 2015-01-05T23:16:47.000Z | 2022-02-22T22:02:17.000Z | pycoin/ecdsa/encrypt.py | impactog/pycoin | 3db6f82afa3054d8d07caca4909e1aed3de2fceb | [
"MIT"
] | 459 | 2015-01-10T00:15:57.000Z | 2022-03-16T12:04:40.000Z | def generate_shared_public_key(my_private_key, their_public_pair, generator):
"""
Two parties each generate a private key and share their public key with the
other party over an insecure channel. The shared public key can be generated by
either side, but not by eavesdroppers. You can then use the entropy from the
shared public key to created a common symmetric key for encryption. (This
is beyond of the scope of pycoin.)
See also <https://en.wikipedia.org/wiki/Key_exchange>
:param my_private_key: an integer private key
:param their_public_pair: a pair ``(x, y)`` representing a public key for the ``generator``
:param generator: a :class:`Generator <pycoin.ecdsa.Generator.Generator>`
:returns: a :class:`Point <pycoin.ecdsa.Point.Point>`, which can be used as a shared
public key.
"""
p = generator.Point(*their_public_pair)
return my_private_key * p
| 48.578947 | 95 | 0.726977 | 142 | 923 | 4.612676 | 0.507042 | 0.082443 | 0.091603 | 0.054962 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195016 | 923 | 18 | 96 | 51.277778 | 0.881561 | 0.769231 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
0b43847b14d46947ed2124ef0ab7e883f3874341 | 707 | py | Python | app/admin.py | mapoetto/group2_CTFLab | 5b492ce46875ea37a57701686897bd9613e2dd13 | [
"MIT"
] | 1 | 2021-10-15T14:37:33.000Z | 2021-10-15T14:37:33.000Z | app/admin.py | mapoetto/group2_CTFLab | 5b492ce46875ea37a57701686897bd9613e2dd13 | [
"MIT"
] | null | null | null | app/admin.py | mapoetto/group2_CTFLab | 5b492ce46875ea37a57701686897bd9613e2dd13 | [
"MIT"
] | null | null | null | # -*- encoding: utf-8 -*-
"""
License: MIT
Copyright (c) 2019 - present AppSeed.us
"""
from django.contrib import admin
from .models import User
from .models import Lab
from .models import CyberKillChain
from .models import Tag_Args
from .models import Tag_Level
from .models import CTFd_configs
from .models import Notifica, Notifica_vista, Statistiche
from .models import SSHTunnel_configs
# Register your models here.
admin.site.register(User)
admin.site.register(Lab)
admin.site.register(CyberKillChain)
admin.site.register(Tag_Args)
admin.site.register(Tag_Level)
admin.site.register(CTFd_configs)
admin.site.register(SSHTunnel_configs)
admin.site.register(Notifica)
admin.site.register(Statistiche)
| 26.185185 | 57 | 0.804809 | 99 | 707 | 5.656566 | 0.333333 | 0.144643 | 0.273214 | 0.067857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007837 | 0.097595 | 707 | 26 | 58 | 27.192308 | 0.869906 | 0.1471 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0b4ed7b6a187e87cd64114bf096512b8aeaa456e | 66 | py | Python | core/database/__init__.py | Smashulica/nebula8 | 010df165e3cc61e0154d20310fa972482ec0e7be | [
"Apache-2.0"
] | 19 | 2020-12-24T02:47:41.000Z | 2022-03-18T07:33:52.000Z | core/database/__init__.py | Smashulica/nebula8 | 010df165e3cc61e0154d20310fa972482ec0e7be | [
"Apache-2.0"
] | 22 | 2020-09-29T04:56:29.000Z | 2022-03-18T14:10:27.000Z | core/database/__init__.py | Smashulica/nebula8 | 010df165e3cc61e0154d20310fa972482ec0e7be | [
"Apache-2.0"
] | 15 | 2020-09-29T04:56:37.000Z | 2022-01-24T15:39:07.000Z | __all__ = ["db_connect","repository"]
from core.database import * | 22 | 37 | 0.742424 | 8 | 66 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106061 | 66 | 3 | 38 | 22 | 0.745763 | 0 | 0 | 0 | 0 | 0 | 0.298507 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0b549bc2c318a84e81c114c98a841feef25f9348 | 302 | py | Python | tesla-trade-bot.py | vishwaphansal7/Trading-Bot | 48faaaae5f64cdfba986328c5441fca197bceec4 | [
"MIT"
] | null | null | null | tesla-trade-bot.py | vishwaphansal7/Trading-Bot | 48faaaae5f64cdfba986328c5441fca197bceec4 | [
"MIT"
] | null | null | null | tesla-trade-bot.py | vishwaphansal7/Trading-Bot | 48faaaae5f64cdfba986328c5441fca197bceec4 | [
"MIT"
] | null | null | null | def get_data(tesla, start_date, end_date):
"""
Get data from Yahoo Finance
symbol: stock symbol
start_date: start date for data
end_date: end date for data
"""
import pandas_datareader.data as web
df = web.DataReader(tesla, "yahoo", start_date, end_date)
return df
| 27.454545 | 61 | 0.678808 | 45 | 302 | 4.377778 | 0.444444 | 0.182741 | 0.167513 | 0.162437 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.241722 | 302 | 10 | 62 | 30.2 | 0.860262 | 0.357616 | 0 | 0 | 0 | 0 | 0.030303 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 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 | 0 | 1 | 0 | 0 | 3 |
0b586cca073bc1a95c7270d097106d7b6613fd95 | 1,237 | py | Python | pylarklispy/parser.py | decorator-factory/py-lark-lispy | bafd11fb311fefbb2cb40563ef2e113eeb6b4ff5 | [
"MIT"
] | 1 | 2020-08-13T19:16:24.000Z | 2020-08-13T19:16:24.000Z | pylarklispy/parser.py | decorator-factory/py-lark-lispy | bafd11fb311fefbb2cb40563ef2e113eeb6b4ff5 | [
"MIT"
] | null | null | null | pylarklispy/parser.py | decorator-factory/py-lark-lispy | bafd11fb311fefbb2cb40563ef2e113eeb6b4ff5 | [
"MIT"
] | null | null | null | import json
from os.path import join, dirname, realpath
import lark
from . import entities
DIR = dirname(realpath(__file__))
GRAMMAR_FILENAME = join(DIR, "grammar.lark")
with open(GRAMMAR_FILENAME) as grammar_file:
grammar = grammar_file.read()
parser = lark.Lark(grammar, parser="lalr")
@lark.v_args(inline=True)
class Transformer(lark.Transformer):
@staticmethod
def ESCAPED_STRING(token):
return json.loads(str(token))
@staticmethod
def start(*e: entities.Entity):
return e
@staticmethod
def integer(token):
return entities.Integer(int(token))
@staticmethod
def string(s):
return entities.String(s)
@staticmethod
def atom(token):
return entities.Atom(str(token))
@staticmethod
def sigil_string(sigil_token, string):
return entities.SigilString(str(sigil_token), string)
@staticmethod
def name(token):
return entities.Name(str(token))
@staticmethod
def s_expr(*es: entities.Entity):
return entities.SExpr(*es)
@staticmethod
def vector(*es: entities.Entity):
return entities.Vector(*es)
@staticmethod
def quoted(subentity):
return entities.Quoted(subentity) | 22.089286 | 61 | 0.678254 | 146 | 1,237 | 5.650685 | 0.342466 | 0.181818 | 0.09697 | 0.083636 | 0.072727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216653 | 1,237 | 56 | 62 | 22.089286 | 0.851393 | 0 | 0 | 0.243902 | 0 | 0 | 0.012924 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.243902 | false | 0 | 0.097561 | 0.243902 | 0.609756 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
0b5e5e53d2672b1e80917066a74749b0dedf5a1e | 587 | py | Python | p2_continuous-control/networks/__init__.py | drah/deep-reinforcement-learning | 1ccc3681088975926b70680dbe93cf6448b94017 | [
"MIT"
] | 1 | 2021-01-02T03:18:49.000Z | 2021-01-02T03:18:49.000Z | p2_continuous-control/networks/__init__.py | drah/deep-reinforcement-learning | 1ccc3681088975926b70680dbe93cf6448b94017 | [
"MIT"
] | null | null | null | p2_continuous-control/networks/__init__.py | drah/deep-reinforcement-learning | 1ccc3681088975926b70680dbe93cf6448b94017 | [
"MIT"
] | null | null | null | import torch
from global_constant import k_device
from .network import Network
from .network import Actor
from .network import Critic
from .ddpg_actor import DDPGActor
from .ddpg_critic import DDPGCritic
def get_net(net_name, **kwargs) -> Network:
net = eval(net_name)(**kwargs)
net.to(k_device)
if 'load_path' in kwargs and kwargs['load_path']:
net.load(kwargs['load_path'])
return net
def get_actor(net_name, **kwargs) -> Actor:
return get_net(net_name, **kwargs)
def get_critic(net_name, **kwargs) -> Critic:
return get_net(net_name, **kwargs)
| 22.576923 | 53 | 0.722317 | 88 | 587 | 4.602273 | 0.295455 | 0.103704 | 0.192593 | 0.096296 | 0.17037 | 0.123457 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170358 | 587 | 25 | 54 | 23.48 | 0.831622 | 0 | 0 | 0.117647 | 0 | 0 | 0.045997 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.411765 | 0.117647 | 0.764706 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
0b5fee83e404789b28cffda4c1ba345d70313ddc | 258 | bzl | Python | for_workspace/ninja_build.bzl | matzipan/rules_foreign_cc | 07e1645dcc6c013b954d26b826fcd41f85585e55 | [
"Apache-2.0"
] | 2 | 2021-03-18T04:14:56.000Z | 2021-03-18T05:11:09.000Z | for_workspace/ninja_build.bzl | matzipan/rules_foreign_cc | 07e1645dcc6c013b954d26b826fcd41f85585e55 | [
"Apache-2.0"
] | null | null | null | for_workspace/ninja_build.bzl | matzipan/rules_foreign_cc | 07e1645dcc6c013b954d26b826fcd41f85585e55 | [
"Apache-2.0"
] | 1 | 2021-03-01T17:51:22.000Z | 2021-03-01T17:51:22.000Z | """ This module is deprecated and has been moved to `//toolchains/built_tools/...` """
load("//foreign_cc/built_tools:ninja_build.bzl", _ninja_tool = "ninja_tool")
load(":deprecation.bzl", "print_deprecation")
print_deprecation()
ninja_tool = _ninja_tool
| 28.666667 | 86 | 0.748062 | 35 | 258 | 5.171429 | 0.6 | 0.198895 | 0.154696 | 0.198895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096899 | 258 | 8 | 87 | 32.25 | 0.776824 | 0.302326 | 0 | 0 | 0 | 0 | 0.482558 | 0.232558 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
0b8e7167f461cf086a9959c3e677f416001290ee | 866 | py | Python | logs/test_logs.py | ravewillow6383/tutorials | 6e6e37ae2dd9afc74d9240f2388ba7b82f43b2f3 | [
"MIT"
] | 1 | 2020-05-29T18:50:04.000Z | 2020-05-29T18:50:04.000Z | logs/test_logs.py | ravewillow6383/tutorials | 6e6e37ae2dd9afc74d9240f2388ba7b82f43b2f3 | [
"MIT"
] | null | null | null | logs/test_logs.py | ravewillow6383/tutorials | 6e6e37ae2dd9afc74d9240f2388ba7b82f43b2f3 | [
"MIT"
] | null | null | null | from logs import reorder_logs
def test_exists():
assert reorder_logs
def test_vanilla():
logs = ["dig1 8 1 5 1","let1 art can","dig2 3 6","let2 own kit dig","let3 art zero"]
assert reorder_logs(logs) == ["let1 art can","let3 art zero","let2 own kit dig","dig1 8 1 5 1","dig2 3 6"]
def test_for_same_word_at_1():
logs = ["a1 9 2 3 1","g1 act car","zo4 4 7","ab1 off key dog","a8 act zoo"]
assert reorder_logs(logs) == ["g1 act car","a8 act zoo","ab1 off key dog","a1 9 2 3 1","zo4 4 7"]
def test_empty_list():
logs = []
assert reorder_logs(logs) == []
def test_all_alpha():
logs = ["g1 act car","ab1 off key dog","a8 act zoo"]
assert reorder_logs(logs) == ["g1 act car","a8 act zoo","ab1 off key dog"]
def test_all_digits():
logs = ["a1 9 2 3 1","zo4 4 7"]
assert reorder_logs(logs) == ["a1 9 2 3 1","zo4 4 7"]
| 27.935484 | 110 | 0.616628 | 166 | 866 | 3.096386 | 0.295181 | 0.149805 | 0.198444 | 0.20428 | 0.398833 | 0.367704 | 0.348249 | 0.348249 | 0.326848 | 0.268482 | 0 | 0.098675 | 0.215935 | 866 | 30 | 111 | 28.866667 | 0.658321 | 0 | 0 | 0 | 0 | 0 | 0.381503 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.333333 | false | 0 | 0.055556 | 0 | 0.388889 | 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 | 0 | 0 | 0 | 3 |
0b96a2f4ef7a0347c225ad22dc7f16d53e2451ca | 1,172 | py | Python | library/network.py | jstucken/Python-Overdrive | 151d58b82abb814560d3327b1e767bc1b57c14d2 | [
"MIT"
] | null | null | null | library/network.py | jstucken/Python-Overdrive | 151d58b82abb814560d3327b1e767bc1b57c14d2 | [
"MIT"
] | null | null | null | library/network.py | jstucken/Python-Overdrive | 151d58b82abb814560d3327b1e767bc1b57c14d2 | [
"MIT"
] | null | null | null | #
# This class allows Python to communicate via
# Useful in sending data from Python to the Database
# and getting a response for further processing in Python
#
# created by jstucken 14-6-2021
#import time
import subprocess
# BEGIN OUR CLASS
class Network:
def __init__(self):
pass
# Static method to get the local IP address of the raspi
# Uses a bash script on the machine to do this
@staticmethod
def getLocalIPAddress():
# get local ip address
local_ip_address = Network.getBashResponse("/home/pi/Python-Overdrive/shell_scripts/get_local_ip.sh");
return local_ip_address
# Static method which runs a local bash script or linux command and gets response data
@staticmethod
def getBashResponse(command):
#response = subprocess.run([command], stdout=subprocess.PIPE, universal_newlines=False).stdout.decode('utf-8')
response = subprocess.check_output(command, shell=True).decode('utf-8')
# strip out newlines
response = response.strip()
return response
| 27.255814 | 119 | 0.645904 | 142 | 1,172 | 5.239437 | 0.570423 | 0.047043 | 0.075269 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010804 | 0.289249 | 1,172 | 42 | 120 | 27.904762 | 0.882353 | 0.462457 | 0 | 0.153846 | 0 | 0 | 0.104712 | 0.095986 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0.076923 | 0.076923 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
0b98211e46ccafa7b1be178cc9722668c5d6bcb6 | 363 | py | Python | tests/MyGame/Example2/Monster.py | generalzgd/flatbuffers-as-objc | 1df5440f9e2f7a081be5ab8874cf6d38f741ef6f | [
"Apache-2.0"
] | null | null | null | tests/MyGame/Example2/Monster.py | generalzgd/flatbuffers-as-objc | 1df5440f9e2f7a081be5ab8874cf6d38f741ef6f | [
"Apache-2.0"
] | 1 | 2017-06-26T07:24:29.000Z | 2017-06-26T07:24:29.000Z | tests/MyGame/Example2/Monster.py | generalzgd/flatbuffers-as-objc | 1df5440f9e2f7a081be5ab8874cf6d38f741ef6f | [
"Apache-2.0"
] | null | null | null | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: Example2
import flatbuffers
class Monster(object):
__slots__ = ['_tab']
# Monster
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
def MonsterStart(builder): builder.StartObject(0)
def MonsterEnd(builder): return builder.EndObject()
| 22.6875 | 68 | 0.727273 | 43 | 363 | 6 | 0.697674 | 0.046512 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006645 | 0.170799 | 363 | 15 | 69 | 24.2 | 0.850498 | 0.258953 | 0 | 0 | 1 | 0 | 0.015094 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | false | 0 | 0.142857 | 0.142857 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
0ba06ef934a525d3801e233c6e2f124fb0a6df52 | 4,377 | py | Python | python/paddle/fluid/incubate/fleet/utils/fs.py | Huangheyl/Paddle | a1b640bc66a5cc9583de503e7406aeba67565e8d | [
"Apache-2.0"
] | 8 | 2019-06-16T12:36:11.000Z | 2021-03-05T05:33:21.000Z | python/paddle/fluid/incubate/fleet/utils/fs.py | zlsh80826/Paddle | c560a7d57aad990f374ebadd330351f18e2ca65f | [
"Apache-2.0"
] | 1 | 2020-09-10T09:05:52.000Z | 2020-09-10T09:06:22.000Z | python/paddle/fluid/incubate/fleet/utils/fs.py | zlsh80826/Paddle | c560a7d57aad990f374ebadd330351f18e2ca65f | [
"Apache-2.0"
] | 25 | 2019-12-07T02:14:14.000Z | 2021-12-30T06:16:30.000Z | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import subprocess
import multiprocessing
from datetime import datetime
import re
import copy
import errno
import time
import logging
import abc
from pathlib import PurePosixPath, Path
import shutil
__all__ = ['FS', 'LocalFS']
class ExecuteError(Exception):
pass
class FSFileExistsError(Exception):
pass
class FSFileNotExistsError(Exception):
pass
class FSTimeOut(Exception):
pass
class FSShellCmdAborted(ExecuteError):
pass
class FS(object):
@abc.abstractmethod
def ls_dir(self, fs_path):
raise NotImplementedError
@abc.abstractmethod
def is_file(self, fs_path):
raise NotImplementedError
@abc.abstractmethod
def is_dir(self, fs_path):
raise NotImplementedError
@abc.abstractmethod
def is_exist(self, fs_path):
raise NotImplementedError
@abc.abstractmethod
def upload(self, local_path, fs_path):
raise NotImplementedError
@abc.abstractmethod
def download(self, fs_path, local_path):
raise NotImplementedError
@abc.abstractmethod
def mkdirs(self, fs_path):
raise NotImplementedError
@abc.abstractmethod
def delete(self, fs_path):
raise NotImplementedError
@abc.abstractmethod
def need_upload_download(self):
raise NotImplementedError
@abc.abstractmethod
def rename(self, fs_src_path, fs_dst_path):
raise NotImplementedError
@abc.abstractmethod
def mv(self, fs_src_path, fs_dst_path, overwrite=False, test_exists=False):
raise NotImplementedError
@abc.abstractmethod
def upload_dir(self, local_dir, dest_dir):
raise NotImplementedError
@abc.abstractmethod
def list_dirs(self, fs_path):
raise NotImplementedError
@abc.abstractmethod
def touch(self, fs_path, exist_ok=True):
raise NotImplementedError
class LocalFS(FS):
def ls_dir(self, fs_path):
return [f for f in os.listdir(fs_path)]
def mkdirs(self, fs_path):
assert not os.path.isfile(fs_path), "{} is already a file".format(
fs_path)
os.system("mkdir -p {}".format(fs_path))
def rename(self, fs_src_path, fs_dst_path):
os.rename(fs_src_path, fs_dst_path)
def _rmr(self, fs_path):
shutil.rmtree(fs_path)
def _rm(self, fs_path):
os.remove(fs_path)
def delete(self, fs_path):
if not self.is_exist(fs_path):
return
if os.path.isfile(fs_path):
return self._rm(fs_path)
return self._rmr(fs_path)
def need_upload_download(self):
return False
def is_file(self, fs_path):
return os.path.isfile(fs_path)
def is_dir(self, fs_path):
return os.path.isdir(fs_path)
def is_exist(self, fs_path):
return os.path.exists(fs_path)
def touch(self, fs_path, exist_ok=True):
if self.is_exist(fs_path):
if exist_ok:
return
raise FSFileExistsError
return Path(fs_path).touch(exist_ok=True)
def mv(self, src_path, dst_path, overwrite=False, test_exists=False):
if not self.is_exist(src_path):
raise FSFileNotExistsError
if overwrite and self.is_exist(dst_path):
self.delete(dst_path)
if self.is_exist(dst_path):
raise FSFileExistsError
return self.rename(src_path, dst_path)
def list_dirs(self, fs_path):
"""
list directory under fs_path, and only give the pure name, not include the fs_path
"""
if not self.is_exist(fs_path):
return []
dirs = [
f for f in os.listdir(fs_path) if os.path.isdir(fs_path + "/" + f)
]
return dirs
| 24.18232 | 91 | 0.671921 | 580 | 4,377 | 4.893103 | 0.248276 | 0.084567 | 0.066949 | 0.187808 | 0.494362 | 0.380197 | 0.266385 | 0.218111 | 0.107118 | 0.065539 | 0 | 0.002432 | 0.248572 | 4,377 | 180 | 92 | 24.316667 | 0.860444 | 0.154215 | 0 | 0.513043 | 0 | 0 | 0.011172 | 0 | 0 | 0 | 0 | 0 | 0.008696 | 1 | 0.234783 | false | 0.043478 | 0.113043 | 0.043478 | 0.521739 | 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 | 0 | 1 | 0 | 0 | 3 |
0ba26f4f0e500f925f94c64e1318d2cdf8907ef9 | 1,288 | py | Python | APIServer/database/models.py | Denisfench/messaging | fb80aa7bfec9fce5b19052af596ce64d89da46cf | [
"MIT"
] | 1 | 2021-03-20T23:13:32.000Z | 2021-03-20T23:13:32.000Z | APIServer/database/models.py | Denisfench/messaging | fb80aa7bfec9fce5b19052af596ce64d89da46cf | [
"MIT"
] | null | null | null | APIServer/database/models.py | Denisfench/messaging | fb80aa7bfec9fce5b19052af596ce64d89da46cf | [
"MIT"
] | null | null | null | from APIServer import db
class Message(db.Model):
__tablename__ = "messages"
id = db.Column(db.Integer, primary_key=True)
event_datetime = db.Column(db.Text)
event_zipcode = db.Column(db.Text, default=None)
event_city = db.Column(db.Text, default=None)
event_state = db.Column(db.Text, default=None)
event_country = db.Column(db.Text, default=None)
event_type = db.Column(db.Text)
event_description = db.Column(db.Text, default=None)
event_priority = db.Column(db.Text, default=None)
msg_sender = db.Column(db.Text, default=None)
active = db.Column(db.Boolean, default=True)
class Thread(db.Model):
__tablename__ = "threads"
id = db.Column(db.Integer, primary_key=True)
first_comment_id = db.Column(db.Integer, default=-1)
last_comment_id = db.Column(db.Integer, default=-1)
class Comment(db.Model):
__tablename__ = "comments"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
content = db.Column(db.Text)
next_comment_id = db.Column(db.Integer, default=-1)
class Status(db.Model):
__tablename__ = "apps"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
app_id = db.Column(db.Text)
name = db.Column(db.Text)
released_at = db.Column(db.DateTime)
| 29.953488 | 68 | 0.700311 | 188 | 1,288 | 4.601064 | 0.25 | 0.19422 | 0.242775 | 0.19422 | 0.596532 | 0.552601 | 0.494798 | 0.321387 | 0.20578 | 0.115607 | 0 | 0.002799 | 0.167702 | 1,288 | 42 | 69 | 30.666667 | 0.804104 | 0 | 0 | 0.133333 | 0 | 0 | 0.020963 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.033333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
0bb3becb88d2433f0bea846efab186d71e3efddf | 4,339 | py | Python | test/test_cal.py | duckinator/boreutils | 3d40c11bf5e57240697adfb1bb693faf0ba82bab | [
"MIT"
] | 9 | 2015-11-05T04:33:50.000Z | 2021-12-15T14:36:04.000Z | test/test_cal.py | duckinator/boreutils | 3d40c11bf5e57240697adfb1bb693faf0ba82bab | [
"MIT"
] | 26 | 2020-05-22T07:57:54.000Z | 2021-09-06T20:18:22.000Z | test/test_cal.py | duckinator/boreutils | 3d40c11bf5e57240697adfb1bb693faf0ba82bab | [
"MIT"
] | 2 | 2020-06-01T05:14:22.000Z | 2022-03-08T14:56:10.000Z | """
Tests for POSIX-compatible `cal`.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cal.html
"""
from pathlib import Path
import time
from helpers import check_version, check, run
def test_version():
"""Check that we're using Boreutil's implementation."""
assert check_version("cal")
def test_missing_args():
"""Nothing to test: `cal` accepts 0-2 arguments."""
pass
def test_extra_args():
"""Too many args => error of the form `cal: ...`"""
assert run(["cal", "a", "b", "c"]).stderr.startswith("cal:")
assert run(["cal", "a", "b", "c"]).returncode > 0
def test_help():
"""Passing -h or --help should print help text."""
assert run(["cal", "-h"]).stdout.split(' ')[0] == 'Usage:'
assert run(["cal", "--help"]).stdout.split(' ')[0] == 'Usage:'
assert run(["cal", "-h"]).returncode > 0
assert run(["cal", "--help"]).returncode > 0
def test_main():
"""Running `cal <month> <year>` should return the correct values and
exit with a return code of 0."""
# == Potential problem years:
# === Month POSIX cal transitions from Julian -> Gregorian calendar.
assert check(["cal", "9", "1752"]).stdout == Path('test/test_cal/1752-9.txt').read_text()
# === Y2K
assert check(["cal", "2000"]).stdout == Path("test/test_cal/2000.txt").read_text()
# === 2038
assert check(["cal", "2038"]).stdout == Path("test/test_cal/2038.txt").read_text()
# === 2100 is not a leap year, but some leap year algorithms think it is.
assert check(["cal", "2100"]).stdout == Path("test/test_cal/2100.txt").read_text()
# One year per century for 1800-2900.
# The years chosen are prime numbers, to ensure they can not be leap years.
# The specific year numbers for each century were chosen arbitrarily.
assert check(["cal", "1801"]).stdout == Path("test/test_cal/1801.txt").read_text()
assert check(["cal", "1907"]).stdout == Path("test/test_cal/1907.txt").read_text()
assert check(["cal", "2003"]).stdout == Path("test/test_cal/2003.txt").read_text()
assert check(["cal", "2111"]).stdout == Path("test/test_cal/2111.txt").read_text()
assert check(["cal", "2207"]).stdout == Path("test/test_cal/2207.txt").read_text()
assert check(["cal", "2309"]).stdout == Path("test/test_cal/2309.txt").read_text()
assert check(["cal", "2459"]).stdout == Path("test/test_cal/2459.txt").read_text()
assert check(["cal", "2521"]).stdout == Path("test/test_cal/2521.txt").read_text()
assert check(["cal", "2609"]).stdout == Path("test/test_cal/2609.txt").read_text()
assert check(["cal", "2711"]).stdout == Path("test/test_cal/2711.txt").read_text()
assert check(["cal", "2819"]).stdout == Path("test/test_cal/2819.txt").read_text()
assert check(["cal", "2917"]).stdout == Path("test/test_cal/2917.txt").read_text()
# One year per eon for 3000 to 9000.
# The years chosen are prime numbers, to ensure they can not be leap years.
# The specific year numbers for each eon were chosen arbitrarily.
assert check(["cal", "3001"]).stdout == Path("test/test_cal/3001.txt").read_text()
assert check(["cal", "4003"]).stdout == Path("test/test_cal/4003.txt").read_text()
assert check(["cal", "5009"]).stdout == Path("test/test_cal/5009.txt").read_text()
assert check(["cal", "6011"]).stdout == Path("test/test_cal/6011.txt").read_text()
assert check(["cal", "7019"]).stdout == Path("test/test_cal/7019.txt").read_text()
assert check(["cal", "8039"]).stdout == Path("test/test_cal/8039.txt").read_text()
assert check(["cal", "9041"]).stdout == Path("test/test_cal/9041.txt").read_text()
# Year 9999 support is the last year required for POSIX compliance.
assert check(["cal", "9999"]).stdout == Path('test/test_cal/9999.txt').read_text()
# Check that individual months work.
assert check(["cal", "1", "2008"]).stdout == Path('test/test_cal/2008-1.txt').read_text()
assert check(["cal", "2", "2020"]).stdout == Path('test/test_cal/2020-2.txt').read_text()
assert check(["cal", "12", "2100"]).stdout == Path('test/test_cal/2100-12.txt').read_text()
# No arguments should result in the current month.
# We don't check the contents of the current month, just the name.
assert check(["cal"]).stdout.splitlines()[0].strip() == time.strftime("%B %Y")
| 49.306818 | 95 | 0.643697 | 640 | 4,339 | 4.265625 | 0.253125 | 0.11685 | 0.14359 | 0.178022 | 0.52674 | 0.334432 | 0.119414 | 0.063736 | 0.063736 | 0.063736 | 0 | 0.074335 | 0.150496 | 4,339 | 87 | 96 | 49.873563 | 0.666305 | 0.261811 | 0 | 0 | 0 | 0 | 0.275008 | 0.191489 | 0 | 0 | 0 | 0 | 0.795455 | 1 | 0.113636 | true | 0.022727 | 0.068182 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7e49dfae96a439ee9ce885ec611461fab9a9d33 | 672 | py | Python | src/python/detectors/insecure_hashing/insecure_hashing.py | martinschaef/amazon-codeguru-reviewer-python-detectors | 7452471b7ac5e1f2e1a0bfbd0f615d98f160e0e4 | [
"Apache-2.0"
] | 18 | 2022-01-27T22:50:22.000Z | 2022-02-15T17:41:24.000Z | src/python/detectors/insecure_hashing/insecure_hashing.py | martinschaef/amazon-codeguru-reviewer-python-detectors | 7452471b7ac5e1f2e1a0bfbd0f615d98f160e0e4 | [
"Apache-2.0"
] | 1 | 2022-01-31T21:36:18.000Z | 2022-02-22T17:09:54.000Z | src/python/detectors/insecure_hashing/insecure_hashing.py | martinschaef/amazon-codeguru-reviewer-python-detectors | 7452471b7ac5e1f2e1a0bfbd0f615d98f160e0e4 | [
"Apache-2.0"
] | 7 | 2022-02-10T21:50:50.000Z | 2022-03-28T14:21:10.000Z | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# {fact rule=insecure-hashing@v1.0 defects=1}
def hashing_noncompliant():
import hashlib
from hashlib import pbkdf2_hmac
# Noncompliant: insecure hashing algorithm used.
derivedkey = hashlib.pbkdf2_hmac('sha224', password, salt, 100000)
derivedkey.hex()
# {/fact}
# {fact rule=insecure-hashing@v1.0 defects=0}
def hashing_compliant():
import hashlib
from hashlib import pbkdf2_hmac
# Compliant: secure hashing algorithm used.
derivedkey = hashlib.pbkdf2_hmac('sha256', password, salt, 100000)
derivedkey.hex()
# {/fact}
| 30.545455 | 70 | 0.72619 | 84 | 672 | 5.738095 | 0.488095 | 0.082988 | 0.06639 | 0.095436 | 0.643154 | 0.643154 | 0.497925 | 0 | 0 | 0 | 0 | 0.053571 | 0.166667 | 672 | 21 | 71 | 32 | 0.807143 | 0.440476 | 0 | 0.6 | 0 | 0 | 0.032787 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
e7e76853eca17accd8c0dd5332dd0b48c23938f8 | 2,596 | py | Python | ascetic/contrib/versioning/transaction.py | emacsway/ascetic | a9f2c10af90bfedaa3ec58589b40ef7a677cd712 | [
"MIT"
] | 17 | 2015-09-05T21:43:51.000Z | 2022-03-05T13:28:15.000Z | ascetic/contrib/versioning/transaction.py | emacsway/ascetic | a9f2c10af90bfedaa3ec58589b40ef7a677cd712 | [
"MIT"
] | null | null | null | ascetic/contrib/versioning/transaction.py | emacsway/ascetic | a9f2c10af90bfedaa3ec58589b40ef7a677cd712 | [
"MIT"
] | null | null | null | from ascetic.contrib.versioning.interfaces import ITransaction, ITransactionManager
class DummyTransaction(ITransaction):
def __init__(self, changeset_repository, revision_repository):
"""
:type changeset_repository: ascetic.contrib.versioning.interfaces.IChangesetRepository
:type revision_repository: ascetic.contrib.versioning.interfaces.IRevisionRepository
"""
self._revision_repository = revision_repository
self._changeset_repository = changeset_repository
def add_object(self, obj):
pass
def begin(self):
return Transaction(self._changeset_repository, self._revision_repository)
def commit(self):
return self
def rollback(self):
return self
def is_null(self):
return True
class Transaction(ITransaction):
def __init__(self, changeset_repository, revision_repository):
"""
:type changeset_repository: ascetic.contrib.versioning.interfaces.IChangesetRepository
:type revision_repository: ascetic.contrib.versioning.interfaces.IRevisionRepository
"""
self._revision_repository = revision_repository
self._changeset_repository = changeset_repository
self._stamp = self._changeset_repository.next()
self._objects = list()
self._committed = set()
def add_object(self, obj):
self._objects.append(obj)
def begin(self):
return SavePoint(self)
def commit(self):
for obj in self._objects:
obj_id = self._get_object_id(obj)
if obj_id not in self._committed:
self._revision_repository.commit(obj, self._stamp)
self._committed.add(obj_id)
def rollback(self):
return DummyTransaction(self._changeset_repository, self._revision_repository)
def is_null(self):
return False
@staticmethod
def _get_object_id(obj):
try:
return 0, hash(obj)
except TypeError:
return 1, id(obj)
class SavePoint(ITransaction):
def __init__(self, parent):
"""
:type parent: ascetic.contrib.versioning.interfaces.ITransaction
"""
self._parent = parent
self._objects = list()
def add_object(self, obj):
self._objects.append(obj)
def begin(self):
return SavePoint(self)
def commit(self):
for obj in self._objects:
self._parent.add_object(obj)
return self._parent
def rollback(self):
return self._parent
def is_null(self):
return False
| 28.217391 | 94 | 0.664484 | 271 | 2,596 | 6.088561 | 0.199262 | 0.126667 | 0.097576 | 0.123636 | 0.618788 | 0.565455 | 0.538182 | 0.48 | 0.48 | 0.48 | 0 | 0.001033 | 0.254237 | 2,596 | 91 | 95 | 28.527473 | 0.85124 | 0.157165 | 0 | 0.603448 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.327586 | false | 0.017241 | 0.017241 | 0.172414 | 0.62069 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e7f9c4e356ba6db08ea3d20dbcb30a579ceabb2f | 153 | py | Python | mayan/apps/authentication/dependencies.py | bonitobonita24/Mayan-EDMS | 7845fe0e1e83c81f5d227a16116397a3d3883b85 | [
"Apache-2.0"
] | 343 | 2015-01-05T14:19:35.000Z | 2018-12-10T19:07:48.000Z | mayan/apps/authentication/dependencies.py | bonitobonita24/Mayan-EDMS | 7845fe0e1e83c81f5d227a16116397a3d3883b85 | [
"Apache-2.0"
] | 191 | 2015-01-03T00:48:19.000Z | 2018-11-30T09:10:25.000Z | mayan/apps/authentication/dependencies.py | bonitobonita24/Mayan-EDMS | 7845fe0e1e83c81f5d227a16116397a3d3883b85 | [
"Apache-2.0"
] | 114 | 2015-01-08T20:21:05.000Z | 2018-12-10T19:07:53.000Z | from mayan.apps.dependencies.classes import PythonDependency
PythonDependency(
module=__name__, name='django-auth-ldap', version_string='==4.0.0'
)
| 25.5 | 70 | 0.777778 | 19 | 153 | 6 | 0.842105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021583 | 0.091503 | 153 | 5 | 71 | 30.6 | 0.798561 | 0 | 0 | 0 | 0 | 0 | 0.150327 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7fc1a2aa6197e2c5876227e174ff91722ad86ff | 169 | py | Python | test/raw/run_program/python_script_╬▓.py | gentzkow/gslab_make | 148e3d1841f6ade5c49fe5dac8e24f99559abb1f | [
"MIT"
] | 1 | 2019-08-15T21:59:26.000Z | 2019-08-15T21:59:26.000Z | test/raw/run_program/python_script_╬▓.py | gslab-econ/gslab_make | 148e3d1841f6ade5c49fe5dac8e24f99559abb1f | [
"MIT"
] | 15 | 2020-01-14T00:18:17.000Z | 2021-09-07T23:15:43.000Z | test/raw/run_program/python_script_╬▓.py | gslab-econ/gslab_make | 148e3d1841f6ade5c49fe5dac8e24f99559abb1f | [
"MIT"
] | 2 | 2021-02-19T20:19:25.000Z | 2021-09-12T02:16:18.000Z | from __future__ import print_function
with open('test/output/output.csv', 'w') as f:
for i in range(11):
print(i, file = f)
print('Test script complete') | 24.142857 | 46 | 0.662722 | 27 | 169 | 3.962963 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014925 | 0.207101 | 169 | 7 | 47 | 24.142857 | 0.783582 | 0 | 0 | 0 | 0 | 0 | 0.252941 | 0.129412 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.6 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
f00130660a0480c92620e6c660702ca21460e980 | 73 | py | Python | setting.py | LEEJ0NGWAN/VRP-Backend-python | d84335101899250bdf9879aceec8afaabec4dec7 | [
"MIT"
] | null | null | null | setting.py | LEEJ0NGWAN/VRP-Backend-python | d84335101899250bdf9879aceec8afaabec4dec7 | [
"MIT"
] | null | null | null | setting.py | LEEJ0NGWAN/VRP-Backend-python | d84335101899250bdf9879aceec8afaabec4dec7 | [
"MIT"
] | null | null | null | aws_access_key_id=None
aws_secret_access_key=None
img_bucket_name=None
| 12.166667 | 26 | 0.890411 | 14 | 73 | 4.071429 | 0.642857 | 0.315789 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068493 | 73 | 5 | 27 | 14.6 | 0.838235 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f00f76b5a5f462ca8519e71069cb5e740c96320f | 2,374 | py | Python | polling_stations/apps/addressbase/migrations/0006_auto_20170927_1215.py | mtravis/UK-Polling-Stations | 26e0331dc29253dc436a0462ffaa01e974c5dc52 | [
"BSD-3-Clause"
] | 29 | 2015-03-10T08:41:34.000Z | 2022-01-12T08:51:38.000Z | polling_stations/apps/addressbase/migrations/0006_auto_20170927_1215.py | mtravis/UK-Polling-Stations | 26e0331dc29253dc436a0462ffaa01e974c5dc52 | [
"BSD-3-Clause"
] | 4,112 | 2015-04-01T21:27:38.000Z | 2022-03-31T19:22:11.000Z | polling_stations/apps/addressbase/migrations/0006_auto_20170927_1215.py | mtravis/UK-Polling-Stations | 26e0331dc29253dc436a0462ffaa01e974c5dc52 | [
"BSD-3-Clause"
] | 31 | 2015-03-18T14:52:50.000Z | 2022-02-24T10:31:07.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("addressbase", "0005_auto_20170927_1128")]
operations = [
migrations.CreateModel(
name="Onsud",
fields=[
(
"uprn",
models.CharField(primary_key=True, max_length=12, serialize=False),
),
("ctry_flag", models.CharField(blank=True, max_length=1)),
("cty", models.CharField(blank=True, max_length=9)),
("lad", models.CharField(blank=True, max_length=9)),
("ward", models.CharField(blank=True, max_length=9)),
("hlthau", models.CharField(blank=True, max_length=9)),
("ctry", models.CharField(blank=True, max_length=9)),
("rgn", models.CharField(blank=True, max_length=9)),
("pcon", models.CharField(blank=True, max_length=9)),
("eer", models.CharField(blank=True, max_length=9)),
("ttwa", models.CharField(blank=True, max_length=9)),
("nuts", models.CharField(blank=True, max_length=9)),
("park", models.CharField(blank=True, max_length=9)),
("oa11", models.CharField(blank=True, max_length=9)),
("lsoa11", models.CharField(blank=True, max_length=9)),
("msoa11", models.CharField(blank=True, max_length=9)),
("parish", models.CharField(blank=True, max_length=9)),
("wz11", models.CharField(blank=True, max_length=9)),
("ccg", models.CharField(blank=True, max_length=9)),
("bua11", models.CharField(blank=True, max_length=9)),
("buasd11", models.CharField(blank=True, max_length=9)),
("ruc11", models.CharField(blank=True, max_length=2)),
("oac11", models.CharField(blank=True, max_length=3)),
("lep1", models.CharField(blank=True, max_length=9)),
("lep2", models.CharField(blank=True, max_length=9)),
("pfa", models.CharField(blank=True, max_length=9)),
("imd", models.CharField(blank=True, max_length=5)),
],
),
migrations.DeleteModel(name="Onsad"),
]
| 48.44898 | 87 | 0.556445 | 254 | 2,374 | 5.055118 | 0.271654 | 0.315421 | 0.273364 | 0.485981 | 0.685358 | 0.685358 | 0.582555 | 0 | 0 | 0 | 0 | 0.037168 | 0.286015 | 2,374 | 48 | 88 | 49.458333 | 0.720354 | 0.008846 | 0 | 0.047619 | 0 | 0 | 0.069758 | 0.009783 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.047619 | 0 | 0.119048 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f010da20e3398ef46ec24192b5cadfa8f1706457 | 85 | py | Python | digitalSignalProcessing/imgio.py | 17ec084/grade2-2 | b0ca311f78bc47aab967ad67960ac9213393eac4 | [
"MIT"
] | null | null | null | digitalSignalProcessing/imgio.py | 17ec084/grade2-2 | b0ca311f78bc47aab967ad67960ac9213393eac4 | [
"MIT"
] | null | null | null | digitalSignalProcessing/imgio.py | 17ec084/grade2-2 | b0ca311f78bc47aab967ad67960ac9213393eac4 | [
"MIT"
] | null | null | null | import cv2
img = cv2.imread("Lenna.jpg", 1)
cv2.imshow("souce", img)
cv2.waitKey(0) | 14.166667 | 32 | 0.682353 | 15 | 85 | 3.866667 | 0.733333 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 0.117647 | 85 | 6 | 33 | 14.166667 | 0.693333 | 0 | 0 | 0 | 0 | 0 | 0.162791 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f016a30551dcd67d72448510d34be8e427481dad | 1,026 | py | Python | cdap-authentication-clients/python/cdap_auth_client/credential.py | ThalesGroup/cdap-clients | 46c31377d3f3652bb0af1b461905aca4bae792ce | [
"Apache-2.0"
] | 1 | 2020-02-08T08:45:47.000Z | 2020-02-08T08:45:47.000Z | cdap-authentication-clients/python/cdap_auth_client/credential.py | ThalesGroup/cdap-clients | 46c31377d3f3652bb0af1b461905aca4bae792ce | [
"Apache-2.0"
] | 2 | 2020-03-09T11:31:19.000Z | 2020-03-11T08:00:51.000Z | cdap-authentication-clients/python/cdap_auth_client/credential.py | ThalesGroup/cdap-clients | 46c31377d3f3652bb0af1b461905aca4bae792ce | [
"Apache-2.0"
] | 5 | 2019-05-17T10:44:49.000Z | 2022-03-21T18:54:58.000Z | # -*- coding: utf-8 -*-
# Copyright © 2014 Cask Data, Inc.
#
# 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.
class Credential(object):
"""
Represents a credential required for authentication.
"""
def __init__(self, name, description, secret):
self.__name = name
self.__description = description
self.__secret = secret
def get_name(self):
return self.__name
def get_description(self):
return self.__description
def is_secret(self):
return self.__secret
| 29.314286 | 79 | 0.704678 | 140 | 1,026 | 5.035714 | 0.578571 | 0.085106 | 0.059574 | 0.04539 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011166 | 0.214425 | 1,026 | 34 | 80 | 30.176471 | 0.862283 | 0.610136 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0 | 0 | 0.272727 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f023dc396d2d5831cbb947b11e956621c150b65d | 675 | py | Python | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content/block_structure/admin.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 3 | 2021-12-15T04:58:18.000Z | 2022-02-06T12:15:37.000Z | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content/block_structure/admin.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | null | null | null | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content/block_structure/admin.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 1 | 2019-01-02T14:38:50.000Z | 2019-01-02T14:38:50.000Z | """
Django Admin for Block Structures.
"""
from config_models.admin import ConfigurationModelAdmin
from django.contrib import admin
from .config.models import BlockStructureConfiguration
class BlockStructureAdmin(ConfigurationModelAdmin):
"""
Configuration Admin for BlockStructureConfiguration.
"""
def get_displayable_field_names(self):
"""
Excludes unused 'enabled field from super's list.
"""
displayable_field_names = super().get_displayable_field_names()
displayable_field_names.remove('enabled')
return displayable_field_names
admin.site.register(BlockStructureConfiguration, BlockStructureAdmin)
| 25.961538 | 71 | 0.754074 | 64 | 675 | 7.75 | 0.484375 | 0.16129 | 0.211694 | 0.096774 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173333 | 675 | 25 | 72 | 27 | 0.888889 | 0.202963 | 0 | 0 | 0 | 0 | 0.014228 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f03c8d503ed4e6784d6124ed0d89f8266fa99f75 | 154 | py | Python | src/tree_builder/arch/py2.py | AXGKl/devapps | 249ff369de512dcde5fdc83e6d461f82ad6c667f | [
"BSD-2-Clause"
] | null | null | null | src/tree_builder/arch/py2.py | AXGKl/devapps | 249ff369de512dcde5fdc83e6d461f82ad6c667f | [
"BSD-2-Clause"
] | null | null | null | src/tree_builder/arch/py2.py | AXGKl/devapps | 249ff369de512dcde5fdc83e6d461f82ad6c667f | [
"BSD-2-Clause"
] | null | null | null | def cls_with_meta(mc, attrs):
class _x_(object):
__metaclass__ = mc
for k, v in attrs.items():
setattr(_x_, k, v)
return _x_
| 19.25 | 30 | 0.584416 | 23 | 154 | 3.391304 | 0.73913 | 0.051282 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.305195 | 154 | 7 | 31 | 22 | 0.728972 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
f04c8334fa6c362f62bb7e878fc89efc6dd15d0f | 1,185 | py | Python | qcloudsdkathena/QueryRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdkathena/QueryRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdkathena/QueryRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class QueryRequest(Request):
def __init__(self):
super(QueryRequest, self).__init__(
'athena', 'qcloudcliV1', 'Query', 'athena.api.qcloud.com')
def get_AccessChannelCode(self):
return self.get_params().get('AccessChannelCode')
def set_AccessChannelCode(self, AccessChannelCode):
self.add_param('AccessChannelCode', AccessChannelCode)
def get_InstanceId(self):
return self.get_params().get('InstanceId')
def set_InstanceId(self, InstanceId):
self.add_param('InstanceId', InstanceId)
def get_Query(self):
return self.get_params().get('Query')
def set_Query(self, Query):
self.add_param('Query', Query)
def get_RelatedKnowledgeMaxNum(self):
return self.get_params().get('RelatedKnowledgeMaxNum')
def set_RelatedKnowledgeMaxNum(self, RelatedKnowledgeMaxNum):
self.add_param('RelatedKnowledgeMaxNum', RelatedKnowledgeMaxNum)
def get_SessionId(self):
return self.get_params().get('SessionId')
def set_SessionId(self, SessionId):
self.add_param('SessionId', SessionId)
| 29.625 | 72 | 0.694515 | 125 | 1,185 | 6.36 | 0.232 | 0.037736 | 0.08805 | 0.106918 | 0.163522 | 0.163522 | 0 | 0 | 0 | 0 | 0 | 0.002075 | 0.186498 | 1,185 | 39 | 73 | 30.384615 | 0.822614 | 0.017722 | 0 | 0 | 0 | 0 | 0.145439 | 0.055938 | 0 | 0 | 0 | 0 | 0 | 1 | 0.44 | false | 0 | 0.04 | 0.2 | 0.72 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f0610c08962765dfba4dd4e3532477580c04b0be | 4,485 | py | Python | app/models/Anamnese.py | galbino/miocardiopediatra | 8b60bbce45d15616058a81f6c329f6eaa063f07f | [
"MIT"
] | null | null | null | app/models/Anamnese.py | galbino/miocardiopediatra | 8b60bbce45d15616058a81f6c329f6eaa063f07f | [
"MIT"
] | 2 | 2019-11-06T00:37:17.000Z | 2019-11-07T23:10:06.000Z | app/models/Anamnese.py | galbino/miocardiopediatra | 8b60bbce45d15616058a81f6c329f6eaa063f07f | [
"MIT"
] | null | null | null | from app import db
from uuid import uuid1
from sqlalchemy.dialects.mysql import BIGINT, TINYINT
from datetime import datetime
class AnamneseQuestion(db.Model):
__tablename__ = "AnamneseQuestion"
id = db.Column("id", BIGINT(unsigned=True), primary_key=True)
label = db.Column(db.JSON)
value_weight_miocardite = db.Column(TINYINT)
value_weight_miocardiopatia = db.Column(TINYINT)
weight_miocardite = db.Column(db.Integer)
weight_miocardiopatia = db.Column(db.Integer)
required = db.Column(TINYINT)
template_id = db.Column(BIGINT(unsigned=True), db.ForeignKey("AnamneseTemplate.id"))
answers = db.relationship("UserAnamneseAnswers", lazy='select', cascade='delete, save-update')
def __init__(self):
self.id = uuid1().int >> 64
@property
def id_(self):
return str(self.id)
def get_label(self, lang):
return self.label.get(lang)
def as_dict(self, lang):
return {"id": self.id_, "label": self.label.get(lang), "required": self.required}
def as_dict_calc(self):
return {"weight_miocardite": self.weight_miocardite, "weight_miocardiopatia": self.weight_miocardiopatia, "value_weight_miocardiopatia": self.value_weight_miocardiopatia, "value_weight_miocardite": self.value_weight_miocardite}
class AnamneseTemplate(db.Model):
__tablename__ = "AnamneseTemplate"
id = db.Column("id", BIGINT(unsigned=True), primary_key=True)
name = db.Column(db.String(500))
questions = db.relationship("AnamneseQuestion", lazy='select', cascade='delete, save-update')
def __init__(self):
self.id = uuid1().int >> 64
@property
def id_(self):
return str(self.id)
def as_dict(self):
return {"id": self.id_, "name": self.name}
def as_dict_template(self, lang):
return {"id": self.id_, "name": self.name, "questions": [question.as_dict(lang) for question in self.questions]}
class UserAnamnese(db.Model):
__tablename__ = "UserAnamnese"
id = db.Column("id", BIGINT(unsigned=True), primary_key=True)
template_id = db.Column(BIGINT(unsigned=True), db.ForeignKey("AnamneseTemplate.id"), primary_key=True)
user_id = db.Column(BIGINT(unsigned=True), db.ForeignKey("User.id"), primary_key=True)
doctor_id = db.Column(BIGINT(unsigned=True), db.ForeignKey("User.id"), primary_key=True)
last_update = db.Column(db.DATETIME, default=datetime.utcnow, onupdate=datetime.utcnow)
creation_date = db.Column(db.DATETIME, default=datetime.utcnow)
answers = db.relationship("UserAnamneseAnswers", lazy='select', cascade="delete, delete-orphan, save-update")
anamnese_template = db.relationship("AnamneseTemplate", lazy='select')
user = db.relationship("User", lazy='select', primaryjoin="UserAnamnese.user_id == User.id")
doctor = db.relationship("User", lazy='select', primaryjoin="UserAnamnese.doctor_id == User.id")
@property
def id_(self):
return str(self.id)
def __init__(self, template_id, user_id, doctor_id):
self.id = uuid1().int >> 64
self.template_id = template_id
self.user_id = user_id
self.doctor_id = doctor_id
def as_dict_short(self):
return {"template": self.anamnese_template.as_dict(), "user_id": self.user_id, "user_name": self.user.name, "creation_date": self.creation_date, "last_update": self.last_update, "anamnese_id": self.id_}
def as_dict(self, lang):
return {"template": self.anamnese_template.as_dict(), "user_id": self.user_id, "doctor_id": self.doctor_id, "questions": [answer.as_dict(lang) for answer in self.answers], "anamnese_id": self.id_}
def as_dict_calc(self):
return [answer.as_dict_calc() for answer in self.answers]
class UserAnamneseAnswers(db.Model):
__tablename__ = "UserAnamneseAnswers"
user_anamnese_id = db.Column(BIGINT(unsigned=True), db.ForeignKey("UserAnamnese.id", ondelete='CASCADE'), primary_key=True)
question_id = db.Column(BIGINT(unsigned=True), db.ForeignKey("AnamneseQuestion.id"), primary_key=True)
answer = db.Column(TINYINT)
question = db.relationship("AnamneseQuestion", lazy='select')
user_anamnese = db.relationship("UserAnamnese", lazy='select')
@property
def id_(self):
return str(self.id)
def as_dict(self, lang):
return {"question": self.question.get_label(lang), "answer": self.answer}
def as_dict_calc(self):
return {**self.question.as_dict_calc(), "answer": self.answer} | 42.714286 | 235 | 0.704571 | 581 | 4,485 | 5.225473 | 0.13253 | 0.050066 | 0.029644 | 0.031621 | 0.50527 | 0.447299 | 0.41469 | 0.326746 | 0.255599 | 0.244071 | 0 | 0.003441 | 0.157637 | 4,485 | 105 | 236 | 42.714286 | 0.800159 | 0 | 0 | 0.325 | 0 | 0 | 0.155818 | 0.020731 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2125 | false | 0 | 0.05 | 0.175 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f074a10656fa4a0aa68deaccf7a3bef2f85ebe7e | 279 | py | Python | sporting_webapp/nfl_package/admin.py | plopez9/chipy_sports_app_2.0 | 39b337238d0a55bfe842cb60ea9fe4724426fbf0 | [
"MIT"
] | null | null | null | sporting_webapp/nfl_package/admin.py | plopez9/chipy_sports_app_2.0 | 39b337238d0a55bfe842cb60ea9fe4724426fbf0 | [
"MIT"
] | null | null | null | sporting_webapp/nfl_package/admin.py | plopez9/chipy_sports_app_2.0 | 39b337238d0a55bfe842cb60ea9fe4724426fbf0 | [
"MIT"
] | 1 | 2019-10-08T17:39:08.000Z | 2019-10-08T17:39:08.000Z | from django.contrib import admin
# Register your models here.
from .NFLmodels import NflSummary, NflStats, DefensiveSummary, DefensiveStats
admin.site.register(NflSummary)
admin.site.register(NflStats)
admin.site.register(DefensiveSummary)
admin.site.register(DefensiveStats)
| 25.363636 | 77 | 0.835125 | 32 | 279 | 7.28125 | 0.46875 | 0.154506 | 0.291845 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082437 | 279 | 10 | 78 | 27.9 | 0.910156 | 0.09319 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b2baacd82de7614b55528723c20d6df70e622010 | 96 | py | Python | reid/datasets/__init__.py | ZoRoronoa/Camera-Aware-Proxy | 352f900bbae330f18c2bfe2b3f2516fb4e31adea | [
"Apache-2.0"
] | 37 | 2021-02-05T11:49:17.000Z | 2022-03-13T15:42:40.000Z | reid/datasets/__init__.py | ZoRoronoa/Camera-Aware-Proxy | 352f900bbae330f18c2bfe2b3f2516fb4e31adea | [
"Apache-2.0"
] | 7 | 2021-03-30T01:33:40.000Z | 2022-03-24T07:54:33.000Z | reid/datasets/__init__.py | ZoRoronoa/Camera-Aware-Proxy | 352f900bbae330f18c2bfe2b3f2516fb4e31adea | [
"Apache-2.0"
] | 9 | 2021-03-06T02:43:55.000Z | 2022-03-26T07:32:19.000Z | from __future__ import absolute_import
from .target_dataset import DA
__all__ = [
'DA',
]
| 12 | 38 | 0.729167 | 12 | 96 | 5 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197917 | 96 | 7 | 39 | 13.714286 | 0.779221 | 0 | 0 | 0 | 0 | 0 | 0.020833 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b2fb1f1224bd16db7441452949c2f2fa5f466455 | 241 | py | Python | binary_search/bs_temp.py | l1n4n/leetcode_by_topics | bb53a4aa9bf9ff6c9a32afe99ba9b70cdeed0d61 | [
"CC0-1.0"
] | null | null | null | binary_search/bs_temp.py | l1n4n/leetcode_by_topics | bb53a4aa9bf9ff6c9a32afe99ba9b70cdeed0d61 | [
"CC0-1.0"
] | null | null | null | binary_search/bs_temp.py | l1n4n/leetcode_by_topics | bb53a4aa9bf9ff6c9a32afe99ba9b70cdeed0d61 | [
"CC0-1.0"
] | null | null | null | # A binary search template
"""
left, right = 0, len(array) - 1
while left <= right:
mid = left + (right - left) // 2
if array[mid] == target:
break or return result
elif array[mid] < target:
left = mid + 1
else:
right = mid - 1
""" | 20.083333 | 33 | 0.60166 | 37 | 241 | 3.918919 | 0.567568 | 0.186207 | 0.193103 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027473 | 0.244813 | 241 | 12 | 34 | 20.083333 | 0.769231 | 1.253112 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6529b5a8670381f77fbfd8d84457a86bcfc52b5b | 412 | py | Python | test/test_slimta_policy.py | nanojob/python-slimta | 70b9c633756a56afaf1fdd53c5ead6d0001036e7 | [
"MIT"
] | 141 | 2015-01-24T23:59:18.000Z | 2022-01-30T16:36:37.000Z | test/test_slimta_policy.py | nanojob/python-slimta | 70b9c633756a56afaf1fdd53c5ead6d0001036e7 | [
"MIT"
] | 106 | 2015-01-13T22:49:07.000Z | 2021-02-17T15:14:11.000Z | test/test_slimta_policy.py | nanojob/python-slimta | 70b9c633756a56afaf1fdd53c5ead6d0001036e7 | [
"MIT"
] | 43 | 2015-07-29T14:55:09.000Z | 2021-09-24T22:30:38.000Z |
import unittest
from slimta.policy import QueuePolicy, RelayPolicy
class TestPolicy(unittest.TestCase):
def test_queuepolicy_interface(self):
qp = QueuePolicy()
self.assertRaises(NotImplementedError, qp.apply, None)
def test_relaypolicy_interface(self):
rp = RelayPolicy()
self.assertRaises(NotImplementedError, rp.apply, None)
# vim:et:fdm=marker:sts=4:sw=4:ts=4
| 21.684211 | 62 | 0.720874 | 48 | 412 | 6.104167 | 0.583333 | 0.047782 | 0.238908 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008902 | 0.182039 | 412 | 18 | 63 | 22.888889 | 0.860534 | 0.080097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 1 | 0.222222 | false | 0 | 0.222222 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
e8dfdcad2934f88fde5963856eb4fa05da2279b3 | 1,435 | py | Python | src/geoserver/workspace.py | tethysplatform/gsconfig | 3d93c741e6317be4679a0b2e0916d74f40fba443 | [
"MIT"
] | 1 | 2021-04-20T03:41:25.000Z | 2021-04-20T03:41:25.000Z | src/geoserver/workspace.py | tethysplatform/gsconfig | 3d93c741e6317be4679a0b2e0916d74f40fba443 | [
"MIT"
] | null | null | null | src/geoserver/workspace.py | tethysplatform/gsconfig | 3d93c741e6317be4679a0b2e0916d74f40fba443 | [
"MIT"
] | null | null | null | """
gsconfig is a python library for manipulating a GeoServer instance via the GeoServer RESTConfig API.
The project is distributed under a MIT License .
"""
__author__ = "David Winslow"
__copyright__ = "Copyright 2018 Aquaveo, Copyright 2012-2015 Boundless, Copyright 2010-2012 OpenPlans"
__license__ = "MIT"
from geoserver.support import xml_property, write_bool, ResourceInfo, url
def workspace_from_index(catalog, node):
name = node.find("name")
return Workspace(catalog, name.text)
class Workspace(ResourceInfo):
resource_type = "workspace"
def __init__(self, catalog, name):
super(Workspace, self).__init__()
self.catalog = catalog
self.name = name
@property
def href(self):
return url(self.catalog.service_url, ["workspaces", self.name + ".xml"])
@property
def coveragestore_url(self):
return url(self.catalog.service_url, ["workspaces", self.name, "coveragestores.xml"])
@property
def datastore_url(self):
return url(self.catalog.service_url, ["workspaces", self.name, "datastores.xml"])
@property
def wmsstore_url(self):
return "%s/workspaces/%s/wmsstores.xml" % (self.catalog.service_url, self.name)
enabled = xml_property("enabled", lambda x: x.lower() == 'true')
writers = dict(
enabled=write_bool("enabled")
)
def __repr__(self):
return "%s @ %s" % (self.name, self.href)
| 28.7 | 102 | 0.683624 | 174 | 1,435 | 5.41954 | 0.408046 | 0.051962 | 0.076352 | 0.089077 | 0.171792 | 0.171792 | 0.171792 | 0.171792 | 0.171792 | 0.171792 | 0 | 0.017346 | 0.196516 | 1,435 | 49 | 103 | 29.285714 | 0.80052 | 0.10453 | 0 | 0.129032 | 0 | 0 | 0.183242 | 0.023493 | 0 | 0 | 0 | 0 | 0 | 1 | 0.225806 | false | 0 | 0.032258 | 0.16129 | 0.580645 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e8e312fcac01da1d5723e03b17fb85b5bf3dff6a | 2,907 | py | Python | graphql/type/schema.py | BarracudaPff/code-golf-data-pythpn | 42e8858c2ebc6a061012bcadb167d29cebb85c5e | [
"MIT"
] | null | null | null | graphql/type/schema.py | BarracudaPff/code-golf-data-pythpn | 42e8858c2ebc6a061012bcadb167d29cebb85c5e | [
"MIT"
] | null | null | null | graphql/type/schema.py | BarracudaPff/code-golf-data-pythpn | 42e8858c2ebc6a061012bcadb167d29cebb85c5e | [
"MIT"
] | null | null | null | try:
pass
except ImportError:
pass
if False:
pass
class GraphQLSchema(object):
"""Schema Definition
A Schema is created by supplying the root types of each type of operation, query and mutation (optional).
A schema definition is then supplied to the validator and executor.
Example:
MyAppSchema = GraphQLSchema(
query=MyAppQueryRootType,
mutation=MyAppMutationRootType,
)
Note: If an array of `directives` are provided to GraphQLSchema, that will be
the exact list of directives represented and allowed. If `directives` is not
provided then a default set of the specified directives (e.g. @include and
@skip) will be used. If you wish to provide *additional* directives to these
specified directives, you must explicitly declare them. Example:
MyAppSchema = GraphQLSchema(
...
directives=specified_directives.extend([MyCustomerDirective]),
)
"""
__slots__ = ("_query", "_mutation", "_subscription", "_type_map", "_directives", "_implementations", "_possible_type_map")
def __init__(self, query, mutation=None, subscription=None, directives=None, types=None):
assert isinstance(query, GraphQLObjectType), "Schema query must be Object Type but got: {}.".format(query)
if mutation:
assert isinstance(mutation, GraphQLObjectType), "Schema mutation must be Object Type but got: {}.".format(mutation)
if subscription:
assert isinstance(subscription, GraphQLObjectType), "Schema subscription must be Object Type but got: {}.".format(subscription)
if types:
assert isinstance(types, Iterable), "Schema types must be iterable if provided but got: {}.".format(types)
self._query = query
self._mutation = mutation
self._subscription = subscription
if directives is None:
directives = specified_directives
assert all(isinstance(d, GraphQLDirective) for d in directives), "Schema directives must be List[GraphQLDirective] if provided but got: {}.".format(directives)
self._directives = directives
initial_types = list(filter(None, [query, mutation, subscription, IntrospectionSchema]))
if types:
initial_types += types
self._type_map = GraphQLTypeMap(initial_types)
def get_query_type(self):
return self._query
def get_mutation_type(self):
return self._mutation
def get_subscription_type(self):
return self._subscription
def get_type_map(self):
return self._type_map
def get_type(self, name):
return self._type_map.get(name)
def get_directives(self):
return self._directives
def get_directive(self, name):
for directive in self.get_directives():
if directive.name == name:
return directive
return None
def get_possible_types(self, abstract_type):
return self._type_map.get_possible_types(abstract_type)
def is_possible_type(self, abstract_type, possible_type):
return self._type_map.is_possible_type(abstract_type, possible_type) | 44.045455 | 161 | 0.749914 | 367 | 2,907 | 5.757493 | 0.269755 | 0.026503 | 0.028396 | 0.032182 | 0.091339 | 0.039754 | 0.039754 | 0 | 0 | 0 | 0 | 0 | 0.164087 | 2,907 | 66 | 162 | 44.045455 | 0.869547 | 0.274854 | 0 | 0.104167 | 0 | 0 | 0.174041 | 0.010816 | 0 | 0 | 0 | 0 | 0.104167 | 1 | 0.208333 | false | 0.0625 | 0.020833 | 0.166667 | 0.479167 | 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 | 0 | 0 | 0 | 3 |
33234e3adf0dd415d47be0a937304b5fae2e596a | 1,209 | py | Python | pyteck/exceptions.py | vayner-s/PyTeCK | 0b180cd8679a16a204e780f6a6dc87df0a7256f1 | [
"MIT"
] | 10 | 2019-04-28T12:56:12.000Z | 2021-12-06T15:23:40.000Z | pyteck/exceptions.py | vayner-s/PyTeCK | 0b180cd8679a16a204e780f6a6dc87df0a7256f1 | [
"MIT"
] | 11 | 2019-02-23T22:03:57.000Z | 2022-02-28T14:45:00.000Z | pyteck/exceptions.py | vayner-s/PyTeCK | 0b180cd8679a16a204e780f6a6dc87df0a7256f1 | [
"MIT"
] | 5 | 2019-08-12T16:10:14.000Z | 2022-02-19T22:08:49.000Z | """Exceptions for ReSpecTh Parser.
.. moduleauthor:: Kyle Niemeyer <kyle.niemeyer@gmail.com>
"""
class ParseError(Exception):
"""Base class for errors."""
pass
class KeywordError(ParseError):
"""Raised for errors in keyword parsing."""
def __init__(self, *keywords):
self.keywords = keywords
def __str__(self):
return repr('Error: {}.'.format(self.keywords))
class UndefinedElementError(KeywordError):
"""Raised for undefined elements."""
def __str__(self):
return repr('Error: Element not defined.\n{}'.format(self.keywords))
class MissingElementError(KeywordError):
"""Raised for missing required elements."""
def __str__(self):
return repr('Error: Required element {} is missing.'.format(
self.keywords))
class MissingAttributeError(KeywordError):
"""Raised for missing required attribute."""
def __str__(self):
return repr('Error: Required attribute {} of {} is missing.'.format(
self.keywords))
class UndefinedKeywordError(KeywordError):
"""Raised for undefined keywords."""
def __str__(self):
return repr('Error: Keyword not defined: {}'.format(self.keywords))
| 24.673469 | 76 | 0.667494 | 126 | 1,209 | 6.214286 | 0.349206 | 0.10728 | 0.063857 | 0.102171 | 0.394636 | 0.302682 | 0.220945 | 0 | 0 | 0 | 0 | 0 | 0.199338 | 1,209 | 48 | 77 | 25.1875 | 0.808884 | 0.239868 | 0 | 0.333333 | 0 | 0 | 0.175737 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.047619 | 0 | 0.238095 | 0.809524 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.