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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33441dcbdd18d01e198cdaef69ee5c18921649eb | 2,656 | py | Python | app/models.py | goldangera/Blogs | 596a5c0f2fc464e332ce6c921b2d4b9f5ac3c44d | [
"PostgreSQL"
] | null | null | null | app/models.py | goldangera/Blogs | 596a5c0f2fc464e332ce6c921b2d4b9f5ac3c44d | [
"PostgreSQL"
] | 1 | 2021-06-01T23:56:28.000Z | 2021-06-01T23:56:28.000Z | app/models.py | goldangera/Blogs | 596a5c0f2fc464e332ce6c921b2d4b9f5ac3c44d | [
"PostgreSQL"
] | null | null | null | from . import db
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from datetime import datetime
from . import login_manager
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(UserMixin, db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(255), index=True)
firstname = db.Column(db.String(255))
lastname = db.Column(db.String(255))
email = db.Column(db.String(255), unique=True, index=True)
pass_secure = db.Column(db.String(255))
subscription = db.Column(db.Boolean)
date_joined = db.Column(db.DateTime, default=datetime.utcnow)
role_id = db.Column(db.Integer, db.ForeignKey('roles.id'))
posts = db.relationship('Post', backref='post', lazy="dynamic")
comments = db.relationship('Comment', backref='user', lazy='dynamic')
@property
def password(self):
raise AttributeError('You cannot read the password attribute')
@password.setter
def password(self, password):
self.pass_secure = generate_password_hash(password)
def verify_password(self, password):
return check_password_hash(self.pass_secure, password)
def __repr__(self):
return f'User {self.username}'
class Role(db.Model):
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255))
# users = db.relationship('User', backref='role', lazy="dynamic")
def __repr__(self):
return f'User {self.name}'
class Post(db.Model):
__tablename__ = 'posts'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String())
text = db.Column(db.String())
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
date_posted = db.Column(db.DateTime, default=datetime.utcnow)
comments = db.relationship('Comment', backref='post_id', lazy='dynamic')
def save_post(self):
db.session.add(self)
db.session.commit()
def get_post(id):
post = Post.query.filter_by(id=id).first()
return post
class Comment(db.Model):
__tablename__ = 'comments'
id = db.Column(db.Integer, primary_key=True)
comment = db.Column(db.String(1000))
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
post = db.Column(db.Integer, db.ForeignKey('posts.id'))
def save_comment(self):
db.session.add(self)
db.session.commit()
@classmethod
def get_comments(cls, post):
comments = Comment.query.filter_by(post=post.id).all()
return comments
| 30.528736 | 76 | 0.681852 | 360 | 2,656 | 4.866667 | 0.241667 | 0.091324 | 0.114155 | 0.082192 | 0.377854 | 0.27169 | 0.255137 | 0.163242 | 0.047945 | 0.047945 | 0 | 0.010143 | 0.183358 | 2,656 | 86 | 77 | 30.883721 | 0.797603 | 0.02372 | 0 | 0.1875 | 1 | 0 | 0.070629 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.15625 | false | 0.140625 | 0.078125 | 0.0625 | 0.8125 | 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 |
334f6e8eb9589cd220b0c1f7bac10284c6bacd96 | 1,570 | py | Python | tigerforecast/problems/tests/run_all_tests.py | danielsuo/TigerForecast | ae18b169d96dd81db88ab27a8b055036845d3a8f | [
"Apache-2.0"
] | 1 | 2020-07-28T09:07:29.000Z | 2020-07-28T09:07:29.000Z | tigerforecast/problems/tests/run_all_tests.py | danielsuo/TigerForecast | ae18b169d96dd81db88ab27a8b055036845d3a8f | [
"Apache-2.0"
] | null | null | null | tigerforecast/problems/tests/run_all_tests.py | danielsuo/TigerForecast | ae18b169d96dd81db88ab27a8b055036845d3a8f | [
"Apache-2.0"
] | 1 | 2021-04-12T22:39:26.000Z | 2021-04-12T22:39:26.000Z | """ test all problems """
from tigerforecast.problems.tests.test_arma import test_arma
from tigerforecast.problems.tests.test_random import test_random
from tigerforecast.problems.tests.test_sp500 import test_sp500
from tigerforecast.problems.tests.test_uci_indoor import test_uci_indoor
from tigerforecast.problems.tests.test_crypto import test_crypto
from tigerforecast.problems.tests.test_enso import test_enso
from tigerforecast.problems.tests.test_lds_time_series import test_lds_time_series
from tigerforecast.problems.tests.test_lstm_time_series import test_lstm_time_series
from tigerforecast.problems.tests.test_rnn_time_series import test_rnn_time_series
from tigerforecast.problems.tests.test_unemployment import test_unemployment
from tigerforecast.problems.tests.test_custom_problem import test_custom_problem
# run all unit tests for problems
def run_all_tests(steps=1000, show=False):
print("\nrunning all problems tests...\n")
test_arma(steps=steps, show_plot=show)
test_random(steps=steps, show_plot=show)
test_sp500(steps=steps, show_plot=show)
test_uci_indoor(steps=steps, show_plot=show)
test_crypto(steps=steps, show_plot=show)
test_enso(steps=steps, show_plot=show)
test_lds_time_series(steps=steps, show_plot=show)
test_lstm_time_series(steps=steps, show_plot=show)
test_rnn_time_series(steps=steps, show_plot=show)
test_unemployment(steps=steps, show_plot=show)
test_custom_problem(show=show)
print("\nall problems tests passed\n")
if __name__ == "__main__":
run_all_tests(show=False)
| 47.575758 | 84 | 0.824204 | 234 | 1,570 | 5.192308 | 0.166667 | 0.139095 | 0.226337 | 0.271605 | 0.571193 | 0.347325 | 0.197531 | 0.088889 | 0 | 0 | 0 | 0.009181 | 0.098089 | 1,570 | 32 | 85 | 49.0625 | 0.84887 | 0.032484 | 0 | 0 | 0 | 0 | 0.046327 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.037037 | false | 0.037037 | 0.407407 | 0 | 0.444444 | 0.074074 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3362db4b2bbd853e90051f78a2bb3ff728e3fb05 | 7,381 | py | Python | metering/tests/test_total_calls.py | singnet/snet-monitoring | aea9e86df3394e35c258c570d1219393aadaa17c | [
"MIT"
] | null | null | null | metering/tests/test_total_calls.py | singnet/snet-monitoring | aea9e86df3394e35c258c570d1219393aadaa17c | [
"MIT"
] | 26 | 2019-04-22T06:43:27.000Z | 2019-12-03T10:15:36.000Z | metering/tests/test_total_calls.py | singnet/snet-platform-usage | aea9e86df3394e35c258c570d1219393aadaa17c | [
"MIT"
] | 5 | 2019-03-25T06:56:31.000Z | 2019-08-28T00:26:14.000Z | import json
import unittest
from datetime import datetime
from unittest.mock import patch
from handlers import usage_handler
from models import OrgServiceConfigModel, UsageModel, UserOrgGroupModel
from repository.org_service_config_repository import OrgServiceRepo
from repository.usage_repository import UsageRepository
from repository.user_org_group_repository import UserOrgGroupRepository
from storage import DatabaseStorage
class TestTotalCalls(unittest.TestCase):
def setUp(self):
self.org_service_repository = OrgServiceRepo()
self.usage_repository = UsageRepository()
self.user_org_group_repository = UserOrgGroupRepository()
self.storage_service = DatabaseStorage()
service_items = list()
service_items.append(
OrgServiceConfigModel(
org_id='snet',
service_id='example-service',
free_calls=100,
effective_end_date=datetime.strptime("2030-09-12 00:00:00", "%Y-%m-%d %H:%M:%S"),
effective_start_date=datetime.strptime("2011-09-12 00:00:00", "%Y-%m-%d %H:%M:%S")
)
)
self.org_service_repository.add_all_items(service_items)
@patch("services.APIUtilityService.get_user_address", return_value="0x123")
def test_paid_usage_record(self, boto_mock):
usage_handler.main(
{"body": json.dumps({
"type": "response",
"registry_address_key": "0x5156fde2ca71da4398f8c76763c41bc9633875e4",
"ethereum_json_rpc_endpoint": "https://ropsten.infura.io",
"request_id": "bl5tuet35nkvoh9gt9q0",
"organization_id": "snet",
"service_id": "example-service",
"group_id": "3cFvmyLn9UO1jrtuZLerzbgLj6AOtqGo+IBQHtZzV1Q=",
"service_method": "/example_service.Calculator/add",
"response_sent_time": "2019-08-08 14:07:15.883501805",
"request_received_time": "2019-08-08 14:07:15.337318252",
"response_time": "0.5461",
"response_code": "Unavailable", "error_message": "",
"version": "v1.0.0", 'username': None,
'payment_mode': "escrow", "operation": "read",
"usage_type": "apicall", "status": "success",
"start_time": "2019-08-08 14:07:15.337318252",
"end_time": "2019-08-08 14:07:15.883501805", "usage_value": 1, "time_zone": "IST", "client_type": None,
"channel_id": 1, "user_details": None, "user_agent": None, "user_address": None
})
}, None)
usage_handler.main(
{"body": json.dumps({
"type": "response",
"registry_address_key": "0x5156fde2ca71da4398f8c76763c41bc9633875e4",
"ethereum_json_rpc_endpoint": "https://ropsten.infura.io",
"request_id": "bl5tuet35nkvoh9gt9q0",
"organization_id": "snet",
"service_id": "example-service",
"group_id": "3cFvmyLn9UO1jrtuZLerzbgLj6AOtqGo+IBQHtZzV1Q=",
"service_method": "/example_service.Calculator/add",
"response_sent_time": "2019-08-08 14:07:15.883501805",
"request_received_time": "2019-08-08 14:07:15.337318252",
"response_time": "0.5461",
"response_code": "Unavailable", "error_message": "",
"version": "v1.0.0", 'username': None,
'payment_mode': "prepaid-call", "operation": "read",
"usage_type": "apicall", "status": "success",
"start_time": "2019-08-08 14:07:15.337318252",
"end_time": "2019-08-08 14:07:15.883501805", "usage_value": 1, "time_zone": "IST", "client_type": None,
"channel_id": 1, "user_details": None, "user_agent": None, "user_address": None
})
}, None)
usage_details = self.usage_repository.session.query(UsageModel).filter(UsageModel.user_address=="0x123").all()
if len(usage_details) != 2:
assert False
@patch("services.APIUtilityService.get_user_address", return_value="0x123")
def test_success_usage_record(self, mock_boto):
self.storage_service.add_usage_data({
"type": "response",
"registry_address_key": "0x5156fde2ca71da4398f8c76763c41bc9633875e4",
"ethereum_json_rpc_endpoint": "https://ropsten.infura.io",
"request_id": "bl5tuet35nkvoh9gt9q0",
"organization_id": "snet",
"service_id": "example-service",
"group_id": "3cFvmyLn9UO1jrtuZLerzbgLj6AOtqGo+IBQHtZzV1Q=",
"service_method": "/example_service.Calculator/add",
"response_sent_time": "2019-08-08 14:07:15.883501805",
"request_received_time": "2019-08-08 14:07:15.337318252",
"response_time": "0.5461",
"response_code": "Unavailable",
"error_message": "",
"version": "v1.0.0",
'username': 'user@snet',
'payment_mode': "free-call",
"operation": "read",
"usage_type": "apicall",
"status": "success",
"start_time": "2019-08-08 14:07:15.337318252",
"end_time": "2019-08-08 14:07:15.883501805",
"usage_value": 1,
"time_zone": "IST",
"client_type": None,
"channel_id": None,
"user_details": None,
"user_agent": None,
"user_address": None
})
self.storage_service.add_usage_data({
"type": "response",
"registry_address_key": "0x5156fde2ca71da4398f8c76763c41bc9633875e4",
"ethereum_json_rpc_endpoint": "https://ropsten.infura.io",
"request_id": "bl5tuet35nkvoh9gt9q0",
"organization_id": "snet",
"service_id": "example-service",
"group_id": "3cFvmyLn9UO1jrtuZLerzbgLj6AOtqGo+IBQHtZzV1Q=",
"service_method": "/example_service.Calculator/add",
"response_sent_time": "2019-08-08 14:07:15.883501805",
"request_received_time": "2019-08-08 14:07:15.337318252",
"response_time": "0.5461",
"response_code": "Unavailable",
"error_message": "",
"version": "v1.0.0",
'username': 'user@snet',
'payment_mode': 'free-call',
"operation": "read",
"usage_type": "apicall",
"status": "failed",
"start_time": "2019-08-08 14:07:15.337318252",
"end_time": "2019-08-08 14:07:15.883501805",
"usage_value": 1,
"time_zone": "IST",
"client_type": None,
"channel_id": None,
"user_details": None,
"user_agent": None,
"user_address": None
})
self.assertEqual((1, 100), self.storage_service.get_usage_details(
user_name='user@snet', org_id='snet', service_id='example-service'))
def tearDown(self):
self.org_service_repository.session.query(
OrgServiceConfigModel).delete()
self.org_service_repository.session.query(UsageModel).delete()
self.org_service_repository.session.query(UserOrgGroupModel).delete()
self.org_service_repository.session.commit()
| 47.619355 | 119 | 0.590164 | 748 | 7,381 | 5.576203 | 0.18984 | 0.030688 | 0.03836 | 0.046032 | 0.747303 | 0.739631 | 0.722129 | 0.686646 | 0.686646 | 0.686646 | 0 | 0.113806 | 0.273811 | 7,381 | 154 | 120 | 47.928571 | 0.664366 | 0 | 0 | 0.684932 | 0 | 0 | 0.406043 | 0.100528 | 0 | 0 | 0.024793 | 0 | 0.013699 | 1 | 0.027397 | false | 0 | 0.068493 | 0 | 0.10274 | 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 |
681f6a984c876b06ef51d01049336b75c3b542f7 | 176 | py | Python | amor/urls.py | Joaxin/django-i18n-words | f764b064990d5ca3ab4a9d18571610ceee7c9136 | [
"MIT"
] | null | null | null | amor/urls.py | Joaxin/django-i18n-words | f764b064990d5ca3ab4a9d18571610ceee7c9136 | [
"MIT"
] | null | null | null | amor/urls.py | Joaxin/django-i18n-words | f764b064990d5ca3ab4a9d18571610ceee7c9136 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
from django.utils.translation import gettext_lazy as _
urlpatterns = [
path(_('amor/'), views.index,name='index'),
] | 25.142857 | 55 | 0.710227 | 23 | 176 | 5.304348 | 0.652174 | 0.163934 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170455 | 176 | 7 | 56 | 25.142857 | 0.835616 | 0 | 0 | 0 | 0 | 0 | 0.05848 | 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 |
682c9b68e991efaeda47bf5e9a3f028d2f200bf8 | 3,973 | py | Python | MLDHT/code/logparser.py | ryanrhymes/personal | ace3e82cf0c48547d461d3343690506276232fd1 | [
"MIT"
] | 2 | 2017-05-02T14:09:51.000Z | 2019-08-07T19:42:24.000Z | MLDHT/code/logparser.py | ryanrhymes/personal | ace3e82cf0c48547d461d3343690506276232fd1 | [
"MIT"
] | null | null | null | MLDHT/code/logparser.py | ryanrhymes/personal | ace3e82cf0c48547d461d3343690506276232fd1 | [
"MIT"
] | null | null | null | #!/usr/bin/python
#
# This script is used parse the log file generated by the crawler.
# Currently, it will map the ip address to its geo-location. The
# file and its structure might be reorganized in futuren when more
# features are needed.
#
# By Liang Wang @ Dept. Computer Science, University of Helsinki
# 2010.12.01
#
import os, sys
import pickle
import sqlite3 as sqlite
IP_DB_FILE = "./ip.db"
class IPDB(object):
def __init__(self, db=IP_DB_FILE):
self.conn = sqlite.connect(db)
self.cur = self.conn.cursor()
pass
def ip2loc(self, ip):
i = self.ip2int(ip)
self.cur.execute("select * from iptable where ip_start<=? order by ip_start desc limit 1;", (i,))
for r in self.cur:
return {"ip":ip, "country_code":r[1], "country_name":r[2],\
"region_code":r[3], "region_name":r[4], "city":r[5],\
"zipcode":r[6], "latitude":r[7], "longtitude":r[8],\
"metrocodde":r[9]}
def ip2int(self, ip):
a = ip.split(".")
k = 0
for i in range(4):
k = (k<<8) + int(a[i])
return k
def debug(self):
# Put test code here.
pass
class Parser(object):
def __init__(self, dup = "-id"):
self.ipdb = IPDB()
self.set_enum(dup)
pass
def set_enum(self, m):
if m == "-id":
self.enum_func = self.enum_id
elif m == "-idip":
self.enum_func = self.enum_idip
elif m == "-idipport":
self.enum_func = self.enum_idipport
def citiesInCountry(self, nodes, country_code):
geo = {"unknown":0}
err = 0
for node in self.enum_idip(nodes.values()):
try:
info = self.ipdb.ip2loc(node["host"])
if info and info["country_code"] == country_code:
if len(info["city"]) == 0:
print node["host"]
if info["city"] in geo:
geo[info["city"]] += 1
else:
geo[info["city"]] = 1
except Exception, errMsg:
print errMsg
err += 1
return geo, err
def geoDistribution(self, nodes, col = "country_name"):
geo = {"unknown":0}
err = 0
for node in self.enum_idip(nodes.values()):
try:
info = self.ipdb.ip2loc(node["host"])
if info:
if info[col] in geo:
geo[info[col]] += 1
else:
geo[info[col]] = 1
else:
geo["unknown"] += 1
except Exception, errMsg:
print errMsg
err += 1
return geo, err
def enum_id(self, nodes):
"""Each (ID) maps to a distinct node"""
for n in nodes:
yield n[0]
pass
def enum_idip(self, nodes):
"""Each (ID,ip) maps to a distinct node"""
for n in nodes:
s = set()
for i in n:
if i["id"] not in s:
s.add(i["id"])
yield i
pass
def enum_idipport(self, nodes):
"""Each (ID,ip,port) maps to a distinct node"""
for n in nodes:
for i in n:
yield i
pass
def rawdata(f):
"""return the dict to the calling function without any processing."""
nodes = pickle.Unpickler(open(f, "r")).load()
return nodes
if __name__=="__main__":
# The command line is in fix format, sorry for this.
if len(sys.argv) < 3:
print "Usage: %s -[id|idip|idipport] logfile" % sys.argv[0]
sys.exit(1)
nodes = rawdata(sys.argv[2])
geo, err = Parser(sys.argv[1]).geoDistribution(nodes)
for k, v in sorted(geo.items(), key=lambda x: -x[1]):
print k,":",v
print err, "errors."
pass
| 29 | 105 | 0.497357 | 519 | 3,973 | 3.72447 | 0.33526 | 0.033109 | 0.009312 | 0.024832 | 0.250905 | 0.202276 | 0.185204 | 0.185204 | 0.185204 | 0.138645 | 0 | 0.018571 | 0.376542 | 3,973 | 136 | 106 | 29.213235 | 0.761809 | 0.094639 | 0 | 0.346535 | 1 | 0 | 0.093566 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.069307 | 0.029703 | null | null | 0.059406 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6835fb1f5fdf0454fd379355c3bef4c11416d811 | 93 | py | Python | Health/config.py | lkean9/GrabTaxi | 93d916dff777ac69ad83973fa00704ed2ae110ee | [
"MIT"
] | null | null | null | Health/config.py | lkean9/GrabTaxi | 93d916dff777ac69ad83973fa00704ed2ae110ee | [
"MIT"
] | null | null | null | Health/config.py | lkean9/GrabTaxi | 93d916dff777ac69ad83973fa00704ed2ae110ee | [
"MIT"
] | null | null | null | database_name = "Health_Service"
user_name = "postgres"
password = "zhangheng"
port = "5432"
| 18.6 | 32 | 0.741935 | 11 | 93 | 6 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049383 | 0.129032 | 93 | 4 | 33 | 23.25 | 0.765432 | 0 | 0 | 0 | 0 | 0 | 0.376344 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.25 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6849e38dd26646ea3e1f4cb7eabda0299b71341f | 656 | py | Python | pyclass/week3/common/entities.py | jbutler42/pynet_class | 837cd0782213036aaf0985105bdd86b0a1c7b547 | [
"Apache-2.0"
] | null | null | null | pyclass/week3/common/entities.py | jbutler42/pynet_class | 837cd0782213036aaf0985105bdd86b0a1c7b547 | [
"Apache-2.0"
] | null | null | null | pyclass/week3/common/entities.py | jbutler42/pynet_class | 837cd0782213036aaf0985105bdd86b0a1c7b547 | [
"Apache-2.0"
] | null | null | null | from common import config
from common import util
class entityObject(object):
"""Read YAML config file to get access info
(device ip, tcp port, user name, keys, etc)
"""
def __init__(self, entities_yml_file=config.cfg.entities_yml_file, *args, **kwargs):
self.entities_yml_file = entities_yml_file
self.entities = util.read_data_file(self.entities_yml_file)
self.users = util.myDict(self.getUsers())
self.devices = util.myDict(self.getDevices())
def getUsers(self):
return self.entities.snmpv3_users
def getDevices(self):
return self.entities.devices
entities = entityObject()
| 29.818182 | 88 | 0.698171 | 86 | 656 | 5.127907 | 0.453488 | 0.163265 | 0.170068 | 0.129252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001916 | 0.204268 | 656 | 21 | 89 | 31.238095 | 0.842912 | 0.128049 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.153846 | 0.153846 | 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 |
685b730125b68f1feb6e3cf73e41a0c079fe1b20 | 2,664 | py | Python | venv/lib/python3.6/site-packages/phonenumbers/data/region_MY.py | exdeam/opencrm | dfdcfdf99f0b42eb3959171927cb6574583f5ee0 | [
"MIT"
] | null | null | null | venv/lib/python3.6/site-packages/phonenumbers/data/region_MY.py | exdeam/opencrm | dfdcfdf99f0b42eb3959171927cb6574583f5ee0 | [
"MIT"
] | null | null | null | venv/lib/python3.6/site-packages/phonenumbers/data/region_MY.py | exdeam/opencrm | dfdcfdf99f0b42eb3959171927cb6574583f5ee0 | [
"MIT"
] | null | null | null | """Auto-generated file, do not edit by hand. MY metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_MY = PhoneMetadata(id='MY', country_code=60, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='(?:1\\d\\d?|3\\d|[4-9])\\d{7}', possible_length=(8, 9, 10), possible_length_local_only=(6, 7)),
fixed_line=PhoneNumberDesc(national_number_pattern='(?:3(?:2[0-36-9]|3[0-368]|4[0-278]|5[0-24-8]|6[0-467]|7[1246-9]|8\\d|9[0-57])\\d|4(?:2[0-689]|[3-79]\\d|8[1-35689])|5(?:2[0-589]|[3468]\\d|5[0-489]|7[1-9]|9[23])|6(?:2[2-9]|3[1357-9]|[46]\\d|5[0-6]|7[0-35-9]|85|9[015-8])|7(?:[2579]\\d|3[03-68]|4[0-8]|6[5-9]|8[0-35-9])|8(?:[24][2-8]|3[2-5]|5[2-7]|6[2-589]|7[2-578]|[89][2-9])|9(?:0[57]|13|[25-7]\\d|[3489][0-8]))\\d{5}', example_number='323856789', possible_length=(8, 9), possible_length_local_only=(6, 7)),
mobile=PhoneNumberDesc(national_number_pattern='1(?:(?:0(?:[23568]\\d|4[0-6]|7[016-9]|9[0-8])|1(?:[1-5]\\d\\d|6(?:0[5-9]|[1-9]\\d))|(?:[23679][2-9]|59\\d)\\d)\\d|4(?:[235-9]\\d\\d|400)|8(?:(?:1[23]|[236]\\d|5[7-9]|7[016-9]|9[0-8])\\d|4(?:[06]\\d|7[0-4])|8(?:[01]\\d|[27][0-4])))\\d{4}', example_number='123456789', possible_length=(9, 10)),
toll_free=PhoneNumberDesc(national_number_pattern='1[378]00\\d{6}', example_number='1300123456', possible_length=(10,)),
premium_rate=PhoneNumberDesc(national_number_pattern='1600\\d{6}', example_number='1600123456', possible_length=(10,)),
voip=PhoneNumberDesc(national_number_pattern='154(?:6(?:0\\d|1[0-3])|8(?:[25]1|4[0189]|7[0-4679]))\\d{4}', example_number='1546012345', possible_length=(10,)),
national_prefix='0',
national_prefix_for_parsing='0',
number_format=[NumberFormat(pattern='(\\d)(\\d{3})(\\d{4})', format='\\1-\\2 \\3', leading_digits_pattern=['[4-79]'], national_prefix_formatting_rule='0\\1'),
NumberFormat(pattern='(\\d{2})(\\d{3})(\\d{3,4})', format='\\1-\\2 \\3', leading_digits_pattern=['1(?:[0249]|[367][2-9]|8[1-9])|8'], national_prefix_formatting_rule='0\\1'),
NumberFormat(pattern='(\\d)(\\d{4})(\\d{4})', format='\\1-\\2 \\3', leading_digits_pattern=['3'], national_prefix_formatting_rule='0\\1'),
NumberFormat(pattern='(\\d{3})(\\d{3})(\\d{4})', format='\\1-\\2 \\3', leading_digits_pattern=['15'], national_prefix_formatting_rule='0\\1'),
NumberFormat(pattern='(\\d{2})(\\d{4})(\\d{4})', format='\\1-\\2 \\3', leading_digits_pattern=['11'], national_prefix_formatting_rule='0\\1'),
NumberFormat(pattern='(\\d)(\\d{3})(\\d{2})(\\d{4})', format='\\1-\\2-\\3-\\4', leading_digits_pattern=['1'])],
mobile_number_portable_region=True)
| 133.2 | 514 | 0.623123 | 481 | 2,664 | 3.301455 | 0.237006 | 0.017632 | 0.109572 | 0.13602 | 0.397355 | 0.324307 | 0.261965 | 0.261965 | 0.243073 | 0.211587 | 0 | 0.168329 | 0.058934 | 2,664 | 19 | 515 | 140.210526 | 0.465098 | 0.019895 | 0 | 0 | 1 | 0.176471 | 0.401919 | 0.332822 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.058824 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68ac6da8ca2e3f20c4dfddb64fc05b2e00cf3694 | 988 | py | Python | fast_arrow/util.py | jwschmo/fast_arrow | f1fa64acb0813615cbe3048c317438fdc81b7c75 | [
"MIT"
] | 143 | 2018-07-24T02:09:07.000Z | 2021-12-15T04:40:25.000Z | fast_arrow/util.py | jwschmo/fast_arrow | f1fa64acb0813615cbe3048c317438fdc81b7c75 | [
"MIT"
] | 67 | 2018-08-01T05:46:54.000Z | 2020-07-23T22:46:25.000Z | fast_arrow/util.py | jwschmo/fast_arrow | f1fa64acb0813615cbe3048c317438fdc81b7c75 | [
"MIT"
] | 46 | 2018-09-05T12:48:14.000Z | 2020-10-06T19:36:03.000Z | import configparser
from urllib.parse import urlparse
import datetime
def get_username_password(config_file):
config = configparser.ConfigParser()
config.read(config_file)
return [config['account']['username'], config['account']['password']]
def get_last_path(url_string):
o = urlparse(url_string)
paths = o.path.rsplit("/")
return list(filter(None, paths))[-1]
def chunked_list(_list, _chunk_size=50):
"""
Break lists into small lists for processing:w
"""
for i in range(0, len(_list), _chunk_size):
yield _list[i:i + _chunk_size]
def days_ago(days):
"""
Returns datetime object
"""
return datetime.date.today() - datetime.timedelta(days=days)
def format_datetime(dt):
"""
Returns ISO 8601 string representation
"""
return dt.isoformat()
def is_max_date_gt(max_date, date):
if max_date is None:
return False
if date < max_date:
return True
else:
return False
| 21.021277 | 73 | 0.66498 | 130 | 988 | 4.853846 | 0.492308 | 0.044374 | 0.041204 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01039 | 0.220648 | 988 | 46 | 74 | 21.478261 | 0.809091 | 0.109312 | 0 | 0.08 | 0 | 0 | 0.03717 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0.08 | 0.12 | 0 | 0.64 | 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 |
68b357c5d83c6305e0c90d922a02d828287e641b | 375 | py | Python | RecoEgamma/EgammaHFProducers/python/hfEMClusteringSequence_cff.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | RecoEgamma/EgammaHFProducers/python/hfEMClusteringSequence_cff.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | RecoEgamma/EgammaHFProducers/python/hfEMClusteringSequence_cff.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | import FWCore.ParameterSet.Config as cms
#Sequence for making HFEMClusters into RecoEcalCandidates
#
#create HFEMClusterShapes and SuperCluster
from RecoEgamma.EgammaHFProducers.hfClusterShapes_cfi import *
#create RecoEcalCandidates
from RecoEgamma.EgammaHFProducers.hfRecoEcalCandidate_cfi import *
hfEMClusteringSequence = cms.Sequence(hfEMClusters+hfRecoEcalCandidate)
| 34.090909 | 71 | 0.874667 | 35 | 375 | 9.314286 | 0.657143 | 0.067485 | 0.190184 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 375 | 10 | 72 | 37.5 | 0.944928 | 0.325333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d79eb2dd4deedf0a4ec145e93587c38511f1f481 | 19,834 | py | Python | 0170.0171.0172.0173.0174.0175.0176.0177.0178.0179.0180.0181.0185.0187.0188.0189.0190.0200.0342.0352.0353.0354.0355.BCRPData.py | alphacastio/connectors-peru-macro-basics | 1da06241344997efc8b48d8bb70d253fc001e34e | [
"MIT"
] | null | null | null | 0170.0171.0172.0173.0174.0175.0176.0177.0178.0179.0180.0181.0185.0187.0188.0189.0190.0200.0342.0352.0353.0354.0355.BCRPData.py | alphacastio/connectors-peru-macro-basics | 1da06241344997efc8b48d8bb70d253fc001e34e | [
"MIT"
] | null | null | null | 0170.0171.0172.0173.0174.0175.0176.0177.0178.0179.0180.0181.0185.0187.0188.0189.0190.0200.0342.0352.0353.0354.0355.BCRPData.py | alphacastio/connectors-peru-macro-basics | 1da06241344997efc8b48d8bb70d253fc001e34e | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# In[3]:
#!/usr/bin/env python
# coding: utf-8
# In[35]:
import pandas as pd
import numpy as np
import requests
import io
import html
from alphacast import Alphacast
from dotenv import dotenv_values
API_KEY = dotenv_values(".env").get("API_KEY")
alphacast = Alphacast(API_KEY)
# In[158]:
def fix_date(df):
if "b'Trimestre/Año" in df.columns:
df["b'Trimestre/Año"] = df["b'Trimestre/Año"].str.replace(r'T(\d).(\d+)', r'\2-Q\1')
df["Q"] = df["b'Trimestre/Año"].str.split("-", expand=True)[1]
df["Y"] = df["b'Trimestre/Año"].str.split("-", expand=True)[0]
df["Y2"] = df["b'Trimestre/Año"].str.split("-", expand=True)[0]
df.loc[df["Y2"] > "29", "Y"] = "19" + df["Y2"]
df.loc[df["Y2"] <= "29", "Y"] = "20" + df["Y2"]
df["b'Trimestre/Año"] = df["Y"]+"-"+df["Q"]
df['Date'] = pd.PeriodIndex(df["b'Trimestre/Año"], freq='Q').to_timestamp()
del df["b'Trimestre/Año"]
del df["Y"]
del df["Y2"]
del df["Q"]
if "b'Día/Mes/Año" in df.columns:
df["Day"] = df["b'Día/Mes/Año"].str.split(pat=".", expand=True)[0]
df["Month"] = df["b'Día/Mes/Año"].str.split(pat=".", expand=True)[1]
df["Year"] = df["b'Día/Mes/Año"].str.split(pat=".", expand=True)[2]
df["Y2"] = df["b'Día/Mes/Año"].str.split(pat=".", expand=True)[2]
df.loc[df["Y2"] > "29", "Year"] = "19" + df["Y2"]
df.loc[df["Y2"] <= "29", "Year"] = "20" + df["Y2"]
df["Month"] = df["Month"].replace(
{'Abr': 4, 'Ago': 8,
'Dic':12, 'Ene': 1,
'Feb': 2,'Jul': 7,
'Jun': 6, 'Mar': 3,
'May': 5 , 'Nov': 11,
'Oct': 10, 'Sep':9 }
)
df["Date"] = pd.to_datetime(df[["Year", "Month", "Day"]], errors="coerce")
del df["Year"]
del df["Month"]
del df["Day"]
del df["b'Día/Mes/Año"]
if "b'Mes/Año" in df.columns:
df["Month"] = df["b'Mes/Año"].str.split(pat=".", expand=True)[0]
df["Year"] = df["b'Mes/Año"].str.split(pat=".", expand=True)[1]
df["Month"] = df["Month"].replace(
{'Abr': 4, 'Ago': 8,
'Dic':12, 'Ene': 1,
'Feb': 2,'Jul': 7,
'Jun': 6, 'Mar': 3,
'May': 5 , 'Nov': 11,
'Oct': 10, 'Sep':9 }
)
df["Day"] = 1
df["Date"] = pd.to_datetime(df[["Year", "Month", "Day"]], errors="coerce")
del df["Year"]
del df["Month"]
del df["Day"]
del df["b'Mes/Año"]
return df
# In[190]:
variables = {
170 : {
"variables" : ["PN03371FQ", "PN03372FQ", "PN03373FQ", "PN03374FQ", "PN03375FQ", "PN03376FQ", "PN03377FQ", "PN03378FQ", "PN03379FQ", "PN03380FQ", "PN37923FQ", "PN37924FQ", "PN03381FQ", "PN03382FQ", "PN03383FQ", "PN03384FQ", "PN03385FQ", "PN03386FQ", "PN37925FQ", "PN03388FQ", "PN03389FQ", "PN03390FQ", "PN03391FQ", "PN03392FQ", "PN37931FQ", "PN03393FQ", "PN03394FQ", "PN03395FQ", "PN03396FQ", "PN03397FQ", "PN03398FQ", "PN03399FQ", "PN03400FQ", "PN03401FQ", "PN03402FQ", "PN03403FQ", "PN03404FQ", "PN03405FQ", "PN03406FQ", "PN03407FQ", "PN03408FQ", "PN03409FQ", "PN03410FQ", "PN03411FQ", "PN03412FQ", "PN37933FQ", "PN03413FQ", "PN37926FQ", "PN03414FQ", "PN37934FQ", "PN37935FQ", "PN03415FQ", "PN03416FQ", "PN03417FQ", "PN03418FQ", "PN03431FQ", "PN03419FQ", "PN03420FQ", "PN03421FQ", "PN03422FQ", "PN03423FQ", "PN03424FQ", "PN03425FQ", "PN03426FQ", "PN03427FQ", "PN03428FQ", "PN03429FQ"],
"dataset_name": ["Saldo de la deuda del sector público no financiero (millones S/)"]
},
171 : {
"variables" : ["PN03432FQ", "PN03433FQ", "PN03434FQ", "PN03435FQ", "PN03436FQ", "PN03437FQ", "PN03438FQ", "PN03439FQ", "PN03440FQ", "PN03441FQ", "PN37927FQ", "PN37928FQ", "PN03442FQ", "PN03443FQ", "PN03444FQ", "PN03445FQ", "PN03446FQ", "PN03447FQ", "PN37929FQ", "PN03449FQ", "PN03450FQ", "PN03451FQ", "PN03452FQ", "PN03453FQ", "PN37932FQ", "PN03454FQ", "PN03455FQ", "PN03456FQ", "PN03457FQ", "PN03458FQ", "PN03459FQ", "PN03460FQ", "PN03461FQ", "PN03462FQ", "PN03463FQ", "PN03464FQ", "PN03465FQ", "PN03466FQ", "PN03467FQ", "PN03468FQ", "PN03469FQ", "PN03470FQ", "PN03471FQ", "PN03472FQ", "PN03473FQ", "PN37936FQ", "PN03474FQ", "PN37930FQ", "PN03475FQ", "PN37937FQ", "PN37938FQ", "PN03476FQ", "PN03477FQ", "PN03478FQ", "PN03479FQ", "PN03480FQ", "PN03491FQ", "PN03481FQ", "PN03482FQ", "PN03483FQ", "PN03484FQ", "PN03485FQ", "PN03486FQ", "PN03487FQ", "PN03488FQ", "PN03489FQ", "PN03490FQ" ],
"dataset_name": ["Saldo de la deuda del sector público no financiero (porcentaje del PBI)"]
},
172 : {
"variables" : ["PD12301MD", "PD04677MD", "PD04678MD", "PD04679MD", "PD04680MD", "PD04681MD", "PD04682MD", "PD04683MD", "PD04684MD", "PD04685MD", "PD04686MD", "PD04687MD", "PD04688MD", "PD04689MD", "PD04690MD", "PD04691MD", "PD04692MD", "PD04693MD", "PD31893DD", "PD31894DD", ],
"dataset_name": ["Tasas de interés"]
},
173 : {
"variables" : ["PN01270PM", "PN01288PM", "PN01289PM", "PN09813PM", "PN01290PM", "PN09814PM", "PN01291PM", "PN01292PM", "PN01293PM", "PN01336PM", "PN01337PM", "PN01338PM", "PN09815PM", "PN01294PM", ],
"dataset_name": ["Índice de precios Lima Metropolitana (índice 2009 = 100)"]
},
174 : {
"variables" : ["PN01296PM", "PN01297PM", "PN01298PM", "PN01299PM", "PN01300PM", "PN01301PM", "PN01302PM", "PN01303PM", "PN01304PM", "PN01305PM", "PN01306PM", "PN01308PM", "PN01309PM", "PN01310PM", "PN01311PM", ],
"dataset_name": ["Índice de precios al consumidor Lima Metropolitana: clasificación sectorial (variación porcentual)"]
},
175 : {
"variables" : ["PN01366PM", "PN01367PM", "PN01368PM", "PN01369PM", "PN01370PM", "PN01372PM", "PN01373PM", "PN01374PM", "PN01375PM", "PN01376PM", "PN01377PM", "PN01378PM", "PN01379PM", "PN01380PM", "PN01381PM", "PN01382PM",],
"dataset_name": ["Índice de precios al consumidor Lima Metropolitana: clasificación transables - no transables (variación porcentual)"]
},
176 : {
"variables" : ["PN02124PM", "PN37695PM", "PN37696PM", "PN37697PM", "PN02125PM", "PN31879GM", "PN31880GM", "PN31881GM", "PN31882GM", "PN31883GM", "PN31884GM", "PN31885GM", "PN31886GM", "PN38063GM", "PN38064GM", "PN38065GM", "PN38066GM", "PN38067GM", "PN38068GM", "PN38050GM", "PN38051GM", "PN38052GM", "PN38053GM", "PN38054GM", "PN38055GM", "PN38056GM", "PN38057GM", "PN38058GM", "PN38059GM", "PN38060GM", "PN38061GM", "PN38062GM", "PN38069GM", "PN38070GM", "PN38071GM"],
"dataset_name": ["REMUNERACIONES Y EMPLEO"]
},
177 : {
"variables" : ["PN01251PM", "PN01259PM", "PN01262PM", "PN01263PM", "PN01264PM", "PN01265PM", "PN01266PM", "PN01267PM", "PN01268PM"],
"dataset_name": [
"Índice del tipo de cambio real (base 2009=100)",
"Tipo de cambio real bilateral del Perú respecto a países latinoamericanos (promedio del período)"
]
},
178 : {
"variables" : ["PN01448BM", "PN01449BM", "PN01450BM", "PN01451BM", "PN01452BM", "PN01453BM", "PN01454BM", "PN01455BM", "PN01456BM", "PN01457BM"],
"dataset_name": [
"Balanza comercial - valores FOB (millones US$)",
]
},
179 : {
"variables" : ["PN01472BM", "PN01473BM", "PN01474BM", "PN01475BM", "PN01476BM", "PN01477BM", "PN01478BM", "PN01479BM", "PN01480BM", "PN01481BM", "PN01482BM", "PN01483BM", "PN01484BM", "PN01485BM", "PN01486BM", "PN01487BM", "PN01488BM" ],
"dataset_name": [
"Exportaciones por grupo de productos - valores FOB (millones US$)",
]
},
180 : {
"variables" : ["PN01497BM", "PN01498BM", "PN01499BM", "PN01500BM", "PN01501BM", "PN01502BM", "PN01503BM", "PN01504BM", "PN01505BM", "PN01506BM", "PN01507BM", "PN01508BM", "PN01509BM", "PN01510BM", "PN01511BM", "PN01512BM", "PN01513BM", "PN01514BM", "PN01515BM", "PN01516BM", "PN01517BM", "PN01518BM", "PN01519BM", "PN01520BM", "PN01521BM", "PN01522BM", "PN01523BM", "PN01524BM", "PN01525BM", "PN01526BM", "PN01527BM", "PN01528BM", "PN01529BM", "PN01530BM", "PN01531BM", "PN01532BM", "PN01533BM", "PN01534BM", "PN01535BM", "PN01536BM", "PN01537BM", "PN01538BM", "PN01539BM", "PN01540BM", "PN01541BM", "PN01542BM", "PN01543BM", "PN01544BM", "PN01545BM", "PN01546BM", "PN01547BM", "PN01548BM", "PN01564BM", "PN01565BM", "PN01566BM", "PN01567BM", "PN01568BM", "PN01569BM", "PN01570BM", "PN01571BM", "PN01572BM", "PN01573BM", "PN01574BM", "PN01575BM", "PN01576BM", "PN01577BM", "PN01578BM", "PN01579BM", "PN01580BM", "PN01581BM", "PN01582BM", "PN01583BM", "PN01584BM", "PN01585BM", "PN01586BM", "PN01587BM", "PN01588BM", "PN01589BM", "PN01590BM", "PN01591BM", "PN01592BM", "PN01593BM", "PN01594BM", "PN01595BM", "PN01596BM", "PN01597BM", "PN01598BM", "PN01599BM", "PN01600BM", "PN01601BM", "PN01602BM", "PN01603BM", "PN01604BM", "PN01605BM", "PN01606BM", "PN01607BM", "PN01608BM", "PN01609BM", "PN01610BM", "PN01611BM", "PN01612BM", "PN01613BM", "PN01614BM", "PN01615BM", "PN01616BM", "PN01617BM", "PN01618BM", "PN01619BM", "PN01620BM", "PN01621BM", "PN01622BM", "PN01623BM", "PN01624BM", ],
"dataset_name": [
"xxxxx",
]
},
181 : {
"variables" : ["PN01625BM", "PN01626BM", "PN01627BM", "PN01628BM", "PN01629BM", "PN01630BM", "PN01631BM", "PN01632BM", "PN01633BM", "PN01634BM", "PN01635BM", "PN01636BM", "PN01637BM", "PN01638BM", "PN01639BM", "PN01640BM", "PN01641BM", "PN01642BM", "PN01643BM", "PN01644BM", "PN01645BM", "PN01646BM", "PN01647BM", "PN01648BM", "", ],
"dataset_name": [
"Importaciones según uso o destino económico - valores FOB (millones US$)",
]
},
185 : {
"variables" : ["PD12912AM", 'PD38048AM', "PD38049AM" ],
"dataset_name": [
"Expectativas Macroeconómicas"
]
},
187 : {
"variables" : ['PN00001MM','PN00002MM','PN00003MM','PN00004MM','PN00005MM','PN00006MM','PN00007MM','PN00008MM','PN00009MM','PN00010MM','PN00011MM','PN00012MM','PN00013MM','PN00014MM','PN00015MM','PN00016MM','PN00178MM','PN00181MM','PN00184MM','PN00187MM','PN00190MM','PN00193MM','PN00196MM','PN00021MM','PN00023MM','PN00025MM','PN00480MM','PN00483MM','PN00486MM','PN00489MM','PN00492MM','PN00494MM','PN00495MM'],
"dataset_name": [
"Cuentas monetarias de las sociedades creadoras de depósito",
"Liquidez de las sociedades creadoras de depósito (fin de periodo)",
"Emisión primaria y multiplicador (millones S/)"
]
},
188 : {
"variables" : ['PN00496MM','PN00499MM','PN00502MM','PN00505MM','PN00508MM','PN00511MM','PN00532MM','PN00533MM','PN00534MM','PN00535MM','PN00536MM','PN00537MM','PN00538MM','PN00539MM','PN00540MM','PN00541MM','PN00542MM','PN00543MM','PN00544MM','PN00545MM','PN00546MM','PN00547MM','PN00548MM','PN00549MM','PN00550MM','PN00551MM'],
"dataset_name": [
"Crédito de las sociedades creadoras de depósito al sector privado (fin de periodo)",
"Crédito al sector privado de las sociedades creadoras de depósito, por tipo de crédito",
"Crédito al sector privado de las sociedades creadoras de depósito, por tipo de crédito y por monedas"
]
},
189 : {
"variables" : ['PN00264MM','PN00265MM','PN00266MM','PN00267MM','PN00268MM','PN00269MM','PN00270MM','PN00271MM','PN00272MM','PN00273MM','PN00274MM','PN00275MM','PN00276MM','PN00277MM','PN00278MM','PN00279MM','PN00280MM','PN00281MM','PN00282MM','PN00283MM','PN00284MM','PN00285MM','PN00286MM','PN00287MM','PN00288MM','PN00289MM','PN00290MM','PN00291MM','PN00292MM','PN00293MM','PN00294MM','PN00295MM','PN00296MM','PN00297MM','PN00298MM','PN00299MM','PN00300MM','PN00301MM','PN00302MM','PN00303MM','PN00304MM','PN00305MM','PN00306MM','PN00307MM','PN00308MM','PN00309MM','PN00310MM','PN00311MM','PN00312MM','PN00313MM','PN00314MM','PN00315MM','PN00316MM','PN00317MM','PN00318MM','PN00319MM','PN00320MM','PN00321MM','PN00322MM','PN00323MM','PN00324MM','PN00325MM','PN00326MM','PN00327MM','PN00328MM','PN00329MM','PN00330MM','PN00331MM','PN00332MM','PN00333MM','PN00334MM','PN00335MM','PN00336MM','PN00337MM','PN00338MM','PN00339MM','PN00340MM','PN00341MM','PN00342MM','PN00343MM','PN00344MM','PN00345MM','PN00346MM','PN00347MM','PN00348MM','PN00349MM','PN00350MM','PN00351MM','PN00352MM','PN00353MM','PN00354MM','PN00355MM','PN00356MM','PN00357MM','PN00358MM','PN00359MM','PN00360MM','PN00361MM','PN00362MM','PN00363MM','PN00364MM','PN00365MM','PN00366MM','PN00367MM','PN00368MM','PN00369MM','PN00370MM','PN00371MM'],
"dataset_name": [
"Saldo de obligaciones domésticas de las sociedades creadoras de depósito en MN por institución",
"Saldo de obligaciones domésticas de las sociedades creadoras de depósito en MN por institución",
" (millones S/)"
]
},
190 : {
"variables" : ['PN00863MM','PN00864MM','PN00865MM','PN00866MM','PN00867MM','PN00868MM','PN00869MM','PN00870MM','PN00871MM','PN00872MM','PN00873MM','PN00874MM','PN00875MM','PN00876MM','PN00877MM','PN00878MM','PN00879MM','PN00880MM','PN00881MM','PN00882MM','PN00883MM','PN00884MM','PN00885MM','PN00886MM','PN00887MM','PN00888MM','PN00889MM','PN00890MM','PN00891MM','PN00892MM','PN00893MM','PN00894MM','PN00895MM','PN00896MM','PN00897MM','PN00898MM','PN00899MM','PN00900MM','PN00901MM','PN00902MM','PN00903MM','PN00904MM','PN00905MM','PN00906MM','PN00907MM','PN00908MM','PN00909MM','PN00910MM','PN00911MM','PN00912MM','PN00913MM','PN00914MM','PN00915MM','PN00916MM','PN00917MM','PN00918MM','PN00919MM','PN00920MM','PN00921MM','PN00922MM','PN00923MM','PN00924MM','PN00925MM','PN00926MM','PN00927MM','PN00928MM','PN00929MM','PN00930MM','PN00931MM','PN00932MM','PN00933MM','PN00934MM','PN00935MM','PN00936MM','PN00937MM','PN00938MM','PN00939MM','PN00940MM','PN00941MM','PN00942MM','PN00943MM','PN00944MM','PN00945MM','PN00946MM','PN00947MM','PN00948MM','PN00949MM','PN00950MM','PN00951MM','PN00952MM','PN00953MM','PN00954MM','PN00955MM','PN00956MM','PN00957MM','PN00958MM','PN00959MM','PN00960MM','PN00961MM','PN00962MM','PN00963MM','PN00964MM','PN00965MM','PN00966MM','PN00967MM','PN00968MM','PN00969MM','PN00970MM','PN00971MM','PN00972MM','PN00973MM','PN00974MM','PN00975MM','PN00976MM','PN00977MM','PN00978MM','PN00979MM','PN00980MM','PN00981MM','PN00982MM','PN00983MM','PN00984MM','PN00985MM','PN00986MM','PN00987MM','PN00988MM','PN00989MM'],
"dataset_name": [
"Obligaciones de las sociedades creadoras de depósito con el sector público",
"Crédito neto al sector público de las sociedades creadoras de depósito"
]
},
200 : {
"variables" : ['PN07801NM','PN07802NM','PN07803NM','PN07804NM','PN07805NM','PN07806NM','PN07807NM','PN07808NM','PN07809NM','PN07810NM','PN07811NM','PN07812NM','PN07813NM','PN07814NM','PN07815NM','PN07816NM','PN07817NM','PN07818NM','PN07819NM', 'PN07821NM','PN07822NM','PN07823NM','PN07824NM','PN07825NM','PN07826NM','PN07827NM','PN07828NM','PN07829NM','PN07830NM','PN07831NM','PN07832NM','PN07833NM','PN07834NM','PN07835NM','PN07836NM','PN07837NM','PN07838NM','PN07839NM'],
"dataset_name": [
"Tasas de interés activas y pasivas promedio de las empresas bancarias en",
"(términos efectivos anuales)"
]
},
342 : {
"variables" : ["PD38041AM", "PD38042AM", "PD38043AM", "PD38044AM", "PD38045AM", "PD38046AM", "PD38047AM", ],
"dataset_name": [
"Expectativas Empresariales",
]
},
352 : {
"variables" : ["PN02312FM", "PN02313FM", "PN02314FM", "PN02315FM", "PN02316FM", "PN02317FM", "PN02318FM", "PN02319FM", "PN02320FM", "PN02321FM", "PN02322FM", "PN02323FM", "PN02324FM", "PN02325FM", "PN02326FM", "PN02327FM", ],
"dataset_name": [
"Ingresos corrientes del gobierno central (millones S/)",
]
},
353 : {
"variables" : ["PN02221FM", "PN02222FM", "PN02223FM", "PN02224FM", "PN02225FM", "PN02226FM", "PN02227FM", "PN02228FM", "PN02229FM", "PN02230FM", "PN02231FM", "PN02232FM", "PN02233FM", ],
"dataset_name": [
"Gastos del gobierno central (millones S/)",
]
},
354 : {
"variables" : ["PN02390FM", "PN02391FM", "PN02392FM", "PN02393FM", "PN02394FM", "PN02395FM", "PN09808FM", "PN02396FM", "PN02397FM", "PN02398FM", "PN02399FM", "PN02400FM", "PN02401FM", "PN02402FM", "PN02403FM", "PN02404FM", "PN02405FM", "PN02406FM", "PN02407FM", "PN02408FM", "PN02409FM", "PN02410FM", "PN02411FM", "PN02412FM", "PN38072FM", ],
"dataset_name": [
"Gastos no financieros del gobierno general (millones S/)",
]
},
355 : {
"variables" : ["PN02294FM", "PN02295FM", "PN02296FM", "PN02297FM", "PN02298FM", "PN02299FM", "PN02300FM", "PN02301FM", "PN02302FM", "PN02303FM", "PN02304FM", "PN02305FM", "PN02306FM", "PN02307FM", "PN02308FM", "PN02309FM", "PN02310FM", "PN02311FM", "PN37894FM", "PN37895FM", "PN37896FM", "PN37897FM", "PN37898FM", "PN37899FM", "PN37900FM", ],
"dataset_name": [
"Ingresos corrientes del gobierno general (millones S/)",
]
},
}
for dataset in variables:
#for dataset in [352, 353, 354, 355]:
url = "https://estadisticas.bcrp.gob.pe/estadisticas/series/api/{}/csv/".format("-".join(variables[dataset]["variables"]))
print(url)
print(variables[dataset]["dataset_name"])
r = requests.get(url, allow_redirects=False)
s_buf = io.StringIO(str(r.content).replace("<br>", "|"))
df = pd.read_csv(s_buf, lineterminator="|", encoding = "latin-1")
for column in df.columns:
df[column] = df[column].replace("n.d.", np.nan)
for dataset_name in variables[dataset]["dataset_name"]:
df = df.rename(columns={
column: html.unescape(column)
})
column = html.unescape(column)
df = df.rename(columns={
column: column.replace(dataset_name + " - ", "")
})
df = fix_date(df)
df = df[df["Date"].notnull()]
df["country"] = "Peru"
df = df.set_index("Date")
alphacast.datasets.dataset(dataset).upload_data_from_df(df,
deleteMissingFromDB = False, onConflictUpdateDB = True, uploadIndex=True)
# In[ ]:
| 71.602888 | 1,552 | 0.581174 | 1,727 | 19,834 | 6.648523 | 0.624783 | 0.025867 | 0.01019 | 0.018812 | 0.161296 | 0.138129 | 0.108779 | 0.108779 | 0.098241 | 0.092144 | 0 | 0.281301 | 0.226429 | 19,834 | 276 | 1,553 | 71.862319 | 0.467053 | 0.00726 | 0 | 0.200913 | 0 | 0 | 0.534509 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.004566 | false | 0 | 0.03653 | 0 | 0.045662 | 0.009132 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d7acd6f99a4d417a8a7c3df2db40f181e429b723 | 357 | py | Python | {{cookiecutter.github_repository}}/{{cookiecutter.project_name}}/db/mixins.py | caravel/django-in | 7c23f8ca26329f77b5daf4a1370729d111909cc1 | [
"MIT"
] | 2 | 2020-10-05T09:55:20.000Z | 2020-10-21T18:54:56.000Z | {{cookiecutter.github_repository}}/{{cookiecutter.project_name}}/db/mixins.py | caravel/django-in | 7c23f8ca26329f77b5daf4a1370729d111909cc1 | [
"MIT"
] | 110 | 2018-08-02T21:17:01.000Z | 2022-03-28T14:36:09.000Z | {{cookiecutter.github_repository}}/{{cookiecutter.project_name}}/db/mixins.py | caravel/django-in | 7c23f8ca26329f77b5daf4a1370729d111909cc1 | [
"MIT"
] | 4 | 2018-04-17T07:06:26.000Z | 2020-11-28T06:22:41.000Z | from django.db import models
class TimeAuditModel(models.Model):
""" To path when the record was created and last modified """
created = models.DateTimeField(
auto_now_add=True, verbose_name="Created At",)
updated = models.DateTimeField(
auto_now=True, verbose_name="Last Modified At")
class Meta:
abstract = True | 27.461538 | 65 | 0.689076 | 45 | 357 | 5.355556 | 0.644444 | 0.099585 | 0.190871 | 0.215768 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221289 | 357 | 13 | 66 | 27.461538 | 0.866906 | 0.148459 | 0 | 0 | 0 | 0 | 0.087542 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.625 | 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 |
cc0058a22ad3fc1f99d49e47186cfd3245860d6a | 182 | py | Python | config/config.py | Nova-Noir/novabot_v2 | 5e2cdd0981f8556a55ba61b62720668f98baef12 | [
"MIT"
] | 3 | 2022-03-21T09:47:32.000Z | 2022-03-22T01:58:43.000Z | config/config.py | shuiyiyihan/novabot_v2 | b662a7553e256e007debe07c72f373f6f8f2b23f | [
"MIT"
] | 3 | 2022-02-23T16:53:50.000Z | 2022-02-23T16:59:58.000Z | config/config.py | shuiyiyihan/novabot_v2 | b662a7553e256e007debe07c72f373f6f8f2b23f | [
"MIT"
] | 1 | 2022-03-17T12:27:54.000Z | 2022-03-17T12:27:54.000Z | from nonebot import get_driver
global_config = get_driver().config
# nickname: str = list(global_config.nickname)[-1] # Yet this will return a randomly one.
nickname: str = "伊蕾娜"
| 26 | 90 | 0.747253 | 27 | 182 | 4.888889 | 0.703704 | 0.136364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006452 | 0.148352 | 182 | 6 | 91 | 30.333333 | 0.845161 | 0.478022 | 0 | 0 | 0 | 0 | 0.032609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0bf6e442409b5b9974d88f4e00cffa67850de599 | 204 | py | Python | server/ahj_gis/urls.py | uofutahcapstoneahjregistryteam/ahj-registry | 257cdfaf6e24510497cb1db7e89f2c889066fe07 | [
"MIT"
] | null | null | null | server/ahj_gis/urls.py | uofutahcapstoneahjregistryteam/ahj-registry | 257cdfaf6e24510497cb1db7e89f2c889066fe07 | [
"MIT"
] | null | null | null | server/ahj_gis/urls.py | uofutahcapstoneahjregistryteam/ahj-registry | 257cdfaf6e24510497cb1db7e89f2c889066fe07 | [
"MIT"
] | null | null | null | from django.urls import path, include
from . import views
urlpatterns = [
path('location/', views.find_ahj_location, name='location'),
path('address/', views.find_ahj_address, name='address')
]
| 22.666667 | 64 | 0.715686 | 26 | 204 | 5.461538 | 0.5 | 0.126761 | 0.169014 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142157 | 204 | 8 | 65 | 25.5 | 0.811429 | 0 | 0 | 0 | 0 | 0 | 0.156863 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0bfc2bf81226bb515375e0b6f23030142f88bb8f | 107 | py | Python | docs/example.py | mayghalV/allcombinations | 20dec9f4b260274eb57597465fb90fe87c312252 | [
"MIT"
] | null | null | null | docs/example.py | mayghalV/allcombinations | 20dec9f4b260274eb57597465fb90fe87c312252 | [
"MIT"
] | null | null | null | docs/example.py | mayghalV/allcombinations | 20dec9f4b260274eb57597465fb90fe87c312252 | [
"MIT"
] | null | null | null | from allcombinations import allcombinations as ac
for i in ac.allcombinations('example.csv'):
print(i) | 26.75 | 49 | 0.775701 | 15 | 107 | 5.533333 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140187 | 107 | 4 | 50 | 26.75 | 0.902174 | 0 | 0 | 0 | 0 | 0 | 0.101852 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0bff5fe96e65d33454342021a65a32d7642a5238 | 61 | py | Python | 02_Beyond_Fundamentals/07_02.py | AnmolTomer/lynda_programming_foundations | 2f1269f2984ae8707acd80017b892ff4cceb0ee9 | [
"MIT"
] | null | null | null | 02_Beyond_Fundamentals/07_02.py | AnmolTomer/lynda_programming_foundations | 2f1269f2984ae8707acd80017b892ff4cceb0ee9 | [
"MIT"
] | null | null | null | 02_Beyond_Fundamentals/07_02.py | AnmolTomer/lynda_programming_foundations | 2f1269f2984ae8707acd80017b892ff4cceb0ee9 | [
"MIT"
] | null | null | null | for value in range(10):
print(value)
print('All Done!')
| 12.2 | 23 | 0.639344 | 10 | 61 | 3.9 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040816 | 0.196721 | 61 | 4 | 24 | 15.25 | 0.755102 | 0 | 0 | 0 | 0 | 0 | 0.147541 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 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 |
0427aceadf8277bb6bd802e8ce8c2bce4001cbe1 | 1,103 | py | Python | server/server/matchus/migrations/0005_auto_20201103_1830.py | Shadowsych/matchus | b66241a873ae6bf12b8b7380c42c9920de9c2110 | [
"AML"
] | 1 | 2021-01-10T04:46:12.000Z | 2021-01-10T04:46:12.000Z | server/server/matchus/migrations/0005_auto_20201103_1830.py | Shadowsych/matchus | b66241a873ae6bf12b8b7380c42c9920de9c2110 | [
"AML"
] | null | null | null | server/server/matchus/migrations/0005_auto_20201103_1830.py | Shadowsych/matchus | b66241a873ae6bf12b8b7380c42c9920de9c2110 | [
"AML"
] | null | null | null | # Generated by Django 3.1.2 on 2020-11-03 18:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('matchus', '0004_auto_20201103_1821'),
]
operations = [
migrations.AlterField(
model_name='user',
name='interests',
field=models.JSONField(blank=True, default=list, null=True),
),
migrations.AlterField(
model_name='user',
name='location',
field=models.CharField(default='', max_length=128),
),
migrations.AlterField(
model_name='user',
name='name',
field=models.CharField(default='', max_length=128),
),
migrations.AlterField(
model_name='user',
name='photos',
field=models.JSONField(blank=True, default=list, null=True),
),
migrations.AlterField(
model_name='user',
name='profilePhoto',
field=models.CharField(blank=True, default='', max_length=256, null=True),
),
]
| 28.282051 | 86 | 0.55757 | 107 | 1,103 | 5.64486 | 0.429907 | 0.165563 | 0.206954 | 0.240066 | 0.594371 | 0.594371 | 0.533113 | 0.533113 | 0.533113 | 0.533113 | 0 | 0.05298 | 0.315503 | 1,103 | 38 | 87 | 29.026316 | 0.74702 | 0.040798 | 0 | 0.59375 | 1 | 0 | 0.08428 | 0.02178 | 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 |
044815b4b24cb42a9cd87687737d2e91da72c934 | 121 | py | Python | lovesense/__init__.py | qdot/lovesense-py | 8cc9fa87451d68eb091cde96460752ec1323fa03 | [
"BSD-3-Clause"
] | 16 | 2016-07-30T09:23:57.000Z | 2020-11-07T12:23:11.000Z | lovesense/__init__.py | metafetish/liblovense | 8cc9fa87451d68eb091cde96460752ec1323fa03 | [
"BSD-3-Clause"
] | 8 | 2016-07-17T22:28:14.000Z | 2018-08-31T00:48:12.000Z | lovesense/__init__.py | metafetish/liblovense-py | 8cc9fa87451d68eb091cde96460752ec1323fa03 | [
"BSD-3-Clause"
] | 5 | 2017-04-29T12:18:36.000Z | 2020-07-04T00:04:32.000Z | from .comm import LovesenseSerialSync
from .errors import LovesenseIOError
__version__ = '0.1.1'
VERSION = __version__
| 17.285714 | 37 | 0.801653 | 14 | 121 | 6.357143 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028571 | 0.132231 | 121 | 6 | 38 | 20.166667 | 0.819048 | 0 | 0 | 0 | 0 | 0 | 0.041322 | 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 |
04544223685f5254812464c37965d4afca11eee8 | 239 | py | Python | string.py | Brzeczunio/nauka_gita | 4d36e3f846869a6517bca976eed4229400a86eb8 | [
"MIT"
] | null | null | null | string.py | Brzeczunio/nauka_gita | 4d36e3f846869a6517bca976eed4229400a86eb8 | [
"MIT"
] | null | null | null | string.py | Brzeczunio/nauka_gita | 4d36e3f846869a6517bca976eed4229400a86eb8 | [
"MIT"
] | null | null | null | a='ala ma kota'
print(a)
a=u'ala ma kota'
print(a)
a='ala'+'ma'+'kota'
print(a)
print(len(a))
if(a[:1]=='a'):
print(a[-4])
else:
print('No nie za brdzo')
print('{0}, {1}, {2}'.format(*'abc'))
a = 'Psa'
print('%s ma %s' % (a,a))
| 13.277778 | 37 | 0.514644 | 49 | 239 | 2.510204 | 0.428571 | 0.195122 | 0.219512 | 0.341463 | 0.390244 | 0.390244 | 0 | 0 | 0 | 0 | 0 | 0.025126 | 0.167364 | 239 | 17 | 38 | 14.058824 | 0.592965 | 0 | 0 | 0.214286 | 0 | 0 | 0.309623 | 0 | 0.071429 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.571429 | 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 |
045d2ab79a513b60cebd842a542742059db1e88a | 261 | py | Python | saleor/dictionary/urls.py | YunazGilang/saleor-custom | a0123a982440ddcc7c91d7c642953986b81eaee1 | [
"BSD-3-Clause"
] | 2 | 2018-05-28T06:48:13.000Z | 2018-07-10T13:22:26.000Z | saleor/dictionary/urls.py | ygrip/saleor-custom | a0123a982440ddcc7c91d7c642953986b81eaee1 | [
"BSD-3-Clause"
] | 1 | 2020-05-26T00:54:24.000Z | 2020-05-26T00:54:24.000Z | saleor/dictionary/urls.py | ygrip/saleor-custom | a0123a982440ddcc7c91d7c642953986b81eaee1 | [
"BSD-3-Clause"
] | 1 | 2018-08-09T13:10:49.000Z | 2018-08-09T13:10:49.000Z | from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from ..dictionary.utils import mine_feature
urlpatterns = [
url(r'^minefeature$', mine_feature.minefeature),
]
urlpatterns = format_suffix_patterns(urlpatterns) | 29 | 61 | 0.819923 | 32 | 261 | 6.46875 | 0.5625 | 0.115942 | 0.193237 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099617 | 261 | 9 | 62 | 29 | 0.880851 | 0 | 0 | 0 | 0 | 0 | 0.049618 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f089a999fecb102bd932dc8094cbebe0d783b252 | 243 | py | Python | desafio031.py | romstk/pythonExercicios | a7a6ce7828ec28f5d8eadc0207214722cfc6fcd8 | [
"MIT"
] | null | null | null | desafio031.py | romstk/pythonExercicios | a7a6ce7828ec28f5d8eadc0207214722cfc6fcd8 | [
"MIT"
] | null | null | null | desafio031.py | romstk/pythonExercicios | a7a6ce7828ec28f5d8eadc0207214722cfc6fcd8 | [
"MIT"
] | null | null | null | distancia = int(input('Digite a distância de sua viagem: '))
if distancia > 200:
print('O custo total de sua passagem é R${:.2f}'.format(0.45*distancia))
else:
print('O custo total de sua passagem é R${:.2f}'.format(0.50 * distancia)) | 40.5 | 78 | 0.674897 | 41 | 243 | 4 | 0.585366 | 0.091463 | 0.134146 | 0.195122 | 0.487805 | 0.487805 | 0.487805 | 0.487805 | 0.487805 | 0.487805 | 0 | 0.054187 | 0.164609 | 243 | 6 | 78 | 40.5 | 0.753695 | 0 | 0 | 0 | 0 | 0 | 0.467213 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.4 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f09ad569045c3c2362ce2bdfccd574c108ca2721 | 372 | py | Python | flask_authlib/schemas.py | AbduazizZiyodov/flask-authlib | d3af85823953a41d5afcef28cd71a8fda291b80e | [
"MIT"
] | 11 | 2021-05-16T09:09:25.000Z | 2022-01-08T16:39:20.000Z | flask_authlib/schemas.py | AbduazizZiyodov/flask-authlib | d3af85823953a41d5afcef28cd71a8fda291b80e | [
"MIT"
] | null | null | null | flask_authlib/schemas.py | AbduazizZiyodov/flask-authlib | d3af85823953a41d5afcef28cd71a8fda291b80e | [
"MIT"
] | null | null | null | from typing import Optional
from pydantic import EmailStr
from pydantic import BaseModel
class RegisterData(BaseModel):
email: EmailStr
username: str
password: str
class LoginData(BaseModel):
username: str
password: str
class User(BaseModel):
id: Optional[int]
username: str
email: EmailStr
password_hash: str
is_admin: bool
| 15.5 | 30 | 0.715054 | 44 | 372 | 6 | 0.477273 | 0.125 | 0.136364 | 0.166667 | 0.204545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.228495 | 372 | 23 | 31 | 16.173913 | 0.919861 | 0 | 0 | 0.4375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.1875 | 0.1875 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f09b1eb26fbb9b62415e8b15b060b1c94535c21a | 21 | py | Python | Cadastro_Ambiental/src/model/__init__.py | andersonmarques/programacao_2_ufra | 94a22559eed817a429309d8da338431416608c0c | [
"MIT"
] | null | null | null | Cadastro_Ambiental/src/model/__init__.py | andersonmarques/programacao_2_ufra | 94a22559eed817a429309d8da338431416608c0c | [
"MIT"
] | null | null | null | Cadastro_Ambiental/src/model/__init__.py | andersonmarques/programacao_2_ufra | 94a22559eed817a429309d8da338431416608c0c | [
"MIT"
] | null | null | null | __all__ = ['projeto'] | 21 | 21 | 0.666667 | 2 | 21 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 21 | 1 | 21 | 21 | 0.526316 | 0 | 0 | 0 | 0 | 0 | 0.318182 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f09dc4c11ac16755ad29a47936caec15a2435994 | 6,866 | py | Python | tensorboard/compat/proto/proto_test.py | tjgq/tensorboard | 751c961b90183115e4ab0ae3975d50146c0705b9 | [
"Apache-2.0"
] | 7 | 2020-04-04T16:25:42.000Z | 2021-10-02T18:26:56.000Z | tensorboard/compat/proto/proto_test.py | tjgq/tensorboard | 751c961b90183115e4ab0ae3975d50146c0705b9 | [
"Apache-2.0"
] | 16 | 2017-08-31T05:13:08.000Z | 2020-07-09T03:22:14.000Z | tensorboard/compat/proto/proto_test.py | tjgq/tensorboard | 751c961b90183115e4ab0ae3975d50146c0705b9 | [
"Apache-2.0"
] | 4 | 2020-08-08T18:08:44.000Z | 2021-05-13T05:22:40.000Z | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Proto match tests between `tensorboard.compat.proto` and TensorFlow.
These tests verify that the local copy of TensorFlow protos are the same
as those available directly from TensorFlow. Local protos are used to
build `tensorboard-notf` without a TensorFlow dependency.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import difflib
import importlib
import tensorflow as tf
from google.protobuf import descriptor_pb2
# Keep this list synced with BUILD in current directory
PROTO_IMPORTS = [
(
"tensorflow.core.framework.allocation_description_pb2",
"tensorboard.compat.proto.allocation_description_pb2",
),
(
"tensorflow.core.framework.api_def_pb2",
"tensorboard.compat.proto.api_def_pb2",
),
(
"tensorflow.core.framework.attr_value_pb2",
"tensorboard.compat.proto.attr_value_pb2",
),
(
"tensorflow.core.protobuf.cluster_pb2",
"tensorboard.compat.proto.cluster_pb2",
),
(
"tensorflow.core.protobuf.config_pb2",
"tensorboard.compat.proto.config_pb2",
),
(
"tensorflow.core.framework.cost_graph_pb2",
"tensorboard.compat.proto.cost_graph_pb2",
),
(
"tensorflow.python.framework.cpp_shape_inference_pb2",
"tensorboard.compat.proto.cpp_shape_inference_pb2",
),
(
"tensorflow.core.protobuf.debug_pb2",
"tensorboard.compat.proto.debug_pb2",
),
("tensorflow.core.util.event_pb2", "tensorboard.compat.proto.event_pb2"),
(
"tensorflow.core.framework.function_pb2",
"tensorboard.compat.proto.function_pb2",
),
(
"tensorflow.core.framework.graph_pb2",
"tensorboard.compat.proto.graph_pb2",
),
(
"tensorflow.core.protobuf.meta_graph_pb2",
"tensorboard.compat.proto.meta_graph_pb2",
),
(
"tensorflow.core.framework.node_def_pb2",
"tensorboard.compat.proto.node_def_pb2",
),
(
"tensorflow.core.framework.op_def_pb2",
"tensorboard.compat.proto.op_def_pb2",
),
(
"tensorflow.core.framework.resource_handle_pb2",
"tensorboard.compat.proto.resource_handle_pb2",
),
(
"tensorflow.core.protobuf.rewriter_config_pb2",
"tensorboard.compat.proto.rewriter_config_pb2",
),
(
"tensorflow.core.protobuf.saved_object_graph_pb2",
"tensorboard.compat.proto.saved_object_graph_pb2",
),
(
"tensorflow.core.protobuf.saver_pb2",
"tensorboard.compat.proto.saver_pb2",
),
(
"tensorflow.core.framework.step_stats_pb2",
"tensorboard.compat.proto.step_stats_pb2",
),
(
"tensorflow.core.protobuf.struct_pb2",
"tensorboard.compat.proto.struct_pb2",
),
(
"tensorflow.core.framework.summary_pb2",
"tensorboard.compat.proto.summary_pb2",
),
(
"tensorflow.core.framework.tensor_pb2",
"tensorboard.compat.proto.tensor_pb2",
),
(
"tensorflow.core.framework.tensor_description_pb2",
"tensorboard.compat.proto.tensor_description_pb2",
),
(
"tensorflow.core.framework.tensor_shape_pb2",
"tensorboard.compat.proto.tensor_shape_pb2",
),
(
"tensorflow.core.profiler.tfprof_log_pb2",
"tensorboard.compat.proto.tfprof_log_pb2",
),
(
"tensorflow.core.protobuf.trackable_object_graph_pb2",
"tensorboard.compat.proto.trackable_object_graph_pb2",
),
(
"tensorflow.core.framework.types_pb2",
"tensorboard.compat.proto.types_pb2",
),
(
"tensorflow.core.framework.variable_pb2",
"tensorboard.compat.proto.variable_pb2",
),
(
"tensorflow.core.framework.versions_pb2",
"tensorboard.compat.proto.versions_pb2",
),
]
PROTO_REPLACEMENTS = [
("tensorflow/core/framework/", "tensorboard/compat/proto/"),
("tensorflow/core/protobuf/", "tensorboard/compat/proto/"),
("tensorflow/core/profiler/", "tensorboard/compat/proto/"),
("tensorflow/python/framework/", "tensorboard/compat/proto/"),
("tensorflow/core/util/", "tensorboard/compat/proto/"),
('package: "tensorflow.tfprof"', 'package: "tensorboard"'),
('package: "tensorflow"', 'package: "tensorboard"'),
('type_name: ".tensorflow.tfprof', 'type_name: ".tensorboard'),
('type_name: ".tensorflow', 'type_name: ".tensorboard'),
]
MATCH_FAIL_MESSAGE_TEMPLATE = """
{}
NOTE!
====
This is expected to happen when TensorFlow updates their proto definitions.
We pin copies of the protos, but TensorFlow can freely update them at any
time.
The proper fix is:
1. In your TensorFlow clone, check out the version of TensorFlow whose
protos you want to update (e.g., `git checkout v2.2.0-rc0`)
2. In your tensorboard repo, run:
./tensorboard/compat/proto/update.sh PATH_TO_TENSORFLOW_REPO
3. Review and commit any changes.
"""
class ProtoMatchTest(tf.test.TestCase):
def test_each_proto_matches_tensorflow(self):
for tf_path, tb_path in PROTO_IMPORTS:
tf_pb2 = importlib.import_module(tf_path)
tb_pb2 = importlib.import_module(tb_path)
tf_descriptor = descriptor_pb2.FileDescriptorProto()
tb_descriptor = descriptor_pb2.FileDescriptorProto()
tf_pb2.DESCRIPTOR.CopyToProto(tf_descriptor)
tb_pb2.DESCRIPTOR.CopyToProto(tb_descriptor)
# Convert expected to be actual since this matches the
# replacements done in proto/update.sh
tb_string = str(tb_descriptor)
tf_string = str(tf_descriptor)
for orig, repl in PROTO_REPLACEMENTS:
tf_string = tf_string.replace(orig, repl)
diff = difflib.unified_diff(
tb_string.splitlines(1),
tf_string.splitlines(1),
fromfile=tb_path,
tofile=tf_path,
)
diff = "".join(diff)
if diff:
self.fail(MATCH_FAIL_MESSAGE_TEMPLATE.format(diff))
if __name__ == "__main__":
tf.test.main()
| 31.934884 | 80 | 0.659918 | 767 | 6,866 | 5.6897 | 0.289439 | 0.140238 | 0.181485 | 0.166132 | 0.21517 | 0.037122 | 0 | 0 | 0 | 0 | 0 | 0.015284 | 0.218613 | 6,866 | 214 | 81 | 32.084112 | 0.798136 | 0.156714 | 0 | 0.163743 | 0 | 0.005848 | 0.554534 | 0.449627 | 0 | 0 | 0 | 0 | 0 | 1 | 0.005848 | false | 0 | 0.064327 | 0 | 0.076023 | 0.005848 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f0be6ce9c3f281d9d63f037de8a00c6a09c6cc3a | 1,111 | py | Python | core/migrations/0012_auto_20210509_0121.py | mlobf/simpleRESTexercise | 7dfb8c1d9e5908686f8450d0556c250daa927250 | [
"MIT"
] | null | null | null | core/migrations/0012_auto_20210509_0121.py | mlobf/simpleRESTexercise | 7dfb8c1d9e5908686f8450d0556c250daa927250 | [
"MIT"
] | null | null | null | core/migrations/0012_auto_20210509_0121.py | mlobf/simpleRESTexercise | 7dfb8c1d9e5908686f8450d0556c250daa927250 | [
"MIT"
] | null | null | null | # Generated by Django 2.2.21 on 2021-05-09 01:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0011_auto_20210509_0102'),
]
operations = [
migrations.RemoveField(
model_name='local',
name='imovel',
),
migrations.RemoveField(
model_name='imobiliaria',
name='endereco',
),
migrations.RemoveField(
model_name='imobiliaria',
name='status',
),
migrations.RemoveField(
model_name='imovel',
name='endereco',
),
migrations.RemoveField(
model_name='imovel',
name='imobiliaria',
),
migrations.AddField(
model_name='imobiliaria',
name='endereço',
field=models.CharField(default=1, max_length=255),
preserve_default=False,
),
migrations.DeleteModel(
name='Endereco',
),
migrations.DeleteModel(
name='Local',
),
]
| 24.152174 | 62 | 0.522052 | 90 | 1,111 | 6.322222 | 0.488889 | 0.094903 | 0.228471 | 0.26362 | 0.326889 | 0.326889 | 0 | 0 | 0 | 0 | 0 | 0.051136 | 0.366337 | 1,111 | 45 | 63 | 24.688889 | 0.757102 | 0.041404 | 0 | 0.564103 | 1 | 0 | 0.128881 | 0.021637 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.025641 | 0 | 0.102564 | 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 |
f0caf6f1085c8123430279b4e1f514c6779abda4 | 393 | py | Python | monkeys/exceptions.py | AryaGuo/cadical | 159af5b21fbe090e5c1514d7659d2bee92b3402a | [
"MIT"
] | null | null | null | monkeys/exceptions.py | AryaGuo/cadical | 159af5b21fbe090e5c1514d7659d2bee92b3402a | [
"MIT"
] | null | null | null | monkeys/exceptions.py | AryaGuo/cadical | 159af5b21fbe090e5c1514d7659d2bee92b3402a | [
"MIT"
] | null | null | null | """Internal exception classes."""
class UnsatisfiableConstraint(Exception):
"""Raise when a specified constraint cannot be satisfied."""
pass
class UnsatisfiableType(UnsatisfiableConstraint):
"""Raised when a type constraint cannot be satisfied."""
pass
class TreeConstructionError(Exception):
"""Raised when a tree cannot be successfully constructed."""
pass
| 24.5625 | 64 | 0.73028 | 39 | 393 | 7.358974 | 0.538462 | 0.052265 | 0.125436 | 0.188153 | 0.250871 | 0.250871 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175573 | 393 | 15 | 65 | 26.2 | 0.885802 | 0.478372 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f0d2ead39cdd7f415b7cddb6ef88e662d85307e2 | 78 | py | Python | strategy/__init__.py | Neyzoter/Nelearn | b0aa9e0b40592a633e872eb0d1f73beb41cae9ee | [
"MIT"
] | null | null | null | strategy/__init__.py | Neyzoter/Nelearn | b0aa9e0b40592a633e872eb0d1f73beb41cae9ee | [
"MIT"
] | null | null | null | strategy/__init__.py | Neyzoter/Nelearn | b0aa9e0b40592a633e872eb0d1f73beb41cae9ee | [
"MIT"
] | null | null | null | """The Nelearn.strategy package."""
import sys
__author__ = 'Neyzoter Song'
| 13 | 35 | 0.717949 | 9 | 78 | 5.777778 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141026 | 78 | 5 | 36 | 15.6 | 0.776119 | 0.371795 | 0 | 0 | 0 | 0 | 0.302326 | 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 |
f0d7e2e9ef1d522098cfa4472278584d27e26335 | 821 | py | Python | pytype/six_overlay.py | jjedele/pytype | 3c5d920d26ac583bdfd68080e7db454ecb1dc900 | [
"Apache-2.0"
] | null | null | null | pytype/six_overlay.py | jjedele/pytype | 3c5d920d26ac583bdfd68080e7db454ecb1dc900 | [
"Apache-2.0"
] | null | null | null | pytype/six_overlay.py | jjedele/pytype | 3c5d920d26ac583bdfd68080e7db454ecb1dc900 | [
"Apache-2.0"
] | null | null | null | """Implementation of special members of third_party/six."""
from pytype import metaclass
from pytype import overlay
class SixOverlay(overlay.Overlay):
"""A custom overlay for the 'six' module."""
def __init__(self, vm):
member_map = {
"add_metaclass": build_add_metaclass,
"with_metaclass": build_with_metaclass,
"PY2": build_version_bool(2),
"PY3": build_version_bool(3),
}
ast = vm.loader.import_name("six")
super(SixOverlay, self).__init__(vm, "six", member_map, ast)
def build_add_metaclass(name, vm):
return metaclass.AddMetaclass.make(name, vm, "six")
def build_with_metaclass(name, vm):
return metaclass.WithMetaclass.make(name, vm, "six")
def build_version_bool(major):
return lambda _, vm: vm.convert.bool_values[vm.python_version[0] == major]
| 26.483871 | 76 | 0.706456 | 111 | 821 | 4.945946 | 0.432432 | 0.043716 | 0.087432 | 0.076503 | 0.185792 | 0.076503 | 0 | 0 | 0 | 0 | 0 | 0.00731 | 0.16687 | 821 | 30 | 77 | 27.366667 | 0.795322 | 0.112058 | 0 | 0 | 0 | 0 | 0.062674 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.166667 | 0.166667 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f0dd020426d165c6b539dc3e3d0d892e84701a65 | 306 | py | Python | models/__init__.py | Ankur-Deka/pytorch_segmentation | 27f5f0213e2ade7441aa8892e8734e3f00e05ec3 | [
"MIT"
] | 1 | 2020-04-23T04:35:25.000Z | 2020-04-23T04:35:25.000Z | models/__init__.py | Ankur-Deka/pytorch_segmentation | 27f5f0213e2ade7441aa8892e8734e3f00e05ec3 | [
"MIT"
] | 5 | 2021-06-08T22:01:01.000Z | 2022-03-19T02:31:19.000Z | models/__init__.py | Ankur-Deka/pytorch_segmentation | 27f5f0213e2ade7441aa8892e8734e3f00e05ec3 | [
"MIT"
] | 1 | 2020-11-27T08:44:10.000Z | 2020-11-27T08:44:10.000Z | from .fcn import FCN8
from .unet import UNet
from .segnet import SegNet
from .segnet import SegResNet
from .enet import ENet
from .gcn import GCN
from .deeplabv3_plus import DeepLab
from .duc_hdc import DeepLab_DUC_HDC
from .upernet import UperNet
from .pspnet import PSPNet
from .pspnet import PSPDenseNet | 27.818182 | 36 | 0.823529 | 48 | 306 | 5.166667 | 0.354167 | 0.080645 | 0.129032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007605 | 0.140523 | 306 | 11 | 37 | 27.818182 | 0.935361 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f0e457bbd9d672db318da359b6b4524c6ddb49f6 | 505 | py | Python | Curso_02_Validacoes_buscas_filtros_e_deploy/clientes/validators.py | dev-nando/API_com_Django_3_Django_Rest_Framework | 418f0ba09625fee1bcfb96df333082167116e4eb | [
"MIT"
] | null | null | null | Curso_02_Validacoes_buscas_filtros_e_deploy/clientes/validators.py | dev-nando/API_com_Django_3_Django_Rest_Framework | 418f0ba09625fee1bcfb96df333082167116e4eb | [
"MIT"
] | null | null | null | Curso_02_Validacoes_buscas_filtros_e_deploy/clientes/validators.py | dev-nando/API_com_Django_3_Django_Rest_Framework | 418f0ba09625fee1bcfb96df333082167116e4eb | [
"MIT"
] | null | null | null | from statistics import mode
from urllib import response
import re
from validate_docbr import CPF
def cpf_valido(numero_do_cpf):
cpf = CPF()
return cpf.validate(numero_do_cpf)
def nome_valido(nome):
return nome.isalpha()
def rg_valido(numero_do_rg):
return len(numero_do_rg) == 9
def celular_valido(numero_celular):
"""Verifica se o celular é válido (11 91234-1234)"""
modelo = '[0-9]{2} [0-9]{5}-[0-9]{4}'
resposta = re.findall(modelo, numero_celular)
return resposta
| 22.954545 | 56 | 0.710891 | 80 | 505 | 4.3 | 0.45 | 0.093023 | 0.081395 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05036 | 0.174257 | 505 | 21 | 57 | 24.047619 | 0.77458 | 0.091089 | 0 | 0 | 0 | 0 | 0.057395 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.266667 | 0.133333 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f0f3be5a4680f6c6cc2516e736a147e377f49780 | 82 | py | Python | loamy/exceptions.py | erm/typehint-serialization-experiment | bb3d1559f2c4133bbfbeaa7242b677b31ecbbd21 | [
"MIT"
] | 1 | 2018-12-03T12:15:38.000Z | 2018-12-03T12:15:38.000Z | loamy/exceptions.py | erm/typehint-serialization-experiment | bb3d1559f2c4133bbfbeaa7242b677b31ecbbd21 | [
"MIT"
] | null | null | null | loamy/exceptions.py | erm/typehint-serialization-experiment | bb3d1559f2c4133bbfbeaa7242b677b31ecbbd21 | [
"MIT"
] | null | null | null | class ValidationError(Exception):
"""Raise when a validation error occurs."""
| 27.333333 | 47 | 0.731707 | 9 | 82 | 6.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146341 | 82 | 2 | 48 | 41 | 0.857143 | 0.45122 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9bf5916d4e8fd591a8df55c95ad51e939898d3c1 | 23 | py | Python | MalmoEnv/malmoenv/version.py | Diffblue-benchmarks/Microsoft-malmo | 4c4f789040db72a77f3f838319a5c02f2c66e829 | [
"MIT"
] | 3,570 | 2016-07-08T04:04:25.000Z | 2019-05-05T12:05:38.000Z | MalmoEnv/malmoenv/version.py | Diffblue-benchmarks/Microsoft-malmo | 4c4f789040db72a77f3f838319a5c02f2c66e829 | [
"MIT"
] | 592 | 2016-07-08T10:33:40.000Z | 2019-05-03T15:08:15.000Z | MalmoEnv/malmoenv/version.py | Diffblue-benchmarks/Microsoft-malmo | 4c4f789040db72a77f3f838319a5c02f2c66e829 | [
"MIT"
] | 607 | 2016-07-08T01:01:52.000Z | 2019-05-05T22:06:40.000Z | malmo_version="0.37.0"
| 11.5 | 22 | 0.73913 | 5 | 23 | 3.2 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 0.043478 | 23 | 1 | 23 | 23 | 0.545455 | 0 | 0 | 0 | 0 | 0 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
aca612987c5eba3cb4c0d4d1c1e4d177c2860b43 | 921 | py | Python | delogger/presets/profiler.py | deresmos/delogger | c185e4fd844414d561f521103975b95bd31aff43 | [
"MIT"
] | 5 | 2018-11-25T12:08:31.000Z | 2021-12-05T16:34:02.000Z | delogger/presets/profiler.py | deresmos/delogger | c185e4fd844414d561f521103975b95bd31aff43 | [
"MIT"
] | null | null | null | delogger/presets/profiler.py | deresmos/delogger | c185e4fd844414d561f521103975b95bd31aff43 | [
"MIT"
] | null | null | null | from logging import Logger
from delogger.decorators.debug_log import DebugLog
from delogger.decorators.profiles import LineMemoryProfile
from delogger.decorators.profiles import LineProfile
from delogger.decorators.profiles import LineProfileStats
from delogger.decorators.profiles import MemoryProfile
from delogger.loggers.base import DeloggerBase
from delogger.modes.stream import StreamColorDebugMode
from delogger.presets.base import PresetsBase
class ProfilerPresets(PresetsBase):
def make_logger(self, delogger: DeloggerBase) -> Logger:
delogger.load_modes(StreamColorDebugMode(), self.count_rorating_filemode())
delogger.load_decorators(
DebugLog(),
LineProfile(),
LineProfileStats(),
MemoryProfile(),
LineMemoryProfile(),
)
return delogger.get_logger()
logger = ProfilerPresets("profiler_logger").get_logger()
| 32.892857 | 83 | 0.756786 | 89 | 921 | 7.730337 | 0.382022 | 0.139535 | 0.159884 | 0.174419 | 0.209302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173724 | 921 | 27 | 84 | 34.111111 | 0.904074 | 0 | 0 | 0 | 0 | 0 | 0.016287 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0 | 0.428571 | 0 | 0.571429 | 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 |
acc11e32a302cb938903ff9dcab5418db04048e1 | 638 | py | Python | Packs/GoogleChronicleBackstory/Scripts/ListDeviceEventsScript/ListDeviceEventsScript.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/GoogleChronicleBackstory/Scripts/ListDeviceEventsScript/ListDeviceEventsScript.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/GoogleChronicleBackstory/Scripts/ListDeviceEventsScript/ListDeviceEventsScript.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | from CommonServerPython import *
asset_identifier = demisto.args().get('asset_identifier')
asset_identifier_type = 'Host Name'
if is_mac_address(asset_identifier):
asset_identifier_type = 'MAC Address'
if is_ip_valid(asset_identifier, accept_v6_ips=True):
asset_identifier_type = 'IP Address'
result = demisto.executeCommand('gcb-list-events',
{
'asset_identifier': asset_identifier,
'asset_identifier_type': asset_identifier_type
}
)
demisto.results(result)
| 35.444444 | 82 | 0.589342 | 60 | 638 | 5.9 | 0.45 | 0.466102 | 0.268362 | 0.338983 | 0.288136 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002358 | 0.335423 | 638 | 17 | 83 | 37.529412 | 0.832547 | 0 | 0 | 0 | 0 | 0 | 0.153605 | 0.032915 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.071429 | 0 | 0.071429 | 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 |
acc65a7fe0fec8ee565e4e744dd5d57a121cb453 | 129 | py | Python | test/simple_source/branching/05_if.py | gauravssnl/python-uncompyle6 | 136f42a610c0701e0770c1c278efd1107b1c6ed1 | [
"MIT"
] | 1 | 2021-03-24T11:54:03.000Z | 2021-03-24T11:54:03.000Z | test/simple_source/branching/05_if.py | gauravssnl/python-uncompyle6 | 136f42a610c0701e0770c1c278efd1107b1c6ed1 | [
"MIT"
] | null | null | null | test/simple_source/branching/05_if.py | gauravssnl/python-uncompyle6 | 136f42a610c0701e0770c1c278efd1107b1c6ed1 | [
"MIT"
] | null | null | null | # Tests:
# ifstmt ::= testexpr _ifstmts_jump
# _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD COME_FROM
if True:
b = False
| 16.125 | 56 | 0.689922 | 18 | 129 | 4.5 | 0.833333 | 0.271605 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217054 | 129 | 7 | 57 | 18.428571 | 0.80198 | 0.751938 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
acca0a498f93afcc0ddd1888e08363fbec04bd50 | 1,293 | py | Python | tests/test_internals_field_writer.py | ujjwalsh/gfapy | 891ef3df695f20c67809e5a54549c876d90690b4 | [
"ISC"
] | 44 | 2017-03-18T08:08:04.000Z | 2021-11-10T16:11:15.000Z | tests/test_internals_field_writer.py | ujjwalsh/gfapy | 891ef3df695f20c67809e5a54549c876d90690b4 | [
"ISC"
] | 22 | 2017-04-04T21:20:31.000Z | 2022-03-09T19:05:30.000Z | tests/test_internals_field_writer.py | ujjwalsh/gfapy | 891ef3df695f20c67809e5a54549c876d90690b4 | [
"ISC"
] | 5 | 2017-07-07T02:56:56.000Z | 2020-09-30T20:10:49.000Z | import gfapy
import unittest
class TestInternalsFieldWriter(unittest.TestCase):
def test_field_writer_i(self):
self.assertEqual("13", gfapy.Field._to_gfa_field(13))
def test_field_writer_f(self):
self.assertEqual("1.3", gfapy.Field._to_gfa_field(1.3))
def test_field_writer_Z(self):
self.assertEqual("1B", gfapy.Field._to_gfa_field("1B"))
def test_field_writer_H(self):
self.assertEqual("0D0D0D",
gfapy.Field._to_gfa_field(gfapy.ByteArray([13,13,13])))
with self.assertRaises(gfapy.ValueError):
gfapy.Field._to_gfa_field(gfapy.ByteArray([13,13,1.3]))
with self.assertRaises(gfapy.ValueError):
gfapy.Field._to_gfa_field(gfapy.ByteArray([13,13,350]))
def test_field_writer_B(self):
self.assertEqual("C,13,13,13", gfapy.Field._to_gfa_field([13,13,13]))
self.assertEqual("f,1.3,1.3,1.3", gfapy.Field._to_gfa_field([1.3,1.3,1.3]))
with self.assertRaises(gfapy.ValueError):
gfapy.Field._to_gfa_field([13,1.3,1.3], "B")
def test_field_writer_J(self):
self.assertEqual("[\"A\", 12]", gfapy.Field._to_gfa_field(["A", 12]))
self.assertEqual("{\"A\": 12}", gfapy.Field._to_gfa_field({"A" : 12}))
def test_field_writer_as_tag(self):
self.assertEqual("AA:i:13", gfapy.Field._to_gfa_tag(13, "AA"))
| 38.029412 | 79 | 0.699149 | 208 | 1,293 | 4.067308 | 0.173077 | 0.141844 | 0.170213 | 0.212766 | 0.550827 | 0.507092 | 0.497636 | 0.440898 | 0.440898 | 0.339244 | 0 | 0.065487 | 0.126063 | 1,293 | 33 | 80 | 39.181818 | 0.683186 | 0 | 0 | 0.115385 | 0 | 0 | 0.049497 | 0 | 0 | 0 | 0 | 0 | 0.461538 | 1 | 0.269231 | false | 0 | 0.076923 | 0 | 0.384615 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
acdbbb6c0e8c73723babf1c1977b9a9af886c736 | 948 | py | Python | gateway/base/node.py | chijy777/pycots | 432c4a921c05244fedf4b1b0f69bcdc872e5ca20 | [
"BSD-3-Clause"
] | null | null | null | gateway/base/node.py | chijy777/pycots | 432c4a921c05244fedf4b1b0f69bcdc872e5ca20 | [
"BSD-3-Clause"
] | null | null | null | gateway/base/node.py | chijy777/pycots | 432c4a921c05244fedf4b1b0f69bcdc872e5ca20 | [
"BSD-3-Clause"
] | null | null | null | """
COT Service
Author: Tony Chi
Updated at: 2018-06
Content : Class for managed node.
"""
# -*- coding: utf-8 -*-
import logging
import time
logger = logging.getLogger("pycots.gw.base.node")
class Node():
"""
Class for managed nodes.
"""
def __init__(self, uid, **default_resources):
self.uid = uid
self.last_seen = time.time()
self.resources = default_resources
def __eq__(self, other):
return self.uid == other.uid
def __gt__(self, other):
return self.uid > other.uid
def __repr__(self):
return "Node <{}>".format(self.uid)
def update_last_seen(self):
self.last_seen = time.time()
def set_resource_value(self, resource, value):
if resource not in self.resources:
self.resources.update({resource: value})
else:
self.resources[resource] = value
def clear_resources(self):
self.resources = {}
| 21.545455 | 52 | 0.614979 | 117 | 948 | 4.769231 | 0.418803 | 0.062724 | 0.053763 | 0.057348 | 0.189964 | 0.11828 | 0.11828 | 0.11828 | 0 | 0 | 0 | 0.01 | 0.261603 | 948 | 43 | 53 | 22.046512 | 0.787143 | 0.139241 | 0 | 0.086957 | 0 | 0 | 0.035309 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.304348 | false | 0 | 0.086957 | 0.130435 | 0.565217 | 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 |
4a07f4c8ab494ade9906a02ebf70b25ec12ed51d | 3,645 | py | Python | antelope/interfaces/abstract_query.py | AntelopeLCA/antelope_lca | 18ae7621713c8cc92c7d8fcc7c0810c1ca3fea32 | [
"BSD-3-Clause"
] | 1 | 2021-10-01T01:07:45.000Z | 2021-10-01T01:07:45.000Z | antelope/interfaces/abstract_query.py | AntelopeLCA/antelope | 3a689b40bb4b53d27d8a2750b3bcc37e8d571377 | [
"BSD-3-Clause"
] | null | null | null | antelope/interfaces/abstract_query.py | AntelopeLCA/antelope | 3a689b40bb4b53d27d8a2750b3bcc37e8d571377 | [
"BSD-3-Clause"
] | null | null | null | """
Root-level catalog interface
"""
class ValidationError(Exception):
pass
class PrivateArchive(Exception):
pass
class EntityNotFound(Exception):
pass
class NoAccessToEntity(Exception):
"""
Used when the actual entity is not accessible, i.e. when a ref cannot dereference itself
"""
pass
class AbstractQuery(object):
"""
Not-qute-abstract base class for executing queries
Query implementation must provide:
- origin (property)
- _iface (generator: itype)
- _tm (property) a TermManager
"""
_validated = None
'''
Overridde these methods
'''
@property
def origin(self):
return NotImplemented
def make_ref(self, entity):
raise NotImplementedError
def _perform_query(self, itype, attrname, exc, *args, strict=False, **kwargs):
raise NotImplementedError
'''
Internal workings
'''
'''
Can be overridden
'''
def _grounded_query(self, origin):
"""
Pseudo-abstract method used to construct entity references from a query that is anchored to a metaresource.
must be overriden by user-facing subclasses if resources beyond self are required to answer
the queries (e.g. a catalog).
:param origin:
:return:
"""
return self
"""
Basic "Documentary" interface implementation
From JIE submitted:
- get(id)
- properties(id)
- get item(id, item)
- get reference(id)
- synonyms(id-or-string)
provided but not spec'd:
- validate
- get_uuid
"""
def validate(self):
if self._validated is None:
try:
self._perform_query('basic', 'validate', ValidationError)
self._validated = True
except ValidationError:
self._validated = False
return self._validated
def get(self, eid, **kwargs):
"""
Basic entity retrieval-- should be supported by all implementations
:param eid:
:param kwargs:
:return:
"""
return self._perform_query('basic', 'get', EntityNotFound, eid,
**kwargs)
def properties(self, external_ref, **kwargs):
"""
Get an entity's list of properties
:param external_ref:
:param kwargs:
:return:
"""
return self._perform_query('basic', 'properties', EntityNotFound, external_ref, **kwargs)
def get_item(self, external_ref, item):
"""
access an entity's dictionary items
:param external_ref:
:param item:
:return:
"""
'''
if hasattr(external_ref, 'external_ref'): # debounce
err_str = external_ref.external_ref
else:
err_str = external_ref
'''
return self._perform_query('basic', 'get_item', EntityNotFound,
external_ref, item)
def get_uuid(self, external_ref):
return self._perform_query('basic', 'get_uuid', EntityNotFound,
external_ref)
def get_reference(self, external_ref):
return self._perform_query('basic', 'get_reference', EntityNotFound,
external_ref)
def synonyms(self, item, **kwargs):
"""
Return a list of synonyms for the object -- quantity, flowable, or compartment
:param item:
:return: list of strings
"""
return self._perform_query('basic', 'synonyms', EntityNotFound, item,
**kwargs)
| 26.605839 | 115 | 0.58107 | 369 | 3,645 | 5.604336 | 0.368564 | 0.079787 | 0.054159 | 0.071083 | 0.120406 | 0.10735 | 0.105899 | 0.105899 | 0.04352 | 0 | 0 | 0 | 0.325926 | 3,645 | 136 | 116 | 26.801471 | 0.841677 | 0.252401 | 0 | 0.227273 | 0 | 0 | 0.049102 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.090909 | 0 | 0.068182 | 0.590909 | 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 |
4a09f9f11cac2da434e858d9ad15cde7dda97591 | 61 | py | Python | eurostatapiclient/__init__.py | ckauth/eurostat-api-client | 70c859881d50b3eca275434e2590ff7d76b290e9 | [
"Apache-2.0"
] | null | null | null | eurostatapiclient/__init__.py | ckauth/eurostat-api-client | 70c859881d50b3eca275434e2590ff7d76b290e9 | [
"Apache-2.0"
] | null | null | null | eurostatapiclient/__init__.py | ckauth/eurostat-api-client | 70c859881d50b3eca275434e2590ff7d76b290e9 | [
"Apache-2.0"
] | null | null | null | from .client import EurostatAPIClient
__version__ = "0.2.6"
| 15.25 | 37 | 0.770492 | 8 | 61 | 5.375 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.056604 | 0.131148 | 61 | 3 | 38 | 20.333333 | 0.754717 | 0 | 0 | 0 | 0 | 0 | 0.081967 | 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 |
4a0d093369bc2e08d213744c334aad38732708d6 | 180 | py | Python | wfs/urls.py | vascop/django-wfs | e13e3fcba574de3da94d9081f603efaffe972f14 | [
"Apache-2.0"
] | 6 | 2015-06-22T12:42:45.000Z | 2018-04-04T10:09:57.000Z | wfs/urls.py | vascop/django-wfs | e13e3fcba574de3da94d9081f603efaffe972f14 | [
"Apache-2.0"
] | 2 | 2016-06-17T18:51:15.000Z | 2017-06-26T11:35:07.000Z | wfs/urls.py | vascop/django-wfs | e13e3fcba574de3da94d9081f603efaffe972f14 | [
"Apache-2.0"
] | 8 | 2016-06-06T21:15:05.000Z | 2022-02-11T20:54:39.000Z | from django.conf.urls import patterns, url
from wfs.views import global_handler
# APP
urlpatterns = patterns('',
url(r'^(?P<service_id>\d+)/$', global_handler, name='wfs'),
)
| 22.5 | 63 | 0.7 | 26 | 180 | 4.730769 | 0.730769 | 0.178862 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127778 | 180 | 7 | 64 | 25.714286 | 0.783439 | 0.016667 | 0 | 0 | 0 | 0 | 0.142857 | 0.125714 | 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 |
4a1db20289da0e284fc2ec5b7c6baf51bc7fe618 | 184 | py | Python | basic_grammar/tuple_usecase.py | OnoYuta/python_programing | 5d191bef5666c0a826f6daa0bd45bc9dd6603d59 | [
"MIT"
] | null | null | null | basic_grammar/tuple_usecase.py | OnoYuta/python_programing | 5d191bef5666c0a826f6daa0bd45bc9dd6603d59 | [
"MIT"
] | null | null | null | basic_grammar/tuple_usecase.py | OnoYuta/python_programing | 5d191bef5666c0a826f6daa0bd45bc9dd6603d59 | [
"MIT"
] | null | null | null | # 選択肢が書き換えられないようにlistではなくtupleを使う
chose_from_two = ('A', 'B', 'C')
answer = []
answer.append('A')
answer.append('C')
print(chose_from_two)
# ('A', 'B', 'C')
print(answer)
# ['A', 'C'] | 18.4 | 33 | 0.625 | 25 | 184 | 4.44 | 0.4 | 0.162162 | 0.216216 | 0.234234 | 0.27027 | 0.27027 | 0 | 0 | 0 | 0 | 0 | 0 | 0.11413 | 184 | 10 | 34 | 18.4 | 0.680982 | 0.315217 | 0 | 0 | 0 | 0 | 0.04065 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 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 | 0 | 0 | 3 |
4a2562e824504fe0d49fb1917ab8720c17848638 | 1,036 | py | Python | fibonacci_calculator_mpu/Calculator/FibonacciService.py | MaartenUijen/fibonacci_calculator_mpu | b96b1894d4801b3332726cc503618a9d6b8bef29 | [
"MIT"
] | null | null | null | fibonacci_calculator_mpu/Calculator/FibonacciService.py | MaartenUijen/fibonacci_calculator_mpu | b96b1894d4801b3332726cc503618a9d6b8bef29 | [
"MIT"
] | null | null | null | fibonacci_calculator_mpu/Calculator/FibonacciService.py | MaartenUijen/fibonacci_calculator_mpu | b96b1894d4801b3332726cc503618a9d6b8bef29 | [
"MIT"
] | null | null | null | from typing import List
from fibonacci_calculator_mpu.Calculator.FibonacciData import FibonacciData
class FibonacciService:
def __init__(self):
""" Instance of Fibonacci Data"""
self.f = FibonacciData()
def get_fibonacci_number(self, n: int) -> int:
"""
:param n: An index.
:return: Fibonacci number based on index.
"""
return self.f.add_fibonacci_number(n)
def get_fibonacci_sequence(self, n: int) -> List[int]:
"""
:param n: An index.
:return: A list with fibonacci sequence until the given index.
"""
return self.f.build_sequence(n)
def get_fibonacci_index(self, fibonacci_number: int) -> int:
"""
:param fibonacci_number: An arbitrary number.
:return: The index corresponding to the fibonacci_number. If it is not a fibonacci
number it returns an index corresponding to the closest fibonacci number.
"""
return self.f.search_index_fibonacci_number(fibonacci_number)
| 32.375 | 90 | 0.655405 | 127 | 1,036 | 5.173228 | 0.354331 | 0.228311 | 0.068493 | 0.033486 | 0.066971 | 0.066971 | 0 | 0 | 0 | 0 | 0 | 0 | 0.259653 | 1,036 | 31 | 91 | 33.419355 | 0.856584 | 0.361004 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0 | 0.181818 | 0 | 0.909091 | 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 |
c57fd526d31ebeb7b4184b911a6eb83cf38314b0 | 58 | py | Python | lib/flask_api/__init__.py | imtiaz-emu/gcp-flask-test | 096f466242aa14941712ab8ea06ac4fb4eaeb993 | [
"Apache-2.0"
] | null | null | null | lib/flask_api/__init__.py | imtiaz-emu/gcp-flask-test | 096f466242aa14941712ab8ea06ac4fb4eaeb993 | [
"Apache-2.0"
] | null | null | null | lib/flask_api/__init__.py | imtiaz-emu/gcp-flask-test | 096f466242aa14941712ab8ea06ac4fb4eaeb993 | [
"Apache-2.0"
] | null | null | null | from flask_api.app import FlaskAPI
__version__ = '0.6.4'
| 14.5 | 34 | 0.758621 | 10 | 58 | 3.9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06 | 0.137931 | 58 | 3 | 35 | 19.333333 | 0.72 | 0 | 0 | 0 | 0 | 0 | 0.086207 | 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 |
c5aa1fae4faf82025c3b6f68ae03fc13af869164 | 2,006 | py | Python | metric_descriptions.py | simonccc/pa-to-graphite | d338e6818cda39d1d7399835dbf1283f2af1cc52 | [
"MIT-0"
] | null | null | null | metric_descriptions.py | simonccc/pa-to-graphite | d338e6818cda39d1d7399835dbf1283f2af1cc52 | [
"MIT-0"
] | null | null | null | metric_descriptions.py | simonccc/pa-to-graphite | d338e6818cda39d1d7399835dbf1283f2af1cc52 | [
"MIT-0"
] | null | null | null | from collections import namedtuple
MetricDescription = namedtuple('MetricDescription', ['name', 'agg', 'dimensions'])
def get_working_metric_descriptions():
return [
MetricDescription(name='CPU_Utilization', agg='avg', dimensions=[ 'Operation', ]),
MetricDescription(name='Heap_AllocRate', agg='avg', dimensions=[ 'Operation', ]),
MetricDescription(name='IO_ReadThroughput', agg='avg', dimensions=[ 'Operation', ]),
MetricDescription(name='IO_WriteThroughput', agg='avg', dimensions=[ 'Operation', ]),
MetricDescription(name='IO_ReadSyscallRate', agg='avg', dimensions=[ 'Operation', ]),
MetricDescription(name='IO_WriteSyscallRate', agg='avg', dimensions=[ 'Operation', ]),
MetricDescription(name='Thread_Blocked_Time', agg='avg', dimensions=[ 'Operation', ]),
MetricDescription(name='Thread_Blocked_Event', agg='avg', dimensions=[ 'Operation', ]),
MetricDescription(name='ShardEvents', agg='avg', dimensions=['Operation']),
MetricDescription(name='ShardBulkDocs', agg='avg', dimensions=['Operation']),
MetricDescription(name='Latency', agg='avg', dimensions=['Operation', ]),
MetricDescription(name='GC_Collection_Event', agg='avg', dimensions=['MemType']),
MetricDescription(name='GC_Collection_Time', agg='avg', dimensions=['MemType']),
MetricDescription(name='Heap_Committed', agg='avg', dimensions=['MemType']),
MetricDescription(name='Heap_Used', agg='avg', dimensions=['MemType']),
MetricDescription(name='ThreadPool_QueueSize', agg='avg', dimensions=['ThreadPoolType']),
MetricDescription(name='ThreadPool_RejectedReqs', agg='avg', dimensions=['ThreadPoolType']),
MetricDescription(name='ThreadPool_ActiveThreads', agg='avg', dimensions=['ThreadPoolType']),
MetricDescription(name='HTTP_RequestDocs', agg='avg', dimensions=['Operation', ]),
MetricDescription(name='HTTP_TotalRequests', agg='avg', dimensions=['Operation', ]),
]
| 74.296296 | 101 | 0.69342 | 177 | 2,006 | 7.723164 | 0.254237 | 0.322604 | 0.234089 | 0.237747 | 0.689832 | 0.689832 | 0.386247 | 0.08632 | 0 | 0 | 0 | 0 | 0.131107 | 2,006 | 26 | 102 | 77.153846 | 0.78428 | 0 | 0 | 0 | 0 | 0 | 0.305583 | 0.02343 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0 | 0.04 | 0.04 | 0.12 | 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 |
c5b8311f0e771969bed986adb24d1bbe82ccfc0e | 311 | py | Python | flambe/runnable/__init__.py | ethan-asapp/flambe | 70257167058c7b82ee39f74167a6161bd264ad18 | [
"MIT"
] | 148 | 2019-08-29T21:19:03.000Z | 2022-03-18T06:13:53.000Z | flambe/runnable/__init__.py | cle-ros/flambe | 0dc2f5b2b286694defe8abf450fe5be9ae12c097 | [
"MIT"
] | 108 | 2019-09-03T14:36:10.000Z | 2020-05-13T15:53:14.000Z | flambe/runnable/__init__.py | cle-ros/flambe | 0dc2f5b2b286694defe8abf450fe5be9ae12c097 | [
"MIT"
] | 21 | 2019-09-08T14:09:45.000Z | 2020-12-27T04:12:33.000Z | from flambe.runnable.runnable import Runnable
from flambe.runnable.cluster_runnable import ClusterRunnable
from flambe.runnable.context import SafeExecutionContext
from flambe.runnable.environment import RemoteEnvironment
__all__ = ['Runnable', 'SafeExecutionContext', 'ClusterRunnable', 'RemoteEnvironment']
| 38.875 | 86 | 0.85209 | 30 | 311 | 8.666667 | 0.366667 | 0.153846 | 0.276923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07717 | 311 | 7 | 87 | 44.428571 | 0.905923 | 0 | 0 | 0 | 0 | 0 | 0.192926 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6809d32310972329f3306873064137ee8e5f164d | 89 | py | Python | src/alvarium/hash/exceptions.py | welo10/alvarium-sdk-python | a62aeafc62bd6bc4e11538c357e422e7a51cf825 | [
"Apache-2.0"
] | null | null | null | src/alvarium/hash/exceptions.py | welo10/alvarium-sdk-python | a62aeafc62bd6bc4e11538c357e422e7a51cf825 | [
"Apache-2.0"
] | null | null | null | src/alvarium/hash/exceptions.py | welo10/alvarium-sdk-python | a62aeafc62bd6bc4e11538c357e422e7a51cf825 | [
"Apache-2.0"
] | null | null | null | class HashException(Exception):
"""a custom exception for hash related opertations""" | 44.5 | 57 | 0.764045 | 10 | 89 | 6.8 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134831 | 89 | 2 | 57 | 44.5 | 0.883117 | 0.52809 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a8460c3a8d6188bfb1cca43c3f15c7a2a497d0e8 | 128 | py | Python | tasks/urls.py | seancallaway/TaskWatcher | d210b2499cdbe6410014c326a7d156b0e561f2ee | [
"MIT"
] | 2 | 2017-11-07T18:12:05.000Z | 2018-03-15T00:08:31.000Z | tasks/urls.py | seancallaway/TaskWatcher | d210b2499cdbe6410014c326a7d156b0e561f2ee | [
"MIT"
] | 12 | 2017-11-01T18:54:56.000Z | 2021-09-22T18:46:18.000Z | tasks/urls.py | seancallaway/TaskWatcher | d210b2499cdbe6410014c326a7d156b0e561f2ee | [
"MIT"
] | null | null | null | from django.urls import path
from tasks.views import HomePage
urlpatterns = [
path('', HomePage.as_view(), name='home'),
]
| 18.285714 | 46 | 0.703125 | 17 | 128 | 5.235294 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15625 | 128 | 6 | 47 | 21.333333 | 0.824074 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 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 |
a8470cc0bcf8909810b2d2fb66353d7f6a89e60a | 318 | py | Python | Programming Languages/Python/Theory/100_Python_Challenges/Section_4_Dictionary/74. map two lists into a dictionary.py | jaswinder9051998/Resources | fd468af37bf24ca57555d153ee64693c018e822e | [
"MIT"
] | 101 | 2021-12-20T11:57:11.000Z | 2022-03-23T09:49:13.000Z | Programming Languages/Python/Theory/100_Python_Challenges/Section_4_Dictionary/74. map two lists into a dictionary.py | Sid-1164/Resources | 3987dcaeddc8825f9bc79609ff26094282b8ece1 | [
"MIT"
] | 4 | 2022-01-12T11:55:56.000Z | 2022-02-12T04:53:33.000Z | Programming Languages/Python/Theory/100_Python_Challenges/Section_4_Dictionary/74. map two lists into a dictionary.py | Sid-1164/Resources | 3987dcaeddc8825f9bc79609ff26094282b8ece1 | [
"MIT"
] | 38 | 2022-01-12T11:56:16.000Z | 2022-03-23T10:07:52.000Z | """
Write a Python function to map two lists into a dictionary.
list1 contains the keys, list2 contains the values.
Input lists:
list1 = [1,2,3,4,5]
list2 = [6,7,8,9,10]
Expected output: {1: 6, 2: 7, 3: 8, 4: 9, 5: 10}
"""
#Solution is:
def map_lists(list1,list2):
return (dict(zip(list1,list2)))
| 16.736842 | 60 | 0.632075 | 57 | 318 | 3.508772 | 0.614035 | 0.11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 0.213836 | 318 | 18 | 61 | 17.666667 | 0.68 | 0.732704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a85556eced2b85b47d8fd71b8044745ae9d0628a | 233 | py | Python | Dataset/Leetcode/test/104/495.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/test/104/495.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/test/104/495.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution(object):
def XXX(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root:
return 0
return max (self.XXX(root.left)+1 , self.XXX(root.right)+1)
| 21.181818 | 67 | 0.493562 | 29 | 233 | 3.965517 | 0.655172 | 0.121739 | 0.191304 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020548 | 0.373391 | 233 | 10 | 68 | 23.3 | 0.767123 | 0.137339 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
a866b01d60cb70f35370a3a519f95f0644cbdccd | 717 | py | Python | app/backend.py | phaksheet/guessthesong | f5d70dea5271286b2e8faea5dd6cb04a06635eee | [
"MIT"
] | 2 | 2018-12-15T21:17:10.000Z | 2018-12-15T21:17:17.000Z | app/backend.py | phaksheet/guessthesong | f5d70dea5271286b2e8faea5dd6cb04a06635eee | [
"MIT"
] | 4 | 2018-12-18T15:38:18.000Z | 2018-12-18T16:44:34.000Z | app/backend.py | DubThink/Guessong | 9200dddd27658f2627d26b1b1fd9de6c56b8931a | [
"MIT"
] | null | null | null | import app
def create_lobby():
return app.gameManager.create_game().roomID
def join_lobby(room, username):
game = app.gameManager.get_game(room.upper())
if game == None:
print("No room")
return None
else:
return game.add_user(username)
def start_game(room, name, playlist, song_length):
game = app.gameManager.get_game(room.upper())
game.set_playlist(int(playlist))
game.guess_time = int(song_length)
app.gameManager.start_game(room.upper())
def get_game(room):
return app.gameManager.get_game(room.upper())
def update_game_state(roomcode, game):
#print("emitting:" + roomcode)
#app.socketio.emit("update_game", "plub")
return True
| 23.129032 | 50 | 0.683403 | 97 | 717 | 4.876289 | 0.391753 | 0.10148 | 0.093023 | 0.133192 | 0.207188 | 0.207188 | 0.143763 | 0 | 0 | 0 | 0 | 0 | 0.188285 | 717 | 30 | 51 | 23.9 | 0.812715 | 0.096234 | 0 | 0.105263 | 0 | 0 | 0.010836 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0.052632 | 0.157895 | 0.578947 | 0.052632 | 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 |
a86c40cc958cd0077b94e247ad41fc02eaef2242 | 75 | py | Python | PythonScripts/PythonBootcamp/Loops/RangeFunction.py | SleepWalKer09/PythonProjects | 6c2a5106f61ce6488ec4586efca214f1a3a3baf8 | [
"MIT"
] | null | null | null | PythonScripts/PythonBootcamp/Loops/RangeFunction.py | SleepWalKer09/PythonProjects | 6c2a5106f61ce6488ec4586efca214f1a3a3baf8 | [
"MIT"
] | null | null | null | PythonScripts/PythonBootcamp/Loops/RangeFunction.py | SleepWalKer09/PythonProjects | 6c2a5106f61ce6488ec4586efca214f1a3a3baf8 | [
"MIT"
] | null | null | null | #valores del 5 al 100 con paso de 3
for x in range(5,100,3):
print(x) | 25 | 36 | 0.64 | 18 | 75 | 2.666667 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 0.253333 | 75 | 3 | 37 | 25 | 0.678571 | 0.453333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
a878dbabb454ae6374cb2707873db49347c693ea | 90 | py | Python | pomodorr/projects/signals/dispatchers.py | kamil559/pomodorr | 232e6e98ff3481561dd1235794b3960066713210 | [
"MIT"
] | null | null | null | pomodorr/projects/signals/dispatchers.py | kamil559/pomodorr | 232e6e98ff3481561dd1235794b3960066713210 | [
"MIT"
] | 15 | 2020-04-11T18:30:57.000Z | 2020-07-05T09:37:43.000Z | pomodorr/projects/signals/dispatchers.py | kamil559/pomodorr | 232e6e98ff3481561dd1235794b3960066713210 | [
"MIT"
] | null | null | null | from django.dispatch import Signal
notify_force_finish = Signal(providing_args=['task'])
| 22.5 | 53 | 0.811111 | 12 | 90 | 5.833333 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088889 | 90 | 3 | 54 | 30 | 0.853659 | 0 | 0 | 0 | 0 | 0 | 0.044444 | 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 |
a87a9091e7031cf065b6aec2625b4c9b6167dde2 | 335 | py | Python | mercadolivre/forms.py | igorgiordan/teste | da1e23901a32887ec7dc36ca0b35024fe2c906d3 | [
"MIT"
] | null | null | null | mercadolivre/forms.py | igorgiordan/teste | da1e23901a32887ec7dc36ca0b35024fe2c906d3 | [
"MIT"
] | null | null | null | mercadolivre/forms.py | igorgiordan/teste | da1e23901a32887ec7dc36ca0b35024fe2c906d3 | [
"MIT"
] | null | null | null | from django import forms
from . import models
from django.contrib.admin.widgets import AdminDateWidget
from django.forms.fields import DateField
class AddProdutoForm(forms.ModelForm):
datafim = forms.DateField(widget=AdminDateWidget)
class Meta:
model = models.Produto
fields = ['nome', 'descricao', 'datafim', 'lancemin']
| 33.5 | 57 | 0.773134 | 39 | 335 | 6.641026 | 0.564103 | 0.11583 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131343 | 335 | 9 | 58 | 37.222222 | 0.890034 | 0 | 0 | 0 | 0 | 0 | 0.083582 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a8b6ba0606c28f884ae1cbd4637da06e1aa3c33a | 1,339 | py | Python | env/Lib/site-packages/OpenGL/GLES2/KHR/no_error.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 210 | 2016-04-09T14:26:00.000Z | 2022-03-25T18:36:19.000Z | env/Lib/site-packages/OpenGL/GLES2/KHR/no_error.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 72 | 2016-09-04T09:30:19.000Z | 2022-03-27T17:06:53.000Z | env/Lib/site-packages/OpenGL/GLES2/KHR/no_error.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 64 | 2016-04-09T14:26:49.000Z | 2022-03-21T11:19:47.000Z | '''OpenGL extension KHR.no_error
This module customises the behaviour of the
OpenGL.raw.GLES2.KHR.no_error to provide a more
Python-friendly API
Overview (from the spec)
With this extension enabled any behavior that generates a GL error will
have undefined behavior. The reason this extension exists is performance
can be increased and power usage decreased. When this mode is used, a GL
driver can have undefined behavior where it would have generated a GL error
without this extension. This could include application termination. In
general this extension should be used after you have verified all the GL
errors are removed, and an application is not the kind that would check
for GL errors and adjust behavior based on those errors.
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/KHR/no_error.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GLES2 import _types, _glgets
from OpenGL.raw.GLES2.KHR.no_error import *
from OpenGL.raw.GLES2.KHR.no_error import _EXTENSION_NAME
def glInitNoErrorKHR():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME )
### END AUTOGENERATED SECTION | 39.382353 | 76 | 0.799104 | 202 | 1,339 | 5.242574 | 0.524752 | 0.073654 | 0.047214 | 0.048159 | 0.086874 | 0.086874 | 0.064212 | 0.064212 | 0 | 0 | 0 | 0.003534 | 0.154593 | 1,339 | 34 | 77 | 39.382353 | 0.931979 | 0.761016 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | true | 0 | 0.777778 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a8b6f7bd0ef5ddd89829ade2e372942566386cf4 | 176 | py | Python | reddit/main.py | leedsrising/sentiment_analysis | fe5cee27666235b72e0d130f69e57ed8882fc1a2 | [
"MIT"
] | null | null | null | reddit/main.py | leedsrising/sentiment_analysis | fe5cee27666235b72e0d130f69e57ed8882fc1a2 | [
"MIT"
] | null | null | null | reddit/main.py | leedsrising/sentiment_analysis | fe5cee27666235b72e0d130f69e57ed8882fc1a2 | [
"MIT"
] | null | null | null | from reddit_client import gather_subreddits, handle_posts
text_file= open("hello.txt", "w")
relevant_subreddits = gather_subreddits("photo")
handle_posts(relevant_subreddits) | 29.333333 | 57 | 0.829545 | 23 | 176 | 6 | 0.695652 | 0.231884 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073864 | 176 | 6 | 58 | 29.333333 | 0.846626 | 0 | 0 | 0 | 0 | 0 | 0.084746 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a8bd0f147526501d1e7c8b49a824838e8095607d | 6,188 | py | Python | scripts/sequence_optimization.py | lalten/kreathon2018 | 61fd0cedc949f287ba8ff8ecd3e1f5841264d74b | [
"MIT"
] | null | null | null | scripts/sequence_optimization.py | lalten/kreathon2018 | 61fd0cedc949f287ba8ff8ecd3e1f5841264d74b | [
"MIT"
] | null | null | null | scripts/sequence_optimization.py | lalten/kreathon2018 | 61fd0cedc949f287ba8ff8ecd3e1f5841264d74b | [
"MIT"
] | null | null | null | #! /usr/bin/python
# coding: utf8
import django
django.setup()
from backend.models import Container
import requests
from here_connector import *
from here_sequence_example import HereConector
monday_route = [17, 96, 45, 19, 21, 30, 35, 23, 26, 25, 44, 27, 28, 31, 33, 91, 66, 43, 36, 67, 38, 39, 36, 40, 48, 9] #,
# , 52, 12, 15, 55, 86, 57, 90, 88]
calc_route_url = "https://route.api.here.com/routing/7.2/calculateroute.json"
# monday_positions = list()
#
# for i in monday_route:
# c = Container.objects.get(id=i)
# monday_positions.append("%f,%f"%(c.lat, c.lng))
#
# print monday_positions
#
# app_id = "nAX0YLEqe9rDAffuvS9L"
# app_code = "O_9Z4uw6cbqaUNKCrWvAlg"
#
# def calc_route():
# app_data = {"app_id": app_id, "app_code": app_code}
# app_data['mode'] = 'fastest;car;traffic:disabled'
# for i, p in enumerate(monday_positions):
# app_data['waypoint' + str(i)] = p
# # if i == 10:
# # break
#
# # print (app_data)
# r = requests.get(calc_route_url, app_data)
# # print r.status_code
# # print r.json()
#
# route = r.json()
# return route
#
# route = calc_route()
# legs = route['response']['route'][0]['leg']
# # print len(legs)
#
# total_lenth = 0
#
# way_points = list()
# for leg in legs:
# for l in leg['maneuver']:
# # print l['length']
# total_lenth += l['length']
# way_points.append("%.4f,%.4f" % (l['position']['latitude'], l['position']['longitude']))
#
#
# print "Total Length: %f km" % (total_lenth/1000.0)
# # 36.400000 km
#
# print way_points
#
# print len(way_points)
# way_point_str = ",".join(way_points)
#
# print len(way_point_str)
#
# # print way_point_str
#
# app_data = {"app_id": app_id, "app_code": app_code}
# app_data['h'] = 1024
# app_data['w'] = 1024
# app_data['ppi'] = 320
# app_data['t'] = 3
# app_data['z'] = 17 # zoom level: 20: Haus, 6: Europa
#
# app_data['r'] = way_point_str
# app_data['m'] = way_point_str
# app_data['lc'] = 'ffff0000'
# app_data['sc'] = 'ffff0000'
# app_data['mlbl'] = 0
#
# # app_data['ctr'] = way_points[0]
#
# app_data['lw'] = 7 # line width
#
# r = requests.get(route_url, app_data)
# print r.url
# print r
#
# f = open('/tmp/route.jpg', 'wb')
# f.write(r.content)
# f.close()
#
#
# # def get_positions(route):
# # positions = list()
# # for r in route:
# # try:
# # c = Container.objects.get(id=r)
# #
# # except Container.DoesNotExist:
# # print r, "no position"
# # continue
# #
# # positions.append("%f,%f" % (c.lat, c.lng))
# # return positions
#
# # positions = get_positions(monday_route)
# #
# # print positions
#
#
#
# # route = calc_route(positions)
# #
# # print route
# #
# # route_to_image(route)
#
# #
# #
# #
# # # print monday_route
# #
# # # sequence_url = "https://wse.cit.api.here.com/2/findsequence.json"
# #
# #
# # def find_sequence(self):
# # app_data = {"app_id": self.app_id, "app_code": self.app_code}
# # app_data['start'] = self.loc_to_waypoint(self.container_locations[0])
# # for i, cl in enumerate(self.container_locations):
# # if i == 0:
# # continue
# # app_data['destination' + str(i)] = self.loc_to_waypoint(cl)
# # if i == 10:
# # break
# #
# # app_data['end'] = self.loc_to_waypoint(self.container_locations[-1])
# # app_data['mode'] = 'truck;fastest'
# # # print app_data
# #
# # # print time.time()
# # s = Session()
# # req = Request('GET', url=self.sequence_url, params=app_data).prepare()
# # print (req.url)
# #
# # r = s.send(req)
# #
# # # r = requests.get(self.sequence_url, app_data)
# #
# # # print time.time()
# # # print r.url
# # # print r.status_code
# # print (r.json())
# #
# #
#
# #
# # def find_sequence(self):
# # app_data = {"app_id": self.app_id, "app_code": self.app_code}
# # app_data['start'] = self.loc_to_waypoint(self.container_locations[0])
# # for i, cl in enumerate(self.container_locations):
# # if i == 0:
# # continue
# # app_data['destination' + str(i)] = self.loc_to_waypoint(cl)
# # if i == 10:
# # break
# #
# # app_data['end'] = self.loc_to_waypoint(self.container_locations[-1])
# # app_data['mode'] = 'truck;fastest'
# # # print app_data
# #
# # # print time.time()
# # s = Session()
# # req = Request('GET', url=self.sequence_url, params=app_data).prepare()
# # print (req.url)
# #
# # r = s.send(req)
# #
# # # r = requests.get(self.sequence_url, app_data)
# #
# # # print time.time()
# # # print r.url
# # # print r.status_code
# # print (r.json())
# #
# #
# # def route_to_image(self):
# # legs = self.route['response']['route'][0]['leg']
# # # print len(legs)
# # way_points = list()
# # for leg in legs:
# # for l in leg['maneuver']:
# # way_points.append("%f,%f" % (l['position']['latitude'], l['position']['longitude']))
# #
# # way_point_str = ",".join(way_points)
# # # print way_point_str
# #
# # app_data = {"app_id": self.app_id, "app_code": self.app_code}
# # app_data['h'] = 1024
# # app_data['w'] = 1024
# # app_data['ppi'] = 320
# # app_data['t'] = 3
# # app_data['z'] = 17 # zoom level: 20: Haus, 6: Europa
# #
# # app_data['r'] = way_point_str
# # app_data['m'] = way_point_str
# # app_data['lc'] = '440000ff'
# # app_data['sc'] = '440000ff'
# # app_data['mlbl'] = 0
# #
# # # app_data['ctr'] = way_points[0]
# #
# # app_data['lw'] = 20 # line width
# #
# # r = requests.get(self.route_url, app_data)
# # print (r.url)
# #
# # # print r.content
# #
# # # print r.status_code
# # f = open('/tmp/route.jpg', 'wb')
# # f.write(r.content)
# # f.close()
#
#
#
#
#
# # start=positions[10]
# # for i, p in enumerate(positions):
# # # if i == 0:
# # # continue
# # # print start, p
# #
# # r = calc_route([start, p])
# # d_sum = 0
# # for m in r['response']['route'][0]['leg'][0]['maneuver']:
# # d_sum += m['length']
# #
# # print d_sum
#
#
# break | 25.052632 | 121 | 0.55446 | 835 | 6,188 | 3.91497 | 0.216766 | 0.104925 | 0.030284 | 0.025696 | 0.632303 | 0.588253 | 0.562251 | 0.538085 | 0.492199 | 0.473845 | 0 | 0.037251 | 0.245152 | 6,188 | 247 | 122 | 25.052632 | 0.662599 | 0.837912 | 0 | 0 | 0 | 0 | 0.096828 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.625 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7639fddf280072e904ec11ef540bb6bf468e8d0c | 924 | py | Python | trainingW3C/8_json.py | jgaffuri/pyEx | 3e62612f5bba59c6d421e2fa544ab77c7af85658 | [
"MIT"
] | 1 | 2020-06-11T16:26:59.000Z | 2020-06-11T16:26:59.000Z | trainingW3C/8_json.py | jgaffuri/pyEx | 3e62612f5bba59c6d421e2fa544ab77c7af85658 | [
"MIT"
] | null | null | null | trainingW3C/8_json.py | jgaffuri/pyEx | 3e62612f5bba59c6d421e2fa544ab77c7af85658 | [
"MIT"
] | null | null | null | import json
# JSON to dictionary
y = json.loads('{ "name":"John", "age":30, "city":"New York"}')
print(y)
print(y["age"])
# dictionary to JSON
x = {
"name": "John",
"age": 30,
"city": "New York"
}
y = json.dumps(x)
print(y)
# all to JSON
print(json.dumps({"name": "John", "age": 30}))
print(json.dumps(["apple", "bananas"]))
print(json.dumps(("apple", "bananas")))
print(json.dumps("hello"))
print(json.dumps(42))
print(json.dumps(31.76))
print(json.dumps(True))
print(json.dumps(False))
print(json.dumps(None))
# complex to JSON
x = {
"name": "John",
"age": 30,
"married": True,
"divorced": False,
"children": ("Ann","Billy"),
"pets": None,
"cars": [
{"model": "BMW 230", "mpg": 27.5},
{"model": "Ford Edge", "mpg": 24.1}
]
}
print(json.dumps(x))
print(json.dumps(x, indent=3))
print(json.dumps(x, indent=3, separators=(". ", " = ")))
print(json.dumps(x, indent=4, sort_keys=True))
| 17.769231 | 63 | 0.593074 | 138 | 924 | 3.963768 | 0.362319 | 0.230347 | 0.332724 | 0.095064 | 0.3766 | 0.338208 | 0.25777 | 0.120658 | 0 | 0 | 0 | 0.033121 | 0.150433 | 924 | 51 | 64 | 18.117647 | 0.663694 | 0.070346 | 0 | 0.222222 | 0 | 0 | 0.232122 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.027778 | 0 | 0.027778 | 0.444444 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
765e2a34f9501deda4bdac1aed550e48d9849a22 | 126 | py | Python | conf/constants.py | brijml/yt-news | e98c49ecb85a36b665f9718e9a3fe11459e417b8 | [
"MIT"
] | null | null | null | conf/constants.py | brijml/yt-news | e98c49ecb85a36b665f9718e9a3fe11459e417b8 | [
"MIT"
] | 1 | 2021-02-08T20:34:13.000Z | 2021-02-08T20:34:13.000Z | conf/constants.py | brijml/yt-news | e98c49ecb85a36b665f9718e9a3fe11459e417b8 | [
"MIT"
] | null | null | null | import os
CHANNELS = ['UC-CSyyi47VX1lD9zyeABW3w', 'UCZFMm1mMw0F81Z37aaEzTUA']
DEVELOPER_KEY = os.environ.get('yt_secret_key') | 31.5 | 67 | 0.801587 | 14 | 126 | 7 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094017 | 0.071429 | 126 | 4 | 68 | 31.5 | 0.74359 | 0 | 0 | 0 | 0 | 0 | 0.480315 | 0.377953 | 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 |
769a87cd60ca3156ed384ca05afd6084a7626406 | 234 | py | Python | embed/help/helpcopy.py | funny-nation/embed-sand-box | 3a7a328ff876024e3b24167a29e8b55caaa06a4f | [
"MIT"
] | null | null | null | embed/help/helpcopy.py | funny-nation/embed-sand-box | 3a7a328ff876024e3b24167a29e8b55caaa06a4f | [
"MIT"
] | null | null | null | embed/help/helpcopy.py | funny-nation/embed-sand-box | 3a7a328ff876024e3b24167a29e8b55caaa06a4f | [
"MIT"
] | null | null | null | from discord import Embed
def getEmbed() -> Embed:
embed = Embed()
embed.title = "3 - 用户可以使用货币送礼物"
embed.description = ""
embed.add_field(name="", value="", inline=False)
embed.colour = 0xff9900
return embed
| 21.272727 | 52 | 0.641026 | 27 | 234 | 5.518519 | 0.703704 | 0.201342 | 0.201342 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033149 | 0.226496 | 234 | 10 | 53 | 23.4 | 0.790055 | 0 | 0 | 0 | 0 | 0 | 0.064103 | 0 | 0 | 0 | 0.034188 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0 | 0.375 | 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 |
769f797962ecec8d66c6017cf8365f5c8787bf3f | 1,925 | py | Python | core/responses.py | onerbs/treux | 3ec3a80a49de2860efcc0b1806e9063975c35023 | [
"MIT"
] | null | null | null | core/responses.py | onerbs/treux | 3ec3a80a49de2860efcc0b1806e9063975c35023 | [
"MIT"
] | null | null | null | core/responses.py | onerbs/treux | 3ec3a80a49de2860efcc0b1806e9063975c35023 | [
"MIT"
] | null | null | null | from rest_framework.response import Response
from core.api.status import *
class WithResponses:
@staticmethod
def send(*args, **kwargs) -> Response:
return Response(*args, **kwargs)
def respond(
self, msg: str = 'Empty', tag: str = 'detail',
*args, status=None, **kwargs
):
return self.send({tag: msg}, *args, status=status, **kwargs)
def item(self, action: str, ref=True, status=None, strict=False) -> Response:
stat = _boolean(ref)
msg = f'{self.__class__.__name__} {stat + action}'
if not strict and 'not' in stat:
status = FAILURE
return self.respond(msg, status=status)
def succeed(self, msg: str = None, status: int = SUCCESS) -> Response:
return self.respond(msg, status=status)
def fail(self, msg: str = None, status: int = FAILURE) -> Response:
return self.respond(msg, 'error', status=status)
def accept(self, msg: str = None) -> Response:
return self.succeed(msg, ACCEPTED)
def reject(self, msg: str = None) -> Response:
return self.fail(msg, REJECTED)
def forbidden(self, superuser=False) -> Response:
level = 'manager' if superuser else 'staff'
msg = f"Must be {level} to perform this action."
return self.fail(msg, FORBIDDEN)
def created(self, ref=True, fields=None) -> Response:
if not ref:
return self.item('created', False)
if not fields:
fields = ['uuid'] # !! uuid.
data = {f: getattr(ref, f) for f in fields}
return self.send(data, status=CREATED)
def updated(self, ref=True) -> Response:
return self.item('updated', ref, UPDATED)
def deleted(self, ref=True, /, hard=False) -> Response:
action = 'destroyed' if hard else 'deleted'
return self.item(action, ref, DELETED)
def undeleted(self, ref=True) -> Response:
return self.item('undeleted', ref, UNDELETED)
def not_found(self) -> Response:
return self.item('found', False, NOT_FOUND, True)
def _boolean(ref) -> str:
return 'not ' if ref in [None, False] else ''
| 29.615385 | 78 | 0.681558 | 271 | 1,925 | 4.793358 | 0.261993 | 0.100077 | 0.096998 | 0.04311 | 0.21709 | 0.189376 | 0.153965 | 0 | 0 | 0 | 0 | 0 | 0.171948 | 1,925 | 64 | 79 | 30.078125 | 0.814931 | 0.004156 | 0 | 0.042553 | 0 | 0 | 0.085117 | 0.013055 | 0 | 0 | 0 | 0 | 0 | 1 | 0.297872 | false | 0 | 0.042553 | 0.212766 | 0.680851 | 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 |
76b4492782bab3be85d46c8eb8fc46a3ff800f03 | 1,045 | py | Python | Software_University/python_basics/conditional_statements_advanced/lab/operations_between_number.py | Ivanazzz/SoftUni-W3resource-Python | 892321a290e22a91ff2ac2fef5316179a93f2f17 | [
"MIT"
] | 1 | 2022-01-26T07:38:11.000Z | 2022-01-26T07:38:11.000Z | Software_University/python_basics/conditional_statements_advanced/lab/operations_between_number.py | Ivanazzz/SoftUni-W3resource-Python | 892321a290e22a91ff2ac2fef5316179a93f2f17 | [
"MIT"
] | null | null | null | Software_University/python_basics/conditional_statements_advanced/lab/operations_between_number.py | Ivanazzz/SoftUni-W3resource-Python | 892321a290e22a91ff2ac2fef5316179a93f2f17 | [
"MIT"
] | null | null | null | first_number = int(input("Enter the first number: "))
second_number = int(input("Enter the second number: "))
operation = input("Choose operation(+, -, *, /, %): ")
result = 0
if operation == "+" or operation == "-" or operation == "*":
if operation == "+":
result = first_number + second_number
elif operation == "-":
result = first_number - second_number
elif operation == "*":
result = first_number * second_number
if result % 2 == 0:
print(f"{first_number} {operation} {second_number} = {result} - even")
else:
print(f"{first_number} {operation} {second_number} = {result} - odd")
elif operation == "/" or operation == "%":
if second_number == 0:
print(f"Cannot divide {first_number} by zero")
elif operation == "/":
result = first_number / second_number
print(f"{first_number} / {second_number} = {result:.2f}")
elif operation == "%":
result = first_number % second_number
print(f"{first_number} % {second_number} = {result}") | 40.192308 | 78 | 0.604785 | 117 | 1,045 | 5.213675 | 0.213675 | 0.216393 | 0.222951 | 0.301639 | 0.668852 | 0.596721 | 0.596721 | 0.596721 | 0.452459 | 0.452459 | 0 | 0.006242 | 0.233493 | 1,045 | 26 | 79 | 40.192308 | 0.755306 | 0 | 0 | 0 | 0 | 0 | 0.32218 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.208333 | 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 |
76c5d19e417aa6c558e8cba0fcae8291a175eda4 | 439 | py | Python | chargehound/models.py | chargehound/chargehound-python | d9400c83c6b83f6362883a655ce4090ff23aca2d | [
"MIT"
] | 2 | 2016-05-10T00:02:52.000Z | 2016-10-20T17:25:01.000Z | chargehound/models.py | chargehound/chargehound-python | d9400c83c6b83f6362883a655ce4090ff23aca2d | [
"MIT"
] | 5 | 2017-05-31T23:37:41.000Z | 2019-05-08T21:39:12.000Z | chargehound/models.py | chargehound/chargehound-python | d9400c83c6b83f6362883a655ce4090ff23aca2d | [
"MIT"
] | 1 | 2017-06-01T22:46:44.000Z | 2017-06-01T22:46:44.000Z | from collections import namedtuple
from munch import Munch
class ChargehoundObject(Munch):
pass
class List(ChargehoundObject):
pass
class Dispute(ChargehoundObject):
pass
class Product(ChargehoundObject):
pass
class Response(ChargehoundObject):
pass
class CorrespondenceItem(ChargehoundObject):
pass
class PastPayment(ChargehoundObject):
pass
HTTPResponse = namedtuple('HTTPResponse', 'status')
| 12.911765 | 51 | 0.758542 | 40 | 439 | 8.325 | 0.4 | 0.162162 | 0.39039 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175399 | 439 | 33 | 52 | 13.30303 | 0.91989 | 0 | 0 | 0.411765 | 0 | 0 | 0.041002 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.411765 | 0.117647 | 0 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
4f2501172713bf4c922f78f93186275f63736cfb | 94 | py | Python | etc/for_myself_test.py | zhangbo2008/facenet | 4dfabcb5cf14f99622dbe5f9f12f0539821c169c | [
"MIT"
] | null | null | null | etc/for_myself_test.py | zhangbo2008/facenet | 4dfabcb5cf14f99622dbe5f9f12f0539821c169c | [
"MIT"
] | 7 | 2019-12-16T22:10:01.000Z | 2022-02-10T00:27:35.000Z | etc/for_myself_test.py | zhangbo2008/facenet | 4dfabcb5cf14f99622dbe5f9f12f0539821c169c | [
"MIT"
] | null | null | null | fed_layer='dafds'
print( isinstance(fed_layer, string_types))
dest = kwargs.pop('dest', None) | 23.5 | 43 | 0.755319 | 14 | 94 | 4.857143 | 0.785714 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085106 | 94 | 4 | 44 | 23.5 | 0.790698 | 0 | 0 | 0 | 0 | 0 | 0.094737 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 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 |
4f480e902db2f5e567966c61b690c61b3db79f56 | 178 | py | Python | posts/urls.py | syqu22/django-react-blog | 6c5605e1c8ef66b17d4d6453f0807947d1adfdb4 | [
"MIT"
] | null | null | null | posts/urls.py | syqu22/django-react-blog | 6c5605e1c8ef66b17d4d6453f0807947d1adfdb4 | [
"MIT"
] | null | null | null | posts/urls.py | syqu22/django-react-blog | 6c5605e1c8ef66b17d4d6453f0807947d1adfdb4 | [
"MIT"
] | null | null | null | from django.urls import path
from posts.views import PostDetail, PostsList
urlpatterns = [
path('', PostsList.as_view()),
path('<slug:slug>/', PostDetail.as_view()),
]
| 19.777778 | 47 | 0.691011 | 22 | 178 | 5.5 | 0.590909 | 0.099174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151685 | 178 | 8 | 48 | 22.25 | 0.801325 | 0 | 0 | 0 | 0 | 0 | 0.067416 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
4fa5826c717a1bdd2fd5367cd547dc36a82eb927 | 124 | py | Python | setup.py | piperchester/piratestrike | 4635e7a6e8f809f4e4d50d0d507aa833bc90d0fd | [
"MIT"
] | null | null | null | setup.py | piperchester/piratestrike | 4635e7a6e8f809f4e4d50d0d507aa833bc90d0fd | [
"MIT"
] | 1 | 2015-06-11T05:32:07.000Z | 2015-06-11T05:32:07.000Z | setup.py | piperchester/piratestrike | 4635e7a6e8f809f4e4d50d0d507aa833bc90d0fd | [
"MIT"
] | null | null | null | from distutils.core import setup
setup(name='piratestrike',
version='0.1',
py_modules=['piratestrike'],
)
| 20.666667 | 34 | 0.645161 | 14 | 124 | 5.642857 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020408 | 0.209677 | 124 | 5 | 35 | 24.8 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0.217742 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
96d824acfac22a7705a2ce53beef7ac10c96abd0 | 4,410 | py | Python | tests/test_grid.py | Intelecy/chocolate | 0ba4f6f0130eab851d32d5534241c8cac3f6666e | [
"BSD-3-Clause"
] | 105 | 2017-10-27T02:14:22.000Z | 2022-01-13T12:57:05.000Z | tests/test_grid.py | Intelecy/chocolate | 0ba4f6f0130eab851d32d5534241c8cac3f6666e | [
"BSD-3-Clause"
] | 31 | 2017-10-03T13:41:35.000Z | 2021-08-20T21:01:29.000Z | tests/test_grid.py | areeh/chocolate | 5f946cb9daf42c3ab44508648917d46bc105c2fc | [
"BSD-3-Clause"
] | 38 | 2017-10-05T20:19:42.000Z | 2022-03-28T11:34:04.000Z | import unittest
from unittest.mock import MagicMock
from chocolate import Grid
from chocolate.space import Space, uniform, quantized_uniform, quantized_log
from chocolate.sample.grid import ParameterGrid
class TestParameterGrid(unittest.TestCase):
def test_init_continuous(self):
s = {"a": uniform(1, 2)}
self.assertRaises(AssertionError, ParameterGrid, Space(s))
def test_len(self):
s = {"a": quantized_uniform(1, 2, 1)}
grid = ParameterGrid(Space(s))
self.assertEqual(len(grid), 1)
s = {"a": quantized_uniform(1, 5, 1),
"b": quantized_log(1, 5, 1, 10)}
grid = ParameterGrid(Space(s))
self.assertEqual(len(grid), 16)
s = {"a": quantized_uniform(1, 5, 1),
"b": {"c": quantized_log(1, 5, 1, 10),
"d": quantized_uniform(0, 1, 1)}}
grid = ParameterGrid(Space(s))
self.assertEqual(len(grid), 20)
s = {"a": quantized_uniform(1, 5, 1),
"b": {"c": quantized_log(1, 5, 1, 10),
"d": quantized_uniform(0, 10, 1)}}
grid = ParameterGrid(Space(s))
self.assertEqual(len(grid), 56)
def test_getitem(self):
s = {"a": quantized_uniform(1, 2, 1)}
grid = ParameterGrid(Space(s))
r = grid[0]
self.assertAlmostEqual(r[0], 0.0)
r = grid[-1]
self.assertAlmostEqual(r[0], 0.0)
s = {"a": quantized_uniform(1, 5, 1),
"b": quantized_log(1, 5, 1, 10)}
grid = ParameterGrid(Space(s))
r = grid[0]
self.assertAlmostEqual(r[0], 0.0)
self.assertAlmostEqual(r[1], 0.0)
r = grid[1]
self.assertAlmostEqual(r[0], 0.25)
self.assertAlmostEqual(r[1], 0.0)
s = {"a": quantized_uniform(1, 5, 1),
"b": {"c": quantized_log(1, 5, 1, 10),
"d": quantized_uniform(0, 10, 1)}}
grid = ParameterGrid(Space(s))
r = grid[0]
self.assertEqual(len(r), 4)
self.assertAlmostEqual(r[0], 0.0)
self.assertAlmostEqual(r[1], 0.0)
self.assertAlmostEqual(r[2], 0.0)
self.assertAlmostEqual(r[3], None)
r = grid[1]
self.assertEqual(len(r), 4)
self.assertAlmostEqual(r[0], 0.25)
self.assertAlmostEqual(r[1], 0.0)
self.assertAlmostEqual(r[2], 0.0)
self.assertAlmostEqual(r[3], None)
r = grid[16]
self.assertEqual(len(r), 4)
self.assertAlmostEqual(r[0], 0.0)
self.assertAlmostEqual(r[1], 0.5)
self.assertAlmostEqual(r[2], None)
self.assertAlmostEqual(r[3], 0.0)
r = grid[20]
self.assertEqual(len(r), 4)
self.assertAlmostEqual(r[0], 0.0)
self.assertAlmostEqual(r[1], 0.5)
self.assertAlmostEqual(r[2], None)
self.assertAlmostEqual(r[3], 0.1)
r = grid[-1]
self.assertEqual(len(r), 4)
self.assertAlmostEqual(r[0], 0.75)
self.assertAlmostEqual(r[1], 0.5)
self.assertAlmostEqual(r[2], None)
self.assertAlmostEqual(r[3], 0.9)
def test_invalid_getitem(self):
s = {"a": quantized_uniform(1, 2, 1)}
grid = ParameterGrid(Space(s))
self.assertRaises(IndexError, grid.__getitem__, 1)
self.assertRaises(IndexError, grid.__getitem__, -2)
def test_empty_grid(self):
grid = ParameterGrid(Space(dict()))
self.assertRaises(IndexError, grid.__getitem__, 0)
def test_empty_subspace(self):
grid = ParameterGrid(Space({"a": {"b": None}}))
self.assertRaises(IndexError, grid.__getitem__, 0)
class TestGrid(unittest.TestCase):
def setUp(self):
s = {"a": quantized_uniform(1, 10, 1)}
self.mock_conn = MagicMock(name="connection")
self.mock_conn.get_space.return_value = Space(s)
self.grid = Grid(self.mock_conn, s)
def test_next(self):
self.mock_conn.count_results.return_value = 0
token, p = self.grid.next()
self.assertEqual(token, {"_chocolate_id": 0})
self.assertEqual(p, {"a": 1})
self.mock_conn.count_results.return_value = 1
token, p = self.grid.next()
self.assertEqual(token, {"_chocolate_id": 1})
self.assertEqual(p, {"a": 2})
def test_stop_iteration(self):
self.mock_conn.count_results.return_value = 9
self.assertRaises(StopIteration, self.grid.next)
| 32.189781 | 76 | 0.5839 | 578 | 4,410 | 4.34083 | 0.119377 | 0.217617 | 0.227979 | 0.09167 | 0.721004 | 0.693105 | 0.653647 | 0.639697 | 0.599841 | 0.563173 | 0 | 0.052794 | 0.265533 | 4,410 | 136 | 77 | 32.426471 | 0.721828 | 0 | 0 | 0.575472 | 0 | 0 | 0.013832 | 0 | 0 | 0 | 0 | 0 | 0.424528 | 1 | 0.084906 | false | 0 | 0.04717 | 0 | 0.150943 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
96e7a13b3fb2f2323b1e570571dfaa7dafab1004 | 110 | py | Python | src/SM3/__init__.py | ice-bob/SM | 7260a706790af53fff111f7ec290477bb06a8705 | [
"MIT"
] | 1 | 2021-05-13T01:20:13.000Z | 2021-05-13T01:20:13.000Z | src/SM3/__init__.py | ice-bob/SM | 7260a706790af53fff111f7ec290477bb06a8705 | [
"MIT"
] | null | null | null | src/SM3/__init__.py | ice-bob/SM | 7260a706790af53fff111f7ec290477bb06a8705 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from .SM3 import *
__version__ = '1.0.0'
__license__ = 'MIT License'
| 15.714286 | 38 | 0.754545 | 15 | 110 | 4.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043011 | 0.154545 | 110 | 6 | 39 | 18.333333 | 0.709677 | 0 | 0 | 0 | 0 | 0 | 0.145455 | 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 |
96e8b76ed3e4e1268fecaec907f8038f7d08a980 | 533 | py | Python | examples/plugins/no_gzip.py | mike820324/microProxy | 64c7c5add4759c6e105b9438cd18c0f8c930c7a3 | [
"MIT"
] | 20 | 2016-04-17T08:43:26.000Z | 2021-05-31T04:01:27.000Z | examples/plugins/no_gzip.py | mike820324/microProxy | 64c7c5add4759c6e105b9438cd18c0f8c930c7a3 | [
"MIT"
] | 237 | 2016-04-17T07:07:08.000Z | 2017-01-26T09:15:52.000Z | examples/plugins/no_gzip.py | mike820324/microProxy | 64c7c5add4759c6e105b9438cd18c0f8c930c7a3 | [
"MIT"
] | 5 | 2016-04-16T14:22:45.000Z | 2019-11-27T04:41:55.000Z | from microproxy.context.http import HttpHeaders
def on_request(plugin_context):
if plugin_context.scheme == "h2":
return plugin_context
try:
headers = plugin_context.request.headers.get_dict()
for key in headers:
if key.lower() != "accept-encoding":
continue
headers[key] = "deflate"
new_headers = HttpHeaders(headers=headers)
plugin_context.request.headers = new_headers
except Exception as e:
print e
return plugin_context
| 26.65 | 59 | 0.641651 | 60 | 533 | 5.533333 | 0.533333 | 0.23494 | 0.114458 | 0.162651 | 0.204819 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002611 | 0.281426 | 533 | 19 | 60 | 28.052632 | 0.86423 | 0 | 0 | 0.133333 | 0 | 0 | 0.045028 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.066667 | null | null | 0.066667 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
96edd09b4f092eced37a3d6011f3ba27da25db85 | 182 | py | Python | ch-5/4-pwm/motors_pwm_drive_slower.py | PacktPublishing/Raspberry-Pi-Pico-Robotics-for-Workbench-Wizards | fd4b0cb544f383acf6fa9c14c53c17fdd3c7dcab | [
"MIT"
] | null | null | null | ch-5/4-pwm/motors_pwm_drive_slower.py | PacktPublishing/Raspberry-Pi-Pico-Robotics-for-Workbench-Wizards | fd4b0cb544f383acf6fa9c14c53c17fdd3c7dcab | [
"MIT"
] | null | null | null | ch-5/4-pwm/motors_pwm_drive_slower.py | PacktPublishing/Raspberry-Pi-Pico-Robotics-for-Workbench-Wizards | fd4b0cb544f383acf6fa9c14c53c17fdd3c7dcab | [
"MIT"
] | null | null | null | import time
import board
import pwmio
A1_PWM = pwmio.PWMOut(board.GP17)
A1_PWM.duty_cycle = 2**16-1
time.sleep(0.3)
A1_PWM.duty_cycle = 2**15
time.sleep(0.3)
A1_PWM.duty_cycle = 0
| 15.166667 | 33 | 0.747253 | 38 | 182 | 3.394737 | 0.447368 | 0.155039 | 0.209302 | 0.325581 | 0.511628 | 0.387597 | 0.387597 | 0.387597 | 0 | 0 | 0 | 0.1125 | 0.120879 | 182 | 11 | 34 | 16.545455 | 0.69375 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
96f54e4a0a36af53f9f7b474eedcc860c2781f82 | 1,044 | py | Python | ta_state.py | Pieter-Cawood/TA-Prioritized-MAPD | b21d3fd1989451b855736a27250a5647b20e426f | [
"MIT"
] | 13 | 2021-04-01T13:04:32.000Z | 2022-03-23T12:23:08.000Z | ta_state.py | Pieter-Cawood/TA-Prioritized-MAPD | b21d3fd1989451b855736a27250a5647b20e426f | [
"MIT"
] | 1 | 2022-02-14T05:09:37.000Z | 2022-02-23T22:31:41.000Z | ta_state.py | Pieter-Cawood/TA-Prioritized-MAPD | b21d3fd1989451b855736a27250a5647b20e426f | [
"MIT"
] | 4 | 2020-11-22T02:35:30.000Z | 2022-01-12T21:39:25.000Z | """
Created on Sat Apr 18 10:45:11 2020
@author: Pieter Cawood
"""
class Location(object):
def __init__(self, col, row):
self.col = col
self.row = row
def __eq__(self, other):
return self.col == other.col and self.row == other.row
def __hash__(self):
return hash(str(self.col) + str(self.row))
def __str__(self):
return str((self.col, self.row))
class State(object):
def __init__(self, time, location):
self.time = time
self.location = location
self.g = 0
self.f = 0
def __eq__(self, other):
return self.time == other.time and self.location == other.location
def __hash__(self):
return hash(str(self.time) + str(self.location.col) + str(self.location.row))
def __str__(self):
return str((self.time, self.location.col, self.location.row))
def __lt__(self, other):
if self.f < other.f:
return True
else:
return False
| 23.2 | 86 | 0.564176 | 137 | 1,044 | 4.036496 | 0.262774 | 0.113924 | 0.047016 | 0.061483 | 0.282098 | 0.282098 | 0.195298 | 0 | 0 | 0 | 0 | 0.019608 | 0.316092 | 1,044 | 44 | 87 | 23.727273 | 0.754902 | 0.056513 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.222222 | 0.703704 | 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 |
96f5514738cca8d84fae0b0376157d64ed0914db | 188 | py | Python | appengine_config.py | nischalshrestha/sampleAppEngine | 78bfa547b1e693713c7db95afff6dbef31c3a3d2 | [
"MIT"
] | 1 | 2015-12-19T09:37:59.000Z | 2015-12-19T09:37:59.000Z | appengine_config.py | nischalshrestha/sampleAppEngine | 78bfa547b1e693713c7db95afff6dbef31c3a3d2 | [
"MIT"
] | 1 | 2015-11-22T02:35:56.000Z | 2015-11-22T02:35:56.000Z | appengine_config.py | nischalshrestha/recognize | 78bfa547b1e693713c7db95afff6dbef31c3a3d2 | [
"MIT"
] | null | null | null | from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib')
# vendor.add(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib')) | 37.6 | 78 | 0.75 | 30 | 188 | 4.566667 | 0.666667 | 0.19708 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090426 | 188 | 5 | 78 | 37.6 | 0.80117 | 0.664894 | 0 | 0 | 0 | 0 | 0.04918 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8c23fc1daacea1b9e6ebfcdd512547fc9b1a25cb | 603 | py | Python | skypond/games/four_keys/agents/random_agent.py | upkoi/skypond | 5e366a18f2c5c85ce7b092d69b28c8f8aaad8718 | [
"MIT"
] | null | null | null | skypond/games/four_keys/agents/random_agent.py | upkoi/skypond | 5e366a18f2c5c85ce7b092d69b28c8f8aaad8718 | [
"MIT"
] | null | null | null | skypond/games/four_keys/agents/random_agent.py | upkoi/skypond | 5e366a18f2c5c85ce7b092d69b28c8f8aaad8718 | [
"MIT"
] | 2 | 2019-06-13T18:08:01.000Z | 2019-06-17T02:42:19.000Z | from __future__ import absolute_import
from ...base.base_agent import Agent
import numpy as np
from skypond.games.four_keys.four_keys_actions import FourKeysActions
class RandomAgent(Agent):
def __init__(self,name='random'):
super().__init__()
self.name = name
self.blind = True
def react(self,observation):
# Randomly perform one of the available actions
return np.random.randint(0,len(FourKeysActions))
def describe(self):
return {'username':self.name,"eth_address":'', "email":'test@example.com', "description":'Sample Random Agent'}
| 28.714286 | 119 | 0.701493 | 76 | 603 | 5.328947 | 0.618421 | 0.059259 | 0.059259 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002041 | 0.187396 | 603 | 20 | 120 | 30.15 | 0.82449 | 0.074627 | 0 | 0 | 0 | 0 | 0.136691 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.307692 | 0.153846 | 0.769231 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
8c287e593757d353b93aa00d047ee3f2dcf155ef | 36 | py | Python | Basic Programming/Getting Started/digitofano.py | therohitsingh/Top300DSACode | e96b2ff833677d73ad197afcb39146969010315a | [
"MIT"
] | null | null | null | Basic Programming/Getting Started/digitofano.py | therohitsingh/Top300DSACode | e96b2ff833677d73ad197afcb39146969010315a | [
"MIT"
] | null | null | null | Basic Programming/Getting Started/digitofano.py | therohitsingh/Top300DSACode | e96b2ff833677d73ad197afcb39146969010315a | [
"MIT"
] | null | null | null | n = input()
for i in n:
print(i) | 12 | 12 | 0.527778 | 8 | 36 | 2.375 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.305556 | 36 | 3 | 12 | 12 | 0.76 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8c3a8f70ed57909866da5d5c365975698e986c02 | 34 | py | Python | dataset/__init__.py | aponamarev/FootBallTracking | a1907164aa35fe925b2a11a1c596c1a489b90231 | [
"MIT"
] | null | null | null | dataset/__init__.py | aponamarev/FootBallTracking | a1907164aa35fe925b2a11a1c596c1a489b90231 | [
"MIT"
] | null | null | null | dataset/__init__.py | aponamarev/FootBallTracking | a1907164aa35fe925b2a11a1c596c1a489b90231 | [
"MIT"
] | null | null | null | __author__ = "Alexander Ponamarev" | 34 | 34 | 0.823529 | 3 | 34 | 8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088235 | 34 | 1 | 34 | 34 | 0.774194 | 0 | 0 | 0 | 0 | 0 | 0.542857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8c3c13c93312deff94c1bfba7fc0ae07addf8543 | 1,059 | py | Python | video_records/epickitchens55_record.py | selva604/DA_TBN | 240b3561eb5957e2827a5b8ef8fbd991d51489f4 | [
"MIT"
] | 1 | 2021-06-17T12:32:21.000Z | 2021-06-17T12:32:21.000Z | video_records/epickitchens55_record.py | selva604/DA_TBN | 240b3561eb5957e2827a5b8ef8fbd991d51489f4 | [
"MIT"
] | null | null | null | video_records/epickitchens55_record.py | selva604/DA_TBN | 240b3561eb5957e2827a5b8ef8fbd991d51489f4 | [
"MIT"
] | null | null | null | from .video_record import VideoRecord
class EpicKitchens55_VideoRecord(VideoRecord):
def __init__(self, tup):
self._index = str(tup[0])
self._series = tup[1]
@property
def untrimmed_video_name(self):
return self._series['video_id']
@property
def start_frame(self):
return self._series['start_frame'] - 1
@property
def end_frame(self):
return self._series['stop_frame'] - 2
@property
def fps(self):
return {'RGB': 60,
'Flow': 30,
'Spec': 60}
@property
def num_frames(self):
return {'RGB': self.end_frame - self.start_frame,
'Flow': (self.end_frame - self.start_frame) / 2,
'Spec': self.end_frame - self.start_frame}
@property
def label(self):
return self._series['verb_class']
# return {'verb': self._series['verb_class'] if 'verb_class' in self._series else -10000,
# 'noun': self._series['noun_class'] if 'noun_class' in self._series else -10000}
| 28.621622 | 97 | 0.595845 | 130 | 1,059 | 4.584615 | 0.315385 | 0.151007 | 0.09396 | 0.134228 | 0.302013 | 0.218121 | 0 | 0 | 0 | 0 | 0 | 0.030184 | 0.280453 | 1,059 | 36 | 98 | 29.416667 | 0.751969 | 0.16525 | 0 | 0.222222 | 0 | 0 | 0.06924 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.259259 | false | 0 | 0.037037 | 0.222222 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8c3c41e44b833b2431e89ea289b01b23c0e25a40 | 139 | gyp | Python | app/binding.gyp | OndrejBilek/satgraph | 79ed0274c7c31cab8c0d7ac38565ef7167de6369 | [
"MIT"
] | null | null | null | app/binding.gyp | OndrejBilek/satgraph | 79ed0274c7c31cab8c0d7ac38565ef7167de6369 | [
"MIT"
] | null | null | null | app/binding.gyp | OndrejBilek/satgraph | 79ed0274c7c31cab8c0d7ac38565ef7167de6369 | [
"MIT"
] | null | null | null | {
"targets": [
{
"target_name": "module",
"sources": [ "cc/module.cc", "cc/functions.cc", "cc/satgraph.cc" ]
}
]
}
| 15.444444 | 72 | 0.47482 | 14 | 139 | 4.642857 | 0.571429 | 0.123077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.280576 | 139 | 8 | 73 | 17.375 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0.517986 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8c3c4c2beb381bc4a6b033d4cb9e84364367e226 | 229 | py | Python | pandapower/pypower/__init__.py | Zamwell/pandapower | ce51946342109e969b87b60c8883d7eec02d3060 | [
"BSD-3-Clause"
] | 221 | 2015-01-03T23:18:11.000Z | 2022-03-27T10:21:40.000Z | pandapower/pypower/__init__.py | lvzhibai/pandapower | 24ed3056558887cc89f67d15b5527523990ae9a1 | [
"BSD-3-Clause"
] | 126 | 2017-02-15T17:09:08.000Z | 2018-07-16T13:25:15.000Z | pandapower/pypower/__init__.py | gdgarcia/pandapower | 630e3278ca012535f78282ae73f1b86f3fe932fc | [
"BSD-3-Clause"
] | 114 | 2015-02-02T15:07:38.000Z | 2022-03-22T17:01:55.000Z | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""PYPOWER solves power flow and Optimal Power Flow (OPF) problems.
"""
| 32.714286 | 67 | 0.737991 | 38 | 229 | 4.447368 | 0.921053 | 0.106509 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.179039 | 229 | 6 | 68 | 38.166667 | 0.856383 | 0.938865 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8c42e75d24509cfe66177e34a0a8bbade5cfdca1 | 18,840 | py | Python | iotbx/regression/ncs/tst_ncs_groups_preprocessing.py | dperl-sol/cctbx_project | b9e390221a2bc4fd00b9122e97c3b79c632c6664 | [
"BSD-3-Clause-LBNL"
] | 155 | 2016-11-23T12:52:16.000Z | 2022-03-31T15:35:44.000Z | iotbx/regression/ncs/tst_ncs_groups_preprocessing.py | dperl-sol/cctbx_project | b9e390221a2bc4fd00b9122e97c3b79c632c6664 | [
"BSD-3-Clause-LBNL"
] | 590 | 2016-12-10T11:31:18.000Z | 2022-03-30T23:10:09.000Z | iotbx/regression/ncs/tst_ncs_groups_preprocessing.py | dperl-sol/cctbx_project | b9e390221a2bc4fd00b9122e97c3b79c632c6664 | [
"BSD-3-Clause-LBNL"
] | 115 | 2016-11-15T08:17:28.000Z | 2022-02-09T15:30:14.000Z | from __future__ import absolute_import, division, print_function
from iotbx.ncs import format_80
from libtbx.utils import null_out
from datetime import datetime
from scitbx import matrix
import iotbx.ncs as ncs
from iotbx import pdb
import iotbx.phil
import unittest
import shutil
import os
from iotbx.ncs import ncs_group_master_phil
import mmtbx.ncs.ncs
import mmtbx.model
from libtbx.test_utils import approx_equal
from six.moves import range
from six.moves import map
__author__ = 'Youval'
import libtbx.load_env
have_phenix = False
if libtbx.env.has_module(name="phenix"):
from phenix.command_line import simple_ncs_from_pdb
have_phenix = True
class TestNcsGroupPreprocessing(unittest.TestCase):
""" Test spec and phil, NCS and ASU information processing"""
def setUp(self):
""" Create temporary folder for temp files produced during test """
self.currnet_dir = os.getcwd()
now = datetime.now().strftime("%I%p_%m_%d_%Y")
self.tempdir = 'TestNcsGroupPreprocessing_{}'.format(now)
if not os.path.isdir(self.tempdir):
os.mkdir(self.tempdir)
os.chdir(self.tempdir)
# self.pdb_obj = pdb.hierarchy.input(pdb_string=test_pdb_ncs_spec)
self.pdb_inp = pdb.input(source_info=None, lines=test_pdb_ncs_spec)
self.ph = self.pdb_inp.construct_hierarchy()
self.pdb_inp = pdb.input(source_info=None, lines=test_pdb_ncs_spec)
def test_phil_processing(self):
""" Verify that phil parameters are properly processed
need to supply exclude_selection=None because model consist only from UNK
residues. """
# print sys._getframe().f_code.co_name
# read file and create pdb object
pdb_inp = pdb.input(source_info=None, lines=pdb_test_data2)
phil_groups = ncs_group_master_phil.fetch(
iotbx.phil.parse(pdb_test_data2_phil)).extract()
p = iotbx.ncs.input.get_default_params()
p.ncs_search.exclude_selection=None
p.ncs_search.minimum_number_of_atoms_in_copy=0
trans_obj = iotbx.ncs.input(
ncs_phil_groups=phil_groups.ncs_group,
hierarchy=pdb_inp.construct_hierarchy(),
params=p.ncs_search)
nrgl = trans_obj.get_ncs_restraints_group_list()
# nrgl._show()
sels = nrgl.get_array_of_str_selections()
assert sels == [["chain 'A'", "chain 'D'", "chain 'G'"],
["chain 'B' or chain 'C'", "chain 'E' or chain 'F'", "chain 'H' or chain 'I'"]]
def test_superpos_pdb(self):
""" verify creation of transformations using superpose_pdb
need to supply exclude_selection=None because model consist only from UNK
residues. """
# print sys._getframe().f_code.co_name
# read file and create pdb object
pdb_inp = pdb.input(source_info=None, lines=pdb_test_data1)
phil_groups = ncs_group_master_phil.fetch(
iotbx.phil.parse(pdb_test_data1_phil)).extract()
p = iotbx.ncs.input.get_default_params()
p.ncs_search.exclude_selection=None
p.ncs_search.minimum_number_of_atoms_in_copy=0
trans_obj = ncs.input(
ncs_phil_groups=phil_groups.ncs_group,
hierarchy=pdb_inp.construct_hierarchy(),
params=p.ncs_search)
nrgl = trans_obj.get_ncs_restraints_group_list()
# nrgl._show()
sels = nrgl.get_array_of_str_selections()
assert sels == [["chain 'A'", "chain 'C'", "chain 'E'"],
["chain 'B'", "chain 'D'", "chain 'F'"]]
self.assertTrue(approx_equal(nrgl[0].copies[0].r,
matrix.sqr(
[0.309017,-0.809017,0.5,0.809017,0.5,0.309017,-0.5,0.309017,0.809017]), eps=0.01))
def test_spec_reading(self):
""" verify creating and processing spec
This is ncs.ncs - specific functionality
"""
if have_phenix:
xrs = self.pdb_inp.xray_structure_simple()
xrs_unit_cell = xrs.orthorhombic_unit_cell_around_centered_scatterers(
buffer_size=8)
self.ph.adopt_xray_structure(xrs_unit_cell)
of = open("test_ncs_spec.pdb", "w")
print(self.ph.as_pdb_string(crystal_symmetry=xrs.crystal_symmetry()), file=of)
of.close()
# create a spec file
ncs_from_pdb=simple_ncs_from_pdb.run(
args=["pdb_in=test_ncs_spec.pdb", "write_spec_files=True"],
log=null_out())
else:
print("phenix not available, skipping test_spec_reading()")
pass
def test_processing_of_asu_2(self):
""" processing complete ASU
If MTRIX records are present, they are ignored
This maybe ncs.ncs - specific functionality, not clear yet.
"""
# print sys._getframe().f_code.co_name
# reading and processing the spec file
trans_obj = ncs.input(hierarchy = self.pdb_inp.construct_hierarchy())
nrgl = trans_obj.get_ncs_restraints_group_list()
# nrgl._show()
sels = nrgl.get_array_of_str_selections()
assert sels == [["chain 'A'", "chain 'B'", "chain 'C'"],
["chain 'D'", "chain 'E'"]]
def test_print_ncs_phil_param(self):
""" Verify correct printout of NCS phil parameters.
need to supply exclude_selection=None because model consist only from UNK
residues. """
# print sys._getframe().f_code.co_name
pdb_inp = iotbx.pdb.input(source_info=None, lines=pdb_test_data2)
phil_groups = ncs_group_master_phil.fetch(
iotbx.phil.parse(pdb_test_data2_phil)).extract()
p = iotbx.ncs.input.get_default_params()
p.ncs_search.exclude_selection=None
p.ncs_search.minimum_number_of_atoms_in_copy=0
trans_obj = ncs.input(
ncs_phil_groups=phil_groups.ncs_group,
hierarchy=pdb_inp.construct_hierarchy(),
params = p.ncs_search)
result = trans_obj.print_ncs_phil_param(write=False)
# print "="*50
# print "resutl"
# print result
# print "="*50
test = (pdb_test_data2_phil == result)
test = test or (pdb_test_data2_phil_reverse == result)
self.assertTrue(test)
#
def test_finding_partial_ncs(self):
# print sys._getframe().f_code.co_name
params = ncs.input.get_default_params()
params.ncs_search.chain_similarity_threshold = 0.2
ncs_inp = ncs.input(
hierarchy=iotbx.pdb.input(source_info=None, lines=pdb_str).construct_hierarchy(),
params = params.ncs_search)
nrgl = ncs_inp.get_ncs_restraints_group_list()
# nrgl._show()
sels = nrgl.get_array_of_str_selections()
print(sels)
assert sels == [[
"(chain 'A' and (name N or name CA or name C or name O ))",
"chain 'B'",
"(chain 'C' and (name N or name CA or name C or name O ))"]]
def test_format_string_longer_than_80(self):
""" Check that strings longer that 80 characters are split correctly """
# print sys._getframe().f_code.co_name
s = [str (x) for x in range(50)]
s = ''.join(s)
result = format_80(s)
expected = '0123456789101112131415161718192021222324252627282930313233' \
'3435363738394041424344 \\ \n4546474849'
self.assertEqual(result,expected)
def tearDown(self):
""" remove temp files and folder """
os.chdir(self.currnet_dir)
shutil.rmtree(self.tempdir)
pdb_str = """\
CRYST1 26.628 30.419 28.493 90.00 90.00 90.00 P 1
ATOM 1 N THR A 1 15.886 19.796 13.070 1.00 10.00 N
ATOM 2 CA THR A 1 15.489 18.833 12.050 1.00 10.00 C
ATOM 3 C THR A 1 15.086 17.502 12.676 1.00 10.00 C
ATOM 4 O THR A 1 15.739 17.017 13.600 1.00 10.00 O
ATOM 5 CB THR A 1 16.619 18.590 11.033 1.00 10.00 C
ATOM 6 OG1 THR A 1 16.963 19.824 10.392 1.00 10.00 O
ATOM 7 CG2 THR A 1 16.182 17.583 9.980 1.00 10.00 C
TER 8 THR A 1
ATOM 1 N THR B 1 10.028 17.193 16.617 1.00 10.00 N
ATOM 2 CA THR B 1 11.046 16.727 15.681 1.00 10.00 C
ATOM 3 C THR B 1 12.336 16.360 16.407 1.00 10.00 C
ATOM 4 O THR B 1 12.772 17.068 17.313 1.00 10.00 O
remark ATOM 5 CB THR B 1 11.356 17.789 14.609 1.00 10.00 C
remark ATOM 6 OG1 THR B 1 10.163 18.098 13.879 1.00 10.00 O
remark ATOM 7 CG2 THR B 1 12.418 17.281 13.646 1.00 10.00 C
TER 16 THR B 1
ATOM 1 N THR C 1 12.121 9.329 18.086 1.00 10.00 N
ATOM 2 CA THR C 1 12.245 10.284 16.991 1.00 10.00 C
ATOM 3 C THR C 1 13.707 10.622 16.718 1.00 10.00 C
ATOM 4 O THR C 1 14.493 10.814 17.645 1.00 10.00 O
ATOM 5 CB THR C 1 11.474 11.584 17.284 1.00 10.00 C
ATOM 6 OG1 THR C 1 10.087 11.287 17.482 1.00 10.00 O
ATOM 7 CG2 THR C 1 11.619 12.563 16.129 1.00 10.00 C
TER 24 THR C 1
END
"""
pdb_test_data1="""\
ATOM 749 O UNK A 90 28.392 67.262 97.682 1.00 0.00 O
ATOM 750 N UNK A 91 30.420 66.924 98.358 1.00 0.00 N
TER
ATOM 1495 N UNK B 67 33.124 2.704 114.920 1.00 0.00 N
TER
ATOM 749 O UNK C 90 3.199 86.786 85.616 1.00 0.00 O
ATOM 750 N UNK C 91 4.437 88.467 85.044 1.00 0.00 N
TER
ATOM 1495 N UNK D 67 65.508 63.662 77.246 1.00 0.00 N
TER
ATOM 749 O UNK E 90 -26.415 72.437 94.483 1.00 0.00 O
ATOM 750 N UNK E 91 -27.678 74.103 93.921 1.00 0.00 N
TER
ATOM 1495 N UNK F 67 7.362 108.699 49.412 1.00 0.00 N
TER
"""
pdb_str2="""\
CRYST1 106.820 62.340 114.190 90.00 90.00 90.00 P 21 21 21 16
SCALE1 0.009361 0.000000 0.000000 0.00000
SCALE2 0.000000 0.016041 0.000000 0.00000
SCALE3 0.000000 0.000000 0.008757 0.00000
ATOM 1 N GLU A 1 63.453 38.635 25.703 1.00134.43 N
ATOM 2 CA GLU A 1 64.202 37.516 26.347 1.00134.43 C
ATOM 3 C GLU A 1 64.256 36.311 25.412 1.00134.43 C
ATOM 4 O GLU A 1 65.333 35.940 24.953 1.00134.43 O
ATOM 5 CB GLU A 1 63.542 37.121 27.675 1.00207.79 C
ATOM 6 CG GLU A 1 64.339 36.145 28.538 1.00207.79 C
ATOM 7 CD GLU A 1 63.462 35.340 29.490 1.00207.79 C
ATOM 8 OE1 GLU A 1 62.232 35.542 29.493 1.00207.79 O
ATOM 9 OE2 GLU A 1 63.997 34.492 30.232 1.00207.79 O
END
"""
pdb_test_data1_phil = '''\
ncs_group {
reference = 'chain A'
selection = 'chain C'
selection = 'chain E'
}
ncs_group {
reference = 'chain B'
selection = 'chain D'
selection = 'chain F'
}
'''
pdb_test_data2="""\
ATOM 749 O UNK A 90 28.392 67.262 97.682 1.00 0.00 O
ATOM 750 N UNK B 91 30.420 66.924 98.358 1.00 0.00 N
ATOM 750 N UNK X 93 38.420 76.924 58.358 1.00 0.00 N
ATOM 1495 N UNK C 67 33.124 2.704 114.920 1.00 0.00 N
TER
ATOM 749 O UNK D 90 3.199 86.786 85.616 1.00 0.00 O
ATOM 750 N UNK E 91 4.437 88.467 85.044 1.00 0.00 N
ATOM 1495 N UNK F 67 65.508 63.662 77.246 1.00 0.00 N
TER
ATOM 749 O UNK G 90 -26.415 72.437 94.483 1.00 0.00 O
ATOM 750 N UNK H 91 -27.678 74.103 93.921 1.00 0.00 N
ATOM 1495 N UNK I 67 7.362 108.699 49.412 1.00 0.00 N
TER
"""
pdb_test_data2_phil = '''\
ncs_group {
reference = chain 'A'
selection = chain 'D'
selection = chain 'G'
}
ncs_group {
reference = chain 'B' or chain 'C'
selection = chain 'E' or chain 'F'
selection = chain 'H' or chain 'I'
}
'''
pdb_test_data2_phil_reverse = '''\
ncs_group {
reference = chain 'B' or chain 'C'
selection = chain 'E' or chain 'F'
selection = chain 'H' or chain 'I'
}
ncs_group {
reference = chain 'A'
selection = chain 'D'
selection = chain 'G'
}
'''
test_phil_3 = '''\
ncs_group {
reference = chain D and (resseq 1:7)
selection = chain E and (resseq 1:7)
}
ncs_group {
reference = chain A and (resseq 151:159)
selection = chain B and (resseq 151:159)
selection = chain C and (resseq 151:159)
}
'''
user_phil3 = '''\
ncs_group {
reference = 'chain A'
selection = 'chain B'
selection = 'chain C'
}
ncs_group {
reference = 'chain B'
selection = 'chain D'
}
'''
user_phil4 = '''\
ncs_group {
reference = 'chain A'
selection = 'chain C'
selection = 'chain D'
}
ncs_group {
reference = 'chain B'
selection = 'chain D'
}
'''
user_phil5 = '''\
ncs_group {
reference = 'chain A'
selection = 'chain C'
selection = 'chain D'
}
ncs_group {
reference = 'chain C'
selection = 'chain E'
}
'''
test_pdb_ncs_spec = '''\
CRYST1 577.812 448.715 468.790 90.00 90.00 90.00 P 1
SCALE1 0.001731 0.000000 0.000000 0.00000
SCALE2 0.000000 0.002229 0.000000 0.00000
SCALE3 0.000000 0.000000 0.002133 0.00000
ATOM 1 CA LYS A 151 10.766 9.333 12.905 1.00 44.22 C
ATOM 2 CA LYS A 152 10.117 9.159 11.610 1.00 49.42 C
ATOM 3 CA LYS A 153 9.099 8.000 11.562 1.00 46.15 C
ATOM 4 CA LYS A 154 8.000 8.202 11.065 1.00 52.97 C
ATOM 5 CA LYS A 155 11.146 9.065 10.474 1.00 41.68 C
ATOM 6 CA LYS A 156 10.547 9.007 9.084 1.00 55.55 C
ATOM 7 CA LYS A 157 11.545 9.413 8.000 1.00 72.27 C
ATOM 8 CA LYS A 158 12.277 10.718 8.343 1.00 75.78 C
ATOM 9 CA LYS A 159 11.349 11.791 8.809 1.00 75.88 C
TER
ATOM 222 CA LEU X 40 94.618 -5.253 91.582 1.00 87.10 C
ATOM 223 CA ARG X 41 62.395 51.344 80.786 1.00107.25 C
ATOM 224 CA ARG X 42 62.395 41.344 80.786 1.00107.25 C
TER
ATOM 1 CA THR D 1 8.111 11.080 10.645 1.00 20.00 C
ATOM 2 CA THR D 2 8.000 9.722 10.125 1.00 20.00 C
ATOM 3 CA THR D 3 8.075 8.694 11.249 1.00 20.00 C
ATOM 4 CA THR D 4 8.890 8.818 12.163 1.00 20.00 C
ATOM 5 CA THR D 5 9.101 9.421 9.092 1.00 20.00 C
ATOM 6 CA THR D 6 9.001 10.343 8.000 1.00 20.00 C
ATOM 7 CA THR D 7 8.964 8.000 8.565 1.00 20.00 C
TER
ATOM 1 CA LYS B 151 6.855 8.667 15.730 1.00 44.22 C
ATOM 2 CA LYS B 152 5.891 8.459 14.655 1.00 49.42 C
ATOM 3 CA LYS B 153 6.103 7.155 13.858 1.00 46.15 C
ATOM 4 CA LYS B 154 5.138 6.438 13.633 1.00 52.97 C
ATOM 5 CA LYS B 155 5.801 9.685 13.736 1.00 41.68 C
ATOM 6 CA LYS B 156 4.731 9.594 12.667 1.00 55.55 C
ATOM 7 CA LYS B 157 4.334 10.965 12.119 1.00 72.27 C
ATOM 8 CA LYS B 158 4.057 11.980 13.238 1.00 75.78 C
ATOM 9 CA LYS B 159 3.177 11.427 14.310 1.00 75.88 C
TER
ATOM 1 CA LYS C 151 6.987 4.106 17.432 1.00 44.22 C
ATOM 2 CA LYS C 152 6.017 3.539 16.502 1.00 49.42 C
ATOM 3 CA LYS C 153 6.497 3.492 15.036 1.00 46.15 C
ATOM 4 CA LYS C 154 6.348 2.458 14.400 1.00 52.97 C
ATOM 5 CA LYS C 155 4.647 4.221 16.634 1.00 41.68 C
ATOM 6 CA LYS C 156 3.552 3.605 15.788 1.00 55.55 C
ATOM 7 CA LYS C 157 2.154 3.953 16.298 1.00 72.27 C
ATOM 8 CA LYS C 158 2.014 3.732 17.811 1.00 75.78 C
ATOM 9 CA LYS C 159 2.558 2.413 18.250 1.00 75.88 C
TER
ATOM 222 CA LEU Y 40 194.618 5.253 81.582 1.00 87.10 C
ATOM 223 CA ARG Y 41 162.395 41.344 70.786 1.00107.25 C
ATOM 224 CA ARG Y 42 162.395 31.344 70.786 1.00107.25 C
TER
ATOM 1 CA THR E 1 8.111 -10.645 11.080 1.00 20.00 C
ATOM 2 CA THR E 2 8.000 -10.125 9.722 1.00 20.00 C
ATOM 3 CA THR E 3 8.075 -11.249 8.694 1.00 20.00 C
ATOM 4 CA THR E 4 8.890 -12.163 8.818 1.00 20.00 C
ATOM 5 CA THR E 5 9.101 -9.092 9.421 1.00 20.00 C
ATOM 6 CA THR E 6 9.001 -8.000 10.343 1.00 20.00 C
ATOM 7 CA THR E 7 8.964 -8.565 8.000 1.00 20.00 C
TER
'''
test_ncs_spec = '''\
Summary of NCS information
Fri Jun 13 13:18:12 2014
C:\Phenix\Dev\Work\work\junk
new_ncs_group
new_operator
rota_matrix 1.0000 0.0000 0.0000
rota_matrix 0.0000 1.0000 0.0000
rota_matrix 0.0000 0.0000 1.0000
tran_orth 0.0000 0.0000 0.0000
center_orth 10.5384 9.4098 10.2058
CHAIN A
RMSD 0.0
MATCHING 9
RESSEQ 151:159
new_operator
rota_matrix 0.4966 0.8679 -0.0102
rota_matrix -0.6436 0.3761 0.6666
rota_matrix 0.5824 -0.3245 0.7453
tran_orth -0.0003 -0.0002 0.0003
center_orth 5.1208 9.3744 13.7718
CHAIN B
RMSD 0.0005
MATCHING 9
RESSEQ 151:159
new_operator
rota_matrix -0.3180 0.7607 0.5659
rota_matrix -0.1734 -0.6334 0.7541
rota_matrix 0.9321 0.1416 0.3334
tran_orth 0.0002 0.0004 -0.0006
center_orth 4.5304 3.5021 16.4612
CHAIN C
RMSD 0.0005
MATCHING 9
RESSEQ 151:159
new_ncs_group
new_operator
rota_matrix 1.0000 0.0000 0.0000
rota_matrix 0.0000 1.0000 0.0000
rota_matrix 0.0000 0.0000 1.0000
tran_orth 0.0000 0.0000 0.0000
center_orth 8.5917 9.4397 9.9770
CHAIN D
RMSD 0.0
MATCHING 7
RESSEQ 1:7
new_operator
rota_matrix 1.0000 0.0000 0.0000
rota_matrix 0.0000 -0.0000 1.0000
rota_matrix 0.0000 -1.0000 -0.0000
tran_orth 0.0000 -0.0000 0.0000
center_orth 8.5917 -9.9770 9.4397
CHAIN E
RMSD 0.0
MATCHING 7
RESSEQ 1:7
'''
def run_selected_tests():
""" Run selected tests
1) List in "tests" the names of the particular test you want to run
2) Comment out unittest.main()
3) Un-comment unittest.TextTestRunner().run(run_selected_tests())
"""
tests = ['test_finding_partial_ncs']
suite = unittest.TestSuite(list(map(TestNcsGroupPreprocessing,tests)))
return suite
if __name__=='__main__':
# use for individual tests
# unittest.TextTestRunner().run(run_selected_tests())
# Use to run all tests
unittest.main(verbosity=0)
| 37.306931 | 88 | 0.585828 | 3,344 | 18,840 | 3.189593 | 0.191388 | 0.023345 | 0.009844 | 0.013782 | 0.533752 | 0.498406 | 0.479186 | 0.458091 | 0.44309 | 0.33724 | 0 | 0.256497 | 0.321868 | 18,840 | 504 | 89 | 37.380952 | 0.57835 | 0.086253 | 0 | 0.350617 | 0 | 0.244444 | 0.682343 | 0.012006 | 0 | 0 | 0 | 0 | 0.017284 | 1 | 0.024691 | false | 0.002469 | 0.046914 | 0 | 0.076543 | 0.014815 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8c4d767148c849a57dbf5ada11848633b727afba | 158 | py | Python | fluids/assets/terrain.py | BerkeleyAutomation/FLUIDS | 728da0d0fec5028ca4506aa9cc8e37a5b072e7a9 | [
"MIT"
] | 26 | 2017-12-28T18:15:36.000Z | 2022-01-21T13:00:27.000Z | fluids/assets/terrain.py | BerkeleyAutomation/FLUIDS | 728da0d0fec5028ca4506aa9cc8e37a5b072e7a9 | [
"MIT"
] | 61 | 2018-01-30T05:18:42.000Z | 2021-05-19T15:00:05.000Z | fluids/assets/terrain.py | BerkeleyAutomation/FLUIDS | 728da0d0fec5028ca4506aa9cc8e37a5b072e7a9 | [
"MIT"
] | 14 | 2017-12-11T04:59:21.000Z | 2021-05-19T12:21:31.000Z | from fluids.assets.shape import Shape
class Terrain(Shape):
def __init__(self, **kwargs):
Shape.__init__(self, color=(0xfd,0xF8,0xef), **kwargs)
| 26.333333 | 62 | 0.696203 | 21 | 158 | 4.857143 | 0.714286 | 0.156863 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030075 | 0.158228 | 158 | 5 | 63 | 31.6 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075949 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8c4d970659a3c3a3957f8a6d158bb5e9d3663bb3 | 2,150 | py | Python | tests/test_sshkeyboard.py | ollipal/sshkeyboard | 457a00adc992884ae26a7dc0c344f7d8978474be | [
"MIT"
] | 7 | 2021-11-19T18:03:50.000Z | 2022-03-31T01:42:05.000Z | tests/test_sshkeyboard.py | ollipal/sshkeyboard | 457a00adc992884ae26a7dc0c344f7d8978474be | [
"MIT"
] | 2 | 2021-11-19T19:20:02.000Z | 2022-02-09T09:22:05.000Z | tests/test_sshkeyboard.py | ollipal/sshkeyboard | 457a00adc992884ae26a7dc0c344f7d8978474be | [
"MIT"
] | 1 | 2022-02-21T18:59:04.000Z | 2022-02-21T18:59:04.000Z | from contextlib import contextmanager
import pytest
import sshkeyboard
i = -1
return_chars = ("a", "a", "b", "")
def setup_testing():
@contextmanager
def _raw(stream):
yield
@contextmanager
def _nonblocking(stream):
yield
def _read_char(debug):
global i
i += 1
return return_chars[i % len(return_chars)]
sshkeyboard._raw = _raw
sshkeyboard._nonblocking = _nonblocking
sshkeyboard._read_char = _read_char
setup_testing()
def empty(key):
pass
def stops(key):
sshkeyboard.stop_listening()
def returns_char(key):
if key not in return_chars:
raise RuntimeError(f"Not correct char {key}")
sshkeyboard.stop_listening()
def press_listen(key):
try:
sshkeyboard.listen_keyboard(empty, empty)
raise RuntimeError("Error not raised")
except AssertionError:
pass
sshkeyboard.stop_listening()
def test_listen_returns_char():
# listen_keyboard press
sshkeyboard.listen_keyboard(returns_char, empty)
# listen_keyboard release
sshkeyboard.listen_keyboard(empty, returns_char)
def test_multiple_listens_raises_error():
# listen_keyboard inside listen_keyboard fails press
sshkeyboard.listen_keyboard(press_listen, empty)
# listen_keyboard inside listen_keyboard fails release
sshkeyboard.listen_keyboard(empty, press_listen)
def test_callback_parameters():
def too_many_params_without_default(key, key2):
pass
def no_params():
pass
def ok1(key):
pass
def ok2(custom_key_name):
pass
def ok3(key="a"):
pass
def ok4(key="a", key2="s"):
pass
with pytest.raises(AssertionError):
sshkeyboard.listen_keyboard(too_many_params_without_default, stops)
with pytest.raises(AssertionError):
sshkeyboard.listen_keyboard(no_params, stops)
sshkeyboard.listen_keyboard(ok1, stops)
sshkeyboard.listen_keyboard(ok2, stops)
sshkeyboard.listen_keyboard(ok3, stops)
sshkeyboard.listen_keyboard(ok4, stops)
# TODO add tests for: sleeps and print orders, throwing errors, assertions
| 21.078431 | 75 | 0.69907 | 255 | 2,150 | 5.639216 | 0.317647 | 0.165508 | 0.191238 | 0.083449 | 0.261474 | 0.130737 | 0.076495 | 0 | 0 | 0 | 0 | 0.007143 | 0.218605 | 2,150 | 101 | 76 | 21.287129 | 0.84881 | 0.103256 | 0 | 0.274194 | 0 | 0 | 0.022893 | 0 | 0 | 0 | 0 | 0.009901 | 0.048387 | 1 | 0.274194 | false | 0.129032 | 0.048387 | 0 | 0.33871 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
8c5b49393f7a3df1d7b5904ad42b03f7e711f0c5 | 3,166 | py | Python | parkingmanagement/parkingmanagement/settings.py | vivek-at-work/ridecell-code | 93965a1437197102eca6cf6313ba3dbb4c3f5c3c | [
"Apache-2.0"
] | null | null | null | parkingmanagement/parkingmanagement/settings.py | vivek-at-work/ridecell-code | 93965a1437197102eca6cf6313ba3dbb4c3f5c3c | [
"Apache-2.0"
] | null | null | null | parkingmanagement/parkingmanagement/settings.py | vivek-at-work/ridecell-code | 93965a1437197102eca6cf6313ba3dbb4c3f5c3c | [
"Apache-2.0"
] | null | null | null | """
Django settings for parkingmanagement project.
Generated by 'django-admin startproject' using Django 3.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
import sys
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
APPS_DIR = os.path.join(BASE_DIR, 'apps')
sys.path.insert(0, APPS_DIR)
SECRET_KEY = os.environ.get('PMS_SECRET_KEY', '&3jy-c34z5sx+*vtwwex&5eqwev@+zbh*dh)*&4-vkuzhkakh+')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'rest_framework'
]
LOCAL_APPS = ['users', 'parkings']
INSTALLED_APPS = INSTALLED_APPS + LOCAL_APPS
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'parkingmanagement.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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',
],
},
},
]
WSGI_APPLICATION = 'parkingmanagement.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': os.environ.get('PMS_DB_NAME', 'mydb') ,
'USER': os.environ.get('PMS_DB_USER', 'myuser'),
'PASSWORD': os.environ.get('PMS_DB_PASS', 'mypass')
},
}
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'},
]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
AUTH_USER_MODEL = 'users.User'
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'users.backends.ConatctNumberBasedAuthenticationsBackend',
]
| 27.293103 | 99 | 0.7012 | 347 | 3,166 | 6.259366 | 0.455331 | 0.107735 | 0.062615 | 0.027624 | 0.138122 | 0.114641 | 0.042818 | 0.029466 | 0 | 0 | 0 | 0.00755 | 0.163298 | 3,166 | 115 | 100 | 27.530435 | 0.812382 | 0.175616 | 0 | 0 | 1 | 0 | 0.550038 | 0.447652 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.081081 | 0.040541 | 0 | 0.040541 | 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 |
8c5bcaf58c7302e332d00ce35e9dc6af67b69166 | 144 | py | Python | python/helpers/python-skeletons/alembic.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 93 | 2015-01-20T06:36:59.000Z | 2021-11-08T09:49:59.000Z | python/helpers/python-skeletons/alembic.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/helpers/python-skeletons/alembic.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 62 | 2015-01-30T13:13:39.000Z | 2022-03-19T08:26:45.000Z | from alembic.operations import Operations
from alembic.environment import EnvironmentContext
op = Operations()
context = EnvironmentContext()
| 20.571429 | 50 | 0.833333 | 14 | 144 | 8.571429 | 0.571429 | 0.183333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 144 | 6 | 51 | 24 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
4fc66255062f79a3e894e7de8fddda9c47631663 | 892 | py | Python | .src/PyPtt/lib_util.py | PttCodingMan/ptt_post_too_many_monitor | 41031f3c6691e7050a1b5ef523e3cd2a00e502c5 | [
"Apache-2.0"
] | null | null | null | .src/PyPtt/lib_util.py | PttCodingMan/ptt_post_too_many_monitor | 41031f3c6691e7050a1b5ef523e3cd2a00e502c5 | [
"Apache-2.0"
] | null | null | null | .src/PyPtt/lib_util.py | PttCodingMan/ptt_post_too_many_monitor | 41031f3c6691e7050a1b5ef523e3cd2a00e502c5 | [
"Apache-2.0"
] | null | null | null | import os
import random
import string
import traceback
from enum import Enum
def check_range(define_obj, value):
if value < define_obj.min_value or define_obj.max_value < value:
return False
return True
def get_file_name(string):
result = os.path.basename(string)
result = result[:result.find('.')]
return result
def get_current_func_name():
return traceback.extract_stack(None, 2)[0][2]
def findnth(haystack, needle, n):
parts = haystack.split(needle, n + 1)
if len(parts) <= n + 1:
return -1
return len(haystack) - len(parts[-1]) - len(needle)
class AutoName(Enum):
def _generate_next_value_(name, start, count, last_values):
return name
def get_random_str(length):
return ''.join(random.choices(string.hexdigits, k=length))
if __name__ == '__main__':
for _ in range(5):
print(get_random_str(10)) | 21.238095 | 68 | 0.681614 | 128 | 892 | 4.515625 | 0.484375 | 0.046713 | 0.041522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014085 | 0.204036 | 892 | 42 | 69 | 21.238095 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.010078 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.178571 | 0.107143 | 0.714286 | 0.035714 | 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 |
4fc9c329268a92dd54ffb4e2adb603ea320a3c9d | 219 | py | Python | backend/api/config.py | vorbrodt/GutenTag | 650011ddf50211153be693cc5ef986cabff6db69 | [
"MIT"
] | null | null | null | backend/api/config.py | vorbrodt/GutenTag | 650011ddf50211153be693cc5ef986cabff6db69 | [
"MIT"
] | null | null | null | backend/api/config.py | vorbrodt/GutenTag | 650011ddf50211153be693cc5ef986cabff6db69 | [
"MIT"
] | null | null | null | import os
class Config(object):
SQLALCHEMY_DATABASE_URI = os.getenv("DATABASE_URL", "postgres://")
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ENGINE_OPTIONS = {
"pool_pre_ping": True,
}
| 21.9 | 70 | 0.69863 | 24 | 219 | 6 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196347 | 219 | 9 | 71 | 24.333333 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0.164384 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.714286 | 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 |
4ff4b2dabc3e255dea82b06435785090bf235bbe | 158 | py | Python | test/tests/signal_test.py | aisk/pyston | ac69cfef0621dbc8901175e84fa2b5cb5781a646 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | test/tests/signal_test.py | aisk/pyston | ac69cfef0621dbc8901175e84fa2b5cb5781a646 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | test/tests/signal_test.py | aisk/pyston | ac69cfef0621dbc8901175e84fa2b5cb5781a646 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | import signal
for k in sorted(dir(signal)):
if not k.startswith("SIG"):
continue
print k, getattr(signal, k)
print hasattr(signal, "alarm")
| 17.555556 | 31 | 0.651899 | 23 | 158 | 4.478261 | 0.695652 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221519 | 158 | 8 | 32 | 19.75 | 0.837398 | 0 | 0 | 0 | 0 | 0 | 0.050633 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.166667 | 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 |
8b10933d44233fae7b6939adb3701023c30bf244 | 971 | py | Python | app/main/errors.py | zhangyage/mytest | 3640f3ba1e871228483697acfec0d84784372966 | [
"MIT"
] | null | null | null | app/main/errors.py | zhangyage/mytest | 3640f3ba1e871228483697acfec0d84784372966 | [
"MIT"
] | null | null | null | app/main/errors.py | zhangyage/mytest | 3640f3ba1e871228483697acfec0d84784372966 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from flask import Flask,render_template,request,jsonify
from . import main
# @main.app_errorhandler(404)
# def page_not_found(e):
# return render_template('404.html'),404
@main.app_errorhandler(404)
def page_not_found(e):
if request.accept_mimetypes.accept_json and \
not request.accept_mimetypes.accept_html:
response = jsonify({'error': 'not found'})
response.status_code = 404
return response
return render_template('404.html'), 404
# @main.app_errorhandler(500)
# def internal_server_error(e):
# return render_template('500.html'),500
@main.app_errorhandler(500)
def page_not_found(e):
if request.accept_mimetypes.accept_json and \
not request.accept_mimetypes.accept_html:
response = jsonify({'error': 'not found'})
response.status_code = 500
return response
return render_template('500.html'), 500 | 31.322581 | 56 | 0.682801 | 126 | 971 | 5.047619 | 0.293651 | 0.110063 | 0.119497 | 0.176101 | 0.822327 | 0.734277 | 0.639937 | 0.639937 | 0.639937 | 0.421384 | 0 | 0.055484 | 0.201854 | 971 | 31 | 57 | 31.322581 | 0.765161 | 0.243048 | 0 | 0.555556 | 0 | 0 | 0.063037 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8c6da8e7637300703dbe7c2fbace147f8fe8d7fc | 249 | py | Python | app2/event.py | yosais/Computer-Simulation-Book | 87b2d83eded02f69cd7b8d839adfa554b25ae19d | [
"MIT"
] | 16 | 2017-10-26T02:35:31.000Z | 2021-11-24T04:31:32.000Z | app2/event.py | yosais/Computer-Simulation-Book | 87b2d83eded02f69cd7b8d839adfa554b25ae19d | [
"MIT"
] | null | null | null | app2/event.py | yosais/Computer-Simulation-Book | 87b2d83eded02f69cd7b8d839adfa554b25ae19d | [
"MIT"
] | 11 | 2018-02-04T05:10:11.000Z | 2021-11-24T05:30:45.000Z | class Event:
def __init__(self, _src, _target, _type, _time):
self.src = _src
self.target = _target
self.type = _type
self.time = _time
def __eq__(self, other):
return self.__dict__ == other.__dict__
| 24.9 | 52 | 0.598394 | 30 | 249 | 4.166667 | 0.433333 | 0.112 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.305221 | 249 | 9 | 53 | 27.666667 | 0.722543 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.125 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
8c80c3fb1279ed3993bc10935073051955b96fc5 | 804 | py | Python | libs/modules/circular_pad.py | kazuto1011/circular-conv-pytorch | 440ca5e94320697fe324ce5a81a3c9ecd71dde01 | [
"MIT"
] | 5 | 2019-01-28T13:31:58.000Z | 2021-07-27T01:59:04.000Z | libs/modules/circular_pad.py | kazuto1011/circular-conv-pytorch | 440ca5e94320697fe324ce5a81a3c9ecd71dde01 | [
"MIT"
] | 1 | 2022-02-10T12:18:38.000Z | 2022-02-10T12:30:12.000Z | libs/modules/circular_pad.py | kazuto1011/circular-conv-pytorch | 440ca5e94320697fe324ce5a81a3c9ecd71dde01 | [
"MIT"
] | 3 | 2020-01-07T03:16:19.000Z | 2022-01-22T07:41:19.000Z | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: http://kazuto1011.github.io
# Created: 2017-05-27
import collections
from itertools import repeat
import torch.nn as nn
from ..functions.circular_pad import CircularPad2d as F_CircularPad2d
def _ntuple(n):
def parse(x):
if isinstance(x, collections.Iterable):
return x
return tuple(repeat(x, n))
return parse
_quadruple = _ntuple(4)
class CircularPad2d(nn.Module):
def __init__(self, padding=(1, 1, 1, 1)):
super(CircularPad2d, self).__init__()
self.padding = _quadruple(padding)
def forward(self, input):
return F_CircularPad2d(padding=self.padding)(input)
def __repr__(self):
return self.__class__.__name__ + str(self.padding)
| 20.615385 | 69 | 0.674129 | 103 | 804 | 5 | 0.543689 | 0.085437 | 0.058252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036508 | 0.216418 | 804 | 38 | 70 | 21.157895 | 0.780952 | 0.149254 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0.210526 | 0.105263 | 0.789474 | 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 |
8c82affe27d3fa276bc451c28ae0b6ef34747637 | 84 | py | Python | misago/misago/themes/__init__.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | 2 | 2021-03-06T21:06:13.000Z | 2021-03-09T15:05:12.000Z | misago/misago/themes/__init__.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | null | null | null | misago/misago/themes/__init__.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | null | null | null | default_app_config = "misago.themes.apps.MisagoThemesConfig"
THEME_CACHE = "theme"
| 21 | 60 | 0.809524 | 10 | 84 | 6.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 84 | 3 | 61 | 28 | 0.844156 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0.440476 | 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 |
8c95691f550f4b13ff4746d31e4215877ddc5487 | 89 | py | Python | settings/conf.py | robinhundt/IFIBlogBot | f8638f23f3de92b36e09b26c55b40e64dd0bb40f | [
"MIT"
] | null | null | null | settings/conf.py | robinhundt/IFIBlogBot | f8638f23f3de92b36e09b26c55b40e64dd0bb40f | [
"MIT"
] | null | null | null | settings/conf.py | robinhundt/IFIBlogBot | f8638f23f3de92b36e09b26c55b40e64dd0bb40f | [
"MIT"
] | null | null | null | feed = {
'url': 'http://blog.stud.uni-goettingen.de/informatikstudiendekanat/feed/'
} | 29.666667 | 78 | 0.696629 | 10 | 89 | 6.2 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101124 | 89 | 3 | 79 | 29.666667 | 0.775 | 0 | 0 | 0 | 0 | 0 | 0.755556 | 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 |
8ca1705b1f78655837b81f67b9d523db589c91a6 | 28 | py | Python | service/youtube/__init__.py | cdrandin/SimpleMusicBot | 0640aa4da4ee0a7ac425e3436f4bf936a00509c4 | [
"MIT"
] | null | null | null | service/youtube/__init__.py | cdrandin/SimpleMusicBot | 0640aa4da4ee0a7ac425e3436f4bf936a00509c4 | [
"MIT"
] | null | null | null | service/youtube/__init__.py | cdrandin/SimpleMusicBot | 0640aa4da4ee0a7ac425e3436f4bf936a00509c4 | [
"MIT"
] | null | null | null | __all__ = ['youtube_fetch']
| 14 | 27 | 0.714286 | 3 | 28 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 28 | 1 | 28 | 28 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0.464286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8cf05b89d0bca0251d7bcf5e23540d1879ea9724 | 225 | py | Python | src/openpersonen/api/enum/geslachtsaanduiding.py | maykinmedia/open-personen | ddcf083ccd4eb864c5305bcd8bc75c6c64108272 | [
"RSA-MD"
] | 2 | 2020-08-26T11:24:43.000Z | 2021-07-28T09:46:40.000Z | src/openpersonen/api/enum/geslachtsaanduiding.py | maykinmedia/open-personen | ddcf083ccd4eb864c5305bcd8bc75c6c64108272 | [
"RSA-MD"
] | 153 | 2020-08-26T10:45:35.000Z | 2021-12-10T17:33:16.000Z | src/openpersonen/api/enum/geslachtsaanduiding.py | maykinmedia/open-personen | ddcf083ccd4eb864c5305bcd8bc75c6c64108272 | [
"RSA-MD"
] | null | null | null | from djchoices import ChoiceItem, DjangoChoices
class GeslachtsaanduidingChoices(DjangoChoices):
man = ChoiceItem("man", "Man")
vrouw = ChoiceItem("vrouw", "Vrouw")
onbekend = ChoiceItem("onbekend", "Onbekend")
| 28.125 | 49 | 0.728889 | 20 | 225 | 8.2 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146667 | 225 | 7 | 50 | 32.142857 | 0.854167 | 0 | 0 | 0 | 0 | 0 | 0.142222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 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 |
8cfa860fa7ca19260f7807127c0367962eac9893 | 919 | py | Python | pythonx/gimmename.py | idbrii/vim-gimmename | b5b819c50deb3e961c7e8a98c36d673ce07e2185 | [
"MIT"
] | 6 | 2020-04-25T01:40:46.000Z | 2021-07-23T11:09:05.000Z | pythonx/gimmename.py | idbrii/vim-gimmename | b5b819c50deb3e961c7e8a98c36d673ce07e2185 | [
"MIT"
] | null | null | null | pythonx/gimmename.py | idbrii/vim-gimmename | b5b819c50deb3e961c7e8a98c36d673ce07e2185 | [
"MIT"
] | null | null | null | #! /usr/bin/env python3
import coolname
def get_name(style):
import vim
vim.vars['gimmecase_generated_variable'] = _get_name(style)
def _get_name(style):
if style == 'snakecase':
return get_snake_name()
elif style == 'camelcase':
return get_camel_name()
elif style == 'mixedcase':
return get_mixed_name()
def get_snake_name():
items = _generate()
return '_'.join(items)
def get_camel_name():
items = _generate()
items = [items[0]] + [e.capitalize() for e in items[1:]]
return ''.join(items)
def get_mixed_name():
items = _generate()
items = [e.capitalize() for e in items]
return ''.join(items)
def _generate():
return coolname.generate(2)
if __name__ == "__main__":
print('snake', get_snake_name())
print('camel', get_camel_name())
print('mixed', get_mixed_name())
print('mixed', _get_name('mixedcase'))
| 20.422222 | 63 | 0.63765 | 118 | 919 | 4.627119 | 0.305085 | 0.054945 | 0.065934 | 0.098901 | 0.157509 | 0.080586 | 0 | 0 | 0 | 0 | 0 | 0.005556 | 0.21654 | 919 | 44 | 64 | 20.886364 | 0.752778 | 0.023939 | 0 | 0.172414 | 1 | 0 | 0.103795 | 0.03125 | 0 | 0 | 0 | 0 | 0 | 1 | 0.206897 | false | 0 | 0.068966 | 0.034483 | 0.517241 | 0.137931 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
50930a760865491201b93f70019e2bc8c3978f9f | 307 | py | Python | server/lostinp/routes/validate.py | manoloesparta/imissu | d8ec8d217feb7af725639cb0572ea4df4d719ae9 | [
"MIT"
] | null | null | null | server/lostinp/routes/validate.py | manoloesparta/imissu | d8ec8d217feb7af725639cb0572ea4df4d719ae9 | [
"MIT"
] | 2 | 2021-11-17T07:43:38.000Z | 2022-02-27T21:07:26.000Z | server/lostinp/routes/validate.py | manoloesparta/lostinparadise | 83b492bac601d3c97f5fcd486b416e984aedcc4a | [
"MIT"
] | null | null | null | from sanic import Blueprint
from sanic.response import json
from lostinp.utils.decorators import user_must_be_registered
bp = Blueprint("validate")
@bp.post("/validate")
@user_must_be_registered
def validate_route(request):
response = {"message": "user is registered"}
return json(response, 200)
| 23.615385 | 60 | 0.775244 | 41 | 307 | 5.634146 | 0.560976 | 0.077922 | 0.08658 | 0.17316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011194 | 0.127036 | 307 | 12 | 61 | 25.583333 | 0.850746 | 0 | 0 | 0 | 0 | 0 | 0.136808 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.555556 | 0.222222 | 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 |
509867c0d2b70279bcf46dec0f20702e47af9191 | 467 | py | Python | tests/unit_tests/test_tethys_apps/test_base/test_controller.py | ezrajrice/tethys | 238271ebb09913f1f57b0d127fd5c81bb4780a0a | [
"BSD-2-Clause"
] | 79 | 2015-10-05T13:13:28.000Z | 2022-02-01T12:30:33.000Z | tests/unit_tests/test_tethys_apps/test_base/test_controller.py | ezrajrice/tethys | 238271ebb09913f1f57b0d127fd5c81bb4780a0a | [
"BSD-2-Clause"
] | 542 | 2015-08-12T22:11:32.000Z | 2022-03-29T22:18:08.000Z | tests/unit_tests/test_tethys_apps/test_base/test_controller.py | Aquaveo/tethys | 15f67c3fb9458d3af2733542be5ea6391f33b222 | [
"BSD-2-Clause"
] | 71 | 2016-01-16T01:03:41.000Z | 2022-03-31T17:55:54.000Z | import unittest
from unittest import mock
import tethys_apps.base.controller as tethys_controller
class TestController(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
@mock.patch('django.views.generic.View.as_view')
def test_TethysController(self, mock_as_view):
kwargs = {'foo': 'bar'}
tethys_controller.TethysController.as_controller(**kwargs)
mock_as_view.assert_called_with(**kwargs)
| 25.944444 | 66 | 0.715203 | 57 | 467 | 5.649123 | 0.526316 | 0.055901 | 0.062112 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188437 | 467 | 17 | 67 | 27.470588 | 0.849604 | 0 | 0 | 0.153846 | 0 | 0 | 0.083512 | 0.070664 | 0 | 0 | 0 | 0 | 0.076923 | 1 | 0.230769 | false | 0.153846 | 0.230769 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
50ae0db729c66ff6f333ed0d0acb844fed8a16d7 | 65 | py | Python | src/apps/__init__.py | AntonNeld/drodbot | b69f715392235dc0d90775c452276b6f12ec4776 | [
"MIT"
] | null | null | null | src/apps/__init__.py | AntonNeld/drodbot | b69f715392235dc0d90775c452276b6f12ec4776 | [
"MIT"
] | null | null | null | src/apps/__init__.py | AntonNeld/drodbot | b69f715392235dc0d90775c452276b6f12ec4776 | [
"MIT"
] | null | null | null | from .main_app import MainApp
__all__ = ("MainApp", "backends")
| 16.25 | 33 | 0.723077 | 8 | 65 | 5.25 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138462 | 65 | 3 | 34 | 21.666667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.230769 | 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 |
50b2999a5b32aba491cb2ab0c65dafd9c7ea3f67 | 439 | py | Python | polarion/first_run.py | red-hat-storage/polarion-reporter | 1f1a7db166f9e0d0246c73899203d0a95274d265 | [
"MIT"
] | null | null | null | polarion/first_run.py | red-hat-storage/polarion-reporter | 1f1a7db166f9e0d0246c73899203d0a95274d265 | [
"MIT"
] | null | null | null | polarion/first_run.py | red-hat-storage/polarion-reporter | 1f1a7db166f9e0d0246c73899203d0a95274d265 | [
"MIT"
] | 1 | 2022-03-30T04:33:12.000Z | 2022-03-30T04:33:12.000Z | import os
os.system("python3 -c 'import site; print(site.getsitepackages())' > temp.txt")
file = open("temp.txt", "r")
string_path = file.read()
string_path = string_path.replace("[", "")
string_path = string_path.replace("]", "")
string_path = string_path.split(",")[-1]
string_path = string_path.strip()
print(string_path)
string_path += "/pygsheets/"
os.system("cp replace_file/chart.py " + string_path + "chart.py")
print("Done!! ")
| 29.266667 | 79 | 0.694761 | 62 | 439 | 4.709677 | 0.403226 | 0.410959 | 0.273973 | 0.342466 | 0.253425 | 0.253425 | 0.253425 | 0.253425 | 0.253425 | 0 | 0 | 0.005076 | 0.102506 | 439 | 14 | 80 | 31.357143 | 0.736041 | 0 | 0 | 0 | 0 | 0 | 0.29385 | 0.116173 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.25 | 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 |
50b65c59d0a4419d08461b83fc6529abd42457d4 | 242 | py | Python | foyer/__init__.py | bc118/foyer | 17576a2c74c2c643c7d6bf47a84cc0977ea35cdb | [
"MIT"
] | 1 | 2020-09-22T18:59:19.000Z | 2020-09-22T18:59:19.000Z | foyer/__init__.py | bc118/foyer | 17576a2c74c2c643c7d6bf47a84cc0977ea35cdb | [
"MIT"
] | null | null | null | foyer/__init__.py | bc118/foyer | 17576a2c74c2c643c7d6bf47a84cc0977ea35cdb | [
"MIT"
] | null | null | null | """Foyer: A pacakage for atom-typing, applying and disseminating forcefields."""
from foyer.forcefield import Forcefield
from foyer.forcefields import forcefields
__version__ = "0.9.1"
__all__ = ("Forcefield", "forcefields", "__version__")
| 30.25 | 80 | 0.772727 | 28 | 242 | 6.25 | 0.642857 | 0.102857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013953 | 0.11157 | 242 | 7 | 81 | 34.571429 | 0.8 | 0.305785 | 0 | 0 | 0 | 0 | 0.228395 | 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 |
50b68be35703c63b12d46973fade6051847f4d55 | 391 | py | Python | pytorch_toolkit/action_recognition/action_recognition/models/modules/__init__.py | morkovka1337/openvino_training_extensions | 846db45c264d6b061505213f51763520b9432ba9 | [
"Apache-2.0"
] | 256 | 2020-09-09T03:27:57.000Z | 2022-03-30T10:06:06.000Z | pytorch_toolkit/action_recognition/action_recognition/models/modules/__init__.py | morkovka1337/openvino_training_extensions | 846db45c264d6b061505213f51763520b9432ba9 | [
"Apache-2.0"
] | 604 | 2020-09-08T12:29:49.000Z | 2022-03-31T21:51:08.000Z | pytorch_toolkit/action_recognition/action_recognition/models/modules/__init__.py | morkovka1337/openvino_training_extensions | 846db45c264d6b061505213f51763520b9432ba9 | [
"Apache-2.0"
] | 160 | 2020-09-09T14:06:07.000Z | 2022-03-30T14:50:48.000Z | from .functional import unsquash_dim, squash_dims, reduce_tensor
from .modules import Identity, AttentionLSTM, Attention, SEBlock, StateInitFC, StateInitZero
from . import self_attention, bnlstm, tcn
__all__ = ['unsquash_dim', 'squash_dims', 'reduce_tensor', 'self_attention', 'bnlstm', 'tcn', 'Identity',
'AttentionLSTM', 'Attention', 'SEBlock', 'StateInitFC', 'StateInitZero']
| 55.857143 | 105 | 0.751918 | 41 | 391 | 6.878049 | 0.487805 | 0.078014 | 0.120567 | 0.148936 | 0.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120205 | 391 | 6 | 106 | 65.166667 | 0.819767 | 0 | 0 | 0 | 0 | 0 | 0.306905 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
50c055f293656ab8cf955eab9b8d9d19d1dad1c9 | 1,238 | py | Python | pyfiction/simulators/simulator.py | FPreta/pyfiction | a8af76c6badb11aa442122b1f2c4fbda1cf2ac53 | [
"MIT"
] | 32 | 2016-05-28T06:12:38.000Z | 2021-09-03T23:10:18.000Z | pyfiction/simulators/simulator.py | KailashDN/pyfiction | dc126d48578c53a3d2f95723c94da0afdd3282d0 | [
"MIT"
] | 4 | 2019-12-16T20:18:25.000Z | 2022-03-01T11:23:10.000Z | pyfiction/simulators/simulator.py | KailashDN/pyfiction | dc126d48578c53a3d2f95723c94da0afdd3282d0 | [
"MIT"
] | 13 | 2017-08-15T13:14:00.000Z | 2022-03-01T01:42:37.000Z | class Simulator:
# the maximum number of steps the agent should take before we interrupt him to break infinite cycles
max_steps = 500
# the recommended number of random game walkthroughs for vocabulary initialization
# should ideally cover all possible states and used words
initialization_iterations = 1024
# if the game rewards are in e.g. [-30, 30], set the reward scale to 30 so that the result is in [-1, 1]
reward_scale = 1
# reference to the underlying game class
game = None
def __init__(self):
raise NotImplementedError("Simulator is an abstract class.")
def restart(self):
raise NotImplementedError("Simulator is an abstract class.")
def startup_actions(self):
raise NotImplementedError("Simulator is an abstract class.")
def write(self, text):
raise NotImplementedError("Simulator is an abstract class.")
def read(self, timeout=0.01):
raise NotImplementedError("Simulator is an abstract class.")
def close(self):
raise NotImplementedError("Simulator is an abstract class.")
class UnknownEndingException(Exception):
"""Reached a state without any actions but cannot assign a reward, unknown state"""
| 33.459459 | 108 | 0.709208 | 160 | 1,238 | 5.4375 | 0.51875 | 0.165517 | 0.227586 | 0.241379 | 0.38046 | 0.38046 | 0.38046 | 0.38046 | 0.196552 | 0 | 0 | 0.019771 | 0.223748 | 1,238 | 36 | 109 | 34.388889 | 0.885536 | 0.368336 | 0 | 0.333333 | 0 | 0 | 0.240933 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.