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 |
|---|---|---|---|---|---|---|---|---|
import fiftyone as fo
import fiftyone.zoo as foz
# Load Dataset
dataset = foz.load_zoo_dataset("coco-2017", split="validation")
# Randomly select 20 samples on which to generate predictions
view = dataset.take(20)
# Load zoo model
model = foz.load_zoo_model("keypoint-rcnn-resnet50-fpn-coco-torch")
# Run Inferen... | 21.863636 | 67 | 0.77131 | [
"BSD-2-Clause"
] | bikramA/sample-code | scripts/fiftyone_sample.py | 481 | Python |
from spaceone.api.inventory.v1 import network_type_pb2, network_type_pb2_grpc
from spaceone.core.pygrpc import BaseAPI
class NetworkType(BaseAPI, network_type_pb2_grpc.NetworkTypeServicer):
pb2 = network_type_pb2
pb2_grpc = network_type_pb2_grpc
def create(self, request, context):
params, metada... | 43.531915 | 118 | 0.726784 | [
"Apache-2.0"
] | choonho/inventory | src/spaceone/inventory/api/v1/network_type.py | 2,046 | Python |
#!/usr/bin/env python3
import argparse
from botocore.exceptions import ClientError
import os
from pacu.core.lib import downloads_dir
module_info = {
# Name of the module (should be the same as the filename)
"name": "lightsail__generate_temp_access",
# Name and any other notes about the author
"author"... | 40.7 | 224 | 0.575553 | [
"BSD-3-Clause"
] | damienjburks/pacu | pacu/modules/lightsail__generate_temp_access/main.py | 8,140 | Python |
# -*- coding: utf-8 -*-
import sys
import argparse
from cgate.reader import readfile, readschema, get_dtype
from cgate.validation import validate
def main():
parser = argparse.ArgumentParser()
parser.add_argument('target', help='Table name or File path')
parser.add_argument('--schema', '-s', help='Cerber... | 32.433333 | 103 | 0.664954 | [
"MIT"
] | buddseye/cerberus-gate | cgate/cgate.py | 973 | Python |
# Generated by Django 2.2.6 on 2020-09-03 03:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comment', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='target',
... | 20.947368 | 72 | 0.59799 | [
"BSD-2-Clause"
] | shenjinglei/typeidea | comment/migrations/0002_auto_20200903_0323.py | 406 | Python |
from django.contrib import admin
# Register your models here.
from .models import Join
class JoinAdmin(admin.ModelAdmin):
list_display = ['email', 'friend', 'timestamp', 'updated']
class Meta:
model = Join
admin.site.register(Join, JoinAdmin)
| 20.230769 | 62 | 0.707224 | [
"MIT"
] | volkandkaya/trader | trader/joins/admin.py | 263 | Python |
import re
def camel_space(string):
string = re.sub(r'(?<!^)(?=[A-Z])', ' ', string)
return string
Test.assert_equals(solution("helloWorld"), "hello World")
Test.assert_equals(solution("camelCase"), "camel Case")
Test.assert_equals(solution("breakCamelCase"), "break Camel Case") | 32 | 66 | 0.697917 | [
"BSD-2-Clause"
] | brennanbrown/code-challenges | camel_space.py | 288 | Python |
import logging
import os
import boto3
from lib.cleanup_resource_handler import CleanupResourceHandler
from lib.queue_handler import QueueHandler
logging.getLogger().setLevel(logging.INFO)
def queue_handler(event, context):
"""
Handler for the event queue lambda trigger
"""
ec2_client = boto3.clien... | 25.6 | 117 | 0.737723 | [
"Apache-2.0"
] | 14kw/aws-cdk | packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/index.py | 896 | Python |
import torchvision as torchvision
from torchvision.transforms import transforms
from tqdm import tqdm
from remote_dataloader.loader import RemoteDataLoader
if __name__ == '__main__':
transform_train = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
... | 33.857143 | 118 | 0.708861 | [
"MIT"
] | ildoonet/remote-dataloader | example.py | 711 | Python |
# inclass/mongo_queries.py
import pymongo
import os
from dotenv import load_dotenv
import sqlite3
load_dotenv()
DB_USER = os.getenv("MONGO_USER", default="OOPS")
DB_PASSWORD = os.getenv("MONGO_PASSWORD", default="OOPS")
CLUSTER_NAME = os.getenv("MONGO_CLUSTER_NAME", default="OOPS")
connection_uri = f"mongodb+srv://{D... | 26.685864 | 150 | 0.566314 | [
"MIT"
] | ekselan/DS-Unit-3-Sprint-2-SQL-and-Databases | assignment3/a3_mongo_queries_abw.py | 10,194 | Python |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | 30.215484 | 171 | 0.547882 | [
"EPL-1.0"
] | CeltonMcGrath/TACTIC | src/tactic/ui/container/tab_wdg.py | 93,668 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__... | 41.794749 | 134 | 0.672624 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/python/pulumi_azure_native/recoveryservices/v20181220/outputs.py | 17,512 | Python |
from .ric import RIC
import pysecm.ric.commodity
import pysecm.ric.equity
import pysecm.ric.fixed_income
import pysecm.ric.fx
import pysecm.ric.index
| 21.428571 | 30 | 0.833333 | [
"MIT"
] | bostonrwalker/pysecm | pysecm/ric/__init__.py | 150 | Python |
import os
import numpy as np
from netCDF4 import Dataset
def load_region(region_id, local=False, return_regions=False):
if local:
_vr = Dataset(
os.path.join(os.path.dirname(os.path.abspath(__file__)), r"data/terrain_parameters/VarslingsOmr_2017.nc"),
"r")
# flip up-down b... | 43.731343 | 124 | 0.669283 | [
"MIT"
] | kmunve/APS | aps/load_region.py | 2,930 | Python |
# Generated by Django 2.1.11 on 2020-06-24 06:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0008_auto_20190919_1521'),
]
operations = [
migrations.AddField(
model_name='product',
name='is_deleted... | 20.736842 | 53 | 0.606599 | [
"MIT"
] | Baktybek0312/ecommerce_api | products/migrations/0009_product_is_deleted.py | 394 | Python |
import time
import torch
from hpc_rll.origin.td import iqn_nstep_td_error, iqn_nstep_td_data
from hpc_rll.rl_utils.td import IQNNStepTDError
from testbase import mean_relative_error, times
assert torch.cuda.is_available()
use_cuda = True
tau = 33
tauPrime = 34
T = 10
B = 64
N = 8
gamma = 0.95
kappa = 0.9
def iqn_val... | 39.425 | 191 | 0.656309 | [
"Apache-2.0"
] | opendilab/DI-hpc | tests/test_iqn_nstep_td_error.py | 6,308 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
from test_framework.mininode import *
from test... | 33 | 83 | 0.695567 | [
"MIT"
] | Supernode-SUNO/SUNO | test/functional/test_framework/blocktools.py | 3,564 | Python |
# -*- coding: utf-8 -*-
import datetime
from unittest.mock import Mock
import pytest
from h.activity import bucketing
from tests.common import factories
UTCNOW = datetime.datetime(year=1970, month=2, day=21, hour=19, minute=30)
FIVE_MINS_AGO = UTCNOW - datetime.timedelta(minutes=5)
YESTERDAY = UTCNOW - datetime.ti... | 34.671679 | 88 | 0.630331 | [
"BSD-2-Clause"
] | y3g0r/h | tests/h/activity/bucketing_test.py | 13,834 | Python |
# models.py
from flask_login import UserMixin
from . import db
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
email = db.Column(db.String(100), unique=True)
password = db.Column(db.String(100))
name = db.Column(db.String(1000))
... | 32.363636 | 90 | 0.707865 | [
"MIT"
] | devsunny/flask-secure-upload | webapp/models.py | 356 | Python |
# -*- coding: utf-8 -*-
from . import fields
from . import integrators
from . import points
from . import system
from . import utils
from . import visualizer
from .system import NBodySystem
from .visualizer import Visualizer, run | 19.333333 | 39 | 0.75 | [
"BSD-3-Clause"
] | DFNaiff/FieldBillard | fieldbillard/__init__.py | 232 | Python |
import json
import logging
import requests
from kube_hunter.core.events import handler
from kube_hunter.core.events.types import Event, OpenPortEvent, Service
from kube_hunter.core.types import Discovery
class EtcdAccessEvent(Service, Event):
"""Etcd is a DB that stores cluster's data, it contains configuration ... | 28.148148 | 85 | 0.735526 | [
"Apache-2.0"
] | LozanoMatheus/kube-hunter | kube_hunter/modules/discovery/etcd.py | 760 | Python |
# -*- coding: utf-8 -*-
# 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/.
#
# Copyright (c) 2021-present Kaleidos Ventures SL
from __future__ import unicode_literals
fro... | 30.017544 | 90 | 0.735243 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | CarlosLVar/taiga-back-1 | taiga/projects/tasks/migrations/0009_auto_20151104_1131.py | 1,711 | Python |
from gpiozero import CPUTemperature
from tabulate import tabulate
from math import floor
import numpy as np
import termplotlib as tpl
import time
import shutil
def roundNum(num, digits):
return floor(num * 10 ** digits) / (10 ** digits)
def CtoF(temp):
fahrenheit = (temp + 1.8) + 32
rounded = roundNum(fah... | 30.988889 | 170 | 0.608103 | [
"MIT"
] | KevinLee3627/pi-temp-monitor | monitor_temp.py | 2,789 | 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 us... | 34.164794 | 125 | 0.691515 | [
"Apache-2.0"
] | AldairCoronel/beam | sdks/python/apache_beam/testing/benchmarks/nexmark/nexmark_launcher.py | 9,122 | Python |
from rlbot.utils.structures.game_data_struct import Physics, GameTickPacket, PlayerInfo
from rlbot.agents.base_agent import SimpleControllerState, BaseAgent
from states.state import State
from util.packet import ParsedPacket
class GroundSave(State):
def score(self, parsed_packet: ParsedPacket, packet: GameTickPa... | 39.692308 | 121 | 0.792636 | [
"MIT"
] | KrystopherWeeton/RLBot | FirstChild/src/states/ground_save.py | 516 | Python |
__author__ = '[email protected]'
| 20.5 | 40 | 0.756098 | [
"Apache-2.0"
] | chenhui0228/sfcsm | sfcsmCtrl/model/__init__.py | 41 | Python |
#
# 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.
#
from rlstructures.logger import Logger, TFLogger
from rlstructures import DictTensor, TemporalDictTensor
from rlstructures import logging... | 42.461224 | 136 | 0.612323 | [
"MIT"
] | Purple-PI/rlstructures | tutorial/deprecated/tutorial_a2c_with_infinite_env/a2c.py | 10,403 | Python |
"""Utility functions for parcinging Freesurfer output files."""
from os.path import join
import nibabel as nb
import numpy as np
def _vectorize_fs_surf(file_path):
"""
Read surface information from a file and turn it into a vector.
Parameters
----------
file_path : str
The path to a file... | 23.682353 | 79 | 0.655241 | [
"BSD-3-Clause"
] | McIntosh-Lab-RRI/meg-mri-surrogate-biomarkers-aging-2020 | camcan/utils/file_parsing.py | 2,013 | Python |
import builtins
import os
import sys
from array import array
from collections import Counter, defaultdict, deque
from dataclasses import dataclass, fields, is_dataclass
from itertools import islice
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Set,
... | 34.741007 | 134 | 0.566163 | [
"MIT"
] | AwesomeGitHubRepos/rich | rich/pretty.py | 24,145 | Python |
import json
import os
import sys
import time
import torch
from training.training import Trainer
from data.conversion import GridDataConverter, PointCloudDataConverter, ERA5Converter
from data.dataloaders import mnist, celebahq
from data.dataloaders_era5 import era5
from data.dataloaders3d import shapenet_voxels, shapen... | 43.034247 | 115 | 0.660353 | [
"MIT"
] | EmilienDupont/neural-function-distributions | main.py | 6,283 | Python |
#! /usr/bin/env python
# Convert OpenSSH known_hosts and known_hosts2 files to "new format" PuTTY
# host keys.
# usage:
# kh2reg.py [ --win ] known_hosts1 2 3 4 ... > hosts.reg
# Creates a Windows .REG file (double-click to install).
# kh2reg.py --unix known_hosts1 2 3 4 ... > sshhostkeys
# Cr... | 34.860606 | 79 | 0.546071 | [
"MIT"
] | FireEgl/FuTTY | contrib/kh2reg.py | 5,752 | Python |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | 36.228792 | 106 | 0.59597 | [
"BSD-3-Clause"
] | BaicellsDev/magma | lte/gateway/python/magma/pipelined/qos/qos_tc_impl.py | 14,093 | Python |
# coding=utf-8
# 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 shutil
import mock
import pytest
from callee import Contains
from .conftest import git_out, search... | 30.049086 | 87 | 0.526953 | [
"MPL-2.0"
] | dklawren/review | tests/test_integration_git.py | 31,249 | Python |
from .optimizers import GAOptimizer | 35 | 35 | 0.885714 | [
"MIT"
] | simoore/control-in-verilog | controlinverilog/synthesis/__init__.py | 35 | Python |
import unittest
import io
import sys
import random
from unittest.mock import MagicMock, Mock, patch
from snap.grid import Grid
from snap.hand import Hand
from snap.card import Card
class TestGrid(unittest.TestCase):
def test__get__origin__returns_correct_cards(self):
random.seed(1)
expected_card =... | 31.170213 | 73 | 0.675085 | [
"MIT"
] | gabrielbarker/snap | test/test_grid.py | 1,465 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`accelerometer`
==================
Updated by lkasso <[email protected]>
Created by hbldh <[email protected]>
Created on 2016-04-10
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
impor... | 22.932203 | 81 | 0.739098 | [
"MIT"
] | somacoder/pymetawear | examples/accelerometer.py | 1,353 | Python |
# Natural Language Toolkit: SVM-based classifier
#
# Copyright (C) 2001-2022 NLTK Project
# Author: Leon Derczynski <[email protected]>
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
nltk.classify.svm was deprecated. For classification based
on support vector machines SVMs use nltk.cl... | 28.222222 | 61 | 0.73622 | [
"Apache-2.0"
] | LouisJustinTALLOT/nltk | nltk/classify/svm.py | 508 | Python |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
with open('VERSION.py') as f:
exec(f.read())
setup(
name='upsere analysis',
version=__version__,
description='10X Genomics CLI',
... | 22.648649 | 58 | 0.619332 | [
"MIT"
] | ebelter/upserve-analysis | setup.py | 838 | Python |
#!/usr/bin/python2
'''
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"); y... | 25.945946 | 72 | 0.697917 | [
"Apache-2.0"
] | zyclove/ambari | ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/blacklisted_set.py | 1,920 | Python |
#!/usr/bin/python
################################################################################
# 20de4144-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# [email protected]
# [email protected]
#
# 10/24/2014 Original Construction
################################################################... | 35.842105 | 136 | 0.586637 | [
"MIT"
] | phnomcobra/PCAT2PY | pcat2py/class/20de4144-5cc5-11e4-af55-00155d01fe08.py | 1,362 | Python |
import _plotly_utils.basevalidators
class SizeyValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="sizey", parent_name="layout.image", **kwargs):
super(SizeyValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | 34.230769 | 82 | 0.653933 | [
"MIT"
] | 4RCAN3/CryptoTrader | binbot/Lib/site-packages/plotly/validators/layout/image/_sizey.py | 445 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import io
import os
import sys
from setuptools import find_packages, setup
def read_req(req_file):
with open(os.path.join('requirements', req_file)) as req:
return [line.strip() for line in req.readlines() if line.strip(... | 33.747664 | 113 | 0.649405 | [
"BSD-3-Clause"
] | Core00077/drf-yasg | setup.py | 3,611 | Python |
from tourapi.list import TourAPI
from tourapi.config import ServiceKey, MobileOS, MobileApp, Languages
from mysql_config import MysqlHost, MysqlUser, MysqlPass, MysqlDB
import pymysql
import json
def upload_category_codes(codes, language="Kor", level=0, cat1="", cat2="", cat3=""):
global conn, curs
query = """
... | 30.2 | 101 | 0.693893 | [
"MIT"
] | darkbright/TourAPI | 02_category_code.py | 1,373 | Python |
import os
import shutil
import subprocess
import re
import string
import pathlib
import timeit
import jmhbenchmark
class JHaskellBenchmark(jmhbenchmark.JMHBenchmark):
def __init__(self, name, source_path, compiler_args=None):
if compiler_args is None:
compiler_args = []
source_path = ... | 32.376238 | 113 | 0.576758 | [
"BSD-3-Clause"
] | hnefatl/dissertation-project | benchmarks/jhaskellbenchmark.py | 3,270 | Python |
import copy
import logging
from collections import defaultdict
import dask.dataframe as dd
import numpy as np
import pandas as pd
from pandas.api.types import is_dtype_equal, is_numeric_dtype
import featuretools.variable_types.variable as vtypes
from featuretools.entityset import deserialize, serialize
from featureto... | 44.426516 | 174 | 0.573924 | [
"BSD-3-Clause"
] | esyyes/featuretools | featuretools/entityset/entityset.py | 43,227 | Python |
from __future__ import unicode_literals
from future.builtins import int, zip
from functools import reduce
from operator import ior, iand
from string import punctuation
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Manager, Q, CharField, TextField
from django.db.models.loading im... | 43.364116 | 78 | 0.61369 | [
"BSD-2-Clause"
] | abendig/mezzanine | mezzanine/core/managers.py | 16,435 | Python |
import pdfplumber
import re
import pandas as pd
from datetime import datetime
import sys
# AUTHOR: Simon Rosen
# -----------------------------------
# DEPENDENCIES
# This module requires 'pdfplumber'
#
# Install: pip install pdfplumber
# -----------------------------------
def extract_data(file_path):
... | 40.036667 | 126 | 0.590542 | [
"MIT"
] | delenamalan/covid19za | scripts/gp_pdf_extractor.py | 12,011 | 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... | 42.402087 | 110 | 0.631674 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | AliMuhammadOfficial/airflow | tests/providers/google/cloud/hooks/test_bigquery.py | 85,313 | Python |
from math import sqrt
import networkx as nx
import matplotlib.pyplot as plt
import pygraphviz
from networkx.drawing.nx_agraph import graphviz_layout
class Distribution:
from random import random
from random import gauss
from numpy.random import poisson
_h = [0]
h = property(lambda s: s._h[0])
... | 24.169492 | 112 | 0.586489 | [
"MIT"
] | stronklab/netpy | netpy/earl/__init__.py | 4,278 | Python |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"Config": "00_learner.ipynb",
"energy_score": "00_learner.ipynb",
"EnsemblePredict": "00_learner.ipynb",
"EnsembleLearner": "00_learner.ipynb",
"ARCHITECTURES": "01_models.... | 37.088235 | 62 | 0.560666 | [
"Apache-2.0"
] | adriHei/deepflash2 | deepflash2/_nbdev.py | 3,783 | Python |
from django.db import models
from django.contrib.auth import get_user_model
User = get_user_model()
class Group(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
description = models.TextField()
class Post(models.Model):
text = models.TextField()
pub_d... | 36.888889 | 119 | 0.743223 | [
"MIT"
] | SergeyKorobenkov/hw05_final | posts/models.py | 1,397 | Python |
import sys
import numpy as np
from numpy.lib import recfunctions as recFunc
from ..frequency_domain.survey import Survey
from ...data import Data as BaseData
from ...utils import mkvc
from .sources import Planewave_xy_1Dprimary, Planewave_xy_1DhomotD
from .receivers import Point3DImpedance, Point3DTipper
from .utils.p... | 36.732824 | 157 | 0.520989 | [
"MIT"
] | JKutt/simpeg | SimPEG/electromagnetics/natural_source/survey.py | 9,624 | Python |
# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergov... | 25.032787 | 80 | 0.698756 | [
"ECL-2.0",
"Apache-2.0"
] | EduardRosert/magics | regression/era/era.py | 1,527 | Python |
#!/usr/bin/env python3
"""A utility script for automating the beets release process.
"""
import click
import os
import re
import subprocess
from contextlib import contextmanager
import datetime
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
CHANGELOG = os.path.join(BASE, 'docs', 'changelog.rst')
... | 26.90678 | 77 | 0.526089 | [
"MIT"
] | DucNg/beets | extra/release.py | 9,525 | Python |
import re
from Error import Error4,Error6,Error9
from DataBase import BaseDatos,BdRow
from .precompilada import precompilada
from typing import Pattern
def getEtiqueta(linea:str)->str:
"""Obtiene el nombre de la captura
Args:
linea (str): Linea donde se va a buscar la etiqueta
Returns:
st... | 29.595745 | 201 | 0.656602 | [
"MIT"
] | EzioFenix/Compilador-M68HC11 | Precompilar/relativo.py | 4,178 | Python |
db.blog_category.ondelete = 'CASCADE'
db.blog.ondelete = 'CASCADE'
db.branch_rating.ondelete = 'CASCADE'
db.branch.ondelete = 'CASCADE'
db.floor.ondelete = 'CASCADE'
db.guest.ondelete = 'CASCADE'
db.news_category.ondelete = 'CASCADE'
db.news.ondelete = 'CASCADE'
db.photo_album.ondelete = 'CASCADE'
db.photo.ondelete = '... | 31.3125 | 38 | 0.760479 | [
"BSD-3-Clause"
] | wantsomechocolate/WantsomeBeanstalk | web2py-appliances-master/HotelManagementExample/models/db_wizard_ondelete.py | 501 | Python |
# Copyright 2016 Hewlett Packard Enterprise Development 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
#
# Unless requi... | 42.716667 | 81 | 0.630901 | [
"Apache-2.0"
] | HewlettPackard/python-ilorest-library-EOL | examples/Rest/ex17_mount_virtual_media_iso.py | 2,563 | Python |
from gpiozero import Servo
from gpiozero import LED
from time import sleep
from WeatherDataCW import WeatherData
class WeatherDashboard:
servo_pin = 17
led_pin = 14
servoCorrection=0.5
maxPW=(2.0+servoCorrection)/1000
minPW=(1.0-servoCorrection)/1000
def __init__(self, servo_position=... | 30.672414 | 98 | 0.649241 | [
"MIT"
] | kuzned/rpi_weather | WeatherDashboardCW.py | 1,779 | Python |
# Generated by Django 2.0.3 on 2018-05-28 23:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0003_task_order'),
]
operations = [
migrations.AlterField(
model_name='task',
name='order',
field... | 19.526316 | 50 | 0.58221 | [
"MIT"
] | rkcf/dailio | backend/api/migrations/0004_auto_20180528_2342.py | 371 | Python |
import datetime
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.db.models import Sum
import commonware.log
import waffle
import amo
import mkt.constants.comm as comm
from amo.utils import cache_ns_key
from mkt.comm.utils import create_comm_note
from mkt.s... | 32.569231 | 81 | 0.590526 | [
"BSD-3-Clause"
] | ngokevin/zamboni | mkt/reviewers/models.py | 14,819 | Python |
class Solution:
def backspaceCompare(self, S: str, T: str) -> bool:
s_bcount, t_bcount = 0, 0
s_idx, t_idx = len(S) - 1, len(T) - 1
while s_idx >= 0 or t_idx >= 0:
while s_idx >= 0:
if S[s_idx] == '#':
s_bcount += 1
... | 29.125 | 74 | 0.318455 | [
"MIT"
] | subwaymatch/leetcode | 0844_backspace_string_compare.py | 1,165 | Python |
_base_ = [
'../../_base_/schedules/schedule_1200e.py', '../../_base_/runtime_10e.py'
]
model = dict(
type='DBNet',
pretrained='torchvision://resnet18',
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=-1,
norm_c... | 32.402062 | 77 | 0.596564 | [
"Apache-2.0"
] | 2793145003/mmocr | configs/textdet/dbnet/dbnet_r18_fpnc_1200e_icdar2015.py | 3,143 | Python |
# Copyright 2013-2022 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.package import *
class RVgam(RPackage):
"""Vector Generalized Linear and Additive Models.
An impleme... | 58.933333 | 95 | 0.761312 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | jmellorcrummey/spack | var/spack/repos/builtin/packages/r-vgam/package.py | 2,652 | Python |
from django import db
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.contenttypes.views import shortcut
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test... | 38.786667 | 77 | 0.663802 | [
"BSD-3-Clause"
] | coderanger/django | django/contrib/contenttypes/tests.py | 2,909 | Python |
"""
BasicSR/codes/dataops/common.py (8-Nov-20)
https://github.com/victorca25/BasicSR/blob/dev2/codes/dataops/common.py
"""
import os
import math
import pickle
import random
import numpy as np
import torch
import cv2
import logging
import copy
from torchvision.utils import make_grid
#from dataops.colors import *
from... | 38.010067 | 184 | 0.613872 | [
"Apache-2.0"
] | f74066357/Image_Inpainting | mmedit/models/inpaintors/vic/common.py | 33,981 | Python |
# -*- coding: utf-8 -*-
from numpy import NaN as npNaN
from pandas import DataFrame, Series
# from pandas_ta.overlap.ma import ma
from .ma import ma
from pandas_ta.utils import get_offset, verify_series
def hilo(high, low, close, high_length=None, low_length=None, mamode=None, offset=None, **kwargs):
"""Indicator... | 34.734375 | 111 | 0.65857 | [
"MIT"
] | MyBourse/pandas-ta | pandas_ta/overlap/hilo.py | 4,446 | Python |
import github
import pandas as pd
def get_issues(repo_addr):
g = github.Github()
repo = g.get_repo(repo_addr)
return repo.get_issues()
def fetch_issue_activity(repo_addr):
g = github.Github()
issues = g.get_repo(repo_addr).get_issues(state="all")
events = []
for issue in issues:
... | 24.15625 | 58 | 0.614489 | [
"MIT"
] | autt/gathering-leto | src/data/data/__init__.py | 773 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
if __name__ == '__main__':
goods = []
while True:
command = input(">>> ").lower()
if command == 'exit':
break
elif command == 'add':
name = input("Название товара: ")
shop = input("Названи... | 29.011765 | 72 | 0.37794 | [
"MIT"
] | surai5a/laba_2_6 | pythonProject/ind.py | 2,745 | Python |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 5 08:32:13 2019
@author: Thiago
"""
import numpy as np
import pylab as pl
#%%
#Simulação de uma va
def va_estoque():
p=np.array([0.1, 0.2, 0.6, 0.1])
x=np.random.rand()
if 0 < x <= p[0]:
return 1
elif p[0] < x <= p[0]+p[1]:
return 2
... | 15.099099 | 42 | 0.50716 | [
"MIT"
] | thiago9864/introducao_modelagem | aulas/05-06/variaveis_aleatorias.py | 1,683 | Python |
"""Test GeoTIFF as process output."""
import numpy as np
import numpy.ma as ma
import os
import pytest
import rasterio
from rasterio.io import MemoryFile
from rio_cogeo.cogeo import cog_validate
import shutil
from tilematrix import Bounds
import warnings
import mapchete
from mapchete.errors import MapcheteConfigError... | 36.396761 | 86 | 0.628699 | [
"MIT"
] | Scartography/mapchete | test/test_formats_geotiff.py | 17,980 | Python |
# Copyright (c) 2012, Cloudscaling
# 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... | 36.551587 | 78 | 0.670828 | [
"Apache-2.0"
] | scality/manila | manila/hacking/checks.py | 9,211 | Python |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | 37.857143 | 79 | 0.686289 | [
"BSD-3-Clause"
] | stormi/tsunami | src/secondaires/navigation/equipage/volontes/tenir_gouvernail.py | 3,986 | Python |
#https://blog.csdn.net/orangefly0214/article/details/81387077
import MultiTemplate
from MultiTemplate import TaskTemplate
# https://blog.csdn.net/u013812710/article/details/72886491
# https://blog.csdn.net/ismr_m/article/details/53100896
#https://blog.csdn.net/bcfdsagbfcisbg/article/details/78134172
import kubernetes
i... | 46.155488 | 219 | 0.594986 | [
"Apache-2.0"
] | qore-dl/qore-dl-code | experiment code/CPU Experiments Code/task_submit_save.py | 30,278 | Python |
# -*- coding: utf-8 -*-
from datetime import datetime
import time
import unittest
from webapp2_caffeine.cache import CacheContainer
from webapp2_caffeine.cache import flush
class DummyCache(CacheContainer):
key = 'dummy_cache'
@property
def fresh_value(self):
return datetime.now()
class Cache... | 26.119403 | 65 | 0.641143 | [
"Apache-2.0"
] | gvigneron/webapp2_caffeine | tests/test_cache.py | 1,750 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Ttm Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.blocktools import create_block, create_coinbase, get_masternode_payment
from test_framewor... | 45.975369 | 124 | 0.645773 | [
"MIT"
] | mytitanium/Titanium-Core-1.0 | test/functional/feature_block_reward_reallocation.py | 9,333 | Python |
from unittest import mock
import pytest
from rest_framework.serializers import ValidationError
from drf_recaptcha.client import RecaptchaResponse
from drf_recaptcha.validators import ReCaptchaV2Validator, ReCaptchaV3Validator
@pytest.mark.parametrize(
("validator_class", "params"),
[
(ReCaptchaV2Val... | 34.630435 | 107 | 0.634442 | [
"MIT"
] | finhold72/recaptcha | tests/test_validator.py | 4,779 | Python |
import os
from datetime import datetime
import numpy as np
import xarray as xr
from pyoos.collectors.usgs.usgs_rest import UsgsRest
from pyoos.parsers.waterml import WaterML11ToPaegan
def get_usgs_data(station_id, start_date, end_date, parameter="00060", cache_dir=None):
"""Get river discharge data from the USGS... | 30.271318 | 89 | 0.576184 | [
"Apache-2.0"
] | cffbots/ewatercycle | src/ewatercycle/observation/usgs.py | 3,905 | Python |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... | 39.867399 | 89 | 0.569815 | [
"Apache-2.0"
] | deeplearning2012/polyaxon | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | 47,203 | Python |
#!/home/anitha/Track/virtual/bin/python
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 24.333333 | 42 | 0.780822 | [
"Unlicense"
] | Anitha987/Hood-Track | virtual/bin/django-admin.py | 146 | Python |
from model.contact import Contact
import random
def test_delete_some_contact(app, db, check_ui):
if app.contacts.count() == 0:
app.contacts.create_new_contact(Contact(firstname="crab"))
old_contacts = db.get_contact_list()
contact = random.choice(old_contacts)
app.contacts.delete_contact_by_id(... | 36 | 125 | 0.739198 | [
"Apache-2.0"
] | winsok/pythonlearning | test/test_contactdeletetest.py | 648 | Python |
import concurrent.futures
import datetime
import io
import logging
import os
import random
import time
import typing as t
import discord
import discord.ext.commands as commands
from PIL import Image, ImageDraw, ImageSequence, ImageFont
import bot.extensions as ext
from bot.consts import Colors
from bot... | 35.462963 | 147 | 0.565144 | [
"MIT"
] | Cavesprout/ClemBot | bot/cogs/memes_cog/memes_cog.py | 7,666 | Python |
#! /usr/bin/env python3
# -*- coding: utf8 -*-
# Virtual dancers that consumes real GigglePixel packets
#
# To use, start this up and then bring up a server broadcasting GigglePixel.
# When this receives a palette packet, the dancing pair (whose humble wearables
# are only capable of displaying one color at a time api... | 24.195652 | 86 | 0.649146 | [
"MIT"
] | playasystems/hacks | python-lib/example-consumer.py | 2,240 | Python |
from __future__ import unicode_literals
import io
import os
import re
import sys
from botocore.awsrequest import AWSPreparedRequest
from moto.core.utils import (
amzn_request_id,
str_to_rfc_1123_datetime,
py2_strip_unicode_keys,
)
from urllib.parse import (
parse_qs,
parse_qsl,
urlparse,
... | 38.059041 | 168 | 0.58727 | [
"Apache-2.0"
] | nom3ad/moto | moto/s3/responses.py | 103,140 | Python |
# -*- coding: utf-8 -*-
#
# Python Github documentation build configuration file, created by
# sphinx-quickstart on Tue Feb 3 23:23:15 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... | 31.524164 | 79 | 0.71816 | [
"MIT"
] | nicchub/PythonGithub | docs/conf.py | 8,480 | Python |
from setuptools import setup
setup(
name='dst',
version='0.1.5',
author='Jeroen Janssens',
author_email='[email protected]',
packages=['dst'],
url='http://datasciencetoolbox.org',
license='BSD',
description='Data Science Toolbox -- Start doing data science in minutes.',
long_... | 34.742857 | 79 | 0.60773 | [
"BSD-2-Clause"
] | CleverProgrammer/data-science-toolbox | manager/setup.py | 1,216 | Python |
#!coding:utf8
#author:yqq
#date:2020/4/30 0030 17:11
#description:
import os
import pymysql
SQL_PASSWD = os.environ.get('SQL_PWD')
def open(host : str,usr : str, passwd : str,db_name : str):
conn = pymysql.connect(host=host, user=usr,
password=passwd, db=db_name,
charset='utf8', ... | 21.666667 | 71 | 0.643439 | [
"MIT"
] | songning4/QBlockChainNotes | Python3/Tornado/apps/pg/PG_Admin/lib/sql.py | 1,105 | Python |
# Copyright 2018 Open Source Robotics Foundation, 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... | 32.55914 | 95 | 0.679326 | [
"Apache-2.0"
] | Blutkoete/ecal | doc/extensions/empy_helpers/__init__.py | 3,028 | Python |
"""
This magical module will rewrite all public methods in the public interface
of the library so they can run the loop on their own if it's not already
running. This rewrite may not be desirable if the end user always uses the
methods they way they should be ran, but it's incredibly useful for quick
scripts and the ru... | 33.873239 | 79 | 0.710603 | [
"MIT"
] | SlavikMIPT/Telethon | telethon/sync.py | 2,405 | Python |
"""
Plotting code for nilearn
"""
# Original Authors: Chris Filo Gorgolewski, Gael Varoquaux
import os
import sys
import importlib
###############################################################################
# Make sure that we don't get DISPLAY problems when running without X on
# unices
def _set_mpl_backend():
... | 42.712329 | 79 | 0.645927 | [
"BSD-2-Clause"
] | AKSoo/nilearn | nilearn/plotting/__init__.py | 3,118 | Python |
import setuptools
import os
own_dir = os.path.abspath(os.path.dirname(__file__))
def requirements():
with open(os.path.join(own_dir, 'requirements.oci.txt')) as f:
for line in f.readlines():
line = line.strip()
if not line or line.startswith('#'):
continue
... | 19.04878 | 66 | 0.583867 | [
"BSD-3-Clause"
] | MrBatschner/cc-utils | setup.oci.py | 781 | Python |
import asyncio
import logging
import voluptuous as vol
from homeassistant.components.system_log import CONF_LOGGER
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import HomeAssistant, Event
from homeassistant.helpers import config_v... | 32.758364 | 79 | 0.661825 | [
"Unlicense"
] | Gamma-Software/HomeAssistantConfig | custom_components/xiaomi_gateway3/__init__.py | 8,812 | Python |
import logging
from aiohttp.web import Application
from virtool.pg.base import Base
from virtool.startup import get_scheduler_from_app
logger = logging.getLogger(__name__)
async def shutdown_client(app: Application):
"""
Attempt to close the async HTTP client session.
:param app: The application objec... | 22.597826 | 87 | 0.658009 | [
"MIT"
] | KingBain/virtool | virtool/shutdown.py | 2,079 | Python |
# User class to hold name and __data
class User:
### Instance Variables ###
__userName = ""
__validUser = None
__data = []
__weights = []
__notes = []
__dates = []
__intWeights = []
__avgWeight = 0
__minWeight = 0
__maxWeight = 0
##########################
### G... | 21.071429 | 77 | 0.595157 | [
"MIT"
] | imjacksonchen/weightTracker | User.py | 2,065 | Python |
from unittest.mock import patch
from django.test import TestCase
from django_logic.state import State
from django_logic.transition import Transition
from tests.models import Invoice
def disable_invoice(invoice: Invoice, *args, **kwargs):
invoice.is_available = False
invoice.save()
def update_invoice(invoi... | 45.507109 | 108 | 0.687669 | [
"MIT"
] | khamenman/django-logic | tests/test_transition.py | 9,602 | Python |
# Generated by Django 3.2.4 on 2021-07-04 11:51
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations ... | 51.458333 | 266 | 0.631174 | [
"MIT"
] | ergauravsoni/final-year-backend | app/core/migrations/0001_initial.py | 2,470 | Python |
from simplecoremidi import send_midi
from time import sleep
def play_a_scale():
root_note = 60 # This is middle C
channel = 1 # This is MIDI channel 1
note_on_action = 0x90
major_steps = [2, 2, 1, 2, 2, 2, 1, 0]
velocity = 127
note = root_note
for step in major_steps:
send_midi((... | 24.703704 | 70 | 0.554723 | [
"MIT"
] | Miselu/simplecoremidi | simplecoremidi/examples/play_a_scale.py | 667 | Python |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Anscombe'] , ['MovingMedian'] , ['NoCycle'] , ['LSTM'] ); | 38.25 | 80 | 0.745098 | [
"BSD-3-Clause"
] | antoinecarme/pyaf | tests/model_control/detailed/transf_Anscombe/model_control_one_enabled_Anscombe_MovingMedian_NoCycle_LSTM.py | 153 | Python |
# if funktioniert (fast) wie in allen anderen Sprachen
# - Einrückungen ersetzen { } Gilt für Python generell!
# - Es gibt ein elif statt einem else if
weight = 50 # kg
height = 190 # cm
bmi = weight / (height/100)**2
# bmi < 18.5 : Untergewicht
# bmi > 25 : Übergewicht
# sonst : Normalgewicht
if bmi < 18.5... | 22.25 | 55 | 0.653933 | [
"Unlicense"
] | slogslog/Coding-Kurzgeschichten | Crashkurs Python/03_if.py | 449 | Python |
import sys
import os
import math
import shutil
import disk_sort
import struct
import operator
import logging
from decimal import Decimal
from fractions import Fraction
import numpy
from scipy.linalg import eig
import scipy.ndimage
import cProfile
import pstats
from osgeo import gdal, ogr
import pygeoprocessing.geopr... | 42.042076 | 166 | 0.583283 | [
"BSD-3-Clause"
] | natcap/invest-natcap.invest-3 | invest_natcap/scenario_generator/scenario_generator.py | 59,952 | Python |
from __future__ import annotations
import argparse
import logging
from typing import TextIO
def parse_args(args=None):
parser = argparse.ArgumentParser()
parser.add_argument("input", type=argparse.FileType('r'),
metavar="PUZZLE_INPUT")
parser.add_argument('-d', '--debug', action='s... | 29.00813 | 76 | 0.575673 | [
"MIT"
] | tcmitchell/AdventOfCode | 2021/day20/day20.py | 3,568 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.