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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
004f01411873fa16b6e88583aa0c8f9f03115c62 | 127 | py | Python | lecture/theory/lists.py | darjeeling4g/web_scrapper | c9ca36c2bafbfdbc2a5442c90692906d72213c0a | [
"MIT"
] | null | null | null | lecture/theory/lists.py | darjeeling4g/web_scrapper | c9ca36c2bafbfdbc2a5442c90692906d72213c0a | [
"MIT"
] | null | null | null | lecture/theory/lists.py | darjeeling4g/web_scrapper | c9ca36c2bafbfdbc2a5442c90692906d72213c0a | [
"MIT"
] | null | null | null | days = ["Mon", "Thu", "Wed", "Thur", "Fri"] # list(mutable sequence)
print(days)
days.append("Sat")
days.reverse()
print(days)
| 21.166667 | 68 | 0.637795 | 18 | 127 | 4.5 | 0.722222 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110236 | 127 | 5 | 69 | 25.4 | 0.716814 | 0.173228 | 0 | 0.4 | 0 | 0 | 0.184466 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 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 |
cc482051af76a337d7da4049b5328ca843dadeec | 339 | py | Python | apdcam_control/__init__.py | fusion-flap/flap_apdcam | fce208414044fb288328090ba697e8e2482e1c75 | [
"MIT"
] | 1 | 2019-09-16T11:45:37.000Z | 2019-09-16T11:45:37.000Z | apdcam_control/__init__.py | fusion-flap/flap_apdcam | fce208414044fb288328090ba697e8e2482e1c75 | [
"MIT"
] | 1 | 2019-06-04T13:09:19.000Z | 2019-06-05T08:26:31.000Z | apdcam_control/__init__.py | fusion-flap/flap_apdcam | fce208414044fb288328090ba697e8e2482e1c75 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 21 16:56:38 2022
@author: Zoletnik
"""
from .apdcam10g_channel_map import apdcam10g_channel_map
from .apdcam_channel_map import apdcam_channel_map
from .apdcam_types_versions import *
from .APDCAM10G_control import *
from .apdcam10g_control_gui import gui
from .apdcam_plot import plot_gui
| 24.214286 | 56 | 0.79646 | 51 | 339 | 5 | 0.490196 | 0.156863 | 0.14902 | 0.156863 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070707 | 0.123894 | 339 | 13 | 57 | 26.076923 | 0.787879 | 0.227139 | 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 |
cc4ce9ddfd9cca455f2a9f048c8ed1ea30e8016e | 266 | py | Python | webcrawler/utils/url.py | mrafayaleem/simple-crawler | 673dc41915bb70b22b1a50d5256c45efd361c2d5 | [
"MIT"
] | 27 | 2016-03-08T11:43:24.000Z | 2021-03-10T11:51:58.000Z | webcrawler/utils/url.py | mrafayaleem/simple-crawler | 673dc41915bb70b22b1a50d5256c45efd361c2d5 | [
"MIT"
] | null | null | null | webcrawler/utils/url.py | mrafayaleem/simple-crawler | 673dc41915bb70b22b1a50d5256c45efd361c2d5 | [
"MIT"
] | 1 | 2022-02-11T05:55:13.000Z | 2022-02-11T05:55:13.000Z | from urlparse import urlparse
def is_url_in_domain(url, domains):
parsed = urlparse(url)
for domain in domains:
if domain.match(parsed.netloc):
return True
return False
def is_absolute(url):
return bool(urlparse(url).netloc)
| 17.733333 | 39 | 0.676692 | 36 | 266 | 4.888889 | 0.527778 | 0.056818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.244361 | 266 | 14 | 40 | 19 | 0.875622 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0.111111 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
cc743b078a3e4272bef4ab72c61aac4e53414532 | 448 | py | Python | money/exceptions.py | KunjPrasad/py-money | 038491b7fce4b4a4748e2f8a935635d93c0e0147 | [
"MIT"
] | null | null | null | money/exceptions.py | KunjPrasad/py-money | 038491b7fce4b4a4748e2f8a935635d93c0e0147 | [
"MIT"
] | null | null | null | money/exceptions.py | KunjPrasad/py-money | 038491b7fce4b4a4748e2f8a935635d93c0e0147 | [
"MIT"
] | null | null | null | """Custom exceptions for money operations"""
# pylint: disable=missing-docstring
class InvalidAmountError(ValueError):
def __init__(self):
super().__init__("Invalid amount for currency")
class CurrencyMismatchError(ValueError):
def __init__(self):
super().__init__("Currencies must match")
class InvalidOperandError(ValueError):
def __init__(self):
super().__init__("Invalid operand types for operation")
| 23.578947 | 63 | 0.723214 | 45 | 448 | 6.666667 | 0.6 | 0.13 | 0.17 | 0.21 | 0.346667 | 0.346667 | 0.246667 | 0 | 0 | 0 | 0 | 0 | 0.167411 | 448 | 18 | 64 | 24.888889 | 0.80429 | 0.162946 | 0 | 0.333333 | 0 | 0 | 0.224932 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
cc7a5c0435eaaa2cb9d6382cd6a96b68432bcebd | 1,349 | py | Python | app/model.py | KLabServerCamp/gameserver | b6e76c8ed93c86180ebd9a340d53c645ae1f2f59 | [
"MIT"
] | null | null | null | app/model.py | KLabServerCamp/gameserver | b6e76c8ed93c86180ebd9a340d53c645ae1f2f59 | [
"MIT"
] | null | null | null | app/model.py | KLabServerCamp/gameserver | b6e76c8ed93c86180ebd9a340d53c645ae1f2f59 | [
"MIT"
] | 31 | 2021-12-16T05:36:43.000Z | 2022-03-10T02:35:41.000Z | import json
import uuid
from enum import Enum, IntEnum
from typing import Optional
from fastapi import HTTPException
from pydantic import BaseModel
from sqlalchemy import text
from sqlalchemy.exc import NoResultFound
from .db import engine
class InvalidToken(Exception):
"""指定されたtokenが不正だったときに投げる"""
class SafeUser(BaseModel):
"""token を含まないUser"""
id: int
name: str
leader_card_id: int
class Config:
orm_mode = True
def create_user(name: str, leader_card_id: int) -> str:
"""Create new user and returns their token"""
token = str(uuid.uuid4())
# NOTE: tokenが衝突したらリトライする必要がある.
with engine.begin() as conn:
result = conn.execute(
text(
"INSERT INTO `user` (name, token, leader_card_id) VALUES (:name, :token, :leader_card_id)"
),
{"name": name, "token": token, "leader_card_id": leader_card_id},
)
# print(result)
return token
def _get_user_by_token(conn, token: str) -> Optional[SafeUser]:
# TODO: 実装
pass
def get_user_by_token(token: str) -> Optional[SafeUser]:
with engine.begin() as conn:
return _get_user_by_token(conn, token)
def update_user(token: str, name: str, leader_card_id: int) -> None:
# このコードを実装してもらう
with engine.begin() as conn:
# TODO: 実装
pass
| 22.864407 | 106 | 0.6553 | 171 | 1,349 | 5.005848 | 0.374269 | 0.081776 | 0.098131 | 0.059579 | 0.276869 | 0.130841 | 0 | 0 | 0 | 0 | 0 | 0.000981 | 0.244626 | 1,349 | 58 | 107 | 23.258621 | 0.839058 | 0.1149 | 0 | 0.147059 | 0 | 0.029412 | 0.094549 | 0 | 0 | 0 | 0 | 0.017241 | 0 | 1 | 0.117647 | false | 0.058824 | 0.264706 | 0 | 0.617647 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
cc82c4be617f44749267d6f8e675bef5e843e4ae | 387 | py | Python | ExampleGame/imaginary/plugins/quiche.py | glyph/imaginary | 62299c8a0481bbee51444e688f45385a81cad328 | [
"MIT"
] | 25 | 2015-01-10T02:26:43.000Z | 2021-08-20T09:40:46.000Z | ExampleGame/imaginary/plugins/quiche.py | glyph/imaginary | 62299c8a0481bbee51444e688f45385a81cad328 | [
"MIT"
] | 65 | 2015-01-07T08:02:53.000Z | 2022-02-06T02:15:09.000Z | ExampleGame/imaginary/plugins/quiche.py | glyph/imaginary | 62299c8a0481bbee51444e688f45385a81cad328 | [
"MIT"
] | 7 | 2015-03-03T18:44:29.000Z | 2021-07-28T02:54:10.000Z | # -*- test-case-name: examplegame.test.test_vending -*-
from imaginary.creation import CreationPluginHelper
from examplegame.quiche import createQuiche, createCoin, createVendingMachine
quichePlugin = CreationPluginHelper('quiche', createQuiche)
vendingPlugin = CreationPluginHelper('vending machine', createVendingMachine)
quarterPlugin = CreationPluginHelper('quarter', createCoin)
| 38.7 | 77 | 0.832041 | 32 | 387 | 10.03125 | 0.59375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.080103 | 387 | 9 | 78 | 43 | 0.901685 | 0.136951 | 0 | 0 | 0 | 0 | 0.084592 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 1 | 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 |
cc8e1d3fe3dfe782e8780597039b08ea38db1be3 | 345 | py | Python | HostASkier/main/forms.py | RyanMower/HostASkier | 20553965da43979f69fb71a23654809c549bd259 | [
"MIT"
] | null | null | null | HostASkier/main/forms.py | RyanMower/HostASkier | 20553965da43979f69fb71a23654809c549bd259 | [
"MIT"
] | 2 | 2021-06-22T01:34:18.000Z | 2021-06-22T01:40:28.000Z | HostASkier/main/forms.py | RyanMower/HostASkier | 20553965da43979f69fb71a23654809c549bd259 | [
"MIT"
] | null | null | null | from django import forms
from localflavor.us.forms import USStateSelect
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, Row, Column
class StateForm(forms.Form):
state = forms.CharField(widget=USStateSelect)
enable_filter = forms.BooleanField(required=False, label="Enable Filter")
| 38.333333 | 79 | 0.782609 | 43 | 345 | 6.209302 | 0.604651 | 0.074906 | 0.11236 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144928 | 345 | 8 | 80 | 43.125 | 0.905085 | 0 | 0 | 0 | 0 | 0 | 0.037681 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
cc97406e8807899dfff0f354bac809e4f056a2bf | 304 | py | Python | sparkdh/dataframe_column_functions.py | mmutiso/dea | 6c497b05ef2e957b610a2f9390a3d55d69bcaa7d | [
"Apache-2.0"
] | null | null | null | sparkdh/dataframe_column_functions.py | mmutiso/dea | 6c497b05ef2e957b610a2f9390a3d55d69bcaa7d | [
"Apache-2.0"
] | null | null | null | sparkdh/dataframe_column_functions.py | mmutiso/dea | 6c497b05ef2e957b610a2f9390a3d55d69bcaa7d | [
"Apache-2.0"
] | null | null | null | from pyspark.sql import functions
def clone_column(df, existing_column_name, new_column_name):
"""
Adds a column to the dataframe with a new name copying
all the values from the existing column
"""
df = df.withColumn(new_column_name, df[existing_column_name])
return df | 30.4 | 66 | 0.713816 | 45 | 304 | 4.622222 | 0.511111 | 0.192308 | 0.153846 | 0.192308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223684 | 304 | 10 | 67 | 30.4 | 0.881356 | 0.309211 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
cc9a790071c818ae4e9994897044e31a412d623f | 6,381 | py | Python | source/gui/test/unitest_project.py | bucricket/projectMAScorrection | 89489026c8e247ec7c364e537798e766331fe569 | [
"BSD-3-Clause"
] | null | null | null | source/gui/test/unitest_project.py | bucricket/projectMAScorrection | 89489026c8e247ec7c364e537798e766331fe569 | [
"BSD-3-Clause"
] | 1 | 2022-03-12T12:19:59.000Z | 2022-03-12T12:19:59.000Z | source/gui/test/unitest_project.py | bucricket/projectMAScorrection | 89489026c8e247ec7c364e537798e766331fe569 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import unittest
import rttov
import h5py
import rmodel
import rttovgui_unittest_class
class Test(rttovgui_unittest_class.RttovGuiUnitTest):
def setUp(self):
file = "../rttov_tests/cldaer101lev_allgas.H5"
self.p = rmodel.project.Project()
profileName = self.p.config.ENV[
"RTTOV_GUI_PROFILE_DIR"] + "/standard54lev_allgas.H5"
self.p.openProfile(profileName)
def tearDown(self):
pass
def test_read_profile(self):
self.assertGreater(self.p.myProfile['BE'], 0.20)
def test_run_pc_1(self):
coefFile = self.p.config.ENV[
'RTTOV_GUI_COEFF_DIR'] + "/rttov9pred101L/rtcoef_metop_2_iasi.H5"
pcFile = self.p.config.ENV[
'RTTOV_GUI_COEFF_DIR'] + "/pc/pccoef_metop_2_iasi.H5"
self.p.myCoeffs.fileName["standard"] = coefFile
self.p.myCoeffs.fileName["PC"] = pcFile
err = self.p.loadCoefficients()
self.assertEqual(err, 0)
self.assertFalse(self.p.isPC())
self.p.myOption["ADDPC"] = True
self.assertTrue(self.p.isPC())
self.p.myProfile["SKIN"]["SURFTYPE"] = 1
err = self.p.runPC()
self.assertEqual(err, 0)
def test_run_pc_2(self):
print "-------------------AIRS-------------------------"
self.p.myProfile["SKIN"]["SURFTYPE"] = 1
coefFile = self.p.config.ENV[
'RTTOV_GUI_COEFF_DIR'] + "/rttov9pred101L/rtcoef_eos_2_airs.H5"
pcFile = self.p.config.ENV[
'RTTOV_GUI_COEFF_DIR'] + "/pc/pccoef_eos_2_airs.H5"
self.p.myCoeffs.fileName["standard"] = coefFile
self.p.myCoeffs.fileName["PC"] = pcFile
print self.p.myCoeffs.fileName
err = self.p.loadCoefficients()
self.assertEqual(err, 0)
err = self.p.runPC()
self.assertEqual(err, 0)
self.check_option(self.p)
print "-------------------IASI NG-------------------------"
coefFile = self.p.config.ENV[
'RTTOV_GUI_COEFF_DIR'] + "/rttov9pred101L/rtcoef_metopsg_1_iasing.H5"
pcFile = self.p.config.ENV[
'RTTOV_GUI_COEFF_DIR'] + "/pc/pccoef_metopsg_1_iasing.H5"
self.p.myCoeffs.fileName["standard"] = coefFile
self.p.myCoeffs.fileName["PC"] = pcFile
print self.p.myCoeffs.fileName
err = self.p.loadCoefficients()
self.assertEqual(err, 0)
err = self.p.runPC()
self.assertEqual(err, 0)
self.check_option(self.p)
def test_profile_without_option(self):
print ">>>>>>>>>>>>>>>>>>>test_profile_without_option"
profileName = self.p.config.ENV[
"RTTOV_GUI_PREFIX"] + "/rttov_tests/profile_without_options.h5"
err = self.p.openProfile(profileName)
self.assertFalse(self.p.myOption["CO2_DATA"])
def test_read_profile_ascii_1(self):
print ">>>>>>>>test_read_profile_ascii_1"
profileName = self.p.config.ENV[
"RTTOV_GUI_PREFIX"] + "/rttov_tests/p_us76.py"
err = self.p.openAsciiProfile(profileName)
self.assertEqual(err, 0)
def test_read_profile_ascii_2(self):
print ">>>>>>>>test_read_profile_ascii_2"
profileName = self.p.config.ENV[
"RTTOV_GUI_PREFIX"] + "/rttov_tests/ECMWF83_prof83.py"
err = self.p.openAsciiProfile(profileName)
self.assertEqual(err, 0)
def test_read_profile_ascii_3(self):
print ">>>>>>>>test_read_profile_ascii_3"
profileName = self.p.config.ENV[
"RTTOV_GUI_PREFIX"] + "/rttov_tests/profile_without_options.h5"
err = self.p.openAsciiProfile(profileName)
self.assertEqual(err, 1)
def test_pc(self):
print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>test pc"
p = rmodel.project.Project()
profileName = p.config.ENV[
"RTTOV_GUI_PROFILE_DIR"] + "/standard54lev_allgas.H5"
print profileName
err = p.openProfile(profileName)
self.assertEqual(err, 0)
print "---------------------TEST PC ---------------------------------"
coefFile = p.config.ENV['RTTOV_GUI_COEFF_DIR'] + \
"/rttov9pred101L/rtcoef_metop_2_iasi.H5"
pcFile = p.config.ENV['RTTOV_GUI_COEFF_DIR'] + \
"/pc/pccoef_metop_2_iasi.H5"
p.myCoeffs.fileName["standard"] = coefFile
p.myCoeffs.fileName["PC"] = pcFile
print p.myCoeffs.fileName
err = p.loadCoefficients()
self.assertEqual(err, 0)
print "isPC ?", p.isPC()
self.assertFalse(p.isPC())
p.myOption["ADDPC"] = True
p.ctrlCoherence()
self.check_option(p)
print "isPC ?", p.isPC()
self.assertTrue(p.isPC())
p.myProfile['SKIN']['SURFTYPE'] = 1
print "-------------------runPC------------------------"
p.myOption["ADDRADREC"] = True
p.myOption["ADDSOLAR"] = True
p.myOption.display()
err = p.runPC()
self.assertEqual(err, 0)
self.assertFalse(p.myOption["ADDSOLAR"])
self.check_option(p)
print "-------------------AIRS-------------------------"
p.dropCoefficients()
coefFile = p.config.ENV['RTTOV_GUI_COEFF_DIR'] + \
"/rttov9pred101L/rtcoef_eos_2_airs.H5"
pcFile = p.config.ENV['RTTOV_GUI_COEFF_DIR'] + \
"/pc/pccoef_eos_2_airs.H5"
p.myCoeffs.fileName["standard"] = coefFile
p.myCoeffs.fileName["PC"] = pcFile
print p.myCoeffs.fileName
err = p.loadCoefficients()
self.assertEqual(err, 0)
err = p.runPC()
self.assertEqual(err, 0)
err = p.runPCK()
self.assertEqual(err, 0)
self.check_option(p)
print "-------------------IASI NG-------------------------"
coefFile = p.config.ENV['RTTOV_GUI_COEFF_DIR'] + \
"/rttov9pred101L/rtcoef_metopsg_1_iasing.H5"
pcFile = p.config.ENV['RTTOV_GUI_COEFF_DIR'] + \
"/pc/pccoef_metopsg_1_iasing.H5"
p.myCoeffs.fileName["standard"] = coefFile
p.myCoeffs.fileName["PC"] = pcFile
print p.myCoeffs.fileName
err = p.loadCoefficients()
self.assertEqual(err, 0)
err = p.runPC()
self.assertEqual(err, 0)
err = p.runPCK()
self.assertEqual(err, 0)
self.check_option(p)
if __name__ == "__main__":
unittest.main()
| 38.209581 | 78 | 0.578906 | 739 | 6,381 | 4.784844 | 0.127199 | 0.056561 | 0.050905 | 0.076357 | 0.790724 | 0.71776 | 0.668552 | 0.65526 | 0.621324 | 0.621324 | 0 | 0.02095 | 0.244476 | 6,381 | 166 | 79 | 38.439759 | 0.712508 | 0.003291 | 0 | 0.573333 | 0 | 0 | 0.253696 | 0.181032 | 0 | 0 | 0 | 0 | 0.166667 | 0 | null | null | 0.006667 | 0.033333 | null | null | 0.126667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cca1f2044601235d36c2ad5b96208fb396023aff | 391 | py | Python | geometric_algebra_attention/keras/Vector2Multivector.py | klarh/geometric_algebra_attention | 327f5d964b5bf72b6bf54b503c23ad8a0d7dc438 | [
"MIT"
] | 5 | 2021-10-14T22:24:00.000Z | 2022-03-24T20:11:59.000Z | geometric_algebra_attention/keras/Vector2Multivector.py | klarh/geometric_algebra_attention | 327f5d964b5bf72b6bf54b503c23ad8a0d7dc438 | [
"MIT"
] | 1 | 2021-12-03T18:51:19.000Z | 2021-12-03T18:51:19.000Z | geometric_algebra_attention/keras/Vector2Multivector.py | klarh/geometric_algebra_attention | 327f5d964b5bf72b6bf54b503c23ad8a0d7dc438 | [
"MIT"
] | 2 | 2021-10-14T22:26:07.000Z | 2022-03-24T20:23:05.000Z |
from tensorflow import keras
from .. import base
from .internal import AttentionBase
class Vector2Multivector(base.Vector2Multivector, keras.layers.Layer):
__doc__ = base.Vector2Multivector.__doc__
math = AttentionBase.math
def call(self, inputs, mask=None):
return self._evaluate(inputs)
keras.utils.get_custom_objects()['Vector2Multivector'] = Vector2Multivector
| 24.4375 | 75 | 0.772379 | 42 | 391 | 6.928571 | 0.595238 | 0.151203 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014925 | 0.143223 | 391 | 15 | 76 | 26.066667 | 0.853731 | 0 | 0 | 0 | 0 | 0 | 0.046154 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0.111111 | 0.888889 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
cca81523859551cb250876da13a087f65573a975 | 95 | py | Python | web/Shitty_Imgur/Solution/__init__.py | abs0lut3pwn4g3/dc91120-CTF | 5582b250f672747dde985e1e39499af10774cee3 | [
"MIT"
] | 3 | 2019-04-20T16:00:33.000Z | 2022-02-13T09:04:04.000Z | web/Shitty_Imgur/Solution/__init__.py | abs0lut3pwn4g3/dc91120-CTF | 5582b250f672747dde985e1e39499af10774cee3 | [
"MIT"
] | null | null | null | web/Shitty_Imgur/Solution/__init__.py | abs0lut3pwn4g3/dc91120-CTF | 5582b250f672747dde985e1e39499af10774cee3 | [
"MIT"
] | null | null | null | x = __import__("subprocess")
images = []
images.append(x.check_output('cat flag*', shell=True)) | 31.666667 | 54 | 0.715789 | 13 | 95 | 4.846154 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084211 | 95 | 3 | 54 | 31.666667 | 0.724138 | 0 | 0 | 0 | 0 | 0 | 0.197917 | 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 |
ccb9e934594036d168fe8fcbfcf0dcde3f7e0e04 | 106 | py | Python | nats/io/__init__.py | brianshannan/python-nats | a76123abe9d5ea3f00bc56bccab35659e54576d8 | [
"Apache-2.0"
] | 62 | 2015-12-18T17:19:24.000Z | 2019-04-11T23:14:35.000Z | nats/io/__init__.py | brianshannan/python-nats | a76123abe9d5ea3f00bc56bccab35659e54576d8 | [
"Apache-2.0"
] | 32 | 2016-05-21T18:38:13.000Z | 2019-03-07T20:48:15.000Z | nats/io/__init__.py | brianshannan/python-nats | a76123abe9d5ea3f00bc56bccab35659e54576d8 | [
"Apache-2.0"
] | 30 | 2015-12-22T07:37:57.000Z | 2019-02-06T22:16:21.000Z | # Copyright 2015 Apcera Inc. All rights reserved.
from nats.io.client import Client
__all__ = ['Client']
| 21.2 | 49 | 0.754717 | 15 | 106 | 5.066667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044444 | 0.150943 | 106 | 4 | 50 | 26.5 | 0.8 | 0.443396 | 0 | 0 | 0 | 0 | 0.105263 | 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 |
cccefa57e73d758093a4b558b42cb7e6a1ed5639 | 189 | py | Python | geo/urls.py | feud72/pub_mask | 8589a2a0f1b2503bdb832c0778aad5dc6580aec3 | [
"MIT"
] | 2 | 2020-03-11T17:16:29.000Z | 2020-03-12T02:06:43.000Z | geo/urls.py | feud72/pub_mask | 8589a2a0f1b2503bdb832c0778aad5dc6580aec3 | [
"MIT"
] | 4 | 2021-03-19T01:06:29.000Z | 2021-09-22T18:49:49.000Z | geo/urls.py | feud72/pub_mask | 8589a2a0f1b2503bdb832c0778aad5dc6580aec3 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
app_name = "geo"
urlpatterns = [
path("", views.geoView, name="index"),
path("<str:lat>/<str:lng>", views.geoView, name="geo"),
]
| 18.9 | 59 | 0.640212 | 26 | 189 | 4.615385 | 0.576923 | 0.116667 | 0.266667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164021 | 189 | 9 | 60 | 21 | 0.759494 | 0 | 0 | 0 | 0 | 0 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.285714 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
aeae2de92b2970bc1f82e994ee9f8310d3b3c43c | 503 | py | Python | src/Chapter12/Exercise1.py | djeada/thinkpython | e8f6e83cfb36ec80f7f27e1aa3f08a0bf541a6a3 | [
"MIT"
] | 3 | 2019-11-10T15:32:52.000Z | 2019-11-20T21:47:31.000Z | src/Chapter12/Exercise1.py | djeada/thinkpython | e8f6e83cfb36ec80f7f27e1aa3f08a0bf541a6a3 | [
"MIT"
] | null | null | null | src/Chapter12/Exercise1.py | djeada/thinkpython | e8f6e83cfb36ec80f7f27e1aa3f08a0bf541a6a3 | [
"MIT"
] | null | null | null | """
Exercise 1
Many of the built-in functions use variable-length argument
tuples. For example, max and min can take any number of
arguments:
>>> max(1,2,3)
3
But sum does not.
>>> sum(1,2,3)
TypeError: sum expected at most 2 arguments, got 3
Write a function called sumall that takes any number
of arguments and returns their sum.
"""
def sumall(*args):
return sum(args)
print(sumall(5, 9, 2))
print(sumall(15, 23, 343, 43))
print(sumall(234, 5, 9, 8, 4, 3, 0, 23))
| 20.12 | 60 | 0.66004 | 88 | 503 | 3.772727 | 0.647727 | 0.099398 | 0.066265 | 0.120482 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084399 | 0.222664 | 503 | 24 | 61 | 20.958333 | 0.764706 | 0.658052 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0 | 0.2 | 0.4 | 0.6 | 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 | 0 | 1 | 0 | 1 | 0 | 3 |
aeb96f235ad84be4bd0a09c167c0d8f24c6ae5f5 | 538 | py | Python | clean/request/inout/filter.py | bahnlink/pyclean | 558d75341082472606788e088809831f6ea543c0 | [
"MIT"
] | null | null | null | clean/request/inout/filter.py | bahnlink/pyclean | 558d75341082472606788e088809831f6ea543c0 | [
"MIT"
] | 2 | 2021-03-25T21:49:39.000Z | 2021-06-01T22:12:00.000Z | clean/request/inout/filter.py | bahnlink/pyclean | 558d75341082472606788e088809831f6ea543c0 | [
"MIT"
] | 1 | 2018-06-07T17:31:56.000Z | 2018-06-07T17:31:56.000Z | from typing import Dict
class Page:
__slots__ = ['offset', 'limit']
def __init__(self, offset: int=0, limit: int=100):
self.offset = offset
self.limit = limit
@classmethod
def from_dict(cls, params: Dict):
return cls(offset=params.get('offset', 0),
limit=params.get('limit', 10))
class Sort:
__slots__ = ['by']
def __init__(self, by: str=''):
self.by = by
@classmethod
def from_dict(cls, params: Dict):
return cls(by=params.get('by', ''))
| 20.692308 | 54 | 0.574349 | 68 | 538 | 4.279412 | 0.352941 | 0.092784 | 0.075601 | 0.151203 | 0.302406 | 0.302406 | 0.302406 | 0.302406 | 0.302406 | 0 | 0 | 0.018088 | 0.280669 | 538 | 25 | 55 | 21.52 | 0.73385 | 0 | 0 | 0.235294 | 0 | 0 | 0.048327 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.058824 | 0.117647 | 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 |
aec0fdbc63293346307b5ede35f23d4dff4a9946 | 122 | py | Python | opconsole/views/agendaView.py | baalkor/timetracking | 35a1650ceffa55e0ff7ef73b63e5f3457dc07612 | [
"Apache-2.0"
] | 1 | 2017-06-05T10:52:13.000Z | 2017-06-05T10:52:13.000Z | opconsole/views/agendaView.py | baalkor/timetracking | 35a1650ceffa55e0ff7ef73b63e5f3457dc07612 | [
"Apache-2.0"
] | 2 | 2017-05-10T20:47:33.000Z | 2017-05-10T20:49:24.000Z | opconsole/views/agendaView.py | baalkor/timetracking | 35a1650ceffa55e0ff7ef73b63e5f3457dc07612 | [
"Apache-2.0"
] | null | null | null | from django.views.generic import TemplateView
class AgendaView(TemplateView):
template_name = "opconsole_agenda.html" | 30.5 | 45 | 0.819672 | 14 | 122 | 7 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106557 | 122 | 4 | 46 | 30.5 | 0.899083 | 0 | 0 | 0 | 0 | 0 | 0.170732 | 0.170732 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
aecb61c8c99dd471426b59736753da4246f9e9b0 | 181 | py | Python | ultimanager/landing/views.py | UltiManager/ultimanager-api | 4109ef21d187578ae978c9973e7ad11c88258b35 | [
"MIT"
] | null | null | null | ultimanager/landing/views.py | UltiManager/ultimanager-api | 4109ef21d187578ae978c9973e7ad11c88258b35 | [
"MIT"
] | 60 | 2017-12-24T02:22:09.000Z | 2022-02-10T08:20:13.000Z | ultimanager/landing/views.py | UltiManager/ultimanager-api | 4109ef21d187578ae978c9973e7ad11c88258b35 | [
"MIT"
] | null | null | null | from django.views import generic
class LandingView(generic.TemplateView):
"""
Show a landing page for the application.
"""
template_name = "landing/landing.html"
| 18.1 | 44 | 0.701657 | 21 | 181 | 6 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20442 | 181 | 9 | 45 | 20.111111 | 0.875 | 0.220994 | 0 | 0 | 0 | 0 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
aecdbdb3533cde0ed7b53da762aaff15185bb11f | 473 | gyp | Python | binding.gyp | andreymaznyak/gpiobcm2835nodejs | 30af970a32d1c7801e437f5a643b24186f407c78 | [
"MIT"
] | null | null | null | binding.gyp | andreymaznyak/gpiobcm2835nodejs | 30af970a32d1c7801e437f5a643b24186f407c78 | [
"MIT"
] | 1 | 2017-08-15T23:48:55.000Z | 2017-08-15T23:48:55.000Z | binding.gyp | andreymaznyak/gpiobcm2835nodejs | 30af970a32d1c7801e437f5a643b24186f407c78 | [
"MIT"
] | null | null | null | {
'targets': [
{
'target_name': 'gpiobcm2835nodejs',
'sources': [
'src/gpiobcm2835nodejs.cc'
],
"cflags" : [ "-lrt -lbcm2835" ],
'conditions': [
['OS=="linux"', {
'cflags!': [
'-lrt -lbcm2835',
],
}],
],
'include_dirs': [
'src/gpio_functions',
],
'libraries': [
'-lbcm2835'
]
}
]
} | 19.708333 | 41 | 0.340381 | 24 | 473 | 6.583333 | 0.75 | 0.113924 | 0.21519 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081967 | 0.484144 | 473 | 24 | 42 | 19.708333 | 0.565574 | 0 | 0 | 0.166667 | 0 | 0 | 0.371308 | 0.050633 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4e25a709c9590b96b967dbe59857ba0dbababb38 | 184 | py | Python | backend_rest/users/urls.py | ezrankayamba/twiga_expodocs | 39303f137f3761e7024e1e0e1a6449f4187e30e9 | [
"MIT"
] | null | null | null | backend_rest/users/urls.py | ezrankayamba/twiga_expodocs | 39303f137f3761e7024e1e0e1a6449f4187e30e9 | [
"MIT"
] | 13 | 2020-02-21T13:58:18.000Z | 2022-03-12T00:16:26.000Z | backend_rest/users/urls.py | ezrankayamba/twiga_expodocs | 39303f137f3761e7024e1e0e1a6449f4187e30e9 | [
"MIT"
] | null | null | null | from django.urls import path, include
from . import views
urlpatterns = [
path('me/', views.UserDetailView.as_view()),
path('register-me/', views.CreateUserView.as_view()),
]
| 23 | 57 | 0.701087 | 23 | 184 | 5.521739 | 0.608696 | 0.110236 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141304 | 184 | 7 | 58 | 26.285714 | 0.803797 | 0 | 0 | 0 | 0 | 0 | 0.081522 | 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 |
9d920be8d38c6eff63c591d77e6ace5dfac9e90d | 290 | py | Python | Python/Basic Programs/fibonacci.py | themohitpapneja/Code_Dump | ec72144e66d12cba2ce719c37292517588490b42 | [
"Apache-2.0"
] | null | null | null | Python/Basic Programs/fibonacci.py | themohitpapneja/Code_Dump | ec72144e66d12cba2ce719c37292517588490b42 | [
"Apache-2.0"
] | null | null | null | Python/Basic Programs/fibonacci.py | themohitpapneja/Code_Dump | ec72144e66d12cba2ce719c37292517588490b42 | [
"Apache-2.0"
] | null | null | null |
Number = int(input("\nPlease Enter the Range Number: "))
First_Value = 0
Second_Value = 1
for Num in range(0, Number):
if (Num <= 1):
Next = Num
else:
Next = First_Value + Second_Value
First_Value = Second_Value
Second_Value = Next
print(Next) | 20.714286 | 56 | 0.610345 | 40 | 290 | 4.25 | 0.475 | 0.258824 | 0.282353 | 0.247059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019512 | 0.293103 | 290 | 14 | 57 | 20.714286 | 0.809756 | 0 | 0 | 0 | 0 | 0 | 0.113793 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.090909 | 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 |
9d952333ef9d4545b20d1022720edd638c914a63 | 1,302 | py | Python | qiskit/transpiler/passes/utils/remove_barriers.py | Roshan-Thomas/qiskit-terra | 77219b5c7b7146b1545c5e5190739b36f4064b2f | [
"Apache-2.0"
] | 1,599 | 2018-07-10T10:59:12.000Z | 2022-03-31T23:56:25.000Z | qiskit/transpiler/passes/utils/remove_barriers.py | Roshan-Thomas/qiskit-terra | 77219b5c7b7146b1545c5e5190739b36f4064b2f | [
"Apache-2.0"
] | 5,244 | 2018-07-10T06:20:13.000Z | 2022-03-31T22:18:48.000Z | qiskit/transpiler/passes/utils/remove_barriers.py | Roshan-Thomas/qiskit-terra | 77219b5c7b7146b1545c5e5190739b36f4064b2f | [
"Apache-2.0"
] | 1,409 | 2018-07-10T02:16:12.000Z | 2022-03-31T09:01:32.000Z | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
"""Remove all barriers in a circuit"""
from qiskit.dagcircuit import DAGCircuit
from qiskit.transpiler.basepasses import TransformationPass
class RemoveBarriers(TransformationPass):
"""Return a circuit with any barrier removed.
This transformation is not semantics preserving.
Example:
.. jupyter-execute::
from qiskit import QuantumCircuit
from qiskit.transpiler.passes import RemoveBarriers
circuit = QuantumCircuit(1)
circuit.x(0)
circuit.barrier()
circuit.h(0)
circuit = RemoveBarriers()(circuit)
circuit.draw()
"""
def run(self, dag: DAGCircuit) -> DAGCircuit:
"""Run the RemoveBarriers pass on `dag`."""
dag.remove_all_ops_named("barrier")
return dag
| 27.702128 | 77 | 0.682028 | 165 | 1,302 | 5.363636 | 0.569697 | 0.045198 | 0.022599 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015167 | 0.240399 | 1,302 | 46 | 78 | 28.304348 | 0.879676 | 0.719662 | 0 | 0 | 0 | 0 | 0.024221 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.333333 | 0.333333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
9d9fe1911cfe9619d85e9ef33031efdf610dce2c | 444 | py | Python | src/file_management.py | Caasitroplla/Music-Programme-Generator | fa59093449787c361b48903d67e0ae5c0cf7ca38 | [
"Apache-2.0"
] | null | null | null | src/file_management.py | Caasitroplla/Music-Programme-Generator | fa59093449787c361b48903d67e0ae5c0cf7ca38 | [
"Apache-2.0"
] | null | null | null | src/file_management.py | Caasitroplla/Music-Programme-Generator | fa59093449787c361b48903d67e0ae5c0cf7ca38 | [
"Apache-2.0"
] | null | null | null | from pathlib import Path
def homepath():
return Path.home()/"Documents"/"Programme Generator"
def sourcepath():
return Path.cwd()/"src"
def jsontemplates():
return Path.cwd()/"json_templates"
def validate(filepath):
if not Path.exists(filepath):
try:
Path.mkdir(filepath)
except FileNotFoundError:
validate(Path(filepath).parent)
Path.mkdir(filepath)
validate(homepath()) | 22.2 | 56 | 0.650901 | 48 | 444 | 6 | 0.5625 | 0.104167 | 0.090278 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.227477 | 444 | 20 | 57 | 22.2 | 0.83965 | 0 | 0 | 0.133333 | 0 | 0 | 0.101124 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.066667 | 0.2 | 0.533333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
9db6502632f1c085eecc98f69efe4f4997e3c3d1 | 1,381 | py | Python | keymaster/common/service/enigma.py | shiroyuki/spymaster | 1efee54427378394ab04d0e53247eb38c28bc97c | [
"Apache-2.0"
] | null | null | null | keymaster/common/service/enigma.py | shiroyuki/spymaster | 1efee54427378394ab04d0e53247eb38c28bc97c | [
"Apache-2.0"
] | null | null | null | keymaster/common/service/enigma.py | shiroyuki/spymaster | 1efee54427378394ab04d0e53247eb38c28bc97c | [
"Apache-2.0"
] | null | null | null | import binascii
import hashlib
from functools import lru_cache
from typing import Optional
import keyring
from cryptography.fernet import Fernet
class Enigma:
def __init__(self, key: Optional[str] = None):
self.__key = key
# FIXME Use something like RSA to encrypt/decrypt data
@property
@lru_cache(maxsize=1)
def _key(self) -> bytes:
if self.__key is not None:
return self.__key
stored_key: str = keyring.get_password('com.shiroyuki.keymaster', 'master_enc_key')
if not stored_key:
new_key: bytes = Fernet.generate_key()
keyring.set_password('com.shiroyuki.keymaster', 'master_enc_key', new_key.decode())
return new_key
return stored_key.encode()
@property
@lru_cache(maxsize=1)
def _inf(self):
return Fernet(self._key)
def decrypt(self, content: bytes) -> str:
return self._inf.decrypt(content).decode()
def encrypt(self, content: str) -> str:
return self._inf.encrypt(content.encode()).decode()
def hash512(self, content: str, salt: Optional[str] = None) -> str:
if salt is None:
m = hashlib.sha512()
m.update(content)
return m.hexdigest()
dk = hashlib.pbkdf2_hmac('sha512', content.encode(), salt.encode(), 100000)
return binascii.hexlify(dk).decode()
| 30.021739 | 95 | 0.643012 | 175 | 1,381 | 4.891429 | 0.36 | 0.040888 | 0.035047 | 0.053738 | 0.158879 | 0.158879 | 0.095794 | 0 | 0 | 0 | 0 | 0.017375 | 0.249819 | 1,381 | 45 | 96 | 30.688889 | 0.80888 | 0.037654 | 0 | 0.114286 | 0 | 0 | 0.060286 | 0.034665 | 0 | 0 | 0 | 0.022222 | 0 | 1 | 0.171429 | false | 0.057143 | 0.171429 | 0.085714 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
9dcd89b6cd937660cb06a22ee5812d65d5a14428 | 684 | py | Python | kddirkit/dataloaders/DealDataset.py | JohannesLiu/HNRE-Pytorch | 395f026e54e02a631db522a828b1e017ffca6e59 | [
"MIT"
] | 1 | 2021-03-03T14:06:45.000Z | 2021-03-03T14:06:45.000Z | kddirkit/dataloaders/DealDataset.py | JohannesLiu/HNRE-Pytorch | 395f026e54e02a631db522a828b1e017ffca6e59 | [
"MIT"
] | null | null | null | kddirkit/dataloaders/DealDataset.py | JohannesLiu/HNRE-Pytorch | 395f026e54e02a631db522a828b1e017ffca6e59 | [
"MIT"
] | null | null | null | import torch
from torch.utils.data import Dataset, DataLoader, TensorDataset
from torch.autograd import Variable
import numpy as np
class DealDataset(Dataset):
"""
下载数据、初始化数据,都可以在这里完成
"""
def __init__(self):
# xy = np.loadtxt('./dataset/diabetes.csv.gz', delimiter=',', dtype=np.float32) # 使用numpy读取数据
# self.x_data = torch.from_numpy(xy[:, 0:-1])
# self.y_data = torch.from_numpy(xy[:, [-1]])
# self.len = xy.shape[0]
NotImplemented
def __getitem__(self, index):
# return self.x_data[index], self.y_data[index]
NotImplemented
def __len__(self):
# return self.len
NotImplemented | 27.36 | 102 | 0.630117 | 84 | 684 | 4.916667 | 0.47619 | 0.065375 | 0.043584 | 0.087167 | 0.096852 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011561 | 0.241228 | 684 | 25 | 103 | 27.36 | 0.7842 | 0.416667 | 0 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.363636 | 0 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
9dd8b23e8e755f723c64cff8c748701b1f47d779 | 52 | py | Python | avalara/__init__.py | Lightmatter/django-oscar-avalara | 27e17080bfba1ff6b90dbedcf5fde034c34b7a22 | [
"BSD-3-Clause"
] | 4 | 2015-08-14T20:43:01.000Z | 2021-02-08T03:43:04.000Z | avalara/__init__.py | Lightmatter/django-oscar-avalara | 27e17080bfba1ff6b90dbedcf5fde034c34b7a22 | [
"BSD-3-Clause"
] | 3 | 2015-10-03T18:15:47.000Z | 2020-10-05T13:44:33.000Z | avalara/__init__.py | Lightmatter/django-oscar-avalara | 27e17080bfba1ff6b90dbedcf5fde034c34b7a22 | [
"BSD-3-Clause"
] | 7 | 2015-01-16T16:47:47.000Z | 2019-11-01T18:26:50.000Z | default_app_config = 'avalara.config.AvalaraConfig'
| 26 | 51 | 0.846154 | 6 | 52 | 7 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057692 | 52 | 1 | 52 | 52 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0.538462 | 0.538462 | 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 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d180299df4ae7c4afdef25f1435a00c4f46618bb | 86 | py | Python | 1_Fundamental Python Programming/1_3_Data Structures/Lists/Length.py | NishkarshRaj/Python-Programming | 29506d8d7ed80730ce5cafd5945f83c81f003e68 | [
"Unlicense"
] | 6 | 2019-07-15T14:54:52.000Z | 2021-11-26T22:34:44.000Z | 1_Fundamental Python Programming/1_3_Data Structures/Lists/Length.py | NishkarshRaj/Python-Programming | 29506d8d7ed80730ce5cafd5945f83c81f003e68 | [
"Unlicense"
] | 1 | 2019-07-15T14:53:35.000Z | 2019-07-15T14:53:35.000Z | 1_Fundamental Python Programming/1_3_Data Structures/Lists/Length.py | NishkarshRaj/Python-Programming | 29506d8d7ed80730ce5cafd5945f83c81f003e68 | [
"Unlicense"
] | 2 | 2019-08-05T01:30:10.000Z | 2020-05-04T18:36:46.000Z | print("Size of list");
list1 = [1,23,5,2,42,526,52];
print(list1);
print(len(list1));
| 17.2 | 29 | 0.639535 | 17 | 86 | 3.235294 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.192308 | 0.093023 | 86 | 4 | 30 | 21.5 | 0.512821 | 0 | 0 | 0 | 0 | 0 | 0.139535 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.75 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
d191abdd480a440c052d5e1c72d036cda6ba94f6 | 472 | py | Python | src/uploadingStateMachine.py | bobjects/dharmacorder | 082144c3e70a9ae5f788ad4130d79599c2400dfa | [
"MIT"
] | null | null | null | src/uploadingStateMachine.py | bobjects/dharmacorder | 082144c3e70a9ae5f788ad4130d79599c2400dfa | [
"MIT"
] | null | null | null | src/uploadingStateMachine.py | bobjects/dharmacorder | 082144c3e70a9ae5f788ad4130d79599c2400dfa | [
"MIT"
] | null | null | null | from dharmacorderStateMachine import DharmacorderStateMachine
from initialUploadingState import InitialUploadingState
class UploadingStateMachine(DharmacorderStateMachine):
def __init__(self, a_dharmacorder):
super(UploadingStateMachine, self).__init__(a_dharmacorder)
self.session_to_upload = None
@property
def initial_state_class(self):
return InitialUploadingState
@property
def print_color(self):
return 'blue'
| 27.764706 | 67 | 0.769068 | 42 | 472 | 8.285714 | 0.547619 | 0.074713 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177966 | 472 | 16 | 68 | 29.5 | 0.896907 | 0 | 0 | 0.166667 | 0 | 0 | 0.008475 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.166667 | 0.166667 | 0.666667 | 0.083333 | 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 |
d1afdda260d0f338f25af4bce3f3879f443ca547 | 252 | py | Python | src/alert_control_center/alerts/models/__init__.py | georgepsarakis/alert-control-center | de435c691a59c198f8b5ac620053b2600558eeaa | [
"BSD-3-Clause"
] | null | null | null | src/alert_control_center/alerts/models/__init__.py | georgepsarakis/alert-control-center | de435c691a59c198f8b5ac620053b2600558eeaa | [
"BSD-3-Clause"
] | 5 | 2021-03-18T21:52:10.000Z | 2022-02-10T11:04:13.000Z | src/alert_control_center/alerts/models/__init__.py | georgepsarakis/alert-control-center | de435c691a59c198f8b5ac620053b2600558eeaa | [
"BSD-3-Clause"
] | null | null | null | from alert_control_center.alerts.models.alerts import \
Assignee, Team, Organization, Alert, \
AlertAssignee, EscalationPolicy, \
EscalationRule, EscalationRulePolicy, \
IncomingWebhook, IncomingChannel, AlertVendor, IncomingWebhookLog
| 42 | 69 | 0.789683 | 20 | 252 | 9.85 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138889 | 252 | 5 | 70 | 50.4 | 0.907834 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d1b3e0c1d86229123f863797400d99deb0e8c616 | 177 | py | Python | gitzebo/version.py | jgilik/gitzebo | 29e2e47048df5429e90bd55d2f267e23fe15e213 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | gitzebo/version.py | jgilik/gitzebo | 29e2e47048df5429e90bd55d2f267e23fe15e213 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | gitzebo/version.py | jgilik/gitzebo | 29e2e47048df5429e90bd55d2f267e23fe15e213 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | #!/usr/bin/env python
major_version = 0
minor_version = 0
patch_version = 10
def format_version():
return "{0}.{1}.{2}".format(major_version, minor_version, patch_version)
| 22.125 | 76 | 0.728814 | 27 | 177 | 4.518519 | 0.555556 | 0.196721 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045161 | 0.124294 | 177 | 7 | 77 | 25.285714 | 0.741935 | 0.112994 | 0 | 0 | 0 | 0 | 0.070513 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0.2 | 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 | 0 | 1 | 0 | 0 | 0 | 3 |
d1c360eaef1c34652f38ae5fd766340b968d9f42 | 176 | py | Python | llvm/utils/lit/tests/lld-features.py | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 2,338 | 2018-06-19T17:34:51.000Z | 2022-03-31T11:00:37.000Z | llvm/utils/lit/tests/lld-features.py | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 3,740 | 2019-01-23T15:36:48.000Z | 2022-03-31T22:01:13.000Z | llvm/utils/lit/tests/lld-features.py | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 500 | 2019-01-23T07:49:22.000Z | 2022-03-30T02:59:37.000Z | ## Show that each of the LLD variants detected by use_lld comes with its own
## feature.
# RUN: %{lit} %{inputs}/lld-features 2>&1 | FileCheck %s -DDIR=%p
# CHECK: Passed: 4
| 25.142857 | 76 | 0.676136 | 30 | 176 | 3.933333 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020833 | 0.181818 | 176 | 6 | 77 | 29.333333 | 0.798611 | 0.926136 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d1c396d3ff20b9a11f3fb9612fce94e9c617fd3e | 5,766 | py | Python | ENIAC/api/loop_stack/loop_indicators/momentum_indicator.py | Ahrli/fast_tools | 144d764e4f169d3ab3753dcc6a79db9f9449de59 | [
"Apache-2.0"
] | 1 | 2021-12-11T16:33:47.000Z | 2021-12-11T16:33:47.000Z | ENIAC/api/loop_stack/loop_indicators/momentum_indicator.py | webclinic017/fast_tools | 144d764e4f169d3ab3753dcc6a79db9f9449de59 | [
"Apache-2.0"
] | null | null | null | ENIAC/api/loop_stack/loop_indicators/momentum_indicator.py | webclinic017/fast_tools | 144d764e4f169d3ab3753dcc6a79db9f9449de59 | [
"Apache-2.0"
] | 3 | 2021-11-22T09:46:43.000Z | 2022-01-28T22:33:07.000Z | import backtrader.indicators as btind
from . import compare_price as compare
from .base_indicator import iBaseIndicator
class iMomentumCompare(iBaseIndicator):
'''
因子:平均移动线比较数值
传入参数:
rule = {"args": ["5"], #ema周期
"logic":{"compare": "eq","byValue": 1,"byMax": 5,}, # 周期结果比较
}
'''
lines = ('momentum',)
params = dict(rule=list())
def __init__(self):
super(iMomentumCompare, self).__init__()
self.momentum = btind.Momentum(self.data.close, period=self.args[0])
def next(self):
self.lines.momentum[0] = compare(self.momentum[0], self.logic)
@classmethod
def judge(cls, cond):
return int(cond['args'][0])
class iMomentumCrossGolden(iBaseIndicator):
'''
因子:金叉
传入参数:
rule = {"args": ["5","10"], #短均线周期, 长均线周期
"logic":{"compare": "eq","byValue": 1,"byMax": 5,}, # 金叉情况比较大小, 短比长高多少
}
'''
lines = ('goldencross', )
params = dict(rule=list())
def __init__(self):
super(iMomentumCrossGolden, self).__init__()
self.momentum_short = btind.Momentum(self.data.close, period=self.args[0])
self.momentum_long = btind.Momentum(self.data.close, period=self.args[1])
self.cross = btind.CrossOver(self.momentum_short, self.momentum_long)
def next(self):
if self.cross[0] == 1:
self.lines.goldencross[0] = compare(self.momentum_short[0]-self.momentum_long[0], self.logic)
else:
self.lines.goldencross[0] = False
# print(self.momentum_short[0], self.momentum_long[0],'*',self.data.datetime.date())
@classmethod
def judge(cls, cond):
return int(cond['args'][0])
class iMomentumCrossDie(iBaseIndicator):
'''
因子:死叉
传入参数:
rule = {"args": ["5","10"], #短均线周期, 长均线周期
"logic":{"compare": "eq","byValue": 1,"byMax": 5,}, # 金叉情况比较大小, 短比长高多少
}
'''
lines = ('goldencross', )
params = dict(rule=list())
def __init__(self):
super(iMomentumCrossDie, self).__init__()
self.momentum_short = btind.Momentum(self.data.close, period=self.args[0])
self.momentum_long = btind.Momentum(self.data.close, period=self.args[1])
self.cross = btind.CrossOver(self.momentum_short, self.momentum_long)
def next(self):
if self.cross[0] == -1:
self.lines.goldencross[0] = compare(self.momentum_long[0]-self.momentum_short[0], self.logic)
else:
self.lines.goldencross[0] = False
@classmethod
def judge(cls, cond):
return int(cond['args'][0])
class iMomentumLong(iBaseIndicator):
'''
传入参数:
rule = {"args": [5,10, 5], # 连续N日短均线, 连续N日长均线, 连续N天多头
"logic":{"compare": "eq","byValue": 1,"byMax": 5,}, #无用
}
'''
lines = ('momentumlong',)
params = dict(rule=list())
def __init__(self):
super(iMomentumLong, self).__init__()
self.momentum_short = btind.Momentum(self.data.close, period=self.args[0])
self.momentum_long = btind.Momentum(self.data.close, period=self.args[1])
def next(self):
momentumlong = set([ self.momentum_short[i] > self.momentum_long[i] for i in range(1-self.args[2],1)])
if len(momentumlong) == 1 and True in momentumlong:
self.lines.momentumlong[0] = True
else:
self.lines.momentumlong[0] = False
@classmethod
def judge(cls, cond):
return int(cond['args'][1]) + int(cond['args'][2])
class iMomentumShort(iBaseIndicator):
'''
传入参数:
rule = {"args": [5,10, 5], # 连续N日短均线, 连续N日长均线, 连续N天多头
"logic":{"compare": "eq","byValue": 1,"byMax": 5,}, #无用
}
'''
lines = ('momentumshort',)
params = dict(rule=list())
def __init__(self):
super(iMomentumShort, self).__init__()
self.momentum_short = btind.Momentum(self.data.close, period=self.args[0])
self.momentum_long = btind.Momentum(self.data.close, period=self.args[1])
def next(self):
momentumshort = set([self.momentum_short[i] < self.momentum_long[i] for i in range(1-self.args[2],1)])
if len(momentumshort) == 1 and True in momentumshort:
self.lines.momentumshort[0] = True
else:
self.lines.momentumshort[0] = False
@classmethod
def judge(cls, cond):
return int(cond['args'][1]) + int(cond['args'][2])
class iMomentumTop(iBaseIndicator):
'''
因子:最近 n 天 最高点
传入参数:
rule = {"args": [30] ,
"logic":{"compare": "eq","byValue": 1,"byMax": 5,}, #无意义
'''
lines = ('momentumtop',)
params = dict(rule=list())
def __init__(self):
super(iMomentumTop, self).__init__()
self.momentum = btind.Momentum(self.data.close, period=self.args[0])
def next(self):
_list = list(self.momentum.get(size=self.args[1]))
if len(_list) == self.args[1] and self.momentum[0] == max(_list):
self.lines.momentumtop[0] = True
else:
self.lines.momentumtop[0] = False
class iMomentumBottom(iBaseIndicator):
'''
因子:最近 n 天 最低点
传入参数:
rule = {"args": [5,30] ,
"logic":{"compare": "eq","byValue": 1,"byMax": 5,}, #无意义
'''
lines = ('momentumbottom',)
params = dict(rule=list())
def __init__(self):
super(iMomentumBottom, self).__init__()
self.momentum = btind.Momentum(self.data.close, period=self.args[0])
def next(self):
_list = list(self.momentum.get(size=self.args[1]))
if len(_list) == self.args[1] and self.momentum[0] == min(_list):
self.lines.momentumbottom[0] = True
else:
self.lines.momentumbottom[0] = False | 31.856354 | 110 | 0.587756 | 691 | 5,766 | 4.780029 | 0.141823 | 0.108992 | 0.056615 | 0.069936 | 0.749016 | 0.708447 | 0.708447 | 0.69997 | 0.648501 | 0.607629 | 0 | 0.020752 | 0.247832 | 5,766 | 181 | 111 | 31.856354 | 0.740835 | 0.177766 | 0 | 0.598039 | 0 | 0 | 0.023789 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.186275 | false | 0 | 0.029412 | 0.04902 | 0.470588 | 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 |
d1c7697208a81001fe40f88140a416ec155f6e8f | 445 | py | Python | tests/test_parse_ipdeny.py | pawel-slowik/ipset-country | e14994eb44d977c59c147a81fabc4c3f3cd8c392 | [
"MIT"
] | null | null | null | tests/test_parse_ipdeny.py | pawel-slowik/ipset-country | e14994eb44d977c59c147a81fabc4c3f3cd8c392 | [
"MIT"
] | null | null | null | tests/test_parse_ipdeny.py | pawel-slowik/ipset-country | e14994eb44d977c59c147a81fabc4c3f3cd8c392 | [
"MIT"
] | null | null | null | import ipaddress
import pytest
from ipset import parse_ipdeny
from .util import open_test_file
def test_valid() -> None:
with open_test_file("ipdeny/valid.zone") as text_input:
assert list(parse_ipdeny(text_input)) == [ipaddress.IPv4Network("127.0.0.0/24")]
def test_error() -> None:
with open_test_file("ipdeny/invalid.zone") as text_input:
with pytest.raises(ValueError):
list(parse_ipdeny(text_input))
| 27.8125 | 88 | 0.719101 | 65 | 445 | 4.692308 | 0.446154 | 0.118033 | 0.118033 | 0.104918 | 0.327869 | 0.170492 | 0 | 0 | 0 | 0 | 0 | 0.024324 | 0.168539 | 445 | 15 | 89 | 29.666667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.107865 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0.181818 | true | 0 | 0.363636 | 0 | 0.545455 | 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 |
d1e20b02a85c1e301ad610765010d658c5dae623 | 190 | py | Python | idigbio_media_appliance/lib/__init__.py | gauravyeole/iDigBio-appliance | 4fae0ef1e7cffc13c523a3a837b1b48da71b79b9 | [
"MIT"
] | 3 | 2016-11-15T21:09:09.000Z | 2020-04-14T15:17:16.000Z | idigbio_media_appliance/lib/__init__.py | gauravyeole/iDigBio-appliance | 4fae0ef1e7cffc13c523a3a837b1b48da71b79b9 | [
"MIT"
] | 17 | 2016-11-21T21:02:22.000Z | 2020-03-25T18:54:53.000Z | idigbio_media_appliance/lib/__init__.py | gauravyeole/iDigBio-appliance | 4fae0ef1e7cffc13c523a3a837b1b48da71b79b9 | [
"MIT"
] | 2 | 2017-06-09T17:30:37.000Z | 2019-04-09T22:09:54.000Z | import uuid
def get_uuid_unicode():
u = uuid.uuid4()
try:
return unicode(u)
except NameError:
return str(u)
class NotAuthorizedException(Exception):
pass
| 13.571429 | 40 | 0.636842 | 22 | 190 | 5.409091 | 0.727273 | 0.134454 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007299 | 0.278947 | 190 | 13 | 41 | 14.615385 | 0.861314 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.111111 | 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 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
d1e381e69abb251c93ca2bd966faa81578cec29a | 76 | py | Python | ploceidae/container/__init__.py | MATTHEWFRAZER/pygmy | c2487e561c855130404a049ddfaf361e4fbb7753 | [
"MIT"
] | null | null | null | ploceidae/container/__init__.py | MATTHEWFRAZER/pygmy | c2487e561c855130404a049ddfaf361e4fbb7753 | [
"MIT"
] | 1 | 2021-03-01T03:35:39.000Z | 2021-03-01T03:35:39.000Z | ploceidae/container/__init__.py | MATTHEWFRAZER/pygmy | c2487e561c855130404a049ddfaf361e4fbb7753 | [
"MIT"
] | null | null | null | from ploceidae.container.container import Container
__all__ = ["Container"] | 25.333333 | 51 | 0.815789 | 8 | 76 | 7.25 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092105 | 76 | 3 | 52 | 25.333333 | 0.84058 | 0 | 0 | 0 | 0 | 0 | 0.116883 | 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 |
d1f647af8b01f9408ba367c5477b9df3b18b8e0b | 425 | py | Python | tests/test_bool.py | el-dee/pyopenxr | 8ea0b8fafd21e46e009b6cbab626264b5f7a4470 | [
"Apache-2.0"
] | 31 | 2021-08-01T22:49:59.000Z | 2022-03-24T05:04:14.000Z | tests/test_bool.py | el-dee/pyopenxr | 8ea0b8fafd21e46e009b6cbab626264b5f7a4470 | [
"Apache-2.0"
] | 56 | 2021-08-02T02:24:29.000Z | 2022-03-20T16:25:48.000Z | tests/test_bool.py | el-dee/pyopenxr | 8ea0b8fafd21e46e009b6cbab626264b5f7a4470 | [
"Apache-2.0"
] | 2 | 2021-08-30T00:59:41.000Z | 2022-02-25T20:00:08.000Z | import unittest
import xr
class TestBool(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_bool(self):
self.assertTrue(True)
self.assertFalse(False)
self.assertTrue(xr.TRUE)
self.assertFalse(xr.FALSE)
self.assertTrue(xr.Bool32(True))
self.assertFalse(xr.Bool32(False))
if __name__ == '__main__':
unittest.main()
| 17.708333 | 42 | 0.625882 | 49 | 425 | 5.244898 | 0.428571 | 0.163424 | 0.22179 | 0.163424 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01278 | 0.263529 | 425 | 23 | 43 | 18.478261 | 0.808307 | 0 | 0 | 0.125 | 0 | 0 | 0.018824 | 0 | 0 | 0 | 0 | 0 | 0.375 | 1 | 0.1875 | false | 0.125 | 0.125 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d1fb465230985147193142c8c7eee2a84f36322d | 27,898 | py | Python | slingen/src/algogen/core/expression.py | danielesgit/slingen | e7cfee7f6f2347b57eb61a077746c9309a85411c | [
"BSD-3-Clause"
] | 23 | 2018-03-13T07:52:26.000Z | 2022-03-24T02:32:00.000Z | slingen/src/algogen/core/expression.py | danielesgit/slingen | e7cfee7f6f2347b57eb61a077746c9309a85411c | [
"BSD-3-Clause"
] | 2 | 2018-09-28T18:29:25.000Z | 2019-02-20T13:22:19.000Z | slingen/src/algogen/core/expression.py | danielesgit/slingen | e7cfee7f6f2347b57eb61a077746c9309a85411c | [
"BSD-3-Clause"
] | 3 | 2018-06-13T13:51:57.000Z | 2020-01-11T14:47:02.000Z | import copy
import collections
import itertools
import core.attributes as attributes
import core.properties as properties
from core.exceptions import WrongArityError
from core.TOS import _TOS
class BaseExpression( object ):
def __init__( self, children = [], line = -1 ):
self.head = self.__class__
# For a simple use of patterns after matching
# asumming only two levels of nestedness, that is,
# children may have iterables (sequences or lists) but
# not iterables containing more iterables
self.children = []
for ch in children:
#if isinstance( ch, collections.Iterable ):
if isinstance( ch, Sequence ):
self.children.extend( ch )
else:
self.children.append( ch )
self.properties = set()
self.size = None
def get_head( self ):
return self.head
def get_children( self ):
return self.children
def set_children( self, i, expr ):
self.children[i] = expr
def get_size( self ):
return self.size
def num_nodes( self ):
return len(list(self.iterate_preorder()))
def _cleanup( self ):
raise NotImplementedError
def match( self, ctx ):
raise NotImplementedError
def iterate_preorder( self ):
yield self
for child in self.get_children():
yield from child.iterate_preorder()
def _preorder_position( self, parent=(None, None) ):
yield (id(self), parent)
for i, child in enumerate(self.get_children()):
yield from child._preorder_position( (self, i) )
def _postorder_stack( self, parent=(None, None) ):
if len( self.get_children() ) == 0:
return [ self, parent, [] ]
else:
return [ self, parent, [ch._postorder_stack((self, i)) for i, ch in enumerate(self.get_children())] ]
def __eq__( self, other ):
return self.get_head() == other.get_head() and \
len(self.get_children()) == len(other.get_children()) and \
all( [ x == y for x,y in zip(self.get_children(), other.get_children()) ] )
#
# Property handling
#
def set_property( self, prop ):
self.properties.add( prop )
def get_properties( self ):
return self.properties
def isInput( self ):
return properties.INPUT in self.properties
def isOutput( self ):
return properties.OUTPUT in self.properties
def isTemporary( self ):
return properties.TEMPORARY in self.properties
def isScalar( self ):
size = self.get_size()
return len( [dim for dim in size if dim != sONE] ) == 0
#return properties.SCALAR in self.properties
def isVector( self ):
size = self.get_size()
return len( [dim for dim in size if dim != sONE] ) == 1
#return properties.VECTOR in self.properties
def isMatrix( self ):
size = self.get_size()
return len( [dim for dim in size if dim != sONE] ) == 2
#return properties.MATRIX in self.properties
def isSquare( self ):
return properties.SQUARE in self.properties
def isZero( self ):
return properties.ZERO in self.properties
def isIdentity( self ):
return properties.IDENTITY in self.properties
def isDiagonal( self ):
return properties.DIAGONAL in self.properties
def isTriangular( self ):
return properties.TRIANGULAR in self.properties
def isLowerTriangular( self ):
return properties.LOWER_TRIANGULAR in self.properties
def isUpperTriangular( self ):
return properties.UPPER_TRIANGULAR in self.properties
def isUnitDiagonal( self ):
return properties.UNIT_DIAGONAL in self.properties
def isImplicitUnitDiagonal( self ):
return properties.IMPLICIT_UNIT_DIAGONAL in self.properties
def isSymmetric( self ):
return properties.SYMMETRIC in self.properties
def isSPD( self ):
return properties.SPD in self.properties
def isNonSingular( self ):
return properties.NON_SINGULAR in self.properties
def isOrthogonal( self ):
return properties.ORTHOGONAL in self.properties
def isFullRank( self ):
return properties.FULL_RANK in self.properties
#
# Printing
#
def __repr__( self ):
raise NotImplementedError
class Atom( BaseExpression ):
def __init__( self ):
BaseExpression.__init__( self, [] )
def match( self, ctx ):
# nothing to match, failure
if len( ctx.stack_expr ) == 0:
return None
# pop the expression to match
expr = ctx.stack_expr.pop()
if self == expr:
patt = ctx.stack_patt.pop()
for m in patt.match( ctx ):
yield m
def _cleanup( self ):
return self
def __eq__( self, other ):
raise NotImplementedError
class Expression( BaseExpression ):
pass
class Sequence( Expression ):
def __init__( self, children ):
Expression.__init__( self, children )
def __iter__( self ):
yield from self.get_children()
def _cleanup( self ):
self.children = [ch._cleanup() for ch in self.get_children()]
return self
def match( self, ctx ):
# Both are Sequences
patt_ch = self.get_children()
expr = ctx.stack_expr.pop()
expr_ch = expr.get_children()
while len( patt_ch ) == 0 and len( expr_ch ) == 0 and \
len( ctx.stack_patt ) > 0:
patt = ctx.stack_patt.pop()
patt_ch = patt.get_children()
expr = ctx.stack_expr.pop()
expr_ch = expr.get_children()
# Exited loop because no more patterns in the stack
# and current sequence is also complete: yield match and done
if len( patt_ch ) == 0 and len( expr_ch ) == 0:
yield ctx.match
return None
# if both empty, match complete, yield
#if len( patt_ch ) == 0 and len( expr_ch ) == 0:
#yield ctx.match
# No pattern to match the expression, failure
if len( patt_ch ) == 0 and len( expr_ch ) > 0:
return None
patt_leaf, patt_next = patt_ch[0], Sequence(patt_ch[1:])
if isinstance( patt_leaf, Pattern ):
ctx.stack_patt.append( patt_next )
# Push full expr back
# The pattern itself will decide what it may match what is left for next
ctx.stack_expr.append( expr )
for m in patt_leaf.match( ctx ):
yield m
else: # Atom or Operator
# nothing to match, failure
if len( expr_ch ) == 0:
return None
else:
expr_leaf, expr_next = expr_ch[0], Sequence(expr_ch[1:])
ctx.stack_patt.append( patt_next )
ctx.stack_expr.append( expr_next )
ctx.stack_expr.append( expr_leaf )
for m in patt_leaf.match( ctx ):
yield m
def __repr__( self ):
return "[ " + ", ".join( [ str(ch) for ch in self.get_children() ] ) + " ]"
class NList( Expression ):
def __init__( self, children ):
Expression.__init__( self, children )
def __iter__( self ):
yield from self.get_children()
def _cleanup( self ):
self.children = [ch._cleanup() for ch in self.get_children()]
return self
def match( self, ctx ):
# nothing to match, failure
if len( ctx.stack_expr ) == 0:
return None
# pop the expression to match
expr = ctx.stack_expr.pop()
if self.get_head() == expr.get_head():
patt_seq = Sequence(self.get_children())
expr_seq = Sequence(expr.get_children())
ctx.stack_expr.append( expr_seq )
for m in patt_seq.match( ctx ):
yield m
def __repr__( self ):
return "NL[ " + ", ".join( [ str(ch) for ch in self.get_children() ] ) + " ]"
#
# Operators
#
class Operator( Expression ):
def __init__( self, children, attr, arity ):
Expression.__init__( self, children )
self.attributes = attr
self.flatten_associative()
# Apply identity if so (e.g., Plus(a) -> a) (not here, at most in __new__)
self.arity = arity
self.check_arity()
def flatten_associative( self ):
if attributes.ASSOCIATIVE in self.attributes:
children = []
for ch in self.get_children():
if isinstance( ch, self.__class__ ):
children.extend( ch.get_children() )
else:
children.append( ch )
self.children = children
def check_arity( self ):
if self.arity == attributes.UNARY and \
len( self.children ) != 1:
raise WrongArityError
if self.arity == attributes.BINARY and \
len( self.children ) != 2:
raise WrongArityError
def set_children( self, i, expr ):
Expression.set_children( self, i, expr )
#self.flatten_associative() # [TODO] DOUBLE-CHECK if it can stay commented!!!!
# Also identity
def _cleanup( self ):
self.children = [ch._cleanup() for ch in self.get_children()]
self.flatten_associative()
if attributes.IDENTITY in self.attributes and \
len(self.children) == 1:
return self.children[0]
#return self.__class__( self.children, self.attributes, self.arity )
#return self.__class__( self.children )
return self
def match( self, ctx ):
# nothing to match, failure
if len( ctx.stack_expr ) == 0:
return None
# pop the expression to match
expr = ctx.stack_expr.pop()
if self.get_head() == expr.get_head():
patt_seq = Sequence(self.get_children())
if attributes.COMMUTATIVE not in self.attributes:
expr_seq = Sequence(expr.get_children())
ctx.stack_expr.append( expr_seq )
for m in patt_seq.match( ctx ):
yield m
else:
#_ctx = copy.deepcopy( ctx )
_ctx = copy.copy( ctx )
expr_ch = expr.get_children()
for ch_permutation in itertools.permutations( expr_ch ):
#ctx = copy.deepcopy( _ctx )
ctx = copy.copy( _ctx )
ctx.stack_expr.append( Sequence( list(ch_permutation) ) )
for m in patt_seq.match( ctx ):
yield m
def __eq__( self, other ):
if self.get_head() == other.get_head() and \
len(self.get_children()) == len(other.get_children()):
if attributes.COMMUTATIVE in self.attributes:
return sorted( [ str(ch) for ch in self.get_children() ] ) == \
sorted( [ str(ch) for ch in other.get_children() ] )
else:
return all( [ x == y for x,y in zip(self.get_children(), other.get_children()) ] )
return False
class Equal( Operator ):
def __init__( self, children ):
Operator.__init__( self, children, [], attributes.BINARY )
def lhs( self ):
return self.get_children()[0]
def rhs( self ):
return self.get_children()[1]
def __repr__(self ):
return "Equal( " + ", ".join( [ str(ch) for ch in self.get_children() ] ) + " )"
def to_math( self ):
lhs, rhs = self.children
return "%s = %s" % (lhs.to_math(), rhs.to_math())
class Plus( Operator ):
def __init__( self, children ):
Operator.__init__( self, children, \
[attributes.COMMUTATIVE, attributes.ASSOCIATIVE, attributes.IDENTITY], \
attributes.NARY )
def get_size( self ):
if self.size == None:
self.size = self.get_children()[0].get_size()
return self.size
def __repr__(self ):
return "Plus( " + ", ".join( [ str(ch) for ch in self.get_children() ] ) + " )"
def to_math( self ):
return "(%s)" % " + ".join([ch.to_math() for ch in self.children])
class Minus( Operator ):
def __init__( self, children ):
Operator.__init__( self, children, [], attributes.UNARY )
def get_size( self ):
if self.size == None:
self.size = self.get_children()[0].get_size()
return self.size
def __repr__(self ):
return "Minus( " + ", ".join( [ str(ch) for ch in self.get_children() ] ) + " )"
def to_math( self ):
return "-%s" % self.children[0].to_math()
class Times( Operator ):
def __init__( self, children ):
Operator.__init__( self, children, \
[attributes.ASSOCIATIVE, attributes.IDENTITY], \
attributes.NARY )
def get_size( self ):
if self.size == None:
self.size = self._calc_size()
return self.size
def _calc_size( self ):
non_scalars = list(filter( lambda x: x.get_size() != (sONE, sONE), self.get_children() ))
if len(non_scalars) == 0:
return (1, 1)
rows = non_scalars[0].get_size()[0]
i = 0
while rows == sONE and i < len(non_scalars) - 1:
if non_scalars[i].size[1] == sONE:
rows = non_scalars[i+1].size[0]
i += 1
cols = non_scalars[-1].size[1]
i = len(non_scalars) - 1
while cols == sONE and i > 0:
#if non_scalars[i].size[0] == 1: # [CHECK]
if non_scalars[i].size[0] == sONE:
cols = non_scalars[i-1].size[1]
i -= 1
return (rows, cols)
def __repr__(self ):
return "Times( " + ", ".join( [ str(ch) for ch in self.get_children() ] ) + " )"
def to_math( self ):
return " * ".join([ch.to_math() for ch in self.children])
class Transpose( Operator ):
def __init__(self, children ):
Operator.__init__( self, children, [], attributes.UNARY )
def get_size( self ):
if self.size == None:
self.size = list(reversed(self.get_children()[0].get_size()))
return self.size
def __repr__(self ):
return "Transpose( " + ", ".join( [ str(ch) for ch in self.get_children() ] ) + " )"
def to_math( self ):
return "trans(%s)" % self.children[0].to_math()
class Inverse( Operator ):
def __init__(self, children ):
Operator.__init__( self, children, [], attributes.UNARY )
def get_size( self ):
if self.size == None:
self.size = self.get_children()[0].get_size()
return self.size
def __repr__(self ):
return "Inverse( " + ", ".join( [ str(ch) for ch in self.get_children() ] ) + " )"
def to_math( self ):
return "inverse(%s)" % self.children[0].to_math()
class BlockedExpression( Expression ):
def __init__( self, nd_array, size, shape ):
Expression.__init__( self, nd_array )
self.size = size
#self.shape = shape
self.shape = tuple(shape) # [TODO] Any problem with this?
def set_children( self, i, expr ):
#pointer = self.get_children()
#for pos_i in range( len(i)-1 ):
#pointer = pointer[ i[pos_i] ]
#pointer[i[-1]] = expr
row, col = i // len( self.children[0] ), i % len( self.children[0] )
self.children[row][col] = expr
# only works for flattening matrices
def flatten_children( self ):
return list(itertools.chain.from_iterable( self.get_children() ))
def transpose( self ):
self.children = [list(row) for row in zip(*self.children)]
self.size = list(reversed(self.size))
self.shape = tuple(reversed(self.shape))
def _cleanup( self ):
# TODO: should reassign back to children
for ch in self.flatten_children():
ch._cleanup()
return self
def __iter__( self ):
yield from self.get_children()
def match( self, ctx ):
# nothing to match, failure
if len( ctx.stack_expr ) == 0:
return None
# pop the expression to match
expr = ctx.stack_expr.pop()
if self.get_head() == expr.get_head() and \
self.shape == expr.shape:
# This allows the use of PatternPlus and PatternStar for rows or full blocked expressions
# In principle, no BlockedExpression would appear in a pattern, would it?
patt_seq = Sequence(self.flatten_children())
expr_seq = Sequence(expr.flatten_children())
ctx.stack_expr.append( expr_seq )
for m in patt_seq.match( ctx ):
yield m
def iterate_preorder( self ):
yield self
for child in self.flatten_children():
yield from child.iterate_preorder()
# only for matrices (2D blocked expressions)
def _preorder_position( self, parent=(None, None) ):
yield (id(self), parent)
for i in range(len(self.children)):
for j in range(len(self.children[0])):
yield from self.children[i][j]._preorder_position( (self, (i,j)) )
def _postorder_stack( self, parent=(None,None) ):
return [ self, parent, [ch._postorder_stack((self, i)) for i, ch in enumerate(self.flatten_children())] ]
def __getitem__( self, i ):
if i > len(self.get_children()):
raise TypeError
return self.get_children()[i]
def __eq__( self, other ):
return self.get_head() == other.get_head() and \
self.shape == self.shape and \
self.get_children() == self.get_children()
def __repr__( self ):
#return "[ %s ]" % ( "; ".join([ ", ".join([ cell for cell in row ]) for row in self.get_children() ]) )
return str(self.get_children())
class Predicate( Expression ):
def __init__( self, name, args, size ):
Expression.__init__( self, args )
self.name = name
self.size = []
for s in size:
this_s = []
for dim in s:
if isinstance(dim, str):
this_s.append( Symbol(dim) )
else:
this_s.append( dim )
self.size.append( tuple(this_s) )
def get_name( self ):
return self.name
def set_children( self, i, expr ):
self.children[i] = expr
def _cleanup( self ):
self.children = [ ch._cleanup() for ch in self.get_children()]
return self
def match( self, ctx ):
# nothing to match, failure
if len( ctx.stack_expr ) == 0:
return None
# pop the expression to match
expr = ctx.stack_expr.pop()
if self.get_head() == expr.get_head() and \
self.name == expr.name:
patt_seq = Sequence(self.get_children())
expr_seq = Sequence(expr.get_children())
ctx.stack_expr.append( expr_seq )
for m in patt_seq.match( ctx ):
yield m
def get_size( self ):
return self.size[0]
def __eq__( self, other ):
return self.get_head() == other.get_head() and \
self.name == other.name and \
self.get_children() == other.get_children()
def __repr__( self ):
return "%s( %s )" % (self.name, ", ".join([str(ch) for ch in self.get_children()]))
class Function( Predicate ):
pass
#
# Symbols
#
class Symbol( Atom ):
def __init__( self, name, size=() ):
Atom.__init__( self )
self.name = name
self.size = size
_TOS.register( self ) ###
def get_name( self ):
return self.name
def __eq__( self, other ):
return self.get_head() == other.get_head() and \
self.get_name() == other.get_name()
def __lt__( self, other ):
return self.name < other.name
def set_property( self, prop ):
# TODO improve
if prop == properties.INPUT:
try:
_TOS.unset_property( self.get_name(), properties.OUTPUT )
except KeyError:
pass
elif prop == properties.OUTPUT:
try:
_TOS.unset_property( self.get_name(), properties.INPUT )
except KeyError:
pass
_TOS.set_property( self.get_name(), prop )
def get_properties( self ):
return _TOS.get_properties( self.get_name() )
def isInput( self ):
return properties.INPUT in _TOS.get_properties(self.get_name())
def isOutput( self ):
return properties.OUTPUT in _TOS.get_properties(self.get_name())
def isTemporary( self ):
return properties.TEMPORARY in _TOS.get_properties(self.get_name())
def isScalar( self ):
return properties.SCALAR in _TOS.get_properties(self.get_name())
def isVector( self ):
return properties.VECTOR in _TOS.get_properties(self.get_name())
def isMatrix( self ):
return properties.MATRIX in _TOS.get_properties(self.get_name())
def isSquare( self ):
return properties.SQUARE in _TOS.get_properties(self.get_name())
def isZero( self ):
return properties.ZERO in _TOS.get_properties(self.get_name())
def isIdentity( self ):
return properties.IDENTITY in _TOS.get_properties(self.get_name())
def isDiagonal( self ):
return properties.DIAGONAL in _TOS.get_properties(self.get_name())
def isTriangular( self ):
return properties.TRIANGULAR in _TOS.get_properties(self.get_name())
def isLowerTriangular( self ):
return properties.LOWER_TRIANGULAR in _TOS.get_properties(self.get_name())
def isUpperTriangular( self ):
return properties.UPPER_TRIANGULAR in _TOS.get_properties(self.get_name())
def isUnitDiagonal( self ):
return properties.UNIT_DIAGONAL in _TOS.get_properties(self.get_name())
def isImplicitUnitDiagonal( self ):
return properties.IMPLICIT_UNIT_DIAGONAL in _TOS.get_properties(self.get_name())
def isSymmetric( self ):
return properties.SYMMETRIC in _TOS.get_properties(self.get_name())
def isSPD( self ):
return properties.SPD in _TOS.get_properties(self.get_name())
def isNonSingular( self ):
return properties.NON_SINGULAR in _TOS.get_properties(self.get_name())
def isOrthogonal( self ):
return properties.ORTHOGONAL in _TOS.get_properties(self.get_name())
def isFullRank( self ):
return properties.FULL_RANK in _TOS.get_properties(self.get_name())
def __repr__( self ):
return self.name
def to_math( self ):
return self.name
sONE = Symbol('1')
sZERO = Symbol('0')
class Scalar( Symbol ):
def __init__( self, name, size=None ):
Symbol.__init__( self, name, (sONE, sONE) )
class Vector( Symbol ):
def __init__( self, name, size ):
Symbol.__init__( self, name, (size[0], sONE) ) # ColumnVector
class Matrix( Symbol ):
def __init__( self, name, size ):
Symbol.__init__( self, name, size )
class Tensor( Symbol ): # will need indices as well
def __init__( self, name, size ):
Symbol.__init__( self, name, size )
# This inherits from atom (not a symbol)
class NumericConstant( Atom ):
def __init__( self, value ):
Atom.__init__( self )
self.value = value
self.size = (1, 1)
def get_value( self ):
return self.value
def __eq__( self, other ):
return self.get_head() == other.get_head() and \
self.get_value() == other.get_value()
def __repr__( self ):
return str(self.value)
#
# Patterns
#
# Check validity of a pattern by asserting
# that do not exist two patterns with same name and different length (underscores)
#
# Add the __eq__ to everyone
# If needed, I could have a "same" function for pointer equality
class Pattern( Atom ):
def __init__( self, name ):
Atom.__init__( self )
self.name = name
def get_name( self ):
return self.name
def match( self, ctx ):
# nothing to match, failure
if len( ctx.stack_expr ) == 0:
return None
# pop the expression to match
expr = ctx.stack_expr.pop()
# expr is a Sequence
expr_ch = expr.get_children()
e,o = self.range_in_seq( expr_ch )
#_ctx = copy.deepcopy( ctx )
_ctx = copy.copy( ctx )
for i in range(e,o+1):
expr_leaf, expr_next = Sequence(expr_ch[:i]), Sequence(expr_ch[i:])
#ctx = copy.deepcopy( _ctx )
ctx = copy.copy( _ctx )
ctx.stack_expr.append( expr_next )
patt_name = self.get_name()
#### if PatternDot, then the match is not a sequence but a single element
if isinstance( self, PatternDot ):
expr_leaf = expr_leaf.get_children()[0]
####
if patt_name not in ctx.match or \
patt_name in ctx.match and expr_leaf == ctx.match[patt_name]:
ctx.match[patt_name] = expr_leaf
# unstack and keep going
next_patt = ctx.stack_patt.pop()
for m in next_patt.match( ctx ):
yield m
def __eq__( self, other ):
return self.get_head() == other.get_head() and \
self.get_name() == other.get_name()
def __repr__( self ):
raise NotImplementedError( "Pattern.__repr__ not overloaded!" )
class PatternDot( Pattern ):
def __init__( self, name ):
Pattern.__init__( self, name )
# can match one and only one element
def range_in_seq( self, seq ):
return (1, min(1, len(seq)))
def __repr__( self ):
return self.name + "_"
class PatternPlus( Pattern ):
def __init__( self, name ):
Pattern.__init__( self, name )
# can match one or more elements
def range_in_seq( self, seq ):
return (1, len(seq))
def __repr__( self ):
return self.name + "__"
class PatternStar( Pattern ):
def __init__( self, name ):
Pattern.__init__( self, name )
# can match zero, one or more elements
def range_in_seq( self, seq ):
return (0, len(seq))
def __repr__( self ):
return self.name + "___"
class PatternOr( Expression ):
def __init__( self, children ):
Expression.__init__( self, children )
def match( self, ctx ):
# nothing to match, failure
#if len( ctx.stack_expr ) == 0:
#return None
# pop the expression to match
#expr = ctx.stack_expr.pop()
# expr is a Sequence
#expr_ch = expr.get_children()
#
_ctx = copy.copy( ctx )
for ch in self.get_children():
#print( ch )
#print( ctx.stack_expr[-1] )
ctx = copy.copy( _ctx )
#ctx.stack_expr.append( expr_next )
#patt_name = self.get_name()
##### if PatternDot, then the match is not a sequence but a single element
#if isinstance( self, PatternDot ):
#expr_leaf = expr_leaf.get_children()[0]
#####
#patt_seq = Sequence([ ch ])
#yield from patt_seq.match( ctx )
for m in ch.match( ctx ):
#for m in patt_seq.match( ctx ):
yield m
def __eq__( self, other ):
return self.get_head() == other.get_head() and \
len(self.get_children()) == len(other.get_children())
def __repr__( self ):
return "( " + " | ".join( [ str(ch) for ch in self.get_children() ] ) + " )"
| 32.937426 | 113 | 0.577461 | 3,393 | 27,898 | 4.51842 | 0.091365 | 0.042463 | 0.047942 | 0.027395 | 0.655991 | 0.598395 | 0.55391 | 0.480856 | 0.401344 | 0.3716 | 0 | 0.004183 | 0.314539 | 27,898 | 846 | 114 | 32.976359 | 0.797521 | 0.111549 | 0 | 0.531034 | 0 | 0 | 0.00738 | 0 | 0 | 0 | 0 | 0.001182 | 0 | 1 | 0.27069 | false | 0.006897 | 0.012069 | 0.148276 | 0.531034 | 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 |
d1ffedddcc2a3ac5f9146f1c01f1252fdf793c96 | 234 | py | Python | Udemy/Secao4/aula107.py | rafaelgama/Curso_Python | 908231de9de4a17f5aa829f2671fd88de9261eda | [
"MIT"
] | 1 | 2020-05-07T20:21:15.000Z | 2020-05-07T20:21:15.000Z | Udemy/Secao4/aula107.py | rafaelgama/Curso_Python | 908231de9de4a17f5aa829f2671fd88de9261eda | [
"MIT"
] | null | null | null | Udemy/Secao4/aula107.py | rafaelgama/Curso_Python | 908231de9de4a17f5aa829f2671fd88de9261eda | [
"MIT"
] | null | null | null | # Criando Exceções - Classes de erros personalizados no python
class TaErradoErros(Exception):
pass
def testar():
raise TaErradoErros('Errado')
try:
testar()
except TaErradoErros as error:
print(f'Erro: {error}')
| 15.6 | 62 | 0.705128 | 27 | 234 | 6.111111 | 0.851852 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196581 | 234 | 14 | 63 | 16.714286 | 0.87766 | 0.25641 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0.125 | 0 | 0 | 0.25 | 0.125 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
ae14ced9e90462d4c28036e1b6de1ad1da48931c | 344 | py | Python | satchmo/feeds/urls.py | sankroh/satchmo | e48df0c2a4be4ce14785d0a5d6dd1e516c57a838 | [
"BSD-3-Clause"
] | 1 | 2016-05-09T12:21:04.000Z | 2016-05-09T12:21:04.000Z | satchmo/feeds/urls.py | sankroh/satchmo | e48df0c2a4be4ce14785d0a5d6dd1e516c57a838 | [
"BSD-3-Clause"
] | null | null | null | satchmo/feeds/urls.py | sankroh/satchmo | e48df0c2a4be4ce14785d0a5d6dd1e516c57a838 | [
"BSD-3-Clause"
] | null | null | null | from django.conf.urls.defaults import *
urlpatterns = patterns('satchmo.feeds.views',
(r'atom/$', 'product_feed', {}, 'satchmo_atom_feed'),
(r'atom/(?P<category>\w+)/$', 'product_feed', {}, 'satchmo_atom_category_feed'),
(r'products.csv$', 'admin_product_feed', {'template' : "feeds/product_feed.csv"}, 'satchmo_product_feed'),
)
| 38.222222 | 110 | 0.677326 | 43 | 344 | 5.139535 | 0.511628 | 0.248869 | 0.162896 | 0.199095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104651 | 344 | 8 | 111 | 43 | 0.717532 | 0 | 0 | 0 | 0 | 0 | 0.574344 | 0.209913 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ae2911a62a0fa6012a455d70e36b2b181052b369 | 294 | py | Python | C3_Decorator_Pattern/StarBuzz/Beverages/Beverages.py | sarada92/Design_Pattern | f817206a6f995bc6f534d7cabb3a290955f37d33 | [
"MIT"
] | 1 | 2022-02-06T15:42:09.000Z | 2022-02-06T15:42:09.000Z | C3_Decorator_Pattern/StarBuzz/Beverages/Beverages.py | sarada92/Design_Pattern | f817206a6f995bc6f534d7cabb3a290955f37d33 | [
"MIT"
] | null | null | null | C3_Decorator_Pattern/StarBuzz/Beverages/Beverages.py | sarada92/Design_Pattern | f817206a6f995bc6f534d7cabb3a290955f37d33 | [
"MIT"
] | null | null | null | from abc import ABC, ABCMeta, abstractmethod
class Beverages(metaclass=ABCMeta):
description = ''
def __init__(self):
self.description = 'Unknown Beverage'
def get_description(self):
return self.description
@abstractmethod
def cost(self):
pass
| 17.294118 | 45 | 0.663265 | 30 | 294 | 6.333333 | 0.6 | 0.157895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.255102 | 294 | 16 | 46 | 18.375 | 0.86758 | 0 | 0 | 0 | 0 | 0 | 0.054422 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0.1 | 0.1 | 0.1 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ae2958e0f365e8a42c774a468b5b5df96d03ca6c | 790 | py | Python | punto.py | Gambl3r08/ejercicios-Python | ddf13b40c611f892112ebbe7bc907f5765998ea0 | [
"MIT"
] | null | null | null | punto.py | Gambl3r08/ejercicios-Python | ddf13b40c611f892112ebbe7bc907f5765998ea0 | [
"MIT"
] | null | null | null | punto.py | Gambl3r08/ejercicios-Python | ddf13b40c611f892112ebbe7bc907f5765998ea0 | [
"MIT"
] | null | null | null | from validaciones import *
class Punto():
# Representar un punto en un plano
def __init__(self, x=0, y=0):
if es_numero(x) and es_numero(y):
self.x = x
self.y = y
else:
raise TypeError("X e Y Deben ser valores numericos ")
def distancia(self, otro):
r = self.restar(otro)
return (dx*dx + dy*dy)**0.5
def restar(self, otro):
return Punto(self.x - otro.x, self.y - otro.y)
def norma(self):
return(self.x*self.x + self.y*self.y)**0.5
def __str__(self):
return ("(", str(self.x), ", ", str(self.y), ")")
def __add__(self, otro):
return Punto(self.x + otro.x, self.y + otro.y)
def __sub__(self, otro):
return Punto(self.x - otro.x, self.y -otro.y) | 26.333333 | 65 | 0.548101 | 123 | 790 | 3.373984 | 0.317073 | 0.096386 | 0.072289 | 0.137349 | 0.296386 | 0.296386 | 0.296386 | 0.296386 | 0.296386 | 0.296386 | 0 | 0.01085 | 0.3 | 790 | 30 | 66 | 26.333333 | 0.739602 | 0.040506 | 0 | 0.095238 | 0 | 0 | 0.050198 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.047619 | 0.238095 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ae2e985dc318ca8513cbe7363cd43a4275deee67 | 2,099 | py | Python | test/test_ers.py | jakebrinkmann/lagoon-armadillo | 4fbaed078f33ad28989cfcc2c5739764afaebac6 | [
"Unlicense"
] | null | null | null | test/test_ers.py | jakebrinkmann/lagoon-armadillo | 4fbaed078f33ad28989cfcc2c5739764afaebac6 | [
"Unlicense"
] | null | null | null | test/test_ers.py | jakebrinkmann/lagoon-armadillo | 4fbaed078f33ad28989cfcc2c5739764afaebac6 | [
"Unlicense"
] | null | null | null | import pytest
from api.auth import ers
import test
@test.vcr.use_cassette(test.cassettes['ers'])
def test_bad_creds():
with pytest.raises(ers.ErsInvalidLogin) as exc:
token = ers.login('', '')
@test.vcr.use_cassette(test.cassettes['ers'])
def test_login():
token = ers.login('username', 'password', secret='46b5bdef021a6d1c',
url='http://ers/api')
assert isinstance(token, str)
@test.vcr.use_cassette(test.cassettes['ers'])
def test_bad_login():
with pytest.raises(ers.ErsInvalidLogin):
token = ers.login('json', 'json', secret='46b5bdef021a6d1c', url='http://ers/noauth')
def test_bad_url():
with pytest.raises(ers.ErsUnavailable) as exc:
token = ers.login('user', 'pass', url='http://isnothere/api')
@test.vcr.use_cassette(test.cassettes['ers'])
def test_roles():
user = ers.roles('fb0fc56dd0692391', url='http://ers/api', verify=False)
assert isinstance(user, tuple)
assert len(user) == 4
@test.vcr.use_cassette(test.cassettes['ers.bad'])
def test_bad_login_response_format():
with pytest.raises(ers.ErsInvalidLogin):
token = ers.login('json', 'json', secret='46b5bdef021a6d1c', url='http://ers/xmlapi')
@test.vcr.use_cassette(test.cassettes['ers.bad'])
def test_bad_login_missing_response_data():
with pytest.raises(ers.ErsInvalidResponse):
token = ers.login('json', 'json', secret='46b5bdef021a6d1c', url='http://ers/json4api')
@test.vcr.use_cassette(test.cassettes['ers.bad'])
def test_bad_login_response_data():
with pytest.raises(ers.ErsInvalidResponse):
token = ers.login('json2', 'json2', secret='46b5bdef021a6d1c', url='http://ers/json2api')
@test.vcr.use_cassette(test.cassettes['ers.bad'])
def test_bad_role_response_data():
with pytest.raises(ers.ErsInvalidResponse):
token = ers.roles('fb0fc56dd0692391', url='http://ers/json2api')
@test.vcr.use_cassette(test.cassettes['ers.bad'])
def test_bad_role_missing_response_data():
with pytest.raises(ers.ErsInvalidResponse):
token = ers.roles('fb0fc56dd0692391', url='http://ers/json3api')
| 36.824561 | 97 | 0.704621 | 276 | 2,099 | 5.217391 | 0.195652 | 0.048611 | 0.0625 | 0.1125 | 0.797222 | 0.711111 | 0.6875 | 0.6875 | 0.6875 | 0.630556 | 0 | 0.042077 | 0.128156 | 2,099 | 56 | 98 | 37.482143 | 0.744809 | 0 | 0 | 0.340909 | 0 | 0 | 0.186279 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 1 | 0.227273 | false | 0.045455 | 0.068182 | 0 | 0.295455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ae425fb2cc3fde4699f2e1fbcd2abc73fbdca20a | 138 | py | Python | mozdns/view/forms.py | jlin/inventory | c098c98e570c3bf9fadfd811eb75e1213f6ea428 | [
"BSD-3-Clause"
] | 22 | 2015-01-16T01:36:32.000Z | 2020-06-08T00:46:18.000Z | mozdns/view/forms.py | jlin/inventory | c098c98e570c3bf9fadfd811eb75e1213f6ea428 | [
"BSD-3-Clause"
] | 8 | 2015-12-28T18:56:19.000Z | 2019-04-01T17:33:48.000Z | mozdns/view/forms.py | jlin/inventory | c098c98e570c3bf9fadfd811eb75e1213f6ea428 | [
"BSD-3-Clause"
] | 13 | 2015-01-13T20:56:22.000Z | 2022-02-23T06:01:17.000Z | from django.forms import ModelForm
from mozdns.view.models import View
class ViewForm(ModelForm):
class Meta:
model = View
| 15.333333 | 35 | 0.724638 | 18 | 138 | 5.555556 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217391 | 138 | 8 | 36 | 17.25 | 0.925926 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
ae83453053e63a4c0a5074f439813eb4f31260ba | 454 | py | Python | rb_message_writer/message_writer.py | Raybeam/rb_message_writer | 8df253c6ee04f753a8849123e90bf394fb00b192 | [
"MIT"
] | 2 | 2020-06-23T18:40:01.000Z | 2021-07-19T19:12:39.000Z | rb_message_writer/message_writer.py | Raybeam/rb_message_writer | 8df253c6ee04f753a8849123e90bf394fb00b192 | [
"MIT"
] | 10 | 2019-11-27T02:02:45.000Z | 2020-05-20T16:50:35.000Z | rb_message_writer/message_writer.py | Raybeam/rb_message_writer | 8df253c6ee04f753a8849123e90bf394fb00b192 | [
"MIT"
] | 1 | 2020-01-30T18:26:27.000Z | 2020-01-30T18:26:27.000Z | class MessageWriter:
"""
This class allows a "message" to be sent to an external recipient.
"""
def __init__(self, *args, **kwargs):
pass
def send_message(self, message):
"""
Sends a message to an external recipient.
Usually, this involves creating a connection to an API with
any necessary credentials.
:param message:
:return:
"""
raise NotImplementedError
| 23.894737 | 70 | 0.601322 | 50 | 454 | 5.36 | 0.66 | 0.044776 | 0.074627 | 0.156716 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.321586 | 454 | 18 | 71 | 25.222222 | 0.87013 | 0.486784 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0.2 | 0 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ae8789bdbbd56b1306439476c6c845fb752941e4 | 413 | py | Python | Desafios/des011.py | joseangelooliveira-br/Python3 | c0ba39768706f84f26b0616b75dd8c7971145b0e | [
"MIT"
] | null | null | null | Desafios/des011.py | joseangelooliveira-br/Python3 | c0ba39768706f84f26b0616b75dd8c7971145b0e | [
"MIT"
] | null | null | null | Desafios/des011.py | joseangelooliveira-br/Python3 | c0ba39768706f84f26b0616b75dd8c7971145b0e | [
"MIT"
] | null | null | null | comp = float(input('Digite o Comptrimento da parede em metros:'))
alt = float(input('Digite a altura da parede em metros: '))
rend = float(input('digite o rendimento da tinta em metros quadrados:'))
print('Você possui uma area de {} m².'.format(comp*alt))
print('Sabendo que o rendimento da tinta é de {}m² por litros.'.format(rend))
print('Você necessitará de {} litros de tinta.'.format(((comp * alt) / rend)))
| 59 | 78 | 0.711864 | 66 | 413 | 4.454545 | 0.469697 | 0.102041 | 0.163265 | 0.115646 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005634 | 0.140436 | 413 | 6 | 79 | 68.833333 | 0.822535 | 0 | 0 | 0 | 0 | 0 | 0.610169 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
8824fbaf483f38443ffc79d61a7b5d45571331ad | 225 | py | Python | src/Pandas_Wrapper_pcg/__init__.py | Gal-Tch/Pandas_Wrapper | 84f377e1fbf451089fb75d799bfee3735c3b25f7 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | src/Pandas_Wrapper_pcg/__init__.py | Gal-Tch/Pandas_Wrapper | 84f377e1fbf451089fb75d799bfee3735c3b25f7 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | src/Pandas_Wrapper_pcg/__init__.py | Gal-Tch/Pandas_Wrapper | 84f377e1fbf451089fb75d799bfee3735c3b25f7 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | import pandas as pd
from pandas import DataFrame
from pandas._typing import Axes, Dtype
import pickle
from datetime import datetime
from os import path
from typing import Optional
import inspect
import time
import numpy as np | 22.5 | 38 | 0.84 | 36 | 225 | 5.222222 | 0.5 | 0.106383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151111 | 225 | 10 | 39 | 22.5 | 0.984293 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
882626a81902a42f81f50394f6da74dce9672ee0 | 308 | py | Python | ukko/__init__.py | Artimi/ukko | 2349f5cb52a4203be77e6a02083321509f35fafa | [
"MIT"
] | 1 | 2018-05-29T10:30:12.000Z | 2018-05-29T10:30:12.000Z | ukko/__init__.py | Artimi/ukko | 2349f5cb52a4203be77e6a02083321509f35fafa | [
"MIT"
] | 1 | 2016-05-30T15:21:05.000Z | 2016-05-30T15:21:05.000Z | ukko/__init__.py | Artimi/ukko | 2349f5cb52a4203be77e6a02083321509f35fafa | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from .rcpparser import RCPParser
from .problem import Problem
from .activity_list import ActivityList
from .schedule import Schedule
from .sgs import SSGS
from .rthypothesis import RTHypothesis, RTSystem
from .garth import GARTH
from .resource_utilization import ResourceUtilization
| 28 | 53 | 0.814935 | 38 | 308 | 6.552632 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003717 | 0.126623 | 308 | 10 | 54 | 30.8 | 0.921933 | 0.068182 | 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 |
8840f6bce45e6ce4d6ba5cad0d56f5da65a5e7f7 | 1,239 | py | Python | static_and_class_methods/lab/02_shop.py | Galchov/python-oop | 1bf7c51ac2c605bae11b08df7edd4341e20a1b39 | [
"MIT"
] | null | null | null | static_and_class_methods/lab/02_shop.py | Galchov/python-oop | 1bf7c51ac2c605bae11b08df7edd4341e20a1b39 | [
"MIT"
] | null | null | null | static_and_class_methods/lab/02_shop.py | Galchov/python-oop | 1bf7c51ac2c605bae11b08df7edd4341e20a1b39 | [
"MIT"
] | null | null | null | class Shop:
_small_shop_capacity = 10
def __init__(self, name, shop_type, capacity):
self.name = name
self.type = shop_type
self.capacity = capacity
self.items_count = 0
self.items = {}
@classmethod
def small_shop(cls, name, shop_type):
return cls(name, shop_type, cls._small_shop_capacity)
def _can_add_item(self):
return self.items_count < self.capacity - 1
def _can_remove_amount_of_item(self, item, amount):
return item in self.items and amount <= self.items[item]
def add_item(self, item):
if not self._can_add_item():
return 'Not enough capacity in the shop'
if item not in self.items:
self.items[item] = 0
self.items[item] += 1
self.items_count += 1
return f'{item} added to the shop'
def remove_item(self, item, amount):
if not self._can_remove_amount_of_item(item, amount):
return f'Cannot remove {amount} {item}'
self.items[item] -= amount
self.items_count -= amount
return f'{amount} {item} removed from the shop'
def __str__(self):
return f'{self.name} of type {self.type} with capacity {self.capacity}'
| 31.769231 | 79 | 0.623083 | 173 | 1,239 | 4.225434 | 0.213873 | 0.135431 | 0.076607 | 0.04104 | 0.057456 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007839 | 0.279257 | 1,239 | 38 | 80 | 32.605263 | 0.81075 | 0 | 0 | 0 | 0 | 0 | 0.146893 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.225806 | false | 0 | 0 | 0.129032 | 0.548387 | 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 |
888117a1d839683355140b9b2bd8e7f8040c7756 | 2,565 | py | Python | backend-project/small_eod/channels/migrations/0004_auto_20200125_1946.py | WlodzimierzKorza/small_eod | 027022bd71122a949a2787d0fb86518df80e48cd | [
"MIT"
] | 64 | 2019-12-30T11:24:03.000Z | 2021-06-24T01:04:56.000Z | backend-project/small_eod/channels/migrations/0004_auto_20200125_1946.py | WlodzimierzKorza/small_eod | 027022bd71122a949a2787d0fb86518df80e48cd | [
"MIT"
] | 465 | 2018-06-13T21:43:43.000Z | 2022-01-04T23:33:56.000Z | backend-project/small_eod/channels/migrations/0004_auto_20200125_1946.py | WlodzimierzKorza/small_eod | 027022bd71122a949a2787d0fb86518df80e48cd | [
"MIT"
] | 72 | 2018-12-02T19:47:03.000Z | 2022-01-04T22:54:49.000Z | # Generated by Django 3.0.2 on 2020-01-25 19:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('channels', '0003_auto_20200110_0200'),
]
operations = [
migrations.AlterField(
model_name='channel',
name='city',
field=models.BooleanField(default=False, help_text='Name of city in institution address is mandatory for this channel.', verbose_name='City'),
),
migrations.AlterField(
model_name='channel',
name='email',
field=models.BooleanField(default=False, help_text='Institution e-mail address is mandatory for this channel.', verbose_name='E-mail'),
),
migrations.AlterField(
model_name='channel',
name='epuap',
field=models.BooleanField(default=False, help_text='Institution ePUAP address is mandatory for this channel.', verbose_name='ePUAP'),
),
migrations.AlterField(
model_name='channel',
name='flat_no',
field=models.BooleanField(default=False, help_text='Flat number in institution address is mandatory for this channel.', verbose_name='Flat number'),
),
migrations.AlterField(
model_name='channel',
name='house_no',
field=models.BooleanField(default=False, help_text='House number in institution address is mandatory for this channel.', verbose_name='House number'),
),
migrations.AlterField(
model_name='channel',
name='name',
field=models.CharField(help_text="Channel's name. Name cannot be longer than 25 characters.", max_length=25, verbose_name='Name'),
),
migrations.AlterField(
model_name='channel',
name='postal_code',
field=models.BooleanField(default=False, help_text='Postal code in institution address is mandatory for this channel.', verbose_name='Postal code'),
),
migrations.AlterField(
model_name='channel',
name='street',
field=models.BooleanField(default=False, help_text='Name of street in institution address is mandatory for this channel.', verbose_name='Street'),
),
migrations.AlterField(
model_name='channel',
name='voivodeship',
field=models.BooleanField(default=False, help_text='Voivodeship in institution address is mandatory for this channel.', verbose_name='Voivodeship'),
),
]
| 43.474576 | 162 | 0.634308 | 278 | 2,565 | 5.730216 | 0.241007 | 0.112994 | 0.141243 | 0.163842 | 0.745763 | 0.745763 | 0.569994 | 0.458255 | 0.279975 | 0.218456 | 0 | 0.018421 | 0.259259 | 2,565 | 58 | 163 | 44.224138 | 0.82 | 0.017544 | 0 | 0.519231 | 1 | 0 | 0.313741 | 0.009134 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.019231 | 0 | 0.076923 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
88979bf93c15eb7e22bf62921dab72abd9cbdddf | 743 | py | Python | domonic/constants/__init__.py | Jordan-Cottle/domonic | 05d70af0d1564d3ba80c860bb5f5bfe089293b18 | [
"MIT"
] | 1 | 2022-03-09T03:39:04.000Z | 2022-03-09T03:39:04.000Z | domonic/constants/__init__.py | Jordan-Cottle/domonic | 05d70af0d1564d3ba80c860bb5f5bfe089293b18 | [
"MIT"
] | null | null | null | domonic/constants/__init__.py | Jordan-Cottle/domonic | 05d70af0d1564d3ba80c860bb5f5bfe089293b18 | [
"MIT"
] | null | null | null | """
domonic.constants
====================================
"""
namespaces = {'xml': 'http://www.w3.org/XML/1998/namespace', 'svg': 'http://www.w3.org/2000/svg', 'xlink': 'http://www.w3.org/1999/xlink',
'xmlns': 'http://www.w3.org/2000/xmlns/', 'xm': 'http://www.w3.org/2001/xml-events', 'xh': 'http://www.w3.org/1999/xhtml'}
# gravitational_constant = 6.67384e-11
# planck_constant = 6.62606957e-34
# speed_of_light = 299792458
# electron_charge = 1.602176565e-19
# electron_mass = 9.10938291e-31
# proton_mass = 1.672621777e-27
# neutron_mass = 1.674927351e-27
# atomic_mass_unit = 1.660539040e-24
# avogadro_constant = 6.02214129e23
# boltzmann_constant = 1.3806488e-23
# gas_constant = 8.3144621
# i love #copilot | 32.304348 | 138 | 0.650067 | 103 | 743 | 4.563107 | 0.592233 | 0.089362 | 0.114894 | 0.153191 | 0.13617 | 0 | 0 | 0 | 0 | 0 | 0 | 0.22427 | 0.123822 | 743 | 23 | 139 | 32.304348 | 0.497696 | 0.567968 | 0 | 0 | 0 | 0 | 0.682594 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
889ee997661618146da6effe1e747885cac8e1ca | 887 | py | Python | retention_dashboard/migrations/0013_auto_20211210_1650.py | uw-it-aca/retention-dashboard | 5f808f62f26b14eead4409603760fa1abc2c6a2a | [
"Apache-2.0"
] | null | null | null | retention_dashboard/migrations/0013_auto_20211210_1650.py | uw-it-aca/retention-dashboard | 5f808f62f26b14eead4409603760fa1abc2c6a2a | [
"Apache-2.0"
] | 32 | 2020-12-08T19:19:53.000Z | 2022-02-23T23:29:53.000Z | retention_dashboard/migrations/0013_auto_20211210_1650.py | uw-it-aca/retention-dashboard | 5f808f62f26b14eead4409603760fa1abc2c6a2a | [
"Apache-2.0"
] | null | null | null | # Generated by Django 2.2.19 on 2021-12-10 16:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('retention_dashboard', '0012_auto_20211208_1901'),
]
operations = [
migrations.AddField(
model_name='datapoint',
name='campus_code',
field=models.CharField(max_length=2, null=True),
),
migrations.AddField(
model_name='datapoint',
name='eop',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='datapoint',
name='international',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='datapoint',
name='iss',
field=models.BooleanField(default=False),
),
]
| 26.088235 | 60 | 0.568207 | 82 | 887 | 6.02439 | 0.536585 | 0.145749 | 0.186235 | 0.218623 | 0.536437 | 0.465587 | 0.303644 | 0.303644 | 0.303644 | 0.303644 | 0 | 0.054636 | 0.319053 | 887 | 33 | 61 | 26.878788 | 0.763245 | 0.05186 | 0 | 0.555556 | 1 | 0 | 0.128725 | 0.027414 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.037037 | 0 | 0.148148 | 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 |
88a0094cc121243d79c8a748a374adfec55a2aa2 | 289 | py | Python | akashic/enums/data_type.py | Akashic-Projects/akashic | 51c4e55bee1a632c658a9bdd900a56a1f535cc81 | [
"MIT"
] | null | null | null | akashic/enums/data_type.py | Akashic-Projects/akashic | 51c4e55bee1a632c658a9bdd900a56a1f535cc81 | [
"MIT"
] | null | null | null | akashic/enums/data_type.py | Akashic-Projects/akashic | 51c4e55bee1a632c658a9bdd900a56a1f535cc81 | [
"MIT"
] | null | null | null | from enum import Enum
class DataType(Enum):
""" DataType enum class
We use this class to define type of data generated
inside of transpiler loop
"""
def __str__(self):
return str(self.name)
INTEGER = 1
FLOAT = 2
STRING = 3
BOOLEAN = 5 | 18.0625 | 54 | 0.605536 | 39 | 289 | 4.384615 | 0.769231 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020619 | 0.32872 | 289 | 16 | 55 | 18.0625 | 0.860825 | 0.33564 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0.125 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
31ff4f3cde2c6577910b0bc74b0f33d5235d8a45 | 106 | gyp | Python | binding.gyp | manobi/daemon.node | 14fb78c4f0395243469f9adc6ce693cafe102ef1 | [
"MIT"
] | 1 | 2019-03-26T18:18:13.000Z | 2019-03-26T18:18:13.000Z | binding.gyp | manobi/daemon.node | 14fb78c4f0395243469f9adc6ce693cafe102ef1 | [
"MIT"
] | null | null | null | binding.gyp | manobi/daemon.node | 14fb78c4f0395243469f9adc6ce693cafe102ef1 | [
"MIT"
] | null | null | null | {
"targets": [
{
"target_name": "lib/daemon",
"sources": [ "src/daemon.cc" ]
}
]
} | 13.25 | 36 | 0.424528 | 9 | 106 | 4.888889 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.339623 | 106 | 8 | 37 | 13.25 | 0.628571 | 0 | 0 | 0 | 0 | 0 | 0.448598 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ee580cb757d38d19bdbddc73915725b210b378a4 | 238 | py | Python | storefront/celery.py | zeestack/storefront3 | 3ba87aae61a4877f4e51bc80442fe5954bbda76d | [
"MIT"
] | null | null | null | storefront/celery.py | zeestack/storefront3 | 3ba87aae61a4877f4e51bc80442fe5954bbda76d | [
"MIT"
] | null | null | null | storefront/celery.py | zeestack/storefront3 | 3ba87aae61a4877f4e51bc80442fe5954bbda76d | [
"MIT"
] | null | null | null | import os
from celery import Celery
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "storefront.settings")
celery = Celery("storefront")
celery.config_from_object("django.conf:settings", namespace="CELERY")
celery.autodiscover_tasks()
| 23.8 | 70 | 0.806723 | 29 | 238 | 6.448276 | 0.551724 | 0.128342 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 238 | 9 | 71 | 26.444444 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0.323529 | 0.092437 | 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 |
ee654256ca1dc945da3532c145d34a1ffef0c1ac | 187 | py | Python | covid_scheduling/errors.py | mggg/covid-scheduling | 8f714947cf3ab4e5a57f0e5221856ac8ccfd91e4 | [
"MIT"
] | 2 | 2020-07-21T21:16:53.000Z | 2020-07-25T05:46:01.000Z | covid_scheduling/errors.py | mggg/covid-scheduling | 8f714947cf3ab4e5a57f0e5221856ac8ccfd91e4 | [
"MIT"
] | 6 | 2020-07-23T15:19:37.000Z | 2022-02-11T03:25:25.000Z | covid_scheduling/errors.py | mggg/covid-scheduling | 8f714947cf3ab4e5a57f0e5221856ac8ccfd91e4 | [
"MIT"
] | null | null | null | """Scheduling errors."""
class AssignmentError(Exception):
"""Raised for errors when generating assignments."""
def __init__(self, message: str):
self.message = message
| 23.375 | 56 | 0.684492 | 19 | 187 | 6.526316 | 0.789474 | 0.177419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187166 | 187 | 7 | 57 | 26.714286 | 0.815789 | 0.347594 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ee70e32977d76a567f4f090b36a26e683a7ca0cc | 1,724 | py | Python | astrobase/services/__init__.py | pierfra-ro/astrobase | b9f62c59a3ab9cdc1388d409fa281c26f1e6db6c | [
"MIT"
] | 45 | 2017-03-09T19:08:44.000Z | 2022-03-24T00:36:28.000Z | astrobase/services/__init__.py | pierfra-ro/astrobase | b9f62c59a3ab9cdc1388d409fa281c26f1e6db6c | [
"MIT"
] | 92 | 2016-12-21T19:01:20.000Z | 2022-01-03T15:28:45.000Z | astrobase/services/__init__.py | pierfra-ro/astrobase | b9f62c59a3ab9cdc1388d409fa281c26f1e6db6c | [
"MIT"
] | 20 | 2016-12-20T23:01:29.000Z | 2021-03-07T16:24:15.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# services - Waqas Bhatti (wbhatti@astro.princeton.edu) - Oct 2017
# License: MIT. See the LICENSE file for more details.
'''This contains various modules to query online data services. These are not
exhaustive and are meant to support other astrobase modules.
- :py:mod:`astrobase.services.dust`: interface to the 2MASS DUST
extinction/emission service.
- :py:mod:`astrobase.services.gaia`: interface to the GAIA TAP+ ADQL query
service.
- :py:mod:`astrobase.services.lccs`: interface to the `LCC-Server
<https://github.com/waqasbhatti/lcc-server>`_ API.
- :py:mod:`astrobase.services.mast`: interface to the MAST catalogs at STScI and
the TESS Input Catalog in particular.
- :py:mod:`astrobase.services.simbad`: interface to the CDS SIMBAD service.
- :py:mod:`astrobase.services.skyview`: interface to the NASA SkyView
finder-chart and cutout service.
- :py:mod:`astrobase.services.trilegal`: interface to the Girardi TRILEGAL
galaxy model forms and service.
- :py:mod:`astrobase.services.limbdarkening`: utilities to get stellar limb
darkening coefficients for use during transit fitting.
- :py:mod:`astrobase.services.identifiers`: utilities to convert from SIMBAD
object names to GAIA DR2 source identifiers and TESS Input Catalogs IDs.
- :py:mod:`astrobase.services.tesslightcurves`: utilities to download various
TESS light curve products from MAST.
- :py:mod:`astrobase.services.alltesslightcurves`: utilities to download all
TESS light curve products from MAST for a given TIC ID.
For a much broader interface to online data services, use the astroquery package
by A. Ginsburg, B. Sipocz, et al.:
http://astroquery.readthedocs.io
'''
| 37.478261 | 80 | 0.762181 | 247 | 1,724 | 5.315789 | 0.502024 | 0.041889 | 0.117289 | 0.184311 | 0.156131 | 0.045697 | 0 | 0 | 0 | 0 | 0 | 0.005387 | 0.138631 | 1,724 | 45 | 81 | 38.311111 | 0.878788 | 0.990719 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c9c10c36756169a85b88c093d90f2fb81051e978 | 450 | py | Python | katas/kyu_6/Bit_Counting.py | dusadamey/CodeWars | 386de2427c8a590fc2e65adf979658e817dd131a | [
"MIT"
] | null | null | null | katas/kyu_6/Bit_Counting.py | dusadamey/CodeWars | 386de2427c8a590fc2e65adf979658e817dd131a | [
"MIT"
] | null | null | null | katas/kyu_6/Bit_Counting.py | dusadamey/CodeWars | 386de2427c8a590fc2e65adf979658e817dd131a | [
"MIT"
] | 1 | 2021-10-30T15:45:40.000Z | 2021-10-30T15:45:40.000Z | # https://www.codewars.com/kata/526571aae218b8ee490006f4/
'''
Instructions :
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.
Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case
'''
def countBits(n):
return bin(n).replace('0b', '').count('1')
| 28.125 | 192 | 0.748889 | 69 | 450 | 4.884058 | 0.753623 | 0.053412 | 0.136499 | 0.148368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092838 | 0.162222 | 450 | 15 | 193 | 30 | 0.801061 | 0.822222 | 0 | 0 | 0 | 0 | 0.042857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
c9d93115cf08ad88c84524d3d8288f7e51f3a832 | 87 | py | Python | lib/pylint/test/input/func_w0110.py | willemneal/Docky | d3504e1671b4a6557468234c263950bfab461ce4 | [
"MIT"
] | 3 | 2018-11-25T01:09:55.000Z | 2021-08-24T01:56:36.000Z | lib/pylint/test/input/func_w0110.py | willemneal/Docky | d3504e1671b4a6557468234c263950bfab461ce4 | [
"MIT"
] | 7 | 2021-02-08T20:22:15.000Z | 2022-03-11T23:19:41.000Z | lib/pylint/test/input/func_w0110.py | willemneal/Docky | d3504e1671b4a6557468234c263950bfab461ce4 | [
"MIT"
] | 3 | 2018-11-09T03:38:09.000Z | 2020-02-24T06:26:10.000Z | """test too short name
"""
__revision__ = 1
A = None
def a():
"""yo"""
pass
| 7.909091 | 22 | 0.505747 | 12 | 87 | 3.333333 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016393 | 0.298851 | 87 | 10 | 23 | 8.7 | 0.639344 | 0.252874 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a00acc314de33f06fc08bfee448eb469fdfae0d5 | 399 | py | Python | sample.py | fusrName/Interpolator | 1bc397618ca81209cd85e1c38f3bf280b0b18308 | [
"CC0-1.0"
] | null | null | null | sample.py | fusrName/Interpolator | 1bc397618ca81209cd85e1c38f3bf280b0b18308 | [
"CC0-1.0"
] | null | null | null | sample.py | fusrName/Interpolator | 1bc397618ca81209cd85e1c38f3bf280b0b18308 | [
"CC0-1.0"
] | null | null | null | from interpolator import interpolate, interpolation_printer
def f(x, y, z):
return x*x*y*3 + x*x*2 + x*y*6 - x*13 - y*235 - 3351
xs = [2,3,5]
ys = [0,1]
zs = [3]
ps = (xs, ys, zs)
res = interpolate(f, ps)
interpolation_printer(res, tuple(map(len, ps)), 'xyz')
def g(x):
return sum(range(x + 1)) # equals to x(x+1)/2
res = interpolate(g, (range(10),))
interpolation_printer(res, (10,)) | 21 | 59 | 0.616541 | 75 | 399 | 3.24 | 0.48 | 0.246914 | 0.1893 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076687 | 0.182957 | 399 | 19 | 60 | 21 | 0.668712 | 0.045113 | 0 | 0 | 0 | 0 | 0.007895 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.076923 | 0.153846 | 0.384615 | 0.230769 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
a00ae03467da281690bcbd3e47776bd971c54921 | 3,624 | py | Python | stubs.min/Rhino/Geometry/__init___parts/GeometryBase.py | ricardyn/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | 1 | 2021-02-02T13:39:16.000Z | 2021-02-02T13:39:16.000Z | stubs.min/Rhino/Geometry/__init___parts/GeometryBase.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | stubs.min/Rhino/Geometry/__init___parts/GeometryBase.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | class GeometryBase(CommonObject,IDisposable,ISerializable):
# no doc
def ComponentIndex(self):
""" ComponentIndex(self: GeometryBase) -> ComponentIndex """
pass
def ConstructConstObject(self,*args):
""" ConstructConstObject(self: CommonObject,parentObject: object,subobject_index: int) """
pass
def Dispose(self):
""" Dispose(self: CommonObject,disposing: bool) """
pass
def Duplicate(self):
""" Duplicate(self: GeometryBase) -> GeometryBase """
pass
def DuplicateShallow(self):
""" DuplicateShallow(self: GeometryBase) -> GeometryBase """
pass
def GetBoundingBox(self,*__args):
"""
GetBoundingBox(self: GeometryBase,plane: Plane) -> BoundingBox
GetBoundingBox(self: GeometryBase,plane: Plane) -> (BoundingBox,Box)
GetBoundingBox(self: GeometryBase,accurate: bool) -> BoundingBox
GetBoundingBox(self: GeometryBase,xform: Transform) -> BoundingBox
"""
pass
def GetUserString(self,key):
""" GetUserString(self: GeometryBase,key: str) -> str """
pass
def GetUserStrings(self):
""" GetUserStrings(self: GeometryBase) -> NameValueCollection """
pass
def MakeDeformable(self):
""" MakeDeformable(self: GeometryBase) -> bool """
pass
def MemoryEstimate(self):
""" MemoryEstimate(self: GeometryBase) -> UInt32 """
pass
def NonConstOperation(self,*args):
""" NonConstOperation(self: CommonObject) """
pass
def OnSwitchToNonConst(self,*args):
""" OnSwitchToNonConst(self: GeometryBase) """
pass
def Rotate(self,angleRadians,rotationAxis,rotationCenter):
""" Rotate(self: GeometryBase,angleRadians: float,rotationAxis: Vector3d,rotationCenter: Point3d) -> bool """
pass
def Scale(self,scaleFactor):
""" Scale(self: GeometryBase,scaleFactor: float) -> bool """
pass
def SetUserString(self,key,value):
""" SetUserString(self: GeometryBase,key: str,value: str) -> bool """
pass
def Transform(self,xform):
""" Transform(self: GeometryBase,xform: Transform) -> bool """
pass
def Translate(self,*__args):
"""
Translate(self: GeometryBase,x: float,y: float,z: float) -> bool
Translate(self: GeometryBase,translationVector: Vector3d) -> bool
"""
pass
def __enter__(self,*args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self,*args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,*args): #cannot find CLR constructor
""" __new__(cls: type,info: SerializationInfo,context: StreamingContext) """
pass
def __reduce_ex__(self,*args):
pass
HasBrepForm=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: HasBrepForm(self: GeometryBase) -> bool
"""
IsDeformable=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsDeformable(self: GeometryBase) -> bool
"""
IsDocumentControlled=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsDocumentControlled(self: GeometryBase) -> bool
"""
ObjectType=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: ObjectType(self: GeometryBase) -> ObjectType
"""
UserStringCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: UserStringCount(self: GeometryBase) -> int
"""
| 35.184466 | 215 | 0.695916 | 375 | 3,624 | 6.52 | 0.24 | 0.150511 | 0.031493 | 0.04908 | 0.231084 | 0.202454 | 0.160736 | 0.160736 | 0.160736 | 0.160736 | 0 | 0.001639 | 0.158113 | 3,624 | 102 | 216 | 35.529412 | 0.799738 | 0.460541 | 0 | 0.431373 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.431373 | false | 0.431373 | 0 | 0 | 0.54902 | 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 |
a018ff21f126a135a14b831bd745ec71cb76d3a9 | 377 | py | Python | sort/bubblesort.py | NesbiDevelopment/algo-playground | a372da7de7dc46d2e6da9c5c3e038d39e0af1e72 | [
"MIT"
] | 1 | 2020-07-25T19:49:23.000Z | 2020-07-25T19:49:23.000Z | sort/bubblesort.py | Nesbi/algo-playground | a372da7de7dc46d2e6da9c5c3e038d39e0af1e72 | [
"MIT"
] | null | null | null | sort/bubblesort.py | Nesbi/algo-playground | a372da7de7dc46d2e6da9c5c3e038d39e0af1e72 | [
"MIT"
] | null | null | null | def sort(elements):
while True:
swapped = False
for i in range(len(elements)-1):
if elements[i] > elements[i+1]:
# swap
temp = elements[i]
elements[i] = elements[i+1]
elements[i+1] = temp
swapped = True
if not swapped:
break
return elements
| 26.928571 | 43 | 0.456233 | 41 | 377 | 4.195122 | 0.463415 | 0.313953 | 0.296512 | 0.313953 | 0.22093 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019417 | 0.453581 | 377 | 13 | 44 | 29 | 0.815534 | 0.01061 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0 | 0 | 0.166667 | 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 |
4e4c4e37883aee24c5d2a8c0076b1f208872f1df | 1,446 | py | Python | test_globals.py | demianvelasco/element-finder | 155909298c42581794ecd80224c1ad1e694b4f29 | [
"MIT"
] | null | null | null | test_globals.py | demianvelasco/element-finder | 155909298c42581794ecd80224c1ad1e694b4f29 | [
"MIT"
] | null | null | null | test_globals.py | demianvelasco/element-finder | 155909298c42581794ecd80224c1ad1e694b4f29 | [
"MIT"
] | null | null | null | PORT = 8000
URL = "http://localhost:{}".format(PORT)
SITE_LOCATION = 'test_site/index.html'
csv_log_single_site_init = [(False, False, True), (False, False, False)]
# TODO: Add logs and csv tests
# (True, False, True), (False, False, True), (True, True, True)]
variations = [{
'element': 'id',
'element_id': 'header',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'headerLeft',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'headerRight',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'wrapall',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'sidebar',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'logo',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'sidebarContent',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'main',
'expected_amount': 1,
}
]
TESTS = list()
for variation in variations:
for options in csv_log_single_site_init:
init_params = dict()
init_params['url'] = URL
init_params['element_id'] = variation['element_id']
init_params['csv'] = options[0]
init_params['debug'] = options[1]
init_params['single_site'] = options[2]
TESTS.append(
(init_params, variation['element'], variation['element_id'], URL, options[0], options[1], options[2], variation['expected_amount']))
| 25.821429 | 144 | 0.592669 | 167 | 1,446 | 4.904192 | 0.281437 | 0.208791 | 0.156288 | 0.175824 | 0.330891 | 0.282051 | 0.282051 | 0 | 0 | 0 | 0 | 0.015901 | 0.217151 | 1,446 | 55 | 145 | 26.290909 | 0.707597 | 0.065007 | 0 | 0.469388 | 0 | 0 | 0.332098 | 0 | 0 | 0 | 0 | 0.018182 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4e6301f7539f672e0925fb129e9174bc561850a1 | 657 | py | Python | apps/compras/views/__init__.py | AlcindoSchleder/ERPi-City | 63f8871cbe0be372dae81e2e363e6733d5d34210 | [
"MIT"
] | null | null | null | apps/compras/views/__init__.py | AlcindoSchleder/ERPi-City | 63f8871cbe0be372dae81e2e363e6733d5d34210 | [
"MIT"
] | 11 | 2019-11-06T09:24:51.000Z | 2021-03-24T19:18:12.000Z | apps/compras/views/__init__.py | AlcindoSchleder/ERPi-City | 63f8871cbe0be372dae81e2e363e6733d5d34210 | [
"MIT"
] | 1 | 2020-06-27T02:29:19.000Z | 2020-06-27T02:29:19.000Z | # -*- coding: utf-8 -*-
from .compras import (
AdicionarOrcamentoCompraView,
AdicionarPedidoCompraView,
OrcamentoCompraListView,
OrcamentoCompraVencidosListView,
OrcamentoCompraVencimentoHojeListView,
PedidoCompraListView,
PedidoCompraAtrasadosListView,
PedidoCompraEntregaHojeListView,
EditarOrcamentoCompraView,
EditarPedidoCompraView,
GerarPedidoCompraView,
CancelarOrcamentoCompraView,
CancelarPedidoCompraView,
GerarCopiaOrcamentoCompraView,
GerarCopiaPedidoCompraView,
ReceberPedidoCompraView,
GerarPDFOrcamentoCompra,
GerarPDFPedidoCompra
)
from .ajax_views import InfoCompra
| 26.28 | 42 | 0.792998 | 29 | 657 | 17.931034 | 0.931034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001815 | 0.161339 | 657 | 24 | 43 | 27.375 | 0.941924 | 0.031963 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.095238 | 0 | 0.095238 | 0 | 1 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
4eaf7f6fa2dec4f5677f903605ef45fd50199b25 | 113 | py | Python | file_upload/upload/urls.py | Xerdiosa/LAW-Tugas-2 | 66b478d2bdddc562e7d0e1e32ccda86d1eb6a71d | [
"MIT"
] | null | null | null | file_upload/upload/urls.py | Xerdiosa/LAW-Tugas-2 | 66b478d2bdddc562e7d0e1e32ccda86d1eb6a71d | [
"MIT"
] | null | null | null | file_upload/upload/urls.py | Xerdiosa/LAW-Tugas-2 | 66b478d2bdddc562e7d0e1e32ccda86d1eb6a71d | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('filestorage/', views.filestorage),
]
| 16.142857 | 44 | 0.716814 | 13 | 113 | 6.230769 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168142 | 113 | 6 | 45 | 18.833333 | 0.861702 | 0 | 0 | 0 | 0 | 0 | 0.106195 | 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 |
14c6b3ab384f884e927f31ee1ad2cfd306ed970d | 66 | py | Python | lightflow_epics/__init__.py | AustralianSynchrotron/lightflow-epics | 0cc0344f76933e9c9a7309b7abd957257be83327 | [
"BSD-3-Clause"
] | null | null | null | lightflow_epics/__init__.py | AustralianSynchrotron/lightflow-epics | 0cc0344f76933e9c9a7309b7abd957257be83327 | [
"BSD-3-Clause"
] | null | null | null | lightflow_epics/__init__.py | AustralianSynchrotron/lightflow-epics | 0cc0344f76933e9c9a7309b7abd957257be83327 | [
"BSD-3-Clause"
] | null | null | null | from .pv_trigger_task import PvTriggerTask
__version__ = '1.2.2'
| 16.5 | 42 | 0.787879 | 10 | 66 | 4.6 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051724 | 0.121212 | 66 | 3 | 43 | 22 | 0.741379 | 0 | 0 | 0 | 0 | 0 | 0.075758 | 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 |
14c8f7bcaab71823be91347983117a4ccdd2caf8 | 4,387 | py | Python | algorithms/dynamic_programming.py | linesd/tabular-methods | 05ee6488feffc64d3bb7335f26b2e9688d90a57b | [
"MIT"
] | 11 | 2019-12-30T22:42:26.000Z | 2021-11-30T20:48:51.000Z | algorithms/dynamic_programming.py | linesd/tabular-methods | 05ee6488feffc64d3bb7335f26b2e9688d90a57b | [
"MIT"
] | 1 | 2020-12-17T11:41:35.000Z | 2020-12-17T11:41:35.000Z | algorithms/dynamic_programming.py | linesd/tabular-methods | 05ee6488feffc64d3bb7335f26b2e9688d90a57b | [
"MIT"
] | 1 | 2020-06-19T12:03:52.000Z | 2020-06-19T12:03:52.000Z | import numpy as np
# global stopping criteria
EPS = 0.001
def value_iteration(model, maxiter=100):
"""
Solves the supplied environment with value iteration.
Parameters
----------
model : python object
Holds information about the environment to solve
such as the reward structure and the transition dynamics.
maxiter : int
The maximum number of iterations to perform.
Return
------
val_ : numpy array of shape (N, 1)
Value function of the environment where N is the number
of states in the environment.
pi : numpy array of shape (N, 1)
Optimal policy of the environment.
"""
# initialize the value function and policy
pi = np.ones((model.num_states, 1))
val_ = np.zeros((model.num_states, 1))
for i in range(maxiter):
# initialize delta
delta = 0
# perform Bellman update for each state
for state in range(model.num_states):
# store old value
tmp = val_[state].copy()
# compute the value function
val_[state] = np.max( np.sum((model.R[state] + model.gamma * val_) * model.P[state,:,:], 0) )
# find maximum change in value
delta = np.max( (delta, np.abs(tmp - val_[state])) )
# stopping criteria
if delta <= EPS * (1 - model.gamma) / model.gamma:
print("Value iteration converged after %d iterations." % i)
break
# compute the policy
for state in range(model.num_states):
pi[state] = np.argmax(np.sum(val_ * model.P[state,:,:],0))
return val_, pi
def policy_iteration(model, maxiter):
"""
Solves the supplied environment with policy iteration.
Parameters
----------
model : python object
Holds information about the environment to solve
such as the reward structure and the transition dynamics.
maxiter : int
The maximum number of iterations to perform.
Return
------
val_ : numpy array of shape (N, 1)
Value function of the environment where N is the number
of states in the environment.
pi : numpy array of shape (N, 1)
Optimal policy of the environment.
"""
# initialize the value function and policy
pi = np.ones((model.num_states, 1))
val_ = np.zeros((model.num_states, 1))
for i in range(maxiter):
# Stopping criteria
stable_policy = True
# Policy evaluation
val_ = policy_evaluation(model, val_, pi)
for state in range(model.num_states):
# do policy improvement
action = np.argmax( np.sum( (model.R[state] + model.gamma * val_) * model.P[state,:,:], 0) )
# check if policy has been updated
if action != pi[state]:
# store new action
pi[state] = action
# update stopping criteria
stable_policy = False
# check if stopping criteria satisfied
if stable_policy:
print("Policy iteration converged after %d iterations." % i)
break
return val_, pi
def policy_evaluation(model, val_, policy):
"""
Evaluates a given policy.
Parameters
----------
model : python object
Holds information about the environment to solve
such as the reward structure and the transition dynamics.
val_ : numpy array of shape (N, 1)
Value function of the environment where N is the number
of states in the environment.
policy : numpy array of shape (N, 1)
Optimal policy of the environment.
Return
------
val_ : numpy array of shape (N, 1)
Value function of the environment where N is the number
of states in the environment.
"""
loop = True
while loop:
# initialize delta
delta = 0
for state in range(model.num_states):
# store old value
tmp = val_[state].copy()
# compute the value function
val_[state] = np.sum( (model.R[state] + model.gamma * val_) * model.P[state,:,int(policy[state])].reshape(-1,1))
# find maximum change in value
delta = np.max( (delta, np.abs(tmp - val_[state])) )
# stopping criteria
if delta <= EPS * (1 - model.gamma) / model.gamma:
loop = False
return val_ | 31.335714 | 124 | 0.595395 | 554 | 4,387 | 4.648014 | 0.191336 | 0.076117 | 0.043495 | 0.046214 | 0.761165 | 0.714951 | 0.714951 | 0.661359 | 0.661359 | 0.661359 | 0 | 0.008967 | 0.313654 | 4,387 | 140 | 125 | 31.335714 | 0.84623 | 0.471621 | 0 | 0.511628 | 0 | 0 | 0.044712 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.069767 | false | 0 | 0.023256 | 0 | 0.162791 | 0.046512 | 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 |
14d10a7a4d433bf424d4975b6a20fa6cc70f616f | 525 | py | Python | src/datalakebundle/test/SimpleTargetPathResolver.py | bricksflow/datalake-bundle | 2d435a46a74915a23738482a71f240a89ab32389 | [
"MIT"
] | null | null | null | src/datalakebundle/test/SimpleTargetPathResolver.py | bricksflow/datalake-bundle | 2d435a46a74915a23738482a71f240a89ab32389 | [
"MIT"
] | 1 | 2021-11-04T13:01:15.000Z | 2021-11-04T13:01:15.000Z | src/datalakebundle/test/SimpleTargetPathResolver.py | daipe-ai/datalake-bundle | 01bd0e2e7361561f2278fe08ee78b92beb9cda26 | [
"MIT"
] | null | null | null | from box import Box
from datalakebundle.table.identifier.ValueResolverInterface import ValueResolverInterface
class SimpleTargetPathResolver(ValueResolverInterface):
def __init__(self, base_path: str):
self.__base_path = base_path
def resolve(self, raw_table_parameters: Box):
return self.__base_path + "/" + raw_table_parameters.db_identifier + "/" + raw_table_parameters.table_identifier + ".delta"
def get_depending_fields(self) -> set:
return {"db_identifier", "table_identifier"}
| 37.5 | 131 | 0.758095 | 58 | 525 | 6.448276 | 0.431034 | 0.085562 | 0.096257 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152381 | 525 | 13 | 132 | 40.384615 | 0.840449 | 0 | 0 | 0 | 0 | 0 | 0.070476 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.222222 | 0.222222 | 0.888889 | 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 |
14ee5b0dfa0dfa9522212560da8832f6d9fdd05b | 841 | py | Python | A059861_test.py | b0ri5/oeis | 2f0b76077136d2783d2cde75be3c9428110928a8 | [
"MIT"
] | null | null | null | A059861_test.py | b0ri5/oeis | 2f0b76077136d2783d2cde75be3c9428110928a8 | [
"MIT"
] | null | null | null | A059861_test.py | b0ri5/oeis | 2f0b76077136d2783d2cde75be3c9428110928a8 | [
"MIT"
] | null | null | null | import unittest
from A059861 import brute_force, r_times_r_plus_two
class Test(unittest.TestCase):
# See https://oeis.org/A059861
def test_brute_force(self):
self.assertEqual(1, brute_force(1))
self.assertEqual(1, brute_force(2))
self.assertEqual(3, brute_force(3))
self.assertEqual(15, brute_force(4))
self.assertEqual(135, brute_force(5))
self.assertEqual(1485, brute_force(6))
def test_r_times_r_plus_two(self):
self.assertEqual(1, r_times_r_plus_two(1))
self.assertEqual(1, r_times_r_plus_two(2))
self.assertEqual(3, r_times_r_plus_two(3))
self.assertEqual(15, r_times_r_plus_two(4))
self.assertEqual(135, r_times_r_plus_two(5))
self.assertEqual(1485, r_times_r_plus_two(6))
if __name__ == '__main__':
unittest.main()
| 30.035714 | 53 | 0.689655 | 129 | 841 | 4.108527 | 0.248062 | 0.339623 | 0.10566 | 0.166038 | 0.369811 | 0.113208 | 0.113208 | 0.113208 | 0 | 0 | 0 | 0.070901 | 0.195006 | 841 | 27 | 54 | 31.148148 | 0.711965 | 0.033294 | 0 | 0 | 0 | 0 | 0.009864 | 0 | 0 | 0 | 0 | 0 | 0.631579 | 1 | 0.105263 | false | 0 | 0.105263 | 0 | 0.263158 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14f2510fb6b64fb32f1dd7a731342ac6b6e7d04d | 116 | py | Python | src/master/readdata.py | emanuelibiapino/micro_cluster | 42ecf3d50aea1e8ec70d3782cac3e440ea08194c | [
"MIT"
] | null | null | null | src/master/readdata.py | emanuelibiapino/micro_cluster | 42ecf3d50aea1e8ec70d3782cac3e440ea08194c | [
"MIT"
] | null | null | null | src/master/readdata.py | emanuelibiapino/micro_cluster | 42ecf3d50aea1e8ec70d3782cac3e440ea08194c | [
"MIT"
] | null | null | null |
def load(file = "data.txt"):
data = []
for line in open(file):
data.append(line)
return data
| 14.5 | 28 | 0.543103 | 16 | 116 | 3.9375 | 0.6875 | 0.253968 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.318966 | 116 | 8 | 29 | 14.5 | 0.797468 | 0 | 0 | 0 | 0 | 0 | 0.068966 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14f2a302863598e21fc5b42163880a805804c68e | 287 | py | Python | cogs/server-management/captcha/oneclick.py | yaakiyu/rt-bot | f68bca95c516e08c31ecc846524dcea4c8ba1503 | [
"BSD-4-Clause"
] | null | null | null | cogs/server-management/captcha/oneclick.py | yaakiyu/rt-bot | f68bca95c516e08c31ecc846524dcea4c8ba1503 | [
"BSD-4-Clause"
] | null | null | null | cogs/server-management/captcha/oneclick.py | yaakiyu/rt-bot | f68bca95c516e08c31ecc846524dcea4c8ba1503 | [
"BSD-4-Clause"
] | null | null | null | # RT - OneClick Captcha
import discord
from .part import CaptchaPart, CaptchaContext
class OneClickCaptchaPart(CaptchaPart):
async def on_button_push(self, ctx: CaptchaContext, interaction: discord.Interaction) -> None:
await self.cog.on_success(ctx, interaction, "send") | 28.7 | 98 | 0.766551 | 33 | 287 | 6.575758 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146341 | 287 | 10 | 99 | 28.7 | 0.885714 | 0.073171 | 0 | 0 | 0 | 0 | 0.015094 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
090bb49c88937ae4b1c640c78bdf2f197dc7e4fb | 339 | py | Python | smartmirror/mod_uber/utils/__init__.py | nirmitdesai/smartmirror | e4973e02469989501e8b9a5c6aa05d7228b06cf2 | [
"BSD-3-Clause"
] | null | null | null | smartmirror/mod_uber/utils/__init__.py | nirmitdesai/smartmirror | e4973e02469989501e8b9a5c6aa05d7228b06cf2 | [
"BSD-3-Clause"
] | null | null | null | smartmirror/mod_uber/utils/__init__.py | nirmitdesai/smartmirror | e4973e02469989501e8b9a5c6aa05d7228b06cf2 | [
"BSD-3-Clause"
] | null | null | null | from uberUtils import *
'''curl -F 'client_id=M5TNy7T9h9n8xUOQ_uWSHVLdGvfw7u6H' \
-F 'client_secret=w5P7E4Ld54d_ai3lJRhAgkU_9oWbKd9kkTJHfPgf' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri=https://9bbc25ce.ngrok.io' \
-F 'code=fMiym9aqxIPA6aEIDgZcHRk0BBwVM4' \
https://login.uber.com/oauth/v2/token'''
| 33.9 | 66 | 0.722714 | 37 | 339 | 6.405405 | 0.810811 | 0.059072 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07931 | 0.144543 | 339 | 10 | 67 | 33.9 | 0.737931 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
090e2a092a86265735a97d2bb277d28e189139d3 | 229 | py | Python | data/scripts/cat.py | cegganesh84/hive | 34e98e7a18c6dc55419bea556a15c4286ddfa08e | [
"Apache-2.0"
] | 61 | 2015-04-08T06:20:17.000Z | 2021-12-16T11:52:09.000Z | data/scripts/cat.py | cegganesh84/hive | 34e98e7a18c6dc55419bea556a15c4286ddfa08e | [
"Apache-2.0"
] | 2 | 2015-03-25T12:19:26.000Z | 2017-05-29T12:35:44.000Z | data/scripts/cat.py | cegganesh84/hive | 34e98e7a18c6dc55419bea556a15c4286ddfa08e | [
"Apache-2.0"
] | 123 | 2015-01-12T01:15:50.000Z | 2022-01-09T00:40:46.000Z | import sys, re
import datetime
import os
table_name=None
if os.environ.has_key('hive_streaming_tablename'):
table_name=os.environ['hive_streaming_tablename']
for line in sys.stdin:
print line
print >> sys.stderr, "dummy"
| 19.083333 | 51 | 0.772926 | 36 | 229 | 4.722222 | 0.611111 | 0.105882 | 0.258824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126638 | 229 | 11 | 52 | 20.818182 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0.231441 | 0.209607 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 0.222222 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
092e3d287c56b422a0e514c5eb8be39f049dd669 | 258 | py | Python | tests/test_utils.py | konakonall/kaleidoscope | b758992ba71a4402ac34c550ac536a1370c2cb08 | [
"MIT"
] | null | null | null | tests/test_utils.py | konakonall/kaleidoscope | b758992ba71a4402ac34c550ac536a1370c2cb08 | [
"MIT"
] | null | null | null | tests/test_utils.py | konakonall/kaleidoscope | b758992ba71a4402ac34c550ac536a1370c2cb08 | [
"MIT"
] | null | null | null | import sys
sys.path.append("../")
from kaleidoscope import util
import os
if __name__ == '__main__':
print util.get_shell_output('/Users/wjielai/Workspace/QCloudAndroid/library/TencentAppCloud',
'./gradlew :foundation:properties | grep projectDir') | 32.25 | 98 | 0.75969 | 30 | 258 | 6.2 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112403 | 258 | 8 | 99 | 32.25 | 0.812227 | 0 | 0 | 0 | 0 | 0 | 0.474903 | 0.324324 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.428571 | null | null | 0.142857 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
1183906cac7af070bd61e9407c42e1e364fcd583 | 441 | py | Python | flask/forms.py | erik1110/DE | 8fb63038ba8ea18feab08498abc8a82f8bfc4295 | [
"MIT"
] | 1 | 2019-05-19T16:06:09.000Z | 2019-05-19T16:06:09.000Z | flask/forms.py | erik1110/DE | 8fb63038ba8ea18feab08498abc8a82f8bfc4295 | [
"MIT"
] | null | null | null | flask/forms.py | erik1110/DE | 8fb63038ba8ea18feab08498abc8a82f8bfc4295 | [
"MIT"
] | null | null | null | from flask_wtf import Form
from wtforms import StringField,PasswordField,validators
class RegistrationForm(Form):
username=StringField("用戶名:",[validators.DataRequired("請輸入用戶名")])
password=PasswordField("密碼:",[validators.DataRequired("請輸入密碼")])
password2=StringField("再次輸入密碼:",[validators.EqualTo("password",message="兩次輸入密碼不匹配")])
email=StringField("電子信件:",[validators.DataRequired("請輸入電子信件"),validators.Email("請輸入有效的電子郵件")]) | 55.125 | 98 | 0.770975 | 43 | 441 | 7.883721 | 0.627907 | 0.19469 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002433 | 0.068027 | 441 | 8 | 98 | 55.125 | 0.822384 | 0 | 0 | 0 | 0 | 0 | 0.144796 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.428571 | 0.285714 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
11893426096e05119a240385f98effdbe06cc5a6 | 151 | py | Python | atcoder/AtCoder_Beginner_Contest_144/81.py | juseongkr/BOJ | 8f10a2bf9a7d695455493fbe7423347a8b648416 | [
"Apache-2.0"
] | 7 | 2020-02-03T10:00:19.000Z | 2021-11-16T11:03:57.000Z | atcoder/AtCoder_Beginner_Contest_144/81.py | juseongkr/Algorithm-training | 8f10a2bf9a7d695455493fbe7423347a8b648416 | [
"Apache-2.0"
] | 1 | 2021-01-03T06:58:24.000Z | 2021-01-03T06:58:24.000Z | atcoder/AtCoder_Beginner_Contest_144/81.py | juseongkr/Algorithm-training | 8f10a2bf9a7d695455493fbe7423347a8b648416 | [
"Apache-2.0"
] | 1 | 2020-01-22T14:34:03.000Z | 2020-01-22T14:34:03.000Z | l = [0]*101
for i in range(1, 10):
for j in range(1, 10):
l[i*j] = 1
n = int(input())
if l[n] == 1:
print("Yes")
else:
print("No")
| 15.1 | 26 | 0.463576 | 31 | 151 | 2.258065 | 0.580645 | 0.2 | 0.228571 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114286 | 0.304636 | 151 | 9 | 27 | 16.777778 | 0.552381 | 0 | 0 | 0 | 0 | 0 | 0.033113 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.222222 | 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 |
11a39e255e1c0c2ba1ad94d727f08a74559c5e73 | 1,360 | py | Python | sap/odata/errors.py | gtreskas/sapcli | ff82ddb998834e1c83dff799134f026df93b3175 | [
"Apache-2.0"
] | 42 | 2019-01-16T13:16:09.000Z | 2022-03-23T20:13:00.000Z | sap/odata/errors.py | gtreskas/sapcli | ff82ddb998834e1c83dff799134f026df93b3175 | [
"Apache-2.0"
] | 59 | 2019-02-23T07:16:56.000Z | 2022-02-28T09:34:47.000Z | sap/odata/errors.py | gtreskas/sapcli | ff82ddb998834e1c83dff799134f026df93b3175 | [
"Apache-2.0"
] | 22 | 2019-03-12T08:15:44.000Z | 2022-01-10T03:56:47.000Z | """HTTP related errors"""
from sap.errors import SAPCliError
class HTTPRequestError(SAPCliError):
"""Exception for unexpected HTTP responses"""
def __init__(self, request, response):
super().__init__()
self.request = request
self.response = response
def __repr__(self):
return f'{self.response.status_code}\n{self.response.text}'
def __str__(self):
return repr(self)
class UnauthorizedError(SAPCliError):
"""Exception for unauthorized """
def __init__(self, request, response, user):
super().__init__()
self.request = request
self.response = response
self.method = request.method
self.url = request.url
self.user = user
def __repr__(self):
return f'Authorization for the user "{self.user}" has failed: {self.method} {self.url}'
def __str__(self):
return repr(self)
class TimedOutRequestError(SAPCliError):
"""Exception for timeout requests"""
def __init__(self, request, timeout):
super().__init__()
self.request = request
self.method = request.method
self.url = request.url
self.timeout = timeout
def __repr__(self):
return f'The request {self.method} {self.url} took more than {self.timeout}s'
def __str__(self):
return repr(self)
| 23.859649 | 95 | 0.638235 | 153 | 1,360 | 5.352941 | 0.281046 | 0.058608 | 0.10989 | 0.065934 | 0.484737 | 0.355311 | 0.29304 | 0.222222 | 0.107448 | 0 | 0 | 0 | 0.250735 | 1,360 | 56 | 96 | 24.285714 | 0.803729 | 0.086765 | 0 | 0.636364 | 0 | 0.060606 | 0.158067 | 0.040131 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.030303 | 0.181818 | 0.575758 | 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 |
11ac0b1cf51d84d856dcb3272ee42e112dadb550 | 2,028 | py | Python | backend/Day.py | tkyaw1/lotus | 3d1eabf3ef2dec26d9d846a787c9f9e018b94740 | [
"MIT"
] | null | null | null | backend/Day.py | tkyaw1/lotus | 3d1eabf3ef2dec26d9d846a787c9f9e018b94740 | [
"MIT"
] | null | null | null | backend/Day.py | tkyaw1/lotus | 3d1eabf3ef2dec26d9d846a787c9f9e018b94740 | [
"MIT"
] | null | null | null | from Block import *
""" This is the class for the day view of the journal. Each day will contain multiple blocks
"""
class Day:
def __init__(self):
self.blocks = []
self.date = "" #YYYYMMDD
self.weather = ""
self.heading = "" # not too sure what will populate this
self.keywords = []
def __str__(self):
return str({
"blocks": [block.return_json() for block in self.blocks],
"date": self.date,
"weather": self.weather,
"heading": self.heading,
"keywords": self.keywords
})
def return_day_json(self):
return str({
"blocks": [block.return_json() for block in self.blocks],
"date": self.date,
"weather": self.weather,
"heading": self.heading,
"keywords": self.keywords
})
def add_block(self, block):
""" Appends a block to the list of blocks
"""
self.blocks.append(block)
# TODO: how to get blocks or return as a json? is this the __str__ function?
def add_keywords(self, block):
[self.keywords.append(keyword) for keyword in block.get_keywords()]
def add_all_keywords(self):
# for block in self.blocks:
# self.keywords.append(block.get_keywords())
for block in self.blocks:
[self.keywords.append(keyword) for keyword in block.get_keywords()]
# [self.keywords.append(keyword) for keyword in block.get_keywords() for block in self.blocks]
def get_keywords(self):
return self.keywords
def set_date(self, date):
self.date = date
def get_date(self):
return self.date
def set_weather(self, weather):
self.weather = weather
def get_weather(self):
return self.weather
def set_heading(self, heading):
self.heading = heading
def get_heading(self):
return self.heading
| 28.971429 | 103 | 0.571499 | 242 | 2,028 | 4.661157 | 0.202479 | 0.085106 | 0.044326 | 0.062057 | 0.445922 | 0.445922 | 0.445922 | 0.445922 | 0.362589 | 0.362589 | 0 | 0 | 0.32643 | 2,028 | 69 | 104 | 29.391304 | 0.825769 | 0.162229 | 0 | 0.355556 | 0 | 0 | 0.04205 | 0 | 0 | 0 | 0 | 0.014493 | 0 | 1 | 0.288889 | false | 0 | 0.022222 | 0.133333 | 0.466667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
11b402e6d7952f6c1cd57bad08d64f94819fa74f | 90 | py | Python | Training/MOOC Tensorflow 2.0/BeiDa/class1/p22_random.uniform.py | church06/Pythons | 87271619abb2dd6398fbe08d746d4b03c54bcd4d | [
"MIT"
] | 177 | 2020-05-16T00:22:37.000Z | 2022-03-13T15:44:27.000Z | Training/MOOC Tensorflow 2.0/BeiDa/class1/p22_random.uniform.py | church06/Pythons | 87271619abb2dd6398fbe08d746d4b03c54bcd4d | [
"MIT"
] | 1 | 2020-07-09T12:42:53.000Z | 2020-07-09T12:42:53.000Z | Training/MOOC Tensorflow 2.0/BeiDa/class1/p22_random.uniform.py | church06/Pythons | 87271619abb2dd6398fbe08d746d4b03c54bcd4d | [
"MIT"
] | 123 | 2020-05-15T18:31:49.000Z | 2022-02-10T09:20:06.000Z | import tensorflow as tf
f = tf.random.uniform([2, 2], minval=0, maxval=1)
print("f:", f)
| 18 | 49 | 0.655556 | 17 | 90 | 3.470588 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051948 | 0.144444 | 90 | 4 | 50 | 22.5 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0.022222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
11b9699c68b525c11a0ebc6728cb12ea5cba3bed | 300 | py | Python | Section 1_Code/1.7/account.py | ktzyl/Practical-Jenkins-V- | 56e60ab67c6265d66079f2c4a84227b2d19e1907 | [
"MIT"
] | 2 | 2020-09-13T16:59:13.000Z | 2021-05-04T11:58:05.000Z | Section 1_Code/1.7/account.py | ktzyl/Practical-Jenkins-V- | 56e60ab67c6265d66079f2c4a84227b2d19e1907 | [
"MIT"
] | null | null | null | Section 1_Code/1.7/account.py | ktzyl/Practical-Jenkins-V- | 56e60ab67c6265d66079f2c4a84227b2d19e1907 | [
"MIT"
] | 23 | 2019-05-06T09:36:59.000Z | 2022-01-25T11:57:51.000Z | class account:
def check_password_length(self, password):
if len(password) > 8:
return True
else:
return False
if __name__ == '__main__':
accVerify = account()
print('The password length is ' + str(accVerify.check_password_length('offtoschool')))
| 27.272727 | 90 | 0.63 | 33 | 300 | 5.363636 | 0.666667 | 0.237288 | 0.214689 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004566 | 0.27 | 300 | 10 | 91 | 30 | 0.803653 | 0 | 0 | 0 | 0 | 0 | 0.14 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.333333 | 0 | 0 | 0.444444 | 0.111111 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
11bb0f0795c5894c8ed97c80fd377b645efcf079 | 740 | py | Python | sequana/resources/data/__init__.py | vladsaveliev/sequana | f6ee7fa7fb47ec179ceedf24684ba861a244656d | [
"BSD-3-Clause"
] | 138 | 2016-07-13T06:24:45.000Z | 2022-03-28T13:12:03.000Z | sequana/resources/data/__init__.py | vladsaveliev/sequana | f6ee7fa7fb47ec179ceedf24684ba861a244656d | [
"BSD-3-Clause"
] | 655 | 2016-03-10T17:33:40.000Z | 2022-03-30T16:10:45.000Z | sequana/resources/data/__init__.py | vladsaveliev/sequana | f6ee7fa7fb47ec179ceedf24684ba861a244656d | [
"BSD-3-Clause"
] | 39 | 2016-11-04T11:40:58.000Z | 2022-03-15T08:12:29.000Z | """
Some useful data sets to be used in the analysis
The command :func:`sequana.sequana_data` may be used to retrieved data from
this package. For example, a small but standard reference (phix) is used in
some NGS experiments. The file is small enough that it is provided within
sequana and its filename (full path) can be retrieved as follows::
from sequana import sequana_data
fullpath = sequana_data("phiX174.fa", "data")
Other files stored in this directory will be documented here.
"""
#: List of adapters used in various sequencing platforms
adapters = {
"adapters_netflex_pcr_free_1_fwd": "adapters_netflex_pcr_free_1_fwd.fa",
"adapters_netflex_pcr_free_1_rev": "adapters_netflex_pcr_free_1_rev.fa"
}
| 28.461538 | 76 | 0.764865 | 116 | 740 | 4.681034 | 0.568966 | 0.110497 | 0.132597 | 0.162063 | 0.191529 | 0.191529 | 0 | 0 | 0 | 0 | 0 | 0.011401 | 0.17027 | 740 | 25 | 77 | 29.6 | 0.872964 | 0.745946 | 0 | 0 | 0 | 0 | 0.738636 | 0.738636 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eeb9e78c190b55f11ceadc04af17538ae5e7cce3 | 2,332 | py | Python | misago/misago/users/tests/test_new_user_setup.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | 2 | 2021-03-06T21:06:13.000Z | 2021-03-09T15:05:12.000Z | misago/misago/users/tests/test_new_user_setup.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | null | null | null | misago/misago/users/tests/test_new_user_setup.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model
from ...conf.test import override_dynamic_settings
from ..setupnewuser import set_default_subscription_options, setup_new_user
User = get_user_model()
def user(db):
return User.objects.create_user("User", "user@example.com")
def test_default_avatar_is_set_for_user(dynamic_settings, user):
setup_new_user(dynamic_settings, user)
assert user.avatars
assert user.avatar_set.exists()
def test_default_started_threads_subscription_option_is_set_for_user(
dynamic_settings, user
):
with override_dynamic_settings(subscribe_start="no"):
set_default_subscription_options(dynamic_settings, user)
assert user.subscribe_to_started_threads == User.SUBSCRIPTION_NONE
with override_dynamic_settings(subscribe_start="watch"):
set_default_subscription_options(dynamic_settings, user)
assert user.subscribe_to_started_threads == User.SUBSCRIPTION_NOTIFY
with override_dynamic_settings(subscribe_start="watch_email"):
set_default_subscription_options(dynamic_settings, user)
assert user.subscribe_to_started_threads == User.SUBSCRIPTION_ALL
def test_default_replied_threads_subscription_option_is_set_for_user(
dynamic_settings, user
):
with override_dynamic_settings(subscribe_reply="no"):
set_default_subscription_options(dynamic_settings, user)
assert user.subscribe_to_replied_threads == User.SUBSCRIPTION_NONE
with override_dynamic_settings(subscribe_reply="watch"):
set_default_subscription_options(dynamic_settings, user)
assert user.subscribe_to_replied_threads == User.SUBSCRIPTION_NOTIFY
with override_dynamic_settings(subscribe_reply="watch_email"):
set_default_subscription_options(dynamic_settings, user)
assert user.subscribe_to_replied_threads == User.SUBSCRIPTION_ALL
def test_if_user_ip_is_available_audit_trail_is_created_for_user(dynamic_settings):
user = User.objects.create_user(
"User", "user@example.com", joined_from_ip="0.0.0.0"
)
setup_new_user(dynamic_settings, user)
assert user.audittrail_set.count() == 1
def test_if_user_ip_is_not_available_audit_trail_is_not_created(dynamic_settings, user):
setup_new_user(dynamic_settings, user)
assert user.audittrail_set.exists() is False
| 37.612903 | 88 | 0.797599 | 306 | 2,332 | 5.601307 | 0.199346 | 0.183781 | 0.155193 | 0.131272 | 0.791132 | 0.775963 | 0.742707 | 0.724037 | 0.67853 | 0.582847 | 0 | 0.002468 | 0.131218 | 2,332 | 61 | 89 | 38.229508 | 0.843534 | 0 | 0 | 0.302326 | 0 | 0 | 0.035592 | 0 | 0 | 0 | 0 | 0 | 0.232558 | 1 | 0.139535 | false | 0 | 0.069767 | 0.023256 | 0.232558 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eededd924be3c0274e5ae998f2286beef26c3a61 | 1,474 | py | Python | release/stubs.min/Autodesk/Revit/DB/Electrical_parts/ElectricalDemandFactorRule.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/Autodesk/Revit/DB/Electrical_parts/ElectricalDemandFactorRule.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/Autodesk/Revit/DB/Electrical_parts/ElectricalDemandFactorRule.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | class ElectricalDemandFactorRule(Enum, IComparable, IFormattable, IConvertible):
"""
This enum describes the different demand factor rule types available to the application.
Within a demand factor a rule will be referenced and the user will have to enter values
corresponding to that rule.
enum ElectricalDemandFactorRule,values: Constant (0),LoadTable (2),LoadTablePerPortion (4),QuantityTable (1),QuantityTablePerPortion (3)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
Constant = None
LoadTable = None
LoadTablePerPortion = None
QuantityTable = None
QuantityTablePerPortion = None
value__ = None
| 27.811321 | 221 | 0.619403 | 163 | 1,474 | 5.018405 | 0.404908 | 0.0978 | 0.102689 | 0.110024 | 0.157702 | 0.157702 | 0.157702 | 0.138142 | 0.138142 | 0.138142 | 0 | 0.004638 | 0.268657 | 1,474 | 52 | 222 | 28.346154 | 0.754174 | 0.46133 | 0 | 0.37037 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.37037 | false | 0.37037 | 0 | 0 | 0.62963 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
eee026343b2e12aef1d463c88c1f87bcaa3e3661 | 609 | py | Python | sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/resource.py | dubiety/azure-sdk-for-python | 62ffa839f5d753594cf0fe63668f454a9d87a346 | [
"MIT"
] | 1 | 2022-02-01T18:50:12.000Z | 2022-02-01T18:50:12.000Z | sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/resource.py | ellhe-blaster/azure-sdk-for-python | 82193ba5e81cc5e5e5a5239bba58abe62e86f469 | [
"MIT"
] | null | null | null | sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/resource.py | ellhe-blaster/azure-sdk-for-python | 82193ba5e81cc5e5e5a5239bba58abe62e86f469 | [
"MIT"
] | null | null | null | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from marshmallow import post_dump, post_load, INCLUDE
from azure.ai.ml._schema.resource_configuration import ResourceConfigurationSchema
class ComponentResourceSchema(ResourceConfigurationSchema):
class Meta:
unknown = INCLUDE
@post_load
def make(self, data, **kwargs):
return data
@post_dump(pass_original=True)
def dump_override(self, data, original, **kwargs):
return original
| 30.45 | 82 | 0.597701 | 54 | 609 | 6.592593 | 0.648148 | 0.044944 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152709 | 609 | 19 | 83 | 32.052632 | 0.689922 | 0.284072 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.090909 | 0.181818 | 0.181818 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 |
eef35e9555049e57c9634770f352e1d4629135d1 | 271 | py | Python | py3nvml/__init__.py | m5imunovic/py3nvml | 23c55a30df82abeb55a3df473b594c7157332d40 | [
"BSD-3-Clause"
] | 216 | 2017-02-14T21:19:19.000Z | 2022-03-26T10:10:09.000Z | py3nvml/__init__.py | m5imunovic/py3nvml | 23c55a30df82abeb55a3df473b594c7157332d40 | [
"BSD-3-Clause"
] | 18 | 2017-05-09T12:47:26.000Z | 2022-03-16T14:09:14.000Z | py3nvml/__init__.py | m5imunovic/py3nvml | 23c55a30df82abeb55a3df473b594c7157332d40 | [
"BSD-3-Clause"
] | 35 | 2017-05-04T00:06:15.000Z | 2022-03-22T02:58:46.000Z | from __future__ import absolute_import
from py3nvml import py3nvml
from py3nvml import nvidia_smi
from py3nvml.utils import grab_gpus, get_free_gpus, get_num_procs
__all__ = ['py3nvml', 'nvidia_smi', 'grab_gpus', 'get_free_gpus', 'get_num_procs']
__version__ = "0.2.6"
| 30.111111 | 82 | 0.797048 | 42 | 271 | 4.547619 | 0.452381 | 0.146597 | 0.17801 | 0.157068 | 0.314136 | 0.314136 | 0.314136 | 0.314136 | 0 | 0 | 0 | 0.033195 | 0.110701 | 271 | 8 | 83 | 33.875 | 0.759336 | 0 | 0 | 0 | 0 | 0 | 0.210332 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
eefc3a31601eaed6921e80b164c8384be8d69393 | 782 | py | Python | deluca/lung/environments/__init__.py | MinRegret/deluca-lung | 488c04f027cd5b05e1c5b6524ce21c3be2739532 | [
"Apache-2.0"
] | 1 | 2021-12-20T13:19:57.000Z | 2021-12-20T13:19:57.000Z | deluca/lung/environments/__init__.py | google/deluca-lung | 8c665f3ac53f2251945f08c9990f2cfa099fdf06 | [
"Apache-2.0"
] | 1 | 2021-04-25T22:38:00.000Z | 2021-04-25T22:38:00.000Z | deluca/lung/environments/__init__.py | MinRegret/deluca-lung | 488c04f027cd5b05e1c5b6524ce21c3be2739532 | [
"Apache-2.0"
] | 3 | 2021-10-17T11:56:43.000Z | 2022-02-26T21:07:37.000Z | from deluca.lung.environments._balloon_lung import BalloonLung
from deluca.lung.environments._delay_lung import DelayLung
from deluca.lung.environments._physical_lung import PhysicalLung
from deluca.lung.environments._stitched_sim import StitchedSim
# from deluca.lung.environments._linear import Linear
# from deluca.lung.environments._cnn import CNN
# from deluca.lung.environments._lstm import LSTM
# from deluca.lung.environments._mlp import MLP
# from deluca.lung.environments._single_comp_lung_pid import SingleCompLung
# from deluca.lung.environments._double_comp_lung_pid import DoubleCompLung
__all__ = [
"BalloonLung",
"DelayLung",
"PhysicalLung",
"StitchedSim",
# "Linear",
# "CNN",
# "MLP",
# "SingleCompLung",
# "DoubleCompLung",
]
| 34 | 75 | 0.780051 | 90 | 782 | 6.511111 | 0.277778 | 0.170648 | 0.238908 | 0.443686 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129156 | 782 | 22 | 76 | 35.545455 | 0.860499 | 0.51023 | 0 | 0 | 0 | 0 | 0.115903 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e1285f4a459979a15fafd2f252d99136be9d3353 | 63 | py | Python | Functions Advanced/02. Sort.py | milenpenev/Python_Advanced | 2f32012dd682fa9541bbf5fa155f6bdbcfa946de | [
"MIT"
] | null | null | null | Functions Advanced/02. Sort.py | milenpenev/Python_Advanced | 2f32012dd682fa9541bbf5fa155f6bdbcfa946de | [
"MIT"
] | null | null | null | Functions Advanced/02. Sort.py | milenpenev/Python_Advanced | 2f32012dd682fa9541bbf5fa155f6bdbcfa946de | [
"MIT"
] | null | null | null | nums = [int(el) for el in input().split()]
print(sorted(nums)) | 21 | 42 | 0.650794 | 11 | 63 | 3.727273 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126984 | 63 | 3 | 43 | 21 | 0.745455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
012ba136bac310f6478eae4860ec72dcecf7fc98 | 227 | py | Python | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/r/redefine_loop.py | ciskoinch8/vimrc | 5bf77a7e7bc70fac5173ab2e9ea05d7dda3e52b8 | [
"MIT"
] | 463 | 2015-01-15T08:17:42.000Z | 2022-03-28T15:10:20.000Z | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/r/redefine_loop.py | ciskoinch8/vimrc | 5bf77a7e7bc70fac5173ab2e9ea05d7dda3e52b8 | [
"MIT"
] | 52 | 2015-01-06T02:43:59.000Z | 2022-03-14T11:15:21.000Z | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/r/redefine_loop.py | ciskoinch8/vimrc | 5bf77a7e7bc70fac5173ab2e9ea05d7dda3e52b8 | [
"MIT"
] | 249 | 2015-01-07T22:49:49.000Z | 2022-03-18T02:32:06.000Z | """Test case for variable redefined in inner loop."""
for item in range(0, 5):
print("hello")
for item in range(5, 10): #[redefined-outer-name]
print(item)
print("yay")
print(item)
print("done")
| 25.222222 | 53 | 0.594714 | 33 | 227 | 4.090909 | 0.575758 | 0.103704 | 0.133333 | 0.207407 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02924 | 0.246696 | 227 | 8 | 54 | 28.375 | 0.760234 | 0.30837 | 0 | 0.285714 | 0 | 0 | 0.07947 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.714286 | 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 |
012fa4e16e8d492c379c29f50266342cf6363387 | 44 | py | Python | settings.py | ipkn/somebox | 1fedaa07236402269b8ad10dc9563f3d90aaead1 | [
"MIT"
] | 4 | 2017-12-25T10:36:15.000Z | 2018-01-01T10:42:34.000Z | settings.py | ipkn/somebox | 1fedaa07236402269b8ad10dc9563f3d90aaead1 | [
"MIT"
] | null | null | null | settings.py | ipkn/somebox | 1fedaa07236402269b8ad10dc9563f3d90aaead1 | [
"MIT"
] | null | null | null | watch_folders = {
"share":"share"
}
| 11 | 23 | 0.522727 | 4 | 44 | 5.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.295455 | 44 | 3 | 24 | 14.666667 | 0.709677 | 0 | 0 | 0 | 0 | 0 | 0.227273 | 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 |
013fa57901307fabf9de19a428338d1c41edbb54 | 878 | py | Python | ergs/dashboard/migrations/0016_auto_20200201_1634.py | Mtulimbogo/uDART | 21e8060239e119310ea89bf02b366a689a2b6a1f | [
"bzip2-1.0.6"
] | null | null | null | ergs/dashboard/migrations/0016_auto_20200201_1634.py | Mtulimbogo/uDART | 21e8060239e119310ea89bf02b366a689a2b6a1f | [
"bzip2-1.0.6"
] | 6 | 2020-02-14T11:24:34.000Z | 2022-02-10T12:02:28.000Z | ergs/dashboard/migrations/0016_auto_20200201_1634.py | Mtulimbogo/uDART | 21e8060239e119310ea89bf02b366a689a2b6a1f | [
"bzip2-1.0.6"
] | null | null | null | # Generated by Django 2.2.6 on 2020-02-01 13:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0015_auto_20200201_1633'),
]
operations = [
migrations.AlterField(
model_name='bus_station',
name='station_id',
field=models.IntegerField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='entry_logs',
name='uuid_number',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='exit_logs',
name='uuid_number',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='recharge_logs',
name='uuid_number',
field=models.IntegerField(),
),
]
| 25.823529 | 73 | 0.567198 | 82 | 878 | 5.878049 | 0.536585 | 0.165975 | 0.207469 | 0.240664 | 0.375519 | 0.375519 | 0.375519 | 0.290456 | 0.290456 | 0.290456 | 0 | 0.052101 | 0.322323 | 878 | 33 | 74 | 26.606061 | 0.757983 | 0.051253 | 0 | 0.518519 | 1 | 0 | 0.141998 | 0.027678 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.037037 | 0 | 0.148148 | 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 |
0151605f2d9cc555342aa7a1c6f84074169c7260 | 56 | py | Python | 1-Iniciante-Beginner/1016 - Distancia - Distance.py | Limarceu/Uri_Online_Judge | 3328dacd5419b5a6bce4cb7dfc38e355e9fdab1f | [
"MIT"
] | null | null | null | 1-Iniciante-Beginner/1016 - Distancia - Distance.py | Limarceu/Uri_Online_Judge | 3328dacd5419b5a6bce4cb7dfc38e355e9fdab1f | [
"MIT"
] | null | null | null | 1-Iniciante-Beginner/1016 - Distancia - Distance.py | Limarceu/Uri_Online_Judge | 3328dacd5419b5a6bce4cb7dfc38e355e9fdab1f | [
"MIT"
] | null | null | null | valor = int(input())
print('{} minutos'.format(valor*2)) | 28 | 35 | 0.660714 | 8 | 56 | 4.625 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0.071429 | 56 | 2 | 35 | 28 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0.175439 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
0167f5e423667e41d40f38a5cf66600facd3c43a | 568 | py | Python | multenant/management/commands/migrate_tenants.py | ekinertac/django-multi-db-tenant | a3459e22ca1ec56be353af086492340860c26b2d | [
"MIT"
] | null | null | null | multenant/management/commands/migrate_tenants.py | ekinertac/django-multi-db-tenant | a3459e22ca1ec56be353af086492340860c26b2d | [
"MIT"
] | null | null | null | multenant/management/commands/migrate_tenants.py | ekinertac/django-multi-db-tenant | a3459e22ca1ec56be353af086492340860c26b2d | [
"MIT"
] | null | null | null | from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from django.core.management.commands.migrate import Command as MigrateCommand
from multenant.utils import get_tenant_databases
class Command(BaseCommand):
help = 'Migrate tenant databases'
def handle(self, *args, **options):
all_databases = get_tenant_databases()
for x in all_databases.keys():
self.stdout.write(self.style.SUCCESS(f"Running migrations for: {x}"))
call_command('migrate', database=x)
| 33.411765 | 81 | 0.741197 | 71 | 568 | 5.816901 | 0.549296 | 0.072639 | 0.101695 | 0.174334 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169014 | 568 | 16 | 82 | 35.5 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0.102113 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.363636 | 0 | 0.636364 | 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 |
01889abce66a59fa8340743ade30007d7d8496ba | 214 | py | Python | m2cgen/interpreters/__init__.py | ggerrein/m2cgen | e916f555b42e3a1d46828942c6b4e5c365c6a624 | [
"MIT"
] | 1 | 2019-06-27T11:26:18.000Z | 2019-06-27T11:26:18.000Z | m2cgen/interpreters/__init__.py | ggerrein/m2cgen | e916f555b42e3a1d46828942c6b4e5c365c6a624 | [
"MIT"
] | null | null | null | m2cgen/interpreters/__init__.py | ggerrein/m2cgen | e916f555b42e3a1d46828942c6b4e5c365c6a624 | [
"MIT"
] | 1 | 2020-04-17T13:58:09.000Z | 2020-04-17T13:58:09.000Z | from .java.interpreter import JavaInterpreter
from .python.interpreter import PythonInterpreter
from .c.interpreter import CInterpreter
__all__ = [
JavaInterpreter,
PythonInterpreter,
CInterpreter,
]
| 19.454545 | 49 | 0.78972 | 19 | 214 | 8.684211 | 0.526316 | 0.309091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154206 | 214 | 10 | 50 | 21.4 | 0.911602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
018bc1f7b9a0f941199c830369b6c9f53cae0a43 | 805 | py | Python | pretty_sample.py | xm4dn355x/python_rich_test | 257b79e572640cc8355c8e2ae898f0ea371decd4 | [
"MIT"
] | null | null | null | pretty_sample.py | xm4dn355x/python_rich_test | 257b79e572640cc8355c8e2ae898f0ea371decd4 | [
"MIT"
] | null | null | null | pretty_sample.py | xm4dn355x/python_rich_test | 257b79e572640cc8355c8e2ae898f0ea371decd4 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
########################################################################
# #
# #
# #
# MIT License #
# Copyright (c) 2021 Michael Nikitenko #
# #
########################################################################
from rich import pretty
pretty.install() # Beautifuliser for python syntax and etc ONLY IN REPL MODE!
if __name__ == '__main__':
print('["Rich and pretty", True]')
print(locals())
| 38.333333 | 80 | 0.226087 | 36 | 805 | 4.833333 | 0.861111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013441 | 0.537888 | 805 | 20 | 81 | 40.25 | 0.454301 | 0.621118 | 0 | 0 | 0 | 0 | 0.226027 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0.4 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0191def482e640e5bdc7ff7735a4903df9b7d0b0 | 22,120 | py | Python | python/shieldquery.py | nickfrerichs/fflproject | de475e7b9d853d465316c8f3fb1dd5f44475e827 | [
"MIT"
] | 29 | 2017-08-10T15:04:54.000Z | 2022-03-07T08:18:25.000Z | python/shieldquery.py | nickfrerichs/fflproject | de475e7b9d853d465316c8f3fb1dd5f44475e827 | [
"MIT"
] | 51 | 2017-05-03T02:45:19.000Z | 2020-09-08T15:01:40.000Z | python/shieldquery.py | nickfrerichs/fflproject | de475e7b9d853d465316c8f3fb1dd5f44475e827 | [
"MIT"
] | 9 | 2017-11-27T11:14:46.000Z | 2022-02-09T19:56:16.000Z | import os,sys
import json
import time
import requests
import datetime
try:
import custom_get_auth_token
except:
sys.exit("custom_get_auth_token.py should exist and contain a function get_token()")
class ShieldAPI:
def __init__(self, proxies=None, headers=None):
if proxies is None:
self.proxies = dict()
else:
self.proxies = proxies
self.headers = {
"Content-Type" : "application/json",
"Connection" : "keep-alive",
"Cache-Control" : "max-age=0",
}
if headers is not None:
self.headers.update(headers)
self.session = requests.Session()
self.session.headers.update(self.headers)
self.api_auth_token = None
self.__loadToken()
def __query(self,q,v="null"):
self.__setAuthHeader()
q = ' '.join(q.split())
chars = ['{','}',':','(',')',',']
for c in chars:
q = q.replace(' %s '%(c),c).replace('%s '%(c),c).replace(' %s'%(c),c)
params = {
"query" : q,
"variables" : v
}
response = self.session.get("https://api.nfl.com/v3/shield/",params = params,proxies=self.proxies)
return json.loads(response.content)
def query(self,q,v="null"):
return self.__query(q,v)
# ===================================================
# Public queries performed when browsing NFL scores
# ===================================================
# https://api.nfl.com/v1/config?c=%2Fpublic%2Fweb
# This one has team logos and colors
def current_season_state(self, date=None):
# Original request URL
# https://api.nfl.com/v3/shield/?query=%20query%7Bviewer%7Bleague%7Bcurrent(date%3A%222020-07-15%22)%7Bid%20week%7Bid%20seasonType%20seasonValue%20weekOrder%20weekType%20weekValue%7D%7D%7D%7D%7D&variables=null
if date is None:
date = datetime.datetime.now().strftime('%Y-%m-%d')
return self.__query(
"""
query {
viewer {
league {
current(date: "%s") {
id
week {
id
seasonType
seasonValue
weekOrder
weekType
weekValue
}
}
}
}
}
""" % (date)
)
def game_detail(self, gameDetailId):
# Original request URL
# https://api.nfl.com/v3/shield/?query=query%7Bviewer%7BgameDetail(id%3A%2210160000-0579-00cc-9a8c-d465ab211561%22)%7Bid%20attendance%20distance%20down%20gameClock%20goalToGo%20homePointsOvertime%20homePointsTotal%20homePointsQ1%20homePointsQ2%20homePointsQ3%20homePointsQ4%20homeTeam%7Babbreviation%20nickName%7DhomeTimeoutsUsed%20homeTimeoutsRemaining%20period%20phase%20playReview%20possessionTeam%7Babbreviation%20nickName%7Dredzone%20scoringSummaries%7BplayId%20playDescription%20patPlayId%20homeScore%20visitorScore%7Dstadium%20startTime%20visitorPointsOvertime%20visitorPointsOvertimeTotal%20visitorPointsQ1%20visitorPointsQ2%20visitorPointsQ3%20visitorPointsQ4%20visitorPointsTotal%20visitorTeam%7Babbreviation%20nickName%7DvisitorTimeoutsUsed%20visitorTimeoutsRemaining%20homePointsOvertimeTotal%20visitorPointsOvertimeTotal%20possessionTeam%7BnickName%7Dweather%7BcurrentFahrenheit%20location%20longDescription%20shortDescription%20currentRealFeelFahrenheit%7DyardLine%20yardsToGo%20drives%7BquarterStart%20endTransition%20endYardLine%20endedWithScore%20firstDowns%20gameClockEnd%20gameClockStart%20howEndedDescription%20howStartedDescription%20inside20%20orderSequence%20playCount%20playIdEnded%20playIdStarted%20playSeqEnded%20playSeqStarted%20possessionTeam%7Babbreviation%20nickName%20franchise%7BcurrentLogo%7Burl%7D%7D%7DquarterEnd%20realStartTime%20startTransition%20startYardLine%20timeOfPossession%20yards%20yardsPenalized%7Dplays%7BclockTime%20down%20driveNetYards%20drivePlayCount%20driveSequenceNumber%20driveTimeOfPossession%20endClockTime%20endYardLine%20firstDown%20goalToGo%20nextPlayIsGoalToGo%20nextPlayType%20orderSequence%20penaltyOnPlay%20playClock%20playDeleted%20playDescription%20playDescriptionWithJerseyNumbers%20playId%20playReviewStatus%20isBigPlay%20playType%20playStats%7BstatId%20yards%20team%7Bid%20abbreviation%7DplayerName%20gsisPlayer%7Bid%7D%7DpossessionTeam%7Babbreviation%20nickName%20franchise%7BcurrentLogo%7Burl%7D%7D%7DprePlayByPlay%20quarter%20scoringPlay%20scoringPlayType%20scoringTeam%7Bid%20abbreviation%20nickName%7DshortDescription%20specialTeamsPlay%20stPlayType%20timeOfDay%20yardLine%20yards%20yardsToGo%20latestPlay%7D%7D%7D%7D&variables=null
# "playStats": [
# {
# "statId": 410,
# "yards": 75,
# "team": {
# "id": "10040325-2019-fe5a-96d1-46b29a6a2b60",
# "abbreviation": "BAL"
# },
# "playerName": "J.Tucker",
# "gsisPlayer": {
# "id": "32013030-2d30-3032-3935-39371b9a6ac1" <= might be able to find this using livegame / livestats
# }
# }
return self.__query("""
query {
viewer {
gameDetail(id: "%s") {
id
attendance
distance
down
gameClock
goalToGo
homePointsOvertime
homePointsTotal
homePointsQ1
homePointsQ2
homePointsQ3
homePointsQ4
homeTeam {
abbreviation
nickName
}
homeTimeoutsUsed
homeTimeoutsRemaining
period
phase
playReview
possessionTeam {
abbreviation
nickName
}
redzone
scoringSummaries {
playId
playDescription
patPlayId
homeScore
visitorScore
}
stadium
startTime
visitorPointsOvertime
visitorPointsOvertimeTotal
visitorPointsQ1
visitorPointsQ2
visitorPointsQ3
visitorPointsQ4
visitorPointsTotal
visitorTeam {
abbreviation
nickName
}
visitorTimeoutsUsed
visitorTimeoutsRemaining
homePointsOvertimeTotal
visitorPointsOvertimeTotal
possessionTeam {
nickName
}
weather {
currentFahrenheit
location
longDescription
shortDescription
currentRealFeelFahrenheit
}
yardLine
yardsToGo
drives {
quarterStart
endTransition
endYardLine
endedWithScore
firstDowns
gameClockEnd
gameClockStart
howEndedDescription
howStartedDescription
inside20
orderSequence
playCount
playIdEnded
playIdStarted
playSeqEnded
playSeqStarted
possessionTeam {
abbreviation
nickName
franchise {
currentLogo {
url
}
}
}
quarterEnd
realStartTime
startTransition
startYardLine
timeOfPossession
yards
yardsPenalized
}
plays {
clockTime
down
driveNetYards
drivePlayCount
driveSequenceNumber
driveTimeOfPossession
endClockTime
endYardLine
firstDown
goalToGo
nextPlayIsGoalToGo
nextPlayType
orderSequence
penaltyOnPlay
playClock
playDeleted
playDescription
playDescriptionWithJerseyNumbers
playId
playReviewStatus
isBigPlay
playType
playStats {
statId
yards
team {
id
abbreviation
}
playerName
gsisPlayer {
id
}
}
possessionTeam {
abbreviation
nickName
franchise {
currentLogo {
url
}
}
}
prePlayByPlay
quarter
scoringPlay
scoringPlayType
scoringTeam {
id
abbreviation
nickName
}
shortDescription
specialTeamsPlay
stPlayType
timeOfDay
yardLine
yards
yardsToGo
latestPlay
}
}
}
}
""" % (gameDetailId))
def league_games(self,year,week,week_type):
# Original request URL
# https://api.nfl.com/v3/shield/?query=query%7Bviewer%7Bleague%7Bgames(first%3A100%2Cweek_seasonValue%3A2020%2Cweek_seasonType%3AREG%2Cweek_weekValue%3A2%2C)%7Bedges%7Bcursor%20node%7Bid%20esbId%20gameDetailId%20gameTime%20gsisId%20networkChannels%20radioLinks%20ticketUrl%20venue%7BfullName%20city%20state%7DawayTeam%7BnickName%20id%20abbreviation%20franchise%7BcurrentLogo%7Burl%7D%7D%7DhomeTeam%7BnickName%20id%20abbreviation%20franchise%7BcurrentLogo%7Burl%7D%7D%7Dslug%7D%7D%7D%7D%7D%7D&variables=null
return self.__query("""
query {
viewer {
league {
games(
first: 100
week_seasonValue: %s
week_seasonType: %s
week_weekValue: %s
) {
edges {
cursor
node {
id
esbId
gameDetailId
gameTime
gsisId
networkChannels
radioLinks
ticketUrl
venue {
fullName
city
state
}
awayTeam {
nickName
id
abbreviation
franchise {
currentLogo {
url
}
}
}
homeTeam {
nickName
id
abbreviation
franchise {
currentLogo {
url
}
}
}
slug
}
}
}
}
}
}
""" % (str(year),str(week_type),str(week)))
def player_game_stats(self, game_id):
# Original request URL
# https://api.nfl.com/v3/shield/?query=query%7Bviewer%7BplayerGameStats(first%3A200%2Cgame_id%3A%2210012019-0908-0811-7a44-785cc0a26345%22)%7Bedges%7Bcursor%20node%7BcreatedDate%20game%7Bid%7DgameStats%7BdefensiveAssists%20defensiveInterceptions%20defensiveInterceptionsYards%20defensiveForcedFumble%20defensivePassesDefensed%20defensiveSacks%20defensiveSafeties%20defensiveSoloTackles%20defensiveTotalTackles%20defensiveTacklesForALoss%20touchdownsDefense%20fumblesLost%20fumblesTotal%20kickReturns%20kickReturnsLong%20kickReturnsTouchdowns%20kickReturnsYards%20kickingFgAtt%20kickingFgLong%20kickingFgMade%20kickingXkAtt%20kickingXkMade%20passingAttempts%20passingCompletions%20passingTouchdowns%20passingYards%20passingInterceptions%20puntReturns%20puntingAverageYards%20puntingLong%20puntingPunts%20puntingPuntsInside20%20receivingReceptions%20receivingTarget%20receivingTouchdowns%20receivingYards%20rushingAttempts%20rushingAverageYards%20rushingTouchdowns%20rushingYards%20kickoffReturnsTouchdowns%20kickoffReturnsYards%20puntReturnsLong%20opponentFumbleRecovery%20totalPointsScored%20kickReturnsAverageYards%20puntReturnsAverageYards%20puntReturnsTouchdowns%7Did%20lastModifiedDate%20player%7Bposition%20jerseyNumber%20currentTeam%7Babbreviation%20nickName%7Dperson%7BfirstName%20lastName%20displayName%20headshot%7Basset%7Burl%7D%7D%7D%7Dseason%7Bid%7Dweek%7Bid%7D%7D%7D%7D%7D%7D&variables=null
# This part is shield_id: 35349-4541-0345
# "id": "10435349-4541-0345-2019-2019112500e5",
# "lastModifiedDate": "2019-11-27T22:23:13.725Z",
# "player": {
# "position": "DE",
# "jerseyNumber": "92",
# "currentTeam": {
# "abbreviation": "MIA",
# "nickName": "Dolphins"
# },
# "person": {
# "firstName": "Zach",
# "lastName": "Sieler",
# "displayName": "Zach Sieler",
# "headshot": {
# "asset": {
# "url": "http://static.nfl.com/static/content/public/static/img/fantasy/transparent/512x512/SIE410345.png"
# }
# }
# }
# },
return self.__query("""
query {
viewer {
playerGameStats(first: 200, game_id: "%s") {
edges {
cursor
node {
createdDate
game {
id
}
gameStats {
defensiveAssists
defensiveInterceptions
defensiveInterceptionsYards
defensiveForcedFumble
defensivePassesDefensed
defensiveSacks
defensiveSafeties
defensiveSoloTackles
defensiveTotalTackles
defensiveTacklesForALoss
touchdownsDefense
fumblesLost
fumblesTotal
kickReturns
kickReturnsLong
kickReturnsTouchdowns
kickReturnsYards
kickingFgAtt
kickingFgLong
kickingFgMade
kickingXkAtt
kickingXkMade
passingAttempts
passingCompletions
passingTouchdowns
passingYards
passingInterceptions
puntReturns
puntingAverageYards
puntingLong
puntingPunts
puntingPuntsInside20
receivingReceptions
receivingTarget
receivingTouchdowns
receivingYards
rushingAttempts
rushingAverageYards
rushingTouchdowns
rushingYards
kickoffReturnsTouchdowns
kickoffReturnsYards
puntReturnsLong
opponentFumbleRecovery
totalPointsScored
kickReturnsAverageYards
puntReturnsAverageYards
puntReturnsTouchdowns
}
id
lastModifiedDate
player {
position
jerseyNumber
currentTeam {
abbreviation
nickName
}
person {
firstName
lastName
displayName
headshot {
asset {
url
}
}
}
}
season {
id
}
week {
id
}
}
}
}
}
}
"""% (game_id))
# =============================================================================================
# For loading token authorized for queries
# - custom_get_auth_token.py should exist
# - it should contain a function get_token() that returns the token as a string
# =============================================================================================
def __loadToken(self):
self.api_auth_token = custom_get_auth_token.get_token()
self.__setAuthHeader()
def __setAuthHeader(self):
if self.api_auth_token is None:
self.__loadToken()
self.session.headers.update({
"Authorization" : "Bearer "+self.api_auth_token
})
| 47.164179 | 2,213 | 0.409855 | 1,068 | 22,120 | 8.423221 | 0.553371 | 0.010227 | 0.009337 | 0.008004 | 0.118608 | 0.107492 | 0.06892 | 0.046799 | 0.024344 | 0.024344 | 0 | 0.072175 | 0.528345 | 22,120 | 468 | 2,214 | 47.264957 | 0.790089 | 0.26623 | 0 | 0.247978 | 0 | 0 | 0.838627 | 0.035733 | 0 | 0 | 0 | 0 | 0 | 1 | 0.024259 | false | 0.016173 | 0.016173 | 0.010782 | 0.059299 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0198c5684e16fa164783f20e54a626703c2ce5f9 | 269 | py | Python | catalyst/contrib/models/cv/classification/__init__.py | cgarciae/catalyst | 391ff89ab0d9a1961b88719e894f917ac0fb7fc3 | [
"Apache-2.0"
] | 46 | 2020-03-27T20:12:32.000Z | 2021-11-21T19:08:51.000Z | catalyst/contrib/models/cv/classification/__init__.py | cgarciae/catalyst | 391ff89ab0d9a1961b88719e894f917ac0fb7fc3 | [
"Apache-2.0"
] | 2 | 2020-04-06T10:43:04.000Z | 2020-07-01T18:26:10.000Z | catalyst/contrib/models/cv/classification/__init__.py | cgarciae/catalyst | 391ff89ab0d9a1961b88719e894f917ac0fb7fc3 | [
"Apache-2.0"
] | 5 | 2020-04-17T14:09:53.000Z | 2021-05-10T08:58:29.000Z | # flake8: noqa
from .mobilenetv2 import InvertedResidual, MobileNetV2
from .mobilenetv3 import MobileNetV3, MobileNetV3Large, MobileNetV3Small
__all__ = [
"InvertedResidual",
"MobileNetV2",
"MobileNetV3",
"MobileNetV3Small",
"MobileNetV3Large",
]
| 20.692308 | 72 | 0.739777 | 19 | 269 | 10.263158 | 0.526316 | 0.276923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049107 | 0.167286 | 269 | 12 | 73 | 22.416667 | 0.821429 | 0.04461 | 0 | 0 | 0 | 0 | 0.27451 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 0 | 1 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
6d6fe990d5cd1f9f0e5fcdc5aee70a2f707a9021 | 2,643 | py | Python | Classes/Wrappers/PlayerProfile.py | Enjoyop/BSDS-V42 | 73b1e86364983d0fc521bdb53e0e4d85f6ae8a38 | [
"Apache-2.0"
] | 16 | 2022-03-03T03:49:59.000Z | 2022-03-30T19:18:42.000Z | Classes/Wrappers/PlayerProfile.py | Enjoyop/BSDS-V42 | 73b1e86364983d0fc521bdb53e0e4d85f6ae8a38 | [
"Apache-2.0"
] | 11 | 2022-03-03T19:56:13.000Z | 2022-03-29T03:03:35.000Z | Classes/Wrappers/PlayerProfile.py | Enjoyop/BSDS-V42 | 73b1e86364983d0fc521bdb53e0e4d85f6ae8a38 | [
"Apache-2.0"
] | 8 | 2022-03-03T12:29:47.000Z | 2022-03-30T19:39:00.000Z | from Classes.Logic.LogicLong import LogicLong
from Classes.Wrappers.PlayerDisplayData import PlayerDisplayData
class PlayerProfile:
def encode(calling_instance, fields, playerData):
calling_instance.encodeLogicLong(LogicLong(fields["PlayerID"][0], fields["PlayerID"][1]))
calling_instance.writeDataReference(0)
sortedBrawlers = sorted(playerData["OwnedBrawlers"], key=lambda x: (playerData["OwnedBrawlers"][x]['Trophies']), reverse=True)
calling_instance.writeVInt(len(sortedBrawlers))
for brawlerID in sortedBrawlers:
brawlerData = playerData["OwnedBrawlers"][brawlerID]
calling_instance.writeDataReference(16, brawlerID)
if brawlerData["Skins"] != []:
calling_instance.writeDataReference(29, brawlerData["Skins"][0]) # TODO: Sync with current skin
else:
calling_instance.writeDataReference(0)
calling_instance.writeVInt(brawlerData["Trophies"])
calling_instance.writeVInt(brawlerData["HighestTrophies"])
calling_instance.writeVInt(brawlerData["PowerLevel"])
calling_instance.writeVInt(16)
calling_instance.writeVInt(1)
calling_instance.writeVInt(9999)
calling_instance.writeVInt(2)
calling_instance.writeVInt(playerData["Experience"])
calling_instance.writeVInt(3)
calling_instance.writeVInt(playerData["Trophies"])
calling_instance.writeVInt(4)
calling_instance.writeVInt(playerData["HighestTrophies"])
calling_instance.writeVInt(5)
calling_instance.writeVInt(len(sortedBrawlers))
calling_instance.writeVInt(8)
calling_instance.writeVInt(9999)
calling_instance.writeVInt(11)
calling_instance.writeVInt(9999)
calling_instance.writeVInt(9)
calling_instance.writeVInt(0)
calling_instance.writeVInt(12)
calling_instance.writeVInt(0)
calling_instance.writeVInt(13)
calling_instance.writeVInt(100)
calling_instance.writeVInt(14)
calling_instance.writeVInt(0)
calling_instance.writeVInt(15)
calling_instance.writeVInt(9999)
calling_instance.writeVInt(16)
calling_instance.writeVInt(0)
calling_instance.writeVInt(18)
calling_instance.writeVInt(0)
calling_instance.writeVInt(17)
calling_instance.writeVInt(0)
calling_instance.writeVInt(19)
calling_instance.writeVInt(0)
PlayerDisplayData.encode(calling_instance, playerData)
def decode(calling_instance, fields):
pass | 34.776316 | 134 | 0.69353 | 247 | 2,643 | 7.238866 | 0.267206 | 0.377517 | 0.496644 | 0.097875 | 0.355705 | 0.309843 | 0.309843 | 0 | 0 | 0 | 0 | 0.029923 | 0.216042 | 2,643 | 76 | 135 | 34.776316 | 0.833012 | 0.010594 | 0 | 0.314815 | 0 | 0 | 0.053175 | 0 | 0 | 0 | 0 | 0.013158 | 0 | 1 | 0.037037 | false | 0.018519 | 0.037037 | 0 | 0.092593 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6d755220bdd524c1602b4d59e3ddaf1ca9bb6696 | 177 | py | Python | minsait/ttaa/datio/common/naming/Sunedu.py | dagarciam/escoffi_test_python | 989d60fc70fae7135932f5a670dfd13c1668296d | [
"Info-ZIP"
] | null | null | null | minsait/ttaa/datio/common/naming/Sunedu.py | dagarciam/escoffi_test_python | 989d60fc70fae7135932f5a670dfd13c1668296d | [
"Info-ZIP"
] | null | null | null | minsait/ttaa/datio/common/naming/Sunedu.py | dagarciam/escoffi_test_python | 989d60fc70fae7135932f5a670dfd13c1668296d | [
"Info-ZIP"
] | null | null | null | from minsait.ttaa.datio.common.naming.Field import Field
personal_id = Field("personal_id")
education_level_desc = Field("education_level_desc")
data_date = Field("data_date")
| 29.5 | 56 | 0.80791 | 26 | 177 | 5.192308 | 0.576923 | 0.192593 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.079096 | 177 | 5 | 57 | 35.4 | 0.828221 | 0 | 0 | 0 | 0 | 0 | 0.225989 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6d7c85080bf95f235b33e300ce7cdb0ee06aaf36 | 150 | py | Python | code/csv-demo.py | swcarpentry/web-data-python | 20b1421f26237811f49739d579a9688d3ecd3e8f | [
"CC-BY-4.0"
] | 10 | 2015-03-31T02:10:38.000Z | 2019-11-07T11:28:04.000Z | code/csv-demo.py | dbreddyAI/web-data-python | 20b1421f26237811f49739d579a9688d3ecd3e8f | [
"CC-BY-4.0"
] | 5 | 2015-04-28T09:24:00.000Z | 2015-06-02T01:36:16.000Z | code/csv-demo.py | dbreddyAI/web-data-python | 20b1421f26237811f49739d579a9688d3ecd3e8f | [
"CC-BY-4.0"
] | 16 | 2015-03-06T15:10:33.000Z | 2019-11-07T11:28:05.000Z | import os
import csv
data = u'first\nsecond\nthird\n'
wrapper = csv.reader(data.strip().split(os.linesep))
for record in wrapper:
print(record)
| 16.666667 | 52 | 0.726667 | 24 | 150 | 4.541667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14 | 150 | 8 | 53 | 18.75 | 0.844961 | 0 | 0 | 0 | 0 | 0 | 0.146667 | 0.146667 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 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 |
6d92bbfc1ef1bc90d563ace3fc80b994d7fbf245 | 172 | py | Python | flatbuffers/python/quantra/FlowType.py | joseprupi/quantragrpc | 48192a1d490596115252c2ad33e2dee4e2b215b5 | [
"BSD-3-Clause"
] | null | null | null | flatbuffers/python/quantra/FlowType.py | joseprupi/quantragrpc | 48192a1d490596115252c2ad33e2dee4e2b215b5 | [
"BSD-3-Clause"
] | null | null | null | flatbuffers/python/quantra/FlowType.py | joseprupi/quantragrpc | 48192a1d490596115252c2ad33e2dee4e2b215b5 | [
"BSD-3-Clause"
] | null | null | null | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: quantra
class FlowType(object):
Interest = 0
PastInterest = 1
Notional = 2
| 17.2 | 68 | 0.715116 | 20 | 172 | 6.15 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022556 | 0.226744 | 172 | 9 | 69 | 19.111111 | 0.902256 | 0.494186 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6dbc8020c3804106135b687f75d5b59fedfbb63e | 614 | py | Python | lib/concurrence/_threading/__init__.py | concurrence/concurrence | 7b67f69d26f2551647959ec69989e1bb7bf202ea | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 27 | 2015-01-17T15:33:31.000Z | 2021-01-01T08:53:46.000Z | lib/concurrence/_threading/__init__.py | toymachine/concurrence | 02f14e90e5f591970f87828c4a6e8f985d67834f | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 1 | 2018-05-03T03:12:57.000Z | 2018-05-03T03:12:57.000Z | lib/concurrence/_threading/__init__.py | toymachine/concurrence | 02f14e90e5f591970f87828c4a6e8f985d67834f | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 4 | 2015-05-11T03:36:15.000Z | 2019-03-05T16:28:29.000Z | # Copyright (C) 2009, Hyves (Startphone Ltd.)
#
# This module is part of the Concurrence Framework and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
def disable_threading():
import sys
import thread
sys.modules['thread'] = thread
import threading
sys.modules['threading'] = threading
import dummy_thread
sys.modules['dummy_thread'] = dummy_thread
import dummy_threading
sys.modules['dummy_threading'] = dummy_threading
import logging
logging.logThreads = 0
#for name, _ in sys.modules.items():
# print name, _
| 27.909091 | 73 | 0.705212 | 78 | 614 | 5.435897 | 0.538462 | 0.117925 | 0.075472 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010183 | 0.200326 | 614 | 21 | 74 | 29.238095 | 0.85336 | 0.387622 | 0 | 0 | 0 | 0 | 0.113821 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | true | 0 | 0.5 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
6dc52e3f6eebcd950564156a7214911da459d0cd | 569 | py | Python | apus/fluent_python/ex1.1.py | geislor/apus | 603ec8292507da5b10c30655a1e7eec6c33e6ef6 | [
"MIT"
] | null | null | null | apus/fluent_python/ex1.1.py | geislor/apus | 603ec8292507da5b10c30655a1e7eec6c33e6ef6 | [
"MIT"
] | 1 | 2016-06-24T13:21:19.000Z | 2016-06-24T13:21:19.000Z | apus/fluent_python/ex1.1.py | geislor/apus | 603ec8292507da5b10c30655a1e7eec6c33e6ef6 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
import collections
Card = collections.namedtuple('Card', ['rank', 'suit'])
class FrenchDeck:
ranks = [str(n) for n in range(2, 11)] + list('JQKA')
suits = 'spades diamonds clubs hearts'.split()
def __init__(self):
self._cards = [Card(rank, suit) for suit in self.suits
for rank in self.ranks]
def __len__(self):
return len(self._cards)
def __getitem__(self, item):
return self._cards[item]
if __name__ == '__main__':
deck = FrenchDeck()
print(len(deck))
pass
| 21.884615 | 62 | 0.599297 | 72 | 569 | 4.416667 | 0.569444 | 0.084906 | 0.075472 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009501 | 0.260105 | 569 | 25 | 63 | 22.76 | 0.745843 | 0.035149 | 0 | 0 | 0 | 0 | 0.095064 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1875 | false | 0.0625 | 0.0625 | 0.125 | 0.5625 | 0.0625 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.