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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
406ae0237fa650007fb4d1f31a942b053762212b | 962 | py | Python | application/model/entity/category.py | UniversidadeDeVassouras/labproghiper-2020.1-MatheusTelles-p1 | d0d81fc82d031f7add9e38add765aad0c404ee35 | [
"Apache-2.0"
] | 1 | 2020-07-15T14:23:30.000Z | 2020-07-15T14:23:30.000Z | application/model/entity/category.py | UniversidadeDeVassouras/labproghiper-2020.1-MatheusTelles-p1 | d0d81fc82d031f7add9e38add765aad0c404ee35 | [
"Apache-2.0"
] | null | null | null | application/model/entity/category.py | UniversidadeDeVassouras/labproghiper-2020.1-MatheusTelles-p1 | d0d81fc82d031f7add9e38add765aad0c404ee35 | [
"Apache-2.0"
] | null | null | null | from flask import current_app
class Category:
def __init__(self, id, name, description, thumb):
self._id = id
self._name = name
self._description = description
def setId(self, id):
self._id = id
def getId(self):
return self._id
def setName(self, name):
self._name = name
def getName(self):
return self._name
def setDescription(self, description):
self._description = description
def getDescription(self):
return self._description
def setThumb(self, thumb):
self._thumb = thumb
def getThumb(self):
return self._thumb
def get_video_category_id (self):
videos = current_app.config ['videos']
videos_category = []
for i, video in enumerate (videos.get_video_list()):
if video.getCategory_id () == self.getId():
videos_category.append (video)
return videos_category | 24.666667 | 60 | 0.613306 | 110 | 962 | 5.127273 | 0.318182 | 0.053191 | 0.099291 | 0.102837 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.298337 | 962 | 39 | 61 | 24.666667 | 0.835556 | 0 | 0 | 0.206897 | 0 | 0 | 0.006231 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.344828 | false | 0 | 0.034483 | 0.137931 | 0.586207 | 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 |
4073fadf1987f151aaa0076f63a670fabd02b58e | 226 | py | Python | setup.py | vwxyzjn/pysc2gym | 7c43e55a8f48be77f53332b73fda7635e6063589 | [
"MIT"
] | 6 | 2020-09-23T21:31:48.000Z | 2022-03-14T23:59:35.000Z | setup.py | vwxyzjn/pysc2gym | 7c43e55a8f48be77f53332b73fda7635e6063589 | [
"MIT"
] | 2 | 2022-01-13T03:48:47.000Z | 2022-03-12T00:58:26.000Z | setup.py | vwxyzjn/pysc2gym | 7c43e55a8f48be77f53332b73fda7635e6063589 | [
"MIT"
] | 1 | 2021-06-28T14:17:11.000Z | 2021-06-28T14:17:11.000Z | from setuptools import setup
import versioneer
setup(name='gym_pysc2',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
install_requires=['gym'] # And any other dependencies foo needs
) | 28.25 | 70 | 0.738938 | 27 | 226 | 6.037037 | 0.703704 | 0.159509 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005291 | 0.163717 | 226 | 8 | 71 | 28.25 | 0.857143 | 0.159292 | 0 | 0 | 0 | 0 | 0.063492 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 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 |
407fa3643267388dca73bf3b3496b61a0c5f9491 | 314 | py | Python | exercicio3.py | DrokaGit/-infosatc-lp-avaliativo-02 | 6bb78ce84ac325c866201ff538f426d6e7a72ab5 | [
"MIT"
] | null | null | null | exercicio3.py | DrokaGit/-infosatc-lp-avaliativo-02 | 6bb78ce84ac325c866201ff538f426d6e7a72ab5 | [
"MIT"
] | null | null | null | exercicio3.py | DrokaGit/-infosatc-lp-avaliativo-02 | 6bb78ce84ac325c866201ff538f426d6e7a72ab5 | [
"MIT"
] | null | null | null | nume1 = int(input("Digite um numero"))
nume2 = int(input("Digite um numero"))
nume3 = int(input("Digite um numero"))
nume4 = int(input("Digite um numero"))
nume5 = int(input("Digite um numero"))
table = [nume1,nume2,nume3,nume4,nume5]
tableM = (float((nume1 + nume2 + nume3 + nume4 + nume5)))
print(float(tableM)) | 34.888889 | 57 | 0.691083 | 46 | 314 | 4.717391 | 0.304348 | 0.184332 | 0.322581 | 0.368664 | 0.737327 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054745 | 0.127389 | 314 | 9 | 58 | 34.888889 | 0.737226 | 0 | 0 | 0 | 0 | 0 | 0.253968 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4084a9455c8745ebe8cdb17a3177996a15d02016 | 210 | py | Python | src/models/configs/database.py | Nardri/rbac-service | c5cf6baf60e95a7790156c85e37c76c697efd585 | [
"MIT"
] | null | null | null | src/models/configs/database.py | Nardri/rbac-service | c5cf6baf60e95a7790156c85e37c76c697efd585 | [
"MIT"
] | null | null | null | src/models/configs/database.py | Nardri/rbac-service | c5cf6baf60e95a7790156c85e37c76c697efd585 | [
"MIT"
] | null | null | null | """Database setup"""
# Third party library
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
# initialization of the database and migration
database = SQLAlchemy()
migrate = Migrate()
| 21 | 46 | 0.795238 | 25 | 210 | 6.6 | 0.6 | 0.109091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138095 | 210 | 9 | 47 | 23.333333 | 0.911602 | 0.380952 | 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 |
40a15dfaa12f9d16539bfd378e8a390a22b70eb7 | 529 | py | Python | project/manage.py | yosukesuzuki/let-me-notify | 39f50214403822712329c1cd953167d6e9b315d6 | [
"MIT"
] | null | null | null | project/manage.py | yosukesuzuki/let-me-notify | 39f50214403822712329c1cd953167d6e9b315d6 | [
"MIT"
] | null | null | null | project/manage.py | yosukesuzuki/let-me-notify | 39f50214403822712329c1cd953167d6e9b315d6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Kay management script.
:Copyright: (c) 2009 Accense Technology, Inc. All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import sys
import os
import logging
sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path
import kay
kay.setup_env(manage_py_env=True)
from werkzeug import script
from kay.management import *
import appengine_config
if __name__ == '__main__':
if len(sys.argv) == 1:
sys.argv.append("--help")
script.run()
| 19.592593 | 66 | 0.701323 | 77 | 529 | 4.61039 | 0.649351 | 0.073239 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013483 | 0.15879 | 529 | 26 | 67 | 20.346154 | 0.78427 | 0.336484 | 0 | 0 | 0 | 0 | 0.040936 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.538462 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
40d397efdfc75b4459bce3aac322fa920256a163 | 2,956 | py | Python | python/learn/PythonDataVisualizationCookbookSE_Code/Chapter 07/ch07_rec08_scatterplot.py | flyingwjw/Documentation | 567608f388ca369b864c2d75a94647801b5dfa1e | [
"Unlicense"
] | null | null | null | python/learn/PythonDataVisualizationCookbookSE_Code/Chapter 07/ch07_rec08_scatterplot.py | flyingwjw/Documentation | 567608f388ca369b864c2d75a94647801b5dfa1e | [
"Unlicense"
] | null | null | null | python/learn/PythonDataVisualizationCookbookSE_Code/Chapter 07/ch07_rec08_scatterplot.py | flyingwjw/Documentation | 567608f388ca369b864c2d75a94647801b5dfa1e | [
"Unlicense"
] | 2 | 2020-09-22T18:37:46.000Z | 2021-09-02T11:02:59.000Z | import matplotlib.pyplot as plt
import numpy as np
# daily search trend for keyword 'flowers' for a year
d = [
1.04, 1.04, 1.16, 1.22, 1.46, 2.34, 1.16, 1.12, 1.24, 1.30, 1.44, 1.22, 1.26,
1.34, 1.26, 1.40, 1.52, 2.56, 1.36, 1.30, 1.20, 1.12, 1.12, 1.12, 1.06, 1.06,
1.00, 1.02, 1.04, 1.02, 1.06, 1.02, 1.04, 0.98, 0.98, 0.98, 1.00, 1.02, 1.02,
1.00, 1.02, 0.96, 0.94, 0.94, 0.94, 0.96, 0.86, 0.92, 0.98, 1.08, 1.04, 0.74,
0.98, 1.02, 1.02, 1.12, 1.34, 2.02, 1.68, 1.12, 1.38, 1.14, 1.16, 1.22, 1.10,
1.14, 1.16, 1.28, 1.44, 2.58, 1.30, 1.20, 1.16, 1.06, 1.06, 1.08, 1.00, 1.00,
0.92, 1.00, 1.02, 1.00, 1.06, 1.10, 1.14, 1.08, 1.00, 1.04, 1.10, 1.06, 1.06,
1.06, 1.02, 1.04, 0.96, 0.96, 0.96, 0.92, 0.84, 0.88, 0.90, 1.00, 1.08, 0.80,
0.90, 0.98, 1.00, 1.10, 1.24, 1.66, 1.94, 1.02, 1.06, 1.08, 1.10, 1.30, 1.10,
1.12, 1.20, 1.16, 1.26, 1.42, 2.18, 1.26, 1.06, 1.00, 1.04, 1.00, 0.98, 0.94,
0.88, 0.98, 0.96, 0.92, 0.94, 0.96, 0.96, 0.94, 0.90, 0.92, 0.96, 0.96, 0.96,
0.98, 0.90, 0.90, 0.88, 0.88, 0.88, 0.90, 0.78, 0.84, 0.86, 0.92, 1.00, 0.68,
0.82, 0.90, 0.88, 0.98, 1.08, 1.36, 2.04, 0.98, 0.96, 1.02, 1.20, 0.98, 1.00,
1.08, 0.98, 1.02, 1.14, 1.28, 2.04, 1.16, 1.04, 0.96, 0.98, 0.92, 0.86, 0.88,
0.82, 0.92, 0.90, 0.86, 0.84, 0.86, 0.90, 0.84, 0.82, 0.82, 0.86, 0.86, 0.84,
0.84, 0.82, 0.80, 0.78, 0.78, 0.76, 0.74, 0.68, 0.74, 0.80, 0.80, 0.90, 0.60,
0.72, 0.80, 0.82, 0.86, 0.94, 1.24, 1.92, 0.92, 1.12, 0.90, 0.90, 0.94, 0.90,
0.90, 0.94, 0.98, 1.08, 1.24, 2.04, 1.04, 0.94, 0.86, 0.86, 0.86, 0.82, 0.84,
0.76, 0.80, 0.80, 0.80, 0.78, 0.80, 0.82, 0.76, 0.76, 0.76, 0.76, 0.78, 0.78,
0.76, 0.76, 0.72, 0.74, 0.70, 0.68, 0.72, 0.70, 0.64, 0.70, 0.72, 0.74, 0.64,
0.62, 0.74, 0.80, 0.82, 0.88, 1.02, 1.66, 0.94, 0.94, 0.96, 1.00, 1.16, 1.02,
1.04, 1.06, 1.02, 1.10, 1.22, 1.94, 1.18, 1.12, 1.06, 1.06, 1.04, 1.02, 0.94,
0.94, 0.98, 0.96, 0.96, 0.98, 1.00, 0.96, 0.92, 0.90, 0.86, 0.82, 0.90, 0.84,
0.84, 0.82, 0.80, 0.80, 0.76, 0.80, 0.82, 0.80, 0.72, 0.72, 0.76, 0.80, 0.76,
0.70, 0.74, 0.82, 0.84, 0.88, 0.98, 1.44, 0.96, 0.88, 0.92, 1.08, 0.90, 0.92,
0.96, 0.94, 1.04, 1.08, 1.14, 1.66, 1.08, 0.96, 0.90, 0.86, 0.84, 0.86, 0.82,
0.84, 0.82, 0.84, 0.84, 0.84, 0.84, 0.82, 0.86, 0.82, 0.82, 0.86, 0.90, 0.84,
0.82, 0.78, 0.80, 0.78, 0.74, 0.78, 0.76, 0.76, 0.70, 0.72, 0.76, 0.72, 0.70,
0.64]
# Now let's generate random data for the same period
d1 = np.random.random(365)
assert len(d) == len(d1)
fig = plt.figure()
ax1 = fig.add_subplot(221)
ax1.scatter(d, d1, alpha=0.5)
ax1.set_title('No correlation')
ax1.grid(True)
ax2 = fig.add_subplot(222)
ax2.scatter(d1, d1, alpha=0.5)
ax2.set_title('Ideal positive correlation')
ax2.grid(True)
ax3 = fig.add_subplot(223)
ax3.scatter(d1, d1*-1, alpha=0.5)
ax3.set_title('Ideal negative correlation')
ax3.grid(True)
ax4 = fig.add_subplot(224)
ax4.scatter(d1, d1+d, alpha=0.5)
ax4.set_title('Non ideal positive correlation')
ax4.grid(True)
plt.tight_layout()
plt.show() | 46.1875 | 78 | 0.552436 | 863 | 2,956 | 1.881808 | 0.122827 | 0.036946 | 0.046798 | 0.022167 | 0.479064 | 0.194581 | 0.16564 | 0.045567 | 0.045567 | 0 | 0 | 0.46297 | 0.164073 | 2,956 | 64 | 79 | 46.1875 | 0.194253 | 0.034506 | 0 | 0 | 0 | 0 | 0.033661 | 0 | 0 | 0 | 0 | 0 | 0.018868 | 1 | 0 | false | 0 | 0.037736 | 0 | 0.037736 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
40d82abf6ddc30ada008f9205fa131b2828d8ba2 | 2,569 | py | Python | src/GenericTsvReader.py | getzlab/ABSOLUTE | cd443ec9370df98778d98227bb9a11c3e24c00cb | [
"BSD-3-Clause"
] | null | null | null | src/GenericTsvReader.py | getzlab/ABSOLUTE | cd443ec9370df98778d98227bb9a11c3e24c00cb | [
"BSD-3-Clause"
] | null | null | null | src/GenericTsvReader.py | getzlab/ABSOLUTE | cd443ec9370df98778d98227bb9a11c3e24c00cb | [
"BSD-3-Clause"
] | null | null | null | """
Created on Jul 5, 2012
@author: lichtens
"""
import csv
import os
class GenericTsvReader(object):
"""
Read a TSV file.
This class wraps a DictReader, but handles comments, which are not handled gracefully in the python csv library.
The next() method assumes user is interested in the content, not the comments.
Get the comments using getComments or getCommentsAsList. The latter assumes each comment is a line of text.
Notes:
IMPORTANT: At this time, this class does not support comments below the header line.
This class will load all comment lines into RAM at one time. This could theoretically cause a bottleneck in some files.
"""
def __init__(self, filename, commentPrepend='#', fieldNames=None, delimiter='\t'):
"""
Constructor
"""
self.__dict__.update(locals())
self.inputContentFP = open(filename, 'r')
self.commentLines = ''
self.commentPrepend = commentPrepend
# The comment lines must be loaded before the dict reader is initialized.
self._loadCommentLines()
self.dictReader = csv.DictReader(self.inputContentFP, delimiter=delimiter, fieldnames=fieldNames)
def _loadCommentLines(self):
resetLocation = self.inputContentFP.tell()
nextChar = self.inputContentFP.read(1)
# Get rid of blank lines
while nextChar in ['\n', '\r']:
resetLocation = self.inputContentFP.tell()
nextChar = self.inputContentFP.read(1)
while nextChar == self.commentPrepend:
self.commentLines = self.commentLines + (self.commentPrepend + self.inputContentFP.readline())
resetLocation = self.inputContentFP.tell()
nextChar = self.inputContentFP.read(1)
# Go back one character to make sure that we have moved the file pointer to the
# beginning of the first non-comment line.
self.inputContentFP.seek(resetLocation, os.SEEK_SET)
# python3 needs __next__ instead of next
def __next__(self):
return self.dictReader.__next__()
def getFieldNames(self):
return self.dictReader.fieldnames
def getComments(self):
return self.commentLines
def getCommentsAsList(self):
""" Return each comment line as an entry in a list """
return self.commentLines.strip().split('\n')
def getInputContentFP(self):
return self.inputContentFP
def __iter__(self):
return self | 33.802632 | 124 | 0.652005 | 289 | 2,569 | 5.702422 | 0.460208 | 0.120146 | 0.042476 | 0.063714 | 0.120146 | 0.120146 | 0.120146 | 0.120146 | 0.120146 | 0 | 0 | 0.004792 | 0.268976 | 2,569 | 76 | 125 | 33.802632 | 0.872737 | 0.351499 | 0 | 0.181818 | 0 | 0 | 0.006353 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.242424 | false | 0 | 0.060606 | 0.151515 | 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 |
40e0c14f05e9b921525413c2427c2d6661b5419f | 865 | py | Python | app/migrations/0001_initial.py | MariaAlice00/ifpi-tds-projeto-integrador | e2ce73279c9bf31de0b33b105723ae7a24deac54 | [
"MIT"
] | null | null | null | app/migrations/0001_initial.py | MariaAlice00/ifpi-tds-projeto-integrador | e2ce73279c9bf31de0b33b105723ae7a24deac54 | [
"MIT"
] | null | null | null | app/migrations/0001_initial.py | MariaAlice00/ifpi-tds-projeto-integrador | e2ce73279c9bf31de0b33b105723ae7a24deac54 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.3 on 2021-06-03 00:35
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Livro',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('imagem', models.ImageField(upload_to='imagens')),
('titulo', models.CharField(max_length=150)),
('autor', models.CharField(max_length=50)),
('genero', models.CharField(max_length=50)),
('serieunico', models.CharField(max_length=50)),
('nota', models.CharField(max_length=2)),
('opiniao', models.CharField(max_length=300)),
],
),
]
| 30.892857 | 117 | 0.564162 | 87 | 865 | 5.494253 | 0.597701 | 0.188285 | 0.225941 | 0.301255 | 0.16318 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045977 | 0.295954 | 865 | 27 | 118 | 32.037037 | 0.738916 | 0.052023 | 0 | 0 | 1 | 0 | 0.07335 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.05 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
40f50e67874d55319f2743b79ff2d604900796f7 | 224 | py | Python | test.py | Naveenkhasyap/udacity-ml | 6df851f7b21dee120a8e8f246df7961ea065eeac | [
"MIT"
] | null | null | null | test.py | Naveenkhasyap/udacity-ml | 6df851f7b21dee120a8e8f246df7961ea065eeac | [
"MIT"
] | null | null | null | test.py | Naveenkhasyap/udacity-ml | 6df851f7b21dee120a8e8f246df7961ea065eeac | [
"MIT"
] | null | null | null | how_many_snakes = 1
snake_string = """
Welcome to Python3!
____
/ . .\\
\\ ---<
\\ /
__________/ /
-=:___________/
<3, Juno
"""
print(snake_string * how_many_snakes) | 14 | 37 | 0.473214 | 17 | 224 | 4.411765 | 0.705882 | 0.186667 | 0.346667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021429 | 0.375 | 224 | 16 | 37 | 14 | 0.514286 | 0 | 0 | 0 | 0 | 0 | 0.635556 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dc00b897bcfec50069749b3f13a2b807436fbaab | 904 | py | Python | src/entities/users.py | MillaKelhu/ohtu-lukuvinkkikirjasto | d195e53824bc5d13ded97112a8c388e05775666c | [
"MIT"
] | null | null | null | src/entities/users.py | MillaKelhu/ohtu-lukuvinkkikirjasto | d195e53824bc5d13ded97112a8c388e05775666c | [
"MIT"
] | null | null | null | src/entities/users.py | MillaKelhu/ohtu-lukuvinkkikirjasto | d195e53824bc5d13ded97112a8c388e05775666c | [
"MIT"
] | null | null | null | from flask_login import UserMixin
class Users(UserMixin):
# Luodaan näennäinen tietokanta käyttäjistä
user_database = {"kayttaja": ("kayttaja", "salasana"),
"tunnus": ("tunnus", "passu")}
def __init__(self, id, username, password):
self.id = id
self.username = username
self.password = password
def get_username(self):
return self.username
@classmethod
def get_password(cls, username):
username, password = cls.user_database.get(username)
return password
@classmethod
def get_username(cls, username):
username, password = cls.user_database.get(username)
return username
def is_active(self):
return True
def get_id(self):
return self.id
def roles(self):
return ["ADMIN", "USER"]
@classmethod
def get(cls, id):
return cls.user_database.get(id)
| 23.179487 | 60 | 0.634956 | 102 | 904 | 5.490196 | 0.313725 | 0.053571 | 0.091071 | 0.096429 | 0.210714 | 0.210714 | 0.210714 | 0.210714 | 0.210714 | 0.210714 | 0 | 0 | 0.263274 | 904 | 38 | 61 | 23.789474 | 0.840841 | 0.045354 | 0 | 0.185185 | 0 | 0 | 0.05814 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0.259259 | 0.037037 | 0.185185 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
dc05bab78000f85994987b7714d00eddf5ea82d2 | 439 | py | Python | design-patterns-101/Animal.py | stealthanthrax/python-design-patterns | 100884e1c5fe0fedaa0f1afa978ae79e53878f6b | [
"MIT"
] | null | null | null | design-patterns-101/Animal.py | stealthanthrax/python-design-patterns | 100884e1c5fe0fedaa0f1afa978ae79e53878f6b | [
"MIT"
] | 4 | 2020-10-01T15:56:00.000Z | 2020-10-08T12:34:17.000Z | design-patterns-101/Animal.py | stealthanthrax/python-design-patterns | 100884e1c5fe0fedaa0f1afa978ae79e53878f6b | [
"MIT"
] | 2 | 2020-10-02T06:50:34.000Z | 2020-10-02T10:17:25.000Z | class Animal:
def __init__(self):
self.name = ""
self.weight = 0
self.sound = ""
def setName(self, name):
self.name = name
def getName(self):
return self.name
def setWeight(self, weight):
self.weight = weight
def getWeight(self):
return self.weight
def setSound(self, sound):
self.sound = sound
def getSound(self):
return self.sound
| 18.291667 | 32 | 0.560364 | 51 | 439 | 4.745098 | 0.313725 | 0.132231 | 0.173554 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003448 | 0.339408 | 439 | 23 | 33 | 19.086957 | 0.831034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.411765 | false | 0 | 0 | 0.176471 | 0.647059 | 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 |
90633c1edf956b4cbfebb1310e68eb561ac6fc3b | 87 | py | Python | Scripts/PyLecTest.py | DVecchione/DVEC | 8788310acefe948c1c40b2ecfd781b0af7027993 | [
"MIT"
] | null | null | null | Scripts/PyLecTest.py | DVecchione/DVEC | 8788310acefe948c1c40b2ecfd781b0af7027993 | [
"MIT"
] | null | null | null | Scripts/PyLecTest.py | DVecchione/DVEC | 8788310acefe948c1c40b2ecfd781b0af7027993 | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
import numpy as np
x=20
y=1
plt.plot(x,y)
plt.show()
| 9.666667 | 31 | 0.724138 | 19 | 87 | 3.315789 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041096 | 0.16092 | 87 | 8 | 32 | 10.875 | 0.821918 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
9068b9974dcf2fb879760cc992a13d9cece6f426 | 43 | py | Python | tools/python/myriad/__init__.py | TU-Berlin-DIMA/myriad-toolkit | 5f7610e10b11e05591d6e2dc030c3ca5dc2a90b4 | [
"BSL-1.0"
] | 15 | 2015-01-18T18:02:16.000Z | 2021-08-02T09:20:35.000Z | tools/python/myriad/__init__.py | TU-Berlin-DIMA/myriad-toolkit | 5f7610e10b11e05591d6e2dc030c3ca5dc2a90b4 | [
"BSL-1.0"
] | null | null | null | tools/python/myriad/__init__.py | TU-Berlin-DIMA/myriad-toolkit | 5f7610e10b11e05591d6e2dc030c3ca5dc2a90b4 | [
"BSL-1.0"
] | 5 | 2015-08-10T21:50:39.000Z | 2018-03-14T15:31:28.000Z | __all__ = [ "assistant", "event", "error" ] | 43 | 43 | 0.604651 | 4 | 43 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139535 | 43 | 1 | 43 | 43 | 0.594595 | 0 | 0 | 0 | 0 | 0 | 0.431818 | 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 |
907b2f51dc7dc8191cd5bf95004855d172a84d81 | 15,373 | py | Python | k1lib/selector.py | 157239n/k1lib | 285520b8364ad5b21cb736b44471aa939e692e9b | [
"MIT"
] | 1 | 2021-08-11T19:10:08.000Z | 2021-08-11T19:10:08.000Z | k1lib/selector.py | 157239n/k1lib | 285520b8364ad5b21cb736b44471aa939e692e9b | [
"MIT"
] | null | null | null | k1lib/selector.py | 157239n/k1lib | 285520b8364ad5b21cb736b44471aa939e692e9b | [
"MIT"
] | null | null | null | # AUTOGENERATED FILE! PLEASE DON'T EDIT
"""
This module is for selecting a subnetwork using CSS so that you can do special
things to them. Checkout the tutorial section for a walkthrough. This is exposed
automatically with::
from k1lib.imports import *
selector.select # exposed
"""
from torch import nn; import k1lib, re, torch
from typing import List, Tuple, Dict, Union, Any, Iterator, Callable
from contextlib import contextmanager; from functools import partial
__all__ = ["ModuleSelector", "preprocess", "select"]
def preprocess(selectors:str, defaultProp="*") -> List[str]:
r"""Removes all quirkly features allowed by the css
language, and outputs nice lines. Example::
# returns ["a:f", "a:g,h", "b:g,h", "t:*"]
selector.preprocess("a:f; a, b: g,h; t")
:param selectors: single css selector string. Statements separated
by "\\n" or ";"
:param defaultProp: default property, if statement doesn't have one"""
# filtering unwanted characters and quirky spaces
lines = [e for l in selectors.split("\n") for e in l.split(";")]
selectors = [re.sub("(^\s+)|(\s+$)", "", re.sub("\s\s+", " ", line)).replace(" >", ">").replace("> ", ">").replace(" :", ":").replace(": ", ":").replace(" ,", ",").replace(", ", ",").replace(";", "\n").replace(" \n", "\n").replace("\n ", "\n") for line in lines if line != ""]
# adding "*" to all selectors with no props specified
selectors = [selector if ":" in selector else f"{selector}:{defaultProp}" for selector in selectors]
# expanding comma-delimited selectors
return [f"{segment}:{selector.split(':')[1]}" for selector in selectors for segment in selector.split(":")[0].split(",")]
def _getParts(s:str): return [a for elem in s.split(":")[0].split(">") if elem for a in elem.split(" ") if a]
def _getProps(s:str): return [elem for elem in s.split(":")[1].split(",") if elem]
_idxAuto = k1lib.AutoIncrement()
class ModuleSelector: # empty methods so that Sphinx generates the docs in order
props:List[str]
"""Properties of this :class:`ModuleSelector`"""
idx:int
"""Unique id of this :class:`ModuleSelector` in the entire script. May be useful
for module recognition"""
nn:"torch.nn.Module"
"""The associated :class:`torch.nn.Module` of this :class:`ModuleSelector`"""
def __init__(self, parent:"ModuleSelector", name:str, nn:"torch.nn.Module"):
self.parent = parent; self.name = name; self.nn = nn
self._children:Dict["ModuleSelector"] = {}
self.props:List[str] = []; self.depth:int = 0
self.directSelectors:List[str] = []
self.indirectSelectors:List[str] = []
self.displayF:Callable[["ModuleSelector"], str] = lambda mS: ', '.join(mS.props)
self.idx = _idxAuto()
def deepestDepth(self): pass
def highlight(self, prop:str):
"""Highlights the specified prop when displaying the object."""
self.displayF = lambda self: (k1lib.fmt.txt.red if prop in self else k1lib.fmt.txt.identity)(', '.join(self.props))
return self
def __call__(self, *args, **kwargs):
"""Calls the internal :class:`torch.nn.Module`"""
return self.nn(*args, **kwargs)
def __contains__(self): pass
def named_children(self): pass
def children(self): pass
def named_modules(self): pass
def modules(self): pass
def directParams(self): pass
def parse(self): pass
def apply(self): pass
def clearProps(self): pass
@property
def displayF(self):
"""Function to display each ModuleSelector's lines.
Default is just::
lambda mS: ", ".join(mS.props) """
return self._displayF
@displayF.setter
def displayF(self, f):
def applyF(self): self._displayF = f
self.apply(applyF)
def __getattr__(self, attr):
if attr.startswith("_"): raise AttributeError(attr)
if attr in self._children: return self._children[attr]
return self.directParams[attr]
def __getitem__(self, idx): return getattr(self, str(idx))
@staticmethod
def sample() -> "ModuleSelector":
"""Create a new example :class:`ModuleSelector` that has a bit of
hierarchy to them, with no css."""
return nn.Sequential(nn.Linear(3, 4), nn.Sequential(nn.Conv2d(3, 8, 3, 2), nn.ReLU(), nn.Linear(5, 6)), nn.Linear(7, 8)).select("")
def hookF(self): pass
def hookFp(self): pass
def hookB(self): pass
def freeze(self): pass
def unfreeze(self): pass
@k1lib.patch(nn.Module)
def select(model:"torch.nn.Module", css:str="*") -> "k1lib.selector.ModuleSelector":
"""Creates a new ModuleSelector, in sync with a model.
Example::
mS = selector.select(nn.Linear(3, 4), "#root:propA")
Or, you can do it the more direct way::
mS = nn.Linear(3, 4).select("#root:propA")
:param model: the :class:`torch.nn.Module` object to select from
:param css: the css selectors"""
root = ModuleSelector(None, "root", model)
root.parse(preprocess(css)); return root
@k1lib.patch(ModuleSelector, name="apply")
def _apply(self, f:Callable[[ModuleSelector], None]):
"""Applies a function to self and all child :class:`ModuleSelector`"""
f(self)
for child in self._children.values(): child.apply(f)
@k1lib.patch(ModuleSelector, name="parse")
def _parse(self, selectors:Union[List[str], str]) -> ModuleSelector:
"""Parses extra selectors. Clears all old selectors, but retain
the props. Returns self. Example::
mS = selector.ModuleSelector.sample().parse("Conv2d:propA")
# returns True
"propA" in mS[1][0]
:param selectors: can be the preprocessed list, or the unprocessed css string"""
if isinstance(selectors, str): selectors = preprocess(selectors)
self.directSelectors = []; self.indirectSelectors = []
ogSelectors = selectors
if self.parent != None:
selectors = [] + selectors + self.parent.indirectSelectors + self.parent.directSelectors
self.indirectSelectors += self.parent.indirectSelectors
self.depth = self.parent.depth + 1
for selector in selectors:
parts = _getParts(selector)
matches = parts[0] == self.nn.__class__.__name__ or parts[0] == "#" + self.name or parts[0] == "*"
if len(parts) == 1:
if matches: self.props += _getProps(selector)
else:
a = selector.find(">"); a = a if a > 0 else float("inf")
b = selector.find(" "); b = b if b > 0 else float("inf")
direct = a < b
if matches:
if direct: self.directSelectors.append(selector[a+1:])
else: self.indirectSelectors.append(selector[b+1:])
for name, mod in self.nn.named_children():
if name not in self._children:
self._children[name] = ModuleSelector(self, name, mod)
self._children[name].parse(ogSelectors)
self.props = list(set(self.props)); return self
@k1lib.patch(ModuleSelector)
def __contains__(self, prop:str=None) -> bool:
"""Whether this :class:`ModuleSelector` has a specific prop.
Example::
# returns True
"b" in nn.Linear(3, 4).select("*:b")
# returns False
"h" in nn.Linear(3, 4).select("*:b")
# returns True, "*" here means the ModuleSelector has any properties at all
"*" in nn.Linear(3, 4).select("*:b")"""
if "*" in self.props: return True
if prop in self.props: return True
if prop == "*" and len(self.props) > 0: return True
return False
@k1lib.patch(ModuleSelector)
def named_children(self, prop:str=None) -> Iterator[Tuple[str, ModuleSelector]]:
"""Get all named direct childs.
:param prop: Filter property. See also: :meth:`__contains__`"""
if prop is None: return self._children.items()
return ((k, v) for k, v in self._children.items() if prop in v)
@k1lib.patch(ModuleSelector)
def children(self, prop:str=None) -> Iterator[ModuleSelector]:
"""Get all direct childs.
:param prop: Filter property. See also: :meth:`__contains__`"""
return (x for _, x in self.named_children(prop))
@k1lib.patch(ModuleSelector, "directParams")
@property
def directParams(self) -> Dict[str, nn.Parameter]:
"""Dict params directly under this module"""
return {name: param for name, param in self.nn.named_parameters() if "." not in name}
@k1lib.patch(ModuleSelector)
def named_modules(self, prop:str=None) -> Iterator[Tuple[str, ModuleSelector]]:
"""Get all named child recursively.
Example::
modules = list(nn.Sequential(nn.Linear(3, 4), nn.ReLU()).select().named_modules())
# return 3
len(modules)
# return tuple ('0', <ModuleSelector of Linear>)
modules[1]
:param prop: Filter property. See also: :meth:`__contains__`"""
if prop != None:
yield from ((name, m) for name, m in self.named_modules() if prop in m)
return
yield self.name, self
for child in self._children.values(): yield from child.named_modules()
@k1lib.patch(ModuleSelector)
def modules(self, prop:str=None) -> Iterator[ModuleSelector]:
"""Get all child recursively.
:param prop: Filter property. See also: :meth:`__contains__`"""
for name, x in self.named_modules(prop): yield x
@k1lib.patch(ModuleSelector)
def clearProps(self) -> "ModuleSelector":
"""Clears all existing props of this and all descendants
:class:`ModuleSelector`. Example::
# returns False
"b" in nn.Linear(3, 4).select("*:b").clearProps()"""
def applyF(self): self.props = []
self.apply(applyF); return self
@k1lib.patch(ModuleSelector, name="deepestDepth")
@property
def deepestDepth(self):
"""Deepest depth of the tree. If self doesn't
have any child, then depth is 0"""
if len(self._children) == 0: return 0
return 1 + max([child.deepestDepth for child in self._children.values()])
@k1lib.patch(ModuleSelector)
def __repr__(self, intro:bool=True, header:Union[str, Tuple[str]]="", footer="", tabs:int=None):
"""
:param intro: whether to include a nice header and footer info
:param header:
str: include a header that starts where `displayF` will start
Tuple[str, str]: first one in tree, second one in displayF section
:param footer: same thing with header, but at the end
:param header: include a header that starts where `displayF` will start
:param tabs: number of tabs at the beginning. Best to leave this empty
"""
if tabs == None: tabs = 5 + self.deepestDepth
answer = "ModuleSelector:\n" if intro else ""
if header:
h1, h2 = ("", header) if isinstance(header, str) else header
answer += h1.ljust(tabs*4, " ") + h2 + "\n"
answer += f"{self.name}: {self.nn.__class__.__name__}".ljust(tabs*4, " ")
answer += self.displayF(self) + ("\n" if len(self._children) > 0 else "")
answer += k1lib.tab("\n".join([child.__repr__(tabs=tabs-1, intro=False) for name, child in self._children.items()]))
if footer:
f1, f2 = ("", footer) if isinstance(footer, str) else footer
answer += "\n" + f1.ljust(tabs*4, " ") + f2
if intro: answer += f"""\n\nCan...
- mS.deepestDepth: get deepest depth possible
- mS.nn: get the underlying nn.Module object
- mS.apply(f): apply to self and all descendants
- "HookModule" in mS: whether this module has a specified prop
- mS.highlight(prop): highlights all modules with specified prop
- mS.parse([..., ...]): parses extra css
- mS.directParams: get Dict[str, nn.Parameter] that are directly under this module"""
return answer
def _strTensor(t): return "None" if t is None else f"{t.shape}"
def strTensorTuple(ts):
if len(ts) > 1:
shapes = "\n".join(f"- {_strTensor(t)}" for t in ts)
return f"tensors ({len(ts)} total) shapes:\n{shapes}"
else:
return f"tensor shape: {_strTensor(ts[0])}"
@k1lib.patch(ModuleSelector)
@contextmanager
def hookF(self, f:Callable[[ModuleSelector, "torch.nn.Module", Tuple[torch.Tensor], torch.Tensor], None]=None, prop:str="*"):
"""Context manager for applying forward hooks.
Example::
def f(mS, m, i, o):
print(i, o)
m = nn.Linear(3, 4)
with m.select().hookF(f):
m(torch.randn(2, 3))
:param f: hook callback, should accept :class:`ModuleSelector`, inputs and output
:param prop: filter property of module to hook onto. If not specified, then it will print out input and output tensor shapes."""
if f is None: f = lambda mS, i, o: print(f"Forward hook {m}:\n" + k1lib.tab(f"Input {strTensorTuple(i)}\nOutput tensor shape: {o.shape}"))
g = lambda m, i, o: f(self, i, o)
handles = [m.nn.register_forward_hook(g) for m in self.modules(prop)]
try: yield
finally:
for h in handles: h.remove()
@k1lib.patch(ModuleSelector)
@contextmanager
def hookFp(self, f=None, prop:str="*"):
"""Context manager for applying forward pre hooks.
Example::
def f(mS, m, i):
print(i)
m = nn.Linear(3, 4)
with m.select().hookFp(f):
m(torch.randn(2, 3))
:param f: hook callback, should accept :class:`ModuleSelector` and inputs
:param prop: filter property of module to hook onto. If not specified, then it will print out input tensor shapes."""
if f is None: f = lambda mS, i: print(f"Forward pre hook {m}:\n" + k1lib.tab(f"Input {strTensorTuple(i)}"))
g = lambda m, i: f(self, i)
handles = [m.nn.register_forward_pre_hook(g) for m in self.modules(prop)]
try: yield
finally:
for h in handles: h.remove()
@k1lib.patch(ModuleSelector)
@contextmanager
def hookB(self, f=None, prop:str="*"):
"""Context manager for applying backward hooks.
Example::
def f(mS, m, i, o):
print(i, o)
m = nn.Linear(3, 4)
with m.select().hookB(f):
m(torch.randn(2, 3)).sum().backward()
:param f: hook callback, should accept :class:`ModuleSelector`, grad inputs and outputs
:param prop: filter property of module to hook onto. If not specified, then it will print out input tensor shapes."""
if f is None: f = lambda mS, i, o: print(f"Backward hook {m}:\n" + k1lib.tab(f"Input {strTensorTuple(i)}\nOutput {strTensorTuple(o)}"))
g = lambda m, i, o: f(self, i, o)
handles = [m.nn.register_full_backward_hook(g) for m in self.modules(prop)]
try: yield
finally:
for h in handles: h.remove()
from contextlib import ExitStack
@contextmanager
def _freeze(self, value:bool, prop:str):
modules = [m for m in self.modules(prop)]
with ExitStack() as stack:
for m in self.modules(prop):
stack.enter_context(m.nn.gradContext())
m.nn.requires_grad_(value)
try: yield
finally: pass
@k1lib.patch(ModuleSelector)
def freeze(self, prop:str="*"):
"""Returns a context manager that freezes (set requires_grad to False) parts of
the network. Example::
l = k1lib.Learner.sample()
w = l.model.lin1.lin.weight.clone() # weights before
with l.model.select("#lin1").freeze():
l.run(1)
# returns True
(l.model.lin1.lin.weight == w).all()"""
return _freeze(self, False, prop)
@k1lib.patch(ModuleSelector)
def unfreeze(self, prop:str="*"):
"""Returns a context manager that unfreezes (set requires_grad to True) parts of
the network. Example::
l = k1lib.Learner.sample()
w = l.model.lin1.lin.weight.clone() # weights before
with l.model.select("#lin1").freeze():
with l.model.select("#lin1 > #lin").unfreeze():
l.run(1)
# returns False
(l.model.lin1.lin.weight == w).all()"""
return _freeze(self, True, prop) | 43.426554 | 280 | 0.656866 | 2,170 | 15,373 | 4.596313 | 0.168664 | 0.012031 | 0.0385 | 0.011029 | 0.302386 | 0.253158 | 0.236816 | 0.216262 | 0.176559 | 0.155605 | 0 | 0.009362 | 0.194042 | 15,373 | 354 | 281 | 43.426554 | 0.795642 | 0.336824 | 0 | 0.163366 | 1 | 0 | 0.117137 | 0.017229 | 0 | 0 | 0 | 0 | 0 | 1 | 0.237624 | false | 0.079208 | 0.019802 | 0.019802 | 0.361386 | 0.014851 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
908535dac0f891e497250dce7197eb9409ed8be9 | 7,745 | py | Python | metadata-ingestion/tests/integration/azure_ad/test_azure_ad.py | zhoxie-cisco/datahub | 254a73e6ca9b1ec6002fcf013ed42cb6a754d1ad | [
"Apache-2.0"
] | 1 | 2021-11-16T03:45:33.000Z | 2021-11-16T03:45:33.000Z | metadata-ingestion/tests/integration/azure_ad/test_azure_ad.py | zhoxie-cisco/datahub | 254a73e6ca9b1ec6002fcf013ed42cb6a754d1ad | [
"Apache-2.0"
] | 4 | 2022-03-02T03:01:24.000Z | 2022-03-23T00:57:33.000Z | metadata-ingestion/tests/integration/azure_ad/test_azure_ad.py | zhoxie-cisco/datahub | 254a73e6ca9b1ec6002fcf013ed42cb6a754d1ad | [
"Apache-2.0"
] | 5 | 2021-07-26T08:37:42.000Z | 2021-11-16T05:41:02.000Z | import json
import pathlib
from unittest.mock import patch
from freezegun import freeze_time
from datahub.ingestion.run.pipeline import Pipeline
from datahub.ingestion.source.identity.azure_ad import AzureADConfig
from tests.test_helpers import mce_helpers
FROZEN_TIME = "2021-08-24 09:00:00"
def test_azure_ad_config():
config = AzureADConfig.parse_obj(
dict(
client_id="00000000-0000-0000-0000-000000000000",
tenant_id="00000000-0000-0000-0000-000000000000",
client_secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
redirect="https://login.microsoftonline.com/common/oauth2/nativeclient",
authority="https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000",
token_url="https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/token",
graph_url="https://graph.microsoft.com/v1.0",
ingest_users=True,
ingest_groups=True,
ingest_group_membership=True,
)
)
# Sanity on required configurations
assert config.client_id == "00000000-0000-0000-0000-000000000000"
assert config.tenant_id == "00000000-0000-0000-0000-000000000000"
assert config.client_secret == "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
assert (
config.redirect
== "https://login.microsoftonline.com/common/oauth2/nativeclient"
)
assert (
config.authority
== "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000"
)
assert (
config.token_url
== "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/token"
)
assert config.graph_url == "https://graph.microsoft.com/v1.0"
# assert on defaults
assert config.ingest_users
assert config.ingest_groups
assert config.ingest_group_membership
@freeze_time(FROZEN_TIME)
def test_azure_ad_source_default_configs(pytestconfig, tmp_path):
test_resources_dir: pathlib.Path = (
pytestconfig.rootpath / "tests/integration/azure_ad"
)
with patch(
"datahub.ingestion.source.identity.azure_ad.AzureADSource.get_token"
) as mock_token, patch(
"datahub.ingestion.source.identity.azure_ad.AzureADSource._get_azure_ad_users"
) as mock_users, patch(
"datahub.ingestion.source.identity.azure_ad.AzureADSource._get_azure_ad_groups"
) as mock_groups, patch(
"datahub.ingestion.source.identity.azure_ad.AzureADSource._get_azure_ad_group_users"
) as mock_group_users:
mocked_functions(
test_resources_dir, mock_token, mock_users, mock_groups, mock_group_users
)
# Run an azure usage ingestion run.
pipeline = Pipeline.create(
{
"run_id": "test-azure-ad",
"source": {
"type": "azure-ad",
"config": {
"client_id": "00000000-0000-0000-0000-000000000000",
"tenant_id": "00000000-0000-0000-0000-000000000000",
"client_secret": "client_secret",
"redirect": "https://login.microsoftonline.com/common/oauth2/nativeclient",
"authority": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000",
"token_url": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/token",
"graph_url": "https://graph.microsoft.com/v1.0",
"ingest_group_membership": True,
"ingest_groups": True,
"ingest_users": True,
},
},
"sink": {
"type": "file",
"config": {
"filename": f"{tmp_path}/azure_ad_mces_default_config.json",
},
},
}
)
pipeline.run()
pipeline.raise_from_status()
mce_helpers.check_golden_file(
pytestconfig,
output_path=tmp_path / "azure_ad_mces_default_config.json",
golden_path=test_resources_dir / "azure_ad_mces_golden_default_config.json",
)
@freeze_time(FROZEN_TIME)
def test_azure_source_ingestion_disabled(pytestconfig, tmp_path):
test_resources_dir: pathlib.Path = (
pytestconfig.rootpath / "tests/integration/azure_ad"
)
with patch(
"datahub.ingestion.source.identity.azure_ad.AzureADSource.get_token"
) as mock_token, patch(
"datahub.ingestion.source.identity.azure_ad.AzureADSource._get_azure_ad_users"
) as mock_users, patch(
"datahub.ingestion.source.identity.azure_ad.AzureADSource._get_azure_ad_groups"
) as mock_groups, patch(
"datahub.ingestion.source.identity.azure_ad.AzureADSource._get_azure_ad_group_users"
) as mock_group_users:
mocked_functions(
test_resources_dir, mock_token, mock_users, mock_groups, mock_group_users
)
# Run an Azure usage ingestion run.
pipeline = Pipeline.create(
{
"run_id": "test-azure-ad",
"source": {
"type": "azure-ad",
"config": {
"client_id": "00000000-0000-0000-0000-000000000000",
"tenant_id": "00000000-0000-0000-0000-000000000000",
"client_secret": "client_secret",
"redirect": "https://login.microsoftonline.com/common/oauth2/nativeclient",
"authority": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000",
"token_url": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/token",
"graph_url": "https://graph.microsoft.com/v1.0",
"ingest_group_membership": "False",
"ingest_groups": "False",
"ingest_users": "False",
},
},
"sink": {
"type": "file",
"config": {
"filename": f"{tmp_path}/azure_ad_mces_ingestion_disabled.json",
},
},
}
)
pipeline.run()
pipeline.raise_from_status()
mce_helpers.check_golden_file(
pytestconfig,
output_path=tmp_path / "azure_ad_mces_ingestion_disabled.json",
golden_path=test_resources_dir / "azure_ad_mces_golden_ingestion_disabled.json",
)
def load_test_resources(test_resources_dir):
azure_ad_users_json_file = test_resources_dir / "azure_ad_users.json"
azure_ad_groups_json_file = test_resources_dir / "azure_ad_groups.json"
with azure_ad_users_json_file.open() as azure_ad_users_json:
reference_users = json.loads(azure_ad_users_json.read())
with azure_ad_groups_json_file.open() as azure_ad_groups_json:
reference_groups = json.loads(azure_ad_groups_json.read())
return reference_users, reference_groups
def mocked_functions(
test_resources_dir, mock_token, mock_users, mock_groups, mock_groups_users
):
# mock token response
mock_token.return_value = "xxxxxxxx"
# mock users and groups response
users, groups = load_test_resources(test_resources_dir)
mock_users.return_value = iter(list([users]))
mock_groups.return_value = iter(list([groups]))
# For simplicity, each user is placed in ALL groups.
# Create a separate response mock for each group in our sample data.
r = []
for _ in groups:
r.append(users)
mock_groups_users.return_value = iter(r)
| 39.314721 | 123 | 0.629438 | 841 | 7,745 | 5.504162 | 0.151011 | 0.058976 | 0.055304 | 0.069129 | 0.755023 | 0.73558 | 0.707712 | 0.668611 | 0.613091 | 0.613091 | 0 | 0.095675 | 0.26856 | 7,745 | 196 | 124 | 39.515306 | 0.721447 | 0.037314 | 0 | 0.428571 | 0 | 0.024845 | 0.363502 | 0.174567 | 0 | 0 | 0 | 0 | 0.062112 | 1 | 0.031056 | false | 0 | 0.043478 | 0 | 0.080745 | 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 |
909961221deb2afd6f990975d13c32b0c0400f10 | 638 | py | Python | daiquiri_client/auth.py | aipescience/django-daiquiri-client | 30521dc7393b65ef51a5fd42b63b1dece46a2d5c | [
"Apache-2.0"
] | null | null | null | daiquiri_client/auth.py | aipescience/django-daiquiri-client | 30521dc7393b65ef51a5fd42b63b1dece46a2d5c | [
"Apache-2.0"
] | null | null | null | daiquiri_client/auth.py | aipescience/django-daiquiri-client | 30521dc7393b65ef51a5fd42b63b1dece46a2d5c | [
"Apache-2.0"
] | null | null | null | class Auth():
def __init__(self, client):
self.client = client
def get_profiles(self):
return self.client.get('/auth/api/profiles/', {'page_size': 10000})['results']
def get_groups(self):
return self.client.get('/auth/api/groups/')
def get_group_map(self):
return {group['id']: group['name'] for group in self.get_groups()}
def activate_profile(self, pk):
return self.client.put('/auth/api/profiles/%d/activate/' % pk, {})
def update_profile_attributes(self, pk, attributes):
return self.client.patch('/auth/api/profiles/%d/' % pk, {'attributes': attributes})
| 31.9 | 91 | 0.639498 | 84 | 638 | 4.702381 | 0.345238 | 0.151899 | 0.162025 | 0.101266 | 0.151899 | 0.151899 | 0.151899 | 0 | 0 | 0 | 0 | 0.009709 | 0.19279 | 638 | 19 | 92 | 33.578947 | 0.757282 | 0 | 0 | 0 | 0 | 0 | 0.189655 | 0.083072 | 0 | 0 | 0 | 0 | 0 | 1 | 0.461538 | false | 0 | 0 | 0.384615 | 0.923077 | 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 |
90a1865751cb26e76fdfe2385bd5686fe05ca8bb | 1,858 | py | Python | ai_flow/model_center/entity/_model_repo_object.py | flink-extended/ai-flow | d1427a243097d94d77fedbe1966500ae26975a13 | [
"Apache-2.0"
] | 79 | 2021-10-15T07:32:27.000Z | 2022-03-28T04:10:19.000Z | ai_flow/model_center/entity/_model_repo_object.py | flink-extended/ai-flow | d1427a243097d94d77fedbe1966500ae26975a13 | [
"Apache-2.0"
] | 153 | 2021-10-15T05:23:46.000Z | 2022-02-23T06:07:10.000Z | ai_flow/model_center/entity/_model_repo_object.py | flink-extended/ai-flow | d1427a243097d94d77fedbe1966500ae26975a13 | [
"Apache-2.0"
] | 23 | 2021-10-15T02:36:37.000Z | 2022-03-17T02:59:27.000Z | #
# Copyright 2022 The AI Flow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
import pprint
from abc import abstractmethod
class _ModelRepoObject(object):
def __iter__(self):
# Iterate through list of properties and yield as key -> value
for prop in self._properties():
yield prop, self.__getattribute__(prop)
@classmethod
def _get_properties_helper(cls):
return sorted([p for p in cls.__dict__ if isinstance(getattr(cls, p), property)])
@classmethod
def _properties(cls):
return cls._get_properties_helper()
@classmethod
@abstractmethod
def from_proto(cls, proto):
pass
def __repr__(self):
return to_string(self)
def to_string(obj):
return _ModelRepoObjectPrinter().to_string(obj)
def get_classname(obj):
return type(obj).__name__
class _ModelRepoObjectPrinter(object):
def __init__(self):
super(_ModelRepoObjectPrinter, self).__init__()
self.printer = pprint.PrettyPrinter()
def to_string(self, obj):
if isinstance(obj, _ModelRepoObject):
return "<%s: %s>" % (get_classname(obj), self._entity_to_string(obj))
return self.printer.pformat(obj)
def _entity_to_string(self, entity):
return ", ".join(["%s=%s" % (key, self.to_string(value)) for key, value in entity])
| 28.584615 | 91 | 0.697524 | 244 | 1,858 | 5.086066 | 0.463115 | 0.045125 | 0.029009 | 0.025786 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005442 | 0.208827 | 1,858 | 64 | 92 | 29.03125 | 0.838776 | 0.331539 | 0 | 0.09375 | 0 | 0 | 0.012255 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0.03125 | 0.0625 | 0.1875 | 0.6875 | 0.09375 | 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 |
90b614eb6ed41d954f776b1b26da34eda803102b | 456 | py | Python | TestBegin.py | FrankWangJQ/HttpRunner-master | f0456a5b7b9d23ddb54415b1ea5951416e9601ef | [
"MIT"
] | null | null | null | TestBegin.py | FrankWangJQ/HttpRunner-master | f0456a5b7b9d23ddb54415b1ea5951416e9601ef | [
"MIT"
] | null | null | null | TestBegin.py | FrankWangJQ/HttpRunner-master | f0456a5b7b9d23ddb54415b1ea5951416e9601ef | [
"MIT"
] | null | null | null | from httprunner import HttpRunner
import time
kwargs = {
"failfast":False,
#"dot_env_path": "/path/to/.env"
}
runner = HttpRunner(**kwargs)
#入口
runner.run("/Users/wangjianqing/PycharmProjects/HttpRunner-master/tests/testcases/Release/账号管理-设置项.yml")
runner.gen_html_report(html_report_name="reportTestForBetaYunZS",html_report_template="/Users/wangjianqing/PycharmProjects/HttpRunner-master/httprunner/templates/default_report_template.html")
| 26.823529 | 192 | 0.800439 | 54 | 456 | 6.574074 | 0.592593 | 0.084507 | 0.180282 | 0.23662 | 0.270423 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072368 | 456 | 16 | 193 | 28.5 | 0.839244 | 0.072368 | 0 | 0 | 0 | 0.125 | 0.530952 | 0.511905 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
90c3c10d1bd2a3bf341092a750b3ced35a3d1342 | 451 | py | Python | [1] BEGINNER/1000 - Hello World!.py | tiago040/URI-SOLUTIONS | 519d3950252a6002e8926416b2f8217ba08fe721 | [
"MIT"
] | 1 | 2022-03-15T03:03:26.000Z | 2022-03-15T03:03:26.000Z | [1] BEGINNER/1000 - Hello World!.py | tiago040/URI-SOLUTIONS | 519d3950252a6002e8926416b2f8217ba08fe721 | [
"MIT"
] | null | null | null | [1] BEGINNER/1000 - Hello World!.py | tiago040/URI-SOLUTIONS | 519d3950252a6002e8926416b2f8217ba08fe721 | [
"MIT"
] | null | null | null | '''
https://resources.urionlinejudge.com.br/gallery/images/problems/UOJ_1000.png
Bem-vindo ao URI Online Judge!
O seu primeiro programa em qualquer linguagem de programação normalmente é o "Hello World!". Neste primeiro problema tudo o que você precisa fazer é imprimir esta mensagem na tela.
Entrada
Este problema não possui nenhuma entrada.
Saída
Você deve imprimir a mensagem "Hello World!" conforme o exemplo abaixo.
'''
print('Hello World!') | 30.066667 | 180 | 0.78714 | 68 | 451 | 5.205882 | 0.794118 | 0.084746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010283 | 0.137472 | 451 | 15 | 181 | 30.066667 | 0.899743 | 0.931264 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
90d92df312eb9bb3199567f0c02a6aff1611d818 | 1,116 | py | Python | spider/utilities/util_config.py | YunofHD/PSpider | c1c9e1e7c61365e140a55541cc558d7c1b9e50f2 | [
"BSD-2-Clause"
] | null | null | null | spider/utilities/util_config.py | YunofHD/PSpider | c1c9e1e7c61365e140a55541cc558d7c1b9e50f2 | [
"BSD-2-Clause"
] | null | null | null | spider/utilities/util_config.py | YunofHD/PSpider | c1c9e1e7c61365e140a55541cc558d7c1b9e50f2 | [
"BSD-2-Clause"
] | null | null | null | # _*_ coding: utf-8 _*_
"""
util_config.py by xianhu
"""
__all__ = [
"CONFIG_FETCH_MESSAGE",
"CONFIG_PARSE_MESSAGE",
"CONFIG_MESSAGE_PATTERN",
"CONFIG_URL_LEGAL_PATTERN",
"CONFIG_URL_ILLEGAL_PATTERN",
]
# define the structure of message, used in Fetcher and Parser
CONFIG_FETCH_MESSAGE = "priority=%s, keys=%s, deep=%s, repeat=%s, url=%s"
CONFIG_PARSE_MESSAGE = "priority=%s, keys=%s, deep=%s, url=%s"
CONFIG_MESSAGE_PATTERN = r"priority=(?P<priority>\d+),\s*keys=(?P<keys>.+?),\s*deep=(?P<deep>\d+),\s*(repeat=(?P<repeat>\d+),\s*)?url=(?P<url>.+)$"
# define url_legal_pattern and url_illegal_pattern
CONFIG_URL_LEGAL_PATTERN = r"^https?:[^\s]+?\.[^\s]+?"
CONFIG_URL_ILLEGAL_PATTERN = r"\.(cab|iso|zip|rar|tar|gz|bz2|7z|tgz|apk|exe|app|pkg|bmg|rpm|deb|dmg|jar|jad|bin|msi|" \
"pdf|doc|docx|xls|xlsx|ppt|pptx|txt|md|odf|odt|rtf|py|java|c|cc|js|css|log|csv|tsv|" \
"jpg|jpeg|png|gif|bmp|xpm|xbm|ico|drm|dxf|eps|psd|pcd|pcx|tif|tiff|" \
"mp3|mp4|swf|mkv|avi|flv|mov|wmv|wma|3gp|mpg|mpeg|mp4a|wav|ogg|rmvb)$"
| 42.923077 | 147 | 0.634409 | 181 | 1,116 | 3.707182 | 0.59116 | 0.053651 | 0.071535 | 0.062593 | 0.160954 | 0.077496 | 0.077496 | 0 | 0 | 0 | 0 | 0.007431 | 0.155914 | 1,116 | 25 | 148 | 44.64 | 0.704883 | 0.139785 | 0 | 0 | 0 | 0.333333 | 0.674737 | 0.543158 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
90e09e247242d171d4b02ca536f204cbdf79e682 | 2,034 | py | Python | src/gluonts/core/serde/_json.py | PascalIversen/gluon-ts | cb6b5145b94f942f7803383a70813363f6953509 | [
"Apache-2.0"
] | 1 | 2020-11-30T18:05:24.000Z | 2020-11-30T18:05:24.000Z | src/gluonts/core/serde/_json.py | PascalIversen/gluon-ts | cb6b5145b94f942f7803383a70813363f6953509 | [
"Apache-2.0"
] | null | null | null | src/gluonts/core/serde/_json.py | PascalIversen/gluon-ts | cb6b5145b94f942f7803383a70813363f6953509 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file 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.
"""
JSON Serialization/Deserialization
----------------------------------
The canonical way to do this is to define and `default` and `object_hook`
parameters to the json.dumps and json.loads methods. Unfortunately, due
to https://bugs.python.org/issue12657 this is not possible at the moment,
as support for custom NamedTuple serialization is broken.
To circumvent the issue, we pass the input value through custom encode
and decode functions that map nested object terms to JSON-serializable
data structures with explicit recursion.
"""
import json
from typing import Any, Optional
from ._base import encode, decode
def dump_json(o: Any, indent: Optional[int] = None) -> str:
"""
Serializes an object to a JSON string.
Parameters
----------
o
The object to serialize.
indent
An optional number of spaced to use as an indent.
Returns
-------
str
A string representing the object in JSON format.
See Also
--------
load_json
Inverse function.
"""
return json.dumps(encode(o), indent=indent, sort_keys=True)
def load_json(s: str) -> Any:
"""
Deserializes an object from a JSON string.
Parameters
----------
s
A string representing the object in JSON format.
Returns
-------
Any
The deserialized object.
See Also
--------
dump_json
Inverse function.
"""
return decode(json.loads(s))
| 26.076923 | 75 | 0.67355 | 279 | 2,034 | 4.885305 | 0.494624 | 0.044021 | 0.016141 | 0.030814 | 0.058694 | 0.058694 | 0.058694 | 0.058694 | 0 | 0 | 0 | 0.008238 | 0.224189 | 2,034 | 77 | 76 | 26.415584 | 0.855513 | 0.779253 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.428571 | 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 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2948b21202accf70d658d0b73f9aafb72b41be55 | 114 | py | Python | b2accessdeprovisioning/configparser.py | EUDAT-B2ACCESS/b2access-deprovisioning-report | 2260347a4e1f522386c188c0dfae2e94bc5b2a40 | [
"Apache-2.0"
] | null | null | null | b2accessdeprovisioning/configparser.py | EUDAT-B2ACCESS/b2access-deprovisioning-report | 2260347a4e1f522386c188c0dfae2e94bc5b2a40 | [
"Apache-2.0"
] | null | null | null | b2accessdeprovisioning/configparser.py | EUDAT-B2ACCESS/b2access-deprovisioning-report | 2260347a4e1f522386c188c0dfae2e94bc5b2a40 | [
"Apache-2.0"
] | 2 | 2017-10-05T07:26:39.000Z | 2017-10-05T07:27:54.000Z | from __future__ import absolute_import
import yaml
with open("config.yml", "r") as f:
config = yaml.load(f)
| 16.285714 | 38 | 0.710526 | 18 | 114 | 4.222222 | 0.722222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175439 | 114 | 6 | 39 | 19 | 0.808511 | 0 | 0 | 0 | 0 | 0 | 0.096491 | 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 |
2970702f348227149035bca1abec42b22aa901b1 | 1,019 | py | Python | tmdb_client.py | SztMar/movies_catalogue | 8140a37e916d9f67314aa679b46134e1794588e6 | [
"MIT"
] | null | null | null | tmdb_client.py | SztMar/movies_catalogue | 8140a37e916d9f67314aa679b46134e1794588e6 | [
"MIT"
] | null | null | null | tmdb_client.py | SztMar/movies_catalogue | 8140a37e916d9f67314aa679b46134e1794588e6 | [
"MIT"
] | null | null | null | import requests
import json
import os
API_TOKEN = os.environ.get("TMDB_API_TOKEN", "")
def call_tmdb_api(_endpoint):
endpoint = f"https://api.themoviedb.org/3/{_endpoint}"
full_url = f'{endpoint}?api_key={API_TOKEN}'
response = requests.get(full_url)
response.raise_for_status()
return response.json()
def get_popular_movies():
return call_tmdb_api(f"movie/popular")
def get_movies_list(list_type):
return call_tmdb_api(f"movie/{list_type}")
def get_poster_url(poster_api_path, size="w324"):
base_url = "https://image.tmdb.org/t/p/"
return f"{base_url}{size}/{poster_api_path}"
def get_single_movie(movie_id):
return call_tmdb_api(f"movie/{movie_id}")
def get_single_movie_cast(movie_id):
return call_tmdb_api(f"movie/{movie_id}/credits")
def get_movies(how_many, list_type='popular'):
data = get_movies_list(list_type)
return data["results"][:how_many]
def get_movie_images(movie_id):
return call_tmdb_api(f"movie/{movie_id}/images")
| 26.128205 | 58 | 0.723258 | 161 | 1,019 | 4.223602 | 0.291925 | 0.072059 | 0.097059 | 0.125 | 0.301471 | 0.301471 | 0.163235 | 0.163235 | 0.163235 | 0.163235 | 0 | 0.004571 | 0.141315 | 1,019 | 38 | 59 | 26.815789 | 0.772571 | 0 | 0 | 0 | 0 | 0 | 0.251227 | 0.10893 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.115385 | 0.192308 | 0.730769 | 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 |
462a57a1182eb2397cc4d73242d61fbadafdf7cc | 367 | py | Python | test/qa-tests/buildscripts/resmokelib/logging/__init__.py | Mrliu8023/mongo-tools | b9048617a6dc788aae9286d0c2bd3fefe49d23d3 | [
"Apache-2.0"
] | 1 | 2022-02-17T10:51:19.000Z | 2022-02-17T10:51:19.000Z | test/qa-tests/buildscripts/resmokelib/logging/__init__.py | Mrliu8023/mongo-tools | b9048617a6dc788aae9286d0c2bd3fefe49d23d3 | [
"Apache-2.0"
] | null | null | null | test/qa-tests/buildscripts/resmokelib/logging/__init__.py | Mrliu8023/mongo-tools | b9048617a6dc788aae9286d0c2bd3fefe49d23d3 | [
"Apache-2.0"
] | null | null | null | """
Extension to the logging package to support buildlogger.
"""
# Alias the built-in logging.Logger class for type checking arguments. Those interested in
# constructing a new Logger instance should use the loggers.new_logger() function instead.
from logging import Logger
from . import config
from . import buildlogger
from . import flush
from . import loggers
| 24.466667 | 90 | 0.784741 | 51 | 367 | 5.627451 | 0.607843 | 0.139373 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160763 | 367 | 14 | 91 | 26.214286 | 0.931818 | 0.640327 | 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 |
4638cae0768af5f19dde04ebbab5eceafeebdaf5 | 14,103 | py | Python | si_unit_pandas/base.py | domdfcoding/si_unit_pandas | 6912d775f88dcfb9112199a57c14b6ce6a979d0e | [
"BSD-3-Clause"
] | null | null | null | si_unit_pandas/base.py | domdfcoding/si_unit_pandas | 6912d775f88dcfb9112199a57c14b6ce6a979d0e | [
"BSD-3-Clause"
] | 19 | 2020-12-21T18:26:24.000Z | 2022-01-16T11:47:58.000Z | si_unit_pandas/base.py | domdfcoding/si_unit_pandas | 6912d775f88dcfb9112199a57c14b6ce6a979d0e | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
#
# base.py
"""
Base functionality.
"""
#
# Copyright (c) 2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
#
# Based on cyberpandas
# https://github.com/ContinuumIO/cyberpandas
# Copyright (c) 2018, Anaconda, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# _isstringslice based on awkward-array
# https://github.com/scikit-hep/awkward-array
# Copyright (c) 2018-2019, Jim Pivarski
# Licensed under the BSD 3-Clause License
#
# stdlib
from abc import abstractmethod
from numbers import Real
from typing import Dict, Iterable, List, Optional, Sequence, SupportsFloat, Tuple, Type, TypeVar, Union, overload
# 3rd party
import numpy # type: ignore
from domdf_python_tools.doctools import prettify_docstrings
from pandas.core.arrays import ExtensionArray # type: ignore
from pandas.core.dtypes.base import ExtensionDtype # type: ignore
from pandas.core.dtypes.generic import ABCExtensionArray # type: ignore
from typing_extensions import Literal, Protocol
__all__ = ["NumPyBackedExtensionArrayMixin"]
class NumPyBackedExtensionArrayMixin(ExtensionArray):
"""
Mixin for pandas extension backed by a numpy array.
"""
_dtype: Type[ExtensionDtype]
@property
def dtype(self):
"""
The dtype for this extension array, :class:`~.CelsiusType`.
"""
return self._dtype
@classmethod
def _from_sequence(cls, scalars: Iterable, dtype=None, copy: bool = False):
"""
Construct a new ExtensionArray from a sequence of scalars.
:param scalars: Each element will be an instance of the scalar type for this
array, ``cls.dtype.type``.
:param dtype: Construct for this particular dtype. This should be a Dtype
compatible with the ExtensionArray.
:type dtype: dtype, optional
:param copy: If True, copy the underlying data.
"""
return cls(scalars, dtype=dtype)
@classmethod
def _from_factorized(cls, values: numpy.ndarray, original: ExtensionArray):
"""
Reconstruct an ExtensionArray after factorization.
:param values: An integer ndarray with the factorized values.
:param original: The original ExtensionArray that factorize was called on.
.. seealso::
:meth:`pandas.pandas.api.extensions.ExtensionArray.factorize`
"""
return cls(values)
@property
def shape(self) -> Tuple[int]:
"""
Return a tuple of the array dimensions.
"""
return len(self.data),
def __len__(self) -> int:
"""
Returns the length of this array.
"""
return len(self.data)
def setitem(self, indexer, value):
"""
Set the 'value' inplace.
"""
# I think having a separate than __setitem__ is good
# since we have to return here, but __setitem__ doesn't.
self[indexer] = value
return self
@property
def nbytes(self) -> int:
"""
The number of bytes needed to store this object in memory.
"""
return self._itemsize * len(self)
def _formatting_values(self):
return numpy.array(self._format_values(), dtype="object")
def copy(self, deep: bool = False) -> ABCExtensionArray:
"""
Return a copy of the array.
:param deep:
:return:
:rtype:
"""
return type(self)(self.data.copy())
@classmethod
def _concat_same_type(cls, to_concat: Sequence[ABCExtensionArray]) -> ABCExtensionArray:
"""
Concatenate multiple arrays.
:param to_concat: sequence of this type
"""
return cls(numpy.concatenate([array.data for array in to_concat]))
def tolist(self) -> List:
"""
Convert the array to a Python list.
"""
return self.data.tolist()
def argsort(
self,
ascending: bool = True,
kind: Union[Literal["quicksort"], Literal["mergesort"], Literal["heapsort"]] = "quicksort",
*args,
**kwargs,
) -> numpy.ndarray:
r"""
Return the indices that would sort this array.
:param ascending: Whether the indices should result in an ascending
or descending sort.
:param kind: {'quicksort', 'mergesort', 'heapsort'}, optional
Sorting algorithm.
\*args and \*\*kwargs are passed through to :func:`numpy.argsort`.
:return: Array of indices that sort ``self``. If NaN values are contained,
NaN values are placed at the end.
.. seealso::
:class:`numpy.argsort`: Sorting implementation used internally.
"""
return self.data.argsort()
def unique(self) -> ExtensionArray: # noqa: D102
# https://github.com/pandas-dev/pandas/pull/19869
_, indices = numpy.unique(self.data, return_index=True)
data = self.data.take(numpy.sort(indices))
return self._from_ndarray(data)
_A = TypeVar("_A")
class BaseArray(numpy.lib.mixins.NDArrayOperatorsMixin, NumPyBackedExtensionArrayMixin):
ndim: int = 1
data: numpy.ndarray
@classmethod
def _from_ndarray(cls: _A, data: numpy.ndarray, copy: bool = False) -> _A:
"""
Zero-copy construction of a BaseArray from an ndarray.
:param data: This should have CelsiusType._record_type dtype
:param copy: Whether to copy the data.
:return:
"""
if copy:
data = data.copy()
new = cls([]) # type: ignore
new.data = data
return new
@property
def na_value(self):
"""
The missing value.
**Example:**
.. code-block::
>>> BaseArray([]).na_value
numpy.nan
"""
return self.dtype.na_value
def take(self, indices, allow_fill: bool = False, fill_value=None):
# Can't use pandas' take yet
# 1. axis
# 2. I don't know how to do the reshaping correctly.
indices = numpy.asarray(indices, dtype="int")
if allow_fill and fill_value is None:
fill_value = self.na_value
elif allow_fill and not isinstance(fill_value, tuple):
if not numpy.isnan(fill_value):
fill_value = int(fill_value)
if allow_fill:
mask = (indices == -1)
if not len(self):
if not (indices == -1).all():
msg = "Invalid take for empty array. Must be all -1."
raise IndexError(msg)
else:
# all NA take from and empty array
took = (
numpy.full(
(len(indices), 2),
fill_value,
dtype=">u8",
).reshape(-1).astype(self.dtype._record_type)
)
return self._from_ndarray(took)
if (indices < -1).any():
msg = "Invalid value in 'indicies'. Must be all >= -1 for 'allow_fill=True'"
raise ValueError(msg)
took = self.data.take(indices)
if allow_fill:
took[mask] = fill_value
return self._from_ndarray(took)
def __repr__(self) -> str:
formatted = self._format_values()
return f"{self.__class__.__name__}({formatted!r})"
def isna(self):
"""
Indicator for whether each element is missing.
"""
if numpy.isnan(self.na_value):
return numpy.isnan(self.data)
else:
return self.data == self.na_value
# From https://github.com/scikit-hep/awkward-array/blob/2bbdb68d7a4fff2eeaed81eb76195e59232e8c13/awkward/array/base.py#L611
def _isstringslice(self, where):
if isinstance(where, str):
return True
elif isinstance(where, bytes):
raise TypeError("column selection must be str, not bytes, in Python 3")
elif isinstance(where, tuple):
return False
elif (
isinstance(where, (numpy.ndarray, self.__class__))
and issubclass(where.dtype.type, (numpy.str, numpy.str_))
):
return True
elif isinstance(where, (numpy.ndarray, self.__class__)) and issubclass(
where.dtype.type, (numpy.object, numpy.object_)
) and not issubclass(where.dtype.type, (numpy.bool, numpy.bool_)):
return len(where) > 0 and all(isinstance(x, str) for x in where)
elif isinstance(where, (numpy.ndarray, self.__class__)):
return False
try:
assert len(where) > 0
assert all(isinstance(x, str) for x in where)
except (TypeError, AssertionError):
return False
else:
return True
def __delitem__(self, where):
if isinstance(where, str):
del self.data[where]
elif self._isstringslice(where):
for x in where:
del self.data[x]
else:
raise TypeError(f"invalid index for removing column from Table: {where}")
@property
@abstractmethod
def _parser(self):
raise NotImplementedError
def append(self, value) -> None:
"""
Append a value to this BaseArray.
:param value:
"""
self.data = numpy.append(self.data, self._parser(value).data)
def __setitem__(self, key, value):
value = self._parser(value).data
self.data[key] = value
class _SupportsIndex(Protocol):
def __index__(self) -> int:
...
_F = TypeVar("_F", bound="UserFloat")
@prettify_docstrings
class UserFloat(Real):
"""
Class that simulates a float.
:param value: Values to initialise the :class:`~domdf_python_tools.bases.UserFloat` with.
.. versionadded:: 1.6.0
"""
def __init__(self, value: Union[SupportsFloat, _SupportsIndex, str, bytes, bytearray] = 0.0):
self._value = (float(value), )
def as_integer_ratio(self) -> Tuple[int, int]:
return float(self).as_integer_ratio()
def hex(self) -> str: # noqa: A003 # pylint: disable=redefined-builtin
return float(self).hex()
def is_integer(self) -> bool:
return float(self).is_integer()
@classmethod
def fromhex(cls: Type[_F], __s: str) -> _F:
return cls(float.fromhex(__s))
def __add__(self: _F, other: float) -> _F:
return self.__class__(float(self).__add__(other))
def __sub__(self: _F, other: float) -> _F:
return self.__class__(float(self).__sub__(other))
def __mul__(self: _F, other: float) -> _F:
return self.__class__(float(self).__mul__(other))
def __floordiv__(self: _F, other: float) -> _F: # type: ignore
return self.__class__(float(self).__floordiv__(other))
def __truediv__(self: _F, other: float) -> _F:
return self.__class__(float(self).__truediv__(other))
def __mod__(self: _F, other: float) -> _F:
return self.__class__(float(self).__mod__(other))
def __divmod__(self: _F, other: float) -> Tuple[_F, _F]:
return tuple(self.__class__(x) for x in float(self).__divmod__(other)) # type: ignore
def __pow__(self: _F, other: float, mod=None) -> _F:
return self.__class__(float(self).__pow__(other, mod))
def __radd__(self: _F, other: float) -> _F:
return self.__class__(float(self).__radd__(other))
def __rsub__(self: _F, other: float) -> _F:
return self.__class__(float(self).__rsub__(other))
def __rmul__(self: _F, other: float) -> _F:
return self.__class__(float(self).__rmul__(other))
def __rfloordiv__(self: _F, other: float) -> _F: # type: ignore
return self.__class__(float(self).__rfloordiv__(other))
def __rtruediv__(self: _F, other: float) -> _F:
return self.__class__(float(self).__rtruediv__(other))
def __rmod__(self: _F, other: float) -> _F:
return self.__class__(float(self).__rmod__(other))
def __rdivmod__(self: _F, other: float) -> Tuple[_F, _F]:
return tuple(self.__class__(x) for x in float(self).__rdivmod__(other)) # type: ignore
def __rpow__(self: _F, other: float, mod=None) -> _F:
return self.__class__(float(self).__rpow__(other, mod))
def __getnewargs__(self) -> Tuple[float]:
return self._value
def __trunc__(self) -> int:
return float(self).__trunc__()
@overload
def __round__(self, ndigits: int) -> float:
...
@overload
def __round__(self, ndigits: None = ...) -> int:
...
def __round__(self, ndigits: Optional[int] = None) -> Union[int, float]:
return float(self).__round__(ndigits)
def __eq__(self, other: object) -> bool:
if isinstance(other, UserFloat):
return self._value == other._value
else:
return float(self).__eq__(other)
def __ne__(self, other: object) -> bool:
if isinstance(other, UserFloat):
return self._value != other._value
else:
return float(self).__ne__(other)
def __lt__(self, other: float) -> bool:
if isinstance(other, UserFloat):
return self._value < other._value
else:
return float(self).__lt__(other)
def __le__(self, other: float) -> bool:
if isinstance(other, UserFloat):
return self._value <= other._value
else:
return float(self).__le__(other)
def __gt__(self, other: float) -> bool:
if isinstance(other, UserFloat):
return self._value > other._value
else:
return float(self).__gt__(other)
def __ge__(self, other: float) -> bool:
if isinstance(other, UserFloat):
return self._value >= other._value
else:
return float(self).__ge__(other)
def __neg__(self: _F) -> _F:
return self.__class__(float(self).__neg__())
def __pos__(self: _F) -> _F:
return self.__class__(float(self).__pos__())
def __str__(self) -> str:
return str(float(self))
def __int__(self) -> int:
return int(float(self))
def __float__(self) -> float:
return self._value[0]
def __abs__(self: _F) -> _F:
return self.__class__(float(self).__abs__())
def __hash__(self) -> int:
return float(self).__hash__()
def __repr__(self) -> str:
return str(self)
def __ceil__(self):
raise NotImplementedError
def __floor__(self):
raise NotImplementedError
| 27.069098 | 124 | 0.704602 | 1,904 | 14,103 | 4.936975 | 0.228466 | 0.037234 | 0.027128 | 0.03617 | 0.234149 | 0.205957 | 0.188936 | 0.177234 | 0.161702 | 0.161702 | 0 | 0.00636 | 0.174927 | 14,103 | 520 | 125 | 27.121154 | 0.801478 | 0.320357 | 0 | 0.186047 | 0 | 0 | 0.037295 | 0.007502 | 0 | 0 | 0 | 0 | 0.011628 | 1 | 0.255814 | false | 0 | 0.034884 | 0.124031 | 0.589147 | 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 |
46395d1d31524d94efb18967e41d8995a2059eda | 196 | py | Python | agents/admin.py | HerbertRamirez/inmo_web | 3c48911d5e3ee7a75580534664874ba5e8281e55 | [
"MIT"
] | null | null | null | agents/admin.py | HerbertRamirez/inmo_web | 3c48911d5e3ee7a75580534664874ba5e8281e55 | [
"MIT"
] | null | null | null | agents/admin.py | HerbertRamirez/inmo_web | 3c48911d5e3ee7a75580534664874ba5e8281e55 | [
"MIT"
] | 3 | 2021-02-18T15:11:53.000Z | 2021-02-20T17:34:01.000Z | from django.contrib import admin
from .models import Agent
# Register your models here.
class AgentAdmin(admin.ModelAdmin):
readonly_fields = ('created','updated')
admin.site.register(Agent) | 24.5 | 43 | 0.77551 | 25 | 196 | 6.04 | 0.72 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122449 | 196 | 8 | 44 | 24.5 | 0.877907 | 0.132653 | 0 | 0 | 0 | 0 | 0.08284 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 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 |
463e9059d21ae44008d266e66201d33e8c741f68 | 1,251 | py | Python | core/migrations/0009_measurement.py | Potanist/Potanist | bd9d82fe9ca8f4157b34e5174793777d6729999c | [
"BSD-3-Clause"
] | null | null | null | core/migrations/0009_measurement.py | Potanist/Potanist | bd9d82fe9ca8f4157b34e5174793777d6729999c | [
"BSD-3-Clause"
] | null | null | null | core/migrations/0009_measurement.py | Potanist/Potanist | bd9d82fe9ca8f4157b34e5174793777d6729999c | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0008_grow_owner'),
]
operations = [
migrations.CreateModel(
name='Measurement',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('timestamp', models.DateTimeField(auto_now_add=True)),
('air_temperature', models.IntegerField(null=True, blank=True)),
('water_temperature', models.IntegerField(null=True, blank=True)),
('humidity', models.IntegerField(null=True, blank=True)),
('co2', models.IntegerField(null=True, blank=True)),
('ppm', models.IntegerField(null=True, blank=True)),
('tds', models.IntegerField(null=True, blank=True)),
('ec', models.IntegerField(null=True, blank=True)),
('ph', models.IntegerField(null=True, blank=True)),
('lumen', models.IntegerField(null=True, blank=True)),
('plant', models.ForeignKey(to='core.Plant')),
],
),
]
| 39.09375 | 114 | 0.576339 | 121 | 1,251 | 5.842975 | 0.446281 | 0.229137 | 0.280057 | 0.330976 | 0.476662 | 0.476662 | 0.130127 | 0 | 0 | 0 | 0 | 0.006586 | 0.271783 | 1,251 | 31 | 115 | 40.354839 | 0.769484 | 0.016787 | 0 | 0 | 0 | 0 | 0.094463 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.08 | 0 | 0.2 | 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 |
464a4fad08a32bd81e6c1f0f95fd3057daa4e736 | 901 | py | Python | investing_algorithm_framework/core/models/__init__.py | coding-kitties/investing-algorithm-framework | 1156acf903345ec5e6787ee8767c68e24c4daffd | [
"Apache-2.0"
] | 9 | 2020-09-14T13:46:32.000Z | 2022-02-01T15:40:12.000Z | investing_algorithm_framework/core/models/__init__.py | coding-kitties/investing-algorithm-framework | 1156acf903345ec5e6787ee8767c68e24c4daffd | [
"Apache-2.0"
] | 44 | 2020-12-28T16:22:20.000Z | 2022-03-23T22:11:26.000Z | investing_algorithm_framework/core/models/__init__.py | coding-kitties/investing-algorithm-framework | 1156acf903345ec5e6787ee8767c68e24c4daffd | [
"Apache-2.0"
] | 2 | 2020-12-25T06:14:39.000Z | 2022-01-19T19:00:20.000Z | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
def create_all_tables():
db.create_all()
def initialize_db(app: Flask):
db.init_app(app)
db.app = app
from investing_algorithm_framework.core.models.order_status import OrderStatus
from investing_algorithm_framework.core.models.order_type import OrderType
from investing_algorithm_framework.core.models.order_side import OrderSide
from investing_algorithm_framework.core.models.time_unit import TimeUnit
from investing_algorithm_framework.core.models.order import Order
from investing_algorithm_framework.core.models.portfolio import Portfolio
from investing_algorithm_framework.core.models.position import Position
__all__ = [
"db",
"Portfolio",
"Position",
'Order',
"OrderType",
'OrderSide',
"TimeUnit",
"create_all_tables",
"initialize_db",
"OrderStatus"
]
| 25.742857 | 78 | 0.785794 | 111 | 901 | 6.099099 | 0.261261 | 0.134417 | 0.227474 | 0.320532 | 0.453471 | 0.453471 | 0.271787 | 0 | 0 | 0 | 0 | 0 | 0.135405 | 901 | 34 | 79 | 26.5 | 0.869063 | 0 | 0 | 0 | 0 | 0 | 0.100999 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.074074 | false | 0 | 0.333333 | 0 | 0.407407 | 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 |
464c4a39f52a6f1f848e5df28842de523721d469 | 385 | py | Python | models/RelSaleSizeProject.py | the-Minister-0001/cardano-nft-admin | 870ae5303808056af702d7e162a249567505d4c6 | [
"MIT"
] | 1 | 2021-07-28T20:17:25.000Z | 2021-07-28T20:17:25.000Z | models/RelSaleSizeProject.py | the-Minister-0001/cardano-nft-admin | 870ae5303808056af702d7e162a249567505d4c6 | [
"MIT"
] | null | null | null | models/RelSaleSizeProject.py | the-Minister-0001/cardano-nft-admin | 870ae5303808056af702d7e162a249567505d4c6 | [
"MIT"
] | null | null | null | from sqlalchemy import Column, Integer
from sqlalchemy import ForeignKey
from sqlalchemy.orm import declarative_base
from .base import Base
class RelSaleSizeProject(Base):
__tablename__ = 'rel_salesizes_projects'
id = Column(Integer, primary_key=True)
project_id = Column(Integer, ForeignKey('projects.id'))
salesize_id = Column(Integer, ForeignKey('salesizes.id'))
| 29.615385 | 61 | 0.779221 | 46 | 385 | 6.304348 | 0.456522 | 0.17931 | 0.155172 | 0.172414 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137662 | 385 | 12 | 62 | 32.083333 | 0.873494 | 0 | 0 | 0 | 0 | 0 | 0.117188 | 0.057292 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
465010f857bece90ac2bd5becc8c6c4644e18f35 | 54 | py | Python | facebook/matrixWordSearch.py | rando3/leetcode-python | b13bb35fb3cdc9813c62944547d260be2f9cab02 | [
"MIT"
] | null | null | null | facebook/matrixWordSearch.py | rando3/leetcode-python | b13bb35fb3cdc9813c62944547d260be2f9cab02 | [
"MIT"
] | null | null | null | facebook/matrixWordSearch.py | rando3/leetcode-python | b13bb35fb3cdc9813c62944547d260be2f9cab02 | [
"MIT"
] | null | null | null | https://leetcode.com/problems/word-search/description/ | 54 | 54 | 0.833333 | 7 | 54 | 6.428571 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 54 | 1 | 54 | 54 | 0.833333 | 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 |
46604f1fc90b7c0ea8ac8ed35c4082c5ab9f172f | 247 | py | Python | src/koeda/utils/stopwords.py | toriving/KoEDA | 5dfbb0e88ede13da2e5e72ac94fe7cb12c0b7cd1 | [
"MIT"
] | 48 | 2021-04-23T16:13:41.000Z | 2022-03-24T09:03:26.000Z | src/koeda/utils/stopwords.py | toriving/KoEDA | 5dfbb0e88ede13da2e5e72ac94fe7cb12c0b7cd1 | [
"MIT"
] | 6 | 2020-11-19T13:56:29.000Z | 2021-09-26T12:13:23.000Z | src/koeda/utils/stopwords.py | toriving/KoEDA | 5dfbb0e88ede13da2e5e72ac94fe7cb12c0b7cd1 | [
"MIT"
] | 3 | 2021-09-13T07:14:29.000Z | 2021-12-29T09:52:36.000Z | import os
import json
STOPWORDS_JSON_PATH = os.path.join(
os.path.dirname(os.path.abspath(__file__)), os.pardir, "corpora/stopwords.json"
)
with open(STOPWORDS_JSON_PATH, "r", encoding="utf-8") as f:
STOPWORD = json.load(f)["stopwords"]
| 24.7 | 83 | 0.720648 | 38 | 247 | 4.473684 | 0.552632 | 0.229412 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004608 | 0.121457 | 247 | 9 | 84 | 27.444444 | 0.778802 | 0 | 0 | 0 | 0 | 0 | 0.149798 | 0.089069 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.285714 | 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 |
46701c0193cfd9ee406763922c026176cc2a2fc9 | 1,126 | py | Python | src/prefect/schedules/adjustments.py | concreted/prefect | dd732f5990ee2b0f3d816adb285168fd63b239e4 | [
"Apache-2.0"
] | 8,633 | 2019-03-23T17:51:03.000Z | 2022-03-31T22:17:42.000Z | src/prefect/schedules/adjustments.py | concreted/prefect | dd732f5990ee2b0f3d816adb285168fd63b239e4 | [
"Apache-2.0"
] | 3,903 | 2019-03-23T19:11:21.000Z | 2022-03-31T23:21:23.000Z | src/prefect/schedules/adjustments.py | ngriffiths13/prefect | 7f5613abcb182494b7dc12159277c3bc5f3c9898 | [
"Apache-2.0"
] | 937 | 2019-03-23T18:49:44.000Z | 2022-03-31T21:45:13.000Z | """
Schedule adjustments are functions that accept a `datetime` and modify it in some way.
Adjustments have the signature `Callable[[datetime], datetime]`.
"""
from datetime import datetime, timedelta
from typing import Callable
import pendulum
import prefect.schedules.filters
def add(interval: timedelta) -> Callable[[datetime], datetime]:
"""
Adjustment that adds a specified interval to the date.
Args:
- interval (timedelta): the amount of time to add
Returns:
- Callable[[datetime], bool]: the adjustment function
"""
def _adjustment_fn(dt: datetime) -> datetime:
return pendulum.instance(dt) + interval
return _adjustment_fn
def next_weekday(dt: datetime) -> datetime:
"""
Adjustment that advances a date to the next weekday. If the date is already a weekday,
it is returned unadjusted.
Args:
- dt (datetime): the datetime to adjust
Returns:
- datetime: the adjusted datetime
"""
pdt = pendulum.instance(dt)
while not prefect.schedules.filters.is_weekday(pdt):
pdt = pdt.add(days=1)
return pdt
| 24.478261 | 90 | 0.683837 | 139 | 1,126 | 5.496403 | 0.431655 | 0.08377 | 0.062827 | 0.078534 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001151 | 0.228242 | 1,126 | 45 | 91 | 25.022222 | 0.878021 | 0.487567 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.307692 | 0.076923 | 0.769231 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
4685d4b1728860e781a678cd76d788dda6fe260b | 236 | py | Python | iam/__init__.py | dataday/aws-utilities-sdk | 7b1236f27a27e2830ccbbf905bbc05f864a1aecf | [
"MIT"
] | null | null | null | iam/__init__.py | dataday/aws-utilities-sdk | 7b1236f27a27e2830ccbbf905bbc05f864a1aecf | [
"MIT"
] | null | null | null | iam/__init__.py | dataday/aws-utilities-sdk | 7b1236f27a27e2830ccbbf905bbc05f864a1aecf | [
"MIT"
] | null | null | null | """
.. module:: aws_utilities_cli.iam
:platform: OS X
:synopsis: Small collection of utilities that
use the Amazon Web Services (AWS) SDK
.. moduleauthor:: dataday
"""
__all__ = ['generate_identity', 'generate_policy']
| 23.6 | 50 | 0.686441 | 28 | 236 | 5.5 | 0.892857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190678 | 236 | 9 | 51 | 26.222222 | 0.806283 | 0.745763 | 0 | 0 | 0 | 0 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
469bf8d9da5f7e85ca99597046844afc1b477cd9 | 213 | py | Python | code/django18/django18/newsletter/forms.py | dvl/celerytalk | 312de04ea24bb073357684a3a35cfd782b2b7aae | [
"MIT"
] | null | null | null | code/django18/django18/newsletter/forms.py | dvl/celerytalk | 312de04ea24bb073357684a3a35cfd782b2b7aae | [
"MIT"
] | null | null | null | code/django18/django18/newsletter/forms.py | dvl/celerytalk | 312de04ea24bb073357684a3a35cfd782b2b7aae | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
class NewsletterForm(forms.Form):
assunto = forms.CharField()
mensagem = forms.CharField(widget=forms.Textarea)
| 19.363636 | 53 | 0.737089 | 25 | 213 | 6.08 | 0.72 | 0.184211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005556 | 0.15493 | 213 | 10 | 54 | 21.3 | 0.838889 | 0.098592 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
46a69a58e97c1c80acfb7499d4de7c5a7c1ed4bb | 875 | py | Python | src/solutions/part1/q389_find_diff.py | hychrisli/PyAlgorithms | 71e537180f3b371d0d2cc47b11cb68ec13a8ac68 | [
"Apache-2.0"
] | null | null | null | src/solutions/part1/q389_find_diff.py | hychrisli/PyAlgorithms | 71e537180f3b371d0d2cc47b11cb68ec13a8ac68 | [
"Apache-2.0"
] | null | null | null | src/solutions/part1/q389_find_diff.py | hychrisli/PyAlgorithms | 71e537180f3b371d0d2cc47b11cb68ec13a8ac68 | [
"Apache-2.0"
] | null | null | null | from src.base.solution import Solution
from src.tests.part1.q389_test_find_diff import FindDiffTestCases
class FindDiff(Solution):
def verify_output(self, test_output, output):
return test_output[0] == output[0]
def run_test(self, input):
return self.findTheDifference(input[0], input[1])
def gen_test_cases(self):
return FindDiffTestCases()
def print_output(self, output):
super(FindDiff, self).print_output(output)
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
lkp = dict()
for ch in s:
lkp[ch] = lkp.get(ch, 0) + 1
for ch in t:
lkp[ch] = lkp.get(ch, 0) - 1
if lkp[ch] < 0:
return ch
if __name__ == '__main__':
solution = FindDiff()
solution.run_tests() | 24.305556 | 65 | 0.580571 | 113 | 875 | 4.318584 | 0.371681 | 0.030738 | 0.028689 | 0.045082 | 0.061475 | 0.061475 | 0.061475 | 0 | 0 | 0 | 0 | 0.021417 | 0.306286 | 875 | 36 | 66 | 24.305556 | 0.782537 | 0.042286 | 0 | 0 | 0 | 0 | 0.010013 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.227273 | false | 0 | 0.090909 | 0.136364 | 0.545455 | 0.090909 | 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 |
46abd7d33dffc8675b1cbcb1f61d7140668df589 | 249 | py | Python | output/models/nist_data/atomic/integer/schema_instance/nistschema_sv_iv_atomic_integer_pattern_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/nist_data/atomic/integer/schema_instance/nistschema_sv_iv_atomic_integer_pattern_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/nist_data/atomic/integer/schema_instance/nistschema_sv_iv_atomic_integer_pattern_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.nist_data.atomic.integer.schema_instance.nistschema_sv_iv_atomic_integer_pattern_1_xsd.nistschema_sv_iv_atomic_integer_pattern_1 import NistschemaSvIvAtomicIntegerPattern1
__all__ = [
"NistschemaSvIvAtomicIntegerPattern1",
]
| 41.5 | 190 | 0.891566 | 28 | 249 | 7.25 | 0.642857 | 0.192118 | 0.137931 | 0.197044 | 0.344828 | 0.344828 | 0.344828 | 0 | 0 | 0 | 0 | 0.017021 | 0.056225 | 249 | 5 | 191 | 49.8 | 0.846809 | 0 | 0 | 0 | 0 | 0 | 0.140562 | 0.140562 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d3b26adf9f1c111614b51c252d8d80c26d192abc | 337 | py | Python | utils/__init__.py | millermuttu/torch_soft | 70a692650b6eb8c70000e0f8dc2b22cbb9f94741 | [
"MIT"
] | null | null | null | utils/__init__.py | millermuttu/torch_soft | 70a692650b6eb8c70000e0f8dc2b22cbb9f94741 | [
"MIT"
] | null | null | null | utils/__init__.py | millermuttu/torch_soft | 70a692650b6eb8c70000e0f8dc2b22cbb9f94741 | [
"MIT"
] | null | null | null | # # importing all the modules at once
# from .config import *
# from .normalization import *
# from .others import *
# from .img_reg import *
# from .transformation import *
# from .visualization import *
# importing the modules in a selective way
import utils.config
import utils.normalization
import utils.misc
import utils.lr_finder
| 24.071429 | 42 | 0.762611 | 45 | 337 | 5.666667 | 0.511111 | 0.196078 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163205 | 337 | 13 | 43 | 25.923077 | 0.904255 | 0.679525 | 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 |
d3bfaf1d9fa752290f67cc0958281b146d4daff0 | 98 | py | Python | threader/__init__.py | mwoolweaver/threader | fdb4fe9ab71d3c85146969f716d10b78f970323e | [
"MIT"
] | 34 | 2017-07-24T20:54:06.000Z | 2022-03-18T13:10:11.000Z | threader/__init__.py | mwoolweaver/threader | fdb4fe9ab71d3c85146969f716d10b78f970323e | [
"MIT"
] | 2 | 2019-05-28T07:21:15.000Z | 2019-07-23T21:45:43.000Z | threader/__init__.py | mwoolweaver/threader | fdb4fe9ab71d3c85146969f716d10b78f970323e | [
"MIT"
] | 8 | 2019-05-28T06:49:02.000Z | 2022-02-04T22:59:09.000Z | """Tools to quickly create twitter threads."""
from .thread import Threader
__version__ = "0.1.1" | 24.5 | 46 | 0.734694 | 14 | 98 | 4.857143 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035294 | 0.132653 | 98 | 4 | 47 | 24.5 | 0.764706 | 0.408163 | 0 | 0 | 0 | 0 | 0.09434 | 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 |
d3cb3a07ae3bcc910cc22e9e664b83887e73f8fe | 3,570 | py | Python | app/model.py | kurapikaaaa/CITS3403Project | 8958219845d5251830f2abd7c58dfd87d97b8c4a | [
"MIT"
] | 1 | 2021-08-04T12:50:57.000Z | 2021-08-04T12:50:57.000Z | app/model.py | kurapikaaaa/CITS3403Project | 8958219845d5251830f2abd7c58dfd87d97b8c4a | [
"MIT"
] | null | null | null | app/model.py | kurapikaaaa/CITS3403Project | 8958219845d5251830f2abd7c58dfd87d97b8c4a | [
"MIT"
] | 1 | 2021-08-12T10:40:28.000Z | 2021-08-12T10:40:28.000Z | from app import db, login
from flask_login import UserMixin
from datetime import datetime
from flask import url_for, redirect
from werkzeug.security import generate_password_hash, check_password_hash
class users(UserMixin, db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
username = db.Column(db.String(100), nullable=False, unique=True)
password = db.Column(db.String(96), nullable=False)
email = db.Column(db.String(128), nullable=False, unique=True)
firstname = db.Column(db.String(130), nullable=False)
lastname = db.Column(db.String(130), nullable=False)
lastLogin = db.Column(db.DateTime)
isActive = db.Column(db.Boolean)
isAdmin = db.Column(db.Boolean)
noteHighScore = db.Column(db.Integer)
KeyHighScore = db.Column(db.Integer)
submit = db.relationship("submission", backref="submitter")
###################################################
def __init__(self):
self.isActive = True
self.isAdmin = False
self.noteHighScore = 0
self.lastLogin = None
self.KeyHighScore = 0
def set_password(self, pwd):
self.password = generate_password_hash(pwd, method="sha384")
def check_password(self, pwd):
return check_password_hash(self.password, pwd)
def is_active(self):
return self.isActive
def validate(self):
if self.username and self.email and self.firstname and self.lastname:
return True
else:
return False
def getSubmissions(self):
res = submission.query.filter_by(creater_id=self.id).all()
return res
def __repr__(self):
return '<user %r>' % self.username
class submission(db.Model):
__tablename__ = 'submission'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
createdAt = db.Column(db.DateTime, nullable=False)
markedAt = db.Column(db.DateTime)
feedback = db.Column(db.Boolean)
totalmark = db.Column(db.Integer)
difficulty = db.Column(db.String(30), nullable=False)
passed = db.Column(db.Boolean)
creater_id = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=False)
answers = db.relationship("answer", backref="submission")
def __init__(self):
self.createdAt = datetime.utcnow()
self.markedAt = None
self.feedback = False
self.totalmark = None
self.marked = False
self.passed = False
def validate(self):
if self.difficulty and self.creater_id and self.createdAt:
return True
def __repr__(self):
return '<submission %r>' % self.id
class answer(db.Model):
__tablename__ = 'answer'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
answerSeq = db.Column(db.Integer)
submittedAnswer = db.Column(db.String(400))
feedback = db.Column(db.String(400))
markreceived = db.Column(db.Boolean)
submissionId = db.Column(db.Integer, db.ForeignKey("submission.id"))
def __init__(self):
self.feedback = None
self.markreceived = False
def validate(self):
if self.answerSeq and self.submittedAnswer and self.submissionId:
return True
else:
print("missingfield")
return False
def __repr__(self):
return '<ans>'
@login.user_loader
def load_user(usr_id):
return users.query.get(int(usr_id))
@login.unauthorized_handler
def unauthorized():
return redirect(url_for("auth.login"))
| 30.254237 | 81 | 0.654622 | 435 | 3,570 | 5.229885 | 0.241379 | 0.087912 | 0.10989 | 0.067253 | 0.169231 | 0.142418 | 0.094066 | 0.065934 | 0.065934 | 0.065934 | 0 | 0.009733 | 0.222969 | 3,570 | 117 | 82 | 30.512821 | 0.810382 | 0 | 0 | 0.213483 | 1 | 0 | 0.03809 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.168539 | false | 0.089888 | 0.05618 | 0.078652 | 0.741573 | 0.011236 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
d3d7b8b121c459940512749ce36dcfbad947c964 | 1,136 | py | Python | lexical/lexical.py | xmeng17/Malicious-URL-Detection | f286aeb50570455486b470cbc2db9aa0fae99b8f | [
"MIT"
] | null | null | null | lexical/lexical.py | xmeng17/Malicious-URL-Detection | f286aeb50570455486b470cbc2db9aa0fae99b8f | [
"MIT"
] | null | null | null | lexical/lexical.py | xmeng17/Malicious-URL-Detection | f286aeb50570455486b470cbc2db9aa0fae99b8f | [
"MIT"
] | null | null | null | import re
class lexical(object):
'''Lexical Features:
Top Level domain (str)
Number of dots in hostname (int)
Average token length of hostname (float)
Max token length of hostname (int)
Average token length of path (float)
Max token length of path (int)
'''
def __init__(self):
pass
def lexical(self,hostname,path):
dot_num=self.dots(hostname)
arr_host=self.split(hostname)
arr_path=self.split(path)
avg_host=self.avg(arr_host)
max_host=self.max(arr_host)
avg_path=self.avg(arr_path)
max_path=self.max(arr_path)
return dot_num,avg_host,max_host,avg_path,max_path
def dots(self,hostname):
# returns number of dots
return hostname.count('.')
def split(self,string):
# returns a list split by ‘/’, ‘?’, ‘.’, ‘=’, ‘-’ and ‘_’
return re.split('/|\?|\.|=|-|_', string)
def avg(self,arr):
# returns average token length
return sum(len(token) for token in arr)/len(arr)
def max(self,arr):
# returns max token length
return max(len(token) for token in arr) | 26.418605 | 70 | 0.617958 | 159 | 1,136 | 4.27673 | 0.27044 | 0.097059 | 0.076471 | 0.067647 | 0.214706 | 0.152941 | 0 | 0 | 0 | 0 | 0 | 0 | 0.260563 | 1,136 | 43 | 71 | 26.418605 | 0.809524 | 0.31338 | 0 | 0 | 0 | 0 | 0.018397 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.047619 | 0.047619 | 0.190476 | 0.619048 | 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 |
d3fa9c7a54272bce3d4b342c353619a4cf77a19a | 2,935 | py | Python | doit/exceptions.py | m4ta1l/doit | d1a1b7b3abc7641d977d3b78b580d97aea4e27ea | [
"MIT"
] | 1,390 | 2015-01-01T21:11:47.000Z | 2022-03-31T11:35:44.000Z | doit/exceptions.py | m4ta1l/doit | d1a1b7b3abc7641d977d3b78b580d97aea4e27ea | [
"MIT"
] | 393 | 2015-01-05T11:18:29.000Z | 2022-03-20T11:46:46.000Z | doit/exceptions.py | m4ta1l/doit | d1a1b7b3abc7641d977d3b78b580d97aea4e27ea | [
"MIT"
] | 176 | 2015-01-07T16:58:56.000Z | 2022-03-28T12:12:11.000Z | """Handle exceptions generated from 'user' code"""
import sys
import traceback
class InvalidCommand(Exception):
"""Invalid command line argument."""
def __init__(self, *args, **kwargs):
self.not_found = kwargs.pop('not_found', None)
super(InvalidCommand, self).__init__(*args, **kwargs)
self.cmd_used = None
self.bin_name = 'doit' # default but might be overwriten
def __str__(self):
if self.not_found is None:
return super(InvalidCommand, self).__str__()
if self.cmd_used:
msg_task_not_found = (
'command `{cmd_used}` invalid parameter: "{not_found}".' +
' Must be a task, or a target.\n' +
'Type "{bin_name} list" to see available tasks')
return msg_task_not_found.format(**self.__dict__)
else:
msg_cmd_task_not_found = (
'Invalid parameter: "{not_found}".' +
' Must be a command, task, or a target.\n' +
'Type "{bin_name} help" to see available commands.\n' +
'Type "{bin_name} list" to see available tasks.\n')
return msg_cmd_task_not_found.format(**self.__dict__)
class InvalidDodoFile(Exception):
"""Invalid dodo file"""
pass
class InvalidTask(Exception):
"""Invalid task instance. User error on specifying the task."""
pass
class CatchedException(object):
"""This used to save info from caught exceptions
The traceback from the original exception is saved
"""
def __init__(self, msg, exception=None):
self.message = msg
self.traceback = ''
if isinstance(exception, CatchedException):
self.traceback = exception.traceback
elif exception is not None:
# TODO remove doit-code part from traceback
self.traceback = traceback.format_exception(
exception.__class__, exception, sys.exc_info()[2])
def get_msg(self):
"""return full exception description (includes traceback)"""
return "%s\n%s" % (self.message, "".join(self.traceback))
def get_name(self):
"""get Exception name"""
return self.__class__.__name__
def __repr__(self):
return "(<%s> %s)" % (self.get_name(), self.message)
def __str__(self):
return "%s\n%s" % (self.get_name(), self.get_msg())
class TaskFailed(CatchedException):
"""Task execution was not successful."""
pass
class UnmetDependency(TaskFailed):
"""Task was not executed because a dependent task failed or is ignored"""
pass
class TaskError(CatchedException):
"""Error while trying to execute task."""
pass
class SetupError(CatchedException):
"""Error while trying to execute setup object"""
pass
class DependencyError(CatchedException):
"""Error while trying to check if task is up-to-date or saving task status"""
pass
| 29.35 | 81 | 0.627257 | 349 | 2,935 | 5.04298 | 0.326648 | 0.040909 | 0.027273 | 0.020455 | 0.235795 | 0.172727 | 0.096591 | 0.061364 | 0.039773 | 0 | 0 | 0.000461 | 0.260647 | 2,935 | 99 | 82 | 29.646465 | 0.810599 | 0.221806 | 0 | 0.163636 | 1 | 0 | 0.15183 | 0 | 0 | 0 | 0 | 0.010101 | 0 | 1 | 0.127273 | false | 0.127273 | 0.036364 | 0.036364 | 0.454545 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3105dd47d27bbfccfce90631a437c8b92d2e3fa8 | 212 | py | Python | examples/unread_sms.py | MikeRixWolfe/pygooglevoice | 1da84249e4ee3ecda921e7a20495074ff89a99cd | [
"BSD-3-Clause"
] | 1 | 2015-08-19T18:22:10.000Z | 2015-08-19T18:22:10.000Z | examples/unread_sms.py | MikeRixWolfe/pygooglevoice | 1da84249e4ee3ecda921e7a20495074ff89a99cd | [
"BSD-3-Clause"
] | null | null | null | examples/unread_sms.py | MikeRixWolfe/pygooglevoice | 1da84249e4ee3ecda921e7a20495074ff89a99cd | [
"BSD-3-Clause"
] | null | null | null | from googlevoice import Voice
voice = Voice()
voice.login()
for message in voice.sms().messages:
#if not message.isRead:
print(message.id, message.phoneNumber, message.messageText)
#message.mark(1)
| 21.2 | 63 | 0.726415 | 28 | 212 | 5.5 | 0.678571 | 0.194805 | 0.194805 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005587 | 0.15566 | 212 | 9 | 64 | 23.555556 | 0.854749 | 0.174528 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 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 |
312a2c813f2b31f42294655c9412690a04165f37 | 200 | py | Python | owtf/__main__.py | Udbhavbisarya23/owtf | 27623937677caf975569f8de8af7983ca57611bc | [
"BSD-3-Clause"
] | 1,514 | 2015-01-15T18:42:58.000Z | 2022-03-25T08:14:40.000Z | owtf/__main__.py | justdvnsh/owtf | 3a543b4eb2a7ad67155eb96dd2d99efbc181498d | [
"BSD-3-Clause"
] | 652 | 2015-01-09T18:27:37.000Z | 2022-03-21T18:41:01.000Z | owtf/__main__.py | justdvnsh/owtf | 3a543b4eb2a7ad67155eb96dd2d99efbc181498d | [
"BSD-3-Clause"
] | 506 | 2015-01-02T09:28:47.000Z | 2022-03-10T23:27:27.000Z | """
owtf.__main__
~~~~~~~~~~~~~
A __main__ method for OWTF so that internal services can be called as Python modules.
"""
import sys
from owtf.core import main
if __name__ == "__main__":
main()
| 16.666667 | 85 | 0.675 | 28 | 200 | 4.25 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.18 | 200 | 11 | 86 | 18.181818 | 0.72561 | 0.565 | 0 | 0 | 0 | 0 | 0.101266 | 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 |
313400b0bdd90b560bc3c6b261a67708f28e5651 | 608 | py | Python | src/config.py | forkedbranch/femm-opt | 78d9cd56510f781fe2643da4c2dadae002537d64 | [
"Apache-2.0"
] | 1 | 2016-05-03T13:58:00.000Z | 2016-05-03T13:58:00.000Z | src/config.py | forkedbranch/femm-opt | 78d9cd56510f781fe2643da4c2dadae002537d64 | [
"Apache-2.0"
] | null | null | null | src/config.py | forkedbranch/femm-opt | 78d9cd56510f781fe2643da4c2dadae002537d64 | [
"Apache-2.0"
] | null | null | null | # (c) Copyright 2016 forkedbranch (http://forkedbranch.eu/)
# Licensed under the Apache License, Version 2.0
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
def get_input_folder():
return config['DEFAULT']['InputFolder']
def get_output_folder():
return config['DEFAULT']['OutputForlder']
def get_femm_exe():
return config['DEFAULT']['FemmExe']
def get_ffmpeg_exe():
return config['DEFAULT']['FfmpegExe']
def get_femm_scr_templ():
return config['DEFAULT']['FemmScrTempl']
def get_femm_scr_lib():
return config['DEFAULT']['FemmScrLib'] | 24.32 | 59 | 0.717105 | 74 | 608 | 5.702703 | 0.513514 | 0.085308 | 0.270142 | 0.118483 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011429 | 0.136513 | 608 | 25 | 60 | 24.32 | 0.792381 | 0.171053 | 0 | 0 | 0 | 0 | 0.227092 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0.066667 | 0.4 | 0.866667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
31359392b650301014dc6082de0814c668402f3a | 742 | py | Python | tests/test_db_mathes_ui.py | AlexRovan/Python_training | 4878be4a7d354bd93e0e33b6e40a23a9592de213 | [
"Apache-2.0"
] | null | null | null | tests/test_db_mathes_ui.py | AlexRovan/Python_training | 4878be4a7d354bd93e0e33b6e40a23a9592de213 | [
"Apache-2.0"
] | null | null | null | tests/test_db_mathes_ui.py | AlexRovan/Python_training | 4878be4a7d354bd93e0e33b6e40a23a9592de213 | [
"Apache-2.0"
] | null | null | null | from model.group import Group
from model.contact import Contact
def test_group_list(app,db):
ui_group = app.group.get_groups_list()
def clean(group):
return Group(id=group.id, name=group.name.strip())
bd_group = map(clean,db.get_group_list())
assert sorted(ui_group,key=Group.id_or_max) == sorted(bd_group, key=Group.id_or_max)
def test_contact_list(app,db):
ui_contact = app.contact.get_contacts_list()
def clean(contact):
return Contact(id=contact.id,firstname = ''.join(contact.firstname.split(' ')),lastname = ''.join(contact.lastname.split(' ')))
bd_contact = map(clean,db.get_contact_list())
assert sorted(ui_contact,key=Contact.id_or_max) == sorted(bd_contact, key=Contact.id_or_max)
| 43.647059 | 135 | 0.725067 | 116 | 742 | 4.396552 | 0.258621 | 0.054902 | 0.054902 | 0.043137 | 0.203922 | 0.172549 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134771 | 742 | 16 | 136 | 46.375 | 0.794393 | 0 | 0 | 0 | 0 | 0 | 0.002695 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.285714 | false | 0 | 0.142857 | 0.142857 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
313df0c7ff39a3b7b860f162c9978fb31e8f55a5 | 248 | py | Python | python/simulator.py | chongdashu/puzzlescript-analyze | 0dfada4584428f7690e717d317d5396487e1f8d0 | [
"MIT"
] | 1 | 2016-02-10T14:06:43.000Z | 2016-02-10T14:06:43.000Z | python/simulator.py | chongdashu/puzzlescript-analyze | 0dfada4584428f7690e717d317d5396487e1f8d0 | [
"MIT"
] | null | null | null | python/simulator.py | chongdashu/puzzlescript-analyze | 0dfada4584428f7690e717d317d5396487e1f8d0 | [
"MIT"
] | null | null | null | __author__ = 'Chong-U Lim, culim@mit.edu'
import uinput
def Simulator():
def __init__(self):
pass
def test1(self):
device = uinput.Device([uinput.KEY_E, uinput.KEY_H, uinput.KEY_L, uinput.KEY_O])
device.emit_click(uinput.KEY_H)
| 11.809524 | 82 | 0.701613 | 39 | 248 | 4.102564 | 0.589744 | 0.28125 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004831 | 0.165323 | 248 | 20 | 83 | 12.4 | 0.768116 | 0 | 0 | 0 | 0 | 0 | 0.108787 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0.125 | 0.125 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
315b93d96e58679d201ae083e0a5ae302d382049 | 1,519 | py | Python | desktop_local_tests/windows/test_windows_public_ip_disrupt_reorder_adapters.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 219 | 2017-12-12T09:42:46.000Z | 2022-03-13T08:25:13.000Z | desktop_local_tests/windows/test_windows_public_ip_disrupt_reorder_adapters.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 11 | 2017-12-14T08:14:51.000Z | 2021-08-09T18:37:45.000Z | desktop_local_tests/windows/test_windows_public_ip_disrupt_reorder_adapters.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 45 | 2017-12-14T07:26:36.000Z | 2022-03-11T09:36:56.000Z | from desktop_local_tests.public_ip_during_disruption import PublicIPDuringDisruptionTestCase
from desktop_local_tests.windows.windows_reorder_adapters_disrupter import WindowsReorderAdaptersDisrupter
class TestWindowsPublicIPDisruptReorderAdapters(PublicIPDuringDisruptionTestCase):
'''Summary:
Tests whether traffic leaving the user's device has the public IP hidden when the adapter order
is changed.
Details:
This test will connect to VPN then swap the priority of the primary and secondary network
adapters. The test then queries a webpage to detect it's public IP.
Discussion:
It's not 100% clear if, in the real world, adapters can change their order without user
involvement. It is still however a good stress test of the application.
On Windows adapter order is determined by the interface metric. It can be manually set but
otherwise it is determined by the system by deciding how "good" an adapter is, e.g. what is the
throughput. In theory that means metrics can change dynamically.
Weaknesses:
The time taken to perform each IP request is relatively long. Tests using IPResponder should be
preferred over these tests.
Scenarios:
Requires two active adapters.
TODO:
Consider a variant which changes the network "Location". This is much more likely to be
something a user might do.
'''
def __init__(self, devices, parameters):
super().__init__(WindowsReorderAdaptersDisrupter, devices, parameters)
| 36.166667 | 106 | 0.768269 | 205 | 1,519 | 5.604878 | 0.629268 | 0.020888 | 0.02785 | 0.036554 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002453 | 0.194865 | 1,519 | 41 | 107 | 37.04878 | 0.93704 | 0.669519 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
3162214c539ed97be79534accd9664fa733e424a | 151 | py | Python | src/django_richenum/__init__.py | adepue/django-richenum | 20cacb6ee1c8f2ad9877dd647c21a3b3f37a4333 | [
"MIT"
] | null | null | null | src/django_richenum/__init__.py | adepue/django-richenum | 20cacb6ee1c8f2ad9877dd647c21a3b3f37a4333 | [
"MIT"
] | null | null | null | src/django_richenum/__init__.py | adepue/django-richenum | 20cacb6ee1c8f2ad9877dd647c21a3b3f37a4333 | [
"MIT"
] | null | null | null | __version__ = 'unknown'
try:
__version__ = __import__('pkg_resources').get_distribution('django_richenum').version
except Exception as e:
pass
| 25.166667 | 89 | 0.761589 | 17 | 151 | 5.882353 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13245 | 151 | 5 | 90 | 30.2 | 0.763359 | 0 | 0 | 0 | 0 | 0 | 0.231788 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3169b8c988e95bc8f6880f27dbdb8bd8e3429cbb | 1,949 | py | Python | gdxpds/test/conftest.py | cdgaete/gdx-pandas | 2b9b00a177268227bce189939cdab081e09cb0dc | [
"BSD-3-Clause"
] | 42 | 2016-02-24T04:23:24.000Z | 2022-02-02T09:42:18.000Z | gdxpds/test/conftest.py | cdgaete/gdx-pandas | 2b9b00a177268227bce189939cdab081e09cb0dc | [
"BSD-3-Clause"
] | 68 | 2015-08-06T14:25:22.000Z | 2022-01-03T13:38:51.000Z | gdxpds/test/conftest.py | cdgaete/gdx-pandas | 2b9b00a177268227bce189939cdab081e09cb0dc | [
"BSD-3-Clause"
] | 21 | 2017-04-25T06:21:42.000Z | 2021-08-24T14:01:27.000Z | # [LICENSE]
# Copyright (c) 2020, Alliance for Sustainable Energy.
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
# that the following conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# 2. Redistributions in binary form must reproduce the
# above copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or
# promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# [/LICENSE]
import pytest
def pytest_addoption(parser):
parser.addoption(
"--no-clean-up", action="store_true", default=False,
help="Pass this option to leave test outputs in place"
)
@pytest.fixture(scope="session",autouse=True)
def clean_up(request):
return (not request.config.getoption('--no-clean-up'))
| 39.77551 | 69 | 0.75372 | 273 | 1,949 | 5.369963 | 0.567766 | 0.024557 | 0.023192 | 0.031378 | 0.125512 | 0.092769 | 0.092769 | 0.092769 | 0.092769 | 0.092769 | 0 | 0.004378 | 0.179579 | 1,949 | 49 | 70 | 39.77551 | 0.912445 | 0.792201 | 0 | 0 | 0 | 0 | 0.243902 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.111111 | 0.111111 | 0.111111 | 0.444444 | 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 |
316f081d38d5db97224f8daf18cc8e5e6ca27466 | 138 | py | Python | reference/Python/media/moviepy/audio/extract_audio.py | steadylearner/code | ba6df6c38a6e25b7ea996f4df905921e27760e04 | [
"MIT"
] | 4 | 2019-07-17T14:43:32.000Z | 2022-03-27T21:38:01.000Z | reference/Python/media/moviepy/audio/extract_audio.py | steadylearner/code | ba6df6c38a6e25b7ea996f4df905921e27760e04 | [
"MIT"
] | 39 | 2020-09-04T03:31:16.000Z | 2022-03-08T22:54:03.000Z | reference/Python/media/moviepy/audio/extract_audio.py | steadylearner/code | ba6df6c38a6e25b7ea996f4df905921e27760e04 | [
"MIT"
] | 1 | 2021-03-03T13:04:28.000Z | 2021-03-03T13:04:28.000Z | import sys
from moviepy.editor import *
clip = VideoFileClip(sys.argv[1])
audioclip = clip.audio
audioclip.write_audiofile(sys.argv[2])
| 17.25 | 38 | 0.775362 | 20 | 138 | 5.3 | 0.7 | 0.132075 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01626 | 0.108696 | 138 | 7 | 39 | 19.714286 | 0.845528 | 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 |
3172a2c22ec1638c70e59d5c5b2388f4aa10d1ba | 788 | py | Python | backend/songwriter/migrations/0006_auto_20170902_0723.py | giliam/turbo-songwriter | 3d100b08dc19c60d7a1324120e06bd9f971eea5a | [
"MIT"
] | null | null | null | backend/songwriter/migrations/0006_auto_20170902_0723.py | giliam/turbo-songwriter | 3d100b08dc19c60d7a1324120e06bd9f971eea5a | [
"MIT"
] | 12 | 2017-09-25T20:13:29.000Z | 2020-02-12T00:12:41.000Z | backend/songwriter/migrations/0006_auto_20170902_0723.py | giliam/turbo-songwriter | 3d100b08dc19c60d7a1324120e06bd9f971eea5a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-09-02 05:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('songwriter', '0005_auto_20170824_1726'),
]
operations = [
migrations.AlterModelOptions(
name='author',
options={'ordering': ['lastname', 'firstname']},
),
migrations.AlterModelOptions(
name='chord',
options={'ordering': ['note']},
),
migrations.AlterModelOptions(
name='editor',
options={'ordering': ['name']},
),
migrations.AlterModelOptions(
name='theme',
options={'ordering': ['name']},
),
]
| 24.625 | 60 | 0.548223 | 65 | 788 | 6.523077 | 0.630769 | 0.254717 | 0.292453 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06055 | 0.308376 | 788 | 31 | 61 | 25.419355 | 0.717431 | 0.086294 | 0 | 0.416667 | 1 | 0 | 0.161785 | 0.032078 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 0.208333 | 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 |
3176a8260273b12af11896b419d23af210fafed0 | 268 | py | Python | WXApi/WXApi/__init__.py | KEDYY/pyweipi | 1bf2ecfb0d680b9ce35fe26b34d1025a8d942aab | [
"MIT"
] | 1 | 2018-05-22T15:10:14.000Z | 2018-05-22T15:10:14.000Z | WXApi/WXApi/__init__.py | KEDYY/pyweipi | 1bf2ecfb0d680b9ce35fe26b34d1025a8d942aab | [
"MIT"
] | null | null | null | WXApi/WXApi/__init__.py | KEDYY/pyweipi | 1bf2ecfb0d680b9ce35fe26b34d1025a8d942aab | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Create: 2014/5/20
Update: 2017/11/22
"""
from .WXError import *
from .WXMenu import *
from .WXUtils import *
from .event import *
from .request import MPCenter
__date__ = '2017/3/12'
__version__ = '1.0.1'
__license__ = 'The MIT License'
| 15.764706 | 31 | 0.671642 | 39 | 268 | 4.307692 | 0.717949 | 0.238095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116592 | 0.16791 | 268 | 16 | 32 | 16.75 | 0.636771 | 0.220149 | 0 | 0 | 0 | 0 | 0.144279 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.625 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
31820a59b9c5678cbd47dd2c6b18f2a2f8d3b779 | 2,986 | py | Python | pycket/base.py | krono/pycket | 5eff3401ce5cf34b16863b669ac9e274edabbe00 | [
"MIT"
] | null | null | null | pycket/base.py | krono/pycket | 5eff3401ce5cf34b16863b669ac9e274edabbe00 | [
"MIT"
] | null | null | null | pycket/base.py | krono/pycket | 5eff3401ce5cf34b16863b669ac9e274edabbe00 | [
"MIT"
] | null | null | null | from pycket.error import SchemeException
from rpython.tool.pairtype import extendabletype
from rpython.rlib import jit, objectmodel
class W_ProtoObject(object):
""" abstract base class of both actual values (W_Objects) and multiple
return values (Values)"""
_attrs_ = []
_settled_ = True
def as_real_value(self):
raise NotImplementedError("not a real value!")
def num_values(val):
raise NotImplementedError("not a real value!")
def get_value(val, index):
raise NotImplementedError("not a real value!")
def get_all_values(self):
raise NotImplementedError("not a real value!")
class W_Object(W_ProtoObject):
__metaclass__ = extendabletype
_attrs_ = []
errorname = "%%%%unreachable%%%%"
def __init__(self):
raise NotImplementedError("abstract base class")
def num_values(self):
return 1
def get_value(self, index):
assert index == 0
return self
def get_all_values(self):
return [self]
def iscallable(self):
return False
def call(self, args, env, cont):
raise SchemeException("%s is not callable" % self.tostring())
def call_with_extra_info(self, args, env, cont, calling_app):
return self.call(args, env, cont)
def enable_jitting(self):
pass # need to override in callables that are based on an AST
# an arity is a pair of a list of numbers and either -1 or a non-negative integer
def get_arity(self):
from pycket.interpreter import Arity
if self.iscallable():
return Arity.unknown
else:
raise SchemeException("%s does not have arity" % self.tostring())
def is_proper_list(self):
return False
def is_impersonator(self):
return self.is_chaperone()
def is_chaperone(self):
return False
def is_proxy(self):
return self.is_chaperone() or self.is_impersonator()
def get_proxied(self):
return self
def get_properties(self):
return {}
def is_non_interposing_chaperone(self):
return False
def immutable(self):
return False
def equal(self, other):
return self is other # default implementation
def eqv(self, other):
return self is other # default implementation
def hash_equal(self):
return objectmodel.compute_hash(self) # default implementation
hash_eqv = hash_equal
def tostring(self):
return str(self)
# for expose
@classmethod
def make_unwrapper(cls):
if cls is W_Object:
return lambda x: x, ''
def unwrap(w_object):
if isinstance(w_object, cls):
return w_object
return None
return unwrap, cls.errorname
class SingletonMeta(type):
def __new__(cls, name, bases, dct):
result = type.__new__(cls, name, bases, dct)
result.singleton = result()
return result
| 27.394495 | 85 | 0.639987 | 370 | 2,986 | 4.991892 | 0.348649 | 0.070384 | 0.040606 | 0.048728 | 0.256091 | 0.172713 | 0.146724 | 0.100704 | 0.054142 | 0 | 0 | 0.00139 | 0.277294 | 2,986 | 108 | 86 | 27.648148 | 0.854495 | 0.102143 | 0 | 0.2125 | 0 | 0 | 0.054805 | 0 | 0 | 0 | 0 | 0 | 0.0125 | 1 | 0.35 | false | 0.0125 | 0.05 | 0.2 | 0.8 | 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 |
31860bb3aacd1e3679ae7c59b51984c300ac1f34 | 3,078 | py | Python | npbench/benchmarks/cavity_flow/cavity_flow_legate.py | frahlg/npbench | 1bc4d9e2e22f3ca67fa2bc7f40e2e751a9c8dd26 | [
"BSD-3-Clause"
] | 27 | 2021-05-10T11:49:13.000Z | 2022-03-22T18:07:19.000Z | npbench/benchmarks/cavity_flow/cavity_flow_legate.py | frahlg/npbench | 1bc4d9e2e22f3ca67fa2bc7f40e2e751a9c8dd26 | [
"BSD-3-Clause"
] | 3 | 2021-12-01T13:03:17.000Z | 2022-03-17T10:53:00.000Z | npbench/benchmarks/cavity_flow/cavity_flow_legate.py | frahlg/npbench | 1bc4d9e2e22f3ca67fa2bc7f40e2e751a9c8dd26 | [
"BSD-3-Clause"
] | 7 | 2021-06-24T03:40:25.000Z | 2022-01-26T09:04:33.000Z | # Barba, Lorena A., and Forsyth, Gilbert F. (2018).
# CFD Python: the 12 steps to Navier-Stokes equations.
# Journal of Open Source Education, 1(9), 21,
# https://doi.org/10.21105/jose.00021
# TODO: License
# (c) 2017 Lorena A. Barba, Gilbert F. Forsyth.
# All content is under Creative Commons Attribution CC-BY 4.0,
# and all code is under BSD-3 clause (previously under MIT, and changed on March 8, 2018).
import legate.numpy as np
def build_up_b(b, rho, dt, u, v, dx, dy):
b[1:-1,
1:-1] = (rho * (1 / dt * ((u[1:-1, 2:] - u[1:-1, 0:-2]) / (2 * dx) +
(v[2:, 1:-1] - v[0:-2, 1:-1]) / (2 * dy)) -
((u[1:-1, 2:] - u[1:-1, 0:-2]) / (2 * dx))**2 - 2 *
((u[2:, 1:-1] - u[0:-2, 1:-1]) / (2 * dy) *
(v[1:-1, 2:] - v[1:-1, 0:-2]) / (2 * dx)) -
((v[2:, 1:-1] - v[0:-2, 1:-1]) / (2 * dy))**2))
def pressure_poisson(nit, p, dx, dy, b):
pn = np.empty_like(p)
pn = p.copy()
for q in range(nit):
pn = p.copy()
p[1:-1, 1:-1] = (((pn[1:-1, 2:] + pn[1:-1, 0:-2]) * dy**2 +
(pn[2:, 1:-1] + pn[0:-2, 1:-1]) * dx**2) /
(2 * (dx**2 + dy**2)) - dx**2 * dy**2 /
(2 * (dx**2 + dy**2)) * b[1:-1, 1:-1])
p[:, -1] = p[:, -2] # dp/dx = 0 at x = 2
p[0, :] = p[1, :] # dp/dy = 0 at y = 0
p[:, 0] = p[:, 1] # dp/dx = 0 at x = 0
p[-1, :] = 0 # p = 0 at y = 2
def cavity_flow(nx, ny, nt, nit, u, v, dt, dx, dy, p, rho, nu):
un = np.empty_like(u)
vn = np.empty_like(v)
b = np.zeros((ny, nx))
for n in range(nt):
un = u.copy()
vn = v.copy()
build_up_b(b, rho, dt, u, v, dx, dy)
pressure_poisson(nit, p, dx, dy, b)
u[1:-1,
1:-1] = (un[1:-1, 1:-1] - un[1:-1, 1:-1] * dt / dx *
(un[1:-1, 1:-1] - un[1:-1, 0:-2]) -
vn[1:-1, 1:-1] * dt / dy *
(un[1:-1, 1:-1] - un[0:-2, 1:-1]) - dt / (2 * rho * dx) *
(p[1:-1, 2:] - p[1:-1, 0:-2]) + nu *
(dt / dx**2 *
(un[1:-1, 2:] - 2 * un[1:-1, 1:-1] + un[1:-1, 0:-2]) +
dt / dy**2 *
(un[2:, 1:-1] - 2 * un[1:-1, 1:-1] + un[0:-2, 1:-1])))
v[1:-1,
1:-1] = (vn[1:-1, 1:-1] - un[1:-1, 1:-1] * dt / dx *
(vn[1:-1, 1:-1] - vn[1:-1, 0:-2]) -
vn[1:-1, 1:-1] * dt / dy *
(vn[1:-1, 1:-1] - vn[0:-2, 1:-1]) - dt / (2 * rho * dy) *
(p[2:, 1:-1] - p[0:-2, 1:-1]) + nu *
(dt / dx**2 *
(vn[1:-1, 2:] - 2 * vn[1:-1, 1:-1] + vn[1:-1, 0:-2]) +
dt / dy**2 *
(vn[2:, 1:-1] - 2 * vn[1:-1, 1:-1] + vn[0:-2, 1:-1])))
u[0, :] = 0
u[:, 0] = 0
u[:, -1] = 0
u[-1, :] = 1 # set velocity on cavity lid equal to 1
v[0, :] = 0
v[-1, :] = 0
v[:, 0] = 0
v[:, -1] = 0
| 37.084337 | 90 | 0.341131 | 549 | 3,078 | 1.894353 | 0.187614 | 0.173077 | 0.109615 | 0.073077 | 0.391346 | 0.346154 | 0.3125 | 0.235577 | 0.235577 | 0.229808 | 0 | 0.156233 | 0.403184 | 3,078 | 82 | 91 | 37.536585 | 0.409907 | 0.163093 | 0 | 0.135593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012195 | 0 | 1 | 0.050847 | false | 0 | 0.016949 | 0 | 0.067797 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
31d152e1371b0f6b06f2bd25172cc000079294dd | 71 | py | Python | html/en/reference/graphs/sage/graphs/graph_plot-2.py | sagemath/documentation | 65dcf569b6e95bfae7c76b40a46af3a9f77479f4 | [
"Apache-2.0"
] | 10 | 2015-05-17T10:52:08.000Z | 2022-03-28T12:15:09.000Z | html/en/reference/graphs/sage/graphs/graph_plot-2.py | sagemath/documentation | 65dcf569b6e95bfae7c76b40a46af3a9f77479f4 | [
"Apache-2.0"
] | 19 | 2015-05-15T17:06:31.000Z | 2021-08-25T09:13:17.000Z | html/en/reference/graphs/sage/graphs/graph_plot-2.py | sagemath/documentation | 65dcf569b6e95bfae7c76b40a46af3a9f77479f4 | [
"Apache-2.0"
] | 21 | 2015-12-15T21:19:29.000Z | 2022-01-03T14:24:20.000Z | petersen_spring = Graph(':I`ES@obGkqegW~')
sphinx_plot(petersen_spring) | 35.5 | 42 | 0.802817 | 10 | 71 | 5.4 | 0.8 | 0.518519 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042254 | 71 | 2 | 43 | 35.5 | 0.794118 | 0 | 0 | 0 | 0 | 0 | 0.208333 | 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 |
31d28cfa4763d607d589139656b5abdc86e64785 | 77 | py | Python | last_char.py | AkhilaSaiBejjarapu/Python | 238cc7692cf2e93eb585a03967b8d688ee3760f2 | [
"MIT"
] | null | null | null | last_char.py | AkhilaSaiBejjarapu/Python | 238cc7692cf2e93eb585a03967b8d688ee3760f2 | [
"MIT"
] | null | null | null | last_char.py | AkhilaSaiBejjarapu/Python | 238cc7692cf2e93eb585a03967b8d688ee3760f2 | [
"MIT"
] | null | null | null | word=input()
last_letter=(len(word)-1)
result=word[last_letter]
print(result) | 19.25 | 25 | 0.779221 | 13 | 77 | 4.461538 | 0.615385 | 0.344828 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013514 | 0.038961 | 77 | 4 | 26 | 19.25 | 0.77027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
31d7a9d787341b47673ced552899077d803f3aa3 | 1,934 | py | Python | tutorials.py | Xython/pattern-matching | 17ccdb68189353f1c63032013f5ef6f1ca4c0902 | [
"MIT"
] | 20 | 2017-12-31T05:45:47.000Z | 2021-05-15T22:08:21.000Z | tutorials.py | Xython/Destruct.py | 17ccdb68189353f1c63032013f5ef6f1ca4c0902 | [
"MIT"
] | null | null | null | tutorials.py | Xython/Destruct.py | 17ccdb68189353f1c63032013f5ef6f1ca4c0902 | [
"MIT"
] | 1 | 2018-01-12T04:54:19.000Z | 2018-01-12T04:54:19.000Z | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 30 17:03:01 2017
@author: misakawa
"""
from pattern_matching import Match, when, var, T, t, _, overwrite
from numpy.random import randint
@overwrite(var[(t == int) | (t == float)], var[(t == int) | (t == float)])
def add(a, b):
return a + b
@when(var[t == str], var[t == str])
def add(a, b):
return a + b
class Bound1:
pass
class Bound2:
pass
class Bound3(Bound1, Bound2):
def __repr__(self):
return "bound3"
class Bound4(Bound3):
pass
@when(_[(t != Bound3) & (t < Bound4)])
def add():
return 2
@when(_)
def add():
return 3
assert add(1, 1) == 2
assert add(Bound2()) == 2
assert add(Bound3()) == 3
@when(_[int], _[Bound1], var)
def add(u):
return u
assert add(1, Bound1(), 'last') == 'last'
def is_type(x):
return isinstance(x, type)
m = Match(1, 2, (3, int))
[a, b, c] = m.case(var[int], var, *var[tuple]).get
assert a == 1 and b == 2 and c == ((3, int), )
[c2] = m.case((_, _, (_, var.when(is_type)))).get
assert c2 == int
@overwrite(_ == None)
def summary():
return 0
@when([var[int], *(_ == [])], var)
def summary(head, res):
return head + res
@when([var[int], *var[list]], var)
def summary(head, tail, res):
return summary(tail, res + head)
@when(var[list])
def summary(lst):
return summary(lst, 0)
assert summary(list(range(100))) == 4950
@overwrite([var, *var])
def qsort(head, tail):
lowers = [i for i in tail if i < head]
highers = [i for i in tail if i >= head]
return qsort(lowers) + [head] + qsort(highers)
@when(var)
def qsort(lst):
return lst
qsort(randint(0, 500, size=(1200, )))
@when(_[t.when(lambda _: _ == int)])
def trait_test():
return 1
assert trait_test(1) == 1
class Population:
num: int = 1000
@when(var[t.when(lambda _: hasattr(_, 'num'))])
def trait_test(x):
return x.num
assert trait_test(Population()) == 1000
| 14.763359 | 74 | 0.588418 | 300 | 1,934 | 3.706667 | 0.29 | 0.044065 | 0.021583 | 0.014388 | 0.084532 | 0.061151 | 0.061151 | 0.032374 | 0 | 0 | 0 | 0.047082 | 0.220269 | 1,934 | 130 | 75 | 14.876923 | 0.690318 | 0.039814 | 0 | 0.130435 | 0 | 0 | 0.009194 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 1 | 0.217391 | false | 0.043478 | 0.028986 | 0.202899 | 0.550725 | 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 |
31e44da249242c3967f376c2f079200c57cbe554 | 155 | py | Python | Python/Tests/TestData/TestDiscoverer/ConfigUnittest/Product/prefix_not_included.py | techkey/PTVS | 8355e67eedd8e915ca49bd38a2f36172696fd903 | [
"Apache-2.0"
] | 404 | 2019-05-07T02:21:57.000Z | 2022-03-31T17:03:04.000Z | Python/Tests/TestData/TestDiscoverer/ConfigUnittest/Product/prefix_not_included.py | techkey/PTVS | 8355e67eedd8e915ca49bd38a2f36172696fd903 | [
"Apache-2.0"
] | 1,672 | 2019-05-06T21:09:38.000Z | 2022-03-31T23:16:04.000Z | Python/Tests/TestData/TestDiscoverer/ConfigUnittest/Product/prefix_not_included.py | techkey/PTVS | 8355e67eedd8e915ca49bd38a2f36172696fd903 | [
"Apache-2.0"
] | 186 | 2019-05-13T03:17:37.000Z | 2022-03-31T16:24:05.000Z | import unittest
class PrefixNotIncluded(unittest.TestCase):
def test_not_included(self):
pass
if __name__ == '__main__':
unittest.main()
| 17.222222 | 43 | 0.709677 | 17 | 155 | 5.882353 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.193548 | 155 | 8 | 44 | 19.375 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.051613 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.166667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
9ed4c95b11ddd761bdc51c8d9a831201ff7973eb | 1,080 | py | Python | pandas_support/test_pandas_support.py | quanbingDG/sharper | 4cd5c6b3238d5e430d5986829cc4e0bb47ab3dff | [
"MIT"
] | null | null | null | pandas_support/test_pandas_support.py | quanbingDG/sharper | 4cd5c6b3238d5e430d5986829cc4e0bb47ab3dff | [
"MIT"
] | 2 | 2021-01-13T03:39:15.000Z | 2021-01-19T08:50:18.000Z | pandas_support/test_pandas_support.py | quanbingDG/sharper | 4cd5c6b3238d5e430d5986829cc4e0bb47ab3dff | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# @Time : 2020/11/9 9:13 下午
# @Author : quanbing
# @Email : quanbinks@sina.com
import pandas as pd
import numpy as np
from unittest import TestCase
from pandas_support import PandasSupport as PS
# @File : test_pandas_support.py
class TestPandasSupport(TestCase):
def setUp(self) -> None:
self._test_frame = pd.DataFrame(np.array([1, 2, 3, 4]).reshape(2, 2), columns=['i1', 'i2'])
def test_check_cols(self):
self.assertEqual(PS.check_cols(['col1', 'col2'], ['col1']), True)
self.assertEqual(PS.check_cols(['col1', 'col2'], ['col']), False)
self.assertEqual(PS.check_cols(['col1', 'col2'], ['col1', 'col3']), False)
self.assertEqual(PS.check_cols(['col1', 'col2'], 'col1'), True)
def test_add_ratio(self):
self.assertEqual(PS.add_ratio(self._test_frame, ['i1']).columns.__len__(), 3)
self.assertEqual(PS.add_ratio(self._test_frame, ['i1'], csum=True).columns.__len__(), 4)
def test_add_csum(self):
self.assertEqual(PS.add_csum(self._test_frame, 'i1').columns.__len__(), 3)
| 38.571429 | 99 | 0.655556 | 154 | 1,080 | 4.363636 | 0.38961 | 0.15625 | 0.177083 | 0.130952 | 0.462798 | 0.421131 | 0.421131 | 0.315476 | 0.315476 | 0 | 0 | 0.040839 | 0.161111 | 1,080 | 27 | 100 | 40 | 0.700883 | 0.115741 | 0 | 0 | 0 | 0 | 0.064278 | 0 | 0 | 0 | 0 | 0 | 0.411765 | 1 | 0.235294 | false | 0 | 0.235294 | 0 | 0.529412 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
9effc7a4839375e16dbdf0896beb3c70b1e21234 | 154 | py | Python | setup.py | Minterious/minter-monitoring | 1a2216be57dec491a970950c3b9cfc72cea228c2 | [
"MIT"
] | 2 | 2019-08-24T12:15:20.000Z | 2019-08-24T12:19:07.000Z | setup.py | Minterious/minter-monitoring | 1a2216be57dec491a970950c3b9cfc72cea228c2 | [
"MIT"
] | null | null | null | setup.py | Minterious/minter-monitoring | 1a2216be57dec491a970950c3b9cfc72cea228c2 | [
"MIT"
] | 1 | 2019-09-19T21:16:25.000Z | 2019-09-19T21:16:25.000Z | import setuptools
setuptools.setup(
name='mintermonitoring',
version='1.0.0',
packages=setuptools.find_packages(include=['mintermonitoring'])
)
| 19.25 | 66 | 0.746753 | 16 | 154 | 7.125 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021898 | 0.11039 | 154 | 7 | 67 | 22 | 0.810219 | 0 | 0 | 0 | 0 | 0 | 0.24026 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7303a20740842e72c83f9691beba5498f652855d | 105 | py | Python | py/Utility.GetData.py | mathematicalmichael/SpringNodes | 3ff4034b6e57ee6efa55c963e1819f3d30a2c4ab | [
"MIT"
] | 51 | 2015-09-25T09:30:57.000Z | 2022-01-19T14:16:44.000Z | py/Utility.GetData.py | sabeelcoder/SpringNodes | e21a24965474d54369e74d23c06f8c42a7b926b5 | [
"MIT"
] | 66 | 2015-09-30T02:43:32.000Z | 2022-03-31T02:26:52.000Z | py/Utility.GetData.py | sabeelcoder/SpringNodes | e21a24965474d54369e74d23c06f8c42a7b926b5 | [
"MIT"
] | 48 | 2015-11-19T01:34:47.000Z | 2022-02-25T17:26:48.000Z | import System
dataKey, _ = IN
OUT = System.AppDomain.CurrentDomain.GetData("_Dyn_Wireless_%s" % dataKey) | 26.25 | 74 | 0.780952 | 13 | 105 | 6 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104762 | 105 | 4 | 74 | 26.25 | 0.829787 | 0 | 0 | 0 | 0 | 0 | 0.150943 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
730d40eb64f626d437281807fa30ca37ecd18cc5 | 1,119 | py | Python | common/src/stack/command/stack/commands/set/firmware/model/imp/__init__.py | kmcm0/stacki | eb9dff1b45d5725b4986e567876bf61707fec28f | [
"BSD-3-Clause"
] | 123 | 2015-05-12T23:36:45.000Z | 2017-07-05T23:26:57.000Z | common/src/stack/command/stack/commands/set/firmware/model/imp/__init__.py | kmcm0/stacki | eb9dff1b45d5725b4986e567876bf61707fec28f | [
"BSD-3-Clause"
] | 177 | 2015-06-05T19:17:47.000Z | 2017-07-07T17:57:24.000Z | common/src/stack/command/stack/commands/set/firmware/model/imp/__init__.py | kmcm0/stacki | eb9dff1b45d5725b4986e567876bf61707fec28f | [
"BSD-3-Clause"
] | 32 | 2015-06-07T02:25:03.000Z | 2017-06-23T07:35:35.000Z | # @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# https://github.com/Teradata/stacki/blob/master/LICENSE-ROCKS.txt
# @rocks@
import stack.commands
class Command(stack.commands.set.firmware.command):
"""
Associates a firmware implementation with one or more models.
<arg type='string' name='models'>
One or more models to associate the implementation with.
</arg>
<param type='string' name='imp'>
The name of the implementation to associate with the provided models.
</param>
<param type='string' name='make'>
The make of the models.
</param>
<example cmd="set firmware model imp m7800 m6036 imp=mellanox_6xxx_7xxx make=mellanox">
Sets the mellanox_6xxx_7xxx implementation as the one to run for the models m7800 and m6036 for make mellanox.
</example>
"""
def run(self, params, args):
self.runPlugins(args = (params, args))
| 29.447368 | 111 | 0.739946 | 165 | 1,119 | 4.993939 | 0.448485 | 0.018204 | 0.050971 | 0.053398 | 0.109223 | 0.109223 | 0.109223 | 0.109223 | 0 | 0 | 0 | 0.040667 | 0.142985 | 1,119 | 37 | 112 | 30.243243 | 0.818561 | 0.827525 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
732dd28306f669f7a332fd1f3c061993b13d2ff5 | 800 | py | Python | quiz/bot/storage/shelter.py | shubham-king/guess-the-melody | 1658a17f41b39cfd212175a03e043b3be7bc0e56 | [
"MIT"
] | 4 | 2019-06-15T15:32:43.000Z | 2020-02-21T09:45:36.000Z | quiz/bot/storage/shelter.py | shubham-king/guess-the-melody | 1658a17f41b39cfd212175a03e043b3be7bc0e56 | [
"MIT"
] | 4 | 2020-07-05T07:20:26.000Z | 2021-04-25T21:05:53.000Z | quiz/bot/storage/shelter.py | shubham-king/guess-the-melody | 1658a17f41b39cfd212175a03e043b3be7bc0e56 | [
"MIT"
] | 7 | 2020-06-13T20:11:41.000Z | 2021-11-09T07:47:02.000Z | from shelve import DbfilenameShelf, open
from typing import Type
from quiz.config import Config
from quiz.types import ContextManager, DictAccess
class Shelter(ContextManager, DictAccess):
"""Interface for bot shelter."""
def __init__(self, config: Type[Config]) -> None:
self._shelter: DbfilenameShelf = open(config.shelve_name)
def __enter__(self) -> "Shelter":
return self
def __getitem__(self, item: str) -> int:
return self._shelter[item]
def __setitem__(self, key: str, value: int) -> None:
self._shelter[key] = value
def __delitem__(self, key: str) -> None:
del self._shelter[key]
def close(self) -> None:
self._shelter.close()
def __exit__(self, exc_type, exc_val, exc_tb) -> None:
self.close()
| 26.666667 | 65 | 0.665 | 99 | 800 | 5.040404 | 0.383838 | 0.132265 | 0.09018 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2225 | 800 | 29 | 66 | 27.586207 | 0.802251 | 0.0325 | 0 | 0 | 0 | 0 | 0.009115 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.368421 | false | 0 | 0.210526 | 0.105263 | 0.736842 | 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 |
73321c0acbdf4ab01ceed6d568aada4c5a634a97 | 125 | py | Python | src/applications/task310/apps.py | SergeyNazarovSam/SergeyPythonfirst | fd2bddf1f5ba28c6802be921177917f369f7ef2e | [
"MIT"
] | 2 | 2020-12-17T20:19:21.000Z | 2020-12-22T12:46:43.000Z | src/applications/task310/apps.py | alexander-sidorov/tms-z43 | 61ecd204f5de4e97ff0300f6ef91c36c2bcda31c | [
"MIT"
] | 4 | 2021-04-20T08:40:30.000Z | 2022-02-10T07:50:30.000Z | src/applications/task310/apps.py | SergeyNazarovSam/SergeyPythonfirst | fd2bddf1f5ba28c6802be921177917f369f7ef2e | [
"MIT"
] | 1 | 2021-02-10T06:42:19.000Z | 2021-02-10T06:42:19.000Z | from django.apps import AppConfig
class Task310Config(AppConfig):
label = "task310"
name = f"applications.{label}"
| 17.857143 | 34 | 0.72 | 14 | 125 | 6.428571 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058252 | 0.176 | 125 | 6 | 35 | 20.833333 | 0.815534 | 0 | 0 | 0 | 0 | 0 | 0.216 | 0 | 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 |
733fd1e0e78df5be2052554568f783ebcd9a6ad0 | 1,741 | py | Python | Cursos/Alura/Python3_Avancando_na_orientacao_a_objetos/models_playlist3.py | ramonvaleriano/python- | ada70918e945e8f2d3b59555e9ccc35cf0178dbd | [
"MIT"
] | null | null | null | Cursos/Alura/Python3_Avancando_na_orientacao_a_objetos/models_playlist3.py | ramonvaleriano/python- | ada70918e945e8f2d3b59555e9ccc35cf0178dbd | [
"MIT"
] | null | null | null | Cursos/Alura/Python3_Avancando_na_orientacao_a_objetos/models_playlist3.py | ramonvaleriano/python- | ada70918e945e8f2d3b59555e9ccc35cf0178dbd | [
"MIT"
] | null | null | null | class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self.ano = ano
self._likes = 0
@property
def likes(self):
return self._likes
def dar_like(self):
self._likes += 1
@property
def nome(self):
return self._nome
@nome.setter
def nome(self, novo_nome):
self._nome = novo_nome.title()
def __str__(self):
return f'{self.nome} - {self.ano} - {self.likes}'
class Filme(Programa):
def __init__(self, nome, ano, duracao):
super().__init__(nome, ano)
self.duracao = duracao
def __str__(self):
return f'{self.nome} - {self.ano} - {self.duracao} min - {self.likes}'
class Serie(Programa):
def __init__(self, nome, ano, temporadas):
super(Serie, self).__init__(nome, ano)
self.temporadas = temporadas
def __str__(self):
return f'{self.nome} - {self.ano} - {self.temporadas} temporadas - {self.likes}'
class Playlist:
def __init__(self, nome, programas):
self.nome = nome.title()
self._programas = programas
def __getitem__(self, item):
return self._programas[item]
@property
def listagem(self):
return self._programas
def __len__(self):
return len(self._programas)
vingadores = Filme('Vigadores - Guerra Infinita', 2018, 160)
atlanta = Serie('Atlatan', 2018, 2)
tmep = Filme('Todo mundo em pânico', 1999, 100)
demolidor = Serie('Demolidor', 2016, 2)
filmes_e_series = [vingadores, atlanta, demolidor, tmep]
playlist_fim_de_semana = Playlist('fim de semana', filmes_e_series)
print(f'Tamonho do playlist: {len(playlist_fim_de_semana)}')
for dados in playlist_fim_de_semana:
print(dados) | 24.871429 | 88 | 0.638713 | 221 | 1,741 | 4.714932 | 0.276018 | 0.084453 | 0.042226 | 0.057582 | 0.21881 | 0.178503 | 0.103647 | 0.103647 | 0.103647 | 0.103647 | 0 | 0.019564 | 0.236646 | 1,741 | 70 | 89 | 24.871429 | 0.764485 | 0 | 0 | 0.12 | 0 | 0.04 | 0.169346 | 0.016648 | 0 | 0 | 0 | 0 | 0 | 1 | 0.28 | false | 0 | 0 | 0.16 | 0.52 | 0.04 | 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 |
734586c386b99571285203cdfc4477ce123175a7 | 19,442 | py | Python | tests/test_util_owsutil.py | TimFranken/pydov | da393129207c93ab845a28525864c13374459dbf | [
"MIT"
] | null | null | null | tests/test_util_owsutil.py | TimFranken/pydov | da393129207c93ab845a28525864c13374459dbf | [
"MIT"
] | null | null | null | tests/test_util_owsutil.py | TimFranken/pydov | da393129207c93ab845a28525864c13374459dbf | [
"MIT"
] | null | null | null | """Module grouping tests for the pydov.util.owsutil module."""
import copy
import re
import pytest
from numpy.compat import unicode
from owslib.etree import etree
from owslib.fes import (
PropertyIsEqualTo,
FilterRequest,
)
from owslib.iso import MD_Metadata
from owslib.util import nspath_eval
from pydov.util import owsutil
from pydov.util.errors import (
MetadataNotFoundError,
FeatureCatalogueNotFoundError,
)
from pydov.util.location import (
Within,
Box,
)
from tests.test_search_boring import (
md_metadata,
mp_remote_md,
mp_remote_describefeaturetype,
mp_remote_fc,
location_md_metadata,
location_fc_featurecatalogue,
location_wfs_describefeaturetype,
)
from tests.test_search import (
wfs,
mp_wfs,
mp_remote_fc_notfound
)
def clean_xml(xml):
"""Clean the given XML string of namespace definition, namespace
prefixes and syntactical but otherwise meaningless differences.
Parameters
----------
xml : str
String representation of XML document.
Returns
-------
str
String representation of cleaned XML document.
"""
# remove xmlns namespace definitions
r = re.sub(r'[ ]+xmlns:[^=]+="[^"]+"', '', xml)
# remove namespace prefixes in tags
r = re.sub(r'<(/?)[^:]+:([^ >]+)([ >])', r'<\1\2\3', r)
# remove extra spaces in tags
r = re.sub(r'[ ]+/>', '/>', r)
# remove extra spaces between tags
r = re.sub(r'>[ ]+<', '><', r)
return r
class TestOwsutil(object):
"""Class grouping tests for the pydov.util.owsutil module."""
def test_get_csw_base_url(self, wfs):
"""Test the owsutil.get_csw_base_url method.
Test whether the CSW base URL of the dov-pub:Boringen layer is correct.
Parameters
----------
wfs : pytest.fixture returning owslib.wfs.WebFeatureService
WebFeatureService based on the local GetCapabilities.
"""
contentmetadata = wfs.contents['dov-pub:Boringen']
assert owsutil.get_csw_base_url(contentmetadata) == \
'https://www.dov.vlaanderen.be/geonetwork/srv/nl/csw'
def test_get_csw_base_url_nometadataurls(self, wfs):
"""Test the owsutil.get_csw_base_url method for a layer without
metdata urls.
Test whether a MetadataNotFoundError is raised.
Parameters
----------
wfs : pytest.fixture returning owslib.wfs.WebFeatureService
WebFeatureService based on the local GetCapabilities.
"""
contents = copy.deepcopy(wfs.contents)
contentmetadata = contents['dov-pub:Boringen']
contentmetadata.metadataUrls = []
with pytest.raises(MetadataNotFoundError):
owsutil.get_csw_base_url(contentmetadata)
def test_get_featurecatalogue_uuid(self, md_metadata):
"""Test the owsutil.get_featurecatalogue_uuid method.
Test whether the featurecatalogue uuid of the dov-pub:Boringen layer
is correct.
Parameters
----------
md_metadata : pytest.fixture providing owslib.iso.MD_Metadata
Parsed metadata describing the Boringen WFS layer in more detail,
in the ISO 19115/19139 format.
"""
assert owsutil.get_featurecatalogue_uuid(md_metadata) == \
'c0cbd397-520f-4ee1-aca7-d70e271eeed6'
def test_get_featurecatalogue_uuid_nocontentinfo(self, md_metadata):
"""Test the owsutil.get_featurecatalogue_uuid method when the
metadata is missing the gmd:contentInfo element.
Test whether a FeatureCatalogueNotFoundError is raised.
Parameters
----------
md_metadata : pytest.fixture providing owslib.iso.MD_Metadata
Parsed metadata describing the Boringen WFS layer in more detail,
in the ISO 19115/19139 format.
"""
tree = etree.fromstring(md_metadata.xml)
root = tree.find('{http://www.isotc211.org/2005/gmd}MD_Metadata')
for ci in tree.findall(
'.//{http://www.isotc211.org/2005/gmd}contentInfo'):
root.remove(ci)
md_metadata.xml = etree.tostring(tree)
with pytest.raises(FeatureCatalogueNotFoundError):
owsutil.get_featurecatalogue_uuid(md_metadata)
def test_get_featurecatalogue_uuid_nouuidref(self, md_metadata):
"""Test the owsutil.get_featurecatalogue_uuid method when the
gmd:contentInfo element is missing a 'uuidref' attribute.
Test whether a FeatureCatalogueNotFoundError is raised.
Parameters
----------
md_metadata : pytest.fixture providing owslib.iso.MD_Metadata
Parsed metadata describing the Boringen WFS layer in more detail,
in the ISO 19115/19139 format.
"""
tree = etree.fromstring(md_metadata.xml)
for ci in tree.findall(nspath_eval(
'gmd:MD_Metadata/gmd:contentInfo/'
'gmd:MD_FeatureCatalogueDescription/'
'gmd:featureCatalogueCitation',
{'gmd': 'http://www.isotc211.org/2005/gmd'})):
ci.attrib.pop('uuidref')
md_metadata.xml = etree.tostring(tree)
with pytest.raises(FeatureCatalogueNotFoundError):
owsutil.get_featurecatalogue_uuid(md_metadata)
def test_get_namespace(self, wfs, mp_remote_describefeaturetype):
"""Test the owsutil.get_namespace method.
Test whether the namespace of the dov-pub:Boringen layer is correct.
Parameters
----------
wfs : pytest.fixture returning owslib.wfs.WebFeatureService
WebFeatureService based on the local GetCapabilities.
mp_remote_describefeaturetype : pytest.fixture
Monkeypatch the call to a remote DescribeFeatureType of the
dov-pub:Boringen layer.
"""
assert owsutil.get_namespace(wfs, 'dov-pub:Boringen') == \
'http://dov.vlaanderen.be/ocdov/dov-pub'
def test_get_remote_featurecatalogue(self, mp_remote_fc):
"""Test the owsutil.get_remote_featurecatalogue method.
Test whether the feature catalogue of the dov-pub:Boringen layer
matches the format described in the docs.
Parameters
----------
mp_remote_fc : pytest.fixture
Monkeypatch the call to get the remote feature catalogue of the
dov-pub:Boringen layer.
"""
fc = owsutil.get_remote_featurecatalogue(
'https://www.dov.vlaanderen.be/geonetwork/srv/nl/csw',
'c0cbd397-520f-4ee1-aca7-d70e271eeed6')
assert type(fc) is dict
assert 'definition' in fc
assert type(fc['definition']) in (str, unicode)
assert 'attributes' in fc
assert type(fc['attributes']) is dict
attrs = fc['attributes']
if len(attrs) > 0:
for attr in attrs.values():
assert type(attr) is dict
assert 'definition' in attr
assert type(attr['definition']) in (str, unicode)
assert 'values' in attr
assert type(attr['values']) is list
if len(attr['values']) > 0:
for v in attr['values']:
assert type(v) in (str, unicode)
assert len(attr['values']) == len(set(attr['values']))
assert 'multiplicity' in attr
mp = attr['multiplicity']
assert type(mp) is tuple
assert len(mp) == 2
assert mp[0] in (0, 1)
assert (type(mp[1]) is int and mp[1] > 0) or mp[1] == 'Inf'
def test_get_remote_featurecataloge_baduuid(self, mp_remote_fc_notfound):
"""Test the owsutil.get_remote_featurecatalogue method with an
inexistent feature catalogue uuid.
Test whether a FeatureCatalogueNotFoundError is raised.
Parameters
----------
mp_remote_fc_notfound : pytest.fixture
Monkeypatch the call to get an inexistent remote featurecatalogue.
"""
with pytest.raises(FeatureCatalogueNotFoundError):
owsutil.get_remote_featurecatalogue(
'https://www.dov.vlaanderen.be/geonetwork/srv/nl/csw',
'badfc000-0000-0000-0000-badfc00badfc')
def test_get_remote_metadata(self, md_metadata):
"""Test the owsutil.get_remote_metadata method.
Test whether the resulting MD_Metadata is correct.
Parameters
----------
md_metadata : pytest.fixture returning owslib.iso.MD_Metadata
Parsed metadata describing the Boringen WFS layer in more detail,
in the ISO 19115/19139 format.
"""
assert type(md_metadata) is MD_Metadata
def test_get_remote_metadata_nometadataurls(self, wfs):
"""Test the owsutil.get_remote_metadata method when the WFS layer
missed metadata URLs.
Test whether a MetadataNotFoundError is raised.
Parameters
----------
wfs : pytest.fixture returning owslib.wfs.WebFeatureService
WebFeatureService based on the local GetCapabilities.
"""
contents = copy.deepcopy(wfs.contents)
contentmetadata = contents['dov-pub:Boringen']
contentmetadata.metadataUrls = []
with pytest.raises(MetadataNotFoundError):
owsutil.get_remote_metadata(contentmetadata)
def test_wfs_build_getfeature_request_onlytypename(self):
"""Test the owsutil.wfs_build_getfeature_request method with only a
typename specified.
Test whether the XML of the WFS GetFeature call is generated correctly.
"""
xml = owsutil.wfs_build_getfeature_request('dov-pub:Boringen')
assert clean_xml(etree.tostring(xml).decode('utf8')) == clean_xml(
'<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" '
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
'service="WFS" version="1.1.0" '
'xsi:schemaLocation="http://www.opengis.net/wfs '
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"><wfs:Query '
'typeName="dov-pub:Boringen"><ogc:Filter '
'xmlns:ogc="http://www.opengis.net/ogc"/></wfs:Query></wfs'
':GetFeature>')
def test_wfs_build_getfeature_request_bbox_nogeometrycolumn(self):
"""Test the owsutil.wfs_build_getfeature_request method with a location
argument but without the geometry_column argument.
Test whether an AttributeError is raised.
"""
with pytest.raises(AttributeError):
xml = owsutil.wfs_build_getfeature_request(
'dov-pub:Boringen',
location=Within(Box(151650, 214675, 151750, 214775)))
def test_wfs_build_getfeature_request_bbox(self):
"""Test the owsutil.wfs_build_getfeature_request method with a
typename, box and geometry_column.
Test whether the XML of the WFS GetFeature call is generated correctly.
"""
xml = owsutil.wfs_build_getfeature_request(
'dov-pub:Boringen',
location=Within(Box(151650, 214675, 151750, 214775)),
geometry_column='geom')
assert clean_xml(etree.tostring(xml).decode('utf8')) == clean_xml(
'<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" '
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
'service="WFS" version="1.1.0" '
'xsi:schemaLocation="http://www.opengis.net/wfs '
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"><wfs:Query '
'typeName="dov-pub:Boringen"><ogc:Filter '
'xmlns:ogc="http://www.opengis.net/ogc"><ogc:Within> '
'<ogc:PropertyName>geom</ogc:PropertyName><gml:Envelope '
'xmlns:gml="http://www.opengis.net/gml" srsDimension="2" '
'srsName="http://www.opengis.net/gml/srs/epsg.xml#31370"><gml'
':lowerCorner>151650.000 '
'214675.000</gml:lowerCorner><gml:upperCorner>151750.000 '
'214775.000</gml:upperCorner></gml:Envelope></ogc:Within></ogc'
':Filter></wfs:Query></wfs:GetFeature>')
def test_wfs_build_getfeature_request_propertyname(self):
"""Test the owsutil.wfs_build_getfeature_request method with a list
of propertynames.
Test whether the XML of the WFS GetFeature call is generated correctly.
"""
xml = owsutil.wfs_build_getfeature_request(
'dov-pub:Boringen', propertyname=['fiche', 'diepte_tot_m'])
assert clean_xml(etree.tostring(xml).decode('utf8')) == clean_xml(
'<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" '
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
'service="WFS" version="1.1.0" '
'xsi:schemaLocation="http://www.opengis.net/wfs '
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> <wfs:Query '
'typeName="dov-pub:Boringen"> '
'<wfs:PropertyName>fiche</wfs:PropertyName> '
'<wfs:PropertyName>diepte_tot_m</wfs:PropertyName> <ogc:Filter/> '
'</wfs:Query> </wfs:GetFeature>')
def test_wfs_build_getfeature_request_filter(self):
"""Test the owsutil.wfs_build_getfeature_request method with an
attribute filter.
Test whether the XML of the WFS GetFeature call is generated correctly.
"""
query = PropertyIsEqualTo(propertyname='gemeente',
literal='Herstappe')
filter_request = FilterRequest()
filter_request = filter_request.setConstraint(query)
try:
filter_request = etree.tostring(filter_request,
encoding='unicode')
except LookupError:
# Python2.7 without lxml uses 'utf-8' instead.
filter_request = etree.tostring(filter_request,
encoding='utf-8')
xml = owsutil.wfs_build_getfeature_request(
'dov-pub:Boringen', filter=filter_request)
assert clean_xml(etree.tostring(xml).decode('utf8')) == clean_xml(
'<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" '
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
'service="WFS" version="1.1.0" '
'xsi:schemaLocation="http://www.opengis.net/wfs '
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> <wfs:Query '
'typeName="dov-pub:Boringen"> <ogc:Filter> '
'<ogc:PropertyIsEqualTo> '
'<ogc:PropertyName>gemeente</ogc:PropertyName> '
'<ogc:Literal>Herstappe</ogc:Literal> </ogc:PropertyIsEqualTo> '
'</ogc:Filter> </wfs:Query> </wfs:GetFeature>')
def test_wfs_build_getfeature_request_bbox_filter(self):
"""Test the owsutil.wfs_build_getfeature_request method with an
attribute filter, a box and a geometry_column.
Test whether the XML of the WFS GetFeature call is generated correctly.
"""
query = PropertyIsEqualTo(propertyname='gemeente',
literal='Herstappe')
filter_request = FilterRequest()
filter_request = filter_request.setConstraint(query)
try:
filter_request = etree.tostring(filter_request,
encoding='unicode')
except LookupError:
# Python2.7 without lxml uses 'utf-8' instead.
filter_request = etree.tostring(filter_request,
encoding='utf-8')
xml = owsutil.wfs_build_getfeature_request(
'dov-pub:Boringen', filter=filter_request,
location=Within(Box(151650, 214675, 151750, 214775)),
geometry_column='geom')
assert clean_xml(etree.tostring(xml).decode('utf8')) == clean_xml(
'<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" '
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
'service="WFS" version="1.1.0" '
'xsi:schemaLocation="http://www.opengis.net/wfs '
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> <wfs:Query '
'typeName="dov-pub:Boringen"> <ogc:Filter> <ogc:And> '
'<ogc:PropertyIsEqualTo> '
'<ogc:PropertyName>gemeente</ogc:PropertyName> '
'<ogc:Literal>Herstappe</ogc:Literal> </ogc:PropertyIsEqualTo> '
'<ogc:Within> <ogc:PropertyName>geom</ogc:PropertyName> '
'<gml:Envelope xmlns:gml="http://www.opengis.net/gml" '
'srsDimension="2" '
'srsName="http://www.opengis.net/gml/srs/epsg.xml#31370"> '
'<gml:lowerCorner>151650.000 214675.000</gml:lowerCorner> '
'<gml:upperCorner>151750.000 214775.000</gml:upperCorner> '
'</gml:Envelope> </ogc:Within> </ogc:And> </ogc:Filter> '
'</wfs:Query> </wfs:GetFeature>')
def test_wfs_build_getfeature_request_bbox_filter_propertyname(self):
"""Test the owsutil.wfs_build_getfeature_request method with an
attribute filter, a box, a geometry_column and a list of
propertynames.
Test whether the XML of the WFS GetFeature call is generated correctly.
"""
query = PropertyIsEqualTo(propertyname='gemeente',
literal='Herstappe')
filter_request = FilterRequest()
filter_request = filter_request.setConstraint(query)
try:
filter_request = etree.tostring(filter_request,
encoding='unicode')
except LookupError:
# Python2.7 without lxml uses 'utf-8' instead.
filter_request = etree.tostring(filter_request,
encoding='utf-8')
xml = owsutil.wfs_build_getfeature_request(
'dov-pub:Boringen', filter=filter_request,
location=Within(Box(151650, 214675, 151750, 214775)),
geometry_column='geom', propertyname=['fiche', 'diepte_tot_m'])
assert clean_xml(etree.tostring(xml).decode('utf8')) == clean_xml(
'<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" '
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
'service="WFS" version="1.1.0" '
'xsi:schemaLocation="http://www.opengis.net/wfs '
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> <wfs:Query '
'typeName="dov-pub:Boringen"> '
'<wfs:PropertyName>fiche</wfs:PropertyName> '
'<wfs:PropertyName>diepte_tot_m</wfs:PropertyName> <ogc:Filter> '
'<ogc:And> <ogc:PropertyIsEqualTo> '
'<ogc:PropertyName>gemeente</ogc:PropertyName> '
'<ogc:Literal>Herstappe</ogc:Literal> </ogc:PropertyIsEqualTo> '
'<ogc:Within> <ogc:PropertyName>geom</ogc:PropertyName> '
'<gml:Envelope xmlns:gml="http://www.opengis.net/gml" '
'srsDimension="2" '
'srsName="http://www.opengis.net/gml/srs/epsg.xml#31370"> '
'<gml:lowerCorner>151650.000 214675.000</gml:lowerCorner> '
'<gml:upperCorner>151750.000 214775.000</gml:upperCorner> '
'</gml:Envelope> </ogc:Within> </ogc:And> </ogc:Filter> '
'</wfs:Query> </wfs:GetFeature>')
| 40.419958 | 79 | 0.620152 | 2,182 | 19,442 | 5.401467 | 0.119615 | 0.017224 | 0.027321 | 0.044544 | 0.788817 | 0.75403 | 0.723401 | 0.68522 | 0.671475 | 0.665196 | 0 | 0.03 | 0.264479 | 19,442 | 480 | 80 | 40.504167 | 0.794196 | 0.254346 | 0 | 0.507752 | 0 | 0.027132 | 0.346063 | 0.111686 | 0 | 0 | 0 | 0 | 0.104651 | 1 | 0.069767 | false | 0 | 0.050388 | 0 | 0.127907 | 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 |
735333a22976a616b2a1727e7723502f1d1387bb | 21 | bzl | Python | java/version.bzl | symonk/selenium | 38e89630f1c4b1a0d3ac6e17765a6ccb58160f83 | [
"Apache-2.0"
] | null | null | null | java/version.bzl | symonk/selenium | 38e89630f1c4b1a0d3ac6e17765a6ccb58160f83 | [
"Apache-2.0"
] | null | null | null | java/version.bzl | symonk/selenium | 38e89630f1c4b1a0d3ac6e17765a6ccb58160f83 | [
"Apache-2.0"
] | null | null | null | SE_VERSION = "4.2.1"
| 10.5 | 20 | 0.619048 | 5 | 21 | 2.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 0.142857 | 21 | 1 | 21 | 21 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0.238095 | 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 |
7df75836ee916a28f4a031535dcb56b53a8daeb4 | 255 | py | Python | libraries/website/docs/snippets/envs/tree_to_list.py | justindujardin/mathy | 776ac528d4586d6ea558a7212adb3559ea487a3c | [
"MIT"
] | 95 | 2020-01-02T23:02:34.000Z | 2022-03-08T18:57:24.000Z | libraries/website/docs/snippets/envs/tree_to_list.py | justindujardin/mathy | 776ac528d4586d6ea558a7212adb3559ea487a3c | [
"MIT"
] | 44 | 2020-01-05T03:07:45.000Z | 2021-08-11T20:45:53.000Z | libraries/website/docs/snippets/envs/tree_to_list.py | justindujardin/mathy | 776ac528d4586d6ea558a7212adb3559ea487a3c | [
"MIT"
] | 5 | 2020-04-04T16:46:36.000Z | 2022-03-30T08:10:02.000Z | from typing import List
from mathy_core import ExpressionParser, MathExpression
parser = ExpressionParser()
expression: MathExpression = parser.parse("4 + 2x")
nodes: List[MathExpression] = expression.to_list()
# len([4,+,2,*,x])
assert len(nodes) == 5
| 25.5 | 55 | 0.74902 | 32 | 255 | 5.90625 | 0.625 | 0.21164 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022222 | 0.117647 | 255 | 9 | 56 | 28.333333 | 0.817778 | 0.062745 | 0 | 0 | 0 | 0 | 0.025316 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7dff476f5b07538c175407ac6793f4c21aad8c8f | 899 | py | Python | cinder/tests/unit/backup/fake_service_with_verify.py | puremudassir/cinder | 99aad0d094e726d328ea815cea8ebdc14957da8c | [
"Apache-2.0"
] | null | null | null | cinder/tests/unit/backup/fake_service_with_verify.py | puremudassir/cinder | 99aad0d094e726d328ea815cea8ebdc14957da8c | [
"Apache-2.0"
] | null | null | null | cinder/tests/unit/backup/fake_service_with_verify.py | puremudassir/cinder | 99aad0d094e726d328ea815cea8ebdc14957da8c | [
"Apache-2.0"
] | null | null | null | # Copyright (C) 2014 Deutsche Telekom AG
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from cinder.backup import driver
from cinder.tests.unit.backup import fake_service
class FakeBackupServiceWithVerify(driver.BackupDriverWithVerify,
fake_service.FakeBackupService):
def verify(self, backup):
pass
| 37.458333 | 78 | 0.719689 | 120 | 899 | 5.375 | 0.708333 | 0.093023 | 0.04031 | 0.049612 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011396 | 0.219132 | 899 | 23 | 79 | 39.086957 | 0.907407 | 0.677419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
b4012c4378e508ce63325920dec3916fc3ec12bc | 2,325 | py | Python | src/mlb_statsapi/model/api/game.py | power-edge/mlb_statsapi_etl | 9cca2ae059e8aab98ed460e7b71ad6eeeed09ffe | [
"Apache-2.0"
] | null | null | null | src/mlb_statsapi/model/api/game.py | power-edge/mlb_statsapi_etl | 9cca2ae059e8aab98ed460e7b71ad6eeeed09ffe | [
"Apache-2.0"
] | null | null | null | src/mlb_statsapi/model/api/game.py | power-edge/mlb_statsapi_etl | 9cca2ae059e8aab98ed460e7b71ad6eeeed09ffe | [
"Apache-2.0"
] | null | null | null | """
created by nikos at 4/26/21
"""
import datetime
from ..base import MLBStatsAPIEndpointModel
from mlb_statsapi.utils.stats_api_object import configure_api
YMDTHMS = '%Y-%m-%dT%H:%M:%SZ'
YYYYMMDD_HHMMSS = '%Y%m%d_%H%M%S'
MMDDYYYY_HHMMSS = '%m%d%Y_%H%M%S'
class GameModel(MLBStatsAPIEndpointModel):
date_formats = {
'updatedSince': YMDTHMS,
'timecode': YYYYMMDD_HHMMSS,
'startTimecode': MMDDYYYY_HHMMSS,
'endTimecode': MMDDYYYY_HHMMSS
}
@configure_api
def liveGameV1(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def liveGameDiffPatchV1(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def liveTimestampv11(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def currentGameStats(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def getGameContextMetrics(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def getWinProbability(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def boxscore(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def content(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def colorFeed(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def colorTimestamps(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def linescore(self, **kwargs):
return self.get_api_file_object(**kwargs)
@configure_api
def playByPlay(self, **kwargs):
return self.get_api_file_object(**kwargs)
@property
def _methods(self) -> dict: return {m.__name__: m for m in (
self.liveGameV1,
self.liveGameDiffPatchV1,
self.liveTimestampv11,
self.currentGameStats,
self.getGameContextMetrics,
self.getWinProbability,
self.boxscore,
self.content,
self.colorFeed,
self.colorTimestamps,
self.linescore,
self.playByPlay
)}
@property
def now_timestamp(self):
return datetime.datetime.now().strftime(YYYYMMDD_HHMMSS)
| 25.549451 | 64 | 0.667957 | 266 | 2,325 | 5.586466 | 0.244361 | 0.10498 | 0.121131 | 0.161507 | 0.450202 | 0.450202 | 0.450202 | 0.450202 | 0.450202 | 0.421938 | 0 | 0.007194 | 0.222796 | 2,325 | 90 | 65 | 25.833333 | 0.815163 | 0.011613 | 0 | 0.38806 | 0 | 0 | 0.038428 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.208955 | false | 0 | 0.044776 | 0.208955 | 0.477612 | 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 |
b41ac0fb4f1e55fdca39a67f5c6756119ab70fed | 68 | py | Python | onnxsim/__init__.py | Wheest/onnx-simplifier | 70e3b52aadbc73fe01029dc7ba0d4965d8fc1a8c | [
"Apache-2.0"
] | 1,977 | 2019-04-01T10:48:18.000Z | 2022-03-31T07:43:03.000Z | onnxsim/__init__.py | fedral/onnx-simplifier | 70e3b52aadbc73fe01029dc7ba0d4965d8fc1a8c | [
"Apache-2.0"
] | 167 | 2019-05-03T08:21:15.000Z | 2022-03-31T10:21:03.000Z | onnxsim/__init__.py | fedral/onnx-simplifier | 70e3b52aadbc73fe01029dc7ba0d4965d8fc1a8c | [
"Apache-2.0"
] | 251 | 2019-04-01T12:21:42.000Z | 2022-03-30T18:14:39.000Z | from onnxsim.onnx_simplifier import simplify
__version__ = '0.0.0'
| 17 | 44 | 0.794118 | 10 | 68 | 4.9 | 0.8 | 0.081633 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 0.117647 | 68 | 3 | 45 | 22.666667 | 0.766667 | 0 | 0 | 0 | 0 | 0 | 0.073529 | 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 |
b424151af9b357850be4c70639941f09ba348b96 | 253 | py | Python | src/temperature/urls.py | JohanGovers/home-mon-server | e22ee05508597f11b313f8fa600a4867ad15f759 | [
"MIT"
] | null | null | null | src/temperature/urls.py | JohanGovers/home-mon-server | e22ee05508597f11b313f8fa600a4867ad15f759 | [
"MIT"
] | null | null | null | src/temperature/urls.py | JohanGovers/home-mon-server | e22ee05508597f11b313f8fa600a4867ad15f759 | [
"MIT"
] | null | null | null | from django.conf.urls import patterns, url
from temperature import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^save_temp_reading$', views.save_temp_reading, name='save_temp_reading'),
)
| 31.625 | 88 | 0.660079 | 32 | 253 | 5.03125 | 0.5 | 0.149068 | 0.279503 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201581 | 253 | 7 | 89 | 36.142857 | 0.79703 | 0 | 0 | 0 | 0 | 0 | 0.174797 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b42ac51788c29cf80e7fbe118ac8d2f98639006c | 30 | py | Python | punch_version.py | joshua-s/punch | c29751844ecf654cc21966a14842e8165e0bc300 | [
"ISC"
] | null | null | null | punch_version.py | joshua-s/punch | c29751844ecf654cc21966a14842e8165e0bc300 | [
"ISC"
] | null | null | null | punch_version.py | joshua-s/punch | c29751844ecf654cc21966a14842e8165e0bc300 | [
"ISC"
] | null | null | null | major = 1
minor = 4
patch = 5
| 7.5 | 9 | 0.6 | 6 | 30 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 0.3 | 30 | 3 | 10 | 10 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
b448742ef1c956bf4c670f1ca4c802b2271cb5bd | 1,030 | py | Python | je_open_cv/modules/image_operations.py | JE-Chen/Python-OPENCV-JE | d5dd3823f0a1cfc195da66bdcbe738c9bbdfc59b | [
"MIT"
] | null | null | null | je_open_cv/modules/image_operations.py | JE-Chen/Python-OPENCV-JE | d5dd3823f0a1cfc195da66bdcbe738c9bbdfc59b | [
"MIT"
] | null | null | null | je_open_cv/modules/image_operations.py | JE-Chen/Python-OPENCV-JE | d5dd3823f0a1cfc195da66bdcbe738c9bbdfc59b | [
"MIT"
] | null | null | null | import cv2
'''
基本圖像處理用
'''
# 取得圖像 行 列 通道數
def get_image_properties(image):
total = [image.shape, image.size, image.dtype]
return total
def get_image_shape(image):
return image.shape
# 取得 圖片大小
def get_image_size(image):
return image.size
# 取得圖片類型
def get_image_type(image):
return image.dtype
# 分割通道
def split_image(image):
B, G, R = cv2.split(image)
return [B, G, R]
'''
The B,G,R channels of an image can be split into their individual planes when needed. Then,
the individual channels can be merged back together to form a BGR image again. This can be performed by:
b = img[:,:,0]
Suppose, you want to make all the red pixels to zero, you need not split like this and put it equal to zero.
You can simply use Numpy indexing which is faster.
img[:,:,2] = 0
'''
# 組合通道
def merge_image(B, G, R):
return cv2.merge((B, G, R))
# 合併2張圖片 採用透明度
def image_Blending(image1, image1_Alpha, image2, image2_Alpha):
return cv2.addWeighted(image1, image1_Alpha, image2, image2_Alpha, 0)
| 18.727273 | 109 | 0.7 | 172 | 1,030 | 4.104651 | 0.482558 | 0.014164 | 0.021246 | 0.022663 | 0.096317 | 0.096317 | 0 | 0 | 0 | 0 | 0 | 0.020631 | 0.2 | 1,030 | 54 | 110 | 19.074074 | 0.836165 | 0.048544 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.411765 | false | 0 | 0.058824 | 0.294118 | 0.882353 | 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 |
b4532acfa1818a77c2c7b5bc9830fae6dbfa670b | 10,204 | py | Python | ElectricRoute/flask_auth_app/project/__init__.py | luciatomainodelacr/TFM | dd989ba18e22d71f6c9c03e16b71110c7c23a9a8 | [
"MIT"
] | 1 | 2021-05-26T15:45:06.000Z | 2021-05-26T15:45:06.000Z | ElectricRoute/flask_auth_app/project/__init__.py | luciatomainodelacr/TFM | dd989ba18e22d71f6c9c03e16b71110c7c23a9a8 | [
"MIT"
] | null | null | null | ElectricRoute/flask_auth_app/project/__init__.py | luciatomainodelacr/TFM | dd989ba18e22d71f6c9c03e16b71110c7c23a9a8 | [
"MIT"
] | 5 | 2021-03-07T19:20:26.000Z | 2021-04-11T18:26:12.000Z | # =============================================================================
# Inicialización de la aplicación: __init__.py
# =============================================================================
"""
Este archivo tendrá la función de crear la aplicación, que iniciará la base de
datos y registrará los molodelos.
Para ejecutar:
1º) En un terminal de linux ir a la ruta:
>> cd Documentos/TFM/ElectricRoute/flask_auth_app
>> export FLASK_APP=project
>> export FLASK_DEBUG=1
>> Si se va a lanzar flask_app en local: export DB_HOST=0.0.0.0
>> Si se va a lanzar flask_app en local: export GRAFANA_HOST=0.0.0.0
>> flask run
2º) Abrir el navegador e ir a la ruta http://localhost:5000/login
3") Insertar un mail y una contraseña (cualquier)
Ejemplo:
User: blanca@hotmail.com
Password: blanca
"""
# Se cargan las librerias
from flask import Flask
from flask_login import LoginManager
from flask_mysqldb import MySQL
from os import environ
from .BE.Output import BaseDatos
# Se inicializa SQLAlchemy
db = MySQL()
# Se crea la app
def create_app():
app = Flask(__name__)
db_host = environ.get('DB_HOST')
app.config['MYSQL_HOST'] = db_host
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = 'root'
app.config['MYSQL_DB'] = 'tfm'
app.config['MYSQL_DATABASE_PORT'] = '3306'
app.secret_key = "123456789"
db.init_app(app)
login_manager = LoginManager()
login_manager.login_view = 'auth.login'
login_manager.init_app(app)
@login_manager.user_loader
def load_user(user_id):
# since the user_id is just the primary key of our user table, use it in the query for the user
#return User.query.get(int(user_id))
return 1
# blueprint for auth routes in our app
from .auth import auth as auth_blueprint
app.register_blueprint(auth_blueprint)
# blueprint for non-auth parts of app
from .main import main as main_blueprint
app.register_blueprint(main_blueprint)
return app
| 129.164557 | 6,108 | 0.130243 | 290 | 10,204 | 4.42069 | 0.434483 | 0.00936 | 0.054602 | 0.014041 | 0.131045 | 0.053042 | 0.053042 | 0.053042 | 0.053042 | 0.053042 | 0 | 0.01827 | 0.839083 | 10,204 | 78 | 6,109 | 130.820513 | 0.762485 | 0.104763 | 0 | 0 | 0 | 0 | 0.01119 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.074074 | false | 0.037037 | 0.259259 | 0.037037 | 0.407407 | 0.148148 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b467f6301bdf6a68e1a4f160e420835a55b52e4b | 202 | py | Python | source_code/day001/input-exercise.py | MKutka/100daysofcode | e69c207956a1b16bb861e5831f0d66e75f16b31e | [
"MIT"
] | null | null | null | source_code/day001/input-exercise.py | MKutka/100daysofcode | e69c207956a1b16bb861e5831f0d66e75f16b31e | [
"MIT"
] | null | null | null | source_code/day001/input-exercise.py | MKutka/100daysofcode | e69c207956a1b16bb861e5831f0d66e75f16b31e | [
"MIT"
] | null | null | null | #Day 1.3 Exercise!!
#First way I thought to do it without help
name = input("What is your name? ")
print(len(name))
#Way I found to do it from searching google
print(len(input("What is your name? "))) | 25.25 | 43 | 0.70297 | 38 | 202 | 3.736842 | 0.631579 | 0.056338 | 0.084507 | 0.211268 | 0.267606 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011976 | 0.173267 | 202 | 8 | 44 | 25.25 | 0.838323 | 0.5 | 0 | 0 | 0 | 0 | 0.383838 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
b4854019f4acb3fc387347bdc98278a5e0867d2a | 363 | py | Python | src/exco/extractor_spec/spec_source.py | thegangtechnology/excel_comment_orm | b38156b406ccb3ce87737b8ed049bbf3b8a39050 | [
"MIT"
] | 2 | 2020-11-10T04:53:07.000Z | 2020-11-12T03:53:46.000Z | src/exco/extractor_spec/spec_source.py | thegangtechnology/excel_comment_orm | b38156b406ccb3ce87737b8ed049bbf3b8a39050 | [
"MIT"
] | 50 | 2020-11-09T06:30:31.000Z | 2022-01-06T05:00:50.000Z | src/exco/extractor_spec/spec_source.py | thegangtechnology/excel_comment_orm | b38156b406ccb3ce87737b8ed049bbf3b8a39050 | [
"MIT"
] | null | null | null | import abc
class SpecSource(abc.ABC):
@abc.abstractmethod
def describe(self) -> str:
"""
Returns:
str to print in case there is an error constructing extractor for tracing back
"""
raise NotImplementedError()
class UnknownSource(SpecSource):
def describe(self) -> str:
return 'Unknown Source'
| 19.105263 | 90 | 0.62259 | 39 | 363 | 5.794872 | 0.74359 | 0.053097 | 0.132743 | 0.159292 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.294766 | 363 | 18 | 91 | 20.166667 | 0.882813 | 0.250689 | 0 | 0.25 | 0 | 0 | 0.058577 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
81ec64fdd381f8390bb7b57ec0c4cafc99c38ae3 | 77 | py | Python | src/token/__init__.py | mingz2013/py.script | c7f637f41949d4992e11bb0f694d2dc6aa7bf112 | [
"Apache-2.0"
] | 1 | 2019-10-23T13:15:59.000Z | 2019-10-23T13:15:59.000Z | src/token/__init__.py | mingz2013/py.cond | c98bc81e2216136bf158177355a8fcc36e1d83a9 | [
"Apache-2.0"
] | null | null | null | src/token/__init__.py | mingz2013/py.cond | c98bc81e2216136bf158177355a8fcc36e1d83a9 | [
"Apache-2.0"
] | null | null | null | # -*- coding:utf-8 -*-
"""
"""
__date__ = "14/12/2017"
__author__ = "zhaojm"
| 12.833333 | 23 | 0.545455 | 9 | 77 | 3.777778 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138462 | 0.155844 | 77 | 5 | 24 | 15.4 | 0.384615 | 0.25974 | 0 | 0 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
81f14ce563d81df9f3673772cac00a024e237a10 | 160 | py | Python | aoc20211219b.py | BarnabyShearer/aoc | 4feb66c668b068f0f42ad99b916e80732eba5a2d | [
"MIT"
] | null | null | null | aoc20211219b.py | BarnabyShearer/aoc | 4feb66c668b068f0f42ad99b916e80732eba5a2d | [
"MIT"
] | null | null | null | aoc20211219b.py | BarnabyShearer/aoc | 4feb66c668b068f0f42ad99b916e80732eba5a2d | [
"MIT"
] | null | null | null | from aoc20211219a import *
def aoc(data):
sensors, _ = slam(parse(data))
return max(sum(abs(x) for x in sub(a, b)) for a in sensors for b in sensors)
| 22.857143 | 80 | 0.6625 | 29 | 160 | 3.62069 | 0.655172 | 0.171429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064 | 0.21875 | 160 | 6 | 81 | 26.666667 | 0.776 | 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 |
c309031e8b5363fdf7fbbe96607fc907a7dbcec7 | 541 | py | Python | anygraph/wrapper.py | gemerden/anygraph | c20cab82ad4a7f4117690a445e136c2b0e84f0f3 | [
"MIT"
] | 10 | 2020-06-11T14:11:58.000Z | 2021-12-31T11:59:26.000Z | anygraph/wrapper.py | gemerden/anygraph | c20cab82ad4a7f4117690a445e136c2b0e84f0f3 | [
"MIT"
] | null | null | null | anygraph/wrapper.py | gemerden/anygraph | c20cab82ad4a7f4117690a445e136c2b0e84f0f3 | [
"MIT"
] | null | null | null | class Wrapper(object):
wrapper_classes = {}
@classmethod
def wrap(cls, obj):
return cls(obj)
def __init__(self, wrapped):
self.__dict__['wrapped'] = wrapped
def __getattr__(self, name):
return getattr(self.wrapped, name)
def __setattr__(self, name, value):
setattr(self.wrapped, name, value)
def __delattr__(self, name):
delattr(self.wrapped, name)
def __str__(self):
return str(self.wrapped)
def __repr__(self):
return repr(self.wrapped)
| 19.321429 | 42 | 0.619224 | 62 | 541 | 4.935484 | 0.33871 | 0.215686 | 0.147059 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.268022 | 541 | 27 | 43 | 20.037037 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0.013011 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.411765 | false | 0 | 0 | 0.235294 | 0.764706 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
c31181ed7742f029eee26ce5c90c82ae4b887fbd | 528 | py | Python | app/articles/forms.py | AlexRAV/flask-blog | df8036e01794914ca0e88856ed93f8a91cc1d47a | [
"BSD-3-Clause"
] | null | null | null | app/articles/forms.py | AlexRAV/flask-blog | df8036e01794914ca0e88856ed93f8a91cc1d47a | [
"BSD-3-Clause"
] | null | null | null | app/articles/forms.py | AlexRAV/flask-blog | df8036e01794914ca0e88856ed93f8a91cc1d47a | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""Article forms."""
from flask_wtf import Form, FlaskForm
from wtforms import PasswordField, StringField, TextAreaField
from wtforms.validators import DataRequired, Email, EqualTo, Length
class NewArticleForm(FlaskForm):
title = StringField('Article title', validators=[DataRequired(), Length(min=5, max=200)])
body = TextAreaField('Article body', validators=[DataRequired(), Length(min=50)])
class NewCommentForm(FlaskForm):
body = TextAreaField('Comment', validators=[DataRequired()])
| 35.2 | 93 | 0.746212 | 56 | 528 | 7.017857 | 0.553571 | 0.167939 | 0.142494 | 0.157761 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015021 | 0.117424 | 528 | 14 | 94 | 37.714286 | 0.828326 | 0.070076 | 0 | 0 | 0 | 0 | 0.065979 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.125 | 0.375 | 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 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
c3184306de4eb3bd08a9f52149a34046ea7333f3 | 2,296 | py | Python | pyfunds/option.py | lucaruzzola/pyfunds | 498c5a0a3eb9423ca9f267b8d8c47f0f23987f3d | [
"MIT"
] | 6 | 2021-08-16T16:15:05.000Z | 2022-03-21T15:46:29.000Z | pyfunds/option.py | lucaruzzola/pyfunds | 498c5a0a3eb9423ca9f267b8d8c47f0f23987f3d | [
"MIT"
] | null | null | null | pyfunds/option.py | lucaruzzola/pyfunds | 498c5a0a3eb9423ca9f267b8d8c47f0f23987f3d | [
"MIT"
] | null | null | null | from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Callable, Generic, TypeVar
T = TypeVar("T")
U = TypeVar("U")
class NoElement(Exception):
pass
class Option(ABC, Generic[T]):
def __init__(self):
super().__init__()
@staticmethod
def apply(value: T):
return Some(value) if value is not None else Nothing()
@abstractmethod
def _is_empty(self) -> bool:
pass
@abstractmethod
def get(self) -> T:
pass
def get_or_else(self, default: T) -> T:
return default if self._is_empty() else self.get()
@staticmethod
def when(condition: bool, value: T) -> Option[T]:
return Some(value) if condition else Nothing()
def map(self, f: Callable[[T], U]) -> Option[U]:
return Some(f(self.get())) if not self._is_empty() else self
def flat_map(self, f: Callable[[T], Option[U]]) -> Option[U]:
return f(self.get()) if not self._is_empty() else self
def fold(self, default: U, fs: Callable[[T], U]) -> U:
return default if self._is_empty() else fs(self.get())
def __str__(self) -> str:
return f"Option is {'Some' if not self._is_empty() else 'Nothing'}" + (
f", with value: {self.get().__repr__()} of type {type(self.get())}"
if not self._is_empty()
else ""
)
def __repr__(self) -> str:
return "pyfunds.Option"
def __eq__(self, other: Option[T]) -> bool:
if self._is_empty():
return other._is_empty()
elif other._is_empty():
return False
else:
return self.get() == other.get()
def __ne__(self, other: Option[T]) -> bool:
return not self == other
class Some(Option[T]):
def __init__(self, value: T):
super().__init__()
self._value = value
def _is_empty(self) -> bool:
return False
def get(self) -> T:
return self._value
def __repr__(self) -> str:
return f"pyfunds.Some({self.get()})"
class Nothing(Option[T]):
def __init__(self):
super().__init__()
def _is_empty(self) -> bool:
return True
def get(self) -> T:
raise NoElement
def __repr__(self) -> str:
return "pyfunds.Nothing"
| 23.916667 | 79 | 0.582753 | 304 | 2,296 | 4.121711 | 0.1875 | 0.067039 | 0.061453 | 0.071828 | 0.396648 | 0.256185 | 0.125299 | 0.077414 | 0.055866 | 0.055866 | 0 | 0 | 0.280488 | 2,296 | 95 | 80 | 24.168421 | 0.758475 | 0 | 0 | 0.348485 | 0 | 0 | 0.077526 | 0.021341 | 0 | 0 | 0 | 0 | 0 | 1 | 0.318182 | false | 0.045455 | 0.045455 | 0.212121 | 0.681818 | 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 |
c327d2cfdab4947c294367dcb469b4dd7dc0ab92 | 485 | py | Python | bots/test_analyseGithub.py | RSE2-D2/RSE2-D2 | eb535669cbc476b67d7cb6e1092eb0babe2f24df | [
"MIT"
] | 3 | 2020-04-02T09:39:44.000Z | 2020-04-02T14:26:48.000Z | bots/test_analyseGithub.py | RSE2-D2/RSE2-D2 | eb535669cbc476b67d7cb6e1092eb0babe2f24df | [
"MIT"
] | 16 | 2020-04-02T08:21:16.000Z | 2020-04-02T15:44:29.000Z | bots/test_analyseGithub.py | RSE2-D2/RSE2-D2 | eb535669cbc476b67d7cb6e1092eb0babe2f24df | [
"MIT"
] | 1 | 2020-04-02T08:36:41.000Z | 2020-04-02T08:36:41.000Z | import analyseGithub
def test_containsGithubURL_empty():
assert not analyseGithub.containsGitHubURL("")
def test_containsGithubURL_noUrl():
assert not analyseGithub.containsGitHubURL("Some test tweet")
def test_containsGithubURL_url():
repo = "https://github.com/git/git"
assert analyseGithub.containsGitHubURL(repo)
def test_extractGitHubLink():
repo = "https://github.com/git/git"
assert analyseGithub.extractGitHubLink(f"{repo} more tweet") == "git/git"
| 30.3125 | 77 | 0.762887 | 53 | 485 | 6.849057 | 0.377358 | 0.077135 | 0.198347 | 0.214876 | 0.236915 | 0.236915 | 0.236915 | 0.236915 | 0 | 0 | 0 | 0 | 0.123711 | 485 | 15 | 78 | 32.333333 | 0.854118 | 0 | 0 | 0.181818 | 0 | 0 | 0.187629 | 0 | 0 | 0 | 0 | 0 | 0.363636 | 1 | 0.363636 | false | 0 | 0.090909 | 0 | 0.454545 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c3372092201a1e6f33ba16a8e3cd911550232f4d | 326 | py | Python | src/plugins/command/main.py | AlexCaranha/MyLauncher | d15037d5e26eee61e851a938b432ee1107f441ab | [
"MIT"
] | null | null | null | src/plugins/command/main.py | AlexCaranha/MyLauncher | d15037d5e26eee61e851a938b432ee1107f441ab | [
"MIT"
] | null | null | null | src/plugins/command/main.py | AlexCaranha/MyLauncher | d15037d5e26eee61e851a938b432ee1107f441ab | [
"MIT"
] | null | null | null |
import pluggy
hookimpl = pluggy.HookimplMarker('mylauncher')
def get_class():
return CommandPlugin()
class CommandPlugin:
@hookimpl
def setup(self):
print("Setup ...")
@hookimpl
def get_alias(self):
return "command"
@hookimpl
def execute(self, input:str):
return None
| 15.52381 | 46 | 0.631902 | 34 | 326 | 6 | 0.558824 | 0.161765 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.260736 | 326 | 20 | 47 | 16.3 | 0.846473 | 0 | 0 | 0.214286 | 0 | 0 | 0.08 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.071429 | 0.214286 | 0.642857 | 0.071429 | 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 |
c33796a44fa6fcd9a0852b7e8f6f953771655ffa | 64 | py | Python | ores/scoring/models/__init__.py | elukey/ores | 18f6e2da642dd124daf4dc122d58032eb15485c9 | [
"MIT"
] | 69 | 2015-07-15T15:04:12.000Z | 2018-08-20T15:00:27.000Z | ores/scoring/models/__init__.py | elukey/ores | 18f6e2da642dd124daf4dc122d58032eb15485c9 | [
"MIT"
] | 146 | 2015-06-13T18:56:49.000Z | 2018-08-17T22:38:52.000Z | ores/scoring/models/__init__.py | elukey/ores | 18f6e2da642dd124daf4dc122d58032eb15485c9 | [
"MIT"
] | 34 | 2018-10-15T16:58:50.000Z | 2022-03-08T20:01:34.000Z | from .rev_id_scorer import RevIdScorer
__all__ = [RevIdScorer]
| 16 | 38 | 0.8125 | 8 | 64 | 5.75 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 64 | 3 | 39 | 21.333333 | 0.821429 | 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 |
c3518b43a0aa4df0b06d8f5ad7ea43c927361987 | 169 | py | Python | bokeh/themes/__init__.py | quasiben/bokeh | 738343bd18c851dfd1fdc82cf35fe3eb4cdfd475 | [
"BSD-3-Clause"
] | null | null | null | bokeh/themes/__init__.py | quasiben/bokeh | 738343bd18c851dfd1fdc82cf35fe3eb4cdfd475 | [
"BSD-3-Clause"
] | null | null | null | bokeh/themes/__init__.py | quasiben/bokeh | 738343bd18c851dfd1fdc82cf35fe3eb4cdfd475 | [
"BSD-3-Clause"
] | null | null | null | ''' Provides API for loading themes
'''
from __future__ import absolute_import
from os.path import join
from .theme import Theme
default = Theme(json={})
del join
| 12.071429 | 38 | 0.739645 | 24 | 169 | 5 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177515 | 169 | 13 | 39 | 13 | 0.863309 | 0.183432 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
c354a245e57f7c727ba4576fb602286db50cc1a3 | 645 | py | Python | core/migrations/0010_wagtailsitepage_screenshot.py | admariner/madewithwagtail | a43b3263c0f151ece4994fccd561b0575db4979f | [
"MIT"
] | null | null | null | core/migrations/0010_wagtailsitepage_screenshot.py | admariner/madewithwagtail | a43b3263c0f151ece4994fccd561b0575db4979f | [
"MIT"
] | null | null | null | core/migrations/0010_wagtailsitepage_screenshot.py | admariner/madewithwagtail | a43b3263c0f151ece4994fccd561b0575db4979f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-21 23:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0009_wagtail112upgrade'),
]
operations = [
migrations.RenameField(
model_name='wagtailsitepage',
old_name='image_desktop',
new_name='site_screenshot',
),
migrations.RemoveField(
model_name='wagtailsitepage',
name='image_phone',
),
migrations.RemoveField(
model_name='wagtailsitepage',
name='image_tablet',
),
]
| 22.241379 | 48 | 0.568992 | 58 | 645 | 6.155172 | 0.655172 | 0.07563 | 0.201681 | 0.168067 | 0.302521 | 0.302521 | 0.302521 | 0 | 0 | 0 | 0 | 0.054422 | 0.316279 | 645 | 28 | 49 | 23.035714 | 0.755102 | 0.105426 | 0 | 0.4 | 1 | 0 | 0.212544 | 0.038328 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.05 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c357fdd1d20a6b3edc1499c2dfe1f260522fc967 | 391 | py | Python | src/database_setup.py | liuchanglilian/crowdsourcing-text-msg | 8270a8175bc78141d9eff00b53f4b292d0d2678c | [
"MIT"
] | null | null | null | src/database_setup.py | liuchanglilian/crowdsourcing-text-msg | 8270a8175bc78141d9eff00b53f4b292d0d2678c | [
"MIT"
] | null | null | null | src/database_setup.py | liuchanglilian/crowdsourcing-text-msg | 8270a8175bc78141d9eff00b53f4b292d0d2678c | [
"MIT"
] | null | null | null | from src.sqlite_helper import create_message_table, drop_message_table
"""
This script will create a SQLite table for you, and should be one time setup
The table name is message which will store all the Post message
"""
create_message_table()
"""
If you need to drop the message table, un-comment the following code by removing the # sign in the beginning
"""
#
# drop_message_table()
#
| 24.4375 | 108 | 0.769821 | 64 | 391 | 4.5625 | 0.625 | 0.205479 | 0.123288 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16624 | 391 | 15 | 109 | 26.066667 | 0.895706 | 0.051151 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c36035176be4720b8166b5477e11e4a52ab157d4 | 417 | py | Python | backend/bin/main/enrichers/enricher.py | anjo-ba/PCAP-Analyzer | ccb13caba9c0c05a7643e63c57575b56ab1233cb | [
"MIT"
] | 4 | 2019-03-29T08:45:36.000Z | 2021-11-11T00:49:36.000Z | backend/bin/main/enrichers/enricher.py | anjo-ba/PCAP-Analyzer | ccb13caba9c0c05a7643e63c57575b56ab1233cb | [
"MIT"
] | 9 | 2019-04-03T18:10:19.000Z | 2020-08-16T12:13:34.000Z | backend/bin/main/enrichers/enricher.py | anjo-ba/PCAP-Analyzer | ccb13caba9c0c05a7643e63c57575b56ab1233cb | [
"MIT"
] | 4 | 2019-05-09T15:33:23.000Z | 2022-02-06T08:01:23.000Z | from typing import Dict
from main.helpers.print_helper import PrintHelper
class Enricher(object):
def __init__(self, enricher_type: str, header: str) -> None:
self.enricher_type = enricher_type
self.header = header
def get_information(self, packet: Dict[str, str], information_dict) -> None:
pass
def print(self) -> None:
PrintHelper.print_nothing(self.enricher_type)
| 26.0625 | 80 | 0.70024 | 53 | 417 | 5.283019 | 0.45283 | 0.171429 | 0.171429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208633 | 417 | 15 | 81 | 27.8 | 0.848485 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0.1 | 0.2 | 0 | 0.6 | 0.3 | 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 |
c362e5ae43a55d318ef4b490ee0fc9d950ff6b12 | 138 | py | Python | injector/__init__.py | vnepomuceno/kafka-events-injector | 66fb490b1a3d5f06737689005c639b1785a6bb37 | [
"MIT"
] | null | null | null | injector/__init__.py | vnepomuceno/kafka-events-injector | 66fb490b1a3d5f06737689005c639b1785a6bb37 | [
"MIT"
] | null | null | null | injector/__init__.py | vnepomuceno/kafka-events-injector | 66fb490b1a3d5f06737689005c639b1785a6bb37 | [
"MIT"
] | null | null | null | import coloredlogs
coloredlogs.install()
custom_logger = logging.getLogger(name)
coloredlogs.install(level="INFO", logger=custom_logger)
| 23 | 55 | 0.826087 | 16 | 138 | 7 | 0.625 | 0.321429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065217 | 138 | 5 | 56 | 27.6 | 0.868217 | 0 | 0 | 0 | 0 | 0 | 0.028986 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c36ddd7acdde8453a1b9743b8e731fb3b4051614 | 80 | py | Python | shopyo/__init__.py | rehmanis/shopyo2 | 3e26602149f09aa4c13a1b4b6fba296bd82af99f | [
"MIT"
] | 2 | 2021-04-17T09:59:48.000Z | 2021-04-17T10:12:02.000Z | shopyo/__init__.py | rehmanis/shopyo2 | 3e26602149f09aa4c13a1b4b6fba296bd82af99f | [
"MIT"
] | 15 | 2021-04-01T19:54:46.000Z | 2021-04-07T22:25:40.000Z | shopyo/__init__.py | rehmanis/shopyo2 | 3e26602149f09aa4c13a1b4b6fba296bd82af99f | [
"MIT"
] | null | null | null | version_info = (4, 0, 1)
__version__ = ".".join([str(v) for v in version_info])
| 26.666667 | 54 | 0.65 | 14 | 80 | 3.285714 | 0.714286 | 0.478261 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044118 | 0.15 | 80 | 2 | 55 | 40 | 0.632353 | 0 | 0 | 0 | 0 | 0 | 0.0125 | 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 |
c377c853596a16e597f271a0e7e5269f859cd807 | 224 | py | Python | math/470.ImplementRand10UsingRand7.py | bzd111/leetcode | fd8db9ef52000cd4373f00a8f60d131caa5fe25d | [
"Apache-2.0"
] | null | null | null | math/470.ImplementRand10UsingRand7.py | bzd111/leetcode | fd8db9ef52000cd4373f00a8f60d131caa5fe25d | [
"Apache-2.0"
] | null | null | null | math/470.ImplementRand10UsingRand7.py | bzd111/leetcode | fd8db9ef52000cd4373f00a8f60d131caa5fe25d | [
"Apache-2.0"
] | null | null | null | import sys
def rand7() -> int:
...
class Solution:
def rand10(self) -> int:
index = sys.maxsize
while index > 40:
index = 7 * (rand7() - 1) + rand7() - 1
return index % 10 + 1
| 16 | 51 | 0.482143 | 27 | 224 | 4 | 0.62963 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.093525 | 0.379464 | 224 | 13 | 52 | 17.230769 | 0.683453 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5eda690b685cc647a25421c21d7eb3efc87731a9 | 3,288 | py | Python | htk-lite/commandlist/help.py | otherbeast/hackers-tool-kit | 12991889db1f6843dde82e7da4b4cdfb50740da5 | [
"Apache-2.0"
] | 393 | 2019-01-21T05:52:54.000Z | 2022-03-29T06:07:04.000Z | htk-lite/commandlist/help.py | urantialife/hackers-tool-kit | 34dbabf3e94825684fd1a684f522d3dc3565eb2d | [
"Apache-2.0"
] | 19 | 2019-02-22T00:49:28.000Z | 2021-12-30T20:28:59.000Z | htk-lite/commandlist/help.py | urantialife/hackers-tool-kit | 34dbabf3e94825684fd1a684f522d3dc3565eb2d | [
"Apache-2.0"
] | 138 | 2019-03-15T23:22:19.000Z | 2022-03-20T17:19:09.000Z | #!/usr/local/bin/python
# coding: latin-1
#if you use this code give me credit @tuf_unkn0wn
#i do not give you permission to show / edit this script without my credit
#to ask questions or report a problem message me on instagram @tuf_unkn0wn
"""
██░ ██ ▄▄▄ ▄████▄ ██ ▄█▀▓█████ ▓█████▄
▓██░ ██▒▒████▄ ▒██▀ ▀█ ██▄█▒ ▓█ ▀ ▒██▀ ██▌
▒██▀▀██░▒██ ▀█▄ ▒▓█ ▄ ▓███▄░ ▒███ ░██ █▌
░▓█ ░██ ░██▄▄▄▄██ ▒▓▓▄ ▄██▒▓██ █▄ ▒▓█ ▄ ░▓█▄ ▌
░▓█▒░██▓ ▓█ ▓██▒▒ ▓███▀ ░▒██▒ █▄░▒████▒░▒████▓
▒ ▒░▒ ▒▒ ▓▒█ ░▒ ▒ ░▒ ▒▒ ▓▒ ▒░ ░ ▒▒▓ ▒
▒ ░▒░ ░ ▒ ▒▒ ░ ░ ▒ ░ ░▒ ▒░ ░ ░ ░ ░ ▒ ▒
░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░
"""
import os
import sys
import random
lred = '\033[91m'
lblue = '\033[94m'
lgreen = '\033[92m'
yellow = '\033[93m'
cyan = '\033[1;36m'
purple = '\033[95m'
red = '\033[31m'
green = '\033[32m'
blue = '\033[34m'
orange = '\033[33m'
colorlist = [red, blue, green, yellow, lblue, purple, cyan, lred, lgreen, orange]
randomcolor = random.choice(colorlist)
banner3list = [red, blue, green, purple]
def helpbanner():
a = os.popen("ls commandlist -1 | wc -l").read()
b = a.replace('\n', '')
print """
╔══════════════════════════════════════════════════════════╗
║ ║
║ \033[92m ██░ ██ ▓█████ ██▓ ██▓███ \033[0m ║
║ \033[90m ▓██░ ██▒▓█ ▀ ▓██▒ ▓██░ ██▒ \033[0m ║
║ \033[92m ▒██▀▀██░▒███ ▒██░ ▓██░ ██▓▒ \033[0m ║
║ \033[90m ░▓█ ░██ ▒▓█ ▄ ▒██░ ▒██▄█▓▒ ▒ \033[0m ║
║ \033[92m ░▓█▒░██▓░▒████▒░██████▒▒██▒ ░ ░ \033[0m ║
║ \033[94m ▒ ░░▒░▒░░ ▒░ ░░ ▒░▓ ░▒▓▒░ ░ ░ \033[0m ║
║ \033[90m ▒ ░▒░ ░ ░ ░ ░░ ░ ▒ ░░▒ ░ \033[0m ║
║ \033[94m ░ ░░ ░ ░ ░ ░ ░░ \033[0m ║
║ \033[90m ░ ░ ░ ░ ░ ░ ░ \033[0m ║
║ ║
║══════════════════════════════════════════════════════════║
║ Commands: [\033[32m{0}\033[0m] Banners: [\033[31m6\033[0m] ║
║══════════════════════════════════════════════════════════════════════════════════════╗
║ ? | this menu ║
║ exit | exit htkl ║
║ clear | clears screen ║
║ banner | shows a banner ║
║ infoscan | gather information on a host [for a more specific scan type infoscan -o] ║
║ dos | run Denial-Of-Service attacks ║
║ ║
║ ║
║ \033[5m@tuf_unkn0wn\033[0m ║
╚══════════════════════════════════════════════════════════════════════════════════════╝
\033[0m\n""".format(b)
helpbanner()
| 46.971429 | 102 | 0.253041 | 404 | 3,288 | 3.918317 | 0.430693 | 0.046747 | 0.053064 | 0.055591 | 0.093493 | 0.089703 | 0.042325 | 0.012003 | 0.012003 | 0.012003 | 0 | 0.095078 | 0.456204 | 3,288 | 69 | 103 | 47.652174 | 0.368568 | 0.07056 | 0 | 0.085106 | 0 | 0.021277 | 0.836991 | 0.136755 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.06383 | null | null | 0.021277 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5eddcc0044e85262897bbd20777730764bb0e4ac | 785 | py | Python | dzTraficoBackend/dzTrafico/BusinessLayer/Statistics/DataVisualizationController.py | DZAymen/dz-Trafico | 74ff9caf9e3845d8af977c46b04a2d3421a0661b | [
"MIT"
] | null | null | null | dzTraficoBackend/dzTrafico/BusinessLayer/Statistics/DataVisualizationController.py | DZAymen/dz-Trafico | 74ff9caf9e3845d8af977c46b04a2d3421a0661b | [
"MIT"
] | null | null | null | dzTraficoBackend/dzTrafico/BusinessLayer/Statistics/DataVisualizationController.py | DZAymen/dz-Trafico | 74ff9caf9e3845d8af977c46b04a2d3421a0661b | [
"MIT"
] | null | null | null | from dzTrafico.BusinessEntities.Simulation import Simulation
import lxml.etree as etree
class DataVisualizationController(object):
def __init__(self, simulation):
# Initialize necessary file paths
self.simulation = simulation
def get_emissions_results(self):
pass
def get_travel_time_results(self):
travel_time_results = []
def get_waiting_time_results(self):
pass
def get_root_node_file(self, filename):
tree = etree.parse(Simulation.project_directory + filename)
return tree.getroot()
class DataVisualization(object):
def __init__(self, type, data):
self.type = type
self.data = data
def add_data(self, data):
for value in data:
self.data.append(value)
| 23.787879 | 67 | 0.680255 | 91 | 785 | 5.615385 | 0.461538 | 0.046967 | 0.050881 | 0.066536 | 0.082192 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.244586 | 785 | 32 | 68 | 24.53125 | 0.86172 | 0.03949 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.095238 | 0.095238 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
5eed38c8799a8f20aa9075adc117edac9f20f714 | 149 | py | Python | dodo.py | Ublimjo/nwt | 08b04c376a3792fd4663de2f229617ddabc3d032 | [
"MIT"
] | 1 | 2018-08-24T09:01:09.000Z | 2018-08-24T09:01:09.000Z | dodo.py | Ublimjo/nwt | 08b04c376a3792fd4663de2f229617ddabc3d032 | [
"MIT"
] | null | null | null | dodo.py | Ublimjo/nwt | 08b04c376a3792fd4663de2f229617ddabc3d032 | [
"MIT"
] | null | null | null | def task_clean_junk():
"""Remove junk file"""
return {
'actions': ['rm -rdf $(find . | grep pycache)'],
'clean': True,
}
| 21.285714 | 56 | 0.496644 | 16 | 149 | 4.5 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.308725 | 149 | 6 | 57 | 24.833333 | 0.699029 | 0.107383 | 0 | 0 | 0 | 0 | 0.346457 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6f0a8a484c64fa9bfcfccccb0a0f15f2d119765a | 6,708 | py | Python | pymonad/test/test_Maybe.py | bjd2385/pymonad | baec7a540d9195b2da029d1a101edd7c385f94bb | [
"BSD-3-Clause"
] | null | null | null | pymonad/test/test_Maybe.py | bjd2385/pymonad | baec7a540d9195b2da029d1a101edd7c385f94bb | [
"BSD-3-Clause"
] | null | null | null | pymonad/test/test_Maybe.py | bjd2385/pymonad | baec7a540d9195b2da029d1a101edd7c385f94bb | [
"BSD-3-Clause"
] | null | null | null | # --------------------------------------------------------
# (c) Copyright 2014 by Jason DeLaat.
# Licensed under BSD 3-clause licence.
# --------------------------------------------------------
import unittest
from pymonad.Maybe import Maybe, Just, First, Last, _Nothing, Nothing
from pymonad.Reader import curry
from pymonad.test.MonadTester import *
from pymonad.test.MonoidTester import *
class TestJustFunctor(unittest.TestCase, MonadTester):
def __init__(self, x):
super(TestJustFunctor, self).__init__(x)
self.setClassUnderTest(Just)
def testFunctorLaws(self):
self.given(8)
self.ensure_first_functor_law_holds()
self.ensure_second_functor_law_holds()
class TestNothingFunctor(unittest.TestCase, MonadTester):
def __init__(self, x):
super(TestNothingFunctor, self).__init__(x)
self.setClassUnderTest(_Nothing)
def testFunctorLaws(self):
self.given(None)
self.ensure_first_functor_law_holds()
self.ensure_second_functor_law_holds()
class TestJustApplicative(unittest.TestCase, MonadTester):
def __init__(self, x):
super(TestJustApplicative, self).__init__(x)
self.setClassUnderTest(Just)
def testApplicativeLaws(self):
self.given(8)
self.ensure_first_applicative_law_holds()
self.ensure_second_applicative_law_holds()
self.ensure_third_applicative_law_holds()
self.ensure_fourth_applicative_law_holds()
self.ensure_fifth_applicative_law_holds()
class TestNothingApplicative(unittest.TestCase, MonadTester):
def __init__(self, x):
super(TestNothingApplicative, self).__init__(x)
self.setClassUnderTest(_Nothing)
def testApplicativeLaws(self):
self.given(None)
self.ensure_first_applicative_law_holds()
self.ensure_second_applicative_law_holds()
self.ensure_third_applicative_law_holds()
self.ensure_fourth_applicative_law_holds()
self.ensure_fifth_applicative_law_holds()
class TestJustMonad(unittest.TestCase, MonadTester):
def __init__(self, x):
super(TestJustMonad, self).__init__(x)
self.setClassUnderTest(Just)
def monad_function_f(self, x):
return Just(x + 10)
def monad_function_g(self, x):
return Just(x * 5)
def testMonadLaws(self):
self.given(8)
self.ensure_first_monad_law_holds()
self.ensure_second_monad_law_holds()
self.ensure_third_monad_law_holds()
class TestNothingMonad(unittest.TestCase, MonadTester):
def __init__(self, x):
super(TestNothingMonad, self).__init__(x)
self.setClassUnderTest(_Nothing)
def monad_function_f(self, x):
return Just(x + 10)
def monad_function_g(self, x):
return Just(x * 5)
def testMonadLaws(self):
self.given(None)
self.ensure_first_monad_law_holds()
self.ensure_second_monad_law_holds()
self.ensure_third_monad_law_holds()
class TestMaybeEquality(unittest.TestCase, MonadTester):
def testEqualityOfIdenticalTypes(self):
self.givenMonads(Just(8), Just(8))
self.ensureMonadsAreEqual()
def testInequalityOfIdenticalTypes(self):
self.givenMonads(Just(8), Just(9))
self.ensureMonadsAreNotEqual()
def testInequalityOfJustAndNothing(self):
self.givenMonads(Just(8), Nothing)
self.ensureMonadsAreNotEqual()
def testMonadComparisonExceptionWithJust(self):
self.givenMonads(Just(8), Reader(8))
self.ensureComparisonRaisesException()
def testMonadComparisonExceptionWithNothing(self):
self.givenMonads(Nothing, Reader(8))
self.ensureComparisonRaisesException()
class TestMaybeMonoid(unittest.TestCase, MonoidTester):
def test_mzero(self):
self.givenMonoid(Maybe)
self.get_mzero()
self.ensure_mzero_is(Nothing)
def test_right_identity(self):
self.givenMonoid(Just(9))
self.ensure_monoid_plus_zero_equals(Just(9))
def test_left_identity(self):
self.givenMonoid(Just(9))
self.ensure_zero_plus_monoid_equals(Just(9))
def test_associativity(self):
self.givenMonoids(Just(1), Just(2), Just(3))
self.ensure_associativity()
def test_mplus_with_two_just_values(self):
self.givenMonoids(Just(1), Just(2))
self.ensure_mconcat_equals(Just(3))
def test_mplus_with_one_just_and_one_nothing(self):
self.givenMonoids(Just(1), Nothing)
self.ensure_mconcat_equals(Just(1))
class TestFirstMonoid(unittest.TestCase, MonoidTester):
def test_mzero(self):
self.givenMonoid(First)
self.get_mzero()
self.ensure_mzero_is(First(Nothing))
def test_right_identity(self):
self.givenMonoid(First(Just(9)))
self.ensure_monoid_plus_zero_equals(First(Just(9)))
def test_left_identity(self):
self.givenMonoid(First(Just(9)))
self.ensure_zero_plus_monoid_equals(First(Just(9)))
def test_associativity(self):
self.givenMonoids(First(Just(1)), First(Just(2)), First(Just(3)))
self.ensure_associativity()
def test_mplus_with_two_just_values(self):
self.givenMonoids(First(Just(1)), First(Just(2)))
self.ensure_mconcat_equals(First(Just(1)))
def test_mplus_with_just_and_nothing(self):
self.givenMonoids(First(Just(1)), Nothing)
self.ensure_mconcat_equals(First(Just(1)))
def test_mplus_with_nothing_and_just(self):
self.givenMonoids(Nothing, First(Just(1)))
self.ensure_mconcat_equals(First(Just(1)))
class TestLastMonoid(unittest.TestCase, MonoidTester):
def test_mzero(self):
self.givenMonoid(Last)
self.get_mzero()
self.ensure_mzero_is(Last(Nothing))
def test_right_identity(self):
self.givenMonoid(Last(Just(9)))
self.ensure_monoid_plus_zero_equals(Last(Just(9)))
def test_left_identity(self):
self.givenMonoid(Last(Just(9)))
self.ensure_zero_plus_monoid_equals(Last(Just(9)))
def test_associativity(self):
self.givenMonoids(Last(Just(1)), Last(Just(2)), Last(Just(3)))
self.ensure_associativity()
def test_mplus_with_two_just_values(self):
self.givenMonoids(Last(Just(1)), Last(Just(2)))
self.ensure_mconcat_equals(Last(Just(2)))
def test_mplus_with_just_and_nothing(self):
self.givenMonoids(Last(Just(1)), Nothing)
self.ensure_mconcat_equals(Last(Just(1)))
def test_mplus_with_nothing_and_just(self):
self.givenMonoids(Nothing, Last(Just(1)))
self.ensure_mconcat_equals(Last(Just(1)))
if __name__ == "__main__":
unittest.main()
| 33.373134 | 73 | 0.690966 | 794 | 6,708 | 5.510076 | 0.127204 | 0.091429 | 0.0384 | 0.0576 | 0.769371 | 0.736457 | 0.702857 | 0.577143 | 0.4416 | 0.314971 | 0 | 0.011401 | 0.189326 | 6,708 | 200 | 74 | 33.54 | 0.793122 | 0.027728 | 0 | 0.601307 | 0 | 0 | 0.001228 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.267974 | false | 0 | 0.03268 | 0.026144 | 0.392157 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6f15c8f389db3a70f0c15433c6aa9fb9ab9b3570 | 369 | py | Python | formatter_sql.py | ZSCNetSupportDept/schedule-utils | e7ba0f34c7af77980758c9a0e9a82faca66f558c | [
"WTFPL"
] | null | null | null | formatter_sql.py | ZSCNetSupportDept/schedule-utils | e7ba0f34c7af77980758c9a0e9a82faca66f558c | [
"WTFPL"
] | null | null | null | formatter_sql.py | ZSCNetSupportDept/schedule-utils | e7ba0f34c7af77980758c9a0e9a82faca66f558c | [
"WTFPL"
] | null | null | null | def format_sql(schedule, table):
for week, schedule in schedule.items():
print(f"UPDATE {table} SET `block`=0, `week`={week} WHERE `name`='{schedule.leader}';")
for block, staffs in schedule.staffs.items():
for staff in staffs:
print(f"UPDATE {table} SET `block`={block}, `week`={week} WHERE `name`='{staff}';")
pass
| 46.125 | 99 | 0.596206 | 48 | 369 | 4.5625 | 0.4375 | 0.091324 | 0.109589 | 0.155251 | 0.228311 | 0.228311 | 0 | 0 | 0 | 0 | 0 | 0.003509 | 0.227642 | 369 | 7 | 100 | 52.714286 | 0.764912 | 0 | 0 | 0 | 0 | 0.285714 | 0.406504 | 0.073171 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.142857 | 0 | 0 | 0.142857 | 0.285714 | 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 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6f2a6d704873d5624524e8309be808576dfeefc1 | 277 | py | Python | nmr/testing_PyBMRB.py | jameshtwose/han_jms_collabs | ee5cdb73b3e14e7f1f1e225dbc6a7d7d2b1b5b73 | [
"CC-BY-4.0"
] | null | null | null | nmr/testing_PyBMRB.py | jameshtwose/han_jms_collabs | ee5cdb73b3e14e7f1f1e225dbc6a7d7d2b1b5b73 | [
"CC-BY-4.0"
] | null | null | null | nmr/testing_PyBMRB.py | jameshtwose/han_jms_collabs | ee5cdb73b3e14e7f1f1e225dbc6a7d7d2b1b5b73 | [
"CC-BY-4.0"
] | null | null | null | from pybmrb import Spectra, Histogram
import plotly.io as pio
pio.renderers.default = "browser"
peak_list=Spectra.n15hsqc(bmrb_ids=15060, legend='residue')
peak_list=Spectra.c13hsqc(bmrb_ids=15060, legend='residue')
peak_list=Spectra.tocsy(bmrb_ids=15060, legend='residue') | 27.7 | 59 | 0.801444 | 41 | 277 | 5.268293 | 0.536585 | 0.111111 | 0.208333 | 0.25 | 0.486111 | 0.37037 | 0.37037 | 0.37037 | 0 | 0 | 0 | 0.074219 | 0.075812 | 277 | 10 | 60 | 27.7 | 0.769531 | 0 | 0 | 0 | 0 | 0 | 0.100719 | 0 | 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 |
6f32849e7bc2a9a3bdff91b0ea97b373245c40e0 | 934 | py | Python | uscampgrounds/models.py | adamfast/geodjango-uscampgrounds | 0ddcdfee44dd2cb3525bbf852e93a58e5429d0d8 | [
"BSD-3-Clause"
] | 1 | 2020-06-26T22:32:25.000Z | 2020-06-26T22:32:25.000Z | uscampgrounds/models.py | adamfast/geodjango-uscampgrounds | 0ddcdfee44dd2cb3525bbf852e93a58e5429d0d8 | [
"BSD-3-Clause"
] | null | null | null | uscampgrounds/models.py | adamfast/geodjango-uscampgrounds | 0ddcdfee44dd2cb3525bbf852e93a58e5429d0d8 | [
"BSD-3-Clause"
] | null | null | null | from django.conf import settings
from django.contrib.gis.db import models
class Campground(models.Model):
campground_code = models.CharField(max_length=64)
name = models.CharField(max_length=256)
campground_type = models.CharField(max_length=256)
phone = models.CharField(max_length=256)
comments = models.TextField()
sites = models.CharField(max_length=256)
elevation = models.CharField(max_length=256)
hookups = models.CharField(max_length=256)
amenities = models.TextField()
point = models.PointField(srid=4326)
def locator_point(self):
return self.point
def __unicode__(self):
return self.name
# integrate with the django-locator app for easy geo lookups if it's installed
if 'locator.objects' in settings.INSTALLED_APPS:
from locator.objects.models import create_locator_object
models.signals.post_save.connect(create_locator_object, sender=Campground)
| 35.923077 | 78 | 0.755889 | 123 | 934 | 5.577236 | 0.471545 | 0.153061 | 0.183673 | 0.244898 | 0.236152 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030496 | 0.157388 | 934 | 25 | 79 | 37.36 | 0.841169 | 0.08137 | 0 | 0 | 0 | 0 | 0.017523 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.15 | 0.1 | 0.9 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6f392ad202bb9d010a7064f5991bc4aec4981e22 | 212 | py | Python | app/core/apps.py | KarimTayie/djangoadmin-test | 7218866dbf72ae580e605d2f32601557efe1baca | [
"MIT"
] | null | null | null | app/core/apps.py | KarimTayie/djangoadmin-test | 7218866dbf72ae580e605d2f32601557efe1baca | [
"MIT"
] | 1 | 2019-12-18T16:01:44.000Z | 2019-12-18T16:01:44.000Z | app/core/apps.py | KarimTayie/djangoadmin-test | 7218866dbf72ae580e605d2f32601557efe1baca | [
"MIT"
] | null | null | null | from django.apps import AppConfig
from django.contrib.admin.apps import AdminConfig
class CoreConfig(AppConfig):
name = "core"
class AppAdminConfig(AdminConfig):
default_site = "core.admin.AppAdmin"
| 17.666667 | 49 | 0.768868 | 25 | 212 | 6.48 | 0.64 | 0.123457 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146226 | 212 | 11 | 50 | 19.272727 | 0.895028 | 0 | 0 | 0 | 0 | 0 | 0.109005 | 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 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.