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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6f3bd5a39dfdffc25d3e3bcdbc5be1926e9811b6 | 48 | py | Python | aliyunsdkcore/__init__.py | gikoluo/aliyun-python-sdk-core | 5c4e79ad5f7668af048ae1a18d424c4919131a9c | [
"MIT"
] | null | null | null | aliyunsdkcore/__init__.py | gikoluo/aliyun-python-sdk-core | 5c4e79ad5f7668af048ae1a18d424c4919131a9c | [
"MIT"
] | null | null | null | aliyunsdkcore/__init__.py | gikoluo/aliyun-python-sdk-core | 5c4e79ad5f7668af048ae1a18d424c4919131a9c | [
"MIT"
] | 4 | 2017-07-27T11:27:01.000Z | 2020-09-01T07:49:21.000Z | __author__ = 'alex jiang'
__version__ = '2.3.3'
| 16 | 25 | 0.6875 | 7 | 48 | 3.571429 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073171 | 0.145833 | 48 | 2 | 26 | 24 | 0.536585 | 0 | 0 | 0 | 0 | 0 | 0.3125 | 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 |
6f3fea7c8f1bfc40279f3c4ea0ed4489009162a1 | 50 | py | Python | players/__init__.py | lejbron/arkenstone | d5341c27ba81eaf116e5ee5983b4fa422437d294 | [
"MIT"
] | null | null | null | players/__init__.py | lejbron/arkenstone | d5341c27ba81eaf116e5ee5983b4fa422437d294 | [
"MIT"
] | 4 | 2021-03-17T19:46:35.000Z | 2021-04-09T11:37:53.000Z | players/__init__.py | lejbron/arkenstone | d5341c27ba81eaf116e5ee5983b4fa422437d294 | [
"MIT"
] | 1 | 2021-04-11T07:50:56.000Z | 2021-04-11T07:50:56.000Z | default_app_config = 'players.apps.PlayersConfig'
| 25 | 49 | 0.84 | 6 | 50 | 6.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06 | 50 | 1 | 50 | 50 | 0.851064 | 0 | 0 | 0 | 0 | 0 | 0.52 | 0.52 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6f59ecc61ca13580a763007d05b1e7a17bc242cb | 165 | py | Python | api/models/target.py | zanachka/proxy-service | 769e263606a6e520efdfe7d119bb717487d0e27e | [
"MIT"
] | 1 | 2020-08-08T17:06:43.000Z | 2020-08-08T17:06:43.000Z | api/models/target.py | zanachka/proxy-service | 769e263606a6e520efdfe7d119bb717487d0e27e | [
"MIT"
] | 2 | 2021-03-30T01:01:59.000Z | 2021-03-30T01:01:59.000Z | api/models/target.py | zanachka/proxy-service | 769e263606a6e520efdfe7d119bb717487d0e27e | [
"MIT"
] | 4 | 2020-12-22T18:13:24.000Z | 2021-11-26T13:03:45.000Z | """
DB operations for Targets
"""
from api.models.base import DBModel
class TargetDB(DBModel):
'''DBModel for the targets table'''
tablename = 'targets'
| 13.75 | 39 | 0.684848 | 20 | 165 | 5.65 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.193939 | 165 | 11 | 40 | 15 | 0.849624 | 0.333333 | 0 | 0 | 0 | 0 | 0.072165 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
6f644b09bfe662762ed95cb2b170c8fc73f84411 | 1,376 | py | Python | azure-iot-device/azure/iot/device/aio/__init__.py | olivakar/azure-iot-sdk-python | d8f2403030cf94510d381d8d5ac37af6e8d306f8 | [
"MIT"
] | null | null | null | azure-iot-device/azure/iot/device/aio/__init__.py | olivakar/azure-iot-sdk-python | d8f2403030cf94510d381d8d5ac37af6e8d306f8 | [
"MIT"
] | null | null | null | azure-iot-device/azure/iot/device/aio/__init__.py | olivakar/azure-iot-sdk-python | d8f2403030cf94510d381d8d5ac37af6e8d306f8 | [
"MIT"
] | null | null | null | """Azure IoT Device Library - Asynchronous
This library provides asynchronous clients for communicating with Azure IoT services
from an IoT device.
"""
from azure.iot.device.iothub.aio import *
from azure.iot.device.provisioning.aio import *
from . import patch_documentation
# Dynamically patch the clients to add shim implementations for all the inherited methods.
# This is necessary to generate accurate online docs.
# It SHOULD not impact the functionality of the methods themselves in any way.
# NOTE In the event of addition of new methods and generation of accurate documentation
# for those methods we have to append content to "patch_documentation.py" file.
# In order to do so please uncomment the "patch.add_shims" lines below,
# enable logging with level "DEBUG" in a python terminal and do
# "import azure.iot.device". The delta between the newly generated output
# and the existing content of "patch_documentation.py" should be appended to
# the function "execute_patch_for_sync" in "patch_documentation.py".
# Once done please again omment out the "patch.add_shims" lines below.
# patch.add_shims_for_inherited_methods(IoTHubDeviceClient) # noqa: F405
# patch.add_shims_for_inherited_methods(IoTHubModuleClient) # noqa: F405
# patch.add_shims_for_inherited_methods(ProvisioningDeviceClient) # noqa: F405
patch_documentation.execute_patch_for_async()
| 45.866667 | 90 | 0.805233 | 201 | 1,376 | 5.38806 | 0.472637 | 0.036934 | 0.060018 | 0.044321 | 0.151431 | 0.151431 | 0.073869 | 0.073869 | 0 | 0 | 0 | 0.007563 | 0.135174 | 1,376 | 29 | 91 | 47.448276 | 0.902521 | 0.844477 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
488aa98c813700f0bcd537993c300646573e9ada | 10,556 | py | Python | var/spack/repos/scs_io/packages/cudnn/package.py | scs-lab/spack | 77956aad6aa523c2a6c7256eb3c75094bf955c35 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | var/spack/repos/scs_io/packages/cudnn/package.py | scs-lab/spack | 77956aad6aa523c2a6c7256eb3c75094bf955c35 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | var/spack/repos/scs_io/packages/cudnn/package.py | scs-lab/spack | 77956aad6aa523c2a6c7256eb3c75094bf955c35 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2020-09-15T02:37:59.000Z | 2020-09-21T04:34:38.000Z | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
class Cudnn(Package):
"""NVIDIA cuDNN is a GPU-accelerated library of primitives for deep
neural networks"""
homepage = "https://developer.nvidia.com/cudnn"
# Latest versions available at:
# https://developer.nvidia.com/rdp/cudnn-download
# Archived versions available at:
# https://developer.nvidia.com/rdp/cudnn-archive
# Note that download links don't work from command line,
# need to use modified URLs like in url_for_version.
maintainers = ['adamjstewart']
# cuDNN 8.0.2
version('8.0.2.39-11.0-linux-x64',
sha256='672f46288b8edd98f8d156a4f1ff518201ca6de0cff67915ceaa37f6d6d86345')
version('8.0.2.39-11.0-linux-ppc64le',
sha256='b7c1ce5b1191eb007ba3455ea5f497fdce293a646545d8a6ed93e9bb06d7f057')
version('8.0.2.39-10.2-linux-x64',
sha256='c9cbe5c211360f3cfbc0fb104f0e9096b37e53f89392525679f049276b2f701f')
version('8.0.2.39-10.2-linux-ppc64le',
sha256='c32325ff84a8123491f2e58b3694885a9a672005bc21764b38874688c0e43262')
version('8.0.2.39-10.1-linux-x64',
sha256='82148a68bd6bdaab93af5e05bb1842b8ccb3ab7de7bed41f609a7616c102213d')
version('8.0.2.39-10.1-linux-ppc64le',
sha256='8196ec4f031356317baeccefbc4f61c8fccb2cf0bdef0a6431438918ddf68fb9')
# cuDNN 8.0
version('8.0.0.180-11.0-linux-x64',
sha256='9e75ea70280a77de815e0bdc85d08b67e081bc99a708b574092142344d2ba07e')
version('8.0.0.180-11.0-linux-ppc64le',
sha256='1229e94731bbca63ee7f5a239f4e1838a51a301d896f3097fbf7377d74704060')
version('8.0.0.180-10.2-linux-x64',
sha256='0c87c12358ee2b99d57c2a8c7560e3bb93e54bb929f5f8bec4964a72a2bb261d')
version('8.0.0.180-10.2-linux-ppc64le',
sha256='59e4ad6db15fcc374976e8052fe39e3f30f34079710fb3c7751a64c853d9243f')
# cuDNN 7.6.5
version('7.6.5.32-10.2-linux-x64',
sha256='600267f2caaed2fd58eb214ba669d8ea35f396a7d19b94822e6b36f9f7088c20',
preferred=True)
version('7.6.5.32-10.2-linux-ppc64le',
sha256='7dc08b6ab9331bfd12207d4802c61db1ad7cace7395b67a6e7b16efa0335668b')
version('7.6.5.32-10.1-linux-x64',
sha256='7eaec8039a2c30ab0bc758d303588767693def6bf49b22485a2c00bf2e136cb3')
version('7.6.5.32-10.1-osx-x64',
sha256='8ecce28a5ed388a2b9b2d239e08d7c550f53b79288e6d9e5eb4c152bfc711aff')
version('7.6.5.32-10.1-linux-ppc64le',
sha256='97b2faf73eedfc128f2f5762784d21467a95b2d5ba719825419c058f427cbf56')
version('7.6.5.32-10.0-linux-x64',
sha256='28355e395f0b2b93ac2c83b61360b35ba6cd0377e44e78be197b6b61b4b492ba')
version('7.6.5.32-10.0-osx-x64',
sha256='6fa0b819374da49102e285ecf7fcb8879df4d0b3cc430cc8b781cdeb41009b47')
version('7.6.5.32-10.0-linux-ppc64le',
sha256='b1717f4570083bbfc6b8b59f280bae4e4197cc1cb50e9d873c05adf670084c5b')
version('7.6.5.32-9.2-linux-x64',
sha256='a2a2c7a8ba7b16d323b651766ee37dcfdbc2b50d920f73f8fde85005424960e4')
version('7.6.5.32-9.2-linux-ppc64le',
sha256='a11f44f9a827b7e69f527a9d260f1637694ff7c1674a3e46bd9ec054a08f9a76')
version('7.6.5.32-9.0-linux-x64',
sha256='bd0a4c0090d5b02feec3f195738968690cc2470b9bc6026e6fe8ff245cd261c8')
# cuDNN 7.6.4
version('7.6.4.38-10.1-linux-x64',
sha256='32091d115c0373027418620a09ebec3658a6bc467d011de7cdd0eb07d644b099')
version('7.6.4.38-10.1-osx-x64',
sha256='bfced062c3689ced2c1fb49c7d5052e6bc3da6974c1eb707e4dcf8cd209d4236')
version('7.6.4.38-10.1-linux-ppc64le',
sha256='f3615fea50986a4dfd05d7a0cf83396dfdceefa9c209e8bf9691e20a48e420ce')
version('7.6.4.38-10.0-linux-x64',
sha256='417bb5daf51377037eb2f5c87649000ca1b9cec0acb16cfe07cb1d3e9a961dbf')
version('7.6.4.38-10.0-osx-x64',
sha256='af01ab841caec25087776a6b8fc7782883da12e590e24825ad1031f9ae0ed4b1')
version('7.6.4.38-10.0-linux-ppc64le',
sha256='c1725ad6bd7d7741e080a1e6da4b62eac027a94ac55c606cce261e3f829400bb')
version('7.6.4.38-9.2-linux-x64',
sha256='c79156531e641289b6a6952888b9637059ef30defd43c3cf82acf38d67f60a27')
version('7.6.4.38-9.2-linux-ppc64le',
sha256='98d8aae2dcd851558397a9a30b73242f257e1556be17c83650e63a0685969884')
version('7.6.4.38-9.0-linux-x64',
sha256='8db78c3623c192d4f03f3087b41c32cb0baac95e13408b5d9dabe626cb4aab5d')
# cuDNN 7.6.3
version('7.6.3.30-10.1-linux-x64',
sha256='352557346d8111e2f954c494be1a90207103d316b8777c33e62b3a7f7b708961')
version('7.6.3.30-10.1-linux-ppc64le',
sha256='f274735a8fc31923d3623b1c3d2b1d0d35bb176687077c6a4d4353c6b900d8ee')
# cuDNN 7.5.1
version('7.5.1.10-10.1-linux-x64',
sha256='2c833f43c9147d9a25a20947a4c5a5f5c33b2443240fd767f63b330c482e68e0')
version('7.5.1.10-10.1-linux-ppc64le',
sha256='a9e23bc83c970daec20874ccd1d8d80b648adf15440ecd0164818b330b1e2663')
version('7.5.1.10-10.0-linux-x64',
sha256='c0a4ec438920aa581dd567117b9c316745b4a451ac739b1e04939a3d8b229985')
version('7.5.1.10-10.0-linux-ppc64le',
sha256='d9205718da5fbab85433476f9ff61fcf4b889d216d6eea26753bbc24d115dd70')
# cuDNN 7.5.0
version('7.5.0.56-10.1-linux-x64',
sha256='c31697d6b71afe62838ad2e57da3c3c9419c4e9f5635d14b683ebe63f904fbc8')
version('7.5.0.56-10.1-linux-ppc64le',
sha256='15415eb714ab86ab6c7531f2cac6474b5dafd989479b062776c670b190e43638')
version('7.5.0.56-10.0-linux-x64',
sha256='701097882cb745d4683bb7ff6c33b8a35c7c81be31bac78f05bad130e7e0b781')
version('7.5.0.56-10.0-linux-ppc64le',
sha256='f0c1cbd9de553c8e2a3893915bd5fff57b30e368ef4c964d783b6a877869e93a')
# cuDNN 7.3.0
version('7.3.0.29-9.0-linux-x64',
sha256='403f9043ff2c7b2c5967454872275d07bca11fd41dfc7b21995eadcad6dbe49b')
# cuDNN 7.2.1
version('7.2.1.38-9.0-linux-x64',
sha256='cf007437b9ac6250ec63b89c25f248d2597fdd01369c80146567f78e75ce4e37')
# cuDNN 7.1.3
version('7.1.3-9.1-linux-x64',
sha256='dd616d3794167ceb923d706bf73e8d6acdda770751492b921ee6827cdf190228')
version('7.1.3-9.1-linux-ppc64le',
sha256='e3b4837f711b98a52faacc872a68b332c833917ef3cf87c0108f1d01af9b2931')
# cuDNN 6.0
version('6.0-8.0-linux-x64',
sha256='9b09110af48c9a4d7b6344eb4b3e344daa84987ed6177d5c44319732f3bb7f9c')
# cuDNN 5.1
version('5.1-8.0-linux-x64',
sha256='c10719b36f2dd6e9ddc63e3189affaa1a94d7d027e63b71c3f64d449ab0645ce')
# CUDA 10.2
depends_on('cuda@10.2.0:11.0.2', when='@7.6.5.32-10.2-linux-x64')
# CUDA 10.1
depends_on('cuda@10.1.0:11.0.2', when='@7.6.5.32-10.1-osx-x64')
depends_on('cuda@10.1.0:11.0.2', when='@7.6.5.32-10.1-linux-x64')
depends_on('cuda@10.1.0:11.0.2', when='@7.6.5.32-10.1-linux-ppc64le')
depends_on('cuda@10.1.0:11.0.2', when='@7.6.4.38-10.1-osx-x64')
depends_on('cuda@10.1.0:11.0.2', when='@7.6.4.38-10.1-linux-x64')
depends_on('cuda@10.1.0:11.0.2', when='@7.6.4.38-10.1-linux-ppc64le')
depends_on('cuda@10.1.0:11.0.2', when='@7.6.3.30-10.1-linux-x64')
depends_on('cuda@10.1.0:11.0.2', when='@7.6.3.30-10.1-linux-ppc64le')
depends_on('cuda@10.1.0:10.1.999', when='@7.5.0.56-10.1-linux-x64')
depends_on('cuda@10.1.0:10.1.999', when='@7.5.0.56-10.1-linux-ppc64le')
# CUDA 10.0
depends_on('cuda@10.0.0:11.0.2', when='@7.6.5.32-10.0-osx-x64')
depends_on('cuda@10.0.0:11.0.2', when='@7.6.5.32-10.0-linux-x64')
depends_on('cuda@10.0.0:11.0.2', when='@7.6.5.32-10.0-linux-ppc64le')
depends_on('cuda@10.0.0:11.0.2', when='@7.6.4.38-10.0-osx-x64')
depends_on('cuda@10.0.0:11.0.2', when='@7.6.4.38-10.0-linux-x64')
depends_on('cuda@10.0.0:11.0.2', when='@7.6.4.38-10.0-linux-ppc64le')
depends_on('cuda@10.0.0:11.0.2', when='@7.5.1.10-10.0-linux-x64')
depends_on('cuda@10.0.0:11.0.2', when='@7.5.1.10-10.0-linux-ppc64le')
depends_on('cuda@10.0.0:11.0.2', when='@7.5.0.56-10.0-linux-x64')
depends_on('cuda@10.0.0:11.0.2', when='@7.5.0.56-10.0-linux-ppc64le')
# CUDA 9.2
depends_on('cuda@9.2.0:9.2.999', when='@7.6.5.32-9.2-linux-x64')
depends_on('cuda@9.2.0:9.2.999', when='@7.6.5.32-9.2-linux-ppc64le')
depends_on('cuda@9.2.0:9.2.999', when='@7.6.4.38-9.2-linux-x64')
depends_on('cuda@9.2.0:9.2.999', when='@7.6.4.38-9.2-linux-ppc64le')
# CUDA 9.1
depends_on('cuda@9.1.0:9.1.999', when='@7.1.3-9.1-linux-x64')
depends_on('cuda@9.1.0:9.1.999', when='@7.1.3-9.1-linux-ppc64le')
# CUDA 9.0
depends_on('cuda@9.0.0:9.0.999', when='@7.6.5.32-9.0-linux-x64')
depends_on('cuda@9.0.0:9.0.999', when='@7.6.4.38-9.0-linux-x64')
depends_on('cuda@9.0.0:9.0.999', when='@7.3.0.29-9.0-linux-x64')
depends_on('cuda@9.0.0:9.0.999', when='@7.2.1.38-9.0-linux-x64')
# CUDA 8.0
depends_on('cuda@8.0.0:8.0.999', when='@6.0-8.0-linux-x64')
depends_on('cuda@8.0.0:8.0.999', when='@5.1-8.0-linux-x64')
def url_for_version(self, version):
url = 'https://developer.download.nvidia.com/compute/redist/cudnn/v{0}/cudnn-{1}-v{2}.tgz'
if version >= Version('7.2'):
directory = version[:3]
ver = version[:4]
cuda = version[4:]
elif version >= Version('7.1'):
directory = version[:3]
ver = version[:2]
cuda = version[3:]
elif version >= Version('7.0'):
directory = version[:3]
ver = version[0]
cuda = version[3:]
else:
directory = version[:2]
ver = version[:2]
cuda = version[2:]
return url.format(directory, cuda, ver)
def setup_run_environment(self, env):
if 'target=ppc64le: platform=linux' in self.spec:
env.set('cuDNN_ROOT', os.path.join(
self.prefix, 'targets', 'ppc64le-linux'))
def install(self, spec, prefix):
install_tree('.', prefix)
if 'target=ppc64le: platform=linux' in spec:
symlink(os.path.join(prefix, 'targets', 'ppc64le-linux', 'lib'),
prefix.lib)
symlink(
os.path.join(prefix, 'targets', 'ppc64le-linux', 'include'),
prefix.include)
| 45.304721 | 98 | 0.670519 | 1,399 | 10,556 | 5.030021 | 0.130093 | 0.013074 | 0.060963 | 0.014921 | 0.433992 | 0.372318 | 0.353276 | 0.341623 | 0.193264 | 0.179054 | 0 | 0.35424 | 0.167772 | 10,556 | 232 | 99 | 45.5 | 0.446784 | 0.070576 | 0 | 0.04321 | 0 | 0.006173 | 0.585081 | 0.484293 | 0 | 0 | 0 | 0 | 0 | 1 | 0.018519 | false | 0 | 0.012346 | 0 | 0.055556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
48946d309358ecb51872d9f0d80dff7d64dcb48a | 872 | py | Python | setup.py | MrJakeSir/theming | fd572c871fb4fd67cc4f9517558570d652ad1f0c | [
"MIT"
] | 3 | 2021-10-02T02:23:50.000Z | 2021-10-02T16:03:33.000Z | setup.py | MrJakeSir/themify | fd572c871fb4fd67cc4f9517558570d652ad1f0c | [
"MIT"
] | null | null | null | setup.py | MrJakeSir/themify | fd572c871fb4fd67cc4f9517558570d652ad1f0c | [
"MIT"
] | null | null | null | from distutils.core import setup
setup(
name = 'colormate',
packages = ['colormate'],
version = '0.2214',
license='MIT',
description = 'A package to theme terminal scripts with custom colors and text formatting',
author = 'Rodrigo',
author_email = 'roarba011@gmail.com',
url = 'https://github.com/mrjakesir/themify',
download_url = 'https://github.com/MrJakeSir/themify/archive/refs/tags/v_0.3.1.tar.gz',
keywords = ['Colors', 'Scripting', 'Theme', 'Theming'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
)
| 36.333333 | 93 | 0.661697 | 101 | 872 | 5.683168 | 0.70297 | 0.132404 | 0.174216 | 0.181185 | 0.114983 | 0.114983 | 0 | 0 | 0 | 0 | 0 | 0.027855 | 0.176606 | 872 | 23 | 94 | 37.913043 | 0.771588 | 0 | 0 | 0 | 0 | 0.043478 | 0.645642 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.043478 | 0 | 0.043478 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4897778aee005c5aa1bda6eba1bb9679879bf2ca | 549 | py | Python | passgen-py/setup.py | hassanselim0/PassGen | 70e0187bfd58e0dc1fba5dbeea5b95769a599f60 | [
"MIT"
] | null | null | null | passgen-py/setup.py | hassanselim0/PassGen | 70e0187bfd58e0dc1fba5dbeea5b95769a599f60 | [
"MIT"
] | 1 | 2020-08-11T22:00:51.000Z | 2020-08-11T23:55:48.000Z | passgen-py/setup.py | hassanselim0/PassGen | 70e0187bfd58e0dc1fba5dbeea5b95769a599f60 | [
"MIT"
] | 1 | 2020-08-10T15:50:21.000Z | 2020-08-10T15:50:21.000Z | from setuptools import setup, find_packages
setup(
name='passgen-py',
packages=find_packages(),
version='1.1',
description='Generate Passwords Deterministically based on a Master Password.',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3'
],
python_requires='>=3.6, <4',
entry_points={
'console_scripts': [
'passgen=src:cli',
],
},
install_requires=['click', 'pyperclip'],
)
| 26.142857 | 83 | 0.599271 | 55 | 549 | 5.872727 | 0.8 | 0.074303 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017199 | 0.258652 | 549 | 20 | 84 | 27.45 | 0.776413 | 0 | 0 | 0.105263 | 1 | 0 | 0.42623 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.157895 | 0.052632 | 0 | 0.052632 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
48e3db6b6aba7110ea8f3e0d1c747e61649abf82 | 634 | py | Python | tests/test_admin.py | FernandoCelmer/django-global-permissions | 1ece2b18476a514dec7b1e13a51191943acb460b | [
"MIT"
] | 30 | 2015-02-04T12:26:35.000Z | 2022-03-23T21:19:10.000Z | tests/test_admin.py | FernandoCelmer/django-global-permissions | 1ece2b18476a514dec7b1e13a51191943acb460b | [
"MIT"
] | 15 | 2015-11-27T17:42:02.000Z | 2022-03-23T00:34:10.000Z | tests/test_admin.py | FernandoCelmer/django-global-permissions | 1ece2b18476a514dec7b1e13a51191943acb460b | [
"MIT"
] | 15 | 2015-04-14T18:09:26.000Z | 2022-03-22T11:42:04.000Z | from django.test import TestCase
from django.core.urlresolvers import reverse
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
class GlobalPermissionsAdminTest(TestCase):
def setUp(self):
User.objects.create_superuser(username='ham', password='spam', email='ham@spam.com')
self.client.login(username='ham', password='spam')
def test_admin_simply_works(self):
resp = self.client.get(reverse('admin:global_permissions_globalpermission_changelist'))
self.assertEqual(200, resp.status_code)
| 33.368421 | 95 | 0.749211 | 80 | 634 | 5.7875 | 0.5625 | 0.086393 | 0.073434 | 0.090713 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005556 | 0.148265 | 634 | 18 | 96 | 35.222222 | 0.851852 | 0 | 0 | 0 | 0 | 0 | 0.123028 | 0.082019 | 0 | 0 | 0 | 0 | 0.071429 | 1 | 0.142857 | false | 0.142857 | 0.357143 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
5b0240511c5c9c995140e0add95f3c10735d13f4 | 903 | py | Python | solutions/29-distinct-powers.py | whitegreyblack/euler | bd8e7ca444eeb51b3c923f1235906054c507ecc8 | [
"MIT"
] | null | null | null | solutions/29-distinct-powers.py | whitegreyblack/euler | bd8e7ca444eeb51b3c923f1235906054c507ecc8 | [
"MIT"
] | null | null | null | solutions/29-distinct-powers.py | whitegreyblack/euler | bd8e7ca444eeb51b3c923f1235906054c507ecc8 | [
"MIT"
] | null | null | null | # problem 29
# Distinct powers
"""
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2**2=4, 2**3=8, 2**4=16, 2**5=32
3**2=9, 3**3=27, 3**4=81, 3**5=243
4**2=16, 4**3=64, 4**4=256, 4**5=1024
5**2=25, 5**3=125, 5**4=625, 5**5=3125
If they are then placed in numerical order, with any repeats removed,
we get the following sequence of 15 distinct terms:
4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125
How many distinct terms are in the sequence generated by ab for
2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?
"""
# analysis
"""
^ | 2 | 3 | 4 | 5 | N |
---+---+---+---+----+---+
2 | 4 | 8 | 16| 25 |2^N|
---+---+---+---+----+---+
3 | 9 | 27| 81| 243|3^N|
---+---+---+---+----+---+
4 | 16| 64|256|1024|4^N|
---+---+---+---+----+---+
5 | 25|125|625|3125|5^N|
---+---+---+---+----+---+
"""
# solution
s = set(a**b for a in range(2, 101) for b in range(2, 101))
print(len(s))
| 25.083333 | 70 | 0.499446 | 183 | 903 | 2.508197 | 0.360656 | 0.017429 | 0.026144 | 0.030501 | 0.069717 | 0.039216 | 0 | 0 | 0 | 0 | 0 | 0.242798 | 0.192691 | 903 | 35 | 71 | 25.8 | 0.375857 | 0.601329 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
5b042f6383e41d397423d2d9b9c278a9f5788a29 | 325 | py | Python | Lotus/controller/common.py | Jayin/Lotus | 6a4791d81b29158a1a83aa6a5d607ab5d677dba4 | [
"Apache-2.0"
] | null | null | null | Lotus/controller/common.py | Jayin/Lotus | 6a4791d81b29158a1a83aa6a5d607ab5d677dba4 | [
"Apache-2.0"
] | null | null | null | Lotus/controller/common.py | Jayin/Lotus | 6a4791d81b29158a1a83aa6a5d607ab5d677dba4 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from Lotus.app import app
from flask import render_template
@app.route('/')
def index():
return 'welcome'
@app.errorhandler(404)
def page_not_found(error):
return render_template('404.html')
@app.errorhandler(405)
def request_method_error(error):
return render_template('405.html')
| 16.25 | 38 | 0.713846 | 45 | 325 | 5 | 0.555556 | 0.186667 | 0.151111 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046763 | 0.144615 | 325 | 19 | 39 | 17.105263 | 0.76259 | 0.064615 | 0 | 0 | 0 | 0 | 0.079734 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.181818 | 0.272727 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
5b11b42643e2e5c40307befa37ef00c0f90f66bd | 121 | py | Python | trackMe-backend/src/config.py | matth3wliuu/trackMe | 0fb22bb8adf147fb4d4ed09c5c7253d0e54bf992 | [
"MIT"
] | 1 | 2022-01-28T06:20:03.000Z | 2022-01-28T06:20:03.000Z | trackMe-backend/src/config.py | matth3wliuu/trackMe | 0fb22bb8adf147fb4d4ed09c5c7253d0e54bf992 | [
"MIT"
] | null | null | null | trackMe-backend/src/config.py | matth3wliuu/trackMe | 0fb22bb8adf147fb4d4ed09c5c7253d0e54bf992 | [
"MIT"
] | null | null | null | dbConfig = {
"user": "root",
"password": "123567l098",
"host": "localhost",
"database": "trackMe_dev"
} | 20.166667 | 29 | 0.545455 | 10 | 121 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097826 | 0.239669 | 121 | 6 | 30 | 20.166667 | 0.608696 | 0 | 0 | 0 | 0 | 0 | 0.47541 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 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 |
5b1cda3e00260587ee1daafde0d87ed8f1313a59 | 310 | py | Python | src/nia/selections/rank.py | salar-shdk/nia | bb0f1b941240b627291dd8212b8840cbe77b0398 | [
"MIT"
] | 8 | 2021-09-06T07:20:23.000Z | 2022-02-23T23:18:22.000Z | src/nia/selections/rank.py | salar-shdk/nia | bb0f1b941240b627291dd8212b8840cbe77b0398 | [
"MIT"
] | null | null | null | src/nia/selections/rank.py | salar-shdk/nia | bb0f1b941240b627291dd8212b8840cbe77b0398 | [
"MIT"
] | null | null | null | from .selection import Selection
import numpy as np
class Rank(Selection):
@Selection.initializer
def __init__(self, size=20):
pass
def select(self, population, fitness):
indexes = fitness.argsort()
return (population[indexes])[:self.size], (fitness[indexes])[:self.size]
| 25.833333 | 80 | 0.677419 | 36 | 310 | 5.722222 | 0.583333 | 0.116505 | 0.145631 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008097 | 0.203226 | 310 | 11 | 81 | 28.181818 | 0.825911 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.111111 | 0.222222 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
d2945eb56ca24287c1bd0834d603839aee1fedac | 2,094 | py | Python | platform/web/api/device/models.py | JMSHDev/regent.dev | e4cedf04dd241ad00012735b543ee3447a8da8a2 | [
"Apache-2.0"
] | 1 | 2021-12-23T14:06:08.000Z | 2021-12-23T14:06:08.000Z | platform/web/api/device/models.py | JMSHDev/regent.dev | e4cedf04dd241ad00012735b543ee3447a8da8a2 | [
"Apache-2.0"
] | null | null | null | platform/web/api/device/models.py | JMSHDev/regent.dev | e4cedf04dd241ad00012735b543ee3447a8da8a2 | [
"Apache-2.0"
] | 1 | 2021-06-28T22:17:28.000Z | 2021-06-28T22:17:28.000Z | import hashlib
import random
import string
import logging
from django.db import models
LOG = logging.getLogger(__name__)
class Device(models.Model):
name = models.CharField(max_length=50, unique=True)
customer = models.CharField(max_length=50)
agent_status = models.CharField(max_length=10, default="offline")
program_status = models.CharField(max_length=10, default="down")
last_updated = models.DateTimeField(auto_now=True)
def delete_mqtt_credentials(self):
self.auth.all().delete()
self.acl.all().delete()
class MqttAuth(models.Model):
username = models.CharField(max_length=100, unique=True)
password = models.CharField(max_length=100)
salt = models.CharField(max_length=10)
activated = models.BooleanField(default=False)
device = models.ForeignKey(
Device, on_delete=models.CASCADE, related_name="auth", related_query_name="auth", null=True
)
def __str__(self):
return "activated" if self.activated else "not activated"
@classmethod
def create(cls, username, password, activated, device=None):
salt = "".join(random.choice(string.ascii_letters) for _ in range(10))
password = hashlib.sha256((password + salt).encode("utf-8")).hexdigest()
return MqttAuth(username=username, password=password, salt=salt, activated=activated, device=device)
class MqttAcl(models.Model):
allow = models.SmallIntegerField()
ipaddr = models.CharField(max_length=60, null=True)
username = models.CharField(max_length=100, null=True)
clientid = models.CharField(max_length=100, null=True)
access = models.SmallIntegerField()
topic = models.CharField(max_length=100)
device = models.ForeignKey(
Device, on_delete=models.CASCADE, related_name="acl", related_query_name="acl", null=True
)
class Telemetry(models.Model):
device = models.ForeignKey(
Device, on_delete=models.CASCADE, related_name="telemetry", related_query_name="telemetry"
)
created_on = models.DateTimeField(auto_now_add=True)
state = models.JSONField()
| 34.327869 | 108 | 0.722063 | 258 | 2,094 | 5.697674 | 0.348837 | 0.112245 | 0.134694 | 0.179592 | 0.342177 | 0.252381 | 0.223129 | 0.122449 | 0.122449 | 0.122449 | 0 | 0.018803 | 0.161891 | 2,094 | 60 | 109 | 34.9 | 0.818803 | 0 | 0 | 0.065217 | 0 | 0 | 0.033429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.065217 | false | 0.086957 | 0.108696 | 0.021739 | 0.73913 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
d2b08ef7b1d20d9d85caa8e8727b92065aef39a2 | 1,023 | py | Python | day5.py | zsmoore/Advent-Of-Code-2017 | 895a7fbaa8b8b82a338dac967bccbf97b2092b20 | [
"MIT"
] | null | null | null | day5.py | zsmoore/Advent-Of-Code-2017 | 895a7fbaa8b8b82a338dac967bccbf97b2092b20 | [
"MIT"
] | null | null | null | day5.py | zsmoore/Advent-Of-Code-2017 | 895a7fbaa8b8b82a338dac967bccbf97b2092b20 | [
"MIT"
] | null | null | null | import sys
import copy
def main():
in_file = open(sys.argv[1], 'r')
jumps = []
for line in in_file.readlines():
jumps.append(int(line.strip()))
#print(compute_exit(jumps))
print(compute_exit2(jumps))
def compute_exit(jump_list):
current_ind = 0
step_num = 0
while True:
if current_ind < 0 or current_ind >= len(jump_list):
return step_num
step = jump_list[current_ind]
jump_list[current_ind] += 1
current_ind += step
step_num += 1
def compute_exit2(jump_list):
current_ind = 0
step_num = 0
while True:
if current_ind < 0 or current_ind >= len(jump_list):
return step_num
step = jump_list[current_ind]
if step >= 3:
jump_list[current_ind] -= 1
elif step <= -3:
jump_list[current_ind] += 1
else:
jump_list[current_ind] += 1
current_ind += step
step_num += 1
if __name__ == "__main__":
main()
| 22.23913 | 60 | 0.567937 | 138 | 1,023 | 3.891304 | 0.282609 | 0.260708 | 0.223464 | 0.268156 | 0.640596 | 0.640596 | 0.640596 | 0.55121 | 0.55121 | 0.55121 | 0 | 0.024781 | 0.329423 | 1,023 | 45 | 61 | 22.733333 | 0.758017 | 0.025415 | 0 | 0.542857 | 0 | 0 | 0.009036 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.085714 | false | 0 | 0.057143 | 0 | 0.2 | 0.028571 | 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 |
d2c77644e40785600cc8b3b66d9450e3d85ddf12 | 67 | py | Python | lang/Python/random-numbers-1.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | lang/Python/random-numbers-1.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | lang/Python/random-numbers-1.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | import random
values = [random.gauss(1, .5) for i in range(1000)]
| 16.75 | 51 | 0.686567 | 12 | 67 | 3.833333 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 0.164179 | 67 | 3 | 52 | 22.333333 | 0.714286 | 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 |
d2e4753ddf7c063ce13b4c81cfba0d2c46394e4c | 504 | py | Python | frappe/email/doctype/email_queue_recipient/email_queue_recipient.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | frappe/email/doctype/email_queue_recipient/email_queue_recipient.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | frappe/email/doctype/email_queue_recipient/email_queue_recipient.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# License: MIT. See LICENSE
import frappe
from frappe.model.document import Document
class EmailQueueRecipient(Document):
DOCTYPE = "Email Queue Recipient"
def is_mail_to_be_sent(self):
return self.status == "Not Sent"
def is_main_sent(self):
return self.status == "Sent"
def update_db(self, commit=False, **kwargs):
frappe.db.set_value(self.DOCTYPE, self.name, kwargs)
if commit:
frappe.db.commit()
| 22.909091 | 58 | 0.730159 | 71 | 504 | 5.070423 | 0.605634 | 0.027778 | 0.077778 | 0.1 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011655 | 0.14881 | 504 | 21 | 59 | 24 | 0.827506 | 0.206349 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.166667 | 0.166667 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
d2f040bef7df7c165fa2e1f80723815e7bebcf83 | 11,453 | py | Python | tests/test_assertion_method.py | katakumpo/nicepy | fa2b0bae8e4b66d92e756687ded58d355c444eca | [
"MIT"
] | null | null | null | tests/test_assertion_method.py | katakumpo/nicepy | fa2b0bae8e4b66d92e756687ded58d355c444eca | [
"MIT"
] | null | null | null | tests/test_assertion_method.py | katakumpo/nicepy | fa2b0bae8e4b66d92e756687ded58d355c444eca | [
"MIT"
] | null | null | null | # -*- coding: utf-8 *-*
import logging
from unittest import TestCase
from nicepy import assert_equal_struct, multi_assert_equal_struct, pretty_repr, permuteflat
log = logging.getLogger(__name__)
class Foo(object):
def __init__(self, **kwargs):
for k, v in kwargs.iteritems():
self[k] = v
def __setitem__(self, name, value):
# helper to add attributes per self[attr] = value -> self.attr == value
setattr(self, name, value)
def __repr__(self):
return pretty_repr(self, ignore_own_repr=True)
class TestAssertEqualStruct(TestCase):
def run_assert(self, args, expected_msg=None):
log.debug('args: %s' % str(args))
msg = None
try:
assert_equal_struct(*args)
except AssertionError as e:
msg = e.message
log.debug('msg: %s' % msg)
self.assertEqual(msg, expected_msg)
def check(self, actual_classes=(list,),
expected_classes=(list,),
expected_obj=None, expected_kwargs={},
working_obj=None, working_kwargs={},
failing_obj=None, failing_kwargs={},
failure_msg=None,
namepaths=None,
expected_namepaths=None):
for actual_cls, expected_cls in permuteflat(actual_classes, expected_classes):
expected_obj = expected_obj or expected_cls(**expected_kwargs)
working_obj = working_obj or actual_cls(**working_kwargs)
self.run_assert((working_obj, expected_obj, namepaths, expected_namepaths))
failing_obj = failing_obj or actual_cls(**failing_kwargs)
self.run_assert((failing_obj, expected_obj, namepaths, expected_namepaths),
failure_msg)
def test_directly(self):
"""
*assert_equal_struct* can compare similar flat structures directly.
"""
self.check(actual_classes=(dict, Foo),
expected_classes=(dict, Foo),
expected_kwargs=dict(x=1),
working_kwargs=dict(x=1, y=2),
failing_kwargs=dict(x=3, y=2),
failure_msg='actual values != expected values:\n\tx: 3 != 1')
self.check(expected_obj=[1],
working_obj=[1, 2],
failing_obj=[3, 2],
failure_msg='actual values != expected values:\n\t0: 3 != 1')
def test_with_namepaths(self):
"""
With namepaths *assert_equal_struct* can compare similar structures and structures with
lists of values in full depth.
This ignores all additional paths at the expected object.
"""
self.check(actual_classes=(dict, Foo),
expected_classes=(dict, Foo),
expected_kwargs=dict(x=1, y=4),
namepaths=['x'],
working_kwargs=dict(x=1, y=2),
failing_kwargs=dict(x=3, y=2),
failure_msg='actual values != expected values:\n\tx: 3 != 1')
self.check(actual_classes=(dict, Foo),
expected_obj=[1, 4],
namepaths=['x'],
working_kwargs=dict(x=1, y=2),
failing_kwargs=dict(x=3, y=2),
failure_msg='actual values != expected values:\n\tx: 3 != 1')
self.check(expected_obj=[1, 4],
namepaths=['0'],
working_obj=[1, 2],
failing_obj=[3, 2],
failure_msg='actual values != expected values:\n\t0: 3 != 1')
def test_with_namepaths_and_expected_namepaths(self):
"""
Like just with namepaths, the values are sometimes at other paths at the expected object and
will be compared using expected_namepaths in same order as namepaths.
"""
self.check(actual_classes=(dict, Foo),
expected_classes=(dict, Foo),
expected_kwargs=dict(a=1, b=4),
namepaths=['x'],
expected_namepaths=['a'],
working_kwargs=dict(x=1, y=2),
failing_kwargs=dict(x=3, y=2),
failure_msg='actual values != expected values:\n\tx != a: 3 != 1')
self.check(actual_classes=(dict, Foo),
expected_obj=[4, 1],
namepaths=['x'],
expected_namepaths=['1'],
working_kwargs=dict(x=1, y=2),
failing_kwargs=dict(x=3, y=2),
failure_msg='actual values != expected values:\n\tx != 1: 3 != 1')
self.check(expected_obj=[4, 1],
namepaths=['0'],
expected_namepaths=['1'],
working_obj=[1, 2],
failing_obj=[3, 2],
failure_msg='actual values != expected values:\n\t0 != 1: 3 != 1')
class TestMultiAssertEqualStruct(TestCase):
def run_assert(self, args, expected_msg=None):
log.debug('args: %s' % str(args))
msg = None
try:
multi_assert_equal_struct(*args)
except AssertionError as e:
msg = e.message
log.debug('msg: %s' % msg)
self.assertEqual(msg, expected_msg)
def check(self, actual_classes=(list,),
expected_classes=(list,),
expected_objs=None, expected_kwargs_list=[],
working_objs=None, working_kwargs_list=[],
failing_objs=None, failing_kwargs_list=[],
failure_msg=None,
namepaths=None,
expected_namepaths=None):
for actual_cls1, actual_cls2, expected_cls1, expected_cls2 in \
permuteflat(*([actual_classes] * 2 + [expected_classes] * 2)):
if not expected_objs:
expected_objs = (expected_cls1(**expected_kwargs_list[0]),
expected_cls2(**expected_kwargs_list[1]))
if not working_objs:
working_objs = (actual_cls1(**working_kwargs_list[0]),
actual_cls2(**working_kwargs_list[1]))
self.run_assert((working_objs, expected_objs, namepaths, expected_namepaths))
if not failing_objs:
failing_objs = (actual_cls1(**failing_kwargs_list[0]),
actual_cls2(**failing_kwargs_list[1]))
self.run_assert((failing_objs, expected_objs, namepaths, expected_namepaths),
failure_msg)
def test_directly(self):
"""
*multi_assert_equal_struct* can compare multiple similar flat structures directly.
"""
self.check(actual_classes=(dict, Foo),
expected_classes=(dict, Foo),
expected_kwargs_list=[dict(x=1), dict(x=2, y=3)],
working_kwargs_list=[dict(x=1, y=0), dict(x=2, y=3)],
failing_kwargs_list=[dict(x=4, y=0), dict(x=2, y=5)],
failure_msg='Multi-assert failed:\n' \
'Index 0: actual values != expected values:\n\tx: 4 != 1\n'\
'Index 1: actual values != expected values:\n\ty: 5 != 3')
self.check(expected_objs=[[1], [2, 3]],
working_objs=[[1, 0], [2, 3]],
failing_objs=[[4, 0], [2, 5]],
failure_msg='Multi-assert failed:\n' \
'Index 0: actual values != expected values:\n\t0: 4 != 1\n'\
'Index 1: actual values != expected values:\n\t1: 5 != 3')
def test_with_namepaths(self):
"""
With namepaths *multi_assert_equal_struct* can compare multiple similar structures and
structures with lists of values in full depth.
This ignores all additional paths at the expected objects.
"""
self.check(actual_classes=(dict, Foo),
expected_classes=(dict, Foo),
expected_kwargs_list=[dict(x=1), dict(x=2, y=3)],
working_kwargs_list=[dict(x=1, y=0), dict(x=2)],
failing_kwargs_list=[dict(x=4, y=0), dict(x=5)],
namepaths=['x'],
failure_msg='Multi-assert failed:\n' \
'Index 0: actual values != expected values:\n\tx: 4 != 1\n'\
'Index 1: actual values != expected values:\n\tx: 5 != 2')
self.check(actual_classes=(dict, Foo),
expected_objs=[[1], [2, 0]],
working_kwargs_list=[dict(x=1, y=5), dict(x=2)],
failing_kwargs_list=[dict(x=3, y=5), dict(x=4)],
namepaths=['x'],
failure_msg='Multi-assert failed:\n' \
'Index 0: actual values != expected values:\n\tx: 3 != 1\n'\
'Index 1: actual values != expected values:\n\tx: 4 != 2')
self.check(expected_objs=[[1], [2, 3]],
working_objs=[[1, 0], [2, 0]],
failing_objs=[[4, 0], [5, 0]],
namepaths=['0'],
failure_msg='Multi-assert failed:\n' \
'Index 0: actual values != expected values:\n\t0: 4 != 1\n'\
'Index 1: actual values != expected values:\n\t0: 5 != 2')
def test_with_namepaths_and_expected_namepaths(self):
"""
Like just with namepaths, the values are sometimes at other paths at the expected object and
will be compared using expected_namepaths in same order as namepaths.
"""
self.check(actual_classes=(dict, Foo),
expected_classes=(dict, Foo),
expected_kwargs_list=[dict(y=1), dict(y=2, x=3)],
working_kwargs_list=[dict(x=1, y=0), dict(x=2)],
failing_kwargs_list=[dict(x=4, y=0), dict(x=5)],
namepaths=['x'],
expected_namepaths=['y'],
failure_msg='Multi-assert failed:\n' \
'Index 0: actual values != expected values:\n\tx != y: 4 != 1\n'\
'Index 1: actual values != expected values:\n\tx != y: 5 != 2')
self.check(actual_classes=(dict, Foo),
expected_objs=[[0, 1], [0, 2]],
working_kwargs_list=[dict(x=1, y=5), dict(x=2)],
failing_kwargs_list=[dict(x=3, y=5), dict(x=4)],
namepaths=['x'],
expected_namepaths=['1'],
failure_msg='Multi-assert failed:\n' \
'Index 0: actual values != expected values:\n\tx != 1: 3 != 1\n'\
'Index 1: actual values != expected values:\n\tx != 1: 4 != 2')
self.check(expected_objs=[[1, 2], [3, 4]],
working_objs=[[2, 1], [4, 3]],
failing_objs=[[2, 5], [6, 3]],
namepaths=['0', '1'],
expected_namepaths=['1', '0'],
failure_msg='Multi-assert failed:\n' \
'Index 0: actual values != expected values:\n\t1 != 0: 5 != 1\n'\
'Index 1: actual values != expected values:\n\t0 != 1: 6 != 4')
| 42.895131 | 100 | 0.516546 | 1,327 | 11,453 | 4.269781 | 0.097965 | 0.031768 | 0.084716 | 0.110131 | 0.77515 | 0.749206 | 0.706671 | 0.696258 | 0.682139 | 0.657077 | 0 | 0.032109 | 0.358247 | 11,453 | 266 | 101 | 43.056391 | 0.738776 | 0.082162 | 0 | 0.57672 | 0 | 0 | 0.148769 | 0 | 0 | 0 | 0 | 0 | 0.121693 | 1 | 0.068783 | false | 0 | 0.015873 | 0.005291 | 0.10582 | 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 |
d2fd24c8d34e5c25a5210eb1ab2a18308730ef2b | 2,778 | py | Python | angr/codenode.py | mariusmue/angr | f8304c4b1f0097a721a6692b02a45cabaae137c5 | [
"BSD-2-Clause"
] | 2 | 2018-05-02T17:41:36.000Z | 2020-05-18T02:49:16.000Z | angr/codenode.py | mariusmue/angr | f8304c4b1f0097a721a6692b02a45cabaae137c5 | [
"BSD-2-Clause"
] | null | null | null | angr/codenode.py | mariusmue/angr | f8304c4b1f0097a721a6692b02a45cabaae137c5 | [
"BSD-2-Clause"
] | 1 | 2019-08-07T01:42:01.000Z | 2019-08-07T01:42:01.000Z | import logging
l = logging.getLogger("angr.codenode")
class CodeNode(object):
__slots__ = ['addr', 'size', '_graph', 'thumb']
def __init__(self, addr, size, graph=None, thumb=False):
self.addr = addr
self.size = size
self.thumb = thumb
self._graph = graph
def __len__(self):
return self.size
def __eq__(self, other):
if type(other) is Block: # pylint: disable=unidiomatic-typecheck
raise TypeError("You do not want to be comparing a CodeNode to a Block")
return type(self) is type(other) and \
self.addr == other.addr and \
self.size == other.size and \
self.is_hook == other.is_hook and \
self.thumb == other.thumb
def __ne__(self, other):
return not self == other
def __cmp__(self, other):
raise TypeError("Comparison with a code node")
def __hash__(self):
return hash((self.addr, self.size))
def successors(self):
if self._graph is None:
raise ValueError("Cannot calculate successors for graphless node")
return list(self._graph.successors(self))
def predecessors(self):
if self._graph is None:
raise ValueError("Cannot calculate predecessors for graphless node")
return list(self._graph.predecessors(self))
def __getstate__(self):
return (self.addr, self.size)
def __setstate__(self, dat):
self.__init__(*dat)
is_hook = None
class BlockNode(CodeNode):
__slots__ = ['bytestr']
is_hook = False
def __init__(self, addr, size, bytestr=None, **kwargs):
super(BlockNode, self).__init__(addr, size, **kwargs)
self.bytestr = bytestr
def __repr__(self):
return '<BlockNode at %#x (size %d)>' % (self.addr, self.size)
def __getstate__(self):
return (self.addr, self.size, self.bytestr, self.thumb)
def __setstate__(self, dat):
self.__init__(*dat[:-1], thumb=dat[-1])
class HookNode(CodeNode):
__slots__ = ['sim_procedure']
is_hook = True
def __init__(self, addr, size, sim_procedure, **kwargs):
super(HookNode, self).__init__(addr, size, **kwargs)
self.sim_procedure = sim_procedure
def __repr__(self):
return '<HookNode %r at %#x (size %s)>' % (self.sim_procedure, self.addr, self.size)
def __hash__(self):
return hash((self.addr, self.size, self.sim_procedure))
def __eq__(self, other):
return super(HookNode, self).__eq__(other) and \
self.sim_procedure == other.sim_procedure
def __getstate__(self):
return (self.addr, self.size, self.sim_procedure)
def __setstate__(self, dat):
self.__init__(*dat)
from .block import Block
| 27.78 | 92 | 0.62527 | 346 | 2,778 | 4.650289 | 0.219653 | 0.059664 | 0.059664 | 0.069608 | 0.389683 | 0.332505 | 0.300186 | 0.204475 | 0.160348 | 0.063393 | 0 | 0.000968 | 0.25594 | 2,778 | 99 | 93 | 28.060606 | 0.777455 | 0.013319 | 0 | 0.235294 | 0 | 0 | 0.103687 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0 | 0.029412 | 0.147059 | 0.647059 | 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 |
d2fdf4a6c5371384e165ae59f3bd959f997c90d9 | 511 | py | Python | unittest_example/mathfunc.py | RobinCPC/experiment_code | 0d3791a97815651945ad7787ba4e6c7df037740b | [
"MIT"
] | null | null | null | unittest_example/mathfunc.py | RobinCPC/experiment_code | 0d3791a97815651945ad7787ba4e6c7df037740b | [
"MIT"
] | null | null | null | unittest_example/mathfunc.py | RobinCPC/experiment_code | 0d3791a97815651945ad7787ba4e6c7df037740b | [
"MIT"
] | null | null | null | """
Simple math operating functions for unit test
"""
def add(a, b):
"""
Adding to parameters and return result
:param a:
:param b:
:return:
"""
return a + b
def minus(a, b):
"""
subtraction
:param a:
:param b:
:return:
"""
return a - b
def multi(a, b):
"""
multiple
:param a:
:param b:
:return:
"""
return a * b
def divide(a, b):
"""
division
:param a:
:param b:
:return:
"""
return a // b
| 11.613636 | 45 | 0.473581 | 64 | 511 | 3.78125 | 0.375 | 0.066116 | 0.181818 | 0.198347 | 0.466942 | 0.466942 | 0.466942 | 0.466942 | 0.359504 | 0 | 0 | 0 | 0.379648 | 511 | 43 | 46 | 11.883721 | 0.763407 | 0.450098 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
96021a52c512a37d56b88bb769ca1d2cad4e3a5c | 490 | py | Python | app/database/db.py | flych3r/spotify-tracker | 306d549da6a57866ea480c85286d870e7653a1eb | [
"MIT"
] | 2 | 2021-06-25T00:24:13.000Z | 2021-07-10T13:00:39.000Z | app/database/db.py | flych3r/spotify-tracker | 306d549da6a57866ea480c85286d870e7653a1eb | [
"MIT"
] | null | null | null | app/database/db.py | flych3r/spotify-tracker | 306d549da6a57866ea480c85286d870e7653a1eb | [
"MIT"
] | 2 | 2021-05-16T01:40:39.000Z | 2021-07-10T12:59:07.000Z | import os
import databases
import sqlalchemy
DB_CONNECTOR = os.getenv('APP_DB_CONNECTOR')
DB_USERNAME = os.getenv('APP_DB_USERNAME')
DB_PASSWORD = os.getenv('APP_DB_PASSWORD')
DB_HOST = os.getenv('APP_DB_HOST')
DB_PORT = os.getenv('APP_DB_PORT')
DB_DATABASE = os.getenv('APP_DB_DATABASE')
DB_URL = f'{DB_CONNECTOR}://{DB_USERNAME}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_DATABASE}'
db: databases.Database = databases.Database(DB_URL)
metadata: sqlalchemy.MetaData = sqlalchemy.MetaData()
| 28.823529 | 90 | 0.777551 | 75 | 490 | 4.733333 | 0.213333 | 0.135211 | 0.185915 | 0.219718 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.079592 | 490 | 16 | 91 | 30.625 | 0.78714 | 0 | 0 | 0 | 0 | 0 | 0.328571 | 0.159184 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0.25 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
9610eaf838ce8599d05cfd89f28acb8943b4bb46 | 191 | py | Python | github/models.py | pyprism/Hiren-Git-Commit-Reminder | 253ba078f63cc9bf3f39a5b735a783c4846b5ba7 | [
"MIT"
] | null | null | null | github/models.py | pyprism/Hiren-Git-Commit-Reminder | 253ba078f63cc9bf3f39a5b735a783c4846b5ba7 | [
"MIT"
] | null | null | null | github/models.py | pyprism/Hiren-Git-Commit-Reminder | 253ba078f63cc9bf3f39a5b735a783c4846b5ba7 | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
class Hiren(models.Model):
access_token = models.CharField(max_length=200)
authorized = models.BooleanField(default=False)
| 19.1 | 51 | 0.759162 | 25 | 191 | 5.72 | 0.84 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018519 | 0.151832 | 191 | 9 | 52 | 21.222222 | 0.864198 | 0.125654 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
824f686fbf01dfe1ee2beac723ed207ab4daf6b1 | 1,741 | py | Python | src/sweetrpg_library_api/application/config.py | paulyhedral/sweetrpg-library-api | 0105e963ef4321398aa66d7cb3aa9c2df1c4f375 | [
"MIT"
] | null | null | null | src/sweetrpg_library_api/application/config.py | paulyhedral/sweetrpg-library-api | 0105e963ef4321398aa66d7cb3aa9c2df1c4f375 | [
"MIT"
] | 33 | 2021-09-18T23:52:05.000Z | 2022-03-30T12:25:49.000Z | src/sweetrpg_library_api/application/config.py | sweetrpg/library-api | 0105e963ef4321398aa66d7cb3aa9c2df1c4f375 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
__author__ = "Paul Schifferer <dm@sweetrpg.com>"
"""
config.py
- settings for the flask application object
"""
import os
import redis
from sweetrpg_library_api.application import constants
class BaseConfig(object):
DEBUG = bool(os.environ.get(constants.DEBUG) or True)
PORT = os.environ.get(constants.PORT) or 5000
# ASSETS_DEBUG = True
LOG_LEVEL = os.environ.get(constants.LOG_LEVEL) or "INFO"
DB_HOST = os.environ[constants.DB_HOST]
# DB_PORT = os.environ.get(constants.DB_PORT) or "27017"
DB_USERNAME = os.environ[constants.DB_USER]
DB_PASSWORD = os.environ[constants.DB_PW]
DB_NAME = os.environ[constants.DB_NAME]
DB_OPTS = os.environ.get(constants.DB_OPTS)
DB_URL = f"mongodb+srv://{DB_USERNAME}:{DB_PASSWORD}@{DB_HOST}/{DB_NAME}?{DB_OPTS}"
MONGODB_ALIAS_CONNECTION = "default"
MONGODB_URI = DB_URL
MONGODB_SETTINGS = {
"host": DB_URL,
"connect": False,
}
# used for encryption and session management
# SECRET_KEY = os.environ.get('SECRET_KEY') or hashlib.sha256(f"{random.random()}".encode('utf-8')).hexdigest()
# CSRF_TOKEN = os.environ.get('CSRF_TOKEN') or hashlib.sha256(f"{random.random()}".encode('utf-8')).hexdigest()
CACHE_REDIS_HOST = os.environ[constants.REDIS_HOST]
CACHE_REDIS_PORT = int(os.environ.get(constants.REDIS_PORT) or 6379)
# CACHE_REDIS_DB = int(os.environ.get(constants.REDIS_DB) or 7)
SESSION_TYPE = "redis"
SESSION_REDIS = redis.from_url(
f"redis://{os.environ[constants.REDIS_HOST]}:{int(os.environ.get(constants.REDIS_PORT) or 6379)}")
# SEGMENT_WRITE_KEY = os.environ.get(constants.SEGMENT_WRITE_KEY)
SERVER_NAME = os.environ.get(constants.SERVER_NAME)
| 38.688889 | 115 | 0.708788 | 251 | 1,741 | 4.689243 | 0.314741 | 0.137638 | 0.122345 | 0.17842 | 0.280374 | 0.170773 | 0.146134 | 0.146134 | 0.146134 | 0.079864 | 0 | 0.018305 | 0.152786 | 1,741 | 44 | 116 | 39.568182 | 0.779661 | 0.278576 | 0 | 0 | 0 | 0.038462 | 0.189713 | 0.130691 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0.115385 | 0 | 0.807692 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
825b17f2327978290f8d614819c14bd2efe19e58 | 661 | py | Python | data/models.py | sarfarazstark/To-Do-Bot | c2d032fa69e42b651d1c574c276161eceb141981 | [
"Apache-2.0"
] | 4 | 2020-11-21T14:49:00.000Z | 2022-02-21T11:24:17.000Z | data/models.py | sarfarazstark/To-Do-Bot | c2d032fa69e42b651d1c574c276161eceb141981 | [
"Apache-2.0"
] | null | null | null | data/models.py | sarfarazstark/To-Do-Bot | c2d032fa69e42b651d1c574c276161eceb141981 | [
"Apache-2.0"
] | null | null | null | """Database models"""
from sqlalchemy import orm
import sqlalchemy
from .db_session import SqlAlchemyBase
# Task database model
class Task(SqlAlchemyBase):
__tablename__ = 'tasks'
id = sqlalchemy.Column(
sqlalchemy.Integer, primary_key=True, autoincrement=True
)
user_id = sqlalchemy.Column(sqlalchemy.Integer)
title = sqlalchemy.Column(sqlalchemy.String)
days_of_the_week = sqlalchemy.Column(sqlalchemy.String)
# User database model
class User(SqlAlchemyBase):
__tablename__ = 'users'
telegram_id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
language_id = sqlalchemy.Column(sqlalchemy.Integer)
| 23.607143 | 73 | 0.753404 | 73 | 661 | 6.589041 | 0.424658 | 0.199584 | 0.324324 | 0.232848 | 0.349272 | 0.203742 | 0.203742 | 0.203742 | 0 | 0 | 0 | 0 | 0.160363 | 661 | 27 | 74 | 24.481481 | 0.866667 | 0.08472 | 0 | 0 | 0 | 0 | 0.016722 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.866667 | 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 |
8264bba891a9dc8d15b49f3c1fc314e278831022 | 3,282 | py | Python | GUITests/UC10.sikuli/UC10.py | gabrielganzer/EZGas | cc21dadb0001405e96a8fe298c2bbccf61d5d5a2 | [
"BSD-3-Clause"
] | null | null | null | GUITests/UC10.sikuli/UC10.py | gabrielganzer/EZGas | cc21dadb0001405e96a8fe298c2bbccf61d5d5a2 | [
"BSD-3-Clause"
] | null | null | null | GUITests/UC10.sikuli/UC10.py | gabrielganzer/EZGas | cc21dadb0001405e96a8fe298c2bbccf61d5d5a2 | [
"BSD-3-Clause"
] | 1 | 2021-04-06T14:31:08.000Z | 2021-04-06T14:31:08.000Z | # UC10 - Evaluate price
#
# User U exists and has valid account
# We create two Users, User1_UC10, User2_UC10 and one new gasStation GasStationUC10
#
# Registered on a 1920x1080p, Google Chrome 100% zoom
### SETUP
#User1
click("1590678880209.png")
click("1590678953637.png")
wait(2)
type("1590829373120.png", "User1_UC10" + Key.TAB + "user1uc10@polito.it" + Key.TAB + "user1")
click("1590679157604.png")
click("1590788841790.png")
wait(2)
# User2
click("1590678880209.png")
wait(2)
click("1590678953637.png")
wait(2)
type("1590829373120.png", "User2_UC10" + Key.TAB + "user2uc10@polito.it" + Key.TAB + "user2")
click("1590679157604.png")
click("1590788841790.png")
# Admin creates a new GasStation
click("1590678880209-1.png")
wait(3)
type("1590829943940.png", "admin@ezgas.com" + Key.TAB + "admin" )
click("1590784293656.png")
wait(2)
click("1590784369122.png")
wait(2)
wheel(WHEEL_DOWN, 6)
wait(2)
type("1590830169812.png", "GasStation_UC10" + Key.TAB + "Torino, corso duca")
wait( "add_UC10.png" , 20)
type(Key.DOWN + Key.ENTER)
type("1590830389386.png", Key.DOWN + Key.DOWN + Key.ENTER)
click("1590830256446.png")
click("1590830265272.png")
wait(2)
click("1590785166092.png")
wait(3)
type(Key.HOME)
click("1590788397797.png")
wait(2)
click("1590828906996.png")
wait(2)
click("1590788458524.png")
# User1 searches the gasStation
click("1590678880209.png")
wait(3)
type("1590829943940.png", "user1uc10@polito.it" + Key.TAB + "user1" )
click("1590784293656.png")
wait(2)
wheel(WHEEL_DOWN, 6)
type("1590931278631.png" , "Torino, corso duca" )
wait( "add_UC10.png" , 20)
type(Key.DOWN + Key.ENTER)
wait(2)
click("1590922172004.png")
wait(2)
wheel(WHEEL_DOWN, 4)
wait(2)
click(Pattern("1590922374562.png").targetOffset(543,-4))
wheel(WHEEL_DOWN, 4)
wait(2)
click(Pattern("1590930530512.png").targetOffset(73,1))
type("1.5")
click(Pattern("1590930568512.png").targetOffset(73,0))
type("1.4")
click("1590834482526.png")
wait(3)
type(Key.HOME)
wait(3)
click("1590788458524.png")
# User2 login and evaluate prices
wait(2)
click("1590678880209.png")
wait(3)
type("1590829943940.png", "user2uc10@polito.it" + Key.TAB + "user2" )
click("1590784293656.png")
wait(2)
wheel(WHEEL_DOWN, 4)
wait(2)
type("1590918242822-1.png" , "Torino, corso duca" )
wait( "add_UC10.png" , 20)
type(Key.DOWN + Key.ENTER)
wait(2)
click("1590918499196.png")
wheel(WHEEL_DOWN, 3)
click(Pattern("1591638408351.png").targetOffset(1068,-3))
# User2 clicks on the green button if the price is correct, otherwise clicks on the red button
# If User clicks the green button, the User1 trustlevel increases +1, otherwise it decreases -1
#
wait(3)
type(Key.HOME)
click("1590788458524.png")
wait(2)
# Admin deletes users and gasStation
click("1590678880209-1.png")
wait(3)
type("1590829943940.png", "admin@ezgas.com" + Key.TAB + "admin" )
click("1590784293656.png")
wait(2)
click("1590784369122.png")
wait(2)
wheel(WHEEL_DOWN, 10)
wait(2)
click(Pattern("1590931822851.png").targetOffset(905,-27))
wait(2)
wheel(WHEEL_UP, 15)
wait(2)
click(Pattern("1590931876805.png").targetOffset(560,-4))
wait(2)
click(Pattern("1590931914901.png").targetOffset(556,-10))
wait(2)
click("1590788397797.png")
wait(2)
click("1590828906996.png")
wait(2)
click("1590788458524.png")
wait(2)
| 23.442857 | 95 | 0.720902 | 479 | 3,282 | 4.906054 | 0.240084 | 0.06383 | 0.061277 | 0.044255 | 0.535745 | 0.517021 | 0.460426 | 0.40766 | 0.285957 | 0.262128 | 0 | 0.267894 | 0.106033 | 3,282 | 139 | 96 | 23.611511 | 0.533061 | 0.166667 | 0 | 0.754717 | 0 | 0 | 0.407817 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
82701369685666a9616bf5da9dc3d5c258f51242 | 196 | py | Python | src/caracara/_kits.py | LaudateCorpus1/caracara | 1200f56891617f15dd48616d7198c45a1e0cbe26 | [
"Unlicense"
] | 1 | 2021-12-28T05:12:33.000Z | 2021-12-28T05:12:33.000Z | src/caracara/_kits.py | CrowdStrike/caracara | 0cfc12447ee299f69e23a5d5210eab5fce8e033e | [
"Unlicense"
] | 1 | 2021-11-26T08:53:25.000Z | 2021-11-26T08:53:25.000Z | src/caracara/_kits.py | LaudateCorpus1/caracara | 1200f56891617f15dd48616d7198c45a1e0cbe26 | [
"Unlicense"
] | 2 | 2022-02-22T07:32:20.000Z | 2022-02-26T03:05:57.000Z | """Kits class defines the available Toolboxes."""
from enum import Enum
class Kits(Enum):
"""Enumerator for toolbox class name lookups."""
HOSTS = "HostsToolbox"
RTR = "RTRToolbox"
| 19.6 | 52 | 0.683673 | 23 | 196 | 5.826087 | 0.782609 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19898 | 196 | 9 | 53 | 21.777778 | 0.853503 | 0.438776 | 0 | 0 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
827aae5cfb257b722009084fcdc82d1efd26e382 | 35 | py | Python | src/test/data/pa3/sample/list_get_element_oob_3.py | Leo-Enrique-Wu/chocopy_compiler_code_generation | 4606be0531b3de77411572aae98f73169f46b3b9 | [
"BSD-2-Clause"
] | 7 | 2021-08-28T18:20:45.000Z | 2022-02-01T07:35:59.000Z | src/test/data/pa3/sample/list_get_element_oob_3.py | Leo-Enrique-Wu/chocopy_compiler_code_generation | 4606be0531b3de77411572aae98f73169f46b3b9 | [
"BSD-2-Clause"
] | 4 | 2020-05-18T01:06:15.000Z | 2020-06-12T19:33:14.000Z | src/test/data/pa3/sample/list_get_element_oob_3.py | Leo-Enrique-Wu/chocopy_compiler_code_generation | 4606be0531b3de77411572aae98f73169f46b3b9 | [
"BSD-2-Clause"
] | 5 | 2019-11-27T05:11:05.000Z | 2021-06-29T14:31:14.000Z | x:[int] = None
x = []
print(x[0])
| 7 | 14 | 0.457143 | 7 | 35 | 2.285714 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037037 | 0.228571 | 35 | 4 | 15 | 8.75 | 0.555556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8299b31e5521abb8d2f8dfff1c5df4a520607b18 | 164 | py | Python | exercises/allergies/allergies.py | akashsara/python | 6778e437487ad0e813959fe8a5e8fd37302704f5 | [
"MIT"
] | null | null | null | exercises/allergies/allergies.py | akashsara/python | 6778e437487ad0e813959fe8a5e8fd37302704f5 | [
"MIT"
] | 1 | 2019-12-17T18:24:34.000Z | 2019-12-18T12:16:52.000Z | exercises/allergies/allergies.py | akashsara/python | 6778e437487ad0e813959fe8a5e8fd37302704f5 | [
"MIT"
] | null | null | null | class Allergies(object):
def __init__(self, score):
pass
def allergic_to(self, item):
pass
@property
def lst(self):
pass
| 13.666667 | 32 | 0.560976 | 19 | 164 | 4.578947 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.347561 | 164 | 11 | 33 | 14.909091 | 0.813084 | 0 | 0 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0.375 | 0 | 0 | 0.5 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
82b3cb2854e832088e3570125c2b7f5602582762 | 200 | py | Python | configs/sem_fpn/onaho_fpn.py | xiong-jie-y/mmsegmentation | 91159e2e5b9ac258440d714a40e0df6083aafee4 | [
"Apache-2.0"
] | 1 | 2021-09-20T22:48:16.000Z | 2021-09-20T22:48:16.000Z | configs/sem_fpn/onaho_fpn.py | xiong-jie-y/mmsegmentation | 91159e2e5b9ac258440d714a40e0df6083aafee4 | [
"Apache-2.0"
] | null | null | null | configs/sem_fpn/onaho_fpn.py | xiong-jie-y/mmsegmentation | 91159e2e5b9ac258440d714a40e0df6083aafee4 | [
"Apache-2.0"
] | null | null | null | _base_ = [
'../_base_/models/fpn_r50.py', '../_base_/datasets/onaho.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
model = dict(decode_head=dict(num_classes=2))
| 33.333333 | 74 | 0.685 | 27 | 200 | 4.518519 | 0.703704 | 0.147541 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033149 | 0.095 | 200 | 5 | 75 | 40 | 0.640884 | 0 | 0 | 0 | 0 | 0 | 0.59 | 0.59 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
82b4601eafecafbb6f782f6379a8c342a3e18c6c | 8,377 | py | Python | tests/test_sql.py | YPlan/django-perf-rec | e4face96502fda64c198e6e9951da91b0857eeec | [
"MIT"
] | 148 | 2016-09-19T13:53:34.000Z | 2018-06-27T11:48:00.000Z | tests/test_sql.py | YPlan/django-perf-rec | e4face96502fda64c198e6e9951da91b0857eeec | [
"MIT"
] | 36 | 2016-09-19T14:19:05.000Z | 2018-07-12T16:33:12.000Z | tests/test_sql.py | YPlan/django-perf-rec | e4face96502fda64c198e6e9951da91b0857eeec | [
"MIT"
] | 8 | 2016-09-29T12:13:07.000Z | 2018-07-11T07:53:33.000Z | from __future__ import annotations
from django_perf_rec.sql import sql_fingerprint
def test_empty():
assert sql_fingerprint("") == ""
assert sql_fingerprint("\n\n \n") == ""
def test_select():
assert sql_fingerprint("SELECT `f1`, `f2` FROM `b`") == "SELECT ... FROM `b`"
def test_select_show_columns(settings):
assert (
sql_fingerprint("SELECT `f1`, `f2` FROM `b`", hide_columns=False)
== "SELECT `f1`, `f2` FROM `b`"
)
def test_select_limit(settings):
assert (
sql_fingerprint("SELECT `f1`, `f2` FROM `b` LIMIT 12", hide_columns=False)
== "SELECT `f1`, `f2` FROM `b` LIMIT #"
)
def test_select_coalesce_show_columns(settings):
assert (
sql_fingerprint(
(
"SELECT `table`.`f1`, COALESCE(table.f2->>'a', table.f2->>'b', "
+ "'default') FROM `table`"
),
hide_columns=False,
)
== "SELECT `table`.`f1`, COALESCE(table.f2->>#, table.f2->>#, #) FROM `table`"
)
def test_select_where():
assert (
sql_fingerprint(
"SELECT DISTINCT `table`.`field` FROM `table` WHERE `table`.`id` = 1"
)
== "SELECT DISTINCT `table`.`field` FROM `table` WHERE `table`.`id` = #"
)
def test_select_where_show_columns(settings):
assert (
sql_fingerprint(
"SELECT DISTINCT `table`.`field` FROM `table` WHERE `table`.`id` = 1",
hide_columns=False,
)
== "SELECT DISTINCT `table`.`field` FROM `table` WHERE `table`.`id` = #"
)
def test_select_comment():
assert (
sql_fingerprint("SELECT /* comment */ `f1`, `f2` FROM `b`")
== "SELECT /* comment */ ... FROM `b`"
)
def test_select_comment_show_columns(settings):
assert (
sql_fingerprint("SELECT /* comment */ `f1`, `f2` FROM `b`", hide_columns=False)
== "SELECT /* comment */ `f1`, `f2` FROM `b`"
)
def test_select_join():
assert (
sql_fingerprint(
"SELECT f1, f2 FROM a INNER JOIN b ON (a.b_id = b.id) WHERE a.f2 = 1"
)
== "SELECT ... FROM a INNER JOIN b ON (a.b_id = b.id) WHERE a.f2 = #"
)
def test_select_join_show_columns(settings):
assert (
sql_fingerprint(
"SELECT f1, f2 FROM a INNER JOIN b ON (a.b_id = b.id) WHERE a.f2 = 1",
hide_columns=False,
)
== "SELECT f1, f2 FROM a INNER JOIN b ON (a.b_id = b.id) WHERE a.f2 = #"
)
def test_select_order_by():
assert (
sql_fingerprint("SELECT f1, f2 FROM a ORDER BY f3")
== "SELECT ... FROM a ORDER BY f3"
)
def test_select_order_by_limit():
assert (
sql_fingerprint("SELECT f1, f2 FROM a ORDER BY f3 LIMIT 12")
== "SELECT ... FROM a ORDER BY f3 LIMIT #"
)
def test_select_order_by_show_columns(settings):
assert (
sql_fingerprint("SELECT f1, f2 FROM a ORDER BY f3", hide_columns=False)
== "SELECT f1, f2 FROM a ORDER BY f3"
)
def test_select_order_by_multiple():
assert (
sql_fingerprint("SELECT f1, f2 FROM a ORDER BY f3, f4")
== "SELECT ... FROM a ORDER BY f3, f4"
)
def test_select_group_by():
assert (
sql_fingerprint("SELECT f1, f2 FROM a GROUP BY f1")
== "SELECT ... FROM a GROUP BY f1"
)
def test_select_group_by_show_columns(settings):
assert (
sql_fingerprint("SELECT f1, f2 FROM a GROUP BY f1", hide_columns=False)
== "SELECT f1, f2 FROM a GROUP BY f1"
)
def test_select_group_by_multiple():
assert (
sql_fingerprint("SELECT f1, f2 FROM a GROUP BY f1, f2")
== "SELECT ... FROM a GROUP BY f1, f2"
)
def test_select_group_by_having():
assert (
sql_fingerprint("SELECT f1, f2 FROM a GROUP BY f1 HAVING f1 > 21")
== "SELECT ... FROM a GROUP BY f1 HAVING f1 > #"
)
def test_select_group_by_having_show_columns(settings):
assert (
sql_fingerprint(
"SELECT f1, f2 FROM a GROUP BY f1 HAVING f1 > 21", hide_columns=False
)
== "SELECT f1, f2 FROM a GROUP BY f1 HAVING f1 > #"
)
def test_select_group_by_having_multiple():
assert (
sql_fingerprint("SELECT f1, f2 FROM a GROUP BY f1 HAVING f1 > 21, f2 < 42")
== "SELECT ... FROM a GROUP BY f1 HAVING f1 > #, f2 < #"
)
def test_insert():
assert (
sql_fingerprint("INSERT INTO `table` (`f1`, `f2`) VALUES ('v1', 2)")
== "INSERT INTO `table` (...) VALUES (...)"
)
def test_insert_show_columns(settings):
assert (
sql_fingerprint(
"INSERT INTO `table` (`f1`, `f2`) VALUES ('v1', 2)", hide_columns=False
)
== "INSERT INTO `table` (`f1`, `f2`) VALUES (#, #)"
)
def test_update():
assert (
sql_fingerprint("UPDATE `table` SET `foo` = 'bar' WHERE `table`.`id` = 1")
== "UPDATE `table` SET ... WHERE `table`.`id` = #"
)
def test_update_no_where():
assert (
sql_fingerprint("UPDATE `table` SET `foo` = 'bar'") == "UPDATE `table` SET ..."
)
def test_declare_cursor():
assert (
sql_fingerprint(
'DECLARE "_django_curs_140239496394496_1300" NO SCROLL CURSOR WITHOUT'
)
== 'DECLARE "_django_curs_#" NO SCROLL CURSOR WITHOUT'
)
def test_savepoint():
assert sql_fingerprint("SAVEPOINT `s140323809662784_x54`") == "SAVEPOINT `#`"
def test_rollback_to_savepoint():
assert (
sql_fingerprint("ROLLBACK TO SAVEPOINT `s140323809662784_x54`")
== "ROLLBACK TO SAVEPOINT `#`"
)
def test_release_savepoint():
assert (
sql_fingerprint("RELEASE SAVEPOINT `s140699855320896_x17`")
== "RELEASE SAVEPOINT `#`"
)
def test_null_value():
assert (
sql_fingerprint(
"SELECT `f1`, `f2` FROM `b` WHERE `b`.`name` IS NULL", hide_columns=False
)
== "SELECT `f1`, `f2` FROM `b` WHERE `b`.`name` IS #"
)
def test_strip_duplicate_whitespaces():
assert (
sql_fingerprint(
"SELECT `f1`, `f2` FROM `b` WHERE `b`.`f1` IS NULL LIMIT 12 "
)
== "SELECT ... FROM `b` WHERE `b`.`f1` IS # LIMIT #"
)
def test_strip_duplicate_whitespaces_recursive():
assert (
sql_fingerprint(
"SELECT `f1`, `f2`, ( COALESCE(b.f3->>'en', b.f3->>'fr', '')) "
"FROM `b` WHERE (`b`.`f1` IS NULL OR ( EXISTS COUNT(1) )) LIMIT 12 ",
hide_columns=False,
)
== "SELECT `f1`, `f2`, (COALESCE(b.f3->>#, b.f3->>#, #)) "
"FROM `b` WHERE (`b`.`f1` IS # OR (EXISTS COUNT(#))) LIMIT #"
)
def test_strip_newlines():
assert (
sql_fingerprint("SELECT `f1`, `f2`\nFROM `b`\n LIMIT 12\n\n")
== "SELECT ... FROM `b` LIMIT #"
)
def test_strip_raw_query():
assert (
sql_fingerprint(
"""
SELECT 'f1'
, 'f2'
, 'f3'
FROM "table_a" WHERE "table_a"."f1" = 1 OR (
"table_a"."type" = 'A' AND
EXISTS (
SELECT "table_b"."id"
FROM "table_b"
WHERE "table_b"."id" = 1
) = true)
"""
)
== (
'SELECT ... FROM "table_a" WHERE "table_a"."f1" = # OR '
+ '("table_a"."type" = # AND EXISTS (SELECT "table_b"."id" FROM '
+ '"table_b" WHERE "table_b"."id" = # ) = true)'
)
)
def test_in_single_value():
assert (
sql_fingerprint("SELECT `f1`, `f2` FROM `b` WHERE `x` IN (1)")
== "SELECT ... FROM `b` WHERE `x` IN (...)"
)
def test_in_multiple_values():
assert (
sql_fingerprint("SELECT `f1`, `f2` FROM `b` WHERE `x` IN (1, 2, 3)")
== "SELECT ... FROM `b` WHERE `x` IN (...)"
)
def test_in_multiple_clauses():
assert (
sql_fingerprint(
"SELECT `f1`, `f2` FROM `b` WHERE `x` IN (1, 2, 3) AND `y` IN (4, 5, 6)"
)
== "SELECT ... FROM `b` WHERE `x` IN (...) AND `y` IN (...)"
)
def test_in_multiple_values_and_clause():
assert (
sql_fingerprint(
"SELECT `f1`, `f2` FROM `b` WHERE `x` IN (1, 2, 3) AND (`y` = 1 OR `y` = 2)"
)
== "SELECT ... FROM `b` WHERE `x` IN (...) AND (`y` = # OR `y` = #)"
)
def test_in_subquery():
assert (
sql_fingerprint("SELECT `f1`, `f2` FROM `b` WHERE `x` IN (SELECT 1)")
== "SELECT ... FROM `b` WHERE `x` IN (SELECT #)"
)
| 26.178125 | 88 | 0.549481 | 1,067 | 8,377 | 4.123711 | 0.096532 | 0.038182 | 0.181818 | 0.177273 | 0.759091 | 0.710909 | 0.618409 | 0.570455 | 0.484773 | 0.447273 | 0 | 0.041688 | 0.292706 | 8,377 | 319 | 89 | 26.260188 | 0.700928 | 0 | 0 | 0.254386 | 0 | 0.052632 | 0.443397 | 0.020561 | 0 | 0 | 0 | 0 | 0.175439 | 1 | 0.171053 | false | 0 | 0.008772 | 0 | 0.179825 | 0.179825 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
82c33d6f16c0ad3e4c5059353c658ad5302c575d | 175 | py | Python | environments/assets/gym_collectball/__init__.py | GPaolo/SERENE | 83bc38a37ad8f1be9695d2483fd463428d4dae23 | [
"MIT"
] | 3 | 2021-04-19T21:55:00.000Z | 2021-12-20T15:26:12.000Z | environments/assets/gym_collectball/__init__.py | GPaolo/SERENE | 83bc38a37ad8f1be9695d2483fd463428d4dae23 | [
"MIT"
] | null | null | null | environments/assets/gym_collectball/__init__.py | GPaolo/SERENE | 83bc38a37ad8f1be9695d2483fd463428d4dae23 | [
"MIT"
] | null | null | null | # Created by Giuseppe Paolo
# Date: 27/08/2020
from gym.envs.registration import register
register(
id='CollectBall-v0',
entry_point='gym_collectball.envs:CollectBall'
) | 21.875 | 48 | 0.771429 | 24 | 175 | 5.541667 | 0.791667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058442 | 0.12 | 175 | 8 | 49 | 21.875 | 0.805195 | 0.245714 | 0 | 0 | 0 | 0 | 0.353846 | 0.246154 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
82da6f9da92810cdbbf538013279acc8cf63197f | 1,028 | py | Python | lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py | medismailben/llvm-project | e334a839032fe500c3bba22bf976ab7af13ce1c1 | [
"Apache-2.0"
] | 2,338 | 2018-06-19T17:34:51.000Z | 2022-03-31T11:00:37.000Z | packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py | DalavanCloud/lldb | e913eaf2468290fb94c767d474d611b41a84dd69 | [
"Apache-2.0"
] | 3,740 | 2019-01-23T15:36:48.000Z | 2022-03-31T22:01:13.000Z | packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py | DalavanCloud/lldb | e913eaf2468290fb94c767d474d611b41a84dd69 | [
"Apache-2.0"
] | 500 | 2019-01-23T07:49:22.000Z | 2022-03-30T02:59:37.000Z | class myIntSynthProvider(object):
def __init__(self, valobj, dict):
self.valobj = valobj
self.val = self.valobj.GetChildMemberWithName("theValue")
def num_children(self):
return 0
def get_child_at_index(self, index):
return None
def get_child_index(self, name):
return None
def update(self):
return False
def has_children(self):
return False
def get_value(self):
return self.val
class myArraySynthProvider(object):
def __init__(self, valobj, dict):
self.valobj = valobj
self.array = self.valobj.GetChildMemberWithName("array")
def num_children(self, max_count):
if 16 < max_count:
return 16
return max_count
def get_child_at_index(self, index):
return None # Keep it simple when this is not tested here.
def get_child_index(self, name):
return None # Keep it simple when this is not tested here.
def has_children(self):
return True
| 22.844444 | 67 | 0.641051 | 131 | 1,028 | 4.832061 | 0.312977 | 0.094787 | 0.06951 | 0.053712 | 0.559242 | 0.488152 | 0.488152 | 0.488152 | 0.401264 | 0.300158 | 0 | 0.006784 | 0.283074 | 1,028 | 44 | 68 | 23.363636 | 0.852103 | 0.086576 | 0 | 0.533333 | 0 | 0 | 0.013889 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.3 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
82dd697abb6c6bff11f04261d8e04916561eba16 | 360 | py | Python | instagram_api/response/send_confirm_email.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | 13 | 2019-08-07T21:24:34.000Z | 2020-12-12T12:23:50.000Z | instagram_api/response/send_confirm_email.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | null | null | null | instagram_api/response/send_confirm_email.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | null | null | null | from .mapper import ApiResponse, ApiResponseInterface
from .mapper.types import Timestamp, AnyType
__all__ = ['SendConfirmEmailResponse']
class SendConfirmEmailResponseInterface(ApiResponseInterface):
title: AnyType
is_email_legit: AnyType
body: AnyType
class SendConfirmEmailResponse(ApiResponse, SendConfirmEmailResponseInterface):
pass
| 24 | 79 | 0.816667 | 29 | 360 | 9.931034 | 0.62069 | 0.069444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127778 | 360 | 14 | 80 | 25.714286 | 0.917197 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 0.066667 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.111111 | 0.222222 | 0 | 0.777778 | 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 |
7d984b4f33bcef674a43431532ba484ab9af642d | 615 | py | Python | suppress.py | j0hntv/suppress | eea5dbdb904e67abdc792fd946ab51f4d550734f | [
"MIT"
] | null | null | null | suppress.py | j0hntv/suppress | eea5dbdb904e67abdc792fd946ab51f4d550734f | [
"MIT"
] | null | null | null | suppress.py | j0hntv/suppress | eea5dbdb904e67abdc792fd946ab51f4d550734f | [
"MIT"
] | null | null | null | """A simple wrapper around contextlib.suppress"""
import contextlib
from functools import wraps
__version__ = "0.1.1"
def suppress(*exceptions):
def wrap(func):
@wraps(func)
def inner(*args, **kwargs):
with contextlib.suppress(exceptions):
return func(*args, **kwargs)
return inner
return wrap
def async_suppress(*exceptions):
def wrap(func):
@wraps(func)
async def inner(*args, **kwargs):
with contextlib.suppress(exceptions):
return await func(*args, **kwargs)
return inner
return wrap
| 21.964286 | 50 | 0.604878 | 67 | 615 | 5.477612 | 0.358209 | 0.196185 | 0.114441 | 0.13624 | 0.702997 | 0.702997 | 0.702997 | 0.305177 | 0.305177 | 0 | 0 | 0.006849 | 0.287805 | 615 | 27 | 51 | 22.777778 | 0.83105 | 0.069919 | 0 | 0.526316 | 0 | 0 | 0.008834 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.263158 | false | 0 | 0.105263 | 0 | 0.684211 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7d9be08030c54e953623ba6d26f1efa4c9f9a3bb | 414 | py | Python | modoboa/admin/signals.py | vinaebizs/modoboa | fb1e7f4c023b7eb6be3aa77174bfa12fc653670e | [
"0BSD"
] | null | null | null | modoboa/admin/signals.py | vinaebizs/modoboa | fb1e7f4c023b7eb6be3aa77174bfa12fc653670e | [
"0BSD"
] | null | null | null | modoboa/admin/signals.py | vinaebizs/modoboa | fb1e7f4c023b7eb6be3aa77174bfa12fc653670e | [
"0BSD"
] | null | null | null | """Modoboa admin signals."""
import django.dispatch
use_external_recipients = django.dispatch.Signal(providing_args=["recipients"])
extra_domain_actions = django.dispatch.Signal(
providing_args=["user", "domain"])
extra_domain_dashboard_widgets = django.dispatch.Signal(
providing_args=["user", "domain"])
extra_account_dashboard_widgets = django.dispatch.Signal(
providing_args=["user", "account"])
| 34.5 | 79 | 0.772947 | 47 | 414 | 6.510638 | 0.404255 | 0.228758 | 0.261438 | 0.379085 | 0.647059 | 0.539216 | 0.539216 | 0.539216 | 0 | 0 | 0 | 0 | 0.089372 | 414 | 11 | 80 | 37.636364 | 0.811671 | 0.05314 | 0 | 0.25 | 0 | 0 | 0.106218 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 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 |
7da75a749aad9d8e1c359fa964268c99722cc54e | 180 | py | Python | test/test.py | justifyzz/Python-Assignment-1 | 8386203a9cf7099754586c26ba6646ec77dc6165 | [
"MIT"
] | null | null | null | test/test.py | justifyzz/Python-Assignment-1 | 8386203a9cf7099754586c26ba6646ec77dc6165 | [
"MIT"
] | null | null | null | test/test.py | justifyzz/Python-Assignment-1 | 8386203a9cf7099754586c26ba6646ec77dc6165 | [
"MIT"
] | null | null | null | from pycoingecko import CoinGeckoAPI
number = int(input('Enter the number of coins: '))
for i in range(length):
print(i + 1, ':', listOfNames[i], listOfMarketCaps[i])
| 22.5 | 62 | 0.672222 | 24 | 180 | 5.041667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006897 | 0.194444 | 180 | 7 | 63 | 25.714286 | 0.827586 | 0 | 0 | 0 | 0 | 0 | 0.156425 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.25 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7dbe53a8adce10ce3864cc27ec6021037f99abf0 | 2,714 | py | Python | relo/core/log.py | cwoebker/relo | db11dea794b4b241578f8de4f11d9dbbbbabf894 | [
"BSD-3-Clause"
] | null | null | null | relo/core/log.py | cwoebker/relo | db11dea794b4b241578f8de4f11d9dbbbbabf894 | [
"BSD-3-Clause"
] | null | null | null | relo/core/log.py | cwoebker/relo | db11dea794b4b241578f8de4f11d9dbbbbabf894 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# encoding: utf-8
import sys
LEVEL = {
'NORMAL': 0,
'INFO': 1,
'DEBUG': 2,
'CRITICAl': 0,
'ERROR': 0,
'EXCEPTION': 0,
}
class Color(object):
ESCAPE = '\033[%sm'
BOLD = '1;%s'
UNDERLINE = '4;%s'
BLUE_ARROW = ESCAPE % (BOLD % '34') # Blue Bold
DEBUG = ESCAPE % (BOLD % '35') # Magenta Bold
HEAD = ESCAPE % (BOLD % '1') # Bold White (Standard Color)
INFO = ESCAPE % '32' # Green Normal
WARNING = ESCAPE % '33' # Yellow Normal
ERROR = ESCAPE % '31' # Red Normal
CRITICAL = ESCAPE % (UNDERLINE % '31') # Red Underline
# SPECIAL
ITEM = ESCAPE % (BOLD % '37') # Black Bold/Bright
SUBITEM = ESCAPE % '37' # White Normal
ENDC = ESCAPE % '0'
@classmethod
def _deco(cls, msg, color):
return '%s%s%s' % (color, msg, cls.ENDC)
@classmethod
def blueArrow(cls, msg):
return cls._deco(msg, cls.BLUE_ARROW)
@classmethod
def head(cls, msg):
return cls._deco(msg, cls.HEAD)
@classmethod
def debug(cls, msg):
return cls._deco(msg, cls.DEBUG)
@classmethod
def info(cls, msg):
return cls._deco(msg, cls.INFO)
@classmethod
def warning(cls, msg):
return cls_deco(msg, cls.WARNING)
@classmethod
def error(cls, msg):
return cls._deco(msg, cls.ERROR)
@classmethod
def critical(cls, msg):
return cls._deco(msg, cls.CRITICAL)
@classmethod
def item(cls, msg):
return cls._deco(msg, cls.ITEM)
@classmethod
def subitem(cls, msg):
return cls._deco(msg, cls.SUBITEM)
class Logger(object):
def __init__(self):
self.level = 0
def debug(self, msg):
if self.level >= LEVEL['DEBUG']:
self._stdout(Color.debug("DEBUG: ") + "%s\n" % msg)
def head(self, msg):
self._stdout(Color.blueArrow('=> ') + Color.head("%s\n") % msg)
def log(self, msg):
self._stdout("%s\n" % msg)
def info(self, msg):
if self.level >= LEVEL['INFO']:
self._stdout(Color.info("INFO: ") + "%s\n" % msg)
def warning(self, msg):
self._stdout(Color.warning("WARNING: ") + "%s\n" % msg)
def error(self, msg):
self._stderr(Color.error("ERROR: ") + "%s\n" % msg)
def critical(self, msg):
self._stderr(Color.critical("CRITICAL: ") + "%s\n" % msg)
def item(self, msg):
self._stdout(Color.item(" - %s\n" % msg))
def subitem(self, msg):
self._stdout(Color.subitem(" @ %s\n" % msg))
def _stdout(self, msg):
sys.stdout.write(msg)
sys.stdout.flush()
def _stderr(self, msg):
sys.stderr.write(msg)
sys.stderr.flush()
logger = Logger() | 26.096154 | 71 | 0.562638 | 353 | 2,714 | 4.249292 | 0.192635 | 0.051333 | 0.072 | 0.09 | 0.268667 | 0.180667 | 0.15 | 0 | 0 | 0 | 0 | 0.015752 | 0.274871 | 2,714 | 104 | 72 | 26.096154 | 0.746443 | 0.065586 | 0 | 0.120482 | 0 | 0 | 0.068119 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26506 | false | 0 | 0.012048 | 0.120482 | 0.578313 | 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 |
7dc01542f166fdf824058cb9a8b3de627c4cc58f | 53 | py | Python | molpal/__init__.py | mchaker/lab-molpal | f4db7ee2ca51515b4246604867a93a3aac08107d | [
"MIT"
] | 1 | 2022-03-27T10:17:25.000Z | 2022-03-27T10:17:25.000Z | molpal/__init__.py | mchaker/lab-molpal | f4db7ee2ca51515b4246604867a93a3aac08107d | [
"MIT"
] | 2 | 2022-03-27T20:08:23.000Z | 2022-03-28T11:47:11.000Z | molpal/__init__.py | mchaker/lab-molpal | f4db7ee2ca51515b4246604867a93a3aac08107d | [
"MIT"
] | 1 | 2022-03-27T20:20:01.000Z | 2022-03-27T20:20:01.000Z | from .explorer import Explorer
__version__ = "1.0.2" | 17.666667 | 30 | 0.754717 | 8 | 53 | 4.5 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065217 | 0.132075 | 53 | 3 | 31 | 17.666667 | 0.717391 | 0 | 0 | 0 | 0 | 0 | 0.092593 | 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 |
7dc20b2c7644374b96c9964dd3914cc3c9615ccd | 237 | py | Python | ursa/graph/node.py | adgirish/ursa | c14fccacb81efd33e86453f979cb4ec799aa8a3a | [
"Apache-2.0"
] | null | null | null | ursa/graph/node.py | adgirish/ursa | c14fccacb81efd33e86453f979cb4ec799aa8a3a | [
"Apache-2.0"
] | null | null | null | ursa/graph/node.py | adgirish/ursa | c14fccacb81efd33e86453f979cb4ec799aa8a3a | [
"Apache-2.0"
] | null | null | null | class Node:
"""
This object is a generic node, the basic component of a Graph.
Fields:
data -- the data this node will contain. This data can be any format.
"""
def __init__(self, data):
self.data = data
| 23.7 | 73 | 0.620253 | 35 | 237 | 4.085714 | 0.657143 | 0.111888 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.295359 | 237 | 9 | 74 | 26.333333 | 0.856287 | 0.594937 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7dccf7de030e74e41a66762279d9a43fa3b28e62 | 63 | py | Python | env/lib/python2.7/site-packages/certifi/__init__.py | wagnermarkd/stationary-hud | 96eb0457e52a7e8a691e8ae101d43353db038f57 | [
"MIT"
] | 6 | 2021-09-18T07:19:54.000Z | 2021-09-18T07:20:07.000Z | venv/Lib/site-packages/certifi/__init__.py | Airren/mxonline-python | f16c7039b5a8ac7d2d743c83c9f44f77f02e1432 | [
"MIT"
] | 10 | 2020-01-20T13:52:07.000Z | 2022-03-12T00:12:31.000Z | venv/Lib/site-packages/certifi/__init__.py | Airren/mxonline-python | f16c7039b5a8ac7d2d743c83c9f44f77f02e1432 | [
"MIT"
] | 1 | 2016-08-24T01:08:34.000Z | 2016-08-24T01:08:34.000Z | from .core import where, old_where
__version__ = "2016.02.28"
| 15.75 | 34 | 0.746032 | 10 | 63 | 4.2 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 0.142857 | 63 | 3 | 35 | 21 | 0.62963 | 0 | 0 | 0 | 0 | 0 | 0.15873 | 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 |
7dddf53059511b42c5f3c624d5d6af6d11789231 | 87 | py | Python | ABC_A/ABC063_A.py | ryosuke0825/atcoder_python | 185cdbe7db44ecca1aaf357858d16d31ce515ddb | [
"MIT"
] | null | null | null | ABC_A/ABC063_A.py | ryosuke0825/atcoder_python | 185cdbe7db44ecca1aaf357858d16d31ce515ddb | [
"MIT"
] | null | null | null | ABC_A/ABC063_A.py | ryosuke0825/atcoder_python | 185cdbe7db44ecca1aaf357858d16d31ce515ddb | [
"MIT"
] | null | null | null | a, b = map(int, input().split())
if a+b >= 10:
print("error")
else:
print(a+b)
| 14.5 | 32 | 0.517241 | 16 | 87 | 2.8125 | 0.6875 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029851 | 0.229885 | 87 | 5 | 33 | 17.4 | 0.641791 | 0 | 0 | 0 | 0 | 0 | 0.057471 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.4 | 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 |
7de40d6d686a2a728856437129c7cee7420fe46e | 95 | py | Python | assemble/tool/assemble_CodeBlockUnixMake.py | vbloodv/blood | 1c6f6c54e937e8d7064f72f32cbbcc8fdaa2677d | [
"MIT"
] | 2 | 2015-08-27T20:02:04.000Z | 2015-08-31T12:33:13.000Z | assemble/tool/assemble_CodeBlockUnixMake.py | vbloodv/blood | 1c6f6c54e937e8d7064f72f32cbbcc8fdaa2677d | [
"MIT"
] | null | null | null | assemble/tool/assemble_CodeBlockUnixMake.py | vbloodv/blood | 1c6f6c54e937e8d7064f72f32cbbcc8fdaa2677d | [
"MIT"
] | null | null | null | import cmake
cmake.buildCmake(
'CodeBlockUnixMake',
'../../',
'../../assemble/'
)
| 11.875 | 24 | 0.536842 | 6 | 95 | 8.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.210526 | 95 | 7 | 25 | 13.571429 | 0.68 | 0 | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.166667 | 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 |
8156afb1df8b300172b241e218362d0df0d09d97 | 297 | py | Python | setup.py | dilayercelik/neural-networks-tfw1 | 8f8100bad59d2d57ada7b8a7efb16544f805c9bd | [
"MIT"
] | null | null | null | setup.py | dilayercelik/neural-networks-tfw1 | 8f8100bad59d2d57ada7b8a7efb16544f805c9bd | [
"MIT"
] | null | null | null | setup.py | dilayercelik/neural-networks-tfw1 | 8f8100bad59d2d57ada7b8a7efb16544f805c9bd | [
"MIT"
] | null | null | null | from setuptools import setup
setup(name='neural_networks_tfw1',
version='0.1',
description='Implementing Neural Networks with Tensorflow',
packages=['neural_networks_tfw1'],
author='Dilay Fidan Ercelik',
author_email='dilay.ercelik@gmail.com',
zip_safe=False)
| 29.7 | 65 | 0.707071 | 35 | 297 | 5.828571 | 0.742857 | 0.205882 | 0.176471 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016461 | 0.181818 | 297 | 9 | 66 | 33 | 0.823045 | 0 | 0 | 0 | 0 | 0 | 0.434343 | 0.077441 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.125 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
815a83e6c63111824a00c57370e405a878ff8494 | 2,872 | py | Python | gollama/backend/tests/test_api/test_shorthand.py | benjaminhubbell/gollama | 193e9eddf26d295b9a34474ae7fb93e2a91ef73a | [
"MIT"
] | 1 | 2020-08-26T19:02:25.000Z | 2020-08-26T19:02:25.000Z | gollama/backend/tests/test_api/test_shorthand.py | benjaminhubbell/gollama | 193e9eddf26d295b9a34474ae7fb93e2a91ef73a | [
"MIT"
] | 18 | 2020-06-05T06:42:22.000Z | 2021-06-04T23:51:19.000Z | gollama/backend/tests/test_api/test_shorthand.py | benjaminhubbell/gollama | 193e9eddf26d295b9a34474ae7fb93e2a91ef73a | [
"MIT"
] | 3 | 2020-08-17T02:58:11.000Z | 2020-08-18T00:03:00.000Z | from django.test import TestCase
from rest_framework.test import APIClient
class TestShortHand(TestCase):
def setUp(self) -> None:
self.client = APIClient()
def test_get(self):
response_json = self.client.post('/api/v1/shorthand/', {'label': 'foo', 'url': 'http://bar.com'}).json()
response = self.client.get(f'/api/v1/shorthand/{response_json["id"]}/')
self.assertEqual(200, response.status_code)
self.assertEqual({
'id': 1,
'label': 'foo',
'url': 'http://bar.com'
}, response.json())
def test_list(self):
self.client.post('/api/v1/shorthand/', {'label': 'foo', 'url': 'http://bar.com'})
self.client.post('/api/v1/shorthand/', {'label': 'bar', 'url': 'http://foo.com'})
response = self.client.get('/api/v1/shorthand/')
self.assertEqual(200, response.status_code)
response_json = response.json()
self.assertEqual(2, len(response_json))
def test_create(self):
response = self.client.post('/api/v1/shorthand/', {'label': 'foo', 'url': 'http://bar.com'})
self.assertEqual(201, response.status_code)
response_json = response.json()
self.assertEqual({
'id': 1,
'label': 'foo',
'url': 'http://bar.com'
}, response_json)
def test_create_fail_duplicate(self):
response = self.client.post('/api/v1/shorthand/', {'label': 'foo', 'url': 'http://bar.com'})
self.assertEqual(201, response.status_code)
response = self.client.post('/api/v1/shorthand/', {'label': 'foo', 'url': 'http://bar.com'})
self.assertEqual(400, response.status_code)
def test_update(self):
response = self.client.post('/api/v1/shorthand/', {'label': 'foo', 'url': 'http://bar.com'})
self.assertEqual(201, response.status_code)
response_json = response.json()
self.assertEqual('http://bar.com', response_json['url'])
response = self.client.patch(f'/api/v1/shorthand/{response_json["id"]}/', {'url': 'https://bar.com'})
self.assertEqual(200, response.status_code)
response_json = response.json()
self.assertEqual('https://bar.com', response_json['url'])
def test_delete(self):
response = self.client.post('/api/v1/shorthand/', {'label': 'foo', 'url': 'http://bar.com'})
self.assertEqual(201, response.status_code)
response_json = response.json()
self.assertEqual({
'id': 1,
'label': 'foo',
'url': 'http://bar.com'
}, response_json)
response = self.client.delete(f'/api/v1/shorthand/{response_json["id"]}/')
self.assertEqual(204, response.status_code)
response = self.client.get(f'/api/v1/shorthand/{response_json["id"]}/')
self.assertEqual(404, response.status_code)
| 43.515152 | 112 | 0.597493 | 344 | 2,872 | 4.889535 | 0.142442 | 0.149822 | 0.108205 | 0.08918 | 0.781213 | 0.735434 | 0.712247 | 0.677765 | 0.677765 | 0.651605 | 0 | 0.020815 | 0.213788 | 2,872 | 65 | 113 | 44.184615 | 0.724092 | 0 | 0 | 0.578947 | 0 | 0 | 0.228412 | 0.05571 | 0 | 0 | 0 | 0 | 0.280702 | 1 | 0.122807 | false | 0 | 0.035088 | 0 | 0.175439 | 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 |
81603469dc6c0438b2388abedcbbaed330402503 | 940 | py | Python | pytorch/torch/_utils_internal.py | raghavnauhria/whatmt | c20483a437c82936cb0fb8080925e37b9c4bba87 | [
"MIT"
] | 15 | 2019-08-10T02:36:38.000Z | 2021-07-14T13:45:32.000Z | torch/_utils_internal.py | wxwoods/mctorch | 7cd6eb51fdd01fa75ed9245039a4f145ba342de2 | [
"BSD-3-Clause"
] | 7 | 2019-10-21T03:08:51.000Z | 2022-03-11T23:54:28.000Z | pytorch/torch/_utils_internal.py | raghavnauhria/whatmt | c20483a437c82936cb0fb8080925e37b9c4bba87 | [
"MIT"
] | 5 | 2019-09-27T02:41:40.000Z | 2021-11-05T20:40:49.000Z | from __future__ import absolute_import, division, print_function, unicode_literals
import os
# this arbitrary-looking assortment of functionality is provided here
# to have a central place for overrideable behavior. The motivating
# use is the FB build environment, where this source file is replaced
# by an equivalent.
if os.path.basename(os.path.dirname(__file__)) == 'shared':
torch_parent = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
else:
torch_parent = os.path.dirname(os.path.dirname(__file__))
def get_file_path(*path_components):
return os.path.join(torch_parent, *path_components)
def get_file_path_2(*path_components):
return os.path.join(*path_components)
def get_writable_path(path):
return path
def prepare_multiprocessing_environment(path):
pass
def resolve_library_path(path):
return os.path.realpath(path)
TEST_MASTER_ADDR = '127.0.0.1'
TEST_MASTER_PORT = 29500
| 24.736842 | 82 | 0.774468 | 138 | 940 | 4.978261 | 0.5 | 0.087336 | 0.113537 | 0.074236 | 0.225619 | 0.225619 | 0.138282 | 0.107715 | 0 | 0 | 0 | 0.014742 | 0.134043 | 940 | 37 | 83 | 25.405405 | 0.829238 | 0.232979 | 0 | 0 | 0 | 0 | 0.02095 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0.055556 | 0.111111 | 0.222222 | 0.611111 | 0.055556 | 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 |
81763b53608a015d4f73d9be3a5324c6bd08db61 | 136 | py | Python | flaskcbv/protos/simple/apps/main/urls.py | procool/flaskcbv | 18c254c10ef03145073e1264a06a0313e811ad29 | [
"BSD-2-Clause"
] | 1 | 2020-02-24T13:08:16.000Z | 2020-02-24T13:08:16.000Z | flaskcbv/protos/simple/apps/main/urls.py | procool/flaskcbv | 18c254c10ef03145073e1264a06a0313e811ad29 | [
"BSD-2-Clause"
] | null | null | null | flaskcbv/protos/simple/apps/main/urls.py | procool/flaskcbv | 18c254c10ef03145073e1264a06a0313e811ad29 | [
"BSD-2-Clause"
] | null | null | null | from flaskcbv.url import Url, make_urls
from .views import mainView
namespases = make_urls(
Url('', mainView(), name="main"),
)
| 13.6 | 39 | 0.691176 | 18 | 136 | 5.111111 | 0.611111 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 136 | 9 | 40 | 15.111111 | 0.821429 | 0 | 0 | 0 | 0 | 0 | 0.030075 | 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 |
81787499b7aab46ab4834d4e0428415d4b205073 | 916 | py | Python | svm-rank/bag_of_words.py | Anthony-Alridge/individual_project | 9013aba2de92099dea5a703486da3dfab1dfbb61 | [
"MIT"
] | null | null | null | svm-rank/bag_of_words.py | Anthony-Alridge/individual_project | 9013aba2de92099dea5a703486da3dfab1dfbb61 | [
"MIT"
] | null | null | null | svm-rank/bag_of_words.py | Anthony-Alridge/individual_project | 9013aba2de92099dea5a703486da3dfab1dfbb61 | [
"MIT"
] | null | null | null | from collections import Counter
import numpy as np
def keep_word(word):
return word.is_alpha
def unique_words(problems):
return set([word.lemma_ for problem in problems for word in problem.tokens() if keep_word(word)])
def create_word2idx(vocab):
return {word: idx for idx, word in enumerate(vocab)}
class BagOfWordsFeature():
def __init__(self, corpus):
self.vocab = list(unique_words(corpus))
# Mapping from words to their index in the feature vector.
self.word2idx = create_word2idx(self.vocab)
def process(self, problem):
features = np.zeros(len(self.vocab))
words = [word.lemma_ for word in problem.tokens() if keep_word(word)]
freqs = Counter(words)
for word in freqs:
# Skip unknown words.
if word in self.word2idx:
features[self.word2idx[word]] = freqs[word]
return features
| 28.625 | 101 | 0.663755 | 123 | 916 | 4.829268 | 0.390244 | 0.050505 | 0.060606 | 0.053872 | 0.121212 | 0.121212 | 0.121212 | 0.121212 | 0.121212 | 0 | 0 | 0.007246 | 0.246725 | 916 | 31 | 102 | 29.548387 | 0.853623 | 0.082969 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.1 | 0.15 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8193d66190779e7816666311c0493c349ff06765 | 121 | py | Python | pymachine/condition.py | landrew31/pymachine | 117ad7aa3694a1ccb0be207cc931de8c2c345567 | [
"MIT"
] | 1 | 2018-02-21T08:57:08.000Z | 2018-02-21T08:57:08.000Z | pymachine/condition.py | landrew31/pymachine | 117ad7aa3694a1ccb0be207cc931de8c2c345567 | [
"MIT"
] | null | null | null | pymachine/condition.py | landrew31/pymachine | 117ad7aa3694a1ccb0be207cc931de8c2c345567 | [
"MIT"
] | null | null | null | from collections import namedtuple
Condition = namedtuple(
'Condition',
['current_state', 'input_character'],
)
| 17.285714 | 41 | 0.719008 | 11 | 121 | 7.727273 | 0.818182 | 0.447059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165289 | 121 | 6 | 42 | 20.166667 | 0.841584 | 0 | 0 | 0 | 0 | 0 | 0.305785 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 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 |
81972bcd61b6a76b4f3ac7d2990ee8f85d6af35f | 1,013 | py | Python | tests/testresources/pytest_resource_path_ini.py | yukihiko-shinoda/pytest-resource-path | bc56c4b5f2c8f3138baeac7f145717f6a70af7b6 | [
"MIT"
] | 5 | 2020-09-06T01:54:28.000Z | 2021-06-14T11:10:09.000Z | tests/testresources/pytest_resource_path_ini.py | yukihiko-shinoda/pytest-resource-path | bc56c4b5f2c8f3138baeac7f145717f6a70af7b6 | [
"MIT"
] | 5 | 2020-05-23T08:30:01.000Z | 2021-05-01T04:58:06.000Z | tests/testresources/pytest_resource_path_ini.py | yukihiko-shinoda/pytest-resource-path | bc56c4b5f2c8f3138baeac7f145717f6a70af7b6 | [
"MIT"
] | null | null | null | """Implements test for pytest-resource-path Fixtures with pytest.ini."""
from pathlib import Path
import pytest
def test_resource_path_ini(resource_path, request):
"""Fixture resource_path should be following absolute path."""
assert resource_path == Path(str(request.fspath)).parents[1] / Path(
"data/test_package/test_module_something/test_resource_path_ini"
)
def test_resource_path_root_ini(resource_path_root, request):
"""Fixture resource_path_root should be following absolute path."""
assert resource_path_root == Path(str(request.fspath)).parents[1] / Path("data")
@pytest.fixture(scope="package")
def resource_path_root_scope_package_ini(resource_path_root):
yield resource_path_root
# Reason: To define fixture in same module. pylint: disable=redefined-outer-name
def test_resource_path_root_scope_package_ini(resource_path_root_scope_package_ini, request):
assert resource_path_root_scope_package_ini == Path(str(request.fspath)).parents[1] / Path("data")
| 37.518519 | 102 | 0.785785 | 143 | 1,013 | 5.237762 | 0.286713 | 0.256342 | 0.213618 | 0.11215 | 0.496662 | 0.456609 | 0.395194 | 0.395194 | 0.125501 | 0 | 0 | 0.003344 | 0.114511 | 1,013 | 26 | 103 | 38.961538 | 0.831661 | 0.261599 | 0 | 0 | 0 | 0 | 0.105191 | 0.084699 | 0 | 0 | 0 | 0 | 0.230769 | 1 | 0.307692 | false | 0 | 0.153846 | 0 | 0.461538 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
81bed88a93d034618c88d318a0da803628905ccb | 337 | py | Python | main.py | ygidtu/mountainClimber | 37a1b2934741a755c90000af8d2f9e8256f24ca6 | [
"Apache-2.0"
] | null | null | null | main.py | ygidtu/mountainClimber | 37a1b2934741a755c90000af8d2f9e8256f24ca6 | [
"Apache-2.0"
] | null | null | null | main.py | ygidtu/mountainClimber | 37a1b2934741a755c90000af8d2f9e8256f24ca6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
u"""
Created at 2020.09.04 by Zhang Yiming
"""
import warnings
warnings.filterwarnings("ignore")
import click
from cli.climb import climb
from cli.diff import diff
@click.group()
def main():
pass
main.add_command(climb)
main.add_command(diff)
if __name__ == '__main__':
main()
| 14.041667 | 37 | 0.700297 | 50 | 337 | 4.52 | 0.66 | 0.061947 | 0.123894 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035088 | 0.154303 | 337 | 23 | 38 | 14.652174 | 0.757895 | 0.237389 | 0 | 0 | 0 | 0 | 0.056452 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | true | 0.076923 | 0.307692 | 0 | 0.384615 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
81cdcd944d2ec3787c0800a16240ad15e52f16bd | 500 | py | Python | benchmarks_sphere/report_konwihr_rexi_nl/compare_wt_dt_vs_accuracy_galewsky_new_rexi_cmlarge_elrexi/postprocessing_pickle.py | valentinaschueller/sweet | 27e99c7a110c99deeadee70688c186d82b39ac90 | [
"MIT"
] | 6 | 2017-11-20T08:12:46.000Z | 2021-03-11T15:32:36.000Z | benchmarks_sphere/report_konwihr_rexi_nl/compare_wt_dt_vs_accuracy_galewsky_new_rexi_cmlarge_elrexi/postprocessing_pickle.py | valentinaschueller/sweet | 27e99c7a110c99deeadee70688c186d82b39ac90 | [
"MIT"
] | 4 | 2018-02-02T21:46:33.000Z | 2022-01-11T11:10:27.000Z | benchmarks_sphere/report_konwihr_rexi_nl/compare_wt_dt_vs_accuracy_galewsky_new_rexi_cmlarge_elrexi/postprocessing_pickle.py | valentinaschueller/sweet | 27e99c7a110c99deeadee70688c186d82b39ac90 | [
"MIT"
] | 12 | 2016-03-01T18:33:34.000Z | 2022-02-08T22:20:31.000Z | #! /usr/bin/env python3
import sys
import math
import glob
from mule_local.postprocessing.pickle_SphereDataSpectralDiff import *
from mule.exec_program import *
# Ugly hack!
#output, retval = exec_program('ls *benchref*/*prog_h* | sort | tail -n 1 | sed "s/.*prog_h//"')
#if retval != 0:
# print(output)
# raise Exception("Something went wrong")
#output = output.replace("\n", '')
#output = output.replace("\r", '')
#p = pickle_SphereDataSpectralDiff(output)
p = pickle_SphereDataSpectralDiff()
| 23.809524 | 96 | 0.72 | 65 | 500 | 5.415385 | 0.630769 | 0.238636 | 0.107955 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006881 | 0.128 | 500 | 20 | 97 | 25 | 0.800459 | 0.608 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.833333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
81cf7c347a9efbb6723692e303da22251c98208b | 71 | py | Python | visualizer/__init__.py | AndreasMadsen/bachelor-code | 115fd2b955de07f34cdec998ba2a7f103ae253e3 | [
"MIT"
] | 1 | 2015-06-16T06:53:52.000Z | 2015-06-16T06:53:52.000Z | visualizer/__init__.py | AndreasMadsen/bachelor-code | 115fd2b955de07f34cdec998ba2a7f103ae253e3 | [
"MIT"
] | null | null | null | visualizer/__init__.py | AndreasMadsen/bachelor-code | 115fd2b955de07f34cdec998ba2a7f103ae253e3 | [
"MIT"
] | null | null | null |
from graph.graph_server import GraphServer
__all__ = ['GraphServer']
| 14.2 | 42 | 0.788732 | 8 | 71 | 6.375 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126761 | 71 | 4 | 43 | 17.75 | 0.822581 | 0 | 0 | 0 | 0 | 0 | 0.157143 | 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 |
81d542769cfc331b3bf5ee9b379987289db08efb | 1,071 | py | Python | steelpy/codes/main.py | svortega/steelpy | bef35eb8ab8728fc29f57b7070b5f3bac0b0e840 | [
"MIT"
] | 4 | 2021-09-28T12:52:01.000Z | 2022-02-24T22:30:22.000Z | steelpy/codes/main.py | svortega/steelpy | bef35eb8ab8728fc29f57b7070b5f3bac0b0e840 | [
"MIT"
] | null | null | null | steelpy/codes/main.py | svortega/steelpy | bef35eb8ab8728fc29f57b7070b5f3bac0b0e840 | [
"MIT"
] | null | null | null | # Copyright (c) 2019-2020 steelpy
# Python stdlib imports
# package imports
#from steelpy.codes.aisc.aisc360 import AISC_360_16
#from steelpy.codes.aisc.aisc335 import AISC_335_89
#from steelpy.codes.iso.ISO19902 import ISOCodeCheck
from steelpy.codes.piping.pipeline import Pipeline_Assessment
#from steelpy.codes.api.wsd_22ed import APIwsd22ed
from steelpy.codes.dnv.pannel import CodeCheckPanel
#
#from steelpy.process.units.main import Units
#from steelpy.material.material import Material
#from steelpy.sections.tubular import Tubular
from steelpy.codes.api.main import API_design
class CodeCheck:
"""
"""
def __init__(self):
""""""
#self._units = Units()
pass
#@property
#def units(self):
# """
# """
# return self._units
#
@property
def API(self):
"""
"""
return API_design()
#
@property
def pipe(self):
""" """
return Pipeline_Assessment()
#
def DNV_pannel(self):
""" """
return CodeCheckPanel()
| 22.3125 | 61 | 0.644258 | 121 | 1,071 | 5.570248 | 0.396694 | 0.163205 | 0.166172 | 0.059347 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040892 | 0.246499 | 1,071 | 47 | 62 | 22.787234 | 0.7943 | 0.452848 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.071429 | 0.214286 | 0 | 0.785714 | 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 |
c4a0dfed3531558a43bad867fbac20a6c63fe3e4 | 3,104 | py | Python | gpytorch/lazy/non_lazy_tensor.py | phumm/gpytorch | 4e8042bcecda049956f8f9e823d82ba6340766d5 | [
"MIT"
] | 1 | 2019-09-30T06:51:03.000Z | 2019-09-30T06:51:03.000Z | gpytorch/lazy/non_lazy_tensor.py | phumm/gpytorch | 4e8042bcecda049956f8f9e823d82ba6340766d5 | [
"MIT"
] | null | null | null | gpytorch/lazy/non_lazy_tensor.py | phumm/gpytorch | 4e8042bcecda049956f8f9e823d82ba6340766d5 | [
"MIT"
] | 1 | 2020-09-16T16:35:27.000Z | 2020-09-16T16:35:27.000Z | #!/usr/bin/env python3
import torch
from .lazy_tensor import LazyTensor
class NonLazyTensor(LazyTensor):
def _check_args(self, tsr):
if not torch.is_tensor(tsr):
return "NonLazyTensor must take a torch.Tensor; got {}".format(tsr.__class__.__name__)
if tsr.dim() < 2:
return "NonLazyTensor expects a matrix (or batches of matrices) - got a Tensor of size {}.".format(
tsr.shape
)
def __init__(self, tsr):
"""
Not a lazy tensor
Args:
- tsr (Tensor: matrix) a Tensor
"""
super(NonLazyTensor, self).__init__(tsr)
self.tensor = tsr
def _expand_batch(self, batch_shape):
return self.__class__(self.tensor.expand(*batch_shape, *self.matrix_shape))
def _get_indices(self, row_index, col_index, *batch_indices):
# Perform the __getitem__
res = self.tensor[(*batch_indices, row_index, col_index)]
return res
def _getitem(self, row_index, col_index, *batch_indices):
# Perform the __getitem__
res = self.tensor[(*batch_indices, row_index, col_index)]
return self.__class__(res)
def _matmul(self, rhs):
return torch.matmul(self.tensor, rhs)
def _prod_batch(self, dim):
return self.__class__(self.tensor.prod(dim))
def _quad_form_derivative(self, left_vecs, right_vecs):
res = left_vecs.matmul(right_vecs.transpose(-1, -2))
return (res,)
def _size(self):
return self.tensor.size()
def _sum_batch(self, dim):
return self.__class__(self.tensor.sum(dim))
def _transpose_nonbatch(self):
return NonLazyTensor(self.tensor.transpose(-1, -2))
def _t_matmul(self, rhs):
return torch.matmul(self.tensor.transpose(-1, -2), rhs)
def diag(self):
if self.tensor.ndimension() < 3:
return self.tensor.diag()
else:
row_col_iter = torch.arange(0, self.matrix_shape[-1], dtype=torch.long, device=self.device)
return self.tensor[..., row_col_iter, row_col_iter].view(*self.batch_shape, -1)
def evaluate(self):
return self.tensor
def __add__(self, other):
if isinstance(other, NonLazyTensor):
return NonLazyTensor(self.tensor + other.tensor)
else:
return super(NonLazyTensor, self).__add__(other)
def mul(self, other):
if isinstance(other, NonLazyTensor):
return NonLazyTensor(self.tensor * other.tensor)
else:
return super(NonLazyTensor, self).mul(other)
def lazify(obj):
"""
A function which ensures that `obj` is a LazyTensor.
If `obj` is a LazyTensor, this function does nothing.
If `obj` is a (normal) Tensor, this function wraps it with a `NonLazyTensor`.
"""
if torch.is_tensor(obj):
return NonLazyTensor(obj)
elif isinstance(obj, LazyTensor):
return obj
else:
raise TypeError("object of class {} cannot be made into a LazyTensor".format(obj.__class__.__name__))
__all__ = ["NonLazyTensor", "lazify"]
| 30.431373 | 111 | 0.634665 | 390 | 3,104 | 4.769231 | 0.261538 | 0.086022 | 0.032258 | 0.034409 | 0.336022 | 0.305376 | 0.305376 | 0.305376 | 0.222581 | 0.222581 | 0 | 0.005184 | 0.254188 | 3,104 | 101 | 112 | 30.732673 | 0.798272 | 0.100515 | 0 | 0.129032 | 0 | 0 | 0.072607 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.274194 | false | 0 | 0.032258 | 0.129032 | 0.66129 | 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 |
c4ae3cca9fef2f5e1a6a2cb205c909acf0583766 | 286 | py | Python | src/pydts/examples_utils/datasets.py | tomer1812/pydts | 7891a0b4b66dc7b986ebb7344c2c8f8d54e56ccc | [
"MIT"
] | null | null | null | src/pydts/examples_utils/datasets.py | tomer1812/pydts | 7891a0b4b66dc7b986ebb7344c2c8f8d54e56ccc | [
"MIT"
] | null | null | null | src/pydts/examples_utils/datasets.py | tomer1812/pydts | 7891a0b4b66dc7b986ebb7344c2c8f8d54e56ccc | [
"MIT"
] | null | null | null | import pandas as pd
from pydts.config import *
DATASETS_DIR = os.path.join(os.path.dirname((os.path.dirname(__file__))), 'datasets')
def load_LOS_simulated_data():
os.path.join(os.path.dirname(__file__))
return pd.read_csv(os.path.join(DATASETS_DIR, 'LOS_simulated_data.csv')) | 35.75 | 85 | 0.758741 | 46 | 286 | 4.369565 | 0.478261 | 0.179104 | 0.149254 | 0.119403 | 0.228856 | 0.228856 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094406 | 286 | 8 | 86 | 35.75 | 0.776062 | 0 | 0 | 0 | 0 | 0 | 0.10453 | 0.076655 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
c4d015c0bdef8b9975c426fec26024b2031d972d | 673 | py | Python | py3Server/ClassMate/botResponses.py | GFBryson/myProjects | e7bb5ba825867eb39e95c7870a5d31a7615ccdb9 | [
"MIT"
] | 1 | 2019-02-27T07:03:58.000Z | 2019-02-27T07:03:58.000Z | py3Server/ClassMate/botResponses.py | GFBryson/myProjects | e7bb5ba825867eb39e95c7870a5d31a7615ccdb9 | [
"MIT"
] | 1 | 2017-11-30T08:09:25.000Z | 2017-11-30T08:12:52.000Z | py3Server/ClassMate/botResponses.py | GFBryson/myProjects | e7bb5ba825867eb39e95c7870a5d31a7615ccdb9 | [
"MIT"
] | 1 | 2017-11-30T08:07:46.000Z | 2017-11-30T08:07:46.000Z | class responder():
def resp_hello():
hello=[]
hello.append('Hey there "{usr}"! how\'s it going?')
hello.append('Hi "{usr}" :grinning:')
hello.append('Hello "{usr}", whats up?')
hello.append('Hey "{usr}" :wave:,\nHow are you doing?')
hello.append('Hi "{usr}"!\nI\'m StrugBot, and I\'m super happy to be here!!')
hello.append('Sup "{usr}"!')
hello.append('Hi "{usr}",\nwhat can I do for you?')
hello.append('WAZZZZUUUUUUUUUUUUUUP "{usr}"')
return hello
def resp_trex():
return"I am a T-Rex!:t-rex:\nI have a BIG head and little arms,\nRAWWWRRRRR!!"
def resp_date():
return 'the date is: '
def resp_time():
return 'the time is: '
| 24.925926 | 80 | 0.622585 | 104 | 673 | 3.990385 | 0.519231 | 0.212048 | 0.093976 | 0.115663 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178306 | 673 | 26 | 81 | 25.884615 | 0.750452 | 0 | 0 | 0 | 0 | 0.055556 | 0.47619 | 0.03125 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0.166667 | 0.444444 | 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 |
c4d099c36b19642df7fc49addbd229bce868b35a | 5,433 | py | Python | day16.py | luciansmith/adventOfCode | f46ee22aa29b7c0bc1890717463f49664abe3399 | [
"MIT"
] | null | null | null | day16.py | luciansmith/adventOfCode | f46ee22aa29b7c0bc1890717463f49664abe3399 | [
"MIT"
] | null | null | null | day16.py | luciansmith/adventOfCode | f46ee22aa29b7c0bc1890717463f49664abe3399 | [
"MIT"
] | null | null | null | import numpy as np
import binascii
example = False
hexval = "020D74FCE27E600A78020200DC298F1070401C8EF1F21A4D6394F9F48F4C1C00E3003500C74602F0080B1720298C400B7002540095003DC00F601B98806351003D004F66011148039450025C00B2007024717AFB5FBC11A7E73AF60F660094E5793A4E811C0123CECED79104ECED791380069D2522B96A53A81286B18263F75A300526246F60094A6651429ADB3B0068937BCF31A009ADB4C289C9C66526014CB33CB81CB3649B849911803B2EB1327F3CFC60094B01CBB4B80351E66E26B2DD0530070401C82D182080803D1C627C330004320C43789C40192D002F93566A9AFE5967372B378001F525DDDCF0C010A00D440010E84D10A2D0803D1761045C9EA9D9802FE00ACF1448844E9C30078723101912594FEE9C9A548D57A5B8B04012F6002092845284D3301A8951C8C008973D30046136001B705A79BD400B9ECCFD30E3004E62BD56B004E465D911C8CBB2258B06009D802C00087C628C71C4001088C113E27C6B10064C01E86F042181002131EE26C5D20043E34C798246009E80293F9E530052A4910A7E87240195CC7C6340129A967EF9352CFDF0802059210972C977094281007664E206CD57292201349AA4943554D91C9CCBADB80232C6927DE5E92D7A10463005A4657D4597002BC9AF51A24A54B7B33A73E2CE005CBFB3B4A30052801F69DB4B08F3B6961024AD4B43E6B319AA020020F15E4B46E40282CCDBF8CA56802600084C788CB088401A8911C20ECC436C2401CED0048325CC7A7F8CAA912AC72B7024007F24B1F789C0F9EC8810090D801AB8803D11E34C3B00043E27C6989B2C52A01348E24B53531291C4FF4884C9C2C10401B8C9D2D875A0072E6FB75E92AC205CA0154CE7398FB0053DAC3F43295519C9AE080250E657410600BC9EAD9CA56001BF3CEF07A5194C013E00542462332DA4295680"
if (example):
# hexval = "D2FE28"
hexval = "38006F45291200"
hexval = "9C0141080250320F1802104A08"
#stole this bit from https://www.geeksforgeeks.org/python-ways-to-convert-hex-into-binary/ method 2.
n = int(hexval, 16)
binval = ''
while n > 0:
binval = str(n % 2) + binval
n = n >> 1
leading_zeros = '0' * (len(hexval)*4 - len(binval))
binval = leading_zeros + binval
print(binval)
def readOneOperation(binval, index):
if binval[index:].count('0') == len(binval)-index:
return (None, None, None, len(binval))
version = int(binval[index:index+3], 2)
index += 3
ptype = int(binval[index:index+3], 2)
index += 3
if ptype==4:
litval = binval[index+1:index+5]
while binval[index]=='1':
index += 5
litval += binval[index+1:index+5]
index += 5
# print(litval)
return (version, ptype, int(litval, 2), index)
else:
length = binval[index]
index += 1
if length=='0':
sublength = int(binval[index:index+15], 2)
index += 15
subbin = binval[index:index+sublength]
index += sublength
subindex = 0
subpackets= []
while (subindex < len(subbin)-3):
subpacket = readOneOperation(subbin, subindex)
subindex = subpacket[3]
# print("Sub-packets:", subpacket)
subpackets.append(subpacket)
return (version, ptype, subpackets, index)
else:
assert(length=='1')
nsubs = int(binval[index:index+11], 2)
index += 11
subpackets = []
for n in range(nsubs):
subpacket = readOneOperation(binval, index)
index = subpacket[3]
# print("Sub-packets:", subpacket)
subpackets.append(subpacket)
return (version, ptype, subpackets, index)
def countVersions(packet):
total = packet[0]
if packet[1] != 4:
for subpacket in packet[2]:
total += countVersions(subpacket)
return total
def prod(vec):
ret = 1
for val in vec:
ret = ret*val
return ret
def calculateValue(packet):
ptype = packet[1]
if ptype==0:
vec = []
for subpacket in packet[2]:
vec.append(calculateValue(subpacket))
print("Sum:", vec, sum(vec))
return sum(vec)
elif ptype==1:
vec = []
for subpacket in packet[2]:
vec.append(calculateValue(subpacket))
print("Product:", vec, prod(vec))
return prod(vec)
elif ptype==2:
vec = []
for subpacket in packet[2]:
vec.append(calculateValue(subpacket))
print("Min:", vec, min(vec))
return min(vec)
elif ptype==3:
vec = []
for subpacket in packet[2]:
vec.append(calculateValue(subpacket))
print("Max:", vec, max(vec))
return max(vec)
elif ptype==4:
print("val:", packet[2])
return packet[2]
elif ptype==5:
vec = []
for subpacket in packet[2]:
vec.append(calculateValue(subpacket))
assert(len(vec)==2)
print("gt:", vec, vec[0]>vec[1])
if (vec[0] > vec[1]):
return 1
return 0
elif ptype==6:
vec = []
for subpacket in packet[2]:
vec.append(calculateValue(subpacket))
assert(len(vec)==2)
print("lt:", vec, vec[0]<vec[1])
if (vec[0] < vec[1]):
return 1
return 0
elif ptype==7:
vec = []
for subpacket in packet[2]:
vec.append(calculateValue(subpacket))
assert(len(vec)==2)
print("eq:", vec, vec[0]==vec[1])
if (vec[0] == vec[1]):
return 1
return 0
else:
raise ValueError("Unknown packet type", ptype)
packet = readOneOperation(binval, 0)
print(packet)
print(countVersions(packet))
print(calculateValue(packet))
| 37.468966 | 1,347 | 0.651574 | 475 | 5,433 | 7.448421 | 0.195789 | 0.040418 | 0.031656 | 0.045223 | 0.258338 | 0.247315 | 0.233748 | 0.233748 | 0.218485 | 0.218485 | 0 | 0.267271 | 0.248666 | 5,433 | 144 | 1,348 | 37.729167 | 0.599461 | 0.036076 | 0 | 0.346457 | 0 | 0 | 0.273996 | 0.260421 | 0 | 1 | 0 | 0 | 0.031496 | 1 | 0.031496 | false | 0 | 0.015748 | 0 | 0.181102 | 0.094488 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c4fbcb6844c497c33e0f139f7c92bb18735dd23a | 837 | py | Python | easyvista/setup.py | GreyNoise-Intelligence/insightconnect-plugins | 2ba3121d42fd96e1267bb095bc76b962678c1f56 | [
"MIT"
] | null | null | null | easyvista/setup.py | GreyNoise-Intelligence/insightconnect-plugins | 2ba3121d42fd96e1267bb095bc76b962678c1f56 | [
"MIT"
] | null | null | null | easyvista/setup.py | GreyNoise-Intelligence/insightconnect-plugins | 2ba3121d42fd96e1267bb095bc76b962678c1f56 | [
"MIT"
] | null | null | null | # GENERATED BY KOMAND SDK - DO NOT EDIT
from setuptools import setup, find_packages
setup(name="easyvista-rapid7-plugin",
version="1.0.0",
description="EasyVista Service Manager platform supports even the most complex requirements, while bringing a new level of simplicity, agility, and mobility required to make cloud based IT Service Management (ITSM) software easy to use and easy to deliver. Using the EasyVista plugin for Rapid7 InsightConnect, users can manage the creation, update, search and closure of incident, service request, problem or event tickets",
author="rapid7",
author_email="",
url="",
packages=find_packages(),
install_requires=['insightconnect-plugin-runtime'], # Add third-party dependencies to requirements.txt, not here!
scripts=['bin/icon_easyvista']
)
| 55.8 | 431 | 0.741935 | 110 | 837 | 5.6 | 0.754545 | 0.038961 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008721 | 0.178017 | 837 | 14 | 432 | 59.785714 | 0.886628 | 0.11589 | 0 | 0 | 1 | 0.090909 | 0.666214 | 0.070556 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.090909 | 0 | 0.090909 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f219263481489e692def3950e22f5330890ee7b8 | 476 | py | Python | exercises/fr/test_01_09.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/fr/test_01_09.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/fr/test_01_09.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | def test():
assert "for ent in doc.ents" in __solution__, "Itères-tu sur les entités ?"
assert x_pro.text == "X Pro", "Es-tu certain que x_pro contient les bons tokens ?"
__msg__.good(
"Parfait ! Bien sur, tu n'as pas besoin de faire cela manuellement à chaque fois."
"Dans le prochain exercice, tu vas découvrir le matcher à base de règles de spaCy, "
"qui peut t'aider à trouver des mots et des phrases spécifiques dans un texte."
)
| 47.6 | 92 | 0.676471 | 78 | 476 | 4 | 0.769231 | 0.038462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.243697 | 476 | 9 | 93 | 52.888889 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.125 | true | 0 | 0 | 0 | 0.125 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f225855419247f9e8048a49c1d9c71b3af0a2082 | 4,513 | py | Python | words.py | ashutoshkrris/Terminal-Wordle | edafc99a6adb12824495e53dd0c5be6dc89b8839 | [
"MIT"
] | null | null | null | words.py | ashutoshkrris/Terminal-Wordle | edafc99a6adb12824495e53dd0c5be6dc89b8839 | [
"MIT"
] | null | null | null | words.py | ashutoshkrris/Terminal-Wordle | edafc99a6adb12824495e53dd0c5be6dc89b8839 | [
"MIT"
] | null | null | null | word_list = ['ABOUT', 'ABOVE', 'ABUSE', 'ACTOR', 'ACUTE', 'ADMIT', 'ADOPT', 'ADULT', 'AFTER', 'AGAIN', 'AGENT', 'AGREE', 'AHEAD', 'ALARM', 'ALBUM', 'ALERT', 'ALIKE', 'ALIVE', 'ALLOW', 'ALONE', 'ALONG', 'ALTER', 'AMONG', 'ANGER', 'ANGLE', 'ANGRY', 'APART', 'APPLE', 'APPLY', 'ARENA', 'ARGUE', 'ARISE', 'ARRAY', 'ASIDE', 'ASSET', 'AUDIO', 'AUDIT', 'AVOID', 'AWARD', 'AWARE', 'BADLY', 'BAKER', 'BASES', 'BASIC', 'BASIS', 'BEACH', 'BEGAN', 'BEGIN', 'BEGUN', 'BEING', 'BELOW', 'BENCH', 'BILLY', 'BIRTH', 'BLACK', 'BLAME', 'BLIND', 'BLOCK', 'BLOOD', 'BOARD', 'BOOST', 'BOOTH', 'BOUND', 'BRAIN', 'BRAND', 'BREAD', 'BREAK', 'BREED', 'BRIEF', 'BRING', 'BROAD', 'BROKE', 'BROWN', 'BUILD', 'BUILT', 'BUYER', 'CABLE', 'CALIF', 'CARRY', 'CATCH', 'CAUSE', 'CHAIN', 'CHAIR', 'CHART', 'CHASE', 'CHEAP', 'CHECK', 'CHEST', 'CHIEF', 'CHILD', 'CHINA', 'CHOSE', 'CIVIL', 'CLAIM', 'CLASS', 'CLEAN', 'CLEAR', 'CLICK', 'CLOCK', 'CLOSE', 'COACH', 'COAST', 'COULD', 'COUNT', 'COURT', 'COVER', 'CRAFT', 'CRASH', 'CREAM', 'CRIME', 'CROSS', 'CROWD', 'CROWN', 'CURVE', 'CYCLE', 'DAILY', 'DANCE', 'DATED', 'DEALT', 'DEATH', 'DEBUT', 'DELAY', 'DEPTH', 'DOING', 'DOUBT', 'DOZEN', 'DRAFT', 'DRAMA', 'DRAWN', 'DREAM', 'DRESS', 'DRILL', 'DRINK', 'DRIVE', 'DROVE', 'DYING', 'EAGER', 'EARLY', 'EARTH', 'EIGHT', 'ELITE', 'EMPTY', 'ENEMY', 'ENJOY', 'ENTER', 'ENTRY', 'EQUAL', 'ERROR', 'EVENT', 'EVERY', 'EXACT', 'EXIST', 'EXTRA', 'FAITH', 'FALSE', 'FAULT', 'FIBER', 'FIELD', 'FIFTH', 'FIFTY', 'FIGHT', 'FINAL', 'FIRST', 'FIXED', 'FLASH', 'FLEET', 'FLOOR', 'FLUID', 'FOCUS', 'FORCE', 'FORTH', 'FORTY', 'FORUM', 'FOUND', 'FRAME', 'FRANK', 'FRAUD', 'FRESH', 'FRONT', 'FRUIT', 'FULLY', 'FUNNY', 'GIANT', 'GIVEN', 'GLASS', 'GLOBE', 'GOING', 'GRACE', 'GRADE', 'GRAND', 'GRANT', 'GRASS', 'GREAT', 'GREEN', 'GROSS', 'GROUP', 'GROWN', 'GUARD', 'GUESS', 'GUEST', 'GUIDE', 'HAPPY', 'HARRY', 'HEART', 'HEAVY', 'HENCE', 'HENRY', 'HORSE', 'HOTEL', 'HOUSE', 'HUMAN', 'IDEAL', 'IMAGE', 'INDEX', 'INNER', 'INPUT', 'ISSUE', 'JAPAN', 'JIMMY', 'JOINT', 'JONES', 'JUDGE', 'KNOWN', 'LABEL', 'LARGE', 'LASER', 'LATER', 'LAUGH', 'LAYER', 'LEARN', 'LEASE', 'LEAST', 'LEAVE', 'LEGAL', 'LEVEL', 'LEWIS', 'LIGHT', 'LIMIT', 'LINKS', 'LIVES', 'LOCAL', 'LOGIC', 'LOOSE', 'LOWER', 'LUCKY', 'LUNCH', 'LYING', 'MAGIC', 'MAJOR', 'MAKER', 'MARCH', 'MARIA', 'MATCH', 'MAYBE', 'MAYOR', 'MEANT', 'MEDIA', 'METAL', 'MIGHT', 'MINOR', 'MINUS', 'MIXED', 'MODEL', 'MONEY', 'MONTH', 'MORAL', 'MOTOR', 'MOUNT', 'MOUSE', 'MOUTH', 'MOVIE', 'MUSIC', 'NEEDS', 'NEVER', 'NEWLY', 'NIGHT', 'NOISE', 'NORTH', 'NOTED', 'NOVEL', 'NURSE', 'OCCUR', 'OCEAN', 'OFFER', 'OFTEN', 'ORDER', 'OTHER', 'OUGHT', 'PAINT', 'PANEL', 'PAPER', 'PARTY', 'PEACE', 'PETER', 'PHASE', 'PHONE', 'PHOTO', 'PIECE', 'PILOT', 'PITCH', 'PLACE', 'PLAIN', 'PLANE', 'PLANT', 'PLATE', 'POINT', 'POUND', 'POWER', 'PRESS', 'PRICE', 'PRIDE', 'PRIME', 'PRINT', 'PRIOR', 'PRIZE', 'PROOF', 'PROUD', 'PROVE', 'QUEEN', 'QUICK', 'QUIET', 'QUITE', 'RADIO', 'RAISE', 'RANGE', 'RAPID', 'RATIO', 'REACH', 'READY', 'REFER', 'RIGHT', 'RIVAL', 'RIVER', 'ROBIN', 'ROGER', 'ROMAN', 'ROUGH', 'ROUND', 'ROUTE', 'ROYAL', 'RURAL', 'SCALE', 'SCENE', 'SCOPE', 'SCORE', 'SENSE', 'SERVE', 'SEVEN', 'SHALL', 'SHAPE', 'SHARE', 'SHARP', 'SHEET', 'SHELF', 'SHELL', 'SHIFT', 'SHIRT', 'SHOCK', 'SHOOT', 'SHORT', 'SHOWN', 'SIGHT', 'SINCE', 'SIXTH', 'SIXTY', 'SIZED', 'SKILL', 'SLEEP', 'SLIDE', 'SMALL', 'SMART', 'SMILE', 'SMITH', 'SMOKE', 'SOLID', 'SOLVE', 'SORRY', 'SOUND', 'SOUTH', 'SPACE', 'SPARE', 'SPEAK', 'SPEED', 'SPEND', 'SPENT', 'SPLIT', 'SPOKE', 'SPORT', 'STAFF', 'STAGE', 'STAKE', 'STAND', 'START', 'STATE', 'STEAM', 'STEEL', 'STICK', 'STILL', 'STOCK', 'STONE', 'STOOD', 'STORE', 'STORM', 'STORY', 'STRIP', 'STUCK', 'STUDY', 'STUFF', 'STYLE', 'SUGAR', 'SUITE', 'SUPER', 'SWEET', 'TABLE', 'TAKEN', 'TASTE', 'TAXES', 'TEACH', 'TEETH', 'TERRY', 'TEXAS', 'THANK', 'THEFT', 'THEIR', 'THEME', 'THERE', 'THESE', 'THICK', 'THING', 'THINK', 'THIRD', 'THOSE', 'THREE', 'THREW', 'THROW', 'TIGHT', 'TIMES', 'TIRED', 'TITLE', 'TODAY', 'TOPIC', 'TOTAL', 'TOUCH', 'TOUGH', 'TOWER', 'TRACK', 'TRADE', 'TRAIN', 'TREAT', 'TREND', 'TRIAL', 'TRIED', 'TRIES', 'TRUCK', 'TRULY', 'TRUST', 'TRUTH', 'TWICE', 'UNDER', 'UNDUE', 'UNION', 'UNITY', 'UNTIL', 'UPPER', 'UPSET', 'URBAN', 'USAGE', 'USUAL', 'VALID', 'VALUE', 'VIDEO', 'VIRUS', 'VISIT', 'VITAL', 'VOICE', 'WASTE', 'WATCH', 'WATER', 'WHEEL', 'WHERE', 'WHICH', 'WHILE', 'WHITE', 'WHOLE', 'WHOSE', 'WOMAN', 'WOMEN', 'WORLD', 'WORRY', 'WORSE', 'WORST', 'WORTH', 'WOULD', 'WOUND', 'WRITE', 'WRONG', 'WROTE', 'YIELD', 'YOUNG', 'YOUTH']
| 2,256.5 | 4,512 | 0.555949 | 502 | 4,513 | 4.996016 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111234 | 4,513 | 1 | 4,513 | 4,513 | 0.62528 | 0 | 0 | 0 | 0 | 0 | 0.553955 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1efec6ae65507f91537c6a7a371e02ca57452f0d | 175 | py | Python | settings/libs.py | skylifewww/pangolinreact | 8d8a45fd15c442618f2ed1ecab15e2e2ab4b7a3a | [
"MIT"
] | null | null | null | settings/libs.py | skylifewww/pangolinreact | 8d8a45fd15c442618f2ed1ecab15e2e2ab4b7a3a | [
"MIT"
] | null | null | null | settings/libs.py | skylifewww/pangolinreact | 8d8a45fd15c442618f2ed1ecab15e2e2ab4b7a3a | [
"MIT"
] | null | null | null | # grappelli
GRAPPELLI_ADMIN_TITLE = 'pangolin - Administration panel'
# rest framework
# REST_FRAMEWORK = {
# 'PAGINATE_BY_PARAM': 'limit',
# 'SEARCH_PARAM': 'q'
# }
| 19.444444 | 57 | 0.68 | 18 | 175 | 6.277778 | 0.777778 | 0.230089 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.182857 | 175 | 8 | 58 | 21.875 | 0.79021 | 0.588571 | 0 | 0 | 0 | 0 | 0.476923 | 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 |
4805394e98503f43fbc6141c4232f0ba1a824264 | 1,732 | py | Python | jayk/util.py | alekratz/jayk | 87dc1aa4fd7be9ee1757ddee066dffb1bd7df09b | [
"ISC"
] | 1 | 2018-04-06T23:06:21.000Z | 2018-04-06T23:06:21.000Z | jayk/util.py | alekratz/jayk | 87dc1aa4fd7be9ee1757ddee066dffb1bd7df09b | [
"ISC"
] | 5 | 2017-10-12T12:13:11.000Z | 2018-05-15T22:32:04.000Z | jayk/util.py | alekratz/jayk | 87dc1aa4fd7be9ee1757ddee066dffb1bd7df09b | [
"ISC"
] | 5 | 2017-10-10T21:59:18.000Z | 2019-06-28T13:28:10.000Z | """Common utilities used through this codebase."""
import logging
import logging.config
class LogMixin:
"""
A logging mixin class, which provides methods for writing log messages.
"""
def __init__(self, logger_name: str):
"""
Creates the logger with the specified name.
:param logger_name: the name for this logger. When in doubt, use MyType.__name__.
"""
self.__logger = logging.getLogger(logger_name)
def critical(self, message, *args, **kwargs):
"""
Passes a critical logging message on to the internal logger.
"""
self.__logger.critical(message, *args, **kwargs)
def error(self, message, *args, **kwargs):
"""
Passes an error logging message on to the internal logger.
"""
self.__logger.error(message, *args, **kwargs)
def warning(self, message, *args, **kwargs):
"""
Passes an warning logging message on to the internal logger.
"""
self.__logger.warning(message, *args, **kwargs)
def info(self, message, *args, **kwargs):
"""
Passes an info logging message on to the internal logger.
"""
self.__logger.info(message, *args, **kwargs)
def debug(self, message, *args, **kwargs):
"""
Passes a debug logging message on to the internal logger.
"""
self.__logger.debug(message, *args, **kwargs)
def exception(self, message, *args, **kwargs):
"""
Passes an exception logging message on to the internal logger. This should only be called
when in the "except" clause of an exception handler.
"""
self.__logger.exception(message, *args, **kwargs)
| 30.928571 | 97 | 0.612587 | 203 | 1,732 | 5.103448 | 0.29064 | 0.127413 | 0.196911 | 0.121622 | 0.416988 | 0.416988 | 0.250965 | 0.217181 | 0.217181 | 0 | 0 | 0 | 0.275982 | 1,732 | 55 | 98 | 31.490909 | 0.826156 | 0.394342 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.411765 | false | 0 | 0.117647 | 0 | 0.588235 | 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 |
481471f6b03716720f9e82b4bb3fce65fee25248 | 59 | py | Python | chapter 5/sampleCode22.py | DTAIEB/Thoughtful-Data-Science | 8b80e8f3e33b6fdc6672ecee1f27e0b983b28241 | [
"Apache-2.0"
] | 15 | 2018-06-01T19:18:32.000Z | 2021-11-28T03:31:35.000Z | chapter 5/sampleCode22.py | chshychen/Thoughtful-Data-Science | 8b80e8f3e33b6fdc6672ecee1f27e0b983b28241 | [
"Apache-2.0"
] | 1 | 2018-12-17T02:01:42.000Z | 2018-12-17T02:01:42.000Z | chapter 5/sampleCode22.py | chshychen/Thoughtful-Data-Science | 8b80e8f3e33b6fdc6672ecee1f27e0b983b28241 | [
"Apache-2.0"
] | 10 | 2018-09-23T02:45:45.000Z | 2022-03-12T15:32:05.000Z | import pixiedust
my_logger = pixiedust.getLogger(__name__)
| 19.666667 | 41 | 0.847458 | 7 | 59 | 6.428571 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084746 | 59 | 2 | 42 | 29.5 | 0.833333 | 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 |
481b0da064442a0c9a7254f4c7fb899384b93ddc | 13,530 | py | Python | rrl.py | siekmanj/apex | 49483c827d8e70302b3e993acf29e9798f4435c1 | [
"MIT"
] | null | null | null | rrl.py | siekmanj/apex | 49483c827d8e70302b3e993acf29e9798f4435c1 | [
"MIT"
] | 1 | 2019-11-14T21:12:31.000Z | 2019-11-14T21:12:31.000Z | rrl.py | siekmanj/rrl | 49483c827d8e70302b3e993acf29e9798f4435c1 | [
"MIT"
] | null | null | null | import os
import torch
import hashlib
from collections import OrderedDict
from util.env import env_factory, eval_policy
from util.logo import print_logo
if __name__ == "__main__":
import sys, argparse, time, os
parser = argparse.ArgumentParser()
parser.add_argument("--nolog", action='store_true')
print_logo(subtitle="Recurrent Reinforcement Learning for Robotics.")
if len(sys.argv) < 2:
print("Usage: python apex.py [algorithm name]", sys.argv)
elif sys.argv[1] == 'ars':
"""
Utility for running Augmented Random Search.
"""
from algos.ars import run_experiment
sys.argv.remove(sys.argv[1])
parser.add_argument("--workers", type=int, default=4)
parser.add_argument("--hidden_size", default=32, type=int) # neurons in hidden layer
parser.add_argument("--timesteps", "-t", default=1e8, type=float) # timesteps to run experiment ofr
parser.add_argument("--load_model", "-l", default=None, type=str) # load a model from a saved file.
parser.add_argument('--std', "-sd", default=0.0075, type=float) # the standard deviation of the parameter noise vectors
parser.add_argument("--deltas", "-d", default=64, type=int) # number of parameter noise vectors to use
parser.add_argument("--lr", "-lr", default=0.01, type=float) # the learning rate used to update policy
parser.add_argument("--reward_shift", "-rs", default=1, type=float) # the reward shift (to counter Gym's alive_bonus)
parser.add_argument("--traj_len", "-tl", default=1000, type=int) # max trajectory length for environment
parser.add_argument("--algo", "-a", default='v1', type=str) # whether to use ars v1 or v2
parser.add_argument("--normalize" '-n', action='store_true') # normalize states online
parser.add_argument("--recurrent", "-r", action='store_true') # whether to use a recurrent policy
parser.add_argument("--logdir", default="./logs/ars/", type=str)
parser.add_argument("--seed", "-s", default=0, type=int)
parser.add_argument("--env_name", "-e", default="Hopper-v3")
parser.add_argument("--average_every", default=10, type=int)
parser.add_argument("--save_model", "-m", default=None, type=str) # where to save the trained model to
parser.add_argument("--redis", default=None)
args = parser.parse_args()
run_experiment(args)
elif sys.argv[1] == 'ddpg':
sys.argv.remove(sys.argv[1])
"""
Utility for running Recurrent/Deep Deterministic Policy Gradients.
"""
from algos.off_policy import run_experiment
parser.add_argument("--timesteps", "-t", default=1e6, type=float) # number of timesteps in replay buffer
parser.add_argument("--start_timesteps", default=1e4, type=int) # number of timesteps to generate random actions for
parser.add_argument("--load_actor", default=None, type=str) # load an actor from a .pt file
parser.add_argument("--load_critic", default=None, type=str) # load a critic from a .pt file
parser.add_argument('--discount', default=0.99, type=float) # the discount factor
parser.add_argument('--expl_noise', default=0.2, type=float) # random noise used for exploration
parser.add_argument('--tau', default=0.01, type=float) # update factor for target networks
parser.add_argument("--a_lr", "-alr", default=1e-5, type=float) # adam learning rate for critic
parser.add_argument("--c_lr", "-clr", default=1e-4, type=float) # adam learning rate for actor
parser.add_argument("--traj_len", "-tl", default=1000, type=int) # max trajectory length for environment
parser.add_argument("--center_reward", "-r", action='store_true') # normalize rewards to a normal distribution
parser.add_argument("--normc_init", default=True, type=bool) # using col norm to init weights
parser.add_argument("--normalize" '-n', action='store_true') # normalize states online
parser.add_argument("--batch_size", default=64, type=int) # batch size for policy update
parser.add_argument("--updates", default=1, type=int) # (if recurrent) number of times to update policy per episode
parser.add_argument("--eval_every", default=100, type=int) # how often to evaluate the trained policy
parser.add_argument("--save_actor", default=None, type=str)
parser.add_argument("--save_critic", default=None, type=str)
parser.add_argument("--recurrent", action='store_true')
parser.add_argument("--prenormalize_steps", default=10000, type=int)
parser.add_argument("--logdir", default="./logs/ddpg/", type=str)
parser.add_argument("--seed", "-s", default=0, type=int)
parser.add_argument("--env_name", "-e", default="Hopper-v3")
args = parser.parse_args()
args.algo = 'ddpg'
run_experiment(args)
elif sys.argv[1] == 'td3':
sys.argv.remove(sys.argv[1])
"""
Utility for running Twin-Delayed Deep Deterministic policy gradients.
"""
from algos.off_policy import run_experiment
parser.add_argument("--timesteps", "-t", default=1e6, type=float) # number of timesteps in replay buffer
parser.add_argument("--start_timesteps", default=1e4, type=float) # number of timesteps to generate random actions for
parser.add_argument("--load_actor", default=None, type=str) # load an actor from a .pt file
parser.add_argument('--discount', default=0.99, type=float) # the discount factor
parser.add_argument('--expl_noise', default=0.1, type=float) # random noise used for exploration
parser.add_argument('--max_action', default=1.0, type=float) #
parser.add_argument('--policy_noise', default=0.2, type=float) #
parser.add_argument('--noise_clip', default=0.5, type=float) #
parser.add_argument('--tau', default=0.005, type=float) # update factor for target networks
parser.add_argument("--a_lr", "-alr", default=3e-4, type=float) # adam learning rate for critic
parser.add_argument("--c_lr", "-clr", default=3e-4, type=float) # adam learning rate for actor
parser.add_argument("--traj_len", "-tl", default=1000, type=int) # max trajectory length for environment
parser.add_argument("--center_reward", "-r", action='store_true') # normalize rewards to a normal distribution
parser.add_argument("--batch_size", default=256, type=int) # batch size for policy update
parser.add_argument("--updates", default=1, type=int) # (if recurrent) number of times to update policy per episode
parser.add_argument("--update_freq", default=1, type=int) # how many episodes to skip before updating
parser.add_argument("--eval_every", default=100, type=int) # how often to evaluate the trained policy
parser.add_argument("--save_actor", default=None, type=str)
#parser.add_argument("--save_critics", default=None, type=str)
parser.add_argument("--logdir", default="./logs/td3/", type=str)
parser.add_argument("--recurrent", action='store_true')
parser.add_argument("--prenormalize_steps", default=10000, type=int)
parser.add_argument("--seed", "-s", default=0, type=int)
parser.add_argument("--env_name", "-e", default="Hopper-v3")
args = parser.parse_args()
args.algo = 'td3'
run_experiment(args)
elif sys.argv[1] == 'ppo':
sys.argv.remove(sys.argv[1])
"""
Utility for running Proximal Policy Optimization.
"""
from algos.ppo import run_experiment
parser.add_argument("--seed", default=0, type=int) # number of timesteps to run experiment for
parser.add_argument("--timesteps", "-t", default=1e6, type=float) # number of timesteps to run experiment for
parser.add_argument("--env_name", default='Cassie-v0', type=str)
parser.add_argument("--traj_len", "-tl", default=400, type=int) # max trajectory length for environment
parser.add_argument("--prenormalize_steps", default=10000, type=int)
parser.add_argument("--num_steps", default=5000, type=int)
parser.add_argument("--recurrent", action='store_true')
parser.add_argument('--discount', default=0.99, type=float) # the discount factor
parser.add_argument('--std', default=0.13, type=float) # the fixed exploration std
parser.add_argument("--a_lr", "-alr", default=1e-4, type=float) # adam learning rate for actor
parser.add_argument("--c_lr", "-clr", default=1e-4, type=float) # adam learning rate for critic
parser.add_argument("--eps", "-ep", default=1e-5, type=float) # adam eps
parser.add_argument("--kl", default=0.02, type=float) # kl abort threshold
parser.add_argument("--entropy_coeff", default=0.0, type=float)
parser.add_argument("--grad_clip", default=0.05, type=float)
parser.add_argument("--batch_size", default=64, type=int) # batch size for policy update
parser.add_argument("--epochs", default=3, type=int) # number of updates per iter
parser.add_argument("--save_actor", default=None, type=str)
parser.add_argument("--save_critic", default=None, type=str)
parser.add_argument("--logdir", default="./logs/ppo/", type=str)
parser.add_argument("--workers", default=4, type=int)
parser.add_argument("--redis", default=None, type=str)
args = parser.parse_args()
run_experiment(args)
elif sys.argv[1] == 'sac':
sys.argv.remove(sys.argv[1])
"""
Utility for running Soft Actor-Critic.
"""
from algos.off_policy import run_experiment
parser.add_argument("--seed", default=0, type=int) # number of timesteps to run experiment for
parser.add_argument("--timesteps", "-t", default=1e6, type=float) # number of timesteps to run experiment for
parser.add_argument("--env_name", default='Cassie-v0', type=str)
parser.add_argument("--traj_len", "-tl", default=400, type=int) # max trajectory length for environment
parser.add_argument("--start_timesteps", default=10000, type=int)
parser.add_argument("--eval_every", default=100, type=int)
parser.add_argument("--recurrent", action='store_true')
parser.add_argument('--discount', default=0.99, type=float) # the discount factor
parser.add_argument('--tau', default=1e-2, type=float)
parser.add_argument("--a_lr", "-alr", default=1e-4, type=float) # adam learning rate for actor
parser.add_argument("--c_lr", "-clr", default=1e-4, type=float) # adam learning rate for critic
parser.add_argument("--alpha", default=None, type=float) # adam learning rate for critic
parser.add_argument("--grad_clip", default=0.05, type=float)
parser.add_argument("--batch_size", default=128, type=int) # batch size for policy update
parser.add_argument("--prenormalize_steps", default=10000, type=int)
parser.add_argument("--save_actor", default=None, type=str)
parser.add_argument("--save_critic", default=None, type=str)
parser.add_argument("--logdir", default="./logs/sac/", type=str)
args = parser.parse_args()
args.algo = 'sac'
run_experiment(args)
elif sys.argv[1] == 'eval':
sys.argv.remove(sys.argv[1])
parser.add_argument("--policy", default="./trained_models/ddpg/ddpg_actor.pt", type=str)
parser.add_argument("--env_name", default=None, type=str)
parser.add_argument("--traj_len", default=400, type=int)
args = parser.parse_args()
policy = torch.load(args.policy)
eval_policy(policy, min_timesteps=100000, env_name=args.env_name, max_traj_len=args.traj_len)
elif sys.argv[1] == 'cassie':
sys.argv.remove(sys.argv[1])
from cassie.udp import run_udp
parser.add_argument("--policy", default='logs/ppo/Cassie-nodelta-stateest-clockbased/bcbc77-seed0/actor.pt', type=str)
args = parser.parse_args()
run_udp(args)
else:
print("Invalid option '{}'".format(sys.argv[1]))
| 63.820755 | 143 | 0.601404 | 1,652 | 13,530 | 4.788136 | 0.150121 | 0.125158 | 0.23641 | 0.032364 | 0.757522 | 0.741467 | 0.67914 | 0.655879 | 0.655626 | 0.621745 | 0 | 0.020966 | 0.266741 | 13,530 | 211 | 144 | 64.123223 | 0.776333 | 0.159128 | 0 | 0.496894 | 0 | 0 | 0.152406 | 0.009132 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.080745 | 0 | 0.080745 | 0.024845 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
48223ac36e2493351b3ff6303137a45f254fb804 | 820 | py | Python | acronym.py | steffenschroeder/python-playground | 3c94a7c92a26d41e69118e8245e8ac9db7cf5ed2 | [
"MIT"
] | null | null | null | acronym.py | steffenschroeder/python-playground | 3c94a7c92a26d41e69118e8245e8ac9db7cf5ed2 | [
"MIT"
] | null | null | null | acronym.py | steffenschroeder/python-playground | 3c94a7c92a26d41e69118e8245e8ac9db7cf5ed2 | [
"MIT"
] | null | null | null | import unittest
def abbreviate(text):
return "".join((i[0].upper() for i in text.split()))
class AcronymTest(unittest.TestCase):
def test_basic(self):
self.assertEqual('PNG', abbreviate('Portable Network Graphics'))
def test_lowercase_words(self):
self.assertEqual('ROR', abbreviate('Ruby on Rails'))
def test_camelcase(self):
self.assertEqual('HTML', abbreviate('HyperText Markup Language'))
def test_punctuation(self):
self.assertEqual('FIFO', abbreviate('First In, First Out'))
def test_all_caps_words(self):
self.assertEqual('PHP', abbreviate('PHP: Hypertext Preprocessor'))
def test_hyphenated(self):
self.assertEqual('CMOS', abbreviate('Complementary metal-oxide semiconductor'))
if __name__ == '__main__':
unittest.main() | 27.333333 | 87 | 0.687805 | 95 | 820 | 5.757895 | 0.547368 | 0.076782 | 0.20841 | 0.087751 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001481 | 0.176829 | 820 | 30 | 88 | 27.333333 | 0.808889 | 0 | 0 | 0 | 0 | 0 | 0.215591 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.388889 | false | 0 | 0.055556 | 0.055556 | 0.555556 | 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 |
483774235763ac392213eaed3e87eadcdbd2e771 | 1,199 | py | Python | src/lib/divergence.py | evolutics/sparse-approximation | fda419b2ca0f6563a4668bae23ca0b94936ff8e8 | [
"MIT"
] | null | null | null | src/lib/divergence.py | evolutics/sparse-approximation | fda419b2ca0f6563a4668bae23ca0b94936ff8e8 | [
"MIT"
] | null | null | null | src/lib/divergence.py | evolutics/sparse-approximation | fda419b2ca0f6563a4668bae23ca0b94936ff8e8 | [
"MIT"
] | null | null | null | import math
from numpy import linalg
from scipy import stats
from scipy.spatial import distance
import numpy
def euclidean(p, Q):
return numpy.apply_along_axis(lambda q: linalg.norm(p - q), 0, Q)
def hellinger(p, Q):
factor = 1 / math.sqrt(2)
sqrt_p = numpy.sqrt(p)
return factor * numpy.apply_along_axis(
lambda q: linalg.norm(sqrt_p - numpy.sqrt(q)), 0, Q
)
def jensen_shannon_distance(p, Q):
"""Square root of Jensen-Shannon divergence."""
return numpy.apply_along_axis(lambda q: distance.jensenshannon(p, q), 0, Q)
def k_directed(p, Q):
"""See: Jianhua Lin. "Divergence Measures Based on the Shannon Entropy". 1991."""
return numpy.apply_along_axis(lambda q: stats.entropy(p, (p + q) / 2), 0, Q)
def kullback_leibler(p, Q):
return numpy.apply_along_axis(lambda q: stats.entropy(p, q), 0, Q)
def neyman_chi_square(p, Q):
return numpy.apply_along_axis(lambda q: numpy.sum(numpy.square(p - q) / q), 0, Q)
def pearson_chi_square(p, Q):
return numpy.apply_along_axis(lambda q: numpy.sum(numpy.square(p - q) / p), 0, Q)
def total_variation(p, Q):
return 0.5 * numpy.apply_along_axis(lambda q: linalg.norm(p - q, 1), 0, Q)
| 25.510638 | 85 | 0.683069 | 204 | 1,199 | 3.882353 | 0.254902 | 0.037879 | 0.151515 | 0.191919 | 0.492424 | 0.469697 | 0.469697 | 0.429293 | 0.383838 | 0.371212 | 0 | 0.018367 | 0.182652 | 1,199 | 46 | 86 | 26.065217 | 0.789796 | 0.097581 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.32 | false | 0 | 0.2 | 0.2 | 0.84 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
484313fcfa513337e375cc555180add4dbd721a7 | 1,663 | py | Python | torch/indicator/vision/object_detection/iou.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | 1 | 2018-12-09T06:09:29.000Z | 2018-12-09T06:09:29.000Z | torch/indicator/vision/object_detection/iou.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | torch/indicator/vision/object_detection/iou.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | # coding = utf-8
from abc import ABCMeta, abstractmethod
import torch
from Putil.torch.indicator.vision.object_detection import box
##@brief 计算iou
# @note
# @return
def _iou(x11, y11, x12, y12, x21, y21, x22, y22):
cap, cup = box._cap_cup(x11, y11, x12, y12, x21, y21, x22, y22)
return cap / cup
def _cap_cup_iou(cap, cup):
return cap / cup
##@brief 计算IoU,基于[batch, box, ...]进行计算,box的结构是[top_left_x, top_left_y, width, height],
# 返回的是[batch, 1, ...],第二维表示的是iou值,当前单元不存在gt_box的情况使用[0, 0, 0, 0]代表,
# 那么不同的iou,针对不存在gt的情况获得的值就不一样,需要特别注明 **一般情况下,计算一个batch的MeanIoU都是需要
# 进
# @note
class iou(torch.nn.Module):
def __init__(self):
torch.nn.Module.__init__(self)
pass
##@brief 返回当前对象的准确iou值索引,有些的返回值可能有多个数据(包含过程数据以及基础iou等),需要该接口方便的返回对应iou的索引
# @return int 索引
@abstractmethod
def iou_index(self):
pass
@abstractmethod
def iou_mean(self, iou):
pass
class MeanIoU(torch.nn.Module):
def __init__(self):
torch.nn.Module.__init__(self)
pass
def forward(self, iou, obj_gt):
iou_filtered = iou * obj_gt
iou = torch.nansum(iou_filtered) / ((torch.isnan(iou_filtered).eq(False) * obj_gt).sum() + 1e-32)
return iou
##@brief
# @note
class IoU(iou):
def iou_index(self):
return 0
def __init__(self):
iou.__init__(self)
pass
def forward(self, box1, box2):
box1 = box._tlwh_to_tlbr(box1)
box2 = box._tlwh_to_tlbr(box2)
x11, y11, x12, y12 = box._to_xyxy(box1)
x21, y21, x22, y22 = box._to_xyxy(box2)
iou = _iou(x11, y11, x12, y12, x21, y21, x22, y22)
return iou, | 26.396825 | 105 | 0.6362 | 232 | 1,663 | 4.318966 | 0.37069 | 0.035928 | 0.035928 | 0.047904 | 0.227545 | 0.227545 | 0.187625 | 0.187625 | 0.187625 | 0.097804 | 0 | 0.064516 | 0.235719 | 1,663 | 63 | 106 | 26.396825 | 0.72384 | 0.21828 | 0 | 0.410256 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25641 | false | 0.128205 | 0.076923 | 0.051282 | 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 |
4854e666dca1f05f5b35de7678011b69bdfaadb9 | 359 | py | Python | grappelli/settings.py | theatlantic/django-grappelli-old | f4a5f10a2e68024873556d4cc249cf0351eb1335 | [
"BSD-3-Clause"
] | 285 | 2019-12-23T09:50:21.000Z | 2021-12-08T09:08:49.000Z | base/site-packages/grappelli/settings.py | jeckun/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | [
"Apache-2.0"
] | null | null | null | base/site-packages/grappelli/settings.py | jeckun/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | [
"Apache-2.0"
] | 9 | 2019-12-23T12:59:25.000Z | 2022-03-15T05:12:11.000Z | # coding: utf-8
# DJANGO IMPORTS
from django.conf import settings
# Admin Site Title
ADMIN_HEADLINE = getattr(settings, "GRAPPELLI_ADMIN_HEADLINE", 'Grappelli')
ADMIN_TITLE = getattr(settings, "GRAPPELLI_ADMIN_TITLE", 'Grappelli')
# Link to your Main Admin Site (no slashes at start and end)
ADMIN_URL = getattr(settings, "GRAPPELLI_ADMIN_URL", '/admin/') | 29.916667 | 75 | 0.768802 | 49 | 359 | 5.44898 | 0.530612 | 0.209738 | 0.269663 | 0.325843 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003185 | 0.125348 | 359 | 12 | 76 | 29.916667 | 0.847134 | 0.289694 | 0 | 0 | 0 | 0 | 0.354582 | 0.179283 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
487a9c7212eb09b59a26433079cfd900f9387fb7 | 7,894 | py | Python | wserver_qdk/tests/main_test.py | PunchyArchy/wserver_qdk | cd29785710cb9f21efb2fc35fa395b1f693b854e | [
"MIT"
] | null | null | null | wserver_qdk/tests/main_test.py | PunchyArchy/wserver_qdk | cd29785710cb9f21efb2fc35fa395b1f693b854e | [
"MIT"
] | null | null | null | wserver_qdk/tests/main_test.py | PunchyArchy/wserver_qdk | cd29785710cb9f21efb2fc35fa395b1f693b854e | [
"MIT"
] | null | null | null | """ Тесты основного класса. """
import unittest
from wserver_qdk.main import WServerQDK
from wserver_qdk import tools
import uuid
class MainTest(unittest.TestCase):
""" Test Case """
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.qdk = WServerQDK('192.168.100.118', 8888, login='Test1',
password='jupiter3')
self.qdk.make_connection()
result = self.qdk.make_auth()
result = self.qdk.get_data()
print('auth_result', result)
# self.qdk.make_connection()
def test_set_act(self):
self.qdk.set_act(auto_id=102150, gross=5000, tare=3000, cargo=2000,
time_in='2021.08.24 13:44:13',
time_out='2021.08.24 14:33:31',
carrier_id=507970, trash_cat_id=36,
trash_type_id=12,
polygon_id=9, operator=22, ex_id=127)
response = self.qdk.get_data()
self.assertTrue(response['status'] and
isinstance(response['info']['info'], int))
def test_get_auto_id(self):
self.qdk.get_auto_id(car_number='В060ХА702')
response = self.qdk.get_data()
self.assertTrue(response['status'] and
isinstance(response['info']['info'], int))
self.qdk.get_auto_id(car_number='0101010101')
response = self.qdk.get_data()
self.assertTrue(response['status'] and not response['info'])
def test_get_carrier_id(self):
""" Вернуть ID перевозчика """
self.qdk.get_carrier_id(carrier_name='test_company_1')
response = self.qdk.get_data()
self.assertTrue(response['status'] and
isinstance(response['info']['info'], int))
self.qdk.get_carrier_id(carrier_name='0')
response = self.qdk.get_data()
self.assertTrue(response['status'] and not response['info'])
def test_set_photo(self):
photo_obj = tools.encode_photo('test_act_photo.png')
self.qdk.set_photo(record_id=784663, photo_obj=str(photo_obj),
photo_type=1)
response = self.qdk.get_data()
self.assertTrue(response['status'] and
isinstance(response['info']['info'], int))
def test_set_operator(self):
self.qdk.set_operator('FULLNAME', 'someLogin', 'somePassword', 9)
response = self.qdk.get_data()
self.assertTrue(response['status'] and
isinstance(response['info']['info'], int))
def test_set_auto(self):
random_car_num = str(uuid.uuid4())[:9]
self.qdk.set_auto(car_number=random_car_num, polygon=9,
id_type='tails')
response = self.qdk.get_data()
self.assertTrue(response['status'] and
isinstance(response['info'], int))
self.qdk.set_auto(car_number=random_car_num, polygon=9,
id_type='tails')
response = self.qdk.get_data()
self.assertTrue(not response['info']['status'])
def test_set_carrier(self):
self.qdk.set_carrier('test_carrier_n', inn='123', kpp='456',
polygon=9,
status=True, active=True, ex_id=None)
response = self.qdk.get_data()
self.assertTrue(response['status'])
def test_set_operator_notes(self):
self.qdk.set_operator_notes(record=784663,
note='TEST_COMM_FROM_QDK',
note_type=1)
response = self.qdk.get_data()
self.assertTrue(response['status'] and
isinstance(response['info']['info'], int))
def test_set_trash_cat(self):
random_name = str(uuid.uuid4())[:10]
self.qdk.set_trash_cat(name=random_name, polygon=9, active=False)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'] and
isinstance(response['info']['info'], int))
self.qdk.set_trash_cat(name=random_name, polygon=9, active=False)
response = self.qdk.get_data()
self.assertTrue(not response['info']['status'])
def test_set_trash_type(self):
random_name = str(uuid.uuid4())[:10]
self.qdk.set_trash_type(name=random_name, category=None, polygon=9)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'] and
isinstance(response['info']['info'], int))
def test_get_rfid_num(self):
self.qdk.get_rfid_id(rfid='FFFF000160')
response = self.qdk.get_data()
self.assertTrue(response['status'] and
isinstance(response['info'], int))
self.qdk.get_rfid_id(rfid='a00240sf')
response = self.qdk.get_data()
self.assertTrue(not response['info'])
def test_update_trash_cat(self):
self.qdk.update_trash_cat(cat_id=4, name='Прочее_Изм')
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_trash_cat(cat_id=4, active=False)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_trash_cat(cat_id=4, active=True)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_trash_cat(cat_id=4, polygon=0)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_trash_cat(cat_id=4, name='Прочее', active=True)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
def test_update_trash_type(self):
self.qdk.update_trash_type(type_id=3, polygon=0)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_trash_type(type_id=3, new_name='Пэт_изм')
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_trash_type(type_id=3, new_cat_id=35)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_trash_type(type_id=3, active=False)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_trash_type(type_id=3, new_name='Пэт', new_cat_id=4,
active=True)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
def test_update_auto(self):
self.qdk.update_auto(auto_id=623481, new_car_num='В2')
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_auto(auto_id=623481, new_id_type='rfid')
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_auto(auto_id=623481, active=False)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_auto(auto_id=623481, new_rg_weight=100)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
self.qdk.update_auto(auto_id=623481, new_car_num='ТЕСТ1337',
new_id_type='tails', active=True,
new_rg_weight=0)
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
def test_update_company(self):
self.qdk.update_company(company_id=507994, name='test_company_izm')
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
def test_update_operator(self):
self.qdk.update_operator(22, full_name='Гульнара ФО')
response = self.qdk.get_data()
self.assertTrue(response['info']['status'])
| 43.373626 | 75 | 0.60375 | 988 | 7,894 | 4.595142 | 0.142713 | 0.109471 | 0.088106 | 0.104846 | 0.729736 | 0.71674 | 0.709471 | 0.689648 | 0.68326 | 0.671586 | 0 | 0.035166 | 0.257917 | 7,894 | 181 | 76 | 43.61326 | 0.739843 | 0.011021 | 0 | 0.522293 | 0 | 0 | 0.084232 | 0 | 0 | 0 | 0 | 0 | 0.210191 | 1 | 0.10828 | false | 0.012739 | 0.025478 | 0 | 0.140127 | 0.006369 | 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 |
6f83b0761d99f7aecd9538ff15dd5acb4d03288c | 118 | py | Python | com/aptitute_tests/RSL.py | theeksha101/problem_solving | 431c4ff224035bb98ad67ead963860329dd4c9ff | [
"MIT"
] | null | null | null | com/aptitute_tests/RSL.py | theeksha101/problem_solving | 431c4ff224035bb98ad67ead963860329dd4c9ff | [
"MIT"
] | null | null | null | com/aptitute_tests/RSL.py | theeksha101/problem_solving | 431c4ff224035bb98ad67ead963860329dd4c9ff | [
"MIT"
] | null | null | null | a = [2, 4, 5, 7, 8, 9]
sum = 0
for i in range(len(a) - 1):
if a[i] % 2 == 0:
sum = sum + a[i]
print(sum)
| 14.75 | 27 | 0.415254 | 27 | 118 | 1.814815 | 0.62963 | 0.081633 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131579 | 0.355932 | 118 | 7 | 28 | 16.857143 | 0.513158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6f8bf885df7a7d6ca45c1dc88e7c1c7b2dc8f976 | 551 | py | Python | util/templatetags/custom_tags.py | dvcolgan/ludumdare27 | 15387d1313de488ee7503189614d42245e6ae56b | [
"MIT"
] | null | null | null | util/templatetags/custom_tags.py | dvcolgan/ludumdare27 | 15387d1313de488ee7503189614d42245e6ae56b | [
"MIT"
] | null | null | null | util/templatetags/custom_tags.py | dvcolgan/ludumdare27 | 15387d1313de488ee7503189614d42245e6ae56b | [
"MIT"
] | null | null | null | from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def setting(name):
return getattr(settings, name, "")
#@register.filter
#def format_difference(value):
# number = int(value)
# if number > 0:
# return mark_safe('<span style="color: green">+' + str(number) + '</span>')
# elif number < 0:
# return mark_safe('<span style="color: red">' + str(number) + '</span>')
# else:
# return mark_safe(str(number))
| 26.238095 | 83 | 0.662432 | 70 | 551 | 5.128571 | 0.5 | 0.089136 | 0.116992 | 0.094708 | 0.194986 | 0.194986 | 0.194986 | 0.194986 | 0 | 0 | 0 | 0.004464 | 0.186933 | 551 | 20 | 84 | 27.55 | 0.796875 | 0.568058 | 0 | 0 | 0 | 0 | 0 | 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 |
6f8ebcc85be160184b266c276cc0f3687216d3eb | 206 | py | Python | KivyTest.py | ethanmac9/GeneralTools | 96d2cd38b2b5f012113c92b751cd6fdfa8e1f1df | [
"MIT"
] | 1 | 2016-09-24T17:38:06.000Z | 2016-09-24T17:38:06.000Z | KivyTest.py | ethanmac9/GeneralTools | 96d2cd38b2b5f012113c92b751cd6fdfa8e1f1df | [
"MIT"
] | null | null | null | KivyTest.py | ethanmac9/GeneralTools | 96d2cd38b2b5f012113c92b751cd6fdfa8e1f1df | [
"MIT"
] | null | null | null | import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
kivy.require('1.9.0')
class GUITestApp(App):
def build(self):
return BoxLayout()
glApp = GUITestApp()
glApp.run()
| 17.166667 | 40 | 0.713592 | 30 | 206 | 4.9 | 0.6 | 0.108844 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017544 | 0.169903 | 206 | 11 | 41 | 18.727273 | 0.842105 | 0 | 0 | 0 | 0 | 0 | 0.024272 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0.111111 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
6f91ab094e27b4b2253d62e62b30b9f0a9a83bbc | 1,726 | py | Python | amftrack/notebooks/analysis/data_info.py | Cocopyth/MscThesis | 60162bc779a3a668e7447b60bb9a4b2a616b8093 | [
"MIT"
] | 1 | 2021-06-10T02:51:53.000Z | 2021-06-10T02:51:53.000Z | amftrack/notebooks/analysis/data_info.py | Cocopyth/MscThesis | 60162bc779a3a668e7447b60bb9a4b2a616b8093 | [
"MIT"
] | null | null | null | amftrack/notebooks/analysis/data_info.py | Cocopyth/MscThesis | 60162bc779a3a668e7447b60bb9a4b2a616b8093 | [
"MIT"
] | null | null | null | inst_25 = [(35,0,15),(29,0,20),(9,0,11),(9,13,35),(3,0,19),(37,0,8),(11,0,30),(19,0,25),(13,0,25),(39,0,18)]
inst_bait = [(10,0,10), (14,0,11), (33,0,26),(4,2,18),(4,20,30),(39,117,137),(12,5,21),(28,0,14),(32,5,14),(32,15,44),(36,0,9),(40,0,14),(2,1,15),(2,17,35),(5,160,168),(11,158,164),(13,116,131)]
inst_30 = []
inst_25late = [(32,160,190),(38,61,76),(39,446,466),(40,153,153+37),(39,269,329),(40,262,287),(38,7,42)]
inst_25late_extended = [(39,269,369),(40,153,190),(38,7,50),(38,61,105),(32,160,199),(39,446,486),(35,70,119),(38,106,130),(36,204,233),(30,57,94),(29,221,241),(40,262,312),(29,160,184),(30,0,24)]
inst_25_100P = [(38,131,131+80)]
# treatments = {'25*' : inst_25late,'25' : inst_25,'baits' : inst_bait, '30' : inst_30}
treatments = {'25_100' : inst_25_100P, '25*' : inst_25late,'25' : inst_25,'baits' : inst_bait, '30' : inst_30}
plate_number = {(9,0,11) : 296, (9,13,35) : 296, (3,0,19) : 340, (37,0,8) : 269,(11,0,30) : 314, (19,0,25) : 344, (13,0,25) : 298, (39,0,18) : 297, (35,0,15) : 351,(10,0,10) : 395,(14,0,11) : 399, (33,0,26) : 420, (4,2,18) : 423, (4,20,30) : 423,(8,0,17): 434 ,(8,20,30) : 434,(39,117,137) : 433, (12,5,21) : 436, (28,0,14): 405,(32,5,45):409,(36,0,9) : 419,(40,0,14) : 425,(2,1,15):435,(2,17,35):435,(5,160,168):382,(11,158,164) : 416,(13,116,131) : 424, (29,0,20) : 373,(32,15,44):409, (32,5,14) : 409, (40,153,153+37) : 69,(39,269,329) : 94, (40,262,287) : 102,(38,7,42) : 59, (32,160,190) : 152,(38,61,76) : 137,(39,446,466) : 26, (38,131,131+80):721}
comments = {395 : 'ignore', 399 : 'left', 405 : 'left', 409 : 'right', 416 : 'middle', 419 : 'middle', 420 : 'left', 423: 'right', 424 : 'left', 425 : 'middle', 433 : 'right', 435 : 'middle', 436 : 'left'} | 143.833333 | 656 | 0.551564 | 377 | 1,726 | 2.472149 | 0.307692 | 0.032189 | 0.01073 | 0.021459 | 0.087983 | 0.087983 | 0.087983 | 0.087983 | 0.087983 | 0.087983 | 0 | 0.467229 | 0.107184 | 1,726 | 12 | 657 | 143.833333 | 0.137573 | 0.049247 | 0 | 0 | 0 | 0 | 0.050952 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6faccc1a6a5c598d0d380be6821bb6343c6e2509 | 572 | py | Python | test/market_feature_1/test_nose_plugin.py | StefanRatzke/nose-market-features | e63b2367b77e860c919d3a33612a3ba6ff632f5f | [
"Apache-2.0"
] | 5 | 2015-01-12T10:04:15.000Z | 2018-12-20T13:49:47.000Z | test/market_feature_1/test_nose_plugin.py | StefanRatzke/nose-market-features | e63b2367b77e860c919d3a33612a3ba6ff632f5f | [
"Apache-2.0"
] | 16 | 2015-10-06T12:35:20.000Z | 2019-04-01T15:05:17.000Z | test/market_feature_1/test_nose_plugin.py | StefanRatzke/nose-market-features | e63b2367b77e860c919d3a33612a3ba6ff632f5f | [
"Apache-2.0"
] | 2 | 2015-03-02T09:49:11.000Z | 2019-03-26T15:27:41.000Z | from unittest import skip
import unittest2
from nose.plugins.attrib import attr
from nose.tools import assert_equals
@attr('test_nose_plugin')
class TestNosePlugin(unittest2.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_one(self):
"""first test, simulation passing test"""
assert_equals(1, 1)
def test_one6(self):
"""first test, simulation passing test"""
assert_equals(1, 1)
def test_three(self):
"""third test, simulation failing test"""
assert_equals(1, 1)
| 21.185185 | 49 | 0.653846 | 73 | 572 | 5 | 0.424658 | 0.131507 | 0.131507 | 0.139726 | 0.350685 | 0.30137 | 0.30137 | 0.30137 | 0.30137 | 0.30137 | 0 | 0.020882 | 0.246504 | 572 | 26 | 50 | 22 | 0.825986 | 0.187063 | 0 | 0.3125 | 0 | 0 | 0.035635 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.3125 | false | 0.125 | 0.25 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
6fb84b781b83af75ecf875a208c9ad2d89873dec | 13,981 | py | Python | template_container_human/labels/slice_7.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | template_container_human/labels/slice_7.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | template_container_human/labels/slice_7.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | coordinates_01EE00 = ((121, 126),
(121, 132), (121, 134), (121, 135), (121, 137), (121, 138), (121, 139), (121, 140), (121, 141), (122, 114), (122, 115), (122, 116), (122, 117), (122, 119), (122, 125), (122, 127), (122, 128), (122, 142), (123, 110), (123, 111), (123, 112), (123, 113), (123, 120), (123, 124), (123, 126), (123, 130), (123, 132), (123, 133), (123, 134), (123, 135), (123, 136), (123, 137), (123, 138), (123, 139), (123, 140), (123, 141), (123, 144), (124, 107), (124, 109), (124, 114), (124, 115), (124, 116), (124, 117), (124, 118), (124, 120), (124, 124), (124, 125), (124, 126), (124, 127), (124, 128), (124, 129), (124, 131), (124, 132), (124, 133), (124, 134), (124, 135), (124, 136), (124, 137), (124, 138), (124, 139), (124, 140), (124, 141), (124, 142), (124, 146), (125, 105), (125, 110), (125, 111), (125, 112), (125, 113), (125, 114), (125, 115), (125, 116), (125, 117),
(125, 118), (125, 119), (125, 120), (125, 122), (125, 124), (125, 125), (125, 126), (125, 127), (125, 128), (125, 129), (125, 130), (125, 131), (125, 132), (125, 133), (125, 134), (125, 135), (125, 136), (125, 137), (125, 138), (125, 139), (125, 140), (125, 141), (125, 142), (125, 143), (125, 144), (125, 148), (126, 103), (126, 107), (126, 108), (126, 109), (126, 110), (126, 111), (126, 112), (126, 113), (126, 114), (126, 115), (126, 116), (126, 117), (126, 118), (126, 119), (126, 120), (126, 124), (126, 125), (126, 126), (126, 127), (126, 128), (126, 129), (126, 130), (126, 131), (126, 132), (126, 133), (126, 134), (126, 135), (126, 136), (126, 137), (126, 138), (126, 139), (126, 140), (126, 141), (126, 142), (126, 143), (126, 144), (126, 145), (126, 146), (126, 149), (127, 102), (127, 105), (127, 106), (127, 107), (127, 108), (127, 109), (127, 110),
(127, 111), (127, 112), (127, 113), (127, 114), (127, 115), (127, 116), (127, 117), (127, 118), (127, 119), (127, 120), (127, 121), (127, 122), (127, 123), (127, 124), (127, 125), (127, 126), (127, 127), (127, 128), (127, 129), (127, 130), (127, 131), (127, 132), (127, 133), (127, 134), (127, 135), (127, 136), (127, 137), (127, 138), (127, 139), (127, 140), (127, 141), (127, 142), (127, 143), (127, 144), (127, 145), (127, 146), (127, 147), (127, 148), (127, 150), (128, 103), (128, 105), (128, 106), (128, 107), (128, 108), (128, 109), (128, 110), (128, 111), (128, 112), (128, 113), (128, 114), (128, 115), (128, 116), (128, 117), (128, 118), (128, 119), (128, 120), (128, 121), (128, 122), (128, 123), (128, 124), (128, 125), (128, 126), (128, 127), (128, 128), (128, 129), (128, 130), (128, 131), (128, 132), (128, 133), (128, 134), (128, 135), (128, 136),
(128, 137), (128, 138), (128, 139), (128, 140), (128, 141), (128, 142), (128, 143), (128, 144), (128, 145), (128, 146), (128, 147), (128, 149), (129, 103), (129, 105), (129, 106), (129, 107), (129, 108), (129, 109), (129, 110), (129, 111), (129, 112), (129, 113), (129, 114), (129, 115), (129, 116), (129, 117), (129, 118), (129, 119), (129, 120), (129, 121), (129, 122), (129, 123), (129, 124), (129, 125), (129, 126), (129, 127), (129, 128), (129, 129), (129, 130), (129, 131), (129, 132), (129, 133), (129, 134), (129, 135), (129, 136), (129, 137), (129, 138), (129, 139), (129, 140), (129, 141), (129, 142), (129, 143), (129, 144), (129, 145), (129, 146), (129, 147), (129, 149), (130, 104), (130, 107), (130, 108), (130, 109), (130, 110), (130, 111), (130, 112), (130, 113), (130, 114), (130, 115), (130, 116), (130, 117), (130, 118), (130, 119), (130, 120),
(130, 121), (130, 122), (130, 123), (130, 124), (130, 125), (130, 126), (130, 127), (130, 128), (130, 129), (130, 130), (130, 131), (130, 132), (130, 133), (130, 134), (130, 135), (130, 136), (130, 137), (130, 138), (130, 139), (130, 140), (130, 141), (130, 142), (130, 143), (130, 144), (130, 145), (130, 146), (130, 148), (131, 104), (131, 106), (131, 107), (131, 108), (131, 109), (131, 110), (131, 111), (131, 112), (131, 113), (131, 114), (131, 115), (131, 116), (131, 117), (131, 118), (131, 119), (131, 120), (131, 121), (131, 122), (131, 123), (131, 124), (131, 125), (131, 126), (131, 127), (131, 128), (131, 129), (131, 130), (131, 131), (131, 132), (131, 133), (131, 134), (131, 135), (131, 136), (131, 137), (131, 138), (131, 139), (131, 140), (131, 141), (131, 142), (131, 143), (131, 144), (131, 145), (131, 147), (132, 108), (132, 109), (132, 110),
(132, 111), (132, 112), (132, 113), (132, 114), (132, 115), (132, 116), (132, 117), (132, 118), (132, 119), (132, 120), (132, 121), (132, 122), (132, 123), (132, 124), (132, 125), (132, 126), (132, 127), (132, 128), (132, 129), (132, 130), (132, 131), (132, 132), (132, 133), (132, 134), (132, 135), (132, 136), (132, 137), (132, 138), (132, 139), (132, 140), (132, 141), (132, 142), (132, 143), (132, 144), (132, 146), (133, 108), (133, 110), (133, 111), (133, 112), (133, 113), (133, 114), (133, 115), (133, 116), (133, 117), (133, 118), (133, 119), (133, 120), (133, 121), (133, 122), (133, 123), (133, 124), (133, 125), (133, 126), (133, 127), (133, 128), (133, 129), (133, 130), (133, 131), (133, 132), (133, 133), (133, 134), (133, 135), (133, 136), (133, 137), (133, 138), (133, 139), (133, 140), (133, 141), (133, 142), (133, 143), (133, 144), (133, 146),
(134, 107), (134, 108), (134, 109), (134, 110), (134, 111), (134, 112), (134, 113), (134, 114), (134, 115), (134, 116), (134, 117), (134, 118), (134, 119), (134, 120), (134, 121), (134, 122), (134, 123), (134, 124), (134, 125), (134, 126), (134, 127), (134, 128), (134, 129), (134, 130), (134, 131), (134, 132), (134, 133), (134, 134), (134, 135), (134, 136), (134, 137), (134, 138), (134, 139), (134, 140), (134, 141), (134, 142), (134, 143), (134, 145), (135, 106), (135, 108), (135, 109), (135, 110), (135, 111), (135, 112), (135, 113), (135, 114), (135, 115), (135, 116), (135, 117), (135, 118), (135, 119), (135, 120), (135, 121), (135, 122), (135, 123), (135, 124), (135, 125), (135, 126), (135, 127), (135, 128), (135, 129), (135, 130), (135, 131), (135, 132), (135, 133), (135, 134), (135, 135), (135, 136), (135, 137), (135, 138), (135, 139), (135, 140),
(135, 141), (135, 142), (135, 143), (135, 145), (136, 105), (136, 107), (136, 110), (136, 111), (136, 112), (136, 113), (136, 114), (136, 115), (136, 116), (136, 117), (136, 118), (136, 119), (136, 120), (136, 121), (136, 122), (136, 123), (136, 124), (136, 125), (136, 126), (136, 127), (136, 128), (136, 129), (136, 130), (136, 131), (136, 132), (136, 133), (136, 134), (136, 135), (136, 136), (136, 137), (136, 138), (136, 139), (136, 140), (136, 141), (136, 142), (136, 144), (137, 105), (137, 109), (137, 110), (137, 111), (137, 112), (137, 113), (137, 114), (137, 115), (137, 116), (137, 117), (137, 118), (137, 119), (137, 120), (137, 121), (137, 122), (137, 123), (137, 124), (137, 125), (137, 126), (137, 127), (137, 128), (137, 129), (137, 130), (137, 131), (137, 132), (137, 133), (137, 134), (137, 135), (137, 136), (137, 137), (137, 138), (137, 139),
(137, 140), (137, 141), (137, 142), (137, 144), (138, 105), (138, 107), (138, 110), (138, 112), (138, 113), (138, 114), (138, 115), (138, 116), (138, 117), (138, 118), (138, 119), (138, 120), (138, 121), (138, 122), (138, 123), (138, 124), (138, 125), (138, 126), (138, 127), (138, 128), (138, 129), (138, 130), (138, 131), (138, 132), (138, 133), (138, 134), (138, 135), (138, 136), (138, 137), (138, 138), (138, 139), (138, 140), (138, 141), (138, 143), (139, 106), (139, 110), (139, 112), (139, 113), (139, 114), (139, 115), (139, 116), (139, 117), (139, 118), (139, 119), (139, 120), (139, 121), (139, 122), (139, 123), (139, 124), (139, 125), (139, 126), (139, 127), (139, 128), (139, 129), (139, 130), (139, 131), (139, 132), (139, 133), (139, 134), (139, 135), (139, 136), (139, 137), (139, 138), (139, 139), (139, 140), (139, 142), (140, 110), (140, 112),
(140, 113), (140, 114), (140, 115), (140, 116), (140, 117), (140, 118), (140, 119), (140, 120), (140, 121), (140, 122), (140, 123), (140, 124), (140, 125), (140, 126), (140, 127), (140, 128), (140, 129), (140, 130), (140, 131), (140, 132), (140, 133), (140, 134), (140, 135), (140, 138), (140, 139), (140, 141), (141, 110), (141, 115), (141, 116), (141, 117), (141, 118), (141, 119), (141, 120), (141, 121), (141, 122), (141, 123), (141, 124), (141, 125), (141, 126), (141, 127), (141, 128), (141, 129), (141, 130), (141, 131), (141, 132), (141, 133), (141, 134), (141, 136), (141, 137), (141, 138), (141, 139), (141, 141), (142, 110), (142, 112), (142, 113), (142, 114), (142, 115), (142, 116), (142, 117), (142, 118), (142, 119), (142, 120), (142, 121), (142, 122), (142, 123), (142, 124), (142, 125), (142, 126), (142, 127), (142, 128), (142, 129), (142, 130),
(142, 131), (142, 132), (142, 133), (142, 135), (142, 138), (142, 141), (143, 115), (143, 117), (143, 118), (143, 119), (143, 120), (143, 121), (143, 122), (143, 123), (143, 124), (143, 125), (143, 126), (143, 127), (143, 128), (143, 129), (143, 130), (143, 131), (143, 132), (143, 134), (143, 138), (143, 140), (144, 115), (144, 117), (144, 118), (144, 119), (144, 120), (144, 121), (144, 122), (144, 123), (144, 124), (144, 125), (144, 126), (144, 127), (144, 128), (144, 129), (144, 130), (144, 131), (144, 138), (145, 115), (145, 117), (145, 118), (145, 119), (145, 120), (145, 121), (145, 122), (145, 123), (145, 124), (145, 125), (145, 126), (145, 127), (145, 128), (145, 129), (145, 133), (145, 138), (145, 139), (146, 116), (146, 119), (146, 120), (146, 121), (146, 122), (146, 123), (146, 124), (146, 125), (146, 126), (146, 127), (146, 128), (146, 138),
(147, 117), (147, 119), (147, 120), (147, 121), (147, 122), (147, 123), (147, 124), (147, 125), (147, 126), (147, 127), (147, 129), (148, 119), (148, 121), (148, 122), (148, 123), (148, 124), (148, 125), (148, 126), (148, 128), (149, 119), (149, 121), (149, 122), (149, 123), (149, 128), (150, 118), (150, 120), (150, 121), (150, 125), (150, 126), (150, 129), (151, 118), (151, 123), (151, 127), (151, 128), (151, 130), (151, 132), (152, 120), (152, 121), (152, 128), (152, 133), )
coordinates_00EE00 = ((98, 135),
(99, 121), (99, 122), (99, 135), (99, 136), (100, 120), (100, 122), (100, 135), (101, 114), (101, 120), (101, 123), (101, 129), (101, 135), (101, 137), (102, 114), (102, 119), (102, 121), (102, 123), (102, 128), (102, 130), (102, 136), (103, 114), (103, 119), (103, 121), (103, 122), (103, 123), (103, 125), (103, 126), (103, 130), (104, 112), (104, 115), (104, 118), (104, 120), (104, 123), (104, 128), (104, 130), (105, 111), (105, 114), (105, 116), (105, 117), (105, 119), (105, 120), (105, 121), (105, 122), (105, 123), (105, 124), (105, 125), (105, 126), (105, 127), (105, 128), (105, 129), (105, 130), (105, 132), (106, 111), (106, 113), (106, 114), (106, 115), (106, 118), (106, 120), (106, 123), (106, 125), (106, 126), (106, 127), (106, 128), (106, 129), (106, 130), (106, 134), (107, 111), (107, 113), (107, 114), (107, 115), (107, 116), (107, 117),
(107, 118), (107, 120), (107, 123), (107, 124), (107, 125), (107, 126), (107, 127), (107, 128), (107, 129), (107, 130), (107, 131), (107, 132), (107, 134), (108, 111), (108, 113), (108, 114), (108, 115), (108, 116), (108, 117), (108, 118), (108, 119), (108, 120), (108, 123), (108, 126), (108, 127), (108, 128), (108, 129), (108, 130), (108, 131), (108, 132), (108, 133), (108, 135), (109, 111), (109, 115), (109, 116), (109, 117), (109, 118), (109, 119), (109, 120), (109, 121), (109, 123), (109, 124), (109, 125), (109, 128), (109, 129), (109, 130), (109, 131), (109, 132), (109, 133), (109, 134), (109, 136), (110, 110), (110, 112), (110, 113), (110, 114), (110, 117), (110, 118), (110, 119), (110, 120), (110, 121), (110, 123), (110, 126), (110, 127), (110, 128), (110, 129), (110, 130), (110, 131), (110, 132), (110, 133), (110, 134), (110, 135), (110, 138),
(111, 109), (111, 111), (111, 115), (111, 117), (111, 118), (111, 119), (111, 120), (111, 122), (111, 128), (111, 130), (111, 131), (111, 132), (111, 133), (111, 134), (111, 135), (111, 136), (111, 140), (112, 107), (112, 111), (112, 117), (112, 119), (112, 120), (112, 121), (112, 123), (112, 128), (112, 130), (112, 131), (112, 132), (112, 133), (112, 134), (112, 135), (112, 136), (112, 137), (112, 138), (113, 105), (113, 109), (113, 110), (113, 111), (113, 113), (113, 118), (113, 120), (113, 121), (113, 122), (113, 123), (113, 124), (113, 125), (113, 126), (113, 127), (113, 130), (113, 131), (113, 132), (113, 133), (113, 134), (113, 135), (113, 136), (113, 137), (113, 138), (113, 139), (113, 141), (114, 105), (114, 107), (114, 108), (114, 109), (114, 110), (114, 111), (114, 114), (114, 118), (114, 119), (114, 120), (114, 121), (114, 122), (114, 123),
(114, 128), (114, 129), (114, 131), (114, 132), (114, 133), (114, 134), (114, 135), (114, 136), (114, 137), (114, 138), (114, 139), (114, 141), (115, 105), (115, 107), (115, 108), (115, 109), (115, 110), (115, 111), (115, 112), (115, 113), (115, 116), (115, 117), (115, 118), (115, 119), (115, 120), (115, 121), (115, 122), (115, 123), (115, 124), (115, 127), (115, 130), (115, 132), (115, 133), (115, 134), (115, 135), (115, 136), (115, 137), (115, 138), (115, 139), (115, 141), (116, 105), (116, 126), (116, 131), (116, 133), (116, 134), (116, 135), (116, 136), (116, 137), (116, 138), (116, 139), (116, 141), (117, 106), (117, 108), (117, 109), (117, 110), (117, 111), (117, 112), (117, 113), (117, 114), (117, 115), (117, 116), (117, 117), (117, 118), (117, 119), (117, 120), (117, 121), (117, 122), (117, 124), (117, 131), (117, 140), (118, 132), (118, 134),
(118, 135), (118, 136), (118, 138), (118, 140), (119, 132), (119, 135), (119, 139), (119, 140), )
coordinates_E0E1E1 = ((126, 127),
(126, 134), (127, 118), (127, 126), (127, 134), (128, 118), (128, 125), (128, 128), (129, 119), (129, 128), (129, 129), (130, 123), (130, 128), (130, 130), (131, 122), (131, 128), (131, 129), (132, 122), (132, 128), (134, 122), (136, 121), (137, 121), )
coordinates_E1E1E1 = ((111, 125),
(112, 114), )
| 582.541667 | 865 | 0.500036 | 2,316 | 13,981 | 3.016839 | 0.025907 | 0.003435 | 0.002576 | 0.003435 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.596695 | 0.168944 | 13,981 | 23 | 866 | 607.869565 | 0.004648 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6fbf3fd6784e5fc825699ad96db6d0683069d114 | 188 | py | Python | griffin_powermate/__init__.py | alex-ong/griffin-powermate | 59f53647de2fd025b27552c37e22e4c8c176aba6 | [
"MIT"
] | 11 | 2015-07-06T03:48:00.000Z | 2022-03-08T15:45:02.000Z | griffin_powermate/__init__.py | alex-ong/griffin-powermate | 59f53647de2fd025b27552c37e22e4c8c176aba6 | [
"MIT"
] | 2 | 2018-03-30T17:11:53.000Z | 2018-03-31T10:49:22.000Z | griffin_powermate/__init__.py | alex-ong/griffin-powermate | 59f53647de2fd025b27552c37e22e4c8c176aba6 | [
"MIT"
] | 6 | 2015-07-10T23:12:38.000Z | 2021-07-05T05:17:22.000Z | __version__ = '1.0.2'
__author__ = 'Christian Musa <christianmusa@gmail.com>'
__url__ = 'https://github.com/crash7/griffin-powermate'
__all__ = []
from griffin_powermate import * | 31.333333 | 59 | 0.718085 | 22 | 188 | 5.363636 | 0.863636 | 0.271186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024845 | 0.143617 | 188 | 6 | 60 | 31.333333 | 0.708075 | 0 | 0 | 0 | 0 | 0 | 0.465608 | 0.132275 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 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 |
6fcd19005d9f0c8dc04e8be2bcd4a496b3ee5923 | 74 | py | Python | tle_download/__init__.py | cognitive-space/tle-download | 86e9859eed1e87bf93f33471a665ad2567ebccca | [
"MIT"
] | null | null | null | tle_download/__init__.py | cognitive-space/tle-download | 86e9859eed1e87bf93f33471a665ad2567ebccca | [
"MIT"
] | null | null | null | tle_download/__init__.py | cognitive-space/tle-download | 86e9859eed1e87bf93f33471a665ad2567ebccca | [
"MIT"
] | null | null | null | __version__ = "0.1.0"
from tle_download.main import get_tles, write_tles
| 18.5 | 50 | 0.783784 | 13 | 74 | 3.923077 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046154 | 0.121622 | 74 | 3 | 51 | 24.666667 | 0.738462 | 0 | 0 | 0 | 0 | 0 | 0.067568 | 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 |
6fcfd615a77be7f31719c843dfcd485b0a7a9fe7 | 349 | py | Python | Olympiad Solutions/URI/1943.py | Ashwanigupta9125/code-DS-ALGO | 49f6cf7d0c682da669db23619aef3f80697b352b | [
"MIT"
] | 36 | 2019-12-27T08:23:08.000Z | 2022-01-24T20:35:47.000Z | Olympiad Solutions/URI/1943.py | Ashwanigupta9125/code-DS-ALGO | 49f6cf7d0c682da669db23619aef3f80697b352b | [
"MIT"
] | 10 | 2019-11-13T02:55:18.000Z | 2021-10-13T23:28:09.000Z | Olympiad Solutions/URI/1943.py | Ashwanigupta9125/code-DS-ALGO | 49f6cf7d0c682da669db23619aef3f80697b352b | [
"MIT"
] | 53 | 2020-08-15T11:08:40.000Z | 2021-10-09T15:51:38.000Z | # Ivan Carvalho
# Solution to https://www.urionlinejudge.com.br/judge/problems/view/1943
#!/usr/bin/env python2.7
# encoding : utf-8
e = int(raw_input())
if e == 1:
print "Top 1"
elif e <= 3:
print "Top 3"
elif e <= 5:
print "Top 5"
elif e <= 10:
print "Top 10"
elif e <= 25:
print "Top 25"
elif e <= 50:
print "Top 50"
else:
print "Top 100"
| 17.45 | 72 | 0.633238 | 65 | 349 | 3.384615 | 0.569231 | 0.254545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0.197708 | 349 | 19 | 73 | 18.368421 | 0.685714 | 0.355301 | 0 | 0 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.466667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
6fd10f3af083decdb2efd072cc80a08a18e55c62 | 66 | py | Python | algocoin/__init__.py | dendisuhubdy/algo-coin | e324f971cc0db5ebc29d04224d2fdeee13a31ac1 | [
"Apache-2.0"
] | 252 | 2017-09-01T21:36:08.000Z | 2022-01-08T15:48:31.000Z | algocoin/__init__.py | dendisuhubdy/algo-coin | e324f971cc0db5ebc29d04224d2fdeee13a31ac1 | [
"Apache-2.0"
] | 75 | 2017-10-10T01:01:19.000Z | 2020-05-04T11:03:20.000Z | algocoin/__init__.py | dendisuhubdy/algo-coin | e324f971cc0db5ebc29d04224d2fdeee13a31ac1 | [
"Apache-2.0"
] | 61 | 2017-08-31T07:22:25.000Z | 2022-01-08T15:48:38.000Z | from .main import main as run # noqa: F401
__version__ = '0.0.3'
| 22 | 43 | 0.681818 | 12 | 66 | 3.416667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113208 | 0.19697 | 66 | 2 | 44 | 33 | 0.660377 | 0.151515 | 0 | 0 | 0 | 0 | 0.092593 | 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 |
6fe5e32a34a80c26893983ec1a48a618f1bae5f3 | 781 | py | Python | shared.py | gattis/magnum-py | 98027eee373296030a118681a449629c57d85426 | [
"Unlicense"
] | null | null | null | shared.py | gattis/magnum-py | 98027eee373296030a118681a449629c57d85426 | [
"Unlicense"
] | null | null | null | shared.py | gattis/magnum-py | 98027eee373296030a118681a449629c57d85426 | [
"Unlicense"
] | null | null | null |
objects = {}
def instantiate():
# This function is called once during server startup. Modify the global 'objects' dict with of instantiated
# shared objects that you wish to store in the parent process and have access to from child request handler
# processes. Each object must support being shared via the multiproccessing module or else the object will
# just be copied into the children. See http://docs.python.org/library/multiprocessing.html
#
# For example, in this function you might put:
#
# import multiprocessing
# objects['num_requests'] = multiprocessing.Value('i',0)
#
# And in your request handler, put:
#
# from magnum.shared import objects
# objects['num_requests'].value += 1
return
| 27.892857 | 112 | 0.690141 | 102 | 781 | 5.264706 | 0.715686 | 0.044693 | 0.067039 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003361 | 0.238156 | 781 | 27 | 113 | 28.925926 | 0.89916 | 0.823303 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.333333 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
d2106f01efc43255c99ac9c1592bee8f1c926386 | 5,480 | py | Python | app/migrations/0002_appointment_doctor_patient_person_receptionist.py | sairamBikkina/sdp1 | e48cb01e8100259f95c16911f5fe6f843313464e | [
"MIT"
] | 5 | 2020-08-06T07:16:00.000Z | 2022-01-20T22:07:58.000Z | app/migrations/0002_appointment_doctor_patient_person_receptionist.py | sairamBikkina/sdp1 | e48cb01e8100259f95c16911f5fe6f843313464e | [
"MIT"
] | 2 | 2020-10-04T13:58:24.000Z | 2020-10-04T14:00:35.000Z | app/migrations/0002_appointment_doctor_patient_person_receptionist.py | sairamBikkina/sdp1 | e48cb01e8100259f95c16911f5fe6f843313464e | [
"MIT"
] | 3 | 2020-10-03T07:19:52.000Z | 2021-10-05T07:15:30.000Z | # Generated by Django 3.0.5 on 2020-05-24 10:19
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Person',
fields=[
(
'user',
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
primary_key=True,
serialize=False,
to=settings.AUTH_USER_MODEL,
),
),
('type', models.IntegerField(default=0)),
],
),
migrations.CreateModel(
name='Receptionist',
fields=[
(
'id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('Address', models.CharField(default=None, max_length=100)),
('Email', models.CharField(default=None, max_length=100)),
('Phone', models.CharField(default=None, max_length=100)),
('gender', models.CharField(default=None, max_length=100)),
(
'person',
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to='app.Person'
),
),
],
),
migrations.CreateModel(
name='Patient',
fields=[
(
'id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('location', models.CharField(blank=True, default='', max_length=500)),
('bio', models.CharField(blank=True, max_length=500)),
('Address', models.CharField(default=None, max_length=100)),
('Email', models.CharField(default=None, max_length=100)),
('Phone', models.CharField(default=None, max_length=100)),
('gender', models.CharField(default=None, max_length=100)),
(
'person',
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to='app.Person'
),
),
],
),
migrations.CreateModel(
name='Doctor',
fields=[
(
'id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('Speciality', models.CharField(default=None, max_length=100)),
('Address', models.CharField(default=None, max_length=100)),
('Email', models.CharField(default=None, max_length=100)),
('Phone', models.CharField(default=None, max_length=100)),
('gender', models.CharField(default=None, max_length=100)),
(
'person',
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to='app.Person'
),
),
],
),
migrations.CreateModel(
name='Appointment',
fields=[
(
'id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
(
'Date',
models.DateField(default=datetime.date.today, verbose_name='Date'),
),
(
'status',
models.CharField(
choices=[
('PD', 'Pending'),
('AP', 'Approved'),
('RJ', 'rejected'),
],
default='PD',
max_length=2,
),
),
(
'message',
models.CharField(default='Pending Approval', max_length=1000),
),
(
'Doctor',
models.ForeignKey(
default=None,
on_delete=django.db.models.deletion.CASCADE,
to='app.Doctor',
),
),
(
'user',
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
),
]
| 34.683544 | 87 | 0.387044 | 371 | 5,480 | 5.603774 | 0.234501 | 0.122655 | 0.148148 | 0.162578 | 0.664743 | 0.630111 | 0.630111 | 0.611833 | 0.593074 | 0.545936 | 0 | 0.026042 | 0.509489 | 5,480 | 157 | 88 | 34.904459 | 0.747396 | 0.008212 | 0 | 0.68 | 1 | 0 | 0.056507 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.026667 | 0 | 0.046667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d2233790f33ba2cc856d503da044f2647bccf7b5 | 237 | py | Python | pymodule1/Hello1.py | debjava/pymodule1 | 8e5f63660f0b835709896cc50ed1147b386422a2 | [
"MIT"
] | null | null | null | pymodule1/Hello1.py | debjava/pymodule1 | 8e5f63660f0b835709896cc50ed1147b386422a2 | [
"MIT"
] | null | null | null | pymodule1/Hello1.py | debjava/pymodule1 | 8e5f63660f0b835709896cc50ed1147b386422a2 | [
"MIT"
] | null | null | null | '''
Created on Mar 30, 2019
@author: PIKU
'''
def justSayHello():
print("Hello ...")
def getHello():
return "Hello guys"
if __name__ == '__main__':
justSayHello()
x = getHello()
print(x)
| 11.85 | 27 | 0.523207 | 24 | 237 | 4.833333 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0375 | 0.324895 | 237 | 19 | 28 | 12.473684 | 0.6875 | 0.160338 | 0 | 0 | 0 | 0 | 0.156977 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.125 | 0.375 | 0.25 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
d24ee59db0447d71e371a28fd126b436b147eeac | 992 | py | Python | testg.py | dcn01/AndroidDropFrameAnalysis | 630d75dc999a8d1e4eec71edc0a1220334166d0a | [
"MIT"
] | 2 | 2018-12-10T03:49:03.000Z | 2018-12-10T13:43:26.000Z | testg.py | dcn01/AndroidDropFrameAnalysis | 630d75dc999a8d1e4eec71edc0a1220334166d0a | [
"MIT"
] | null | null | null | testg.py | dcn01/AndroidDropFrameAnalysis | 630d75dc999a8d1e4eec71edc0a1220334166d0a | [
"MIT"
] | null | null | null | # fpsAllFrameRead = open("profileAllFrame.txt", "r")
# profileDataReadList =[]
# t = []
# for line in fpsAllFrameRead.readlines():
# profileDataReadList.append(line)
#
# for line in profileDataReadList:
# splitByComma = line.split(",")
# l = len(splitByComma)
# print str(l)
a = 34.4/(1000/60)
print str(a)
# fin = ""
# c = 0
# e = len(willBeInsertIntoSqlList)
# for tmplist in willBeInsertIntoSqlList:
# splitByT = tmplist.split("\t")
# if c==0:
# fin = fin +"{"
#
# if c==e -1:
# fin = fin+str(c)+":{\"Draw\":"+splitByT[1]+",\"Prepare\":"+splitByT[2]+",\"Process\":"+splitByT[3]+",\"Execute\":"+splitByT[4].strip()+"}}"
# else:
# fin = fin+str(c)+":{\"Draw\":"+splitByT[1]+",\"Prepare\":"+splitByT[2]+",\"Process\":"+splitByT[3]+",\"Execute\":"+splitByT[4].strip()+"},"
#
# c = c+1
# fin = "var person_data = "+fin+";\nvar svg_width = 88350;"
# dataWrite = open("./output/js/data.js", "w")
# dataWrite.write(fin)
| 31 | 149 | 0.5625 | 116 | 992 | 4.793103 | 0.448276 | 0.032374 | 0.032374 | 0.035971 | 0.273381 | 0.273381 | 0.273381 | 0.273381 | 0.273381 | 0.273381 | 0 | 0.032178 | 0.185484 | 992 | 31 | 150 | 32 | 0.655941 | 0.910282 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
d26a2cfd9b0c9f91c37793b0017bd2b85c25f09b | 1,060 | py | Python | portal_gun/configuration/schemas/compute_aws.py | Coderik/portal-gun | 081020a46b16b649497bceb6c2435b1ba135b487 | [
"MIT"
] | 69 | 2018-05-03T18:25:43.000Z | 2021-02-10T11:37:28.000Z | portal_gun/configuration/schemas/compute_aws.py | Coderik/portal-gun | 081020a46b16b649497bceb6c2435b1ba135b487 | [
"MIT"
] | 7 | 2018-09-19T06:39:11.000Z | 2022-03-29T21:55:08.000Z | portal_gun/configuration/schemas/compute_aws.py | Coderik/portal-gun | 081020a46b16b649497bceb6c2435b1ba135b487 | [
"MIT"
] | 11 | 2018-07-30T18:09:12.000Z | 2019-10-03T15:36:13.000Z | from marshmallow import fields, Schema
from .provision import ProvisionActionSchema
class InstanceSchema(Schema):
type = fields.String(required=True)
image_id = fields.String(required=True)
availability_zone = fields.String(required=True)
ebs_optimized = fields.Boolean()
iam_fleet_role = fields.String(required=True)
class Meta:
ordered = True
class AuthSchema(Schema):
key_pair_name = fields.String(required=True)
identity_file = fields.String(required=True)
user = fields.String(required=True)
group = fields.String(required=True)
class Meta:
ordered = True
class NetworkSchema(Schema):
security_group_id = fields.String(required=True)
subnet_id = fields.String()
class Meta:
ordered = True
class ComputeAwsSchema(Schema):
provider = fields.String(required=True)
instance = fields.Nested(InstanceSchema, required=True)
auth = fields.Nested(AuthSchema, required=True)
network = fields.Nested(NetworkSchema, required=True)
provision_actions = fields.Nested(ProvisionActionSchema, many=True)
class Meta:
ordered = True
| 24.090909 | 68 | 0.779245 | 129 | 1,060 | 6.310078 | 0.341085 | 0.191646 | 0.2457 | 0.29484 | 0.244472 | 0.120393 | 0.120393 | 0.120393 | 0.120393 | 0 | 0 | 0 | 0.122642 | 1,060 | 43 | 69 | 24.651163 | 0.875269 | 0 | 0 | 0.266667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.866667 | 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 |
9636f9d68fd104dbb3836b714d906a33ec4f48ed | 15,812 | py | Python | rssynergia/base_diagnostics/read_bunch.py | radiasoft/rs_synergia | b43509de7f4a938354dc127762d8e723463e0e95 | [
"Apache-2.0"
] | null | null | null | rssynergia/base_diagnostics/read_bunch.py | radiasoft/rs_synergia | b43509de7f4a938354dc127762d8e723463e0e95 | [
"Apache-2.0"
] | null | null | null | rssynergia/base_diagnostics/read_bunch.py | radiasoft/rs_synergia | b43509de7f4a938354dc127762d8e723463e0e95 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""?
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
#import argparse
#import tables
from mpi4py import MPI
import h5py
import inspect
import numpy as np
import os
import synergia
# load the particles that will be used for the simulation
# The particles file is a text file with particle coordinates
# defined with the MAD-X conventions: X PX Y PY T PT
# Read this in using numpy's loadtxt command
# particle coordinates are converted to Synergia conventions
# input arguments:
# particles_file: the file name
# reference particle: the lattice reference particle for kinematic conversions
# num_real_particles: the number of real particles in the bunch
# bucket_length: the longitudinal length of the bucket
# comm: the Commxx communicator object for this bunch
# verbose: be chatty about what's happening
#
def read_bunch(particles, refpart, real_particles, comm, bucket_length = None, verbose=False):
'''
Read a bunch from file (either .txt, .h5, or .mxtxt (MAD-X txt file)) and construct a Synergia bunch object.
Arguments:
- particles (string or np.ndarray): EITHER a file containing particles coordinates OR an ndarray of coordinates
- refpart (synergia.foundation.foundation.Reference_particle): the Synergia reference particle describing the bunch
- num_real_particles (float): the number of real particles
- comm (synergia.utils.parallel_utils.Commxx): the Commxx communicator object for this bunch
- bucket_length (Optional[float]): if specified, the longitudinal length of the bucket in m
- verbose (Optional[Boolean]): Flag for verbose feedback
Returns:
-bunch: A Synergia bunch object is created in the current session
'''
#first attempt to load the particles as an h5 file
try:
return read_h5_particles(particles, refpart, real_particles, bucket_length, comm, verbose)
#it's not an h5 file - then there are two possibilities:
#1. It's another sort of file, in which case, an IOError will be thrown
#2. It's a numpy array, in which case a TypeError will be thrown
#Therefore, we will catch the IOErrror and process it as an input file to check if it's a legible text file
#Then we will catch the possible TypeError and process it for being a numpy array
except IOError:
#IOError, so it's a file but not an .h5 file
name,extension = os.path.splitext(particles)
#assuming no error is thrown, we continue processing the file - whihc should be now either a .txt or .mxtxt
assert extension == '.txt' or extension == '.mxtxt', \
"Supported file types are hdf5 (.h5) and plain text (.txt/.mxtxt)"
return read_txt_particles(particles, refpart, real_particles, bucket_length, comm, extension == '.mxtxt', verbose)
except TypeError:
#TypeError, so it's not a file - so we should check if it's a numpy array
#Had we checked the .txt read first, it would have return an AttributeError
assert isinstance(particles, np.ndarray), \
"Supported data types are numpy arrays only."
return read_array_particles(particles, refpart, real_particles, bucket_length, comm, verbose)
#====================================================================
# if madx_format is True, the particles are in madX units, otherwise they are in
# synergia units
def read_txt_particles(particles_file, refpart, real_particles, bucket_length, comm, madx_format, verbose):
"""Read an array of particles from a text file"""
four_momentum = refpart.get_four_momentum()
pmass = four_momentum.get_mass()
E_0 = four_momentum.get_total_energy()
p0c = four_momentum.get_momentum()
myrank = comm.get_rank()
mpisize = comm.get_size()
if myrank==0 and verbose:
if madx_format:
print("Loading madX particles from txt file: ", particles_file)
else:
print("Loading Synergia particles from txt file: ", particles_file)
if myrank == 0:
particles = np.loadtxt(particles_file)
num_total_particles = particles.shape[0]
# broadcast num particles to all nodes
MPI.COMM_WORLD.bcast(num_total_particles, root=0)
else:
num_total_particles = None
num_total_particles = MPI.COMM_WORLD.bcast(num_total_particles, root=0)
if myrank == 0:
# make sure the data has the correct shape, either [n,6] without
# particles IDs or [n,7] with particle IDs.
if (particles.shape[1] != 6) and (particles.shape[1] != 7):
raise RuntimeError, "input data shape %shas incorrect number of particle coordinates"%repr(particles.shape)
if madx_format:
# numpy manipulations to convert kinematics
# convert MAD-X T=-c*dt to Synergia c*ct
particles[:,4] = -particles[:,4]
# convert MAD-X Delta-E/pc to Synergia delta-p/p
# sqrt(((dE/p0c)+(E0/p0c))**2 - (m/p0c)**2) - (p0c/p0c)
m_over_pc = pmass/p0c
E_0_over_pc = E_0/p0c
particles[:,5] = np.sqrt( (particles[:,5] + E_0_over_pc) *
(particles[:,5] + E_0_over_pc) - m_over_pc**2 ) - 1.0
# if there are no IDs, append particle ID column
if particles.shape[1] != 7:
particles_w_id = np.column_stack((particles,
np.arange(num_total_particles, dtype='d')))
else:
particles_w_id = particles
if myrank == 0:
print("Read ", num_total_particles, " particles")
#Note: Synergia bunch constructor updated - commit 077b99d7 - 11/17/2016
#Using old constructor throws an ArgumentError of a non-standard type.
# Using a try and except to handle both instances.
try:
# try the original constructor
bunch = synergia.bunch.Bunch(
refpart,
num_total_particles, real_particles, comm,
bucket_length)
except Exception, e:
#look to see if it's an ArgumentError by evaluating the traceback
if (not str(e).startswith("Python argument types in")):
raise
else:
# use the new constructor
if verbose:
print("Using updated bunch constructor")
bunch = synergia.bunch.Bunch(
refpart,
num_total_particles, real_particles, comm)
# now set the new parameter 'z_period_length'
if bucket_length is not None:
bunch.set_z_period_length(bucket_length)
else:
bucket_length = 1. #fix this quantity
local_num = bunch.get_local_num()
local_particles = bunch.get_local_particles()
# Each processor will have a possibly different number of local particles.
# rank 0 has to find out how many each of them has and distribute them
n_particles_by_proc = MPI.COMM_WORLD.gather(local_num, 0)
if myrank == 0:
# copy in my particles
this_rank_start = 0
local_particles[:,:] = particles_w_id[0:local_num, :]
this_rank_start += local_num
# send particles out to other ranks
for r in range(1, mpisize):
this_rank_end = this_rank_start+n_particles_by_proc[r]
MPI.COMM_WORLD.send(obj=particles_w_id[this_rank_start:this_rank_end, :],
dest=r)
this_rank_start += n_particles_by_proc[r]
else:
# I'm not rank 0. Receive my particles
lp = MPI.COMM_WORLD.recv(source=0)
local_particles[:,:] = lp[:,:]
return bunch
#==========================================================
def read_h5_particles(particles_file, refpart, real_particles, bucket_length, comm, verbose):
"""Read an array of particles from an HDF-5 file"""
four_momentum = refpart.get_four_momentum()
pmass = four_momentum.get_mass()
E_0 = four_momentum.get_total_energy()
p0c = four_momentum.get_momentum()
myrank = comm.get_rank()
mpisize = comm.get_size()
if myrank==0 and verbose:
print("Loading particles from h5 file: ", particles_file)
if myrank == 0:
#h5 = tables.open_file(particles_file)
h5 = h5py.File(particles_file)
# use explicit int conversion otherwise there seems to
# be a typepython->C++ type mismatch of numpy.int64->int
#num_total_particles = int(h5.root.particles.shape[0])
num_total_particles = int(h5['particles'].shape[0])
if verbose:
print("Total of ", num_total_particles, " particles from file")
# broadcast num particles to all nodes
MPI.COMM_WORLD.bcast(num_total_particles, root=0)
else:
num_total_particles = None
num_total_particles = MPI.COMM_WORLD.bcast(num_total_particles, root=0)
if myrank == 0:
particles = h5['particles']
# make sure the data has the correct shape, either [n,6] without
# particles IDs or [n,7] with particle IDs.
if (particles.shape[1] != 7):
raise RuntimeError, "input data shape %shas incorrect number of particle coordinates"%repr(particles.shape)
#Note: Synergia bunch constructor updated - commit 077b99d7 - 11/17/2016
#Using old constructor throws an ArgumentError of a non-standard type.
# Using a try and except to handle both instances.
try:
# try the original constructor
bunch = synergia.bunch.Bunch(
refpart,
num_total_particles, real_particles, comm,
bucket_length)
except Exception, e:
#look to see if it's an ArgumentError by evaluating the traceback
if (not str(e).startswith("Python argument types in")):
raise
else:
# use the new constructor
if verbose:
print("Using updated bunch constructor")
bunch = synergia.bunch.Bunch(
refpart,
num_total_particles, real_particles, comm)
# now set the new parameter 'z_period_length'
if bucket_length is not None:
bunch.set_z_period_length(bucket_length)
else:
bucket_length = 1. #fix this quantity
local_num = bunch.get_local_num()
local_particles = bunch.get_local_particles()
# Each processor will have a possibly different number of local particles.
# rank 0 has to find out how many each of them has and distribute them
n_particles_by_proc = MPI.COMM_WORLD.gather(local_num, 0)
if myrank == 0:
# copy in my particles
this_rank_start = 0
local_particles[:,:] = particles[0:local_num, :]
this_rank_start += local_num
# send particles out to other ranks
for r in range(1, mpisize):
this_rank_end = this_rank_start+n_particles_by_proc[r]
MPI.COMM_WORLD.send(obj=particles[this_rank_start:this_rank_end, :],
dest=r)
this_rank_start += n_particles_by_proc[r]
else:
# I'm not rank 0. Receive my particles
lp = MPI.COMM_WORLD.recv(source=0)
local_particles[:,:] = lp[:,:]
return bunch
#==========================================================
def read_array_particles(particle_array, refpart, real_particles, bucket_length, comm, verbose):
"""Read an array of particles coordinates from memory"""
four_momentum = refpart.get_four_momentum()
pmass = four_momentum.get_mass()
E_0 = four_momentum.get_total_energy()
p0c = four_momentum.get_momentum()
myrank = comm.get_rank()
mpisize = comm.get_size()
if myrank==0 and verbose:
print("Loading particles from: ".format(particle_array))
if myrank == 0:
# use explicit int conversion otherwise there seems to
# be a typepython->C++ type mismatch of numpy.int64->int
#num_total_particles = int(h5.root.particles.shape[0])
num_total_particles = particle_array.shape[0]
if verbose:
print("Total of ", num_total_particles, " particles")
# broadcast num particles to all nodes
MPI.COMM_WORLD.bcast(num_total_particles, root=0)
else:
num_total_particles = None
num_total_particles = MPI.COMM_WORLD.bcast(num_total_particles, root=0)
if myrank == 0:
particles = particle_array
# make sure the data has the correct shape, either [n,6] without
# particles IDs or [n,7] with particle IDs.
if (particle_array.shape[1] != 7):
raise RuntimeError, "input data shape %shas incorrect number of particle coordinates"%repr(particles.shape)
#Note: Synergia bunch constructor updated - commit 077b99d7 - 11/17/2016
#Using old constructor throws an ArgumentError of a non-standard type.
# Using a try and except to handle both instances.
try:
# try the original constructor
bunch = synergia.bunch.Bunch(
refpart,
num_total_particles, real_particles, comm,
bucket_length)
except Exception, e:
#look to see if it's an ArgumentError by evaluating the traceback
if (not str(e).startswith("Python argument types in")):
raise
else:
# use the new constructor
if verbose:
print("Using updated bunch constructor")
bunch = synergia.bunch.Bunch(
refpart,
num_total_particles, real_particles, comm)
# now set the new parameter 'z_period_length'
if bucket_length is not None:
bunch.set_z_period_length(bucket_length)
else:
bucket_length = 1. #fix this quantity
local_num = bunch.get_local_num()
local_particles = bunch.get_local_particles()
# Each processor will have a possibly different number of local particles.
# rank 0 has to find out how many each of them has and distribute them
n_particles_by_proc = MPI.COMM_WORLD.gather(local_num, 0)
if myrank == 0:
# copy in my particles
this_rank_start = 0
local_particles[:,:] = particle_array[0:local_num, :]
this_rank_start += local_num
# send particles out to other ranks
for r in range(1, mpisize):
this_rank_end = this_rank_start+n_particles_by_proc[r]
MPI.COMM_WORLD.send(obj=particles[this_rank_start:this_rank_end, :],
dest=r)
this_rank_start += n_particles_by_proc[r]
else:
# I'm not rank 0. Receive my particles
lp = MPI.COMM_WORLD.recv(source=0)
local_particles[:,:] = lp[:,:]
return bunch
#================================================================
def print_bunch_stats(bunch):
coord_names = ("x", "xp", "y", "yp", "c*dt", "dp/p")
myrank = bunch.get_comm().get_rank()
means = synergia.bunch.Core_diagnostics().calculate_mean(bunch)
stds = synergia.bunch.Core_diagnostics().calculate_std(bunch, means)
if myrank == 0:
print("%20s %20s %20s"%("coord","mean","rms"))
print("%20s %20s %20s"%("====================",)
"====================",
"====================")
for i in range(6):
print("%20s %20.12e %20.12e"%(coord_names[i], means[i], stds[i]))
#=========================================================
| 41.177083 | 142 | 0.623893 | 2,052 | 15,812 | 4.643275 | 0.165205 | 0.02267 | 0.048174 | 0.015113 | 0.684719 | 0.661629 | 0.640533 | 0.628463 | 0.622796 | 0.601595 | 0 | 0.016493 | 0.271439 | 15,812 | 383 | 143 | 41.284595 | 0.81059 | 0.291424 | 0 | 0.706161 | 0 | 0 | 0.08535 | 0 | 0 | 0 | 0 | 0 | 0.009479 | 0 | null | null | 0 | 0.033175 | null | null | 0.07109 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
96395cbf1fcfecb1f1e6a9078b9555cfe006e998 | 2,625 | py | Python | basic_algorithm/draw/draw.py | Quanfita/ImageProcessing | 2a7c1d093a003c43d6d259f6e8db3b4e6163839b | [
"MIT"
] | null | null | null | basic_algorithm/draw/draw.py | Quanfita/ImageProcessing | 2a7c1d093a003c43d6d259f6e8db3b4e6163839b | [
"MIT"
] | null | null | null | basic_algorithm/draw/draw.py | Quanfita/ImageProcessing | 2a7c1d093a003c43d6d259f6e8db3b4e6163839b | [
"MIT"
] | null | null | null | import cv2
import numpy as np
def drawPoint(canvas,x,y):
canvas[y,x] = 0
def drawLine(canvas,x1,y1,x2,y2):
dx, dy = abs(x2 - x1), abs(y2 - y1)
xi, yi = x1, y1
sx, sy = 1 if (x2 - x1) > 0 else -1, 1 if (y2 - y1) > 0 else -1
pi = 2*dy - dx
while xi != x2 + 1:
if pi < 0:
pi += 2 * dy
else:
pi += 2 * dy - 2 * dx
yi += 1 * sy
drawPoint(canvas,xi,yi)
xi += 1 * sx
def drawCircle(canvas,x,y,r):
x0, y0 = x, y
xi = 0
yi = r
pi = 5/4 - r
while xi <= yi:
if pi < 0:
pi += 2 * (xi + 1) + 1
else:
pi += 2 * (xi + 1) + 1 - 2 * (yi - 1)
yi -= 1
drawPoint(canvas,xi+x0,yi+y0)
drawPoint(canvas,-xi+x0,yi+y0)
drawPoint(canvas,xi+x0,-yi+y0)
drawPoint(canvas,-xi+x0,-yi+y0)
xi += 1
xi = r
yi = 0
pi = 5/4 - r
while not (xi == yi+1 or xi == yi):
if pi < 0:
pi += 2 * (yi + 1) + 1
else:
pi += 2 * (yi + 1) + 1 - 2 * (xi - 1)
xi -= 1
drawPoint(canvas,xi+x0,yi+y0)
drawPoint(canvas,-xi+x0,yi+y0)
drawPoint(canvas,xi+x0,-yi+y0)
drawPoint(canvas,-xi+x0,-yi+y0)
yi += 1
def drawEllipse(canvas,x,y,rx,ry):
x0, y0 = x, y
xi, yi = 0, ry
rx2 = rx ** 2
ry2 = ry ** 2
p1i = ry2 - rx2 * ry + rx2 / 4
while 2*ry2*xi < 2*rx2*yi:
if p1i < 0:
p1i += 2 * ry2 * (xi + 1) + ry2
else:
p1i += 2 * ry2 * (xi + 1) - 2* rx2 * (yi - 1) + ry2
yi -= 1
drawPoint(canvas,xi+x0,yi+y0)
drawPoint(canvas,-xi+x0,yi+y0)
drawPoint(canvas,xi+x0,-yi+y0)
drawPoint(canvas,-xi+x0,-yi+y0)
xi += 1
xi -= 1
p2i = ry2 * (xi + .5) ** 2 + rx2 * (yi - 1) ** 2 - rx2 * ry2
while yi >= 0:
if p2i > 0:
p2i += -2 * rx2 * (yi - 1) + rx2
else:
p2i += 2 * ry2 * (xi + 1) - 2 * rx2 * (yi - 1) + rx2
xi += 1
drawPoint(canvas,xi+x0,yi+y0)
drawPoint(canvas,-xi+x0,yi+y0)
drawPoint(canvas,xi+x0,-yi+y0)
drawPoint(canvas,-xi+x0,-yi+y0)
yi -= 1
if __name__ == '__main__':
canvas = np.ones([1000,1000],dtype=np.uint8) * 255
drawLine(canvas,800,100,100,600)
cv2.imwrite('line.png',canvas)
canvas = np.ones([1000,1000],dtype=np.uint8) * 255
drawCircle(canvas,500,500,300)
cv2.imwrite('circle.png',canvas)
canvas = np.ones([1000,1000],dtype=np.uint8) * 255
drawEllipse(canvas,500,500,100,200)
cv2.imwrite('ellipse.png',canvas) | 27.061856 | 67 | 0.459429 | 415 | 2,625 | 2.886747 | 0.149398 | 0.225376 | 0.241235 | 0.253756 | 0.5601 | 0.476628 | 0.476628 | 0.456594 | 0.433222 | 0.404007 | 0 | 0.137077 | 0.369143 | 2,625 | 97 | 68 | 27.061856 | 0.586353 | 0 | 0 | 0.448276 | 0 | 0 | 0.01409 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.045977 | false | 0 | 0.022989 | 0 | 0.068966 | 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 |
963c560293977e228cb5a3afa7c8d254adb111f7 | 956 | py | Python | ads/feature_engineering/adsstring/parsers/base.py | oracle/accelerated-data-science | d594ed0c8c1365daf4cf9e860daebc760fa9a24b | [
"UPL-1.0",
"Apache-2.0"
] | 20 | 2022-02-22T19:07:09.000Z | 2022-03-16T17:21:42.000Z | ads/feature_engineering/adsstring/parsers/base.py | oracle/accelerated-data-science | d594ed0c8c1365daf4cf9e860daebc760fa9a24b | [
"UPL-1.0",
"Apache-2.0"
] | null | null | null | ads/feature_engineering/adsstring/parsers/base.py | oracle/accelerated-data-science | d594ed0c8c1365daf4cf9e860daebc760fa9a24b | [
"UPL-1.0",
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*--
# Copyright (c) 2021, 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
class Parser:
@property
def pos(self):
raise NotImplementedError()
@property
def noun(self):
raise NotImplementedError()
@property
def adjective(self):
raise NotImplementedError()
@property
def adverb(self):
raise NotImplementedError()
@property
def verb(self):
raise NotImplementedError()
@property
def word(self):
raise NotImplementedError()
@property
def sentence(self):
raise NotImplementedError()
@property
def word_count(self):
raise NotImplementedError()
@property
def bigram(self):
raise NotImplementedError()
@property
def trigram(self):
raise NotImplementedError()
| 19.916667 | 104 | 0.639121 | 97 | 956 | 6.28866 | 0.515464 | 0.180328 | 0.459016 | 0.531148 | 0.588525 | 0.140984 | 0 | 0 | 0 | 0 | 0 | 0.015647 | 0.264644 | 956 | 47 | 105 | 20.340426 | 0.852063 | 0.210251 | 0 | 0.645161 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.322581 | false | 0 | 0 | 0 | 0.354839 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
964fab6dbeeb71e25e526001be717823ea172dc3 | 32 | py | Python | backend/appengine/routes/gallerys/model.py | SamaraCardoso27/eMakeup | 02c3099aca85b5f54214c3a32590e80eb61621e7 | [
"MIT"
] | null | null | null | backend/appengine/routes/gallerys/model.py | SamaraCardoso27/eMakeup | 02c3099aca85b5f54214c3a32590e80eb61621e7 | [
"MIT"
] | null | null | null | backend/appengine/routes/gallerys/model.py | SamaraCardoso27/eMakeup | 02c3099aca85b5f54214c3a32590e80eb61621e7 | [
"MIT"
] | null | null | null | __author__ = 'Samara Cardoso'
| 8 | 29 | 0.71875 | 3 | 32 | 6.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | 32 | 3 | 30 | 10.666667 | 0.730769 | 0 | 0 | 0 | 0 | 0 | 0.466667 | 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 |
96588284712f2b02b4c2431118e6f0abd22431a0 | 8,331 | py | Python | tests/python/pants_test/base/test_cmd_line_spec_parser.py | dturner-tw/pants | 3a04f2e46bf2b8fb0a7999c09e4ffdf9057ed33f | [
"Apache-2.0"
] | null | null | null | tests/python/pants_test/base/test_cmd_line_spec_parser.py | dturner-tw/pants | 3a04f2e46bf2b8fb0a7999c09e4ffdf9057ed33f | [
"Apache-2.0"
] | null | null | null | tests/python/pants_test/base/test_cmd_line_spec_parser.py | dturner-tw/pants | 3a04f2e46bf2b8fb0a7999c09e4ffdf9057ed33f | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
from pants.base.cmd_line_spec_parser import CmdLineSpecParser
from pants.build_graph.address import Address
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.build_graph.target import Target
from pants_test.base_test import BaseTest
class CmdLineSpecParserTest(BaseTest):
@property
def alias_groups(self):
return BuildFileAliases(
targets={
'generic': Target
}
)
def setUp(self):
super(CmdLineSpecParserTest, self).setUp()
def add_target(path, name):
self.add_to_build_file(path, 'generic(name="{name}")\n'.format(name=name))
add_target('BUILD', 'root')
add_target('a', 'a')
add_target('a', 'b')
add_target('a/b', 'b')
add_target('a/b', 'c')
self.spec_parser = CmdLineSpecParser(self.build_root, self.address_mapper)
def test_normal(self):
self.assert_parsed(cmdline_spec=':root', expected=[':root'])
self.assert_parsed(cmdline_spec='//:root', expected=[':root'])
self.assert_parsed(cmdline_spec='a', expected=['a'])
self.assert_parsed(cmdline_spec='a:a', expected=['a'])
self.assert_parsed(cmdline_spec='a/b', expected=['a/b'])
self.assert_parsed(cmdline_spec='a/b:b', expected=['a/b'])
self.assert_parsed(cmdline_spec='a/b:c', expected=['a/b:c'])
def test_sibling(self):
self.assert_parsed(cmdline_spec=':', expected=[':root'])
self.assert_parsed(cmdline_spec='//:', expected=[':root'])
self.assert_parsed(cmdline_spec='a:', expected=['a', 'a:b'])
self.assert_parsed(cmdline_spec='//a:', expected=['a', 'a:b'])
self.assert_parsed(cmdline_spec='a/b:', expected=['a/b', 'a/b:c'])
self.assert_parsed(cmdline_spec='//a/b:', expected=['a/b', 'a/b:c'])
def test_sibling_or_descendents(self):
self.assert_parsed(cmdline_spec='::', expected=[':root', 'a', 'a:b', 'a/b', 'a/b:c'])
self.assert_parsed(cmdline_spec='//::', expected=[':root', 'a', 'a:b', 'a/b', 'a/b:c'])
self.assert_parsed(cmdline_spec='a::', expected=['a', 'a:b', 'a/b', 'a/b:c'])
self.assert_parsed(cmdline_spec='//a::', expected=['a', 'a:b', 'a/b', 'a/b:c'])
self.assert_parsed(cmdline_spec='a/b::', expected=['a/b', 'a/b:c'])
self.assert_parsed(cmdline_spec='//a/b::', expected=['a/b', 'a/b:c'])
def test_absolute(self):
self.assert_parsed(cmdline_spec=os.path.join(self.build_root, 'a'), expected=['a'])
self.assert_parsed(cmdline_spec=os.path.join(self.build_root, 'a:a'), expected=['a'])
self.assert_parsed(cmdline_spec=os.path.join(self.build_root, 'a:'), expected=['a', 'a:b'])
self.assert_parsed(cmdline_spec=os.path.join(self.build_root, 'a::'),
expected=['a', 'a:b', 'a/b', 'a/b:c'])
double_absolute = '/' + os.path.join(self.build_root, 'a')
self.assertEquals('//', double_absolute[:2],
'A sanity check we have a leading-// absolute spec')
with self.assertRaises(self.spec_parser.BadSpecError):
self.spec_parser.parse_addresses(double_absolute).next()
with self.assertRaises(self.spec_parser.BadSpecError):
self.spec_parser.parse_addresses('/not/the/buildroot/a').next()
def test_cmd_line_affordances(self):
self.assert_parsed(cmdline_spec='./:root', expected=[':root'])
self.assert_parsed(cmdline_spec='//./:root', expected=[':root'])
self.assert_parsed(cmdline_spec='//./a/../:root', expected=[':root'])
self.assert_parsed(cmdline_spec=os.path.join(self.build_root, './a/../:root'),
expected=[':root'])
self.assert_parsed(cmdline_spec='a/', expected=['a'])
self.assert_parsed(cmdline_spec='./a/', expected=['a'])
self.assert_parsed(cmdline_spec=os.path.join(self.build_root, './a/'), expected=['a'])
self.assert_parsed(cmdline_spec='a/b/:b', expected=['a/b'])
self.assert_parsed(cmdline_spec='./a/b/:b', expected=['a/b'])
self.assert_parsed(cmdline_spec=os.path.join(self.build_root, './a/b/:b'), expected=['a/b'])
def test_cmd_line_spec_list(self):
self.assert_parsed_list(cmdline_spec_list=['a', 'a/b'], expected=['a', 'a/b'])
self.assert_parsed_list(cmdline_spec_list=['::'], expected=[':root', 'a', 'a:b', 'a/b', 'a/b:c'])
def test_does_not_exist(self):
with self.assertRaises(self.spec_parser.BadSpecError):
self.spec_parser.parse_addresses('c').next()
with self.assertRaises(self.spec_parser.BadSpecError):
self.spec_parser.parse_addresses('c:').next()
with self.assertRaises(self.spec_parser.BadSpecError):
self.spec_parser.parse_addresses('c::').next()
def assert_parsed(self, cmdline_spec, expected):
def sort(addresses):
return sorted(addresses, key=lambda address: address.spec)
self.assertEqual(sort(Address.parse(addr) for addr in expected),
sort(self.spec_parser.parse_addresses(cmdline_spec)))
def assert_parsed_list(self, cmdline_spec_list, expected):
def sort(addresses):
return sorted(addresses, key=lambda address: address.spec)
self.assertEqual(sort(Address.parse(addr) for addr in expected),
sort(self.spec_parser.parse_addresses(cmdline_spec_list)))
def test_spec_excludes(self):
expected_specs = [':root', 'a', 'a:b', 'a/b', 'a/b:c']
# This bogus BUILD file gets in the way of parsing.
self.add_to_build_file('some/dir', 'COMPLETELY BOGUS BUILDFILE)\n')
with self.assertRaises(CmdLineSpecParser.BadSpecError):
self.assert_parsed_list(cmdline_spec_list=['::'], expected=expected_specs)
# Test absolute path in spec_excludes.
self.spec_parser = CmdLineSpecParser(self.build_root, self.address_mapper,
spec_excludes=[os.path.join(self.build_root, 'some')])
self.assert_parsed_list(cmdline_spec_list=['::'], expected=expected_specs)
# Test relative path in spec_excludes.
self.spec_parser = CmdLineSpecParser(self.build_root, self.address_mapper,
spec_excludes=['some'])
self.assert_parsed_list(cmdline_spec_list=['::'], expected=expected_specs)
def test_exclude_target_regexps(self):
expected_specs = [':root', 'a', 'a:b', 'a/b', 'a/b:c']
# This bogus BUILD file gets in the way of parsing.
self.add_to_build_file('some/dir', 'COMPLETELY BOGUS BUILDFILE)\n')
with self.assertRaises(CmdLineSpecParser.BadSpecError):
self.assert_parsed_list(cmdline_spec_list=['::'], expected=expected_specs)
self.spec_parser = CmdLineSpecParser(self.build_root, self.address_mapper,
exclude_target_regexps=[r'.*some/dir.*'])
self.assert_parsed_list(cmdline_spec_list=['::'], expected=expected_specs)
class CmdLineSpecParserBadBuildTest(BaseTest):
def setUp(self):
super(CmdLineSpecParserBadBuildTest, self).setUp()
self.add_to_build_file('bad/a', 'a_is_bad')
self.add_to_build_file('bad/b', 'b_is_bad')
self.spec_parser = CmdLineSpecParser(self.build_root, self.address_mapper)
self.NO_FAIL_FAST_RE = re.compile(r"""^--------------------
.*
Exception message: name 'a_is_bad' is not defined
while executing BUILD file BuildFile\((/[^/]+)*/bad/a/BUILD, FileSystemProjectTree\(.*\)\)
Loading addresses from 'bad/a' failed\.
.*
Exception message: name 'b_is_bad' is not defined
while executing BUILD file BuildFile\((/[^/]+)*T/bad/b/BUILD, FileSystemProjectTree\(.*\)\)
Loading addresses from 'bad/b' failed\.
Invalid BUILD files for \[::\]$""", re.DOTALL)
self.FAIL_FAST_RE = """^name 'a_is_bad' is not defined
while executing BUILD file BuildFile\((/[^/]+)*/bad/a/BUILD\, FileSystemProjectTree\(.*\)\)
Loading addresses from 'bad/a' failed.$"""
def test_bad_build_files(self):
with self.assertRaisesRegexp(self.spec_parser.BadSpecError, self.NO_FAIL_FAST_RE):
list(self.spec_parser.parse_addresses('::'))
def test_bad_build_files_fail_fast(self):
with self.assertRaisesRegexp(self.spec_parser.BadSpecError, self.FAIL_FAST_RE):
list(self.spec_parser.parse_addresses('::', True))
| 42.723077 | 101 | 0.680471 | 1,150 | 8,331 | 4.705217 | 0.125217 | 0.020699 | 0.118278 | 0.14027 | 0.758085 | 0.739605 | 0.711144 | 0.696914 | 0.688967 | 0.648309 | 0 | 0.001124 | 0.145961 | 8,331 | 194 | 102 | 42.943299 | 0.759382 | 0.037571 | 0 | 0.224638 | 0 | 0 | 0.156804 | 0.029089 | 0 | 0 | 0 | 0 | 0.391304 | 1 | 0.137681 | false | 0 | 0.057971 | 0.021739 | 0.231884 | 0.007246 | 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 |
9699ab49dc0c20db4bb4ee78fa2411605bb8f673 | 1,758 | py | Python | resources/dot_PyCharm/system/python_stubs/-762174762/win32profile.py | basepipe/developer_onboarding | 05b6a776f8974c89517868131b201f11c6c2a5ad | [
"MIT"
] | 1 | 2020-04-20T02:27:20.000Z | 2020-04-20T02:27:20.000Z | resources/dot_PyCharm/system/python_stubs/cache/9edeeb97ae7c1ec358f9620843984323739bcf3221eaa5ee1fd68961c7a6b26a/win32profile.py | basepipe/developer_onboarding | 05b6a776f8974c89517868131b201f11c6c2a5ad | [
"MIT"
] | null | null | null | resources/dot_PyCharm/system/python_stubs/cache/9edeeb97ae7c1ec358f9620843984323739bcf3221eaa5ee1fd68961c7a6b26a/win32profile.py | basepipe/developer_onboarding | 05b6a776f8974c89517868131b201f11c6c2a5ad | [
"MIT"
] | null | null | null | # encoding: utf-8
# module win32profile
# from C:\Python27\lib\site-packages\win32\win32profile.pyd
# by generator 1.147
# no doc
# no imports
# Variables with simple values
PI_APPLYPOLICY = 2
PI_NOUI = 1
PT_MANDATORY = 4
PT_ROAMING = 2
PT_TEMPORARY = 1
# functions
def CreateEnvironmentBlock(*args, **kwargs): # real signature unknown
""" Retrieves environment variables for a user """
pass
def DeleteProfile(*args, **kwargs): # real signature unknown
""" Remove a user's profile """
pass
def ExpandEnvironmentStringsForUser(*args, **kwargs): # real signature unknown
""" Replaces environment variables in a string with per-user values """
pass
def GetAllUsersProfileDirectory(*args, **kwargs): # real signature unknown
""" Retrieve All Users profile directory """
pass
def GetDefaultUserProfileDirectory(*args, **kwargs): # real signature unknown
""" Retrieve profile path for Default user """
pass
def GetEnvironmentStrings(*args, **kwargs): # real signature unknown
""" Retrieves environment variables for current process """
pass
def GetProfilesDirectory(*args, **kwargs): # real signature unknown
""" Retrieves directory where user profiles are stored """
pass
def GetProfileType(*args, **kwargs): # real signature unknown
""" Returns type of current user's profile """
pass
def GetUserProfileDirectory(*args, **kwargs): # real signature unknown
""" Returns profile directory for a logon token """
pass
def LoadUserProfile(*args, **kwargs): # real signature unknown
""" Load user settings for a login token """
pass
def UnloadUserProfile(*args, **kwargs): # real signature unknown
""" Unload profile loaded by LoadUserProfile """
pass
# no classes
| 27.46875 | 78 | 0.711035 | 203 | 1,758 | 6.133005 | 0.428571 | 0.088353 | 0.123695 | 0.203213 | 0.378313 | 0.251406 | 0.099598 | 0.099598 | 0.099598 | 0 | 0 | 0.01257 | 0.185438 | 1,758 | 63 | 79 | 27.904762 | 0.856844 | 0.521047 | 0 | 0.407407 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.407407 | false | 0.407407 | 0 | 0 | 0.407407 | 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 |
969d7989d597d987141a08864cd0542293d4eb73 | 644 | py | Python | server/api/python/comprehension.py | DigitalCompanion/trustometer | acd7a2ab4927195ee5455d3274efff9f76e1395f | [
"MIT"
] | 8 | 2018-10-27T14:47:09.000Z | 2019-06-13T15:11:04.000Z | server/api/python/comprehension.py | DigitalCompanion/trustometer | acd7a2ab4927195ee5455d3274efff9f76e1395f | [
"MIT"
] | 3 | 2020-08-18T12:17:05.000Z | 2020-08-18T12:17:46.000Z | server/api/python/comprehension.py | futurityab/trustometer | acd7a2ab4927195ee5455d3274efff9f76e1395f | [
"MIT"
] | 3 | 2019-06-13T15:06:09.000Z | 2020-05-09T08:23:49.000Z | import boto3
import json
def init(ACCESS_KEY, SECRET_KEY):
return boto3.client(service_name='comprehend', region_name="us-west-2", aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY)
def get_entities(client, title):
return client.detect_entities(Text=title, LanguageCode='en').get('Entities')
def get_key_phrases(client, title):
return client.detect_key_phrases(Text=title, LanguageCode='en').get('KeyPhrases')
def get_sentiment(client, title):
sentiment = client.detect_sentiment(Text=title, LanguageCode='en')
return [sentiment.get('Sentiment').title(), sentiment.get('SentimentScore')]
| 35.777778 | 140 | 0.751553 | 86 | 644 | 5.395349 | 0.348837 | 0.077586 | 0.135776 | 0.148707 | 0.237069 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005291 | 0.119565 | 644 | 17 | 141 | 37.882353 | 0.813051 | 0 | 0 | 0 | 0 | 0 | 0.105431 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0 | 0.181818 | 0.272727 | 0.909091 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
96a6e69d914f940d6ce83071f9858c2504a877e2 | 140 | py | Python | nested ternary.py | ps2809/Python-Examples | 0574f53787af28bf5bd011c139d340091454a4f9 | [
"MIT"
] | 1 | 2021-07-30T06:15:18.000Z | 2021-07-30T06:15:18.000Z | nested ternary.py | ps2809/Python-Examples | 0574f53787af28bf5bd011c139d340091454a4f9 | [
"MIT"
] | null | null | null | nested ternary.py | ps2809/Python-Examples | 0574f53787af28bf5bd011c139d340091454a4f9 | [
"MIT"
] | null | null | null | a=int(input('enter a:'))
b=int(input('enter b:'))
c=int(input('enter c:'))
min_value= a if a<b and a<c else b if b<c else c
print(min_value) | 28 | 48 | 0.657143 | 34 | 140 | 2.647059 | 0.352941 | 0.266667 | 0.433333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128571 | 140 | 5 | 49 | 28 | 0.737705 | 0 | 0 | 0 | 0 | 0 | 0.170213 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7368bcef3513f858130a78b597825be9b12f3327 | 1,709 | py | Python | spacy/cli/__init__.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 2 | 2017-06-23T20:54:31.000Z | 2022-01-06T08:11:49.000Z | spacy/cli/__init__.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2021-03-01T19:01:37.000Z | 2021-03-01T19:01:37.000Z | spacy/cli/__init__.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2021-06-21T07:17:48.000Z | 2021-06-21T07:17:48.000Z | from wasabi import msg
from ._util import app, setup_cli # noqa: F401
# These are the actual functions, NOT the wrapped CLI commands. The CLI commands
# are registered automatically and won't have to be imported here.
from .download import download # noqa: F401
from .info import info # noqa: F401
from .package import package # noqa: F401
from .profile import profile # noqa: F401
from .train import train_cli # noqa: F401
from .pretrain import pretrain # noqa: F401
from .debug_data import debug_data # noqa: F401
from .debug_config import debug_config # noqa: F401
from .debug_model import debug_model # noqa: F401
from .evaluate import evaluate # noqa: F401
from .convert import convert # noqa: F401
from .init_pipeline import init_pipeline_cli # noqa: F401
from .init_config import init_config, fill_config # noqa: F401
from .validate import validate # noqa: F401
from .project.clone import project_clone # noqa: F401
from .project.assets import project_assets # noqa: F401
from .project.run import project_run # noqa: F401
from .project.dvc import project_update_dvc # noqa: F401
from .project.push import project_push # noqa: F401
from .project.pull import project_pull # noqa: F401
from .project.document import project_document # noqa: F401
@app.command("link", no_args_is_help=True, deprecated=True, hidden=True)
def link(*args, **kwargs):
"""As of spaCy v3.0, symlinks like "en" are deprecated. You can load trained
pipeline packages using their full names or from a directory path."""
msg.warn(
"As of spaCy v3.0, model symlinks are deprecated. You can load trained "
"pipeline packages using their full names or from a directory path."
)
| 44.973684 | 80 | 0.752487 | 258 | 1,709 | 4.883721 | 0.333333 | 0.139683 | 0.190476 | 0.105556 | 0.153968 | 0.134921 | 0.134921 | 0.134921 | 0.134921 | 0.134921 | 0 | 0.049681 | 0.175541 | 1,709 | 37 | 81 | 46.189189 | 0.844571 | 0.308367 | 0 | 0 | 0 | 0 | 0.121845 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.034483 | true | 0 | 0.793103 | 0 | 0.827586 | 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 |
737528bac9620b8ee07a8513acd084d73b0adc0c | 9,587 | py | Python | test/test_pyini.py | limodou/uliweb3 | 560fe818047c8ee8b4b775e714d9c637f0d23651 | [
"BSD-2-Clause"
] | 16 | 2018-09-12T02:50:28.000Z | 2021-08-20T08:38:31.000Z | test/test_pyini.py | limodou/uliweb3 | 560fe818047c8ee8b4b775e714d9c637f0d23651 | [
"BSD-2-Clause"
] | 21 | 2018-11-29T06:41:08.000Z | 2022-01-18T13:27:38.000Z | test/test_pyini.py | limodou/uliweb3 | 560fe818047c8ee8b4b775e714d9c637f0d23651 | [
"BSD-2-Clause"
] | 1 | 2018-10-08T10:02:56.000Z | 2018-10-08T10:02:56.000Z | #coding=utf8
from uliweb.utils.pyini import *
def test_sorteddict():
"""
>>> d = SortedDict()
>>> d
<SortedDict {}>
>>> d.name = 'limodou'
>>> d['class'] = 'py'
>>> d
<SortedDict {'class':'py', 'name':'limodou'}>
>>> d.keys()
['name', 'class']
>>> d.values()
['limodou', 'py']
>>> d['class']
'py'
>>> d.name
'limodou'
>>> d.get('name', 'default')
'limodou'
>>> d.get('other', 'default')
'default'
>>> 'name' in d
True
>>> 'other' in d
False
>>> print (d.other)
None
>>> try:
... d['other']
... except Exception as e:
... print (e)
'other'
>>> del d['class']
>>> del d['name']
>>> d
<SortedDict {}>
>>> d['name'] = 'limodou'
>>> d.pop('other', 'default')
'default'
>>> d.pop('name')
'limodou'
>>> d
<SortedDict {}>
>>> d.update({'class':'py', 'attribute':'border'})
>>> d
<SortedDict {'attribute':'border', 'class':'py'}>
"""
def test_section():
"""
>>> s = Section('default', "#comment")
>>> print (s)
#comment
[default]
<BLANKLINE>
>>> s.name = 'limodou'
>>> s.add_comment('name', '#name')
>>> s.add_comment(comments='#change')
>>> print (s)
#change
[default]
#name
name = 'limodou'
<BLANKLINE>
>>> del s.name
>>> print (s)
#change
[default]
<BLANKLINE>
"""
def test_ini1():
"""
>>> x = Ini()
>>> s = x.add('default')
>>> print (x)
#coding=utf-8
[default]
<BLANKLINE>
>>> s['abc'] = 'name'
>>> print (x)
#coding=utf-8
[default]
abc = 'name'
<BLANKLINE>
"""
def test_ini2():
"""
>>> x = Ini()
>>> x['default'] = Section('default', "#comment")
>>> x.default.name = 'limodou'
>>> x.default['class'] = 'py'
>>> x.default.list = ['abc']
>>> print (x)
#coding=utf-8
#comment
[default]
name = 'limodou'
class = 'py'
list = ['abc']
<BLANKLINE>
>>> x.default.list = ['cde'] #for mutable object will merge the data, including dict type
>>> print (x.default.list)
['abc', 'cde']
>>> x.default.d = {'a':'a'}
>>> x.default.d = {'b':'b'}
>>> print (x.default.d)
{'a': 'a', 'b': 'b'}
"""
def test_gettext():
"""
>>> from uliweb.i18n import gettext_lazy as _
>>> x = Ini(env={'_':_})
>>> x['default'] = Section('default')
>>> x.default.option = _('Hello')
>>> x.keys()
['_', 'gettext_lazy', 'set', 'default']
"""
def test_replace():
"""
>>> x = Ini()
>>> x['default'] = Section('default')
>>> x.default.option = ['a']
>>> x.default.option
['a']
>>> x.default.option = ['b']
>>> x.default.option
['a', 'b']
>>> x.default.add('option', ['c'], replace=True)
>>> x.default.option
['c']
>>> print (x.default)
[default]
option <= ['c']
<BLANKLINE>
"""
def test_set_var():
"""
>>> x = Ini()
>>> x.set_var('default/key', 'name')
True
>>> print (x)
#coding=utf-8
[default]
key = 'name'
<BLANKLINE>
>>> x.set_var('default/key/name', 'hello')
True
>>> print (x)
#coding=utf-8
[default]
key = 'name'
key/name = 'hello'
<BLANKLINE>
>>> x.get_var('default/key')
'name'
>>> x.get_var('default/no')
>>> x.get_var('defaut/no', 'no')
'no'
>>> x.del_var('default/key')
True
>>> print (x)
#coding=utf-8
[default]
key/name = 'hello'
<BLANKLINE>
>>> x.get_var('default/key/name')
'hello'
>>> x.get_var('default')
<Section {'key/name':'hello'}>
"""
def test_update():
"""
>>> x = Ini()
>>> x.set_var('default/key', 'name')
True
>>> d = {'default/key':'limodou', 'default/b':123}
>>> x.update(d)
>>> print (x)
#coding=utf-8
[default]
key = 'limodou'
b = 123
<BLANKLINE>
"""
def test_uni_print():
"""
>>> a = ()
>>> uni_prt(a, 'utf-8')
'()'
>>> a = (1,2)
>>> uni_prt(a)
'(1, 2)'
"""
def test_triple_string():
"""
>>> from io import StringIO
>>> buf = StringIO(\"\"\"
... #coding=utf8
... [DEFAULT]
... a = '''hello
... 中文
... '''
... \"\"\")
>>> x = Ini()
>>> x.read(buf)
>>> print (repr(x.DEFAULT.a))
'hello\\n\\u4e2d\\u6587\\n'
"""
def test_save():
"""
>>> from uliweb.i18n import gettext_lazy as _, i18n_ini_convertor
>>> from io import StringIO
>>> x = Ini(env={'_':_}, convertors=i18n_ini_convertor)
>>> buf = StringIO(\"\"\"
... [default]
... option = _('English')
... str = 'str'
... str1 = "str"
... float = 1.2
... int = 1
... list = [1, 'str', 0.12]
... dict = {'a':'b', 1:2}
... s = 'English'
... [other]
... option = 'default'
... options1 = '{{option}} xxx'
... options2 = '{{default.int}}'
... options3 = option
... options4 = '-- {{default.option}} --'
... options5 = '-- {{default.s}} --'
... options6 = 'English {{default.s}} --'
... options7 = default.str + default.str1
... \"\"\")
>>> x.read(buf)
>>> print (x)
#coding=UTF-8
<BLANKLINE>
[default]
option = _('English')
str = 'str'
str1 = 'str'
float = 1.2
int = 1
list = [1, 'str', 0.12]
dict = {'a': 'b', 1: 2}
s = 'English'
[other]
option = 'default'
options1 = 'default xxx'
options2 = '1'
options3 = 'default'
options4 = '-- English --'
options5 = '-- English --'
options6 = 'English English --'
options7 = 'strstr'
<BLANKLINE>
"""
def test_merge_data():
"""
>>> from uliweb.utils.pyini import merge_data
>>> a = [[1,2,3], [2,3,4], [4,5]]
>>> b = [{'a':[1,2], 'b':{'a':[1,2]}}, {'a':[2,3], 'b':{'a':['b'], 'b':2}}]
>>> c = [set([1,2,3]), set([2,4])]
>>> print (merge_data(a))
[1, 2, 3, 4, 5]
>>> print (merge_data(b))
{'a': [1, 2, 3], 'b': {'a': [1, 2, 'b'], 'b': 2}}
>>> print (merge_data(c))
{1, 2, 3, 4}
>>> print (merge_data([2]))
2
"""
def test_lazy():
"""
>>> from uliweb.i18n import gettext_lazy as _, i18n_ini_convertor
>>> from io import StringIO
>>> x = Ini(env={'_':_}, convertors=i18n_ini_convertor, lazy=True)
>>> buf = StringIO(\"\"\"
... [default]
... option = _('English')
... str = 'str'
... str1 = "str"
... float = 1.2
... int = 1
... list = [1, 'str', 0.12]
... dict = {'a':'b', 1:2}
... s = 'English'
... [other]
... option = 'default'
... options1 = '{{option}} xxx'
... options2 = '{{default.int}}'
... options3 = option
... options4 = '-- {{default.option}} --'
... options5 = '-- {{default.s}} --'
... options6 = 'English {{default.s}} --'
... options7 = default.str + default.str1
... \"\"\")
>>> x.read(buf)
>>> x.freeze()
>>> print (x)
#coding=UTF-8
<BLANKLINE>
[default]
option = _('English')
str = 'str'
str1 = 'str'
float = 1.2
int = 1
list = [1, 'str', 0.12]
dict = {'a': 'b', 1: 2}
s = 'English'
[other]
option = 'default'
options1 = 'default xxx'
options2 = '1'
options3 = 'default'
options4 = '-- English --'
options5 = '-- English --'
options6 = 'English English --'
options7 = 'strstr'
<BLANKLINE>
"""
def test_multiple_read():
"""
>>> from uliweb.i18n import gettext_lazy as _, i18n_ini_convertor
>>> from io import StringIO
>>> x = Ini(env={'_':_}, convertors=i18n_ini_convertor, lazy=True)
>>> buf = StringIO(\"\"\"
... [default]
... option = 'abc'
... [other]
... option = default.option
... option1 = '{{option}} xxx'
... option2 = '{{default.option}}'
... option3 = '{{other.option}}'
... \"\"\")
>>> x.read(buf)
>>> buf1 = StringIO(\"\"\"
... [default]
... option = 'hello'
... \"\"\")
>>> x.read(buf1)
>>> x.freeze()
>>> print (x)
#coding=UTF-8
<BLANKLINE>
[default]
option = 'hello'
[other]
option = 'hello'
option1 = 'hello xxx'
option2 = 'hello'
option3 = 'hello'
<BLANKLINE>
"""
def test_chinese():
"""
>>> from uliweb.i18n import gettext_lazy as _, i18n_ini_convertor
>>> from io import StringIO
>>> x = Ini(env={'_':_}, convertors=i18n_ini_convertor)
>>> buf = StringIO(\"\"\"#coding=utf-8
... [default]
... option = '中文'
... option2 = _('中文')
... option3 = '{{option}}'
... [other]
... x = '中文 {{default.option}}'
... x1 = '中文 {{default.option}}'
... x2 = 'xbd {{default.option}}'
... \"\"\")
>>> x.read(buf)
>>> print (x)
#coding=utf-8
[default]
option = '中文'
option2 = _('中文')
option3 = '中文'
[other]
x = '中文 中文'
x1 = '中文 中文'
x2 = 'xbd 中文'
<BLANKLINE>
>>> print (repr(x.other.x1))
'中文 中文'
>>> x.keys()
['_', 'gettext_lazy', 'set', 'default', 'other']
"""
def test_set():
"""
>>> from io import StringIO
>>> x = Ini()
>>> buf = StringIO(\"\"\"#coding=utf-8
... [default]
... set1 = {1,2,3}
... set2 = set([1,2,3])
... \"\"\")
>>> x.read(buf)
>>> print (x)
#coding=utf-8
[default]
set1 = {1, 2, 3}
set2 = {1, 2, 3}
<BLANKLINE>
>>> buf2 = StringIO(\"\"\"#coding=utf-8
... [default]
... set1 = {5,3}
... \"\"\")
>>> x.read(buf2)
>>> print (x.default.set1)
{1, 2, 3, 5}
"""
| 22.295349 | 93 | 0.456973 | 1,065 | 9,587 | 4.032864 | 0.119249 | 0.069616 | 0.034924 | 0.041909 | 0.570431 | 0.54156 | 0.474738 | 0.437253 | 0.437253 | 0.363912 | 0 | 0.031536 | 0.292166 | 9,587 | 429 | 94 | 22.347319 | 0.601385 | 0.774591 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.941176 | true | 0 | 0.058824 | 0 | 1 | 0.058824 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
739647d67e5d34152efe879eebab2aba747ceb26 | 815 | py | Python | src/Pages/LoginPage.py | Artem0791/Hackathon18_09 | 15f7e6c14264a574dc3efc42c5edd03e39b8dab8 | [
"MIT"
] | 1 | 2021-09-17T18:26:33.000Z | 2021-09-17T18:26:33.000Z | src/Pages/LoginPage.py | Artem0791/Hackathon18_09 | 15f7e6c14264a574dc3efc42c5edd03e39b8dab8 | [
"MIT"
] | null | null | null | src/Pages/LoginPage.py | Artem0791/Hackathon18_09 | 15f7e6c14264a574dc3efc42c5edd03e39b8dab8 | [
"MIT"
] | 3 | 2021-09-18T10:06:32.000Z | 2021-09-18T20:50:29.000Z | from .BasePage import BasePage
from src.Locators import LoginPage
from src.Services.Faker.FakeDataGenerator import DataGenerator
class Login(BasePage):
def create_account(self):
data = DataGenerator()
self.select(LoginPage.CreateCustomer.title, 'Mr.')
self.input(LoginPage.CreateCustomer.first_name, data.get_name())
self.input(LoginPage.CreateCustomer.last_name, data.get_name())
self.input(LoginPage.CreateCustomer.email, data.get_email())
self.input(LoginPage.CreateCustomer.password, 'evetah799')
self.input(LoginPage.CreateCustomer.confirm_password, 'evetah799')
self.click(LoginPage.CreateCustomer.consent_checkbox)
self.click(LoginPage.CreateCustomer.terms_checkbox)
self.click(LoginPage.CreateCustomer.register_button)
| 40.75 | 74 | 0.75092 | 88 | 815 | 6.840909 | 0.409091 | 0.343854 | 0.149502 | 0.265781 | 0.289037 | 0.156146 | 0.156146 | 0.156146 | 0 | 0 | 0 | 0.008658 | 0.149693 | 815 | 19 | 75 | 42.894737 | 0.860029 | 0 | 0 | 0 | 0 | 0 | 0.02583 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0.133333 | 0.2 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
73a60122798b5b44ac1b77285ac69b9d5cb78587 | 2,888 | py | Python | fcore/util.py | superwhyun/farmos | 9292f3ba24b7d07002af0549ae510ce4edf09ce5 | [
"BSD-3-Clause"
] | null | null | null | fcore/util.py | superwhyun/farmos | 9292f3ba24b7d07002af0549ae510ce4edf09ce5 | [
"BSD-3-Clause"
] | null | null | null | fcore/util.py | superwhyun/farmos | 9292f3ba24b7d07002af0549ae510ce4edf09ce5 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 JiNong, Inc.
# All right reserved.
#
"""
Utility Functions를 정의함.
"""
import time
import math
import logging
import logging.handlers
def getdefaultlogger():
_logger = logging.getLogger('mate')
_logger.setLevel(logging.DEBUG)
streamHandler = logging.StreamHandler()
formatter = logging.Formatter('[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s > %(message)s')
streamHandler.setFormatter(formatter)
_logger.addHandler(streamHandler)
return _logger
class SunTime:
def __init__(self, longitude, latitude):
self._longitude = longitude * -1
self._latitude = latitude
self._today = time.localtime(time.time())
def settoday(self):
self._today = time.localtime(time.time())
def getgamma(self):
return (2.0 * math.pi / 365.0) * self._today.tm_yday
def getgamma2(self, hour):
return (2.0 * math.pi / 365.0) * self._today.tm_yday + (hour/24.0)
def getequationtime(self, gamma):
return 229.18 * (0.000075 + 0.001868 * math.cos(gamma) - 0.032077 * math.sin(gamma) - 0.014615 * math.cos(2 * gamma) - 0.040849 * math.sin(2 * gamma))
def getsolardeclination(self, gamma):
return 0.006918 - 0.399912 * math.cos(gamma) + 0.070257 * math.sin(gamma) - 0.006758 * math.cos(2 * gamma) + 0.000907 * math.sin(2 * gamma)
def degtorad(self, deg):
return math.pi * deg / 180.0
def radtodeg(self, rad):
return 180 * rad / math.pi
def gethourangle(self, latitude, declination, tm):
latrad = self.degtorad(latitude)
hourangle = math.acos(math.cos(self.degtorad (90.833)) / (math.cos(latrad) * math.cos(declination))
- math.tan(latrad) * math.tan(declination))
if tm == 1:
return hourangle
elif tm == 0:
return -1 * hourangle
return 0
def gettime(self, gamma, isrise):
eqtime = self.getequationtime(gamma)
declination = self.getsolardeclination(gamma)
hourangle = self.gethourangle(self._latitude, declination, 1 if isrise == True else 0)
delta = self._longitude - self.radtodeg(hourangle)
return 720.0 + 4.0 * delta - eqtime
def getsunrise(self):
tm = self.gettime(self.getgamma (), True)
#return self.gettime(self.getgamma2(int(tm / 60.0)), True) + 540
m = self.gettime(self.getgamma2(int(tm / 60.0)), True) + 540
return int(m * 60)
def getsunset(self):
tm = self.gettime(self.getgamma (), False)
#return self.gettime(self.getgamma2(int(tm / 60.0)), False) + 540
m = self.gettime(self.getgamma2(int(tm / 60.0)), False) + 540
return int(m * 60)
if __name__ == '__main__':
st = SunTime(128.856632, 37.798953)
print("rise", st.getsunrise(), "set", st.getsunset())
| 33.976471 | 158 | 0.621191 | 369 | 2,888 | 4.791328 | 0.319783 | 0.027715 | 0.050905 | 0.054299 | 0.252262 | 0.204751 | 0.171946 | 0.134615 | 0.134615 | 0.127828 | 0 | 0.078947 | 0.236842 | 2,888 | 84 | 159 | 34.380952 | 0.72323 | 0.084834 | 0 | 0.070175 | 0 | 0.017544 | 0.032012 | 0.014863 | 0 | 0 | 0 | 0 | 0 | 1 | 0.22807 | false | 0 | 0.070175 | 0.105263 | 0.54386 | 0.017544 | 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 |
73a7196bbf0eb253a97a49fbb8e7cb7ec93df591 | 611 | py | Python | tests/manual/i3wmcommands.py | diegoperezm/screencast-script | ac477c6f44a151cafa88ebfd981d2bbe34f792bd | [
"MIT"
] | null | null | null | tests/manual/i3wmcommands.py | diegoperezm/screencast-script | ac477c6f44a151cafa88ebfd981d2bbe34f792bd | [
"MIT"
] | null | null | null | tests/manual/i3wmcommands.py | diegoperezm/screencast-script | ac477c6f44a151cafa88ebfd981d2bbe34f792bd | [
"MIT"
] | null | null | null | import sys
# for development
sys.path.append('../../src')
from screencastscript import ScreencastScript # noqa: E402
screencast = ScreencastScript()
screencast.sleep(1)
screencast.i3wm_focus_left()
screencast.sleep(1)
screencast.i3wm_zoom_in()
screencast.sleep(1)
screencast.i3wm_zoom_out()
screencast.sleep(1)
screencast.i3wm_focus_right()
screencast.sleep(1)
screencast.i3wm_focus_up()
screencast.sleep(1)
screencast.i3wm_focus_down()
screencast.sleep(1)
screencast.i3wm_toggle_fullscreen()
screencast.sleep(1)
screencast.i3wm_ws_2()
screencast.sleep(1)
screencast.i3wm_ws_1()
screencast.sleep(1)
| 16.972222 | 59 | 0.800327 | 82 | 611 | 5.743902 | 0.329268 | 0.318471 | 0.339703 | 0.496815 | 0.641189 | 0.577495 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.076923 | 611 | 35 | 60 | 17.457143 | 0.792553 | 0.042553 | 0 | 0.434783 | 0 | 0 | 0.015464 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.086957 | 0 | 0.086957 | 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 |
73cf094cf77e18c95fada7abbb805a0feed41fec | 526 | py | Python | auto_pilot/common/registrable.py | farrellsc/zAutoPilot | 652d93690237dcb21c3cbdbdad95f917b7fec6e3 | [
"MIT"
] | 1 | 2018-03-05T08:27:58.000Z | 2018-03-05T08:27:58.000Z | auto_pilot/common/registrable.py | farrellsc/zAutoPilot | 652d93690237dcb21c3cbdbdad95f917b7fec6e3 | [
"MIT"
] | null | null | null | auto_pilot/common/registrable.py | farrellsc/zAutoPilot | 652d93690237dcb21c3cbdbdad95f917b7fec6e3 | [
"MIT"
] | null | null | null | from typing import Callable, TypeVar, List
T = TypeVar('T')
class Registrable(object):
reg_list = dict()
@classmethod
def register(cls, class_name: str) -> Callable:
def register_inner(class_type: T) -> None:
cls.reg_list[class_name] = class_type
return register_inner
@classmethod
def list_available(cls) -> List[str]:
return list(cls.reg_list.keys())
@classmethod
def by_name(cls, class_name: str) -> T:
return cls.reg_list.get(class_name, None)
| 23.909091 | 51 | 0.65019 | 70 | 526 | 4.685714 | 0.371429 | 0.085366 | 0.091463 | 0.091463 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.239544 | 526 | 21 | 52 | 25.047619 | 0.82 | 0 | 0 | 0.2 | 0 | 0 | 0.001901 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.066667 | 0.133333 | 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 |
73d30c85b213e414209b78284449266b653e1713 | 558 | py | Python | spiketools/utils/base.py | claire98han/SpikeTools | f1cdffd50e2cbdb75961a716425c4665aa930f54 | [
"Apache-2.0"
] | 1 | 2022-03-09T19:40:37.000Z | 2022-03-09T19:40:37.000Z | spiketools/utils/base.py | claire98han/SpikeTools | f1cdffd50e2cbdb75961a716425c4665aa930f54 | [
"Apache-2.0"
] | 35 | 2021-09-28T15:13:31.000Z | 2021-11-26T04:38:08.000Z | spiketools/utils/base.py | claire98han/SpikeTools | f1cdffd50e2cbdb75961a716425c4665aa930f54 | [
"Apache-2.0"
] | 4 | 2021-09-28T14:56:24.000Z | 2022-03-09T21:00:31.000Z | """Base utility functions, that manipulate basic data structures, etc."""
###################################################################################################
###################################################################################################
def flatten(lst):
"""Flatten a list of lists into a single list.
Parameters
----------
lst : list of list
A list of embedded lists.
Returns
-------
lst
A flattened list.
"""
return [item for sublist in lst for item in sublist]
| 26.571429 | 99 | 0.378136 | 46 | 558 | 4.586957 | 0.586957 | 0.085308 | 0.066351 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.193548 | 558 | 20 | 100 | 27.9 | 0.468889 | 0.405018 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
73d5dcabb54b57daa8b78e26015c8bd966917221 | 197 | py | Python | src/dataclay/communication/grpc/messages/logicmodule/__init__.py | kpavel/pyclay | 275bc8af5c57301231a20cca1cc88556a9c84c79 | [
"BSD-3-Clause"
] | 1 | 2020-04-16T17:09:15.000Z | 2020-04-16T17:09:15.000Z | src/dataclay/communication/grpc/messages/logicmodule/__init__.py | kpavel/pyclay | 275bc8af5c57301231a20cca1cc88556a9c84c79 | [
"BSD-3-Clause"
] | 35 | 2019-11-06T17:06:16.000Z | 2021-04-12T16:27:20.000Z | src/dataclay/communication/grpc/messages/logicmodule/__init__.py | kpavel/pyclay | 275bc8af5c57301231a20cca1cc88556a9c84c79 | [
"BSD-3-Clause"
] | 1 | 2020-05-06T11:28:16.000Z | 2020-05-06T11:28:16.000Z |
""" Class description goes here. """
"""Package containing gRPC classes."""
__author__ = 'Enrico La Sala <enrico.lasala@bsc.es>'
__copyright__ = '2017 Barcelona Supercomputing Center (BSC-CNS)'
| 24.625 | 64 | 0.725888 | 23 | 197 | 5.869565 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023392 | 0.13198 | 197 | 7 | 65 | 28.142857 | 0.766082 | 0.142132 | 0 | 0 | 0 | 0 | 0.680328 | 0.180328 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
73ec5cfa22b958735251f6bd136ed85eba9a7172 | 562 | py | Python | TheKinozal/custom_storages/async_s3_video.py | R-Mielamud/TheKinozal | 62cb79faae58b23f0ef0175593ed9b5746229b5b | [
"MIT"
] | 1 | 2020-10-16T19:15:32.000Z | 2020-10-16T19:15:32.000Z | TheKinozal/custom_storages/async_s3_video.py | R-Mielamud/TheKinozal | 62cb79faae58b23f0ef0175593ed9b5746229b5b | [
"MIT"
] | null | null | null | TheKinozal/custom_storages/async_s3_video.py | R-Mielamud/TheKinozal | 62cb79faae58b23f0ef0175593ed9b5746229b5b | [
"MIT"
] | null | null | null | import os
from TheKinozal import settings
from storages.backends.s3boto3 import S3Boto3Storage
from helpers.random_string import generate_random_string
from helpers.chunked_upload import ChunkedS3VideoUploader
class AsyncS3VideoStorage(S3Boto3Storage):
def _save(self, name, content):
filename, ext = os.path.splitext(name)
name = filename + "_" + generate_random_string() + ext
uploader = ChunkedS3VideoUploader(content, settings.AWS_VIDEOS_KEY, name)
uploader.upload()
return settings.AWS_VIDEOS_KEY + "/" + name
| 35.125 | 81 | 0.756228 | 62 | 562 | 6.66129 | 0.516129 | 0.087167 | 0.096852 | 0.096852 | 0.116223 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019313 | 0.170819 | 562 | 15 | 82 | 37.466667 | 0.866953 | 0 | 0 | 0 | 1 | 0 | 0.003559 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.416667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.