text stringlengths 4 1.02M | meta dict |
|---|---|
from math import *
import numpy as np
from pyspheregl.utils.transformations import quaternion_matrix
def rotate_cartesian(q, v):
"""Rotate a point in Cartesian coordinates by the given quaternion,
returning a new point in Cartesian space."""
return v + 2.0 * np.cross(q[0:3], np.cross(q[0:3], v) + q[3]*... | {
"content_hash": "f5cd93aefdc7a684a0d5380ac2562ab5",
"timestamp": "",
"source": "github",
"line_count": 498,
"max_line_length": 103,
"avg_line_length": 33.467871485943775,
"alnum_prop": 0.5890682186356273,
"repo_name": "johnhw/pypuffersphere",
"id": "1618339c45d4a7164b2988bc2d6fb54ce71d9dfd",
"size... |
"""
WSGI config for CharlieChat 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import D... | {
"content_hash": "16a13cfe7828c2d72abde8de27d8dfb0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 78,
"avg_line_length": 27.27777777777778,
"alnum_prop": 0.7942973523421588,
"repo_name": "signalw/charliechat",
"id": "47d2b3f3a901aee8b7bf49a930e461ecbf3258fd",
"size": "4... |
from django.db import models
"""
Representa las opciones de estados que tiene cada título nacional
"""
class EstadoPostituloNacional(models.Model):
NO_VIGENTE = u'No vigente'
VIGENTE = u'Vigente'
nombre = models.CharField(max_length=50, unique=True)
class Meta:
app_label = 'postitulos'
... | {
"content_hash": "027f97f3fee88be3cdbb6c2a53bdab1a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 24.105263157894736,
"alnum_prop": 0.6681222707423581,
"repo_name": "MERegistro/meregistro",
"id": "aa96d1e215106903c90d107401a61546403bed52",
"size":... |
from nltk import metrics
class LevenshteinReduce(object):
def __init__(self, phrase, tracks):
"""
:param phrase: (str) phrase or ngram
:param tracks: (list) tacks to perform best string matching with
:return: Returns the track from the list of tracks best matching the given phrase... | {
"content_hash": "6abe26d5d0ee55d495d0d036d79a41f8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 89,
"avg_line_length": 31.902439024390244,
"alnum_prop": 0.5412844036697247,
"repo_name": "husman/WoTrack",
"id": "e5359c7a899e33237e91249d8aac31e4c15f1026",
"size": "1308"... |
"""
Template tags used in admin or board
"""
from django import template
register = template.Library()
@register.filter(name='calcul_indent')
def calcul_indent(value, coef=20):
return (value+1)*coef
| {
"content_hash": "e9acf5f89dc84b9f7e810c8fec0292a6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 20.5,
"alnum_prop": 0.7268292682926829,
"repo_name": "sveetch/sveedocuments",
"id": "2eae1fbdb98c0cf9ca2d33af7d3de3db2724dc60",
"size": "229",
"bin... |
"""The users module."""
from . import views | {
"content_hash": "1d826f7c5da5fd1444fbb43a5d65d90a",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 23,
"avg_line_length": 14.666666666666666,
"alnum_prop": 0.6590909090909091,
"repo_name": "dtnewman/zappa_boilerplate",
"id": "83e231a187b94b68b53de33c94adc0d8d2a8d189",
"si... |
import gzip
import io
from ..file import _File
from .base import NonstandardExtHDU
from .hdulist import HDUList
from ..header import Header, _pad_length
from ..util import fileobj_name
from ....utils import lazyproperty
class FitsHDU(NonstandardExtHDU):
"""
A non-standard extension HDU for encapsulating ent... | {
"content_hash": "68bbe43e1b9135bc44461e1a54c3c221",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 80,
"avg_line_length": 32.368852459016395,
"alnum_prop": 0.5907824765763484,
"repo_name": "DougBurke/astropy",
"id": "c2c811aad6b3729ae6b1928c212e7821d71797e2",
"size": "4... |
"""
oar.rest_api.views.resource
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Define resources api interaction
"""
from __future__ import division
from flask import url_for, g
from oar.lib import db
from oar.lib.models import Resource
from . import Blueprint
from ..utils import Arg
app = Blueprint('resources', __name__, url_prefix... | {
"content_hash": "08547dd68120119bbc6cfa1624e71d72",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 79,
"avg_line_length": 31.192307692307693,
"alnum_prop": 0.6017262638717632,
"repo_name": "fr0uty/oartm",
"id": "3d2cc725d91eb390b3efbd3b22edc24899b68581",
"size": "2481",
... |
import json
data = dict()
with open("config/config.json") as config_data:
data['config'] = json.load(config_data)
with open("config/creds.json") as creds_data:
data['creds'] = json.load(creds_data)
| {
"content_hash": "50b54b761541e48469bf4a211f06964f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 47,
"avg_line_length": 22.555555555555557,
"alnum_prop": 0.6995073891625616,
"repo_name": "competitiveoverwatch/RankVerification",
"id": "184f3876dfb5519867065aca89b780e6c8c67... |
import logging
from box import CredentialsV2, BoxClient
from box.client import BoxClientException
from modularodm import fields
import requests
from framework.auth import Auth
from framework.exceptions import HTTPError
from website.addons.base import exceptions
from website.addons.base import AddonOAuthUserSettingsB... | {
"content_hash": "1938c5656fd381d8d712f1463458de53",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 144,
"avg_line_length": 32.36649214659686,
"alnum_prop": 0.6041734066645099,
"repo_name": "abought/osf.io",
"id": "d9e030f231bc40d4b7ba753afa9044150319ea74",
"size": "6206... |
import sys
import numpy as np
from spinalcordtoolbox.image import Image, empty_like, add_suffix
from spinalcordtoolbox.utils import SCTArgumentParser, Metavar, parse_num_list, init_sct, printv, set_loglevel
# PARAMETERS
class Param(object):
# The constructor
def __init__(self):
self.almost_zero = np... | {
"content_hash": "15f5c3f1e97c8ded4dd990e5bd911763",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 120,
"avg_line_length": 45.01901140684411,
"alnum_prop": 0.597972972972973,
"repo_name": "neuropoly/spinalcordtoolbox",
"id": "d78b441d3bbe7ca8b6123b61befa536c5e5904a9",
"... |
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.views.generic import TemplateView, ListView, FormView, DetailView
from django.core.exceptions import PermissionDenied
from net.model... | {
"content_hash": "d8f6d98473ef95922b84c9aefb48e2f2",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 118,
"avg_line_length": 38.9572192513369,
"alnum_prop": 0.5922443376801647,
"repo_name": "dehu4ka/lna",
"id": "4ebfbc4fee1e04634408737c452de9e17245d0c3",
"size": "14718",
... |
"""
MSDP (Mud Server Data Protocol)
This implements the MSDP protocol as per
http://tintin.sourceforge.net/msdp/. MSDP manages out-of-band
communication between the client and server, for updating health bars
etc.
"""
import re
from src.utils.utils import to_str
# MSDP-relevant telnet cmd/opt-codes
MSDP = chr(69)
... | {
"content_hash": "b052279ca32ef80b2276b012cc14e8dc",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 93,
"avg_line_length": 38.13991769547325,
"alnum_prop": 0.5700258955545965,
"repo_name": "Pathel/deuterium",
"id": "aa36bd65d828b5cb2b00732f8d2c311234765413",
"size": "926... |
from application.views import app
import unittest
import os
class TestRoutes(unittest.TestCase):
def setUp(self):
app.config.from_object(os.environ.get('SETTINGS'))
self.app = app.test_client()
def test_health(self):
self.assertEqual((self.app.get('/health')).status, '200 OK')
| {
"content_hash": "a69ba3c15c38364bc2dcd2c022f5452b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 68,
"avg_line_length": 26.083333333333332,
"alnum_prop": 0.6773162939297125,
"repo_name": "Skablam/flask-spawn",
"id": "0667c6934a17efde55ba0d8a6f64d5a460b2a18e",
"size": "... |
__author__ = 'ray'
__date__ = '6/12/14'
"""
georest.storage.exceptions
~~~~~~~~~~~~~~~~~~~~~~~~~~
Geo Feature Storage Exceptions.
"""
from ..geo.exceptions import *
class StorageError(GeoException):
pass
class StorageInternalError(StorageError):
HTTP_STATUS_CODE = 500
class UnknownStoragePro... | {
"content_hash": "c1e5a6665e0c41d00781a7b454e4b29f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 44,
"avg_line_length": 16.80952380952381,
"alnum_prop": 0.6912181303116147,
"repo_name": "Kotaimen/georest",
"id": "cab65989b9f0bfe3210741925cafd171942f3e68",
"size": "733"... |
"""set the sip version, cause pandas-qt uses version 2 by default"""
import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)
from PyQt4 import QtGui
import pandas
import pandasqt
import numpy
"""setup a new empty model"""
model = pandasqt.DataFrameModel()
"""setup an application and create a table view widget"... | {
"content_hash": "dc44da8ed649dd2881b9208312cf7f6f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 25.571428571428573,
"alnum_prop": 0.7251396648044692,
"repo_name": "szaiser/pandas-qt",
"id": "79803f43be8da2047bcecc43e836ee507b8ea0da",
"size": "89... |
from bbfetchext import * | {
"content_hash": "bb3a7b017d4262f09a4f18757d33f3cc",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 24,
"avg_line_length": 24,
"alnum_prop": 0.8333333333333334,
"repo_name": "Equitable/trump",
"id": "47c32bfd8993ff566f0c332ae4bf39b5bf5edf8e",
"size": "24",
"binary": fals... |
import proto # type: ignore
from google.ads.googleads.v11.enums.types import (
response_content_type as gage_response_content_type,
)
from google.ads.googleads.v11.resources.types import (
campaign_budget as gagr_campaign_budget,
)
from google.protobuf import field_mask_pb2 # type: ignore
from google.rpc imp... | {
"content_hash": "0df45c32b4486a446786bc78d358a3fb",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 129,
"avg_line_length": 37.33974358974359,
"alnum_prop": 0.6727896995708155,
"repo_name": "googleads/google-ads-python",
"id": "8a998c2fde70adc7e3b782fb5e6376706451bfd5",
... |
import os
from kubernetes import client
from oslo_utils import uuidutils
from unittest import mock
from tacker import context
from tacker.sol_refactored.common import exceptions as sol_ex
from tacker.sol_refactored.common import vnfd_utils
from tacker.sol_refactored.infra_drivers.kubernetes import kubernetes
from tac... | {
"content_hash": "6f6d4d784e1a2f3577469280ef553954",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 76,
"avg_line_length": 42.16475095785441,
"alnum_prop": 0.616356201726488,
"repo_name": "openstack/tacker",
"id": "e35d202168445b2ffa177490da99891ff1003492",
"size": "1163... |
from html import HTML
import json
from .data import Data
from .grid import Grid
from .axes import Axes
from .legend import Legend
from .tooltip import Tooltip
from .regions import Regions
from .point import Point
from .size import Size
from .padding import Padding
class Chart(object):
"""
Create and modify a ... | {
"content_hash": "28870464d1241a127a65262a85745b23",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 114,
"avg_line_length": 27.480662983425415,
"alnum_prop": 0.5679533574587857,
"repo_name": "h0s/c3py",
"id": "e68a1553246cc09ddbd474cd116423919326591f",
"size": "4974",
... |
import numpy
import pyamgcl_ext
from pyamgcl_ext import coarsening, relaxation, solver_type
from scipy.sparse.linalg import LinearOperator
class make_solver:
"""
Iterative solver preconditioned by algebraic multigrid
The class builds algebraic multigrid hierarchy for the given matrix and
uses the hier... | {
"content_hash": "65db17242ccd08c316ad5c2d829fb7f5",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 91,
"avg_line_length": 33.851351351351354,
"alnum_prop": 0.5904191616766467,
"repo_name": "huahbo/amgcl",
"id": "e80ea144b025b128275d0f78957002a810945d2f",
"size": "5010",... |
from unittest import TestCase
import numpy as np
import pandas as pd
from rosie.chamber_of_deputies.classifiers.monthly_subquota_limit_classifier import MonthlySubquotaLimitClassifier
class TestMonthlySubquotaLimitClassifier(TestCase):
'''Testing Monthly Subquota Limit Classifier.
To include new test cases... | {
"content_hash": "2261e94d2bc125bb7344d7f879eda0df",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 122,
"avg_line_length": 36.029411764705884,
"alnum_prop": 0.6787755102040817,
"repo_name": "marcusrehm/serenata-de-amor",
"id": "76fa23db904e0294389d7d1c321bd2383f296187",
... |
"""
WSGI config for librosmasvendidos 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJ... | {
"content_hash": "4d63b2e8c60d6ebf8cdbf3c4ade687e4",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.6875,
"alnum_prop": 0.781021897810219,
"repo_name": "sn1k/listadelibros",
"id": "53f1c7924f5603db7bbcc4ba62d7a1cb7baf4c60",
"size": "411",
"bina... |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
def anyfactor():
iris = h2o.import_file(path=pyunit_utils.locate("smalldata/iris/iris.csv"))
# frame (positive example)
assert iris.anyfactor(), "Expected true, but got false. Column 5 is a factor."
# fr... | {
"content_hash": "67c0805a39fe05cab4d228533a515ec1",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 95,
"avg_line_length": 24.09375,
"alnum_prop": 0.6562905317769131,
"repo_name": "h2oai/h2o-dev",
"id": "f92795e81030754707ad48fa623fa2a84a626465",
"size": "771",
"binary"... |
from django.http import HttpResponse
import json
from zipfile import ZipFile
from metashare import settings
from django.db.models import Q
from django.shortcuts import get_object_or_404
from metashare.storage.models import StorageObject, MASTER, PROXY, INTERNAL, \
REMOTE
def inventory(request):
if settings.SY... | {
"content_hash": "441199d3e214e26b360838685e2bb215",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 102,
"avg_line_length": 48.888888888888886,
"alnum_prop": 0.696969696969697,
"repo_name": "MiltosD/CEF-ELRC",
"id": "4368be2c3d0a31a03a7fa6fe24ef84f15780d232",
"size": "396... |
"""Implementation of SQLAlchemy backend."""
import collections
import datetime as dt
import functools
import re
import sys
import threading
import time
import uuid
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_db import options
from oslo_db.sqlalchemy import session as db_session
from... | {
"content_hash": "58bfdd3a037fecb93f52e794016f1842",
"timestamp": "",
"source": "github",
"line_count": 4515,
"max_line_length": 81,
"avg_line_length": 35.10299003322259,
"alnum_prop": 0.597457252823522,
"repo_name": "HybridF5/jacket",
"id": "26e94fc13c46242917904460307918e97d20f721",
"size": "1593... |
from random import random, choice, randint
from string import printable
from collections import Counter
from nose.tools import assert_raises
from importlib import import_module
from feature import *
def randstr(length=12):
return "".join([choice(printable) for _ in range(length)])
def test_setter_extended():
... | {
"content_hash": "74c10160b857f22fae83297d69c58b63",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 91,
"avg_line_length": 24.44559585492228,
"alnum_prop": 0.5494913098770665,
"repo_name": "slyrz/feature",
"id": "fce582ac93796997d4db18f9cc7641594d84bd44",
"size": "9436",... |
"""
=======
License
=======
Copyright (c) 2015 Thomas Lehmann
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 u... | {
"content_hash": "2c95d4cc9a642398d1c3af1b3a6b7a62",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 93,
"avg_line_length": 42.13513513513514,
"alnum_prop": 0.72674791533034,
"repo_name": "Nachtfeuer/concept-py",
"id": "3798ec7a6b8a6a7f7f48a4b5c43b8e1b0e8b4f8b",
"size": "1... |
import mysql.connector
from objects import Cart
from objects import Product
config = {
'user':'shop',
'password':'pass',
'host':'localhost',
'database':'webshop'
}
#Assign decimal precision
import decimal
decimal.getcontext().prec = 3
# Get products, with query options
# If userId is given, inner jo... | {
"content_hash": "e655de7bcb0e4fa5ff80334cf8bcdbbf",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 154,
"avg_line_length": 28.242798353909464,
"alnum_prop": 0.5241148185924522,
"repo_name": "alamminsalo/py-webshop",
"id": "20c3a21ab15f5c006d2cf24f7f08120d88fbcf33",
"siz... |
from a10sdk.common.A10BaseClass import A10BaseClass
class Oper(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param time: {"type": "string", "format": "string"}
:param offset: {"type": "string", "format": "string"}
:param date: {"type": "string", "format": "str... | {
"content_hash": "f811e9b713bb8d885793220f45b4f78f",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 116,
"avg_line_length": 26.96969696969697,
"alnum_prop": 0.5837078651685393,
"repo_name": "a10networks/a10sdk-python",
"id": "6746313b1526a7fd167fc129644be25c6bd38a32",
"si... |
"""Configure py.test."""
import json
from unittest.mock import PropertyMock, patch
import pytest
from tests.common import load_fixture
@pytest.fixture(name="tomorrowio_config_flow_connect", autouse=True)
def tomorrowio_config_flow_connect():
"""Mock valid tomorrowio config flow setup."""
with patch(
... | {
"content_hash": "c9db8b970d2d17b05e0be0c0c44a7e4b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 86,
"avg_line_length": 35.48571428571429,
"alnum_prop": 0.7069243156199678,
"repo_name": "mezz64/home-assistant",
"id": "2d36d68c57a76875e14f3a738619fdeb8f33cc7e",
"size": ... |
import requests
keywords = ['politics', 'us', 'world', 'technology', 'sports', 'business', 'entertainment', 'science', 'health']
states = {
'AK': 'Alaska',
'AL': 'Alabama',
'AR': 'Arkansas',
'AS': 'American Samoa',
'AZ': 'Arizona',
'CA': 'California',
'CO': 'Colo... | {
"content_hash": "046e35b19e27ffc040cc6eaa9c20dbec",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 112,
"avg_line_length": 29.357142857142858,
"alnum_prop": 0.59721300597213,
"repo_name": "srujant/MLNews",
"id": "79e9481a3e91f289dbd6b7931c17e92e4d123168",
"size": "4521"... |
__author__ = 'calvin'
import contextlib
from future.utils import iteritems
from .property import Property
from .exceptions import *
class EventDispatcher(object):
def __init__(self, *args, **kwargs):
self.event_dispatcher_event_callbacks = {}
self.event_dispatcher_properties = {}
bindings... | {
"content_hash": "72f05178db279791c1d9c1cb843377d0",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 117,
"avg_line_length": 45.15813953488372,
"alnum_prop": 0.6037696982181481,
"repo_name": "lobocv/eventdispatcher",
"id": "5ad7d48ae2e6d6e7726c13d491897ed6e22d08b1",
"size... |
"""
Tests for NetApp API layer
"""
import ddt
from lxml import etree
import mock
from oslo_utils import netutils
import paramiko
import six
from six.moves import urllib
from cinder import exception
from cinder.i18n import _
from cinder import test
from cinder.tests.unit.volume.drivers.netapp.dataontap.client import (
... | {
"content_hash": "0ae8d86e7158352b404d37a44001bf2e",
"timestamp": "",
"source": "github",
"line_count": 549,
"max_line_length": 79,
"avg_line_length": 41.697632058287795,
"alnum_prop": 0.5887209505504106,
"repo_name": "Datera/cinder",
"id": "537f8996c9b432c606cf685090a77a30fa548312",
"size": "23756... |
from __future__ import division
from __future__ import print_function
from past.utils import old_div
import sys
import pmagpy.pmag as pmag
#
#
def main():
"""
NAME
measurements_normalize.py
DESCRIPTION
takes magic_measurements file and normalized moment by sample_weight and sample_volume... | {
"content_hash": "7378f2adc098c3f37d2aa85e8698d3a0",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 139,
"avg_line_length": 37.44117647058823,
"alnum_prop": 0.600942655145326,
"repo_name": "Caoimhinmg/PmagPy",
"id": "98178b0735e1c03af17b14be2446500ec6a3b9f7",
"size": "256... |
from gii.core import *
from freejoy import Joystick, getJoystickCount
from MOAIRuntime import getAKU
##----------------------------------------------------------------##
class MOAIJoystickSensorGetter():
def __init__( self, joyId ):
joyName = 'joy-%d' % joyId
#button - keyboard sensor
self.buttonSensorName = j... | {
"content_hash": "095e0ba846eef1aa07752a1b44d00f84",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 68,
"avg_line_length": 30.62962962962963,
"alnum_prop": 0.6727126158806933,
"repo_name": "tommo/gii",
"id": "52fe39990b602f3bc752e9a684ccd5f7be678ac7",
"size": "2481",
"b... |
import mock
import datetime as dt
from nose.tools import * # noqa (PEP8 asserts)
import pytest
from osf_tests.factories import (
ProjectFactory,
UserFactory,
RegistrationFactory,
NodeFactory,
CollectionFactory,
)
from osf.models import NodeRelation
from tests.base import OsfTestCase, get_default_m... | {
"content_hash": "385b722f0c965a2468ed59a4a6bf37c8",
"timestamp": "",
"source": "github",
"line_count": 490,
"max_line_length": 118,
"avg_line_length": 43.63469387755102,
"alnum_prop": 0.6373883354380057,
"repo_name": "laurenrevere/osf.io",
"id": "6ed8816479f02b9bff06df67ede416c77ba70361",
"size": ... |
"""Start and stop tsproxy."""
import logging
import os
import re
import subprocess
import sys
from telemetry.core import util
from telemetry.internal.util import atexit_with_log
import py_utils
_TSPROXY_PATH = os.path.join(
util.GetTelemetryThirdPartyDir(), 'tsproxy', 'tsproxy.py')
def ParseTsProxyPortFromOu... | {
"content_hash": "933ac54810e6778bc90b62a86db10cc1",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 77,
"avg_line_length": 31.54609929078014,
"alnum_prop": 0.6490557553956835,
"repo_name": "catapult-project/catapult-csm",
"id": "4d88238a59960018bc1a1fdf423c60f3cdf36f53",
... |
"""Utilities to help convert mp4s to fmp4s."""
import io
def find_box(segment: io.BytesIO, target_type: bytes, box_start: int = 0) -> int:
"""Find location of first box (or sub_box if box_start provided) of given type."""
if box_start == 0:
box_end = segment.seek(0, io.SEEK_END)
segment.seek(0... | {
"content_hash": "6096a4b66d057921d032b7edc97a43b2",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 86,
"avg_line_length": 34.60526315789474,
"alnum_prop": 0.6152091254752852,
"repo_name": "titilambert/home-assistant",
"id": "00603807215a601f078753a9542988c6955a0720",
"si... |
"""Tests for tensorflow.ops.gradients."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import warnings
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framewor... | {
"content_hash": "43a257df028f71910cffa288239d7296",
"timestamp": "",
"source": "github",
"line_count": 571,
"max_line_length": 84,
"avg_line_length": 38.08581436077058,
"alnum_prop": 0.6381569871706442,
"repo_name": "code-sauce/tensorflow",
"id": "20a5139a2418fd0b1662efa82a4ae2f6b9739dad",
"size":... |
from test import initialize, frobnicate, exacerbate
#To keep test results tidy don't put any thing we want results for before line 20
def bad1():
frobnicate()
def bad2():
exacerbate()
def good():
exacerbate()
bad2()
bad1()
initialize()
good() | {
"content_hash": "fd2d1e26c2e7c2b0b23ac490b29dd393",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 81,
"avg_line_length": 8.5625,
"alnum_prop": 0.6605839416058394,
"repo_name": "github/codeql",
"id": "5268cae9c9a53b26c4b0a8d4840dd88a716639a5",
"size": "361",
"binary": ... |
"""
Asset Management - Events: Create and update functions.
"""
__author__ = 'Edna Donoughe'
from ooiservices.app.uframe.uframe_tools import (uframe_get_asset_by_uid, get_uframe_event, uframe_put_event,
uframe_postto, uframe_create_cruise, uframe_create_calibration)
fr... | {
"content_hash": "d662980b79c1d48a53d5d1878b71aa89",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 121,
"avg_line_length": 40.27444794952682,
"alnum_prop": 0.5856505052087413,
"repo_name": "asascience-open/ooi-ui-services",
"id": "b33d269ae1fce1bb5f1014af1b8af225fb03afbd"... |
num = input('Enter number: ')
#Diplay the output
print('The binary equivalent is {0}'.format(bin(int(num))[2:])) | {
"content_hash": "9dee17261ba430b992299770aaf690a6",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 63,
"avg_line_length": 28.25,
"alnum_prop": 0.6814159292035398,
"repo_name": "HarendraSingh22/Python-Guide-for-Beginners",
"id": "8cbe92b3be95dbe88ef455a19303ef222fe79789",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('basicviz', '0003_auto_20160717_1943'),
]
operations = [
migrations.AddField(
model_name='document',
name='metadata',
... | {
"content_hash": "5133a7c4f2f3bc90da646582d90cfeae",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 63,
"avg_line_length": 22.57894736842105,
"alnum_prop": 0.5944055944055944,
"repo_name": "sdrogers/ms2ldaviz",
"id": "cd77e6fbd8394f12ae210fde89ddd5e79fb63e21",
"size": "45... |
"""Traceback utilities."""
import dis
import keyword
import opcode
import os
import sys
import tokenize
from pysec.core import Object
from pysec.io import fd
from pysec.xsplit import xlines
NORESULT = object()
SCOPE_BUILTIN = 'builtin'
SCOPE_GLOBAL = 'global'
SCOPE_LOCAL = 'local'
def getvar(name, frame=None):
... | {
"content_hash": "2da13a86ee72f379bfd8a65cee91edac",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 114,
"avg_line_length": 32.944954128440365,
"alnum_prop": 0.5367585630743525,
"repo_name": "chencoyote/owasp-pysec",
"id": "8147e878e0615130148f7bbe273cece140dd3923",
"siz... |
from nova import db
from nova import exception
from nova import objects
from nova.objects import base as obj_base
from nova.objects import fields
from nova.openstack.common import timeutils
from nova import utils
FIXED_IP_OPTIONAL_ATTRS = ['instance', 'network']
class FixedIP(obj_base.NovaPersistentObject, obj_base... | {
"content_hash": "10905b796530867653bb0698ed29a5b8",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 79,
"avg_line_length": 43.63241106719368,
"alnum_prop": 0.5633662469426578,
"repo_name": "nash-x/hws",
"id": "2482b635e5a59b8bbf0b0e3c5567c9fe3f606154",
"size": "11648",
... |
'''A domain specific language for timeseries analysis and manipulation.
Created using ply (http://www.dabeaz.com/ply/) a pure Python implementation
of the popular compiler construction tools lex and yacc.
'''
from ccy import todate
from ..conf import settings
from ..exc import ExpressionError, CouldNotParse
... | {
"content_hash": "9fd9a67b6548afa0dc255aaa3aa9dba5",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 79,
"avg_line_length": 34.21764705882353,
"alnum_prop": 0.6064981949458483,
"repo_name": "quantmind/dynts",
"id": "d042e8b3876e0957b983cd822cce617b59dcaf43",
"size": "5817... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
# from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from deck.tests.test_unit import EVENT_DATA
from deck.mo... | {
"content_hash": "289e2027c4182ce804231b51d95f50b7",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 78,
"avg_line_length": 46.82716049382716,
"alnum_prop": 0.5670972844713946,
"repo_name": "luanfonceca/speakerfight",
"id": "aabaee07dae9456e91b928a9eb64a313261d5879",
"size... |
"""This module provides a bunch of helper functions to deal with user
registration stuff."""
from models import Event, Registration
from django.contrib.auth.models import User
from datetime import datetime, timedelta
def is_waitlisted(student, event):
"""Checks to see if a student is waitlisted for a given event.""... | {
"content_hash": "3e7cc3a3ee5949793809242edf931587",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 69,
"avg_line_length": 24.416666666666668,
"alnum_prop": 0.7313505607020966,
"repo_name": "knowledgecommonsdc/kcdc3",
"id": "48b3d66103348a0ab92d076757864743fcc9b997",
"siz... |
import sys
import subprocess
import ctypes
from unittest import TestCase
from . import glk_test_program
import zvm.glk as glk
class AnyGlkTestsMixIn:
"""Integration tests that can be used with any Glk library. Aside
from serving as integration tests, they also ensure that the Glk
specification is observed... | {
"content_hash": "1f5ffc0e512ecb971bf29256759414fb",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 77,
"avg_line_length": 39.73125,
"alnum_prop": 0.6009123800534844,
"repo_name": "sussman/zvm",
"id": "d8e41835066a3cb6e8e188c8aa72dc35f5ed92d9",
"size": "6522",
"binary"... |
import numpy as np
class LoLTypeInference:
"""
Given a list of lists this class infers the types of
each of the attributes.
"""
def __init__(self, cat_thresh=1000,
num_thresh = 0.25,
addr_thresh=0.25):
"""
cat_thresh parsing threshold for categorical attrs
num_thresh parsing threshold for... | {
"content_hash": "59ad2706b5119206a2610a2fb324ea46",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 59,
"avg_line_length": 20.2875,
"alnum_prop": 0.6383240911891559,
"repo_name": "sjyk/activedetect",
"id": "ad32a601aed6d5a56bec58c4a6ba78f0cb3834e6",
"size": "1623",
"bin... |
import numpy as np
from scipy.integrate import ode
from .common import validate_tol, validate_first_step, warn_extraneous
from .base import OdeSolver, DenseOutput
class LSODA(OdeSolver):
"""Adams/BDF method with automatic stiffness detection and switching.
This is a wrapper to the Fortran solver from ODEPACK... | {
"content_hash": "9a1cf0aa5ef6a10904cb88a23530cb17",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 84,
"avg_line_length": 42.670212765957444,
"alnum_prop": 0.6166791323859386,
"repo_name": "pizzathief/scipy",
"id": "9b695c7b77e8e02667e7ba1c68e81cc717323bed",
"size": "80... |
from distutils.core import setup
VERSION = '0.9.5'
setup(
name = 'finder_colors',
py_modules = ['finder_colors'],
scripts = ['finder_colors.py'],
version = VERSION,
description = 'Get/Set the Colors set on files by OSX Finder',
long_description=open('README.rst','r').read(),
author = 'Dani... | {
"content_hash": "0580519a44e8cb62b92fc2e5549e4f3b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 86,
"avg_line_length": 43.29032258064516,
"alnum_prop": 0.5476900149031296,
"repo_name": "danthedeckie/finder_colors",
"id": "91d2bee8cdc973e2d2dd1a89f6d388f01d32f743",
"si... |
from dataclasses import dataclass
from typing import List
@dataclass
class URLRedirect:
old_url: str
new_url: str
API_DOCUMENTATION_REDIRECTS: List[URLRedirect] = [
# Add URL redirects for REST API documentation here:
URLRedirect("/api/delete-stream", "/api/archive-stream"),
]
POLICY_DOCUMENTATION_... | {
"content_hash": "5fcfbb8ec079709ac618b206e9b802ec",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 100,
"avg_line_length": 41.66233766233766,
"alnum_prop": 0.69856608478803,
"repo_name": "zulip/zulip",
"id": "868ced5bddb32ffd07170af9913ebe4e17b057de",
"size": "3208",
"... |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="multipip",
version="0.1",
licence="Apache License (2.0)",
description="multipip and py2rpm",
long_description=read("README.rst"),
author="Alessio Ababil... | {
"content_hash": "89ad1cdba9ce53b662313e5f0467199b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 70,
"avg_line_length": 22.44,
"alnum_prop": 0.6310160427807486,
"repo_name": "aababilov/multipip",
"id": "261bbcfed454fd187e473d4afa4178e284390b01",
"size": "624",
"binar... |
import os
import sys
import datetime
from importlib import import_module
try:
from sphinx_astropy.conf.v1 import * # noqa
except ImportError:
print('ERROR: the documentation requires the sphinx-astropy package to be installed')
sys.exit(1)
# Get configuration information from setup.cfg
from configparser ... | {
"content_hash": "2d6a5e5b5e4f80603293d0ef07878dfd",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 89,
"avg_line_length": 34.45882352941177,
"alnum_prop": 0.6695117787640833,
"repo_name": "gbrammer/grizli",
"id": "69f790636b6e9572e7b9e504d853d9902f9a2165",
"size": "7344... |
from cursor import Cursor
from character import Character
class Document:
def __init__(self):
self.characters = []
self.cursor = Cursor(self)
self.filename = '';
def insert(self, character):
if not hasattr(character, 'character'):
character = Character(character)
... | {
"content_hash": "1b6c7f9d120f064f6fef7d27afdbb34f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 63,
"avg_line_length": 27.88,
"alnum_prop": 0.6097560975609756,
"repo_name": "JMwill/wiki",
"id": "75ce2e8149147f88bb6c0294d4f3887c62ecc2a3",
"size": "697",
"binary": fal... |
import sys
import os
import csv
import itertools
import json
import urllib
SPREADSHEET_URL = 'https://docs.google.com/spreadsheet/pub?key=0Al9obkz_TwDLdEpqcEM5bVRSc3FXczF3Vl80Wk53eEE&output=csv'
class Vocabulary(object):
template = """\
var vocabulary = {texts!s};
"""
class Texts(list):
def __str__(self):
re... | {
"content_hash": "3e74d15b1d4053fb53abd72157ffddc8",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 119,
"avg_line_length": 24.419753086419753,
"alnum_prop": 0.6890798786653185,
"repo_name": "eugenox/yays",
"id": "3e32da32b3aa28c7d21f2e1663f3ca217d3bb5eb",
"size": "2003",... |
"""DetCon/BYOL losses."""
import haiku as hk
import jax
import jax.numpy as jnp
from detcon.utils import helpers
def manual_cross_entropy(labels, logits, weight):
ce = - weight * jnp.sum(labels * jax.nn.log_softmax(logits), axis=-1)
return jnp.mean(ce)
def byol_nce_detcon(pred1, pred2, target1, target2,
... | {
"content_hash": "7e115d97adb82cf90e391b5de6796db6",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 79,
"avg_line_length": 41.869565217391305,
"alnum_prop": 0.6824160609207338,
"repo_name": "deepmind/detcon",
"id": "805c44c1849db3d7dc8e1e840969617526169348",
"size": "645... |
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import google.api_core
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1, operations_v1
from google.api_core import retry as retries
import google.auth # type: ignore
from google.auth import... | {
"content_hash": "8ae3c3a2055df4da2f27f04365a4ef25",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 101,
"avg_line_length": 33.75454545454546,
"alnum_prop": 0.592153694227489,
"repo_name": "googleapis/python-tpu",
"id": "827330e1e1ddfa3857cdf06d4c9d3cb0da7a1411",
"size":... |
"""luigi bindings for Google Dataproc on Google Cloud"""
import os
import time
import logging
import luigi
logger = logging.getLogger('luigi-interface')
_dataproc_client = None
try:
import httplib2
import oauth2client.client
from googleapiclient import discovery
from googleapiclient.errors import Ht... | {
"content_hash": "4f8a2cb83c2c87f2cbefafcfd2b30ad9",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 133,
"avg_line_length": 40.03238866396761,
"alnum_prop": 0.5893001618122977,
"repo_name": "casey-green/luigi",
"id": "a6af258b60cf3674e67d1b44f9ef941b57b573ee",
"size": "9... |
import string
import cStringIO
import leveldb
import io
import os
import time
import binascii
import shutil
import logging
from decimal import Decimal
from cache import Cache
from common import *
from lib.serialize import *
from lib.core import *
from lib.messages import msg_block, message_to_str, message_read
from li... | {
"content_hash": "57ad84c724569d8dda280c6f48dec398",
"timestamp": "",
"source": "github",
"line_count": 835,
"max_line_length": 126,
"avg_line_length": 32.18802395209581,
"alnum_prop": 0.5402016594113926,
"repo_name": "obulpathi/bitcoinpy",
"id": "f89cc1923ab31fb4382f3bc3f775521dc1ef8fe5",
"size": ... |
'''
Salt module to manage RAID arrays with mdadm
'''
# Import python libs
import os
import logging
# Import salt libs
import salt.utils
from salt.exceptions import CommandExecutionError
# Set up logger
log = logging.getLogger(__name__)
# Define a function alias in order not to shadow built-in's
__func_alias__ = {
... | {
"content_hash": "7d4ba6e59050d953910e6d73f805de36",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 120,
"avg_line_length": 28.572093023255814,
"alnum_prop": 0.5349177926094743,
"repo_name": "victorywang80/Maintenance",
"id": "0001c89e56d810b53ac25ff48ed96a0ea653f5aa",
"... |
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.exceptions import APIException
from django.db.models import Q
from frontend.models import Practice, PCT, STP, RegionalTeam, PCN
from . import view_utils as utils
from matrixstore.db import get_db, get_row_gr... | {
"content_hash": "0cb03ffc95f139e2207ed6e18906652c",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 87,
"avg_line_length": 37.00689655172414,
"alnum_prop": 0.5879612374207976,
"repo_name": "annapowellsmith/openpresc",
"id": "ff6ee903fd5f44759488a212060ec8af5d8bbec3",
"si... |
from setuptools import setup
setup(
name='t4_lambda_s3select',
version='0.0.1',
py_modules=['index'],
)
| {
"content_hash": "14212d11e3177817cc6b62fbb00b9b2b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 30,
"avg_line_length": 16.714285714285715,
"alnum_prop": 0.6324786324786325,
"repo_name": "quiltdata/quilt-compiler",
"id": "cfe1d24af29363150c4d7374c38ea9b7a2b4b8ef",
"size... |
from typing import Any, Optional
from cached_property import cached_property
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.athena import AWSAthenaHook
from airflow.sensors.base_sensor_operator import BaseSensorOperator
from airflow.utils.decorators import apply_defaults
cla... | {
"content_hash": "0466327d98fb2f227c7e45f5c06458bf",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 86,
"avg_line_length": 31.535211267605632,
"alnum_prop": 0.6507369361322018,
"repo_name": "mrkm4ntr/incubator-airflow",
"id": "40c028a41c4c43ddaba3b5c69fff1e9690516ef8",
"s... |
import sqlite3
import os
import simplejson as json
db = sqlite3.connect("../data/pbp.db")
c = db.cursor()
# Fetch all scoreboard paths
scoreboard_paths = [];
for root, dirs, files in os.walk("..\\data\\scoreboards"):
for file in files:
if file.endswith("scoreboard.json"):
scoreboard_paths.append(os.path.join(ro... | {
"content_hash": "dd81fc63204f2ae99fdea71691dd17f7",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 109,
"avg_line_length": 49.03508771929825,
"alnum_prop": 0.6869409660107334,
"repo_name": "albertlyu/ncaab-pbp",
"id": "032f5e4bc55fca7a42fda0a4df9ea1d3d1792d82",
"size": "... |
"""
Algorithm:
Feature Weighting
Viewpoints Labels
Choose Examplars based on Scores
Normalizing Scores
Per Name
Incremental Version
"""
from __future__ import absolute_import, division, print_function
import utool as ut
import numpy as np
from ibeis.algo.hots.smk import smk_debug
from vtool impo... | {
"content_hash": "cec460f689210520d0d487ac94878d9f",
"timestamp": "",
"source": "github",
"line_count": 781,
"max_line_length": 159,
"avg_line_length": 40.27016645326505,
"alnum_prop": 0.6014117198181298,
"repo_name": "SU-ECE-17-7/ibeis",
"id": "7cb9978371bd76bab1c7731dbf84dd232503dc09",
"size": "3... |
import subprocess
import sys
from setuptools import setup
try:
cmd = (
"g++ -std=c++11 -O3 scib/knn_graph/knn_graph.cpp -o scib/knn_graph/knn_graph.o"
)
sys.stdout.write("Compile knn_graph C++ code for LISI metric...\n")
sys.stdout.flush()
subprocess.check_output(
cmd, stderr=subpr... | {
"content_hash": "4f810386a076e59e63a4016e080fe07b",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 93,
"avg_line_length": 27.38095238095238,
"alnum_prop": 0.6660869565217391,
"repo_name": "theislab/scib",
"id": "45677ce07b5dbdf6ee8ee7d6adcfcffcf7dff79a",
"size": "575",
... |
import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.c... | {
"content_hash": "8253600c6e691d9df38d04da9ee92aae",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 211,
"avg_line_length": 43.823008849557525,
"alnum_prop": 0.6861873990306947,
"repo_name": "Azure/azure-sdk-for-python",
"id": "bb0c37412d60df0a7f4962cb4ae486633b2925ae",
... |
import datetime
import PyRSS2Gen
rss = PyRSS2Gen.RSS2(
title = "Andrew's PyRSS2Gen feed",
link = "http://www.dalkescientific.com/Python/PyRSS2Gen.html",
description = "The latest news about PyRSS2Gen, a "
"Python library for generating RSS2 feeds",
lastBuildDate = datetime.datetime.u... | {
"content_hash": "0c1908de3954b91f4fe8181e4220a9e1",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 76,
"avg_line_length": 44.84848484848485,
"alnum_prop": 0.5972972972972973,
"repo_name": "liamzebedee/PyRSSGen",
"id": "4e6b29ad8a199f08e3a6d0a775c9800fbbaa62d5",
"size": "... |
from __future__ import unicode_literals
import logging
import sys
from enum import Enum
import requests
try:
# python3.x
from urllib.parse import urljoin
except ImportError:
# python2.x
# noinspection PyUnresolvedReferences
from urlparse import urljoin
__all__ = ['Client', 'BadResponse']
GODADD... | {
"content_hash": "aa3faa25dadfcdb7f8a53dfaf1c0085a",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 118,
"avg_line_length": 39.125,
"alnum_prop": 0.6169106174307155,
"repo_name": "eXamadeus/godaddypy",
"id": "10df10c266ec98d7f45462de7c32a909e647b81e",
"size": "13459",
... |
from __future__ import unicode_literals
from future.builtins import int, zip
from functools import reduce
from operator import ior, iand
from string import punctuation
from django.db.models import Manager, Q, CharField, TextField, get_models
from django.db.models.manager import ManagerDescriptor
from django.db.models... | {
"content_hash": "648c26f31743ab2e7467d7feb7ff0b77",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 78,
"avg_line_length": 43.76648351648352,
"alnum_prop": 0.5987696943066977,
"repo_name": "agepoly/mezzanine",
"id": "8562f72e5418adfd3f08f80f6b27a368e673851c",
"size": "15... |
from Test_Column_ObjFnc import tac_column
import time
"""
% -------------------------------------------------------------------------
% SIMULATION-BASED OPTIMIZATION OF A SINGLE CONVENTIONAL DISTILLATION
% COLUMN USING THE PARTICLE SWARM OPTIMIZATION ALGORITHM
%------------------------------------------------... | {
"content_hash": "dcff3b3981f78e9e9a73e4f00e883310",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 104,
"avg_line_length": 37.55128205128205,
"alnum_prop": 0.5742574257425742,
"repo_name": "CAChemE/stochastic-optimization",
"id": "2d32a8b2ca89640eb3d1eedd4a0b915ca6d8e134",... |
""" Unit test for ‘_metadata’ private module.
"""
from __future__ import (absolute_import, unicode_literals)
import sys
import errno
import re
try:
# Python 3 standard library.
import urllib.parse as urlparse
except ImportError:
# Python 2 standard library.
import urlparse
import functools
import ... | {
"content_hash": "f55b2f3ecd7f244dd3f26201d3b0b9e1",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 79,
"avg_line_length": 34.744,
"alnum_prop": 0.5747946887712027,
"repo_name": "dproc/trex_odp_porting_integration",
"id": "692753f47a3a7c259069fa54df0d9e92eab9e8ac",
"size... |
from test.test_support import run_unittest, check_py3k_warnings
import unittest
class OpcodeTest(unittest.TestCase):
def test_try_inside_for_loop(self):
n = 0
for i in range(10):
n = n+i
try: 1 // 0
except NameError: pass
except ZeroDivisionError: pa... | {
"content_hash": "f6c89dc283e70a93736691be1abaaf87",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 74,
"avg_line_length": 25.873949579831933,
"alnum_prop": 0.5086066904839234,
"repo_name": "fkolacek/FIT-VUT",
"id": "c93ef86df2a94f36e589e1d0faa9c98edd1469b8",
"size": "31... |
from peachbox.model.view import View
import peachbox.model
import uuid
class RealTimeView(View):
keys = []
_cassandra_initialized = False
_cassandra_indices = None
@classmethod
def row(cls, **kwargs):
if not cls._cassandra_initialized: cls.cassandra_initialize()
partition_key = ... | {
"content_hash": "4060afc4ae43b3ac4ac7e249a983bbf2",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 104,
"avg_line_length": 24.892307692307693,
"alnum_prop": 0.572929542645241,
"repo_name": "PeachstoneIO/peachbox",
"id": "c4821e5ef2082f53abce2b05255bba999a2e6490",
"size":... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0033_abouttheeditorpage_language'),
('core', '0030_homepage_banner_content'),
]
operations = [
]
| {
"content_hash": "73c94ca3641844771b0dee35ca932b83",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 53,
"avg_line_length": 19.333333333333332,
"alnum_prop": 0.6293103448275862,
"repo_name": "PARINetwork/pari",
"id": "43c22331b060babe53ef4c6f5829998321d11690",
"size": "279... |
class ReadOnlyAdminPreMixin(object):
"""
Mixin for :class:`django.contrib.admin.options.ModelAdmin`
that makes the model admin read only.
Examples:
Typical usage::
from ievv_opensource.ievv_djangoadmin import ievv_djangoadmin_mixins
@admin.register(MyModel)
... | {
"content_hash": "d8c5f610d456ce421e670e2c8626dc74",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 80,
"avg_line_length": 29.615384615384617,
"alnum_prop": 0.5461038961038961,
"repo_name": "appressoas/ievv_opensource",
"id": "d46b727c2f5f694caf18325e21316deb5087e4ed",
"s... |
import sys
sys.path.append('..') # append .. to the current path so it can find Binance.py
from Binance import Binance
import logging.config
import logging.handlers
import logging
import ConfigParser
def readConfig(key):
# read in configuration
config = ConfigParser.ConfigParser()
config.read... | {
"content_hash": "fb3d7f89c9a9fc771509a3a74625ee07",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 99,
"avg_line_length": 28.264705882352942,
"alnum_prop": 0.7148803329864725,
"repo_name": "js7558/pyBinance",
"id": "524cf0b00f0b43d9a70d367a20679f519f9801e2",
"size": "230... |
import json
import logging
import re
from api.api_samples.python_client.api_client import CloudBoltAPIClient
from api.api_samples.python_client.samples.api_helpers import wait_for_order_completion
from common.methods import set_progress
from servicecatalog.models import ServiceBlueprint
from utilities.exceptions impor... | {
"content_hash": "3d1bbdb6db9ed73cdf242d9d2e2a553e",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 106,
"avg_line_length": 34.89473684210526,
"alnum_prop": 0.6485671191553545,
"repo_name": "CloudBoltSoftware/cloudbolt-forge",
"id": "b98fc050c47ce9433dd8ef71092e02b36938f73... |
from collections import OrderedDict
from gluon import current
from gluon.html import A, DIV, LI, URL, TAG, TD, TR, UL
from gluon.storage import Storage
from s3 import S3SQLInlineLink
def config(settings):
"""
Template settings: 'Skeleton' designed to be copied to quickly create
... | {
"content_hash": "b6f7693c7de3adfbd8211082c29843dd",
"timestamp": "",
"source": "github",
"line_count": 743,
"max_line_length": 151,
"avg_line_length": 42.0228802153432,
"alnum_prop": 0.45456874739775166,
"repo_name": "flavour/eden",
"id": "5388ac6633e71ad9c1d704a61459cf230e201880",
"size": "31349"... |
from django.apps import AppConfig
class ElasticsearchappConfig(AppConfig):
name = 'elasticsearchapp'
def ready(self):
import elasticsearchapp.signals | {
"content_hash": "efa3f34832bebe2aede11e11136ae098",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 40,
"avg_line_length": 21,
"alnum_prop": 0.75,
"repo_name": "aminhp93/learning_python",
"id": "fc035aed3e55235353853d1230b3dec8c04003e1",
"size": "168",
"binary": false,
... |
"""
Generates a report for English Wikipedia articles with no Wikidata item
Copyright (C) 2015 James Hare
Licensed under MIT License: http://mitlicense.org
"""
from urllib.parse import quote
import pywikibot
from project_index import WikiProjectTools
def main():
wptools = WikiProjectTools()
bot = pywikibot.... | {
"content_hash": "93e0fce60aa9e22d0582c05214d49a13",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 88,
"avg_line_length": 34.9,
"alnum_prop": 0.6203438395415473,
"repo_name": "harej/reports_bot",
"id": "00fe620bf466953364d0deb1b7b3abb4e0023b37",
"size": "1420",
"binary... |
import pytest
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
def element_send_keys(session, element, text):
return session.transport.send(
"POST", "/session/{session_id}/element/{element_id}/value".format(
session_id=session.session_id,
eleme... | {
"content_hash": "1539ea8b0e9ebdb076d929b2fcf49f71",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 90,
"avg_line_length": 34.413223140495866,
"alnum_prop": 0.6954851104707013,
"repo_name": "chromium/chromium",
"id": "c1046840fa4ef24a5e063d09aee8c58803e835f7",
"size": "4... |
"""Finds browsers that can be controlled by telemetry."""
import logging
import operator
from telemetry import decorators
from telemetry.internal.backends.chrome import android_browser_finder
from telemetry.internal.backends.chrome import cros_browser_finder
from telemetry.internal.backends.chrome import desktop_brow... | {
"content_hash": "72145a21cd349fd4e9f916d723d18a63",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 79,
"avg_line_length": 35.40555555555556,
"alnum_prop": 0.7170877137925624,
"repo_name": "Workday/OpenFrame",
"id": "8123196e0fa7ea349574265010f7b3f48e6afb90",
"size": "65... |
"""Concrete date/time and related types.
See http://www.iana.org/time-zones/repository/tz-link.html for
time zone and DST data sources.
"""
import time as _time
import math as _math
def _cmp(x, y):
return 0 if x == y else 1 if x > y else -1
MINYEAR = 1
MAXYEAR = 9999
_MAXORDINAL = 3652059 # date.max.toordinal(... | {
"content_hash": "8fd6604a7d0e6786cd000094d34b9cbd",
"timestamp": "",
"source": "github",
"line_count": 2433,
"max_line_length": 94,
"avg_line_length": 34.738183312782574,
"alnum_prop": 0.5473626919709411,
"repo_name": "Microsoft/PTVS",
"id": "dd6eca907dd440b90bf969ea2c34c7c7ad0102f0",
"size": "845... |
import smtplib
import thread
import urllib
import urlparse
from datetime import datetime, timedelta
from email.mime.text import MIMEText
from airy.core.web import AiryHandler, AiryRequestHandler
from airy.core.conf import settings
from users.decorators import login_required
from users.forms import *
from users.models... | {
"content_hash": "41b67643a8786027697fbd1474e7a4b9",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 107,
"avg_line_length": 32.28846153846154,
"alnum_prop": 0.5903513996426444,
"repo_name": "letolab/airy",
"id": "a5fdc370e79a59318e90e9d280059bc03efab96f",
"size": "8395",... |
import errno
from unittest import mock
from six.moves import builtins
from os_win import constants
from os_win import exceptions
from os_win.tests.unit import test_base
from os_win.utils.io import namedpipe
from os_win.utils.winapi import constants as w_const
class NamedPipeTestCase(test_base.BaseTestCase):
_FA... | {
"content_hash": "31b21cf05f03e17dbabab5522ff10186",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 77,
"avg_line_length": 39.90934065934066,
"alnum_prop": 0.6078336889929098,
"repo_name": "openstack/os-win",
"id": "b28ca1ae7b45a0d7d68371a378e92e5df05d6003",
"size": "151... |
__version__ = '0.1'
import pep8
def check_helloworld(physical_line):
if pep8.noqa(physical_line):
return
pos = physical_line.find('Hello World')
if -1 != pos:
return pos, 'HW01 use "Hello World"'
check_helloworld.name = name = 'flake8-helloworld'
check_helloworld.version = __version__
| {
"content_hash": "ac96d19973f3f4975f115f8f192c9c54",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 50,
"avg_line_length": 21.266666666666666,
"alnum_prop": 0.64576802507837,
"repo_name": "hhatto/flake8-helloworld",
"id": "6709f2df83b293dd88543471c008de8e34b2102e",
"size"... |
import itertools
from oslo_log import log as logging
from nova.cells import opts as cells_opts
from nova.cells import rpcapi as cells_rpcapi
from nova.db import api as db
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import fields
LOG = logging.getLogger(__name_... | {
"content_hash": "514273d178041033d9dbd7cfd90699f9",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 79,
"avg_line_length": 39.24528301886792,
"alnum_prop": 0.5903846153846154,
"repo_name": "mikalstill/nova",
"id": "3010145e7e3e43158cfbf626b76761693e18a1ce",
"size": "4765... |
"""Tests for stream_slice."""
import string
import StringIO
import unittest2
from apitools.base.py import exceptions
from apitools.base.py import stream_slice
class StreamSliceTest(unittest2.TestCase):
def setUp(self):
self.stream = StringIO.StringIO(string.letters)
self.value = self.stream.getvalue()
... | {
"content_hash": "aaefa1d210d07841598f527a0fdef0a5",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 75,
"avg_line_length": 29.685185185185187,
"alnum_prop": 0.6818465377417342,
"repo_name": "craigcitro/original-apitools",
"id": "900ba8169a6eb6636db0d8974426fc2cd357d464",
... |
DOCUMENTATION = '''
---
module: ecs_service
short_description: create, terminate, start or stop a service in ecs
description:
- Creates or terminates ecs services.
notes:
- the service role specified must be assumable (i.e. have a trust relationship for the ecs service, ecs.amazonaws.com)
- for details of the par... | {
"content_hash": "8ef8fabf1bed53b4ed4156f8031c4178",
"timestamp": "",
"source": "github",
"line_count": 378,
"max_line_length": 317,
"avg_line_length": 41.939153439153436,
"alnum_prop": 0.6295338421749826,
"repo_name": "mikepolyak/bowling-kata",
"id": "4683d4f2aebdd2b9d4ec8bc35047dbddb522e262",
"si... |
import distributions as dist
import random
import json
class person:
def __init__(self):
# The below is a measure of the average an individual can be expected to move
# around in the percentile spread of incomes -- in other words, if
# avg_inc_change = .04, then that means the average person can be expected to... | {
"content_hash": "f320c540fed527bf2a8e8136ad1761a2",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 90,
"avg_line_length": 32.127272727272725,
"alnum_prop": 0.6745897000565931,
"repo_name": "polpolion/TheFatalisticGameOfLife",
"id": "37cc88fb3ba306e660e1107c5091d0f208de90c... |
"""Helper functions for SSD models meta architecture tests."""
import functools
import tensorflow.compat.v1 as tf
from google.protobuf import text_format
from object_detection.builders import post_processing_builder
from object_detection.core import anchor_generator
from object_detection.core import balanced_positive... | {
"content_hash": "5727acf628f12c593afd24b92e5563ff",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 104,
"avg_line_length": 35.29795918367347,
"alnum_prop": 0.6751850138760407,
"repo_name": "tombstone/models",
"id": "0991388b31ac6a5974c9297e50b9630b3966e489",
"size": "93... |
from corehq.apps.fixtures.dbaccessors import get_fixture_data_types_in_domain
from corehq.apps.fixtures.models import FixtureDataType, FixtureTypeField, \
FixtureDataItem, FieldList, FixtureItemField, FixtureOwnership
from corehq.apps.locations.tests.util import LocationHierarchyTestCase
from corehq.apps.users.mode... | {
"content_hash": "24aa646110793a283cc6e6c822aa5bea",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 89,
"avg_line_length": 38.875,
"alnum_prop": 0.5547860499628988,
"repo_name": "qedsoftware/commcare-hq",
"id": "a6b0b048c71e8292de458496bbee877c1136f5d1",
"size": "4043",
... |
"""
Compute angular separation in the sky using haversine
Note:
decimal points on constants made 0 difference in `%timeit` execution time
The Meeus algorithm is about 9.5% faster than Astropy/Vicenty on my PC,
and gives virtually identical result
within double precision arithmetic limitations
"""
try:
from astro... | {
"content_hash": "719ca3dd49dd12b3107b48996b3c35ad",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 98,
"avg_line_length": 23.328125,
"alnum_prop": 0.6259209645010047,
"repo_name": "geospace-code/pymap3d",
"id": "a6dd4937cdfa44ae455f1f6363cfe331f437195b",
"size": "2986",... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "table.legendgrouptitle"
_path_str = "table.legendgrouptitle.font"
_valid_props = {"color", "fa... | {
"content_hash": "41881730f4aa59a1e1bfddf1dbc3b4b3",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 82,
"avg_line_length": 37.23348017621145,
"alnum_prop": 0.5597491717936584,
"repo_name": "plotly/plotly.py",
"id": "d48cf0853ff67d59f360fc31d255c88234109232",
"size": "845... |
from shellbot import Command
class Next(Command):
"""
Displays the next item to do
>>>command = Next(store=store)
>>>shell.load_command(command)
"""
keyword = u'next'
information_message = u'Display next item to do'
def execute(self, bot, arguments=None, **kwargs):
"""
... | {
"content_hash": "7f01d7fc3ee7841a8f9df669a113fc0f",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 74,
"avg_line_length": 25.423076923076923,
"alnum_prop": 0.583963691376702,
"repo_name": "bernard357/shellbot",
"id": "66cd92db03e6e532ec86faf651a9ce55e6442bb1",
"size": "1... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import argparse
import cgi
import copy
from datetime import datetime, timedelta
from json import JSONEncoder
from flask import jsonify, Response, request
from flask_restpl... | {
"content_hash": "fb9304dcf0a7e0a398206b84e1867cf3",
"timestamp": "",
"source": "github",
"line_count": 621,
"max_line_length": 110,
"avg_line_length": 34.35748792270532,
"alnum_prop": 0.537870266216723,
"repo_name": "JorisDeRieck/Flexget",
"id": "470aeda4ff2d02c8130e6faed6c7ccbfac92c800",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.