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 subprocess
if __name__ == "__main__":
for fiber_xposition in range(-5, 6):
command = f"mpirun -np {6} python fiber.py --fiber_xposition={fiber_xposition} > log.log"
print(command)
subprocess.call(command, shell=True)
| 31.625 | 97 | 0.667984 | [
"MIT"
] | joamatab/grating_coupler_meep | grating_coupler_meep/fiber_sweep_fiber_xposition.py | 253 | Python |
from setuptools import setup, find_packages
from codecs import open # To use a consistent encoding
from os import path
import templar
version = templar.__version__
dependencies = [
'jinja2==2.8',
]
setup(
name='templar',
version=version,
description='A static templating engine written in Python',
... | 28.275 | 63 | 0.633068 | [
"MIT"
] | Cal-CS-61A-Staff/templar | setup.py | 1,131 | Python |
# coding=utf-8
from src.tk import TK
import argparse
parser = argparse.ArgumentParser()
parser.register('type', 'bool', (lambda x: x.lower() in ('True', "yes", "true", "t", "1")))
parser.add_argument('--mode', default='main', help='')
args = parser.parse_args()
if args.mode == 'main':
window = TK()
window.st... | 21.333333 | 91 | 0.586914 | [
"Apache-2.0"
] | a892574222/game | main.py | 1,024 | 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, Mapping, Optional, Sequence, Union, overload
from .. import... | 39.086364 | 198 | 0.671822 | [
"ECL-2.0",
"Apache-2.0"
] | RafalSumislawski/pulumi-aws | sdk/python/pulumi_aws/elasticloadbalancingv2/get_listener.py | 8,599 | Python |
# modmerger framework
# by sphere
modmerger_version = 201
# Note: the following is from Warband 1.127 module system.
from modmerger_options import *
# list of current module components
# not in use atm
mod_components = [
"animations",
"constants",
"dialogs",
"factions",
"game_m... | 29.577889 | 136 | 0.663099 | [
"MIT"
] | ChroniclesStudio/money-and-honour | src/modmerger_header.py | 5,886 | Python |
#!/usr/bin/env python3
import json
import argparse
import datetime
class TicketManager:
ticketfile = '/Users/ben/ticketing/tickets.json'
def __init__(self: object, ticketfile: str='/Users/ben/Google Drive/code/ticketing/tickets.json')->object:
self.ticketfille = ticketfile
self.read_tickets(... | 35.23913 | 110 | 0.588834 | [
"MIT"
] | benhg/work-tickets | worktickets.py | 3,242 | Python |
import pandas as pd
import datetime as dt
import smtplib as st
import random as rd
FROM = "pythonsender633@gmail.com"
PASSWORD = "1234abc()"
SUBJECT = "Happy birthday!"
LETTERS = [1, 2, 3]
PLACEHOLDER = "[NAME]"
PATH = "birthdays.csv"
C_NAME = "name"
C_EMAIL = "email"
C_YEAR = "year"
C_MONTH = "month"
C_DAY = "day"
... | 25.636364 | 80 | 0.617908 | [
"MIT"
] | YosafatM/100-days-of-Python | Intermedio Avanzado/32 Felicitaciones/main.py | 1,128 | Python |
from datetime import datetime
import unittest
from unittest.mock import MagicMock
import numpy as np
from pyhsi.cameras import BaslerCamera
class MockGrab:
def __init__(self, data):
self.Array = data
def GrabSucceeded(self):
return True
def Release(self):
pass
class TestBasle... | 30.62963 | 78 | 0.603386 | [
"MIT"
] | rddunphy/pyHSI | test/test_cameras.py | 1,654 | Python |
import torch
from torch import nn, Tensor
from typing import Union, Tuple, List, Iterable, Dict
from ..SentenceTransformer import SentenceTransformer
import logging
class TripleSoftmaxLoss(nn.Module):
def __init__(self,
model: SentenceTransformer,
sentence_embedding_dimension: int... | 43.258065 | 121 | 0.670022 | [
"Apache-2.0"
] | jaimeenahn/COVID-sentence-bert | sentence_transformers/losses/TripleSoftmaxLoss.py | 2,702 | Python |
import string
from flask import Blueprint
from flask import abort
from flask import redirect
from flask import render_template
from meerkat import utils
from meerkat.db import DataAccess
page = Blueprint('simple', __name__)
@page.route('/simple/')
def simple_index():
links = DataAccess.get_libs(... | 26.763158 | 77 | 0.679449 | [
"MIT"
] | by46/meerkat | meerkat/views/simple.py | 1,017 | Python |
re.VERBOSE | 10 | 10 | 0.9 | [
"BSD-3-Clause"
] | kuanpern/jupyterlab-snippets-multimenus | example_snippets/multimenus_snippets/NewSnippets/Python/Regular expressions/Compilation flags/Enable verbose REs, for cleaner and more organized code.py | 10 | Python |
import socket
import random
import os
import requests
import re
import github
import minecraft
import string
import sys
HOST = "irc.libera.chat"
PORT = 6667
NICK = "DoveBot"
#PASSWORD = os.getenv("PASSWORD")
CHANNEL = "#dovegaming"
SERVER = ""
readbuffer = ""
def send(message):
s.send(message)
print(message)
s ... | 60.615385 | 190 | 0.612183 | [
"MIT"
] | dovegaming/dovenetwork | runtime/bots/irc/main.py | 3,940 | 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, Mapping, Optional, Sequence, Union
from . import _utilities... | 39.88125 | 238 | 0.667137 | [
"ECL-2.0",
"Apache-2.0"
] | elad-snyk/pulumi-aws | sdk/python/pulumi_aws/get_ami_ids.py | 6,381 | Python |
# header files
import torch
import torch.nn as nn
import torchvision
import numpy as np
# define network (remember input size: (224 x 224 x 3))
class DenseNet_121(torch.nn.Module):
# define dense block
def dense_block(self, input_channels):
return torch.nn.Sequential(
torch.nn.Conv2d(... | 37.582707 | 83 | 0.577873 | [
"MIT"
] | arp95/cnn_architectures_image_classification | models/densenet121.py | 9,997 | Python |
"""Illustrates a method to intercept changes on objects, turning
an UPDATE statement on a single row into an INSERT statement, so that a new
row is inserted with the new data, keeping the old row intact.
This example adds a numerical version_id to the Versioned class as well
as the ability to see which row is the most... | 26.322034 | 78 | 0.683408 | [
"MIT"
] | 418sec/sqlalchemy | examples/versioned_rows/versioned_rows_w_versionid.py | 4,659 | Python |
import numpy as np
from testbed.cluster_env import LraClusterEnv
from testbed.PolicyGradient_CPO import PolicyGradient
params = {
# 'path': "Dynamic_large_100",
# 'path': "Dynamic_large_100_limit10",
# 'number of containers': 81,
'learning rate': 0.015,
'nodes per group': 3,
... | 47.34728 | 215 | 0.680983 | [
"Apache-2.0"
] | George-RL-based-container-sche/George | testbed/SubScheduler.py | 11,316 | Python |
# Advent of Code 2021 - Day: 24
# Imports (Always imports data based on the folder and file name)
from aocd import data, submit
def solve(lines):
# We need to simply find all the pairs of numbers, i.e. the numbers on lines 6 and 16 and store them.
pairs = [(int(lines[i * 18 + 5][6:]), int(lines[i * 18 + 15][6:])) fo... | 34.409091 | 171 | 0.655218 | [
"Unlicense"
] | Azurealistic/Winter | Solutions/2021/24.py | 1,514 | Python |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# 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... | 35.394649 | 94 | 0.587452 | [
"Apache-2.0"
] | 7338/qiskit-terra | test/python/transpiler/test_mappers.py | 10,583 | Python |
from testutils import assert_raises
try:
b" \xff".decode("ascii")
except UnicodeDecodeError as e:
assert e.start == 3
assert e.end == 4
else:
assert False, "should have thrown UnicodeDecodeError"
assert_raises(UnicodeEncodeError, "¿como estás?".encode, "ascii")
def round_trip(s, encoding="utf-8"):... | 24.238095 | 66 | 0.667976 | [
"MIT"
] | JesterOrNot/RustPython | tests/snippets/encoding.py | 584 | Python |
from ..utils.core import concatenate
class StreamList(list):
"""Class to replace a basic list for streamed products
"""
def __init__(self, product):
if isinstance(product, list):
super(StreamList, self).__init__(product)
else:
super(StreamList, self).__init__([prod... | 28.291667 | 120 | 0.639175 | [
"MIT"
] | guitargeek/geeksw | geeksw/framework/stream.py | 679 | Python |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from python_api.users import models as user_models
from python_api.images import models as image_models
@python_2_unicode_compatible
class Notification(image_models.TimeStampedModel):
TYPE_CHOICES = (
('like', 'Like... | 34.72 | 77 | 0.717742 | [
"MIT"
] | hyecheon/python_api | python_api/notifications/models.py | 868 | Python |
"""
Django settings for django_i18n_example project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
... | 25.219858 | 91 | 0.691507 | [
"MIT"
] | localizely/django_i18n_example | django_i18n_example/settings.py | 3,560 | Python |
#!/usr/bin/python
# coding:utf-8
'''
Created on 2017-04-06
Update on 2017-11-17
Author: Peter/ApacheCN-xy/片刻
GitHub: https://github.com/apachecn/MachineLearning
'''
import sys
from numpy import mat, mean, power
'''
这个mapper文件按行读取所有的输入并创建一组对应的浮点数,然后得到数组的长度并创建NumPy矩阵。
再对所有的值进行平方,最后将均值和平方后的均值发送出去。这些值将用来计算全局的均值... | 26.512195 | 78 | 0.677093 | [
"Apache-2.0"
] | cherisyu/ML_in_Action | ML-in-Action/MachineLearning-dev/src/py3.x/ML/15.BigData_MapReduce/mrMeanMapper.py | 1,737 | Python |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 4 17:07:18 2016
@author: sshank
"""
# Print out the required annotations at the moment... change to put into MySQL
from Bio.Seq import Seq
from Bio import AlignIO
from Bio.SeqRecord import SeqRecord
from argparse import ArgumentParser
parser = ArgumentParser()
rst_he... | 36.2875 | 90 | 0.635549 | [
"MIT"
] | stephenshank/taed-pv | create_pdb_annotations.py | 2,903 | Python |
#!/usr/bin/env python
import os
import torch
from setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CppExtension
cmdclass = {}
cmdclass['build_ext'] = BuildExtension
import setuptools
ext_modules = [
CppExtension(name='torch_blocksparse_cpp_utils',
so... | 30 | 70 | 0.589189 | [
"MIT"
] | akhti/torch-blocksparse | setup.py | 1,110 | Python |
XXXXXXXXX XXXXX
XXXXXX
XXXXXX
XXXXX XXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX XXXXXXX X XXXXX XXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXX... | 26.042386 | 114 | 0.734583 | [
"MIT"
] | dnaextrim/django_adminlte_x | adminlte/static/plugins/datatables/extensions/FixedHeader/examples/simple.html.py | 16,589 | Python |
# Copyright 2012-2021 The Meson development team
# 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... | 49.734289 | 163 | 0.609897 | [
"Apache-2.0"
] | val-verde/python-meson | mesonbuild/interpreter/interpreter.py | 152,734 | Python |
import base64
from .fields import BaseField
class BaseTask(object):
def serialize(self, **result):
return result
class ProxyMixin(BaseTask):
def __init__(self, *args, **kwargs):
self.proxyType = kwargs.pop('proxy_type')
self.userAgent = kwargs.pop('user_agent')
self.proxyAddr... | 31.555556 | 110 | 0.607981 | [
"MIT"
] | uguraba/python-anticaptcha | python_anticaptcha/tasks.py | 5,112 | Python |
# -*- coding: utf-8 -*-
"""
.. _training-example:
Train Your Own Neural Network Potential
=======================================
This example shows how to use TorchANI to train a neural network potential
with the setup identical to NeuroChem. We will use the same configuration as
specified in `inputtrain.ipt`_
.. _... | 39.366071 | 276 | 0.642927 | [
"MIT"
] | isayev/torchani | examples/nnp_training.py | 13,227 | Python |
import pytest
import uqbar.strings
import supriya.patterns
pattern_01 = supriya.patterns.Pn(
supriya.patterns.Pbind(foo=supriya.patterns.Pseq(["A", "B", "C"])), repetitions=2
)
pattern_02 = supriya.patterns.Pn(
supriya.patterns.Pbind(foo=supriya.patterns.Pseq(["A", "B", "C"])),
key="repeat",
repetit... | 20.030303 | 85 | 0.420575 | [
"MIT"
] | butayama/supriya | tests/patterns/test_patterns_Pn.py | 1,983 | Python |
""" A QuoteController Module """
from masonite.controllers import Controller
from masonite.request import Request
from app.Quote import Quote
class QuoteController(Controller):
def __init__(self, request: Request):
self.request = request
def show(self):
id = self.request.param("id")
r... | 26.764706 | 58 | 0.613187 | [
"MIT"
] | code-weather/capstone_backend_tailwindCSS | app/http/controllers/QuoteController.py | 910 | Python |
class Errors:
def __init__(self):
pass
def min_nonetype(self):
pass
| 13.25 | 27 | 0.5 | [
"MIT"
] | bailez/matfin | matfin/utils/utils.py | 106 | Python |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from .chromatic import *
| 26.5 | 57 | 0.641509 | [
"MIT"
] | Jyvol/enterprise_extensions | enterprise_extensions/chromatic/__init__.py | 159 | Python |
"""
Component to interface with various locks that can be controlled remotely.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/lock/
"""
import asyncio
from datetime import timedelta
import functools as ft
import logging
import os
import voluptuous as v... | 28.945652 | 78 | 0.672174 | [
"Apache-2.0"
] | Norien/Home-Assistant | homeassistant/components/lock/__init__.py | 5,326 | Python |
"""
Created on Sun Feb 2 13:28:48 2020
@author: matias
"""
import numpy as np
from numpy.linalg import inv
from matplotlib import pyplot as plt
import time
import camb
from scipy.integrate import cumtrapz as cumtrapz
from scipy.integrate import simps as simps
from scipy.interpolate import interp1d
from scipy.constant... | 28.557692 | 91 | 0.676431 | [
"MIT"
] | matiasleize/tesis_licenciatura | Software/Funcionales/funciones_LambdaCDM_AGN.py | 2,971 | Python |
# mypy: allow-untyped-defs
import subprocess
from functools import partial
from typing import Callable
from mozlog import get_default_logger
from wptserve.utils import isomorphic_decode
logger = None
def vcs(bin_name: str) -> Callable[..., None]:
def inner(command, *args, **kwargs):
global logger
... | 28.735294 | 88 | 0.61259 | [
"BSD-3-Clause"
] | BasixKOR/wpt | tools/wptrunner/wptrunner/vcs.py | 1,954 | Python |
import socket
import struct
import os
PACKET_SIZE = 1024
TIME_OUT = 5
SUCCESS = b'File Has Been Transferred'
def getPayload(fileName):
try:
with open(file=fileName, mode="r+b") as readFile:
payload = readFile.read()
if len(payload) == 0:
print("That is a blank file... | 28.413043 | 132 | 0.596787 | [
"MIT"
] | brendo61-byte/ECE_456 | Labs/Lab_4/Lab_4/client.py | 2,614 | Python |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
import re
from sqlalchemy.orm import validates
from ggrc import db
from ggrc ... | 29.360947 | 78 | 0.654373 | [
"ECL-2.0",
"Apache-2.0"
] | mikecb/ggrc-core | src/ggrc/models/person.py | 4,962 | Python |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | 43.220062 | 89 | 0.676112 | [
"MIT"
] | JustinACoder/H22-GR3-UnrealAI | Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/boosted_trees/python/training/functions/gbdt_batch.py | 55,581 | Python |
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class UpdateIndirectPartnerAccountResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
att... | 27.432432 | 89 | 0.572742 | [
"Apache-2.0"
] | Lencof/huaweicloud-sdk-python-v3 | huaweicloud-sdk-bss/huaweicloudsdkbss/v2/model/update_indirect_partner_account_response.py | 3,109 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Northwestern University.
#
# invenio-subjects-mesh is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Version information for invenio-subjects-mesh.
This file is imported by ``invenio_s... | 25.25 | 73 | 0.725248 | [
"MIT"
] | fenekku/invenio-subjects-mesh | invenio_subjects_mesh/version.py | 404 | Python |
# ---------------------------------------------------------------------
# Segment handlers
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules... | 30.57377 | 85 | 0.576408 | [
"BSD-3-Clause"
] | sbworth/getnoc | fm/handlers/alarm/segment.py | 1,865 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Spectrogram decomposition
=========================
.. autosummary::
:toctree: generated/
decompose
hpss
nn_filter
"""
import numpy as np
import scipy.sparse
from scipy.ndimage import median_filter
import sklearn.decomposition
from . import core
fro... | 32.827094 | 91 | 0.587641 | [
"ISC"
] | ElisaIzrailova/librosa | librosa/decompose.py | 18,417 | Python |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from gazebo_msgs/SetJointTrajectoryRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import trajectory_msgs.msg
import geometry_msgs.msg
import genpy
import std_msgs... | 37.508306 | 292 | 0.642781 | [
"MIT"
] | Filipe-Douglas-Slam/slam_lidar_kinect | files/catkin_ws/devel/lib/python2.7/dist-packages/gazebo_msgs/srv/_SetJointTrajectory.py | 22,580 | Python |
from __future__ import unicode_literals
import netaddr
from django.core.exceptions import ValidationError
from django.test import TestCase, override_settings
from ipam.models import IPAddress, Prefix, VRF
class TestPrefix(TestCase):
@override_settings(ENFORCE_GLOBAL_UNIQUE=False)
def test_duplicate_global(... | 45.774194 | 84 | 0.72093 | [
"Apache-2.0"
] | 0xAalaoui/netbox | netbox/ipam/tests/test_models.py | 2,838 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
__author__ = 'Tim Schneider <tim.schneider@northbridge-development.de>'
__copyright__ = "Copyright 2015, Northbridge Development Konrad & Schneider GbR"
__credits__ = ["Tim Schneider", ]
__maintainer__ = "Tim Schneider"
__email__ = "mail@northbridge-developm... | 25.271845 | 100 | 0.688436 | [
"MIT"
] | Mactory/django-splitdate | django_splitdate/tests/runtests.py | 2,603 | Python |
#-------------------------------------------------------------------------------
#
# Base class for all door sensors
#
import iofun
import message
from device import Device
from querier import Querier
from querier import MsgHandler
from dbbuilder import GenericDBBuilder
from linkdb import LightDBRecordFormatter
from us... | 39.943609 | 176 | 0.686118 | [
"Unlicense"
] | vastsuperking/insteon-terminal | python/hiddendoorsensor.py | 10,625 | Python |
# Copyright (c) 2020. Yul HR Kang. hk2699 at caa dot columbia dot edu.
import torch
import matplotlib.pyplot as plt
from lib.pylabyk import numpytorch as npt
from lib.pylabyk.numpytorch import npy, npys
def print_demo(p, fun):
out = fun(p)
print('-----')
print('fun: %s' % fun.__name__)
print('p:')... | 21.909091 | 71 | 0.443983 | [
"Apache-2.0"
] | Gravifer/pylabyk | demo/demo_min_max_distrib.py | 1,205 | Python |
def onehot_encode_seq(sequence, m=0, padding=False):
"""Converts a given IUPAC DNA sequence to a one-hot
encoded DNA sequence.
"""
import numpy as np
import torch
valid_keys = ['a','c','g','t','u','n','r','y','s','w','k','m']
nucs = {'a':0,'c':1,'g':2,'t':3,'u':3}
if pad... | 36.571429 | 114 | 0.596217 | [
"MIT"
] | jacobhepkema/scover | bin/scover_utils.py | 4,864 | Python |
from __future__ import unicode_literals
from django.apps import AppConfig
class CondominiosConfig(AppConfig):
name = 'condominios'
| 17.25 | 39 | 0.804348 | [
"MIT"
] | mpeyrotc/govector | condominios/apps.py | 138 | Python |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | 30.268293 | 78 | 0.705077 | [
"Apache-2.0"
] | cc1-cloud/cc1 | src/wi/utils/__init__.py | 2,483 | Python |
import connexion
from flask_cors import CORS
import api
from flask import request
import sys
def create_app():
app = connexion.FlaskApp(__name__, specification_dir='openapi/')
app.add_api('my_api.yaml')
@app.app.route("/v1/plugin/<name>/<path:path>", methods=["GET", "POST"])
def plugin(name, path):
... | 29.44 | 114 | 0.653533 | [
"MIT"
] | xu-hao/pds-backend | api/server.py | 736 | Python |
import base64
import typing
import uuid
from urllib.parse import parse_qs
from commercetools.testing.abstract import BaseBackend
from commercetools.testing.utils import create_commercetools_response
class AuthModel:
def __init__(self):
self.tokens: typing.List[str] = []
def add_token(self, token):
... | 34 | 87 | 0.61037 | [
"MIT"
] | BramKaashoek/commercetools-python-sdk | src/commercetools/testing/auth.py | 3,298 | Python |
# -*- coding: utf-8 -*-
# Copyright 2010-2020, Google Inc.
# 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... | 35.732759 | 79 | 0.723281 | [
"BSD-3-Clause"
] | dancerj/mozc | src/build_tools/change_reference_mac.py | 4,145 | Python |
number1 = 10
| 6.5 | 12 | 0.692308 | [
"MIT"
] | wang40290059/TBD39 | login.py | 13 | Python |
import torch
def binary_accuracy(preds, y):
rounded_preds = torch.round(torch.sigmoid(preds))
correct = (rounded_preds == y).float()
acc = correct.sum() / len(correct)
return acc | 21.888889 | 53 | 0.675127 | [
"MIT"
] | gucci-j/pytorch-imdb-cv | src/metrics.py | 197 | Python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: users.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... | 42.347084 | 3,323 | 0.777158 | [
"MIT"
] | HappyManRus/TinkoffNewAPI | include/users_pb2.py | 29,770 | Python |
from rest_framework import serializers
from vianeyRest.models import Usuario,Materia,Persona
class UsuarioSerializer(serializers.ModelSerializer):
class Meta:
model = Usuario
fields = ('id','nombreUsuario','contrasenaUsuario')
class MateriaSerializer(serializers.ModelSerializer):
class Meta... | 29.423077 | 65 | 0.669281 | [
"Unlicense"
] | elgs1995/Servicio-Web- | vianeyRest/serializers.py | 765 | Python |
from loris.compliance.format import FormatCompliance
from loris.compliance.helpers import ComparableMixin
from loris.compliance.helpers import st
from loris.compliance.http import HttpCompliance
from loris.compliance.quality import QualityCompliance
from loris.compliance.region import RegionCompliance
from loris.compli... | 35.531915 | 99 | 0.670958 | [
"BSD-2-Clause"
] | jpstroop/loris-redux | loris/compliance/__init__.py | 3,340 | Python |
from contextlib import nullcontext as does_not_raise
from typing import Any
import pytest
from _mock_data.window_handles import WINDOW_HANDLE_1_ID, WINDOW_HANDLE_4_ID
from browserist.exception.window_handle import WindowHandleIdNotFoundError, WindowHandleIdNotValidError
from browserist.model.window.controller import ... | 41.611111 | 155 | 0.814419 | [
"Apache-2.0"
] | jakob-bagterp/browserist | test/browser/window/controller/remove_handle_by_id_test.py | 1,498 | Python |
from typing import IO, Dict, Optional, Set
from rdflib.plugins.serializers.xmlwriter import XMLWriter
from rdflib.namespace import Namespace, RDF, RDFS # , split_uri
from rdflib.plugins.parsers.RDFVOC import RDFVOC
from rdflib.graph import Graph
from rdflib.term import Identifier, URIRef, Literal, BNode
from rdflib.... | 34.760753 | 90 | 0.551079 | [
"BSD-3-Clause"
] | GreenfishK/rdflib | rdflib/plugins/serializers/rdfxml.py | 12,931 | Python |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import os
from os.path import abspath, dirname
from restclients_core.dao import DAO
class Sdbmyuw_DAO(DAO):
def service_name(self):
return 'sdbmyuw'
def service_mock_paths(self):
return [abspath(os.path.jo... | 23.8 | 70 | 0.731092 | [
"Apache-2.0"
] | uw-it-aca/uw-restclients-sdbmyuw | uw_sdbmyuw/dao.py | 357 | Python |
import pandas as pd
import read_mta_turnstile as t
# This function generally generates a schedule for all stations in the df_top.csv file in a pivot table format.
def find_schedule():
# Read the stations with highest Toucan scores and select columns relavant
# to our schedule algorithm
top_stations = pd.re... | 51.903226 | 111 | 0.678061 | [
"MIT"
] | Stitchmaker/Metis_Bootcamp | 1-Benson_Project/find_schedule.py | 3,218 | Python |
import _continuation
import threading
__all__ = ['Fiber', 'error', 'current']
_tls = threading.local()
def current():
try:
return _tls.current_fiber
except AttributeError:
fiber = _tls.current_fiber = _tls.main_fiber = _create_main_fiber()
return fiber
class error(Exception):
... | 27.895161 | 85 | 0.603643 | [
"MIT"
] | timgates42/python-fibers | fibers/_pyfibers.py | 3,459 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from cmsplugin_cascade.extra_fields.config import PluginExtraFieldsConfig
CASCADE_PLUGINS = getattr(settings, 'SHOP_CASCADE_PLUGINS',
('auth', 'breadcrumb', 'catalog', 'cart', 'checkout', 'extensions', 'order', 'proc... | 38.615385 | 106 | 0.685259 | [
"BSD-3-Clause"
] | Edison4mobile/django-shopping | shop/cascade/settings.py | 1,004 | Python |
import sklearn.neighbors
from numpy import linalg as LA
from apexpy import Apex
import numpy as np
#Create an Apex conversion instance at the usual reference altitude
#no epoch is specified; we will set the epoch just-in-time when we are going to
#do an coordinate transformation
apex_reference_height = 110000. # Apex ... | 41.715736 | 127 | 0.676199 | [
"MIT"
] | jali7001/LBH_to_E_flux | LBH_to_eflux/helper_funcs.py | 8,218 | Python |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | 35.345455 | 120 | 0.736968 | [
"Apache-2.0"
] | AnniDu/cm_api | python/src/cm_api/endpoints/host_templates.py | 5,832 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 52.284426 | 354 | 0.680107 | [
"MIT"
] | AriZavala2/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/aio/operations/_network_interfaces_operations.py | 63,787 | Python |
# -*- coding: utf-8 -*-
# @Time : 2021/5/8 7:14
# @Author : 咸鱼型233
# @File : v1.1_py3_adjust.py
# @Software: PyCharm
# @Function: v1.0的py3适应性调整
# 修改记录 : 2021.5.8-20:34-改崩了,下一版用urllib3实现
import base64
import json
import urllib
import requests
import urllib3
from config import APPCODE, path_image
# 获取图片二进制数据的ba... | 28.930233 | 110 | 0.633039 | [
"MIT"
] | Ayusummer/DailyNotes | DailyLife/picOCR_toExcel/old_version/v1.1_py3_adjust.py | 2,654 | Python |
import logging
import zmq
from gabriel_protocol import gabriel_pb2
from gabriel_server import network_engine
TEN_SECONDS = 10000
REQUEST_RETRIES = 3
logger = logging.getLogger(__name__)
def run(engine, source_name, server_address, all_responses_required=False,
timeout=TEN_SECONDS, request_retries=REQUEST_... | 34.66 | 74 | 0.683785 | [
"Apache-2.0"
] | cmusatyalab/gabriel | server/src/gabriel_server/network_engine/engine_runner.py | 1,733 | Python |
import cupy as np
def supersample(clip, d, n_frames):
"""Replaces each frame at time t by the mean of `n_frames` equally spaced frames
taken in the interval [t-d, t+d]. This results in motion blur.
"""
def filter(get_frame, t):
timings = np.linspace(t - d, t + d, n_frames)
frame_avera... | 30 | 85 | 0.627451 | [
"MIT"
] | va6996/moviepy | moviepy/video/fx/supersample.py | 510 | Python |
"""scrapli_cfg.platform.core.cisco_iosxe.sync_platform"""
from typing import Any, Callable, List, Optional
from scrapli.driver import NetworkDriver
from scrapli.response import MultiResponse, Response
from scrapli_cfg.diff import ScrapliCfgDiffResponse
from scrapli_cfg.exceptions import DiffConfigError, FailedToDeterm... | 34.626984 | 100 | 0.616548 | [
"MIT"
] | m1009d/scrapli_cfg | scrapli_cfg/platform/core/cisco_iosxe/sync_platform.py | 13,089 | Python |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 32.934783 | 85 | 0.768977 | [
"Apache-2.0"
] | googleapis/python-vm-migration | samples/generated_samples/vmmigration_v1_generated_vm_migration_get_datacenter_connector_sync.py | 1,515 | Python |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | 32.696203 | 79 | 0.714092 | [
"Apache-2.0"
] | kucerakk/template | umn/source/conf.py | 5,166 | Python |
import os
import json
import zipfile
import tempfile
from pathlib import Path
from copy import deepcopy
from .exception import FrictionlessException
from .metadata import Metadata
from .detector import Detector
from .resource import Resource
from .system import system
from . import helpers
from . import errors
from . i... | 31.3789 | 92 | 0.561748 | [
"MIT"
] | augusto-herrmann/frictionless-py | frictionless/package.py | 21,136 | Python |
"""
utils.py
"""
import pathlib
import tempfile
import shutil
import curio.io as io
async def atomic_write(p, data):
p = pathlib.Path(p)
with tempfile.NamedTemporaryFile(dir=p.parent, delete=False) as f:
af = io.FileStream(f)
res = await af.write(data)
shutil.move(f.name, p)
return re... | 17.888889 | 70 | 0.664596 | [
"MIT"
] | Zaharid/zsvc | zsvc/utils.py | 322 | Python |
from aiohttp import web
import asyncio
import uvloop
async def handle(request):
name = request.match_info.get('name', "Anonymous")
text = "Hello, " + name
return web.Response(text=text)
app = web.Application()
app.add_routes([web.get('/', handle),
web.get('/{name}', handle)])
asyncio.set_e... | 23.8125 | 55 | 0.685039 | [
"Apache-2.0"
] | decaun/easy-python-study | async/http/aioserver.py | 381 | Python |
#
# PySNMP MIB module INT-SERV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INT-SERV-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:18:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | 129.878788 | 2,054 | 0.780876 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp-with-texts/INT-SERV-MIB.py | 25,716 | Python |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | 31.104167 | 105 | 0.560065 | [
"Apache-2.0"
] | cfpb/elasticsearch-dsl-py | elasticsearch_dsl/search.py | 25,381 | Python |
"""Test the code generating time series with the order totals.
Unless otherwise noted, each `time_step` is 60 minutes long implying
12 time steps per day (i.e., we use `LONG_TIME_STEP` by default).
"""
import datetime
import pandas as pd
import pytest
from tests import config as test_config
from urban_meal_delivery... | 35.6425 | 88 | 0.644666 | [
"MIT"
] | webartifex/urban-meal-delivery | tests/forecasts/timify/test_make_time_series.py | 14,257 | Python |
"""
This file is part of the FJournal Project.
Copyright © 2019-2020, Daniele Penazzo. All Rights Reserved.
The use of this code is governed by the MIT license attached.
See the LICENSE file for the full license.
Created on: 2020-07-10
Author: Penaz
"""
from tkinter import ttk
import tkinter as tk
from models import ... | 27.301887 | 68 | 0.595715 | [
"MIT"
] | Penaz91/fjournal | gui/addmealpopup.py | 1,448 | Python |
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT
#
# Adafruit PCF8523 RTC Library documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 11 21:37:36 2016.
#
# This file is execfile()d with the current directory set to its
... | 29.598945 | 85 | 0.700214 | [
"MIT",
"MIT-0",
"Unlicense"
] | adafruit/Adafruit_MicroPython_PCF8523 | docs/conf.py | 11,218 | Python |
import unittest
import numpy
import pytest
import cupy
import cupy.core._accelerator as _acc
from cupy.core import _cub_reduction
from cupy import testing
@testing.gpu
class TestSearch(unittest.TestCase):
@testing.for_all_dtypes(no_complex=True)
@testing.numpy_cupy_allclose()
def test_argmax_all(self, ... | 35.495212 | 79 | 0.625082 | [
"MIT"
] | daxiongshu/cupy | tests/cupy_tests/sorting_tests/test_search.py | 25,947 | Python |
import mock
import json
from collections import OrderedDict
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from apps.common.tests import GetResponseMixin
from apps.issue.models import Issue, IssueStatus, IssueE... | 53.859054 | 366 | 0.604131 | [
"MIT"
] | ycheng-aa/gated_launch_backend | apps/issue/testcases/integration/tests.py | 61,964 | Python |
# encoding = utf-8
"""
//
// AzureMonitorAddonForSplunk
//
// Copyright (c) Microsoft Corporation
//
// All rights reserved.
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the ""Software""), to deal
// in the S... | 40.944444 | 123 | 0.674084 | [
"MIT"
] | sebastus/AzureMonitorAddonForSplunk | bin/azure_monitor_metrics_main.py | 11,055 | Python |
from numpy.oldnumeric.ma import *
| 11.666667 | 33 | 0.771429 | [
"Apache-2.0"
] | animesh/parliament2 | docker_version/resources/usr/lib/python2.7/dist-packages/numpy/numarray/ma.py | 50 | Python |
# Copyright 2019, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 35.912281 | 127 | 0.655105 | [
"Apache-2.0"
] | bhumikapahariapuresoftware/opencensus-python | contrib/opencensus-ext-datadog/setup.py | 2,047 | Python |
from itertools import tee
import numpy as np
import scipy.interpolate as intp
from scipy.signal import savgol_filter
def get_edge_bin(array):
"""Detect the edge indcies of a binary 1-D array.
Args:
array (:class:`numpy.ndarray`): A list or Numpy 1d array, with binary
(0/1) or boolean (True... | 31.735075 | 83 | 0.544033 | [
"Apache-2.0"
] | wangleon/gamse | gamse/utils/onedarray.py | 8,513 | Python |
#!/usr/bin/env python
import argparse
import bs4
import os
import re
# better indentation hack via https://stackoverflow.com/a/15513483/127114
orig_prettify = bs4.BeautifulSoup.prettify
r = re.compile(r'^(\s*)', re.MULTILINE)
def prettify(self, encoding=None, formatter="minimal", indent_width=3):
return r.sub(r'\... | 33.115385 | 98 | 0.603175 | [
"MIT"
] | learningequality/channel2site | scripts/deindexify.py | 2,583 | Python |
"""
Based on REST Framework Parsers, optimized for csv
Parsers are used to parse the content of incoming HTTP requests.
They give us a generic way of being able to handle various media types
on the request, such as form content or json encoded data.
"""
import codecs
from urllib import parse
from django.conf import ... | 38.64375 | 122 | 0.613456 | [
"MIT"
] | marco-aziz/mPulse | mparser.py | 6,183 | Python |
class CurveByPoints(CurveElement,IDisposable):
""" A curve interpolating two or more points. """
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def getBoundingBox(self,*args):
""" getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """
pass
def GetPoints(self):
"""
Get... | 22.341772 | 215 | 0.689235 | [
"MIT"
] | BCSharp/ironpython-stubs | release/stubs.min/Autodesk/Revit/DB/__init___parts/CurveByPoints.py | 3,530 | Python |
# -*- coding: UTF-8 -*-
"""Define transaction calendar"""
import calendar
import datetime
from collections import defaultdict
from utils import Exchange
class TransPeriod(object):
"""
The period of exchange transaction time, e.g. start_time, end_time of a day.
"""
def __init__(self, start_time, end_ti... | 34.914634 | 89 | 0.595878 | [
"MIT"
] | xuesj/QuoteAdapter | receivers/Calender.py | 2,863 | Python |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 37.986667 | 220 | 0.707617 | [
"Apache-2.0"
] | Abduttayyeb/datasets | tensorflow_datasets/image_classification/imagenet2012_real.py | 5,698 | Python |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Nicira, 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
#
#... | 40.616046 | 78 | 0.567478 | [
"Apache-2.0"
] | ericwanghp/quantum | quantum/tests/unit/openvswitch/test_ovs_lib.py | 14,175 | Python |
# Generated by Django 3.0.6 on 2020-05-28 17:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | 46.878788 | 119 | 0.60181 | [
"Apache-2.0"
] | AIexBondar/my_works | projectamber/botapp/migrations/0001_initial.py | 3,115 | Python |
"""Tests for the HTTP API Client."""
import pytest
import solana.system_program as sp
from solana.rpc.api import DataSliceOpt, Client
from solana.keypair import Keypair
from solana.rpc.core import RPCException
from solana.rpc.types import RPCError
from solana.transaction import Transaction
from solana.rpc.commitment i... | 37.042506 | 120 | 0.773765 | [
"MIT"
] | 01protocol/solana-py | tests/integration/test_http_client.py | 16,558 | Python |
#!/usr/bin/python
__title__ = 'centinel'
__version__ = '0.1.5.7.1'
import centinel.backend
import centinel.client
import centinel.command
import centinel.config
import centinel.cli
import centinel.daemonize
import centinel.utils
| 19.166667 | 25 | 0.808696 | [
"MIT"
] | rpanah/centinel | centinel/__init__.py | 230 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The BitCore Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
This module contains utilities for doing coverage analysis on the RPC
interface.
It provides a way t... | 27.71028 | 79 | 0.660708 | [
"MIT"
] | Goosey13/bitcore-limtex-broteq | qa/rpc-tests/test_framework/coverage.py | 2,965 | Python |
#!/usr/bin/env python
# coding: utf-8
# This software component is licensed by ST under BSD 3-Clause license,
# the "License"; You may not use this file except in compliance with the
# License. You may obtain a copy of the License at:
# https://opensource.org/licenses/BSD-3-Clause
... | 26.190476 | 75 | 0.643636 | [
"MIT"
] | MahendraSondagar/STMicroelectronics | SensorTile/STM32CubeFunctionPack_SENSING1_V4.0.2/Middlewares/ST/STM32_AI_AudioPreprocessing_Library/Python/MFCC.py | 1,650 | Python |
# Generated by Django 3.2.7 on 2021-09-10 14:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AppState',
... | 43.946429 | 147 | 0.538399 | [
"MIT"
] | Polarts/UEMarketplaceAlertsBot | bot/migrations/0001_initial.py | 2,461 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.