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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f1212ab75574f42e605d0d03910218033dfcfd8a | 1,035 | py | Python | dryad/test_status_controller.py | Francis-T/citas-dryad | 2974aeb2b2754df3f23a098d614e3892bb5e2319 | [
"MIT"
] | null | null | null | dryad/test_status_controller.py | Francis-T/citas-dryad | 2974aeb2b2754df3f23a098d614e3892bb5e2319 | [
"MIT"
] | null | null | null | dryad/test_status_controller.py | Francis-T/citas-dryad | 2974aeb2b2754df3f23a098d614e3892bb5e2319 | [
"MIT"
] | 1 | 2016-09-05T08:25:30.000Z | 2016-09-05T08:25:30.000Z | #
# Status Indicator Circuit Controller Test
# Author: Francis T
#
# Tests the status indicator circuit controller
#
import unittest
import status_controller as statc
class BasicFuncTestCase(unittest.TestCase):
def setUp(self):
#statc.initialize()
return
def test_status_inactive(self):
self.assertEqual( statc.indicate(statc.STATUS_INACTIVE), True)
return
def test_status_ready(self):
self.assertEqual( statc.indicate(statc.STATUS_READY), True)
return
def test_status_busy(self):
self.assertEqual( statc.indicate(statc.STATUS_BUSY), True)
return
def test_status_tx(self):
self.assertEqual( statc.indicate(statc.STATUS_TX), True)
return
def test_status_rx(self):
self.assertEqual( statc.indicate(statc.STATUS_RX), True)
return
def test_status_shutdown(self):
self.assertEqual( statc.indicate(statc.STATUS_SHUTDOWN), True)
return
if __name__ == "__main__":
unittest.main()
| 24.069767 | 70 | 0.683092 | 120 | 1,035 | 5.666667 | 0.283333 | 0.079412 | 0.114706 | 0.167647 | 0.548529 | 0.379412 | 0.379412 | 0 | 0 | 0 | 0 | 0 | 0.228019 | 1,035 | 42 | 71 | 24.642857 | 0.851064 | 0.124638 | 0 | 0.28 | 0 | 0 | 0.008939 | 0 | 0 | 0 | 0 | 0 | 0.24 | 1 | 0.28 | false | 0 | 0.08 | 0.04 | 0.68 | 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 |
f137db4cbba929f8e984ccaf98ff3fbc2e3814b3 | 460 | py | Python | portafolio/core/migrations/0031_career_important_title.py | jhonfmg7/portafolioDjango | 64db6a371a84dcad4f22dd7cdeb598c7c2db124e | [
"Apache-2.0"
] | null | null | null | portafolio/core/migrations/0031_career_important_title.py | jhonfmg7/portafolioDjango | 64db6a371a84dcad4f22dd7cdeb598c7c2db124e | [
"Apache-2.0"
] | null | null | null | portafolio/core/migrations/0031_career_important_title.py | jhonfmg7/portafolioDjango | 64db6a371a84dcad4f22dd7cdeb598c7c2db124e | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.0.5 on 2020-08-26 20:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0030_remove_project_important_title'),
]
operations = [
migrations.AddField(
model_name='career',
name='important_title',
field=models.CharField(blank=True, max_length=200, null=True, verbose_name='Titulo Importante'),
),
]
| 24.210526 | 108 | 0.636957 | 52 | 460 | 5.480769 | 0.807692 | 0.098246 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063768 | 0.25 | 460 | 18 | 109 | 25.555556 | 0.762319 | 0.097826 | 0 | 0 | 1 | 0 | 0.186441 | 0.084746 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f17afddf883e4061f0668498c50ef2b1d40f471f | 190 | py | Python | app/gws/server/spool.py | ewie/gbd-websuite | 6f2814c7bb64d11cb5a0deec712df751718fb3e1 | [
"Apache-2.0"
] | null | null | null | app/gws/server/spool.py | ewie/gbd-websuite | 6f2814c7bb64d11cb5a0deec712df751718fb3e1 | [
"Apache-2.0"
] | null | null | null | app/gws/server/spool.py | ewie/gbd-websuite | 6f2814c7bb64d11cb5a0deec712df751718fb3e1 | [
"Apache-2.0"
] | null | null | null | import gws
import importlib
def add(job):
uwsgi = importlib.import_module('uwsgi')
gws.log.info("SPOOLING", job.uid)
d = {b'job_uid': gws.as_bytes(job.uid)}
uwsgi.spool(d)
| 19 | 44 | 0.663158 | 30 | 190 | 4.1 | 0.566667 | 0.146341 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178947 | 190 | 9 | 45 | 21.111111 | 0.788462 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 0.571429 | 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 |
74c33b8ce76256cd1afd8372053d4ddff47c2092 | 1,078 | py | Python | src/SortingSim/stick.py | berkayaslan/Sorting_Simulation | 16cfcd404063b060191dab244025012271edacd8 | [
"MIT"
] | 2 | 2020-01-26T09:42:03.000Z | 2020-05-26T13:57:02.000Z | src/SortingSim/stick.py | berkayaslan/Sorting_Simulation | 16cfcd404063b060191dab244025012271edacd8 | [
"MIT"
] | null | null | null | src/SortingSim/stick.py | berkayaslan/Sorting_Simulation | 16cfcd404063b060191dab244025012271edacd8 | [
"MIT"
] | null | null | null | class Stick:
def __init__(self, length=None, location=None):
self._length = length
self._loc = location
self._id = id(self)
self._color = None
# fixme: Verilere setter metodu ile yükleme yapılması!
@property
def length(self):
return self._length
@property
def location(self):
return self._loc
@property
def o_id(self):
return self._id
@property
def color(self):
return self._color
@length.setter
def length(self, value):
self._length = value
@location.setter
def location(self, location):
self._loc = location
@color.setter
def color(self, value: tuple):
if value[0] <= 255 and value[1] <= 255 and value[2] <= 255 \
and value[0] >= 0 and value[1] >= 0 and value[2] >= 0:
self._color = value
else:
self._color = (255, 255, 255)
if __name__ == "__main__":
stick = Stick()
stick.length(120)
stick.location(0)
print(stick.length, stick.location)
| 19.962963 | 70 | 0.569573 | 132 | 1,078 | 4.462121 | 0.257576 | 0.067912 | 0.095076 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04235 | 0.320965 | 1,078 | 53 | 71 | 20.339623 | 0.762295 | 0.048237 | 0 | 0.166667 | 0 | 0 | 0.007813 | 0 | 0 | 0 | 0 | 0.018868 | 0 | 1 | 0.222222 | false | 0 | 0 | 0.111111 | 0.361111 | 0.027778 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
74c76ee9a4a603fbe963cba6d550995d33315088 | 302 | py | Python | python100/problems/003.py | zerlous/morning-python | 8ef8b5602ece9f74da870f3588ad7c2f734792b3 | [
"MIT"
] | null | null | null | python100/problems/003.py | zerlous/morning-python | 8ef8b5602ece9f74da870f3588ad7c2f734792b3 | [
"MIT"
] | null | null | null | python100/problems/003.py | zerlous/morning-python | 8ef8b5602ece9f74da870f3588ad7c2f734792b3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : zerlous
# @File : 003.py
# @Time : 2019-04-02 23:15
# 一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?
# x + 100 = m^2 , x + 268 = n^2
# => n^2 - m^2 = 168
# => (m+n)(m-n) = 168
# => 设i = m+n, j = m -n, 则i*j=168
# => m=(i+j)/2, n =(i-j)/2 得i,j均偶数 | 25.166667 | 47 | 0.519868 | 59 | 302 | 2.661017 | 0.59322 | 0.050955 | 0.038217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179167 | 0.205298 | 302 | 12 | 48 | 25.166667 | 0.475 | 0.927152 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
74d545645521efaf64601d79b9a3ec56f365eb34 | 922 | py | Python | cutterdrcov_plugin/extras.py | Semnodime/CutterDRcov | 7e2efd041662128aaba54dfa6230bedfca36e6fd | [
"MIT"
] | 52 | 2019-03-24T20:33:46.000Z | 2021-11-22T00:21:08.000Z | cutterdrcov_plugin/extras.py | Semnodime/CutterDRcov | 7e2efd041662128aaba54dfa6230bedfca36e6fd | [
"MIT"
] | 8 | 2019-03-24T13:38:08.000Z | 2021-12-13T21:19:59.000Z | cutterdrcov_plugin/extras.py | Semnodime/CutterDRcov | 7e2efd041662128aaba54dfa6230bedfca36e6fd | [
"MIT"
] | 10 | 2019-03-24T14:07:43.000Z | 2021-12-07T08:24:30.000Z | import ntpath
def hex_pad(num, pad):
return "{0:#0{1}x}".format(num, pad + 2)
# https://stackoverflow.com/questions/8384737/extract-file-name-from-path-no-matter-what-the-os-path-format
# cuz windows sucks :( .. hard
def file_name(path):
# There's one caveat: Linux filenames may contain backslashes. So on linux,
# r'a/b\c' always refers to the file b\c in the a folder, while on Windows,
# it always refers to the c file in the b subfolder of the a folder. So when
# both forward and backward slashes are used in a path, you need to know the
# associated platform to be able to interpret it correctly. In practice it's
# usually safe to assume it's a windows path since backslashes are seldom
# used in Linux filenames, but keep this in mind when you code so you don't
# create accidental security holes.
head, tail = ntpath.split(path)
return tail or ntpath.basename(head)
| 46.1 | 107 | 0.715835 | 160 | 922 | 4.1125 | 0.5875 | 0.018237 | 0.042553 | 0.051672 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014885 | 0.198482 | 922 | 19 | 108 | 48.526316 | 0.875507 | 0.745119 | 0 | 0 | 0 | 0 | 0.044643 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0.166667 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
74d9d4320921729eea09ee6fc647c058abfb15da | 71 | py | Python | pm4pymdl/util/parquet_importer/parameters.py | dorian1000/pm4py-mdl | 71e0c2425abb183da293a58d31e25e50137c774f | [
"MIT"
] | 5 | 2021-01-31T22:45:29.000Z | 2022-02-22T14:26:06.000Z | pm4pymdl/util/parquet_importer/parameters.py | Javert899/pm4py-mdl | 4cc875999100f3f1ad60b925a20e40cf52337757 | [
"MIT"
] | 3 | 2021-07-07T15:32:55.000Z | 2021-07-07T16:15:36.000Z | pm4pymdl/util/parquet_importer/parameters.py | dorian1000/pm4py-mdl | 71e0c2425abb183da293a58d31e25e50137c774f | [
"MIT"
] | 9 | 2020-09-23T15:34:11.000Z | 2022-03-17T09:15:40.000Z | from enum import Enum
class Parameters(Enum):
COLUMNS = "columns"
| 14.2 | 23 | 0.71831 | 9 | 71 | 5.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197183 | 71 | 4 | 24 | 17.75 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0.098592 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
74e8c675fdd045baa869a7b1fb7f3e6afa25b115 | 4,641 | py | Python | week05/hw5p1.py | taoyichen/CS110-Assignments-Python | f2e4e485c820b835981e2e4b8bd0a26cc31cfe73 | [
"MIT"
] | null | null | null | week05/hw5p1.py | taoyichen/CS110-Assignments-Python | f2e4e485c820b835981e2e4b8bd0a26cc31cfe73 | [
"MIT"
] | null | null | null | week05/hw5p1.py | taoyichen/CS110-Assignments-Python | f2e4e485c820b835981e2e4b8bd0a26cc31cfe73 | [
"MIT"
] | 1 | 2020-06-06T08:21:18.000Z | 2020-06-06T08:21:18.000Z | import package_test
from package_test import hw5p2
#import package_test.hw5p2
#package_test.hw5p2.main()
hw5p2.main()
"""
'''
TAO YICHEN
ytao15@binghamton.edu
Lab section: B56
CA name: Paul Maino
Assignment #5 Part 1
Phone: 6079532749
'''
'''
RESTATEMENT:
Display tax for single and married filers given set of incomes
OUTPUT to monitor:
marital_status[status] (str)
total_income[status][income] (float)
tax (float)
GIVEN:
marital_status (str) - ['single', 'married']
total_income[status][income] (float):
[[0,9075, 9076, 36900, 36901, 89350, 89351,
186350, 186351, 405100, 405101, 406750, 406751],
[0, 18150, 18151, 73800, 73801, 148850, 148851,
226850, 226851, 405100, 405101, 457600, 457601]]
Define constants below
FORMULA:
tax = base tax amount for bracket
+ (tax rate for bracket * (total_income[status][income]
- base total_income[status][income] level for bracket))
'''
# No MAGIC numbers!
# CONSTANTS
# base total_income[status][income] levels
# for single and married tax brackets
SINGLE_BRACKET0 = 0
SINGLE_BRACKET1 = 9075
SINGLE_BRACKET2 = 36900
SINGLE_BRACKET3 = 89350
SINGLE_BRACKET4 = 186350
SINGLE_BRACKET5 = 405100
SINGLE_BRACKET6 = 406750
MARRIED_BRACKET0 = 0
MARRIED_BRACKET1 = 18150
MARRIED_BRACKET2 = 73800
MARRIED_BRACKET3 = 148850
MARRIED_BRACKET4 = 226850
MARRIED_BRACKET5 = 405100
MARRIED_BRACKET6 = 457600
# Define base tax amounts for single and married tax brackets
SINGLE_BASE_TAX0 = 0
SINGLE_BASE_TAX1 = 907.50
SINGLE_BASE_TAX2 = 5081.25
SINGLE_BASE_TAX3 = 18193.75
SINGLE_BASE_TAX4 = 45353.75
SINGLE_BASE_TAX5 = 117541.25
SINGLE_BASE_TAX6 = 118118.75
MARRIED_BASE_TAX0 = 0
MARRIED_BASE_TAX1 = 1815.0
MARRIED_BASE_TAX2 = 10162.5
MARRIED_BASE_TAX3 = 28925.0
MARRIED_BASE_TAX4 = 50765.0
MARRIED_BASE_TAX5 = 109587.5
MARRIED_BASE_TAX6 = 127962.5
# Define tax rate applied to total_income[status][income] over
# base total_income[status][income] of given tax bracket
TAX_RATE0 = 0.1
TAX_RATE1 = 0.15
TAX_RATE2 = 0.25
TAX_RATE3 = 0.28
TAX_RATE4 = 0.33
TAX_RATE5 = 0.35
TAX_RATE6 = 0.396
single_answer = ("single","Single","SINGLE")
married_answer = ("married","Married","MARRIED")
def main(status,income):
if status in single_answer:
if income >= SINGLE_BRACKET6:
tax = SINGLE_BASE_TAX6 + TAX_RATE6 * (income - SINGLE_BRACKET6)
elif income >= SINGLE_BRACKET5:
tax = SINGLE_BASE_TAX5 + TAX_RATE5* (income - SINGLE_BRACKET5)
elif income >= SINGLE_BRACKET4:
tax = SINGLE_BASE_TAX4 + TAX_RATE4 * (income - SINGLE_BRACKET4)
elif income >= SINGLE_BRACKET3:
tax = SINGLE_BASE_TAX3 + TAX_RATE3 * (income - SINGLE_BRACKET3)
elif income >= SINGLE_BRACKET2:
tax = SINGLE_BASE_TAX2 + TAX_RATE2 * (income - SINGLE_BRACKET2)
elif income >= SINGLE_BRACKET1:
tax = SINGLE_BASE_TAX1 + TAX_RATE1 * (income - SINGLE_BRACKET1)
elif income >= SINGLE_BRACKET0:
tax = SINGLE_BASE_TAX0 + TAX_RATE0 * (income - SINGLE_BRACKET0)
elif status in married_answer:
if income >= MARRIED_BRACKET6:
tax = MARRIED_BASE_TAX6 + TAX_RATE6 * (income - MARRIED_BRACKET6)
elif income >= MARRIED_BRACKET5:
tax = MARRIED_BASE_TAX5 + TAX_RATE5 * (income -MARRIED_BRACKET5)
elif income >= MARRIED_BRACKET4:
tax = MARRIED_BASE_TAX4 + TAX_RATE4 * (income -MARRIED_BRACKET4)
elif income >= MARRIED_BRACKET3:
tax = MARRIED_BASE_TAX3 + TAX_RATE3 * (income -MARRIED_BRACKET3)
elif income >= MARRIED_BRACKET2:
tax = MARRIED_BASE_TAX2 + TAX_RATE2 * (income -MARRIED_BRACKET2)
elif income >= MARRIED_BRACKET1:
tax = MARRIED_BASE_TAX1 + TAX_RATE1 * (income -MARRIED_BRACKET1)
elif income >= MARRIED_BRACKET0:
tax = MARRIED_BASE_TAX0 + TAX_RATE0 * (income -MARRIED_BRACKET0)
print("Tax for %7s filer, with income $%9.2f = $%9.2f" %
(status, income, tax))
status = input("What is your marital status? Press <Enter> to quite.\n")
while status:
while not ((status in single_answer) or (status in married_answer)):
status = input("Wrong entry!\nWhat is your status?\n")
income_str = input("What is your income? (Round to whole numbers please)\n")
while not income_str.isdigit and int(income_str)>0:
income_str = input("Wrong entry!\nWhat is your inocme?\n")
while not int(income_str)>0:
income_str = input("Wrong entry!\nWhat is your inocme?\n")
while not income_str.isdigit:
income_str = input("Wrong entry!\nWhat is your inocme?\n")
income = int(income_str)
main(status,income)
status = input("What is your marital status? Press <Enter> to quite.\n")
"""
| 31.571429 | 78 | 0.716009 | 645 | 4,641 | 4.924031 | 0.243411 | 0.044081 | 0.037469 | 0.050693 | 0.269521 | 0.129408 | 0.108312 | 0.085642 | 0.085642 | 0.085642 | 0 | 0.112642 | 0.187029 | 4,641 | 146 | 79 | 31.787671 | 0.729128 | 0.010774 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
74f27c4a87e0d0092113e2de9c038d951d050bbb | 12,791 | py | Python | modules/zivid/_settings_converter.py | knzivid/zivid-python | 5f05d5c17a6f649e89d58a69d0744c525e02b5eb | [
"BSD-3-Clause"
] | null | null | null | modules/zivid/_settings_converter.py | knzivid/zivid-python | 5f05d5c17a6f649e89d58a69d0744c525e02b5eb | [
"BSD-3-Clause"
] | null | null | null | modules/zivid/_settings_converter.py | knzivid/zivid-python | 5f05d5c17a6f649e89d58a69d0744c525e02b5eb | [
"BSD-3-Clause"
] | null | null | null | """Auto generated, do not edit."""
import zivid
import _zivid
def to_settings_acquisition(internal_acquisition):
return zivid.Settings.Acquisition(
aperture=internal_acquisition.aperture.value,
brightness=internal_acquisition.brightness.value,
exposure_time=internal_acquisition.exposure_time.value,
gain=internal_acquisition.gain.value,
)
def to_settings_processing_color_balance(internal_balance):
return zivid.Settings.Processing.Color.Balance(
blue=internal_balance.blue.value,
green=internal_balance.green.value,
red=internal_balance.red.value,
)
def to_settings_processing_color(internal_color):
return zivid.Settings.Processing.Color(
balance=to_settings_processing_color_balance(internal_color.balance),
gamma=internal_color.gamma.value,
)
def to_settings_processing_filters_experimental_contrast_distortion_correction(
internal_correction,
):
return zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction(
enabled=internal_correction.enabled.value,
strength=internal_correction.strength.value,
)
def to_settings_processing_filters_experimental_contrast_distortion_removal(
internal_removal,
):
return zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(
enabled=internal_removal.enabled.value,
threshold=internal_removal.threshold.value,
)
def to_settings_processing_filters_experimental_contrast_distortion(
internal_contrast_distortion,
):
return zivid.Settings.Processing.Filters.Experimental.ContrastDistortion(
correction=to_settings_processing_filters_experimental_contrast_distortion_correction(
internal_contrast_distortion.correction
),
removal=to_settings_processing_filters_experimental_contrast_distortion_removal(
internal_contrast_distortion.removal
),
)
def to_settings_processing_filters_experimental(internal_experimental):
return zivid.Settings.Processing.Filters.Experimental(
contrast_distortion=to_settings_processing_filters_experimental_contrast_distortion(
internal_experimental.contrast_distortion
),
)
def to_settings_processing_filters_noise_removal(internal_removal):
return zivid.Settings.Processing.Filters.Noise.Removal(
enabled=internal_removal.enabled.value,
threshold=internal_removal.threshold.value,
)
def to_settings_processing_filters_noise(internal_noise):
return zivid.Settings.Processing.Filters.Noise(
removal=to_settings_processing_filters_noise_removal(internal_noise.removal),
)
def to_settings_processing_filters_outlier_removal(internal_removal):
return zivid.Settings.Processing.Filters.Outlier.Removal(
enabled=internal_removal.enabled.value,
threshold=internal_removal.threshold.value,
)
def to_settings_processing_filters_outlier(internal_outlier):
return zivid.Settings.Processing.Filters.Outlier(
removal=to_settings_processing_filters_outlier_removal(
internal_outlier.removal
),
)
def to_settings_processing_filters_reflection_removal(internal_removal):
return zivid.Settings.Processing.Filters.Reflection.Removal(
enabled=internal_removal.enabled.value,
)
def to_settings_processing_filters_reflection(internal_reflection):
return zivid.Settings.Processing.Filters.Reflection(
removal=to_settings_processing_filters_reflection_removal(
internal_reflection.removal
),
)
def to_settings_processing_filters_smoothing_gaussian(internal_gaussian):
return zivid.Settings.Processing.Filters.Smoothing.Gaussian(
enabled=internal_gaussian.enabled.value, sigma=internal_gaussian.sigma.value,
)
def to_settings_processing_filters_smoothing(internal_smoothing):
return zivid.Settings.Processing.Filters.Smoothing(
gaussian=to_settings_processing_filters_smoothing_gaussian(
internal_smoothing.gaussian
),
)
def to_settings_processing_filters(internal_filters):
return zivid.Settings.Processing.Filters(
experimental=to_settings_processing_filters_experimental(
internal_filters.experimental
),
noise=to_settings_processing_filters_noise(internal_filters.noise),
outlier=to_settings_processing_filters_outlier(internal_filters.outlier),
reflection=to_settings_processing_filters_reflection(
internal_filters.reflection
),
smoothing=to_settings_processing_filters_smoothing(internal_filters.smoothing),
)
def to_settings_processing(internal_processing):
return zivid.Settings.Processing(
color=to_settings_processing_color(internal_processing.color),
filters=to_settings_processing_filters(internal_processing.filters),
)
def to_settings(internal_settings):
return zivid.Settings(
processing=to_settings_processing(internal_settings.processing),
acquisitions=[
to_settings_acquisition(element)
for element in internal_settings.acquisitions.value
],
)
def to_internal_settings_acquisition(acquisition):
internal_acquisition = _zivid.Settings.Acquisition()
internal_acquisition.aperture = _zivid.Settings.Acquisition.Aperture(
acquisition.aperture
)
internal_acquisition.brightness = _zivid.Settings.Acquisition.Brightness(
acquisition.brightness
)
internal_acquisition.exposure_time = _zivid.Settings.Acquisition.ExposureTime(
acquisition.exposure_time
)
internal_acquisition.gain = _zivid.Settings.Acquisition.Gain(acquisition.gain)
return internal_acquisition
def to_internal_settings_processing_color_balance(balance):
internal_balance = _zivid.Settings.Processing.Color.Balance()
internal_balance.blue = _zivid.Settings.Processing.Color.Balance.Blue(balance.blue)
internal_balance.green = _zivid.Settings.Processing.Color.Balance.Green(
balance.green
)
internal_balance.red = _zivid.Settings.Processing.Color.Balance.Red(balance.red)
return internal_balance
def to_internal_settings_processing_color(color):
internal_color = _zivid.Settings.Processing.Color()
internal_color.gamma = _zivid.Settings.Processing.Color.Gamma(color.gamma)
internal_color.balance = to_internal_settings_processing_color_balance(
color.balance
)
return internal_color
def to_internal_settings_processing_filters_experimental_contrast_distortion_correction(
correction,
):
internal_correction = (
_zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction()
)
internal_correction.enabled = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Enabled(
correction.enabled
)
internal_correction.strength = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Strength(
correction.strength
)
return internal_correction
def to_internal_settings_processing_filters_experimental_contrast_distortion_removal(
removal,
):
internal_removal = (
_zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal()
)
internal_removal.enabled = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Enabled(
removal.enabled
)
internal_removal.threshold = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Threshold(
removal.threshold
)
return internal_removal
def to_internal_settings_processing_filters_experimental_contrast_distortion(
contrast_distortion,
):
internal_contrast_distortion = (
_zivid.Settings.Processing.Filters.Experimental.ContrastDistortion()
)
internal_contrast_distortion.correction = to_internal_settings_processing_filters_experimental_contrast_distortion_correction(
contrast_distortion.correction
)
internal_contrast_distortion.removal = to_internal_settings_processing_filters_experimental_contrast_distortion_removal(
contrast_distortion.removal
)
return internal_contrast_distortion
def to_internal_settings_processing_filters_experimental(experimental):
internal_experimental = _zivid.Settings.Processing.Filters.Experimental()
internal_experimental.contrast_distortion = to_internal_settings_processing_filters_experimental_contrast_distortion(
experimental.contrast_distortion
)
return internal_experimental
def to_internal_settings_processing_filters_noise_removal(removal):
internal_removal = _zivid.Settings.Processing.Filters.Noise.Removal()
internal_removal.enabled = _zivid.Settings.Processing.Filters.Noise.Removal.Enabled(
removal.enabled
)
internal_removal.threshold = _zivid.Settings.Processing.Filters.Noise.Removal.Threshold(
removal.threshold
)
return internal_removal
def to_internal_settings_processing_filters_noise(noise):
internal_noise = _zivid.Settings.Processing.Filters.Noise()
internal_noise.removal = to_internal_settings_processing_filters_noise_removal(
noise.removal
)
return internal_noise
def to_internal_settings_processing_filters_outlier_removal(removal):
internal_removal = _zivid.Settings.Processing.Filters.Outlier.Removal()
internal_removal.enabled = _zivid.Settings.Processing.Filters.Outlier.Removal.Enabled(
removal.enabled
)
internal_removal.threshold = _zivid.Settings.Processing.Filters.Outlier.Removal.Threshold(
removal.threshold
)
return internal_removal
def to_internal_settings_processing_filters_outlier(outlier):
internal_outlier = _zivid.Settings.Processing.Filters.Outlier()
internal_outlier.removal = to_internal_settings_processing_filters_outlier_removal(
outlier.removal
)
return internal_outlier
def to_internal_settings_processing_filters_reflection_removal(removal):
internal_removal = _zivid.Settings.Processing.Filters.Reflection.Removal()
internal_removal.enabled = _zivid.Settings.Processing.Filters.Reflection.Removal.Enabled(
removal.enabled
)
return internal_removal
def to_internal_settings_processing_filters_reflection(reflection):
internal_reflection = _zivid.Settings.Processing.Filters.Reflection()
internal_reflection.removal = to_internal_settings_processing_filters_reflection_removal(
reflection.removal
)
return internal_reflection
def to_internal_settings_processing_filters_smoothing_gaussian(gaussian):
internal_gaussian = _zivid.Settings.Processing.Filters.Smoothing.Gaussian()
internal_gaussian.enabled = _zivid.Settings.Processing.Filters.Smoothing.Gaussian.Enabled(
gaussian.enabled
)
internal_gaussian.sigma = _zivid.Settings.Processing.Filters.Smoothing.Gaussian.Sigma(
gaussian.sigma
)
return internal_gaussian
def to_internal_settings_processing_filters_smoothing(smoothing):
internal_smoothing = _zivid.Settings.Processing.Filters.Smoothing()
internal_smoothing.gaussian = to_internal_settings_processing_filters_smoothing_gaussian(
smoothing.gaussian
)
return internal_smoothing
def to_internal_settings_processing_filters(filters):
internal_filters = _zivid.Settings.Processing.Filters()
internal_filters.experimental = to_internal_settings_processing_filters_experimental(
filters.experimental
)
internal_filters.noise = to_internal_settings_processing_filters_noise(
filters.noise
)
internal_filters.outlier = to_internal_settings_processing_filters_outlier(
filters.outlier
)
internal_filters.reflection = to_internal_settings_processing_filters_reflection(
filters.reflection
)
internal_filters.smoothing = to_internal_settings_processing_filters_smoothing(
filters.smoothing
)
return internal_filters
def to_internal_settings_processing(processing):
internal_processing = _zivid.Settings.Processing()
internal_processing.color = to_internal_settings_processing_color(processing.color)
internal_processing.filters = to_internal_settings_processing_filters(
processing.filters
)
return internal_processing
def to_internal_settings(settings):
internal_settings = _zivid.Settings()
internal_settings.processing = to_internal_settings_processing(settings.processing)
temp = _zivid.Settings().Acquisitions()
for acq in settings.acquisitions:
temp.append(to_internal_settings_acquisition(acq))
internal_settings.acquisitions = temp
return internal_settings
| 33.572178 | 130 | 0.787272 | 1,287 | 12,791 | 7.423465 | 0.03885 | 0.216663 | 0.232887 | 0.116182 | 0.682437 | 0.628951 | 0.443898 | 0.281662 | 0.164852 | 0.088549 | 0 | 0 | 0.148776 | 12,791 | 380 | 131 | 33.660526 | 0.87748 | 0.002189 | 0 | 0.114695 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.129032 | false | 0 | 0.007168 | 0.064516 | 0.265233 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
74f9eecab8ce2f291f5fec2748dfb9c29a2b9af0 | 2,003 | py | Python | szz/Commit.py | fastluca/szz-mpi | 3ebc266cb98080f2c7d34ca6cdcc03b6ac0902ae | [
"MIT"
] | 1 | 2019-03-21T23:27:31.000Z | 2019-03-21T23:27:31.000Z | szz/Commit.py | fastluca/szz-mpi | 3ebc266cb98080f2c7d34ca6cdcc03b6ac0902ae | [
"MIT"
] | null | null | null | szz/Commit.py | fastluca/szz-mpi | 3ebc266cb98080f2c7d34ca6cdcc03b6ac0902ae | [
"MIT"
] | 1 | 2019-02-17T12:10:20.000Z | 2019-02-17T12:10:20.000Z | class Commit:
def __init__(self, sha: str, timestamp, author_id: str, committer_id: str, message: str, num_parents: int, num_additions: int, num_deletions: int, num_files_changed: int, files: int, src_loc_added: int, src_loc_deleted: int, num_src_files_touched: int, src_files: str):
self.__sha = sha
self.__timestamp = timestamp
self.__author_id = author_id
self.__committer_id = committer_id
self.__message = message
self.__num_parents = num_parents
self.__num_additions = num_additions
self.__num_deletions = num_deletions
self.__num_files_changed = num_files_changed
self.__files = files # semi-colon list of file names
self.__src_loc_added = src_loc_added
self.__src_loc_deleted = src_loc_deleted
self.__num_src_files_touched = num_src_files_touched
self.__src_files = src_files # semi-colon list of file names
@property
def sha(self):
return self.__sha
@property
def timestamp(self):
return self.__timestamp
@property
def author_id(self):
return self.__author_id
@property
def committer_id(self):
return self.__committer_id
@property
def message(self):
return self.__message
@property
def num_parents(self):
return self.__num_parents
@property
def num_additions(self):
return self.__num_additions
@property
def num_deletions(self):
return self.__num_deletions
@property
def num_files_changed(self):
return self.__num_files_changed
@property
def src_loc_added(self):
return self.__src_loc_added
@property
def src_loc_deleted(self):
return self.__src_loc_deleted
@property
def num_src_files_touched(self):
return self.__num_src_files_touched
@property
def src_files(self):
return self.__src_files
@property
def files(self):
return self.__files
| 27.067568 | 273 | 0.678982 | 259 | 2,003 | 4.72973 | 0.123552 | 0.125714 | 0.16 | 0.073469 | 0.151837 | 0.047347 | 0.047347 | 0 | 0 | 0 | 0 | 0 | 0.254618 | 2,003 | 73 | 274 | 27.438356 | 0.820496 | 0.029456 | 0 | 0.241379 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.258621 | false | 0 | 0 | 0.241379 | 0.517241 | 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 |
740ae050de236b941d1df03dc6f2237703df6297 | 1,812 | py | Python | PythonInterview/DesigPattern/StructuralModel/Decorator.py | xtawfnhdx/PythonInterview | 515675ffd86eb1ad3bfa631fd3c88fddcf411e98 | [
"Apache-2.0"
] | null | null | null | PythonInterview/DesigPattern/StructuralModel/Decorator.py | xtawfnhdx/PythonInterview | 515675ffd86eb1ad3bfa631fd3c88fddcf411e98 | [
"Apache-2.0"
] | null | null | null | PythonInterview/DesigPattern/StructuralModel/Decorator.py | xtawfnhdx/PythonInterview | 515675ffd86eb1ad3bfa631fd3c88fddcf411e98 | [
"Apache-2.0"
] | null | null | null | from abc import ABC, abstractmethod
class Component(ABC):
"""
基本组件接口
"""
@abstractmethod
def operation(self) -> str:
"""
定义具体操作
:return:
"""
pass
class ConcreteComponent(Component):
def operation(self) -> str:
return "基本组件的基础实现"
class Decorator(Component):
"""
装饰器遵循与基本组件的接口(继承)
"""
_comment: Component = None
def __init__(self, comment: Component):
self._comment = comment
@property
def comment(self) -> Component:
return self._comment
@abstractmethod
def operation(self) -> str:
pass
class ConcreteDecoratorA(Decorator):
def operation(self) -> str:
return f"A装饰器 {self.comment.operation()}"
class ConcreteDecoratorB(Decorator):
def operation(self) -> str:
return f"B装饰器 {self.comment.operation()}"
def client_code(comment: Component) -> None:
print("执行结果", end="\n")
print(comment.operation())
if __name__ == '__main__':
simple = ConcreteComponent()
client_code(simple)
ca = ConcreteDecoratorA(simple)
client_code(ca)
cb = ConcreteDecoratorB(ca)
client_code(cb)
# """
# 装饰模式
# """
# from __future__ import annotations
# from abc import ABC, abstractmethod
#
#
# class IHouse(ABC):
# @abstractmethod
# def live(self):
# pass
#
#
# class House(IHouse):
# def live(self):
# print('房子基本功能-居住')
#
#
# class IMirrorHouse(IHouse):
# @abstractmethod
# def lookMirror(self):
# pass
#
#
# class MirrorHouse(IMirrorHouse):
# def __init__(self, se):
# self = se
#
# def lookMirror(self):
# print('有了镜子功能')
#
#
# if __name__ == '__main__':
# house = House()
# house.live()
# m = MirrorHouse(house)
# m.live()
# m.lookMirror()
| 17.423077 | 49 | 0.596578 | 178 | 1,812 | 5.876404 | 0.303371 | 0.057361 | 0.076482 | 0.090822 | 0.220841 | 0.133843 | 0.066922 | 0 | 0 | 0 | 0 | 0 | 0.268764 | 1,812 | 103 | 50 | 17.592233 | 0.789434 | 0.333333 | 0 | 0.264706 | 0 | 0 | 0.076646 | 0.046889 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0.058824 | 0.029412 | 0.117647 | 0.558824 | 0.058824 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
74123240b191374d6f68a590cb14714bf9a10b24 | 357 | py | Python | src/sentry/middleware/social_auth.py | learninto/sentry | 4f9f564841498b3af49c1677d6b61f3e47b01923 | [
"BSD-3-Clause"
] | 1 | 2020-02-27T02:46:25.000Z | 2020-02-27T02:46:25.000Z | src/sentry/middleware/social_auth.py | learninto/sentry | 4f9f564841498b3af49c1677d6b61f3e47b01923 | [
"BSD-3-Clause"
] | 1 | 2020-11-05T14:54:44.000Z | 2020-11-19T21:54:19.000Z | src/sentry/middleware/social_auth.py | learninto/sentry | 4f9f564841498b3af49c1677d6b61f3e47b01923 | [
"BSD-3-Clause"
] | 1 | 2017-02-09T06:36:57.000Z | 2017-02-09T06:36:57.000Z | from __future__ import absolute_import
from social_auth.middleware import SocialAuthExceptionMiddleware
from sentry.utils import auth
from sentry.utils.http import absolute_uri
class SentrySocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware):
def get_redirect_uri(self, request, exception):
return absolute_uri(auth.get_login_url())
| 29.75 | 73 | 0.840336 | 40 | 357 | 7.2 | 0.575 | 0.097222 | 0.104167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112045 | 357 | 11 | 74 | 32.454545 | 0.908517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.571429 | 0.142857 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
742ba0c76a2e61d537ebb0628dbe4ec0329259e6 | 5,194 | py | Python | tests/base/fluids/test_fluid.py | DHaspel/cavsim | a23e344b47b970e1a90e04c071e06860935d1694 | [
"Apache-2.0"
] | null | null | null | tests/base/fluids/test_fluid.py | DHaspel/cavsim | a23e344b47b970e1a90e04c071e06860935d1694 | [
"Apache-2.0"
] | null | null | null | tests/base/fluids/test_fluid.py | DHaspel/cavsim | a23e344b47b970e1a90e04c071e06860935d1694 | [
"Apache-2.0"
] | null | null | null | from unittest import TestCase
import numpy as np
import numpy.testing as npt
from cavsim.base.fluids.fluid import Fluid
class TestFluid(TestCase):
def setUp(self):
self.fluid = Fluid(1, 2, 3, 4, 5, 6)
def tearDown(self):
del self.fluid
self.fluid = None
def test___init__(self):
f = Fluid(1, 2, 3, 4, 5, 6)
self.assertEqual(None, f._density_cb)
self.assertEqual(None, f._viscosity_cb)
self.assertEqual(None, f._bulk_modulus_cb)
self.assertEqual(None, f._vapor_pressure_cb)
def test__density(self):
p = self.fluid.norm_pressure
t = self.fluid.norm_temperature
self.assertEqual(self.fluid.norm_density, self.fluid._density(p, t))
answer = np.asarray([self.fluid.norm_density, self.fluid.norm_density])
result = self.fluid._density([p, p], [t, t])
self.assertEqual(answer.shape, result.shape)
npt.assert_almost_equal(result, answer)
def test__viscosity(self):
self.assertEqual(self.fluid.norm_viscosity, self.fluid._viscosity(3, 4))
answer = np.asarray([self.fluid.norm_viscosity, self.fluid.norm_viscosity])
result = self.fluid._viscosity([3, 3], [4, 4])
self.assertEqual(answer.shape, result.shape)
npt.assert_allclose(result, answer)
def test__bulk_modulus(self):
self.assertEqual(self.fluid.norm_bulk_modulus, self.fluid._bulk_modulus(5))
answer = np.asarray([self.fluid.norm_bulk_modulus, self.fluid.norm_bulk_modulus])
result = self.fluid._bulk_modulus([5, 5])
self.assertEqual(answer.shape, result.shape)
npt.assert_allclose(result, answer)
def test__vapor_pressure(self):
self.assertEqual(self.fluid.norm_vapor_pressure, self.fluid._vapor_pressure(6))
answer = np.asarray([self.fluid.norm_vapor_pressure, self.fluid.norm_vapor_pressure])
result = self.fluid._vapor_pressure([6, 6])
self.assertEqual(answer.shape, result.shape)
npt.assert_allclose(result, answer)
def test_density(self):
p = self.fluid.norm_pressure
t = self.fluid.norm_temperature
self.assertEqual(self.fluid.norm_density, self.fluid.density(p, t))
self.fluid._density_cb = lambda x, y, z: 99
self.assertEqual(99, self.fluid.density(p, t))
def test_viscosity(self):
self.assertEqual(self.fluid.norm_viscosity, self.fluid.viscosity(3, 4))
self.fluid._viscosity_cb = lambda x, y, z: 88
self.assertEqual(88, self.fluid.viscosity(3, 4))
def test_bulk_modulus(self):
self.assertEqual(self.fluid.norm_bulk_modulus, self.fluid.bulk_modulus(5))
self.fluid._bulk_modulus_cb = lambda x, y: 77
self.assertEqual(77, self.fluid.bulk_modulus(5))
def test_vapor_pressure(self):
self.assertEqual(self.fluid.norm_vapor_pressure, self.fluid.vapor_pressure(6))
self.fluid._vapor_pressure_cb = lambda x, y: 66
self.assertEqual(66, self.fluid.vapor_pressure(6))
def test_density_cb(self):
# Test getter
cb = lambda x, y, z: 99
self.assertEqual(None, self.fluid.density_cb)
self.fluid._density_cb = cb
self.assertEqual(cb, self.fluid.density_cb)
# Test setter
self.fluid.density_cb = None
self.assertEqual(None, self.fluid._density_cb)
self.fluid.density_cb = cb
self.assertEqual(cb, self.fluid._density_cb)
with self.assertRaises(TypeError):
self.fluid.density_cb = 123
def test_viscosity_cb(self):
# Test getter
cb = lambda x, y, z: 99
self.assertEqual(None, self.fluid.viscosity_cb)
self.fluid._viscosity_cb = cb
self.assertEqual(cb, self.fluid.viscosity_cb)
# Test setter
self.fluid.viscosity_cb = None
self.assertEqual(None, self.fluid._viscosity_cb)
self.fluid.viscosity_cb = cb
self.assertEqual(cb, self.fluid._viscosity_cb)
with self.assertRaises(TypeError):
self.fluid.viscosity_cb = 123
def test_bulk_modulus_cb(self):
# Test getter
cb = lambda x, y: 99
self.assertEqual(None, self.fluid.bulk_modulus_cb)
self.fluid._bulk_modulus_cb = cb
self.assertEqual(cb, self.fluid.bulk_modulus_cb)
# Test setter
self.fluid.bulk_modulus_cb = None
self.assertEqual(None, self.fluid._bulk_modulus_cb)
self.fluid.bulk_modulus_cb = cb
self.assertEqual(cb, self.fluid._bulk_modulus_cb)
with self.assertRaises(TypeError):
self.fluid.bulk_modulus_cb = 123
def test_vapor_pressure_cb(self):
# Test getter
cb = lambda x, y: 99
self.assertEqual(None, self.fluid.vapor_pressure_cb)
self.fluid._vapor_pressure_cb = cb
self.assertEqual(cb, self.fluid.vapor_pressure_cb)
# Test setter
self.fluid.vapor_pressure_cb = None
self.assertEqual(None, self.fluid._vapor_pressure_cb)
self.fluid.vapor_pressure_cb = cb
self.assertEqual(cb, self.fluid._vapor_pressure_cb)
with self.assertRaises(TypeError):
self.fluid.vapor_pressure_cb = 123
| 39.953846 | 93 | 0.670004 | 705 | 5,194 | 4.70922 | 0.09078 | 0.203313 | 0.078313 | 0.078313 | 0.818976 | 0.695783 | 0.659639 | 0.579518 | 0.557229 | 0.557229 | 0 | 0.016873 | 0.224105 | 5,194 | 129 | 94 | 40.263566 | 0.806948 | 0.01829 | 0 | 0.182692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.423077 | 1 | 0.144231 | false | 0 | 0.038462 | 0 | 0.192308 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
744596be112cd09ec44dc8a6cfce90d30a73ab12 | 405 | py | Python | initialize/application.py | adripo/vonage-python-code-snippets | 443d83a8cb3c052a634c997f1a3e3eccd61541ab | [
"MIT"
] | 8 | 2017-11-10T17:47:40.000Z | 2019-03-09T19:35:01.000Z | initialize/application.py | adripo/vonage-python-code-snippets | 443d83a8cb3c052a634c997f1a3e3eccd61541ab | [
"MIT"
] | 26 | 2017-04-12T18:13:51.000Z | 2019-03-04T15:29:35.000Z | initialize/application.py | adripo/vonage-python-code-snippets | 443d83a8cb3c052a634c997f1a3e3eccd61541ab | [
"MIT"
] | 18 | 2020-10-01T07:23:22.000Z | 2022-01-17T00:20:44.000Z | import os
import vonage
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), "../.env")
load_dotenv(dotenv_path)
VONAGE_APPLICATION_ID=os.environ.get("VONAGE_APPLICATION_ID")
VONAGE_APPLICATION_PRIVATE_KEY_PATH=os.environ.get("VONAGE_APPLICATION_PRIVATE_KEY_PATH")
client = vonage.Client(
application_id=VONAGE_APPLICATION_ID,
private_key=VONAGE_APPLICATION_PRIVATE_KEY_PATH,
)
| 27 | 89 | 0.832099 | 56 | 405 | 5.517857 | 0.321429 | 0.330097 | 0.184466 | 0.262136 | 0.433657 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.079012 | 405 | 14 | 90 | 28.928571 | 0.828418 | 0 | 0 | 0 | 0 | 0 | 0.155556 | 0.138272 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.272727 | 0 | 0.272727 | 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 |
74567795a187febc4b7818b1e7dc40331bc56c8b | 296 | py | Python | django_openapi/utils.py | tokikanno/openapi-router | 884463d43eb472dce3d5fd835390f676f8a672f5 | [
"MIT"
] | 19 | 2020-08-03T06:51:54.000Z | 2022-03-15T14:45:10.000Z | django_openapi/utils.py | tokikanno/openapi-router | 884463d43eb472dce3d5fd835390f676f8a672f5 | [
"MIT"
] | 3 | 2021-01-13T10:01:07.000Z | 2021-04-29T02:17:41.000Z | django_openapi/utils.py | tokikanno/openapi-router | 884463d43eb472dce3d5fd835390f676f8a672f5 | [
"MIT"
] | 4 | 2020-12-20T14:50:29.000Z | 2021-12-14T21:17:46.000Z | # -*- coding:utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from django.http import JsonResponse
def json_response(data, status_code=200):
resp = JsonResponse(data)
resp.status_code = status_code
return resp
| 22.769231 | 41 | 0.777027 | 39 | 296 | 5.435897 | 0.589744 | 0.141509 | 0.226415 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016 | 0.155405 | 296 | 12 | 42 | 24.666667 | 0.832 | 0.067568 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.5 | 0 | 0.75 | 0.125 | 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 |
745ce16b8c6283b71d3e3aefb6237ab8e9a44ba5 | 776 | py | Python | datatools/test/number.py | hayj/DataTools | a779a533afe8e176c33b91d17974468ef7c6b17e | [
"MIT"
] | null | null | null | datatools/test/number.py | hayj/DataTools | a779a533afe8e176c33b91d17974468ef7c6b17e | [
"MIT"
] | null | null | null | datatools/test/number.py | hayj/DataTools | a779a533afe8e176c33b91d17974468ef7c6b17e | [
"MIT"
] | null | null | null | # coding: utf-8
from fr.hayj.util.number import *;
from fr.hayj.util.duration import *;
import unittest
import re
# The level allow the unit test execution to choose only the top level test
unittestLevel = 1
if unittestLevel <= 1:
class UtilTest(unittest.TestCase):
def test1(self):
self.assertTrue(truncateFloat(0.00002000002, 2) == 0.00)
self.assertTrue(truncateFloat(0.00002000002, 8) == 0.00002)
self.assertTrue(truncateFloat(0.00002000002, 20) == 0.00002000002)
self.assertTrue(truncateFloat(0.02, 8) == 0.02)
self.assertTrue(truncateFloat(0.02, 1) == 0.0)
self.assertTrue(truncateFloat(5e-5, 1) == 0.0)
self.assertTrue(truncateFloat(5e-5, 10) == 0.00005)
| 32.333333 | 78 | 0.640464 | 101 | 776 | 4.920792 | 0.435644 | 0.197183 | 0.380282 | 0.28169 | 0.488934 | 0.132797 | 0.132797 | 0.132797 | 0 | 0 | 0 | 0.157095 | 0.237113 | 776 | 23 | 79 | 33.73913 | 0.682432 | 0.112113 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | 1 | 0.066667 | false | 0 | 0.266667 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
747a06d2abc8c71978e54d63ef1aeef2b7e2379e | 6,712 | py | Python | stl/ast.py | karen-leung-tri/py-stl | 87f764a2b8b7c756a239f200b77c3875f959cae6 | [
"BSD-3-Clause"
] | null | null | null | stl/ast.py | karen-leung-tri/py-stl | 87f764a2b8b7c756a239f200b77c3875f959cae6 | [
"BSD-3-Clause"
] | null | null | null | stl/ast.py | karen-leung-tri/py-stl | 87f764a2b8b7c756a239f200b77c3875f959cae6 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from collections import deque, namedtuple
from functools import lru_cache
import funcy as fn
from lenses import lens, bind
import stl
def flatten_binary(phi, op, dropT, shortT):
def f(x):
return x.args if isinstance(x, op) else [x]
args = [arg for arg in phi.args if arg is not dropT]
if any(arg is shortT for arg in args):
return shortT
elif not args:
return dropT
elif len(args) == 1:
return args[0]
else:
return op(tuple(fn.mapcat(f, phi.args)))
class AST(object):
__slots__ = ()
def __or__(self, other):
return flatten_binary(Or((self, other)), Or, BOT, TOP)
def __and__(self, other):
return flatten_binary(And((self, other)), And, TOP, BOT)
def __invert__(self):
if isinstance(self, Neg):
return self.arg
return Neg(self)
def __rshift__(self, t):
if self in (BOT, TOP):
return self
phi = self
for _ in range(t):
phi = Next(phi)
return phi
def __call__(self, trace, time=0):
return stl.pointwise_sat(self)(trace, time)
@property
def children(self):
return tuple()
def walk(self):
"""Walk of the AST."""
pop = deque.pop
children = deque([self])
while len(children) > 0:
node = pop(children)
yield node
children.extend(node.children)
@property
def params(self):
def get_params(leaf):
if isinstance(leaf, ModalOp):
if isinstance(leaf.interval[0], Param):
yield leaf.interval[0]
if isinstance(leaf.interval[1], Param):
yield leaf.interval[1]
elif isinstance(leaf, LinEq):
if isinstance(leaf.const, Param):
yield leaf.const
return set(fn.mapcat(get_params, self.walk()))
def set_params(self, val):
phi = param_lens(self)
return phi.modify(lambda x: float(val.get(x, val.get(str(x), x))))
@property
def lineqs(self):
return set(lineq_lens.collect()(self))
@property
def atomic_predicates(self):
return set(AP_lens.collect()(self))
@property
def var_names(self):
symbols = set(bind(self.lineqs).Each().terms.Each().collect())
symbols |= self.atomic_predicates
return set(bind(symbols).Each().id.collect())
def inline_context(self, context):
phi, phi2 = self, None
def update(ap):
return context.get(ap, ap)
while phi2 != phi:
phi2, phi = phi, AP_lens.modify(update)(phi)
return phi
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class _Top(AST):
__slots__ = ()
def __repr__(self):
return "⊤"
def __invert__(self):
return BOT
class _Bot(AST):
__slots__ = ()
def __repr__(self):
return "⊥"
def __invert__(self):
return TOP
TOP = _Top()
BOT = _Bot()
class AtomicPred(namedtuple("AP", ["id"]), AST):
__slots__ = ()
def __repr__(self):
return f"{self.id}"
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
@property
def children(self):
return tuple()
class LinEq(namedtuple("LinEquality", ["terms", "op", "const"]), AST):
__slots__ = ()
def __repr__(self):
return " + ".join(map(str, self.terms)) + f" {self.op} {self.const}"
@property
def children(self):
return tuple()
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class Var(namedtuple("Var", ["coeff", "id"])):
__slots__ = ()
def __repr__(self):
if self.coeff == -1:
coeff_str = "-"
elif self.coeff == +1:
coeff_str = ""
else:
coeff_str = f"{self.coeff}"
return f"{coeff_str}{self.id}"
class Interval(namedtuple('I', ['lower', 'upper'])):
__slots__ = ()
def __repr__(self):
return f"[{self.lower},{self.upper}]"
class NaryOpSTL(namedtuple('NaryOp', ['args']), AST):
__slots__ = ()
OP = "?"
def __repr__(self):
return f" {self.OP} ".join(f"({x})" for x in self.args)
@property
def children(self):
return tuple(self.args)
class Or(NaryOpSTL):
__slots__ = ()
OP = "∨"
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class And(NaryOpSTL):
__slots__ = ()
OP = "∧"
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class ModalOp(namedtuple('ModalOp', ['interval', 'arg']), AST):
__slots__ = ()
OP = '?'
def __repr__(self):
return f"{self.OP}{self.interval}({self.arg})"
@property
def children(self):
return (self.arg,)
class F(ModalOp):
__slots__ = ()
OP = "◇"
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class G(ModalOp):
__slots__ = ()
OP = "□"
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class Until(namedtuple('ModalOp', ['arg1', 'arg2']), AST):
__slots__ = ()
def __repr__(self):
return f"({self.arg1}) U ({self.arg2})"
@property
def children(self):
return (self.arg1, self.arg2)
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class Neg(namedtuple('Neg', ['arg']), AST):
__slots__ = ()
def __repr__(self):
return f"¬({self.arg})"
@property
def children(self):
return (self.arg,)
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class Next(namedtuple('Next', ['arg']), AST):
__slots__ = ()
def __repr__(self):
return f"◯({self.arg})"
@property
def children(self):
return (self.arg,)
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
class Param(namedtuple('Param', ['name']), AST):
__slots__ = ()
def __repr__(self):
return self.name
def __hash__(self):
# TODO: compute hash based on contents
return hash(repr(self))
@lru_cache()
def param_lens(phi, *, getter=False):
return bind(phi).Recur(Param)
def type_pred(*args):
ast_types = set(args)
return lambda x: type(x) in ast_types
lineq_lens = lens.Recur(LinEq)
AP_lens = lens.Recur(AtomicPred)
| 20.975 | 76 | 0.567789 | 827 | 6,712 | 4.351874 | 0.171705 | 0.066685 | 0.036677 | 0.045846 | 0.403445 | 0.363434 | 0.307585 | 0.280356 | 0.247569 | 0.235621 | 0 | 0.004239 | 0.29708 | 6,712 | 319 | 77 | 21.040752 | 0.756889 | 0.066448 | 0 | 0.411765 | 0 | 0 | 0.051688 | 0.010082 | 0 | 0 | 0 | 0.003135 | 0 | 1 | 0.25 | false | 0 | 0.02451 | 0.196078 | 0.735294 | 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 |
748db5b41786bab067b492eb0b8d340b621d6f8f | 4,626 | py | Python | abacusai/deployment.py | Ankit-RealityEngines/api-python | 3627048d31df5972c5777de2a1c1211ea06a8804 | [
"MIT"
] | null | null | null | abacusai/deployment.py | Ankit-RealityEngines/api-python | 3627048d31df5972c5777de2a1c1211ea06a8804 | [
"MIT"
] | null | null | null | abacusai/deployment.py | Ankit-RealityEngines/api-python | 3627048d31df5972c5777de2a1c1211ea06a8804 | [
"MIT"
] | null | null | null | from .return_class import AbstractApiClass
from .refresh_schedule import RefreshSchedule
class Deployment(AbstractApiClass):
"""
A model deployment
"""
def __init__(self, client, deploymentId=None, name=None, status=None, description=None, deployedAt=None, createdAt=None, projectId=None, modelId=None, modelVersion=None, featureGroupId=None, featureGroupVersion=None, callsPerSecond=None, autoDeploy=None, regions=None, error=None, refreshSchedules={}):
super().__init__(client, deploymentId)
self.deployment_id = deploymentId
self.name = name
self.status = status
self.description = description
self.deployed_at = deployedAt
self.created_at = createdAt
self.project_id = projectId
self.model_id = modelId
self.model_version = modelVersion
self.feature_group_id = featureGroupId
self.feature_group_version = featureGroupVersion
self.calls_per_second = callsPerSecond
self.auto_deploy = autoDeploy
self.regions = regions
self.error = error
self.refresh_schedules = client._build_class(
RefreshSchedule, refreshSchedules)
def __repr__(self):
return f"Deployment(deployment_id={repr(self.deployment_id)}, name={repr(self.name)}, status={repr(self.status)}, description={repr(self.description)}, deployed_at={repr(self.deployed_at)}, created_at={repr(self.created_at)}, project_id={repr(self.project_id)}, model_id={repr(self.model_id)}, model_version={repr(self.model_version)}, feature_group_id={repr(self.feature_group_id)}, feature_group_version={repr(self.feature_group_version)}, calls_per_second={repr(self.calls_per_second)}, auto_deploy={repr(self.auto_deploy)}, regions={repr(self.regions)}, error={repr(self.error)}, refresh_schedules={repr(self.refresh_schedules)})"
def to_dict(self):
return {'deployment_id': self.deployment_id, 'name': self.name, 'status': self.status, 'description': self.description, 'deployed_at': self.deployed_at, 'created_at': self.created_at, 'project_id': self.project_id, 'model_id': self.model_id, 'model_version': self.model_version, 'feature_group_id': self.feature_group_id, 'feature_group_version': self.feature_group_version, 'calls_per_second': self.calls_per_second, 'auto_deploy': self.auto_deploy, 'regions': self.regions, 'error': self.error, 'refresh_schedules': self._get_attribute_as_dict(self.refresh_schedules)}
def refresh(self):
self.__dict__.update(self.describe().__dict__)
return self
def describe(self):
return self.client.describe_deployment(self.deployment_id)
def update(self, description=None):
return self.client.update_deployment(self.deployment_id, description)
def rename(self, name):
return self.client.rename_deployment(self.deployment_id, name)
def set_auto(self, enable=None):
return self.client.set_auto_deployment(self.deployment_id, enable)
def set_model_version(self, model_version):
return self.client.set_deployment_model_version(self.deployment_id, model_version)
def set_feature_group_version(self, feature_group_version):
return self.client.set_deployment_feature_group_version(self.deployment_id, feature_group_version)
def start(self):
return self.client.start_deployment(self.deployment_id)
def stop(self):
return self.client.stop_deployment(self.deployment_id)
def delete(self):
return self.client.delete_deployment(self.deployment_id)
def create_batch_prediction(self, name=None, global_prediction_args=None, explanations=False, output_format=None, output_location=None, database_connector_id=None, database_output_config=None, refresh_schedule=None, csv_input_prefix=None, csv_prediction_prefix=None, csv_explanations_prefix=None):
return self.client.create_batch_prediction(self.deployment_id, name, global_prediction_args, explanations, output_format, output_location, database_connector_id, database_output_config, refresh_schedule, csv_input_prefix, csv_prediction_prefix, csv_explanations_prefix)
def wait_for_deployment(self, wait_states={'PENDING', 'DEPLOYING'}, timeout=480):
return self.client._poll(self, wait_states, timeout=timeout)
def get_status(self):
return self.describe().status
def create_refresh_policy(self, cron: str):
return self.client.create_refresh_policy(self.name, cron, 'DEPLOYMENT', deployment_ids=[self.id])
def list_refresh_policies(self):
return self.client.list_refresh_policies(deployment_ids=[self.id])
| 57.111111 | 642 | 0.75508 | 586 | 4,626 | 5.643345 | 0.158703 | 0.041125 | 0.062897 | 0.055035 | 0.206834 | 0.112186 | 0.057454 | 0 | 0 | 0 | 0 | 0.000753 | 0.138997 | 4,626 | 80 | 643 | 57.825 | 0.829525 | 0.003891 | 0 | 0 | 0 | 0.017544 | 0.180689 | 0.137315 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0 | 0.035088 | 0.280702 | 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 |
749864186a6dd9c711cc350ae0e33d7867281662 | 162 | py | Python | problem_24.py | MasterScott/project-euler | 643df8258bf9ac84b14b648a3a5a254bc682c473 | [
"MIT"
] | null | null | null | problem_24.py | MasterScott/project-euler | 643df8258bf9ac84b14b648a3a5a254bc682c473 | [
"MIT"
] | null | null | null | problem_24.py | MasterScott/project-euler | 643df8258bf9ac84b14b648a3a5a254bc682c473 | [
"MIT"
] | 1 | 2019-10-28T23:33:46.000Z | 2019-10-28T23:33:46.000Z | from itertools import permutations
for i, p in enumerate(permutations([x for x in '0123456789'])):
if i == 10**6 - 1:
print ''.join(p)
break
| 23.142857 | 63 | 0.604938 | 24 | 162 | 4.083333 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 0.265432 | 162 | 6 | 64 | 27 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0.061728 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
776f426a84e27e37f4447fb48972e95dce547d74 | 162 | py | Python | lang/python/matplotlib/dyn.py | liuyang1/test | a4560e0c9ffd0bc054d55bbcf12a894ab5b7d417 | [
"MIT"
] | 8 | 2015-06-07T13:25:48.000Z | 2022-03-22T23:14:50.000Z | lang/python/matplotlib/dyn.py | liuyang1/test | a4560e0c9ffd0bc054d55bbcf12a894ab5b7d417 | [
"MIT"
] | 30 | 2016-01-29T01:36:41.000Z | 2018-09-19T07:01:22.000Z | lang/python/matplotlib/dyn.py | liuyang1/test | a4560e0c9ffd0bc054d55bbcf12a894ab5b7d417 | [
"MIT"
] | null | null | null | import matplotlib.pyplot as p
from scipy import eye
import time
for x in xrange(3, 7):
p.imshow(eye(x))
p.show(block=False)
time.sleep(3)
print x
| 18 | 29 | 0.67284 | 30 | 162 | 3.633333 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02381 | 0.222222 | 162 | 8 | 30 | 20.25 | 0.84127 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.375 | null | null | 0.125 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
777555e78b559e5e4b478451278bf7a1b55935a1 | 1,071 | py | Python | Strategy/python/strategy.py | JaviMiot/patternDesignJS_Python | 110cd02320e485c17f7d3b6bbafc4ffa53ae974c | [
"MIT"
] | null | null | null | Strategy/python/strategy.py | JaviMiot/patternDesignJS_Python | 110cd02320e485c17f7d3b6bbafc4ffa53ae974c | [
"MIT"
] | null | null | null | Strategy/python/strategy.py | JaviMiot/patternDesignJS_Python | 110cd02320e485c17f7d3b6bbafc4ffa53ae974c | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
class Operation(ABC):
@abstractmethod
def calculate(self, number1: float, number2: float) -> float:
pass
class Sum(Operation):
def calculate(self, number1: float, number2: float) -> float:
return number1 + number2
class Rest(Operation):
def calculate(self, number1: float, number2: float) -> float:
return number1 - number2
class MathOperation(ABC):
def __init__(self, instance: Operation):
self.__instance = instance
@property
def instance(self):
return self.__instance
@instance.setter
def instance(self, instance: Operation):
self.__instance = instance
def calculate(self, number1: float, number2: float) -> float:
return self.__instance.calculate(number1, number2)
if __name__ == '__main__':
mathOperators = MathOperation(Sum())
print(mathOperators.instance)
print(mathOperators.calculate(1, 2))
mathOperators.instance = Rest()
print(mathOperators.instance)
print(mathOperators.calculate(1, 2))
| 23.282609 | 65 | 0.68254 | 113 | 1,071 | 6.292035 | 0.247788 | 0.101266 | 0.090014 | 0.129395 | 0.627286 | 0.627286 | 0.511955 | 0.511955 | 0.293952 | 0.222222 | 0 | 0.021403 | 0.214753 | 1,071 | 45 | 66 | 23.8 | 0.824019 | 0 | 0 | 0.344828 | 0 | 0 | 0.00747 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.241379 | false | 0.034483 | 0.034483 | 0.137931 | 0.551724 | 0.137931 | 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 |
77a4bcb4eb5aca4624577ad893ccf4c83ff54da0 | 1,388 | py | Python | release/stubs.min/System/Security/AccessControl_parts/AuthorizationRuleCollection.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/System/Security/AccessControl_parts/AuthorizationRuleCollection.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/System/Security/AccessControl_parts/AuthorizationRuleCollection.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | class AuthorizationRuleCollection(ReadOnlyCollectionBase, ICollection, IEnumerable):
"""
Represents a collection of System.Security.AccessControl.AuthorizationRule objects.
AuthorizationRuleCollection()
"""
def AddRule(self, rule):
""" AddRule(self: AuthorizationRuleCollection,rule: AuthorizationRule) """
pass
def CopyTo(self, rules, index):
"""
CopyTo(self: AuthorizationRuleCollection,rules: Array[AuthorizationRule],index: int)
Copies the contents of the collection to an array.
rules: An array to which to copy the contents of the collection.
index: The zero-based index from which to begin copying.
"""
pass
def __getitem__(self, *args):
""" x.__getitem__(y) <==> x[y] """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __iter__(self, *args):
""" __iter__(self: IEnumerable) -> object """
pass
InnerList = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Gets the list of elements contained in the System.Collections.ReadOnlyCollectionBase instance.
"""
| 30.173913 | 221 | 0.657781 | 146 | 1,388 | 5.869863 | 0.417808 | 0.032672 | 0.056009 | 0.066511 | 0.192532 | 0.131855 | 0.131855 | 0.131855 | 0.131855 | 0.131855 | 0 | 0 | 0.232709 | 1,388 | 45 | 222 | 30.844444 | 0.804695 | 0.520173 | 0 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0.416667 | 0 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
77b07935b55d5c70675838e025530126172cd7e9 | 114 | py | Python | aula01/aula01.py | fabiolealsc/estudandoPython | be0e9211ba3d596a15a9427b612c537a102b858e | [
"MIT"
] | 3 | 2021-09-05T16:50:06.000Z | 2021-11-08T08:56:51.000Z | aula01/aula01.py | fabiolealsc/estudandoPython | be0e9211ba3d596a15a9427b612c537a102b858e | [
"MIT"
] | null | null | null | aula01/aula01.py | fabiolealsc/estudandoPython | be0e9211ba3d596a15a9427b612c537a102b858e | [
"MIT"
] | null | null | null | print("Hello, world")
def func():
pass
while True:
txt = input('Digite um valor: ')
print(eval(txt)) | 14.25 | 36 | 0.596491 | 16 | 114 | 4.25 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.236842 | 114 | 8 | 37 | 14.25 | 0.781609 | 0 | 0 | 0 | 0 | 0 | 0.252174 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0 | 0 | 0.166667 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
77e1cf7fad88dd83f35688487683b7260d719151 | 517 | py | Python | dltranz/data_load/augmentations/drop_day.py | KirillVladimirov/pytorch-lifestream | 83005b950d41de8afc11711fc955ffafb5ff7a9e | [
"Apache-2.0"
] | null | null | null | dltranz/data_load/augmentations/drop_day.py | KirillVladimirov/pytorch-lifestream | 83005b950d41de8afc11711fc955ffafb5ff7a9e | [
"Apache-2.0"
] | null | null | null | dltranz/data_load/augmentations/drop_day.py | KirillVladimirov/pytorch-lifestream | 83005b950d41de8afc11711fc955ffafb5ff7a9e | [
"Apache-2.0"
] | 1 | 2022-02-05T15:06:48.000Z | 2022-02-05T15:06:48.000Z | import numpy as np
import torch
class DropDay:
def __init__(self, event_time_name='event_time'):
self.event_time_name = event_time_name
def __call__(self, x):
mask = self.get_perm_ix(x[self.event_time_name])
new_x = {k: v[mask] for k, v in x.items()}
return new_x
@staticmethod
def get_perm_ix(event_time):
days = torch.unique(event_time, sorted=True)
ix = np.random.choice(len(days), 1)[0]
mask = event_time != days[ix]
return mask
| 25.85 | 56 | 0.634429 | 80 | 517 | 3.775 | 0.45 | 0.238411 | 0.172185 | 0.168874 | 0.172185 | 0.172185 | 0 | 0 | 0 | 0 | 0 | 0.005208 | 0.257253 | 517 | 19 | 57 | 27.210526 | 0.78125 | 0 | 0 | 0 | 0 | 0 | 0.019342 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.133333 | 0 | 0.533333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7ae91d54f6551b3200a7ad1c7b4b024eb589bb18 | 91 | py | Python | BackendBaggie/cartview/apps.py | Baggie-App/Updateapi | 80f200d7ffd4695e6348ce6bb9a7a31a6b821e77 | [
"MIT"
] | null | null | null | BackendBaggie/cartview/apps.py | Baggie-App/Updateapi | 80f200d7ffd4695e6348ce6bb9a7a31a6b821e77 | [
"MIT"
] | null | null | null | BackendBaggie/cartview/apps.py | Baggie-App/Updateapi | 80f200d7ffd4695e6348ce6bb9a7a31a6b821e77 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class CartviewConfig(AppConfig):
name = 'cartview'
| 15.166667 | 33 | 0.758242 | 10 | 91 | 6.9 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 91 | 5 | 34 | 18.2 | 0.907895 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7aef5d12e97ce42126f8f1a2e3852a9ec848f12a | 354 | py | Python | pywinrt/winsdk/windows/graphics/capture/interop/__init__.py | pywinrt/python-winsdk | 1e2958a712949579f5e84d38220062b2cec12511 | [
"MIT"
] | 3 | 2022-02-14T14:53:08.000Z | 2022-03-29T20:48:54.000Z | pywinrt/winsdk/windows/graphics/capture/interop/__init__.py | pywinrt/python-winsdk | 1e2958a712949579f5e84d38220062b2cec12511 | [
"MIT"
] | 4 | 2022-01-28T02:53:52.000Z | 2022-02-26T18:10:05.000Z | pywinrt/winsdk/windows/graphics/capture/interop/__init__.py | pywinrt/python-winsdk | 1e2958a712949579f5e84d38220062b2cec12511 | [
"MIT"
] | null | null | null | # WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
import winsdk
_ns_module = winsdk._import_ns_module("Windows.Graphics.Capture.Interop")
try:
import winsdk.windows.graphics.capture
except Exception:
pass
create_for_monitor = _ns_module.create_for_monitor
create_for_window = _ns_module.create_for_window
| 25.285714 | 86 | 0.805085 | 55 | 354 | 4.872727 | 0.6 | 0.119403 | 0.164179 | 0.126866 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012821 | 0.118644 | 354 | 13 | 87 | 27.230769 | 0.846154 | 0.237288 | 0 | 0 | 1 | 0 | 0.119403 | 0.119403 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.125 | 0.375 | 0 | 0.375 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
7af766090d703b356c60d610ebbb2f0858967ab4 | 5,271 | py | Python | tests/data/rings_ringspecs.py | ArdanaCLM/swiftlm | a251c7fa4524bf35c95c15fcc21ec608780b07f4 | [
"Apache-2.0"
] | 1 | 2020-09-01T12:34:24.000Z | 2020-09-01T12:34:24.000Z | tests/data/rings_ringspecs.py | ArdanaCLM/swiftlm | a251c7fa4524bf35c95c15fcc21ec608780b07f4 | [
"Apache-2.0"
] | null | null | null | tests/data/rings_ringspecs.py | ArdanaCLM/swiftlm | a251c7fa4524bf35c95c15fcc21ec608780b07f4 | [
"Apache-2.0"
] | null | null | null | # (c) Copyright 2015, 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# 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.
#
ringspec_simple = '''
global:
all_ring_specifications:
- region_name_not_used: region1
rings:
- display_name: Account Ring
min_part_hours: 12
name: account
partition_power: 17
replication_policy:
replica_count: 1
- display_name: Container Ring
min_part_hours: 12
name: container
partition_power: 17
replication_policy:
replica_count: 2
- default: true
display_name: General
min_part_hours: 12
name: object-0
partition_power: 17
replication_policy:
replica_count: 3
- default: false
display_name: EC
min_part_hours: 12
name: object-1
partition_power: 17
erasure_coding_policy:
ec_num_data_fragments: 4
ec_num_parity_fragments: 10
ec_type: jerasure_rs_vand
ec_object_segment_size: 1000000
'''
ringspec_region_zones = '''
global:
all_ring_specifications:
- region_name_not_used: region1
swift_regions:
- id: 2
server_groups:
- sg21
- sgtwotwo
- sgtwo3
- id: 3
server_groups:
- sg31
- sgthreetwo
- sgthree3
rings:
- display_name: Account Ring
min_part_hours: 12
name: account
partition_power: 17
replication_policy:
replica_count: 3
- display_name: Container Ring
min_part_hours: 12
name: container
partition_power: 17
replication_policy:
replica_count: 3
- default: true
display_name: General
min_part_hours: 12
name: object-0
partition_power: 17
replication_policy:
replica_count: 3
'''
ringspec_null_zones = '''
global:
all_ring_specifications:
- region_name_not_used: region1
swift_regions: []
swift_zones: []
rings:
- display_name: Account Ring
min_part_hours: 12
name: account
partition_power: 17
replication_policy:
replica_count: 3
swift_zones:
- id: 2
server_groups_omitted: on-purpose
- display_name: Container Ring
min_part_hours: 12
name: container
partition_power: 17
replication_policy:
replica_count: 3
- default: true
display_name: General
min_part_hours: 12
name: object-0
partition_power: 17
replication_policy:
replica_count: 3
'''
ringspec_zones_not_speced = '''
global:
all_ring_specifications:
- region_name_not_used: region1
rings:
- display_name: Account Ring
min_part_hours: 12
name: account
partition_power: 17
replication_policy:
replica_count: 3
- display_name: Container Ring
min_part_hours: 12
name: container
partition_power: 17
replication_policy:
replica_count: 3
- default: true
display_name: General
min_part_hours: 12
name: object-0
partition_power: 17
replication_policy:
replica_count: 3
'''
ringspec_zones_duplicate_in_ring = '''
global:
all_ring_specifications:
- region_name_not_used: region1
rings:
- display_name: Account Ring
min_part_hours: 12
name: account
partition_power: 17
replication_policy:
replica_count: 3
swift_zones:
- id: 1
server_groups:
- ONE
- SAME
- id: 2
server_groups:
- TWO
- SAME
- display_name: Container Ring
min_part_hours: 12
name: container
partition_power: 17
replication_policy:
replica_count: 3
- default: true
display_name: General
min_part_hours: 12
name: object-0
partition_power: 17
replication_policy:
replica_count: 3
'''
| 28.803279 | 75 | 0.540505 | 528 | 5,271 | 5.100379 | 0.263258 | 0.065355 | 0.071296 | 0.083179 | 0.687338 | 0.687338 | 0.678426 | 0.678426 | 0.678426 | 0.675826 | 0 | 0.04077 | 0.409031 | 5,271 | 182 | 76 | 28.961538 | 0.823756 | 0.116107 | 0 | 0.81875 | 0 | 0 | 0.96037 | 0.072798 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb1e4016be4331d352fd22fa658ec03e7e142dff | 161 | py | Python | Coursera/CICCP1/dezenas.py | marcelomiky/python_code | 4b843c78e16c37e981e4adfe47ae974ee0f2ad81 | [
"MIT"
] | 2 | 2020-10-19T13:53:59.000Z | 2021-08-05T19:48:07.000Z | Coursera/CICCP1/dezenas.py | marcelomiky/PythonCodes | 07f0db8019805b3b9567b7b57ddb49b4333a3aa2 | [
"MIT"
] | null | null | null | Coursera/CICCP1/dezenas.py | marcelomiky/PythonCodes | 07f0db8019805b3b9567b7b57ddb49b4333a3aa2 | [
"MIT"
] | null | null | null | numero_inteiro = int(input("Digite um número inteiro: "))
temp = numero_inteiro // 10
digito_dezena = temp % 10
print("O dígito das dezenas é", digito_dezena)
| 23 | 57 | 0.732919 | 24 | 161 | 4.75 | 0.708333 | 0.22807 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0.15528 | 161 | 6 | 58 | 26.833333 | 0.808824 | 0 | 0 | 0 | 0 | 0 | 0.298137 | 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 |
bb25f70ffa6ee8081a8ce9f87977d0f789c35355 | 881 | py | Python | devicegroups/tests.py | svelle/Lagerregal | d0340d2fa5bbb8dfc090c23a772f46f769064ea1 | [
"BSD-3-Clause"
] | null | null | null | devicegroups/tests.py | svelle/Lagerregal | d0340d2fa5bbb8dfc090c23a772f46f769064ea1 | [
"BSD-3-Clause"
] | null | null | null | devicegroups/tests.py | svelle/Lagerregal | d0340d2fa5bbb8dfc090c23a772f46f769064ea1 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import unicode_literals
from django.test.client import Client
from django.test import TestCase
from django.urls import reverse
import six
from model_mommy import mommy
from devicegroups.models import Devicegroup
from users.models import Lageruser
class DevicegroupTests(TestCase):
def setUp(self):
self.client = Client()
Lageruser.objects.create_superuser("test", "test@test.com", "test")
self.client.login(username='test', password='test')
def test_devicegroup_creation(self):
devicegroup = mommy.make(Devicegroup)
self.assertEqual(six.text_type(devicegroup), devicegroup.name)
self.assertEqual(devicegroup.get_absolute_url(), reverse('devicegroup-detail', kwargs={'pk': devicegroup.pk}))
self.assertEqual(devicegroup.get_edit_url(), reverse('devicegroup-edit', kwargs={'pk': devicegroup.pk}))
| 35.24 | 118 | 0.746879 | 106 | 881 | 6.075472 | 0.415094 | 0.046584 | 0.043478 | 0.090062 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144154 | 881 | 24 | 119 | 36.708333 | 0.854111 | 0 | 0 | 0 | 0 | 0 | 0.07605 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.111111 | false | 0.055556 | 0.444444 | 0 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
bb365dc3b0f658d8f759aeb22816bea5884e02ae | 223 | py | Python | inference/preprocessors/dummy.py | narumiruna/inference-template | 4946f4de632c49a8b65b484a4eb77979da8d8208 | [
"MIT"
] | null | null | null | inference/preprocessors/dummy.py | narumiruna/inference-template | 4946f4de632c49a8b65b484a4eb77979da8d8208 | [
"MIT"
] | null | null | null | inference/preprocessors/dummy.py | narumiruna/inference-template | 4946f4de632c49a8b65b484a4eb77979da8d8208 | [
"MIT"
] | null | null | null | from ..utils import get_logger
from .preprocessors import Preprocessor
LOGGER = get_logger(__name__)
class DummyPreprocessor(Preprocessor):
def __call__(self, frame):
LOGGER.info('Call dummy pre-processor')
| 20.272727 | 47 | 0.757848 | 26 | 223 | 6.115385 | 0.692308 | 0.113208 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156951 | 223 | 10 | 48 | 22.3 | 0.845745 | 0 | 0 | 0 | 0 | 0 | 0.107623 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
bb39bd1cb1f7b1f9160cbb2212804ba07a9c2e7f | 868 | py | Python | src/BeanPorter/bpcml/Decls.py | WeZZard/BeanPorter | 51a501c17aa7c14763bfe2bb361819f81119dfd1 | [
"MIT"
] | null | null | null | src/BeanPorter/bpcml/Decls.py | WeZZard/BeanPorter | 51a501c17aa7c14763bfe2bb361819f81119dfd1 | [
"MIT"
] | null | null | null | src/BeanPorter/bpcml/Decls.py | WeZZard/BeanPorter | 51a501c17aa7c14763bfe2bb361819f81119dfd1 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from abc import abstractmethod
from typing import Dict, Optional
from BeanPorter.bpcml.Exprs import Expr
class Decl(object):
def __init__(self):
pass
@abstractmethod
def evaluate(self, variables: Dict[str, str]) -> str:
pass
class RuleDecl(Decl):
def __init__(self, expr: Optional[Expr] = None):
self.expr = expr
super().__init__()
def __str__(self) -> str:
return self.expr.__str__()
def __repr__(self) -> str:
return self.expr.__repr__()
@abstractmethod
def evaluate(self, variables: Dict[str, str]) -> str:
if self.expr is None:
return ""
return self.expr.evaluate(variables)
@staticmethod
def make_empty() -> 'RuleDecl':
return RuleDecl()
@staticmethod
def make(expr: Expr) -> 'RuleDecl':
assert(expr is not None)
return RuleDecl(expr)
| 19.727273 | 55 | 0.658986 | 108 | 868 | 5.027778 | 0.342593 | 0.088398 | 0.077348 | 0.106814 | 0.265193 | 0.187845 | 0.187845 | 0.187845 | 0.187845 | 0 | 0 | 0.001481 | 0.22235 | 868 | 43 | 56 | 20.186047 | 0.802963 | 0.024194 | 0 | 0.275862 | 0 | 0 | 0.018913 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 1 | 0.275862 | false | 0.068966 | 0.103448 | 0.103448 | 0.655172 | 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 |
bb51cff9c7fd98ea2e3be2188c9165fb1f513dcf | 372 | py | Python | 02-python-oo/aula-05/exemplos/train.py | opensanca/trilha-python | 9ffadd266e22a920a3c1acfdbc6a5a4645fce9d6 | [
"MIT"
] | 47 | 2016-05-19T22:37:18.000Z | 2022-02-22T02:34:18.000Z | 02-python-oo/aula-05/exemplos/train.py | opensanca/trilha-python | 9ffadd266e22a920a3c1acfdbc6a5a4645fce9d6 | [
"MIT"
] | 21 | 2016-05-20T12:35:25.000Z | 2016-07-26T00:23:33.000Z | 02-python-oo/aula-05/exemplos/train.py | lamenezes/python-intro | 9ffadd266e22a920a3c1acfdbc6a5a4645fce9d6 | [
"MIT"
] | 25 | 2016-05-19T22:52:32.000Z | 2022-01-08T15:15:36.000Z | """
Cria uma classe trem que possui carros. O trem é iterável e cada elemento
retornado pela iteração retorna um sring com o número do carro.
"""
class Train:
def __init__(self, cars):
self.cars = cars
def __len__(self): # len(train)
return self.cars
def __iter__(self):
return ('car #{}'.format(i + 1) for i in range(self.cars))
| 23.25 | 73 | 0.642473 | 56 | 372 | 4.053571 | 0.696429 | 0.140969 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003597 | 0.252688 | 372 | 15 | 74 | 24.8 | 0.81295 | 0.400538 | 0 | 0 | 0 | 0 | 0.032558 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | false | 0 | 0 | 0.285714 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bb52f0733efe5513920fdebfb1eef593a99fcd79 | 471 | py | Python | home/migrations/0003_auto_20210622_1116.py | screw-pack/hazel | ade9b6c6a396b3da2bb2d5505cfb63e1579cdab8 | [
"MIT"
] | null | null | null | home/migrations/0003_auto_20210622_1116.py | screw-pack/hazel | ade9b6c6a396b3da2bb2d5505cfb63e1579cdab8 | [
"MIT"
] | null | null | null | home/migrations/0003_auto_20210622_1116.py | screw-pack/hazel | ade9b6c6a396b3da2bb2d5505cfb63e1579cdab8 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.4 on 2021-06-22 09:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0002_auto_20210618_1545'),
]
operations = [
migrations.AlterModelOptions(
name='activity',
options={'ordering': ['start_time']},
),
migrations.AlterModelOptions(
name='agenda',
options={'ordering': ['entry']},
),
]
| 21.409091 | 49 | 0.562633 | 43 | 471 | 6.069767 | 0.790698 | 0.206897 | 0.237548 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094512 | 0.303609 | 471 | 21 | 50 | 22.428571 | 0.70122 | 0.095541 | 0 | 0.266667 | 1 | 0 | 0.169811 | 0.054245 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.266667 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb542cac2a03cdb3c031650c9fa28df93e7a1256 | 309 | py | Python | ex9-11.py | yiyidhuang/PythonCrashCrouse2nd | 3512f9ab8fcf32c6145604a37e2a62feddf174d1 | [
"MIT"
] | null | null | null | ex9-11.py | yiyidhuang/PythonCrashCrouse2nd | 3512f9ab8fcf32c6145604a37e2a62feddf174d1 | [
"MIT"
] | null | null | null | ex9-11.py | yiyidhuang/PythonCrashCrouse2nd | 3512f9ab8fcf32c6145604a37e2a62feddf174d1 | [
"MIT"
] | null | null | null | from admins import Admin, Privileges
eric = Admin('eric', 'matthes', 'e_mattches', 'e_mattches@example.com', 'alaska')
eric_privileges = [
'can reset passwords',
'can moderate discussions',
'can suspend accounts',
]
eric.privileges.privileges = eric_privileges
eric.privileges.show_privileges()
| 25.75 | 81 | 0.734628 | 36 | 309 | 6.166667 | 0.555556 | 0.252252 | 0.216216 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139159 | 309 | 11 | 82 | 28.090909 | 0.834586 | 0 | 0 | 0 | 0 | 0 | 0.36246 | 0.071197 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.111111 | 0.111111 | 0 | 0.111111 | 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 |
bb574f490a6c4afce6122ec48aebabf0148da56e | 3,999 | py | Python | threemegawatt/threemegawatt/settings/development.py | opemipoVRB/MeterTracker | 3c52e704844628db31b72d008983b6c090266775 | [
"MIT"
] | null | null | null | threemegawatt/threemegawatt/settings/development.py | opemipoVRB/MeterTracker | 3c52e704844628db31b72d008983b6c090266775 | [
"MIT"
] | null | null | null | threemegawatt/threemegawatt/settings/development.py | opemipoVRB/MeterTracker | 3c52e704844628db31b72d008983b6c090266775 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←
←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←
↓↓...........................................................................↓↓
↓↓..........................↓↓↓↓↓↓↓↓↓↓↓↓↓....................................↓↓
↓↓.......................↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓.................................↓↓
↓↓.....................↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓...............................↓↓
↓↓....................↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓..............................↓↓
↓↓...................↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓.↓↓...............................↓↓
↓↓...................↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓...↓↓..............................↓↓
↓↓...................↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓.↓↓...↓↓↓.............................↓↓
↓↓...................↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓..............................↓↓
↓↓....................↓↓↓↓↓↓↓↓↓↓↓↓↓.....↓↓↓↓↓↓↓↓↓............................↓↓
↓↓......................↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓..↓↓↓↓↓↓↓............................↓↓
↓↓...................................↓↓↓.....................................↓↓
↓↓.................↓↓................↓↓↓↓ ↓↓↓↓↓↓↓........↓...................↓↓
↓↓...............↓↓↓↓↓↓..............↓↓↓↓↓↓↓↓↓↓↓↓↓...↓↓↓↓↓↓..................↓↓
↓↓............↓↓↓↓..↓↓↓↓↓.........................↓↓↓↓↓↓↓↓↓..................↓↓
↓↓............↓↓↓↓...↓↓↓↓↓↓↓....................↓↓↓↓↓↓.↓↓.↓↓.................↓↓
↓↓...............↓↓↓↓↓↓↓↓↓↓↓↓↓↓............↓↓↓↓↓↓↓↓..........................↓↓
↓↓.........................↓↓↓↓↓↓↓↓↓...↓↓↓↓↓↓↓...............................↓↓
↓↓..............................↓↓↓↓↓↓↓↓↓↓...................................↓↓
↓↓..........................↓↓↓↓↓....↓↓↓↓↓↓↓↓↓...............................↓↓
↓↓............↓↓.↓↓↓↓↓↓↓↓↓↓↓↓↓............↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓..................↓↓
↓↓............↓↓.↓↓..↓↓↓↓.....................↓↓↓↓↓↓↓↓↓↓↓↓↓↓.................↓↓
↓↓..............↓↓↓↓↓↓............................↓↓.↓↓↓↓↓↓↓.................↓↓
↓↓.................. ......................↓↓
↓↓.................. ↑↑↑ ↑↑↑ ↑↑↑↑↑↑↑ ↑↑↑↑↑↑↑ .......................↓↓
↓↓.................. ↑↑↑ ↑↑↑ ↑↑↑ ↑↑↑↑ ↑↑↑ ↑↑↑↑.....................↓↓
↓↓.................. ↑↑↨ ↑↑↑ ↑↑↨ ↨↑↑ ↑↑↨ ↨↑↑......................↓↓
↓↓.................. ↨↑↨ ↑↨↑ ↨↑↨ ↨↑↨ ↨↑↨ ↨↑↨......................↓↓
↓↓.................. ↑↨↑ ↨↑↨ ↨↨↑↨↑↨↨↑↑↨ ↨↨↑↨↑↨↨↑↑↨.....................↓↓
↓↓.................. ↨↑↨ ↨↨↨ ↨↨↨ ↨↨↨ ↨↨↨ ↨↨↨....................↓↓
↓↓.................. :↨: ↨↨: ↨↨: :↨↨ ↨↨: :::....................↓↓
↓↓................... ::↨↨:↨ :↨: :↨: :↨: :::....................↓↓
↓↓.................... :::: ::: ::: ::: :::....................↓↓
↓↓...................... : : : ::::::: ....................↓↓
↓↓...........................................................................↓↓
↓↓←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←↓↓
↓↓→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→↓↓
↓↓ development.py.py Created by Durodola Opemipo 2019 ↓↓
↓↓ Personal Email : <opemipodurodola@gmail.com> ↓↓
↓↓ Telephone Number: +2348182104309 ↓↓
↓↓→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→↓↓
↓↓←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←↓↓
"""
import os
from threemegawatt.settings.base import *
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env("DEBUG")
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
| 58.808824 | 79 | 0.112778 | 257 | 3,999 | 6.389105 | 0.381323 | 0.119367 | 0.058465 | 0.034105 | 0.008526 | 0.008526 | 0 | 0 | 0 | 0 | 0 | 0.007283 | 0.107277 | 3,999 | 67 | 80 | 59.686567 | 0.118207 | 0.955739 | 0 | 0 | 0 | 0 | 0.202454 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
249c43ce612636beb782922b00342077fa5dc793 | 76 | py | Python | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/N/nuclear magneton in inverse meters per tesla.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | null | null | null | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/N/nuclear magneton in inverse meters per tesla.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | null | null | null | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/N/nuclear magneton in inverse meters per tesla.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | 1 | 2021-02-04T04:51:48.000Z | 2021-02-04T04:51:48.000Z | constants.physical_constants["nuclear magneton in inverse meters per tesla"] | 76 | 76 | 0.855263 | 10 | 76 | 6.4 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078947 | 76 | 1 | 76 | 76 | 0.914286 | 0 | 0 | 0 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
24aa08a1924956fa17aa4dbec0f66deb43113a38 | 1,390 | py | Python | core/utils.py | kasittig/advent_of_code | e536bfbe0a9a05cbee2b9c241bc2fea78db4ee27 | [
"MIT"
] | null | null | null | core/utils.py | kasittig/advent_of_code | e536bfbe0a9a05cbee2b9c241bc2fea78db4ee27 | [
"MIT"
] | 1 | 2021-12-18T03:11:27.000Z | 2021-12-18T03:11:27.000Z | core/utils.py | kasittig/advent_of_code | e536bfbe0a9a05cbee2b9c241bc2fea78db4ee27 | [
"MIT"
] | null | null | null | import os
from collections import defaultdict
from typing import Any, Dict, Iterable, List, Set, Union
def validate_and_read_file(filepath: str) -> List[str]:
if not os.path.exists(filepath):
raise FileNotFoundError(f"Error: no file found at {filepath}")
return open(filepath).readlines()
def get_default_input_filename(day: str, year: str) -> str:
return f"inputs/{year}/day_{day}.txt"
def get_default_solution_filename(day: str, year: str) -> str:
return f"daily_solutions/year_{year}/day_{day}.py"
def get_default_test_filename(day: str, year: str) -> str:
return f"daily_solutions/year_{year}/tests/test_day_{day}.py"
def group_entries_by_line_break(input_lines: List[str]) -> List[List[str]]:
entries: List[List[str]] = []
current_entry: List[str] = []
for line in input_lines:
line = line.strip()
if line == "":
entries.append(current_entry)
current_entry = []
else:
current_entry.append(line.strip())
if current_entry:
entries.append(current_entry)
return entries
def get_frequency_counts(input_list: Iterable[Any]) -> Dict[Any, int]:
count_dict: Dict[Any, int] = defaultdict(int)
for elt in input_list:
count_dict[elt] += 1
return count_dict
def get_unique_entries(entry: Iterable[Any]) -> Set[Any]:
return {e for e in entry}
| 27.8 | 75 | 0.67554 | 197 | 1,390 | 4.558376 | 0.345178 | 0.080178 | 0.04343 | 0.060134 | 0.152561 | 0.152561 | 0.152561 | 0.152561 | 0.11804 | 0.11804 | 0 | 0.000902 | 0.202158 | 1,390 | 49 | 76 | 28.367347 | 0.808837 | 0 | 0 | 0.060606 | 0 | 0 | 0.109353 | 0.084892 | 0 | 0 | 0 | 0 | 0 | 1 | 0.212121 | false | 0 | 0.090909 | 0.121212 | 0.515152 | 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 |
24acf2037e2804da3c6e1f82c0c898b338afaf0e | 4,067 | py | Python | reclass/storage/tests/test_memcache_proxy.py | scivisum/reclass | 71608ae3999a549d5e1efd4520cd2ad6a3b2b554 | [
"Artistic-2.0"
] | 54 | 2017-09-18T12:38:11.000Z | 2022-03-06T03:53:52.000Z | reclass/storage/tests/test_memcache_proxy.py | scivisum/reclass | 71608ae3999a549d5e1efd4520cd2ad6a3b2b554 | [
"Artistic-2.0"
] | 47 | 2017-09-13T07:45:46.000Z | 2020-12-03T10:00:25.000Z | reclass/storage/tests/test_memcache_proxy.py | scivisum/reclass | 71608ae3999a549d5e1efd4520cd2ad6a3b2b554 | [
"Artistic-2.0"
] | 24 | 2017-08-17T10:11:34.000Z | 2021-06-28T09:57:45.000Z | #
# -*- coding: utf-8 -*-
#
# This file is part of reclass (http://github.com/madduck/reclass)
#
# Copyright © 2007–14 martin f. krafft <madduck@madduck.net>
# Released under the terms of the Artistic Licence 2.0
#
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from reclass.settings import Settings
from reclass.storage.memcache_proxy import MemcacheProxy
from reclass.storage import NodeStorageBase
import unittest
try:
import unittest.mock as mock
except ImportError:
import mock
class TestMemcacheProxy(unittest.TestCase):
def setUp(self):
self._storage = mock.MagicMock(spec_set=NodeStorageBase)
def test_no_nodes_caching(self):
p = MemcacheProxy(self._storage, cache_nodes=False)
NAME = 'foo'; NAME2 = 'bar'; RET = 'baz'; SETTINGS = Settings()
self._storage.get_node.return_value = RET
self.assertEqual(p.get_node(NAME, SETTINGS), RET)
self.assertEqual(p.get_node(NAME, SETTINGS), RET)
self.assertEqual(p.get_node(NAME2, SETTINGS), RET)
self.assertEqual(p.get_node(NAME2, SETTINGS), RET)
expected = [mock.call(NAME, SETTINGS), mock.call(NAME, SETTINGS),
mock.call(NAME2, SETTINGS), mock.call(NAME2, SETTINGS)]
self.assertListEqual(self._storage.get_node.call_args_list, expected)
def test_nodes_caching(self):
p = MemcacheProxy(self._storage, cache_nodes=True)
NAME = 'foo'; NAME2 = 'bar'; RET = 'baz'; SETTINGS = Settings()
self._storage.get_node.return_value = RET
self.assertEqual(p.get_node(NAME, SETTINGS), RET)
self.assertEqual(p.get_node(NAME, SETTINGS), RET)
self.assertEqual(p.get_node(NAME2, SETTINGS), RET)
self.assertEqual(p.get_node(NAME2, SETTINGS), RET)
expected = [mock.call(NAME, SETTINGS), mock.call(NAME2, SETTINGS)] # called once each
self.assertListEqual(self._storage.get_node.call_args_list, expected)
def test_no_classes_caching(self):
p = MemcacheProxy(self._storage, cache_classes=False)
NAME = 'foo'; NAME2 = 'bar'; RET = 'baz'; SETTINGS = Settings()
self._storage.get_class.return_value = RET
self.assertEqual(p.get_class(NAME, None, SETTINGS), RET)
self.assertEqual(p.get_class(NAME, None, SETTINGS), RET)
self.assertEqual(p.get_class(NAME2, None, SETTINGS), RET)
self.assertEqual(p.get_class(NAME2, None, SETTINGS), RET)
expected = [mock.call(NAME, None, SETTINGS), mock.call(NAME, None, SETTINGS),
mock.call(NAME2, None, SETTINGS), mock.call(NAME2, None, SETTINGS)]
self.assertListEqual(self._storage.get_class.call_args_list, expected)
def test_classes_caching(self):
p = MemcacheProxy(self._storage, cache_classes=True)
NAME = 'foo'; NAME2 = 'bar'; RET = 'baz'; SETTINGS = Settings()
self._storage.get_class.return_value = RET
self.assertEqual(p.get_class(NAME, None, SETTINGS), RET)
self.assertEqual(p.get_class(NAME, None, SETTINGS), RET)
self.assertEqual(p.get_class(NAME2, None, SETTINGS), RET)
self.assertEqual(p.get_class(NAME2, None, SETTINGS), RET)
expected = [mock.call(NAME, None, SETTINGS), mock.call(NAME2, None, SETTINGS)] # called once each
self.assertListEqual(self._storage.get_class.call_args_list, expected)
def test_nodelist_no_caching(self):
p = MemcacheProxy(self._storage, cache_nodelist=False)
p.enumerate_nodes()
p.enumerate_nodes()
expected = [mock.call(), mock.call()]
self.assertListEqual(self._storage.enumerate_nodes.call_args_list, expected)
def test_nodelist_caching(self):
p = MemcacheProxy(self._storage, cache_nodelist=True)
p.enumerate_nodes()
p.enumerate_nodes()
expected = [mock.call()] # once only
self.assertListEqual(self._storage.enumerate_nodes.call_args_list, expected)
if __name__ == '__main__':
unittest.main()
| 43.265957 | 105 | 0.69191 | 519 | 4,067 | 5.208092 | 0.181118 | 0.069182 | 0.106548 | 0.112468 | 0.774325 | 0.769515 | 0.766556 | 0.748798 | 0.698483 | 0.572697 | 0 | 0.008214 | 0.191788 | 4,067 | 93 | 106 | 43.731183 | 0.813508 | 0.059503 | 0 | 0.478873 | 0 | 0 | 0.011539 | 0 | 0 | 0 | 0 | 0 | 0.309859 | 1 | 0.098592 | false | 0 | 0.15493 | 0 | 0.267606 | 0.014085 | 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 |
24bf65ebd5def1edf26cf1f3544da9ded8c43a2f | 164 | py | Python | Python_Exercise/py_exercise.py | kindyluv/My_Personal_Python_Exercises | 5192ee6ab57c537f0231ee004f06879f14ba2138 | [
"MIT"
] | null | null | null | Python_Exercise/py_exercise.py | kindyluv/My_Personal_Python_Exercises | 5192ee6ab57c537f0231ee004f06879f14ba2138 | [
"MIT"
] | null | null | null | Python_Exercise/py_exercise.py | kindyluv/My_Personal_Python_Exercises | 5192ee6ab57c537f0231ee004f06879f14ba2138 | [
"MIT"
] | null | null | null | has_high_income = True
has_good_credit = True
if has_high_income and has_good_credit:
print("Eligible for loan")
else:
print("Ineligible for loan")
| 20.5 | 40 | 0.72561 | 25 | 164 | 4.44 | 0.56 | 0.126126 | 0.234234 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20122 | 164 | 7 | 41 | 23.428571 | 0.847328 | 0 | 0 | 0 | 0 | 0 | 0.229299 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
24c2c16a4acb45ab5b7484cfae6c99888157396c | 454 | py | Python | monitor/views.py | scsich/phagescan | 3394b6a80e62c175b1e10477f58f7b609c399085 | [
"Apache-2.0"
] | 21 | 2015-02-03T18:41:23.000Z | 2022-03-18T20:16:13.000Z | monitor/views.py | scsich/phagescan | 3394b6a80e62c175b1e10477f58f7b609c399085 | [
"Apache-2.0"
] | null | null | null | monitor/views.py | scsich/phagescan | 3394b6a80e62c175b1e10477f58f7b609c399085 | [
"Apache-2.0"
] | 6 | 2015-03-03T11:22:21.000Z | 2021-07-18T10:59:15.000Z |
from djcelery.models import WorkerState
from django.views.generic import ListView
import datetime
class MonitorListView(ListView):
model = WorkerState
queryset = WorkerState.objects.filter(last_heartbeat__gte=datetime.datetime.utcnow() - datetime.timedelta(minutes=5))
# todo paginate the list so we don't dump everything
def dispatch(self, request, *args, **kwargs):
return super(MonitorListView, self).dispatch(request, *args, **kwargs)
| 25.222222 | 118 | 0.781938 | 56 | 454 | 6.285714 | 0.732143 | 0.0625 | 0.096591 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002506 | 0.121145 | 454 | 17 | 119 | 26.705882 | 0.879699 | 0.110132 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0.125 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
24c61967065b81daa7a84b34568d13d782ce537d | 418 | py | Python | filter_meter_data/xlclass/globals.py | phizzl3/FilterMeterReadData | a057c494a37f613c0d76c18d7349351771b63e08 | [
"MIT"
] | 1 | 2021-01-19T16:56:24.000Z | 2021-01-19T16:56:24.000Z | filter_meter_data/xlclass/globals.py | phizzl3/FilterMeterReadData | a057c494a37f613c0d76c18d7349351771b63e08 | [
"MIT"
] | 6 | 2021-02-28T14:31:57.000Z | 2021-03-15T20:23:52.000Z | xlclass/globals.py | phizzl3/xlclass | 09859d38e4953608ea0013fcc92b1e4c669bcaf6 | [
"MIT"
] | null | null | null | from openpyxl.styles import PatternFill
# Color dict for background fill
COLORS = {'red': PatternFill(fgColor='FF0000', fill_type='solid'),
'green': PatternFill(fgColor='00b050', fill_type='solid'),
'orange': PatternFill(fgColor='FFC000', fill_type='solid'),
'yellow': PatternFill(fgColor='FFFF00', fill_type='solid'),
'gray': PatternFill(fgColor='C0C0C0', fill_type='solid')}
| 46.444444 | 69 | 0.672249 | 46 | 418 | 6 | 0.521739 | 0.326087 | 0.235507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048571 | 0.162679 | 418 | 8 | 70 | 52.25 | 0.74 | 0.07177 | 0 | 0 | 0 | 0 | 0.204663 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
24d847e5d03cf7ba2d903128103f250d10a6fe3c | 511 | py | Python | set3/p3_5.py | Felpezs/IPL_2021 | eaef2baec96f16c1486f4ec5af6eff097f81fcd2 | [
"MIT"
] | 1 | 2021-07-08T19:28:06.000Z | 2021-07-08T19:28:06.000Z | set3/p3_5.py | Felpezs/IPL_2021 | eaef2baec96f16c1486f4ec5af6eff097f81fcd2 | [
"MIT"
] | null | null | null | set3/p3_5.py | Felpezs/IPL_2021 | eaef2baec96f16c1486f4ec5af6eff097f81fcd2 | [
"MIT"
] | null | null | null | def approx_derivative(f, x: int, delta = 1e-6):
return (f(x + delta) - f(x - delta))/(2 * delta)
def approx_derivative_2(f, delta = 1e-6):
def new_func(x):
return (f(x + delta) - f(x - delta))/(2 * delta)
return new_func
def approx_integral(f, lo, hi, num_regions):
area = 0
h = (hi - lo)/num_regions
x = lo + h
for i in range(num_regions - 1):
area += f(x)
x += h
total_area = h * ((f(hi) + f(lo))/2 + area)
return total_area | 26.894737 | 57 | 0.528376 | 84 | 511 | 3.083333 | 0.321429 | 0.046332 | 0.108108 | 0.100386 | 0.200772 | 0.200772 | 0.200772 | 0.200772 | 0.200772 | 0 | 0 | 0.028571 | 0.315068 | 511 | 19 | 58 | 26.894737 | 0.711429 | 0 | 0 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0 | 0.133333 | 0.533333 | 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 |
24ed9a457f7b83e0a213c03d5495eef7ad64ec9f | 54 | py | Python | Flask-todolist-Sqlite3-master/venv/lib/python3.6/sre_constants.py | IncredibleDraco/MyScholar | 272aafa33f7227d1bc0d937d046788cbabede453 | [
"Apache-2.0"
] | null | null | null | Flask-todolist-Sqlite3-master/venv/lib/python3.6/sre_constants.py | IncredibleDraco/MyScholar | 272aafa33f7227d1bc0d937d046788cbabede453 | [
"Apache-2.0"
] | null | null | null | Flask-todolist-Sqlite3-master/venv/lib/python3.6/sre_constants.py | IncredibleDraco/MyScholar | 272aafa33f7227d1bc0d937d046788cbabede453 | [
"Apache-2.0"
] | 1 | 2019-11-25T10:25:21.000Z | 2019-11-25T10:25:21.000Z | /home/sheldon/anaconda3/lib/python3.6/sre_constants.py | 54 | 54 | 0.851852 | 9 | 54 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 0 | 54 | 1 | 54 | 54 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
24f0c6c494f81e8ebac822ae3156cf6a71fdea70 | 197 | py | Python | update_ip/services/__init__.py | vishnuprasadnta/update-ip | 22992b6ec272ebd4f684392cad11254e463e619c | [
"BSD-3-Clause"
] | null | null | null | update_ip/services/__init__.py | vishnuprasadnta/update-ip | 22992b6ec272ebd4f684392cad11254e463e619c | [
"BSD-3-Clause"
] | null | null | null | update_ip/services/__init__.py | vishnuprasadnta/update-ip | 22992b6ec272ebd4f684392cad11254e463e619c | [
"BSD-3-Clause"
] | null | null | null | from nfsn import NearlyFreeSpeechService
from webfaction import WebFactionService
services= [WebFactionService, NearlyFreeSpeechService]
services_by_name= dict(((s.__name__,s) for s in services))
| 32.833333 | 58 | 0.84264 | 22 | 197 | 7.272727 | 0.590909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.091371 | 197 | 5 | 59 | 39.4 | 0.893855 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
24f8fbec9bbb99a029907adb70cb243de5f2d665 | 28,356 | py | Python | sdk/python/pulumi_aws_native/eks/_inputs.py | AaronFriel/pulumi-aws-native | 5621690373ac44accdbd20b11bae3be1baf022d1 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws_native/eks/_inputs.py | AaronFriel/pulumi-aws-native | 5621690373ac44accdbd20b11bae3be1baf022d1 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws_native/eks/_inputs.py | AaronFriel/pulumi-aws-native | 5621690373ac44accdbd20b11bae3be1baf022d1 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from ._enums import *
__all__ = [
'AddonTagArgs',
'ClusterEncryptionConfigProviderPropertiesArgs',
'ClusterEncryptionConfigArgs',
'ClusterKubernetesNetworkConfigArgs',
'ClusterLoggingArgs',
'ClusterResourcesVpcConfigArgs',
'ClusterTagArgs',
'FargateProfileLabelArgs',
'FargateProfileSelectorArgs',
'FargateProfileTagArgs',
'NodegroupLaunchTemplateSpecificationArgs',
'NodegroupRemoteAccessArgs',
'NodegroupScalingConfigArgs',
'NodegroupTaintArgs',
'NodegroupUpdateConfigArgs',
]
@pulumi.input_type
class AddonTagArgs:
def __init__(__self__, *,
key: pulumi.Input[str],
value: pulumi.Input[str]):
"""
A key-value pair to associate with a resource.
:param pulumi.Input[str] key: The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
:param pulumi.Input[str] value: The value for the tag. You can specify a value that is 1 to 255 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
pulumi.set(__self__, "key", key)
pulumi.set(__self__, "value", value)
@property
@pulumi.getter
def key(self) -> pulumi.Input[str]:
"""
The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
return pulumi.get(self, "key")
@key.setter
def key(self, value: pulumi.Input[str]):
pulumi.set(self, "key", value)
@property
@pulumi.getter
def value(self) -> pulumi.Input[str]:
"""
The value for the tag. You can specify a value that is 1 to 255 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
return pulumi.get(self, "value")
@value.setter
def value(self, value: pulumi.Input[str]):
pulumi.set(self, "value", value)
@pulumi.input_type
class ClusterEncryptionConfigProviderPropertiesArgs:
def __init__(__self__, *,
key_arn: Optional[pulumi.Input[str]] = None):
"""
The encryption provider for the cluster.
:param pulumi.Input[str] key_arn: Amazon Resource Name (ARN) or alias of the KMS key. The KMS key must be symmetric, created in the same region as the cluster, and if the KMS key was created in a different account, the user must have access to the KMS key.
"""
if key_arn is not None:
pulumi.set(__self__, "key_arn", key_arn)
@property
@pulumi.getter(name="keyArn")
def key_arn(self) -> Optional[pulumi.Input[str]]:
"""
Amazon Resource Name (ARN) or alias of the KMS key. The KMS key must be symmetric, created in the same region as the cluster, and if the KMS key was created in a different account, the user must have access to the KMS key.
"""
return pulumi.get(self, "key_arn")
@key_arn.setter
def key_arn(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "key_arn", value)
@pulumi.input_type
class ClusterEncryptionConfigArgs:
def __init__(__self__, *,
provider: Optional[pulumi.Input['ClusterEncryptionConfigProviderPropertiesArgs']] = None,
resources: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
"""
The encryption configuration for the cluster
:param pulumi.Input['ClusterEncryptionConfigProviderPropertiesArgs'] provider: The encryption provider for the cluster.
:param pulumi.Input[Sequence[pulumi.Input[str]]] resources: Specifies the resources to be encrypted. The only supported value is "secrets".
"""
if provider is not None:
pulumi.set(__self__, "provider", provider)
if resources is not None:
pulumi.set(__self__, "resources", resources)
@property
@pulumi.getter
def provider(self) -> Optional[pulumi.Input['ClusterEncryptionConfigProviderPropertiesArgs']]:
"""
The encryption provider for the cluster.
"""
return pulumi.get(self, "provider")
@provider.setter
def provider(self, value: Optional[pulumi.Input['ClusterEncryptionConfigProviderPropertiesArgs']]):
pulumi.set(self, "provider", value)
@property
@pulumi.getter
def resources(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Specifies the resources to be encrypted. The only supported value is "secrets".
"""
return pulumi.get(self, "resources")
@resources.setter
def resources(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "resources", value)
@pulumi.input_type
class ClusterKubernetesNetworkConfigArgs:
def __init__(__self__, *,
ip_family: Optional[pulumi.Input['ClusterKubernetesNetworkConfigIpFamily']] = None,
service_ipv4_cidr: Optional[pulumi.Input[str]] = None,
service_ipv6_cidr: Optional[pulumi.Input[str]] = None):
"""
The Kubernetes network configuration for the cluster.
:param pulumi.Input['ClusterKubernetesNetworkConfigIpFamily'] ip_family: Ipv4 or Ipv6, Ipv6 is only supported on cluster with k8s version 1.21
:param pulumi.Input[str] service_ipv4_cidr: The CIDR block to assign Kubernetes service IP addresses from. If you don't specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap with resources in other networks that are peered or connected to your VPC.
:param pulumi.Input[str] service_ipv6_cidr: The CIDR block to assign Kubernetes service IP addresses from.
"""
if ip_family is not None:
pulumi.set(__self__, "ip_family", ip_family)
if service_ipv4_cidr is not None:
pulumi.set(__self__, "service_ipv4_cidr", service_ipv4_cidr)
if service_ipv6_cidr is not None:
pulumi.set(__self__, "service_ipv6_cidr", service_ipv6_cidr)
@property
@pulumi.getter(name="ipFamily")
def ip_family(self) -> Optional[pulumi.Input['ClusterKubernetesNetworkConfigIpFamily']]:
"""
Ipv4 or Ipv6, Ipv6 is only supported on cluster with k8s version 1.21
"""
return pulumi.get(self, "ip_family")
@ip_family.setter
def ip_family(self, value: Optional[pulumi.Input['ClusterKubernetesNetworkConfigIpFamily']]):
pulumi.set(self, "ip_family", value)
@property
@pulumi.getter(name="serviceIpv4Cidr")
def service_ipv4_cidr(self) -> Optional[pulumi.Input[str]]:
"""
The CIDR block to assign Kubernetes service IP addresses from. If you don't specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap with resources in other networks that are peered or connected to your VPC.
"""
return pulumi.get(self, "service_ipv4_cidr")
@service_ipv4_cidr.setter
def service_ipv4_cidr(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "service_ipv4_cidr", value)
@property
@pulumi.getter(name="serviceIpv6Cidr")
def service_ipv6_cidr(self) -> Optional[pulumi.Input[str]]:
"""
The CIDR block to assign Kubernetes service IP addresses from.
"""
return pulumi.get(self, "service_ipv6_cidr")
@service_ipv6_cidr.setter
def service_ipv6_cidr(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "service_ipv6_cidr", value)
@pulumi.input_type
class ClusterLoggingArgs:
def __init__(__self__, *,
cluster_logging: Optional[pulumi.Input['ClusterLoggingArgs']] = None):
"""
Enable exporting the Kubernetes control plane logs for your cluster to CloudWatch Logs based on log types. By default, cluster control plane logs aren't exported to CloudWatch Logs.
:param pulumi.Input['ClusterLoggingArgs'] cluster_logging: The cluster control plane logging configuration for your cluster.
"""
if cluster_logging is not None:
pulumi.set(__self__, "cluster_logging", cluster_logging)
@property
@pulumi.getter(name="clusterLogging")
def cluster_logging(self) -> Optional[pulumi.Input['ClusterLoggingArgs']]:
"""
The cluster control plane logging configuration for your cluster.
"""
return pulumi.get(self, "cluster_logging")
@cluster_logging.setter
def cluster_logging(self, value: Optional[pulumi.Input['ClusterLoggingArgs']]):
pulumi.set(self, "cluster_logging", value)
@pulumi.input_type
class ClusterResourcesVpcConfigArgs:
def __init__(__self__, *,
subnet_ids: pulumi.Input[Sequence[pulumi.Input[str]]],
endpoint_private_access: Optional[pulumi.Input[bool]] = None,
endpoint_public_access: Optional[pulumi.Input[bool]] = None,
public_access_cidrs: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
security_group_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
"""
An object representing the VPC configuration to use for an Amazon EKS cluster.
:param pulumi.Input[Sequence[pulumi.Input[str]]] subnet_ids: Specify subnets for your Amazon EKS nodes. Amazon EKS creates cross-account elastic network interfaces in these subnets to allow communication between your nodes and the Kubernetes control plane.
:param pulumi.Input[bool] endpoint_private_access: Set this value to true to enable private access for your cluster's Kubernetes API server endpoint. If you enable private access, Kubernetes API requests from within your cluster's VPC use the private VPC endpoint. The default value for this parameter is false, which disables private access for your Kubernetes API server. If you disable private access and you have nodes or AWS Fargate pods in the cluster, then ensure that publicAccessCidrs includes the necessary CIDR blocks for communication with the nodes or Fargate pods.
:param pulumi.Input[bool] endpoint_public_access: Set this value to false to disable public access to your cluster's Kubernetes API server endpoint. If you disable public access, your cluster's Kubernetes API server can only receive requests from within the cluster VPC. The default value for this parameter is true, which enables public access for your Kubernetes API server.
:param pulumi.Input[Sequence[pulumi.Input[str]]] public_access_cidrs: The CIDR blocks that are allowed access to your cluster's public Kubernetes API server endpoint. Communication to the endpoint from addresses outside of the CIDR blocks that you specify is denied. The default value is 0.0.0.0/0. If you've disabled private endpoint access and you have nodes or AWS Fargate pods in the cluster, then ensure that you specify the necessary CIDR blocks.
:param pulumi.Input[Sequence[pulumi.Input[str]]] security_group_ids: Specify one or more security groups for the cross-account elastic network interfaces that Amazon EKS creates to use to allow communication between your worker nodes and the Kubernetes control plane. If you don't specify a security group, the default security group for your VPC is used.
"""
pulumi.set(__self__, "subnet_ids", subnet_ids)
if endpoint_private_access is not None:
pulumi.set(__self__, "endpoint_private_access", endpoint_private_access)
if endpoint_public_access is not None:
pulumi.set(__self__, "endpoint_public_access", endpoint_public_access)
if public_access_cidrs is not None:
pulumi.set(__self__, "public_access_cidrs", public_access_cidrs)
if security_group_ids is not None:
pulumi.set(__self__, "security_group_ids", security_group_ids)
@property
@pulumi.getter(name="subnetIds")
def subnet_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
"""
Specify subnets for your Amazon EKS nodes. Amazon EKS creates cross-account elastic network interfaces in these subnets to allow communication between your nodes and the Kubernetes control plane.
"""
return pulumi.get(self, "subnet_ids")
@subnet_ids.setter
def subnet_ids(self, value: pulumi.Input[Sequence[pulumi.Input[str]]]):
pulumi.set(self, "subnet_ids", value)
@property
@pulumi.getter(name="endpointPrivateAccess")
def endpoint_private_access(self) -> Optional[pulumi.Input[bool]]:
"""
Set this value to true to enable private access for your cluster's Kubernetes API server endpoint. If you enable private access, Kubernetes API requests from within your cluster's VPC use the private VPC endpoint. The default value for this parameter is false, which disables private access for your Kubernetes API server. If you disable private access and you have nodes or AWS Fargate pods in the cluster, then ensure that publicAccessCidrs includes the necessary CIDR blocks for communication with the nodes or Fargate pods.
"""
return pulumi.get(self, "endpoint_private_access")
@endpoint_private_access.setter
def endpoint_private_access(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "endpoint_private_access", value)
@property
@pulumi.getter(name="endpointPublicAccess")
def endpoint_public_access(self) -> Optional[pulumi.Input[bool]]:
"""
Set this value to false to disable public access to your cluster's Kubernetes API server endpoint. If you disable public access, your cluster's Kubernetes API server can only receive requests from within the cluster VPC. The default value for this parameter is true, which enables public access for your Kubernetes API server.
"""
return pulumi.get(self, "endpoint_public_access")
@endpoint_public_access.setter
def endpoint_public_access(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "endpoint_public_access", value)
@property
@pulumi.getter(name="publicAccessCidrs")
def public_access_cidrs(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
The CIDR blocks that are allowed access to your cluster's public Kubernetes API server endpoint. Communication to the endpoint from addresses outside of the CIDR blocks that you specify is denied. The default value is 0.0.0.0/0. If you've disabled private endpoint access and you have nodes or AWS Fargate pods in the cluster, then ensure that you specify the necessary CIDR blocks.
"""
return pulumi.get(self, "public_access_cidrs")
@public_access_cidrs.setter
def public_access_cidrs(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "public_access_cidrs", value)
@property
@pulumi.getter(name="securityGroupIds")
def security_group_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Specify one or more security groups for the cross-account elastic network interfaces that Amazon EKS creates to use to allow communication between your worker nodes and the Kubernetes control plane. If you don't specify a security group, the default security group for your VPC is used.
"""
return pulumi.get(self, "security_group_ids")
@security_group_ids.setter
def security_group_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "security_group_ids", value)
@pulumi.input_type
class ClusterTagArgs:
def __init__(__self__, *,
key: pulumi.Input[str],
value: pulumi.Input[str]):
"""
A key-value pair to associate with a resource.
:param pulumi.Input[str] key: The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
:param pulumi.Input[str] value: The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
pulumi.set(__self__, "key", key)
pulumi.set(__self__, "value", value)
@property
@pulumi.getter
def key(self) -> pulumi.Input[str]:
"""
The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
return pulumi.get(self, "key")
@key.setter
def key(self, value: pulumi.Input[str]):
pulumi.set(self, "key", value)
@property
@pulumi.getter
def value(self) -> pulumi.Input[str]:
"""
The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
return pulumi.get(self, "value")
@value.setter
def value(self, value: pulumi.Input[str]):
pulumi.set(self, "value", value)
@pulumi.input_type
class FargateProfileLabelArgs:
def __init__(__self__, *,
key: pulumi.Input[str],
value: pulumi.Input[str]):
"""
A key-value pair to associate with a pod.
:param pulumi.Input[str] key: The key name of the label.
:param pulumi.Input[str] value: The value for the label.
"""
pulumi.set(__self__, "key", key)
pulumi.set(__self__, "value", value)
@property
@pulumi.getter
def key(self) -> pulumi.Input[str]:
"""
The key name of the label.
"""
return pulumi.get(self, "key")
@key.setter
def key(self, value: pulumi.Input[str]):
pulumi.set(self, "key", value)
@property
@pulumi.getter
def value(self) -> pulumi.Input[str]:
"""
The value for the label.
"""
return pulumi.get(self, "value")
@value.setter
def value(self, value: pulumi.Input[str]):
pulumi.set(self, "value", value)
@pulumi.input_type
class FargateProfileSelectorArgs:
def __init__(__self__, *,
namespace: pulumi.Input[str],
labels: Optional[pulumi.Input[Sequence[pulumi.Input['FargateProfileLabelArgs']]]] = None):
pulumi.set(__self__, "namespace", namespace)
if labels is not None:
pulumi.set(__self__, "labels", labels)
@property
@pulumi.getter
def namespace(self) -> pulumi.Input[str]:
return pulumi.get(self, "namespace")
@namespace.setter
def namespace(self, value: pulumi.Input[str]):
pulumi.set(self, "namespace", value)
@property
@pulumi.getter
def labels(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['FargateProfileLabelArgs']]]]:
return pulumi.get(self, "labels")
@labels.setter
def labels(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['FargateProfileLabelArgs']]]]):
pulumi.set(self, "labels", value)
@pulumi.input_type
class FargateProfileTagArgs:
def __init__(__self__, *,
key: pulumi.Input[str],
value: pulumi.Input[str]):
"""
A key-value pair to associate with a resource.
:param pulumi.Input[str] key: The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
:param pulumi.Input[str] value: The value for the tag. You can specify a value that is 1 to 255 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
pulumi.set(__self__, "key", key)
pulumi.set(__self__, "value", value)
@property
@pulumi.getter
def key(self) -> pulumi.Input[str]:
"""
The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
return pulumi.get(self, "key")
@key.setter
def key(self, value: pulumi.Input[str]):
pulumi.set(self, "key", value)
@property
@pulumi.getter
def value(self) -> pulumi.Input[str]:
"""
The value for the tag. You can specify a value that is 1 to 255 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.
"""
return pulumi.get(self, "value")
@value.setter
def value(self, value: pulumi.Input[str]):
pulumi.set(self, "value", value)
@pulumi.input_type
class NodegroupLaunchTemplateSpecificationArgs:
def __init__(__self__, *,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
version: Optional[pulumi.Input[str]] = None):
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if version is not None:
pulumi.set(__self__, "version", version)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def version(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "version")
@version.setter
def version(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "version", value)
@pulumi.input_type
class NodegroupRemoteAccessArgs:
def __init__(__self__, *,
ec2_ssh_key: pulumi.Input[str],
source_security_groups: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
pulumi.set(__self__, "ec2_ssh_key", ec2_ssh_key)
if source_security_groups is not None:
pulumi.set(__self__, "source_security_groups", source_security_groups)
@property
@pulumi.getter(name="ec2SshKey")
def ec2_ssh_key(self) -> pulumi.Input[str]:
return pulumi.get(self, "ec2_ssh_key")
@ec2_ssh_key.setter
def ec2_ssh_key(self, value: pulumi.Input[str]):
pulumi.set(self, "ec2_ssh_key", value)
@property
@pulumi.getter(name="sourceSecurityGroups")
def source_security_groups(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "source_security_groups")
@source_security_groups.setter
def source_security_groups(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "source_security_groups", value)
@pulumi.input_type
class NodegroupScalingConfigArgs:
def __init__(__self__, *,
desired_size: Optional[pulumi.Input[float]] = None,
max_size: Optional[pulumi.Input[float]] = None,
min_size: Optional[pulumi.Input[float]] = None):
if desired_size is not None:
pulumi.set(__self__, "desired_size", desired_size)
if max_size is not None:
pulumi.set(__self__, "max_size", max_size)
if min_size is not None:
pulumi.set(__self__, "min_size", min_size)
@property
@pulumi.getter(name="desiredSize")
def desired_size(self) -> Optional[pulumi.Input[float]]:
return pulumi.get(self, "desired_size")
@desired_size.setter
def desired_size(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "desired_size", value)
@property
@pulumi.getter(name="maxSize")
def max_size(self) -> Optional[pulumi.Input[float]]:
return pulumi.get(self, "max_size")
@max_size.setter
def max_size(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "max_size", value)
@property
@pulumi.getter(name="minSize")
def min_size(self) -> Optional[pulumi.Input[float]]:
return pulumi.get(self, "min_size")
@min_size.setter
def min_size(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "min_size", value)
@pulumi.input_type
class NodegroupTaintArgs:
def __init__(__self__, *,
effect: Optional[pulumi.Input[str]] = None,
key: Optional[pulumi.Input[str]] = None,
value: Optional[pulumi.Input[str]] = None):
if effect is not None:
pulumi.set(__self__, "effect", effect)
if key is not None:
pulumi.set(__self__, "key", key)
if value is not None:
pulumi.set(__self__, "value", value)
@property
@pulumi.getter
def effect(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "effect")
@effect.setter
def effect(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "effect", value)
@property
@pulumi.getter
def key(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "key")
@key.setter
def key(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "key", value)
@property
@pulumi.getter
def value(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "value")
@value.setter
def value(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "value", value)
@pulumi.input_type
class NodegroupUpdateConfigArgs:
def __init__(__self__, *,
max_unavailable: Optional[pulumi.Input[float]] = None,
max_unavailable_percentage: Optional[pulumi.Input[float]] = None):
if max_unavailable is not None:
pulumi.set(__self__, "max_unavailable", max_unavailable)
if max_unavailable_percentage is not None:
pulumi.set(__self__, "max_unavailable_percentage", max_unavailable_percentage)
@property
@pulumi.getter(name="maxUnavailable")
def max_unavailable(self) -> Optional[pulumi.Input[float]]:
return pulumi.get(self, "max_unavailable")
@max_unavailable.setter
def max_unavailable(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "max_unavailable", value)
@property
@pulumi.getter(name="maxUnavailablePercentage")
def max_unavailable_percentage(self) -> Optional[pulumi.Input[float]]:
return pulumi.get(self, "max_unavailable_percentage")
@max_unavailable_percentage.setter
def max_unavailable_percentage(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "max_unavailable_percentage", value)
| 45.661836 | 586 | 0.678481 | 3,641 | 28,356 | 5.135677 | 0.073057 | 0.095299 | 0.065137 | 0.035563 | 0.789614 | 0.700412 | 0.64827 | 0.587678 | 0.545216 | 0.502808 | 0 | 0.006334 | 0.220553 | 28,356 | 620 | 587 | 45.735484 | 0.839698 | 0.348568 | 0 | 0.361179 | 1 | 0 | 0.115533 | 0.054592 | 0 | 0 | 0 | 0 | 0 | 1 | 0.208845 | false | 0 | 0.014742 | 0.036855 | 0.346437 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 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 | 0 | 0 | 0 | 3 |
70257036b3b2cfab8988c675cf019d292c546a3e | 110 | py | Python | application/utils/utils.py | campos537/deep-fashion-system | 1de31dd6260cc967e1832cff63ae7e537a3a4e9d | [
"Unlicense"
] | 1 | 2021-04-06T00:43:26.000Z | 2021-04-06T00:43:26.000Z | application/utils/utils.py | campos537/deep-fashion-system | 1de31dd6260cc967e1832cff63ae7e537a3a4e9d | [
"Unlicense"
] | null | null | null | application/utils/utils.py | campos537/deep-fashion-system | 1de31dd6260cc967e1832cff63ae7e537a3a4e9d | [
"Unlicense"
] | null | null | null | import base64
def get_result(result):
stream = base64.decodebytes(result)
return stream.decode()
| 18.333333 | 39 | 0.709091 | 13 | 110 | 5.923077 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0.2 | 110 | 6 | 40 | 18.333333 | 0.829545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
705470c5d6de5aaf51115a99bde2ca4ec64eb827 | 341 | py | Python | screenshooter/listener.py | engelmi/screenshooter | 9a1433d5306b506e6661212b650f8f5430bb8614 | [
"MIT"
] | 1 | 2020-08-01T13:35:16.000Z | 2020-08-01T13:35:16.000Z | screenshooter/listener.py | engelmi/screenshooter | 9a1433d5306b506e6661212b650f8f5430bb8614 | [
"MIT"
] | 1 | 2019-07-25T08:42:06.000Z | 2019-07-25T08:42:06.000Z | screenshooter/listener.py | engelmi/screenshooter | 9a1433d5306b506e6661212b650f8f5430bb8614 | [
"MIT"
] | null | null | null |
class ScreenGrabListener(object):
"""
Basic listener class to process a grabbed image via the screenshooter.
"""
def process(self, grabbed_image):
"""
Abstract method. Processes a grabbed image.
:param grabbed_image: The grabbed image as PIL.Image.
"""
raise NotImplementedError("")
| 26.230769 | 74 | 0.639296 | 36 | 341 | 6 | 0.638889 | 0.277778 | 0.12037 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | 341 | 12 | 75 | 28.416667 | 0.870968 | 0.492669 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7084359911956e6eb8fcc82cb7baa296e5280584 | 186 | py | Python | main/Models/Circle/Simulation/Circle.py | JulianoGianlupi/nh-cc3d-4x-base-tool | c0f4aceebd4c5bf3ec39e831ef851e419b161259 | [
"CC0-1.0"
] | null | null | null | main/Models/Circle/Simulation/Circle.py | JulianoGianlupi/nh-cc3d-4x-base-tool | c0f4aceebd4c5bf3ec39e831ef851e419b161259 | [
"CC0-1.0"
] | null | null | null | main/Models/Circle/Simulation/Circle.py | JulianoGianlupi/nh-cc3d-4x-base-tool | c0f4aceebd4c5bf3ec39e831ef851e419b161259 | [
"CC0-1.0"
] | 1 | 2021-02-26T21:50:29.000Z | 2021-02-26T21:50:29.000Z |
from cc3d import CompuCellSetup
from CircleSteppables import CircleSteppable
CompuCellSetup.register_steppable(steppable=CircleSteppable(frequency=1))
CompuCellSetup.run()
| 16.909091 | 73 | 0.817204 | 17 | 186 | 8.882353 | 0.647059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012346 | 0.129032 | 186 | 10 | 74 | 18.6 | 0.919753 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
7084a93fe5b577c679276f294fe5764e40d39b1b | 390 | py | Python | src/dispatch/plugins/dispatch_test/participant_group.py | roor0/dispatch | 12c4f567096411abe62abaf61c7c124496764346 | [
"Apache-2.0"
] | 3,417 | 2020-02-23T22:54:47.000Z | 2022-03-31T13:01:01.000Z | src/dispatch/plugins/dispatch_test/participant_group.py | roor0/dispatch | 12c4f567096411abe62abaf61c7c124496764346 | [
"Apache-2.0"
] | 607 | 2020-02-24T14:27:02.000Z | 2022-03-30T19:15:39.000Z | src/dispatch/plugins/dispatch_test/participant_group.py | roor0/dispatch | 12c4f567096411abe62abaf61c7c124496764346 | [
"Apache-2.0"
] | 359 | 2020-02-24T19:04:43.000Z | 2022-03-29T06:48:12.000Z | from dispatch.plugins.bases import ParticipantGroupPlugin
class TestParticipantGroupPlugin(ParticipantGroupPlugin):
title = "Dispatch Test Plugin - Participant Group"
slug = "test-participant-group"
def create(self, participants, **kwargs):
return
def add(self, participant, **kwargs):
return
def remove(self, participant, **kwargs):
return
| 24.375 | 57 | 0.702564 | 37 | 390 | 7.405405 | 0.594595 | 0.131387 | 0.109489 | 0.19708 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207692 | 390 | 15 | 58 | 26 | 0.886731 | 0 | 0 | 0.3 | 0 | 0 | 0.158974 | 0.05641 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.1 | 0.3 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
709771a132f3b39704dc8a78fa50fd197c2b9aca | 144 | py | Python | tests/fixtures/regressors/__init__.py | XavierJingfeng/starter | 274566e491d5c7157f3c8deff136c56838022349 | [
"MIT"
] | null | null | null | tests/fixtures/regressors/__init__.py | XavierJingfeng/starter | 274566e491d5c7157f3c8deff136c56838022349 | [
"MIT"
] | null | null | null | tests/fixtures/regressors/__init__.py | XavierJingfeng/starter | 274566e491d5c7157f3c8deff136c56838022349 | [
"MIT"
] | null | null | null | from tests.fixtures.regressors.simple_gaussian_mlp_regressor import (
SimpleGaussianMLPRegressor)
__all__ = ['SimpleGaussianMLPRegressor']
| 28.8 | 69 | 0.840278 | 12 | 144 | 9.5 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090278 | 144 | 4 | 70 | 36 | 0.870229 | 0 | 0 | 0 | 0 | 0 | 0.180556 | 0.180556 | 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 |
56061be80b560aeb56981297f4a7efbad2518c39 | 131 | py | Python | question_repo/apps/repo/signal/signals.py | Quizas007/question_repo | e377257137077b17ed039b06d3d6990d56d63743 | [
"Apache-2.0"
] | null | null | null | question_repo/apps/repo/signal/signals.py | Quizas007/question_repo | e377257137077b17ed039b06d3d6990d56d63743 | [
"Apache-2.0"
] | null | null | null | question_repo/apps/repo/signal/signals.py | Quizas007/question_repo | e377257137077b17ed039b06d3d6990d56d63743 | [
"Apache-2.0"
] | null | null | null | """
自定义信号
"""
import django.dispatch
mysignal = django.dispatch.Signal(providing_args=["arg1","arg2"])
# 内置的信号会自动触发,自定义信号不可以。
| 10.916667 | 65 | 0.709924 | 14 | 131 | 6.571429 | 0.857143 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017241 | 0.114504 | 131 | 11 | 66 | 11.909091 | 0.775862 | 0.206107 | 0 | 0 | 0 | 0 | 0.086022 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
56330ea2eae7358118452b9d5a4b8adbc3462322 | 68 | py | Python | app/src/main/python/youtube_dl/version.py | lprc/simple-dl | 7321a4f62c7188998c0bf5b681e90eddb98eb9aa | [
"MIT"
] | null | null | null | app/src/main/python/youtube_dl/version.py | lprc/simple-dl | 7321a4f62c7188998c0bf5b681e90eddb98eb9aa | [
"MIT"
] | null | null | null | app/src/main/python/youtube_dl/version.py | lprc/simple-dl | 7321a4f62c7188998c0bf5b681e90eddb98eb9aa | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
__version__ = '2020.03.06'
| 17 | 39 | 0.808824 | 9 | 68 | 5.111111 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 0.117647 | 68 | 3 | 40 | 22.666667 | 0.633333 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
568d2084adf71a287fd23fe49c7602c597d70fdf | 85 | py | Python | src/tcp/server/src/sizeof.py | gltchitm/pong-c-cheats | 64bdb50519db0ebdc68ae19c3ce738e658fb71d3 | [
"MIT"
] | null | null | null | src/tcp/server/src/sizeof.py | gltchitm/pong-c-cheats | 64bdb50519db0ebdc68ae19c3ce738e658fb71d3 | [
"MIT"
] | null | null | null | src/tcp/server/src/sizeof.py | gltchitm/pong-c-cheats | 64bdb50519db0ebdc68ae19c3ce738e658fb71d3 | [
"MIT"
] | null | null | null | SIZEOF_BYTE = 8
SIZEOF_INT_16 = 16 // SIZEOF_BYTE
SIZEOF_INT_32 = 32 // SIZEOF_BYTE
| 17 | 33 | 0.752941 | 15 | 85 | 3.8 | 0.4 | 0.526316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126761 | 0.164706 | 85 | 4 | 34 | 21.25 | 0.676056 | 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 |
56a6e49ba851394662aa10e00d7024d9b014ea05 | 489 | py | Python | default_arg.py | Baibhabswain/pythonPrograms | 38380174f22e73b766b98754b00cd78a56b4bf59 | [
"MIT"
] | 1 | 2019-03-29T04:32:09.000Z | 2019-03-29T04:32:09.000Z | default_arg.py | Baibhabswain/pythonPrograms | 38380174f22e73b766b98754b00cd78a56b4bf59 | [
"MIT"
] | null | null | null | default_arg.py | Baibhabswain/pythonPrograms | 38380174f22e73b766b98754b00cd78a56b4bf59 | [
"MIT"
] | null | null | null | def add(x=input("Please enter the first number"),y=input("Please enter the second number"),z=input("Please enter the third number")):
print x,'+',y,'+',z
return x+y+z
def main():
print"main starts..."
x=10
y=20
z=30
print "x is base"
print add(x,y,z)
print add(x,y)
print add(x)
print "y is base"
print add(x,y,z)
print add(y,z)
print add(y)
print "z is base"
print add(x,y,z)
print add(x,z)
print add(z)
print"entered values"
print add()
main()
| 21.26087 | 134 | 0.621677 | 96 | 489 | 3.166667 | 0.25 | 0.263158 | 0.177632 | 0.131579 | 0.289474 | 0.253289 | 0.253289 | 0.253289 | 0.253289 | 0.171053 | 0 | 0.015544 | 0.210634 | 489 | 23 | 135 | 21.26087 | 0.772021 | 0 | 0 | 0.130435 | 0 | 0 | 0.310493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.695652 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
3b1ce50f7d1f70a241cbdefb23a5cd91698686da | 206 | py | Python | Mundo1/ex021-import.playsound.py | YuriBraga/Python_Course | 1f72ec02e9fa911ddbf28830542374a419d15a6c | [
"MIT"
] | null | null | null | Mundo1/ex021-import.playsound.py | YuriBraga/Python_Course | 1f72ec02e9fa911ddbf28830542374a419d15a6c | [
"MIT"
] | null | null | null | Mundo1/ex021-import.playsound.py | YuriBraga/Python_Course | 1f72ec02e9fa911ddbf28830542374a419d15a6c | [
"MIT"
] | null | null | null | '''from pygame import mixer
mixer.init()
mixer.music.load('ex021.mp3')
mixer.music.play()
input('Agora dá para escutar')'''
# Pode ser feito assim também:
import playsound
playsound.playsound('ex021.mp3')
| 20.6 | 33 | 0.742718 | 30 | 206 | 5.1 | 0.7 | 0.130719 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043243 | 0.101942 | 206 | 9 | 34 | 22.888889 | 0.783784 | 0.713592 | 0 | 0 | 0 | 0 | 0.169811 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3b342af0c0a09204758f2297725b146938b7b68d | 1,236 | py | Python | example/client/sampleclient.py | Pizaid/pizaid-controller | b4945d06efe3f12b90f9c917a53a95753ef3c477 | [
"MIT"
] | null | null | null | example/client/sampleclient.py | Pizaid/pizaid-controller | b4945d06efe3f12b90f9c917a53a95753ef3c477 | [
"MIT"
] | 1 | 2020-04-16T08:12:00.000Z | 2020-04-16T08:12:00.000Z | example/client/sampleclient.py | Pizaid/pizaid-controller | b4945d06efe3f12b90f9c917a53a95753ef3c477 | [
"MIT"
] | 1 | 2020-04-14T09:48:07.000Z | 2020-04-14T09:48:07.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
#
# Author: Makoto Shimazu <makoto.shimaz@gmail.com>
# URL: https://github.com/Pizaid
# License: 2-Clause BSD License
# Created: 2014-08-09
#
import sys
sys.path.append('gen-py')
from Pizaid import ControllerService
from Pizaid.ttypes import *
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
try:
transport = TSocket.TSocket('localhost', 9090)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = ControllerService.Client(protocol)
transport.open()
# print client.network_ipv4()
# print client.storage_storage_group_list()
# print client.storage_join("main", "/dev/sda")
# print client.storage_capacity_kb("main")
# print client.storage_usage_kb("main")
# print client.storage_usage_percent("main")
print client.storage_disk_list("unused")
print client.storage_disk_id("/dev/sda")
print client.storage_disk_port("/dev/sda")
print client.storage_disk_size("/dev/sda")
except Thrift.TException, tx:
print '%s' % (tx.message)
| 29.428571 | 57 | 0.733819 | 157 | 1,236 | 5.656051 | 0.464968 | 0.123874 | 0.182432 | 0.099099 | 0.155405 | 0.128378 | 0 | 0 | 0 | 0 | 0 | 0.015137 | 0.144822 | 1,236 | 41 | 58 | 30.146341 | 0.824976 | 0.377832 | 0 | 0 | 0 | 0 | 0.062334 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.35 | null | null | 0.25 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3b4ade8bc607cded2275ae6b39e470674d788698 | 481 | py | Python | chat/routing.py | yccye/CT_AI_web | 267553d3aaaef78f7dbdd652c0f1868ec60862c2 | [
"MulanPSL-1.0"
] | 5 | 2021-05-25T07:53:36.000Z | 2021-11-23T13:04:51.000Z | chat/routing.py | yccye/CT_AI_web | 267553d3aaaef78f7dbdd652c0f1868ec60862c2 | [
"MulanPSL-1.0"
] | 1 | 2021-11-07T14:41:52.000Z | 2021-11-07T15:34:28.000Z | chat/routing.py | yccye/CT_AI_web | 267553d3aaaef78f7dbdd652c0f1868ec60862c2 | [
"MulanPSL-1.0"
] | 2 | 2021-11-07T13:29:13.000Z | 2022-03-10T12:13:04.000Z | """配置通往consumer的路由,即配置websocket路由"""
from django.conf.urls import url
from django.urls import path
from . import consumers
websocket_urlpatterns = [
# url(r'^ws/chat/(?P<room_name>[^/]+)/$', consumers.ChatConsumer),
path('ws/chat/<room_name>/', consumers.ChatConsumer),
path('wss/chat/<room_name>/', consumers.ChatConsumer),
path('ws/group_chat/<room_name>/', consumers.GroupChatConsumer),
path('wss/group_chat/<room_name>/', consumers.GroupChatConsumer),
]
| 32.066667 | 70 | 0.717256 | 57 | 481 | 5.912281 | 0.385965 | 0.118694 | 0.252226 | 0.249258 | 0.58457 | 0.58457 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106029 | 481 | 14 | 71 | 34.357143 | 0.783721 | 0.199584 | 0 | 0 | 0 | 0 | 0.248021 | 0.195251 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3b59fa3ba836f14bb8c826edd251c3f03ed8f395 | 120 | py | Python | 2019_skoltech_ISP/01_beginning/sec03/code/s3/code.py | Lavton/latexLectures | f8491351b2f74884689db24bbce2aa2270fa556a | [
"MIT"
] | 5 | 2019-01-11T08:19:44.000Z | 2020-11-24T11:30:48.000Z | 2019_skoltech_ISP/01_beginning/sec03/code/s3/code.py | Lavton/latexLectures | f8491351b2f74884689db24bbce2aa2270fa556a | [
"MIT"
] | null | null | null | 2019_skoltech_ISP/01_beginning/sec03/code/s3/code.py | Lavton/latexLectures | f8491351b2f74884689db24bbce2aa2270fa556a | [
"MIT"
] | 1 | 2019-01-20T17:52:16.000Z | 2019-01-20T17:52:16.000Z | import time
def f(x):
pass
if __name__ == "__main__":
# execute only if
# run as a script
f("oo") | 13.333333 | 26 | 0.541667 | 18 | 120 | 3.166667 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.341667 | 120 | 9 | 27 | 13.333333 | 0.721519 | 0.266667 | 0 | 0 | 0 | 0 | 0.116279 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.2 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3b6b8fe5725c66cf7e2178e79e839a7f75612950 | 453 | py | Python | handlers/file_handler.py | jstriebel/ai-car | 9e4a3b10053effa0660077d97f1ad119dcfb0174 | [
"MIT"
] | 1 | 2017-08-14T16:22:15.000Z | 2017-08-14T16:22:15.000Z | handlers/file_handler.py | jstriebel/ai-car | 9e4a3b10053effa0660077d97f1ad119dcfb0174 | [
"MIT"
] | 1 | 2017-08-12T16:44:46.000Z | 2017-08-13T15:54:00.000Z | handlers/file_handler.py | jstriebel/ai-car | 9e4a3b10053effa0660077d97f1ad119dcfb0174 | [
"MIT"
] | 3 | 2017-10-07T14:56:30.000Z | 2021-04-09T15:47:01.000Z | from aiohttp import web, WSMsgType
import asyncio
from handlers.handler import Handler
class FileHandler(Handler):
def __init__(self, file):
self.file = file
@asyncio.coroutine
def handle(self, request):
with open(self.file, "rt") as file:
return web.Response(text=file.read(), content_type="text/html")
def __enter__(self):
pass
def __exit__(self, exit_type, value, traceback):
pass
| 22.65 | 75 | 0.660044 | 57 | 453 | 5 | 0.578947 | 0.084211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.240618 | 453 | 19 | 76 | 23.842105 | 0.828488 | 0 | 0 | 0.142857 | 0 | 0 | 0.024283 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.142857 | 0.214286 | 0 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
3b748dc3c04a8889510b5571b932a02c2a3fcf64 | 334 | py | Python | OpenGLES/GLES/gles1.py | pome-ta/pystaGLES | f52b51dd1364f87b22a12d7527482b76e7fab0bb | [
"MIT"
] | null | null | null | OpenGLES/GLES/gles1.py | pome-ta/pystaGLES | f52b51dd1364f87b22a12d7527482b76e7fab0bb | [
"MIT"
] | null | null | null | OpenGLES/GLES/gles1.py | pome-ta/pystaGLES | f52b51dd1364f87b22a12d7527482b76e7fab0bb | [
"MIT"
] | null | null | null | # coding: utf-8
import ctypes
# from objc_util import *
#import headers.gl_c
#import headers.glext_c
from OpenGLES.GLES.headers.gl_c import *
from OpenGLES.GLES.headers.glext_c import *
#reload(headers.gl_c)
# reload(headers.glext_c)
# ObjCClass("NSBundle").bundleWithPath_("/System/Library/Frameworks/OpenGLES.framework").load()
| 22.266667 | 95 | 0.778443 | 48 | 334 | 5.25 | 0.479167 | 0.107143 | 0.119048 | 0.126984 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0033 | 0.092814 | 334 | 14 | 96 | 23.857143 | 0.828383 | 0.646707 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
3b8212d16b84b98df542810b9eaf9101f2375755 | 7,084 | py | Python | pymeet/COM.py | Melisius/PyMEET | 9de470e55b0228b7c4ffed5f0c54bd27d6eba841 | [
"MIT"
] | null | null | null | pymeet/COM.py | Melisius/PyMEET | 9de470e55b0228b7c4ffed5f0c54bd27d6eba841 | [
"MIT"
] | null | null | null | pymeet/COM.py | Melisius/PyMEET | 9de470e55b0228b7c4ffed5f0c54bd27d6eba841 | [
"MIT"
] | null | null | null | import numpy as np
def atom_to_numbers(atom_name, number_property):
"""
Function that contains useful conversions.
"""
name2number = {"H": 1, "He": 2, "Li": 3, "Be": 4, "B": 5, "C": 6, "N": 7, "O": 8, "F": 9, "Ne": 10, "Na": 11, "Mg": 12, "Al": 13, "Si": 14, "P": 15, "S": 16,
"Cl": 17, "Ar": 18, "K": 19, "Ca": 20, "Sc": 21, "Ti": 22, "V": 23, "Cr": 24, "Mn": 25, "Fe": 26, "Co": 27, "Ni": 28, "Cu": 29, "Zn": 30, "Ga": 31,
"Ge": 32, "As": 33, "Se": 34, "Br": 35, "Kr": 36, "Rb": 37, "Sr": 38, "Y": 39, "Zr": 40, "Nb": 41, "Mo": 42, "Tc": 43, "Ru": 44, "Rh": 45, "Pd": 46,
"Ag": 47, "Cd": 48, "In": 49, "Sn": 50, "Sb": 51, "Te": 52, "I": 53, "Xe": 54, "Cs": 55, "Ba": 56, "La": 57, "Ce": 58, "Pr": 59, "Nd": 60, "Pm": 61,
"Sm": 62, "Eu": 63, "Gd": 64, "Tb": 65, "Dy": 66, "Ho": 67, "Er": 68, "Tm": 69, "Yb": 70, "Lu": 71, "Hf": 72, "Ta": 73, "W": 74, "Re": 75, "Os": 76,
"Ir": 77, "Pt": 78, "Au": 79, "Hg": 80, "Tl": 81, "Pb": 82, "Bi": 83, "Po": 84, "At": 85, "Rn": 86, "Fr": 87, "Ra": 88, "Ac": 89, "Th": 90, "Pa": 91,
"U": 92, "Np": 93, "Pu": 94, "Am": 95, "Cm": 96, "Bk": 97, "Cf": 98, "Es": 99, "Fm": 100, "Md": 101, "No": 102, "Lr": 103, "Rf": 104, "Db": 105, "Sg":
106, "Bh": 107, "Hs": 108, "Mt": 109, "Ds": 110, "Rg": 111, "Cn": 112, "Nh": 113, "Fl": 114, "Mc": 115, "Lv": 116, "Ts": 117, "Og": 118}
number2name = {1: "H", 2: "He", 3: "Li", 4: "Be", 5: "B", 6: "C", 7: "N", 8: "O", 9: "F", 10: "Ne", 11: "Na", 12: "Mg", 13: "Al", 14: "Si", 15: "P", 16: "S",
17: "Cl", 18: "Ar", 19: "K", 20: "Ca", 21: "Sc", 22: "Ti", 23: "V", 24: "Cr", 25: "Mn", 26: "Fe", 27: "Co", 28: "Ni", 29: "Cu", 30: "Zn", 31: "Ga", 32:
"Ge", 33: "As", 34: "Se", 35: "Br", 36: "Kr", 37: "Rb", 38: "Sr", 39: "Y", 40: "Zr", 41: "Nb", 42: "Mo", 43: "Tc", 44: "Ru", 45: "Rh", 46: "Pd", 47:
"Ag", 48: "Cd", 49: "In", 50: "Sn", 51: "Sb", 52: "Te", 53: "I", 54: "Xe", 55: "Cs", 56: "Ba", 57: "La", 58: "Ce", 59: "Pr", 60: "Nd", 61: "Pm", 62:
"Sm", 63: "Eu", 64: "Gd", 65: "Tb", 66: "Dy", 67: "Ho", 68: "Er", 69: "Tm", 70: "Yb", 71: "Lu", 72: "Hf", 73: "Ta", 74: "W", 75: "Re", 76: "Os", 77:
"Ir", 78: "Pt", 79: "Au", 80: "Hg", 81: "Tl", 82: "Pb", 83: "Bi", 84: "Po", 85: "At", 86: "Rn", 87: "Fr", 88: "Ra", 89: "Ac", 90: "Th", 91: "Pa", 92:
"U", 93: "Np", 94: "Pu", 95: "Am", 96: "Cm", 97: "Bk", 98: "Cf", 99: "Es", 100: "Fm", 101: "Md", 102: "No", 103: "Lr", 104: "Rf", 105: "Db", 106: "Sg",
107: "Bh", 108: "Hs", 109: "Mt", 110: "Ds", 111: "Rg", 112: "Cn", 113: "Nh", 114: "Fl", 115: "Mc", 116: "Lv", 117: "Ts", 118: "Og"}
vdw_radii = {1: 2.26767118629, 2: 2.64561638401, 3: 3.43930129921, 4: 2.89128076253, 5: 3.62827389807, 6: 3.21253418058, 7: 2.9290752823, 8: 2.87238350264, 9:
2.77789720321, 10: 2.91017802241, 11: 4.28967799407, 12: 3.26922596024, 13: 3.47709581899, 14: 3.96842457602, 15: 3.40150677944, 16: 3.40150677944, 17:
3.30702048001, 18: 3.55268485853, 19: 5.19674646859, 20: 4.36526703362, 21: 3.9873218359, 22: False, 23: False, 24: False, 25: False, 26: False, 27: False, 28:
3.08025336138, 29: 2.64561638401, 30: 2.62671912412, 31: 3.53378759864, 32: 3.9873218359, 33: 3.49599307887, 34: 3.5904793783, 35: 3.49599307887, 36:
3.81724649693, 37: 5.72586974539, 38: 4.70541771156, 39: False, 40: False, 41: False, 42: False, 43: False, 44: False, 45: False, 46: 3.08025336138, 47:
3.25032870036, 48: 2.98576706195, 49: 3.64717115796, 50: 4.10070539522, 51: 3.89283553647, 52: 3.89283553647, 53: 3.74165745739, 54: 4.08180813533, 55:
6.48176014083, 56: 5.06446564939, 57: False, 58: False, 59: False, 60: False, 61: False, 62: False, 63: False, 64: False, 65: False, 66: False, 67: False, 68: False, 69: False,
70: False, 71: False, 72: False, 73: False, 74: False, 75: False, 76: False, 77: False, 78: 3.30702048001, 79: 3.13694514104, 80: 2.9290752823, 81: 3.70386293761, 82:
3.81724649693, 83: 3.91173279636, 84: 3.7227601975, 85: 3.81724649693, 86: 4.15739717487, 87: 6.57624644025, 88: 5.34792454768, 89: False, 90: False, 91:
False, 92: 3.51489033876, 93: False, 94: False, 95: False, 96: False, 97: False, 98: False, 99: False, 100: False, 101: False, 102: False, 103: False, 104: False, 105: False, 106:
False, 107: False, 108: False, 109: False, 110: False, 111: False, 112: False, 113: False, 114: False, 115: False, 116: False, 117: False, 118: False}
mass = {"H": 1.008, "Na": 22.989, "Sc": 44.955, "Ga": 69.723, "Nb": 92.906, "Sb": 121.76, "Pm": False, "Lu": 174.9668, "Tl": 204.38, "Pa": 231.035, "Md": False, "Rg": False,
"He": 4.002, "Mg": 24.305, "Ti": 47.867, "Ge": 72.63, "Mo": 95.95, "Te": 127.6, "Sm": 150.36, "Hf": 178.49, "Pb": 207.2, "U": 238.028, "No": False, "Cn": False,
"Li": 6.94, "Al": 26.981, "V": 50.9415, "As": 74.921, "Tc": False, "I": 126.904, "Eu": 151.964, "Ta": 180.947, "Bi": 208.98, "Np": False, "Lr": False, "Nh": False,
"Be": 9.012, "Si": 28.085, "Cr": 51.9961, "Se": 78.971, "Ru": 101.07, "Xe": 131.293, "Gd": 157.25, "W": 183.84, "Po": False, "Pu": False, "Rf": False, "Fl": False,
"B": 10.81, "P": 30.973, "Mn": 54.938, "Br": 79.904, "Rh": 102.905, "Cs": 132.905, "Tb": 158.925, "Re": 186.207, "At": False, "Am": False, "Db": False, "Mc": False,
"C": 12.011, "S": 32.06, "Fe": 55.845, "Kr": 83.798, "Pd": 106.42, "Ba": 137.327, "Dy": 162.5, "Os": 190.23, "Rn": False, "Cm": False, "Sg": False, "Lv": False,
"N": 14.007, "Cl": 35.45, "Co": 58.933, "Rb": 85.4678, "Ag": 107.8682, "La": 138.905, "Ho": 164.93, "Ir": 192.217, "Fr": False, "Bk": False, "Bh": False, "Ts": False,
"O": 15.999, "Ar": 39.948, "Ni": 58.6934, "Sr": 87.62, "Cd": 112.414, "Ce": 140.116, "Er": 167.259, "Pt": 195.084, "Ra": False, "Cf": False, "Hs": False, "Og": False,
"F": 18.998, "K": 39.0983, "Cu": 63.546, "Y": 88.905, "In": 114.818, "Pr": 140.907, "Tm": 168.934, "Au": 196.966, "Ac": False, "Es": False, "Mt": False,
"Ne": 20.1797, "Ca": 40.078, "Zn": 65.38, "Zr": 91.224, "Sn": 118.71, "Nd": 144.242, "Yb": 173.045, "Hg": 200.592, "Th": 232.0377, "Fm": False, "Ds": False}
if number_property.lower() == "charge":
return name2number[atom_name]
elif number_property.lower() == "mass":
return mass[atom_name]
elif number_property.lower() == "vdw_radii":
return vdw_radii[name2number[atom_name]]
def calc_center_of_mass(elements, xyz):
"""
Calculates the center of elements.
Input : elements, vector(n)
: xyz, x,y,z coordinate matrix(n, 3)
"""
mass = np.zeros(len(elements))
for i in range(len(elements)):
mass[i] = atom_to_numbers(elements[i], "mass")
Xcm = np.sum(mass*xyz[:,0])/np.sum(mass)
Ycm = np.sum(mass*xyz[:,1])/np.sum(mass)
Zcm = np.sum(mass*xyz[:,2])/np.sum(mass)
return np.array([Xcm, Ycm, Zcm]) | 101.2 | 191 | 0.502823 | 1,211 | 7,084 | 2.926507 | 0.346821 | 0.008465 | 0.015237 | 0.010158 | 0.017494 | 0.017494 | 0 | 0 | 0 | 0 | 0 | 0.335154 | 0.224591 | 7,084 | 70 | 192 | 101.2 | 0.310031 | 0.021033 | 0 | 0 | 0 | 0 | 0.099956 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.037736 | false | 0 | 0.018868 | 0 | 0.132075 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8e56ed966f7b3a1a052979308f0135e0e02265d6 | 114 | py | Python | web/wsgi_dozer.py | LinuxOSsk/Shakal-NG | c4091c7972cffd86f64aa9f9a058d2907a56e5eb | [
"MIT"
] | 10 | 2016-02-06T15:40:30.000Z | 2018-09-27T15:15:13.000Z | web/wsgi_dozer.py | LinuxOSsk/Shakal-NG | c4091c7972cffd86f64aa9f9a058d2907a56e5eb | [
"MIT"
] | 94 | 2016-02-04T18:39:36.000Z | 2022-01-20T05:25:00.000Z | web/wsgi_dozer.py | LinuxOSsk/Shakal-NG | c4091c7972cffd86f64aa9f9a058d2907a56e5eb | [
"MIT"
] | 8 | 2016-05-10T20:29:53.000Z | 2021-02-07T00:50:31.000Z | # -*- coding: utf-8 -*-
from dozer import Dozer
from .wsgi import application
application = Dozer(application)
| 14.25 | 32 | 0.719298 | 14 | 114 | 5.857143 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010526 | 0.166667 | 114 | 7 | 33 | 16.285714 | 0.852632 | 0.184211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8e73639fd89c53082140ccfdb67b914c88ac5358 | 831 | py | Python | t1.py | eferro/pydatastructsalgorithms | 20b84afaa85ee1bba59fcc2bcbe6a2dd058da7bf | [
"MIT"
] | null | null | null | t1.py | eferro/pydatastructsalgorithms | 20b84afaa85ee1bba59fcc2bcbe6a2dd058da7bf | [
"MIT"
] | null | null | null | t1.py | eferro/pydatastructsalgorithms | 20b84afaa85ee1bba59fcc2bcbe6a2dd058da7bf | [
"MIT"
] | null | null | null | from pydatastructsalgorithms import tree_list as tree
# r = tree.binary_tree(3)
# tree.insert_left(r, 4)
# tree.insert_left(r, 5)
# tree.insert_right(r, 6)
# tree.insert_right(r, 7)
# l = tree.get_left_child(r)
# tree.set_root_val(l, 9)
# tree.insert_left(l, 11)
# print(tree.get_right_child(tree.get_right_child(r)))
# x = tree.binary_tree('a')
# tree.insert_left(x, 'b')
# tree.insert_right(x, 'c')
# print x
# tree.insert_right(tree.get_right_child(x), 'd')
# print x
# tree.insert_left(tree.get_right_child(tree.get_right_child(x)), 'e')
# print x
def build_tree():
r = tree.binary_tree('a')
tree.insert_left(r, 'b')
tree.insert_right(r, 'c')
tree.insert_right(tree.get_left_child(r), 'd')
tree.insert_left(tree.get_right_child(r), 'e')
tree.insert_right(tree.get_right_child(r), 'f')
return r
print build_tree() | 23.742857 | 70 | 0.713598 | 152 | 831 | 3.638158 | 0.230263 | 0.253165 | 0.177215 | 0.21519 | 0.566004 | 0.424955 | 0.424955 | 0.122966 | 0 | 0 | 0 | 0.010825 | 0.11071 | 831 | 35 | 71 | 23.742857 | 0.737483 | 0.55716 | 0 | 0 | 0 | 0 | 0.017094 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.1 | null | null | 0.1 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8e8e40f2f08d10e053b3679ecaea9d2e6c4d91a1 | 183 | py | Python | djangoreactAnimalRescue/animalresque/animals/urls.py | LegolasVzla/django | bbecd7175fb4833731041f88c0ba3327f8a898f0 | [
"MIT"
] | null | null | null | djangoreactAnimalRescue/animalresque/animals/urls.py | LegolasVzla/django | bbecd7175fb4833731041f88c0ba3327f8a898f0 | [
"MIT"
] | 9 | 2019-12-04T22:50:51.000Z | 2022-02-10T10:25:40.000Z | djangoreactAnimalRescue/animalresque/animals/urls.py | LegolasVzla/django | bbecd7175fb4833731041f88c0ba3327f8a898f0 | [
"MIT"
] | null | null | null | from rest_framework import routers
from .api import AnimalViewSet
router = routers.DefaultRouter()
router.register('api/animals', AnimalViewSet, 'animals')
urlpatterns = router.urls | 26.142857 | 56 | 0.808743 | 21 | 183 | 7 | 0.619048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.098361 | 183 | 7 | 57 | 26.142857 | 0.890909 | 0 | 0 | 0 | 0 | 0 | 0.097826 | 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 |
8ea5e29ef8c1696d1f4448a1275564f4cc6083ea | 786 | py | Python | tools/leetcode.023.Merge k Sorted Lists/leetcode.023.Merge k Sorted Lists.submission5.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | 4 | 2015-10-10T00:30:55.000Z | 2020-07-27T19:45:54.000Z | tools/leetcode.023.Merge k Sorted Lists/leetcode.023.Merge k Sorted Lists.submission5.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | tools/leetcode.023.Merge k Sorted Lists/leetcode.023.Merge k Sorted Lists.submission5.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode[]} lists
# @return {ListNode}
def mergeKLists(self, lists):
lists = [i for i in lists if i]
if not lists: return None
if len(lists) == 1: return lists[0]
dummy = ListNode(0)
d = dummy
lists.sort(key=lambda x: x.val)
while lists:
temp = lists[0]
d.next = temp
temp = temp.next
d = d.next
d.next = None
if temp:
lists[0] = temp
lists.sort(key=lambda x: x.val)
else:
lists = lists[1:]
return dummy.next
| 786 | 786 | 0.479644 | 96 | 786 | 3.885417 | 0.354167 | 0.048257 | 0.064343 | 0.096515 | 0.123324 | 0.123324 | 0.123324 | 0 | 0 | 0 | 0 | 0.013129 | 0.418575 | 786 | 1 | 786 | 786 | 0.803063 | 0.978372 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0 | 0 | 0.15 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8eadce45d598833e81a4fe85012aa8463fefa8ba | 539 | py | Python | main.py | mir45ol/cyber-controller | b12399731d2cb66ae1209e0bfbde9fcc88ed3558 | [
"MIT"
] | 1 | 2022-01-30T01:17:05.000Z | 2022-01-30T01:17:05.000Z | main.py | mir45ol/cyber-controller | b12399731d2cb66ae1209e0bfbde9fcc88ed3558 | [
"MIT"
] | null | null | null | main.py | mir45ol/cyber-controller | b12399731d2cb66ae1209e0bfbde9fcc88ed3558 | [
"MIT"
] | 1 | 2022-02-05T20:17:01.000Z | 2022-02-05T20:17:01.000Z | import config
import controller
import hwrtc
import network
import web_server
import wlan
def main():
if config.wlan_ssid and config.wlan_password:
wlan.initialize_wlan()
wlan.connect_to_wlan()
hwrtc.initialize_hwrtc()
hwrtc.initialize_ds3231()
hwrtc.synchronize_hwrtc_ds3231()
controller.register_pump_led_interrupt_handlers()
if config.wlan_ssid \
and config.wlan_password \
and wlan.wlan.status() == network.STAT_GOT_IP:
web_server.start_web_server()
main()
| 20.730769 | 58 | 0.71243 | 68 | 539 | 5.338235 | 0.426471 | 0.110193 | 0.066116 | 0.088154 | 0.203857 | 0.203857 | 0.203857 | 0.203857 | 0 | 0 | 0 | 0.018824 | 0.211503 | 539 | 25 | 59 | 21.56 | 0.835294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | true | 0.105263 | 0.315789 | 0 | 0.368421 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
8ec19cdfebcf6eb13a2b18ea13fafc46252266f9 | 413 | py | Python | testguess/templates/testguess/json.py | kezabelle/django-testguess | 0d33fd3291157f6454e74e47944767de5dc8a91c | [
"BSD-2-Clause"
] | null | null | null | testguess/templates/testguess/json.py | kezabelle/django-testguess | 0d33fd3291157f6454e74e47944767de5dc8a91c | [
"BSD-2-Clause"
] | null | null | null | testguess/templates/testguess/json.py | kezabelle/django-testguess | 0d33fd3291157f6454e74e47944767de5dc8a91c | [
"BSD-2-Clause"
] | null | null | null | def test_response_is_json(self):
from json import loads
response = self.client.{{ request.method|lower }}('{{ request.path }}', data={{ request.data|safe }})
self.assertFalse(response.streaming)
# rather than F, this will E
content = loads(response.content)
expected = {} # TODO: Fill this in to make the test pass
self.assertEqual(content, expected)
| 41.3 | 109 | 0.631961 | 50 | 413 | 5.16 | 0.68 | 0.100775 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.251816 | 413 | 9 | 110 | 45.888889 | 0.834951 | 0.162228 | 0 | 0 | 0 | 0 | 0.052632 | 0 | 0 | 0 | 0 | 0.111111 | 0.285714 | 0 | null | null | 0 | 0.142857 | null | null | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8ef3b330ea6a710b3d536345a2cc24ce60527a6a | 2,547 | py | Python | python/periodic-web-scrapper/scraper/utilities/WebUtilities.py | MarioCodes/ProyectosClaseDAM | df568b4feda8bf3a6cf7cc8e81e7dfa4156dcfd9 | [
"Apache-2.0"
] | null | null | null | python/periodic-web-scrapper/scraper/utilities/WebUtilities.py | MarioCodes/ProyectosClaseDAM | df568b4feda8bf3a6cf7cc8e81e7dfa4156dcfd9 | [
"Apache-2.0"
] | 17 | 2019-06-14T12:30:46.000Z | 2022-02-18T11:38:50.000Z | python/periodic-web-scrapper/scraper/utilities/WebUtilities.py | MarioCodes/ProyectosClaseDAM | df568b4feda8bf3a6cf7cc8e81e7dfa4156dcfd9 | [
"Apache-2.0"
] | null | null | null | '''
Created on Mar 22, 2018
@author: msanchez
'''
import requests
from html.parser import HTMLParser
import urllib
class WebUtilities(object):
def __init__(self):
''' Utility class. Has everything that has to do with web download / requests.
It may also create static HTML web pages.
Attributes:
content Part of the page which will form the main content, this is the main info to show.
title title which will be shown into HTML <h1> tags as main header.
'''
self.content = ""
def download(self, url):
''' Obtains complete request from an URL.
:param url: Complete url to download
:return: Complete request
:rtype: requests.Response
'''
page = requests.get(url)
page._content = self.__unescape(page)
return page
def web_status(self, url):
''' Pings a web and shows if it's reachable.
:return: online if status code == 200, else offline
:rtype: str
'''
status_code = urllib.request.urlopen(url).getcode()
return "online" if status_code == 200 else "offline" # todo: change to bool
def __unescape(self, page):
''' Removes HTML Entities. If not done, chars such as 'á' would appear as 'x/0f1' when read.
'''
parser = HTMLParser()
return parser.unescape(page.text)
def create_static_web(self, title):
''' Sets the title which will be shown to the given str and creates and empty content
:param title: str to set as the web's title
'''
self.content = ""
self.title = title
def append_paragraph(self, content):
''' Appends the given parameter as a part of the main content to be shown.
it does so appending it into <p> tags.
:param content: str to be added in a new line into <p> tags
'''
self.content += "<p>" + content + "</p>"
def build(self):
''' Main method to call when the rest of options are set. It will mount the title with the content
and return the whole web as a str.
:return: whole static web with appended title and content.
:rtype: str
'''
html_page = "<html><h1>" + self.title + "</h1>"
for entry in self.content:
html_page += entry
html_page += "</html>"
return html_page | 33.513158 | 108 | 0.568512 | 324 | 2,547 | 4.410494 | 0.398148 | 0.038488 | 0.012596 | 0.022393 | 0.082575 | 0.053184 | 0.053184 | 0.053184 | 0 | 0 | 0 | 0.010216 | 0.346682 | 2,547 | 76 | 109 | 33.513158 | 0.848558 | 0.485669 | 0 | 0.074074 | 0 | 0 | 0.041056 | 0 | 0 | 0 | 0 | 0.013158 | 0 | 1 | 0.259259 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d904aa2e2fa43b92a5d3dd1e133389c9c177bb50 | 8,736 | py | Python | app/dell_racadm_info_update.py | haoaaren/check_dell_racadm | cf5aa09fc60b42426811e90cb3812279d3d167a8 | [
"MIT"
] | 4 | 2019-11-20T08:02:00.000Z | 2021-01-05T04:36:59.000Z | app/dell_racadm_info_update.py | haoaaren/check_dell_racadm | cf5aa09fc60b42426811e90cb3812279d3d167a8 | [
"MIT"
] | null | null | null | app/dell_racadm_info_update.py | haoaaren/check_dell_racadm | cf5aa09fc60b42426811e90cb3812279d3d167a8 | [
"MIT"
] | 1 | 2021-01-05T04:37:02.000Z | 2021-01-05T04:37:02.000Z | #coding:utf-8
from flask import request,render_template, redirect,session
from . import app
from dbutil import DB
from collections import OrderedDict
import json
import datetime
# 基础
from dell_racadm import check_client_ip,check_dell_racadm_ip,dell_racadm_achieve_ip_info,achieve_dell_cacadm_comman,check_dell_racadm_info
# 数据信息
# 硬盘信息
from dell_racadm import check_dell_racadm_Physical_disk_format,achieve_disk_reportsclass_table_value,check_dell_racadm_Physical_disk_save
# 系统信息格式化 + 信息/网卡信息入库
from dell_racadm import check_dell_racadm_System_format,check_dell_racadm_System_Nic_info_save
# NIC网卡信息格式化
from dell_racadm import check_dell_racadm_NIC_CARD_format
# CPU信息
from dell_racadm import check_dell_racadm_cpu_info_format,check_dell_racadm_CPU_info_save
# 内存信息
from dell_racadm import check_dell_racadm_memory_info_format,check_dell_racadm_memory_info_save
# 前面板信息
from dell_racadm import check_dell_racadm_System_LCD_CurrentDisplay_save
# 传感器 状态 信息
# 传感器-内存
from dell_racadm import check_dell_racadm_Sensor_memory_format,check_dell_racadm_Sensor_memory_save
# 传感器-风扇
from dell_racadm import check_dell_racadm_Sensor_FAN_format,check_dell_racadm_Sensor_Fan_save
# 传感器-CPU
from dell_racadm import check_dell_racadm_Sensor_CPU_format,check_dell_racadm_Sensor_CPU_save
# 传感器-温度
from dell_racadm import check_dell_racadm_Sensor_TEMPERATURE_format,check_dell_racadm_Sensor_TEMPERATURE_save
# 传感器-电源
from dell_racadm import check_dell_racadm_Sensor_POWER_format,check_dell_racadm_Sensor_POWER_save
# 传感器-电池
from dell_racadm import check_dell_racadm_Sensor_BATTERY_format,check_dell_racadm_Sensor_BATTERY_save
# 此为用来传入IP以检查 并入库。暂未做限制;
# 经测试,应限制在300,警戒500的范围。
# 限制可以在调用此接口的那端限制
@app.route('/dell_racadm', methods=["GET"])
def dell_racadm():
if request.method == "GET":
client_ip = request.remote_addr
if check_client_ip(client_ip) == 'no':
# IP地址没在白名单 禁止访问
return '01'
IP_addr=request.args.get("IP_addr")
check_ip_Result=check_dell_racadm_ip(client_ip,IP_addr)
if check_ip_Result == 'no':
# 返回1 IP地址不在记录中
return '1'
achieve_ip_Result=dell_racadm_achieve_ip_info(client_ip,IP_addr)
if achieve_ip_Result == 'no':
# 返回 2 IP地址信息 获取错误
return '2'
check_time=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
# 先检测 racadm 是否可用
tmp_0 = achieve_dell_cacadm_comman('test_connect')
if tmp_0 == 'no':
# 返回 3 代表 无法获取测试用 racadm 命令
return '3'
tmp_1 = check_dell_racadm_info(IP_addr,achieve_ip_Result['card_user_name'],achieve_ip_Result['card_user_passwd'],tmp_0)
if tmp_1 == 'no' :
# 返回 4 代表 racadm 连接异常
return '4'
# 获取 磁盘信息 入库
tmp_0 = achieve_dell_cacadm_comman('achieve_disk')
tmp_1 = check_dell_racadm_info(IP_addr,achieve_ip_Result['card_user_name'],achieve_ip_Result['card_user_passwd'],tmp_0)
if tmp_1 != 'no':
tmp_2=check_dell_racadm_Physical_disk_format(tmp_1,IP_addr,check_time)
if tmp_2 != 'no':
need_state = achieve_disk_reportsclass_table_value('save_status_data_need')
tmp_3=check_dell_racadm_Physical_disk_save(IP_addr,achieve_ip_Result['id'],check_time,tmp_1,tmp_2,need_state)
# 获取 服务器型号 服务标签 快速服务代码 操作系统 电源状态 网卡 等等信息入库
tmp_0 = achieve_dell_cacadm_comman('achieve_NIC_and_System')
tmp_1 = check_dell_racadm_info(IP_addr,achieve_ip_Result['card_user_name'],achieve_ip_Result['card_user_passwd'],tmp_0)
if tmp_1 == 'no':
return '5'
# 获取 服务器型号 服务标签 快速服务代码 操作系统 电源状态 网卡 等等信息入库
# 服务器型号 服务标签 快速服务代码 操作系统 电源状态 格式化
need_state = achieve_disk_reportsclass_table_value('System_Information')
tmp_3=check_dell_racadm_System_format(tmp_1,IP_addr,check_time,need_state)
# 网卡信息格式化
tmp_4=check_dell_racadm_NIC_CARD_format(tmp_1,IP_addr,check_time)
# 入库操作
tmp_5=check_dell_racadm_System_Nic_info_save(achieve_ip_Result['id'],System_data=tmp_3,Nic_data=tmp_4)
# 硬件资源 内存 信息入库
tmp_0 = achieve_dell_cacadm_comman('achieve_Memory_info')
tmp_1 = check_dell_racadm_info(IP_addr,achieve_ip_Result['card_user_name'],achieve_ip_Result['card_user_passwd'],tmp_0)
if tmp_1 == 'no':
return '6'
tmp_2=check_dell_racadm_memory_info_format(tmp_1,IP_addr,check_time,achieve_ip_Result['id'])
if tmp_2 == 'no':
return '7'
tmp_3=check_dell_racadm_memory_info_save(achieve_ip_Result['id'],tmp_2)
# 硬件资源 CPU 信息入库
tmp_0 = achieve_dell_cacadm_comman('achieve_CPU_info')
tmp_1 = check_dell_racadm_info(IP_addr,achieve_ip_Result['card_user_name'],achieve_ip_Result['card_user_passwd'],tmp_0)
if tmp_1 == 'no':
return '8'
tmp_2 = check_dell_racadm_cpu_info_format(tmp_1,IP_addr,check_time,achieve_ip_Result['id'])
if tmp_2 == 'no':
return '9'
tmp_3 = check_dell_racadm_CPU_info_save(achieve_ip_Result['id'],tmp_2)
# 硬件信息 前面板信息获取
tmp_0 = achieve_dell_cacadm_comman('achieve_System_LCD')
tmp_1 = check_dell_racadm_info(IP_addr,achieve_ip_Result['card_user_name'],achieve_ip_Result['card_user_passwd'],tmp_0)
if tmp_1 != 'no':
check_dell_racadm_System_LCD_CurrentDisplay_save(achieve_ip_Result['id'],tmp_1)
# cpu 内存 温度 风扇 硬盘 主板等等信息(传感器)
tmp_0 = achieve_dell_cacadm_comman('achieve_sensorinfo')
tmp_1 = check_dell_racadm_info(IP_addr,achieve_ip_Result['card_user_name'],achieve_ip_Result['card_user_passwd'],tmp_0)
if tmp_1 == 'no':
return '10'
# 内存传感器信息格式化并入库
tmp_2=check_dell_racadm_Sensor_memory_format(tmp_1,check_time,achieve_ip_Result['id'])
if tmp_2 != 'no':
check_dell_racadm_Sensor_memory_save(achieve_ip_Result['id'],tmp_2)
# 风扇传感器信息格式化并入库
tmp_2=check_dell_racadm_Sensor_FAN_format(tmp_1,check_time,achieve_ip_Result['id'])
if tmp_2 != 'no':
check_dell_racadm_Sensor_Fan_save(achieve_ip_Result['id'],tmp_2)
# CPU传感器信息格式化并入库
tmp_2=check_dell_racadm_Sensor_CPU_format(tmp_1,check_time,achieve_ip_Result['id'])
if tmp_2 != 'no':
check_dell_racadm_Sensor_CPU_save(achieve_ip_Result['id'],tmp_2)
# 温度传感器信息格式化并入库
tmp_2=check_dell_racadm_Sensor_TEMPERATURE_format(tmp_1,check_time,achieve_ip_Result['id'])
if tmp_2 != 'no':
check_dell_racadm_Sensor_TEMPERATURE_save(achieve_ip_Result['id'],tmp_2)
# 电源传感器信息格式化并入库
tmp_2=check_dell_racadm_Sensor_POWER_format(tmp_1,check_time,achieve_ip_Result['id'])
if tmp_2 != 'no':
check_dell_racadm_Sensor_POWER_save(achieve_ip_Result['id'],tmp_2)
# 电池传感器信息格式化并入库
tmp_2=check_dell_racadm_Sensor_BATTERY_format(tmp_1,check_time,achieve_ip_Result['id'])
if tmp_2 != 'no':
check_dell_racadm_Sensor_BATTERY_save(achieve_ip_Result['id'],tmp_2)
return 'ok'
# return json.dumps(tmp_2, ensure_ascii=False)
else:
return redirect('/')
# cpu 内存 温度 风扇 硬盘 主板等等信息入库
@app.route('/save_cpu', methods=["GET"])
def save_cpu():
if request.method == "GET":
client_ip = request.remote_addr
if check_client_ip(client_ip) == 'no':
# IP地址没在白名单 禁止访问
return '01'
IP_addr=request.args.get("IP_addr")
check_ip_Result=check_dell_racadm_ip(client_ip,IP_addr)
if check_ip_Result == 'no':
# 返回1 IP地址不在记录中
return '1'
achieve_ip_Result=dell_racadm_achieve_ip_info(client_ip,IP_addr)
if achieve_ip_Result == 'no':
# 返回 2 IP地址信息 获取错误
return '2'
# 更新网卡
tmp_0 = achieve_dell_cacadm_comman('achieve_NIC_and_System')
if tmp_0 == 'no':
return '3'
tmp_1 = check_dell_racadm_info(IP_addr,achieve_ip_Result['card_user_name'],achieve_ip_Result['card_user_passwd'],tmp_0)
if tmp_1 == 'no':
# 返回 3 代表 racadm 连接异常
return '3'
check_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
need_state = achieve_disk_reportsclass_table_value('System_Information')
tmp_2=check_dell_racadm_System_format(tmp_1,IP_addr,check_time,need_state)
return json.dumps(tmp_2, ensure_ascii=False)
tmp_2 = check_dell_racadm_NIC_CARD_format(tmp_1,IP_addr,check_time)
if tmp_2 == 'no':
# 返回 4 代表 数据格式化失败,规则不匹配
return '4'
else:
return json.dumps(tmp_2, ensure_ascii=False)
return tmp_2
return '33'
| 41.799043 | 138 | 0.704556 | 1,302 | 8,736 | 4.238863 | 0.12596 | 0.137706 | 0.157637 | 0.091321 | 0.842906 | 0.809748 | 0.660808 | 0.559159 | 0.444465 | 0.444465 | 0 | 0.018527 | 0.209135 | 8,736 | 208 | 139 | 42 | 0.780287 | 0.086081 | 0 | 0.503876 | 0 | 0 | 0.079647 | 0.008192 | 0 | 0 | 0 | 0 | 0 | 1 | 0.015504 | false | 0.062016 | 0.147287 | 0 | 0.341085 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 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 |
d92be7a0a2a9418b2f005b72010bbabb90745df1 | 2,632 | py | Python | commands/Premium/premium.py | adl212/Lacan-NTSport-Source-Code | b5b01cbb5cc97b5cbd3a6ebcf90c2e6d82322968 | [
"MIT"
] | 1 | 2021-04-25T18:31:48.000Z | 2021-04-25T18:31:48.000Z | commands/Premium/premium.py | adl212/Lacan-NTSport-Source-Code | b5b01cbb5cc97b5cbd3a6ebcf90c2e6d82322968 | [
"MIT"
] | 6 | 2021-03-26T21:18:57.000Z | 2021-05-03T18:04:37.000Z | commands/Premium/premium.py | adl212/Lacan-NTSport-Source-Code | b5b01cbb5cc97b5cbd3a6ebcf90c2e6d82322968 | [
"MIT"
] | 4 | 2021-03-06T16:48:36.000Z | 2021-05-23T00:54:09.000Z | '''What is premium?'''
from discord.ext import commands
from packages.utils import Embed, ImproperType
class Command(commands.Cog):
def __init__(self, client):
self.client= client
@commands.command()
async def premium(self, ctx):
#return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
if await ImproperType.check(ctx): return
embed=Embed('Premium', 'Premium is a one time purchase for your Discord server. \n It will make your server appearance a lot better. \n There are lots of benefits you will get for being a premium server. \n \n Your benefits are: \n :small_blue_diamond: **LIFETIME** server access to **all** features of this bot. \n :small_blue_diamond: You don\'t have to do anything, the bot will create speed, gold member, accuracy and race roles for your server. \n :small_blue_diamond: Role registering / updating system through the command `n.update`. \n :small_blue_diamond: Nickname updating system through the command `n.update`. \n :small_blue_diamond: The feeling that you helped the developers a lot through your purchasement. \n :small_blue_diamond: More things coming soon:tm:, so stay tuned. \n \n :small_orange_diamond: In order to receive these Premium features, check your class down below. Then send `10M` to [this](https://nitrotype.com/racer/hypertyper55) account and DM <@505338178287173642> on discord.', 'diamond_shape_with_a_dot_inside')
#\n\n **__List of Premium 💠 Server Prizes__** (since December 20th 2020)\n\n:small_orange_diamond: ***Class I:*** Human Members: __<50__, Age: __>3 months__: `5M`.\n\n:small_orange_diamond: ***Class II:*** Human members: __50-99__, Age: __>3 months__: `10M`.\n\n:small_orange_diamond: ***Class III:*** Human members: 100-150, Age: __>3 months__: `15M`. \n\n:small_orange_diamond: ***Class IV:*** Human members: __150-199__, Age __>3 months__: `20M`. \n\n:small_orange_diamond: ***Class V: ***Human members: __200+__, Age: __>3 months__: `25M`. \n\n:small_orange_diamond: ***Class VI: ***Human members: __ANY__, Age: __<3 months__: `20M`.')
embed.footer(f'{ctx.author} • Become a premium 💠 member today! 💗')
embed.thumbnail('https://media.discordapp.net/attachments/719414661686099993/754971786231283712/season-callout-badge.png')
await embed.send(ctx)
try:
await ctx.message.delete()
except:
pass
def setup(client):
client.add_cog(Command(client)) | 101.230769 | 1,054 | 0.720365 | 396 | 2,632 | 4.585859 | 0.462121 | 0.042952 | 0.026982 | 0.05011 | 0.154185 | 0.143172 | 0.060573 | 0.060573 | 0.060573 | 0.060573 | 0 | 0.046259 | 0.162234 | 2,632 | 26 | 1,055 | 101.230769 | 0.77551 | 0.338526 | 0 | 0 | 0 | 0.055556 | 0.27781 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.055556 | 0.111111 | 0 | 0.277778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d942a04ced23f92091eda9000046982c5f7f347a | 306 | py | Python | routers/repo/tests/in/py/sample_projects/car/rear_suspension_assembly.py | fermiumlabs/gitea | 34b1f2546b306f15c65f21d8f9629507d3fdd798 | [
"MIT"
] | 1 | 2020-10-08T14:14:52.000Z | 2020-10-08T14:14:52.000Z | routers/repo/tests/in/py/sample_projects/car/rear_suspension_assembly.py | fermiumlabs/gitea | 34b1f2546b306f15c65f21d8f9629507d3fdd798 | [
"MIT"
] | null | null | null | routers/repo/tests/in/py/sample_projects/car/rear_suspension_assembly.py | fermiumlabs/gitea | 34b1f2546b306f15c65f21d8f9629507d3fdd798 | [
"MIT"
] | null | null | null | # coding: utf-8
r"""Tabby rear suspension assembly"""
from car_assemblies import make_rear_suspension_assembly
from osvcad.view import view_assembly, view_assembly_graph
assembly = make_rear_suspension_assembly()
if __name__ == "__main__":
view_assembly(assembly)
view_assembly_graph(assembly)
| 23.538462 | 58 | 0.803922 | 40 | 306 | 5.625 | 0.475 | 0.213333 | 0.293333 | 0.231111 | 0.293333 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003717 | 0.120915 | 306 | 12 | 59 | 25.5 | 0.832714 | 0.147059 | 0 | 0 | 0 | 0 | 0.031373 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.285714 | 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 |
d966b6da1943e7fcc8c1aa8f39d2dde2c9b18bf1 | 779 | py | Python | objectModel/Python/cdm/persistence/cdmfolder/types/projections/operation_add_artifact_attribute.py | rt112000/CDM | 34bd34f9260140a8f8aa02bd87c23033f3daad4c | [
"CC-BY-4.0",
"MIT"
] | 884 | 2019-05-10T02:09:10.000Z | 2022-03-31T14:02:00.000Z | objectModel/Python/cdm/persistence/cdmfolder/types/projections/operation_add_artifact_attribute.py | rt112000/CDM | 34bd34f9260140a8f8aa02bd87c23033f3daad4c | [
"CC-BY-4.0",
"MIT"
] | 171 | 2019-06-10T11:34:37.000Z | 2022-03-31T22:50:12.000Z | objectModel/Python/cdm/persistence/cdmfolder/types/projections/operation_add_artifact_attribute.py | rt112000/CDM | 34bd34f9260140a8f8aa02bd87c23033f3daad4c | [
"CC-BY-4.0",
"MIT"
] | 340 | 2019-05-07T18:00:16.000Z | 2022-03-31T12:00:15.000Z | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
from typing import Union
from cdm.persistence.cdmfolder.types.projections.operation_base import OperationBase
from cdm.persistence.cdmfolder.types.type_attribute import TypeAttribute
from cdm.persistence.cdmfolder.types.entity_attribute import EntityAttribute
from cdm.persistence.cdmfolder.types import AttributeGroupReference
class OperationAddArtifactAttribute(OperationBase):
"""OperationAddArtifactAttribute class"""
def __init__(self):
super().__init__()
self.newAttribute = None # type: Union[str, AttributeGroupReference, TypeAttribute, EntityAttribute]
self.insertAtTop = None
| 41 | 109 | 0.803594 | 83 | 779 | 7.409639 | 0.566265 | 0.045528 | 0.117073 | 0.17561 | 0.20813 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12837 | 779 | 18 | 110 | 43.277778 | 0.905744 | 0.335045 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.5 | 0 | 0.7 | 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 | 1 | 0 | 1 | 0 | 0 | 3 |
d97890969781912a2513be62820c2cd00f1b4a65 | 131 | py | Python | drf_gitlab_webhook/urls.py | Develatio/drf-gitlab-webhook | 34a90a979da1b004886620a89e916b88a61e0c85 | [
"MIT"
] | 1 | 2019-01-19T22:06:31.000Z | 2019-01-19T22:06:31.000Z | drf_gitlab_webhook/urls.py | Develatio/drf-gitlab-webhook | 34a90a979da1b004886620a89e916b88a61e0c85 | [
"MIT"
] | null | null | null | drf_gitlab_webhook/urls.py | Develatio/drf-gitlab-webhook | 34a90a979da1b004886620a89e916b88a61e0c85 | [
"MIT"
] | 1 | 2019-05-09T16:56:04.000Z | 2019-05-09T16:56:04.000Z | from django.conf.urls import url
from . import classviews
urlpatterns = [
url(r'^event/$', classviews.HookEvent.as_view()),
]
| 18.714286 | 53 | 0.709924 | 17 | 131 | 5.411765 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145038 | 131 | 6 | 54 | 21.833333 | 0.821429 | 0 | 0 | 0 | 0 | 0 | 0.061069 | 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 |
d990ddde01350e477f961c78fce1ed2af6c8f78a | 16,528 | py | Python | stgelpDL/dev/edfiles.py | dmitryv56/stgelpDL | a3dbe9f1a4ff19586dfdfac01748634b47389a6e | [
"MIT"
] | null | null | null | stgelpDL/dev/edfiles.py | dmitryv56/stgelpDL | a3dbe9f1a4ff19586dfdfac01748634b47389a6e | [
"MIT"
] | null | null | null | stgelpDL/dev/edfiles.py | dmitryv56/stgelpDL | a3dbe9f1a4ff19586dfdfac01748634b47389a6e | [
"MIT"
] | null | null | null | import pandas as pd
import copy
from pathlib import Path
import pandas as pd
import numpy as np
import math
from datetime import datetime,timedelta
import matplotlib.pyplot as plt
from predictor.utility import msg2log
def Forcast_imbalance_edit():
ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/ElHiero_24092020_27102020.csv")
src_col_name = "Forcasting"
src1_col_name = "Real_demand"
dst_col_name = "FrcImbalance"
ds[dst_col_name] =[round(ds[src_col_name][i]-ds[src1_col_name][i],2) for i in range(len(ds)) ]
ds.to_csv("~/LaLaguna/stgelpDL/dataLaLaguna/ElHiero_24092020_27102020_CommonAnalyze.csv", index=False)
return
def WindTurbine_edit():
ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/ElHiero_24092020_20102020_WindGenPower.csv")
aux_col_name = "Programmed_demand"
dest_col_name="Real_demand"
src_col_name="WindGen_Power_"
ds[aux_col_name]=[ 0.0 for i in range(len(ds[aux_col_name]))]
ds[dest_col_name]=ds[src_col_name]
ds.to_csv("~/LaLaguna/stgelpDL/dataLaLaguna/editedElHiero_24092020_20102020_WindGenPower.csv", index=False)
return
def profivateHouse_edit():
ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/__PrivateHouseElectricityConsumption_21012020.csv")
col_name='lasts'
dt_col_name='Date Time'
aux_col_name="Programmed_demand"
data_col_name="Demand"
v=ds[col_name].values
for i in range (len(ds[col_name].values)):
a=v[i].split('-')
v[i]='T'+a[0]+":00.000+02:00"
ds[col_name]=copy.copy(v)
for i in range(len(ds[col_name])):
ds[dt_col_name][i] =ds[dt_col_name][i] + v[i]
ds1 =ds.drop([col_name], axis=1)
add_col=[]
for i in range(len(ds[dt_col_name])):
add_col.append(ds[data_col_name].values[i] * 2 )
ds1[aux_col_name]=add_col
ds1.to_csv("~/LaLaguna/stgelpDL/dataLaLaguna/PrivateHouseElectricityConsumption_21012020.csv", index=False)
pass
def powerSolarPlant_edit():
# ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/__PowerGenOfSolarPlant_21012020.csv")
ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/__SolarPlantPowerGen_21012020.csv")
# col_name = 'lasts'
dt_col_name = 'Date Time'
aux_col_name = "Programmed_demand"
data_col_name = "PowerGen"
v = ds[dt_col_name].values
for i in range(len(ds[dt_col_name].values)):
a = v[i].split(' ')
b=a[0].split('.')
if len(a[1])<5:
a[1]='0'+a[1]
v[i]='2020-'+b[1]+"-"+b[0]+'T'+a[1]+':00.000+02:00'
ds[dt_col_name] = copy.copy(v)
# ds1 = ds.drop([col_name], axis=1)
add_col = []
for i in range(len(ds[dt_col_name])):
add_col.append(ds[data_col_name].values[i] * 2)
ds[aux_col_name] = add_col
# ds1.to_csv("~/LaLaguna/stgelpDL/dataLaLaguna/PowerGenOfSolarPlant_21012020.csv", index=False)
ds.to_csv("~/LaLaguna/stgelpDL/dataLaLaguna/SolarPlantPowerGen_21012020_21012020.csv", index=False)
pass
def powerSolarPlant_Imbalance():
# ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/__PowerGenOfSolarPlant_21012020.csv")
ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/SolarPlantPowerGen_21012020.csv")
# col_name = 'lasts'
dt_col_name = 'Date Time'
aux_col_name = "Programmed_demand"
data_col_name = "PowerGen"
ds["Imbalance"] = [ds[aux_col_name].values[i]-ds[data_col_name].values[i] for i in range(len(ds)) ]
ds.to_csv("~/LaLaguna/stgelpDL/dataLaLaguna/SolarPlantPowerGen_21012020.csv", index=False)
pass
def powerElHiero_edit():
ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/_ElHiero_24092020_20102020_additionalData.csv")
dt_col_name = 'Date Time'
aux_col_name = "Programmed_demand"
data_col_name = "PowerGen"
v = ds[dt_col_name].values
for i in range(len(ds[dt_col_name].values)):
a = v[i].split(' ')
b = a[0].split('.')
if len(a[1]) < 5:
a[1] = '0' + a[1]
v[i] = '2020-' + b[1] + "-" + b[0] + 'T' + a[1] + ':00.000+02:00'
ds[dt_col_name] = copy.copy(v)
ds.to_csv("~/LaLaguna/stgelpDL/dataLaLaguna/ElHiero_24092020_20102020_additionalData.csv", index=False)
pass
def datosElHiero_edit():
# ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/__PowerGenOfSolarPlant_21012020.csv")
ds = pd.read_csv("~/LaLaguna/stgelpDL/dataLaLaguna/Datos_de_El_Hierro_2016.csv")
# col_name = 'lasts'
dt_col_name = 'Date Time'
v = ds[dt_col_name].values
for i in range(len(ds[dt_col_name].values)):
a = v[i].split(' ') #29-12-2016 3:00:00
b=a[0].split('-') # dd mm year
a0new="{}-{}-{}".format(b[2],b[1],b[0])
c=a[1].split(':') #h mm ss
if len(c[0])<2:
c[0]='0{}'.format(c[0])
a1new='{}:{}:{}.000+00:00'.format(c[0],c[1],c[2])
v[i]="{}T{}".format(a0new,a1new)
ds[dt_col_name] = copy.copy(v)
ds.to_csv("~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016.", index=False)
pass
def datosElHiero_PerDay():
src_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016.csv"
dst_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016_Days.csv"
ds = pd.read_csv(src_csv)
# col_name = 'lasts'
dt_col_name = 'Date Time'
data_col_name = 'Real_demand'
v=ds[data_col_name].values
n_v=len(v)
col_names=["{}:{}".format(int(i/6), (i%6)*10) for i in range(144)]
v_dict = {col_names[i]:[] for i in range(144)}
# d_dict = {"Date Time": [ds[dt_col_name][i] for i in range(0, n_v, 144)]}
# d_dict={"Date": [pd.to_datetime(ds[dt_col_name][i],dayfirst=True).date() for i in range(0,n_v,144)]}
d_dict = {"Date": [pd.to_datetime(ds[dt_col_name][i], dayfirst=True).date().strftime('%Y-%m-%d') for i in range(0, n_v, 144)]}
for i in range(n_v):
v_dict[col_names[i%144]].append(v[i])
# last list 365-size, we add v[0]
d={**d_dict,**v_dict}
ds1=pd.DataFrame(d)
ds1.to_csv(dst_csv)
return
def datosElHiero_PerTimeStamps():
src_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016.csv"
dst_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016_TimeStamps.csv"
ds = pd.read_csv(src_csv)
# col_name = 'lasts'
dt_col_name = 'Date Time'
data_col_name = 'Real_demand'
v=ds[data_col_name].values
n_v=len(v)
col_names= [pd.to_datetime(ds[dt_col_name][i], dayfirst=True).date().strftime('%Y-%m-%d') for i in
range(0, n_v, 144)]
row_names=["{}:{}".format(int(i/6), (i%6)*10) for i in range(144)]
v_dict={}
# v_dict = {item:[] for item in col_names}
# d_dict = {"Date Time": [ds[dt_col_name][i] for i in range(0, n_v, 144)]}
# d_dict={"Date": [pd.to_datetime(ds[dt_col_name][i],dayfirst=True).date() for i in range(0,n_v,144)]}
d_dict = {"Date": [pd.to_datetime(ds[dt_col_name][i], dayfirst=True).date().strftime('%Y-%m-%d') for i in range(0, n_v, 144)]}
d_dict = {"Timestamp": row_names}
n_start=0
n_series=144 # obsefvation points
n_features=366 # days
for icol in col_names:
v_dict[icol]=v[n_start:n_start+n_series].tolist()
n_start=n_start+n_series
# last list 365-size, we add v[0]
d={**d_dict,**v_dict}
ds1=pd.DataFrame(d)
ds1.to_csv(dst_csv)
return
def datosElHiero_PerTimeStamps():
dst_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016-Est.csv"
src_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016_TimeStamps.csv"
ds = pd.read_csv(src_csv)
# col_name = 'lasts'
dt_col_name = 'Timestamp'
d_dst={}
vts=ds['Timestamp'].values.tolist()
vts.append('ave')
vts.append('std')
vts.append('min')
vts.append('max')
d_dst["RowName"]=vts
for col in ds.columns:
if 'Unnamed' in col or 'Timestamp' in col: continue
v=ds[col].values.tolist()
a=np.array(v)
ave=a.mean()
std=a.std()
minv=a.min()
maxv=a.max()
v.append(round(ave,3))
v.append(round(std,3))
v.append(round(minv,2))
v.append(round(maxv,2))
d_dst[col]=v
ds1 = pd.DataFrame(d_dst)
n_ds1=len(ds1)
ave = []
std = []
minv = []
maxv = []
for i in range(n_ds1):
v=[]
for col in ds1.columns[1:]:
v.append(ds1[col][i])
a=np.array(v)
ave.append(round(a.mean(),3))
std.append(round(a.std(),3))
minv.append(round(a.min(),2))
maxv.append(round(a.max(),2))
ds1['ave']=ave
ds1['std'] = std
ds1['min'] = minv
ds1['max'] = maxv
ds1.to_csv(dst_csv)
return
""" transform time series (feature in source dataset) matrix Nrows * Mcols.
The source dataset must comprise a timestamp feature(column) named 'dt_col_name' or index column. The 'data_col_name'-
feature must be a time series (TS) are ordered by index ot timestamp feature('dt_col_name') , that is, the observation
must be equidistant and without gaps. Additional, the beginning timestamp must be 00:00:00 (or 0 for index).
The 'period' and 'direction' determine the formation of the matrix.
If the 'direction' is along the 'X'- axis, then the segments of the TS corresponding to the 'period' are the
rows of the matrix. Column names are derived from observation times within a period, for example, "00: 00,00: 10, ...,
23:50" to 10 minutes discretization and a period of 1 day.
If the direction is along 'Y'-axis, then the segment of the TS corresponding to the 'period' are the column of matrix.
The column names are derived from the period in the timestamp, i.g. data string if the period is 1 day like as
'2016-03-27', and row names are derived from observations within period, for example, "00:00,...,23:50".
"""
def ts2matrix(source_csv:str=None, dest_csv:str=None, dt_col_name:str="Date Time",
data_col_name:str='Real_demand', outRowIndex="rowNames", discret:int=10,period:object=None,
direction:str='x', title:str="", f:object=None):
if source_csv is None or not Path(source_csv).exists() :
msg="The source dataset path is invalid: {}".format(source_csv)
msg2log(None,msg,f)
return None
ds=pd.read_csv(source_csv)
if dt_col_name not in ds.columns or data_col_name not in ds.columns:
msg = "{} or {} not found in the dataset {}".format(dt_col_name,data_col_name, source_csv)
msg2log(None, msg, f)
return None
folder_csv=Path(source_csv).parent
dest_csv = Path(folder_csv / "{}_{}".format(title,data_col_name)).with_suffix(".csv")
dest_se_csv = Path(folder_csv / "{}_{}_StatEst".format(title, data_col_name)).with_suffix(".csv")
if direction=="X" or direction == "x":
dsMatrix = ts2matrix_X(ds=ds, dt_col_name=dt_col_name, data_col_name=data_col_name,outRowIndex=outRowIndex,
discret=discret, period=period, f=f)
elif direction=="Y" or direction == "y":
dsMatrix = ts2matrix_Y(ds=ds, dt_col_name=dt_col_name, data_col_name=data_col_name, outRowIndex=outRowIndex,
discret=discret, period=period, f=f)
else:
msg = "{} invalid direction ".format(direction)
msg2log(None, msg, f)
return None
dsMatrix.to_csv(dest_csv)
dsMatrixStatEst=ts2matrix_statest(ds=dsMatrix, rowIndexName=outRowIndex, f=f)
dsMatrixStatEst.to_csv(dest_se_csv)
return
def ts2matrix_X(ds:pd.DataFrame=None, dt_col_name:str='Date Time',data_col_name:str='Real_demand',
outRowIndex:str="rowNames", discret:int=10,period:int=144, f:object=None)->pd.DataFrame:
# src_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016.csv"
# dst_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016_Days.csv"
# ds = pd.read_csv(src_csv)
# # col_name = 'lasts'
# dt_col_name = 'Date Time'
# data_col_name = 'Real_demand'
h_period_sr=60/discret # hour in sample resolution, 6
d_period_sr = period # day period in sample resolution, 144
v=ds[data_col_name].values
n_v=len(v)
if n_v%d_period_sr!=0:
msg="Time series size is {} and it is not multiply of {} period".format(n_v,d_period_sr)
msg2log(None,msg,f)
return None
col_names = ["{}:{}".format(int(i / h_period_sr), int((i % h_period_sr) * 10)) for i in range(d_period_sr)]
v_dict = {col_names[i]:[] for i in range(d_period_sr)}
d_dict = {outRowIndex: [pd.to_datetime(ds[dt_col_name][i], dayfirst=True).date().strftime('%Y-%m-%d') \
for i in range(0, n_v, d_period_sr)]}
for i in range(n_v):
v_dict[col_names[i%144]].append(v[i])
d={**d_dict,**v_dict}
ds1=pd.DataFrame(d)
# ds1.to_csv(dst_csv)
return ds1
def ts2matrix_Y(ds:pd.DataFrame=None, dt_col_name:str='Date Time',data_col_name:str='Real_demand',
outRowIndex:str="rowNames", discret:int=10,period:int=144, f:object=None)->pd.DataFrame:
# src_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016.csv"
# dst_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016_TimeStamps.csv"
# ds = pd.read_csv(src_csv)
# # col_name = 'lasts'
# dt_col_name = 'Date Time'
# data_col_name = 'Real_demand'
#
#
v=ds[data_col_name].values
n_v=len(v)
h_period_sr = 60 / discret # hour in sample resolution, 6
d_period_sr = period # day period in sample resolution, 144
v = ds[data_col_name].values
n_v = len(v)
if n_v % d_period_sr != 0:
msg = "Time series size is {} and it is not multiply of {} period".format(n_v, d_period_sr)
msg2log(None, msg, f)
return None
col_names= [pd.to_datetime(ds[dt_col_name][i], dayfirst=True).date().strftime('%Y-%m-%d') for i in
range(0, n_v, d_period_sr)]
row_names=["{}:{}".format(int(i/h_period_sr), int((i%h_period_sr)*10)) for i in range(d_period_sr)]
v_dict={}
d_dict = {outRowIndex: row_names}
n_start=0
n_series=d_period_sr # obsefvation points
n_features=366 # days
for icol in col_names:
v_dict[icol]=v[n_start:n_start+n_series].tolist()
n_start=n_start+n_series
d={**d_dict,**v_dict}
ds1=pd.DataFrame(d)
# ds1.to_csv(dst_csv)
return ds1
def ts2matrix_statest(ds:pd.DataFrame=None,rowIndexName:str="rowNames",f:object=None):
# dst_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016-Est.csv"
# src_csv="~/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016_TimeStamps.csv"
# ds = pd.read_csv(src_csv)
# col_name = 'lasts'
dt_col_name = rowIndexName
d_dst={}
vts=ds[rowIndexName].values.tolist()
vts.append('ave')
vts.append('std')
vts.append('min')
vts.append('max')
d_dst[rowIndexName]=vts
for col in ds.columns:
if 'Unnamed' in col or rowIndexName in col: continue
v=ds[col].values.tolist()
a=np.array(v)
ave=a.mean()
std=a.std()
minv=a.min()
maxv=a.max()
v.append(round(ave,3))
v.append(round(std,3))
v.append(round(minv,2))
v.append(round(maxv,2))
d_dst[col]=v
ds1 = pd.DataFrame(d_dst)
n_ds1=len(ds1)
ave = []
std = []
minv = []
maxv = []
for i in range(n_ds1):
v=[]
for col in ds1.columns[1:]:
v.append(ds1[col][i])
a=np.array(v)
ave.append(round(a.mean(),3))
std.append(round(a.std(),3))
minv.append(round(a.min(),2))
maxv.append(round(a.max(),2))
ds1['ave']=ave
ds1['std'] = std
ds1['min'] = minv
ds1['max'] = maxv
# ds1.to_csv(dst_csv)
return ds1
if __name__=="__main__":
# privateHouse_edit()
# powerSolarPlant_edit()
# powerElHiero_edit()
#WindTurbine_edit()
# Forcast_imbalance_edit()
# powerSolarPlant_Imbalance()
# powerSolarPlant_analysis()
# datosElHiero_edit()
# datosElHiero_PerDay()
# datosElHiero_PerTimeStamps()
# datosElHiero_PerTimeStamps()
src_csv = "/home/dmitryv/LaLaguna/stgelpDL/dataLaLaguna/Data_ElHierro_2016.csv"
with open("loglog.log",'w+') as ff:
ts2matrix(source_csv=src_csv, dt_col_name = "Date Time", data_col_name= 'Real_demand',
outRowIndex = "rowNames", discret = 10, period=144, direction = 'x', title = "X_direction", f=ff)
ts2matrix(source_csv=src_csv, dt_col_name="Date Time", data_col_name='Real_demand',
outRowIndex="rowNames", discret=10, period=144, direction='y', title="Y_direction", f=ff)
pass
| 35.697624 | 130 | 0.647749 | 2,560 | 16,528 | 3.960938 | 0.101563 | 0.077318 | 0.040828 | 0.091716 | 0.761736 | 0.723274 | 0.706016 | 0.672781 | 0.641913 | 0.619034 | 0 | 0.042902 | 0.201779 | 16,528 | 462 | 131 | 35.774892 | 0.725688 | 0.131534 | 0 | 0.647619 | 0 | 0 | 0.182067 | 0.107751 | 0 | 0 | 0 | 0 | 0 | 1 | 0.044444 | false | 0.019048 | 0.028571 | 0 | 0.11746 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d992c4a228423f90ecb2adf20087008d8ce1a6bc | 1,352 | py | Python | geneticalgorithm2/cache.py | its4avin/geneticalgorithm2 | 59663ce92a92a0278b5220c32a63a3a2b839d4b1 | [
"MIT"
] | 1 | 2021-04-14T18:11:34.000Z | 2021-04-14T18:11:34.000Z | geneticalgorithm2/cache.py | its4avin/geneticalgorithm2 | 59663ce92a92a0278b5220c32a63a3a2b839d4b1 | [
"MIT"
] | null | null | null | geneticalgorithm2/cache.py | its4avin/geneticalgorithm2 | 59663ce92a92a0278b5220c32a63a3a2b839d4b1 | [
"MIT"
] | null | null | null |
import numpy as np
from functools import lru_cache, wraps
#from fastcache import clru_cache
def np_lru_cache(*args, **kwargs):
"""
LRU cache implementation for functions whose FIRST parameter is a numpy array
forked from: https://gist.github.com/Susensio/61f4fee01150caaac1e10fc5f005eb75
"""
def decorator(function):
@wraps(function)
def wrapper(np_array):
return cached_wrapper( tuple(np_array))
@lru_cache(*args, **kwargs)
#@clru_cache(*args, **kwargs)
def cached_wrapper(hashable_array):
return function(np.array(hashable_array))
# copy lru_cache attributes over too
wrapper.cache_info = cached_wrapper.cache_info
wrapper.cache_clear = cached_wrapper.cache_clear
return wrapper
return decorator
if __name__ == '__main__':
ar = np.random.randint(0, 100, (1000, 100))
f = lambda arr: np.std(arr + arr/(1 + arr**2) - arr + np.sin(arr) * np.cos(arr) + 2)
def no_c(arr):
return f(arr)
@np_lru_cache(maxsize = 700, typed = True)
def with_c(arr):
return f(arr)
#%time for _ in range(50): [no_c(arr) for arr in ar[np.random.rand(ar.shape[0]).argsort()]]
#%time for _ in range(50): [with_c(arr) for arr in ar[np.random.rand(ar.shape[0]).argsort()]]
| 23.719298 | 97 | 0.633136 | 187 | 1,352 | 4.390374 | 0.395722 | 0.058465 | 0.054811 | 0.043849 | 0.17296 | 0.099878 | 0.099878 | 0.099878 | 0.099878 | 0.099878 | 0 | 0.039331 | 0.247781 | 1,352 | 56 | 98 | 24.142857 | 0.767945 | 0.323965 | 0 | 0.090909 | 0 | 0 | 0.00905 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0.181818 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
7950faaf8969b4bfd67614a72bff42f402a632e6 | 357 | py | Python | bookwyrm/activitypub/image.py | mouse-reeve/fedireads | e3471fcc3500747a1b1deaaca662021aae5b08d4 | [
"CC0-1.0"
] | 270 | 2020-01-27T06:06:07.000Z | 2020-06-21T00:28:18.000Z | bookwyrm/activitypub/image.py | mouse-reeve/fedireads | e3471fcc3500747a1b1deaaca662021aae5b08d4 | [
"CC0-1.0"
] | 158 | 2020-02-10T20:36:54.000Z | 2020-06-26T17:12:54.000Z | bookwyrm/activitypub/image.py | mouse-reeve/fedireads | e3471fcc3500747a1b1deaaca662021aae5b08d4 | [
"CC0-1.0"
] | 15 | 2020-02-13T21:53:33.000Z | 2020-06-17T16:52:46.000Z | """ an image, nothing fancy """
from dataclasses import dataclass
from .base_activity import ActivityObject
@dataclass(init=False)
class Document(ActivityObject):
"""a document"""
url: str
name: str = ""
type: str = "Document"
id: str = None
@dataclass(init=False)
class Image(Document):
"""an image"""
type: str = "Image"
| 17 | 41 | 0.64986 | 42 | 357 | 5.5 | 0.52381 | 0.060606 | 0.155844 | 0.199134 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212885 | 357 | 20 | 42 | 17.85 | 0.822064 | 0.120448 | 0 | 0.181818 | 0 | 0 | 0.043919 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.181818 | 0 | 0.818182 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
7956e8f8d0ec0fef2a695bd6195a66b5f1e4e0e9 | 420 | py | Python | docs/python/attachments/animals.py | Benbinbin/blog-data | e98b6560253bb6a1aa35e08b4ba36d03194920d1 | [
"MIT"
] | null | null | null | docs/python/attachments/animals.py | Benbinbin/blog-data | e98b6560253bb6a1aa35e08b4ba36d03194920d1 | [
"MIT"
] | null | null | null | docs/python/attachments/animals.py | Benbinbin/blog-data | e98b6560253bb6a1aa35e08b4ba36d03194920d1 | [
"MIT"
] | null | null | null |
class Dog:
def speak(self):
print("Woof!")
def __init__(self, name):
self.name = name
def hear(self, words):
if self.name in words:
self.speak()
class Husky(Dog):
origin = "Siberia"
def speak(self):
print("Awoo!")
class Chihuahua(Dog):
origin = "Mexico"
def speak(self):
print("Yip!")
class Labrador(Dog):
origin = "Canada"
| 14 | 30 | 0.538095 | 50 | 420 | 4.44 | 0.44 | 0.108108 | 0.162162 | 0.22973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.32381 | 420 | 29 | 31 | 14.482759 | 0.78169 | 0 | 0 | 0.166667 | 0 | 0 | 0.078759 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0 | 0 | 0 | 0.666667 | 0.166667 | 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 |
795e54dfa1e363bb6a92f080ec47772f29a13da6 | 811 | py | Python | fastapi_react_admin/__init__.py | sqllq/fastapi-react-admin | a0384061bd36881bcd334edb54eab5ab610ebbfd | [
"MIT"
] | null | null | null | fastapi_react_admin/__init__.py | sqllq/fastapi-react-admin | a0384061bd36881bcd334edb54eab5ab610ebbfd | [
"MIT"
] | null | null | null | fastapi_react_admin/__init__.py | sqllq/fastapi-react-admin | a0384061bd36881bcd334edb54eab5ab610ebbfd | [
"MIT"
] | null | null | null | """
______ _ _ _____ _ _ _
| ____| | | (_) | __ \ | | /\ | | (_)
| |__ __ _ ___| |_ __ _ _ __ _ | |__) |___ ___| |_ / \ __| |_ __ ___ _ _ __
| __/ _` / __| __/ _` | '_ \| | | _ // _ \/ __| __| / /\ \ / _` | '_ ` _ \| | '_ \
| | | (_| \__ \ || (_| | |_) | | | | \ \ __/ (__| |_ / ____ \ (_| | | | | | | | | | |
|_| \__,_|___/\__\__,_| .__/|_| |_| \_\___|\___|\__| /_/ \_\__,_|_| |_| |_|_|_| |_|
| |
|_|
"""
from .config import router
from .auth import admin_login_view
from .core import ReactAppAdmin, ReactTortoiseModelAdmin
from .commands import create_super_user, compile_app_admin, compile_model_admin
__version__ = "0.0.1"
| 45.055556 | 89 | 0.393342 | 31 | 811 | 5.645161 | 0.677419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00625 | 0.408138 | 811 | 17 | 90 | 47.705882 | 0.358333 | 0.701603 | 0 | 0 | 0 | 0 | 0.022321 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
79be6504986834ffb4fc631ea1dcce3c139c7fb4 | 161 | py | Python | wsmode/exceptions.py | 29527/OKExPyWebsocket | d084373e0bf18ca533bcc8f4fc1ba051d6be0209 | [
"MIT"
] | 2 | 2021-08-20T10:01:22.000Z | 2021-11-07T21:41:35.000Z | wsmode/exceptions.py | 29527/OKExPyWebsocket | d084373e0bf18ca533bcc8f4fc1ba051d6be0209 | [
"MIT"
] | null | null | null | wsmode/exceptions.py | 29527/OKExPyWebsocket | d084373e0bf18ca533bcc8f4fc1ba051d6be0209 | [
"MIT"
] | 3 | 2021-08-18T09:07:15.000Z | 2022-03-11T08:09:06.000Z | class MessageTypeNotExist(Exception):
"""
消息类型不存在
"""
pass
class TopicMessageTypeNotExist(Exception):
"""
主题消息类型不存在
"""
pass
| 10.733333 | 42 | 0.590062 | 10 | 161 | 9.5 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.298137 | 161 | 14 | 43 | 11.5 | 0.840708 | 0.10559 | 0 | 0.5 | 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 |
8dc3232c7e5f402c1d0748b307d531d49a9423ea | 144 | py | Python | lib/abridger/extraction_model/table.py | willangenent/abridger | 6daa80f7360339376b38544ce60694c5addaa30f | [
"MIT"
] | 8 | 2016-10-19T14:15:34.000Z | 2020-06-23T09:37:02.000Z | lib/abridger/extraction_model/table.py | freewilll/abridger | 6daa80f7360339376b38544ce60694c5addaa30f | [
"MIT"
] | null | null | null | lib/abridger/extraction_model/table.py | freewilll/abridger | 6daa80f7360339376b38544ce60694c5addaa30f | [
"MIT"
] | null | null | null | class Table(object):
def __init__(self, table, col, values):
self.table = table
self.col = col
self.values = values
| 24 | 43 | 0.590278 | 18 | 144 | 4.5 | 0.444444 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.305556 | 144 | 5 | 44 | 28.8 | 0.81 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8dcf634f294734dd35e17dc999018f8d298536e2 | 171 | py | Python | palindrome_partitioning.py | spencercjh/sync-leetcode-today-problem-python3-example | 4957e5eadb697334741df0fc297bec2edaa9e2ab | [
"Apache-2.0"
] | null | null | null | palindrome_partitioning.py | spencercjh/sync-leetcode-today-problem-python3-example | 4957e5eadb697334741df0fc297bec2edaa9e2ab | [
"Apache-2.0"
] | null | null | null | palindrome_partitioning.py | spencercjh/sync-leetcode-today-problem-python3-example | 4957e5eadb697334741df0fc297bec2edaa9e2ab | [
"Apache-2.0"
] | null | null | null |
class PalindromePartitioning:
"""
https://leetcode-cn.com/problems/palindrome-partitioning/
"""
def partition(self, s: str) -> List[List[str]]:
| 19 | 61 | 0.619883 | 17 | 171 | 6.235294 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 171 | 8 | 62 | 21.375 | 0.796992 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8df91c6b34032c0d6f4c0950b4b4025e8db29746 | 10,161 | py | Python | orator/schema/grammars/sqlite_grammar.py | HeathLee/sorator | 271668865bf0d039908643e3df9b98c966b9d956 | [
"MIT"
] | null | null | null | orator/schema/grammars/sqlite_grammar.py | HeathLee/sorator | 271668865bf0d039908643e3df9b98c966b9d956 | [
"MIT"
] | null | null | null | orator/schema/grammars/sqlite_grammar.py | HeathLee/sorator | 271668865bf0d039908643e3df9b98c966b9d956 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from .grammar import SchemaGrammar
class SQLiteSchemaGrammar(SchemaGrammar):
_modifiers = ['unsigned', 'nullable', 'default', 'increment']
_serials = ['big_integer', 'integer']
def compile_rename_column(self, blueprint, command, connection):
"""
Compile a rename column command.
:param blueprint: The blueprint
:type blueprint: Blueprint
:param command: The command
:type command: Fluent
:param connection: The connection
:type connection: orator.connections.Connection
:rtype: list
"""
sql = []
# If foreign keys are on, we disable them
foreign_keys = self._connection.select('PRAGMA foreign_keys')
if foreign_keys:
foreign_keys = bool(foreign_keys[0])
if foreign_keys:
sql.append('PRAGMA foreign_keys = OFF')
sql += super().compile_rename_column(
blueprint, command, connection)
if foreign_keys:
sql.append('PRAGMA foreign_keys = ON')
return sql
def compile_change(self, blueprint, command, connection):
"""
Compile a change column command into a series of SQL statement.
:param blueprint: The blueprint
:type blueprint: orator.schema.Blueprint
:param command: The command
:type command: Fluent
:param connection: The connection
:type connection: orator.connections.Connection
:rtype: list
"""
sql = []
# If foreign keys are on, we disable them
foreign_keys = self._connection.select('PRAGMA foreign_keys')
if foreign_keys:
foreign_keys = bool(foreign_keys[0])
if foreign_keys:
sql.append('PRAGMA foreign_keys = OFF')
sql += super(SQLiteSchemaGrammar,
self).compile_change(blueprint, command, connection)
if foreign_keys:
sql.append('PRAGMA foreign_keys = ON')
return sql
def compile_table_exists(self):
"""
Compile the query to determine if a table exists
:rtype: str
"""
result = ("SELECT * FROM sqlite_master WHERE type = 'table' "
"AND name = %(marker)s" % {'marker': self.get_marker()})
return result
def compile_column_exists(self, table):
"""
Compile the query to determine the list of columns.
"""
return 'PRAGMA table_info(%s)' % table.replace('.', '__')
def compile_create(self, blueprint, command, _):
"""
Compile a create table command.
"""
columns = ', '.join(self._get_columns(blueprint))
sql = 'CREATE TABLE %s (%s' % (self.wrap_table(blueprint), columns)
sql += self._add_foreign_keys(blueprint)
sql += self._add_primary_keys(blueprint)
return sql + ')'
def _add_foreign_keys(self, blueprint):
sql = ''
foreigns = self._get_commands_by_name(blueprint, 'foreign')
for foreign in foreigns:
sql += self._get_foreign_key(foreign)
if foreign.get('on_delete'):
sql += ' ON DELETE %s' % foreign.on_delete
if foreign.get('on_update'):
sql += ' ON UPDATE %s' % foreign.on_delete
return sql
def _get_foreign_key(self, foreign):
on = self.wrap_table(foreign.on)
columns = self.columnize(foreign.columns)
references = foreign.references
if not isinstance(references, list):
references = [references]
on_columns = self.columnize(references)
return ', FOREIGN KEY(%s) REFERENCES %s(%s)' % (
columns, on, on_columns)
def _add_primary_keys(self, blueprint):
primary = self._get_command_by_name(blueprint, 'primary')
if primary:
columns = self.columnize(primary.columns)
return ', PRIMARY KEY (%s)' % columns
return ''
def compile_add(self, blueprint, command, _):
table = self.wrap_table(blueprint)
columns = self.prefix_list('ADD COLUMN', self._get_columns(blueprint))
statements = []
for column in columns:
statements.append('ALTER TABLE %s %s' % (table, column))
return statements
def compile_unique(self, blueprint, command, _):
columns = self.columnize(command.columns)
table = self.wrap_table(blueprint)
return 'CREATE UNIQUE INDEX %s ON %s (%s)' % (
command.index, table, columns)
def compile_index(self, blueprint, command, _):
columns = self.columnize(command.columns)
table = self.wrap_table(blueprint)
return 'CREATE INDEX %s ON %s (%s)' % (command.index, table, columns)
def compile_foreign(self, blueprint, command, _):
pass
def compile_drop(self, blueprint, command, _):
return 'DROP TABLE %s' % self.wrap_table(blueprint)
def compile_drop_if_exists(self, blueprint, command, _):
return 'DROP TABLE IF EXISTS %s' % self.wrap_table(blueprint)
def compile_drop_column(self, blueprint, command, connection):
schema = connection.get_schema_manager()
table_diff = self._get_table_diff(blueprint, schema)
for name in command.columns:
column = connection.get_column(blueprint.get_table(), name)
table_diff.removed_columns[name] = column
return schema.get_database_platform().get_alter_table_sql(table_diff)
def compile_drop_unique(self, blueprint, command, _):
return 'DROP INDEX %s' % command.index
def compile_drop_index(self, blueprint, command, _):
return 'DROP INDEX %s' % command.index
def compile_rename(self, blueprint, command, _):
from_ = self.wrap_table(blueprint)
return 'ALTER TABLE %s RENAME TO %s' % (
from_, self.wrap_table(command.to))
# why need comment in SQLite Schema?
# Because multi orator type dump to same SQLite type
# so meet a SQLite type, doesn't know the origin type
def _type_char(self, column):
return 'VARCHAR /*char(%%s,%s)*/' % column.length
def _type_string(self, column):
return 'VARCHAR /*string(%%s,%s)*/' % column.length
def _type_text(self, column):
return 'TEXT /*text(%s)*/'
def _type_medium_text(self, column):
return 'TEXT /*medium_text(%s)*/'
def _type_long_text(self, column):
return 'TEXT /*long_text(%s)*/'
def _type_integer(self, column):
return 'INTEGER /*integer(%s)*/'
def _type_big_integer(self, column):
return 'INTEGER /*big_integer(%s)*/'
def _type_medium_integer(self, column):
return 'INTEGER /*medium_integer(%s)*/'
def _type_tiny_integer(self, column):
return 'TINYINT /*tiny_integer(%s)*/'
def _type_small_integer(self, column):
return 'INTEGER /*small_integer(%s)*/'
def _type_float(self, column):
return 'FLOAT /*float(%s)*/'
def _type_double(self, column):
if column.total and column.places:
return 'FLOAT /*double(%%s,%s,%s)*/' % (
column.total, column.places)
return 'FLOAT /*double(%s)*/'
def _type_decimal(self, column):
return 'NUMERIC /*DECIMAL(%%s,%s,%s)*/' % (
column.total, column.places)
def _type_boolean(self, column):
return 'TINYINT /*boolean(%s)*/'
def _type_enum(self, column):
return 'VARCHAR /*enum(%%s,%s)*/' % column.allowed
def _type_json(self, column):
return 'TEXT /*json(%s)*/'
def _type_date(self, column):
return 'DATE /*date(%s)*/'
def _type_datetime(self, column):
return 'DATETIME /*datetime(%s)*/'
def _type_time(self, column):
return 'TIME /*time(%s)*/'
def _type_timestamp(self, column):
if column.use_current:
return 'DATETIME /*timestamp(%s)*/ DEFAULT CURRENT_TIMESTAMP'
return 'DATETIME /*timestamp(%s)*/'
def _type_binary(self, column):
return 'BLOB /*binary*/'
def _modify_nullable(self, blueprint, column):
if column.get('nullable'):
return ' NULL'
return ' NOT NULL'
def _modify_unsigned(self, blueprint, column):
# SQLite doesn't have unsigned
# but the schema dumper need this info
if column.get('unsigned', False):
return ' /*unsigned*/'
return ''
def _modify_default(self, blueprint, column):
if column.get('default') is not None:
return ' DEFAULT %s' % self._get_default_value(column.default)
return ''
def _modify_increment(self, blueprint, column):
if column.type in self._serials and column.auto_increment:
return ' PRIMARY KEY AUTOINCREMENT'
return ''
def _get_dbal_column_type(self, type_):
"""
Get the dbal column type.
:param type_: The fluent type
:type type_: str
:rtype: str
"""
type_ = type_.lower()
if type_ == 'enum':
return 'string'
return super()._get_dbal_column_type(type_)
def _list_tables(self):
sql = """\
SELECT name AS table_name
FROM sqlite_master
WHERE type="table"
"""
return sql
def _list_columns(self, table):
sql = """\
PRAGMA table_info('{}');
""".format(table)
return sql
def _plain_sql(self, column):
sql = """\
SELECT sql
FROM sqlite_master
WHERE type = 'table'
AND name = '{}'
""".format(column)
return sql
def _list_indexes(self, table):
sql = """\
PRAGMA index_list('{}')
""".format(table)
return sql
def _show_index(self, index):
sql = """\
PRAGMA index_info('{}')
""".format(index)
return sql
def _list_foreign_keys(self, table):
sql = """\
PRAGMA foreign_key_list('{}')
""".format(table)
return sql
| 28.382682 | 78 | 0.591674 | 1,142 | 10,161 | 5.06042 | 0.144483 | 0.043779 | 0.052604 | 0.026648 | 0.38761 | 0.304724 | 0.234989 | 0.225991 | 0.200381 | 0.200381 | 0 | 0.000418 | 0.293377 | 10,161 | 357 | 79 | 28.462185 | 0.804457 | 0.104911 | 0 | 0.237864 | 0 | 0 | 0.191141 | 0.012266 | 0 | 0 | 0 | 0 | 0 | 1 | 0.242718 | false | 0.004854 | 0.004854 | 0.11165 | 0.538835 | 0.174757 | 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 |
8dfa54ed9ca447d258b8fa54b0c7ae8f6bd61598 | 262 | py | Python | Vamei/std02/time1.py | YangPhy/learnPython | 5507fa1a0d2878fc663d62509af8ff959955f822 | [
"MIT"
] | 5 | 2020-05-18T06:54:52.000Z | 2021-05-29T23:17:41.000Z | Vamei/std02/time1.py | YangPhy/learnPython | 5507fa1a0d2878fc663d62509af8ff959955f822 | [
"MIT"
] | null | null | null | Vamei/std02/time1.py | YangPhy/learnPython | 5507fa1a0d2878fc663d62509af8ff959955f822 | [
"MIT"
] | 1 | 2020-05-17T22:47:49.000Z | 2020-05-17T22:47:49.000Z | import time
print(time.time())
# DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
# print(time.clock())
print(time.process_time())
print(time.perf_counter())
| 37.428571 | 154 | 0.782443 | 43 | 262 | 4.674419 | 0.534884 | 0.179104 | 0.129353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017094 | 0.10687 | 262 | 6 | 155 | 43.666667 | 0.84188 | 0.656489 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0.75 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
8dfbec677b19e5f32fef5dafd97ffba05416b93b | 3,706 | py | Python | catkit/emulators/ZwoCamera.py | aidancgray/catkit | c789f20a327faf91f5b34b6818670732eab24040 | [
"BSD-3-Clause"
] | 1 | 2020-09-04T22:50:21.000Z | 2020-09-04T22:50:21.000Z | catkit/emulators/ZwoCamera.py | aidancgray/catkit | c789f20a327faf91f5b34b6818670732eab24040 | [
"BSD-3-Clause"
] | 2 | 2020-09-08T20:50:39.000Z | 2020-09-14T17:52:27.000Z | catkit/emulators/ZwoCamera.py | aidancgray/catkit | c789f20a327faf91f5b34b6818670732eab24040 | [
"BSD-3-Clause"
] | null | null | null | import abc
import logging
import zwoasi
from catkit.config import CONFIG_INI
import catkit.hardware.zwo.ZwoCamera
# Convert zwoasi module to a class such that it can be inherited.
ZwoASI = type("ZwoASI", (), zwoasi.__dict__)
class ZwoEmulator(ZwoASI):
""" Class to emulate of the zwoasi library. """
implemented_camera_purposes = None
@classmethod
def get_camera_mappings(cls):
# Find all cameras
camera_mappings = {}
for camera_purpose in cls.implemented_camera_purposes:
camera_config_id = CONFIG_INI.get("testbed", camera_purpose)
camera_name = CONFIG_INI.get(camera_config_id, 'camera_name')
camera_mappings[camera_config_id] = {"purpose": camera_purpose, "name": camera_name}
return camera_mappings
def __init__(self, config_id):
self.log = logging.getLogger()
self.config_id = config_id
self.image_type = None
self.control_values = {}
self.camera_mappings = self.get_camera_mappings()
if self.config_id not in self.camera_mappings:
raise ValueError(f"Unknown camera for simulations: {self.config_id}")
self.camera_purpose = self.camera_mappings[self.config_id]["purpose"]
def init(self, library_file=None):
pass
@classmethod
def get_num_cameras(cls):
return len(cls.implemented_camera_purposes)
def list_cameras(self):
return [camera["name"] for camera in self.camera_mappings.values()]
def Camera(self, id_):
return self
def get_controls(self):
# only used for oepn behavior to
# get / set control values to default on open
# needs to play nicely with calls to set_controls
# this phony dict is set to have *some* accessible value (None) for
# every dict key we ask for
return {'BandWidth': {'MinValue': None, 'ControlType': None, 'DefaultValue': None}}
def set_control_value(self, control_type, value, auto=False):
accepted_types = (int,)
if value is not None and not isinstance(value, accepted_types):
raise ValueError(f"Expected type {accepted_types} got '{type(value)}'")
self.control_values[control_type] = value
def start_video_capture(self):
pass
def stop_video_capture(self):
pass
def stop_exposure(self):
pass
def set_image_type(self, image_type):
self.image_type = image_type
@abc.abstractmethod
def capture(self, initial_sleep=0.01, poll=0.01, buffer=None, filename=None):
pass
def capture_video_frame(self, buffer=None, filename=None, timeout=None):
return self.capture(buffer=buffer, filename=filename)
def close(self):
pass
def get_camera_property(self):
# sometimes this just gets logged
# one use where it needs keys 'MaxWidth', 'MaxHeight'
# I *think* this can just return a dict with milquetoast values for this
# took said milquetoast values from the __setup_control_values sim
# function here
return {'MaxWidth': 4096, 'MaxHeight': 4096}
pass
def set_id(self, id, id_str):
pass
def set_roi(self, start_x=None, start_y=None, width=None, height=None, bins=None, image_type=None):
# sets region of interest
# purpose : set_roi_format, set_roi_start_position
# set_roi_format --> _set_roi_format :
# check for all the errors
# runs zwolib.ASISetROIFormat(id_, width, height, bins, image_type)
# set_roi_start_position --> _set_start_position :
# runs zwolib.ASISetStartPos(id_, start_x, start_y)
pass # according to Marshall
| 32.79646 | 103 | 0.669185 | 484 | 3,706 | 4.896694 | 0.334711 | 0.053165 | 0.025316 | 0.023629 | 0.067511 | 0.022785 | 0 | 0 | 0 | 0 | 0 | 0.005002 | 0.244738 | 3,706 | 112 | 104 | 33.089286 | 0.841729 | 0.240961 | 0 | 0.174603 | 0 | 0 | 0.072146 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.142857 | 0.079365 | 0.079365 | 0.507937 | 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 |
5c0ce4192fe64603b53959af5cc740ca348b1497 | 1,335 | py | Python | setup.py | cpkthompson/django-fake-bot-detector | 5b04bbd7eb20ba5a15de8e661c78fd86af9c988f | [
"Apache-2.0"
] | 5 | 2019-05-07T07:41:45.000Z | 2021-06-08T13:30:17.000Z | setup.py | cpkthompson/django-fake-bot-detector | 5b04bbd7eb20ba5a15de8e661c78fd86af9c988f | [
"Apache-2.0"
] | 7 | 2020-06-12T17:27:54.000Z | 2022-02-10T11:06:30.000Z | setup.py | cpkthompson/django-fake-bot-detector | 5b04bbd7eb20ba5a15de8e661c78fd86af9c988f | [
"Apache-2.0"
] | 1 | 2021-04-28T09:23:58.000Z | 2021-04-28T09:23:58.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from fakebotdetector import __version__
def get_long_description():
"""Return the README"""
return open('README.md', 'r', encoding='utf8').read()
setup(
name='django-fake-bot-detector',
version=__version__,
url='https://github.com/danmoz/django-fake-bot-detector',
license='Apache Software License',
description='Detect and block fake search bots 🤖',
long_description=get_long_description(),
long_description_content_type='text/markdown',
author='Dan Morrison',
author_email='dan@offworld.net.au',
packages=['fakebotdetector'],
classifiers=[
'Development Status :: 4 - Beta',
'Framework :: Django',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
)
| 32.560976 | 70 | 0.637453 | 139 | 1,335 | 6.007194 | 0.568345 | 0.182036 | 0.239521 | 0.186826 | 0.064671 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013397 | 0.217228 | 1,335 | 40 | 71 | 33.375 | 0.784689 | 0.044944 | 0 | 0 | 0 | 0 | 0.55205 | 0.018927 | 0 | 0 | 0 | 0 | 0 | 1 | 0.032258 | true | 0 | 0.064516 | 0 | 0.129032 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5c2f35124e182302dbaf9ddef40c95728068c056 | 225 | py | Python | snippets/html2sql.py | dejbug/dejan7 | 0e3d9f4068cd7b39a3a992f4b21fa5042c88227b | [
"MIT"
] | null | null | null | snippets/html2sql.py | dejbug/dejan7 | 0e3d9f4068cd7b39a3a992f4b21fa5042c88227b | [
"MIT"
] | null | null | null | snippets/html2sql.py | dejbug/dejan7 | 0e3d9f4068cd7b39a3a992f4b21fa5042c88227b | [
"MIT"
] | null | null | null | import web
if "__main__" == __name__:
u = "https://www.ebay.de/sch/Mobel-Wohnen/11700/i.html?_from=R40&LH_BIN=1&_nkw=kaffeetisch&_dcat=38205&rt=nc&_mPrRngCbx=1&_udlo=4&_udhi=29"
r = web.fetch(u)
print r.status_code
| 32.142857 | 141 | 0.715556 | 41 | 225 | 3.536585 | 0.902439 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084577 | 0.106667 | 225 | 6 | 142 | 37.5 | 0.636816 | 0 | 0 | 0 | 0 | 0.2 | 0.643836 | 0 | 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 |
5c32bff6da66b4fa728d03c16f79c609f2bc49ab | 464 | py | Python | ga4stpg/graph/__init__.py | GiliardGodoi/steiner-problem-with-evol | 6b34f0342b791ae6c65b6d016c37a4d45ab5cdad | [
"MIT"
] | null | null | null | ga4stpg/graph/__init__.py | GiliardGodoi/steiner-problem-with-evol | 6b34f0342b791ae6c65b6d016c37a4d45ab5cdad | [
"MIT"
] | 5 | 2021-01-26T17:28:32.000Z | 2021-03-14T13:46:48.000Z | ga4stpg/graph/__init__.py | GiliardGodoi/steiner-problem-with-evol | 6b34f0342b791ae6c65b6d016c37a4d45ab5cdad | [
"MIT"
] | 1 | 2021-01-25T16:35:59.000Z | 2021-01-25T16:35:59.000Z | # -*- coding: utf-8 -*-
from .reader import SteinerTreeProblem, Reader, ReaderORLibrary
from .graph import UndirectedWeightedGraph
from .graph import UndirectedWeightedGraph as UWGraph
from .graph import UndirectedWeightedGraph as Graph
from .graph import UndirectedGraph
from .graph import UndirectedGraph as UGraph
__all__ = [
"Graph",
"UndirectedGraph",
"UGraph",
"Reader",
"ReaderORLibrary",
"SteinerTreeProblem"
]
| 27.294118 | 64 | 0.721983 | 42 | 464 | 7.880952 | 0.357143 | 0.135952 | 0.226586 | 0.344411 | 0.241692 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002688 | 0.198276 | 464 | 16 | 65 | 29 | 0.887097 | 0.045259 | 0 | 0 | 0 | 0 | 0.152941 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3083e2c645cba7ab538bab70a7a1386f4a0020e4 | 208 | py | Python | impysonator/npl/contants.py | guidiego/impysonator | df5b7a48818ead24ea6ec22b6829c643fab992aa | [
"MIT"
] | 7 | 2018-03-28T18:05:09.000Z | 2018-04-09T14:11:26.000Z | impysonator/npl/contants.py | guidiego/impysonator | df5b7a48818ead24ea6ec22b6829c643fab992aa | [
"MIT"
] | null | null | null | impysonator/npl/contants.py | guidiego/impysonator | df5b7a48818ead24ea6ec22b6829c643fab992aa | [
"MIT"
] | null | null | null | from re import compile
IMPERSONAL_EXPRESSIONS = [
compile('^(\.*)nós[\s|\.|$]'),
compile('Nos\s| nos[\s|$]|-nos[\s|$]'),
compile('[N|(\.|\s)n]oss[a|o]'),
compile('\w*[e|a]mos[,|\.|\s|$]')
]
| 20.8 | 43 | 0.480769 | 29 | 208 | 3.413793 | 0.551724 | 0.121212 | 0.141414 | 0.161616 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149038 | 208 | 9 | 44 | 23.111111 | 0.559322 | 0 | 0 | 0 | 0 | 0 | 0.418269 | 0.105769 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 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 |
309223f2f8156cc62e0138df83ac0f0153900966 | 62 | py | Python | duckgo.py | yashaka/webdriver-demo | bf1c7d29f54af5e3c77ab2d85bc4bed054a609e1 | [
"MIT"
] | null | null | null | duckgo.py | yashaka/webdriver-demo | bf1c7d29f54af5e3c77ab2d85bc4bed054a609e1 | [
"MIT"
] | null | null | null | duckgo.py | yashaka/webdriver-demo | bf1c7d29f54af5e3c77ab2d85bc4bed054a609e1 | [
"MIT"
] | null | null | null | from selenipupser import element
query = element('[name=q]')
| 15.5 | 32 | 0.741935 | 8 | 62 | 5.75 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 62 | 3 | 33 | 20.666667 | 0.851852 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 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 |
3098faf17a69f75a1483cd08aad053831460cf55 | 144 | py | Python | Prazen Euler.py | Babnik21/Euler | e73f27ca477c58940a8212b17cd86fce9684e15b | [
"MIT"
] | null | null | null | Prazen Euler.py | Babnik21/Euler | e73f27ca477c58940a8212b17cd86fce9684e15b | [
"MIT"
] | null | null | null | Prazen Euler.py | Babnik21/Euler | e73f27ca477c58940a8212b17cd86fce9684e15b | [
"MIT"
] | null | null | null | i = 0
vsota = 0
while i < 1000:
if i % 3 == 0:
vsota += i
elif i % 5 == 0:
vsota += i
i += 1
print(vsota)
| 7.2 | 20 | 0.375 | 23 | 144 | 2.347826 | 0.478261 | 0.333333 | 0.259259 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148649 | 0.486111 | 144 | 19 | 21 | 7.578947 | 0.581081 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
30a148fcef8cc908dd17aa013d41bed192bfd5de | 122 | py | Python | libraries/website/docs/snippets/cas/overview/evaluate_expression.py | justindujardin/mathy | 776ac528d4586d6ea558a7212adb3559ea487a3c | [
"MIT"
] | 95 | 2020-01-02T23:02:34.000Z | 2022-03-08T18:57:24.000Z | libraries/website/docs/snippets/cas/overview/evaluate_expression.py | justindujardin/mathy | 776ac528d4586d6ea558a7212adb3559ea487a3c | [
"MIT"
] | 44 | 2020-01-05T03:07:45.000Z | 2021-08-11T20:45:53.000Z | libraries/website/docs/snippets/cas/overview/evaluate_expression.py | justindujardin/mathy | 776ac528d4586d6ea558a7212adb3559ea487a3c | [
"MIT"
] | 5 | 2020-04-04T16:46:36.000Z | 2022-03-30T08:10:02.000Z | from mathy_core import ExpressionParser
expression = ExpressionParser().parse("4 + 2")
assert expression.evaluate() == 6
| 24.4 | 46 | 0.770492 | 14 | 122 | 6.642857 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027778 | 0.114754 | 122 | 4 | 47 | 30.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0.040984 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 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 |
30c249456403ba1e6baa94afda95313e18e736de | 106 | py | Python | textProcessing/urls.py | nvakhilnair/Text-Pre-processing-for-Sentiment-Analysis | 646b79258af745ea0cdb623b9763de714717259d | [
"MIT"
] | null | null | null | textProcessing/urls.py | nvakhilnair/Text-Pre-processing-for-Sentiment-Analysis | 646b79258af745ea0cdb623b9763de714717259d | [
"MIT"
] | null | null | null | textProcessing/urls.py | nvakhilnair/Text-Pre-processing-for-Sentiment-Analysis | 646b79258af745ea0cdb623b9763de714717259d | [
"MIT"
] | null | null | null | from .views import API
from django.urls import path
urlpatterns = [
path('', API.as_view()),
]
| 11.777778 | 28 | 0.632075 | 14 | 106 | 4.714286 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.235849 | 106 | 8 | 29 | 13.25 | 0.814815 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 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 |
30efd3e520d72e743da6e55444a12e5dda1b5179 | 199 | py | Python | sdipylib/plot.py | sdrdl/sdipylib | 197a6c434d2b34a52e6544973407e92f3561727a | [
"BSD-2-Clause"
] | null | null | null | sdipylib/plot.py | sdrdl/sdipylib | 197a6c434d2b34a52e6544973407e92f3561727a | [
"BSD-2-Clause"
] | null | null | null | sdipylib/plot.py | sdrdl/sdipylib | 197a6c434d2b34a52e6544973407e92f3561727a | [
"BSD-2-Clause"
] | null | null | null | """Plotting support"""
def source_attribution(ax, text ):
ax.text(0, -.05, text, fontsize=14,
horizontalalignment='left', verticalalignment='top',
transform=ax.transAxes) | 33.166667 | 64 | 0.643216 | 21 | 199 | 6.047619 | 0.809524 | 0.094488 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031646 | 0.20603 | 199 | 6 | 65 | 33.166667 | 0.772152 | 0.080402 | 0 | 0 | 0 | 0 | 0.039326 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
30f370fe717239a2c55137458132ce5868ea35e1 | 337 | py | Python | enema/crypto.py | kjczarne/enema | 6ac59cb13663f924574846d2558f27e0bb41a92d | [
"MIT"
] | null | null | null | enema/crypto.py | kjczarne/enema | 6ac59cb13663f924574846d2558f27e0bb41a92d | [
"MIT"
] | null | null | null | enema/crypto.py | kjczarne/enema | 6ac59cb13663f924574846d2558f27e0bb41a92d | [
"MIT"
] | null | null | null | import os
from cryptography.fernet import Fernet
def encrypt_password(password: str, key):
f = Fernet(key)
return str(f.encrypt(bytes(password, 'utf-8')), 'utf-8')
def decrypt_password(password: str, key):
f = Fernet(key)
return str(f.decrypt(bytes(password, 'utf-8')), 'utf-8')
KEY = os.environ.get("DASH_APP_KEY") | 22.466667 | 60 | 0.68546 | 52 | 337 | 4.365385 | 0.384615 | 0.070485 | 0.167401 | 0.193833 | 0.555066 | 0.555066 | 0.370044 | 0.370044 | 0.370044 | 0.370044 | 0 | 0.014035 | 0.154303 | 337 | 15 | 61 | 22.466667 | 0.782456 | 0 | 0 | 0.222222 | 0 | 0 | 0.094675 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.444444 | 0.222222 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
eb4a3d4d9082fcac0d03dfdabc44cb8a2905e9b2 | 2,677 | py | Python | myteam/migrations/0001_initial.py | raymundosaraiva/fifa_myteam | 3b813cdffb63449dbfca96350529f9fde17b5025 | [
"MIT"
] | null | null | null | myteam/migrations/0001_initial.py | raymundosaraiva/fifa_myteam | 3b813cdffb63449dbfca96350529f9fde17b5025 | [
"MIT"
] | null | null | null | myteam/migrations/0001_initial.py | raymundosaraiva/fifa_myteam | 3b813cdffb63449dbfca96350529f9fde17b5025 | [
"MIT"
] | null | null | null | # Generated by Django 2.1.7 on 2019-06-08 21:37
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Player',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('Name', models.CharField(max_length=50)),
('Age', models.IntegerField()),
('Photo', models.CharField(max_length=100)),
('Nationality', models.CharField(max_length=50)),
('Flag', models.CharField(max_length=100)),
('Overall', models.IntegerField()),
('Potential', models.IntegerField()),
('Club', models.CharField(max_length=50)),
('ClubLogo', models.CharField(max_length=100)),
('Value', models.CharField(max_length=10)),
('Wage', models.CharField(max_length=10)),
('PreferredFoot', models.CharField(max_length=10)),
('Position', models.CharField(max_length=10)),
('Height', models.CharField(max_length=10)),
('Weight', models.CharField(max_length=10)),
('Finishing', models.IntegerField()),
('HeadingAccuracy', models.IntegerField()),
('ShortPassing', models.IntegerField()),
('Volleys', models.IntegerField()),
('Dribbling', models.IntegerField()),
('Curve', models.IntegerField()),
('FKAccuracy', models.IntegerField()),
('LongPassing', models.IntegerField()),
('BallControl', models.IntegerField()),
('Acceleration', models.IntegerField()),
('SprintSpeed', models.IntegerField()),
('Agility', models.IntegerField()),
('Reactions', models.IntegerField()),
('Balance', models.IntegerField()),
('ShotPower', models.IntegerField()),
('Jumping', models.IntegerField()),
('Stamina', models.IntegerField()),
('Strength', models.IntegerField()),
('LongShots', models.IntegerField()),
('Aggression', models.IntegerField()),
('Interceptions', models.IntegerField()),
('Positioning', models.IntegerField()),
('Vision', models.IntegerField()),
('Penalties', models.IntegerField()),
('Marking', models.IntegerField()),
],
),
]
| 43.885246 | 114 | 0.525215 | 201 | 2,677 | 6.920398 | 0.40796 | 0.362329 | 0.155284 | 0.207045 | 0.226456 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022989 | 0.31752 | 2,677 | 60 | 115 | 44.616667 | 0.738369 | 0.01681 | 0 | 0 | 1 | 0 | 0.128517 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.037736 | 0.018868 | 0 | 0.09434 | 0.018868 | 0 | 0 | 0 | null | 1 | 0 | 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 |
eb61d97f58614f8c6747182079791a3edd418075 | 566 | py | Python | sherlock/codelib/system_function/implements.py | Luavis/sherlock.py | 6974244c5ddb2f5e41aea2fbc7f913917fd15532 | [
"MIT"
] | 55 | 2017-02-12T08:22:44.000Z | 2022-01-08T12:34:53.000Z | sherlock/codelib/system_function/implements.py | Ronlin1/sherlock.py | 6974244c5ddb2f5e41aea2fbc7f913917fd15532 | [
"MIT"
] | 3 | 2017-02-24T16:23:40.000Z | 2022-02-05T19:54:26.000Z | sherlock/codelib/system_function/implements.py | Ronlin1/sherlock.py | 6974244c5ddb2f5e41aea2fbc7f913917fd15532 | [
"MIT"
] | 7 | 2017-01-17T17:34:59.000Z | 2022-02-15T15:23:17.000Z | import ast
from sherlock.codelib.analyzer.variable import Type
from sherlock.codelib.system_function import system_function
@system_function('range', Type.LIST, Type.NUMBER, Type.NUMBER)
def system_range(g, start, end):
return '$(seq %s $(( %s - 1 )))' % (g.dispatch(start), g.dispatch(end))
@system_function('print', Type.VOID, Type.ANY)
def system_print(g, msg):
return 'echo %s' % g.dispatch(msg)
@system_function('pipe', Type.VOID, Type.ANY, Type.ANY)
def system_pipe(g, before, after):
return '%s | %s' % (g.dispatch(before), g.dispatch(after))
| 33.294118 | 75 | 0.706714 | 85 | 566 | 4.611765 | 0.352941 | 0.178571 | 0.096939 | 0.076531 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00202 | 0.125442 | 566 | 16 | 76 | 35.375 | 0.789899 | 0 | 0 | 0 | 0 | 0 | 0.090106 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 0.75 | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
eb6591f825c57a68f6992dbbedf4b1b854a25935 | 153 | py | Python | book_store/book_outlet/apps.py | goulartdev/udemy-django-course | f39ab36aacdf47d19f8c286c317cc54d8358dadc | [
"MIT"
] | null | null | null | book_store/book_outlet/apps.py | goulartdev/udemy-django-course | f39ab36aacdf47d19f8c286c317cc54d8358dadc | [
"MIT"
] | null | null | null | book_store/book_outlet/apps.py | goulartdev/udemy-django-course | f39ab36aacdf47d19f8c286c317cc54d8358dadc | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class BookOutletConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'book_outlet'
| 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 |
eb70f9263d22391becf954191090f791229ce937 | 209 | py | Python | byq_trial/__init__.py | huandzh/byq_trial | e0bede817654e17b48e8387ce1f6afce505e4602 | [
"MIT"
] | null | null | null | byq_trial/__init__.py | huandzh/byq_trial | e0bede817654e17b48e8387ce1f6afce505e4602 | [
"MIT"
] | 1 | 2018-05-15T09:41:18.000Z | 2018-05-15T09:44:49.000Z | byq_trial/__init__.py | huandzh/byq_trial | e0bede817654e17b48e8387ce1f6afce505e4602 | [
"MIT"
] | null | null | null | #! -*- coding:utf-8 -*-
"""Shortcuts for yuqing trials
.. moduleauthor:: Huan Di <hd@iamhd.top>
"""
from byq_trial.auth import SimpleAuth
from byq_trial.call import APICall
__all__ = [SimpleAuth, APICall]
| 17.416667 | 40 | 0.712919 | 28 | 209 | 5.107143 | 0.785714 | 0.097902 | 0.167832 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005587 | 0.143541 | 209 | 11 | 41 | 19 | 0.793296 | 0.440191 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
eb81a639415e736f223f1c5d8de1dac03d696391 | 131 | py | Python | tests/test_a.py | keik/sandbox-python-structure | 8a112b68ad6f42fdc2736553c4914e7ab59462fc | [
"MIT"
] | 1 | 2016-08-15T08:19:43.000Z | 2016-08-15T08:19:43.000Z | tests/test_a.py | keik/sandbox-python-structure | 8a112b68ad6f42fdc2736553c4914e7ab59462fc | [
"MIT"
] | null | null | null | tests/test_a.py | keik/sandbox-python-structure | 8a112b68ad6f42fdc2736553c4914e7ab59462fc | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from sandbox_python_structure import f
def test_parse_no_subarg():
ret = f()
assert ret == 'hi'
| 14.555556 | 38 | 0.633588 | 19 | 131 | 4.105263 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009804 | 0.221374 | 131 | 8 | 39 | 16.375 | 0.754902 | 0.160305 | 0 | 0 | 0 | 0 | 0.018519 | 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 |
eb8c8d68ae724529208f6f7e11037b7998a2407e | 48 | py | Python | nsq/version.py | virtuald/pynsq | 40a637b02c28edfb7723373b81f7e7b9d5e364ed | [
"MIT"
] | null | null | null | nsq/version.py | virtuald/pynsq | 40a637b02c28edfb7723373b81f7e7b9d5e364ed | [
"MIT"
] | null | null | null | nsq/version.py | virtuald/pynsq | 40a637b02c28edfb7723373b81f7e7b9d5e364ed | [
"MIT"
] | null | null | null | # also update in setup.py
__version__ = '0.6.9'
| 16 | 25 | 0.6875 | 9 | 48 | 3.222222 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075 | 0.166667 | 48 | 2 | 26 | 24 | 0.65 | 0.479167 | 0 | 0 | 0 | 0 | 0.217391 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.