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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9719dd0b81d1b9075b3a1e4a0b04e81cb9f0f034 | 915 | py | Python | src/ggrc/migrations/versions/20130724021606_2bf7c04016c9_person_email_must_be.py | Smotko/ggrc-core | b3abb58b24e7559960d71a94ba79c75539e7fe29 | [
"Apache-2.0"
] | null | null | null | src/ggrc/migrations/versions/20130724021606_2bf7c04016c9_person_email_must_be.py | Smotko/ggrc-core | b3abb58b24e7559960d71a94ba79c75539e7fe29 | [
"Apache-2.0"
] | 12 | 2015-01-08T14:50:19.000Z | 2017-11-29T19:37:53.000Z | src/ggrc/migrations/versions/20130724021606_2bf7c04016c9_person_email_must_be.py | mikecb/ggrc-core | 1cda560cb0920021416e07740c6cca1acba56268 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2015-01-08T13:25:09.000Z | 2015-01-08T13:25:09.000Z | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
"""Person.email must be unique
Revision ID: 2bf7c04016c9
Revises: d3af6d071ef
Create Date: 2013-07-24 02:16:06.282258
"""
# revision identifiers, used by Alembic.
revision = '2bf7c04016c9'
down_revision = 'd3af6d071ef'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint('uq_people_email', 'people', ['email'])
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('uq_people_email', 'people', type_='unique')
### end Alembic commands ###
| 28.59375 | 78 | 0.727869 | 118 | 915 | 5.567797 | 0.59322 | 0.041096 | 0.060883 | 0.070015 | 0.222222 | 0.133942 | 0.133942 | 0.133942 | 0 | 0 | 0 | 0.066838 | 0.149727 | 915 | 31 | 79 | 29.516129 | 0.777635 | 0.582514 | 0 | 0 | 0 | 0 | 0.22029 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
9724a53e6036c425eed527609249dc5e837db6a6 | 685 | py | Python | Catalan_Numbers/Python/jcla1/catalan.py | Mynogs/Algorithm-Implementations | 13a74821fc1f0f7becaa9fb63b98e94134936bdb | [
"MIT"
] | 1,184 | 2015-01-01T14:11:29.000Z | 2022-03-21T19:40:47.000Z | Catalan_Numbers/Python/jcla1/catalan.py | Mynogs/Algorithm-Implementations | 13a74821fc1f0f7becaa9fb63b98e94134936bdb | [
"MIT"
] | 89 | 2015-01-01T15:49:17.000Z | 2021-12-05T19:11:38.000Z | Catalan_Numbers/Python/jcla1/catalan.py | Mynogs/Algorithm-Implementations | 13a74821fc1f0f7becaa9fb63b98e94134936bdb | [
"MIT"
] | 388 | 2015-01-02T03:26:17.000Z | 2022-03-24T14:36:10.000Z | def catalan_direct(n):
return factorial(2 * n) / (factorial(n + 1) * factorial(n))
def catalan_binomial(n):
if n == 0: return 1
return binomial_coefficient(2 * n, n) - binomial_coefficient(2 * n, n - 1)
def catalan_sum(n):
return sum([binomial_coefficient(n, i) ** 2 for i in xrange(n + 1)]) / (n + 1)
def binomial_coefficient(n, k):
return factorial(n) / (factorial(k) * factorial(n - k))
def factorial(n):
return n * factorial(n-1) if n > 1 else 1
if __name__ == '__main__':
# Make sure all implementations give the same results
print(all([catalan_direct(n)
== catalan_binomial(n)
== catalan_sum(n) for n in xrange(100)])) | 32.619048 | 82 | 0.633577 | 106 | 685 | 3.924528 | 0.292453 | 0.144231 | 0.067308 | 0.057692 | 0.105769 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030132 | 0.224818 | 685 | 21 | 83 | 32.619048 | 0.753296 | 0.074453 | 0 | 0 | 0 | 0 | 0.012638 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.266667 | 0.666667 | 0.066667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
973acfd3901ad069b2fdfb5a8915dd3eb1316973 | 187 | py | Python | vis_utils/tb_logging.py | lknak/tigr | 614a6435c483a25cb8183c08184d140120053a4f | [
"MIT"
] | null | null | null | vis_utils/tb_logging.py | lknak/tigr | 614a6435c483a25cb8183c08184d140120053a4f | [
"MIT"
] | null | null | null | vis_utils/tb_logging.py | lknak/tigr | 614a6435c483a25cb8183c08184d140120053a4f | [
"MIT"
] | 2 | 2022-01-21T07:49:27.000Z | 2022-02-05T13:23:18.000Z | from torch.utils.tensorboard import SummaryWriter
TENSORBOARD_LOGGER : SummaryWriter
TRAINING_LOG_STEP = 0
AUGMENTATION_LOG_STEP = 0
TI_LOG_STEP = 0
DEBUG_LOG_STEP = 0
LOG_INTERVAL = -1 | 20.777778 | 49 | 0.828877 | 28 | 187 | 5.178571 | 0.571429 | 0.193103 | 0.22069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030488 | 0.122995 | 187 | 9 | 50 | 20.777778 | 0.853659 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
974eec00dee959b5d38def6fdb40830000173ec8 | 66 | py | Python | notebooks/_solutions/case2_biodiversity_analysis13.py | rprops/Python_DS-WS | b2fc449a74be0c82863e5fcf1ddbe7d64976d530 | [
"BSD-3-Clause"
] | 65 | 2017-03-21T09:15:40.000Z | 2022-02-01T23:43:08.000Z | notebooks/_solutions/case2_biodiversity_analysis13.py | rprops/Python_DS-WS | b2fc449a74be0c82863e5fcf1ddbe7d64976d530 | [
"BSD-3-Clause"
] | 100 | 2016-12-15T03:44:06.000Z | 2022-03-07T08:14:07.000Z | notebooks/_solutions/case2_biodiversity_analysis13.py | rprops/Python_DS-WS | b2fc449a74be0c82863e5fcf1ddbe7d64976d530 | [
"BSD-3-Clause"
] | 52 | 2016-12-19T07:48:52.000Z | 2022-02-19T17:53:48.000Z | survey_data = survey_data_unique.dropna(subset=['species']).copy() | 66 | 66 | 0.787879 | 9 | 66 | 5.444444 | 0.777778 | 0.408163 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 66 | 1 | 66 | 66 | 0.765625 | 0 | 0 | 0 | 0 | 0 | 0.104478 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
97681a1718c4a517019e57b4ad483c882fcd2d37 | 1,797 | py | Python | tests/test_models/test_users.py | 30ideas-Software-Factory/readIT | 74b5e1391b88d6919786f1f93e723913a73e9efe | [
"Unlicense"
] | 5 | 2021-05-28T22:49:46.000Z | 2021-07-02T22:17:37.000Z | tests/test_models/test_users.py | 30ideas-Software-Factory/readIT | 74b5e1391b88d6919786f1f93e723913a73e9efe | [
"Unlicense"
] | 12 | 2021-05-29T18:57:14.000Z | 2021-06-08T14:24:13.000Z | tests/test_models/test_users.py | 30ideas-Software-Factory/readIT | 74b5e1391b88d6919786f1f93e723913a73e9efe | [
"Unlicense"
] | 7 | 2021-06-20T22:11:14.000Z | 2021-06-28T18:58:30.000Z | #!/usr/bin/python3
""" Contains the Test User class """
from models.users import User
from models.baseModel import BaseModel
import unittest
class TestUser(unittest.TestCase):
"""Test the User class"""
def test_is_subclass(self):
"""Test that User is a subclass of BaseModel"""
user = User()
self.assertIsInstance(user, BaseModel)
def test_init_(self):
user = User()
self.assertTrue(hasattr(user, "IdUser"))
self.assertTrue(hasattr(user, "FirstName"))
self.assertTrue(hasattr(user, "LastName"))
self.assertTrue(hasattr(user, "Phone"))
self.assertTrue(hasattr(user, "Mail"))
self.assertTrue(hasattr(user, "Password"))
self.assertTrue(hasattr(user, "City"))
def test_to_dict_values(self):
"""test that values in dict returned from to_dict are correct"""
eva = {'FirstName': 'Eva',
'LastName': 'DaughterOfGod',
'Mail': 'evacontacto@readIT',
'Password': 'Hola',
'Phone': '59899101010',
'City': 'Paradise'}
u = User(**eva)
new_d = u.to_dict()
self.assertEqual(new_d["Class"], "User")
self.assertEqual(type(new_d["IdUser"]), str)
self.assertEqual(type(new_d["FirstName"]), str)
self.assertEqual(type(new_d["LastName"]), str)
self.assertEqual(type(new_d["Phone"]), str)
self.assertEqual(type(new_d["Mail"]), str)
self.assertEqual(type(new_d["Password"]), str)
self.assertEqual(type(new_d["City"]), str)
def test_str(self):
"""test that the str method has the correct output"""
user = User()
string = "[User] ({}) {}".format(user.IdUser, user.__dict__)
self.assertEqual(string, str(user))
| 36.673469 | 72 | 0.601002 | 209 | 1,797 | 5.057416 | 0.282297 | 0.034059 | 0.139073 | 0.165563 | 0.169347 | 0.147588 | 0 | 0 | 0 | 0 | 0 | 0.008869 | 0.247078 | 1,797 | 48 | 73 | 37.4375 | 0.772358 | 0.1202 | 0 | 0.081081 | 0 | 0 | 0.132561 | 0 | 0 | 0 | 0 | 0 | 0.459459 | 1 | 0.108108 | false | 0.081081 | 0.081081 | 0 | 0.216216 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
97816564e1874e02b5c0cd54d1cf752b6659b9a3 | 768 | py | Python | graphtiny/api.py | Canicio/pyqtgraph-tiny | b88ebe8a2e6ad860ca4857b527adccbbde14851d | [
"MIT"
] | 1 | 2018-03-17T12:36:56.000Z | 2018-03-17T12:36:56.000Z | graphtiny/api.py | Canicio/pyqtgraph-tiny | b88ebe8a2e6ad860ca4857b527adccbbde14851d | [
"MIT"
] | 1 | 2017-08-08T18:31:31.000Z | 2017-08-08T18:31:31.000Z | graphtiny/api.py | Canicio/graphtiny | b88ebe8a2e6ad860ca4857b527adccbbde14851d | [
"MIT"
] | null | null | null | from abc import ABCMeta, abstractmethod
from numpy.core.records import ndarray
from graphtiny.domain import Chart, DataStreamWindow
class IChart(metaclass=ABCMeta):
@abstractmethod
def set_data_stream(self, chart: Chart, x: ndarray, y: ndarray) -> None:
"""
Introduces data stream in the chart
:param chart: A Chart object
:param x: A numpy array representing data stream of the x-axis
:param y: A numpy array representing data stream of the y-axis
"""
class IDataStreamWindow(metaclass=ABCMeta):
@abstractmethod
def launch_window(self, window: DataStreamWindow) -> None:
"""
Displays the window with its graphic content
:param window: A DataStreamWindow object
"""
| 29.538462 | 76 | 0.684896 | 93 | 768 | 5.623656 | 0.451613 | 0.076482 | 0.114723 | 0.126195 | 0.145315 | 0.145315 | 0.145315 | 0.145315 | 0 | 0 | 0 | 0 | 0.24349 | 768 | 25 | 77 | 30.72 | 0.900172 | 0.359375 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
9797b5af874059d81d0e5f547824f391670ed073 | 56 | py | Python | gnoll/actions/dispatch.py | gnoll-project/gnoll-python | cf2540d2220733ba2203d86ca939fa64f38d0af0 | [
"MIT"
] | null | null | null | gnoll/actions/dispatch.py | gnoll-project/gnoll-python | cf2540d2220733ba2203d86ca939fa64f38d0af0 | [
"MIT"
] | null | null | null | gnoll/actions/dispatch.py | gnoll-project/gnoll-python | cf2540d2220733ba2203d86ca939fa64f38d0af0 | [
"MIT"
] | null | null | null | from pyee import EventEmitter
dispatch = EventEmitter()
| 18.666667 | 29 | 0.821429 | 6 | 56 | 7.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 56 | 2 | 30 | 28 | 0.938776 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
97992e047d22c07ba264c49af6fa5aef078bd341 | 905 | py | Python | pydrift/decorators.py | sergiocalde94/pydrift | 8d8968ca80895cc31e86bc55df57ad64712e36d8 | [
"MIT"
] | 18 | 2020-06-27T21:05:18.000Z | 2021-12-20T15:14:57.000Z | pydrift/decorators.py | sergiocalde94/pydrift | 8d8968ca80895cc31e86bc55df57ad64712e36d8 | [
"MIT"
] | 5 | 2021-02-03T17:53:53.000Z | 2021-04-23T14:03:36.000Z | pydrift/decorators.py | sergiocalde94/pydrift | 8d8968ca80895cc31e86bc55df57ad64712e36d8 | [
"MIT"
] | 7 | 2020-06-07T10:51:41.000Z | 2021-06-13T20:23:28.000Z | from functools import wraps
def check_optional_module(_func=None,
*,
has_module: bool,
exception_message: str):
def decorator_check_optional_module(func):
@wraps(func)
def wrapper_check_optional_module(*args, **kwargs):
if not has_module:
raise ModuleNotFoundError(exception_message)
return func(*args, **kwargs)
return wrapper_check_optional_module
if _func is None:
return decorator_check_optional_module
else:
return decorator_check_optional_module(_func)
def track_calls(func):
@wraps(func)
def wrapper_track_calls(*args, **kwargs):
wrapper_track_calls.has_been_called_ids.append(id(args[0]))
return func(*args, **kwargs)
wrapper_track_calls.has_been_called_ids = []
return wrapper_track_calls
| 31.206897 | 67 | 0.640884 | 102 | 905 | 5.303922 | 0.333333 | 0.144177 | 0.210721 | 0.127542 | 0.428835 | 0.158965 | 0.158965 | 0.158965 | 0.158965 | 0 | 0 | 0.001546 | 0.285083 | 905 | 28 | 68 | 32.321429 | 0.834621 | 0 | 0 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.043478 | 0 | 0.521739 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
97c4ceb646afbf2252dacae9ae06cb0ea8c68412 | 327 | py | Python | simplemap/html_render.py | patrick--/simplemap | 1c0a9de1a9c2e35b73f3068511b9c17bc389ba50 | [
"MIT"
] | 126 | 2015-12-31T17:31:40.000Z | 2020-01-21T19:45:27.000Z | simplemap/html_render.py | ptrks/simplemap | 1c0a9de1a9c2e35b73f3068511b9c17bc389ba50 | [
"MIT"
] | 7 | 2016-01-01T17:10:02.000Z | 2018-08-09T08:16:19.000Z | simplemap/html_render.py | ptrks/simplemap | 1c0a9de1a9c2e35b73f3068511b9c17bc389ba50 | [
"MIT"
] | 14 | 2015-12-31T21:49:29.000Z | 2017-09-13T06:19:32.000Z |
"""
simplemap.html_render
~~~~~~~~~~~~~~~~~~~~~
This module contains everything related to Jinja2 HTML rendering.
"""
from jinja2 import Undefined
class SilentUndefined(Undefined):
""" Allow Jinja2 to continue rendering if undefined tag is parsed """
def _fail_with_undefined_error(self, *args, **kwargs):
return None | 20.4375 | 70 | 0.718654 | 39 | 327 | 5.897436 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010676 | 0.140673 | 327 | 16 | 71 | 20.4375 | 0.807829 | 0.529052 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c12f3aad32b9c24ae341c2d85562fa4d677a6dca | 89 | py | Python | notebooks/classic/exercise/matplotlib-subplots.py | kmunve/ml-workshop | 96a42e663bb656e97231eff17ef4ca21e2a14b0e | [
"MIT"
] | 3 | 2020-02-17T13:35:56.000Z | 2020-10-22T13:15:28.000Z | notebooks/classic/exercise/matplotlib-subplots.py | kmunve/ml-workshop | 96a42e663bb656e97231eff17ef4ca21e2a14b0e | [
"MIT"
] | 7 | 2020-02-09T17:52:44.000Z | 2020-02-09T17:52:53.000Z | notebooks/classic/exercise/matplotlib-subplots.py | kmunve/ml-workshop | 96a42e663bb656e97231eff17ef4ca21e2a14b0e | [
"MIT"
] | 4 | 2019-07-22T17:05:52.000Z | 2020-01-23T12:17:59.000Z | fig, ax = plt.subplots(2, sharex='all', figsize=(10, 5))
fig.savefig("two-subplots.png") | 29.666667 | 56 | 0.674157 | 15 | 89 | 4 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049383 | 0.089888 | 89 | 3 | 57 | 29.666667 | 0.691358 | 0 | 0 | 0 | 0 | 0 | 0.211111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c13c4bfee1c9c7430580db61de18561beb73453a | 157 | py | Python | test/integration/default/testinfra/test_docker.py | joe-bowman/docker-formula | efc3cc4ecb86163b179d476ebaf96d9a2fc1d476 | [
"Apache-2.0"
] | null | null | null | test/integration/default/testinfra/test_docker.py | joe-bowman/docker-formula | efc3cc4ecb86163b179d476ebaf96d9a2fc1d476 | [
"Apache-2.0"
] | null | null | null | test/integration/default/testinfra/test_docker.py | joe-bowman/docker-formula | efc3cc4ecb86163b179d476ebaf96d9a2fc1d476 | [
"Apache-2.0"
] | null | null | null | import testinfra
def test_service_is_running_and_enabled(Service):
docker = Service('docker')
assert docker.is_running
assert docker.is_enabled
| 22.428571 | 49 | 0.783439 | 21 | 157 | 5.52381 | 0.52381 | 0.155172 | 0.241379 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152866 | 157 | 6 | 50 | 26.166667 | 0.87218 | 0 | 0 | 0 | 0 | 0 | 0.038217 | 0 | 0 | 0 | 0 | 0 | 0.4 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c16e57e83faead3659a5fd36f3a7c633cdd84012 | 330 | py | Python | app/app/tests.py | aniket463/recipe-app-api | 64d390bea67f840f0d056f6fdb36eb30236be64b | [
"MIT"
] | null | null | null | app/app/tests.py | aniket463/recipe-app-api | 64d390bea67f840f0d056f6fdb36eb30236be64b | [
"MIT"
] | null | null | null | app/app/tests.py | aniket463/recipe-app-api | 64d390bea67f840f0d056f6fdb36eb30236be64b | [
"MIT"
] | null | null | null | from django.test import TestCase
from app.calc import substraction
from app.calc import add
class CalcTests(TestCase):
def test_add_number(self):
#Test that two number added togather
self.assertEqual(add(3,8), 11)
def test_substraction_number(self):
self.assertEqual(substraction(8,3),5)
| 27.5 | 45 | 0.709091 | 46 | 330 | 5 | 0.5 | 0.06087 | 0.095652 | 0.147826 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02682 | 0.209091 | 330 | 12 | 46 | 27.5 | 0.854406 | 0.106061 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.375 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
c17bdf43121bff61f06c96f3d74874b39434a71f | 267 | py | Python | app1/callbacks.py | DrGFreeman/multi-dash | 377788c4404a9f7b59ba0dbfb697b4db074fdbd4 | [
"Unlicense"
] | null | null | null | app1/callbacks.py | DrGFreeman/multi-dash | 377788c4404a9f7b59ba0dbfb697b4db074fdbd4 | [
"Unlicense"
] | null | null | null | app1/callbacks.py | DrGFreeman/multi-dash | 377788c4404a9f7b59ba0dbfb697b4db074fdbd4 | [
"Unlicense"
] | null | null | null | from datetime import datetime
from dash.dependencies import Input, Output
from app1 import app
@app.callback(Output('placeholder', 'children'),
[Input('update_button', 'n_clicks')])
def update(n_clicks):
return datetime.now().strftime('%H:%M:%S') | 26.7 | 51 | 0.700375 | 35 | 267 | 5.257143 | 0.657143 | 0.076087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004425 | 0.153558 | 267 | 10 | 52 | 26.7 | 0.809735 | 0 | 0 | 0 | 0 | 0 | 0.179104 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0.142857 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
c181b677ca0d130f4ba82570047a76315f9bae27 | 1,266 | py | Python | test/should-work/client.py | dragazo/PyBlox | 52e895090708810f4af18da746b90278e4ee82f7 | [
"Apache-2.0"
] | 2 | 2021-08-16T14:25:11.000Z | 2021-12-11T19:38:15.000Z | test/should-work/client.py | dragazo/PyBlox | 52e895090708810f4af18da746b90278e4ee82f7 | [
"Apache-2.0"
] | null | null | null | test/should-work/client.py | dragazo/PyBlox | 52e895090708810f4af18da746b90278e4ee82f7 | [
"Apache-2.0"
] | 1 | 2021-09-24T15:32:49.000Z | 2021-09-24T15:32:49.000Z | #!/usr/bin/env python
import netsblox
editor = netsblox.Editor()
phoneiot = editor.phone_iot
public_roles = editor.public_roles
assert type(phoneiot.get_sensors()) == list
assert public_roles.get_public_role_id() == editor.get_public_role_id()
assert phoneiot.get_color(12, 34, 54, 34) == 571220534
assert phoneiot.get_color(12, 34, 54) == -15982026
assert phoneiot.get_color(12, 34, blue=54) == -15982026
assert phoneiot.get_color(12, blue=54, green=34) == -15982026
assert type(editor.chart.default_options()) == dict
v = editor.hurricane_data.get_hurricane_data('katrina', 2005)
assert type(v) == list
for x in v:
assert type(x) == dict
assert netsblox.prep_send(12) == 12
assert netsblox.prep_send(12.5) == 12.5
assert netsblox.prep_send([1, 2, 3]) == [1, 2, 3]
assert netsblox.prep_send((1, 2, 3)) == [1, 2, 3]
assert netsblox.prep_send({ 'key': 'value' }) == [['key', 'value']]
assert netsblox.prep_send({ 'key': { 'more': 'stuff' } }) == [[ 'key', [[ 'more', 'stuff' ]] ]]
assert netsblox.prep_send([{ 'a': 1 }, { 'b': 2 }]) == [ [[ 'a', 1 ]], [[ 'b', 2 ]] ]
assert netsblox.prep_send(({ 'a': 1 }, { 'b': 2 })) == [ [[ 'a', 1 ]], [[ 'b', 2 ]] ]
assert netsblox.prep_send({ (1, 2, 3): 4 }) == [[ [1, 2, 3], 4 ]]
assert netsblox.prep_send(None) == ''
| 38.363636 | 95 | 0.636651 | 193 | 1,266 | 4.025907 | 0.274611 | 0.18018 | 0.23166 | 0.28314 | 0.467181 | 0.369369 | 0.366795 | 0.20592 | 0.20592 | 0.20592 | 0 | 0.093173 | 0.14376 | 1,266 | 32 | 96 | 39.5625 | 0.623616 | 0.015798 | 0 | 0 | 0 | 0 | 0.044177 | 0 | 0 | 0 | 0 | 0 | 0.76 | 1 | 0 | false | 0 | 0.04 | 0 | 0.04 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c1b891e7d61a9e3e64538ab34a986ee96aa12260 | 2,866 | py | Python | corehq/ex-submodules/phonelog/migrations/0006_auto__chg_field_devicereportentry_app_version__chg_field_devicereporte.py | dslowikowski/commcare-hq | ad8885cf8dab69dc85cb64f37aeaf06106124797 | [
"BSD-3-Clause"
] | 1 | 2015-02-10T23:26:39.000Z | 2015-02-10T23:26:39.000Z | corehq/ex-submodules/phonelog/migrations/0006_auto__chg_field_devicereportentry_app_version__chg_field_devicereporte.py | SEL-Columbia/commcare-hq | 992ee34a679c37f063f86200e6df5a197d5e3ff6 | [
"BSD-3-Clause"
] | null | null | null | corehq/ex-submodules/phonelog/migrations/0006_auto__chg_field_devicereportentry_app_version__chg_field_devicereporte.py | SEL-Columbia/commcare-hq | 992ee34a679c37f063f86200e6df5a197d5e3ff6 | [
"BSD-3-Clause"
] | null | null | null | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'DeviceReportEntry.app_version'
db.alter_column(u'phonelog_devicereportentry', 'app_version', self.gf('django.db.models.fields.TextField')(null=True))
# Changing field 'DeviceReportEntry.device_id'
db.alter_column(u'phonelog_devicereportentry', 'device_id', self.gf('django.db.models.fields.CharField')(max_length=50, null=True))
def backwards(self, orm):
# Changing field 'DeviceReportEntry.app_version'
db.alter_column(u'phonelog_devicereportentry', 'app_version', self.gf('django.db.models.fields.TextField')(default=''))
# Changing field 'DeviceReportEntry.device_id'
db.alter_column(u'phonelog_devicereportentry', 'device_id', self.gf('django.db.models.fields.CharField')(default='', max_length=50))
models = {
u'phonelog.devicereportentry': {
'Meta': {'unique_together': "[('xform_id', 'i')]", 'object_name': 'DeviceReportEntry'},
'app_version': ('django.db.models.fields.TextField', [], {'null': 'True'}),
'date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'device_id': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'db_index': 'True'}),
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'}),
'i': ('django.db.models.fields.IntegerField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'msg': ('django.db.models.fields.TextField', [], {}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'db_index': 'True'}),
'xform_id': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
},
u'phonelog.userentry': {
'Meta': {'unique_together': "[('xform_id', 'i')]", 'object_name': 'UserEntry'},
'i': ('django.db.models.fields.IntegerField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'sync_token': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'user_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'username': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'}),
'xform_id': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
}
}
complete_apps = ['phonelog']
| 54.075472 | 140 | 0.60328 | 318 | 2,866 | 5.279874 | 0.207547 | 0.10006 | 0.166766 | 0.238237 | 0.775462 | 0.746873 | 0.746873 | 0.697439 | 0.630733 | 0.570578 | 0 | 0.011578 | 0.186322 | 2,866 | 52 | 141 | 55.115385 | 0.708405 | 0.069435 | 0 | 0.166667 | 0 | 0 | 0.504697 | 0.300639 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.111111 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c1d8533dc5b50c1147107c9c121f06d5e5bfcd69 | 1,318 | py | Python | spectator/gauge.py | brharrington/spectator-py | 08001c29be458e3b0de24292738441c04c2b3fbc | [
"Apache-2.0"
] | 46 | 2019-02-06T13:20:54.000Z | 2021-12-05T02:33:35.000Z | spectator/gauge.py | brharrington/spectator-py | 08001c29be458e3b0de24292738441c04c2b3fbc | [
"Apache-2.0"
] | 9 | 2018-04-26T22:07:19.000Z | 2022-01-20T00:45:42.000Z | spectator/gauge.py | brharrington/spectator-py | 08001c29be458e3b0de24292738441c04c2b3fbc | [
"Apache-2.0"
] | 18 | 2018-04-26T22:00:00.000Z | 2021-10-21T04:40:42.000Z | from abc import ABCMeta, abstractmethod
from future.utils import with_metaclass
from spectator.atomicnumber import AtomicNumber
from spectator.clock import SystemClock
class AbstractGauge(with_metaclass(ABCMeta)):
@abstractmethod
def get(self):
pass
@abstractmethod
def set(self, value):
pass
@abstractmethod
def _measure(self):
pass
class NoopGauge(AbstractGauge):
def get(self):
return 0
def set(self, value):
pass
def _measure(self):
return {}
class Gauge(AbstractGauge):
ttl = 15 * 60
def __init__(self, meterId, clock=SystemClock()):
self.meterId = meterId
self._clock = clock
self._last_update = AtomicNumber(float('nan'))
self._value = AtomicNumber(float('nan'))
def get(self):
return self._value.get()
def set(self, value):
self._last_update.set(self._clock.wall_time())
self._value.set(value)
def _has_expired(self):
return (self._clock.wall_time() - self._last_update.get()) > self.ttl
def _measure(self):
id = self.meterId.with_default_stat('gauge')
if self._has_expired():
v = self._value.get_and_set(float('nan'))
else:
v = self._value.get()
return {id: v}
| 20.920635 | 77 | 0.626707 | 156 | 1,318 | 5.083333 | 0.294872 | 0.090794 | 0.037831 | 0.056747 | 0.100883 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005171 | 0.266313 | 1,318 | 62 | 78 | 21.258065 | 0.814891 | 0 | 0 | 0.380952 | 0 | 0 | 0.010622 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.261905 | false | 0.095238 | 0.095238 | 0.095238 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
c1dca4278a150c965a6fa445d1242b2411276737 | 47,762 | py | Python | ice/parser/parser.py | i2y/ice | db9abf04fbd0b256f13507900a4e5129e65b71a0 | [
"MIT"
] | null | null | null | ice/parser/parser.py | i2y/ice | db9abf04fbd0b256f13507900a4e5129e65b71a0 | [
"MIT"
] | null | null | null | ice/parser/parser.py | i2y/ice | db9abf04fbd0b256f13507900a4e5129e65b71a0 | [
"MIT"
] | null | null | null | import warnings
from collections import Sequence
import rply
from rply import ParserGenerator
from ice import __version__
from . import lexer
name_seq = 0
def get_temp_name():
global name_seq
name_seq += 1
name_symbol = Symbol('_gs%s' % name_seq)
return name_symbol
class ParsingError(Exception):
def __init__(self, file_path, lineno=1, colno=1):
self.file_path = file_path
self.lineno = lineno
self.colno = colno
def __str__(self):
return 'ParsingError: file=' \
+ self.file_path\
+ ' lineno='\
+ str(self.lineno)\
+ ' colno='\
+ str(self.colno)
def parse(lexer, filename="<string>"):
try:
with warnings.catch_warnings():
warnings.simplefilter('ignore')
return pg.build().parse(lexer)
except rply.errors.ParsingError as e:
source_pos = e.getsourcepos()
if source_pos is None:
raise ParsingError(filename)
else:
raise ParsingError(filename,
source_pos.lineno,
source_pos.colno)
class Symbol(object):
def __init__(self, name, lineno=0, col_offset=0):
self.name = name
self.outer_name = name
self.lineno = lineno
self.col_offset = col_offset
def eval(self, env):
pass
def __repr__(self):
return self.outer_name
def __str__(self):
return self.outer_name
def __eq__(self, other):
if type(other) is not Symbol:
return False
if self.name == other.name:
return True
else:
return False
def __hash__(self):
return (self.name.__hash__() << 16) + self.outer_name.__hash__()
class Keyword(object):
def __init__(self, name, lineno=0, col_offset=0):
self.name = name
self.lineno = lineno
self.col_offset = col_offset
self.repr = ':' + self.name
def __repr__(self):
return self.repr
def __str__(self):
return self.name
def __call__(self, table):
return table[self.name]
def __eq__(self, other):
if type(other) is not Keyword:
return False
if self.name == other.name:
return True
else:
return False
def __hash__(self):
return self.name.__hash__()
pg = ParserGenerator(['NUMBER', 'OPPLUS', 'OPMINUS', 'OPTIMES', 'OPDIV', 'OPLEQ', 'OPGEQ', 'OPEQ', 'OPNEQ',
'OPLT', 'OPGT', 'OPBITOR', 'OPPOW', 'MACRO_NAME', 'LET', # 'UNION', 'PREDICATE',
'INFIX_MACRO_NAME', 'INFIX_1_MACRO_NAME', 'INFIX_2_MACRO_NAME', 'INFIX', 'INFIX_1', 'INFIX_2',
'OPRSHIFT', 'OPLSHIFT', 'OPFLOORDIV', 'OPBITAND', 'OPBITXOR', 'USER_DEFINED_KEYWORD',
'OPAND', 'OPOR', 'OPIS', 'NOT', 'PERCENT', 'EXPORT', 'ASSERT',
'LPAREN', 'RPAREN', 'TRUE', 'FALSE', 'TQUOTE_STR', 'DQUOTE_STR', 'SQUOTE_STR', 'NAME_LPAREN',
'AT', 'DOT_NAME', 'DOT_NAME_LPAREN', 'TQUOTE_RAW_STR', 'DQUOTE_RAW_STR', 'SQUOTE_RAW_STR',
'NAME', 'EQUALS', 'IF', 'ELSEIF', 'ELSE', 'COLON', 'SEMI', 'DATA', 'IMPORT', 'INCLUDE',
'LBRACK', 'RBRACK', 'COMMA', 'FUNC', 'DOC', 'CALET', 'PIPELINE', 'PIPELINE_BIND',
'PIPELINE_FIRST', 'PIPELINE_FIRST_BIND', 'RETURN', 'CALL', 'DO',
'LBRACE', 'RBRACE', 'MATCH', 'CASE', 'DEFM', 'RECORD', 'AMP', 'FATARROW', 'THINARROW',
'YIELD', 'FROM', 'USE', 'FOR', 'IN', 'TRY', 'FINALLY', 'EXCEPT',
'AS', 'RAISE', 'WITH', 'MACRO', 'QUOTE', 'QUASI_QUOTE', 'UNQUOTE', 'UNQUOTE_SPLICING',
'QUOTE_LPAREN', 'QUASI_QUOTE_LPAREN', 'UNQUOTE_LPAREN', 'UNQUOTE_SPLICING_LPAREN'],
precedence=[('left', ['EQUALS']),
('left', ['NOT']),
('left', ['OPIS']),
('left', ['IN']),
('left', ['AS', 'OPEQ', 'OPLEQ', 'OPGEQ', 'OPNEQ', 'OPLT', 'OPGT', 'OPAND', 'OPOR',
'PIPELINE', 'PIPELINE_BIND', 'PIPELINE_FIRST', 'PIPELINE_FIRST_BIND',
'INFIX_MACRO_NAME']),
('left', ['OPPLUS', 'OPMINUS', 'INFIX_1_MACRO_NAME']),
('left', ['LBRACK', 'RBRACK']),
('left', ['OPTIMES', 'OPDIV', 'OPFLOORDIV', 'PERCENT', 'OPBITAND', 'OPBITOR',
'OPBITXOR', 'OPPOW', 'OPRSHIFT', 'OPLSHIFT', 'INFIX_2_MACRO_NAME']),
('left', ['IF'])],
cache_id='ice_' + __version__)
@pg.production('program : block')
def program(p):
return p[0]
@pg.production('block : stmts')
def block(p):
return p[0]
@pg.production('stmts : stmts stmt')
def stmts_b(p):
if p[1] is None:
return p[0]
else:
return p[0] + [p[1]]
@pg.production('stmts : stmt')
def stmts_stmt(p):
if p[0] is None:
return []
else:
return [p[0]]
@pg.production('stmt : SEMI')
def stmt_semi(p):
pass
@pg.production('stmt : binop_expr')
@pg.production('stmt : let_expr')
@pg.production('stmt : as_expr')
@pg.production('stmt : deco_expr')
@pg.production('stmt : func_expr')
@pg.production('stmt : funcm_expr')
# @pg.production('stmt : record_expr')
@pg.production('stmt : data_expr')
@pg.production('stmt : import_expr')
@pg.production('stmt : from_expr')
@pg.production('stmt : macros_stmt')
@pg.production('stmt : try_stmt')
@pg.production('stmt : with_stmt')
@pg.production('stmt : raise_stmt')
@pg.production('stmt : return_stmt')
@pg.production('stmt : macro_stmt')
@pg.production('stmt : infix_macro_stmt')
@pg.production('stmt : q_stmt')
@pg.production('stmt : qq_stmt')
@pg.production('stmt : assert_stmt')
def stmt(p):
return p[0]
# # TODO fukkatu?
# @pg.production('call_macro_stmt : id_expr COLON do_suite')
# def call_macro_stmt(p):
# head = []
# body = p[2]
# rest = []
# return process_calling_macro(p[0], head, body, rest)
# @pg.production('call_macro_stmt : id_expr COLON do_suite rest')
# def call_macro_expr(p):
# head = []
# body = p[2]
# rest = p[3]
# return process_calling_macro(p[0], head, body, rest)
@pg.production('import_expr : IMPORT names_list')
def import_expr(p):
return [Symbol('import')] + p[1]
@pg.production('names_list : names_list COMMA names')
def names(p):
return p[0] + [p[2]]
@pg.production('names_list : names')
def names_single(p):
return [p[0]]
@pg.production('names : _names')
def names(p):
return Symbol('.'.join(p[0]))
@pg.production('_names : NAME')
def _names_one(p):
return [p[0].getstr()]
@pg.production('_names : _names DOT_NAME')
def _names(p):
return p[0] + [p[1].getstr()[1:]]
@pg.production('names_lparen : _names_lparen')
def names(p):
return Symbol('.'.join(p[0]))
@pg.production('_names_lparen : NAME_LPAREN')
def _names_one(p):
return [p[0].getstr()[:-1]]
@pg.production('_names_lparen : _names DOT_NAME_LPAREN')
def _names(p):
return p[0] + [p[1].getstr()[1:-1]]
# @pg.production('include_expr : INCLUDE string')
# def include_expr(p):
# return [Symbol('require'), p[1]]
@pg.production('lbrace : LBRACE')
def lbrace(p):
pass
@pg.production('rbrace : RBRACE')
def rbrace(p):
pass
@pg.production('namelist : namelist COMMA name')
def names(p):
return p[0] + [p[2]]
@pg.production('namelist : name')
def names_single(p):
return [p[0]]
@pg.production('name : NAME')
def name(p):
return token_to_symbol(p[0])
@pg.production('tuple_elt : binop_expr COMMA')
def tuple_elt(p):
return p[0]
@pg.production('from_expr : FROM names IMPORT namelist')
def from_expr(p):
return [Symbol('from_import'), p[1], p[3]]
@pg.production('macros_stmt : USE lbrace use_expr_list rbrace')
def macros_stmt(p):
return [Symbol('do')] + p[2]
@pg.production('use_expr_list : use_expr')
def macros_stmt(p):
return [p[0]]
@pg.production('use_expr_list : use_expr_list use_expr')
def macros_stmt(p):
return p[0] + p[1]
@pg.production('use_expr : namelist FROM names')
def use_expr(p):
filename = p[1].filename
module_name = p[2].name
import importlib
mod = importlib.import_module(module_name)
if hasattr(mod, 'get_keywords'):
keywords = mod.get_keywords()
else:
keywords = {}
for macro_name in p[0]:
macro_name_str = str(macro_name)
lexer.add_macro_name((filename, macro_name_str))
if macro_name_str in keywords:
for user_defined_keyword in keywords[macro_name_str]:
print(user_defined_keyword)
lexer.add_user_defined_keyword((filename, user_defined_keyword))
# else:
# raise SyntaxError(macro_name_str)
return [Symbol('use'), p[0], p[2]]
#@pg.production('use_infix_expr : USE INFIX namelist FROM names')
#def use_expr(p):
# for macro_name in p[1]:
# lexer.add_infix_macro_name(str(macro_name))
# return [Symbol('use'), p[1], p[3]]
@pg.production('suite : binop_expr')
def suite_expr(p):
return p[0]
@pg.production('suite : lbrace stmts rbrace')
def suite_stmts(p):
return [Symbol('do')] + p[1]
# @pg.production('suite : NEWLINE INDENT stmts DEDENT END')
# def suite_stmts(p):
# return [Symbol('do')] + p[2]
@pg.production('suite2 : lbrace stmts rbrace')
def suite2_stmts(p):
return p[1]
# @pg.production('suite2 : NEWLINE INDENT stmts DEDENT END')
# def suite2_stmts(p):
# return p[2]
@pg.production('try_stmt : TRY suite2 finally_cls')
def try_finally_stmt(p):
return [Symbol('try')] + p[1] + [p[2]]
@pg.production('try_stmt : TRY suite2 except_cls_list')
def try_except_stmt(p):
return [Symbol('try')] + p[1] + p[2]
@pg.production('try_stmt : TRY suite2 except_cls_list finally_cls')
def try_excepts_finally_stmt(p):
return [Symbol('try')] + p[1] + p[2] + [p[3]]
@pg.production('except_cls_list : except_cls_list except_cls')
def except_cls_list(p):
return p[0] + [p[1]]
@pg.production('except_cls_list : except_cls')
def except_cls_list(p):
return [p[0]]
@pg.production('except_cls : EXCEPT binop_expr AS NAME suite2')
def except_cls(p):
return [Symbol('except'), p[1], token_to_symbol(p[3])] + p[4]
@pg.production('finally_cls : FINALLY suite2')
def finally_cls(p):
return [Symbol('finally')] + p[1]
@pg.production('raise_stmt : RAISE binop_expr')
def raise_stmt(p):
return [Symbol('raise'), p[1]]
#@pg.production('do_suite : binop_expr')
#def suite_expr(p):
# return [Symbol('do'), p[0]]
@pg.production('do_suite : lbrace stmts rbrace')
def suite_stmts(p):
return [Symbol('do')] + p[1]
# @pg.production('do_suite : NEWLINE INDENT stmts DEDENT END')
# def suite_stmts(p):
# return [Symbol('do')] + p[2]
#@pg.production('labeled_expr : binop_expr COLON binop_expr')
#def labeled_expr(p):
# # return [Symbol('label'), p[0], p[2]]
# return [Symbol('call_macro'), p[0], [], [Symbol('do'), p[2]], []]
class Label:
def __init__(self, label):
self.label = label
# @pg.production('labeled_expr : binop_expr do_suite')
# def labeled_expr(p):
# name = Label(p[0])
# head = []
# body = p[1]
# rest = None
# return [Symbol('call_macro'), name, [head, body, rest]]
#@pg.production('cont_labeled_expr : id_expr COLON do_suite')
#def labeled_expr(p):
# name = p[0]
# head = []
# body = p[2]
# rest = None
# return [Symbol('call_macro'), name, [head, body, rest]]
#@pg.production('cont_labeled_expr : id_expr COLON do_suite cont_labeled_expr')
#def labeled_expr(p):
# name = p[0]
# head = []
# body = p[2]
# rest = p[3][1:]
# return [Symbol('call_macro'), name, [head, body, rest]]
#@pg.production('labeled_expr : binop_expr COLON do_suite cont_labeled_expr')
#def labeled_expr(p):
# name = p[0]
# head = []
# body = p[2]
# rest = p[3][1:]
# return [Symbol('call_macro'), name, [head, body, rest]]
# @pg.production('labeled_expr : binop_expr do_suite labeled_expr')
# def labeled_expr(p):
# name = Label(p[0])
# head = []
# body = p[1]
# rest = p[2][1:]
# return [Symbol('call_macro'), name, [head, body, rest]]
# @pg.production('labeled_expr : binop_expr do_suite call_macro_expr')
# def labeled_expr(p):
# name = Label(p[0])
# head = []
# body = p[1]
# rest = p[2][1:]
# return [Symbol('call_macro'), name, [head, body, rest]]
# @pg.production('user_defined_stmt : NAME NAME COLON trailing_dict')
# def user_defined_stmt(p):
# return [Symbol('val'),
# token_to_symbol(p[1]),
# [Symbol(p[0].getstr() + '.define'), p[1].getstr(), p[3]]]
# @pg.production('user_defined_stmt : NAME id_expr app_args COLON trailing_dict')
# def user_defined_stmt(p):
# return [Symbol(p[0].getstr() + '.define'), p[1]] + p[2] + [p[4]]
# @pg.production('user_defined_stmt : NAME NAME DOT_NAME app_args COLON trailing_dict')
# def user_defined_stmt(p):
# return [Symbol(p[0].getstr() + '.define'), Symbol(p[1].getstr() + '.' + p[2].getstr()[1:])] + p[3] + [p[5]]
@pg.production('macro_stmt : MACRO fun_header suite2')
def macro_stmt(p):
fun_name, fun_args = p[1]
lexer.add_macro_name((p[0].filename, str(fun_name)))
return [Symbol('mac'), fun_name, fun_args] + p[2]
@pg.production('infix_macro_stmt : INFIX MACRO fun_header suite2')
def macro_stmt(p):
fun_name, fun_args = p[2]
lexer.add_infix_macro_name((p[0].filename, str(fun_name)))
return [Symbol('mac'), fun_name, fun_args] + p[3]
@pg.production('infix_macro_stmt : INFIX_1 MACRO fun_header suite2')
def macro_stmt(p):
fun_name, fun_args = p[2]
lexer.add_infix_1_macro_name((p[0].filename, str(fun_name)))
return [Symbol('mac'), fun_name, fun_args] + p[3]
@pg.production('infix_macro_stmt : INFIX_2 MACRO fun_header suite2')
def macro_stmt(p):
fun_name, fun_args = p[2]
lexer.add_infix_2_macro_name((p[0].filename, str(fun_name)))
return [Symbol('mac'), fun_name, fun_args] + p[3]
@pg.production('q_stmt : QUOTE suite')
def q_stmt(p):
return [Symbol('quote'), p[1]]
#@pg.production('quote_expr : QUOTE_LPAREN binop_expr RPAREN')
#@pg.production('quote_expr : QUOTE binop_expr')
@pg.production('quote_expr : QUOTE stmt')
def quote_expr(p):
return [Symbol('quote'), p[1]]
@pg.production('qq_stmt : QUASI_QUOTE suite')
def qq_stmt(p):
return [Symbol('quasiquote'), p[1]]
#@pg.production('quasi_quote_expr : QUASI_QUOTE_LPAREN binop_expr RPAREN')
#@pg.production('quasi_quote_expr : QUASI_QUOTE binop_expr')
@pg.production('quasi_quote_expr : QUASI_QUOTE stmt')
def quasi_quote_expr(p):
return [Symbol('quasiquote'), p[1]]
#@pg.production('uq_expr : UNQUOTE_LPAREN binop_expr RPAREN')
@pg.production('uq_expr : UNQUOTE binop_expr')
def uq_expr(p):
return [Symbol('unquote'), p[1]]
#@pg.production('uqs_expr : UNQUOTE_SPLICING_LPAREN binop_expr RPAREN')
@pg.production('uqs_expr : UNQUOTE_SPLICING binop_expr')
def uqs_expr(p):
return [Symbol('unquote_splicing'), p[1]]
@pg.production('assert_stmt : ASSERT binop_expr')
def assert_stmt(p):
return [Symbol('assert'), p[1]]
@pg.production('with_stmt : WITH with_contexts suite2')
def with_stmt(p):
return [Symbol('with'), p[1]] + p[2]
@pg.production('with_contexts : with_contexts COMMA with_context')
def with_contexts(p):
return p[0] + [p[2]]
@pg.production('with_contexts : with_context')
def with_contexts_one(p):
return [p[0]]
@pg.production('with_context : binop_expr AS NAME')
def with_context(p):
return [p[0], token_to_symbol(p[2])]
@pg.production('return_stmt : RETURN binop_expr')
def raise_stmt(p):
return [Symbol('return'), p[1]]
def token_to_symbol(token):
return Symbol(token.getstr(), token.getsourcepos().lineno, token.getsourcepos().colno)
def token_to_keyword(token):
return Keyword(token.getstr(), token.getsourcepos().lineno, token.getsourcepos().colno)
@pg.production('let_expr : LET pattern EQUALS binop_expr')
def let_expr(p):
return [Symbol('match'), p[3], p[1], Symbol('True')]
@pg.production('binding : NAME')
def binding(p):
return token_to_symbol(p[0])
@pg.production('as_expr : binop_expr AS id_expr')
def let_expr(p):
return [Symbol('val', 0, 0), p[2], p[0]]
@pg.production('expr : record_expr')
# @pg.production('expr : func_expr')
# @pg.production('expr : union_expr')
# @pg.production('expr : predicate_expr')
@pg.production('expr : fn_expr')
@pg.production('expr : paren_expr')
@pg.production('expr : if_expr')
@pg.production('expr : prim_expr')
@pg.production('expr : uq_expr')
@pg.production('expr : uqs_expr')
@pg.production('expr : app_expr')
@pg.production('expr : left_app_expr')
@pg.production('expr : dict_expr')
@pg.production('expr : tuple_expr')
@pg.production('expr : match_expr')
@pg.production('expr : yield_expr')
@pg.production('expr : yield_from_expr')
@pg.production('expr : for_expr')
@pg.production('expr : block_expr')
@pg.production('expr : dot_expr')
@pg.production('expr : get_expr')
@pg.production('expr : quote_expr')
@pg.production('expr : quasi_quote_expr')
@pg.production('expr : id_expr')
@pg.production('expr : call_macro_expr')
@pg.production('expr : call_func_expr')
@pg.production('expr : call_method_expr')
def expr(p):
return p[0]
@pg.production('paren_expr : LPAREN binop_expr RPAREN')
def paren_expr(p):
return p[1]
@pg.production('prim_expr : NUMBER')
def expr_num(p):
num_repr = p[0].getstr()
try:
return int(num_repr)
except ValueError as _:
return float(num_repr)
@pg.production('prim_expr : string')
def expr_string(p):
return p[0]
@pg.production('string : DQUOTE_STR')
@pg.production('string : SQUOTE_STR')
def expr_quote_str(p):
return quote_str(p[0].getstr()[1:-1])
@pg.production('string : TQUOTE_STR')
def expr_triple_quote_str(p):
return quote_str(p[0].getstr()[3:-3])
def quote_str(string):
new_string = ''
string_enumerator = enumerate(string)
for index, char in string_enumerator:
if char == '\\':
index, char = next(string_enumerator)
if char == 'n':
char = '\n'
elif char == 't':
char = '\t'
elif char == 'r':
char = '\r'
elif char in {'\\', "'", '"'}:
pass
else:
char = '\\' + char
new_string = new_string + char
return new_string
@pg.production('string : DQUOTE_RAW_STR')
@pg.production('string : SQUOTE_RAW_STR')
def expr_quote_raw_str(p):
return p[0].getstr()[2:-1]
@pg.production('string : TQUOTE_RAW_STR')
def expr_triple_quote_raw_str(p):
return p[0].getstr()[4:-3]
@pg.production('prim_expr : bool_expr')
def expr_false(p):
return p[0]
@pg.production('bool_expr : TRUE')
def expr_true(p):
return Symbol('True')
@pg.production('bool_expr : FALSE')
def expr_false(p):
return Symbol('False')
@pg.production('id_expr : NAME')
def id_expr(p):
return token_to_symbol(p[0])
@pg.production('id_expr : AMP')
def id_expr(p):
return Symbol('&')
@pg.production('if_expr : IF binop_expr suite elseif_exprs ELSE suite')
def if_else_expr(p):
return [Symbol('if'), p[1], p[2]] + p[3] + [p[5]]
@pg.production('if_expr : IF binop_expr suite ELSE suite')
def if_else_expr(p):
return [Symbol('if'), p[1], p[2], p[4]]
@pg.production('elseif_exprs : elseif_exprs elseif_expr')
def elseif_exprs(p):
return p[0] + p[1]
@pg.production('elseif_exprs : elseif_expr')
def elseif_exprs_expr(p):
return p[0]
@pg.production('elseif_expr : ELSEIF binop_expr suite')
def elseif_expr(p):
return [p[1], p[2]]
# @pg.production('elseif_expr :')
# def elseif_expr_empty(p):
# return None
#@pg.production('trailing_if_expr : binop_expr IF binop_expr ELSE binop_expr')
def trailing_if_expr(p):
return [Symbol('if'), p[2], p[0], p[4]]
@pg.production('yield_expr : YIELD binop_expr')
def yield_expr(p):
return [Symbol('yield'), p[1]]
@pg.production('yield_from_expr : YIELD FROM binop_expr')
def yield_from_expr(p):
return [Symbol('yield_from'), p[1]]
def issequence(obj):
return isinstance(obj, Sequence)
def issequence_except_str(obj):
if isinstance(obj, str):
return False
return isinstance(obj, Sequence)
def _compute_underscore_max_num(exps):
max_num = 0
if not issequence_except_str(exps):
exps = (exps,)
for exp in exps:
if isinstance(exp, Symbol) and exp.name.startswith('$'):
try:
n = int(exp.name[1:])
except:
n = 1
elif issequence_except_str(exp):
n = _compute_underscore_max_num(exp)
else:
n = 0
if n > max_num:
max_num = n
return max_num
@pg.production('dot_expr : expr DOT_NAME')
def dot_expr(p):
return [Symbol('getattr'), p[0], p[1].getstr()[1:]]
@pg.production('get_expr : binop_expr LBRACK binop_expr RBRACK')
def get_expr(p):
return [Symbol('get'), p[0], p[2]]
@pg.production('get_expr : binop_expr LBRACK binop_expr COMMA binop_expr RBRACK')
def get_expr(p):
return [Symbol('get'), p[0], [Symbol('v'), p[2], p[4]]]
@pg.production('get_expr : binop_expr LBRACK binop_expr COMMA binop_expr COMMA binop_expr RBRACK')
def get_expr(p):
return [Symbol('get'), p[0], [Symbol('v'), p[2], p[4], p[6]]]
@pg.production('get_expr : binop_expr LBRACK range_start COLON range_end RBRACK')
def get_slice_expr(p):
return [Symbol('get'), p[0], p[2], p[4]]
@pg.production('get_expr : binop_expr LBRACK range_start COLON range_end COLON range_interval RBRACK')
def get_slice_expr(p):
return [Symbol('get'), p[0], p[2], p[4], p[6]]
@pg.production('range_start : ')
@pg.production('range_end : ')
@pg.production('range_interval : ')
def range_start_none(p):
return Symbol('None')
@pg.production('range_start : binop_expr')
@pg.production('range_end : binop_expr')
@pg.production('range_interval : binop_expr')
def range_start_none(p):
return p[0]
@pg.production('for_expr : LBRACK binop_expr FOR pattern IN binop_expr RBRACK')
def for_expr(p):
pattern = p[3]
items = p[5]
body = p[1]
return [Symbol('tuple_of'), body, [pattern, items]]
@pg.production('for_expr : LBRACK binop_expr FOR pattern IN binop_expr IF binop_expr RBRACK')
def for_expr_if(p):
pattern = p[3]
items = p[5]
body = p[1]
when = p[7]
return [Symbol('tuple_of'), body, [pattern, items, Keyword('when'), when]]
@pg.production('tuple_expr : LBRACK tuple_elts binop_expr RBRACK')
def tuple_expr(p):
return [Symbol('make_tuple')] + p[1] + [p[2]]
@pg.production('tuple_expr : LBRACK binop_expr RBRACK')
def tuple_expr_one(p):
return [Symbol('make_tuple'), p[1]]
@pg.production('tuple_expr : LBRACK tuple_elts binop_expr RBRACK')
def tuple_expr(p):
return [Symbol('make_tuple')] + p[1] + [p[2]]
@pg.production('tuple_expr : LBRACK binop_expr RBRACK')
def tuple_expr_one(p):
return [Symbol('make_tuple'), p[1]]
@pg.production('tuple_expr : LBRACK RBRACK')
def tuple_expr_empty(p):
return [Symbol('make_tuple')]
@pg.production('tuple_elts : tuple_elts tuple_elt')
def tuple_elts(p):
return p[0] + [p[1]]
@pg.production('tuple_elts : tuple_elt')
def tuple_elts_elt(p):
return [p[0]]
@pg.production('tuple_elt : binop_expr COMMA')
def tuple_elt(p):
return p[0]
#@pg.production('deco_expr : decorators binop_expr')
@pg.production('deco_expr : decorators func_expr')
def deco_expr(p):
# return p[1][:2] + p[0] + p[1][2:]
return [Symbol('with_decorator')] + p[0] + [p[1]]
@pg.production('decorators : decorators decorator')
def decorators(p):
return p[0] + [p[1]]
@pg.production('decorators : decorator')
def decorators_single(p):
return [p[0]]
@pg.production('decorator : AT binop_expr')
def decorator(p):
return p[1]
@pg.production('func_expr : FUNC fun_header doc_string suite')
def fun_expr(p):
fun_name, fun_args = p[1]
return [Symbol('def'), fun_name, fun_args, p[3]]
@pg.production('funcm_expr : FUNC NAME doc_string lbrace defm_case_branches rbrace')
def fun_expr(p):
return [Symbol('defm'), token_to_symbol(p[1])] + p[4]
@pg.production('defm_case_branches : defm_case_branches defm_case_branch')
def case_branches(p):
return p[0] + p[1]
@pg.production('defm_case_branches : defm_case_branch')
def case_branches_branch(p):
return p[0]
@pg.production('defm_case_branch : CASE defm_pattern THINARROW lbrace stmts rbrace')
def case_branch(p):
return [p[1], [Symbol('do')] + p[4]]
@pg.production('defm_case_branch : CASE defm_pattern THINARROW binop_expr')
def case_branch(p):
return [p[1], p[3]]
# @pg.production('defm_case_branch : CASE defm_pattern COLON binop_expr NEWLINE')
# def case_branch(p):
# return [p[1], p[3]]
# @pg.production('defm_case_branch : CASE defm_pattern COLON binop_expr SEMI')
# def case_branch(p):
# return [p[1], p[3]]
@pg.production('defm_pattern : app_nc_args')
def pattern(p):
return p[0]
@pg.production('defm_pattern : pattern')
def app_args(p):
return [p[0]]
@pg.production('defm_pattern : pattern COMMA defm_pattern')
def app_args(p):
return [p[0]] + p[2]
@pg.production('fun_header : NAME_LPAREN list_arg_elts id_expr RPAREN')
def fun_header(p):
return [namelparen_to_symbol(p[0]), p[1] + [p[2]]]
@pg.production('fun_header : NAME_LPAREN id_expr RPAREN')
def fun_header(p):
return [namelparen_to_symbol(p[0]), [p[1]]]
@pg.production('fun_header : NAME_LPAREN RPAREN')
def fun_header(p):
return [namelparen_to_symbol(p[0]), []]
@pg.production('fn_expr : id_expr FATARROW suite')
def fun_expr(p):
return [Symbol('fn'), [p[0]], p[2]]
@pg.production('fn_expr : args FATARROW suite')
def fun_expr(p):
return [Symbol('fn'), p[0], p[2]]
@pg.production('args : LPAREN list_arg_elts id_expr RPAREN')
def args(p):
return p[1] + [p[2]]
@pg.production('args : LPAREN id_expr RPAREN')
def args_one(p):
return [p[1]]
@pg.production('args : LPAREN RPAREN')
def args_empty(p):
return []
@pg.production('nc_args : list_arg_elts id_expr')
def args(p):
return p[0] + [p[1]]
@pg.production('nc_args : id_expr')
def args_one(p):
return [p[0]]
@pg.production('list_arg_elts : list_arg_elts list_arg_elt')
def list_arg_elts(p):
return p[0] + [p[1]]
@pg.production('list_arg_elts : list_arg_elt')
def list_arg_elts_elt(p):
return [p[0]]
@pg.production('list_arg_elt : id_expr COMMA')
def list_arg_elt(p):
return p[0]
def _create_underscore_args(exps):
max_num = _compute_underscore_max_num(exps)
if max_num == 1:
return [Symbol('$1')]
else:
return [Symbol('$' + str(n)) for n in range(1, max_num + 1)]
@pg.production('block_expr : FATARROW suite')
def block_expr(p):
block = p[1]
return [Symbol('fn'), _create_underscore_args(block), block]
@pg.production('doc_string : DOC string')
@pg.production('doc_string : ')
def doc_string(p):
pass
from collections import Iterable
def flatten_list(lis):
i = 0
while i < len(lis):
while isinstance(lis[i], Iterable):
if not lis[i]:
lis.pop(i)
i -= 1
break
else:
lis[i:i + 1] = lis[i]
i += 1
return lis
@pg.production('call_macro_expr : MACRO_NAME head')
def call_macro_expr(p):
head = p[1]
body = None
rest = []
return process_calling_macro(token_to_symbol(p[0]), head, body, rest)
@pg.production('call_macro_expr : MACRO_NAME head rest')
def call_macro_expr(p):
head = p[1]
body = None
rest = p[2]
return process_calling_macro(token_to_symbol(p[0]), head, body, rest)
@pg.production('call_macro_expr : MACRO_NAME do_suite')
def call_macro_expr(p):
head = []
body = p[1]
rest = []
return process_calling_macro(token_to_symbol(p[0]), head, body, rest)
@pg.production('call_macro_expr : MACRO_NAME head do_suite')
def call_macro_expr(p):
head = p[1]
body = p[2]
rest = []
return process_calling_macro(token_to_symbol(p[0]), head, body, rest)
@pg.production('call_macro_expr : MACRO_NAME head do_suite rest')
def call_macro_expr(p):
head = p[1]
body = p[2]
rest = p[3]
return process_calling_macro(token_to_symbol(p[0]), head, body, rest)
def process_calling_macro(name, head, body, rest):
# macro_name = name.name
# if macro_name == 'macro':
# call_func, *rest = head
# _, fun_name, *fun_args = call_func
# return [Symbol('mac'), fun_name, fun_args, body]
# elif macro_name == 'def':
# call_func, *rest = head
# _, fun_name, *fun_args = call_func
# return [Symbol('def'), fun_name, fun_args, body]
# elif macro_name == 'if':
# clauses = [head[0], body]
# for rest_clause in rest:
# label, head, body = rest_clause
# if label == Symbol('elif'):
# clauses.append(head[0])
# clauses.append(body)
# elif label == Symbol('else'):
# clauses.append(body)
# return [Symbol('if'), *clauses]
# else:
# error = SyntaxError(label)
# error.filename = '<string>'
# error.lineno = name.lineno
# error.offset = name.col_offset
# raise error
# return [Symbol('if'), *clauses]
# elif macro_name == 'return':
# return [Symbol('return'), head[0]]
# elif macro_name == 'raise':
# return [Symbol('raise'), head[0]]
# else:
# if rest is None or len(rest) == 0:
# return [Symbol('call_macro'), name, head, body]
# else:
return [Symbol('call_macro'), name, head, body, rest]
@pg.production('rest : ')
def rest(p):
return []
@pg.production('rest : rest_item')
def rest(p):
return [p[0]]
@pg.production('rest : rest rest_item')
def rest(p):
return p[0] + [p[1]]
@pg.production('rest_item : sub_keyword head do_suite')
def rest_item(p):
head = p[1]
body = p[2]
return [p[0], head, body]
@pg.production('rest_item : sub_keyword do_suite')
def rest_item(p):
head = []
body = p[1]
return [p[0], head, body]
@pg.production('sub_keyword : ELSE')
@pg.production('sub_keyword : ELSEIF')
@pg.production('sub_keyword : EXCEPT')
@pg.production('sub_keyword : USER_DEFINED_KEYWORD')
def sub_keyword(p):
return token_to_symbol(p[0])
@pg.production('head : app_nc_args')
def head(p):
return p[0]
@pg.production('if_expr : IF binop_expr suite')
def if_expr(p):
return [Symbol('if'), p[1], p[2]]
@pg.production('if_expr : IF binop_expr suite elseif_exprs')
def if_expr(p):
return [Symbol('if'), p[1], p[2]] + p[3]
def namelparen_to_symbol(token):
return Symbol(token.getstr()[:-1],
token.getsourcepos().lineno,
token.getsourcepos().colno)
@pg.production('call_func_expr : NAME_LPAREN RPAREN')
def call_func_expr(p):
return [Symbol('call_func'),
namelparen_to_symbol(p[0])]
# @pg.production('call_func_expr : NAME_LPAREN RPAREN fn_expr')
# @pg.production('call_func_expr : NAME_LPAREN RPAREN block_expr')
def call_func_expr(p):
return [Symbol('call_func'),
namelparen_to_symbol(p[0]), p[2]]
@pg.production('call_func_expr : NAME_LPAREN app_args_elts RPAREN')
def call_func_expr(p):
return [Symbol('call_func'),
namelparen_to_symbol(p[0])] + p[1]
@pg.production('app_expr : binop_expr app_args')
def call_func_expr(p):
return [p[0]] + p[1]
#@pg.production('call_func_expr : NAME_LPAREN app_args_elts RPAREN fn_expr')
#@pg.production('call_func_expr : NAME_LPAREN app_args_elts RPAREN block_expr')
#def call_func_expr(p):
# return [Symbol('call_func'),
# namelparen_to_symbol(p[0])] + [p[3]] + p[1]
@pg.production('call_func_expr : paren_expr LPAREN RPAREN')
def call_func_expr(p):
return [Symbol('call_func'), p[0]]
@pg.production('call_func_expr : paren_expr LPAREN app_args_elts RPAREN')
def call_func_expr(p):
return [Symbol('call_func'), p[0]] + p[2]
#@pg.production('call_func_expr : call_func_expr LPAREN RPAREN')
#def call_func_expr(p):
# return [Symbol('call_func'), p[0]]
#@pg.production('call_func_expr : call_func_expr LPAREN app_args_elts RPAREN')
#def call_func_expr(p):
# return [Symbol('call_func'), p[0]] + p[2]
@pg.production('call_method_expr : expr DOT_NAME_LPAREN RPAREN')
def call_method_expr(p):
return [Symbol('call_func'), [Symbol('getattr'), p[0], p[1].getstr()[1:-1]]]
@pg.production('call_method_expr : expr DOT_NAME_LPAREN app_args_elts RPAREN')
def call_method_expr(p):
return [Symbol('call_func'), [Symbol('getattr'), p[0], p[1].getstr()[1:-1]]] + p[2]
@pg.production('app_args : LPAREN app_args_elts RPAREN')
def app_args(p):
return p[1]
@pg.production('app_args : LPAREN RPAREN')
def app_args(p):
return []
@pg.production('app_args_elts : app_args_elts COMMA app_args_elt')
def app_args_elts(p):
return p[0] + p[2]
@pg.production('app_args_elts : app_args_elt')
def app_args_elts(p):
return p[0]
@pg.production('app_args_elt : NAME EQUALS binop_expr')
def app_args_elt(p):
return [token_to_keyword(p[0]), p[2]]
@pg.production('app_args_elt : EQUALS NAME')
def app_args_elt_short(p):
return [token_to_keyword(p[1]), token_to_symbol(p[1])]
@pg.production('app_args_elt : binop_expr')
def app_args_elt(p):
return [p[0]]
# TODO
#@pg.production('app_expr : expr app_args app_args')
#@pg.production('app_expr : expr app_args app_args')
def trailing_closure_expr(p):
return [[p[0]] + p[1]] + p[2]
#@pg.production('app_expr : expr app_args AT fn_expr')
#@pg.production('app_expr : expr app_args AT block_expr')
#def trailing_closure_expr(p):
# return [p[0]] + p[1] + [p[3]]
@pg.production('app_nc_expr : expr app_nc_args')
def app_expr(p):
return [p[0]] + p[1]
@pg.production('app_nc_args : app_nc_arg')
def app_nc_args(p):
return [p[0]]
@pg.production('app_nc_args : app_nc_arg COMMA app_nc_args')
def app_nc_args(p):
return [p[0]] + p[2]
# @pg.production('app_nc_args : app_nc_arg app_nc_args')
# def app_nc_args(p):
# return [p[0]] + p[1]
# @pg.production('app_nc_args : app_nc_arg labeled_blocks')
# def app_nc_args(p):
# return [p[0]] + p[1]
#
#
# @pg.production('labeled_blocks : labeled_block labeled_blocks')
# def labeled_blocks(p):
# return [p[0]] + p[1]
#
#
# @pg.production('labeled_blocks : labeled_block')
# def labeled_blocks(p):
# return [p[0]]
@pg.production('app_nc_arg : binop_expr')
def app_nc_arg(p):
return p[0]
@pg.production('left_app_expr : expr CALET left_app_fun_expr app_args')
def left_app_expr(p):
expr, _, left_app_fun_expr, app_args = p
return [left_app_fun_expr, expr] + app_args
@pg.production('left_app_fun_expr : id_expr')
def left_app_fun_expr(p):
return p[0]
@pg.production('dict_expr : lbrace rbrace')
def dict_expr_empty(p):
return [Symbol('table')]
@pg.production('dict_expr : lbrace fields rbrace')
def dict_expr(p):
return [Symbol('table')] + p[1]
@pg.production('fields : field')
def fields_one(p):
return p[0]
@pg.production('fields : list_fields field')
def fields(p):
return p[0] + p[1]
@pg.production('list_fields : list_field')
def list_fields_one(p):
return p[0]
@pg.production('list_fields : list_fields list_field')
def list_fields(p):
return p[0] + p[1]
@pg.production('list_field : field COMMA')
def list_field(p):
return p[0]
@pg.production('field : key COLON binop_expr')
def field(p):
return [p[0], p[2]]
@pg.production('field : EQUALS NAME')
def field(p):
s = token_to_symbol(p[1])
return [s.name, s]
@pg.production('key : prim_expr')
@pg.production('key : id_expr')
@pg.production('key : call_func_expr')
def key(p):
return p[0]
@pg.production('match_expr : MATCH binop_expr lbrace case_branches rbrace')
def case(p):
return [Symbol('match'), p[1]] + p[3]
@pg.production('case_branches : case_branches case_branch')
def case_branches(p):
return p[0] + p[1]
@pg.production('case_branches : case_branch')
def case_branches_branch(p):
return p[0]
@pg.production('case_branch : CASE pattern THINARROW lbrace stmts rbrace')
def case_branch(p):
return [p[1], [Symbol('do')] + p[4]]
@pg.production('case_branch : CASE pattern THINARROW binop_expr')
def case_branch(p):
return [p[1], p[3]]
# @pg.production('case_branch : CASE pattern COLON binop_expr SEMI')
# def case_branch(p):
# return [p[1], p[3]]
# @pg.production('pattern : fn_expr')
@pg.production('pattern : prim_pattern')
@pg.production('pattern : dict_pattern')
@pg.production('pattern : sequence_pattern')
@pg.production('pattern : sequence_type_pattern')
@pg.production('pattern : type_pattern')
@pg.production('pattern : id_pattern')
@pg.production('pattern : ref_pattern')
# @pg.production('pattern : and_pattern')
# @pg.production('pattern : or_pattern')
@pg.production('pattern : quote_pattern')
# TODO @pg.production('defm_pattern : app_nc_args')
def pattern(p):
return p[0]
@pg.production('prim_pattern : NUMBER')
def pattern_num(p):
num_repr = p[0].getstr()
try:
return int(num_repr)
except ValueError as _:
return float(num_repr)
@pg.production('prim_pattern : string')
def pattern_string(p):
return p[0]
@pg.production('prim_pattern : bool_expr')
def pattern_bool(p):
return p[0]
@pg.production('dict_pattern : lbrace rbrace')
def dict_pattern_empty(p):
return [Symbol('table')]
@pg.production('dict_pattern : lbrace dict_pattern_fields rbrace')
def dict_pattern(p):
return [Symbol('table')] + p[1]
@pg.production('dict_pattern_fields : dict_pattern_field')
def fields_one(p):
return p[0]
@pg.production('dict_pattern_fields : dict_pattern_list_fields dict_pattern_field')
def fields(p):
return p[0] + p[1]
@pg.production('dict_pattern_list_fields : dict_pattern_list_field')
def list_fields_one(p):
return p[0]
@pg.production('dict_pattern_list_fields : dict_pattern_list_fields dict_pattern_list_field')
def list_fields(p):
return p[0] + p[1]
@pg.production('dict_pattern_list_field : dict_pattern_field COMMA')
def list_field(p):
return p[0]
@pg.production('dict_pattern_field : dict_pattern_key COLON pattern')
def field(p):
return [p[0], p[2]]
@pg.production('dict_pattern_field : EQUALS NAME')
def field(p):
s = token_to_symbol(p[1])
return [s.name, s]
@pg.production('dict_pattern_key : binop_expr')
def key(p):
return p[0]
@pg.production('id_pattern : NAME')
def id_pattern(p):
return token_to_symbol(p[0])
@pg.production('id_pattern : AMP')
def id_pattern(p):
return Symbol('&')
@pg.production('sequence_pattern : LBRACK sequence_pattern_elts pattern RBRACK')
def sequence_pattern(p):
return [Symbol('make_tuple')] + p[1] + [p[2]]
@pg.production('sequence_pattern : LBRACK pattern RBRACK')
def sequence_pattern_one(p):
return [Symbol('make_tuple'), p[1]]
@pg.production('sequence_pattern : LBRACK RBRACK')
def sequence_pattern_empty(p):
return [Symbol('make_tuple')]
@pg.production('sequence_pattern_elts : sequence_pattern_elts sequence_pattern_elt')
def sequence_pattern_elts(p):
return p[0] + [p[1]]
@pg.production('sequence_pattern_elts : sequence_pattern_elt')
def sequence_pattern_elts_elt(p):
return [p[0]]
@pg.production('sequence_pattern_elt : pattern COMMA')
def sequence_pattern_elt(p):
return p[0]
@pg.production('sequence_pattern_named_elts : sequence_pattern_named_elts sequence_pattern_named_elt')
def sequence_pattern_named_elts(p):
return p[0] + p[1]
@pg.production('sequence_pattern_named_elts : sequence_pattern_named_elt')
def sequence_pattern_named_elts_elt(p):
return p[0]
@pg.production('sequence_pattern_named_elt : named_pattern COMMA')
def sequence_pattern_named_elt(p):
return p[0]
@pg.production('named_pattern : NAME EQUALS pattern')
def sequence_pattern_named_pattern(p):
s = token_to_symbol(p[0])
return [s.name, p[2]]
@pg.production('sequence_type_pattern : names_lparen sequence_pattern_elts pattern RPAREN')
def sequence_type_pattern(p):
return [Symbol('sequence_type'), p[0]] + p[1] + [p[2]]
@pg.production('sequence_type_pattern : names_lparen sequence_pattern_named_elts named_pattern RPAREN')
def sequence_type_pattern(p):
return [Symbol('sequence_type_with_named_member'), p[0]] + p[1] + p[2]
@pg.production('sequence_type_pattern : names_lparen pattern RPAREN')
def sequence_type_pattern_one(p):
return [Symbol('sequence_type'), p[0], p[1]]
@pg.production('sequence_type_pattern : names_lparen named_pattern RPAREN')
def sequence_type_pattern_one(p):
return [Symbol('sequence_type_with_named_member'), p[0], p[1]]
@pg.production('and_pattern : pattern OPAND pattern')
def and_pattern(p):
return [token_to_symbol(p[1]), p[0], p[2]]
@pg.production('or_pattern : pattern OPOR pattern')
def or_pattern(p):
return [token_to_symbol(p[1]), p[0], p[2]]
#@pg.production('type_pattern : pattern COLON NAME')
#def type_pattern(p):
# return [Symbol('type'), token_to_symbol(p[2]), p[0]]
@pg.production('type_pattern : pattern COLON binop_expr')
def type_pattern(p):
return [Symbol('type'), p[2], p[0]]
@pg.production('ref_pattern : CALET NAME')
def ref_pattern(p):
return [Symbol('ref'), token_to_symbol(p[1])]
# @pg.production('quote_pattern : QUOTE LPAREN pattern RPAREN')
@pg.production('quote_pattern : QUOTE pattern')
def quote_pattern(p):
return [Symbol('quote'), p[1]]
@pg.production('record_expr : RECORD NAME')
def record_expr(p):
return [Symbol('record'), token_to_symbol(p[1]), []]
# @pg.production('record_expr : RECORD NAME OPLT NAME')
# def record_expr(p):
# return [Symbol('record'), token_to_symbol(p[1]), token_to_symbol(p[3]), []]
@pg.production('record_expr : RECORD NAME_LPAREN record_fields RPAREN')
def record_expr(p):
return [Symbol('record'), namelparen_to_symbol(p[1]), p[2]]
@pg.production('record_expr : RECORD NAME_LPAREN record_fields RPAREN OPLT NAME')
def record_expr(p):
return [Symbol('record'), namelparen_to_symbol(p[1]), token_to_symbol(p[5]), p[2]]
@pg.production('record_expr : RECORD NAME lbrace record_body rbrace')
def record_expr(p):
return [Symbol('record'), token_to_symbol(p[1]), []] + p[3]
@pg.production('record_expr : RECORD NAME OPLT NAME lbrace record_body rbrace')
def record_expr(p):
return [Symbol('record'), token_to_symbol(p[1]), token_to_symbol(p[3]), []] + p[5]
@pg.production('record_expr : RECORD NAME_LPAREN record_fields RPAREN lbrace record_body rbrace')
def record_expr(p):
return [Symbol('record'), namelparen_to_symbol(p[1]), p[2]] + p[5]
@pg.production('record_expr : RECORD NAME_LPAREN record_fields RPAREN OPLT NAME lbrace record_body rbrace')
def record_expr(p):
return [Symbol('record'), namelparen_to_symbol(p[1]), token_to_symbol(p[5]), p[2]] + p[7]
# @pg.production('union_expr : UNION suite2')
# def union_expr(p):
# return [Symbol('union')] + p[1]
# @pg.production('predicate_expr : PREDICATE binop_expr')
# def union_expr(p):
# return [Symbol('predicate'), p[1]]
@pg.production('record_body : func_expr')
def record_body(p):
return [p[0]]
@pg.production('record_body : record_body func_expr')
def record_body(p):
return p[0] + [p[1]]
@pg.production('record_fields : record_field')
def record_expr(p):
return [p[0]]
@pg.production('record_fields : record_field COMMA record_fields')
def record_expr(p):
return [p[0]] + p[2]
@pg.production('record_field : id_expr')
def record_expr(p):
return p[0]
@pg.production('record_field : id_expr COLON binop_expr')
def record_expr(p):
return [p[0], p[2]]
@pg.production('data_expr : DATA NAME lbrace data_record_expr_list rbrace')
def data_expr(p):
return [Symbol('data'), token_to_symbol(p[1])] + p[3]
@pg.production('data_record_expr_list : data_record_expr')
def record_expr(p):
return [p[0]]
@pg.production('data_record_expr_list : data_record_expr data_record_expr_list')
def record_expr(p):
return [p[0]] + p[1]
@pg.production('data_record_expr : NAME_LPAREN record_fields RPAREN')
def record_expr(p):
return [namelparen_to_symbol(p[0])] + p[1]
@pg.production('binop_expr : NOT binop_expr')
def binop_expr(p):
return [token_to_symbol(p[0]), p[1]]
@pg.production('binop_expr : binop_expr OPPLUS binop_expr')
@pg.production('binop_expr : binop_expr OPMINUS binop_expr')
@pg.production('binop_expr : binop_expr OPTIMES binop_expr')
@pg.production('binop_expr : binop_expr PERCENT binop_expr')
@pg.production('binop_expr : binop_expr OPDIV binop_expr')
@pg.production('binop_expr : binop_expr OPLEQ binop_expr')
@pg.production('binop_expr : binop_expr OPGEQ binop_expr')
@pg.production('binop_expr : binop_expr OPEQ binop_expr')
@pg.production('binop_expr : binop_expr OPNEQ binop_expr')
@pg.production('binop_expr : binop_expr OPLT binop_expr')
@pg.production('binop_expr : binop_expr OPGT binop_expr')
@pg.production('binop_expr : binop_expr OPBITOR binop_expr')
@pg.production('binop_expr : binop_expr OPBITXOR binop_expr')
@pg.production('binop_expr : binop_expr OPBITAND binop_expr')
@pg.production('binop_expr : binop_expr OPFLOORDIV binop_expr')
@pg.production('binop_expr : binop_expr OPPOW binop_expr')
@pg.production('binop_expr : binop_expr OPRSHIFT binop_expr')
@pg.production('binop_expr : binop_expr OPLSHIFT binop_expr')
@pg.production('binop_expr : binop_expr OPAND binop_expr')
@pg.production('binop_expr : binop_expr OPOR binop_expr')
@pg.production('binop_expr : binop_expr OPIS binop_expr')
@pg.production('binop_expr : binop_expr IN binop_expr')
@pg.production('binop_expr : binop_expr AS id_expr')
def binop_expr(p):
return [token_to_symbol(p[1]), p[0], p[2]]
@pg.production('binop_expr : binop_expr INFIX_MACRO_NAME binop_expr')
def binop_expr(p):
return [Symbol('call_macro'), token_to_symbol(p[1]), p[0], p[2]]
@pg.production('binop_expr : binop_expr INFIX_1_MACRO_NAME binop_expr')
def binop_expr(p):
return [Symbol('call_macro'), token_to_symbol(p[1]), p[0], p[2]]
@pg.production('binop_expr : binop_expr INFIX_2_MACRO_NAME binop_expr')
def binop_expr(p):
return [Symbol('call_macro'), token_to_symbol(p[1]), p[0], p[2]]
@pg.production('binop_expr : binop_expr NOT IN binop_expr')
def binop_expr(p):
return [Symbol('not_in'), p[0], p[3]]
@pg.production('binop_expr : binop_expr PIPELINE binop_expr')
def binop_expr(p):
return [Symbol('|>'), p[0], p[2]]
@pg.production('binop_expr : binop_expr PIPELINE_BIND binop_expr')
def binop_expr(p):
left, _, right = p
input_sym = get_temp_name()
return [Symbol('|>'), p[0], [Symbol('bind'),
[Symbol('fn'), [input_sym], p[2] + [input_sym]]]]
@pg.production('binop_expr : binop_expr PIPELINE_FIRST binop_expr')
def binop_expr(p):
return [Symbol('|>1'), p[0], p[2]]
@pg.production('binop_expr : binop_expr PIPELINE_FIRST_BIND binop_expr')
def binop_expr(p):
left, _, right = p
input_sym = get_temp_name()
return [Symbol('|>'), p[0], [Symbol('bind'),
[Symbol('fn'), [input_sym],
[p[2][0], input_sym] + p[2][(1 if len(p[2]) > 1 else len(p[2])):]]]]
@pg.production('binop_expr : expr')
def binop_expr(p):
return p[0] | 25.859231 | 116 | 0.653825 | 7,100 | 47,762 | 4.152535 | 0.042535 | 0.152223 | 0.030119 | 0.029 | 0.706475 | 0.638063 | 0.592172 | 0.531459 | 0.420683 | 0.385307 | 0 | 0.014188 | 0.186885 | 47,762 | 1,847 | 117 | 25.859231 | 0.744979 | 0.158264 | 0 | 0.371075 | 0 | 0 | 0.30473 | 0.018252 | 0 | 0 | 0 | 0.000541 | 0.004757 | 1 | 0.252141 | false | 0.005709 | 0.015224 | 0.210276 | 0.524263 | 0.000951 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c1f29d841c4f62a411df976675d972c35cfa098c | 35 | py | Python | python/testData/completion/fStringLikeCompletionNotAvailableInByteLiterals.py | alexey-anufriev/intellij-community | ffcd46f14e630acdefcc76e2bfc7c43d2449013a | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/completion/fStringLikeCompletionNotAvailableInByteLiterals.py | alexey-anufriev/intellij-community | ffcd46f14e630acdefcc76e2bfc7c43d2449013a | [
"Apache-2.0"
] | 1 | 2020-07-30T19:04:47.000Z | 2020-07-30T19:04:47.000Z | python/testData/completion/fStringLikeCompletionNotAvailableInByteLiterals.py | bradleesand/intellij-community | 750ff9c10333c9c1278c00dbe8d88c877b1b9749 | [
"Apache-2.0"
] | 1 | 2020-10-15T05:56:42.000Z | 2020-10-15T05:56:42.000Z | my_expr = 42
s = b'foo{my_e<caret>' | 17.5 | 22 | 0.657143 | 9 | 35 | 2.333333 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 0.142857 | 35 | 2 | 22 | 17.5 | 0.633333 | 0 | 0 | 0 | 0 | 0 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a9bd8dbf35bce6e926afc202bb829485abcb884b | 158 | py | Python | ml/shuffle.py | thevibegod/lms | 4b7f03acb44e63a3f6294c9224d6376ad22800c2 | [
"MIT"
] | null | null | null | ml/shuffle.py | thevibegod/lms | 4b7f03acb44e63a3f6294c9224d6376ad22800c2 | [
"MIT"
] | 6 | 2021-06-09T18:28:28.000Z | 2022-03-12T00:53:22.000Z | ml/shuffle.py | thevibegod/lms | 4b7f03acb44e63a3f6294c9224d6376ad22800c2 | [
"MIT"
] | null | null | null | import pandas as pd
df = pd.read_csv('dataset.csv', header=None)
ds = df.sample(frac=1)
ds.to_csv('shuffled_dataset.csv')
print('Shuffled Dataset Generated') | 26.333333 | 44 | 0.753165 | 27 | 158 | 4.296296 | 0.666667 | 0.172414 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006993 | 0.094937 | 158 | 6 | 45 | 26.333333 | 0.804196 | 0 | 0 | 0 | 1 | 0 | 0.358491 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a9de834288288f89d510cc750e968243a7eb1eb3 | 355 | py | Python | office365/sharepoint/listitems/listItem_collection.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 544 | 2016-08-04T17:10:16.000Z | 2022-03-31T07:17:20.000Z | office365/sharepoint/listitems/listItem_collection.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 438 | 2016-10-11T12:24:22.000Z | 2022-03-31T19:30:35.000Z | office365/sharepoint/listitems/listItem_collection.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 202 | 2016-08-22T19:29:40.000Z | 2022-03-30T20:26:15.000Z | from office365.sharepoint.base_entity_collection import BaseEntityCollection
from office365.sharepoint.listitems.listitem import ListItem
class ListItemCollection(BaseEntityCollection):
"""List Item collection"""
def __init__(self, context, resource_path=None):
super(ListItemCollection, self).__init__(context, ListItem, resource_path)
| 39.444444 | 82 | 0.811268 | 36 | 355 | 7.666667 | 0.611111 | 0.094203 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018987 | 0.109859 | 355 | 8 | 83 | 44.375 | 0.85443 | 0.056338 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a9e96f3479553a323cae24395aae1384d5d71a03 | 54 | py | Python | hello world.py | xiongshao1943/test-only | b197f1b3d7abeaafcd45dcadcc34a6cf4f600f88 | [
"Apache-2.0"
] | null | null | null | hello world.py | xiongshao1943/test-only | b197f1b3d7abeaafcd45dcadcc34a6cf4f600f88 | [
"Apache-2.0"
] | null | null | null | hello world.py | xiongshao1943/test-only | b197f1b3d7abeaafcd45dcadcc34a6cf4f600f88 | [
"Apache-2.0"
] | null | null | null | name = input('Enter you name :')
print('Hello ',name) | 27 | 33 | 0.648148 | 8 | 54 | 4.375 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 54 | 2 | 34 | 27 | 0.76087 | 0 | 0 | 0 | 0 | 0 | 0.407407 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
a9fc4f5e65a9e9ec49c824da6ceb7e54ae1603c4 | 316 | py | Python | kubernetes_typed/client/models/v1_typed_local_object_reference.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 22 | 2020-12-10T13:06:02.000Z | 2022-02-13T21:58:15.000Z | kubernetes_typed/client/models/v1_typed_local_object_reference.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 4 | 2021-03-08T07:06:12.000Z | 2022-03-29T23:41:45.000Z | kubernetes_typed/client/models/v1_typed_local_object_reference.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 2 | 2021-09-05T19:18:28.000Z | 2022-03-14T02:56:17.000Z | # Code generated by `typeddictgen`. DO NOT EDIT.
"""V1TypedLocalObjectReferenceDict generated type."""
from typing import TypedDict
V1TypedLocalObjectReferenceDict = TypedDict(
"V1TypedLocalObjectReferenceDict",
{
"apiGroup": str,
"kind": str,
"name": str,
},
total=False,
)
| 22.571429 | 53 | 0.667722 | 25 | 316 | 8.44 | 0.76 | 0.379147 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012195 | 0.221519 | 316 | 13 | 54 | 24.307692 | 0.845528 | 0.300633 | 0 | 0 | 1 | 0 | 0.218605 | 0.144186 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a9fcc66dd61126cc0745ff31b6efb944d4f0b8ed | 271 | py | Python | backend/system/__init__.py | red23495/maya | 8ac042982ffb803a8e1499c06a3957e93de2343a | [
"MIT"
] | null | null | null | backend/system/__init__.py | red23495/maya | 8ac042982ffb803a8e1499c06a3957e93de2343a | [
"MIT"
] | null | null | null | backend/system/__init__.py | red23495/maya | 8ac042982ffb803a8e1499c06a3957e93de2343a | [
"MIT"
] | null | null | null | from .context import GlobalContext
from .dao import BaseDao
from .model import BaseModel
from .service import BaseService
from .schema import BaseSchema, DeleteSchema, DeleteResponseSchema, ListSchema
from .crud import BaseCrud
from .message_generator import get_message
| 33.875 | 78 | 0.848708 | 33 | 271 | 6.909091 | 0.606061 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114391 | 271 | 7 | 79 | 38.714286 | 0.95 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e7146df9c79e95a75dba56942c81b49fcbfb3769 | 17,700 | py | Python | azure/mgmt/datalake/analytics/account/operations/data_lake_store_accounts_operations.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | 1 | 2022-01-25T22:52:58.000Z | 2022-01-25T22:52:58.000Z | azure/mgmt/datalake/analytics/account/operations/data_lake_store_accounts_operations.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | azure/mgmt/datalake/analytics/account/operations/data_lake_store_accounts_operations.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class DataLakeStoreAccountsOperations(object):
"""DataLakeStoreAccountsOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An objec model deserializer.
:ivar api_version: Client Api Version. Constant value: "2016-11-01".
"""
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2016-11-01"
self.config = config
def add(
self, resource_group_name, account_name, data_lake_store_account_name, suffix=None, custom_headers=None, raw=False, **operation_config):
"""Updates the specified Data Lake Analytics account to include the
additional Data Lake Store account.
:param resource_group_name: The name of the Azure resource group that
contains the Data Lake Analytics account.
:type resource_group_name: str
:param account_name: The name of the Data Lake Analytics account to
which to add the Data Lake Store account.
:type account_name: str
:param data_lake_store_account_name: The name of the Data Lake Store
account to add.
:type data_lake_store_account_name: str
:param suffix: the optional suffix for the Data Lake Store account.
:type suffix: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: None or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
parameters = None
if suffix is not None:
parameters = models.AddDataLakeStoreParameters(suffix=suffix)
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
'dataLakeStoreAccountName': self._serialize.url("data_lake_store_account_name", data_lake_store_account_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
if parameters is not None:
body_content = self._serialize.body(parameters, 'AddDataLakeStoreParameters')
else:
body_content = None
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def delete(
self, resource_group_name, account_name, data_lake_store_account_name, custom_headers=None, raw=False, **operation_config):
"""Updates the Data Lake Analytics account specified to remove the
specified Data Lake Store account.
:param resource_group_name: The name of the Azure resource group that
contains the Data Lake Analytics account.
:type resource_group_name: str
:param account_name: The name of the Data Lake Analytics account from
which to remove the Data Lake Store account.
:type account_name: str
:param data_lake_store_account_name: The name of the Data Lake Store
account to remove
:type data_lake_store_account_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: None or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
'dataLakeStoreAccountName': self._serialize.url("data_lake_store_account_name", data_lake_store_account_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def get(
self, resource_group_name, account_name, data_lake_store_account_name, custom_headers=None, raw=False, **operation_config):
"""Gets the specified Data Lake Store account details in the specified
Data Lake Analytics account.
:param resource_group_name: The name of the Azure resource group that
contains the Data Lake Analytics account.
:type resource_group_name: str
:param account_name: The name of the Data Lake Analytics account from
which to retrieve the Data Lake Store account details.
:type account_name: str
:param data_lake_store_account_name: The name of the Data Lake Store
account to retrieve
:type data_lake_store_account_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: :class:`DataLakeStoreAccountInfo
<azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInfo>`
or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: :class:`DataLakeStoreAccountInfo
<azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInfo>`
or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
'dataLakeStoreAccountName': self._serialize.url("data_lake_store_account_name", data_lake_store_account_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('DataLakeStoreAccountInfo', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def list_by_account(
self, resource_group_name, account_name, filter=None, top=None, skip=None, select=None, orderby=None, count=None, custom_headers=None, raw=False, **operation_config):
"""Gets the first page of Data Lake Store accounts linked to the specified
Data Lake Analytics account. The response includes a link to the next
page, if any.
:param resource_group_name: The name of the Azure resource group that
contains the Data Lake Analytics account.
:type resource_group_name: str
:param account_name: The name of the Data Lake Analytics account for
which to list Data Lake Store accounts.
:type account_name: str
:param filter: OData filter. Optional.
:type filter: str
:param top: The number of items to return. Optional.
:type top: int
:param skip: The number of items to skip over before returning
elements. Optional.
:type skip: int
:param select: OData Select statement. Limits the properties on each
entry to just those requested, e.g.
Categories?$select=CategoryName,Description. Optional.
:type select: str
:param orderby: OrderBy clause. One or more comma-separated
expressions with an optional "asc" (the default) or "desc" depending
on the order you'd like the values sorted, e.g.
Categories?$orderby=CategoryName desc. Optional.
:type orderby: str
:param count: The Boolean value of true or false to request a count of
the matching resources included with the resources in the response,
e.g. Categories?$count=true. Optional.
:type count: bool
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of :class:`DataLakeStoreAccountInfo
<azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInfo>`
:rtype: :class:`DataLakeStoreAccountInfoPaged
<azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInfoPaged>`
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
if top is not None:
query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1)
if skip is not None:
query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=1)
if select is not None:
query_parameters['$select'] = self._serialize.query("select", select, 'str')
if orderby is not None:
query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str')
if count is not None:
query_parameters['$count'] = self._serialize.query("count", count, 'bool')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(
request, header_parameters, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
deserialized = models.DataLakeStoreAccountInfoPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.DataLakeStoreAccountInfoPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
| 49.859155 | 192 | 0.668192 | 1,939 | 17,700 | 5.920062 | 0.123775 | 0.02718 | 0.030578 | 0.043558 | 0.774371 | 0.750327 | 0.719139 | 0.697448 | 0.693614 | 0.675669 | 0 | 0.003114 | 0.237966 | 17,700 | 354 | 193 | 50 | 0.847939 | 0.355424 | 0 | 0.65625 | 0 | 0.025 | 0.195696 | 0.11363 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0375 | false | 0 | 0.025 | 0 | 0.1125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e722c1eb1d2bea4a1f19801458516ddedaac5629 | 226 | py | Python | 001146StepikPyBegin/Stepik001146PyBeginсh04p01st12C09_v06_Ivan_Merzlyakov_20200413.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 001146StepikPyBegin/Stepik001146PyBeginсh04p01st12C09_v06_Ivan_Merzlyakov_20200413.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 001146StepikPyBegin/Stepik001146PyBeginсh04p01st12C09_v06_Ivan_Merzlyakov_20200413.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | # https://stepik.org/lesson/265081/step/12?discussion=1542627&thread=solutions&unit=246029
s, a, b, c = 0, int(input()), int(input()), int(input())
s += a if a > 0 else 0
s += b if b > 0 else 0
s += c if c > 0 else 0
print(s)
| 32.285714 | 90 | 0.628319 | 47 | 226 | 3.021277 | 0.489362 | 0.169014 | 0.126761 | 0.225352 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149733 | 0.172566 | 226 | 6 | 91 | 37.666667 | 0.609626 | 0.389381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e72c41aab33604f2ec16e615d495812f5f5c7b37 | 139 | py | Python | login/urls.py | JianPpan/untitled_ClassManagement | f6bd968823fc376ec1971ee9d2eece308287455a | [
"MulanPSL-1.0"
] | null | null | null | login/urls.py | JianPpan/untitled_ClassManagement | f6bd968823fc376ec1971ee9d2eece308287455a | [
"MulanPSL-1.0"
] | null | null | null | login/urls.py | JianPpan/untitled_ClassManagement | f6bd968823fc376ec1971ee9d2eece308287455a | [
"MulanPSL-1.0"
] | null | null | null | from django.conf.urls import url
from login.views import login
app_name = 'logins'
urlpatterns = [
url(r'^$', login, name='login')
] | 15.444444 | 35 | 0.683453 | 20 | 139 | 4.7 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172662 | 139 | 9 | 36 | 15.444444 | 0.817391 | 0 | 0 | 0 | 0 | 0 | 0.092857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e72eb1777b0eeb9d14e40c925b44ea47d54e32ca | 289 | py | Python | kubernetes_typed/client/models/v1_nfs_volume_source.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 22 | 2020-12-10T13:06:02.000Z | 2022-02-13T21:58:15.000Z | kubernetes_typed/client/models/v1_nfs_volume_source.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 4 | 2021-03-08T07:06:12.000Z | 2022-03-29T23:41:45.000Z | kubernetes_typed/client/models/v1_nfs_volume_source.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 2 | 2021-09-05T19:18:28.000Z | 2022-03-14T02:56:17.000Z | # Code generated by `typeddictgen`. DO NOT EDIT.
"""V1NFSVolumeSourceDict generated type."""
from typing import TypedDict
V1NFSVolumeSourceDict = TypedDict(
"V1NFSVolumeSourceDict",
{
"path": str,
"readOnly": bool,
"server": str,
},
total=False,
)
| 20.642857 | 48 | 0.636678 | 25 | 289 | 7.36 | 0.8 | 0.326087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013699 | 0.242215 | 289 | 13 | 49 | 22.230769 | 0.826484 | 0.294118 | 0 | 0 | 1 | 0 | 0.19697 | 0.106061 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e765541ab914b48a4f43b07b88c06ff9c0e6465a | 44 | py | Python | cli/__init__.py | charlesreid1/dahak-taco | b7ab6d510f4989e495667c745c4dd818d1732823 | [
"BSD-3-Clause"
] | null | null | null | cli/__init__.py | charlesreid1/dahak-taco | b7ab6d510f4989e495667c745c4dd818d1732823 | [
"BSD-3-Clause"
] | null | null | null | cli/__init__.py | charlesreid1/dahak-taco | b7ab6d510f4989e495667c745c4dd818d1732823 | [
"BSD-3-Clause"
] | 1 | 2018-03-16T21:27:28.000Z | 2018-03-16T21:27:28.000Z | _program = "taco"
__version__ = "1.0.1beta"
| 14.666667 | 25 | 0.681818 | 6 | 44 | 4.166667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078947 | 0.136364 | 44 | 2 | 26 | 22 | 0.578947 | 0 | 0 | 0 | 0 | 0 | 0.295455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e76c656e6c74af8f2d56825e23cd387e36aeef31 | 401 | py | Python | dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py | srcarter3/python-awips | d981062662968cf3fb105e8e23d955950ae2497e | [
"BSD-3-Clause"
] | 33 | 2016-03-17T01:21:18.000Z | 2022-02-08T10:41:06.000Z | dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py | srcarter3/python-awips | d981062662968cf3fb105e8e23d955950ae2497e | [
"BSD-3-Clause"
] | 15 | 2016-04-19T16:34:08.000Z | 2020-09-09T19:57:54.000Z | dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py | Unidata/python-awips | 8459aa756816e5a45d2e5bea534d23d5b1dd1690 | [
"BSD-3-Clause"
] | 20 | 2016-03-12T01:46:58.000Z | 2022-02-08T06:53:22.000Z |
class GetGeometryDataResponse(object):
def __init__(self):
self.geometryWKBs = None
self.geoData = None
def getGeometryWKBs(self):
return self.geometryWKBs
def setGeometryWKBs(self, geometryWKBs):
self.geometryWKBs = geometryWKBs
def getGeoData(self):
return self.geoData
def setGeoData(self, geoData):
self.geoData = geoData
| 20.05 | 44 | 0.663342 | 38 | 401 | 6.894737 | 0.368421 | 0.244275 | 0.10687 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.261845 | 401 | 19 | 45 | 21.105263 | 0.885135 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0 | 0 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
e7d57733a14bd14b22ac54f00ccfc5903ce8b1c4 | 669 | py | Python | cumulusci/tasks/robotframework/tests/TestLibrary.py | jdominiczak/CumulusCI | f706c1906f9eb6d604c571a9dd16f5d0ed38599f | [
"BSD-3-Clause"
] | 163 | 2018-09-13T18:49:34.000Z | 2022-03-25T08:37:15.000Z | cumulusci/tasks/robotframework/tests/TestLibrary.py | jdominiczak/CumulusCI | f706c1906f9eb6d604c571a9dd16f5d0ed38599f | [
"BSD-3-Clause"
] | 1,280 | 2018-09-11T20:09:37.000Z | 2022-03-31T18:40:21.000Z | cumulusci/tasks/robotframework/tests/TestLibrary.py | jdominiczak/CumulusCI | f706c1906f9eb6d604c571a9dd16f5d0ed38599f | [
"BSD-3-Clause"
] | 125 | 2015-01-17T16:05:39.000Z | 2018-09-06T19:05:00.000Z | # from cumulusci.robotframework.utils import selenium_retry
# The following decorator is commented out, because with it the
# library gets two extra keywords. I'm not certain if that's what
# should be happening, or if those two keywords are actually just
# helper functions that are accidentially ending up as keywords
# @selenium_retry
class TestLibrary(object):
"""Documentation for the TestLibrary library."""
def library_keyword_one(self):
"""Keyword documentation with *bold* and _italics_"""
return "this is keyword one from TestLibrary.py"
def library_keyword_two(self):
return "this is keyword two from TestLibrary.py"
| 35.210526 | 65 | 0.748879 | 92 | 669 | 5.358696 | 0.630435 | 0.052738 | 0.068966 | 0.077079 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185351 | 669 | 18 | 66 | 37.166667 | 0.904587 | 0.623318 | 0 | 0 | 0 | 0 | 0.330508 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
e7db7db77f02f9ba4f004fea0210493ed47227bf | 168 | py | Python | My/test.py | wangzihan424/Myblog | 480443f2b6209f69dc8ab4e36349a41bf3c5c0a1 | [
"MIT"
] | 1 | 2018-01-01T12:31:51.000Z | 2018-01-01T12:31:51.000Z | My/test.py | wangzihan424/Myblog | 480443f2b6209f69dc8ab4e36349a41bf3c5c0a1 | [
"MIT"
] | null | null | null | My/test.py | wangzihan424/Myblog | 480443f2b6209f69dc8ab4e36349a41bf3c5c0a1 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
class People(object):
pass
class People1(object):
def __str__(self):
return "123"
p = People()
print p
p1 = People1()
print p1 | 12.923077 | 22 | 0.60119 | 23 | 168 | 4.217391 | 0.695652 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062992 | 0.244048 | 168 | 13 | 23 | 12.923077 | 0.700787 | 0.119048 | 0 | 0 | 0 | 0 | 0.020408 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.111111 | 0 | null | null | 0.222222 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e7defab092a8c6a31ee2f6d14dfbb7eb3596456d | 475 | py | Python | src/sqlfluff/core/__init__.py | pvonglehn/sqlfluff | 61eb251ee96b1b70aa477f3a2f2b9c351a04c1e8 | [
"MIT"
] | null | null | null | src/sqlfluff/core/__init__.py | pvonglehn/sqlfluff | 61eb251ee96b1b70aa477f3a2f2b9c351a04c1e8 | [
"MIT"
] | null | null | null | src/sqlfluff/core/__init__.py | pvonglehn/sqlfluff | 61eb251ee96b1b70aa477f3a2f2b9c351a04c1e8 | [
"MIT"
] | 1 | 2021-03-07T21:49:52.000Z | 2021-03-07T21:49:52.000Z | """The core elements of sqlfluff."""
# flake8: noqa: F401
# Config objects
from sqlfluff.core.config import FluffConfig
# Public classes
from sqlfluff.core.linter import Linter
from sqlfluff.core.parser import Lexer, Parser
# Dialect introspection
from sqlfluff.core.dialects import dialect_selector, dialect_readout
# All of the errors.
from sqlfluff.core.errors import (
SQLBaseError,
SQLTemplaterError,
SQLLexError,
SQLParseError,
SQLLintError,
)
| 20.652174 | 68 | 0.768421 | 56 | 475 | 6.482143 | 0.535714 | 0.165289 | 0.220386 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010025 | 0.16 | 475 | 22 | 69 | 21.590909 | 0.899749 | 0.254737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.454545 | 0 | 0.454545 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
99bbb76447ce3721bfcbb6a8e1979553d2d5700b | 310 | py | Python | latex/code/paradigms/oop/class_abstract.py | nikoladze/icsc-paradigms-and-patterns | 019e51b6fa7747a9a7ee24ca48315e1988565ef2 | [
"CC0-1.0",
"CC-BY-4.0"
] | 10 | 2020-09-28T12:14:31.000Z | 2021-09-22T18:38:13.000Z | latex/code/paradigms/oop/class_abstract.py | nikoladze/icsc-paradigms-and-patterns | 019e51b6fa7747a9a7ee24ca48315e1988565ef2 | [
"CC0-1.0",
"CC-BY-4.0"
] | 5 | 2020-09-28T13:40:52.000Z | 2021-12-06T16:38:09.000Z | latex/code/paradigms/oop/class_abstract.py | nikoladze/icsc-paradigms-and-patterns | 019e51b6fa7747a9a7ee24ca48315e1988565ef2 | [
"CC0-1.0",
"CC-BY-4.0"
] | 5 | 2020-09-28T13:10:45.000Z | 2021-12-06T16:05:16.000Z | from abc import ABC, abstractmethod
class Shape(ABC):
@abstractmethod
def calculate_area(self):
pass
@abstractmethod
def draw(self):
pass
class Rectangle(Shape):
def __init__(self, ...):
...
def calculate_area(self):
# concrete implementation here
| 15.5 | 38 | 0.619355 | 32 | 310 | 5.8125 | 0.53125 | 0.182796 | 0.172043 | 0.215054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.287097 | 310 | 19 | 39 | 16.315789 | 0.841629 | 0.090323 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.166667 | 0.083333 | null | null | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
99bd70b0b1f3c2fefc5fbd3c5e4dfb7838ccf414 | 447 | py | Python | blogapp/models.py | FnK-Lap/Unchained | 3a78d0597ab34737fdcc6d347c87063e93fad9cf | [
"MIT"
] | null | null | null | blogapp/models.py | FnK-Lap/Unchained | 3a78d0597ab34737fdcc6d347c87063e93fad9cf | [
"MIT"
] | null | null | null | blogapp/models.py | FnK-Lap/Unchained | 3a78d0597ab34737fdcc6d347c87063e93fad9cf | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
class Post(models.Model):
content = models.TextField()
created_at = models.DateTimeField()
def __str__(self):
return self.content
class Comment(models.Model):
comment = models.CharField(max_length=200)
created_at = models.DateTimeField()
post = models.ForeignKey(Post, on_delete=models.CASCADE)
def __str__(self):
return self.comment | 29.8 | 66 | 0.693512 | 54 | 447 | 5.518519 | 0.537037 | 0.067114 | 0.100671 | 0.187919 | 0.134228 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008499 | 0.210291 | 447 | 15 | 67 | 29.8 | 0.835694 | 0.053691 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.083333 | 0.166667 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
99d0ec460ef85f6b78235bb1df6008162b91ab1f | 904 | py | Python | dypy/tests/test_variables.py | nickrsan/dypy | 78ebdc02ce1908446d4cc6e0ee1927c91f820d9f | [
"MIT"
] | 3 | 2019-03-12T21:13:45.000Z | 2022-02-18T09:55:07.000Z | dypy/tests/test_variables.py | nickrsan/dypy | 78ebdc02ce1908446d4cc6e0ee1927c91f820d9f | [
"MIT"
] | 2 | 2019-04-03T02:13:54.000Z | 2019-04-03T02:18:56.000Z | dypy/tests/test_variables.py | nickrsan/dypy | 78ebdc02ce1908446d4cc6e0ee1927c91f820d9f | [
"MIT"
] | null | null | null | import unittest
import dypy
class VariableSupportTest(unittest.TestCase):
def test_check_variable_id(self):
"""
Makes sure that when no variable_id is provided, we get the names
we expect
:return:
"""
name_id_pairs = {
"variable_id": "variable_id",
"Variable_id": "variable_id",
"Variable ID": "variable_id",
"5three Variable": "three_variable",
"Remove-my-hyphens": "remove_my_hyphens",
}
leave_capitalization_intact = {
"variable_id": "variable_id",
"Variable_id": "Variable_id",
"Variable ID": "Variable_ID",
"5three Variable": "three_Variable",
"Remove-my-hyphens": "Remove_my_hyphens",
}
for key in name_id_pairs:
self.assertEqual(name_id_pairs[key], dypy.variables.check_variable_id(key, None))
for key in leave_capitalization_intact:
self.assertEqual(leave_capitalization_intact[key], dypy.variables.check_variable_id(key, key))
| 25.828571 | 97 | 0.724558 | 118 | 904 | 5.245763 | 0.347458 | 0.258481 | 0.290792 | 0.323102 | 0.487884 | 0.487884 | 0.487884 | 0.378029 | 0.378029 | 0.378029 | 0 | 0.002614 | 0.153761 | 904 | 34 | 98 | 26.588235 | 0.806536 | 0.10177 | 0 | 0.090909 | 0 | 0 | 0.321696 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0.045455 | false | 0 | 0.090909 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
99e52f49796b5d41076aba34de619bcc405c5d52 | 155 | py | Python | m06_file1.py | AmreshTripathy/Advance-Python | 0cfe3fc263af1080edbf9167895a51d27be64993 | [
"Apache-2.0"
] | null | null | null | m06_file1.py | AmreshTripathy/Advance-Python | 0cfe3fc263af1080edbf9167895a51d27be64993 | [
"Apache-2.0"
] | null | null | null | m06_file1.py | AmreshTripathy/Advance-Python | 0cfe3fc263af1080edbf9167895a51d27be64993 | [
"Apache-2.0"
] | null | null | null | def greet(name):
print (f'Good morning, {name}')
# print (__name__)
if __name__ == '__main__':
n = input('Enter Your name: ')
greet(n)
| 19.375 | 36 | 0.574194 | 20 | 155 | 3.85 | 0.65 | 0.233766 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.258065 | 155 | 7 | 37 | 22.142857 | 0.669565 | 0.103226 | 0 | 0 | 0 | 0 | 0.346154 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
99edf83c304fa89bec4ed4d3b21dd4548b013c50 | 1,368 | py | Python | bot/utils/errors.py | Clutter-Development/Clutter | 6b725c016a439958caaa7d88bacae8e2b11ca272 | [
"CC0-1.0"
] | 6 | 2022-02-04T17:11:19.000Z | 2022-03-05T09:14:39.000Z | bot/utils/errors.py | Clutter-Development/Clutter | 6b725c016a439958caaa7d88bacae8e2b11ca272 | [
"CC0-1.0"
] | 2 | 2022-02-08T16:53:42.000Z | 2022-02-19T07:44:19.000Z | bot/utils/errors.py | Clutter-Development/Clutter | 6b725c016a439958caaa7d88bacae8e2b11ca272 | [
"CC0-1.0"
] | 2 | 2022-02-18T21:28:57.000Z | 2022-02-23T17:08:18.000Z | import discord
from discord import app_commands as app
__all__ = (
"ClutterError",
"InDevelopmentMode",
"UserIsBlacklisted",
"GuildIsBlacklisted",
"UserHasBeenBlacklisted",
"GlobalCooldownReached",
"UnknownTranslationString",
)
class ClutterError(discord.DiscordException):
"""Base class for all Clutter errors."""
class InDevelopmentMode(ClutterError, app.AppCommandError):
"""Raised when a user is not a bot admin and bot is in development mode when using an app command."""
class UserIsBlacklisted(ClutterError, app.AppCommandError):
"""Raised when a user is blacklisted when using an app command."""
class GuildIsBlacklisted(ClutterError, app.AppCommandError):
"""Raised when a guild is blacklisted when using an app command."""
class UserHasBeenBlacklisted(ClutterError, app.AppCommandError):
"""Raised when a user is blacklisted when using an app command."""
class GlobalCooldownReached(ClutterError, app.AppCommandError):
"""Raised when a user is blacklisted when using an app command."""
def __init__(self, retry_after: float, message: str, /):
self.retry_after = retry_after
self.message = message
def __str__(self):
return self.message
class UnknownTranslationString(ClutterError, app.AppCommandError):
"""Raised when a translation string is missing"""
| 28.5 | 105 | 0.736111 | 150 | 1,368 | 6.606667 | 0.333333 | 0.090817 | 0.181635 | 0.217962 | 0.445005 | 0.445005 | 0.336024 | 0.336024 | 0.249243 | 0.249243 | 0 | 0 | 0.173977 | 1,368 | 47 | 106 | 29.106383 | 0.876991 | 0.306287 | 0 | 0 | 0 | 0 | 0.143483 | 0.073384 | 0 | 0 | 0 | 0 | 0 | 1 | 0.086957 | false | 0 | 0.086957 | 0.043478 | 0.521739 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
820477ca11e0ba3796ae1ed723f0175e4fd87448 | 2,035 | py | Python | pysnmp/REMOTE-LOGIN-TRAP-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/REMOTE-LOGIN-TRAP-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/REMOTE-LOGIN-TRAP-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module REMOTE-LOGIN-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REMOTE-LOGIN-TRAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:47:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint")
s5AgRemoteLoginIp, s5AgRemoteLoginStatus = mibBuilder.importSymbols("S5-AGENT-MIB", "s5AgRemoteLoginIp", "s5AgRemoteLoginStatus")
remoteLoginTrap, = mibBuilder.importSymbols("S5-ROOT-MIB", "remoteLoginTrap")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Counter64, Integer32, NotificationType, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Gauge32, IpAddress, MibIdentifier, NotificationType, ModuleIdentity, ObjectIdentity, Bits, TimeTicks, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Integer32", "NotificationType", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Gauge32", "IpAddress", "MibIdentifier", "NotificationType", "ModuleIdentity", "ObjectIdentity", "Bits", "TimeTicks", "Counter32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
remoteLoginStatus = NotificationType((1, 3, 6, 1, 4, 1, 45, 1, 6, 2, 8) + (0,1)).setObjects(("S5-AGENT-MIB", "s5AgRemoteLoginIp"), ("S5-AGENT-MIB", "s5AgRemoteLoginStatus"))
mibBuilder.exportSymbols("REMOTE-LOGIN-TRAP-MIB", remoteLoginStatus=remoteLoginStatus)
| 113.055556 | 515 | 0.786241 | 200 | 2,035 | 8 | 0.51 | 0.115 | 0.028125 | 0.03375 | 0.35375 | 0.23 | 0.23 | 0.23 | 0.23 | 0.23 | 0 | 0.049285 | 0.072727 | 2,035 | 17 | 516 | 119.705882 | 0.798622 | 0.165111 | 0 | 0 | 0 | 0 | 0.363905 | 0.063314 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
82270abb34448de1d28c848049ee656003285eab | 2,902 | py | Python | cellrank/_key.py | WeilerP/cellrank | c8c2b9f6bd2448861fb414435aee7620ca5a0bad | [
"BSD-3-Clause"
] | 172 | 2020-03-19T19:50:53.000Z | 2022-03-28T09:36:04.000Z | cellrank/_key.py | WeilerP/cellrank | c8c2b9f6bd2448861fb414435aee7620ca5a0bad | [
"BSD-3-Clause"
] | 702 | 2020-03-19T08:09:04.000Z | 2022-03-30T09:55:14.000Z | cellrank/_key.py | WeilerP/cellrank | c8c2b9f6bd2448861fb414435aee7620ca5a0bad | [
"BSD-3-Clause"
] | 17 | 2020-04-07T03:11:02.000Z | 2022-02-02T20:39:16.000Z | from typing import Any, Callable, Optional
class cprop:
"""Class property."""
def __init__(self, f: Callable[..., str]):
self.f = f
def __get__(self, obj: Any, owner: Any) -> str:
return self.f(owner)
class Key:
"""Class which manages keys in :class:`anndata.AnnData`."""
@classmethod
def backward(cls, bwd: bool) -> str:
return "bwd" if bwd else "fwd"
@classmethod
def where(cls, bwd: bool) -> str:
return "from" if bwd else "to"
@classmethod
def initial(cls, bwd: bool) -> str:
return "initial" if bwd else "terminal"
@classmethod
def cytotrace(cls, key: str) -> str:
return f"ct_{key}"
class obs:
@classmethod
def probs(cls, key: str) -> str:
return f"{key}_probs"
@classmethod
def macrostates(cls, bwd: bool) -> str:
return f"macrostates_{Key.backward(bwd)}"
@classmethod
def term_states(cls, bwd: bool) -> str:
return f"{Key.initial(bwd)}_states"
@classmethod
def priming_degree(cls, bwd: bool) -> str:
return f"priming_degree_{Key.backward(bwd)}"
class obsm:
@classmethod
def memberships(cls, key: str) -> str:
return f"{key}_memberships"
@classmethod
def schur_vectors(cls, bwd: bool) -> str:
return f"schur_vectors_{Key.backward(bwd)}"
@classmethod
def macrostates(cls, bwd: bool) -> str:
return f"macrostates_{Key.backward(bwd)}"
@classmethod
def abs_probs(cls, bwd: bool) -> str:
return ("from" if bwd else "to") + "_" + Key.obs.term_states(bwd)
@classmethod
def abs_times(cls, bwd: bool) -> str:
return f"absorption_times_{Key.backward(bwd)}"
class varm:
@classmethod
def lineage_drivers(cls, bwd: bool):
return ("initial" if bwd else "terminal") + "_lineage_drivers"
class uns:
@classmethod
def kernel(cls, bwd: bool, key: Optional[str] = None) -> str:
return key if key is not None else f"T_{Key.backward(bwd)}"
@classmethod
def estimator(cls, bwd: bool, key: Optional[str] = None) -> str:
return key if key is not None else f"{Key.backward(bwd)}_estimator"
@classmethod
def names(cls, key: str) -> str:
return f"{key}_names"
@classmethod
def colors(cls, key: str) -> str:
return f"{key}_colors"
@classmethod
def eigen(cls, bwd: bool) -> str:
return f"eigendecomposition_{Key.backward(bwd)}"
@classmethod
def schur_matrix(cls, bwd: bool) -> str:
return f"schur_matrix_{Key.backward(bwd)}"
@classmethod
def coarse(cls, bwd: bool) -> str:
return f"coarse_{Key.backward(bwd)}"
| 27.903846 | 79 | 0.567884 | 351 | 2,902 | 4.584046 | 0.193732 | 0.117464 | 0.099441 | 0.105034 | 0.497825 | 0.417029 | 0.30578 | 0.220012 | 0.220012 | 0.220012 | 0 | 0 | 0.308063 | 2,902 | 103 | 80 | 28.174757 | 0.801295 | 0.023777 | 0 | 0.337838 | 0 | 0 | 0.163005 | 0.119064 | 0 | 0 | 0 | 0 | 0 | 1 | 0.310811 | false | 0 | 0.013514 | 0.297297 | 0.702703 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8237ae1f3b2386a6d8ebda2469e470afeb0c3eb1 | 140 | py | Python | cride/circles/urls.py | jgmc3012/cride | 19401b5c19aa706c9928c12195fd8303d75f1d49 | [
"MIT"
] | null | null | null | cride/circles/urls.py | jgmc3012/cride | 19401b5c19aa706c9928c12195fd8303d75f1d49 | [
"MIT"
] | 5 | 2020-06-30T21:41:49.000Z | 2021-09-08T02:15:04.000Z | cride/circles/urls.py | jmillandev/cride | 19401b5c19aa706c9928c12195fd8303d75f1d49 | [
"MIT"
] | null | null | null | from django.urls import path
from cride.circles.views import ListCreateAPIView
urlpatterns = [
path('', ListCreateAPIView.as_view())
] | 20 | 49 | 0.764286 | 16 | 140 | 6.625 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135714 | 140 | 7 | 50 | 20 | 0.876033 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
4130f4d682db7205fa5d7279b9c35cacaaafe8cb | 319 | py | Python | framework/core/error_views.py | ravique/otus-framework | 46a519ff4b64c2be7fc23f8f43eefdd3b0c94512 | [
"MIT"
] | null | null | null | framework/core/error_views.py | ravique/otus-framework | 46a519ff4b64c2be7fc23f8f43eefdd3b0c94512 | [
"MIT"
] | null | null | null | framework/core/error_views.py | ravique/otus-framework | 46a519ff4b64c2be7fc23f8f43eefdd3b0c94512 | [
"MIT"
] | 1 | 2019-06-28T21:08:55.000Z | 2019-06-28T21:08:55.000Z | from framework.core.template_handlers import env, render_template
def not_found_view(request, **kwargs):
return 'Page not found :('
def forbidden_view(request, **kwargs):
context = kwargs.get('context')
template = env.get_template('forbidden.html')
return render_template(template, context=context)
| 26.583333 | 65 | 0.746082 | 40 | 319 | 5.775 | 0.5 | 0.121212 | 0.147186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141066 | 319 | 11 | 66 | 29 | 0.843066 | 0 | 0 | 0 | 0 | 0 | 0.119122 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.142857 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
4134733b100980a0fe17da1135eb9bebe76ac9be | 495 | py | Python | psola/utilities/find.py | diguo2046/psola | a45fff605c4ea75145deb4a316924026bf278f85 | [
"MIT"
] | 43 | 2018-05-23T05:45:28.000Z | 2021-11-28T08:11:01.000Z | psola/utilities/find.py | diguo2046/psola | a45fff605c4ea75145deb4a316924026bf278f85 | [
"MIT"
] | null | null | null | psola/utilities/find.py | diguo2046/psola | a45fff605c4ea75145deb4a316924026bf278f85 | [
"MIT"
] | 15 | 2018-05-16T04:59:30.000Z | 2021-05-16T08:57:37.000Z | #!/usr/bin/env python
"""
psola.utilities.find
Implements a function that sort-of works like MATLAB's find
This is preferable to importing `find' from pylab, IMO
Author: jreinhold
Created on: Aug 18, 2017
"""
import numpy as np
def find(x):
"""
kind-of mimics the find command in matlab,
really created to avoid repetition in code
Args:
x (numpy mask): condition, e.g., x < 5
Returns:
indices where x is true
"""
return np.squeeze(np.where(x))
| 18.333333 | 59 | 0.660606 | 77 | 495 | 4.246753 | 0.766234 | 0.036697 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018667 | 0.242424 | 495 | 26 | 60 | 19.038462 | 0.853333 | 0.757576 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
4138547503fa6fe8d1074b5b2c7712299cb4ca8e | 55 | py | Python | Python Scripts/lesson_137_main.py | jessequinn/udemy_python_complete | b97e657dea2a8680557949f01ac80d3230c82c41 | [
"MIT"
] | null | null | null | Python Scripts/lesson_137_main.py | jessequinn/udemy_python_complete | b97e657dea2a8680557949f01ac80d3230c82c41 | [
"MIT"
] | null | null | null | Python Scripts/lesson_137_main.py | jessequinn/udemy_python_complete | b97e657dea2a8680557949f01ac80d3230c82c41 | [
"MIT"
] | null | null | null | a =3
b = "tim"
c = 1, 2, 3
print(a)
print(b)
print(c)
| 6.875 | 11 | 0.509091 | 14 | 55 | 2 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097561 | 0.254545 | 55 | 7 | 12 | 7.857143 | 0.585366 | 0 | 0 | 0 | 0 | 0 | 0.054545 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
415a0184fc0cf2acf5e7fa555af6365ef819e0ca | 2,581 | py | Python | preprocessing/fields/amazon_fields.py | stungkit/Copycat-abstractive-opinion-summarizer | 04fe5393a7bb6883516766b762f6a0c530e95375 | [
"MIT"
] | 51 | 2020-09-25T07:05:01.000Z | 2022-03-17T12:07:40.000Z | preprocessing/fields/amazon_fields.py | stungkit/Copycat-abstractive-opinion-summarizer | 04fe5393a7bb6883516766b762f6a0c530e95375 | [
"MIT"
] | 4 | 2020-10-19T10:00:22.000Z | 2022-03-14T17:02:47.000Z | preprocessing/fields/amazon_fields.py | stungkit/Copycat-abstractive-opinion-summarizer | 04fe5393a7bb6883516766b762f6a0c530e95375 | [
"MIT"
] | 22 | 2020-09-22T01:06:47.000Z | 2022-01-26T14:20:09.000Z | class AmazonFields(object):
PROD_ID = "asin"
REV_TEXT = "reviewText"
OVERALL = 'overall'
# group ids there are used to produce summaries
EXCLUDED_GROUP_IDS = {'B005085X5Y',
'B0052PKEYK',
'B009L0KU46',
'B006QM4HOG',
'B005DO7R3G',
'B007I8G8A8',
'B004X86A86',
'B0040EIHQQ',
'B002AROW78',
'B005BQ6YYO',
'B0013EQ20Y',
'B000A2FTN6',
'B006UF64CW',
'B00AZ6WVQU',
'B001QCZ3E4',
'B001TKE25E',
'B0051PJHDK',
'B005ZA2W42',
'B003U8K0N6',
'B003YJ5LLM',
'B000BYGGBW',
'B004IV8Y50',
'B00DB94FB2',
'B002RL8IGI',
'B004G8EKIA',
'B000V7CPJG',
'B001H9O71Q',
'B00BOZCSQE',
'B000EB7OTU',
'B005MZO5TA',
'B000EZUQK0',
'B005H86LZ8',
'B005JS7KME',
'B000YA8NYQ',
'B002BJU8YQ',
'B00GW5NX88',
'B004OQQLTU',
'B008Z8W714',
'B003HT9W32',
'B00028QA72',
'B000EXUB3E',
'B000N245Y2',
'B0039PH51K',
'B006ZO110I',
'B004U3Y9FU',
'B006NNLX2C',
'B006Y401K0',
'B00006IUVM',
'B004R9X6VU',
'B000COQT0Y',
'B0002U34HY',
'B000N6MI7E',
'B0000CCY1S',
'B001EQJ5AU',
'B00442C8RS',
'B0036SGFXO',
'B0025OO8DO',
'B001GCV0FK',
'B00455NTOU',
'B006CO18RM'
}
| 37.955882 | 51 | 0.279737 | 82 | 2,581 | 8.756098 | 0.963415 | 0.022284 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.321701 | 0.644711 | 2,581 | 67 | 52 | 38.522388 | 0.461287 | 0.017435 | 0 | 0 | 0 | 0 | 0.245067 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4165009c85e483f589a199ebd8b12e333a80178e | 1,168 | py | Python | yqml/select.py | maztohir/YQML | 6e5eb06f2869a7309614120cc56ac04f5a689c9f | [
"MIT"
] | 2 | 2021-03-11T16:44:02.000Z | 2021-04-17T17:57:38.000Z | yqml/select.py | maztohir/yqml | 6e5eb06f2869a7309614120cc56ac04f5a689c9f | [
"MIT"
] | null | null | null | yqml/select.py | maztohir/yqml | 6e5eb06f2869a7309614120cc56ac04f5a689c9f | [
"MIT"
] | null | null | null | from yqml.keys import Keys
from .where import Where
from .join import Join, RightJoin, LeftJoin
from .fields import Fields
class Select:
def __init__(self, dict):
self._content = dict
def to_sql(self):
query = f"SELECT {self.field_clause} {self.from_clause} {self.join_clause} {self.left_join_clause} {self.right_join_clause} {self.where_clause}"
return query
@property
def field_clause(self):
return Fields(self._content.get(Keys.SELECT)).to_raw_sql()
@property
def from_clause(self):
return From(self._content).to_raw_sql()
@property
def join_clause(self):
return Join(self._content).to_raw_sql()
@property
def right_join_clause(self):
return RightJoin(self._content).to_raw_sql()
@property
def left_join_clause(self):
return LeftJoin(self._content).to_raw_sql()
@property
def where_clause(self):
return Where(self._content).to_raw_sql()
class From:
def __init__(self, dict):
self._content = dict
def to_raw_sql(self):
table_id = self._content.get(Keys.FROM)
return f'FROM {table_id}' | 26.545455 | 152 | 0.668664 | 160 | 1,168 | 4.56875 | 0.1875 | 0.150479 | 0.076607 | 0.109439 | 0.311902 | 0.259918 | 0.259918 | 0.095759 | 0.095759 | 0 | 0 | 0 | 0.22774 | 1,168 | 44 | 153 | 26.545455 | 0.810421 | 0 | 0 | 0.294118 | 0 | 0.029412 | 0.126604 | 0.040205 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0 | 0.117647 | 0.176471 | 0.705882 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
4177f78e0fda7c1ab99934917f15b1e0a6282a28 | 16,492 | py | Python | heat/tests/api/openstack_v1/test_routes.py | whitepages/heat | 4da2e1262fa42e6107389ba7a0e72ade024e316f | [
"Apache-2.0"
] | null | null | null | heat/tests/api/openstack_v1/test_routes.py | whitepages/heat | 4da2e1262fa42e6107389ba7a0e72ade024e316f | [
"Apache-2.0"
] | null | null | null | heat/tests/api/openstack_v1/test_routes.py | whitepages/heat | 4da2e1262fa42e6107389ba7a0e72ade024e316f | [
"Apache-2.0"
] | 1 | 2021-03-21T11:37:03.000Z | 2021-03-21T11:37:03.000Z | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import heat.api.openstack.v1 as api_v1
from heat.tests import common
class RoutesTest(common.HeatTestCase):
def assertRoute(self, mapper, path, method, action, controller,
params=None):
params = params or {}
route = mapper.match(path, {'REQUEST_METHOD': method})
self.assertIsNotNone(route)
self.assertEqual(action, route['action'])
self.assertEqual(
controller, route['controller'].controller.__class__.__name__)
del(route['action'])
del(route['controller'])
self.assertEqual(params, route)
def setUp(self):
super(RoutesTest, self).setUp()
self.m = api_v1.API({}).map
def test_template_handling(self):
self.assertRoute(
self.m,
'/aaaa/resource_types',
'GET',
'list_resource_types',
'StackController',
{
'tenant_id': 'aaaa',
})
self.assertRoute(
self.m,
'/aaaa/resource_types/test_type',
'GET',
'resource_schema',
'StackController',
{
'tenant_id': 'aaaa',
'type_name': 'test_type'
})
self.assertRoute(
self.m,
'/aaaa/resource_types/test_type/template',
'GET',
'generate_template',
'StackController',
{
'tenant_id': 'aaaa',
'type_name': 'test_type'
})
self.assertRoute(
self.m,
'/aaaa/validate',
'POST',
'validate_template',
'StackController',
{
'tenant_id': 'aaaa'
})
def test_stack_collection(self):
self.assertRoute(
self.m,
'/aaaa/stacks',
'GET',
'index',
'StackController',
{
'tenant_id': 'aaaa'
})
self.assertRoute(
self.m,
'/aaaa/stacks',
'POST',
'create',
'StackController',
{
'tenant_id': 'aaaa'
})
self.assertRoute(
self.m,
'/aaaa/stacks/preview',
'POST',
'preview',
'StackController',
{
'tenant_id': 'aaaa'
})
self.assertRoute(
self.m,
'/aaaa/stacks/detail',
'GET',
'detail',
'StackController',
{
'tenant_id': 'aaaa'
})
def test_stack_data(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack',
'GET',
'lookup',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack'
})
self.assertRoute(
self.m,
'/aaaa/stacks/arn:openstack:heat::6548ab64fbda49deb188851a3b7d8c8b'
':stacks/stack-1411-06/1c5d9bb2-3464-45e2-a728-26dfa4e1d34a',
'GET',
'lookup',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'arn:openstack:heat:'
':6548ab64fbda49deb188851a3b7d8c8b:stacks/stack-1411-06/'
'1c5d9bb2-3464-45e2-a728-26dfa4e1d34a'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/resources',
'GET',
'lookup',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'path': 'resources'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/events',
'GET',
'lookup',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'path': 'events'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb',
'GET',
'show',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
})
def test_stack_snapshot(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/snapshots',
'POST',
'snapshot',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/snapshots/cccc',
'GET',
'show_snapshot',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'snapshot_id': 'cccc'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/snapshots/cccc',
'DELETE',
'delete_snapshot',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'snapshot_id': 'cccc'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/snapshots',
'GET',
'list_snapshots',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/snapshots/cccc/restore',
'POST',
'restore_snapshot',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'snapshot_id': 'cccc'
})
def test_stack_outputs(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/outputs',
'GET',
'list_outputs',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb'
}
)
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/outputs/cccc',
'GET',
'show_output',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'output_key': 'cccc'
}
)
def test_stack_data_template(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/template',
'GET',
'template',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/template',
'GET',
'lookup',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'path': 'template'
})
def test_stack_post_actions(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/actions',
'POST',
'action',
'ActionController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
})
def test_stack_post_actions_lookup_redirect(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/actions',
'POST',
'lookup',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'path': 'actions'
})
def test_stack_update_delete(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb',
'PUT',
'update',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb',
'DELETE',
'delete',
'StackController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
})
def test_resources(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/resources',
'GET',
'index',
'ResourceController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/resources/cccc',
'GET',
'show',
'ResourceController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'resource_name': 'cccc'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/resources/cccc/metadata',
'GET',
'metadata',
'ResourceController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'resource_name': 'cccc'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/resources/cccc/signal',
'POST',
'signal',
'ResourceController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'resource_name': 'cccc'
})
def test_events(self):
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/events',
'GET',
'index',
'EventController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/resources/cccc/events',
'GET',
'index',
'EventController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'resource_name': 'cccc'
})
self.assertRoute(
self.m,
'/aaaa/stacks/teststack/bbbb/resources/cccc/events/dddd',
'GET',
'show',
'EventController',
{
'tenant_id': 'aaaa',
'stack_name': 'teststack',
'stack_id': 'bbbb',
'resource_name': 'cccc',
'event_id': 'dddd'
})
def test_software_configs(self):
self.assertRoute(
self.m,
'/aaaa/software_configs',
'GET',
'index',
'SoftwareConfigController',
{
'tenant_id': 'aaaa'
})
self.assertRoute(
self.m,
'/aaaa/software_configs',
'POST',
'create',
'SoftwareConfigController',
{
'tenant_id': 'aaaa'
})
self.assertRoute(
self.m,
'/aaaa/software_configs/bbbb',
'GET',
'show',
'SoftwareConfigController',
{
'tenant_id': 'aaaa',
'config_id': 'bbbb'
})
self.assertRoute(
self.m,
'/aaaa/software_configs/bbbb',
'DELETE',
'delete',
'SoftwareConfigController',
{
'tenant_id': 'aaaa',
'config_id': 'bbbb'
})
def test_software_deployments(self):
self.assertRoute(
self.m,
'/aaaa/software_deployments',
'GET',
'index',
'SoftwareDeploymentController',
{
'tenant_id': 'aaaa'
})
self.assertRoute(
self.m,
'/aaaa/software_deployments',
'POST',
'create',
'SoftwareDeploymentController',
{
'tenant_id': 'aaaa'
})
self.assertRoute(
self.m,
'/aaaa/software_deployments/bbbb',
'GET',
'show',
'SoftwareDeploymentController',
{
'tenant_id': 'aaaa',
'deployment_id': 'bbbb'
})
self.assertRoute(
self.m,
'/aaaa/software_deployments/bbbb',
'PUT',
'update',
'SoftwareDeploymentController',
{
'tenant_id': 'aaaa',
'deployment_id': 'bbbb'
})
self.assertRoute(
self.m,
'/aaaa/software_deployments/bbbb',
'DELETE',
'delete',
'SoftwareDeploymentController',
{
'tenant_id': 'aaaa',
'deployment_id': 'bbbb'
})
def test_build_info(self):
self.assertRoute(
self.m,
'/fake_tenant/build_info',
'GET',
'build_info',
'BuildInfoController',
{'tenant_id': 'fake_tenant'}
)
def test_405(self):
self.assertRoute(
self.m,
'/fake_tenant/validate',
'GET',
'reject',
'DefaultMethodController',
{'tenant_id': 'fake_tenant', 'allowed_methods': 'POST'}
)
self.assertRoute(
self.m,
'/fake_tenant/stacks',
'PUT',
'reject',
'DefaultMethodController',
{'tenant_id': 'fake_tenant', 'allowed_methods': 'GET,POST'}
)
self.assertRoute(
self.m,
'/fake_tenant/stacks/fake_stack/stack_id',
'POST',
'reject',
'DefaultMethodController',
{'tenant_id': 'fake_tenant', 'stack_name': 'fake_stack',
'stack_id': 'stack_id', 'allowed_methods': 'GET,PUT,PATCH,DELETE'}
)
def test_options(self):
self.assertRoute(
self.m,
'/fake_tenant/validate',
'OPTIONS',
'options',
'DefaultMethodController',
{'tenant_id': 'fake_tenant', 'allowed_methods': 'POST'}
)
self.assertRoute(
self.m,
'/fake_tenant/stacks/fake_stack/stack_id',
'OPTIONS',
'options',
'DefaultMethodController',
{'tenant_id': 'fake_tenant', 'stack_name': 'fake_stack',
'stack_id': 'stack_id', 'allowed_methods': 'GET,PUT,PATCH,DELETE'}
)
def test_services(self):
self.assertRoute(
self.m,
'/aaaa/services',
'GET',
'index',
'ServiceController',
{
'tenant_id': 'aaaa'
})
| 28.288165 | 79 | 0.431057 | 1,227 | 16,492 | 5.619397 | 0.136919 | 0.108774 | 0.135025 | 0.142132 | 0.751269 | 0.742857 | 0.732995 | 0.656853 | 0.60145 | 0.519797 | 0 | 0.010723 | 0.445853 | 16,492 | 582 | 80 | 28.33677 | 0.743736 | 0.033107 | 0 | 0.724584 | 0 | 0 | 0.320276 | 0.120213 | 0 | 0 | 0 | 0 | 0.099815 | 1 | 0.03512 | false | 0 | 0.003697 | 0 | 0.040665 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
417897748e026f4f02ed88c0117e7837109fc500 | 185 | py | Python | test_django/hello/urls.py | YEZHIAN1996/pythonstudy | a8774ef97266e8ab0289484ef190d2ee55f1d37c | [
"Apache-2.0"
] | 1 | 2022-02-22T01:54:56.000Z | 2022-02-22T01:54:56.000Z | test_django/hello/urls.py | YEZHIAN1996/pythonstudy | a8774ef97266e8ab0289484ef190d2ee55f1d37c | [
"Apache-2.0"
] | null | null | null | test_django/hello/urls.py | YEZHIAN1996/pythonstudy | a8774ef97266e8ab0289484ef190d2ee55f1d37c | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from hello.views import is_odd, http_req
urlpatterns = [
path('<int:num>/', is_odd, name='is_odd'),
path('http/req/', http_req, name='http_req')
]
| 23.125 | 48 | 0.681081 | 30 | 185 | 4 | 0.5 | 0.233333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151351 | 185 | 7 | 49 | 26.428571 | 0.764331 | 0 | 0 | 0 | 0 | 0 | 0.179348 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
41a2184952e142a5afb3083c0dbf463ce07bbe9d | 462 | py | Python | eu/softfire/tub/exceptions/exceptions.py | softfire-eu/experiment-manager | 3e44c917e956bac0359a0303f9a3d0708481e1c9 | [
"Apache-2.0"
] | 3 | 2017-05-08T10:45:28.000Z | 2017-08-08T13:18:54.000Z | eu/softfire/tub/exceptions/exceptions.py | softfire-eu/experiment-manager | 3e44c917e956bac0359a0303f9a3d0708481e1c9 | [
"Apache-2.0"
] | null | null | null | eu/softfire/tub/exceptions/exceptions.py | softfire-eu/experiment-manager | 3e44c917e956bac0359a0303f9a3d0708481e1c9 | [
"Apache-2.0"
] | 1 | 2018-07-12T08:19:14.000Z | 2018-07-12T08:19:14.000Z | class _BaseException(Exception):
def __init__(self, message, *args) -> None:
self.message = message
super().__init__(*args)
class ManagerNotFound(_BaseException):
pass
class RpcFailedCall(_BaseException):
pass
class ExperimentValidationError(_BaseException):
pass
class ResourceNotFound(_BaseException):
pass
class ResourceAlreadyBooked(_BaseException):
pass
class ExperimentNotFound(_BaseException):
pass
| 15.931034 | 48 | 0.733766 | 39 | 462 | 8.307692 | 0.435897 | 0.314815 | 0.339506 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186147 | 462 | 28 | 49 | 16.5 | 0.861702 | 0 | 0 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0.375 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
41a96ce1cac04188c0692b34694f59bc91f568fc | 560 | py | Python | tests/jdi_uitests_webtests/main/page_objects/pages/home_page.py | jdi-testing/jdi-python | 7c0607b97d4d44b27ea8f532d47c68b8dd00e6f7 | [
"MIT"
] | 5 | 2020-02-14T10:32:01.000Z | 2021-07-22T08:20:28.000Z | tests/jdi_uitests_webtests/main/page_objects/pages/home_page.py | jdi-testing/jdi-python | 7c0607b97d4d44b27ea8f532d47c68b8dd00e6f7 | [
"MIT"
] | 54 | 2018-07-27T14:07:33.000Z | 2021-11-08T09:24:16.000Z | tests/jdi_uitests_webtests/main/page_objects/pages/home_page.py | jdi-testing/jdi-python | 7c0607b97d4d44b27ea8f532d47c68b8dd00e6f7 | [
"MIT"
] | 1 | 2021-01-20T14:31:52.000Z | 2021-01-20T14:31:52.000Z | from JDI.web.selenium.elements.api_interact.find_element_by import By
from JDI.web.selenium.elements.common.image import Image
from JDI.web.selenium.elements.common.link import Link
from JDI.web.selenium.elements.common.text import Text
from JDI.web.selenium.elements.composite.web_page import WebPage
class HomePage(WebPage):
def __init__(self, url, title):
super(HomePage, self).__init__(url=url, title=title)
about = Link(By.link_text("About"))
logo_image = Image(By.css(".epam-logo img"))
text_item = Text(By.css(".main-txt"))
| 32.941176 | 69 | 0.753571 | 86 | 560 | 4.732558 | 0.395349 | 0.085995 | 0.12285 | 0.22113 | 0.363636 | 0.235872 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121429 | 560 | 16 | 70 | 35 | 0.827236 | 0 | 0 | 0 | 0 | 0 | 0.05 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.454545 | 0 | 0.909091 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
41b20f790b6985bfa1f3757a75cfaedc3ed0233b | 177 | py | Python | yosim/rules/apps.py | thoongnv/yosim | 22bcaceb2c40735363496d9404970a73c4b944bc | [
"MIT"
] | 2 | 2022-02-15T03:41:13.000Z | 2022-02-15T03:44:46.000Z | yosim/rules/apps.py | thoongnv/yosim | 22bcaceb2c40735363496d9404970a73c4b944bc | [
"MIT"
] | 5 | 2021-06-08T22:26:24.000Z | 2022-03-12T00:21:35.000Z | yosim/rules/apps.py | thoongnv/yosim | 22bcaceb2c40735363496d9404970a73c4b944bc | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from django.apps import AppConfig
class RulesConfig(AppConfig):
name = 'yosim.rules'
verbose_name = "Rules"
def ready(self):
pass
| 16.090909 | 33 | 0.627119 | 21 | 177 | 5.238095 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007463 | 0.242938 | 177 | 10 | 34 | 17.7 | 0.813433 | 0.118644 | 0 | 0 | 0 | 0 | 0.103896 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.166667 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
41ba22bd38c8d51f5bf64e1e12f05338b9a305b8 | 247 | py | Python | onegreek/universities/views.py | goldhand/onegreek | 1ad105f15608284a9e80802734f0c6222413a4a0 | [
"BSD-3-Clause"
] | 1 | 2019-06-13T11:46:08.000Z | 2019-06-13T11:46:08.000Z | onegreek/universities/views.py | goldhand/onegreek | 1ad105f15608284a9e80802734f0c6222413a4a0 | [
"BSD-3-Clause"
] | null | null | null | onegreek/universities/views.py | goldhand/onegreek | 1ad105f15608284a9e80802734f0c6222413a4a0 | [
"BSD-3-Clause"
] | null | null | null | from rest_framework import viewsets
from .serializers import UniversitySerializer
from .models import University
class UniversityViewSet(viewsets.ModelViewSet):
queryset = University.objects.all()
serializer_class = UniversitySerializer
| 27.444444 | 47 | 0.82996 | 24 | 247 | 8.458333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121457 | 247 | 8 | 48 | 30.875 | 0.935484 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
41bf0aa7aa8657c18ffec31a5eceb725b9f22e18 | 141 | py | Python | Chapter 07/Chap07_Example7.23.py | bpbpublications/Programming-Techniques-using-Python | 49b785f37e95a3aad1d36cef51e219ac56e5e9f0 | [
"MIT"
] | null | null | null | Chapter 07/Chap07_Example7.23.py | bpbpublications/Programming-Techniques-using-Python | 49b785f37e95a3aad1d36cef51e219ac56e5e9f0 | [
"MIT"
] | null | null | null | Chapter 07/Chap07_Example7.23.py | bpbpublications/Programming-Techniques-using-Python | 49b785f37e95a3aad1d36cef51e219ac56e5e9f0 | [
"MIT"
] | null | null | null | myl1 = [10, 20, -30.1, 'Hello']
list_length = len(myl1)
count = 0
while count<list_length:
print(count, myl1[count])
count +=1
| 20.142857 | 32 | 0.609929 | 22 | 141 | 3.818182 | 0.590909 | 0.238095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110092 | 0.22695 | 141 | 6 | 33 | 23.5 | 0.66055 | 0 | 0 | 0 | 0 | 0 | 0.037037 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
41c8b05fb5813f637c5e573303e9ec8ee0854eb2 | 149 | py | Python | homework_day_3/6.py | wxz896446511/Manyu | 5974ba3a3f27fbaf53bf9f876150ff764a70ac46 | [
"Apache-2.0"
] | 4 | 2018-09-26T00:48:02.000Z | 2020-08-21T02:06:59.000Z | homework_day_3/6.py | wxz896446511/Manyu | 5974ba3a3f27fbaf53bf9f876150ff764a70ac46 | [
"Apache-2.0"
] | null | null | null | homework_day_3/6.py | wxz896446511/Manyu | 5974ba3a3f27fbaf53bf9f876150ff764a70ac46 | [
"Apache-2.0"
] | 1 | 2020-08-21T02:07:04.000Z | 2020-08-21T02:07:04.000Z | s1=0
s2=0
n=1
m=50000
while n<50001:
s1=s1+1/(n*1.0)
n+=1
while m>0:
s2=s2+1/(m*1.0)
m=m-1
print('s1='+str(s1))
print('s2='+str(s2))
| 11.461538 | 20 | 0.516779 | 39 | 149 | 1.974359 | 0.282051 | 0.077922 | 0.077922 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.268908 | 0.201342 | 149 | 12 | 21 | 12.416667 | 0.378151 | 0 | 0 | 0 | 0 | 0 | 0.040268 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68c9e87b18bf9b5cf5cffc96cfae86418021989e | 60 | py | Python | Data/Write/Write pickle.py | fraunhofer-iais/IAIS-Python-Snippets | a3ee610d6270cda2c891688851696c34831ffa2b | [
"MIT"
] | null | null | null | Data/Write/Write pickle.py | fraunhofer-iais/IAIS-Python-Snippets | a3ee610d6270cda2c891688851696c34831ffa2b | [
"MIT"
] | null | null | null | Data/Write/Write pickle.py | fraunhofer-iais/IAIS-Python-Snippets | a3ee610d6270cda2c891688851696c34831ffa2b | [
"MIT"
] | null | null | null | ### Pickle the data
pickle.dump(data, open("data.p", "wb")) | 20 | 39 | 0.633333 | 10 | 60 | 3.8 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116667 | 60 | 3 | 39 | 20 | 0.716981 | 0.25 | 0 | 0 | 0 | 0 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68e8192cc2ff542a1fbc557bde4a3ec054ffbb9e | 1,511 | py | Python | qtpy/tests/test_qtwidgets.py | tlambert-forks/qtpy | 016e8c5e67d30cb6803a2310bdbd7c4cabe33959 | [
"MIT"
] | null | null | null | qtpy/tests/test_qtwidgets.py | tlambert-forks/qtpy | 016e8c5e67d30cb6803a2310bdbd7c4cabe33959 | [
"MIT"
] | null | null | null | qtpy/tests/test_qtwidgets.py | tlambert-forks/qtpy | 016e8c5e67d30cb6803a2310bdbd7c4cabe33959 | [
"MIT"
] | null | null | null | """Test QtWidgets."""
import pytest
from qtpy import PYQT5, PYQT_VERSION, QtWidgets
def test_qtextedit_functions():
"""Test functions mapping for QtWidgets.QTextEdit."""
assert QtWidgets.QTextEdit.setTabStopWidth
assert QtWidgets.QTextEdit.tabStopWidth
assert QtWidgets.QTextEdit.print_
def test_qplaintextedit_functions():
"""Test functions mapping for QtWidgets.QPlainTextEdit."""
assert QtWidgets.QPlainTextEdit.setTabStopWidth
assert QtWidgets.QPlainTextEdit.tabStopWidth
assert QtWidgets.QPlainTextEdit.print_
def test_qapplication_functions():
"""Test functions mapping for QtWidgets.QApplication."""
assert QtWidgets.QApplication.exec_
def test_qdialog_functions():
"""Test functions mapping for QtWidgets.QDialog."""
assert QtWidgets.QDialog.exec_
def test_qmenu_functions():
"""Test functions mapping for QtWidgets.QDialog."""
assert QtWidgets.QMenu.exec_
@pytest.mark.skipif(PYQT5 and PYQT_VERSION.startswith('5.9'),
reason="A specific setup with at least sip 4.9.9 is needed for PyQt5 5.9.*"
"to work with scoped enum access")
def test_enum_access():
"""Test scoped and unscoped enum access for qtpy.QtWidgets.*."""
assert QtWidgets.QFileDialog.AcceptOpen == QtWidgets.QFileDialog.AcceptMode.AcceptOpen
assert QtWidgets.QMessageBox.InvalidRole == QtWidgets.QMessageBox.ButtonRole.InvalidRole
assert QtWidgets.QStyle.State_None == QtWidgets.QStyle.StateFlag.State_None
| 34.340909 | 95 | 0.750496 | 169 | 1,511 | 6.585799 | 0.331361 | 0.161725 | 0.098832 | 0.130279 | 0.22372 | 0.22372 | 0.113208 | 0.113208 | 0.113208 | 0 | 0 | 0.007862 | 0.158173 | 1,511 | 43 | 96 | 35.139535 | 0.867138 | 0.210457 | 0 | 0 | 0 | 0 | 0.08643 | 0 | 0 | 0 | 0 | 0 | 0.521739 | 1 | 0.26087 | true | 0 | 0.086957 | 0 | 0.347826 | 0.086957 | 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 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68f5649c62aa4f43394924b3ae19b877c4eef1be | 188 | py | Python | create_db.py | rdclif/GCloud-WebProject | 5e548cce536ed71ae5f0a1641c95e9ce3b08a912 | [
"CNRI-Python"
] | null | null | null | create_db.py | rdclif/GCloud-WebProject | 5e548cce536ed71ae5f0a1641c95e9ce3b08a912 | [
"CNRI-Python"
] | null | null | null | create_db.py | rdclif/GCloud-WebProject | 5e548cce536ed71ae5f0a1641c95e9ce3b08a912 | [
"CNRI-Python"
] | null | null | null |
from main import db
from main import Visit
from main import sqlalchemy
if __name__ == '__main__':
print('Creating all database tables...')
x = db.create_all()
print('Done!') | 18.8 | 44 | 0.68617 | 26 | 188 | 4.615385 | 0.615385 | 0.2 | 0.35 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202128 | 188 | 10 | 45 | 18.8 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.234043 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0.285714 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
68ff13e3e208e09b794739d2c907043aabd15844 | 130 | py | Python | sudoku/python/sudoku.py | sandos/MastersOfCode | 582e372901857b853eb50435298001e378b45e0f | [
"Unlicense"
] | null | null | null | sudoku/python/sudoku.py | sandos/MastersOfCode | 582e372901857b853eb50435298001e378b45e0f | [
"Unlicense"
] | null | null | null | sudoku/python/sudoku.py | sandos/MastersOfCode | 582e372901857b853eb50435298001e378b45e0f | [
"Unlicense"
] | null | null | null | import csv
with open("../sudoku.csv", "r") as csvfile:
reader = csv.reader(csvfile)
for row in reader:
print row | 18.571429 | 43 | 0.615385 | 19 | 130 | 4.210526 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.253846 | 130 | 7 | 44 | 18.571429 | 0.824742 | 0 | 0 | 0 | 0 | 0 | 0.10687 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec037e8ff41b312d1239dc04d766e9f4b8fe7357 | 391 | py | Python | petstagram/core/views.py | BoyanPeychinov/python_web_basics | 2f892ac119f7fe3a5c03fc5e7b35670dc609a70f | [
"MIT"
] | 1 | 2021-07-20T12:16:34.000Z | 2021-07-20T12:16:34.000Z | petstagram/core/views.py | BoyanPeychinov/python_web_basics | 2f892ac119f7fe3a5c03fc5e7b35670dc609a70f | [
"MIT"
] | null | null | null | petstagram/core/views.py | BoyanPeychinov/python_web_basics | 2f892ac119f7fe3a5c03fc5e7b35670dc609a70f | [
"MIT"
] | null | null | null | from django.views import View
class PostOnlyView(View):
form_class = None
def post(self, request, *args, **kwargs):
form = self.form_class(request.POST)
if form.is_valid():
return self.form_valid(form)
else:
return self.form_invalid(form)
def form_valid(self, form):
pass
def form_invalid(self, form):
pass | 21.722222 | 45 | 0.606138 | 50 | 391 | 4.6 | 0.44 | 0.173913 | 0.121739 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.296675 | 391 | 18 | 46 | 21.722222 | 0.836364 | 0 | 0 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0.153846 | 0.076923 | 0 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ec0ebec4153df6eb77466725e0c8fd3afb8e6d9e | 2,604 | py | Python | telemetry/telemetry/internal/platform/cast_platform_backend.py | BearerPipelineTest/catapult | 3800a67cd916200046a50748893bbd0dcf3d7f4a | [
"BSD-3-Clause"
] | null | null | null | telemetry/telemetry/internal/platform/cast_platform_backend.py | BearerPipelineTest/catapult | 3800a67cd916200046a50748893bbd0dcf3d7f4a | [
"BSD-3-Clause"
] | null | null | null | telemetry/telemetry/internal/platform/cast_platform_backend.py | BearerPipelineTest/catapult | 3800a67cd916200046a50748893bbd0dcf3d7f4a | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
from telemetry.core import platform as telemetry_platform
from telemetry.internal.platform import cast_device
from telemetry.internal.platform import platform_backend
class CastPlatformBackend(platform_backend.PlatformBackend):
def __init__(self, device):
super(CastPlatformBackend, self).__init__(device)
self._output_dir = device.output_dir
self._runtime_exe = device.runtime_exe
@classmethod
def SupportsDevice(cls, device):
return isinstance(device, cast_device.CastDevice)
@classmethod
def CreatePlatformForDevice(cls, device, finder_options):
assert cls.SupportsDevice(device)
return telemetry_platform.Platform(CastPlatformBackend(device))
@property
def output_dir(self):
return self._output_dir
@property
def runtime_exe(self):
return self._runtime_exe
def IsRemoteDevice(self):
return False
def GetArchName(self):
return 'Arch type of device not yet supported in Cast'
def GetOSName(self):
return 'castos'
def GetDeviceTypeName(self):
return 'Cast Device'
def GetOSVersionName(self):
return ''
def GetOSVersionDetailString(self):
return 'CastOS'
def GetSystemTotalPhysicalMemory(self):
raise NotImplementedError()
def HasBeenThermallyThrottled(self):
return False
def IsThermallyThrottled(self):
return False
def InstallApplication(self, application):
raise NotImplementedError()
def LaunchApplication(self, application, parameters=None,
elevate_privilege=False):
raise NotImplementedError()
def PathExists(self, path, timeout=None, retries=None):
raise NotImplementedError()
def CanFlushIndividualFilesFromSystemCache(self):
return False
def FlushEntireSystemCache(self):
return None
def FlushSystemCacheForDirectory(self, directory):
return None
def StartActivity(self, intent, blocking):
raise NotImplementedError()
def CooperativelyShutdown(self, proc, app_name):
return False
def SupportFlushEntireSystemCache(self):
return False
def StartDisplayTracing(self):
raise NotImplementedError()
def StopDisplayTracing(self):
raise NotImplementedError()
def TakeScreenshot(self, file_path):
return None
def GetTypExpectationsTags(self):
tags = super(CastPlatformBackend, self).GetTypExpectationsTags()
tags.append(self.GetDeviceTypeName())
return tags
| 25.281553 | 72 | 0.75768 | 274 | 2,604 | 7.072993 | 0.390511 | 0.067079 | 0.097523 | 0.04644 | 0.03612 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001854 | 0.171275 | 2,604 | 102 | 73 | 25.529412 | 0.8962 | 0.059524 | 0 | 0.289855 | 0 | 0 | 0.027812 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 1 | 0.391304 | false | 0 | 0.057971 | 0.246377 | 0.73913 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ec2aed547019ea718fa0b562ff4098ff83dbf1cb | 3,242 | py | Python | tests/test_ideal_gas_flow.py | aanish94/apsCFD | 51ac84926d691ec80a46e877302ccbe47281f8f4 | [
"MIT"
] | 4 | 2021-01-22T14:17:17.000Z | 2021-01-23T16:29:41.000Z | tests/test_ideal_gas_flow.py | aanish94/apsCFD | 51ac84926d691ec80a46e877302ccbe47281f8f4 | [
"MIT"
] | 4 | 2018-02-01T05:40:09.000Z | 2018-02-02T07:35:11.000Z | tests/test_ideal_gas_flow.py | aanish94/apsCFD | 51ac84926d691ec80a46e877302ccbe47281f8f4 | [
"MIT"
] | 1 | 2021-01-22T02:14:49.000Z | 2021-01-22T02:14:49.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test ideal gas flow calculations
"""
import unittest
from utils.utils import deg_to_rad
from ideal_gas_flow import (isentropic, normal_shock, rayleigh,
prandtl_meyer, oblique_shock)
class TestIdealGasFlow(unittest.TestCase):
"""
"""
def test_isentropic(self):
"""Test Isentropic Flow Relations
"""
M = 2.0
gamma = 1.4
self.assertAlmostEqual(isentropic.A_Astar(M, gamma), 1.687, places=2)
self.assertAlmostEqual(isentropic.T0_T(M, gamma), 1.80, places=2)
self.assertAlmostEqual(isentropic.p0_p(M, gamma), 7.824, places=2)
self.assertAlmostEqual(isentropic.r0_r(M, gamma), 4.347, places=2)
# Inverse calculation
self.assertAlmostEqual(isentropic.mach_from_area_ratio(1.687, gamma)[1], 2.0, places=2)
def test_normal_shock(self):
"""Test Normal Shock Relations
"""
M = 2.0
gamma = 1.4
self.assertAlmostEqual(normal_shock.mach(M, gamma), 0.5774, places=2)
self.assertAlmostEqual(normal_shock.T2_T1(M, gamma), 1.687, places=2)
self.assertAlmostEqual(normal_shock.p2_p1(M, gamma), 4.50, places=2)
self.assertAlmostEqual(normal_shock.rho2_rho1(M, gamma), 2.667, places=2)
def test_rayleigh(self):
"""Test Rayleigh Flow Relations
"""
M = 2.0
gamma = 1.4
self.assertAlmostEqual(rayleigh.T0_T0star(M, gamma), 0.7934, places=2)
self.assertAlmostEqual(rayleigh.T_Tstar(M, gamma), 0.5289, places=2)
self.assertAlmostEqual(rayleigh.p_pstar(M, gamma), 0.3636, places=2)
self.assertAlmostEqual(rayleigh.rho_rhostar(M, gamma), 0.6875, places=2)
# Inverse calculations
self.assertAlmostEqual(rayleigh.mach(0.7934, gamma), 2, places=2)
def test_prandtl_meyer(self):
"""Test Prandtl Meyer Relations
"""
M = 2.0
gamma = 1.4
self.assertAlmostEqual(prandtl_meyer.nu(M, gamma), 0.4604, places=2)
# Inverse calculations
self.assertAlmostEqual(prandtl_meyer.mach_from_nu(1.1481, gamma), 4, places=2)
self.assertAlmostEqual(prandtl_meyer.mach_from_nu(0.4604, gamma), M, places=2)
def test_oblique_shock(self):
"""Test Oblique Shock Relations
"""
M = 2.0
gamma = 1.4
# From charts, for M = 2
beta = deg_to_rad(44.0)
theta = deg_to_rad(14.0)
# Test beta <-> theta map
self.assertAlmostEqual(oblique_shock.beta(M, theta, gamma), beta, places=2)
self.assertAlmostEqual(oblique_shock.theta(M, beta, gamma), theta, places=2)
# Test conditions behind the shock
self.assertAlmostEqual(oblique_shock.mach(M, beta, theta, gamma), 1.482, places=1)
self.assertAlmostEqual(oblique_shock.T2_T1(M, beta, gamma), 1.249, places=2)
self.assertAlmostEqual(oblique_shock.p2_p1(M, beta, gamma), 2.088, places=2)
self.assertAlmostEqual(oblique_shock.rho2_rho1(M, beta, gamma), 1.673, places=2)
self.assertAlmostEqual(oblique_shock.u2_u1(M, beta, gamma), 0.8304, places=2)
if __name__ == "__main__":
unittest.main()
| 33.081633 | 95 | 0.639729 | 432 | 3,242 | 4.655093 | 0.229167 | 0.250622 | 0.076579 | 0.194928 | 0.435107 | 0.338637 | 0.178518 | 0.135753 | 0.083541 | 0.043759 | 0 | 0.069467 | 0.236274 | 3,242 | 97 | 96 | 33.42268 | 0.74273 | 0.125848 | 0 | 0.208333 | 0 | 0 | 0.002874 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0.104167 | false | 0 | 0.0625 | 0 | 0.1875 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec3ac3aaff08cf33fd3407062e48c690f394ad7a | 149 | py | Python | reagent/test/environment/__init__.py | cts198859/ReAgent | 20f3d333821bad364fd567cce97de51c44123484 | [
"BSD-3-Clause"
] | 1 | 2020-06-30T16:57:47.000Z | 2020-06-30T16:57:47.000Z | reagent/test/environment/__init__.py | OregonWebSells/ReAgent | 866f91785ca86db32fb67744aa063fe77791ff21 | [
"BSD-3-Clause"
] | null | null | null | reagent/test/environment/__init__.py | OregonWebSells/ReAgent | 866f91785ca86db32fb67744aa063fe77791ff21 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
logger = logging.getLogger(__name__)
| 21.285714 | 71 | 0.758389 | 20 | 149 | 5.45 | 0.95 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007752 | 0.134228 | 149 | 6 | 72 | 24.833333 | 0.837209 | 0.610738 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ec3e15a3f0d2a5295e65513f4e182448baf2f725 | 180 | py | Python | tracardi/process_engine/destination/rabbitmq_connector.py | bytepl/tracardi | e8fa4684fa6bd3d05165fe48aa925fc6c1e74923 | [
"MIT"
] | null | null | null | tracardi/process_engine/destination/rabbitmq_connector.py | bytepl/tracardi | e8fa4684fa6bd3d05165fe48aa925fc6c1e74923 | [
"MIT"
] | null | null | null | tracardi/process_engine/destination/rabbitmq_connector.py | bytepl/tracardi | e8fa4684fa6bd3d05165fe48aa925fc6c1e74923 | [
"MIT"
] | null | null | null | from tracardi.process_engine.destination.connector import Connector
class RabbitMqConnector(Connector):
async def run(self, mapping, delta):
print(mapping, delta)
| 18 | 67 | 0.755556 | 20 | 180 | 6.75 | 0.8 | 0.177778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 180 | 9 | 68 | 20 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec442408ef5cfbb32ec2566e55d4fa5067d76b3e | 1,042 | py | Python | tests/test_helper.py | ajrox090/VaRA-Tool-Suite | 1550d36a4049e0615afb0bacfb96b1d506a29c98 | [
"BSD-2-Clause"
] | 8 | 2019-10-30T08:07:44.000Z | 2020-11-13T08:02:36.000Z | tests/test_helper.py | ajrox090/VaRA-Tool-Suite | 1550d36a4049e0615afb0bacfb96b1d506a29c98 | [
"BSD-2-Clause"
] | 342 | 2019-02-14T15:53:31.000Z | 2020-11-03T18:11:27.000Z | tests/test_helper.py | ajrox090/VaRA-Tool-Suite | 1550d36a4049e0615afb0bacfb96b1d506a29c98 | [
"BSD-2-Clause"
] | 5 | 2021-04-28T17:05:16.000Z | 2022-03-31T23:11:22.000Z | """Small helper classes for testing."""
import typing as tp
import plumbum as pb
from benchbuild.source import Variant, FetchableSource
class BBTestSource(FetchableSource):
"""Source test fixture class."""
test_versions: tp.List[str]
def __init__(
self, test_versions: tp.List[str], local: str,
remote: tp.Union[str, tp.Dict[str, str]]
):
super().__init__(local, remote)
self.test_versions = test_versions
@property
def local(self) -> str:
return "test_source"
@property
def remote(self) -> tp.Union[str, tp.Dict[str, str]]:
return "test_remote"
@property
def default(self) -> Variant:
return Variant(owner=self, version=self.test_versions[0])
# pylint: disable=unused-argument,no-self-use
def version(self, target_dir: str, version: str) -> pb.LocalPath:
return pb.local.path('.') / f'varats-test-{version}'
def versions(self) -> tp.Iterable[Variant]:
return [Variant(self, v) for v in self.test_versions]
| 26.717949 | 69 | 0.652591 | 135 | 1,042 | 4.911111 | 0.385185 | 0.108597 | 0.096531 | 0.054299 | 0.129713 | 0.066365 | 0.066365 | 0 | 0 | 0 | 0 | 0.001229 | 0.21881 | 1,042 | 38 | 70 | 27.421053 | 0.813268 | 0.100768 | 0 | 0.125 | 0 | 0 | 0.047516 | 0.022678 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.208333 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ec4ed3cf60eb8edf8d45b20754549aa35c4fac16 | 237 | py | Python | core/templatetags/core_tags.py | samshultz/techbitsdata | 753309cbfee7bfa9a08804786f29b37f2b058436 | [
"BSD-3-Clause"
] | null | null | null | core/templatetags/core_tags.py | samshultz/techbitsdata | 753309cbfee7bfa9a08804786f29b37f2b058436 | [
"BSD-3-Clause"
] | null | null | null | core/templatetags/core_tags.py | samshultz/techbitsdata | 753309cbfee7bfa9a08804786f29b37f2b058436 | [
"BSD-3-Clause"
] | null | null | null | from django import template
from ..models import HomePage
register = template.Library()
@register.simple_tag
def get_homepages(count=None):
if count:
return HomePage.objects.all()[:count]
return HomePage.objects.all()
| 19.75 | 45 | 0.734177 | 30 | 237 | 5.733333 | 0.633333 | 0.127907 | 0.22093 | 0.302326 | 0.337209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164557 | 237 | 11 | 46 | 21.545455 | 0.868687 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6b6681e427d456facc061c75cde2612fd3d99a96 | 115 | py | Python | app/__init__.py | MarciaAndrea/devweb_formulario | 8b038f81cdd58d2ec58c91d04ca892a4fa99f549 | [
"MIT"
] | null | null | null | app/__init__.py | MarciaAndrea/devweb_formulario | 8b038f81cdd58d2ec58c91d04ca892a4fa99f549 | [
"MIT"
] | null | null | null | app/__init__.py | MarciaAndrea/devweb_formulario | 8b038f81cdd58d2ec58c91d04ca892a4fa99f549 | [
"MIT"
] | null | null | null | from flask import Flask
app = Flask(__name__)
app.config['DEBUG'] = True
from app import models, views
| 12.777778 | 30 | 0.678261 | 16 | 115 | 4.625 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.234783 | 115 | 8 | 31 | 14.375 | 0.840909 | 0 | 0 | 0 | 0 | 0 | 0.04717 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6b7420711037e6b6953b203dd71e4d0da3755188 | 312 | py | Python | pommerman/agents/frozen_agent.py | PBarde/ASAF-playground | 6567e5c56b6e077e0686376240bd3ccaa8a0da0c | [
"Apache-2.0"
] | 1 | 2020-12-22T06:45:18.000Z | 2020-12-22T06:45:18.000Z | pommerman/agents/frozen_agent.py | PBarde/ASAF-playground | 6567e5c56b6e077e0686376240bd3ccaa8a0da0c | [
"Apache-2.0"
] | null | null | null | pommerman/agents/frozen_agent.py | PBarde/ASAF-playground | 6567e5c56b6e077e0686376240bd3ccaa8a0da0c | [
"Apache-2.0"
] | null | null | null | from . import BaseAgent
from .. import constants
class FrozenAgent(BaseAgent):
"""This is a agent that just sits there."""
def __init__(self, *args, **kwargs):
super(FrozenAgent, self).__init__(*args, **kwargs)
def act(self, obs, action_space):
return constants.Action.Stop.value
| 24 | 58 | 0.673077 | 39 | 312 | 5.153846 | 0.692308 | 0.099502 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201923 | 312 | 12 | 59 | 26 | 0.807229 | 0.11859 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.285714 | 0.142857 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6b84a8e0c10dad08caa3e4f6f99c18a7c9f285ee | 2,896 | py | Python | os_brick/initiator/connectors/local.py | ebalduf/os-brick-backports | 6a180265560d5e0bab80e47ac25c15906d1165fb | [
"Apache-2.0"
] | null | null | null | os_brick/initiator/connectors/local.py | ebalduf/os-brick-backports | 6a180265560d5e0bab80e47ac25c15906d1165fb | [
"Apache-2.0"
] | null | null | null | os_brick/initiator/connectors/local.py | ebalduf/os-brick-backports | 6a180265560d5e0bab80e47ac25c15906d1165fb | [
"Apache-2.0"
] | null | null | null | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os_brick.i18n import _
from os_brick.initiator.connectors import base
from os_brick import utils
class LocalConnector(base.BaseLinuxConnector):
""""Connector class to attach/detach File System backed volumes."""
def __init__(self, root_helper, driver=None,
*args, **kwargs):
super(LocalConnector, self).__init__(root_helper, driver=driver,
*args, **kwargs)
@staticmethod
def get_connector_properties(root_helper, *args, **kwargs):
"""The Local connector properties."""
return {}
def get_volume_paths(self, connection_properties):
path = connection_properties['device_path']
return [path]
def get_search_path(self):
return None
def get_all_available_volumes(self, connection_properties=None):
# TODO(walter-boring): not sure what to return here.
return []
@utils.trace
def connect_volume(self, connection_properties):
"""Connect to a volume.
:param connection_properties: The dictionary that describes all
of the target volume attributes.
connection_properties must include:
device_path - path to the volume to be connected
:type connection_properties: dict
:returns: dict
"""
if 'device_path' not in connection_properties:
msg = (_("Invalid connection_properties specified "
"no device_path attribute"))
raise ValueError(msg)
device_info = {'type': 'local',
'path': connection_properties['device_path']}
return device_info
@utils.trace
def disconnect_volume(self, connection_properties, device_info):
"""Disconnect a volume from the local host.
:param connection_properties: The dictionary that describes all
of the target volume attributes.
:type connection_properties: dict
:param device_info: historical difference, but same as connection_props
:type device_info: dict
"""
pass
def extend_volume(self, connection_properties):
# TODO(walter-boring): is this possible?
raise NotImplementedError
| 36.658228 | 79 | 0.649862 | 330 | 2,896 | 5.542424 | 0.433333 | 0.153089 | 0.06561 | 0.049207 | 0.132313 | 0.132313 | 0.088573 | 0.088573 | 0.088573 | 0.088573 | 0 | 0.002869 | 0.27797 | 2,896 | 78 | 80 | 37.128205 | 0.871832 | 0.466506 | 0 | 0.0625 | 0 | 0 | 0.078348 | 0.014957 | 0 | 0 | 0 | 0.025641 | 0 | 1 | 0.25 | false | 0.03125 | 0.09375 | 0.0625 | 0.53125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6b886eb9cef2b6008b055841d4decd5bf7c3d6ad | 135 | py | Python | okta/models/user/TempPassword.py | xmercury-qb/okta-sdk-python | a668a963b13fc61177b36c5438c6ec5fa6f17c4e | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2020-06-19T18:54:00.000Z | 2020-06-19T18:54:00.000Z | okta/models/user/TempPassword.py | xmercury-qb/okta-sdk-python | a668a963b13fc61177b36c5438c6ec5fa6f17c4e | [
"ECL-2.0",
"Apache-2.0"
] | 3 | 2018-01-05T20:23:12.000Z | 2019-03-06T12:00:58.000Z | okta/models/user/TempPassword.py | xmercury-qb/okta-sdk-python | a668a963b13fc61177b36c5438c6ec5fa6f17c4e | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2018-11-08T19:32:46.000Z | 2021-03-30T06:35:48.000Z | class TempPassword:
types = {
'tempPassword': str
}
def __init__(self):
self.tempPassword = None # str
| 13.5 | 39 | 0.555556 | 12 | 135 | 5.916667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.348148 | 135 | 9 | 40 | 15 | 0.806818 | 0.022222 | 0 | 0 | 0 | 0 | 0.092308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6b93b639b40dce2081a3f1509a8777312189b2f5 | 73 | py | Python | airbyte-integrations/connectors/source-twilio-singer/source_twilio_singer/__init__.py | rajatariya21/airbyte | 11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d | [
"MIT"
] | 2 | 2021-03-02T09:17:41.000Z | 2021-03-02T11:02:23.000Z | airbyte-integrations/connectors/source-twilio-singer/source_twilio_singer/__init__.py | rajatariya21/airbyte | 11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d | [
"MIT"
] | 4 | 2021-09-01T00:33:50.000Z | 2022-02-27T16:13:46.000Z | airbyte-integrations/connectors/source-twilio-singer/source_twilio_singer/__init__.py | rajatariya21/airbyte | 11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d | [
"MIT"
] | 1 | 2021-07-02T15:08:53.000Z | 2021-07-02T15:08:53.000Z | from .source import SourceTwilioSinger
__all__ = ["SourceTwilioSinger"]
| 18.25 | 38 | 0.808219 | 6 | 73 | 9.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.109589 | 73 | 3 | 39 | 24.333333 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0.246575 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6bab2761f4e78590b87af2ab8a2f23f2ce26ee32 | 69 | py | Python | tests/test_resources/test_jobs_package/test_jobs_package/throw_an_exception_job.py | ni/hoplite | bc1b01aa08ba21daa36f46b06000b62890096787 | [
"MIT"
] | 16 | 2016-02-25T16:41:28.000Z | 2020-11-07T13:27:40.000Z | tests/test_resources/test_jobs_package/test_jobs_package/throw_an_exception_job.py | ni/hoplite | bc1b01aa08ba21daa36f46b06000b62890096787 | [
"MIT"
] | null | null | null | tests/test_resources/test_jobs_package/test_jobs_package/throw_an_exception_job.py | ni/hoplite | bc1b01aa08ba21daa36f46b06000b62890096787 | [
"MIT"
] | 8 | 2016-02-11T16:44:52.000Z | 2020-01-23T19:45:37.000Z | def run(config, status):
raise TypeError("THE SKY IS FALLING!!")
| 23 | 43 | 0.681159 | 10 | 69 | 4.7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 69 | 2 | 44 | 34.5 | 0.824561 | 0 | 0 | 0 | 0 | 0 | 0.289855 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6bc75bfe6f3b314f3347fa4156e55b1ddf54d5f2 | 785 | py | Python | migrate_dns/destructo.py | jlin/inventory | c098c98e570c3bf9fadfd811eb75e1213f6ea428 | [
"BSD-3-Clause"
] | 22 | 2015-01-16T01:36:32.000Z | 2020-06-08T00:46:18.000Z | migrate_dns/destructo.py | jlin/inventory | c098c98e570c3bf9fadfd811eb75e1213f6ea428 | [
"BSD-3-Clause"
] | 9 | 2019-03-15T11:39:32.000Z | 2019-04-30T00:59:50.000Z | migrate_dns/destructo.py | jlin/inventory | c098c98e570c3bf9fadfd811eb75e1213f6ea428 | [
"BSD-3-Clause"
] | 13 | 2015-01-13T20:56:22.000Z | 2022-02-23T06:01:17.000Z | from mozdns.address_record.models import AddressRecord
from mozdns.cname.models import CNAME
from mozdns.domain.models import Domain
from mozdns.mx.models import MX
from mozdns.nameserver.models import Nameserver
from mozdns.ptr.models import PTR
from mozdns.soa.models import SOA
from mozdns.srv.models import SRV
from mozdns.txt.models import TXT
from reversion.models import Version, Revision
def destroy():
Version.objects.all().delete()
Revision.objects.all().delete()
TXT.objects.all().delete()
SRV.objects.all().delete()
CNAME.objects.all().delete()
Nameserver.objects.all().delete()
PTR.objects.all().delete()
MX.objects.all().delete()
AddressRecord.objects.all().delete()
SOA.objects.all().delete()
Domain.objects.all().delete()
| 30.192308 | 54 | 0.743949 | 107 | 785 | 5.448598 | 0.214953 | 0.188679 | 0.301887 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128662 | 785 | 25 | 55 | 31.4 | 0.852339 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.045455 | true | 0 | 0.454545 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6bc7b78982d279f5295d2beb48fb63642b3d9439 | 255 | py | Python | mundo-1/condicoes/aumentos_multiplos.py | Murilloalves/estudos-python | 804a8f646efd86840a3183b65f775168ebb6cf37 | [
"MIT"
] | null | null | null | mundo-1/condicoes/aumentos_multiplos.py | Murilloalves/estudos-python | 804a8f646efd86840a3183b65f775168ebb6cf37 | [
"MIT"
] | null | null | null | mundo-1/condicoes/aumentos_multiplos.py | Murilloalves/estudos-python | 804a8f646efd86840a3183b65f775168ebb6cf37 | [
"MIT"
] | null | null | null | salario = float(input('Qual é salário do funcionário? R$'))
if salario <= 1250:
aumento = salario + (salario*15/100)
else:
aumento = salario + (salario * 10 / 100)
print('Quem ganhava R${} passa a ganhar R${:.2f} agora.'.format(salario, aumento))
| 36.428571 | 82 | 0.662745 | 36 | 255 | 4.694444 | 0.694444 | 0.16568 | 0.248521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07109 | 0.172549 | 255 | 6 | 83 | 42.5 | 0.729858 | 0 | 0 | 0 | 0 | 0 | 0.317647 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6bd258b97e010833aa36fdeb89edf6a7e0ee7073 | 2,556 | py | Python | Assignment_2_Pi/Pi_Archimedes/Pi_Archimedes.py | osccal/python-course | e815fd647fc5e5248188ed3976b62a181831e9ba | [
"MIT"
] | null | null | null | Assignment_2_Pi/Pi_Archimedes/Pi_Archimedes.py | osccal/python-course | e815fd647fc5e5248188ed3976b62a181831e9ba | [
"MIT"
] | null | null | null | Assignment_2_Pi/Pi_Archimedes/Pi_Archimedes.py | osccal/python-course | e815fd647fc5e5248188ed3976b62a181831e9ba | [
"MIT"
] | null | null | null | """
Python3 program to calculate pi to 100 places using Archimedes method
"""
from decimal import Decimal, getcontext
from time import time
def pi_archimedes(n):
"""
Calculate n iterations of Archimedes PI
"""
polygon_edge_length_squared = Decimal(2) # Decimal for precision
polygon_sides = 2
for i in range(n):
polygon_edge_length_squared = 2 - 2 * (1 - polygon_edge_length_squared / 4).sqrt()
polygon_sides *= 2
return polygon_sides * polygon_edge_length_squared.sqrt()
def main():
"""
Try the series
"""
# Pi to 1000 places for reference
Pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989
places = 100
old_result = None
start = time() # Timestamp for timing
for n in range(10*places):
# Do calculations with double precision
getcontext().prec = 2*places # Sets precision to 2*places. This is to reduce loss due to rounding
result = pi_archimedes(n)
# Print the result with single precision
getcontext().prec = places
result = +result # Do the rounding on result from 2*places to 1*places (ie the number we want)
error = result - Decimal(Pi) # Simple error calculation
#print("Result: ", result)
#print("Error: ", Decimal(error))
if result == old_result: # If the numbers we get are the same, break. This is as close as we'll get
break
old_result = result
print("Result: ", result)
print("Error: ", Decimal(error))
print("Time: ", time()-start)
if __name__ == "__main__":
main()
| 54.382979 | 1,011 | 0.777778 | 208 | 2,556 | 9.423077 | 0.389423 | 0.022449 | 0.034694 | 0.04898 | 0.039796 | 0.039796 | 0.039796 | 0 | 0 | 0 | 0 | 0.480544 | 0.165493 | 2,556 | 46 | 1,012 | 55.565217 | 0.43835 | 0.225352 | 0 | 0 | 0 | 0 | 0.01501 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.071429 | 0 | 0.178571 | 0.107143 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6be28791480695f18cfb74b2706fdb1c647fff80 | 523 | py | Python | May 2019/brick_sort.py | Gern-Yataro/Daily-CS | 194e8c2b23964300f39a8ed4f06d355360197766 | [
"MIT"
] | 1 | 2019-04-15T01:09:04.000Z | 2019-04-15T01:09:04.000Z | May 2019/brick_sort.py | Gern-Yataro/Daily-CS | 194e8c2b23964300f39a8ed4f06d355360197766 | [
"MIT"
] | null | null | null | May 2019/brick_sort.py | Gern-Yataro/Daily-CS | 194e8c2b23964300f39a8ed4f06d355360197766 | [
"MIT"
] | null | null | null | numbers = [9, 8, 7, 6, 5, 4, 3, 2, 1]
def brick_sort(array):
n = len(array)-1
swapped = True
while swapped == True:
swapped = False
for index in range(0, n, 2):
if array[index] > array[index+1]:
array[index], array[index+1] = array[index+1], array[index]
swapped = True
for index in range(1, n, 2):
if array[index] > array[index+1]:
array[index], array[index+1] = array[index+1], array[index]
swapped = True
return array
print(brick_sort(numbers))
| 23.772727 | 67 | 0.581262 | 81 | 523 | 3.728395 | 0.345679 | 0.397351 | 0.218543 | 0.317881 | 0.516556 | 0.516556 | 0.516556 | 0.516556 | 0.516556 | 0.516556 | 0 | 0.052219 | 0.267686 | 523 | 21 | 68 | 24.904762 | 0.736292 | 0 | 0 | 0.4375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0 | 0 | 0.125 | 0.0625 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d405da66dfc30f0e0e30d4963515d7ec89e1c3ae | 3,620 | py | Python | harakiri/model.py | ManjiKR/Harakiri | dba9fd7c63e54cf319549a15795e7a4782df8fd0 | [
"Apache-2.0"
] | null | null | null | harakiri/model.py | ManjiKR/Harakiri | dba9fd7c63e54cf319549a15795e7a4782df8fd0 | [
"Apache-2.0"
] | null | null | null | harakiri/model.py | ManjiKR/Harakiri | dba9fd7c63e54cf319549a15795e7a4782df8fd0 | [
"Apache-2.0"
] | null | null | null | from typing import Any, Iterator, List
class SkillInfo:
def __init__(self, **data: Any) -> None:
self.__command = data["Command"]
self.__hit_level = data["Hit level"]
self.__damage = data["Damage"]
self.__startup_frame = data["Start up frame"]
self.__block_frame = data["Block frame"]
self.__hit_frame = data["Hit frame"]
self.__counter_hit_frame = data["Counter hit frame"]
self.__notes = data["Notes"]
@property
def command(self) -> str:
return self.__command
@property
def hit_level(self) -> str:
return self.__hit_level
@property
def damage(self) -> str:
return self.__damage
@property
def start_up_frame(self) -> str:
return self.__startup_frame
@property
def block_frame(self) -> str:
return self.__block_frame
@property
def hit_frame(self) -> str:
return self.__hit_frame
@property
def counter_hit_frame(self) -> str:
return self.__counter_hit_frame
@property
def notes(self) -> str:
return self.__notes
class SkillData:
def __init__(self, **data: Any) -> None:
self.__status = data["status"]
self.__info = data["info"]
@property
def status(self) -> int:
return self.__status
@property
def info(self) -> SkillInfo:
return SkillInfo(**self.__info)
class AllSkillsData:
def __init__(self, **data: Any) -> None:
self.__status = data["status"]
self.__skill_list = data["skill_list"]
@property
def status(self) -> int:
return self.__status
@property
def skill_list(self) -> Iterator[SkillInfo]:
for skill in self.__skill_list:
yield SkillInfo(**skill)
class GalleryPost:
def __init__(self, **data: Any) -> None:
self.__status = data["status"]
self.__title = data["content"]["title"]
self.__auhor = data["content"]["auhor"]
self.__content = data["content"]["content"]
@property
def status(self) -> int:
return self.__status
@property
def title(self) -> str:
return self.__title
@property
def author(self) -> str:
return self.__auhor
@property
def content(self) -> List[str]:
return self.__content
class ListsPostInfo:
def __init__(self, **data: Any) -> None:
self.__id = data["id"]
self.__title = data["title"]
self.__writer = data["writer"]
self.__date = data["date"]
self.__recommend = data["recommend"]
self.__reply = data["reply"]
self.__views = data["views"]
@property
def id(self) -> int:
return self.__id
@property
def title(self) -> str:
return self.__title
@property
def writer(self) -> str:
return self.__writer
@property
def date(self) -> str:
return self.__date
@property
def recommend(self) -> int:
return self.__recommend
@property
def reply(self) -> int:
return self.__reply
@property
def views(self) -> int:
return self.__views
class GalleryList:
def __init__(self, **data: Any) -> None:
self.__status = data["status"]
self.__total = data["total"]
self.__lists = data["lists"]
@property
def status(self) -> int:
return self.__status
@property
def total(self) -> int:
return self.__total
@property
def lists(self) -> Iterator[ListsPostInfo]:
for post in self.__lists:
yield ListsPostInfo(post)
| 22.911392 | 60 | 0.594199 | 413 | 3,620 | 4.842615 | 0.125908 | 0.143 | 0.091 | 0.1105 | 0.322 | 0.2885 | 0.2635 | 0.2375 | 0.2375 | 0.2375 | 0 | 0 | 0.287017 | 3,620 | 157 | 61 | 23.057325 | 0.774893 | 0 | 0 | 0.403361 | 0 | 0 | 0.055249 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.268908 | false | 0 | 0.008403 | 0.201681 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d405f66eb96aad36fd4897d6d6488e602b579c70 | 162 | py | Python | eviction_tracker/detainer_warrants/caselink/constants/ids.py | gregziegan/eviction-tracker | 4db4bacb9675f985cf2f4a747855491e9036ad28 | [
"BSD-3-Clause"
] | 5 | 2021-09-15T08:06:59.000Z | 2022-01-26T21:25:50.000Z | eviction_tracker/detainer_warrants/caselink/constants/ids.py | gregziegan/eviction-tracker | 4db4bacb9675f985cf2f4a747855491e9036ad28 | [
"BSD-3-Clause"
] | 18 | 2022-01-14T17:15:53.000Z | 2022-02-14T07:33:53.000Z | eviction_tracker/detainer_warrants/caselink/constants/ids.py | thebritican/eviction-tracker | 1e34d509b0410d61de6abd6be521c53951fa038a | [
"BSD-3-Clause"
] | 1 | 2021-09-15T01:46:57.000Z | 2021-09-15T01:46:57.000Z | # Frames
UPDATE_FRAME = 'update'
POSTBACK_FRAME = 'postback'
# Login
USERNAME_LOGIN_FIELD = 'OPERCODE'
PASSWORD_LOGIN_FIELD = 'PASSWD'
LOGIN_BUTTON = 'LogInSub'
| 18 | 33 | 0.771605 | 19 | 162 | 6.210526 | 0.631579 | 0.169492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123457 | 162 | 8 | 34 | 20.25 | 0.830986 | 0.074074 | 0 | 0 | 0 | 0 | 0.244898 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d40e772ae52c17b142e2d7efa20aa49ff2ef1d17 | 186 | py | Python | appyratus/schema/exc.py | gigaquads/appyratus | 09d88c000e0f3d254f5e1875388ccf87cec4be7c | [
"MIT"
] | 1 | 2021-02-26T15:31:01.000Z | 2021-02-26T15:31:01.000Z | appyratus/schema/exc.py | gigaquads/appyratus | 09d88c000e0f3d254f5e1875388ccf87cec4be7c | [
"MIT"
] | null | null | null | appyratus/schema/exc.py | gigaquads/appyratus | 09d88c000e0f3d254f5e1875388ccf87cec4be7c | [
"MIT"
] | null | null | null | class ValidationError(Exception):
def __init__(self, schema: 'Schema', errors: dict):
super().__init__(str(errors))
self.schema = schema
self.errors = errors
| 31 | 55 | 0.645161 | 20 | 186 | 5.6 | 0.55 | 0.178571 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.231183 | 186 | 5 | 56 | 37.2 | 0.783217 | 0 | 0 | 0 | 0 | 0 | 0.032258 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d416c187ae283cbe42a03ab6bc7df55912901374 | 148 | py | Python | python/client/parser/__init__.py | loumir/modelinstanceinvot-code | 246bd04b9eab558813ef09ad69a2a2f3ed7d2d92 | [
"Unlicense"
] | null | null | null | python/client/parser/__init__.py | loumir/modelinstanceinvot-code | 246bd04b9eab558813ef09ad69a2a2f3ed7d2d92 | [
"Unlicense"
] | 2 | 2022-03-09T18:39:21.000Z | 2022-03-11T16:27:45.000Z | python/client/parser/__init__.py | loumir/modelinstanceinvot-code | 246bd04b9eab558813ef09ad69a2a2f3ed7d2d92 | [
"Unlicense"
] | 1 | 2021-07-09T12:30:57.000Z | 2021-07-09T12:30:57.000Z | import sys, os
from utils.logger_setup import LoggerSetup
logger = LoggerSetup.get_logger()
logger.info("client.inst_builder package intialized")
| 21.142857 | 53 | 0.817568 | 20 | 148 | 5.9 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101351 | 148 | 6 | 54 | 24.666667 | 0.887218 | 0 | 0 | 0 | 0 | 0 | 0.256757 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d431ad0f4ad590fbccad4eb29cd76488bac8859f | 179 | py | Python | setup.py | Horta/pystart | 684dad092e8b64929e2e559fe95bb39c46f065dc | [
"MIT"
] | 1 | 2019-05-07T06:52:59.000Z | 2019-05-07T06:52:59.000Z | setup.py | Horta/pystart | 684dad092e8b64929e2e559fe95bb39c46f065dc | [
"MIT"
] | 1 | 2018-05-30T09:49:58.000Z | 2018-05-30T14:56:12.000Z | setup.py | horta/pystart | 684dad092e8b64929e2e559fe95bb39c46f065dc | [
"MIT"
] | null | null | null | from setuptools import setup
if __name__ == '__main__':
console_scripts = ["pystart = pystart.cmd:entry_point"]
setup(entry_points=dict(console_scripts=console_scripts))
| 29.833333 | 61 | 0.765363 | 22 | 179 | 5.636364 | 0.681818 | 0.33871 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128492 | 179 | 5 | 62 | 35.8 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0.22905 | 0.128492 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d46677069c648d405454e7408df8cbf599f1a80c | 436 | py | Python | staticfiles/context_processors.py | nttks/django-staticfiles | cd4e024e44c0be909333fcac5c328b2e4d2747bd | [
"BSD-3-Clause"
] | 1 | 2021-02-08T07:49:35.000Z | 2021-02-08T07:49:35.000Z | staticfiles/context_processors.py | nttks/django-staticfiles | cd4e024e44c0be909333fcac5c328b2e4d2747bd | [
"BSD-3-Clause"
] | 2 | 2021-06-01T22:03:20.000Z | 2022-01-13T00:43:38.000Z | staticfiles/context_processors.py | nttks/django-staticfiles | cd4e024e44c0be909333fcac5c328b2e4d2747bd | [
"BSD-3-Clause"
] | 1 | 2020-11-04T08:39:52.000Z | 2020-11-04T08:39:52.000Z | import warnings
from django.conf import settings
def static(request):
"""
Adds static-related context variables to the context.
"""
return {'STATIC_URL': settings.STATIC_URL}
def static_url(request):
warnings.warn(
"The context processor 'staticfiles.context_processors.static_url' "
"was renamed to 'staticfiles.context_processors.static'.",
DeprecationWarning)
return static(request)
| 27.25 | 76 | 0.713303 | 49 | 436 | 6.22449 | 0.489796 | 0.118033 | 0.183607 | 0.222951 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.194954 | 436 | 15 | 77 | 29.066667 | 0.868946 | 0.12156 | 0 | 0 | 0 | 0 | 0.356948 | 0.226158 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2e23486d7d857a99db4d71fd355e0cdfb7001603 | 219 | py | Python | TeensyFirmware/flash.py | microsoft/ada | 4bb55acd6e34c45989ad69c1009b0fd571d10640 | [
"MIT"
] | 1 | 2022-02-18T01:10:51.000Z | 2022-02-18T01:10:51.000Z | TeensyFirmware/flash.py | microsoft/ada | 4bb55acd6e34c45989ad69c1009b0fd571d10640 | [
"MIT"
] | null | null | null | TeensyFirmware/flash.py | microsoft/ada | 4bb55acd6e34c45989ad69c1009b0fd571d10640 | [
"MIT"
] | null | null | null | import RPi.GPIO as GPIO
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
# set up the GPIO channels - one input and one output
GPIO.setup(7, GPIO.OUT)
GPIO.output(7, GPIO.LOW)
GPIO.setup(7, GPIO.IN)
| 21.9 | 53 | 0.73516 | 41 | 219 | 3.926829 | 0.609756 | 0.093168 | 0.124224 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016304 | 0.159817 | 219 | 9 | 54 | 24.333333 | 0.858696 | 0.406393 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2e2fae2968970fcc70433023daf34a9d9e155d6c | 74 | py | Python | lintuasema-backend/application/db.py | luomus/lintuasemasovellus | 966546795f5e6f0efd5b5d03c08577c788dba241 | [
"MIT"
] | null | null | null | lintuasema-backend/application/db.py | luomus/lintuasemasovellus | 966546795f5e6f0efd5b5d03c08577c788dba241 | [
"MIT"
] | 32 | 2021-02-03T12:17:33.000Z | 2021-05-02T16:38:13.000Z | lintuasema-backend/application/db.py | luomus/lintuasemasovellus | 966546795f5e6f0efd5b5d03c08577c788dba241 | [
"MIT"
] | 1 | 2021-04-18T17:26:03.000Z | 2021-04-18T17:26:03.000Z | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
prefix = 'v2_'
| 14.8 | 39 | 0.77027 | 9 | 74 | 6.111111 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 0.148649 | 74 | 4 | 40 | 18.5 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0.041096 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2e50d32fa06f70e5e135d222e062d8b6f5dbc18d | 1,877 | py | Python | more_or_less/more_plugin.py | jeroen-dhollander/python-paginator | 8c60ae6dd64a7440feda4561440117d9bebc3ae7 | [
"CC0-1.0"
] | 3 | 2018-09-26T20:07:51.000Z | 2021-07-10T11:59:44.000Z | more_or_less/more_plugin.py | jeroen-dhollander/python-paginator | 8c60ae6dd64a7440feda4561440117d9bebc3ae7 | [
"CC0-1.0"
] | 1 | 2020-02-19T10:15:38.000Z | 2020-03-14T21:48:55.000Z | more_or_less/more_plugin.py | jeroen-dhollander/python-more-or-less | 8c60ae6dd64a7440feda4561440117d9bebc3ae7 | [
"CC0-1.0"
] | null | null | null | from abc import ABC, abstractmethod
class MorePlugin(ABC):
'''
A plugin that represents an extra action the user can take on the 'more' prompt.
'''
@abstractmethod
def get_keys(self):
''' Returns a list of the keys the user has to enter to trigger this action. '''
pass
@abstractmethod
def build_page(self, page_builder, key_pressed, arguments):
'''
Called when the user pressed one of the keys to trigger this action.
Arguments:
----------
page_builder:
The MorePageBuilder instance.
key_pressed:
The key the user pressed to trigger this action.
arguments:
A dictionary of arguments the user entered on this line before triggering
this action.
By default, the only value that can be in there is 'count',
which will be set if the user entered a number before your action.
For example, if the user entered '10 ' then the '<space>' action is triggered
with argument {'count': 10}.
'''
pass
def wrap_page(self, page):
'''
Called when a new page is created.
Gives the plugin to return a wrapper page that can be used to modify/register
_every_ line, including the ones that are suppressed by other plugins.
Example usage is counting all the outputted lines.
Must return a 'Page'. Implementing this method is optional.
'''
return page
@abstractmethod
def get_help(self):
'''
Returns an iterator over 'command', 'help-text' tuples that describe how to use
this plugin.
Example:
yield (' ', 'Display next line of text')
'''
pass
| 31.813559 | 93 | 0.574853 | 227 | 1,877 | 4.709251 | 0.480176 | 0.045837 | 0.036483 | 0.053321 | 0.052385 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003344 | 0.362813 | 1,877 | 58 | 94 | 32.362069 | 0.890468 | 0.617475 | 0 | 0.461538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0.230769 | 0.076923 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
2e53c5028305c2f695ef7f89ee5abdf87898de3d | 173 | py | Python | torchsynth/__init__.py | Doddox-UV/torchsynth | 574bdd5988d7802a42d9e9ec70dc515605c6aded | [
"Apache-2.0"
] | 184 | 2021-04-11T19:56:25.000Z | 2022-03-31T15:30:44.000Z | torchsynth/__init__.py | Doddox-UV/torchsynth | 574bdd5988d7802a42d9e9ec70dc515605c6aded | [
"Apache-2.0"
] | 207 | 2021-03-04T02:58:43.000Z | 2021-04-10T20:20:54.000Z | torchsynth/__init__.py | Doddox-UV/torchsynth | 574bdd5988d7802a42d9e9ec70dc515605c6aded | [
"Apache-2.0"
] | 5 | 2021-04-25T00:38:06.000Z | 2021-10-01T11:08:13.000Z | from torchsynth.__info__ import ( # noqa: F401
__author__,
__author_email__,
__copyright__,
__docs__,
__homepage__,
__license__,
__version__,
)
| 17.3 | 47 | 0.676301 | 14 | 173 | 6 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023256 | 0.254335 | 173 | 9 | 48 | 19.222222 | 0.627907 | 0.057803 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.111111 | 0 | 0.111111 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2e7dc647373335b503a34a2d4a35865fb0a8ce24 | 372 | py | Python | testserver/manage.py | akubera/batavia | b56f2a3f54242f81aea3a5a048356a03f0d49494 | [
"BSD-3-Clause"
] | 1 | 2018-05-17T08:46:16.000Z | 2018-05-17T08:46:16.000Z | testserver/manage.py | akubera/batavia | b56f2a3f54242f81aea3a5a048356a03f0d49494 | [
"BSD-3-Clause"
] | 1 | 2021-06-10T23:39:56.000Z | 2021-06-10T23:39:56.000Z | testserver/manage.py | akubera/batavia | b56f2a3f54242f81aea3a5a048356a03f0d49494 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
if sys.version_info[0] != 3:
sys.stderr.write('Batavia requires Python 3' + os.linesep)
sys.exit(1)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| 23.25 | 66 | 0.693548 | 51 | 372 | 4.72549 | 0.647059 | 0.091286 | 0.149378 | 0.182573 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013378 | 0.196237 | 372 | 15 | 67 | 24.8 | 0.792642 | 0.053763 | 0 | 0 | 0 | 0 | 0.179487 | 0.062678 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 0 | 0 | 0 | 3 |
2e8e45f33735173ba981879373ba6646052dcfb9 | 104 | py | Python | fantasyanalyzer/main/main.py | dmowen2/FantasyAnalyzer | b113615ac711560718c595eeef3e771a2a4e2a69 | [
"MIT"
] | null | null | null | fantasyanalyzer/main/main.py | dmowen2/FantasyAnalyzer | b113615ac711560718c595eeef3e771a2a4e2a69 | [
"MIT"
] | null | null | null | fantasyanalyzer/main/main.py | dmowen2/FantasyAnalyzer | b113615ac711560718c595eeef3e771a2a4e2a69 | [
"MIT"
] | null | null | null | #basic file to run the program
import mainApp
startprogram = mainApp.commandLine()
startprogram.run()
| 14.857143 | 36 | 0.788462 | 13 | 104 | 6.307692 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134615 | 104 | 6 | 37 | 17.333333 | 0.911111 | 0.278846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2e9074bb1cba53266c6974290d0d2403b768e6ea | 3,124 | py | Python | network_anomaly/code/Basic_features/test.py | kidrabit/Data-Visualization-Lab-RND | baa19ee4e9f3422a052794e50791495632290b36 | [
"Apache-2.0"
] | 1 | 2022-01-18T01:53:34.000Z | 2022-01-18T01:53:34.000Z | network_anomaly/code/Basic_features/test.py | kidrabit/Data-Visualization-Lab-RND | baa19ee4e9f3422a052794e50791495632290b36 | [
"Apache-2.0"
] | null | null | null | network_anomaly/code/Basic_features/test.py | kidrabit/Data-Visualization-Lab-RND | baa19ee4e9f3422a052794e50791495632290b36 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import pandas as pd
import csv
import collections
from pandas import DataFrame as df
def test(data):
print(data['TIME'])
return 100
# data['TIME'] = data['TIME'].astype('float')
# data['TIME'] = data['TIME'].astype('int')
#
# # IP, PORT, IP_PORT 데이터셋 생성 -> new_data
# new_data = data['dstip']
# new_data = pd.DataFrame(new_data)
# IP = []
# PORT = []
# dst = []
# land=[]
#
# dst = data['dstip'].values.tolist()
# src = data['srcip'].values.tolist()
#
#
# for i in range(len(new_data)):
# IP.append(new_data.iloc[i][0].split(':')[0])
# PORT.append(new_data.iloc[i][0].split(':')[1])
#
# for i in range(len(new_data)):
# if src==dst:
# land.append(1)
# else:
# land.append(0)
#
#
# IP = pd.DataFrame(IP, columns=['IP'])
# PORT = pd.DataFrame(PORT, columns=['PORT'])
# IP_PORT = pd.DataFrame(dst, columns=['IP_PORT'])
# LAND=pd.DataFrame(land,columns=['LAND'])
#
#
#
# new_data = pd.concat([data['TIME'], IP], axis=1)
# new_data = pd.concat([new_data, PORT], axis=1)
# new_data = pd.concat([new_data, IP_PORT], axis=1)
# new_data = pd.concat([new_data,LAND],axis=1)
#
#
#
# # timestamp에 각 초에 따른 데이터를 넣어줌
# timestamp_IP_PORT = []
# for i in range((max(new_data['TIME']))+1):
# line = []
# timestamp_IP_PORT.append(line)
#
# for j in range(len(new_data['TIME'])):
# timestamp_IP_PORT[new_data['TIME'].iloc[j]].append(new_data['IP_PORT'].iloc[j])
#
# # timestamp를 이용해서 counter에 각 초당 IP&PORT 개수를 저장함
# counter_IP_PORT = []
# for k in range(len(timestamp_IP_PORT)):
# counter_IP_PORT.append(collections.Counter(timestamp_IP_PORT[k]))
#
# timestamp_IP = []
#
# # 초단위로 바꾼 값 중의 최대값 크기만큼의 (timestamp)리스트를 만듦
# for i in range((max(new_data['TIME']))+1):
# line = []
# timestamp_IP.append(line)
#
#
#
# # (timestamp)안에 각 초단위에 해당하는 dstip를 리스트형태로 넣음
# # 아래 코드 실행 후 timestamp[0:2] 로 출력하면 0초,1초에 대한 dstip 출력
# for j in range(len(new_data['TIME'])):
#
# timestamp_IP[new_data['TIME'].iloc[j]].append(new_data['IP'].iloc[j])
# # f.write(str(timestamp_IP)) 테스트
#
#
# # timestamp를 이용해서 counter에 각 초당 IP&PORT 개수를 저장함
# counter_IP = []
# for k in range(len(timestamp_IP)):
# counter_IP.append(collections.Counter(timestamp_IP[k]))
#
# timestamp_PORT = []
# # 초단위로 바꾼 값 중의 최대값 크기만큼의 (timestamp)리스트를 만듦
# for i in range((max(new_data['TIME']))+1):
# line = []
# timestamp_PORT.append(line)
#
# # (timestamp)안에 각 초단위에 해당하는 dstip를 리스트형태로 넣음
# # 아래 코드 실행 후 timestamp[0:2] 로 출력하면 0초,1초에 대한 dstip 출력
# for j in range(len(new_data['TIME'])):
# # print(data['time'].iloc[j])
# timestamp_PORT[new_data['TIME'].iloc[j]].append(new_data['PORT'].iloc[j])
#
# counter_PORT = []
# for k in range(len(timestamp_PORT)):
# counter_PORT.append(collections.Counter(timestamp_PORT[k]))
#
# return land
if __name__ == '__main__':
pass | 28.925926 | 88 | 0.572983 | 447 | 3,124 | 3.850112 | 0.221477 | 0.10982 | 0.057525 | 0.031958 | 0.61011 | 0.520046 | 0.520046 | 0.420686 | 0.404997 | 0.311447 | 0 | 0.010647 | 0.248399 | 3,124 | 108 | 89 | 28.925926 | 0.722317 | 0.876761 | 0 | 0 | 0 | 0 | 0.043011 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.111111 | 0.444444 | 0 | 0.666667 | 0.111111 | 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 | 0 | 0 | 0 | 3 |
5cef3a3627a98fccd21ed376ae079a30c30f5f8d | 194 | py | Python | curso em video/python/mundo 3/aula 21/aula 21.py | KenzoDezotti/cursoemvideo | 6eba03e67192f7384092192ed2cc1a8e59efd9b9 | [
"MIT"
] | null | null | null | curso em video/python/mundo 3/aula 21/aula 21.py | KenzoDezotti/cursoemvideo | 6eba03e67192f7384092192ed2cc1a8e59efd9b9 | [
"MIT"
] | null | null | null | curso em video/python/mundo 3/aula 21/aula 21.py | KenzoDezotti/cursoemvideo | 6eba03e67192f7384092192ed2cc1a8e59efd9b9 | [
"MIT"
] | null | null | null | def teste(b):
global a
b += 4
a=8
c=2
print(a)
print(b)
print(c)
#------------------------------------
#funcionamento do comando global
a=5
print(a)
teste(6)
print(a) | 13.857143 | 37 | 0.453608 | 29 | 194 | 3.034483 | 0.517241 | 0.204545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034247 | 0.247423 | 194 | 14 | 38 | 13.857143 | 0.568493 | 0.345361 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0 | 0 | 0.083333 | 0.416667 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
cf458acadf833d83661ceef97551521840b2249b | 730 | py | Python | brewerslab-orig-commander/metroui/ajaxRecalculate.py | allena29/brewerslabng | f47e671971436b7af806b54f6019c5b185d7d194 | [
"Apache-2.0"
] | 1 | 2020-04-12T10:08:10.000Z | 2020-04-12T10:08:10.000Z | brewerslab-orig-commander/metroui/ajaxRecalculate.py | allena29/brewerslabng | f47e671971436b7af806b54f6019c5b185d7d194 | [
"Apache-2.0"
] | 2 | 2021-12-13T20:09:45.000Z | 2022-03-08T21:09:57.000Z | brewerslab-orig-commander/metroui/ajaxRecalculate.py | allena29/brewerslabng | f47e671971436b7af806b54f6019c5b185d7d194 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
import re
import sys
import cgi
import _mysql
import mysql.connector
from thememetro import *
from cloudNG import *
con=mysql.connector.connect(user='brewerslab',password='beer',database="brewerslab")
form=cgi.FieldStorage()
theme=webTheme()
theme.bgcolor="#ffffff"
if theme.localUser:
sys.stdout.write("Content-Type:text/xml\n\n")
grid={}
db=_mysql.connect(host="localhost",user="brewerslab",passwd='beer',db="brewerslab")
print "<xml><junk>"
bc=brewerslabCloudApi()
#bc.calculateRecipe("test@example.com", form['recipe'].value)
#bc.compile("test@example.com", form['recipe'].value,None)
bc.calculateRecipeWrapper("test@example.com",form['recipe'].value)
print "</junk><complete>1</complete></xml>"
| 28.076923 | 84 | 0.746575 | 98 | 730 | 5.540816 | 0.55102 | 0.060773 | 0.077348 | 0.099448 | 0.160221 | 0.160221 | 0 | 0 | 0 | 0 | 0 | 0.001471 | 0.068493 | 730 | 25 | 85 | 29.2 | 0.797059 | 0.182192 | 0 | 0 | 0 | 0 | 0.26431 | 0.10101 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.105263 | 0.368421 | null | null | 0.105263 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
cf49e6d7e31e1c1a3165ef1af9d24717e6080a4b | 11,063 | py | Python | migrations/versions/95805663f7bd_.py | Anioko/CMS | b6465faf2a5d7333f494526bcddf8083d6807aee | [
"MIT"
] | null | null | null | migrations/versions/95805663f7bd_.py | Anioko/CMS | b6465faf2a5d7333f494526bcddf8083d6807aee | [
"MIT"
] | 1 | 2021-06-02T01:40:15.000Z | 2021-06-02T01:40:15.000Z | migrations/versions/95805663f7bd_.py | Anioko/CMS | b6465faf2a5d7333f494526bcddf8083d6807aee | [
"MIT"
] | null | null | null | """empty message
Revision ID: 95805663f7bd
Revises:
Create Date: 2020-05-30 12:10:57.896357
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '95805663f7bd'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('blogcategories',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('slug', sa.String(length=255), nullable=True),
sa.Column('description', sa.String(length=512), nullable=True),
sa.Column('created_on', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_blogcategories_slug'), 'blogcategories', ['slug'], unique=True)
op.create_table('blogpoststatus',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=128), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('editableHTML',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('editor_name', sa.String(length=100), nullable=True),
sa.Column('value', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('editor_name')
)
op.create_table('files',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=32), nullable=True),
sa.Column('path', sa.String(length=255), nullable=True),
sa.Column('uploaded_date', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('images',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('image_filename', sa.String(), nullable=True),
sa.Column('image_url', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('menus',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=32), nullable=True),
sa.Column('created_on', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('photogalleries',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=128), nullable=True),
sa.Column('slug', sa.String(length=255), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('created_on', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_photogalleries_slug'), 'photogalleries', ['slug'], unique=True)
op.create_table('roles',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('index', sa.String(length=64), nullable=True),
sa.Column('default', sa.Boolean(), nullable=True),
sa.Column('permissions', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
op.create_table('sitesettings',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=128), nullable=True),
sa.Column('value', sa.String(length=4000), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('menuitems',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=32), nullable=True),
sa.Column('slug', sa.String(length=256), nullable=True),
sa.Column('weight', sa.Integer(), nullable=True),
sa.Column('menu_id', sa.Integer(), nullable=True),
sa.Column('created_on', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['menu_id'], ['menus.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('photogalleryitems',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=128), nullable=True),
sa.Column('description', sa.String(length=512), nullable=True),
sa.Column('file_id', sa.Integer(), nullable=True),
sa.Column('photogallery_id', sa.Integer(), nullable=True),
sa.Column('created_on', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['file_id'], ['files.id'], ),
sa.ForeignKeyConstraint(['photogallery_id'], ['photogalleries.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('confirmed', sa.Boolean(), nullable=True),
sa.Column('first_name', sa.String(length=64), nullable=True),
sa.Column('last_name', sa.String(length=64), nullable=True),
sa.Column('email', sa.String(length=64), nullable=True),
sa.Column('password_hash', sa.String(length=128), nullable=True),
sa.Column('role_id', sa.Integer(), nullable=True),
sa.Column('created_on', sa.DateTime(), nullable=True),
sa.Column('username', sa.String(length=64), nullable=True),
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
op.create_index(op.f('ix_users_first_name'), 'users', ['first_name'], unique=False)
op.create_index(op.f('ix_users_last_name'), 'users', ['last_name'], unique=False)
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
op.create_table('blogposts',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=128), nullable=True),
sa.Column('slug', sa.String(length=255), nullable=True),
sa.Column('content', sa.Text(), nullable=True),
sa.Column('blogcategory_id', sa.Integer(), nullable=True),
sa.Column('blogpoststatus_id', sa.Integer(), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('created_on', sa.DateTime(), nullable=True),
sa.Column('published_on', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['blogcategory_id'], ['blogcategories.id'], ),
sa.ForeignKeyConstraint(['blogpoststatus_id'], ['blogpoststatus.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_blogposts_slug'), 'blogposts', ['slug'], unique=True)
op.create_table('opportunities',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('title', sa.String(), nullable=True),
sa.Column('summary', sa.String(), nullable=True),
sa.Column('city', sa.String(), nullable=True),
sa.Column('state', sa.String(), nullable=True),
sa.Column('country', sa.String(), nullable=True),
sa.Column('opportunity_type', sa.String(), nullable=True),
sa.Column('available_now', sa.String(), nullable=True),
sa.Column('location_type', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('pages',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=128), nullable=True),
sa.Column('slug', sa.String(length=255), nullable=True),
sa.Column('content', sa.Text(), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('menu_id', sa.Integer(), nullable=True),
sa.Column('created_on', sa.DateTime(), nullable=True),
sa.Column('published_on', sa.DateTime(), nullable=True),
sa.Column('is_homepage', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['menu_id'], ['menus.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_pages_slug'), 'pages', ['slug'], unique=True)
op.create_table('schools',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(), nullable=True),
sa.Column('description', sa.String(), nullable=True),
sa.Column('grading', sa.String(), nullable=True),
sa.Column('start_date', sa.DateTime(), nullable=False),
sa.Column('end_date', sa.DateTime(), nullable=False),
sa.Column('currently', sa.String(), nullable=True),
sa.Column('city', sa.String(), nullable=True),
sa.Column('state', sa.String(), nullable=True),
sa.Column('country', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('workplaces',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(), nullable=True),
sa.Column('description', sa.String(), nullable=True),
sa.Column('role', sa.String(), nullable=True),
sa.Column('role_description', sa.String(), nullable=True),
sa.Column('start_date', sa.DateTime(), nullable=False),
sa.Column('end_date', sa.DateTime(), nullable=False),
sa.Column('currently', sa.String(), nullable=True),
sa.Column('city', sa.String(), nullable=True),
sa.Column('state', sa.String(), nullable=True),
sa.Column('country', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('workplaces')
op.drop_table('schools')
op.drop_index(op.f('ix_pages_slug'), table_name='pages')
op.drop_table('pages')
op.drop_table('opportunities')
op.drop_index(op.f('ix_blogposts_slug'), table_name='blogposts')
op.drop_table('blogposts')
op.drop_index(op.f('ix_users_username'), table_name='users')
op.drop_index(op.f('ix_users_last_name'), table_name='users')
op.drop_index(op.f('ix_users_first_name'), table_name='users')
op.drop_index(op.f('ix_users_email'), table_name='users')
op.drop_table('users')
op.drop_table('photogalleryitems')
op.drop_table('menuitems')
op.drop_table('sitesettings')
op.drop_index(op.f('ix_roles_default'), table_name='roles')
op.drop_table('roles')
op.drop_index(op.f('ix_photogalleries_slug'), table_name='photogalleries')
op.drop_table('photogalleries')
op.drop_table('menus')
op.drop_table('images')
op.drop_table('files')
op.drop_table('editableHTML')
op.drop_table('blogpoststatus')
op.drop_index(op.f('ix_blogcategories_slug'), table_name='blogcategories')
op.drop_table('blogcategories')
# ### end Alembic commands ###
| 45.714876 | 92 | 0.669891 | 1,440 | 11,063 | 5.032639 | 0.091667 | 0.123637 | 0.175797 | 0.204222 | 0.796881 | 0.78667 | 0.705533 | 0.652408 | 0.611287 | 0.571271 | 0 | 0.011454 | 0.131881 | 11,063 | 241 | 93 | 45.904564 | 0.743128 | 0.025581 | 0 | 0.475336 | 0 | 0 | 0.182165 | 0.008191 | 0 | 0 | 0 | 0 | 0 | 1 | 0.008969 | false | 0.004484 | 0.008969 | 0 | 0.017937 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d83daa61f951ded7d9855286838edef9a66c37b5 | 170 | py | Python | AIZU_ONLINE_JUDGE/0007.py | vox256/Codes | c408ef0fbc25af46dacef93b3496985feb98dd5c | [
"MIT"
] | null | null | null | AIZU_ONLINE_JUDGE/0007.py | vox256/Codes | c408ef0fbc25af46dacef93b3496985feb98dd5c | [
"MIT"
] | null | null | null | AIZU_ONLINE_JUDGE/0007.py | vox256/Codes | c408ef0fbc25af46dacef93b3496985feb98dd5c | [
"MIT"
] | null | null | null | n = int(input())
debt = 100000
for i in range (n):
debt *= 1.05
if debt % 1000 != 0:
debt -= debt % 1000
debt += 1000
print (int(debt)) | 17 | 28 | 0.476471 | 25 | 170 | 3.24 | 0.6 | 0.296296 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207547 | 0.376471 | 170 | 10 | 29 | 17 | 0.556604 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d85908aea84d7f7f730620a14ba03abbda1756ba | 45 | py | Python | common/__init__.py | weipeng/pyepi | 1af5eab78e20f55fadccef8cb7b7aad6d503b31b | [
"MIT"
] | 1 | 2020-03-28T06:29:28.000Z | 2020-03-28T06:29:28.000Z | common/__init__.py | weipeng/pyepi | 1af5eab78e20f55fadccef8cb7b7aad6d503b31b | [
"MIT"
] | null | null | null | common/__init__.py | weipeng/pyepi | 1af5eab78e20f55fadccef8cb7b7aad6d503b31b | [
"MIT"
] | 2 | 2020-03-29T16:12:52.000Z | 2020-04-28T22:53:33.000Z | __all__ = [
'stats', 'utils', 'linalg'
]
| 11.25 | 30 | 0.511111 | 4 | 45 | 4.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.244444 | 45 | 3 | 31 | 15 | 0.558824 | 0 | 0 | 0 | 0 | 0 | 0.355556 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d8593d6692d7d033994d2758b7537e9bd3034f63 | 45 | py | Python | skforecast/__init__.py | JavierEscobarOrtiz/skforecast | a3af4a1dd4201c582f159d4e3a1734ed6d29b6c5 | [
"MIT"
] | 1 | 2021-12-01T09:21:21.000Z | 2021-12-01T09:21:21.000Z | skforecast/__init__.py | JavierEscobarOrtiz/skforecast | a3af4a1dd4201c582f159d4e3a1734ed6d29b6c5 | [
"MIT"
] | null | null | null | skforecast/__init__.py | JavierEscobarOrtiz/skforecast | a3af4a1dd4201c582f159d4e3a1734ed6d29b6c5 | [
"MIT"
] | null | null | null | name = "skforecast"
__version__ = "0.5.dev1"
| 15 | 24 | 0.688889 | 6 | 45 | 4.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 0.133333 | 45 | 2 | 25 | 22.5 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d8bab771f310012235c06cb7dfdf54237fe96981 | 125 | py | Python | src/pycrds/__init__.py | lokamigauti/metroclima-crds | 70ad9d13810ed551deba1363e475e6a7271f3af1 | [
"BSD-3-Clause"
] | null | null | null | src/pycrds/__init__.py | lokamigauti/metroclima-crds | 70ad9d13810ed551deba1363e475e6a7271f3af1 | [
"BSD-3-Clause"
] | null | null | null | src/pycrds/__init__.py | lokamigauti/metroclima-crds | 70ad9d13810ed551deba1363e475e6a7271f3af1 | [
"BSD-3-Clause"
] | null | null | null | __all__ = ["datafile", "flags", "graphs"]
for module in __all__:
__import__(__name__ + "." + module, globals(), locals()) | 41.666667 | 60 | 0.648 | 13 | 125 | 5 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152 | 125 | 3 | 60 | 41.666667 | 0.613208 | 0 | 0 | 0 | 0 | 0 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d8bfc1ac4a0ba5561449846faf72e97b38a7b701 | 320 | py | Python | apolo/apolo/apps/adopcion/models.py | XeresRed/TrabajoGrado | 3d7135732ea76410995ed3b5c3332eb83881677c | [
"MIT"
] | null | null | null | apolo/apolo/apps/adopcion/models.py | XeresRed/TrabajoGrado | 3d7135732ea76410995ed3b5c3332eb83881677c | [
"MIT"
] | null | null | null | apolo/apolo/apps/adopcion/models.py | XeresRed/TrabajoGrado | 3d7135732ea76410995ed3b5c3332eb83881677c | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class Persona(AbstractUser):
activos = models.CharField(blank=True, max_length=100)
numeroEmpl = models.IntegerField(blank=True, null=True)
tipo = models.CharField(blank=True, max_length=100)
| 26.666667 | 59 | 0.759375 | 42 | 320 | 5.738095 | 0.571429 | 0.112033 | 0.165975 | 0.19917 | 0.298755 | 0.298755 | 0.298755 | 0 | 0 | 0 | 0 | 0.021978 | 0.146875 | 320 | 11 | 60 | 29.090909 | 0.860806 | 0.075 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d8e095732d43409e05f872611e0a25bf01b9a971 | 471 | py | Python | d1lod/d1lod/__init__.py | DataONEorg/slinky | 1f0f774b7b5556126d75524ac9fd328ad0fc1ba2 | [
"Apache-2.0"
] | 2 | 2019-03-07T21:14:27.000Z | 2021-03-30T00:24:13.000Z | d1lod/d1lod/__init__.py | DataONEorg/slinky | 1f0f774b7b5556126d75524ac9fd328ad0fc1ba2 | [
"Apache-2.0"
] | 64 | 2021-03-11T22:28:45.000Z | 2022-03-17T18:41:08.000Z | d1lod/d1lod/__init__.py | DataONEorg/slinky | 1f0f774b7b5556126d75524ac9fd328ad0fc1ba2 | [
"Apache-2.0"
] | 2 | 2018-09-05T16:38:42.000Z | 2021-03-12T18:07:20.000Z | from . import people
from . import dataone
from . import util
from . import validator
from . import metadata
from .graph import Graph
from .interface import Interface
# Set default logging handler to avoid "No handler found" warnings.
import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHandler(NullHandler())
| 24.789474 | 67 | 0.7431 | 59 | 471 | 5.864407 | 0.576271 | 0.144509 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005236 | 0.18896 | 471 | 18 | 68 | 26.166667 | 0.900524 | 0.163482 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0.066667 | 0.666667 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
2b14e1f101cb9c3f4df93b0023935c69cc41ca60 | 6,801 | py | Python | Malt/SourceTranspiler.py | panthavma/Malt | 918bce21a131e472db7a136a3cb851bda9237a7f | [
"MIT-0",
"MIT"
] | null | null | null | Malt/SourceTranspiler.py | panthavma/Malt | 918bce21a131e472db7a136a3cb851bda9237a7f | [
"MIT-0",
"MIT"
] | null | null | null | Malt/SourceTranspiler.py | panthavma/Malt | 918bce21a131e472db7a136a3cb851bda9237a7f | [
"MIT-0",
"MIT"
] | null | null | null | import textwrap
#TODO: Send transpiler along graph types
class SourceTranspiler():
@classmethod
def get_source_name(self, name):
name = name.replace('.','_').replace(' ', '_')
name = '_' + ''.join(char for char in name if char.isalnum() or char == '_')
while '__' in name:
name = name.replace('__','_')
return name
@classmethod
def asignment(self, name, asignment):
pass
@classmethod
def declaration(self, type, size, name, initialization=None):
pass
@classmethod
def global_reference(self, node_name, parameter_name):
pass
@classmethod
def global_declaration(self, type, size, name, initialization=None):
pass
@classmethod
def custom_io_reference(self, io, graph_io_type, name):
pass
@classmethod
def preprocessor_wrap(self, define, content):
return content
@classmethod
def custom_output_declaration(self, type, name, index, graph_io_type):
pass
@classmethod
def parameter_reference(self, node_name, parameter_name, io_type):
pass
@classmethod
def io_parameter_reference(self, parameter_name, io_type):
return parameter_name
@classmethod
def is_instantiable_type(self, type):
return True
@classmethod
def call(self, name, parameters=[], full_statement=False):
pass
@classmethod
def result(self, result):
pass
@classmethod
def scoped(self, code):
pass
class GLSLTranspiler(SourceTranspiler):
@classmethod
def asignment(self, name, asignment):
return f'{name} = {asignment};\n'
@classmethod
def declaration(self, type, size, name, initialization=None):
array = '' if size == 0 else f'[{size}]'
asignment = f' = {initialization}' if initialization else ''
return f'{type} {name}{array}{asignment};\n'
@classmethod
def global_reference(self, node_name, parameter_name):
return f"U_0{node_name}_0_{self.get_source_name(parameter_name)}".replace('__','_')
@classmethod
def global_declaration(self, type, size, name, initialization=None):
return 'uniform ' + self.declaration(type, size, name, initialization)
@classmethod
def custom_io_reference(self, io, graph_io_type, name):
return f"{io.upper()}_{graph_io_type.upper()}_{''.join(char.upper() for char in name if char.isalnum())}"
@classmethod
def preprocessor_wrap(self, define, content):
if define is None:
return content
return textwrap.dedent('''\
#ifdef {}
{}
#endif //{}
''').format(define, content.strip(), define)
@classmethod
def custom_output_declaration(self, type, name, index, graph_io_type):
return f"layout (location = {index}) out {type} {self.custom_io_reference('OUT', graph_io_type, name)};\n"
@classmethod
def parameter_reference(self, node_name, parameter_name, io_type):
return f'{node_name}_0_{parameter_name}'
@classmethod
def is_instantiable_type(self, type):
return type.startswith('sampler') == False
@classmethod
def call(self, function, name, parameters=[], post_parameter_initialization = ''):
src = ''
for i, parameter in enumerate(function['parameters']):
if parameter['io'] in ['out','inout']:
initialization = parameters[i]
src_reference = self.parameter_reference(name, parameter['name'], parameter['io'])
src += self.declaration(parameter['type'], parameter['size'], src_reference, initialization)
parameters[i] = src_reference
src += post_parameter_initialization
initialization = f'{function["name"]}({",".join(parameters)})'
if function['type'] != 'void' and self.is_instantiable_type(function['type']):
src += self.declaration(function['type'], 0, self.parameter_reference(name, 'result', 'out'), initialization)
else:
src += initialization + ';\n'
return src
@classmethod
def result(self, result):
return f'return {result};\n'
@classmethod
def scoped(self, code):
import textwrap
code = textwrap.indent(code, '\t')
return f'{{\n{code}}}\n'
class PythonTranspiler(SourceTranspiler):
@classmethod
def asignment(self, name, asignment):
return f'{name} = {asignment}\n'
@classmethod
def declaration(self, type, size, name, initialization=None):
if initialization is None: initialization = 'None'
return self.asignment(name, initialization)
@classmethod
def global_reference(self, node_name, parameter_name):
return f'PARAMETERS["{node_name}"]["{parameter_name}"]'
@classmethod
def global_declaration(self, type, size, name, initialization=None):
return ''
return self.declaration(type, size, name, initialization)
@classmethod
def custom_io_reference(self, io, graph_io_type, name):
return self.io_parameter_reference(name, io)
@classmethod
def custom_output_declaration(self, type, name, index, graph_io_type):
return self.declaration(type, 0, self.io_parameter_reference(name, 'out'))
@classmethod
def parameter_reference(self, node_name, parameter_name, io_type):
if io_type:
return f'{node_name}_parameters["{io_type.upper()}"]["{parameter_name}"]'
else:
return f'{node_name}_parameters["{parameter_name}"]'
@classmethod
def io_parameter_reference(self, parameter_name, io_type):
return f'{io_type.upper()}["{parameter_name}"]'
@classmethod
def call(self, function, name, parameters=[], post_parameter_initialization = ''):
import textwrap
src = ''
src += textwrap.dedent(f'''
{name}_parameters = {{
'IN' : {{}},
'OUT' : {{}},
}}
''')
for i, parameter in enumerate(function['parameters']):
initialization = parameters[i]
if initialization is None:
initialization = 'None'
parameter_reference = self.parameter_reference(name, parameter['name'], parameter['io'])
src += f'{parameter_reference} = {initialization}\n'
src += post_parameter_initialization
src += f'run_node("{name}", "{function["name"]}", {name}_parameters)\n'
return src
@classmethod
def result(self, result):
return f'return {result}\n'
@classmethod
def scoped(self, code):
import textwrap
code = textwrap.indent(code, '\t')
return f'if True:\n{code}'
| 32.385714 | 121 | 0.624761 | 737 | 6,801 | 5.583446 | 0.118046 | 0.125881 | 0.041312 | 0.050547 | 0.680194 | 0.614581 | 0.576428 | 0.520535 | 0.520535 | 0.507412 | 0 | 0.001179 | 0.251728 | 6,801 | 209 | 122 | 32.54067 | 0.807428 | 0.005734 | 0 | 0.618182 | 0 | 0.012121 | 0.157077 | 0.06996 | 0.006061 | 0 | 0 | 0.004785 | 0 | 1 | 0.224242 | false | 0.060606 | 0.024242 | 0.10303 | 0.448485 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
2b1f7bce8113efac8c0084ee01c17879a8efac3c | 4,590 | py | Python | heat/tests/test_common_param_utils.py | noironetworks/heat | 7cdadf1155f4d94cf8f967635b98e4012a7acfb7 | [
"Apache-2.0"
] | 265 | 2015-01-02T09:33:22.000Z | 2022-03-26T23:19:54.000Z | heat/tests/test_common_param_utils.py | noironetworks/heat | 7cdadf1155f4d94cf8f967635b98e4012a7acfb7 | [
"Apache-2.0"
] | 8 | 2015-09-01T15:43:19.000Z | 2021-12-14T05:18:23.000Z | heat/tests/test_common_param_utils.py | noironetworks/heat | 7cdadf1155f4d94cf8f967635b98e4012a7acfb7 | [
"Apache-2.0"
] | 295 | 2015-01-06T07:00:40.000Z | 2021-09-06T08:05:06.000Z | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from heat.common import param_utils
from heat.tests import common
class TestExtractBool(common.HeatTestCase):
def test_extract_bool(self):
for value in ('True', 'true', 'TRUE', True):
self.assertTrue(param_utils.extract_bool('bool', value))
for value in ('False', 'false', 'FALSE', False):
self.assertFalse(param_utils.extract_bool('bool', value))
for value in ('foo', 't', 'f', 'yes', 'no', 'y', 'n', '1', '0', None):
self.assertRaises(ValueError, param_utils.extract_bool,
'bool', value)
class TestExtractInt(common.HeatTestCase):
def test_extract_int(self):
# None case
self.assertIsNone(param_utils.extract_int('num', None))
# 0 case
self.assertEqual(0, param_utils.extract_int('num', 0))
self.assertEqual(0, param_utils.extract_int('num', 0, allow_zero=True))
self.assertEqual(0, param_utils.extract_int('num', '0'))
self.assertEqual(0, param_utils.extract_int('num', '0',
allow_zero=True))
self.assertRaises(ValueError,
param_utils.extract_int,
'num', 0, allow_zero=False)
self.assertRaises(ValueError,
param_utils.extract_int,
'num', '0', allow_zero=False)
# positive values
self.assertEqual(1, param_utils.extract_int('num', 1))
self.assertEqual(1, param_utils.extract_int('num', '1'))
self.assertRaises(ValueError, param_utils.extract_int, 'num', '1.1')
self.assertRaises(ValueError, param_utils.extract_int, 'num', 1.1)
# negative values
self.assertEqual(-1, param_utils.extract_int('num', -1,
allow_negative=True))
self.assertEqual(-1, param_utils.extract_int('num', '-1',
allow_negative=True))
self.assertRaises(ValueError,
param_utils.extract_int, 'num', '-1.1',
allow_negative=True)
self.assertRaises(ValueError,
param_utils.extract_int, 'num', -1.1,
allow_negative=True)
self.assertRaises(ValueError, param_utils.extract_int, 'num', -1)
self.assertRaises(ValueError, param_utils.extract_int, 'num', '-1')
self.assertRaises(ValueError, param_utils.extract_int, 'num', '-1.1')
self.assertRaises(ValueError, param_utils.extract_int, 'num', -1.1)
self.assertRaises(ValueError,
param_utils.extract_int, 'num', -1,
allow_negative=False)
self.assertRaises(ValueError,
param_utils.extract_int, 'num', '-1',
allow_negative=False)
self.assertRaises(ValueError,
param_utils.extract_int, 'num', '-1.1',
allow_negative=False)
self.assertRaises(ValueError,
param_utils.extract_int, 'num', -1.1,
allow_negative=False)
# Non-int value
self.assertRaises(ValueError,
param_utils.extract_int, 'num', 'abc')
self.assertRaises(ValueError,
param_utils.extract_int, 'num', '')
self.assertRaises(ValueError,
param_utils.extract_int, 'num', 'true')
self.assertRaises(ValueError,
param_utils.extract_int, 'num', True)
class TestExtractTags(common.HeatTestCase):
def test_extract_tags(self):
self.assertRaises(ValueError, param_utils.extract_tags, "aaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaa,a")
self.assertEqual(["foo", "bar"], param_utils.extract_tags('foo,bar'))
| 45.9 | 79 | 0.579956 | 493 | 4,590 | 5.231237 | 0.221095 | 0.127957 | 0.210934 | 0.209383 | 0.673129 | 0.626987 | 0.5886 | 0.5886 | 0.550601 | 0.47848 | 0 | 0.014227 | 0.310893 | 4,590 | 99 | 80 | 46.363636 | 0.801138 | 0.13268 | 0 | 0.376812 | 0 | 0 | 0.066162 | 0.012879 | 0 | 0 | 0 | 0 | 0.463768 | 1 | 0.043478 | false | 0 | 0.028986 | 0 | 0.115942 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2b25d82fa6f0f77480a8c0271786df4755236b12 | 136 | py | Python | src/py/twitter_credentials.py | franciscomoura/social-media-analysis | e277ad7b81952ec5d01c0801133e226f430daa6e | [
"Apache-2.0"
] | null | null | null | src/py/twitter_credentials.py | franciscomoura/social-media-analysis | e277ad7b81952ec5d01c0801133e226f430daa6e | [
"Apache-2.0"
] | null | null | null | src/py/twitter_credentials.py | franciscomoura/social-media-analysis | e277ad7b81952ec5d01c0801133e226f430daa6e | [
"Apache-2.0"
] | null | null | null | consumer_key = '<your key>'
consumer_secret = '<your secret>'
access_token = '<your token>'
access_token_secret = '<your token secret>'
| 27.2 | 43 | 0.727941 | 18 | 136 | 5.222222 | 0.333333 | 0.212766 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 136 | 4 | 44 | 34 | 0.789916 | 0 | 0 | 0 | 0 | 0 | 0.397059 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2b275e20cb5d8a0781ea95c53cddfe783077cf6e | 1,820 | py | Python | pmaf/pipe/agents/miners/_metakit.py | mmtechslv/PhyloMAF | bab43dd4a4d2812951b1fdf4f1abb83edb79ea88 | [
"BSD-3-Clause"
] | 1 | 2021-07-02T06:24:17.000Z | 2021-07-02T06:24:17.000Z | pmaf/pipe/agents/miners/_metakit.py | mmtechslv/PhyloMAF | bab43dd4a4d2812951b1fdf4f1abb83edb79ea88 | [
"BSD-3-Clause"
] | 1 | 2021-06-28T12:02:46.000Z | 2021-06-28T12:02:46.000Z | pmaf/pipe/agents/miners/_metakit.py | mmtechslv/PhyloMAF | bab43dd4a4d2812951b1fdf4f1abb83edb79ea88 | [
"BSD-3-Clause"
] | null | null | null | from abc import ABC, abstractmethod
class MinerBackboneMetabase(ABC):
""" """
@abstractmethod
def verify_docker(self,docker):
"""
Parameters
----------
docker :
Returns
-------
"""
pass
@abstractmethod
def yield_accession_by_identifier(self, docker, **kwargs):
"""
Parameters
----------
docker :
**kwargs :
Returns
-------
"""
pass
@abstractmethod
def yield_sequence_by_identifier(self, docker, **kwargs):
"""
Parameters
----------
docker :
**kwargs :
Returns
-------
"""
pass
@abstractmethod
def yield_phylogeny_by_identifier(self, docker, **kwargs):
"""
Parameters
----------
docker :
**kwargs :
Returns
-------
"""
pass
@abstractmethod
def yield_taxonomy_by_identifier(self, docker, **kwargs):
"""
Parameters
----------
docker :
**kwargs :
Returns
-------
"""
pass
@abstractmethod
def yield_identifier_by_docker(self, docker, **kwargs):
"""
Parameters
----------
docker :
**kwargs :
Returns
-------
"""
pass
@property
@abstractmethod
def factor(self):
""" """
pass
@property
@abstractmethod
def mediator(self):
""" """
pass
@property
@abstractmethod
def state(self):
""" """
pass
| 14.108527 | 62 | 0.392308 | 106 | 1,820 | 6.584906 | 0.235849 | 0.17192 | 0.179083 | 0.200573 | 0.687679 | 0.545845 | 0.545845 | 0.545845 | 0.475645 | 0.475645 | 0 | 0 | 0.471978 | 1,820 | 128 | 63 | 14.21875 | 0.726327 | 0.218132 | 0 | 0.65625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.28125 | false | 0.28125 | 0.03125 | 0 | 0.34375 | 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 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.