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 |
|---|---|---|---|---|---|---|---|---|
from datetime import datetime
from typing import List, Optional
from uuid import getnode
from .ballot import (
CiphertextBallot,
CiphertextBallotContest,
CiphertextBallotSelection,
PlaintextBallot,
PlaintextBallotContest,
PlaintextBallotSelection,
make_ciphertext_ballot_contest,
make_ci... | 37.435361 | 119 | 0.713676 | [
"MIT"
] | john-s-morgan/electionguard-python | src/electionguard/encrypt.py | 19,691 | Python |
import argparse
import logging
import sys
import pyphen
import nltk
pyphen.language_fallback("en_US")
logger = logging.getLogger()
logger.setLevel(logging.INFO)
console_out = logging.StreamHandler(sys.stdout)
console_out.setLevel(logging.DEBUG)
logger.addHandler(console_out)
def parse_arguments():
"""
Simp... | 30.244604 | 96 | 0.673525 | [
"MIT"
] | 0105rahulk/ml-powered-applications | ml_editor/ml_editor.py | 8,408 | Python |
# -*- coding: utf-8 -*-
import six
from flask import Blueprint, jsonify, current_app
from ..utils import MountTree
from .utils import is_testing
api_bp = Blueprint('api', __name__.rsplit('.')[1])
if is_testing():
@api_bp.route('/_hello/')
def api_hello():
return jsonify('api hello')
@api_bp.route(... | 25.906977 | 55 | 0.572711 | [
"MIT"
] | korepwx/mlcomp | mlcomp/board/views/api.py | 1,114 | Python |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
from copy import deepcopy
import torch
from cvpods.checkpoint import DefaultCheckpointer
from cvpods.data import build_transform_gens
__all__ = ["DefaultPredictor"]
class DefaultPredictor:
"""
Create a simple end-to-end predictor with the given config that runs on
... | 35.012195 | 93 | 0.634622 | [
"Apache-2.0"
] | reinforcementdriving/cvpods | cvpods/engine/predictor.py | 2,871 | Python |
# coding: utf-8
from pytdx.hq import TdxHq_API
from pytdx.params import TDXParams
import pandas as pd
import numpy as np
import re
import csv
import io
import time
import traceback
if __name__ == '__main__':
with io.open(r'..\all_other_data\symbol.txt', 'r', encoding='utf-8') as f:
symbol = [s.strip() fo... | 28.62069 | 113 | 0.586747 | [
"MIT"
] | lte2000/cwfx | get_data/get_last_price.py | 1,672 | Python |
#! /usr/bin/env python3
from ssedata import FunctionType
from google.protobuf.json_format import MessageToDict
import grpc
import argparse
import json
import logging
import logging.config
import os
import sys
import inspect
import time
from websocket import create_connection
import socket
import re
from concurrent imp... | 42.977671 | 119 | 0.575426 | [
"MIT"
] | Parkman328/Qlik-Rapid-API-Gateway | gcp/__main__.py | 26,947 | Python |
import utils.gpu as gpu
from model.build_model import Build_Model
from utils.tools import *
from eval.evaluator import Evaluator
import argparse
import time
import logging
import config.yolov4_config as cfg
from utils.visualize import *
from utils.torch_utils import *
from utils.log import Logger
import pooraka as prk
... | 39.76378 | 129 | 0.577426 | [
"Apache-2.0"
] | chakkritte/EEEA-Net | Transfer/YOLOv4-pytorch/eval_voc.py | 5,050 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test read functionality for OGR EDIGEO driver.
# Author: Even Rouault <even dot rouault at mines dash paris dot org>
#
####################... | 38.036232 | 305 | 0.600495 | [
"MIT"
] | GISerliang/gdal | autotest/ogr/ogr_edigeo.py | 5,249 | Python |
from typing import Optional
from tjax import Array, Generator, Shape
from .parametrization import Parametrization
__all__ = ['Samplable']
class Samplable(Parametrization):
def sample(self, rng: Generator, shape: Optional[Shape] = None) -> Array:
raise NotImplementedError
| 22.230769 | 77 | 0.754325 | [
"MIT"
] | NeilGirdhar/efax | efax/_src/samplable.py | 289 | Python |
from equinox.models import Model,cleanup
import glm
from random import random
from .glutils import bindIndicesToBuffer, storeDataInVBO,createVAO,unbindVAO
class Terrain(Model):
def __init__(self, n_vertex):
self.vertices = (
-1.0, 0.0, 1.0,
-1.0, 0.0, -1.0,
1.... | 17.735294 | 76 | 0.434494 | [
"MIT"
] | ProfAndreaPollini/equinox | equinox/models/terrain.py | 603 | Python |
from datetime import datetime
import itertools
import os
import random
import string
from _signal import SIGINT
from contextlib import contextmanager
from functools import partial
from itertools import permutations, combinations
from shutil import copyfile
from sys import executable
from time import sleep, perf_counter... | 36.212698 | 120 | 0.649215 | [
"Apache-2.0"
] | AYCH-Inc/aych.hyper.tolerant | plenum/test/helper.py | 57,035 | Python |
# !/usr/bin/env python2
from math import pi, cos, sin, atan2, acos, sqrt, pow, radians, asin
from math_calc import *
from service_router import readPos
class LegConsts(object):
''' Class object to store characteristics of each leg '''
def __init__(self, x_off, y_off, z_off, ang_off, leg_nr):
self.x_of... | 47.048048 | 203 | 0.547456 | [
"MIT"
] | JevgenijsGalaktionovs/AntBot | dns_main/src/kinematics.py | 15,667 | Python |
from PIL import Image
import tempfile
import cv2
import imutils
import numpy as np
def set_image_dpi_ppi(file_path):
im = Image.open(file_path)
length_x, width_y = im.size
factor = float(length_x/width_y)
size = int(600), int(600/factor)
im_resized = im.resize(size, Image.ANTIALIAS)
temp_file =... | 36.347368 | 93 | 0.663481 | [
"MIT"
] | tonthatnam/japanese_ocr | tess/utilities/image_process.py | 3,453 | Python |
'''
Module containing python objects matching the ESGF database tables.
'''
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey
from sqlalchemy.orm import relationship
Base = declarative_base()
ROLE_USER = 'user'
ROLE_PUBLISHER = 'publisher'
ROL... | 30.7625 | 91 | 0.697278 | [
"BSD-3-Clause"
] | ESGF/COG | cog/plugins/esgf/objects.py | 2,461 | Python |
from classes.fixed_scheduler import FixedScheduler
from classes.concretes.sql_mixin import SqlMixin
from sqlalchemy import Column, create_engine, Table
from sqlalchemy.types import Float
from sqlalchemy.orm import registry, Session
import attr
registry = registry()
@registry.mapped
@attr.s(auto_attribs=True)
class M... | 26.333333 | 67 | 0.704641 | [
"MIT"
] | LiteralGenie/AutomateStuff | fancytimers/tests/sanity.py | 948 | Python |
import logging
from typing import Iterable, Mapping, Optional, Union
import gym
import numpy as np
import torch as th
from stable_baselines3.common import on_policy_algorithm, vec_env
from imitation.data import types
from imitation.rewards import discrim_nets
from imitation.algorithms.adversarial import AdversarialT... | 28.963636 | 90 | 0.662272 | [
"MIT"
] | aj96/InfoGAIL | cnn_modules/cnn_gail.py | 1,593 | Python |
# -*- coding: utf-8 -*-
#
# Review Heatmap Add-on for Anki
# Copyright (C) 2016-2019 Glutanimate <https://glutanimate.com>
#
# This file was automatically generated by Anki Add-on Builder v0.1.4
# It is subject to the same licensing terms as the rest of the program
# (see the LICENSE file which accompanies this progra... | 22.608696 | 70 | 0.709615 | [
"MIT"
] | kb1900/Anki-Addons | review_heatmap/gui/forms/anki21/__init__.py | 520 | Python |
""" Orlov Module : workspace module fixture. """
import os
import logging
import pytest
from orlov.libs.workspace import Workspace
logger = logging.getLogger(__name__)
@pytest.fixture(scope='session')
def workspace(request) -> Workspace:
""" Workspace Factory Fixture.
Yields:
directory(Workspace): ... | 27.4 | 68 | 0.678832 | [
"MIT"
] | coppelia517/orlov | orlov/libs/workspace/fixture.py | 822 | Python |
import dask
import dask.array as da
import numpy as np
import numpy.testing as npt
import pytest
import sklearn
import sklearn.linear_model
import sklearn.metrics
from dask.array.utils import assert_eq
import dask_ml.metrics
import dask_ml.wrappers
def test_pairwise_distances(X_blobs):
centers = X_blobs[::100].c... | 31.141243 | 88 | 0.662917 | [
"BSD-3-Clause"
] | Alilarian/dask-ml | tests/metrics/test_metrics.py | 5,512 | Python |
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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 ... | 45.805383 | 153 | 0.557991 | [
"Apache-2.0"
] | rajputakhil/ludwig | ludwig/models/modules/recurrent_modules.py | 22,124 | Python |
# 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 *
class RCheckmate(RPackage):
"""Tests and assertions to perform frequent argument checks.
A s... | 41.434783 | 95 | 0.735572 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 0t1s1/spack | var/spack/repos/builtin/packages/r-checkmate/package.py | 953 | Python |
import os
import torch
import os
import random
from torch.nn import(
Module,Linear,LayerNorm
)
import math
from .AutoEncoder import Encoder
class DeltaT(Module):
def __init__(self):
super().__init__()
self.reset_seed()
self.elem = math.prod(Encoder().output_size)
self.input_size... | 27.26087 | 52 | 0.605263 | [
"MIT"
] | Geson-anko/JARVIS3 | _Sensation0/DeltaTime.py | 1,254 | Python |
# Time: O(k * log(min(n, m, k))), where n is the size of num1, and m is the size of num2.
# Space: O(min(n, m, k))
# You are given two integer arrays nums1
# and nums2 sorted in ascending order and an integer k.
#
# Define a pair (u,v) which consists of one element
# from the first array and one element from the seco... | 27.54321 | 90 | 0.53922 | [
"MIT"
] | RideGreg/LeetCode | Python/find-k-pairs-with-smallest-sums.py | 2,231 | Python |
"""
Gets concordance for keywords and groups by word.
"""
from defoe import query_utils
from defoe.alto.query_utils import get_page_matches
def do_query(archives, config_file=None, logger=None, context=None):
"""
Gets concordance for keywords and groups by word.
config_file must be the path to a configu... | 31 | 75 | 0.547686 | [
"MIT"
] | kallewesterling/defoe | defoe/alto/queries/keyword_concordance_by_word.py | 2,852 | Python |
"""
Demonstrate differences between __str__() and __reper__().
"""
class neither:
pass
class stronly:
def __str__(self):
return "STR"
class repronly:
def __repr__(self):
return "REPR"
class both(stronly, repronly):
pass
class Person:
def __init__(self, name, age):
... | 18.961538 | 59 | 0.600406 | [
"MIT"
] | ceeblet/OST_PythonCertificationTrack | Python3/Python3_Lesson09/src/reprmagic.py | 493 | Python |
#!/usr/bin/env python3
"""
"""
import socket
device_ca_server_prefix = f'{socket.gethostname()}_dio_controller:'
from caproto.threading.client import Context
ctx = Context()
ca_name = device_ca_server_prefix
pv_names = ['dio',
'bit0_indicator',
'bit0',
'b... | 23.677419 | 68 | 0.491826 | [
"BSD-3-Clause"
] | vstadnytskyi/icarus-nmr | icarus_nmr/scripts/digital_controller_terminal_client.py | 734 | Python |
from flask import Flask, render_template, request, redirect
from flask import render_template
app = Flask(__name__)
@app.route('/hello/')
@app.route('/hello/<name>')
def hello(name=None):
return render_template('hello.html', name=name)
from flask import Flask,request,render_template,redirect
# 绑定访问地址127.0.0.1... | 24.235294 | 65 | 0.654126 | [
"MIT"
] | archfool/NLP | demo_flask.py | 836 | Python |
#
# io_fits.py -- Module wrapper for loading FITS files.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
"""
There are two possible choices for a python FITS file readi... | 30.494662 | 95 | 0.566227 | [
"BSD-3-Clause"
] | Rbeaty88/ginga | ginga/util/io_fits.py | 8,569 | Python |
#!/usr/bin/python
#
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: onyx_qos
author: "Anas Badaha (@anasb)"
short_description:... | 39.844828 | 115 | 0.682172 | [
"MIT"
] | DiptoChakrabarty/nexus | venv/lib/python3.7/site-packages/ansible_collections/mellanox/onyx/plugins/modules/onyx_qos.py | 9,244 | Python |
from abstractclasses import solver, solver_model
"""
The Nash equilibrium solver takes a payoff matrix from game theory,
then it solves for a nash equilibrium, if one exists.
"""
# ————————————————————————————————————————————————
# NASH EQUILIBRIUM SOLVER CLASS
# ————————————————————————————————————————————————
cl... | 35.006623 | 79 | 0.404748 | [
"MIT"
] | benedictvs/FOCS-Calculator | modules/nashequilibrium.py | 10,956 | Python |
"""Describe overall framework configuration."""
import os
import pytest
from kubernetes.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION
from settings import (
DEFAULT_IMAGE,
DEFAULT_PULL_POLICY,
DEFAULT_IC_TYPE,
DEFAULT_SERVICE,
DEFAULT_DEPLOYMENT_TYPE,
NUM_REPLICAS,
BATCH_START,
... | 32.091463 | 123 | 0.620179 | [
"Apache-2.0"
] | 84flix/kubernetes-ingress | tests/conftest.py | 5,263 | Python |
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
from dailymed.models import Set, Spl, InactiveIngredient
from dailymed.serializers import SplSerializer
import json
from pathlib import Path
SPL_URL = reverse('spl-list')
PR... | 33.478788 | 78 | 0.589971 | [
"MIT"
] | coderxio/dailymed-api | api/dailymed/tests/test_api.py | 5,524 | Python |
import os
os.chdir("./export")
from reader.csv_mod import CsvReader
from reader.sarif_mod import SarifReader
from reader.server_mod import RestfulReader
from export.export import Exporter
def generate(args):
project_name = args.name
sarif_list = args.sarif
if sarif_list == None:
sarif_list = ... | 23.157895 | 54 | 0.681818 | [
"MIT"
] | Heersin/codeql_packer | codql-report/generator.py | 1,320 | Python |
# Copyright (c) 2020 PaddlePaddle 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 app... | 42.785714 | 148 | 0.497663 | [
"Apache-2.0"
] | wangna11BD/Paddle | python/paddle/nn/functional/extension.py | 5,990 | Python |
# -*- coding: utf-8 -*-
# @Time : 2021/6/10
# @Author : kaka
import argparse
import logging
import os
from config import Params
from datasets import load_dataset
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import AutoTokenizer
impor... | 38.35 | 124 | 0.651673 | [
"Apache-2.0"
] | Macielyoung/sentence_representation_matching | simcse/train_unsup.py | 4,614 | Python |
from mgt.datamanagers.remi.dictionary_generator import DictionaryGenerator
from mgt.models.transformer_model import TransformerModel
"""
Example showing how to save and load a model.
"""
dictionary = DictionaryGenerator.create_dictionary();
model = TransformerModel(dictionary)
model.save_checkpoint("test_model")
mode... | 31 | 74 | 0.833333 | [
"MIT"
] | wingedsheep/music-generation-toolbox | example/save_and_load_model.py | 372 | Python |
#---------------------------------------------------------------
# ALGORITHM DEMO : TOPLOGICAL SORT
#---------------------------------------------------------------
# Topological Sort is a algorithm can find "ordering" on an "order dependency" graph
# Concept
# https://blog.techbridge.cc/2020/05/10/leetcode-topologica... | 30.322222 | 146 | 0.563576 | [
"Unlicense"
] | yennanliu/Python_basics | algorithm/python/topological_sort.py | 10,916 | Python |
#
# CSS
#
PIPELINE_CSS = {
'search': {
'source_filenames': (
'crashstats/css/lib/flatpickr.dark.min.css',
'supersearch/css/search.less',
),
'output_filename': 'css/search.min.css',
},
'select2': {
'source_filenames': (
'crashstats/js/lib/s... | 30.81448 | 75 | 0.544347 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Krispy2009/socorro | webapp-django/crashstats/settings/bundles.py | 13,620 | Python |
import random
import torch
from torch.utils.tensorboard import SummaryWriter
from flowtron_plotting_utils import plot_alignment_to_numpy
from flowtron_plotting_utils import plot_gate_outputs_to_numpy
class FlowtronLogger(SummaryWriter):
def __init__(self, logdir):
super(FlowtronLogger, self).__init__(logd... | 39.179487 | 76 | 0.630236 | [
"Apache-2.0"
] | hit-thusz-RookieCJ/MyFLowtron | flowtron_logger.py | 1,548 | Python |
# Copyright (C) 2021, Mindee.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
import pytest
import numpy as np
from scipy.optimize import linear_sum_assignment
from doctr.utils.metrics import box_iou
@p... | 39.466667 | 98 | 0.714527 | [
"Apache-2.0"
] | fmobrj/doctr | api/tests/routes/test_detection.py | 1,184 | Python |
from .eLABJournalObject import *
import json
import pandas as pd
import numbers
class SampleSerie(eLABJournalObject):
def __init__(self, api, data):
"""
Internal use only: initialize sample serie
"""
if ((data is not None) & (type(data) == dict) &
("name" in ... | 32.888889 | 94 | 0.538514 | [
"Apache-2.0"
] | matthijsbrouwer/elabjournal-python | elabjournal/elabjournal/SampleSerie.py | 1,480 | Python |
#!/usr/bin/env python
"""
Axis camera video driver. Inspired by:
https://code.ros.org/svn/wg-ros-pkg/branches/trunk_cturtle/sandbox/axis_camera/axis.py
Communication with the camera is done using the Axis VAPIX API described at
http://www.axis.com/global/en/support/developer-support/vapix
.. note::
This is a ma... | 42.135177 | 120 | 0.653737 | [
"BSD-3-Clause"
] | MarcoStb1993/axis_camera | nodes/axis.py | 27,430 | Python |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CakeGallery.created'
db.add_column(u'cakegallery_cakegallery', 'created',
... | 75.920635 | 188 | 0.57234 | [
"BSD-3-Clause"
] | TorinAsakura/cooking | povary/apps/cakegallery/migrations/0014_auto__add_field_cakegallery_created__add_field_cakegallery_updated.py | 9,566 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-24 05:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('utils', '0011_auto_20160822_1127'),
]
operations = ... | 30.7 | 145 | 0.605863 | [
"Apache-2.0"
] | Upande/MaMaSe | apps/utils/migrations/0012_auto_20160824_0543.py | 921 | Python |
import time
import pytest
from tools import utils, constants
PARAMS = ['--connections', '500']
# TODO parameterize test
@pytest.mark.baker
@pytest.mark.multinode
@pytest.mark.slow
@pytest.mark.incremental
class TestManyBakers:
"""Run 5 bakers and num nodes, wait and check logs"""
def test_init(self, sandb... | 24.828571 | 60 | 0.638665 | [
"MIT"
] | blockchain-analysis-study/my-tezos | tests_python/tests/test_many_bakers.py | 869 | Python |
"""
Telnet server.
Example usage::
class MyTelnetApplication(TelnetApplication):
def client_connected(self, telnet_connection):
# Set CLI with simple prompt.
telnet_connection.set_application(
telnet_connection.create_prompt_application(...))
def... | 32.598039 | 98 | 0.60015 | [
"BSD-3-Clause"
] | sainjusajan/django-oscar | oscar/lib/python2.7/site-packages/prompt_toolkit/contrib/telnet/server.py | 13,300 | Python |
# model settings
model = dict(
type='CenterNet',
pretrained='modelzoo://resnet18',
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_eval=False,
add_summay_every_n_step=200,
style='pytorch'),
... | 30.126866 | 87 | 0.628685 | [
"Apache-2.0"
] | mrsempress/mmdetection | configs/centernext/paper_cxt18_Ro16_3lr_wd4e4_hm2wh1_s123_nos_2x.py | 4,037 | Python |
#!/usr/bin/env python
"""
This now uses the imshow command instead of pcolor which *is much
faster*
"""
from __future__ import division, print_function
import numpy as np
from matplotlib.pyplot import *
from matplotlib.collections import LineCollection
import matplotlib.cbook as cbook
# I use if 1 to break up the di... | 26.037975 | 71 | 0.618376 | [
"MIT",
"BSD-3-Clause"
] | epgauss/matplotlib | examples/pylab_examples/mri_with_eeg.py | 2,057 | Python |
import pandas as pd
kraken_rank_dictionary = {
'P': 'phylum',
'C': 'class',
'O': 'order',
'F': 'family',
'G': 'genus',
'S': 'species'
}
greengenes_rank_dict = {
'k__': 'kingdom',
'p__': 'phylum',
'c__': 'class',
'o__': 'order',
'f__': 'family',
'g__': 'genus',
's__'... | 33.863014 | 78 | 0.642799 | [
"MIT"
] | qiyunzhu/taxa-assign-benchmarking | benchutils/transformers.py | 2,472 | Python |
from .randt import RandomizationTools
def setup(bot):
bot.add_cog(RandomizationTools(bot))
| 16.166667 | 40 | 0.773196 | [
"MIT"
] | Simonx22/FalcomBot-cogs | randt/__init__.py | 97 | Python |
"""empty message
Revision ID: f6d196dc5629
Revises: fd5076041bff
Create Date: 2019-04-06 22:25:32.133764
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f6d196dc5629'
down_revision = 'fd5076041bff'
branch_labels = None
depends_on = None
def upgrade():
# ... | 24.16129 | 75 | 0.688919 | [
"MIT"
] | YA-androidapp/vuejs-flask-docker | services/backend/migrations/versions/f6d196dc5629_.py | 749 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
TODO:
* needs to check if required modules are installed (or prefereably developed)
* needs to be able to ignore plugins that the user doesnt care about
Super Setup
PREREQ:
git config --global push.default current
export CODE_DIR=~/code
mkdir $CODE_DIR
cd $CODE... | 34.715412 | 166 | 0.604485 | [
"Apache-2.0"
] | brmscheiner/ibeis | super_setup.py | 48,428 | Python |
#!/usr/bin/env python3
# Software Name: ngsildclient
# SPDX-FileCopyrightText: Copyright (c) 2021 Orange
# SPDX-License-Identifier: Apache 2.0
#
# This software is distributed under the Apache 2.0;
# see the NOTICE file for more details.
#
# Author: Fabien BATTELLO <fabien.battello@orange.com> et al.
# SPDX-License-Id... | 28.108108 | 83 | 0.721154 | [
"Apache-2.0"
] | Orange-OpenSource/python-orion-client | tests/test_client.py | 1,040 | Python |
async def m001_initial(db):
"""
Initial wallet table.
"""
await db.execute(
"""
CREATE TABLE IF NOT EXISTS charges (
id TEXT NOT NULL PRIMARY KEY,
user TEXT,
description TEXT,
onchainwallet TEXT,
onchainaddress TEXT,
... | 25.518519 | 72 | 0.510885 | [
"MIT"
] | bliotti/lnbits | lnbits/extensions/satspay/migrations.py | 689 | Python |
#!flask/bin/python
from app import app
from config import DEBUG_MODE
if __name__ == '__main__':
app.run(debug=DEBUG_MODE)
| 16 | 29 | 0.742188 | [
"MIT"
] | siketh/TRBlog | run.py | 128 | Python |
#pylint: skip-file
from setuptools import setup, find_packages
from pypandoc import convert
def convert_md(filename):
return convert(filename, 'rst')
setup(name='nonstandard',
version='0.9.3',
description="Obsolete; see package *experimental*.",
long_description = convert_md('README.md'),
classi... | 29.192308 | 63 | 0.661397 | [
"MIT"
] | aroberge/nonstandard | setup.py | 760 | Python |
from django import template
from django.db import models
register = template.Library()
try:
''.rsplit
def rsplit(s, delim, maxsplit):
return s.rsplit(delim, maxsplit)
except AttributeError:
def rsplit(s, delim, maxsplit):
"""
Return a list of the words of the string s, scanning s
... | 37.931507 | 107 | 0.611051 | [
"BSD-3-Clause"
] | dokterbob/satchmo | satchmo/apps/satchmo_store/shop/templatetags/satchmo_adminapplist.py | 2,769 | Python |
# Copyright (c) 2010-2019 openpyxl
import pytest
from io import BytesIO
from zipfile import ZipFile
from openpyxl.packaging.manifest import Manifest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
from .test_fields import (
Index,
Number,
Text,
)
@py... | 23.814159 | 92 | 0.528056 | [
"MIT"
] | albertqee/openpyxl-3.x | openpyxl/pivot/tests/test_record.py | 2,691 | Python |
## Calculate feature importance, but focus on "meta-features" which are categorized by
## rules from different perspectives: orders, directions, powers.
## for "comprehensive methods"
from util_relaimpo import *
from util_ca import *
from util import loadNpy
def mainCA(x_name, y_name, divided_by = "", feature_names... | 37.546875 | 92 | 0.651685 | [
"MIT"
] | terryli710/MPS_regression | feature_importance_v4.py | 2,403 | Python |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 71.495935 | 301 | 0.712702 | [
"MIT"
] | AndrewLane/azure-cli | src/command_modules/azure-cli-acr/azure/cli/command_modules/acr/_params.py | 17,588 | Python |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 35.711538 | 79 | 0.661282 | [
"MIT"
] | keathmilligan/flask-jwt-refresh | docs/conf.py | 1,857 | Python |
print("Enter 1st number")
n1 = input()
print("Enter 2nd number")
n2 = input()
print("Sum of Both = ", int(n1) + int(n2))
print("Sum of Both = ", int(n1) + int(n2)) | 23.428571 | 42 | 0.609756 | [
"MIT"
] | codewithsandy/Python-Basic-Exp | 03 Variable/cal.py | 164 | Python |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from blueapps.account import views
app_name = 'account'
urlpatterns = [
url(r'^login_success/$', views.login_success, name="login_success"),
url(r'^login_page/$', views.login_page, name="login_page"),
url(r'^send_code/$', views.send_code_view, name... | 25.846154 | 72 | 0.693452 | [
"MIT"
] | wangzishuo111/bk_prometheus | blueapps/account/urls.py | 336 | Python |
# -*- coding: utf-8 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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 ... | 32.4 | 105 | 0.663237 | [
"Apache-2.0"
] | trib3/xhtml2pdf | xhtml2pdf/turbogears.py | 1,458 | Python |
#!/usr/bin/env python
# Copyright 2015 Coursera
#
# 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 ag... | 33.208333 | 78 | 0.658971 | [
"Apache-2.0"
] | andres-zartab/courseraprogramming | courseraprogramming/commands/config.py | 3,985 | Python |
#-*-coding:utf-8-*-
import numpy as np
import cv2
import gc
from tqdm import tqdm
def watershed(opencv_image):
top_n_label = 2
gray = cv2.cvtColor(opencv_image, cv2.COLOR_BGR2GRAY)
print('convert gray end')
gray[gray == 0] = 255
_, cvt_img = cv2.threshold(gray, 225, 255, cv2.THRESH_BINARY_INV)
... | 21.446809 | 88 | 0.641865 | [
"MIT"
] | essential2189/Cell-Based-Model | preprocess/watershed.py | 1,008 | Python |
import torch
import torch.nn.functional as F
def spatial_argmax(logit):
weights = F.softmax(logit.view(logit.size(0), -1), dim=-1).view_as(logit)
return torch.stack(((weights.sum(1) * torch.linspace(-1, 1, logit.size(2)).to(logit.device)[None]).sum(1),
(weights.sum(2) * torch.linspace(-... | 38.874074 | 120 | 0.59013 | [
"MIT"
] | aljubrmj/CS342-Final-Project | planner/regressor/models.py | 5,248 | Python |
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
import chat.routing
application = ProtocolTypeRouter({
# Empty for now (http->django views is added by default)
'websocket': AuthMiddlewareStack(
URLRouter(
chat.routing.websocket_urlpa... | 26.615385 | 60 | 0.722543 | [
"MIT"
] | aanu1143/chat-app | chat_app/routing.py | 346 | Python |
config = {
"interfaces": {
"google.monitoring.v3.NotificationChannelService": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": []
},
"retry_params": {
"default": {
... | 38.847458 | 67 | 0.442845 | [
"Apache-2.0"
] | Random-Trees/google-cloud-python | monitoring/google/cloud/monitoring_v3/gapic/notification_channel_service_client_config.py | 2,292 | 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... | 38.05618 | 110 | 0.708001 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 312day/airflow | tests/providers/amazon/aws/hooks/test_cloud_formation.py | 3,387 | Python |
"""sls.py
An implementation of the robust adaptive controller.
Both FIR SLS version with CVXPY and the common
Lyapunov relaxation.
"""
import numpy as np
import cvxpy as cvx
import utils
import logging
import math
import scipy.linalg
from abc import ABC, abstractmethod
from adaptive import AdaptiveMethod
class ... | 33.166176 | 207 | 0.579479 | [
"MIT"
] | DuttaAbhigyan/robust-adaptive-lqr | python/sls.py | 22,553 | Python |
# partesanato/__init__.py
| 13.5 | 26 | 0.777778 | [
"MIT"
] | edgarbs1998/partesanato-server | src/partesanato/__init__.py | 27 | Python |
from .__main__ import *
| 12.5 | 24 | 0.72 | [
"MIT"
] | kokonut27/Vyxal | vyxal/__init__.py | 25 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... | 31.52518 | 99 | 0.583752 | [
"MIT"
] | 777-project/777 | contrib/seeds/generate-seeds.py | 4,382 | Python |
"""
Handles creation of genomes, either from scratch or by sexual or
asexual reproduction from parents.
"""
from __future__ import division
import math
import random
from itertools import count
from neat.config import ConfigParameter, DefaultClassConfig
from neat.math_util import mean
from neat.six_util import iterit... | 43.598958 | 115 | 0.632899 | [
"Apache-2.0"
] | Osrip/Novelty_criticality_PyTorch-NEAT | neat_local/reproduction.py | 8,371 | Python |
import logging
from functools import reduce
from typing import Text, Set, Dict, Optional, List, Union, Any
import os
import rasa.shared.data
import rasa.shared.utils.io
from rasa.shared.core.domain import Domain
from rasa.shared.importers.importer import TrainingDataImporter
from rasa.shared.importers import utils
fro... | 38.549505 | 88 | 0.651856 | [
"Apache-2.0"
] | mukulbalodi/rasa | rasa/shared/importers/multi_project.py | 7,787 | Python |
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009-2018 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from __future__ import absolute_import, division... | 35.005355 | 88 | 0.575548 | [
"BSD-3-Clause"
] | JHP4911/jsonpickle | jsonpickle/pickler.py | 26,149 | Python |
import os
import numpy as np
import tensorflow as tf
from utils.data_reader import H5DataLoader, H53DDataLoader
from utils.img_utils import imsave
from utils import ops
"""
This module builds a standard U-NET for semantic segmentation.
If want VAE using pixelDCL, please visit this code:
https://github.com/HongyangGao... | 42.606061 | 79 | 0.585744 | [
"MIT"
] | HongyangGao/DilatedPixelCNN | network.py | 12,654 | Python |
#!/usr/bin/python
script = r"""
MD Dir1
MD Dir1\Dir2
CD Dir1\Dir2
MF file2.dat
MD Dir3
CD Dir3
MF file3.dat
MD Dir4
CD Dir4
MF file4.dat
MD Dir5
CD Dir5
MF file5.dat
CD C:
DELTREE Dir1
MD Dir2
CD Dir2
MF a.txt
MF b.txt
CD C:
MD Dir3
COPY Dir2 Dir3
"""
expected = r"""
C:
|_DIR2
| |_a.txt
| |_b.txt
|
|_DIR3
|_... | 8.955556 | 26 | 0.635236 | [
"BSD-2-Clause"
] | artemkin/sandbox | fme/tests/test_deltree_copy.py | 403 | 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... | 37.957746 | 79 | 0.601299 | [
"Apache-2.0"
] | CortexFoundation/tvm-cvm | topi/python/topi/cuda/conv2d_hwcn.py | 5,390 | Python |
#!/usr/bin/env 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 __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import b... | 33.531599 | 80 | 0.546804 | [
"MIT"
] | gdawg/redex | tools/python/dex.py | 137,949 | Python |
#!/usr/bin/env python
"""Tests for `calvestbr` package."""
import unittest
from calvestbr import calvestbr
class TestCalvestbr(unittest.TestCase):
"""Tests for `calvestbr` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"""Tear down test fixtures,... | 18.045455 | 46 | 0.632242 | [
"MIT"
] | IsaacHiguchi/calvestbr | tests/test_calvestbr.py | 397 | Python |
# Copyright 2018 Samuel Payne sam_payne@byu.edu
# 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 ... | 38.894988 | 241 | 0.666196 | [
"Apache-2.0"
] | PayneLab/cptac | cptac/pancan/file_download.py | 16,297 | Python |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox(capabilities={"marionette": Fa... | 30.470588 | 138 | 0.619691 | [
"Apache-2.0"
] | oksanacps/python_for_testing | fixture/application.py | 1,036 | Python |
from django.urls import path
from . import views
app_name = "chat"
urlpatterns = [
path('', views.home, name='home'),
path('post/', views.post, name='post'),
path('messages/', views.messages, name='messages'),
path('upload/', views.upload, name='views.upload'),
]
| 23.5 | 55 | 0.641844 | [
"MIT"
] | MdIbu/ibu_chat | chat/urls.py | 282 | Python |
#!/usr/bin/env python
import os
import logging
import requests
import json
import configparser
import sys
import time
import re
from os.path import dirname
from config import (
instanceA_url, instanceA_key, instanceA_path, instanceA_profile,
instanceA_profile_id, instanceA_profile_filter, instanceA_profile_f... | 46.085657 | 515 | 0.684504 | [
"MIT"
] | markschrik/syncarr | index.py | 23,135 | Python |
import logging
import os
import queue
import requests
import time
from threading import Thread
cri_sock = os.getenv("KIP_CRI_SOCK", "unix:///var/run/containerd/containerd.sock")
cri_client = os.getenv("KIP_CRI_CLI", False)
gateway_host = os.getenv("KIP_GATEWAY_HOST", "http://localhost:8888")
num_pullers = int(os.ge... | 37.057018 | 120 | 0.640549 | [
"BSD-3-Clause"
] | dummys/kernel-image-puller | kernel_image_puller.py | 8,449 | Python |
import socket
import timeit
import numpy as np
from PIL import Image
from datetime import datetime
import os
import sys
from collections import OrderedDict
sys.path.append('./')
# PyTorch includes
import torch
from torch.autograd import Variable
from torchvision import transforms
import cv2
# Custom includes
from net... | 36.417431 | 181 | 0.623504 | [
"MIT"
] | ericwang0701/Graphonomy | exp/inference/inference_dir.py | 7,939 | Python |
#
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | 47.822742 | 150 | 0.699979 | [
"MIT"
] | AetherUnbound/airbyte | airbyte-integrations/connectors/source-slack/source_slack/source.py | 14,299 | Python |
class Solution:
def isAlienSorted(self, words: List[str], order: str) -> bool:
if len(words) <= 1:
return True
self.dic = {}
for i, char in enumerate(order):
self.dic[char] = i
for i in range(1, len(words)):
if self.cmp(words[i], words[i-1]) == -1:... | 31.5 | 66 | 0.478836 | [
"MIT"
] | QinganZhao/LXXtCode | LeetCode/953. Verifying an Alien Dictionary.py | 756 | Python |
# -*- coding: utf-8 -*-
import argparse
import importlib
import json
import logging
import os
import re
import sys
from io import StringIO
import boto3
import tabulate
import yaml
from dask.distributed import Client
from dask_kubernetes import KubeCluster
from kubernetes.client import Configuration
from kubernetes.cli... | 29.314815 | 97 | 0.637271 | [
"MIT"
] | HDI-Project/BTB | benchmark/btb_benchmark/kubernetes.py | 7,915 | Python |
"""
Django settings for webapp2 project.
Generated by 'django-admin startproject' using Django 4.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
from pathlib i... | 25.983871 | 91 | 0.701117 | [
"MIT"
] | ndavilo/webapp2 | webapp2/settings.py | 3,222 | Python |
#!/usr/bin/env python3
# Copyright (c) 2019-2020 The Crown Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run fuzz test targets.
"""
from concurrent.futures import ThreadPoolExecutor, as_completed
import argpar... | 35.053191 | 180 | 0.600202 | [
"MIT"
] | BlockMechanic/crown | test/fuzz/test_runner.py | 9,885 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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, Dict, List, Mapping, Optional, Tuple, Union
from .. import ... | 33.867925 | 200 | 0.688858 | [
"ECL-2.0",
"Apache-2.0"
] | mdop-wh/pulumi-aws | sdk/python/pulumi_aws/rds/get_event_categories.py | 3,590 | Python |
# Copyright 2018, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | 23.902655 | 102 | 0.675676 | [
"Apache-2.0"
] | 4O4/Nuitka | tests/basics/LateClosureAssignment.py | 2,701 | Python |
# SPDX-FileCopyrightText: Copyright (c) 2021 Martin Stephens
#
# SPDX-License-Identifier: MIT
"""These tests are run with a sensor connected to confirm that the correct
responses are received from the sensor.
The try - except clauses and an if __name__ == "__main__" allow the code to be
run with pytest on a Raspberry ... | 28.237668 | 92 | 0.697157 | [
"MIT",
"MIT-0",
"Unlicense"
] | BiffoBear/CircuitPython-AS3935 | tests/test_board_responses.py | 6,297 | Python |
import json
from banal import ensure_list
from functools import lru_cache
from pantomime.types import JSON
from requests.exceptions import TooManyRedirects
from opensanctions.core import Dataset
from opensanctions import helpers as h
FORMATS = ["%d %b %Y", "%d %B %Y", "%Y", "%b %Y", "%B %Y"]
SDN = Dataset.require("us... | 36.078125 | 81 | 0.637289 | [
"MIT"
] | pudo/opensanctions | opensanctions/crawlers/us_trade_csl.py | 4,618 | Python |
import argparse
import json
import os
import pandas as pd
import torch
import torch.optim as optim
import torch.nn as nn
import torch.utils.data
# imports the model in model.py by name
from model import BinaryClassifier
def model_fn(model_dir):
"""Load the PyTorch model from the `model_dir` directory."""
prin... | 38.166667 | 110 | 0.657732 | [
"MIT"
] | ngocpc/Project_Plagiarism_Detection | Project_Plagiarism_Detection/source_pytorch/train.py | 6,641 | Python |
#
# Copyright (c) 2021, NVIDIA 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 by applicable law or agreed ... | 37.185185 | 98 | 0.680777 | [
"Apache-2.0"
] | Jwmc999/Transformers4Rec | transformers4rec/tf/block/dlrm.py | 4,016 | Python |
class SqlDataQualityQueries:
establisment_company_relation_check = ("""
-- looks for registration without relation with compay
-- for have a database with full information needs to return total equal to zero (establisment + company)
SELECT count(e.basiccnpj) as total_without_relation from open_data.fact... | 58 | 109 | 0.732759 | [
"MIT"
] | paulo3011/opendatafrombrasil | source/python/airflow/runtime/plugins/helpers/sql_data_quality_queries.py | 464 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.