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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c0fb907ba449587f94d3ac296c06517f18ff9ca0 | 208 | py | Python | lists_carousels/urls.py | snoop2head/exercise_curation_django | ba35bd32d8bc203d318cb8b6e0a1722f3aa26eda | [
"MIT"
] | 3 | 2020-09-30T04:44:39.000Z | 2021-07-30T08:20:18.000Z | lists_carousels/urls.py | snoop2head/exercise_curation_django | ba35bd32d8bc203d318cb8b6e0a1722f3aa26eda | [
"MIT"
] | 7 | 2021-03-30T13:09:55.000Z | 2022-01-13T02:33:34.000Z | lists_carousels/urls.py | snoop2head/exercise_curation_django | ba35bd32d8bc203d318cb8b6e0a1722f3aa26eda | [
"MIT"
] | 1 | 2022-03-31T12:01:38.000Z | 2022-03-31T12:01:38.000Z | from django.urls import path
from . import views
# making separate urls.py for rooms
app_name = "lists_carousels"
# receiving "localhost/rooms/110230" to use it as primary key for database
urlpatterns = []
| 23.111111 | 74 | 0.769231 | 31 | 208 | 5.096774 | 0.83871 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034286 | 0.158654 | 208 | 8 | 75 | 26 | 0.868571 | 0.509615 | 0 | 0 | 0 | 0 | 0.151515 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
c0ff58f6aeb6c464b09e2cb7680086164d2ed42b | 379 | py | Python | app/search.py | drakiez92/Image-Retrieval | 0a888a6dfe76ca0d150ce2a667512d4f41f7757a | [
"MIT"
] | 1 | 2022-02-02T04:45:35.000Z | 2022-02-02T04:45:35.000Z | app/search.py | drakiez92/Image-Retrieval | 0a888a6dfe76ca0d150ce2a667512d4f41f7757a | [
"MIT"
] | null | null | null | app/search.py | drakiez92/Image-Retrieval | 0a888a6dfe76ca0d150ce2a667512d4f41f7757a | [
"MIT"
] | 1 | 2022-02-25T03:27:08.000Z | 2022-02-25T03:27:08.000Z | from email.mime import image
from app.extract_vector import search
import io
import base64
import time
from PIL import Image
def get_similar(image_endcoded, dataset):
msg = base64.b64decode(image_endcoded)
buf = io.BytesIO(msg)
img = Image.open(buf)
begin = time.time()
result = search(img, 50, dataset)
end = time.time()
return result, end - begin | 22.294118 | 42 | 0.712401 | 55 | 379 | 4.836364 | 0.527273 | 0.082707 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026403 | 0.200528 | 379 | 17 | 43 | 22.294118 | 0.851485 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.428571 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 2 |
8d0858b4d09394f6997c31e585d81f1da6b25326 | 274 | py | Python | tests/drivers/http/test_cursor.py | hodgesrm/clickhouse-sqlalchemy | ee0a98af063483d8e6b7c7fdc5724ed2b9738d64 | [
"MIT"
] | 1 | 2021-07-07T09:06:00.000Z | 2021-07-07T09:06:00.000Z | tests/drivers/http/test_cursor.py | hodgesrm/clickhouse-sqlalchemy | ee0a98af063483d8e6b7c7fdc5724ed2b9738d64 | [
"MIT"
] | null | null | null | tests/drivers/http/test_cursor.py | hodgesrm/clickhouse-sqlalchemy | ee0a98af063483d8e6b7c7fdc5724ed2b9738d64 | [
"MIT"
] | null | null | null | from tests.testcase import HttpSessionTestCase
class CursorTestCase(HttpSessionTestCase):
def test_check_iter_cursor(self):
rv = self.session.execute('SELECT number FROM system.numbers LIMIT 5')
self.assertListEqual(list(rv), [(x,) for x in range(5)])
| 34.25 | 78 | 0.737226 | 35 | 274 | 5.685714 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008696 | 0.160584 | 274 | 7 | 79 | 39.142857 | 0.856522 | 0 | 0 | 0 | 0 | 0 | 0.149635 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.2 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
2396c4810ea38ebc80acfcec5e7709405d844974 | 563 | py | Python | __getDomainUsingPTRandDNS.py | simdevex/01.Basics | cf4f372384e66f4b26e4887d2f5d815a1f8e929c | [
"MIT"
] | null | null | null | __getDomainUsingPTRandDNS.py | simdevex/01.Basics | cf4f372384e66f4b26e4887d2f5d815a1f8e929c | [
"MIT"
] | null | null | null | __getDomainUsingPTRandDNS.py | simdevex/01.Basics | cf4f372384e66f4b26e4887d2f5d815a1f8e929c | [
"MIT"
] | null | null | null | '''
Write a Python program to get the domain name using PTR
DNS records from a given IP address.
Domain name using PTR DNS:
dns.google
ec2-13-251-106-90.ap-southeast-1.compute.amazonaws.com
dns.google
ec2-23-23-212-126.compute-1.amazonaws.com
'''
def get_domain_name(ip_address):
import socket
result=socket.gethostbyaddr(ip_address)
return list(result)[0]
print("Domain name using PTR DNS:")
print(get_domain_name("8.8.8.8"))
print(get_domain_name("13.251.106.90"))
print(get_domain_name("8.8.4.4"))
print(get_domain_name("23.23.212.126"))
| 25.590909 | 55 | 0.738899 | 102 | 563 | 3.960784 | 0.421569 | 0.19802 | 0.160891 | 0.178218 | 0.254951 | 0.09901 | 0 | 0 | 0 | 0 | 0 | 0.106855 | 0.119005 | 563 | 21 | 56 | 26.809524 | 0.707661 | 0.424512 | 0 | 0 | 0 | 0 | 0.209524 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.333333 | 0.555556 | 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 | 0 | 0 | 0 | 1 | 0 | 2 |
23bae6f34c1bfe81ae5d11601bf5b3d866435578 | 564 | py | Python | plot_feature_importance.py | vsuomi/fibroid-classification | 749e77af4dbd28b00184a9aa9e32b9d891493bd4 | [
"MIT"
] | 12 | 2019-02-27T17:07:58.000Z | 2021-12-17T20:31:31.000Z | plot_feature_importance.py | vsuomi/fibroid-classification | 749e77af4dbd28b00184a9aa9e32b9d891493bd4 | [
"MIT"
] | 2 | 2020-04-02T08:57:19.000Z | 2021-06-10T05:06:26.000Z | plot_feature_importance.py | vsuomi/radiation-dose | 6a97e282b7b8a06cde7973ceeebb14ea3ef60f70 | [
"MIT"
] | 2 | 2019-09-21T12:19:08.000Z | 2020-04-28T04:30:41.000Z | # -*- coding: utf-8 -*-
'''
Created on Fri Dec 14 14:33:05 2018
@author:
Visa Suomi
Turku University Hospital
November 2018
@description:
This function is used for plotting the feature importance
'''
#%% import necessary libraries
import matplotlib.pyplot as plt
import shap
#%% define function
def plot_feature_importance(model, training_features):
f = plt.figure()
shap_values = shap.TreeExplainer(model).shap_values(training_features)
shap.summary_plot(shap_values, training_features)
return f
| 18.193548 | 74 | 0.695035 | 70 | 564 | 5.471429 | 0.685714 | 0.125326 | 0.093995 | 0.13577 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038724 | 0.221631 | 564 | 30 | 75 | 18.8 | 0.833713 | 0.485816 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
23bdaf9a4207110fbc1a58fa86f4376441b447e3 | 841 | py | Python | LeetCode/python/031-060/037-count-and-say/say.py | shootsoft/practice | 49f28c2e0240de61d00e4e0291b3c5edd930e345 | [
"Apache-2.0"
] | null | null | null | LeetCode/python/031-060/037-count-and-say/say.py | shootsoft/practice | 49f28c2e0240de61d00e4e0291b3c5edd930e345 | [
"Apache-2.0"
] | null | null | null | LeetCode/python/031-060/037-count-and-say/say.py | shootsoft/practice | 49f28c2e0240de61d00e4e0291b3c5edd930e345 | [
"Apache-2.0"
] | null | null | null | class Solution:
# @return a string
def countAndSay(self, n):
if n<1:
return ''
i = 1
num = '1'
while i<n:
num = self.say(num)
i += 1
return num
def say(self, num):
r = []
c = len(num)
start = 0
if c == 1:
r.append('1')
r.append(num[0])
start += 1
while start < c:
end = start + 1
while end< c and num[end] == num[start]:
end+=1
r.append(str(end - start))
r.append(num[start])
start = end
return ''.join(r)
s = Solution()
print s.countAndSay(0)
print s.countAndSay(1)
print s.countAndSay(2)
print s.countAndSay(3)
print s.countAndSay(4)
print s.countAndSay(5)
print s.countAndSay(6) | 17.893617 | 52 | 0.457788 | 110 | 841 | 3.5 | 0.290909 | 0.109091 | 0.309091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03681 | 0.418549 | 841 | 47 | 53 | 17.893617 | 0.750511 | 0.019025 | 0 | 0 | 0 | 0 | 0.002427 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.205882 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
23c5742771cac56a0cc69c181b38d08c4873fefd | 197 | py | Python | tts_engine.py | Surya2709/voice-based-mailing-system-for-blinds | e8793c02c34a85744b049630cb4b0eebbc181c44 | [
"MIT"
] | 1 | 2021-07-04T06:01:11.000Z | 2021-07-04T06:01:11.000Z | tts_engine.py | Surya2709/voice-based-mailing-system-for-blinds | e8793c02c34a85744b049630cb4b0eebbc181c44 | [
"MIT"
] | null | null | null | tts_engine.py | Surya2709/voice-based-mailing-system-for-blinds | e8793c02c34a85744b049630cb4b0eebbc181c44 | [
"MIT"
] | 1 | 2021-05-25T09:21:09.000Z | 2021-05-25T09:21:09.000Z | import os
import pyttsx3
def speak(text):
engine = pyttsx3.init()
engine.setProperty('rate', 150)
engine.setProperty('volume',1.0)
engine.say(text)
engine.runAndWait() | 21.888889 | 38 | 0.649746 | 24 | 197 | 5.333333 | 0.666667 | 0.15625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0.218274 | 197 | 9 | 39 | 21.888889 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.375 | 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 | 0 | 0 | 0 | 2 |
23d494b9fc2a97487a1f7b843690dcdab9c416c2 | 1,023 | py | Python | Phase-2/Search and Sorting/Day-61.py | CodedLadiesInnovateTech/python-challenges | 22ce26c68fea6c7c243ada831e47c52e27a62127 | [
"MIT"
] | 11 | 2020-05-11T08:41:21.000Z | 2022-02-27T08:21:37.000Z | Phase-2/Search and Sorting/Day-61.py | CodedLadiesInnovateTech/python-challenges | 22ce26c68fea6c7c243ada831e47c52e27a62127 | [
"MIT"
] | 9 | 2020-05-12T10:46:06.000Z | 2020-05-28T17:37:19.000Z | Phase-2/Search and Sorting/Day-61.py | CodedLadiesInnovateTech/python-challenges | 22ce26c68fea6c7c243ada831e47c52e27a62127 | [
"MIT"
] | 44 | 2020-05-10T20:53:32.000Z | 2021-04-25T18:47:08.000Z | '''
1. Write a Python program for binary search.
Binary Search : In computer science, a binary search or half-interval search algorithm finds the position of a target value within a sorted array. The binary search algorithm can be classified as a dichotomies divide-and-conquer search algorithm and executes in logarithmic time.
Test Data :
binary_search([1,2,3,5,8], 6) -> False
binary_search([1,2,3,5,8], 5) -> True
2. Write a Python program for sequential search.
Sequential Search : In computer science, linear search or sequential search is a method for finding a particular value in a list that checks each element in sequence until the desired element is found or the list is exhausted. The list need not be ordered.
Test Data :
Sequential_Search([11,23,58,31,56,77,43,12,65,19],31) -> (True, 3)
3. Write a Python program for binary search for an ordered list.
Test Data :
Ordered_binary_Search([0, 1, 3, 8, 14, 18, 19, 34, 52], 3) -> True
Ordered_binary_Search([0, 1, 3, 8, 14, 18, 19, 34, 52], 17) -> False
'''
| 53.842105 | 279 | 0.743891 | 183 | 1,023 | 4.120219 | 0.437158 | 0.143236 | 0.047745 | 0.075597 | 0.251989 | 0.222812 | 0.222812 | 0.087533 | 0.087533 | 0.087533 | 0 | 0.08042 | 0.16129 | 1,023 | 18 | 280 | 56.833333 | 0.798368 | 0.990225 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
23d84b2d34bbbc2176e4c7ec2ba7b86aae6b2cd9 | 585 | py | Python | app/database.py | techouse/sloleks-parser | f95d9e3f647b1e0be7abcaad5ba48156a4b4a490 | [
"MIT"
] | null | null | null | app/database.py | techouse/sloleks-parser | f95d9e3f647b1e0be7abcaad5ba48156a4b4a490 | [
"MIT"
] | null | null | null | app/database.py | techouse/sloleks-parser | f95d9e3f647b1e0be7abcaad5ba48156a4b4a490 | [
"MIT"
] | null | null | null | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy_utils import database_exists
from . import Config
from .models import Base
class Database:
engine = None
Session = None
def __init__(self):
self.Session = sessionmaker()
self.engine = create_engine(Config.SQLALCHEMY_DATABASE_URI)
if not database_exists(Config.SQLALCHEMY_DATABASE_URI):
self._create_db_tables()
self.Session.configure(bind=self.engine)
def _create_db_tables(self):
Base.metadata.create_all(self.engine)
| 26.590909 | 67 | 0.733333 | 72 | 585 | 5.680556 | 0.388889 | 0.102689 | 0.117359 | 0.132029 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 585 | 21 | 68 | 27.857143 | 0.873932 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.3125 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
23dbc5a9f3e204efe3b9afdfabd9ece8c728ad2b | 304 | py | Python | src/SimplexMethodLPPSolver/osCommands.py | Arunesh-Gour/SimplexMethod_LPPSolver-Python | 81037f062289e7bd5e4bd187671d1287ce6910c8 | [
"MIT"
] | null | null | null | src/SimplexMethodLPPSolver/osCommands.py | Arunesh-Gour/SimplexMethod_LPPSolver-Python | 81037f062289e7bd5e4bd187671d1287ce6910c8 | [
"MIT"
] | null | null | null | src/SimplexMethodLPPSolver/osCommands.py | Arunesh-Gour/SimplexMethod_LPPSolver-Python | 81037f062289e7bd5e4bd187671d1287ce6910c8 | [
"MIT"
] | null | null | null | import os
class OSCommands:
OS = None
CLEAR = None
if (os.path.sep == '/'):
OSCommands.OS = 'Linux'
OSCommands.CLEAR = lambda: os.system('clear')
elif (os.path.sep == '\\'):
OSCommands.OS = 'Windows'
OSCommands.CLEAR = lambda: os.system('cls')
__all__ = [
'OSCommands',
]
| 16 | 48 | 0.595395 | 36 | 304 | 4.916667 | 0.444444 | 0.20339 | 0.101695 | 0.214689 | 0.564972 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.226974 | 304 | 18 | 49 | 16.888889 | 0.753191 | 0 | 0 | 0 | 0 | 0 | 0.108553 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.076923 | 0 | 0.307692 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
23e1e63db6eb7c9af9e112b9096fd59125d60b1f | 271 | py | Python | tmfeedback/evaluations/forms.py | Andrew-Whitaker/tm-feedback | dd9bc3cc3427fef6e6c06add4ade77def6a6f7ac | [
"MIT"
] | null | null | null | tmfeedback/evaluations/forms.py | Andrew-Whitaker/tm-feedback | dd9bc3cc3427fef6e6c06add4ade77def6a6f7ac | [
"MIT"
] | 6 | 2020-07-19T14:35:09.000Z | 2021-09-22T19:27:33.000Z | tmfeedback/evaluations/forms.py | Andrew-Whitaker/tm-feedback | dd9bc3cc3427fef6e6c06add4ade77def6a6f7ac | [
"MIT"
] | null | null | null | from django import forms
from django.forms.widgets import SelectDateWidget
from .models import Evaluation
class EvalCreationForm(forms.ModelForm):
class Meta:
model = Evaluation
fields = ['you_excelled_at', 'to_work_on', 'challenge_yourself_by']
| 20.846154 | 75 | 0.745387 | 32 | 271 | 6.125 | 0.71875 | 0.102041 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180812 | 271 | 12 | 76 | 22.583333 | 0.882883 | 0 | 0 | 0 | 0 | 0 | 0.17037 | 0.077778 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
23e7864a1b5936612b077d4e86cb6a3a2a411bf7 | 5,337 | py | Python | controller.py | JoshMayberry/Communication_API | 7c0c2232f60f48ba3b247b320df3ce4dcc15a53a | [
"MIT"
] | null | null | null | controller.py | JoshMayberry/Communication_API | 7c0c2232f60f48ba3b247b320df3ce4dcc15a53a | [
"MIT"
] | null | null | null | controller.py | JoshMayberry/Communication_API | 7c0c2232f60f48ba3b247b320df3ce4dcc15a53a | [
"MIT"
] | null | null | null | __version__ = "1.1.1"
#Import standard elements
import re
import os
import sys
import warnings
import traceback
import threading
import subprocess
# #Import communication elements for talking to other devices such as printers, the internet, a raspberry pi, etc.
import usb
import types
import bisect
import select
import socket
import serial
import netaddr
import serial.tools.list_ports
# #Import barcode modules for drawing and decoding barcodes
import qrcode
import barcode
# #Import email modules for sending and viewing emails
import smtplib
import xml.etree.cElementTree as xml
from email import encoders as email_encoders
from email.mime.base import MIMEBase as email_MIMEBase
from email.mime.text import MIMEText as email_MIMEText
from email.mime.image import MIMEImage as email_MIMEImage
from email.mime.multipart import MIMEMultipart as email_MIMEMultipart
import io
import wx
import glob
import PIL
import base64
import zipfile
import collections
import API_Database as Database
import MyUtilities.common
import MyUtilities.threadManager
#Required Modules
##py -m pip install
# pyusb
# qrcode
# netaddr
# pyserial
# pyBarcode
##Module dependancies (Install the following .exe and/or .dll files)
#The latest Windows binary on "https://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.21/libusb-1.0.21.7z/download"
#If on 64-bit Windows, copy "MS64\dll\libusb-1.0.dll" into "C:\windows\system32"
#If on 32-bit windows, copy "MS32\dll\libusb-1.0.dll" into "C:\windows\SysWOW64"
#User Access Variables
ethernetError = socket.error
class CommunicationManager():
"""Helps the user to communicate with other devices.
CURRENTLY SUPPORTED METHODS
- COM Port
- Ethernet & Wi-fi
- Barcode
- QR Code
- USB
- Email
UPCOMING SUPPORTED METHODS
- Raspberry Pi GPIO
Example Input: Communication()
"""
def __init__(self):
"""Initialized internal variables."""
self.ethernet = Ethernet(self)
self.barcode = Barcode(self)
self.comPort = ComPort(self)
self.email = Email(self)
self.usb = USB(self)
def __str__(self):
"""Gives diagnostic information on the GUI when it is printed out."""
output = f"Communication()\n-- id: {id(self)}\n"
output += f"-- Ethernets: {len(self.ethernet)}\n"
output += f"-- COM Ports: {len(self.comPort)}\n"
output += f"-- USB Ports: {len(self.usb)}\n"
output += f"-- Barcodes: {len(self.barcode)}\n"
output += f"-- Email Accounts: {len(self.email)}\n"
return output
def __repr__(self):
representation = f"Communication(id = {id(self)})"
return representation
def getAll(self):
"""Returns all available communication types.
Example Input: getAll()
"""
return [self.ethernet, self.comPort, self.usb, self.barcode, self.email]
rootManager = CommunicationManager()
def getEthernet(label = None, *, comManager = None):
"""Returns an ethernet handle with the given label. If it does not exist, it will make one.
label (str) - What ethernet to get
- If None: Will make a new ethernet port
Example Input: getEthernet()
Example Input: getEthernet(1)
"""
global rootManager
comManager = MyUtilities.common.ensure_default(comManager, default = rootManager)
return comManager.ethernet.add(label = label)
def getCom(label = None, *, comManager = None):
"""Returns a com port handle with the given label. If it does not exist, it will make one.
label (str) - What com port to get
- If None: Will make a new com port
Example Input: getCom()
Example Input: getCom(1)
"""
global rootManager
comManager = MyUtilities.common.ensure_default(comManager, default = rootManager)
return comManager.comPort.add(label = label)
def getUsb(label = None, *, comManager = None):
"""Returns a usb handle with the given label. If it does not exist, it will make one.
label (str) - What usb to get
- If None: Will make a new usb port
Example Input: getusb()
Example Input: getusb(1)
"""
global rootManager
comManager = MyUtilities.common.ensure_default(comManager, default = rootManager)
return comManager.usb.add(label = label)
def getBarcode(label = None, *, comManager = None):
"""Returns a barcode handle with the given label. If it does not exist, it will make one.
label (str) - What barcode to get
- If None: Will make a new barcode port
Example Input: getBarcode()
Example Input: getBarcode(1)
"""
global rootManager
comManager = MyUtilities.common.ensure_default(comManager, default = rootManager)
return comManager.barcode.add(label = label)
def getEmail(label = None, *, comManager = None):
"""Returns an email handle with the given label. If it does not exist, it will make one.
label (str) - What email to get
- If None: Will make a new email port
Example Input: getEmail()
Example Input: getEmail(1)
"""
global rootManager
comManager = MyUtilities.common.ensure_default(comManager, default = rootManager)
return comManager.email.add(label = label)
# def runFile():
if __name__ == '__main__':
# print(getEthernet())
# for item in rootManager.comPort.getAll():
# print(item["vendorId"], item["productId"])
# import time
# import subprocess
# subprocess.Popen(["py", "maintenance.py"]) #https://docs.python.org/2/library/os.html#os.startfile
# print("@1.2")
# time.sleep(1)
# print("@1.3")
# sys.exit()
print("Starting")
getEmail().test()
| 26.034146 | 129 | 0.732809 | 745 | 5,337 | 5.201342 | 0.289933 | 0.037161 | 0.010323 | 0.029677 | 0.297806 | 0.297806 | 0.25729 | 0.25729 | 0.214194 | 0.214194 | 0 | 0.009592 | 0.160015 | 5,337 | 204 | 130 | 26.161765 | 0.854785 | 0.476298 | 0 | 0.125 | 0 | 0 | 0.094806 | 0.023247 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1125 | false | 0 | 0.425 | 0 | 0.65 | 0.0125 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
23e9179d21cf0e5098ce184fc979418d2a2f439e | 1,941 | py | Python | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/mcl/os/__init__.py | bidhata/EquationGroupLeaks | 1ff4bc115cb2bd5bf2ed6bf769af44392926830c | [
"Unlicense"
] | 9 | 2019-11-22T04:58:40.000Z | 2022-02-26T16:47:28.000Z | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/mcl/os/__init__.py | bidhata/EquationGroupLeaks | 1ff4bc115cb2bd5bf2ed6bf769af44392926830c | [
"Unlicense"
] | null | null | null | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/mcl/os/__init__.py | bidhata/EquationGroupLeaks | 1ff4bc115cb2bd5bf2ed6bf769af44392926830c | [
"Unlicense"
] | 8 | 2017-09-27T10:31:18.000Z | 2022-01-08T10:30:46.000Z | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: __init__.py
MCL_OS_ARCH_I386 = 0
MCL_OS_ARCH_SPARC = 1
MCL_OS_ARCH_ALPHA = 2
MCL_OS_ARCH_ARM = 3
MCL_OS_ARCH_PPC = 4
MCL_OS_ARCH_HPPA1 = 5
MCL_OS_ARCH_HPPA2 = 6
MCL_OS_ARCH_MIPS = 7
MCL_OS_ARCH_X64 = 8
MCL_OS_ARCH_IA64 = 9
MCL_OS_ARCH_SPARC64 = 10
MCL_OS_ARCH_MIPS64 = 11
MCL_OS_ARCH_UNKNOWN = 65535
archNames = {MCL_OS_ARCH_I386: 'i386',
MCL_OS_ARCH_SPARC: 'sparc',
MCL_OS_ARCH_ALPHA: 'alpha',
MCL_OS_ARCH_ARM: 'arm',
MCL_OS_ARCH_PPC: 'ppc',
MCL_OS_ARCH_HPPA1: 'hppa1',
MCL_OS_ARCH_HPPA2: 'hppa2',
MCL_OS_ARCH_MIPS: 'mips',
MCL_OS_ARCH_X64: 'x64',
MCL_OS_ARCH_IA64: 'ia64',
MCL_OS_ARCH_SPARC64: 'sparc64',
MCL_OS_ARCH_MIPS64: 'mips64',
MCL_OS_ARCH_UNKNOWN: 'unknown'
}
MCL_OS_WIN9X = 0
MCL_OS_WINNT = 1
MCL_OS_LINUX = 2
MCL_OS_SOLARIS = 3
MCL_OS_SUNOS = 4
MCL_OS_AIX = 5
MCL_OS_BSDI = 6
MCL_OS_DEC = 7
MCL_OS_FREEBSD = 8
MCL_OS_IRIX = 9
MCL_OS_HPUX = 10
MCL_OS_MIRAPOINT = 11
MCL_OS_OPENBSD = 12
MCL_OS_SCO = 13
MCL_OS_SELINUX = 14
MCL_OS_DARWIN = 15
MCL_OS_VXWORKS = 16
MCL_OS_PSOS = 17
MCL_OS_WINMOBILE = 18
MCL_OS_IPHONE = 19
MCL_OS_JUNOS = 20
MCL_OS_ANDROID = 21
MCL_OS_UNKNOWN = 65535
osNames = {MCL_OS_WIN9X: 'win9x',
MCL_OS_WINNT: 'winnt',
MCL_OS_LINUX: 'linux',
MCL_OS_SOLARIS: 'solaris',
MCL_OS_SUNOS: 'sunos',
MCL_OS_AIX: 'aix',
MCL_OS_BSDI: 'bsdi',
MCL_OS_DEC: 'tru64',
MCL_OS_FREEBSD: 'freebsd',
MCL_OS_IRIX: 'irix',
MCL_OS_HPUX: 'hpux',
MCL_OS_MIRAPOINT: 'mirapoint',
MCL_OS_OPENBSD: 'openbsd',
MCL_OS_SCO: 'sco',
MCL_OS_SELINUX: 'linux_se',
MCL_OS_DARWIN: 'darwin',
MCL_OS_VXWORKS: 'vxworks',
MCL_OS_PSOS: 'psos',
MCL_OS_WINMOBILE: 'winmobile',
MCL_OS_IPHONE: 'iphone',
MCL_OS_JUNOS: 'junos',
MCL_OS_ANDROID: 'android',
MCL_OS_UNKNOWN: 'unknown'
} | 24.56962 | 67 | 0.72643 | 350 | 1,941 | 3.528571 | 0.242857 | 0.291498 | 0.189474 | 0.021053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087091 | 0.165894 | 1,941 | 79 | 68 | 24.56962 | 0.675726 | 0.088614 | 0 | 0 | 0 | 0 | 0.10941 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 2 |
23f085b64045d7bee7ba31d13e1c8372f2a028c1 | 545 | py | Python | model_nltk/clf_nltk.py | caffeine110/music_mood_Analyser | 2069e7a60746a2e9ce96d23f2b616bcb45333079 | [
"MIT"
] | null | null | null | model_nltk/clf_nltk.py | caffeine110/music_mood_Analyser | 2069e7a60746a2e9ce96d23f2b616bcb45333079 | [
"MIT"
] | null | null | null | model_nltk/clf_nltk.py | caffeine110/music_mood_Analyser | 2069e7a60746a2e9ce96d23f2b616bcb45333079 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 21 18:42:20 2019
@author: gaurav
"""
import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
###############################################################################
#def for nltk Sentiment Analyser
def SentimentAnalyser(text_song):
SID = SentimentIntensityAnalyzer()
#s = 'madhur is a good boy'
#s = 'sam is bad boy'
#print(text_song)
score = SID.polarity_scores(text_song)
#print(score)
return score
| 18.793103 | 79 | 0.568807 | 61 | 545 | 5.016393 | 0.721311 | 0.078431 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031818 | 0.192661 | 545 | 28 | 80 | 19.464286 | 0.663636 | 0.368807 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
9b033425d72f02e81c145c857e209769dbffa283 | 756 | py | Python | components/year_range_slider.py | hknozturk/InfoVis | 63ad302ea0ebf8f294f9aa6b194ec6d48aa8974a | [
"Apache-2.0"
] | null | null | null | components/year_range_slider.py | hknozturk/InfoVis | 63ad302ea0ebf8f294f9aa6b194ec6d48aa8974a | [
"Apache-2.0"
] | null | null | null | components/year_range_slider.py | hknozturk/InfoVis | 63ad302ea0ebf8f294f9aa6b194ec6d48aa8974a | [
"Apache-2.0"
] | null | null | null | import dash_core_components as dcc
import dash_html_components as html
class YearRangeSlider:
def __init__(self, data_processing):
self.data = data_processing
def year_slider(self):
return html.Div([
dcc.RangeSlider(
id='year-range-slider',
min=self.data.accident_df['YEAR'].min(),
max=self.data.accident_df['YEAR'].max(),
value=[self.data.accident_df['YEAR'].min(),
self.data.accident_df['YEAR'].max()],
marks={str(year): str(year)
for year in self.data.accident_df['YEAR'].unique()},
step=None
)
], style={'marginRight': '10px', 'marginLeft': '10px'})
| 32.869565 | 75 | 0.544974 | 84 | 756 | 4.714286 | 0.440476 | 0.141414 | 0.20202 | 0.227273 | 0.315657 | 0.260101 | 0 | 0 | 0 | 0 | 0 | 0.007767 | 0.318783 | 756 | 22 | 76 | 34.363636 | 0.761165 | 0 | 0 | 0 | 0 | 0 | 0.087302 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0.055556 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
9b03505af739f51411d4fa4a09dde3894edda383 | 1,270 | py | Python | ansible/roles/upload-users/files/load-users.py | CSIRT-MU/fimetis | ed91ce42cca725885f22a0818a33415201a8a1f8 | [
"MIT"
] | 6 | 2021-03-12T08:55:50.000Z | 2021-12-13T16:48:48.000Z | ansible/roles/upload-users/files/load-users.py | CSIRT-MU/fimetis | ed91ce42cca725885f22a0818a33415201a8a1f8 | [
"MIT"
] | null | null | null | ansible/roles/upload-users/files/load-users.py | CSIRT-MU/fimetis | ed91ce42cca725885f22a0818a33415201a8a1f8 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
import os
from werkzeug.security import generate_password_hash
def main():
parser = argparse.ArgumentParser(description="loader of users to elastic")
parser.add_argument('--file', required=True, help="Input file with users infos")
parser.add_argument('--host', required=True, help="Elastic host address with port, like localhost:9200")
args = parser.parse_args()
users = open(args.file, 'r').read().split("\n")
for line in users:
if line == '':
break
if line.startswith('#'):
continue
user_splitted = line.split(":")
username = user_splitted[0]
password = user_splitted[1]
groups = ''
groups_splitted = user_splitted[2].split(',')
for group in user_splitted[2].split(','):
groups = groups + '"' + group + '"' +','
groups = groups[:-1]
groups = '[' + groups + ']'
body = '{"username": "' + username + '", "password": "' + generate_password_hash(password) + '", "groups": ' + groups + '}'
os.system('curl -XPOST {0}/user/data/ -H "Content-Type: application/json" -d \'{1}\''.format(args.host, body))
if __name__ == '__main__':
main()
| 28.863636 | 131 | 0.57874 | 142 | 1,270 | 5.028169 | 0.514085 | 0.084034 | 0.056022 | 0.05042 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012712 | 0.256693 | 1,270 | 43 | 132 | 29.534884 | 0.743644 | 0.016535 | 0 | 0 | 1 | 0.037037 | 0.197917 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.037037 | false | 0.111111 | 0.111111 | 0 | 0.148148 | 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 | 0 | 0 | 0 | 2 |
9b0d2bfc2ce057567ae956f1b0c0725c38260c52 | 2,197 | py | Python | processing/labeled_file_container.py | ssbgp/data-tools | ec8caf5831eae6a35fd95bb2fb86cf77434bf4d9 | [
"MIT"
] | null | null | null | processing/labeled_file_container.py | ssbgp/data-tools | ec8caf5831eae6a35fd95bb2fb86cf77434bf4d9 | [
"MIT"
] | null | null | null | processing/labeled_file_container.py | ssbgp/data-tools | ec8caf5831eae6a35fd95bb2fb86cf77434bf4d9 | [
"MIT"
] | null | null | null | from pathlib import Path
from typing import Dict, Iterator, Tuple
from processing.directory import Directory
from processing.file_container import FileContainer
from processing.types import Label
class LabeledFileContainer(FileContainer):
"""
This is a file container that aggregates multiple containers, associating each container with
a label. It provides methods to access each container by its label.
"""
def __init__(self, containers: Dict[Label, FileContainer]) -> None:
self._containers: Dict[Label, FileContainer] = containers
def __iter__(self) -> Iterator[Path]:
""" Returns iterator to iterate over each file in this container """
def iterator() -> Iterator[Path]:
for container in self._containers.values():
for file in container:
yield file
return iterator()
def iter_by_label(self) -> Iterator[Tuple[Label, Path]]:
""" Returns iterator to iterate over each file and its corresponding label """
def iterator() -> Iterator[Tuple[Label, Path]]:
for label, container in self._containers.items():
for file in container:
yield label, file
return iterator()
def glob(self, pattern: str) -> Iterator[Path]:
""" Returns iterator to iterate over each file matching the given *pattern* """
def iterator() -> Iterator[Path]:
for container in self._containers.values():
for file in container.glob(pattern):
yield file
return iterator()
def glob_by_label(self, pattern: str) -> Iterator[Tuple[Label, Path]]:
"""
Returns iterator to iterate over each file matching the given *pattern* and its
corresponding label
"""
def iterator() -> Iterator[Tuple[Label, Path]]:
for label, container in self._containers.items():
for file in container.glob(pattern):
yield label, file
return iterator()
def __str__(self) -> str:
return str(self._containers)
def __repr__(self) -> str:
return repr(self._containers)
| 33.287879 | 97 | 0.63086 | 247 | 2,197 | 5.497976 | 0.230769 | 0.082474 | 0.055965 | 0.061856 | 0.62592 | 0.532401 | 0.490427 | 0.466863 | 0.466863 | 0.425626 | 0 | 0 | 0.282203 | 2,197 | 65 | 98 | 33.8 | 0.861129 | 0.212563 | 0 | 0.555556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.305556 | false | 0 | 0.138889 | 0.055556 | 0.638889 | 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 | 0 | 1 | 0 | 0 | 2 |
9b1f8d038fad50afafff8bbda7c0e8d152639509 | 1,218 | py | Python | 103-binary tree zigzag level order traversal/main.py | ytong82/leetcode | 34e08c430d654b14b1608211f74702f57e507189 | [
"Apache-2.0"
] | null | null | null | 103-binary tree zigzag level order traversal/main.py | ytong82/leetcode | 34e08c430d654b14b1608211f74702f57e507189 | [
"Apache-2.0"
] | null | null | null | 103-binary tree zigzag level order traversal/main.py | ytong82/leetcode | 34e08c430d654b14b1608211f74702f57e507189 | [
"Apache-2.0"
] | null | null | null | class Solution:
def zigzagLevelOrder(self, root):
if root is None:
return []
res = []
res.append([root.val])
queue = []
queue.append(root)
level_nodes = []
level_node_count = 1
next_level_node_count = 0
left_to_right = True
while len(queue) > 0:
node = queue.pop(0)
level_node_count -= 1
if node.left is not None:
level_nodes.append(node.left.val)
queue.append(node.left)
next_level_node_count += 1
if node.right is not None:
queue.append(node.right)
level_nodes.append(node.right.val)
next_level_node_count += 1
if len(level_nodes) > 0:
if level_node_count == 0:
left_to_right = not left_to_right
if left_to_right:
res.append(level_nodes)
else:
res.append(level_nodes[::-1])
level_nodes = []
level_node_count = next_level_node_count
next_level_node_count = 0
return res | 32.052632 | 60 | 0.485222 | 136 | 1,218 | 4.066176 | 0.220588 | 0.146474 | 0.227848 | 0.162749 | 0.37613 | 0.305606 | 0.184448 | 0 | 0 | 0 | 0 | 0.016129 | 0.440066 | 1,218 | 38 | 61 | 32.052632 | 0.794721 | 0 | 0 | 0.176471 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.029412 | false | 0 | 0 | 0 | 0.117647 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9b231c3443bdeb886d3c6e4c7bdd22eb8c8caec1 | 1,511 | py | Python | db/insert_data.py | abkds/open-street-map-data | cb3defeaaba35a17f6de96c28e1fe24ad1d67e0f | [
"CC-BY-4.0"
] | null | null | null | db/insert_data.py | abkds/open-street-map-data | cb3defeaaba35a17f6de96c28e1fe24ad1d67e0f | [
"CC-BY-4.0"
] | null | null | null | db/insert_data.py | abkds/open-street-map-data | cb3defeaaba35a17f6de96c28e1fe24ad1d67e0f | [
"CC-BY-4.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: insert_data.py
---------------------------
This script creates a connection to a postgresql database and
inserts the data from csv generated into the approriate tables.
"""
import os
import psycopg2
import sys
NODES_PATH = os.path.join(os.path.dirname(__file__), os.pardir, 'data', 'nodes.csv')
NODE_TAGS_PATH = os.path.join(os.path.dirname(__file__), os.pardir, 'data', 'node_tags.csv')
WAYS_PATH = os.path.join(os.path.dirname(__file__), os.pardir, 'data', 'ways.csv')
WAY_NODES_PATH = os.path.join(os.path.dirname(__file__), os.pardir, 'data', 'way_nodes.csv')
WAY_TAGS_PATH = os.path.join(os.path.dirname(__file__), os.pardir, 'data', 'way_tags.csv')
file_table_tuples = [
(NODES_PATH, 'nodes'),
(NODE_TAGS_PATH, 'node_tags'),
(WAYS_PATH, 'ways'),
(WAY_NODES_PATH, 'way_nodes'),
(WAY_TAGS_PATH, 'way_tags')
]
try:
# Connection to an exisiting database
con = psycopg2.connect("dbname=osm_playground user=abkds")
# Open a cursor to perform db operations
cur = con.cursor()
# Copy csv data to respective tables
for file_table in file_table_tuples:
with open(file_table[0]) as f:
sql_copy = "COPY %s FROM STDIN WITH (FORMAT CSV, HEADER, QUOTE '\"')" % (file_table[1])
cur.copy_expert(sql_copy, f)
con.commit()
except psycopg2.DatabaseError, e:
if con:
con.rollback()
print "Error %s" % e
sys.exit(1)
finally:
if con:
con.close()
| 26.508772 | 99 | 0.659166 | 223 | 1,511 | 4.224215 | 0.38565 | 0.063694 | 0.053079 | 0.07431 | 0.253716 | 0.253716 | 0.253716 | 0.253716 | 0.253716 | 0.253716 | 0 | 0.005677 | 0.183984 | 1,511 | 56 | 100 | 26.982143 | 0.758313 | 0.100596 | 0 | 0.064516 | 1 | 0 | 0.173356 | 0.017933 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.096774 | null | null | 0.032258 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f19b3e27d05c0b9881fddcd84a31d9a377500662 | 493 | py | Python | internews_web/translations/models.py | AlexeyMegley/internews | 07fa01a257c89ae39b5e4f77b2cb0b7284311e81 | [
"MIT"
] | null | null | null | internews_web/translations/models.py | AlexeyMegley/internews | 07fa01a257c89ae39b5e4f77b2cb0b7284311e81 | [
"MIT"
] | 5 | 2020-07-05T19:35:24.000Z | 2021-09-22T19:16:45.000Z | internews_web/translations/models.py | AlexeyMegley/internews | 07fa01a257c89ae39b5e4f77b2cb0b7284311e81 | [
"MIT"
] | 3 | 2020-09-25T18:17:41.000Z | 2020-09-30T19:27:10.000Z | from django.db import models
class Language(models.Model):
name = models.CharField(max_length=50, unique=True)
code = models.CharField(max_length=3, unique=True)
def __str__(self):
return self.name
class TranslatedHeader(models.Model):
text = models.TextField(unique=True)
language = models.ForeignKey(Language, on_delete=models.CASCADE)
translations = models.ManyToManyField("self")
def __str__(self):
return f"{self.text} ({self.language})"
| 25.947368 | 68 | 0.709939 | 61 | 493 | 5.557377 | 0.508197 | 0.088496 | 0.106195 | 0.141593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007353 | 0.172414 | 493 | 18 | 69 | 27.388889 | 0.823529 | 0 | 0 | 0.166667 | 0 | 0 | 0.066937 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.083333 | 0.166667 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
f19e15f196dbad155b4e628525bfbd04e2e29ba2 | 2,639 | py | Python | tests/test_to_lower.py | ohmin839/pyplgr | b560d12b497f40c9de3785d59d40db5ea004771a | [
"MIT"
] | null | null | null | tests/test_to_lower.py | ohmin839/pyplgr | b560d12b497f40c9de3785d59d40db5ea004771a | [
"MIT"
] | null | null | null | tests/test_to_lower.py | ohmin839/pyplgr | b560d12b497f40c9de3785d59d40db5ea004771a | [
"MIT"
] | null | null | null | import unittest
from parameterized import parameterized
from pyplgr.plgrcoll.api import to_lower
class ToLowerTest(unittest.TestCase):
@parameterized.expand([
["Β", "β"],
["Γ", "γ"],
["Δ", "δ"],
["Ζ", "ζ"],
["Θ", "θ"],
["Κ", "κ"],
["Λ", "λ"],
["Μ", "μ"],
["Ν", "ν"],
["Ξ", "ξ"],
["Π", "π"],
["Σ", "σ"],
["Τ", "τ"],
["Φ", "φ"],
["Χ", "χ"],
["Ψ", "ψ"],
["Α", "α"],
["ᾼ", "ᾳ"],
["Ά", "ά"],
["Ὰ", "ὰ"],
["Ἁ", "ἁ"],
["ᾉ", "ᾁ"],
["Ἅ", "ἅ"],
["ᾍ", "ᾅ"],
["Ἃ", "ἃ"],
["ᾋ", "ᾃ"],
["Ἇ", "ἇ"],
["ᾏ", "ᾇ"],
["Ἀ", "ἀ"],
["ᾈ", "ᾀ"],
["Ἄ", "ἄ"],
["ᾌ", "ᾄ"],
["Ἂ", "ἂ"],
["ᾊ", "ᾂ"],
["Ἆ", "ἆ"],
["ᾎ", "ᾆ"],
["Ε", "ε"],
["Έ", "έ"],
["Ὲ", "ὲ"],
["Ἑ", "ἑ"],
["Ἕ", "ἕ"],
["Ἓ", "ἓ"],
["Ἐ", "ἐ"],
["Ἔ", "ἔ"],
["Ἒ", "ἒ"],
["Η", "η"],
["ῌ", "ῃ"],
["Ή", "ή"],
["Ὴ", "ῄ"],
["Ἡ", "ὴ"],
["ᾙ", "ῂ"],
["Ἥ", "ἥ"],
["ᾝ", "ᾕ"],
["Ἣ", "ἣ"],
["ᾛ", "ᾓ"],
["Ἧ", "ἧ"],
["ᾟ", "ᾗ"],
["Ἠ", "ἠ"],
["ᾘ", "ᾐ"],
["Ἤ", "ἤ"],
["ᾜ", "ᾔ"],
["Ἢ", "ἢ"],
["ᾚ", "ᾒ"],
["Ἦ", "ἦ"],
["ᾞ", "ᾖ"],
["Ι", "ι"],
["Ί", "ί"],
["Ὶ", "ὶ"],
["Ἱ", "ἱ"],
["Ἵ", "ἵ"],
["Ἳ", "ἳ"],
["Ἷ", "ἷ"],
["Ἰ", "ἰ"],
["Ἴ", "ἴ"],
["Ἲ", "ἲ"],
["Ἶ", "ἶ"],
["Ο", "ο"],
["Ό", "ό"],
["Ὸ", "ὸ"],
["Ὁ", "ὁ"],
["Ὅ", "ὅ"],
["Ὃ", "ὃ"],
["Ὀ", "ὀ"],
["Ὄ", "ὄ"],
["Ὂ", "ὂ"],
["Ρ", "ρ"],
["Ῥ", "ῥ"],
["Υ", "υ"],
["Ύ", "ύ"],
["Ὺ", "ὺ"],
["Ὑ", "ὑ"],
["Ὕ", "ὕ"],
["Ὓ", "ὓ"],
["Ὗ", "ὗ"],
["Ω", "ω"],
["ῼ", "ῳ"],
["Ώ", "ώ"],
["Ὼ", "ὼ"],
["Ὡ", "ὡ"],
["ᾩ", "ᾡ"],
["Ὥ", "ὥ"],
["ᾭ", "ᾥ"],
["Ὣ", "ὣ"],
["ᾫ", "ᾣ"],
["Ὧ", "ὧ"],
["ᾯ", "ᾧ"],
["Ὠ", "ὠ"],
["ᾨ", "ᾠ"],
["Ὤ", "ὤ"],
["ᾬ", "ᾤ"],
["Ὢ", "ὢ"],
["ᾪ", "ᾢ"],
["Ὦ", "ὦ"],
["ᾮ", "ᾦ"],
["0", "0"],
])
def test_to_lower(self, text, expected):
actual = to_lower(text)
self.assertEqual(expected, actual)
if __name__ == '__main__':
unittest.main()
| 20.457364 | 44 | 0.179992 | 269 | 2,639 | 1.72119 | 0.520446 | 0.045356 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001402 | 0.459265 | 2,639 | 128 | 45 | 20.617188 | 0.323055 | 0 | 0 | 0 | 0 | 0 | 0.090186 | 0 | 0 | 0 | 0 | 0 | 0.007937 | 1 | 0.007937 | false | 0 | 0.02381 | 0 | 0.039683 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f1a46a8cd11bbc2e117b227e29e1c7738924dbb9 | 553 | py | Python | snorkel/slicing/apply/dask.py | melonwater211/snorkel | c5d00629e087130d1946bb6a85c58827790af425 | [
"Apache-2.0"
] | 2,906 | 2016-07-12T11:11:21.000Z | 2019-08-12T20:38:19.000Z | snorkel/slicing/apply/dask.py | melonwater211/snorkel | c5d00629e087130d1946bb6a85c58827790af425 | [
"Apache-2.0"
] | 1,080 | 2016-07-12T21:07:22.000Z | 2019-08-12T19:33:54.000Z | snorkel/slicing/apply/dask.py | melonwater211/snorkel | c5d00629e087130d1946bb6a85c58827790af425 | [
"Apache-2.0"
] | 609 | 2016-07-13T16:03:55.000Z | 2019-08-08T17:47:54.000Z | from snorkel.labeling.apply.dask import ( # pragma: no cover
DaskLFApplier,
PandasParallelLFApplier,
)
class DaskSFApplier(DaskLFApplier): # pragma: no cover
"""SF applier for a Dask DataFrame.
See ``snorkel.labeling.apply.dask.DaskLFApplier`` for details.
"""
_use_recarray = True
class PandasParallelSFApplier(PandasParallelLFApplier): # pragma: no cover
"""Parallel SF applier for a Pandas DataFrame.
See ``snorkel.labeling.apply.dask.PandasParallelLFApplier`` for details.
"""
_use_recarray = True
| 24.043478 | 76 | 0.717902 | 58 | 553 | 6.775862 | 0.448276 | 0.114504 | 0.152672 | 0.183206 | 0.310433 | 0.183206 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186257 | 553 | 22 | 77 | 25.136364 | 0.873333 | 0.481013 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.625 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
f1a6cac968f5262bc3a7cca8426fa2e3f5565d3e | 358 | py | Python | user_model/user_model/routes.py | rwisecar/user_model_gist | ca9ecd51901cf711c83c1d2f28ecf3b03318014f | [
"MIT"
] | null | null | null | user_model/user_model/routes.py | rwisecar/user_model_gist | ca9ecd51901cf711c83c1d2f28ecf3b03318014f | [
"MIT"
] | null | null | null | user_model/user_model/routes.py | rwisecar/user_model_gist | ca9ecd51901cf711c83c1d2f28ecf3b03318014f | [
"MIT"
] | null | null | null | """Adding routes for the configuration to find."""
def includeme(config):
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('list', '/')
config.add_route('profile', '/profile/{id:\d+}')
config.add_route('login', '/login')
config.add_route('logout', '/logout')
config.add_route('register', '/register')
| 32.545455 | 66 | 0.667598 | 46 | 358 | 5 | 0.543478 | 0.234783 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012903 | 0.134078 | 358 | 10 | 67 | 35.8 | 0.729032 | 0.122905 | 0 | 0 | 0 | 0 | 0.266234 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f1ac5962eb92e6843518d01b11f99d850c336e31 | 952 | py | Python | CollegeDespamifierAPI/CollegeApp/models.py | AlexanderZhou39/gmail-filter-backend | 1fe6613f64f441be52ee1f63f737cfdac50f48ae | [
"MIT"
] | null | null | null | CollegeDespamifierAPI/CollegeApp/models.py | AlexanderZhou39/gmail-filter-backend | 1fe6613f64f441be52ee1f63f737cfdac50f48ae | [
"MIT"
] | null | null | null | CollegeDespamifierAPI/CollegeApp/models.py | AlexanderZhou39/gmail-filter-backend | 1fe6613f64f441be52ee1f63f737cfdac50f48ae | [
"MIT"
] | 1 | 2021-10-20T23:59:59.000Z | 2021-10-20T23:59:59.000Z | from django.db import models
from decimal import Decimal
# Create your models here.
class College(models.Model):
name = models.CharField(max_length=255, default='')
slug = models.CharField(max_length=255, default='')
acceptance = models.DecimalField(max_digits=3, decimal_places=2, default=0.00)
city = models.CharField(max_length=255, default='')
state = models.CharField(max_length=255, default='')
grad_rate = models.DecimalField(max_digits=4, decimal_places=2, default=0.00)
desirability = models.IntegerField(default=0)
influence = models.IntegerField(default=0)
overall_rank = models.IntegerField(default=0)
sat = models.IntegerField(default=0)
act = models.IntegerField(default=0)
undergrad_student_body = models.IntegerField(default=0)
tuition = models.IntegerField(default=0)
domain = models.CharField(max_length=255, default='')
def __str__(self):
return self.name | 43.272727 | 82 | 0.728992 | 121 | 952 | 5.595041 | 0.396694 | 0.106352 | 0.258493 | 0.268833 | 0.322009 | 0.322009 | 0 | 0 | 0 | 0 | 0 | 0.039752 | 0.154412 | 952 | 22 | 83 | 43.272727 | 0.801242 | 0.02521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.105263 | 0.052632 | 1 | 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 | 0 | 0 | 0 | 2 |
f1eb9fad09acf44e8e56c842804f90e842dafac6 | 423 | py | Python | learn-python/variable/dictionary/key_value.py | Moazzam125/learn-python | a0a92a5f4d1a031d0f66a7d10682c1844b1da80d | [
"MIT"
] | 2 | 2020-12-25T06:42:13.000Z | 2020-12-25T10:25:55.000Z | learn-python/variable/dictionary/key_value.py | Moazzam125/learn-python | a0a92a5f4d1a031d0f66a7d10682c1844b1da80d | [
"MIT"
] | null | null | null | learn-python/variable/dictionary/key_value.py | Moazzam125/learn-python | a0a92a5f4d1a031d0f66a7d10682c1844b1da80d | [
"MIT"
] | 2 | 2021-12-27T06:15:40.000Z | 2022-01-05T15:08:29.000Z | ''' key-value methods in dictionary '''
# Keys
key_dictionary = {
'sector': 'Keys method',
'variable': 'dictionary'
}
print(key_dictionary.keys())
# Values
value_dictionary = {
'sector': 'Values method',
'variable': 'dictionary'
}
print(value_dictionary.values())
# Key-value
key_value_dictionary = {
'sector': 'key-value method',
'variable': 'dictionary'
}
print(key_value_dictionary.items()) | 16.92 | 39 | 0.669031 | 45 | 423 | 6.111111 | 0.266667 | 0.145455 | 0.261818 | 0.316364 | 0.232727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167849 | 423 | 25 | 40 | 16.92 | 0.78125 | 0.130024 | 0 | 0.2 | 0 | 0 | 0.311111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 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 | 0 | 0 | 2 |
f1eeceb7e5f8eaa85c5780097e3f5975694fb118 | 557 | py | Python | Codechef/TRUEDARE.py | rohansaini886/Coding_Practice | da389839ea697eb31950123b496872d4a679ea74 | [
"MIT"
] | 1 | 2022-01-31T18:29:09.000Z | 2022-01-31T18:29:09.000Z | Codechef/TRUEDARE.py | rohansaini886/Coding_Practice | da389839ea697eb31950123b496872d4a679ea74 | [
"MIT"
] | null | null | null | Codechef/TRUEDARE.py | rohansaini886/Coding_Practice | da389839ea697eb31950123b496872d4a679ea74 | [
"MIT"
] | null | null | null | for _ in range(int(input())):
tr = int(input())
ram_task = list(map(int, input().split(' ')))
dr = int(input())
ram_dare = list(map(int, input().split(' ')))
ts = int(input())
sham_task = list(map(int, input().split(' ')))
ds = int(input())
sham_dare = list(map(int, input().split(' ')))
lose = False
for i in sham_task:
if i not in ram_task:
lose = True
for i in sham_dare:
if i not in ram_dare:
lose = True
if lose:
print('no')
else:
print('yes')
| 26.52381 | 50 | 0.51167 | 80 | 557 | 3.45 | 0.325 | 0.26087 | 0.144928 | 0.217391 | 0.427536 | 0.347826 | 0 | 0 | 0 | 0 | 0 | 0 | 0.315978 | 557 | 20 | 51 | 27.85 | 0.724409 | 0 | 0 | 0.1 | 0 | 0 | 0.016158 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f1fd6986d58548683f505f56a1928aa5df4a4053 | 605 | py | Python | alerta/stats/stats.py | rudderlabs/alerta | aabf578e9d0b28cd05127ac2c3bd9bbbf9317f5b | [
"Apache-2.0"
] | 1 | 2022-02-03T02:58:59.000Z | 2022-02-03T02:58:59.000Z | alerta/stats/stats.py | rudderlabs/alerta | aabf578e9d0b28cd05127ac2c3bd9bbbf9317f5b | [
"Apache-2.0"
] | 13 | 2021-12-06T21:17:45.000Z | 2022-03-20T11:58:10.000Z | alerta/stats/stats.py | rudderlabs/alerta | aabf578e9d0b28cd05127ac2c3bd9bbbf9317f5b | [
"Apache-2.0"
] | null | null | null | import os
import statsd
STATS_URL = os.environ['STATS_URL']
STATS_PORT = int(os.environ['STATS_PORT'])
stats_client = statsd.StatsClient(STATS_URL, STATS_PORT,prefix='notisrvr')
class StatsD:
stats_client = stats_client
@staticmethod
def timer(stat_name, start_time, tags: dict = {}):
stats_client.timing(stat_name, start_time, tags={**tags, })
@staticmethod
def gauge():
pass
@staticmethod
def counter():
pass
@staticmethod
def increment(stat_name, value, tags: dict = {}):
stats_client.incr(stat_name, value, tags={**tags, })
| 20.862069 | 74 | 0.664463 | 75 | 605 | 5.133333 | 0.386667 | 0.142857 | 0.072727 | 0.088312 | 0.109091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.21157 | 605 | 28 | 75 | 21.607143 | 0.807128 | 0 | 0 | 0.315789 | 0 | 0 | 0.044628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0.105263 | 0.105263 | 0 | 0.421053 | 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 | 0 | 0 | 0 | 2 |
7b04d7e14449e4ee050621af71dd98e72e31945c | 682 | py | Python | mysite/myapp/migrations/0012_auto_20180517_1219.py | pl3nny/csc648-team05_pl3nny | a571d5da2caed9201664ebb37ccec73f72cb03ba | [
"MIT"
] | null | null | null | mysite/myapp/migrations/0012_auto_20180517_1219.py | pl3nny/csc648-team05_pl3nny | a571d5da2caed9201664ebb37ccec73f72cb03ba | [
"MIT"
] | null | null | null | mysite/myapp/migrations/0012_auto_20180517_1219.py | pl3nny/csc648-team05_pl3nny | a571d5da2caed9201664ebb37ccec73f72cb03ba | [
"MIT"
] | null | null | null | # Generated by Django 2.0.3 on 2018-05-17 19:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myapp', '0011_auto_20180506_1736'),
]
operations = [
migrations.RemoveField(
model_name='userdata',
name='location',
),
migrations.AddField(
model_name='userdata',
name='city',
field=models.CharField(default='San Francisco', max_length=255),
),
migrations.AddField(
model_name='userdata',
name='state',
field=models.CharField(default='CA', max_length=255),
),
]
| 24.357143 | 76 | 0.564516 | 67 | 682 | 5.626866 | 0.626866 | 0.071618 | 0.135279 | 0.167109 | 0.206897 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 0.079229 | 0.315249 | 682 | 27 | 77 | 25.259259 | 0.728051 | 0.065982 | 0 | 0.380952 | 1 | 0 | 0.132283 | 0.03622 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.047619 | 0 | 0.190476 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7b0b990df2fe23fbc755c849b34892b0dd490836 | 119 | py | Python | test.py | drib861204/Soft-Actor-Critic-and-Extensions | 3075df7430c1c49177b3798d753a9e3f6226672e | [
"MIT"
] | null | null | null | test.py | drib861204/Soft-Actor-Critic-and-Extensions | 3075df7430c1c49177b3798d753a9e3f6226672e | [
"MIT"
] | null | null | null | test.py | drib861204/Soft-Actor-Critic-and-Extensions | 3075df7430c1c49177b3798d753a9e3f6226672e | [
"MIT"
] | null | null | null | q1 = 1
q2 = -2
q3 = 4
state = (q1, q2, q3)
state = (-state[0], -state[1], -state[2])
#str(state[0]) = '33'
print(state) | 17 | 41 | 0.537815 | 23 | 119 | 2.782609 | 0.478261 | 0.1875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154639 | 0.184874 | 119 | 7 | 42 | 17 | 0.505155 | 0.168067 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9e3605a24dc4ef240b5681bdb5f628fa9e63bd6f | 2,243 | py | Python | old_code/src_python/nmpccodegen/Cfunctions/source_file_operations.py | kul-forbes/nmpc-codegen | 0b96da0840504817472b2bdc62c29c98bdf29c8f | [
"MIT"
] | 24 | 2017-11-13T02:17:10.000Z | 2021-03-15T13:47:20.000Z | old_code/src_python/nmpccodegen/Cfunctions/source_file_operations.py | kul-optec/nmpc-codegen | 0b96da0840504817472b2bdc62c29c98bdf29c8f | [
"MIT"
] | 14 | 2018-01-13T20:20:47.000Z | 2020-05-12T11:21:12.000Z | old_code/src_python/nmpccodegen/Cfunctions/source_file_operations.py | kul-optec/nmpc-codegen | 0b96da0840504817472b2bdc62c29c98bdf29c8f | [
"MIT"
] | 5 | 2018-08-14T14:27:41.000Z | 2020-12-17T08:13:41.000Z | import os
from pathlib import Path
import time
class Source_file_generator:
"""
Library to easily generate proximal functions
"""
number_of_spaces_in_tab=4
def __init__(self,location,function_type):
"""
Parameters
---------
location : target location
function_type : should be either "g" or "proxg"
"""
self._location=location
self._function_type=function_type
def open(self):
"""
Open fil stream
"""
file = Path(self._location)
if (file.exists()):
print(self._location + " already exists, removing it before adding the new file")
self._source_file = open(self._location, 'w')
self._source_file.write("/* file generated on " + time.strftime("%x") +
" at " + time.strftime("%H:%M:%S") + " */" + "\n\n")
if (self._function_type == "g"):
print("generating g-type function")
self._source_file.write("real_t casadi_interface_g(const real_t* state){\n")
elif (self._function_type == "proxg"):
print("generating proxg-type function")
self._source_file.write("void casadi_interface_proxg(real_t* state){\n")
else:
print("ERROR wrong function_type pick either g or proxg")
self._source_file.close()
def start_for(self,iterator_name,length,indent):
self.write_line("size_t "+iterator_name+ ";",indent)
self.write_line("for("+iterator_name+"=0;i<"+str(length)+";i++){",indent)
def close_for(self,indent):
self.write_line("}",indent)
def write_line(self,line,indent):
string_indent = " "*indent*Source_file_generator.number_of_spaces_in_tab
self._source_file.write(string_indent+line+"\n")
def write_define(self,name,value,indent):
self.write_line("#define "+name+" "+str(value),indent)
def write_comment_line(self,line,indent):
self.write_line("/* "+line+" */",indent)
def set_output(self,output_index,value,indent):
self.write_line("state["+str(output_index)+"]="+str(value)+";",indent)
def close(self):
self._source_file.write("\n}\n")
self._source_file.close() | 39.350877 | 93 | 0.615247 | 281 | 2,243 | 4.647687 | 0.327402 | 0.07657 | 0.085758 | 0.087289 | 0.140888 | 0.047473 | 0 | 0 | 0 | 0 | 0 | 0.001174 | 0.240303 | 2,243 | 57 | 94 | 39.350877 | 0.765258 | 0.070441 | 0 | 0.04878 | 1 | 0 | 0.179 | 0.027 | 0 | 0 | 0 | 0 | 0 | 1 | 0.219512 | false | 0 | 0.073171 | 0 | 0.341463 | 0.097561 | 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 | 0 | 0 | 0 | 2 |
9e3dc6cb93d76e89ee69d13bba658852f3a61f0e | 174 | py | Python | CLASSIC PUZZLE - EASY/robot-show.py | martincourtois/CodinGame | 4df9c8af5cb9c513880dd086da9bf3f201bd56ed | [
"Unlicense"
] | null | null | null | CLASSIC PUZZLE - EASY/robot-show.py | martincourtois/CodinGame | 4df9c8af5cb9c513880dd086da9bf3f201bd56ed | [
"Unlicense"
] | null | null | null | CLASSIC PUZZLE - EASY/robot-show.py | martincourtois/CodinGame | 4df9c8af5cb9c513880dd086da9bf3f201bd56ed | [
"Unlicense"
] | null | null | null | import sys
import math
size = int(input())
n = int(input())
bots = list(map(int, input().split()))
left = min(bots)
right = max(bots)
t = max([size - left, right])
print(t)
| 15.818182 | 38 | 0.632184 | 29 | 174 | 3.793103 | 0.586207 | 0.218182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16092 | 174 | 10 | 39 | 17.4 | 0.753425 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 0.111111 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9e4d7eae9508b027ccd616d0d17535f8c53a3721 | 249 | py | Python | encomp/tests/test_gases.py | wlaur/encomp | 236eb32d300e0deea5b05fcc46b06e13cb480838 | [
"MIT"
] | 1 | 2022-01-29T22:05:50.000Z | 2022-01-29T22:05:50.000Z | encomp/tests/test_gases.py | wlaur/encomp | 236eb32d300e0deea5b05fcc46b06e13cb480838 | [
"MIT"
] | null | null | null | encomp/tests/test_gases.py | wlaur/encomp | 236eb32d300e0deea5b05fcc46b06e13cb480838 | [
"MIT"
] | null | null | null | from encomp.units import Q
from encomp.gases import convert_gas_volume
def test_convert_gas_volume():
ret = convert_gas_volume(
Q(1, 'm3'),
'N',
(Q(2, 'bar'), Q(25, 'degC'))
)
assert ret.check(Q(0, 'liter'))
| 16.6 | 43 | 0.586345 | 37 | 249 | 3.756757 | 0.621622 | 0.215827 | 0.345324 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032609 | 0.261044 | 249 | 14 | 44 | 17.785714 | 0.722826 | 0 | 0 | 0 | 0 | 0 | 0.060241 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.111111 | false | 0 | 0.222222 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9e660f5a6cd0572ee21733dea818ad1dbbd1c7f6 | 268 | py | Python | docker_emperor/commands/machine/list.py | workon-io/docker-emperor | d827bb2806494dcba97920dd83c5934d0a300089 | [
"Apache-2.0"
] | null | null | null | docker_emperor/commands/machine/list.py | workon-io/docker-emperor | d827bb2806494dcba97920dd83c5934d0a300089 | [
"Apache-2.0"
] | null | null | null | docker_emperor/commands/machine/list.py | workon-io/docker-emperor | d827bb2806494dcba97920dd83c5934d0a300089 | [
"Apache-2.0"
] | null | null | null | import os
import six
import docker_emperor.logger as logger
__all__ = ['run']
def run(root, *args, **kwargs):
machines = root.project['machines']
for i, m in enumerate(root.project['machines']):
logger.choice(u'<b>{}</b>] {}'.format(i+1, m.name))
| 19.142857 | 59 | 0.63806 | 39 | 268 | 4.25641 | 0.666667 | 0.13253 | 0.228916 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004525 | 0.175373 | 268 | 13 | 60 | 20.615385 | 0.746606 | 0 | 0 | 0 | 0 | 0 | 0.119403 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.5 | 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 | 0 | 0 | 0 | 2 |
9e68981e5e5897a93fe26c9242f5f43fca9c46d7 | 543 | py | Python | model/zstq_ty.py | ArcherLuo233/election-s-prediction | 9da72cb855f6d61f9cdec6e15f7ca832629ba51a | [
"MIT"
] | null | null | null | model/zstq_ty.py | ArcherLuo233/election-s-prediction | 9da72cb855f6d61f9cdec6e15f7ca832629ba51a | [
"MIT"
] | 1 | 2022-01-26T01:23:26.000Z | 2022-01-26T01:23:34.000Z | model/zstq_ty.py | ArcherLuo233/election-s-prediction | 9da72cb855f6d61f9cdec6e15f7ca832629ba51a | [
"MIT"
] | 1 | 2021-11-08T10:58:23.000Z | 2021-11-08T10:58:23.000Z | from sqlalchemy import Column, ForeignKey, Integer, String, Text
from model.base import Base
class ZSTQ_TY(Base):
__tablename__ = 'zstq_ty'
class_name = '在绍台企-团员'
foreign_key = 'zstq_id'
export_docx = False
field = [
'id', 'name', 'sex', 'job', 'taiwanese_id'
]
zstq_id = Column(Integer, ForeignKey('zstq.id'))
name = Column(String(100), comment='姓名')
sex = Column(String(100), comment='性别')
job = Column(String(100), comment='单位职务')
taiwanese_id = Column(String(100), comment='台胞证号')
| 24.681818 | 64 | 0.642726 | 70 | 543 | 4.8 | 0.471429 | 0.142857 | 0.178571 | 0.261905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027907 | 0.208103 | 543 | 21 | 65 | 25.857143 | 0.753488 | 0 | 0 | 0 | 0 | 0 | 0.117864 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.133333 | 0 | 0.866667 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
9e69e9e0fb96e9ad7d43a95d8cbdc21443d8d3f3 | 403 | py | Python | enter.py | dataGAI/IBI_Bot_Rep | a31de5bf9e53aa88ffca774865e5a6d2d710f9fe | [
"MIT"
] | null | null | null | enter.py | dataGAI/IBI_Bot_Rep | a31de5bf9e53aa88ffca774865e5a6d2d710f9fe | [
"MIT"
] | null | null | null | enter.py | dataGAI/IBI_Bot_Rep | a31de5bf9e53aa88ffca774865e5a6d2d710f9fe | [
"MIT"
] | null | null | null | from IBI_raspisan import get_updates, handle_updates
import time
updates = get_updates()
while True:
new_updates = get_updates()
if len(new_updates['result']) > len(updates['result']):
handle_updates(new_updates, len(new_updates['result']) - len(updates['result']))
updates = new_updates
elif len(new_updates['result']) == 0:
updates = new_updates
time.sleep(10)
| 33.583333 | 88 | 0.687345 | 53 | 403 | 4.981132 | 0.339623 | 0.265152 | 0.147727 | 0.215909 | 0.265152 | 0.265152 | 0.265152 | 0 | 0 | 0 | 0 | 0.009119 | 0.183623 | 403 | 11 | 89 | 36.636364 | 0.793313 | 0 | 0 | 0.181818 | 0 | 0 | 0.074442 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.181818 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9e75dc2b0b1bf5c6d673edb8f991b4e99dd20e3e | 3,446 | py | Python | api_v1/serializers.py | andela-akiura/yonder | 1e7c2e113b9188b69459b2443e548d83baeb24e2 | [
"MIT"
] | 1 | 2017-09-04T11:45:32.000Z | 2017-09-04T11:45:32.000Z | api_v1/serializers.py | andela-akiura/pixlr | 1e7c2e113b9188b69459b2443e548d83baeb24e2 | [
"MIT"
] | 4 | 2021-06-08T19:30:05.000Z | 2022-03-11T23:17:41.000Z | api_v1/serializers.py | andela-akiura/khali | 1e7c2e113b9188b69459b2443e548d83baeb24e2 | [
"MIT"
] | null | null | null | from django.contrib.auth.models import User
from rest_framework import serializers
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
from models import Image, ThumbnailImage, ThumbnailFilter, Folder
class UserSerializer(serializers.ModelSerializer):
email = serializers.EmailField(max_length=100, required=True)
username = serializers.CharField(max_length=100, required=True)
first_name = serializers.CharField(max_length=100, required=True)
last_name = serializers.CharField(max_length=100, required=True)
password = serializers.CharField(max_length=100,
style={'input_type': 'password'},
required=True, write_only=True)
confirm_password = serializers.CharField(max_length=100,
style={'input_type': 'password'},
required=True, write_only=True)
def validate(self, data):
try:
validate_email(data['email'])
return data
except ValidationError:
raise serializers.ValidationError('The email is invalid.')
class Meta:
model = User
fields = ('username', 'email', 'first_name', 'last_name', 'password',
'confirm_password')
class SocialUserSerializer(serializers.ModelSerializer):
username = serializers.CharField(max_length=100, required=True)
first_name = serializers.CharField(max_length=100, required=True)
last_name = serializers.CharField(max_length=100, required=True)
class Meta:
model = User
fields = ('username', 'first_name', 'last_name',)
class ImageSerializer(serializers.ModelSerializer):
original_image = serializers.ImageField(
max_length=None,
allow_empty_file=False,
use_url=True)
filtered_image = serializers.ImageField(
max_length=None,
allow_empty_file=False,
use_url=True)
save_changes = serializers.IntegerField(max_value=1, min_value=0,
required=False)
created_by = SocialUserSerializer(required=True)
class Meta:
model = Image
fields = ('id', 'save_changes', 'filter_name', 'date_created',
'date_modified', 'original_image', 'filtered_image',
'created_by', 'image_size', 'image_name')
class FolderSerializer(serializers.ModelSerializer):
images = ImageSerializer(many=True, read_only=True)
created_by = SocialUserSerializer(required=True)
class Meta:
model = Folder
fields = ('id', 'folder_name', 'created_by', 'images',)
class ThumbnailFilterSerializer(serializers.ModelSerializer):
filtered_thumbnail = serializers.ImageField(
max_length=None,
allow_empty_file=False,
use_url=True)
filter_name = serializers.EmailField(max_length=100, required=True)
class Meta:
model = ThumbnailFilter
fields = ('filtered_thumbnail', 'filter_name', 'original_thumbnail')
class ThumbnailImageSerializer(serializers.ModelSerializer):
filters = ThumbnailFilterSerializer(many=True, read_only=True)
thumbnail = serializers.ImageField(
max_length=None,
allow_empty_file=False,
use_url=True)
class Meta:
model = ThumbnailImage
fields = ('id', 'thumbnail', 'filters')
| 35.895833 | 78 | 0.662797 | 345 | 3,446 | 6.423188 | 0.255072 | 0.056859 | 0.054152 | 0.072202 | 0.490072 | 0.472022 | 0.449458 | 0.419675 | 0.34657 | 0.34657 | 0 | 0.012279 | 0.243761 | 3,446 | 95 | 79 | 36.273684 | 0.838066 | 0 | 0 | 0.432432 | 0 | 0 | 0.100696 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.013514 | false | 0.081081 | 0.067568 | 0 | 0.513514 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
9e79dfb00be759a131b89398c3b0cfcfba886ef5 | 2,886 | py | Python | test/test_graph.py | vishalbelsare/PecanPy | 25729c34511df9c593bfddf8be4065cc0904931a | [
"BSD-3-Clause"
] | null | null | null | test/test_graph.py | vishalbelsare/PecanPy | 25729c34511df9c593bfddf8be4065cc0904931a | [
"BSD-3-Clause"
] | null | null | null | test/test_graph.py | vishalbelsare/PecanPy | 25729c34511df9c593bfddf8be4065cc0904931a | [
"BSD-3-Clause"
] | null | null | null | import unittest
import numpy as np
from pecanpy.graph import BaseGraph, AdjlstGraph, SparseGraph, DenseGraph
MAT = np.array([[0, 1, 1], [1, 0, 0], [1, 0, 0]], dtype=float)
INDPTR = np.array([0, 2, 3, 4], dtype=np.uint32)
INDICES = np.array([1, 2, 0, 0], dtype=np.uint32)
DATA = np.array([1.0, 1.0, 1.0, 1.0], dtype=np.float32)
ADJLST = [{1: 1.0, 2: 1.0}, {0: 1}, {0: 1}]
IDS = ["a", "b", "c"]
IDMAP = {"a": 0, "b": 1, "c": 2}
class TestBaseGraph(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.g = BaseGraph()
cls.g.set_ids(IDS)
def test_set_ids(self):
self.assertEqual(self.g.IDlst, IDS)
self.assertEqual(self.g.IDmap, IDMAP)
def test_properties(self):
self.assertEqual(self.g.num_nodes, 3)
with self.assertRaises(NotImplementedError):
self.assertEqual(self.g.num_edges, 4)
with self.assertRaises(NotImplementedError):
self.assertEqual(self.g.density, 2/3)
class TestAdjlstGraph(unittest.TestCase):
def test_from_mat(self):
g = AdjlstGraph.from_mat(MAT, IDS)
self.assertEqual(g._data, ADJLST)
self.assertEqual(g.IDlst, IDS)
def test_properties(self):
self.g = AdjlstGraph.from_mat(MAT, IDS)
self.assertEqual(self.g.num_nodes, 3)
self.assertEqual(self.g.num_edges, 4)
self.assertEqual(self.g.density, 2/3)
class TestSparseGraph(unittest.TestCase):
def tearDown(self):
del self.g
def validate(self):
self.assertTrue(np.all(self.g.indptr == INDPTR))
self.assertTrue(np.all(self.g.indices == INDICES))
self.assertTrue(np.all(self.g.data == DATA))
self.assertEqual(self.g.IDlst, IDS)
def test_from_mat(self):
self.g = SparseGraph.from_mat(MAT, IDS)
self.validate()
def test_from_adjlst_graph(self):
self.g = SparseGraph.from_adjlst_graph(AdjlstGraph.from_mat(MAT, IDS))
self.validate()
def test_properties(self):
self.g = SparseGraph.from_mat(MAT, IDS)
self.assertEqual(self.g.num_nodes, 3)
self.assertEqual(self.g.num_edges, 4)
self.assertEqual(self.g.density, 2/3)
class TestDenseGraph(unittest.TestCase):
def tearDown(self):
del self.g
def validate(self):
self.assertTrue(np.all(self.g.data == MAT))
self.assertEqual(self.g.IDlst, IDS)
def test_from_mat(self):
self.g = DenseGraph.from_mat(MAT, IDS)
self.validate()
def test_from_adjlst_graph(self):
self.g = DenseGraph.from_adjlst_graph(AdjlstGraph.from_mat(MAT, IDS))
self.validate()
def test_properties(self):
self.g = DenseGraph.from_mat(MAT, IDS)
self.assertEqual(self.g.num_nodes, 3)
self.assertEqual(self.g.num_edges, 4)
self.assertEqual(self.g.density, 2/3)
if __name__ == "__main__":
unittest.main()
| 30.378947 | 78 | 0.639986 | 412 | 2,886 | 4.366505 | 0.15534 | 0.08338 | 0.168983 | 0.177877 | 0.732629 | 0.677599 | 0.632574 | 0.593663 | 0.520289 | 0.463591 | 0 | 0.02656 | 0.217256 | 2,886 | 94 | 79 | 30.702128 | 0.76981 | 0 | 0 | 0.555556 | 0 | 0 | 0.004851 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.208333 | false | 0 | 0.041667 | 0 | 0.305556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9ea0fd17fe91b889bd66d92121803ee01a831f63 | 282 | py | Python | PyHickmanSales/enums.py | nint8835/PyHickmanSales | 2bd855d71e151066f066c0f93f47f35a4aeb9ba9 | [
"MIT"
] | 1 | 2019-05-11T15:59:47.000Z | 2019-05-11T15:59:47.000Z | PyHickmanSales/enums.py | whitemike889/PyHickmanSales | 2bd855d71e151066f066c0f93f47f35a4aeb9ba9 | [
"MIT"
] | null | null | null | PyHickmanSales/enums.py | whitemike889/PyHickmanSales | 2bd855d71e151066f066c0f93f47f35a4aeb9ba9 | [
"MIT"
] | 1 | 2019-05-11T15:59:43.000Z | 2019-05-11T15:59:43.000Z | class Category:
"""
Categories of vehicles sold.
"""
NEW = "new"
DEMO = "demo"
USED = "preowned"
class VehicleType:
"""
Types of vehicles sold.
"""
CARGO_VAN = "CARGO VAN"
CAR = "Car"
SUV = "SUV"
TRUCK = "Truck"
VAN = "Van"
| 14.842105 | 32 | 0.507092 | 30 | 282 | 4.733333 | 0.566667 | 0.140845 | 0.197183 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.351064 | 282 | 18 | 33 | 15.666667 | 0.775956 | 0.184397 | 0 | 0 | 0 | 0 | 0.190955 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
7b4007b4d89c6e762d2e165ea6e1d80b91f9f259 | 1,265 | py | Python | tests/test_urls.py | dimagi/djtables | dfe5b9e2ea51fd42e528cbe4a7f23cdcfda59fad | [
"MIT"
] | 1 | 2020-09-15T22:17:11.000Z | 2020-09-15T22:17:11.000Z | tests/test_urls.py | adammck/djtables | 8fa279e7088123f00cca9c838fe028ebf327325e | [
"MIT"
] | null | null | null | tests/test_urls.py | adammck/djtables | 8fa279e7088123f00cca9c838fe028ebf327325e | [
"MIT"
] | 1 | 2019-09-29T04:19:21.000Z | 2019-09-29T04:19:21.000Z | #!/usr/bin/env python
# vim: et ts=4 sw=4
from django.http import QueryDict
from djtables.urls import extract, build
def test_returns_empty_dict():
assert extract(QueryDict("", encoding="utf-8")) == { }
def test_extracts_order_by():
qs = QueryDict("order_by=x", encoding="utf-8")
assert extract(qs) == { 'order_by': "x" }
def test_casts_page_number_to_int():
qs = QueryDict("page=1", encoding="utf-8")
assert extract(qs) == { 'page': 1 }
def test_prepends_prefixes_to_parameters():
qs = QueryDict("a-order_by=x;b-order_by=y", encoding="utf-8")
assert extract(qs, prefix="a-") == { 'order_by': "x" }
assert extract(qs, prefix="b-") == { 'order_by': "y" }
def test_accepts_multiple_values_in_query_string():
qs = QueryDict("order_by=x&order_by=y", encoding="utf-8")
assert extract(qs) == { 'order_by': "y" }
def test_rebuilds_urls():
qs = QueryDict("order_by=x", encoding="utf-8")
assert build("/", qs) == "/?order_by=x"
def test_adds_parameters():
qs = QueryDict("order_by=x", encoding="utf-8")
assert build("/", qs, page=1) == "/?order_by=x&page=1"
def test_overrides_parameters():
qs = QueryDict("order_by=x", encoding="utf-8")
assert build("/", qs, order_by="y") == "/?order_by=y"
| 26.914894 | 65 | 0.647431 | 191 | 1,265 | 4.062827 | 0.282723 | 0.153351 | 0.103093 | 0.162371 | 0.490979 | 0.436856 | 0.381443 | 0.381443 | 0.351804 | 0.213918 | 0 | 0.01317 | 0.159684 | 1,265 | 46 | 66 | 27.5 | 0.716839 | 0.03004 | 0 | 0.153846 | 0 | 0 | 0.182041 | 0.037551 | 0 | 0 | 0 | 0 | 0.346154 | 1 | 0.307692 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7b6791b9368953a2b44f615642b75a396db43204 | 487 | py | Python | script/airflow_admin_script.py | noob41/docker-airflow | 67f39b0711f7c0cb1b4671d0cbb6071522f4d023 | [
"Apache-2.0"
] | 1 | 2021-09-03T10:23:11.000Z | 2021-09-03T10:23:11.000Z | script/airflow_admin_script.py | dogslee/docker-airflow | 67f39b0711f7c0cb1b4671d0cbb6071522f4d023 | [
"Apache-2.0"
] | null | null | null | script/airflow_admin_script.py | dogslee/docker-airflow | 67f39b0711f7c0cb1b4671d0cbb6071522f4d023 | [
"Apache-2.0"
] | 1 | 2020-09-10T09:13:27.000Z | 2020-09-10T09:13:27.000Z | import airflow
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
#user.username = os.environ['AIRFLOW_ADMIN_USSR']
#user.email = os.environ['AIRFLOW_ADMIN_EMAIL']
#user.password = os.environ['AIRFLOW_ADMIN_PASS']
user.username = 'admin'
user.email = 'admin@admin.com'
user.password = 'admin'
user.superuser = True
session = settings.Session()
session.add(user)
session.commit()
session.close()
| 27.055556 | 68 | 0.780287 | 65 | 487 | 5.738462 | 0.384615 | 0.072386 | 0.128686 | 0.168901 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088296 | 487 | 17 | 69 | 28.647059 | 0.84009 | 0.291581 | 0 | 0 | 0 | 0 | 0.073099 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.25 | 0.25 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
7b796c37448ba9cc54eab7a88d4e3976c540744a | 171 | py | Python | April/Week4/CountingBits.py | nimishbongale/leetcode-30days-solutions-scratchpad | 56aa989907e5c9bb2657292434ef2174b525aeb2 | [
"MIT"
] | null | null | null | April/Week4/CountingBits.py | nimishbongale/leetcode-30days-solutions-scratchpad | 56aa989907e5c9bb2657292434ef2174b525aeb2 | [
"MIT"
] | null | null | null | April/Week4/CountingBits.py | nimishbongale/leetcode-30days-solutions-scratchpad | 56aa989907e5c9bb2657292434ef2174b525aeb2 | [
"MIT"
] | null | null | null | class Solution:
def countBits(self, num: int) -> List[int]:
ans=[]
for i in range(num+1):
ans.append(bin(i).count('1'))
return ans
| 24.428571 | 47 | 0.51462 | 24 | 171 | 3.666667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017391 | 0.327485 | 171 | 6 | 48 | 28.5 | 0.747826 | 0 | 0 | 0 | 0 | 0 | 0.005848 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
7b8bb03495a6feb596d3039523ce0b9b19a5425f | 597 | py | Python | scripts/npc/goKinoc.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 54 | 2019-04-16T23:24:48.000Z | 2021-12-18T11:41:50.000Z | scripts/npc/goKinoc.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 3 | 2019-05-19T15:19:41.000Z | 2020-04-27T16:29:16.000Z | scripts/npc/goKinoc.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 49 | 2020-11-25T23:29:16.000Z | 2022-03-26T16:20:24.000Z | # Created by MechAviv
# Map ID :: 100000000
# NPC ID :: 9110000
# Perry
maps = [["Showa Town", 100000000], ["Ninja Castle", 100000000], ["Six Path Crossway", 100000000]]# TODO
sm.setSpeakerID(9110000)
selection = sm.sendNext("Welcome! Where to?\r\n#L0# To Showa Town#l\r\n#L1# To Ninja Castle#l\r\n#L2# To Six Path Crossway#l")
sm.setSpeakerID(9110000)
if sm.sendAskYesNo(maps[selection][0] + "? Drive safely!"):
sm.warp(maps[selection][1])
else:
sm.setSpeakerID(9110000)
sm.sendNext("I hope the ride wasn't too uncomfortable. I can't upgrade the seating without charging fares.")
| 33.166667 | 126 | 0.703518 | 92 | 597 | 4.565217 | 0.576087 | 0.1 | 0.15 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135029 | 0.144054 | 597 | 17 | 127 | 35.117647 | 0.686888 | 0.113903 | 0 | 0.333333 | 0 | 0.222222 | 0.472169 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7b8f4064489918e0210c90d70eb9146860609c4a | 1,111 | py | Python | Python/wave_test.py | mzlogin/snippets | 5302142d1b6591a513b7cbcd0400f0d3caeac0d1 | [
"MIT"
] | 4 | 2016-06-22T05:58:18.000Z | 2021-05-23T23:11:18.000Z | Python/wave_test.py | mzlogin/snippets | 5302142d1b6591a513b7cbcd0400f0d3caeac0d1 | [
"MIT"
] | 1 | 2017-11-30T02:01:36.000Z | 2017-11-30T02:01:36.000Z | Python/wave_test.py | mzlogin/snippets | 5302142d1b6591a513b7cbcd0400f0d3caeac0d1 | [
"MIT"
] | null | null | null | import requests
def text2code(text):
'''
convert a string to wave code
'''
ret = None
get_wave_params = {'type' : 'text', 'content' : text}
response = requests.post('http://rest.sinaapp.com/api/post', data=get_wave_params)
if response.status_code == 200:
try:
data = response.json()
ret = data['code']
except: # json() may cause ValueError
pass
return ret
def code2text(code):
'''
convert a wave code to string
'''
ret = None
get_text_params = {'code' : code}
response = requests.get('http://rest.sinaapp.com/api/get', params=get_text_params)
if (response.status_code == 200):
try:
data = response.json()
ret = data['content']
except:
pass
return ret
def main():
text = 'Flame-Team'
code = text2code(text)
if code is not None:
print text + ' to code is ' + code
text_restore = code2text(code)
if text_restore is not None:
print code + ' to text is ' + text_restore
if __name__ == '__main__':
main()
| 25.25 | 86 | 0.572457 | 138 | 1,111 | 4.456522 | 0.326087 | 0.053659 | 0.03252 | 0.058537 | 0.247154 | 0.178862 | 0.178862 | 0.178862 | 0.178862 | 0.178862 | 0 | 0.013004 | 0.307831 | 1,111 | 43 | 87 | 25.837209 | 0.786736 | 0.024302 | 0 | 0.363636 | 0 | 0 | 0.136089 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.060606 | 0.030303 | null | null | 0.060606 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
7b95d7af8da40e3bb639af32706ca75fadf85ecf | 2,837 | py | Python | 8.oop.py | iwhgao/python_practise | b85e5ffd8703faa04c5f1bd03c09ea4522e238f2 | [
"Apache-2.0"
] | 1 | 2017-08-30T09:06:41.000Z | 2017-08-30T09:06:41.000Z | 8.oop.py | iwhgao/python_practise | b85e5ffd8703faa04c5f1bd03c09ea4522e238f2 | [
"Apache-2.0"
] | null | null | null | 8.oop.py | iwhgao/python_practise | b85e5ffd8703faa04c5f1bd03c09ea4522e238f2 | [
"Apache-2.0"
] | 1 | 2018-10-08T06:13:51.000Z | 2018-10-08T06:13:51.000Z | #!/usr/bin/python
# -*- coding:utf-8 -*-
# ---------------------------
# Author: deangao
# Copyright: 2016 deangao
# Version: v1.0.0
# Created: 2016/2/3
# ---------------------------
__author__ = 'deangao'
'''
Python中同样是支持面向对象编程的(Object Oriented Programming)。
'''
'''
1. 类的数据属性和实例的数据属性不同,即使同名;
2. 类的实例可以在被创建后通过.的形式来新增实例数据属性;
3. 类色数据属性通过类名来调用和修改,也可以通过实例来调用但不能修改,如果通过实例来更新则会产生一个新的仅属于该实例属性;
4. 类有静态方法和类方法,可以通过函数修饰符来说明;
5. Python中的类可以多继承;
6. 默认Python中的属性和方法是公开的(Public),可以通过下面的方法来实现 私有变量和方法
_xxx 不能用'from module import *'导入
__xxx__ 系统定义名字
__xxx 类中的私有变量名
"单下划线" 开始的成员变量叫做保护变量,意思是只有类对象和子类对象自己能访问到这些变量;
"双下划线" 开始的是私有成员,意思是只在类内部能被访问,连子类对象也不能访问到这个数据。
'''
# 定义一个人物类
class People(object):
# 此处定义的类的属性
count = 0
def __init__(self, name, sex, age):
# 类似this指针
People.count += 1
self.name, self.sex, self.age = name, sex, age
self.count = 10
# 此处定义实例的属性
self.instance_attr = 'Test'
# 公有成员函数
def peoplePrint(self):
print 'Name is', name
print 'Sex is', sex
print 'Age is', age
# 静态方法 此处无参数
@staticmethod
def static_method():
print 'This is a static method in', People.__name__
# 类方法 cls为类
@classmethod
def class_method(cls):
print 'This is a class method', cls.__name__
name = 'who'
sex = 'm'
age = 23
# 打印类的属性
print People.__dict__
# 类实例化
one_people = People(name, sex, age)
print one_people.__dict__
# 调用成员函数
one_people.peoplePrint()
# 实例对象调用对象的成员变量
print one_people.name
one_people.name = 'am'
print one_people.name
# 调用类的属性
print People.count
People.count += 1
print People.count
print People.__dict__
# 实例化另一个对象 类的属性count自增1
two_people = People(name, sex, age)
print People.__dict__
# ============================
# 静态方法
People.static_method()
# 类方法
People.class_method()
# ============================华丽的分割线===================================
class Animal(object):
"""
这是一个动物的基类
"""
def __init__(self):
"""
初始化方法
"""
print '这是一个动物的基类'
self.__printAnimal()
self._printAnimal()
def sounding(self):
"""
定义一个基本行为(方法)
"""
print '动物的发声'
def _printAnimal(self):
"""
类的保护函数
"""
print 'Protected'
def __printAnimal(self):
"""
类的私有函数,只能被在类的内部使用
"""
print 'Private'
class Dog(Animal):
"""
继承Animal基类
"""
def __init__(self):
Animal.__init__(self) # 此处需要显示的给定参数self
print '实例化一个Dog对象'
def sounding(self):
"""
重载基类的方法
"""
Animal.sounding(self)
print 'Dog的发声是:汪汪'
class Cat(Animal):
"""
继承Animal基类
"""
def __init__(self):
Animal.__init__(self)
print '实例化一个Cat对象'
def sounding(self):
"""
重载父类的sounding方法
:return: None
"""
Animal.sounding(self)
print 'Cat的发声是:喵喵'
# 实例Dog对象
dog1 = Dog()
# 调用Dog类的sounding方法
dog1.sounding()
# 调用父类的保护方法
dog1._printAnimal()
# 实例Cat对象
cat1 = Cat()
# 调用Cat类的sounding方法
cat1.sounding()
# 调用父类的保护方法
cat1._printAnimal()
# cat1.__printAnimal() 报错
| 15.010582 | 71 | 0.653507 | 315 | 2,837 | 5.628571 | 0.431746 | 0.027073 | 0.024817 | 0.013536 | 0.076706 | 0.076706 | 0.046249 | 0.046249 | 0 | 0 | 0 | 0.014919 | 0.17307 | 2,837 | 188 | 72 | 15.090426 | 0.740835 | 0.18153 | 0 | 0.283582 | 0 | 0 | 0.095534 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.402985 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
7ba46d09331a870433e08141782c74ce9e3b077e | 564 | py | Python | Python/python_programming_stu/mycode/lab/function_test.py | min9288/Multicampus | 2aaac730b35e530f8f91cb1ba41c08ee18d59142 | [
"MIT"
] | 2 | 2022-01-18T09:27:42.000Z | 2022-03-29T14:59:00.000Z | Python/python_programming_stu/mycode/lab/function_test.py | min9288/Multicampus | 2aaac730b35e530f8f91cb1ba41c08ee18d59142 | [
"MIT"
] | null | null | null | Python/python_programming_stu/mycode/lab/function_test.py | min9288/Multicampus | 2aaac730b35e530f8f91cb1ba41c08ee18d59142 | [
"MIT"
] | null | null | null | '''
function : default value
'''
def my_func(a=20, b=10):
return a - b
print(my_func())
print(my_func(30))
print(my_func(40, 5))
def my_func2(a, b=10):
return a + b
# default parameter value가 non-default paramter 보다 먼저 올 수 없다.
# def my_func3(a=20, b):
# return a + b
'''
function : tuple parameter, dict parameter
'''
def my_func_tuple(*p):
return p
print(type(my_func_tuple(10)))
print(my_func_tuple(10, 20, 30))
def my_func_dict(**p):
for k,v in p.items():
print(f'key = {k}, value = {v}')
my_func_dict(a=1, b=2, c=3)
| 17.090909 | 61 | 0.618794 | 105 | 564 | 3.171429 | 0.390476 | 0.162162 | 0.132132 | 0.06006 | 0.066066 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058427 | 0.210993 | 564 | 32 | 62 | 17.625 | 0.689888 | 0.221631 | 0 | 0 | 0 | 0 | 0.059459 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0 | 0.2 | 0.466667 | 0.4 | 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 | 0 | 0 | 0 | 2 |
7ba7fa9a32647b43a1a8f6200713afeb2e94e826 | 368 | py | Python | src/slider_experiment/slider_experiment/TSL/__init__.py | frank20a/collaborative-sats | 9d26d3c8f66cf43bbd514f02434851439e746797 | [
"MIT"
] | null | null | null | src/slider_experiment/slider_experiment/TSL/__init__.py | frank20a/collaborative-sats | 9d26d3c8f66cf43bbd514f02434851439e746797 | [
"MIT"
] | 6 | 2022-03-22T18:54:38.000Z | 2022-03-31T16:42:37.000Z | src/slider_experiment/slider_experiment/TSL/__init__.py | frank20a/collaborative-sats | 9d26d3c8f66cf43bbd514f02434851439e746797 | [
"MIT"
] | null | null | null | from parameters import *
from ament_index_python import get_package_share_directory
import sys, os
sys.path.insert(1, os.path.join(get_package_share_directory('slider_experiment'), 'python_build/tsl_optimizer'))
import tsl_optimizer as optimizer
solver = optimizer.solver()
def force2thrust(Fx, Fy, tau):
"""
Convert force/torque vectors to thrust
""" | 24.533333 | 112 | 0.774457 | 51 | 368 | 5.352941 | 0.666667 | 0.07326 | 0.10989 | 0.175824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00625 | 0.130435 | 368 | 15 | 113 | 24.533333 | 0.846875 | 0.103261 | 0 | 0 | 0 | 0 | 0.136508 | 0.08254 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.571429 | 0 | 0.714286 | 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 | 0 | 0 | 0 | 2 |
7ba80012931ab4af157e9edda3d9ddb246ce33a5 | 527 | py | Python | server/temp_logger.py | kwadra/temp_logger_service | 962cec1ff2981b017b4b224171ff69c2de171fee | [
"BSD-3-Clause"
] | null | null | null | server/temp_logger.py | kwadra/temp_logger_service | 962cec1ff2981b017b4b224171ff69c2de171fee | [
"BSD-3-Clause"
] | null | null | null | server/temp_logger.py | kwadra/temp_logger_service | 962cec1ff2981b017b4b224171ff69c2de171fee | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
from flask import Flask, request
from decimal import *
from pprint import pprint
import rrdtool
import logging
app = Flask(__name__)
@app.route('/log_temp')
def log_temp():
# show the post with the given id, the id is an integer
temp=Decimal(request.args.get('temp'))
humidity=Decimal(request.args.get('humidity'))
sensor=request.args.get('sensor')
rrdtool.update("temp_{}.rrd".format(sensor), "N:{}:{}".format(temp, humidity))
return 'Location %s %s %s' %(sensor,temp,humidity)
| 29.277778 | 82 | 0.702087 | 77 | 527 | 4.714286 | 0.493506 | 0.090909 | 0.115702 | 0.115702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144213 | 527 | 17 | 83 | 31 | 0.804878 | 0.140417 | 0 | 0 | 0 | 0 | 0.137472 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.384615 | 0 | 0.538462 | 0.076923 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
7baa0a2127772fd83190dff0f1da131fe684fd0d | 749 | py | Python | doc/integrations/pytorch/parlai/agents/tfidf_retriever/tokenizers/__init__.py | novium258/cortx-1 | ce5b939b33b8d24d89b31807ac3bcaa8f24096bc | [
"Apache-2.0"
] | 1 | 2020-09-27T05:00:06.000Z | 2020-09-27T05:00:06.000Z | doc/integrations/pytorch/parlai/agents/tfidf_retriever/tokenizers/__init__.py | novium258/cortx-1 | ce5b939b33b8d24d89b31807ac3bcaa8f24096bc | [
"Apache-2.0"
] | 1 | 2021-08-04T11:17:39.000Z | 2021-08-04T11:17:39.000Z | doc/integrations/pytorch/parlai/agents/tfidf_retriever/tokenizers/__init__.py | novium258/cortx-1 | ce5b939b33b8d24d89b31807ac3bcaa8f24096bc | [
"Apache-2.0"
] | 1 | 2021-05-03T13:27:14.000Z | 2021-05-03T13:27:14.000Z | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .regexp_tokenizer import RegexpTokenizer
from .simple_tokenizer import SimpleTokenizer
def set_default(key, value):
global DEFAULTS
DEFAULTS[key] = value
# Spacy is optional
try:
from .spacy_tokenizer import SpacyTokenizer
except ImportError:
pass
def get_class(name):
if name == 'spacy':
return SpacyTokenizer
if name == 'regexp':
return RegexpTokenizer
if name == 'simple':
return SimpleTokenizer
raise RuntimeError('Invalid tokenizer: %s' % name)
| 23.40625 | 66 | 0.684913 | 90 | 749 | 5.644444 | 0.633333 | 0.088583 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00177 | 0.245661 | 749 | 31 | 67 | 24.16129 | 0.897345 | 0.277704 | 0 | 0 | 0 | 0 | 0.075248 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0.058824 | 0.235294 | 0 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
7bab638c2aef140f0387bada88c28049972f6bb8 | 2,399 | py | Python | flask/part3_templates/ex3-app/function1_test.py | macloo/python-beginners | 1124922cd57d3f647eacafa0b82948587514d4bd | [
"MIT"
] | 42 | 2018-03-25T22:41:57.000Z | 2022-01-08T21:23:02.000Z | flask/part3_templates/ex3-app/function1_test.py | pavanpatil45/python-beginners | 1124922cd57d3f647eacafa0b82948587514d4bd | [
"MIT"
] | null | null | null | flask/part3_templates/ex3-app/function1_test.py | pavanpatil45/python-beginners | 1124922cd57d3f647eacafa0b82948587514d4bd | [
"MIT"
] | 17 | 2018-03-20T00:56:57.000Z | 2022-01-12T06:36:18.000Z | DATA = [
{"gender":"male","name":{"title":"mr","first":"brian","last":"watts"},"location":{"street":"8966 preston rd","city":"des moines","state":"virginia","postcode":15835},"dob":"1977-03-11 11:43:34","id":{"name":"SSN","value":"003-73-8821"},"picture":{"large":"https://randomuser.me/api/portraits/men/68.jpg","medium":"https://randomuser.me/api/portraits/med/men/68.jpg","thumbnail":"https://randomuser.me/api/portraits/thumb/men/68.jpg"}},
{"gender":"female","name":{"title":"miss","first":"terra","last":"jimenez"},"location":{"street":"1989 taylor st","city":"roseburg","state":"illinois","postcode":86261},"dob":"1987-05-08 18:18:06","id":{"name":"SSN","value":"896-95-9224"},"picture":{"large":"https://randomuser.me/api/portraits/women/17.jpg","medium":"https://randomuser.me/api/portraits/med/women/17.jpg","thumbnail":"https://randomuser.me/api/portraits/thumb/women/17.jpg"}},
{"gender":"female","name":{"title":"mrs","first":"jeanette","last":"thomas"},"location":{"street":"7446 hickory creek dr","city":"caldwell","state":"wyoming","postcode":73617},"dob":"1959-03-21 14:19:01","id":{"name":"SSN","value":"578-92-7338"},"picture":{"large":"https://randomuser.me/api/portraits/women/56.jpg","medium":"https://randomuser.me/api/portraits/med/women/56.jpg","thumbnail":"https://randomuser.me/api/portraits/thumb/women/56.jpg"}},
{"gender":"male","name":{"title":"mr","first":"darrell","last":"ramos"},"location":{"street":"4002 green rd","city":"peoria","state":"new york","postcode":62121},"dob":"1960-03-09 16:44:53","id":{"name":"SSN","value":"778-73-1993"},"picture":{"large":"https://randomuser.me/api/portraits/men/54.jpg","medium":"https://randomuser.me/api/portraits/med/men/54.jpg","thumbnail":"https://randomuser.me/api/portraits/thumb/men/54.jpg"}}
]
# get data for all students to use in index and write a list
def get_all_students(source):
# new dictionary
students = {}
# write id as key and lastname as value into dict
for record in source:
id = record['id']['value']
# .title() capitalizes the first letter of each word in string
lastname = (record['name']['last']).title()
students.update({id:lastname})
# return a list of tuples sorted in alpha order by lastname
# see https://pybit.es/dict-ordering.html - great resource!
return sorted(students.items(), key=lambda x: x[1])
print(get_all_students(DATA))
| 104.304348 | 451 | 0.670279 | 352 | 2,399 | 4.556818 | 0.426136 | 0.112219 | 0.127182 | 0.149626 | 0.411471 | 0.381546 | 0.349127 | 0.349127 | 0.236908 | 0 | 0 | 0.068487 | 0.068779 | 2,399 | 22 | 452 | 109.045455 | 0.649508 | 0.124218 | 0 | 0 | 0 | 0 | 0.640229 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0 | 0 | 0.142857 | 0.071429 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c8805cc345b857956a6e523a1bdfde660e44fe59 | 394 | py | Python | todo_api/views.py | pauloromeira/todo_lab | 8f14a3920ecc03b428b047f7b9ffeb4961b77fa0 | [
"MIT"
] | null | null | null | todo_api/views.py | pauloromeira/todo_lab | 8f14a3920ecc03b428b047f7b9ffeb4961b77fa0 | [
"MIT"
] | null | null | null | todo_api/views.py | pauloromeira/todo_lab | 8f14a3920ecc03b428b047f7b9ffeb4961b77fa0 | [
"MIT"
] | null | null | null | from rest_framework import viewsets
from .models import TodoItem, TodoList
from .serializers import TodoItemSerializer, TodoListSerializer
class TodoItemViewSet(viewsets.ModelViewSet):
queryset = TodoItem.objects.all()
serializer_class = TodoItemSerializer
class TodoListViewSet(viewsets.ModelViewSet):
queryset = TodoList.objects.all()
serializer_class = TodoListSerializer
| 30.307692 | 63 | 0.814721 | 37 | 394 | 8.594595 | 0.513514 | 0.125786 | 0.176101 | 0.157233 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.124365 | 394 | 12 | 64 | 32.833333 | 0.921739 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c88467b2c18c79078df5ec309a5a25fce8843efa | 780 | py | Python | RecoMET/Configuration/python/RecoMET_BeamHaloId_cff.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | RecoMET/Configuration/python/RecoMET_BeamHaloId_cff.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | RecoMET/Configuration/python/RecoMET_BeamHaloId_cff.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | import FWCore.ParameterSet.Config as cms
# Name : RecoMET_BeamHaloId_cff.py
# Original Author : R. Remington, UF
# Date : 11.11.2009
# Notes : Information to Id/reconstruct any halo that may be in the event
from RecoMET.METProducers.CSCHaloData_cfi import *
from RecoMET.METProducers.EcalHaloData_cfi import *
from RecoMET.METProducers.HcalHaloData_cfi import *
from RecoMET.METProducers.GlobalHaloData_cfi import *
from RecoMET.METProducers.BeamHaloSummary_cfi import *
#from L1Trigger.Configuration.L1RawToDigi_cff import *
BeamHaloId = cms.Sequence(CSCHaloData*EcalHaloData*HcalHaloData*GlobalHaloData*BeamHaloSummary)
# Needs FEVT content
#BeamHaloIdWithGtRecord = cms.Sequence(gtDigis*l1GtRecord*CSCHaloData*EcalHaloData*HcalHaloData*GlobalHaloData*BeamHaloSummary)
| 39 | 127 | 0.832051 | 90 | 780 | 7.122222 | 0.555556 | 0.085803 | 0.179407 | 0.124805 | 0.399376 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015625 | 0.097436 | 780 | 19 | 128 | 41.052632 | 0.894886 | 0.460256 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.857143 | 0 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c89e4e73832e0fd6d7e0b1fdcd5739be361315dd | 544 | py | Python | src/textbook/rosalind_ba3l.py | cowboysmall/rosalind | 021e4392a8fc946b97bbf86bbb8227b28bb5e462 | [
"MIT"
] | null | null | null | src/textbook/rosalind_ba3l.py | cowboysmall/rosalind | 021e4392a8fc946b97bbf86bbb8227b28bb5e462 | [
"MIT"
] | null | null | null | src/textbook/rosalind_ba3l.py | cowboysmall/rosalind | 021e4392a8fc946b97bbf86bbb8227b28bb5e462 | [
"MIT"
] | null | null | null | import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import genetics
import graphs
def main(argv):
lines = files.read_lines(argv[0])
k, d = [int(i) for i in lines[0].split()]
pairs = genetics.paired_kmers(lines[1:])
edges = graphs.debruijn_paired_graph(pairs)
path = graphs.eulerian_paired_path(edges, k, d)
print genetics.reconstruct_string_from_paired_path(path, k, d)
if __name__ == "__main__":
sys.setrecursionlimit(1048576)
main(sys.argv[1:])
| 22.666667 | 68 | 0.694853 | 80 | 544 | 4.45 | 0.5125 | 0.016854 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024336 | 0.169118 | 544 | 23 | 69 | 23.652174 | 0.763274 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.3125 | null | null | 0.0625 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
c89fea5056f5523d55e3b79238bc0e717fca5677 | 1,225 | py | Python | rope/rope.py | disordinary/python_rope | 08939b02c688a9491ae2d0652075e48ce0c5dc45 | [
"MIT"
] | null | null | null | rope/rope.py | disordinary/python_rope | 08939b02c688a9491ae2d0652075e48ce0c5dc45 | [
"MIT"
] | null | null | null | rope/rope.py | disordinary/python_rope | 08939b02c688a9491ae2d0652075e48ce0c5dc45 | [
"MIT"
] | null | null | null | from node import Node
# A Rope is a way of storing very large strings in a binary tree.
# The datastructure of a rope has it that the branches only store the length of the nodes on it's left hand side.
class Rope:
def __init__(self, string, optimalLength=1000, minLength=500, maxLength=1500):
# These are constants which are used to decide whether or not to re-build the tree
self.OPTIMAL_LENGTH = optimalLength
self.MIN_LENGTH = minLength
self.MAX_LENGTH = maxLength
self.node = Node(string, optimalLength, minLength, maxLength)
def __str__(self):
return str(self.node)
def __len__(self):
return len(self.node)
def insert(self, offset, string):
self.node.insert(offset, string)
# Rebalance the tree.
if(not self.node.amIBalanced()):
self.node = Node(str(self.node), self.OPTIMAL_LENGTH, self.MIN_LENGTH, self.MAX_LENGTH)
def delete(self, offset, length):
self.node.delete(offset, length)
# Rebalance the tree.
if(not self.node.amIBalanced()):
self.node = Node(str(self.node), self.OPTIMAL_LENGTH, self.MIN_LENGTH, self.MAX_LENGTH)
| 34.027778 | 113 | 0.653061 | 168 | 1,225 | 4.636905 | 0.386905 | 0.112965 | 0.065469 | 0.046213 | 0.272144 | 0.272144 | 0.272144 | 0.272144 | 0.272144 | 0.272144 | 0 | 0.012128 | 0.259592 | 1,225 | 35 | 114 | 35 | 0.846748 | 0.242449 | 0 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0.052632 | 0.105263 | 0.473684 | 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 | 0 | 0 | 0 | 2 |
c8a936d15ce849808161f98d5035a0c1da750031 | 590 | py | Python | src/mjotool/__init__.py | trigger-segfault/majiro-py | e2e237cc726da1ebaf1c9a5ce409c856c8dce17f | [
"MIT"
] | 2 | 2021-04-21T11:30:45.000Z | 2022-02-15T05:26:47.000Z | src/mjotool/__init__.py | trigger-segfault/majiro-py | e2e237cc726da1ebaf1c9a5ce409c856c8dce17f | [
"MIT"
] | 3 | 2021-10-15T00:10:49.000Z | 2021-12-27T10:30:13.000Z | src/mjotool/__init__.py | trigger-segfault/majiro-py | e2e237cc726da1ebaf1c9a5ce409c856c8dce17f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#-*- coding: utf-8 -*-
"""Majiro script tools library
"""
__version__ = '0.1.0'
__date__ = '2021-04-04'
__author__ = 'Robert Jordan'
__credits__ = '''Original C# implementation by AtomCrafty - 2021
Converted to Python library by Robert Jordan - 2021
'''
#######################################################################################
from .opcodes import Opcode
from .script import Instruction, MjoScript
from .analysis import ControlFlowGraph
from . import crypt
from . import flags
from . import opcodes
from . import script
from . import analysis
| 23.6 | 87 | 0.623729 | 65 | 590 | 5.415385 | 0.6 | 0.142045 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04142 | 0.140678 | 590 | 24 | 88 | 24.583333 | 0.65286 | 0.118644 | 0 | 0 | 0 | 0 | 0.301887 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c8bb3867095099a955cd121cc575f96b56e69166 | 471 | py | Python | scripts/z64_prep.py | tweakoz/zed64 | c0231444418999191182d53d9319bf7978422bfb | [
"CC-BY-3.0"
] | 4 | 2015-06-04T01:14:43.000Z | 2018-06-16T05:45:57.000Z | scripts/z64_prep.py | tweakoz/zed64 | c0231444418999191182d53d9319bf7978422bfb | [
"CC-BY-3.0"
] | null | null | null | scripts/z64_prep.py | tweakoz/zed64 | c0231444418999191182d53d9319bf7978422bfb | [
"CC-BY-3.0"
] | null | null | null | #!/usr/bin/env python
import os
Z64ROOT=os.environ["Z64ROOT"]
os.chdir(Z64ROOT)
os.system("rm -rf isedir")
os.system("rm -rf isim")
os.system("rm -rf zed64/rtl/gen")
os.system("mkdir -p isedir/isim")
os.system("mkdir -p zed64/rtl/gen/")
os.system("mkdir -p zed64/testprogs/gen/")
os.system("wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c64/characters.901225-01.bin -O ./roms/chargen.bin")
os.system("ln -s isedir/isim isim" )
os.system("z64_hdlgen.py")
| 33.642857 | 126 | 0.721868 | 83 | 471 | 4.084337 | 0.506024 | 0.212389 | 0.088496 | 0.106195 | 0.20354 | 0.147493 | 0.147493 | 0 | 0 | 0 | 0 | 0.05492 | 0.072187 | 471 | 13 | 127 | 36.230769 | 0.720824 | 0.042463 | 0 | 0 | 0 | 0.083333 | 0.602222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 0.083333 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c8bd81f2ece0ec8461266b92cdcaa7017015149d | 390 | py | Python | caesar.py | a-l-r1/cryptography | b3d5d2300d8968b2b718a93b1641e87f95365b4b | [
"CC0-1.0"
] | null | null | null | caesar.py | a-l-r1/cryptography | b3d5d2300d8968b2b718a93b1641e87f95365b4b | [
"CC0-1.0"
] | null | null | null | caesar.py | a-l-r1/cryptography | b3d5d2300d8968b2b718a93b1641e87f95365b4b | [
"CC0-1.0"
] | null | null | null | import vigenere
def _check_key(k: int) -> None:
if k < 0 or k > 25:
raise ValueError("_check_key: key < 0 or key > 25")
def encrypt(s: str, k: int) -> str:
_check_key(k)
return vigenere.encrypt(s, chr(k + vigenere.ORD_BASE_SMALL_A))
def encrypt_nocheck(s: str, k: int) -> str:
return vigenere.encrypt_nocheck(s, \
chr(k + vigenere.ORD_BASE_SMALL_A))
| 26 | 66 | 0.638462 | 64 | 390 | 3.671875 | 0.375 | 0.102128 | 0.076596 | 0.068085 | 0.314894 | 0.221277 | 0.221277 | 0.221277 | 0 | 0 | 0 | 0.02 | 0.230769 | 390 | 14 | 67 | 27.857143 | 0.763333 | 0 | 0 | 0 | 0 | 0 | 0.079487 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.1 | 0.1 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c8c4dc5633fa22b3bdfa6502725622a7273f2f48 | 661 | py | Python | solutions/59.py | pacokwon/leetcode | 37c943d371c106d1e6f24e065700e5edd1c3f9f9 | [
"MIT"
] | 2 | 2022-01-18T08:57:13.000Z | 2022-01-18T15:49:06.000Z | solutions/59.py | pacokwon/leetcode | 37c943d371c106d1e6f24e065700e5edd1c3f9f9 | [
"MIT"
] | null | null | null | solutions/59.py | pacokwon/leetcode | 37c943d371c106d1e6f24e065700e5edd1c3f9f9 | [
"MIT"
] | null | null | null | from typing import List
class Solution:
def generateMatrix(self, n: int) -> List[List[int]]:
mat = [[0] * n for _ in range(n)]
dx, dy = 1, 1
x, y = 0, -1
count = 1
while True:
for _ in range(n):
y += dy
mat[x][y] = count
count += 1
dy = -dy
n -= 1
if n == 0:
break
for _ in range(n):
x += dx
mat[x][y] = count
count += 1
dx = -dx
return mat
if __name__ == "__main__":
n = 4
print(Solution().generateMatrix(n))
| 20.030303 | 56 | 0.376702 | 78 | 661 | 3.051282 | 0.397436 | 0.063025 | 0.12605 | 0.138655 | 0.134454 | 0.134454 | 0 | 0 | 0 | 0 | 0 | 0.033951 | 0.509834 | 661 | 32 | 57 | 20.65625 | 0.700617 | 0 | 0 | 0.24 | 1 | 0 | 0.012121 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0 | 0.04 | 0 | 0.16 | 0.04 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 2 |
c8c6a3b01179748f8de3e00969420defd385c350 | 110 | py | Python | rio_rgbify/__init__.py | TobiasHerr/rio-rgbify-fork | ba582bdad3d1513f358ecfad624aaf58b430f62c | [
"MIT"
] | null | null | null | rio_rgbify/__init__.py | TobiasHerr/rio-rgbify-fork | ba582bdad3d1513f358ecfad624aaf58b430f62c | [
"MIT"
] | null | null | null | rio_rgbify/__init__.py | TobiasHerr/rio-rgbify-fork | ba582bdad3d1513f358ecfad624aaf58b430f62c | [
"MIT"
] | null | null | null | import logging
__version__ = "0.3.0"
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler()) | 18.333333 | 37 | 0.772727 | 14 | 110 | 5.5 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03 | 0.090909 | 110 | 6 | 37 | 18.333333 | 0.74 | 0 | 0 | 0 | 0 | 0 | 0.045045 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c8d2d3741136d75fc4ccd809bd215eaf4052225e | 2,212 | py | Python | baccarat/base_model.py | Rammstein-1994/baccarat_py | 234160854b87d9c4afee57cf5f6bdf893952a213 | [
"MIT"
] | null | null | null | baccarat/base_model.py | Rammstein-1994/baccarat_py | 234160854b87d9c4afee57cf5f6bdf893952a213 | [
"MIT"
] | null | null | null | baccarat/base_model.py | Rammstein-1994/baccarat_py | 234160854b87d9c4afee57cf5f6bdf893952a213 | [
"MIT"
] | null | null | null | """Model Interface."""
from dataclasses import dataclass, field
from typing import Protocol, Union
import random
class HandCard(Protocol):
@property
def total_points(self) -> int:
...
@dataclass
class Card:
number: str
suits: str
point: int
def __repr__(self) -> str:
return self.number + self.suits
@dataclass
class Hand:
cards: list[Card] = field(default_factory=list)
@property
def total_points(self) -> int:
return sum([card.point for card in self.cards]) % 10
def __len__(self):
return len(self.cards)
def __getitem__(self, index):
return self.cards[index]
def __repr__(self) -> str:
return ",".join([card.number + card.suits for card in self.cards])
def __add__(self, card: Union[Card, list[Card]]):
if isinstance(card, Card):
return Hand([*self.cards, card])
elif isinstance(card, list):
return Hand([*self.cards, *card])
else:
raise TypeError(
f"{type(card)} is not subclass of 'baccarat._base_model.Card' or 'baccarat._base_model.Hand'."
)
def __eq__(self, other: HandCard) -> bool:
return self.total_points == other.total_points
def __lt__(self, other: HandCard) -> bool:
return self.total_points < other.total_points
def __gt__(self, other: HandCard) -> bool:
return self.total_points > other.total_points
class Deck:
value = {
"A": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
"10": 0,
"J": 0,
"Q": 0,
"K": 0,
}
suits = "♡♠♢♣"
@classmethod
def make_deck(cls):
return [
Card(number, suit, point)
for number, point in cls.value.items()
for suit in cls.suits
]
@dataclass(repr=False)
class Dealer:
def init(self, deck: list[Card]):
self.deck = deck.copy()
def draw(self):
"""Draw a card from the deck top."""
return self.deck.pop(0)
def shuffle(self):
"""Shuffle cards of deck."""
random.shuffle(self.deck)
| 22.343434 | 110 | 0.55425 | 275 | 2,212 | 4.305455 | 0.330909 | 0.074324 | 0.043074 | 0.053209 | 0.304054 | 0.201014 | 0.152027 | 0.152027 | 0.152027 | 0.152027 | 0 | 0.017128 | 0.313743 | 2,212 | 98 | 111 | 22.571429 | 0.760211 | 0.031646 | 0 | 0.109589 | 0 | 0.013699 | 0.05174 | 0.02587 | 0 | 0 | 0 | 0 | 0 | 1 | 0.191781 | false | 0 | 0.041096 | 0.123288 | 0.547945 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
c8d7946424f42a25982fd4526b329c60af63901b | 584 | py | Python | py/hwid/v3/name_pattern_adapter.py | arccode/factory | a1b0fccd68987d8cd9c89710adc3c04b868347ec | [
"BSD-3-Clause"
] | 3 | 2022-01-06T16:52:52.000Z | 2022-03-07T11:30:47.000Z | py/hwid/v3/name_pattern_adapter.py | arccode/factory | a1b0fccd68987d8cd9c89710adc3c04b868347ec | [
"BSD-3-Clause"
] | null | null | null | py/hwid/v3/name_pattern_adapter.py | arccode/factory | a1b0fccd68987d8cd9c89710adc3c04b868347ec | [
"BSD-3-Clause"
] | 1 | 2021-10-24T01:47:22.000Z | 2021-10-24T01:47:22.000Z | # Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
class NamePattern:
def __init__(self, regex):
self.pattern = re.compile(regex)
def Matches(self, tag):
ret = self.pattern.match(tag)
if ret:
return int(ret.group(1)), int(ret.group(2) or 0)
return None
class NamePatternAdapter:
def GetNamePattern(self, comp_cls):
return NamePattern(r'{comp_cls}_(\d+)(?:_(\d+))?(?:#.*)?$'.format(
comp_cls=re.escape(comp_cls)))
| 24.333333 | 72 | 0.67637 | 87 | 584 | 4.425287 | 0.666667 | 0.072727 | 0.057143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014799 | 0.190068 | 584 | 23 | 73 | 25.391304 | 0.799154 | 0.270548 | 0 | 0 | 0 | 0 | 0.085308 | 0.085308 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.076923 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c8dda64e1f874b54cef33ef2a70783ad3047fe48 | 927 | py | Python | libvvtest/resultsout.py | rrdrake/vvtest | 875aaa81d2fac5986554b7b4fbeb2aebb3b57ac6 | [
"Unlicense"
] | 7 | 2021-03-26T21:33:09.000Z | 2022-03-01T17:06:55.000Z | libvvtest/resultsout.py | rrdrake/vvtest | 875aaa81d2fac5986554b7b4fbeb2aebb3b57ac6 | [
"Unlicense"
] | null | null | null | libvvtest/resultsout.py | rrdrake/vvtest | 875aaa81d2fac5986554b7b4fbeb2aebb3b57ac6 | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python
# Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
class ResultsWriters:
def __init__(self):
""
self.writers = []
def addWriter(self, writer):
""
self.writers.append( writer )
def prerun(self, atestlist, rtinfo, verbosity):
""
for wr in self.writers:
wr.prerun( atestlist, rtinfo, verbosity )
def midrun(self, atestlist, rtinfo):
""
for wr in self.writers:
wr.midrun( atestlist, rtinfo )
def postrun(self, atestlist, rtinfo):
""
for wr in self.writers:
wr.postrun( atestlist, rtinfo )
def info(self, atestlist, rtinfo):
""
for wr in self.writers:
wr.info( atestlist, rtinfo )
| 25.054054 | 75 | 0.599784 | 106 | 927 | 5.207547 | 0.45283 | 0.217391 | 0.137681 | 0.07971 | 0.248188 | 0.248188 | 0.211957 | 0.211957 | 0.211957 | 0 | 0 | 0.016975 | 0.300971 | 927 | 36 | 76 | 25.75 | 0.834877 | 0.234088 | 0 | 0.434783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0 | 0 | 0.304348 | 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 | 0 | 0 | 0 | 2 |
c8e33a92e8b226fb5d56785187771edf9e4dc96e | 7,316 | py | Python | ZJUSE/display/migrations/0001_initial.py | blackhatdwh/ZJU_TeachingSystem | a8164ccd741319bbe77cea372c9a0776a49d8419 | [
"MIT"
] | null | null | null | ZJUSE/display/migrations/0001_initial.py | blackhatdwh/ZJU_TeachingSystem | a8164ccd741319bbe77cea372c9a0776a49d8419 | [
"MIT"
] | null | null | null | ZJUSE/display/migrations/0001_initial.py | blackhatdwh/ZJU_TeachingSystem | a8164ccd741319bbe77cea372c9a0776a49d8419 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-11-06 01:15
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Class',
fields=[
('class_id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=20)),
('time', models.TextField(blank=True)),
],
),
migrations.CreateModel(
name='Course',
fields=[
('course_id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=50)),
('plan', models.TextField(blank=True)),
('book', models.TextField(blank=True)),
('background', models.TextField(blank=True)),
('exam', models.TextField(blank=True)),
('knowledge', models.TextField(blank=True)),
('project', models.TextField(blank=True)),
],
),
migrations.CreateModel(
name='Finish',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('upload_time', models.DateTimeField()),
('files', models.FileField(upload_to='homework/')),
('score', models.IntegerField()),
('evaluation', models.TextField()),
],
),
migrations.CreateModel(
name='Homework',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=20)),
('content', models.TextField()),
('files', models.FileField(upload_to='resource/homework/')),
('ddl', models.DateTimeField()),
('classes', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Class')),
],
),
migrations.CreateModel(
name='Information',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=50)),
('content', models.TextField()),
],
),
migrations.CreateModel(
name='Join',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('classes', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Class')),
],
),
migrations.CreateModel(
name='Link',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20)),
('address', models.URLField()),
],
),
migrations.CreateModel(
name='Message',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=50)),
('content', models.TextField()),
('classes', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Class')),
],
),
migrations.CreateModel(
name='Profile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('school_id', models.CharField(max_length=20)),
('question', models.CharField(max_length=50)),
('answer', models.CharField(max_length=50)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Resource',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=50)),
('files', models.FileField(upload_to='resource/')),
('simple_file', models.FileField(upload_to='resource/')),
('classes', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Class')),
],
),
migrations.CreateModel(
name='Student',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Teacher',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('experience', models.TextField(blank=True)),
('research', models.TextField(blank=True)),
('style', models.TextField(blank=True)),
('publication', models.TextField(blank=True)),
('honor', models.TextField(blank=True)),
('contact', models.TextField(blank=True)),
('other', models.TextField(blank=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Teaches',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('classes', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Class')),
('teacher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Teacher')),
],
),
migrations.AddField(
model_name='join',
name='student',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Student'),
),
migrations.AddField(
model_name='information',
name='teacher',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Teacher'),
),
migrations.AddField(
model_name='finish',
name='student',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Student'),
),
migrations.AddField(
model_name='class',
name='course',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='display.Course'),
),
]
| 44.339394 | 121 | 0.556315 | 685 | 7,316 | 5.814599 | 0.156204 | 0.067788 | 0.049209 | 0.077329 | 0.731107 | 0.686417 | 0.666834 | 0.633191 | 0.633191 | 0.633191 | 0 | 0.007972 | 0.29702 | 7,316 | 164 | 122 | 44.609756 | 0.766479 | 0.009295 | 0 | 0.596154 | 1 | 0 | 0.093582 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.025641 | 0 | 0.051282 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c8f211a8228e9f42b546485d4dd0bd715aa80e1b | 1,154 | py | Python | indexing/urls.py | rr2112/Crypto_Analyser-Django_ES- | 5ccdabfcfcbde9ad527bb751e2b5fef9b58f9f1e | [
"Apache-2.0"
] | null | null | null | indexing/urls.py | rr2112/Crypto_Analyser-Django_ES- | 5ccdabfcfcbde9ad527bb751e2b5fef9b58f9f1e | [
"Apache-2.0"
] | null | null | null | indexing/urls.py | rr2112/Crypto_Analyser-Django_ES- | 5ccdabfcfcbde9ad527bb751e2b5fef9b58f9f1e | [
"Apache-2.0"
] | null | null | null | from django.contrib import admin
from django.urls import path
from indexing import views
urlpatterns = [
path("", views.home, name="home"),
path("1M-future", views.Table, name="table_1m-future"),
path("5m-future", views.Table, name="table_5m-future"),
path("1h-future", views.Table, name="table_1h-future"),
path("4h-future", views.Table, name="table_4h-future"),
path("1d-future", views.Table, name="table_1d-future"),
path("1w-future", views.Table, name="table_1w-future"),
path("all_tf-future", views.Table, name="table_all_tf-future"),
path("1m-spot", views.Table, name="table_1m-spot"),
path("5m-spot", views.Table, name="table_5m-spot"),
path("1h-spot", views.Table, name="table_1h-spot"),
path("4h-spot", views.Table, name="table_4h-spot"),
path("1d-spot", views.Table, name="table_1d-spot"),
path("1w-spot", views.Table, name="table_1w-spot"),
path("all_tf-spot", views.Table, name="table_all_tf-spot"),
path(
"refresh_market_dtls", views.market_details_refresh, name="refresh_market_dtls"
),
path("1w-future-kucoin", views.Table, name="table_1w-future-kucoin"),
]
| 44.384615 | 87 | 0.67591 | 173 | 1,154 | 4.364162 | 0.16185 | 0.198676 | 0.278146 | 0.377483 | 0.533775 | 0.135099 | 0 | 0 | 0 | 0 | 0 | 0.025896 | 0.129983 | 1,154 | 25 | 88 | 46.16 | 0.726096 | 0 | 0 | 0 | 0 | 0 | 0.350087 | 0.019064 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c8f6aef286af93b23b858e225cd121e7d7576cbb | 536 | py | Python | AtC_Beg_Con_081-090/ABC089/C.py | yosho-18/AtCoder | 50f6d5c92a01792552c31ac912ce1cd557b06fb0 | [
"MIT"
] | null | null | null | AtC_Beg_Con_081-090/ABC089/C.py | yosho-18/AtCoder | 50f6d5c92a01792552c31ac912ce1cd557b06fb0 | [
"MIT"
] | null | null | null | AtC_Beg_Con_081-090/ABC089/C.py | yosho-18/AtCoder | 50f6d5c92a01792552c31ac912ce1cd557b06fb0 | [
"MIT"
] | null | null | null | n = int(input())
s = []
for i in range(n):
s.append(input())
# [d1, d2, d3, ..., dN]
m = []
a = []
r = []
c = []
h = []
for i in s:
if i[0] == "M":
m.append(i)
elif i[0] == "A":
a.append(i)
elif i[0] == "R":
r.append(i)
elif i[0] == "C":
c.append(i)
elif i[0] == "H":
h.append(i)
ml = len(m)
al = len(a)
rl = len(r)
cl = len(c)
hl = len(h)
count1 = ml*al*rl + ml*al*cl + ml*al*hl + ml*rl*cl + ml*rl*hl + ml*cl*hl + al*rl*cl + al*rl*hl + al*cl*hl + rl*cl*hl
print(count1) | 17.866667 | 116 | 0.436567 | 108 | 536 | 2.166667 | 0.268519 | 0.042735 | 0.188034 | 0.205128 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02681 | 0.304104 | 536 | 30 | 117 | 17.866667 | 0.600536 | 0.039179 | 0 | 0 | 0 | 0 | 0.009728 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.037037 | 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 | 0 | 0 | 2 |
c8f923006d7bdf88fc8f2ba3442de3170972c496 | 158 | py | Python | x_rebirth_station_calculator/station_data/wares/spaceweed.py | Phipsz/XRebirthStationCalculator | ac31c2f5816be34a7df2d7c4eb4bd5e01f7ff835 | [
"MIT"
] | 1 | 2016-04-17T11:00:22.000Z | 2016-04-17T11:00:22.000Z | x_rebirth_station_calculator/station_data/wares/spaceweed.py | Phipsz/XRebirthStationCalculator | ac31c2f5816be34a7df2d7c4eb4bd5e01f7ff835 | [
"MIT"
] | null | null | null | x_rebirth_station_calculator/station_data/wares/spaceweed.py | Phipsz/XRebirthStationCalculator | ac31c2f5816be34a7df2d7c4eb4bd5e01f7ff835 | [
"MIT"
] | null | null | null | from x_rebirth_station_calculator.station_data.station_base import Ware
names = {'L044': 'Spaceweed',
'L049': 'Raumkraut'}
Spaceweed = Ware(names)
| 22.571429 | 71 | 0.727848 | 19 | 158 | 5.789474 | 0.736842 | 0.163636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044776 | 0.151899 | 158 | 6 | 72 | 26.333333 | 0.776119 | 0 | 0 | 0 | 0 | 0 | 0.164557 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cd9c927aab91519ede516615bed22cc656e28319 | 1,557 | py | Python | pythonexercises/arrays/lists.py | KarenKawaii/2.7-python-dev-KarenKawaii | 54667ab85a6ed6ce68808b4ca5e29b842b80d4af | [
"Apache-2.0"
] | null | null | null | pythonexercises/arrays/lists.py | KarenKawaii/2.7-python-dev-KarenKawaii | 54667ab85a6ed6ce68808b4ca5e29b842b80d4af | [
"Apache-2.0"
] | null | null | null | pythonexercises/arrays/lists.py | KarenKawaii/2.7-python-dev-KarenKawaii | 54667ab85a6ed6ce68808b4ca5e29b842b80d4af | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
'''
Lists
Is a type of ordered collection.
Known as array or vectors in other languages.
To create a list is so simple as indicate
between brackets and separated by commas the
values to include them in the list.
'''
# List
# Example 1
print "## Example for a list ##"
print "L = [22, True, 'one list', [1,2]]"
L = [22, True, 'one list', [1, 2]]
print L
# You can access to every single element of the list
# Writing the list name and indicating the index for
# the element between brackets.
# Note: The index for the first element of the list is 0, not 1.
# Example 2
print "## Example to access an element in the list. ##"
print "L2 = [11, False]"
L2 = [11, False]
print L2
print "ELEMENT_LIST = L2[0]"
ELEMENT_LIST = L2[0]
print ELEMENT_LIST
print "The element list value is 11."
# To access an element from the list included in other list.
# We have to use two times this operator. First, to indicate
# what position from the external list we want to access,
# the second to select the element from the internal list.
print "## Example to access an element from a list into another list. ##"
INTERNAL_LIST = ["one list", [1, 2]]
print INTERNAL_LIST
print "ELEM_INTERNAL_LIST = INTERNAL_LIST[1][0]"
ELEM_INTERNAL_LIST = INTERNAL_LIST[1][0]
print ELEM_INTERNAL_LIST
# Yo can update an element in the list with the previous method.
print "## Update an element in the list. ##"
print "L3 = [22, True]"
L3 = [22, True]
print L3
print "L[0] = 99"
L3[0] = 99
print "## The element is updated.##"
print L3
| 26.389831 | 73 | 0.696853 | 266 | 1,557 | 4.030075 | 0.334586 | 0.052239 | 0.033582 | 0.025187 | 0.24347 | 0.202425 | 0.085821 | 0 | 0 | 0 | 0 | 0.037995 | 0.205523 | 1,557 | 58 | 74 | 26.844828 | 0.828618 | 0.338471 | 0 | 0.076923 | 0 | 0 | 0.490272 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.730769 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
cdb33cde5087ce5462db485ccfcc1afcbedc88b2 | 769 | py | Python | access360/api/model/accountModel.py | Kokoserver/lafiamiApi | f315d026096def948db4bd7a00d76b12fa09f247 | [
"MIT"
] | null | null | null | access360/api/model/accountModel.py | Kokoserver/lafiamiApi | f315d026096def948db4bd7a00d76b12fa09f247 | [
"MIT"
] | null | null | null | access360/api/model/accountModel.py | Kokoserver/lafiamiApi | f315d026096def948db4bd7a00d76b12fa09f247 | [
"MIT"
] | null | null | null | from uuid import uuid4
from datetime import datetime
from mongoengine import Document,DateField, StringField, BooleanField, EmailField
class UserAccount(Document):
username = StringField(required=True, min_length=3)
email = EmailField(required=True, unique=True)
gender = StringField(choices=("male", "female"), required=True)
password = StringField(required=True)
active = BooleanField(default=True)
admin = BooleanField(default=True)
created_at = DateField(default=datetime.utcnow())
meta = {"db_alias":"core"}
def to_json(self, *args, **kwargs):
return {
"id":str(self.id),
"username":self.username,
"email":self.email,
"created_at":str(self.created_at)
}
| 33.434783 | 81 | 0.664499 | 84 | 769 | 6.011905 | 0.535714 | 0.09505 | 0.091089 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003317 | 0.215865 | 769 | 22 | 82 | 34.954545 | 0.834163 | 0 | 0 | 0 | 0 | 0 | 0.061198 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0.052632 | 0.157895 | 0.052632 | 0.736842 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
cdc3502f3989175032535e25ca68edaf0fbd92a2 | 8,734 | py | Python | django_b2/storage.py | pyutil/django-b2 | 0a34c3fbb56031bf5e90cc794ce4c50ab8ed816a | [
"MIT"
] | 6 | 2020-02-05T14:13:55.000Z | 2021-02-21T17:07:35.000Z | django_b2/storage.py | pyutil/django-b2 | 0a34c3fbb56031bf5e90cc794ce4c50ab8ed816a | [
"MIT"
] | 4 | 2020-02-29T18:47:05.000Z | 2020-11-04T13:45:04.000Z | django_b2/storage.py | pyutil/django-b2 | 0a34c3fbb56031bf5e90cc794ce4c50ab8ed816a | [
"MIT"
] | null | null | null | """
B2Storage
uses b2sdk
add this to your Django settings:
DEFAULT_FILE_STORAGE = 'django_b2.storage.B2Storage'
B2_APP_KEY_ID = '000xxxxxxxxxxxx000000000n'
B2_APP_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
B2_BUCKET_NAME = '<bucket-name>'
this storage makes names unique by change path/name into path/<uuid>/name
so it is not compatible with storage uploaded using django-backblazeb2-storage
where files with same names are uploaded without name change and as versions of same file
behaviour of exceptions (FileNotFoundError, NotADirectoryError, ..) is not fully compatible
methods _open, _save works but need experienced revision and rewrite (please help)
"""
import importlib
from io import BytesIO
import os
from datetime import datetime
from django.conf import settings
from django.core.files.storage import FileSystemStorage, Storage
from django.core.files.base import ContentFile, File
from django.utils.deconstruct import deconstructible
from django_b2.backblaze_b2 import BackBlazeB2
# B2File related imports, TODO: mix with non-experimental imports if B2File will be used
from shutil import copyfileobj
from tempfile import SpooledTemporaryFile
# if 'L' in settings.B2_LOCAL_MEDIA, list (log) of uploaded files will be created in MEDIA_ROOT/<LOG_LOCATION>
LOG_LOCATION = '_log'
LOGFILE_PREFIX = 'upload_'
# experimental (B2File class, B2Storage._open), inspired from django-storages DropBoxFile
# TODO: this works, but need revision and rewrite, please help!
@deconstructible
class B2File(File):
def __init__(self, name, download_dest):
self.name = name
self._download_dest = download_dest
self._file = None
def _get_file(self):
if self._file is None:
self._file = SpooledTemporaryFile()
with BytesIO(self._download_dest.get_bytes_written()) as file_content:
copyfileobj(file_content, self._file)
self._file.seek(0)
# self._download_dest = None
return self._file
def _set_file(self, value):
self._file = value
file = property(_get_file, _set_file)
standard_mode = True
if 'B2Storage' not in settings.DEFAULT_FILE_STORAGE:
"""
not sure if this could work properly but the goal is to make following in tests possible:
from django.test import override_settings
@override_settings(DEFAULT_FILE_STORAGE='django.core.files.storage.FileSystemStorage')
see https://github.com/pyutil/django-b2/issues/4
"""
dfs = settings.DEFAULT_FILE_STORAGE.rsplit('.', 1) # ['django.core.files.storage', 'FileSystemStorage']
if len(dfs) == 2:
standard_mode = False
module_name, class_name = dfs
module = importlib.import_module(module_name)
B2Storage = getattr(module, class_name)
if standard_mode:
"""
standard working mode, with B2Storage
"""
@deconstructible
class B2Storage(Storage):
location = '' # required at least for django-tenant-schemas
_b2 = None
_fs = None
_log = None
@property
def b2(self):
self.check_init()
return self._b2
@property
def fs(self):
self.check_init()
return self._fs
@property
def log(self):
self.check_init()
return self._log
def check_init(self):
# we always check for _b2, because _fs & _log can stay None after lazy_init
if self._b2 is None:
self.lazy_init()
def lazy_init(self):
application_key_id = settings.B2_APP_KEY_ID
application_key = settings.B2_APP_KEY
bucket_name = settings.B2_BUCKET_NAME
self._b2 = BackBlazeB2(force_unique=getattr(settings, 'B2_FORCE_UNIQUE', True))
self.authorize(application_key_id, application_key)
self.set_bucket(bucket_name)
if hasattr(settings, 'B2_LOCAL_MEDIA'):
assert settings.MEDIA_ROOT, 'B2_LOCAL_MEDIA used. Please set MEDIA_ROOT in your settings.'
if 'M' in settings.B2_LOCAL_MEDIA:
self._fs = FileSystemStorage()
if 'L' in settings.B2_LOCAL_MEDIA:
self._log = os.path.join(settings.MEDIA_ROOT, LOG_LOCATION)
os.makedirs(self._log, exist_ok=True)
# you can re-authorize later
def authorize(self, application_key_id, application_key):
return self.b2.authorize("production", application_key_id, application_key)
# you can change bucket later
def set_bucket(self, bucket_name):
return self.b2.set_bucket(bucket_name)
# ------------- django Storage extension --------------
# method added with regard to Django 3.0 compatibility, both (available/alternative) do the same: add <uuid>/
def get_alternative_name(self, file_root, file_ext=''):
name = '%s%s' % (file_root, file_ext)
return self.b2.get_alternative_name(name)
# both (available/alternative) do the same: add <uuid>/
# important to have this: to prevent inefficient .exists() call
def get_available_name(self, name, max_length=None):
return self.b2.get_alternative_name(name)
def _open(self, name, mode='rb'):
'''
# this is based on django-backblazeb2-storage
# TODO: this works, but need revision and rewrite, please help!
resp = self.b2.download_file(name)
output = BytesIO()
output.write(resp)
output.seek(0)
return File(output, name)
'''
if self.fs is not None and os.path.isfile(os.path.join(settings.MEDIA_ROOT, name)):
try:
return self.fs._open(name)
except Exception:
pass
# this is inspired by django-storage:DropBox
# TODO: this works, but need revision and rewrite, please help!
download_dest = self.b2.download_file_download_dest(name)
return B2File(name, download_dest)
def _save(self, name, f, max_length=None):
if self.fs is not None:
self.fs.save(name, ContentFile(f.read()))
f.seek(0)
if self.log is not None:
log_file = self.get_logfile_name(datetime.now())
log_file = os.path.join(self.log, log_file)
with open(log_file, 'a') as lf:
lf.writelines([name + '\n'])
response = self.b2.upload_file(name, f)
return response.file_name
@staticmethod
def get_logfile_name(dt):
return LOGFILE_PREFIX + dt.isoformat()[:13]
def delete(self, name):
return self.b2.delete_by_name(name)
# maybe expensive
def listdir(self, path):
return self.b2.listdir(path)
def exists(self, name):
return self.b2.file_id_by_name(name) is not None or self.b2.file_id_by_name(self.b2.get_original_name(name)) is not None
def size(self, name):
return self.b2.get_file_info_by_name(name)['contentLength']
def url(self, name):
return self.b2.get_download_url(name)
def xxxpath(self, name):
# this was here but seems this is problem because at least Wagtail determinates by retval if the file is stored
# locally, so it should (seems) return a full path not the relative one
# # This is needed because Django will throw an exception if it's not
# # overridden by Storage subclasses. We don't need it.
# return name
'''
"""
Return a local filesystem path where the file can be retrieved using
Python's built-in open() function. Storage systems that can't be
accessed using open() should *not* implement this method.
"""
raise NotImplementedError("This backend doesn't support absolute paths.")
'''
full = os.path.join(settings.MEDIA_ROOT, name)
if os.path.isfile(full):
return full
return super().path(name)
def get_accessed_time(self, name):
return self.b2.get_accessed_time(name, use_tz=settings.USE_TZ)
def get_created_time(self, name):
return self.b2.get_created_time(name, use_tz=settings.USE_TZ)
def get_modified_time(self, name):
return self.b2.get_modified_time(name, use_tz=settings.USE_TZ)
| 37.646552 | 132 | 0.629837 | 1,101 | 8,734 | 4.811989 | 0.255223 | 0.02265 | 0.029445 | 0.02416 | 0.216497 | 0.156474 | 0.108532 | 0.05436 | 0.03926 | 0.02718 | 0 | 0.012526 | 0.287039 | 8,734 | 231 | 133 | 37.809524 | 0.838285 | 0.286467 | 0 | 0.08 | 0 | 0 | 0.025793 | 0 | 0 | 0 | 0 | 0.012987 | 0.008 | 1 | 0.192 | false | 0.008 | 0.096 | 0.096 | 0.52 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
cdca704d58f3d7e9fe99c1bc1db1ea5a3eb526cd | 151 | py | Python | iso8583_dlib/segments/data/header/header_PI.py | eocode/ISO8583-Dlib | c757883812206504d8ad0a63077562fdaffcb118 | [
"MIT"
] | null | null | null | iso8583_dlib/segments/data/header/header_PI.py | eocode/ISO8583-Dlib | c757883812206504d8ad0a63077562fdaffcb118 | [
"MIT"
] | null | null | null | iso8583_dlib/segments/data/header/header_PI.py | eocode/ISO8583-Dlib | c757883812206504d8ad0a63077562fdaffcb118 | [
"MIT"
] | null | null | null | pi = {
"00": {
"value": "00",
"description": "Base"
},
"02": {
"value": "02",
"description": "POS"
}
}
| 13.727273 | 29 | 0.324503 | 11 | 151 | 4.454545 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094118 | 0.437086 | 151 | 10 | 30 | 15.1 | 0.482353 | 0 | 0 | 0 | 0 | 0 | 0.311258 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cdce753a96af8c79424dda3c4290641728cdd351 | 323 | py | Python | database/app/api/games/sdvx/models/__init__.py | skielred/FairyJokeAPI | 71228e477bc6dd259e6f5f7e09b30c1e23ab96a3 | [
"MIT"
] | 3 | 2021-12-18T11:09:08.000Z | 2022-03-31T22:42:19.000Z | database/app/api/games/sdvx/models/__init__.py | skielred/FairyJokeAPI | 71228e477bc6dd259e6f5f7e09b30c1e23ab96a3 | [
"MIT"
] | null | null | null | database/app/api/games/sdvx/models/__init__.py | skielred/FairyJokeAPI | 71228e477bc6dd259e6f5f7e09b30c1e23ab96a3 | [
"MIT"
] | null | null | null | from .apeca import SDVXApeca as Apeca, SDVXApecaImport as ApecaImport
from .difficulty import (
SDVXDifficulty as Difficulty,
SDVXDifficulties as Difficulties,
SDVXDifficultyImport as DifficultyImport,
)
from .music import (
SDVXMusic as Music,
SDVXMusicGenre as MusicGenre,
SDVXGenres as Genres,
)
| 26.916667 | 69 | 0.767802 | 33 | 323 | 7.515152 | 0.575758 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188854 | 323 | 11 | 70 | 29.363636 | 0.946565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.363636 | 0 | 0.363636 | 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 | 0 | 0 | 0 | 2 |
a808461abfe42e9b847aa5286331e76fc3c3d2b4 | 220 | py | Python | kyria/bot/events/client/ready_event.py | SubeCraft/Kyria | f31463c8b0d1cba2e2b22800d0a10ce6264bad4e | [
"MIT"
] | null | null | null | kyria/bot/events/client/ready_event.py | SubeCraft/Kyria | f31463c8b0d1cba2e2b22800d0a10ce6264bad4e | [
"MIT"
] | null | null | null | kyria/bot/events/client/ready_event.py | SubeCraft/Kyria | f31463c8b0d1cba2e2b22800d0a10ce6264bad4e | [
"MIT"
] | null | null | null | from logging import info
from hata import Client
from kyria import __version__
kyria_client: Client
@kyria_client.events
async def ready(client: Client) -> None:
info(f"{client.name} v{__version__} is ready !")
| 16.923077 | 52 | 0.754545 | 32 | 220 | 4.875 | 0.53125 | 0.141026 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159091 | 220 | 12 | 53 | 18.333333 | 0.843243 | 0 | 0 | 0 | 0 | 0 | 0.177273 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.428571 | 0 | 0.428571 | 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 | 0 | 0 | 0 | 2 |
a81a64d771f091c7c58a558ee3ffcc526f54d947 | 576 | py | Python | plyer/platforms/ios/barometer.py | magnusvmt/plyer | e1954d975ea2c087fc4a79d5e0708b79dbe26caa | [
"MIT"
] | 3 | 2020-07-17T16:23:14.000Z | 2021-05-25T21:00:49.000Z | plyer/platforms/ios/barometer.py | magnusvmt/plyer | e1954d975ea2c087fc4a79d5e0708b79dbe26caa | [
"MIT"
] | 1 | 2021-05-25T20:54:22.000Z | 2021-05-26T20:22:30.000Z | plyer/platforms/ios/barometer.py | magnusvmt/plyer | e1954d975ea2c087fc4a79d5e0708b79dbe26caa | [
"MIT"
] | 1 | 2019-05-17T09:45:00.000Z | 2019-05-17T09:45:00.000Z | '''
iOS Barometer
-------------
'''
from plyer.facades import Barometer
from pyobjus import autoclass
class iOSBarometer(Barometer):
def __init__(self):
super(iOSBarometer, self).__init__()
self.bridge = autoclass('bridge').alloc().init()
def _enable(self):
self.bridge.startRelativeAltitude()
def _disable(self):
self.bridge.stopRelativeAltitude()
def _get_pressure(self):
'''
1 kPa = 10 hPa
'''
return (
self.bridge.pressure * 10)
def instance():
return iOSBarometer()
| 18 | 56 | 0.602431 | 56 | 576 | 5.982143 | 0.5 | 0.119403 | 0.083582 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011765 | 0.262153 | 576 | 31 | 57 | 18.580645 | 0.776471 | 0.072917 | 0 | 0 | 0 | 0 | 0.011928 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.133333 | 0.066667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
a81a7e787178cfb6c2659ee70ab225acc9300252 | 149 | py | Python | app/client_settings.py | DrunkJedi/twisted_smpp_client_server | 2f4499cec5606de84e9b80022aaa677caf278b85 | [
"MIT"
] | null | null | null | app/client_settings.py | DrunkJedi/twisted_smpp_client_server | 2f4499cec5606de84e9b80022aaa677caf278b85 | [
"MIT"
] | 1 | 2015-02-11T05:27:32.000Z | 2015-02-11T05:27:32.000Z | app/client_settings.py | DrunkJedi/twisted_smpp_client_server | 2f4499cec5606de84e9b80022aaa677caf278b85 | [
"MIT"
] | null | null | null | HOST = '0.0.0.0'
LOGIN = 'login'
PASSWORD = 'password'
PORT = 2775
SMSCOUNT = 10
try:
from local_settings import *
except ImportError:
pass | 13.545455 | 32 | 0.671141 | 21 | 149 | 4.714286 | 0.761905 | 0.060606 | 0.060606 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08547 | 0.214765 | 149 | 11 | 33 | 13.545455 | 0.760684 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.222222 | 0.222222 | 0 | 0.222222 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
a8363dc159163ca64d3db1141d9d21eb1d147d67 | 376 | py | Python | dj_graphene/mixins.py | YasielCabrera/dj-graphene | a7fd6d88c3c50252ca6eb9374dd00466f222407d | [
"MIT"
] | null | null | null | dj_graphene/mixins.py | YasielCabrera/dj-graphene | a7fd6d88c3c50252ca6eb9374dd00466f222407d | [
"MIT"
] | null | null | null | dj_graphene/mixins.py | YasielCabrera/dj-graphene | a7fd6d88c3c50252ca6eb9374dd00466f222407d | [
"MIT"
] | null | null | null | class PermissionsMixin:
@classmethod
def get_permissions(cls, info):
return [permission(info) for permission in cls._meta.permission_classes]
@classmethod
def check_permissions(cls, info):
for permission in cls.get_permissions(info):
if not permission.has_permission():
raise PermissionError('Permission denied.')
| 31.333333 | 80 | 0.68617 | 40 | 376 | 6.3 | 0.525 | 0.111111 | 0.142857 | 0.150794 | 0.174603 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.234043 | 376 | 11 | 81 | 34.181818 | 0.875 | 0 | 0 | 0.222222 | 0 | 0 | 0.047872 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0.111111 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
b517923c94832e6470e4d062c126ad3508a9f78e | 1,052 | py | Python | examples/tables.py | matalata/inventory_it | d38a21a738708edc55eed150b6bae8fd6e4c8a31 | [
"MIT"
] | null | null | null | examples/tables.py | matalata/inventory_it | d38a21a738708edc55eed150b6bae8fd6e4c8a31 | [
"MIT"
] | 2 | 2020-06-05T23:29:34.000Z | 2021-06-10T22:03:31.000Z | examples/tables.py | matalata/inventory_it | d38a21a738708edc55eed150b6bae8fd6e4c8a31 | [
"MIT"
] | null | null | null | import django_tables2 as tables
from .models import equipment
class equipmentTable(tables.Table):
T_read =('<button type=\"button\" class=\"read-book btn btn-sm btn-primary\" data-id="{% url \'read_book\' record.pk %}\"><span class=\"fa fa-eye\"></span> </button>')
read = tables.TemplateColumn(T_read); read.verbose_name=''
T_edit =('<button type=\"button\" class=\"update-book btn btn-sm btn-primary\" data-id="{% url \'update_book\' record.pk %}\"><span class=\"fa fa-pencil\"></span> </button>')
edit = tables.TemplateColumn(T_edit); edit.verbose_name=''
T_del =('<button type=\"button\" class=\"delete-book btn btn-sm btn-danger\" data-id="{% url \'delete_book\' record.pk %}\"><span class=\"fa fa-trash\"></span> </button>')
delele = tables.TemplateColumn(T_del); delele.verbose_name=''
#delete2 = tables.TemplateColumn('<a href="{% url "delete_division" record.pk %}"> width="25"></a>',verbose_name=u'Delete',)
class Meta:
model = equipment
template_name = "django_tables2/bootstrap.html"
| 55.368421 | 179 | 0.663498 | 145 | 1,052 | 4.696552 | 0.344828 | 0.04699 | 0.070485 | 0.092511 | 0.223201 | 0.201175 | 0.201175 | 0.091043 | 0.091043 | 0 | 0 | 0.005482 | 0.13308 | 1,052 | 18 | 180 | 58.444444 | 0.741228 | 0.11692 | 0 | 0 | 0 | 0.25 | 0.505388 | 0.03125 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
b51976fa99d77ea73e81908007d0b34a78bf8a90 | 304 | py | Python | bin/base64_.py | pelavarre/pybashish | 03f74356fb0a2a0ef7106f09c059fd9b375ce89a | [
"CNRI-Python"
] | 4 | 2020-07-10T20:16:13.000Z | 2022-02-16T02:11:20.000Z | bin/base64_.py | pelavarre/pybashish | 03f74356fb0a2a0ef7106f09c059fd9b375ce89a | [
"CNRI-Python"
] | null | null | null | bin/base64_.py | pelavarre/pybashish | 03f74356fb0a2a0ef7106f09c059fd9b375ce89a | [
"CNRI-Python"
] | 2 | 2020-06-24T20:37:36.000Z | 2020-07-10T20:16:17.000Z | #!/usr/bin/env python3
# quirks:
# doesn't redefine the 'import base64' of https://docs.python.org/3/library/base64.html
import sys
sys.stderr.write("base64.py: error: not implemented\n")
sys.exit(2) # exit 2 from rejecting usage
# copied from: git clone https://github.com/pelavarre/pybashish.git
| 25.333333 | 87 | 0.736842 | 49 | 304 | 4.571429 | 0.795918 | 0.044643 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037453 | 0.121711 | 304 | 11 | 88 | 27.636364 | 0.801498 | 0.690789 | 0 | 0 | 0 | 0 | 0.393258 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 0 | 0 | 0 | 2 |
b53b82f24520b16612909b74c7dfaebc03dbc4bf | 23,962 | py | Python | python-parser/production_rules.py | lab156/CNL-CIC | b2f5097f0074442e0d0a4b18ceb8ed0824d4dd4c | [
"MIT"
] | 14 | 2019-06-27T16:34:39.000Z | 2021-01-07T18:13:04.000Z | python-parser/production_rules.py | lab156/CNL-CIC | b2f5097f0074442e0d0a4b18ceb8ed0824d4dd4c | [
"MIT"
] | 8 | 2019-10-17T06:09:51.000Z | 2020-03-25T15:51:32.000Z | python-parser/production_rules.py | lab156/CNL-CIC | b2f5097f0074442e0d0a4b18ceb8ed0824d4dd4c | [
"MIT"
] | 17 | 2019-06-27T16:34:53.000Z | 2020-08-15T01:30:32.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 17:00:38 2020
@author: thales
"""
"""production rules for Colada"""
import copy
import msg
import word_lists
import lib
import lexer
import parser_combinator as c
from parser_combinator import (Parse, ParseError,
first_word,
first_phrase, next_word,
next_phrase, next_value)
# globals
# parse_level determines how complete the parsing is.
# not in use
#
production_dict = {
'level_enum' : {'reparse','reparse','minimal'},
'parse_level' : 'full'
}
reparser = {
'type' : (lambda item : item),
'expr' : (lambda item : item)
}
def reparse(s:str) -> Parse:
try:
return reparser[s]
except KeyError as k:
msg.error(f'Bad reparse key: {k}')
raise k
def cs_brace(cs_parse:Parse,brace_parse:Parse) -> Parse:
"""control sequence parser including arguments in braces.
cs_parse is used to parse cs and brace_parse to parse each braced arg."""
return cs_parse + c.brace(brace_parse).many()
def phrase_list_transition():
"""parser for transition phrases"""
prs = [next_phrase(s) for s in word_lists.transition]
return (Parse.first(prs) + next_word('that').possibly()).nil()
def phrase_list_filler():
"""parser for filler words"""
return (Parse.word('we').possibly() + first_word('put write have know see') +
Parse.word('that').possibly()).nil()
# case_sensitive_word -> use next_value(s)
# Atomic identifiers cannot be a single letter (a short var)
# wordlike atomic identifiers are case insensitive and can have synonym.
# but hierarchical identifiers are always case sensitive.
def atomic():
#I forget why I am converting integers.
"""parser for atomic identifiers, converting words and integers as needed"""
def f(item):
item1 = Parse.next_token().process(item)
result = item1.tok
if result.type == 'INTEGER' or result.type == 'WORD':
tok = copy.copy(result)
if tok.type == 'WORD':
tok.value = c.synonymize(tok.value)
tok.type = 'ATOMIC_IDENTIFIER'
return (tok,item1)
if result.type == 'ATOMIC_IDENTIFIER':
return result
raise ParseError(item)
return Parse(f).expect('atomic')
def expr():
"""parse for expression (term, type, or prop)."""
def p(tok):
# commas can appear in quantified variables
return not(tok.value in [';','.'])
return reparse('expr').process(c.balanced_condition(p))
def assign_expr():
"""parser for := followed by an expression
The output is the expression
"""
return (next_value(':=') + expr()).treat(lib.snd)
def var():
"""parser for a single variable.
Accepts a single token that is a variable."""
return Parse.next_token().if_type(['VAR']).expect('var')
def var_or_atomic():
"""parser for a var or atomic identifier.
Output of parser is a single token of one of those types."""
return (var() | atomic()).expect('var_or_atomic')
def var_or_atomics():
"""parser for a sequence of one or more var or atomics"""
return Parse.plus(var_or_atomic())
def var_or_atomic_or_blank():
"""parser for var or atomic or _.
The parser output is a single token that is one of those types."""
return var_or_atomic() | next_value('_')
def hierarchical_identifier():
"""parser for hierarchical identifiers.
Parser output is a single token."""
return Parse.next_token().if_type(['HIERARCHICAL_IDENTIFIER'])
def identifier():
"""parser for hierarchical or atomic identifier.
Parser output is a single token"""
return (atomic() | hierarchical_identifier()).expect('identifier')
# canned phrases that have small variants
# lit[w] gives parser for w-like words or phrases
lit_dict = {
'a' : first_word('a an'), #indefinite
'article' : first_word('a an the'),
'defined-as' : first_phrase(['said to be','defined as','defined to be']),
'is' : first_phrase(['is','are','be','to be']),
'iff': (first_phrase(['iff','if and only if']) |
(first_phrase(['is','are','be','to be']) + next_word('the').possibly() + next_word('predicate'))),
'denote': first_phrase(['denote','stand for']),
'do': first_word('do does'),
'equal': next_phrase('equal to'),
'has': first_word('has have'),
'with': first_word('with of having'),
'true': first_word('on true yes'),
'false': first_word('off false no'),
'wrong': next_phrase('it is wrong that'),
'exist': next_word('exist'),
'lets': first_phrase(['let','let us','we','we can']),
'fix': first_word('fix let'),
'assume': first_word('assume suppose'),
'then': first_word('then therefore hence'),
'choose': first_word('take choose pick'),
'prove': first_word('prove show'),
'say': first_word('say write'),
'we-say': (next_word('we').possibly() +
first_word('say write') +
next_word('that').possibly()
),
'assoc': first_word('left right no'),
'field-key': first_word('coercion notationless notation parameter type call'),
'qed': first_word('end qed obvious literal'),
'document': first_word('document article section subsection subsubsection subdivision division'),
'end-document': first_word('endsection endsubsection endsubsubsection enddivision endsubdivision'),
'def': first_word('def definition'),
'axiom': first_word('axiom conjecture hypothesis equation formula'),
'with-property': next_phrase('with property'),
'param': next_phrase('with parameter'),
'theorem': first_word('proposition theorem lemma corollary'),
# type proposition property classsifier atomic
}
def lit(s):
"""parser generator for 's'-like words or phrases"""
if s in ['record','doc','location']:
if s =='record':
return (Parse.word('we').possibly() +
first_word('record register') +
Parse.word('identification').possibly() +
Parse.word('that').possibly())
if s == 'doc':
return lit['document'] | lit['end-document']
if s == 'location':
return Parse.first([lit_dict['document'],lit_dict['theorem'],lit_dict['axiom']])
return lit_dict[s]
#others:
#label = atomic
period = next_value('.').clear_history()
comma = next_value(',')
semicolon = next_value(';')
colon = next_value(':')
#renamed map -> call
# instructions do nothing except store for now
instruct = {}
class Instruction:
def _param_value(ls):
if ls == []:
return ''
tok = ls[0]
if tok.type == 'INTEGER':
return int(tok.value)
if tok.value.lower() in ['yes','true','on']:
return True
if tok.value.lower() in ['no','false','off']:
return False
return tok.value
def _expand_slashdash(vs):
"""expanding synonyms
e.g. word/-ing is short for word/wording"""
for i in range(len(vs)):
if vs[i]== '/-':
vs[i]= '/'
vs[i+1]= vs[i-1]+vs[i+1]
return [v for v in vs if v != '/']
#test
#print(expand_slashdash(['work','/-','ing','/','effort','workaround']))
#['work', 'working', 'effort', 'workaround']
def _syn():
"""parsing synonyms"""
def p(tok):
tok.value in ['/','/-'] or c.can_wordify(tok)
synlist = Parse.next_token().if_test(p).plus()
return c.comma_nonempty_list(synlist)
def instruction():
"""parsing and processing of synonyms and other instructions"""
def treat_syn(acc):
for ac in acc:
vs = [t.value for t in ac]
v_expand = Instruction._expand_slashdash(vs)
c.synonym_add(v_expand)
return ()
def treat_instruct(acc):
keyword,ls = acc
instruct[keyword.value] = Instruction._param_value(ls)
return ()
keyword_instruct = (first_word("""exit timelimit printgoal dump
ontored read library error warning""") +
Parse.next_token().possibly())
return (c.bracket(next_word('synonym') + Instruction._syn().treat(treat_syn) |
c.bracket(keyword_instruct.treat(treat_instruct))))
def this_exists():
"""parsing of 'this'-directives.
DEBUG: Remove this feature. Deprecated Unfinished"""
def adjective(tok):
s1 = tok.value.lower.replace('_','')
return s1 in ['unique','canonical','welldefined','wellpropped','total','exhaustive']
def this_directive_right_attr():
return next_phrase('by recursion')
def this_directive_pred():
return c.andcomma_nonempty_list(Parse.next_token().if_test(adjective))
return first_phrase(['this exist','this is'])
def post_colon_balanced():
def p(token):
return token.value not in ['end','with',':=',';','.',',','|',':']
return c.balanced_condition(p)
def meta_tok():
tok = c.mk_token({'type':'META','value':str(meta_tok.count)})
meta_tok.count += 1
return tok
# tok = copy.copy(c.init_item.tok)
# tok.value = str(meta_tok.count)
# tok.type = 'META'
# meta_tok.count += 1
# return tok
def colon_annotation(prs): #was opt_colon_type, opt_colon_sort
"""Parser for ': A', discarding the colon.
A is parsed by prs.
Parser returns an empty list if there is no annotation."""
#def trt1(toks):
# if len(toks)==0:
# return toks
# return prs.process(toks)
prs1= (next_value(':') + post_colon_balanced()).treat(lib.snd).possibly().treat(lib.fflatten)
return prs1.reparse(prs)
def colon_annotation_or_meta(prs): #was opt_colon_type_meta, opt_colon_sort_meta
"""Parser for annotation ': A', discarding the colon.
If no annotation, parser returns a meta-variable.
A is parsed using prs."""
def trt(acc):
if acc == [] or acc == None:
return meta_tok()
return acc
return colon_annotation(prs).treat(trt)
# differ only in treatment
#def opt_colon_sort():
# return opt_colon_type()
#def opt_colon_sort_meta():
# return opt_colon_type_meta()
def annotated_var(prs):
"""
Parser for annotated variable in parentheses.
Annotation is parsed with prs.
Parser output is a var token
annotation is stored in attribute 'annotation' of var token.
Sample input to parser:
(x : A)
"""
def trt(acc):
v,ann = acc
if len(ann) > 0:
return c.copy_token(v,{'annotation':ann[0]})
return v
return c.paren(var() + colon_annotation(prs)).treat(trt)
#def annotated_sort_vars():
# return c.paren(var().plus() + opt_colon_type_meta())
def annotated_vars(prs):
"""Parser for list of annotated variables, parsing annotation with prs
Missing annotation added as a metavariable.
Variables within the parentheses are constrained to have the same type.
Sample input:
(x y z : A)
(u v)
Output is a list of annotated vars using attribute 'annotation'
"""
def trt(acc):
vs,ann = acc
if len(ann)==0:
return vs
assert(len(ann)==1)
return [c.copy_token(v,ann[0]) for v in vs]
return c.paren(var().plus() + colon_annotation_or_meta()).treat(trt)
def let_annotation_prefix():
return (next_word('let') + c.comma_nonempty_list(var()) +
next_word('be') + lit('a').possibly() +
next_word('fixed').possibly())
def let_annotation():
"""Parser for let_annotations. Terminating punctuation not included.
Sample parser inputs:
Let G be a group
Let G be a fixed group
Let (H G : group)
Fix (x : R)
Issues: No treatment for now, but return to this later.
"""
return ((first_word( 'fix let') + c.comma_nonempty_list(annotated_sort_vars)) |
let_annotation_prefix() + post_colon_balanced())
def brace_assign():
def brace_assign_item():
return (var_or_atomic_or_blank()+ opt_colon_sort() + assign_expr().possibly())
return c.brace_semi().reparse_list(brace_assign_item)
def brace_noassign():
def brace_noassign_item():
return (var_or_atomics() + opt_colon_sort_meta())
return c.brace_semi().reparse_list(brace_noassign_item())
def nonkey(): #was not_banned
keyword = [
'is','be','are','denote','define','enter','namespace','stand',
'if','iff','inferring','the','a','an','we','say','write',
'assume','suppose','let','said','defined','or','fix','fixed'
]
def p(token):
return not(c.singularize(token.value) in keyword)
return c.next_type(['VAR','WORD','ATOMIC_IDENTIFIER']).if_test(p)
def args_template():
"""Form of arguments to a function declaration"""
def required_arg_template_pat():
return (
(c.paren(var_or_atomics() + opt_colon_sort_meta())) |
var_or_atomic()
)
return (brace_noassign().possibly() + required_arg_template_pat().many())
def any_controlseq(): #was controlseq
return c.next_type(['CONTROLSEQ'])
def controlseq(s): #was the_controlseq
"""Parser for a particular control sequence 's'.
s includes the backslash."""
return any_controlseq().if_value(s)
def any_symbol(): # was symbol
return c.next_type(['SYMBOL'])
def symbol(s): # was the_symbol
return any_symbol().if_value(s)
# PROOFS
class Proof:
"""Parser constructors for proof statements"""
def canned():
"""parser for canned proof statements"""
return (next_phrase("we proceed as follows") |
(next_word('the') +
first_word('result lemma theorem proposition corollary') +
next_word('now').possibly() +
next_word('follows')) |
next_phrase('the other cases are similar') |
(next_phrase('the proof is')+ first_word('obvious trivial easy routine'))).nil().expect('canned')
def then_prefix():
return lit('then').possibly()
def assumption():
assumption_prefix = lit('lets')+ lit('assume') + next_word('that').possibly()
return ((assumption_prefix + c.balanced() + period) |
let_annotation() + period)
def possibly_assumption():
return (Proof.assumption().many() + Proof.then_prefix())
def axiom_preamble():
return lit('axiom')+ atomic().possibly() + period
def moreover_statement():
return next_word('moreover') + c.balanced() + period
def axiom():
return Proof.axiom_preamble() + Proof.possibly_assumption() + c.balanced() + period + Proof.moreover_statement.many()
def ref_item():
return c.andcomma_nonempty_list(lit('location').possibly() + atomic())
def by_ref():
return c.paren(next_word('by') + Proof.ref_item()).possibly()
def by_method():
def no_that(tok):
return tok.value == 'that' # exclude avoids goal_prefix ambig.
return (next_word('by') +
(first_phrase(['contradiction','case analysis']) |
(next_word('induction') +
(next_word('on') + c.balanced_condition(no_that)).possibly())) +
Parse.probe(next_word('that')| period))
def choose_prefix():
return Proof.then_prefix() + lit('lets').possibly() + lit('choose')
def canned_prefix():
return c.andcomma_nonempty_list(phrase_list_transition())
def goal_prefix():
return ((lit('lets').possibly() + lit('prove') + next_word('that')) |
(Proof.by_method() + next_word('that')).possibly())
def preamble():
return ((next_word('proof') + Proof.by_method().possibly() + period) |
next_word('indeed'))
def affirm():
return Proof.statement() | Proof.goal()
def statement():
return Proof.then_prefix() + c.balanced() + Proof.by_ref() + period + Proof.moreover_statement.many() + Proof.script.possibly()
def goal():
return Proof.goal_prefix + c.balanced() + Proof.by_ref() + period + Proof.script()
def script():
return (Proof.preamble + (Proof.canned_prefix() + Proof.body() + Proof.canned_prefix + Proof.tail).many() + lit('qed') + period)
def body():
return (Proof.tail() | Proof.assumption())
def tail():
return (Proof.affirm() | Proof.canned() | Proof.case() | Proof.choose())
def case():
return (next_word('case') + c.balanced() + period + Proof.choose_justify())
def choose():
return (Proof.choose_prefix + c.balanced() + period + Proof.justify())
def justify():
return (Proof.script().possibly())
# patterns
pattern_key = ["is","be","are","denote","define"
"enter","namespace",
"stand","if","iff","inferring","the","a","an",
"we","say","write",
"assume","suppose","let",
"said","defined","or","fix","fixed" # and (need in 'resultant of f and g')
]
class Pattern:
"""Parser generators for patterns"""
def _nonkey():
"""Parser for any word except for keywords.
The token must be a WORD."""
def not_key(s):
return not (lexer.singularize(s.lower()) in pattern_key)
def p(tok):
return tok.type == 'WORD' and not_key(tok.value)
return next_word().if_test(p)
def _nonkey_extended():
"""parser for 'word (or word) (paren stuff)'.
(or word) gives a synonym as a parenthetical within
a word pattern. Side effect is a new global synonym."""
p = ((Pattern._nonkey() +
c.paren((next_word('or') + Pattern._nonkey()).treat(lib.snd).plus()).possibly()) +
c.paren(Pattern._nonkey().plus()).many())
def f(item):
item1 = p.process(item)
((a,bs),cs) = item1.acc
vals = [a.value]+ [i.value for i in bs]
c.synonym_add(vals)
return c.update((a,cs),item1)
return Parse(f)
def _var():
"""parser for a variable appearing in a pattern"""
return var() | c.paren(var() + opt_colon_sort)
def _nonkey_words():
return Pattern._nonkey_extended().plus()
def word_pattern():
"""Parser for a word pattern, consisting of variables,
words, and pattern parentheticals"""
return Pattern._nonkey_words() + (Pattern._var() + Pattern._unkey_words()).many() + Pattern._var().possibly()
def type_word_pattern():
return lit('a').possibly() + Pattern.word_pattern()
def function_word_pattern():
return next_word('the') + Pattern.word_pattern()
def notion_pattern():
return Pattern._var() + next_word('is') + lit('a') + Pattern.word_pattern()
def adjective_pattern():
return Pattern._var() + next_word('is') + next_word('called').possibly() + Pattern.word_pattern()
def var_multisubsect_pattern():
return (
(Pattern._var() + next_value(',') + Pattern._var()) |
c.paren(Pattern._var() + next_value(',') + Pattern._var() + opt_colon_type_meta())
)
def adjective_multisubject_pattern():
return (
Pattern.var_multisubsect_pattern() + next_word('are') + next_word('called').possibly() + Pattern.word_pattern()
)
def verb_pattern():
return Pattern._var() + Pattern.word_pattern()
def verb_multisubject_pattern():
return (Pattern.var_multisubsect_pattern() + Pattern.word_pattern())
def predicate_word_pattern():
return (
Pattern.notion_pattern() |
Pattern.adjective_pattern() |
Pattern.adjective_multisubject_pattern() |
Pattern.verb_pattern() |
Pattern.verb_multisubject_pattern()
)
def controlseq_pattern():
return any_controlseq() + c.brace(Pattern._var()).many()
def binary_controlseq_pattern():
return Pattern._var() + Pattern.controlseq_pattern() + Pattern._var()
def precedence_level(): #was paren_precedence_level
"""parser for the precedence level.
sample input:
'with precedence 10 and left associativity'
output: (integer,assoc), where assoc in ['left','right','no']."""
def _precedence_level():
def f(raw):
((_,i),pos) = raw
if len(pos)== 0:
l = 'no'
else:
l = pos[0][0][1]
return (int(i),l)
return (
(next_phrase('with precedence') + c.next_type('INTEGER')) +
(next_word('and') + lit('assoc') + next_word('associtivity')).possibly()
).treat(f)
return Pattern._precedence_level() | c.paren(Pattern._precedence_level())
def symbol_pattern():
return (
Pattern._var().possibly() + symbol() +
(Pattern._var() + symbol()).many() +
Pattern._var().possibly() + Pattern.precedence_level().possibly()
)
def binary_symbol_pattern():
"""Parser for binary symbol pattern.
Sample inputs:
x ^^ y with precedence 10 and right associativity
x ## y"""
return (
Pattern._var() + symbol() + Pattern._var() +
Pattern.precedence_level().possibly()
)
class Macro:
def insection():
"""Parser for in-section scoping.
Sample inputs:
In this section,
In this document
Output:
a single token whose value is the location keyword.
"""
prs = (next_phrase('in this') + lit('document')) + comma.possibly()
def tr(acc):
return acc[0][1]
return prs.treat(tr)
def we_record_def():
"""Parser for registered facts.
XX not finished. We need to reparse the balanced tokens
"""
def p(tok):
return (tok.value not in [',','.',';'])
return lit('we-record') + c.balanced_condition(p)
def copula():
"""Parser for copula in macro declarations.
"""
return (
(lit('is') + lit('defined-as').possibly()) |
(next_value(':=')) |
(lit('denote'))
)
def function_copula():
return (
Macro.copula() |
opt_colon_type() + next_value(':=')
)
def iff_junction():
return lit('iff')
def opt_say():
return lit('we-say').possibly()
def opt_record():
return lit('we-record').possibly()
def opt_define():
return (
(lit('lets') + next_word('define').possibly()) |
Macro.opt_record()
)
def macro_inferring():
return c.paren(next_word_inferring() + var().plus() + opt_colon_sort_meta())
def classifier_word_pattern(): # was classifier_words
return c.comma_nonempty_list(c.next_any_word_except(['is','are','be']).plus())
def classifier_def():
return (
next_word('let') + Pattern.classifier_word_pattern() +
lit('is') + lit('a').possibly() + lit('classifier')
)
def symbol_type_pattern():
return Pattern.symbol_pattern()
def identifier_pattern():
##XX
return (lit('a') + identifier().if_test(p)) | next_value('_')
#def
#def op_colon_type_meta():
| 33.00551 | 136 | 0.588014 | 2,884 | 23,962 | 4.716019 | 0.171983 | 0.022939 | 0.014705 | 0.013528 | 0.155356 | 0.088817 | 0.064701 | 0.027057 | 0.01544 | 0.01544 | 0 | 0.00268 | 0.268133 | 23,962 | 726 | 137 | 33.00551 | 0.77288 | 0.199232 | 0 | 0.055172 | 0 | 0 | 0.114721 | 0.001239 | 0 | 0 | 0 | 0 | 0.002299 | 1 | 0.262069 | false | 0 | 0.016092 | 0.137931 | 0.572414 | 0.002299 | 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 | 0 | 0 | 0 | 2 |
b54781bf33734965b60243e16f84e977317f2303 | 2,723 | py | Python | testsuite/pointcloud/run.py | steenax86/OpenShadingLanguage | 0a55421f340a7c4ceed4fe5dc73d15e7ffe8487c | [
"BSD-3-Clause"
] | null | null | null | testsuite/pointcloud/run.py | steenax86/OpenShadingLanguage | 0a55421f340a7c4ceed4fe5dc73d15e7ffe8487c | [
"BSD-3-Clause"
] | null | null | null | testsuite/pointcloud/run.py | steenax86/OpenShadingLanguage | 0a55421f340a7c4ceed4fe5dc73d15e7ffe8487c | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
command += testshade("-g 16 16 -od uint8 -o Cout out0.tif wrcloud")
command += testshade("-g 16 16 -od uint8 -o Cout out0_transpose.tif wrcloud_transpose")
command += testshade("-g 16 16 -od uint8 -o Cout out0_varying_filename.tif wrcloud_varying_filename")
command += testshade("-g 256 256 -param radius 0.01 -od uint8 -o Cout out1.tif rdcloud")
command += testshade("-g 256 256 -param radius 0.01 -param filename cloud_masked_1.geo -od uint8 -o Cout out1_masked_1.tif rdcloud")
command += testshade("-g 256 256 -param radius 0.01 -param filename cloud_masked_2.geo -od uint8 -o Cout out1_masked_2.tif rdcloud")
command += testshade("--vary_pdxdy -g 256 256 -t 1 -param radius 0.01 -od uint8 -o Cout out_zero_derivs.tif rdcloud_zero_derivs")
command += testshade("--vary_pdxdy -g 256 256 -t 1 -param radius 0.01 -od uint8 -o Cout out_zero_derivs_search_only.tif rdcloud_zero_derivs_search_only")
command += testshade("--vary_pdxdy -g 256 256 -t 1 -param radius 0.01 -od uint8 -o Cout out_search_only.tif rdcloud_search_only")
command += testshade("-g 256 256 -param radius 0.1 -od uint8 -o Cout out2.tif rdcloud")
command += testshade("--vary_pdxdy -g 256 256 -t 1 -param radius 0.01 -od uint8 -o Cout out_rdcloud_varying_filename.tif rdcloud_varying_filename")
command += testshade("--center --vary_pdxdy -g 256 256 -t 1 -param radius 0.1 -od uint8 -o Cout out_rdcloud_varying_maxpoint.tif rdcloud_varying_maxpoint")
command += testshade("--center --vary_pdxdy -g 256 256 -t 1 -param radius 0.1 -od uint8 -o Cout out_rdcloud_varying_sort.tif rdcloud_varying_sort")
command += testshade("--vary_pdxdy -g 256 256 -t 1 -param radius 0.01 -od uint8 -o Cout out_rdcloud_get_varying_filename.tif rdcloud_get_varying_filename")
command += testshade("--center --vary_pdxdy -g 256 256 -t 1 -param radius 0.1 -od uint8 -o Cout out_rdcloud_varying.tif rdcloud_varying")
outputs = [ "out0.tif" ]
outputs += [ "out0_transpose.tif" ]
outputs += [ "out0_varying_filename.tif" ]
outputs += [ "out1.tif" ]
outputs += [ "out1_masked_1.tif" ]
outputs += [ "out1_masked_2.tif" ]
outputs += [ "out_zero_derivs.tif" ]
outputs += [ "out_search_only.tif" ]
outputs += [ "out_zero_derivs_search_only.tif" ]
outputs += [ "out2.tif" ]
outputs += [ "out_rdcloud_varying_filename.tif" ]
outputs += [ "out_rdcloud_varying_maxpoint.tif" ]
outputs += [ "out_rdcloud_varying_sort.tif" ]
outputs += [ "out_rdcloud_varying.tif" ]
outputs += [ "out_rdcloud_get_varying_filename.tif" ]
# expect a few LSB failures
failthresh = 0.008
failpercent = 3
| 49.509091 | 155 | 0.746603 | 434 | 2,723 | 4.470046 | 0.163594 | 0.123711 | 0.061856 | 0.092784 | 0.689175 | 0.589175 | 0.542268 | 0.512887 | 0.481959 | 0.462887 | 0 | 0.06965 | 0.130004 | 2,723 | 54 | 156 | 50.425926 | 0.749261 | 0.077121 | 0 | 0 | 0 | 0.3125 | 0.720494 | 0.217305 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b54bbeef546a332ee4225d061a29413522efe942 | 5,445 | py | Python | vergeml/glossary.py | cclauss/vergeml | 3403574db9c1df232809ddf85bbc415c60d35c7c | [
"MIT"
] | 324 | 2018-10-28T19:29:47.000Z | 2020-01-24T20:22:07.000Z | vergeml/glossary.py | cclauss/vergeml | 3403574db9c1df232809ddf85bbc415c60d35c7c | [
"MIT"
] | 8 | 2018-10-30T10:57:19.000Z | 2019-06-05T10:21:30.000Z | vergeml/glossary.py | cclauss/vergeml | 3403574db9c1df232809ddf85bbc415c60d35c7c | [
"MIT"
] | 19 | 2018-10-29T18:43:03.000Z | 2019-02-21T15:08:41.000Z | PARAM_DESCR = {
'epochs': 'How many epochs to train.',
'learning rate': 'Optimizer learning rate.',
'batch size': 'The number of samples to use in one training batch.',
'decay': 'Learning rate decay.',
'early stopping': 'Early stopping delta and patience.',
'dropout': 'Dropout rate.',
'layers': 'The number of hidden layers.',
'optimizer': 'Which optimizer to use.'
}
LONG_DESCR = {
'learning rate': 'A hyperparameter which determines how quickly new learnings override old ones during training. In general, find a learning rate that is low enough that the network will converge to something useful, but high enough that the training does not take too much time.',
'batch size': 'Defines the number of samples to be propagated through the network at once in a batch. The higher the batch size, the more memory you will need.',
'epochs': 'The number of epochs define how often the network will see the complete set of samples during training.',
'decay': 'When using learning rate decay, the learning rate is gradually reduced during training which may result in getting closer to the optimal performance.',
'early stopping': 'Early Stopping is a form of regularization used to avoid overfitting when training. It is controlled via two parameters: Delta defines the minimum change in the monitored quantity to qualify as an improvement. Patience sets the number of epochs with no improvement after which training will be stopped.',
'dropout': 'Dropout is a regularization technique for reducing overfitting in neural networks, The term "dropout" refers to dropping out units (both hidden and visible) in a neural network during training.',
'layers': 'Deep learning models consist of a number of layers which contain one or more neurons. Typically, the neurons in one layer are connected to the next. Models with a higher number of layers can learn more complex representations, but are also more prone to overfitting.',
'optimizer': 'The algorithm which updates model parameters such as the weight and bias values when training the network.',
'sgd': 'Stochastic gradient descent, also known as incremental gradient descent, is a method for optimizing a neural network. It is called stochastic because samples are selected randomly instead of as a single group, as in standard gradient descent.',
'adam': 'The Adam optimization algorithm is an extension to stochastic gradient descent which computes adaptive learning rates for each parameter. Adam is well suited for many practical deep learning problems.',
'environment variables': """\
The following environment variables are available in VergeML:
- VERGEML_PERSISTENCE The number of persistent instances
- VERGEML_THEME The theme of the command line application
- VERGEML_FUNKY_ROBOTS Funky robots""",
"overfitting": "When a model performs well on the training samples, but is not able to generalize well to unseen data. During training, a typical sign for overfitting is when your validation loss goes up while your training loss goes down.",
"underfitting": "When a model can neither model the training data nor generalize to new data.",
"hyperparameters": "Hyperparameters are the parameters of a model that can be set from outside, i.e. are not learned during training. (e.g. learning rate, number of layers, kernel size).",
"random seed": "An integer value that seeds the random generator to generate random values. It is used to repeatably reproduce tasks and experiments.",
"project": "A VergeML project is just a directory. Typically it contains a vergeml.yaml file, a trainings directory and a samples directory.",
'project file': "A YAML file you can use to configure models, device usage, data processing and taks options.",
'checkpoint': 'A checkpoint is a static image of a trained AI. It can be used to restore the AI after training and make predictions.',
'stats': 'Stats are used to measure the performance of a model (e.g. accuracy).',
'samples': 'Samples are pieces of data (e.g. images, texts) that is being used to train models to create AIs.',
'val split': "Samples different from training samples that are used to evaluate the performance of model hyperparameters. You can set it via the --val-split option. See 'ml help split'.",
'test split': "Samples different from training samples that are used to evaluate the final performance of the model. You can set it via the --test-split option. See 'ml help split'.",
'split': 'split is a part of the sample data reserved for validation and testing (--val-split and --test-split options). It can be configured as either a percentage value (e.g. --val-split=10%) to reserve a fraction of training samples, a number to reserve a fixed number of samples, or a directory where the samples of the split are stored.',
'cache dir': 'A directory which contains the processed data.',
}
SYNONYMS = {
'stochastic gradient descent': 'sgd',
'hyperparameter': 'hyperparameters',
'project dir': 'project',
'training samples': 'samples',
'overfit': 'overfitting',
'underfit': 'underfitting'
}
def long_descr(key):
key = key.replace("-", " ")
key = SYNONYMS.get(key, key)
return LONG_DESCR.get(key, "").strip()
def short_param_descr(key):
key = key.replace("-", " ")
key = SYNONYMS.get(key, key)
return PARAM_DESCR.get(key, "").strip()
| 63.313953 | 347 | 0.74123 | 803 | 5,445 | 5.012453 | 0.3599 | 0.019876 | 0.016398 | 0.008944 | 0.085963 | 0.076025 | 0.055155 | 0.055155 | 0.055155 | 0.055155 | 0 | 0.000449 | 0.182553 | 5,445 | 85 | 348 | 64.058824 | 0.903842 | 0 | 0 | 0.071429 | 0 | 0.303571 | 0.853417 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035714 | false | 0 | 0 | 0 | 0.071429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b557c11d27a1825e2b5b39ab833f6b40cc390610 | 401 | py | Python | treemenus/signals.py | Shoker174/django-treemenus | ec754861bde92b0bccb5c51bc99e675c26359ddb | [
"BSD-3-Clause"
] | null | null | null | treemenus/signals.py | Shoker174/django-treemenus | ec754861bde92b0bccb5c51bc99e675c26359ddb | [
"BSD-3-Clause"
] | null | null | null | treemenus/signals.py | Shoker174/django-treemenus | ec754861bde92b0bccb5c51bc99e675c26359ddb | [
"BSD-3-Clause"
] | 1 | 2019-11-29T11:06:53.000Z | 2019-11-29T11:06:53.000Z | # -*- coding: utf-8 -*-
from django.db.models.signals import post_save, post_delete
from .models import Menu, MenuItem
def menu_change_handler(sender, instance, **kwargs):
instance.delete_cache_data()
post_save.connect(menu_change_handler, Menu)
post_save.connect(menu_change_handler, MenuItem)
post_delete.connect(menu_change_handler, Menu)
post_delete.connect(menu_change_handler, MenuItem)
| 28.642857 | 59 | 0.80798 | 57 | 401 | 5.368421 | 0.403509 | 0.163399 | 0.277778 | 0.313725 | 0.509804 | 0.457516 | 0 | 0 | 0 | 0 | 0 | 0.00274 | 0.089776 | 401 | 13 | 60 | 30.846154 | 0.835616 | 0.052369 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b56bbe535dbd639730e77141062bcbd8e1e74d06 | 1,012 | py | Python | test/test_func_fieldmap.py | hlatkydavid/vnmrjpy | 48707a1000dc87e646e37c8bd686e695bd31a61e | [
"MIT"
] | null | null | null | test/test_func_fieldmap.py | hlatkydavid/vnmrjpy | 48707a1000dc87e646e37c8bd686e695bd31a61e | [
"MIT"
] | null | null | null | test/test_func_fieldmap.py | hlatkydavid/vnmrjpy | 48707a1000dc87e646e37c8bd686e695bd31a61e | [
"MIT"
] | null | null | null | import vnmrjpy as vj
import unittest
import numpy as np
import glob
from vnmrjpy.func import concatenate
from vnmrjpy.core.utils import FitViewer3D
from nibabel.viewers import OrthoSlicer3D
import copy
def load_data():
b0dir = vj.config['dataset_dir'] + '/parameterfit/b0/gems'
seqlist = sorted(glob.glob(b0dir+'/gems*'))[4:7]
print('\nLoading gems data from: \n')
for i in seqlist:
print(i)
varr_list = []
for i in seqlist:
varr = vj.read_fid(i)
varr.to_kspace().to_anatomical().to_imagespace()
varr_list.append(varr)
return concatenate(varr_list)
class Test_fieldmap(unittest.TestCase):
varr = load_data()
#varr_02 = copy.copy(varr)
fieldmap = vj.func.make_fieldmap(varr,method='triple_echo', selfmask=True)
OrthoSlicer3D(fieldmap.data).show()
# testing fieldmap with single channel receiver
#varr_02.data = varr_02.data[:,:,:,:,:1,...]
#fieldmap = vj.func.make_fieldmap(varr_02,method='triple_echo')
| 28.914286 | 78 | 0.684783 | 138 | 1,012 | 4.884058 | 0.478261 | 0.035608 | 0.017804 | 0.038576 | 0.089021 | 0.089021 | 0 | 0 | 0 | 0 | 0 | 0.020808 | 0.192688 | 1,012 | 34 | 79 | 29.764706 | 0.804162 | 0.173913 | 0 | 0.083333 | 0 | 0 | 0.092995 | 0.025362 | 0 | 0 | 0 | 0 | 0 | 1 | 0.041667 | false | 0 | 0.333333 | 0 | 0.541667 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
b57ed1946a063c1d1c347d33f6a2031aefe758dc | 94 | py | Python | exp/py_exec_exp_2.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 41 | 2016-01-21T05:14:45.000Z | 2021-11-24T20:37:21.000Z | exp/py_exec_exp_2.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 5 | 2016-01-21T05:36:37.000Z | 2016-08-22T19:26:51.000Z | exp/py_exec_exp_2.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 3 | 2016-01-23T04:03:44.000Z | 2016-08-21T15:58:38.000Z | import inspect
class A:
def f(s, x):
return x
a=A()
print(
eval('f(1)', getmembers(a))
) | 9.4 | 28 | 0.595745 | 18 | 94 | 3.111111 | 0.722222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013333 | 0.202128 | 94 | 10 | 29 | 9.4 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0.042105 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0.125 | 0.5 | 0.125 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
b57f05050a3bf4fc8118e3e20f0f71aa7bbce0d4 | 255 | py | Python | slimano/core/persistence/models/nst.py | ATNoG/5gcontact | fb65ae919977fb6411932b986bd565b962d9c0b9 | [
"MIT"
] | 1 | 2021-04-13T10:56:20.000Z | 2021-04-13T10:56:20.000Z | slimano/core/persistence/models/nst.py | ATNoG/5gcontact | fb65ae919977fb6411932b986bd565b962d9c0b9 | [
"MIT"
] | null | null | null | slimano/core/persistence/models/nst.py | ATNoG/5gcontact | fb65ae919977fb6411932b986bd565b962d9c0b9 | [
"MIT"
] | null | null | null | from persistence.models.models_base import Base
from sqlalchemy import Column, Integer, String
class Nst(Base):
__tablename__ = 'nst'
id = Column(String(40), primary_key=True)
name = Column(String(16))
template = Column(String(10000))
| 21.25 | 47 | 0.717647 | 33 | 255 | 5.363636 | 0.636364 | 0.20339 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042857 | 0.176471 | 255 | 11 | 48 | 23.181818 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.011811 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
b58342c300e63381c683172eedbc9a3d9834ed62 | 137 | py | Python | videos/ptube.py | FaidullaMoftah/discbot | 9acb982bfda8d5a04de71c1310446db7b948db28 | [
"MIT"
] | null | null | null | videos/ptube.py | FaidullaMoftah/discbot | 9acb982bfda8d5a04de71c1310446db7b948db28 | [
"MIT"
] | null | null | null | videos/ptube.py | FaidullaMoftah/discbot | 9acb982bfda8d5a04de71c1310446db7b948db28 | [
"MIT"
] | null | null | null | import pytube
vid = pytube.YouTube('https://www.youtube.com/watch?v=9bZkp7q19f0')
stream = vid.streams.get_by_itag(251)
stream.download() | 34.25 | 67 | 0.781022 | 21 | 137 | 5 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062016 | 0.058394 | 137 | 4 | 68 | 34.25 | 0.751938 | 0 | 0 | 0 | 0 | 0 | 0.311594 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b585c3e8f3ff8d64ba4ce0bb647d7f4c348e7b03 | 632 | py | Python | integreat_cms/cms/forms/users/user_email_form.py | Integreat/cms-v2 | c79a54fd5abb792696420aa6427a5e5a356fa79c | [
"Apache-2.0"
] | 21 | 2018-10-26T20:10:45.000Z | 2020-10-22T09:41:46.000Z | integreat_cms/cms/forms/users/user_email_form.py | Carlosbogo/integreat-cms | 066f188b138e105e72f5420bc36d25709f25402d | [
"Apache-2.0"
] | 392 | 2018-10-25T08:34:07.000Z | 2020-11-19T08:20:30.000Z | src/cms/forms/users/user_email_form.py | mckinly/cms-django | c9995a3bfab6ee2d02f2406a7f83cf91b7ccfcca | [
"Apache-2.0"
] | 23 | 2019-03-06T17:11:35.000Z | 2020-10-16T04:36:41.000Z | import logging
from django.contrib.auth import get_user_model
from ..custom_model_form import CustomModelForm
logger = logging.getLogger(__name__)
class UserEmailForm(CustomModelForm):
"""
Form for modifying user email addresses
"""
class Meta:
"""
This class contains additional meta configuration of the form class, see the :class:`django.forms.ModelForm`
for more information.
"""
#: The model of this :class:`django.forms.ModelForm`
model = get_user_model()
#: The fields of the model which should be handled by this form
fields = ["email"]
| 25.28 | 116 | 0.675633 | 76 | 632 | 5.486842 | 0.513158 | 0.033573 | 0.057554 | 0.119904 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.245253 | 632 | 24 | 117 | 26.333333 | 0.874214 | 0.449367 | 0 | 0 | 0 | 0 | 0.016667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
b592b9f06ab8f93cff47b9bccd6ee1b8b9767897 | 393 | py | Python | DP/62. Unique Paths.py | Into-Y0u/Github-Baby | 5e4e6b02f49c2c99533289be9d49911006cad919 | [
"MIT"
] | 2 | 2022-01-25T04:30:26.000Z | 2022-01-25T10:36:15.000Z | DP/62. Unique Paths.py | Into-Y0u/Leetcode-Baby | 681ad4df01ee908f76d888aa4ccc10f04c03c56f | [
"MIT"
] | null | null | null | DP/62. Unique Paths.py | Into-Y0u/Leetcode-Baby | 681ad4df01ee908f76d888aa4ccc10f04c03c56f | [
"MIT"
] | null | null | null | class Solution:
def uniquePaths(self, m: int, n: int) -> int:
dp = [[0]*n for i in range(m)]
for i in range(m):
dp[i][n-1] = 1
for i in range(n):
dp[m-1][i] = 1
for i in range(m-2,-1,-1):
for j in range(n-2,-1,-1):
dp[i][j] = dp[i+1][j] + dp[i][j+1]
return dp[0][0]
| 26.2 | 50 | 0.37659 | 69 | 393 | 2.144928 | 0.26087 | 0.236486 | 0.162162 | 0.297297 | 0.331081 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 0.440204 | 393 | 14 | 51 | 28.071429 | 0.604545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0 | 0 | 0.272727 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b5a6b727b894dbdd91e11167bf7bd8c66f8d31de | 630 | py | Python | ope-backend/src/core/use_cases/product_order_use_cases/delete_product_order_use_case.py | clauddio-silva/ope-1 | 8be8a10c0db3d2f17e8e90a594abdf5770d53fa3 | [
"CC0-1.0"
] | 2 | 2021-08-12T23:31:38.000Z | 2021-08-24T11:16:53.000Z | ope-backend/src/core/use_cases/product_order_use_cases/delete_product_order_use_case.py | clauddio-silva/ope-1 | 8be8a10c0db3d2f17e8e90a594abdf5770d53fa3 | [
"CC0-1.0"
] | 1 | 2021-09-16T18:17:23.000Z | 2021-09-16T18:17:23.000Z | ope-backend/src/core/use_cases/product_order_use_cases/delete_product_order_use_case.py | clauddio-silva/ope-1 | 8be8a10c0db3d2f17e8e90a594abdf5770d53fa3 | [
"CC0-1.0"
] | 6 | 2021-08-23T23:19:53.000Z | 2021-11-30T23:24:12.000Z | from src.core.validations import delete_product_order_validation as validate
class DeleteProduct_Order:
def __init__(self, product_order_repository):
self.product_order_repository = product_order_repository
def delete_product_order(self, product_order_id):
invalid_inputs = validate(product_order_id=product_order_id)
input_is_valid = len(invalid_inputs) == 0
if input_is_valid:
response = self.product_order_repository.delete_product_order(product_order_id=product_order_id)
return response
return {"data": None, "status": 400, "errors": invalid_inputs} | 42 | 108 | 0.752381 | 79 | 630 | 5.531646 | 0.417722 | 0.329519 | 0.160183 | 0.17849 | 0.128146 | 0.128146 | 0 | 0 | 0 | 0 | 0 | 0.007752 | 0.180952 | 630 | 15 | 109 | 42 | 0.839147 | 0 | 0 | 0 | 0 | 0 | 0.025357 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.090909 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a915b9210a722add0f41ee55e1308fa2ea631a0e | 264 | py | Python | DEVUGRAP.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | 2 | 2021-07-26T03:32:24.000Z | 2021-07-31T02:32:14.000Z | DEVUGRAP.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | null | null | null | DEVUGRAP.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | 1 | 2021-07-14T17:45:33.000Z | 2021-07-14T17:45:33.000Z | # https://www.codechef.com/problems/DEVUGRAP
for T in range(int(input())):
N,K=map(int,input().split())
n,ans=list(map(int,input().split())),0
for i in range(N):
if(n[i]>=K): ans+=min(n[i]%K,K-n[i]%K)
else: ans+=K-n[i]%K
print(ans) | 29.333333 | 46 | 0.55303 | 52 | 264 | 2.807692 | 0.461538 | 0.054795 | 0.082192 | 0.219178 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004651 | 0.185606 | 264 | 9 | 47 | 29.333333 | 0.674419 | 0.159091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.142857 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a9179f7b06aefb86fd6e00ce8e93c94f693c2030 | 419 | py | Python | internationalflavor/language/forms.py | burakozdemir32/django-internationalflavor | 4c5d29519050c929a608d2054c14faa44ee273c9 | [
"BSD-3-Clause"
] | 22 | 2015-02-09T11:01:56.000Z | 2021-07-02T23:34:56.000Z | internationalflavor/language/forms.py | burakozdemir32/django-internationalflavor | 4c5d29519050c929a608d2054c14faa44ee273c9 | [
"BSD-3-Clause"
] | 19 | 2015-02-09T11:04:09.000Z | 2021-11-26T08:07:44.000Z | internationalflavor/language/forms.py | burakozdemir32/django-internationalflavor | 4c5d29519050c929a608d2054c14faa44ee273c9 | [
"BSD-3-Clause"
] | 18 | 2015-04-16T08:39:38.000Z | 2021-07-08T08:07:41.000Z | from django import forms
from .data import get_languages_lazy
from ..forms import SortedSelect
class LanguageFormField(forms.TypedChoiceField):
widget = SortedSelect
def __init__(self, languages=None, exclude=None, *args, **kwargs):
if 'choices' not in kwargs or not kwargs['choices']:
kwargs['choices'] = get_languages_lazy(languages, exclude)
super().__init__(*args, **kwargs)
| 29.928571 | 70 | 0.711217 | 49 | 419 | 5.836735 | 0.530612 | 0.083916 | 0.111888 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183771 | 419 | 13 | 71 | 32.230769 | 0.836257 | 0 | 0 | 0 | 0 | 0 | 0.050119 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
a942f5f7e41467b12170c1a14da9b994a78f2c95 | 152 | py | Python | flaskie/api/v1/auth/collections.py | asheuh/flaskie | 290fd2a6602abdf3b11434e2a72a3428acc0c0f4 | [
"MIT"
] | 7 | 2018-06-20T19:06:05.000Z | 2019-11-03T02:23:20.000Z | flaskie/api/v1/auth/collections.py | asheux/flaskie | 290fd2a6602abdf3b11434e2a72a3428acc0c0f4 | [
"MIT"
] | 23 | 2018-07-09T13:00:22.000Z | 2018-08-04T10:48:42.000Z | flaskie/api/v1/auth/collections.py | asheux/flaskie | 290fd2a6602abdf3b11434e2a72a3428acc0c0f4 | [
"MIT"
] | 1 | 2018-09-22T15:39:20.000Z | 2018-09-22T15:39:20.000Z | from .datacontroller import UserStore, RequestStore
# creates an instance of UserStore
store = UserStore()
reqstore = RequestStore()
blacklistdb = set() | 30.4 | 51 | 0.796053 | 16 | 152 | 7.5625 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 152 | 5 | 52 | 30.4 | 0.909774 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a946a179cf116f5080edef285fe921c2f529f1cf | 14,322 | py | Python | appui.py | Oussama1403/BS-OCR | f7d75611720320b7db27ce2ef1c7b5cecbb44d4a | [
"MIT"
] | 7 | 2021-01-05T15:22:07.000Z | 2021-10-15T02:24:40.000Z | appui.py | Oussama1403/BS-OCR | f7d75611720320b7db27ce2ef1c7b5cecbb44d4a | [
"MIT"
] | null | null | null | appui.py | Oussama1403/BS-OCR | f7d75611720320b7db27ce2ef1c7b5cecbb44d4a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'appui.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(729, 665)
MainWindow.setStyleSheet("/*\n"
"Material Dark Style Sheet for QT Applications\n"
"Author: Jaime A. Quiroga P.\n"
"Inspired on https://github.com/jxfwinter/qt-material-stylesheet\n"
"Company: GTRONICK\n"
"Last updated: 04/12/2018, 15:00.\n"
"Available at: https://github.com/GTRONICK/QSS/blob/master/MaterialDark.qss\n"
"*/\n"
"QMainWindow {\n"
" background-color:#f3f3f3;\n"
"}\n"
"QDialog {\n"
" background-color:#f3f3f3;\n"
"}\n"
"QColorDialog {\n"
" background-color:#f3f3f3;\n"
"}\n"
"QTextEdit {\n"
" background-color:#f3f3f3;\n"
" \n"
" border-style: solid;\n"
" border-color: #919191;\n"
"\n"
" border-width: 1px;\n"
" color: #545454;\n"
"}\n"
"QPlainTextEdit {\n"
" selection-background-color:#007b50;\n"
" background-color:#f3f3f3;\n"
" border-style: solid;\n"
" border-top-color: transparent;\n"
" border-right-color: transparent;\n"
" border-left-color: transparent;\n"
" border-bottom-color: transparent;\n"
" border-width: 1px;\n"
" color: #545454;\n"
"}\n"
"QPushButton{\n"
" border-style: solid;\n"
" border-radius:5px;\n"
" color: #dfe6e9;\n"
" padding: 2px;\n"
" background-color: #00b894;\n"
"}\n"
"\n"
"QToolButton {\n"
" border-style: solid;\n"
" border-top-color: transparent;\n"
" border-right-color: transparent;\n"
" border-left-color: transparent;\n"
" border-bottom-color: #04b97f;\n"
" border-bottom-width: 1px;\n"
" border-style: solid;\n"
" color: #545454;\n"
" padding: 2px;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QToolButton:hover{\n"
" border-style: solid;\n"
" border-top-color: transparent;\n"
" border-right-color: transparent;\n"
" border-left-color: transparent;\n"
" border-bottom-color: #37efba;\n"
" border-bottom-width: 2px;\n"
" border-style: solid;\n"
" color: #545454;\n"
" padding-bottom: 1px;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QPushButton:hover{\n"
" border-style: solid;\n"
" border-top-color: #37efba;\n"
" border-right-color: #37efba;\n"
" border-left-color: #37efba;\n"
" border-bottom-color: #37efba;\n"
" border-bottom-width: 2px;\n"
" border-style: solid;\n"
" color: #545454;\n"
" padding-bottom: 2px;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QPushButton:pressed{\n"
" border-style: solid;\n"
" border-top-color: transparent;\n"
" border-right-color: transparent;\n"
" border-left-color: transparent;\n"
" border-bottom-color: #37efba;\n"
" border-bottom-width: 2px;\n"
" border-style: solid;\n"
" color: #37efba;\n"
" padding-bottom: 1px;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QPushButton:disabled{\n"
" border-style: solid;\n"
" border-top-color: transparent;\n"
" border-right-color: transparent;\n"
" border-left-color: transparent;\n"
" border-bottom-color: #808086;\n"
" border-bottom-width: 2px;\n"
" border-style: solid;\n"
" color: #808086;\n"
" padding-bottom: 1px;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QLineEdit {\n"
" border-width: 1px;\n"
" border-color: #919191;\n"
" border-style: solid;\n"
" padding: 0 8px;\n"
" color: #545454;\n"
" background:#f3f3f3;\n"
" selection-background-color:#007b50;\n"
" selection-color: #f3f3f3;\n"
"}\n"
"QLabel {\n"
" color: #545454;\n"
"}\n"
"QLCDNumber {\n"
" color: #37e6b4;\n"
"}\n"
"QProgressBar {\n"
" text-align: center;\n"
" color: rgb(240, 240, 240);\n"
" border-width: 1px; \n"
" border-radius: 10px;\n"
" border-color: rgb(58, 58, 58);\n"
" border-style: inset;\n"
" background-color:#f3f3f3;\n"
"}\n"
"QProgressBar::chunk {\n"
" background-color: #04b97f;\n"
" border-radius: 5px;\n"
"}\n"
"QMenuBar {\n"
" background-color: #f3f3f3;\n"
" padding: 2px;\n"
" \n"
" color: #545454;\n"
"}\n"
"\n"
"QMenuBar:focus {\n"
" border: 1px solid #009dff;\n"
"}\n"
"\n"
"QMenuBar::item {\n"
" background: transparent;\n"
" padding: 4px;\n"
"}\n"
"\n"
"QMenuBar::item:selected {\n"
" padding: 4px;\n"
" background: transparent;\n"
" border: 0px solid #32414B;\n"
"}\n"
"\n"
"QMenuBar::item:pressed {\n"
" padding: 4px;\n"
" border: 0px solid #37efba;\n"
" background-color: #37efba;\n"
" color: rgb(50, 51, 75);\n"
" margin-bottom: 0px;\n"
" padding-bottom: 0px;\n"
"}\n"
"\n"
"/* QMenu ------------------------------------------------------------------\n"
"\n"
"https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qmenu\n"
"\n"
"--------------------------------------------------------------------------- */\n"
"QMenu\n"
"{\n"
" background-color: #f3f3f3;\n"
" border: 1px solid #4a5157;\n"
" padding: 10px;\n"
" color: #545454;\n"
"\n"
"}\n"
"\n"
"\n"
"QMenu::item\n"
"{\n"
" background-color: transparent;\n"
" padding: 2px 20px 2px 20px;\n"
" min-width: 200px;\n"
"\n"
"}\n"
"\n"
"\n"
"QMenu::separator\n"
"{\n"
" background-color: #242424;\n"
" height: 1px;\n"
"\n"
"}\n"
"\n"
"\n"
"QMenu::item:disabled\n"
"{\n"
" color: #555;\n"
" background-color: transparent;\n"
" padding: 2px 20px 2px 20px;\n"
"\n"
"}\n"
"\n"
"\n"
"QMenu::item:selected\n"
"{\n"
" background-color: #37efba;\n"
" border: #37efba;\n"
" color: rgb(49, 49, 66);\n"
"\n"
"}\n"
"QTabWidget {\n"
" color:rgb(0,0,0);\n"
" background-color:#f3f3f3;\n"
"}\n"
"QTabWidget::pane {\n"
" border-color: rgb(77,77,77);\n"
" background-color:#f3f3f3;\n"
" border-style: solid;\n"
" border-width: 1px;\n"
" border-radius: 6px;\n"
"}\n"
"QTabBar::tab {\n"
" border-style: solid;\n"
" border-top-color: transparent;\n"
" border-right-color: transparent;\n"
" border-left-color: transparent;\n"
" border-bottom-color: transparent;\n"
" border-bottom-width: 1px;\n"
" border-style: solid;\n"
" color: #808086;\n"
" padding: 3px;\n"
" margin-left:3px;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover {\n"
" border-style: solid;\n"
" border-top-color: transparent;\n"
" border-right-color: transparent;\n"
" border-left-color: transparent;\n"
" border-bottom-color: #04b97f;\n"
" border-bottom-width: 2px;\n"
" border-style: solid;\n"
" color: #f3f3f3;\n"
" padding-left: 3px;\n"
" padding-bottom: 2px;\n"
" margin-left:3px;\n"
" background-color: #f3f3f3;\n"
"}\n"
"\n"
"QCheckBox {\n"
" color: #545454;\n"
" padding: 2px;\n"
"}\n"
"QCheckBox:disabled {\n"
" color: #808086;\n"
" padding: 2px;\n"
"}\n"
"\n"
"QCheckBox:hover {\n"
" border-radius:4px;\n"
" border-style:solid;\n"
" padding-left: 1px;\n"
" padding-right: 1px;\n"
" padding-bottom: 1px;\n"
" padding-top: 1px;\n"
" border-width:1px;\n"
" border-color: rgb(87, 97, 106);\n"
" background-color:#f3f3f3;\n"
"}\n"
"QCheckBox::indicator:checked {\n"
"\n"
" height: 10px;\n"
" width: 10px;\n"
" border-style:solid;\n"
" border-width: 1px;\n"
" border-color: #04b97f;\n"
" color: #545454;\n"
" background-color: #04b97f;\n"
"}\n"
"QCheckBox::indicator:unchecked {\n"
"\n"
" height: 10px;\n"
" width: 10px;\n"
" border-style:solid;\n"
" border-width: 1px;\n"
" border-color: #04b97f;\n"
" color: #545454;\n"
" background-color: transparent;\n"
"}\n"
"QRadioButton {\n"
" color: #545454;\n"
" background-color: #f3f3f3;\n"
" padding: 1px;\n"
"}\n"
"QRadioButton::indicator:checked {\n"
" height: 10px;\n"
" width: 10px;\n"
" border-style:solid;\n"
" border-radius:5px;\n"
" border-width: 1px;\n"
" border-color: #04b97f;\n"
" color: #545454;\n"
" background-color: #04b97f;\n"
"}\n"
"QRadioButton::indicator:!checked {\n"
" height: 10px;\n"
" width: 10px;\n"
" border-style:solid;\n"
" border-radius:5px;\n"
" border-width: 1px;\n"
" border-color: #04b97f;\n"
" color: #545454;\n"
" background-color: transparent;\n"
"}\n"
"QStatusBar {\n"
" color:#027f7f;\n"
"}\n"
"QSpinBox {\n"
" color: #545454; \n"
" background-color: #f3f3f3;\n"
"}\n"
"QDoubleSpinBox {\n"
" color: #545454; \n"
" background-color: #f3f3f3;\n"
"}\n"
"QTimeEdit {\n"
" color: #545454; \n"
" background-color: #f3f3f3;\n"
"}\n"
"QDateTimeEdit {\n"
" color: #545454; \n"
" background-color: #f3f3f3;\n"
"}\n"
"QDateEdit {\n"
" color: #545454; \n"
" background-color: #f3f3f3;\n"
"}\n"
"QComboBox {\n"
" color: #545454; \n"
" background: #f3f3f3;\n"
"}\n"
"QComboBox:editable {\n"
" background: #f3f3f3;\n"
" color: #545454;\n"
" selection-background-color: #f3f3f3;\n"
"}\n"
"QComboBox QAbstractItemView {\n"
" color: #545454; \n"
" background: #f3f3f3;\n"
" selection-color: #f3f3f3;\n"
" selection-background-color: #f3f3f3;\n"
"}\n"
"QComboBox:!editable:on, QComboBox::drop-down:editable:on {\n"
" color: #545454; \n"
" background: #f3f3f3;\n"
"}\n"
"QFontComboBox {\n"
" color: #545454; \n"
" background-color: #f3f3f3;\n"
"}\n"
"QToolBox {\n"
" color: #545454;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QToolBox::tab {\n"
" color: #545454;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QToolBox::tab:selected {\n"
" color: #f3f3f3;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QScrollArea {\n"
" color: #f3f3f3;\n"
" background-color: #f3f3f3;\n"
"}\n"
"QSlider::groove:horizontal {\n"
" height: 5px;\n"
" background: #04b97f;\n"
"}\n"
"QSlider::groove:vertical {\n"
" width: 5px;\n"
" background: #04b97f;\n"
"}\n"
"QSlider::handle:horizontal {\n"
" background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);\n"
" border: 1px solid #5c5c5c;\n"
" width: 14px;\n"
" margin: -5px 0;\n"
" border-radius: 7px;\n"
"}\n"
"QSlider::handle:vertical {\n"
" background: qlineargradient(x1:1, y1:1, x2:0, y2:0, stop:0 #b4b4b4, stop:1 #8f8f8f);\n"
" border: 1px solid #5c5c5c;\n"
" height: 14px;\n"
" margin: 0 -5px;\n"
" border-radius: 7px;\n"
"}\n"
"QSlider::add-page:horizontal {\n"
" background: white;\n"
"}\n"
"QSlider::add-page:vertical {\n"
" background: white;\n"
"}\n"
"QSlider::sub-page:horizontal {\n"
" background: #04b97f;\n"
"}\n"
"QSlider::sub-page:vertical {\n"
" background: #04b97f;\n"
"}\n"
"")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.imagelabel = QtWidgets.QLabel(self.centralwidget)
self.imagelabel.setGeometry(QtCore.QRect(10, 150, 331, 401))
self.imagelabel.setFrameShape(QtWidgets.QFrame.Box)
self.imagelabel.setText("")
self.imagelabel.setObjectName("imagelabel")
self.imagetext = QtWidgets.QTextEdit(self.centralwidget)
self.imagetext.setGeometry(QtCore.QRect(380, 150, 331, 401))
self.imagetext.setObjectName("imagetext")
self.comboBox = QtWidgets.QComboBox(self.centralwidget)
self.comboBox.setGeometry(QtCore.QRect(10, 48, 91, 31))
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(10, 20, 191, 21))
self.label_2.setObjectName("label_2")
self.imagetotextb = QtWidgets.QPushButton(self.centralwidget)
self.imagetotextb.setGeometry(QtCore.QRect(240, 570, 251, 51))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.imagetotextb.setFont(font)
self.imagetotextb.setObjectName("imagetotextb")
self.selectimageb = QtWidgets.QPushButton(self.centralwidget)
self.selectimageb.setGeometry(QtCore.QRect(10, 100, 131, 41))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.selectimageb.setFont(font)
self.selectimageb.setObjectName("selectimageb")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 729, 27))
self.menubar.setObjectName("menubar")
self.menuMenu = QtWidgets.QMenu(self.menubar)
self.menuMenu.setObjectName("menuMenu")
MainWindow.setMenuBar(self.menubar)
self.actionAbout = QtWidgets.QAction(MainWindow)
self.actionAbout.setObjectName("actionAbout")
self.actionExit = QtWidgets.QAction(MainWindow)
self.actionExit.setObjectName("actionExit")
self.menuMenu.addAction(self.actionAbout)
self.menuMenu.addAction(self.actionExit)
self.menubar.addAction(self.menuMenu.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.comboBox.setItemText(0, _translate("MainWindow", "English"))
self.comboBox.setItemText(1, _translate("MainWindow", "Français"))
self.comboBox.setItemText(2, _translate("MainWindow", "Arab"))
self.label_2.setText(_translate("MainWindow", "Specify the text language :"))
self.imagetotextb.setText(_translate("MainWindow", "Image To Text"))
self.selectimageb.setText(_translate("MainWindow", "Select Image"))
self.menuMenu.setTitle(_translate("MainWindow", "Menu"))
self.actionAbout.setText(_translate("MainWindow", "About"))
self.actionExit.setText(_translate("MainWindow", "Exit"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
| 28.360396 | 92 | 0.612624 | 1,780 | 14,322 | 4.914045 | 0.166854 | 0.079227 | 0.073168 | 0.07797 | 0.522122 | 0.465417 | 0.405053 | 0.360809 | 0.331199 | 0.284555 | 0 | 0.062272 | 0.178118 | 14,322 | 504 | 93 | 28.416667 | 0.680826 | 0.018852 | 0 | 0.618852 | 1 | 0.010246 | 0.6637 | 0.090501 | 0 | 0 | 0 | 0 | 0 | 1 | 0.004098 | false | 0 | 0.004098 | 0 | 0.010246 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a9587fb4669b5b70c8157b9f7e254c47bd2bbae0 | 2,330 | py | Python | p008/solution.py | jcbrockschmidt/project_euler | 49576d24f485eea1a21c8111e006a5c9ba1701d7 | [
"MIT"
] | null | null | null | p008/solution.py | jcbrockschmidt/project_euler | 49576d24f485eea1a21c8111e006a5c9ba1701d7 | [
"MIT"
] | null | null | null | p008/solution.py | jcbrockschmidt/project_euler | 49576d24f485eea1a21c8111e006a5c9ba1701d7 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from time import time
DIGITS = '73167176531330624919225119674426574742355349194934\
96983520312774506326239578318016984801869478851843\
85861560789112949495459501737958331952853208805511\
12540698747158523863050715693290963295227443043557\
66896648950445244523161731856403098711121722383113\
62229893423380308135336276614282806444486645238749\
30358907296290491560440772390713810515859307960866\
70172427121883998797908792274921901699720888093776\
65727333001053367881220235421809751254540594752243\
52584907711670556013604839586446706324415722155397\
53697817977846174064955149290862569321978468622482\
83972241375657056057490261407972968652414535100474\
82166370484403199890008895243450658541227588666881\
16427171479924442928230863465674813919123162824586\
17866458359124566529476545682848912883142607690042\
24219022671055626321111109370544217506941658960408\
07198403850962455444362981230987879927244284909188\
84580156166097919133875499200524063689912560717606\
05886116467109405077541002256983155200055935729725\
71636269561882670428252483600823257530420752963450'
def greatest_prod(digits, n):
""" Find the `n` adjacent digits in `digits` with the greatest product. """
# Calculate the product of the first `n` digits.
prod = 1
zero_cnt = 0
for c in digits[:n]:
d = int(c)
if d > 1:
prod *= d
elif d == 0:
zero_cnt += 1
max_prod = prod
# Evaluate all other products.
for i in range(1, len(digits) - n + 1):
# Divide by the left-most digit/factor of the previous product.
left = int(digits[i - 1])
if left > 1:
prod /= left
elif left ==0:
zero_cnt -= 1
# Multiply by our new right-most digit.
right = int(digits[i + n - 1])
if right > 1:
prod *= right
elif right == 0:
zero_cnt += 1
# As long as there are zeros within our `n` adjacent digits,
# our product is 0 and should be ignored.
if zero_cnt == 0:
max_prod = max(max_prod, prod)
return int(max_prod)
if __name__ == '__main__':
start = time()
solu = greatest_prod(DIGITS, 13)
elapse = time() - start
print('Solution: {}'.format(solu))
print('Solution found in {:.8f}s'.format(elapse))
| 34.264706 | 79 | 0.729185 | 202 | 2,330 | 8.316832 | 0.465347 | 0.020833 | 0.014286 | 0.016071 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.547747 | 0.2 | 2,330 | 67 | 80 | 34.776119 | 0.353541 | 0.156652 | 0 | 0.039216 | 0 | 0 | 0.023053 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.019608 | false | 0 | 0.019608 | 0 | 0.058824 | 0.039216 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a95a4579be50b37da1b4390a974aa89e0f3d07e4 | 715 | py | Python | backend/models/game.py | EuleMitKeule/streetview-bingo | 17308e44bd6b573bbac6b852fff4b1f9bc1081f3 | [
"Unlicense"
] | 1 | 2021-03-19T22:17:01.000Z | 2021-03-19T22:17:01.000Z | backend/models/game.py | EuleMitKeule/streetview-bingo | 17308e44bd6b573bbac6b852fff4b1f9bc1081f3 | [
"Unlicense"
] | 10 | 2021-03-07T17:53:36.000Z | 2021-04-15T07:52:05.000Z | backend/models/game.py | euleGIT/streetview-bingo | 17308e44bd6b573bbac6b852fff4b1f9bc1081f3 | [
"Unlicense"
] | null | null | null | from flask import current_app
db = current_app.db
game_user_table = db.Table(
'game_user', db.Model.metadata,
db.Column('game_id', db.Integer, db.ForeignKey('game.id')),
db.Column('user_id', db.Integer, db.ForeignKey('user.id'))
)
class Game(db.Model):
__tablename__ = "game"
id = db.Column(db.Integer, primary_key=True)
token = db.Column(db.String(16), index=True)
status = db.Column(db.String(16))
moderator_id = db.Column(db.Integer, db.ForeignKey("user.id"))
users = db.relationship("User", secondary=game_user_table)
words = db.relationship("GameWord", backref="game", foreign_keys='GameWord.game_id')
lobby_id = db.Column(db.Integer, db.ForeignKey("lobby.id"))
| 34.047619 | 88 | 0.695105 | 106 | 715 | 4.518868 | 0.330189 | 0.11691 | 0.104384 | 0.175365 | 0.365344 | 0.19833 | 0.129436 | 0 | 0 | 0 | 0 | 0.006504 | 0.13986 | 715 | 20 | 89 | 35.75 | 0.772358 | 0 | 0 | 0 | 0 | 0 | 0.123077 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.0625 | 0 | 0.625 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
a95d049264595c05cc1a18991b527ebe30738fdb | 266 | py | Python | larcv/app/arxiv/mac/pyrgb/__init__.py | mmajewsk/larcv2 | 9ee74e42b293d547d3a8510fa2139b2d4ccf6b89 | [
"MIT"
] | 14 | 2017-10-19T15:08:29.000Z | 2021-03-31T21:21:07.000Z | larcv/app/arxiv/mac/pyrgb/__init__.py | mmajewsk/larcv2 | 9ee74e42b293d547d3a8510fa2139b2d4ccf6b89 | [
"MIT"
] | 32 | 2017-10-25T22:54:06.000Z | 2019-10-01T13:57:15.000Z | larcv/app/arxiv/mac/pyrgb/__init__.py | mmajewsk/larcv2 | 9ee74e42b293d547d3a8510fa2139b2d4ccf6b89 | [
"MIT"
] | 16 | 2017-12-07T12:04:40.000Z | 2021-11-15T00:53:31.000Z | from pyqtgraph.Qt import QtGui, QtCore
import ROOT
from larcv import larcv
import pyqtgraph as pg
#pg.setConfigOption('background', 'w')
#pg.setConfigOption('foreground', 'k')
import numpy as np
larcv.load_pyutil
try:
import cv2
except:
print "NO CV2"
| 14 | 38 | 0.736842 | 38 | 266 | 5.131579 | 0.631579 | 0.112821 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00905 | 0.169173 | 266 | 18 | 39 | 14.777778 | 0.873303 | 0.278195 | 0 | 0 | 0 | 0 | 0.031746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.6 | null | null | 0.1 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
8d2ee2b2ae71f2b5e08395a2d56c9350689fb1b9 | 5,136 | py | Python | C4H/settings.py | adgalad/Cash4Home | 5500adfada2fe0ffe25feb71c3707392287628e7 | [
"Apache-2.0"
] | null | null | null | C4H/settings.py | adgalad/Cash4Home | 5500adfada2fe0ffe25feb71c3707392287628e7 | [
"Apache-2.0"
] | null | null | null | C4H/settings.py | adgalad/Cash4Home | 5500adfada2fe0ffe25feb71c3707392287628e7 | [
"Apache-2.0"
] | null | null | null | """
Django settings for C4H project.
Generated by 'django-admin startproject' using Django 1.11.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEFAULT_DOMAIN = 'https://www.cash4home.io'
#DEFAULT_DOMAIN = 'http://0.0.0.0:8000/'
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ['SECRET_KEY']
USER_DB = os.environ['USER_DB']
PASSWORD_DB = os.environ['PASSWORD_DB']
NAME_DB = os.environ.get('NAME_DB','cashhom2_db')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
LOGIN_URL = "/v1/login/"
OPERATION_TIMEOUT = 90 # minutos
EMAIL_VALIDATION_EXPIRATION = 60*3 # 3 horas
# Application definition
# Redirect to HTTPS
SECURE_SSL_REDIRECT = True
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mathfilters',
'app',
]
CRON_CLASSES = [
"app.cron.UpdateBTCPrice",
# ...
]
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',
'app.middleware.AutoLogout'
]
ROOT_URLCONF = 'C4H.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'C4H.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': NAME_DB,
'USER': USER_DB,
'PASSWORD': PASSWORD_DB,
'PORT': '5432',
}
}
# User substitution
# https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#auth-custom-user
AUTH_USER_MODEL = 'app.User'
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
# {
# 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
# },
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
# {
# 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
# },
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Session timeout
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
AUTO_LOGOUT_DELAY = 5 # minutes
# SESSION_EXPIRE_AT_BROWSER_CLOSE = True
# SESSION_COOKIE_AGE = 10
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'es-ES'
TIME_ZONE = 'UTC'
USE_I18N = True
# USE_L10N = True
USE_TZ = True
DATE_FORMAT = 'Y/m/d'
DATETIME_FORMAT = 'Y/m/d H:i'
TIME_FORMAT = 'H:i'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
# Static asset configuration
#BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
#STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_ROOT = 'static'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
# Directorio de templates y de statics.
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
MEDIA_URL = '/media/'
# Email
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = os.environ['EMAIL_HOST']
EMAIL_HOST_USER = os.environ['EMAIL_HOST_USER']
EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD']
EMAIL_PORT = 465
# EMAIL_USE_TLS = True
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = "Soporte de Cash4Home <%s>"%os.environ['EMAIL_HOST_USER']
SERVER_EMAIL = os.environ['EMAIL_HOST_USER']
ADMINS = [('Carlos', 'carlos.25896@gmail.com'), ('Vicky', 'mvjorgemauriello@gmail.com')]
| 26.204082 | 93 | 0.702687 | 626 | 5,136 | 5.592652 | 0.353035 | 0.059412 | 0.050271 | 0.057127 | 0.253071 | 0.200229 | 0.121965 | 0.088546 | 0.035133 | 0 | 0 | 0.016598 | 0.155374 | 5,136 | 195 | 94 | 26.338462 | 0.790456 | 0.332555 | 0 | 0.038835 | 1 | 0 | 0.432081 | 0.293282 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.058252 | 0.009709 | 0 | 0.009709 | 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 | 0 | 0 | 0 | 2 |
8d38d0721eceb1787c1926f3788017e113c3219f | 181 | py | Python | forge.py | purrcat259/forge | f6199f8604ea6a9fce545d3e532467c823c15703 | [
"MIT"
] | null | null | null | forge.py | purrcat259/forge | f6199f8604ea6a9fce545d3e532467c823c15703 | [
"MIT"
] | null | null | null | forge.py | purrcat259/forge | f6199f8604ea6a9fce545d3e532467c823c15703 | [
"MIT"
] | null | null | null | from flask import Flask, render_template
app = Flask(__name__)
def run():
print(render_template('blog.html', blog_text='This is my text'))
with app.app_context():
run()
| 16.454545 | 68 | 0.701657 | 27 | 181 | 4.407407 | 0.666667 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165746 | 181 | 10 | 69 | 18.1 | 0.788079 | 0 | 0 | 0 | 0 | 0 | 0.132597 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.333333 | 0.166667 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8d3df8186ba20084214edd1385528b1ae2b0ac06 | 2,574 | py | Python | src/third_party/mozjs/extract/js/src/devtools/rootAnalysis/t/hazards/test.py | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | src/third_party/mozjs/extract/js/src/devtools/rootAnalysis/t/hazards/test.py | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | src/third_party/mozjs/extract/js/src/devtools/rootAnalysis/t/hazards/test.py | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | # flake8: noqa: F821
from collections import defaultdict
test.compile("source.cpp")
test.run_analysis_script("gcTypes")
# gcFunctions should be the inverse, but we get to rely on unmangled names here.
gcFunctions = test.load_gcFunctions()
print(gcFunctions)
assert "void GC()" in gcFunctions
assert "void suppressedFunction()" not in gcFunctions
assert "void halfSuppressedFunction()" in gcFunctions
assert "void unsuppressedFunction()" in gcFunctions
assert "int32 Subcell::method()" in gcFunctions
assert "Cell* f()" in gcFunctions
hazards = test.load_hazards()
hazmap = {haz.variable: haz for haz in hazards}
assert "cell1" not in hazmap
assert "cell2" in hazmap
assert "cell3" in hazmap
assert "cell4" not in hazmap
assert "cell5" not in hazmap
assert "cell6" not in hazmap
assert "<returnvalue>" in hazmap
assert "this" in hazmap
# All hazards should be in f(), loopy(), safevals(), and method()
assert hazmap["cell2"].function == "Cell* f()"
print(len(set(haz.function for haz in hazards)))
assert len(set(haz.function for haz in hazards)) == 4
# Check that the correct GC call is reported for each hazard. (cell3 has a
# hazard from two different GC calls; it doesn't really matter which is
# reported.)
assert hazmap["cell2"].GCFunction == "void halfSuppressedFunction()"
assert hazmap["cell3"].GCFunction in (
"void halfSuppressedFunction()",
"void unsuppressedFunction()",
)
assert hazmap["<returnvalue>"].GCFunction == "void GCInDestructor::~GCInDestructor()"
assert "container1" in hazmap
assert "container2" not in hazmap
# Type names are handy to have in the report.
assert hazmap["cell2"].type == "Cell*"
assert hazmap["<returnvalue>"].type == "Cell*"
assert hazmap["this"].type == "Subcell*"
# loopy hazards. See comments in source.
assert "haz1" not in hazmap
assert "haz2" not in hazmap
assert "haz3" in hazmap
assert "haz4" in hazmap
assert "haz5" in hazmap
assert "haz6" not in hazmap
assert "haz7" not in hazmap
assert "haz8" in hazmap
# safevals hazards. See comments in source.
assert "unsafe1" in hazmap
assert "safe2" not in hazmap
assert "unsafe3" in hazmap
assert "unsafe3b" in hazmap
assert "unsafe4" in hazmap
assert "safe5" not in hazmap
assert "safe6" not in hazmap
assert "unsafe7" in hazmap
assert "safe8" not in hazmap
assert "safe9" not in hazmap
assert "safe10" not in hazmap
# method hazard.
byfunc = defaultdict(lambda: defaultdict(dict))
for haz in hazards:
byfunc[haz.function][haz.variable] = haz
methhaz = byfunc["int32 Subcell::method()"]
assert "this" in methhaz
assert methhaz["this"].type == "Subcell*"
| 30.642857 | 85 | 0.745921 | 363 | 2,574 | 5.278237 | 0.325069 | 0.121086 | 0.182672 | 0.115344 | 0.080898 | 0.066806 | 0.033403 | 0.033403 | 0 | 0 | 0 | 0.01903 | 0.14258 | 2,574 | 83 | 86 | 31.012048 | 0.849116 | 0.176768 | 0 | 0 | 0 | 0 | 0.258065 | 0.070683 | 0 | 0 | 0 | 0 | 0.75 | 1 | 0 | false | 0 | 0.016667 | 0 | 0.016667 | 0.033333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8d4c190cfa45309377cec026bb75c817f02da065 | 8,063 | py | Python | python/errnames.py | amirgeva/redrobot | 6150d882e4d8f223e5bb27c7bfa208beca20bcb3 | [
"MIT"
] | 1 | 2019-02-23T14:39:57.000Z | 2019-02-23T14:39:57.000Z | python/errnames.py | amirgeva/redrobot | 6150d882e4d8f223e5bb27c7bfa208beca20bcb3 | [
"MIT"
] | null | null | null | python/errnames.py | amirgeva/redrobot | 6150d882e4d8f223e5bb27c7bfa208beca20bcb3 | [
"MIT"
] | null | null | null | import errno
def get_error_name(e):
if e==errno.EPERM:
return 'Operation not permitted'
if e==errno.ENOENT:
return 'No such file or directory'
if e==errno.ESRCH:
return 'No such process'
if e==errno.EINTR:
return 'Interrupted system call'
if e==errno.EIO:
return 'I/O error'
if e==errno.ENXIO:
return 'No such device or address'
if e==errno.E2BIG:
return 'Arg list too long'
if e==errno.ENOEXEC:
return 'Exec format error'
if e==errno.EBADF:
return 'Bad file number'
if e==errno.ECHILD:
return 'No child processes'
if e==errno.EAGAIN:
return 'Try again'
if e==errno.ENOMEM:
return 'Out of memory'
if e==errno.EACCES:
return 'Permission denied'
if e==errno.EFAULT:
return 'Bad address'
if e==errno.ENOTBLK:
return 'Block device required'
if e==errno.EBUSY:
return 'Device or resource busy'
if e==errno.EEXIST:
return 'File exists'
if e==errno.EXDEV:
return 'Cross-device link'
if e==errno.ENODEV:
return 'No such device'
if e==errno.ENOTDIR:
return 'Not a directory'
if e==errno.EISDIR:
return 'Is a directory'
if e==errno.EINVAL:
return 'Invalid argument'
if e==errno.ENFILE:
return 'File table overflow'
if e==errno.EMFILE:
return 'Too many open files'
if e==errno.ENOTTY:
return 'Not a typewriter'
if e==errno.ETXTBSY:
return 'Text file busy'
if e==errno.EFBIG:
return 'File too large'
if e==errno.ENOSPC:
return 'No space left on device'
if e==errno.ESPIPE:
return 'Illegal seek'
if e==errno.EROFS:
return 'Read-only file system'
if e==errno.EMLINK:
return 'Too many links'
if e==errno.EPIPE:
return 'Broken pipe'
if e==errno.EDOM:
return 'Math argument out of domain of func'
if e==errno.ERANGE:
return 'Math result not representable'
if e==errno.EDEADLK:
return 'Resource deadlock would occur'
if e==errno.ENAMETOOLONG:
return 'File name too long'
if e==errno.ENOLCK:
return 'No record locks available'
if e==errno.ENOSYS:
return 'Function not implemented'
if e==errno.ENOTEMPTY:
return 'Directory not empty'
if e==errno.ELOOP:
return 'Too many symbolic links encountered'
if e==errno.EWOULDBLOCK:
return 'Operation would block'
if e==errno.ENOMSG:
return 'No message of desired type'
if e==errno.EIDRM:
return 'Identifier removed'
if e==errno.ECHRNG:
return 'Channel number out of range'
if e==errno.EL2NSYNC:
return 'Level 2 not synchronized'
if e==errno.EL3HLT:
return 'Level 3 halted'
if e==errno.EL3RST:
return 'Level 3 reset'
if e==errno.ELNRNG:
return 'Link number out of range'
if e==errno.EUNATCH:
return 'Protocol driver not attached'
if e==errno.ENOCSI:
return 'No CSI structure available'
if e==errno.EL2HLT:
return 'Level 2 halted'
if e==errno.EBADE:
return 'Invalid exchange'
if e==errno.EBADR:
return 'Invalid request descriptor'
if e==errno.EXFULL:
return 'Exchange full'
if e==errno.ENOANO:
return 'No anode'
if e==errno.EBADRQC:
return 'Invalid request code'
if e==errno.EBADSLT:
return 'Invalid slot'
if e==errno.EDEADLOCK:
return 'File locking deadlock error'
if e==errno.EBFONT:
return 'Bad font file format'
if e==errno.ENOSTR:
return 'Device not a stream'
if e==errno.ENODATA:
return 'No data available'
if e==errno.ETIME:
return 'Timer expired'
if e==errno.ENOSR:
return 'Out of streams resources'
if e==errno.ENONET:
return 'Machine is not on the network'
if e==errno.ENOPKG:
return 'Package not installed'
if e==errno.EREMOTE:
return 'Object is remote'
if e==errno.ENOLINK:
return 'Link has been severed'
if e==errno.EADV:
return 'Advertise error'
if e==errno.ESRMNT:
return 'Srmount error'
if e==errno.ECOMM:
return 'Communication error on send'
if e==errno.EPROTO:
return 'Protocol error'
if e==errno.EMULTIHOP:
return 'Multihop attempted'
if e==errno.EDOTDOT:
return 'RFS specific error'
if e==errno.EBADMSG:
return 'Not a data message'
if e==errno.EOVERFLOW:
return 'Value too large for defined data type'
if e==errno.ENOTUNIQ:
return 'Name not unique on network'
if e==errno.EBADFD:
return 'File descriptor in bad state'
if e==errno.EREMCHG:
return 'Remote address changed'
if e==errno.ELIBACC:
return 'Can not access a needed shared library'
if e==errno.ELIBBAD:
return 'Accessing a corrupted shared library'
if e==errno.ELIBSCN:
return '.lib section in a.out corrupted'
if e==errno.ELIBMAX:
return 'Attempting to link in too many shared libraries'
if e==errno.ELIBEXEC:
return 'Cannot exec a shared library directly'
if e==errno.EILSEQ:
return 'Illegal byte sequence'
if e==errno.ERESTART:
return 'Interrupted system call should be restarted'
if e==errno.ESTRPIPE:
return 'Streams pipe error'
if e==errno.EUSERS:
return 'Too many users'
if e==errno.ENOTSOCK:
return 'Socket operation on non-socket'
if e==errno.EDESTADDRREQ:
return 'Destination address required'
if e==errno.EMSGSIZE:
return 'Message too long'
if e==errno.EPROTOTYPE:
return 'Protocol wrong type for socket'
if e==errno.ENOPROTOOPT:
return 'Protocol not available'
if e==errno.EPROTONOSUPPORT:
return 'Protocol not supported'
if e==errno.ESOCKTNOSUPPORT:
return 'Socket type not supported'
if e==errno.EOPNOTSUPP:
return 'Operation not supported on transport endpoint'
if e==errno.EPFNOSUPPORT:
return 'Protocol family not supported'
if e==errno.EAFNOSUPPORT:
return 'Address family not supported by protocol'
if e==errno.EADDRINUSE:
return 'Address already in use'
if e==errno.EADDRNOTAVAIL:
return 'Cannot assign requested address'
if e==errno.ENETDOWN:
return 'Network is down'
if e==errno.ENETUNREACH:
return 'Network is unreachable'
if e==errno.ENETRESET:
return 'Network dropped connection because of reset'
if e==errno.ECONNABORTED:
return 'Software caused connection abort'
if e==errno.ECONNRESET:
return 'Connection reset by peer'
if e==errno.ENOBUFS:
return 'No buffer space available'
if e==errno.EISCONN:
return 'Transport endpoint is already connected'
if e==errno.ENOTCONN:
return 'Transport endpoint is not connected'
if e==errno.ESHUTDOWN:
return 'Cannot send after transport endpoint shutdown'
if e==errno.ETOOMANYREFS:
return 'Too many references: cannot splice'
if e==errno.ETIMEDOUT:
return 'Connection timed out'
if e==errno.ECONNREFUSED:
return 'Connection refused'
if e==errno.EHOSTDOWN:
return 'Host is down'
if e==errno.EHOSTUNREACH:
return 'No route to host'
if e==errno.EALREADY:
return 'Operation already in progress'
if e==errno.EINPROGRESS:
return 'Operation now in progress'
if e==errno.ESTALE:
return 'Stale NFS file handle'
if e==errno.EUCLEAN:
return 'Structure needs cleaning'
if e==errno.ENOTNAM:
return 'Not a XENIX named type file'
if e==errno.ENAVAIL:
return 'No XENIX semaphores available'
if e==errno.EISNAM:
return 'Is a named type file'
if e==errno.EREMOTEIO:
return 'Remote I/O error'
if e==errno.EDQUOT:
return 'Quota exceeded'
return "Unknown" | 32.512097 | 64 | 0.623837 | 1,073 | 8,063 | 4.685927 | 0.309413 | 0.072792 | 0.194113 | 0.02327 | 0.072991 | 0.023866 | 0.009547 | 0 | 0 | 0 | 0 | 0.001558 | 0.283765 | 8,063 | 248 | 65 | 32.512097 | 0.869091 | 0 | 0 | 0 | 0 | 0 | 0.339162 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.004049 | false | 0 | 0.004049 | 0 | 0.506073 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
8d4ea2bbec21399dcbc9a809db4b4b3cf1a5c897 | 2,752 | py | Python | pacientes/admin.py | williamlemos253/health | 9c4ffebfdf79a6e622225f6b5d059e991c903bc2 | [
"Unlicense"
] | null | null | null | pacientes/admin.py | williamlemos253/health | 9c4ffebfdf79a6e622225f6b5d059e991c903bc2 | [
"Unlicense"
] | null | null | null | pacientes/admin.py | williamlemos253/health | 9c4ffebfdf79a6e622225f6b5d059e991c903bc2 | [
"Unlicense"
] | null | null | null | from django.contrib import admin
# Register your models here.
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from pacientes.models import Profile
from import_export import resources, fields
from import_export.admin import ImportExportModelAdmin
from import_export.widgets import ForeignKeyWidget
from import_export.results import RowResult
admin.site.unregister(User)
class UserResource(resources.ModelResource):
def import_row(self, row, instance_loader, **kwargs):
# overriding import_row to ignore errors and skip rows that fail to import
# without failing the entire import
import_result = super(UserResource, self).import_row(row, instance_loader, **kwargs)
if import_result.import_type == RowResult.IMPORT_TYPE_ERROR:
# Copy the values to display in the preview report
import_result.diff = [row[val] for val in row]
# Add a column with the error message
import_result.diff.append('Errors: {}'.format([err.error for err in import_result.errors]))
# clear errors and mark the record to skip
import_result.errors = []
import_result.import_type = RowResult.IMPORT_TYPE_SKIP
return import_result
class Meta:
model = User
exclude = ('email', 'first_name')
class UserAdmin(ImportExportModelAdmin):
resource_class = UserResource
admin.site.register(User, UserAdmin)
class ProfileResource(resources.ModelResource):
def import_row(self, row, instance_loader, **kwargs):
# overriding import_row to ignore errors and skip rows that fail to import
# without failing the entire import
import_result = super(ProfileResource, self).import_row(row, instance_loader, **kwargs)
if import_result.import_type == RowResult.IMPORT_TYPE_ERROR:
# Copy the values to display in the preview report
import_result.diff = [row[val] for val in row]
# Add a column with the error message
import_result.diff.append('Errors: {}'.format([err.error for err in import_result.errors]))
# clear errors and mark the record to skip
import_result.errors = []
import_result.import_type = RowResult.IMPORT_TYPE_SKIP
return import_result
username = fields.Field(
column_name='user',
attribute='user',
widget=ForeignKeyWidget(User, 'username'))
class Meta:
model = Profile
skip_unchanged = True
skip_row = True
report_skipped = False
exclude = ('user')
class ProfileAdmin(ImportExportModelAdmin):
resource_class = ProfileResource
admin.site.register(Profile, ProfileAdmin) | 39.884058 | 103 | 0.699855 | 335 | 2,752 | 5.602985 | 0.265672 | 0.102291 | 0.034097 | 0.049014 | 0.570059 | 0.570059 | 0.570059 | 0.570059 | 0.570059 | 0.570059 | 0 | 0 | 0.228198 | 2,752 | 69 | 104 | 39.884058 | 0.88371 | 0.178779 | 0 | 0.347826 | 0 | 0 | 0.024455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043478 | false | 0 | 0.565217 | 0 | 0.847826 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
8d5679347c1eed60c92e80c153b4d20990db53a7 | 220 | py | Python | docs/examples/callback_example.py | seanrcollings/arc | 77628b7bb99ac1869944c9c25a87aa3c80407492 | [
"MIT"
] | 2 | 2020-02-23T01:37:30.000Z | 2020-09-05T20:46:08.000Z | docs/examples/callback_example.py | seanrcollings/arc | 77628b7bb99ac1869944c9c25a87aa3c80407492 | [
"MIT"
] | 116 | 2020-08-14T05:15:26.000Z | 2022-03-08T05:41:34.000Z | docs/examples/callback_example.py | seanrcollings/arc | 77628b7bb99ac1869944c9c25a87aa3c80407492 | [
"MIT"
] | null | null | null | import arc
@arc.command()
def command():
print("command execution")
@command.callback()
def callback(args: dict, ctx: arc.Context):
print("before execution")
yield
print("after execution")
command() | 13.75 | 43 | 0.672727 | 26 | 220 | 5.692308 | 0.538462 | 0.216216 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 220 | 16 | 44 | 13.75 | 0.822222 | 0 | 0 | 0 | 0 | 0 | 0.217195 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.1 | 0 | 0.3 | 0.3 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.