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
e87036f9dc84456eb79073af2898babcb7325cd3
91
py
Python
src/vulfocus/__init__.py
x98zy/vulfocus-py
c3ac3108918ecd1faa661146fbbd3543173cdb55
[ "Apache-2.0" ]
1
2021-11-28T04:32:57.000Z
2021-11-28T04:32:57.000Z
src/vulfocus/__init__.py
x98zy/vulfocus-py
c3ac3108918ecd1faa661146fbbd3543173cdb55
[ "Apache-2.0" ]
null
null
null
src/vulfocus/__init__.py
x98zy/vulfocus-py
c3ac3108918ecd1faa661146fbbd3543173cdb55
[ "Apache-2.0" ]
2
2021-11-26T09:11:50.000Z
2021-11-28T02:46:33.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2021/11/28 10:50 # @Author : x98zy
18.2
26
0.571429
15
91
3.466667
1
0
0
0
0
0
0
0
0
0
0
0.2
0.175824
91
4
27
22.75
0.493333
0.912088
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
e8abb86c889dbd1f15be34c8658f1bf1c3ea5567
171
py
Python
cracker/main.py
dfioravanti/rust_projects
a80f01006488d9d5eb02bf3c904361e0da02d0fd
[ "MIT" ]
null
null
null
cracker/main.py
dfioravanti/rust_projects
a80f01006488d9d5eb02bf3c904361e0da02d0fd
[ "MIT" ]
null
null
null
cracker/main.py
dfioravanti/rust_projects
a80f01006488d9d5eb02bf3c904361e0da02d0fd
[ "MIT" ]
null
null
null
from libcracker import generate_valid_string original_string = "aaaa" nb_zeros = 5 nb_threads = 10 print(generate_valid_string(original_string, nb_zeros, nb_threads))
17.1
67
0.818713
25
171
5.2
0.56
0.2
0.292308
0.415385
0.507692
0
0
0
0
0
0
0.019868
0.116959
171
9
68
19
0.84106
0
0
0
1
0
0.023669
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.2
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
fa30ac8e5220e33b1542373d5c3d9b42852823eb
5,526
py
Python
api/Package.py
Purdue-ECE-461/project-2-3
77a12793b8e799982efa0508c8600ae81dc1fc07
[ "Apache-2.0" ]
1
2022-01-25T18:11:32.000Z
2022-01-25T18:11:32.000Z
api/Package.py
Purdue-ECE-461/project-2-3
77a12793b8e799982efa0508c8600ae81dc1fc07
[ "Apache-2.0" ]
null
null
null
api/Package.py
Purdue-ECE-461/project-2-3
77a12793b8e799982efa0508c8600ae81dc1fc07
[ "Apache-2.0" ]
null
null
null
from flask import Flask, request, jsonify import responses import requests import json app = Flask(__name__) class Package(object): import firestore as Firestore import datetime from MetaData import MetaData from PackageData import PackageData import Error import Packages import PackageRating from PackageHistoryEntry import PackageHistoryEntry import PackageQuery data = PackageData() metadata = MetaData() history = [] rating = 0 def toJSON(self): j = dict() j["metadata"] = str(self.metadata.toJSON()) j["data"] = str(self.data.toJSON()) j["history"] = self.history j["rating"] = str(self.rating) return json.dumps(j, default=lambda o: o.__dict__, sort_keys=True, indent=4) def get_self(self, ID): import firestore as Firestore packdict = Firestore.read(ID) try: self.rating = packdict["rating"] except: self.rating = 0 try: self.history = json.loads(packdict["history"]) except: self.history = [] self.metadata = self.metadata.get_data() self.data = self.data.get_data(ID) return self def __eq__(self, obj): if(obj == None): if ((not self) or self.metadata == None): return True else: return False return self.metadata == obj.metadata def __str__(self): return self.toJSON() if __name__ == "__main__" : from main import packageCreate jcreate = ''' { "metadata": { "Name": "Underscore", "Version": "1.0.0", "ID": "underscore" }, "data": { "Content": "UEsDBBQAAAAAAA9DQlMAAAAAAAAAAAAAAAALACAAZXhjZXB0aW9ucy9VVA0AB35PWGF+T1hhfk9YYXV4CwABBPcBAAAEFAAAAFBLAwQUAAgACACqMCJTAAAAAAAAAABNAQAAJAAgAGV4Y2VwdGlvbnMvQ29tbWNvdXJpZXJFeGNlcHRpb24uamF2YVVUDQAH4KEwYeGhMGHgoTBhdXgLAAEE9wEAAAQUAAAAdY7NCoMwDMfvfYoct0tfQAYDGbv7BrVmW9DaksQhDN99BSc65gKBwP/jl+R86+4IPgabN/g4MCFbHD0mpdhLYQyFFFl/PIyijpVuzqvYCiVlO5axwWKJdDHUsbVXVEXOTef5MmmoO/LgOycC5dp5WbCAo2LfCFRDrxRwFV7GQJ7E9HSKsMUCf/0w+2bSHuPwN3vMFPiMPkjsVoTTHmcyk3kDUEsHCOEX4+uiAAAATQEAAFBLAwQUAAgACACqMCJTAAAAAAAAAAB9AgAAKgAgAGV4Y2VwdGlvbnMvQ29tbWNvdXJpZXJFeGNlcHRpb25NYXBwZXIuamF2YVVUDQAH4KEwYeGhMGHgoTBhdXgLAAEE9wEAAAQUAAAAdVHNTsMwDL7nKXzcJOQXKKCJwYEDAiHxACY1U0bbRI7bVUJ7d7JCtrbbIkVx4u/HdgLZb9owWF9j2rX1rTgW5N5yUOebWBjj6uBFzzDCUUnUfZHViA8U+Z1jSBQurlFadZVTxxEz9CO9jDy21FGPrtmyVXwejmKa20WUmESF8cxujOBe8Sl38UIhsFzFvYnvXHkAmFWOTWg/K2fBVhQjrE9NzEQhaVZcc6MRZqnbS6x7+DEG0lr9tTfEk2mAzGYzoF87FkmFDbf/2jIN1OdwcckTuF9m28Ma/9XRDe6g4d0kt1gWJ5KwttJMi8M2lKRH/CMpLTLgJrnihjUn175Mgllxb/bmF1BLBwiV8DzjBgEAAH0CAABQSwMEFAAIAAgAD0NCUwAAAAAAAAAAGQMAACYAIABleGNlcHRpb25zL0dlbmVyaWNFeGNlcHRpb25NYXBwZXIuamF2YVVUDQAHfk9YYX9PWGF+T1hhdXgLAAEE9wEAAAQUAAAAjVNRa8IwEH7Prwg+VZA87a3bcJsyBhNHx9hzTE+Npk25XG3Z8L8v7ZbaKsICaS6977vvu6QtpNrLDXBlM+FnpmyJGlBAraAgbXMXM6azwiJdYBAcSSS9loqceJQOEnCFp0D8P0qAP9n0OqUkbTRpOME//JuerZ08yFrofAeKxEu7xMNc5QQ6XxRBXDjsI6AmMQ+NL2RRAF7FvaE96LQHMDZb2X2TA8yFM+ubnXhvnt7ptA3YNJBYUa6MVlwZ6Rx/hhxQqzNl7usayCAnx89St93+nn8zxv2Y/jbexoNz4nh2ai16eQBE76Td/ZkJNE42hFEnxKEeB61m9G+7k+B3PIdqkIvG8Ylk7EZ4XYvR6KGpGGpX0nHaoq3y0aQR6lEQqMR82IQoi1RSJzGTJD81bWfgFOq2YhTwE97/xsQ8SZZJIyE2QK9WSaO/IF2Ac/4fiMZB+MiO7AdQSwcIIu3xZlgBAAAZAwAAUEsBAhQDFAAAAAAAD0NCUwAAAAAAAAAAAAAAAAsAIAAAAAAAAAAAAO1BAAAAAGV4Y2VwdGlvbnMvVVQNAAd+T1hhfk9YYX5PWGF1eAsAAQT3AQAABBQAAABQSwECFAMUAAgACACqMCJT4Rfj66IAAABNAQAAJAAgAAAAAAAAAAAApIFJAAAAZXhjZXB0aW9ucy9Db21tY291cmllckV4Y2VwdGlvbi5qYXZhVVQNAAfgoTBh4aEwYeChMGF1eAsAAQT3AQAABBQAAABQSwECFAMUAAgACACqMCJTlfA84wYBAAB9AgAAKgAgAAAAAAAAAAAApIFdAQAAZXhjZXB0aW9ucy9Db21tY291cmllckV4Y2VwdGlvbk1hcHBlci5qYXZhVVQNAAfgoTBh4aEwYeChMGF1eAsAAQT3AQAABBQAAABQSwECFAMUAAgACAAPQ0JTIu3xZlgBAAAZAwAAJgAgAAAAAAAAAAAApIHbAgAAZXhjZXB0aW9ucy9HZW5lcmljRXhjZXB0aW9uTWFwcGVyLmphdmFVVA0AB35PWGF/T1hhfk9YYXV4CwABBPcBAAAEFAAAAFBLBQYAAAAABAAEALcBAACnBAAAAAA=", "JSProgram": "if (process.argv.length === 7) {\nconsole.log('\''Success'\'')\nprocess.exit(0)\n} else {\nconsole.log('\''Failed'\'')\nprocess.exit(1)\n}\n" } }''' jingest = ''' { "metadata": { "Name": "Underscore", "Version": "1.0.0", "ID": "underscore" }, "data": { "URL": "https://github.com/jashkenas/underscore", "JSProgram": "if (process.argv.length === 7) {\nconsole.log('\''Success'\'')\nprocess.exit(0)\n} else {\nconsole.log('\''Failed'\'')\nprocess.exit(1)\n}\n" } }''' r = requests.Request("/packages/", headers={"X-Authorization": "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}, json=jcreate) request = r resp = 200 with app.app_context(): resp = packageCreate() print(resp) if resp[1] == 201: resp = packageDelete(json.loads(str(resp[0]), strict=False)["ID"]) if resp != 200: print("delete failed") r = requests.Request("/packages/", headers={"X-Authorization": "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}, json=jingest) request = r resp = 200 with app.app_context(): resp = packageCreate() print(test.rating) print(resp)
53.134615
2,224
0.741947
361
5,526
11.268698
0.387812
0.014749
0.008358
0.012783
0.199607
0.199607
0.199607
0.199607
0.199607
0.199607
0
0.071569
0.170648
5,526
104
2,225
53.134615
0.816059
0
0
0.350515
0
0.030928
0.601773
0.493034
0
1
0
0
0
1
0.041237
false
0
0.154639
0.010309
0.309278
0.041237
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
5
d7036209a590bd7cc187b388d16f385f47135376
757
py
Python
dbconnect/connection/abstract.py
astercrono/python-dbconnect
6a2d6cc40b43deadaec32c11aa3bb8925eef2328
[ "BSD-3-Clause" ]
null
null
null
dbconnect/connection/abstract.py
astercrono/python-dbconnect
6a2d6cc40b43deadaec32c11aa3bb8925eef2328
[ "BSD-3-Clause" ]
null
null
null
dbconnect/connection/abstract.py
astercrono/python-dbconnect
6a2d6cc40b43deadaec32c11aa3bb8925eef2328
[ "BSD-3-Clause" ]
1
2019-02-05T20:37:39.000Z
2019-02-05T20:37:39.000Z
from abc import ABC, abstractmethod class AbstractDBConnection(ABC): @abstractmethod def connect(self, connection_string): pass @abstractmethod def close(self): pass @abstractmethod def is_open(self): pass @abstractmethod def rollback(self): pass @abstractmethod def commit(self): pass @abstractmethod def update(self, query): pass @abstractmethod def select(self, query): pass @abstractmethod def batch_update(self, queries, notify): pass @abstractmethod def set_transaction_size(self, size): pass @abstractmethod def get_transaction_size(self): pass @abstractmethod def enable_commit(self): pass @abstractmethod def disable_commit(self): pass @abstractmethod def commit_enabled(self): pass
13.763636
41
0.746367
89
757
6.235955
0.337079
0.398198
0.454054
0.315315
0.331532
0
0
0
0
0
0
0
0.171731
757
54
42
14.018519
0.885167
0
0
0.634146
0
0
0
0
0
0
0
0
0
1
0.317073
false
0.317073
0.02439
0
0.365854
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
5
d722bb2b3606d82ceb63efd1ae6386ab994f9192
299
py
Python
snippets/py/const/const.py
snippetfinder/The-Quick-Snippet-Reference
4d2c38cb3687f31428539b6c9cdb11abdd4c6682
[ "BSL-1.0" ]
10
2022-01-13T15:56:14.000Z
2022-01-21T20:43:29.000Z
snippets/py/const/const.py
snippetfinder/The-Quick-Snippet-Reference
4d2c38cb3687f31428539b6c9cdb11abdd4c6682
[ "BSL-1.0" ]
1
2022-01-21T20:33:13.000Z
2022-01-22T20:26:57.000Z
snippets/py/const/const.py
snippetfinder/The-Quick-Snippet-Reference
4d2c38cb3687f31428539b6c9cdb11abdd4c6682
[ "BSL-1.0" ]
null
null
null
# as function: def number(): return 10 def decimal(): return 2.3 def string(): return "Hello there." # ≡ def array(): return [2.3, 'Hello there.', [1, 2], {"a": 1, 'b': 2}] def dictionary(): return {"number": 2.3, 'list': [1, 2], "values": {'a': 1, "b": 2}} print(string()) # Hello there. ≡
42.714286
84
0.555184
49
299
3.428571
0.428571
0.035714
0.095238
0.047619
0
0
0
0
0
0
0
0.065844
0.187291
299
7
85
42.714286
0.617284
0.120401
0
0
0
0
0.169231
0
0
0
0
0
0
1
0.833333
true
0
0
0.833333
0.833333
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
1
1
0
0
5
d72754871e3b78020c0273228e78de85575a548c
148
py
Python
actions/get_idps.py
StackStorm-Exchange/keycloak
f978f295fbdcf72d3bde62d73d3ea023ed45378f
[ "Apache-2.0" ]
2
2021-01-04T13:16:57.000Z
2021-07-13T20:42:30.000Z
actions/get_idps.py
StackStorm-Exchange/keycloak
f978f295fbdcf72d3bde62d73d3ea023ed45378f
[ "Apache-2.0" ]
2
2017-10-20T23:58:33.000Z
2018-10-29T18:51:46.000Z
actions/get_idps.py
StackStorm-Exchange/keycloak
f978f295fbdcf72d3bde62d73d3ea023ed45378f
[ "Apache-2.0" ]
4
2017-11-02T16:57:30.000Z
2021-01-28T17:45:07.000Z
from lib import action class KeycloakgetRolesAction(action.KeycloakBaseAction): def run(self): return self.keycloak_admin.get_idps()
18.5
56
0.756757
17
148
6.470588
0.882353
0
0
0
0
0
0
0
0
0
0
0
0.168919
148
7
57
21.142857
0.894309
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
d76eac67dea8e4ef11926dec7090e0a57d9961e9
124
py
Python
solutions/0205_insomorphic-strings/python/solution_hash-mapping.py
Hsins/LeetCode
38766debcd76164b397fc1d1b6c7cc8115b2d226
[ "MIT" ]
2
2022-02-18T15:13:00.000Z
2022-02-18T15:13:06.000Z
solutions/0205_insomorphic-strings/python/solution_hash-mapping.py
Hsins/LeetCode
38766debcd76164b397fc1d1b6c7cc8115b2d226
[ "MIT" ]
null
null
null
solutions/0205_insomorphic-strings/python/solution_hash-mapping.py
Hsins/LeetCode
38766debcd76164b397fc1d1b6c7cc8115b2d226
[ "MIT" ]
null
null
null
class Solution: def isIsomorphic(self, s: str, t: str) -> bool: return [*map(s.index, s)] == [*map(t.index, t)]
31
55
0.564516
19
124
3.684211
0.631579
0
0
0
0
0
0
0
0
0
0
0
0.225806
124
3
56
41.333333
0.729167
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
ad27b9ef94524278c12f74774cb5b579fef7d352
27
py
Python
python/testData/quickFixes/PyMakeFunctionFromMethodQuickFixTest/usageImport2_after.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/quickFixes/PyMakeFunctionFromMethodQuickFixTest/usageImport2_after.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/quickFixes/PyMakeFunctionFromMethodQuickFixTest/usageImport2_after.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
from test import foo foo()
9
20
0.740741
5
27
4
0.8
0
0
0
0
0
0
0
0
0
0
0
0.185185
27
3
21
9
0.909091
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
ad4a60921a1ba898e2272469d1cd9e9d6a0795e2
200
py
Python
game/admin.py
pmarella2/Fox-and-Hounds
ad6e8868df9ec13d5c977cee093c7eb6a8150b6f
[ "MIT" ]
1
2020-05-12T23:55:55.000Z
2020-05-12T23:55:55.000Z
game/admin.py
pmarella2/Fox-and-Hounds
ad6e8868df9ec13d5c977cee093c7eb6a8150b6f
[ "MIT" ]
14
2020-05-11T22:43:48.000Z
2022-03-17T00:04:44.000Z
game/admin.py
pmarella2/Fox-and-Hounds
ad6e8868df9ec13d5c977cee093c7eb6a8150b6f
[ "MIT" ]
null
null
null
from django.contrib import admin from django_otp.admin import OTPAdminSite from .models import Game, GameLog admin.site.__class__ = OTPAdminSite admin.site.register(Game) admin.site.register(GameLog)
28.571429
41
0.835
28
200
5.785714
0.464286
0.166667
0.209877
0
0
0
0
0
0
0
0
0
0.09
200
7
42
28.571429
0.89011
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
ad55d703e1bbc60649dbb5ec8ec39b6839aaa8c3
46
py
Python
gitpy/repository/__init__.py
babygame0ver/gitpy
960306ef8f2e7827ddaed3fd875c5ac7db6b1d02
[ "MIT" ]
6
2019-12-27T14:08:27.000Z
2020-03-05T10:23:45.000Z
gitpy/repository/__init__.py
babygame0ver/gitpy
960306ef8f2e7827ddaed3fd875c5ac7db6b1d02
[ "MIT" ]
7
2020-01-08T06:02:26.000Z
2020-10-30T03:24:33.000Z
gitpy/repository/__init__.py
babygame0ver/gitpy
960306ef8f2e7827ddaed3fd875c5ac7db6b1d02
[ "MIT" ]
2
2019-10-28T17:10:38.000Z
2020-01-08T06:03:08.000Z
''' https://developer.github.com/v3/repos '''
23
45
0.652174
6
46
5
1
0
0
0
0
0
0
0
0
0
0
0.023256
0.065217
46
1
46
46
0.674419
0.804348
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
ad5d4c0601f7edd06e10f5605dc3c9f5be70568d
85
py
Python
notes/admin.py
truc0/simple-noteapp
34071ffc55e29f870816dc33b17b27333e09bf6e
[ "MIT" ]
1
2021-04-29T13:04:43.000Z
2021-04-29T13:04:43.000Z
notes/admin.py
truc0/simple-noteapp
34071ffc55e29f870816dc33b17b27333e09bf6e
[ "MIT" ]
22
2020-12-31T01:45:19.000Z
2021-10-13T04:55:18.000Z
notes/admin.py
truc0/simple-noteapp
34071ffc55e29f870816dc33b17b27333e09bf6e
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Note admin.site.register(Note)
17
32
0.811765
13
85
5.307692
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.117647
85
4
33
21.25
0.92
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
a8dd08d5c2e5deafdc515f7b5b6e533892a6844c
2,188
py
Python
tensorbay/healthcheck/basic_check.py
machearn/tensorbay-python-sdk
5c96a5f4c0028c7bec0764f2d0142b29597ec3a9
[ "MIT" ]
73
2021-02-24T12:23:26.000Z
2022-03-12T13:00:31.000Z
tensorbay/healthcheck/basic_check.py
machearn/tensorbay-python-sdk
5c96a5f4c0028c7bec0764f2d0142b29597ec3a9
[ "MIT" ]
681
2021-02-25T07:34:17.000Z
2022-03-25T07:08:23.000Z
tensorbay/healthcheck/basic_check.py
machearn/tensorbay-python-sdk
5c96a5f4c0028c7bec0764f2d0142b29597ec3a9
[ "MIT" ]
35
2021-02-24T12:00:45.000Z
2022-03-30T06:43:13.000Z
#!/usr/bin/env python3 # # Copyright 2021 Graviti. Licensed under MIT License. # """Method check_basic. :meth:`check_basic` checks whether :class:`~tensorbay.dataset.dataset.Dataset` or :class:`~tensorbay.dataset.dataset.FusionDataset` is empty and whether the :class:`~tensorbay.dataset.segment.Segment` or :class:`~tensorbay.dataset.dataset.FusionDataset` in the object is empty. """ from typing import Iterator, Union from tensorbay.dataset import Dataset, FusionDataset from tensorbay.healthcheck.report import Error class BasicError(Error): """The base class of the basic error. Arguments: name: The dataset or segment name which has error. """ def __init__(self, name: str) -> None: self._name = name class EmptyDatasetError(BasicError): """The health check function for empty dataset. This error is raised to indicate that :class:`~tensorbay.dataset.dataset.Dataset` or :class:`~tensorbay.dataset.dataset.FusionDataset` is empty. """ def __str__(self) -> str: return f"Dataset '{self._name}' is empty" class EmptySegmentError(BasicError): """The health check function for empty segment. This error is raised to indicate that :class:`~tensorbay.dataset.segment.Segment` or :class:`~tensorbay.dataset.dataset.FusionDataset` is empty. """ def __str__(self) -> str: return f"Segment '{self._name}' is empty" def check_basic(dataset: Union[Dataset, FusionDataset]) -> Iterator[BasicError]: """The health check function for basic error. Arguments: dataset: The :class:`~tensorbay.dataset.dataset.Dataset` or :class:`~tensorbay.dataset.dataset.FusionDataset` needs to be checked. Yields: BasicError indicating that :class:`~tensorbay.dataset.dataset.Dataset`, :class:`~tensorbay.dataset.dataset.FusionDataset`, :class:`~tensorbay.dataset.segment.Segment` or :class:`~tensorbay.dataset.segment.FusionSegment` is empty. """ if not dataset: yield EmptyDatasetError(dataset.name) return for segment in dataset: if not segment: yield EmptySegmentError(segment.name)
28.051282
85
0.699726
259
2,188
5.841699
0.27027
0.158625
0.194316
0.185063
0.506279
0.47918
0.430271
0.377396
0.377396
0.339061
0
0.002822
0.190128
2,188
77
86
28.415584
0.851016
0.59872
0
0.105263
0
0
0.080834
0
0
0
0
0
0
1
0.210526
false
0
0.157895
0.105263
0.684211
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
a8eca0c14a8c3a5027e590165acd7db655f2c74f
86
py
Python
NeuralAdversarialBalancing/__init__.py
MGIMM/Neural_Adversarial_Balancing
e8b68011cc1fef3c6f352dda8b7a0f9046ef6b4d
[ "MIT" ]
1
2021-11-26T22:03:22.000Z
2021-11-26T22:03:22.000Z
NeuralAdversarialBalancing/__init__.py
MGIMM/Neural_Adversarial_Balancing
e8b68011cc1fef3c6f352dda8b7a0f9046ef6b4d
[ "MIT" ]
null
null
null
NeuralAdversarialBalancing/__init__.py
MGIMM/Neural_Adversarial_Balancing
e8b68011cc1fef3c6f352dda8b7a0f9046ef6b4d
[ "MIT" ]
null
null
null
from .NeuralAdversarialBalancing import NeuralAdversarialBalancing, ParameterClipper
28.666667
84
0.906977
5
86
15.6
0.8
0
0
0
0
0
0
0
0
0
0
0
0.069767
86
2
85
43
0.975
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
a8ef92639db811e6142bb2ed43bb6d4bdc54cae2
83
py
Python
Arcade/Intro/1_The_Journey_Begins/3_checkPalindrome/code.py
leocabrallce/CodeFights
9037c68669c04bff6b6152491ce37dbbbec62aa9
[ "MIT" ]
null
null
null
Arcade/Intro/1_The_Journey_Begins/3_checkPalindrome/code.py
leocabrallce/CodeFights
9037c68669c04bff6b6152491ce37dbbbec62aa9
[ "MIT" ]
null
null
null
Arcade/Intro/1_The_Journey_Begins/3_checkPalindrome/code.py
leocabrallce/CodeFights
9037c68669c04bff6b6152491ce37dbbbec62aa9
[ "MIT" ]
null
null
null
def checkPalindrome(inputString): return inputString == str(inputString)[::-1]
27.666667
48
0.73494
8
83
7.625
0.75
0
0
0
0
0
0
0
0
0
0
0.013699
0.120482
83
2
49
41.5
0.821918
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
a8fe770af46df264ed013e3494c8e1e36c0c2087
1,960
py
Python
tests/test_markers.py
orenavitov/passa
d4c7dbb5d62e017f5868d095cffcc3b21b64cdae
[ "ISC" ]
55
2018-08-07T23:40:48.000Z
2021-10-05T10:05:25.000Z
tests/test_markers.py
orenavitov/passa
d4c7dbb5d62e017f5868d095cffcc3b21b64cdae
[ "ISC" ]
60
2018-08-16T17:47:20.000Z
2021-03-20T13:20:17.000Z
tests/test_markers.py
orenavitov/passa
d4c7dbb5d62e017f5868d095cffcc3b21b64cdae
[ "ISC" ]
11
2018-09-06T10:09:41.000Z
2022-01-25T15:03:32.000Z
from packaging.markers import Marker from passa.internals.markers import get_without_extra def test_strip_marker_extra_noop(): marker = get_without_extra( Marker('os_name == "nt" or sys_platform == "Windows"'), ) assert str(marker) == 'os_name == "nt" or sys_platform == "Windows"' def test_strip_marker_none(): marker = get_without_extra(None) assert marker is None def test_strip_marker_extra_only(): marker = get_without_extra(Marker('extra == "sock"')) assert marker is None def test_strip_marker_extra_simple(): marker = get_without_extra(Marker('os_name == "nt" and extra == "sock"')) assert str(marker) == 'os_name == "nt"' def test_strip_marker_extra_in_front(): marker = get_without_extra(Marker('extra == "sock" or os_name == "nt"')) assert str(marker) == 'os_name == "nt"' def test_strip_marker_extra_nested(): marker = get_without_extra(Marker( '(os_name == "nt" or sys_platform == "Windows") ' 'and extra == "sock"', )) assert str(marker) == 'os_name == "nt" or sys_platform == "Windows"' def test_strip_marker_extra_crazy(): marker = get_without_extra(Marker( '(os_name == "nt" or sys_platform == "Windows" and extra == "huh") ' 'and extra == "sock"', )) assert str(marker) == 'os_name == "nt" or sys_platform == "Windows"' def test_strip_marker_extra_cancelled(): marker = get_without_extra(Marker('extra == "sock" or extra == "huh"')) assert marker is None def test_strip_marker_extra_paranthesized_cancelled(): marker = get_without_extra(Marker( '(extra == "sock") or (extra == "huh") or (sys_platform == "Windows")', )) assert str(marker) == 'sys_platform == "Windows"' def test_strip_marker_extra_crazy_cancelled(): marker = get_without_extra(Marker( '(extra == "foo" or extra == "sock") or ' '(extra == "huh" or extra == "bar")', )) assert marker is None
29.253731
79
0.652041
258
1,960
4.635659
0.147287
0.128763
0.13796
0.150502
0.841973
0.822742
0.805184
0.711538
0.650502
0.494983
0
0
0.20102
1,960
66
80
29.69697
0.763729
0
0
0.422222
0
0
0.326531
0
0
0
0
0
0.222222
1
0.222222
false
0.022222
0.044444
0
0.266667
0
0
0
0
null
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
d10d56e0950b9d52d29412e4e5dae09f54999b3e
137
py
Python
insights/parsers/nova_conf.py
lhuett/insights-core
1c84eeffc037f85e2bbf60c9a302c83aa1a50cf8
[ "Apache-2.0" ]
121
2017-05-30T20:23:25.000Z
2022-03-23T12:52:15.000Z
insights/parsers/nova_conf.py
lhuett/insights-core
1c84eeffc037f85e2bbf60c9a302c83aa1a50cf8
[ "Apache-2.0" ]
1,977
2017-05-26T14:36:03.000Z
2022-03-31T10:38:53.000Z
insights/parsers/nova_conf.py
lhuett/insights-core
1c84eeffc037f85e2bbf60c9a302c83aa1a50cf8
[ "Apache-2.0" ]
244
2017-05-30T20:22:57.000Z
2022-03-26T10:09:39.000Z
from .. import parser, IniConfigFile from insights.specs import Specs @parser(Specs.nova_conf) class NovaConf(IniConfigFile): pass
17.125
36
0.781022
17
137
6.235294
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.138686
137
7
37
19.571429
0.898305
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.2
0.4
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
5
d16cb66031567401786aaa7a7e38c5f818c8290a
25
py
Python
bfm/__init__.py
MaxMls/3DDFA_V2
9c622c9468a00a890a3de6d4e968cf3d7ddb03b8
[ "MIT" ]
2,153
2020-08-25T09:44:57.000Z
2022-03-31T03:09:21.000Z
bfm/__init__.py
MaxMls/3DDFA_V2
9c622c9468a00a890a3de6d4e968cf3d7ddb03b8
[ "MIT" ]
123
2020-08-30T02:21:22.000Z
2022-03-13T06:53:44.000Z
bfm/__init__.py
MaxMls/3DDFA_V2
9c622c9468a00a890a3de6d4e968cf3d7ddb03b8
[ "MIT" ]
394
2020-08-27T14:24:53.000Z
2022-03-31T07:46:45.000Z
from .bfm import BFMModel
25
25
0.84
4
25
5.25
1
0
0
0
0
0
0
0
0
0
0
0
0.12
25
1
25
25
0.954545
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
66f9780f9ee2d84365a995517ebe3a488212312c
239
py
Python
gbdxtools/ipe/__init__.py
matthewhanson/gbdxtools
f07fed2ea2b8d62845f6cf83c3947d0c2a4c6daf
[ "MIT" ]
null
null
null
gbdxtools/ipe/__init__.py
matthewhanson/gbdxtools
f07fed2ea2b8d62845f6cf83c3947d0c2a4c6daf
[ "MIT" ]
null
null
null
gbdxtools/ipe/__init__.py
matthewhanson/gbdxtools
f07fed2ea2b8d62845f6cf83c3947d0c2a4c6daf
[ "MIT" ]
null
null
null
import sys import gbdxtools.rda from gbdxtools.rda.util import deprecation deprecation("The module 'gbdxtools.ipe' has been deprecated, functionality has been moved to gbdxtools.rda") sys.modules[__name__] = sys.modules['gbdxtools.rda']
29.875
108
0.803347
33
239
5.69697
0.545455
0.255319
0
0
0
0
0
0
0
0
0
0
0.104603
239
7
109
34.142857
0.878505
0
0
0
0
0
0.443515
0
0
0
0
0
0
1
0
true
0
0.6
0
0.6
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
0f0b494ff862cd5d6406848bcf5d9252116eccf9
79
py
Python
qrogue/game/world/navigation/__init__.py
7Magic7Mike7/Qrogue
70bd5671a77981c1d4b633246321ba44f13c21ff
[ "MIT" ]
4
2021-12-14T19:13:43.000Z
2022-02-16T13:25:38.000Z
qrogue/game/world/navigation/__init__.py
7Magic7Mike7/Qrogue
70bd5671a77981c1d4b633246321ba44f13c21ff
[ "MIT" ]
null
null
null
qrogue/game/world/navigation/__init__.py
7Magic7Mike7/Qrogue
70bd5671a77981c1d4b633246321ba44f13c21ff
[ "MIT" ]
1
2022-01-04T18:35:51.000Z
2022-01-04T18:35:51.000Z
# exporting from .navigation import Coordinate, Direction # importing # +util
13.166667
45
0.772152
8
79
7.625
1
0
0
0
0
0
0
0
0
0
0
0
0.151899
79
5
46
15.8
0.910448
0.316456
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
0f1cfaa915f436300f6821bd335c8490f2d81968
6,583
py
Python
tests/test_stimp.py
stumpy-dev/stumpy
589630e0308529d000fe9c06504ee7e4f759bc0b
[ "BSD-3-Clause" ]
null
null
null
tests/test_stimp.py
stumpy-dev/stumpy
589630e0308529d000fe9c06504ee7e4f759bc0b
[ "BSD-3-Clause" ]
null
null
null
tests/test_stimp.py
stumpy-dev/stumpy
589630e0308529d000fe9c06504ee7e4f759bc0b
[ "BSD-3-Clause" ]
null
null
null
import numpy as np import numpy.testing as npt from stumpy import stimp, stimped from stumpy.stimp import _bfs_indices from dask.distributed import Client, LocalCluster import pytest import naive T = [ np.array([584, -11, 23, 79, 1001, 0, -19], dtype=np.float64), np.random.uniform(-1000, 1000, [64]).astype(np.float64), ] n = [9, 10, 16] @pytest.fixture(scope="module") def dask_cluster(): cluster = LocalCluster(n_workers=2, threads_per_worker=2) yield cluster cluster.close() def split(node, out): mid = len(node) // 2 out.append(node[mid]) return node[:mid], node[mid + 1 :] def naive_bsf_indices(n): a = np.arange(n) nodes = [a.tolist()] out = [] while nodes: tmp = [] for node in nodes: for n in split(node, out): if n: tmp.append(n) nodes = tmp return np.array(out) @pytest.mark.parametrize("n", n) def test_bsf_indices(n): ref_bsf_indices = naive_bsf_indices(n) cmp_bsf_indices = np.array(list(_bfs_indices(n))) npt.assert_almost_equal(ref_bsf_indices, cmp_bsf_indices) @pytest.mark.parametrize("T", T) def test_stimp_1_percent(T): threshold = 0.2 percentage = 0.01 min_m = 3 n = T.shape[0] - min_m + 1 seed = np.random.randint(100000) np.random.seed(seed) pan = stimp( T, min_m=min_m, max_m=None, step=1, percentage=percentage, pre_scrump=True, # normalize=True, ) for i in range(n): pan.update() ref_PAN = np.full((pan.M_.shape[0], T.shape[0]), fill_value=np.inf) np.random.seed(seed) for idx, m in enumerate(pan.M_[:n]): zone = int(np.ceil(m / 4)) s = zone tmp_P, tmp_I = naive.prescrump(T, m, T, s=s, exclusion_zone=zone) ref_mp = naive.scrump(T, m, T, percentage, zone, True, s) for i in range(ref_mp.shape[0]): if tmp_P[i] < ref_mp[i, 0]: ref_mp[i, 0] = tmp_P[i] ref_mp[i, 1] = tmp_I[i] ref_PAN[pan._bfs_indices[idx], : ref_mp.shape[0]] = ref_mp[:, 0] # Compare raw pan cmp_PAN = pan._PAN naive.replace_inf(ref_PAN) naive.replace_inf(cmp_PAN) npt.assert_almost_equal(ref_PAN, cmp_PAN) # Compare transformed pan cmp_pan = pan.PAN_ ref_pan = naive.transform_pan( pan._PAN, pan._M, threshold, pan._bfs_indices, pan._n_processed ) naive.replace_inf(ref_pan) naive.replace_inf(cmp_pan) npt.assert_almost_equal(ref_pan, cmp_pan) @pytest.mark.parametrize("T", T) def test_stimp_max_m(T): threshold = 0.2 percentage = 0.01 min_m = 3 max_m = 5 n = T.shape[0] - min_m + 1 seed = np.random.randint(100000) np.random.seed(seed) pan = stimp( T, min_m=min_m, max_m=max_m, step=1, percentage=percentage, pre_scrump=True, # normalize=True, ) for i in range(n): pan.update() ref_PAN = np.full((pan.M_.shape[0], T.shape[0]), fill_value=np.inf) np.random.seed(seed) for idx, m in enumerate(pan.M_[:n]): zone = int(np.ceil(m / 4)) s = zone tmp_P, tmp_I = naive.prescrump(T, m, T, s=s, exclusion_zone=zone) ref_mp = naive.scrump(T, m, T, percentage, zone, True, s) for i in range(ref_mp.shape[0]): if tmp_P[i] < ref_mp[i, 0]: ref_mp[i, 0] = tmp_P[i] ref_mp[i, 1] = tmp_I[i] ref_PAN[pan._bfs_indices[idx], : ref_mp.shape[0]] = ref_mp[:, 0] # Compare raw pan cmp_PAN = pan._PAN naive.replace_inf(ref_PAN) naive.replace_inf(cmp_PAN) npt.assert_almost_equal(ref_PAN, cmp_PAN) # Compare transformed pan cmp_pan = pan.PAN_ ref_pan = naive.transform_pan( pan._PAN, pan._M, threshold, pan._bfs_indices, pan._n_processed ) naive.replace_inf(ref_pan) naive.replace_inf(cmp_pan) npt.assert_almost_equal(ref_pan, cmp_pan) @pytest.mark.parametrize("T", T) def test_stimp_100_percent(T): threshold = 0.2 percentage = 1.0 min_m = 3 n = T.shape[0] - min_m + 1 pan = stimp( T, min_m=min_m, max_m=None, step=1, percentage=percentage, pre_scrump=True, # normalize=True, ) for i in range(n): pan.update() ref_PAN = np.full((pan.M_.shape[0], T.shape[0]), fill_value=np.inf) for idx, m in enumerate(pan.M_[:n]): zone = int(np.ceil(m / 4)) ref_mp = naive.stump(T, m, T_B=None, exclusion_zone=zone) ref_PAN[pan._bfs_indices[idx], : ref_mp.shape[0]] = ref_mp[:, 0] # Compare raw pan cmp_PAN = pan._PAN naive.replace_inf(ref_PAN) naive.replace_inf(cmp_PAN) npt.assert_almost_equal(ref_PAN, cmp_PAN) # Compare transformed pan cmp_pan = pan.PAN_ ref_pan = naive.transform_pan( pan._PAN, pan._M, threshold, pan._bfs_indices, pan._n_processed ) naive.replace_inf(ref_pan) naive.replace_inf(cmp_pan) npt.assert_almost_equal(ref_pan, cmp_pan) @pytest.mark.filterwarnings("ignore:numpy.dtype size changed") @pytest.mark.filterwarnings("ignore:numpy.ufunc size changed") @pytest.mark.filterwarnings("ignore:numpy.ndarray size changed") @pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning") @pytest.mark.parametrize("T", T) def test_stimped(T, dask_cluster): with Client(dask_cluster) as dask_client: threshold = 0.2 min_m = 3 n = T.shape[0] - min_m + 1 pan = stimped( dask_client, T, min_m=min_m, max_m=None, step=1, # normalize=True, ) for i in range(n): pan.update() ref_PAN = np.full((pan.M_.shape[0], T.shape[0]), fill_value=np.inf) for idx, m in enumerate(pan.M_[:n]): zone = int(np.ceil(m / 4)) ref_mp = naive.stump(T, m, T_B=None, exclusion_zone=zone) ref_PAN[pan._bfs_indices[idx], : ref_mp.shape[0]] = ref_mp[:, 0] # Compare raw pan cmp_PAN = pan._PAN naive.replace_inf(ref_PAN) naive.replace_inf(cmp_PAN) npt.assert_almost_equal(ref_PAN, cmp_PAN) # Compare transformed pan cmp_pan = pan.PAN_ ref_pan = naive.transform_pan( pan._PAN, pan._M, threshold, pan._bfs_indices, pan._n_processed ) naive.replace_inf(ref_pan) naive.replace_inf(cmp_pan) npt.assert_almost_equal(ref_pan, cmp_pan)
24.74812
81
0.600638
1,016
6,583
3.656496
0.134843
0.051682
0.038762
0.058143
0.779004
0.766083
0.745357
0.712517
0.703096
0.703096
0
0.025026
0.271609
6,583
265
82
24.841509
0.749739
0.033875
0
0.680851
0
0
0.024579
0
0
0
0
0
0.047872
1
0.042553
false
0
0.037234
0
0.090426
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
0f39e9cb3a2173913d716e8cfb5646de6b5b1552
96
py
Python
flopy/export/__init__.py
hansonmcoombs/flopy
49398983c36d381992621d5bf698ea7f78fc0014
[ "CC0-1.0", "BSD-3-Clause" ]
null
null
null
flopy/export/__init__.py
hansonmcoombs/flopy
49398983c36d381992621d5bf698ea7f78fc0014
[ "CC0-1.0", "BSD-3-Clause" ]
null
null
null
flopy/export/__init__.py
hansonmcoombs/flopy
49398983c36d381992621d5bf698ea7f78fc0014
[ "CC0-1.0", "BSD-3-Clause" ]
null
null
null
from .netcdf import Logger, NetCdf # isort:skip from . import metadata, shapefile_utils, utils
32
48
0.78125
13
96
5.692308
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.145833
96
2
49
48
0.902439
0.104167
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
0f4b8a1e37632f31ebeaeb3a02a8e75804e6061c
156
py
Python
mathics/builtin/arithfns/__init__.py
tirkarthi/mathics-core
6b07500b935f23dc332f4ec3fac1d71ac4c8fc04
[ "Apache-2.0" ]
90
2021-09-11T14:14:00.000Z
2022-03-29T02:08:29.000Z
mathics/builtin/arithfns/__init__.py
tirkarthi/mathics-core
6b07500b935f23dc332f4ec3fac1d71ac4c8fc04
[ "Apache-2.0" ]
187
2021-09-13T01:00:41.000Z
2022-03-31T11:52:52.000Z
mathics/builtin/arithfns/__init__.py
tirkarthi/mathics-core
6b07500b935f23dc332f4ec3fac1d71ac4c8fc04
[ "Apache-2.0" ]
10
2021-10-05T15:44:26.000Z
2022-03-21T12:34:33.000Z
""" Arithmetic Functions Arithmetic Functions are functions that work on individual numbers, lists, and arrays: in either symbolic or algebraic forms. """
26
125
0.788462
20
156
6.15
0.85
0.308943
0
0
0
0
0
0
0
0
0
0
0.147436
156
5
126
31.2
0.924812
0.942308
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
0f4dc976ea80a0eb0c75bcbb3b2a85d82e4e44e4
80
py
Python
code_icc/archs/cluster/baselines/__init__.py
ThmCuong/IIC-Python3
5a02b40ffa07b159fa7e89cf5b4ed781f4798ff1
[ "MIT" ]
null
null
null
code_icc/archs/cluster/baselines/__init__.py
ThmCuong/IIC-Python3
5a02b40ffa07b159fa7e89cf5b4ed781f4798ff1
[ "MIT" ]
null
null
null
code_icc/archs/cluster/baselines/__init__.py
ThmCuong/IIC-Python3
5a02b40ffa07b159fa7e89cf5b4ed781f4798ff1
[ "MIT" ]
null
null
null
# from code_icc.archs.cluster.baselines.triplets import * from . import triplets
40
57
0.8125
11
80
5.818182
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.1
80
2
58
40
0.888889
0.6875
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
0f5030fea86046cc90521b24abd7bb88924b8c13
63
py
Python
dodo.py
tonyfast/lit_fizz
e26c5d580bbabc1f8b82a024dc9a7888987e7b3e
[ "MIT" ]
null
null
null
dodo.py
tonyfast/lit_fizz
e26c5d580bbabc1f8b82a024dc9a7888987e7b3e
[ "MIT" ]
null
null
null
dodo.py
tonyfast/lit_fizz
e26c5d580bbabc1f8b82a024dc9a7888987e7b3e
[ "MIT" ]
null
null
null
with __import__('tingle').Markdown(): from readme import *
21
37
0.698413
7
63
5.714286
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.15873
63
2
38
31.5
0.754717
0
0
0
0
0
0.095238
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
7e2ff6882d64a481c11a06a1ee7c2fbb36a73a5d
3,894
py
Python
Python5.py
SubOptimal/PythonChallenge
989a04500aa371057315dffb6e3d03a968f16130
[ "MIT" ]
null
null
null
Python5.py
SubOptimal/PythonChallenge
989a04500aa371057315dffb6e3d03a968f16130
[ "MIT" ]
null
null
null
Python5.py
SubOptimal/PythonChallenge
989a04500aa371057315dffb6e3d03a968f16130
[ "MIT" ]
1
2019-04-11T17:39:00.000Z
2019-04-11T17:39:00.000Z
#Used to make requests import urllib.request import pickle base_url="http://www.pythonchallenge.com/pc/def/banner.p" x = urllib.request.urlopen(base_url) y = pickle.loads(x.read()) print(y) #[[(' ', 95)], [(' ', 14), ('#', 5), (' ', 70), ('#', 5), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 6), ('#', 3), (' ', 6), ('#', 4), (' ', 3), ('#', 3), (' ', 9), ('#', 3), (' ', 7), ('#', 5), (' ', 3), ('#', 3), (' ', 4), ('#', 5), (' ', 3), ('#', 3), (' ', 10), ('#', 3), (' ', 7), ('#', 4), (' ', 1)], [(' ', 3), ('#', 3), (' ', 3), ('#', 2), (' ', 4), ('#', 4), (' ', 1), ('#', 7), (' ', 5), ('#', 2), (' ', 2), ('#', 3), (' ', 6), ('#', 4), (' ', 1), ('#', 7), (' ', 3), ('#', 4), (' ', 1), ('#', 7), (' ', 5), ('#', 3), (' ', 2), ('#', 3), (' ', 5), ('#', 4), (' ', 1)], [(' ', 2), ('#', 3), (' ', 5), ('#', 3), (' ', 2), ('#', 5), (' ', 4), ('#', 4), (' ', 3), ('#', 3), (' ', 3), ('#', 4), (' ', 4), ('#', 5), (' ', 4), ('#', 4), (' ', 2), ('#', 5), (' ', 4), ('#', 4), (' ', 3), ('#', 3), (' ', 5), ('#', 3), (' ', 3), ('#', 4), (' ', 1)], [(' ', 1), ('#', 3), (' ', 11), ('#', 4), (' ', 5), ('#', 4), (' ', 3), ('#', 3), (' ', 4), ('#', 3), (' ', 4), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 3), (' ', 6), ('#', 4), (' ', 2), ('#', 4), (' ', 1)], [(' ', 1), ('#', 3), (' ', 11), ('#', 4), (' ', 5), ('#', 4), (' ', 10), ('#', 3), (' ', 4), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 3), (' ', 7), ('#', 3), (' ', 2), ('#', 4), (' ', 1)], [('#', 4), (' ', 11), ('#', 4), (' ', 5), ('#', 4), (' ', 5), ('#', 2), (' ', 3), ('#', 3), (' ', 4), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 1), ('#', 4), (' ', 7), ('#', 3), (' ', 2), ('#', 4), (' ', 1)], [('#', 4), (' ', 11), ('#', 4), (' ', 5), ('#', 4), (' ', 3), ('#', 10), (' ', 4), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 1), ('#', 14), (' ', 2), ('#', 4), (' ', 1)], [('#', 4), (' ', 11), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 3), (' ', 4), ('#', 4), (' ', 4), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 1), ('#', 4), (' ', 12), ('#', 4), (' ', 1)], [('#', 4), (' ', 11), ('#', 4), (' ', 5), ('#', 4), (' ', 1), ('#', 4), (' ', 5), ('#', 3), (' ', 4), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 1), ('#', 4), (' ', 12), ('#', 4), (' ', 1)], [(' ', 1), ('#', 3), (' ', 11), ('#', 4), (' ', 5), ('#', 4), (' ', 1), ('#', 4), (' ', 5), ('#', 3), (' ', 4), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 3), (' ', 12), ('#', 4), (' ', 1)], [(' ', 2), ('#', 3), (' ', 6), ('#', 2), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 3), (' ', 4), ('#', 4), (' ', 4), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 3), ('#', 3), (' ', 6), ('#', 2), (' ', 3), ('#', 4), (' ', 1)], [(' ', 3), ('#', 3), (' ', 4), ('#', 2), (' ', 3), ('#', 4), (' ', 5), ('#', 4), (' ', 3), ('#', 11), (' ', 3), ('#', 4), (' ', 5), ('#', 4), (' ', 2), ('#', 4), (' ', 5), ('#', 4), (' ', 4), ('#', 3), (' ', 4), ('#', 2), (' ', 4), ('#', 4), (' ', 1)], [(' ', 6), ('#', 3), (' ', 5), ('#', 6), (' ', 4), ('#', 5), (' ', 4), ('#', 2), (' ', 4), ('#', 4), (' ', 1), ('#', 6), (' ', 4), ('#', 11), (' ', 4), ('#', 5), (' ', 6), ('#', 3), (' ', 6), ('#', 6)], [(' ', 95)]] for line in y: for t in line: print(t[0]*t[1], end = '') print("") #Set terminal width to a minimum width for best results.
177
3,561
0.156651
405
3,894
1.501235
0.130864
0.111842
0.143092
0.098684
0.434211
0.422697
0.371711
0.358553
0.315789
0.300987
0
0.129817
0.24037
3,894
22
3,562
177
0.075727
0.891371
0
0
0
0
0.179688
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.3
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
7e36c1620eae34c5d0e60ea0469ddc7f37fe39e6
8,411
py
Python
operations.py
aniruddhraghu/ecg_aug
6779c99948bb588849fab43dc9cab266819f9994
[ "Apache-2.0" ]
null
null
null
operations.py
aniruddhraghu/ecg_aug
6779c99948bb588849fab43dc9cab266819f9994
[ "Apache-2.0" ]
null
null
null
operations.py
aniruddhraghu/ecg_aug
6779c99948bb588849fab43dc9cab266819f9994
[ "Apache-2.0" ]
null
null
null
############ Adapted from https://github.com/moskomule/dda ############# """ Operations """ from scipy.special import logit import torch from torch import nn from torch.distributions import RelaxedBernoulli, Bernoulli from functional import (rand_temporal_warp, baseline_wander, gaussian_noise, rand_crop, rand_crop_base, spec_aug, rand_displacement, magnitude_scale) import warp_ops class _Operation(nn.Module): """ Base class of operation :param operation: :param initial_magnitude: :param initial_probability: :param learn_magnitude: :param learn_probability: :param temperature: Temperature for RelaxedBernoulli distribution used during training """ def __init__(self, operation, initial_magnitude, initial_probability=[0.9999999,0.9999999], learn_magnitude=True, learn_probability=True, temperature = 0.1, ): super().__init__() self.operation = operation if initial_magnitude is not None and learn_magnitude: self.magnitude = nn.Parameter(torch.Tensor(initial_magnitude)) else: self.magnitude = torch.Tensor(initial_magnitude) if learn_probability: self.probability = nn.Parameter(torch.Tensor([float(logit(i)) for i in initial_probability])) else: self.probability = torch.Tensor([float(logit(i)) for i in initial_probability]) assert 0 < temperature self.temperature = temperature def forward(self,input, label): mask = self.get_mask(label, input.size(0)).to(input.device) mag = self.magnitude.to(input.device).unsqueeze(0) # we need a per-ex mag based on the class label. Right now, the mag is a (1x2) tensor. # First repeat in BS dimension BS, C, L = input.shape mag = mag.repeat(BS, 1) # Now it is BS x 2, or BS by class num more generally. Select out the relevant entries. # Also add a sum over all elems to make sure we don't get an error in autograd. mag_rel = 0*mag.sum() + mag[torch.arange(BS), label.long()] mag_rel = mag_rel.view(BS, 1, 1) transformed = self.operation(input, mag_rel) mask = mask.view(BS, 1, 1) retval = (mask * transformed + (1 - mask) * input) return retval def get_mask(self, label, batch_size=None): prob = torch.sigmoid(self.probability).unsqueeze(0) prob = prob.repeat(batch_size, 1) prob = 0*prob.sum() + prob[torch.arange(batch_size), label.long()] if self.training: return RelaxedBernoulli(self.temperature, prob).rsample() else: return Bernoulli(prob).sample() class NoOp(_Operation): def __init__(self, initial_magnitude=[2., 2.], initial_probability=[0.9999999,0.9999999], learn_magnitude=False, learn_probability=False, temperature = 0.1, ): super().__init__(None, initial_magnitude, initial_probability, learn_magnitude, learn_probability, temperature) def forward(self, input, label): return input class RandTemporalWarp(_Operation): def __init__(self, initial_magnitude=[2., 2.], initial_probability=[0.9999999,0.9999999], learn_magnitude=True, learn_probability=True, temperature = 0.1, ): super().__init__(rand_temporal_warp, initial_magnitude, initial_probability, learn_magnitude, learn_probability, temperature) # create the warp obj here. self.warp_obj = warp_ops.RandWarpAug([2496]) def forward(self,input, label): mask = self.get_mask(label, input.size(0)).to(input.device) mag = self.magnitude.to(input.device).unsqueeze(0) # we need a per-ex mag based on the class label. Right now, the mag is a (1x2) tensor. # First repeat in BS dimension BS, C, L = input.shape mag = mag.repeat(BS, 1) # Now it is BS x 2, or BS by class num more generally. Select out the relevant entries. # Also add a sum over all elems to make sure we don't get an error in autograd. mag_rel = 0*mag.sum() + mag[torch.arange(BS), label.long()] mag_rel = mag_rel.view(BS, 1, 1) transformed = self.operation(input, mag_rel, self.warp_obj) B, C, L = transformed.shape mask = mask.view(B, 1, 1) retval = (mask * transformed + (1 - mask) * input) return retval class BaselineWander(_Operation): def __init__(self, initial_magnitude=[0.0,0.0], initial_probability=[0.9999999,0.9999999], learn_magnitude=True, learn_probability=True, temperature = 0.1, ): super().__init__(baseline_wander, initial_magnitude, initial_probability, learn_magnitude, learn_probability, temperature) class GaussianNoise(_Operation): def __init__(self, initial_magnitude=[0.0,0.0], initial_probability=[0.9999999,0.9999999], learn_magnitude=True, learn_probability=True, temperature = 0.1, ): super().__init__(gaussian_noise, initial_magnitude, initial_probability, learn_magnitude, learn_probability, temperature) class RandCrop(_Operation): def __init__(self, initial_magnitude=[0.05], initial_probability=[0.9999999,0.9999999], learn_magnitude=False, learn_probability=True, temperature = 0.1, ): super().__init__(rand_crop, initial_magnitude, initial_probability, learn_magnitude, learn_probability, temperature) def forward(self,input, label): mask = self.get_mask(label, input.size(0)).to(input.device) mag = self.magnitude.to(input.device) transformed = self.operation(input, mag) B, C, L = transformed.shape mask = mask.view(B, 1, 1) retval = (mask * transformed + (1 - mask) * input) return retval class RandDisplacement(_Operation): def __init__(self, initial_magnitude=[0.5,0.5], initial_probability=[0.9999999,0.9999999], learn_magnitude=True, learn_probability=True, temperature = 0.1, ): super().__init__(rand_displacement, initial_magnitude, initial_probability, learn_magnitude, learn_probability, temperature) # create the warp obj here. self.warp_obj = warp_ops.DispAug([2496]) def forward(self,input, label): mask = self.get_mask(label, input.size(0)).to(input.device) mag = self.magnitude.to(input.device).unsqueeze(0) # we need a per-ex mag based on the class label. Right now, the mag is a (1x2) tensor. # First repeat in BS dimension BS, C, L = input.shape mag = mag.repeat(BS, 1) # Now it is BS x 2, or BS by class num more generally. Select out the relevant entries. # Also add a sum over all elems to make sure we don't get an error in autograd. mag_rel = 0*mag.sum() + mag[torch.arange(BS), label.long()] mag_rel = mag_rel.view(BS, 1, 1) transformed = self.operation(input, mag_rel, self.warp_obj) B, C, L = transformed.shape mask = mask.view(B, 1, 1) retval = (mask * transformed + (1 - mask) * input) return retval class MagnitudeScale(_Operation): def __init__(self, initial_magnitude=[0.0,0.0], initial_probability=[0.9999999,0.9999999], learn_magnitude=True, learn_probability=True, temperature = 0.1, ): super().__init__(magnitude_scale, initial_magnitude, initial_probability, learn_magnitude, learn_probability, temperature)
37.717489
149
0.590655
978
8,411
4.888548
0.152352
0.063585
0.018406
0.056892
0.738339
0.727045
0.727045
0.711567
0.711567
0.689605
0
0.037896
0.312924
8,411
222
150
37.887387
0.78941
0.140887
0
0.666667
0
0
0
0
0
0
0
0
0.006536
1
0.091503
false
0
0.039216
0.006536
0.228758
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
7e3d574b9756e8a862d63e67230ae283baff36f7
138
py
Python
management/commands/refresh.py
AileenLumina/dwarf
5fc3b1b532290a474d17f84694dae1d0d53be7b4
[ "MIT" ]
null
null
null
management/commands/refresh.py
AileenLumina/dwarf
5fc3b1b532290a474d17f84694dae1d0d53be7b4
[ "MIT" ]
null
null
null
management/commands/refresh.py
AileenLumina/dwarf
5fc3b1b532290a474d17f84694dae1d0d53be7b4
[ "MIT" ]
null
null
null
from dwarf.bot import bot bot.loop.close() # TODO Also shutdown the web interface # TODO Make it actually reboot # TODO Backup instance
17.25
38
0.768116
22
138
4.818182
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.173913
138
7
39
19.714286
0.929825
0.623188
0
0
0
0
0
0
0
0
0
0.142857
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
1
0
1
0
0
0
0
5
7e3fc79a3e54dee2f2912c7c7bb3625262e88cea
176
py
Python
shop/admin.py
hosseinkianmehr/solar-site
6e7995e70442efded3e7bde7cd776fa74dd74372
[ "MIT" ]
3
2021-01-19T20:12:09.000Z
2021-11-18T10:06:45.000Z
shop/admin.py
hosseinkianmehr/solar-site
6e7995e70442efded3e7bde7cd776fa74dd74372
[ "MIT" ]
null
null
null
shop/admin.py
hosseinkianmehr/solar-site
6e7995e70442efded3e7bde7cd776fa74dd74372
[ "MIT" ]
null
null
null
from django.contrib import admin from shop.models import * # Register your models here. admin.site.register(shop), admin.site.register(company), admin.site.register(salessite)
25.142857
32
0.801136
25
176
5.64
0.52
0.191489
0.361702
0
0
0
0
0
0
0
0
0
0.090909
176
7
33
25.142857
0.88125
0.147727
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7e58daaf622f2975be4f170e1295536ac8fae1e3
129
py
Python
FaceSwap-master/pytorch_stylegan_encoder/encode_image.py
CSID-DGU/-2020-1-OSSP1-ninetynine-2
b1824254882eeea0ee44e4e60896b72c51ef1d2c
[ "MIT" ]
1
2020-06-21T13:45:26.000Z
2020-06-21T13:45:26.000Z
FaceSwap-master/pytorch_stylegan_encoder/encode_image.py
CSID-DGU/-2020-1-OSSP1-ninetynine-2
b1824254882eeea0ee44e4e60896b72c51ef1d2c
[ "MIT" ]
null
null
null
FaceSwap-master/pytorch_stylegan_encoder/encode_image.py
CSID-DGU/-2020-1-OSSP1-ninetynine-2
b1824254882eeea0ee44e4e60896b72c51ef1d2c
[ "MIT" ]
3
2020-09-02T03:18:45.000Z
2021-01-27T08:24:05.000Z
version https://git-lfs.github.com/spec/v1 oid sha256:d97eeb64e51b97d2db9ecdd71998aeaf1948172ddcf1cd7ad51b4f00b7c4ddee size 6138
32.25
75
0.883721
13
129
8.769231
1
0
0
0
0
0
0
0
0
0
0
0.317073
0.046512
129
3
76
43
0.609756
0
0
0
0
0
0
0
0
1
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
1
0
0
0
1
0
0
0
0
0
0
0
0
5
7e632b05dd8bdff6a182ba07c6ce2239b3275200
181
py
Python
myCommServer/admin.py
JadeShekh/satinnovation
c6f8a4197a5c8a9beee3671257eff1e59e6f8449
[ "MIT" ]
null
null
null
myCommServer/admin.py
JadeShekh/satinnovation
c6f8a4197a5c8a9beee3671257eff1e59e6f8449
[ "MIT" ]
null
null
null
myCommServer/admin.py
JadeShekh/satinnovation
c6f8a4197a5c8a9beee3671257eff1e59e6f8449
[ "MIT" ]
8
2017-03-13T10:37:27.000Z
2021-07-22T05:17:08.000Z
from django.contrib import admin from .models import UserMsg, MyCommDevice, MyCommMsg admin.site.register(UserMsg) admin.site.register(MyCommDevice) admin.site.register(MyCommMsg)
25.857143
52
0.834254
23
181
6.565217
0.478261
0.178808
0.337748
0
0
0
0
0
0
0
0
0
0.077348
181
6
53
30.166667
0.904192
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7e83a65c5ff9c7da814d1fc43cd517ce8308a42a
63
py
Python
blive/__init__.py
yulinfeng000/blive
ee135a8648332b772983108b5f299656fa4f15d0
[ "MIT" ]
6
2022-01-07T08:48:13.000Z
2022-03-12T02:32:19.000Z
blive/__init__.py
yulinfeng000/blive
ee135a8648332b772983108b5f299656fa4f15d0
[ "MIT" ]
1
2022-02-18T11:45:24.000Z
2022-03-09T02:00:31.000Z
blive/__init__.py
yulinfeng000/blive
ee135a8648332b772983108b5f299656fa4f15d0
[ "MIT" ]
1
2022-01-11T07:38:45.000Z
2022-01-11T07:38:45.000Z
from .framework import * from .core import * from .msg import *
21
24
0.730159
9
63
5.111111
0.555556
0.434783
0
0
0
0
0
0
0
0
0
0
0.174603
63
3
25
21
0.884615
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7ea0550e9c49bef7a5982fb30054d62b33be64b6
43
py
Python
python/testData/intentions/PyAnnotateVariableTypeIntentionTest/notSuggestedForNonlocalTarget.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/intentions/PyAnnotateVariableTypeIntentionTest/notSuggestedForNonlocalTarget.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/intentions/PyAnnotateVariableTypeIntentionTest/notSuggestedForNonlocalTarget.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
def func(): nonlocal var v<caret>ar
14.333333
16
0.604651
7
43
3.714286
1
0
0
0
0
0
0
0
0
0
0
0
0.27907
43
3
17
14.333333
0.83871
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
true
0
0
0
0.333333
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
0
0
5
7eb0433af58d51af413fc34dea869011b716a3d1
30,175
py
Python
leetcode/hard/815_bus_routes.py
phantomnat/python-learning
addc7ba5fc4fb8920cdd2891d4b2e79efd1a524a
[ "MIT" ]
null
null
null
leetcode/hard/815_bus_routes.py
phantomnat/python-learning
addc7ba5fc4fb8920cdd2891d4b2e79efd1a524a
[ "MIT" ]
null
null
null
leetcode/hard/815_bus_routes.py
phantomnat/python-learning
addc7ba5fc4fb8920cdd2891d4b2e79efd1a524a
[ "MIT" ]
null
null
null
import collections import queue class Solution: def numBusesToDestination(self, routes, S, T): if S == T: return 0 routes = list(map(set, routes)) graph = collections.defaultdict(set) for i, r1 in enumerate(routes): for j in range(i+1, len(routes)): r2 = routes[j] if any(r in r2 for r in r1): graph[i].add(j) graph[j].add(i) seens, targets = set(), set() for node, route in enumerate(routes): if S in route: seens.add(node) if T in route: targets.add(node) print('seens:', seens) print('targets:', targets) # print(dict(graph)) # Queues.queue q = queue.Queue() # queue = [q for node in seens] for node in seens: q.put((node, 1)) while q.qsize() > 0: # print(queue) node, depth = q.get() # queue.remove() # print('node:',node,' depth:',depth) if node in targets: return depth # print('graph[node]:',graph[node]) for nei in graph[node]: # print('nei:',nei) if nei not in seens: seens.add(nei) q.put((nei, depth+1)) # print('queue:',queue) return -1 if __name__ == '__main__': s = Solution() # assert (s.numBusesToDestination([[1, 2, 7, 9], [3, 6, 8, 7]], 1, 6)) == 2 # assert (s.numBusesToDestination([[1, 2, 7], [ 6, 8, 7]], 1, 6)) == 2 # assert (s.numBusesToDestination([[1, 2, 7], [3, 6, 7], [ 9, 6, 10, 12]], 1, 12)) == 3 # assert (s.numBusesToDestination([[1, 2, 7], [3, 6, 7], [2, 9, 6, 10, 12]], 1, 2)) == 1 # assert (s.numBusesToDestination([[1, 2, 7], [3, 6, 7], [2, 9, 6, 10, 12]], 1, 9)) == 2 # assert (s.numBusesToDestination([[1, 2, 7], [3, 6, 7], [ 9, 10, 12]], 1, 12)) == -1 # assert (s.numBusesToDestination( [[24],[3,6,11,14,22],[1,23,24],[0,6,14],[1,3,8,11,20]], 20, 8)) == 1 # assert (s.numBusesToDestination( # [[0,14,22,34,35,56,64,65,82,108,111,116,121,123,131,132,151,152,154,176,180,184,189,198,201,208],[6,23,35,37,38,40,41,49,58,64,74,92,96,101,112,116,123,127,142,148,150,154,155,165,182,193,209],[10,13,21,42,72,73,89,115,121,125,135,136,161,194,205,208],[6,33,34,60,75,79,80,81,87,96,105,110,115,119,122,124,125,133,135,141,142,148,158,186],[3,21,22,30,31,35,56,58,59,74,78,93,97,107,124,127,128,130,141,142,143,146,147,151,166,167,169,175,180,181,185,203],[141,204],[7,19,27,30,31,34,41,48,51,54,55,69,89,91,100,104,110,121,127,134,138,143,150,152,161,170,181,184,185,190,195],[3,8,22,25,38,58,70,74,77,79,80,83,86,88,99,108,109,116,120,132,135,136,137,148,151,153,158,169,171,173,174,175,178,180,202,205,207],[0,10,16,27,41,45,60,62,73,93,102,115,134,140,153,164,168,186,188],[7,12,23,29,32,39,43,59,64,68,70,91,107,120,136,162,165,176,177,183,189,195,203],[11,13,16,28,31,34,39,56,62,89,95,101,102,107,112,115,125,142,145,151,155,170,171,177,197,204,209],[2,5,70,71,83,93,97,100],[9,10,12,20,21,27,34,36,40,55,57,61,67,68,70,73,83,90,92,101,106,108,109,111,116,128,138,141,155,156,168,173,176,186,191,203],[8,10,11,15,18,24,43,46,97,99,137,138,166,192,194,207],[4,5,6,29,42,50,64,78,81,84,107,110,116,137,143,144,146,150,157,178,182,207],[3,7,17,34,36,41,51,53,54,55,63,68,71,82,86,91,96,97,108,117,128,136,137,138,142,145,148,156,164,173,182,188,200,207],[4,13,19,23,33,50,60,69,76,77,78,80,94,97,107,109,116,123,126,128,129,133,137,139,140,143,147,152,158,159,163,164,166,184,187,189,200,206],[7,35,38,42,94,104,116,120,123,134,154],[2,17,21,25,30,38,43,46,48,55,64,84,85,99,102,112,117,126,145,154,161,165,174,176,186],[4,43,46,48,58,67,68,91,126,130,140,150,153,162,170,174],[8,24,65,67,106,118,145,148,202],[6,12,20,23,36,37,39,48,59,66,69,71,80,86,90,102,105,118,126,128,134,140,141,156,160,163,164,188,191,199,205,207],[2,48,115,170],[2,27,49,59,64,67,68,75,77,90,133,174,178,184,188,205],[0,4,68,140,158,183,196,204],[11,20,35,48,60,61,63,73,98,116,120,125,131,132,149,151,171,179,180,182,185,188,204,208],[42,112],[7,11,24,29,41,42,54,57,64,72,78,87,95,103,106,107,108,111,117,122,123,152,164,186,190,195,199,202,208],[2,3,10,11,19,21,24,43,48,49,61,67,68,73,75,80,101,122,123,134,137,141,162,172,182,186,190,202,208],[9,13,31,35,42,66,68,83,88,90,95,97,102,111,134,136,138,142,153,174,200],[4,19,51,52,56,60,65,67,68,82,83,85,93,110,113,125,134,139,152,159,162,194],[19,20,25,28,29,30,40,65,120,125,126,153,155,170,172,184],[12,28,35,36,37,48,53,77,84,85,89,106,117,119,134,138,149,150,161,180,182,189,206],[90],[5,35,38,44,45,46,48,51,52,54,58,62,71,74,77,78,80,90,99,118,126,136,150,152,157,171,185,187,189,209],[9,18,22,25,48,55,56,59,64,66,68,75,77,78,79,98,103,109,110,122,151,154,164,171,175,187,193,205,207],[11,12,19,32,41,50,54,56,57,62,69,70,71,73,79,83,84,94,95,110,130,157,172,173,179,205,208],[0,5,10,15,30,32,36,45,72,93,105,111,114,116,120,127,138,139,154,190,193],[3,5,6,21,33,34,35,41,50,57,60,65,82,90,92,102,111,114,120,131,156,186,195],[116,168,203],[1,4,10,14,18,23,43,51,52,65,71,86,88,92,100,104,108,112,120,131,133,148,152,154,165,169,174,186,189,190,191,198,200,208],[6,16,21,28,31,35,37,38,58,64,71,72,76,94,95,99,100,116,122,126,133,134,136,138,140,144,147,161,163,180,185]], # 77, # 31 # )) == 2 # assert (s.numBusesToDestination( # [[98,173],[87,139,178,184],[0,1,2,5,8,17,28,40,42,47,59,71,82,85,105,114,117,118,119,126,130,135,138,142,143,150,152,166,169,176,178,196,201,210,238,239],[0,3,5,12,37,38,39,41,45,50,58,64,65,69,76,89,95,110,118,120,126,128,133,135,143,171,176,179,183,197,200,215,216,217,218,219,227,229,232],[8,23,35,45,52,54,55,66,73,84,95,107,154,156,175,206,207,229,233,236],[4,5,16,24,27,30,50,54,56,67,72,75,77,79,80,89,96,124,137,139,147,157,163,165,167,193,195,198,210,216,221,222,223,227],[2,22,24,29,31,52,107,116,120,136,141,142,159,167,176,187,235],[80,175],[13,23,96,115,122,150,167,170,172,185,187,212,233],[14,21,23,24,25,39,42,46,57,66,77,100,115,116,118,122,126,127,144,145,148,152,155,160,164,165,195,202,209,210,213,220,223,229,231,237],[5,23,30,37,51,56,57,59,72,74,87,105,141,163,166,169,175,183,184,198,210,220,221],[10,35,58,69,109,151,154,187,207,210,222,239],[3,5,20,22,30,34,35,36,42,50,52,61,65,66,67,69,80,86,87,89,93,95,124,127,128,132,136,166,174,183,186,191,195,197,201,207,208,220,221],[25,69,92,102,107,110,118,132,136,160,161,189,202,209,239],[24,37,38,41,42,47,52,57,58,71,82,90,103,107,123,142,143,150,174,177,187,189,196,233],[62,113,115,179,207],[14,60,80,83,93,103,123,133,135,151,163,173,180,235],[2,3,9,23,26,29,32,36,37,46,49,59,74,79,86,94,114,115,132,141,142,161,163,167,171,174,179,180,192,199,201,205,210,218,230,232,236],[10,44,74,120,123,142,183,188],[23,28,33,42,48,61,64,73,74,89,99,105,134,141,143,152,162,164,172,186,205,221,222],[3,8,23,42,50,56,58,66,81,86,103,110,125,133,143,155,156,159,167,171,172,188,189,190,199,221,230],[1,19,24,28,29,32,33,35,45,51,55,61,77,78,79,87,90,96,111,115,119,121,130,133,138,141,164,169,172,178,184,192,198,216,222,234],[192],[38,137],[25,43,50,52,64,74,96,104,109,136,149,194,195,200,237,238],[2,9,12,16,18,40,41,44,86,100,115,122,126,132,139,142,149,161,164,165,169,170,175,195,198,202,214,217,228,230,237],[14,27,34,36,40,66,78,80,88,131,132,135,148,169,177,183,207,223],[4,29,31,38,74,88,107,112,123,142,171,176,205,215,227],[11,32,39,53,59,66,74,80,101,109,113,114,142,151,154,158,172,193,198,221,238,239],[2],[55,74,118,128,170],[10,20,27,35,41,64,72,73,76,97,119,126,140,142,167,187,213],[51,79,109,158,200,215],[6,21,31,33,47,87,89,109,119,126,153,173,179,183,202,211,223,230,237],[3,6,12,14,24,26,46,47,49,78,91,101,114,120,124,125,131,132,150,161,182,189,213,218,224,230,234],[13,18,21,29,34,38,39,48,54,55,58,63,85,90,93,112,162,174,194,198,203,206,210,232],[30,40,52,62,63,68,69,72,77,80,83,85,91,97,104,114,115,123,133,137,147,161,174,177,179,187,190,195,198,215,226,228,232,233],[2,14,15,31,34,35,36,42,46,54,63,66,73,78,107,108,123,126,137,139,140,143,154,164,165,177,179,186,197,200,202,227,230,239],[1,37,82,94,119,125,127,128,146,148,184,188,206,209,212,218,232,236],[8,10,21,26,31,35,36,38,39,41,44,50,55,70,77,84,86,103,117,124,130,133,134,171,172,184,193,194,213,229,230],[0,71,73,89,91,119,130,146,148,152,192,196],[32,33,55,103,141],[11,16,23,52,74,86,100,105,108,120,129,133,170,181,183,187,207,210,227,231],[18,19,38,46,49,51,52,53,70,90,99,117,173,191,201,209,219,223],[2,5,9,12,15,16,17,23,24,33,47,68,70,101,109,119,122,133,134,153,167,171,173,176,179,188,197,204,207,210,216,225,230,237,238],[1,8,10,11,13,22,25,26,27,31,36,37,53,55,57,58,61,75,89,90,100,106,125,158,169,170,172,177,186,199,215,222,226,230,235,237,239],[6,7,8,20,24,30,40,42,51,74,79,81,91,136,167,169,176,179,181,182,197,203,210,215,238,239],[8,12,14,33,37,38,39,44,65,107,116,124,128,132,134,169,178,179,186,193,200,211,213,217,222,224,225]], # 94, # 222 # )) == 2 # assert (s.numBusesToDestination( # [[10,13,22,28,32,35,43],[2,11,15,25,27],[6,13,18,25,42],[5,6,20,27,37,47],[7,11,19,23,35],[7,11,17,25,31,43,46,48],[1,4,10,16,25,26,46],[7,11],[3,9,19,20,21,24,32,45,46,49],[11,41]], # 37, # 43 # )) == 3 # assert (s.numBusesToDestination( # [[16,18,24,75,82,83,93,95,98,103,106,168,171,211,218,221,265,283,285,307,313,319,336,369,377,379,390,392,397,423,452,457],[4,21,25,28,29,46,48,53,54,71,81,86,116,117,122,124,130,133,147,148,151,155,158,171,198,208,209,218,248,252,261,267,271,273,274,275,288,289,291,299,300,301,303,330,334,352,362,364,365,373,381,386,393,421,424,428,431,433,437,458,466,473],[22,32,44,72,90,100,129,132,153,158,161,173,175,187,196,209,213,220,221,236,239,242,268,281,283,289,304,326,330,334,352,365,376,389,414,428,429,443,461],[4,8,9,10,12,19,36,44,45,48,53,59,63,68,76,78,79,82,85,100,102,105,113,121,131,157,163,164,165,175,179,180,192,196,200,210,221,222,225,232,237,245,265,272,275,279,283,300,302,327,331,332,335,348,353,356,363,378,385,387,403,422,428,429,451,452],[6,13,14,36,37,41,42,55,62,78,82,83,96,107,114,116,118,129,138,143,158,164,168,201,202,204,222,223,227,229,232,234,244,265,268,274,289,295,313,317,322,330,341,347,348,361,363,369,379,391,414,433,447,456,464,465],[14,22,36,39,42,57,62,65,70,86,90,97,112,123,133,145,151,158,168,185,187,192,194,203,223,225,234,238,245,252,255,267,271,274,285,297,300,303,318,322,343,344,363,364,372,381,399,419,420,425,426,427,433,439,440,450,452,470,471],[56,74,100,167,179,194,214,250,288,332,393,410,439],[1,5,6,8,10,18,24,27,29,30,36,42,44,52,64,66,70,83,96,97,98,100,103,107,113,125,129,140,141,159,160,163,164,166,172,174,181,186,194,202,208,218,232,239,242,248,258,277,279,284,286,291,295,302,304,305,308,313,316,319,320,341,342,352,356,360,370,386,392,399,400,402,408,410,412,416,427,434,435,439,444,457,463,471,472],[0,1,10,12,26,27,29,30,48,51,60,72,83,84,89,91,100,103,125,127,131,136,147,156,167,170,173,178,181,182,186,188,195,197,201,204,211,215,216,221,235,238,266,269,277,282,287,296,317,335,340,343,347,351,355,357,358,366,368,382,384,390,395,397,404,418,421,424,427,429,430,438,458,462,466],[87,207,419],[9,22,89,90,129,131,136,142,148,154,176,182,204,207,217,228,246,248,275,306,328,340,341,364,366,371,407,418,420,437,439,442,458,473],[2,25,34,67,80,81,106,110,125,146,160,172,176,178,196,205,208,217,226,239,244,253,269,280,300,308,322,324,328,335,340,342,343,352,365,368,385,387,391,404,410,413,416,420,423,433,435,436,439,440,450,468],[10,59,68,75,79,90,91,98,105,121,134,143,145,156,162,174,209,214,216,235,249,255,256,258,260,274,279,291,308,312,315,319,341,346,350,353,356,382,386,399,408,414,435,449,471],[1,5,6,9,14,35,39,41,53,70,75,77,91,98,101,108,114,120,123,134,150,156,160,171,180,181,186,187,201,206,215,220,223,236,248,249,251,255,257,263,269,270,278,282,305,312,313,314,320,327,331,338,345,349,359,360,380,381,384,389,400,414,415,419,420,427,429,432,437,440,441,442,455],[2,12,14,15,51,62,64,69,74,90,97,98,99,100,110,112,114,118,133,136,138,139,154,163,170,172,173,180,194,199,207,210,211,226,233,234,235,260,273,274,282,300,302,314,318,327,334,335,344,351,352,354,367,369,377,385,388,407,419,420,433,434,441,444,445,450,454,458,470],[2,30,32,41,64,71,76,77,79,84,104,109,128,132,137,143,147,152,160,182,191,196,197,204,218,221,262,282,312,323,326,334,349,357,361,371,385,387,398,415,460,461,471],[2,6,28,45,56,68,70,110,113,140,150,159,168,172,174,175,177,179,204,207,230,231,235,247,281,285,289,291,298,315,322,326,339,350,351,352,367,369,376,380,381,382,386,427,429,443,461,465,470],[47,61,62,63,84,105,107,124,151,178,203,234,239,253,267,304,322,349,353,357,363,365,396,412,425,446,451,462],[10,21,65,109,114,168,200,253,292,308,323,327,381,392,393,432],[17,21,27,30,107,140,191,195,261,278,290,332,342,347,353,399,402,433,444],[46,91,95,103,154,181,192,202,221,224,266,290,335,342,346,347,363,381,394,401,417,439,441],[19,30,39,61,118,197,200,224,271,278,360,408],[15,20,30,37,38,60,65,79,81,88,91,92,93,99,100,101,103,115,124,148,160,191,194,228,234,251,252,258,261,272,280,300,301,303,313,316,318,320,329,343,378,379,380,387,406,412,418,423,435,439,443,470,472],[0,5,12,25,71,86,100,102,132,143,167,181,183,187,226,244,304,336,423,461],[6,20,26,45,48,53,67,73,81,87,89,92,94,96,99,107,122,128,129,137,138,149,159,168,182,202,211,219,225,229,231,234,240,244,247,251,254,261,284,292,297,300,302,305,315,328,337,338,348,354,366,381,382,383,384,395,398,399,409,415,418,420,422,424,426,428,450,452,457,460,461],[4,6,22,39,44,48,49,52,61,64,68,71,76,78,93,101,102,111,114,126,127,138,141,148,159,167,172,176,187,195,201,205,207,232,242,252,256,277,289,295,297,299,301,305,310,320,332,335,339,343,346,350,353,355,364,366,375,380,388,419,420,423,444,446,448,450,453,464,471],[67,68,73,83,152,202,218,222,264,289,301,302,368,371,412,416,435],[8,10,19,32,38,54,64,75,84,114,124,130,139,149,158,160,172,181,185,194,195,200,208,231,240,277,283,292,308,328,335,338,353,355,366,371,390,406,412,418,445,462,469,470,474],[9,22,30,65,81,88,138,142,151,153,155,156,160,162,166,174,181,188,192,198,203,219,238,240,243,252,257,258,265,301,325,330,340,362,370,392,396,399,404,417,447,454,463,467,472,473],[7,15,35,152,165,229,296,330,331,342,348,359,459],[9,12,21,28,35,45,50,57,61,76,83,97,107,111,120,130,165,171,177,180,187,195,199,204,216,217,227,244,262,278,283,285,290,304,305,310,316,329,331,343,354,360,378,387,413,422,427,433,438,449,452,456,465,468,469],[37,109,112,173,174,219,248,249,263,347,396,401,417],[9,13,24,25,34,38,44,47,54,64,70,86,102,103,106,111,112,118,129,136,145,152,159,162,196,207,209,215,224,225,248,257,259,275,315,327,345,355,378,382,394,398,423,429,433,438,445,449,450,462,472],[3,20,28,30,36,47,63,70,78,90,93,101,102,108,111,126,140,150,153,160,162,163,167,170,182,190,195,203,204,210,216,219,229,232,239,247,251,252,253,269,283,291,292,294,295,309,334,343,350,356,364,365,368,372,373,382,393,406,413,418,439,443,446,454,461,463,469,474],[0,1,10,11,18,20,21,22,23,24,33,36,43,54,60,62,65,71,72,76,77,78,80,98,103,106,118,120,124,131,138,140,143,151,155,160,161,164,165,170,171,174,175,186,191,199,207,228,231,239,243,246,248,254,265,267,278,281,286,290,291,298,299,309,312,316,327,348,358,366,371,380,381,396,412,417,422,423,424,430,436,439,442,468],[8,17,19,38,43,54,68,70,79,99,109,112,122,133,153,159,162,179,185,190,199,227,229,239,259,260,267,275,277,278,293,296,324,325,326,332,335,336,342,358,362,385,391,408,419,420,421,422,433,447,451,471],[1,3,6,19,25,27,29,39,45,48,54,59,61,67,68,71,72,73,77,83,105,107,111,113,126,129,131,139,141,154,162,165,167,168,172,173,174,180,182,192,195,200,209,211,213,218,225,228,231,236,242,267,270,272,280,283,284,286,291,297,298,299,302,317,324,333,335,340,347,348,350,354,355,358,366,368,372,373,380,399,419,421,428,435,436,450,455,470],[103,146,194,267,317,351,433,468],[5,11,16,47,49,59,72,79,119,120,127,129,143,158,162,185,204,221,235,248,249,264,270,290,291,295,297,301,313,316,324,334,335,340,377,404,410,412,423,446,456,458,462,464,472],[14,16,53,61,65,86,98,99,100,113,115,185,207,217,246,278,282,336,358,375,429,445],[9,21,33,36,40,49,58,59,66,70,79,81,84,107,112,123,126,133,134,135,141,154,155,169,178,195,210,216,220,231,232,239,255,257,272,279,294,295,300,301,305,308,313,357,372,380,383,386,388,393,414,415,419,420,424,437,443,445,456,466,467],[10,179,182,353],[0,2,6,7,8,13,19,20,28,35,40,42,49,53,59,62,71,75,76,86,95,96,101,115,116,126,129,144,155,157,159,171,191,195,205,215,220,222,224,234,240,241,257,260,264,267,269,280,281,290,307,339,341,346,347,363,377,378,383,389,395,401,405,406,407,416,418,420,426,429,432,434,438,441,459,460,473],[1,10,11,28,30,34,36,41,58,117,149,169,217,218,219,245,270,354,386,440],[3,12,15,19,21,23,30,48,49,63,81,90,110,119,133,141,143,166,168,185,191,200,203,214,222,253,260,266,284,306,311,321,329,340,380,397,399,401,415,425,426,428,437,463],[12,32,34,64,70,80,86,89,91,117,119,125,133,172,187,189,191,197,223,246,259,265,280,282,291,296,346,350,352,368,405,411,430,434,468],[13,57,58,93,100,172,174,182,231,252,269,347,389,417,474],[1,24,28,30,33,52,55,60,61,66,67,71,76,77,79,88,96,101,121,126,129,136,146,152,155,171,175,176,179,190,197,199,200,205,208,221,230,238,245,249,253,257,259,266,269,272,274,276,284,285,294,298,300,319,332,335,345,349,350,353,359,361,362,365,374,377,379,392,413,417,436,441,442,454,457,461,465,471,472],[4,22,30,53,56,57,74,79,80,96,98,100,107,128,133,139,142,151,175,183,190,191,193,206,211,224,230,237,242,245,251,256,261,270,272,275,276,280,286,294,305,317,327,330,334,344,364,385,387,394,398,402,403,404,407,412,413,419,427,428,457,460,461,471],[356,369],[23,46,49,51,53,59,61,74,96,113,114,120,135,138,139,144,159,192,202,204,215,216,236,261,268,281,301,317,324,346,377,380,389,402,414,427,429,459],[20,29,38,39,45,58,77,78,97,102,113,130,139,140,142,154,171,172,188,196,200,211,214,215,224,233,237,246,249,252,256,271,278,280,282,287,296,301,302,304,310,330,340,346,348,360,372,376,377,381,390,396,405,424,427,442,444,451,459,465],[107,154,179,222,252,286,313,316,372,382,383,385],[8,16,27,62,68,69,73,84,103,120,172,177,179,189,207,208,229,240,274,286,291,301,314,321,324,336,387,410],[8,15,17,37,52,55,58,75,95,115,121,145,152,168,170,178,183,189,192,209,212,233,243,250,260,262,273,278,280,283,306,316,327,329,334,348,355,378,405,412,418,427,428],[5,7,9,34,40,61,68,78,81,93,123,127,130,150,153,156,167,214,219,226,227,242,250,276,278,340,355,360,364,377,403,415,439,441,457,463,474],[1,4,14,16,21,43,58,62,81,98,111,124,145,153,178,181,202,206,229,264,266,284,304,310,319,330,412,427,459,464],[13,15,21,27,29,49,64,65,70,77,79,85,92,115,122,128,131,155,160,163,168,179,181,191,204,213,235,244,264,282,284,300,305,309,315,318,319,328,347,356,362,364,369,384,385,399,434,453],[0,5,14,15,21,22,26,30,35,38,40,53,60,62,79,93,100,104,108,116,117,126,127,129,147,151,152,155,159,161,163,172,174,176,190,194,205,216,228,230,236,250,253,256,271,274,278,283,298,316,320,329,335,337,342,346,350,353,356,361,365,368,369,371,379,380,390,392,402,404,409,412,415,422,424,427,428,433,436,449,450,458,461,467,468],[0,34,39,45,46,72,81,93,106,110,113,119,121,124,129,137,139,146,156,184,189,199,207,231,233,235,241,247,252,263,264,265,283,311,314,316,331,350,359,368,378,401,406,409,417,423,437,440,441,445,447,457,462,467],[0,9,20,28,36,37,39,48,54,64,71,73,75,76,84,109,119,121,122,131,139,155,175,186,205,206,211,213,218,220,222,228,239,242,244,254,265,278,285,286,295,301,321,329,335,344,346,349,350,359,370,371,372,384,393,397,398,408,412,433,435,436,442,458,460,464,466,468],[331,388,406],[5,43,68,73,89,110,131,199,214,245,272,279,290,305,331,359,388,392,413,435,470],[1,9,13,18,49,54,55,57,64,72,78,86,87,88,93,118,133,135,137,138,139,141,147,149,156,157,162,165,171,175,180,189,205,218,219,239,242,244,249,253,270,273,275,277,279,283,291,305,307,309,318,327,329,335,337,342,344,345,353,354,355,362,365,366,369,372,375,376,392,400,406,435,449,456,462,472],[5,6,19,22,39,49,51,53,66,76,79,80,86,98,122,134,138,142,157,165,167,168,179,180,198,204,215,237,243,246,248,254,257,285,288,290,295,318,319,326,338,347,355,361,375,376,380,386,388,390,396,402,403,404,427,437,441,459,472],[3,9,18,30,37,42,45,60,67,71,88,92,98,105,127,133,134,136,140,142,143,149,150,154,160,173,174,175,177,188,193,208,214,220,223,227,239,240,245,250,257,258,263,292,295,310,319,322,325,338,345,353,354,355,358,360,368,376,396,397,398,401,421,423,436,441,452,453,467,469,471],[3,58],[9,35,37,70,73,79,81,87,94,98,105,106,115,117,121,145,168,183,192,222,229,230,232,236,242,252,255,267,279,281,284,290,296,318,324,338,340,346,350,354,360,374,415,416,426,433,440,441,445,447,463,464],[7,11,16,22,25,32,34,38,39,45,57,58,64,66,68,69,73,79,85,88,91,96,101,114,120,125,131,139,142,149,152,165,170,172,174,176,192,194,208,211,218,221,230,236,240,263,271,281,284,288,294,310,318,324,325,329,336,340,341,346,348,351,355,361,369,370,376,385,389,397,401,415,417,418,419,423,429,443,465,466,468,473,474],[1,5,15,25,31,45,47,53,55,56,59,63,68,72,101,138,139,143,145,146,158,159,171,175,176,205,210,219,220,224,234,243,244,246,254,276,280,281,286,287,298,299,304,305,306,307,310,313,316,318,322,325,327,329,332,343,348,354,361,367,369,370,372,374,375,388,390,391,393,394,421,440,442,448,449,450,455,456,463,464,470,473],[32,70,89,91,100,130,147,157,166,182,205,251,269,280,289,301,305,315,333,338,354,366,374,388],[17,28,40,61,63,66,91,112,120,131,153,169,192,215,218,236,242,257,264,293,333,352,366,368,375,376,383,394,395,405,425,463],[27,28,61,73,79,80,89,94,95,99,119,125,128,131,156,165,177,193,197,198,205,209,212,218,219,224,230,231,232,247,253,258,269,271,276,277,281,282,290,291,301,316,319,341,346,347,351,354,361,386,399,402,422,438,454,471],[16,18,19,22,26,32,36,37,56,64,82,86,92,94,95,104,107,120,135,145,151,172,198,201,208,209,223,228,243,245,247,251,252,255,260,265,287,288,289,313,333,360,366,369,373,382,401,447,465],[1,4,7,21,27,28,30,34,41,58,63,65,78,92,93,95,100,104,110,111,115,131,132,136,145,148,158,175,180,186,191,194,195,196,200,204,206,215,227,228,242,243,245,246,251,258,274,279,288,289,292,295,300,304,306,312,323,325,329,335,340,342,345,365,370,387,393,409,414,418,424,434,457,462,466,471,472],[0,5,36,51,54,56,57,58,67,70,76,81,87,98,100,102,103,111,113,139,142,145,147,149,150,153,157,162,172,180,184,186,196,203,204,216,220,224,252,256,274,287,297,309,314,334,335,348,366,374,388,389,391,393,395,404,428,434,446,447,451,455,474],[22,58,81,98,100,107,125,133,199,224,230,232,235,288,290,323,324,340,351,393,397,399,446,451,461,468],[364],[0,1,10,12,16,35,37,45,58,60,61,79,83,90,96,119,127,133,136,139,141,143,144,167,170,177,178,182,192,207,212,216,230,234,256,284,293,298,314,317,321,329,354,357,362,367,369,376,420,434,438,439,441,442,443,452,456],[1,9,11,23,58,62,81,86,100,102,109,116,128,139,141,147,161,171,178,179,180,181,187,189,190,194,200,207,211,217,223,233,245,248,252,258,267,269,270,273,274,290,296,297,299,300,301,312,327,334,335,348,351,354,360,365,370,375,376,382,384,385,400,406,412,420,422,424,435,446,449,469,470,471],[0,10,11,13,15,17,35,38,40,61,63,75,76,78,109,113,115,120,123,129,130,134,144,148,156,158,159,161,176,179,186,199,204,205,209,211,237,244,246,251,256,268,274,290,297,299,300,316,317,327,336,338,348,353,366,369,375,380,383,386,387,394,398,405,411,423,427,430,435,436,440,441,447,455,459,463,467,469,471,472],[14,17,23,24,41,49,54,76,78,89,93,101,104,105,108,118,134,161,163,170,174,180,182,186,193,214,219,238,241,246,247,251,278,304,318,333,342,343,344,345,351,352,357,361,378,388,394,404,406,415,436,438,442,446,463,471],[8,12,17,21,42,48,50,52,74,80,104,117,124,127,138,146,147,153,162,167,176,207,215,219,220,231,235,240,252,268,285,290,291,302,320,321,328,334,353,356,371,372,374,387,402,415,419,448,450,459,466,473],[9,18,30,36,38,43,44,64,73,78,82,86,87,93,94,108,109,118,132,140,141,148,150,152,157,163,168,178,182,196,199,221,223,226,238,241,245,248,250,252,255,258,261,271,280,282,284,291,293,299,303,310,312,314,323,329,340,345,348,351,354,358,361,374,380,391,392,394,397,400,405,411,419,421,444,445,467],[11,20,21,43,44,47,55,59,62,68,69,74,80,81,84,92,93,97,112,115,119,121,123,127,129,130,150,155,157,161,163,164,165,169,179,180,182,189,194,197,205,221,223,236,241,249,257,260,262,265,271,281,286,290,292,296,297,304,305,307,321,323,334,349,357,363,365,368,382,396,401,408,416,439,453,454,455,464],[0,14,20,27,28,51,52,72,87,91,104,105,122,125,135,159,161,178,179,190,196,209,234,266,281,284,298,303,317,376,407,445,471,472],[2,27,81,142,158,178,258,276,332,438,443,472],[0,6,15,17,25,29,35,36,59,63,67,71,73,76,80,81,97,101,105,116,117,121,129,131,145,149,151,154,159,171,175,184,186,192,195,201,202,207,209,211,214,216,229,230,236,243,246,247,250,252,254,258,270,273,277,282,284,287,291,305,323,331,338,348,350,359,385,386,388,393,397,417,437,449,459,460,466,470,471,473],[1,12,14,15,26,35,36,50,63,67,68,70,73,79,99,110,121,122,128,135,136,140,148,149,160,188,196,200,203,204,206,210,213,218,225,227,228,233,243,244,246,254,258,265,267,283,286,290,296,308,311,312,317,326,330,338,343,364,365,369,381,383,399,402,403,420,421,422,427,430,433,437,438,443,445,447,459,460,462,467,469,470],[10,17,28,32,34,44,48,78,79,81,82,85,89,93,101,106,107,124,138,156,157,169,172,177,182,190,191,198,199,208,212,256,282,291,293,313,315,324,340,346,353,361,369,384,386,387,391,426,432,449,452,455,460,471],[15,25,48,66,69,78,83,87,113,116,123,137,143,147,159,199,204,232,235,242,247,251,265,266,294,314,321,324,351,356,362,363,376,390,401,433,434,444,445,448,473],[15,16,26,27,31,42,50,55,63,68,69,75,95,109,111,114,117,121,128,131,132,136,138,140,144,148,159,161,162,163,168,170,186,187,197,200,211,213,214,225,234,243,246,256,262,268,273,285,305,325,333,340,365,385,387,402,411,412,418,421,431,434,437,439,442,445,452,455,461],[6,7,16,22,44,45,47,53,73,77,80,81,111,119,120,122,126,129,133,134,140,143,144,146,147,150,170,172,186,189,197,199,210,224,226,228,240,244,246,249,250,255,272,274,276,280,283,300,303,305,308,311,312,313,324,325,326,330,333,341,347,355,362,369,375,385,391,413,421,423,430,432,438,446,450],[18,26,28,35,41,42,48,75,87,92,106,107,114,125,133,137,140,152,168,170,171,184,192,200,223,241,256,258,275,279,286,287,299,319,326,343,351,361,368,372,382,386,392,406,409,415,432,438,445,449,454,455,464,469],[8,10,20,29,30,36,37,39,42,46,48,66,69,71,72,76,78,83,84,85,95,108,112,117,120,124,132,133,148,152,177,180,185,189,231,232,246,247,260,267,279,284,291,303,314,316,320,331,333,335,341,346,350,369,392,397,401,408,410,413,414,416,422,426,439,444,459,462,463,466,469,470]] # ,100, # 285 # )) == 2 assert (s.numBusesToDestination( [[148,167,216],[6,23,25,40,43,58,63,69,77,86,94,96,106,117,119,127,139,151,153,155,157,186,191,196,200,204,210,216,219],[2,6,7,16,27,30,42,47,49,68,69,77,93,94,96,102,104,111,114,126,131,137,150,161,167,171,174,193,198,199,200,223],[46,131,211],[25,36,51,52,65,78,90,102,103,105,108,114,123,151,152,153,162,174,175],[217],[9,10,15,27,37,38,41,43,46,51,67,74,81,82,83,94,95,107,113,120,122,123,124,132,149,160,162,169,170,171,174,177,185,192,193,195,196,198,213,217,220,221],[74,78,85,95,130,136,145,152,173,175,180,181,184,193,199,202],[13,18,28,38,41,42,47,75,87,91,106,151,158,166,181,182,199,216],[44,63,71,74,144,162,169,220],[2,23,115,185,208],[0,8,13,14,35,46,67,89,91,122,124,126,130,156,177,193,212,214],[2,4,24,37,40,43,55,68,81,92,106,107,109,127,132,138,145,159,163,165,170,172,183,184,209,213,215,220],[5,16,17,34,38,48,55,59,60,65,69,84,86,94,100,103,109,110,112,127,130,131,134,145,148,149,154,161,166,169,182,183,201,203,208,214,223],[0,2,5,6,8,19,49,50,53,79,92,94,97,109,110,112,121,129,132,135,138,139,144,160,166,170,194,197,198,201,212],[27,52,61,112,118,133,142,159,175,186,216],[2,20,34,64,65,77,87,91,95,96,97,125,126,131,144,146,149,152,154,164,165,170,179,205,207],[24,85,123,132,172,173,194,222],[2,4,5,15,23,36,44,47,63,64,78,80,84,97,99,102,104,114,120,130,132,143,161,162,163,167,171,172,176,179,180,194,196,199,202,204,209,214,216,221],[8,22,26,31,38,39,41,59,78,90,102,108,110,138,141,146,176,185,190,198,200,219,220],[5,24,30,46,55,64,67,74,78,136,194,216],[133,142,202],[13,40,49,57,63,75,76,85,91,107,116,121,128,135,137,141,154,193,198,200,204,223],[4,13,14,26,28,33,39,49,58,65,67,74,77,81,90,96,122,124,144,156,158,166,169,170,179,203,204,208,215,223],[6,20,28,36,46,90,107,115,124,131,135,144,147,148,149,161,162,174,176,214,221],[10,20,21,29,35,36,62,65,67,70,72,87,89,92,100,103,107,109,113,126,129,139,140,145,146,147,174,176,180,184,189,190,193,196,198,199,200,209,217],[19,22,27,54,59,63,77,102,122,126,140,143,154,164,165,175,212,216,217,218],[11,13,16,18,27,31,46,49,69,77,88,109,111,119,121,146,161,169,193,194,198,200,204],[1,7,28,58,73,91,98,138,150,173,182,186,213],[3,25,28,33,46,68,70,74,78,97,141,146,149,169,172,178,185,188,202,212,223],[3,4,19,22,24,37,38,43,54,55,56,57,58,62,66,72,75,77,88,106,114,119,127,132,133,137,144,146,150,156,161,164,165,179,181,195,200,213,214,215,222],[9,11,14,15,38,46,55,61,66,68,69,75,76,79,82,91,100,101,102,113,135,141,142,171,175,180,198,208,210,215,218,221],[2,30,33,62,93,104,124,127,128,147,158,160,161,173,181,189,192,199,201,215,223],[4,26,29,38,47,58,61,69,78,93,94,112,114,131,136,144,182,193,198,203,206,209],[5,13,14,16,17,22,30,32,45,47,49,55,63,64,68,77,82,84,86,92,98,100,104,107,117,119,122,127,134,153,164,179,185,197,201,209,212,213,220,223],[2,4,5,6,42,55,75,81,84,93,102,111,112,113,118,129,142,149,159,169,191,193,200,214,223],[10,12,15,19,20,24,33,34,40,47,54,64,93,104,115,121,123,124,155,172,189,190,193,196,202,212,219,222],[104,108,143],[14,15,20,21,31,47,48,59,67,70,74,82,94,102,109,121,125,128,148,162,165,171,180,196,199,202,205,212,214],[2,6,17,18,41,50,60,70,118,151,155,158,166,167,172,180,182,186,188,195],[1,23,25,30,39,41,42,48,58,65,67,94,100,121,126,135,145,152,163,164,171,174,206,210,220,224],[18,25,96,123,172],[5,7,9,12,13,19,22,25,34,51,62,64,74,79,81,85,88,101,102,119,123,140,143,149,155,165,166,167,178,182,189,204,213,222,223],[1,5,18,21,23,50,54,59,62,67,68,72,87,94,95,96,110,116,118,122,133,135,151,155,156,158,171,178,183,184,192,198,208,212,222,224],[18,20,24,34,47,52,56,68,77,82,89,91,97,101,105,106,107,109,118,123,139,141,143,152,153,162,174,180,184,187,188,192,198,202,206,216,224]], 180, 143 )) == 1
359.22619
17,159
0.693024
7,745
30,175
2.699032
0.067657
0.004018
0.016073
0.008324
0.012677
0.010955
0.009472
0.009472
0.009472
0.009472
0
0.680541
0.030257
30,175
84
17,160
359.22619
0.033832
0.834002
0
0
0
0
0.004424
0
0
0
0
0
0.027027
1
0.027027
false
0
0.054054
0
0.162162
0.054054
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
0e8dc64402a6118cb291c1560764b2ab4538ed5d
694
py
Python
tests/test_models/test_buttons.py
ExpressApp/pybotx
97c8b1ce5d45a05567ed01d545cb43174a2dcbb9
[ "MIT" ]
13
2021-01-21T12:43:10.000Z
2022-03-23T11:11:59.000Z
tests/test_models/test_buttons.py
ExpressApp/pybotx
97c8b1ce5d45a05567ed01d545cb43174a2dcbb9
[ "MIT" ]
259
2020-02-26T08:51:03.000Z
2022-03-23T11:08:36.000Z
tests/test_models/test_buttons.py
ExpressApp/pybotx
97c8b1ce5d45a05567ed01d545cb43174a2dcbb9
[ "MIT" ]
5
2019-12-02T16:19:22.000Z
2021-11-22T20:33:34.000Z
import pytest from pydantic import ValidationError from botx.models.buttons import Button, ButtonOptions class CustomButton(Button): """Button without custom behaviour.""" def test_label_will_be_set_to_command_if_none(): assert CustomButton(command="/cmd").label == "/cmd" def test_label_can_be_set_if_passed_explicitly(): assert CustomButton(command="/cmd", label="temp").label == "temp" def test_empty_label(): assert CustomButton(command="/cmd", label="").label == "" def test_create_button_options_with_invalid_hsize(): with pytest.raises(ValidationError) as exc_info: ButtonOptions(h_size=0) assert "should be positive integer" in str(exc_info)
24.785714
69
0.75072
91
694
5.43956
0.538462
0.056566
0.151515
0.169697
0.2
0
0
0
0
0
0
0.001669
0.136888
694
27
70
25.703704
0.824708
0.04611
0
0
0
0
0.07622
0
0
0
0
0
0.285714
1
0.285714
true
0.071429
0.214286
0
0.571429
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
0
1
0
0
5
0e94f52aa74ffa31af581266bcde6be47bc8f08e
457
py
Python
py_client/aidm/aidm_time_window_classes.py
sma-software/openviriato.algorithm-platform.py-client
73d4cf89aa6f4d02ab15b5504d92107848742325
[ "Apache-2.0" ]
2
2021-06-21T06:50:29.000Z
2021-06-30T15:58:02.000Z
py_client/aidm/aidm_time_window_classes.py
sma-software/openviriato.algorithm-platform.py-client
73d4cf89aa6f4d02ab15b5504d92107848742325
[ "Apache-2.0" ]
null
null
null
py_client/aidm/aidm_time_window_classes.py
sma-software/openviriato.algorithm-platform.py-client
73d4cf89aa6f4d02ab15b5504d92107848742325
[ "Apache-2.0" ]
null
null
null
import datetime class TimeWindow: __from_time: datetime.datetime __to_time: datetime.datetime def __init__(self, from_time: datetime.datetime, to_time: datetime.datetime): self.__from_time = from_time self.__to_time = to_time @property def from_time(self) -> datetime.datetime: return self.__from_time @property def to_time(self) -> datetime.datetime: return self.__to_time
24.052632
82
0.669584
55
457
5.054545
0.218182
0.172662
0.28777
0.172662
0.57554
0.57554
0.330935
0.330935
0
0
0
0
0.256018
457
18
83
25.388889
0.817647
0
0
0.153846
0
0
0
0
0
0
0
0
0
1
0.230769
false
0
0.076923
0.153846
0.692308
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
0eb0de9cbe7b073230d696555d472888b3e40a1c
348
py
Python
wabot/models.py
engleandro/Portifolio-WhatsAppAutomation
f01d181697215aee3d105e3ad94e2593b7732e5c
[ "Apache-2.0" ]
null
null
null
wabot/models.py
engleandro/Portifolio-WhatsAppAutomation
f01d181697215aee3d105e3ad94e2593b7732e5c
[ "Apache-2.0" ]
null
null
null
wabot/models.py
engleandro/Portifolio-WhatsAppAutomation
f01d181697215aee3d105e3ad94e2593b7732e5c
[ "Apache-2.0" ]
null
null
null
from django.db import models class MessageWABot(models.Model): customer = models.CharField(max_length=15) from_phone = models.CharField(max_length=15) to_phone = models.CharField(max_length=15) message = models.CharField(max_length=500) request_at = models.DateTimeField() def __str__(self): return self.customer
26.769231
48
0.732759
45
348
5.422222
0.533333
0.245902
0.295082
0.393443
0.360656
0.254098
0
0
0
0
0
0.03125
0.172414
348
12
49
29
0.815972
0
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0.111111
0.111111
1
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
5
7ec603da7e51b19f1f67a90f5e3b8a8507d65b66
671
py
Python
landing/templatetags/hometag.py
okfnepal/election-nepal
20b29330a5fbc14e2512e76ae0c3ef37d665e3d0
[ "MIT" ]
31
2017-04-04T15:12:01.000Z
2020-09-23T23:28:33.000Z
landing/templatetags/hometag.py
okfnepal/election-nepal
20b29330a5fbc14e2512e76ae0c3ef37d665e3d0
[ "MIT" ]
45
2017-04-05T16:06:15.000Z
2019-10-08T19:10:43.000Z
landing/templatetags/hometag.py
okfnepal/election-nepal
20b29330a5fbc14e2512e76ae0c3ef37d665e3d0
[ "MIT" ]
18
2017-04-04T15:12:23.000Z
2019-07-09T00:50:59.000Z
from django import template from landing.models import AboutUs, Data, Visualization register = template.Library() @register.assignment_tag def get_aboutus_tag(): return AboutUs.objects.first() @register.assignment_tag def get_datalist_tag(): return Data.objects.all().order_by('-added') @register.assignment_tag def get_Visualization_tag(): return Visualization.objects.all().order_by('-added') @register.assignment_tag def get_recentVisualization_tag(): limit = 5 return Visualization.objects.order_by('-added')[:limit] @register.assignment_tag def get_recentDataset_tag(): limit = 5 return Data.objects.order_by('-added')[:limit]
20.96875
59
0.76006
85
671
5.776471
0.317647
0.183299
0.213849
0.244399
0.462322
0.199593
0.199593
0.199593
0.199593
0.199593
0
0.003401
0.123696
671
31
60
21.645161
0.831633
0
0
0.35
0
0
0.035768
0
0
0
0
0
0
1
0.25
false
0
0.1
0.15
0.6
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
7ed1112dd92c7ac3a94b34837f1170638c1b14cd
134
py
Python
django/django_admin_register_app/cafe/admin.py
taptorestart/python-backend-examples
0817223f403570f5822511c240726c6108d3b9b7
[ "MIT" ]
7
2022-02-25T03:27:01.000Z
2022-03-22T10:51:13.000Z
django/django_admin_register_app/cafe/admin.py
taptorestart/python-backend-examples
0817223f403570f5822511c240726c6108d3b9b7
[ "MIT" ]
null
null
null
django/django_admin_register_app/cafe/admin.py
taptorestart/python-backend-examples
0817223f403570f5822511c240726c6108d3b9b7
[ "MIT" ]
1
2022-03-24T14:47:49.000Z
2022-03-24T14:47:49.000Z
from django.contrib import admin from .models import Category, Beverage admin.site.register(Category) admin.site.register(Beverage)
19.142857
38
0.820896
18
134
6.111111
0.555556
0.163636
0.309091
0
0
0
0
0
0
0
0
0
0.097015
134
6
39
22.333333
0.909091
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7ed455c08ebf2fa2029dd086b8bafbace11c5c72
23
py
Python
source/online_catalog_scraper/__init__.py
kevinliang43/ProjectDB
6ffd435cb01658e16f0da272bb3f8ec2faeef73c
[ "Apache-2.0" ]
null
null
null
source/online_catalog_scraper/__init__.py
kevinliang43/ProjectDB
6ffd435cb01658e16f0da272bb3f8ec2faeef73c
[ "Apache-2.0" ]
null
null
null
source/online_catalog_scraper/__init__.py
kevinliang43/ProjectDB
6ffd435cb01658e16f0da272bb3f8ec2faeef73c
[ "Apache-2.0" ]
null
null
null
from scrapers import *
11.5
22
0.782609
3
23
6
1
0
0
0
0
0
0
0
0
0
0
0
0.173913
23
1
23
23
0.947368
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7d3904750e900034307b9e21305faa768ed1a144
173
py
Python
web_python/website/templatetags/tempo_atual.py
1997jorge/web-python-django
a5709258e1c1cac408e2aeabe3011dcc5309e787
[ "MIT" ]
null
null
null
web_python/website/templatetags/tempo_atual.py
1997jorge/web-python-django
a5709258e1c1cac408e2aeabe3011dcc5309e787
[ "MIT" ]
null
null
null
web_python/website/templatetags/tempo_atual.py
1997jorge/web-python-django
a5709258e1c1cac408e2aeabe3011dcc5309e787
[ "MIT" ]
null
null
null
from django import template import datetime register = template.Library() @register.simple_tag def tempo_atual(): return datetime.datetime.now().strftime('%H:%M:%S')
17.3
55
0.745665
23
173
5.521739
0.782609
0
0
0
0
0
0
0
0
0
0
0
0.121387
173
9
56
19.222222
0.835526
0
0
0
0
0
0.046243
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
5
7d3e26e31199b66d23d9599df6983d1a56433ae2
167
py
Python
spekulatio/build_file_tree/actions/__init__.py
iwilltry42/spekulatio
42d678b7d7fcc13284902be5a08fb0407d96ec4d
[ "MIT" ]
10
2019-03-19T23:05:04.000Z
2022-01-19T14:08:06.000Z
spekulatio/build_file_tree/actions/__init__.py
iwilltry42/spekulatio
42d678b7d7fcc13284902be5a08fb0407d96ec4d
[ "MIT" ]
6
2019-03-23T08:38:44.000Z
2020-11-24T20:50:14.000Z
spekulatio/build_file_tree/actions/__init__.py
iwilltry42/spekulatio
42d678b7d7fcc13284902be5a08fb0407d96ec4d
[ "MIT" ]
1
2019-09-26T12:21:36.000Z
2019-09-26T12:21:36.000Z
from .ignore import ignore # noqa from .copy import copy # noqa from .compile_scss import compile_scss # noqa from .render_html import render_html_factory # noqa
27.833333
52
0.778443
25
167
5
0.4
0.192
0
0
0
0
0
0
0
0
0
0
0.173653
167
5
53
33.4
0.905797
0.113772
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
adfd4049865aa1696336f3545f50153a62234e0d
219
py
Python
lib/datasets/__init__.py
ybai62868/UAV-LPSODection
fd5f2315df0811f108f8fd24693280807bb8aa94
[ "MIT" ]
6
2019-09-26T12:02:13.000Z
2020-08-12T15:52:00.000Z
lib/datasets/__init__.py
ybai62868/UAV-Detection
fd5f2315df0811f108f8fd24693280807bb8aa94
[ "MIT" ]
1
2019-11-06T10:20:27.000Z
2019-11-06T10:20:27.000Z
lib/datasets/__init__.py
ybai62868/UAV-Detection
fd5f2315df0811f108f8fd24693280807bb8aa94
[ "MIT" ]
null
null
null
from __future__ import absolute_import from __future__ import division from __future__ import print_function from .dac import DACDataset as dac from .voc import MPIIDataset as mpii from .coco import COCODataset as coco
31.285714
38
0.849315
32
219
5.375
0.46875
0.174419
0.27907
0
0
0
0
0
0
0
0
0
0.136986
219
7
39
31.285714
0.910053
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0.166667
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
bc00bd3a407659bbdd4a5252d6fdb5b5c19ca1d5
229
py
Python
src/commands/testgroup.py
xiaoeric/HomegrownRobot
632c5bdff534d09d98361e395892c5c3cabad099
[ "MIT" ]
null
null
null
src/commands/testgroup.py
xiaoeric/HomegrownRobot
632c5bdff534d09d98361e395892c5c3cabad099
[ "MIT" ]
null
null
null
src/commands/testgroup.py
xiaoeric/HomegrownRobot
632c5bdff534d09d98361e395892c5c3cabad099
[ "MIT" ]
null
null
null
from wpilib.command import CommandGroup class TestCommandGroup(CommandGroup): """Run when robot enters testing mode""" def __init__(self): super().__init__('Test Program') # TODO add robot systems test
22.9
44
0.694323
26
229
5.807692
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.213974
229
9
45
25.444444
0.838889
0.275109
0
0
0
0
0.075
0
0
0
0
0.111111
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
1
0
0
5
bc1f6bad55ade03ce0cbd31cd7659d53a6ead5b1
42
py
Python
guillotina/contrib/pubsub/exceptions.py
rboixaderg/guillotina
fcae65c2185222272f3b8fee4bc2754e81e0e983
[ "BSD-2-Clause" ]
173
2017-03-10T18:26:12.000Z
2022-03-03T06:48:56.000Z
guillotina/contrib/pubsub/exceptions.py
rboixaderg/guillotina
fcae65c2185222272f3b8fee4bc2754e81e0e983
[ "BSD-2-Clause" ]
921
2017-03-08T14:04:43.000Z
2022-03-30T10:28:56.000Z
guillotina/contrib/pubsub/exceptions.py
rboixaderg/guillotina
fcae65c2185222272f3b8fee4bc2754e81e0e983
[ "BSD-2-Clause" ]
60
2017-03-16T19:59:44.000Z
2022-03-03T06:48:59.000Z
class NoPubSubDriver(Exception): pass
14
32
0.761905
4
42
8
1
0
0
0
0
0
0
0
0
0
0
0
0.166667
42
2
33
21
0.914286
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
70ab257f9b12d6396972df5c3fe1cbe88970ed8a
101
py
Python
src/export/simple_html/jinja_filters.py
pgecsenyi/jira-report-generator
48d9c7dc8e8bc5e7e9cc69c0c05a644f320c41d2
[ "MIT" ]
null
null
null
src/export/simple_html/jinja_filters.py
pgecsenyi/jira-report-generator
48d9c7dc8e8bc5e7e9cc69c0c05a644f320c41d2
[ "MIT" ]
null
null
null
src/export/simple_html/jinja_filters.py
pgecsenyi/jira-report-generator
48d9c7dc8e8bc5e7e9cc69c0c05a644f320c41d2
[ "MIT" ]
null
null
null
SECS_IN_HOUR = 60 * 60 def secs_to_hours(value): return '{0:.1f}'.format(value / SECS_IN_HOUR)
16.833333
49
0.683168
18
101
3.5
0.666667
0.190476
0.31746
0
0
0
0
0
0
0
0
0.071429
0.168317
101
5
50
20.2
0.678571
0
0
0
0
0
0.069307
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
5
cb11de4c9072bbe73633b36bf0348541dac4e512
20
py
Python
elliot/evaluation/metrics/fairness/reo/__init__.py
gategill/elliot
113763ba6d595976e14ead2e3d460d9705cd882e
[ "Apache-2.0" ]
175
2021-03-04T15:46:25.000Z
2022-03-31T05:56:58.000Z
elliot/evaluation/metrics/fairness/reo/__init__.py
gategill/elliot
113763ba6d595976e14ead2e3d460d9705cd882e
[ "Apache-2.0" ]
15
2021-03-06T17:53:56.000Z
2022-03-24T17:02:07.000Z
elliot/evaluation/metrics/fairness/reo/__init__.py
gategill/elliot
113763ba6d595976e14ead2e3d460d9705cd882e
[ "Apache-2.0" ]
39
2021-03-04T15:46:26.000Z
2022-03-09T15:37:12.000Z
from .reo import REO
20
20
0.8
4
20
4
0.75
0
0
0
0
0
0
0
0
0
0
0
0.15
20
1
20
20
0.941176
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
cb5861d3aadda5d45446336fbb6104cc1b43c5ef
83
py
Python
cpepgen/__init__.py
hjuinj/cpepgen
965f84148f783bd1d19aec4c9b86841a598d4a9b
[ "MIT" ]
null
null
null
cpepgen/__init__.py
hjuinj/cpepgen
965f84148f783bd1d19aec4c9b86841a598d4a9b
[ "MIT" ]
null
null
null
cpepgen/__init__.py
hjuinj/cpepgen
965f84148f783bd1d19aec4c9b86841a598d4a9b
[ "MIT" ]
null
null
null
from . import cyclo_peptide, utils, geometry, genetic_algorithm, chemical_linkages
41.5
82
0.843373
10
83
6.7
1
0
0
0
0
0
0
0
0
0
0
0
0.096386
83
1
83
83
0.893333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
cb74ea5e26551e48ae60d8019b911dcf9863a816
24
py
Python
sanic/__version__.py
ddc67cd/sanic
150d75b7c6aa2346436f0eb895048c53976c98d4
[ "MIT" ]
null
null
null
sanic/__version__.py
ddc67cd/sanic
150d75b7c6aa2346436f0eb895048c53976c98d4
[ "MIT" ]
null
null
null
sanic/__version__.py
ddc67cd/sanic
150d75b7c6aa2346436f0eb895048c53976c98d4
[ "MIT" ]
null
null
null
__version__ = "20.12.0"
12
23
0.666667
4
24
3
1
0
0
0
0
0
0
0
0
0
0
0.238095
0.125
24
1
24
24
0.333333
0
0
0
0
0
0.291667
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
cbcf3ede66ed140776738fffc9172dad4aefce86
3,327
py
Python
haigha/tests/unit/writer_test.py
ask/haigha
1f87bbb37371f5ae6212c5af32ab4e8c5cebe34c
[ "BSD-3-Clause" ]
1
2022-02-18T05:41:30.000Z
2022-02-18T05:41:30.000Z
haigha/tests/unit/writer_test.py
ask/haigha
1f87bbb37371f5ae6212c5af32ab4e8c5cebe34c
[ "BSD-3-Clause" ]
null
null
null
haigha/tests/unit/writer_test.py
ask/haigha
1f87bbb37371f5ae6212c5af32ab4e8c5cebe34c
[ "BSD-3-Clause" ]
null
null
null
from chai import Chai from datetime import datetime from cStringIO import StringIO from haigha.writer import Writer class WriterTest(Chai): # Tests commented out because they don't really apply, but there's a lot that # can be copied ''' def test_write_methods(self): writer = Writer() writer.write( 'foo' ) writer.write_bit( 1 ) writer.write_octet( 5 ) writer.write_short( 42 ) writer.write_long( 12345 ) writer.write_longlong( 123456789 ) writer.write_shortstr( "bar" ) writer.write_longstr( "hellowurld" ) writer.write_table( {'cats':'dogs'} ) writer.write_timestamp( 'now' ) self.assertEquals( 10, len(writer._output_buffer) ) self.assertEquals( (writer._write_str, 'foo'), writer._output_buffer[0] ) self.assertEquals( (writer._write_bit, 1), writer._output_buffer[1] ) self.assertEquals( (writer._write_octet, 5), writer._output_buffer[2] ) self.assertEquals( (writer._write_short, 42), writer._output_buffer[3] ) self.assertEquals( (writer._write_long, 12345), writer._output_buffer[4] ) self.assertEquals( (writer._write_longlong, 123456789), writer._output_buffer[5] ) self.assertEquals( (writer._write_shortstr, 'bar'), writer._output_buffer[6] ) self.assertEquals( (writer._write_longstr, 'hellowurld'), writer._output_buffer[7] ) self.assertEquals( (writer._write_table, {'cats':'dogs'}), writer._output_buffer[8] ) self.assertEquals( (writer._write_timestamp, 'now'), writer._output_buffer[9] ) def test_writing_bits(self): writer = Writer(); stream = StringIO() writer.write_bit(True) writer.flush( stream ) self.assertEquals( '\x01', stream.getvalue() ) writer = Writer(); stream = StringIO() [ writer.write_bit(True) for x in xrange(4) ] writer.flush( stream ) self.assertEquals( '\x0f', stream.getvalue() ) writer = Writer(); stream = StringIO() [ writer.write_bit(True) for x in xrange(5) ] writer.flush( stream ) self.assertEquals( '\x1f', stream.getvalue() ) writer = Writer(); stream = StringIO() [ writer.write_bit(True) for x in xrange(8) ] writer.flush( stream ) self.assertEquals( '\xff', stream.getvalue() ) writer = Writer(); stream = StringIO() writer.write_bit(True) writer.write_bit(False) writer.write_bit(True) writer.write_bit(False) writer.flush( stream ) self.assertEquals( '\x05', stream.getvalue() ) writer = Writer(); stream = StringIO() writer.write_bit(True) writer.write_bit(False) writer.write_bit(True) writer.write_bit(False) writer.write_bit(True) writer.flush( stream ) self.assertEquals( '\x15', stream.getvalue() ) writer = Writer(); stream = StringIO() writer.write_shortstr('foo') [ writer.write_bit(True) for x in xrange(4) ] writer.write_shortstr('bar') writer.flush( stream ) self.assertEquals( '\x03foo\x0f\x03bar', stream.getvalue() ) writer = Writer(); stream = StringIO() writer.write_shortstr('foo') writer.write_bit(True) writer.write_bit(False) writer.write_bit(True) writer.write_bit(False) writer.write_bit(True) writer.write_shortstr('bar') writer.flush( stream ) self.assertEquals( '\x03foo\x15\x03bar', stream.getvalue() ) '''
35.393617
89
0.677487
410
3,327
5.307317
0.209756
0.217371
0.13511
0.107537
0.673713
0.463235
0.435662
0.435662
0.435662
0.387868
0
0.02618
0.184851
3,327
93
90
35.774194
0.77618
0.892696
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.8
0
1
0
0
0
0
null
1
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
1
0
1
0
0
5
cbe6b4ea065b4dac055cfee219847d46c3defaa3
472
py
Python
habitican_curse/__init__.py
1ncend1ary/Habitican-Curse
f51c8f3646ad4830bf94bcbd9184128ecffd55d5
[ "MIT" ]
null
null
null
habitican_curse/__init__.py
1ncend1ary/Habitican-Curse
f51c8f3646ad4830bf94bcbd9184128ecffd55d5
[ "MIT" ]
null
null
null
habitican_curse/__init__.py
1ncend1ary/Habitican-Curse
f51c8f3646ad4830bf94bcbd9184128ecffd55d5
[ "MIT" ]
null
null
null
# Standard Library Imports import curses import tempfile import time import locale import threading # Custom Module Imports import habitican_curse.config as C from habitican_curse.screen import Screen import habitican_curse.global_objects as G import habitican_curse.helper as H import habitican_curse.menu as M import habitican_curse.request_manager as RM import habitican_curse.interface as I import habitican_curse.content as CT import habitican_curse.debug as DEBUG
24.842105
44
0.858051
72
472
5.472222
0.458333
0.319797
0.406091
0
0
0
0
0
0
0
0
0
0.118644
472
18
45
26.222222
0.947115
0.097458
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
1dca7fde809db36dd5a4ea53b85425259f779d2b
87
py
Python
ast_version/src/intval.py
lucassa3/CCompiler
ad788f692dc2863da9111b4a42f54277ac29d5ae
[ "MIT" ]
1
2020-04-29T21:30:11.000Z
2020-04-29T21:30:11.000Z
ast_version/src/intval.py
lucassa3/CCompiler
ad788f692dc2863da9111b4a42f54277ac29d5ae
[ "MIT" ]
10
2018-08-20T18:10:56.000Z
2019-04-05T14:45:11.000Z
ast_version/src/intval.py
lucassa3/CCompiler
ad788f692dc2863da9111b4a42f54277ac29d5ae
[ "MIT" ]
null
null
null
from node import Node class IntVal(Node): def eval(self, st): return self.value
17.4
22
0.701149
14
87
4.357143
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.206897
87
5
23
17.4
0.884058
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
38174fb0aea8c08124e96d888b9526c53ae3c11c
179
py
Python
repo/sqlalchemy/repo.py
kianooshsanatkar/PyRepo
5b0ec3d6efdfab239cf04d72d78f891a21d2875a
[ "MIT" ]
null
null
null
repo/sqlalchemy/repo.py
kianooshsanatkar/PyRepo
5b0ec3d6efdfab239cf04d72d78f891a21d2875a
[ "MIT" ]
null
null
null
repo/sqlalchemy/repo.py
kianooshsanatkar/PyRepo
5b0ec3d6efdfab239cf04d72d78f891a21d2875a
[ "MIT" ]
null
null
null
from ..core.baserpo import BaseRepository class SqlAlchemyRepository(BaseRepository): def get(self, model: type, query): return self.__ctx__.query(model).get(query)
25.571429
51
0.743017
21
179
6.142857
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.150838
179
7
51
25.571429
0.848684
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
697fac30073930777c35c24844fee181f34d9622
176
py
Python
py_tdlib/constructors/passport_elements_with_errors.py
Mr-TelegramBot/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
24
2018-10-05T13:04:30.000Z
2020-05-12T08:45:34.000Z
py_tdlib/constructors/passport_elements_with_errors.py
MrMahdi313/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
3
2019-06-26T07:20:20.000Z
2021-05-24T13:06:56.000Z
py_tdlib/constructors/passport_elements_with_errors.py
MrMahdi313/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
5
2018-10-05T14:29:28.000Z
2020-08-11T15:04:10.000Z
from ..factory import Type class passportElementsWithErrors(Type): elements = None # type: "vector<PassportElement>" errors = None # type: "vector<passportElementError>"
25.142857
54
0.755682
17
176
7.823529
0.705882
0.120301
0.210526
0
0
0
0
0
0
0
0
0
0.136364
176
6
55
29.333333
0.875
0.386364
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.25
0.25
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
5
69971bf8f3181c74c781b011c230dda3322a9438
196
py
Python
utils/cheat.py
Its-Vichy/Cs-Fuck
3e13cbf33ca62178e61d7df3e23e803835626d92
[ "Apache-2.0" ]
15
2021-11-05T14:25:08.000Z
2022-03-22T07:37:26.000Z
utils/cheat.py
Its-Vichy/Cs-Fuck
3e13cbf33ca62178e61d7df3e23e803835626d92
[ "Apache-2.0" ]
1
2021-12-21T15:28:32.000Z
2021-12-21T15:28:32.000Z
utils/cheat.py
Its-Vichy/Cs-Fuck
3e13cbf33ca62178e61d7df3e23e803835626d92
[ "Apache-2.0" ]
4
2021-11-05T17:37:39.000Z
2022-03-18T17:55:09.000Z
class Cheat: def __init__(self, name: str): self.name = name self.is_running = False def set_is_running(self, is_running: bool): self.is_running = is_running
28
48
0.622449
27
196
4.148148
0.444444
0.401786
0.348214
0
0
0
0
0
0
0
0
0
0.290816
196
7
49
28
0.805755
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.5
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
69bbddc3da1c934d115679377ca5b2d562ddc9ba
69
py
Python
sccsServerLocalNetworkPythonGear-sendingOnlyWIP/sccsPYTest.py
ninekorn/Python-2-way-local-network-communication-WIP
ce0338574f27e9799f83178320ce651ed27ccf5e
[ "MIT" ]
null
null
null
sccsServerLocalNetworkPythonGear-sendingOnlyWIP/sccsPYTest.py
ninekorn/Python-2-way-local-network-communication-WIP
ce0338574f27e9799f83178320ce651ed27ccf5e
[ "MIT" ]
null
null
null
sccsServerLocalNetworkPythonGear-sendingOnlyWIP/sccsPYTest.py
ninekorn/Python-2-way-local-network-communication-WIP
ce0338574f27e9799f83178320ce651ed27ccf5e
[ "MIT" ]
null
null
null
import math import time import socket while True: print('test')
9.857143
17
0.724638
10
69
5
0.8
0
0
0
0
0
0
0
0
0
0
0
0.202899
69
7
17
9.857143
0.909091
0
0
0
0
0
0.057143
0
0
0
0
0
0
1
0
true
0
0.6
0
0.6
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
69ce7c0a52477f88a4506877bb180bf318034a14
50
py
Python
antelope_core/providers/traci/__init__.py
AntelopeLCA/core
ee40685add52ba41a462e2147fe8c377c6ba2a80
[ "BSD-3-Clause" ]
1
2021-10-06T18:42:49.000Z
2021-10-06T18:42:49.000Z
antelope_core/providers/traci/__init__.py
AntelopeLCA/core
ee40685add52ba41a462e2147fe8c377c6ba2a80
[ "BSD-3-Clause" ]
6
2021-01-09T08:56:46.000Z
2022-03-29T08:26:21.000Z
antelope_core/providers/traci/__init__.py
AntelopeLCA/core
ee40685add52ba41a462e2147fe8c377c6ba2a80
[ "BSD-3-Clause" ]
null
null
null
from .traci_2_1_spreadsheet import Traci21Factors
25
49
0.9
7
50
6
1
0
0
0
0
0
0
0
0
0
0
0.086957
0.08
50
1
50
50
0.826087
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
0e101567dc00f179d44577e30cffde57d1bb748b
87
py
Python
vk/exceptions/errors.py
fossabot/vk.py
94d5c719eb8da6d778d2be208038c447971d5cff
[ "MIT" ]
null
null
null
vk/exceptions/errors.py
fossabot/vk.py
94d5c719eb8da6d778d2be208038c447971d5cff
[ "MIT" ]
null
null
null
vk/exceptions/errors.py
fossabot/vk.py
94d5c719eb8da6d778d2be208038c447971d5cff
[ "MIT" ]
null
null
null
class APIException(Exception): pass class KeyboardException(Exception): pass
12.428571
35
0.747126
8
87
8.125
0.625
0.4
0
0
0
0
0
0
0
0
0
0
0.183908
87
6
36
14.5
0.915493
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
3878672e1e44fc04d3fb7fe3be181f6f35bf9b93
149
py
Python
.config/qtile/settings/path.py
QWinOS/Qtile-Dracula
cf6db72278fe8aebcfd663534ba5c99320dc97da
[ "MIT" ]
null
null
null
.config/qtile/settings/path.py
QWinOS/Qtile-Dracula
cf6db72278fe8aebcfd663534ba5c99320dc97da
[ "MIT" ]
null
null
null
.config/qtile/settings/path.py
QWinOS/Qtile-Dracula
cf6db72278fe8aebcfd663534ba5c99320dc97da
[ "MIT" ]
null
null
null
from os import path qtile_path = path.join(path.expanduser("~"), ".config", "qtile") rofi_path = path.join(path.expanduser("~"), ".config", "rofi")
29.8
64
0.671141
20
149
4.9
0.45
0.163265
0.244898
0.326531
0.653061
0.653061
0
0
0
0
0
0
0.100671
149
4
65
37.25
0.731343
0
0
0
0
0
0.167785
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
389246086698bcce85818760c9d00f1d29183bd8
278
py
Python
dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/message/ServerMsg.py
mjames-upc/python-awips
e2b05f5587b02761df3b6dd5c6ee1f196bd5f11c
[ "BSD-3-Clause" ]
null
null
null
dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/message/ServerMsg.py
mjames-upc/python-awips
e2b05f5587b02761df3b6dd5c6ee1f196bd5f11c
[ "BSD-3-Clause" ]
null
null
null
dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/message/ServerMsg.py
mjames-upc/python-awips
e2b05f5587b02761df3b6dd5c6ee1f196bd5f11c
[ "BSD-3-Clause" ]
null
null
null
## ## # File auto-generated against equivalent DynamicSerialize Java class class ServerMsg(object): def __init__(self): self.message = None def getMessage(self): return self.message def setMessage(self, message): self.message = message
16.352941
68
0.665468
30
278
6.033333
0.6
0.243094
0
0
0
0
0
0
0
0
0
0
0.248201
278
16
69
17.375
0.866029
0.23741
0
0
1
0
0
0
0
0
0
0
0
1
0.428571
false
0
0
0.142857
0.714286
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
38947fa2a62a41a91c169926864d8178dab8281e
156
py
Python
cluster/__init__.py
JoviaNierenberg/project5
7e12dfa0ae02065c55ef2d8422455c936fb50684
[ "MIT" ]
null
null
null
cluster/__init__.py
JoviaNierenberg/project5
7e12dfa0ae02065c55ef2d8422455c936fb50684
[ "MIT" ]
null
null
null
cluster/__init__.py
JoviaNierenberg/project5
7e12dfa0ae02065c55ef2d8422455c936fb50684
[ "MIT" ]
20
2022-01-31T20:09:57.000Z
2022-02-15T03:17:27.000Z
from .kmeans import KMeans from .silhouette import Silhouette from .utils import ( make_clusters, plot_clusters, plot_multipanel)
19.5
34
0.692308
17
156
6.176471
0.529412
0.228571
0
0
0
0
0
0
0
0
0
0
0.262821
156
7
35
22.285714
0.913043
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
38c767d37eea0f824938b4cfd691045c7fd5b93d
259
py
Python
todo/renderers/render_output.py
tomasdanjonsson/td-cli
08abf22e991ef3b62c170af67fd77581fa1c1b21
[ "MIT" ]
154
2018-09-28T11:05:39.000Z
2022-03-05T08:22:09.000Z
todo/renderers/render_output.py
tomasdanjonsson/td-cli
08abf22e991ef3b62c170af67fd77581fa1c1b21
[ "MIT" ]
18
2019-01-14T08:47:30.000Z
2021-12-10T21:02:58.000Z
todo/renderers/render_output.py
tomasdanjonsson/td-cli
08abf22e991ef3b62c170af67fd77581fa1c1b21
[ "MIT" ]
11
2018-10-15T12:54:06.000Z
2022-02-07T13:34:37.000Z
from .base import Render class RenderOutput(Render): def __init__(self, string_to_format): self.string_to_format = string_to_format def render(self, **kwargs): print(self._format(f"{self.string_to_format}%s" % "{reset}", **kwargs))
25.9
79
0.687259
35
259
4.714286
0.485714
0.193939
0.339394
0.327273
0
0
0
0
0
0
0
0
0.177606
259
9
80
28.777778
0.774648
0
0
0
0
0
0.123552
0.096525
0
0
0
0
0
1
0.333333
false
0
0.166667
0
0.666667
0.166667
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
5
38cbf6271e5c8686931e7778b83b92ce0a53e300
119
py
Python
synaptor/proc/overlap/__init__.py
ZettaAI/Synaptor
e425b4c744fca093ee5c63f41b82b3cae7898af4
[ "MIT" ]
7
2018-04-01T18:18:23.000Z
2021-09-13T07:02:16.000Z
synaptor/proc/overlap/__init__.py
ZettaAI/Synaptor
e425b4c744fca093ee5c63f41b82b3cae7898af4
[ "MIT" ]
5
2018-10-24T19:36:03.000Z
2020-10-30T02:13:38.000Z
synaptor/proc/overlap/__init__.py
ZettaAI/Synaptor
e425b4c744fca093ee5c63f41b82b3cae7898af4
[ "MIT" ]
6
2018-07-12T17:59:54.000Z
2020-10-30T02:29:50.000Z
from . import overlap from .overlap import count_overlaps, find_max_overlaps, add_overlapping_seg from . import merge
23.8
75
0.831933
17
119
5.529412
0.647059
0.212766
0
0
0
0
0
0
0
0
0
0
0.12605
119
4
76
29.75
0.903846
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
38d9b8b75915922113d0020dfc3dd142f820d8bc
237
py
Python
src/sage/combinat/ncsym/all.py
bopopescu/sage
2d495be78e0bdc7a0a635454290b27bb4f5f70f0
[ "BSL-1.0" ]
4
2020-07-17T04:49:44.000Z
2020-07-29T06:33:51.000Z
src/sage/combinat/ncsym/all.py
Ivo-Maffei/sage
467fbc70a08b552b3de33d9065204ee9cbfb02c7
[ "BSL-1.0" ]
2
2018-10-30T13:40:20.000Z
2020-07-23T12:13:30.000Z
src/sage/combinat/ncsym/all.py
dimpase/sage
468f23815ade42a2192b0a9cd378de8fdc594dcd
[ "BSL-1.0" ]
7
2021-11-08T10:01:59.000Z
2022-03-03T11:25:52.000Z
""" Features that are imported by default in the interpreter namespace """ from __future__ import absolute_import from .ncsym import SymmetricFunctionsNonCommutingVariables from .dual import SymmetricFunctionsNonCommutingVariablesDual
26.333333
66
0.85654
23
237
8.608696
0.782609
0
0
0
0
0
0
0
0
0
0
0
0.109705
237
8
67
29.625
0.938389
0.278481
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
38e4894c9f1670ff361dda9ba42c2198757e33bb
237
py
Python
src/Model/Visitor.py
oIi123/TableauxProver
cb527f91f5c2d0393fbfcb3fb501b4480e0c9031
[ "MIT" ]
null
null
null
src/Model/Visitor.py
oIi123/TableauxProver
cb527f91f5c2d0393fbfcb3fb501b4480e0c9031
[ "MIT" ]
null
null
null
src/Model/Visitor.py
oIi123/TableauxProver
cb527f91f5c2d0393fbfcb3fb501b4480e0c9031
[ "MIT" ]
null
null
null
def visitor(visitor_class: object): def visited(self, obj: object): # call visitor obj.__getattribute__("visited_" + visitor_class.__name__)(self) setattr(visitor_class, "visit", visited) return visitor_class
33.857143
71
0.700422
27
237
5.666667
0.481481
0.313725
0
0
0
0
0
0
0
0
0
0
0.194093
237
6
72
39.5
0.801047
0.050633
0
0
0
0
0.058296
0
0
0
0
0
0
1
0.4
false
0
0
0
0.6
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
5
2a09495aad436133b8f3603ce7c480e858e8a99f
86
py
Python
helpFuncs.py
Lunaresk/trollinfobot
1d9c5746799854435c50d0cc7b1ee6eb50283631
[ "MIT" ]
null
null
null
helpFuncs.py
Lunaresk/trollinfobot
1d9c5746799854435c50d0cc7b1ee6eb50283631
[ "MIT" ]
null
null
null
helpFuncs.py
Lunaresk/trollinfobot
1d9c5746799854435c50d0cc7b1ee6eb50283631
[ "MIT" ]
null
null
null
def linkUser(id, name = 'User'): return u'[{0}](tg://user?id={1})'.format(name, id)
28.666667
52
0.581395
15
86
3.333333
0.733333
0
0
0
0
0
0
0
0
0
0
0.026316
0.116279
86
2
53
43
0.631579
0
0
0
0
0
0.313953
0.267442
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
2a54e3c04e58f0252c8cc2cd8a05712c83833a41
186
py
Python
html_telegraph_poster/__init__.py
bhumikapaharia/html-telegraph-poster
e3bab4b7a602931eb9b891c6befbb6b2ded7e22c
[ "MIT" ]
1
2022-01-24T12:24:31.000Z
2022-01-24T12:24:31.000Z
html_telegraph_poster/__init__.py
bhumikapaharia/html-telegraph-poster
e3bab4b7a602931eb9b891c6befbb6b2ded7e22c
[ "MIT" ]
null
null
null
html_telegraph_poster/__init__.py
bhumikapaharia/html-telegraph-poster
e3bab4b7a602931eb9b891c6befbb6b2ded7e22c
[ "MIT" ]
null
null
null
from .html_to_telegraph import upload_to_telegraph, TelegraphPoster from .upload_images import upload_image import logging logging.getLogger(__name__).addHandler(logging.NullHandler())
31
67
0.865591
23
186
6.565217
0.608696
0.145695
0
0
0
0
0
0
0
0
0
0
0.069892
186
5
68
37.2
0.872832
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.75
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
aa4d0a9d9d65fe4183d24fbb84786f80a750e568
147
py
Python
third/orm/01_sqlalchemy.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
13
2020-01-04T07:37:38.000Z
2021-08-31T05:19:58.000Z
third/orm/01_sqlalchemy.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
3
2020-06-05T22:42:53.000Z
2020-08-24T07:18:54.000Z
third/orm/01_sqlalchemy.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
9
2020-10-19T04:53:06.000Z
2021-08-31T05:20:01.000Z
# https://github.com/sqlalchemy/sqlalchemy # https://www.sqlalchemy.org/ # pip install sqlalchemy import sqlalchemy print(sqlalchemy.__version__)
24.5
42
0.795918
17
147
6.647059
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.081633
147
5
43
29.4
0.837037
0.62585
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
5
aa6324c5c2bfdc82b2a8ff9561178d78ebc282ec
34
py
Python
Fundamentos/Python/Sesion3/archivoParalelo.py
sergijoan22/MasterDataEDEM
6dd9a449902633e1f03bc09163a8bdca44b2698a
[ "Apache-2.0" ]
null
null
null
Fundamentos/Python/Sesion3/archivoParalelo.py
sergijoan22/MasterDataEDEM
6dd9a449902633e1f03bc09163a8bdca44b2698a
[ "Apache-2.0" ]
null
null
null
Fundamentos/Python/Sesion3/archivoParalelo.py
sergijoan22/MasterDataEDEM
6dd9a449902633e1f03bc09163a8bdca44b2698a
[ "Apache-2.0" ]
null
null
null
def saludar(str): print(str*3)
17
17
0.647059
6
34
3.666667
0.833333
0
0
0
0
0
0
0
0
0
0
0.035714
0.176471
34
2
18
17
0.75
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0
0.5
0.5
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
1
0
5
aa91d214a1f42e7fd867926f6677ed64ff57f151
30
py
Python
py/desisurvey/_version.py
michaelJwilson/desisurvey
dfd875918beec919eb746946dc792a6db318b2ff
[ "BSD-3-Clause" ]
null
null
null
py/desisurvey/_version.py
michaelJwilson/desisurvey
dfd875918beec919eb746946dc792a6db318b2ff
[ "BSD-3-Clause" ]
null
null
null
py/desisurvey/_version.py
michaelJwilson/desisurvey
dfd875918beec919eb746946dc792a6db318b2ff
[ "BSD-3-Clause" ]
null
null
null
__version__ = '0.11.1.dev820'
15
29
0.7
5
30
3.4
1
0
0
0
0
0
0
0
0
0
0
0.259259
0.1
30
1
30
30
0.37037
0
0
0
0
0
0.433333
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
aac743e93fc17061f18d02fa91fbd53d49ba427f
249
py
Python
students/K33422/Khusnutdinov_Sergei/Lab_02/lab02/conf_app/admin.py
DanteLeapman/ITMO_ICT_WebDevelopment_2020-2021
e19ce8a69caf353c63a6f4c1b9484cc0fcceb74c
[ "MIT" ]
null
null
null
students/K33422/Khusnutdinov_Sergei/Lab_02/lab02/conf_app/admin.py
DanteLeapman/ITMO_ICT_WebDevelopment_2020-2021
e19ce8a69caf353c63a6f4c1b9484cc0fcceb74c
[ "MIT" ]
null
null
null
students/K33422/Khusnutdinov_Sergei/Lab_02/lab02/conf_app/admin.py
DanteLeapman/ITMO_ICT_WebDevelopment_2020-2021
e19ce8a69caf353c63a6f4c1b9484cc0fcceb74c
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import User, Conf, Review, Reserve from django.contrib.auth.admin import UserAdmin admin.site.register(User, UserAdmin) admin.site.register(Conf) admin.site.register(Review) admin.site.register(Reserve)
31.125
47
0.819277
36
249
5.666667
0.388889
0.176471
0.333333
0.254902
0
0
0
0
0
0
0
0
0.080321
249
8
48
31.125
0.89083
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.428571
0
0.428571
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
2d5584e63ee649d63b5db9a41b7352542f395746
5,274
py
Python
data_generation/clean_extra_data.py
KochPJ/AutoPoseEstimation
6b2e0181fb4dc76399c7a21759a9d73aebc48ade
[ "MIT" ]
8
2021-03-21T17:50:33.000Z
2022-01-21T13:55:39.000Z
data_generation/clean_extra_data.py
KochPJ/AutoPoseEstimation
6b2e0181fb4dc76399c7a21759a9d73aebc48ade
[ "MIT" ]
1
2021-11-09T19:25:34.000Z
2021-11-11T14:53:34.000Z
data_generation/clean_extra_data.py
KochPJ/AutoPoseEstimation
6b2e0181fb4dc76399c7a21759a9d73aebc48ade
[ "MIT" ]
2
2021-03-21T17:52:06.000Z
2021-05-14T06:48:51.000Z
import os import json import numpy as np import transforms3d ''' use only for data with foreground and foreground 180 ''' path = './data' classes = list(os.listdir(path)) tag = '.meta.json' l = len(tag) for cls in classes: print('_________________') print('class: ', cls) extra_path = os.path.join(path, cls, 'extra') extra_dirs = sorted(list(os.listdir(extra_path))) extra_dirs = sorted([d for d in extra_dirs if tag in d]) times = [int(float(d[:-l])) for d in extra_dirs] max_dist = 0 at = 0 for i, t in enumerate(times[:-1]): dist = times[i+1]-t if dist > max_dist: max_dist = dist at = i ''' fig, axs = plt.subplots(2, 2, constrained_layout=True) fig.suptitle(cls,fontsize=16) plt.subplot(1, 2, 1) plt.title('foreground') plt.plot(times[:at], list(range(len(times[:at])))) plt.subplot(1, 2, 2) plt.title('foreground 180') plt.plot(times[at+1:], list(range(len(times[at+1:])))) plt.show() ''' print('check for foreground') with open(os.path.join(extra_path, extra_dirs[0])) as f: meta = json.load(f) pc_rotation = np.array(meta.get('object_pose')).reshape(4, 4)[:3, :3] first_rotation = np.rad2deg(transforms3d.euler.mat2euler(pc_rotation)) rotations = [{'rot': first_rotation, 'indexes': [0]}] for i, d in enumerate(extra_dirs[1:at]): with open(os.path.join(extra_path, d)) as f: meta = json.load(f) pc_rotation = np.array(meta.get('object_pose')).reshape(4, 4)[:3, :3] this_rotation = np.rad2deg(transforms3d.euler.mat2euler(pc_rotation)) not_in_rotatins = True for rot in rotations: if np.array_equal(rot['rot'], this_rotation): not_in_rotatins = False rot['indexes'].append(i+1) break if not_in_rotatins: rotations.append({'rot': this_rotation, 'indexes': [i+1]}) for rot in rotations: print('rot: {}, n indexes: {}, first and last index: {}, dist: {}'.format( rot['rot'], len(rot['indexes']), [rot['indexes'][0], rot['indexes'][-1]], rot['indexes'][-1]-rot['indexes'][0]+1)) if not np.array_equal(rot['rot'], first_rotation): print('delete indexes of rot: {}'.format(rot['rot'])) print([rot['indexes'][0], rot['indexes'][-1]], rot['indexes'][-1]-rot['indexes'][0]+1) for index in rot['indexes']: id = extra_dirs[index][:-l] curr_path = os.path.join(extra_path, '{}.color.png'.format(id)) if os.path.exists(curr_path): os.remove(curr_path) curr_path = os.path.join(extra_path, '{}.depth.png'.format(id)) if os.path.exists(curr_path): os.remove(curr_path) curr_path = os.path.join(extra_path, '{}.meta.json'.format(id)) if os.path.exists(curr_path): os.remove(curr_path) print('') print('check for foreground 180') with open(os.path.join(extra_path, extra_dirs[at+1])) as f: meta = json.load(f) pc_rotation = np.array(meta.get('object_pose')).reshape(4, 4)[:3, :3] first_rotation = np.rad2deg(transforms3d.euler.mat2euler(pc_rotation)) rotations = [{'rot': first_rotation, 'indexes': [at+1]}] for i, d in enumerate(extra_dirs[at+2:]): with open(os.path.join(extra_path, d)) as f: meta = json.load(f) pc_rotation = np.array(meta.get('object_pose')).reshape(4, 4)[:3, :3] this_rotation = np.rad2deg(transforms3d.euler.mat2euler(pc_rotation)) not_in_rotatins = True for rot in rotations: if np.array_equal(rot['rot'], this_rotation): not_in_rotatins = False rot['indexes'].append(i+at+2) break if not_in_rotatins: rotations.append({'rot': this_rotation, 'indexes': [i+at+2]}) for rot in rotations: print('rot: {}, n indexes: {}, first and last index: {}, dist: {}'.format( rot['rot'], len(rot['indexes']), [rot['indexes'][0], rot['indexes'][-1]], rot['indexes'][-1]-rot['indexes'][0]+1)) if not np.array_equal(rot['rot'], first_rotation): print('delete indexes of rot: {}'.format(rot['rot'])) print([rot['indexes'][0], rot['indexes'][-1]], rot['indexes'][-1]-rot['indexes'][0]+1) for index in rot['indexes']: id = extra_dirs[index][:-l] curr_path = os.path.join(extra_path, '{}.color.png'.format(id)) if os.path.exists(curr_path): os.remove(curr_path) curr_path = os.path.join(extra_path, '{}.depth.png'.format(id)) if os.path.exists(curr_path): os.remove(curr_path) curr_path = os.path.join(extra_path, '{}.meta.json'.format(id)) if os.path.exists(curr_path): os.remove(curr_path)
37.942446
98
0.540766
698
5,274
3.941261
0.143266
0.079971
0.043621
0.054526
0.782261
0.757543
0.757543
0.739368
0.739368
0.713195
0
0.022623
0.29598
5,274
138
99
38.217391
0.718287
0
0
0.653465
0
0
0.121094
0
0
0
0
0
0
1
0
false
0
0.039604
0
0.039604
0.108911
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
2d58a3ca7cb54f97cdf121396337f0b44457da7e
206
py
Python
api/views/__init__.py
SarangWadode/medstore
07cb70661a8cba6f8dd090dfbd589bfacb7bf12a
[ "MIT" ]
2
2021-03-24T13:36:39.000Z
2022-02-10T13:51:59.000Z
api/views/__init__.py
SarangWadode/medstore
07cb70661a8cba6f8dd090dfbd589bfacb7bf12a
[ "MIT" ]
44
2021-01-05T01:51:38.000Z
2022-02-10T13:44:26.000Z
api/views/__init__.py
mukeshgurpude/medstore
498b76acbeb9727e7a61560e4016b3577c2706d2
[ "MIT" ]
1
2020-10-28T09:26:01.000Z
2020-10-28T09:26:01.000Z
# A little bit modification, used the __init__.py as to make different routes in different files from .medicine import * from .auth import * from .cart import * from .order import * from .checkout import *
29.428571
96
0.762136
31
206
4.935484
0.709677
0.261438
0
0
0
0
0
0
0
0
0
0
0.174757
206
6
97
34.333333
0.9
0.456311
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
2d69fedc4eca0b45958c80460c196c33d83a6521
65
py
Python
Modules and packages/Built-in modules/builtin_modules.py
yazgeldigithub/PythonIntro
849065dcaaf8bc6aaf63cd35fdcd4b24786955c1
[ "MIT" ]
null
null
null
Modules and packages/Built-in modules/builtin_modules.py
yazgeldigithub/PythonIntro
849065dcaaf8bc6aaf63cd35fdcd4b24786955c1
[ "MIT" ]
null
null
null
Modules and packages/Built-in modules/builtin_modules.py
yazgeldigithub/PythonIntro
849065dcaaf8bc6aaf63cd35fdcd4b24786955c1
[ "MIT" ]
null
null
null
import sys import datetime print(sys.path) print(datetime.date)
10.833333
20
0.8
10
65
5.2
0.6
0
0
0
0
0
0
0
0
0
0
0
0.107692
65
5
21
13
0.896552
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
5
2d971a6513ffcc1cacbf32bdaa649493363ce3be
2,029
py
Python
csrank/tests/test_losses.py
hytsang/cs-ranking
241626a6a100a27b96990b4f199087a6dc50dcc0
[ "Apache-2.0" ]
null
null
null
csrank/tests/test_losses.py
hytsang/cs-ranking
241626a6a100a27b96990b4f199087a6dc50dcc0
[ "Apache-2.0" ]
null
null
null
csrank/tests/test_losses.py
hytsang/cs-ranking
241626a6a100a27b96990b4f199087a6dc50dcc0
[ "Apache-2.0" ]
1
2018-10-30T08:57:14.000Z
2018-10-30T08:57:14.000Z
import numpy as np from keras import backend as K from numpy.testing import assert_almost_equal from csrank.losses import hinged_rank_loss, smooth_rank_loss, plackett_luce_loss decimal = 3 def test_hinged_rank_loss(): y_true = np.arange(5)[None, :] y_true_tensor = K.constant(y_true) # Predicting all 0, gives an error of 1.0: assert_almost_equal( actual=K.eval( hinged_rank_loss( y_true_tensor, K.constant(np.array([[0., 0., 0., 0., 0.]])) ) ), desired=np.array([1.]), decimal=decimal, ) # Predicting the correct ranking improves, but penalizes by difference of # scores: assert_almost_equal( actual=K.eval( hinged_rank_loss( y_true_tensor, K.constant(np.array([[.2, .1, .0, -0.1, -0.2]])) ) ), desired=np.array([0.8]), decimal=decimal, ) def test_plackett_luce_loss(): y_true = np.arange(5)[None, :] y_true_tensor = K.constant(y_true) assert_almost_equal( actual=K.eval( plackett_luce_loss( y_true_tensor, K.constant(np.array([[0., 0., 0., 0., 0.]])) ) ), desired=np.array([4.78749]), decimal=decimal, ) def test_smooth_rank_loss(): y_true = np.arange(5)[None, :] y_true_tensor = K.constant(y_true) # Predicting all 0, gives an error of 1.0: assert_almost_equal( actual=K.eval( smooth_rank_loss( y_true_tensor, K.constant(np.array([[0., 0., 0., 0., 0.]])) ) ), desired=np.array([1.]), decimal=decimal, ) # Predicting the correct ranking improves, but penalizes by difference of # scores: assert_almost_equal( actual=K.eval( smooth_rank_loss( y_true_tensor, K.constant(np.array([[.2, .1, .0, -0.1, -0.2]])) ) ), desired=np.array([0.822749841877]), decimal=decimal, )
25.683544
80
0.56136
268
2,029
4.029851
0.212687
0.064815
0.025
0.088889
0.782407
0.749074
0.723148
0.723148
0.723148
0.723148
0
0.04416
0.308034
2,029
78
81
26.012821
0.725071
0.118778
0
0.627119
0
0
0
0
0
0
0
0
0.101695
1
0.050847
false
0
0.067797
0
0.118644
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
2dd4cfee0f24415a7cea03aaf2c96896c4bf578a
11,177
py
Python
test/test_deterministic_wallets.py
mflaxman/electrum-personal-server
700cd108ea026b971f05b906db03951acf6b2ac0
[ "MIT" ]
2
2020-06-19T20:11:38.000Z
2021-12-28T10:52:10.000Z
test/test_deterministic_wallets.py
mflaxman/electrum-personal-server
700cd108ea026b971f05b906db03951acf6b2ac0
[ "MIT" ]
10
2018-08-02T16:58:34.000Z
2018-08-04T22:00:09.000Z
test/test_deterministic_wallets.py
mflaxman/electrum-personal-server
700cd108ea026b971f05b906db03951acf6b2ac0
[ "MIT" ]
1
2020-07-05T20:32:15.000Z
2020-07-05T20:32:15.000Z
import pytest from electrumpersonalserver.server import parse_electrum_master_public_key # electrum has its own tests here #https://github.com/spesmilo/electrum/blob/03b40a3c0a7dd84e76bc0d0ea2ad390dafc92250/lib/tests/test_wallet_vertical.py @pytest.mark.parametrize( "master_public_key, recv_spks, change_spks", [ #p2pkh wallet ("xpub661MyMwAqRbcGVQTLtBFzc3ENvyZHoUEhWRdGwoqLZaf5wXP9VcDY2VJV7usvsFLZz" + "2RUTVhCVXYXc3S8zpLyAFbDFcfrpUiwLoE9VWH2yz", #pubkey ["76a914b1847c763c9a9b12631ab42335751c1bf843880c88ac" #recv scriptpubkeys ,"76a914d8b6b932e892fad5132ea888111adac2171c5af588ac" ,"76a914e44b19ef74814f977ae4e2823dd0a0b33480472a88ac"], ["76a914d2c2905ca383a5b8f94818cb7903498061a6286688ac" #change scriptpubkeys ,"76a914e7b4ddb7cede132e84ba807defc092cf52e005b888ac" ,"76a91433bdb046a1d373728d7844df89aa24f788443a4588ac"]) , #p2wpkh wallet ("zpub6mr7wBKy3oJn89TCiXUAPBWpTTTx58BgEjPLzDNf5kMThvd6xchrobPTsJ5mP" + "w3NJ7zRhckN8cv4FhQBfwurZzNE5uTW5C5PYqNTkRAnTkP", #pubkey ['00142b82c61a7a48b7b10801f0eb247af46821bd33f5' #recv scriptpubkeys ,'0014073dc6bcbb18d6468c5996bdeba926f6805b74b1' ,'001400fa0b5cb21e8d442a7bd61af3d558a62be0c9aa'], ['00144f4a0655a4b586be1e08d97a2f55125120b84c69' #change scriptpubkeys ,'0014ef7967a7a56c23bbc9f317e612c93a5e23d25ffe' ,'0014ad768a11730bf54d10c72184d53239de0f310bc9']) ,#p2sh 2of2 multisig wallet ("2 tpubD6NzVbkrYhZ4YVMVzC7wZeRfz3bhqcHvV8M3UiULCfzFtLtp5nwvi6LnBQegrkx" + "YGPkSzXUEvcPEHcKdda8W1YShVBkhFBGkLxjSQ1Nx3cJ tpubD6NzVbkrYhZ4WjgNYq2nF" + "TbiSLW2SZAzs4g5JHLqwQ3AmR3tCWpqsZJJEoZuP5HAEBNxgYQhtWMezszoaeTCg6FWGQB" + "T74sszGaxaf64o5s", #m=2, 2 pubkeys, n=len(pubkeys) ['a914fe30a46a4e1b41f9bb758448fd84ee4628c103e187' #recv ,'a914dad5dd605871560ae5d219cd6275e6ad19bc6b9987' ,'a914471e158e2db190acdd8c76ed6d2ade102fe1e8ac87' ,'a914013449715a32f21d1a8a2b95a01b40eb41ada16f87' ,'a914ae3dd25567fb7c2f87be41220dd14025ca68b0e087' ,'a91462b90344947b610c4eadb7dd460fee3f32fefe7687' ,'a914d4388c7d5771ebf26b6e650c42e60e4cf7d4c5a187' ,'a914e4f0832e56591d01b71c72b9a3777dc8f9d9a92e87' ,'a914a5d5accd96d27403c7663b92fdb57299d7a871eb87' ,'a914f8f2c6ef2d80f972e4d8b418a15337a3c38af37f87' ,'a914a2bd2f67fac7c24e609b574ccc8cfaa2f90ebf8c87' ,'a914a56298a7decde1d18306f55d9305577c3fce690187' ,'a91430f2f83238ac29125a539055fa59efc86a73a23987' ,'a914263b4585d0735c5065987922af359d5eabeb880d87' ,'a91455d9d47113fb8b37705bdf6d4107d438afd63e4687' ,'a914970d754163b8957b73f4e8baaf23dea5f6e3db2287' ,'a914facbc921203a9ffd751cc246a884918beaac21b687' ,'a914fc7556833eca1e0f84c6d7acb875e645f7ed4e9687' ,'a914bbfe6a032d633f113b5d605e3a97cc08a47cc87d87' ,'a91403d733c4ca337b5fa1de95970ba6f898a9d36c4887' ,'a9148af27dc7c950e17c11e164065e672cd60ae3d48d87' ,'a914c026aa45377f2a4a62136bac1d3350c318fee5c587' ,'a9146337f59e3ea55e73725c9f2fc52a5ca5d68c361687'], ['a914aeaebf9d567ab8a6813e89668e16f40bf419408e87' #change ,'a914f2a6264dd3975297fa2a5a8e17321299a44f76d987' ,'a9142067a6c47958090a645137cc0898c0c7bbc69b5387' ,'a914210840f77ea5b7eb11cb55e5d719a93b7746fb9387' ,'a914163db6b8ca00362be63a26502c5f7bf64787506b87' ,'a91479b2c527594059c056e5367965ae92bbcf63512187']) ,#p2sh 2of3 multisig wallet ("2 tpubD6NzVbkrYhZ4WwaMJ3od4hANxdMVpb63Du3ERq1xjtowxVJEcTbGH2rFd9TFXxw" + "KJRKDn9vQjDPxFeaku6BHW6wHn2KPF1ijS4LwgwQFJ3B tpubD6NzVbkrYhZ4Wjv4ZRPD6" + "MNdiLmfvXztbKuuatkqHjukU3S6GXhmKnbAF5eU9bR2Nryiq8v67emUUSM1VUrAx5wcZ19" + "AsaGg3ZLmjbbwLXr tpubD6NzVbkrYhZ4Xxa2fEp7YsbnFnwuQNaogijbiX42Deqd4NiAD" + "tqNU6AXCU2d2kPFWBpAGG7K3HAKYwUfZBPgTLkfQp2dDg9SLVnkgYPgEXN", ['a914167c95beb25b984ace517d4346e6cdbf1381793687', #recv addrs 'a914378bbda1ba7a713de18c3ba3c366f42212bfb45087', 'a9142a5c9881c70906180f37dd02d8c830e9b6328d4a87', 'a914ffe0832375b72ee5307bfa502896ba28cc470ee987', 'a9147607d40e039fbea57d9c04e48b198c9fcf3356c187', 'a9148d9582ad4cf0581c6e0697e4cba6a12e66ca1a0087', 'a914d153a743b315ba19690823119019e16e3762104d87', 'a914b4accc89e48610043e70371153fd8cb5a3eef34287', 'a91406febca615e3631253fd75a1d819436e1d046e0487', 'a914b863cbb888c6b28291cb87a2390539e28be37a9587', 'a914ec39094e393184d2c352a29b9d7a3caddaccb6cf87', 'a914da4faa4babbdf611caf511d287133f06c1c3244a87', 'a9146e64561d0c5e2e9159ecff65db02e04b3277402487', 'a914377d66386972492192ae827fb2208596af0941d187', 'a914448d364ff2374449e57df13db33a40f5b099997c87', 'a914f24b875d2cb99e0b138ab0e6dd65027932b3c6e787', 'a914aa4bcee53406b1ef6c83852e3844e38a3a9d9f3087', 'a9145e5ec40fdab54be0d6e21107bc38c39df97e37fc87', 'a9141de4d402c82f4e9b0e6b792b331232a5405ebd3f87', 'a9148873ee280e51f9c64d257dd6dedc8712fd652cc687'], ['a9142cc87d7562a85029a57cc37026e12dab72223db287', #change 'a91499f4aee0b274f0b3ab48549a2c58cd667a62c0cb87', 'a91497a89cd5ada3a766a1275f8151e9256fcf537f6c87', 'a9147ffc9f3a3b60635ea1783243274f4d07ab617cb487', 'a9143423113ab913d86fd47e55488a0c559e18b457b987', 'a914a28a3773a37c52ff6fd7dff497d0eaf80a46febb87']) , #p2wsh 1of2 multisig wallet ("1 Vpub5fAqpSRkLmvXwqbuR61MaKMSwj5z5xUBwanaz3qnJ5MgaBDpFSLUvKTiNK9zHp" + "dvrg2LHHXkKxSXBHNWNpZz9b1VqADjmcCs3arSoxN3F3r Vpub5fvEo4MUpbVs9sZqr45" + "zmRVEsTcQ49MA9m3MLht3XzdZvS9eMXLLu1H6TL1j2SMnykHqXNzG5ycMyQmFDvEE5B32" + "sP8TmRe6wW8HjBgMssh", #recv scriptpubkeys ['002031fbaa839e96fc1abaf3453b9f770e0ccfe2d8e3e990bb381fdcb7db4722986a', '0020820ae739b36f4feb1c299ced201db383bbcf1634e0071e489b385f43c2323761', '0020eff05f4d14aa1968a7142b1009aa57a6208fb01b212f8b8f7df63645d26a1292', '002049c6e17979dca380ffb66295d27f609bea2879d4f0b590c96c70ff12260a8721', '002002bf2430fc7ebc6fb27da1cb80e52702edcc62a29f65c997e5c924dcd98411bd', '0020c7a58dcf9633453ba12860b57c14af67d87d022be5c52bf6be7a6abdc295c6e0', '0020136696059a5e932c72f4f0a05fa7f52faf9b54f1b7694e15acce710e6cc9e89d', '0020c372e880227f35c2ee35d0724bf05cea95e74dcb3e6aa67ff15f561a29c0645d', '002095c705590e2b84996fa44bff64179b26669e53bbd58d76bb6bbb5c5498a981ce', '00207217754dae083c3c365c7e1ce3ad889ca2bd88e4f809cec66b9987adc390aa26', '0020bee30906450e099357cc96a1f472c1ef70089cd4a0cba96749adfe1c9a2f9e87', '0020b1838b3d5a386ad6c90eeae9a27a9b812e32ce06376f261dea89e405bc8209d9', '0020231a3d05886efff601f0702d4c8450dfcce8d6a4bd90f17f7ff76f5c25c632de', '002071220f3941b5f65aca90e464db4291cd5ea63f37fa858fd5b66d5019f0dbab0f', '0020fc3c7db9f0e773f9f9c725d4286ddcc88db9575c45b2441d458018150eb4ef10', '00209f037bfc98dee2fc0d3cca54df09b2d20e92a0133fa381a4dd74c49e4d0a89f5', '0020c9060d0554ba2ca92048e1772e806d796ba41f10bf6aee2653a9eba96b05c944', '0020a7cb1dd2730dba564f414ed8d9312370ff89c34df1441b83125cb4d97a96005a', '00209fddc9b4e070b887dec034ed74f15f62d075a3ac8cf6eb95a88c635e0207534c', '0020c48f9c50958ab8e386a8bd3888076f31d12e5cf011ff46cc83c6fadfe6d47d20', '0020a659f4621dca404571917e73dedb26b6d7c49a07dacbf15890760ac0583d3267'], #change scriptpubkeys ['002030213b5d3b6988b86aa13a9eaca08e718d51f32dc130c70981abb0102173c791', '002027bd198f9783a58e9bc4d3fdbd1c75cc74154905cce1d23c7bd3e051695418fe', '0020c1fd2cdebf120d3b1dc990dfdaca62382ff9525beeb6a79a908ddecb40e2162c', '00207a3e478266e5fe49fe22e3d8f04d3adda3b6a0835806a0db1f77b84d0ba7f79c', '002059e66462023ecd54e20d4dce286795e7d5823af511989736edc0c7a844e249f5', '0020bd8077906dd367d6d107d960397e46db2daba5793249f1f032d8d7e12e6f193c']) , #p2wpkh-p2sh ("upub5E4QEumGPNTmSKD95TrYX2xqLwwvBULbRzzHkrpW9WKKCB1y9DEfPXDnUyQjLjmVs" + "7gSd7k5vRb1FoSb6BjyiWNg4arkJLaqk1jULzbwA5q", ["a914ae8f84a06668742f713d0743c1f54d248040e63387", #recv "a914c2e9bdcc48596b8cce418042ade72198fddf3cd987", "a914a44b6ad63ccef0ae1741eaccee99bf2fa83f842987", "a9148cf1c891d96a0be07893d0bddcf00ed5dad2c46e87", "a91414d677b32f2409f4dfb3073d382c302bcd6ed33587", "a9141b284bee7198d5134512f37ef60e4048864b4bd687"], ["a914a5aacff65860440893107b01912dc8f60cadab2b87", #change "a914dcd74ebc8bfc5cf0535717a3e833592d54b3c48687", "a91446793cae4c2b8149ade61c1627b96b90599bc08787", "a91439f3776831f321125bdb5099fbbd654923f8316c87"]) , #p2wpkh-p2sh ("ypub6XrRLtXNB7NQo3vDaMNnffXVJe1WVaebXcb4ncpTHHADLuFYmf2CcPn96YzUbMt8s" + "HSMmtr1mCcMgCBLqNdY2hrXXcdiLxCdD9e2dChBLun", ["a91429c2ad045bbb162ef3c2d9cacb9812bec463061787", #recv "a91433ec6bb67b113978d9cfd307a97fd15bc0a5a62087", "a91450523020275ccbf4e916a0d8523ae42391ad988a87", "a91438c2e5e76a874d86cfc914fe9fc1868b6afb5c5487"], ["a91475f608698bb735120a17699fee854bce9a8dc8d387", "a91477e69344ef53587051c85a06a52a646457b44e6c87", "a914607c98ea34fbdffe39fee161ae2ffd5517bf1a5587"]) , #old mnemonic mpk ("e9d4b7866dd1e91c862aebf62a49548c7dbf7bcc6e4b7b8c9da820c7737968df9c09d" + "5a3e271dc814a29981f81b3faaf2737b551ef5dcc6189cf0f8252c442b3", ["76a9149cd3dfb0d87a861770ae4e268e74b45335cf00ab88ac", #recv "76a914c30f2af6a79296b6531bf34dba14c8419be8fb7d88ac", "76a9145eb4eeaefcf9a709f8671444933243fbd05366a388ac", "76a914f96669095e6df76cfdf5c7e49a1909f002e123d088ac"], ["76a914ca14915184a2662b5d1505ce7142c8ca066c70e288ac", #change "76a9148942ac692ace81019176c4fb0ac408b18b49237f88ac", "76a914e1232622a96a04f5e5a24ca0792bb9c28b089d6e88ac"]) , #p2wsh-p2sh 2of2 multisig ("2 Ypub6hWbqA2p47QgsLt5J4nxrR3ngu8xsPGb7PdV8CDh48KyNngNqPKSqertAqYhQ4u" + "mELu1UsZUCYfj9XPA6AdSMZWDZQobwF7EJ8uNrECaZg1 Ypub6iNDhL4WWq5kFZcdFqHHw" + "X4YTH4rYGp8xbndpRrY7WNZFFRfogSrL7wRTajmVHgR46AT1cqUG1mrcRd7h1WXwBsgX2Q" + "vT3zFbBCDiSDLkau", ["a91428060ade179c792fac07fc8817fd150ce7cdd3f987", #recv "a9145ba5ed441b9f3e22f71193d4043b645183e6aeee87", "a91484cc1f317b7d5afff115916f1e27319919601d0187", "a9144001695a154cac4d118af889d3fdcaf929af315787", "a914897888f3152a27cbd7611faf6aa01085931e542a87"], ["a91454dbb52de65795d144f3c4faeba0e37d9765c85687", #change "a914f725cbd61c67f34ed40355f243b5bb0650ce61c587", "a9143672bcd3d02d3ea7c3205ddbc825028a0d2a781987"]) ] ) def test_deterministic_wallets(master_public_key, recv_spks, change_spks): initial_count = 15 gaplimit = 5 wal = parse_electrum_master_public_key(master_public_key, gaplimit) spks = wal.get_scriptpubkeys(0, 0, initial_count) #for test, generate 15, check that the last 5 lead to gap limit overrun for i in range(initial_count - gaplimit): ret = wal.have_scriptpubkeys_overrun_gaplimit([spks[i]]) assert ret == None for i in range(gaplimit): index = i + initial_count - gaplimit ret = wal.have_scriptpubkeys_overrun_gaplimit([spks[index]]) assert ret != None and ret[0] == i+1 last_index_add = 3 last_index = initial_count - gaplimit + last_index_add ret = wal.have_scriptpubkeys_overrun_gaplimit(spks[2:last_index]) assert ret[0] == last_index_add assert wal.get_scriptpubkeys(0, 0, len(recv_spks)) == recv_spks assert wal.get_scriptpubkeys(1, 0, len(change_spks)) == change_spks
56.165829
117
0.833408
404
11,177
22.930693
0.59901
0.006477
0.008096
0.007448
0.035622
0.025043
0.025043
0.013385
0.013385
0.013385
0
0.452605
0.107095
11,177
198
118
56.449495
0.475651
0.053324
0
0
0
0
0.763797
0.752323
0
0
0
0
0.026882
1
0.005376
false
0
0.010753
0
0.016129
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
934f93f6826c943f78e2f05fb5205c4dd95da98e
12,979
py
Python
hmda/migrations/0009_auto_20181117_2048.py
cmc333333/mapusaurus
1d7ccef90d0ed832d52f797cbe68057057cd0177
[ "CC0-1.0" ]
null
null
null
hmda/migrations/0009_auto_20181117_2048.py
cmc333333/mapusaurus
1d7ccef90d0ed832d52f797cbe68057057cd0177
[ "CC0-1.0" ]
55
2018-02-09T04:11:31.000Z
2018-07-04T18:30:29.000Z
hmda/migrations/0009_auto_20181117_2048.py
cmc333333/mapusaurus
1d7ccef90d0ed832d52f797cbe68057057cd0177
[ "CC0-1.0" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-11-17 20:48 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('hmda', '0008_auto_20180331_0327'), ] operations = [ migrations.AlterField( model_name='hmdarecord', name='agency_code', field=models.CharField(choices=[('1', 'Office of the Comptroller of the Currency (OCC)'), ('2', 'Federal Reserve System (FRS)'), ('3', 'Federal Deposit Insurance Corporation (FDIC)'), ('5', 'National Credit Union Administration (NCUA)'), ('7', 'Department of Housing and Urban Development (HUD)'), ('9', 'Consumer Financial Protection Bureau (CFPB)')], help_text='A code representing the federal agency to which the HMDA-reporting institution submits its HMDA data.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='applicant_ethnicity', field=models.CharField(choices=[('1', 'Hispanic or Latino'), ('2', 'Not Hispanic or Latino'), ('3', 'Information not provided by applicant in mail, Internet, or telephone application'), ('4', 'Not applicable'), ('5', 'No co-applicant')], help_text='A code representing the ethnicity of the primary applicant.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='applicant_income_000s', field=models.CharField(help_text='The gross annual income that the lender relied on when evaluating the creditworthiness of the applicant, rounded to the nearest thousand.', max_length=8), ), migrations.AlterField( model_name='hmdarecord', name='applicant_race_1', field=models.CharField(choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the first listed race for the primary applicant. The applicant can list up to five races.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='applicant_race_2', field=models.CharField(blank=True, choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the second listed race for the primary applicant.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='applicant_race_3', field=models.CharField(blank=True, choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the third listed race for the primary applicant.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='applicant_race_4', field=models.CharField(blank=True, choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the fourth listed race for the primary applicant.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='applicant_race_5', field=models.CharField(blank=True, choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the fifth listed race for the primary applicant.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='co_applicant_ethnicity', field=models.CharField(choices=[('1', 'Hispanic or Latino'), ('2', 'Not Hispanic or Latino'), ('3', 'Information not provided by applicant in mail, Internet, or telephone application'), ('4', 'Not applicable'), ('5', 'No co-applicant')], help_text='A code representing the ethnicity of the co-applicant.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='co_applicant_race_1', field=models.CharField(choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the first listed race for the co-applicant. The co-applicant can list up to five races.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='co_applicant_race_2', field=models.CharField(blank=True, choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the second listed race for the co-applicant.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='co_applicant_race_3', field=models.CharField(blank=True, choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the third listed race for the co-applicant.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='co_applicant_race_4', field=models.CharField(blank=True, choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the fourth listed race for the co-applicant.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='co_applicant_race_5', field=models.CharField(blank=True, choices=[('1', 'American Indian or Alaska Native'), ('2', 'Asian'), ('3', 'Black or African American'), ('4', 'Native Hawaiian or Other Pacific Islander '), ('5', 'White'), ('6', 'Information not provided by applicant in mail, Internet, or telephone application'), ('7', 'Not applicable'), ('8', 'No co-applicant')], help_text='A code representing the fifth listed race for the co-applicant.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='denial_reason_1', field=models.CharField(blank=True, choices=[('1', 'Debt-to-income ratio'), ('2', 'Employment history'), ('3', 'Credit history'), ('4', 'Collateral'), ('5', 'Insufficient cash (downpayment, closing costs)'), ('6', 'Unverifiable information'), ('7', 'Credit application incomplete'), ('8', 'Mortgage insurance denied'), ('9', 'Other')], help_text='A code representing the first reason for denial of the application. Lenders may report up to three denial reasons, but such reporting is optional.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='denial_reason_2', field=models.CharField(blank=True, choices=[('1', 'Debt-to-income ratio'), ('2', 'Employment history'), ('3', 'Credit history'), ('4', 'Collateral'), ('5', 'Insufficient cash (downpayment, closing costs)'), ('6', 'Unverifiable information'), ('7', 'Credit application incomplete'), ('8', 'Mortgage insurance denied'), ('9', 'Other')], help_text='A code representing the second reason for denial of the application.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='denial_reason_3', field=models.CharField(blank=True, choices=[('1', 'Debt-to-income ratio'), ('2', 'Employment history'), ('3', 'Credit history'), ('4', 'Collateral'), ('5', 'Insufficient cash (downpayment, closing costs)'), ('6', 'Unverifiable information'), ('7', 'Credit application incomplete'), ('8', 'Mortgage insurance denied'), ('9', 'Other')], help_text='A code representing the third reason for denial of the application.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='edit_status', field=models.CharField(blank=True, choices=[('', 'No edit failures'), ('5', 'Validity edit failure only'), ('6', 'Quality edit failure only'), ('7', 'Validity and quality edit failures')], help_text='A code representing the edit failure status of the application.', max_length=1, null=True), ), migrations.AlterField( model_name='hmdarecord', name='hoepa_status', field=models.CharField(choices=[('1', 'HOEPA loan'), ('2', 'Not a HOEPA loan')], help_text='A code representing whether a loan is subject to the Home Ownership and Equity Protection Act of 1994 (HOEPA).', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='hmda_record_id', field=models.CharField(max_length=23, primary_key=True, serialize=False), ), migrations.AlterField( model_name='hmdarecord', name='lien_status', field=models.CharField(choices=[('1', 'Secured by a first lien'), ('2', 'Secured by a subordinate lien'), ('3', 'Not secured by a lien'), ('4', 'Not applicable (purchased loans)')], help_text='A code representing the lien status. Most mortgages are secured by a lien against the property. In the event of a forced liquidation, first lien holders will generally get paid before subordinate lien holders.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='preapproval', field=models.CharField(choices=[('1', 'Preapproval was requested'), ('2', 'Preapproval was not requested'), ('3', 'Not applicable')], help_text='A code representing the pre-approval status of the application.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='property_type', field=models.CharField(choices=[('1', 'One to four-family (other than manufactured housing)'), ('2', 'Manufactured housing'), ('3', 'Multifamily')], help_text='A code representing the type of the property.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='purchaser_type', field=models.CharField(choices=[('0', 'Loan was not originated or was not sold in calendar year covered by register'), ('1', 'Fannie Mae (FNMA)'), ('2', 'Ginnie Mae (GNMA)'), ('3', 'Freddie Mac (FHLMC)'), ('4', 'Farmer Mac (FAMC)'), ('5', 'Private securitization'), ('6', 'Commercial bank, savings bank or savings association'), ('7', 'Life insurance company, credit union, mortgage bank, or finance company'), ('8', 'Affiliate institution'), ('9', 'Other type of purchaser')], help_text='A code representing the type of institution purchasing the loan.', max_length=1), ), migrations.AlterField( model_name='hmdarecord', name='sequence_number', field=models.CharField(help_text='A one-up number scheme for each respondent to make each loan unique.', max_length=8), ), ]
92.049645
582
0.646968
1,601
12,979
5.164897
0.163648
0.060467
0.075584
0.087677
0.780989
0.756803
0.712178
0.706857
0.693191
0.661144
0
0.021898
0.197781
12,979
140
583
92.707143
0.772282
0.005316
0
0.56391
1
0.045113
0.530875
0.005114
0
0
0
0
0
1
0
false
0
0.015038
0
0.037594
0
0
0
0
null
0
0
0
0
1
1
1
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
5
fa7daa77f6e4adbef5d5783be9b77a28d8a9cc2f
93
py
Python
HREMGromacs/__init__.py
MauriceKarrenbrock/HREMGromacs
3741820bee466ae3b4a69a8241c0905b5beffe0c
[ "MIT" ]
null
null
null
HREMGromacs/__init__.py
MauriceKarrenbrock/HREMGromacs
3741820bee466ae3b4a69a8241c0905b5beffe0c
[ "MIT" ]
null
null
null
HREMGromacs/__init__.py
MauriceKarrenbrock/HREMGromacs
3741820bee466ae3b4a69a8241c0905b5beffe0c
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Template init file""" from .package import __title__, __version__
23.25
43
0.677419
11
93
5
1
0
0
0
0
0
0
0
0
0
0
0.0125
0.139785
93
3
44
31
0.675
0.44086
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
fac38a5c07150f3bc3e731989d6bfc2f7d456b84
2,241
py
Python
bioimageio/core/transformations/reshape.py
k-dominik/python-bioimage-io
aecaa3412c31672ce159335db083ee9fb4fca519
[ "MIT" ]
null
null
null
bioimageio/core/transformations/reshape.py
k-dominik/python-bioimage-io
aecaa3412c31672ce159335db083ee9fb4fca519
[ "MIT" ]
null
null
null
bioimageio/core/transformations/reshape.py
k-dominik/python-bioimage-io
aecaa3412c31672ce159335db083ee9fb4fca519
[ "MIT" ]
null
null
null
from typing import Sequence from bioimageio.core.protocols import Tensor from bioimageio.core.transformations import TensorTransformation class Reshape(TensorTransformation): def __init__(self, shape: Sequence[int], **super_kwargs): self.shape = shape super().__init__(**super_kwargs) def apply(self, tensor: Tensor) -> Tensor: # this -2 stuff was intended to be able to deal with an unknown batch dimension... # todo: decide if we want to deal with batch dimension at all in trfs and if so how? # if -2 in self.shape and self.shape.index(-2) >= len(tensor.shape): # raise ValueError(f"transformation shape {self.shape} incompatible with tensor shape {tensor.shape}") # # out_shape = tuple([tensor.shape[i] if s == -2 else s for i, s in enumerate(self.shape)]) return tensor.reshape(self.shape) # def dynamic_output_shape(self, input_shape: List[Tuple[int]]) -> List[Tuple[int]]: # output_shape = [] # for i, ipt_shape in enumerate(input_shape): # if i in self.apply_to: # s = numpy.prod(ipt_shape) # rest_dim = None # out_shape = list(ipt_shape) # for out_idx, out in enumerate(self.shape): # if out == -1: # rest_dim = out_idx # continue # # if out == -2: # out = ipt_shape[self.shape.index(-2)] # out_shape[out_idx] = out # # if s / out != s // out: # raise ValueError(f"Cannot reshape {ipt_shape} to {self.shape}") # # s //= out # # if rest_dim is not None: # out_shape[rest_dim] = s # elif s != 1: # raise ValueError(f"Cannot reshape {ipt_shape} to {self.shape}") # # output_shape.append(tuple(out_shape)) # else: # output_shape.append(ipt_shape) # # return output_shape # # def dynamic_input_shape(self, output_shape: List[Tuple[int]]) -> List[Tuple[int]]: # raise NotImplementedError
40.017857
114
0.545292
266
2,241
4.43985
0.300752
0.083827
0.040644
0.025402
0.130398
0.130398
0.130398
0.081287
0.081287
0.081287
0
0.005487
0.349398
2,241
55
115
40.745455
0.804527
0.703257
0
0
0
0
0
0
0
0
0
0.018182
0
1
0.222222
false
0
0.333333
0.111111
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
1
1
1
0
0
5
fad733a619c4fe340c9c4de189e41b3549c6b4df
1,310
py
Python
test_movies.py
ppai22/knn_movie_recommender
64bfda2dbb826c61db400976aae646e72b5dab3f
[ "MIT" ]
5
2021-06-14T10:05:01.000Z
2022-01-10T12:28:16.000Z
test_movies.py
ppai22/knn_movie_recommender
64bfda2dbb826c61db400976aae646e72b5dab3f
[ "MIT" ]
3
2021-06-08T21:56:09.000Z
2022-03-12T00:38:52.000Z
test_movies.py
ppai22/knn_movie_recommender
64bfda2dbb826c61db400976aae646e72b5dab3f
[ "MIT" ]
1
2020-07-09T04:34:47.000Z
2020-07-09T04:34:47.000Z
''' Template to create a movie test data by yourself: ['Action', 'Adventure', 'Animation', 'Biography', 'Comedy', 'Crime', 'Documentary', 'Drama', 'Family', 'Fantasy', 'Film-Noir', 'Game-Show', 'History', 'Horror', 'Music', 'Musical', 'Mystery', 'News', 'Reality-TV', 'Romance', 'Sci-Fi', 'Short', 'Sport', 'Thriller', 'War', 'Western', IMDb SCORE] Generate a list in the above format by replacing the respective genre of the movie with 1 and 0 if it isn't and add the IMDb score at the end ''' AVENGERS_INFINITY_WAR = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 8.5] JOKER = [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8.7] FORD_V_FERRARI = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.3] SW_THE_FORCE_AWAKENS = [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.9] MI_FALLOUT = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 7.8] THE_GREAT_HACK = [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.0] THE_NUN = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 5.7] RALPH_BREAKS_THE_INTERNET = [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.1]
65.5
113
0.514504
318
1,310
2.075472
0.264151
0.49697
0.659091
0.793939
0.319697
0.319697
0.316667
0.30303
0.30303
0.284848
0
0.224652
0.232061
1,310
19
114
68.947368
0.431412
0.372519
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
1
1
1
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
5
fae2f0f473e63b57ec02453f3e56697080af9066
449
py
Python
SatPlot/rotate.py
lff5985/share-from-zhao
b1a6e3513db10e6da18ed6884d4fab9fb68e51b4
[ "MIT" ]
2
2018-06-13T02:27:22.000Z
2020-12-27T09:55:50.000Z
SatPlot/rotate.py
lff5985/share-from-zhao
b1a6e3513db10e6da18ed6884d4fab9fb68e51b4
[ "MIT" ]
null
null
null
SatPlot/rotate.py
lff5985/share-from-zhao
b1a6e3513db10e6da18ed6884d4fab9fb68e51b4
[ "MIT" ]
2
2016-11-09T14:06:30.000Z
2019-06-01T02:46:15.000Z
# -*- coding: utf-8 -*- import math import numpy as np test = np.mat(np.zeros((3,3))) def R1(omega): return np.mat([[1,0,0],[0,math.cos(omega),math.sin(omega)],[0,-1*math.sin(omega),math.cos(omega)]]) def R2(omega): return np.mat([[math.cos(omega),0,-1*math.sin(omega)],[0,1,0],[math.sin(omega),0,math.cos(omega)]]) def R3(omega): return np.mat([[math.cos(omega),math.sin(omega),0],[-1*math.sin(omega),math.cos(omega),0],[0,0,1]])
26.411765
103
0.619154
88
449
3.159091
0.25
0.151079
0.258993
0.18705
0.57554
0.568345
0.517986
0.359712
0.359712
0.359712
0
0.059259
0.097996
449
16
104
28.0625
0.62716
0.046771
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.222222
0.333333
0.888889
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
fae842c7765866ed9a9d6ae6dd62df4a17849e0c
27,854
py
Python
tasks/drug_run.py
dmis-lab/ReSimNet
3c5832dccba525451ed019afb66b829b055a2be1
[ "Apache-2.0" ]
34
2019-02-11T04:48:06.000Z
2021-11-30T13:16:39.000Z
tasks/drug_run.py
dmis-lab/ReSimNet
3c5832dccba525451ed019afb66b829b055a2be1
[ "Apache-2.0" ]
1
2019-09-13T21:31:53.000Z
2019-12-12T00:10:56.000Z
tasks/drug_run.py
dmis-lab/ReSimNet
3c5832dccba525451ed019afb66b829b055a2be1
[ "Apache-2.0" ]
11
2019-02-13T03:56:39.000Z
2022-03-11T02:25:20.000Z
import sys import pickle import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import logging import csv import os import pandas as pd from scipy.stats import pearsonr from sklearn.metrics import precision_score, roc_auc_score from datetime import datetime from torch.autograd import Variable from models.root.utils import * LOGGER = logging.getLogger(__name__) def prob_to_class(prob): return np.array([float(p >= 0.5) for p in prob]) def run_bi(model, loader, dataset, args, metric, train=False): total_step = 0.0 stats = {'loss':[]} tar_set = [] pred_set = [] kk_tar_set = [] kk_pred_set = [] ku_tar_set = [] ku_pred_set = [] uu_tar_set = [] uu_pred_set = [] start_time = datetime.now() for d_idx, (d1, d1_r, d1_l, d2, d2_r, d2_l, score) in enumerate(loader): # Split for KK/KU/UU sets kk_idx = np.argwhere([a in dataset.known and b in dataset.known for a, b in zip(d1, d2)]).flatten() ku_idx = np.argwhere([(a in dataset.known) != (b in dataset.known) for a, b in zip(d1, d2)]).flatten() uu_idx = np.argwhere([a not in dataset.known and b not in dataset.known for a, b in zip(d1, d2)]).flatten() assert len(kk_idx) + len(ku_idx) + len(uu_idx) == len(d1) # Grad zero + mode change model.optimizer.zero_grad() if train: model.train(train) else: model.eval() # Get outputs outputs, embed1, embed2 = model(d1_r.cuda(), d1_l, d2_r.cuda(), d2_l, None, None) loss = model.get_loss(outputs, score.cuda()) stats['loss'] += [loss.data[0]] total_step += 1.0 # Metrics for binary classification tmp_tar = score.data.cpu().numpy() tmp_pred = outputs.data.cpu().numpy() # tmp_pred = np.array([float(p >= 0.5) for p in tmp_pred[:]]) # print(tmp_tar[:5], tmp_pred[:5]) # Accumulate for final evaluation tar_set += list(tmp_tar[:]) pred_set += list(tmp_pred[:]) kk_tar_set += list(tmp_tar[kk_idx]) kk_pred_set += list(tmp_pred[kk_idx]) ku_tar_set += list(tmp_tar[ku_idx]) ku_pred_set += list(tmp_pred[ku_idx]) uu_tar_set += list(tmp_tar[uu_idx]) uu_pred_set += list(tmp_pred[uu_idx]) # Calculate current f1 scores f1 = metric(list(tmp_tar[:]), list(prob_to_class(tmp_pred[:]))) f1_kk = metric(list(tmp_tar[kk_idx]), list(prob_to_class(tmp_pred[kk_idx]))) f1_ku = metric(list(tmp_tar[ku_idx]), list(prob_to_class(tmp_pred[ku_idx]))) f1_uu = metric(list(tmp_tar[uu_idx]), list(prob_to_class(tmp_pred[uu_idx]))) # For binary classification, report f1 _, _, f1, _ = f1 _, _, f1_kk, _ = f1_kk _, _, f1_ku, _ = f1_ku _, _, f1_uu, _ = f1_uu # Optimize model if train and not args.save_embed: loss.backward() nn.utils.clip_grad_norm(model.get_model_params()[1], args.grad_max_norm) model.optimizer.step() # Print for print step or at last if d_idx % args.print_step == 0 or d_idx == (len(loader) - 1): et = int((datetime.now() - start_time).total_seconds()) _progress = ( '{}/{} | Loss: {:.3f} | Total F1: {:.3f} | '.format( d_idx + 1, len(loader), loss.data[0], f1) + 'KK: {:.3f} KU: {:.3f} UU: {:.3f} | '.format( f1_kk, f1_ku, f1_uu) + '{:2d}:{:2d}:{:2d}'.format( et//3600, et%3600//60, et%60)) LOGGER.debug(_progress) if args.top_only: # if False: tar_sets = [tar_set, kk_tar_set, ku_tar_set, uu_tar_set] pred_sets = [pred_set, kk_pred_set, ku_pred_set, uu_pred_set] messages = ['Total', 'KK', 'KU', 'UU'] top_criterion = 0.10 top_k = 100 for tar, pred, msg in zip(tar_sets, pred_sets, messages): sorted_target = sorted(tar[:], reverse=True) # top_cut = sorted_target[int(len(sorted_target) * top_criterion)] top_cut = 0.9 sorted_pred, my_target = (list(t) for t in zip(*sorted( zip(pred[:], tar[:]), reverse=True))) precision = sum(k >= top_cut for k in my_target[:top_k]) / top_k LOGGER.info('{} cut: {:.3f}, P@{}: {:.2f}, '.format( msg, top_cut, top_k, precision) + 'Pred Mean@100: {:.3f}, Tar Mean@100: {:.3f}'.format( sum(sorted_pred[:top_k])/top_k, sum(my_target[:top_k])/top_k)) def sort_and_slice(list1, list2): list2, list1 = (list(t) for t in zip(*sorted( zip(list2, list1), reverse=True))) list1 = list1[:len(list1)//100] + list1[-len(list1)//100:] # list1 = list1[-len(list1)//100:] list2 = list2[:len(list2)//100] + list2[-len(list2)//100:] # list2 = list2[-len(list2)//100:] assert len(list1) == len(list2) return list1, list2 if args.top_only: # if False: tar_set, pred_set = sort_and_slice(tar_set, pred_set) kk_tar_set, kk_pred_set = sort_and_slice(kk_tar_set, kk_pred_set) ku_tar_set, ku_pred_set = sort_and_slice(ku_tar_set, ku_pred_set) uu_tar_set, uu_pred_set = sort_and_slice(uu_tar_set, uu_pred_set) # Calculate acuumulated f1 scores f1 = metric(tar_set, prob_to_class(pred_set)) f1_kk = metric(kk_tar_set, prob_to_class(kk_pred_set)) f1_ku = metric(ku_tar_set, prob_to_class(ku_pred_set)) f1_uu = metric(uu_tar_set, prob_to_class(uu_pred_set)) pr, rc, f1, _ = f1 pr_kk, rc_kk, f1_kk, _ = f1_kk pr_ku, rc_ku, f1_ku, _ = f1_ku pr_uu, rc_uu, f1_uu, _ = f1_uu # TODO add spearman correlation # End of an epoch et = (datetime.now() - start_time).total_seconds() LOGGER.info('Results (Loss/F1/KK/KU/UU): {:.3f}\t'.format( sum(stats['loss'])/len(stats['loss'])) + '[{:.3f}\t{:.3f}\t{:.3f}]\t[{:.3f}\t{:.3f}\t{:.3f}]\t'.format( pr, rc, f1, pr_kk, rc_kk, f1_kk) + '[{:.3f}\t{:.3f}\t{:.3f}]\t[{:.3f}\t{:.3f}\t{:.3f}]\t'.format( pr_ku, rc_ku, f1_ku, pr_uu, rc_uu, f1_uu) + 'count: {}/{}/{}/{}'.format( len(pred_set), len(kk_pred_set), len(ku_pred_set), len(uu_pred_set))) return f1_ku def element(d): return [d[k] for k in range(0,len(d))] def run_reg(model, loader, dataset, args, metric, train=False): total_step = 0.0 stats = {'loss':[]} tar_set = [] pred_set = [] kk_tar_set = [] kk_pred_set = [] ku_tar_set = [] ku_pred_set = [] uu_tar_set = [] uu_pred_set = [] start_time = datetime.now() for d_idx, d in enumerate(loader): if args.rep_idx == 4: d1, d1_r, d1_a, d1_l, d2, d2_r, d2_a, d2_l, score = element(d) else: d1, d1_r, d1_l, d2, d2_r, d2_l, score = element(d) # Split for KK/KU/UU sets kk_idx = np.argwhere([a in dataset.known and b in dataset.known for a, b in zip(d1, d2)]).flatten() ku_idx = np.argwhere([(a in dataset.known) != (b in dataset.known) for a, b in zip(d1, d2)]).flatten() uu_idx = np.argwhere([a not in dataset.known and b not in dataset.known for a, b in zip(d1, d2)]).flatten() assert len(kk_idx) + len(ku_idx) + len(uu_idx) == len(d1) # Grad zero + mode change model.optimizer.zero_grad() if train: model.train(train) else: model.eval() # Get outputs if args.rep_idx == 4: outputs, embed1, embed2 = model(d1_r.cuda(), d1_l, d2_r.cuda(), d2_r, d1_a.cuda(), d2_a.cuda()) else: outputs, embed1, embed2 = model(d1_r.cuda(), d1_l, d2_r.cuda(), d2_l, None, None) loss = model.get_loss(outputs, score.cuda()) stats['loss'] += [loss.data[0]] total_step += 1.0 # Metrics for regression tmp_tar = score.data.cpu().numpy() tmp_pred = outputs.data.cpu().numpy() # print(tmp_tar[:10]) # Accumulate for final evaluation tar_set += list(tmp_tar[:]) pred_set += list(tmp_pred[:]) kk_tar_set += list(tmp_tar[kk_idx]) kk_pred_set += list(tmp_pred[kk_idx]) ku_tar_set += list(tmp_tar[ku_idx]) ku_pred_set += list(tmp_pred[ku_idx]) uu_tar_set += list(tmp_tar[uu_idx]) uu_pred_set += list(tmp_pred[uu_idx]) # Calculate current f1 scores f1 = metric(list(tmp_tar[:]), list(tmp_pred[:])) f1_kk = metric(list(tmp_tar[kk_idx]), list(tmp_pred[kk_idx])) f1_ku = metric(list(tmp_tar[ku_idx]), list(tmp_pred[ku_idx])) f1_uu = metric(list(tmp_tar[uu_idx]), list(tmp_pred[uu_idx])) f1 = f1[0][1] f1_kk = f1_kk[0][1] f1_ku = f1_ku[0][1] f1_uu = f1_uu[0][1] # Optimize model if train and not args.save_embed: loss.backward() nn.utils.clip_grad_norm(model.get_model_params()[1], args.grad_max_norm) model.optimizer.step() # Print for print step or at last if d_idx % args.print_step == 0 or d_idx == (len(loader) - 1): et = int((datetime.now() - start_time).total_seconds()) _progress = ( '{}/{} | Loss: {:.3f} | Total Corr: {:.3f} | '.format( d_idx + 1, len(loader), loss.data[0], f1) + 'KK: {:.3f} KU: {:.3f} UU: {:.3f} | '.format( f1_kk, f1_ku, f1_uu) + '{:2d}:{:2d}:{:2d}'.format( et//3600, et%3600//60, et%60)) LOGGER.debug(_progress) # if args.top_only: # # if False: # tar_sets = [tar_set, kk_tar_set, ku_tar_set, uu_tar_set] # pred_sets = [pred_set, kk_pred_set, ku_pred_set, uu_pred_set] # messages = ['Total', 'KK', 'KU', 'UU'] # top_criterion = 0.10 # top_k = 100 # # for tar, pred, msg in zip(tar_sets, pred_sets, messages): # sorted_target = sorted(tar[:], reverse=True) # # top_cut = sorted_target[int(len(sorted_target) * top_criterion)] # top_cut = 0.9 # # sorted_pred, my_target = (list(t) for t in zip(*sorted( # zip(pred[:], tar[:]), reverse=True))) # precision = sum(k >= top_cut for k in my_target[:top_k]) / top_k # LOGGER.info('{} cut: {:.3f}, P@{}: {:.2f}, '.format( # msg, top_cut, top_k, precision) + # 'Pred Mean@100: {:.3f}, Tar Mean@100: {:.3f}'.format( # sum(sorted_pred[:top_k])/top_k, # sum(my_target[:top_k])/top_k)) # # def sort_and_slice(list1, list2): # list2, list1 = (list(t) for t in zip(*sorted( # zip(list2, list1), reverse=True))) # list1 = list1[:len(list1)//100] + list1[-len(list1)//100:] # # list1 = list1[-len(list1)//100:] # list2 = list2[:len(list2)//100] + list2[-len(list2)//100:] # # list2 = list2[-len(list2)//100:] # assert len(list1) == len(list2) # return list1, list2 # # if args.top_only: # # if False: # tar_set, pred_set = sort_and_slice(tar_set, pred_set) # kk_tar_set, kk_pred_set = sort_and_slice(kk_tar_set, kk_pred_set) # ku_tar_set, ku_pred_set = sort_and_slice(ku_tar_set, ku_pred_set) # uu_tar_set, uu_pred_set = sort_and_slice(uu_tar_set, uu_pred_set) # Calculate acuumulated f1 scores f1 = metric(tar_set, pred_set) f1_kk = metric(kk_tar_set, kk_pred_set) f1_ku = metric(ku_tar_set, ku_pred_set) f1_uu = metric(uu_tar_set, uu_pred_set) # Trun into correlation f1 = f1[0][1] f1_kk = f1_kk[0][1] f1_ku = f1_ku[0][1] f1_uu = f1_uu[0][1] # End of an epoch et = (datetime.now() - start_time).total_seconds() LOGGER.info('Results (Loss/F1/KK/KU/UU): {:.4f}\t'.format( sum(stats['loss'])/len(stats['loss'])) + '[{:.4f}\t{:.4f}\t{:.4f}\t{:.4f}] '.format( f1, f1_kk, f1_ku, f1_uu) + 'count: {}/{}/{}/{}'.format( len(pred_set), len(kk_pred_set), len(ku_pred_set), len(uu_pred_set))) corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5 = evaluation(pred_set, tar_set) LOGGER.info('[TOTAL\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}] '.format( corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5)) corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5 = evaluation(kk_pred_set, kk_tar_set) LOGGER.info('[KK\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}] '.format( corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5)) corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5 = evaluation(ku_pred_set, ku_tar_set) LOGGER.info('[KU\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}] '.format( corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5)) corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5 = evaluation(uu_pred_set, uu_tar_set) LOGGER.info('[UU\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}] '.format( corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5)) return f1_ku def precision_at_k(y_pred, y_true, k): list_of_tuple = [(x, y) for x, y in zip(y_pred, y_true)] sorted_list_of_tuple = sorted(list_of_tuple, key=lambda tup: tup[0], reverse=True) topk = sorted_list_of_tuple[:int(len(sorted_list_of_tuple) * k)] topk_true = [x[1] for x in topk] topk_pred = [x[0] for x in topk] #print(topk) #print(topk_true) #print(topk_pred) precisionk = precision_score([1 if x > 0.9 else 0 for x in topk_true], [1 if x > -1.0 else 0 for x in topk_pred], labels=[0,1], pos_label=1) # print([1 if x > 90.0 else 0 for x in topk_true]) # print([1 if x > 90.0 else 0 for x in topk_pred]) # print(precisionk) return precisionk def mse_at_k(y_pred, y_true, k): list_of_tuple = [(x, y) for x, y in zip(y_pred, y_true)] sorted_list_of_tuple = sorted(list_of_tuple, key=lambda tup: tup[0], reverse=True) topk = sorted_list_of_tuple[:int(len(sorted_list_of_tuple) * k)] topk_true = [x[1] for x in topk] topk_pred = [x[0] for x in topk] msek = np.square(np.subtract(topk_pred, topk_true)).mean() return msek def evaluation(y_pred, y_true): # print(y_pred) # print(y_true) # print(pearsonr(np.ravel(y_pred), y_true)) corr = pearsonr(np.ravel(y_pred), y_true)[0] # mse = np.square(np.subtract(y_pred, y_true)).mean() msetotal = mse_at_k(y_pred, y_true, 1.0) mse1 = mse_at_k(y_pred, y_true, 0.01) mse2 = mse_at_k(y_pred, y_true, 0.02) mse5 = mse_at_k(y_pred, y_true, 0.05) auroc = float('nan') if len([x for x in y_true if x > 0.9]) > 0: auroc = roc_auc_score([1 if x > 0.9 else 0 for x in y_true], y_pred) precision1 = precision_at_k(y_pred, y_true, 0.01) precision2 = precision_at_k(y_pred, y_true, 0.02) precision5 = precision_at_k(y_pred, y_true, 0.05) #print(auroc, precision1, precision2, precision5) return (corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5) # Outputs response embeddings for a given dictionary def save_embed(model, dictionary, dataset, args, drug_file): model.eval() key2vec = {} known_cnt = 0 # Iterate drug dictionary for idx, item in enumerate(dictionary.items()): drug, rep = [item[k] for k in range(0,len(item))] if args.embed_d == 1: d1_r = rep[args.rep_idx] d1_k = drug in dataset.known d1_l = len(d1_r) else: d1_r = rep[0] d1_k = rep[1] d1_l = len(d1_r) # For string data (smiles/inchikey) if args.rep_idx == 0 or args.rep_idx == 1: d1_r = list(map(lambda x: dataset.char2idx[x] if x in dataset.char2idx else dataset.char2idx[dataset.UNK], d1_r)) d1_l = len(d1_r) # Real valued for mol2vec if args.rep_idx != 3: d1_r = Variable(torch.LongTensor(d1_r)).cuda() else: d1_r = Variable(torch.FloatTensor(d1_r)).cuda() d1_l = torch.LongTensor(np.array([d1_l])) d1_r = d1_r.unsqueeze(0) d1_l = d1_l.unsqueeze(0) # Run model amd save embed _, embed1, embed2 = model(d1_r, d1_l, d1_r, d1_l, None, None) assert embed1.data.tolist() == embed2.data.tolist() """ known = False for pert_id, _ in dataset.drugs.items(): if drug == pert_id: known = True known_cnt += 1 break """ key2vec[drug] = [embed1.squeeze().data.tolist(), d1_k] # Print progress if idx % args.print_step == 0 or idx == len(dictionary) - 1: _progress = '{}/{} saving drug embeddings..'.format( idx + 1, len(dictionary)) LOGGER.info(_progress) # Save embed as pickle pickle.dump(key2vec, open('{}/embed/{}.{}.pkl'.format( args.checkpoint_dir, drug_file, args.model_name), 'wb'), protocol=2) LOGGER.info('{}/{} number of known drugs.'.format(known_cnt, len(key2vec))) # Outputs pred vs label scores given a dataloader def save_prediction(model, loader, dataset, args): model.eval() csv_writer = csv.writer(open(args.checkpoint_dir + 'pred_' + args.model_name + '.csv', 'w')) csv_writer.writerow(['pert1', 'pert1_known', 'pert2', 'pert2_known', 'prediction', 'target']) for d_idx, (d1, d1_r, d1_l, d2, d2_r, d2_l, score) in enumerate(loader): # Run model for getting predictions outputs, _, _ = model(d1_r.cuda(), d1_l, d2_r.cuda(), d2_l, None, None) predictions = outputs.data.cpu().numpy() targets = score.data.tolist() for a1, a2, a3, a4 in zip(d1, d2, predictions, targets): csv_writer.writerow([a1, a1 in dataset.known, a2, a2 in dataset.known, a3, a4]) # Print progress if d_idx % args.print_step == 0 or d_idx == len(loader) - 1: _progress = '{}/{} saving drug predictions..'.format( d_idx + 1, len(loader)) LOGGER.info(_progress) # Outputs pred vs label scores given a dataloader def perform_ensemble(model, loader, dataset, args): model.eval() tar_set = [] pred_set = [] kk_tar_set = [] kk_pred_set = [] ku_tar_set = [] ku_pred_set = [] uu_tar_set = [] uu_pred_set = [] for d_idx, (d1, d1_r, d1_l, d2, d2_r, d2_l, score) in enumerate(loader): # Run model for getting predictions outputs, _, _ = model(d1_r.cuda(), d1_l, d2_r.cuda(), d2_l, None, None) # Split for KK/KU/UU sets kk_idx = np.argwhere([a in dataset.known and b in dataset.known for a, b in zip(d1, d2)]).flatten() ku_idx = np.argwhere([(a in dataset.known) != (b in dataset.known) for a, b in zip(d1, d2)]).flatten() uu_idx = np.argwhere([a not in dataset.known and b not in dataset.known for a, b in zip(d1, d2)]).flatten() assert len(kk_idx) + len(ku_idx) + len(uu_idx) == len(d1) # Metrics for regression tmp_tar = score.data.cpu().numpy() tmp_pred = outputs.data.cpu().numpy() # Accumulate for final evaluation tar_set += list(tmp_tar[:]) pred_set += list(tmp_pred[:]) kk_tar_set += list(tmp_tar[kk_idx]) kk_pred_set += list(tmp_pred[kk_idx]) ku_tar_set += list(tmp_tar[ku_idx]) ku_pred_set += list(tmp_pred[ku_idx]) uu_tar_set += list(tmp_tar[uu_idx]) uu_pred_set += list(tmp_pred[uu_idx]) corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5 = evaluation(pred_set, tar_set) print('[TOTAL\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}] '.format( corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5)) corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5 = evaluation(kk_pred_set, kk_tar_set) print('[KK\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}] '.format( corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5)) corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5 = evaluation(ku_pred_set, ku_tar_set) print('[KU\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}] '.format( corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5)) corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5 = evaluation(uu_pred_set, uu_tar_set) print('[UU\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}\t{:.5f}] '.format( corr, msetotal, mse1, mse2, mse5, auroc, precision1, precision2, precision5)) return pred_set, tar_set, kk_pred_set, kk_tar_set, ku_pred_set, ku_tar_set, uu_pred_set, uu_tar_set # Outputs pred scores for new pair dataset def save_pair_score(model, pair_dir, fp_dir, dataset, args): model.eval() drug2rep = pickle.load(open(fp_dir, 'rb')) folder_name = args.checkpoint_dir + 'save_pair_score/' if not os.path.exists(folder_name): os.makedirs(folder_name) for subdir, _, files in os.walk(pair_dir): for file_ in sorted(files): df = pd.read_csv(os.path.join(subdir, file_), sep=",") #print(df) LOGGER.info('save_pair_score processing {}...'.format(file_)) csv_writer = csv.writer(open(folder_name + file_ + '_' + args.model_name + '.csv', 'w')) csv_writer.writerow(['drug1', 'drug2', 'prediction', 'jaccard']) batch = [] for row_idx, row in df.iterrows(): drug1 = row['id1'] drug1_r = drug2rep[drug1][0] drug1_r = [float(value) for value in list(drug1_r)] drug2 = row['id2'] drug2_r = drug2rep[drug2][0] drug2_r = [float(value) for value in list(drug2_r)] example = [drug1, drug1_r, len(drug1_r), drug2, drug2_r, len(drug2_r), 0] batch.append(example) if len(batch) == 1024: inputs = dataset.collate_fn(batch) outputs, _, _ = model(inputs[1].cuda(), inputs[2], inputs[4].cuda(), inputs[5], None, None) predictions = outputs.data.cpu().numpy() for example, pred in zip(batch, predictions): from scipy.spatial import distance def jaccard(a, b): return 1-distance.jaccard(a, b) jac = jaccard(example[1], example[4]) csv_writer.writerow([example[0], example[3], pred, jac]) print(example[0], example[3], pred, jac) batch = [] # Print progress if row_idx % 5000 == 0 or row_idx == len(df) - 1: _progress = '{}/{} saving unknwon predictions..'.format( row_idx + 1, len(df)) LOGGER.info(_progress) if len(batch) > 0: inputs = dataset.collate_fn(batch) outputs, _, _ = model(inputs[1].cuda(), inputs[2], inputs[4].cuda(), inputs[5], None, None) predictions = outputs.data.cpu().numpy() for example, pred in zip(batch, predictions): from scipy.spatial import distance def jaccard(a, b): return 1-distance.jaccard(a, b) jac = jaccard(example[1], example[4]) csv_writer.writerow([example[0], example[3], pred, jac]) def save_pair_score_for_zinc(model, pair_dir, example_dir, dataset, args): print("\n=============================================================") print("SAVE PAIR SCORE FOR ZINC") print("=============================================================") model.eval() df_example = pd.read_csv(example_dir, sep=",") print(df_example) folder_name = args.checkpoint_dir + 'save_pair_score_for_zinc/' if not os.path.exists(folder_name): os.makedirs(folder_name) for subdir, _, files in os.walk(pair_dir): for file_ in sorted(files): df_zinc = pd.read_csv(os.path.join(subdir, file_), sep=",") LOGGER.info('save_pair_score processing {}...'.format(file_)) csv_writer = csv.writer(open(folder_name + file_ + '_' + args.model_name + '.csv', 'w')) csv_writer.writerow(['pair1', 'pair2', 'prediction']) batch = [] for row_idx, row in df_zinc.iterrows(): drug1 = row['zinc_id'] drug1_r = row['fingerprint'] drug1_r = [float(value) for value in list(drug1_r)] for row_idex, row in df_example.iterrows(): try: drug2 = row['pair'] drug2_r =row['fp'] drug2_r = [float(value) for value in list(drug2_r)] #print(drug1, drug1_r, len(drug1_r), drug2, drug2_r, len(drug2_r)) example = [drug1, drug1_r, len(drug1_r), drug2, drug2_r, len(drug2_r), 0] batch.append(example) except KeyError: continue if len(batch) == 4096: inputs = dataset.collate_fn(batch) outputs, _, _ = model(inputs[1].cuda(), inputs[2], inputs[4].cuda(), inputs[5], None, None) predictions = outputs.data.cpu().numpy() for example, pred in zip(batch, predictions): if pred > 0.9: csv_writer.writerow([example[0], example[3], pred]) batch = [] # Print progress if row_idx % 1000 == 0 or row_idx == len(df_zinc) - 1: _progress = '{}/{} saving zinc predictions..'.format( row_idx + 1, len(df_zinc)) LOGGER.info(_progress) if len(batch) > 0: inputs = dataset.collate_fn(batch) outputs, _, _ = model(inputs[1].cuda(), inputs[2], inputs[4].cuda(), inputs[5], None, None) predictions = outputs.data.cpu().numpy() for example, pred in zip(batch, predictions): if pred > 0.9: csv_writer.writerow([example[0], example[3], pred])
41.387816
117
0.549113
3,937
27,854
3.655321
0.082042
0.036968
0.017789
0.026683
0.798138
0.774512
0.753179
0.730943
0.704399
0.677229
0
0.041274
0.299777
27,854
672
118
41.449405
0.696575
0.122604
0
0.567033
0
0.021978
0.072722
0.037252
0
0
0
0.001488
0.010989
1
0.032967
false
0
0.03956
0.008791
0.096703
0.030769
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
4f07b683641f3a475d235b06ba42cb2586fe0495
294
py
Python
reqon/deprecated/exceptions.py
dmpayton/reqlon
69ea152acaed1bf4d5a6219e23e8af46f77fb9ee
[ "MIT" ]
null
null
null
reqon/deprecated/exceptions.py
dmpayton/reqlon
69ea152acaed1bf4d5a6219e23e8af46f77fb9ee
[ "MIT" ]
null
null
null
reqon/deprecated/exceptions.py
dmpayton/reqlon
69ea152acaed1bf4d5a6219e23e8af46f77fb9ee
[ "MIT" ]
null
null
null
class ReqonError(Exception): pass class InvalidTypeError(ReqonError): def __init__(self, message): super(InvalidTypeError, self).__init__(message) class InvalidFilterError(ReqonError): def __init__(self, message): super(InvalidFilterError, self).__init__(message)
26.727273
57
0.741497
28
294
7.214286
0.392857
0.128713
0.168317
0.207921
0.326733
0.326733
0
0
0
0
0
0
0.159864
294
10
58
29.4
0.817814
0
0
0.25
0
0
0
0
0
0
0
0
0
1
0.25
false
0.125
0
0
0.625
0
1
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
1
0
0
1
0
0
5
4f0d1e75b9aab327e0827668e0b5854852bd449e
190
py
Python
Logic-2/round_sum.py
VivekM27/Coding-Bat-Python-Solutions
14d5c6ccaa2129e56a5898374dec60740fe6761b
[ "Apache-2.0" ]
null
null
null
Logic-2/round_sum.py
VivekM27/Coding-Bat-Python-Solutions
14d5c6ccaa2129e56a5898374dec60740fe6761b
[ "Apache-2.0" ]
null
null
null
Logic-2/round_sum.py
VivekM27/Coding-Bat-Python-Solutions
14d5c6ccaa2129e56a5898374dec60740fe6761b
[ "Apache-2.0" ]
null
null
null
# ROUND_SUM def round_sum(a, b, c): return round10(a) + round10(b) + round10(c) def round10(n): if n%10>4: n/=10 return (n+1) * 10 else: n/=10 return n * 10
17.272727
46
0.526316
34
190
2.882353
0.411765
0.122449
0.183673
0.204082
0
0
0
0
0
0
0
0.153846
0.315789
190
11
47
17.272727
0.6
0.047368
0
0.222222
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0
0.111111
0.555556
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
87a35a2c0b2d2d58e6d524f426b519a035ab8736
181
py
Python
Python/sound2_working.py
GuruprasadaShridharHegde/Coder-Mansion
14529a6d5d4e674ecaf0c771e9cc428ba34b0a2d
[ "MIT" ]
1
2022-01-19T04:22:21.000Z
2022-01-19T04:22:21.000Z
Python/sound2_working.py
GuruprasadaShridharHegde/Coder-Mansion
14529a6d5d4e674ecaf0c771e9cc428ba34b0a2d
[ "MIT" ]
null
null
null
Python/sound2_working.py
GuruprasadaShridharHegde/Coder-Mansion
14529a6d5d4e674ecaf0c771e9cc428ba34b0a2d
[ "MIT" ]
null
null
null
import pygame pygame.mixer.init() pygame.mixer.music.load("01.mp3") pygame.mixer.music.set_volume(0.1) pygame.mixer.music.play() while pygame.mixer.music.get_busy() == True: pass
20.111111
44
0.756906
30
181
4.5
0.6
0.407407
0.474074
0
0
0
0
0
0
0
0
0.029762
0.071823
181
9
45
20.111111
0.77381
0
0
0
0
0
0.032967
0
0
0
0
0
0
1
0
true
0.142857
0.142857
0
0.142857
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
87b645275ee25983627f1b5874236433ee6031d1
98
py
Python
CstrikeRCON/__init__.py
beatmasta/counter-strike-rcon
e08a0c63f5760ae3faf044fddd14733905df67f8
[ "MIT" ]
7
2016-01-08T16:30:39.000Z
2019-12-25T19:33:33.000Z
CstrikeRCON/__init__.py
beatmasta/counter-strike-rcon
e08a0c63f5760ae3faf044fddd14733905df67f8
[ "MIT" ]
3
2016-03-21T07:30:36.000Z
2020-11-08T09:07:34.000Z
CstrikeRCON/__init__.py
beatmasta/counter-strike-rcon
e08a0c63f5760ae3faf044fddd14733905df67f8
[ "MIT" ]
6
2015-03-11T16:11:24.000Z
2022-03-08T01:28:49.000Z
""" initializate CstrikeRCON as a module to be imported by third parties """ import CstrikeRCON
16.333333
37
0.765306
13
98
5.769231
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.173469
98
5
38
19.6
0.925926
0.693878
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
87f7b04845579e835125f0960461bb06963e2326
255
py
Python
src/backbones/__init__.py
Light4Code/tensorflow-research
392c2d7bc376f491fec68d479b130f883d6d028d
[ "MIT" ]
5
2020-02-29T16:28:55.000Z
2021-11-24T07:47:36.000Z
src/backbones/__init__.py
octumcore/tensorflow-research
ebb8e8243889f55affa354c49eb54db4fbcd2c87
[ "MIT" ]
3
2020-11-13T18:41:57.000Z
2022-02-10T01:37:51.000Z
src/backbones/__init__.py
octumcore/tensorflow-research
ebb8e8243889f55affa354c49eb54db4fbcd2c87
[ "MIT" ]
4
2020-03-24T10:50:17.000Z
2020-06-02T13:07:28.000Z
from .auto_encoder.auto_encoder_conv import AutoEncoderConv from .auto_encoder.auto_encoder_full_connected import AutoEncoderFullConnected from .base_backbone import BaseBackbone from .segmentation.segmentation_vanilla_unet import SegmentationVanillaUnet
51
78
0.909804
29
255
7.655172
0.551724
0.198198
0.135135
0.171171
0.234234
0
0
0
0
0
0
0
0.062745
255
4
79
63.75
0.92887
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
358a7752ebed3be02f8d75821efa8c24285c62b9
140
py
Python
videoanalyst/model/loss/loss_base.py
JIANG-CX/data_labeling
8d2470bbb537dfc09ed2f7027ed8ee7de6447248
[ "MIT" ]
1
2021-05-24T10:08:51.000Z
2021-05-24T10:08:51.000Z
videoanalyst/model/loss/loss_base.py
JIANG-CX/data_labeling
8d2470bbb537dfc09ed2f7027ed8ee7de6447248
[ "MIT" ]
null
null
null
videoanalyst/model/loss/loss_base.py
JIANG-CX/data_labeling
8d2470bbb537dfc09ed2f7027ed8ee7de6447248
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -* from videoanalyst.utils import Registry TRACK_LOSSES = Registry('TRACK_LOSSES') VOS_LOSSES = Registry('VOS_LOSSES')
23.333333
39
0.75
18
140
5.611111
0.611111
0.257426
0.376238
0
0
0
0
0
0
0
0
0.008065
0.114286
140
5
40
28
0.806452
0.142857
0
0
0
0
0.186441
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
35b346991eddf3a9453a6350619849c22ddc0ff6
102
py
Python
modules/2.79/bpy/types/CompositorNodeBrightContrast.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
modules/2.79/bpy/types/CompositorNodeBrightContrast.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
modules/2.79/bpy/types/CompositorNodeBrightContrast.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
class CompositorNodeBrightContrast: use_premultiply = None def update(self): pass
11.333333
35
0.676471
9
102
7.555556
1
0
0
0
0
0
0
0
0
0
0
0
0.27451
102
8
36
12.75
0.918919
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.25
0
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
5
ea0e16b542da114d42d07b1f242d7e46bf6f4f87
17,087
py
Python
guppy/heapy/pbhelp.py
EhsanKia/guppy3
87bb2e5b9e3d76c8b1c6698c40fdd395b1ee3cd3
[ "MIT" ]
null
null
null
guppy/heapy/pbhelp.py
EhsanKia/guppy3
87bb2e5b9e3d76c8b1c6698c40fdd395b1ee3cd3
[ "MIT" ]
null
null
null
guppy/heapy/pbhelp.py
EhsanKia/guppy3
87bb2e5b9e3d76c8b1c6698c40fdd395b1ee3cd3
[ "MIT" ]
null
null
null
# AUTOMATICALLY GENERATED BY GENGUPPY about = b'\x80\x03cguppy.gsl.Text\nRecordingInter\nq\x00)\x81q\x01}q\x02(X\x07\x00\x00\x00appendsq\x03]q\x04(K\x00X\x16\x00\x00\x00Heapy Profile Browser\nq\x05K\x01X\x01\x00\x00\x00\tq\x06K\x02X\x07\x00\x00\x00Versionq\x07K\x01h\x06K\x03X\x04\x00\x00\x000.1\nq\x08K\x04h\x06K\x02X\x06\x00\x00\x00Authorq\tK\x04h\x06K\x03X\x10\x00\x00\x00Sverker Nilsson\nq\nK\x04h\x06K\x02X\x05\x00\x00\x00Emailq\x0bK\x04h\x06K\x03X\x0b\x00\x00\x00sn@sncs.se\nq\x0cK\x04h\x06K\x02X\x07\x00\x00\x00Licenseq\rK\x04h\x06K\x03X\x04\x00\x00\x00MIT\nq\x0eK\x05X\x18\x00\x00\x00Copyright (c) 2005--2008q\x0fK\x06X.\x00\x00\x00S. Nilsson Computer System ABLinkoping, Swedenq\x10K\x07X\x01\x00\x00\x00\nq\x11eX\x0b\x00\x00\x00tag_configsq\x12}q\x13(K\x00X\x08\x00\x00\x00spacing1q\x14K\x0b\x86q\x15X\x04\x00\x00\x00fontq\x16X\x05\x00\x00\x00timesq\x17K\x18X\x04\x00\x00\x00boldq\x18\x87q\x19\x86q\x1a\x86q\x1bK\x02h\x15h\x16h\x17K\x0cX\x04\x00\x00\x00boldq\x1c\x87q\x1d\x86q\x1e\x86q\x1fK\x03h\x15h\x16h\x17K\x0c\x86q \x86q!\x86q"K\x01X\x04\x00\x00\x00tabsq#(G@:\x80\x00\x00\x00\x00\x00X\x06\x00\x00\x00centerq$G@O\x80\x00\x00\x00\x00\x00X\x04\x00\x00\x00leftq%tq&\x86q\'h\x15h\x1e\x87q(K\x04h\'h\x14K\x06\x86q)\x86q*K\x05h)h\x16h\x17K\nX\x06\x00\x00\x00italicq+\x87q,\x86q-\x86q.K\x06h)h\x16h\x17K\n\x86q/\x86q0\x86q1K\x07h)h!\x86q2K\x08h!\x85q3uX\n\x00\x00\x00_gsl_titleq4X\x1b\x00\x00\x00About Heapy Profile Browserq5X\x10\x00\x00\x00_gsl_tk_geometryq6X\x07\x00\x00\x00400x200q7ub.' help = b'\x80\x03cguppy.gsl.Text\nRecordingInter\nq\x00)\x81q\x01}q\x02(X\x07\x00\x00\x00appendsq\x03]q\x04(K\x00X\x06\x00\x00\x00Menus\nq\x05K\x01Xr\x00\x00\x00Click on the dotted line at the top of a menu to "tear it off": a separate window containing the menu is created.\nq\x06K\x03X\n\x00\x00\x00File Menu\nq\x07K\x05X\x01\x00\x00\x00\tq\x08K\x06X\x13\x00\x00\x00New Profile Browserq\tK\x05h\x08K\x07X%\x00\x00\x00Create a new browser window with the\nq\nK\x08X\x02\x00\x00\x00\t\tq\x0bK\x07X#\x00\x00\x00same file as the one opened in the\nq\x0cK\x08h\x0bK\x07X\x11\x00\x00\x00current window. \nq\rK\th\x08K\x06X\x0c\x00\x00\x00Open Profileq\x0eK\th\x08K\x07X(\x00\x00\x00Open a profile data file in the current\nq\x0fK\x08h\x0bK\x07X\'\x00\x00\x00window. Data files can be created with\nq\x10K\x08h\x0bK\nX\n\x00\x00\x00Stat.dump q\x11K\x07X\x03\x00\x00\x00. \nq\x12K\th\x08K\x06X\x0c\x00\x00\x00Close Windowq\x13K\th\x08K\x07X(\x00\x00\x00Close the current window (exits from Tk\nq\x14K\x08h\x0bK\x07X%\x00\x00\x00if it was the last browser window). \nq\x15K\th\x08K\x06X\x0b\x00\x00\x00Clear Cacheq\x16K\th\x08K\x07X&\x00\x00\x00Clear the sample cache, releasing its\nq\x17K\x08h\x0bK\x07X\x1a\x00\x00\x00memory. The cache will be\nq\x18K\x08h\x0bK\x07X)\x00\x00\x00automatically filled again when needed. \nq\x19K\x08h\x0bK\x0bX%\x00\x00\x00This command is a kind of temporary /q\x1aK\x07X\x01\x00\x00\x00\nq\x1bK\x08h\x0bK\x0bX\'\x00\x00\x00experimental feature. I think the cacheq\x1cK\x07h\x1bK\x08h\x0bK\x0bX%\x00\x00\x00handling should be made automatic andq\x1dK\x07h\x1bK\x08h\x0bK\x0bX\x17\x00\x00\x00less memory consuming. q\x1eK\x07h\x1bK\x03X\n\x00\x00\x00Pane Menu\nq\x1fK\x0ch\x08K\x06X\x12\x00\x00\x00Show Control Panelq K\x0ch\x08K\x07X\x1d\x00\x00\x00Show the control panel pane.\nq!K\rh\x08K\x06X\n\x00\x00\x00Show Graphq"K\rh\x08K\x07X\x15\x00\x00\x00Show the graph pane.\nq#K\rh\x08K\x06X\n\x00\x00\x00Show Tableq$K\rh\x08K\x07X\x15\x00\x00\x00Show the table pane.\nq%K\x03X\x0b\x00\x00\x00Graph Menu\nq&K\x0eh\x08K\x06X\x0c\x00\x00\x00Bars / Linesq\'K\x0eh\x08K\x07X-\x00\x00\x00Choose whether the graph should be displayed\nq(K\x0fh\x0bK\x07X\x16\x00\x00\x00using bars or lines. \nq)K\x0fh\x0bK\x0bX1\x00\x00\x00When using bars, the sample value (size or count)q*K\x07h\x1bK\x0fh\x0bK\x0bX1\x00\x00\x00for different kinds of objects will be stacked onq+K\x07h\x1bK\x0fh\x0bK\x0bX4\x00\x00\x00top of each other so the total height represents theq,K\x07h\x1bK\x0fh\x0bK\x0bX/\x00\x00\x00total value of a sample. When using lines, eachq-K\x07h\x1bK\x0fh\x0bK\x0bX.\x00\x00\x00line represents the value for a single kind ofq.K\x07h\x1bK\x0fh\x0bK\x0bX/\x00\x00\x00object. The 10 largest values are shown in eachq/K\x07h\x1bK\x0fh\x0bK\x0bX/\x00\x00\x00sample point. Each kind has a particular color,q0K\x07h\x1bK\x0fh\x0bK\x0bX1\x00\x00\x00choosen arbitrary but it is always the same colorq1K\x07h\x1bK\x0fh\x0bK\x0bX1\x00\x00\x00for the same kind. The remaing kinds, if any, areq2K\x07h\x1bK\x0fh\x0bK\x0bX\x10\x00\x00\x00shown in black. q3K\x07h\x1bK\x10h\x08K\x06X\x0c\x00\x00\x00Size / Countq4K\x10h\x08K\x07X1\x00\x00\x00Choose whether the graph should display the size\nq5K\x0fh\x0bK\x07X1\x00\x00\x00of objects of a particular kind or the number of\nq6K\x0fh\x0bK\x07X\x17\x00\x00\x00objects of that kind. \nq7K\x0fh\x0bK\x11X<\x00\x00\x00(Note that this affects only the graph, the table will stillq8K\x07h\x1bK\x0fh\x0bK\x11X;\x00\x00\x00choose size or kind as it were choosen in the table menu.) q9K\x07h\x1bK\x03X\x0b\x00\x00\x00Table Menu\nq:K\x12X\x0f\x00\x00\x00Header submenu\nq;K\x13XT\x01\x00\x00This menu has a choice of header for each column of the table. The data of each column is determined by the header of that column, as well as the headers of previous columns. So if you change the first column header (A/B), the data in that column will change as well as the data under the next header (Size/Count) and the ones that follow.\nq<K\x14h\x08K\x15X\x05\x00\x00\x00A / Bq=K\x14h\x08K\x16X+\x00\x00\x00Use the sample at the A or B marker in the\nq>K\x17h\x0bK\x16X\x08\x00\x00\x00graph. \nq?K\x17h\x0bK\x13X\'\x00\x00\x00The kinds of objects shown in the tableq@K\x16h\x1bK\x17h\x0bK\x13X\'\x00\x00\x00under this column are taken from the 10qAK\x16h\x1bK\x17h\x0bK\x13X+\x00\x00\x00largest sample values at that point, in theqBK\x16h\x1bK\x17h\x0bK\x13X*\x00\x00\x00same order as they are shown in the graph.qCK\x16h\x1bK\x17h\x0bK\x13X(\x00\x00\x00The ordering in the graph depends on theqDK\x16h\x1bK\x17h\x0bK\x13X*\x00\x00\x00choice of count or size in the graph menu.qEK\x16h\x1bK\x17h\x0bK\x13X)\x00\x00\x00However, the table may show count or sizeqFK\x16h\x1bK\x17h\x0bK\x13X*\x00\x00\x00independent from the choice in the graph. qGK\x16h\x1bK\x18h\x08K\x15h4K\x18h\x08K\x16X\'\x00\x00\x00Show the size or count of the kinds of\nqHK\x17h\x0bK\x16X&\x00\x00\x00objects in each row, taken from those\nqIK\x17h\x0bK\x16X\x1e\x00\x00\x00choosen in the A / B column. \nqJK\x18h\x08K\x15X\x0f\x00\x00\x00%A:Tot / %B:TotqKK\x18h\x08K\x16X$\x00\x00\x00Show percentage of the Size / Count\nqLK\x17h\x0bK\x16X.\x00\x00\x00column, relative to the total (size or count)\nqMK\x17h\x0bK\x16X$\x00\x00\x00at either the A or B sample point. \nqNK\x18h\x08K\x19X\x07\x00\x00\x00Cumul /qOK\x18h\x08K\x16X+\x00\x00\x00Show either a cumulative sum of the Size /\nqPK\x17h\x08K\x19X\x00\x00\x00\x00qQK\x1aX\t\x00\x00\x00A-B / B-AqRK\x17h\x08K\x16X\'\x00\x00\x00Count column, or the difference A-B or\nqSK\x17h\x0bK\x16X\x06\x00\x00\x00B-A. \nqTK\x17h\x0bK\x13X&\x00\x00\x00The cumulative sum is taken by summingqUK\x16h\x1bK\x17h\x0bK\x13X)\x00\x00\x00from the first table row down to the lastqVK\x16h\x1bK\x17h\x0bK\x13X\x05\x00\x00\x00row. qWK\x16h\x1bK\x18h\x08K\x15hKK\x18h\x08K\x16X\'\x00\x00\x00Show percentage of the previous field,\nqXK\x17h\x0bK\x16X&\x00\x00\x00relative to either the A or B total. \nqYK\x18h\x08K\x15X\x04\x00\x00\x00KindqZK\x18h\x08K\x16X-\x00\x00\x00Shows the kind of objects. This is currently\nq[K\x17h\x0bK\x16X*\x00\x00\x00the only alternative for this column. The\nq\\K\x17h\x0bK\x16X*\x00\x00\x00kind shown corresponds to the color shown\nq]K\x17h\x0bK\x16X\'\x00\x00\x00in the A / B column. A special kind is\nq^K\x17h\x0bK\x16X\'\x00\x00\x00<Other> which summarizes the remaining\nq_K\x17h\x0bK\x16X*\x00\x00\x00data if there were more than 10 different\nq`K\x17h\x0bK\x16X\x16\x00\x00\x00kinds in the sample. \nqaK\x12X\x12\x00\x00\x00Scrollbar submenu\nqbK\x1bh\x08K\x15X\x0f\x00\x00\x00Auto / On / OffqcK\x1bh\x08K\x16X.\x00\x00\x00Choose a scrollbar mode. The usual setting is\nqdK\x1ch\x0bK\x16X)\x00\x00\x00Auto which shows the scrollbar only when\nqeK\x1ch\x0bK\x16X\t\x00\x00\x00needed. \nqfK\x03X\x0c\x00\x00\x00Window Menu\nqgK\x0bXq\x00\x00\x00This menu lists the names of all open windows. Selecting one brings it to the top, deiconifying it if necessary.\nqhK\x03X\n\x00\x00\x00Help Menu\nqiK\x1dh\x08K\x06X\x05\x00\x00\x00AboutqjK\x1dh\x08K\x07X#\x00\x00\x00Version, author, email, copyright.\nqkK\x1eh\x08K\x06X\x04\x00\x00\x00HelpqlK\x1eh\x08K\x07X\x17\x00\x00\x00Open this help window.\nqmK\x00X\x06\x00\x00\x00Panes\nqnK\x01X\x98\x00\x00\x00There are 3 panes in the main window shown by default. At the top is the Control Panel, at the bottom left the Graph and at the bottom right the Table.\nqoK\x03X\x13\x00\x00\x00Control Panel Pane\nqpK\x1fXl\x00\x00\x00This contains controls for the graph and the markers. It also has a quick-exit button and a collect button.\nqqK\x12X\x13\x00\x00\x00X / Y axis control\nqrK\x13X\xec\x00\x00\x00The two frames in the Control Panel having an X or Y button in the top left corner control each axis of the graph. The X, horizontal, axis shows the sample point. The Y axis shows either the size or count, as choosen in the Graph menu.\nqsK h\x08K\x15X\x0c\x00\x00\x00X / Y ButtonqtK h\x08K\x16X,\x00\x00\x00Brings up a menu, currently containing some\nquK!h\x0bK\x16X2\x00\x00\x00buttons that can also be accessed directly in the\nqvK!h\x0bK\x16X\x08\x00\x00\x00panel. \nqwK"h\x08K\x15X\x0b\x00\x00\x00Grid buttonqxK"h\x08K\x16X,\x00\x00\x00Select if the graph should show grid lines.\nqyK"h\x08K\x15X\r\x00\x00\x00Range buttonsqzK"h\x08K\x16X0\x00\x00\x00Change the range that is shown in the displayed\nq{K!h\x08K\x15hQK\x1aX\x05\x00\x00\x00- / +q|K!h\x08K\x16X.\x00\x00\x00portion of the graph. For each time + or - is\nq}K!h\x0bK\x16X0\x00\x00\x00pressed the range will be stepped up or down in\nq~K!h\x0bK\x16X0\x00\x00\x00the sequence (1, 2, 5) and multiples thereoff. \nq\x7fK"h\x08K\x15X\x0b\x00\x00\x00Range fieldq\x80K"h\x08K\x16X+\x00\x00\x00The current range is shown here, and a new\nq\x81K!h\x0bK\x16X2\x00\x00\x00range can be entered by writing to this field and\nq\x82K!h\x0bK\x16X.\x00\x00\x00pressing Enter. The format is an integer that\nq\x83K!h\x0bK\x16X-\x00\x00\x00may be followed by a multiplier, K, M, G, or\nq\x84K!h\x0bK\x16X0\x00\x00\x00T, meaning that the value is multipled by 1000,\nq\x85K!h\x0bK\x16X,\x00\x00\x001E6, 1E9, or 1E12 respectively. The maximum\nq\x86K!h\x0bK\x16X\x0e\x00\x00\x00range is 1T. \nq\x87K\x12X\x15\x00\x00\x00A / B sample control\nq\x88K\x13X\x95\x00\x00\x00Each of the frames showing A or B in the top left corner controls one of the sample markers. The current position is shown in the bottom left corner.q\x89K#X\x86\x00\x00\x00(This is currently not an entry field - TODO - but the marker may be moved long distances by directly dragging it in the Graph frame.)q\x8aK\x13h\x1bK$h\x08K\x15h|K$h\x08K\x16X3\x00\x00\x00Step the marker one step to the left (-) or to the\nq\x8bK%h\x0bK\x16X\x0c\x00\x00\x00right (+). \nq\x8cK%h\x0bK\x13X0\x00\x00\x00The table will be updated to show new data if itq\x8dK\x16h\x1bK%h\x0bK\x13X-\x00\x00\x00was set to show such data that were dependentq\x8eK\x16h\x1bK%h\x0bK\x13X\x15\x00\x00\x00on the marker moved. q\x8fK\x16h\x1bK%h\x0bK\x13X/\x00\x00\x00The graph will show the new marker position. Ifq\x90K\x16h\x1bK%h\x0bK\x13X/\x00\x00\x00the marker was outside of the displayed portionq\x91K\x16h\x1bK%h\x0bK\x13X1\x00\x00\x00of the graph, the graph will scroll so the markerq\x92K\x16h\x1bK%h\x0bK\x13X\x11\x00\x00\x00becomes visible. q\x93K\x16h\x1bK&h\x08K\x15X\x0c\x00\x00\x00Track buttonq\x94K&h\x08K\x16X2\x00\x00\x00Press to set the marker to the last sample in the\nq\x95K%h\x0bK\x16X,\x00\x00\x00file and stay at the end as new samples are\nq\x96K%h\x0bK\x16X/\x00\x00\x00added. (New samples are periodically read from\nq\x97K%h\x0bK\x16X2\x00\x00\x00the end of the file when auto-collect is selected\nq\x98K%h\x0bK\x16X\x1a\x00\x00\x00via the Collect button.) \nq\x99K%h\x0bK\x13X)\x00\x00\x00Tracking is turned off when the marker isq\x9aK\x16h\x1bK%h\x0bK\x13X\x10\x00\x00\x00manually moved. q\x9bK\x16h\x1bK\x12X\x0c\x00\x00\x00Exit button\nq\x9cK\x13XE\x00\x00\x00Exits the program, a shortcut for the Exit command in the File menu.\nq\x9dK\x12X\x0f\x00\x00\x00Collect button\nq\x9eK\x13Xv\x00\x00\x00When selected, the browser will collect new samples from the current file, and will continue to do this periodically.\nq\x9fK#X<\x00\x00\x00Currently it will check the file for new data once a second.q\xa0K\x13h\x1bK\x03X\x0b\x00\x00\x00Graph Pane\nq\xa1K\x0bX\x06\x01\x00\x00This pane shows the currently visible portion of the sample file. It can be scrolled via an horizontal scrollbar. The two markers are shown as buttons labeled A and B above the graph and with lines extending down in the graph. Markers can be moved by the mouse.\nq\xa2K\x07Xt\x00\x00\x00How to move the markers is hopefully quite self evident when tried out but I wrote up some details about it anyway.\nq\xa3K\x12X\x18\x00\x00\x00Marker movement details\nq\xa4K\'X\x9d\x04\x00\x00Holding down the mouse button and moving the mouse moves the underlying marker. Klicking the mouse button over a marker without moving the mouse, selects the marker. While it is selected any movement of the mouse within the graph will move the marker with it. Klicking again anywhere in the graph will deselect the marker. If the marker can be moved, the cursor will be an arrow indicating the direction it can be moved, left or right or both. If the marker can not be moved in any direction, the cursor will show a circle or disc. The marker can not move outside the available samples. Moving the mouse outside of the graph also restricts the movement of the mouse, even if the mouse button is pressed. This is intentional so that the marker can be moved longer distances than the mouse can move. Moving the mouse to the right of the graph, the marker can only be moved to the right - moving back the mouse will not move the marker back until the mouse enters the graph area again. Similarly for the left side. Above or below the graph, the mouse will not move the marker at all but will show a circle to indicate that the mouse may be \'recirculated\' to move back into the graph.\nq\xa5K\x03X\x0b\x00\x00\x00Table Pane\nq\xa6K\x0bX\x7f\x00\x00\x00This pane shows a table based on the configuration set in the Table menu. The sample number and time stamp show in the header.\nq\xa7eX\x0b\x00\x00\x00tag_configsq\xa8}q\xa9(K\x00X\x08\x00\x00\x00spacing1q\xaaK\n\x86q\xabX\x04\x00\x00\x00fontq\xacX\x05\x00\x00\x00timesq\xadK\x14X\x04\x00\x00\x00boldq\xae\x87q\xaf\x86q\xb0\x86q\xb1K\x01h\xabh\xach\xadK\x0c\x86q\xb2\x86q\xb3\x86q\xb4K\x02h\xaaK\x06\x86q\xb5h\xb3\x86q\xb6K\x03h\xaaK\t\x86q\xb7h\xach\xadK\x10X\x04\x00\x00\x00boldq\xb8\x87q\xb9\x86q\xba\x86q\xbbK\x04h\xb3\x85q\xbcK\x06(X\x08\x00\x00\x00lmargin1q\xbdK$\x86q\xbeX\x08\x00\x00\x00lmargin2q\xbfK$\x86q\xc0h\xb5h\xach\xadK\x0cX\x04\x00\x00\x00boldq\xc1\x87q\xc2\x86q\xc3tq\xc4K\x07(h\xbeh\xc0h\xb5h\xb3tq\xc5K\x05(X\x04\x00\x00\x00tabsq\xc6(G@Z\xc0\x00\x00\x00\x00\x00X\x06\x00\x00\x00centerq\xc7G@g\x80\x00\x00\x00\x00\x00X\x04\x00\x00\x00leftq\xc8tq\xc9\x86q\xcah\xbeh\xc0h\xb5h\xc3tq\xcbK\x08h\xca\x85q\xccK\th\xcah\xb5\x86q\xcdK\n(h\xbeh\xc0h\xb5h\xach\xadK\x0cX\x06\x00\x00\x00italicq\xce\x87q\xcf\x86q\xd0tq\xd1K\x0bh\xbeh\xc0h\xb3\x87q\xd2K\x0c(h\xc6(G@Z \x00\x00\x00\x00\x00h\xc7G@f\xe0\x00\x00\x00\x00\x00h\xc8tq\xd3\x86q\xd4h\xbeh\xc0h\xb5h\xc3tq\xd5K\rh\xd4h\xb5\x86q\xd6K\x0e(h\xc6(G@S@\x00\x00\x00\x00\x00h\xc7G@`\x00\x00\x00\x00\x00\x00h\xc8tq\xd7\x86q\xd8h\xbeh\xc0h\xb5h\xc3tq\xd9K\x0fh\xd8\x85q\xdaK\x10h\xd8h\xb5\x86q\xdbK\x11h\xbeh\xc0h\xach\xadK\n\x86q\xdc\x86q\xdd\x87q\xdeK\x12(h\xbeh\xc0h\xaaK\x08\x86q\xdfh\xc3tq\xe0K\x15(h\xbdKH\x86q\xe1h\xbfKH\x86q\xe2h\xb5h\xc3tq\xe3K\x16(h\xe1h\xe2h\xb5h\xb3tq\xe4K\x14(h\xc6(G@`\xd0\x00\x00\x00\x00\x00h\xc7G@i\xe0\x00\x00\x00\x00\x00h\xc8tq\xe5\x86q\xe6h\xe1h\xe2h\xb5h\xc3tq\xe7K\x17h\xe6\x85q\xe8K\x13h\xe1h\xe2h\xb3\x87q\xe9K\x18h\xe6h\xb5\x86q\xeaK\x19h\xe3K\x1ah\xe1h\xe2h\xc3\x87q\xebK\x1b(h\xc6(G@^\xa0\x00\x00\x00\x00\x00h\xc7G@f\xe0\x00\x00\x00\x00\x00h\xc8tq\xec\x86q\xedh\xe1h\xe2h\xb5h\xc3tq\xeeK\x1ch\xed\x85q\xefK\x1d(h\xc6(G@L\xc0\x00\x00\x00\x00\x00h\xc7G@V@\x00\x00\x00\x00\x00h\xc8tq\xf0\x86q\xf1h\xbeh\xc0h\xb5h\xc3tq\xf2K\x1eh\xf1h\xb5\x86q\xf3K\x1fh\xb7h\xb3\x86q\xf4K (h\xc6(G@^`\x00\x00\x00\x00\x00h\xc7G@f\xa0\x00\x00\x00\x00\x00h\xc8tq\xf5\x86q\xf6h\xe1h\xe2h\xb5h\xc3tq\xf7K!h\xf6\x85q\xf8K"h\xf6h\xb5\x86q\xf9K#h\xe1h\xe2h\xdd\x87q\xfaK$(h\xc6(G@]`\x00\x00\x00\x00\x00h\xc7G@e\xa0\x00\x00\x00\x00\x00h\xc8tq\xfb\x86q\xfch\xe1h\xe2h\xb5h\xc3tq\xfdK%h\xfc\x85q\xfeK&h\xfch\xb5\x86q\xffK\'(h\xbeh\xc0h\xdfh\xb3tr\x00\x01\x00\x00uX\n\x00\x00\x00_gsl_titler\x01\x01\x00\x00X\x1e\x00\x00\x00Help for Heapy Profile Browserr\x02\x01\x00\x00ub.'
3,417.4
15,587
0.781764
3,387
17,087
3.940951
0.25096
0.123165
0.035061
0.017081
0.235091
0.147812
0.112451
0.066976
0.053641
0.029368
0
0.195402
0.078422
17,087
4
15,588
4,271.75
0.652251
0.002048
0
0
1
4.5
0.561173
0.35478
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
1
1
1
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
ea21081752360978188d7b3257e78389a9770d89
38
py
Python
custom_components/lobe/__init__.py
KTibow/lobe-home-assistant
d6ab166ffdce73f9ffb9282412e27b0685461d76
[ "MIT" ]
4
2021-05-02T06:33:03.000Z
2022-01-21T13:56:50.000Z
custom_components/lobe/__init__.py
KTibow/lobe-home-assistant
d6ab166ffdce73f9ffb9282412e27b0685461d76
[ "MIT" ]
null
null
null
custom_components/lobe/__init__.py
KTibow/lobe-home-assistant
d6ab166ffdce73f9ffb9282412e27b0685461d76
[ "MIT" ]
2
2021-05-30T01:28:19.000Z
2021-06-26T12:12:21.000Z
"""image_processing.lobe platform."""
19
37
0.736842
4
38
6.75
1
0
0
0
0
0
0
0
0
0
0
0
0.052632
38
1
38
38
0.75
0.815789
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
ea7d237d959d16f7c75f3c63e066ec5cac85234f
218
py
Python
Python/LeapYear.py
aaaaaaaaaanyaaaaaaaaa/Hello-world
ff47220589c34c1cd4555346e92d3255b433975f
[ "MIT" ]
3
2018-12-14T10:03:25.000Z
2020-02-11T16:24:39.000Z
Python/LeapYear.py
aaaaaaaaaanyaaaaaaaaa/Hello-world
ff47220589c34c1cd4555346e92d3255b433975f
[ "MIT" ]
1
2018-10-13T09:49:28.000Z
2018-10-13T09:49:28.000Z
Python/LeapYear.py
aaaaaaaaaanyaaaaaaaaa/Hello-world
ff47220589c34c1cd4555346e92d3255b433975f
[ "MIT" ]
2
2018-10-15T07:10:43.000Z
2019-10-23T08:31:25.000Z
year = int(input("Enter Year: ")) # Leap Year Check if not year % 400: print(year, "is a Leap Year") elif not year % 4 and year % 100: print(year, "is a Leap Year") else: print(year, "is not a Leap Year")
21.8
37
0.619266
39
218
3.461538
0.435897
0.237037
0.244444
0.177778
0.296296
0.296296
0
0
0
0
0
0.042424
0.243119
218
9
38
24.222222
0.775758
0.068807
0
0.285714
0
0
0.288557
0
0
0
0
0
0
1
0
false
0
0
0
0
0.428571
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
5
ea99451608efa17751b52b49d4d95a08e4bc6d5c
8,638
py
Python
Algorithm.Python/stubs/QuantConnect/Data/__Market_4.py
gaoxiaojun/Lean
9dca43bccb720d0df91e4bfc1d363b71e3a36cb5
[ "Apache-2.0" ]
2
2020-12-08T11:27:20.000Z
2021-04-06T13:21:15.000Z
Algorithm.Python/stubs/QuantConnect/Data/__Market_4.py
gaoxiaojun/Lean
9dca43bccb720d0df91e4bfc1d363b71e3a36cb5
[ "Apache-2.0" ]
null
null
null
Algorithm.Python/stubs/QuantConnect/Data/__Market_4.py
gaoxiaojun/Lean
9dca43bccb720d0df91e4bfc1d363b71e3a36cb5
[ "Apache-2.0" ]
1
2020-12-08T11:27:21.000Z
2020-12-08T11:27:21.000Z
import typing import System.IO import System.Collections.Generic import System import QuantConnect.Orders import QuantConnect.Data.Market import QuantConnect.Data import QuantConnect import datetime class TradeBar(QuantConnect.Data.BaseData, QuantConnect.Data.Market.IBar, QuantConnect.Data.Market.IBaseDataBar, QuantConnect.Data.IBaseData): """ TradeBar class for second and minute resolution data: An OHLC implementation of the QuantConnect BaseData class with parameters for candles. TradeBar() TradeBar(original: TradeBar) TradeBar(time: DateTime, symbol: Symbol, open: Decimal, high: Decimal, low: Decimal, close: Decimal, volume: Decimal, period: Nullable[TimeSpan]) """ @typing.overload def Clone(self, fillForward: bool) -> QuantConnect.Data.BaseData: pass @typing.overload def Clone(self) -> QuantConnect.Data.BaseData: pass def Clone(self, *args) -> QuantConnect.Data.BaseData: pass @typing.overload def GetSource(self, config: QuantConnect.Data.SubscriptionDataConfig, date: datetime.datetime, isLiveMode: bool) -> QuantConnect.Data.SubscriptionDataSource: pass @typing.overload def GetSource(self, config: QuantConnect.Data.SubscriptionDataConfig, date: datetime.datetime, datafeed: QuantConnect.DataFeedEndpoint) -> str: pass def GetSource(self, *args) -> str: pass @staticmethod def Parse(config: QuantConnect.Data.SubscriptionDataConfig, line: str, baseDate: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseCfd(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.T: pass @staticmethod @typing.overload def ParseCfd(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseCfd(config: QuantConnect.Data.SubscriptionDataConfig, streamReader: System.IO.StreamReader, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass def ParseCfd(self, *args) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseCrypto(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.T: pass @staticmethod @typing.overload def ParseCrypto(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseCrypto(config: QuantConnect.Data.SubscriptionDataConfig, streamReader: System.IO.StreamReader, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass def ParseCrypto(self, *args) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseEquity(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.T: pass @staticmethod @typing.overload def ParseEquity(config: QuantConnect.Data.SubscriptionDataConfig, streamReader: System.IO.StreamReader, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseEquity(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass def ParseEquity(self, *args) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseForex(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.T: pass @staticmethod @typing.overload def ParseForex(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseForex(config: QuantConnect.Data.SubscriptionDataConfig, streamReader: System.IO.StreamReader, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass def ParseForex(self, *args) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseFuture(config: QuantConnect.Data.SubscriptionDataConfig, streamReader: System.IO.StreamReader, date: datetime.datetime) -> QuantConnect.Data.Market.T: pass @staticmethod @typing.overload def ParseFuture(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.T: pass @staticmethod @typing.overload def ParseFuture(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseFuture(config: QuantConnect.Data.SubscriptionDataConfig, streamReader: System.IO.StreamReader, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass def ParseFuture(self, *args) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseOption(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.T: pass @staticmethod @typing.overload def ParseOption(config: QuantConnect.Data.SubscriptionDataConfig, streamReader: System.IO.StreamReader, date: datetime.datetime) -> QuantConnect.Data.Market.T: pass @staticmethod @typing.overload def ParseOption(config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass @staticmethod @typing.overload def ParseOption(config: QuantConnect.Data.SubscriptionDataConfig, streamReader: System.IO.StreamReader, date: datetime.datetime) -> QuantConnect.Data.Market.TradeBar: pass def ParseOption(self, *args) -> QuantConnect.Data.Market.TradeBar: pass @typing.overload def Reader(self, config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime, isLiveMode: bool) -> QuantConnect.Data.BaseData: pass @typing.overload def Reader(self, config: QuantConnect.Data.SubscriptionDataConfig, stream: System.IO.StreamReader, date: datetime.datetime, isLiveMode: bool) -> QuantConnect.Data.BaseData: pass @typing.overload def Reader(self, config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime, datafeed: QuantConnect.DataFeedEndpoint) -> QuantConnect.Data.BaseData: pass def Reader(self, *args) -> QuantConnect.Data.BaseData: pass def ToString(self) -> str: pass def Update(self, lastTrade: float, bidPrice: float, askPrice: float, volume: float, bidSize: float, askSize: float) -> None: pass @typing.overload def __init__(self) -> QuantConnect.Data.Market.TradeBar: pass @typing.overload def __init__(self, original: QuantConnect.Data.Market.TradeBar) -> QuantConnect.Data.Market.TradeBar: pass @typing.overload def __init__(self, time: datetime.datetime, symbol: QuantConnect.Symbol, open: float, high: float, low: float, close: float, volume: float, period: typing.Optional[datetime.timedelta]) -> QuantConnect.Data.Market.TradeBar: pass def __init__(self, *args) -> QuantConnect.Data.Market.TradeBar: pass Close: float EndTime: datetime.datetime High: float Low: float Open: float Period: datetime.timedelta Volume: float class TradeBars(QuantConnect.Data.Market.DataDictionary[TradeBar], System.Collections.IEnumerable, QuantConnect.Interfaces.IExtendedDictionary[Symbol, TradeBar], System.Collections.Generic.ICollection[KeyValuePair[Symbol, TradeBar]], System.Collections.Generic.IDictionary[Symbol, TradeBar], System.Collections.Generic.IEnumerable[KeyValuePair[Symbol, TradeBar]]): """ Collection of TradeBars to create a data type for generic data handler: TradeBars() TradeBars(frontier: DateTime) """ @typing.overload def __init__(self) -> QuantConnect.Data.Market.TradeBars: pass @typing.overload def __init__(self, frontier: datetime.datetime) -> QuantConnect.Data.Market.TradeBars: pass def __init__(self, *args) -> QuantConnect.Data.Market.TradeBars: pass Item: indexer#
36.447257
364
0.726904
878
8,638
7.11959
0.117312
0.194529
0.137258
0.183011
0.774116
0.728843
0.68885
0.677012
0.639738
0.639258
0
0
0.173767
8,638
236
365
36.601695
0.875858
0.052558
0
0.603659
0
0
0
0
0
0
0
0
0
1
0.280488
false
0.280488
0.054878
0
0.396341
0
0
0
0
null
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
5
eaa0c1fac79cea8fccb2df9a92483486aa3ac54a
9,056
py
Python
plot.py
polikutinevgeny/FrontsCNN
a9f48d5afcdd7e0fe561840d94af36c0fedf1c15
[ "MIT" ]
1
2019-12-28T08:40:44.000Z
2019-12-28T08:40:44.000Z
plot.py
polikutinevgeny/FrontsCNN
a9f48d5afcdd7e0fe561840d94af36c0fedf1c15
[ "MIT" ]
null
null
null
plot.py
polikutinevgeny/FrontsCNN
a9f48d5afcdd7e0fe561840d94af36c0fedf1c15
[ "MIT" ]
null
null
null
import matplotlib.colors import numpy as np import xarray as xr from cartopy import crs as ccrs from matplotlib import pyplot as plt import matplotlib.patches as mpatches from confusion_matrix import plot_confusion_matrix from crop import crop_center, crop_2d def plot_results(x, y_true, y_pred, name, in_size, date, bw=False, binary=False): proj = ccrs.LambertConformal( central_latitude=50, central_longitude=-107, false_easting=5632642.22547, false_northing=4612545.65137, standard_parallels=(50, 50), cutoff=-30 ) f = plt.figure(figsize=(16, 8)) f.suptitle("Fronts at {}".format(date), fontsize=16) ax = plt.subplot(1, 2, 1, projection=proj) ax.set_title("Prediction") plot_fronts(x, y_pred, proj, ax, in_size, bw, binary) ax = plt.subplot(1, 2, 2, projection=proj) ax.set_title("Ground truth") plot_fronts(x, y_true, proj, ax, in_size, bw, binary) plt.savefig(name) plt.close(f) def plot_fronts(x, y, proj, ax, in_size, bw=False, binary=False): with xr.open_dataset("/mnt/ldm_vol_DESKTOP-DSIGH25-Dg0_Volume1/DiplomData2/NARR/air.2m.nc") as example: lat = crop_center(crop_2d(example.lat.values), in_size) lon = crop_center(crop_2d(example.lon.values), in_size) lon = (lon + 220) % 360 - 180 # Shift due to problems with crossing dateline in cartopy shift = ccrs.PlateCarree(central_longitude=-40) ax.set_xmargin(0.1) ax.set_ymargin(0.1) ax.set_extent((2.0e+6, 1.039e+07, 6.0e+5, 8959788), crs=proj) if x.ndim == 3: plt.contour(lon, lat, x[..., 1], levels=20, transform=shift, colors='black', linewidths=0.5) if bw: if binary: cmap = matplotlib.colors.ListedColormap([(0, 0, 0, 0), 'black']) plt.pcolormesh(lon, lat, y, cmap=cmap, zorder=10, transform=shift) else: plt.pcolor(lon, lat, np.ma.masked_not_equal(y, 1), hatch="||||", alpha=0., transform=shift, zorder=100) plt.pcolor(lon, lat, np.ma.masked_not_equal(y, 2), hatch="----", alpha=0., transform=shift, zorder=100) plt.pcolor(lon, lat, np.ma.masked_not_equal(y, 3), hatch="oooo", alpha=0., transform=shift, zorder=100) plt.pcolor(lon, lat, np.ma.masked_not_equal(y, 4), hatch="++++", alpha=0., transform=shift, zorder=100) hot = mpatches.Patch(facecolor='white', label='Тёплый фронт', hatch="||||", alpha=1) cold = mpatches.Patch(facecolor='white', label='Холодный фронт', hatch="----", alpha=1) stat = mpatches.Patch(facecolor='white', label='Стационарный фронт', hatch="oooo", alpha=1) occl = mpatches.Patch(facecolor='white', label='Фронт окклюзии', hatch="++++", alpha=1) ax.legend(handles=[hot, cold, stat, occl], loc='upper center', bbox_to_anchor=(0.5, -0.05), ncol=2, prop={'size': 12}) else: if x.ndim == 3: plt.contourf(lon, lat, x[..., 0], levels=20, transform=shift) else: plt.contourf(lon, lat, x, levels=20, transform=shift) if binary: cmap = matplotlib.colors.ListedColormap([(0, 0, 0, 0), 'black']) plt.pcolormesh(lon, lat, y, cmap=cmap, zorder=10, transform=shift) else: cmap = matplotlib.colors.ListedColormap([(0, 0, 0, 0), 'red', 'blue', 'green', 'purple']) plt.pcolormesh(lon, lat, y, cmap=cmap, zorder=10, transform=shift) hot = mpatches.Patch(facecolor='red', label='Тёплый фронт', alpha=1) cold = mpatches.Patch(facecolor='blue', label='Холодный фронт', alpha=1) stat = mpatches.Patch(facecolor='green', label='Стационарный фронт', alpha=1) occl = mpatches.Patch(facecolor='purple', label='Фронт окклюзии', alpha=1) ax.legend(handles=[hot, cold, stat, occl], loc='upper center', bbox_to_anchor=(0.5, -0.05), ncol=2, prop={'size': 12}) ax.coastlines() ax.gridlines(draw_labels=True) # hot = mpatches.Patch(facecolor='red', label='Тёплый фронт', alpha=1) # cold = mpatches.Patch(facecolor='blue', label='Холодный фронт', alpha=1) # stat = mpatches.Patch(facecolor='green', label='Стационарный фронт', alpha=1) # occl = mpatches.Patch(facecolor='purple', label='Фронт окклюзии', alpha=1) # ax.legend(handles=[hot, cold, stat, occl], loc='upper center', bbox_to_anchor=(0.5, -0.05), ncol=2, # prop={'size': 12}) def plot_fronts_far_east(x, y, name, onehot, in_size, date, bw=False): proj = ccrs.LambertConformal( central_latitude=50, central_longitude=130, false_easting=5632642.22547, false_northing=4612545.65137, standard_parallels=(50, 50), cutoff=-30 ) f = plt.figure(figsize=(8, 8)) f.suptitle("Fronts at {}".format(date), fontsize=16) ax = plt.subplot(1, 1, 1, projection=proj) y = np.argmax(y, axis=-1) if onehot else y with xr.open_dataset("/mnt/ldm_vol_DESKTOP-DSIGH25-Dg0_Volume1/DiplomData2/NARR/air.2m.nc") as example: lat = crop_center(crop_2d(example.lat.values), in_size) lon = crop_center(crop_2d(example.lon.values), in_size) # Steal lat/lon from NARR lon = ((lon + 220) % 360 - 180 + 237) % 360 # Shift due to problems with crossing dateline in cartopy shift = ccrs.PlateCarree(central_longitude=-40) ax.set_xmargin(0.1) ax.set_ymargin(0.1) ax.set_extent((2.0e+6, 1.039e+07, 6.0e+5, 8959788), crs=proj) plt.contour(lon, lat, x[..., 1], levels=20, transform=shift, colors='black', linewidths=0.5) if bw: plt.pcolor(lon, lat, np.ma.masked_not_equal(y, 1), hatch="||||", alpha=0., transform=shift, zorder=100) plt.pcolor(lon, lat, np.ma.masked_not_equal(y, 2), hatch="----", alpha=0., transform=shift, zorder=100) plt.pcolor(lon, lat, np.ma.masked_not_equal(y, 3), hatch="oooo", alpha=0., transform=shift, zorder=100) plt.pcolor(lon, lat, np.ma.masked_not_equal(y, 4), hatch="++++", alpha=0., transform=shift, zorder=100) hot = mpatches.Patch(facecolor='white', label='Тёплый фронт', hatch="||||", alpha=1) cold = mpatches.Patch(facecolor='white', label='Холодный фронт', hatch="----", alpha=1) stat = mpatches.Patch(facecolor='white', label='Стационарный фронт', hatch="oooo", alpha=1) occl = mpatches.Patch(facecolor='white', label='Фронт окклюзии', hatch="++++", alpha=1) ax.legend(handles=[hot, cold, stat, occl], loc='upper center', bbox_to_anchor=(0.5, -0.05), ncol=2, prop={'size': 12}) else: plt.contourf(lon, lat, x[..., 0], levels=20, transform=shift) cmap = matplotlib.colors.ListedColormap([(0, 0, 0, 0), 'red', 'blue', 'green', 'purple']) plt.pcolormesh(lon, lat, y, cmap=cmap, zorder=10, transform=shift) hot = mpatches.Patch(facecolor='red', label='Тёплый фронт', alpha=1) cold = mpatches.Patch(facecolor='blue', label='Холодный фронт', alpha=1) stat = mpatches.Patch(facecolor='green', label='Стационарный фронт', alpha=1) occl = mpatches.Patch(facecolor='purple', label='Фронт окклюзии', alpha=1) ax.legend(handles=[hot, cold, stat, occl], loc='upper center', bbox_to_anchor=(0.5, -0.05), ncol=2, prop={'size': 12}) ax.coastlines() ax.gridlines(draw_labels=True) plt.savefig(name) plt.close(f) def plot_conf_matrix(y_true, y_pred, filename, binary=False, normalize=True, title=None, cmap='Greys'): if binary: plot_confusion_matrix(y_true, y_pred, ["Нет фронта", "Фронт"], normalize=normalize, title=title, cmap=cmap) else: plot_confusion_matrix(y_true, y_pred, ["Нет фронта", "Тёплый", "Холодный", "Стационарный", "Окклюзии"], normalize=normalize, title=title, cmap=cmap) plt.savefig(filename) plt.close() def plot_sample(dataset, model, prefix, in_size, binary=False): x, y_true = dataset[0] dates = dataset.get_dates(0) y_pred = model.predict(x) if binary: y_true = y_true[..., 0] for i in range(x.shape[0]): plot_results(x[i], y_true[i], y_pred[i], "{}/{}".format(prefix, i), in_size, dates[i]) def plot_filtered(dataset, model, in_size, prefix, filter_func, binary=False): for m, i in zip(dataset, range(len(dataset))): x, y = m r = model.evaluate(x, y, verbose=0) d = dataset.get_dates(i)[0] if filter_func(r[1]): pred = model.predict(x) if binary: y[0] = y[0, ..., 0] plot_results(x[0], y[0], pred[0], "{2}/{0}_{1:.2f}.png".format(i, r[1], prefix), in_size, d) def plot_metrics_histogram(dataset, model, prefix): d = [[] for _ in model.keras_model.metrics_names] for (x, y) in dataset: r = model.evaluate(x, y, verbose=0) for i, j in zip(d, r): i.append(j) for n, i in zip(model.metrics_names, d): plt.hist(i, bins=100) plt.title(n) plt.savefig("{}/{}".format(prefix, n)) plt.close()
50.592179
115
0.623564
1,306
9,056
4.227412
0.166156
0.047093
0.079696
0.021735
0.795689
0.76526
0.740989
0.722876
0.712009
0.675783
0
0.048392
0.210468
9,056
178
116
50.876404
0.723776
0.061727
0
0.634615
0
0
0.090138
0.015789
0
0
0
0
0
1
0.044872
false
0
0.051282
0
0.096154
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
577161a144932ec56a755db8e42f348a74940472
123
py
Python
src/Biblioteca/members/admin.py
ElDwarf/Biblioteca-manager-demo
109476c8bf9ee3861857b4e9fe4965fb5321d609
[ "MIT" ]
null
null
null
src/Biblioteca/members/admin.py
ElDwarf/Biblioteca-manager-demo
109476c8bf9ee3861857b4e9fe4965fb5321d609
[ "MIT" ]
null
null
null
src/Biblioteca/members/admin.py
ElDwarf/Biblioteca-manager-demo
109476c8bf9ee3861857b4e9fe4965fb5321d609
[ "MIT" ]
1
2022-01-17T19:23:55.000Z
2022-01-17T19:23:55.000Z
from django.contrib import admin from .models import Member, Loan admin.site.register(Member) admin.site.register(Loan)
15.375
32
0.796748
18
123
5.444444
0.555556
0.183673
0.346939
0
0
0
0
0
0
0
0
0
0.113821
123
7
33
17.571429
0.899083
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
57d6cb4110fb6f37273295c94c915ed987d107d1
165
py
Python
service/front_controller.py
yutiansut/cilantro
3fa579999e7d5a6d6041ccc7e309c667fc7eac90
[ "Apache-2.0" ]
3
2019-09-04T12:40:33.000Z
2021-12-28T16:33:27.000Z
service/front_controller.py
yutiansut/cilantro
3fa579999e7d5a6d6041ccc7e309c667fc7eac90
[ "Apache-2.0" ]
97
2018-05-29T13:27:04.000Z
2021-11-02T11:03:33.000Z
service/front_controller.py
yutiansut/cilantro
3fa579999e7d5a6d6041ccc7e309c667fc7eac90
[ "Apache-2.0" ]
16
2018-04-25T11:39:21.000Z
2019-12-16T14:37:39.000Z
from flask import Blueprint front_controller = Blueprint('front', __name__) @front_controller.route('/') def index(): return "cilantro is up and running ..."
18.333333
47
0.721212
20
165
5.65
0.8
0.247788
0
0
0
0
0
0
0
0
0
0
0.151515
165
8
48
20.625
0.807143
0
0
0
0
0
0.218182
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.6
0.4
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
5
57e4546a55d2ff3e287a2f4ab6d0d1ff7834e879
40,724
py
Python
hivwholeseq/store/check_initial_reference.py
iosonofabio/hivwholeseq
d504c63b446c3a0308aad6d6e484ea1666bbe6df
[ "MIT" ]
3
2016-12-01T03:12:06.000Z
2021-07-03T01:29:26.000Z
hivwholeseq/store/check_initial_reference.py
iosonofabio/hivwholeseq
d504c63b446c3a0308aad6d6e484ea1666bbe6df
[ "MIT" ]
null
null
null
hivwholeseq/store/check_initial_reference.py
iosonofabio/hivwholeseq
d504c63b446c3a0308aad6d6e484ea1666bbe6df
[ "MIT" ]
3
2016-01-17T03:43:46.000Z
2020-03-25T07:00:11.000Z
# vim: fdm=marker ''' author: Fabio Zanini date: 17/06/14 content: Check whether we need a new initial reference. Reasons might be a new sample sequenced that comes before all current ones, or the current reference has some genes not properly assembled. ''' # Modules import sys import os import numpy as np import argparse from Bio.Seq import Seq from Bio.Alphabet.IUPAC import ambiguous_dna from Bio import SeqIO from hivwholeseq.sequencing.samples import SampleSeq from hivwholeseq.patients.patients import load_patients, load_patient, Patient from hivwholeseq.patients.filenames import get_sample_foldername from hivwholeseq.utils.genome_info import locate_gene from hivwholeseq.data.primers import fragments_genes # Functions def check_similarity_initial_sample(refseq, sample_seq, fragment, VERBOSE=0, maxdiff=10): '''Check whether the reference looks similar to the initial sample''' from seqanpy import align_global (score, ali1, ali2) = align_global(str(refseq.seq), str(sample_seq.seq), band=50) alim = np.zeros((2, len(ali1)), 'S1') alim[0] = np.fromstring(ali1, 'S1') alim[1] = np.fromstring(ali2, 'S1') n_diff = (alim[0] != alim[1]).sum() if VERBOSE >= 2: print fragment+': difference between ref and initial consensus:', n_diff if n_diff > maxdiff: print 'ERROR: '+fragment+', reference is not similar to initial consensus ('+\ str(sample_init_seq.name)+', '+\ str(n_diff)+' differences)' return False elif VERBOSE >=3: print 'OK: reference is similar to initial consensus ('+\ str(sample_init_seq.name)+', '+\ str(n_diff)+' differences)' return True def check_has_complete_codons(gene, genename, VERBOSE=0): '''Check that the length is multiple of 3''' if len(gene) % 3: print 'ERROR: '+genename+' has a length not 3 * X' return False elif VERBOSE >= 3: print 'OK: '+genename+' has a length 3 * X' return True def check_start_aminoacid(prot, genename, VERBOSE=0): '''Check whether the protein starts with an M''' # Pol starts with an F instead of an M from collections import defaultdict start_aa = defaultdict(lambda: 'M') start_aa['pol'] = 'F' if prot[0] != start_aa[genename]: print 'ERROR: '+genename+' does not start with an '+start_aa[genename]+'!' return False elif VERBOSE >= 3: print 'OK: '+genename+' starts with an '+start_aa[genename] return True def check_has_end(prot_ref, genename, VERBOSE=0): '''Check whether it has a stop codon''' if prot_ref[-1] != '*': if VERBOSE >= 1: print 'ERROR: '+genename+' does not end!' return False elif VERBOSE >= 3: print 'OK: '+genename+' ends with a *' return True def check_has_premature_stops(prot_ref, genename, VERBOSE=0): '''Check for premature stop codons''' protm = np.array(prot_ref) ind_star = (protm == '*').nonzero()[0] if (len(ind_star) != 1) or (ind_star[0] != len(protm) - 1): if VERBOSE >= 1: print 'ERROR: '+genename+' has premature stop codons!' return False elif VERBOSE >= 3: print 'OK: '+genename+' has no premature stop codons' return True def check_has_similar_length(len_ref, len_HXB2, genename, VERBOSE=0, maxdiff=30): '''Does the gene have similar length like the HXB2?''' if len_ref < len_HXB2 - maxdiff: print 'ERROR: '+genename+' too short! (ref '+str(len_ref)+', HXB2 '+str(len_HXB2)+')' return False elif len_ref > len_HXB2 + maxdiff: print 'ERROR: '+genename+' too long! (ref '+str(len_ref)+', HXB2 '+str(len_HXB2)+')' return False elif VERBOSE >= 3: print 'OK: '+genename+' has the right length (ref '+str(len_ref)+', HXB2 '+str(len_HXB2)+')' return True def check_has_premature_stops_noend(prot_ref, genename, VERBOSE=0): '''Check for premature stop codons''' protm = np.array(prot_ref) ind_star = (protm == '*').nonzero()[0] if len(ind_star): if VERBOSE >= 1: print 'ERROR: '+genename+' has premature stop codons!' return False elif VERBOSE >= 3: print 'OK: '+genename+' has no premature stop codons' return True def get_fragment_length_HXB2(frag_spec): '''Get the length of a fragment in HXB2''' from hivwholeseq.data.primers import primers_coordinates_HXB2 pr_coord_HXB2 = primers_coordinates_HXB2[frag_spec] len_HXB2 = pr_coord_HXB2[1][0] - pr_coord_HXB2[0][1] return len_HXB2 def get_gene_HXB2(genename): '''Get a gene or exon in HXB2''' from operator import attrgetter from hivwholeseq.reference import load_custom_reference HXB2 = load_custom_reference('HXB2', format='gb') if genename not in ('tat1', 'tat2', 'rev1', 'rev2'): gene_coord = HXB2.features[map(attrgetter('id'), HXB2.features).index(genename)] gene_HXB2 = gene_coord.extract(HXB2) return gene_HXB2 else: exon_n = int(genename[-1]) genename = genename[:-1] gene_coord = HXB2.features[map(attrgetter('id'), HXB2.features).index(genename)] exon_coord = gene_coord.location.parts[exon_n - 1] exon_HXB2 = exon_coord.extract(HXB2) return exon_HXB2 def get_frame(geneseq, gene_HXB2, genename, VERBOSE=0): '''Get the frame by aligning the proteins''' from seqanpy import align_local from Bio.Seq import translate from numpy import argmax geneseq = ''.join(geneseq) gene_HXB2 = ''.join(gene_HXB2) if genename in ('tat1', 'rev1'): gene_HXB2 = gene_HXB2[:len(gene_HXB2) - (len(gene_HXB2) % 3)] elif genename in ('tat2', 'rev2'): gene_HXB2 = gene_HXB2[len(gene_HXB2) % 3:] prot_HXB2 = translate(gene_HXB2) scores = [] for frame in xrange(3): tmp = geneseq[frame:] tmp = tmp[:len(tmp) - (len(tmp) % 3)] tmp = translate(tmp) (score, ali1, ali2) = align_local(prot_HXB2, tmp) scores.append(score) return argmax(scores) def check_length_fragment(refseq, frag_spec, VERBOSE=0, tolerance=50): '''Check the length of the fragment compared to HXB2''' fragment = frag_spec[:2] len_HXB2 = get_fragment_length_HXB2(frag_spec) if len(refseq) < len_HXB2 - tolerance: print 'ERROR: '+fragment+' too short! ('+str(len(refseq))+' vs '+str(len_HXB2)+' in HXB2)' return False elif len(refseq) > len_HXB2 + tolerance: print 'ERROR: '+fragment+' too long! ('+str(len(refseq))+' vs '+str(len_HXB2)+' in HXB2)' return False elif VERBOSE >= 3: print 'OK: '+fragment+' has approximately the right length ('+str(len(refseq))+' vs '+str(len_HXB2)+' in HXB2)' return True def check_F1(refseq, spec, VERBOSE=0): '''Check fragment F1: gag, pol''' check = check_length_fragment(refseq, 'F1'+spec, VERBOSE=VERBOSE, tolerance=50) if not check: return False # Check gag (should be complete) genename = 'gag' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F1!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=30) if not check: return False geneseq = refseq[start: end] gene = geneseq.seq check = check_has_complete_codons(gene, genename, VERBOSE=VERBOSE) if not check: return False prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False # Check pol (there should be the start) genename = 'pol' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found): print 'ERROR: start of '+genename+' not found in F1!' return False elif VERBOSE >= 3: print 'OK: start of '+genename+' found' geneseq = refseq[start:] geneseq = geneseq[:len(geneseq) - len(geneseq) % 3] gene = geneseq.seq prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops_noend(prot, genename, VERBOSE=VERBOSE) if not check: return False return True def check_F2(refseq, spec, VERBOSE=0): '''Check fragment F2: gag, pol''' check = check_length_fragment(refseq, 'F2'+spec, VERBOSE=VERBOSE, tolerance=80) if not check: return False # Check gag (there should be end) genename = 'gag' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not end_found): print 'ERROR: end of '+genename+' not found in F2!' return False elif VERBOSE >= 3: print 'OK: end of '+genename+' found' geneseq = refseq[:end] geneseq = geneseq[len(geneseq) % 3:] gene = geneseq.seq prot = gene.translate() check = check_has_end(prot, 'gag', VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops(prot, 'gag', VERBOSE=VERBOSE) if not check: return False # Check pol (there should be the start) genename = 'pol' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found): print 'ERROR: start of '+genename+' not found in F2!' return False elif VERBOSE >= 3: print 'OK: start of '+genename+' found' geneseq = refseq[start:] geneseq = geneseq[:len(geneseq) - len(geneseq) % 3] gene = geneseq.seq prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops_noend(prot, genename, VERBOSE=VERBOSE) if not check: return False return True def check_F3(refseq, spec, VERBOSE=0): '''Check fragment F3: end of pol''' check = check_length_fragment(refseq, 'F3'+spec, VERBOSE=VERBOSE, tolerance=50) if not check: return False # Check pol: this depends on the spec: for F3bo there should be the end, # anything else has only the middle (it's all pol!) genename = 'pol' if spec == 'bo': (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not end_found): print 'ERROR: end of '+genename+' not found in F3!' return False elif VERBOSE >= 3: print 'OK: end of '+genename+' found' geneseq = refseq[:end] geneseq = geneseq[len(geneseq) % 3:] gene = geneseq.seq prot = gene.translate() check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False else: # Try all 3 reading frames for offset in xrange(3): geneseq = refseq[offset:] geneseq = geneseq[: len(geneseq) - (len(geneseq) % 3)] gene = geneseq.seq prot = gene.translate() check = check_has_premature_stops_noend(prot, genename, VERBOSE=0) if check: if VERBOSE >= 3: print 'OK: '+genename+' has no premature stop codons' break else: if VERBOSE >= 1: print 'ERROR: '+genename+' has premature stop codons in all reading frames!' return False return True def check_F4(refseq, spec, VERBOSE=0): '''Check fragment F4: pol, vif, vpr, vpu, tat1, rev1, env''' check = check_length_fragment(refseq, 'F4'+spec, VERBOSE=VERBOSE, tolerance=50) if not check: return False # Check pol (there should be end) genename = 'pol' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not end_found): print 'ERROR: end of '+genename+' not found in F4!' return False elif VERBOSE >= 3: print 'OK: end of '+genename+' found' geneseq = refseq[:end] gene_HXB2 = get_gene_HXB2(genename) frame = get_frame(geneseq, gene_HXB2, genename) geneseq = geneseq[frame:] geneseq = geneseq[:len(geneseq) - (len(geneseq) % 3)] gene = geneseq.seq prot = gene.translate() check = check_has_end(prot, genename, VERBOSE=VERBOSE) # it can end a bit early or late if not check: gene_new = refseq.seq[frame:] gene_new = gene_new[:len(gene_new) - (len(gene_new) % 3)] prot_new = gene_new.translate() end_new = prot_new.find('*') end_diff = (frame + 3 * end_new) - end if 0 < end_diff < 200: print genename.upper()+' ENDS '+str(end_new - len(prot) + 1)+' AMINO ACIDS DOWNSTREAM!' prot = prot_new[:end_new + 1] elif -200 < end_diff < 0: print genename.upper()+' ENDS '+str(len(prot) - 1 - end_new)+' AMINO ACIDS UPSTREAM!' prot = prot_new[:end_new + 1] else: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: print prot return False # Check env (there should be the start) genename = 'env' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found): print 'ERROR: start of '+genename+' not found in F4!' return False elif VERBOSE >= 3: print 'OK: start of '+genename+' found' geneseq = refseq[start:] geneseq = geneseq[:len(geneseq) - len(geneseq) % 3] gene = geneseq.seq prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops_noend(prot, genename, VERBOSE=VERBOSE) if not check: return False # Check vif (should be complete) genename = 'vif' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F4!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=15) if not check: return False geneseq = refseq[start: end] gene = geneseq.seq check = check_has_complete_codons(gene, genename, VERBOSE=VERBOSE) if not check: return False prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_end(prot, genename, VERBOSE=0) if check: if VERBOSE >= 3: print 'OK: '+genename+' ends with a *' else: # Vif tends to be a bit longer than in HXB2 for nc in xrange(1, 4): gene_ext = refseq[start: end + 3 * nc].seq prot_ext = gene_ext.translate() check = check_has_end(prot_ext, genename, VERBOSE=0) if check: gene = gene_ext prot = prot_ext if VERBOSE: print 'WARNING: '+genename+' actually ends '+str(nc)+' codons downstream' break else: print 'ERROR: '+genename+' does not end, not even slightly downstream' return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False # Check vpu (should be complete) genename = 'vpu' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F4!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=15) if not check: return False geneseq = refseq[start: end] gene = geneseq.seq check = check_has_complete_codons(gene, genename, VERBOSE=VERBOSE) if not check: return False prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: print 'ERROR IN VPU STARTING CODON, CONTINUING!' #return False check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False # Check vpr (should be complete) genename = 'vpr' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F4!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=15) if not check: return False geneseq = refseq[start: end] gene = geneseq.seq check = check_has_complete_codons(gene, genename, VERBOSE=VERBOSE) if not check: return False prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False # Check tat1 (first exon of tat, should be complete) genename = 'tat1' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F4!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=35) if not check: return False geneseq = refseq[start: end] geneseq = geneseq[:len(geneseq) - len(geneseq) % 3] gene = geneseq.seq prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops_noend(prot, genename, VERBOSE=VERBOSE) if not check: return False # Check rev1 (first exon of rev, should be complete) genename = 'rev1' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F4!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=15) if not check: return False geneseq = refseq[start: end] geneseq = geneseq[:len(geneseq) - len(geneseq) % 3] gene = geneseq.seq prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops_noend(prot, genename, VERBOSE=VERBOSE) if not check: return False return True def check_F5(refseq, spec, VERBOSE=0): '''Check fragment F5: env''' if spec == 'a+bo': spec_inner = 'bo' else: spec_inner = spec check = check_length_fragment(refseq, 'F5'+spec_inner, VERBOSE=VERBOSE, tolerance=70) if not check: return False # Check env (there should be the start) genename = 'env' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found): print 'ERROR: start of '+genename+' not found in F5!' return False elif VERBOSE >= 3: print 'OK: start of '+genename+' found' geneseq = refseq[start:] geneseq = geneseq[:len(geneseq) - len(geneseq) % 3] gene = geneseq.seq prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops_noend(prot, genename, VERBOSE=VERBOSE) if not check: return False # Check vpu (should be complete in F5ao) if spec_inner == 'ao': genename = 'vpu' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F4!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=15) if not check: return False geneseq = refseq[start: end] gene = geneseq.seq check = check_has_complete_codons(gene, genename, VERBOSE=VERBOSE) if not check: return False prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: print 'ERROR IN VPU STARTING CODON, CONTINUING!' #return False check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False return True def check_F6(refseq, spec, VERBOSE=0): '''Check fragment F6: end of env, tat2, rev2''' check = check_length_fragment(refseq, 'F6'+spec, VERBOSE=VERBOSE, tolerance=50) if not check: return False # Check env (there should be end) genename = 'env' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not end_found): print 'ERROR: end of '+genename+' not found in F6!' return False elif VERBOSE >= 3: print 'OK: end of '+genename+' found' geneseq = refseq[:end] gene_HXB2 = get_gene_HXB2(genename) frame = get_frame(geneseq, gene_HXB2, genename) geneseq = geneseq[frame:] geneseq = geneseq[:len(geneseq) - (len(geneseq) % 3)] gene = geneseq.seq prot = gene.translate() check = check_has_end(prot, genename, VERBOSE=VERBOSE) # env can end a bit early or late if not check: gene_new = refseq.seq[frame:] gene_new = gene_new[:len(gene_new) - (len(gene_new) % 3)] prot_new = gene_new.translate() end_new = prot_new.find('*') end_diff = (frame + 3 * end_new) - end if 0 < end_diff < 200: print 'ENV ENDS '+str(end_new - len(prot) + 1)+' AMINO ACIDS DOWNSTREAM!' prot = prot_new[:end_new + 1] elif -200 < end_diff < 0: print 'ENV ENDS '+str(len(prot) - 1 - end_new)+' AMINO ACIDS UPSTREAM!' prot = prot_new[:end_new + 1] else: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: print prot return False # Check tat2 (second exon of tat, should be complete) genename = 'tat2' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F6!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=15) if not check: return False geneseq = refseq[start: end] geneseq = geneseq[len(geneseq) % 3:] gene = geneseq.seq prot = gene.translate() check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: print 'ERROR IN TAT2 PREMATURE STOPS, CONTINUING!' # Check rev2 (second exon of rev, should be complete) genename = 'rev2' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in F6!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' # NOTE: rev2 overlaps with env gp41 and can have insertions or deletions gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=45) if not check: return False geneseq = refseq[start: end] geneseq = geneseq[len(geneseq) % 3:] gene = geneseq.seq prot = gene.translate() check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: # rev2 can end a bit early end_new = prot.rfind('*') if end_new != -1: if len(prot) - 1 - end_new < 20: print 'REV2 ENDS '+str(len(prot) - end_new - 1)+' AMINO ACIDS UPSTREAM!' prot = prot[:end_new + 1] else: return False else: # rev2 can also end quite a bit late gene_new = refseq.seq[start:] gene_new = gene_new[(end - start) % 3:] gene_new = gene_new[:len(gene_new) - (len(gene_new) % 3)] prot_new = gene_new.translate() end_new = prot_new.find('*') if (start + 3 * end_new) - end < 200: print 'REV2 ENDS '+str(end_new - len(prot) + 1)+' AMINO ACIDS DOWNSTREAM!' prot = prot_new[:end_new + 1] else: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False return True def check_genomewide(refseq, VERBOSE=0): '''Check the integrity of all genes in the genomewide consensus''' # Check single-exon genes length_tolerance = {'gag': 30, 'pol': 30, 'env': 70, 'vpr': 15, 'vpu': 15} for genename, tol in length_tolerance.iteritems(): (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in genomewide!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=tol) if not check: return False geneseq = refseq[start: end] gene = geneseq.seq check = check_has_complete_codons(gene, genename, VERBOSE=VERBOSE) if not check: # sometimes the gene ends a few nucleotides upstream, and there is a # frameshift mutation that screws up gene_new = refseq.seq[start:] gene_new = gene_new[:len(gene_new) - (len(gene_new) % 3)] prot_new = gene_new.translate() end_new = prot_new.find('*') end_diff = start + (3 * end_new + 3) - end if -90 < end_diff < 0: print genename.upper()+' ENDS '+str((end - start) // 3 - end_new - 1)+' AMINO ACIDS UPSTREAM!' gene = gene_new[:3 * (end_new + 1)] else: return False prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if (not check): if genename != 'vpu': return False else: print 'ERROR IN VPU STARTING CODON, CONTINUING!' check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: # sometimes a gene is a bit longer gene_new = refseq.seq[start:] gene_new = gene_new[:len(gene_new) - (len(gene_new) % 3)] prot_new = gene_new.translate() end_new = prot_new.find('*') end_diff = start + (3 * end_new + 3) - end if -90 < end_diff < 0: print genename.upper()+' ENDS '+str((end - start) // 3 - end_new - 1)+' AMINO ACIDS UPSTREAM!' gene = gene_new[:3 * (end_new + 1)] prot = gene.translate() elif 0 < end_diff < 90: print genename.upper()+' ENDS '+str(end_new + 1 - (end - start) // 3)+' AMINO ACIDS DOWNSTREAM!' gene = gene_new[:3 * (end_new + 1)] prot = gene.translate() else: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False # Vif is special because it can be longer than in HXB2 genename = 'vif' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in genomewide!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=15) if not check: return False geneseq = refseq[start: end] gene = geneseq.seq check = check_has_complete_codons(gene, genename, VERBOSE=VERBOSE) if not check: return False prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_end(prot, genename, VERBOSE=0) if not check: # Vif tends to be a bit longer than in HXB2 for nc in xrange(1, 4): gene_ext = refseq[start: end + 3 * nc].seq prot_ext = gene_ext.translate() check = check_has_end(prot_ext, genename, VERBOSE=0) if check: gene = gene_ext prot = prot_ext if VERBOSE: print 'WARNING: '+genename+' actually ends '+str(nc)+' codons downstream' break else: print 'ERROR: '+genename+' does not end, not even slightly downstream' return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False # Check 2-exon genes for genename_whole in ('tat', 'rev'): genename = genename_whole+'1' (start, end, start_found, end_found) = locate_gene(refseq, genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in genomewide!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=15) if not check: return False geneseq = refseq[start: end] geneseq = geneseq[:len(geneseq) - len(geneseq) % 3] gene = geneseq.seq prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False start_exon1 = start end_exon1 = end genename = genename_whole+'2' (start, end, start_found, end_found) = locate_gene(refseq[end_exon1 + 2000:], genename, VERBOSE=VERBOSE) if (not start_found) or (not end_found): print 'ERROR: '+genename+' not found in genomewide!' return False elif VERBOSE >= 3: print 'OK: start and end of '+genename+' found' start += end_exon1 + 2000 end += end_exon1 + 2000 # NOTE: rev2 overlaps with env gp41 and can have insertions or deletions if genename == 'rev2': tol = 45 else: tol = 15 gene_HXB2 = get_gene_HXB2(genename) check = check_has_similar_length(end - start, len(gene_HXB2), genename, VERBOSE=VERBOSE, maxdiff=tol) if not check: return False geneseq = refseq[start: end] frame = get_frame(geneseq, gene_HXB2, genename, VERBOSE=VERBOSE) geneseq = geneseq[frame:] gene = geneseq.seq prot = gene.translate() check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: if genename != 'rev2': return False else: # rev2 can end a bit early end_new = prot.rfind('*') if end_new != -1: if len(prot) - 1 - end_new < 20: print 'REV2 ENDS '+str(len(prot) - end_new - 1)+' AMINO ACIDS UPSTREAM!' prot = prot[:end_new + 1] end = start + frame + 3 * (end_new + 1) else: return False else: # rev2 can also end quite a bit late gene_new = refseq.seq[start:] gene_new = gene_new[(end - start) % 3:] gene_new = gene_new[:len(gene_new) - (len(gene_new) % 3)] prot_new = gene_new.translate() end_new = prot_new.find('*') if (start + 3 * end_new) - end < 200: print 'REV2 ENDS '+str(end_new - len(prot) + 1)+' AMINO ACIDS DOWNSTREAM!' prot = prot_new[:end_new + 1] end = start + ((end - start) % 3) + 3 * (end_new + 1) else: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False start_exon2 = start end_exon2 = end genename = genename_whole gene_HXB2 = get_gene_HXB2(genename) from Bio.SeqFeature import FeatureLocation gene_loc = FeatureLocation(start_exon1, end_exon1, strand=+1) + \ FeatureLocation(start_exon2, end_exon2, strand=+1) geneseq = gene_loc.extract(refseq) gene = geneseq.seq check = check_has_complete_codons(gene, genename, VERBOSE=VERBOSE) if not check: return False prot = gene.translate() check = check_start_aminoacid(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_end(prot, genename, VERBOSE=VERBOSE) if not check: return False check = check_has_premature_stops(prot, genename, VERBOSE=VERBOSE) if not check: return False return True def check_genes(refseq, frag_spec, VERBOSE=0): '''Check whether a gene is present and intact''' if frag_spec == 'genomewide': return check_genomewide(refseq, VERBOSE=VERBOSE) fragment = frag_spec[:2] spec = frag_spec[2:] if fragment == 'F1': return check_F1(refseq, spec, VERBOSE=VERBOSE) elif fragment == 'F2': return check_F2(refseq, spec, VERBOSE=VERBOSE) elif fragment == 'F3': return check_F3(refseq, spec, VERBOSE=VERBOSE) elif fragment == 'F4': return check_F4(refseq, spec, VERBOSE=VERBOSE) elif fragment == 'F5': return check_F5(refseq, spec, VERBOSE=VERBOSE) elif fragment == 'F6': return check_F6(refseq, spec, VERBOSE=VERBOSE) else: raise ValueError('Fragment '+fragment+' not implemented') # Script if __name__ == '__main__': # Parse input args parser = argparse.ArgumentParser(description='Check patient samples') parser.add_argument('--verbose', type=int, default=0, help='Verbosity level [0-3]') parser.add_argument('--patients', nargs='+', help='Patient to analyze') parser.add_argument('--fragments', nargs='+', help='Fragment to map (e.g. F1 F6)') parser.add_argument('--force', action='store_true', help='Ignore a single bad fragment and move to the next') args = parser.parse_args() VERBOSE = args.verbose pnames = args.patients use_force = args.force fragments = args.fragments if not fragments: fragments = ['F'+str(i) for i in xrange(1, 7)] if VERBOSE >= 3: print 'fragments', fragments patients = load_patients() if pnames is not None: patients = patients.loc[pnames] for pname, patient in patients.iterrows(): patient = Patient(patient) if VERBOSE >= 1: print 'Patient:', patient.name patient.discard_nonsequenced_samples() for fragment in fragments: if VERBOSE >= 1: print fragment # Check whether a reference exists at all ref_fn = patient.get_reference_filename(fragment) if not os.path.isfile(ref_fn): print 'ERROR: reference for fragment', fragment, 'not found!' continue elif VERBOSE >= 3: print 'OK: reference file found' refseq = SeqIO.read(ref_fn, 'fasta') # Check whether the consensus from the first sample is similar to # the reference for i, sample in enumerate(patient.itersamples()): if os.path.isfile(sample.get_consensus_filename(fragment)): sample_init_seq = sample.get_consensus(fragment) if (VERBOSE >= 1) and (i != 0): print 'Consensus from initial sample missing, taking time point', print 'n', i, '(start from zero)' break check = check_similarity_initial_sample(refseq, sample_init_seq, fragment, VERBOSE=VERBOSE) if not check: if not use_force: sys.exit() # Get the specific fragment for this consensus # NOTE: we only recently started hiding the frag spec in the reference name tmp = refseq.name.split('_')[-1] if (len(tmp) >= 3) and (tmp[:2] == fragment): frag_spec = tmp else: if fragment == 'F3': frag_spec = 'F3bo' elif fragment == 'F5': frag_spec = 'F5ao' else: frag_spec = fragment+'o' # Check whether genes are fine check = check_genes(refseq, frag_spec, VERBOSE=VERBOSE) if not check: print 'ERROR in', fragment if use_force: continue else: sys.exit() # Check genomewide if present ref_fn = patient.get_reference_filename('genomewide') if not os.path.isfile(ref_fn): if VERBOSE >= 1: print 'WARNING: genomewide reference not found' continue refseq = SeqIO.read(ref_fn, 'fasta') #n_diff = check_similarity_initial_sample(refseq, sample_init_seq, 'genomewide', # VERBOSE=VERBOSE) #if n_diff > 10: # print 'ERROR: genomewide reference is not similar to initial consensus ('+\ # str(n_diff)+' differences)' # continue if VERBOSE: print 'Genomewide' check = check_genes(refseq, 'genomewide', VERBOSE=VERBOSE) if not check: print 'ERROR in genomewide' sys.exit()
35.16753
119
0.602569
5,141
40,724
4.630422
0.07197
0.051754
0.083176
0.063054
0.765974
0.749002
0.710271
0.681706
0.667255
0.652384
0
0.017941
0.295133
40,724
1,157
120
35.197926
0.811357
0.051444
0
0.731982
0
0
0.08725
0
0
0
0
0
0
0
null
null
0
0.023649
null
null
0.108108
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
57e7d31d4fe20d7f923416487cc5d3eae977fd56
314
py
Python
src/tests/system/t347b.py
ArtemovSA/PyMite
a22fbae773b285ccf4993905a46dd396cb762f69
[ "OLDAP-2.6", "Python-2.0" ]
51
2015-03-24T07:53:03.000Z
2021-08-06T12:55:53.000Z
src/tests/system/t347b.py
ArtemovSA/PyMite
a22fbae773b285ccf4993905a46dd396cb762f69
[ "OLDAP-2.6", "Python-2.0" ]
null
null
null
src/tests/system/t347b.py
ArtemovSA/PyMite
a22fbae773b285ccf4993905a46dd396cb762f69
[ "OLDAP-2.6", "Python-2.0" ]
15
2015-04-09T14:17:27.000Z
2022-01-26T02:42:47.000Z
def bar1(): """__NATIVE__ PmReturn_t retval = PM_RET_OK; /* If wrong number of args, raise TypeError */ if (NATIVE_GET_NUM_ARGS() != 0) { PM_RAISE(retval, PM_RET_EX_TYPE); return retval; } NATIVE_SET_TOS(PM_NONE); return retval; """ pass def bar2(): return bar1()
16.526316
49
0.60828
43
314
4.046512
0.627907
0.091954
0.126437
0
0
0
0
0
0
0
0
0.017467
0.270701
314
18
50
17.444444
0.742358
0.710191
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0.25
0
0.25
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
1
1
0
0
5
17e297faccad5373cc95f6427eb2f04cde8758c5
106
py
Python
ckanext/harvest/logic/auth/patch.py
alphagov-mirror/ckanext-harvest
be4d134cf2e4d4548c67dc2f61b200948f0f74e0
[ "PostgreSQL" ]
86
2015-01-09T19:21:20.000Z
2022-03-23T07:17:27.000Z
ckanext/harvest/logic/auth/patch.py
alphagov-mirror/ckanext-harvest
be4d134cf2e4d4548c67dc2f61b200948f0f74e0
[ "PostgreSQL" ]
319
2015-01-13T13:40:08.000Z
2022-03-24T12:13:42.000Z
ckanext/harvest/logic/auth/patch.py
alphagov-mirror/ckanext-harvest
be4d134cf2e4d4548c67dc2f61b200948f0f74e0
[ "PostgreSQL" ]
154
2015-01-13T21:06:03.000Z
2022-03-15T12:10:57.000Z
import ckanext.harvest.logic.auth.update as _update harvest_source_patch = _update.harvest_source_update
26.5
52
0.867925
15
106
5.733333
0.6
0.302326
0.44186
0
0
0
0
0
0
0
0
0
0.075472
106
3
53
35.333333
0.877551
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
17f1ee9790eacea0c15c226b89ab12c8b91778f8
221
py
Python
src/models/__init__.py
LazyEval/housing-prices-firenze
c9e81554d86cbf54dfc12cca9b2d12725a8909a9
[ "MIT" ]
1
2020-10-14T21:16:03.000Z
2020-10-14T21:16:03.000Z
src/models/__init__.py
LazyEval/housing-prices-firenze
c9e81554d86cbf54dfc12cca9b2d12725a8909a9
[ "MIT" ]
null
null
null
src/models/__init__.py
LazyEval/housing-prices-firenze
c9e81554d86cbf54dfc12cca9b2d12725a8909a9
[ "MIT" ]
null
null
null
from .preprocessing_utils import CustomEncoder, ColumnSelector from .preprocessing_pipeline import preprocessing_pipeline from .model import Model __all__ = (CustomEncoder, ColumnSelector, preprocessing_pipeline, Model)
36.833333
72
0.864253
22
221
8.318182
0.409091
0.344262
0
0
0
0
0
0
0
0
0
0
0.090498
221
5
73
44.2
0.910448
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
aa2b32aceb703db15337d9c799bbc82cb3e8b57f
183
py
Python
samples/modules/module_use_4.py
nakednamor/naked-python
6580afe41c867888a08c5394d32c2bb4c60fa6d0
[ "MIT" ]
null
null
null
samples/modules/module_use_4.py
nakednamor/naked-python
6580afe41c867888a08c5394d32c2bb4c60fa6d0
[ "MIT" ]
null
null
null
samples/modules/module_use_4.py
nakednamor/naked-python
6580afe41c867888a08c5394d32c2bb4c60fa6d0
[ "MIT" ]
null
null
null
# you can import a module and use it with an alias # import module module_name as your_alias import module_definition as module_alias module_alias.method_a() module_alias.method_b()
26.142857
50
0.819672
32
183
4.4375
0.53125
0.232394
0.239437
0
0
0
0
0
0
0
0
0
0.136612
183
6
51
30.5
0.898734
0.480874
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5