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 |
|---|---|---|---|---|---|---|---|---|
"""
Test to verify performance of attaching number of pods as a bulk, each pod attached to one pvc only
The test results will be uploaded to the ES server
"""
import logging
import os
import pytest
import pathlib
import time
from concurrent.futures import ThreadPoolExecutor
from ocs_ci.framework.testlib import perform... | 34.207469 | 106 | 0.632703 | [
"MIT"
] | Sravikaz/ocs-ci | tests/e2e/performance/csi_tests/test_bulk_pod_attachtime_performance.py | 8,244 | Python |
import datetime
import logging
import os
import elastalert.elastalert
import elastalert.utils.util
import mock
import pytest
from elastalert import config
from elastalert.ruletypes import AnyRule
from elastalert.utils.time import dt_to_ts, ts_to_dt
writeback_index = "wb"
def pytest_addoption(parser):
parser.add... | 32.125 | 86 | 0.619624 | [
"Apache-2.0"
] | JasperJuergensen/elastalert | tests/conftest.py | 9,509 | Python |
import time
import os
from flask import Flask, jsonify, make_response
from flask.ext.sqlalchemy import SQLAlchemy
from redis import Redis
from rq import Queue
from fetch import fetch_user_photos
app = Flask(__name__)
app.config.from_object(os.environ['APP_SETTINGS'])
db = SQLAlchemy(app)
request_queue = Queue(connec... | 24.377358 | 69 | 0.673375 | [
"MIT"
] | oosidat/pyphotoanalytics | app.py | 1,292 | Python |
"""A Couchbase CLI subcommand"""
import getpass
import inspect
import ipaddress
import json
import os
import platform
import random
import re
import string
import subprocess
import sys
import urllib.parse
import tempfile
import time
from typing import Optional, List, Any, Dict
from argparse import ArgumentError, Arg... | 48.129503 | 124 | 0.603769 | [
"Apache-2.0"
] | b33f/couchbase-cli | cbmgr.py | 267,215 | Python |
# Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import datetime
import json
import os
import random
import time
from collections import namedtuple
from copy import deepcop... | 40.705615 | 142 | 0.626393 | [
"Apache-2.0"
] | TopCoder2K/mdetr | main.py | 26,866 | Python |
import sys
import mrjob
from mrjob.job import MRJob
import re
from itertools import islice, izip
import itertools
from mrjob.step import MRStep
from mrjob.protocol import JSONValueProtocol
WORD_RE = re.compile(r'[a-zA-Z]+')
class BigramCount(MRJob):
OUTPUT_PROTOCOL = JSONValueProtocol
def m... | 25.181818 | 75 | 0.631769 | [
"MIT"
] | akhilaSharon/big-data-python-class | Homeworks/Homework5/code/p3.py | 831 | Python |
import json
from tests.constants import TEST_LOCATION_GUID
def test_get_location_by_location_guid(test_client, auth_headers):
get_resp = test_client.get('/mines/location/' + TEST_LOCATION_GUID, headers=auth_headers['full_auth_header'])
get_data = json.loads(get_resp.data.decode())
assert get_data['mine_lo... | 39.5 | 113 | 0.792405 | [
"Apache-2.0"
] | MaxWardle/mds | python-backend/tests/mines/resources/test_mine_location_resource.py | 395 | Python |
from lark import Lark
_name_parser = Lark("""
?start : name
name : var*
var : gen _extras
_extras : (sub _extras_sub) | (sup _extras_sup) | (prime _extras) | ()
_extras_sub : (sup [prime]) | (prime _extras_sub) | ()
_extras_sup : (sub [prime]) | (prime _extras_sup) | ()
prime :... | 28.327586 | 122 | 0.5 | [
"Apache-2.0",
"MIT"
] | JoeyBF/sseq | python_ext/webserver/spectralsequences_webserver/name_tools.py | 3,286 | Python |
# ---------------------------------------------------------------------
#
# Copyright (c) 2012 University of Oxford
#
# 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, incl... | 43.878788 | 90 | 0.679558 | [
"MIT"
] | dataflow/DataStage | datastage/web/documentation/urls.py | 1,448 | Python |
#!/usr/bin/python
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
im... | 26.0625 | 93 | 0.736211 | [
"Apache-2.0"
] | TansyArron/pants | tests/python/pants_test/tasks/false.py | 417 | Python |
from django.http import HttpRequest
from typing import Optional, Text
from zerver.lib.actions import check_send_stream_message, \
check_send_private_message
from zerver.lib.exceptions import StreamDoesNotExistError
from zerver.lib.request import REQ, has_request_variables
from zerver.models import UserProfile
@h... | 38.657143 | 81 | 0.67997 | [
"Apache-2.0"
] | Romdeau/zulip | zerver/lib/webhooks/common.py | 1,353 | Python |
# -*- coding: utf-8 -*-
import json
from urllib import quote
from twisted.internet.defer import inlineCallbacks
from vumi.message import TransportUserMessage
from vumi.tests.helpers import VumiTestCase
from vumi.transports.httprpc.tests.helpers import HttpRpcTransportHelper
from vumi.tests.utils import LogCatcher
fr... | 33.10219 | 78 | 0.610217 | [
"BSD-3-Clause"
] | praekelt/vumi-aat | vxaat/tests/test_ussd.py | 13,607 | Python |
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 36.689655 | 79 | 0.632832 | [
"Apache-2.0"
] | puppetlabs-operations/horizon | horizon/forms/fields.py | 15,960 | Python |
"""
Timings against numpy/itk/nibabel/etc where appropriate
"""
import os
import nibabel as nib
import itk
import ants
import time
def time_nifti_to_numpy(N_TRIALS):
"""
Times how fast a framework can read a nifti file and convert it to numpy
"""
datadir = os.path.join(os.path.dirname(os.path.realpa... | 26 | 89 | 0.625163 | [
"Apache-2.0"
] | ncullen93/ANTsPy | tests/timings.py | 1,534 | Python |
from . import water
from . import ion
from . import cosolute
from . import small_molecule
from . import peptide
from . import protein
from . import dna
from . import rna
from . import lipid
from .get_molecule_type_from_group_names import get_molecule_type_from_group_names
from .get_molecule_type_from_sequence import g... | 25.142857 | 82 | 0.838068 | [
"MIT"
] | uibcdf/MolModSAKs | molsysmt/element/molecule/__init__.py | 352 | Python |
'''In Repetition Based on User Input, you saw a loop that prompted users until they typed quit. This code won’t work if users type Quit, or QUIT, or any other version that isn’t exactly quit. Modify that loop so that it terminates if a user types that word with any capitalization.'''
text = ""
while text.lower()!= ... | 50 | 286 | 0.694 | [
"MIT"
] | YordanIH/Intro_to_CS_w_Python | chapter09/exercise06.py | 508 | Python |
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. 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 requir... | 32.027778 | 74 | 0.770165 | [
"Apache-2.0"
] | google-cloud-sdk-unofficial/google-cloud-sdk | lib/surface/vmware/nodetypes/__init__.py | 1,153 | Python |
parts = ["aardvark", "abacus", "abbey", "abdomen", "ability", "abolishment", "abroad", "accelerant", "accelerator", "accident", "accompanist", "accordion", "account", "accountant", "achieve", "achiever", "acid", "acknowledgment", "acoustic", "acoustics", "acrylic", "act", "action", "active", "activity", "actor", "actre... | 15,801 | 47,391 | 0.625973 | [
"MIT"
] | flapperleenie/thevocals | python/words.py | 47,403 | Python |
"""
This file offers the methods to automatically retrieve the graph Elusimicrobia bacterium RIFOXYC2_FULL_34_12.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING ... | 34.12381 | 223 | 0.686855 | [
"MIT"
] | AnacletoLAB/ensmallen | bindings/python/ensmallen/datasets/string/elusimicrobiabacteriumrifoxyc2full3412.py | 3,583 | Python |
import os
import math
import argparse
import pickle
import torch
import torch.distributed as dist
from torch.nn import Parameter
import torch.nn.functional as F
from sparse_coo_tensor_cpp import sparse_coo_tensor_gpu, spmm_gpu
import utils
from dist_data import DistData
run = 0
def outer_product2(inputs, ag):
... | 39.9 | 162 | 0.627051 | [
"MIT"
] | chineshboy/dist-gnn | 1D_CAGNET/dist_1d.py | 12,369 | Python |
#This code aims to return an "n" result of the Fibonnachi Sequence.
#Below are two fucntions, each of which return the same results by following different algorithms.
def getFibNExt (n):
fibAr = [0, 1, 0]
for i in range(n-1):
fibAr[2] = fibAr[0]
fibAr[0] += fibAr[1]
fibAr[1] = fibAr[2]
... | 39.694444 | 155 | 0.627012 | [
"MIT"
] | DAM-96/Python-CodeSamples | fibonnachiSequence.py | 1,431 | 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 ... | 42.485106 | 441 | 0.644531 | [
"ECL-2.0",
"Apache-2.0"
] | pulumi/pulumi-okta | sdk/python/pulumi_okta/group_memberships.py | 9,984 | Python |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import logging
import os
import posixpath
import warnings
import django
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
from django.db import models
from django.template.defaultfil... | 40.403846 | 99 | 0.666111 | [
"Apache-2.0"
] | OrsoBruno96/django-private-storage | private_storage/fields.py | 4,202 | Python |
import torch.nn as nn
import math
import torch
import torch.nn.functional as F
def conv_bn(inp, oup, stride, k_size=3):
return nn.Sequential(
nn.Conv2d(inp, oup, k_size, stride, 1, bias=False),
nn.BatchNorm2d(oup),
nn.PReLU()
)
def conv_1x1_bn(inp, oup):
return nn.Sequential(
... | 37.769231 | 128 | 0.594705 | [
"MIT"
] | BOGUENSONG/EXTD_Pytorch | mobileFacenet_48_PReLU.py | 8,838 | Python |
# Databricks notebook source
# COMMAND ----------
# Instrument for unit tests. This is only executed in local unit tests, not in Databricks.
if 'dbutils' not in locals():
import databricks_test
databricks_test.inject_variables()
# COMMAND ----------
assert dbutils.widgets.get("input") == "input_value"
| 24.230769 | 90 | 0.698413 | [
"MIT"
] | Bhaskers-Blu-Org2/DataOps | Python/packages/databricks-test/tests/patch_notebook.py | 315 | Python |
import subprocess
from collections import OrderedDict
from io import StringIO
from itertools import product
def _parse_categorical(line):
# Categorical Lines consist of:
#
# <name><w*>{<values>}<w*>[<default>]<*w>#Comment
# where:
# <name> - name of parameter.
# <values> - comma seperated list... | 32.946809 | 77 | 0.624475 | [
"Apache-2.0"
] | Fanxingye/Autotabular | autotabular/metalearning/optimizers/optimizer_base.py | 3,097 | Python |
import transmission_rpc
from bgmi.config import (
TRANSMISSION_RPC_PASSWORD,
TRANSMISSION_RPC_PORT,
TRANSMISSION_RPC_URL,
TRANSMISSION_RPC_USERNAME,
)
from bgmi.downloader.base import BaseDownloadService
from bgmi.utils import print_info, print_warning
class TransmissionRPC(BaseDownloadService):
... | 29.169811 | 87 | 0.655886 | [
"MIT"
] | Sg4Dylan/BGmi | bgmi/downloader/transmission.py | 1,546 | Python |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from builtins import str
from collections import namedtuple
from textwrap impor... | 36.407143 | 100 | 0.677523 | [
"Apache-2.0"
] | omerzach/pants | tests/python/pants_test/build_graph/test_build_file_parser.py | 15,296 | Python |
from __future__ import absolute_import, division, print_function
import six
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.testing.decorators import image_comparison
from mpl_toolkits.axes_grid1 import host_subplot
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.axes_grid... | 35.381503 | 79 | 0.639601 | [
"Apache-2.0"
] | NalediMadlopha/google-python-exercises | venv/lib/python2.7/site-packages/mpl_toolkits/tests/test_axes_grid1.py | 6,121 | Python |
"""
Off Multipage Cheatsheet
https://github.com/daniellewisDL/streamlit-cheat-sheet
@daniellewisDL : https://github.com/daniellewisDL
"""
import streamlit as st
from pathlib import Path
import base64
from modules.toc import *
# Initial page config
st.set_page_config(
page_title='Code Compendium Intro Page',
... | 27.259259 | 228 | 0.65942 | [
"MIT"
] | rypaik/Streamlit_Ref | .history/pages/intro_20220303154534.py | 8,853 | Python |
from setuptools import setup
setup(
name='geompy',
version='0.1.0',
description='Tools for Euclidean Geometry.',
url='https://github.com/qthequartermasterman/geometry',
author='Andrew P. Sansom',
author_email='AndrewSansom@my.unt.edu',
license='MIT',
packages=['geompy'],
install_req... | 20.068966 | 59 | 0.558419 | [
"MIT"
] | qthequartermasterman/geometry | setup.py | 582 | Python |
import sys
import decimal
from svg.path import Path, Line, Arc, CubicBezier, QuadraticBezier
from svg.path import parse_path
import xml.etree.ElementTree as ET
def frange(x, y, jump):
while x < y:
yield x
x += jump
ns = {'svg': 'http://www.w3.org/2000/svg'}
inputfile = sys.argv[1];
tree = ET.parse(inputfil... | 30.270833 | 391 | 0.659326 | [
"MIT"
] | RodrigoD27avila/TCC2 | tests/teste1/parse_svg.py | 1,453 | Python |
"""This module contains common functions-helpers of the client and agents.
Copyright (c) 2018 http://reportportal.io .
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/... | 33.285714 | 78 | 0.655482 | [
"Apache-2.0"
] | jyejare/client-Python | reportportal_client/helpers.py | 2,563 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-08 12:24
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [("campusonline", "0010_auto_20171002_1450")]
forward = [
"""
... | 28.954545 | 88 | 0.560963 | [
"BSD-2-Clause"
] | medunigraz/outpost.django.campusonline | src/outpost/django/campusonline/migrations/0011_events.py | 1,911 | Python |
def neighbord_analysis(x_as, column = 0):
"""
Given an array xas this function compute the distance between the elements the mean distance and the variance
Author: Michele Monti
Args:
x_as: the name of the list or data set that you want:
Kwargs:
column: is the column of the data set that you need to ana... | 29.068966 | 110 | 0.742586 | [
"BSD-2-Clause"
] | Repythory/Libraries | amolf/numerical_data_analysis/NeighbourAnalysis.py | 843 | Python |
"""
Copyright (c) 2018 Doyub Kim
I am making my contributions/submissions to this project solely in my personal
capacity and am not conveying any rights to any intellectual property of any
third parties.
"""
import pyjet
import unittest
import numpy as np
class ParticleSystemData2Tests(unittest.TestCase):
def t... | 29.567901 | 78 | 0.571399 | [
"MIT"
] | Whitemane/fluid-engine-dev | src/tests/python_tests/particle_system_data_tests.py | 4,790 | Python |
#!/usr/bin/env python3
# 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.
"""
The RPM-related plugins need to be composed in a specific way with one
another, and with the plugin that handles sh... | 39.441558 | 79 | 0.659532 | [
"MIT"
] | baioc/antlir | antlir/nspawn_in_subvol/plugins/rpm.py | 6,074 | Python |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from pants.backend.python.subsystems.ipython import IPython
from pants.backend.python.util_rules.local_dists import LocalDistsPex, LocalDistsPexRequest
from pants.backend.python.... | 34.442424 | 99 | 0.705965 | [
"Apache-2.0"
] | Eric-Arellano/pants | src/python/pants/backend/python/goals/repl.py | 5,683 | Python |
# Copyright 2018 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 applica... | 39.018692 | 80 | 0.659641 | [
"Apache-2.0"
] | LinMiaoShuSheng/models | official/resnet/keras/keras_benchmark.py | 4,175 | 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 t... | 34.909091 | 74 | 0.75651 | [
"Apache-2.0"
] | 1ap/google-api-python-client | tests/__init__.py | 768 | Python |
# -*- coding: utf-8 -*-
#
# pytest-dasktest documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 1 00:43:18 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | 32.801394 | 116 | 0.719567 | [
"MIT"
] | mariusvniekerk/pytest-dask | docs/conf.py | 9,414 | Python |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import sys
sys.path.append('./')
from update import BasicUpdateBlock, SmallUpdateBlock
from extractor import BasicEncoder, SmallEncoder
from corr import CorrBlock, AlternateCorrBlock
from util import bilinear_sampler, coords_grid, u... | 34.024691 | 102 | 0.583817 | [
"MIT"
] | aharley/track_check_repeat | nets/raft_core/backraft.py | 5,512 | Python |
#!/usr/bin/env python
import subprocess
from pathlib import Path
from distutils.cmd import Command
from setuptools import setup, find_packages
# pylint: disable=unused-import
import fastentrypoints # noqa: F401
# pylint: enable=unused-import
import howdoi
class Lint(Command):
"""A custom command to run Flake8 o... | 26.627273 | 87 | 0.593377 | [
"MIT"
] | AliRaza954/howdoi | setup.py | 2,929 | Python |
from __future__ import print_function
from __future__ import absolute_import
# Copyright (c) 2003-2016 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# -*- mode: python; tab-... | 36.561546 | 199 | 0.589649 | [
"BSD-3-Clause"
] | AymenSe/turicreate | deps/src/curl-7.65.1/tests/python_dependencies/impacket/nmb.py | 35,940 | Python |
#! /usr/bin/env python
# coding:utf-8
import unittest
from kovot.response import Response
from kovot.response import ResponseTransformer
from kovot.response import ResponseSelector
class ResponseTest(unittest.TestCase):
def test_response(self):
text = "京都にいます"
score = 1.2
res = Response(... | 29.840909 | 63 | 0.626809 | [
"MIT"
] | kazh98/kovot | test/test_response.py | 1,385 | Python |
class RGB:
def __init__(self, red=0, green=0, blue=0):
self.r = 0
self.g = 0
self.b = 0
self.red = red
self.green = green
self.blue = blue
@property
def red(self):
return self.r
@red.setter
def red(self, value):
if isinstance(value, i... | 28.329114 | 95 | 0.503575 | [
"MIT"
] | reggyred/siiembeddedsign | src/embled/colors.py | 2,238 | Python |
import random
# create the initial array
regionsEMEA = ["Central Eastern Europe", "France", "Germany", "Middle East / Africa", "United Kingdom", "Western Europe"]
# randomly pick region after region
num = len(regionsEMEA)
for x in range(num):
numRegions = len(regionsEMEA)
pos = random.randint(0,numRegions-1)
... | 28.357143 | 121 | 0.712846 | [
"MIT"
] | jansche/EMEARegionsRandomizer | randEMEA.py | 397 | Python |
import collections
from typing import Iterator
import itertools
from stream_lib.stream_api import Stream, T
class ItertoolsStream(Stream[T]):
@staticmethod
def stream(*iterables: Iterator[T]):
if len(iterables) == 1:
return ItertoolsStream(*iterables)
else:
return Ite... | 26.829787 | 70 | 0.660587 | [
"MIT"
] | flegac/deep-experiments | stream-lib/stream_lib/itertools_stream.py | 1,261 | Python |
from .history.pyplot_history import pyplot_history
from .history.plotly_history import plotly_history
def plot_history(history, engine="pyplot", **kwargs):
if engine == "pyplot":
return pyplot_history(history, **kwargs)
elif engine == "plotly":
return plotly_history(history, **kwargs)
else... | 31.083333 | 53 | 0.710456 | [
"MIT"
] | krzpiesiewicz/pytorch-fit | pytorch_fit/visuals/plot.py | 373 | Python |
import logging
from typing import Callable, TypeVar, List, Optional, Dict
import ray
from ray.exceptions import RayActorError
from ray.util.sgd.v2.worker_group import WorkerGroup
from ray.util.sgd.v2.session import init_session, get_session, shutdown_session
T = TypeVar("T")
logger = logging.getLogger(__name__)
cl... | 37.365462 | 79 | 0.592863 | [
"Apache-2.0"
] | cuongnvan/ray | python/ray/util/sgd/v2/backends/backend.py | 9,304 | Python |
from django.test import TestCase
from authors.apps.authentication.models import User
class UserModelTest(TestCase):
"""
Test Suite for the User model class, User authentication.
"""
def test_create_user(self):
"""
Test User model can create a user successfully
"""
sel... | 27.736842 | 64 | 0.580645 | [
"BSD-3-Clause"
] | andela/ah-bird-box | authors/apps/authentication/tests/test_create_user.py | 527 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright 2018-2020 New York University Abu Dhabi
#
# 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, inclu... | 36.40796 | 79 | 0.584859 | [
"MIT"
] | AhmedYounes94/Camel_tools | camel_tools/cli/camel_transliterate.py | 7,318 | Python |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 7 16:41:25 2011
@author: -
"""
import os;
import time;
import sys;
import plot_pca_functions;
import numpy as np
import matplotlib.pyplot as plt
import math
taylor_error_capitol= 0.608546356589;
pca_error_9_capitol = 0.614236131016; #at 10% sample-training
taylor_err... | 20.304348 | 68 | 0.755889 | [
"BSD-2-Clause"
] | mirestrepo/voxels-at-lems | bvpl/bvpl_octree/taylor_vs_pca.py | 467 | Python |
# encoding: UTF-8
import os
print u'load {0}/*'.format(os.path.dirname(__file__))
# 默认设置
from chinese import text
# 是否要使用英文
from vnpy.trader.vtGlobal import globalSetting
if globalSetting['language'] == 'english':
from english import text | 20.416667 | 53 | 0.742857 | [
"MIT"
] | CjoneL/vnpy | vnpy/trader/gateway/ctpGateway/language/__init__.py | 267 | Python |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | 38.96124 | 120 | 0.65579 | [
"Apache-2.0"
] | king4arabs/mindspore | tests/ut/python/dataset/test_random_color.py | 10,052 | Python |
# -*- coding: utf-8 -*-
check_state = 0
d = {}
p = []
e = []
m = []
n = int(input())
for _ in range(n):
ln = input().split()
d[ln[0]] = (int(ln[1]), int(ln[2]), int(ln[3]))
p.append(int(ln[1]))
e.append(int(ln[2]))
m.append(int(ln[3]))
while True:
if check_state == 0:
if p.cou... | 17.413223 | 74 | 0.320361 | [
"MIT"
] | ErFer7/URI-Python | 2654.py | 2,110 | Python |
import numpy as np
from math import *
import pymultinest
import sys
sys.path.insert(0, '/home/kochenma/pysb')
from pysb.integrate import Solver
import csv
import datetime
import time as tm
from model_550 import model
from pysb.pathfinder import set_path
set_path('bng', '/home/kochenma/BioNetGen')
data_object = []
wi... | 25.610526 | 237 | 0.671599 | [
"MIT"
] | LoLab-VU/Bayesian_Inference_of_Network_Dynamics | log_casp_act/run_model_550.py | 2,433 | Python |
# encoding: utf-8
"""
parse_process.py
Created by Thomas Mangin on 2015-06-05.
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
import time
import copy
from collections import defaultdict
from exabgp.configuration.core import Section
from exabgp.configura... | 22.755556 | 125 | 0.608154 | [
"BSD-3-Clause"
] | RIPE-NCC/exabgp | lib/exabgp/configuration/neighbor/api.py | 4,096 | Python |
# Copyright 2018 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 applica... | 42.996732 | 145 | 0.751995 | [
"Apache-2.0"
] | AnyaTracy/tensorflow | tensorflow/python/ops/boosted_trees_ops.py | 13,157 | Python |
# --------------
# Code starts here
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import Imputer
from sklearn.preprocessing import LabelEncoder
import numpy as np
from scipy.stats import skew
#### Data 1
# Load the data
df = pd.read_csv(path)
# Overview of the data
df.info()
df.descr... | 21.988506 | 85 | 0.716153 | [
"MIT"
] | NishthaShukla/eda | code.py | 1,913 | Python |
class CookieContainer(object):
"""
Provides a container for a collection of System.Net.CookieCollection objects.
CookieContainer()
CookieContainer(capacity: int)
CookieContainer(capacity: int,perDomainCapacity: int,maxCookieSize: int)
"""
def ZZZ(self):
"""hardcoded/mock instance of the class"""... | 41.403509 | 172 | 0.730932 | [
"MIT"
] | tranconbv/ironpython-stubs | release/stubs.min/System/Net/__init___parts/CookieContainer.py | 4,720 | Python |
class Solution(object):
def changebase(self, n, base):
digits = "0123456789ABCDEF"
remstack = []
while n > 0:
rem = n % base
remstack.append(rem)
n = n / base
newString = ""
while not len(remstack) == 0:
newString += digits[remstack.pop()]
return newString
... | 21.3 | 46 | 0.544601 | [
"MIT"
] | quake0day/oj | changebase.py | 639 | Python |
"""Retrieve county->CBSA crosswalk file from the NBER"""
from collections import defaultdict
import unicodecsv as csv
import logging
import requests
from utils.fs import cache_json
URL = 'http://www.nber.org/cbsa-msa-fips-ssa-county-crosswalk/2016/cbsatocountycrosswalk2016.csv'
@cache_json('cbsa_lookup.json')
def c... | 30.970588 | 97 | 0.68471 | [
"MIT"
] | squatter1/skills-ml | datasets/nber_county_cbsa.py | 1,053 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Config(object):
DEBUG = True
RELOADER = True
PORT = 8080
class DevelopmentConfig(Config):
pass
class ProductionConfig(Config):
DEBUG = False
RELOADER = False
| 15.8 | 32 | 0.64557 | [
"BSD-3-Clause"
] | bsmithgall/cookiecutter-kindergarten | {{ cookiecutter.app_name }}/{{ cookiecutter.app_name }}_backend/{{ cookiecutter.app_name }}/config.py | 237 | Python |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.spectral_norm as spectral_norm
import math
import numpy as np
import torchvision.models as models
from modules.networks import get_pad
from torch.distributions.multivariate_normal import MultivariateNormal
from util.utils import l... | 44.399156 | 217 | 0.667744 | [
"Apache-2.0"
] | avalonstrel/SketchBERT | models/SketchTransformer/models/networks.py | 52,613 | Python |
import binascii
import re
try:
import json
except:
import simplejson as json
# Inserting certain referenced dicts in here means they can be declared in the same order as in the spec.
maps = {}
# SMPP PDU Definition - SMPP v3.4, section 4, page 45
mandatory_parameter_lists = {
'bind_transmitter': [ # S... | 73.97561 | 188 | 0.513138 | [
"BSD-3-Clause"
] | komuW/smpp_server | smpp/__init__.py | 78,858 | Python |
# Copyright 2018 Iguazio
#
# 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, softwa... | 33.814286 | 83 | 0.586608 | [
"Apache-2.0"
] | AlonMaor14/mlrun | mlrun/runtimes/function_reference.py | 4,734 | Python |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class HypervBackupEnvParams(object):
"""Implementation of the 'HyperVBackupEnvParams' model.
Message to capture any additional backup params for a HyperV environment.
Attributes:
allow_crash_consistent_snapshot (bool): Whether to fallback t... | 29.654545 | 88 | 0.67198 | [
"Apache-2.0"
] | anoopbhat/management-sdk-python | cohesity_management_sdk/models/hyperv_backup_env_params.py | 1,631 | Python |
from {{ project_name }}.settings.base import * # noqa: F401, F403
| 33.5 | 66 | 0.686567 | [
"MIT"
] | pennlabs/labs-django-startproject | project_name/settings/staging.py | 67 | Python |
""" This file contains SPRKKRAtoms - an enhanced version of Atoms to be used
with SPRKKR """
from ase import Atoms
from ..common.unique_values import UniqueValuesMapping
import spglib
from ase.spacegroup import Spacegroup
import numpy as np
from ..sprkkr.sites import Site
from ..common.misc import numpy_index
class ... | 39.161512 | 117 | 0.612496 | [
"MIT"
] | ase2sprkkr/ase2sprkkr | src/ase2sprkkr/sprkkr/sprkkr_atoms.py | 11,396 | Python |
"""
Open Orchestrator Cloud Radio Access Network
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... | 41.531915 | 109 | 0.456967 | [
"Apache-2.0",
"BSD-3-Clause"
] | howls90/OOCRAN | oocran/django/images/forms.py | 1,952 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 8 23:53:58 2019
@author: yanyanyu
"""
from spark import start_spark
from pyspark import SparkConf
from pyspark import SparkFiles
from pyspark.sql import Row
def main():
spark,conf=start_spark()
steps_per_floor_=conf['steps_per_floor']
... | 27.87931 | 144 | 0.66914 | [
"Apache-2.0"
] | nancyyanyu/mini_projects | examples_pyspark/pyspark_small_project/etl_job.py | 1,617 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('report_database', '0003_auto_20160501_164... | 25.590909 | 99 | 0.673179 | [
"MIT"
] | MikeVerdicchio/SafeCollab | report_database/migrations/0004_report_shared_users.py | 563 | Python |
from kafka import KafkaConsumer
consumer = KafkaConsumer('primeiro', bootstrap_servers='hdpdemo.local:6667', group_id='my_favorite_group')
for msg in consumer:
print(msg)
| 29.333333 | 106 | 0.789773 | [
"MIT"
] | thiagonogueira/fiap | abd/ingestao de dados/demo_ingestao/kafka_python/consumer_group.py | 176 | Python |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# https://aws.amazon.com/apache2.0/
#
# or in the "license" file accomp... | 36.232143 | 77 | 0.720059 | [
"Apache-2.0"
] | GabrielFraga962/boto3 | tests/functional/test_resource.py | 2,029 | Python |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
# The header block is where all import statements should live
from __future__ import print_function
import os
import re
import uuid
import requests
import json
import psutil
import subprocess
import numpy as np
import yaml
import time
from pprint import pformat
from installed_clie... | 46.824096 | 143 | 0.594097 | [
"MIT"
] | mclark58/kb_SPAdes | lib/kb_SPAdes/kb_SPAdesImpl.py | 38,864 | Python |
import os
import tensorflow as tf
from tensorkit.log import logger, Color
class Restore(object):
def __init__(self):
self._var_list = None
self._restore_saver = None
self._restore_optimistic = False
self.restore_ckpt_file = None
self._inited = False
def init(self, va... | 42.225225 | 109 | 0.588436 | [
"MIT"
] | nonu116/HDR-GAN | tensorkit/restore.py | 4,687 | Python |
import config as c
import random as r
def print_map(map_grid):
print("= " * (len(map_grid) + 2))
for row in map_grid:
print("||", end='')
print(*row, sep=" ", end='')
print("||")
print("= " * (len(map_grid) + 2))
# Builds map with all of one type of tile
# Should be WALL or FLOOR
d... | 37.315217 | 93 | 0.645791 | [
"MIT"
] | MBogert/dungeon_maker | map.py | 3,433 | Python |
# Nodes represent a definition of a value in our graph of operators.
from typing import TYPE_CHECKING, Union, Callable, Any, Tuple, List, Optional, Dict, Set
from ._compatibility import compatibility
from .immutable_collections import immutable_dict, immutable_list
import torch
import builtins
import types
from ... | 44.253333 | 133 | 0.611216 | [
"MIT"
] | Westlanderz/AI-Plat1 | venv/Lib/site-packages/torch/fx/node.py | 26,552 | Python |
"""
Copyright 2021 Anderson Faustino da Silva
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, ... | 31.732984 | 87 | 0.550074 | [
"Apache-2.0"
] | ComputerSystemsLab/OptimizationCache | examples/algorithms/sga.py | 6,061 | Python |
from flask import Flask
app = Flask(__name__)
app.config.from_object('instapurge.settings')
app.secret_key = app.config['SECRET_KEY']
import instapurge.views
| 20 | 45 | 0.79375 | [
"MIT"
] | kushmansingh/instapurge | instapurge/__init__.py | 160 | Python |
#!/usr/bin/env python
import versioneer
from setuptools import setup
long_description = """\
pg8000
------
pg8000 is a Pure-Python interface to the PostgreSQL database engine. It is \
one of many PostgreSQL interfaces for the Python programming language. pg8000 \
is somewhat distinctive in that it is written entir... | 34.818182 | 79 | 0.679373 | [
"BSD-3-Clause"
] | JonathanRRogers/pg8000 | setup.py | 1,915 | Python |
import os
def app_config(app):
app.config.from_object('src.conf.flask_api_conf')
if os.environ.get('FLASK_API_CONF') is not None:
app.config.from_envvar('FLASK_API_CONF')
sqlalchemy_database_uri_str = os.environ.get('FLASK_API_SQLALCHEMY_DATABASE_URI')
if sqlalchemy_database_uri_str is not Non... | 43.52381 | 125 | 0.793217 | [
"Apache-2.0"
] | chaalia/flask-api | src/conf/app_config.py | 914 | Python |
import numpy as np
import matplotlib.pyplot as plt
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__)))
import plot_settings
from test_utilities import gausspuls_coeff, gausspulse, gauss_ft
# time domain plot
fc = 5e6
bandwidth = 2/3
bwr = -6
t_vals = np.linspace(-3/fc, 3/fc, 200)
h = gausspulse(t_... | 22.411765 | 71 | 0.702537 | [
"MIT"
] | ebezzam/frius | report_results/fig1p6_pulse_shape.py | 1,143 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apibox.settings')
try:
from django.core.management import execute_from_command_line
except Impor... | 28.782609 | 73 | 0.678248 | [
"MIT"
] | woodonggyu/apibox | manage.py | 662 | Python |
#!/usr/bin/python3
import subprocess
import sys
import json
import math
import os
from os.path import expanduser
from tempfile import TemporaryFile
def get_workspace():
handle = subprocess.Popen(
["i3-msg", "-t", "get_workspaces"], stdout=subprocess.PIPE)
output = handle.communicate()[0]
data = js... | 30.791667 | 90 | 0.600361 | [
"MIT"
] | SecLion77/i3_config | scripts/workspace_controller.py | 4,434 | Python |
# this is a library that can be used to update and create parts
# of the bulkdata
import urllib
import json
import time
from django.conf import settings
from apps.bulk.models import Character, Corporation, Alliance
from apps.static.models import Crpnpccorporations
from connection import connection
#Make sure not t... | 32.460784 | 79 | 0.522501 | [
"MIT"
] | Sult/evehub | utils/whoapi.py | 3,311 | Python |
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack 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... | 39.431193 | 79 | 0.646696 | [
"Apache-2.0"
] | Hybrid-Cloud/badam | fs_patches_of_hybrid_cloud/cherry_for_111T/nova_cascaded/nova/virt/vmwareapi/vim_util.py | 8,596 | Python |
####################
# ES-DOC CIM Questionnaire
# Copyright (c) 2017 ES-DOC. All rights reserved.
#
# University of Colorado, Boulder
# http://cires.colorado.edu/
#
# This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT].
####################
from djan... | 41.569519 | 178 | 0.684827 | [
"MIT"
] | ES-DOC/esdoc-questionnaire | Q/questionnaire/views/views_realizations.py | 15,547 | Python |
# -*- coding: utf-8 -*-
# Copyright 2015 OpenMarket Ltd
#
# 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 la... | 31.469565 | 77 | 0.622824 | [
"Apache-2.0"
] | iot-factory/synapse | tests/crypto/test_event_signing.py | 3,619 | Python |
from core.datasource import DataSource
from core.model.member import KarmaMember, Member
# karma database service class, perform operations on the configured mongodb.
from util.config import config, profile
class KarmaService:
def __init__(self):
self._karma = DataSource(config['database']['host'], conf... | 47.428571 | 100 | 0.622239 | [
"MIT"
] | ianagbip1oti/aura | core/service/karma_service.py | 3,984 | Python |
# Copyright 2021 solo-learn development team.
# 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, publ... | 43.84375 | 91 | 0.769066 | [
"MIT"
] | Froskekongen/solo-learn | tests/utils/test_gather.py | 1,403 | Python |
from pdb import set_trace as T
from nmmo import Task
from collections import namedtuple
class Tier:
REWARD_SCALE = 15
EASY = 4 / REWARD_SCALE
NORMAL = 6 / REWARD_SCALE
HARD = 11 / REWARD_SCALE
def player_kills(realm, player):
return player.history.playerKills
def equipmen... | 25.977778 | 76 | 0.652695 | [
"MIT"
] | NeuralMMO/baselines | tasks.py | 1,169 | Python |
import numpy as np
import sys
import os
import re
import ntpath
from subprocess import call
#### DISCLAIMER: This script uses the `pythonSubmit.py` format
#### that has been replaced by the `runSubmit.py` and
#### `compasConfigDefault.yaml` combo as of v02.25.10.
#### The `pythonSubmit.py` format will eventually beco... | 44.583744 | 218 | 0.613088 | [
"MIT"
] | IsobelMarguarethe/COMPAS | utils/example_plots/methods_paper_plots/fig_5_HR_diagram/pythonSubmit.py | 36,202 | Python |
from django.contrib.auth import get_user_model
from django.utils.translation import gettext_lazy as _
from rest_framework import HTTP_HEADER_ENCODING, authentication
from .exceptions import AuthenticationFailed, InvalidToken, TokenError
from .settings import api_settings
AUTH_HEADER_TYPES = api_settings.AUTH_HEADER_T... | 34.168919 | 88 | 0.654143 | [
"MIT"
] | BrianMarquez3/Python-Django | webpersonal/env/Lib/site-packages/rest_framework_simplejwt/authentication.py | 5,057 | Python |
import random
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from .attention import Attention
from .baseRNN import BaseRNN
if torch.cuda.is_available():
import torch.cuda as device
else:
import torch as device
class DecoderRNN(Base... | 46.224299 | 125 | 0.641225 | [
"Apache-2.0"
] | junyongk/pytorch-seq2seq | seq2seq/models/DecoderRNN.py | 9,892 | Python |
import torch
from mmcv import Config
from mmcv.parallel import MMDataParallel
from mmcv.runner import load_checkpoint
from mmdet.apis import single_gpu_mergetiles_visualize
from mmdet.core import wrap_fp16_model
from mmdet.datasets import build_dataloader, build_dataset
from mmdet.models import build_detector
import ... | 30.234375 | 93 | 0.716796 | [
"Apache-2.0"
] | magnificent1208/r3det-on-mmdetection | rtools/dota_result_visualize.py | 1,935 | Python |
#!/usr/bin/env python
# encoding: utf-8
"""
Mobi.py
Created by Elliot Kroo on 2009-12-25.
Copyright (c) 2009 Elliot Kroo. All rights reserved.
"""
import sys
import os
import unittest
from struct import *
from pprint import pprint
import mobi.utils
from mobi.lz77 import uncompress_lz77
class Mobi:
def parse(self) ... | 28.247387 | 179 | 0.634883 | [
"Apache-2.0"
] | cloudylan/dbooklib | dbookbee/mobi/__init__.py | 8,115 | 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 ... | 50.288462 | 244 | 0.678967 | [
"MIT"
] | Co0olboi/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/aio/operations/_security_rules_operations.py | 20,920 | Python |
from .activity import Activity
from .dataset import Dataset
from .utils import from_file
| 18 | 30 | 0.822222 | [
"MIT"
] | b3by/pymudata | pymudata/__init__.py | 90 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.