hexsha stringlengths 40 40 | size int64 4 1.02M | ext stringclasses 8
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 209 | max_stars_repo_name stringlengths 5 121 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | 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 209 | max_issues_repo_name stringlengths 5 121 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | 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 209 | max_forks_repo_name stringlengths 5 121 | max_forks_repo_head_hexsha stringlengths 40 40 | 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 4 1.02M | avg_line_length float64 1.07 66.1k | max_line_length int64 4 266k | alphanum_fraction float64 0.01 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1a8585d262994990f5f747b5ea6d114f365aef34 | 116 | py | Python | ahmed-package/functions.py | gokcelahmed/ahmed-package | a6c34fb2d85105ad33063b840c84f70ff7a0aa4d | [
"MIT"
] | null | null | null | ahmed-package/functions.py | gokcelahmed/ahmed-package | a6c34fb2d85105ad33063b840c84f70ff7a0aa4d | [
"MIT"
] | null | null | null | ahmed-package/functions.py | gokcelahmed/ahmed-package | a6c34fb2d85105ad33063b840c84f70ff7a0aa4d | [
"MIT"
] | null | null | null | if __name__ == "__main__":
def printName():
name = input("Please enter your name: ")
print(name) | 29 | 48 | 0.577586 |
18368c68efada810dc75011eacd391e1d6bdcf1d | 7,935 | py | Python | snakeai/gameplay/entities.py | robertomatheuspp/snake-ai-reinforcement | a94197472335f1ac348aa9f6a0f224569d667755 | [
"MIT"
] | null | null | null | snakeai/gameplay/entities.py | robertomatheuspp/snake-ai-reinforcement | a94197472335f1ac348aa9f6a0f224569d667755 | [
"MIT"
] | null | null | null | snakeai/gameplay/entities.py | robertomatheuspp/snake-ai-reinforcement | a94197472335f1ac348aa9f6a0f224569d667755 | [
"MIT"
] | 1 | 2018-10-21T01:16:52.000Z | 2018-10-21T01:16:52.000Z | import itertools
import random
import numpy as np
from collections import deque, namedtuple
class Point(namedtuple('PointTuple', ['x', 'y'])):
""" Represents a 2D point with named axes. """
def __add__(self, other):
""" Add two points coordinate-wise. """
return Point(self.x + other.x, self.... | 31.74 | 101 | 0.600378 |
9ca9a64f8e2d05a8ffc4301ad082af79edc0dd8b | 51,171 | py | Python | samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py | nitoqq/openapi-generator | d5ea62f9669b2f669065b02b701eedc816d9d3cd | [
"Apache-2.0"
] | 1 | 2020-08-07T08:38:39.000Z | 2020-08-07T08:38:39.000Z | samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py | nitoqq/openapi-generator | d5ea62f9669b2f669065b02b701eedc816d9d3cd | [
"Apache-2.0"
] | null | null | null | samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py | nitoqq/openapi-generator | d5ea62f9669b2f669065b02b701eedc816d9d3cd | [
"Apache-2.0"
] | 1 | 2019-10-06T12:57:47.000Z | 2019-10-06T12:57:47.000Z | # coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | 36.36887 | 174 | 0.461824 |
ab6b647a401389f015c1e0901a213f9b87bc8081 | 23,111 | py | Python | hyperopt/tests/test_spark.py | michaelmior/hyperopt | 63b5b9bf379fc55f6a158e17c400c1d8bb780fff | [
"BSD-3-Clause"
] | 1 | 2021-01-25T13:43:35.000Z | 2021-01-25T13:43:35.000Z | hyperopt/tests/test_spark.py | bugrabuga/hyperopt | 63b5b9bf379fc55f6a158e17c400c1d8bb780fff | [
"BSD-3-Clause"
] | null | null | null | hyperopt/tests/test_spark.py | bugrabuga/hyperopt | 63b5b9bf379fc55f6a158e17c400c1d8bb780fff | [
"BSD-3-Clause"
] | null | null | null | import contextlib
import logging
import os
import shutil
import tempfile
import time
import timeit
import unittest
import numpy as np
from pyspark.sql import SparkSession
from six import StringIO
from hyperopt import SparkTrials, anneal, base, fmin, hp
from .test_fmin import test_quadratic1_tpe
@contextlib.context... | 35.998442 | 100 | 0.54831 |
d2890a22a8e305c48018fa4f1e44c3435a9116d1 | 2,437 | py | Python | cleastsq.py | cbbing/stock | 6bde95c447544b719094f045817690c54c6e730f | [
"Apache-2.0"
] | 31 | 2015-10-25T05:31:49.000Z | 2022-01-11T19:07:16.000Z | cleastsq.py | cbbing/stock | 6bde95c447544b719094f045817690c54c6e730f | [
"Apache-2.0"
] | null | null | null | cleastsq.py | cbbing/stock | 6bde95c447544b719094f045817690c54c6e730f | [
"Apache-2.0"
] | 21 | 2015-07-17T10:11:18.000Z | 2020-06-08T07:23:03.000Z | # coding=utf-8
'''
作者:Jairus Chan
程序:多项式曲线拟合算法
'''
import matplotlib.pyplot as plt
import math
import numpy
import random
#阶数为9阶
order=9
#进行曲线拟合
def getMatA(xa):
matA=[]
for i in range(0,order+1):
matA1=[]
for j in range(0,order+1):
tx=0.0
for k in range(0,len(xa)):
... | 21.191304 | 65 | 0.509643 |
0fb8c40448957368380a81d9c6c096b42f3608c5 | 3,444 | py | Python | trainer.py | ouldevloper/sign-language-recognition | f056238b005c3b5dec99605e799aef28f6e50861 | [
"MIT"
] | null | null | null | trainer.py | ouldevloper/sign-language-recognition | f056238b005c3b5dec99605e799aef28f6e50861 | [
"MIT"
] | null | null | null | trainer.py | ouldevloper/sign-language-recognition | f056238b005c3b5dec99605e799aef28f6e50861 | [
"MIT"
] | null | null | null | # @Author: Абделлах Улахияне
# @Date: 2021-04-17 23:54:50
# @Last Modified by: Абделлах Улахияне
# @Last Modified time: 2021-04-18 06:47:44
# Importing the Keras libraries and packages
import tensorflow as tf
from tensorflow import keras
import keras
from keras.models import Sequential
from keras.preprocessing.ima... | 40.046512 | 107 | 0.63734 |
d5147774a7e8900bafcafc7464a6c7e71f642e9f | 10,537 | py | Python | lib/datasets/imdb.py | yjy941124/PPR-FCN | 1eba5515b37e7b32413efdf14bb0c22a2e46fee9 | [
"MIT"
] | 20 | 2017-10-16T18:12:51.000Z | 2021-12-23T02:34:20.000Z | lib/datasets/imdb.py | yjy941124/PPR-FCN | 1eba5515b37e7b32413efdf14bb0c22a2e46fee9 | [
"MIT"
] | 1 | 2018-11-10T04:59:48.000Z | 2021-01-21T04:51:31.000Z | lib/datasets/imdb.py | yjy941124/PPR-FCN | 1eba5515b37e7b32413efdf14bb0c22a2e46fee9 | [
"MIT"
] | 5 | 2017-10-17T00:54:42.000Z | 2018-04-08T15:09:40.000Z | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
import os.path as osp
import PIL
from utils.cython_bbox impor... | 39.025926 | 113 | 0.528898 |
1e8710f83f1a9c0a30788461fc485c3054796397 | 23,303 | py | Python | packaging/test_irods_resource_plugin_s3_for_cloudian.py | murlock/irods_resource_plugin_s3 | 5b7fa3f3cf373900828454147226a225791e97a5 | [
"BSD-3-Clause"
] | null | null | null | packaging/test_irods_resource_plugin_s3_for_cloudian.py | murlock/irods_resource_plugin_s3 | 5b7fa3f3cf373900828454147226a225791e97a5 | [
"BSD-3-Clause"
] | null | null | null | packaging/test_irods_resource_plugin_s3_for_cloudian.py | murlock/irods_resource_plugin_s3 | 5b7fa3f3cf373900828454147226a225791e97a5 | [
"BSD-3-Clause"
] | null | null | null | try:
from minio import Minio
except ImportError:
print('This test requires minio: perhaps try pip install minio')
exit()
import commands
import datetime
import os
import platform
import random
import re
import shutil
import string
import subprocess
import sys
if sys.version_info >= (2,7):
import unittest... | 61.648148 | 188 | 0.653564 |
f9ba05f91fc985d298e7f760945f111e5b1349e9 | 1,901 | py | Python | gitseries/cmds/create.py | 4383/git-series | 8fff0da84ac3f3302459808aa154c1d2d2264c44 | [
"Apache-2.0"
] | null | null | null | gitseries/cmds/create.py | 4383/git-series | 8fff0da84ac3f3302459808aa154c1d2d2264c44 | [
"Apache-2.0"
] | null | null | null | gitseries/cmds/create.py | 4383/git-series | 8fff0da84ac3f3302459808aa154c1d2d2264c44 | [
"Apache-2.0"
] | null | null | null | import uuid
import os
import logging
import shlex
import stat
import sys
import tempfile
from gitseries import opts
from gitseries import executor
from gitseries import git
from gitseries.cmds import base as base_cmd
class Create(base_cmd.BaseCommand):
"Create a new serie."
log = logging.getLogger(__name__)... | 31.683333 | 86 | 0.617044 |
2892b12bede371f6d5a7ae8272072544c312cd65 | 2,569 | py | Python | cdrc.py | PeterWurmsdobler/energy-balance-uk | 3eccbf10d395d04bbd6cb855a8bb878ede130141 | [
"MIT"
] | null | null | null | cdrc.py | PeterWurmsdobler/energy-balance-uk | 3eccbf10d395d04bbd6cb855a8bb878ede130141 | [
"MIT"
] | null | null | null | cdrc.py | PeterWurmsdobler/energy-balance-uk | 3eccbf10d395d04bbd6cb855a8bb878ede130141 | [
"MIT"
] | null | null | null | from datetime import datetime
import numpy as np
from csv import reader
from constants import T_s
def load_domestic_data(filepath: str) -> None:
"""Load CDRC data, aggregate over post code areas and meters, then save to file."""
# path = 'data/cdrc/DomesticEnergyProviderDataset/DEP2015_SF_CDRC.csv'
num_... | 38.924242 | 87 | 0.569482 |
114a489a7f1947a532a584a57cbd6d6d8604fc08 | 1,543 | py | Python | tests/conftest.py | brossboth/cryptocom-exchange | b4862187fc28bcb99e0df92cf8a651bd28b1f2c0 | [
"MIT"
] | null | null | null | tests/conftest.py | brossboth/cryptocom-exchange | b4862187fc28bcb99e0df92cf8a651bd28b1f2c0 | [
"MIT"
] | null | null | null | tests/conftest.py | brossboth/cryptocom-exchange | b4862187fc28bcb99e0df92cf8a651bd28b1f2c0 | [
"MIT"
] | null | null | null | import asyncio
import pytest
import cryptocom.exchange as cro
@pytest.fixture
async def exchange() -> cro.Exchange:
ex = cro.Exchange()
await ex.sync_pairs()
return ex
@pytest.fixture
async def account() -> cro.Account:
acc = cro.Account(from_env=True)
await acc.sync_pairs()
yield acc
a... | 25.716667 | 79 | 0.63383 |
1a4591d0cab685cbf9c22e2bbb7acbcec083d876 | 6,489 | py | Python | python/_impl.py | gglin001/poptorch | 61f38ed2d8c6b672e023862eb698865fa7f4724e | [
"MIT"
] | 128 | 2020-12-08T22:22:46.000Z | 2022-03-23T10:54:26.000Z | python/_impl.py | gglin001/poptorch | 61f38ed2d8c6b672e023862eb698865fa7f4724e | [
"MIT"
] | 4 | 2021-06-22T14:26:28.000Z | 2022-02-15T11:25:05.000Z | python/_impl.py | gglin001/poptorch | 61f38ed2d8c6b672e023862eb698865fa7f4724e | [
"MIT"
] | 7 | 2020-12-09T20:32:56.000Z | 2022-01-18T16:12:24.000Z | # Copyright (c) 2020 Graphcore Ltd. All rights reserved.
from contextlib import contextmanager
import copy
import fcntl
import hashlib
import os
from typing import Dict, Any
import torch
# Do not import any poptorch.* here: it will break the poptorch module
from ._logging import logger
from . import poptorch_core
# ... | 35.266304 | 93 | 0.664355 |
3a10756f1821c368bbef4e2e7e7120b78cfc8c61 | 785 | py | Python | core/authentication.py | blumug/texapi | 3caf1dd3f0c641a06964a33f7d3046bdace24eeb | [
"MIT"
] | null | null | null | core/authentication.py | blumug/texapi | 3caf1dd3f0c641a06964a33f7d3046bdace24eeb | [
"MIT"
] | null | null | null | core/authentication.py | blumug/texapi | 3caf1dd3f0c641a06964a33f7d3046bdace24eeb | [
"MIT"
] | null | null | null | import datetime
from django.utils.timezone import utc
from rest_framework.authentication import TokenAuthentication
from rest_framework import exceptions
class ExpiringTokenAuthentication(TokenAuthentication):
def authenticate_credentials(self, key):
try:
token = self.model.objects.get(key=ke... | 32.708333 | 77 | 0.721019 |
0232b76bc623fd926087d4c08b8b623394779db5 | 12,614 | bzl | Python | asylo/bazel/asylo.bzl | Hasimir/asylo | ac598c5266e36312d18fcdaa55efbc780af88975 | [
"Apache-2.0"
] | 1 | 2019-06-27T12:44:36.000Z | 2019-06-27T12:44:36.000Z | asylo/bazel/asylo.bzl | Hasimir/asylo | ac598c5266e36312d18fcdaa55efbc780af88975 | [
"Apache-2.0"
] | null | null | null | asylo/bazel/asylo.bzl | Hasimir/asylo | ac598c5266e36312d18fcdaa55efbc780af88975 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2018 Asylo authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | 35.13649 | 94 | 0.641747 |
bd2339f31d520d24782e4b2522c6978f32ae852e | 5,263 | py | Python | tensorflow/python/kernel_tests/broadcast_to_ops_test.py | yanzhiwei1990/tensorflow | 28ede9ed7caee0ce2731d95cc0eb9aff7f360105 | [
"Apache-2.0"
] | 1 | 2020-02-04T06:39:30.000Z | 2020-02-04T06:39:30.000Z | tensorflow/python/kernel_tests/broadcast_to_ops_test.py | yanzhiwei1990/tensorflow | 28ede9ed7caee0ce2731d95cc0eb9aff7f360105 | [
"Apache-2.0"
] | 1 | 2018-09-17T19:30:27.000Z | 2018-09-17T19:30:27.000Z | tensorflow/python/kernel_tests/broadcast_to_ops_test.py | yanzhiwei1990/tensorflow | 28ede9ed7caee0ce2731d95cc0eb9aff7f360105 | [
"Apache-2.0"
] | 1 | 2019-10-21T10:37:57.000Z | 2019-10-21T10:37:57.000Z | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.484615 | 80 | 0.642219 |
e9f7c6f9e8ac4b058c6578568604e9c180b9100e | 2,379 | py | Python | .ranger/commands.py | xhlar/configs | fd12ab668a6f2cb18582623c820333eec393a09c | [
"CC0-1.0"
] | null | null | null | .ranger/commands.py | xhlar/configs | fd12ab668a6f2cb18582623c820333eec393a09c | [
"CC0-1.0"
] | null | null | null | .ranger/commands.py | xhlar/configs | fd12ab668a6f2cb18582623c820333eec393a09c | [
"CC0-1.0"
] | null | null | null | from ranger.api.commands import Command
class fzf_select(Command):
"""
:fzf_select
Find a file using fzf.
With a prefix argument to select only directories.
See: https://github.com/junegunn/fzf
"""
def execute(self):
import subprocess
import os
from ranger.ext.get_e... | 38.370968 | 108 | 0.527533 |
e3b31dd35fec5d30447f50b6e1b6ef3ac6a8a474 | 7,045 | py | Python | tests/test_serde.py | NervanaSystems/ngraph-python | ac032c83c7152b615a9ad129d54d350f9d6a2986 | [
"Apache-2.0"
] | 18 | 2018-03-19T04:16:49.000Z | 2021-02-08T14:44:58.000Z | tests/test_serde.py | rsumner31/ngraph | 5e5c9bb9f24d95aee190b914dd2d44122fc3be53 | [
"Apache-2.0"
] | 2 | 2019-04-16T06:41:49.000Z | 2019-05-06T14:08:13.000Z | tests/test_serde.py | rsumner31/ngraph | 5e5c9bb9f24d95aee190b914dd2d44122fc3be53 | [
"Apache-2.0"
] | 11 | 2018-06-16T15:59:08.000Z | 2021-03-06T00:45:30.000Z | # ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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.apa... | 34.704433 | 93 | 0.690277 |
c672aef23bbfc0d5ba55d84917d192681a65c318 | 589 | py | Python | manti_by/apps/blog/migrations/0014_auto_20180619_1106.py | manti-by/m2 | ee2d2bad412c265962675c94dbfd29cdec07910c | [
"BSD-3-Clause"
] | 2 | 2017-09-07T09:28:29.000Z | 2018-04-10T03:03:32.000Z | manti_by/apps/blog/migrations/0014_auto_20180619_1106.py | manti-by/m2 | ee2d2bad412c265962675c94dbfd29cdec07910c | [
"BSD-3-Clause"
] | 11 | 2021-03-23T13:59:39.000Z | 2022-02-02T10:16:58.000Z | manti_by/apps/blog/migrations/0014_auto_20180619_1106.py | manti-by/Manti.by | ee2d2bad412c265962675c94dbfd29cdec07910c | [
"BSD-3-Clause"
] | null | null | null | # Generated by Django 1.11.13 on 2018-06-19 11:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("blog", "0013_auto_20180525_1219")]
operations = [
migrations.AddField(
model_name="post",
name="updated",
field=mod... | 26.772727 | 87 | 0.611205 |
d7d4c7ad012e3b43e9009c14cb452f44156e6b61 | 2,007 | py | Python | LogOX/main.py | MrEluzium/LogOX | fb1242be0bab223efa7837e9d319232f7a0cd80e | [
"Apache-2.0"
] | 3 | 2022-01-22T18:41:39.000Z | 2022-02-05T13:52:11.000Z | LogOX/main.py | MrEluzium/LogOX | fb1242be0bab223efa7837e9d319232f7a0cd80e | [
"Apache-2.0"
] | null | null | null | LogOX/main.py | MrEluzium/LogOX | fb1242be0bab223efa7837e9d319232f7a0cd80e | [
"Apache-2.0"
] | 1 | 2022-02-23T09:41:06.000Z | 2022-02-23T09:41:06.000Z | """
Copyright 2022 Artem Voronov <mreluzium@mail.ru>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law... | 31.857143 | 113 | 0.709018 |
bd9b1bf39d0b5c82f80912c43597a171e265792b | 509 | py | Python | docs_src/async_methods/query_single/example.py | samnimoh/pydapper | 28e02a82339c4373aae043483868c84946e4aca9 | [
"MIT"
] | 19 | 2022-01-19T15:30:57.000Z | 2022-03-10T15:15:56.000Z | docs_src/async_methods/query_single/example.py | samnimoh/pydapper | 28e02a82339c4373aae043483868c84946e4aca9 | [
"MIT"
] | 17 | 2022-01-19T06:23:35.000Z | 2022-03-06T17:09:25.000Z | docs_src/async_methods/query_single/example.py | samnimoh/pydapper | 28e02a82339c4373aae043483868c84946e4aca9 | [
"MIT"
] | 2 | 2022-02-05T02:18:02.000Z | 2022-02-17T08:39:54.000Z | import asyncio
import datetime
from dataclasses import dataclass
from pydapper import connect_async
@dataclass
class Task:
id: int
description: str
due_date: datetime.date
owner_id: int
async def main():
async with connect_async() as commands:
task = await commands.query_single_async("s... | 20.36 | 104 | 0.711198 |
c9d9d70a62c52580b221ccfbcf8cb99754d78f51 | 6,296 | py | Python | locobot/test/test_interpreter_mock.py | Dhiraj100892/droidlet | e4ea578672531524552b6ff021165fc9371b0ec8 | [
"MIT"
] | null | null | null | locobot/test/test_interpreter_mock.py | Dhiraj100892/droidlet | e4ea578672531524552b6ff021165fc9371b0ec8 | [
"MIT"
] | null | null | null | locobot/test/test_interpreter_mock.py | Dhiraj100892/droidlet | e4ea578672531524552b6ff021165fc9371b0ec8 | [
"MIT"
] | null | null | null | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
import unittest
import sys
import os
BASE_DIR = os.path.join(os.path.dirname(__file__), "../../")
sys.path.append(BASE_DIR)
import numpy as np
from base_fakeagent_test_case import BaseFakeAgentTestCase
import rotation
from all_test_commands import MOVE_COMMAN... | 30.563107 | 99 | 0.629447 |
47b2c4864606d4566c19f7b41f90b7937c7127b5 | 374 | py | Python | apps/asset/serializer/idc.py | plsof/tabops_api | 39f5d2fd5158ae0c22e43ab6ff7e2b07a68a62d8 | [
"MIT"
] | 1 | 2019-07-31T07:34:38.000Z | 2019-07-31T07:34:38.000Z | apps/asset/serializer/idc.py | plsof/tabops_api | 39f5d2fd5158ae0c22e43ab6ff7e2b07a68a62d8 | [
"MIT"
] | 9 | 2019-12-05T00:39:29.000Z | 2022-02-10T14:13:29.000Z | apps/asset/serializer/idc.py | plsof/tabops_api | 39f5d2fd5158ae0c22e43ab6ff7e2b07a68a62d8 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from ..models import Idc
class IdcSerializer(serializers.ModelSerializer):
isp_name = serializers.SerializerMethodField()
class Meta:
model = Idc
fields = ['id', 'name', 'address', 'isp', 'bandwidth', 'ip_range', 'comment', 'isp_name']
def get_isp_... | 24.933333 | 97 | 0.681818 |
fc1cd0da6bddf183b034db63f73a3ae6d2bcb57e | 261 | py | Python | Leetcode/0078. Subsets/0078.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | Leetcode/0078. Subsets/0078.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | Leetcode/0078. Subsets/0078.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
ans = []
def dfs(s: int, path: List[int]) -> None:
ans.append(path)
for i in range(s, len(nums)):
dfs(i + 1, path + [nums[i]])
dfs(0, [])
return ans
| 20.076923 | 56 | 0.521073 |
63690e89fc7c44fce7014ed4d889f0d77ae5360c | 7,457 | py | Python | tests/unit_tests/test_simulator.py | larioandr/pydesim | 4b04c07ddff71be0771270301c90cffb91886083 | [
"MIT"
] | 1 | 2020-09-08T11:28:21.000Z | 2020-09-08T11:28:21.000Z | tests/unit_tests/test_simulator.py | larioandr/pydesim | 4b04c07ddff71be0771270301c90cffb91886083 | [
"MIT"
] | null | null | null | tests/unit_tests/test_simulator.py | larioandr/pydesim | 4b04c07ddff71be0771270301c90cffb91886083 | [
"MIT"
] | null | null | null | from unittest.mock import patch, ANY, Mock
import pytest
from pydesim import simulate, Model
def test_simulate_signature():
ret = simulate({}, init=None, fin=None, handlers={}, stime_limit=1)
assert ret.stime == 0
assert ret.data == {}
def test_simulate_executes_init_and_fin():
"""In... | 26.727599 | 80 | 0.603326 |
f88d87f82450aa8525f098a1687cfb94ccc080d3 | 275 | py | Python | bstnode.py | Vlada04/bst | bda30f5e5bf55426c996b49f018aed5e9919e169 | [
"MIT"
] | null | null | null | bstnode.py | Vlada04/bst | bda30f5e5bf55426c996b49f018aed5e9919e169 | [
"MIT"
] | null | null | null | bstnode.py | Vlada04/bst | bda30f5e5bf55426c996b49f018aed5e9919e169 | [
"MIT"
] | null | null | null | """
File: bstnode.py
Author: Ken Lambert
"""
class BSTNode(object):
"""Represents a node for a linked binary search tree."""
def __init__(self, data, left = None, right = None):
self.data = data
self.left = left
self.right = right | 22.916667 | 61 | 0.589091 |
f22e11f52ab9d95b91cc4fb8d4ea20a8c6e39356 | 272 | py | Python | tests/prime_number/sieve_of_eratosthenes/std.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | tests/prime_number/sieve_of_eratosthenes/std.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | tests/prime_number/sieve_of_eratosthenes/std.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | from kgmk.dsa.number_theory.sieve_of_eratosthenes import (
SieveOfEratosthenes,
)
def test():
fn = SieveOfEratosthenes()
a = fn(1000000)
print(a[:10])
a = fn.gpf(10000)
print(a[:10])
a = fn.lpf(10000)
print(a[:10])
if __name__ == '__main__':
test() | 14.315789 | 58 | 0.647059 |
3edae763099237eefaba2e1b52f56533c2013a1d | 304 | py | Python | modules/2.79/bpy/types/BevelModifier.py | cmbasnett/fake-bpy-module | acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55 | [
"MIT"
] | null | null | null | modules/2.79/bpy/types/BevelModifier.py | cmbasnett/fake-bpy-module | acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55 | [
"MIT"
] | null | null | null | modules/2.79/bpy/types/BevelModifier.py | cmbasnett/fake-bpy-module | acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55 | [
"MIT"
] | null | null | null | class BevelModifier:
angle_limit = None
edge_weight_method = None
limit_method = None
loop_slide = None
material = None
offset_type = None
profile = None
segments = None
use_clamp_overlap = None
use_only_vertices = None
vertex_group = None
width = None
| 17.882353 | 29 | 0.664474 |
7d4376004027f161aa144bd29483c01cbea342bb | 25,412 | py | Python | test/test_post_flag_scheduled_changes_input.py | launchdarkly/api-client-python | b72bd94fb65ac57bd95df5767aebcdaff50e5cb6 | [
"Apache-2.0"
] | 6 | 2020-02-06T20:17:25.000Z | 2021-12-28T20:13:34.000Z | test/test_post_flag_scheduled_changes_input.py | launchdarkly/api-client-python | b72bd94fb65ac57bd95df5767aebcdaff50e5cb6 | [
"Apache-2.0"
] | 7 | 2019-02-18T21:51:47.000Z | 2021-09-03T17:49:33.000Z | test/test_post_flag_scheduled_changes_input.py | launchdarkly/api-client-python | b72bd94fb65ac57bd95df5767aebcdaff50e5cb6 | [
"Apache-2.0"
] | 6 | 2019-08-02T16:10:31.000Z | 2021-05-23T17:47:03.000Z | # -*- coding: utf-8 -*-
"""
LaunchDarkly REST API
# Overview ## Authentication All REST API resources are authenticated with either [personal or service access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens), or session cookies. Other authentication mechanisms are not supporte... | 619.804878 | 24,467 | 0.670549 |
dbd970b555c1e21de460bb8d0a973a4aefe96a28 | 135,629 | py | Python | python/cudf/cudf/core/column/string.py | mingwandroid/cudf | 6a406ba8ca9918ef0757ac25c0a6acd383edc905 | [
"Apache-2.0"
] | null | null | null | python/cudf/cudf/core/column/string.py | mingwandroid/cudf | 6a406ba8ca9918ef0757ac25c0a6acd383edc905 | [
"Apache-2.0"
] | null | null | null | python/cudf/cudf/core/column/string.py | mingwandroid/cudf | 6a406ba8ca9918ef0757ac25c0a6acd383edc905 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2019-2020, NVIDIA CORPORATION.
import pickle
import warnings
import cupy
import numpy as np
import pandas as pd
import pyarrow as pa
import cudf
from cudf import _lib as libcudf
from cudf._lib import string_casting as str_cast
from cudf._lib.column import Column
from cudf._lib.nvtext.generate_ngrams i... | 30.086291 | 119 | 0.534075 |
6e8cc35961241be2a921d45cead66fa77614f1ea | 3,987 | py | Python | layers/layer1_python3/0200_mflog/mflog/__init__.py | thefab/mfcom-1 | f6a209edb22a782dfb0cf63cc0f62433b1b6e961 | [
"BSD-3-Clause"
] | null | null | null | layers/layer1_python3/0200_mflog/mflog/__init__.py | thefab/mfcom-1 | f6a209edb22a782dfb0cf63cc0f62433b1b6e961 | [
"BSD-3-Clause"
] | null | null | null | layers/layer1_python3/0200_mflog/mflog/__init__.py | thefab/mfcom-1 | f6a209edb22a782dfb0cf63cc0f62433b1b6e961 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import os
import logging
import logging.config
import json
from jinja2 import Template
MFLOG_DEFAULT_CONFIG_PATH = \
os.path.join(os.environ.get('MFCOM_HOME', ''), "config",
"python_default_logging.json")
MFLOG_CONFIG_PATH = \
os.path.join(os.environ.get('MODULE_HOME',... | 36.577982 | 79 | 0.672686 |
f9a4f680b0d07eeb51492fe707dbb2cdf25367fc | 8,281 | py | Python | plot_helper.py | nadanai263/MCMC_emcee_intro | a0664ad39dff46bdb660b355abe7ec19b92134d7 | [
"MIT"
] | 1 | 2019-03-01T08:05:43.000Z | 2019-03-01T08:05:43.000Z | plot_helper.py | nadanai263/MCMC_emcee_intro | a0664ad39dff46bdb660b355abe7ec19b92134d7 | [
"MIT"
] | null | null | null | plot_helper.py | nadanai263/MCMC_emcee_intro | a0664ad39dff46bdb660b355abe7ec19b92134d7 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
from matplotlib.ticker import MaxNLocator
import cycler as cycler
def plot1(x,y,xlabel='x',ylabel='y',legend=False,title=False):
plt.close("all")
my_dpi=150
figure_optio... | 28.653979 | 101 | 0.689168 |
a8954abba24f193f27a2cfc877c344130ea80b21 | 5,035 | py | Python | plasmapy/plasma/sources/plasmablob.py | Quettle/PlasmaPy | 9689c83b991832c32158cca8b3f94525b59bde18 | [
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-1-Clause",
"BSD-3-Clause"
] | 2 | 2020-09-16T08:53:45.000Z | 2022-01-29T18:00:10.000Z | plasmapy/plasma/sources/plasmablob.py | RAJAGOPALAN-GANGADHARAN/PlasmaPy | 6df9583cc47375687a07300c0aa11ba31634d770 | [
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-1-Clause",
"BSD-3-Clause"
] | null | null | null | plasmapy/plasma/sources/plasmablob.py | RAJAGOPALAN-GANGADHARAN/PlasmaPy | 6df9583cc47375687a07300c0aa11ba31634d770 | [
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-1-Clause",
"BSD-3-Clause"
] | null | null | null | """
Defines the core Plasma class used by PlasmaPy to represent plasma properties.
"""
__all__ = ["PlasmaBlob"]
import astropy.units as u
import warnings
from plasmapy.formulary.collisions import coupling_parameter
from plasmapy.formulary.dimensionless import quantum_theta
from plasmapy.formulary.parameters import _g... | 31.080247 | 90 | 0.606356 |
320fccff94a8fef884c43348112506dff6e93e45 | 2,614 | py | Python | omniapp/screens/mainScreen/mainScreen.py | omniaura/omnisynth-gui | a14c6fdeff6e10d65cbbd46f3c9d6929fc6231a2 | [
"Apache-2.0"
] | null | null | null | omniapp/screens/mainScreen/mainScreen.py | omniaura/omnisynth-gui | a14c6fdeff6e10d65cbbd46f3c9d6929fc6231a2 | [
"Apache-2.0"
] | 1 | 2022-01-04T20:32:26.000Z | 2022-01-04T20:32:26.000Z | omniapp/screens/mainScreen/mainScreen.py | omniaura/omnisynth-gui | a14c6fdeff6e10d65cbbd46f3c9d6929fc6231a2 | [
"Apache-2.0"
] | null | null | null | # Defining all the screens for ScreenManager
from omniapp.constants import OMNISYNTH_PATH
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.screenmanager import Screen
from kivy.properties import BooleanProperty
from kivy.lang import Builder
from kivy.uix.wid... | 35.324324 | 93 | 0.672915 |
15fecb3563eadd04bbf44a444340fd01ba16267a | 675 | py | Python | pyopendds/Subscriber.py | iguessthislldo/pyopendds | edc8f698f24728d1faca20c8039024739d7c2972 | [
"MIT"
] | 5 | 2018-11-04T21:16:29.000Z | 2019-12-24T02:24:43.000Z | pyopendds/Subscriber.py | iguessthislldo/pyopendds | edc8f698f24728d1faca20c8039024739d7c2972 | [
"MIT"
] | 9 | 2019-07-19T05:39:30.000Z | 2020-02-06T02:39:58.000Z | pyopendds/Subscriber.py | iguessthislldo/pyopendds | edc8f698f24728d1faca20c8039024739d7c2972 | [
"MIT"
] | 2 | 2019-07-18T07:22:37.000Z | 2019-07-26T03:13:41.000Z | from __future__ import annotations
from typing import TYPE_CHECKING, List
from .DataReader import DataReader
from .Topic import Topic
if TYPE_CHECKING:
from .DomainParticipant import DomainParticipant
class Subscriber:
def __init__(self, participant: DomainParticipant, qos=None, listener=None):
part... | 29.347826 | 80 | 0.733333 |
529709ad6dc4bc319b8cdf0356178a48a56a805d | 735 | py | Python | care/base/context_processors.py | tobast/care | 03dd4a5095b5f7c53e53fc771a31b149876e4b50 | [
"MIT"
] | 1 | 2021-11-06T12:59:07.000Z | 2021-11-06T12:59:07.000Z | care/base/context_processors.py | tobast/care | 03dd4a5095b5f7c53e53fc771a31b149876e4b50 | [
"MIT"
] | null | null | null | care/base/context_processors.py | tobast/care | 03dd4a5095b5f7c53e53fc771a31b149876e4b50 | [
"MIT"
] | null | null | null | from care.userprofile.models import UserProfile
from care.groupaccountinvite.models import GroupAccountInvite
def base_context(request):
""" Add some basic context to every page """
context = {}
if request.user.is_authenticated:
user_profile = UserProfile.objects.get(user=request.user)
inv... | 36.75 | 68 | 0.687075 |
f74f31c008764067d236e426a04117c1f847fea3 | 22,768 | py | Python | tests/test_macsec.py | superchild/sonic-swss | 0f069108215ec5cb456e87554309ee99febb302d | [
"Apache-2.0"
] | null | null | null | tests/test_macsec.py | superchild/sonic-swss | 0f069108215ec5cb456e87554309ee99febb302d | [
"Apache-2.0"
] | 1 | 2022-01-21T20:05:43.000Z | 2022-01-25T19:17:40.000Z | tests/test_macsec.py | superchild/sonic-swss | 0f069108215ec5cb456e87554309ee99febb302d | [
"Apache-2.0"
] | null | null | null | from swsscommon import swsscommon
import conftest
import sys
import functools
import typing
import re
import time
def to_string(value):
if isinstance(value, bool):
return "true" if value else "false"
return str(value)
class Table(object):
def __init__(self, database: conftest.DVSDatabase, table... | 30.116402 | 87 | 0.549895 |
b3eea5a37c4caa9d2daf7f971c1ca72c6887b18d | 3,583 | py | Python | geomesa-spark/geomesa_pyspark/src/test/python/test_types.py | khobbs-ccri/geomesa | 09b5c503c55be11b343f3a6e559b9a3cfb7f76d7 | [
"Apache-2.0"
] | 1,197 | 2015-01-08T18:50:52.000Z | 2022-03-31T04:10:26.000Z | geomesa-spark/geomesa_pyspark/src/test/python/test_types.py | khobbs-ccri/geomesa | 09b5c503c55be11b343f3a6e559b9a3cfb7f76d7 | [
"Apache-2.0"
] | 1,307 | 2015-01-05T21:25:30.000Z | 2022-03-30T17:00:49.000Z | geomesa-spark/geomesa_pyspark/src/test/python/test_types.py | khobbs-ccri/geomesa | 09b5c503c55be11b343f3a6e559b9a3cfb7f76d7 | [
"Apache-2.0"
] | 436 | 2015-01-26T15:44:18.000Z | 2022-03-14T18:50:04.000Z | from geomesa_pyspark.types import *
from shapely.wkt import loads
from unittest import TestCase, main
class PointUDTTest(TestCase):
udt = Point.__UDT__
def test_udt(self):
self.assertIsInstance(self.udt, PointUDT)
def test_udt_roundtrip(self):
wkt = "POINT (30 10)"
g = loads(wkt... | 27.992188 | 97 | 0.639129 |
398b3adc68edb142da84c3453af098d6c61526a8 | 7,195 | py | Python | service_matcher_app/service_matcher/utils.py | City-of-Turku/PaohServiceMatchEngine | 39f580003f9c0d10708acd93644f796f764ec2f0 | [
"MIT"
] | null | null | null | service_matcher_app/service_matcher/utils.py | City-of-Turku/PaohServiceMatchEngine | 39f580003f9c0d10708acd93644f796f764ec2f0 | [
"MIT"
] | null | null | null | service_matcher_app/service_matcher/utils.py | City-of-Turku/PaohServiceMatchEngine | 39f580003f9c0d10708acd93644f796f764ec2f0 | [
"MIT"
] | null | null | null | import logging
import re
import numpy as np
from typing import Optional
from .models import *
PROVINCE_CODES = ["02"]
class ServiceMatcherUtils():
"""
A class for various auxillary functions related to service matching
"""
def __init__(self) -> None:
pass
def _filter_service_data_by_mun... | 49.965278 | 241 | 0.620014 |
b2cf74795375349ffe6dbe785252fe83e6b3d14e | 10,087 | py | Python | ilm/distill_classic.py | asappresearch/neural-ilm | fd7e09960525391f4084a5753429deabd7ff00aa | [
"MIT"
] | null | null | null | ilm/distill_classic.py | asappresearch/neural-ilm | fd7e09960525391f4084a5753429deabd7ff00aa | [
"MIT"
] | null | null | null | ilm/distill_classic.py | asappresearch/neural-ilm | fd7e09960525391f4084a5753429deabd7ff00aa | [
"MIT"
] | 2 | 2021-02-25T04:42:14.000Z | 2021-02-25T04:43:06.000Z | """
run a classic distillation, from deep model to shallow model
forked from ilm_distill.py, 5 apr 2019
"""
import torch
from torch import nn, optim, autograd
import torch.nn.functional as F
import numpy as np
import argparse
import math
from os.path import expanduser as expand
from torchvision import datasets, transf... | 36.284173 | 165 | 0.575592 |
19582785128ccb31df4c48c417ca54a649adc73e | 5,864 | py | Python | pysync.py | plinecom/pysync | c0b5c5ccb38b214be2b5cf5d4686eabdbadd8553 | [
"MIT"
] | 1 | 2020-05-04T02:22:15.000Z | 2020-05-04T02:22:15.000Z | pysync.py | plinecom/pysync | c0b5c5ccb38b214be2b5cf5d4686eabdbadd8553 | [
"MIT"
] | null | null | null | pysync.py | plinecom/pysync | c0b5c5ccb38b214be2b5cf5d4686eabdbadd8553 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import sys
import os
import os.path
import time
import shutil
def listup(srcRoot, destRoot, oldRoot, relativePath):
srcPath = os.path.join(srcRoot, relativePath)
destPath = os.path.join(destRoot, relativePath)
oldPath = os.path.join(oldRoot, relativePath)
# System::String ^ src... | 29.32 | 100 | 0.527115 |
b8a3551a0c50ea5a4a86670c980f7278187316b2 | 554 | py | Python | orb_simulator/lexer/regex_ast/__init__.py | dmguezjaviersnet/IA-Sim-Comp-Project | 8165b9546efc45f98091a3774e2dae4f45942048 | [
"MIT"
] | 1 | 2022-01-19T22:49:09.000Z | 2022-01-19T22:49:09.000Z | orb_simulator/lexer/regex_ast/__init__.py | dmguezjaviersnet/IA-Sim-Comp-Project | 8165b9546efc45f98091a3774e2dae4f45942048 | [
"MIT"
] | 15 | 2021-11-10T14:25:02.000Z | 2022-02-12T19:17:11.000Z | orb_simulator/lexer/regex_ast/__init__.py | dmguezjaviersnet/IA-Sim-Comp-Project | 8165b9546efc45f98091a3774e2dae4f45942048 | [
"MIT"
] | null | null | null | from lexer.regex_ast.regex_node import Node
from lexer.regex_ast.regex_atomic_node import AtomicNode
from lexer.regex_ast.regex_binary_node import BinaryNode
from lexer.regex_ast.regex_concat_node import ConcatNode
from lexer.regex_ast.regex_closure_node import ClosureNode
from lexer.regex_ast.regex_epsilon_node import... | 55.4 | 58 | 0.893502 |
e336bc89d334aa97eb29ace99e033e12f6422129 | 1,742 | py | Python | src/figures/multi_instrument_analysis.py | LauraOlivera/gammapy-v1.0-paper | 212b87975575347e0249746c9e5a490e1bc549a5 | [
"MIT"
] | 1 | 2022-02-14T22:42:34.000Z | 2022-02-14T22:42:34.000Z | src/figures/multi_instrument_analysis.py | LauraOlivera/gammapy-v1.0-paper | 212b87975575347e0249746c9e5a490e1bc549a5 | [
"MIT"
] | 24 | 2022-02-07T15:04:27.000Z | 2022-03-31T20:12:56.000Z | src/figures/multi_instrument_analysis.py | LauraOlivera/gammapy-v1.0-paper | 212b87975575347e0249746c9e5a490e1bc549a5 | [
"MIT"
] | 10 | 2022-01-27T20:22:15.000Z | 2022-03-08T17:17:18.000Z | import config
import astropy.units as u
from gammapy.estimators import FluxPoints
from gammapy.modeling.models import Models
import matplotlib.pyplot as plt
sed_x_label = r"$E\,/\,{\rm TeV}$"
sed_y_label = (
r"$E^2\,{\rm d}\phi/{\rm d}\phi\,/\,({\rm erg}\,{\rm cm}^{-2}\,{\rm s}^{-1})$"
)
figsize = config.FigureSi... | 34.156863 | 87 | 0.726177 |
0a8b6b139ab38b2c90c026e58ebfa8a15b6c6fb7 | 1,844 | py | Python | src/179.largest-number/179.largest-number.py | AnestLarry/LeetCodeAnswer | ca06a9cabe72879812f4b41d68ec882139974d84 | [
"MIT"
] | null | null | null | src/179.largest-number/179.largest-number.py | AnestLarry/LeetCodeAnswer | ca06a9cabe72879812f4b41d68ec882139974d84 | [
"MIT"
] | null | null | null | src/179.largest-number/179.largest-number.py | AnestLarry/LeetCodeAnswer | ca06a9cabe72879812f4b41d68ec882139974d84 | [
"MIT"
] | null | null | null | #
# @lc app=leetcode id=179 lang=python3
#
# [179] Largest Number
#
# Given a list of non negative integers, arrange them such that they form the largest number.
# Example 1:
# Input: [10,2]
# Output: "210"
# Example 2:
# Input: [3,30,34,5,9]
# Output: "9534330"
# Note: The result may be very large, so you need to r... | 30.229508 | 93 | 0.517896 |
2ab3c0e970125048471e9cfab721c1292b4aa723 | 185,657 | py | Python | src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py | GaneshaThirumurthi/azure-cli | 72850c4a1ca0f2d36ad6dce319bd22e59ad387e1 | [
"MIT"
] | null | null | null | src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py | GaneshaThirumurthi/azure-cli | 72850c4a1ca0f2d36ad6dce319bd22e59ad387e1 | [
"MIT"
] | null | null | null | src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py | GaneshaThirumurthi/azure-cli | 72850c4a1ca0f2d36ad6dce319bd22e59ad387e1 | [
"MIT"
] | null | null | null | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 57.639553 | 239 | 0.628223 |
02fc56f292604959ff994c67f2d8d154db9bc21c | 1,217 | py | Python | flask_blog_api/public/forms.py | dannydabbles/flask_blog_api | a2eda67d8ea1b35a3a1263ec288565b6254af34c | [
"MIT"
] | 1 | 2020-03-04T16:02:47.000Z | 2020-03-04T16:02:47.000Z | flask_blog_api/public/forms.py | dannydabbles/flask_blog_api | a2eda67d8ea1b35a3a1263ec288565b6254af34c | [
"MIT"
] | null | null | null | flask_blog_api/public/forms.py | dannydabbles/flask_blog_api | a2eda67d8ea1b35a3a1263ec288565b6254af34c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import FlaskForm
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from flask_blog_api.user.models import User
class LoginForm(FlaskForm):
"""Login form."""
username = StringField("Username", validators=[Data... | 30.425 | 77 | 0.645029 |
c17e589c7bbba1061575d4168defde78e2c7a042 | 7,077 | py | Python | Question_model/answers/vgg19_chainer.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | Question_model/answers/vgg19_chainer.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | Question_model/answers/vgg19_chainer.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | import chainer
import chainer.links as L
import chainer.functions as F
import argparse
import cv2
import numpy as np
from glob import glob
num_classes = 2
img_height, img_width = 224, 224
GPU = -1
class Mynet(chainer.Chain):
def __init__(self, train=True):
self.train = train
super(Mynet, self).__i... | 30.769565 | 93 | 0.544157 |
de950c9ef18c999d8c40fac9c83b8e707cbae9dc | 668 | py | Python | trees/symmetric_tree/recursion.py | sweeneyngo/algo | 9c63cef40b97d51e018fbbf537c8f59b811b2d19 | [
"MIT"
] | null | null | null | trees/symmetric_tree/recursion.py | sweeneyngo/algo | 9c63cef40b97d51e018fbbf537c8f59b811b2d19 | [
"MIT"
] | null | null | null | trees/symmetric_tree/recursion.py | sweeneyngo/algo | 9c63cef40b97d51e018fbbf537c8f59b811b2d19 | [
"MIT"
] | null | null | null | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
return self.checkMirror(root, root)
def checkMi... | 27.833333 | 60 | 0.585329 |
b5bad4b74e54e4fbe1dee121b6aff88cb68e4039 | 2,738 | py | Python | tests/api_resources/abstract/test_api_resource.py | timvisher/stripe-python | ae953fd0aa531f5b500e5e86eee5859df95a255d | [
"MIT"
] | null | null | null | tests/api_resources/abstract/test_api_resource.py | timvisher/stripe-python | ae953fd0aa531f5b500e5e86eee5859df95a255d | [
"MIT"
] | null | null | null | tests/api_resources/abstract/test_api_resource.py | timvisher/stripe-python | ae953fd0aa531f5b500e5e86eee5859df95a255d | [
"MIT"
] | null | null | null | from __future__ import absolute_import, division, print_function
import pytest
import stripe
class TestAPIResource(object):
class MyResource(stripe.api_resources.abstract.APIResource):
OBJECT_NAME = 'myresource'
def test_retrieve_and_refresh(self, request_mock):
url = '/v1/myresources/foo%2... | 26.843137 | 79 | 0.505844 |
37476b032f552d5fd4f43e57d4f5ab303374c7c4 | 2,180 | py | Python | je_auto_control/windows/record/win32_record.py | JE-Chen/Python_JEAutoControl | 477bf9612e28e9ab6d0a8e269db2f699e50a3744 | [
"MIT"
] | 9 | 2020-10-12T06:33:36.000Z | 2021-09-13T07:07:36.000Z | je_auto_control/windows/record/win32_record.py | JE-Chen/Python_JEAutoControl | 477bf9612e28e9ab6d0a8e269db2f699e50a3744 | [
"MIT"
] | 2 | 2021-11-19T13:45:37.000Z | 2021-12-03T12:25:28.000Z | je_auto_control/windows/record/win32_record.py | JE-Chen/Python_JEAutoControl | 477bf9612e28e9ab6d0a8e269db2f699e50a3744 | [
"MIT"
] | null | null | null | import sys
from je_auto_control.utils.exception.exception_tag import windows_import_error
from je_auto_control.utils.exception.exceptions import AutoControlException
if sys.platform not in ["win32", "cygwin", "msys"]:
raise AutoControlException(windows_import_error)
from je_auto_control.windows.listener.win32_ke... | 32.537313 | 90 | 0.738532 |
d6474dc035ca8af63f2e1b7bbbbaae9a48656db7 | 99,712 | py | Python | Dive-into-DL-paddlepaddle/docs/d2l/paddle.py | skywalk163/awesome-DeepLearning | 277d796fc5e7d9b31431160c5652a8319885f908 | [
"Apache-2.0"
] | 1 | 2022-03-14T09:03:15.000Z | 2022-03-14T09:03:15.000Z | Dive-into-DL-paddlepaddle/docs/d2l/paddle.py | jameszhang-236/awesome-DeepLearning | 422128eab5cff9c41b618280cbc1c0e064f45874 | [
"Apache-2.0"
] | null | null | null | Dive-into-DL-paddlepaddle/docs/d2l/paddle.py | jameszhang-236/awesome-DeepLearning | 422128eab5cff9c41b618280cbc1c0e064f45874 | [
"Apache-2.0"
] | null | null | null | ################# WARNING ################
# The below part is generated automatically through:
# d2lbook build lib
# Don't edit it directly
import collections
import hashlib
import math
import os
import random
import re
import shutil
import sys
import tarfile
import time
import zipfile
from col... | 39.041504 | 151 | 0.596177 |
a9206e5af5513cdc862300ca5b3cde2e68b2dd51 | 1,794 | py | Python | backend/server/apps/ml/tests.py | BlooAM/ML-WebService | f331ad24b5b43bccfcdd062aedcd9413f31d9097 | [
"MIT"
] | null | null | null | backend/server/apps/ml/tests.py | BlooAM/ML-WebService | f331ad24b5b43bccfcdd062aedcd9413f31d9097 | [
"MIT"
] | null | null | null | backend/server/apps/ml/tests.py | BlooAM/ML-WebService | f331ad24b5b43bccfcdd062aedcd9413f31d9097 | [
"MIT"
] | null | null | null | import inspect
from django.test import TestCase
from apps.ml.registry import MLRegistry
from apps.ml.income_classifier.random_forest import RandomForestClassifier
class MLTests(TestCase):
def test_rf_algorithm(self):
input_data = {
"age": 37,
"workclass": "Private",
"f... | 38.170213 | 97 | 0.61204 |
842cf6109379393d11e4922ae6f2a723a613c55b | 942 | py | Python | problem solutions/error_calc.py | suhailnajeeb/numerical-methods | b5f6189e5072407004e97d37edc83356e43449e9 | [
"MIT"
] | null | null | null | problem solutions/error_calc.py | suhailnajeeb/numerical-methods | b5f6189e5072407004e97d37edc83356e43449e9 | [
"MIT"
] | null | null | null | problem solutions/error_calc.py | suhailnajeeb/numerical-methods | b5f6189e5072407004e97d37edc83356e43449e9 | [
"MIT"
] | 1 | 2020-02-12T09:12:50.000Z | 2020-02-12T09:12:50.000Z | import numpy as np
a0 = 3.56
a1 = 1.4859
a2 = 2.025
x = np.array([1,2,3,4,5])
y = np.array([7.7, 14.5, 26, 40, 62])
xm = np.mean(x).round(4)
ym = np.mean(y).round(4)
print('mean of x: ' + str(xm))
print('mean of y: ' + str(ym))
st = lambda yi : np.square(yi - ym).round(4)
sr = lambda xi,yi : np.square(yi-a0-a1*xi-... | 20.933333 | 96 | 0.504246 |
1b0c11892ef3aa133d021c6ddd9006dc0cf33060 | 2,367 | py | Python | Knil Dungeon/Dialog.py | WexyR/KNIL | b81c5d4025d1f4e1607b0e948c4611cff0fdbc2e | [
"MIT"
] | null | null | null | Knil Dungeon/Dialog.py | WexyR/KNIL | b81c5d4025d1f4e1607b0e948c4611cff0fdbc2e | [
"MIT"
] | null | null | null | Knil Dungeon/Dialog.py | WexyR/KNIL | b81c5d4025d1f4e1607b0e948c4611cff0fdbc2e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import Menu
import Game
import Tools
def dialog_box_create(ROWS, COLS, percent_size_rows=0.25):
"""Initialise une boite de dialogue"""
assert isinstance(percent_size_rows, float) and 0 <= percent_size_rows
d = dict()
x = 1
y = int((ROWS-1) * (1-percent_size_rows))+1
d[... | 38.177419 | 173 | 0.606253 |
ad3130808f810af7366ef698ce92654fa1e16855 | 524 | py | Python | zinc/migrations/0004_zone_cached_ns_records.py | PressLabs/zinc | 9e1dc852f31f9897e7759962cf0f3e6d42fbe637 | [
"Apache-2.0"
] | 29 | 2017-06-29T15:03:49.000Z | 2018-01-30T14:07:26.000Z | zinc/migrations/0004_zone_cached_ns_records.py | presslabs/zinc | 94146e5203fc93ee0e8bb011a4db0ffcd4b0096e | [
"Apache-2.0"
] | 9 | 2019-01-11T09:07:17.000Z | 2022-02-03T12:50:21.000Z | zinc/migrations/0004_zone_cached_ns_records.py | PressLabs/zinc | 9e1dc852f31f9897e7759962cf0f3e6d42fbe637 | [
"Apache-2.0"
] | 1 | 2020-08-09T18:17:25.000Z | 2020-08-09T18:17:25.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-15 16:27
from __future__ import unicode_literals
from django.db import migrations, models
import zinc.models
class Migration(migrations.Migration):
dependencies = [
('zinc', '0003_zone_ns_propagated'),
]
operations = [
migr... | 23.818182 | 100 | 0.645038 |
e5c3b0c077867dca9511022145c9dbbd6a137532 | 2,406 | py | Python | sheets/snippets/sheets_batch_update.py | himanshupr2627/python-samples | 4a04e3aee1068dc1f1402e9e9c90044ff101a6c8 | [
"Apache-2.0"
] | 479 | 2018-03-16T16:45:11.000Z | 2020-10-13T11:32:02.000Z | sheets/snippets/sheets_batch_update.py | himanshupr2627/python-samples | 4a04e3aee1068dc1f1402e9e9c90044ff101a6c8 | [
"Apache-2.0"
] | 159 | 2018-03-28T20:03:56.000Z | 2020-10-13T06:00:08.000Z | sheets/snippets/sheets_batch_update.py | himanshupr2627/python-samples | 4a04e3aee1068dc1f1402e9e9c90044ff101a6c8 | [
"Apache-2.0"
] | 493 | 2018-03-21T01:07:21.000Z | 2020-10-14T10:31:00.000Z | """
Copyright 2022 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | 29.703704 | 77 | 0.640482 |
7fd2dd25859ec86ed4da264c4dfe89e82882c723 | 5,841 | py | Python | Processor/diode.py | george200150/Licenta | 9c3f7d86abf3cc5d90204db0acc956eb8bee26dc | [
"MIT"
] | null | null | null | Processor/diode.py | george200150/Licenta | 9c3f7d86abf3cc5d90204db0acc956eb8bee26dc | [
"MIT"
] | null | null | null | Processor/diode.py | george200150/Licenta | 9c3f7d86abf3cc5d90204db0acc956eb8bee26dc | [
"MIT"
] | null | null | null | import os.path as osp
from itertools import chain
import json
from torch.utils.data import Dataset
import numpy as np
from PIL import Image
import random
import matplotlib.pyplot as plt
'''
The json metadata for DIODE is laid out as follows:
train:
outdoor:
scene_000xx:
scan_00yyy:
... | 33.568966 | 121 | 0.594248 |
ca4dd67ec0aed2f8bf00d6183e24f2e58f704b39 | 8,639 | py | Python | far_ws/src/follow_ahead_rl/scripts/move_test.py | alik604/ra | 6058a9adb47db93bb86bcb2c224930c5731d663d | [
"Unlicense"
] | null | null | null | far_ws/src/follow_ahead_rl/scripts/move_test.py | alik604/ra | 6058a9adb47db93bb86bcb2c224930c5731d663d | [
"Unlicense"
] | 5 | 2021-03-26T01:30:13.000Z | 2021-04-22T22:19:03.000Z | far_ws/src/follow_ahead_rl/scripts/move_test.py | alik604/ra | 6058a9adb47db93bb86bcb2c224930c5731d663d | [
"Unlicense"
] | 1 | 2021-05-05T00:57:43.000Z | 2021-05-05T00:57:43.000Z | <<<<<<< HEAD
import gym
import gym_gazeboros_ac
from time import sleep
=======
import pickle
import math
import gym
import gym_gazeboros_ac
import numpy as np
import matplotlib.pyplot as plt
from time import sleep
import cv2 as cv
>>>>>>> MCTS
ENV_NAME = 'gazeborosAC-v0'
EPISODE_LEN = 15
# Robot Chase Simulator 2021... | 39.447489 | 214 | 0.593008 |
c89b2a10e803867fa6cc6af293cb6128f9e950fd | 7,220 | py | Python | hubspot/crm/extensions/calling/models/error_detail.py | cclauss/hubspot-api-python | 7c60c0f572b98c73e1f1816bf5981396a42735f6 | [
"Apache-2.0"
] | null | null | null | hubspot/crm/extensions/calling/models/error_detail.py | cclauss/hubspot-api-python | 7c60c0f572b98c73e1f1816bf5981396a42735f6 | [
"Apache-2.0"
] | null | null | null | hubspot/crm/extensions/calling/models/error_detail.py | cclauss/hubspot-api-python | 7c60c0f572b98c73e1f1816bf5981396a42735f6 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Calling Extensions API
Provides a way for apps to add custom calling options to a contact record. This works in conjunction with the [Calling SDK](#), which is used to build your phone/calling UI. The endpoints here allow your service to appear as an option to HubSpot users when they acces... | 30.59322 | 467 | 0.597091 |
300ac6b1f8141c26ff68562048669d787c7fd579 | 74,952 | py | Python | theano/tensor/subtensor.py | mrgloom/Theano | 018c7fa9a292858486b92e03a5d0a36cb3e45e1f | [
"BSD-3-Clause"
] | 1 | 2020-12-27T13:50:59.000Z | 2020-12-27T13:50:59.000Z | theano/tensor/subtensor.py | ynd/Theano | 5c89596df9e5d8ecafa7d4c0aa8f0f4eb393cd57 | [
"BSD-3-Clause"
] | null | null | null | theano/tensor/subtensor.py | ynd/Theano | 5c89596df9e5d8ecafa7d4c0aa8f0f4eb393cd57 | [
"BSD-3-Clause"
] | null | null | null | from copy import copy
from itertools import izip
import sys
from textwrap import dedent
import warnings
import logging
_logger = logging.getLogger("theano.tensor.subtensor")
import numpy
import theano
from theano.gradient import DisconnectedType
from theano import gof
from theano.gof import Apply, Constant, hashtype,... | 36.384466 | 94 | 0.5305 |
79052816aec8b76957540d72b3609cbf4bb76b0c | 1,528 | py | Python | src/commercetools/platform/client/matching_cart/by_project_key_shipping_methods_matching_cart_request_builder.py | lime-green/commercetools-python-sdk | 63b77f6e5abe43e2b3ebbf3cdbbe00c7cf80dca6 | [
"MIT"
] | 1 | 2021-04-07T20:01:30.000Z | 2021-04-07T20:01:30.000Z | src/commercetools/platform/client/matching_cart/by_project_key_shipping_methods_matching_cart_request_builder.py | lime-green/commercetools-python-sdk | 63b77f6e5abe43e2b3ebbf3cdbbe00c7cf80dca6 | [
"MIT"
] | null | null | null | src/commercetools/platform/client/matching_cart/by_project_key_shipping_methods_matching_cart_request_builder.py | lime-green/commercetools-python-sdk | 63b77f6e5abe43e2b3ebbf3cdbbe00c7cf80dca6 | [
"MIT"
] | null | null | null | # Generated file, please do not change!!!
import typing
from ...models.error import ErrorResponse
from ...models.shipping_method import ShippingMethodPagedQueryResponse
if typing.TYPE_CHECKING:
from ...base_client import BaseClient
class ByProjectKeyShippingMethodsMatchingCartRequestBuilder:
_client: "Base... | 32.510638 | 80 | 0.643979 |
f426afc0fcdbe383d46815ade7f64023f4dfe6ce | 1,917 | py | Python | test/test_get_transaction_details_by_transaction_id_from_callback_ribsl.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python | c59ebd914850622b2c6500c4c30af31fb9cecf0e | [
"MIT"
] | 5 | 2021-05-17T04:45:03.000Z | 2022-03-23T12:51:46.000Z | test/test_get_transaction_details_by_transaction_id_from_callback_ribsl.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python | c59ebd914850622b2c6500c4c30af31fb9cecf0e | [
"MIT"
] | null | null | null | test/test_get_transaction_details_by_transaction_id_from_callback_ribsl.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python | c59ebd914850622b2c6500c4c30af31fb9cecf0e | [
"MIT"
] | 2 | 2021-06-02T07:32:26.000Z | 2022-02-12T02:36:23.000Z | """
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | 46.756098 | 484 | 0.82264 |
f7977280429846a6a1a24bb202ae2f2a6ce767dd | 17,415 | py | Python | dvc/repo/experiments/executor/base.py | Sayanta66/dvc | 0d484d45f710b39c6baf541ac4d23aa983792aae | [
"Apache-2.0"
] | 1 | 2021-07-20T05:33:18.000Z | 2021-07-20T05:33:18.000Z | dvc/repo/experiments/executor/base.py | Sayanta66/dvc | 0d484d45f710b39c6baf541ac4d23aa983792aae | [
"Apache-2.0"
] | null | null | null | dvc/repo/experiments/executor/base.py | Sayanta66/dvc | 0d484d45f710b39c6baf541ac4d23aa983792aae | [
"Apache-2.0"
] | 1 | 2021-08-05T07:15:30.000Z | 2021-08-05T07:15:30.000Z | import logging
import os
import pickle
from abc import ABC, abstractmethod
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import (
TYPE_CHECKING,
Callable,
Iterable,
NamedTuple,
Optional,
Union,
)
from funcy import cached_proper... | 32.071823 | 79 | 0.558599 |
75b99fb192196d9b6bf4f8907baf56184748d30b | 6,334 | py | Python | gooey/tests/test_integration.py | jwaschkau/Gooey | 57b4f2e79b9d1e72325ee02179ead4a46b1d97a6 | [
"MIT"
] | null | null | null | gooey/tests/test_integration.py | jwaschkau/Gooey | 57b4f2e79b9d1e72325ee02179ead4a46b1d97a6 | [
"MIT"
] | null | null | null | gooey/tests/test_integration.py | jwaschkau/Gooey | 57b4f2e79b9d1e72325ee02179ead4a46b1d97a6 | [
"MIT"
] | null | null | null | import json
import time
import unittest
from concurrent import futures
from gooey.gui import application
from gooey.gui.lang.i18n import _
class TestGooeyIntegration(unittest.TestCase):
"""
A few quick integration tests that exercise Gooey's various run modes
WX Python needs to control the ma... | 37.47929 | 94 | 0.618251 |
800199a38d8cf1c5886f8347e4eb868d640f1b93 | 2,553 | py | Python | tests/test_indicator.py | alexcwyu/python-trading | a494f602411a3ebfdecae002a16a5ea93fc7a046 | [
"Apache-2.0"
] | 17 | 2016-03-30T21:52:30.000Z | 2021-05-01T18:21:48.000Z | tests/test_indicator.py | ajmal017/python-trading | a494f602411a3ebfdecae002a16a5ea93fc7a046 | [
"Apache-2.0"
] | 2 | 2016-10-04T19:29:05.000Z | 2017-02-01T19:24:39.000Z | tests/test_indicator.py | ajmal017/python-trading | a494f602411a3ebfdecae002a16a5ea93fc7a046 | [
"Apache-2.0"
] | 9 | 2016-04-24T05:05:26.000Z | 2020-05-03T13:01:34.000Z | from unittest import TestCase
from algotrader.trading.context import ApplicationContext
from algotrader.utils.indicator import parse_series, get_or_create_indicator
from algotrader.technical.ma import SMA
class IndicatorTest(TestCase):
def setUp(self):
self.app_context = ApplicationContext()
def test... | 39.276923 | 113 | 0.64669 |
232db6b8d3e673ec4e8d04319bbcaec1fad1c5d5 | 8,918 | py | Python | cryptoapis/model/list_transactions_by_block_height_response_item_blockchain_specific_dash_vin.py | xan187/Crypto_APIs_2.0_SDK_Python | a56c75df54ef037b39be1315ed6e54de35bed55b | [
"MIT"
] | null | null | null | cryptoapis/model/list_transactions_by_block_height_response_item_blockchain_specific_dash_vin.py | xan187/Crypto_APIs_2.0_SDK_Python | a56c75df54ef037b39be1315ed6e54de35bed55b | [
"MIT"
] | null | null | null | cryptoapis/model/list_transactions_by_block_height_response_item_blockchain_specific_dash_vin.py | xan187/Crypto_APIs_2.0_SDK_Python | a56c75df54ef037b39be1315ed6e54de35bed55b | [
"MIT"
] | 1 | 2021-07-21T03:35:18.000Z | 2021-07-21T03:35:18.000Z | """
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | 44.148515 | 484 | 0.6146 |
7ea4878b4ff0813016985329087ff75c6805e2cc | 2,371 | py | Python | Solutions/VMX2-VoicemailExpress/Code/sub_other.py | cbgandhi-code/amazon-connect-salesforce-scv | fc5da5445b01295e530b50aa774598e91087c57a | [
"Apache-2.0",
"CC0-1.0"
] | null | null | null | Solutions/VMX2-VoicemailExpress/Code/sub_other.py | cbgandhi-code/amazon-connect-salesforce-scv | fc5da5445b01295e530b50aa774598e91087c57a | [
"Apache-2.0",
"CC0-1.0"
] | null | null | null | Solutions/VMX2-VoicemailExpress/Code/sub_other.py | cbgandhi-code/amazon-connect-salesforce-scv | fc5da5445b01295e530b50aa774598e91087c57a | [
"Apache-2.0",
"CC0-1.0"
] | null | null | null | # Version: 2022.03.23
"""
**********************************************************************************************************************
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved *
* ... | 56.452381 | 119 | 0.518768 |
bc9d84411558123a05436a09a0577c76e61e4e5b | 140 | py | Python | scorecard/templatetags/jsonify.py | desafinadude/municipal-data | 1c86c55bbb59f9c8087f6920fae3585dd90d5d43 | [
"MIT"
] | 19 | 2018-01-09T10:54:15.000Z | 2022-01-25T13:10:55.000Z | wazimap/templatetags/jsonify.py | ChrisAchinga/wazimap | a66a1524030a8b98e7ea0dfb270d1946ca75b3b2 | [
"MIT"
] | 66 | 2016-02-15T08:59:29.000Z | 2017-09-21T14:00:43.000Z | wazimap/templatetags/jsonify.py | ChrisAchinga/wazimap | a66a1524030a8b98e7ea0dfb270d1946ca75b3b2 | [
"MIT"
] | 18 | 2017-10-06T12:26:37.000Z | 2021-08-30T01:38:37.000Z | import json
from django import template
register = template.Library()
@register.filter
def jsonify(value):
return json.dumps(value)
| 12.727273 | 29 | 0.757143 |
7fb03a28b0bb7be23f9ae112637c66d6ec603515 | 2,539 | py | Python | src/tox/session/commands/show_config.py | snsnlou/tox | 036dfaca03a8202be77ccc3ce70e1f1f17ece57c | [
"MIT"
] | 1 | 2021-07-07T01:46:02.000Z | 2021-07-07T01:46:02.000Z | src/tox/session/commands/show_config.py | snsnlou/tox | 036dfaca03a8202be77ccc3ce70e1f1f17ece57c | [
"MIT"
] | 20 | 2021-05-03T18:02:23.000Z | 2022-03-12T12:01:04.000Z | src/tox/session/commands/show_config.py | snsnlou/tox | 036dfaca03a8202be77ccc3ce70e1f1f17ece57c | [
"MIT"
] | 3 | 2021-04-15T06:17:40.000Z | 2021-09-14T04:17:59.000Z | import sys
from collections import OrderedDict
from packaging.requirements import Requirement
from packaging.utils import canonicalize_name
from six import StringIO
from six.moves import configparser
from tox import reporter
from tox.util.stdlib import importlib_metadata
DO_NOT_SHOW_CONFIG_ATTRIBUTES = (
"interp... | 29.870588 | 86 | 0.664829 |
01fb516c83f0e4393acb7127cb904fddb3bd860a | 770 | py | Python | Raspberry_Pi_Pico/button_test.py | jckantor/cbe61622 | bdc08e6c4f0674c5e991617945cafd1b121d6b4b | [
"MIT"
] | 2 | 2021-11-22T20:36:35.000Z | 2021-12-07T07:52:10.000Z | Raspberry_Pi_Pico/button_test.py | jckantor/cbe-virtual-laboratory | bdc08e6c4f0674c5e991617945cafd1b121d6b4b | [
"MIT"
] | null | null | null | Raspberry_Pi_Pico/button_test.py | jckantor/cbe-virtual-laboratory | bdc08e6c4f0674c5e991617945cafd1b121d6b4b | [
"MIT"
] | 1 | 2021-12-11T20:39:32.000Z | 2021-12-11T20:39:32.000Z |
from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
from time import sleep
import sys
@asm_pio(set_init=(PIO.OUT_LOW,) * 4)
def prog():
wrap_target()
set(pins, 8) [31] # 8
nop() [31]
nop() [31]
nop() [31]
nop() [31]
nop() [31]
nop() [31]
set(pins, 4) [31] # 4
no... | 16.041667 | 56 | 0.487013 |
8b2d760e2abd047fba953c34620f1f66ae437ef9 | 263 | py | Python | tests/artificial/transf_Fisher/trend_MovingMedian/cycle_7/ar_/test_artificial_128_Fisher_MovingMedian_7__0.py | shaido987/pyaf | b9afd089557bed6b90b246d3712c481ae26a1957 | [
"BSD-3-Clause"
] | 377 | 2016-10-13T20:52:44.000Z | 2022-03-29T18:04:14.000Z | tests/artificial/transf_Fisher/trend_MovingMedian/cycle_7/ar_/test_artificial_128_Fisher_MovingMedian_7__0.py | ysdede/pyaf | b5541b8249d5a1cfdc01f27fdfd99b6580ed680b | [
"BSD-3-Clause"
] | 160 | 2016-10-13T16:11:53.000Z | 2022-03-28T04:21:34.000Z | tests/artificial/transf_Fisher/trend_MovingMedian/cycle_7/ar_/test_artificial_128_Fisher_MovingMedian_7__0.py | ysdede/pyaf | b5541b8249d5a1cfdc01f27fdfd99b6580ed680b | [
"BSD-3-Clause"
] | 63 | 2017-03-09T14:51:18.000Z | 2022-03-27T20:52:57.000Z | import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 7, transform = "Fisher", sigma = 0.0, exog_count = 0, ar_order = 0); | 37.571429 | 163 | 0.730038 |
34d7fa6a9721c48429b22da3bbfef67aa499bb5a | 9,282 | py | Python | pims/formats/utils/abstract.py | Cytomine-ULiege/pims | 3c13f054be3ce9b6755428ccd9c5e0c1a8fb02d4 | [
"Apache-2.0"
] | 2 | 2022-01-19T08:58:12.000Z | 2022-01-28T14:40:41.000Z | pims/formats/utils/abstract.py | Cytomine-ULiege/pims | 3c13f054be3ce9b6755428ccd9c5e0c1a8fb02d4 | [
"Apache-2.0"
] | 18 | 2021-09-20T08:47:11.000Z | 2022-03-14T15:51:37.000Z | pims/formats/utils/abstract.py | Cytomine-ULiege/pims | 3c13f054be3ce9b6755428ccd9c5e0c1a8fb02d4 | [
"Apache-2.0"
] | null | null | null | # * Copyright (c) 2020-2021. Authors: see NOTICE file.
# *
# * 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 ... | 30.94 | 87 | 0.648028 |
01c9e895234998512a96bc9e6a171dae8990d6ad | 12,240 | py | Python | beastbot/utility/vec.py | NicEastvillage/RLBot-Beast | 1d178cd79a22a4d2d9b22341906bb810c3f8659b | [
"MIT"
] | 8 | 2019-04-24T12:16:30.000Z | 2021-12-23T14:35:57.000Z | beastbot/utility/vec.py | NicEastvillage/RLBot-Beast | 1d178cd79a22a4d2d9b22341906bb810c3f8659b | [
"MIT"
] | null | null | null | beastbot/utility/vec.py | NicEastvillage/RLBot-Beast | 1d178cd79a22a4d2d9b22341906bb810c3f8659b | [
"MIT"
] | 2 | 2018-12-16T16:59:00.000Z | 2021-12-23T14:36:04.000Z | import math
from utility.rlmath import clip
class Vec3:
def __init__(self, x: float or 'Vec3'=0.0, y: float=0.0, z: float=0.0):
if hasattr(x, 'x'):
# We have been given a vector. Copy it
self.x = float(x.x)
self.y = float(x.y) if hasattr(x, 'y') else 0
self... | 31.465296 | 109 | 0.51781 |
d257e5f3201f4d6c4cb8b2ce8869459c6f1d8b63 | 1,030 | py | Python | paprika/repositories/SilverpopMailingRepository.py | thunder-/paprika | af262407ec9c195dbb5a7c205510e6ad2fb65f36 | [
"MIT"
] | null | null | null | paprika/repositories/SilverpopMailingRepository.py | thunder-/paprika | af262407ec9c195dbb5a7c205510e6ad2fb65f36 | [
"MIT"
] | null | null | null | paprika/repositories/SilverpopMailingRepository.py | thunder-/paprika | af262407ec9c195dbb5a7c205510e6ad2fb65f36 | [
"MIT"
] | null | null | null | from paprika.repositories.Repository import Repository
class SilverpopMailingRepository(Repository):
def __init__(self, connector):
Repository.__init__(self, connector)
def insert(self, silverpop_mailing):
connection = self.get_connection()
cursor = connection.cursor()
params... | 31.212121 | 114 | 0.683495 |
59e71258eec76674dd2b21f097643b0f9f9ab2ff | 38,105 | py | Python | test/test_fapi.py | niooss-ledger/tpm2-pytss | f748de7993ff6b39900ba4a0332f893eba19194f | [
"BSD-2-Clause"
] | null | null | null | test/test_fapi.py | niooss-ledger/tpm2-pytss | f748de7993ff6b39900ba4a0332f893eba19194f | [
"BSD-2-Clause"
] | null | null | null | test/test_fapi.py | niooss-ledger/tpm2-pytss | f748de7993ff6b39900ba4a0332f893eba19194f | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/python3 -u
"""
SPDX-License-Identifier: BSD-2
"""
import random
import string
import sys
import pytest
pytestmark = pytest.mark.skipif(
"tpm2_pytss.FAPI" not in sys.modules, reason="FAPI Not Detected"
)
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitive... | 35.982059 | 110 | 0.624747 |
53e6839d0e121b7f9b6f0927874f3de5ca965984 | 2,554 | py | Python | tests/test_cli.py | 91nunocosta/cookiecutterizer | fb450b3878a4d0af3400258e2b736dae2e4b65b0 | [
"MIT"
] | null | null | null | tests/test_cli.py | 91nunocosta/cookiecutterizer | fb450b3878a4d0af3400258e2b736dae2e4b65b0 | [
"MIT"
] | null | null | null | tests/test_cli.py | 91nunocosta/cookiecutterizer | fb450b3878a4d0af3400258e2b736dae2e4b65b0 | [
"MIT"
] | null | null | null | """Test Command Line Interface."""
import json
import textwrap
from pathlib import Path
from click.testing import CliRunner
from cookiecutterizer.cli import cookiecutterize
from tests.helpers import create_text_file, load_text_file
def test_cookiecutterize(tmp_path):
"""Test cookiecutterize command."""
runn... | 24.09434 | 79 | 0.523884 |
8f3d509c21b86f44334315efaaeff8a048c71398 | 3,508 | py | Python | Projects/3_Adversarial Search/agents/40_ab_negascout.py | rpaech/udacity-aind | 58bafa6758465c03cc0723f27e781e9d8336c871 | [
"MIT"
] | null | null | null | Projects/3_Adversarial Search/agents/40_ab_negascout.py | rpaech/udacity-aind | 58bafa6758465c03cc0723f27e781e9d8336c871 | [
"MIT"
] | null | null | null | Projects/3_Adversarial Search/agents/40_ab_negascout.py | rpaech/udacity-aind | 58bafa6758465c03cc0723f27e781e9d8336c871 | [
"MIT"
] | null | null | null | import random
from sample_players import DataPlayer
from isolation.isolation import Action, Isolation
from typing import Optional, Tuple, Dict
def liberty_difference(state: Isolation) -> int:
def liberty_count(player_id: int) -> int:
return len(state.liberties(state.locs[player_id]))
this_player = s... | 31.321429 | 79 | 0.525371 |
2e4cf36b60b1f37901596e7e0b9a2842671afd7a | 379 | py | Python | Array/Medium_JumpGame_55_WYH.py | LinkWoong/LC-Solutions | 98b2ce55f05f6acb672f20519f79ca9f4248961d | [
"MIT"
] | 4 | 2019-05-15T10:40:34.000Z | 2020-07-27T03:05:39.000Z | Array/Medium_JumpGame_55_WYH.py | LinkWoong/LC-Solutions | 98b2ce55f05f6acb672f20519f79ca9f4248961d | [
"MIT"
] | 2 | 2019-08-20T15:34:33.000Z | 2019-09-20T19:41:27.000Z | Array/Medium_JumpGame_55_WYH.py | LinkWoong/LC-Solutions | 98b2ce55f05f6acb672f20519f79ca9f4248961d | [
"MIT"
] | null | null | null |
# coding: utf-8
# In[20]:
#算法思路:
#从左向右遍历整个array
#检查当前可以最大达到的数max_reach,能否跟上current脚步数i
#如果跟不上则返回False,跟得上并且超越了终点则返回True
class Solution:
def canJump(self, nums):
max_reach, n = 0, len(nums)
for i, x in enumerate(nums):
if max_reach < i: return False
if max_reach >= n - 1: ... | 19.947368 | 46 | 0.620053 |
76f662228dcbe2be3bbbf288f5401e2235157f9a | 689 | py | Python | modules/ckanext-ytp_request/ckanext/ytp_request/logic/auth/create.py | eetumans/opendata | 061f58550bcb820016a764cca4763ed0a5f627fe | [
"MIT"
] | 16 | 2018-07-12T14:26:02.000Z | 2022-02-24T12:10:00.000Z | modules/ckanext-ytp_request/ckanext/ytp_request/logic/auth/create.py | eetumans/opendata | 061f58550bcb820016a764cca4763ed0a5f627fe | [
"MIT"
] | 751 | 2017-09-28T07:47:50.000Z | 2022-03-31T12:08:25.000Z | modules/ckanext-ytp_request/ckanext/ytp_request/logic/auth/create.py | vrk-kpa/opendata-ckan | 8936e2d9e700b9e5534fe2a51eedc2d1ede8c10b | [
"MIT"
] | 6 | 2017-10-31T07:47:07.000Z | 2021-10-06T07:09:07.000Z | from ckanext.ytp_request.helper import get_user_member
from ckan import authz
import logging
from ckan.common import _
log = logging.getLogger(__name__)
def member_request_create(context, data_dict):
""" Only allow to logged in users """
if not authz.auth_is_loggedin_user():
return {'success': False, ... | 34.45 | 113 | 0.701016 |
5fb054455e669692a7c42e892a7c29942b31ede3 | 7,036 | py | Python | Lib/site-packages/qutebrowser/commands/runners.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | null | null | null | Lib/site-packages/qutebrowser/commands/runners.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | 20 | 2021-05-03T18:02:23.000Z | 2022-03-12T12:01:04.000Z | Lib/site-packages/qutebrowser/commands/runners.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | null | null | null | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... | 35.535354 | 83 | 0.639568 |
84a0fbe31d9f60b314683e4f6aa6df933e0b1631 | 1,618 | py | Python | rltools/domains/randomwalk.py | omtinez/rltools | ce60b906fbe109e96f7866ae98144c9c9988650b | [
"MIT"
] | null | null | null | rltools/domains/randomwalk.py | omtinez/rltools | ce60b906fbe109e96f7866ae98144c9c9988650b | [
"MIT"
] | null | null | null | rltools/domains/randomwalk.py | omtinez/rltools | ce60b906fbe109e96f7866ae98144c9c9988650b | [
"MIT"
] | null | null | null | import random
class RandomWalk(object):
ACTIONS = [0]
def __init__(self):
self.num_states = 7
self.current_state = 3
def take_action(self, action):
if action > 0:
raise ValueError('Only action "0" supported in this domain')
if self.current_state == 0 or self.cu... | 29.418182 | 105 | 0.590235 |
b45b37e4f82d040620a41ac216478942b28d2be9 | 3,377 | py | Python | kornia/losses/psnr.py | ChristophReich1996/kornia | 35f955b46e8015da1cb9faa28c6943ec2b09cc2a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | kornia/losses/psnr.py | ChristophReich1996/kornia | 35f955b46e8015da1cb9faa28c6943ec2b09cc2a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | kornia/losses/psnr.py | ChristophReich1996/kornia | 35f955b46e8015da1cb9faa28c6943ec2b09cc2a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import torch
import torch.nn as nn
from torch.nn.functional import mse_loss as mse
def psnr(input: torch.Tensor, target: torch.Tensor, max_val: float) -> torch.Tensor:
r"""Creates a function that calculates the PSNR between 2 images.
PSNR is Peek Signal to Noise Ratio, which is similar to mean squared error.... | 30.7 | 102 | 0.609417 |
cdc725c48f36c163104863e98d9da3e82b5cfd83 | 41 | py | Python | flowbee/activities/__init__.py | blitzagency/flowbee | 35e8977827eda34474aa5edc95bbfec86c61b33a | [
"MIT"
] | null | null | null | flowbee/activities/__init__.py | blitzagency/flowbee | 35e8977827eda34474aa5edc95bbfec86c61b33a | [
"MIT"
] | null | null | null | flowbee/activities/__init__.py | blitzagency/flowbee | 35e8977827eda34474aa5edc95bbfec86c61b33a | [
"MIT"
] | null | null | null | from .base import (Activities, Workflow)
| 20.5 | 40 | 0.780488 |
d8af71eb07aaaafa426f2c57304d5c7a4f4be85f | 7,414 | py | Python | tests/unit/modules/test_rpm.py | johnskopis/salt | 86adb6b0fe40230b8be4c74229e897a7a08f81a6 | [
"Apache-2.0"
] | 1 | 2016-08-21T21:19:12.000Z | 2016-08-21T21:19:12.000Z | tests/unit/modules/test_rpm.py | johnskopis/salt | 86adb6b0fe40230b8be4c74229e897a7a08f81a6 | [
"Apache-2.0"
] | 2 | 2019-03-06T20:43:44.000Z | 2019-04-10T23:56:02.000Z | tests/unit/modules/test_rpm.py | johnskopis/salt | 86adb6b0fe40230b8be4c74229e897a7a08f81a6 | [
"Apache-2.0"
] | 1 | 2020-04-10T20:18:40.000Z | 2020-04-10T20:18:40.000Z | # -*- coding: utf-8 -*-
'''
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
Magi... | 35.137441 | 114 | 0.570003 |
3bebd6fc5065620173f75c951d462600ad72abfd | 9,793 | py | Python | addition_module/face_lightning/KDF/train.py | xueyedamo521/FaceX-Zoo | aa3ecc8eb5471457d566889836cec5f138b92752 | [
"Apache-2.0"
] | 1 | 2021-03-31T04:43:49.000Z | 2021-03-31T04:43:49.000Z | addition_module/face_lightning/KDF/train.py | xueyedamo521/FaceX-Zoo | aa3ecc8eb5471457d566889836cec5f138b92752 | [
"Apache-2.0"
] | null | null | null | addition_module/face_lightning/KDF/train.py | xueyedamo521/FaceX-Zoo | aa3ecc8eb5471457d566889836cec5f138b92752 | [
"Apache-2.0"
] | null | null | null | """
@author: Jun Wang
@date: 20201019
@contact: jun21wangustc@gmail.com
"""
import os
import sys
import shutil
import argparse
import logging as logger
import torch
from torch import optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
from backbone.backbone_def import BackboneFactory
... | 47.081731 | 97 | 0.635045 |
35cd33ce20be49dde5ce55248f2ad047fc962fa8 | 13,305 | py | Python | src/logistic/main_mimic.py | rathp/time_series_prediction | c776f988c633868c7106041ac91ab56ca9fd7968 | [
"MIT"
] | null | null | null | src/logistic/main_mimic.py | rathp/time_series_prediction | c776f988c633868c7106041ac91ab56ca9fd7968 | [
"MIT"
] | null | null | null | src/logistic/main_mimic.py | rathp/time_series_prediction | c776f988c633868c7106041ac91ab56ca9fd7968 | [
"MIT"
] | null | null | null | import sys, os
import argparse
import numpy as np
import pandas as pd
import json
import time
import torch
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import (roc_curve, accuracy_score, log_loss,
balanced_accura... | 39.247788 | 148 | 0.637956 |
6fd3b348d55ff4399b86550119d50aa866c0ae97 | 678 | py | Python | office365api/mail/drafts.py | swimlane/python-office365 | 42c0c0cad0d92e4cd7f18fcf3e75153045a9ea0f | [
"MIT"
] | 21 | 2016-10-27T10:39:25.000Z | 2021-06-15T01:03:06.000Z | office365api/mail/drafts.py | swimlane/python-office365 | 42c0c0cad0d92e4cd7f18fcf3e75153045a9ea0f | [
"MIT"
] | 6 | 2017-03-08T06:39:59.000Z | 2021-07-12T01:35:05.000Z | office365api/mail/drafts.py | swimlane/python-office365 | 42c0c0cad0d92e4cd7f18fcf3e75153045a9ea0f | [
"MIT"
] | 15 | 2016-12-11T22:33:56.000Z | 2021-09-13T17:44:11.000Z | from office365api.mail.folders import Folder
class Drafts(Folder):
@property
def folder_name(self):
return 'Drafts'
def reply(self, message, comment=None, to_all=False):
"""
Sends reply to sender and other recipients.
:param message: Message to reply to, only Id is import... | 29.478261 | 86 | 0.643068 |
edf54ff64a79958d136e730469924c4025d22a08 | 796 | py | Python | Problems/Depth-First Search/easy/MaxDepthNaryTree/max_depth_nary_tree.py | dolong2110/Algorithm-By-Problems-Python | 31ecc7367aaabdd2b0ac0af7f63ca5796d70c730 | [
"MIT"
] | 1 | 2021-08-16T14:52:05.000Z | 2021-08-16T14:52:05.000Z | Problems/Depth-First Search/easy/MaxDepthNaryTree/max_depth_nary_tree.py | dolong2110/Algorithm-By-Problems-Python | 31ecc7367aaabdd2b0ac0af7f63ca5796d70c730 | [
"MIT"
] | null | null | null | Problems/Depth-First Search/easy/MaxDepthNaryTree/max_depth_nary_tree.py | dolong2110/Algorithm-By-Problems-Python | 31ecc7367aaabdd2b0ac0af7f63ca5796d70c730 | [
"MIT"
] | null | null | null | class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
# Recursive
def maxDepth(root: 'Node') -> int:
if not root:
return 0
def search_max(cur_root: 'Node', depth: int):
if not cur_root.children:
return depth
re... | 24.875 | 81 | 0.589196 |
d49cbe8d7289e8f4355f59f8f794d5dcaa2b303b | 2,366 | bzl | Python | bazel/generate_cc.bzl | LuminateWireless/grpc | b21e8bfde50f6c895165b984f1d5dff58a4cc7b4 | [
"BSD-3-Clause"
] | 1 | 2021-04-27T20:09:23.000Z | 2021-04-27T20:09:23.000Z | bazel/generate_cc.bzl | LuminateWireless/grpc | b21e8bfde50f6c895165b984f1d5dff58a4cc7b4 | [
"BSD-3-Clause"
] | null | null | null | bazel/generate_cc.bzl | LuminateWireless/grpc | b21e8bfde50f6c895165b984f1d5dff58a4cc7b4 | [
"BSD-3-Clause"
] | 1 | 2019-06-03T16:02:06.000Z | 2019-06-03T16:02:06.000Z | """Generates C++ grpc stubs from proto_library rules.
This is an internal rule used by cc_grpc_library, and shouldn't be used
directly.
"""
def generate_cc_impl(ctx):
"""Implementation of the generate_cc rule."""
protos = [f for src in ctx.attr.srcs for f in src.proto.direct_sources]
includes = [f for src in ct... | 34.289855 | 81 | 0.610313 |
4918ed56c140e3f0ce56defcfbed09d85cea59bc | 958 | py | Python | ops/convert_model_togroupmodel.py | wang3702/barlowtwins | 6d1dc9d31f8f3c87fa4148b7dada0fe9e34805d1 | [
"MIT"
] | null | null | null | ops/convert_model_togroupmodel.py | wang3702/barlowtwins | 6d1dc9d31f8f3c87fa4148b7dada0fe9e34805d1 | [
"MIT"
] | null | null | null | ops/convert_model_togroupmodel.py | wang3702/barlowtwins | 6d1dc9d31f8f3c87fa4148b7dada0fe9e34805d1 | [
"MIT"
] | null | null | null |
def convert_model_to_group(world_size ,group_norm_size ,model):
total_world_size = world_size
print("total world size %d, group num %d" % (total_world_size, group_norm_size))
if total_world_size >= group_norm_size:
cur_divide_group = 1
gpu_per_group = total_world_size // group_norm_size
... | 43.545455 | 86 | 0.727557 |
65f347dcfe331ca0d560958359f2aac4a912c99e | 2,669 | py | Python | scrapy/logformatter.py | subhipandey/scrapy | b5c552d17ff9e9629434712c3d0595c02853bcfc | [
"BSD-3-Clause"
] | 9,953 | 2019-04-03T23:41:04.000Z | 2022-03-31T11:54:44.000Z | stackoverflow/venv/lib/python3.6/site-packages/scrapy/logformatter.py | W4LKURE/learn_python3_spider | 98dd354a41598b31302641f9a0ea49d1ecfa0fb1 | [
"MIT"
] | 44 | 2019-05-27T10:59:29.000Z | 2022-03-31T14:14:29.000Z | stackoverflow/venv/lib/python3.6/site-packages/scrapy/logformatter.py | W4LKURE/learn_python3_spider | 98dd354a41598b31302641f9a0ea49d1ecfa0fb1 | [
"MIT"
] | 2,803 | 2019-04-06T13:15:33.000Z | 2022-03-31T07:42:01.000Z | import os
import logging
from twisted.python.failure import Failure
from scrapy.utils.request import referer_str
SCRAPEDMSG = u"Scraped from %(src)s" + os.linesep + "%(item)s"
DROPPEDMSG = u"Dropped: %(exception)s" + os.linesep + "%(item)s"
CRAWLEDMSG = u"Crawled (%(status)s) %(request)s%(request_flags)s (referer: %... | 34.217949 | 106 | 0.58299 |
358d5ed4e40a7840fe0f2861abc52f73022aaad0 | 3,833 | py | Python | etc/tidy.py | olsonjeffery/schemers | 74a8a6cfbf7158e489fd82e0d0e678df81948b87 | [
"BSD-3-Clause"
] | 2 | 2015-03-10T02:30:25.000Z | 2021-09-07T11:05:47.000Z | etc/tidy.py | olsonjeffery/schemers | 74a8a6cfbf7158e489fd82e0d0e678df81948b87 | [
"BSD-3-Clause"
] | null | null | null | etc/tidy.py | olsonjeffery/schemers | 74a8a6cfbf7158e489fd82e0d0e678df81948b87 | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2010-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or ht... | 32.760684 | 74 | 0.600313 |
c04e591f7c07799ba41d5beee76a127faa7fc2ec | 2,751 | py | Python | tests/parsers/text_parser.py | cugu-stars/plaso | a205f8e52dfe4c239aeae5558d572806b7b00e81 | [
"Apache-2.0"
] | null | null | null | tests/parsers/text_parser.py | cugu-stars/plaso | a205f8e52dfe4c239aeae5558d572806b7b00e81 | [
"Apache-2.0"
] | null | null | null | tests/parsers/text_parser.py | cugu-stars/plaso | a205f8e52dfe4c239aeae5558d572806b7b00e81 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This file contains the tests for the generic text parser."""
import unittest
import pyparsing
from plaso.parsers import text_parser
from tests.parsers import test_lib
class PyparsingConstantsTest(test_lib.ParserTestCase):
"""Tests the PyparsingConstants text par... | 32.364706 | 79 | 0.733915 |
caa044a8c084467ddb400e9d7325af160045293b | 1,664 | py | Python | test/test_get_transaction_details_by_transaction_id_response_data.py | xan187/Crypto_APIs_2.0_SDK_Python | a56c75df54ef037b39be1315ed6e54de35bed55b | [
"MIT"
] | null | null | null | test/test_get_transaction_details_by_transaction_id_response_data.py | xan187/Crypto_APIs_2.0_SDK_Python | a56c75df54ef037b39be1315ed6e54de35bed55b | [
"MIT"
] | null | null | null | test/test_get_transaction_details_by_transaction_id_response_data.py | xan187/Crypto_APIs_2.0_SDK_Python | a56c75df54ef037b39be1315ed6e54de35bed55b | [
"MIT"
] | 1 | 2021-07-21T03:35:18.000Z | 2021-07-21T03:35:18.000Z | """
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | 42.666667 | 484 | 0.805288 |
d4c4d80736767a7fa72222f0139764b8abfcfdef | 257 | py | Python | python-package/exp_pb2_test.py | openmit/openmit | 01e3262d69d47fbe38bad1ba95c7d1ade110d01e | [
"Apache-2.0"
] | 15 | 2017-06-28T08:39:51.000Z | 2019-03-27T14:08:45.000Z | python-package/exp_pb2_test.py | openmit/openmit | 01e3262d69d47fbe38bad1ba95c7d1ade110d01e | [
"Apache-2.0"
] | null | null | null | python-package/exp_pb2_test.py | openmit/openmit | 01e3262d69d47fbe38bad1ba95c7d1ade110d01e | [
"Apache-2.0"
] | 3 | 2017-07-30T08:50:45.000Z | 2017-10-24T14:41:30.000Z | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import exp_pb2 as exp
person = exp.Person()
person.name = "zhouyong";
person.id = 29;
person.xxxx = "xxxxx-yyyyy";
person.strs.append('strs0');
person.strs.append('strs1');
print('person:\n{}'.format(person))
| 18.357143 | 35 | 0.669261 |
0f595f9858043d8a23ee4fce130b33541ea622da | 1,444 | py | Python | Hello_Spirograph_1.py | TechnoTanuki/Python_BMP | d6f7e7a4b74f7d6e8761d618c156d37c97726038 | [
"MIT"
] | 3 | 2022-02-24T15:46:43.000Z | 2022-03-30T13:17:03.000Z | Hello_Spirograph_1.py | TechnoTanuki/Python_BMP | d6f7e7a4b74f7d6e8761d618c156d37c97726038 | [
"MIT"
] | null | null | null | Hello_Spirograph_1.py | TechnoTanuki/Python_BMP | d6f7e7a4b74f7d6e8761d618c156d37c97726038 | [
"MIT"
] | null | null | null | notice = """
Hello Spirograph Demo
-----------------------------------
| Copyright 2022 by Joel C. Alcarez |
| [joelalcarez1975@gmail.com] |
|-----------------------------------|
| We make absolutely no warranty |
| of any kind, expressed or implied |
|-----------------------------------|
| This grap... | 29.469388 | 67 | 0.5 |
ffae89a1834d09b18c5a2a14295250989e1b402b | 1,047 | py | Python | gale/balance/request.py | lujinda/gale | d86ce7f691ac4a89ab491543e37476efdb1d7e59 | [
"MIT"
] | 4 | 2016-02-01T02:26:01.000Z | 2021-06-01T08:43:05.000Z | gale/balance/request.py | lujinda/gale | d86ce7f691ac4a89ab491543e37476efdb1d7e59 | [
"MIT"
] | null | null | null | gale/balance/request.py | lujinda/gale | d86ce7f691ac4a89ab491543e37476efdb1d7e59 | [
"MIT"
] | 1 | 2016-01-08T11:00:11.000Z | 2016-01-08T11:00:11.000Z | #!/usr/bin/env python
#coding:utf-8
# Author : tuxpy
# Email : q8886888@qq.com.com
# Last modified : 2015-11-27 15:01:54
# Filename : request.py
# Description :
from __future__ import print_function, unicode_literals
import socket
try:
import httplib # py2
except ImportError:
from http i... | 26.846154 | 71 | 0.674308 |
e1e662ece8f58983c9ce163402e660de08feafe3 | 2,105 | py | Python | nifti_gridview/ngv_io/writer.py | alabamagan/NIfTI-gridview | 79d6501f78374555b85d52248b380241db53d3ab | [
"MIT"
] | 2 | 2020-11-26T06:49:13.000Z | 2020-11-26T15:40:20.000Z | nifti_gridview/ngv_io/writer.py | alabamagan/NIfTI-gridview | 79d6501f78374555b85d52248b380241db53d3ab | [
"MIT"
] | null | null | null | nifti_gridview/ngv_io/writer.py | alabamagan/NIfTI-gridview | 79d6501f78374555b85d52248b380241db53d3ab | [
"MIT"
] | null | null | null | import numpy as np
import os
import cv2
import gc
from ngv_model import draw_grid_wrapper, NGV_Logger
class writer(object):
def __init__(self, data_loader, seg_loaders, draw_worker, outdir, **kwargs):
assert isinstance(draw_worker, draw_grid_wrapper), "Incorrect type."
self._data_loader = data_loa... | 33.951613 | 105 | 0.615202 |
fa25dd765e4e73154bacd109c7ff8183ec31e67e | 3,150 | py | Python | paraphrasing/word2vec_train_and_save.py | Keracorn/geulstagram | d7964abaece0e46c2bd4796fee2ba6d836140022 | [
"MIT"
] | 5 | 2020-04-08T01:38:31.000Z | 2022-03-20T06:09:27.000Z | paraphrasing/word2vec_train_and_save.py | woodongk/geulstagram | ae375c136191774f03ac9f0f6bb8de86be9c44d3 | [
"MIT"
] | null | null | null | paraphrasing/word2vec_train_and_save.py | woodongk/geulstagram | ae375c136191774f03ac9f0f6bb8de86be9c44d3 | [
"MIT"
] | 12 | 2019-09-28T05:05:30.000Z | 2020-03-16T13:42:33.000Z | import pandas as pd
import os
from konlpy.tag import Okt
## word2vec
import warnings
warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim')
from gensim.models import word2vec
# load data
def load_data(PATH):
data = pd.read_csv(PATH, index_col=1)
data.columns = ['CONTENT_ID', 'USER_ID... | 30 | 105 | 0.576825 |
71ab996580bd6c0266b7cedcba3e5442cc189578 | 346 | py | Python | Getting_Started_With_Raspberry_Pi_Pico/built_in_led_on_off/code.py | claycooper/Adafruit_Learning_System_Guides | 890431bd4b9df929bc601e5886c2a735d89814f9 | [
"MIT"
] | null | null | null | Getting_Started_With_Raspberry_Pi_Pico/built_in_led_on_off/code.py | claycooper/Adafruit_Learning_System_Guides | 890431bd4b9df929bc601e5886c2a735d89814f9 | [
"MIT"
] | null | null | null | Getting_Started_With_Raspberry_Pi_Pico/built_in_led_on_off/code.py | claycooper/Adafruit_Learning_System_Guides | 890431bd4b9df929bc601e5886c2a735d89814f9 | [
"MIT"
] | null | null | null | # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Example for Pico. Turns the built-in LED on and off with no delay."""
import board
import digitalio
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = T... | 23.066667 | 72 | 0.754335 |
03cc049b4d3ef761b71dac17669c843a2e07a619 | 937 | py | Python | config/parameters.py | disruptive-technologies/cold-storage-an | b6d740e4f90165ed0c771b83a2869e4c8793c09a | [
"MIT"
] | null | null | null | config/parameters.py | disruptive-technologies/cold-storage-an | b6d740e4f90165ed0c771b83a2869e4c8793c09a | [
"MIT"
] | null | null | null | config/parameters.py | disruptive-technologies/cold-storage-an | b6d740e4f90165ed0c771b83a2869e4c8793c09a | [
"MIT"
] | null | null | null |
# delay
H_DELAY = 3 # hours of historic data used in thresholds (rolling median halfwidth)
S_DELAY = 60*60*H_DELAY # seconds of historic data used in thresholds
# robust sampling
S_ROBUST_CYCLE = 60*60*16 # period length for robust statistics calculation in seconds
S_ROBUST_WIDTH = 60*60... | 55.117647 | 126 | 0.589114 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.