content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | 30.496732 | 86 | 0.476211 | [
"BSD-3-Clause"
] | lvcarlosja/bokeh | bokeh/client/states.py | 4,666 | Python |
import mxnet as mx
import proposal
import proposal_target
from rcnn.config import config
import focal_loss
eps = 2e-5
use_global_stats = True
workspace = 512
res_deps = {'50': (3, 4, 6, 3), '101': (3, 4, 23, 3), '152': (3, 8, 36, 3), '200': (3, 24, 36, 3)}
units = res_deps['101']
filter_list = [256, 512, 1024, 2048]
... | 59 | 133 | 0.696163 | [
"Apache-2.0"
] | angelfish91/Faster-RCNN-MXnet011 | rcnn/symbol/symbol_resnet_modify.py | 13,629 | Python |
# -*- coding: utf-8 -*-
"""Subspace Outlier Detection (SOD)
"""
# Author: Yahya Almardeny <almardeny@gmail.com>
# License: BSD 2 clause
import numpy as np
import numba as nb
from sklearn.neighbors import NearestNeighbors
from sklearn.utils import check_array
from ..utils.utility import check_parameter
from .base impo... | 35.164179 | 79 | 0.621817 | [
"BSD-2-Clause"
] | BillyGareth/pyod | pyod/models/sod.py | 7,068 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
from unittestzero import Assert
from pages.dashboard import DashboardPage
class TestProductFilter(objec... | 39.295082 | 83 | 0.673759 | [
"BSD-3-Clause"
] | ANKIT-KS/fjord | smoketests/tests/dashboard/test_product_filter.py | 2,397 | Python |
import re
import os
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from urllib import urlencode
import hashlib
import csv
from product_spiders.item... | 35.526316 | 89 | 0.668148 | [
"Apache-2.0"
] | 0--key/lib | portfolio/Python/scrapy/seapets/thepetexpress.py | 2,025 | Python |
from CtCI_Custom_Classes.stack import Stack
class SetOfStacks:
def __init__(self, capacity):
self.capacity = capacity
self.stacks = []
def get_last_stack(self):
if not self.stacks:
return None
return self.stacks[-1]
def is_empty(self):
last = self.get_... | 23.914286 | 43 | 0.551971 | [
"MIT"
] | enyquist/Cracking_the_Coding_Interview | CtCI_custom_classes/overflow_stack.py | 837 | Python |
# coding: utf-8
"""
Ory Kratos
Welcome to the ORY Kratos HTTP API documentation! # noqa: E501
The version of the OpenAPI document: latest
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import ory_kratos_client
from ory_krat... | 32.627907 | 100 | 0.497149 | [
"Apache-2.0"
] | Marcuzz/sdk | clients/kratos/python/test/test_request_method_config.py | 2,806 | Python |
# -*- coding: utf-8 -*-
"""
mslib.mscolab._tests.test_utils
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests for mscolab/utils
This file is part of mss.
:copyright: Copyright 2019 Shivashis Padhi
:copyright: Copyright 2019-2020 by the mss team, see AUTHORS.
Licensed under the Apache License, Ver... | 33.509091 | 87 | 0.686923 | [
"Apache-2.0"
] | gisi90/MSS | mslib/mscolab/_tests/test_utils.py | 1,843 | Python |
import os
import numpy as np
import tensorflow as tf
from collections import deque
def sample(logits):
noise = tf.random_uniform(tf.shape(logits))
return tf.argmax(logits - tf.log(-tf.log(noise)), 1)
def cat_entropy(logits):
a0 = logits - tf.reduce_max(logits, 1, keepdims=True)
ea0 = tf.exp(a0)
z... | 32.616725 | 107 | 0.587651 | [
"MIT"
] | zeuseyera/baselines-kr | baselines/a2c/utils.py | 9,361 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | 23.888889 | 108 | 0.739535 | [
"Apache-2.0"
] | TokkoLabs/client-python | kubernetes/test/test_v2beta1_horizontal_pod_autoscaler.py | 1,075 | Python |
# Generated by Django 3.0.8 on 2021-07-07 22:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('keyword_relation', '0010_auto_20210322_2049'),
]
operations = [
migrations.CreateModel(
name='Keyword_Grouping',
fie... | 27.090909 | 114 | 0.588926 | [
"MIT"
] | rohanjsuresh/extracted_keyword_validation | keyword_relation/migrations/0011_keyword_grouping.py | 596 | Python |
import tensorflow as tf
class FrozenBatchNorm2D(tf.keras.layers.Layer):
def __init__(self, eps=1e-5, **kwargs):
super().__init__(**kwargs)
self.eps = eps
def build(self, input_shape):
self.weight = self.add_weight(name='weight', shape=[input_shape[-1]],
... | 38.911765 | 79 | 0.544974 | [
"MIT"
] | Leonardo-Blanger/detr_tensorflow | detr_tensorflow/models/custom_layers.py | 2,646 | Python |
import ClientSide2 #custom package
import numpy as np
import argparse
import json
import os
import ClassifierFunctions2 as cf
import random
import logging
from matplotlib import pyplot as plt
from builtins import input
from Notation import SpaceGroupsDict as spgs
SpGr = spgs.spacegroups()
from itertools import co... | 36.224215 | 203 | 0.590121 | [
"MIT"
] | MatthewGong/DiffractionClassification | DiffractionClassifierCombinatorial2.0.py | 16,156 | Python |
from django.core.urlresolvers import reverse
from oscar.core.loading import get_model
from oscar.test.testcases import WebTestCase, add_permissions
from oscar.test.factories import (
CategoryFactory, PartnerFactory, ProductFactory, ProductAttributeFactory)
from hooks.test.factories import (
HookEventFactory,... | 32.121951 | 95 | 0.699317 | [
"BSD-3-Clause"
] | cage1016/django-oscar-hooks | tests/functional/dashboard/test_hook.py | 1,317 | Python |
"""The tests the History component."""
# pylint: disable=protected-access,invalid-name
from datetime import timedelta
import json
from unittest.mock import patch, sentinel
import pytest
from pytest import approx
from homeassistant.components import history, recorder
from homeassistant.components.recorder.history impo... | 34.985646 | 122 | 0.666986 | [
"Apache-2.0"
] | 0xFEEDC0DE64/homeassistant-core | tests/components/history/test_init.py | 36,563 | Python |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 38.512821 | 74 | 0.768309 | [
"Apache-2.0"
] | Explorer1092/aliyun-openapi-python-sdk | aliyun-python-sdk-cs/aliyunsdkcs/request/v20151215/PauseClusterUpgradeRequest.py | 1,502 | Python |
#MenuTitle: Generate lowercase from uppercase
"""
Generate lowercase a-z from uppercase A-Z
TODO (M Foley) Generate all lowercase glyphs, not just a-z
"""
font = Glyphs.font
glyphs = list('abcdefghijklmnopqrstuvwxyz')
masters = font.masters
for glyph_name in glyphs:
glyph = GSGlyph(glyph_name)
glyph.updateGl... | 24.652174 | 58 | 0.714286 | [
"MIT"
] | m4rc1e/mf-glyphs-scripts | Glyph-Builders/lowercase_from_upper.py | 567 | Python |
# to run:
# pip install unittest2
# unit2 discover
#
# to debug:
# pip install nose
# nosetests --pdb
import StringIO
import sys
import pdfquery
import unittest2
from pdfquery.cache import FileCache
class TestPDFQuery(unittest2.TestCase):
"""
Various tests based on the IRS_1040A sample doc.
"""
... | 34.630208 | 90 | 0.563393 | [
"MIT"
] | leeoniya/pdfquery | tests/tests.py | 6,649 | Python |
from controller.enums import PartEnum
def convert_from_part_id(part_id):
if part_id == PartEnum.FUSE.value:
return 'Fuse', 'Fuse'
elif part_id == PartEnum.BACKCOVER.value:
return 'BottomCover', 'BottomCoverFlipped'
elif part_id == PartEnum.WHITECOVER.value:
return 'WhiteCover', 'Wh... | 34.479167 | 50 | 0.682175 | [
"MIT"
] | EmilRyberg/P6BinPicking | controller/class_converter.py | 1,655 | Python |
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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
#
# Un... | 38.551724 | 78 | 0.68381 | [
"Apache-2.0"
] | MultipleCrashes/nova | nova/tests/functional/db/test_console_auth_token.py | 2,236 | Python |
import argparse
import datetime
import json
import os
import time
from os import path
import numpy as np
import torch
from absl import flags
from torch import optim
from pprint import pprint
import wandb
from src.alive_sieve import AliveSieve, SievePlayback
from src.nets import AgentModel
from src.rewards_lib import ... | 39.565138 | 118 | 0.58554 | [
"MIT"
] | mnoukhov/ecn | src/ecn.py | 21,563 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
!!! This generally needs to be run right after the close of applications for a framework, and passed to product
!!! managers & CCS.
Generate a CSV with per-lot draft statistics for each supplier who registered interest in the framework,
whether or not they made a compl... | 33.382353 | 120 | 0.725551 | [
"MIT"
] | Crown-Commercial-Service/digitalmarketplace-scripts | scripts/framework-applications/export-framework-applications-at-close.py | 2,270 | Python |
from docxtpl import DocxTemplate
import csv
import json
import random
#случайный авто
with open('Car_info.txt') as file:
car_rand = []
reader = csv.reader(file)
for row in file:
car_rand.append(row)
report_car = car_rand[random.randint(0, len(car_rand)-1)]
car_info = report_car.split()
#О авто
def g... | 30.809524 | 70 | 0.665379 | [
"MIT"
] | Nikolas-01/Lesson_7 | 7.py | 1,369 | Python |
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import re # noqa: F401
import sys # noqa: F401
from datadog_api_client.v2.model_uti... | 39.994152 | 114 | 0.583126 | [
"Apache-2.0"
] | rchenzheng/datadog-api-client-python | src/datadog_api_client/v2/model/security_filter_exclusion_filter.py | 6,839 | Python |
# -*- coding:utf-8 -*-
"""
"""
import pandas as pd
from pandas.util import hash_pandas_object
from hypernets.tabular.datasets.dsutils import load_bank
from . import if_cuml_ready, is_cuml_installed
if is_cuml_installed:
import cudf
from hypernets.tabular.cuml_ex import CumlToolBox
dd_selector = CumlTool... | 35.590361 | 114 | 0.603927 | [
"Apache-2.0"
] | lyhue1991/Hypernets | hypernets/tests/tabular/tb_cuml/drift_detection_test.py | 2,954 | Python |
"""Abstract class for image transports.
Defines generic functions.
"""
# Copyright (c) 2018 Erling Andersen, Haukeland University Hospital, Bergen, Norway
from abc import ABCMeta, abstractmethod # , abstractproperty
# import imagedata.transports
class NoOtherInstance(Exception):
pass
class AbstractTransport... | 23.52381 | 83 | 0.592105 | [
"MIT"
] | erling6232/imagedata | src/imagedata/transports/abstracttransport.py | 2,964 | Python |
# coding: utf-8
"""
IncQuery Server
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 0.12.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class TWCRep... | 30.858156 | 124 | 0.619168 | [
"Apache-2.0"
] | thomas-bc/mms-autocref | iqs_client/models/twc_repository_info_response.py | 4,351 | Python |
"""This is a set of tools built up over time for working with Gaussian and
QChem input and output."""
########################################################################
# #
# ... | 61.25 | 74 | 0.348105 | [
"Apache-2.0"
] | theavey/QM-calc-scripts | gautools/__init__.py | 1,715 | Python |
# -*- coding: utf-8 -*-
from datetime import date, time
import pytest
from django.contrib.admin import site as admin_site
from resources.admin.period_inline import PeriodModelForm, prefix_weekday
from resources.models import Period, Resource
from resources.models.unit import Unit
from resources.tests.utils import ass... | 36.642857 | 104 | 0.703704 | [
"MIT"
] | City-of-Helsinki/respa | resources/tests/test_admin_period_inline.py | 2,052 | Python |
import os
import layout
import callbacks # layout needs to be defined before creating callbacks
import routes
import appserver
server = appserver.app.server
if __name__ == "__main__":
debug_mode = True if os.getenv("DEBUG", "false") == "true" else False
if debug_mode is True:
print(f"Initiating server... | 27.4 | 73 | 0.671533 | [
"MIT"
] | budavariam/activity-visualizer | src/app.py | 548 | Python |
# Visualizer is for debugging purposes only
import logging
import math
import random
import threading
import http.server
import socketserver
import os
import re
from shapely import wkt
import matplotlib.pyplot as plt
import mpld3
import screeninfo
import tempfile
import webbrowser
import owlready2
from shapely import ... | 49.091995 | 298 | 0.497785 | [
"MIT"
] | lu-w/criticality-recognition | auto/auto_visualizer/auto_visualizer.py | 41,090 | Python |
import pytest
from cool_search import BaseClass, base_function
given = pytest.mark.parametrize
@given("fn", [BaseClass(), base_function])
def test_parameterized(fn):
assert "hello from" in fn()
def test_base_function():
assert base_function() == "hello from base function"
def test_base_class():
asse... | 19.736842 | 62 | 0.733333 | [
"Unlicense"
] | khulaifi95/cool-search | tests/test_base.py | 375 | Python |
# coding: utf-8
"""
SendinBlue API
SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at h... | 44.926829 | 820 | 0.704126 | [
"MIT"
] | Danilka/APIv3-python-library | test/test_get_extended_contact_details_statistics.py | 1,842 | Python |
from rest_framework import generics
from ..models import Article, Country, Source
from .serializers import ArticleSerializer, CountrySerializer, SourceSerializer
class ArticleListView(generics.ListCreateAPIView):
queryset = Article.objects.all()
serializer_class = ArticleSerializer
permission_classes = []... | 28.725 | 79 | 0.781549 | [
"MIT"
] | XOyarz/polstats-django | main_app/api/views.py | 1,149 | Python |
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
# useful for handling different item types with a single interface
from itemadapter import is_item, ItemAdapter
class Proj2062SpiderMiddleware:
... | 35.096154 | 78 | 0.674521 | [
"MIT"
] | miccaldas/new_rss | support_files/scraping/entries/proj_2062/proj_2062/middlewares.py | 3,652 | Python |
import functools as ft
import inspect
from typing import Any, Callable, Dict, Iterable, List, Optional, Union
import pydantic
from . import base
class PydanticValidator(base.BaseValidator):
"""
Parameters validator based on `pydantic <https://pydantic-docs.helpmanual.io/>`_ library.
Uses python type ann... | 40.385542 | 118 | 0.654236 | [
"Unlicense"
] | bernhardkaindl/pjrpc | xjsonrpc/server/validators/pydantic.py | 3,352 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
import re
from urllib.parse import urljoin
from requests import get
from time import sleep
from datetime i... | 35.747563 | 100 | 0.7421 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | openstax/cnx-automation | tests/webview/ui/test_content.py | 36,680 | Python |
import os
from werkzeug.security import generate_password_hash
from flask_script import Manager, Shell, Command, Option
from flask_migrate import Migrate, MigrateCommand
from app import db
from app import create_app
from app.models import User
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manage... | 24.767442 | 68 | 0.684507 | [
"MIT"
] | Tianny/incepiton-mysql | manage.py | 1,065 | Python |
#
# Copyright 2019 Delphix
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 29.534247 | 77 | 0.674397 | [
"Apache-2.0"
] | PaulZ-98/sdb | sdb/commands/zfs/internal/__init__.py | 2,156 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
class _GetAttrMeta(type):
# https://stackoverflow.com/questions/33727217/subscriptable-objects-in-class
def __getitem__(cls, x):
return getattr(cls, x)
de... | 31.555556 | 81 | 0.672535 | [
"MIT"
] | earthobservations/python_dwd | wetterdienst/util/parameter.py | 568 | Python |
import os
import sys
import numpy as np
import random
import math
from PIL import Image, ImageOps, ImageFilter
import torch
import torch.utils.data as data
import torchvision.transforms as transform
from .base import BaseDataset
class NYUv2Segmentation(BaseDataset):
BASE_DIR = 'nyuv2'
NUM_CLAS... | 37.904762 | 79 | 0.568677 | [
"MIT"
] | etmwb/cvsegmentation | cvss/datasets/nyuv2.py | 4,776 | Python |
# This file was scaffold by idol_mar, but it will not be overwritten, so feel free to edit.
# This file will be regenerated if you delete it.
from ...codegen.all.target.optional_method import (
AllTargetOptionalMethodSchema as OptionalMethodSchemaCodegen,
)
class OptionalMethodSchema(OptionalMethodSchemaCodegen):... | 33 | 91 | 0.79697 | [
"MIT"
] | corps/idol | test/src/lib/idol/py_mar/all/target/optional_method.py | 330 | Python |
# -*- coding: utf-8 -*-
import os
import sqlite3
import logging
logger = logging.getLogger("xtc")
class sqlite_handle(object):
def __init__(self):
self.dbname = "Xsense.db"
self.conn = None
def db_init(self): # 初始化db task_info、apps、scripts、run_tasks
self.db_table_all()
conn... | 36.318436 | 167 | 0.591601 | [
"MIT"
] | zxypic/PublicPic | client-autosense/sense/sqlite_syn.py | 7,075 | Python |
def notas(*n, sit=False):
"""
Função para analisar notas e situação de varios alunos.
:param n: Uma ou mais notas dos alunos (aceita varias)
:param sit: Valor opcional, indicando se deve ou não adicionar a situação.
:return: Dicionario com varias informações sobre a situação da turma.
"""
di... | 25.777778 | 78 | 0.566092 | [
"MIT"
] | Matheus-Henrique-Burey/Curso-de-Python | Modulo-03/ex105/ex105.py | 713 | Python |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | 36.285714 | 77 | 0.740157 | [
"Apache-2.0"
] | Aniruddha120/qiskit-aqua | test/aqua/operators/__init__.py | 508 | Python |
import os
import csv
import shutil
from datetime import datetime
from numpy import logspace
import torch
import torch.nn as nn
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data import DataLoader
from torch.optim import Adam
from dataset.e_piano import create_epiano_datasets, create_pop909_datasets
... | 56.356021 | 307 | 0.645113 | [
"MIT"
] | yeong35/MusicTransformer-Pytorch | train.py | 21,588 | Python |
# Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 35.561404 | 105 | 0.715836 | [
"Apache-2.0"
] | aosterloh/cloud-dataproc | codelabs/spark-bigquery/backfill.py | 4,054 | Python |
def sample_mean(a, b, c):
try:
a = int(a)
b = int(b)
c = int(c)
mean_numbers = [a, b, c]
d = len(mean_numbers)
result_mean = (a + b + c)/d
return float(result_mean)
except ZeroDivisionError:
print("Error: Number Not Valid")
except ValueError:
... | 25.928571 | 43 | 0.53168 | [
"MIT"
] | brittrubil/miniProject2-601 | Statistics/SampleMean.py | 363 | Python |
import random
import unittest
from domain_tree.tree import DomainTree, DomainNode, NodeNotFoundException
from domain_tree.domain import RealDomain, RealInterval
class TestDomainTree(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
pass
@classmethod
def tearDownClass... | 33.48855 | 111 | 0.57488 | [
"BSD-3-Clause"
] | virtualms/DomainTree | test/test_tree.py | 4,387 | Python |
from django.contrib import admin
from django.urls import path
from django.contrib.auth import views as auth_views
from dashboard.views import index
from visitantes.views import registrar_visitante, informacoes_visitante, finalizar_visita
urlpatterns = [
path('admin/', admin.site.urls),
path('', index, name='i... | 46 | 95 | 0.757033 | [
"MIT"
] | lucasazevedo/visitor-control | project/urls.py | 782 | Python |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# 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 ... | 37.423077 | 79 | 0.660843 | [
"Apache-2.0"
] | yi-cloud/octavia | octavia/tests/unit/common/test_config.py | 1,946 | Python |
import math
numero_turmas = int(input('Qual o número de turmas? '))
for _ in range(numero_turmas):
numero_alunos = int(input('Qual o número de alunos? '))
soma = 0
menor = math.inf
maior = 0
for i in range(numero_alunos):
nota = float(input(f'Qual a nota do aluno {i + 1}? '))
soma +=... | 30.588235 | 92 | 0.578846 | [
"Unlicense"
] | profamaroca/Lista3-1 | 14.py | 526 | Python |
import getpass, platform, sys, threading
from .. util import log
from . control import ExtractedControl
# See https://stackoverflow.com/questions/42603000
DARWIN_ROOT_WARNING = """
In MacOS, pynput must to be running as root in order to get keystrokes.
Try running your program like this:
sudo %s <your commands h... | 23.279412 | 71 | 0.60897 | [
"MIT"
] | 8cH9azbsFifZ/BiblioPixel | bibliopixel/control/keyboard.py | 1,583 | Python |
#
# Autogenerated by Frugal Compiler (3.4.7)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from frugal.util import make_hashable
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol... | 27.463054 | 84 | 0.535785 | [
"Apache-2.0"
] | dustyholmes-wf/frugal | test/expected/python.asyncio/actual_base/ttypes.py | 5,575 | Python |
from fastapi_utils.inferring_router import InferringRouter
from . import views
router = InferringRouter()
router.include_router(views.router, prefix='/api', tags=['api'])
| 25.571429 | 65 | 0.765363 | [
"MIT"
] | zhaojiejoe/fastapi-friendly-response-demo | api/__init__.py | 179 | Python |
import komand
from .schema import CreateRecordInput, CreateRecordOutput
# Custom imports below
class CreateRecord(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="create_record",
description="Create a new SObject record",
input=CreateReco... | 27.34375 | 76 | 0.595429 | [
"MIT"
] | GreyNoise-Intelligence/insightconnect-plugins | salesforce/komand_salesforce/actions/create_record/action.py | 875 | Python |
import os
import numpy as np
import pandas as pd
from sklearn.preprocessing import OneHotEncoder,LabelEncoder,StandardScaler
from sklearn.decomposition import TruncatedSVD,PCA
from sklearn.metrics.pairwise import cosine_similarity,pairwise_distances
from sklearn.feature_extraction.text import TfidfVectorizer
SEED = 204... | 45.542857 | 134 | 0.788582 | [
"MIT"
] | zonemercy/Kaggle | quora/pyfm/generate_interaction.py | 1,594 | Python |
class Animal:
_number_of_legs = 0
_pairs_of_eyes = 0
def __init__(self, age):
self._age = age
print("Animal created")
@property
def age(self):
return self._age
@age.setter
def age(self, age):
self._age = age
def print_legs_and_eyes(self... | 23.097297 | 110 | 0.608238 | [
"MIT"
] | Archive-42/Lambda-Resource-Static-Assets | 2-resources/_External-learning-resources/00-Javascript/Object-oriented-programming-for-JavaScript/Module 2/B04710_CodeBundle/Chapter 4/B04170_04_Python_Draft_01.py | 4,273 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import base64
import lzma
from ... import TestUnitBase
from refinery.units.formats.office.xlxtr import _ref2rc, _rc2ref
class TestCellIndexConverter(TestUnitBase):
def test_concistency(self):
for row in range(1, 12):
for col in range(1, 12):
... | 96.943396 | 130 | 0.672635 | [
"BSD-3-Clause"
] | baderj/refinery | test/units/formats/office/test_xlxtr.py | 10,276 | Python |
from argparse import ArgumentParser
from typing import Any
from zerver.lib.management import ZulipBaseCommand
from zerver.models import Service, UserProfile
class Command(ZulipBaseCommand):
help = """Given an existing bot, converts it into an outgoing webhook bot."""
def add_arguments(self, parser: Argument... | 37.783333 | 86 | 0.599912 | [
"Apache-2.0"
] | abhigyank/zulip | zerver/management/commands/convert_bot_to_outgoing_webhook.py | 2,267 | Python |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# Copyright (C) 2014-2016 Anler Hernández ... | 44.447853 | 93 | 0.696894 | [
"MIT"
] | mattcongy/itshop | docker-images/taigav2/taiga-back/tests/integration/test_stats.py | 7,248 | Python |
import sys
import compileall
import importlib.util
import test.test_importlib.util
import os
import pathlib
import py_compile
import shutil
import struct
import tempfile
import time
import unittest
import io
from unittest import mock, skipUnless
try:
from concurrent.futures import ProcessPoolExecut... | 43.419732 | 87 | 0.611708 | [
"MIT"
] | jasam/ciclo_vida_datos_scraping | python/Lib/test/test_compileall.py | 25,965 | Python |
from PIL import Image
def img_to_binary(img: Image, min_value=100) -> Image:
return img.convert('L').point(lambda p: p > min_value and 255).convert('1')
| 26.5 | 79 | 0.704403 | [
"BSD-3-Clause"
] | Amjad50/Fyp | utils/image.py | 159 | Python |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 6 22:41:54 2020
@author: mahjaf
Automatic sleep scoring implemented for Zmax headband.
"""
#%% Reading EDF section
#####===================== Importiung libraries =========================#####
import mne
import numpy as np
from numpy import loadtxt
import h5py
impor... | 41.956693 | 137 | 0.569016 | [
"MIT"
] | MahdadJafarzadeh/ssccoorriinngg | Zmax_autoscoring_controlled_train_test_split.py | 10,657 | Python |
import warnings
from mlprimitives.utils import import_object
_RESAMPLE_AGGS = [
'mean',
'median',
'prod',
'quantile',
'std',
'sum',
'var',
]
def resample(df, rule, on=None, groupby=(), aggregation='mean',
reset_index=True, time_index=None):
"""pd.DataFrame.resample adapt... | 30.333333 | 97 | 0.633314 | [
"MIT"
] | AlexanderGeiger/MLPrimitives | mlprimitives/adapters/pandas.py | 3,458 | Python |
"""Rectify function"""
import torch
from torch.autograd import Function
from encoding import cpu
if torch.cuda.device_count() > 0:
from encoding import gpu
__all__ = ['rectify']
class _rectify(Function):
@staticmethod
def forward(ctx, y, x, kernel_size, stride, padding, dilation, average):
ctx.s... | 32.023256 | 83 | 0.6122 | [
"MIT"
] | Womcos/SCARF | encoding/functions/rectify.py | 1,377 | Python |
from pyspark.sql import SparkSession
def get_spark():
return (SparkSession.builder
.appName("simpleapp")
.master("local")
.getOrCreate())
from pyspark import SparkConf, SparkContext
import sys
def main(sc, args):
print("SimpleApp Arguments")
for x in args:
... | 20.891892 | 44 | 0.564036 | [
"Apache-2.0"
] | MediaIQ/databricks-client-java | src/test/resources/simpleapp.py | 773 | Python |
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from itertools import product
from sklearn.preprocessing import LabelEncoder
# =============================================================================
# The lines where we processed our data
# ==============... | 44.529412 | 204 | 0.660238 | [
"MIT"
] | enkaranfiles/bil476_predict-future-sales | preprocessing.py | 7,598 | Python |
from nepc import nepc
from nepc.util import util
import pandas as pd
import os
import pytest
import platform
# TODO: remove dependence on csv; put function in scraper that uses built-in
# readlines function
import csv
# TODO: test that all values in [nepc]/tests/data are in the nepc database
@pytest.mark.usefix... | 39.552632 | 92 | 0.578399 | [
"CC0-1.0"
] | USNavalResearchLaboratory/nepc | tests/test_mysql_build.py | 4,509 | Python |
# encoding: utf-8
import unittest
from cool.core import constants
class IntConstants(constants.Constants):
TEST0 = (0, 'test0')
TEST1 = (1, 'test1')
class IntStringCodeConstants(constants.Constants):
TEST = ('test', 'test0')
TEST1 = (1, 'test1')
class ConstantsTests(unittest.TestCase):
def te... | 33.114754 | 106 | 0.641584 | [
"BSD-3-Clause"
] | 007gzs/django-cool | tests/core/test_constants.py | 2,020 | Python |
from pomodoro import main
if __name__ == "__main__":
main()
| 11 | 26 | 0.666667 | [
"MIT"
] | Dev3XOR/pomodoro | src/pomodoro/__main__.py | 66 | Python |
import pytest
from icepyx.core.visualization import Visualize
import icepyx.core.visualization as vis
@pytest.mark.parametrize(
"n, exp",
[
(
1,
[
"ATL06_20200702014158_01020810_004_01.h5",
"ATL06_20200703011618_01170810_004_01.h5",
... | 34.504587 | 87 | 0.576442 | [
"BSD-3-Clause"
] | ICESat2-SlideRule/icepyx | icepyx/tests/test_visualization.py | 3,761 | Python |
#CODE1---For preparing the list of DRUG side-effect relation from SIDER database---
#Python 3.6.5 |Anaconda, Inc.
import sys
import glob
import errno
import csv
path = '/home/16AT72P01/Excelra/SIDER1/output/adverse_effects.tsv'
files = glob.glob(path)
unique_sideeffect = set()
unique_drug = set()
unique_pair = set()... | 25.551724 | 105 | 0.735493 | [
"MIT"
] | ankita094/BioIntMed | src/dictionaryCode/other/siderData1.py | 741 | Python |
import csv
def save_statistics(experiment_name, line_to_add):
with open("{}.csv".format(experiment_name), 'a') as f:
writer = csv.writer(f)
writer.writerow(line_to_add)
def load_statistics(experiment_name):
data_dict = dict()
with open("{}.csv".format(experiment_name), 'r') as f:
l... | 25.62963 | 58 | 0.58237 | [
"MIT"
] | likesiwell/DL_Code_Repos | MetaLearning/MatchingNetworks/storage.py | 692 | Python |
"""
ASGI config for apiproject project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... | 23.352941 | 78 | 0.788413 | [
"MIT"
] | vasulimited123/Django-Repository | apiproject/apiproject/asgi.py | 397 | Python |
"""
This module provides an interface for reading and writing to a HackPSU RaspberryPi Scanner config file
Methods:
getProperty(configFile, prop)
Get a property from a config file by reading the config file until the desired property is found
setProperty(configFile, prop, value)
Set a property by updating the co... | 27.676692 | 111 | 0.710676 | [
"MIT"
] | hackpsu-tech/hackPSUS2018-rfid | HackPSUconfig.py | 3,681 | Python |
from django.test import TestCase
from django.contrib.auth import get_user_model
from core import models
def sample_user(email='rg171195@gmail.com', password='testpass'):
'''Creating sample user'''
return get_user_model().objects.create_user(email, password)
class ModelTests(TestCase):
def test_create_u... | 33.102041 | 73 | 0.658446 | [
"MIT"
] | Rish1711/recipe-app-api | app/core/tests/test_models.py | 1,622 | Python |
import copy
import dask
import dask.array as da
from dask.distributed import Client
import datetime
import logging
import math
from multiprocessing.pool import ThreadPool
import numpy as np
from pathlib import Path
from tqdm.auto import tqdm
from typing import Union, TypeVar, Tuple
import xarray as xr
import shutil
imp... | 34.681373 | 84 | 0.637597 | [
"MIT"
] | awst-austria/qa4sm-preprocessing | src/qa4sm_preprocessing/nc_image_reader/transpose.py | 14,150 | Python |
#!/usr/bin/python
import sys
from PIL import Image
import argparse
parser = argparse.ArgumentParser(description='Convert animated or static images to CampZone2019 badge code')
parser.add_argument('image', help='The path to an image to read from (e.g. .gif, .jpg, .png)')
parser.add_argument('--start_x', type=int, def... | 45.912281 | 123 | 0.680168 | [
"MIT"
] | tjclement/cz19-badge | tools/convert.py | 2,617 | Python |
import asyncio
from pathlib import Path
from secrets import token_bytes
from typing import Optional
import aiosqlite
import pytest
from clvm_tools import binutils
from ceres.types.blockchain_format.coin import Coin
from ceres.types.blockchain_format.program import Program, SerializedProgram
from ceres.types.blockchai... | 36.557252 | 93 | 0.640426 | [
"Apache-2.0"
] | ales/ceres-combineharvester | tests/pools/test_wallet_pool_store.py | 4,789 | Python |
import time
import torch
import numpy as np
from collections import deque
from graphnas.trainer import Trainer
class Evolution_Trainer(Trainer):
"""
This class implements the Asyncronous Aging Evolution,
proposed by Real et. al. on:
Regularized Evolution for Image Classifier Architecture Search
... | 43.622222 | 95 | 0.626083 | [
"Apache-2.0"
] | mhnnunes/nas_gnn | graphnas/evolution_trainer.py | 5,889 | Python |
# Generated by Django 2.1.4 on 2018-12-28 02:51
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... | 31.275862 | 120 | 0.637266 | [
"MIT"
] | uzzal71/Django_blog | mysite/blog/migrations/0001_initial.py | 907 | Python |
# Make SweetPea visible regardless of whether it's been installed.
import sys
sys.path.append("..")
from sweetpea.primitives import Factor, DerivedLevel, WithinTrial, Transition
from sweetpea.constraints import no_more_than_k_in_a_row
from sweetpea import fully_cross_block, synthesize_trials_non_uniform, print_experim... | 38.634409 | 213 | 0.748678 | [
"MIT"
] | ahsanbutt95/sweetpea-py | example_programs/PadmalaPessoa2011.py | 3,593 | Python |
# coding: utf-8
import pprint
import re
import six
class KeyStatusInfo:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is j... | 24.884058 | 74 | 0.534945 | [
"Apache-2.0"
] | Adek06/huaweicloud-sdk-python-v3 | huaweicloud-sdk-kms/huaweicloudsdkkms/v1/model/key_status_info.py | 3,578 | Python |
# -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : 526614962@qq.com
@site : https://github.com/zhuyuanxiang/tensorflow_cookbook
---------------------------
@Software : PyCharm
@Project : TensorFlow_Machine_Learning_Cookbook
@File : C0106_operations.py
@Version : v0.1... | 30.842697 | 99 | 0.637887 | [
"MIT"
] | zhuyuanxiang/tensorflow_cookbook | 01_Introduction/C0106_operations.py | 3,173 | Python |
import numpy
# FIXME: copy the functions here
from sklearn.mixture.gmm import log_multivariate_normal_density, logsumexp
def sample_gaussian2(means, cv, size, random_state, mins, maxes):
def once(size1):
g = random_state.multivariate_normal(means, cv, size1).T
g = g.reshape(len(means), -1)
... | 33.859649 | 108 | 0.56943 | [
"Apache-2.0"
] | bccp/bananaplots | bananas/model.py | 5,790 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import wagtail.wagtailcore.fields
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0020_add_index_on_page_first_published_at'),
('tests', '0... | 34.606061 | 114 | 0.510508 | [
"BSD-3-Clause"
] | razisayyed/wagtail | wagtail/tests/testapp/migrations/0014_m2m_blog_page.py | 2,284 | Python |
import loquis
import subprocess
@loquis.command
def run(query,*args):
try:
L=[query.lower()]+list(args)
print(L)
return [subprocess.check_output(L)]
except:
return ["Failed to run command"]
languages={'en':{'run':run}}
| 15.533333 | 37 | 0.686695 | [
"MIT"
] | Steve132/loquis | modules/process.py | 233 | Python |
import _plotly_utils.basevalidators
class NamelengthsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name='namelengthsrc',
parent_name='violin.hoverlabel',
**kwargs
):
super(NamelengthsrcValidator, self).__init__(
plotly... | 28.8 | 78 | 0.590112 | [
"MIT"
] | Jo-Con-El/plotly.py | plotly/validators/violin/hoverlabel/__init__.py | 6,048 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from pytest import raises, approx
def test():
import pytq_crawlib
pass
if __name__ == "__main__":
import os
basename = os.path.basename(__file__)
pytest.main([basename, "-s", "--tb=native"])
| 15.388889 | 48 | 0.638989 | [
"MIT"
] | MacHu-GWU/pytq_crawlib-project | tests/test_import.py | 277 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (print_function, unicode_literals,
absolute_import, with_statement)
import os
import sys
if __name__ == '__main__':
if __package__ is None:
dir_name = os.path.dirname(__file__)
sys.path.append(
... | 20.363636 | 57 | 0.609375 | [
"Apache-2.0"
] | zxjsdp/excel2mysql | excel2mysql/__main__.py | 448 | Python |
import biathlonresults as api
def test_cups():
res = api.cups(1819)
assert isinstance(res, list)
assert len(res) == 37
def test_cup_results():
res = api.cup_results("BT1819SWRLCP__SMTS")
assert isinstance(res, dict)
assert isinstance(res["Rows"], list)
assert res["Rows"][0]["Name"] == "B... | 27.479452 | 64 | 0.649053 | [
"MIT"
] | prtkv/biathlonresults | tests/test_api.py | 2,006 | Python |
from django.conf.urls.defaults import patterns
from satchmo_store.shop.satchmo_settings import get_satchmo_setting
ssl = get_satchmo_setting('SSL', default_value=False)
urlpatterns = patterns('',
(r'^$', 'payment.modules.cod.views.pay_ship_info', {'SSL':ssl}, 'COD_satchmo_checkout-step2'),
(r'^confirm/$', '... | 46.181818 | 106 | 0.732283 | [
"BSD-3-Clause"
] | dokterbob/satchmo | satchmo/apps/payment/modules/cod/urls.py | 508 | Python |
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
"""
Run a job from hdf5.
"""
from pyiron.base.job.wrapper import job_wrapper_function
def register(parser):
parser.add_argument(
... | 29.179487 | 108 | 0.593146 | [
"BSD-3-Clause"
] | srmnitc/pyiron | pyiron/cli/wrapper.py | 1,139 | Python |
import numpy as np
import wmf
import batched_inv
import batched_inv_mp
import solve_mp
import solve_gpu
np.random.seed(123)
B = np.load("test_matrix.pkl")
S = wmf.log_surplus_confidence_matrix(B, alpha=2.0, epsilon=1e-6)
num_factors = 40 + 1
num_iterations = 1
batch_size = 1000
solve = batched_inv.solve_sequentia... | 24.346154 | 142 | 0.793049 | [
"MIT"
] | Phdntom/wmf | test_batched_inv_mp.py | 633 | Python |
"""
ASGI config for cryptocurrency project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANG... | 23.823529 | 78 | 0.792593 | [
"Apache-2.0"
] | deepanshu-jain1999/cryptocurrencytracking | cryptocurrency/asgi.py | 405 | Python |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 40.068966 | 94 | 0.643561 | [
"Apache-2.0"
] | HatsuneMiku4/incubator-tvm | topi/python/topi/cuda/conv2d_nhwc_tensorcore.py | 12,782 | Python |
# Generated by Django 2.1.5 on 2019-05-03 15:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0035_post_video'),
]
operations = [
migrations.AlterField(
model_name='post',
name='video',
fiel... | 21.157895 | 80 | 0.59204 | [
"MIT"
] | akindele214/181hub_2 | blog/migrations/0036_auto_20190503_1645.py | 402 | Python |
import asyncio
import os
import warnings
from datetime import date
from secedgar.cik_lookup import CIKLookup
from secedgar.client import NetworkClient
from secedgar.core._base import AbstractFiling
from secedgar.core.filing_types import FilingType
from secedgar.exceptions import FilingTypeError
from secedgar.utils imp... | 36.359184 | 99 | 0.60586 | [
"Apache-2.0"
] | Ahrvo-Trading-Systems/sec-edgar | secedgar/core/company.py | 8,908 | Python |
from asolut.main import *
| 13 | 25 | 0.769231 | [
"MIT"
] | Marios-Mamalis/asolut | asolut/__init__.py | 26 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.