hexsha stringlengths 40 40 | size int64 7 1.04M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 247 | max_stars_repo_name stringlengths 4 125 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 247 | max_issues_repo_name stringlengths 4 125 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 247 | max_forks_repo_name stringlengths 4 125 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 1 1.04M | avg_line_length float64 1.77 618k | max_line_length int64 1 1.02M | alphanum_fraction float64 0 1 | original_content stringlengths 7 1.04M | filtered:remove_function_no_docstring int64 -102 942k | filtered:remove_class_no_docstring int64 -354 977k | filtered:remove_delete_markers int64 0 60.1k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3499eeff8038172939193acef20b3fe68d410fc5 | 589 | py | Python | Miscellaneous/GuessTheNo.py | spirulinax/PyHub | ae92c249224013f86c06b4d6cec3c6caa2e18c4d | [
"MIT"
] | 1 | 2020-11-09T14:13:45.000Z | 2020-11-09T14:13:45.000Z | Miscellaneous/GuessTheNo.py | spirulinax/PyHub | ae92c249224013f86c06b4d6cec3c6caa2e18c4d | [
"MIT"
] | null | null | null | Miscellaneous/GuessTheNo.py | spirulinax/PyHub | ae92c249224013f86c06b4d6cec3c6caa2e18c4d | [
"MIT"
] | null | null | null | # Guess The No
n = 45
attempt = 0
NoOfGuess = 9
while NoOfGuess > 0:
attempt += 1
print("---------------------------------")
No = int(input("Enter a No:-"))
if No == n:
print("Congratulations You won!")
print("Total Attempt Taken:-", attempt)
break
elif No < n:
pri... | 21.035714 | 48 | 0.47708 | # Guess The No
n = 45
attempt = 0
NoOfGuess = 9
while NoOfGuess > 0:
attempt += 1
print("---------------------------------")
No = int(input("Enter a No:-"))
if No == n:
print("Congratulations You won!")
print("Total Attempt Taken:-", attempt)
break
elif No < n:
pri... | 0 | 0 | 0 |
8ac4088faa49f24247ab4e52803e3dbe165157c3 | 4,231 | py | Python | examples/gui/gui_common.py | charbeljc/pymodbus | f0edef3071d500b7e3a987ee196c38bb79f59518 | [
"W3C"
] | null | null | null | examples/gui/gui_common.py | charbeljc/pymodbus | f0edef3071d500b7e3a987ee196c38bb79f59518 | [
"W3C"
] | null | null | null | examples/gui/gui_common.py | charbeljc/pymodbus | f0edef3071d500b7e3a987ee196c38bb79f59518 | [
"W3C"
] | 2 | 2021-05-02T06:37:33.000Z | 2022-02-06T16:08:47.000Z | #!/usr/bin/env python
# -------------------------------------------------------------------------- #
# System
# -------------------------------------------------------------------------- #
import os
import getpass
import pickle
from threading import Thread
# ------------------------------------------------------------... | 34.398374 | 78 | 0.45143 | #!/usr/bin/env python
# -------------------------------------------------------------------------- #
# System
# -------------------------------------------------------------------------- #
import os
import getpass
import pickle
from threading import Thread
# ------------------------------------------------------------... | 0 | 0 | 0 |
99737a47300033ec91b5e8f9c0d5fbaea99d17dc | 2,124 | py | Python | abc_graphene_sqlalchemy/tests/test_fields.py | maquino1985/graphene-sqlalchemy | 89e11fbbb7513bb07fb87ed805cad6dcd98d41c2 | [
"MIT"
] | 1 | 2021-03-18T10:35:33.000Z | 2021-03-18T10:35:33.000Z | abc_graphene_sqlalchemy/tests/test_fields.py | maquino1985/graphene-sqlalchemy | 89e11fbbb7513bb07fb87ed805cad6dcd98d41c2 | [
"MIT"
] | null | null | null | abc_graphene_sqlalchemy/tests/test_fields.py | maquino1985/graphene-sqlalchemy | 89e11fbbb7513bb07fb87ed805cad6dcd98d41c2 | [
"MIT"
] | null | null | null | import logging
import pytest
from promise import Promise
from graphene import InputObjectType
from graphene.relay import Connection
from sqlalchemy import inspect
from .models import Editor as EditorModel
from .models import Pet as PetModel
from ..fields import SQLAlchemyConnectionField, SQLAlchemyFilteredConnection... | 27.947368 | 111 | 0.750471 | import logging
import pytest
from promise import Promise
from graphene import InputObjectType
from graphene.relay import Connection
from sqlalchemy import inspect
from .models import Editor as EditorModel
from .models import Pet as PetModel
from ..fields import SQLAlchemyConnectionField, SQLAlchemyFilteredConnection... | 1,328 | 156 | 229 |
d434cf747e0d00bccee8b50a8bf0bf43a33096bb | 155 | py | Python | module2/Bot/test.py | 2B5/ia-3B5 | 40a54eb3c6b3d4f536ca1e93b317e2ea9c9a327e | [
"MIT"
] | null | null | null | module2/Bot/test.py | 2B5/ia-3B5 | 40a54eb3c6b3d4f536ca1e93b317e2ea9c9a327e | [
"MIT"
] | 2 | 2017-01-17T17:25:15.000Z | 2021-02-16T23:08:25.000Z | module2/Bot/test.py | 2B5/ia-3B5 | 40a54eb3c6b3d4f536ca1e93b317e2ea9c9a327e | [
"MIT"
] | 2 | 2016-12-06T08:30:38.000Z | 2016-12-22T01:06:27.000Z | import aiml
kernel = aiml.Kernel()
kernel.learn("startup.xml")
kernel.respond("load aiml")
while True:
print(kernel.respond(raw_input("Message >>"))) | 19.375 | 50 | 0.716129 | import aiml
kernel = aiml.Kernel()
kernel.learn("startup.xml")
kernel.respond("load aiml")
while True:
print(kernel.respond(raw_input("Message >>"))) | 0 | 0 | 0 |
a3dfba0ecffb4a8e77fef62ce979de407e8dc97d | 1,522 | py | Python | semantic_segmentation/src/models/segformer.py | no-name-xiaosheng/PaddleViT | 50226a3be5095b3727d3c62d2eab23ef1e9612ec | [
"Apache-2.0"
] | 2 | 2021-11-23T02:01:52.000Z | 2021-11-23T02:02:03.000Z | semantic_segmentation/src/models/segformer.py | Dongsheng-Bi/PaddleViT | c90a6c8dc3787e69cef3a37b9a260bd59eeff1f7 | [
"Apache-2.0"
] | null | null | null | semantic_segmentation/src/models/segformer.py | Dongsheng-Bi/PaddleViT | c90a6c8dc3787e69cef3a37b9a260bd59eeff1f7 | [
"Apache-2.0"
] | null | null | null | import paddle.nn as nn
from .backbones.mix_transformer import MixVisionTransformer
from .decoders.segformer_head import SegformerHead
class Segformer(nn.Layer):
"""Segformer model implementation
""" | 40.052632 | 63 | 0.676741 | import paddle.nn as nn
from .backbones.mix_transformer import MixVisionTransformer
from .decoders.segformer_head import SegformerHead
class Segformer(nn.Layer):
"""Segformer model implementation
"""
def __init__(self, config):
super(Segformer, self).__init__()
self.backbone = MixVisi... | 1,255 | 0 | 53 |
88d0e040eb0d18aebce1104ffd1bde81bddf0d0b | 8,176 | py | Python | siuba/siu/dispatchers.py | sethvargo/siuba | 90172e7888b93eb4a42187a5aea947dbcbbc05ad | [
"MIT"
] | null | null | null | siuba/siu/dispatchers.py | sethvargo/siuba | 90172e7888b93eb4a42187a5aea947dbcbbc05ad | [
"MIT"
] | null | null | null | siuba/siu/dispatchers.py | sethvargo/siuba | 90172e7888b93eb4a42187a5aea947dbcbbc05ad | [
"MIT"
] | null | null | null | # symbolic dispatch wrapper ---------------------------------------------------
from functools import singledispatch, update_wrapper, wraps
import inspect
from .calls import Call, FuncArg, MetaArg, Lazy
from .symbolic import Symbolic, create_sym_call, strip_symbolic
def symbolic_dispatch(f = None, cls = object):
... | 29.516245 | 95 | 0.597725 | # symbolic dispatch wrapper ---------------------------------------------------
from functools import singledispatch, update_wrapper, wraps
import inspect
from .calls import Call, FuncArg, MetaArg, Lazy
from .symbolic import Symbolic, create_sym_call, strip_symbolic
def _dispatch_not_impl(func_name):
def f(x, *a... | 1,956 | -3 | 229 |
fa1316628e51b9c7e416adbda3bf277df8f62831 | 3,899 | py | Python | Ptr_Net_TSPTW/critic.py | samsvp/neural-combinatorial-optimization-rl-tensorflow | add7f1cbb46f363499bc17c085e42825d8e929d1 | [
"MIT"
] | 223 | 2017-09-25T11:09:33.000Z | 2022-03-30T12:04:25.000Z | Ptr_Net_TSPTW/critic.py | samsvp/neural-combinatorial-optimization-rl-tensorflow | add7f1cbb46f363499bc17c085e42825d8e929d1 | [
"MIT"
] | 6 | 2017-11-16T11:01:06.000Z | 2020-07-22T07:46:56.000Z | Ptr_Net_TSPTW/critic.py | samsvp/neural-combinatorial-optimization-rl-tensorflow | add7f1cbb46f363499bc17c085e42825d8e929d1 | [
"MIT"
] | 68 | 2017-11-17T19:55:39.000Z | 2022-03-06T12:45:50.000Z | import tensorflow as tf
from tensorflow.contrib.rnn import LSTMCell, MultiRNNCell, DropoutWrapper
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
| 53.410959 | 146 | 0.637599 | import tensorflow as tf
from tensorflow.contrib.rnn import LSTMCell, MultiRNNCell, DropoutWrapper
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
class Critic(object):
def __init__(self, config):
self.config=config
# Data config
self.batch_size = c... | 3,636 | 0 | 82 |
76f6d739cb23629b57aa94b4e728c30211cd2955 | 4,709 | py | Python | woudc_data_registry/registry.py | ahurka/woudc-data-registry | 29ce092076193f2730d488de5412d93a7b78b987 | [
"MIT"
] | null | null | null | woudc_data_registry/registry.py | ahurka/woudc-data-registry | 29ce092076193f2730d488de5412d93a7b78b987 | [
"MIT"
] | null | null | null | woudc_data_registry/registry.py | ahurka/woudc-data-registry | 29ce092076193f2730d488de5412d93a7b78b987 | [
"MIT"
] | null | null | null | # =================================================================
#
# Terms and Conditions of Use
#
# Unless otherwise noted, computer program source code of this
# distribution # is covered under Crown Copyright, Government of
# Canada, and is distributed under the MIT License.
#
# The Canada wordmark and related gr... | 32.475862 | 73 | 0.651094 | # =================================================================
#
# Terms and Conditions of Use
#
# Unless otherwise noted, computer program source code of this
# distribution # is covered under Crown Copyright, Government of
# Canada, and is distributed under the MIT License.
#
# The Canada wordmark and related gr... | 0 | 0 | 0 |
54b57db99bbed5cda2f6832054fc944284bdef27 | 322 | py | Python | leadreader/str.py | raindrift/leadreader | c360630a75a149e20c9cf64bcb2c14646effb9ae | [
"MIT"
] | null | null | null | leadreader/str.py | raindrift/leadreader | c360630a75a149e20c9cf64bcb2c14646effb9ae | [
"MIT"
] | null | null | null | leadreader/str.py | raindrift/leadreader | c360630a75a149e20c9cf64bcb2c14646effb9ae | [
"MIT"
] | null | null | null | """
String utilities.
"""
def camelize(value):
"""
Return the camel-cased version of a string.
Used for analysis class names.
"""
c = _camelcase()
return "".join(next(c)(x) if x else '_' for x in value.split("_"))
| 21.466667 | 70 | 0.586957 | """
String utilities.
"""
def camelize(value):
"""
Return the camel-cased version of a string.
Used for analysis class names.
"""
def _camelcase():
while True:
yield type(value).capitalize
c = _camelcase()
return "".join(next(c)(x) if x else '_' for x in value.split("_")... | 57 | 0 | 26 |
130d68694e0cf1462e5ccacca80e498aa25a58b7 | 24,266 | py | Python | Scripts/simulation/holidays/holiday_tradition.py | velocist/TS4CheatsInfo | b59ea7e5f4bd01d3b3bd7603843d525a9c179867 | [
"Apache-2.0"
] | null | null | null | Scripts/simulation/holidays/holiday_tradition.py | velocist/TS4CheatsInfo | b59ea7e5f4bd01d3b3bd7603843d525a9c179867 | [
"Apache-2.0"
] | null | null | null | Scripts/simulation/holidays/holiday_tradition.py | velocist/TS4CheatsInfo | b59ea7e5f4bd01d3b3bd7603843d525a9c179867 | [
"Apache-2.0"
] | null | null | null | # uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\holidays\holiday_tradition.py
# Compiled at: 2020-06-15 20:09:55
# Size of source mod 2**32: 25532 b... | 55.783908 | 401 | 0.623424 | # uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\holidays\holiday_tradition.py
# Compiled at: 2020-06-15 20:09:55
# Size of source mod 2**32: 25532 b... | 8,168 | 8,825 | 531 |
fca8a4cdcd60925e50a4fe8be2fd519f54dc6226 | 594 | py | Python | yt_dlp/WS_Extractor/fox.py | evolution-ant/local-youtube-dl | e9be36e8cdc585c0e24a18c74d790b62af6e11a7 | [
"Unlicense"
] | null | null | null | yt_dlp/WS_Extractor/fox.py | evolution-ant/local-youtube-dl | e9be36e8cdc585c0e24a18c74d790b62af6e11a7 | [
"Unlicense"
] | null | null | null | yt_dlp/WS_Extractor/fox.py | evolution-ant/local-youtube-dl | e9be36e8cdc585c0e24a18c74d790b62af6e11a7 | [
"Unlicense"
] | null | null | null | #encoding: utf-8
import re
import json
from ..extractor.fox import FOXIE as Old
from ..utilsEX import download_webPage_by_PYCURL | 39.6 | 163 | 0.725589 | #encoding: utf-8
import re
import json
from ..extractor.fox import FOXIE as Old
from ..utilsEX import download_webPage_by_PYCURL
class FoxIE(Old):
def _download_webpage(self, url_or_request, video_id, note=None, errnote=None, fatal=True, tries=1, timeout=5, encoding=None, data=None, headers={}, query={}):
... | 418 | -4 | 49 |
610597d93ce9bc090b5257f9c8893cbb6e5557aa | 213 | py | Python | arena/objects/tetrahedron.py | syreal17/ARENA-py | 84f73d09ca5bcfec5973b366784ec8385d5e156d | [
"BSD-3-Clause"
] | null | null | null | arena/objects/tetrahedron.py | syreal17/ARENA-py | 84f73d09ca5bcfec5973b366784ec8385d5e156d | [
"BSD-3-Clause"
] | null | null | null | arena/objects/tetrahedron.py | syreal17/ARENA-py | 84f73d09ca5bcfec5973b366784ec8385d5e156d | [
"BSD-3-Clause"
] | null | null | null | from .arena_object import Object
class Tetrahedron(Object):
"""
Class for Tetrahedron in the ARENA.
"""
| 23.666667 | 61 | 0.661972 | from .arena_object import Object
class Tetrahedron(Object):
"""
Class for Tetrahedron in the ARENA.
"""
def __init__(self, **kwargs):
super().__init__(object_type="tetrahedron", **kwargs)
| 70 | 0 | 26 |
b513b7325a18107a0d683adb1f74f7b43224fbe7 | 2,307 | py | Python | tronx/modules/__init__.py | beastzx18/Tron | 92207b841c80311e484e8f350b96f7df8a76d3b9 | [
"MIT"
] | 8 | 2021-08-22T06:43:34.000Z | 2022-02-24T17:09:49.000Z | tronx/modules/__init__.py | beastzx18/Tron | 92207b841c80311e484e8f350b96f7df8a76d3b9 | [
"MIT"
] | 61 | 2021-09-12T11:05:33.000Z | 2021-12-07T15:26:18.000Z | tronx/modules/__init__.py | beastzx18/Tron | 92207b841c80311e484e8f350b96f7df8a76d3b9 | [
"MIT"
] | 6 | 2021-09-08T08:43:04.000Z | 2022-02-24T17:09:50.000Z | import os
from pyrogram.types import Message
from tronx import USER_ID, Config
from tronx.database.postgres import dv_sql as dv
# -----
MODULES = sorted(__list_all_plugins())
__all__ = MODULES + ["MODULES"]
# -----
# types of message
# chat type
| 19.066116 | 70 | 0.684439 | import os
from pyrogram.types import Message
from tronx import USER_ID, Config
from tronx.database.postgres import dv_sql as dv
# -----
def __list_all_plugins():
from os.path import dirname, basename, isfile
import glob
mod_paths = glob.glob(dirname(__file__) + "/*.py")
all_plugins = [
basename(f)[:-3]
... | 1,953 | 0 | 89 |
7388a16df3e442cbca8c2f4415458d3451d3daa3 | 2,892 | py | Python | backend/socket_chat/tests/group_consumer/chat_events/test_list_group_event.py | nikifkon/ChatApp | 1b34e25dca63db7389cec87d7fb1099d95a6308a | [
"MIT"
] | 6 | 2019-09-15T09:35:09.000Z | 2020-03-21T04:10:39.000Z | backend/socket_chat/tests/group_consumer/chat_events/test_list_group_event.py | nikifkon/ChatApp | 1b34e25dca63db7389cec87d7fb1099d95a6308a | [
"MIT"
] | 6 | 2019-09-14T11:09:19.000Z | 2021-06-10T18:49:50.000Z | backend/socket_chat/tests/group_consumer/chat_events/test_list_group_event.py | nikifkon/ChatApp | 1b34e25dca63db7389cec87d7fb1099d95a6308a | [
"MIT"
] | 2 | 2019-10-17T21:11:53.000Z | 2021-02-04T02:52:29.000Z | from copy import deepcopy
import pytest
from channels.testing import WebsocketCommunicator
from backend.groups.models import ChatGroup, GroupMessage
from backend.socket_chat.tests.utils import round_to_minutes
pytestmark = [pytest.mark.asyncio, pytest.mark.django_db(transaction=True)]
@pytest.fixture
@pytest.fi... | 37.558442 | 123 | 0.755878 | from copy import deepcopy
import pytest
from channels.testing import WebsocketCommunicator
from backend.groups.models import ChatGroup, GroupMessage
from backend.socket_chat.tests.utils import round_to_minutes
pytestmark = [pytest.mark.asyncio, pytest.mark.django_db(transaction=True)]
@pytest.fixture
def group_la... | 2,234 | 0 | 178 |
99e3b201284a27e95b30d576ebb5e398e5e6d326 | 7,740 | py | Python | server.py | dplassgit/starter-snake-python | 3264a50663c32e96d608268b8d74b38290cd5322 | [
"MIT"
] | null | null | null | server.py | dplassgit/starter-snake-python | 3264a50663c32e96d608268b8d74b38290cd5322 | [
"MIT"
] | null | null | null | server.py | dplassgit/starter-snake-python | 3264a50663c32e96d608268b8d74b38290cd5322 | [
"MIT"
] | null | null | null | import os
import random
import cherrypy
"""
Dumb battlesnake server in python.
For instructions see https://github.com/BattlesnakeOfficial/starter-snake-python/README.md
"""
move_names = ["up", "down", "left", "right"]
moves_dx = [0, 0, -1, 1]
moves_dy = [1, -1, 0, 0]
""" Snake object. """
# Ideas:
# 1. evaluate... | 28.666667 | 108 | 0.589276 | import os
import random
import cherrypy
"""
Dumb battlesnake server in python.
For instructions see https://github.com/BattlesnakeOfficial/starter-snake-python/README.md
"""
move_names = ["up", "down", "left", "right"]
moves_dx = [0, 0, -1, 1]
moves_dy = [1, -1, 0, 0]
""" Snake object. """
class AnSnake(object):
de... | 6,073 | 323 | 217 |
d0402f1bee556b094723200b8f549a690fa5a0f4 | 174 | py | Python | modules/jenkins/chuck_module.py | msabramo/django-chuck | bbef6171c9b3738460dc05cb77e65ba88fcc5ad8 | [
"BSD-2-Clause"
] | 1 | 2020-05-29T04:27:50.000Z | 2020-05-29T04:27:50.000Z | modules/jenkins/chuck_module.py | msabramo/django-chuck | bbef6171c9b3738460dc05cb77e65ba88fcc5ad8 | [
"BSD-2-Clause"
] | null | null | null | modules/jenkins/chuck_module.py | msabramo/django-chuck | bbef6171c9b3738460dc05cb77e65ba88fcc5ad8 | [
"BSD-2-Clause"
] | null | null | null | depends = ["unittest"]
description = """
Plug and play integration with the Jenkins Coninuous Integration server.
For more information, visit:
http://www.jenkins-ci.org/
""" | 24.857143 | 72 | 0.747126 | depends = ["unittest"]
description = """
Plug and play integration with the Jenkins Coninuous Integration server.
For more information, visit:
http://www.jenkins-ci.org/
""" | 0 | 0 | 0 |
6226e87e91e3d07d4938eccf6653e2af46cf982f | 5,595 | py | Python | plastic_agent/agent/replay_buffer.py | pedMatias/matias_hfo | 6d88e1043a1455f5c1f6cc11b9380869772f4176 | [
"MIT"
] | 1 | 2021-06-03T20:03:50.000Z | 2021-06-03T20:03:50.000Z | plastic_agent/agent/replay_buffer.py | pedMatias/matias_hfo | 6d88e1043a1455f5c1f6cc11b9380869772f4176 | [
"MIT"
] | null | null | null | plastic_agent/agent/replay_buffer.py | pedMatias/matias_hfo | 6d88e1043a1455f5c1f6cc11b9380869772f4176 | [
"MIT"
] | 1 | 2021-03-14T01:22:33.000Z | 2021-03-14T01:22:33.000Z | import numpy as np
import os
import random
from copy import copy
from typing import List
import pickle
from agents.plastic_dqn_v1 import config
REPLAY_MEMORY_SIZE = 50_000 # How many last steps to keep for model training
MIN_REPLAY_MEMORY_SIZE = 1_000 # Minimum number of steps in a memory to
class LearnBuffer:
... | 35.188679 | 80 | 0.597319 | import numpy as np
import os
import random
from copy import copy
from typing import List
import pickle
from agents.plastic_dqn_v1 import config
REPLAY_MEMORY_SIZE = 50_000 # How many last steps to keep for model training
MIN_REPLAY_MEMORY_SIZE = 1_000 # Minimum number of steps in a memory to
class Transition:
... | 3,887 | -4 | 435 |
9666ad76af020f393f10d46a89a360cc326f4eb9 | 1,312 | py | Python | ucvm_v21_10/make_mesh_model.py | SCECcode/ucvm_docker | f472fb0ff512a15c557d88734dcda3ec6a550cc3 | [
"BSD-3-Clause"
] | 1 | 2022-03-08T00:12:08.000Z | 2022-03-08T00:12:08.000Z | ucvm_v21_10/make_mesh_model.py | SCECcode/ucvm_docker | f472fb0ff512a15c557d88734dcda3ec6a550cc3 | [
"BSD-3-Clause"
] | 1 | 2021-12-10T20:35:20.000Z | 2021-12-10T20:35:20.000Z | ucvm_v21_10/make_mesh_model.py | SCECcode/ucvm_docker | f472fb0ff512a15c557d88734dcda3ec6a550cc3 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
import sys
import os
import time
#
# Generate the master out.grid
# Create a 3M point file of lat/lons - and write to ASCII file called out.grd.
# This file will be used as input to ucvm_query for medium scale test for images
#
if not os.path.exists("out.grd"):
print("Creating grd.out file.")
... | 23.017544 | 102 | 0.699695 | #!/usr/bin/env python3
import sys
import os
import time
#
# Generate the master out.grid
# Create a 3M point file of lat/lons - and write to ASCII file called out.grd.
# This file will be used as input to ucvm_query for medium scale test for images
#
if not os.path.exists("out.grd"):
print("Creating grd.out file.")
... | 0 | 0 | 0 |
b1ac4c296c0679ac6f18ecdf329130a62edd9cd2 | 1,633 | py | Python | lib/pulsemodel/sigproc/scripts/bndspec2spec.py | qingyundou/tacotron_qdou | aca014e8ea73bbab617029b81368cee235f47ce2 | [
"MIT"
] | 2 | 2020-12-16T12:53:52.000Z | 2021-09-18T06:52:05.000Z | lib/pulsemodel/sigproc/scripts/bndspec2spec.py | qingyundou/tacotron_qdou | aca014e8ea73bbab617029b81368cee235f47ce2 | [
"MIT"
] | null | null | null | lib/pulsemodel/sigproc/scripts/bndspec2spec.py | qingyundou/tacotron_qdou | aca014e8ea73bbab617029b81368cee235f47ce2 | [
"MIT"
] | 1 | 2021-03-05T03:44:39.000Z | 2021-03-05T03:44:39.000Z | #!/usr/bin/python
'''
Copyright(C) 2016 Engineering Department, University of Cambridge, UK.
License
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/LI... | 37.113636 | 108 | 0.736681 | #!/usr/bin/python
'''
Copyright(C) 2016 Engineering Department, University of Cambridge, UK.
License
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/LI... | 0 | 0 | 0 |
1ae5a32e889489d3ae8d914a5b1ff679ee750c75 | 750 | py | Python | measurements/migrations/0011_testrun_ordering.py | nat64check/zaphod_backend | b92191950825e1a4fd8c34207c8491d587cfb61f | [
"BSD-3-Clause"
] | 1 | 2017-11-14T16:22:38.000Z | 2017-11-14T16:22:38.000Z | measurements/migrations/0011_testrun_ordering.py | sjm-steffann/nat64check_zaphod_backend | b92191950825e1a4fd8c34207c8491d587cfb61f | [
"BSD-3-Clause"
] | 5 | 2019-12-03T05:36:07.000Z | 2021-06-25T15:20:04.000Z | measurements/migrations/0011_testrun_ordering.py | sjm-steffann/nat64check_zaphod_backend | b92191950825e1a4fd8c34207c8491d587cfb61f | [
"BSD-3-Clause"
] | null | null | null | # ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
# Copyright (c) 2018, S.J.M. Steffann. This software is licensed under the BSD
# 3-Clause License. Please see the LICENSE file in the project root directory.
# •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••... | 34.090909 | 113 | 0.516 | # ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
# Copyright (c) 2018, S.J.M. Steffann. This software is licensed under the BSD
# 3-Clause License. Please see the LICENSE file in the project root directory.
# •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••... | 0 | 321 | 23 |
70e4742cf86e95b61a1b7955657907327064055a | 5,915 | py | Python | historia/intercept/select.py | thatdevsherry/historia | 232026b38479fd855c1d8eff543d95e144bfdfe2 | [
"MIT"
] | 10 | 2020-12-12T23:00:27.000Z | 2022-02-09T18:01:40.000Z | historia/intercept/select.py | ShehriyarQureshi/historia | feb48e1489563e4770d32d4e6465d3931407a345 | [
"MIT"
] | 3 | 2018-11-01T11:36:55.000Z | 2018-11-09T04:43:54.000Z | historia/intercept/select.py | ShehriyarQureshi/temporalite | feb48e1489563e4770d32d4e6465d3931407a345 | [
"MIT"
] | null | null | null | """
Copyright (c) 2019 Muhammad Shehriyar Qureshi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish,... | 33.607955 | 131 | 0.647844 | """
Copyright (c) 2019 Muhammad Shehriyar Qureshi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish,... | 4,218 | 585 | 23 |
71fc454f62555f12d5b2e0ba7a796fefb4f06480 | 3,716 | py | Python | app/api/views.py | kwahome/pycon-monitoring-workshop | 24ff177352fb13b686ab46a96c30066556d2e92d | [
"MIT"
] | 7 | 2018-10-25T08:31:05.000Z | 2021-12-31T11:41:50.000Z | app/api/views.py | nknganda/pycon-monitoring-workshop | 24ff177352fb13b686ab46a96c30066556d2e92d | [
"MIT"
] | null | null | null | app/api/views.py | nknganda/pycon-monitoring-workshop | 24ff177352fb13b686ab46a96c30066556d2e92d | [
"MIT"
] | 5 | 2018-10-24T10:18:24.000Z | 2019-09-13T09:15:59.000Z | from annoying.functions import get_object_or_None
from app.api.serializers import (
SendMessageRequestSerializer
)
from app.core.models import MessageRequest
from app.core.routing import ROUTING_REGISTRY
from app.core.views import (
BaseAPIView, GET, POST
)
from rest_framework import status
class HealthCheckV... | 34.728972 | 75 | 0.592842 | from annoying.functions import get_object_or_None
from app.api.serializers import (
SendMessageRequestSerializer
)
from app.core.models import MessageRequest
from app.core.routing import ROUTING_REGISTRY
from app.core.views import (
BaseAPIView, GET, POST
)
from rest_framework import status
class HealthCheckV... | 2,840 | 0 | 162 |
ed185ed349862425c27643f54e86a86df7452b89 | 643 | py | Python | main.py | BdEINSALyon/planning-downloader | 6f0875702547d4746c5c9d766ee2922e0b2a26c5 | [
"MIT"
] | null | null | null | main.py | BdEINSALyon/planning-downloader | 6f0875702547d4746c5c9d766ee2922e0b2a26c5 | [
"MIT"
] | null | null | null | main.py | BdEINSALyon/planning-downloader | 6f0875702547d4746c5c9d766ee2922e0b2a26c5 | [
"MIT"
] | null | null | null | import requests
if __name__ == '__main__':
main()
| 23.814815 | 82 | 0.491446 | import requests
def main():
PHPSESSID = 'oflbncfl7e2pk5rhhir703ruf3'
URL = 'http://planning.gala.bde-insa-lyon.fr/orga/{id}/print'
orgas = [
{'id': 1, 'name': 'SUPER ADMIN'}
]
for o in orgas:
print(o['name'])
r = requests.get(URL.format(id=o['id']), cookies={'PHPSESSID': P... | 564 | 0 | 23 |
af679ac4a4259365b979a1379db022e999b02ea8 | 2,038 | py | Python | chap08/sentiment.py | wtsnjp/nlp100 | 8beaabd0e8598e8a0cbd1eca690281ce5d783e93 | [
"Unlicense"
] | 3 | 2018-01-18T09:56:39.000Z | 2019-03-14T05:54:11.000Z | chap08/sentiment.py | WatsonDNA/nlp100 | 8beaabd0e8598e8a0cbd1eca690281ce5d783e93 | [
"Unlicense"
] | null | null | null | chap08/sentiment.py | WatsonDNA/nlp100 | 8beaabd0e8598e8a0cbd1eca690281ce5d783e93 | [
"Unlicense"
] | 1 | 2020-05-12T14:24:00.000Z | 2020-05-12T14:24:00.000Z | #
# Class SentimentSentences: sentences for polarity analysis
#
from nltk import stem
from collections import Counter
from bisect import bisect_left
from sklearn.linear_model import LogisticRegression
from sklearn.feature_extraction.text import CountVectorizer
| 30.878788 | 73 | 0.540236 | #
# Class SentimentSentences: sentences for polarity analysis
#
from nltk import stem
from collections import Counter
from bisect import bisect_left
from sklearn.linear_model import LogisticRegression
from sklearn.feature_extraction.text import CountVectorizer
class SentimentSentences:
def __init__(self, sentence... | 990 | 762 | 23 |
ebc20eb2ee4c18598edb19954bc42f8e40aa130d | 196 | py | Python | 26-50/30.py | tonyyzy/ProjectEuler | f52de2f931ebd4df2020e32d12062866b1586e72 | [
"MIT"
] | null | null | null | 26-50/30.py | tonyyzy/ProjectEuler | f52de2f931ebd4df2020e32d12062866b1586e72 | [
"MIT"
] | null | null | null | 26-50/30.py | tonyyzy/ProjectEuler | f52de2f931ebd4df2020e32d12062866b1586e72 | [
"MIT"
] | null | null | null | n = 10
result = []
while n < 1000000:
a = str(n)
temp = 0
for i in a:
temp += int(i) ** 5
if temp == n:
result.append(n)
n += 1
print(sum(result))
| 15.076923 | 28 | 0.428571 | n = 10
result = []
while n < 1000000:
a = str(n)
temp = 0
for i in a:
temp += int(i) ** 5
if temp == n:
result.append(n)
n += 1
print(sum(result))
| 0 | 0 | 0 |
dec766a3420a14372b2ae35c3a7c1574968c32eb | 35 | py | Python | ast-transformations-core/src/test/resources/org/jetbrains/research/ml/ast/gumtree/tree/data/loop/for/in_4.py | JetBrains-Research/ast-transformations | 0ab408af3275b520cc87a473f418c4b4dfcb0284 | [
"MIT"
] | 8 | 2021-01-19T21:15:54.000Z | 2022-02-23T19:16:25.000Z | ast-transformations-core/src/test/resources/org/jetbrains/research/ml/ast/gumtree/tree/data/loop/for/in_4.py | JetBrains-Research/ast-transformations | 0ab408af3275b520cc87a473f418c4b4dfcb0284 | [
"MIT"
] | 4 | 2020-11-17T14:28:25.000Z | 2022-02-24T07:54:28.000Z | ast-transformations-core/src/test/resources/org/jetbrains/research/ml/ast/gumtree/tree/data/loop/for/in_4.py | nbirillo/ast-transformations | 717706765a2da29087a0de768fc851698886dd65 | [
"MIT"
] | 1 | 2022-02-23T19:16:30.000Z | 2022-02-23T19:16:30.000Z | for i in range(1, 100, 3):
pass | 17.5 | 26 | 0.571429 | for i in range(1, 100, 3):
pass | 0 | 0 | 0 |
98aa14ecbcd5b5459adc0ed27c86aa5535c9c1d7 | 3,504 | py | Python | django_local_apps/ufs_local_obj.py | weijia/django-local-apps | 5befc41c8ac9625e98c1023257a270a57de700dd | [
"BSD-3-Clause"
] | null | null | null | django_local_apps/ufs_local_obj.py | weijia/django-local-apps | 5befc41c8ac9625e98c1023257a270a57de700dd | [
"BSD-3-Clause"
] | null | null | null | django_local_apps/ufs_local_obj.py | weijia/django-local-apps | 5befc41c8ac9625e98c1023257a270a57de700dd | [
"BSD-3-Clause"
] | null | null | null | import datetime
import os
from django.utils import timezone
from tzlocal import get_localzone
from obj_sys import obj_tools
from obj_sys.models_ufs_obj import UfsObj
from tagging.models import Tag
| 32.747664 | 107 | 0.66895 | import datetime
import os
from django.utils import timezone
from tzlocal import get_localzone
from obj_sys import obj_tools
from obj_sys.models_ufs_obj import UfsObj
from tagging.models import Tag
class ObjectIsNotAssigned(Exception):
pass
class UfsObjSaverBase(object):
def __init__(self, user):
s... | 2,679 | 343 | 279 |
2eda976df95eecd7f8b76221d9aed0bdf80df510 | 5,946 | py | Python | app/debts.py | rkarell/pay-back | 1cc91c58bca3b43e75770727c19c5669a46563d9 | [
"MIT"
] | null | null | null | app/debts.py | rkarell/pay-back | 1cc91c58bca3b43e75770727c19c5669a46563d9 | [
"MIT"
] | null | null | null | app/debts.py | rkarell/pay-back | 1cc91c58bca3b43e75770727c19c5669a46563d9 | [
"MIT"
] | null | null | null |
# When merging two debts, if the resulting debt is negative, this function is used to swap the creditor and debtor, so that the sum of debt is always positive
| 38.61039 | 186 | 0.55819 | class Debts(object):
def __init__(self):
self.debts = []
self.participants = []
def addTransactions(self, transactions):
for transaction in transactions.transactions:
self.addParticipant(transaction.buyer)
for participant in transaction.participants:
... | 5,262 | -9 | 528 |
c52fa157935331613b97e35158cf26220a4a1a2f | 4,645 | py | Python | main/forms.py | mattr555/AtYourService | 41af372176dc607e97851b2c1e8c8efac392787c | [
"MIT"
] | 1 | 2020-11-05T07:29:46.000Z | 2020-11-05T07:29:46.000Z | main/forms.py | mattr555/AtYourService | 41af372176dc607e97851b2c1e8c8efac392787c | [
"MIT"
] | null | null | null | main/forms.py | mattr555/AtYourService | 41af372176dc607e97851b2c1e8c8efac392787c | [
"MIT"
] | null | null | null | from django import forms
from django.contrib.auth.models import User, Group
from django.contrib.auth.forms import UserCreationForm
from datetime import timedelta
from main.models import UserEvent, UserProfile, Organization, Event
import pytz
| 39.364407 | 117 | 0.651238 | from django import forms
from django.contrib.auth.models import User, Group
from django.contrib.auth.forms import UserCreationForm
from datetime import timedelta
from main.models import UserEvent, UserProfile, Organization, Event
import pytz
class MyUserCreate(UserCreationForm):
email = forms.EmailField(required=... | 2,646 | 1,664 | 92 |
19a82d6f900b8f0c33e556f95dff04c5745664de | 2,334 | py | Python | examples/rel_vort_ex.py | dennissergeev/pyveccalc | c5d806e41c13ff3a22e4000764326e491b7d4283 | [
"MIT"
] | 3 | 2015-05-11T01:06:17.000Z | 2015-12-11T12:16:15.000Z | examples/rel_vort_ex.py | dennissergeev/pyveccalc | c5d806e41c13ff3a22e4000764326e491b7d4283 | [
"MIT"
] | 2 | 2015-04-27T08:27:07.000Z | 2015-05-16T14:21:35.000Z | examples/rel_vort_ex.py | dennissergeev/pyveccalc | c5d806e41c13ff3a22e4000764326e491b7d4283 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Compute magnitude and relative vorticity
"""
import numpy as np
import matplotlib as mpl
mpl.rcParams['mathtext.default'] = 'regular'
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, addcyclic
from netCDF4 import Dataset
from pyveccalc.standard import WindHorizonta... | 32.873239 | 94 | 0.67138 | # -*- coding: utf-8 -*-
"""
Compute magnitude and relative vorticity
"""
import numpy as np
import matplotlib as mpl
mpl.rcParams['mathtext.default'] = 'regular'
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, addcyclic
from netCDF4 import Dataset
from pyveccalc.standard import WindHorizonta... | 0 | 0 | 0 |
c31a933e05468982f256a12e95b017ea0c4b2898 | 1,984 | py | Python | SNA/data/preprocess_ES.py | deepesch/decentralizedtrustscore | 406ac219cfa0eb37efa2bf5add484381fd78eb4a | [
"MIT"
] | null | null | null | SNA/data/preprocess_ES.py | deepesch/decentralizedtrustscore | 406ac219cfa0eb37efa2bf5add484381fd78eb4a | [
"MIT"
] | null | null | null | SNA/data/preprocess_ES.py | deepesch/decentralizedtrustscore | 406ac219cfa0eb37efa2bf5add484381fd78eb4a | [
"MIT"
] | 1 | 2020-09-06T02:53:47.000Z | 2020-09-06T02:53:47.000Z | '''Preprocess Epinions and Slashdot data'''
'''Take in text file of data, create and save adjacency matrix'''
import numpy as np, pickle
import scipy.sparse as sp
#Preprocess data
#Optionally run normally or in test mode (when writing tests)
if __name__ == "__main__":
preprocess()
| 34.206897 | 86 | 0.677923 | '''Preprocess Epinions and Slashdot data'''
'''Take in text file of data, create and save adjacency matrix'''
import numpy as np, pickle
import scipy.sparse as sp
#Preprocess data
#Optionally run normally or in test mode (when writing tests)
def preprocess(mode = "normal"):
#FILE_PATH = "Raw Data/soc-sign-epinions.... | 1,674 | 0 | 22 |
bc141a549fb309092bd3508f3eded2771ae00a62 | 242 | py | Python | foobar-1.py | meetajain11/Neural-Networks | 07b0b8c4d8e722b1a8c3763deecff36c53728808 | [
"MIT"
] | null | null | null | foobar-1.py | meetajain11/Neural-Networks | 07b0b8c4d8e722b1a8c3763deecff36c53728808 | [
"MIT"
] | null | null | null | foobar-1.py | meetajain11/Neural-Networks | 07b0b8c4d8e722b1a8c3763deecff36c53728808 | [
"MIT"
] | null | null | null |
demo(15324) | 17.285714 | 28 | 0.438017 | def demo(area):
ans = []
while(area >= 4):
ar = int(area**0.5)
ans.append(ar*ar)
area = area-ar*ar
while(area > 0):
ans.append(1)
area = area-1
print(ans)
demo(15324) | 200 | 0 | 23 |
e24245eab1fca32b7fea62ffd5dfa3c5c2dd631a | 10,243 | py | Python | custom_components/acthor/acthor/registers.py | jatty/hass-acthor | 9d5aaed3f01e9288fef031b47b0808e6e80c22d3 | [
"MIT"
] | null | null | null | custom_components/acthor/acthor/registers.py | jatty/hass-acthor | 9d5aaed3f01e9288fef031b47b0808e6e80c22d3 | [
"MIT"
] | null | null | null | custom_components/acthor/acthor/registers.py | jatty/hass-acthor | 9d5aaed3f01e9288fef031b47b0808e6e80c22d3 | [
"MIT"
] | null | null | null | import abc
import asyncio
import datetime
import logging
from typing import Any, Coroutine, Generic, Iterable, Iterator, Tuple, TypeVar
from .abc import ABCModbusProtocol, MultiRegister, SingleRegister
logger = logging.getLogger(__name__)
T = TypeVar("T")
class ACThorRegistersMixin(ABCModbusProtocol, abc.A... | 24.622596 | 116 | 0.60617 | import abc
import asyncio
import datetime
import logging
from typing import Any, Coroutine, Generic, Iterable, Iterator, Tuple, TypeVar
from .abc import ABCModbusProtocol, MultiRegister, SingleRegister
logger = logging.getLogger(__name__)
T = TypeVar("T")
class ReadOnlyMixin(Generic[T], abc.ABC):
__slots__ = (... | 1,571 | 583 | 211 |
d5caa9127743b2e76bdcf8dc231561b1a3f77a1b | 9,631 | py | Python | pgbot/common.py | gresm/PygameCommunityBot | 0da081704baaaa6fd6464f7abe43e6ba5043952d | [
"MIT"
] | 77 | 2020-11-16T05:26:49.000Z | 2021-03-08T06:27:06.000Z | pgbot/common.py | gresm/PygameCommunityBot | 0da081704baaaa6fd6464f7abe43e6ba5043952d | [
"MIT"
] | 71 | 2021-03-19T17:51:30.000Z | 2022-02-19T12:42:19.000Z | pgbot/common.py | gresm/PygameCommunityBot | 0da081704baaaa6fd6464f7abe43e6ba5043952d | [
"MIT"
] | 19 | 2021-03-19T12:48:17.000Z | 2021-12-18T04:41:08.000Z | """
This file is a part of the source code for the PygameCommunityBot.
This project has been licensed under the MIT license.
Copyright (c) 2020-present PygameCommunityDiscord
This file defines some constants and variables used across the whole codebase
"""
import io
import os
from typing import Optional, Union
impor... | 28.921922 | 139 | 0.663586 | """
This file is a part of the source code for the PygameCommunityBot.
This project has been licensed under the MIT license.
Copyright (c) 2020-present PygameCommunityDiscord
This file defines some constants and variables used across the whole codebase
"""
import io
import os
from typing import Optional, Union
impor... | 0 | 0 | 0 |
6b35d0e3814027abbd9206a5231a54d20d277179 | 1,262 | py | Python | plantcv/plantcv/hyperspectral/_avg_reflectance.py | Howzit123/plantcv | b4ff6ad765da36353f40827ce3816b33d1d3596a | [
"MIT"
] | 2 | 2021-08-20T14:56:48.000Z | 2021-08-24T23:12:56.000Z | plantcv/plantcv/hyperspectral/_avg_reflectance.py | Howzit123/plantcv | b4ff6ad765da36353f40827ce3816b33d1d3596a | [
"MIT"
] | null | null | null | plantcv/plantcv/hyperspectral/_avg_reflectance.py | Howzit123/plantcv | b4ff6ad765da36353f40827ce3816b33d1d3596a | [
"MIT"
] | 1 | 2021-06-15T15:01:46.000Z | 2021-06-15T15:01:46.000Z | # Calculate masked average background reflectance
import numpy as np
def _avg_reflectance(spectral_data, mask):
""" Find average reflectance of masked hyperspectral data instance. This is useful for calculating a target
signature (n_band x 1 - column array) which is required in various GatorSense hypersp... | 34.108108 | 111 | 0.669572 | # Calculate masked average background reflectance
import numpy as np
def _avg_reflectance(spectral_data, mask):
""" Find average reflectance of masked hyperspectral data instance. This is useful for calculating a target
signature (n_band x 1 - column array) which is required in various GatorSense hypersp... | 0 | 0 | 0 |
dc8c9e5d8239e35faa52d813da6c2b78279456f0 | 843 | py | Python | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/14_Longest_Common_Prefix.py | Sycamore-City-passerby/ML | 605cfc70bdda2c99e5f1c16b25812b59c98a72ad | [
"MIT"
] | null | null | null | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/14_Longest_Common_Prefix.py | Sycamore-City-passerby/ML | 605cfc70bdda2c99e5f1c16b25812b59c98a72ad | [
"MIT"
] | null | null | null | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/14_Longest_Common_Prefix.py | Sycamore-City-passerby/ML | 605cfc70bdda2c99e5f1c16b25812b59c98a72ad | [
"MIT"
] | null | null | null |
if __name__ == "__main__":
print(Solution().longestCommonPrefix(["hello", "heaven", "heavy"]))
"""
Time Complexity = O(N*k), k is the length of the common prefix
Space Complexity = O(1)
Write a function to find the longest common prefix string amongst an array of strings.
... | 24.085714 | 94 | 0.52669 | class Solution:
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if not strs:
return ""
for i in range(len(strs[0])):
for string in strs[1:]:
if i >= len(string) or string[i] != strs[0][i]:
... | 0 | 353 | 22 |
05ab655deb7f84c746142d1073d20e615dff176c | 1,191 | py | Python | main.py | hyeon0145/xts-aes-256 | 5f4c25cba7a9b81566635fbf2bd273ac71e1bf64 | [
"WTFPL"
] | 2 | 2017-08-21T11:11:49.000Z | 2019-02-12T09:28:45.000Z | main.py | hyeon0145/xts-aes-256 | 5f4c25cba7a9b81566635fbf2bd273ac71e1bf64 | [
"WTFPL"
] | null | null | null | main.py | hyeon0145/xts-aes-256 | 5f4c25cba7a9b81566635fbf2bd273ac71e1bf64 | [
"WTFPL"
] | 2 | 2018-09-05T09:33:19.000Z | 2019-07-12T19:36:40.000Z | import sys
import binascii
from xts_aes import XTSAES
TEXT_TYPES = {
'encryption': 'plaintext',
'decryption': 'ciphertext',
}
arguments = sys.argv[1:]
mode = 'encryption'
inverse_mode = 'decryption'
if arguments and (arguments[0] == '-d'):
mode = 'decryption'
inverse_mode = 'encryption'
key = read_h... | 27.068182 | 139 | 0.702771 | import sys
import binascii
from xts_aes import XTSAES
TEXT_TYPES = {
'encryption': 'plaintext',
'decryption': 'ciphertext',
}
def read_hex_string(name):
try:
hex_string = input('{name}: '.format(name=name))
hex_string = binascii.unhexlify(hex_string)
except binascii.Error:
sys... | 239 | 0 | 23 |
37e8351577681ea1ea7a116a7d719adb4de5025d | 74 | py | Python | bin/botocore/vendored/requests/packages/urllib3/packages/__init__.py | iilness2/bash-lambda-layer-custom | 0b054d4ccb0623460354ba1f58059258c095a494 | [
"MIT"
] | 2,177 | 2015-01-02T09:56:51.000Z | 2022-03-27T01:48:37.000Z | pip/_vendor/requests/packages/urllib3/packages/__init__.py | alex/pip | d51a4b345b31ec4c8defbefe7f12b996c00c67fa | [
"MIT"
] | 713 | 2015-11-06T10:48:58.000Z | 2018-11-27T16:32:18.000Z | pip/_vendor/requests/packages/urllib3/packages/__init__.py | alex/pip | d51a4b345b31ec4c8defbefe7f12b996c00c67fa | [
"MIT"
] | 742 | 2015-08-22T23:17:54.000Z | 2022-01-18T08:55:33.000Z | from __future__ import absolute_import
from . import ssl_match_hostname
| 14.8 | 38 | 0.851351 | from __future__ import absolute_import
from . import ssl_match_hostname
| 0 | 0 | 0 |
1cd31b4890f3b6fdc7244e05a71517bd89b89233 | 48 | py | Python | napari_plot/layers/line/__init__.py | lukasz-migas/napari-1d | b0f081a8711ae941b3e4b5c58c3aea56bd0e3277 | [
"BSD-3-Clause"
] | 13 | 2021-08-27T23:01:09.000Z | 2022-03-22T13:51:35.000Z | napari_plot/layers/line/__init__.py | lukasz-migas/napari-1d | b0f081a8711ae941b3e4b5c58c3aea56bd0e3277 | [
"BSD-3-Clause"
] | 71 | 2021-08-28T13:29:17.000Z | 2022-03-28T21:22:12.000Z | napari_plot/layers/line/__init__.py | lukasz-migas/napari-1d | b0f081a8711ae941b3e4b5c58c3aea56bd0e3277 | [
"BSD-3-Clause"
] | null | null | null | """Line"""
from .line import Line # noqa: F401
| 16 | 36 | 0.625 | """Line"""
from .line import Line # noqa: F401
| 0 | 0 | 0 |
7dfdebaa1e091eb8231a2ef9b239f464cd5c54da | 5,737 | py | Python | tests/test_doit_cmd.py | m4ta1l/doit | d1a1b7b3abc7641d977d3b78b580d97aea4e27ea | [
"MIT"
] | 3 | 2021-08-07T14:14:51.000Z | 2021-08-20T01:16:01.000Z | tests/test_doit_cmd.py | m4ta1l/doit | d1a1b7b3abc7641d977d3b78b580d97aea4e27ea | [
"MIT"
] | 5 | 2020-09-07T19:21:51.000Z | 2020-09-07T19:41:44.000Z | tests/test_doit_cmd.py | m4ta1l/doit | d1a1b7b3abc7641d977d3b78b580d97aea4e27ea | [
"MIT"
] | null | null | null | import os
from unittest.mock import Mock
import pytest
from doit.exceptions import InvalidCommand
from doit.cmd_run import Run
from doit.cmd_list import List
from doit import doit_cmd
| 35.196319 | 79 | 0.630818 | import os
from unittest.mock import Mock
import pytest
from doit.exceptions import InvalidCommand
from doit.cmd_run import Run
from doit.cmd_list import List
from doit import doit_cmd
def cmd_main(args):
main = doit_cmd.DoitMain()
main.BIN_NAME = 'doit'
return main.run(args)
class TestRun(object):
... | 4,961 | 9 | 575 |
13c81ad5d59ddeac7225490f08cb685f14f20c5b | 1,970 | py | Python | trajectory/utils/serialization.py | SeanNobel/trajectory-transformer | b5497e992734b2320add01adbbfd26b3ee16f2d2 | [
"MIT"
] | 63 | 2021-11-23T08:00:27.000Z | 2022-03-31T04:03:05.000Z | trajectory/utils/serialization.py | SeanNobel/trajectory-transformer | b5497e992734b2320add01adbbfd26b3ee16f2d2 | [
"MIT"
] | 7 | 2021-12-08T04:01:13.000Z | 2022-03-31T07:42:37.000Z | trajectory/utils/serialization.py | SeanNobel/trajectory-transformer | b5497e992734b2320add01adbbfd26b3ee16f2d2 | [
"MIT"
] | 12 | 2021-12-13T10:55:32.000Z | 2022-03-24T09:06:22.000Z | import time
import sys
import os
import glob
import pickle
import json
import torch
import pdb
def mkdir(savepath, prune_fname=False):
"""
returns `True` iff `savepath` is created
"""
if prune_fname:
savepath = os.path.dirname(savepath)
if not os.path.exists(savepath):
try:
... | 26.621622 | 89 | 0.65736 | import time
import sys
import os
import glob
import pickle
import json
import torch
import pdb
def mkdir(savepath, prune_fname=False):
"""
returns `True` iff `savepath` is created
"""
if prune_fname:
savepath = os.path.dirname(savepath)
if not os.path.exists(savepath):
try:
... | 1,323 | 0 | 115 |
1619dc70d15eabc62f53e2b1f4e694140295a184 | 12,160 | py | Python | paper/code/analysis.py | skearnes/color-features | a6af3686c82a5d1d6b68341fe5e5b16e8e4ed356 | [
"BSD-3-Clause"
] | 5 | 2016-06-07T04:17:24.000Z | 2021-05-27T07:41:57.000Z | paper/code/analysis.py | skearnes/color-features | a6af3686c82a5d1d6b68341fe5e5b16e8e4ed356 | [
"BSD-3-Clause"
] | 1 | 2018-04-28T14:40:26.000Z | 2018-05-19T21:55:47.000Z | paper/code/analysis.py | skearnes/color-features | a6af3686c82a5d1d6b68341fe5e5b16e8e4ed356 | [
"BSD-3-Clause"
] | 1 | 2018-12-06T22:54:43.000Z | 2018-12-06T22:54:43.000Z | """Analyze results.
Use the saved model output to calculate AUC and other metrics.
"""
import collections
import cPickle as pickle
import gflags as flags
import gzip
import logging
import numpy as np
import os
import pandas as pd
from sklearn import metrics
from statsmodels.stats import proportion
import sys
flags.D... | 35.870206 | 80 | 0.565789 | """Analyze results.
Use the saved model output to calculate AUC and other metrics.
"""
import collections
import cPickle as pickle
import gflags as flags
import gzip
import logging
import numpy as np
import os
import pandas as pd
from sklearn import metrics
from statsmodels.stats import proportion
import sys
flags.D... | 3,768 | 0 | 92 |
c49431bc20102646a020c6ae047aba4f99d141c1 | 992 | py | Python | cgi-bin/reset_svg.py | errollw/smartboards | c511d4aff8a907e9a07065f7dee1b07f34d8fecd | [
"MIT"
] | 4 | 2018-06-14T12:19:37.000Z | 2022-02-08T18:36:37.000Z | cgi-bin/reset_svg.py | errollw/smartboards | c511d4aff8a907e9a07065f7dee1b07f34d8fecd | [
"MIT"
] | null | null | null | cgi-bin/reset_svg.py | errollw/smartboards | c511d4aff8a907e9a07065f7dee1b07f34d8fecd | [
"MIT"
] | 2 | 2017-02-16T14:21:02.000Z | 2020-05-16T08:21:43.000Z | #!/usr/bin/env python
import cgi
import os
from utils import simple_success_response_JSON
from shutil import copyfile
args = cgi.FieldStorage()
u_id = args['u_id'].value
### Check if SVG exists for each user. If it doesn't, create one
### ------------------------------------------------------------
svg_pat... | 32 | 76 | 0.623992 | #!/usr/bin/env python
import cgi
import os
from utils import simple_success_response_JSON
from shutil import copyfile
args = cgi.FieldStorage()
u_id = args['u_id'].value
### Check if SVG exists for each user. If it doesn't, create one
### ------------------------------------------------------------
svg_pat... | 0 | 0 | 0 |
3cf445961c7fbec62141706a180b03f1a5a6c68c | 1,671 | py | Python | bioprocs/scripts/tsv/pTsvColFilter.py | pwwang/biopipen | d53b78aa192fd56a5da457463b099b2aa833b284 | [
"MIT"
] | 2 | 2021-09-10T00:17:52.000Z | 2021-10-10T09:53:09.000Z | bioprocs/scripts/tsv/pTsvColFilter.py | pwwang/biopipen | d53b78aa192fd56a5da457463b099b2aa833b284 | [
"MIT"
] | 1 | 2021-12-02T07:54:09.000Z | 2021-12-02T07:54:09.000Z | bioprocs/scripts/tsv/pTsvColFilter.py | pwwang/biopipen | d53b78aa192fd56a5da457463b099b2aa833b284 | [
"MIT"
] | 2 | 2021-09-10T00:17:54.000Z | 2021-10-10T09:56:40.000Z | from os import path
from collections import OrderedDict
from diot import Diot
from pyppl.utils import alwaysList
from bioprocs.utils.tsvio2 import TsvReader, TsvWriter
infile = {{i.infile | quote}}
colfile = {{i.colfile | quote}}
outfile = {{o.outfile | quote}}
inopts = {{args.inopts | repr}}
cols = {{args.cols |... | 29.315789 | 92 | 0.707361 | from os import path
from collections import OrderedDict
from diot import Diot
from pyppl.utils import alwaysList
from bioprocs.utils.tsvio2 import TsvReader, TsvWriter
infile = {{i.infile | quote}}
colfile = {{i.colfile | quote}}
outfile = {{o.outfile | quote}}
inopts = {{args.inopts | repr}}
cols = {{args.cols |... | 0 | 0 | 0 |
078d96e72eb252112b59995c7c4436d0430ccb52 | 7,510 | py | Python | quantfig.py | zmoxq/quantfig | 0bd9df3a936569c38b4d7cffe47ff7eb4de2544a | [
"MIT"
] | null | null | null | quantfig.py | zmoxq/quantfig | 0bd9df3a936569c38b4d7cffe47ff7eb4de2544a | [
"MIT"
] | null | null | null | quantfig.py | zmoxq/quantfig | 0bd9df3a936569c38b4d7cffe47ff7eb4de2544a | [
"MIT"
] | null | null | null | from app.signal_calc import SignalCalc
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import math
import numpy as np
import pandas as pd
def line_fig(date, y_axis, y_dict):
"""
:param date: xaxis,
:param y_label: yaxis label e.g. 'y2','y3'
:param y_dict: line data
:ret... | 27.509158 | 102 | 0.488815 | from app.signal_calc import SignalCalc
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import math
import numpy as np
import pandas as pd
def line_fig(date, y_axis, y_dict):
"""
:param date: xaxis,
:param y_label: yaxis label e.g. 'y2','y3'
:param y_dict: line data
:ret... | 6,373 | -6 | 347 |
0cc0c9f3e41e7549d1812b602079b749456b4e01 | 2,906 | py | Python | examples/bank-marketing/splitnn_dataloader.py | lemonviv/PyVertical | 42d4e3e836b03a80929d7f7a08e06bfdbe80896a | [
"Apache-2.0"
] | null | null | null | examples/bank-marketing/splitnn_dataloader.py | lemonviv/PyVertical | 42d4e3e836b03a80929d7f7a08e06bfdbe80896a | [
"Apache-2.0"
] | null | null | null | examples/bank-marketing/splitnn_dataloader.py | lemonviv/PyVertical | 42d4e3e836b03a80929d7f7a08e06bfdbe80896a | [
"Apache-2.0"
] | null | null | null |
class SplitDataLoader:
"""
This class distributes each sample among different workers.
It returns a dictionary with key as data party's id and
value as a pointer to the list of data batches at party's
location.
example:
>>> from splitnn_dataloader import SplitDataLoader
>>> splitnn_tra... | 44.030303 | 123 | 0.60702 |
class SplitDataLoader:
"""
This class distributes each sample among different workers.
It returns a dictionary with key as data party's id and
value as a pointer to the list of data batches at party's
location.
example:
>>> from splitnn_dataloader import SplitDataLoader
>>> splitnn_tra... | 148 | 0 | 78 |
5a882d3d8363079955e3ebfe7587ce3969adff5a | 13,368 | py | Python | app.py | aarunishsinha/Course-Management-System | 80364ffd1c7f6110da9687d9c24f146ab45180f9 | [
"MIT"
] | 2 | 2022-02-14T04:31:06.000Z | 2022-03-01T18:26:07.000Z | app.py | aarunishsinha/Course_Management_System | 80364ffd1c7f6110da9687d9c24f146ab45180f9 | [
"MIT"
] | null | null | null | app.py | aarunishsinha/Course_Management_System | 80364ffd1c7f6110da9687d9c24f146ab45180f9 | [
"MIT"
] | 1 | 2022-02-14T04:31:08.000Z | 2022-02-14T04:31:08.000Z | from flask import Flask, render_template, send_from_directory, request, redirect, url_for
import os
import psycopg2
# import students
from students import studentRoutes
from Admin import adminRoutes
# import nltk
# import numpy as np
# import pandas as pd
# conn = psycopg2.connect('dbname=postgres')
conn = psycopg2.co... | 33.503759 | 242 | 0.596349 | from flask import Flask, render_template, send_from_directory, request, redirect, url_for
import os
import psycopg2
# import students
from students import studentRoutes
from Admin import adminRoutes
# import nltk
# import numpy as np
# import pandas as pd
# conn = psycopg2.connect('dbname=postgres')
conn = psycopg2.co... | 11,390 | 0 | 242 |
8e54a2ad2d5ce89659043e4f426413cb107524f6 | 1,447 | py | Python | setup.py | vznncv/vznncv-miniterm | a5999744435350304e26c4b4c97f7a999b2e5abd | [
"MIT"
] | 1 | 2022-02-17T20:23:12.000Z | 2022-02-17T20:23:12.000Z | setup.py | vznncv/vznncv-miniterm | a5999744435350304e26c4b4c97f7a999b2e5abd | [
"MIT"
] | null | null | null | setup.py | vznncv/vznncv-miniterm | a5999744435350304e26c4b4c97f7a999b2e5abd | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from setuptools import setup, find_namespace_packages
project_name = 'vznncv-miniterm'
with open('README.md') as readme_file:
readme = readme_file.read()
readme = re.sub(r'!\[[^\[\]]*\]\S*', '', readme)
_locals = {}
with open('src/' + project_name.replace(... | 27.826923 | 74 | 0.624741 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from setuptools import setup, find_namespace_packages
project_name = 'vznncv-miniterm'
with open('README.md') as readme_file:
readme = readme_file.read()
readme = re.sub(r'!\[[^\[\]]*\]\S*', '', readme)
_locals = {}
with open('src/' + project_name.replace(... | 0 | 0 | 0 |
b7625fb779461162066385c07a1a8355c1818475 | 4,187 | py | Python | tinkycare.py | m-clare/tinky-care | a2c7831d9f6908949265d51708d5d27fe89901ff | [
"MIT"
] | 5 | 2021-04-08T23:55:13.000Z | 2021-11-23T19:30:47.000Z | tinkycare.py | m-clare/tinky-care | a2c7831d9f6908949265d51708d5d27fe89901ff | [
"MIT"
] | null | null | null | tinkycare.py | m-clare/tinky-care | a2c7831d9f6908949265d51708d5d27fe89901ff | [
"MIT"
] | null | null | null | import os
import json
from PIL import Image, ImageDraw, ImageFont
from inky.inky_uc8159 import Inky
from datetime import datetime as dt
from bots.orgbot import get_org_image
from bots.twitterbot import get_tweet_img
from bots.twitterbot import get_recent_care_tweet
from bots.pomodorobot import get_pomodoro_time
from bo... | 23.522472 | 85 | 0.583711 | import os
import json
from PIL import Image, ImageDraw, ImageFont
from inky.inky_uc8159 import Inky
from datetime import datetime as dt
from bots.orgbot import get_org_image
from bots.twitterbot import get_tweet_img
from bots.twitterbot import get_recent_care_tweet
from bots.pomodorobot import get_pomodoro_time
from bo... | 2,496 | 0 | 115 |
ceedc8ffab527acf38eb4912b4ec135b78d4964d | 6,473 | py | Python | loss/loss_functions.py | akio-kobayashi/acoustic_scene | b4d0678474d1b0dde4478a1710aa489e2ffad875 | [
"Apache-2.0"
] | null | null | null | loss/loss_functions.py | akio-kobayashi/acoustic_scene | b4d0678474d1b0dde4478a1710aa489e2ffad875 | [
"Apache-2.0"
] | null | null | null | loss/loss_functions.py | akio-kobayashi/acoustic_scene | b4d0678474d1b0dde4478a1710aa489e2ffad875 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import tensorflow as tf
import keras.backend as K
'''
Cauchy-Schwarz distance between 2 samples
The distance measures 'distinguishability' between samples.
So, if 2 samples belong to same class, the distance would have a small value.
'''
'''
Compute Cauchy-Schwarz distance loss amon... | 35.762431 | 113 | 0.663525 | import numpy as np
import tensorflow as tf
import keras.backend as K
'''
Cauchy-Schwarz distance between 2 samples
The distance measures 'distinguishability' between samples.
So, if 2 samples belong to same class, the distance would have a small value.
'''
def cauchy_schwarz_distance(logits1, logits2, cros... | 5,272 | 0 | 433 |
c717da8e40954a97b84dcdb68eb545035fb322a9 | 1,925 | py | Python | wolk/data.py | bverhoeve/wolk | 61e63c535cac38a2e6026ae48765d8ede4787404 | [
"MIT"
] | 1 | 2020-05-31T17:38:19.000Z | 2020-05-31T17:38:19.000Z | wolk/data.py | bverhoeve/wolk | 61e63c535cac38a2e6026ae48765d8ede4787404 | [
"MIT"
] | 7 | 2020-05-18T13:06:57.000Z | 2020-06-01T17:44:52.000Z | wolk/data.py | bverhoeve/wolk | 61e63c535cac38a2e6026ae48765d8ede4787404 | [
"MIT"
] | null | null | null | import os
import json
import boto3
import logging
from .constants import (
DATA_DIR,
S3_BUCKET,
AWS_DIR,
AWS_EC2_FILE,
AWS_RDS_FILE,
AZURE_DIR,
GCP_DIR
)
# Initialisation of data directory
if not os.path.exists(DATA_DIR):
logging.debug('No data directories yet, creating')
aws_path:... | 33.189655 | 82 | 0.66026 | import os
import json
import boto3
import logging
from .constants import (
DATA_DIR,
S3_BUCKET,
AWS_DIR,
AWS_EC2_FILE,
AWS_RDS_FILE,
AZURE_DIR,
GCP_DIR
)
# Initialisation of data directory
if not os.path.exists(DATA_DIR):
logging.debug('No data directories yet, creating')
aws_path:... | 1,276 | 0 | 58 |
5c1091d48c8e0c9de6e93e70cfd744804701c5be | 51,872 | py | Python | parinfer.py | oakmac/sublime-text-parinfer | 42b5e43591c415aaab331d07c820f073780df64a | [
"ISC"
] | 58 | 2015-11-20T09:54:43.000Z | 2022-01-11T07:17:56.000Z | parinfer.py | oakmac/sublime-text-parinfer | 42b5e43591c415aaab331d07c820f073780df64a | [
"ISC"
] | 38 | 2015-11-21T23:02:00.000Z | 2021-03-22T15:13:11.000Z | parinfer.py | oakmac/sublime-text-parinfer | 42b5e43591c415aaab331d07c820f073780df64a | [
"ISC"
] | 10 | 2015-12-03T02:42:01.000Z | 2020-08-16T15:02:45.000Z | ## Parinfer.py - a Parinfer implementation in Python
## v3.12.0
## https://github.com/oakmac/parinfer.py
##
## More information about Parinfer can be found here:
## http://shaunlebron.github.io/parinfer/
##
## Copyright (c) 2015, 2020, Chris Oakman and other contributors
## Released under the ISC license
## https://git... | 36.32493 | 158 | 0.564486 | ## Parinfer.py - a Parinfer implementation in Python
## v3.12.0
## https://github.com/oakmac/parinfer.py
##
## More information about Parinfer can be found here:
## http://shaunlebron.github.io/parinfer/
##
## Copyright (c) 2015, 2020, Chris Oakman and other contributors
## Released under the ISC license
## https://git... | 33,963 | 393 | 1,676 |
4453f078b7d3b2fd4ad81bf82d4df1d74c857f5d | 392 | py | Python | testemunhoweb/cadastro/migrations/0010_auto_20181223_2252.py | danielcamilo13/testemunhoWEB | 46825e31123058fa6ee21e4e71e9e0bedde32bb4 | [
"bzip2-1.0.6"
] | 1 | 2019-12-03T01:37:13.000Z | 2019-12-03T01:37:13.000Z | testemunhoweb/cadastro/migrations/0010_auto_20181223_2252.py | danielcamilo13/testemunhoWEB | 46825e31123058fa6ee21e4e71e9e0bedde32bb4 | [
"bzip2-1.0.6"
] | 11 | 2020-06-06T01:28:35.000Z | 2022-03-12T00:16:34.000Z | testemunhoweb/cadastro/migrations/0010_auto_20181223_2252.py | danielcamilo13/testemunhoWEB | 46825e31123058fa6ee21e4e71e9e0bedde32bb4 | [
"bzip2-1.0.6"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2018-12-24 00:52
from __future__ import unicode_literals
from django.db import migrations
| 19.6 | 49 | 0.612245 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2018-12-24 00:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cadastro', '0009_auto_20181215_0042'),
]
operations = [
migrations.RenameModel(
... | 0 | 220 | 23 |
0769c7ed667e125bb1a20f8fc98707bcd2e4d8af | 3,435 | py | Python | custom_components/nest_protect/select.py | rubicon/ha-nest-protect | 4f6ddf12e8384472eff29274c21462b028fe7f85 | [
"MIT"
] | 78 | 2022-01-15T23:08:29.000Z | 2022-03-31T19:58:17.000Z | custom_components/nest_protect/select.py | rubicon/ha-nest-protect | 4f6ddf12e8384472eff29274c21462b028fe7f85 | [
"MIT"
] | 33 | 2022-01-15T20:03:18.000Z | 2022-03-31T23:38:34.000Z | custom_components/nest_protect/select.py | rubicon/ha-nest-protect | 4f6ddf12e8384472eff29274c21462b028fe7f85 | [
"MIT"
] | 10 | 2022-01-29T23:14:10.000Z | 2022-03-22T12:33:52.000Z | """Select platform for Nest Protect."""
from __future__ import annotations
from dataclasses import dataclass
from homeassistant.components.select import SelectEntity, SelectEntityDescription
from homeassistant.helpers.entity import EntityCategory
from . import HomeAssistantNestProtectData
from .const import DOMAIN, ... | 30.945946 | 85 | 0.676274 | """Select platform for Nest Protect."""
from __future__ import annotations
from dataclasses import dataclass
from homeassistant.components.select import SelectEntity, SelectEntityDescription
from homeassistant.helpers.entity import EntityCategory
from . import HomeAssistantNestProtectData
from .const import DOMAIN, ... | 0 | 0 | 0 |
d95dd702b9c2c9ec191644d22f8b6dfb6585324e | 996 | py | Python | 1Dec/listComprehension.py | universekavish/Python-Training | ccd7dfbc8802662de0e0fc20fe99bb3aae4c6e18 | [
"Apache-2.0"
] | null | null | null | 1Dec/listComprehension.py | universekavish/Python-Training | ccd7dfbc8802662de0e0fc20fe99bb3aae4c6e18 | [
"Apache-2.0"
] | null | null | null | 1Dec/listComprehension.py | universekavish/Python-Training | ccd7dfbc8802662de0e0fc20fe99bb3aae4c6e18 | [
"Apache-2.0"
] | null | null | null | L = [10, 11, 12, 13, 14, 15, 16, 17, 18]
print(L)
L1 = [x for x in L if x % 2 == 0]
print(L1)
ip = '10.20.30.40'
octets = ip.split('.')
print(octets)
octets = [int(octet) for octet in octets]
print(octets)
import random
primesPositions = [p for p in range(100) if isPrime(random.randint(1, 1000))]
print(primesPosit... | 21.652174 | 108 | 0.629518 | L = [10, 11, 12, 13, 14, 15, 16, 17, 18]
print(L)
L1 = [x for x in L if x % 2 == 0]
print(L1)
ip = '10.20.30.40'
octets = ip.split('.')
print(octets)
octets = [int(octet) for octet in octets]
print(octets)
def isPrime(n) :
if n < 2 : return False
i = 2
while i < n :
if n % i == 0 : return False
i = i + 1
re... | 338 | -7 | 121 |
2f08724de9f8343f814b4344a568f661f600795c | 232 | py | Python | model/model_builder.py | chansoopark98/Ear-detection | 19d402344ffe5101928af6a5c0149fc147b1d847 | [
"MIT"
] | null | null | null | model/model_builder.py | chansoopark98/Ear-detection | 19d402344ffe5101928af6a5c0149fc147b1d847 | [
"MIT"
] | null | null | null | model/model_builder.py | chansoopark98/Ear-detection | 19d402344ffe5101928af6a5c0149fc147b1d847 | [
"MIT"
] | null | null | null | from tensorflow import keras
from model.model import csnet_extra_model
| 29 | 61 | 0.788793 | from tensorflow import keras
from model.model import csnet_extra_model
def model_build(image_size=224):
inputs, output = csnet_extra_model(IMAGE_SIZE=image_size)
model = keras.Model(inputs, outputs=output)
return model
| 138 | 0 | 23 |
be878f796efbc4d57181dd35b507d33001bf2c79 | 1,665 | py | Python | tests/test_plugins.py | mikegribov/filedjson | ee9f8408edcf8a72b8ed415237789a602ee6b579 | [
"MIT"
] | null | null | null | tests/test_plugins.py | mikegribov/filedjson | ee9f8408edcf8a72b8ed415237789a602ee6b579 | [
"MIT"
] | null | null | null | tests/test_plugins.py | mikegribov/filedjson | ee9f8408edcf8a72b8ed415237789a602ee6b579 | [
"MIT"
] | null | null | null | import os
import traceback
from ..xjson import XJson
| 23.125 | 80 | 0.717718 | import os
import traceback
from ..xjson import XJson
def check_same_structure(name, ext):
json = XJson(os.path.join("examples", "single_file_" + name + ".json"))
plugin = XJson(os.path.join("examples", "single_file_" + name + "." + ext))
assert json.structure != {} and json.structure == plugin.str... | 1,103 | 0 | 499 |
cc313e270c4f537f465b4dd917ff496c05ef36f3 | 3,175 | py | Python | awwards/migrations/0001_initial.py | Nkurumwa/API-project | 452c3c259f46ab60d62f47d740a2eb15db694768 | [
"MIT"
] | null | null | null | awwards/migrations/0001_initial.py | Nkurumwa/API-project | 452c3c259f46ab60d62f47d740a2eb15db694768 | [
"MIT"
] | 3 | 2020-06-06T00:10:58.000Z | 2021-06-10T22:29:21.000Z | awwards/migrations/0001_initial.py | Nkurumwa/API-project | 452c3c259f46ab60d62f47d740a2eb15db694768 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2019-11-25 21:03
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
| 46.014493 | 129 | 0.607559 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2019-11-25 21:03
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration)... | 0 | 2,870 | 23 |
15622877fb0c7c997c9035ab265bc41c3504cd1d | 1,390 | py | Python | python_codes/generators_.py | naikshubham/Miscellaneous-ML-and-Python | a7be5cf5ac95085d3becc554593ee45f93f7850f | [
"BSD-2-Clause"
] | 1 | 2021-06-15T09:57:47.000Z | 2021-06-15T09:57:47.000Z | python_codes/generators_.py | naikshubham/Miscellaneous-ML-and-Python | a7be5cf5ac95085d3becc554593ee45f93f7850f | [
"BSD-2-Clause"
] | null | null | null | python_codes/generators_.py | naikshubham/Miscellaneous-ML-and-Python | a7be5cf5ac95085d3becc554593ee45f93f7850f | [
"BSD-2-Clause"
] | null | null | null |
print(join(capitalize("this will be uppercase text")))
print(join(leetspeak("This isn't a leetspeak")))
print(join(hypenate("will be hypenated by letters")))
print(join(hypenate("will be hypenated by words".split())))
# next() and send()
free = psychologist()
print('free->', free)
print('next->', next(... | 26.730769 | 72 | 0.570504 | def capitalize(values):
# print(values)
for value in values:
# print(value)
yield value.upper()
def hypenate(values):
# print(values)
for value in values:
yield f"-{value}-"
def leetspeak(values):
for value in values:
if value in {'t', 'T'}:
yield '7'
... | 788 | 0 | 114 |
0c0b703bd0d03b86650c5ce280e2f3295cc83afa | 4,897 | py | Python | mri/dispatch/MatplotlibDispatch.py | Mri-monitoring/Mri-python-client | 7ff4889c198d22b9d78b7f0ba8711efa71aef16b | [
"Apache-2.0"
] | 4 | 2015-07-16T16:41:50.000Z | 2015-08-13T09:53:30.000Z | mri/dispatch/MatplotlibDispatch.py | Mri-monitoring/Mri-python-client | 7ff4889c198d22b9d78b7f0ba8711efa71aef16b | [
"Apache-2.0"
] | 4 | 2015-07-16T16:09:37.000Z | 2015-08-18T19:38:19.000Z | mri/dispatch/MatplotlibDispatch.py | Mri-monitoring/Mri-python-client | 7ff4889c198d22b9d78b7f0ba8711efa71aef16b | [
"Apache-2.0"
] | null | null | null | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
import logging
import os
import errno
from .BaseDispatch import BaseDisp... | 36.544776 | 109 | 0.559526 | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
import logging
import os
import errno
from .BaseDispatch import BaseDisp... | 780 | 0 | 53 |
c8beb2fef2a90dce4e6cacc257c60abd209a38cc | 2,186 | py | Python | prototype/speed/rpcsize.py | ooici/pyon | 122c629290d27f32f2f41dafd5c12469295e8acf | [
"BSD-2-Clause"
] | 2 | 2015-06-09T16:07:09.000Z | 2015-07-28T10:06:31.000Z | prototype/speed/rpcsize.py | ooici/pyon | 122c629290d27f32f2f41dafd5c12469295e8acf | [
"BSD-2-Clause"
] | 3 | 2020-07-22T15:14:55.000Z | 2021-12-13T19:35:06.000Z | prototype/speed/rpcsize.py | ooici/pyon | 122c629290d27f32f2f41dafd5c12469295e8acf | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
from pyon.net.endpoint import RPCClient
#from interface.services.idatastore_service import IDatastoreService
from interface.services.ihello_service import IHelloService
from pyon.net.messaging import make_node
import gevent
import time
import base64
import os
import argparse
import msgpack
parse... | 25.717647 | 92 | 0.68893 | #!/usr/bin/env python
from pyon.net.endpoint import RPCClient
#from interface.services.idatastore_service import IDatastoreService
from interface.services.ihello_service import IHelloService
from pyon.net.messaging import make_node
import gevent
import time
import base64
import os
import argparse
import msgpack
parse... | 531 | 0 | 69 |
7001a2aafe77e80e908cb64a736dd79539290346 | 7,957 | py | Python | packages/connections/gym/connection.py | mattmcd/aea-examples | 1c72faadf8feb9f4b8dda9f17995010c2fb3510e | [
"Apache-2.0"
] | null | null | null | packages/connections/gym/connection.py | mattmcd/aea-examples | 1c72faadf8feb9f4b8dda9f17995010c2fb3510e | [
"Apache-2.0"
] | null | null | null | packages/connections/gym/connection.py | mattmcd/aea-examples | 1c72faadf8feb9f4b8dda9f17995010c2fb3510e | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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... | 32.214575 | 153 | 0.607892 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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... | 0 | 0 | 0 |
60b4412d890e1f04c1d7d9dcd011193caca13c37 | 3,404 | py | Python | scripts/find_clusters.py | camillemarie/ncov | 6084ab1f42a36cfba6f8198c4f38047737072d06 | [
"MIT"
] | 1 | 2022-02-06T20:23:03.000Z | 2022-02-06T20:23:03.000Z | scripts/find_clusters.py | camillemarie/ncov | 6084ab1f42a36cfba6f8198c4f38047737072d06 | [
"MIT"
] | 1 | 2022-03-01T00:02:11.000Z | 2022-03-01T00:08:15.000Z | scripts/find_clusters.py | camillemarie/ncov | 6084ab1f42a36cfba6f8198c4f38047737072d06 | [
"MIT"
] | 1 | 2022-01-11T17:46:29.000Z | 2022-01-11T17:46:29.000Z | #!/usr/bin/env python3
import argparse
from augur.utils import read_tree, read_node_data, read_metadata
from collections import Counter
import csv
import hashlib
MAX_HASH_LENGTH = 7
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Find polytomies in a given tree that all belong t... | 39.126437 | 134 | 0.61134 | #!/usr/bin/env python3
import argparse
from augur.utils import read_tree, read_node_data, read_metadata
from collections import Counter
import csv
import hashlib
MAX_HASH_LENGTH = 7
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Find polytomies in a given tree that all belong t... | 0 | 0 | 0 |
fe7269f61e6da28d4bef240e6beb92eb1df6c19b | 1,486 | py | Python | newstream/settings/docker.py | diffractive/newstream | cf1a1f230e18d01c63b50ab9d360aa44ac5a486f | [
"MIT"
] | 1 | 2020-05-03T12:33:42.000Z | 2020-05-03T12:33:42.000Z | newstream/settings/docker.py | diffractive/newstream | cf1a1f230e18d01c63b50ab9d360aa44ac5a486f | [
"MIT"
] | 14 | 2020-07-06T20:05:57.000Z | 2022-03-12T00:39:11.000Z | newstream/settings/docker.py | diffractive/newstream | cf1a1f230e18d01c63b50ab9d360aa44ac5a486f | [
"MIT"
] | null | null | null | from .base import *
ALLOWED_HOSTS = [
"*"
]
SECRET_KEY = os.environ.get("SECERT_KEY", "dummykey")
DATABASE_NAME = os.environ.get("DATABASE_NAME", "newstream")
DATABASE_USER = os.environ.get("DATABASE_USER", "newstream")
DATABASE_HOST = os.environ.get("DATABASE_HOST", "")
DATABASE_PORT = os.environ.get("DATABASE_P... | 23.587302 | 70 | 0.571332 | from .base import *
ALLOWED_HOSTS = [
"*"
]
SECRET_KEY = os.environ.get("SECERT_KEY", "dummykey")
DATABASE_NAME = os.environ.get("DATABASE_NAME", "newstream")
DATABASE_USER = os.environ.get("DATABASE_USER", "newstream")
DATABASE_HOST = os.environ.get("DATABASE_HOST", "")
DATABASE_PORT = os.environ.get("DATABASE_P... | 0 | 0 | 0 |
4863ce321508a73286127e64fdef95c188d41618 | 564 | py | Python | app/settings/views.py | dev-johnlopez/assignably-old | 99f550e3e970a979234a724097ed8c940f1562c1 | [
"MIT"
] | null | null | null | app/settings/views.py | dev-johnlopez/assignably-old | 99f550e3e970a979234a724097ed8c940f1562c1 | [
"MIT"
] | null | null | null | app/settings/views.py | dev-johnlopez/assignably-old | 99f550e3e970a979234a724097ed8c940f1562c1 | [
"MIT"
] | null | null | null | from flask import Blueprint, g, render_template, redirect, url_for, g, flash
from flask_security import current_user, login_required, current_user
from app import db
bp = Blueprint('settings', __name__)
#@bp.before_app_request
#def before_request():
# g.search_form = SearchForm()
@bp.route('/index', methods=['GET... | 29.684211 | 76 | 0.696809 | from flask import Blueprint, g, render_template, redirect, url_for, g, flash
from flask_security import current_user, login_required, current_user
from app import db
bp = Blueprint('settings', __name__)
#@bp.before_app_request
#def before_request():
# g.search_form = SearchForm()
@bp.route('/index', methods=['GET... | 154 | 0 | 22 |
2d48a057d0d9e5d36b293be7298aca0f68373d78 | 3,840 | py | Python | flask_signon/core/jwt_signon.py | juanmanuel96/flask-signon | c08ce983fdde908aa46936f36a7d43bceaa78ae2 | [
"BSD-2-Clause"
] | null | null | null | flask_signon/core/jwt_signon.py | juanmanuel96/flask-signon | c08ce983fdde908aa46936f36a7d43bceaa78ae2 | [
"BSD-2-Clause"
] | null | null | null | flask_signon/core/jwt_signon.py | juanmanuel96/flask-signon | c08ce983fdde908aa46936f36a7d43bceaa78ae2 | [
"BSD-2-Clause"
] | null | null | null | import datetime
from flask import Flask
from flask_jwt_extended import JWTManager
from flask_signon.utils import import_string
| 49.87013 | 87 | 0.698177 | import datetime
from flask import Flask
from flask_jwt_extended import JWTManager
from flask_signon.utils import import_string
class JWTAuth(JWTManager):
def init_app(self, app):
"""
Register this extension with the flask app.
:param app:
The Flask Application object
... | 2,989 | 699 | 23 |
51e6803e70accccebe00711e6bcbf5d3e9f1ae94 | 2,272 | py | Python | xmlreader/XmlReader.py | ZrifBSofiane/XmlBuilder | e0caaa6ebff9b16604308373a361133d49b28060 | [
"MIT"
] | null | null | null | xmlreader/XmlReader.py | ZrifBSofiane/XmlBuilder | e0caaa6ebff9b16604308373a361133d49b28060 | [
"MIT"
] | 2 | 2021-01-13T11:36:18.000Z | 2021-01-13T11:36:40.000Z | xmlreader/XmlReader.py | ZrifBSofiane/XmlReader | e0caaa6ebff9b16604308373a361133d49b28060 | [
"MIT"
] | null | null | null | from xml.etree import ElementTree
from datetime import datetime
from typing import Any
from os import path
import re
| 33.411765 | 89 | 0.59419 | from xml.etree import ElementTree
from datetime import datetime
from typing import Any
from os import path
import re
class XmlReader:
def __init__(self):
self.types = {}
self.datetime_format = None
def register(self, ctor: Any):
temp = ctor()
self.types[type(temp).__name__] = ... | 1,944 | -5 | 211 |
cc23049acceaadcf9842b0dcc4a63b1ab589941e | 1,269 | py | Python | day2.py | Zinko17/FP | f3a8f542a710c3acafbc6d6ac6acd275dd34e653 | [
"MIT"
] | null | null | null | day2.py | Zinko17/FP | f3a8f542a710c3acafbc6d6ac6acd275dd34e653 | [
"MIT"
] | null | null | null | day2.py | Zinko17/FP | f3a8f542a710c3acafbc6d6ac6acd275dd34e653 | [
"MIT"
] | null | null | null | # a = int(input())
# b = int(input())
# if a < b:
# print('a')
# else:
# print('b')
# password = input('enter password:')
# check_password = input('confirm password:')
# if password == check_password and len(password) >=8:
# print('Succesful')
# else:
# if len(password)>= 8:
# print('password don... | 13.645161 | 54 | 0.501182 | # a = int(input())
# b = int(input())
# if a < b:
# print('a')
# else:
# print('b')
# password = input('enter password:')
# check_password = input('confirm password:')
# if password == check_password and len(password) >=8:
# print('Succesful')
# else:
# if len(password)>= 8:
# print('password don... | 0 | 0 | 0 |
49024c6ba195d2ad7accd6ec7d53322f090c0610 | 7,320 | py | Python | tests/api/v1/auth/test_login.py | rogerokello/weConnect-api | e1fb136864842781063a60bae0764defb99e47c6 | [
"MIT"
] | 1 | 2019-04-18T19:56:31.000Z | 2019-04-18T19:56:31.000Z | tests/api/v1/auth/test_login.py | rogerokello/weconnect-practice | e1fb136864842781063a60bae0764defb99e47c6 | [
"MIT"
] | 6 | 2018-02-19T14:17:00.000Z | 2018-07-08T08:38:02.000Z | tests/api/v1/auth/test_login.py | rogerokello/weConnect-api | e1fb136864842781063a60bae0764defb99e47c6 | [
"MIT"
] | 1 | 2018-02-26T13:05:49.000Z | 2018-02-26T13:05:49.000Z | import unittest
import json
from app import create_app, db, session
from tests.api.v1 import BaseTestCase
class AuthTestCase(BaseTestCase):
"""Test case for the authentication blueprint."""
def test_user_login(self):
"""Test registered user can login. (POST request)"""
#first regi... | 43.058824 | 115 | 0.54194 | import unittest
import json
from app import create_app, db, session
from tests.api.v1 import BaseTestCase
class AuthTestCase(BaseTestCase):
"""Test case for the authentication blueprint."""
def test_user_login(self):
"""Test registered user can login. (POST request)"""
#first regi... | 0 | 0 | 0 |
db183d5d9240100317028197380a0bf0c8249960 | 542 | py | Python | pathogen_memo/views/index.py | NajlaBioinfo/pathogen_memo_app | 426a0ef545ffc96da8c6fc1bca5eb19caaf1879c | [
"MIT"
] | null | null | null | pathogen_memo/views/index.py | NajlaBioinfo/pathogen_memo_app | 426a0ef545ffc96da8c6fc1bca5eb19caaf1879c | [
"MIT"
] | 3 | 2021-09-03T10:33:09.000Z | 2022-03-12T00:17:18.000Z | pathogen_memo/views/index.py | NajlaBioinfo/pathogen_memo_app | 426a0ef545ffc96da8c6fc1bca5eb19caaf1879c | [
"MIT"
] | null | null | null | from flask import Blueprint, render_template
from sys import version
from flask import Flask, jsonify
from pathogen_memo.controllers import getallquery
#Set word_count_site_name
indexv = Blueprint('indexv', __name__)
@indexv.route('/')
| 22.583333 | 73 | 0.761993 | from flask import Blueprint, render_template
from sys import version
from flask import Flask, jsonify
from pathogen_memo.controllers import getallquery
#Set word_count_site_name
indexv = Blueprint('indexv', __name__)
@indexv.route('/')
def index():
tablename = 'pathogens'
data_index = getallquery.gethemall(ta... | 278 | 0 | 22 |
87a07ddd5aaead0e0d702a3e591e624c393f2c25 | 1,061 | py | Python | bin/fasta_unwrap.py | nyoungb2/seq_tools | 8d93ad3fa2340c908e67830a2362fba6d2c47fbb | [
"MIT"
] | null | null | null | bin/fasta_unwrap.py | nyoungb2/seq_tools | 8d93ad3fa2340c908e67830a2362fba6d2c47fbb | [
"MIT"
] | null | null | null | bin/fasta_unwrap.py | nyoungb2/seq_tools | 8d93ad3fa2340c908e67830a2362fba6d2c47fbb | [
"MIT"
] | 1 | 2018-06-25T19:34:47.000Z | 2018-06-25T19:34:47.000Z | #!/usr/bin/env python
"""
fasta_unwrap: hard-wrapped fastas unwrapped (sequence is just 1 line)
Usage:
fasta_unwrap <fasta> | [-]
fasta_unwrap -h | --help
fasta_unwrap --version
Options:
<fasta> Fasta file name ('-' if from STDIN).
-h --help Show this screen.
--version Show version.
Descri... | 18.946429 | 69 | 0.637135 | #!/usr/bin/env python
"""
fasta_unwrap: hard-wrapped fastas unwrapped (sequence is just 1 line)
Usage:
fasta_unwrap <fasta> | [-]
fasta_unwrap -h | --help
fasta_unwrap --version
Options:
<fasta> Fasta file name ('-' if from STDIN).
-h --help Show this screen.
--version Show version.
Descri... | 0 | 0 | 0 |
56ceee4a1208e349f997d03840c35c70dbf57a9b | 632 | py | Python | dialogue-engine/test/integration/programy/clients/events/tcpsocket/socket_client.py | cotobadesign/cotoba-agent-oss | 3833d56e79dcd7529c3e8b3a3a8a782d513d9b12 | [
"MIT"
] | 104 | 2020-03-30T09:40:00.000Z | 2022-03-06T22:34:25.000Z | dialogue-engine/test/integration/programy/clients/events/tcpsocket/socket_client.py | cotobadesign/cotoba-agent-oss | 3833d56e79dcd7529c3e8b3a3a8a782d513d9b12 | [
"MIT"
] | 25 | 2020-06-12T01:36:35.000Z | 2022-02-19T07:30:44.000Z | dialogue-engine/test/integration/programy/clients/events/tcpsocket/socket_client.py | cotobadesign/cotoba-agent-oss | 3833d56e79dcd7529c3e8b3a3a8a782d513d9b12 | [
"MIT"
] | 10 | 2020-04-02T23:43:56.000Z | 2021-05-14T13:47:01.000Z | # client.py
import socket
import sys
import json
host = sys.argv[1]
port = int(sys.argv[2])
question = sys.argv[3]
userid = sys.argv[4]
max_size = 1024
if len(sys.argv) == 6:
max_size = sys.argv[5]
payload = {"question": question, "userid": userid}
json_data = json.dumps(payload)
# create a socket object
s = soc... | 19.151515 | 53 | 0.702532 | # client.py
import socket
import sys
import json
host = sys.argv[1]
port = int(sys.argv[2])
question = sys.argv[3]
userid = sys.argv[4]
max_size = 1024
if len(sys.argv) == 6:
max_size = sys.argv[5]
payload = {"question": question, "userid": userid}
json_data = json.dumps(payload)
# create a socket object
s = soc... | 0 | 0 | 0 |
7d02549204810ef8130b0409f64d3c31c9543392 | 1,351 | py | Python | gva/flows/operators/save_to_minio_operator.py | gva-jjoyce/gva_data | cda990d0abb4b175025aaf16e75192bd9cc213af | [
"Apache-2.0"
] | null | null | null | gva/flows/operators/save_to_minio_operator.py | gva-jjoyce/gva_data | cda990d0abb4b175025aaf16e75192bd9cc213af | [
"Apache-2.0"
] | 24 | 2020-12-24T12:21:42.000Z | 2021-01-28T14:22:38.000Z | gva/flows/operators/save_to_minio_operator.py | gva-jjoyce/gva_data | cda990d0abb4b175025aaf16e75192bd9cc213af | [
"Apache-2.0"
] | null | null | null | from .internals.base_operator import BaseOperator
from ...data.writers import MinIoWriter, Writer # type:ignore
from ...data.validator import Schema # type:ignore
import datetime
| 29.369565 | 78 | 0.515914 | from .internals.base_operator import BaseOperator
from ...data.writers import MinIoWriter, Writer # type:ignore
from ...data.validator import Schema # type:ignore
import datetime
class SaveToMinIoOperator(BaseOperator):
def __init__(
self,
*,
end_point: str,
... | 1,004 | 19 | 141 |
3a03c336149f763ec2aca84dddb3492afa302a34 | 3,462 | py | Python | assets/psutil/get_sys_info.py | OrceBR/HercAdminTool | 4db13c88094493ccb75d9e74342c49e5c27d95d2 | [
"MIT"
] | 2 | 2021-04-08T05:06:20.000Z | 2021-07-22T00:42:50.000Z | assets/psutil/get_sys_info.py | OrceBR/HercAdminTool | 4db13c88094493ccb75d9e74342c49e5c27d95d2 | [
"MIT"
] | null | null | null | assets/psutil/get_sys_info.py | OrceBR/HercAdminTool | 4db13c88094493ccb75d9e74342c49e5c27d95d2 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# This script ships with HAT, or HercAdminTool.
# Please see our project here: https://github.com/jguy1987/HercAdminTool
# Author: Jguy - John Mish
# The MIT license covers this file. Please see applicable license file here: https://github.com/jguy1987/HercAdminTool/blob/master/license.txt
# You ... | 29.589744 | 142 | 0.697574 | #!/usr/bin/env python
# This script ships with HAT, or HercAdminTool.
# Please see our project here: https://github.com/jguy1987/HercAdminTool
# Author: Jguy - John Mish
# The MIT license covers this file. Please see applicable license file here: https://github.com/jguy1987/HercAdminTool/blob/master/license.txt
# You ... | 0 | 0 | 0 |
8af60fffa531510aaf431b7e15d750205843a7fd | 1,163 | py | Python | companies/urls.py | Ins-V/wc_crm | 5d75907bb48e892328712ed0b2cf96b9083239aa | [
"MIT"
] | null | null | null | companies/urls.py | Ins-V/wc_crm | 5d75907bb48e892328712ed0b2cf96b9083239aa | [
"MIT"
] | null | null | null | companies/urls.py | Ins-V/wc_crm | 5d75907bb48e892328712ed0b2cf96b9083239aa | [
"MIT"
] | null | null | null | from django.urls import path
from companies import views
app_name = 'company'
urlpatterns = [
path('contacts/', views.CompanyContactsView.as_view(), name='contacts'),
path('phone/list/', views.CompanyPhoneListView.as_view(), name='phone_list'),
path('phone/add/', views.CompanyPhoneCreateView.as_view(), n... | 52.863636 | 96 | 0.705933 | from django.urls import path
from companies import views
app_name = 'company'
urlpatterns = [
path('contacts/', views.CompanyContactsView.as_view(), name='contacts'),
path('phone/list/', views.CompanyPhoneListView.as_view(), name='phone_list'),
path('phone/add/', views.CompanyPhoneCreateView.as_view(), n... | 0 | 0 | 0 |
6aec30f308acb1094dc090358d4839af6529207e | 768 | py | Python | aaulan/models/crew_member.py | AAULAN/aaulan2.0 | f0400914fe9e126a2dbf94cbce78cc34f976f3b8 | [
"MIT"
] | null | null | null | aaulan/models/crew_member.py | AAULAN/aaulan2.0 | f0400914fe9e126a2dbf94cbce78cc34f976f3b8 | [
"MIT"
] | null | null | null | aaulan/models/crew_member.py | AAULAN/aaulan2.0 | f0400914fe9e126a2dbf94cbce78cc34f976f3b8 | [
"MIT"
] | null | null | null | from django.conf import settings
from django.db import models
from django.contrib import admin
admin.site.register(CrewMember, CrewMemberAdmin)
| 24.774194 | 72 | 0.692708 | from django.conf import settings
from django.db import models
from django.contrib import admin
class CrewMember(models.Model):
class Meta:
verbose_name = 'Crew member'
#photo = models.ImageField()
title = models.CharField(max_length=100)
user = models.ForeignKey(
settings.AUTH_USER_MO... | 140 | 434 | 46 |
836d12ee60397703c65310ff1b8d20a62d53b1f0 | 4,626 | py | Python | order.py | AmmeySaini/Realme-AutoBuy | c5ca4ce9990fd397b192f3360ecb264a64ab08f6 | [
"MIT"
] | 32 | 2020-06-23T08:20:56.000Z | 2022-02-13T05:42:48.000Z | order.py | AmmeySaini/Realme-AutoBuy | c5ca4ce9990fd397b192f3360ecb264a64ab08f6 | [
"MIT"
] | 9 | 2020-07-22T06:16:43.000Z | 2021-04-08T09:03:41.000Z | order.py | AmmeySaini/Realme-AutoBuy | c5ca4ce9990fd397b192f3360ecb264a64ab08f6 | [
"MIT"
] | 18 | 2020-06-23T08:12:15.000Z | 2021-10-09T00:13:15.000Z | import requests
import urllib3
import re
import time
from pathlib import Path
from __constants.constants import head1
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
######### AUTHOR - @AmmeySaini #########
######### Github Repo - https://github.com/AmmeySaini/Realme-AutoBuy #########
######### I'... | 50.835165 | 149 | 0.426719 | import requests
import urllib3
import re
import time
from pathlib import Path
from __constants.constants import head1
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
######### AUTHOR - @AmmeySaini #########
######### Github Repo - https://github.com/AmmeySaini/Realme-AutoBuy #########
######### I'... | 4,052 | 0 | 23 |
0103fcf54df56370cd3ee1ea3fff662c86dbc2ac | 1,597 | py | Python | output_parser.py | crowd-planning-poker/ML-SEE-replication-pack | 8db5ad0e6425d2d24243442a472028137164fdf5 | [
"MIT"
] | null | null | null | output_parser.py | crowd-planning-poker/ML-SEE-replication-pack | 8db5ad0e6425d2d24243442a472028137164fdf5 | [
"MIT"
] | null | null | null | output_parser.py | crowd-planning-poker/ML-SEE-replication-pack | 8db5ad0e6425d2d24243442a472028137164fdf5 | [
"MIT"
] | null | null | null | import numpy as np
import sys
import regex as re
if __name__ == "__main__":
file_name = sys.argv[1]
parse_output_performance(file_name) | 35.488889 | 110 | 0.514715 | import numpy as np
import sys
import regex as re
def parse_output_performance(file):
f = open(file, "r")
content = f.read()
print("Dataset\tProject\tMethod\tFold\tF1\tAUC_ROC")
f1, auc_roc = {'RF-BERT':[],'BERT-BERT':[],'RF-BoW':[]},{'RF-BERT':[],'BERT-BERT':[],'RF-BoW':[]}
for match in re... | 1,418 | 0 | 25 |
bce529e350c6acfe1c38a83d15faaccd0ed9f22c | 4,649 | py | Python | demo.py | b4824583/cmr | 7e964bd5fae6d12ad347d5256daa634548ca0a5a | [
"MIT"
] | null | null | null | demo.py | b4824583/cmr | 7e964bd5fae6d12ad347d5256daa634548ca0a5a | [
"MIT"
] | null | null | null | demo.py | b4824583/cmr | 7e964bd5fae6d12ad347d5256daa634548ca0a5a | [
"MIT"
] | null | null | null | """
Demo of CMR.
Note that CMR assumes that the object has been detected, so please use a picture of a bird that is centered and well cropped.
Sample usage:
python demo.py --name bird_net --num_train_epoch 500 --img_path misc/demo_data/img1.jpg
"""
from __future__ import absolute_import
from __future__ import divis... | 27.672619 | 125 | 0.620779 | """
Demo of CMR.
Note that CMR assumes that the object has been detected, so please use a picture of a bird that is centered and well cropped.
Sample usage:
python demo.py --name bird_net --num_train_epoch 500 --img_path misc/demo_data/img1.jpg
"""
from __future__ import absolute_import
from __future__ import divis... | 3,684 | 0 | 69 |
4ae71ff7c9b21807335b8daf912d973c1bd8ecba | 4,389 | py | Python | deepsim/deepsim/__init__.py | aws-deepracer/deepsim | cad2639f525c2f94ec5c03d8b855cc65b0b8ee55 | [
"Apache-2.0"
] | 1 | 2022-03-25T07:20:49.000Z | 2022-03-25T07:20:49.000Z | deepsim/deepsim/__init__.py | aws-deepracer/deepsim | cad2639f525c2f94ec5c03d8b855cc65b0b8ee55 | [
"Apache-2.0"
] | null | null | null | deepsim/deepsim/__init__.py | aws-deepracer/deepsim | cad2639f525c2f94ec5c03d8b855cc65b0b8ee55 | [
"Apache-2.0"
] | null | null | null | #################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"). ... | 48.766667 | 112 | 0.732741 | #################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"). ... | 0 | 0 | 0 |
64f2b559694d21656b8f455bb0caf9f3b4b2e2c5 | 4,010 | py | Python | hexrd/config/tests/test_root.py | glemaitre/hexrd | b68b1ba72e0f480d29bdaae2adbd6c6e2380cc7c | [
"BSD-3-Clause"
] | 27 | 2020-02-18T12:15:08.000Z | 2022-03-24T17:53:46.000Z | hexrd/config/tests/test_root.py | glemaitre/hexrd | b68b1ba72e0f480d29bdaae2adbd6c6e2380cc7c | [
"BSD-3-Clause"
] | 259 | 2020-02-02T22:18:29.000Z | 2022-03-30T19:59:58.000Z | hexrd/config/tests/test_root.py | glemaitre/hexrd | b68b1ba72e0f480d29bdaae2adbd6c6e2380cc7c | [
"BSD-3-Clause"
] | 11 | 2020-02-18T12:14:44.000Z | 2022-03-04T16:19:11.000Z | import multiprocessing as mp
import os
import tempfile
from unittest import skipIf
from .common import TestConfig, test_data
from hexrd import config
reference_data = \
"""
analysis_name: analysis
#working_dir: # not set to test defaulting to cwd
---
analysis_name: analysis_2
working_dir: %(existing_path)s
multiproc... | 33.140496 | 78 | 0.66783 | import multiprocessing as mp
import os
import tempfile
from unittest import skipIf
from .common import TestConfig, test_data
from hexrd import config
reference_data = \
"""
analysis_name: analysis
#working_dir: # not set to test defaulting to cwd
---
analysis_name: analysis_2
working_dir: %(existing_path)s
multiproc... | 2,984 | 398 | 46 |
c9ceab957cb78af08dee479a7e3534e68d15a3a3 | 122 | py | Python | StackedAutoEncoder/train.py | vsc-hvdc/srtp_GIS | 1ade28e92f450812990328d2e4b4921497646f6c | [
"Apache-2.0"
] | null | null | null | StackedAutoEncoder/train.py | vsc-hvdc/srtp_GIS | 1ade28e92f450812990328d2e4b4921497646f6c | [
"Apache-2.0"
] | null | null | null | StackedAutoEncoder/train.py | vsc-hvdc/srtp_GIS | 1ade28e92f450812990328d2e4b4921497646f6c | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
this file is for training the SAE, and apply for the model
@author Zhou Hang
"""
import model
| 17.428571 | 58 | 0.663934 | # -*- coding: utf-8 -*-
"""
this file is for training the SAE, and apply for the model
@author Zhou Hang
"""
import model
| 0 | 0 | 0 |
b83849f586edcddec3a0d1931e899385d48dcf29 | 2,179 | py | Python | deeplearning-image-gpu/python-lib/tensorboard_handle.py | gbetegon88/dataiku-contrib | 4683a9e08a3706a163810bf104bf6464025e235e | [
"Apache-2.0"
] | 93 | 2015-10-28T13:15:45.000Z | 2022-03-07T01:16:24.000Z | deeplearning-image-gpu/python-lib/tensorboard_handle.py | gbetegon88/dataiku-contrib | 4683a9e08a3706a163810bf104bf6464025e235e | [
"Apache-2.0"
] | 130 | 2015-11-13T17:41:41.000Z | 2022-03-30T16:37:44.000Z | deeplearning-image-gpu/python-lib/tensorboard_handle.py | gbetegon88/dataiku-contrib | 4683a9e08a3706a163810bf104bf6464025e235e | [
"Apache-2.0"
] | 88 | 2015-10-29T09:36:23.000Z | 2021-12-13T20:14:08.000Z | import dataiku
import constants
from dataikuapi.utils import DataikuException
import os
from threading import Thread
from werkzeug.serving import make_server
from tensorflow import logging
from tensorboard.backend import application
import tensorboard.default as tb_default
| 32.044118 | 129 | 0.671868 | import dataiku
import constants
from dataikuapi.utils import DataikuException
import os
from threading import Thread
from werkzeug.serving import make_server
from tensorflow import logging
from tensorboard.backend import application
import tensorboard.default as tb_default
class TensorboardThread(Thread):
def __i... | 1,704 | 11 | 185 |
8c344f9429de43332d17b67e902d0404f0d63aa0 | 2,934 | py | Python | src/arago/hiro/backend/seven/app_admin.py | 166MMX/hiro-python-library | fb29e3247a8fe1b0f7dc4e68141cf7340a8dd0a5 | [
"MIT"
] | null | null | null | src/arago/hiro/backend/seven/app_admin.py | 166MMX/hiro-python-library | fb29e3247a8fe1b0f7dc4e68141cf7340a8dd0a5 | [
"MIT"
] | null | null | null | src/arago/hiro/backend/seven/app_admin.py | 166MMX/hiro-python-library | fb29e3247a8fe1b0f7dc4e68141cf7340a8dd0a5 | [
"MIT"
] | null | null | null | from typing import TYPE_CHECKING, Final
from urllib.parse import quote
from arago.hiro.model.graph.vertex import Vertex
from arago.hiro.utils.cast_b import to_vertex
if TYPE_CHECKING:
from arago.hiro.client.rest_base_client import HiroRestBaseClient
| 40.191781 | 102 | 0.623722 | from typing import TYPE_CHECKING, Final
from urllib.parse import quote
from arago.hiro.model.graph.vertex import Vertex
from arago.hiro.utils.cast_b import to_vertex
if TYPE_CHECKING:
from arago.hiro.client.rest_base_client import HiroRestBaseClient
class Hiro7AppAdminModel:
_base_client: Final['HiroRestBas... | 2,417 | 133 | 126 |
69681b1cbcf6d74049745d43ead44794f77d94da | 2,617 | py | Python | google-cloud-sdk/lib/surface/sql/reschedule_maintenance.py | bopopescu/Social-Lite | ee05d6a7431c36ff582c8d6b58bb20a8c5f550bf | [
"Apache-2.0"
] | 2 | 2019-11-10T09:17:07.000Z | 2019-12-18T13:44:08.000Z | google-cloud-sdk/lib/surface/sql/reschedule_maintenance.py | bopopescu/Social-Lite | ee05d6a7431c36ff582c8d6b58bb20a8c5f550bf | [
"Apache-2.0"
] | 4 | 2020-07-21T12:51:46.000Z | 2022-01-22T10:29:25.000Z | google-cloud-sdk/lib/surface/sql/reschedule_maintenance.py | bopopescu/Social-Lite | ee05d6a7431c36ff582c8d6b58bb20a8c5f550bf | [
"Apache-2.0"
] | 1 | 2020-07-25T01:40:19.000Z | 2020-07-25T01:40:19.000Z | # -*- coding: utf-8 -*- #
# Copyright 2019 Google LLC. 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 requir... | 35.849315 | 101 | 0.721055 | # -*- coding: utf-8 -*- #
# Copyright 2019 Google LLC. 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 requir... | 0 | 0 | 0 |
07a4e65171b1be0b8deff477425b769066282366 | 895 | py | Python | 2017/day16.py | di-wu/aoc-python | cb08358ad3654e9401c1bd73ef32b0f79f372215 | [
"Apache-2.0"
] | null | null | null | 2017/day16.py | di-wu/aoc-python | cb08358ad3654e9401c1bd73ef32b0f79f372215 | [
"Apache-2.0"
] | null | null | null | 2017/day16.py | di-wu/aoc-python | cb08358ad3654e9401c1bd73ef32b0f79f372215 | [
"Apache-2.0"
] | null | null | null | input = open('inputs/day16.input').read().strip().split(',')
positions = list("abcdefghijklmnop")
print("Part one: %s" % move(1, positions[:]))
print("Part two: %s" % move(1000000000, positions[:]))
| 28.870968 | 60 | 0.426816 | input = open('inputs/day16.input').read().strip().split(',')
positions = list("abcdefghijklmnop")
def move(iterations, pos):
sequence = []
for i in range(iterations):
s = ''.join(pos)
if s in sequence:
return sequence[iterations % i]
sequence.append(s)
for i in inp... | 671 | 0 | 23 |
c3bedd08edfecc9f7400cb88cb75e8a254fd2c64 | 1,423 | py | Python | media/files/linearreg.py | cobyoo/PlayPay | 6a80e104062965d809d290c65db82f391a53b844 | [
"MIT"
] | 2 | 2021-01-18T14:31:26.000Z | 2021-01-18T15:52:54.000Z | media/files/linearreg_q0cLGi8.py | cobyoo/PlayPay | 6a80e104062965d809d290c65db82f391a53b844 | [
"MIT"
] | null | null | null | media/files/linearreg_q0cLGi8.py | cobyoo/PlayPay | 6a80e104062965d809d290c65db82f391a53b844 | [
"MIT"
] | null | null | null | import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn import model_selection
from sklearn import metrics
from mpl_toolkits.mplot3d import Axes3D
data = pd.read_excel('train_data.xlsx')
data2 = pd.read_excel('test_data.x... | 28.46 | 108 | 0.719606 | import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn import model_selection
from sklearn import metrics
from mpl_toolkits.mplot3d import Axes3D
data = pd.read_excel('train_data.xlsx')
data2 = pd.read_excel('test_data.x... | 0 | 0 | 0 |
b0a1f2f042b581c99a0d2f8cfa9f921d37bf758b | 2,597 | py | Python | utils/misc.py | bbbbbbzhou/DuDoRNet | 5e47030e373aec066f6cc7957e913e984407b1b2 | [
"MIT"
] | 35 | 2020-03-27T02:12:21.000Z | 2022-03-14T17:19:22.000Z | utils/misc.py | chisyliu/DuDoRNet | 5e47030e373aec066f6cc7957e913e984407b1b2 | [
"MIT"
] | 4 | 2020-06-14T12:50:14.000Z | 2021-12-04T06:19:08.000Z | utils/misc.py | chisyliu/DuDoRNet | 5e47030e373aec066f6cc7957e913e984407b1b2 | [
"MIT"
] | 11 | 2020-11-17T12:56:13.000Z | 2022-03-19T17:45:29.000Z | __all__ = ['read_dir', 'get_last_checkpoint', 'compute_metrics', 'get_aapm_minmax',
'convert_coefficient2hu', 'convert_hu2coefficient']
import os
import os.path as path
import scipy.io as sio
import numpy as np
from tqdm import tqdm
from skimage.measure import compare_ssim, compare_psnr
| 30.916667 | 83 | 0.630343 | __all__ = ['read_dir', 'get_last_checkpoint', 'compute_metrics', 'get_aapm_minmax',
'convert_coefficient2hu', 'convert_hu2coefficient']
import os
import os.path as path
import scipy.io as sio
import numpy as np
from tqdm import tqdm
from skimage.measure import compare_ssim, compare_psnr
def read_dir(dir_path, pr... | 2,161 | 0 | 138 |
538e6766d10f927845522486ad65550a2e7d0ba7 | 7,236 | py | Python | srunner/challenge/envs/sensor_interface.py | HumanCompatibleAI/scenario_runner | 6ad946762ffc91d9cf30455045d7cc2f1de57ea1 | [
"MIT"
] | 2 | 2019-07-18T07:02:01.000Z | 2022-03-03T02:47:46.000Z | srunner/challenge/envs/sensor_interface.py | HumanCompatibleAI/scenario_runner | 6ad946762ffc91d9cf30455045d7cc2f1de57ea1 | [
"MIT"
] | null | null | null | srunner/challenge/envs/sensor_interface.py | HumanCompatibleAI/scenario_runner | 6ad946762ffc91d9cf30455045d7cc2f1de57ea1 | [
"MIT"
] | 1 | 2020-11-27T02:01:49.000Z | 2020-11-27T02:01:49.000Z | import copy
import logging
import numpy as np
import os
import time
from threading import Thread
import carla
class Speedometer(object):
"""
Speed pseudo sensor that gets the current speed of the vehicle.
This sensor is not placed at the CARLA environment. It is
only an asynchronous interface to t... | 35.126214 | 105 | 0.615395 | import copy
import logging
import numpy as np
import os
import time
from threading import Thread
import carla
def threaded(fn):
def wrapper(*args, **kwargs):
thread = Thread(target=fn, args=args, kwargs=kwargs)
thread.setDaemon(True)
thread.start()
return thread
return wrappe... | 5,528 | 184 | 619 |
c4b292dfdc7b1ee1ab1dec65306d4c3d376b6785 | 2,879 | py | Python | api/staticdata/control_list_entries/helpers.py | django-doctor/lite-api | 1ba278ba22ebcbb977dd7c31dd3701151cd036bf | [
"MIT"
] | null | null | null | api/staticdata/control_list_entries/helpers.py | django-doctor/lite-api | 1ba278ba22ebcbb977dd7c31dd3701151cd036bf | [
"MIT"
] | null | null | null | api/staticdata/control_list_entries/helpers.py | django-doctor/lite-api | 1ba278ba22ebcbb977dd7c31dd3701151cd036bf | [
"MIT"
] | null | null | null | from api.core.exceptions import NotFoundError
from api.staticdata.control_list_entries.models import ControlListEntry
def get_clc_parent_nodes(rating):
"""
A control list entry can be a group entry or a child of a child entry.
Given a rating, this function provides the list of all parent nodes in the ch... | 35.54321 | 115 | 0.686697 | from api.core.exceptions import NotFoundError
from api.staticdata.control_list_entries.models import ControlListEntry
def get_control_list_entry(rating):
try:
return ControlListEntry.objects.get(rating=rating)
except ControlListEntry.DoesNotExist:
raise NotFoundError({"control_list_entry": f"'... | 1,189 | 0 | 46 |
1e57494008d83982fbef0bcb09c70e1c20e983a5 | 2,934 | py | Python | packtivity/kubernetes/kubedirectjobbackend.py | yadage/packtivity | e7020f549bb0933afc1f63c399ee0926d113c23c | [
"MIT"
] | 1 | 2021-08-23T03:45:20.000Z | 2021-08-23T03:45:20.000Z | packtivity/kubernetes/kubedirectjobbackend.py | lukasheinrich/packtivity | e7020f549bb0933afc1f63c399ee0926d113c23c | [
"MIT"
] | 12 | 2019-07-23T09:13:53.000Z | 2022-02-03T05:47:36.000Z | packtivity/kubernetes/kubedirectjobbackend.py | lukasheinrich/packtivity | e7020f549bb0933afc1f63c399ee0926d113c23c | [
"MIT"
] | 2 | 2020-03-24T10:45:28.000Z | 2020-05-30T05:49:34.000Z | import os
import logging
from .kubesubmitmixin import SubmitToKubeMixin
from .kubespecmixin import KubeSpecMixin
log = logging.getLogger(__name__)
| 34.517647 | 83 | 0.522154 | import os
import logging
from .kubesubmitmixin import SubmitToKubeMixin
from .kubespecmixin import KubeSpecMixin
log = logging.getLogger(__name__)
class KubernetesDirectJobBackend(SubmitToKubeMixin, KubeSpecMixin):
def __init__(self, **kwargs):
SubmitToKubeMixin.__init__(self, **kwargs)
KubeSpecM... | 2,609 | 46 | 130 |
54c4df4909919029afc5df010166e50c34ded11a | 1,612 | py | Python | spotty/providers/aws/config/instance_config.py | vexcel-data/spotty | f6d56129a088908a5b8dcf303867af85e3bdf325 | [
"MIT"
] | null | null | null | spotty/providers/aws/config/instance_config.py | vexcel-data/spotty | f6d56129a088908a5b8dcf303867af85e3bdf325 | [
"MIT"
] | null | null | null | spotty/providers/aws/config/instance_config.py | vexcel-data/spotty | f6d56129a088908a5b8dcf303867af85e3bdf325 | [
"MIT"
] | null | null | null | from typing import Optional
from spotty.config.abstract_instance_config import AbstractInstanceConfig
from spotty.providers.aws.config.validation import validate_instance_parameters
VOLUME_TYPE_EBS = 'ebs'
VOLUME_TYPE_EFS = 'efs'
DEFAULT_AMI_NAME = 'SpottyAMI'
| 24.8 | 87 | 0.675558 | from typing import Optional
from spotty.config.abstract_instance_config import AbstractInstanceConfig
from spotty.providers.aws.config.validation import validate_instance_parameters
VOLUME_TYPE_EBS = 'ebs'
VOLUME_TYPE_EFS = 'efs'
DEFAULT_AMI_NAME = 'SpottyAMI'
class InstanceConfig(AbstractInstanceConfig):
def ... | 782 | 543 | 23 |
8bcf5fb87a306555240cbdbc68c6a26cf55b9ed8 | 14,113 | py | Python | django/sierra/api/models.py | unt-libraries/catalog-api | 9189a6cc64305a6ead4b95ca0b56d7b7ae6c87d5 | [
"BSD-3-Clause"
] | 19 | 2016-03-16T22:08:28.000Z | 2020-08-28T15:54:33.000Z | django/sierra/api/models.py | unt-libraries/catalog-api | 9189a6cc64305a6ead4b95ca0b56d7b7ae6c87d5 | [
"BSD-3-Clause"
] | 39 | 2016-02-26T14:35:12.000Z | 2021-03-19T22:04:20.000Z | django/sierra/api/models.py | unt-libraries/catalog-api | 9189a6cc64305a6ead4b95ca0b56d7b7ae6c87d5 | [
"BSD-3-Clause"
] | 9 | 2016-02-29T22:11:56.000Z | 2020-06-15T06:15:44.000Z | """
Contains models for api app.
"""
import hashlib
import importlib
import csv
import re
import ujson
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import models, transaction, IntegrityError
from django.contrib.auth.models import User
from django.contrib.auth i... | 39.867232 | 79 | 0.61128 | """
Contains models for api app.
"""
import hashlib
import importlib
import csv
import re
import ujson
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import models, transaction, IntegrityError
from django.contrib.auth.models import User
from django.contrib.auth i... | 655 | 6,552 | 96 |
088bf1e3b31b8ef5be18cdddd2324a6bd339deae | 297 | py | Python | src/validators.py | catzilla-007/Gengo-SSE-Coding-Test | a4eb0a49e09ed6d243847242e9fa0097908e650a | [
"MIT"
] | null | null | null | src/validators.py | catzilla-007/Gengo-SSE-Coding-Test | a4eb0a49e09ed6d243847242e9fa0097908e650a | [
"MIT"
] | null | null | null | src/validators.py | catzilla-007/Gengo-SSE-Coding-Test | a4eb0a49e09ed6d243847242e9fa0097908e650a | [
"MIT"
] | null | null | null | from .errors import InvalidInputError
| 33 | 67 | 0.73064 | from .errors import InvalidInputError
def validate_palindrome_character(palindrome: str) -> None:
if not isinstance(palindrome, str):
raise InvalidInputError('Input should be a string')
if len(palindrome) <= 0:
raise InvalidInputError('Characters should be one or more')
| 235 | 0 | 23 |
19a62c19b001126691f6e415ed9dc44c7a8d1b31 | 957 | py | Python | n_gram.py | Qin-Folks/vgae_pytorch | 392dc3a8c2a5d47cbcf6c5571b5878dc4eae56b1 | [
"MIT"
] | 1 | 2021-07-01T17:34:20.000Z | 2021-07-01T17:34:20.000Z | n_gram.py | Qin-Folks/vgae_pytorch | 392dc3a8c2a5d47cbcf6c5571b5878dc4eae56b1 | [
"MIT"
] | null | null | null | n_gram.py | Qin-Folks/vgae_pytorch | 392dc3a8c2a5d47cbcf6c5571b5878dc4eae56b1 | [
"MIT"
] | null | null | null | import torch
| 28.147059 | 74 | 0.601881 | import torch
def get_gram_graph_embedding(node_attrs, adj, is_soft):
node_num = node_attrs.shape[0]
assert node_num <= adj.shape[0]
if is_soft:
adj = adj / 0.5
adj_hard = (adj > 0.5).int()
adj = ((adj_hard - adj).detach() + adj)[:node_num, :node_num]
adj = adj[:node_num, :nod... | 921 | 0 | 23 |
f9d31a78e22b20491ae1cf00aa085332a44b4b14 | 1,050 | py | Python | src/scraping/articlescraper/spiders/fd-sitemap.py | NZR/PublicDiscourseMiner-COVID | e0246852db65eb9fd5058dfb0040e7d02c503931 | [
"MIT"
] | null | null | null | src/scraping/articlescraper/spiders/fd-sitemap.py | NZR/PublicDiscourseMiner-COVID | e0246852db65eb9fd5058dfb0040e7d02c503931 | [
"MIT"
] | null | null | null | src/scraping/articlescraper/spiders/fd-sitemap.py | NZR/PublicDiscourseMiner-COVID | e0246852db65eb9fd5058dfb0040e7d02c503931 | [
"MIT"
] | 1 | 2021-08-03T12:04:33.000Z | 2021-08-03T12:04:33.000Z | from time import sleep
import scrapy
from scrapy import Request
# usage: `scrapy crawl fd-sitemap-css -o ./sitemapURLs/fdlinks.json` | 40.384615 | 160 | 0.621905 | from time import sleep
import scrapy
from scrapy import Request
# usage: `scrapy crawl fd-sitemap-css -o ./sitemapURLs/fdlinks.json`
class FdSitemapSpider(scrapy.Spider):
name = "fd-sitemap-css"
start_urls = []
for i in range(1, 48): # Number of pages with tag "Coronavirus"
start_urls.append('http... | 547 | 348 | 22 |
92dbcfabdb0f0af2b55ea72ec3c7023368b9e376 | 1,772 | py | Python | src/waldur_rancher/migrations/0019_settings_non_null.py | geant-multicloud/MCMS-mastermind | 81333180f5e56a0bc88d7dad448505448e01f24e | [
"MIT"
] | 26 | 2017-10-18T13:49:58.000Z | 2021-09-19T04:44:09.000Z | src/waldur_rancher/migrations/0019_settings_non_null.py | geant-multicloud/MCMS-mastermind | 81333180f5e56a0bc88d7dad448505448e01f24e | [
"MIT"
] | 14 | 2018-12-10T14:14:51.000Z | 2021-06-07T10:33:39.000Z | src/waldur_rancher/migrations/0019_settings_non_null.py | geant-multicloud/MCMS-mastermind | 81333180f5e56a0bc88d7dad448505448e01f24e | [
"MIT"
] | 32 | 2017-09-24T03:10:45.000Z | 2021-10-16T16:41:09.000Z | # Generated by Django 2.2.10 on 2020-03-19 15:29
import django.db.models.deletion
from django.db import migrations, models
| 29.533333 | 60 | 0.517494 | # Generated by Django 2.2.10 on 2020-03-19 15:29
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waldur_rancher', '0018_template_icon'),
]
operations = [
migrations.AlterField(
model_name='ca... | 0 | 1,624 | 23 |
20d5a6a14d18d0266795a549eef19fc38dfca6eb | 355 | py | Python | catops/parser.py | BBOXX/CatOps | c8d8fcc8d5d8d809f75f5663265dd213260484a7 | [
"MIT"
] | 2 | 2018-07-12T15:11:59.000Z | 2018-07-14T19:10:58.000Z | catops/parser.py | BBOXX/CatOps | c8d8fcc8d5d8d809f75f5663265dd213260484a7 | [
"MIT"
] | 3 | 2018-08-10T15:54:02.000Z | 2018-08-31T09:45:43.000Z | catops/parser.py | BBOXX/CatOps | c8d8fcc8d5d8d809f75f5663265dd213260484a7 | [
"MIT"
] | null | null | null | """Custom parser which raises an error instead of exiting."""
import argparse
class ArgumentParserError(Exception):
"""Error raised by ArgumentParser"""
pass
class CatParser(argparse.ArgumentParser):
"""Overrides error method to throw an error instead of exiting"""
| 25.357143 | 69 | 0.732394 | """Custom parser which raises an error instead of exiting."""
import argparse
class ArgumentParserError(Exception):
"""Error raised by ArgumentParser"""
pass
class CatParser(argparse.ArgumentParser):
"""Overrides error method to throw an error instead of exiting"""
def error(self, message):
... | 47 | 0 | 26 |
6ff8fd27d66086bf4c8e1ed8affbd6442d82cf21 | 59 | py | Python | md_click/__init__.py | shalgrim/md-click | fdf4348c83143e157047a0d53a63d79db51ac0cb | [
"BSD-3-Clause"
] | 3 | 2021-03-15T18:50:16.000Z | 2022-01-17T11:43:31.000Z | md_click/__init__.py | shalgrim/md-click | fdf4348c83143e157047a0d53a63d79db51ac0cb | [
"BSD-3-Clause"
] | 1 | 2022-03-31T07:52:18.000Z | 2022-03-31T07:52:18.000Z | md_click/__init__.py | shalgrim/md-click | fdf4348c83143e157047a0d53a63d79db51ac0cb | [
"BSD-3-Clause"
] | 1 | 2021-06-21T21:45:28.000Z | 2021-06-21T21:45:28.000Z | from .main import cli
__version__ = 1.0
__all__ = ['cli'] | 11.8 | 21 | 0.677966 | from .main import cli
__version__ = 1.0
__all__ = ['cli'] | 0 | 0 | 0 |
1c8ebe3b0e41f7a4b51bbb4e0dac81d2f5bca3f1 | 648 | py | Python | leetcode/475.py | windniw/just-for-fun | 54e5c2be145f3848811bfd127f6a89545e921570 | [
"Apache-2.0"
] | 1 | 2019-08-28T23:15:25.000Z | 2019-08-28T23:15:25.000Z | leetcode/475.py | windniw/just-for-fun | 54e5c2be145f3848811bfd127f6a89545e921570 | [
"Apache-2.0"
] | null | null | null | leetcode/475.py | windniw/just-for-fun | 54e5c2be145f3848811bfd127f6a89545e921570 | [
"Apache-2.0"
] | null | null | null | """
link: https://leetcode-cn.com/problems/heaters
problem: 给定数轴上若干A类型的点,再给B类型的点,问以所有B为圆心画圆,最小半径是多少可以覆盖所有的A
solution: 二分。所有A点由其最近的B负责覆盖,结果为此集合中的最大值。
"""
| 27 | 71 | 0.544753 | """
link: https://leetcode-cn.com/problems/heaters
problem: 给定数轴上若干A类型的点,再给B类型的点,问以所有B为圆心画圆,最小半径是多少可以覆盖所有的A
solution: 二分。所有A点由其最近的B负责覆盖,结果为此集合中的最大值。
"""
class Solution:
def findRadius(self, houses: List[int], heaters: List[int]) -> int:
houses.sort()
heaters.sort()
res = 0
for ho... | 449 | -6 | 48 |