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 .action_handler import *
from .event_handler import *
from .headline_post_action import *
from .incident_command import *
from .keyword_handler import *
from .incident_notification import *
from .dialog_handler import *
| 28.125 | 36 | 0.813333 | [
"MIT"
] | qubitdigital/response | response/slack/decorators/__init__.py | 225 | Python |
from browser import document, alert
import sys
from pprint import pprint
class redirect:
def write(text, text2):
document["output"].innerHTML += text2
sys.stdout = redirect()
sys.stderr = redirect()
d = document["output"]
d.clear()
d.innerHTML = "Hello"
print("Hello again")
def hello(ev):
... | 17.318182 | 43 | 0.664042 | [
"Apache-2.0"
] | citizendatascience/ErysNotes | data/tests/redirect.py | 381 | Python |
# Copyright 2021 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 29.108108 | 92 | 0.548839 | [
"Apache-2.0"
] | TripleRD/Cirq | cirq-core/cirq/transformers/transformer_primitives_test.py | 12,512 | Python |
import collections
import operator
import bytewax
FIRST_ITERATION = 0
def read_edges(filename):
with open(filename) as lines:
for line in lines:
line = line.strip()
if line:
parent, child = tuple(x.strip() for x in line.split(","))
yield FIRST_ITE... | 27.289474 | 113 | 0.733365 | [
"ECL-2.0",
"Apache-2.0"
] | mttcnnff/bytewax | examples/pagerank.py | 2,074 | Python |
from abc import ABCMeta
from abc import abstractproperty
# The base class for all BMI Exceptions
# Made abstract since it is recommended to raise the specific subclass
class BMIException(Exception):
__metaclass__ = ABCMeta
@abstractproperty
def status_code(self):
pass
# The base class for all e... | 24.347222 | 74 | 0.735881 | [
"Apache-2.0"
] | CCI-MOC/ABMI | m2-modified/ims/exception/exception.py | 1,753 | Python |
import requests
import json
import os
requests.packages.urllib3.disable_warnings()
from cmlApiCalls import CML as cml
#edit the following variables
server = "cml.server.com"
username = "admin"
password = "CMLpassword123"
lab = "53b3fe"
user = os.getlogin()
auth = cml.auth(server, username, password)
N = True
n_id =... | 25.952381 | 116 | 0.585933 | [
"BSD-3-Clause"
] | alexanderdeca/cml-community | scripts/breakout-to-secureCRT-session/main.py | 1,635 | Python |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 37.377358 | 197 | 0.746593 | [
"Apache-2.0"
] | Amourspirit/ooo_uno_tmpl | ooobuild/lo/form/x_positioning_listener.py | 1,981 | Python |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 12 16:39:59 2020
@author: nicholls
"""
import os
import numpy as np
import matplotlib.pyplot as plt
#%%
class AngularSpreadCalc():
""" class for calculating how angular spread changes with iterations:
Inputs:
iterations: maxinum number of iterat... | 36.726531 | 93 | 0.610358 | [
"MIT"
] | surfaceanalytics/inelasticscattering | model/algorithms/legacy/angular_spread_lorentzian.py | 8,998 | Python |
# =======================================================================================
# \ | | __ __| _ \ | / __| \ \ / __|
# _ \ | | | ( | . < _| \ / \__ \
# @autor: Luis Monteiro _/ _\ \__/ _| \___/ _|\_\ ___| _| ____/
# ============... | 41.378378 | 105 | 0.427172 | [
"MIT"
] | lcmonteiro/service-autokeys | autokeys/credentials.py | 1,531 | Python |
"""Install funsies."""
import setuptools
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setuptools.setup(
name="funsies",
version="0.8.1",
author="Cyrille Lavigne",
auth... | 32.821429 | 79 | 0.624048 | [
"MIT"
] | aspuru-guzik-group/funsies | setup.py | 1,838 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.CloudbusTransitResultItem import CloudbusTransitResultItem
class AlipayDataAiserviceCloudbusTransitorridorQueryResponse(AlipayResponse):
def __init__(self):
... | 32.966667 | 127 | 0.736097 | [
"Apache-2.0"
] | Anning01/alipay-sdk-python-all | alipay/aop/api/response/AlipayDataAiserviceCloudbusTransitorridorQueryResponse.py | 989 | Python |
class Domain(Enum,IComparable,IFormattable,IConvertible):
"""
Enumeration of connector domain types
enum Domain,values: DomainCableTrayConduit (4),DomainElectrical (2),DomainHvac (1),DomainPiping (3),DomainUndefined (0)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq... | 27.820513 | 215 | 0.684793 | [
"MIT"
] | BCSharp/ironpython-stubs | release/stubs.min/Autodesk/Revit/DB/__init___parts/Domain.py | 1,085 | Python |
"""
This is the custom function interface.
You should not implement it, or speculate about its implementation
class CustomFunction:
# Returns f(x, y) for any given positive integers x and y.
# Note that f(x, y) is increasing with respect to both x and y.
# i.e. f(x, y) < f(x + 1, y),... | 34.346154 | 89 | 0.463606 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | lwy0ever/leetcode | 1237-Find Positive Integer Solution for a Given Equation.py | 893 | Python |
# This code implementents a variational autoencoder using importance weighted
# sampling as described in Burda et al. 2015 "Importance Weighted Autoencoders"
# and the planar normalizing flow described in Rezende et al. 2015
# "Variational Inference with Normalizing Flows"
import theano
theano.config.floatX = 'float32'... | 48.863158 | 315 | 0.705472 | [
"MIT"
] | Jungiebumper/parmesan | examples/iw_vae_normflow.py | 23,210 | Python |
from . import base
from grow.common import utils as common_utils
from boto.s3 import connection
from boto.s3 import key
from grow.pods import env
from protorpc import messages
import boto
import cStringIO
import logging
import os
import mimetypes
class Config(messages.Message):
bucket = messages.StringField(1)
... | 34.612245 | 91 | 0.651533 | [
"MIT"
] | davidwtbuxton/grow | grow/deployments/destinations/amazon_s3.py | 3,392 | Python |
# Copyright 2020 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS",... | 33.747554 | 98 | 0.595071 | [
"Apache-2.0"
] | getindata/kedro | tests/pipeline/test_node.py | 17,245 | Python |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 38.73 | 117 | 0.670281 | [
"BSD-2-Clause"
] | JuDFTteam/aiida_core | aiida/work/launch.py | 3,873 | Python |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
import frappe
from frappe.model.document import Document
class Note(Document):
def autoname(self):
# replace forbidden characters
import re
self.name = re.sub("[%'\"#*?`]", "", self.title.strip())
def validate(sel... | 26.217391 | 80 | 0.718905 | [
"MIT"
] | 18alantom/frappe | frappe/desk/doctype/note/note.py | 1,206 | Python |
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | 37.741722 | 118 | 0.610633 | [
"ECL-2.0",
"Apache-2.0"
] | bopopescu/ACI | core/setup.py | 5,699 | Python |
import ipaddress
from socket import inet_ntoa
from async_service import background_trio_service
from eth_utils import encode_hex
import pytest
import trio
from web3 import IPCProvider, Web3
from ddht.rpc import RPCServer
from ddht.tools.web3 import DiscoveryV5Module
from ddht.v5_1.rpc_handlers import get_v51_rpc_hand... | 31.493827 | 80 | 0.704822 | [
"MIT"
] | vaporydev/ddht | tests/core/v5_1/test_v51_rpc_handlers.py | 2,551 | Python |
from ..utils import Object
class PageBlockRelatedArticle(Object):
"""
Contains information about a related article
Attributes:
ID (:obj:`str`): ``PageBlockRelatedArticle``
Args:
url (:obj:`str`):
Related article URL
title (:obj:`str`):
Article titl... | 29.396226 | 92 | 0.589217 | [
"MIT"
] | iTeam-co/pytglib | pytglib/api/types/page_block_related_article.py | 1,558 | Python |
from django.db import models
from django.core.validators import URLValidator
from django.contrib.auth.models import User
from tinymce.models import HTMLField
# Create your models here.
class Project(models.Model):
title = models.CharField(max_length = 50)
image = models.ImageField(upload_to = 'projects/')
... | 34.018519 | 99 | 0.704954 | [
"Unlicense"
] | drewheathens/Awwwards | upload/models.py | 1,837 | Python |
n = int(input())
x = int(input())
# n = 5 : 101 => x ** 4 * x ** 1
ans = 1
while n > 0:
if n & 1:
ans *= x
n >>= 1
x *= x
continue
n >>= 1
x *= x
print(ans)
| 12 | 32 | 0.343137 | [
"MIT"
] | freepvps/hsesamples | src/2sem/pow.py | 204 | Python |
##
# Copyright (c) 2007-2016 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 27.090909 | 74 | 0.705817 | [
"Apache-2.0"
] | DalavanCloud/ccs-caldavclientlibrary | caldavclientlibrary/protocol/webdav/tests/test_head.py | 1,788 | Python |
import random
from typing import List, Optional, Tuple
import numpy as np
import gym
import wandb
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras import Sequential, Input, Model
from tensorflow.keras.layers import Dense, Conv2D, Flatten, Concatenate
from tensorflow.keras.optimizers impor... | 41.574766 | 142 | 0.619085 | [
"MIT"
] | kiritowu/Deep-Learning | RL/Snake-DQN/model/dqn_engineered.py | 8,901 | Python |
#!/usr/bin/env python
# coding: utf-8
from saenopy import Solver
# initialize the object
M = Solver()
from saenopy.materials import SemiAffineFiberMaterial
# provide a material model
material = SemiAffineFiberMaterial(1645, 0.0008, 1.0075, 0.033)
M.setMaterialModel(material)
import numpy as np
... | 25.730159 | 75 | 0.488587 | [
"MIT"
] | rgerum/saenopy | docs/regularization.py | 1,621 | Python |
import unittest
import example_module
class MainTest(unittest.TestCase):
def test_add(self):
self.assertEqual(example_module.add(1, 1), 2)
def test_subtract(self):
self.assertEqual(example_module.subtract(1, 1), 0)
if __name__ == '__main__':
unittest.main() | 24 | 58 | 0.704861 | [
"MIT"
] | hokiedsp/test_python | tests/math_test.py | 288 | Python |
"""
This module stores global variables that must be shared between all modules of
envprobe.
Please do not introduce a too large global state in this module.
Please do not add dependencies of other modules to this module because almost
all parts of envprobe refers this module.
"""
# This list contains the valid subco... | 35.076923 | 78 | 0.785088 | [
"MIT"
] | steakhal/envprobe | configuration/global_config.py | 456 | Python |
import configparser
import psycopg2
from sql_queries import copy_table_queries, insert_table_queries
def load_staging_tables(cur, conn):
for query in copy_table_queries:
print('Loading data by: '+query)
cur.execute(query)
conn.commit()
def insert_tables(cur, conn):
for query in inser... | 25.470588 | 117 | 0.684758 | [
"MIT"
] | gulbulut/udacity-data-engineering-nanodegree-projects | Project_3_Data_Warehouse/etl.py | 866 | Python |
# -*- coding: utf-8 -*-
# __ __ __ ___ __ __ __ __ ____
# | ' \ \/ / | | \ \ \ / \
# | _ \ /__| | , , |/ /\__|
# | (_) ) / _ | | | | ( __
# | ___/ ( (_) | | | |\ \/ |
# |__| \___/ \___,__;__/__/__/ \____/
"""
Digital Messaging Center API Client
~~~~~~~~~~~~~~~~~~~~~~~~~... | 22.769231 | 73 | 0.488176 | [
"MIT"
] | MappCTSAmericas/pydmc | pydmc/__init__.py | 592 | Python |
import string
import zmq
host = '127.0.0.1'
port = 6789
ctx = zmq.Context()
pub = ctx.socket(zmq.PUB)
pub.bind('tcp://%s:%s' % (host, port))
with open('lokomotywa.txt', 'rt') as poem:
words = poem.read()
for word in words.split():
word = word.strip(string.punctuation)
data = word.encode('utf-8')
if wo... | 26.473684 | 74 | 0.586481 | [
"MIT"
] | Mikma03/Python_Bill_Lubanovic_BookCodes | 17. Chapter_/poem_pub.py | 503 | Python |
# -*- coding: utf-8 -*-
import keras.engine.training
from typing import Callable
from typing import Tuple
from typing import List
from typing import Union
from util_types import types_of_loco
from network_model.distillation.distillation_model_builder import DistllationModelIncubator
from keras.optimizers import Optimiz... | 47.87395 | 114 | 0.509215 | [
"MIT"
] | Tetuwo181/ModelLearner | network_model/model_builder.py | 5,867 | Python |
# @ayushk780
# Big Thanks To Spechide and @TechnoAyanBoT
"""Counth: Avaible commands: .bstats
"""
import asyncio
from telethon import events
from uniborg.util import admin_cmd, humanbytes,get_readable_time
import shutil
import time
from userbot import botStartTime
@borg.on(admin_cmd(pattern=r"bstats"))
async def _(e... | 25.9 | 65 | 0.646075 | [
"MIT"
] | felapr1804/TechnoAyanBOT | userbot/plugins/bot_stats.py | 777 | Python |
import six
from django.shortcuts import render, resolve_url
from django.utils.functional import Promise
from rest_framework.renderers import BaseRenderer, JSONRenderer, TemplateHTMLRenderer
from rest_framework.utils import json
from .app_settings import redoc_settings, swagger_settings
from .codecs import VALIDATORS,... | 41.096045 | 110 | 0.690267 | [
"BSD-3-Clause"
] | varnion/drf-yasg | src/drf_yasg/renderers.py | 7,274 | Python |
"""
Grabs data from the "FAQ Content" CSV and turns it into nice JSON: a main faq object containing an array of themed Section objects, each Section Object in turn holding an array of Question objects consisting of question, answer and related link/s, as follows:
[
{
"Q": "What are the symptoms of... | 44.257143 | 270 | 0.700775 | [
"MIT"
] | zappascout/stop-covid19-sfbayarea | data/jsonic1_commit.py | 3,098 | Python |
#!/usr/bin/env python
import mdtraj as md
import numpy as np
from LLC_Membranes.llclib import physical, topology
r = 1
t = md.load('initial.gro')
keep = [a.index for a in t.topology.atoms if a.residue.name == 'HOH']
res_start = keep[0]
com = physical.center_of_mass(t.xyz[:, keep, :], [18., 1., 1.])
membrane = top... | 35.326087 | 152 | 0.624615 | [
"MIT"
] | shirtsgroup/LLC_Membranes | Ben_Manuscripts/stochastic_transport/figures/pore_water_tcl.py | 1,625 | Python |
import logging
logger = logging.getLogger('artifice')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(levelname)s:artifice:%(message)s'))
logger.addHandler(handler)
def set_verbosity(verbose):
if verbose == 0:
logger.setLevel(logging.WARNING)
elif ve... | 24.058824 | 77 | 0.753056 | [
"Apache-2.0"
] | bendkill/artifice | artifice/log/logger.py | 409 | Python |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""BitcoinSN P2... | 41.188172 | 413 | 0.653135 | [
"MIT"
] | BitcoinSN/BitcoinSN | test/functional/test_framework/mininode.py | 22,983 | Python |
from tool.runners.python import SubmissionPy
class CocoSubmission(SubmissionPy):
def run(self, s):
"""
:param s: input in string format
:return: solution flag
"""
# Your code goes here
# suppositions: all numbers are co-prime (it seems to be the case in the input ??... | 31.852941 | 90 | 0.553093 | [
"MIT"
] | david-ds/adventofcode-2020 | day-13/part-2/coco.py | 1,083 | Python |
import json
import os
from . import utils
from .browsers.chrome_native import is_native
def dump_kwargs(**kwargs):
utils.alert(
title='%s Kwargs' % kwargs.get('entity_type', 'Unknown'),
message='<pre>%s</pre>' % json.dumps(kwargs, sort_keys=True, indent=4)
)
def dump_environ(**kwargs):
... | 26.285714 | 97 | 0.609472 | [
"BSD-3-Clause"
] | westernx/sgactions | sgactions/examples.py | 1,288 | Python |
import sys
import os
sys.path.append(os.path.abspath('..'))
sys.path.append(os.path.abspath('./demo/'))
from autorch_sphinx_theme import __version__
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# document... | 31.854839 | 80 | 0.715823 | [
"MIT"
] | zhanghang1989/autorch_sphinx_theme | docs/conf.py | 7,900 | Python |
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 38.9 | 80 | 0.701285 | [
"ECL-2.0",
"Apache-2.0"
] | BuddenD/jax | jax/experimental/jax2tf/tests/tf_test_util.py | 1,945 | Python |
import time
import thriftpy2
from thriftpy2.utils import serialize, deserialize
from thriftpy2.protocol import TBinaryProtocolFactory, TCyBinaryProtocolFactory
addressbook = thriftpy2.load("addressbook.thrift")
def make_addressbook():
phone1 = addressbook.PhoneNumber()
phone1.type = addressbook.PhoneType.MO... | 25.966667 | 79 | 0.689345 | [
"MIT"
] | 4masaka/thriftpy2 | benchmark/benchmark_struct.py | 1,558 | Python |
# coding: utf-8
#
# Copyright 2017 The Oppia 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 requi... | 38.890654 | 87 | 0.582054 | [
"Apache-2.0"
] | AnanyaNegi/oppia | core/domain/activity_jobs_one_off_test.py | 83,226 | Python |
import tensorflow as tf
import numpy as np
import hyperchamber as hc
import inspect
from hypergan.trainers.base_trainer import BaseTrainer
TINY = 1e-12
class EvolutionTrainer(BaseTrainer):
def _create(self):
gan = self.gan
generator = self.gan.generator
config = self.config
d_var... | 39.833333 | 215 | 0.62097 | [
"MIT"
] | Darkar25/HyperGAN | hypergan/trainers/experimental/evolution_trainer.py | 4,063 | Python |
import csv
import numpy as np
import re
import itertools
from collections import Counter
from collections import namedtuple
DataPoint = namedtuple('DataPoint', ['PhraseId', 'SentenceId', 'Phrase', 'Sentiment'])
def load_datapoints(data_file):
datapoints = []
with open(data_file) as f:
reader = csv.... | 30.702128 | 91 | 0.620582 | [
"Apache-2.0"
] | pychuang/ist557-data-mining-cnn | data_helpers.py | 2,886 | Python |
import numpy as np
import pytest
import random
from mujoco_py import (MjSim, load_model_from_xml, cymj)
MODEL_XML = """
<mujoco model="inverted pendulum">
<size nuserdata="100"/>
<compiler inertiafromgeom="true"/>
<default>
<joint armature="0" damping="1" limited="true"/>
<geom contype="0" friction="1 0.1 0.1" ... | 29.189474 | 143 | 0.659574 | [
"MIT"
] | aaronhan223/CS394R_Final_Project | mujoco-py/mujoco_py/tests/test_pid.py | 2,773 | Python |
from torchtext import data
import spacy
import dill
BOS_WORD = '<s>'
EOS_WORD = '</s>'
BLANK_WORD = "<blank>"
spacy_en = spacy.load('en')
spacy_de = spacy.load('de')
def tokenizer_en(text):
return [tok.text for tok in spacy_en.tokenizer(text)]
def tokenizer_de(text):
return [tok.text for tok in spacy_de.tok... | 28.8125 | 170 | 0.715835 | [
"MIT"
] | abhishek1907/transformer | data_loader.py | 922 | Python |
import nanome
from nanome.util import Logs
from nanome._internal._network import PluginNetwork, _Packet
from nanome._internal._process import ProcessManagerInstance
from nanome._internal._network._commands._callbacks import _Messages
from nanome._internal._network._commands._callbacks._commands_enums import _Hashes
im... | 32.609929 | 109 | 0.637669 | [
"MIT"
] | nanome-ai/Nanome | nanome/_internal/_plugin_instance.py | 4,598 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
import os
from io import BytesIO
from subprocess import PIPE, Popen
... | 35.265207 | 91 | 0.579619 | [
"MIT"
] | TrueGameover/thumbor | thumbor/engines/pil.py | 14,494 | Python |
# Subplots Function
subplots_doc = """It creates a matrix of subplots. It requires two integers (different from 0) where the first sets the number of rows and the second the number of columns of the subplots matrix."""
subplot_doc = """It sets the subplot to use to plot data: further commands will refer to the subp... | 61.281437 | 365 | 0.75386 | [
"MIT"
] | Dev-iL/plotext | plotext/docstrings.py | 10,234 | Python |
from __future__ import absolute_import
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
from ..w_transform import HaarTransform, InvHaarTransform
def _zeros_like(obj):
zeros = [np.zeros_like(lev, dtype=float) for lev in obj]
return zeros
__all__ = ['_f... | 28.427419 | 74 | 0.593759 | [
"MIT"
] | alexxromero/WAKY-private | kwakpriv/plotting/plottingtools.py | 3,525 | Python |
##########################################################################
#
# Copyright (c) 2017, Image Engine Design 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:
#
# * Redistrib... | 37.402062 | 123 | 0.693219 | [
"BSD-3-Clause"
] | mattigruener/gaffer | python/GafferUI/WidgetAlgo.py | 3,628 | Python |
from typing import List
async def FixEnvData(data: List[str]):
cache_data = data
if str(cache_data[1]).startswith(" "):
cache_data[1] = cache_data[1].split(" ", 1)[-1]
if str(cache_data[2]).startswith(" "):
cache_data[2] = (
"" if cache_data[2].isspace() else cache_data[2].spli... | 32.695652 | 78 | 0.557181 | [
"MIT"
] | BGHRFF/AppJsonMaker | core/fix.py | 752 | Python |
from dyc.utils import (
get_leading_whitespace,
read_yaml,
get_indent_forward,
get_indent_backward,
get_extension,
is_comment,
)
class TestGetLeadingWhitespace:
def test_tabs(self):
"""Test tabs functionality"""
text = '\t\tHello'
expected = '\t\t'
got = get... | 29.44186 | 66 | 0.644813 | [
"MIT"
] | lukerm48/dyc | tests/test_utils.py | 3,798 | Python |
"""Install Dplython."""
from setuptools import setup, find_packages
setup(
name="dplython",
version="0.0.4",
description="Dplyr-style operations on top of pandas DataFrame.",
url="https://github.com/dodger487/dplython",
download_url="https://github.com/dodger487/dplython/tarball/0.0.4",
pack... | 34.472222 | 71 | 0.639807 | [
"MIT"
] | dgrtwo/dplython | setup.py | 1,241 | Python |
import pickle
from kitti_functions import *
class DataLoader:
def __init__(self, args):
self.dataset_path = args.dataset_path
self.batch_size = args.batch_size
self.batch_size_valid = 1
self.seq_length = args.seq_length
self.scale_factor = args.data_scale
self.soci... | 35.893443 | 132 | 0.52394 | [
"MIT"
] | d1024choi/trajpred_irl | kitti_utils.py | 13,137 | Python |
import argparse, json
import simpleamt
import MySQLdb
if __name__ == '__main__':
parser = argparse.ArgumentParser(parents=[simpleamt.get_parent_parser()])
parser.add_argument('-f', action='store_true', default=False)
args = parser.parse_args()
mtc = simpleamt.get_mturk_connection_from_args(args)
approve_ids... | 36.069444 | 97 | 0.630343 | [
"MIT"
] | maxspero/ccr-amt | check_and_approve_hits.py | 2,597 | Python |
import logging
import pickle
import os
import sys
import json
import cv2
import numpy as np
import glob
import tqdm
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import src
from src.__init__ import *
def image_reader(image_path_list):
image = cv2.imread(image_path_list[0], 0)
image... | 29.653061 | 95 | 0.628585 | [
"MIT"
] | WZX1998/facial-recognition | src/dataset_creator.py | 4,359 | 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... | 31.873362 | 98 | 0.65735 | [
"Apache-2.0"
] | 2RedSquares/spark | python/pyspark/taskcontext.py | 7,299 | Python |
from unittest import TestCase
import pandas as pd
from pytz import UTC
from trading_calendars.exchange_calendar_xshg import XSHGExchangeCalendar
from .test_trading_calendar import ExchangeCalendarTestBase
from .test_utils import T
class XSHGCalendarTestCase(ExchangeCalendarTestBase, TestCase):
answer_key_file... | 29.43662 | 75 | 0.576555 | [
"Apache-2.0"
] | quantrocket-llc/trading-calendars | trading_calendars/tests/test_xshg_calendar.py | 2,090 | Python |
import os
from sb3_contrib.ppo_mask import MaskablePPO
from sb3_contrib.qrdqn import QRDQN
from sb3_contrib.tqc import TQC
from sb3_contrib.trpo import TRPO
# Read version from file
version_file = os.path.join(os.path.dirname(__file__), "version.txt")
with open(version_file, "r") as file_handler:
__version__ = fi... | 28.833333 | 69 | 0.791908 | [
"MIT"
] | cyprienc/stable-baselines3-contrib | sb3_contrib/__init__.py | 346 | Python |
import logging
import os
import pickle
import sys
from pathlib import Path
import click
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import zsampler
from dotenv import load_dotenv, find_dotenv
from scipy.special import logsumexp, softmax
from src.inference.context_geo import GridContextGeo, ... | 43.801956 | 122 | 0.561708 | [
"MIT"
] | jp2011/spatial-poisson-mixtures | src/models/block_mixture_gp_softmax.py | 17,915 | Python |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deepcoin-cli"""
from test_framework.test_framework import DeepcoinTestFramework
from test_framewor... | 56.133333 | 160 | 0.706176 | [
"MIT"
] | deepcoindev2/Deepcoin | test/functional/interface_deepcoin_cli.py | 4,210 | Python |
# coding: utf-8
"""
Flat API
The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro (GP3, GP4, GP5, GPX, GP), PowerTab, TuxGuitar and Mus... | 40.242718 | 1,686 | 0.624367 | [
"Apache-2.0"
] | FlatIO/api-client-python | flat_api/models/flat_locales.py | 4,145 | Python |
from io import BytesIO
from unittest import TestCase
from ecc import G, N, PrivateKey, S256Point
from helper import (
big_endian_to_int,
byte_to_int,
encode_base58_checksum,
hmac_sha512,
hmac_sha512_kdf,
int_to_big_endian,
int_to_byte,
raw_decode_base58,
sha256,
)
from mnemonic impo... | 50.261931 | 206 | 0.673541 | [
"MIT"
] | jimmysong/pw-exercises | session6/hd.py | 45,286 | Python |
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 29.294574 | 88 | 0.562494 | [
"Apache-2.0"
] | Rajeshrc99/docker-voltha | ofagent/loxi/of11/instruction.py | 11,337 | Python |
import os
import numpy as np
import copy
import colorsys
from timeit import default_timer as timer
from keras import backend as K
from keras.models import load_model
from keras.layers import Input
from PIL import Image, ImageFont, ImageDraw
from nets.yolo4 import yolo_body,yolo_eval
from utils.utils import letterbox_im... | 36.48913 | 96 | 0.515788 | [
"MIT"
] | yanjingke/yolov4-keras | yolo.py | 7,016 | Python |
import holoviews as hv
import geoviews as gv
import cartopy.crs as ccrs
import cartopy.feature as cf
from holoviews.operation.datashader import regrid
from holoviews.streams import FreehandDraw
import panel as pn
pn.extension()
hv.extension('bokeh', logo=False)
import sys
# Suppress warnings
if not sys.warnoptions:
... | 35.16 | 189 | 0.662874 | [
"BSD-3-Clause"
] | informatics-lab/example-notebooks | 2.1 Weather/opscentretools/plotting.py | 2,637 | Python |
from typing import Dict
import pytest
from {{cookiecutter.project_slug}}.tests.assertions import assert_field_error
from {{cookiecutter.project_slug}}.users.api.serializers import RegisterSerializer
pytestmark = pytest.mark.django_db
@pytest.fixture
def user_json(user_json: Dict) -> Dict:
user_json["password1"... | 30.909091 | 83 | 0.682941 | [
"BSD-3-Clause"
] | e-dang/cookiecutter-django | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/tests/integration/users/test_serializers.py | 1,700 | Python |
import re
### parse_text(text)
# takes a string, return a list of strings with the matching groups
def parse_text_regex(text, regex):
try:
compiled_regex = re.compile(regex)
if compiled_regex is None:
raise Exception(f"String {text} doesn't match {regex}")
except TypeError as te:
... | 24.64 | 67 | 0.676948 | [
"MIT"
] | PumaConcolor/TPS-dice-roller-bot | TPS_dice_roller_bot/core/parse.py | 616 | Python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from django.contrib import messages
from django.db.models import Count
from django.views.generic import (
DetailView,
TemplateView,
)
from .models import (
AggregateHourlySongChart,
HourlySo... | 34.555556 | 101 | 0.66881 | [
"MIT"
] | pmrowla/kchart | kchart/charts/views.py | 2,177 | Python |
#
# LeetCode
#
# Problem - 581
# URL - https://leetcode.com/problems/shortest-unsorted-continuous-subarray/
#
class Solution:
def findUnsortedSubarray(self, arr: List[int]) -> int:
if (not arr):
0
index1 = -1
index2 = -1
for i in range(1, len(arr)):
if (arr[i] < arr[i-1]):
index... | 19.534884 | 76 | 0.515476 | [
"MIT"
] | KevinTMtz/CompetitiveProgramming | LeetCode/581.py | 840 | Python |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | 45.145897 | 484 | 0.596916 | [
"MIT"
] | Crypto-APIs/Crypto_APIs_2.0_SDK_Python | cryptoapis/model/list_assets_details_e400.py | 14,861 | Python |
#!/usr/bin/env python
# mypy: ignore-errors
# depdive documentation build configuration file
#
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, li... | 27.672515 | 77 | 0.661877 | [
"MIT"
] | nasifimtiazohi/depdive | docs/conf.py | 4,732 | Python |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HMM10_then1_IsolatedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HMM10_then1_IsolatedLHS.
"""
# Flag this insta... | 43.068966 | 125 | 0.5004 | [
"MIT"
] | levilucio/SyVOLT | UMLRT2Kiltera_MM/Properties/from_thesis/HMM10_then1_IsolatedLHS.py | 2,498 | Python |
#!/usr/bin/env python
# Copyright (c) 2014 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.
'''
A script to check that the (Linux) executables produced by gitian only contain
allowed gcxc, glibc and libstdc+... | 38.006135 | 142 | 0.653269 | [
"MIT"
] | bitcoinemxmx/GCX | contrib/devtools/symbol-check.py | 6,195 | Python |
#!/usr/bin/env python3
import cgi, cgitb, os, storage, shutil, time, sys, atexit
def deltemp():
os.remove("_/3dsthemes/tmp.zip")
from libs import zip
cgitb.enable()
from libs.session import Session
from libs import smdh
session=Session()
if not session.isLoggedIn():
raise ValueError("Must be logged in to upload... | 32.901639 | 156 | 0.707025 | [
"BSD-2-Clause"
] | Mtgxyz2/homepage | 3dsthemes/do_upload.py | 2,007 | Python |
# Generated by Django 4.0.2 on 2022-02-19 19:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='HierarchicalModelMixin',
f... | 28.434783 | 175 | 0.643731 | [
"MIT"
] | kayzan73/cenith4 | common/migrations/0001_initial.py | 654 | Python |
import pickle
from time import time
from sklearn.cross_validation import train_test_split as tts
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import SGDClassifier
from sklearn.metrics import classification_report as clsr
from sklearn.neural_network._base import identity
from sk... | 28.927536 | 83 | 0.66483 | [
"MIT"
] | shobhitagarwal1612/Emotion-Analysis | analyzer/build.py | 1,996 | Python |
class FlumineException(Exception):
"""Base class for Flumine Errors"""
pass
class RunError(FlumineException):
"""Exception raised if error
in `Flumine.run()``
"""
def __init__(self, message):
super(RunError, self).__init__(message)
class ListenerError(FlumineException):
"""Erro... | 20.476923 | 55 | 0.678437 | [
"MIT"
] | betcode-org/flumine | flumine/exceptions.py | 1,331 | Python |
from . import AWSProperty, AWSAttribute, validate_pausetime
from .validators import positive_integer, integer, boolean
class AutoScalingRollingUpdate(AWSProperty):
props = {
'MaxBatchSize': (positive_integer, False),
'MinInstancesInService': (integer, False),
'MinSuccessfulInstancesPercent... | 28.833333 | 76 | 0.679453 | [
"MIT"
] | MrUltimate/good-vibes-api | env/lib/python3.7/site-packages/troposphere/policies.py | 1,903 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import sys
import os
sys.path.append(os.getc... | 27.94958 | 75 | 0.562538 | [
"ISC"
] | arn4ud/fpga-tool-perf | test/test_all.py | 3,326 | Python |
import os
import freesasa
from .extract_residues import extract_residue
# Defaults
_DEFAULT_OPTIONS = {
'hetatm': True,
'hydrogen': True,
# 'halt-at-unknown': True,
# 'separate-chains' : False,
'separate-models': True
}
_DEFAULT_PARAMETERS = {
'algorithm': freesasa.LeeRichards,
'probe-r... | 33.252174 | 149 | 0.626831 | [
"Apache-2.0"
] | UCL-CCS/BAC2 | bac/analyse/wsas/freesasa_utils.py | 7,648 | Python |
import sys
from telethon import events, functions, __version__
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern="helpme", allow_sudo=True)) # pylint:disable=E0602
async def _(event):
if event.fwd_from:
return
help_string = """@UniBorg
Python {}
Telethon {}
UserBot Forked from https://git... | 29.68 | 85 | 0.66442 | [
"MPL-2.0"
] | anandvfc/UniBorg | stdplugins/_help.py | 1,484 | Python |
import pytest
from briefcase.integrations.subprocess import CommandOutputParseError, ParseError
def splitlines_parser(data):
"""A test parser that returns the input data, split by line."""
return data.splitlines()
def second_line_parser(data):
"""A test parser that returns the second line of input."""
... | 31.572816 | 87 | 0.664207 | [
"BSD-3-Clause"
] | pybee/briefcase | tests/integrations/subprocess/test_Subprocess__parse_output.py | 3,252 | Python |
"""This module contains the detection code for predictable variable
dependence."""
import logging
from copy import copy
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.report import Issue
from mythril.exceptions import UnsatError
from mythril.analysis import solver
from mythr... | 39.008658 | 124 | 0.534569 | [
"MIT"
] | marcuswin/mythril | mythril/analysis/module/modules/dependence_on_predictable_vars.py | 9,011 | Python |
# -*- coding: utf-8 -*-
from helper import unittest, PillowTestCase
from PIL import Image, ImageDraw, ImageFont, features
FONT_SIZE = 20
FONT_PATH = "Tests/fonts/DejaVuSans.ttf"
@unittest.skipUnless(features.check('raqm'), "Raqm Library is not installed.")
class TestImagecomplextext(PillowTestCase):
def test_en... | 33.395522 | 98 | 0.633966 | [
"MIT"
] | leorzz/simplemooc | Pillow-4.3.0/Tests/test_imagefontctl.py | 4,540 | Python |
import random as rd
import time as t
def Seed():
rd.seed(int(str(t.time()).split(".")[0]))
Seed()
def Random():
return rd.gauss(0,0.01)
def RandomZeroMask(Prob=0.1):
r= rd.random()
if r<Prob:
return 0.0
else:
return 1.0 | 19.615385 | 45 | 0.580392 | [
"MIT"
] | ssuurrffaaccee/ToyNeuralNetworkImplementation | DYNAMIC/Rand.py | 255 | Python |
# Standard Library
import asyncio
import logging
import math
# Third Party
import numpy as np
import pandas as pd
from fastapi import FastAPI, HTTPException, Request
from nats.aio.client import Client as NATS
from nats_wrapper import NatsWrapper
app = FastAPI()
logging.basicConfig(level=logging.INFO, format="%(asctim... | 34.878049 | 118 | 0.588112 | [
"Apache-2.0"
] | cjellick/opni | src/payload-receiver-service/app/main.py | 2,860 | Python |
# Copyright (c) 2019 - now, Eggroll 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 ... | 35.943396 | 98 | 0.623097 | [
"Apache-2.0"
] | Jakob-98/eggroll | python/eggroll/core/aspects.py | 1,905 | Python |
# Copyright 2013-2021 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)
import os
from spack import *
class Lbann(CMakePackage, CudaPackage, ROCmPackage):
"""LBANN: Livermore Big Artificia... | 46.198511 | 99 | 0.615104 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | JeffersonLab/spack | var/spack/repos/builtin/packages/lbann/package.py | 18,618 | Python |
# coding=utf-8
"""sksurgerytextoverlay tests"""
from sksurgeryutils.ui.sksurgerytextoverlay_demo import TextOverlayDemo
import pytest
import sys
def test_sksurgerytextoverlay():
""" Basic test to run the widget and make sure everything loads OK."""
if sys.platform == "darwin":
pytest.skip("Test not ... | 25.1 | 74 | 0.713147 | [
"BSD-3-Clause"
] | SciKit-Surgery/scikit-surgeryutils | tests/test_sksurgerytextoverlay.py | 502 | Python |
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Bill)
| 14.125 | 32 | 0.769912 | [
"MIT"
] | rozenmd/housemates | bills/admin.py | 113 | Python |
# stdlib
import time
from unittest import skipIf
# 3p
import psycopg2
from psycopg2 import extensions
from psycopg2 import extras
from ddtrace import Pin
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY
from ddtrace.contrib.psycopg.patch import PSYCOPG2_VERSION
from ddtrace.contrib.psycopg.patch import patch
f... | 34.733167 | 119 | 0.603389 | [
"Apache-2.0",
"BSD-3-Clause"
] | discord/dd-trace-py | tests/contrib/psycopg/test_psycopg.py | 13,928 | Python |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os,json,glob,re
import numpy as np
import pandas as pd
import nibabel as nb
from nilearn.input_data import NiftiMasker
def dcan2fmriprep(dcandir,outdir,sub_id=None):
dcandir = os.path.abspath(... | 39.870036 | 134 | 0.594712 | [
"MIT"
] | PennLINC/xcp_abcd | xcp_abcd/utils/dcan2fmriprep.py | 11,044 | Python |
import codecs
import os
from setuptools import setup, find_packages
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
VERSION = (0, 8, 0)
version = '.'.join(map(str, VERSION))
setup(
name='python-qu... | 27.982143 | 78 | 0.611359 | [
"MIT"
] | Ethernodes-org/python-quickbooks | setup.py | 1,567 | Python |
from __future__ import absolute_import
import os
from collections import namedtuple
import time
from torch.nn import functional as F
from baseline.fast_rcnn.model.utils.creator_tool import AnchorTargetCreator, ProposalTargetCreator
from torch import nn
import torch as t
from baseline.fast_rcnn.utils import array_tool ... | 36.859316 | 98 | 0.611925 | [
"BSD-3-Clause"
] | ITMO-NSS-team/LightObjRecEnsembler | baseline/fast_rcnn/trainer.py | 9,694 | Python |
import math
import random
import time
def average_density(rdr):
countZeros = 0
length = 0
for i in rdr:
length = length + 1
if (i == 0):
countZeros = countZeros + 1
return [length - countZeros, length]
def check_rdr(rdr):
for i in range (0, len(rdr)-1):
... | 42.679612 | 968 | 0.535942 | [
"MIT"
] | iMohannad/Random_Recording_Algorithm | Python/IFRA.py | 8,792 | Python |
"""
WSGI config for djangoCMS project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | 23.235294 | 78 | 0.787342 | [
"MIT"
] | yeLer/Vue-Somes | step3ComprehensiveProject/django-vue-cms/djangoCMS/djangoCMS/wsgi.py | 395 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.