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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e2b840809b699ab185450306eb2e4ed2ad9a4e95 | 342 | py | Python | blog/admin.py | Benz-Solutions/MyWebsite | d60601f7f390c9d8a4b4394b321cf3b2cdc4b26a | [
"MIT"
] | null | null | null | blog/admin.py | Benz-Solutions/MyWebsite | d60601f7f390c9d8a4b4394b321cf3b2cdc4b26a | [
"MIT"
] | null | null | null | blog/admin.py | Benz-Solutions/MyWebsite | d60601f7f390c9d8a4b4394b321cf3b2cdc4b26a | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import *
# Register your models here.
class ArticleAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('name',)}
admin.site.register(Category, CategoryAdmin)
admin.site.register(Article, ArticleAdmin) | 34.2 | 46 | 0.760234 | 38 | 342 | 6.789474 | 0.552632 | 0.116279 | 0.209302 | 0.255814 | 0.286822 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108187 | 342 | 10 | 47 | 34.2 | 0.845902 | 0.076023 | 0 | 0 | 0 | 0 | 0.053968 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.75 | 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 |
2c5915bfcc71c4e5023e40d798ccce58874ecc86 | 434 | py | Python | src/sima/riflex/convergencecriterion.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/riflex/convergencecriterion.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/riflex/convergencecriterion.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | # Generated with ConvergenceCriterion
#
from enum import Enum
from enum import auto
class ConvergenceCriterion(Enum):
""""""
AMPNOR = auto()
DIFMAX = auto()
NONE = auto()
def label(self):
if self == ConvergenceCriterion.AMPNOR:
return "AMPNOR"
if self == ConvergenceCriterion.DIFMAX:
return "DIFMAX"
if self == ConvergenceCriterion.NONE:
return "NONE" | 24.111111 | 47 | 0.612903 | 41 | 434 | 6.487805 | 0.390244 | 0.067669 | 0.293233 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.292627 | 434 | 18 | 48 | 24.111111 | 0.86645 | 0.080645 | 0 | 0 | 1 | 0 | 0.041026 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.153846 | 0 | 0.769231 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2c5cf8dcb9fd5d49e82d350e140ef7595ccbcd0b | 112 | py | Python | src/beginner/1096.py | henrikhorbovyi/URI | 6df34d87bb7bbbf760ab774e01da87ad669acae9 | [
"Apache-2.0"
] | 1 | 2018-07-04T01:53:29.000Z | 2018-07-04T01:53:29.000Z | src/beginner/1096.py | henrikhorbovyi/URI | 6df34d87bb7bbbf760ab774e01da87ad669acae9 | [
"Apache-2.0"
] | null | null | null | src/beginner/1096.py | henrikhorbovyi/URI | 6df34d87bb7bbbf760ab774e01da87ad669acae9 | [
"Apache-2.0"
] | null | null | null | j = 7
for i in range(1,(10),2):
for jump in range(0,3):
print("I={0} J={1}".format(i,j))
j = j - 1
j = 7
| 16 | 34 | 0.491071 | 28 | 112 | 1.964286 | 0.5 | 0.072727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130952 | 0.25 | 112 | 6 | 35 | 18.666667 | 0.52381 | 0 | 0 | 0.333333 | 0 | 0 | 0.098214 | 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 |
2c76126529c4965a133a13463d27045f974025d6 | 148 | py | Python | xrpl/__init__.py | mDuo13/xrpl-py | 70f927dcd2dbb8644b3e210b0a8de2a214e71e3d | [
"0BSD"
] | null | null | null | xrpl/__init__.py | mDuo13/xrpl-py | 70f927dcd2dbb8644b3e210b0a8de2a214e71e3d | [
"0BSD"
] | null | null | null | xrpl/__init__.py | mDuo13/xrpl-py | 70f927dcd2dbb8644b3e210b0a8de2a214e71e3d | [
"0BSD"
] | null | null | null | """High-level XRPL exports."""
from xrpl.constants import CryptoAlgorithm, XRPLException
__all__ = [
"CryptoAlgorithm",
"XRPLException",
]
| 18.5 | 57 | 0.716216 | 13 | 148 | 7.846154 | 0.769231 | 0.54902 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155405 | 148 | 7 | 58 | 21.142857 | 0.816 | 0.162162 | 0 | 0 | 0 | 0 | 0.237288 | 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 |
2c83d6c6d98de50292a039b0f0d8c42a9f4bd009 | 1,022 | py | Python | setup.py | giantas/configreader | 9d35b4fc13bb20343d52eeeb1154ac464627d164 | [
"MIT"
] | null | null | null | setup.py | giantas/configreader | 9d35b4fc13bb20343d52eeeb1154ac464627d164 | [
"MIT"
] | null | null | null | setup.py | giantas/configreader | 9d35b4fc13bb20343d52eeeb1154ac464627d164 | [
"MIT"
] | null | null | null | from setuptools import setup
try:
import pypandoc
long_description = pypandoc.convert_file('README.md', 'rst')
except (ImportError, OSError, RuntimeError):
long_description = 'Usage available at http://github.com/giantas/pyconfigreader'
setup(name='pyconfigreader',
version='0.10.0',
description='A module for handling simple configuration requirements',
long_description=long_description,
url='http://github.com/giantas/pyconfigreader',
author='Aswa Paul',
license='MIT',
packages=['pyconfigreader'],
install_requires=[],
zip_safe=False,
python_requires='>3.4, <3.10',
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]
)
| 34.066667 | 84 | 0.632094 | 105 | 1,022 | 6.07619 | 0.561905 | 0.208464 | 0.274295 | 0.244514 | 0.106583 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025543 | 0.233855 | 1,022 | 29 | 85 | 35.241379 | 0.789272 | 0 | 0 | 0 | 0 | 0 | 0.462818 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.111111 | 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 |
2caa275e81cc1de445765f7534d25b471bea7b79 | 464 | py | Python | setup.py | Tbarkin121/CubeBot | 02a96f5d71a27c9a8b1b6a6433f46d2ee7d8cc09 | [
"MIT"
] | null | null | null | setup.py | Tbarkin121/CubeBot | 02a96f5d71a27c9a8b1b6a6433f46d2ee7d8cc09 | [
"MIT"
] | null | null | null | setup.py | Tbarkin121/CubeBot | 02a96f5d71a27c9a8b1b6a6433f46d2ee7d8cc09 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name="simple_driving",
version='0.0.1',
install_requires=['gym',
'pybullet',
'numpy',
'matplotlib',
'torch']
)
setup(
name="box_pendulum",
version='0.0.1',
install_requires=['gym',
'pybullet',
'numpy',
'matplotlib',
'torch']
) | 22.095238 | 35 | 0.394397 | 34 | 464 | 5.264706 | 0.558824 | 0.100559 | 0.100559 | 0.111732 | 0.625698 | 0.625698 | 0.625698 | 0.625698 | 0.625698 | 0.625698 | 0 | 0.024896 | 0.480603 | 464 | 21 | 36 | 22.095238 | 0.717842 | 0 | 0 | 0.736842 | 0 | 0 | 0.210753 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.052632 | 0 | 0.052632 | 0 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2cae829ee97b4b1462c02bc6d4ee498365c91ec4 | 2,133 | py | Python | venv/Lib/site-packages/frontend/events/ui/mouse/mouse.py | mysnyldz/Tez-Analizi-Tarama | 47e149bbd6a9e865e9242e50fb7ca1a18adfc640 | [
"MIT"
] | 1 | 2022-01-18T17:56:51.000Z | 2022-01-18T17:56:51.000Z | venv/Lib/site-packages/frontend/events/ui/mouse/mouse.py | mysnyldz/Tez-Analizi | 47e149bbd6a9e865e9242e50fb7ca1a18adfc640 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/frontend/events/ui/mouse/mouse.py | mysnyldz/Tez-Analizi | 47e149bbd6a9e865e9242e50fb7ca1a18adfc640 | [
"MIT"
] | null | null | null | from __future__ import annotations
from enum import IntEnum
from typing import List, Optional, TYPE_CHECKING
from ..ui import UIEvent
__all__ = ['MouseEvent', 'MouseButton']
class MouseButton(IntEnum):
MAIN_LEFT = 0
AUXILIARY_WHEEL_MIDDLE = 1
SECONDARY_RIGHT = 2
FOURTH_BROWSERBACK = 3
FOURTH_BROWSERFORWARD = 4
class MouseEvent(UIEvent):
__interface_for__ = {'click', 'dblclick', 'mouseup', 'mousedown'}
@property
def alt_key(self) -> bool:
return self.__data__['altKey']
@property
def ctrl_key(self) -> bool:
return self.__data__['ctrlKey']
@property
def meta_key(self) -> bool:
return self.__data__['metaKey']
@property
def shift_key(self) -> bool:
return self.__data__['shiftKey']
@property
def button(self) -> MouseButton:
return MouseButton(self.__data__['button'])
@property
def buttons(self) -> List[MouseButton]:
return [MouseButton(item) for item in self.__data__['buttons']]
@property
def client_x(self) -> int:
return self.__data__['clientX']
@property
def client_y(self) -> int:
return self.__data__['clientY']
@property
def movement_x(self) -> int:
return self.__data__['movementX']
@property
def movement_y(self) -> int:
return self.__data__['movementY']
@property
def offset_x(self) -> int:
return self.__data__['offsetX']
@property
def offset_y(self) -> int:
return self.__data__['offsetY']
@property
def screen_x(self) -> int:
return self.__data__['screenX']
@property
def screen_y(self) -> int:
return self.__data__['screenY']
@property
def x(self) -> int:
return self.__data__['x']
@property
def y(self) -> int:
return self.__data__['y']
@property
def region(self) -> int:
return self.__data__['region']
@property
def related_target(self) -> Optional[dom.Base]:
return super().__get_dom_node__(int(self.__data__['relatedTarget']))
if TYPE_CHECKING:
from .... import dom
| 21.989691 | 76 | 0.632443 | 245 | 2,133 | 5.04898 | 0.334694 | 0.160065 | 0.169766 | 0.151172 | 0.275667 | 0.25869 | 0 | 0 | 0 | 0 | 0 | 0.003111 | 0.246601 | 2,133 | 96 | 77 | 22.21875 | 0.766646 | 0 | 0 | 0.26087 | 0 | 0 | 0.080638 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0.072464 | 0.26087 | 0.710145 | 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 |
2ccf317633f8a8f8e27fa1ddb8028622cce1da18 | 1,023 | py | Python | kkanbu/operation/views.py | coding-kkanbu/teameet_backend | 2af1c5fb3ed7f0c2d374afbdf53f318ecc6ae69d | [
"MIT"
] | 1 | 2022-01-09T13:40:41.000Z | 2022-01-09T13:40:41.000Z | kkanbu/operation/views.py | coding-kkanbu/teameet_backend | 2af1c5fb3ed7f0c2d374afbdf53f318ecc6ae69d | [
"MIT"
] | 33 | 2022-01-04T10:27:55.000Z | 2022-03-31T10:32:53.000Z | kkanbu/operation/views.py | coding-kkanbu/teameet_backend | 2af1c5fb3ed7f0c2d374afbdf53f318ecc6ae69d | [
"MIT"
] | null | null | null | from rest_framework.mixins import CreateModelMixin, ListModelMixin
from rest_framework.viewsets import GenericViewSet
from .models import CommentBlame, CommentLike, PostBlame, PostLike
from .serializers import (
CommentBlameSerializer,
CommentLikeSerializer,
PostBlameSerializer,
PostLikeSerializer,
)
class PostLikeViewSet(
GenericViewSet,
CreateModelMixin,
ListModelMixin,
):
serializer_class = PostLikeSerializer
queryset = PostLike.objects.all()
class CommentLikeViewSet(
GenericViewSet,
CreateModelMixin,
ListModelMixin,
):
serializer_class = CommentLikeSerializer
queryset = CommentLike.objects.all()
class PostBlameViewSet(
GenericViewSet,
CreateModelMixin,
ListModelMixin,
):
serializer_class = PostBlameSerializer
queryset = PostBlame.objects.all()
class CommentBlameViewSet(
GenericViewSet,
CreateModelMixin,
ListModelMixin,
):
serializer_class = CommentBlameSerializer
queryset = CommentBlame.objects.all()
| 21.765957 | 66 | 0.765396 | 75 | 1,023 | 10.36 | 0.373333 | 0.19305 | 0.226512 | 0.277992 | 0.303732 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173998 | 1,023 | 46 | 67 | 22.23913 | 0.919527 | 0 | 0 | 0.432432 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.108108 | 0 | 0.432432 | 0 | 0 | 0 | 1 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e2bc818e01945d9c0408c4cbbc441b836d509f64 | 374 | py | Python | polls/api/views.py | s-wirth/thesis | a093dfb39a644b95509e2f5b25fbf3b2efa72545 | [
"MIT"
] | null | null | null | polls/api/views.py | s-wirth/thesis | a093dfb39a644b95509e2f5b25fbf3b2efa72545 | [
"MIT"
] | null | null | null | polls/api/views.py | s-wirth/thesis | a093dfb39a644b95509e2f5b25fbf3b2efa72545 | [
"MIT"
] | null | null | null | from rest_framework.generics import ListAPIView, RetrieveAPIView
from polls.models import Question
from .serializers import PollSerializer
class PollListAPIView(ListAPIView):
queryset = Question.objects.all()
serializer_class = PollSerializer
class PollDetailAPIView(RetrieveAPIView):
queryset = Question.objects.all()
serializer_class = PollSerializer
| 24.933333 | 64 | 0.807487 | 36 | 374 | 8.305556 | 0.527778 | 0.12709 | 0.153846 | 0.173913 | 0.367893 | 0.367893 | 0.367893 | 0 | 0 | 0 | 0 | 0 | 0.13369 | 374 | 14 | 65 | 26.714286 | 0.92284 | 0 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
e2d559a3ca341530971501bcc976d147a40ae603 | 962 | py | Python | tests/st/utils/network.py | PushkarJ/node | 097d86c82a57b274a1a5d02de967cad4ee4c0efc | [
"Apache-2.0"
] | 3,973 | 2015-07-29T21:13:46.000Z | 2022-03-31T09:27:38.000Z | tests/st/utils/network.py | PushkarJ/node | 097d86c82a57b274a1a5d02de967cad4ee4c0efc | [
"Apache-2.0"
] | 4,584 | 2015-07-29T08:47:22.000Z | 2022-03-31T22:54:26.000Z | tests/st/utils/network.py | PushkarJ/node | 097d86c82a57b274a1a5d02de967cad4ee4c0efc | [
"Apache-2.0"
] | 1,066 | 2015-07-30T06:29:18.000Z | 2022-03-31T20:01:47.000Z | # Copyright (c) 2015-2016 Tigera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
import os
logger = logging.getLogger(__name__)
class DummyNetwork(object):
def __init__(self, name):
self.name = name
self.network = name
self.deleted = False
def delete(self, host=None):
pass
def disconnect(self, host, container):
pass
def __str__(self):
return self.name
| 31.032258 | 74 | 0.709979 | 137 | 962 | 4.89781 | 0.664234 | 0.089419 | 0.038748 | 0.04769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015852 | 0.213098 | 962 | 30 | 75 | 32.066667 | 0.870542 | 0.601871 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.142857 | 0.142857 | 0.071429 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
e2d685b2b16223505f4de0741358a36023cbbc1e | 537 | py | Python | binary_search.py | matteoalberici4/algorithms | 4ce633f324bb0c945661bd5fdfcf214470fa0562 | [
"Apache-2.0"
] | null | null | null | binary_search.py | matteoalberici4/algorithms | 4ce633f324bb0c945661bd5fdfcf214470fa0562 | [
"Apache-2.0"
] | null | null | null | binary_search.py | matteoalberici4/algorithms | 4ce633f324bb0c945661bd5fdfcf214470fa0562 | [
"Apache-2.0"
] | null | null | null | # Binary search
def binary_search(A: list, x: int):
i = 0
j = len(A)
while i < j:
m = (i + j) // 2
if A[m] == x:
return True
elif A[m] > x:
j = m
else:
i = m + 1
return False
def recursive_binary_search(A: list, x: int, start: int, end: int):
if end >= start:
m = start + (end - start) // 2
if A[m] == x:
return m
elif A[m] > m:
return recursive_binary_search(A, start, m - 1, x)
else:
return recursive_binary_search(A, m + 1, end, x)
else:
return -1 | 20.653846 | 67 | 0.519553 | 91 | 537 | 2.989011 | 0.263736 | 0.220588 | 0.191176 | 0.242647 | 0.448529 | 0.242647 | 0 | 0 | 0 | 0 | 0 | 0.019718 | 0.33892 | 537 | 26 | 68 | 20.653846 | 0.746479 | 0.024209 | 0 | 0.217391 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.086957 | false | 0 | 0 | 0 | 0.347826 | 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 |
e2e2dc06730b59c854b6d2860c899cd9a7b8b670 | 64 | py | Python | gseapy/__init__.py | oreh/gseapy | d3212afb2e8d61f37957d685da6ef28f723d98e6 | [
"MIT"
] | 1 | 2021-01-15T02:02:12.000Z | 2021-01-15T02:02:12.000Z | gseapy/__init__.py | oreh/gseapy | d3212afb2e8d61f37957d685da6ef28f723d98e6 | [
"MIT"
] | null | null | null | gseapy/__init__.py | oreh/gseapy | d3212afb2e8d61f37957d685da6ef28f723d98e6 | [
"MIT"
] | null | null | null | #
from .gsea import call, replot, prerank
__version__ ='0.4.3' | 12.8 | 39 | 0.703125 | 10 | 64 | 4.1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 0.15625 | 64 | 5 | 40 | 12.8 | 0.703704 | 0 | 0 | 0 | 0 | 0 | 0.078125 | 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 |
3925b2784023edda66e35c0c33a7eb363d9b6d50 | 123 | py | Python | home/iot/urls.py | he0119/smart-home | bdd3a59a8c46c0fdc07ac3049bf589c7f95a2683 | [
"MIT"
] | null | null | null | home/iot/urls.py | he0119/smart-home | bdd3a59a8c46c0fdc07ac3049bf589c7f95a2683 | [
"MIT"
] | 223 | 2020-02-21T06:16:56.000Z | 2022-03-01T22:24:19.000Z | home/iot/urls.py | he0119/smart-home | bdd3a59a8c46c0fdc07ac3049bf589c7f95a2683 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
app_name = "iot"
urlpatterns = [
path("", views.iot, name="iot"),
]
| 13.666667 | 36 | 0.650407 | 17 | 123 | 4.647059 | 0.588235 | 0.177215 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195122 | 123 | 8 | 37 | 15.375 | 0.79798 | 0 | 0 | 0 | 0 | 0 | 0.04878 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
394657e58f8379a3486e573f239234d8779f7390 | 468 | py | Python | part8/app/application_business_rules/boundary/output_port/memo_output_port.py | y-tomimoto/CleanArchitecture | dd7cc8966c29ad24bf39a8b0672eae6341004037 | [
"MIT"
] | 4 | 2021-09-03T04:03:38.000Z | 2021-12-26T14:59:50.000Z | part9/app/application_business_rules/boundary/output_port/memo_output_port.py | y-tomimoto/CleanArchitecture | dd7cc8966c29ad24bf39a8b0672eae6341004037 | [
"MIT"
] | null | null | null | part9/app/application_business_rules/boundary/output_port/memo_output_port.py | y-tomimoto/CleanArchitecture | dd7cc8966c29ad24bf39a8b0672eae6341004037 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from enterprise_business_rules.dto.output_memo_dto import OutputMemoDTO
class MemoOutputPort(ABC):
@abstractmethod
def create_view_for_get(self, output_memo_dto: OutputMemoDTO) -> str:
pass
@abstractmethod
def create_view_for_save(self, output_memo_dto: OutputMemoDTO) -> str:
pass
@abstractmethod
def create_view_for_get_by_day(self, output_memo_dto: OutputMemoDTO) -> str:
pass | 27.529412 | 80 | 0.75 | 59 | 468 | 5.59322 | 0.40678 | 0.121212 | 0.157576 | 0.245455 | 0.627273 | 0.627273 | 0.518182 | 0.406061 | 0.406061 | 0.406061 | 0 | 0 | 0.185897 | 468 | 17 | 81 | 27.529412 | 0.866142 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0.166667 | 0 | 0.5 | 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 |
1a4642cd5a6decb58fd1c3701afb24397ea89305 | 14,016 | py | Python | contrail_dashboard/content/networks/ipam/forms.py | gzimin/contrail-dashboard | 24b295fdd2dd45155fa8f9e22addb26de2c6ca47 | [
"Apache-2.0"
] | null | null | null | contrail_dashboard/content/networks/ipam/forms.py | gzimin/contrail-dashboard | 24b295fdd2dd45155fa8f9e22addb26de2c6ca47 | [
"Apache-2.0"
] | null | null | null | contrail_dashboard/content/networks/ipam/forms.py | gzimin/contrail-dashboard | 24b295fdd2dd45155fa8f9e22addb26de2c6ca47 | [
"Apache-2.0"
] | null | null | null | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.conf import settings # noqa
from django.core.urlresolvers import reverse # noqa
from django.core import validators
from django.forms import ValidationError # noqa
from django.utils.translation import ugettext_lazy as _ # noqa
from horizon import exceptions
from horizon import forms
from horizon import messages
from horizon.forms import fields
from horizon.utils import validators as utils_validators
from openstack_dashboard import api
from contrail_dashboard.api.contrail_quantum import *
from openstack_dashboard.utils import filters
from netaddr import *
class CreateNetworkIpam(forms.SelfHandlingForm):
name = forms.CharField(label=_("Name"),
error_messages={
'required': _('This field is required.'),
'invalid': _("The string may only contain"
" ASCII characters and numbers.")},
validators=[validators.validate_slug])
dnsmethod = forms.ChoiceField(label=_('DNS Method'),
choices=[('default', _('Default')),
('vdns', _('Virtual DNS')),
('tenantdns', _('Tenant DNS')),
('none', _('None'))],
widget=forms.Select(attrs={'class': 'switchable',
'data-slug': 'dnsmethod'}))
vdns = forms.CharField(label=_("Virtual DNS"),
required=False,
help_text=_("FQ Name of Virtual DNS i.e. default-domain:vdns"),
widget=forms.TextInput(
attrs={'class': 'switched',
'data-switch-on': 'dnsmethod',
'data-dnsmethod-vdns': _('Virtual DNS')}))
tenantdns = fields.IPField(label=_("Tenant DNS Server IP"),
required=False,
help_text=_("Tenant managed DNS Server's IP Address"),
version=fields.IPv4,
mask=False,
widget=forms.TextInput(
attrs={'class': 'switched',
'data-switch-on': 'dnsmethod',
'data-dnsmethod-tenantdns': _('Tenant DNS Server IP')}))
ntpip = fields.IPField(label=_("NTP Server IP"),
required=False,
help_text=_("IP Address of the NTP Server"),
version=fields.IPv4,
mask=False,
widget=forms.TextInput())
domainname = forms.CharField(label=_("Domain Name"),
required=False,
help_text=_("Domain Name i.e. openstack.org"),
widget=forms.TextInput())
def clean(self):
cleaned_data = super(CreateNetworkIpam, self).clean()
name = cleaned_data.get("name")
dnsmethod = cleaned_data.get("dnsmethod")
vdns = cleaned_data.get("vdns")
tenantdns = cleaned_data.get("tenantdns")
ntpip = cleaned_data.get("ntpip")
domainname = cleaned_data.get("domainname")
if dnsmethod == 'vdns' and not len(vdns):
msg = _('Virtual DNS : Enter a valid Virtual DNS in FQN format')
raise ValidationError(msg)
if dnsmethod == 'tenantdns':
if not tenantdns:
msg = _('Tenant DNS Server IP : Enter Tenant DNS Server IP address')
raise ValidationError(msg)
elif not len(tenantdns):
msg = _('Tenant DNS Server IP : Enter Tenant DNS Server IP address')
raise ValidationError(msg)
return cleaned_data
def handle(self, request, data):
params = {'name': data['name'],
'mgmt': {'ipam_method': None,
'dhcp_option_list': {'dhcp_option': []}}}
if data['domainname']:
params['mgmt']['dhcp_option_list']['dhcp_option'].append(
{'dhcp_option_name': '15',
'dhcp_option_value': data['domainname']}
)
if data['ntpip']:
params['mgmt']['dhcp_option_list']['dhcp_option'].append(
{'dhcp_option_name': '4',
'dhcp_option_value': data['ntpip']}
)
params['mgmt']['ipam_dns_server'] = {}
params['mgmt']['ipam_dns_server']['tenant_dns_server_address'] = {}
params['mgmt']['ipam_dns_server']['virtual_dns_server_name'] = None
if data['dnsmethod'] == 'default':
params['mgmt']['ipam_dns_method'] = 'default-dns-server'
if data['dnsmethod'] == 'none':
params['mgmt']['ipam_dns_method'] = 'none'
if data['dnsmethod'] == 'tenantdns':
params['mgmt']['ipam_dns_method'] = 'tenant-dns-server'
if data['tenantdns']:
params['mgmt']['ipam_dns_server']['tenant_dns_server_address']['ip_address'] = []
params['mgmt']['ipam_dns_server']['tenant_dns_server_address']['ip_address'].append(data['tenantdns'])
if data['dnsmethod'] == 'vdns':
params['mgmt']['ipam_dns_method'] = 'virtual-dns-server'
params['mgmt']['ipam_dns_server']['virtual_dns_server_name'] = data['vdns']
try:
ipam = ipam_create(request, **params)
messages.success(request,
_('Successfully created network ipam: %s') % data['name'])
return ipam
except Exception:
redirect = reverse("horizon:project:networks:index")
exceptions.handle(request,
_('Unable to create network ipam.'),
redirect=redirect)
class UpdateIpam(forms.SelfHandlingForm):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(label=_("Name"),
widget=forms.TextInput(attrs={'readonly': 'readonly'}),
validators=[validators.validate_slug])
dnsmethod = forms.ChoiceField(label=_('DNS Method'),
choices=[('default', _('Default')),
('vdns', _('Virtual DNS')),
('tenantdns', _('Tenant DNS')),
('none', _('None'))],
widget=forms.Select(attrs={
'class': 'switchable',
'data-slug': 'dnsmethod'}))
vdns = forms.CharField(label=_("Virtual DNS"),
required=False,
help_text=_("FQ Name of Virtual DNS i.e. default-domain:vdns"),
widget=forms.TextInput(attrs={
'class': 'switched',
'data-switch-on': 'dnsmethod',
'data-dnsmethod-vdns': _('Virtual DNS')}))
tenantdns = fields.IPField(label=_("Tenant DNS Server IP"),
required=False,
help_text=_("Tenant managed DNS Server's IP Address"),
version=fields.IPv4,
mask=False,
widget=forms.TextInput(attrs={
'class': 'switched',
'data-switch-on': 'dnsmethod',
'data-dnsmethod-tenantdns': _('Tenant DNS Server IP')}))
ntpip = fields.IPField(label=_("NTP Server IP"),
required=False,
help_text=_("IP Address of the NTP Server"),
version=fields.IPv4,
mask=False,
widget=forms.TextInput())
domainname = forms.CharField(label=_("Domain Name"),
required=False,
help_text=_("Domain Name i.e. openstack.org"),
widget=forms.TextInput())
def __init__(self, *args, **kwargs):
ipam_obj = kwargs.pop('ipam_obj', {})
mgmt = ipam_obj.__dict__['_apidict']['mgmt']
super(UpdateIpam, self).__init__(*args, **kwargs)
if mgmt['ipam_dns_method'] == 'default-dns-server':
self.fields['dnsmethod'].initial = 'default'
if mgmt['ipam_dns_method'] == 'tenant-dns-server':
self.fields['dnsmethod'].initial = 'tenantdns'
if ('ipam_dns_server' in mgmt and
'tenant_dns_server_address' in mgmt['ipam_dns_server'] and
'ip_address' in mgmt['ipam_dns_server']['tenant_dns_server_address']):
for ip in mgmt['ipam_dns_server']['tenant_dns_server_address']['ip_address']:
self.fields['tenantdns'].initial = ip
if mgmt['ipam_dns_method'] == 'virtual-dns-server':
self.fields['dnsmethod'].initial = 'vdns'
if ('ipam_dns_server' in mgmt and
'virtual_dns_server_name' in mgmt['ipam_dns_server'] and
mgmt['ipam_dns_server']['virtual_dns_server_name'] is not None):
self.fields['vdns'].initial = mgmt['ipam_dns_server']['virtual_dns_server_name']
if mgmt['ipam_dns_method'] == 'none':
self.fields['dnsmethod'].initial = 'none'
if 'dhcp_option_list' in mgmt:
dhcp_list = mgmt['dhcp_option_list']
if dhcp_list and 'dhcp_option' in dhcp_list:
for entry in mgmt['dhcp_option_list']['dhcp_option']:
if entry['dhcp_option_name'] == '4':
self.fields['ntpip'].initial = entry['dhcp_option_value']
if entry['dhcp_option_name'] == '15':
self.fields['domainname'].initial = entry['dhcp_option_value']
def clean(self):
cleaned_data = super(UpdateIpam, self).clean()
name = cleaned_data.get("name")
dnsmethod = cleaned_data.get("dnsmethod")
vdns = cleaned_data.get("vdns")
tenantdns = cleaned_data.get("tenantdns")
ntpip = cleaned_data.get("ntpip")
domainname = cleaned_data.get("domainname")
if dnsmethod == 'vdns' and not len(vdns):
msg = _('Virtual DNS : Enter a valid Virtual DNS in FQN format')
raise ValidationError(msg)
if dnsmethod == 'tenantdns':
if not tenantdns:
msg = _('Tenant DNS Server IP : Enter Tenant DNS Server IP address')
raise ValidationError(msg)
elif not len(tenantdns):
msg = _('Tenant DNS Server IP : Enter Tenant DNS Server IP address')
raise ValidationError(msg)
return cleaned_data
def handle(self, request, data):
params = {'mgmt': {'ipam_method': None,
'dhcp_option_list': {'dhcp_option': []}}}
if data['domainname']:
params['mgmt']['dhcp_option_list']['dhcp_option'].append(
{'dhcp_option_name': '15',
'dhcp_option_value':
data['domainname']})
if data['ntpip']:
params['mgmt']['dhcp_option_list']['dhcp_option'].append(
{'dhcp_option_name': '4',
'dhcp_option_value':
data['ntpip']})
params['mgmt']['ipam_dns_server'] = {}
params['mgmt']['ipam_dns_server']['tenant_dns_server_address'] = {}
params['mgmt']['ipam_dns_server']['virtual_dns_server_name'] = None
if data['dnsmethod'] == 'default':
params['mgmt']['ipam_dns_method'] = 'default-dns-server'
if data['dnsmethod'] == 'none':
params['mgmt']['ipam_dns_method'] = 'none'
if data['dnsmethod'] == 'tenantdns':
params['mgmt']['ipam_dns_method'] = 'tenant-dns-server'
if data['tenantdns']:
params['mgmt']['ipam_dns_server']['tenant_dns_server_address']['ip_address'] = []
params['mgmt']['ipam_dns_server']['tenant_dns_server_address']['ip_address'].append(data['tenantdns'])
if data['dnsmethod'] == 'vdns':
params['mgmt']['ipam_dns_method'] = 'virtual-dns-server'
params['mgmt']['ipam_dns_server']['virtual_dns_server_name'] = data['vdns']
try:
ipam = ipam_modify(request, ipam_id=data['id'], **params)
messages.success(request,
_('Successfully updated network ipam: %s') % data['name'])
return ipam
except Exception:
redirect = reverse("horizon:project:networks:index")
exceptions.handle(request,
_('Unable to update network ipam.'),
redirect=redirect)
| 45.954098 | 118 | 0.526541 | 1,369 | 14,016 | 5.193572 | 0.157779 | 0.074684 | 0.046414 | 0.04782 | 0.737131 | 0.700985 | 0.670183 | 0.649648 | 0.639241 | 0.633193 | 0 | 0.003084 | 0.352169 | 14,016 | 304 | 119 | 46.105263 | 0.779956 | 0.056364 | 0 | 0.708861 | 0 | 0 | 0.27668 | 0.037416 | 0 | 0 | 0 | 0 | 0 | 1 | 0.021097 | false | 0 | 0.059072 | 0 | 0.160338 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1a51ce17e500d0f92115bda5567132b52e5563e6 | 117 | py | Python | dartsclone/__init__.py | expnn/darts-clone-python | e78f4d8b2193e512f182e392829f1517dc46df15 | [
"Apache-2.0"
] | null | null | null | dartsclone/__init__.py | expnn/darts-clone-python | e78f4d8b2193e512f182e392829f1517dc46df15 | [
"Apache-2.0"
] | null | null | null | dartsclone/__init__.py | expnn/darts-clone-python | e78f4d8b2193e512f182e392829f1517dc46df15 | [
"Apache-2.0"
] | null | null | null | from dartsclone._dartsclone import DoubleArray, TraverseState
__all__ = [
"DoubleArray",
"TraverseState",
]
| 16.714286 | 61 | 0.735043 | 9 | 117 | 9 | 0.666667 | 0.592593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.17094 | 117 | 6 | 62 | 19.5 | 0.835052 | 0 | 0 | 0 | 0 | 0 | 0.205128 | 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 |
1a61df1ef96c820378981c6cada53bbbb1e309df | 912 | py | Python | app/models.py | EmilLuta/BamBank | 59de4d287ba1055e1f47aee8755f9d49f95fa0a1 | [
"Unlicense"
] | null | null | null | app/models.py | EmilLuta/BamBank | 59de4d287ba1055e1f47aee8755f9d49f95fa0a1 | [
"Unlicense"
] | null | null | null | app/models.py | EmilLuta/BamBank | 59de4d287ba1055e1f47aee8755f9d49f95fa0a1 | [
"Unlicense"
] | null | null | null | from datetime import datetime
from flask.ext.login import UserMixin
from app import db
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(30))
password = db.Column(db.String(128))
balance = db.Column(db.Integer)
def __repr__(self):
return 'User #{} - {}'.format(self.id, self.username)
class Transaction(db.Model):
id = db.Column(db.Integer, primary_key=True)
from_id = db.Column(db.Integer, db.ForeignKey('user.id'))
to_id = db.Column(db.Integer, db.ForeignKey('user.id'))
amount = db.Column(db.Integer)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
from_user = db.relationship('User', foreign_keys=[from_id], backref=db.backref('sent_transactions', uselist=True))
to_user = db.relationship('User', foreign_keys=[to_id], backref=db.backref('received_transaction', uselist=True)) | 41.454545 | 118 | 0.710526 | 132 | 912 | 4.780303 | 0.340909 | 0.114105 | 0.142631 | 0.161648 | 0.326466 | 0.326466 | 0.22187 | 0.22187 | 0.117274 | 0 | 0 | 0.006378 | 0.140351 | 912 | 22 | 119 | 41.454545 | 0.798469 | 0 | 0 | 0.111111 | 0 | 0 | 0.078861 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0.055556 | 0.166667 | 0.055556 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
1a648592ab13a8eec979beb3ea5cf76790095ed8 | 10,770 | py | Python | misc/test_compsp.py | wrensuess/prospector | 08173f84ddfc2b031c78822344fc821778d35bae | [
"MIT"
] | 94 | 2016-10-12T19:29:58.000Z | 2022-03-24T13:25:39.000Z | misc/test_compsp.py | wrensuess/prospector | 08173f84ddfc2b031c78822344fc821778d35bae | [
"MIT"
] | 168 | 2016-04-15T20:01:34.000Z | 2022-03-31T21:03:07.000Z | misc/test_compsp.py | wrensuess/prospector | 08173f84ddfc2b031c78822344fc821778d35bae | [
"MIT"
] | 53 | 2016-07-14T07:19:11.000Z | 2022-03-21T03:10:28.000Z | # Test the analytic full SFR integrals implemented in SSPBasis against the
# COMPSP implementations of same.
import sys, os, time
import numpy as np
import matplotlib.pyplot as pl
import fsps
from prospect.sources import CompositeSFH
sfhtype = {1:'tau', 4: 'delaytau', 5: 'simha'}
compute_vega_mags = False
zcontinuous = 1
sps = fsps.StellarPopulation(compute_vega_mags=compute_vega_mags,
zcontinuous=zcontinuous)
mysps = CompositeSFH(sfh_type='tau', interp_type='logarithmic', flux_interp='linear',
compute_vega_mags=compute_vega_mags, zcontinuous=zcontinuous)
mysps.configure()
sspages = np.insert(mysps.logage, 0, 0)
mysps.mint_log=-3
wlo = 1e3
whi = 1.2e4
def main():
tage = 1.4
# vary sf_trunc
sf_trunc = tage * np.linspace(0.90, 1.02, 9)
figlist = test_taumodel_sft(values=sf_trunc, tau=1.0,
sf_slope=10.0, tage=tage, sfh=4)
figlist[1].axes[0].set_xlim(5, 9)
figlist[0].savefig('figures/test_sft_spec.pdf')
figlist[1].savefig('figures/test_sft_wght.pdf')
# vary sf_trunc, simha SFH
sf_trunc = tage * np.linspace(0.90, 1.02, 9)
figlist = test_taumodel_sft(values=sf_trunc, tau=4.2,
sf_slope=10.0, tage=tage, sfh=5)
figlist[1].axes[0].set_xlim(5, 10.5)
figlist[0].savefig('figures/test_sft_simha_spec.pdf')
figlist[1].savefig('figures/test_sft_simha_wght.pdf')
#sys.exit()
# vary sf_slope
figlist = test_taumodel_sfslope()
figlist[1].axes[0].set_xlim(5, 10.5)
figlist[0].savefig('figures/test_sfslope_spec.pdf')
figlist[1].savefig('figures/test_sfslope_wght.pdf')
# vary tage
figlist = test_taumodel_tage(sfh=1)
figlist[0].savefig('figures/test_tage_spec.pdf')
figlist[1].savefig('figures/test_tage_wght.pdf')
# vary tau
figlist = test_taumodel_tau(sfh=1)
figlist[0].savefig('figures/test_tau_spec.pdf')
figlist[1].savefig('figures/test_tau_wght.pdf')
#pl.show()
def test_mint_convergence():
"""Test convergence of most recent bin.
"""
sfh_params = {'tage': 1e9, 'tau':14e9}
# set up an array of minimum values, and get the weights for each minimum value
mint = np.linspace(-4, 2, 100)
w = np.zeros([len(mint), len(mysps.logage)+1])
for i, m in enumerate(mint):
mysps.update(**sfh_params)
mysps.mint_log = m
mysps.configure()
w[i,:] = mysps.all_ssp_weights
# Plot summed weight for zeroth and 1st SSP
pl.figure()
zero = (w[:,0] + w[:,1])
pl.plot(mint, zero, '-o')
pl.yscale('log')
pl.show()
# Plot fractional weight error (relative to smallest tmin) as a function of tmin
pl.figure()
pl.plot(np.log10(mint), 1 - w[:,0]/w[0,0], '-o')
pl.plot(np.log10(mint), 1 - w[:,1]/w[0,1], '-o')
pl.show()
def test_taumodel_dust(values=np.linspace(0.0, 4.0, 9),
tage=3.0, tau=1.0, sfh=1):
pname = r'$\tau_V$'
sps.params['sfh'] = sfh
mysps.sfh_type = sfhtype[sfh]
mysps.configure()
sfig, saxes = pl.subplots(2, 1, figsize=(11, 8.5))
rax, dax = saxes
#wfig, wax = pl.subplots()
for dust2 in values:
sps.params['tau'] = tau
sps.params['tage'] = tage
sps.params['dust2'] = dust2
sfh_params = {'tage': tage*1e9, 'tau': tau*1e9, 'dust2': dust2}
w, spec = sps.get_spectrum(tage=tage, peraa=True)
mw, myspec, mstar = mysps.get_galaxy_spectrum(**sfh_params)
rax.plot(mw, myspec / spec, label=r'{}={:4.2f}'.format(pname, dust2))
dax.plot(mw, spec - myspec, label=r'{}={:4.2f}'.format(pname, dust2))
#wax.plot(sspages, mysps.all_ssp_weights, '-o', label=r'{}={:4.2f}'.format(pname, dust2))
rax.set_xlim(1e3, 1e7)
rax.set_ylabel('pro / FSPS')
dax.set_xlim(1e3, 1e7)
dax.set_ylabel('FSPS - pro')
[ax.set_xscale('log') for ax in [rax, dax]]
[ax.text(0.1, 0.8, r'$\tau_{{SF}}={}, tage={}$'.format(tau, tage), transform=ax.transAxes)
for ax in [rax, dax]]
[ax.legend(loc=0, prop={'size': 10}) for ax in [rax, dax]]
#wax.set_yscale('log')
#wax.set_xlabel('log t$_{lookback}$')
#wax.set_ylabel('weight')
[ax.set_title('SFH={} ({} model)'.format(sfh, sfhtype[sfh]))
for ax in [rax]]
return [sfig]
def test_taumodel_tau(values=10**np.linspace(-1, 1, 9),
tage=10.0, sfh=1):
"""Test (delayed-) tau models
"""
pname = r'$\tau$'
sps.params['sfh'] = sfh
mysps.sfh_type = sfhtype[sfh]
mysps.configure()
sfig, saxes = pl.subplots(2, 1, figsize=(11, 8.5))
rax, dax = saxes
wfig, wax = pl.subplots()
for tau in values:
sps.params['tau'] = tau
sps.params['tage'] = tage
sfh_params = {'tage': tage*1e9, 'tau': tau*1e9}
w, spec = sps.get_spectrum(tage=tage, peraa=True)
mw, myspec, mstar = mysps.get_galaxy_spectrum(**sfh_params)
rax.plot(mw, myspec / spec, label=r'{}={:4.2f}'.format(pname, tau))
dax.plot(mw, spec - myspec, label=r'{}={:4.2f}'.format(pname, tau))
wax.plot(sspages, mysps.all_ssp_weights, '-o', label=r'{}={:4.2f}'.format(pname, tau))
rax.set_xlim(wlo, whi)
rax.set_ylabel('pro / FSPS')
dax.set_xlim(wlo, whi)
dax.set_ylabel('FSPS - pro')
[ax.legend(loc=0, prop={'size': 10}) for ax in [rax, dax, wax]]
wax.set_yscale('log')
wax.set_xlabel('log t$_{lookback}$')
wax.set_ylabel('weight')
[ax.set_title('SFH={} ({} model)'.format(sfh, sfhtype[sfh]))
for ax in [rax, wax]]
return [sfig, wfig]
def test_taumodel_tage(values=10**np.linspace(np.log10(0.11), 1, 9),
tau=1.0, sf_slope=0.0, sfh=1):
"""Test (delayed-) tau models
"""
pname = 'tage'
sps.params['sfh'] = sfh
mysps.sfh_type = sfhtype[sfh]
mysps.configure()
sfig, saxes = pl.subplots(2, 1, figsize=(11, 8.5))
rax, dax = saxes
wfig, wax = pl.subplots()
for tage in values:
sps.params['tau'] = tau
sps.params['tage'] = tage
#sps.params['sf_slope'] = sf_slope
sfh_params = {'tage': tage*1e9, 'tau': tau*1e9}
w, spec = sps.get_spectrum(tage=tage, peraa=True)
mw, myspec, mstar = mysps.get_galaxy_spectrum(**sfh_params)
rax.plot(mw, myspec / spec, label=r'{}={:4.2f}'.format(pname, tage))
dax.plot(mw, spec - myspec, label=r'{}={:4.2f}'.format(pname, tage))
wax.plot(sspages, mysps.all_ssp_weights, '-o', label=r'{}={:4.2f}'.format(pname, tage))
rax.set_xlim(wlo, whi)
rax.set_ylabel('pro / FSPS')
dax.set_xlim(wlo, whi)
dax.set_ylabel('FSPS - pro')
[ax.legend(loc=0, prop={'size': 10}) for ax in [rax, dax, wax]]
wax.set_yscale('log')
wax.set_xlabel('log t$_{lookback}$')
wax.set_ylabel('weight')
[ax.set_title('SFH={} ({} model)'.format(sfh, sfhtype[sfh]))
for ax in [rax, wax]]
return [sfig, wfig]
def test_taumodel_sft(values=11 - 10**np.linspace(np.log10(0.11), 1, 9),
tau=1.0, sf_slope=0, tage=11.0, sfh=1):
"""Test (delayed-) tau models with a truncation
"""
pname = 'sf_trunc'
sps.params['sfh'] = sfh
mysps.sfh_type = sfhtype[sfh]
mysps.configure()
sfig, saxes = pl.subplots(2, 1, figsize=(11, 8.5))
rax, dax = saxes
wfig, wax = pl.subplots()
for sf_trunc in values:
sps.params['tau'] = tau
sps.params['tage'] = tage
sps.params['sf_trunc'] = sf_trunc
sps.params['sf_slope'] = sf_slope
sfh_params = {'tage': tage*1e9, 'tau': tau*1e9, 'sf_trunc': sf_trunc*1e9,
'sf_slope': sf_slope / 1e9}
w, spec = sps.get_spectrum(tage=tage, peraa=True)
mw, myspec, mstar = mysps.get_galaxy_spectrum(**sfh_params)
rax.plot(mw, myspec / spec, label=r'{}={:4.2f}'.format(pname, sf_trunc))
dax.plot(mw, spec - myspec, label=r'{}={:4.2f}'.format(pname, sf_trunc))
wax.plot(sspages, mysps.all_ssp_weights, '-o', label=r'{}={:4.2f}'.format(pname, sf_trunc))
#print(mysps.all_ssp_weights.sum())
if tage > sf_trunc:
wax.axvline(np.log10((tage - sf_trunc) * 1e9), linestyle=':', color='k')
rax.set_xlim(wlo, whi)
rax.set_ylabel('pro / FSPS')
dax.set_xlim(wlo, whi)
dax.set_ylabel('FSPS - pro')
[ax.text(0.1, 0.8, '$tau_{{SF}}={}, tage={}$\n sf_slope={:3.1f}'.format(tau, tage, sf_slope), transform=ax.transAxes)
for ax in [rax, dax, wax]]
[ax.legend(loc=0, prop={'size': 10}) for ax in [rax, dax, wax]]
wax.set_yscale('log')
wax.set_xlabel('log t$_{lookback}$')
wax.set_ylabel('weight')
logttrunc = np.log10((tage - values) * 1e9)
wax.set_xlim(logttrunc.min() - 0.5, logttrunc.max() + 0.5)
[ax.set_title('SFH={} ({} model)'.format(sfh, sfhtype[sfh]))
for ax in [rax, wax]]
return [sfig, wfig]
def test_taumodel_sfslope(values=np.linspace(-10, 10, 9),
tau=10.0, sf_trunc=10.0, tage=11.0, sfh=5):
"""Test (delayed-) tau models
"""
pname = 'sf_slope'
sps.params['sfh'] = sfh
mysps.sfh_type = sfhtype[sfh]
mysps.configure()
sfig, saxes = pl.subplots(2, 1, figsize=(11, 8.5))
rax, dax = saxes
wfig, wax = pl.subplots()
for sf_slope in values:
sps.params['tau'] = tau
sps.params['tage'] = tage
sps.params['sf_trunc'] = sf_trunc
sps.params['sf_slope'] = sf_slope
sfh_params = {'tage': tage*1e9, 'tau': tau*1e9, 'sf_trunc': sf_trunc*1e9,
'sf_slope': sf_slope / 1e9}
w, spec = sps.get_spectrum(tage=tage, peraa=True)
mw, myspec, mstar = mysps.get_galaxy_spectrum(**sfh_params)
rax.plot(mw, myspec / spec, label=r'{}={:4.2f}'.format(pname, sf_slope))
dax.plot(mw, spec - myspec, label=r'{}={:4.2f}'.format(pname, sf_slope))
wax.plot(sspages, mysps.all_ssp_weights, '-o', label=r'{}={:4.2f}'.format(pname, sf_slope))
wax.axvline(np.log10((tage - sf_trunc) * 1e9), linestyle=':', color='k')
#print(mysps.all_ssp_weights.sum())
rax.set_xlim(wlo, whi)
rax.set_ylabel('pro / FSPS')
dax.set_xlim(wlo, whi)
dax.set_ylabel('FSPS - pro')
[ax.legend(loc=0, prop={'size': 10}) for ax in [rax, dax, wax]]
[ax.text(0.1, 0.8, '$tau_{{SF}}={}, tage={}$\n sf_trunc={}'.format(tau, tage, sf_trunc), transform=ax.transAxes)
for ax in [rax, dax, wax]]
wax.set_yscale('log')
wax.set_xlabel('log t$_{lookback}$')
wax.set_ylabel('weight')
logttrunc = np.log10((tage - values) * 1e9)
wax.set_xlim(logttrunc.min() - 0.5, logttrunc.max() + 0.5)
[ax.set_title('SFH={} ({} model)'.format(sfh, sfhtype[sfh]))
for ax in [rax, wax]]
return [sfig, wfig]
if __name__ == "__main__":
main()
| 38.602151 | 121 | 0.598886 | 1,641 | 10,770 | 3.798294 | 0.11883 | 0.028076 | 0.016846 | 0.021659 | 0.7648 | 0.756137 | 0.735601 | 0.684101 | 0.645115 | 0.616236 | 0 | 0.037716 | 0.219591 | 10,770 | 278 | 122 | 38.741007 | 0.703867 | 0.081616 | 0 | 0.558559 | 0 | 0 | 0.111619 | 0.027625 | 0 | 0 | 0 | 0 | 0 | 1 | 0.031532 | false | 0 | 0.022523 | 0 | 0.076577 | 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 |
1a6b30e88a6f30aa2a3a8b20000c5cddd916bfb3 | 648 | py | Python | backend/pycloud_api/models/schemas/package.py | git-albertomarin/pycloud | 2d273096bc16d09ec2890ca3e3200ad64bde92d3 | [
"Apache-2.0"
] | 3 | 2020-02-23T12:54:47.000Z | 2021-01-09T11:32:49.000Z | backend/pycloud_api/models/schemas/package.py | git-albertomarin/pycloud | 2d273096bc16d09ec2890ca3e3200ad64bde92d3 | [
"Apache-2.0"
] | 5 | 2021-03-09T22:04:10.000Z | 2022-02-18T14:07:29.000Z | backend/pycloud_api/models/schemas/package.py | albmarin/Pycloud | 2d273096bc16d09ec2890ca3e3200ad64bde92d3 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from typing import Optional, List
from pydantic import UrlStr, constr
from .dbmodel import DBModelMixin, ObjectIdStr
from .rwmodel import RWModel
from .user import UserInDB
class Package(RWModel):
name: str
summary: Optional[str] = ""
maintainers: Optional[List[UserInDB]]
class PackageInDB(DBModelMixin, Package):
pass
class Release(RWModel):
description: str
download_url: Optional[UrlStr]
home_page: Optional[UrlStr]
version: constr(max_length=80)
keywords: constr(max_length=255)
package: Optional[ObjectIdStr] = None
class ReleaseInDB(DBModelMixin, Release):
pass
| 19.636364 | 46 | 0.726852 | 75 | 648 | 6.226667 | 0.52 | 0.051392 | 0.06424 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011299 | 0.180556 | 648 | 32 | 47 | 20.25 | 0.868173 | 0.032407 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.1 | 0.25 | 0 | 0.9 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
1a8027fa13bfc3f9070de05f89dc571b7fabad99 | 242 | py | Python | srv-manuals/pyinfra/deploy.py | 0054/lab | da1637ecc334a716084de55fe01741f208859c3b | [
"MIT"
] | null | null | null | srv-manuals/pyinfra/deploy.py | 0054/lab | da1637ecc334a716084de55fe01741f208859c3b | [
"MIT"
] | null | null | null | srv-manuals/pyinfra/deploy.py | 0054/lab | da1637ecc334a716084de55fe01741f208859c3b | [
"MIT"
] | null | null | null | import pyinfra.operations as o
import pyinfra
from pyinfra.operations import yum, server, apt
server.shell(
name = 'Run shell command',
commands = 'df -h')
yum.packages(
packages = ['bash-completions']
)
| 15.125 | 47 | 0.632231 | 28 | 242 | 5.464286 | 0.678571 | 0.169935 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.268595 | 242 | 15 | 48 | 16.133333 | 0.864407 | 0 | 0 | 0 | 0 | 0 | 0.158996 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
1aa3236bf14f1a976e1df6829a06ab91bfbb45ff | 10,663 | py | Python | tests/sat/Models/c765.180.UNSAT.dimacs.test.py | bernardocuteri/wasp | 05c8f961776dbdbf7afbf905ee00fc262eba51ad | [
"Apache-2.0"
] | 19 | 2015-12-03T08:53:45.000Z | 2022-03-31T02:09:43.000Z | tests/sat/Models/c765.180.UNSAT.dimacs.test.py | bernardocuteri/wasp | 05c8f961776dbdbf7afbf905ee00fc262eba51ad | [
"Apache-2.0"
] | 80 | 2017-11-25T07:57:32.000Z | 2018-06-10T19:03:30.000Z | tests/sat/Models/c765.180.UNSAT.dimacs.test.py | bernardocuteri/wasp | 05c8f961776dbdbf7afbf905ee00fc262eba51ad | [
"Apache-2.0"
] | 6 | 2015-01-15T07:51:48.000Z | 2020-06-18T14:47:48.000Z | input = """
c num blocks = 1
c num vars = 180
c minblockids[0] = 1
c maxblockids[0] = 180
p cnf 180 765
43 -70 -94 0
80 70 -20 0
34 -89 37 0
-99 -140 153 0
-30 131 14 0
136 20 17 0
-125 -172 -114 0
19 -13 -126 0
127 -138 -142 0
-127 -84 79 0
-63 -13 50 0
-15 -118 17 0
6 65 -116 0
-30 -167 157 0
-156 -143 -12 0
38 -60 154 0
-121 18 -76 0
142 -152 130 0
177 41 -62 0
-51 180 -105 0
-61 -76 26 0
-177 -180 -110 0
32 42 -144 0
155 119 73 0
95 -39 104 0
111 -56 -167 0
126 82 -111 0
-64 159 -36 0
-28 -79 40 0
157 -130 88 0
172 16 -88 0
100 21 -110 0
93 40 -22 0
-172 -179 28 0
178 36 -104 0
-45 1 -100 0
-55 -1 32 0
178 32 -16 0
-26 22 63 0
-13 -42 73 0
-131 107 -16 0
-61 -98 -91 0
154 -42 -67 0
-161 -87 9 0
-151 27 -77 0
129 121 -122 0
108 -97 -15 0
-6 12 86 0
-108 -171 -57 0
-30 -145 175 0
1 -78 3 0
141 54 -62 0
-69 -119 58 0
-177 142 -59 0
-144 -164 163 0
21 -116 -119 0
106 -69 -129 0
174 34 -2 0
-33 -119 -152 0
88 -45 -142 0
-56 -164 -22 0
-15 82 -132 0
-162 -45 179 0
67 46 -78 0
-11 -170 86 0
-145 111 -21 0
-23 20 -27 0
39 60 53 0
160 -116 -47 0
-160 45 102 0
-113 143 45 0
112 115 -140 0
29 174 -126 0
132 157 -25 0
123 69 -167 0
99 -36 -63 0
-164 29 -43 0
-152 149 -23 0
149 35 173 0
-81 75 -84 0
-161 -142 84 0
-124 -113 -172 0
7 -143 -18 0
90 55 -118 0
179 -103 23 0
-119 -35 161 0
-160 -153 -133 0
114 99 -4 0
-116 -85 122 0
141 72 -71 0
-163 52 -20 0
-112 144 161 0
-173 111 -120 0
-145 -33 -86 0
-31 144 -94 0
-74 94 158 0
-4 107 -119 0
15 -43 -76 0
117 179 -51 0
159 -104 158 0
-160 -117 21 0
-23 97 59 0
-97 143 91 0
8 61 69 0
41 164 160 0
60 -175 -160 0
-27 169 -67 0
-178 33 -69 0
-119 -107 83 0
53 93 -160 0
-45 -155 -153 0
9 167 15 0
-38 127 168 0
-28 -69 -108 0
135 21 -117 0
146 48 41 0
139 -2 104 0
44 -31 176 0
104 -23 -109 0
106 49 123 0
-14 -2 -63 0
-170 -5 -177 0
88 -180 -161 0
175 23 168 0
98 -135 -45 0
79 -161 136 0
-140 123 -129 0
-104 -79 178 0
-158 46 24 0
76 -165 -65 0
-31 82 -29 0
-16 -124 58 0
-11 83 -21 0
43 -33 -121 0
4 133 23 0
-9 -157 72 0
-27 -86 13 0
35 140 54 0
167 64 21 0
-118 -122 97 0
-23 149 126 0
65 128 96 0
-167 -175 -177 0
-53 -116 -92 0
52 139 37 0
-50 -1 -85 0
105 -132 53 0
-119 -8 20 0
-112 100 53 0
-74 45 -39 0
-59 -44 -23 0
-31 146 1 0
23 114 -20 0
39 -25 166 0
54 110 47 0
-43 -9 154 0
116 -123 -109 0
-26 138 -12 0
-169 128 37 0
-147 -119 -105 0
17 -49 -21 0
174 27 18 0
101 -121 -166 0
-99 161 -90 0
9 90 -142 0
158 161 169 0
-38 -9 171 0
-165 87 -48 0
-18 -15 148 0
-48 -130 -57 0
-32 -2 50 0
-171 65 -30 0
12 -30 29 0
-106 -136 -67 0
-98 -61 174 0
29 46 -132 0
177 -116 42 0
-140 176 10 0
-147 105 165 0
57 68 -95 0
56 44 -173 0
-68 9 119 0
-89 69 -172 0
-17 146 15 0
6 149 27 0
-141 -32 -136 0
-111 -67 84 0
-147 -133 -108 0
137 -126 -123 0
175 105 -101 0
-60 177 -98 0
52 -19 -31 0
-61 -123 -91 0
-155 101 62 0
44 119 -109 0
8 138 32 0
166 131 -56 0
-46 -54 -116 0
66 132 100 0
-158 -83 180 0
117 160 69 0
-159 -132 48 0
-21 -59 -123 0
-107 -42 27 0
-9 -50 35 0
-56 96 142 0
143 110 -147 0
75 17 -68 0
22 17 -144 0
-56 152 41 0
-141 163 -108 0
-66 -49 -155 0
-134 8 157 0
-18 49 31 0
-4 -106 146 0
-153 38 -39 0
-99 -61 119 0
-105 156 98 0
-42 -173 178 0
25 -102 -51 0
-180 -85 -6 0
-18 52 129 0
-93 130 -25 0
-149 77 106 0
-157 -180 43 0
-136 -129 -87 0
-121 151 -83 0
79 153 -15 0
-85 13 -116 0
-63 150 74 0
-8 95 -1 0
171 -152 -167 0
-165 176 -17 0
-35 -74 -122 0
160 155 -87 0
32 -73 -106 0
145 -180 -47 0
-39 178 -120 0
-120 35 174 0
112 167 58 0
-42 53 135 0
50 141 54 0
32 -101 154 0
-128 85 -143 0
-90 -53 -144 0
-50 -143 46 0
65 -175 9 0
-4 -3 16 0
-158 103 88 0
-110 142 -27 0
-146 -138 -133 0
151 -71 -129 0
116 24 119 0
-25 -116 138 0
-170 -77 -5 0
111 -154 87 0
47 39 89 0
148 163 -106 0
-156 -38 -168 0
-25 4 165 0
-1 -13 15 0
164 -15 -92 0
-65 -163 19 0
-10 -137 -131 0
46 86 149 0
-30 61 168 0
-75 93 43 0
-89 114 -25 0
-159 163 -9 0
53 73 -148 0
-124 32 -27 0
94 104 -164 0
134 -143 -11 0
-107 -85 61 0
21 55 82 0
5 170 54 0
83 117 34 0
-1 -31 -78 0
54 162 43 0
-171 48 4 0
-157 -45 -135 0
55 -131 127 0
13 76 -173 0
-109 -120 -25 0
19 82 -31 0
27 30 68 0
6 9 72 0
-63 -86 -62 0
97 160 -53 0
129 5 102 0
-178 -116 -19 0
-95 -157 -59 0
171 17 157 0
-178 -61 -98 0
42 -43 81 0
110 -139 -134 0
-158 -146 116 0
18 22 79 0
-161 130 -59 0
68 -133 -9 0
163 30 -177 0
-30 -34 114 0
89 -170 83 0
64 -55 -82 0
-3 121 -145 0
41 -74 87 0
-135 -19 11 0
32 81 31 0
130 -138 31 0
123 -63 39 0
-94 -38 149 0
-168 -125 -35 0
139 -95 -87 0
131 -56 -85 0
168 152 78 0
170 -145 39 0
121 -131 124 0
-124 83 177 0
50 -42 -37 0
-39 -37 158 0
156 107 115 0
171 35 -121 0
74 14 -51 0
-72 -21 -97 0
-44 102 85 0
-174 -46 2 0
-168 -6 -42 0
-75 42 47 0
-16 -112 -146 0
102 -82 79 0
-111 -33 -167 0
-167 -101 130 0
-74 -71 -17 0
110 -117 -88 0
171 92 -80 0
-39 126 -91 0
66 -165 83 0
87 -28 9 0
-128 -84 -15 0
-146 128 -90 0
31 -78 39 0
160 132 79 0
86 -111 -171 0
-138 -175 -128 0
101 46 85 0
-78 1 63 0
40 96 -53 0
68 -123 109 0
-74 79 132 0
-90 20 50 0
-180 97 -53 0
-60 112 143 0
157 -175 -40 0
79 -82 -160 0
-159 142 -9 0
129 -179 131 0
-107 72 34 0
-71 -163 16 0
-131 -64 10 0
-48 150 -30 0
52 -118 155 0
-72 42 -87 0
-135 118 16 0
178 3 -70 0
-28 -3 116 0
95 -60 160 0
73 -162 -39 0
129 -130 163 0
140 53 -130 0
-25 -108 -134 0
169 -4 -60 0
107 -113 55 0
171 -91 179 0
-111 -59 94 0
14 -56 -40 0
-125 -44 172 0
-34 42 -101 0
79 70 -139 0
-53 -106 55 0
17 158 128 0
102 -60 146 0
-134 -56 -176 0
71 153 89 0
-48 -97 -168 0
-15 23 160 0
107 119 93 0
-148 -142 12 0
26 -142 -16 0
10 179 -160 0
63 -179 112 0
-105 -17 -141 0
172 164 55 0
-107 -26 67 0
142 12 -125 0
-18 -148 -92 0
-87 -116 -84 0
-134 12 35 0
-150 142 82 0
-95 -171 -154 0
-72 18 81 0
24 -166 68 0
-146 45 -122 0
-89 -57 -77 0
57 68 -98 0
6 -169 73 0
94 138 -41 0
-41 46 -36 0
104 -161 -149 0
121 13 -92 0
-150 115 2 0
-93 18 136 0
-80 115 81 0
128 -15 39 0
-71 109 -111 0
-94 -147 53 0
-165 116 -54 0
179 -8 -148 0
48 -114 65 0
160 -127 -68 0
40 -88 -59 0
43 -63 15 0
-15 -6 -23 0
-112 140 49 0
78 -102 -93 0
120 -20 -42 0
51 15 -114 0
159 20 -75 0
-85 -3 10 0
-104 54 72 0
132 142 21 0
-151 122 153 0
-20 -81 -59 0
113 -132 -29 0
-113 -58 74 0
-130 88 144 0
91 -84 -2 0
5 -74 -145 0
-106 171 140 0
90 -134 115 0
145 50 -13 0
12 54 24 0
-129 101 -18 0
-60 -126 5 0
-179 -107 100 0
-103 -35 -7 0
34 66 7 0
-128 -23 -11 0
70 -92 23 0
19 166 140 0
-154 87 173 0
77 -103 -70 0
-26 177 86 0
152 72 -141 0
95 -64 -169 0
-147 57 -162 0
21 69 124 0
-157 -5 -68 0
128 11 -66 0
-154 61 92 0
18 -11 -175 0
-119 51 163 0
58 157 176 0
-124 63 -10 0
71 -160 -127 0
26 87 136 0
94 -148 134 0
49 -82 43 0
-164 -87 -167 0
162 -83 -167 0
-66 126 55 0
-88 -92 167 0
64 106 158 0
113 124 -118 0
-84 -91 146 0
160 114 131 0
-57 43 -7 0
160 -38 -65 0
-7 83 129 0
-131 82 -48 0
-79 122 -121 0
-157 54 -176 0
40 44 -56 0
-116 -98 36 0
26 142 -69 0
-20 90 -69 0
-117 -50 -111 0
-17 173 108 0
-96 31 -98 0
-164 30 -151 0
120 139 -50 0
-144 147 56 0
4 91 -39 0
-126 155 105 0
-174 106 -7 0
-169 86 136 0
121 -20 -55 0
-97 -93 104 0
-164 -104 102 0
-8 101 -39 0
-124 -31 -107 0
88 93 -63 0
-28 -84 -108 0
-91 135 155 0
-76 112 35 0
-50 99 56 0
-114 -77 56 0
-76 -99 13 0
-20 16 117 0
-11 1 179 0
-11 -68 133 0
81 155 -17 0
106 110 158 0
123 -137 -78 0
94 -11 -123 0
-137 -174 136 0
-138 154 36 0
19 -72 -78 0
165 14 -2 0
116 -26 119 0
107 79 -10 0
120 82 -158 0
24 55 -139 0
22 -25 102 0
-32 -94 -36 0
-64 150 5 0
-178 60 33 0
166 62 110 0
-77 -138 -11 0
12 -146 101 0
-73 -1 -123 0
15 -154 -150 0
109 -59 115 0
33 139 42 0
174 -177 -13 0
-124 146 125 0
136 1 -173 0
-172 -147 -51 0
142 45 163 0
-150 -177 137 0
52 170 -71 0
-54 -178 -83 0
-129 -51 127 0
-110 -141 -19 0
-155 129 87 0
-153 -116 84 0
101 139 54 0
119 -134 92 0
67 -49 110 0
-2 59 -53 0
75 105 100 0
51 -85 112 0
-41 -22 -120 0
-78 92 48 0
138 102 -108 0
-98 -26 90 0
-132 111 -113 0
-30 -160 170 0
-163 78 58 0
129 24 169 0
112 166 107 0
92 -12 104 0
169 -49 107 0
44 -86 -55 0
-83 -88 4 0
-103 -158 -71 0
37 18 -130 0
-62 -175 51 0
157 -137 -97 0
-72 -141 -96 0
-163 -40 -146 0
32 133 -10 0
-180 28 -102 0
-138 88 -157 0
-139 -179 -80 0
-80 -21 -169 0
15 -168 -10 0
-63 -41 -96 0
29 -95 -118 0
-83 -87 146 0
-119 -62 -135 0
60 -175 -128 0
81 145 73 0
93 -167 112 0
28 -79 -158 0
163 171 -162 0
-74 100 138 0
153 69 -176 0
-153 -174 -65 0
141 -29 165 0
126 158 112 0
-165 92 161 0
-82 125 15 0
15 -170 -71 0
68 89 -118 0
-172 56 45 0
-120 -52 177 0
-129 -127 168 0
-36 49 -147 0
135 -47 -10 0
16 -103 -28 0
52 -64 -87 0
-105 -71 140 0
-9 97 -136 0
95 -85 -93 0
-161 82 -107 0
-118 11 83 0
16 132 -21 0
166 103 -102 0
44 68 -19 0
149 -150 -170 0
8 -93 -6 0
-142 -29 66 0
-47 -85 -112 0
19 123 -2 0
-119 149 -152 0
-144 99 -150 0
-19 152 51 0
118 13 147 0
-73 -25 -15 0
173 -13 -11 0
-126 -98 -35 0
-160 91 60 0
27 -52 45 0
122 -33 -13 0
53 -22 87 0
-78 -44 -89 0
-11 -117 33 0
107 121 -143 0
-166 -66 147 0
140 124 29 0
115 -52 -112 0
-18 94 149 0
-141 142 -144 0
8 -152 56 0
107 40 -110 0
106 110 -144 0
-47 -167 -162 0
15 14 -91 0
27 93 -157 0
146 105 -138 0
154 38 127 0
170 39 -156 0
17 -19 84 0
-170 23 -46 0
36 -91 -81 0
-114 161 -113 0
167 -136 -16 0
-54 -134 -33 0
30 47 -127 0
-10 12 -14 0
-91 141 28 0
-32 -44 -38 0
-144 90 142 0
1 -118 -169 0
-178 -44 -79 0
-115 -70 -109 0
111 -102 93 0
21 -90 83 0
82 -50 154 0
158 -114 -82 0
-96 -174 137 0
-18 -161 -19 0
-24 -2 -136 0
-34 175 167 0
-155 13 -124 0
130 98 -76 0
-61 109 -143 0
-24 149 33 0
148 132 -44 0
-79 17 169 0
-127 158 150 0
162 139 -37 0
-100 66 -65 0
67 -50 78 0
107 -124 59 0
-72 114 -24 0
-172 -52 -118 0
-82 115 42 0
-90 -48 51 0
-80 -45 124 0
-106 -180 46 0
58 -172 129 0
87 105 -52 0
-99 -178 -176 0
-52 -4 113 0
-113 101 -76 0
-51 68 67 0
-10 -68 77 0
128 138 -126 0
10 147 20 0
-47 50 -126 0
-61 -73 -112 0
-77 -46 -138 0
37 -102 -12 0
62 -2 31 0
-165 32 -4 0
-169 -134 149 0
137 -32 33 0
127 49 67 0
-169 -84 -47 0
-43 6 117 0
20 104 54 0
122 141 103 0
-72 -142 -149 0
2 -62 -10 0
-136 -103 -9 0
-173 -44 -24 0
-8 57 169 0
9 -146 -47 0
76 -28 146 0
-149 -115 89 0
94 -157 81 0
176 -106 162 0
12 -2 -123 0
-82 -25 60 0
-123 74 -180 0
-62 -38 -36 0
-87 -99 44 0
-131 -82 122 0
-115 -85 -52 0
163 44 -117 0
63 42 -136 0
4 16 -71 0
-64 42 -142 0
-104 -15 106 0
4 139 -89 0
-70 -42 144 0
86 17 -91 0
7 -29 -21 0
-16 -127 -104 0
154 144 -157 0
-16 -121 -51 0
-124 164 142 0
-145 -39 -165 0
136 91 44 0
100 -33 -3 0
110 167 -47 0
2 -128 -105 0
-76 -142 73 0
55 95 -121 0
62 -12 20 0
20 -34 -14 0
-175 -99 19 0
166 74 175 0
61 -123 100 0
127 92 21 0
1 -38 -3 0
135 107 -38 0
174 12 19 0
176 97 136 0
152 -3 102 0
163 -108 -6 0
15 -47 -56 0
92 164 -105 0
-144 11 46 0
26 113 49 0
141 152 -7 0
-39 16 37 0
-129 -101 -50 0
-42 89 111 0
27 72 -84 0
167 -4 11 0
-154 -178 176 0
138 -149 -73 0
-89 9 -127 0
"""
output = "UNSAT"
| 13.75871 | 22 | 0.596361 | 3,083 | 10,663 | 2.062601 | 0.062601 | 0.004718 | 0.001887 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.831507 | 0.289787 | 10,663 | 774 | 23 | 13.776486 | 0.008187 | 0 | 0 | 0 | 0 | 0 | 0.997374 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1ab83da7c2062cf5cc475de448b40326bcf8b514 | 188 | py | Python | desafio003.py | RickChaves29/Desafios-Python | 9d67036ca2ba9c6db2a649a381cac832ac83035f | [
"MIT"
] | null | null | null | desafio003.py | RickChaves29/Desafios-Python | 9d67036ca2ba9c6db2a649a381cac832ac83035f | [
"MIT"
] | null | null | null | desafio003.py | RickChaves29/Desafios-Python | 9d67036ca2ba9c6db2a649a381cac832ac83035f | [
"MIT"
] | null | null | null | algo = input('Digite algo: ')
print('Tipo do valor:', type(algo))
print('è um número ?:', algo.isnumeric())
print('é alfabeto', algo.isalpha())
print('é um alfanumerico ', algo.isalnum())
| 31.333333 | 43 | 0.670213 | 27 | 188 | 4.666667 | 0.62963 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117021 | 188 | 5 | 44 | 37.6 | 0.759036 | 0 | 0 | 0 | 0 | 0 | 0.367021 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.8 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
1ab957f1c02022b1e16808ece063ffc00a8778cc | 196 | py | Python | src/tests/test_MST.py | xiaonanln/study-the-algorithm-design-manual | 0b9654564f9cffe58232b5e7759d21c8486ebd0a | [
"MIT"
] | 10 | 2018-01-10T22:27:41.000Z | 2022-02-08T12:18:47.000Z | src/tests/test_MST.py | xiaonanln/study-the-algorithm-design-manual | 0b9654564f9cffe58232b5e7759d21c8486ebd0a | [
"MIT"
] | null | null | null | src/tests/test_MST.py | xiaonanln/study-the-algorithm-design-manual | 0b9654564f9cffe58232b5e7759d21c8486ebd0a | [
"MIT"
] | 2 | 2018-05-07T15:07:59.000Z | 2018-10-29T12:50:56.000Z |
import unittest
class TestMST(unittest.TestCase):
pass
def testPrim(self):
pass
def testPrimPQ(self):
pass
def testKruskal(self):
pass
if __name__ == '__main__':
unittest.main()
| 10.315789 | 33 | 0.704082 | 24 | 196 | 5.416667 | 0.583333 | 0.161538 | 0.169231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188776 | 196 | 18 | 34 | 10.888889 | 0.81761 | 0 | 0 | 0.363636 | 0 | 0 | 0.041026 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.363636 | 0.090909 | 0 | 0.454545 | 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 |
1abc05173a9d61e694136033106eb349d0c9ef6d | 1,745 | py | Python | kh_site/group_coaching/migrations/0004_auto_20171226_0914.py | nhuntwalker/kyeisha-site | ccccc4a277f354a5f64c38476885a499483f80fc | [
"MIT"
] | null | null | null | kh_site/group_coaching/migrations/0004_auto_20171226_0914.py | nhuntwalker/kyeisha-site | ccccc4a277f354a5f64c38476885a499483f80fc | [
"MIT"
] | 7 | 2020-06-05T18:51:41.000Z | 2022-03-11T23:28:14.000Z | kh_site/group_coaching/migrations/0004_auto_20171226_0914.py | nhuntwalker/kyeisha-site | ccccc4a277f354a5f64c38476885a499483f80fc | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-12-26 09:14
from __future__ import unicode_literals
from django.db import migrations
import redactor.fields
class Migration(migrations.Migration):
dependencies = [
('group_coaching', '0003_auto_20171225_1144'),
]
operations = [
migrations.AlterField(
model_name='coachingevent',
name='logistics',
field=redactor.fields.RedactorField(default='<ul>\n <li><p>8 group sessions total</p></li>\n <li><p>Weekly “office hours” (TBD in the new year) over the phone where I’m available for troubleshooting, Q&A, and check-ins</p></li>\n <li><p>Formation of daily self-care practice-exercises (Monday through Friday) to help you stay focused, build momentum, and move forward throughout the week</p></li>\n <li><p>Tailored invitations to work on between sessions to help you get stronger and more free</p></li>\n</ul>'),
),
migrations.AlterField(
model_name='coachingevent',
name='outline',
field=redactor.fields.RedactorField(default='<ul>\n <li><p>Session 1 & 2 - Liberate our minds by understanding and REMOVING the negative effects of historical and individual trauma.</p></li>\n\n <li><p>Session 3 & 4 Understand your current self-care practices and design ones that support you in developing you ideal self.</p></li>\n\n <li><p>Session 5 & 6 Clarify your values and beliefs (including the limiting ones) in order to begin living an intentional, joy filled life.</p></li>\n\n <li><p>Session 7 & 8 - Begin designing life goals in order to crate clarity, purpose and restore passion.</p></li>\n </ul>'),
),
]
| 64.62963 | 667 | 0.674499 | 256 | 1,745 | 4.554688 | 0.570313 | 0.020583 | 0.027444 | 0.037736 | 0.212693 | 0.194683 | 0.11578 | 0.077187 | 0.077187 | 0 | 0 | 0.029496 | 0.203438 | 1,745 | 26 | 668 | 67.115385 | 0.809353 | 0.037822 | 0 | 0.315789 | 1 | 0.105263 | 0.693317 | 0.013723 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.052632 | 0.157895 | 0 | 0.315789 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
1abf4cb881c4f3e60d1cfc3f8381caa53f423178 | 627 | py | Python | resources/home/dnanexus/get_reference.py | edawson/parliament2 | 2632aa3484ef64c9539c4885026b705b737f6d1e | [
"Apache-2.0"
] | null | null | null | resources/home/dnanexus/get_reference.py | edawson/parliament2 | 2632aa3484ef64c9539c4885026b705b737f6d1e | [
"Apache-2.0"
] | null | null | null | resources/home/dnanexus/get_reference.py | edawson/parliament2 | 2632aa3484ef64c9539c4885026b705b737f6d1e | [
"Apache-2.0"
] | 1 | 2020-05-28T23:01:44.000Z | 2020-05-28T23:01:44.000Z | def main():
reference_chosen = False
with open("ref.fa", 'r') as f:
chrs = set()
for line in f:
if line.startswith(">chr1") and "LN:248956422" in line:
print "hg38"
reference_chosen = True
break
if line.startswith('>'):
chrs.add(line)
if not line.startswith('>chr'):
print "b37"
reference_chosen = True
break
if not reference_chosen:
if len(chrs) == 195:
print "hg38"
else:
print "hg19"
main() | 27.26087 | 67 | 0.441786 | 64 | 627 | 4.265625 | 0.546875 | 0.21978 | 0.117216 | 0.175824 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 0.061765 | 0.457735 | 627 | 23 | 68 | 27.26087 | 0.741176 | 0 | 0 | 0.285714 | 0 | 0 | 0.070064 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.190476 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
46eadb703c8a458f192dbb234130f8a2b55bea35 | 140 | py | Python | ai/predict/urls.py | thdwlsgus0/relay_15 | b5cb66ca250afd5402b0f19c870fda1852b77a28 | [
"MIT"
] | 3 | 2020-08-07T05:35:28.000Z | 2020-08-10T00:48:11.000Z | ai/predict/urls.py | thdwlsgus0/relay_15 | b5cb66ca250afd5402b0f19c870fda1852b77a28 | [
"MIT"
] | null | null | null | ai/predict/urls.py | thdwlsgus0/relay_15 | b5cb66ca250afd5402b0f19c870fda1852b77a28 | [
"MIT"
] | 11 | 2020-07-28T00:45:51.000Z | 2020-11-22T18:34:52.000Z | from django.urls import path
from . import views
app_name = 'predict'
urlpatterns = [
path('predict/', views.PredictView.as_view()),
] | 17.5 | 50 | 0.707143 | 18 | 140 | 5.388889 | 0.722222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157143 | 140 | 8 | 51 | 17.5 | 0.822034 | 0 | 0 | 0 | 0 | 0 | 0.106383 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
201372a1e4705cccc6f2f54157adc81b9c9721fc | 16 | py | Python | slos/test/fixtures/Billing_Item.py | softlayer/softlayer-cinder-driver | 465c2a15b7692f9fa1171a212fe162a990267e62 | [
"MIT"
] | 2 | 2016-04-19T14:08:47.000Z | 2016-05-30T02:57:19.000Z | slos/test/fixtures/Billing_Item.py | softlayer/softlayer-cinder-driver | 465c2a15b7692f9fa1171a212fe162a990267e62 | [
"MIT"
] | 1 | 2015-02-23T09:32:25.000Z | 2015-02-23T09:32:25.000Z | slos/test/fixtures/Billing_Item.py | softlayer/softlayer-cinder-driver | 465c2a15b7692f9fa1171a212fe162a990267e62 | [
"MIT"
] | 1 | 2016-04-19T14:17:13.000Z | 2016-04-19T14:17:13.000Z | cancelItem = {}
| 8 | 15 | 0.625 | 1 | 16 | 10 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | 16 | 1 | 16 | 16 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
2041c3ff2e98a5828dc6f00ad03b705cc7fd6dec | 332 | py | Python | chainer_ext/functions.py | dojitza/ddnn | adbe5c20f2f6b2c3d875af8b651cce22138928ff | [
"Unlicense"
] | 110 | 2017-09-07T03:29:34.000Z | 2022-03-28T12:41:00.000Z | chainer_ext/functions.py | dojitza/ddnn | adbe5c20f2f6b2c3d875af8b651cce22138928ff | [
"Unlicense"
] | 9 | 2017-10-11T12:12:44.000Z | 2021-04-02T01:40:49.000Z | chainer_ext/functions.py | dojitza/ddnn | adbe5c20f2f6b2c3d875af8b651cce22138928ff | [
"Unlicense"
] | 58 | 2017-07-30T12:48:40.000Z | 2022-03-07T01:18:24.000Z | from chainer import function,cuda
import chainer.functions as F
class Entropy(function.Function):
def forward(self, x):
xp = cuda.get_array_module(*x)
y = x[0] * xp.log(x[0]+1e-9)
return -xp.sum(y,1),
def backward(self, x, gy):
return gy,
def entropy(x):
return Entropy()(x) | 25.538462 | 38 | 0.593373 | 51 | 332 | 3.823529 | 0.54902 | 0.051282 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020661 | 0.271084 | 332 | 13 | 39 | 25.538462 | 0.785124 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.181818 | 0.181818 | 0.818182 | 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 |
204e3b65323bf10a3eefefb2dfd884929e9c6a3a | 764 | py | Python | biobb_chemistry/test/unitests/test_acpype/test_acpype_params_cns.py | bioexcel/biobb_chemistry | 86b37fa073a813b64f28874ab6002171b8080eca | [
"Apache-2.0"
] | null | null | null | biobb_chemistry/test/unitests/test_acpype/test_acpype_params_cns.py | bioexcel/biobb_chemistry | 86b37fa073a813b64f28874ab6002171b8080eca | [
"Apache-2.0"
] | 3 | 2019-12-10T11:26:28.000Z | 2021-04-26T10:01:31.000Z | biobb_chemistry/test/unitests/test_acpype/test_acpype_params_cns.py | bioexcel/biobb_chemistry | 86b37fa073a813b64f28874ab6002171b8080eca | [
"Apache-2.0"
] | 2 | 2019-11-03T22:58:18.000Z | 2021-01-09T12:57:59.000Z | from biobb_common.tools import test_fixtures as fx
from biobb_chemistry.acpype.acpype_params_cns import acpype_params_cns
class TestAcpypeParamsCNS():
def setUp(self):
fx.test_setup(self,'acpype_params_cns')
def tearDown(self):
fx.test_teardown(self)
pass
def test_params_cns(self):
acpype_params_cns(properties=self.properties, **self.paths)
assert fx.not_empty(self.paths['output_path_par'])
assert fx.not_empty(self.paths['output_path_inp'])
#assert fx.not_empty(self.paths['output_path_top'])
assert fx.equal(self.paths['output_path_inp'], self.paths['ref_output_acpype_path_inp'])
#assert fx.equal(self.paths['output_path_top'], self.paths['ref_output_acpype_path_top'])
| 38.2 | 97 | 0.72644 | 110 | 764 | 4.718182 | 0.290909 | 0.138728 | 0.144509 | 0.183044 | 0.456647 | 0.433526 | 0.325626 | 0.202312 | 0 | 0 | 0 | 0 | 0.160995 | 764 | 19 | 98 | 40.210526 | 0.809672 | 0.180628 | 0 | 0 | 0 | 0 | 0.141026 | 0.041667 | 0 | 0 | 0 | 0 | 0.230769 | 1 | 0.230769 | false | 0.076923 | 0.153846 | 0 | 0.461538 | 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 |
20524479dca991d090edc80fdde07b36a0b66bea | 445 | py | Python | wstools/utils/roman_num.py | inductiveload/wstools | b354a642b10a8d1bfa2a7683d2270c42512cb25d | [
"MIT"
] | null | null | null | wstools/utils/roman_num.py | inductiveload/wstools | b354a642b10a8d1bfa2a7683d2270c42512cb25d | [
"MIT"
] | null | null | null | wstools/utils/roman_num.py | inductiveload/wstools | b354a642b10a8d1bfa2a7683d2270c42512cb25d | [
"MIT"
] | null | null | null |
def roman_to_int(s):
s = s.upper()
try:
rom_val = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
int_val = 0
for i in range(len(s)):
if i > 0 and rom_val[s[i]] > rom_val[s[i - 1]]:
int_val += rom_val[s[i]] - 2 * rom_val[s[i - 1]]
else:
int_val += rom_val[s[i]]
return int_val
except KeyError:
pass
return None | 23.421053 | 83 | 0.433708 | 74 | 445 | 2.445946 | 0.5 | 0.198895 | 0.19337 | 0.220994 | 0.254144 | 0.154696 | 0 | 0 | 0 | 0 | 0 | 0.077778 | 0.393258 | 445 | 19 | 84 | 23.421053 | 0.592593 | 0 | 0 | 0 | 0 | 0 | 0.015766 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0.071429 | 0 | 0 | 0.214286 | 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 |
647ed173aea3b20537085ef6e013182ef554ff77 | 158 | py | Python | Modules/dRun.py | amaurijp/BioSPA | fd10b58c5a6aa444f34690a98cd939dd5111c4d5 | [
"MIT"
] | 3 | 2019-10-29T17:26:24.000Z | 2021-01-08T22:15:17.000Z | Modules/dRun.py | amaurijp/BioSPA | fd10b58c5a6aa444f34690a98cd939dd5111c4d5 | [
"MIT"
] | null | null | null | Modules/dRun.py | amaurijp/BioSPA | fd10b58c5a6aa444f34690a98cd939dd5111c4d5 | [
"MIT"
] | null | null | null | import os
diretorio=os.getcwd()
exec(open(diretorio + '/dTopographyAnalysis_t1.py').read())
exec(open(diretorio + '/dTopographyAnalysis_t2.py').read())
| 14.363636 | 59 | 0.727848 | 19 | 158 | 5.947368 | 0.578947 | 0.141593 | 0.300885 | 0.637168 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013986 | 0.094937 | 158 | 10 | 60 | 15.8 | 0.776224 | 0 | 0 | 0 | 0 | 0 | 0.33121 | 0.33121 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
64a1de4104eddbd6133a5e582a56a4280d74331c | 677 | py | Python | mysite/main/views.py | flohh-py/django-tutorial | feecb2b25d88abe0cdccdae4cef87658fa5d8ea7 | [
"MIT"
] | null | null | null | mysite/main/views.py | flohh-py/django-tutorial | feecb2b25d88abe0cdccdae4cef87658fa5d8ea7 | [
"MIT"
] | null | null | null | mysite/main/views.py | flohh-py/django-tutorial | feecb2b25d88abe0cdccdae4cef87658fa5d8ea7 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.views.generic import View
from django.contrib.auth.views import LoginView
from django.urls import reverse_lazy
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
class BaseView(LoginRequiredMixin, PermissionRequiredMixin):
pass
class MainLoginView(LoginView):
template_name = 'main/mainlogin.html'
fields = '__all__'
redirect_authenticated_user = True
permission_required = None
def get_redirect_url(self):
return reverse_lazy('main_url')
class MainView(LoginRequiredMixin, View):
def get(self, request):
return render(request, 'main/main.html')
| 27.08 | 82 | 0.774003 | 78 | 677 | 6.551282 | 0.538462 | 0.097847 | 0.066536 | 0.082192 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152142 | 677 | 24 | 83 | 28.208333 | 0.890244 | 0 | 0 | 0 | 0 | 0 | 0.070901 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0.058824 | 0.294118 | 0.117647 | 0.941176 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 |
64d694c8a7b02bcda2592c47960f61f504552b82 | 15 | py | Python | fileb.py | sicilyChen/python | 30b09bb35c57ef5f9b8950c1d38fe7322a6273bb | [
"Apache-2.0"
] | null | null | null | fileb.py | sicilyChen/python | 30b09bb35c57ef5f9b8950c1d38fe7322a6273bb | [
"Apache-2.0"
] | null | null | null | fileb.py | sicilyChen/python | 30b09bb35c57ef5f9b8950c1d38fe7322a6273bb | [
"Apache-2.0"
] | null | null | null | file=('b,txt',) | 15 | 15 | 0.533333 | 3 | 15 | 2.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 1 | 15 | 15 | 0.533333 | 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 |
b3788abd79bcb56fabae9c1af9b9b261c85dd9ad | 188 | py | Python | synergine2_cocos2d/actions.py | buxx/synergine2 | 843988df5e653a413eca8c486ee93f5e9e884f37 | [
"MIT"
] | 1 | 2021-02-26T15:36:04.000Z | 2021-02-26T15:36:04.000Z | synergine2_cocos2d/actions.py | buxx/synergine2 | 843988df5e653a413eca8c486ee93f5e9e884f37 | [
"MIT"
] | 182 | 2017-03-06T10:20:19.000Z | 2021-06-10T14:12:36.000Z | synergine2_cocos2d/actions.py | buxx/synergine2 | 843988df5e653a413eca8c486ee93f5e9e884f37 | [
"MIT"
] | 1 | 2018-01-01T15:38:24.000Z | 2018-01-01T15:38:24.000Z | # coding: utf-8
from cocos.actions import MoveTo as BaseMoveTo
class MoveTo(BaseMoveTo):
def update(self, t):
super().update(t)
self.target.need_update_cshape = True
| 20.888889 | 46 | 0.68617 | 26 | 188 | 4.884615 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006757 | 0.212766 | 188 | 8 | 47 | 23.5 | 0.851351 | 0.069149 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b38df552d0faa6de354858e7c94b009cb777e6d4 | 262 | py | Python | agent/python/perper/protocol/cache/instance_data.py | aph5nt/perper | ca3d63e0d0dd21b950f4ba038f16fd8e3b1ab566 | [
"MIT"
] | null | null | null | agent/python/perper/protocol/cache/instance_data.py | aph5nt/perper | ca3d63e0d0dd21b950f4ba038f16fd8e3b1ab566 | [
"MIT"
] | null | null | null | agent/python/perper/protocol/cache/instance_data.py | aph5nt/perper | ca3d63e0d0dd21b950f4ba038f16fd8e3b1ab566 | [
"MIT"
] | null | null | null | from collections import OrderedDict
from pyignite import GenericObjectMeta
from pyignite.datatypes import String
class InstanceData(
metaclass=GenericObjectMeta,
schema=OrderedDict(
[
("agent", String),
]
),
):
pass
| 17.466667 | 38 | 0.667939 | 22 | 262 | 7.954545 | 0.636364 | 0.137143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.263359 | 262 | 14 | 39 | 18.714286 | 0.906736 | 0 | 0 | 0 | 0 | 0 | 0.019084 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.083333 | 0.25 | 0 | 0.333333 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
b3946f6d539ba858832202dc445dfb27b98096c4 | 177 | py | Python | flaim/product_search/urls.py | bfssi-forest-dussault/flaime | 7c898f07e0d7c16b63a59d2c0c56290e32a2df47 | [
"MIT"
] | null | null | null | flaim/product_search/urls.py | bfssi-forest-dussault/flaime | 7c898f07e0d7c16b63a59d2c0c56290e32a2df47 | [
"MIT"
] | 11 | 2020-11-09T19:55:58.000Z | 2022-02-13T19:43:03.000Z | flaim/product_search/urls.py | BFSSI-Bioinformatics-Lab/flaime | 1feedf3974114c16724bfbd235ce4637983a3f5e | [
"MIT"
] | null | null | null | from django.urls import path
from flaim.product_search.views import IndexView
app_name = "product_search"
urlpatterns = [
path('', IndexView.as_view(), name='index'),
]
| 16.090909 | 48 | 0.728814 | 23 | 177 | 5.434783 | 0.695652 | 0.208 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146893 | 177 | 10 | 49 | 17.7 | 0.827815 | 0 | 0 | 0 | 0 | 0 | 0.107955 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b3a9e41ea6f6881d7ad8f5457f27c28532f85231 | 251 | py | Python | DMOJ/DMOPC/DMOPC_19_C4P0_Yikes.py | Togohogo1/pg | ee3c36acde47769c66ee13a227762ee677591375 | [
"MIT"
] | null | null | null | DMOJ/DMOPC/DMOPC_19_C4P0_Yikes.py | Togohogo1/pg | ee3c36acde47769c66ee13a227762ee677591375 | [
"MIT"
] | 1 | 2021-10-14T18:26:56.000Z | 2021-10-14T18:26:56.000Z | DMOJ/DMOPC/DMOPC_19_C4P0_Yikes.py | Togohogo1/pg | ee3c36acde47769c66ee13a227762ee677591375 | [
"MIT"
] | 1 | 2021-08-06T03:39:55.000Z | 2021-08-06T03:39:55.000Z | diff_counter = 0
A = input()
B = input()
for i in range(len(A)):
if A[i] != B[i]:
diff_counter += 1
if diff_counter > 1:
print("LARRY IS DEAD!")
elif diff_counter == 1:
print("LARRY IS SAVED!")
else:
print("LARRY IS DEAD!")
| 15.6875 | 28 | 0.573705 | 42 | 251 | 3.333333 | 0.47619 | 0.314286 | 0.257143 | 0.242857 | 0.342857 | 0.342857 | 0 | 0 | 0 | 0 | 0 | 0.021505 | 0.258964 | 251 | 15 | 29 | 16.733333 | 0.731183 | 0 | 0 | 0.166667 | 0 | 0 | 0.171315 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 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 |
b3acd18ca0ca739491814d3a1ef4dfc80be79b93 | 578 | py | Python | data/migrations/0008_practice_glyphosate_multipliers.py | SIXMON/peps | 48c09a951a0193ada7b91c8bb6efc4b1232c3520 | [
"MIT"
] | 5 | 2019-08-29T13:55:47.000Z | 2021-11-15T08:30:33.000Z | data/migrations/0008_practice_glyphosate_multipliers.py | SIXMON/peps | 48c09a951a0193ada7b91c8bb6efc4b1232c3520 | [
"MIT"
] | 295 | 2019-08-19T12:40:29.000Z | 2022-01-24T14:03:20.000Z | data/migrations/0008_practice_glyphosate_multipliers.py | SIXMON/peps | 48c09a951a0193ada7b91c8bb6efc4b1232c3520 | [
"MIT"
] | 7 | 2020-05-27T06:28:48.000Z | 2021-11-17T10:00:54.000Z | # Generated by Django 2.2.4 on 2019-09-10 13:00
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('data', '0007_auto_20190906_1403'),
]
operations = [
migrations.AddField(
model_name='practice',
name='glyphosate_multipliers',
field=django.contrib.postgres.fields.ArrayField(base_field=django.contrib.postgres.fields.jsonb.JSONField(), blank=True, null=True, size=None),
),
]
| 27.52381 | 155 | 0.683391 | 67 | 578 | 5.80597 | 0.641791 | 0.133676 | 0.215938 | 0.277635 | 0.359897 | 0 | 0 | 0 | 0 | 0 | 0 | 0.067245 | 0.202422 | 578 | 20 | 156 | 28.9 | 0.776573 | 0.077855 | 0 | 0 | 1 | 0 | 0.107345 | 0.084746 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.214286 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b3ad75652b65f95689ab488380d4c24ba3e3ca61 | 24 | py | Python | parallel/process/__init__.py | worldwise001/stylometry | b5a4cc98fb8dfb6d1600d41bb15c96aeaf4ecb72 | [
"MIT"
] | 14 | 2015-02-24T16:14:07.000Z | 2022-02-19T21:49:55.000Z | parallel/process/__init__.py | worldwise001/stylometry | b5a4cc98fb8dfb6d1600d41bb15c96aeaf4ecb72 | [
"MIT"
] | 1 | 2015-02-25T09:45:13.000Z | 2015-02-25T09:45:13.000Z | parallel/process/__init__.py | worldwise001/stylometry | b5a4cc98fb8dfb6d1600d41bb15c96aeaf4ecb72 | [
"MIT"
] | 4 | 2015-11-20T10:47:11.000Z | 2021-03-30T13:14:20.000Z | __author__ = 'sharvey'
| 8 | 22 | 0.708333 | 2 | 24 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 24 | 2 | 23 | 12 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0.304348 | 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 |
b3beb1c0dc8ead4dd844963eebf33634ad5ed015 | 248 | py | Python | nlpaug/util/method.py | booltime/nlpaug | d21e51bacd170dcd3dddfc34a401f0215f91dbf1 | [
"MIT"
] | 1 | 2021-09-08T09:18:02.000Z | 2021-09-08T09:18:02.000Z | nlpaug/util/method.py | booltime/nlpaug | d21e51bacd170dcd3dddfc34a401f0215f91dbf1 | [
"MIT"
] | null | null | null | nlpaug/util/method.py | booltime/nlpaug | d21e51bacd170dcd3dddfc34a401f0215f91dbf1 | [
"MIT"
] | null | null | null | class Method:
CHAR = 'char'
WORD = 'word'
SPECTROGRAM = 'spectrogram'
AUDIO = 'audio'
FLOW = 'flow'
@staticmethod
def getall():
return [Method.CHAR, Method.WORD, Method.AUDIO, Method.SPECTROGRAM, Method.FLOW]
| 19.076923 | 88 | 0.612903 | 26 | 248 | 5.846154 | 0.423077 | 0.131579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.262097 | 248 | 12 | 89 | 20.666667 | 0.830601 | 0 | 0 | 0 | 0 | 0 | 0.11336 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0.111111 | 0.888889 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
b3cb3448a7ec0478bad0111a47011928e20470cb | 277 | py | Python | common/actions.py | tsafacjo/gogoportefollioopt | 2ab9244674cf875e8262c7b0ce9efe211eb91603 | [
"MIT"
] | null | null | null | common/actions.py | tsafacjo/gogoportefollioopt | 2ab9244674cf875e8262c7b0ce9efe211eb91603 | [
"MIT"
] | null | null | null | common/actions.py | tsafacjo/gogoportefollioopt | 2ab9244674cf875e8262c7b0ce9efe211eb91603 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: latin-1 -*-
from abc import ABC, abstractmethod
class Action (ABC):
def __init__(self,job):
self.job = job
@abstractmethod
def processing(self):
"""
traitements liés aux actions
"""
pass
| 14.578947 | 36 | 0.563177 | 30 | 277 | 5.066667 | 0.733333 | 0.092105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005263 | 0.314079 | 277 | 18 | 37 | 15.388889 | 0.794737 | 0.249097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.142857 | 0.142857 | 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 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
b3e594fa9d82737d051fc8c3764054989912a53f | 1,126 | py | Python | config/api.py | IniterWorker/epitech-stats-notes | cf0273bb6f44398218b637af625282f6654c190a | [
"MIT"
] | 2 | 2017-03-11T22:11:44.000Z | 2017-03-12T12:45:10.000Z | config/api.py | IniterWorker/epitech-stats-notes | cf0273bb6f44398218b637af625282f6654c190a | [
"MIT"
] | null | null | null | config/api.py | IniterWorker/epitech-stats-notes | cf0273bb6f44398218b637af625282f6654c190a | [
"MIT"
] | null | null | null | from config import Configure
class IntranetAPI:
"""
Simple AutoLogin API
"""
def __init__(self, config):
if not isinstance(config, Configure):
raise TypeError("Invalid instance of Configure")
if config.get_auto_login() == "None":
raise ValueError("Please check auth key")
self._config = config
self._host = "https://intra.epitech.eu/"
self._format = "json"
self._auth = None
def get_host(self):
return self._host
def get_config(self):
return self._config
def get_format(self):
return self._format
def set_host(self, host):
self._host = host
def set_config(self, config):
self._config = config
def set_format(self, format):
self._format = format
def url_formated(self, middle):
return self._host + self._config.get_auto_login() + "/" + middle + "?format=" + self._format
def url_formated_with_user(self, middle, login):
return self._host + self._config.get_auto_login() + "/user/" + login + "/" + middle + "?format=" + self._format
| 26.809524 | 119 | 0.614565 | 135 | 1,126 | 4.859259 | 0.318519 | 0.106707 | 0.097561 | 0.082317 | 0.184451 | 0.109756 | 0.109756 | 0.109756 | 0 | 0 | 0 | 0 | 0.269982 | 1,126 | 41 | 120 | 27.463415 | 0.798054 | 0.017762 | 0 | 0.074074 | 0 | 0 | 0.098165 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.037037 | 0.185185 | 0.592593 | 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 |
b3ee2b36d845b843f74c7a20197f655be9b9a9ee | 739 | py | Python | fwl-automation-decisions/domain/src/domain/model/zone_connection/ZoneConnectionRepository.py | aherculano/fwl-project | 6d4c4d40393b76d45cf13b572b5aabc0696e9285 | [
"MIT"
] | null | null | null | fwl-automation-decisions/domain/src/domain/model/zone_connection/ZoneConnectionRepository.py | aherculano/fwl-project | 6d4c4d40393b76d45cf13b572b5aabc0696e9285 | [
"MIT"
] | null | null | null | fwl-automation-decisions/domain/src/domain/model/zone_connection/ZoneConnectionRepository.py | aherculano/fwl-project | 6d4c4d40393b76d45cf13b572b5aabc0696e9285 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from ...BaseRepository import BaseRepository
from .ZoneConnection import ZoneConnection
from .ZonePair import ZonePair
class ZoneConnectionRepository(BaseRepository, ABC):
@abstractmethod
def add(self, o: ZoneConnection) -> ZoneConnection:
raise NotImplementedError
@abstractmethod
def list(self) -> [ZoneConnection]:
raise NotImplementedError
@abstractmethod
def get(self, o: ZoneConnection) -> ZoneConnection:
raise NotImplementedError
@abstractmethod
def get_by_id(self, id: ZonePair) -> ZoneConnection:
raise NotImplementedError
@abstractmethod
def exists(self, id: ZonePair) -> bool:
raise NotImplementedError
| 25.482759 | 56 | 0.728011 | 66 | 739 | 8.121212 | 0.318182 | 0.158582 | 0.283582 | 0.38806 | 0.492537 | 0.389925 | 0.276119 | 0.276119 | 0 | 0 | 0 | 0 | 0.20433 | 739 | 28 | 57 | 26.392857 | 0.911565 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.2 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b3f263631d46099813a04aa3ce7723802975610a | 105 | py | Python | startcheck.py | tanyusheng/idCheck | 9619b4d5e4080b8b33c49a1154a472c979763b1c | [
"MIT"
] | null | null | null | startcheck.py | tanyusheng/idCheck | 9619b4d5e4080b8b33c49a1154a472c979763b1c | [
"MIT"
] | null | null | null | startcheck.py | tanyusheng/idCheck | 9619b4d5e4080b8b33c49a1154a472c979763b1c | [
"MIT"
] | 1 | 2022-03-10T03:28:56.000Z | 2022-03-10T03:28:56.000Z | from idcheckgui import *
if __name__ == '__main__':
check_gui = IDCheckGUI()
check_gui.mainloop() | 26.25 | 28 | 0.704762 | 12 | 105 | 5.333333 | 0.75 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180952 | 105 | 4 | 29 | 26.25 | 0.744186 | 0 | 0 | 0 | 0 | 0 | 0.075472 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b3f4e6a6310ced9a87b684b3d537e62408326c98 | 2,553 | py | Python | visualizations.py | amanasifkhalid/Airborne | 7562c6f3e72b3ae8d5c17ca99dddbe83766a24d2 | [
"MIT"
] | null | null | null | visualizations.py | amanasifkhalid/Airborne | 7562c6f3e72b3ae8d5c17ca99dddbe83766a24d2 | [
"MIT"
] | null | null | null | visualizations.py | amanasifkhalid/Airborne | 7562c6f3e72b3ae8d5c17ca99dddbe83766a24d2 | [
"MIT"
] | null | null | null | import pandas as pd
import plotly.express as px
def air_quality_vs_cases(data, state, city, from_month, to_month):
''' Takes data, state, city, from_month, and to_month as inputs, where
data is a dictionary of the COVID-19 cases, the air qualities, and the dates.
Creates a Pandas DataFrame of the data, formats a title for the graph, and
then creates a scatterplot with a trend line using plotly.'''
df = pd.DataFrame(data=data)
title = f"{city} Daily Air Quality vs. New {state} COVID-19 Cases,\n{from_month}"
if to_month != from_month:
title = title + f"-{to_month}"
title = title + " 2020"
scatter = px.scatter(df, x="COVID-19 Cases", y="Air Pollution (PM2.5)",
title=title, hover_name="Date", trendline="ols")
scatter.show()
def new_cases_line_graph(data, state, from_month, to_month):
''' Takes data, state, from_month, and to_month as inputs, where
data is a dictionary of the COVID-19 cases, the air qualities, and the dates.
Creates a Pandas DataFrame of data, and plots the DataFrame's COVID-19 cases
column and Dates column on a line graph using plotly. Formats the title with
state, from_month, and to_month; if from_month and to_month are equal, meaning
the data is from one month, only display one month in the title. Else, display
the month range in the title.'''
df =pd.DataFrame(data=data)
title = f"{state} COVID-19 Cases for {from_month}"
if to_month !=from_month:
title = title + f"-{to_month}"
title = title + " 2020"
line = px.line(df, x="Date", y="COVID-19 Cases", title=title)
line.show()
def air_quality_line_graph(data, city, from_month, to_month):
''' Takes data, city, from_month, and to_month as inputs, where
data is a dictionary of the COVID-19 cases, the air qualities, and the dates.
Creates a Pandas DataFrame of data, and plots the DataFrame's Air Quality
column and Dates column on a line graph using plotly. Formats the title with
city, from_month, and to_month; if from_month and to_month are equal, meaning
the data is from one month, only display one month in the title. Else, display
the month range in the title.'''
df =pd.DataFrame(data=data)
title = f"{city} Air Pollution (PM2.5) for {from_month}"
if to_month !=from_month:
title = title + f"- {to_month}"
title = title + " 2020"
line = px.line(df, x="Date", y="Air Pollution (PM2.5)", title=title)
line.show()
| 49.096154 | 86 | 0.673325 | 412 | 2,553 | 4.070388 | 0.182039 | 0.085868 | 0.057245 | 0.058438 | 0.765057 | 0.75969 | 0.754323 | 0.667263 | 0.646392 | 0.646392 | 0 | 0.01732 | 0.231101 | 2,553 | 51 | 87 | 50.058824 | 0.836984 | 0.483745 | 0 | 0.518519 | 0 | 0.037037 | 0.237037 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.074074 | 0 | 0.185185 | 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 |
b3ff2df3b72fe8498f7c8edce1e96008dab01203 | 2,119 | py | Python | graphql/app/conftest.py | py-in-the-sky/appengine-swapi | 824d770cd11e5510b2300d1e248a9474e3fde8c2 | [
"MIT"
] | null | null | null | graphql/app/conftest.py | py-in-the-sky/appengine-swapi | 824d770cd11e5510b2300d1e248a9474e3fde8c2 | [
"MIT"
] | null | null | null | graphql/app/conftest.py | py-in-the-sky/appengine-swapi | 824d770cd11e5510b2300d1e248a9474e3fde8c2 | [
"MIT"
] | null | null | null | import fix_sys_path # pragma: no flakes
import os
import pytest
from google.appengine.ext.testbed import Testbed
from google.appengine.ext import ndb
from fixtures import ensure_minimal_data_in_datastore
from app.models.ndb.character import Character
from app.models.ndb.faction import Faction
@pytest.yield_fixture(scope='function')
def testbed():
testbed = Testbed()
testbed.activate()
# testbed.setup_env(app_id='_')
os.environ['APPLICATION_ID'] = '_'
# This is a hack to get things working; `testbed.setup_env` does
# not seem to be doing the job.
# See: http://einaregilsson.com/unit-testing-model-classes-in-google-app-engine/
# Will almost always need datastore for tests that use this fixture.
testbed.init_datastore_v3_stub()
# ndb uses memcache, so stub it as well.
testbed.init_memcache_stub()
# Clear in-context cache before test.
ndb.get_context().clear_cache()
yield testbed
ndb.get_context().clear_cache()
testbed.deactivate()
@pytest.fixture(scope='function')
def fixtures(testbed):
ensure_minimal_data_in_datastore()
ndb.get_context().clear_cache()
@pytest.fixture(scope='function')
def rey(fixtures):
return Character.query(Character.name == 'Rey').get()
@pytest.fixture(scope='function')
def finn(fixtures):
return Character.query(Character.name == 'Finn').get()
@pytest.fixture(scope='function')
def leia(fixtures):
return Character.query(Character.name == 'Leia').get()
@pytest.fixture(scope='function')
def han(fixtures):
return Character.query(Character.name == 'Han').get()
@pytest.fixture(scope='function')
def r2d2(resistance):
return Character.create(name='R2D2', faction_key=resistance.key)
@pytest.fixture(scope='function')
def chewie(resistance):
return Character.create(name='Chewie', faction_key=resistance.key)
@pytest.fixture(scope='function')
def resistance(fixtures):
return Faction.query(Faction.name == 'The Resistance').get()
@pytest.fixture(scope='function')
def first_order(fixtures):
return Faction.query(Faction.name == 'The First Order').get()
| 26.160494 | 84 | 0.731949 | 282 | 2,119 | 5.390071 | 0.343972 | 0.078947 | 0.131579 | 0.151316 | 0.500658 | 0.334211 | 0.121053 | 0.068421 | 0.068421 | 0 | 0 | 0.002735 | 0.137329 | 2,119 | 80 | 85 | 26.4875 | 0.828775 | 0.170363 | 0 | 0.255319 | 0 | 0 | 0.08462 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.212766 | false | 0 | 0.170213 | 0.170213 | 0.553191 | 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 |
374039e182b4955bc13eddfb3175ac9808c69215 | 121 | py | Python | hackerrank/30 Days of Code/Day 6/StringLoopCombination.py | JLJTECH/TutorialTesting | f2dbbd49a86b3b086d0fc156ac3369fb74727f86 | [
"MIT"
] | null | null | null | hackerrank/30 Days of Code/Day 6/StringLoopCombination.py | JLJTECH/TutorialTesting | f2dbbd49a86b3b086d0fc156ac3369fb74727f86 | [
"MIT"
] | null | null | null | hackerrank/30 Days of Code/Day 6/StringLoopCombination.py | JLJTECH/TutorialTesting | f2dbbd49a86b3b086d0fc156ac3369fb74727f86 | [
"MIT"
] | null | null | null | #Day 6 : Lets Review
for i in range(int(input())):
char = input()
print("".join(char[::2]),"".join(char[1::2])) | 20.166667 | 49 | 0.545455 | 20 | 121 | 3.3 | 0.75 | 0.242424 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040404 | 0.181818 | 121 | 6 | 49 | 20.166667 | 0.626263 | 0.157025 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3749de9f7c4e3ab9b27b28b7a4d9751d761d91d6 | 105 | py | Python | pva_exercises/getter.py | osprey-dcs/training_resources | a5cc11694fb9e5190a94468faf2773d458a207c7 | [
"MIT"
] | null | null | null | pva_exercises/getter.py | osprey-dcs/training_resources | a5cc11694fb9e5190a94468faf2773d458a207c7 | [
"MIT"
] | null | null | null | pva_exercises/getter.py | osprey-dcs/training_resources | a5cc11694fb9e5190a94468faf2773d458a207c7 | [
"MIT"
] | null | null | null | #!/opt/p4p/bin/python
from p4p.client.thread import Context
ctxt=Context()
print(ctxt.get('demo:sin'))
| 15 | 37 | 0.733333 | 17 | 105 | 4.529412 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020833 | 0.085714 | 105 | 6 | 38 | 17.5 | 0.78125 | 0.190476 | 0 | 0 | 0 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 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 |
3757ea4977d9511189c05360399dd7fa9955e0d4 | 276 | py | Python | server/proxy_server/__init__.py | ezirmusitua/proxies | 2a618f00808613aa5741218a3268e33ae212d006 | [
"MIT"
] | null | null | null | server/proxy_server/__init__.py | ezirmusitua/proxies | 2a618f00808613aa5741218a3268e33ae212d006 | [
"MIT"
] | 4 | 2021-03-31T18:38:32.000Z | 2022-02-11T03:39:26.000Z | server/proxy_server/__init__.py | ezirmusitua/proxies | 2a618f00808613aa5741218a3268e33ae212d006 | [
"MIT"
] | 1 | 2018-04-18T01:30:18.000Z | 2018-04-18T01:30:18.000Z | # -*- coding: utf-8 -*-
import sys
sys.path.append('..')
sys.path.append('../..')
from public.config import Config, concat_config_path
config = Config(concat_config_path(__file__, 'config.json'))
from proxy_server.app import app
from proxy_server.models import bind_models
| 23 | 60 | 0.746377 | 40 | 276 | 4.875 | 0.45 | 0.071795 | 0.133333 | 0.225641 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004049 | 0.105072 | 276 | 11 | 61 | 25.090909 | 0.785425 | 0.076087 | 0 | 0 | 0 | 0 | 0.071146 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
375d8984869d5c18ac8f6c538e7ddda00495e9a1 | 140 | py | Python | samples/test_actions.py | naren-m/home_assistant | a20d64b79d97cbb2c9bae197c0900515ed8bfbfc | [
"MIT"
] | null | null | null | samples/test_actions.py | naren-m/home_assistant | a20d64b79d97cbb2c9bae197c0900515ed8bfbfc | [
"MIT"
] | null | null | null | samples/test_actions.py | naren-m/home_assistant | a20d64b79d97cbb2c9bae197c0900515ed8bfbfc | [
"MIT"
] | null | null | null | import actions as a
if __name__ == '__main__':
my_action = a.Actions()
my_action.open_google
my_action.play_youtube_playlist()
| 20 | 37 | 0.721429 | 20 | 140 | 4.35 | 0.7 | 0.275862 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185714 | 140 | 6 | 38 | 23.333333 | 0.763158 | 0 | 0 | 0 | 0 | 0 | 0.057143 | 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 |
375f562d7f1a69c6c51e4cbf055cac4060726389 | 136 | py | Python | terrascript/resource/local.py | hugovk/python-terrascript | 08fe185904a70246822f5cfbdc9e64e9769ec494 | [
"BSD-2-Clause"
] | 4 | 2022-02-07T21:08:14.000Z | 2022-03-03T04:41:28.000Z | terrascript/resource/local.py | hugovk/python-terrascript | 08fe185904a70246822f5cfbdc9e64e9769ec494 | [
"BSD-2-Clause"
] | null | null | null | terrascript/resource/local.py | hugovk/python-terrascript | 08fe185904a70246822f5cfbdc9e64e9769ec494 | [
"BSD-2-Clause"
] | 2 | 2022-02-06T01:49:42.000Z | 2022-02-08T14:15:00.000Z | # terrascript/resource/local.py
import terrascript
class local_file(terrascript.Resource):
pass
__all__ = [
"local_file",
]
| 11.333333 | 39 | 0.720588 | 15 | 136 | 6.133333 | 0.6 | 0.413043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 136 | 11 | 40 | 12.363636 | 0.821429 | 0.213235 | 0 | 0 | 0 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0.166667 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3767ad7ef0d33ed967f8618d7c9a1a98117608cc | 171 | py | Python | corepro/models/customerbeneficiaryidonly.py | bored117/CorePro | cd05bff7d14cb6937ad6ee2fdbd987bf90f9ea0e | [
"MIT"
] | 1 | 2017-01-12T19:43:28.000Z | 2017-01-12T19:43:28.000Z | corepro/models/customerbeneficiaryidonly.py | bored117/CorePro | cd05bff7d14cb6937ad6ee2fdbd987bf90f9ea0e | [
"MIT"
] | null | null | null | corepro/models/customerbeneficiaryidonly.py | bored117/CorePro | cd05bff7d14cb6937ad6ee2fdbd987bf90f9ea0e | [
"MIT"
] | 4 | 2017-11-02T21:21:51.000Z | 2021-01-29T21:47:30.000Z | __author__ = 'socialmoneydev'
from jsonBase import JsonBase
class CustomerBeneficiaryIdOnly(JsonBase):
def __init__(self):
self.customerBeneficiaryId = None
| 21.375 | 42 | 0.77193 | 15 | 171 | 8.266667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163743 | 171 | 7 | 43 | 24.428571 | 0.867133 | 0 | 0 | 0 | 0 | 0 | 0.082353 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
377a6aa44723dbf2d93139d4ec9e58ce044168a4 | 81 | py | Python | content/views.py | AsfanUlla/pi-backend | ee1fed18bff9881e341c1022584f9323d2a7561d | [
"Apache-2.0"
] | null | null | null | content/views.py | AsfanUlla/pi-backend | ee1fed18bff9881e341c1022584f9323d2a7561d | [
"Apache-2.0"
] | null | null | null | content/views.py | AsfanUlla/pi-backend | ee1fed18bff9881e341c1022584f9323d2a7561d | [
"Apache-2.0"
] | null | null | null | from fastapi import APIRouter, Body, HTTPException, status
router = APIRouter()
| 20.25 | 58 | 0.790123 | 9 | 81 | 7.111111 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135802 | 81 | 3 | 59 | 27 | 0.914286 | 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 |
3780eb086943a2eed2b9303d82b7b1042d5706b6 | 223 | py | Python | pynif/__init__.py | debayan/pynif | 3b6c77646d0a6b438bb637cf04c9e0a9ee199e40 | [
"Apache-2.0"
] | 13 | 2019-01-24T15:14:18.000Z | 2022-02-24T14:52:29.000Z | pynif/__init__.py | debayan/pynif | 3b6c77646d0a6b438bb637cf04c9e0a9ee199e40 | [
"Apache-2.0"
] | 3 | 2021-04-18T09:22:49.000Z | 2022-03-03T13:34:11.000Z | pynif/__init__.py | debayan/pynif | 3b6c77646d0a6b438bb637cf04c9e0a9ee199e40 | [
"Apache-2.0"
] | 5 | 2019-08-14T13:23:52.000Z | 2021-04-18T11:22:58.000Z | name = "pynif"
from .phrase import NIFPhrase
from .context import NIFContext
from .collection import NIFCollection
from .prefixes import NIFPrefixes
__all__ = [ 'NIFPhrase', 'NIFContext', 'NIFCollection', 'NIFPrefixes' ]
| 24.777778 | 71 | 0.775785 | 23 | 223 | 7.347826 | 0.565217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130045 | 223 | 8 | 72 | 27.875 | 0.871134 | 0 | 0 | 0 | 0 | 0 | 0.215247 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
37819f7028ddb052ce8c293bb30c41113a5470c7 | 14,726 | py | Python | classes/bd_api_caller.py | Brown-University-Library/easyborrow_controller | 31bb8e94998012d4cecd250245000e5631149dfa | [
"Unlicense",
"MIT"
] | null | null | null | classes/bd_api_caller.py | Brown-University-Library/easyborrow_controller | 31bb8e94998012d4cecd250245000e5631149dfa | [
"Unlicense",
"MIT"
] | 1 | 2015-10-05T21:00:03.000Z | 2015-10-05T21:00:03.000Z | classes/bd_api_caller.py | birkin/easyborrow_controller | 31bb8e94998012d4cecd250245000e5631149dfa | [
"MIT",
"Unlicense"
] | null | null | null | import json, logging, pprint, urllib
import requests
from easyborrow_controller_code import settings
from easyborrow_controller_code.classes.db_handler import Db_Handler
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) # to address ```InsecureRequestWarning: Unverified HTTPS request is being made...```
## logger setup
LOG_PATH = settings.LOG_PATH
LOG_LEVEL = settings.LOG_LEVEL
level_dct = { 'DEBUG': logging.DEBUG, 'INFO': logging.INFO }
logging.basicConfig(
filename=LOG_PATH, level=level_dct[LOG_LEVEL],
format='[%(asctime)s] %(levelname)s [%(module)s-%(funcName)s()::%(lineno)d] %(message)s', datefmt='%d/%b/%Y %H:%M:%S' )
log = logging.getLogger(__name__)
class BD_CallerBib( object ):
""" Handles bdpy3_web `bib` calls. """
def __init__( self ):
""" Loads env vars.
Called by EzBorrowController.py """
self.db_handler = None
self._prep_db_handler()
self.log_identifier = 'init'
self.bdpyweb_defaults = {
'url': settings.BDPYWEB_BIB_URL, # note: different from other bdpyweb-url setting
'api_authorization_code': settings.BDPYWEB_AUTHORIZATION_CODE,
'api_identity': settings.BDPYWEB_IDENTITY
}
self.api_result = None # will be dct
self.api_confirmation_code = None # will be str
self.api_found = None # will be boolean
self.api_requestable = None # will be boolean
self.HISTORY_SQL_PATTERN = settings.HISTORY_ACTION_SQL
log.debug( 'BD_CallerBib initialized' )
def _prep_db_handler( self ):
""" Initializes db_handler.
Called by __init__() """
self.db_handler = Db_Handler( log )
return
def prepare_params( self, patron_inst, item_inst ):
""" Preps parameters for bib call.
Called by controller.run_code() """
log.debug( 'about to get `bib_dct`' )
bib_dct = self.extract_bib( item_inst.knowledgebase_openurl )
bd_data = {
'title': item_inst.title,
# 'author': bib_dct['response']['bib']['author'][0]['name'],
'author': self.get_author( bib_dct ),
# 'year': bib_dct['response']['bib']['year'],
'year': self.get_year( bib_dct ),
'user_barcode': patron_inst.barcode } # TODO: normalize `user_barcode` and `patron_barcode` usage in this module, and in bdpyweb3-webapp
log.debug( 'bib bd_data, ```%s```' % pprint.pformat(bd_data) )
return bd_data
def extract_bib( self, ourl ):
""" Parses openurl to return bjson-dct.
Called by prepare_params() """
log.debug( 'about to start `param_dct`' )
log.debug( 'ourl, ```%s```' % ourl )
param_dct = { 'ourl': ourl }
try:
r = requests.get( 'https://library.brown.edu/bib_ourl_api/v1/ourl_to_bib/', params=param_dct )
except Exception as e:
msg = repr(e)
log.error( 'exception, ```%s```' % msg )
raise Exception( msg )
bib_dct = json.loads( r.content.decode('utf-8') )
log.debug( 'bib_dct, ```%s```' % pprint.pformat(bib_dct) )
return bib_dct
def get_author( self, bib_dct ):
author = None
try:
author = bib_dct['response']['bib']['author'][0]['name']
except:
log.debug( 'id, %s; author not found' % self.log_identifier )
pass
return author
def get_year( self, bib_dct ):
year = None
try:
year = bib_dct['response']['bib']['year']
except:
log.debug( 'id, %s; year not found' % self.log_identifier )
pass
return year
def hit_bd_api( self, title, author, year, user_barcode ):
""" Executes bdpy3_web bib call.
Called by Controller.run_code() """
log.info( '%s- starting try_request()' % self.log_identifier )
parameter_dict = self.prepare_bd_api_hit( title, author, year, user_barcode )
try:
r = requests.post( self.bdpyweb_defaults['url'], data=parameter_dict, timeout=300, verify=False )
log.debug( '%s- bdpyweb response content, `%s`' % (self.log_identifier, r.content.decode('utf-8')) )
self.api_result = json.loads( r.content )
except Exception as e:
log.debug( '%s- exception on bdpyweb post, `%s`' % (self.log_identifier, pprint.pformat(repr(e))) )
return
def prepare_bd_api_hit( self, title, author, year, user_barcode ):
""" Prepares bd-api dct for bib post.
Called by: hit_bd_api() """
parameter_dict = {
'api_authorization_code': self.bdpyweb_defaults['api_authorization_code'],
'api_identity': self.bdpyweb_defaults['api_identity'],
'title': title,
'author': author,
'year': year,
'patron_barcode': user_barcode }
log.debug( 'id, %s; parameter_dict to post, ```%s```' % (self.log_identifier, pprint.pformat(parameter_dict)) )
return parameter_dict
def process_response( self ):
""" Examines _bib_ bdpyweb3 api-response & populates instance attributes.
Called by controller.run_code() """
if self.api_result:
if 'response' in self.api_result.keys():
if 'interpreted_response' in self.api_result['response'].keys():
if 'result' in self.api_result['response']['interpreted_response'].keys():
if self.api_result['response']['interpreted_response']['result'] == 'requested':
self.api_confirmation_code = self.api_result['response']['interpreted_response']['bd_confirmation_code']
self.api_found = True
self.api_requestable = True
log.debug( 'id, %s; process_response complete; code, `%s`; found, `%s`; requestable, `%s`' % (self.log_identifier, self.api_confirmation_code, self.api_found, self.api_requestable) )
return
def update_history_table( self ):
""" Populates history table based on request result.
Called by controller.run_code() """
( api_confirmation_code, history_table_message ) = self.prep_code_message()
utf8_sql = self.prep_history_sql( api_confirmation_code, history_table_message )
self.db_handler.run_sql( utf8_sql )
# self.web_logger.post_message( message='- in tunneler_runners.BD_ApiRunner.update_history_table(); history table updated for ezb#: %s' % self.log_identifier, identifier=self.log_identifier, importance='info' )
log.debug( 'update_history_table complete' )
return
def prep_code_message( self ):
""" Sets api_confirmation_code and history_table_message vars.
Called by update_history_table() """
if self.api_requestable is True:
api_confirmation_code = self.api_confirmation_code
history_table_message = 'Request_Successful'
else:
api_confirmation_code = ''
history_table_message = 'not_requestable'
log.debug( '%s- prep_code_message complete; local api_confirmation_code, `%s`; history_table_message, `%s`' % (self.log_identifier, api_confirmation_code, history_table_message) )
return ( api_confirmation_code, history_table_message )
def prep_history_sql( self, api_confirmation_code, history_table_message ):
""" Prepares history table update sql.
Called by update_history_table()
TODO: when db class exists, remove utf8 encoding. """
sql = self.HISTORY_SQL_PATTERN % (
self.log_identifier,
'borrowdirect',
'attempt_bd-bib',
history_table_message,
api_confirmation_code
)
utf8_sql = sql.encode( 'utf-8' ) # old code expects utf-8 string
# log.debug( '%s- prep_history_sql complete; utf8_sql, `%s`' % (self.log_identifier, sql.decode('utf-8')) )
log.debug( '%s- prep_history_sql complete; utf8_sql, `%s`' % (self.log_identifier, utf8_sql.decode('utf-8')) )
return utf8_sql
def handle_success( self, request_inst ):
""" Updates request_inst attributes on success.
Called by controller.run_code() """
request_inst.current_status = 'success'
request_inst.confirmation_code = self.api_confirmation_code
return request_inst
## end class BD_CallerBib()
class BD_CallerExact( object ):
""" Handles bdpy3_web `exact` calls. """
def __init__( self ):
""" Loads env vars.
Called by EzBorrowController.py """
# self.logger = logger
self.db_handler = None
self._prep_db_handler()
self.log_identifier = 'init'
self.bdpyweb_defaults = {
'url': settings.BDPYWEB_URL, # note: different from other bdpyweb-url setting
'api_authorization_code': settings.BDPYWEB_AUTHORIZATION_CODE,
'api_identity': settings.BDPYWEB_IDENTITY
}
self.api_result = None # will be dct
self.api_confirmation_code = None # will be str
self.api_found = None # will be boolean
self.api_requestable = None # will be boolean
self.HISTORY_SQL_PATTERN = settings.HISTORY_ACTION_SQL
log.debug( 'BD_CallerExact initialized' )
def _prep_db_handler( self ):
""" Initializes db_handler.
Called by __init__() """
self.db_handler = Db_Handler( log )
return
def setup_api_hit( self, item_inst ):
""" Sets the currently-active-service and updates weblog.
Called by controller.run_code() """
item_inst.current_service = 'borrowDirect'
# web_logger.post_message( message='- in controller; checking BorrowDirect...', identifier=self.log_identifier, importance='info' )
log.debug( '- identifier, %s; setup_api_hit() complete' % self.log_identifier )
return item_inst
def prepare_params( self, patron_inst, item_inst ):
""" Preps parameters for isbn call.
Called by controller.run_code() """
bd_data = { 'isbn': item_inst.isbn, 'user_barcode': patron_inst.barcode }
return bd_data
def hit_bd_api( self, isbn, user_barcode ):
""" Executes bdpy3_web exact call.
Called by Controller.run_code() """
log.info( '%s- starting try_request()' % self.log_identifier )
parameter_dict = self.prepare_bd_api_hit( isbn, user_barcode )
try:
r = requests.post( self.bdpyweb_defaults['url'], data=parameter_dict, timeout=300, verify=False )
log.debug( '%s- bdpyweb response content, `%s`' % (self.log_identifier, r.content.decode('utf-8')) )
self.api_result = json.loads( r.content )
except Exception as e:
log.debug( '%s- exception on bdpyweb post, `%s`' % (self.log_identifier, pprint.pformat(repr(e))) )
return
def prepare_bd_api_hit( self, isbn, user_barcode ):
""" Prepares bd-api dct for isbn post.
Called by: hit_bd_api() """
parameter_dict = {
'api_authorization_code': self.bdpyweb_defaults['api_authorization_code'],
'api_identity': self.bdpyweb_defaults['api_identity'],
'isbn': isbn,
'user_barcode': user_barcode }
log.debug( '%s- post parameter_dict, `%s`' % (self.log_identifier, parameter_dict) )
return parameter_dict
def process_response( self ):
""" Examines response dict & populates class attributes.
Called by controller.run_code() """
if self.api_result and ( type(self.api_result) == dict ) and ( 'requestable' in self.api_result.keys() ):
if self.api_result['requestable'] is True:
self.api_confirmation_code = self.api_result['bd_confirmation_code']
self.api_found = True
self.api_requestable = True
log.debug( '%s- process_response complete; code, `%s`; found, `%s`; requestable, `%s`' % (self.log_identifier, self.api_confirmation_code, self.api_found, self.api_requestable) )
return
def update_history_table( self ):
""" Populates history table based on request result.
Called by controller.run_code() """
( api_confirmation_code, history_table_message ) = self.prep_code_message()
utf8_sql = self.prep_history_sql( api_confirmation_code, history_table_message )
self.db_handler.run_sql( utf8_sql )
# self.web_logger.post_message( message='- in tunneler_runners.BD_ApiRunner.update_history_table(); history table updated for ezb#: %s' % self.log_identifier, identifier=self.log_identifier, importance='info' )
log.debug( 'update_history_table complete' )
return
def prep_code_message( self ):
""" Sets api_confirmation_code and history_table_message vars.
Called by update_history_table() """
if self.api_requestable is True:
api_confirmation_code = self.api_confirmation_code
history_table_message = 'Request_Successful'
else:
api_confirmation_code = ''
history_table_message = 'not_requestable'
log.debug( '%s- prep_code_message complete; local api_confirmation_code, `%s`; history_table_message, `%s`' % (self.log_identifier, api_confirmation_code, history_table_message) )
return ( api_confirmation_code, history_table_message )
def prep_history_sql( self, api_confirmation_code, history_table_message ):
""" Prepares history table update sql.
Called by update_history_table()
TODO: when db class exists, remove utf8 encoding. """
sql = self.HISTORY_SQL_PATTERN % (
self.log_identifier,
'borrowdirect',
'attempt_bd-isbn',
history_table_message,
api_confirmation_code
)
utf8_sql = sql.encode( 'utf-8' ) # old code expects utf-8 string
# log.debug( '%s- prep_history_sql complete; utf8_sql, `%s`' % (self.log_identifier, sql.decode('utf-8')) )
log.debug( '%s- prep_history_sql complete; utf8_sql, `%s`' % (self.log_identifier, utf8_sql.decode('utf-8')) )
return utf8_sql
def handle_success( self, request_inst ):
""" Updates request_inst attributes on success.
Called by controller.run_code() """
request_inst.current_status = 'success'
request_inst.confirmation_code = self.api_confirmation_code
return request_inst
# end class BD_CallerExact()
| 47.656958 | 218 | 0.636222 | 1,764 | 14,726 | 5.031179 | 0.12585 | 0.032338 | 0.064225 | 0.032451 | 0.786817 | 0.74693 | 0.712901 | 0.686197 | 0.668732 | 0.668732 | 0 | 0.003998 | 0.252614 | 14,726 | 308 | 219 | 47.811688 | 0.802381 | 0.210852 | 0 | 0.607477 | 0 | 0.014019 | 0.169892 | 0.023208 | 0 | 0 | 0 | 0.00974 | 0 | 1 | 0.11215 | false | 0.009346 | 0.023364 | 0 | 0.247664 | 0.028037 | 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 |
3794c597e4e759c39a873157346654ba15436082 | 6,005 | py | Python | metrics/parse_log.py | StevenCoral/SED_DOA | 924bb1e9e71d2fb34d5f65946062e830c8d1ec1e | [
"MIT"
] | null | null | null | metrics/parse_log.py | StevenCoral/SED_DOA | 924bb1e9e71d2fb34d5f65946062e830c8d1ec1e | [
"MIT"
] | null | null | null | metrics/parse_log.py | StevenCoral/SED_DOA | 924bb1e9e71d2fb34d5f65946062e830c8d1ec1e | [
"MIT"
] | null | null | null | import os
import pickle
trial_type = 'single' # single or series
loss_type = 'DOA' # 'SED' or 'DOA'
training_params = list()
loss_results = list()
dest_folder = '/home/username/results_pickles/'
if trial_type == 'single':
if loss_type != 'DOA' and loss_type != 'SED':
print('Error: unknown loss type.')
quit()
log_file = 'doa_0000.log'
with open(os.path.join(dest_folder, log_file), 'r') as file:
content = file.read()
hyper_results = content.split('Training mode') # 0 is hyperparams, 1 is results
train_key = 'Train ' + loss_type + ' loss'
valid_key = 'Valid ' + loss_type + ' loss'
results_dict = {train_key: None, valid_key: None}
per_evaluation = hyper_results[1].split('Train SELD loss') # Split results per evaluation
train_list = list()
valid_list = list()
for curr_valid in per_evaluation[1:]:
items = curr_valid.split(', ') # Separate the loss values in the log
# Populate lists only with the desired values:
for curr_item in items:
if train_key in curr_item:
train_list.append(float(curr_item[-5:]))
if valid_key in curr_item:
valid_list.append(float(curr_item[-5:]))
# Save in dictionary and main list:
results_dict[train_key] = train_list
results_dict[valid_key] = valid_list
loss_results.append(results_dict)
with open(os.path.join(dest_folder, 'losses_' + loss_type + '.pickle'), 'wb') as handle:
pickle.dump(loss_results, handle, protocol=pickle.HIGHEST_PROTOCOL)
elif trial_type == 'series':
if loss_type == 'SED':
log_file = '0001.log' # For SED, we need to copy output from the terminal window into a single file.
with open(os.path.join(dest_folder, log_file), 'r') as file:
content = file.read()
per_training = content.split('lr: ')
for curr_training in per_training[1:]:
hyper_results = curr_training.split('Training mode') # 0 is hyperparams, 1 is results
# Create a dictionary of hyperparams for every train ##########
hyperparams_dict = dict()
hyperparams_list = hyper_results[0].split('\n')[0].split(', ')
hyperparams_dict['lr'] = float(hyperparams_list[0])
for curr_param in hyperparams_list[1:]:
key_value = curr_param.split(': ') # 0 is key, 1 is value
# Enter values into the dictionary, convert only nheads to int:
hyperparams_dict[key_value[0]] = int(key_value[1]) if key_value[0] == 'nhead' else key_value[1]
training_params.append(hyperparams_dict)
# Create a dictionary of loss results for every train ##########
train_key = 'Train ' + loss_type + ' loss'
valid_key = 'Valid ' + loss_type + ' loss'
results_dict = {train_key: None, valid_key: None}
per_evaluation = hyper_results[1].split('Train SELD loss') # Split results per evaluation
train_list = list()
valid_list = list()
for curr_valid in per_evaluation[1:]:
items = curr_valid.split(', ') # Separate the loss values in the log
# Populate lists only with the desired values:
for curr_item in items:
if train_key in curr_item:
train_list.append(float(curr_item[-5:]))
if valid_key in curr_item:
valid_list.append(float(curr_item[-5:]))
# Save in dictionary and main list:
results_dict[train_key] = train_list
results_dict[valid_key] = valid_list
loss_results.append(results_dict)
# Save files params to disk:
with open(os.path.join(dest_folder, 'hyperparams_' + loss_type + '.pickle'), 'wb') as handle:
pickle.dump(training_params, handle, protocol=pickle.HIGHEST_PROTOCOL)
with open(os.path.join(dest_folder, 'losses_' + loss_type + '.pickle'), 'wb') as handle:
pickle.dump(loss_results, handle, protocol=pickle.HIGHEST_PROTOCOL)
elif loss_type == 'DOA':
file_list = os.listdir(dest_folder)
for log_file in file_list:
if log_file.endswith('.log'):
with open(os.path.join(dest_folder, log_file), 'r') as file:
content = file.read()
hyper_results = content.split('Training mode') # 0 is hyperparams, 1 is results
# We take the hyper-parameters from the SED file ###############
# Create a dictionary of loss results for every train ##########
train_key = 'Train ' + loss_type + ' loss'
valid_key = 'Valid ' + loss_type + ' loss'
results_dict = {train_key: None, valid_key: None}
per_evaluation = hyper_results[1].split('Train SELD loss') # Split results per evaluation
train_list = list()
valid_list = list()
for curr_valid in per_evaluation[1:]:
items = curr_valid.split(', ') # Separate the loss values in the log
# Populate lists only with the desired values:
for curr_item in items:
if train_key in curr_item:
train_list.append(float(curr_item[-5:]))
if valid_key in curr_item:
valid_list.append(float(curr_item[-5:]))
# Save in dictionary and main list:
results_dict[train_key] = train_list
results_dict[valid_key] = valid_list
loss_results.append(results_dict)
with open(os.path.join(dest_folder, 'losses_' + loss_type + '.pickle'), 'wb') as handle:
pickle.dump(loss_results, handle, protocol=pickle.HIGHEST_PROTOCOL)
else:
print('Error: unknown loss type.')
else:
print('Error: unknown trial type.') | 46.550388 | 111 | 0.594671 | 761 | 6,005 | 4.479632 | 0.140604 | 0.039894 | 0.020534 | 0.028747 | 0.727779 | 0.702845 | 0.702845 | 0.694632 | 0.684658 | 0.672631 | 0 | 0.008789 | 0.298918 | 6,005 | 129 | 112 | 46.550388 | 0.80095 | 0.158035 | 0 | 0.680412 | 0 | 0 | 0.08203 | 0.006217 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.020619 | 0 | 0.020619 | 0.030928 | 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 |
3794d50332ce377f37a53c18a8979f3d31aea0d4 | 479 | py | Python | src/sima/post/fabricationfactor.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/post/fabricationfactor.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/post/fabricationfactor.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | # Generated with FabricationFactor
#
from enum import Enum
from enum import auto
class FabricationFactor(Enum):
""""""
SEAMLESSPIPE = auto()
UOEPIPE = auto()
UOTRBPIPE = auto()
def label(self):
if self == FabricationFactor.SEAMLESSPIPE:
return "Seamless Pipe (1.0)"
if self == FabricationFactor.UOEPIPE:
return "UOE Pipe (0.85)"
if self == FabricationFactor.UOTRBPIPE:
return "UOTRB Pipe (0.925)" | 26.611111 | 50 | 0.617954 | 50 | 479 | 5.92 | 0.48 | 0.060811 | 0.233108 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026012 | 0.277662 | 479 | 18 | 51 | 26.611111 | 0.82948 | 0.066806 | 0 | 0 | 1 | 0 | 0.118721 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.153846 | 0 | 0.769231 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
37a4234cf47dfcb50161edb970089a243a6d7ca3 | 228 | py | Python | src/TimeAxisItem.py | enzo-bc/qteeg | 1816eb3f83c77342f8cb49df826abfc23edf7b8d | [
"BSD-3-Clause"
] | 1 | 2021-12-07T19:10:36.000Z | 2021-12-07T19:10:36.000Z | src/TimeAxisItem.py | enzo-bc/qteeg | 1816eb3f83c77342f8cb49df826abfc23edf7b8d | [
"BSD-3-Clause"
] | null | null | null | src/TimeAxisItem.py | enzo-bc/qteeg | 1816eb3f83c77342f8cb49df826abfc23edf7b8d | [
"BSD-3-Clause"
] | null | null | null | import pyqtgraph as pg
import pandas as pd
class TimeAxisItem(pg.AxisItem):
def tickStrings(self, values, scale, spacing):
return [pd.Timestamp(value).to_pydatetime(warn=False)
for value in values]
| 25.333333 | 61 | 0.692982 | 30 | 228 | 5.233333 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223684 | 228 | 8 | 62 | 28.5 | 0.887006 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 0.833333 | 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 | 1 | 0 | 0 | 0 | 3 |
37b9e27c2c085a5f439428d2aeb920fecc6992da | 668 | py | Python | conv_is_all_you_need/src/Cropping_Window_Xception/analyze.py | guitarmind/HPA-competition-solutions | 547d53aaca148fdb5f4585526ad7364dfa47967d | [
"MIT"
] | null | null | null | conv_is_all_you_need/src/Cropping_Window_Xception/analyze.py | guitarmind/HPA-competition-solutions | 547d53aaca148fdb5f4585526ad7364dfa47967d | [
"MIT"
] | null | null | null | conv_is_all_you_need/src/Cropping_Window_Xception/analyze.py | guitarmind/HPA-competition-solutions | 547d53aaca148fdb5f4585526ad7364dfa47967d | [
"MIT"
] | null | null | null | from lib.steps import after_training_for_folds
from lib.config import print_config
from lib.utils import load_config, debug
import os
import fire
def main(cwd):
config = load_config(cwd)
# os.environ['CUDA_VISIBLE_DEVICES'] = config['cuda_visible_devices'] or '0,1,2,3,4,5,6,7'
# avail_gpus = GPUtil.getAvailable(limit=100)
# os.environ['CUDA_VISIBLE_DEVICES'] = ','.join(map(str, avail_gpus))
os.environ['CUDA_VISIBLE_DEVICES'] = '0,1,2,3'
debug(f"os.environ['CUDA_VISIBLE_DEVICES'] = {os.environ['CUDA_VISIBLE_DEVICES']}")
print_config(config)
after_training_for_folds(config)
if __name__ == '__main__':
fire.Fire(main)
| 24.740741 | 94 | 0.718563 | 101 | 668 | 4.435644 | 0.425743 | 0.147321 | 0.241071 | 0.223214 | 0.301339 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026224 | 0.143713 | 668 | 26 | 95 | 25.692308 | 0.756993 | 0.299401 | 0 | 0 | 0 | 0 | 0.232759 | 0.150862 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.384615 | 0 | 0.461538 | 0.153846 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
37bbc8f5767e29241bdf2a7eec08c71c79b80fc7 | 406 | py | Python | src/engines/Examples/Python/check_cartopy.py | NOAA-EMC/ioda | 366ce1aa4572dde7f3f15862a2970f3dd3c82369 | [
"Apache-2.0"
] | 1 | 2021-06-09T16:11:50.000Z | 2021-06-09T16:11:50.000Z | src/engines/Examples/Python/check_cartopy.py | NOAA-EMC/ioda | 366ce1aa4572dde7f3f15862a2970f3dd3c82369 | [
"Apache-2.0"
] | null | null | null | src/engines/Examples/Python/check_cartopy.py | NOAA-EMC/ioda | 366ce1aa4572dde7f3f15862a2970f3dd3c82369 | [
"Apache-2.0"
] | 3 | 2021-06-09T16:12:02.000Z | 2021-11-14T09:19:25.000Z | #
# (C) Copyright 2020-2021 UCAR
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# This just checks that numPy, Matplotlib and Cartopy are available.
# If they are not, then the tests that depend on them will be skipped.
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
| 29 | 77 | 0.761084 | 70 | 406 | 4.414286 | 0.771429 | 0.012945 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035608 | 0.169951 | 406 | 13 | 78 | 31.230769 | 0.881306 | 0.761084 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
805b1962e62161f688d453ed7ed3f91a4858c95d | 108 | py | Python | Coursera/Week.3/Task.4.py | v1nnyb0y/Coursera.BasePython | bbfb3184dc27a4cdb16b087123890991afbc5506 | [
"MIT"
] | null | null | null | Coursera/Week.3/Task.4.py | v1nnyb0y/Coursera.BasePython | bbfb3184dc27a4cdb16b087123890991afbc5506 | [
"MIT"
] | null | null | null | Coursera/Week.3/Task.4.py | v1nnyb0y/Coursera.BasePython | bbfb3184dc27a4cdb16b087123890991afbc5506 | [
"MIT"
] | null | null | null | '''
Цена товара
'''
import math
N = float(input())
print(int(N), int(round(N - int(N), 2) * 100), sep=' ')
| 13.5 | 55 | 0.555556 | 18 | 108 | 3.333333 | 0.722222 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044944 | 0.175926 | 108 | 7 | 56 | 15.428571 | 0.629213 | 0.101852 | 0 | 0 | 0 | 0 | 0.011236 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 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 |
806ad0e5ea7464dedff7af4721ef13666678e8c1 | 276 | py | Python | website/oauth/utils.py | bdyetton/prettychart | e8b33a7dfdc8c33d15969586be7f68172795f76d | [
"Apache-2.0"
] | null | null | null | website/oauth/utils.py | bdyetton/prettychart | e8b33a7dfdc8c33d15969586be7f68172795f76d | [
"Apache-2.0"
] | null | null | null | website/oauth/utils.py | bdyetton/prettychart | e8b33a7dfdc8c33d15969586be7f68172795f76d | [
"Apache-2.0"
] | null | null | null | # This dict is built through the metaclass applied to ExternalProvider.
# It is intentionally empty here, and should remain empty.
PROVIDER_LOOKUP = dict()
def get_service(name):
"""Given a service name, return the provider class"""
return PROVIDER_LOOKUP[name]()
| 30.666667 | 71 | 0.746377 | 38 | 276 | 5.342105 | 0.710526 | 0.137931 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 276 | 8 | 72 | 34.5 | 0.890351 | 0.641304 | 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 |
806fe0585fe1b78af7a0a8c1f9cc09bf98f9bd56 | 177 | py | Python | main.py | keremkoseoglu/yogaflow | 5e2d53c39c6a14efa69109b199e2f30361919b85 | [
"MIT"
] | 1 | 2022-01-11T14:01:58.000Z | 2022-01-11T14:01:58.000Z | main.py | keremkoseoglu/yogaflow | 5e2d53c39c6a14efa69109b199e2f30361919b85 | [
"MIT"
] | 40 | 2020-06-09T04:46:25.000Z | 2022-03-31T13:09:15.000Z | main.py | keremkoseoglu/yogaflow | 5e2d53c39c6a14efa69109b199e2f30361919b85 | [
"MIT"
] | 1 | 2022-01-11T14:01:52.000Z | 2022-01-11T14:01:52.000Z | """Main entry point"""
import os
from PyQt5.Qt import QApplication
from gui.prime import Prime
APP = QApplication([])
P = Prime()
os._exit(APP.exec_()) # pylint: disable=W0212
| 19.666667 | 45 | 0.723164 | 26 | 177 | 4.846154 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03268 | 0.135593 | 177 | 8 | 46 | 22.125 | 0.79085 | 0.220339 | 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 |
80a7f56f505f0dbd4204cbca1f042ca893e0a682 | 66 | py | Python | beproud/django/commons/__init__.py | beproud/bpcommons | c24aed4143d743b1af6c621630ed9faa7e1ccaa4 | [
"BSD-2-Clause"
] | 2 | 2016-03-07T01:52:12.000Z | 2017-08-30T06:14:43.000Z | beproud/django/commons/__init__.py | beproud/bpcommons | c24aed4143d743b1af6c621630ed9faa7e1ccaa4 | [
"BSD-2-Clause"
] | 18 | 2015-03-08T13:52:18.000Z | 2022-01-25T02:46:09.000Z | beproud/django/commons/__init__.py | beproud/bpcommons | c24aed4143d743b1af6c621630ed9faa7e1ccaa4 | [
"BSD-2-Clause"
] | 2 | 2015-02-07T01:33:00.000Z | 2015-09-08T14:57:44.000Z | VERSION_INFO = (0, 42)
VERSION = '.'.join(map(str, VERSION_INFO))
| 22 | 42 | 0.666667 | 10 | 66 | 4.2 | 0.7 | 0.52381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051724 | 0.121212 | 66 | 2 | 43 | 33 | 0.672414 | 0 | 0 | 0 | 0 | 0 | 0.015152 | 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 |
80aab45b2e45498da2af63c84e1aa2903d801120 | 89 | py | Python | cursopython/pythonteste/aula13b.py | AtilaCosta87/Python | b4eea7885d16df80feecc4c699a8348ca13a80c2 | [
"MIT"
] | 1 | 2018-07-23T04:03:35.000Z | 2018-07-23T04:03:35.000Z | cursopython/pythonteste/aula13b.py | AtilaCosta87/Python | b4eea7885d16df80feecc4c699a8348ca13a80c2 | [
"MIT"
] | null | null | null | cursopython/pythonteste/aula13b.py | AtilaCosta87/Python | b4eea7885d16df80feecc4c699a8348ca13a80c2 | [
"MIT"
] | null | null | null | n = int(input('Digite um número: '))
for c in range(0, n + 1):
print(c)
print('FIM')
| 17.8 | 36 | 0.573034 | 17 | 89 | 3 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028571 | 0.213483 | 89 | 4 | 37 | 22.25 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0.235955 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
80c2057ae9d2bbf973f4e4375f5d617a9a47ff15 | 3,217 | py | Python | catkin_ws/src/meArm/script/regulate_mearm_20191210.py | kjoelovelife/Knight_car | 5d5909ce495094fdc46bb87be2e28be8ba718854 | [
"CC-BY-2.0"
] | null | null | null | catkin_ws/src/meArm/script/regulate_mearm_20191210.py | kjoelovelife/Knight_car | 5d5909ce495094fdc46bb87be2e28be8ba718854 | [
"CC-BY-2.0"
] | null | null | null | catkin_ws/src/meArm/script/regulate_mearm_20191210.py | kjoelovelife/Knight_car | 5d5909ce495094fdc46bb87be2e28be8ba718854 | [
"CC-BY-2.0"
] | 4 | 2019-08-17T03:36:07.000Z | 2020-09-29T02:19:46.000Z | #!/usr/bin/python
from Adafruit_MotorHAT.Adafruit_PWM_Servo_Driver import PWM
from Adafruit_MotorHAT import Adafruit_MotorHAT as DC_motor
import time ,sys ,select,termios ,tty ,atexit
import numpy as np
## ==== set parameter ====
board = {}
board["addr"] = 0x60
servo_parameter_text = ["frequency" ,"pulse_max" ,"pulse_min" ,"angle_max" , "angle_min","exercise_time" , "bottom_angle","arm_angle" ,"head_angle" , "paw_angle", "step_angle" ,"move_status"]
servo_parameter = {
servo_parameter_text[0] : 50 , # frequency
servo_parameter_text[1] : 2.0 , # pulse max
servo_parameter_text[2] : 1.0 , # pulse min
servo_parameter_text[3] : 180.0, # angle max
servo_parameter_text[4] : 0.0 , # angle min
servo_parameter_text[5] : 0.5 , # exercise time
servo_parameter_text[6] : 90.0 , # bottom angle
servo_parameter_text[7] : 180.0 , # arm angle
servo_parameter_text[8] : 0.0 , # head angle
servo_parameter_text[9] : 150.0 , # paw angle
servo_parameter_text[10] : 1.0 , # step angle
servo_parameter_text[11] : False, # move status
}
## ==== set pin of servo ====
pin = {}
pin[ servo_parameter_text[6] ] = 15
pin[ servo_parameter_text[7] ] = 0
pin[ servo_parameter_text[8] ] = 14
pin[ servo_parameter_text[9] ] = 1
## ==== set pin of servo ====
servo = PWM(board["addr"])
servo.setPWMFreq(servo_parameter["frequency"])
def setServoPulse( pin, angle):
pulseLength = 1000000 # 1,000,000 us per second
pulseLength /= servo_parameter["frequency"] # Hz
pulseLength /= 4096 # 12 bits of resolution
pulse = (servo_parameter["pulse_max"] - servo_parameter["pulse_min"] ) * (angle - servo_parameter["angle_min"] ) / ( servo_parameter["angle_max"] - servo_parameter["angle_min"] ) + servo_parameter["pulse_min"]
pulse *= 1000
pulse /= pulseLength
servo.setPWM( pin , 0 , int(pulse) )
def getKey():
tty.setraw(sys.stdin.fileno())
rlist, _, _ = select.select([sys.stdin],[],[],0.1)
if rlist:
key = sys.stdin.read(1)
else:
key = ""
termios.tcsetattr(sys.stdin , termios.TCSADRAIN, settings)
return key
def constrain(input , low , high):
if input < low:
input = low
elif input > high:
input = high
else:
input = input
return input
def check_value(value):
value = constrain( value , servo_parameter["angle_min"] , servo_parameter["angle_max"] )
return value
def servo_release(pin):
servo.setPWM( pin , 0 , 0 )
if __name__ == "__main__":
for start_text in (servo_parameter_text[6] , servo_parameter_text[7],servo_parameter_text[8],servo_parameter_text[9]):
setServoPulse(pin[start_text] , servo_parameter[start_text])
print(" {} now is {}".format(start_text , servo_parameter[start_text]))
time.sleep(3)
for control_pin in pin.values():
servo_release(control_pin)
print (" Release all servo ")
| 30.349057 | 214 | 0.602114 | 396 | 3,217 | 4.636364 | 0.282828 | 0.259259 | 0.205882 | 0.062636 | 0.102397 | 0.102397 | 0.04793 | 0.04793 | 0 | 0 | 0 | 0.038989 | 0.274479 | 3,217 | 105 | 215 | 30.638095 | 0.747644 | 0.085173 | 0 | 0.030303 | 0 | 0 | 0.088407 | 0 | 0 | 0 | 0.001376 | 0 | 0 | 0 | null | null | 0 | 0.060606 | null | null | 0.030303 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
80cd78695ae40b277968de7ab2de8e58ad54888b | 352 | py | Python | hackerrank/strings/find_a_string.py | alex-d-bondarev/learn-python | b119cb1e09a57e93abc73383c014cc8ceba18acf | [
"MIT"
] | null | null | null | hackerrank/strings/find_a_string.py | alex-d-bondarev/learn-python | b119cb1e09a57e93abc73383c014cc8ceba18acf | [
"MIT"
] | null | null | null | hackerrank/strings/find_a_string.py | alex-d-bondarev/learn-python | b119cb1e09a57e93abc73383c014cc8ceba18acf | [
"MIT"
] | null | null | null | def count_substring(string, sub_string):
counter = 0;
while (string.find(sub_string) >= 0):
counter += 1
string = string[string.find(sub_string) + 1:]
return counter
if __name__ == '__main__':
string = input().strip()
sub_string = input().strip()
count = count_substring(string, sub_string)
print(count)
| 22 | 53 | 0.630682 | 43 | 352 | 4.813953 | 0.395349 | 0.217391 | 0.193237 | 0.222222 | 0.280193 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01487 | 0.235795 | 352 | 15 | 54 | 23.466667 | 0.754647 | 0 | 0 | 0 | 0 | 0 | 0.022727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0 | 0 | 0.181818 | 0.090909 | 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 |
80d5721f95b13f71f84589312fd93d329027f56a | 4,380 | py | Python | python/tests/unit/test_vtk_writer.py | nicolas-chaulet/bempp | 0f5cc72e0e542437e787db5704978456b0ad9e35 | [
"BSL-1.0"
] | 2 | 2021-07-22T13:34:28.000Z | 2021-07-22T13:35:20.000Z | python/tests/unit/test_vtk_writer.py | UCL/bempp | f768ec7d319c02d6e0142512fb61db0607cadf10 | [
"BSL-1.0"
] | null | null | null | python/tests/unit/test_vtk_writer.py | UCL/bempp | f768ec7d319c02d6e0142512fb61db0607cadf10 | [
"BSL-1.0"
] | 1 | 2021-05-17T09:46:44.000Z | 2021-05-17T09:46:44.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import the bempp module
import sys
sys.path.append("../..")
import bempp
import numpy as np
import os
import shutil
import pytest
class TestVtkWriter:
def setup_method(self, method):
self.grid = bempp.GridFactory.createStructuredGrid("triangular", (0., 0.), (1., 2.), (4, 5))
self.view = self.grid.leafView()
self.vtkWriter = self.view.vtkWriter()
def test_addCellData_throws_for_input_of_incorrect_dimensions(self):
data = np.zeros((3, 4))
pytest.raises((RuntimeError, ValueError, TypeError),
"self.vtkWriter.addCellData(data, 'title')")
def test_addCellData_does_not_throw_for_input_of_correct_dimensions(self):
data = np.zeros((self.view.entityCount(0), 4))
pytest.raises((RuntimeError, ValueError, TypeError),
"self.vtkWriter.addCellData(data, 'title')")
def test_addCellData_saves_a_ref_to_python_data(self):
data = np.zeros((4, self.view.entityCount(0)))
self.vtkWriter.addCellData(data, 'title')
assert len(self.vtkWriter._python_data) == 1
def test_addCellData_saves_a_ref_to_correct_python_data(self):
data = np.zeros((4, self.view.entityCount(0)))
self.vtkWriter.addCellData(data, 'title')
assert np.all(self.vtkWriter._python_data[0] == data)
def test_addCellData_saves_a_ref_to_c_data(self):
data = np.zeros((4, self.view.entityCount(0)))
self.vtkWriter.addCellData(data, 'title')
assert len(self.vtkWriter._c_data) == 1
def test_addVertexData_throws_for_input_of_incorrect_dimensions(self):
data = np.zeros((3, 4))
pytest.raises((RuntimeError, ValueError, TypeError),
"self.vtkWriter.addVertexData(data, 'title')")
def test_addVertexData_does_not_throw_for_input_of_correct_dimensions(self):
data = np.zeros((4, self.view.entityCount(2)))
vtkWriter = self.vtkWriter.addVertexData(data, 'title') # should not throw
def test_addVertexData_saves_a_ref_to_python_data(self):
data = np.zeros((4, self.view.entityCount(2)))
self.vtkWriter.addVertexData(data, 'title')
assert len(self.vtkWriter._python_data) == 1
def test_addVertexData_saves_a_ref_to_correct_python_data(self):
data = np.zeros((4, self.view.entityCount(2)))
self.vtkWriter.addVertexData(data, 'title')
assert np.all(self.vtkWriter._python_data[0] == data)
def test_addVertexData_saves_a_ref_to_c_data(self):
data = np.zeros((4, self.view.entityCount(2)))
self.vtkWriter.addVertexData(data, 'title')
assert len(self.vtkWriter._c_data) == 1
def test_clear_clears_refs_to_python_data(self):
data = np.zeros((4, self.view.entityCount(2)))
self.vtkWriter.addVertexData(data, 'title')
self.vtkWriter.clear()
assert ((not hasattr(self.vtkWriter, "_python_data"))
or self.vtkWriter._python_data is None)
def test_clear_clears_refs_to_c_data(self):
data = np.zeros((4, self.view.entityCount(2)))
self.vtkWriter.addVertexData(data, 'title')
self.vtkWriter.clear()
assert ((not hasattr(self.vtkWriter, "_c_data"))
or self.vtkWriter._c_data is None)
@pytest.mark.parametrize("type", ("ascii", "base64", "appendedraw", "appendedbase64"))
def test_write_accepts_output_type(self, type):
if os.path.exists("output.vtu"):
os.remove("output.vtu")
data = np.zeros((4, self.view.entityCount(2)))
self.vtkWriter.addVertexData(data, 'title')
self.vtkWriter.write("output", type)
assert os.path.exists("output.vtu")
os.remove("output.vtu")
@pytest.mark.parametrize("type", ("ascii", "base64", "appendedraw", "appendedbase64"))
def test_pwrite_accepts_output_type(self, type):
if os.path.exists("subdir"):
shutil.rmtree("subdir")
os.mkdir("subdir")
os.mkdir("subdir/nested_subdir")
data = np.zeros((4, self.view.entityCount(2)))
self.vtkWriter.addVertexData(data, 'title')
self.vtkWriter.pwrite("output", "subdir", "nested_subdir", type)
assert os.path.exists("subdir/s0001:output.pvtu")
assert os.path.exists("subdir/nested_subdir/s0001:p0000:output.vtu")
shutil.rmtree("subdir") | 40.555556 | 100 | 0.669406 | 559 | 4,380 | 5.030411 | 0.175313 | 0.134068 | 0.054765 | 0.064011 | 0.782361 | 0.73542 | 0.722262 | 0.69808 | 0.69808 | 0.640114 | 0 | 0.01728 | 0.194064 | 4,380 | 108 | 101 | 40.555556 | 0.77932 | 0.01895 | 0 | 0.5 | 0 | 0 | 0.110852 | 0.038426 | 0 | 0 | 0 | 0 | 0.130952 | 1 | 0.178571 | false | 0 | 0.071429 | 0 | 0.261905 | 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 |
80db4de7c9e36ab7a3f89becdff758d2e46cfc7b | 353 | py | Python | djangocms_baseplugins/inline_gallery/models.py | benzkji/djangocms-baseplugins | 7f041a030ed93dcdec70e4ca777b841846b8f2f2 | [
"MIT"
] | 2 | 2019-04-14T01:31:22.000Z | 2020-03-05T13:06:57.000Z | djangocms_baseplugins/inline_gallery/models.py | benzkji/djangocms-baseplugins | 7f041a030ed93dcdec70e4ca777b841846b8f2f2 | [
"MIT"
] | 32 | 2017-04-04T09:28:06.000Z | 2021-08-18T16:23:02.000Z | djangocms_baseplugins/inline_gallery/models.py | bnzk/djangocms-baseplugins | 7f041a030ed93dcdec70e4ca777b841846b8f2f2 | [
"MIT"
] | null | null | null |
from .base import InlineGalleryBase, InlineGalleryImageBase
from djangocms_baseplugins.baseplugin.utils import check_migration_modules_needed
check_migration_modules_needed('inline_gallery')
class InlineGallery(InlineGalleryBase):
pass
class InlineGalleryImage(InlineGalleryImageBase):
def __str__(self):
return self.to_string()
| 20.764706 | 81 | 0.82153 | 35 | 353 | 7.914286 | 0.714286 | 0.101083 | 0.151625 | 0.194946 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121813 | 353 | 16 | 82 | 22.0625 | 0.893548 | 0 | 0 | 0 | 0 | 0 | 0.039773 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.125 | 0.25 | 0.125 | 0.75 | 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 | 1 | 0 | 0 | 0 | 3 |
80e9ffd9f55df567ccb0bb6a16d18e850ab7a32a | 3,410 | py | Python | python/basics/acs_vars.py | madebr/ncurses_programs | ccb818ef552a39bf2ecbe42151375d5f9965d5c7 | [
"X11"
] | null | null | null | python/basics/acs_vars.py | madebr/ncurses_programs | ccb818ef552a39bf2ecbe42151375d5f9965d5c7 | [
"X11"
] | null | null | null | python/basics/acs_vars.py | madebr/ncurses_programs | ccb818ef552a39bf2ecbe42151375d5f9965d5c7 | [
"X11"
] | null | null | null | #!/usr/bin/env python
import curses
try:
stdscr = curses.initscr()
stdscr.addstr("Upper left corner "); stdscr.addch(curses.ACS_ULCORNER); stdscr.addstr("\n")
stdscr.addstr("Lower left corner "); stdscr.addch(curses.ACS_LLCORNER); stdscr.addstr("\n")
stdscr.addstr("Lower right corner "); stdscr.addch(curses.ACS_LRCORNER); stdscr.addstr("\n")
stdscr.addstr("Tee pointing right "); stdscr.addch(curses.ACS_LTEE); stdscr.addstr("\n")
stdscr.addstr("Tee pointing left "); stdscr.addch(curses.ACS_RTEE); stdscr.addstr("\n")
stdscr.addstr("Tee pointing up "); stdscr.addch(curses.ACS_BTEE); stdscr.addstr("\n")
stdscr.addstr("Tee pointing down "); stdscr.addch(curses.ACS_TTEE); stdscr.addstr("\n")
stdscr.addstr("Horizontal line "); stdscr.addch(curses.ACS_HLINE); stdscr.addstr("\n")
stdscr.addstr("Vertical line "); stdscr.addch(curses.ACS_VLINE); stdscr.addstr("\n")
stdscr.addstr("Large Plus or cross over "); stdscr.addch(curses.ACS_PLUS); stdscr.addstr("\n")
stdscr.addstr("Scan Line 1 "); stdscr.addch(curses.ACS_S1); stdscr.addstr("\n")
stdscr.addstr("Scan Line 3 "); stdscr.addch(curses.ACS_S3); stdscr.addstr("\n")
stdscr.addstr("Scan Line 7 "); stdscr.addch(curses.ACS_S7); stdscr.addstr("\n")
stdscr.addstr("Scan Line 9 "); stdscr.addch(curses.ACS_S9); stdscr.addstr("\n")
stdscr.addstr("Diamond "); stdscr.addch(curses.ACS_DIAMOND); stdscr.addstr("\n")
stdscr.addstr("Checker board (stipple) "); stdscr.addch(curses.ACS_CKBOARD); stdscr.addstr("\n")
stdscr.addstr("Degree Symbol "); stdscr.addch(curses.ACS_DEGREE); stdscr.addstr("\n")
stdscr.addstr("Plus/Minus Symbol "); stdscr.addch(curses.ACS_PLMINUS); stdscr.addstr("\n")
stdscr.addstr("Bullet "); stdscr.addch(curses.ACS_BULLET); stdscr.addstr("\n")
stdscr.addstr("Arrow Pointing Left "); stdscr.addch(curses.ACS_LARROW); stdscr.addstr("\n")
stdscr.addstr("Arrow Pointing Right "); stdscr.addch(curses.ACS_RARROW); stdscr.addstr("\n")
stdscr.addstr("Arrow Pointing Down "); stdscr.addch(curses.ACS_DARROW); stdscr.addstr("\n")
stdscr.addstr("Arrow Pointing Up "); stdscr.addch(curses.ACS_UARROW); stdscr.addstr("\n")
stdscr.addstr("Board of squares "); stdscr.addch(curses.ACS_BOARD); stdscr.addstr("\n")
stdscr.addstr("Lantern Symbol "); stdscr.addch(curses.ACS_LANTERN); stdscr.addstr("\n")
stdscr.addstr("Solid Square Block "); stdscr.addch(curses.ACS_BLOCK); stdscr.addstr("\n")
stdscr.addstr("Less/Equal sign "); stdscr.addch(curses.ACS_LEQUAL); stdscr.addstr("\n")
stdscr.addstr("Greater/Equal sign "); stdscr.addch(curses.ACS_GEQUAL); stdscr.addstr("\n")
stdscr.addstr("Pi "); stdscr.addch(curses.ACS_PI); stdscr.addstr("\n")
stdscr.addstr("Not equal "); stdscr.addch(curses.ACS_NEQUAL); stdscr.addstr("\n")
stdscr.addstr("UK pound sign "); stdscr.addch(curses.ACS_STERLING); stdscr.addstr("\n")
stdscr.getch()
finally:
curses.endwin()
| 77.5 | 105 | 0.608504 | 409 | 3,410 | 4.997555 | 0.205379 | 0.363992 | 0.257828 | 0.303327 | 0.671233 | 0.389432 | 0.209393 | 0 | 0 | 0 | 0 | 0.003049 | 0.230499 | 3,410 | 43 | 106 | 79.302326 | 0.775915 | 0.005865 | 0 | 0 | 0 | 0 | 0.274417 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.027027 | 0 | 0.027027 | 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 |
80f7b999021f63c374a6f2d7987c4598997b69b9 | 396 | py | Python | neurospyke/visualization/__init__.py | FrancescoNegri/neurospyke | 1f7836d262d841f4a31d7d0d5e3fadc5fc313b6e | [
"MIT"
] | null | null | null | neurospyke/visualization/__init__.py | FrancescoNegri/neurospyke | 1f7836d262d841f4a31d7d0d5e3fadc5fc313b6e | [
"MIT"
] | null | null | null | neurospyke/visualization/__init__.py | FrancescoNegri/neurospyke | 1f7836d262d841f4a31d7d0d5e3fadc5fc313b6e | [
"MIT"
] | null | null | null | from .raw_data import plot_raw_data
from .spikes import plot_spikes
from .butterfly import plot_butterfly
from .spike_train import plot_spike_train
from .isih import plot_ISIH
from .psth import plot_PSTH
from .crosscorr import plot_cross_correlogram
__all__ = [
'plot_raw_data', 'plot_spikes', 'plot_butterfly',
'plot_spike_train', 'plot_ISIH',
'plot_PSTH', 'plot_cross_correlogram'] | 33 | 53 | 0.79798 | 58 | 396 | 5 | 0.258621 | 0.241379 | 0.075862 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126263 | 396 | 12 | 54 | 33 | 0.83815 | 0 | 0 | 0 | 0 | 0 | 0.236776 | 0.055416 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.636364 | 0 | 0.636364 | 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 |
038b387b5db31b2dd2316a23fcd69f28c5d836de | 1,372 | py | Python | src/structure/ole/dir_entry.py | orca-eaa5a/pyhwpscan | df728c78309419276d296f98fd2ed81fa711aa99 | [
"MIT"
] | null | null | null | src/structure/ole/dir_entry.py | orca-eaa5a/pyhwpscan | df728c78309419276d296f98fd2ed81fa711aa99 | [
"MIT"
] | null | null | null | src/structure/ole/dir_entry.py | orca-eaa5a/pyhwpscan | df728c78309419276d296f98fd2ed81fa711aa99 | [
"MIT"
] | null | null | null | '''
http://www.reversenote.info/ole-parser-python/
'''
from ctypes import *
import zlib
from structure.c_style_structure import CStyleStructure
class DirectoryEntry(CStyleStructure):
def __init__(self, ptr_size=4, pack=0):
super().__init__(ptr_size=ptr_size, pack=1)
self.DirectoryEntryName = c_ubyte * 0x40
self.DirectoryEntryNameLength = c_short
self.ObjectType = c_ubyte
self.ColorFlag = c_ubyte
self.LeftSiblingID = c_uint32
self.RightSiblingID = c_uint32
self.ChildID = c_uint32
self.CLSID = c_ubyte * 0x10
self.StateFlags = c_uint32
self.CreationTime = c_uint64
self.ModificationTime = c_uint64
self.StartingSectorLocation = c_uint32
self.StreamSize = c_uint64
self.stream = None
def size(self):
return self.sizeof()
def stream_size(self):
return self.StreamSize
def name(self):
return bytes(self.DirectoryEntryName).decode('utf16').replace('\x00', '')
def name_raw(self):
return bytes(self.DirectoryEntryName)
def get_stream(self):
return self.stream
def raw(self):
return self.get_bytes()
def get_decompressed_stream(self):
zobj = zlib.decompressobj(-zlib.MAX_WBITS)
stream = zobj.decompress(self.get_stream())
return stream
| 31.906977 | 81 | 0.658892 | 160 | 1,372 | 5.4375 | 0.4 | 0.068966 | 0.063218 | 0.041379 | 0.085057 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028128 | 0.248542 | 1,372 | 43 | 82 | 31.906977 | 0.815713 | 0.033528 | 0 | 0 | 0 | 0 | 0.006823 | 0 | 0 | 0 | 0.006065 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.083333 | 0.166667 | 0.527778 | 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 |
03b5d2138268e6678a7a12a8494039b2027e8318 | 1,592 | py | Python | tests/ea/fitness_normalizer/fixtures/multiply.py | stevenbennett96/stk | 6e5af87625b83e0bfc7243bc42d8c7a860cbeb76 | [
"MIT"
] | null | null | null | tests/ea/fitness_normalizer/fixtures/multiply.py | stevenbennett96/stk | 6e5af87625b83e0bfc7243bc42d8c7a860cbeb76 | [
"MIT"
] | null | null | null | tests/ea/fitness_normalizer/fixtures/multiply.py | stevenbennett96/stk | 6e5af87625b83e0bfc7243bc42d8c7a860cbeb76 | [
"MIT"
] | null | null | null | import pytest
import stk
from ..case_data import CaseData
def _get_case_data_1() -> CaseData:
topology_graph = stk.polymer.Linear(
building_blocks=(
stk.BuildingBlock('BrCCBr', [stk.BromoFactory()]),
),
repeating_unit='A',
num_repeating_units=2,
)
return CaseData(
fitness_normalizer=stk.Multiply(
coefficient=(1, 2, 3),
filter=lambda population, record:
record.get_fitness_value() is not None,
),
population=(
stk.MoleculeRecord(
topology_graph=topology_graph,
).with_fitness_value((1, 10, 100)),
stk.MoleculeRecord(
topology_graph=topology_graph,
).with_fitness_value((2, 20, 200)),
stk.MoleculeRecord(
topology_graph=topology_graph,
).with_fitness_value((3, 30, 300)),
stk.MoleculeRecord(topology_graph),
),
normalized=(
stk.MoleculeRecord(
topology_graph=topology_graph,
).with_fitness_value((1, 20, 300)),
stk.MoleculeRecord(
topology_graph=topology_graph,
).with_fitness_value((2, 40, 600)),
stk.MoleculeRecord(
topology_graph=topology_graph,
).with_fitness_value((3, 60, 900)),
stk.MoleculeRecord(topology_graph),
),
)
@pytest.fixture(
scope='session',
params=(
_get_case_data_1,
),
)
def multiply(request) -> CaseData:
return request.param()
| 27.929825 | 62 | 0.562814 | 153 | 1,592 | 5.575163 | 0.379085 | 0.228605 | 0.234467 | 0.28136 | 0.464244 | 0.42204 | 0.42204 | 0.42204 | 0.42204 | 0.42204 | 0 | 0.039437 | 0.33103 | 1,592 | 56 | 63 | 28.428571 | 0.761502 | 0 | 0 | 0.38 | 0 | 0 | 0.008794 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0 | 0.06 | 0.02 | 0.14 | 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 |
03e071bfa7fb04dc25bbce74e4f7bf8a177e6eb4 | 689 | py | Python | PyBall/models/position/position.py | a-hacker/PyBall | ed88b28dceddf4c8b9f1370d931e4cfa74ce5fda | [
"MIT"
] | null | null | null | PyBall/models/position/position.py | a-hacker/PyBall | ed88b28dceddf4c8b9f1370d931e4cfa74ce5fda | [
"MIT"
] | null | null | null | PyBall/models/position/position.py | a-hacker/PyBall | ed88b28dceddf4c8b9f1370d931e4cfa74ce5fda | [
"MIT"
] | null | null | null | from PyBall.models import BaseModel
class Position(BaseModel):
_fields = {
'id': {'default_value': None, 'field_type': str},
'fullName': {'default_value': None, 'field_type': str},
'link': {'default_value': None, 'field_type': str},
}
class Pitcher(Position):
pass
class Catcher(Position):
pass
class First(Position):
pass
class Second(Position):
pass
class Third(Position):
pass
class Shortstop(Position):
pass
class Left(Position):
pass
class Center(Position):
pass
class Right(Position):
pass
class Batter(Position):
pass
class OnDeck(Position):
pass
class InHole(Position):
pass
| 11.87931 | 63 | 0.638607 | 78 | 689 | 5.551282 | 0.384615 | 0.332564 | 0.431871 | 0.145497 | 0.193995 | 0.193995 | 0 | 0 | 0 | 0 | 0 | 0 | 0.24238 | 689 | 57 | 64 | 12.087719 | 0.829502 | 0 | 0 | 0.387097 | 0 | 0 | 0.120464 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.387097 | 0.032258 | 0 | 0.483871 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
ff03577c945a7e72e50c08c8437c93c61af6ae25 | 22,947 | py | Python | linode/commands/linode_create.py | anvetsu/pylinode | 3b15a153fa0528df203c0013949827ff836759f5 | [
"MIT"
] | null | null | null | linode/commands/linode_create.py | anvetsu/pylinode | 3b15a153fa0528df203c0013949827ff836759f5 | [
"MIT"
] | null | null | null | linode/commands/linode_create.py | anvetsu/pylinode | 3b15a153fa0528df203c0013949827ff836759f5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import time
import click
from urls import *
from base_request import Linode, print_table, CONTEXT_SETTINGS
SIZES = {'1':20480, '2':30720, '3': 48, '4':96, '5': 192, '6':384, '7':768, '8':1152, '9':1536}
DATACENTERS = {'2': 'Dallas, TX, USA', '3': 'Fremont, CA, USA', '4': 'Atlanta, GA, USA', '6': 'Newark, NJ, USA', '7': 'London, England, UK', '8': 'Tokyo, JP', '9': 'Singapore, SG', '10': 'Frankfurt, DE'}
PLANS = {'1': 'Linode 1024', '2': 'Linode 2048', '4': 'Linode 4096', '6': 'Linode 8192', '7': 'Linode 16384', '8': 'Linode 32768', '9': 'Linode 49152', '10': 'Linode 65536', '12': 'Linode 98304'}
@click.group()
def linode_create_group():
"""
account command group
"""
pass
def validate(dic, option_list):
"""
linode create command validation
"""
for option in option_list:
if not dic[option]:
raise click.UsageError('required option %s is missing' %(option))
return True
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--datacenter', '-d', type=click.Choice(['2','3','4','6','7','8','9','10']), help='datacenter id to create linode', metavar='<default=2>', default='9')
@click.option('--plan', '-p', type=click.Choice(['1', '2','4','6','7','8','9','10','12']), help='plan id to create linode', metavar='<default=1>', default='1')
@click.option('--os', '-o', type=click.Choice(['142','129','130','140','141','137','135','117','124','139','138','60','127','78','122','134','118','120','87','126','133','86']), help='distribution id to create linode', metavar='<default=140>', default='140')
@click.option('--clone', '-c', type=int, help='create new linode from given linode id')
@click.option('--image', '-i', type=int, help='create new linode disk from given image id')
@click.option('--label', '-l', type=str, help='linode disk label')
@click.option('--rootpass', '-r', type=str, help='root password for linode')
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.pass_context
def create(ctx, datacenter, plan, os, clone, image, label, rootpass, token, proxy):
"""
create new linode
"""
if (not label and not rootpass):
return click.echo(ctx.get_help())
option_list = ['label', 'rootpass']
if validate(ctx.params, option_list):
method = 'GET'
params = {'DATACENTERID': datacenter, 'PLANID': plan}
url = LINODE_CREATE
msg = 'Creating Linode in datacenter %s with plan %s' %(DATACENTERS[datacenter], PLANS[plan])
click.echo(msg)
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
return click.echo('Error: %s' %(msg))
else:
linode_id = result['DATA']['LinodeID']
if image:
msg = 'Creating disk for linode %d from image %d' % (linode_id, image)
click.echo(msg)
size = SIZES[plan] - 512
params = {'LINODEID': linode_id, 'IMAGEID': image, 'LABEL': label, 'ROOTPASS': rootpass , 'SIZE': size}
url = LINODE_DISK_FROM_IMAGE
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
return click.echo('Error: %s' %(msg))
else:
main_disk_id = result['DATA']['DISKID']
main_job_id = result['DATA']['JOBID']
job_done = False
while not job_done:
url = JOB_LIST
params = {'LINODEID': linode_id, 'JOBID': main_job_id}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['DATA'][0]['HOST_SUCCESS']:
job_done = True
else:
time.sleep(3)
elif clone:
msg = 'Cloning linode from linode %d' % (clone)
click.echo(msg)
size = SIZES[plan] - 512
params = {'LINODEID': clone, 'DATECENTERID': datacenter, 'PLANID': plan, 'LABEL': label, 'ROOTPASS': rootpass,
'SIZE': size}
url = LINODE_CLONE
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
print 'Result =>',result
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
return click.echo('Error: %s' %(msg))
else:
main_job_id = result['DATA']['JOBID']
job_done = False
while not job_done:
url = JOB_LIST
params = {'LINODEID': linode_id, 'JOBID': main_job_id}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['DATA'][0]['HOST_SUCCESS']:
job_done = True
else:
time.sleep(3)
else:
msg = 'Creating disk for linode %d' % (linode_id)
click.echo(msg)
size = SIZES[plan] - 512
params = {'LINODEID': linode_id, 'FROMDISTRIBUTIONID': os, 'LABEL': label, 'ROOTPASS': rootpass, 'SIZE': size, 'TYPE': 'ext4'}
url = LINODE_DISK_CREATE
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
return click.echo('Error: %s' %(msg))
else:
main_disk_id = result['DATA']['DiskID']
main_job_id = result['DATA']['JobID']
job_done = False
while not job_done:
url = JOB_LIST
params = {'LINODEID': linode_id, 'JOBID': main_job_id}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['DATA'][0]['HOST_SUCCESS']:
job_done = True
else:
time.sleep(3)
msg = 'Creating swap disk for linode %d' %(linode_id)
click.echo(msg)
size = 256
swap_label ='swap'
params = {'LINODEID': linode_id, 'LABEL': swap_label, 'SIZE': size, 'TYPE': 'swap'}
url = LINODE_DISK_CREATE
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
return click.echo('Error: %s' %(msg))
else:
swap_disk_id = result['DATA']['DiskID']
swap_job_id = result['DATA']['JobID']
job_done = False
while not job_done:
url = JOB_LIST
params = {'LINODEID': linode_id, 'JOBID': swap_job_id}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['DATA'][0]['HOST_SUCCESS']:
job_done = True
else:
time.sleep(3)
msg = 'Creating config for linode %d' %(linode_id)
click.echo(msg)
config_label = 'label for ',linode_id
url = LINODE_CREATE_CONFIG
disk_list = '{0},{1}'.format(main_disk_id,swap_disk_id)
params = {'LINODEID': linode_id, 'KERNELID': 138, 'LABEL': config_label, 'DISKLIST': disk_list}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
return click.echo('Error: %s' %(msg))
else:
config_id = result['DATA']['ConfigID']
msg = 'Booting linode %d' %(linode_id)
click.echo(msg)
url = LINODE_BOOT
params = {'LINODEID': linode_id, 'CONFIGID': config_id}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
return click.echo('Error: %s' %(msg))
else:
boot_job_id = result['DATA']['JobID']
job_done = False
while not job_done:
url = JOB_LIST
params = {'LINODEID': linode_id, 'JOBID': boot_job_id}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['DATA'][0]['HOST_SUCCESS']:
job_done = True
else:
time.sleep(3)
url = LINODE_IP
params = {'LINODEID': linode_id}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
return click.echo('Error: %s' %(msg))
else:
suc_msg = 'Your linode %d created successfully' %(linode_id)
click.echo(suc_msg)
ip_msg = 'Ip Address of this linode is %s' %(result['DATA'][0]['IPADDRESS'])
click.echo(ip_msg)
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--tablefmt', '-f', type=click.Choice(['fancy_grid', 'simple', 'plain', 'grid', 'pipe', 'orgtbl', 'psql', 'rst', 'mediawiki', 'html', 'latex', 'latex_booktabs', 'tsv']), help='output table format', default='fancy_grid', metavar='<format>')
@click.pass_context
def os(ctx, token, proxy, tablefmt):
"""
list of linode distributions
"""
method = 'GET'
url = AVAIL_DISTRIBUTION
result = Linode.do_request(method, url, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
record = 'os'
headers = ['Distribution ID', 'Label']
table = []
for each in result['DATA']:
table.append([each['DISTRIBUTIONID'], each['LABEL']])
data = {'headers': headers, 'table_data': table}
print_table(tablefmt, data, record)
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--tablefmt', '-f', type=click.Choice(['fancy_grid', 'simple', 'plain', 'grid', 'pipe', 'orgtbl', 'psql', 'rst', 'mediawiki', 'html', 'latex', 'latex_booktabs', 'tsv']), help='output table format', default='fancy_grid', metavar='<format>')
@click.pass_context
def plan(ctx, token, proxy, tablefmt):
"""
list of linode plans
"""
method = 'GET'
url = AVAIL_PLANS
result = Linode.do_request(method, url, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
record = 'plan'
headers = ['Plan ID', 'Label', 'Ram', 'Cores', 'Disk', 'Price']
table = []
for each in result['DATA']:
table.append([each['PLANID'], each['LABEL'], each['RAM'], each['CORES'], each['DISK'], each['PRICE']])
data = {'headers': headers, 'table_data': table}
print_table(tablefmt, data, record)
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--tablefmt', '-f', type=click.Choice(['fancy_grid', 'simple', 'plain', 'grid', 'pipe', 'orgtbl', 'psql', 'rst', 'mediawiki', 'html', 'latex', 'latex_booktabs', 'tsv']), help='output table format', default='fancy_grid', metavar='<format>')
@click.pass_context
def datacenter(ctx, token, proxy, tablefmt):
"""
list of linode datacenters
"""
method = 'GET'
url = AVAIL_DATACENTER
result = Linode.do_request(method, url, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
record = 'datacenter'
headers = ['Data Center ID', 'Location']
table = []
for each in result['DATA']:
table.append([each['DATACENTERID'], each['LOCATION']])
data = {'headers': headers, 'table_data': table}
print_table(tablefmt, data, record)
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--tablefmt', '-f', type=click.Choice(['fancy_grid', 'simple', 'plain', 'grid', 'pipe', 'orgtbl', 'psql', 'rst', 'mediawiki', 'html', 'latex', 'latex_booktabs', 'tsv']), help='output table format', default='fancy_grid', metavar='<format>')
@click.pass_context
def image(ctx, token, proxy, tablefmt):
"""
list of linode user's images
"""
method = 'GET'
url = AVAIL_IMAGE
result = Linode.do_request(method, url, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
record = 'image'
headers = ['Image ID', 'Status', 'Label', 'FS Type']
table = []
for each in result['DATA']:
table.append([each['IMAGEID'], each['STATUS'], each['LABEL'], each['FS_TYPE']])
data = {'headers': headers, 'table_data': table}
print_table(tablefmt, data, record)
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--linode', '-l', type=str, help='delete linode', metavar='<linode id>')
@click.option('--tablefmt', '-f', type=click.Choice(['fancy_grid', 'simple', 'plain', 'grid', 'pipe', 'orgtbl', 'psql', 'rst', 'mediawiki', 'html', 'latex', 'latex_booktabs', 'tsv']), help='output table format', default='fancy_grid', metavar='<format>')
@click.pass_context
def delete(ctx, linode, token, proxy, tablefmt):
"""
delete linode
"""
if not linode:
return click.echo(ctx.get_help())
method = 'GET'
url = DELETE_LINODE
params = {'LINODEID': linode, 'SKIPCHECKS': True}
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
msg = "Linode {0} is deleted.".format(linode)
click.echo()
click.echo(msg)
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--tablefmt', '-f', type=click.Choice(['fancy_grid', 'simple', 'plain', 'grid', 'pipe', 'orgtbl', 'psql', 'rst', 'mediawiki', 'html', 'latex', 'latex_booktabs', 'tsv']), help='output table format', default='fancy_grid', metavar='<format>')
@click.pass_context
def list(ctx, token, proxy, tablefmt):
"""
List linodes
"""
method = 'GET'
url = LINODE_LIST
result = Linode.do_request(method, url, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
url = LINODE_IP
result_ip = Linode.do_request(method, url, token=token, proxy=proxy)
ip_dict = {}
if result_ip['ERRORARRAY']:
ip_available = False
else:
ip_available = True
for each in result_ip['DATA']:
ip_dict[each['LINODEID']] = each['IPADDRESS']
record = 'linode'
if ip_available:
headers = ['Id', 'Label', 'IP', 'Group', 'Plan', 'Datacenter']
table = []
for each in result['DATA']:
linode_id = each['LINODEID']
ip_address = ip_dict[linode_id]
table.append([linode_id, each['LABEL'], ip_address, each['LPM_DISPLAYGROUP'], each['PLANID'], each['DATACENTERID']])
else:
headers = ['Id', 'Label', 'Group', 'Plan', 'Datacenter']
table = []
for each in result['DATA']:
table.append([each['LINODEID'], each['LABEL'], each['LPM_DISPLAYGROUP'], each['PLANID'], each['DATACENTERID']])
data = {'headers': headers, 'table_data': table}
print_table(tablefmt, data, record)
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--group', '-g', type=str, help='new group', metavar='<linode group>')
@click.option('--label', '-L', type=str, help='new label', metavar='<linode label>')
@click.option('--linode', '-l', type=str, help='update linode', metavar='<linode id>')
@click.option('--tablefmt', '-f', type=click.Choice(['fancy_grid', 'simple', 'plain', 'grid', 'pipe', 'orgtbl', 'psql', 'rst', 'mediawiki', 'html', 'latex', 'latex_booktabs', 'tsv']), help='output table format', default='fancy_grid', metavar='<format>')
@click.pass_context
def update(ctx, linode, label, group, token, proxy, tablefmt):
"""
update linode
"""
if not linode:
return click.echo(ctx.get_help())
method = 'GET'
# We need config id for this
#url = LINODE_GET_CONFIG
# params = {'LINODEID': linode}
# result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
#if result['ERRORARRAY']:
# msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
# click.echo('Error: %s' %(msg))
# sys.exit(1)
#else:
# config_id = result['DATA'][0]['ConfigID']
url = LINODE_UPDATE
# print label, group
params = {'LINODEID': linode, 'Label': label, 'lpm_displayGroup': group}
# method = 'POST'
result = Linode.do_request(method, url, params=params, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
msg = "Linode {0} is updated.".format(linode)
click.echo()
click.echo(msg)
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--linode', '-l', type=str, help='linode info', metavar='<linode id>')
@click.pass_context
def info(ctx, linode, token, proxy):
""" Given a linode ID return its label,group,IP and other details """
method = 'GET'
url = LINODE_LIST
result = Linode.do_request(method, url, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
url = LINODE_IP
result_ip = Linode.do_request(method, url, token=token, proxy=proxy)
ip_address = ''
if result_ip['ERRORARRAY']:
ip_available = False
else:
ip_available = True
for each in result_ip['DATA']:
if str(each['LINODEID']) == linode:
ip_address = each['IPADDRESS']
break
for each in result['DATA']:
linode_id = str(each['LINODEID'])
if linode_id == linode:
print 'Label :',each['LABEL']
if ip_available:
print 'IP :',ip_address
print 'Group :',each['LPM_DISPLAYGROUP']
print 'Plan :',each['PLANID']
print 'Location :',each['DATACENTERID']
break
@linode_create_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--token', '-t', type=str, help='linode authentication token', metavar='<token>')
@click.option('--proxy', '-x', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.option('--skip', '-s', type=str, help='linode to skip', metavar='<skip linode>')
@click.option('--group', '-g', type=str, help='linode group name', metavar='<linode group>')
@click.pass_context
def find(ctx, group, skip, token, proxy):
""" Given a linode group name, print information for all linodes in that group """
method = 'GET'
url = LINODE_LIST
result = Linode.do_request(method, url, token=token, proxy=proxy)
if result['ERRORARRAY']:
msg = ' '.join([err['ERRORMESSAGE'] for err in result['ERRORARRAY'] ])
click.echo('Error: %s' %(msg))
else:
url = LINODE_IP
result_ip = Linode.do_request(method, url, token=token, proxy=proxy)
ip_dict = {}
if result_ip['ERRORARRAY']:
ip_available = False
else:
ip_available = True
for each in result_ip['DATA']:
ip_dict[each['LINODEID']] = each['IPADDRESS']
linode_skip = skip
template = "%s,%s,%s,%s,%s"
for each in result['DATA']:
lgroup = str(each['LPM_DISPLAYGROUP'])
label = each['LABEL']
if linode_skip != None and (label.lower() == linode_skip.lower()):
continue
if lgroup.lower() == group.lower():
linode_id = each['LINODEID']
crtd_dt = each['CREATE_DT']
tstamp = time.mktime(time.strptime(crtd_dt, "%Y-%m-%d %H:%M:%S.%f"))
print template % (ip_dict.get(linode_id), each['DATACENTERID'], each['LINODEID'], tstamp, tstamp)
| 45.439604 | 258 | 0.583562 | 2,776 | 22,947 | 4.722983 | 0.100865 | 0.034399 | 0.029746 | 0.041644 | 0.723743 | 0.711387 | 0.692243 | 0.659599 | 0.650751 | 0.627946 | 0 | 0.013042 | 0.241513 | 22,947 | 504 | 259 | 45.529762 | 0.740247 | 0.018042 | 0 | 0.670823 | 0 | 0 | 0.23734 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.044888 | 0.009975 | null | null | 0.032419 | 0 | 0 | 0 | null | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
208d1bd83c400c9a9a785bff3d325c1255ce46eb | 236 | py | Python | app/questions/admin.py | angelprg/django-questions | 02c8a358499aecfc8a627aeb2168a6e8d8280139 | [
"MIT"
] | null | null | null | app/questions/admin.py | angelprg/django-questions | 02c8a358499aecfc8a627aeb2168a6e8d8280139 | [
"MIT"
] | null | null | null | app/questions/admin.py | angelprg/django-questions | 02c8a358499aecfc8a627aeb2168a6e8d8280139 | [
"MIT"
] | null | null | null | from django.contrib import admin
from questions.models import Question, QuestionCategory
@admin.register(Question)
class QuestionAdmin(admin.ModelAdmin):
readonly_fields = ('created_at', )
admin.site.register(QuestionCategory)
| 19.666667 | 55 | 0.800847 | 26 | 236 | 7.192308 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110169 | 236 | 11 | 56 | 21.454545 | 0.890476 | 0 | 0 | 0 | 0 | 0 | 0.042373 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
20d174a7def589b1a12f4c80e3314e39900594e8 | 21 | py | Python | src/__init__.py | makarchuk/django_lucy | ea9eed4e7a1d4572b85c879f5bf43028f999dac7 | [
"MIT"
] | null | null | null | src/__init__.py | makarchuk/django_lucy | ea9eed4e7a1d4572b85c879f5bf43028f999dac7 | [
"MIT"
] | null | null | null | src/__init__.py | makarchuk/django_lucy | ea9eed4e7a1d4572b85c879f5bf43028f999dac7 | [
"MIT"
] | null | null | null | name = "django_lucy"
| 10.5 | 20 | 0.714286 | 3 | 21 | 4.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 21 | 1 | 21 | 21 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0.52381 | 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 |
4550921393ed8ac742abe6fc714bc72a7a1e2c1b | 63 | py | Python | WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/mini-scripts/python_Check_String.txt.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | 5 | 2021-06-02T23:44:25.000Z | 2021-12-27T16:21:57.000Z | WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/mini-scripts/python_Check_String.txt.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | 22 | 2021-05-31T01:33:25.000Z | 2021-10-18T18:32:39.000Z | WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/mini-scripts/python_Check_String.txt.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | 3 | 2021-06-19T03:37:47.000Z | 2021-08-31T00:49:51.000Z | txt = "The best things in life are free!"
print("free" in txt)
| 21 | 41 | 0.68254 | 12 | 63 | 3.583333 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 63 | 2 | 42 | 31.5 | 0.843137 | 0 | 0 | 0 | 0 | 0 | 0.587302 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
45532f89100e7c58f11aef05cd196b6a81f818c5 | 1,319 | py | Python | modules/auxiliary.py | hatlesshacker/KMeansExample | 4e0fe9041d72d8550cfccaf49277b1709b50798e | [
"BSD-2-Clause"
] | 1 | 2021-09-07T18:20:03.000Z | 2021-09-07T18:20:03.000Z | modules/auxiliary.py | warmachine028/KMeansExample | 4e0fe9041d72d8550cfccaf49277b1709b50798e | [
"BSD-2-Clause"
] | 2 | 2021-07-06T13:20:11.000Z | 2021-09-07T14:56:12.000Z | modules/auxiliary.py | warmachine028/KMeansExample | 4e0fe9041d72d8550cfccaf49277b1709b50798e | [
"BSD-2-Clause"
] | 1 | 2021-07-03T03:53:31.000Z | 2021-07-03T03:53:31.000Z | """ File for storing helper Classes and Functions"""
from random import randint
from typing import Union
# Class to initialize Cluster
class Cluster:
def __init__(self, n: int) -> None:
self.title: str = f"Cluster {n}"
self.points: tuple['Point', ...] = ()
self.epi_x: Union[int, float] = randint(1, 10)
self.epi_y: Union[int, float] = randint(1, 10)
@property
def epicenter(self) -> tuple[Union[int, float], ...]:
return self.epi_x, self.epi_y
def __repr__(self):
return f'({self.epi_x:.2f}, {self.epi_y:.2f})'
# Class to initialize Point
class Point:
def __init__(self, x: int, y: int, cluster: Union[str, Cluster] = 'u'):
self.x = x
self.y = y
self.cluster = cluster
@property
def coordinates(self) -> tuple[int, ...]:
return self.x, self.y
def __repr__(self):
return f'({self.x:.2f}, {self.y:.2f})'
# Class for Global Boolean Vars
class BooleanVar:
def __init__(self, value: bool = False) -> None:
"""Initializing a Boolean Variable"""
self.value = value
def set(self, value: bool) -> None:
"""Set the variable to VALUE"""
self.value = value
def get(self) -> bool:
"""Retrieve VALUE from the variable"""
return self.value
| 25.862745 | 75 | 0.592115 | 179 | 1,319 | 4.217877 | 0.312849 | 0.055629 | 0.043709 | 0.05298 | 0.121854 | 0.121854 | 0.060927 | 0 | 0 | 0 | 0 | 0.010299 | 0.263836 | 1,319 | 50 | 76 | 26.38 | 0.76725 | 0.167551 | 0 | 0.2 | 0 | 0 | 0.075419 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.066667 | 0.133333 | 0.633333 | 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 |
4563062782d2d036ef70d95e395cb8fc60c839d1 | 97 | py | Python | Project_Code/webjax/Code/src/memberships/apps.py | shimon0505004/SU19CSE299S02G09NSU | c1b680d2981ae0f41a01c56557aab8dd182855c4 | [
"MIT"
] | 119 | 2018-08-24T13:02:14.000Z | 2021-11-22T09:51:38.000Z | Project_Code/webjax/Code/src/memberships/apps.py | shimon0505004/SU19CSE299S02G09NSU | c1b680d2981ae0f41a01c56557aab8dd182855c4 | [
"MIT"
] | 13 | 2019-12-05T01:01:12.000Z | 2022-03-12T00:06:33.000Z | Project_Code/webjax/Code/src/memberships/apps.py | shimon0505004/SU19CSE299S02G09NSU | c1b680d2981ae0f41a01c56557aab8dd182855c4 | [
"MIT"
] | 102 | 2018-08-09T17:57:53.000Z | 2022-03-14T19:49:24.000Z | from django.apps import AppConfig
class MembershipsConfig(AppConfig):
name = 'memberships'
| 16.166667 | 35 | 0.773196 | 10 | 97 | 7.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154639 | 97 | 5 | 36 | 19.4 | 0.914634 | 0 | 0 | 0 | 0 | 0 | 0.113402 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
45e456c3f5e2662579a6c14386dba4f4fd0b289f | 17,076 | py | Python | generative_lightning/models/generators.py | AahanSingh/Lightning-Gans | dba9e216a866d48d85585db1497af331fec60cac | [
"MIT"
] | null | null | null | generative_lightning/models/generators.py | AahanSingh/Lightning-Gans | dba9e216a866d48d85585db1497af331fec60cac | [
"MIT"
] | null | null | null | generative_lightning/models/generators.py | AahanSingh/Lightning-Gans | dba9e216a866d48d85585db1497af331fec60cac | [
"MIT"
] | null | null | null | """Contains model code for the CycleGAN
"""
import math
import torch
from torch import nn
import torch.utils.data
from .utils import downsample, upsample
from .resnet import WideResnetEncoder, WideResnetDecoder, conv_downsample, conv_upsample, ResidualLayer
class UNETGenerator(nn.Module):
def __init__(self, **kwargs):
super().__init__()
self.down_stack = nn.ModuleList([
downsample(in_channels=3, out_channels=64, kernel_size=2, apply_instancenorm=False),
downsample(in_channels=64, out_channels=128, kernel_size=2),
downsample(in_channels=128, out_channels=256, kernel_size=2),
downsample(in_channels=256, out_channels=512, kernel_size=2),
downsample(in_channels=512, out_channels=512, kernel_size=2),
downsample(in_channels=512, out_channels=512, kernel_size=2),
downsample(in_channels=512, out_channels=512, kernel_size=2),
downsample(in_channels=512, out_channels=512, kernel_size=2, apply_instancenorm=False),
])
self.up_stack = nn.ModuleList([
upsample(in_channels=512, out_channels=512, kernel_size=2, apply_dropout=True),
upsample(in_channels=1024, out_channels=512, kernel_size=2, apply_dropout=True),
upsample(in_channels=1024, out_channels=512, kernel_size=2, apply_dropout=True),
upsample(in_channels=1024, out_channels=512, kernel_size=2),
upsample(in_channels=1024, out_channels=256, kernel_size=2),
upsample(in_channels=512, out_channels=128, kernel_size=2),
upsample(in_channels=256, out_channels=64, kernel_size=2)
])
self.last = nn.Sequential(
nn.ConvTranspose2d(in_channels=128, out_channels=3, kernel_size=2, stride=2), nn.Tanh())
def forward(self, input):
# Downsampling through the model
x = input
skips = []
for down in self.down_stack:
x = down(x)
skips.append(x)
skips = reversed(skips[:-1])
# Upsampling and establishing the skip connections
for up, skip in zip(self.up_stack, skips):
x = up(x)
x = torch.cat((x, skip), dim=1)
x = self.last(x)
return x
class CustomUNET(nn.Module):
def __init__(self, **kwargs):
super().__init__()
self.down_stack = nn.ModuleList([
conv_downsample(ks=5, st=2, in_c=3, out_c=64, activation="leaky_relu", norm=None),
conv_downsample(ks=5,
st=2,
in_c=64,
out_c=128,
activation="leaky_relu",
norm="instance"),
conv_downsample(ks=5,
st=2,
in_c=128,
out_c=256,
activation="leaky_relu",
norm="instance"),
conv_downsample(ks=5,
st=2,
in_c=256,
out_c=512,
activation="leaky_relu",
norm="instance"),
conv_downsample(ks=5,
st=2,
in_c=512,
out_c=512,
activation="leaky_relu",
norm="instance"),
conv_downsample(ks=5,
st=2,
in_c=512,
out_c=512,
activation="leaky_relu",
norm="instance"),
conv_downsample(ks=5,
st=2,
in_c=512,
out_c=512,
activation="leaky_relu",
norm="instance"),
conv_downsample(ks=3, st=2, in_c=512, out_c=512, activation="leaky_relu", norm=None),
])
self.up_stack = nn.ModuleList([
conv_upsample(ks=3,
st=2,
in_c=512,
out_c=512,
activation="leaky_relu",
dropout=True,
norm="instance"),
conv_upsample(ks=5,
st=2,
in_c=1024,
out_c=512,
activation="leaky_relu",
dropout=True,
norm="instance"),
conv_upsample(ks=5,
st=2,
in_c=1024,
out_c=512,
activation="leaky_relu",
dropout=True,
norm="instance"),
conv_upsample(ks=5,
st=2,
in_c=1024,
out_c=512,
activation="leaky_relu",
norm="instance"),
conv_upsample(ks=5,
st=2,
in_c=1024,
out_c=256,
activation="leaky_relu",
norm="instance"),
conv_upsample(ks=5, st=2, in_c=512, out_c=128, activation="leaky_relu",
norm="instance"),
conv_upsample(ks=5, st=2, in_c=256, out_c=64, activation="leaky_relu", norm="instance"),
])
self.last = conv_upsample(ks=5, st=2, in_c=128, out_c=3, activation="tanh", norm=None)
def forward(self, input):
# Downsampling through the model
x = input
skips = []
for down in self.down_stack:
x = down(x)
skips.append(x)
skips = reversed(skips[:-1])
# Upsampling and establishing the skip connections
for up, skip in zip(self.up_stack, skips):
x = up(x)
x = torch.cat((x, skip), dim=1)
x = self.last(x)
return x
class WideResnetEncoderDecoder(torch.nn.Module):
def __init__(self, l=4, k=4, input_channels=3, image_size=256):
super().__init__()
downsample_channels = int(input_channels * 2**(math.log2(image_size) - 1))
self.encoder = WideResnetEncoder(l=l,
k=k,
input_channels=input_channels,
image_size=image_size)
self.decoder = WideResnetDecoder(l=l,
k=k,
input_channels=downsample_channels,
image_size=image_size)
def forward(self, x):
x = self.encoder(x)
x = self.decoder(x)
return x
class WideResnetUNET(torch.nn.Module):
def __init__(self, l=2, k=1, input_channels=3, image_size=256):
super().__init__()
self.first_conv = conv_downsample(ks=3,
st=1,
in_c=input_channels,
out_c=64,
activation="leaky_relu",
norm="batch")
self.encoder = self.get_encoder()
self.first_upsample = conv_upsample(ks=3,
st=2,
in_c=256,
out_c=256,
activation="leaky_relu",
norm="batch")
self.decoder = self.get_decoder()
#self.final_conv = conv_downsample(ks=3,
# st=1,
# in_c=32,
# out_c=3,
# activation="tanh",
# norm=None)
"""
self.num_encoder_decoder_layers = int(math.log2(image_size))
self.res_depth = l
self.res_width_factor = k
self.input_channels = input_channels
self.downsample_filters = []
self.encoder = self.get_encoder()
self.decoder = self.get_decoder()
self.last_conv = conv_upsample(ks=3,
st=2,
in_c=self.downsample_filters[-1] * 2,
out_c=self.input_channels,
activation="tanh",
norm=None)
"""
def _get_res_downsample(self, l, k, in_channels, out_channels, kernel_size, activation, norm):
return torch.nn.Sequential(
ResidualLayer(l=l,
k=k,
in_channels=in_channels,
kernel_size=kernel_size,
activation=activation,
norm=norm),
conv_downsample(ks=kernel_size,
st=2,
in_c=in_channels,
out_c=out_channels,
activation=activation,
norm=norm))
def _get_res_upsample(self, l, k, in_channels, out_channels, kernel_size, activation, norm):
return torch.nn.Sequential(
ResidualLayer(l=l,
k=k,
in_channels=in_channels,
kernel_size=kernel_size,
activation=activation,
norm=norm),
conv_upsample(ks=kernel_size,
st=2,
in_c=in_channels,
out_c=out_channels,
activation=activation,
norm=norm))
def get_encoder(self):
return torch.nn.ModuleList([
# 64,256,256
self._get_res_downsample(l=2,
k=1,
in_channels=64,
out_channels=128,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 128,128,128
self._get_res_downsample(l=2,
k=1,
in_channels=128,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,64,64
self._get_res_downsample(l=2,
k=1,
in_channels=256,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,32,32
self._get_res_downsample(l=2,
k=1,
in_channels=256,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,16,16
self._get_res_downsample(l=2,
k=1,
in_channels=256,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,8,8
self._get_res_downsample(l=2,
k=1,
in_channels=256,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,4,4
self._get_res_downsample(l=2,
k=1,
in_channels=256,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch")
])
"""
layers = []
in_ch = self.input_channels
f = 2
for _ in range(self.num_encoder_decoder_layers - 1):
layer = ResidualLayer(l=self.res_depth,
k=self.res_width_factor,
in_channels=in_ch,
res_channels=f,
kernel_size=3)
f *= 2
downsample = conv_downsample(ks=3, st=2, in_c=in_ch, out_c=f, activation="leaky_relu")
layers.append(torch.nn.Sequential(layer, downsample))
in_ch = f
self.downsample_filters.append(f)
self.downsample_filters = list(reversed(self.downsample_filters))
return torch.nn.ModuleList(layers)
"""
def get_decoder(self):
"""
layers = []
for i in range(1, len(self.downsample_filters)):
in_ch = self.downsample_filters[i - 1]
if i != 1:
in_ch *= 2
layer = ResidualLayer(l=self.res_depth,
k=self.res_width_factor,
in_channels=in_ch,
res_channels=self.downsample_filters[i - 1],
kernel_size=3)
upsampling = conv_upsample(ks=3,
st=2,
in_c=in_ch,
out_c=self.downsample_filters[i],
activation="relu")
layers.append(torch.nn.Sequential(layer, upsampling))
return torch.nn.ModuleList(layers)
"""
return torch.nn.ModuleList([
# 256,4,4 + 256,4,4
self._get_res_upsample(l=2,
k=1,
in_channels=512,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,8,8 + 256,8,8
self._get_res_upsample(l=2,
k=1,
in_channels=512,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,16,16 + 256,16,16
self._get_res_upsample(l=2,
k=1,
in_channels=512,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,32,32 + 256,32,32
self._get_res_upsample(l=2,
k=1,
in_channels=512,
out_channels=256,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 256,64,64 + 256,64,64
self._get_res_upsample(l=2,
k=1,
in_channels=512,
out_channels=128,
kernel_size=3,
activation="leaky_relu",
norm="batch"),
# 128,128,128 + 128,128,128
conv_upsample(ks=3, st=2, in_c=256, out_c=3, activation="tanh", norm=None),
# 3,256,256
])
def forward(self, x):
x = self.first_conv(x)
d_feats = []
for l in self.encoder:
x = l(x)
d_feats.append(x)
d_feats.reverse()
d_feats.pop(0)
x = self.first_upsample(x)
for i, l in enumerate(self.decoder):
print(x.shape, d_feats[i].shape)
x = torch.cat((x, d_feats[i]), 1)
x = l(x)
return x | 42.372208 | 103 | 0.403783 | 1,571 | 17,076 | 4.149586 | 0.078294 | 0.058291 | 0.087437 | 0.091732 | 0.793833 | 0.742292 | 0.676331 | 0.629084 | 0.582758 | 0.565884 | 0 | 0.065116 | 0.511654 | 17,076 | 403 | 104 | 42.372208 | 0.716633 | 0.080698 | 0 | 0.781457 | 0 | 0 | 0.033504 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.039735 | false | 0 | 0.019868 | 0.006623 | 0.099338 | 0.003311 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
afd82c260c47778ad42ab239d529d62e9140d244 | 3,005 | py | Python | ott/tools/gaussian_mixture/probabilities.py | theouscidda6/ott | 53a06973e417f579fc79795403f81ee829dbd575 | [
"Apache-2.0"
] | 110 | 2021-12-28T17:18:08.000Z | 2022-03-31T00:20:57.000Z | ott/tools/gaussian_mixture/probabilities.py | theouscidda6/ott | 53a06973e417f579fc79795403f81ee829dbd575 | [
"Apache-2.0"
] | 14 | 2022-01-31T14:04:47.000Z | 2022-03-24T17:20:35.000Z | ott/tools/gaussian_mixture/probabilities.py | theouscidda6/ott | 53a06973e417f579fc79795403f81ee829dbd575 | [
"Apache-2.0"
] | 17 | 2022-01-31T11:59:26.000Z | 2022-03-31T11:28:44.000Z | # coding=utf-8
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Pytree for a vector of probabilities."""
from typing import Optional
import jax
import jax.numpy as jnp
@jax.tree_util.register_pytree_node_class
class Probabilities:
"""Parameterized array of probabilities of length n.
The internal representation is a length n-1 unconstrained array. We convert
to a length n simplex by appending a 0 and taking a softmax.
"""
_params: jnp.ndarray
def __init__(self, params):
self._params = params
@classmethod
def from_random(
cls,
key: jnp.ndarray,
n_dimensions: int,
stdev: Optional[float] = 0.1,
dtype: Optional[jnp.dtype] = None) -> 'Probabilities':
"""Construct a random Probabilities."""
return cls(params=jax.random.normal(
key=key, shape=(n_dimensions - 1,), dtype=dtype) * stdev)
@classmethod
def from_probs(
cls,
probs: jnp.ndarray) -> 'Probabilities':
"""Construct Probabilities from a vector of probabilities."""
log_probs = jnp.log(probs)
log_probs_normalized, norm = log_probs[:-1], log_probs[-1]
log_probs_normalized -= norm
return cls(params=log_probs_normalized)
@property
def params(self):
return self._params
@property
def dtype(self):
return self._params.dtype
def unnormalized_log_probs(self) -> jnp.ndarray:
return jnp.concatenate(
[self._params, jnp.zeros((1,), dtype=self.dtype)], axis=-1)
def log_probs(self) -> jnp.ndarray:
return jax.nn.log_softmax(self.unnormalized_log_probs())
def probs(self) -> jnp.ndarray:
return jax.nn.softmax(self.unnormalized_log_probs())
def sample(self, key: jnp.ndarray, size: int) -> jnp.ndarray:
return jax.random.categorical(
key=key, logits=self.unnormalized_log_probs(), shape=(size,))
def tree_flatten(self):
children = (self.params,)
aux_data = {}
return children, aux_data
@classmethod
def tree_unflatten(cls, aux_data, children):
return cls(*children, **aux_data)
def __repr__(self):
class_name = type(self).__name__
children, aux = self.tree_flatten()
return '{}({})'.format(
class_name, ', '.join([repr(c) for c in children] +
[f'{k}: {repr(v)}' for k, v in aux.items()]))
def __hash__(self):
return jax.tree_util.tree_flatten(self).__hash__()
def __eq__(self, other):
return jax.tree_util.tree_flatten(self) == jax.tree_util.tree_flatten(other)
| 30.05 | 80 | 0.691514 | 417 | 3,005 | 4.81295 | 0.35012 | 0.047833 | 0.021923 | 0.028401 | 0.135027 | 0.111111 | 0.061784 | 0 | 0 | 0 | 0 | 0.007435 | 0.194343 | 3,005 | 99 | 81 | 30.353535 | 0.821561 | 0.29218 | 0 | 0.12069 | 0 | 0 | 0.023011 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.241379 | false | 0 | 0.051724 | 0.155172 | 0.551724 | 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 |
aff4ed8b68232e6d479c5b639bd4ca5f8942f1f0 | 183 | py | Python | users/forms.py | nicoliendro10/pokegram | 1f2c52ef1f916826683465a7cc420fbc9ec10121 | [
"MIT"
] | null | null | null | users/forms.py | nicoliendro10/pokegram | 1f2c52ef1f916826683465a7cc420fbc9ec10121 | [
"MIT"
] | null | null | null | users/forms.py | nicoliendro10/pokegram | 1f2c52ef1f916826683465a7cc420fbc9ec10121 | [
"MIT"
] | null | null | null | from django import forms
class ProfileForm(forms.Form):
website = forms.URLField(max_length=200)
biography = forms.CharField(max_length=500)
picture = forms.ImageField() | 26.142857 | 47 | 0.748634 | 23 | 183 | 5.869565 | 0.73913 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03871 | 0.153005 | 183 | 7 | 48 | 26.142857 | 0.832258 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 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 |
b30df5bc0c8887c9ddd22e225af7ac9519cfea7a | 633 | py | Python | test/integration/test_extra_deps.py | jmgao/bfg9000 | 7ffb15aed8ea88ee454821e83aa8c42014ac8e34 | [
"BSD-3-Clause"
] | null | null | null | test/integration/test_extra_deps.py | jmgao/bfg9000 | 7ffb15aed8ea88ee454821e83aa8c42014ac8e34 | [
"BSD-3-Clause"
] | null | null | null | test/integration/test_extra_deps.py | jmgao/bfg9000 | 7ffb15aed8ea88ee454821e83aa8c42014ac8e34 | [
"BSD-3-Clause"
] | null | null | null | from . import *
class TestExtraDeps(IntegrationTest):
def __init__(self, *args, **kwargs):
IntegrationTest.__init__(self, 'extra_deps', *args, **kwargs)
def test_build(self):
self.build(executable('program'))
self.assertOutput([executable('program')], 'hello, world!\n')
self.assertExists(output_file('1'))
self.assertExists(output_file('2'))
self.assertExists(output_file('3'))
def test_touch_3(self):
self.build('touch3')
self.assertNotExists(output_file('1'))
self.assertExists(output_file('2'))
self.assertExists(output_file('3'))
| 28.772727 | 69 | 0.64297 | 70 | 633 | 5.557143 | 0.414286 | 0.154242 | 0.282776 | 0.33419 | 0.33419 | 0.33419 | 0.33419 | 0.33419 | 0.33419 | 0.33419 | 0 | 0.01581 | 0.200632 | 633 | 21 | 70 | 30.142857 | 0.752964 | 0 | 0 | 0.266667 | 0 | 0 | 0.080569 | 0 | 0 | 0 | 0 | 0 | 0.466667 | 1 | 0.2 | false | 0 | 0.066667 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b3173d6ea836e8a1dbfab814d422bcf56aca6c92 | 418 | py | Python | plugin.py | Myselfminer/N | 072a589301d8d8e4395e75c9ea720d6074eff6b6 | [
"Apache-2.0"
] | 2 | 2015-10-18T07:40:46.000Z | 2015-10-25T16:03:18.000Z | plugin.py | Myselfminer/N | 072a589301d8d8e4395e75c9ea720d6074eff6b6 | [
"Apache-2.0"
] | 1 | 2015-10-18T11:38:04.000Z | 2015-10-18T11:38:04.000Z | plugin.py | Myselfminer/N | 072a589301d8d8e4395e75c9ea720d6074eff6b6 | [
"Apache-2.0"
] | null | null | null | import hook
import os
import config
plugin_path=config.get(install_path)+"plugins\\"
def init():
path=os.listdir(plugin_path)
a=open(config.get(install_path)+"reg\\N_NOW_RUNNING\\PLUGINS\\INITTEMP\\plugininit.py")
a.write("def init():")
for i in path:
a.write(" import "+i+"\n "+i+".init()")
import plugininit
plugininit.init()
def register_value_command(plugin_id, command, #todo!
| 29.857143 | 91 | 0.684211 | 61 | 418 | 4.540984 | 0.491803 | 0.072202 | 0.115523 | 0.144404 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15311 | 418 | 13 | 92 | 32.153846 | 0.782486 | 0 | 0 | 0 | 0 | 0 | 0.228155 | 0.126214 | 0 | 0 | 0 | 0.076923 | 0 | 0 | null | null | 0 | 0.384615 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b31c8cc49eba581358aaf691d50fc0dd85f2fd96 | 26 | py | Python | tinys3/tests/__init__.py | Scylardor/tinys3 | 60f130dfb522a915b19e9b03986cc97b9179a0f9 | [
"MIT"
] | 186 | 2015-01-06T00:38:48.000Z | 2022-03-10T02:05:56.000Z | tinys3/tests/__init__.py | Scylardor/tinys3 | 60f130dfb522a915b19e9b03986cc97b9179a0f9 | [
"MIT"
] | 25 | 2015-01-06T00:43:42.000Z | 2019-07-11T10:03:28.000Z | tinys3/tests/__init__.py | Scylardor/tinys3 | 60f130dfb522a915b19e9b03986cc97b9179a0f9 | [
"MIT"
] | 55 | 2015-01-12T07:16:47.000Z | 2021-05-07T22:52:47.000Z | __author__ = 'shlomiatar'
| 13 | 25 | 0.769231 | 2 | 26 | 8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115385 | 26 | 1 | 26 | 26 | 0.695652 | 0 | 0 | 0 | 0 | 0 | 0.384615 | 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 |
b329431917b93f8a48d39b93f9d385786a2c31a8 | 440 | py | Python | tests/test_sum.py | H1bro/library | 0a444ba2be117a92dd3b881ff46bc7b38d0d8d71 | [
"BSD-2-Clause"
] | null | null | null | tests/test_sum.py | H1bro/library | 0a444ba2be117a92dd3b881ff46bc7b38d0d8d71 | [
"BSD-2-Clause"
] | 1 | 2019-12-22T23:38:29.000Z | 2019-12-22T23:38:29.000Z | tests/test_sum.py | H1bro/library | 0a444ba2be117a92dd3b881ff46bc7b38d0d8d71 | [
"BSD-2-Clause"
] | null | null | null | from http import HTTPStatus
from pytest import fixture
from app.models.library import Book, Litterateur
def test_get_books(client):
response = client.get('/books')
assert response.status_code == HTTPStatus.OK, 'check failed'
# assert response.json == {'message': 'Healthy'}, 'Improper response'
#
def test_get_book(client):
response = client.get('/book/1')
assert response.status_code == HTTPStatus.OK, 'check failed'
| 31.428571 | 73 | 0.729545 | 57 | 440 | 5.526316 | 0.491228 | 0.133333 | 0.063492 | 0.146032 | 0.298413 | 0.298413 | 0.298413 | 0.298413 | 0 | 0 | 0 | 0.002674 | 0.15 | 440 | 13 | 74 | 33.846154 | 0.839572 | 0.152273 | 0 | 0.222222 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b33253f872a2639913a73e61cc01fe56115874a8 | 59 | py | Python | 8 More about functions/more_about_functions.py | narayanants/python-mega-course | 2ba2980ab21dfbed5f86f00695559f7831b5c566 | [
"MIT"
] | null | null | null | 8 More about functions/more_about_functions.py | narayanants/python-mega-course | 2ba2980ab21dfbed5f86f00695559f7831b5c566 | [
"MIT"
] | null | null | null | 8 More about functions/more_about_functions.py | narayanants/python-mega-course | 2ba2980ab21dfbed5f86f00695559f7831b5c566 | [
"MIT"
] | null | null | null | def foo(x,y=10):
z = x * y
return z
print(foo(10)) | 11.8 | 16 | 0.508475 | 13 | 59 | 2.307692 | 0.615385 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097561 | 0.305085 | 59 | 5 | 17 | 11.8 | 0.634146 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b3407fa7adf49359074498e50f861a85274081f5 | 1,596 | py | Python | tests/test_highstock.py | Jbrunn/python-highcharts | a4c488ae5c2e125616efad5a722f3dfd8a9bc450 | [
"MIT"
] | 370 | 2015-10-07T20:13:10.000Z | 2022-03-31T03:43:17.000Z | tests/test_highstock.py | Jbrunn/python-highcharts | a4c488ae5c2e125616efad5a722f3dfd8a9bc450 | [
"MIT"
] | 67 | 2016-03-14T12:18:44.000Z | 2022-02-24T09:24:31.000Z | tests/test_highstock.py | Jbrunn/python-highcharts | a4c488ae5c2e125616efad5a722f3dfd8a9bc450 | [
"MIT"
] | 159 | 2016-02-25T15:07:52.000Z | 2022-03-12T13:04:14.000Z | import unittest
import os
import sys
if sys.version_info >= (3, 0):
def execfile(filepath):
with open(filepath) as f:
code = compile(f.read(), filepath, 'exec')
exec(code)
class TestHighstock(unittest.TestCase):
"""Very simple test cases that run through examples and check for exceptions."""
PATH_ROOT = "examples/highstock"
def test_arearange(self):
execfile(os.path.join(self.PATH_ROOT, 'arearange.py'))
def test_basic_line_2(self):
execfile(os.path.join(self.PATH_ROOT, 'basic-line-2.py'))
def test_candlestick_and_volume(self):
execfile(os.path.join(self.PATH_ROOT, 'candlestick-and-volume.py'))
def test_compare(self):
execfile(os.path.join(self.PATH_ROOT, 'compare.py'))
def test_data_grouping(self):
execfile(os.path.join(self.PATH_ROOT, 'data-grouping.py'))
def test_Example1_basic_line(self):
execfile(os.path.join(self.PATH_ROOT, 'Example1-basic-line.py'))
def test_flags_general(self):
execfile(os.path.join(self.PATH_ROOT, 'flags-general.py'))
def test_flags_general_2(self):
execfile(os.path.join(self.PATH_ROOT, 'flags-general-2.py'))
def test_intraday_area(self):
execfile(os.path.join(self.PATH_ROOT, 'intraday-area.py'))
def test_lazy_loading(self):
execfile(os.path.join(self.PATH_ROOT, 'lazy-loading.py'))
def test_ohlc(self):
execfile(os.path.join(self.PATH_ROOT, 'ohlc.py'))
def test_yaxis_plotbands(self):
execfile(os.path.join(self.PATH_ROOT, 'yaxis-plotbands.py')) | 31.92 | 84 | 0.677318 | 230 | 1,596 | 4.530435 | 0.26087 | 0.099808 | 0.161228 | 0.207294 | 0.456814 | 0.416507 | 0.416507 | 0.416507 | 0.122841 | 0.088292 | 0 | 0.006144 | 0.184211 | 1,596 | 50 | 85 | 31.92 | 0.794163 | 0.046366 | 0 | 0 | 0 | 0 | 0.13975 | 0.030982 | 0 | 0 | 0 | 0 | 0 | 1 | 0.382353 | false | 0 | 0.088235 | 0 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b34dcbbb4576649a2338625ade54b3e3ebaa2d9f | 203 | py | Python | ubt-angular/datetimeEx.py | maurosc3ner/ubt_angular | d4aa52fe9ec03d40720e94e75431394f07a30ec1 | [
"MIT"
] | null | null | null | ubt-angular/datetimeEx.py | maurosc3ner/ubt_angular | d4aa52fe9ec03d40720e94e75431394f07a30ec1 | [
"MIT"
] | 5 | 2021-03-08T19:56:25.000Z | 2022-03-02T02:51:08.000Z | ubt-angular/datetimeEx.py | maurosc3ner/ubt_angular | d4aa52fe9ec03d40720e94e75431394f07a30ec1 | [
"MIT"
] | null | null | null | import datetime
now = datetime.datetime(2003, 8, 4, 12, 30, 45)
print now
print repr(now)
print type(now)
print now.year, now.month, now.day
print now.hour, now.minute, now.second
print now.microsecond | 20.3 | 47 | 0.748768 | 36 | 203 | 4.222222 | 0.527778 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 0.133005 | 203 | 10 | 48 | 20.3 | 0.795455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.125 | null | null | 0.75 | 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 |
b3507c643c0a7dd48bc619eecf81c7e1da80b334 | 144 | py | Python | thumbnailer-ecs-caching/thumbnailer/thumbnailer/urls.py | memcachier/django-docker-ecs-tutorial | b911d4dcaac7a4b8cd11e8f19e4b574b4edad9cc | [
"BSD-3-Clause"
] | 1 | 2019-06-13T14:48:25.000Z | 2019-06-13T14:48:25.000Z | thumbnailer-basic/thumbnailer/thumbnailer/urls.py | memcachier/django-docker-ecs-tutorial | b911d4dcaac7a4b8cd11e8f19e4b574b4edad9cc | [
"BSD-3-Clause"
] | null | null | null | thumbnailer-basic/thumbnailer/thumbnailer/urls.py | memcachier/django-docker-ecs-tutorial | b911d4dcaac7a4b8cd11e8f19e4b574b4edad9cc | [
"BSD-3-Clause"
] | 1 | 2019-10-19T18:39:17.000Z | 2019-10-19T18:39:17.000Z | from django.conf.urls import url
from main.views import ThumbnailView
urlpatterns = [
url(r'^$', ThumbnailView.as_view(), name='index')
]
| 18 | 53 | 0.715278 | 19 | 144 | 5.368421 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145833 | 144 | 7 | 54 | 20.571429 | 0.829268 | 0 | 0 | 0 | 0 | 0 | 0.048611 | 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 |
2fa37316b32845014d34300cfc85f2396b7f1f70 | 397 | py | Python | projects/shadow/kmap-builder-jython27/filters/__init__.py | zaqwes8811/smart-vocabulary-cards | abeab5c86b1c6f68d8796475cba80c4f2c6055ff | [
"Apache-2.0"
] | null | null | null | projects/shadow/kmap-builder-jython27/filters/__init__.py | zaqwes8811/smart-vocabulary-cards | abeab5c86b1c6f68d8796475cba80c4f2c6055ff | [
"Apache-2.0"
] | 11 | 2015-01-25T14:22:52.000Z | 2015-09-08T09:59:38.000Z | projects/shadow/kmap-builder-jython27/filters/__init__.py | zaqwes8811/vocabulary-cards | abeab5c86b1c6f68d8796475cba80c4f2c6055ff | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
import re
def is_content_letter(string):
no_num = '[^0-9 \f\n\r\t\v\-\.\,]'
if re.findall(no_num, string):
return True
else:
return False
if __name__=='__main__':
string = 'asfdasdf99 '
print is_content_letter(string)
string = ' '
print is_content_letter(string)
string = ' 9 '
print is_content_letter(string)
print 'Done' | 22.055556 | 38 | 0.617128 | 55 | 397 | 4.127273 | 0.545455 | 0.15859 | 0.264317 | 0.370044 | 0.396476 | 0.281938 | 0 | 0 | 0 | 0 | 0 | 0.020202 | 0.251889 | 397 | 18 | 39 | 22.055556 | 0.744108 | 0.032746 | 0 | 0.2 | 0 | 0 | 0.133159 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.066667 | null | null | 0.266667 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2fb05c93497d196a0d0ed8c62cf09c27ba8b1a4e | 24 | py | Python | downloadbook/__init__.py | zerenlu/downloadbook | f1aa31e50c8e7ad583d91f3db80c2b7e0aba0ff9 | [
"MIT"
] | null | null | null | downloadbook/__init__.py | zerenlu/downloadbook | f1aa31e50c8e7ad583d91f3db80c2b7e0aba0ff9 | [
"MIT"
] | null | null | null | downloadbook/__init__.py | zerenlu/downloadbook | f1aa31e50c8e7ad583d91f3db80c2b7e0aba0ff9 | [
"MIT"
] | null | null | null | __all__ = ["functions"]
| 12 | 23 | 0.666667 | 2 | 24 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 24 | 1 | 24 | 24 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0.375 | 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 |
2fd2bea49548fd498d56d8de9045b7f350e46d2b | 455 | py | Python | pyhdtoolkit/utils/__init__.py | fsoubelet/PyhDToolk | aef9d5f1fac2d4c4307d50ba5c53f6a5eb635a66 | [
"MIT"
] | 5 | 2020-05-28T09:16:01.000Z | 2021-12-27T18:59:15.000Z | pyhdtoolkit/utils/__init__.py | fsoubelet/PyhDToolk | aef9d5f1fac2d4c4307d50ba5c53f6a5eb635a66 | [
"MIT"
] | 71 | 2020-02-20T20:32:43.000Z | 2022-03-24T17:04:28.000Z | pyhdtoolkit/utils/__init__.py | fsoubelet/PyhDToolk | aef9d5f1fac2d4c4307d50ba5c53f6a5eb635a66 | [
"MIT"
] | 2 | 2021-09-28T16:01:06.000Z | 2022-03-16T19:04:23.000Z | """
utils package
~~~~~~~~~~~~~~~~~~~
These are miscellaneous modules with functions that sometime tunr out useful to my workflow.
These are mainly wrappers around lower-level tools, or simply just additional niceties.
:copyright: (c) 2019 by Felix Soubelet.
:license: MIT, see LICENSE for more details.
"""
from .cmdline import CommandLine
from .executors import MultiProcessor, MultiThreader
from .printutil import END, Background, Foreground, Styles
| 32.5 | 92 | 0.764835 | 58 | 455 | 6 | 0.87931 | 0.045977 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010178 | 0.136264 | 455 | 13 | 93 | 35 | 0.875318 | 0.659341 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2fd562e8f389b57126bf76dca45d45cec9dcf30b | 291 | py | Python | Curso DevMedia/pessoa_juridica.py | rodgui/CursoPython | 3788ce5423e35ba31ac2c65506d382b5faa6bd35 | [
"Apache-2.0"
] | null | null | null | Curso DevMedia/pessoa_juridica.py | rodgui/CursoPython | 3788ce5423e35ba31ac2c65506d382b5faa6bd35 | [
"Apache-2.0"
] | null | null | null | Curso DevMedia/pessoa_juridica.py | rodgui/CursoPython | 3788ce5423e35ba31ac2c65506d382b5faa6bd35 | [
"Apache-2.0"
] | null | null | null | from pessoa import Pessoa
class PessoaJuridica(Pessoa):
def __init__(self, CNPJ, nome, idade) -> None:
super().__init__(nome, idade)
self.CNPJ = CNPJ
def getCNPJ(self):
return self.CNPJ
def setCNPJ(self, CNPJ):
self.CNPJ = CNPJ
| 22.384615 | 50 | 0.587629 | 34 | 291 | 4.794118 | 0.470588 | 0.245399 | 0.147239 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.312715 | 291 | 13 | 51 | 22.384615 | 0.815 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.111111 | 0.666667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
640048b04afb5e2952d4a3126aa32600a5e5aad4 | 862 | py | Python | quiz/migrations/0006_auto_20210624_1235.py | Zhumatai-prog/online_test | 2b3dc52dddb1aa11ba36aa645d2a52afa6b50c75 | [
"MIT"
] | null | null | null | quiz/migrations/0006_auto_20210624_1235.py | Zhumatai-prog/online_test | 2b3dc52dddb1aa11ba36aa645d2a52afa6b50c75 | [
"MIT"
] | null | null | null | quiz/migrations/0006_auto_20210624_1235.py | Zhumatai-prog/online_test | 2b3dc52dddb1aa11ba36aa645d2a52afa6b50c75 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.4 on 2021-06-24 12:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0005_auto_20201209_2125'),
]
operations = [
migrations.AlterField(
model_name='course',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='question',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='result',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
]
| 29.724138 | 111 | 0.607889 | 92 | 862 | 5.532609 | 0.456522 | 0.070727 | 0.147348 | 0.170923 | 0.614931 | 0.614931 | 0.614931 | 0.614931 | 0.614931 | 0.614931 | 0 | 0.049363 | 0.271462 | 862 | 28 | 112 | 30.785714 | 0.761147 | 0.052204 | 0 | 0.545455 | 1 | 0 | 0.072393 | 0.028221 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6409315a2b2fd51cf4ee774aff5de9b69ff05b8b | 431 | py | Python | tests/test_simple_zpl2.py | marcovannoord/simple_zpl2 | 7550485c50ee9a4808d1c6dfbeb040ab6429f3bb | [
"MIT"
] | 16 | 2017-06-15T23:01:16.000Z | 2021-09-30T00:30:49.000Z | tests/test_simple_zpl2.py | marcovannoord/simple_zpl2 | 7550485c50ee9a4808d1c6dfbeb040ab6429f3bb | [
"MIT"
] | 139 | 2017-05-27T15:14:34.000Z | 2022-03-21T14:31:04.000Z | tests/test_simple_zpl2.py | marcovannoord/simple_zpl2 | 7550485c50ee9a4808d1c6dfbeb040ab6429f3bb | [
"MIT"
] | 5 | 2018-04-09T03:54:28.000Z | 2022-03-22T08:46:38.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_simple_zpl2
----------------------------------
Tests for `simple_zpl2` module.
"""
import pytest
from simple_zpl2 import *
def no_newline(formatter):
return formatter.zpl_text.replace('\n', '')
def wrap(zpl):
return '^XA' + zpl + '^XZ'
def char_range(a, b, inclusive=True):
for c in range(ord(a), ord(b) + int(bool(inclusive))):
yield chr(c)
| 13.903226 | 58 | 0.573086 | 59 | 431 | 4.067797 | 0.694915 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011429 | 0.187935 | 431 | 30 | 59 | 14.366667 | 0.674286 | 0.294664 | 0 | 0 | 0 | 0 | 0.027586 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.222222 | 0.222222 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
640e48e1a30e012c6da3c47a306057cb6a6e220b | 1,445 | py | Python | backend-code/party_register/models.py | sumitpal1007/yeprayas_react | f09f56e4357b94412b091cdf7cad0de6e45aa7b8 | [
"MIT"
] | null | null | null | backend-code/party_register/models.py | sumitpal1007/yeprayas_react | f09f56e4357b94412b091cdf7cad0de6e45aa7b8 | [
"MIT"
] | null | null | null | backend-code/party_register/models.py | sumitpal1007/yeprayas_react | f09f56e4357b94412b091cdf7cad0de6e45aa7b8 | [
"MIT"
] | null | null | null | from django.db import models
from .utils import create_new_ref_number
class Party(models.Model):
party_id = models.CharField(max_length = 10, blank=False, editable=False, unique=True, default=create_new_ref_number)
name = models.CharField(max_length=50, null=False)
contact_number = models.CharField(max_length=15)
status = models.CharField(max_length=10, default='ACTIVE')
isDeleted = models.CharField(max_length=1, default='N')
company_name = models.CharField(max_length=250)
email = models.CharField(max_length=100, unique=True, null=False)
password = models.CharField(max_length=100, null=False)
def __str__(self):
return "{} - {}".format(self.party_id, self.name)
#class PartyRegister(models.Model):
# email = models.CharField(max_length=100)
# password = models.CharField(max_length=100)
# created_date = models.DateTimeField(auto_now_add=True)
# party = models.OneToOneField(Party, on_delete = models.CASCADE, null=False)
# def __str__(self):
# return self.party_username
class File(models.Model):
title = models.CharField(max_length=30)
document = models.FileField(max_length=30)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
party = models.ForeignKey(Party, on_delete=models.CASCADE, null=False)
def __str__(self):
return self.title
# Create your models here.
| 36.125 | 121 | 0.728028 | 192 | 1,445 | 5.244792 | 0.34375 | 0.107249 | 0.196624 | 0.262165 | 0.469712 | 0.332671 | 0.109235 | 0.109235 | 0.109235 | 0.109235 | 0 | 0.023026 | 0.158478 | 1,445 | 39 | 122 | 37.051282 | 0.805099 | 0.229066 | 0 | 0.095238 | 0 | 0 | 0.012658 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.095238 | false | 0.047619 | 0.095238 | 0.095238 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
643f742c8f1a10426e8c93933f32e9aeb01c1cee | 107 | py | Python | eschool/authentification/apps.py | legacy1234/eschool | b9574db1d55fc310eb5de6b4a123e1d0be734d9f | [
"MIT"
] | 2 | 2020-06-05T14:49:11.000Z | 2021-07-19T17:50:05.000Z | Projet9/authentification/apps.py | S0Imyr/Projet9 | 0717718e0878b49dac10aefc0901d94bd5ebebd0 | [
"MIT"
] | 50 | 2020-05-29T11:15:33.000Z | 2020-07-29T15:30:53.000Z | authentification/apps.py | peppasd/LIT | 80e256e7678be3cf3ad72d152005cdb7778545d5 | [
"MIT"
] | 3 | 2020-12-19T13:48:06.000Z | 2021-08-12T18:36:33.000Z | from django.apps import AppConfig
class AuthentificationConfig(AppConfig):
name = 'authentification'
| 17.833333 | 40 | 0.794393 | 10 | 107 | 8.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140187 | 107 | 5 | 41 | 21.4 | 0.923913 | 0 | 0 | 0 | 0 | 0 | 0.149533 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ff247e23239c511a967244683961cafbe74f8c8b | 284 | py | Python | runtests.py | xapi-project/python-github2 | d5e0d6efac263658799d09d52c9577aadb580ba3 | [
"BSD-3-Clause"
] | null | null | null | runtests.py | xapi-project/python-github2 | d5e0d6efac263658799d09d52c9577aadb580ba3 | [
"BSD-3-Clause"
] | null | null | null | runtests.py | xapi-project/python-github2 | d5e0d6efac263658799d09d52c9577aadb580ba3 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
"""Run all unit tests for this project"""
import sys
import os
# Add this to the path so we can "import github2"
sys.path.append(os.path.join(os.path.dirname(__file__), '.'))
import unittest
from tests import *
if __name__ == "__main__":
unittest.main()
| 18.933333 | 61 | 0.704225 | 45 | 284 | 4.177778 | 0.688889 | 0.06383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004184 | 0.158451 | 284 | 14 | 62 | 20.285714 | 0.782427 | 0.366197 | 0 | 0 | 0 | 0 | 0.052023 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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.