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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ee96971fc5dc091f676b0aa6d88c0fa488534c29 | 180 | py | Python | 4-1/WIndow Programing/20180316/20125345.py | define16/Class | 8b0771a348b2bcb19ba338ebff94326828a293ea | [
"Apache-2.0"
] | null | null | null | 4-1/WIndow Programing/20180316/20125345.py | define16/Class | 8b0771a348b2bcb19ba338ebff94326828a293ea | [
"Apache-2.0"
] | null | null | null | 4-1/WIndow Programing/20180316/20125345.py | define16/Class | 8b0771a348b2bcb19ba338ebff94326828a293ea | [
"Apache-2.0"
] | null | null | null | cnt = 1;
for i in [10, 2, 7] :
print("%d : " % cnt , end = "" );
for j in range(1, i+1, 1) :
print("■", end = "");
print(" (%d)" % i);
cnt += 1;
| 16.363636 | 37 | 0.333333 | 28 | 180 | 2.178571 | 0.5 | 0.131148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084112 | 0.405556 | 180 | 10 | 38 | 18 | 0.476636 | 0 | 0 | 0 | 0 | 0 | 0.061111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
ee9d84501becf7aee7cf1c6034daf3de1a910759 | 1,064 | py | Python | spec/base.py | ace6807/spec-data-validation-pattern | 57c7a757035f16ffa999244175814db0ec3964d9 | [
"MIT"
] | 1 | 2021-07-27T00:55:08.000Z | 2021-07-27T00:55:08.000Z | spec/base.py | ace6807/spec-data-validation-pattern | 57c7a757035f16ffa999244175814db0ec3964d9 | [
"MIT"
] | null | null | null | spec/base.py | ace6807/spec-data-validation-pattern | 57c7a757035f16ffa999244175814db0ec3964d9 | [
"MIT"
] | null | null | null | from abc import abstractmethod
from dataclasses import dataclass
from typing import Any
class Spec:
@abstractmethod
def passes(self, candidate: Any) -> bool:
raise NotImplementedError()
def __call__(self, candidate: Any) -> bool:
return self.passes(candidate)
def __and__(self, other: "Spec") -> "And":
return And(self, other)
def __or__(self, other: "Spec") -> "Or":
return Or(self, other)
def __neg__(self) -> "Not":
return Not(self)
@dataclass(frozen=True)
class And(Spec):
first: Spec
second: Spec
def passes(self, candidate: Any) -> bool:
return self.first.passes(candidate) and self.second.passes(candidate)
@dataclass(frozen=True)
class Or(Spec):
first: Spec
second: Spec
def passes(self, candidate: Any) -> bool:
return self.first.passes(candidate) or self.second.passes(candidate)
@dataclass(frozen=True)
class Not(Spec):
subject: Spec
def passes(self, candidate: Any) -> bool:
return not self.subject.passes(candidate)
| 22.166667 | 77 | 0.658835 | 132 | 1,064 | 5.189394 | 0.219697 | 0.131387 | 0.116788 | 0.145985 | 0.525547 | 0.525547 | 0.439416 | 0.439416 | 0.239416 | 0.239416 | 0 | 0 | 0.223684 | 1,064 | 47 | 78 | 22.638298 | 0.829298 | 0 | 0 | 0.34375 | 0 | 0 | 0.015038 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0.09375 | 0.21875 | 0.84375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
eea4241f4f521b3fe349280b8cb510cea4f31976 | 824 | py | Python | scripts/scripts.py | Asion001/Nft | 5fce2620be79ea440596cee9c322f3f06251c2b1 | [
"MIT"
] | null | null | null | scripts/scripts.py | Asion001/Nft | 5fce2620be79ea440596cee9c322f3f06251c2b1 | [
"MIT"
] | null | null | null | scripts/scripts.py | Asion001/Nft | 5fce2620be79ea440596cee9c322f3f06251c2b1 | [
"MIT"
] | null | null | null | from brownie import accounts, network, Wei, project
import os, json
development_networks = ["development"]
def is_development():
return get_network() in development_networks
def get_network():
return network.show_active()
def get_account():
if is_development():
return accounts[0]
else:
return accounts.load("test_account")
def get_balance():
return get_account().balance()
def get_balance_in_eth():
return Wei(get_balance()).to("ether")
def get_publish_source():
if is_development():
return False
else:
return True
def get_last_deploy(network_number="4"):
with open("build/deployments/map.json", "r") as file:
deploy_map = file.read()
deploy_map = json.loads(deploy_map)
return deploy_map[network_number]["nft"][-1]
| 19.619048 | 57 | 0.677184 | 107 | 824 | 4.971963 | 0.448598 | 0.067669 | 0.107143 | 0.078947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004594 | 0.207524 | 824 | 41 | 58 | 20.097561 | 0.810107 | 0 | 0 | 0.153846 | 0 | 0 | 0.071602 | 0.031553 | 0 | 0 | 0 | 0 | 0 | 1 | 0.269231 | false | 0 | 0.076923 | 0.153846 | 0.692308 | 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 |
eee51ed7413b3939bd7f81de1af10487285d031f | 3,669 | py | Python | survivor/tests/survivor.py | vix993/project-lifeline | 273bdad6e4d31178995654bbfced9d9e9e665c12 | [
"MIT"
] | 1 | 2021-04-13T14:58:37.000Z | 2021-04-13T14:58:37.000Z | survivor/tests/survivor.py | vix993/project-lifeline | 273bdad6e4d31178995654bbfced9d9e9e665c12 | [
"MIT"
] | null | null | null | survivor/tests/survivor.py | vix993/project-lifeline | 273bdad6e4d31178995654bbfced9d9e9e665c12 | [
"MIT"
] | null | null | null | from rest_framework.test import APITestCase
from rest_framework import status
from rest_framework.reverse import reverse as api_reverse
from survivor.models import Survivor, FlagAsInfected, Reports
class SurvivorAPITestCase(APITestCase):
def setUp(self):
survivor = Survivor.objects.create(
name='New Name', age=20, gender='M', latitude='11', longitude='22',
items='Fiji Water:13;Campbell Soup:17;First Aid Pouch:18;AK47:652'
)
def test_single_post(self):
post_count = Survivor.objects.count()
self.assertEqual(post_count, 1)
def test_get_list(self):
data = {}
url = api_reverse("api-survivor:create-list-survivors")
response = self.client.get(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_post_item(self):
survivor = Survivor.objects.first()
data = {"name": "New Second Test Name", "age": "20", "gender": "M",
"latitude": "11", "longitude": "22",
"items": "Fiji Water:100;Campbell Soup:200;First Aid Pouch:150;AK47:50"}
url = api_reverse("api-survivor:create-list-survivors")
response = self.client.post(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
def test_get_item(self):
survivor = Survivor.objects.first()
data = {}
url = survivor.get_api_url()
response = self.client.get(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_update_item(self):
survivor = Survivor.objects.first()
url = survivor.get_api_url()
data = {"age": "16", "latitude": "66677888", "longitude": "332222111"}
response = self.client.post(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
response = self.client.put(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_update_item_with_user(self):
survivor = Survivor.objects.first()
url = survivor.get_api_url()
data = {"age": "16", "latitude": "66677888", "longitude": "332222111"}
response = self.client.put(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_update_latlon(self):
survivor = Survivor.objects.first()
url = survivor.get_api_url()
data = {"latitude": "30", "longitude": "30"}
response = self.client.put(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_post_item(self):
data = {"name": "Third Test Name", "age": "20", "gender": "M",
"latitude": "11", "longitude": "22",
"items": "Fiji Water:1500;Campbell Soup:200;First Aid Pouch:150;AK47:50"}
url = api_reverse("api-survivor:create-list-survivors")
response = self.client.post(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
def test_update(self):
survivor = Survivor.objects.create(
name='Usain Bolt',
age='27',
gender='M',
latitude="77.232323",
longitude="77.788888",
items="Fiji Water:1500;Campbell Soup:200;First Aid Pouch:150;AK47:50",
)
url = survivor.get_api_url()
data = {"latitude": "66", "longitude": "33"}
response = self.client.put(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK) | 43.678571 | 89 | 0.638321 | 452 | 3,669 | 5.028761 | 0.210177 | 0.040035 | 0.071271 | 0.067312 | 0.775187 | 0.766388 | 0.732072 | 0.684118 | 0.684118 | 0.684118 | 0 | 0.057042 | 0.225947 | 3,669 | 84 | 90 | 43.678571 | 0.74331 | 0 | 0 | 0.555556 | 0 | 0 | 0.180109 | 0.027793 | 0 | 0 | 0 | 0 | 0.138889 | 1 | 0.138889 | false | 0 | 0.055556 | 0 | 0.208333 | 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 |
eeeb8c96a94417f9f97bec07439fd6ca716f9e2d | 67 | py | Python | utils/__init__.py | nmiles2718/PACMan_dist | 62f495f8d506919146a16750072a523aaafb3c53 | [
"MIT"
] | null | null | null | utils/__init__.py | nmiles2718/PACMan_dist | 62f495f8d506919146a16750072a523aaafb3c53 | [
"MIT"
] | null | null | null | utils/__init__.py | nmiles2718/PACMan_dist | 62f495f8d506919146a16750072a523aaafb3c53 | [
"MIT"
] | null | null | null | __all__ = ['adscrawl','classifier','proposal_scraper','tokenizer']
| 33.5 | 66 | 0.746269 | 6 | 67 | 7.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044776 | 67 | 1 | 67 | 67 | 0.703125 | 0 | 0 | 0 | 0 | 0 | 0.641791 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e11219500f3a77d987fc996a7f655f087cd6b164 | 368 | py | Python | sheetsite/csv_spreadsheet.py | paulfitz/sheetsite | 3ec3226a3d7e9cce7e92e5bcae96acf4d970ab0e | [
"MIT"
] | 33 | 2016-01-17T15:32:56.000Z | 2020-11-30T01:49:32.000Z | sheetsite/csv_spreadsheet.py | paulfitz/sheetsite | 3ec3226a3d7e9cce7e92e5bcae96acf4d970ab0e | [
"MIT"
] | null | null | null | sheetsite/csv_spreadsheet.py | paulfitz/sheetsite | 3ec3226a3d7e9cce7e92e5bcae96acf4d970ab0e | [
"MIT"
] | 3 | 2018-10-30T08:32:28.000Z | 2020-11-30T02:03:22.000Z | import csv
class CsvSpreadsheet(object):
def __init__(self, filename):
with open(filename, 'r') as fin:
reader = csv.reader(fin)
self.data = [row for row in reader]
def worksheets(self):
return [self]
def get_all_values(self):
return self.data
@property
def title(self):
return "sheet"
| 18.4 | 47 | 0.584239 | 45 | 368 | 4.644444 | 0.6 | 0.143541 | 0.133971 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.317935 | 368 | 19 | 48 | 19.368421 | 0.832669 | 0 | 0 | 0 | 0 | 0 | 0.016304 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.076923 | 0.230769 | 0.692308 | 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 |
01046774ad47642a1c88158ae89b46721785ad04 | 1,742 | py | Python | app/db/models.py | SiriusKoan/shorten-url-with-kv | 55d108a263441cc17dbec2ce3c8419b4b4ea111d | [
"MIT"
] | 3 | 2022-02-16T09:11:39.000Z | 2022-03-25T06:07:34.000Z | app/db/models.py | SiriusKoan/shorten-url-with-kv | 55d108a263441cc17dbec2ce3c8419b4b4ea111d | [
"MIT"
] | null | null | null | app/db/models.py | SiriusKoan/shorten-url-with-kv | 55d108a263441cc17dbec2ce3c8419b4b4ea111d | [
"MIT"
] | null | null | null | import datetime
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
db = SQLAlchemy()
class Users(db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String, unique=True, nullable=False)
password = db.Column(db.String, nullable=False)
email = db.Column(db.String, unique=True, nullable=False)
is_admin = db.Column(db.Boolean, nullable=False, default=False)
verify_code = db.Column(db.String, unique=True, nullable=True) # for futurn use
api_key = db.Column(db.String, unique=True)
urls = db.relationship("urls")
register_time = db.Column(
db.DateTime, default=datetime.datetime.now, nullable=False
)
def __init__(self, username, password, email, is_admin=False) -> None:
self.username = username
self.password = generate_password_hash(password)
self.email = email
self.is_admin = is_admin
def check_password(self, password):
return check_password_hash(self.password, password)
class urls(db.Model):
__tablename__ = "urls"
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=False)
old = db.Column(db.String, nullable=False)
new = db.Column(db.String, nullable=False, unique=True)
use = db.Column(db.Integer, nullable=False, default=0)
create_by = db.Column(db.String, nullable=False, default="web") # web or api
created_time = db.Column(db.DateTime, default=datetime.datetime.now, nullable=False)
def __init__(self, user_id, old, new) -> None:
self.user_id = user_id
self.old = old
self.new = new
| 37.869565 | 88 | 0.699196 | 239 | 1,742 | 4.924686 | 0.242678 | 0.101954 | 0.127443 | 0.108751 | 0.410365 | 0.394223 | 0.273577 | 0.24469 | 0.122345 | 0.122345 | 0 | 0.000703 | 0.183123 | 1,742 | 45 | 89 | 38.711111 | 0.826423 | 0.014351 | 0 | 0.054054 | 1 | 0 | 0.014002 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.081081 | false | 0.162162 | 0.081081 | 0.027027 | 0.72973 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
0125e2e369cc19aee09872fba753c013571e48ed | 2,383 | py | Python | gui/model/timer_model.py | GGelatin/TekkenBot | 33e9a319a085aa17f355dc6f470dfb15e15020cd | [
"MIT"
] | 45 | 2019-06-14T00:29:35.000Z | 2022-01-13T15:52:35.000Z | gui/model/timer_model.py | GGelatin/TekkenBot | 33e9a319a085aa17f355dc6f470dfb15e15020cd | [
"MIT"
] | 16 | 2019-07-19T09:06:15.000Z | 2021-04-08T11:29:58.000Z | gui/model/timer_model.py | GGelatin/TekkenBot | 33e9a319a085aa17f355dc6f470dfb15e15020cd | [
"MIT"
] | 10 | 2019-06-14T23:30:26.000Z | 2021-08-23T17:13:03.000Z | #!/usr/bin/env python3
# Copyright (c) 2019, Alchemy Meister
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice,this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
"""
"""
from constants.battle.timer import BattleTime
class TimerModel():
"""
"""
def __init__(self):
self.all_time_limit_dict = {}
for char_enum in BattleTime:
if char_enum.printable_name is not None:
self.all_time_limit_dict[char_enum.value] = (
char_enum.printable_name
)
def timer_name_to_index(self, timer_name):
return list(self.all_time_limit_dict.values()).index(timer_name)
def timer_index_to_printable_enum(self, timer_index):
return BattleTime(list(self.all_time_limit_dict.keys())[timer_index])
@staticmethod
def get_default_time_limit():
return BattleTime.SIXTY
@staticmethod
def get_time_limit_enum():
return BattleTime
| 40.389831 | 78 | 0.730592 | 323 | 2,383 | 5.26935 | 0.47678 | 0.031727 | 0.025852 | 0.037603 | 0.159812 | 0.108108 | 0.079906 | 0.079906 | 0.079906 | 0.079906 | 0 | 0.002653 | 0.20898 | 2,383 | 58 | 79 | 41.086207 | 0.900265 | 0.645825 | 0 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0.052632 | 0.210526 | 0.578947 | 0.157895 | 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 |
014ddcdc52e65599bfaae00da8c842d3e3099abb | 193 | py | Python | f5cli/config/__init__.py | f5devcentral/f5-cli | 22a5c6902e3f78a969a86116a73fcad817f220be | [
"Apache-2.0"
] | 13 | 2020-03-06T22:35:47.000Z | 2021-06-28T23:08:46.000Z | f5cli/config/__init__.py | f5devcentral/f5-cli | 22a5c6902e3f78a969a86116a73fcad817f220be | [
"Apache-2.0"
] | 19 | 2020-03-11T15:14:06.000Z | 2022-01-26T23:56:56.000Z | f5cli/config/__init__.py | f5devcentral/f5-cli | 22a5c6902e3f78a969a86116a73fcad817f220be | [
"Apache-2.0"
] | 1 | 2020-03-24T13:29:30.000Z | 2020-03-24T13:29:30.000Z | """Configuration module for the CLI """
from .core import ConfigurationClient
from .auth import AuthConfigurationClient
__all__ = [
'AuthConfigurationClient',
'ConfigurationClient'
]
| 19.3 | 41 | 0.761658 | 16 | 193 | 8.9375 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15544 | 193 | 9 | 42 | 21.444444 | 0.877301 | 0.165803 | 0 | 0 | 0 | 0 | 0.272727 | 0.149351 | 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 |
015c755a8da8d75aa266e30bba76d209ad102249 | 465 | py | Python | Exercicios/ex029.py | sleepinhoo/Python | d8ac7f3297f3a99b27b07d7341a16503a64124b0 | [
"MIT"
] | null | null | null | Exercicios/ex029.py | sleepinhoo/Python | d8ac7f3297f3a99b27b07d7341a16503a64124b0 | [
"MIT"
] | null | null | null | Exercicios/ex029.py | sleepinhoo/Python | d8ac7f3297f3a99b27b07d7341a16503a64124b0 | [
"MIT"
] | null | null | null | # aplicador de multa
# kilometragem: 80km
# valor por kilomretro excedido: 7.00
print("OPA meu jovem, cuidado com a velocidade!")
km = float(input("Ovo ter que conferir se vc passou da velocidade, me informe o a kilometragem por favor: "))
vl = km - 80.0
if vl < 1.0 :
print("Tá limpo meu rei, pode passar.")
else :
mt = vl * 7
print("Tá correndo mermão?")
print(f"Ovo ter que te aplicar uma multa de R${mt}")
print("End of transmission...") | 27.352941 | 109 | 0.666667 | 77 | 465 | 4.025974 | 0.727273 | 0.03871 | 0.058065 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030137 | 0.215054 | 465 | 17 | 110 | 27.352941 | 0.819178 | 0.156989 | 0 | 0 | 0 | 0 | 0.619537 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 0 | 0 | 0 | 0.5 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 3 |
01743a4f1ff1a8cc638bbb40ce399fd2b90050bb | 563 | py | Python | keynet/version.py | visym/keynet | 7e3aeb0fd35955ef7ca7499170a337f261655f6e | [
"MIT"
] | 13 | 2020-09-14T22:33:00.000Z | 2021-12-06T01:34:17.000Z | keynet/version.py | visym/keynet | 7e3aeb0fd35955ef7ca7499170a337f261655f6e | [
"MIT"
] | 3 | 2020-10-22T23:37:47.000Z | 2020-11-20T00:36:51.000Z | keynet/version.py | visym/keynet | 7e3aeb0fd35955ef7ca7499170a337f261655f6e | [
"MIT"
] | 4 | 2020-09-15T01:13:30.000Z | 2021-11-26T05:04:22.000Z | MAJOR = 0
MINOR = 2
RELEASE = 4
VERSION = '%d.%d.%d' % (MAJOR, MINOR, RELEASE)
def at_least_version(versionstring):
"""Is versionstring='X.Y.Z' at least the current version?"""
(major, minor, release) = versionstring.split('.')
return at_least_major_version(major) and at_least_minor_version(minor) and at_least_release_version(release)
def at_least_major_version(major):
return MAJOR >= int(major)
def at_least_minor_version(minor):
return MINOR >= int(minor)
def at_least_release_version(release):
return RELEASE >= int(release)
| 24.478261 | 112 | 0.724689 | 81 | 563 | 4.790123 | 0.271605 | 0.14433 | 0.103093 | 0.087629 | 0.391753 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006289 | 0.152753 | 563 | 22 | 113 | 25.590909 | 0.807128 | 0.095915 | 0 | 0 | 0 | 0 | 0.017893 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0 | 0.230769 | 0.615385 | 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 |
01876fa0573f177a3d46f8f8cfdd8a019695d623 | 545 | py | Python | test/test-356-getei.py | Cam2337/snap-python | 0bf722b461f8b5aae3ecb2757313521e9e9e76f1 | [
"BSD-3-Clause"
] | 242 | 2015-01-01T08:40:28.000Z | 2022-03-18T05:22:09.000Z | test/test-356-getei.py | Cam2337/snap-python | 0bf722b461f8b5aae3ecb2757313521e9e9e76f1 | [
"BSD-3-Clause"
] | 99 | 2015-01-24T07:55:27.000Z | 2021-10-30T18:20:13.000Z | test/test-356-getei.py | Cam2337/snap-python | 0bf722b461f8b5aae3ecb2757313521e9e9e76f1 | [
"BSD-3-Clause"
] | 105 | 2015-03-03T06:45:17.000Z | 2022-02-24T15:52:40.000Z | import snap
Graph = snap.GenFull(snap.PNEANet, 10)
Src = 1
Dst = 2
EI = Graph.GetEI(Src,Dst)
EId = EI.GetId()
print(EId, Graph.GetEI(Src,Dst).GetId())
print(Graph.GetEI(Src,Dst).GetSrcNId(), Graph.GetEI(Src,Dst).GetDstNId())
print(Graph.GetEI(EId).GetSrcNId(), Graph.GetEI(EId).GetDstNId())
if EId != Graph.GetEI(Src,Dst).GetId():
print("*** error1")
if Graph.GetEI(Src,Dst).GetSrcNId() != Graph.GetEI(EId).GetSrcNId():
print("*** error2")
if Graph.GetEI(Src,Dst).GetDstNId() != Graph.GetEI(EId).GetDstNId():
print("*** error3")
| 27.25 | 73 | 0.669725 | 80 | 545 | 4.5625 | 0.2625 | 0.30137 | 0.249315 | 0.306849 | 0.471233 | 0.350685 | 0.350685 | 0 | 0 | 0 | 0 | 0.014374 | 0.106422 | 545 | 19 | 74 | 28.684211 | 0.735113 | 0 | 0 | 0 | 0 | 0 | 0.055147 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.066667 | 0.4 | 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 |
6d74cd7d729bf7312befefd8847a8cfbfaed3064 | 5,247 | py | Python | kiestze_django/kiestze_django/settings.py | oSoc18/kiest_ze | 842eefcf3f6002ea90c2917682f625749398b33e | [
"Apache-2.0"
] | 3 | 2018-07-11T07:59:15.000Z | 2018-07-26T19:58:44.000Z | kiestze_django/kiestze_django/settings.py | oSoc18/kiest_ze | 842eefcf3f6002ea90c2917682f625749398b33e | [
"Apache-2.0"
] | 4 | 2018-08-11T13:55:50.000Z | 2019-12-28T15:41:30.000Z | kiestze_django/kiestze_django/settings.py | oSoc18/kiest_ze | 842eefcf3f6002ea90c2917682f625749398b33e | [
"Apache-2.0"
] | null | null | null | """
Django settings for kiestze_django project.
Generated by 'django-admin startproject' using Django 2.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
from . import secret
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
# SECRET_KEY = 'chl$i$@d!z&hw)^9h1*h4tz9j$_-*!o097o_m+g*%^^91hu-z)'
SECRET_KEY = secret.key
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = secret.DEBUG
ALLOWED_HOSTS = ['.kiestze.be', '192.81.221.154', 'localhost', '127.0.0.1']
#INTERNAL_IPS = ['127.0.0.1'] # "The Debug Toolbar is shown only if your IP is listed in the INTERNAL_IPS setting"
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites', #allauth
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.postgres',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.github',
'allauth.socialaccount.providers.gitlab',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.twitter',
'corsheaders',
#'debug_toolbar',
'kiestze',
]
SITE_ID = 1 # Required by allauth, no idea why
if not DEBUG:
os.environ['HTTPS'] = 'on' # Allauth/nginx SSL sorcery
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'HTTPS'
LOGIN_REDIRECT_URL = '/lijst'
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
# 'django.middleware.gzip.GZipMiddleware',
# You should include the Debug Toolbar middleware as early as possible in the list.
# However, it must come after any other middleware that encodes
# the response’s content, such as GZipMiddleware.
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
# CORS for easier debugging.
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = False
#CORS_ORIGIN_WHITELIST = (
# 'localhost:3030',
#)
CORS_ORIGIN_REGEX_WHITELIST = (
'localhost:[0-9]+',
'127.0.0.1:[0-9]+',
)
ROOT_URLCONF = 'kiestze_django.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
],
},
},
]
WSGI_APPLICATION = 'kiestze_django.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'kiestze',
'USER': secret.psql_user,
'PASSWORD': secret.psql_password,
'HOST': 'localhost',
'PORT': '',
}
}
# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Europe/Brussels'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
STATIC_URL = '/static/'
# hack, so that server and dev machinse don't have to change code.
if not DEBUG:
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
else:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
) | 28.058824 | 114 | 0.69697 | 608 | 5,247 | 5.907895 | 0.419408 | 0.065145 | 0.037862 | 0.048719 | 0.165367 | 0.130568 | 0.074332 | 0.074332 | 0.033408 | 0 | 0 | 0.016367 | 0.173242 | 5,247 | 187 | 115 | 28.058824 | 0.811664 | 0.345721 | 0 | 0.038095 | 1 | 0 | 0.522995 | 0.412736 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.057143 | 0.019048 | 0 | 0.019048 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6d798a21298a9977957ca10bb0ace9062bf94b5a | 96 | py | Python | clans_cells/apps.py | Red-Teapot/bbyaworld.com-django | 6eb8febd2cfa304a062ac924240cbdf060499cfc | [
"MIT"
] | 1 | 2020-01-11T18:04:15.000Z | 2020-01-11T18:04:15.000Z | clans_cells/apps.py | Red-Teapot/bbyaworld.com-django | 6eb8febd2cfa304a062ac924240cbdf060499cfc | [
"MIT"
] | 2 | 2018-08-24T08:53:27.000Z | 2019-07-05T16:08:28.000Z | clans_cells/apps.py | Red-Teapot/bbyaworld.com-django | 6eb8febd2cfa304a062ac924240cbdf060499cfc | [
"MIT"
] | 1 | 2018-11-22T16:19:52.000Z | 2018-11-22T16:19:52.000Z | from django.apps import AppConfig
class ClansCellsConfig(AppConfig):
name = 'clans_cells'
| 16 | 34 | 0.770833 | 11 | 96 | 6.636364 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15625 | 96 | 5 | 35 | 19.2 | 0.901235 | 0 | 0 | 0 | 0 | 0 | 0.114583 | 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 |
6dabff58ec29960f0a431a615d286843296c47d5 | 381 | py | Python | Lists/Join.py | obareau/python_travaux_pratiques | 2205f4c253e96e409b56f5c23d6e23387ab46524 | [
"MIT"
] | 1 | 2021-11-01T12:45:50.000Z | 2021-11-01T12:45:50.000Z | Lists/Join.py | obareau/python_travaux_pratiques | 2205f4c253e96e409b56f5c23d6e23387ab46524 | [
"MIT"
] | null | null | null | Lists/Join.py | obareau/python_travaux_pratiques | 2205f4c253e96e409b56f5c23d6e23387ab46524 | [
"MIT"
] | null | null | null | fields = ["one", "two", "three", "four", "five", "six"]
together = ":".join(fields)
print(together) # one:two:three:four:five:six
together = ':'.join(fields)
print(together) # one:two and three:four:five:six
mixed = ' -=<> '.join(fields)
print(mixed) # one -=<> two and three -=<> four -=<> five -=<> six
another = ''.join(fields)
print(another) # onetwo and threefourfivesix
| 25.4 | 66 | 0.632546 | 50 | 381 | 4.82 | 0.3 | 0.099585 | 0.215768 | 0.26556 | 0.647303 | 0.647303 | 0.647303 | 0.46473 | 0.46473 | 0.46473 | 0 | 0 | 0.139108 | 381 | 14 | 67 | 27.214286 | 0.734756 | 0.364829 | 0 | 0.222222 | 0 | 0 | 0.127119 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.444444 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
6db45fac3197ccd9e4edcb5d82136ad96bd61a4e | 379 | py | Python | example/vm-flow.py | cloudmesh/cloudmesh-flow | aa0c00034c2947b8f41d726c5926cdcb068ce54a | [
"Apache-2.0"
] | 1 | 2019-05-07T13:20:33.000Z | 2019-05-07T13:20:33.000Z | example/vm-flow.py | cloudmesh/cloudmesh-flow | aa0c00034c2947b8f41d726c5926cdcb068ce54a | [
"Apache-2.0"
] | 29 | 2019-04-25T18:04:25.000Z | 2022-03-25T18:41:44.000Z | example/vm-flow.py | cloudmesh/cloudmesh-flow | aa0c00034c2947b8f41d726c5926cdcb068ce54a | [
"Apache-2.0"
] | 1 | 2020-03-23T03:00:51.000Z | 2020-03-23T03:00:51.000Z | from cloudmesh.compute.aws import Provider as AWSProvider
from cloudmesh.compute.azure import AzProvider
from cloudmesh.flow.Flow import Flow
class MyFlow(Flow):
def spawn_aws(self):
pass
def spawn_azure(self):
pass
def ping_aws(self):
pass
def ping_azure(self):
pass
if __name__ == "__main__":
flow = MyFlow(sys.argv[0])
| 18.95 | 57 | 0.672823 | 51 | 379 | 4.764706 | 0.470588 | 0.131687 | 0.135802 | 0.115226 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003484 | 0.242744 | 379 | 19 | 58 | 19.947368 | 0.843206 | 0 | 0 | 0.285714 | 0 | 0 | 0.021108 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.285714 | 0.214286 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
6db815c82ce284f518d74c579ccfc98817fa5adf | 547 | py | Python | hubcheck/pageobjects/po_supportneedhelp.py | codedsk/hubcheck | 2ff506eb56ba00f035300862f8848e4168452a17 | [
"MIT"
] | 1 | 2016-02-13T13:42:23.000Z | 2016-02-13T13:42:23.000Z | hubcheck/pageobjects/po_supportneedhelp.py | codedsk/hubcheck | 2ff506eb56ba00f035300862f8848e4168452a17 | [
"MIT"
] | null | null | null | hubcheck/pageobjects/po_supportneedhelp.py | codedsk/hubcheck | 2ff506eb56ba00f035300862f8848e4168452a17 | [
"MIT"
] | null | null | null | from hubcheck.pageobjects.po_generic_page import GenericPage
class SupportNeedHelpPage(GenericPage):
"""Support Need Help page object"""
def __init__(self,browser,catalog):
super(SupportNeedHelpPage,self).__init__(browser,catalog)
def open(self):
return self.needhelplink.click()
def close(self):
return self.needhelpform.close.click()
def submit_ticket(self,data):
return self.needhelpform.submit_ticket(data)
def goto_ticket(self):
return self.needhelpform.goto_ticket()
| 22.791667 | 65 | 0.71298 | 62 | 547 | 6.064516 | 0.483871 | 0.106383 | 0.111702 | 0.138298 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190128 | 547 | 23 | 66 | 23.782609 | 0.848758 | 0.053016 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0 | 0.083333 | 0.333333 | 0.916667 | 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 |
6dc73c98b00834eaebba6c9a356185b0f7a60b23 | 199 | py | Python | recipes/Python/577069_Access_grep_from_python/recipe-577069.py | tdiprima/code | 61a74f5f93da087d27c70b2efe779ac6bd2a3b4f | [
"MIT"
] | 2,023 | 2017-07-29T09:34:46.000Z | 2022-03-24T08:00:45.000Z | recipes/Python/577069_Access_grep_from_python/recipe-577069.py | unhacker/code | 73b09edc1b9850c557a79296655f140ce5e853db | [
"MIT"
] | 32 | 2017-09-02T17:20:08.000Z | 2022-02-11T17:49:37.000Z | recipes/Python/577069_Access_grep_from_python/recipe-577069.py | unhacker/code | 73b09edc1b9850c557a79296655f140ce5e853db | [
"MIT"
] | 780 | 2017-07-28T19:23:28.000Z | 2022-03-25T20:39:41.000Z | import subprocess
def grep(filename, arg):
process = subprocess.Popen(['grep', '-n', arg, filename], stdout=subprocess.PIPE)
stdout, stderr = process.communicate()
return stdout, stderr
| 28.428571 | 85 | 0.703518 | 23 | 199 | 6.086957 | 0.608696 | 0.171429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160804 | 199 | 6 | 86 | 33.166667 | 0.838323 | 0 | 0 | 0 | 0 | 0 | 0.030151 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6ddeaba734ea098a5ef82e061815b81b851e3b71 | 180 | py | Python | Utils/obfuscate.py | Xiloe/kino | 1e6455e9e939d6a46bd06431c76b044f2dad5fa2 | [
"MIT"
] | null | null | null | Utils/obfuscate.py | Xiloe/kino | 1e6455e9e939d6a46bd06431c76b044f2dad5fa2 | [
"MIT"
] | null | null | null | Utils/obfuscate.py | Xiloe/kino | 1e6455e9e939d6a46bd06431c76b044f2dad5fa2 | [
"MIT"
] | null | null | null | def obfuscate(utils_path, project_path):
import subprocess
print('Running obfuscator ...')
subprocess.run(f'{utils_path}/confuser/Confuser.CLI.exe {project_path} -n')
| 30 | 79 | 0.727778 | 23 | 180 | 5.521739 | 0.695652 | 0.141732 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 180 | 5 | 80 | 36 | 0.814103 | 0 | 0 | 0 | 0 | 0 | 0.433333 | 0.211111 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6de195436fc11dd6547bde73a1d3f7a62f56ff6e | 130 | py | Python | backend/gunicorn.conf.py | WhitePrime/tabby-web | 156341173a42de346b1785602961da40d77a3c66 | [
"MIT"
] | 91 | 2021-11-01T06:02:15.000Z | 2022-03-31T16:02:37.000Z | backend/gunicorn.conf.py | WhitePrime/tabby-web | 156341173a42de346b1785602961da40d77a3c66 | [
"MIT"
] | 23 | 2021-11-14T17:10:01.000Z | 2022-03-28T21:40:25.000Z | backend/gunicorn.conf.py | WhitePrime/tabby-web | 156341173a42de346b1785602961da40d77a3c66 | [
"MIT"
] | 12 | 2021-12-02T02:25:04.000Z | 2022-03-19T11:48:03.000Z | wsgi_app = "tabby.wsgi:application"
workers = 4
preload_app = True
sendfile = True
max_requests = 1000
max_requests_jitter = 100
| 16.25 | 35 | 0.776923 | 19 | 130 | 5.052632 | 0.736842 | 0.229167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072072 | 0.146154 | 130 | 7 | 36 | 18.571429 | 0.792793 | 0 | 0 | 0 | 0 | 0 | 0.169231 | 0.169231 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6df227204659db596dad114617a6c04d3ccdff66 | 221 | py | Python | tests/errors/semantic/non_blocking/PYCCEL_RESTRICTION_LIST_COMPREHENSION_LIMITS.py | dina-fouad/pyccel | f4d919e673b400442b9c7b81212b6fbef749c7b7 | [
"MIT"
] | 206 | 2018-06-28T00:28:47.000Z | 2022-03-29T05:17:03.000Z | tests/errors/semantic/non_blocking/PYCCEL_RESTRICTION_LIST_COMPREHENSION_LIMITS.py | dina-fouad/pyccel | f4d919e673b400442b9c7b81212b6fbef749c7b7 | [
"MIT"
] | 670 | 2018-07-23T11:02:24.000Z | 2022-03-30T07:28:05.000Z | tests/errors/semantic/non_blocking/PYCCEL_RESTRICTION_LIST_COMPREHENSION_LIMITS.py | dina-fouad/pyccel | f4d919e673b400442b9c7b81212b6fbef749c7b7 | [
"MIT"
] | 19 | 2019-09-19T06:01:00.000Z | 2022-03-29T05:17:06.000Z | # pylint: disable=missing-function-docstring, missing-module-docstring/
a = [i*j for i in range(1,3) for j in range(1,4) for k in range(i,j)]
n = 5
a = [i*j for i in range(1,n) for j in range(1,4) for k in range(i,j)]
| 27.625 | 71 | 0.656109 | 52 | 221 | 2.788462 | 0.346154 | 0.289655 | 0.22069 | 0.082759 | 0.565517 | 0.565517 | 0.565517 | 0.565517 | 0.358621 | 0.358621 | 0 | 0.044199 | 0.180995 | 221 | 7 | 72 | 31.571429 | 0.756906 | 0.312217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a308e76229184992c1e116730b45f892f73e2b32 | 3,567 | py | Python | speakerbot/speaker_db_plugins/speakerbot_reports.py | akatrevorjay/speakerbot | a210d27a2752c5424924b02e917a46a7beb31edc | [
"MIT"
] | 2 | 2015-02-17T03:29:09.000Z | 2015-05-06T16:41:08.000Z | speakerbot/speaker_db_plugins/speakerbot_reports.py | akatrevorjay/speakerbot | a210d27a2752c5424924b02e917a46a7beb31edc | [
"MIT"
] | 2 | 2016-06-24T13:03:41.000Z | 2018-04-02T19:59:19.000Z | speakerbot/speaker_db_plugins/speakerbot_reports.py | akatrevorjay/speakerbot | a210d27a2752c5424924b02e917a46a7beb31edc | [
"MIT"
] | 4 | 2015-02-13T19:01:17.000Z | 2018-08-31T18:33:52.000Z |
def get_lucky_numbers(self):
return self.execute("select lucky_number, count(lucky_number) as occurences, sum(case when outcome < 1 then 1 else 0 end) as negative_outcomes, sum(case when outcome > 1 then 1 else 0 end) as successful_outcomes from wager_history where lucky_number <> 0 group by lucky_number")
def get_number_occurence(self):
return self.execute("select chosen_number, count(chosen_number) as occurences, sum(case when outcome < 1 then 1 else 0 end) as negative_outcomes, sum(case when outcome > 1 then 1 else 0 end) as successful_outcomes from wager_history group by chosen_number")
def get_multiplier_occurence(self):
return self.execute("select win_multiplier, count(win_multiplier) as occurences, sum(case when outcome < 1 then 1 else 0 end) as negative_outcomes, sum(case when outcome > 1 then 1 else 0 end) as successful_outcomes from wager_history group by win_multiplier")
def get_wagers_and_outcomes_by_day(self, limit=30):
return self.execute("select date(wager_time, 'unixepoch') as wager_date, case when sum(wager) > 100000 then 100000 else sum(wager) end as amount_wagered, case when sum(outcome) > 100000 then 100000 when sum(outcome) < -100000 then -100000 else sum(outcome) end as outcome from wager_history group by date(wager_time, 'unixepoch') limit ?", [limit])
def get_wagers_by_outcome(self, limit=15):
return self.execute("select wager, sum(case when outcome > 1 then 1 else 0 end) as successful_outcomes, sum(case when outcome < 1 then 1 else 0 end) as negative_outcomes from wager_history group by wager order by count(wager) desc limit ?", [limit])
def get_lucky_and_chosen_cooccurence(self):
return self.execute("select lucky.number, lucky.lucky_numero, chosen.chosen_numero, case when coc.cooccurrence is null then 0 else coc.cooccurrence end as cooccurence from (select chosen_number as number, count(chosen_number) as chosen_numero, null as lucky_number from wager_history group by chosen_number) chosen inner join (select lucky_number as number, null as chosen_number, count(lucky_number) as lucky_numero from wager_history group by lucky_number) lucky on lucky.number=chosen.number left join (select lucky_number as number, count(*) as cooccurrence from wager_history where lucky_number = chosen_number group by number) coc on lucky.number=coc.number")
def get_aggregate_wager_stats(self, start=0, end=4000000000):
results = self.execute("""
SELECT
count(*) as spins,
AVG(wager) as avg_wgr,
AVG(outcome) as avg_out,
MAX(wager) as max_wgr,
SUM(wager) as ttl_wgr,
SUM(outcome) as net_win,
AVG(win_multiplier) as avg_multi,
SUM(cheated_death) as cheat_death
FROM
wager_history
where wager_time > ? and wager_time < ?
""", [start, end])
try:
results = results.next()
results["avg_out"] = int(round(results["avg_out"]))
results["avg_wgr"] = int(round(results["avg_wgr"]))
results["avg_multi"] = int(round(results["avg_multi"]))
results["roi"] = str(int(round(results["avg_out"] / results["avg_wgr"], 2) * 100)) + "%"
except:
results = None
pass
return results
def get_wager_history(self, limit=50):
return self.execute ("select datetime(wager_time, 'unixepoch') as time, lucky_number, wager, outcome, chosen_number, win_multiplier, cheated_death from wager_history order by wager_time desc LIMIT ?", [limit]) | 66.055556 | 669 | 0.716849 | 531 | 3,567 | 4.636535 | 0.163842 | 0.062551 | 0.064988 | 0.058489 | 0.455727 | 0.393989 | 0.287977 | 0.238018 | 0.210398 | 0.210398 | 0 | 0.02894 | 0.195963 | 3,567 | 54 | 670 | 66.055556 | 0.829498 | 0 | 0 | 0 | 0 | 0.179487 | 0.732754 | 0.025519 | 0 | 0 | 0 | 0 | 0 | 1 | 0.205128 | false | 0.025641 | 0 | 0.179487 | 0.410256 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
097d200d834e9033d30730f307403bf1a66ec4c7 | 791 | py | Python | backend/django_app/core/api/views/__init__.py | bekurmann/BA_polity | 933c9df9d935066cc498c5da8e1e0f68742f6ee5 | [
"MIT"
] | null | null | null | backend/django_app/core/api/views/__init__.py | bekurmann/BA_polity | 933c9df9d935066cc498c5da8e1e0f68742f6ee5 | [
"MIT"
] | null | null | null | backend/django_app/core/api/views/__init__.py | bekurmann/BA_polity | 933c9df9d935066cc498c5da8e1e0f68742f6ee5 | [
"MIT"
] | null | null | null | from .politican import PoliticanViewSet
# from .party import
from .parlament import ParlamentViewSet
from .commission import CommissionViewSet
from .fraction import FractionViewSet
from .affair import (AffairAllViewSet, AffairViewSet, AffairDebateViewSet, AffairFileViewSet )
from .session import SessionViewSet
from .membership import ParlamentMembershipViewSet, PoliticanMembershipViewSet, CommissionMembershipViewSet
from .analysis import ( AnalysisParlamentAffairsPerYearOW, AnalysisParlamentAffairsTypesOW,
AnalysisParlamentAffairTypesPerYearOW, AnalysisParlamentInterpellationOW,
AnalysisParlamentPostulateOW, AnalysisParlamentMotionOW,
AnalysisJupyterPolitican, AnalysisJupyterAffair,
) | 60.846154 | 107 | 0.778761 | 47 | 791 | 13.106383 | 0.659574 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187105 | 791 | 13 | 108 | 60.846154 | 0.958009 | 0.022756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
09a440ea81889592be59bc0be057ee6338e5b6c0 | 266 | py | Python | src/githubnavigator/__main__.py | rmk135/github-navigator-application | 58458ff23cf3c05dffb16a3188ea2777b482eb79 | [
"MIT"
] | 5 | 2018-02-26T12:25:18.000Z | 2019-01-17T15:08:23.000Z | src/githubnavigator/__main__.py | rmk135/github-navigator-application | 58458ff23cf3c05dffb16a3188ea2777b482eb79 | [
"MIT"
] | 2 | 2020-07-08T21:09:58.000Z | 2020-07-08T21:10:09.000Z | src/githubnavigator/__main__.py | rmk135/github-navigator-application | 58458ff23cf3c05dffb16a3188ea2777b482eb79 | [
"MIT"
] | 1 | 2019-02-27T06:57:58.000Z | 2019-02-27T06:57:58.000Z | """Application main module."""
from .application import Application
def main() -> None:
"""Run application."""
application = Application()
application.config.from_yaml('config/config.yml')
application.run()
if __name__ == '__main__':
main()
| 17.733333 | 53 | 0.665414 | 27 | 266 | 6.222222 | 0.481481 | 0.392857 | 0.392857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180451 | 266 | 14 | 54 | 19 | 0.770642 | 0.154135 | 0 | 0 | 0 | 0 | 0.116822 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.285714 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
09b45c8df049d4673ec31c2a417f1cc09bd98c93 | 3,446 | py | Python | k1lib/callbacks/shorts.py | 157239n/k1lib | 285520b8364ad5b21cb736b44471aa939e692e9b | [
"MIT"
] | 1 | 2021-08-11T19:10:08.000Z | 2021-08-11T19:10:08.000Z | k1lib/callbacks/shorts.py | 157239n/k1lib | 285520b8364ad5b21cb736b44471aa939e692e9b | [
"MIT"
] | null | null | null | k1lib/callbacks/shorts.py | 157239n/k1lib | 285520b8364ad5b21cb736b44471aa939e692e9b | [
"MIT"
] | null | null | null | # AUTOGENERATED FILE! PLEASE DON'T EDIT
from .callbacks import Callback, Callbacks, Cbs
import k1lib, os, torch
__all__ = ["Autosave", "DontTrainValid", "InspectLoss", "ModifyLoss", "Cpu", "Cuda",
"DType", "InspectBatch", "ModifyBatch", "InspectOutput", "ModifyOutput",
"Beep"]
@k1lib.patch(Cbs)
class Autosave(Callback):
"""Autosaves 3 versions of the network to disk"""
def __init__(self): super().__init__(); self.order = 23
def endRun(self):
os.system("mv autosave-1.pth autosave-0.pth")
os.system("mv autosave-2.pth autosave-1.pth")
self.l.save("autosave-2.pth")
@k1lib.patch(Cbs)
class DontTrainValid(Callback):
"""If is not training, then don't run m.backward() and opt.step().
The core training loop in k1lib.Learner don't specifically do this,
cause there may be some weird cases where you want to also train valid."""
def _common(self):
if not self.l.model.training: return True
def startBackward(self): return self._common()
def startStep(self): return self._common()
@k1lib.patch(Cbs)
class InspectLoss(Callback):
"""Expected `f` to take in 1 float."""
def __init__(self, f): super().__init__(); self.f = f; self.order = 15
def endLoss(self): self.f(self.loss.detach())
@k1lib.patch(Cbs)
class ModifyLoss(Callback):
"""Expected `f` to take in 1 float and return 1 float."""
def __init__(self, f): super().__init__(); self.f = f; self.order = 13
def endLoss(self): self.l.loss = self.f(self.loss)
@k1lib.patch(Cbs)
class Cuda(Callback):
"""Moves batch and model to the default GPU"""
def startRun(self): self.l.model.cuda()
def startBatch(self):
self.l.xb = self.l.xb.cuda()
self.l.yb = self.l.yb.cuda()
@k1lib.patch(Cbs)
class Cpu(Callback):
"""Moves batch and model to CPU"""
def startRun(self): self.l.model.cpu()
def startBatch(self):
self.l.xb = self.l.xb.cpu()
self.l.yb = self.l.yb.cpu()
@k1lib.patch(Cbs)
class DType(Callback):
"""Moves batch and model to a specified data type"""
def __init__(self, dtype): super().__init__(); self.dtype = dtype
def startRun(self): self.l.model = self.l.model.to(self.dtype)
def startBatch(self):
self.l.xb = self.l.xb.to(self.dtype)
self.l.yb = self.l.yb.to(self.dtype)
@k1lib.patch(Cbs)
class InspectBatch(Callback):
"""Expected `f` to take in 2 tensors."""
def __init__(self, f:callable): super().__init__(); self.f = f; self.order = 15
def startBatch(self): self.f(self.l.xb, self.l.yb)
@k1lib.patch(Cbs)
class ModifyBatch(Callback):
"""Modifies xb and yb on the fly. Expected `f`
to take in 2 tensors and return 2 tensors."""
def __init__(self, f): super().__init__(); self.f = f; self.order = 13
def startBatch(self): self.l.xb, self.l.yb = self.f(self.l.xb, self.l.yb)
@k1lib.patch(Cbs)
class InspectOutput(Callback):
"""Expected `f` to take in 1 tensor."""
def __init__(self, f): super().__init__(); self.f = f; self.order = 15
def endPass(self): self.f(self.y)
@k1lib.patch(Cbs)
class ModifyOutput(Callback):
"""Modifies output on the fly. Expected `f` to take
in 1 tensor and return 1 tensor"""
def __init__(self, f): super().__init__(); self.f = f; self.order = 13
def endPass(self): self.l.y = self.f(self.y)
@k1lib.patch(Cbs)
class Beep(Callback):
"""Plays a beep sound when the run is over"""
def endRun(self): k1lib.beep() | 42.54321 | 84 | 0.658735 | 535 | 3,446 | 4.11028 | 0.229907 | 0.059118 | 0.070941 | 0.098226 | 0.414279 | 0.414279 | 0.309231 | 0.279673 | 0.194179 | 0.138699 | 0 | 0.015581 | 0.180499 | 3,446 | 81 | 85 | 42.54321 | 0.763102 | 0.221997 | 0 | 0.3125 | 1 | 0 | 0.070692 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.390625 | false | 0.03125 | 0.03125 | 0.03125 | 0.609375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
09b86653076f12057c45584575a4e9db8f35f4b1 | 2,720 | py | Python | test_filtering.py | oslaksam/Python-CLI-Image-editor | a3e025c9297b7d4c1305aca2b7f3b6edaa8bcb27 | [
"MIT"
] | null | null | null | test_filtering.py | oslaksam/Python-CLI-Image-editor | a3e025c9297b7d4c1305aca2b7f3b6edaa8bcb27 | [
"MIT"
] | null | null | null | test_filtering.py | oslaksam/Python-CLI-Image-editor | a3e025c9297b7d4c1305aca2b7f3b6edaa8bcb27 | [
"MIT"
] | null | null | null | from numpy.testing import assert_equal
from pytest import fixture
from filtering.filtering import *
@fixture
def image():
return read_image('tests/lenna.png')
@fixture
def image_gaussian_blur():
return read_image('tests/lenna_gaussian_blur.png')
@fixture
def image_gray(image):
return np.average(image.astype(np.float), weights=[0.299, 0.587, 0.114], axis=2).astype(np.uint8)
@fixture
def image_gray_edge_detection():
return read_image('tests/lenna_gray_edge_detection.png')
@fixture
def image_gaussian_blur3():
return read_image('tests/lenna_blur3.png')
@fixture
def image_inverse():
return read_image('tests/lenna_inverse.png')
@fixture
def image_rotate():
return read_image('tests/lenna_rotate.png')
@fixture
def image_lit75():
return read_image('tests/lenna_lit75.png')
@fixture
def image_dark50():
return read_image('tests/lenna_dark50.png')
@fixture
def image_emboss():
return read_image('tests/lenna_emboss.png')
@fixture
def image_sharp():
return read_image('tests/lenna_sharp.png')
@fixture
def image_mirror():
return read_image('tests/lenna_mirror.png')
@fixture
def image_dark50():
return read_image('tests/lenna_dark50.png')
def test_gaussian_blur3(image, image_gaussian_blur3):
assert_equal(apply_filter(image, approx_gaussian_blur_3_kernel), image_gaussian_blur3)
def test_image_inverse(image, image_inverse):
assert_equal(inverse(image), image_inverse)
def test_identity_filter(image):
assert_equal(apply_filter(image, identity_kernel), image)
def test_gaussian_blur(image, image_gaussian_blur):
assert_equal(apply_filter(image, approx_gaussian_blur_5_kernel), image_gaussian_blur)
def test_gray_edge_detection(image_gray, image_gray_edge_detection):
assert_equal(apply_filter(image_gray, edge_detection_kernel), image_gray_edge_detection)
def test_smile(image):
assert_equal(apply_filter(image, identity_kernel), image)
def test_bw(image, image_gray):
assert_equal((bw(image)), image_gray)
def test_darken50(image, image_dark50):
assert_equal((darken(image, 50)), image_dark50)
def test_emboss(image, image_emboss):
assert_equal((apply_filter(image, embossing_kernel)), image_emboss)
def test_lit75(image, image_lit75):
assert_equal((lighten(image, 75)), image_lit75)
def test_mirror(image, image_mirror):
assert_equal((mirror(image)), image_mirror)
def test_rotation(image, image_rotate):
assert_equal((rotate(image)), image_rotate)
def test_sharp(image, image_sharp):
assert_equal((apply_filter(image, sharpening_kernel)), image_sharp)
def chain_test(image, image_gray):
assert_equal(bw(rotate(rotate(rotate(rotate(image))))), image_gray)
| 21.587302 | 101 | 0.770221 | 387 | 2,720 | 5.072351 | 0.155039 | 0.081508 | 0.099338 | 0.122262 | 0.386653 | 0.191544 | 0.164035 | 0.164035 | 0.118186 | 0.118186 | 0 | 0.020425 | 0.118015 | 2,720 | 125 | 102 | 21.76 | 0.797832 | 0 | 0 | 0.271429 | 0 | 0 | 0.101103 | 0.095588 | 0 | 0 | 0 | 0 | 0.214286 | 1 | 0.385714 | false | 0 | 0.042857 | 0.185714 | 0.614286 | 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 |
09d7b7832478a8789ffda2358c7033e4144b37a0 | 310 | py | Python | saleor/account/templatetags/account_utils.py | TropicalBastos/saleor-courses | 3d158d7e00fba999331b4949ee69bca3b3ab564e | [
"CC-BY-4.0"
] | 4 | 2019-11-23T20:00:45.000Z | 2021-09-15T20:06:15.000Z | saleor/account/templatetags/account_utils.py | TropicalBastos/saleor-courses | 3d158d7e00fba999331b4949ee69bca3b3ab564e | [
"CC-BY-4.0"
] | 14 | 2020-03-24T17:54:29.000Z | 2022-02-10T19:53:07.000Z | saleor/account/templatetags/account_utils.py | TropicalBastos/saleor-courses | 3d158d7e00fba999331b4949ee69bca3b3ab564e | [
"CC-BY-4.0"
] | 1 | 2020-01-11T21:33:21.000Z | 2020-01-11T21:33:21.000Z | from django import template
from django.utils.translation import pgettext
from django.templatetags.static import static
from django.template.defaultfilters import safe, truncatechars
register = template.Library()
@register.filter()
def safe_truncate(string, arg):
return truncatechars(safe(string), arg) | 28.181818 | 62 | 0.816129 | 38 | 310 | 6.631579 | 0.526316 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106452 | 310 | 11 | 63 | 28.181818 | 0.909747 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.5 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
61db2666e29858ff8dfe13a2ccbf18aac664afb5 | 1,339 | py | Python | service/migrations/0005_auto_20210902_1522.py | theonlykingpin/snapfoodclone | 0c1a7839424e89d9bc7bfb55c150a92055759702 | [
"MIT"
] | 11 | 2021-09-17T07:44:05.000Z | 2022-02-06T08:33:30.000Z | service/migrations/0005_auto_20210902_1522.py | theonlykingpin/snapfoodclone | 0c1a7839424e89d9bc7bfb55c150a92055759702 | [
"MIT"
] | 1 | 2021-10-09T07:37:14.000Z | 2021-10-09T07:37:14.000Z | service/migrations/0005_auto_20210902_1522.py | theonlykingpin/snapfoodclone | 0c1a7839424e89d9bc7bfb55c150a92055759702 | [
"MIT"
] | 3 | 2021-09-27T14:12:13.000Z | 2021-10-18T12:21:37.000Z | # Generated by Django 3.2 on 2021-09-02 10:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('service', '0004_alter_service_address'),
]
operations = [
migrations.RemoveField(
model_name='serviceavailabletime',
name='available_time',
),
migrations.AddField(
model_name='serviceavailabletime',
name='close_time',
field=models.TimeField(null=True, verbose_name='close time'),
),
migrations.AddField(
model_name='serviceavailabletime',
name='day',
field=models.PositiveSmallIntegerField(choices=[(0, 'saturday'), (1, 'sunday'), (2, 'monday'), (3, 'tuesday'), (4, 'wednesday'), (5, 'thursday'), (6, 'friday')], null=True, verbose_name='day'),
),
migrations.AddField(
model_name='serviceavailabletime',
name='is_close',
field=models.BooleanField(blank=True, null=True, verbose_name='close day'),
),
migrations.AddField(
model_name='serviceavailabletime',
name='open_time',
field=models.TimeField(null=True, verbose_name='open time'),
),
migrations.DeleteModel(
name='AvailableTime',
),
]
| 32.658537 | 205 | 0.582524 | 123 | 1,339 | 6.211382 | 0.471545 | 0.058901 | 0.189791 | 0.215969 | 0.435864 | 0.397906 | 0.397906 | 0.112565 | 0 | 0 | 0 | 0.026042 | 0.283047 | 1,339 | 40 | 206 | 33.475 | 0.769792 | 0.032114 | 0 | 0.441176 | 1 | 0 | 0.209428 | 0.020093 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.029412 | 0 | 0.117647 | 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 |
61e3d984387f617242463dbfb78af7f13225b86a | 171 | py | Python | scripts/callmultiplier.py | tomunger/pythonnet.embedingtest | 3aff2f85e06417375c40e31b3e4a838e9db91c15 | [
"MIT"
] | 3 | 2019-05-14T05:18:19.000Z | 2022-01-28T13:48:33.000Z | scripts/callmultiplier.py | tomunger/pythonnet.embedingtest | 3aff2f85e06417375c40e31b3e4a838e9db91c15 | [
"MIT"
] | null | null | null | scripts/callmultiplier.py | tomunger/pythonnet.embedingtest | 3aff2f85e06417375c40e31b3e4a838e9db91c15 | [
"MIT"
] | 1 | 2020-03-06T15:11:31.000Z | 2020-03-06T15:11:31.000Z | import clr
from PythonNetTest import Multiplier
def multiplyThese (a, b):
m = Multiplier()
return m.Multiply(a, b)
# print "3 * 5: " + str(multiplyThese(3.0, 5.0))
| 14.25 | 48 | 0.672515 | 26 | 171 | 4.423077 | 0.653846 | 0.034783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043165 | 0.187135 | 171 | 11 | 49 | 15.545455 | 0.784173 | 0.269006 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | 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 | 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 |
61e45f345290b348ddb44fbc3cd7a6a3a007da11 | 134 | py | Python | test.py | sletort/pointpointgame | 93a9649d4a1910e59d7e1061a1d072560bd43e0b | [
"MIT"
] | null | null | null | test.py | sletort/pointpointgame | 93a9649d4a1910e59d7e1061a1d072560bd43e0b | [
"MIT"
] | null | null | null | test.py | sletort/pointpointgame | 93a9649d4a1910e59d7e1061a1d072560bd43e0b | [
"MIT"
] | null | null | null | import random
foo = ['battery', 'correct', 'horse', 'staple']
secure_random = random.SystemRandom()
print(secure_random.choice(foo))
| 22.333333 | 47 | 0.731343 | 16 | 134 | 6 | 0.6875 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097015 | 134 | 5 | 48 | 26.8 | 0.793388 | 0 | 0 | 0 | 0 | 0 | 0.186567 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1114aa1a04310dd0d416f88392c7af990557fa97 | 274 | py | Python | setup.py | ourlink/dash_subsidy | eeb535fa033303c5c3d671199dfd3eb7e84aaacf | [
"MIT"
] | null | null | null | setup.py | ourlink/dash_subsidy | eeb535fa033303c5c3d671199dfd3eb7e84aaacf | [
"MIT"
] | null | null | null | setup.py | ourlink/dash_subsidy | eeb535fa033303c5c3d671199dfd3eb7e84aaacf | [
"MIT"
] | null | null | null | from distutils.core import setup, Extension
dash_subsidy_module = Extension('dash_subsidy', sources = ['dash_subsidy.cpp'])
setup (name = 'dash_subsidy',
version = '1.3',
description = 'Subsidy function for Dash',
ext_modules = [dash_subsidy_module])
| 30.444444 | 79 | 0.70073 | 33 | 274 | 5.575758 | 0.606061 | 0.298913 | 0.217391 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008929 | 0.182482 | 274 | 8 | 80 | 34.25 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0.248175 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
111b1a532f4a26bc954024257936a85b6c2e4a6c | 623 | py | Python | flaml/tune/__init__.py | wuchihsu/FLAML | 54d303a95ab8615ec298a5a7a530f8d1d477bf68 | [
"MIT"
] | 1,747 | 2020-12-05T00:14:58.000Z | 2022-03-31T20:54:09.000Z | flaml/tune/__init__.py | wuchihsu/FLAML | 54d303a95ab8615ec298a5a7a530f8d1d477bf68 | [
"MIT"
] | 229 | 2020-12-14T06:19:16.000Z | 2022-03-31T05:20:27.000Z | flaml/tune/__init__.py | wuchihsu/FLAML | 54d303a95ab8615ec298a5a7a530f8d1d477bf68 | [
"MIT"
] | 260 | 2020-12-13T09:24:41.000Z | 2022-03-27T04:09:51.000Z | try:
from ray import __version__ as ray_version
assert ray_version >= '1.0.0'
from ray.tune import (uniform, quniform, choice, randint, qrandint, randn,
qrandn, loguniform, qloguniform, lograndint, qlograndint)
except (ImportError, AssertionError):
from .sample import (uniform, quniform, choice, randint, qrandint, randn,
qrandn, loguniform, qloguniform, lograndint, qlograndint)
from .tune import run, report
from .sample import polynomial_expansion_set
from .sample import PolynomialExpansionSet, Categorical, Float
from .trial import Trial
| 47.923077 | 84 | 0.704655 | 67 | 623 | 6.432836 | 0.507463 | 0.069606 | 0.111369 | 0.12529 | 0.440835 | 0.440835 | 0.440835 | 0.440835 | 0.440835 | 0.440835 | 0 | 0.006211 | 0.224719 | 623 | 12 | 85 | 51.916667 | 0.886128 | 0 | 0 | 0.166667 | 0 | 0 | 0.008183 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
1123d580ede84c34a052679d4d692e596e0907b8 | 234 | py | Python | costurero/pytest/test_math.py | tonper19/PythonDemos | 633a40e282049e511fd965c0afe104e775a2f526 | [
"MIT"
] | null | null | null | costurero/pytest/test_math.py | tonper19/PythonDemos | 633a40e282049e511fd965c0afe104e775a2f526 | [
"MIT"
] | null | null | null | costurero/pytest/test_math.py | tonper19/PythonDemos | 633a40e282049e511fd965c0afe104e775a2f526 | [
"MIT"
] | null | null | null | def add(x, y):
return x + y
def subtract(x, y):
return x - y
def inc(x):
return x + 1
def test_add():
assert add(1, 2) == 3
def test_subtract():
assert subtract(2, 1) == 1
def test_inc():
assert inc(1) == 2
| 14.625 | 30 | 0.555556 | 43 | 234 | 2.953488 | 0.27907 | 0.062992 | 0.125984 | 0.141732 | 0.204724 | 0.204724 | 0 | 0 | 0 | 0 | 0 | 0.053892 | 0.286325 | 234 | 15 | 31 | 15.6 | 0.706587 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.5 | false | 0 | 0 | 0.25 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
1136642ecb74eb8306dbea2e2932c8f12fc0691d | 395 | py | Python | Modules/pred/classes.py | iheb-brini/fitness-lab | 2d82d7a2ecba27f535cda880865e6d9ed446eac5 | [
"MIT"
] | null | null | null | Modules/pred/classes.py | iheb-brini/fitness-lab | 2d82d7a2ecba27f535cda880865e6d9ed446eac5 | [
"MIT"
] | null | null | null | Modules/pred/classes.py | iheb-brini/fitness-lab | 2d82d7a2ecba27f535cda880865e6d9ed446eac5 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
class AbstractPredictor(ABC):
@abstractmethod
def predict(self, model, x, **kwargs):
pass
class Prediction:
predictor: AbstractPredictor
def __init__(self, predictor: AbstractPredictor) -> None:
self.predictor = predictor
def run(self, model, x, **kwargs):
return self.predictor.predict(model, x, **kwargs)
| 19.75 | 61 | 0.675949 | 42 | 395 | 6.261905 | 0.452381 | 0.068441 | 0.136882 | 0.121673 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222785 | 395 | 19 | 62 | 20.789474 | 0.856678 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.090909 | 0.090909 | 0.090909 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
115e7464e6aca8858b8c090c5884b3514a14c4fa | 835 | py | Python | py_pdf_term/candidates/_candidates/filters/__init__.py | kumachan-mis/py-pdf-term | 282505826ce8c626003e753068d15738d772ce46 | [
"MIT"
] | null | null | null | py_pdf_term/candidates/_candidates/filters/__init__.py | kumachan-mis/py-pdf-term | 282505826ce8c626003e753068d15738d772ce46 | [
"MIT"
] | 1 | 2021-08-02T13:02:12.000Z | 2021-08-02T13:02:12.000Z | py_pdf_term/candidates/_candidates/filters/__init__.py | kumachan-mis/py-pdf-term | 282505826ce8c626003e753068d15738d772ce46 | [
"MIT"
] | null | null | null | from .combiner import FilterCombiner
from .term import (
BaseCandidateTermFilter,
EnglishConcatenationFilter,
EnglishNumericFilter,
EnglishProperNounFilter,
EnglishSymbolLikeFilter,
JapaneseConcatenationFilter,
JapaneseNumericFilter,
JapaneseProperNounFilter,
JapaneseSymbolLikeFilter,
)
from .token import BaseCandidateTokenFilter, EnglishTokenFilter, JapaneseTokenFilter
# isort: unique-list
__all__ = [
"BaseCandidateTermFilter",
"BaseCandidateTokenFilter",
"EnglishConcatenationFilter",
"EnglishNumericFilter",
"EnglishProperNounFilter",
"EnglishSymbolLikeFilter",
"EnglishTokenFilter",
"FilterCombiner",
"JapaneseConcatenationFilter",
"JapaneseNumericFilter",
"JapaneseProperNounFilter",
"JapaneseSymbolLikeFilter",
"JapaneseTokenFilter",
]
| 26.935484 | 84 | 0.767665 | 39 | 835 | 16.333333 | 0.564103 | 0.144427 | 0.216641 | 0.288854 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159281 | 835 | 30 | 85 | 27.833333 | 0.907407 | 0.021557 | 0 | 0 | 0 | 0 | 0.35092 | 0.263804 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.107143 | 0 | 0.107143 | 0 | 0 | 0 | 1 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
febd8757b43ccc6a58571d56c5bdcce95644a081 | 131 | py | Python | jqfpy/loading/rec.py | podhmo/jqfpy | c733084751fbc700f642f23092e24da5b56afb98 | [
"MIT"
] | 13 | 2017-09-02T03:59:35.000Z | 2021-10-05T01:42:16.000Z | jqfpy/loading/rec.py | podhmo/jqfpy | c733084751fbc700f642f23092e24da5b56afb98 | [
"MIT"
] | 32 | 2017-08-26T07:14:15.000Z | 2021-01-21T13:21:02.000Z | jqfpy/loading/rec.py | podhmo/jqfpy | c733084751fbc700f642f23092e24da5b56afb98 | [
"MIT"
] | 1 | 2019-03-19T12:38:58.000Z | 2019-03-19T12:38:58.000Z | def consume_rec(xs, fn, n=0):
if n <= 0:
fn(xs)
else:
for x in xs:
consume_rec(x, fn, n=n - 1)
| 18.714286 | 39 | 0.435115 | 24 | 131 | 2.291667 | 0.541667 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039474 | 0.419847 | 131 | 6 | 40 | 21.833333 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.166667 | 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 |
fefe039fcf5fe23f70c3e5ad59e3fcd357b14f51 | 420 | py | Python | keras_dna/__init__.py | etirouthier/keras_dna | 99cd0009cfac24fd58ba824fbaa64c4026850c0d | [
"MIT"
] | 14 | 2020-11-04T01:45:21.000Z | 2021-09-18T22:03:14.000Z | keras_dna/__init__.py | etirouthier/keras_dna | 99cd0009cfac24fd58ba824fbaa64c4026850c0d | [
"MIT"
] | null | null | null | keras_dna/__init__.py | etirouthier/keras_dna | 99cd0009cfac24fd58ba824fbaa64c4026850c0d | [
"MIT"
] | 3 | 2020-12-02T06:51:00.000Z | 2021-04-15T22:10:21.000Z | from __future__ import absolute_import
from . import evaluation
from . import normalization
from . import extractors
from . import generators
from . import layers
from . import model
from . import utils
from . import sequence
# Also importable from root
from .generators import Generator, MultiGenerator
from .model import ModelWrapper
from .sequence import SeqIntervalDl, StringSeqIntervalDl
__version__ = '0.0.17'
| 22.105263 | 56 | 0.807143 | 51 | 420 | 6.470588 | 0.45098 | 0.242424 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011173 | 0.147619 | 420 | 18 | 57 | 23.333333 | 0.910615 | 0.059524 | 0 | 0 | 0 | 0 | 0.015267 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.923077 | 0 | 0.923077 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
28a545e84e4d0e1d46d2e9dd5715f7992af38030 | 481 | py | Python | Test/test_ImportCertificate.py | raghavendramanandi/SSLAutoPilot | e5b54dc54bb0710dce236aa98d22d46bc445f68a | [
"MIT"
] | null | null | null | Test/test_ImportCertificate.py | raghavendramanandi/SSLAutoPilot | e5b54dc54bb0710dce236aa98d22d46bc445f68a | [
"MIT"
] | null | null | null | Test/test_ImportCertificate.py | raghavendramanandi/SSLAutoPilot | e5b54dc54bb0710dce236aa98d22d46bc445f68a | [
"MIT"
] | null | null | null | import unittest
from unittest import TestCase
from importCertificate import getCommandForImport
class TestImportCertificate(TestCase):
def test_getKeyStoreCommand(self):
command = getCommandForImport("certbotlocation", "location", "password")
self.assertEqual(command, "keytool -import -trustcacerts -alias tomcat -file certbotlocation/0001_cert.perm -keystore location -noprompt -storepass password")
if __name__ == '__main__':
unittest.main()
| 34.357143 | 166 | 0.765073 | 45 | 481 | 7.955556 | 0.688889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009804 | 0.151767 | 481 | 13 | 167 | 37 | 0.867647 | 0 | 0 | 0 | 0 | 0.111111 | 0.349272 | 0.06237 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.111111 | false | 0.222222 | 0.666667 | 0 | 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 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
28a723339cfc0fcc41cb5ec9ea810b3c99d1c2bc | 85 | py | Python | ficheros/CSV/ejercicio altos cargos/numeurotonumdollar.py | txtbits/daw-python | 5dde1207e2791e90aa5e9ce2b6afc4116129efab | [
"MIT"
] | null | null | null | ficheros/CSV/ejercicio altos cargos/numeurotonumdollar.py | txtbits/daw-python | 5dde1207e2791e90aa5e9ce2b6afc4116129efab | [
"MIT"
] | null | null | null | ficheros/CSV/ejercicio altos cargos/numeurotonumdollar.py | txtbits/daw-python | 5dde1207e2791e90aa5e9ce2b6afc4116129efab | [
"MIT"
] | null | null | null | dato = '21.999,32'
dato = float(dato.replace('.', '').replace(',', '.'))
print dato | 17 | 53 | 0.552941 | 11 | 85 | 4.272727 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094595 | 0.129412 | 85 | 5 | 54 | 17 | 0.540541 | 0 | 0 | 0 | 0 | 0 | 0.139535 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
28a96ab70caac00b217d928fa3bce38095545708 | 1,003 | py | Python | manga_py/providers/mangareader_xyz.py | paulolimac/manga-py | 3d180846750a4e770b5024eb8cd15629362875b1 | [
"MIT"
] | 1 | 2020-11-19T00:40:49.000Z | 2020-11-19T00:40:49.000Z | manga_py/providers/mangareader_xyz.py | paulolimac/manga-py | 3d180846750a4e770b5024eb8cd15629362875b1 | [
"MIT"
] | null | null | null | manga_py/providers/mangareader_xyz.py | paulolimac/manga-py | 3d180846750a4e770b5024eb8cd15629362875b1 | [
"MIT"
] | null | null | null | from manga_py.provider import Provider
from .helpers.std import Std
class MangaReaderXyz(Provider, Std):
def get_chapter_index(self) -> str:
re = self.re.compile(r'/chapter-(\d+(?:\.\d+)?)')
return re.search(self.chapter).group(1).replace('.', '-')
def get_main_content(self):
return self._get_content('{}/manga/{}')
def get_manga_name(self) -> str:
if ~self.get_url().find('/manga/'):
re = '/manga/([^/]+)'
else:
re = '/([^/]+)/chapter-'
return self._get_name(re)
def get_chapters(self):
return self._elements('.table td > a,.chapter-list div.row a')
def get_files(self):
parser = self.html_fromstring(self.chapter + '/0')
return self._images_helper(parser, '#view-chapter img,#vungdoc img')
def get_cover(self) -> str:
return self._cover_from_content('img.img-thumbnail,.manga-info-pic > img')
def book_meta(self) -> dict:
pass
main = MangaReaderXyz
| 27.861111 | 82 | 0.60319 | 130 | 1,003 | 4.476923 | 0.438462 | 0.061856 | 0.04811 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002581 | 0.227318 | 1,003 | 35 | 83 | 28.657143 | 0.748387 | 0 | 0 | 0 | 0 | 0 | 0.182453 | 0.05683 | 0 | 0 | 0 | 0 | 0 | 1 | 0.291667 | false | 0.041667 | 0.083333 | 0.125 | 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 |
28e33fbcb8dce9fe7016099e8e75e2666a179906 | 314 | py | Python | core/admin.py | mchlzhao/prophetic | cf9e7c315c73bc5afbb47ab3588eb1082f09b60e | [
"MIT"
] | null | null | null | core/admin.py | mchlzhao/prophetic | cf9e7c315c73bc5afbb47ab3588eb1082f09b60e | [
"MIT"
] | null | null | null | core/admin.py | mchlzhao/prophetic | cf9e7c315c73bc5afbb47ab3588eb1082f09b60e | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Group, Event, Market, Order, MarketPosition, Trade, Account
admin.site.register(Group)
admin.site.register(Event)
admin.site.register(Market)
admin.site.register(Order)
admin.site.register(MarketPosition)
admin.site.register(Trade)
admin.site.register(Account) | 31.4 | 79 | 0.818471 | 43 | 314 | 5.976744 | 0.348837 | 0.245136 | 0.463035 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066879 | 314 | 10 | 80 | 31.4 | 0.877133 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.222222 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
28f947a0308404179e0d07bade5bdad3346c3618 | 319 | py | Python | worklets/resources/set-cookie.py | servo-wpt-sync/web-platform-tests | 56e2df852354bc2b89e6d17a9dbafd280d24203c | [
"BSD-3-Clause"
] | null | null | null | worklets/resources/set-cookie.py | servo-wpt-sync/web-platform-tests | 56e2df852354bc2b89e6d17a9dbafd280d24203c | [
"BSD-3-Clause"
] | null | null | null | worklets/resources/set-cookie.py | servo-wpt-sync/web-platform-tests | 56e2df852354bc2b89e6d17a9dbafd280d24203c | [
"BSD-3-Clause"
] | null | null | null | def main(request, response):
name = request.GET.first("name")
source_origin = request.headers.get("origin", None);
response.headers.set("Set-Cookie", name + "=value")
response.headers.set("Access-Control-Allow-Origin", source_origin)
response.headers.set("Access-Control-Allow-Credentials", "true")
| 45.571429 | 70 | 0.711599 | 40 | 319 | 5.625 | 0.475 | 0.2 | 0.24 | 0.213333 | 0.32 | 0.32 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119122 | 319 | 6 | 71 | 53.166667 | 0.800712 | 0 | 0 | 0 | 0 | 0 | 0.278997 | 0.184953 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
28fbc18f1d2600096ba4e315e98618163bb58d7b | 879 | py | Python | pygithub3/requests/repos/hooks.py | teamorchard/python-github3 | 321385860cb2ecaea1221612682c20e8069768b0 | [
"0BSD"
] | 107 | 2015-01-06T09:47:27.000Z | 2021-11-02T08:21:58.000Z | pygithub3/requests/repos/hooks.py | mikiec84/python-github3 | 321385860cb2ecaea1221612682c20e8069768b0 | [
"0BSD"
] | 16 | 2015-02-17T08:00:58.000Z | 2019-09-17T17:23:44.000Z | pygithub3/requests/repos/hooks.py | mikiec84/python-github3 | 321385860cb2ecaea1221612682c20e8069768b0 | [
"0BSD"
] | 69 | 2015-01-02T14:38:29.000Z | 2022-02-25T10:04:09.000Z | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from . import Request
from pygithub3.resources.repos import Hook
class List(Request):
uri = 'repos/{user}/{repo}/hooks'
resource = Hook
class Get(Request):
uri = 'repos/{user}/{repo}/hooks/{id}'
resource = Hook
class Create(Request):
uri = 'repos/{user}/{repo}/hooks'
resource = Hook
body_schema = {
'schema': ('name', 'config', 'events', 'active'),
'required': ('name', 'config'),
}
class Update(Request):
uri = 'repos/{user}/{repo}/hooks/{id}'
resource = Hook
body_schema = {
'schema': ('name', 'config', 'events', 'add_events', 'remove_events',
'active'),
'required': (),
}
class Test(Request):
uri = 'repos/{user}/{repo}/hooks/{id}/test'
class Delete(Request):
uri = 'repos/{user}/{repo}/hooks/{id}'
| 17.938776 | 77 | 0.56314 | 99 | 879 | 4.959596 | 0.363636 | 0.1222 | 0.183299 | 0.232179 | 0.586558 | 0.586558 | 0.586558 | 0.464358 | 0.171079 | 0 | 0 | 0.002985 | 0.23777 | 879 | 48 | 78 | 18.3125 | 0.729851 | 0.050057 | 0 | 0.407407 | 0 | 0 | 0.336134 | 0.210084 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.074074 | 0 | 0.740741 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
28fcd6b34957bac42b9c069d6e022129ce614964 | 75 | py | Python | web3_input_decoder/exceptions.py | kigawas/web3-input-decoder | 7e9a250d7225e92fc731f5b52b2db4649098f363 | [
"MIT"
] | 13 | 2021-03-26T03:02:27.000Z | 2022-03-23T11:27:55.000Z | web3_input_decoder/exceptions.py | kigawas/web3-input-decoder | 7e9a250d7225e92fc731f5b52b2db4649098f363 | [
"MIT"
] | 47 | 2021-03-28T13:36:03.000Z | 2022-03-29T16:19:12.000Z | web3_input_decoder/exceptions.py | kigawas/web3-input-decoder | 7e9a250d7225e92fc731f5b52b2db4649098f363 | [
"MIT"
] | 3 | 2021-10-14T03:19:49.000Z | 2022-03-03T09:41:03.000Z | __all__ = ("InputDataError",)
class InputDataError(ValueError):
pass
| 12.5 | 33 | 0.72 | 6 | 75 | 8.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16 | 75 | 5 | 34 | 15 | 0.793651 | 0 | 0 | 0 | 0 | 0 | 0.186667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.333333 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e910131f6d5db54d9d31fdd823ceb8bd716e3edb | 299 | py | Python | civic_sandbox/serializers.py | hackoregon/housing-2018 | d0e23f942e2bb4e26c3bd4b30863fe468d64ff5f | [
"MIT"
] | 1 | 2018-01-30T22:26:14.000Z | 2018-01-30T22:26:14.000Z | civic_sandbox/serializers.py | hackoregon/housing-2018 | d0e23f942e2bb4e26c3bd4b30863fe468d64ff5f | [
"MIT"
] | 21 | 2018-01-25T04:41:41.000Z | 2021-06-10T20:13:47.000Z | civic_sandbox/serializers.py | hackoregon/housing-2018 | d0e23f942e2bb4e26c3bd4b30863fe468d64ff5f | [
"MIT"
] | 4 | 2018-01-25T04:19:40.000Z | 2018-12-13T19:19:58.000Z | from rest_framework_gis.serializers import GeoFeatureModelSerializer
from rest_framework.serializers import ModelSerializer
from .models import Permit
class PermitSerializer(GeoFeatureModelSerializer):
class Meta:
model = Permit
geo_field = 'point'
fields = '__all__'
| 24.916667 | 68 | 0.765886 | 29 | 299 | 7.62069 | 0.655172 | 0.072398 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187291 | 299 | 11 | 69 | 27.181818 | 0.909465 | 0 | 0 | 0 | 0 | 0 | 0.040134 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.625 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
e915979d37891b52d74fb6b20a694c39a517e615 | 775 | py | Python | question/q6_1_ronri_enzan_equal.py | breeze-shared-inc/python_training_01 | 7e918b37adbce062ae279f060bc25cfacda2fb85 | [
"MIT"
] | null | null | null | question/q6_1_ronri_enzan_equal.py | breeze-shared-inc/python_training_01 | 7e918b37adbce062ae279f060bc25cfacda2fb85 | [
"MIT"
] | 1 | 2020-05-11T04:59:04.000Z | 2020-05-11T05:29:08.000Z | question/q6_1_ronri_enzan_equal.py | bzgwhite/python_training_01 | 7e918b37adbce062ae279f060bc25cfacda2fb85 | [
"MIT"
] | null | null | null | """
次のLESSONで行う条件分岐(IF文)処理を扱う上で重要です。
論理演算とは
00は真である(正しい)
や
00は偽である(正しくない)
をプログラミングで表現します。
プログラミングでは
真と偽をそれぞれTrueとFalseで
表現します。
例
print(A == A)
=>True
print(1 == 2)
=>False
次のLESSONの条件分岐は
もし00が真なら〜
と言う処理が行われます。
まずは論理演算で扱う記号を活用できるようにしましょう!
論理演算子一覧
AとBが等しい
==
is
AとBが異なる
!=
is not
問題:次のように出力せよ
AとBが等しい(数字)
True
False
True
False
AとBが等しい(文字列)
True
False
True
False
AとBが異なる
False
True
False
True
"""
print("AとBが等しい(数字)")
print(1 1) # True 記号で
print(1 2) # False 記号で
print(1 1) # True 文字で
print(1 2) # False 文字で
print("AとBが等しい(文字列)")
print("山田" "山田") # True 記号で
print("山田" "田中") # False 記号で
print("山田" "山田") # True 文字で
print("山田" "田中") # False 文字で
print("AとBが異なる")
print(1 1) # False 記号で
print(1 2) # True 記号で
print(1 1) # False 文字で
print(1 2) # True 文字で | 10.616438 | 32 | 0.683871 | 120 | 775 | 4.425 | 0.316667 | 0.101695 | 0.065913 | 0.067797 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037677 | 0.178065 | 775 | 73 | 33 | 10.616438 | 0.794349 | 0.147097 | 0 | 0.8 | 0 | 0 | 0.188525 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
e94545e8824aa96331d3a1e327639574da90d2fc | 219 | py | Python | ghcontribs/__init__.py | dwhswenson/ghcontribs | 759ee79453f85dd57185d6e5e6170227ae5fd8fb | [
"MIT"
] | null | null | null | ghcontribs/__init__.py | dwhswenson/ghcontribs | 759ee79453f85dd57185d6e5e6170227ae5fd8fb | [
"MIT"
] | 6 | 2021-11-11T23:54:38.000Z | 2022-01-30T16:30:53.000Z | ghcontribs/__init__.py | dwhswenson/ghcontribs | 759ee79453f85dd57185d6e5e6170227ae5fd8fb | [
"MIT"
] | null | null | null | from . import contrib
from . import json_utils
from .contrib import GitHubContrib, ContribType
from .json_utils import write_json_file, load_json_file
from .monthly import get_monthly_contribs, write_all_contrib_files
| 31.285714 | 66 | 0.853881 | 32 | 219 | 5.5 | 0.46875 | 0.113636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.109589 | 219 | 6 | 67 | 36.5 | 0.902564 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3a6105e6ce73c813126dc3e5719b45dfe3259b42 | 305 | py | Python | by-session/ta-921/j10/a1.py | amiraliakbari/sharif-mabani-python | 5d14a08d165267fe71c28389ddbafe29af7078c5 | [
"MIT"
] | 2 | 2015-04-29T20:59:35.000Z | 2018-09-26T13:33:43.000Z | by-session/ta-921/j10/a1.py | amiraliakbari/sharif-mabani-python | 5d14a08d165267fe71c28389ddbafe29af7078c5 | [
"MIT"
] | null | null | null | by-session/ta-921/j10/a1.py | amiraliakbari/sharif-mabani-python | 5d14a08d165267fe71c28389ddbafe29af7078c5 | [
"MIT"
] | null | null | null | a = []
def f(n, k):
if k == 0:
if n == 0:
print a
return
if n < 0:
print "invalid:", a
return
a.append(0)
f(n, k-1)
a.pop()
a.append(1)
f(n-1, k-1)
a.pop()
a.append(2)
f(n-2, k-1)
a.pop()
f(5, 3) | 14.52381 | 28 | 0.337705 | 53 | 305 | 1.943396 | 0.301887 | 0.07767 | 0.087379 | 0.174757 | 0.252427 | 0.252427 | 0 | 0 | 0 | 0 | 0 | 0.082803 | 0.485246 | 305 | 21 | 29 | 14.52381 | 0.573248 | 0 | 0 | 0.263158 | 0 | 0 | 0.027972 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.105263 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3a772fa991ab9060f141f0916240a325fd4f195e | 133 | py | Python | dplhooks/deploys/urls.py | cschlay/dplhooks | bdeb77f3e4e2345da2f98eb9815b22c857d4e996 | [
"MIT"
] | null | null | null | dplhooks/deploys/urls.py | cschlay/dplhooks | bdeb77f3e4e2345da2f98eb9815b22c857d4e996 | [
"MIT"
] | 4 | 2021-03-30T14:07:19.000Z | 2021-06-10T19:58:54.000Z | dplhooks/deploys/urls.py | cschlay/dplhooks | bdeb77f3e4e2345da2f98eb9815b22c857d4e996 | [
"MIT"
] | null | null | null | from django.urls import path
from dplhooks.deploys import views
urlpatterns = [
path('p/deploy', views.DeployView.as_view())
]
| 16.625 | 48 | 0.736842 | 18 | 133 | 5.388889 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150376 | 133 | 7 | 49 | 19 | 0.858407 | 0 | 0 | 0 | 0 | 0 | 0.06015 | 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 |
3a776046989c2a414d1dbeafe896f62f2302ec30 | 159 | py | Python | digicert_express/platforms/ubuntu_platform.py | digicert/digicert_express | 292fb4e7f8a39e53c384a79c50a9488c51258f97 | [
"MIT"
] | 2 | 2017-03-03T20:37:29.000Z | 2018-06-01T22:22:15.000Z | digicert_express/platforms/ubuntu_platform.py | digicert/digicert_express | 292fb4e7f8a39e53c384a79c50a9488c51258f97 | [
"MIT"
] | null | null | null | digicert_express/platforms/ubuntu_platform.py | digicert/digicert_express | 292fb4e7f8a39e53c384a79c50a9488c51258f97 | [
"MIT"
] | 2 | 2018-01-26T07:11:42.000Z | 2019-03-06T23:30:39.000Z | from base_platform import BasePlatform
class UbuntuPlatform(BasePlatform):
APACHE_SERVICE = 'apache2ctl'
APACHE_RESTART_COMMAND = 'service apache2 restart'
| 26.5 | 51 | 0.836478 | 17 | 159 | 7.588235 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014085 | 0.106918 | 159 | 5 | 52 | 31.8 | 0.894366 | 0 | 0 | 0 | 0 | 0 | 0.207547 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
3a92278b2c73de077df8f2a1e59980057667a367 | 145 | py | Python | classification/tests/test_classifier.py | magesh-technovator/serverless-transformers-on-aws-lambda | 2bc3c320d29fe73955fc0d98476391620550b5d7 | [
"Apache-2.0"
] | 103 | 2021-07-11T12:50:47.000Z | 2022-03-02T15:34:04.000Z | classification/tests/test_classifier.py | k-for-code/serverless-transformers-on-aws-lambda | 11f347e007fb3f54a1e2f3870a06698f9af0d629 | [
"Apache-2.0"
] | 8 | 2021-07-15T09:14:46.000Z | 2021-07-22T03:44:46.000Z | classification/tests/test_classifier.py | k-for-code/serverless-transformers-on-aws-lambda | 11f347e007fb3f54a1e2f3870a06698f9af0d629 | [
"Apache-2.0"
] | 16 | 2021-07-13T08:58:22.000Z | 2022-02-07T20:31:34.000Z | from src.classifier import Classifier
pipeline = Classifier()
def test_response(requests, response):
assert response == pipeline(requests)
| 20.714286 | 41 | 0.77931 | 16 | 145 | 7 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137931 | 145 | 6 | 42 | 24.166667 | 0.896 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3ab1b449154c7f04f1cbb92fd0e8f6c978a1e769 | 195 | py | Python | app/planeks_news/admin.py | smak0v/planeks_news | bcc02a1ddafa609ccb7e3bf381109ba696e1eb87 | [
"MIT"
] | null | null | null | app/planeks_news/admin.py | smak0v/planeks_news | bcc02a1ddafa609ccb7e3bf381109ba696e1eb87 | [
"MIT"
] | 8 | 2020-06-15T10:49:56.000Z | 2022-01-13T02:52:35.000Z | app/planeks_news/admin.py | smak0v/planeks_news | bcc02a1ddafa609ccb7e3bf381109ba696e1eb87 | [
"MIT"
] | null | null | null | from django.contrib.admin import AdminSite
class PlaneksNewsAdminSite(AdminSite):
site_header = 'PLANEKS News Administration'
admin_site = PlaneksNewsAdminSite(name='planeks_news_admin')
| 21.666667 | 60 | 0.815385 | 21 | 195 | 7.380952 | 0.666667 | 0.141935 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112821 | 195 | 8 | 61 | 24.375 | 0.895954 | 0 | 0 | 0 | 0 | 0 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
3abdcc5b3a7c4292cdc63fb243ce18eb4357a881 | 204 | py | Python | standard_lib/file_matching_regex.py | DahlitzFlorian/python-snippets | 212f63f820b6f5842f74913ed08da18d41dfe7a4 | [
"MIT"
] | 29 | 2019-03-25T09:35:12.000Z | 2022-01-08T22:09:03.000Z | standard_lib/file_matching_regex.py | DahlitzFlorian/python-snippets | 212f63f820b6f5842f74913ed08da18d41dfe7a4 | [
"MIT"
] | null | null | null | standard_lib/file_matching_regex.py | DahlitzFlorian/python-snippets | 212f63f820b6f5842f74913ed08da18d41dfe7a4 | [
"MIT"
] | 4 | 2020-05-19T21:18:12.000Z | 2021-05-18T12:49:21.000Z | import fnmatch
import os
import re
reg = "({})|({})".format(fnmatch.translate("*.md"), fnmatch.translate("*.git*"))
markdown_files = [f for f in os.listdir() if re.match(reg, f)]
print(markdown_files)
| 20.4 | 80 | 0.671569 | 30 | 204 | 4.5 | 0.6 | 0.237037 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 204 | 9 | 81 | 22.666667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.093137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.166667 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
aafe920b29dcd58c5bf1a9b42533f150c7888147 | 292 | py | Python | hooks/pre_gen_project.py | aubricus/cookiecutter-python-package | 666af04831a652338287736b9c2e4e621cbe1cbe | [
"MIT"
] | null | null | null | hooks/pre_gen_project.py | aubricus/cookiecutter-python-package | 666af04831a652338287736b9c2e4e621cbe1cbe | [
"MIT"
] | 3 | 2020-09-17T07:36:59.000Z | 2020-09-17T07:39:31.000Z | hooks/pre_gen_project.py | aubricus/cookiecutter-python-package | 666af04831a652338287736b9c2e4e621cbe1cbe | [
"MIT"
] | 1 | 2020-10-10T18:31:58.000Z | 2020-10-10T18:31:58.000Z | """Cookiecutter pre_gen_project hook.
See: https://cookiecutter.readthedocs.io/en/1.7.2/advanced/hooks.html
"""
import os
import shutil
import fileinput
from pathlib import Path
def run():
"""Run pre gen hook functions."""
# NOTE: Do not delete this or the hook will not run.
run()
| 16.222222 | 69 | 0.722603 | 46 | 292 | 4.543478 | 0.73913 | 0.057416 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012195 | 0.157534 | 292 | 17 | 70 | 17.176471 | 0.837398 | 0.633562 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0.666667 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
c9396290a6a8347c883817be1dcb68e6b6312d4c | 488 | py | Python | fluent-python-code/01-data-model/vector.py | dym0080/learn-python | 2c1f34e9fa249334305350cf4f7fefb351871bda | [
"MIT"
] | null | null | null | fluent-python-code/01-data-model/vector.py | dym0080/learn-python | 2c1f34e9fa249334305350cf4f7fefb351871bda | [
"MIT"
] | null | null | null | fluent-python-code/01-data-model/vector.py | dym0080/learn-python | 2c1f34e9fa249334305350cf4f7fefb351871bda | [
"MIT"
] | null | null | null | from math import hypot
class Vector:
def __init__(self,x=0,y=0):
self.x=x
self.y=y
def __repr__(self):
return 'Vector(%r,%r)' % (self.x,self.y)
def __abs__(self):
return hypot(self.x,self.y)
def __bool__(self):
return bool(abs(self))
def __add__(self,other):
x=self.x+other.x
y=self.y+other.y
return Vector(x,y)
def __mul__(self,scalar):
return Vector(self.x*scalar,self.y * scalar) | 21.217391 | 52 | 0.569672 | 76 | 488 | 3.342105 | 0.276316 | 0.11811 | 0.070866 | 0.07874 | 0.102362 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005764 | 0.288934 | 488 | 23 | 52 | 21.217391 | 0.726225 | 0 | 0 | 0 | 0 | 0 | 0.026585 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.352941 | false | 0 | 0.058824 | 0.235294 | 0.764706 | 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 |
c955ad5a426b20afccce06cdb6ff1bf87b34a80f | 1,110 | py | Python | build/lib/atesa/test/test_return_rcs.py | team-mayes/atesa_OLD | 2bbe0650dfe055ce0d962046eeff783499f5a12a | [
"MIT"
] | null | null | null | build/lib/atesa/test/test_return_rcs.py | team-mayes/atesa_OLD | 2bbe0650dfe055ce0d962046eeff783499f5a12a | [
"MIT"
] | null | null | null | build/lib/atesa/test/test_return_rcs.py | team-mayes/atesa_OLD | 2bbe0650dfe055ce0d962046eeff783499f5a12a | [
"MIT"
] | null | null | null | # from unittest import TestCase
#
#
# class TestReturn_rcs(TestCase):
# def test_return_rcs(self):
# self.fail()
# literal_ops = True
#
#
# rc_values = []
# for i in range(traj.__len__()): # iterate through frames
# op_values = candidatevalues(thread,frame=i).split(' ') # OP values as a list
# equation = rc_definition
# if literal_ops:
# candidateops = [candidateops] # to fix error where candidateops has unexpected format
# for j in reversed(range(len(candidateops[0]))): # for each candidate op... (reversed to avoid e.g. 'OP10' -> 'candidatevalues(..., 0)0')
# equation = equation.replace('OP' + str(j + 1), 'op_values[j]')
# rc_values.append(eval(equation))
# commit_flag = 'False' # return 'False' if no beads are in bounds
# for value in rc_values:
# if rc_min <= value <= rc_max: # todo: this needs to be changed to the min and max of the given window that this thread is constrained to
# commit_flag = 'True' # return 'True' if any of the beads are in bounds.
# break
| 44.4 | 146 | 0.622523 | 150 | 1,110 | 4.48 | 0.56 | 0.035714 | 0.029762 | 0.047619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007308 | 0.26036 | 1,110 | 24 | 147 | 46.25 | 0.811206 | 0.95045 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0.041667 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c97eef50910294271c29379403bbe3d5ca1cfa5f | 792 | py | Python | pypedream/expressions/equation.py | Nukleon84/pypedream | de074e1b21d65eb3a02e1b0719fff1b4c2b7ae92 | [
"MIT"
] | 9 | 2020-05-17T15:23:33.000Z | 2021-04-28T19:03:00.000Z | pypedream/expressions/equation.py | Nukleon84/pypedream | de074e1b21d65eb3a02e1b0719fff1b4c2b7ae92 | [
"MIT"
] | 1 | 2020-07-30T11:53:53.000Z | 2020-07-30T11:53:53.000Z | pypedream/expressions/equation.py | Nukleon84/pypedream | de074e1b21d65eb3a02e1b0719fff1b4c2b7ae92 | [
"MIT"
] | null | null | null | from . basic import Expression,Variable
class Equation(object):
def __init__(self, rhs, name=""):
self.name=name
self.rhs=rhs
self.variables=[]
self.exploreVariables(rhs)
return
def exploreVariables(self, expr):
if(isinstance(expr,Variable)):
if expr not in self.variables:
self.variables.append(expr)
else:
for child in expr.children:
self.exploreVariables(child)
return
def residual(self):
return self.rhs.eval()
def reset(self):
self.rhs.reset()
return
def __str__(self):
return f"{self.rhs} = {self.residual()}"
def __repr__(self):
return self.__str__() | 24.75 | 48 | 0.539141 | 82 | 792 | 5.012195 | 0.390244 | 0.085158 | 0.082725 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.359848 | 792 | 32 | 49 | 24.75 | 0.810651 | 0 | 0 | 0.12 | 0 | 0 | 0.037831 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0 | 0.04 | 0.12 | 0.56 | 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 |
a322b7bb4376182350470e14568005ce94682e2f | 3,754 | py | Python | tests/test_cfloader.py | shachibista/mloader | 43f91542188888717885183dec24bf17cf9fef48 | [
"MIT"
] | null | null | null | tests/test_cfloader.py | shachibista/mloader | 43f91542188888717885183dec24bf17cf9fef48 | [
"MIT"
] | 5 | 2020-09-30T22:11:05.000Z | 2020-09-30T22:15:00.000Z | tests/test_cfloader.py | shachibista/cfloader | 43f91542188888717885183dec24bf17cf9fef48 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""Tests for `cfloader` package."""
import json
from pathlib import Path
import pytest
import cfloader
from cfloader.loader import Loader
from cfloader.readers import ConfigFileNotFoundError
def test_cfloader_can_open_path_objects():
config_filepath = Path("tests/examples/config.json")
loader = cfloader.open(config_filepath)
def test_cfloader_can_open_str_paths():
config_filepath = "tests/examples/config.json"
loader = cfloader.open(config_filepath)
def test_cfloader_can_open_dicts():
config_dict = {}
loader = cfloader.open(config_dict)
assert isinstance(loader, Loader)
assert loader.config == config_dict
def test_cfloader_open_returns_loader():
config_filepath = Path("tests/examples/config.json")
loader = cfloader.open(config_filepath)
assert isinstance(loader, Loader)
assert loader.config == json.loads(config_filepath.read_text())
def test_cfloader_can_open_zip_files():
archive_path = "tests/examples/archive.zip"
loader = cfloader.open(cfloader.Archive(archive_path))
assert isinstance(loader, Loader)
import zipfile
with zipfile.ZipFile(archive_path, "r") as archive_fs:
with archive_fs.open("config.json", "r") as config_file:
assert loader.config == json.load(config_file)
def test_cfloader_can_open_tar_files():
archive_path = "tests/examples/archive.tar"
loader = cfloader.open(cfloader.Archive(archive_path))
assert isinstance(loader, Loader)
import tarfile
with tarfile.open(archive_path, "r") as archive_fs:
config_fileinfo = archive_fs.getmember("config.json")
config_file = archive_fs.extractfile(config_fileinfo)
assert loader.config == json.loads(config_file.read())
def test_cfloader_can_open_tar_gz_files():
archive_path = "tests/examples/archive.tar.gz"
loader = cfloader.open(cfloader.Archive(archive_path))
assert isinstance(loader, Loader)
import tarfile
with tarfile.open(archive_path, "r:gz") as archive_fs:
config_fileinfo = archive_fs.getmember("config.json")
config_file = archive_fs.extractfile(config_fileinfo)
assert loader.config == json.loads(config_file.read())
# disabled because extractfile returns a <ExFileObject name=None>
# def test_cfloader_can_open_tar_bz_files():
# archive_path = "tests/examples/archive.tar.bz"
# loader = cfloader.open(cfloader.Archive(archive_path))
# assert isinstance(loader, Loader)
# import tarfile
# with tarfile.open(archive_path, "r:bz2") as archive_fs:
# config_fileinfo = archive_fs.getmember("config.json")
# config_file = archive_fs.extractfile(config_fileinfo)
# breakpoint()
# assert loader.config == json.loads(config_file.read())
def test_cfloader_can_open_tar_xz_files():
archive_path = "tests/examples/archive.tar.xz"
loader = cfloader.open(cfloader.Archive(archive_path))
assert isinstance(loader, Loader)
import tarfile
with tarfile.open(archive_path, "r:xz") as archive_fs:
config_fileinfo = archive_fs.getmember("config.json")
config_file = archive_fs.extractfile(config_fileinfo)
assert loader.config == json.loads(config_file.read())
def test_cfloader_complains_if_config_not_found_in_zip_archive():
archive_path = "tests/examples/archive.zip"
with pytest.raises(ConfigFileNotFoundError):
loader = cfloader.open(cfloader.Archive(archive_path, "cfg.json"))
def test_cfloader_complains_if_config_not_found_in_tar_archive():
archive_path = "tests/examples/archive.tar.xz"
with pytest.raises(ConfigFileNotFoundError):
loader = cfloader.open(cfloader.Archive(archive_path, "cfg.json")) | 34.440367 | 74 | 0.736814 | 477 | 3,754 | 5.534591 | 0.142558 | 0.079167 | 0.0625 | 0.054545 | 0.811364 | 0.794697 | 0.728409 | 0.620076 | 0.620076 | 0.593939 | 0 | 0.000317 | 0.160895 | 3,754 | 109 | 75 | 34.440367 | 0.837778 | 0.157698 | 0 | 0.538462 | 0 | 0 | 0.099809 | 0.077241 | 0 | 0 | 0 | 0 | 0.184615 | 1 | 0.153846 | false | 0 | 0.153846 | 0 | 0.307692 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a343bbdb638fd183d6cf3b766992497a452a95d1 | 6,065 | py | Python | ambuild2/frontend/v2_2/cpp/msvc.py | Wend4r/ambuild | cbf415104b1e7ac6baaf614cda517a5a2e827a42 | [
"BSD-3-Clause"
] | null | null | null | ambuild2/frontend/v2_2/cpp/msvc.py | Wend4r/ambuild | cbf415104b1e7ac6baaf614cda517a5a2e827a42 | [
"BSD-3-Clause"
] | null | null | null | ambuild2/frontend/v2_2/cpp/msvc.py | Wend4r/ambuild | cbf415104b1e7ac6baaf614cda517a5a2e827a42 | [
"BSD-3-Clause"
] | null | null | null | # vim: set ts=8 sts=4 sw=4 tw=99 et:
#
# This file is part of AMBuild.
#
# AMBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# AMBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with AMBuild. If not, see <http://www.gnu.org/licenses/>.
import os
import re
from ambuild2 import util
from ambuild2.frontend.v2_2.cpp.deptypes import PchNodes
from ambuild2.frontend.v2_2.cpp.vendor import Archiver, Linker, Vendor
# Microsoft Visual C++
class MSVC(Vendor):
def __init__(self, version):
super(MSVC, self).__init__(version)
@property
def name(self):
return 'msvc'
@property
def behavior(self):
return 'msvc'
@property
def family(self):
return 'msvc'
def like(self, name):
return name == 'msvc'
@property
def definePrefix(self):
return '/D'
@property
def objSuffix(self):
return '.obj'
@property
def debugInfoArgv(self):
return ['/Z7']
def makePchArgv(self, source_file, pch_file, source_type):
return ['/showIncludes', '/nologo', '/Yc', '/c', source_file, '/Fp' + pch_file]
def parseDebugInfoType(self, debuginfo):
if debuginfo == 'bundled':
return 'separate'
return debuginfo
def objectArgs(self, sourceFile, objFile):
return ['/showIncludes', '/nologo', '/c', sourceFile, '/Fo' + objFile]
def programLinkArgv(self, cmd_argv, files, linkFlags, symbolFile, outputFile):
argv = cmd_argv + files
argv += ['/link']
argv += linkFlags
argv += [
'/OUT:' + outputFile,
'/nologo',
]
if symbolFile:
argv += ['/DEBUG', '/PDB:"' + symbolFile + '.pdb"']
return argv
def libLinkArgv(self, cmd_argv, files, linkFlags, symbolFile, outputFile):
argv = cmd_argv + files
argv += ['/link']
argv += linkFlags
argv += [
'/OUT:' + outputFile,
'/nologo',
'/DLL',
]
if symbolFile:
argv += ['/DEBUG', '/PDB:"' + symbolFile + '.pdb"']
return argv
def preprocessArgv(self, sourceFile, outFile):
return ['/showIncludes', '/nologo', '/P', '/c', sourceFile, '/Fi' + outFile]
@staticmethod
def IncludePath(output_path, include_path):
assert os.path.isabs(output_path)
output_path = os.path.normcase(output_path)
if not os.path.isabs(include_path):
abs_include_path = os.path.join(output_path, include_path)
else:
abs_include_path = include_path
abs_include_path = os.path.normcase(abs_include_path)
# Hack - try and get a relative path because CL, with either
# /Zi or /ZI, combined with subprocess, apparently tries and
# looks for paths like c:\bleh\"c:\bleh" <-- wtf
# .. this according to Process Monitor
output_drive, _ = os.path.splitdrive(output_path)
include_drive, _ = os.path.splitdrive(abs_include_path)
if output_drive != include_drive:
return os.path.normcase(include_path)
return os.path.relpath(abs_include_path, output_path)
def formatInclude(self, build_root, output_path, include):
return ['/I', MSVC.IncludePath(output_path, include)]
def formatPchInclude(self, build_root, output_path, pch):
folder, header_name = os.path.split(pch.header_file.path)
# Include path calculation expects a path relative to output_path, so
# we need to transform it.
pch_rel_folder = os.path.relpath(os.path.join(build_root, pch.pch_file.path), output_path)
argv = [
'/Fp' + MSVC.IncludePath(output_path, pch_rel_folder),
'/Yu' + header_name,
'/I',
MSVC.IncludePath(output_path, folder),
]
return argv
##
# MSVC-specific properties.
##
@property
def shared_pdb_name(self):
cl_version = int(self.version_string)
# Truncate down to the major version then correct the offset
# There is some evidence that the first digit of the minor version can be used for the PDB, but I can't reproduce it
cl_version = int(cl_version / 100) - 6
# Microsoft introduced a discontinuity with vs2015
if cl_version >= 13:
cl_version += 1
# Pad it back out again
cl_version *= 10
return 'vc{0}.pdb'.format(cl_version)
# cl.exe /showIncludes does not show anything at all for precompiled headers,
# so the only way we can build a proper dependency is by rebuilding every
# source file that *might* use the PCH, whether or not it actually does.
@property
def pch_needs_strong_deps(self):
return True
# cl.exe precompiles source files, technically, not headers. So we need to
# link against something.
@property
def pch_needs_source_file(self):
return True
@property
def shared_pdb_flags(self):
return set(['/Zi', '/ZI'])
def nameForPch(self, source_file):
return os.path.splitext(source_file)[0] + '.pch'
@property
def emits_dependency_file(self):
return False
class MsvcLinker(Linker):
def __init__(self):
super(MsvcLinker, self).__init__()
def like(self, name):
return name == 'msvc'
class MsvcArchiver(Archiver):
def __init__(self):
super(MsvcArchiver, self).__init__()
def like(self, name):
return name == 'msvc'
def makeArgv(self, base_argv, files, outputFile):
return base_argv + ['/OUT:' + outputFile] + files
| 31.42487 | 124 | 0.630998 | 761 | 6,065 | 4.888305 | 0.345598 | 0.037634 | 0.022581 | 0.015323 | 0.203495 | 0.15672 | 0.127688 | 0.103226 | 0.103226 | 0.083333 | 0 | 0.00651 | 0.265458 | 6,065 | 192 | 125 | 31.588542 | 0.828507 | 0.257214 | 0 | 0.355372 | 0 | 0 | 0.052384 | 0 | 0 | 0 | 0 | 0 | 0.008264 | 1 | 0.231405 | false | 0 | 0.041322 | 0.157025 | 0.520661 | 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 |
a347f455c70bd8efd3fcd1cd0f76b70b534fc7a4 | 454 | py | Python | src/python/WMCore/WMBS/Oracle/Subscriptions/KillWorkflow.py | khurtado/WMCore | f74e252412e49189a92962945a94f93bec81cd1e | [
"Apache-2.0"
] | 21 | 2015-11-19T16:18:45.000Z | 2021-12-02T18:20:39.000Z | src/python/WMCore/WMBS/Oracle/Subscriptions/KillWorkflow.py | khurtado/WMCore | f74e252412e49189a92962945a94f93bec81cd1e | [
"Apache-2.0"
] | 5,671 | 2015-01-06T14:38:52.000Z | 2022-03-31T22:11:14.000Z | src/python/WMCore/WMBS/Oracle/Subscriptions/KillWorkflow.py | khurtado/WMCore | f74e252412e49189a92962945a94f93bec81cd1e | [
"Apache-2.0"
] | 67 | 2015-01-21T15:55:38.000Z | 2022-02-03T19:53:13.000Z | #!/usr/bin/env python
"""
_KillWorkflow_
Oracle implementation of Subscriptions.KillWorkflow
"""
from WMCore.WMBS.MySQL.Subscriptions.KillWorkflow import KillWorkflow as MySQLKillWorkflow
class KillWorkflow(MySQLKillWorkflow):
"""
_KillWorkflow_
Mark all files that are not complete/failed and belong to a particular
workflow as failed. Ignore Cleanup and LogCollect subscriptions as we
still want those to run.
"""
pass
| 23.894737 | 90 | 0.759912 | 53 | 454 | 6.433962 | 0.754717 | 0.146628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178414 | 454 | 18 | 91 | 25.222222 | 0.914209 | 0.596916 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
a359e2e5049e17c7f4418bdb5a1b11f1cb2bbab4 | 4,467 | py | Python | tests/test_reflector.py | yuvipanda/kubernetes-informers | b32ebae7350745897e95cf44f5fa149deddec22f | [
"BSD-3-Clause"
] | 2 | 2018-12-02T20:46:06.000Z | 2018-12-03T01:54:11.000Z | tests/test_reflector.py | yuvipanda/kubernetes-informers | b32ebae7350745897e95cf44f5fa149deddec22f | [
"BSD-3-Clause"
] | null | null | null | tests/test_reflector.py | yuvipanda/kubernetes-informers | b32ebae7350745897e95cf44f5fa149deddec22f | [
"BSD-3-Clause"
] | null | null | null | from kubernetes_informers import Reflector, CoalescingQueue
from kubernetes_informers.reflector import Delta
import asyncio
import pytest
from kubernetes_asyncio import client
def make_pod(ns, name, rv):
return client.V1Pod(
metadata=client.V1ObjectMeta(namespace=ns, resource_version=rv, name=name),
)
@pytest.mark.asyncio
async def test_single_changes():
"""
Validate deltas with single object changes only
"""
states = [
# Initial state is empty
[],
# Add pod1
[make_pod('ns', 'pod1', 1) ],
# Add pod2
[
make_pod('ns', 'pod1', 1),
make_pod('ns', 'pod2', 1)
],
# Change pod1
[
make_pod('ns', 'pod1', 2),
make_pod('ns', 'pod2', 1)
],
# Delete pod1
[
make_pod('ns', 'pod2', 1)
],
# Change pod2
[
make_pod('ns', 'pod2', 2)
],
# Delete pod2
[],
]
deltas = [
Delta(type='added', resource=make_pod('ns', 'pod1', 1)),
Delta(type='added', resource=make_pod('ns', 'pod2', 1)),
Delta(type='changed', resource=make_pod('ns', 'pod1', 2)),
Delta(type='deleted', resource=make_pod('ns', 'pod1', 2)),
Delta(type='changed', resource=make_pod('ns', 'pod2', 2)),
Delta(type='deleted', resource=make_pod('ns', 'pod2', 2)),
]
yield_states = iter(states)
async def fake_list_method(namespace, *args, **kwargs):
assert namespace == 'ns'
state = next(yield_states)
return client.V1PodList(items=state)
q = CoalescingQueue()
r = Reflector(q, fake_list_method, 'ns', resync_period=0.1)
reflect_future = asyncio.ensure_future(r.reflect())
for expected_delta in deltas:
delta = await q.get()
assert delta == expected_delta
reflect_future.cancel()
@pytest.mark.asyncio
async def test_multiple_changes():
"""
Validate deltas with single object changes only
"""
states = [
# Initial state is empty
[],
# Add two pods
[
make_pod('ns', 'pod1', 1),
make_pod('ns', 'pod2', 1)
],
# Change pod1
[
make_pod('ns', 'pod1', 2),
make_pod('ns', 'pod2', 1)
],
# Delete pod1
[
make_pod('ns', 'pod2', 1)
],
# Change pod2
[
make_pod('ns', 'pod2', 2)
],
# Add pod3 and pod4
[
make_pod('ns', 'pod2', 2),
make_pod('ns', 'pod3', 1),
make_pod('ns', 'pod4', 1),
],
# Change pod3 and pod4
[
make_pod('ns', 'pod2', 2),
make_pod('ns', 'pod3', 2),
make_pod('ns', 'pod4', 2),
],
# Delete all pods
[],
]
delta_batches = [
[
Delta(type='added', resource=make_pod('ns', 'pod1', 1)),
Delta(type='added', resource=make_pod('ns', 'pod2', 1)),
],
[
Delta(type='changed', resource=make_pod('ns', 'pod1', 2)),
],
[
Delta(type='deleted', resource=make_pod('ns', 'pod1', 2)),
],
[
Delta(type='changed', resource=make_pod('ns', 'pod2', 2)),
],
[
Delta(type='added', resource=make_pod('ns', 'pod3', 1)),
Delta(type='added', resource=make_pod('ns', 'pod4', 1)),
],
[
Delta(type='changed', resource=make_pod('ns', 'pod3', 2)),
Delta(type='changed', resource=make_pod('ns', 'pod4', 2)),
],
[
Delta(type='deleted', resource=make_pod('ns', 'pod2', 2)),
Delta(type='deleted', resource=make_pod('ns', 'pod3', 2)),
Delta(type='deleted', resource=make_pod('ns', 'pod4', 2)),
]
]
yield_states = iter(states)
async def fake_list_method(namespace, *args, **kwargs):
assert namespace == 'ns'
state = next(yield_states)
return client.V1PodList(items=state)
q = CoalescingQueue()
r = Reflector(q, fake_list_method, 'ns', resync_period=0.1)
reflect_future = asyncio.ensure_future(r.reflect())
for delta_batch in delta_batches:
while len(delta_batch) != 0:
delta = await q.get()
assert delta in delta_batch
delta_batch.remove(delta)
reflect_future.cancel()
| 27.404908 | 83 | 0.513768 | 503 | 4,467 | 4.415507 | 0.170974 | 0.119766 | 0.153985 | 0.137776 | 0.785232 | 0.760018 | 0.707789 | 0.697884 | 0.633949 | 0.633949 | 0 | 0.032096 | 0.330423 | 4,467 | 162 | 84 | 27.574074 | 0.710465 | 0.048131 | 0 | 0.57377 | 0 | 0 | 0.083739 | 0 | 0 | 0 | 0 | 0 | 0.032787 | 1 | 0.008197 | false | 0 | 0.040984 | 0.008197 | 0.07377 | 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 |
a388ad1a4fbf65486325ab924892693b3f2e1f77 | 296 | py | Python | accounts/forms.py | knyghty/bord | b5c607a6d4ee05255d8e6e77a531b0481966860b | [
"MIT"
] | null | null | null | accounts/forms.py | knyghty/bord | b5c607a6d4ee05255d8e6e77a531b0481966860b | [
"MIT"
] | 4 | 2016-11-05T02:53:02.000Z | 2018-01-13T19:57:24.000Z | accounts/forms.py | knyghty/bord | b5c607a6d4ee05255d8e6e77a531b0481966860b | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model
from django.contrib.auth.forms import UserCreationForm
class UserCreationForm(UserCreationForm):
"""A form that creates a user."""
class Meta(UserCreationForm.Meta):
model = get_user_model()
fields = ('username', 'email')
| 26.909091 | 54 | 0.722973 | 35 | 296 | 6 | 0.542857 | 0.095238 | 0.161905 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175676 | 296 | 10 | 55 | 29.6 | 0.860656 | 0.091216 | 0 | 0 | 0 | 0 | 0.04943 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
6e6338830a60df5dff718e760d90f65b2cf8baf7 | 488 | py | Python | benri/cloudpickle_wrapper.py | MaxOSmith/benri | ef3333adc8f4c5680b8f5a8cac225eb25bb713fa | [
"MIT"
] | null | null | null | benri/cloudpickle_wrapper.py | MaxOSmith/benri | ef3333adc8f4c5680b8f5a8cac225eb25bb713fa | [
"MIT"
] | null | null | null | benri/cloudpickle_wrapper.py | MaxOSmith/benri | ef3333adc8f4c5680b8f5a8cac225eb25bb713fa | [
"MIT"
] | null | null | null | """ Class to serialize data for multiprocessing.
Inspired by: https://github.com/openai/baselines/blob/master/baselines/common/vec_env/__init__.py
"""
import cloudpickle
import pickle
class CloudpickleWrapper(object):
""" Uses `cloudpickle` to serialize contents. """
def __init__(self, data):
self.data = data
def __getstate__(self):
return cloudpickle.dumps(self.x)
def __setstate__(self, data):
self.data = pickle.loads(data)
| 23.238095 | 97 | 0.684426 | 57 | 488 | 5.561404 | 0.614035 | 0.100946 | 0.07571 | 0.100946 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202869 | 488 | 21 | 98 | 23.238095 | 0.81491 | 0.381148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.222222 | 0.111111 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6e9cbc7c946be4354e3e7bc9dce1aeb5f37fd2b9 | 829 | py | Python | src/fpm_tablut_player/utils/timer.py | contimatteo/PMF-Tablut-Player | 9886583d2027beb2c0941c753f78bfb42ba8ae36 | [
"MIT"
] | null | null | null | src/fpm_tablut_player/utils/timer.py | contimatteo/PMF-Tablut-Player | 9886583d2027beb2c0941c753f78bfb42ba8ae36 | [
"MIT"
] | null | null | null | src/fpm_tablut_player/utils/timer.py | contimatteo/PMF-Tablut-Player | 9886583d2027beb2c0941c753f78bfb42ba8ae36 | [
"MIT"
] | null | null | null | import time
###
class Timer:
start_time: float
def __init__(self):
self.start_time = None
def start(self):
if self.start_time is not None:
raise Exception(f"Timer is running. Use .stop() to stop it")
self.start_time = time.perf_counter()
return self
def stop(self):
if self.start_time is None:
raise Exception(f"Timer is not running. Use .start() to start it")
self.start_time = None
return self
def get_elapsed_time(self) -> float:
if self.start_time is None:
raise Exception(f"Timer is not running. Use .start() to start it")
return time.perf_counter() - self.start_time
def get_time_left(self, threshold: float) -> float:
return float(threshold) - self.get_elapsed_time()
| 22.405405 | 78 | 0.618818 | 116 | 829 | 4.25 | 0.241379 | 0.146045 | 0.184584 | 0.091278 | 0.387424 | 0.387424 | 0.283976 | 0.283976 | 0.283976 | 0.283976 | 0 | 0 | 0.289505 | 829 | 36 | 79 | 23.027778 | 0.837012 | 0 | 0 | 0.380952 | 0 | 0 | 0.159806 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.047619 | 0.047619 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6ede655702f64d649af56d2fc654df5d03ded272 | 141 | py | Python | src/__init__.py | LeRyc/Robust-Robotic-Manipulation | 0463c55bd689081c119f1fc024f4c22704f91c6f | [
"MIT"
] | 1 | 2020-12-07T08:39:52.000Z | 2020-12-07T08:39:52.000Z | src/__init__.py | LeRyc/Robust-Robotic-Manipulation | 0463c55bd689081c119f1fc024f4c22704f91c6f | [
"MIT"
] | null | null | null | src/__init__.py | LeRyc/Robust-Robotic-Manipulation | 0463c55bd689081c119f1fc024f4c22704f91c6f | [
"MIT"
] | null | null | null | """Collects all defined and implemented observer modules."""
from src.observer.base_observer import BaseObserver
__all__ = ["BaseObserver"] | 28.2 | 60 | 0.794326 | 16 | 141 | 6.6875 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106383 | 141 | 5 | 61 | 28.2 | 0.849206 | 0.382979 | 0 | 0 | 0 | 0 | 0.146341 | 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 |
6eecfea751f48d2adef3410970f44b6f0a6f4f45 | 327 | py | Python | main.py | kalDima1218/schet-drevnih-shizov | 8656d55044201900106379d9897df8fbca160156 | [
"Unlicense"
] | null | null | null | main.py | kalDima1218/schet-drevnih-shizov | 8656d55044201900106379d9897df8fbca160156 | [
"Unlicense"
] | null | null | null | main.py | kalDima1218/schet-drevnih-shizov | 8656d55044201900106379d9897df8fbca160156 | [
"Unlicense"
] | null | null | null | chislo = input()
chislo_na_schote_drevnih_shizov = ""
cifri_scheta_drevnih_shizov = "ноль, целковый, чекушка, порнушка, пердушка, засирушка, жучок, мудачок, хуй на воротничок, дурачок, ВСЕ".split(", ")
for i in chislo: chislo_na_schote_drevnih_shizov+=cifri_scheta_drevnih_shizov[int(i)]
print(chislo_na_schote_drevnih_shizov)
| 54.5 | 147 | 0.810398 | 46 | 327 | 5.369565 | 0.586957 | 0.263158 | 0.17004 | 0.255061 | 0.522267 | 0.412955 | 0.412955 | 0.412955 | 0.412955 | 0 | 0 | 0 | 0.085627 | 327 | 5 | 148 | 65.4 | 0.826087 | 0 | 0 | 0 | 0 | 0.2 | 0.321101 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 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 |
42f1424c56aba2d5f33c118be4a2c8865d3e722a | 1,044 | py | Python | external/glbinding-1.1.0/codegeneration/scripts/binding.py | matparsa/Fahim | baccbd9c68fed6a315bf77e7141e4f7af8ea92d5 | [
"MIT"
] | 2 | 2021-10-09T03:47:42.000Z | 2022-02-06T06:34:31.000Z | Examples/Effect/GLator/glbinding/codegeneration/scripts/binding.py | richardlalancette/AfterEffectsExperimentations | 5eae44e81c867ee44d00f88aaefaef578f7c3de7 | [
"MIT"
] | null | null | null | Examples/Effect/GLator/glbinding/codegeneration/scripts/binding.py | richardlalancette/AfterEffectsExperimentations | 5eae44e81c867ee44d00f88aaefaef578f7c3de7 | [
"MIT"
] | null | null | null |
import os, sys
templatedir = "templates/"
tab = " "
tab2 = tab + tab
execdir = os.path.dirname(os.path.abspath(sys.argv[0])) + "/"
def versionBID(feature, core = False, ext = False):
if feature is None:
return ""
version = str(feature.major) + str(feature.minor)
if core:
return version + "core"
elif ext:
return version + "ext"
return version
def template(outputfile):
with open (execdir + templatedir + outputfile + ".in", "r") as file:
return file.read()
class Status:
targetdir = ""
def status(file):
print("generating " + file.replace(Status.targetdir, ""))
# enum_binding_name_exceptions = [ "DOMAIN", "MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", "FALSE", "TRUE", "NO_ERROR", "WAIT_FAILED" ]
def enumBID(enum):
return enum.name
# extension_binding_name_exceptions = [ ]
# ToDo: discuss - just use name for glbinding?
def extensionBID(extension):
return extension.name
def functionBID(function):
return function.name
| 18 | 127 | 0.638889 | 123 | 1,044 | 5.317073 | 0.569106 | 0.079511 | 0.04893 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002509 | 0.23659 | 1,044 | 57 | 128 | 18.315789 | 0.818068 | 0.201149 | 0 | 0 | 0 | 0 | 0.044632 | 0 | 0 | 0 | 0 | 0.017544 | 0 | 1 | 0.222222 | false | 0 | 0.037037 | 0.111111 | 0.62963 | 0.037037 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
6e22a0a89dda2bc2488bfe28f191e1e1be113b7b | 694 | py | Python | board/field.py | dwaffe/connect4deepLearning | 167c26a3f4f7040ca714c4bdb1c14bfb51c64d9e | [
"MIT"
] | null | null | null | board/field.py | dwaffe/connect4deepLearning | 167c26a3f4f7040ca714c4bdb1c14bfb51c64d9e | [
"MIT"
] | null | null | null | board/field.py | dwaffe/connect4deepLearning | 167c26a3f4f7040ca714c4bdb1c14bfb51c64d9e | [
"MIT"
] | null | null | null | from .piece import Piece
from typing import Optional
from colorama import init
from termcolor import colored
init()
class Field:
def __init__(self, piece: Optional[Piece] = None) -> None:
self._piece = piece
def get_piece(self) -> Optional[Piece]:
return self._piece
def put_piece(self, piece: Piece):
self._piece = piece
def __str__(self) -> str:
if self._piece is not None:
return colored(self._piece.get_sign(), self._piece.get_color())
else:
return ' '
def is_sign(self, sign: str):
if self._piece is None:
return False
return self._piece.get_sign() == sign | 23.133333 | 75 | 0.610951 | 89 | 694 | 4.516854 | 0.280899 | 0.223881 | 0.104478 | 0.084577 | 0.079602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.295389 | 694 | 30 | 76 | 23.133333 | 0.822086 | 0 | 0 | 0.095238 | 0 | 0 | 0.001439 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.190476 | 0.047619 | 0.714286 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6e51e1a1628148b4ac7ab7831f710895fda4ab90 | 265 | py | Python | URI/1-Beginner/1012.py | vicenteneto/online-judge-solutions | 4176e2387658f083b980d7b49bc98300a4c28411 | [
"MIT"
] | null | null | null | URI/1-Beginner/1012.py | vicenteneto/online-judge-solutions | 4176e2387658f083b980d7b49bc98300a4c28411 | [
"MIT"
] | null | null | null | URI/1-Beginner/1012.py | vicenteneto/online-judge-solutions | 4176e2387658f083b980d7b49bc98300a4c28411 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
a, b, c = [float(x) for x in raw_input().split()]
print 'TRIANGULO: %.3f' % (a * c / 2)
print 'CIRCULO: %.3f' % (3.14159 * c * c)
print 'TRAPEZIO: %.3f' % ((a + b) * c / 2)
print 'QUADRADO: %.3f' % (b * b)
print 'RETANGULO: %.3f' % (a * b)
| 29.444444 | 49 | 0.50566 | 44 | 265 | 3.022727 | 0.522727 | 0.045113 | 0.045113 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.067633 | 0.218868 | 265 | 8 | 50 | 33.125 | 0.574879 | 0.079245 | 0 | 0 | 0 | 0 | 0.293388 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.833333 | 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 | 0 | 0 | 0 | 1 | 0 | 3 |
2858e465ed1704ea997daa3d55bf628a15205556 | 2,643 | py | Python | ScriptGeneratorPython/generateScript.py | JakeChapeskie/MyoScripts | ff2efaaaf8d771b255c865845dd930ba2ef3e839 | [
"MIT"
] | 4 | 2015-01-27T00:37:26.000Z | 2016-05-11T13:31:16.000Z | ScriptGeneratorPython/generateScript.py | JakeChapeskie/MyoScripts | ff2efaaaf8d771b255c865845dd930ba2ef3e839 | [
"MIT"
] | null | null | null | ScriptGeneratorPython/generateScript.py | JakeChapeskie/MyoScripts | ff2efaaaf8d771b255c865845dd930ba2ef3e839 | [
"MIT"
] | 5 | 2015-03-17T20:26:50.000Z | 2020-02-12T11:25:09.000Z | #Generates Scripts for Myo
#Jake Chapeskie
#2014
import argparse
DEBUG_MODE=False #Set to true for extra print outputs
def debugPrint(s):
if DEBUG_MODE==True:
print(s)
return
def keyTwoMyo(key):
#TODO: Add special character parsing
str='myo.keyboard("'+key+'","press")'
return str
# parse Command Line inputs
parser = argparse.ArgumentParser(description='Program to generate lua scripts for Myo')
parser.add_argument('-i','--inFile', help='Specifies Template File to use', required=False)
parser.add_argument('-o','--outFile', help='Specifies the filename of the generated script', required=True)
parser.add_argument('-title','--appTitle', help='Specifies the Window name to activate the script on', required=True)
parser.add_argument('-waveIn','--waveIn', help='Command to map to waveIn', required=False)
parser.add_argument('-waveOut','--waveOut', help='Command to map to waveOut', required=False)
parser.add_argument('-fingersSpread','--fingersSpread', help='Command to map to fingersSpread', required=False)
parser.add_argument('-fist','--fist', help='Command to map to fist', required=False)
args = vars(parser.parse_args())
debugPrint(args)
#set file names
if args['inFile'] == None:
#use default Template
print 'Using Default Template'
inputFileName='luaTemplateSimple.lua'
else:
inputFileName=args['inFile']
print 'Using Template from '+inputFileName
debugPrint('IN:'+inputFileName)
#redundant since required, might add check for .lua extension
if args['outFile'] == None:
outFileName='luaTemplateSimple.lua'
else:
outFileName=args['outFile']
print 'Outputing Script to '+outFileName
#open template
file= open(inputFileName, 'r')
templateData= file.read()
tmp=templateData
file.close()
#add mappings
if args['waveIn'] != None:
tmp=tmp.replace("--PLACEHOLDER:WAVEIN", keyTwoMyo(args['waveIn']));
if args['waveOut'] != None:
tmp=tmp.replace("--PLACEHOLDER:WAVEOUT", keyTwoMyo(args['waveOut']));
if args['fingersSpread'] != None:
tmp=tmp.replace("--PLACEHOLDER:FINGERSSPREAD", keyTwoMyo(args['fingersSpread']));
if args['fist'] != None:
tmp=tmp.replace("--PLACEHOLDER:FIST", keyTwoMyo(args['fist']));
if args['appTitle'] != None:
tmp=tmp.replace("PLACEHOLDER:TITLE", args['appTitle']);
#Clean up some script stuff
#change ScriptId
ScriptId=args['appTitle']
debugPrint(ScriptId)
tmp=tmp.replace("'com.thalmic.generated'", "'com.thalmic."+ScriptId+"'");
tmp=tmp.replace("--TEMPLATE FOR SCRIPT GENERATION, DO NOT MODIFY","")
#Any Changes to the file contents after the file write won't be applied
#write out to file
outfile=open(outFileName,'w')
outfile.write(tmp)
outfile.close()
print 'Complete'
| 34.776316 | 117 | 0.740068 | 351 | 2,643 | 5.54416 | 0.344729 | 0.032374 | 0.061151 | 0.043679 | 0.200411 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001688 | 0.10367 | 2,643 | 75 | 118 | 35.24 | 0.819755 | 0.146046 | 0 | 0.037736 | 1 | 0 | 0.363515 | 0.050401 | 0 | 0 | 0 | 0.013333 | 0 | 0 | null | null | 0 | 0.018868 | null | null | 0.09434 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
288e50b8e67aa3e78a182d58f80bf9d7589ab275 | 346 | py | Python | exercises/005_Tuplas/tuple_002.py | Kike-Ramirez/intro-py-td | c117ef7b645add0987593f2ff3eb5bb97724e8d9 | [
"MIT"
] | null | null | null | exercises/005_Tuplas/tuple_002.py | Kike-Ramirez/intro-py-td | c117ef7b645add0987593f2ff3eb5bb97724e8d9 | [
"MIT"
] | null | null | null | exercises/005_Tuplas/tuple_002.py | Kike-Ramirez/intro-py-td | c117ef7b645add0987593f2ff3eb5bb97724e8d9 | [
"MIT"
] | null | null | null | # Python INTRO for TD Users
# Kike Ramírez
# May, 2018
# Understanding Tuples
# Tuples comparison
#case 1
a=(5,6)
b=(1,4)
if (a>b):print("a is bigger")
else: print("b is bigger")
#case 2
a=(5,6)
b=(5,4)
if (a>b):print("a is bigger")
else: print ("b is bigger")
#case 3
a=(5,6)
b=(6,4)
if (a>b):print("a is bigger")
else: print("b is bigger") | 13.84 | 29 | 0.621387 | 73 | 346 | 2.945205 | 0.356164 | 0.223256 | 0.04186 | 0.055814 | 0.553488 | 0.553488 | 0.553488 | 0.553488 | 0.553488 | 0.553488 | 0 | 0.066202 | 0.17052 | 346 | 25 | 30 | 13.84 | 0.682927 | 0.303468 | 0 | 0.75 | 0 | 0 | 0.283262 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
953c6d676b05361706ad480aebd1e13ad0db53c9 | 1,586 | py | Python | aiotdlib/api/types/mask_position.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 37 | 2021-05-04T10:41:41.000Z | 2022-03-30T13:48:05.000Z | aiotdlib/api/types/mask_position.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 13 | 2021-07-17T19:54:51.000Z | 2022-02-26T06:50:00.000Z | aiotdlib/api/types/mask_position.py | jraylan/aiotdlib | 4528fcfca7c5c69b54a878ce6ce60e934a2dcc73 | [
"MIT"
] | 7 | 2021-09-22T21:27:11.000Z | 2022-02-20T02:33:19.000Z | # =============================================================================== #
# #
# This file has been generated automatically!! Do not change this manually! #
# #
# =============================================================================== #
from __future__ import annotations
from pydantic import Field
from .mask_point import MaskPoint
from ..base_object import BaseObject
class MaskPosition(BaseObject):
"""
Position on a photo where a mask is placed
:param point: Part of the face, relative to which the mask is placed
:type point: :class:`MaskPoint`
:param x_shift: Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position)
:type x_shift: :class:`float`
:param y_shift: Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. (For example, 1.0 will place the mask just below the default mask position)
:type y_shift: :class:`float`
:param scale: Mask scaling coefficient. (For example, 2.0 means a doubled size)
:type scale: :class:`float`
"""
ID: str = Field("maskPosition", alias="@type")
point: MaskPoint
x_shift: float
y_shift: float
scale: float
@staticmethod
def read(q: dict) -> MaskPosition:
return MaskPosition.construct(**q)
| 38.682927 | 197 | 0.546658 | 186 | 1,586 | 4.596774 | 0.435484 | 0.040936 | 0.02807 | 0.035088 | 0.210526 | 0.149708 | 0.149708 | 0.149708 | 0.149708 | 0 | 0 | 0.00531 | 0.287516 | 1,586 | 40 | 198 | 39.65 | 0.751327 | 0.692938 | 0 | 0 | 1 | 0 | 0.041667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.307692 | 0.076923 | 0.923077 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
9545069fad3e7afab3f20d2b033815095133fb0b | 279 | py | Python | proj/ud120-projects/choose_your_own/test.py | askldjd/udacity-machine-learning | 0defdfc09fb21ad5de31df4caf3fe1e6e1f9fa1b | [
"MIT"
] | 2 | 2017-09-22T21:13:07.000Z | 2020-07-06T11:30:19.000Z | proj/ud120-projects/choose_your_own/test.py | askldjd/udacity-machine-learning | 0defdfc09fb21ad5de31df4caf3fe1e6e1f9fa1b | [
"MIT"
] | null | null | null | proj/ud120-projects/choose_your_own/test.py | askldjd/udacity-machine-learning | 0defdfc09fb21ad5de31df4caf3fe1e6e1f9fa1b | [
"MIT"
] | 13 | 2017-02-07T06:46:52.000Z | 2021-11-04T20:29:41.000Z | from sklearn.cross_validation import cross_val_score
from sklearn.datasets import load_iris
from sklearn.ensemble import AdaBoostClassifier
iris = load_iris()
clf = AdaBoostClassifier(n_estimators=100)
scores = cross_val_score(clf, iris.data, iris.target)
print scores.mean() | 39.857143 | 53 | 0.827957 | 39 | 279 | 5.717949 | 0.538462 | 0.147982 | 0.116592 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011952 | 0.100358 | 279 | 7 | 54 | 39.857143 | 0.876494 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
954fa77199df153eea3b9c972b0a7bdc533cbedd | 1,583 | py | Python | warmup_1/parrot_trouble.py | nhutnamhcmus/coding-bat-solutions | 5f780a4027a6c3523a72961db1bad547c997fdc6 | [
"MIT"
] | 1 | 2020-09-19T18:02:13.000Z | 2020-09-19T18:02:13.000Z | warmup_1/parrot_trouble.py | nhutnamhcmus/coding-bat-solutions | 5f780a4027a6c3523a72961db1bad547c997fdc6 | [
"MIT"
] | null | null | null | warmup_1/parrot_trouble.py | nhutnamhcmus/coding-bat-solutions | 5f780a4027a6c3523a72961db1bad547c997fdc6 | [
"MIT"
] | null | null | null | # =======================================================================================================================================
# VNU-HCM, University of Science
# Department Computer Science, Faculty of Information Technology
# Authors: Nhut-Nam Le (Tich Phan Suy Rong)
# © 2020
"""
We have a loud talking parrot. The "hour" parameter is the current hour time in the range 0..23. We are in trouble if the parrot is talking and the hour is before 7 or after 20. Return True if we are in trouble.
parrot_trouble(True, 6) → True
parrot_trouble(True, 7) → False
parrot_trouble(False, 6) → False
"""
import unittest
def parrot_trouble(talking, hour):
return (False, (hour < 7 or hour > 20))[talking]
class MyTest(unittest.TestCase):
def test_case_00(self):
self.assertEqual(parrot_trouble(True, 6), True)
def test_case_01(self):
self.assertEqual(parrot_trouble(True, 7), False)
def test_case_03(self):
self.assertEqual(parrot_trouble(False, 6), False)
def test_case_04(self):
self.assertEqual(parrot_trouble(False, 21), False)
def test_case_05(self):
self.assertEqual(parrot_trouble(False, 20), False)
def test_case_06(self):
self.assertEqual(parrot_trouble(True, 23), True)
def test_case_07(self):
self.assertEqual(parrot_trouble(False, 23), False)
def test_case_08(self):
self.assertEqual(parrot_trouble(True, 20), False)
def test_case_09(self):
self.assertEqual(parrot_trouble(False, 12), False)
if __name__ == "__main__":
unittest.main()
| 28.267857 | 211 | 0.637397 | 216 | 1,583 | 4.509259 | 0.337963 | 0.173511 | 0.101643 | 0.231006 | 0.374743 | 0.337782 | 0 | 0 | 0 | 0 | 0 | 0.03775 | 0.180038 | 1,583 | 55 | 212 | 28.781818 | 0.709553 | 0.372078 | 0 | 0 | 0 | 0 | 0.008155 | 0 | 0 | 0 | 0 | 0 | 0.375 | 1 | 0.416667 | false | 0 | 0.041667 | 0.041667 | 0.541667 | 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 |
958636b454316d848d5150db80beae3090a99bd1 | 566 | py | Python | gloop/clients/match.py | pitzer42/nano_tcg | c984b253b8a53a707460aac21c10f140d16d902e | [
"MIT"
] | 1 | 2020-09-30T21:03:37.000Z | 2020-09-30T21:03:37.000Z | gloop/clients/match.py | pitzer42/nano_tcg | c984b253b8a53a707460aac21c10f140d16d902e | [
"MIT"
] | null | null | null | gloop/clients/match.py | pitzer42/nano_tcg | c984b253b8a53a707460aac21c10f140d16d902e | [
"MIT"
] | null | null | null | from abc import ABC
from gloop.entities.match import Match
from gloop.entities.player import Player
class MatchClient(ABC):
async def wait_notification(self):
raise NotImplementedError()
async def notify_new_player_join(self, player: Player):
raise NotImplementedError()
async def notify_match_start(self, match: Match):
raise NotImplementedError()
async def notify_play(self, player: Player):
raise NotImplementedError()
async def notify_game_over(self, match: Match):
raise NotImplementedError()
| 24.608696 | 59 | 0.726148 | 66 | 566 | 6.090909 | 0.348485 | 0.099502 | 0.288557 | 0.318408 | 0.587065 | 0.268657 | 0.268657 | 0.268657 | 0 | 0 | 0 | 0 | 0.20318 | 566 | 22 | 60 | 25.727273 | 0.891353 | 0 | 0 | 0.357143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.214286 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
95a59a1231001450442e7f01d79b3fc7c03a0fd0 | 93 | py | Python | telegram_bot_sdk/exceptions/message_exception.py | myOmikron/TelegramBotSDK | 526d1e276e5b37955b32772554f3682767ceeff2 | [
"MIT"
] | null | null | null | telegram_bot_sdk/exceptions/message_exception.py | myOmikron/TelegramBotSDK | 526d1e276e5b37955b32772554f3682767ceeff2 | [
"MIT"
] | null | null | null | telegram_bot_sdk/exceptions/message_exception.py | myOmikron/TelegramBotSDK | 526d1e276e5b37955b32772554f3682767ceeff2 | [
"MIT"
] | null | null | null | class MessageError:
def __init__(self):
print("Message Result \"ok\" was False")
| 23.25 | 48 | 0.645161 | 11 | 93 | 5.090909 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.225806 | 93 | 3 | 49 | 31 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0.27957 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
95c9c1e342ed126da8d18ace24907dfd8e20d15f | 1,657 | py | Python | server/controllers/score_controller.py | KohlbacherLab/deregnet-rest | d512e04b66556fbb52a49e9da465af01ebfdd78a | [
"BSD-3-Clause"
] | null | null | null | server/controllers/score_controller.py | KohlbacherLab/deregnet-rest | d512e04b66556fbb52a49e9da465af01ebfdd78a | [
"BSD-3-Clause"
] | null | null | null | server/controllers/score_controller.py | KohlbacherLab/deregnet-rest | d512e04b66556fbb52a49e9da465af01ebfdd78a | [
"BSD-3-Clause"
] | 1 | 2018-01-30T18:38:56.000Z | 2018-01-30T18:38:56.000Z | import connexion
import six
from deregnet_rest.models.score import Score # noqa: E501
from deregnet_rest.models.score_info import ScoreInfo # noqa: E501
from deregnet_rest import util
from deregnet_rest.controllers_impl.scores import ScoreController
def delete_score(score_id): # noqa: E501
"""Delete a previously uploaded node score
Delete a previously uploaded node score # noqa: E501
:param score_id: ID of the node score to be deleted
:type score_id: str
:rtype: None
"""
return ScoreController.delete_score(score_id)
def get_score(score_id): # noqa: E501
"""Retrieve information on a previously uploaded score
# noqa: E501
:param score_id: ID of node score to return
:type score_id: str
:rtype: ScoreInfo
"""
return ScoreController.get_score(score_id)
def get_scores(skip=0, limit=1000): # noqa: E501
"""List available previously uploaded node scores
Returns a list with all available node scores # noqa: E501
:param skip: number of records to skip for pagination
:type skip: int
:param limit: maximum number of records to return
:type limit: int
:rtype: List[ScoreInfo]
"""
return ScoreController.get_scores(skip, limit)
def post_score(body): # noqa: E501
"""Upload a node score for use with DeRegNet algorithms
# noqa: E501
:param body: Node scores to be uploaded for later use with a DeRegNet algorithm
:type body: dict | bytes
:rtype: ScoreInfo
"""
if connexion.request.is_json:
body = Score.from_dict(connexion.request.get_json()) # noqa: E501
return ScoreController.post_score(body)
| 25.492308 | 83 | 0.709716 | 231 | 1,657 | 4.982684 | 0.290043 | 0.076455 | 0.055604 | 0.038228 | 0.278888 | 0.105126 | 0.050391 | 0.050391 | 0 | 0 | 0 | 0.029276 | 0.216657 | 1,657 | 64 | 84 | 25.890625 | 0.857473 | 0.526252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.375 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
95d2319e790eb4abde92afa3b9493c26265afe89 | 8,733 | py | Python | r-net.py | gypleon/SQuAD | 792301271e533b02b0d9282ba3a9eaef8fff3c57 | [
"MIT"
] | null | null | null | r-net.py | gypleon/SQuAD | 792301271e533b02b0d9282ba3a9eaef8fff3c57 | [
"MIT"
] | null | null | null | r-net.py | gypleon/SQuAD | 792301271e533b02b0d9282ba3a9eaef8fff3c57 | [
"MIT"
] | null | null | null | import tensorflow as tf
import numpy as np
from word_embedding import WORD_EMBEDDING as WE
class R_NET(object):
'''
refer to
R-NET: Machine Reading Comprehension with Self-matching Networks
Natural Language Computing Group, Microsoft Research Asia
https://www.microsoft.com/en-us/research/publication/mrc/
'''
def __init__(self, path_dataset, path_vocab, batch_size = 1, train = True, dimension_word_embeddings = 300,
length_gru_state = 75, length_attention_state = 75, learning_rate = 1, dropout_keep_prob = 0.8,
rho = .95, epsilon = 1e-6):
self.path_ds = path_dataset
self.vocab = WE(path_vocab, dimension_word_embeddings)
self.batch_size = batch_size
self.len_gs = length_gru_state
self.len_as = length_attention_state
self.lr = learning_rate
self.keep_prob = dropout_keep_prob
self.rho = rho
self.eps = epsilon
self.graph = self.build()
@property
def answers(self):
return self.answers
def build(self, scope = 'rnet'):
''' build model graph
input:
questions: a batch of questions, []
passages: a batch of corresponding passage ids, recover passages from ids in order to reduce duplicated passage
copies in memory
answers: a batch of corresponding answers
output:
self.answers: predicted answers, [start_pointer, end_pointer]
self.losses: losses between predicted and target answers
'''
with tf.variable_scope(scope):
# placeholders
questions = tf.placeholder(tf.int32, shape=[self.batch_size, self.sequence_length, ])
passages = tf.placeholder()
# question and passage encoder
u_Q = self.encode(questions)
u_P = self.encode(passages)
# gated attention-based rnn
gated_u_P = self.gated_attn(u_Q, u_P)
# self-matching attention
h_P = self.self_matching_attn(gated_u_P)
# output layer - pointer networks
self.answers = output_layer(h_P, u_Q)
self.losses = tf.losses.softmax_cross_entropy(answers, self.answers)
return
def inference(self):
''' inference
input:
inputs: tuples of passage, question and answer: (passage, question, truth)
output:
losses:
'''
passages = tf.slice(inputs, [], [])
questions = tf.slice(inputs, [], [])
truths = tf.slice(inputs, [], [])
return self.answers, self.losses
def train(self):
optimizer = tf.train.AdadeltaOptimizer(learning_rate = self.lr, beta1 = self.rho, epsilon = self.eps)
optimizer.minimize(self.losses)
def encode(self, words):
''' encode token sequence as a list of new token representations
input:
words: list of tokens
output:
representations: list of final representations
'''
# TODO: new biRNN for each word? how to batch words for embedding?
# build graph for the longest word, traverse corpus in advance?
sequence = [self.embedding(word) for word in words]
outputs = self.bidirectionalGRU(sequence, 3)
representations = tf.squeeze(outputs)
return representations
def gated_attn(self, seq_1, seq_2, num_units = self.len_gs, scope = 'GatedAttn'):
''' gated attention for seq_2 w.r.t seq_1
input:
seq_1: query sequence in attention mechanism
seq_2: encoder sequence in attention mechanism
output:
outputs:
v_P:
context:
'''
u_Q = seq_1
u_P = seq_2
cell = self.GRUCellGPU(num_units)
with tf.variable_scope(scope):
attn_v = tf.get_variable('attn_v', [num_units])
w_u_Q = tf.get_variable('weight_ques')
w_u_P = tf.get_variable('weight_pass_orig')
w_v_P = tf.get_variable('weight_pass_ques')
v_P = tf.get_variable('embedding_pass_ques')
score = tf.reduce_sum(attn_v * tf.tanh(w_u_Q * u_Q + w_u_P * u_P + w_v_P * v_P), [2]) # scores of all tokens
alignments = tf.softmax(score)
alignments = tf.expand_dims(alignments, 1)
u_Q = tf.expand_dims(u_Q, 1)
context = tf.reduce_sum(tf.matmul(alignments, u_Q, transpose_b=True), [2])
# gate
inputs = tf.concat([u_Q, context], 1)
w_g = tf.get_variable('weight_gate')
g = tf.sigmoid(tf.reduce_sum(w_g * inputs))
gated_inputs = g * inputs
outputs, v_P = cell(gated_inputs, v_P)
return outputs, v_P
def self_matching_attn(self, seq, scope = 'SelfMatchAttn'):
''' self-matching attention of seq
input:
output:
'''
v_P = seq
with tf.variable_scope(scope):
attn_v = tf.get_variable('attn_v')
w_v_P = tf.get_variable('weight_passage')
w_v_P_w = tf.get_variable('weight_passage_wave')
score = tf.reduce_sum(attn_v * tf.tanh(w_v_P * v_P + w_v_P_w * v_P), [2]) # scores for all tokens
alignments = tf.softmax(score)
alignments = tf.expand_dims(alignments, 1)
v_P = tf.expand_dims(u_Q, 1)
context = tf.reduce_sum(tf.matmul(alignments, v_P, transpose_b=True), [2])
inputs = tf.concat([seq, context], 1)
outputs = self.bidirectionalGRU(inputs, 1)
h_P = outputs
return h_P
def output_layer(self, seq_1, seq_2, scope = 'PointerNetwork'):
h_P = seq_1
u_Q = seq_2
cell = self.GRUCellGPU(num_units)
with tf.variable_scope(scope):
# initialize hidden state of answer
attn_v_a = tf.get_varialbe('attn_v')
w_u_Q = tf.get_varialbe('weight_passage')
w_v_Q = tf.get_varialbe('weight_answer')
V_Q = tf.get_varialbe('weight_answer')
score_a = tf.reduce_sum(attn_v_a * tf.tanh(w_u_Q * u_Q + w_a * h_a), [2]) # scores for all tokens
alignments_a = tf.softmax(score_a)
r_Q = tf.reduce_sum(tf.matmul(alignments_a, u_Q, transpose_b=True), [2])
attn_v = tf.get_varialbe('attn_v')
w_P = tf.get_varialbe('weight_passage')
w_a = tf.get_varialbe('weight_answer')
h_a = tf.get_varialbe('embedding_answer')
score = tf.reduce_sum(attn_v * tf.tanh(w_P * h_P + w_a * h_a), [2]) # scores for all tokens
alignments = tf.softmax(score)
alignments = tf.expand_dims(alignments, 1)
v_P = tf.expand_dims(u_Q, 1)
context = tf.reduce_sum(tf.matmul(alignments, v_P, transpose_b=True), [2])
outputs, h_a = cell(h_a, context)
self.answer = outputs
return self.answer
def GRUCellGPU(self, num_units = self.len_gs, gpu_num = 0, scope = 'GRUCellGPU'):
''' wrapper GRUCell with Dropout & GPU device
'''
gru_cell = tf.contrib.rnn.DeviceWrapper(
tf.contrib.rnn.DropoutWrapper(
tf.nn.rnn_cell.GRUCell(num_units),
input_keep_prob = self.keep_prob, output_keep_prob = self.keep_prob, state_keep_prob = self.keep_prob),
"/device:GPU:%i" % gpu_num)
return gru_cell
def bidirectionalGRU(self, sequence, num_layers, num_units = self.len_gs, scope = 'bidirectionalGRU'):
''' bidirectional rnn layer using GRU cells
input:
sequence: sequencial token/char inputs
num_layers: number of bidirectionalGRU layers
num_units: number of dimension of GRU's hidden states
scope: name of variable scope
output:
results: results of biRNN layers, (outputs, output_state_fw, output_state_bw)
outputs: [batch_size, max_time, layers_output]
output_state_fw: final states, one tensor per layer, of the forward rnn.
output_state_bw: similiar to fw above.
'''
with tf.variable_scope(scope):
gru_fw = self.GRUCellGPU(num_units)
gru_bw = self.GRUCellGPU(num_units)
# shape: [batch_size, max_time_step, ...]
# TODO: decide batch_size_word based on the batch with the largest amount of unique words.
# char embedding: [batch_size_word, word_length, 300],
# sentence: [batch_size, seq_len, 300+75]
inputs = np.array([sequence])
# TODO: length of each sequence should be provided
outputs, _, _ = tf.contrib.rnn.stack_bidirectional_dynamic_rnn([gru_fw] * num_layers, [gru_bw] * num_layers,
inputs)
return outputs
def embedding(self, word, scope = 'embedding'):
'''
input:
word: tokenized word
output:
embed: embedding combining both word-level and character-level
'''
word_embed, char_embeds = self.vocab.embedding(word)
with tf.variable_scope(scope):
# char_embeds: [word_length, vocab_dim]
# TODO: dynamic word_length needs padding?
# NO need, since dynamic rnn adopted. But length of each word should be provided.
# TODO: BUT how to batch words?
# MAX_TIME should be provided, traverse words of a batch to get the largest word length
char_embed = self.bidirectionalGRU(char_embeds, 2)
embed = tf.concat([word_embed, char_embed], axis = 0)
return embed
if __name__ == '__main__':
| 38.641593 | 117 | 0.671705 | 1,265 | 8,733 | 4.396047 | 0.203162 | 0.006833 | 0.021039 | 0.0205 | 0.240245 | 0.188635 | 0.147815 | 0.130192 | 0.127315 | 0.11221 | 0 | 0.00873 | 0.226154 | 8,733 | 225 | 118 | 38.813333 | 0.814146 | 0.10592 | 0 | 0.142857 | 0 | 0 | 0.05321 | 0 | 0 | 0 | 0 | 0.013333 | 0 | 0 | null | null | 0.079365 | 0.02381 | null | null | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
95e00a7ec2479d14b38648404f902195127f2c8e | 142 | py | Python | gym_multipendulum/__init__.py | GitYiheng/gym-multipendulum | 58e09a3f505a2ca389fee30f6eb9508cdd041176 | [
"MIT"
] | null | null | null | gym_multipendulum/__init__.py | GitYiheng/gym-multipendulum | 58e09a3f505a2ca389fee30f6eb9508cdd041176 | [
"MIT"
] | null | null | null | gym_multipendulum/__init__.py | GitYiheng/gym-multipendulum | 58e09a3f505a2ca389fee30f6eb9508cdd041176 | [
"MIT"
] | null | null | null | from gym.envs.registration import register
register(
id='multipendulum-v0',
entry_point='gym_multipendulum.envs:MultipendulumEnv',
)
| 20.285714 | 58 | 0.774648 | 16 | 142 | 6.75 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008 | 0.119718 | 142 | 6 | 59 | 23.666667 | 0.856 | 0 | 0 | 0 | 0 | 0 | 0.387324 | 0.274648 | 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 |
95e85e9c5dcb45735d3a20249307135c06ee3254 | 121 | py | Python | stats.py | firebird631/siis | 8d64e8fb67619aaa5c0a62fda9de51dedcd47796 | [
"PostgreSQL"
] | null | null | null | stats.py | firebird631/siis | 8d64e8fb67619aaa5c0a62fda9de51dedcd47796 | [
"PostgreSQL"
] | null | null | null | stats.py | firebird631/siis | 8d64e8fb67619aaa5c0a62fda9de51dedcd47796 | [
"PostgreSQL"
] | null | null | null | import pstats
from pstats import SortKey
p = pstats.Stats('profiling.txt')
p.strip_dirs().sort_stats(-1).print_stats()
| 17.285714 | 43 | 0.760331 | 19 | 121 | 4.684211 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009174 | 0.099174 | 121 | 6 | 44 | 20.166667 | 0.807339 | 0 | 0 | 0 | 0 | 0 | 0.108333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
95e972d0f30a0a606a71ffa5373d4a5245107754 | 91 | py | Python | rest_registration/__init__.py | Neraste/django-rest-registration | a60026e653c7b2c63b9f487031b9cb187453a92f | [
"MIT"
] | null | null | null | rest_registration/__init__.py | Neraste/django-rest-registration | a60026e653c7b2c63b9f487031b9cb187453a92f | [
"MIT"
] | null | null | null | rest_registration/__init__.py | Neraste/django-rest-registration | a60026e653c7b2c63b9f487031b9cb187453a92f | [
"MIT"
] | null | null | null | __version__ = "0.6.2"
default_app_config = 'rest_registration.apps.RestRegistrationConfig'
| 30.333333 | 68 | 0.824176 | 11 | 91 | 6.181818 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035294 | 0.065934 | 91 | 2 | 69 | 45.5 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0.549451 | 0.494505 | 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 |
95eb33819e293041c6f181399271e7fcd4dcc29f | 1,174 | py | Python | tests/test_pkg_metadata.py | Algorithmism/quantopian-tools | a57afa7d16286f502e236e32525fbde552028627 | [
"BSD-3-Clause"
] | 1 | 2022-01-31T10:53:53.000Z | 2022-01-31T10:53:53.000Z | tests/test_pkg_metadata.py | Algorithmism/quantopian-tools | a57afa7d16286f502e236e32525fbde552028627 | [
"BSD-3-Clause"
] | null | null | null | tests/test_pkg_metadata.py | Algorithmism/quantopian-tools | a57afa7d16286f502e236e32525fbde552028627 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import re
import semantic_version
import pytest
import validators
from datetime import datetime
import quantopian_tools
def test_valid_pkg_name():
assert quantopian_tools
assert re.match(r'[a-z][a-z_.]+', quantopian_tools.__pkg_name__)
def test_valid_version():
assert semantic_version.validate(str(semantic_version.Version.coerce(quantopian_tools.__version__)))
def test_valid_release_date():
try:
datetime.strptime(quantopian_tools.__release_date__, '%m/%d/%Y')
except ValueError:
pytest.fail()
def test_valid_project_name():
assert quantopian_tools.__project_name__
def test_valid_project_description():
assert quantopian_tools.__project_description__
def test_valid_project_url():
assert validators.url(quantopian_tools.__project_url__)
def test_valid_license():
assert quantopian_tools.__license__ == 'BSD'
def test_valid_author():
assert quantopian_tools.__author__
assert validators.email(quantopian_tools.__author_email__)
def test_valid_maintainer():
assert quantopian_tools.__maintainer__
assert validators.email(quantopian_tools.__maintainer_email__)
| 22.576923 | 104 | 0.782794 | 145 | 1,174 | 5.710345 | 0.303448 | 0.235507 | 0.130435 | 0.068841 | 0.086957 | 0 | 0 | 0 | 0 | 0 | 0 | 0.000982 | 0.132879 | 1,174 | 51 | 105 | 23.019608 | 0.812377 | 0.017888 | 0 | 0 | 0 | 0 | 0.020851 | 0 | 0 | 0 | 0 | 0 | 0.366667 | 1 | 0.3 | true | 0 | 0.2 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
95f23a28e684bd87ef5ce24b521720656b429427 | 891 | py | Python | agent/sn_agent/agent/test.py | akolonin/singnet | 3be30d40a2394325dc14bb55ea2871fe463b9405 | [
"MIT"
] | null | null | null | agent/sn_agent/agent/test.py | akolonin/singnet | 3be30d40a2394325dc14bb55ea2871fe463b9405 | [
"MIT"
] | null | null | null | agent/sn_agent/agent/test.py | akolonin/singnet | 3be30d40a2394325dc14bb55ea2871fe463b9405 | [
"MIT"
] | 1 | 2020-10-27T01:32:15.000Z | 2020-10-27T01:32:15.000Z | #
# sn_agent/base.py - implementation of abstract class defining API for Network
# communication with block-chain implementations through connections with
# smart contracts and block-chain messaging systems.
#
# Copyright (c) 2017 SingularityNET
#
# Distributed under the MIT software license, see LICENSE file.
#
from sn_agent.agent.base import AgentABC
from sn_agent.network.enum import NetworkStatus
from sn_agent.ontology.service_descriptor import ServiceDescriptor
from enum import Enum
import logging
from sn_agent.agent.base import AgentABC
logger = logging.getLogger(__name__)
class TestAgent(AgentABC):
def __init__(self, app, agent_id):
super().__init__(app, agent_id)
logger.debug('Test Agent Started')
def can_perform(self, service: ServiceDescriptor) -> bool:
pass
def perform(self, service: ServiceDescriptor) -> bool:
pass
| 26.205882 | 78 | 0.762065 | 113 | 891 | 5.823009 | 0.557522 | 0.053191 | 0.066869 | 0.048632 | 0.234043 | 0.234043 | 0.103343 | 0 | 0 | 0 | 0 | 0.005384 | 0.166106 | 891 | 33 | 79 | 27 | 0.880215 | 0.331089 | 0 | 0.266667 | 0 | 0 | 0.030717 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.133333 | 0.4 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
25003dfea7e7cf54e69c1816a20e6f722c4b8843 | 187 | py | Python | Python-Task6/NumberCount.py | gaushikmr/codewayy-python | 1e0f1b4d97cf2232daca1145d43290457a3b6c02 | [
"CNRI-Python"
] | null | null | null | Python-Task6/NumberCount.py | gaushikmr/codewayy-python | 1e0f1b4d97cf2232daca1145d43290457a3b6c02 | [
"CNRI-Python"
] | null | null | null | Python-Task6/NumberCount.py | gaushikmr/codewayy-python | 1e0f1b4d97cf2232daca1145d43290457a3b6c02 | [
"CNRI-Python"
] | null | null | null | # Question:5
countNumber = input("Enter the string ")
print ("Original string is : " + countNumber)
res = len(countNumber.split())
print ("Number of words in string is : " + str(res))
| 20.777778 | 52 | 0.679144 | 25 | 187 | 5.08 | 0.72 | 0.125984 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006494 | 0.176471 | 187 | 8 | 53 | 23.375 | 0.818182 | 0.053476 | 0 | 0 | 0 | 0 | 0.394286 | 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 |
25079c7610f4609e6a2c70703d824f4c6ed6832d | 666 | py | Python | molly/apps/places/providers/__init__.py | mollyproject/mollyproject | 3247c6bac3f39ce8d275d19aa410b30c6284b8a7 | [
"Apache-2.0"
] | 7 | 2015-05-16T13:27:21.000Z | 2019-08-06T11:09:24.000Z | molly/apps/places/providers/__init__.py | mollyproject/mollyproject | 3247c6bac3f39ce8d275d19aa410b30c6284b8a7 | [
"Apache-2.0"
] | null | null | null | molly/apps/places/providers/__init__.py | mollyproject/mollyproject | 3247c6bac3f39ce8d275d19aa410b30c6284b8a7 | [
"Apache-2.0"
] | 4 | 2015-11-27T13:36:36.000Z | 2021-03-09T17:55:53.000Z | from molly.conf.provider import Provider
class BaseMapsProvider(Provider):
def import_data(self):
pass
def real_time_information(self, entity):
return None
def augment_metadata(self, entities, **kwargs):
pass
from naptan import NaptanMapsProvider
from acislive import ACISLiveMapsProvider, ACISLiveRouteProvider
from osm import OSMMapsProvider
from postcodes import PostcodesMapsProvider
from ldb import LiveDepartureBoardPlacesProvider
from bbc_tpeg import BBCTPEGPlacesProvider
from tfl import TubeRealtimeProvider
from atcocif import AtcoCifTimetableProvider
from timetables import TimetableAnnotationProvider
| 28.956522 | 64 | 0.806306 | 67 | 666 | 7.940299 | 0.61194 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163664 | 666 | 22 | 65 | 30.272727 | 0.955117 | 0 | 0 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0.117647 | 0.647059 | 0.058824 | 0.941176 | 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 |
250c468d9e411792abdc6a1cfd948a7141029d58 | 1,424 | py | Python | setup.py | aayla-secura/simple_CORS_https_server | e32e1c0ce44f3b5a5e5dc830364eddb0b7127040 | [
"MIT"
] | 3 | 2019-03-28T04:17:17.000Z | 2021-08-02T20:15:17.000Z | setup.py | aayla-secura/simple_CORS_https_server | e32e1c0ce44f3b5a5e5dc830364eddb0b7127040 | [
"MIT"
] | 1 | 2020-07-02T20:48:18.000Z | 2020-07-07T19:09:24.000Z | setup.py | aayla-secura/simple_CORS_https_server | e32e1c0ce44f3b5a5e5dc830364eddb0b7127040 | [
"MIT"
] | 2 | 2020-05-31T11:24:10.000Z | 2021-08-02T20:20:32.000Z | from setuptools import setup, find_packages
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='mixnmatchttp',
version='1.0.dev32',
url='https://github.com/aayla-secura/mixnmatchttp',
author='AaylaSecura1138',
author_email='aayla.secura.1138@gmail.com',
description='Modular HTTP server: Auth, Caching, Proxy, and more',
long_description=long_description,
long_description_content_type='text/markdown',
classifiers=[
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
],
packages=find_packages(),
install_requires=[
'future>=0.12',
'wrapt>=1',
'awesomedict',
],
extras_require={
'unix_pwd': ['passlib>=1.7.2'],
'scrypt': ['passlib>=1.7.2', 'scrypt>=0.8.3'],
'bcrypt': ['passlib>=1.7.2', 'bcrypt>=3.1.4'],
'jwt': ['PyJWT[crypto]>=1.7.1'],
'daemon': ['python-daemon>=2.2.4'],
'sql': ['SQLAlchemy>=1.3.16'],
},
zip_safe=False)
| 33.904762 | 70 | 0.582865 | 164 | 1,424 | 4.981707 | 0.530488 | 0.186047 | 0.244798 | 0.190942 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0.050551 | 0.235955 | 1,424 | 41 | 71 | 34.731707 | 0.700368 | 0 | 0 | 0.051282 | 0 | 0 | 0.515449 | 0.018961 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0.025641 | 0 | 0.025641 | 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 |
251ad593ec553fb6924431331f4965f5608128f0 | 2,540 | py | Python | info/__init__.py | Crystalordiamond/GitHub_Information | 189a954895c653f69ef3cca6d381b3a40b3c4f16 | [
"MIT"
] | 1 | 2018-11-22T08:40:26.000Z | 2018-11-22T08:40:26.000Z | info/__init__.py | Crystalordiamond/GitHub_Information | 189a954895c653f69ef3cca6d381b3a40b3c4f16 | [
"MIT"
] | null | null | null | info/__init__.py | Crystalordiamond/GitHub_Information | 189a954895c653f69ef3cca6d381b3a40b3c4f16 | [
"MIT"
] | null | null | null | import logging
from logging.handlers import RotatingFileHandler
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from redis import StrictRedis
from flask_wtf.csrf import CSRFProtect, generate_csrf
from flask_session import Session
from config import config_dict
# 暂时没有app对象,就不会去初始化,只是声明一下.为什么能这样做:点进去源码
# 没有就申明一下 有就进入判断去执行 (懒加载思想)
db = SQLAlchemy()
# redis_store没有像SQLAlchemy封装一个这样到方法 就直接设置为全局变量
redis_store = None # type: StrictRedis
"""记录日志的配置"""
def setup_log(config_name):
# 下面到函数调用后 根据传入的参数 找不到不同的项目配置类
# 将configClass传入到logging.basicConfig(level=configClass),但是需要不同环境中设置好日志级别,来调用。
configClass = config_dict[config_name]
# 设置日志的记录等级
logging.basicConfig(level=configClass.LOG_LEVEL) # 调试debug级 调用不同环境中到日志等级
# 创建日志记录器,指明日志保存的路径、每个日志文件100兆、保存的日志文件个数上限10个
file_log_handler = RotatingFileHandler("logs/log", maxBytes=1024 * 1024 * 100, backupCount=10)
# 创建日志记录的格式 日志等级 输入日志信息的文件名 行数 日志信息
formatter = logging.Formatter('%(levelname)s %(filename)s:%(lineno)d %(message)s')
# 为刚创建的日志记录器设置日志记录格式
file_log_handler.setFormatter(formatter)
# 为全局的日志工具对象(flask app使用的)添加日志记录器
logging.getLogger().addHandler(file_log_handler)
"""
# ofo生产单车:原材料--->车间--->小黄
# 工厂方法:传入配置名称--->返回对应配置的app对象
# development: --> app开发模式的app对象
# production: --> app线上模式的app对象
"""
# todo 谁传给你参数
"""创建app create_app方法:工厂方法"""
def craete_app(config_name):
# 之所以在这里调用日志函数 是因为日志和运行环境有关系,要是运行环境日志就不用经常显示错误 增加服务器压力。开发环境就不一样
setup_log(config_name)
app = Flask(__name__)
configClass = config_dict[config_name]
app.config.from_object(configClass) # 添加配置类到app
"""
SQLALchemy 实际上是对数据库的抽象,让开发者不用直接和 SQL 语句打交道,而是通过 Python 对象来操作数据库,在舍弃一些性能开销的同时,换来的是开发效率的较大提升
SQLAlchemy是一个关系型数据库框架,它提供了高层的 ORM 和底层的原生数据库的操作。flask-sqlalchemy 是一个简化了 SQLAlchemy 操作的flask扩展。
文档地址:http://docs.jinkan.org/docs/flask-sqlalchemy
"""
# 创建数据库对象
db = SQLAlchemy(app)
# 创建redis数据库对象
global redis_store
redis_store = StrictRedis(host=configClass.REDIS_HOST, port=configClass.REDIS_PORT, db=configClass.REDIS_NUM)
# 4.开启csrf保护机制
"""
1.自动获取cookie中的csrf_token,
2.自动获取ajax请求头中的csrf_token
3.自己校验这两个值
"""
csrf = CSRFProtect(app)
# 创建Session对象,将Session的存储方法进行调整(flask后端内存调整到redis服务器)
Session(app)
# 注册首页蓝图对象
from info.moduls.index import index_bp
app.register_blueprint(index_bp)
# 注册(注册页面)蓝图对象
from info.moduls.passport import passport_bp
app.register_blueprint(passport_bp)
# 返回不同模式下的app对象 开发模式 生产模式
return app
| 30.97561 | 113 | 0.754724 | 279 | 2,540 | 6.716846 | 0.55914 | 0.026681 | 0.022412 | 0.01921 | 0.033084 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010252 | 0.155118 | 2,540 | 81 | 114 | 31.358025 | 0.863001 | 0.241732 | 0 | 0.0625 | 0 | 0 | 0.041066 | 0.016571 | 0 | 0 | 0 | 0.012346 | 0 | 1 | 0.0625 | false | 0.0625 | 0.3125 | 0 | 0.40625 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
252f40093ddfad99a3ec2cea18782a3b5a666dd8 | 414 | py | Python | prediction/src/utils/text_preprocessing.py | Tensor-Reloaded/Social-Media-Post-Impact-Prediction | 6854af9da861273e413847b762f33c370cc4ab27 | [
"MIT"
] | null | null | null | prediction/src/utils/text_preprocessing.py | Tensor-Reloaded/Social-Media-Post-Impact-Prediction | 6854af9da861273e413847b762f33c370cc4ab27 | [
"MIT"
] | 13 | 2021-10-06T19:32:01.000Z | 2022-01-21T23:54:52.000Z | prediction/src/utils/text_preprocessing.py | Tensor-Reloaded/Social-Media-Post-Impact-Prediction | 6854af9da861273e413847b762f33c370cc4ab27 | [
"MIT"
] | 1 | 2021-11-20T19:57:36.000Z | 2021-11-20T19:57:36.000Z | import re
url_removal = re.compile(r'https?://\S*')
rt_user_removal = re.compile(r'(RT )?(@\S+)?')
spaces_removal = re.compile(r'\s+')
def sanitize_text(tweet_text):
tweet_text = rt_user_removal.sub('', tweet_text)
tweet_text = url_removal.sub('', tweet_text)
tweet_text = spaces_removal.sub(' ', tweet_text)
return tweet_text.strip()
def preprocess_text(text):
return sanitize_text(text)
| 24.352941 | 52 | 0.698068 | 62 | 414 | 4.354839 | 0.306452 | 0.266667 | 0.192593 | 0.188889 | 0.207407 | 0.207407 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140097 | 414 | 16 | 53 | 25.875 | 0.758427 | 0 | 0 | 0 | 0 | 0 | 0.070048 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.090909 | 0.090909 | 0.454545 | 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 |
25409a89ea2ed7ee23970fa56851f4f6f69686a6 | 13,013 | py | Python | bLib/util.py | scottwedge/blib | 9a035dafad46fb2723562f19b4549a4216c2cf7d | [
"MIT"
] | null | null | null | bLib/util.py | scottwedge/blib | 9a035dafad46fb2723562f19b4549a4216c2cf7d | [
"MIT"
] | null | null | null | bLib/util.py | scottwedge/blib | 9a035dafad46fb2723562f19b4549a4216c2cf7d | [
"MIT"
] | null | null | null | import os
import ctypes
import traceback
from bLib.helper import *
basename = os.path.basename
dirname = os.path.dirname
abspath = os.path.abspath
exists = os.path.exists
join = os.path.join
isdir = os.path.isdir
isfile = os.path.isfile
def readfile(path):
try:
f = open(path, 'rb')
except:
traceback.print_exc()
d = f.read()
f.close()
return d
PACKAGE_DIR = dirname(abspath(__file__))
CLIB32 = join(PACKAGE_DIR, 'clib', 'bin32', 'release')
CLIB64 = join(PACKAGE_DIR, 'clib', 'bin64', 'release')
FRIDA_SCRIPTDIR = join(PACKAGE_DIR, 'frida_scripts')
def addressof(pointer):
return ctypes.addressof(pointer.contents)
def void_pointer(addr):
VOIDP = ctypes.POINTER(ctypes.c_void_p)
p = ctypes.cast(addr, VOIDP)
return p
def u32_pointer(addr):
INTP = ctypes.POINTER(ctypes.c_uint)
p = ctypes.cast(addr, INTP)
return p
def u64_pointer(addr):
INTP = ctypes.POINTER(ctypes.c_uint64)
p = ctypes.cast(addr, INTP)
return p
def u8_pointer(addr):
U8P = ctypes.POINTER(ctypes.c_ubyte)
p = ctypes.cast(addr, U8P)
return p
def malloc(sz):
return u8_pointer((ctypes.c_ubyte*sz)())
def str2PCSTR(s):
return ctypes.c_char_p(bytes(s, 'ansi'))
def next_pow2(n):
if n == 0:
return 0
out = n - 1
out |= out >> 1
out |= out >> 2
out |= out >> 4
out |= out >> 8
out |= out >> 16
return out + 1
# func state is the position of the bit/byte to flip
def bitflip_1bit(data, func_state): # for i in range((len(data)*8)):
if not func_state:
func_state = 0
if func_state >= len(data) * 8:
return data, None # we are done here, lets switch to the next function
data[int(func_state / 8)] ^= (0x80 >> (func_state % 8))
func_state += 1
return data, func_state
def bitflip_2bits(data, func_state): # for i in range((len(data)*7)):
if not func_state:
func_state = 0
if func_state >= len(data) * 7:
return data, None# we are done here, lets switch to the next function
data[int(func_state / 7)] ^= (0xC0 >> (func_state % 7))
func_state += 1
return data, func_state
def bitflip_4bits(data, func_state): # for i in range((len(data)*5)):
if not func_state:
func_state = 0
if func_state >= len(data) * 5:
return data, None # we are done here, lets switch to the next function
data[int(func_state / 5)] ^= (0xF0 >> (func_state % 5))
func_state += 1
return data, func_state
def byteflip_1(data, func_state): # for i in range((len(data))):
if not func_state:
func_state = 0
if func_state >= len(data):
return data, None # we are done here, lets switch to the next function
data[func_state] ^= 0xFF
func_state += 1
return data, func_state
def byteflip_2(data, func_state): # for i in range(1, ((len(data)))):
if not func_state:
func_state = 0
if func_state + 1 >= len(data):
return data, None # we are done here, lets switch to the next function
if len(data) > 1:
data[func_state] ^= 0xFF
data[func_state + 1] ^= 0xFF
else:
return data, None # input too small for byteflipping
func_state += 1
return data, func_state
def byteflip_4(data, func_state):
if not func_state:
func_state = 0
if func_state + 3 >= len(data):
return data, None
if len(data) > 3:
data[func_state] ^= 0xFF
data[func_state + 1] ^= 0xFF
data[func_state + 2] ^= 0xFF
data[func_state + 3] ^= 0xFF
else:
return data, None # input too small for byteflipping
func_state += 1
return data, func_state
def mutate_byte_arithmetic(data, func_state):
if not func_state:
func_state = [0, 0, False]
if func_state[1] > AFL_ARITH_MAX:
func_state[0] += 1
func_state[1] = 0
if func_state[0] >= len(data):
if func_state[2] == False:
func_state = [0, 0, True]
else:
return data, None
# TODO: we have to check for could_be_bitflip()
if func_state[2] == False:
val = data[func_state[0]] + func_state[1]
else:
val = data[func_state[0]] - func_state[1]
store_8(data, func_state[0], val)
func_state[1] += 1
return data, func_state
def mutate_2bytes_arithmetic(data, func_state):
data_len = len(data)
if data_len < 2:
return data, None
if not func_state:
func_state = [0, 0, False]
if func_state[1] > AFL_ARITH_MAX:
func_state[0] += 1
func_state[1] = 0
if func_state[0] + 1 >= data_len:
if func_state[2] == False:
func_state = [0, 0, True]
else:
return data, None
# TODO: we have to check for could_be_bitflip()
val = load_16(data, func_state[0])
if func_state[2] == False:
val += func_state[1]
else:
val -= func_state[1]
store_16(data, func_state[0], val)
func_state[1] += 1
return data, func_state
def mutate_4bytes_arithmetic(data, func_state):
data_len = len(data)
if data_len < 4:
return data, None
if not func_state:
func_state = [0, 0, False]
if func_state[1] > AFL_ARITH_MAX:
func_state[0] += 1
func_state[1] = 0
if func_state[0] + 3 >= len(data):
if func_state[2] == False:
func_state = [0, 0, True]
else:
return data, None
# TODO: we have to check for could_be_bitflip()
val = load_32(data, func_state[0])
if func_state[2] == False:
val += func_state[1]
else:
val -= func_state[1]
store_32(data, func_state[0], val)
func_state[1] += 1
return data, func_state
# TODO: implement is_not_bitflip and is_not_arithmetic
def mutate_1byte_interesting(data, func_state):
if not func_state:
func_state = [0, 0]
if func_state[1] >= len(interesting_8_Bit):
func_state[0] += 1
func_state[1] = 0
if func_state[0] >= len(data):
return data, None
interesting_value = interesting_8_Bit[func_state[1]]
data[func_state[0]] = in_range_8(interesting_value)
func_state[1] += 1
return data, func_state
# TODO: implement is_not_bitflip and is_not_arithmetic
def mutate_2bytes_interesting(data, func_state):
data_len = len(data)
if data_len < 2:
return data, None
if not func_state:
func_state = [0, 0, False]
if func_state[1] >= len(interesting_16_Bit):
func_state[0] += 1
func_state[1] = 0
if func_state[0] + 1 >= data_len:
if func_state[2] == False:
func_state = [0, 0, True]
else:
return data, None
interesting_value = in_range_16(interesting_16_Bit[func_state[1]])
if func_state[2]:
interesting_value = swap_16(interesting_value)
store_16(data, func_state[0], interesting_value)
func_state[1] += 1
return data, func_state
# TODO: implement is_not_bitflip and is_not_arithmetic
def mutate_4bytes_interesting(data, func_state):
data_len = len(data)
if data_len < 4:
return data, None
if not func_state:
func_state = [0, 0, False]
if func_state[1] >= len(interesting_32_Bit):
func_state[0] += 1
func_state[1] = 0
if func_state[0] + 3 >= data_len:
if func_state[2] == False:
func_state = [0, 0, True]
else:
return data, None
interesting_value = in_range_32(interesting_32_Bit[func_state[1]])
if func_state[2]:
interesting_value = swap_32(interesting_value)
store_32(data, func_state[0], interesting_value)
func_state[1] += 1
return data, func_state
#TODO: auto-create dictionary from binary
#TODO: afl has this also https://github.com/mirrorer/afl/blob/2fb5a3482ec27b593c57258baae7089ebdc89043/afl-fuzz.c#L5123
def dictionary_overwrite(data, func_state):
global tokens_list, tokens_list_length
if tokens_list_length <= 0:
return data, None
if not func_state:
func_state = [0, 0] # first is an index in tokens_list, second is an index in data
data_len = len(data)
token = tokens_list[func_state[0]]
place = func_state[1]
if data_len < len(token):
return data, None
if place >= data_len - len(token):
func_state[0] += 1 # take the next token
func_state[1] = 0
if func_state[0] >= len(tokens_list):
return data, None
data = data[:place] + bytearray(token) + data[place + len(token):]
func_state[1] += 1
return data, func_state
def dictionary_insert(data, func_state):
global tokens_list, tokens_list_length
if tokens_list_length <= 0:
return data, None
if not func_state:
func_state = [0, 0] # first is an index in tokens_list, second is an index in data
data_len = len(data)
token = tokens_list[func_state[0]]
place = func_state[1]
if place >= data_len:
func_state[0] += 1 # take the next token
func_state[1] = 0
if func_state[0] >= len(tokens_list):
return data, None
data = data[:place] + bytearray(token) + data[place:]
func_state[1] += 1
return data, func_state
def havoc_bitflip(data):
value_to_flip = RAND(len(data) * 8)
data, res = bitflip_1bit(data, value_to_flip)
return data
def havoc_interesting_byte(data):
value_to_change = RAND(len(data))
interesting_value_index = RAND(len(interesting_8_Bit))
func_state = [value_to_change, interesting_value_index]
data, state = mutate_1byte_interesting(data, func_state)
return data
def havoc_interesting_2bytes(data):
data_len = len(data)
if data_len < 2:
return data
value_to_change = RAND(data_len - 1) # substract 1 to make sure we have space for 2 bytes
interesting_value_index = RAND(len(interesting_16_Bit))
swap = RAND(2) # is swap?
func_state = [value_to_change, interesting_value_index, swap]
data, state = mutate_2bytes_interesting(data, func_state)
return data
def havoc_interesting_4bytes(data):
data_len = len(data)
if data_len < 4:
return data
value_to_change = RAND(len(data) - 3) # substract 1 to make sure we have space for 2 bytes
interesting_value_index = RAND(len(interesting_32_Bit))
swap = RAND(2) # is swap?
func_state = [value_to_change, interesting_value_index, swap]
data, state = mutate_4bytes_interesting(data, func_state)
return data
def havoc_randomly_add(data): # similar to mutate_byte_arithmetic but a bit faster
value_to_change = RAND(len(data))
data[value_to_change] = in_range_8(data[value_to_change] + 1 + RAND(AFL_ARITH_MAX))
return data
def havoc_randomly_substract(data): # similar to mutate_byte_arithmetic but a bit faster
value_to_change = RAND(len(data))
data[value_to_change] = in_range_8(data[value_to_change] - (1 + RAND(AFL_ARITH_MAX)))
return data
def havoc_randomly_add_2bytes(data): # similar to mutate_byte_arithmetic but a bit faster
data_len = len(data)
if data_len < 2:
return data
func_state = [RAND(data_len - 1), RAND(AFL_ARITH_MAX), True] # pos, value, is_sub
data, func_state = mutate_2bytes_arithmetic(data, func_state)
return data
def havoc_randomly_substract_2bytes(data): # similar to mutate_byte_arithmetic but a bit faster
data_len = len(data)
if data_len < 2:
return data
func_state = [RAND(data_len - 1), RAND(AFL_ARITH_MAX), False] # pos, value, is_sub
data, func_state = mutate_2bytes_arithmetic(data, func_state)
return data
def havoc_randomly_add_4bytes(data): # similar to mutate_byte_arithmetic but a bit faster
data_len = len(data)
if data_len < 4:
return data
func_state = [RAND(data_len - 3), RAND(AFL_ARITH_MAX), True] # pos, value, is_sub
data, func_state = mutate_4bytes_arithmetic(data, func_state)
return data
def havoc_randomly_substract_4bytes(data): # similar to mutate_byte_arithmetic but a bit faster
data_len = len(data)
if data_len < 4:
return data
func_state = [RAND(data_len - 3), RAND(AFL_ARITH_MAX), False] # pos, value, is_sub
data, func_state = mutate_4bytes_arithmetic(data, func_state)
return data
def havoc_set_randomly(data):
pos = RAND(len(data))
data[pos] = in_range_8(data[pos] ^ (1 + RAND(255)));
return data
def havoc_remove_randomly_block(data):
data_len = len(data)
if data_len <= 2:
return data
len_to_remove = AFL_choose_block_len(data_len - 1)
pos = RAND(data_len - len_to_remove + 1)
data = data[:pos] + data[pos+len_to_remove:]
return data
def prepare_block(data):
actually_clone = RAND(4)
data_len = len(data)
if actually_clone:
clone_len = AFL_choose_block_len(data_len)
clone_from = RAND(data_len - clone_len + 1 )
else:
clone_len = AFL_choose_block_len(AFL_HAVOC_BLK_XL)
clone_from = 0
clone_to = RAND(data_len)
if actually_clone:
block = data[clone_from:clone_from + clone_len]
else:
use_data_block = RAND(2)
if use_data_block:
block_start = RAND(data_len)
block = data[block_start:block_start+clone_len]
else:
block = [RAND(256)] * clone_len # TODO: check if it is actually correct implementation
block = bytearray(block)
return block, clone_to, clone_len
# insert random block
def havoc_clone_randomly_block(data):
block, clone_to, clone_len = prepare_block(data)
if clone_len == 0:
return data
data = data[:clone_to] + block + data[clone_to:]
return data
# overwrite random block
def havoc_overwrite_randomly_block(data):
block, clone_to, clone_len = prepare_block(data)
if clone_len == 0:
return data
data = data[:clone_to] + block + data[clone_to+clone_len:]
return data
# overwrite from dict
def havoc_overwrite_with_dict(data):
func_state = [RAND(len(tokens_list)), RAND(len(data))]
data, func_state = dictionary_overwrite(data, func_state)
return data
# overwrite from dict
def havoc_insert_with_dict(data):
func_state = [RAND(len(tokens_list)), RAND(len(data))]
data, func_state = dictionary_insert(data, func_state)
return data | 23.320789 | 119 | 0.715823 | 2,161 | 13,013 | 4.061083 | 0.095326 | 0.186645 | 0.097767 | 0.03897 | 0.774499 | 0.744417 | 0.712625 | 0.687329 | 0.667958 | 0.603464 | 0 | 0.031444 | 0.171521 | 13,013 | 558 | 120 | 23.320789 | 0.78258 | 0.136863 | 0 | 0.58377 | 0 | 0 | 0.004559 | 0 | 0 | 0 | 0.003576 | 0.001792 | 0 | 1 | 0.104712 | false | 0 | 0.010471 | 0.007853 | 0.306283 | 0.002618 | 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 |
254c57eea086024e7cb24ecf06076fc8d36a4cce | 493 | py | Python | src/waldur_auth_saml2/apps.py | geant-multicloud/MCMS-mastermind | 81333180f5e56a0bc88d7dad448505448e01f24e | [
"MIT"
] | 26 | 2017-10-18T13:49:58.000Z | 2021-09-19T04:44:09.000Z | src/waldur_auth_saml2/apps.py | geant-multicloud/MCMS-mastermind | 81333180f5e56a0bc88d7dad448505448e01f24e | [
"MIT"
] | 14 | 2018-12-10T14:14:51.000Z | 2021-06-07T10:33:39.000Z | src/waldur_auth_saml2/apps.py | geant-multicloud/MCMS-mastermind | 81333180f5e56a0bc88d7dad448505448e01f24e | [
"MIT"
] | 32 | 2017-09-24T03:10:45.000Z | 2021-10-16T16:41:09.000Z | from django.apps import AppConfig
from django.contrib.auth import get_user_model
class SAML2Config(AppConfig):
name = 'waldur_auth_saml2'
verbose_name = 'Auth SAML2'
def ready(self):
from djangosaml2.signals import pre_user_save
from . import handlers
pre_user_save.connect(
handlers.update_registration_method,
sender=get_user_model(),
dispatch_uid='waldur_auth_saml2.handlers.update_registration_method',
)
| 27.388889 | 81 | 0.699797 | 58 | 493 | 5.637931 | 0.534483 | 0.082569 | 0.073395 | 0.195719 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013263 | 0.235294 | 493 | 17 | 82 | 29 | 0.854111 | 0 | 0 | 0 | 0 | 0 | 0.162272 | 0.107505 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.307692 | 0 | 0.615385 | 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 |
c265bfead5c04d97f2ed69e70f8a0380fd6fe54e | 3,117 | py | Python | tests.py | knutsenfiksdal/Oving_7 | f2436a6ebd46542311da4459279e572a7f854e3c | [
"MIT"
] | null | null | null | tests.py | knutsenfiksdal/Oving_7 | f2436a6ebd46542311da4459279e572a7f854e3c | [
"MIT"
] | null | null | null | tests.py | knutsenfiksdal/Oving_7 | f2436a6ebd46542311da4459279e572a7f854e3c | [
"MIT"
] | null | null | null | import unittest
from tur import Tur, Posisjon
class TestTur(unittest.TestCase):
def test_slutt_tidspunkt(self):
tur1 = Tur('tur', 0, 15)
tur2 = Tur('tur', 4, 6)
self.assertGreater(tur1.sluttidspunkt, tur1.starttidspunkt)
self.assertEqual(15, tur1.sluttidspunkt)
self.assertEqual(6, tur2.sluttidspunkt)
with self.assertRaises(ValueError):
tur2.sluttidspunkt = 3
def test_add_posisjon(self):
tur1 = Tur('Tur1', 0, 15)
punkt1 = Posisjon(2, 3, 2)
punkt2 = Posisjon(4, 4, 7)
tur1.add_posisjon(punkt1)
self.assertEqual(1, len(tur1.posisjoner))
self.assertEqual(2, tur1.posisjoner[0].x_koordinat)
self.assertEqual(3, tur1.posisjoner[0].y_koordinat)
self.assertEqual(2, tur1.posisjoner[0].hoyde)
tur1.add_posisjon(punkt2)
self.assertEqual(2, len(tur1.posisjoner))
self.assertEqual(4, tur1.posisjoner[1].x_koordinat)
self.assertEqual(4, tur1.posisjoner[1].y_koordinat)
self.assertEqual(7, tur1.posisjoner[1].hoyde)
def test_add_posisjon_koordinater(self):
tur1 = Tur('Tur1', 0, 15)
tur1.add_posisjon_koordinater(2, 3, 2)
self.assertEqual(1, len(tur1.posisjoner))
self.assertEqual(2, tur1.posisjoner[0].x_koordinat)
self.assertEqual(3, tur1.posisjoner[0].y_koordinat)
self.assertEqual(2, tur1.posisjoner[0].hoyde)
tur1.add_posisjon_koordinater(4, 4, 7)
self.assertEqual(2, len(tur1.posisjoner))
self.assertEqual(4, tur1.posisjoner[1].x_koordinat)
self.assertEqual(4, tur1.posisjoner[1].y_koordinat)
self.assertEqual(7, tur1.posisjoner[1].hoyde)
def test_hoydemeter(self):
tur1 = Tur('Tur', 0, 15)
tur2 = Tur('Tur', 4, 6)
punkt1 = Posisjon(2, 3, 2)
punkt2 = Posisjon(20, 5, 20)
punkt3 = Posisjon(18, 13, 22)
punkt4 = Posisjon(2, 3, 2)
punkt5 = Posisjon(5, 3, 10)
punkt6 = Posisjon(15, 5, 18)
punkt7 = Posisjon(12, 15, 12)
tur1.add_posisjon(punkt1)
tur1.add_posisjon(punkt2)
tur1.add_posisjon(punkt3)
tur1.add_posisjon(punkt4)
self.assertEqual(40, tur1.hoydemeter())
tur2.add_posisjon(punkt5)
tur2.add_posisjon(punkt6)
tur2.add_posisjon(punkt7)
self.assertEqual(14, tur2.hoydemeter())
def test_er_rundtur(self):
tur1 = Tur('Tur', 0, 15)
tur2 = Tur('Tur', 4, 6)
punkt1 = Posisjon(2, 3, 2)
punkt2 = Posisjon(20, 5, 20)
punkt3 = Posisjon(18, 13, 22)
punkt4 = Posisjon(2, 3, 2)
punkt5 = Posisjon(5, 3, 10)
punkt6 = Posisjon(15, 5, 18)
punkt7 = Posisjon(12, 15, 12)
tur1.add_posisjon(punkt1)
tur1.add_posisjon(punkt2)
tur1.add_posisjon(punkt3)
tur1.add_posisjon(punkt4)
tur2.add_posisjon(punkt5)
tur2.add_posisjon(punkt6)
tur2.add_posisjon(punkt7)
self.assertTrue(tur1.er_rundtur())
self.assertFalse(tur2.er_rundtur())
if __name__ == '__main__':
unittest.main()
| 36.244186 | 67 | 0.62111 | 398 | 3,117 | 4.743719 | 0.155779 | 0.158898 | 0.095339 | 0.029131 | 0.722458 | 0.722458 | 0.70339 | 0.68697 | 0.68697 | 0.68697 | 0 | 0.093562 | 0.252486 | 3,117 | 85 | 68 | 36.670588 | 0.716738 | 0 | 0 | 0.688312 | 0 | 0 | 0.010908 | 0 | 0 | 0 | 0 | 0 | 0.311688 | 1 | 0.064935 | false | 0 | 0.025974 | 0 | 0.103896 | 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 |
c2c467a955b411f0b77e583250db02fa9a9ac46e | 88 | py | Python | src/processing/__init__.py | 13375P34Ker/speech_analytics | 5c6b5df888546b7e1c37541e267259fa5be07eb2 | [
"MIT"
] | 17 | 2021-01-30T10:53:05.000Z | 2022-02-16T16:24:40.000Z | src/processing/__init__.py | DinoTheDinosaur/speech_analytics | f9661fe7575121a9262859d3cba91879565eaf70 | [
"MIT"
] | 4 | 2021-02-03T08:35:17.000Z | 2021-02-05T08:39:26.000Z | src/processing/__init__.py | JI411/speech_analytics | 5c6b5df888546b7e1c37541e267259fa5be07eb2 | [
"MIT"
] | 4 | 2021-01-31T04:08:43.000Z | 2021-08-22T03:09:25.000Z | from src.processing.audio_processor import AudioProcessor
__all__ = ['AudioProcessor']
| 22 | 57 | 0.829545 | 9 | 88 | 7.555556 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 88 | 3 | 58 | 29.333333 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0.159091 | 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 |
c2cda26dad1a5f0d87b646429b0caa594c06a5dc | 1,057 | py | Python | Advent2016_02b.py | MLCarey321/AdventOfCode2016 | cdd1ec47d89a8c6d05e9155b7ff282c91f0a1101 | [
"MIT"
] | 1 | 2016-12-02T03:12:16.000Z | 2016-12-02T03:12:16.000Z | Advent2016_02b.py | MLCarey321/AdventOfCode2016 | cdd1ec47d89a8c6d05e9155b7ff282c91f0a1101 | [
"MIT"
] | null | null | null | Advent2016_02b.py | MLCarey321/AdventOfCode2016 | cdd1ec47d89a8c6d05e9155b7ff282c91f0a1101 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
import sys
keyMap = {(0, 0): " ", (1, 0): " ", (2, 0): "1", (3, 0): " ", (4, 0): " ",
(0, 1): " ", (1, 1): "2", (2, 1): "3", (3, 1): "4", (4, 1): " ",
(0, 2): "5", (1, 2): "6", (2, 2): "7", (3, 2): "8", (4, 2): "9",
(0, 3): " ", (1, 3): "A", (2, 3): "B", (3, 3): "C", (4, 3): " ",
(0, 4): " ", (1, 4): " ", (2, 4): "D", (3, 4): " ", (4, 4): " "}
x = 0
y = 2
tempx = 0
tempy = 0
passcode = ""
while True:
string = sys.stdin.readline()
if len(string) > 1:
for direction in string:
tempx = x
tempy = y
if direction == "U":
tempy = max(y-1, 0)
elif direction == "D":
tempy = min(y+1, 4)
elif direction == "L":
tempx = max(x-1, 0)
elif direction == "R":
tempx = min(x+1, 4)
if keyMap[(tempx, tempy)] != " ":
x = tempx
y = tempy
passcode += keyMap[(x, y)]
else:
break
print passcode
| 27.102564 | 74 | 0.336802 | 144 | 1,057 | 2.472222 | 0.305556 | 0.022472 | 0.016854 | 0.08427 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118123 | 0.415326 | 1,057 | 38 | 75 | 27.815789 | 0.457929 | 0.016083 | 0 | 0 | 0 | 0 | 0.028874 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.09375 | 0.03125 | null | null | 0.03125 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c2cf832d27bc89ee3acc1d1903bf9ebe57ceb057 | 1,230 | py | Python | app/local/collectors/mongodb.py | darkframemaster/learngit | 6c7a13d098db341f349b866ebbe0509794a9add6 | [
"MIT"
] | 1 | 2016-09-10T16:42:35.000Z | 2016-09-10T16:42:35.000Z | app/local/collectors/mongodb.py | darkframemaster/learngit | 6c7a13d098db341f349b866ebbe0509794a9add6 | [
"MIT"
] | null | null | null | app/local/collectors/mongodb.py | darkframemaster/learngit | 6c7a13d098db341f349b866ebbe0509794a9add6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
import pymongo
class Db():
def __init__(self, reponame, **kw):
self.__connection = pymongo.MongoClient(**kw)
self.__db = self.__connection[str(reponame)]
def drop_commit(self):
self.__db.drop_collection('commit')
def drop_user(self):
self.__db.drop_collection('user')
def save_user(self, insert_data={}):
collection = self.__db['user']
collection.insert_one(insert_data)
def save_users(self, insert_data=[]):
collection = self.__db['user']
collection.insert_many(insert_data)
def save_commit(self, insert_data={}):
collection = self.__db['commit']
collection.insert_one(insert_data)
def save_commits(self, insert_data={}):
collection = self.__db['commit']
collection.insert_many(insert_data)
def find_user(self, find_data={}):
collection = self.__db['user']
return collection.find_one(find_data)
def find_users(self, find_data={}):
collection = self.__db['user']
return collection.find(find_data)
def find_commit(self, find_data={}):
collection = self.__db['commit']
return collection.find_one(find_data)
def find_commits(self, find_data={}):
collection = self.__db['commit']
return collection.find(find_data)
| 24.6 | 47 | 0.720325 | 167 | 1,230 | 4.922156 | 0.191617 | 0.080292 | 0.175182 | 0.194647 | 0.717762 | 0.639903 | 0.59854 | 0.549878 | 0.506083 | 0.257908 | 0 | 0.001869 | 0.130081 | 1,230 | 49 | 48 | 25.102041 | 0.766355 | 0.033333 | 0 | 0.484848 | 0 | 0 | 0.042194 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.030303 | 0 | 0.515152 | 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 |
6c0b5eaed5afb539b4679538d50a6606adfed472 | 2,949 | py | Python | web_api/yonyou/apis/sale_invoice_items.py | zhanghe06/flask_restful | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | [
"MIT"
] | 1 | 2020-12-04T03:15:47.000Z | 2020-12-04T03:15:47.000Z | web_api/yonyou/apis/sale_invoice_items.py | zhanghe06/flask_restful | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | [
"MIT"
] | 1 | 2021-06-01T22:24:27.000Z | 2021-06-01T22:24:27.000Z | web_api/yonyou/apis/sale_invoice_items.py | zhanghe06/flask_restful | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | [
"MIT"
] | 2 | 2020-12-04T03:16:18.000Z | 2021-09-04T14:10:12.000Z | #!/usr/bin/env python
# encoding: utf-8
"""
@author: zhanghe
@software: PyCharm
@file: sale_invoice_items.py
@time: 2018-07-24 16:47
"""
from libs.mysql_orm_op import DbInstance
from web_api.databases.yonyou import db
from web_api.models.yonyou import SASaleInvoiceB
db_instance = DbInstance(db)
def get_sale_invoice_items_row_by_id(sale_invoice_items_id):
"""
通过 id 获取信息
:param sale_invoice_items_id:
:return: None/object
"""
return db_instance.get_row_by_id(SASaleInvoiceB, sale_invoice_items_id)
def get_sale_invoice_items_row(*args, **kwargs):
"""
获取信息
:param args:
:param kwargs:
:return: None/object
"""
return db_instance.get_row(SASaleInvoiceB, *args, **kwargs)
def get_sale_invoice_items_rows(*args, **kwargs):
"""
获取列表
:param args:
:param kwargs:
:return:
"""
return db_instance.get_rows(SASaleInvoiceB, *args, **kwargs)
def get_sale_invoice_items_limit_rows_by_last_id(last_pk, limit_num, *args, **kwargs):
"""
通过最后一个主键 id 获取最新信息列表
:param last_pk:
:param limit_num:
:param args:
:param kwargs:
:return:
"""
return db_instance.get_limit_rows_by_last_id(SASaleInvoiceB, last_pk, limit_num, *args, **kwargs)
def add_sale_invoice_items(sale_invoice_items_data):
"""
添加信息
:param sale_invoice_items_data:
:return: None/Value of user.id
:except:
"""
return db_instance.add(SASaleInvoiceB, sale_invoice_items_data)
def edit_sale_invoice_items(sale_invoice_items_id, sale_invoice_items_data):
"""
修改信息
:param sale_invoice_items_id:
:param sale_invoice_items_data:
:return: Number of affected rows (Example: 0/1)
:except:
"""
return db_instance.edit(SASaleInvoiceB, sale_invoice_items_id, sale_invoice_items_data)
def delete_sale_invoice_items(sale_invoice_items_id):
"""
删除信息
:param sale_invoice_items_id:
:return: Number of affected rows (Example: 0/1)
:except:
"""
return db_instance.delete(SASaleInvoiceB, sale_invoice_items_id)
def get_sale_invoice_items_pagination(page=1, per_page=10, *args, **kwargs):
"""
获取列表(分页)
Usage:
items: 信息列表
has_next: 如果本页之后还有超过一个分页,则返回True
has_prev: 如果本页之前还有超过一个分页,则返回True
next_num: 返回下一页的页码
prev_num: 返回上一页的页码
iter_pages(): 页码列表
iter_pages(left_edge=2, left_current=2, right_current=5, right_edge=2) 页码列表默认参数
:param page:
:param per_page:
:param args:
:param kwargs:
:return:
"""
rows = db_instance.get_pagination(SASaleInvoiceB, page, per_page, *args, **kwargs)
return rows
def delete_sale_invoice_items_table():
"""
清空表
:return:
"""
return db_instance.delete_table(SASaleInvoiceB)
def count_sale_invoice_items(*args, **kwargs):
"""
计数
:param args:
:param kwargs:
:return:
"""
return db_instance.count(SASaleInvoiceB, *args, **kwargs)
| 23.039063 | 101 | 0.690404 | 391 | 2,949 | 4.861893 | 0.263427 | 0.150447 | 0.218832 | 0.085218 | 0.542872 | 0.451341 | 0.340873 | 0.314571 | 0.164124 | 0.116781 | 0 | 0.010213 | 0.20312 | 2,949 | 127 | 102 | 23.220472 | 0.798723 | 0.355036 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0.12 | 0 | 0.92 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6c1400795bc66234bcc0b1c3aaf3f4dce0fe0dfa | 525 | py | Python | dpscalc.py | LucasMolander/WoW-DPS-Calculator | d08295136a0a0f65e595f370512082ca56531123 | [
"MIT"
] | null | null | null | dpscalc.py | LucasMolander/WoW-DPS-Calculator | d08295136a0a0f65e595f370512082ca56531123 | [
"MIT"
] | null | null | null | dpscalc.py | LucasMolander/WoW-DPS-Calculator | d08295136a0a0f65e595f370512082ca56531123 | [
"MIT"
] | null | null | null | #
# Contains the classes that calculate the DPS for each spec. :)
#
from stats import Stats
from abc import ABC, abstractmethod
class DPSCalc(ABC):
def __init__(self):
pass
@abstractmethod
def calculate(self, stats):
"""
@param stats Stats object
"""
pass
class RogueDPSCalc(DPSCalc):
def calculate(self, stats):
assert isinstance(stats, Stats), 'stats must be a Stats object'
print('I did muh calcalatan')
| 18.103448 | 72 | 0.586667 | 58 | 525 | 5.241379 | 0.568966 | 0.098684 | 0.105263 | 0.138158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 525 | 28 | 73 | 18.75 | 0.868571 | 0.167619 | 0 | 0.333333 | 0 | 0 | 0.125326 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.25 | false | 0.166667 | 0.166667 | 0 | 0.583333 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
6c2a69e925ccbff9599db1bae2d7577d27466479 | 156 | py | Python | vjudge_interface/requests/request.py | Quinas/vjudge-interface | 3302ae084f7781bc465443c9fd957065bce67fc0 | [
"MIT"
] | null | null | null | vjudge_interface/requests/request.py | Quinas/vjudge-interface | 3302ae084f7781bc465443c9fd957065bce67fc0 | [
"MIT"
] | 3 | 2021-03-31T19:28:18.000Z | 2021-12-13T20:24:37.000Z | vjudge_interface/requests/request.py | Quinas/vjudge_interface | 3302ae084f7781bc465443c9fd957065bce67fc0 | [
"MIT"
] | null | null | null | class Request:
def __init__(self):
self.timeout = 5000
def get_params(self):
return {}
def get_body(self):
return {}
| 14.181818 | 27 | 0.551282 | 18 | 156 | 4.444444 | 0.611111 | 0.15 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039216 | 0.346154 | 156 | 10 | 28 | 15.6 | 0.745098 | 0 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | false | 0 | 0 | 0.285714 | 0.857143 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
6c330dc8d33d8bc247d4efba62832d770eb20ea4 | 1,108 | py | Python | dhukiya/apps/core/migrations/0004_auto_20210211_1128.py | fikryans/dhukiya_porto | 9108e51a2feeb275e07c77f81edae07636cf89b6 | [
"MIT"
] | null | null | null | dhukiya/apps/core/migrations/0004_auto_20210211_1128.py | fikryans/dhukiya_porto | 9108e51a2feeb275e07c77f81edae07636cf89b6 | [
"MIT"
] | null | null | null | dhukiya/apps/core/migrations/0004_auto_20210211_1128.py | fikryans/dhukiya_porto | 9108e51a2feeb275e07c77f81edae07636cf89b6 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.6 on 2021-02-11 11:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20210210_2324'),
]
operations = [
migrations.AddField(
model_name='setting',
name='site_address',
field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Address'),
),
migrations.AddField(
model_name='setting',
name='site_closetime',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='setting',
name='site_email',
field=models.EmailField(max_length=254, null=True),
),
migrations.AddField(
model_name='setting',
name='site_opentime',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='setting',
name='site_phone',
field=models.IntegerField(null=True, verbose_name='Phone Number'),
),
]
| 28.410256 | 98 | 0.5713 | 109 | 1,108 | 5.651376 | 0.449541 | 0.146104 | 0.186688 | 0.219156 | 0.457792 | 0.457792 | 0.457792 | 0.321429 | 0.321429 | 0.24026 | 0 | 0.048493 | 0.311372 | 1,108 | 38 | 99 | 29.157895 | 0.758847 | 0.040614 | 0 | 0.53125 | 1 | 0 | 0.131951 | 0.021678 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.03125 | 0 | 0.125 | 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 |
6c58e7480edd405e6d61dad583606d3ad64ebce7 | 3,654 | py | Python | app/models.py | JadeMaveric/CollegeVenturers | 885039bb07a7ed42455df928d248d64daabb6edd | [
"MIT"
] | 1 | 2019-09-25T07:14:08.000Z | 2019-09-25T07:14:08.000Z | app/models.py | JadeMaveric/CollegeVenturers | 885039bb07a7ed42455df928d248d64daabb6edd | [
"MIT"
] | 3 | 2019-09-20T05:52:16.000Z | 2021-06-02T00:23:39.000Z | app/models.py | JadeMaveric/CollegeVenturers | 885039bb07a7ed42455df928d248d64daabb6edd | [
"MIT"
] | 2 | 2019-09-20T04:34:51.000Z | 2019-09-20T06:38:15.000Z | from app import db
from app import login
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from datetime import datetime
from hashlib import md5
@login.user_loader
def load_user(id):
return User.query.get(int(id))
project_contributors = db.Table('project_contributors', db.Model.metadata,
db.Column('contributors', db.Integer, db.ForeignKey('user.id')),
db.Column('project', db.Integer, db.ForeignKey('project.id'))
)
project_upvoters = db.Table('project_upvoters', db.Model.metadata,
db.Column('project', db.Integer, db.ForeignKey('project.id')),
db.Column('upvoters', db.Integer, db.ForeignKey('user.id'))
)
project_comment = db.Table('project_comments', db.Model.metadata,
db.Column('project', db.Integer, db.ForeignKey('project.id')),
db.Column('comment', db.Integer, db.ForeignKey('comment.id'))
)
class User(UserMixin, db.Model):
__tablename__ = 'user'
# Login details
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(64), index=True, unique=True, nullable=False)
email = db.Column(db.String(128), index=True, unique=True, nullable=False)
password_hash = db.Column(db.String(128))
# Profile details
first_name = db.Column(db.String(32))
last_name = db.Column(db.String(32))
college = db.Column(db.String(64))
website = db.Column(db.String(128))
about_me = db.Column(db.Text)
social_github = db.Column(db.String(128))
social_linked = db.Column(db.String(128))
social_twitter = db.Column(db.String(128))
# Posts
comments = db.relationship('Comment', backref='author', lazy='dynamic')
upvotes = db.relationship('Project', secondary=project_upvoters, backref='upvoters')
def set_password(self, password):
self.password_hash = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.password_hash, password)
def avatar(self, size):
digest = md5(self.email.lower().encode('utf-8')).hexdigest()
return f'https://www.gravatar.com/avatar/{digest}?d=identicon&s={size}'
def __repr__(self):
return f'<User {self.username}>'
class Project(db.Model):
__tablename__ = 'project'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), nullable=False)
summary = db.Column(db.String(256))
website = db.Column(db.String(128))
description = db.Column(db.Text)
future_scope = db.Column(db.String(32))
short_term_goal = db.Column(db.Text)
category_primary = db.Column(db.String(32))
category_secondary = db.Column(db.String(32))
category_tertiary = db.Column(db.String(32))
comments = db.relationship('Comment', secondary=project_comment, backref='project')
contributors = db.relationship('User', secondary=project_contributors, backref='projects')
#rank = %COUNT(upvotes) WHERE PROJECT = self.id
def rank(self):
raise NotImplementedError
def upvote_number(self):
raise NotImplementedError
def upvote_user_list(self):
raise NotImplementedError
def __repr__(self):
return f'<Project {self.name}>'
class Comment(db.Model):
__tablename__ = 'comment'
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.Text, nullable=False)
timestamp = db.Column(db.DateTime, default=datetime.utcnow)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
def __repr__(self):
return f'<Comment {self.author} - {self.timestamp}>'
@login.user_loader
def load_user(id):
return User.query.get(int(id))
| 36.178218 | 94 | 0.699507 | 491 | 3,654 | 5.063136 | 0.232179 | 0.102977 | 0.104586 | 0.109413 | 0.417136 | 0.291633 | 0.153661 | 0.153661 | 0.113837 | 0.095736 | 0 | 0.014653 | 0.159551 | 3,654 | 101 | 95 | 36.178218 | 0.794855 | 0.022167 | 0 | 0.240506 | 1 | 0 | 0.109555 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.139241 | false | 0.075949 | 0.075949 | 0.075949 | 0.759494 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
6c6f8c493da10f3993f9cf31c2ae3b4b61ccd207 | 2,434 | py | Python | src/processing/canopy_height_models.py | Croydon-Brixton/gedi-biomass-mapping | bd6021a8515597d5ce14221afa47758803b4864a | [
"MIT"
] | null | null | null | src/processing/canopy_height_models.py | Croydon-Brixton/gedi-biomass-mapping | bd6021a8515597d5ce14221afa47758803b4864a | [
"MIT"
] | null | null | null | src/processing/canopy_height_models.py | Croydon-Brixton/gedi-biomass-mapping | bd6021a8515597d5ce14221afa47758803b4864a | [
"MIT"
] | null | null | null | """Functions for calculating biomass from TCH of canopy height models"""
def longo2016_acd(top_of_canopy_height: float) -> float:
"""
Convert `top_of_canopy_height` (tch) to biomass according to
the formula in Longo et al. 2016.
Source:
https://agupubs.onlinelibrary.wiley.com/action/downloadSupplement?
doi=10.1002%2F2016GB005465&file=gbc20478-sup-0001-supplementary.pdf
Note:
The original formula is in units of kgC/m2. We therefore
multiply the result by 10 to get the ACD values in MgC/ha
Args:
top_of_canopy_height (float): Top of canopy height in meters
(meant to work with mean TCH at 50x50m resolution as that
is what was used in the creation of the formula)
Returns:
float: Above ground carbon density in MgC/ha.
"""
# Note: ACD units are in MgC/ha (hence multiplication by 10). To get units in
# kgC/ha, remove multiplication by 10
return 10 * 0.054 * top_of_canopy_height ** 1.76
def asner2014_acd(top_of_canopy_height: float) -> float:
"""
Convert `top_of_canopy_height` (tch) to biomass according to
the general ACD formula in Asner & Mascaro 2014.
Source:
https://www.sciencedirect.com/science/article/pii/S003442571300360X
Args:
top_of_canopy_height (float): Top of canopy height in meters
(meant to work with mean TCH at 50x50m resolution as that
is what was used in the creation of the formula)
Returns:
float: Above ground carbon density in MgC/ha.
"""
# Note: native ACD unit of formula is MgC/ha. To convert to
# kgC/m2, divide by 10.
return 6.8500 * top_of_canopy_height ** 0.9520
def asner2014_colombia_acd(top_of_canopy_height: float) -> float:
"""
Convert `top_of_canopy_height` (tch) to biomass according to
the Colombia ACD formula in Asner & Mascaro 2014.
Source:
https://www.sciencedirect.com/science/article/pii/S003442571300360X
Args:
top_of_canopy_height (float): Top of canopy height in meters
(meant to work with mean TCH at 50x50m resolution as that
is what was used in the creation of the formula)
Returns:
float: Above ground carbon density in MgC/ha.
"""
# Note: native ACD unit of formula is MgC/ha. To convert to
# kgC/m2, divide by 10.
return 2.1011 * top_of_canopy_height ** 1.2682
| 34.771429 | 81 | 0.679129 | 361 | 2,434 | 4.468144 | 0.299169 | 0.079355 | 0.138872 | 0.158091 | 0.699318 | 0.676999 | 0.676999 | 0.676999 | 0.676999 | 0.676999 | 0 | 0.073344 | 0.249384 | 2,434 | 69 | 82 | 35.275362 | 0.809524 | 0.76705 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.