hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | 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 245 | max_issues_repo_name stringlengths 6 130 | 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 245 | max_forks_repo_name stringlengths 6 130 | 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 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f717001c298682adebd3ce0fdb017a670744af55 | 4,004 | py | Python | ansible/deploy.py | CloudReactor/aws-ecs-cloudreactor-deployer | 0abf182780dae41e646eef7ef23c029a9cbbba43 | [
"BSD-2-Clause"
] | null | null | null | ansible/deploy.py | CloudReactor/aws-ecs-cloudreactor-deployer | 0abf182780dae41e646eef7ef23c029a9cbbba43 | [
"BSD-2-Clause"
] | null | null | null | ansible/deploy.py | CloudReactor/aws-ecs-cloudreactor-deployer | 0abf182780dae41e646eef7ef23c029a9cbbba43 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/local/bin/python
import argparse
import logging
import os
import shlex
import subprocess
import sys
_DEFAULT_LOG_LEVEL = 'INFO'
if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='deploy', allow_abbrev=False,
description="""
Deploys a project to AWS ECS and CloudReactor using An... | 34.817391 | 94 | 0.693556 |
import argparse
import logging
import os
import shlex
import subprocess
import sys
_DEFAULT_LOG_LEVEL = 'INFO'
if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='deploy', allow_abbrev=False,
description="""
Deploys a project to AWS ECS and CloudReactor using Ansible.
""")
deploy... | true | true |
f71700a02e9af92b95c627de9e9deee219c9f35c | 2,411 | py | Python | Chapter04/flask_test.py | cloudnatif/Cloud-Natif | 13b318981d946f26b37db6073252dcb31d0760b1 | [
"MIT"
] | 94 | 2017-07-28T07:19:42.000Z | 2022-01-25T21:09:06.000Z | Chapter04/flask_test.py | cloudnatif/Cloud-Natif | 13b318981d946f26b37db6073252dcb31d0760b1 | [
"MIT"
] | null | null | null | Chapter04/flask_test.py | cloudnatif/Cloud-Natif | 13b318981d946f26b37db6073252dcb31d0760b1 | [
"MIT"
] | 78 | 2017-03-15T17:27:55.000Z | 2022-01-25T21:09:30.000Z | # Test cases for restful API
from app import app
import unittest
class FlaskappTests(unittest.TestCase):
def setUp(self):
# creates a test client
self.app = app.test_client()
# propagate the exceptions to the test client
self.app.testing = True
def test_users_status_code(self):
... | 43.053571 | 203 | 0.662796 |
from app import app
import unittest
class FlaskappTests(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
self.app.testing = True
def test_users_status_code(self):
result = self.app.get('/api/v1/users')
print (result)
... | true | true |
f71700e3179565aa0840be71453d64b75aaf1335 | 17,142 | py | Python | eventlet/queue.py | ljz888666555/eventlet | 203e629212be5cf6e53d577734421d494b255754 | [
"MIT"
] | 1 | 2016-09-20T21:00:28.000Z | 2016-09-20T21:00:28.000Z | eventlet/queue.py | ljz888666555/eventlet | 203e629212be5cf6e53d577734421d494b255754 | [
"MIT"
] | null | null | null | eventlet/queue.py | ljz888666555/eventlet | 203e629212be5cf6e53d577734421d494b255754 | [
"MIT"
] | null | null | null | # Copyright (c) 2009 Denis Bilenko, denis.bilenko at gmail com
# Copyright (c) 2010 Eventlet Contributors (see AUTHORS)
# and licensed under the MIT license:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... | 37.184382 | 117 | 0.605064 |
from __future__ import print_function
import sys
import heapq
import collections
import traceback
from eventlet.event import Event
from eventlet.greenthread import getcurrent
from eventlet.hubs import get_hub
from eventlet.support import six
from eventlet.timeout import Timeout
__all__ = ['Que... | true | true |
f7170216f50bfa3fdd6fc09085ea89978ae0086b | 756 | py | Python | googlelyrics/__main__.py | lastsecondsave/googlelyrics | b022953b82d84fee4caa1e7ea1edbc0374b89a22 | [
"MIT"
] | null | null | null | googlelyrics/__main__.py | lastsecondsave/googlelyrics | b022953b82d84fee4caa1e7ea1edbc0374b89a22 | [
"MIT"
] | null | null | null | googlelyrics/__main__.py | lastsecondsave/googlelyrics | b022953b82d84fee4caa1e7ea1edbc0374b89a22 | [
"MIT"
] | null | null | null | import sys
from argparse import ArgumentParser
from . import search
def parse_args():
parser = ArgumentParser(prog="googlelyrics")
parser.add_argument(
"--no-header", action="store_true", help="don't print the info header"
)
parser.add_argument("query", type=str, nargs="+", help="search quer... | 19.894737 | 78 | 0.633598 | import sys
from argparse import ArgumentParser
from . import search
def parse_args():
parser = ArgumentParser(prog="googlelyrics")
parser.add_argument(
"--no-header", action="store_true", help="don't print the info header"
)
parser.add_argument("query", type=str, nargs="+", help="search quer... | true | true |
f717023372944f7baec384fa86924fa77eb99257 | 894 | py | Python | alembic/versions/d6fcd3132857_episode_source.py | DmitryBurnaev/podcast-service | 53349a3f9aed22a8024d0c83380f9a02464962a3 | [
"MIT"
] | 5 | 2021-07-01T16:31:29.000Z | 2022-01-29T14:32:13.000Z | alembic/versions/d6fcd3132857_episode_source.py | DmitryBurnaev/podcast-service | 53349a3f9aed22a8024d0c83380f9a02464962a3 | [
"MIT"
] | 45 | 2020-10-25T19:41:26.000Z | 2022-03-25T06:31:58.000Z | alembic/versions/d6fcd3132857_episode_source.py | DmitryBurnaev/podcast-service | 53349a3f9aed22a8024d0c83380f9a02464962a3 | [
"MIT"
] | 1 | 2022-01-27T11:30:07.000Z | 2022-01-27T11:30:07.000Z | """episode_source
Revision ID: d6fcd3132857
Revises: bca0b2a3b5f4
Create Date: 2021-10-17 18:51:29.927189
"""
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from sqlalchemy import String
from alembic import op
# revision identifiers, used by Alembic.
revision = "d6fcd3132857"
down_revision = "bca0b... | 26.294118 | 94 | 0.719239 | import sqlalchemy as sa
from sqlalchemy.sql import table, column
from sqlalchemy import String
from alembic import op
revision = "d6fcd3132857"
down_revision = "bca0b2a3b5f4"
branch_labels = None
depends_on = None
episodes = table("podcast_episodes", column("source_type", String))
def upgrade():
| true | true |
f7170340f1b333ec00377c1b81345ad679ae62c9 | 9,484 | py | Python | homeassistant/components/lcn/__init__.py | petewill/home-assistant | 5859dba4344f05fb8774aa1207e47ac28f627a67 | [
"Apache-2.0"
] | 3 | 2020-01-21T18:09:09.000Z | 2022-01-17T08:06:03.000Z | homeassistant/components/lcn/__init__.py | petewill/home-assistant | 5859dba4344f05fb8774aa1207e47ac28f627a67 | [
"Apache-2.0"
] | 39 | 2016-12-16T12:40:34.000Z | 2017-02-13T17:53:42.000Z | homeassistant/components/lcn/__init__.py | petewill/home-assistant | 5859dba4344f05fb8774aa1207e47ac28f627a67 | [
"Apache-2.0"
] | 6 | 2020-04-10T06:21:11.000Z | 2021-07-01T08:53:38.000Z | """Support for LCN devices."""
import logging
import pypck
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.climate import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP
from homeassistant.const import (
CONF_ADDRESS,
CONF_BINARY_SENSORS,
CONF_COVERS,
CON... | 29.453416 | 88 | 0.614614 | import logging
import pypck
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.climate import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP
from homeassistant.const import (
CONF_ADDRESS,
CONF_BINARY_SENSORS,
CONF_COVERS,
CONF_HOST,
CONF_LIGHTS,
CO... | true | true |
f717047c1e24f5939fecd31454d00b32da770cfe | 815 | py | Python | profiles_project/urls.py | Andrei-Ionescu-001/profiles-rest-api1 | fc5ceb57e3ef0dd00ab9c73b1ab65e5cee8f6c43 | [
"MIT"
] | null | null | null | profiles_project/urls.py | Andrei-Ionescu-001/profiles-rest-api1 | fc5ceb57e3ef0dd00ab9c73b1ab65e5cee8f6c43 | [
"MIT"
] | null | null | null | profiles_project/urls.py | Andrei-Ionescu-001/profiles-rest-api1 | fc5ceb57e3ef0dd00ab9c73b1ab65e5cee8f6c43 | [
"MIT"
] | null | null | null | """profiles_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Cl... | 35.434783 | 77 | 0.707975 | from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path("api/", include('profiles_api.urls')),
]
| true | true |
f7170601a4453e0e9695176e02bd85d687d2032e | 408 | py | Python | PYTHON/Desafios Python - Mundo 1/027.py | FR7/Meus-Projetos | 1c8e1a91eaf143cccdc10f0e7edd013d910de474 | [
"MIT"
] | null | null | null | PYTHON/Desafios Python - Mundo 1/027.py | FR7/Meus-Projetos | 1c8e1a91eaf143cccdc10f0e7edd013d910de474 | [
"MIT"
] | null | null | null | PYTHON/Desafios Python - Mundo 1/027.py | FR7/Meus-Projetos | 1c8e1a91eaf143cccdc10f0e7edd013d910de474 | [
"MIT"
] | null | null | null | # Faça um programa que leia o nome completo de uma pessoa, mostrando em seguida o primeiro e o último nome, separadamente.
#Ex. Ana Maria de Souza
# Primeiro = Ana
# Último = Souza
nome = str(input('Digite seu nome Completo: ')).strip().upper()
n = nome.split()
print('Seu nome completo é: {}'.format(nome))
print('Se... | 31.384615 | 122 | 0.686275 |
nome = str(input('Digite seu nome Completo: ')).strip().upper()
n = nome.split()
print('Seu nome completo é: {}'.format(nome))
print('Seu primeiro nome é: {}'.format(n[0]))
print('Seu último nome é: {}'.format(n[len(n)-1]))
| true | true |
f717065229b5aa3e8bbbf8152fb8d179944a277e | 395 | py | Python | apps/article/migrations/0002_auto_20190227_1556.py | sakisrealop/website | 43a12492a90f1f03ec69a60b74f73a5fa7f4af75 | [
"MIT"
] | 312 | 2019-02-22T02:12:39.000Z | 2022-03-28T03:51:44.000Z | apps/article/migrations/0002_auto_20190227_1556.py | Atheny/website | 28cf598488465695e4d1e2691e8d162b9c253e27 | [
"MIT"
] | 21 | 2019-04-01T04:38:50.000Z | 2022-03-11T23:43:55.000Z | apps/article/migrations/0002_auto_20190227_1556.py | Atheny/website | 28cf598488465695e4d1e2691e8d162b9c253e27 | [
"MIT"
] | 97 | 2019-01-29T02:23:09.000Z | 2022-02-26T17:25:41.000Z | # Generated by Django 2.0.8 on 2019-02-27 15:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='category_article',
name='add_time',
... | 20.789474 | 58 | 0.607595 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='category_article',
name='add_time',
field=models.DateTimeField(auto_now_... | true | true |
f7170654671a68ef6a00e9dc095703a97a4c6389 | 13,779 | py | Python | run_alicevision.py | sinithwar/Ruby_Run_Alice_Vision | 5ad3e6b02b1bca962cdcdbda1a6d7f1b31474667 | [
"CC0-1.0"
] | null | null | null | run_alicevision.py | sinithwar/Ruby_Run_Alice_Vision | 5ad3e6b02b1bca962cdcdbda1a6d7f1b31474667 | [
"CC0-1.0"
] | null | null | null | run_alicevision.py | sinithwar/Ruby_Run_Alice_Vision | 5ad3e6b02b1bca962cdcdbda1a6d7f1b31474667 | [
"CC0-1.0"
] | null | null | null | import sys, os
import shutil
def SilentMkdir(theDir):
try:
os.mkdir(theDir)
except:
pass
return 0
def Run_00_CameraInit(baseDir,binDir,srcImageDir):
SilentMkdir(baseDir + "/00_CameraInit")
binName = binDir + "\\aliceVision_cameraInit.exe"
dstDir = baseDir + "/00_CameraInit/"
cmdLine = binName
cmdLine =... | 36.165354 | 595 | 0.725016 | import sys, os
import shutil
def SilentMkdir(theDir):
try:
os.mkdir(theDir)
except:
pass
return 0
def Run_00_CameraInit(baseDir,binDir,srcImageDir):
SilentMkdir(baseDir + "/00_CameraInit")
binName = binDir + "\\aliceVision_cameraInit.exe"
dstDir = baseDir + "/00_CameraInit/"
cmdLine = binName
cmdLine =... | true | true |
f71707097c636c343b5861abc9032e2e393f7ac3 | 2,560 | py | Python | lib/bullet/src/examples/pybullet/inverse_kinematics.py | mtesseracttech/CustomEngine | 1a9ed564408ae29fe49681a810b851403d71f486 | [
"Apache-2.0"
] | 5 | 2016-07-04T15:00:01.000Z | 2021-01-19T02:42:48.000Z | lib/bullet/src/examples/pybullet/inverse_kinematics.py | mtesseracttech/CustomEngine | 1a9ed564408ae29fe49681a810b851403d71f486 | [
"Apache-2.0"
] | null | null | null | lib/bullet/src/examples/pybullet/inverse_kinematics.py | mtesseracttech/CustomEngine | 1a9ed564408ae29fe49681a810b851403d71f486 | [
"Apache-2.0"
] | 1 | 2016-04-23T07:47:32.000Z | 2016-04-23T07:47:32.000Z | import pybullet as p
import time
import math
from datetime import datetime
#clid = p.connect(p.SHARED_MEMORY)
p.connect(p.GUI)
p.loadURDF("plane.urdf",[0,0,-0.3])
kukaId = p.loadURDF("kuka_iiwa/model.urdf",[0,0,0])
p.resetBasePositionAndOrientation(kukaId,[0,0,0],[0,0,0,1])
kukaEndEffectorIndex = 6
numJoints = p.getNu... | 29.767442 | 178 | 0.732813 | import pybullet as p
import time
import math
from datetime import datetime
p.connect(p.GUI)
p.loadURDF("plane.urdf",[0,0,-0.3])
kukaId = p.loadURDF("kuka_iiwa/model.urdf",[0,0,0])
p.resetBasePositionAndOrientation(kukaId,[0,0,0],[0,0,0,1])
kukaEndEffectorIndex = 6
numJoints = p.getNumJoints(kukaId)
if (numJoints!=7):... | true | true |
f717072f58bacbac6ee72e5f50a62ccb40155d02 | 688 | py | Python | bdlb/diabetic_retinopathy_diagnosis/__init__.py | jrubin01/bdl-benchmarks | 1a6118750006febcd73a68af488a61673b6924b1 | [
"Apache-2.0"
] | 1 | 2020-10-30T09:13:49.000Z | 2020-10-30T09:13:49.000Z | bdlb/diabetic_retinopathy_diagnosis/__init__.py | jrubin01/bdl-benchmarks | 1a6118750006febcd73a68af488a61673b6924b1 | [
"Apache-2.0"
] | 5 | 2019-10-26T19:05:04.000Z | 2022-03-30T08:07:46.000Z | bdlb/diabetic_retinopathy_diagnosis/__init__.py | jrubin01/bdl-benchmarks | 1a6118750006febcd73a68af488a61673b6924b1 | [
"Apache-2.0"
] | 2 | 2020-09-12T13:06:14.000Z | 2020-12-01T13:22:45.000Z | # Copyright 2019 BDL Benchmarks 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... | 49.142857 | 80 | 0.677326 | true | true | |
f7170733d9d5dfa19bfa97dde2fa1c168c81130c | 9,133 | py | Python | pysnmp-with-texts/V-BRIDGE-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 8 | 2019-05-09T17:04:00.000Z | 2021-06-09T06:50:51.000Z | pysnmp-with-texts/V-BRIDGE-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 4 | 2019-05-31T16:42:59.000Z | 2020-01-31T21:57:17.000Z | pysnmp-with-texts/V-BRIDGE-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module V-BRIDGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/V-BRIDGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:33:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | 118.61039 | 849 | 0.783861 |
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuild... | true | true |
f71708f6e5870838a55c5650db911c0b554c69fb | 10,593 | py | Python | oneflow/python/test/models/vgg16.py | xxg1413/oneflow | f2e3c85a25b8aecfb6c0c0af1737833b1a77e135 | [
"Apache-2.0"
] | 1 | 2020-12-04T03:06:16.000Z | 2020-12-04T03:06:16.000Z | oneflow/python/test/models/vgg16.py | xxg1413/oneflow | f2e3c85a25b8aecfb6c0c0af1737833b1a77e135 | [
"Apache-2.0"
] | null | null | null | oneflow/python/test/models/vgg16.py | xxg1413/oneflow | f2e3c85a25b8aecfb6c0c0af1737833b1a77e135 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2020 The OneFlow 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 applicable law or agr... | 31.906627 | 85 | 0.657604 | import argparse
import os
from datetime import datetime
import numpy
import oneflow as flow
import oneflow.core.operator.op_conf_pb2 as op_conf_util
_DATA_DIR = "/dataset/PNGS/PNG224/of_record_repeated"
_SINGLE_DATA_DIR = "/dataset/PNGS/PNG224/of_record"
_MODEL_LOAD_DIR = "/dataset/PNGS/cnns_model_for_test/vgg16/mode... | true | true |
f71709ad2911d4c2d64410be79854cf9a92e3003 | 13,191 | py | Python | pommerman/envs/v0.py | xysun/playground | 20f9a7e0eb3d24e7cd32d8afd94b767b8fcc00b4 | [
"Apache-2.0"
] | null | null | null | pommerman/envs/v0.py | xysun/playground | 20f9a7e0eb3d24e7cd32d8afd94b767b8fcc00b4 | [
"Apache-2.0"
] | null | null | null | pommerman/envs/v0.py | xysun/playground | 20f9a7e0eb3d24e7cd32d8afd94b767b8fcc00b4 | [
"Apache-2.0"
] | null | null | null | """The baseline Pommerman environment.
This evironment acts as game manager for Pommerman. Further environments,
such as in v1.py, will inherit from this.
"""
import json
import os
import numpy as np
import time
from gym import spaces
from gym.utils import seeding
import gym
from .. import characters
from .. import ... | 37.157746 | 80 | 0.578197 | import json
import os
import numpy as np
import time
from gym import spaces
from gym.utils import seeding
import gym
from .. import characters
from .. import constants
from .. import forward_model
from .. import graphics
from .. import utility
class Pomme(gym.Env):
metadata = {
'render.modes': ['human',... | true | true |
f7170a4a00a9b5ea431fcc159ff237369b376a27 | 5,708 | py | Python | syft/frameworks/torch/fl/utils.py | shubhamsingh987/PySyft | ff967e3735bd7d47667d1d3e5038ba1493ca2e90 | [
"Apache-2.0"
] | 1 | 2020-05-25T13:44:29.000Z | 2020-05-25T13:44:29.000Z | syft/frameworks/torch/fl/utils.py | shubhamsingh987/PySyft | ff967e3735bd7d47667d1d3e5038ba1493ca2e90 | [
"Apache-2.0"
] | 2 | 2020-03-09T09:17:06.000Z | 2020-04-09T13:33:12.000Z | syft/frameworks/torch/fl/utils.py | shubhamsingh987/PySyft | ff967e3735bd7d47667d1d3e5038ba1493ca2e90 | [
"Apache-2.0"
] | 1 | 2022-03-06T06:22:21.000Z | 2022-03-06T06:22:21.000Z | import syft as sy
import torch
from typing import Dict
from typing import Any
import logging
logger = logging.getLogger(__name__)
def extract_batches_per_worker(federated_train_loader: sy.FederatedDataLoader):
"""Extracts the batches from the federated_train_loader and stores them
in a dictionary (keys = ... | 29.884817 | 103 | 0.596181 | import syft as sy
import torch
from typing import Dict
from typing import Any
import logging
logger = logging.getLogger(__name__)
def extract_batches_per_worker(federated_train_loader: sy.FederatedDataLoader):
logging_interval = 100
batches = {}
for worker_id in federated_train_loader.workers:
wo... | true | true |
f7170ac6132a5c5e78915df4b9f637eb7aa8674a | 6,819 | py | Python | pool/models.py | tammer/pool | bacf2da7106ba9eaff7d4bde3b6e04823cd6a515 | [
"MIT"
] | null | null | null | pool/models.py | tammer/pool | bacf2da7106ba9eaff7d4bde3b6e04823cd6a515 | [
"MIT"
] | null | null | null | pool/models.py | tammer/pool | bacf2da7106ba9eaff7d4bde3b6e04823cd6a515 | [
"MIT"
] | null | null | null | # -*- coding: future_fstrings -*-
from django.db import models
from django.contrib.auth.models import User
import datetime
from pytz import timezone
def now():
# return Main.objects.all().first().now
return datetime.datetime.now()
def set_now(d):
m = Main.objects.all().first()
m.now = d
m.save()
class Team(mode... | 29.519481 | 195 | 0.723713 |
from django.db import models
from django.contrib.auth.models import User
import datetime
from pytz import timezone
def now():
return datetime.datetime.now()
def set_now(d):
m = Main.objects.all().first()
m.now = d
m.save()
class Team(models.Model):
full_name = models.CharField(max_length=50)
short_name = mo... | true | true |
f7170ac8f8e6a649b111e7906e5760a225c20807 | 619 | py | Python | flexible_reports/migrations/0009_auto_20171025_0558.py | mpasternak/django-flexible-reports | cdf62590efb2937b30e19952a67afbc3a3e1c192 | [
"MIT"
] | 2 | 2017-08-31T11:55:26.000Z | 2018-07-14T19:39:05.000Z | flexible_reports/migrations/0009_auto_20171025_0558.py | mpasternak/django-flexible-reports | cdf62590efb2937b30e19952a67afbc3a3e1c192 | [
"MIT"
] | 1 | 2017-08-24T07:04:46.000Z | 2017-09-23T14:39:06.000Z | flexible_reports/migrations/0009_auto_20171025_0558.py | mpasternak/django-flexible-reports | cdf62590efb2937b30e19952a67afbc3a3e1c192 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-10-25 10:58
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('flexible_reports', '0008_auto_20171025_0553'),
]
o... | 28.136364 | 165 | 0.678514 |
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('flexible_reports', '0008_auto_20171025_0553'),
]
operations = [
migrations.AlterField(
model_name='re... | true | true |
f7170bc3e6ea26e09566be6cd362d8f830bcb772 | 4,016 | py | Python | InvenTree/InvenTree/urls.py | mtrazakhan/invent | dfcb8209855f566b8bd5a23e8bd3d5d1b726beaf | [
"MIT"
] | null | null | null | InvenTree/InvenTree/urls.py | mtrazakhan/invent | dfcb8209855f566b8bd5a23e8bd3d5d1b726beaf | [
"MIT"
] | 8 | 2020-06-06T01:14:46.000Z | 2022-03-12T00:14:35.000Z | InvenTree/InvenTree/urls.py | mtrazakhan/invent | dfcb8209855f566b8bd5a23e8bd3d5d1b726beaf | [
"MIT"
] | null | null | null | """
Top-level URL lookup for InvenTree application.
Passes URL lookup downstream to each app as required.
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
from qr_code import urls as qr_code_urls
from company.urls import company_urls
... | 34.033898 | 122 | 0.728088 |
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
from qr_code import urls as qr_code_urls
from company.urls import company_urls
from company.urls import supplier_part_urls
from company.urls import price_break_urls
from common.urls import ... | true | true |
f7170c3b4209a882e4b52313adf31afa74155a64 | 2,107 | py | Python | main.py | flace/text-generator | 4392a4071a0d203b0b5f814c77fb7b0943acad79 | [
"MIT"
] | null | null | null | main.py | flace/text-generator | 4392a4071a0d203b0b5f814c77fb7b0943acad79 | [
"MIT"
] | null | null | null | main.py | flace/text-generator | 4392a4071a0d203b0b5f814c77fb7b0943acad79 | [
"MIT"
] | null | null | null | import sys
import os
import json
import time
from nlp_tools import tokenize_words, build_prob_language_model, generate_text_using_trigrams
from files_io import load_text, serialize, deserialize
if __name__ == '__main__':
args = sys.argv[1:]
N_WORDS = args[0]
FILES_FOLDER = 'files'
TMP_FOLDER = os.path... | 36.964912 | 98 | 0.6972 | import sys
import os
import json
import time
from nlp_tools import tokenize_words, build_prob_language_model, generate_text_using_trigrams
from files_io import load_text, serialize, deserialize
if __name__ == '__main__':
args = sys.argv[1:]
N_WORDS = args[0]
FILES_FOLDER = 'files'
TMP_FOLDER = os.path... | true | true |
f7170d095793806b6b0978bf391117e084b45d00 | 789 | py | Python | freezer_api/__init__.py | ctpegasus/freezer-api | b784327252ac6132a4d3b87c50e9a99c70d6c938 | [
"Apache-2.0"
] | 22 | 2015-10-18T02:53:47.000Z | 2021-09-19T10:38:12.000Z | freezer_api/__init__.py | ctpegasus/freezer-api | b784327252ac6132a4d3b87c50e9a99c70d6c938 | [
"Apache-2.0"
] | 5 | 2019-08-14T06:46:03.000Z | 2021-12-13T20:01:25.000Z | freezer_api/__init__.py | ctpegasus/freezer-api | b784327252ac6132a4d3b87c50e9a99c70d6c938 | [
"Apache-2.0"
] | 20 | 2016-03-08T08:34:56.000Z | 2020-10-13T06:50:05.000Z | # (c) Copyright 2016 Hewlett-Packard Enterprise Development Company, L.P.
#
# 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 require... | 35.863636 | 74 | 0.768061 |
import pbr.version
__version__ = pbr.version.VersionInfo('freezer-api').version_string()
version_info = pbr.version.VersionInfo('freezer-api')
| true | true |
f7170dafbded2faa0073fa4e84b225d8c30b922d | 9,839 | py | Python | ising_low.py | kartik-gatsby/optimized-ising-model | 1a9b0210deb26d73f93aec5b0804baaebf9c6ff9 | [
"MIT"
] | 1 | 2020-06-07T00:11:17.000Z | 2020-06-07T00:11:17.000Z | ising_low.py | kartik-gatsby/optimized-ising-model | 1a9b0210deb26d73f93aec5b0804baaebf9c6ff9 | [
"MIT"
] | null | null | null | ising_low.py | kartik-gatsby/optimized-ising-model | 1a9b0210deb26d73f93aec5b0804baaebf9c6ff9 | [
"MIT"
] | null | null | null | import numpy as np
from random import random
import matplotlib.pyplot as plt
import time
import logging
logging.basicConfig(level=logging.INFO,filename='simulation.log', filemode='w',format='%(asctime)s - %(message)s',datefmt='%d-%b-%y %H:%M:%S')
np.seterr(all='warn')
#################################################... | 38.73622 | 281 | 0.57018 | import numpy as np
from random import random
import matplotlib.pyplot as plt
import time
import logging
logging.basicConfig(level=logging.INFO,filename='simulation.log', filemode='w',format='%(asctime)s - %(message)s',datefmt='%d-%b-%y %H:%M:%S')
np.seterr(all='warn')
| true | true |
f7170de985b4d2849b9f1917151cdfb0f523b4b6 | 247 | py | Python | test.py | namitkewat/cy_aho_corasick | e9483f7efe60d3a1f9904d059dedbd021858f31c | [
"MIT"
] | 2 | 2021-08-10T03:14:43.000Z | 2021-08-10T03:17:39.000Z | test.py | namitkewat/cy_aho_corasick | e9483f7efe60d3a1f9904d059dedbd021858f31c | [
"MIT"
] | null | null | null | test.py | namitkewat/cy_aho_corasick | e9483f7efe60d3a1f9904d059dedbd021858f31c | [
"MIT"
] | 2 | 2019-04-26T09:47:35.000Z | 2021-08-10T03:18:03.000Z | import cy_aho_corasick as cy_aho
# print(dir(cyAhoCorasick))
t = cy_aho.Trie(remove_overlaps=True)
t.insert(b"sugar")
print(t.parse_text(b"sugarcane sugarcane sugar canesugar"))
print(t.parse_text_values(b"sugarcane sugarcane sugar canesugar"))
| 27.444444 | 66 | 0.801619 | import cy_aho_corasick as cy_aho
t = cy_aho.Trie(remove_overlaps=True)
t.insert(b"sugar")
print(t.parse_text(b"sugarcane sugarcane sugar canesugar"))
print(t.parse_text_values(b"sugarcane sugarcane sugar canesugar"))
| true | true |
f7170eb00fc11965e5ade80c62bfb984df7625cd | 14,665 | py | Python | fairseq/fairseq_cli/preprocess.py | shalei120/AutoInsert | 89ec5dadd252d79586fe3e44f1d315c5ec938c1f | [
"MIT"
] | 28 | 2021-09-15T01:25:00.000Z | 2022-03-01T20:21:28.000Z | fairseq/fairseq_cli/preprocess.py | shalei120/AutoInsert | 89ec5dadd252d79586fe3e44f1d315c5ec938c1f | [
"MIT"
] | 2 | 2022-03-25T07:55:12.000Z | 2022-03-28T12:46:05.000Z | fairseq/fairseq_cli/preprocess.py | shalei120/AutoInsert | 89ec5dadd252d79586fe3e44f1d315c5ec938c1f | [
"MIT"
] | 2 | 2021-09-14T07:20:11.000Z | 2021-09-23T08:00:24.000Z | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Data pre-processing: build vocabularies and binarize training data.
"""
import logging
import os
import shutil
impo... | 35.943627 | 88 | 0.561132 |
import logging
import os
import shutil
import sys
from collections import Counter
from itertools import zip_longest
from multiprocessing import Pool
from fairseq import options, tasks, utils
from fairseq.binarizer import Binarizer
from fairseq.data import indexed_dataset
from fairseq.file_chunker_utils import fi... | true | true |
f7170eb31ebfcf1d90bae6e7d44135dc95875c7b | 2,701 | py | Python | examples/do_full_save_example.py | cclauss/hyperparameter_hunter | 12fcbbd4ed71447f80e41f3538be824126b3e209 | [
"MIT"
] | null | null | null | examples/do_full_save_example.py | cclauss/hyperparameter_hunter | 12fcbbd4ed71447f80e41f3538be824126b3e209 | [
"MIT"
] | null | null | null | examples/do_full_save_example.py | cclauss/hyperparameter_hunter | 12fcbbd4ed71447f80e41f3538be824126b3e209 | [
"MIT"
] | null | null | null | from hyperparameter_hunter import Environment, CrossValidationExperiment
from hyperparameter_hunter.utils.learning_utils import get_toy_classification_data
from sklearn.model_selection import RepeatedStratifiedKFold
from xgboost import XGBClassifier
def do_full_save(experiment_result):
"""This is a simple check t... | 60.022222 | 129 | 0.775268 | from hyperparameter_hunter import Environment, CrossValidationExperiment
from hyperparameter_hunter.utils.learning_utils import get_toy_classification_data
from sklearn.model_selection import RepeatedStratifiedKFold
from xgboost import XGBClassifier
def do_full_save(experiment_result):
return experiment_result['f... | true | true |
f71710eb7646ca089fb4cdca00db365acd3cf522 | 1,978 | py | Python | ucsmsdk/mometa/macpool/MacpoolUniverse.py | anoop1984/python_sdk | c4a226bad5e10ad233eda62bc8f6d66a5a82b651 | [
"Apache-2.0"
] | null | null | null | ucsmsdk/mometa/macpool/MacpoolUniverse.py | anoop1984/python_sdk | c4a226bad5e10ad233eda62bc8f6d66a5a82b651 | [
"Apache-2.0"
] | null | null | null | ucsmsdk/mometa/macpool/MacpoolUniverse.py | anoop1984/python_sdk | c4a226bad5e10ad233eda62bc8f6d66a5a82b651 | [
"Apache-2.0"
] | null | null | null | """This module contains the general information for MacpoolUniverse ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class MacpoolUniverseConsts():
pass
class MacpoolUniverse(ManagedObject):
... | 43.955556 | 248 | 0.651668 | import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class MacpoolUniverseConsts():
pass
class MacpoolUniverse(ManagedObject):
consts = MacpoolUniverseConsts()
naming_props = set([])
mo_meta = MoMeta("Ma... | true | true |
f7171159415e7019d10d3a184eb5d2bb629cc8f6 | 7,052 | py | Python | image_classification/MLP-Mixer/load_pytorch_weights.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | image_classification/MLP-Mixer/load_pytorch_weights.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | image_classification/MLP-Mixer/load_pytorch_weights.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2021 PPViT 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 applicable l... | 33.421801 | 86 | 0.591605 |
import os
import numpy as np
import paddle
import torch
import timm
from mlp_mixer import build_mlp_mixer as build_model
from config import get_config
def print_model_named_params(model):
print('----------------------------------')
for name, param in model.named_parameters():
print(name, ... | true | true |
f717117743a109d891ba595119728a6bb26c4c8a | 2,424 | py | Python | code/3D_plot/plot3d.py | iszhaoxin/Presentation | 70cebcae6717d39df5041dbfeefe2ebba6a752fa | [
"MIT"
] | null | null | null | code/3D_plot/plot3d.py | iszhaoxin/Presentation | 70cebcae6717d39df5041dbfeefe2ebba6a752fa | [
"MIT"
] | null | null | null | code/3D_plot/plot3d.py | iszhaoxin/Presentation | 70cebcae6717d39df5041dbfeefe2ebba6a752fa | [
"MIT"
] | null | null | null | import igraph
import json
data = []
f = open("./miserables.json", 'r')
f = open("./mygraph.json", 'r')
data = json.loads(f.read())
print(data.keys())
N=len(data['nodes'])
L=len(data['links'])
Edges=[(data['links'][k]['source'], data['links'][k]['target']) for k in range(L)]
G=igraph.Graph(Edges, directed=False)
... | 24.734694 | 119 | 0.558581 | import igraph
import json
data = []
f = open("./miserables.json", 'r')
f = open("./mygraph.json", 'r')
data = json.loads(f.read())
print(data.keys())
N=len(data['nodes'])
L=len(data['links'])
Edges=[(data['links'][k]['source'], data['links'][k]['target']) for k in range(L)]
G=igraph.Graph(Edges, directed=False)
... | true | true |
f71711cd4743336100f7a85eeb3ee827d1e992c5 | 5,321 | py | Python | spotify/views.py | Caleb-Shepard/Silent-Disco | 80f2cf04278d178c149999d643507aa26bee8654 | [
"MIT"
] | null | null | null | spotify/views.py | Caleb-Shepard/Silent-Disco | 80f2cf04278d178c149999d643507aa26bee8654 | [
"MIT"
] | null | null | null | spotify/views.py | Caleb-Shepard/Silent-Disco | 80f2cf04278d178c149999d643507aa26bee8654 | [
"MIT"
] | null | null | null | from django.shortcuts import render, redirect
from .credentials import REDIRECT_URI, CLIENT_SECRET, CLIENT_ID
from rest_framework.views import APIView
from requests import Request, post
from rest_framework import status
from rest_framework.response import Response
from .util import *
from api.models import Room
from .m... | 34.551948 | 98 | 0.640857 | from django.shortcuts import render, redirect
from .credentials import REDIRECT_URI, CLIENT_SECRET, CLIENT_ID
from rest_framework.views import APIView
from requests import Request, post
from rest_framework import status
from rest_framework.response import Response
from .util import *
from api.models import Room
from .m... | true | true |
f717123331164f33e20c5a56f3a0048c5419d173 | 9,110 | py | Python | tests/test_keydb.py | meskio/tuf | 09c3ceb993d40f7339bbbaf4eae617f95b972708 | [
"MIT"
] | 1 | 2015-02-16T22:53:00.000Z | 2015-02-16T22:53:00.000Z | tests/test_keydb.py | meskio/tuf | 09c3ceb993d40f7339bbbaf4eae617f95b972708 | [
"MIT"
] | null | null | null | tests/test_keydb.py | meskio/tuf | 09c3ceb993d40f7339bbbaf4eae617f95b972708 | [
"MIT"
] | 1 | 2019-09-12T02:32:54.000Z | 2019-09-12T02:32:54.000Z | #!/usr/bin/env python
"""
<Program Name>
test_keydb.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
October 2012.
<Copyright>
See LICENSE for licensing information.
<Purpose>
Unit test for 'keydb.py'.
"""
# Help with Python 3 compatibility, where the print statement is a function, an
# i... | 35.866142 | 84 | 0.681668 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import unittest
import logging
import tuf
import tuf.formats
import tuf.keys
import tuf.keydb
import tuf.log
logger = logging.getLogger('tuf.test_keydb')
KEYS ... | true | true |
f71712333b3dfe5f51734a3e9dc773e435f4a887 | 264 | py | Python | python/setup.py | Mattis3403/lucy_password | e0d6db6f3fc5bebadf9e184d3972f09cf58ac1e5 | [
"MIT"
] | null | null | null | python/setup.py | Mattis3403/lucy_password | e0d6db6f3fc5bebadf9e184d3972f09cf58ac1e5 | [
"MIT"
] | null | null | null | python/setup.py | Mattis3403/lucy_password | e0d6db6f3fc5bebadf9e184d3972f09cf58ac1e5 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name='lucy_password',
version='0.1',
url='https://github.com/Mattis3403/lucy_password',
license='MIT',
author='Lucy',
author_email='m.seebeck@campus.tu-berlin.de',
description='A Password Manager'
)
| 22 | 54 | 0.67803 | from setuptools import setup
setup(
name='lucy_password',
version='0.1',
url='https://github.com/Mattis3403/lucy_password',
license='MIT',
author='Lucy',
author_email='m.seebeck@campus.tu-berlin.de',
description='A Password Manager'
)
| true | true |
f7171260e741432d5843b14ddc6f794a0f0ae620 | 21,489 | py | Python | layers/poky/meta/lib/oeqa/oetest.py | dtischler/px30-test | 55dce0b7aff1c4a7dea3ac94f94cc9c67fba7c9f | [
"Apache-2.0"
] | 53 | 2018-02-28T08:51:32.000Z | 2022-02-28T06:49:23.000Z | meta/lib/oeqa/oetest.py | nareshgbhat/luv-yocto | 48976c54238dda0791e274927371265d259c0e5a | [
"MIT"
] | 27 | 2018-01-25T00:26:53.000Z | 2020-08-09T05:20:04.000Z | meta/lib/oeqa/oetest.py | nareshgbhat/luv-yocto | 48976c54238dda0791e274927371265d259c0e5a | [
"MIT"
] | 51 | 2018-02-21T04:46:08.000Z | 2022-03-02T04:20:41.000Z | # Copyright (C) 2013 Intel Corporation
#
# Released under the MIT license (see COPYING.MIT)
# Main unittest module used by testimage.bbclass
# This provides the oeRuntimeTest base class which is inherited by all tests in meta/lib/oeqa/runtime.
# It also has some helper functions and it's responsible for actually star... | 34.828201 | 171 | 0.589557 |
import os, re, mmap, sys
import unittest
import inspect
import subprocess
import signal
import shutil
import functools
try:
import bb
except ImportError:
pass
import logging
import oeqa.runtime
# Exported test doesn't require sdkext
try:
import oeqa.sdkext
except ImportError:
pass
from oeqa.ut... | true | true |
f71712d716cabab7ce71af1445f2108a94cac93f | 2,041 | py | Python | Support/Fuego/Pythia/pythia-0.5/packages/fuego/fuego/serialization/chemkin/unpickle/tokens/RegularExpressions.py | balos1/PelePhysics | d01190cc7b0eaad4ec96fac573034ccb485f0e9f | [
"BSD-3-Clause-LBNL"
] | 31 | 2018-11-21T01:49:06.000Z | 2022-03-30T03:41:43.000Z | Support/Fuego/Pythia/pythia-0.5/packages/fuego/fuego/serialization/chemkin/unpickle/tokens/RegularExpressions.py | balos1/PelePhysics | d01190cc7b0eaad4ec96fac573034ccb485f0e9f | [
"BSD-3-Clause-LBNL"
] | 123 | 2019-03-12T22:27:29.000Z | 2022-03-29T17:00:04.000Z | Support/Fuego/Pythia/pythia-0.5/packages/fuego/fuego/serialization/chemkin/unpickle/tokens/RegularExpressions.py | sundials-codes/PelePhysics | 5624f83a04f43aa95288be9d8a7bb372a4adefe6 | [
"BSD-3-Clause-LBNL"
] | 32 | 2018-11-05T11:51:59.000Z | 2022-03-29T13:09:32.000Z | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2003 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~... | 18.898148 | 87 | 0.468398 |
eol = r"$"
whitespace = r"\s+"
whitespaceOpt = r"\s*"
element = r"[A-Za-z][\w+-]?"
namedElement = r"(?P<%s>" + element + r")"
species = r"[A-Za-z(][\w()=*,-]{0,15}[+]*"
coeff = r"\d+[.]?\d*"
coeffOpt = r"\d+[.]?\d*"
number = r"[+-]?(\d+[.]\d*|[.]\d+|\d+)([eE][-+]?\d{1,3})?"
numberOpt = r"(" + number + ... | true | true |
f7171371220cb2defcde3ccbb021f461672d109a | 258 | py | Python | 6 kyu/PI approximation.py | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | 6 | 2020-09-03T09:32:25.000Z | 2020-12-07T04:10:01.000Z | 6 kyu/PI approximation.py | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | 1 | 2021-12-13T15:30:21.000Z | 2021-12-13T15:30:21.000Z | 6 kyu/PI approximation.py | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | null | null | null | import math
def iter_pi(epsilon):
down=1
res=0
count=0
while abs(res*4-math.pi)>epsilon:
if count%2==0:
res+=1/down
else:
res-=1/down
count+=1
down+=2
return [count, round(res*4,10)] | 19.846154 | 37 | 0.5 | import math
def iter_pi(epsilon):
down=1
res=0
count=0
while abs(res*4-math.pi)>epsilon:
if count%2==0:
res+=1/down
else:
res-=1/down
count+=1
down+=2
return [count, round(res*4,10)] | true | true |
f71713810aaf3fe2f07db20e361f46b522b96650 | 1,562 | py | Python | newsletter/src/newsletter.py | emilybache/BeeFriendly | 7582d8f7140f2d0088404d9cb1d47b6231606c49 | [
"MIT"
] | 4 | 2020-06-14T13:42:39.000Z | 2022-01-29T14:36:53.000Z | newsletter/src/newsletter.py | emilybache/BeeFriendly | 7582d8f7140f2d0088404d9cb1d47b6231606c49 | [
"MIT"
] | 2 | 2022-02-13T15:19:44.000Z | 2022-02-25T12:32:16.000Z | newsletter/src/newsletter.py | emilybache/BeeFriendly | 7582d8f7140f2d0088404d9cb1d47b6231606c49 | [
"MIT"
] | 4 | 2020-06-11T09:31:45.000Z | 2021-08-17T14:00:41.000Z | import sys
import json
import requests
from flask import Flask
from flask import request
from tracing import init_tracer, flask_to_scope
import opentracing
from opentracing.ext import tags
from opentracing_instrumentation.client_hooks import install_all_patches
from flask_opentracing import FlaskTracer
from flask_cors ... | 25.193548 | 72 | 0.68758 | import sys
import json
import requests
from flask import Flask
from flask import request
from tracing import init_tracer, flask_to_scope
import opentracing
from opentracing.ext import tags
from opentracing_instrumentation.client_hooks import install_all_patches
from flask_opentracing import FlaskTracer
from flask_cors ... | true | true |
f71713d9bb5d058485271de369582288349ed788 | 5,787 | py | Python | monkelabs.py | SolanaNFTCollector/Solana-Mining-Bot | 026fa825ba92b0f6d52678cd425d08f63f9e523d | [
"MIT"
] | 26 | 2022-02-13T23:31:49.000Z | 2022-03-31T21:36:28.000Z | monkelabs.py | SolanaNFTCollector/Solana-Mining-Bot | 026fa825ba92b0f6d52678cd425d08f63f9e523d | [
"MIT"
] | 7 | 2022-02-13T23:33:01.000Z | 2022-03-13T20:49:40.000Z | monkelabs.py | SolanaNFTCollector/Solana-Mining-Bot | 026fa825ba92b0f6d52678cd425d08f63f9e523d | [
"MIT"
] | 9 | 2022-02-13T23:31:51.000Z | 2022-03-30T08:50:10.000Z | import requests
import base64
import time
import os
import pathlib
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.keys import Keys
fr... | 40.753521 | 106 | 0.655953 | import requests
import base64
import time
import os
import pathlib
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.keys import Keys
fr... | true | true |
f71713f48e400918eea9548ed6280ac938049c7b | 8,414 | py | Python | nmt/onmt/translate/Translator.py | Priyansh2/csnli | de31f3f5ae0a956496b76a4643fa9ce7f3736d29 | [
"MIT"
] | 21 | 2018-08-29T13:56:35.000Z | 2021-07-12T23:25:14.000Z | nmt/onmt/translate/Translator.py | Priyansh2/csnli | de31f3f5ae0a956496b76a4643fa9ce7f3736d29 | [
"MIT"
] | 4 | 2018-12-08T17:33:31.000Z | 2021-05-16T08:41:16.000Z | nmt/onmt/translate/Translator.py | Priyansh2/csnli | de31f3f5ae0a956496b76a4643fa9ce7f3736d29 | [
"MIT"
] | 10 | 2018-09-17T05:27:09.000Z | 2021-11-01T08:18:30.000Z | import torch
from torch.autograd import Variable
import onmt.translate.Beam
import onmt.io
class Translator(object):
"""
Uses a model to translate a batch of sentences.
Args:
model (:obj:`onmt.modules.NMTModel`):
NMT model to use for translation
fields (dict of Fields): data fie... | 37.730942 | 79 | 0.537794 | import torch
from torch.autograd import Variable
import onmt.translate.Beam
import onmt.io
class Translator(object):
def __init__(self, model, fields,
beam_size, n_best=1,
max_length=100,
global_scorer=None,
copy_attn=False,
cud... | true | true |
f71713fdfa11b82fe9b89f6419ce8da3b95a2129 | 389 | py | Python | nov q3.py | Manthanc007/APS-2o2o | a84337c4e658a93b6c67515fa3ef59b09f2e5e94 | [
"MIT"
] | null | null | null | nov q3.py | Manthanc007/APS-2o2o | a84337c4e658a93b6c67515fa3ef59b09f2e5e94 | [
"MIT"
] | null | null | null | nov q3.py | Manthanc007/APS-2o2o | a84337c4e658a93b6c67515fa3ef59b09f2e5e94 | [
"MIT"
] | null | null | null | l=list(map(int,input().split()))
output=[]
l1=[ 2**i for i in range(2,26)]
a=1
l2=[]
for i in range(len(l1)):
a=l1[i]-a
l2.append(a)
l2.insert(0,1)
l2.insert(0,1)
l1.insert(0,2)
l1.insert(0,0)
l2.insert(0,0)
for i in range(1,len(l)):
a1=l[i]
output.append(l2[a1])
output.append(... | 18.52381 | 33 | 0.55527 | l=list(map(int,input().split()))
output=[]
l1=[ 2**i for i in range(2,26)]
a=1
l2=[]
for i in range(len(l1)):
a=l1[i]-a
l2.append(a)
l2.insert(0,1)
l2.insert(0,1)
l1.insert(0,2)
l1.insert(0,0)
l2.insert(0,0)
for i in range(1,len(l)):
a1=l[i]
output.append(l2[a1])
output.append(... | true | true |
f71715f08d40ed8ad31bcc3c4ff219a7c0938071 | 615 | py | Python | test/test_form_mutation.py | smalllark/mechanize | a514b8474ca1d65514f6c569f7b10a40906fb014 | [
"BSD-3-Clause"
] | 3 | 2015-10-07T05:27:44.000Z | 2017-07-01T05:18:01.000Z | test/test_form_mutation.py | smalllark/mechanize | a514b8474ca1d65514f6c569f7b10a40906fb014 | [
"BSD-3-Clause"
] | null | null | null | test/test_form_mutation.py | smalllark/mechanize | a514b8474ca1d65514f6c569f7b10a40906fb014 | [
"BSD-3-Clause"
] | null | null | null | import unittest
from unittest import TestCase
import mechanize
def first_form(text, base_uri="http://example.com/"):
return mechanize.ParseString(text, base_uri)[0]
class MutationTests(TestCase):
def test_add_textfield(self):
form = first_form('<input type="text" name="foo" value="bar" />')
... | 25.625 | 75 | 0.673171 | import unittest
from unittest import TestCase
import mechanize
def first_form(text, base_uri="http://example.com/"):
return mechanize.ParseString(text, base_uri)[0]
class MutationTests(TestCase):
def test_add_textfield(self):
form = first_form('<input type="text" name="foo" value="bar" />')
... | true | true |
f71716f48a697e06f2c811b63ac0163ef6dae9d4 | 12,993 | py | Python | OXTR_pathway.py | rribeiro-sci/OXTR | 521f60be922e731757b74d90d9b00c4130c99575 | [
"Apache-2.0"
] | null | null | null | OXTR_pathway.py | rribeiro-sci/OXTR | 521f60be922e731757b74d90d9b00c4130c99575 | [
"Apache-2.0"
] | null | null | null | OXTR_pathway.py | rribeiro-sci/OXTR | 521f60be922e731757b74d90d9b00c4130c99575 | [
"Apache-2.0"
] | null | null | null | '''
THE OXYTOCIN RECEPTOR METABOLIC PATHWAY
VERSION 1.0
G alpha q11 coupled receptor
last modification 4 October 2020
References:
1. Chang, Chiung-wen, Ethan Poteet, John A. Schetz, Zeynep H. Gümüş,
and Harel Weinst... | 47.076087 | 308 | 0.682444 |
import os
import sys
import math
import numpy as np
import sympy
from sympy import Piecewise
from pysb import *
from pysb.macros import *
from pysb.integrate import Solver
from pysb.simulator import ScipyOdeSimulator
from pysb.macros import create_t_obs, drug_binding
__author__ = "Rui Ribeiro"
__organizarion__ = "... | true | true |
f717181beb4c4046a045a44b6d0f4db857d85911 | 4,211 | py | Python | forte/processors/stanfordnlp_processor.py | swapnull7/forte | 737a72afd440d40c3826c3a7c5e4e44235c0f701 | [
"Apache-2.0"
] | 2 | 2021-01-01T12:07:27.000Z | 2021-09-10T03:57:18.000Z | forte/processors/stanfordnlp_processor.py | swapnull7/forte | 737a72afd440d40c3826c3a7c5e4e44235c0f701 | [
"Apache-2.0"
] | null | null | null | forte/processors/stanfordnlp_processor.py | swapnull7/forte | 737a72afd440d40c3826c3a7c5e4e44235c0f701 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 The Forte 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 applicable ... | 35.091667 | 74 | 0.566611 |
import logging
from typing import List, Any, Dict
import stanza
from forte.common.configuration import Config
from forte.common.resources import Resources
from forte.data.data_pack import DataPack
from forte.processors.base import PackProcessor
from ft.onto.base_ontology import Token, Sentence, Dependency... | true | true |
f71718fb9e53b3bcc9413c4c7771e00095fa68d9 | 6,615 | py | Python | tests/test_coverage_max_reduce.py | Erotemic/vtool_ibeis | b5dfd5bec43dacc8ea9fc3d6a7f17cd661b678c5 | [
"Apache-2.0"
] | 5 | 2015-04-17T11:27:00.000Z | 2017-11-29T11:31:51.000Z | tests/test_coverage_max_reduce.py | Erotemic/vtool_ibeis | b5dfd5bec43dacc8ea9fc3d6a7f17cd661b678c5 | [
"Apache-2.0"
] | 2 | 2020-06-25T19:02:43.000Z | 2020-06-30T19:33:27.000Z | tests/test_coverage_max_reduce.py | Erotemic/vtool_ibeis | b5dfd5bec43dacc8ea9fc3d6a7f17cd661b678c5 | [
"Apache-2.0"
] | 3 | 2016-07-04T18:22:56.000Z | 2017-03-03T22:50:19.000Z | #Is it possible to use numpy.ufunc.reduce over an iterator of ndarrays?
#I have a generator function that yields ndarrays (all of the same shape and dtype) and I would like to find the maximum value at each index.
#Currently I have code that looks like this:
def main():
import numpy as np
import cv2
sh... | 58.539823 | 177 | 0.579138 |
def main():
import numpy as np
import cv2
shape = (250, 300)
dsize = shape[::-1]
affmat_list = np.array([
[[ 1.57351554e+00, 0.00000000e+00, 1.09061039e+02],
[ -3.61827926e-01, 7.46059970e-01, 2.50669551e+01]],
[[ 3.05754491e+00, 0.00000000e+00, 8.2802... | true | true |
f7171a791e39a7775c3b4fa6f439304244a17891 | 698 | py | Python | contracts_api_test/unit/test_base.py | codeforamerica/contracts-api | cc86380d36c6c5ad3028f557c342ab7d1fbb2ddc | [
"BSD-3-Clause"
] | null | null | null | contracts_api_test/unit/test_base.py | codeforamerica/contracts-api | cc86380d36c6c5ad3028f557c342ab7d1fbb2ddc | [
"BSD-3-Clause"
] | null | null | null | contracts_api_test/unit/test_base.py | codeforamerica/contracts-api | cc86380d36c6c5ad3028f557c342ab7d1fbb2ddc | [
"BSD-3-Clause"
] | 2 | 2020-01-09T03:37:56.000Z | 2021-04-16T10:49:40.000Z | from flask.ext.testing import TestCase
from contracts_api.settings import TestConfig
from contracts_api.app import create_app as _create_app
from contracts_api.database import db
from contracts_api.api.models import Stage, Contract, StageProperty, ContractAudit, Flow
class BaseTestCase(TestCase):
'''
A base t... | 30.347826 | 90 | 0.719198 | from flask.ext.testing import TestCase
from contracts_api.settings import TestConfig
from contracts_api.app import create_app as _create_app
from contracts_api.database import db
from contracts_api.api.models import Stage, Contract, StageProperty, ContractAudit, Flow
class BaseTestCase(TestCase):
def create_app(s... | true | true |
f7171ae01ae8fce11b09972bff09e3872d739860 | 395 | py | Python | sayit/wsgi.py | SarahJaine/say-it | 83ea1493a8f2934d7a82fbdd02113e338adff99f | [
"MIT"
] | null | null | null | sayit/wsgi.py | SarahJaine/say-it | 83ea1493a8f2934d7a82fbdd02113e338adff99f | [
"MIT"
] | 3 | 2017-02-26T23:58:56.000Z | 2017-05-08T00:09:15.000Z | sayit/wsgi.py | SarahJaine/say-it | 83ea1493a8f2934d7a82fbdd02113e338adff99f | [
"MIT"
] | null | null | null | import os
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "sayit.settings")
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
public_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'public')
application = get_wsgi_application()
application = Dj... | 28.214286 | 57 | 0.797468 | import os
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "sayit.settings")
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
public_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'public')
application = get_wsgi_application()
application = Dj... | true | true |
f7171afc41a48d20fb0a9e5cbef0798bf315d360 | 5,238 | py | Python | src/cc_catalog_airflow/dags/provider_api_scripts/test_raw_pixel.py | sarayourfriend/openverse-catalog | b12ba815de782032f72ffa4f5620cfc8de8c84bd | [
"MIT"
] | null | null | null | src/cc_catalog_airflow/dags/provider_api_scripts/test_raw_pixel.py | sarayourfriend/openverse-catalog | b12ba815de782032f72ffa4f5620cfc8de8c84bd | [
"MIT"
] | null | null | null | src/cc_catalog_airflow/dags/provider_api_scripts/test_raw_pixel.py | sarayourfriend/openverse-catalog | b12ba815de782032f72ffa4f5620cfc8de8c84bd | [
"MIT"
] | null | null | null | import json
import logging
import os
from unittest.mock import patch
from common import LicenseInfo, MockImageStore
import raw_pixel as rwp
_license_info = (
'cc0',
'1.0',
'https://creativecommons.org/publicdomain/zero/1.0/',
None
)
license_info = LicenseInfo(*_license_info)
rwp.image_store = MockIma... | 35.876712 | 87 | 0.657312 | import json
import logging
import os
from unittest.mock import patch
from common import LicenseInfo, MockImageStore
import raw_pixel as rwp
_license_info = (
'cc0',
'1.0',
'https://creativecommons.org/publicdomain/zero/1.0/',
None
)
license_info = LicenseInfo(*_license_info)
rwp.image_store = MockIma... | true | true |
f7171bff1d3cb168e55e72b45b4b3d0194d1ce5e | 65,057 | py | Python | ansible/my_env/lib/python2.7/site-packages/ansible/modules/cloud/amazon/ec2.py | otus-devops-2019-02/yyashkin_infra | 0cd0c003884155ac922e3e301305ac202de7028c | [
"MIT"
] | null | null | null | ansible/my_env/lib/python2.7/site-packages/ansible/modules/cloud/amazon/ec2.py | otus-devops-2019-02/yyashkin_infra | 0cd0c003884155ac922e3e301305ac202de7028c | [
"MIT"
] | null | null | null | ansible/my_env/lib/python2.7/site-packages/ansible/modules/cloud/amazon/ec2.py | otus-devops-2019-02/yyashkin_infra | 0cd0c003884155ac922e3e301305ac202de7028c | [
"MIT"
] | null | null | null | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible 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 Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | 38.201409 | 156 | 0.627957 |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
DOCUMENTATION = '''
---
module: ec2
short_description: create, terminate, start or stop an instance in ec2
description:
- Creates or terminates ec2 instance... | true | true |
f7171c2df3dccec4804c1204824186fb4e3f7e3c | 11,988 | py | Python | azurelinuxagent/common/utils/textutil.py | ezeeyahoo/WALinuxAgent | 7bb93ee0d75b91c6e9bc6d69003b4fdce9697ec2 | [
"Apache-2.0"
] | null | null | null | azurelinuxagent/common/utils/textutil.py | ezeeyahoo/WALinuxAgent | 7bb93ee0d75b91c6e9bc6d69003b4fdce9697ec2 | [
"Apache-2.0"
] | null | null | null | azurelinuxagent/common/utils/textutil.py | ezeeyahoo/WALinuxAgent | 7bb93ee0d75b91c6e9bc6d69003b4fdce9697ec2 | [
"Apache-2.0"
] | 1 | 2020-08-18T20:15:17.000Z | 2020-08-18T20:15:17.000Z | # Microsoft Azure Linux Agent
#
# Copyright 2018 Microsoft 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.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | 27.75 | 120 | 0.593427 |
import base64
import crypt
import hashlib
import random
import re
import string
import struct
import sys
import zlib
import xml.dom.minidom as minidom
from azurelinuxagent.common.future import ustr
def parse_doc(xml_text):
xml_text = xml_text.encode('utf-8')
return minidom.parseSt... | true | true |
f7171c608104cc14fe26b6320a24c63490559aab | 1,848 | py | Python | var/spack/repos/builtin/packages/mathematica/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1 | 2020-06-25T15:25:29.000Z | 2020-06-25T15:25:29.000Z | var/spack/repos/builtin/packages/mathematica/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1 | 2018-07-06T19:11:46.000Z | 2018-07-06T19:12:28.000Z | var/spack/repos/builtin/packages/mathematica/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1 | 2020-03-06T11:04:37.000Z | 2020-03-06T11:04:37.000Z | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os
class Mathematica(Package):
"""Mathematica: high-powered computation with thousands of... | 40.173913 | 112 | 0.66829 |
from spack import *
import os
class Mathematica(Package):
homepage = "https://www.wolfram.com/mathematica/"
url = 'file://{0}/Mathematica_12.0.0_LINUX.sh'.format(os.getcwd())
version('12.0.0',
sha256='b9fb71e1afcc1d72c200196ffa434512d208fa2920e207878433f504e58ae9d7',
expand=... | true | true |
f7171cb105ed3aeddea51ce5ca8c8235d6316ea6 | 2,672 | py | Python | utils/normalizer.py | bibofeng/DeepRL-1 | 7b14d9720a8ea1e08b05a2889d699a70174caf8f | [
"Apache-2.0"
] | null | null | null | utils/normalizer.py | bibofeng/DeepRL-1 | 7b14d9720a8ea1e08b05a2889d699a70174caf8f | [
"Apache-2.0"
] | null | null | null | utils/normalizer.py | bibofeng/DeepRL-1 | 7b14d9720a8ea1e08b05a2889d699a70174caf8f | [
"Apache-2.0"
] | 1 | 2021-08-11T19:37:04.000Z | 2021-08-11T19:37:04.000Z | #######################################################################
# Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
################################... | 30.022472 | 83 | 0.483533 | true | true | |
f7171ccc27659928b6ad50c94240b8057bf13f57 | 6,779 | py | Python | t5_closed_book_qa/t5_cbqa/preprocessors.py | DagonDD/google-research | ccd5d36e7a8ee1d672c93a801634bfd8f2e0c3eb | [
"Apache-2.0"
] | 1 | 2020-09-23T11:38:28.000Z | 2020-09-23T11:38:28.000Z | t5_closed_book_qa/t5_cbqa/preprocessors.py | DagonDD/google-research | ccd5d36e7a8ee1d672c93a801634bfd8f2e0c3eb | [
"Apache-2.0"
] | null | null | null | t5_closed_book_qa/t5_cbqa/preprocessors.py | DagonDD/google-research | ccd5d36e7a8ee1d672c93a801634bfd8f2e0c3eb | [
"Apache-2.0"
] | 1 | 2020-09-23T11:38:32.000Z | 2020-09-23T11:38:32.000Z | # coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | 31.384259 | 80 | 0.682107 |
import tensorflow.compat.v1 as tf
def natural_questions_nocontext(
dataset,
prefix='nq question: ',
drop_yes_no=False,
max_tokens=None,
max_answers=None,
):
def nq_map(ex):
inputs = prefix + ex['question']['text']
annotations = ex['annotations']
yes_no_labels = ... | true | true |
f7171d5731043db4e13be2098f930ef1ab4b964b | 2,388 | py | Python | matchms/Fragments.py | maximskorik/matchms | 922f5afaef123a793194bdd74391027477cbb844 | [
"Apache-2.0"
] | null | null | null | matchms/Fragments.py | maximskorik/matchms | 922f5afaef123a793194bdd74391027477cbb844 | [
"Apache-2.0"
] | null | null | null | matchms/Fragments.py | maximskorik/matchms | 922f5afaef123a793194bdd74391027477cbb844 | [
"Apache-2.0"
] | null | null | null | import numpy
class Fragments:
"""
Stores arrays of intensities and M/z values, with some checks on their internal consistency.
For example
.. testcode::
import numpy as np
from matchms import Fragments
mz = np.array([10, 20, 30], dtype="float")
intensities = np.arra... | 29.481481 | 112 | 0.624372 | import numpy
class Fragments:
def __init__(self, mz=None, intensities=None):
assert isinstance(mz, numpy.ndarray), "Input argument 'mz' should be a numpy.array."
assert isinstance(intensities, numpy.ndarray), "Input argument 'intensities' should be a numpy.array."
assert mz.shape == intens... | true | true |
f7171db882ba4b1df49ab8686fc4f9a29d574d7c | 7,255 | py | Python | expenses/views/category.py | PrzemyslawSarnacki/django-expenses | 9e07d57e3e2292a318df7c7d8cc4571bb75309d3 | [
"BSD-3-Clause"
] | 6 | 2018-09-29T23:58:50.000Z | 2022-03-10T03:40:38.000Z | expenses/views/category.py | PrzemyslawSarnacki/django-expenses | 9e07d57e3e2292a318df7c7d8cc4571bb75309d3 | [
"BSD-3-Clause"
] | 2 | 2021-02-15T10:20:23.000Z | 2022-03-09T22:32:37.000Z | expenses/views/category.py | PrzemyslawSarnacki/django-expenses | 9e07d57e3e2292a318df7c7d8cc4571bb75309d3 | [
"BSD-3-Clause"
] | 4 | 2020-08-06T12:44:09.000Z | 2021-04-04T13:45:34.000Z | # Django-Expenses
# Copyright © 2018-2021, Chris Warrick.
# All rights reserved.
# See /LICENSE for licensing information.
"""Category management."""
from collections import defaultdict
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from ... | 32.533632 | 117 | 0.596141 |
from collections import defaultdict
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from dj... | true | true |
f7171e3b6b8107097e5ca08c85f785efd7b32b6f | 1,904 | py | Python | st_nodeserver.py | Einstein42/st-nodeserver | 5309bb8bb4d076f981feed752e39e67db3cb9d00 | [
"MIT"
] | 1 | 2017-04-09T01:49:11.000Z | 2017-04-09T01:49:11.000Z | st_nodeserver.py | Einstein42/st-nodeserver | 5309bb8bb4d076f981feed752e39e67db3cb9d00 | [
"MIT"
] | null | null | null | st_nodeserver.py | Einstein42/st-nodeserver | 5309bb8bb4d076f981feed752e39e67db3cb9d00 | [
"MIT"
] | null | null | null | #!/usr/bin/python
'''
ST Micro Node Server for Polyglot
by Einstein.42(James Milne)
milne.james@gmail.com
'''
import sys
from polyglot.nodeserver_api import SimpleNodeServer, PolyglotConnector
from st_types import STControl
VERSION = "0.0.1"
class STNodeServer(SimpleNodeServer):
''' ST Micro Node Server '... | 31.733333 | 98 | 0.628676 |
import sys
from polyglot.nodeserver_api import SimpleNodeServer, PolyglotConnector
from st_types import STControl
VERSION = "0.0.1"
class STNodeServer(SimpleNodeServer):
sensors = []
def setup(self):
self.logger = self.poly.logger
self.logger.info('Config File param: %s', self.pol... | true | true |
f7172061b131608ed83712b9290ea4258e0d92ab | 4,829 | py | Python | examples/validate_secure_metadata.py | ninchat/ninchat-api | 44d57210c760798ac403fa367ee2f2f280bb5dd6 | [
"BSD-2-Clause"
] | 2 | 2017-07-23T12:51:45.000Z | 2018-12-10T01:12:14.000Z | examples/validate_secure_metadata.py | ninchat/ninchat-api | 44d57210c760798ac403fa367ee2f2f280bb5dd6 | [
"BSD-2-Clause"
] | 1 | 2019-03-25T10:04:25.000Z | 2019-03-25T10:04:25.000Z | examples/validate_secure_metadata.py | ninchat/ninchat-api | 44d57210c760798ac403fa367ee2f2f280bb5dd6 | [
"BSD-2-Clause"
] | 6 | 2016-06-23T07:24:04.000Z | 2021-02-02T13:41:06.000Z | #!/usr/bin/env python3
#
# Copyright (c) 2020, Somia Reality Oy
# All rights reserved.
# Installing dependencies:
#
# - Ubuntu/Debian: apt install python3-cryptography python3-jwcrypto
# - Using pip: pip3 install cryptography jwcrypto
from argparse import ArgumentParser
from base64 import b64decode, urlsafe_b64de... | 34.007042 | 136 | 0.720646 |
from argparse import ArgumentParser
from base64 import b64decode, urlsafe_b64decode, urlsafe_b64encode
from calendar import timegm
from datetime import datetime
from hashlib import sha512
from hmac import compare_digest
from json import dumps, loads
from time import time
from cryptography.hazmat.backends imp... | true | true |
f71720a0eccf6342d22032de87fb4c3251492c1b | 836 | py | Python | plotly/validators/cone/_stream.py | fcollonval/plotly.py | 5c7f100db1af8c82bb740a38ef684955a8ed6d0e | [
"MIT"
] | 2 | 2020-03-24T11:41:14.000Z | 2021-01-14T07:59:43.000Z | plotly/validators/cone/_stream.py | fcollonval/plotly.py | 5c7f100db1af8c82bb740a38ef684955a8ed6d0e | [
"MIT"
] | null | null | null | plotly/validators/cone/_stream.py | fcollonval/plotly.py | 5c7f100db1af8c82bb740a38ef684955a8ed6d0e | [
"MIT"
] | 4 | 2019-06-03T14:49:12.000Z | 2022-01-06T01:05:12.000Z | import _plotly_utils.basevalidators
class StreamValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name='stream', parent_name='cone', **kwargs):
super(StreamValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
d... | 34.833333 | 75 | 0.586124 | import _plotly_utils.basevalidators
class StreamValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name='stream', parent_name='cone', **kwargs):
super(StreamValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
d... | true | true |
f71720bf1e6e85436ed4df37a21e70f073d0583e | 29,705 | py | Python | openaset/distamben/admin.py | muntaza/Open-Aset | f5eb6770a9f7184e3860a18cd655b35b248a9dd5 | [
"BSD-2-Clause"
] | null | null | null | openaset/distamben/admin.py | muntaza/Open-Aset | f5eb6770a9f7184e3860a18cd655b35b248a9dd5 | [
"BSD-2-Clause"
] | null | null | null | openaset/distamben/admin.py | muntaza/Open-Aset | f5eb6770a9f7184e3860a18cd655b35b248a9dd5 | [
"BSD-2-Clause"
] | 2 | 2019-02-18T05:25:23.000Z | 2021-02-01T16:45:23.000Z | ### $Id: admin.py,v 1.29 2017/12/18 09:12:51 muntaza Exp $
from django.contrib import admin
from umum.models import Provinsi, Kabupaten, LokasiBidang, SKPD, SUBSKPD, KodeBarang, HakTanah, SatuanBarang, KeadaanBarang, SKPenghapusan, MutasiBerkurang, JenisPemanfaatan, AsalUsul, Tahun, GolonganBarang, Tanah, KontrakTanah... | 42.254623 | 357 | 0.809291 | Barang, HakTanah, SatuanBarang, KeadaanBarang, SKPenghapusan, MutasiBerkurang, JenisPemanfaatan, AsalUsul, Tahun, GolonganBarang, Tanah, KontrakTanah, PenghapusanTanah, TanahPenghapusan, PemanfaatanTanah, TanahPemanfaatan, HargaTanah, TahunBerkurangUsulHapusTanah, TanahUsulHapus
TanahDistamben, KontrakTanahDistamben,... | true | true |
f71720ecd6a39740e6edfa1bbf6de6885bb541e1 | 1,132 | py | Python | skpr/examples/coded_diffraction.py | PhilippPelz/scikit-pr-open | 50833b13160b6afe0a743d63d560bddeee2c18b5 | [
"MIT"
] | null | null | null | skpr/examples/coded_diffraction.py | PhilippPelz/scikit-pr-open | 50833b13160b6afe0a743d63d560bddeee2c18b5 | [
"MIT"
] | null | null | null | skpr/examples/coded_diffraction.py | PhilippPelz/scikit-pr-open | 50833b13160b6afe0a743d63d560bddeee2c18b5 | [
"MIT"
] | 1 | 2020-11-11T06:51:46.000Z | 2020-11-11T06:51:46.000Z | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 11 10:11:21 2017
@author: philipp
"""
from skpr.core.engines import CodedMeasurementEngine
from skpr.core.models import FarfieldCodedMeasurementNet
from skpr.core.parameters import *
from skpr.inout.h5rw import h5read
from skpr.nn import modules as... | 22.196078 | 63 | 0.770318 |
from skpr.core.engines import CodedMeasurementEngine
from skpr.core.models import FarfieldCodedMeasurementNet
from skpr.core.parameters import *
from skpr.inout.h5rw import h5read
from skpr.nn import modules as M
from skpr.util import *
p = get_default_parameters()
f = h5read('/home/pelzphil/projects/cd_sim.h5')
... | true | true |
f71720f87d0474311aa36f05f3fea5fd99145fd6 | 861 | py | Python | src/solutions/template.py | etillison3350/advent-of-code-2020 | 01fcb1ad79ccfc29dbdd0ef9839e7cf5ea28c156 | [
"MIT"
] | null | null | null | src/solutions/template.py | etillison3350/advent-of-code-2020 | 01fcb1ad79ccfc29dbdd0ef9839e7cf5ea28c156 | [
"MIT"
] | null | null | null | src/solutions/template.py | etillison3350/advent-of-code-2020 | 01fcb1ad79ccfc29dbdd0ef9839e7cf5ea28c156 | [
"MIT"
] | null | null | null | from helpers.executor import Executor
from helpers.util import *
import itertools
from itertools import *
import re
from re import *
import numpy as np
from typing import Any, Callable, Generator, Sequence
day, year = None, None # TODO: Update day and year for current day
split_seq = '\n'
class Solution(Executor)... | 26.090909 | 96 | 0.674797 | from helpers.executor import Executor
from helpers.util import *
import itertools
from itertools import *
import re
from re import *
import numpy as np
from typing import Any, Callable, Generator, Sequence
day, year = None, None
split_seq = '\n'
class Solution(Executor):
def solve(self, r: Sequence[str], pri... | true | true |
f7172172e00faa7405c4c67e0bc74c55f26a1ecc | 1,684 | py | Python | pythonlibs/mantis/fanbei/smarthome/constants.py | adoggie/Tibet.6 | 3c53060edafd80b9c4dafa10699a68d86a410c66 | [
"MIT"
] | 22 | 2019-10-28T07:28:12.000Z | 2022-03-19T15:36:41.000Z | pythonlibs/mantis/fanbei/smarthome/constants.py | adoggie/Tibet.6 | 3c53060edafd80b9c4dafa10699a68d86a410c66 | [
"MIT"
] | 1 | 2019-11-07T04:54:14.000Z | 2019-11-07T07:12:48.000Z | pythonlibs/mantis/fanbei/smarthome/constants.py | adoggie/Tibet.6 | 3c53060edafd80b9c4dafa10699a68d86a410c66 | [
"MIT"
] | 13 | 2019-10-28T07:29:07.000Z | 2021-11-03T06:53:12.000Z | #coding:utf-8
# DeviceActiveListKeyHash = 'blue_earth.device.active.list' # 存放所有上线设备id {a:Time,b:Time}
#
DeviceCommandQueue = 'smartbox.device.command.queue.{device_type}.{device_id}'
#
# DeviceSequence = 'blue_earth.device.sequence'
DeviceChannelPub = 'smartbox.device.channel.pub.{device_id}' # 设备所有原始数据读取之后分发的通道
D... | 43.179487 | 121 | 0.785629 |
tbox.device.command.queue.{device_type}.{device_id}'
DeviceChannelPub = 'smartbox.device.channel.pub.{device_id}'
DeviceAppChannelPub = 'smartbox.device.app.channel.pub.{device_id}'
lPubIoT = '{device_id}'
DeviceChannelPubTraverseDown = 'smartbox.down.pub.{device_id}'
DeviceChannelPubTraverseUp = 'smartb... | true | true |
f7172286b14ddc62ce23b4339aa80a3cd495b4ef | 27,950 | py | Python | example_scripts/basic_project_stats.py | vrooje/Data-digging | ae4ee1de0df0d2686115510ac35f5960d5cfaf08 | [
"MIT"
] | 40 | 2016-05-17T10:53:28.000Z | 2022-02-08T05:02:21.000Z | example_scripts/basic_project_stats.py | vrooje/Data-digging | ae4ee1de0df0d2686115510ac35f5960d5cfaf08 | [
"MIT"
] | 29 | 2016-03-17T03:17:03.000Z | 2020-10-01T17:27:59.000Z | example_scripts/basic_project_stats.py | vrooje/Data-digging | ae4ee1de0df0d2686115510ac35f5960d5cfaf08 | [
"MIT"
] | 34 | 2015-12-04T15:18:12.000Z | 2021-08-13T13:35:49.000Z | #Python 2.7.9 (default, Apr 5 2015, 22:21:35)
# the full environment I used to test this is in basic_project_stats.yml
import sys
# file with raw classifications (csv)
# put this way up here so if there are no inputs we exit quickly before even trying to load everything else
try:
classfile_in = sys.argv[1]
except... | 46.505824 | 377 | 0.712916 |
import sys
try:
classfile_in = sys.argv[1]
except:
print("\nUsage: %s classifications_infile" % sys.argv[0])
print(" classifications_infile is a Zooniverse (Panoptes) classifications data export CSV.\n")
print(" Optional inputs:")
print(" workflow_id=N")
print(" specify the p... | true | true |
f71722c909f61d25a111b3cedd33fb84627eb888 | 29,871 | py | Python | msp430backend/msp430_ws/server_protocol.py | zlalanne/msp430-webcontrol | a4e8f84942c3e16fa447907d2cfff4587013d6b3 | [
"BSD-3-Clause"
] | null | null | null | msp430backend/msp430_ws/server_protocol.py | zlalanne/msp430-webcontrol | a4e8f84942c3e16fa447907d2cfff4587013d6b3 | [
"BSD-3-Clause"
] | null | null | null | msp430backend/msp430_ws/server_protocol.py | zlalanne/msp430-webcontrol | a4e8f84942c3e16fa447907d2cfff4587013d6b3 | [
"BSD-3-Clause"
] | null | null | null | import requests
import json
import sys
import re
from twisted.internet.error import ConnectionDone
from twisted.internet import protocol, threads, reactor
from twisted.protocols.basic import LineReceiver
from twisted.python import log
from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol, Http... | 35.773653 | 132 | 0.614174 | import requests
import json
import sys
import re
from twisted.internet.error import ConnectionDone
from twisted.internet import protocol, threads, reactor
from twisted.protocols.basic import LineReceiver
from twisted.python import log
from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol, Http... | true | true |
f71723d3940a1fbf9bf3aa6a991155af7fdbb8a9 | 1,520 | py | Python | solfasol/publications/migrations/0011_auto_20201008_1533.py | rekognize/solfasol | c960c3364c753d75161242eccac4f085d800c843 | [
"MIT"
] | null | null | null | solfasol/publications/migrations/0011_auto_20201008_1533.py | rekognize/solfasol | c960c3364c753d75161242eccac4f085d800c843 | [
"MIT"
] | 1 | 2020-06-18T13:08:47.000Z | 2020-06-18T13:08:47.000Z | solfasol/publications/migrations/0011_auto_20201008_1533.py | Solfasol/solfasol | c960c3364c753d75161242eccac4f085d800c843 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.1 on 2020-10-08 12:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('publications', '0010_auto_20201007_2250'),
]
operations = [
migrations.AddField(
model_name='publication',
name='ema... | 31.020408 | 91 | 0.571711 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('publications', '0010_auto_20201007_2250'),
]
operations = [
migrations.AddField(
model_name='publication',
name='email',
field=models.CharField(blank=T... | true | true |
f71723fdc10ac4d26d6a68387acb900d9d2c358c | 674 | py | Python | pipeline/python/ion/reports/parseBeadfind.py | konradotto/TS | bf088bd8432b1e3f4b8c8c083650a30d9ef2ae2e | [
"Apache-2.0"
] | 125 | 2015-01-22T05:43:23.000Z | 2022-03-22T17:15:59.000Z | pipeline/python/ion/reports/parseBeadfind.py | konradotto/TS | bf088bd8432b1e3f4b8c8c083650a30d9ef2ae2e | [
"Apache-2.0"
] | 59 | 2015-02-10T09:13:06.000Z | 2021-11-11T02:32:38.000Z | pipeline/python/ion/reports/parseBeadfind.py | konradotto/TS | bf088bd8432b1e3f4b8c8c083650a30d9ef2ae2e | [
"Apache-2.0"
] | 98 | 2015-01-17T01:25:10.000Z | 2022-03-18T17:29:42.000Z | # Copyright (C) 2010 Ion Torrent Systems, Inc. All Rights Reserved
import sys
def parseLog(logText):
metrics = {}
# Get Headings for beadfind
for line in logText:
if "=" in line:
name = line.strip().split("=")
key = name[0].strip()
value = name[1].strip()
... | 21.0625 | 66 | 0.581602 |
import sys
def parseLog(logText):
metrics = {}
for line in logText:
if "=" in line:
name = line.strip().split("=")
key = name[0].strip()
value = name[1].strip()
metrics[key] = value
return metrics
def generateMetrics(beadPath):
f = open(... | true | true |
f71724f0b63a8c3aadbf9ee4f9fbfb6ac8561c54 | 4,900 | py | Python | temboo/core/Library/NPR/StoryFinder/GetListByID.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 7 | 2016-03-07T02:07:21.000Z | 2022-01-21T02:22:41.000Z | temboo/core/Library/NPR/StoryFinder/GetListByID.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | null | null | null | temboo/core/Library/NPR/StoryFinder/GetListByID.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 8 | 2016-06-14T06:01:11.000Z | 2020-04-22T09:21:44.000Z | # -*- coding: utf-8 -*-
###############################################################################
#
# GetListByID
# Retrieves a list of NPR categories from a specified list type ID.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"... | 43.362832 | 258 | 0.686939 | true | true | |
f71725ad870be675205ea0d7cbcda78635c972b3 | 3,720 | py | Python | CodonSubstitution/build/biopython/Tests/test_SCOP_Raf.py | JackCurragh/DARNED | 13963d129bd8f69fb1106ad1f47394b3211a939c | [
"MIT"
] | 1 | 2015-10-07T20:34:29.000Z | 2015-10-07T20:34:29.000Z | CodonSubstitution/build/biopython/Tests/test_SCOP_Raf.py | JackCurragh/DARNED | 13963d129bd8f69fb1106ad1f47394b3211a939c | [
"MIT"
] | null | null | null | CodonSubstitution/build/biopython/Tests/test_SCOP_Raf.py | JackCurragh/DARNED | 13963d129bd8f69fb1106ad1f47394b3211a939c | [
"MIT"
] | null | null | null |
"""Unit test for Raf"""
import unittest
from Bio.SCOP import Raf
class RafTests(unittest.TestCase):
rafLine = "101m_ 0.01 38 010301 111011 0 153 0 mm 1 vv 2 ll 3 ss 4 ee 5 gg 6 ee 7 ww 8 qq 9 ll 10 vv 11 ll 12 hh 13 vv 14 ww 15 aa 16 kk 17 vv 18 ee 19 aa 20 dd 21 vv 22 a... | 39.157895 | 1,132 | 0.583871 |
import unittest
from Bio.SCOP import Raf
class RafTests(unittest.TestCase):
rafLine = "101m_ 0.01 38 010301 111011 0 153 0 mm 1 vv 2 ll 3 ss 4 ee 5 gg 6 ee 7 ww 8 qq 9 ll 10 vv 11 ll 12 hh 13 vv 14 ww 15 aa 16 kk 17 vv 18 ee 19 aa 20 dd 21 vv 22 aa 23 gg 24 hh 25 gg ... | true | true |
f71726d73754bd88715d19bd42c1ca917206a9ec | 526 | py | Python | human_services/phone_at_location/migrations/0004_auto_20191230_2338.py | pg-irc/pathways-backend | 05a8c4e750523d2d081b030a248c5444d1ed7992 | [
"BSD-3-Clause"
] | 12 | 2017-08-30T18:21:00.000Z | 2021-12-09T04:04:17.000Z | human_services/phone_at_location/migrations/0004_auto_20191230_2338.py | pg-irc/pathways-backend | 05a8c4e750523d2d081b030a248c5444d1ed7992 | [
"BSD-3-Clause"
] | 424 | 2017-08-08T18:32:14.000Z | 2022-03-30T21:42:51.000Z | human_services/phone_at_location/migrations/0004_auto_20191230_2338.py | pg-irc/pathways-backend | 05a8c4e750523d2d081b030a248c5444d1ed7992 | [
"BSD-3-Clause"
] | 7 | 2017-09-29T21:14:37.000Z | 2019-12-30T21:07:37.000Z | # Generated by Django 2.2.4 on 2019-12-30 23:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('phone_at_location', '0003_auto_20180910_1743'),
]
operations = [
migrations.AlterField(
model_n... | 26.3 | 136 | 0.6673 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('phone_at_location', '0003_auto_20180910_1743'),
]
operations = [
migrations.AlterField(
model_name='phoneatlocation',
name='locati... | true | true |
f717275ca2c8359dcf62adea379cace6a5b31975 | 29,190 | py | Python | zipline/pipeline/term.py | welly87/zipline | dbdfa8ed86417f954e95bd7468e144589f2cd482 | [
"Apache-2.0"
] | 2 | 2019-05-23T17:19:42.000Z | 2019-06-19T21:49:21.000Z | zipline/pipeline/term.py | welly87/zipline | dbdfa8ed86417f954e95bd7468e144589f2cd482 | [
"Apache-2.0"
] | 1 | 2021-03-25T23:28:04.000Z | 2021-03-25T23:28:04.000Z | zipline/pipeline/term.py | welly87/zipline | dbdfa8ed86417f954e95bd7468e144589f2cd482 | [
"Apache-2.0"
] | 2 | 2020-03-17T23:23:05.000Z | 2020-05-01T20:26:44.000Z | """
Base class for Filters, Factors and Classifiers
"""
from abc import ABCMeta, abstractproperty
from bisect import insort
from collections import Mapping
from weakref import WeakValueDictionary
from numpy import (
array,
dtype as dtype_class,
ndarray,
searchsorted,
)
from six import with_metaclass
f... | 32.289823 | 79 | 0.598664 | from abc import ABCMeta, abstractproperty
from bisect import insort
from collections import Mapping
from weakref import WeakValueDictionary
from numpy import (
array,
dtype as dtype_class,
ndarray,
searchsorted,
)
from six import with_metaclass
from zipline.assets import Asset
from zipline.errors impo... | true | true |
f71727c1dc39153ee0b3faeb26aa5bded60a358e | 1,706 | py | Python | sources/models/components/resistor_model.py | pablintino/Altium-DBlib-source | 65e85572f84048a7e7c5a116b429e09ac9a33e82 | [
"MIT"
] | 1 | 2021-06-23T20:19:45.000Z | 2021-06-23T20:19:45.000Z | sources/models/components/resistor_model.py | pablintino/Altium-DBlib-source | 65e85572f84048a7e7c5a116b429e09ac9a33e82 | [
"MIT"
] | null | null | null | sources/models/components/resistor_model.py | pablintino/Altium-DBlib-source | 65e85572f84048a7e7c5a116b429e09ac9a33e82 | [
"MIT"
] | null | null | null | #
# MIT License
#
# Copyright (c) 2020 Pablo Rodriguez Nava, @pablintino
#
# 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
# t... | 37.911111 | 81 | 0.751465 |
from sqlalchemy import Column, String, ForeignKey
from models.components.component_model import ComponentModel
class ResistorModel(ComponentModel):
__tablename__ = 'resistor'
__id_prefix__ = 'RFIX'
id = Column(ForeignKey("component.id"), primary_key=True)
power_max... | true | true |
f717282762e91799ab097381b849786ec18cef78 | 213 | py | Python | tensorbay/opendataset/SegTrack2/__init__.py | Hoteryoung/tensorbay-python-sdk | 53c34dd529c20ec69b34ddd348b5c8e74f4094d0 | [
"MIT"
] | null | null | null | tensorbay/opendataset/SegTrack2/__init__.py | Hoteryoung/tensorbay-python-sdk | 53c34dd529c20ec69b34ddd348b5c8e74f4094d0 | [
"MIT"
] | null | null | null | tensorbay/opendataset/SegTrack2/__init__.py | Hoteryoung/tensorbay-python-sdk | 53c34dd529c20ec69b34ddd348b5c8e74f4094d0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#
# Copytright 2021 Graviti. Licensed under MIT License.
#
# pylint: disable=invalid-name
"""Dataloader of the SegTrack2 dataset."""
from .loader import SegTrack2
__all__ = ["SegTrack2"]
| 17.75 | 54 | 0.732394 |
from .loader import SegTrack2
__all__ = ["SegTrack2"]
| true | true |
f7172919cb32b1bce840769389a548df78d2e786 | 3,420 | py | Python | tempest/api/compute/admin/test_fixed_ips_negative.py | midokura/tempest | b0ec1d280f057d5d9c2eda081bcbda7e381ecb3b | [
"Apache-2.0"
] | null | null | null | tempest/api/compute/admin/test_fixed_ips_negative.py | midokura/tempest | b0ec1d280f057d5d9c2eda081bcbda7e381ecb3b | [
"Apache-2.0"
] | null | null | null | tempest/api/compute/admin/test_fixed_ips_negative.py | midokura/tempest | b0ec1d280f057d5d9c2eda081bcbda7e381ecb3b | [
"Apache-2.0"
] | null | null | null | # Copyright 2013 NEC Corporation. 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 ... | 39.767442 | 78 | 0.635965 |
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
from tempest import config
from tempest import test
CONF = config.CONF
class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
@classmethod
def resource_setup(cls):
super(FixedIPsNegativeTestJson, ... | true | true |
f717292cec5c724f5760c7a638af9b8247d18a07 | 21,662 | py | Python | phi/tf/tf_backend.py | PhylomatX/PhiFlow | 2b7a73c1f595e288d26945cd53cc482952bb1db9 | [
"MIT"
] | null | null | null | phi/tf/tf_backend.py | PhylomatX/PhiFlow | 2b7a73c1f595e288d26945cd53cc482952bb1db9 | [
"MIT"
] | null | null | null | phi/tf/tf_backend.py | PhylomatX/PhiFlow | 2b7a73c1f595e288d26945cd53cc482952bb1db9 | [
"MIT"
] | 1 | 2021-05-04T16:31:41.000Z | 2021-05-04T16:31:41.000Z | import numbers
import uuid
import warnings
from packaging import version
import six
import numpy as np
import six
import tensorflow as tf
from packaging import version
from phi.backend.backend_helper import split_multi_mode_pad, PadSettings, general_grid_sample_nd, equalize_shapes, circular_pad, replicate_pad
from ph... | 39.030631 | 186 | 0.634383 | import numbers
import uuid
import warnings
from packaging import version
import six
import numpy as np
import six
import tensorflow as tf
from packaging import version
from phi.backend.backend_helper import split_multi_mode_pad, PadSettings, general_grid_sample_nd, equalize_shapes, circular_pad, replicate_pad
from ph... | true | true |
f7172942f9d5947ca0af46c7c7e888e04cf6623f | 6,675 | py | Python | bindings/python/ensmallen_graph/datasets/string/flavobacteriumhydatis.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/flavobacteriumhydatis.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/flavobacteriumhydatis.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | """
This file offers the methods to automatically retrieve the graph Flavobacterium hydatis.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 2021... | 35.31746 | 223 | 0.703221 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen_graph import EnsmallenGraph
def FlavobacteriumHydatis(
directed: bool = False,
verbose: int = 2,
cache_path: str = "graphs/string",
**additional_graph_kwargs: Dict
) -> EnsmallenGraph:
... | true | true |
f7172b0b8c3ea7766ba1803624338fcfaab912a0 | 1,473 | py | Python | Python/Algorithms/232.py | DimitrisJim/leetcode_solutions | 765ea578748f8c9b21243dec9dc8a16163e85c0c | [
"Unlicense"
] | 2 | 2021-01-15T17:22:54.000Z | 2021-05-16T19:58:02.000Z | Python/Algorithms/232.py | DimitrisJim/leetcode_solutions | 765ea578748f8c9b21243dec9dc8a16163e85c0c | [
"Unlicense"
] | null | null | null | Python/Algorithms/232.py | DimitrisJim/leetcode_solutions | 765ea578748f8c9b21243dec9dc8a16163e85c0c | [
"Unlicense"
] | null | null | null | class MyQueue:
def __init__(self):
""" Uses two stacks to implement a Queue. Storage holds elements
pushed right before the first pop.
"""
self.storage, self.tmp = [], []
def push(self, x: int) -> None:
""" Unconditionally add to storage. Equivalent to stack.push."""
... | 30.6875 | 79 | 0.551935 | class MyQueue:
def __init__(self):
self.storage, self.tmp = [], []
def push(self, x: int) -> None:
self.storage.append(x)
def pop(self) -> int:
tmp = self.tmp
if not tmp:
storage = self.storage
while storage:
tmp.appen... | true | true |
f7172cfeb48041bf769a78d5a1e56314062ba794 | 5,141 | py | Python | library/f5bigip_net_route_domain.py | GabrielFortin/ansible-module-f5bigip | 8d1323e912388e20eafd63a73ec015dd6d8a012c | [
"Apache-2.0"
] | 6 | 2017-01-11T01:28:00.000Z | 2019-02-19T16:11:09.000Z | library/f5bigip_net_route_domain.py | GabrielFortin/ansible-module-f5bigip | 8d1323e912388e20eafd63a73ec015dd6d8a012c | [
"Apache-2.0"
] | 48 | 2017-05-29T17:50:59.000Z | 2020-02-09T15:24:27.000Z | library/f5bigip_net_route_domain.py | GabrielFortin/ansible-module-f5bigip | 8d1323e912388e20eafd63a73ec015dd6d8a012c | [
"Apache-2.0"
] | 5 | 2017-05-05T18:30:51.000Z | 2017-12-19T23:13:05.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018, Eric Jacob <erjac77@gmail.com>
#
# 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/LICENS... | 32.333333 | 115 | 0.665435 |
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: f5bigip_net_route_domain
short_description: BIG-IP net route-domain module
description:
- Configures route-domains for traffic management.
version_added:... | true | true |
f7172d0eeab28f547639ac4e3e76bcd936be54db | 1,149 | py | Python | tensorlayer/layers/__init__.py | yazdotai/tensorlayer | dea9d4023b578b4452c3861618e46466d4553658 | [
"Apache-2.0"
] | 1 | 2019-02-24T22:23:59.000Z | 2019-02-24T22:23:59.000Z | tensorlayer/layers/__init__.py | yazdotai/tensorlayer | dea9d4023b578b4452c3861618e46466d4553658 | [
"Apache-2.0"
] | null | null | null | tensorlayer/layers/__init__.py | yazdotai/tensorlayer | dea9d4023b578b4452c3861618e46466d4553658 | [
"Apache-2.0"
] | null | null | null | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""
TensorLayer provides rich layer implementations trailed for
various benchmarks and domain-specific problems. In addition, we also
support transparent access to native TensorFlow parameters.
For example, we provide not only layers for local response normalization, but also
... | 31.054054 | 115 | 0.767624 |
from .binary import *
from .convolution import *
from .core import *
from .dense import *
from .dropout import *
from .extend import *
from .flow_control import *
from .image_resize import *
from .importer import *
from .inputs import *
from .merge import *
from .noise import *
from .normalization import *
from .obj... | true | true |
f7172d3dba51a3291b1ccf91d79c1b90f924a771 | 473 | py | Python | app/ch13-validation/starter/pypi_org/views/cms_views.py | tbensonwest/data-driven-web-apps-with-flask | be025c1c0190419019924f7516f49b3b8452cdf8 | [
"MIT"
] | 496 | 2019-07-03T05:13:24.000Z | 2022-03-27T01:15:10.000Z | app/ch13-validation/starter/pypi_org/views/cms_views.py | tbensonwest/data-driven-web-apps-with-flask | be025c1c0190419019924f7516f49b3b8452cdf8 | [
"MIT"
] | 28 | 2021-03-10T08:24:07.000Z | 2022-03-02T07:26:39.000Z | app/ch13-validation/starter/pypi_org/views/cms_views.py | tbensonwest/data-driven-web-apps-with-flask | be025c1c0190419019924f7516f49b3b8452cdf8 | [
"MIT"
] | 562 | 2019-07-03T14:35:21.000Z | 2022-03-31T06:23:58.000Z | import flask
from pypi_org.infrastructure.view_modifiers import response
import pypi_org.services.cms_service as cms_service
blueprint = flask.Blueprint('cms', __name__, template_folder='templates')
@blueprint.route('/<path:full_url>')
@response(template_file='cms/page.html')
def cms_page(full_url: str):
print(... | 24.894737 | 73 | 0.748414 | import flask
from pypi_org.infrastructure.view_modifiers import response
import pypi_org.services.cms_service as cms_service
blueprint = flask.Blueprint('cms', __name__, template_folder='templates')
@blueprint.route('/<path:full_url>')
@response(template_file='cms/page.html')
def cms_page(full_url: str):
print(... | true | true |
f7172eb93f55fa05275985968c5cd0ba4d4c38c0 | 966 | py | Python | robosuite/models/arenas/hole_arena.py | junjungoal/robosuite | 14a9a8672bb14145dd4586a0c0080e1d0d3ff74e | [
"MIT"
] | null | null | null | robosuite/models/arenas/hole_arena.py | junjungoal/robosuite | 14a9a8672bb14145dd4586a0c0080e1d0d3ff74e | [
"MIT"
] | null | null | null | robosuite/models/arenas/hole_arena.py | junjungoal/robosuite | 14a9a8672bb14145dd4586a0c0080e1d0d3ff74e | [
"MIT"
] | null | null | null | from robosuite.models.arenas import TableArena
class HoleArena(TableArena):
"""
Workspace that contains a tabletop with two fixed pegs.
Args:
table_full_size (3-tuple): (L,W,H) full dimensions of the table
table_friction (3-tuple): (sliding, torsional, rolling) friction parameters of the ... | 32.2 | 96 | 0.624224 | from robosuite.models.arenas import TableArena
class HoleArena(TableArena):
def __init__(
self,
table_full_size=(0.45, 0.69, 0.05),
table_friction=(1, 0.005, 0.0001),
table_offset=(0, 0, 0),
):
super().__init__(
table_full_size=table_full_size,
... | true | true |
f7172fbd187e9bb300b57d617d3830a727c1ba69 | 3,748 | py | Python | usaspending_api/idvs/v2/views/funding_rollup.py | gaybro8777/usaspending-api | fe9d730acd632401bbbefa168e3d86d59560314b | [
"CC0-1.0"
] | 1 | 2020-06-15T19:59:52.000Z | 2020-06-15T19:59:52.000Z | usaspending_api/idvs/v2/views/funding_rollup.py | gaybro8777/usaspending-api | fe9d730acd632401bbbefa168e3d86d59560314b | [
"CC0-1.0"
] | null | null | null | usaspending_api/idvs/v2/views/funding_rollup.py | gaybro8777/usaspending-api | fe9d730acd632401bbbefa168e3d86d59560314b | [
"CC0-1.0"
] | null | null | null | from collections import OrderedDict
from psycopg2.sql import Identifier, Literal, SQL
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.views import APIView
from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.common.helpers.s... | 44.094118 | 107 | 0.702241 | from collections import OrderedDict
from psycopg2.sql import Identifier, Literal, SQL
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.views import APIView
from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.common.helpers.s... | true | true |
f7173014b1cb6f863746c4e0773f7adabde24751 | 1,474 | py | Python | test/test_runner_change.py | akxlr/bf-stream-py | f2d5fb1afbfcae61713f2414da3e40d326960e58 | [
"Apache-2.0"
] | null | null | null | test/test_runner_change.py | akxlr/bf-stream-py | f2d5fb1afbfcae61713f2414da3e40d326960e58 | [
"Apache-2.0"
] | null | null | null | test/test_runner_change.py | akxlr/bf-stream-py | f2d5fb1afbfcae61713f2414da3e40d326960e58 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Betfair: Exchange Streaming API
API to receive streamed updates. This is an ssl socket connection of CRLF delimited json messages (see RequestMessage & ResponseMessage)
OpenAPI spec version: 1.0.1423
Contact: bdp@betfair.com
Generated by: https://github.com/swagger-api/swagger... | 27.811321 | 140 | 0.718453 |
from __future__ import absolute_import
import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.runner_change import RunnerChange
class TestRunnerChange(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
... | true | true |
f717303bc1bbfdb991baae18496729085b8816f6 | 1,283 | py | Python | jupyterlab/PrettifyPage.py | Larz60p/MakerProjectApril2019 | 2fd4d68aa66c1f4ad3b01f6a9589a078319280d7 | [
"MIT"
] | 1 | 2019-04-25T22:53:52.000Z | 2019-04-25T22:53:52.000Z | jupyterlab/PrettifyPage.py | Larz60p/MakerProjectApril2019 | 2fd4d68aa66c1f4ad3b01f6a9589a078319280d7 | [
"MIT"
] | null | null | null | jupyterlab/PrettifyPage.py | Larz60p/MakerProjectApril2019 | 2fd4d68aa66c1f4ad3b01f6a9589a078319280d7 | [
"MIT"
] | null | null | null | # PrettifyPage.py
from bs4 import BeautifulSoup
import requests
import BusinessPaths
import pathlib
class PrettifyPage:
def __init__(self):
self.bpath = BusinessPaths.BusinessPaths()
def prettify(self, soup, indent):
pretty_soup = str()
previous_indent = 0
for line in soup.pr... | 31.292683 | 76 | 0.632112 |
from bs4 import BeautifulSoup
import requests
import BusinessPaths
import pathlib
class PrettifyPage:
def __init__(self):
self.bpath = BusinessPaths.BusinessPaths()
def prettify(self, soup, indent):
pretty_soup = str()
previous_indent = 0
for line in soup.prettify().split("\... | true | true |
f71730b686a7fb863fdc989a73270099f5159e60 | 2,381 | py | Python | Python 3 Codes/bert_embed.py | Nitinram23/text-to-image | f819bed3dffbccd8e20b03741e3f67178729812b | [
"MIT"
] | null | null | null | Python 3 Codes/bert_embed.py | Nitinram23/text-to-image | f819bed3dffbccd8e20b03741e3f67178729812b | [
"MIT"
] | null | null | null | Python 3 Codes/bert_embed.py | Nitinram23/text-to-image | f819bed3dffbccd8e20b03741e3f67178729812b | [
"MIT"
] | null | null | null | from bert_embedding import BertEmbedding
import numpy as np
import pickle
import argparse
import json
import os
from os.path import join, isfile
import re
import h5py
def save_caption_vectors_flowers(data_dir):
import time
img_dir = join(data_dir, 'flowers/jpg')
image_files = [f for f in os.listdir(img_dir) if 'j... | 30.139241 | 77 | 0.692986 | from bert_embedding import BertEmbedding
import numpy as np
import pickle
import argparse
import json
import os
from os.path import join, isfile
import re
import h5py
def save_caption_vectors_flowers(data_dir):
import time
img_dir = join(data_dir, 'flowers/jpg')
image_files = [f for f in os.listdir(img_dir) if 'j... | true | true |
f71730dab83cd1a03f3141bd046a4fc4403b2874 | 1,886 | py | Python | libs/play_db.py | fangMint/django_web | cf50df6c1a2358996620ac83ffa99b31472d3c07 | [
"AFL-3.0"
] | null | null | null | libs/play_db.py | fangMint/django_web | cf50df6c1a2358996620ac83ffa99b31472d3c07 | [
"AFL-3.0"
] | null | null | null | libs/play_db.py | fangMint/django_web | cf50df6c1a2358996620ac83ffa99b31472d3c07 | [
"AFL-3.0"
] | 1 | 2021-11-22T10:15:50.000Z | 2021-11-22T10:15:50.000Z | # ==================================
# Author : fang
# Time : 2020/4/8 pm 8:55
# Email : zhen.fang@qdreamer.com
# File : play_db.py
# Software : PyCharm
# ==================================
import datetime
DB = {}
class PlayDB:
def __init__(self, inherited=False):
if inherited:
s... | 27.333333 | 83 | 0.534995 |
import datetime
DB = {}
class PlayDB:
def __init__(self, inherited=False):
if inherited:
self.__store = DB
else:
self.__store = {}
@staticmethod
def __timestamp():
time_stamp = datetime.datetime.now().timestamp()
time_stamp = int(round(tim... | true | true |
f71730fb4a31346934ff7ec9a4083bfc3b7a99ee | 16,084 | py | Python | pandas/tests/reshape/test_cut.py | developing-coder/pandas | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | [
"BSD-3-Clause"
] | 1 | 2019-05-04T03:42:25.000Z | 2019-05-04T03:42:25.000Z | pandas/tests/reshape/test_cut.py | developing-coder/pandas | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | [
"BSD-3-Clause"
] | null | null | null | pandas/tests/reshape/test_cut.py | developing-coder/pandas | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | [
"BSD-3-Clause"
] | 1 | 2020-01-02T14:28:17.000Z | 2020-01-02T14:28:17.000Z | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical, DataFrame, DatetimeIndex, Index, Interval, IntervalIndex,
Series, TimedeltaIndex, Timestamp, cut, date_range, isna, qcut,
timedelta_range, to_datetime)
from pandas.api.types import CategoricalDtype as CDT
import pandas.c... | 32.959016 | 79 | 0.624347 | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical, DataFrame, DatetimeIndex, Index, Interval, IntervalIndex,
Series, TimedeltaIndex, Timestamp, cut, date_range, isna, qcut,
timedelta_range, to_datetime)
from pandas.api.types import CategoricalDtype as CDT
import pandas.c... | true | true |
f71733ffb9bbff488b8f191f8cc9d6dc64459192 | 2,702 | py | Python | Solutions/Trend Micro Vision One/Data Connectors/AzureFunctionTrendMicroXDR/shared_code/configurations.py | sxchuba/Azure-Sentinel | 0f5f543981901dbd9d9654f8f2d0010f8af1e9a6 | [
"MIT"
] | 11 | 2019-02-04T13:37:14.000Z | 2019-02-22T20:47:06.000Z | Solutions/Trend Micro Vision One/Data Connectors/AzureFunctionTrendMicroXDR/shared_code/configurations.py | sxchuba/Azure-Sentinel | 0f5f543981901dbd9d9654f8f2d0010f8af1e9a6 | [
"MIT"
] | 6 | 2019-02-03T13:58:50.000Z | 2019-02-25T02:01:16.000Z | Solutions/Trend Micro Vision One/Data Connectors/AzureFunctionTrendMicroXDR/shared_code/configurations.py | sxchuba/Azure-Sentinel | 0f5f543981901dbd9d9654f8f2d0010f8af1e9a6 | [
"MIT"
] | 4 | 2019-02-03T09:20:27.000Z | 2019-02-12T15:43:35.000Z | import os
VERSION = '1.0.1'
SIEM_NAME = 'SentinelAddon'
XDR_HOSTS = {
'us': 'https://api.xdr.trendmicro.com',
'eu': 'https://api.eu.xdr.trendmicro.com',
'in': 'https://api.in.xdr.trendmicro.com',
'jp': 'https://api.xdr.trendmicro.co.jp',
'sg': 'https://api.sg.xdr.trendmicro.com',
'au': 'https:... | 24.563636 | 88 | 0.707994 | import os
VERSION = '1.0.1'
SIEM_NAME = 'SentinelAddon'
XDR_HOSTS = {
'us': 'https://api.xdr.trendmicro.com',
'eu': 'https://api.eu.xdr.trendmicro.com',
'in': 'https://api.in.xdr.trendmicro.com',
'jp': 'https://api.xdr.trendmicro.co.jp',
'sg': 'https://api.sg.xdr.trendmicro.com',
'au': 'https:... | true | true |
f7173583513fd2e9bcaf8f9083a5b3c6349ba684 | 8,045 | py | Python | env/EnvMultipleStock_train.py | rlaplaza/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020 | 5fe6b8554587320bc6044164270635166c93616d | [
"MIT"
] | null | null | null | env/EnvMultipleStock_train.py | rlaplaza/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020 | 5fe6b8554587320bc6044164270635166c93616d | [
"MIT"
] | null | null | null | env/EnvMultipleStock_train.py | rlaplaza/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020 | 5fe6b8554587320bc6044164270635166c93616d | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
from gym.utils import seeding
import gym
from gym import spaces
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
# shares normalization factor
# 100 shares per trade
HMAX_NORMALIZE = 100
# initial amount of money we have in our account
INITIAL_ACCOUNT_BALA... | 35.915179 | 168 | 0.549037 | import numpy as np
import pandas as pd
from gym.utils import seeding
import gym
from gym import spaces
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
HMAX_NORMALIZE = 100
INITIAL_ACCOUNT_BALANCE = 1000000
STOCK_DIM = 30
TRANSACTION_FEE_PERCENT = 0.001
REWARD_SCALING = 1e-4
class StockE... | true | true |
f71735a115665e8722defa42706030357a5b5f70 | 13,762 | py | Python | src/asldro/validators/test_user_parameter_input.py | gold-standard-phantoms/asldro | 6ae82ed69d66fed64e1e54e5394cc3b5d8dbe1bd | [
"MIT"
] | 3 | 2021-03-09T15:51:32.000Z | 2021-05-19T13:05:18.000Z | src/asldro/validators/test_user_parameter_input.py | gold-standard-phantoms/asldro | 6ae82ed69d66fed64e1e54e5394cc3b5d8dbe1bd | [
"MIT"
] | null | null | null | src/asldro/validators/test_user_parameter_input.py | gold-standard-phantoms/asldro | 6ae82ed69d66fed64e1e54e5394cc3b5d8dbe1bd | [
"MIT"
] | null | null | null | """ Tests some user inputs to the model to make sure the validation is performed correctly """
# pylint: disable=redefined-outer-name
from copy import deepcopy
import pytest
from asldro.data.filepaths import GROUND_TRUTH_DATA
from asldro.validators.parameters import ValidationError
from asldro.validators.user_parameter... | 34.840506 | 96 | 0.540256 |
from copy import deepcopy
import pytest
from asldro.data.filepaths import GROUND_TRUTH_DATA
from asldro.validators.parameters import ValidationError
from asldro.validators.user_parameter_input import (
IMAGE_TYPE_VALIDATOR,
ASL,
GROUND_TRUTH,
STRUCTURAL,
validate_input_params,
get_example_input... | true | true |
f71736471faae4b0d81905d43eaa8efbc4764f0e | 3,424 | py | Python | superbench/benchmarks/micro_benchmarks/cuda_memory_bw_performance.py | yangpanMS/superbenchmark | 4d85630abba0fe45b8cd3a51e79c15e6ac87a1e6 | [
"MIT"
] | 59 | 2021-04-12T09:44:23.000Z | 2022-03-27T14:33:46.000Z | superbench/benchmarks/micro_benchmarks/cuda_memory_bw_performance.py | yangpanMS/superbenchmark | 4d85630abba0fe45b8cd3a51e79c15e6ac87a1e6 | [
"MIT"
] | 275 | 2021-03-29T06:40:34.000Z | 2022-03-30T07:35:49.000Z | superbench/benchmarks/micro_benchmarks/cuda_memory_bw_performance.py | yangpanMS/superbenchmark | 4d85630abba0fe45b8cd3a51e79c15e6ac87a1e6 | [
"MIT"
] | 24 | 2021-04-09T12:42:27.000Z | 2022-03-16T08:26:34.000Z | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""Module of the Cuda memory performance benchmarks."""
import os
import re
from superbench.common.utils import logger
from superbench.benchmarks import BenchmarkRegistry, Platform
from superbench.benchmarks.micro_benchmarks import MemBwBenchma... | 33.242718 | 106 | 0.591414 |
import os
import re
from superbench.common.utils import logger
from superbench.benchmarks import BenchmarkRegistry, Platform
from superbench.benchmarks.micro_benchmarks import MemBwBenchmark
class CudaMemBwBenchmark(MemBwBenchmark):
def __init__(self, name, parameters=''):
super().__init__(name, para... | true | true |
f717365a8e51a89fa39fe965f60ce80a0e94df41 | 2,243 | py | Python | apps/project/views.py | fsantand/bugtracker | c3d3ec4f6962dcedb2d569177bf5e53c48165da0 | [
"MIT"
] | null | null | null | apps/project/views.py | fsantand/bugtracker | c3d3ec4f6962dcedb2d569177bf5e53c48165da0 | [
"MIT"
] | 3 | 2021-03-30T13:43:20.000Z | 2021-06-10T19:39:51.000Z | apps/project/views.py | fsantand/bugtracker | c3d3ec4f6962dcedb2d569177bf5e53c48165da0 | [
"MIT"
] | null | null | null | from django.shortcuts import render, redirect
from django.views.generic import DetailView, CreateView, TemplateView
from django.contrib.auth.mixins import LoginRequiredMixin
from .models import Project
from apps.bug.models import Bug, Comment
# Create your views here.
class ProjectDetail(DetailView):
model = Proj... | 31.591549 | 107 | 0.633081 | from django.shortcuts import render, redirect
from django.views.generic import DetailView, CreateView, TemplateView
from django.contrib.auth.mixins import LoginRequiredMixin
from .models import Project
from apps.bug.models import Bug, Comment
class ProjectDetail(DetailView):
model = Project
class ProjectCreate(... | true | true |
f717376b324600cdb7a435b02cd031e066e6ac60 | 13,985 | py | Python | src/openprocurement/framework/core/utils.py | ProzorroUKR/openprocurement.api | 2855a99aa8738fb832ee0dbad4e9590bd3643511 | [
"Apache-2.0"
] | 10 | 2020-02-18T01:56:21.000Z | 2022-03-28T00:32:57.000Z | src/openprocurement/framework/core/utils.py | quintagroup/openprocurement.api | 2855a99aa8738fb832ee0dbad4e9590bd3643511 | [
"Apache-2.0"
] | 26 | 2018-07-16T09:30:44.000Z | 2021-02-02T17:51:30.000Z | src/openprocurement/framework/core/utils.py | ProzorroUKR/openprocurement.api | 2855a99aa8738fb832ee0dbad4e9590bd3643511 | [
"Apache-2.0"
] | 15 | 2019-08-08T10:50:47.000Z | 2022-02-05T14:13:36.000Z | from functools import partial, wraps
from logging import getLogger
from time import sleep
from cornice.resource import resource
from couchdb import ResourceConflict
from dateorro import calc_datetime
from jsonpointer import resolve_pointer
from pyramid.compat import decode_path_info
from pyramid.exceptions import URLD... | 35.050125 | 113 | 0.687093 | from functools import partial, wraps
from logging import getLogger
from time import sleep
from cornice.resource import resource
from couchdb import ResourceConflict
from dateorro import calc_datetime
from jsonpointer import resolve_pointer
from pyramid.compat import decode_path_info
from pyramid.exceptions import URLD... | true | true |
f71738e4c80d2271b070b3350e92aeee9a9e5ae3 | 3,954 | py | Python | stcloud/models/update_plan_response_dto.py | sematext/sematext-api-client-python | 16e025cd3d32aa58deb70fc5930ae4165afebe97 | [
"Apache-2.0"
] | 1 | 2020-05-01T12:15:52.000Z | 2020-05-01T12:15:52.000Z | stcloud/models/update_plan_response_dto.py | sematext/sematext-api-client-python | 16e025cd3d32aa58deb70fc5930ae4165afebe97 | [
"Apache-2.0"
] | null | null | null | stcloud/models/update_plan_response_dto.py | sematext/sematext-api-client-python | 16e025cd3d32aa58deb70fc5930ae4165afebe97 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Sematext Cloud API
API Explorer provides access and documentation for Sematext REST API. The REST API requires the API Key to be sent as part of `Authorization` header. E.g.: `Authorization : apiKey e5f18450-205a-48eb-8589-7d49edaea813`. # noqa: E501
OpenAPI spec version: v3
... | 28.861314 | 236 | 0.574608 |
import pprint
import re
import six
class UpdatePlanResponseDto(object):
swagger_types = {
'events': 'list[EventDto]',
'plan_id': 'int'
}
attribute_map = {
'events': 'events',
'plan_id': 'planId'
}
def __init__(self, events=None, plan_id=None):
self.... | true | true |
f7173966ea1c7e65d2e1a2dd36186f075d2562fc | 5,614 | py | Python | examples/Cliner/CliNER/code/feature_extraction/umls_dir/create_sqliteDB.py | swapnull7/forte | 737a72afd440d40c3826c3a7c5e4e44235c0f701 | [
"Apache-2.0"
] | null | null | null | examples/Cliner/CliNER/code/feature_extraction/umls_dir/create_sqliteDB.py | swapnull7/forte | 737a72afd440d40c3826c3a7c5e4e44235c0f701 | [
"Apache-2.0"
] | null | null | null | examples/Cliner/CliNER/code/feature_extraction/umls_dir/create_sqliteDB.py | swapnull7/forte | 737a72afd440d40c3826c3a7c5e4e44235c0f701 | [
"Apache-2.0"
] | null | null | null | # database.py creates a .db file for performing umls searches.
import atexit
import os
import sqlite3
import sys
from read_config import enabled_modules
features_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if features_dir not in sys.path:
sys.path.append(features_dir)
# find where umls tabl... | 27.385366 | 79 | 0.612576 |
import atexit
import os
import sqlite3
import sys
from read_config import enabled_modules
features_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if features_dir not in sys.path:
sys.path.append(features_dir)
enabled = enabled_modules()
umls_tables = enabled['UMLS']
success = False
db_pat... | true | true |
f7173a7583eedd9e7c316806a5cfde0de9f793f5 | 1,516 | py | Python | rohans2dtlkit/simonsays.py | rohan-patra/2DGameDevToolkit | 337b86066b306e6654cd520dd9cf60b224dc7c0d | [
"MIT"
] | 1 | 2020-03-25T02:39:11.000Z | 2020-03-25T02:39:11.000Z | rohans2dtlkit/simonsays.py | rohan-patra/2DGameDevToolkit | 337b86066b306e6654cd520dd9cf60b224dc7c0d | [
"MIT"
] | null | null | null | rohans2dtlkit/simonsays.py | rohan-patra/2DGameDevToolkit | 337b86066b306e6654cd520dd9cf60b224dc7c0d | [
"MIT"
] | null | null | null | """Simon Says
Exercises
1. Speed up tile flash rate.
2. Add more tiles.
"""
from random import choice
from time import sleep
from turtle import *
from rohans2dtlkit import floor, square, vector
pattern = []
guesses = []
tiles = {
vector(0, 0): ('red', 'dark red'),
vector(0, -200): ('blue', 'dark blue'),
... | 18.26506 | 47 | 0.58905 |
from random import choice
from time import sleep
from turtle import *
from rohans2dtlkit import floor, square, vector
pattern = []
guesses = []
tiles = {
vector(0, 0): ('red', 'dark red'),
vector(0, -200): ('blue', 'dark blue'),
vector(-200, 0): ('green', 'dark green'),
vector(-200, -200): ('yellow', ... | true | true |
f7173b7401256a6e7120034785ae4d0cbd732b2d | 3,478 | py | Python | Game/finger.py | Ravnit202/PYJAC | 65987f8afd2e54e1b308b09f45f291e374e79bd2 | [
"MIT"
] | 1 | 2022-02-27T21:39:46.000Z | 2022-02-27T21:39:46.000Z | Game/finger.py | Ravnit202/PYJAC | 65987f8afd2e54e1b308b09f45f291e374e79bd2 | [
"MIT"
] | null | null | null | Game/finger.py | Ravnit202/PYJAC | 65987f8afd2e54e1b308b09f45f291e374e79bd2 | [
"MIT"
] | 1 | 2022-01-23T17:56:16.000Z | 2022-01-23T17:56:16.000Z | import cv2
import mediapipe
import numpy
import pydirectinput
class FingerDetector:
wScr, hScr = pydirectinput.size() #Get the current screen resolution
pX, pY = 0, 0
cX, cY = 0, 0
def __init__(self):
"""
Initialize all objects
"""
#Load the mediapipe libraries/solut... | 37.397849 | 138 | 0.572168 | import cv2
import mediapipe
import numpy
import pydirectinput
class FingerDetector:
wScr, hScr = pydirectinput.size()
pX, pY = 0, 0
cX, cY = 0, 0
def __init__(self):
self.initHand = mediapipe.solutions.hands
self.mainHand = self.initHand.Hands(min_detection_confidence=0.7,... | true | true |
f7173b8750ccd8758d98ec5020d4c31e69bddff1 | 3,395 | py | Python | myproject/settings.py | sabariask/final-cloud-app-with-database | b95769cf8dfe77d597dff30666b82bd5478cdc1a | [
"Apache-2.0"
] | null | null | null | myproject/settings.py | sabariask/final-cloud-app-with-database | b95769cf8dfe77d597dff30666b82bd5478cdc1a | [
"Apache-2.0"
] | null | null | null | myproject/settings.py | sabariask/final-cloud-app-with-database | b95769cf8dfe77d597dff30666b82bd5478cdc1a | [
"Apache-2.0"
] | null | null | null | """
Django settings for myproject project.
Generated by 'django-admin startproject' using Django 3.0.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
... | 26.523438 | 91 | 0.699558 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'aay0j_9b&ky3a7(8m8il+-1ud(scw12@w5!+5-=gsk6ynzi0ls'
DEBUG = True
# <HINT> add your cloud host here
ALLOWED_HOSTS = ['onlinecourseapp.eu-gb.cf.appdomain.cloud']
# Application definition
INSTALLED_APPS = [
'o... | true | true |
f7173c865c6e1cbc6ede078b6fa126c1cac8a519 | 1,332 | py | Python | test/selenium/src/lib/meta.py | Smotko/ggrc-core | b3abb58b24e7559960d71a94ba79c75539e7fe29 | [
"Apache-2.0"
] | null | null | null | test/selenium/src/lib/meta.py | Smotko/ggrc-core | b3abb58b24e7559960d71a94ba79c75539e7fe29 | [
"Apache-2.0"
] | 12 | 2015-01-08T14:50:19.000Z | 2017-11-29T19:37:53.000Z | test/selenium/src/lib/meta.py | Smotko/ggrc-core | b3abb58b24e7559960d71a94ba79c75539e7fe29 | [
"Apache-2.0"
] | 1 | 2015-01-08T13:25:09.000Z | 2015-01-08T13:25:09.000Z | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""Metaclasses module"""
from lib import decorator, exception, constants
c... | 32.487805 | 78 | 0.707958 |
from lib import decorator, exception, constants
class DecoratePublicMethods(type):
def __new__(mcs, name, bases, dct):
for attr_name, value in dct.items():
if all(
[method_name in attr_name for method_name in [
constants.test_runner.TEST_METHOD_PREFIX,
con... | true | true |
f7173cd9ebdb7121ecd49307a8e79a80894f89a2 | 47 | py | Python | components/__init__.py | nuric/pix2rule | 0f0f654e488a1839455786ccc4ad023c0aa0c2e8 | [
"MIT"
] | 6 | 2021-06-15T10:37:34.000Z | 2022-01-26T14:41:44.000Z | components/__init__.py | nuric/pix2rule | 0f0f654e488a1839455786ccc4ad023c0aa0c2e8 | [
"MIT"
] | 3 | 2021-08-25T15:17:22.000Z | 2021-11-12T13:52:14.000Z | components/__init__.py | nuric/pix2rule | 0f0f654e488a1839455786ccc4ad023c0aa0c2e8 | [
"MIT"
] | 1 | 2021-11-08T17:36:52.000Z | 2021-11-08T17:36:52.000Z | """Reusable components used in the project."""
| 23.5 | 46 | 0.723404 | true | true | |
f7173ce767b2f0ec4ef68dd6e5eb6e37168beeea | 3,958 | py | Python | python/oneflow/test/modules/test_ne.py | LiPengze97/oneflow | 1c1d2d3faa1c02d20e009046a290cf1095ee12e0 | [
"Apache-2.0"
] | null | null | null | python/oneflow/test/modules/test_ne.py | LiPengze97/oneflow | 1c1d2d3faa1c02d20e009046a290cf1095ee12e0 | [
"Apache-2.0"
] | null | null | null | python/oneflow/test/modules/test_ne.py | LiPengze97/oneflow | 1c1d2d3faa1c02d20e009046a290cf1095ee12e0 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2020 The OneFlow 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 applicable law or agr... | 33.82906 | 77 | 0.689237 |
import unittest
from collections import OrderedDict
import numpy as np
from test_util import GenArgList
import oneflow as flow
import oneflow.unittest
from oneflow.test_utils.automated_test_util import *
def _test_ne(test_case, shape, device):
arr1 = np.random.randn(*shape)
arr2 = np.random.randn(*shape)
... | true | true |
f7173cf25e08228c30ad2d6b241f0a7a9258b6b2 | 2,213 | py | Python | game/sdl/nacl/generate_nmf.py | spiffcode/hostile-takeover | 363c8f7f02c25f90255b28a5e2eaea784b2a502f | [
"BSD-2-Clause-FreeBSD"
] | 113 | 2015-01-07T00:37:37.000Z | 2022-03-08T17:58:24.000Z | game/sdl/nacl/generate_nmf.py | ptitSeb/hostile-takeover | db70254a966ca3223178e669594f3b704b5471a2 | [
"BSD-2-Clause-FreeBSD"
] | 6 | 2015-04-13T16:16:00.000Z | 2021-06-08T04:49:09.000Z | game/sdl/nacl/generate_nmf.py | spiffcode/hostile-takeover | 363c8f7f02c25f90255b28a5e2eaea784b2a502f | [
"BSD-2-Clause-FreeBSD"
] | 49 | 2015-01-08T04:27:35.000Z | 2022-03-08T04:55:08.000Z | #!/usr/bin/python
#
# Copyright (c) 2011, The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import optparse
# This script generates a JSON .nmf file, which provides the mapping to indicate
# which .nexe fil... | 36.278689 | 80 | 0.690917 |
import sys
import optparse
def main(argv):
parser = optparse.OptionParser()
parser.add_option('--nmf', dest='nmf_file', help='nmf file to generate')
parser.add_option('--x86-64', dest='x86_64', help='x86_64 nexe')
parser.add_option('--x86-32', dest='x86_32', help='x86_32 nexe')
parser... | true | true |
f7173e027264e39bd5de097156f1fe290ba68ed4 | 11,074 | py | Python | utils/utils.py | Ray0089/PSGMN | 0363d558add24034e035d26121e2e1b61d97c198 | [
"Apache-2.0"
] | 18 | 2021-02-05T05:30:15.000Z | 2022-03-13T03:40:25.000Z | utils/utils.py | Ray0089/PSGMN | 0363d558add24034e035d26121e2e1b61d97c198 | [
"Apache-2.0"
] | 2 | 2021-04-17T02:20:42.000Z | 2021-09-11T07:05:13.000Z | utils/utils.py | Ray0089/PSGMN | 0363d558add24034e035d26121e2e1b61d97c198 | [
"Apache-2.0"
] | 5 | 2021-04-19T00:21:20.000Z | 2022-01-17T07:30:27.000Z | # import PIL
import matplotlib.pyplot as plt
import numpy as np
import math
import cv2
import torch
from torch_geometric.data import Data
def load_ply(path):
"""
Loads a 3D mesh model from a PLY file.
:param path: Path to a PLY file.
:return: The loaded model given by a dictionary with items:
'pt... | 30.506887 | 86 | 0.536753 |
import matplotlib.pyplot as plt
import numpy as np
import math
import cv2
import torch
from torch_geometric.data import Data
def load_ply(path):
f = open(path, 'r')
n_pts = 0
n_faces = 0
face_n_corners = 3
pt_props = []
face_props = []
is_binary = False
header_vertex_section = False... | true | true |
f7173e64baaaa455cc2055a042fb58a2903aa785 | 2,500 | py | Python | cic/drivers/singleton.py | Chia-Network/internal-custody | 672cf33bb63cad960f5576f84a6606ce471e05cb | [
"Apache-2.0"
] | null | null | null | cic/drivers/singleton.py | Chia-Network/internal-custody | 672cf33bb63cad960f5576f84a6606ce471e05cb | [
"Apache-2.0"
] | null | null | null | cic/drivers/singleton.py | Chia-Network/internal-custody | 672cf33bb63cad960f5576f84a6606ce471e05cb | [
"Apache-2.0"
] | 1 | 2022-02-22T22:35:24.000Z | 2022-02-22T22:35:24.000Z | from typing import List, Tuple
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_spend import CoinSpend
from chia.types.condition_opcodes import ConditionOpcode
from chia.util.has... | 30.487805 | 103 | 0.7288 | from typing import List, Tuple
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_spend import CoinSpend
from chia.types.condition_opcodes import ConditionOpcode
from chia.util.has... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.