text stringlengths 4 1.02M | meta dict |
|---|---|
import uuid
import random
from django.test import TestCase, Client
from main.models import Question_option
class TestSesson(TestCase):
fixtures = ['basic_setup.json']
def setUp(self):
# Create our client, login and select a course
self.client = Client()
self.client.post('/login/',... | {
"content_hash": "a726fb88722fc6b9670237c56f06836e",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 107,
"avg_line_length": 48.5609756097561,
"alnum_prop": 0.6685082872928176,
"repo_name": "camerongray1515/SELP-Audience-Response-System",
"id": "ce618a80dc7e0d0dc86227ec8df3d... |
from fakes import MyOpener
import wpl
import os
def load_file(filename):
return file(os.path.join(os.path.dirname(__file__), filename)).read()
def test_find_item__isbn10__makes_good_request():
opener = MyOpener('')
w = wpl.Library(opener)
w.find_item('1593974744')
assert (opener.last_request['... | {
"content_hash": "7ac6a72ee3e8beb57c6baa39392d0d95",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 116,
"avg_line_length": 28.484848484848484,
"alnum_prop": 0.6840425531914893,
"repo_name": "blairconrad/LibraryLookup",
"id": "7368ca9cc3418602b9e2ac6e3159f72466ae04c1",
"s... |
from flask import g
import pandas as pd
def get_product_list(params):
df = pd.read_sql('''
select item_name
from donorschoose_resources
where item_name like %(item_name)s
limit 100
''', \
g.db_engine, \
params={'item_name': params['item_name']}
)
... | {
"content_hash": "8c9be032951687f150ea73923d7e08e1",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 49,
"avg_line_length": 19.58823529411765,
"alnum_prop": 0.5525525525525525,
"repo_name": "sampathweb/bayes_hack",
"id": "bf78d1ff6ef2888ef1f8396f7d0563cd68d8549f",
"size": ... |
"""Provide the RedditorListingMixin class."""
from ....const import urljoin
from ..generator import ListingGenerator
from .base import BaseListingMixin
from .gilded import GildedListingMixin
class RedditorListingMixin(BaseListingMixin, GildedListingMixin):
"""Adds additional methods pertaining to Redditor instanc... | {
"content_hash": "a82b080821e37aeee25b1789213a4752",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 39,
"alnum_prop": 0.6384053902302077,
"repo_name": "13steinj/praw",
"id": "eed2ca8212ae27d4288709ec5acce8310acedb80",
"size": "5343",
"binary": fa... |
import dapi
try:
import oauth
import oauth_provider
except ImportError:
oauth_support = False
else:
oauth_support = True
if oauth_support:
from dapi.auth.doauth import AuthOAuth
class OAuthApi(dapi.Api):
auth = AuthOAuth()
oauth_api = OAuthApi(extends=dapi.default_api... | {
"content_hash": "b0f5f606956a68a0a547da4c6c412d03",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 50,
"avg_line_length": 18.941176470588236,
"alnum_prop": 0.6645962732919255,
"repo_name": "ingenieroariel/dapi",
"id": "de71c7b55b5476f5a56c54ec2653551036754192",
"size": "... |
import numpy as np
def is_positive_semi_definite(R):
if not isinstance(R, (np.ndarray, np.generic)):
raise ValueError('Encountered an error while checking if the matrix is positive semi definite. \
Expected a numpy array, instead got : {}'.format(R))
return np.all(np.linalg.eigvals(R) > 0)... | {
"content_hash": "53508caccb61685f17e3f98ebdfb69bc",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 104,
"avg_line_length": 40.125,
"alnum_prop": 0.6791277258566978,
"repo_name": "siavashk/pycpd",
"id": "7a80880bc0080ff42d1310df76d5731e0f54b8a3",
"size": "321",
"binary":... |
'''
The function `rfc3339` formats dates according to the :RFC:`3339`. `rfc3339`
tries to have as much as possible sensible defaults.
'''
__author__ = 'Henry Precheur <henry@precheur.org>'
__license__ = 'Public Domain'
__all__ = ('rfc3339', )
import datetime
import time
def _timezone(utcoffset):
'''
Return ... | {
"content_hash": "97bc03701570542b8609ee76026a8787",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 78,
"avg_line_length": 29.664,
"alnum_prop": 0.5827939590075513,
"repo_name": "steveandroulakis/mytardis",
"id": "b5e7fd4f598b3ce69991983574709711bc833004",
"size": "3755"... |
from __future__ import absolute_import
import random
import warnings
from time import time
from datetime import datetime
from collections import deque
import six
from twisted.internet import reactor, defer, task
from scrapy.utils.defer import mustbe_deferred
from scrapy.utils.httpobj import urlparse_cached
from scrap... | {
"content_hash": "0c80b77c90eafa8dd3c7b14ba5fa4a78",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 98,
"avg_line_length": 36.68811881188119,
"alnum_prop": 0.6198893536634732,
"repo_name": "Ryezhang/scrapy",
"id": "59c3ad0745d2c73f78729b584cf5c5cdb93a7551",
"size": "7411... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from hypothesis import given
import hypothesis.strategies as st
import numpy as np
import unittest
from caffe2.python import core, workspace, dyndep
import caffe2.pytho... | {
"content_hash": "db3d622a40fc31c4dc28c27158a27d43",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 80,
"avg_line_length": 41.696969696969695,
"alnum_prop": 0.5314922480620154,
"repo_name": "sf-wind/caffe2",
"id": "29f128e58ffd4d76f509fd522ec977684c7b3616",
"size": "8927... |
from neutron.conf.services import provider_configuration
from oslo_config import cfg
def list_service_provider():
return [
('service_providers', provider_configuration.serviceprovider_opts),
]
_dummy_bgpvpn_provider = ':'.join([
'BGPVPN', 'Dummy',
'networking_bgpvpn.neutron.services.service_... | {
"content_hash": "65ed9078d022bea1e0d1a0bfc9b1b665",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 75,
"avg_line_length": 27.318181818181817,
"alnum_prop": 0.7054908485856906,
"repo_name": "openstack/networking-bgpvpn",
"id": "6bce35929abdc934583565897307a13c1c1aa80b",
"... |
"The protodown app module"
from bootstrap.build import Arguments
def init(arguments):
return "Initialized empty repository"
def config(arguments):
print(arguments)
if(arguments.option=='help'):
return 'display config help'
else:
s = Template("setting $option to $value")
return... | {
"content_hash": "a54b647111da518d8bff3e06d480b1cc",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 104,
"avg_line_length": 33.28,
"alnum_prop": 0.6947115384615384,
"repo_name": "tweakch/protodown",
"id": "331fc0d24c8cc019e09c4e931ebfc2ceac140321",
"size": "1687",
"bina... |
import ast
from . import parsers
from ..lexer import lexers
from ..utils.parser import (build_call, build_class, build_yield, production,
split_tag_args_string, update_source_pos)
spg = parsers.spg
"""
Structure parser generator.
Used to tokenize and split the template at ``{{``, ``}}``, ``{%``, ``%}``,
``{#`` ... | {
"content_hash": "4c30b68cfb0b221d4554e98f218af0fc",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 77,
"avg_line_length": 25.495535714285715,
"alnum_prop": 0.5671511118893364,
"repo_name": "funkybob/rattle",
"id": "5c3e6ea3e891e60eb8def563609b1c5592fc8b46",
"size": "571... |
import numpy as np
import pandas as pd
import pytest
from statsmodels.imputation import mice
import statsmodels.api as sm
from numpy.testing import assert_equal, assert_allclose
import warnings
try:
import matplotlib.pyplot as plt
except ImportError:
pass
pdf_output = False
if pdf_output:
from matplotli... | {
"content_hash": "467b0fe7017d23c1408bd3d6b59b0069",
"timestamp": "",
"source": "github",
"line_count": 395,
"max_line_length": 139,
"avg_line_length": 31.453164556962026,
"alnum_prop": 0.5540083708950418,
"repo_name": "jseabold/statsmodels",
"id": "40492d2fec31404c8838ad52b70ab8c53bac46bd",
"size"... |
'''
Introduction to pandas
=======================
Quick script to install dependencies and start the notebook server
in the current directory.
'''
import subprocess
try:
hasattr(raw_input, '__call__')
input = raw_input
except:
pass
pkgs = ['numpy', 'scipy', 'pandas', 'jupyter',
'notebook', 'ipyth... | {
"content_hash": "0630c8be67c098c659e7bdbde892b2d4",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 114,
"avg_line_length": 23.56,
"alnum_prop": 0.5831918505942275,
"repo_name": "alexvmarch/pandas_intro",
"id": "4cb5350c13dea3b93ee61a7e68df188e566c725c",
"size": "1201",
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: bigip_ssl_key_cert
short_description: Import/Delete SSL keys and certs from BIG-IP
description:
- This module imports/deletes SSL keys and certificates on a BIG-IP.
Keys can be imported from key... | {
"content_hash": "8e107ddd366ec2606b239d0992922fd9",
"timestamp": "",
"source": "github",
"line_count": 793,
"max_line_length": 108,
"avg_line_length": 32.73770491803279,
"alnum_prop": 0.5642694811447941,
"repo_name": "F5Networks/f5-ansible-modules",
"id": "2f27e0ddbc4edcd5296ec7751b6f0fc52f6bffe4",
... |
'''
Management of Pacemaker/Corosync clusters with PCS
==================================================
A state module to manage Pacemaker/Corosync clusters
with the Pacemaker/Corosync configuration system (PCS)
.. versionadded:: 2016.110
:depends: pcs
Walkthrough of a complete PCS cluster setup:
http://clusterla... | {
"content_hash": "d9c9973bb04be41d7a3f2a97ff1b6a90",
"timestamp": "",
"source": "github",
"line_count": 1069,
"max_line_length": 123,
"avg_line_length": 33.042095416276894,
"alnum_prop": 0.5685408527263461,
"repo_name": "hoonetorg/salt-pcs-formula",
"id": "9ba81c0f28fee04382d6ffd5545d96e4b4575cdb",
... |
"""DNS Messages"""
import cStringIO
import random
import struct
import sys
import time
import dns.edns
import dns.exception
import dns.flags
import dns.name
import dns.opcode
import dns.entropy
import dns.rcode
import dns.rdata
import dns.rdataclass
import dns.rdatatype
import dns.rrset
import dns.renderer
import dns... | {
"content_hash": "acf94ad9adb290ed55811be9ff5a031a",
"timestamp": "",
"source": "github",
"line_count": 1099,
"max_line_length": 94,
"avg_line_length": 38.06915377616014,
"alnum_prop": 0.5770113294134519,
"repo_name": "rsreese/namebench",
"id": "e523931481bc600cbceaf1df82f034565274e73a",
"size": "4... |
import os
PROJECT_ROOT = os.path.join(os.path.dirname(__file__))
PROJECT_ROOT = os.path.normpath(os.path.abspath(PROJECT_ROOT))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sql... | {
"content_hash": "d2d9deadeef3e33fcafc3c58b606cab0",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 88,
"avg_line_length": 32.36666666666667,
"alnum_prop": 0.7056642636457261,
"repo_name": "saippuakauppias/django-banzai",
"id": "3355a7b4b048b70f49783512b33247a8a7007093",
... |
from keras.layers import Dense, merge
#Makes Dense connections to a series of previous outputs
#Can be used for making connections to all previous layers
#Eg http://arxiv.org/abs/1608.06993 but for Dense networks
#Avoids the need to concat inputs by product then sum
def make_densedense(output_dim, inputs):
out_arr... | {
"content_hash": "ce21f519664dd1c4f88db16fff51dcef",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 58,
"avg_line_length": 33.375,
"alnum_prop": 0.6891385767790262,
"repo_name": "kuza55/keras-extras",
"id": "933a925373efd835eff1e5821b2b46d24a0df08b",
"size": "534",
"bin... |
"""
Django settings for doughuware project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | {
"content_hash": "cb93d2bc7f7988380562dc3d8f9c8e5a",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 71,
"avg_line_length": 25.89622641509434,
"alnum_prop": 0.6881602914389799,
"repo_name": "JDougherty/doughuware",
"id": "2924dc819ec4c6dc7d09f18d41260bfbfff116ea",
"size":... |
class TargetPool(GCPResource):
'''Object to represent a gcp targetPool'''
resource_type = "compute.v1.targetPool"
# pylint: disable=too-many-arguments
def __init__(self,
rname,
project,
zone,
desc,
region,
... | {
"content_hash": "a9441d3080e59f2a9964841e08d4b71b",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 101,
"avg_line_length": 32.5,
"alnum_prop": 0.5223264540337711,
"repo_name": "drewandersonnz/openshift-tools",
"id": "2e10c298561c8f67f8979e4178d1bf6e2e9ccace",
"size": "27... |
import gi
try:
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
gi.require_version('GdkPixbuf', '2.0')
except ValueError as e:
print(e)
exit(1)
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
import os
DEFAULT_CURSOR = Gdk.Cursor(Gdk... | {
"content_hash": "edb3a2ff2cbf9b329da9cea4989e8c07",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 77,
"avg_line_length": 23.554347826086957,
"alnum_prop": 0.6035994462390402,
"repo_name": "atareao/my-weather-indicator",
"id": "008d6b75d709abd4ea8389c607a309638de2f365",
... |
import io
import os
import setuptools # type: ignore
package_root = os.path.abspath(os.path.dirname(__file__))
name = "google-cloud-containeranalysis"
description = "Google Cloud Devtools Containeranalysis API client library"
version = {}
with open(
os.path.join(
package_root, "google/cloud/devtools/... | {
"content_hash": "f497e9c0eeb427be06128b49842c200b",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 113,
"avg_line_length": 29.89156626506024,
"alnum_prop": 0.6360338573155986,
"repo_name": "googleapis/python-containeranalysis",
"id": "16a187fbc581ec13cf71b6585bbd7ed0f7ac0c... |
import os
import sys
DEBUG = True
SECRET_KEY = os.environ.get('DAYS_SECRET_KEY', 'insecure-secret-key')
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Application definition
INSTALLED_APPS = [
'days.apps.days.apps.DaysConfig',
'django.contrib.admin',
'django.contrib.auth',
... | {
"content_hash": "027656ac07e24b7beb1d4d336a38c45c",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 104,
"avg_line_length": 26.98581560283688,
"alnum_prop": 0.6438896189224704,
"repo_name": "rlucioni/days",
"id": "c18bd3bc7ba5afc43b5fdf0b5ecb46577d3f4ff4",
"size": "3805"... |
import requests
class LeClient(object):
def __init__(self):
self.endpoint = 'http://dbios.herokuapp.com/'
def request(self, path=None, params=None):
self.path = path
self.params = params
result = None
result = requests.get(self.endpoint + path, params=params)
... | {
"content_hash": "278a54a33084d2ede6326448c06c2b70",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 66,
"avg_line_length": 24.357142857142858,
"alnum_prop": 0.6099706744868035,
"repo_name": "fly/dbcli",
"id": "464ef8230c660bf85a04a4ddbef9d2d06c2bcda8",
"size": "341",
"b... |
from BattleBase import *
from DistributedBattleAI import *
from toontown.toonbase.ToontownBattleGlobals import *
import random
from toontown.suit import DistributedSuitBaseAI
import SuitBattleGlobals
import BattleExperienceAI
from toontown.toon import NPCToons
from toontown.pets import PetTricks, DistributedPetProxyAI
... | {
"content_hash": "21ab5790f06c3d6fcabeec2cfe6f48b6",
"timestamp": "",
"source": "github",
"line_count": 1619,
"max_line_length": 272,
"avg_line_length": 45.18282890673255,
"alnum_prop": 0.552063539801233,
"repo_name": "Spiderlover/Toontown",
"id": "d3cce0e70b8fad5c1f28c304abb0c62cc382e76d",
"size":... |
'''
MFEM example 8p
See c++ version in the MFEM library for more detail
How to run:
mpirun -np 2 python <arguments>
Example of arguments:
ex8p.py -m square-disc.mesh
ex8p.py -m star.mesh
ex8p.py -m escher.mesh
ex8p.py -m fichera.mesh
ex8p.py -m square-disc-p3.mesh
... | {
"content_hash": "9b07ed2616a04329a9eb79499c095faf",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 85,
"avg_line_length": 32.87822878228782,
"alnum_prop": 0.6894500561167228,
"repo_name": "mfem/PyMFEM",
"id": "dc432ae9d223493c61254024528e983af956925d",
"size": "8910",
... |
class BuiltIn(object):
def __init__(self):
self.code = []
self.methods = []
self.messages = []
self.defaults = {}
self.constant_names = ['False', 'True', 'Less', 'Equal', 'Greater', 'Empty', 'BuiltIn']
self.opaque_names = ['Constant', 'Small-Integer']
self.poi... | {
"content_hash": "0233935df577cf9e8303c0f867c132e3",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 128,
"avg_line_length": 37.30769230769231,
"alnum_prop": 0.6096219931271478,
"repo_name": "shaurz/ome",
"id": "9d71ef383788915fba20232178abe3c3347b8b3a",
"size": "1552",
... |
import time
# ============= local library imports ==========================
from pychron.core.helpers.strtools import csv_to_floats
from pychron.lasers.laser_managers.serial_laser_manager import SerialLaserManager
class ReadPositionError(BaseException):
def __init__(self, xyz):
self._msg = "ReadPositio... | {
"content_hash": "bf44f6ab0bef03b04d1d4352c1c8f4af",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 109,
"avg_line_length": 30.90459363957597,
"alnum_prop": 0.49485479076149097,
"repo_name": "NMGRL/pychron",
"id": "f10c4d9598b40f94fc5891c5b729f38b844b2364",
"size": "9612... |
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O'],
kineticsEstimator = 'rate rules',
)
# List of species
species(
label='ethane',
reac... | {
"content_hash": "fd7c7180b6c77dcbd5e505a45a9d04a7",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 71,
"avg_line_length": 19.557692307692307,
"alnum_prop": 0.6460176991150443,
"repo_name": "enochd/RMG-Py",
"id": "1bf80ef09e70a9645ec76339de3d4e0b475ed181",
"size": "1032",... |
import warnings
import numpy as np
from ..base import BaseEstimator, TransformerMixin
from ..utils.metaestimators import available_if
from ..utils.validation import (
_allclose_dense_sparse,
_check_feature_names_in,
check_array,
)
from ..utils._param_validation import StrOptions
def _identity(X):
""... | {
"content_hash": "ac11c8ca07c36d55dad8b573127874d3",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 88,
"avg_line_length": 35.84365781710915,
"alnum_prop": 0.6006913011274793,
"repo_name": "betatim/scikit-learn",
"id": "d4c2cf6de7af2163f29eeda2d5b261924427e1f6",
"size": ... |
def extractKysqiWordpressCom(item):
'''
Parser for 'kysqi.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'L... | {
"content_hash": "6c201c49e771c66d0ee8a72b9087c9ef",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.6284153005464481,
"repo_name": "fake-name/ReadableWebProxy",
"id": "6b70057fc5edb708e0f2bcbcdb6ad38a20566880",
"... |
import torch
from fairseq.optim.amp_optimizer import AMPOptimizer
from fairseq.tasks import register_task
from fairseq.tasks.speech_to_text import SpeechToTextTask
from .data.speech_to_text_dataset_with_domain import SpeechToTextDatasetCreatorWithDomain
from .loss.attention_head_selection import HeadSelectionLoss
@r... | {
"content_hash": "f98678d2f682cd8f1bfabade36553480",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 132,
"avg_line_length": 43.137142857142855,
"alnum_prop": 0.5788846204795337,
"repo_name": "pytorch/fairseq",
"id": "6e0ce11d6307493b30da865ba23adf23d0015b7c",
"size": "77... |
def foo(some_pa<caret>ram: str):
pass | {
"content_hash": "3fece53c695081387e9ba090fc3f314c",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 32,
"avg_line_length": 20.5,
"alnum_prop": 0.6585365853658537,
"repo_name": "siosio/intellij-community",
"id": "70e1da13e07e268bd7b70917d66290f638745660",
"size": "41",
"b... |
from unittest import TestCase
import klineyes
from klineyes.util.test_data import load_test_data
class TestEyes(TestCase):
def test_get_dates_pattern(self):
'''
testing
:return:
'''
klineyes.get_dates_pattern(input_data=load_test_data(), ptypes=['hammer', 'line', 'star']) | {
"content_hash": "070a93e5a7085313ab7669a68f3fceb9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 98,
"avg_line_length": 22.857142857142858,
"alnum_prop": 0.64375,
"repo_name": "tenstone/klineyes",
"id": "fb3fd86292dca0483f7cd4c678cca8ff70d6b9ec",
"size": "320",
"bina... |
"""
Wind Turbine Company - 2013
Author: Stephan Rayner
Email: stephan.rayner@gmail.com
"""
from HIL.controller.Base_Controller import Base_Controller
from Yaw_Generation import Yaw_Generation
Yaw_Generation = Yaw_Generation()
class Yaw_Manual(Base_Controller):
"""docstring for Yaw_Manual"""
def __init__(self)... | {
"content_hash": "0b171d2649f2e76555a047e566c2e3da",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 86,
"avg_line_length": 36.39622641509434,
"alnum_prop": 0.5759460860549508,
"repo_name": "stephan-rayner/HIL-TestStation",
"id": "bc96c7d3608c6635bf6269b3bc13c8fc9a6121a2",
... |
"""The type mappings for the ``simplejson``-like API.
In particular, this module provides the extension to native Python data types with
particulars of the Ion data model.
"""
# Python 2/3 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from ... | {
"content_hash": "c945eee0dafd18235b42e8665ee9c161",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 115,
"avg_line_length": 35.78536585365854,
"alnum_prop": 0.629907306434024,
"repo_name": "almann/ion-python",
"id": "9db902da13cc3d7944ff53dcc3aaf033ca784602",
"size": "79... |
import mock
from rally.plugins.openstack.context.network import allow_ssh
from tests.unit import fakes
from tests.unit import test
CTX = "rally.plugins.openstack.context.network.allow_ssh"
class AllowSSHContextTestCase(test.TestCase):
def setUp(self):
super(AllowSSHContextTestCase, self).setUp()
... | {
"content_hash": "af94c5eab9d90157c968c19cd63b00af",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 78,
"avg_line_length": 40.50375939849624,
"alnum_prop": 0.6047893075923519,
"repo_name": "redhat-openstack/rally",
"id": "8615bc08a1a9a2abf6e50b48d16c0ee6e84722d6",
"size"... |
import math, random
# Primality test functions. Assume that "n" is odd and greater than 3.
# Tests if 'n' is prime by trial division, by checking if it has a factor
# k (1 < k <= sqrt(n))
def trial_division(n):
return not(any(n % x == 0 for x in range(3, math.floor(math.sqrt(n))+1)))
# Tests if 'n' is a strong p... | {
"content_hash": "6d4ff592915901f3e5adb0bf87c22474",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 93,
"avg_line_length": 33.13861386138614,
"alnum_prop": 0.5760382432028682,
"repo_name": "JesseEmond/benchmarkus-prime",
"id": "7bebaf00c549693467be45d587f5818abd6a2a7b",
... |
from __future__ import unicode_literals
import sys
from PySide import QtGui
from PySide import QtCore
class Ejemplo11(QtGui.QWidget):
def __init__(self):
super(Ejemplo11, self).__init__()
self.WidgetsParte2_4()
def WidgetsParte2_4(self):
self.boton = QtGui.QPushButton('Abrir imagen')... | {
"content_hash": "b353953d9eeeea6e5614535c228344f8",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 69,
"avg_line_length": 31.93617021276596,
"alnum_prop": 0.6295802798134577,
"repo_name": "DoctorMalboro/CharlaPySidePyDayLujan2014",
"id": "798059fad1cc20011719935fe431a61385... |
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
import traceback
import sys
import functools
import asyncio
import simplejson as json
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm.exc import NoResultFound
import tornado.ioloop
import tornado.web
from... | {
"content_hash": "7c5f3a581c61338faa9b12797e66b7cf",
"timestamp": "",
"source": "github",
"line_count": 1006,
"max_line_length": 174,
"avg_line_length": 41.35487077534791,
"alnum_prop": 0.5814484532365455,
"repo_name": "mit-ll/python-keylime",
"id": "cfcb59f556094b20442dbc68eda467acad8028cf",
"size... |
import os
import setuptools
VERSION = '0.1.1'
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setuptools.setup(
name='pyglib',
author='Benjamin Staffin',
author_email='benley@gmail.com',
url='https://github.com/benley/pyglib',
install_requires=[
'python-gflags'... | {
"content_hash": "3d1fd1ab3db07978603657e1fcb09315",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 27.129032258064516,
"alnum_prop": 0.6076099881093936,
"repo_name": "benley/pyglib",
"id": "43cb28b47c5faf4602af4057e03636bafa1ffbb9",
"size": "864",
... |
"""
Note: Django 1.4 support was dropped in #107
https://github.com/pydanny/dj-stripe/pull/107
"""
from django.contrib import admin
from .models import Event, EventProcessingException, Transfer, Charge#, Plan
from .models import Invoice, InvoiceItem, CurrentSubscription, Customer
class CustomerHasCardListFi... | {
"content_hash": "a230291a54f32fba6c0b35b48725504c",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 77,
"avg_line_length": 23.23859649122807,
"alnum_prop": 0.5582062509436811,
"repo_name": "rawjam/dj-stripe",
"id": "fbedf2d89b79450e7ba0ed8e37ee0b81065db280",
"size": "664... |
from google.cloud import container_v1
async def sample_set_addons_config():
# Create a client
client = container_v1.ClusterManagerAsyncClient()
# Initialize request argument(s)
request = container_v1.SetAddonsConfigRequest(
)
# Make the request
response = await client.set_addons_config(r... | {
"content_hash": "aca4257155809b1d5e4c03533ba22870",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 67,
"avg_line_length": 25.11111111111111,
"alnum_prop": 0.7323008849557522,
"repo_name": "googleapis/python-container",
"id": "fd9de008a6cdc80fa06d1bff067b7a989bc8e54a",
"s... |
"""Tests for API client and approvals-related API calls."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import threading
import time
from absl import app
from grr_response_core.lib.util import compatibility
from grr_response_server.gui import api_aut... | {
"content_hash": "d259b136359af786f7d35075ac7751a1",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 78,
"avg_line_length": 31.118181818181817,
"alnum_prop": 0.7028921998247152,
"repo_name": "demonchild2112/travis-test",
"id": "252fa9510b263c17699823876c82a25658adfcb7",
"... |
"""Generates training data for learning/updating MentorNet."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import itertools
import os
import pickle
import models
import numpy as np
import tensorflow as tf
flags = tf.app.flags
flags.DEFINE_st... | {
"content_hash": "057dbf01187ad1d3b80f9bdccc39189b",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 78,
"avg_line_length": 28.72289156626506,
"alnum_prop": 0.6424077181208053,
"repo_name": "google/mentornet",
"id": "f4ccd15dfa60acae7876422e59a723e6b89bcea5",
"size": "544... |
import os
import sys
import yaml
def parse_args(envirnment, arguments):
manifest = envirnment.manifest
try:
with open(manifest, 'r') as stream:
available_arguments = yaml.load(stream)
except:
print('An error occurred while attempting to open the Manifest-file.')
sys.exi... | {
"content_hash": "bf2e90a267fe69448f5991e473fdf954",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 123,
"avg_line_length": 34.707070707070706,
"alnum_prop": 0.5480209545983702,
"repo_name": "char16t/wa",
"id": "9f88fd3bfd2379ec8c2ca5f48640abaca5ab04df",
"size": "3571",
... |
import os
from django.utils import six
from django.core.files.base import File, ContentFile
from django.core.files.storage import (
default_storage, Storage)
from django.db.models.fields.files import ImageFieldFile, FieldFile
from django.core.files.images import get_image_dimensions
from django.utils.safestring i... | {
"content_hash": "6c7b121d0812d4c8ff6c89f4a2e98ce0",
"timestamp": "",
"source": "github",
"line_count": 753,
"max_line_length": 79,
"avg_line_length": 38.45683930942895,
"alnum_prop": 0.6095379515159887,
"repo_name": "sandow-digital/easy-thumbnails-cropman",
"id": "796527962b8ccf7c380b598f7f7f4b59764... |
from __future__ import absolute_import
import os
import shutil
import nox
LOCAL_DEPS = (os.path.join("..", "api_core"), os.path.join("..", "core"))
@nox.session(python="3.7")
def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality iss... | {
"content_hash": "4de065bbffef44d93cd81da0e6470a5f",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 84,
"avg_line_length": 30.07638888888889,
"alnum_prop": 0.612791503117063,
"repo_name": "tswast/google-cloud-python",
"id": "0f528b7f3902a3125b02718b92dd0ccdb51edc45",
"si... |
import mock
from rdomanager_oscplugin.tests.v1.overcloud_node import fakes
from rdomanager_oscplugin.v1 import overcloud_node
class TestDeleteNode(fakes.TestDeleteNode):
def setUp(self):
super(TestDeleteNode, self).setUp()
# Get the command object to test
self.cmd = overcloud_node.Delet... | {
"content_hash": "290e9353022891cb5a2483fcf5332025",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 74,
"avg_line_length": 38.2,
"alnum_prop": 0.6116928446771379,
"repo_name": "rdo-management/python-rdomanager-oscplugin",
"id": "5433a0a62dd611be0b2fe96b90a962085da3fbb1",
... |
import requests
__author__ = 'Lei Yu'
# connection wrapper
class Error(Exception):
def __init__(self,message):
self.message=message
def __str__(self):
return repr(self.message)
class Connection:
def __init__(self,host="api.coursera.org/api",version="catalog.v1"):
self.host=host
... | {
"content_hash": "e151bc31e4843c1b9efd250bb2a7b578",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 72,
"avg_line_length": 17.72093023255814,
"alnum_prop": 0.5826771653543307,
"repo_name": "leiyu123/coursera_rest_client",
"id": "ab103b639e9bde1f944acc22c2a786112da0c54d",
... |
import abc
class FwaasDriverBase(object, metaclass=abc.ABCMeta):
"""Firewall as a Service Driver base class.
Using FwaasDriver Class, an instance of L3 perimeter Firewall
can be created. The firewall co-exists with the L3 agent.
One instance is created for each tenant. One firewall policy
is ass... | {
"content_hash": "54f77130fcfe376623dbcb9d29462983",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 79,
"avg_line_length": 36.13725490196079,
"alnum_prop": 0.6923494302767227,
"repo_name": "openstack/neutron-fwaas",
"id": "afdb7d15dff2d2bf710334fa664166b3d648b1ff",
"size... |
import os
import config
import web
import app.controllers
urls = (
# front page
'/', 'app.controllers.home.index',
'/hello/', 'app.controllers.hello.index',
)
app = web.application(urls, globals())
def notfound():
render = web.template.render(config.global_template_path, base='layout', cache=config... | {
"content_hash": "850bfabbb516908a8b7268e1a1332321",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 128,
"avg_line_length": 31.314285714285713,
"alnum_prop": 0.7071167883211679,
"repo_name": "neuweb/mvc-webpy",
"id": "a97b2131ffa4e62d492f6f5c46cd8414d6b6c8e1",
"size": "11... |
import time
from openerp.osv import fields, osv
from openerp.osv.orm import browse_record, browse_null
from openerp.tools.translate import _
class purchase_requisition_partner(osv.osv_memory):
_name = "purchase.requisition.partner"
_description = "Purchase Requisition Partner"
_columns = {
'partner... | {
"content_hash": "c0592eb2b30afdc67f388e560f8d21b8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 123,
"avg_line_length": 43.8125,
"alnum_prop": 0.6697574893009985,
"repo_name": "chjw8016/GreenOdoo7-haibao",
"id": "58a72556b221925ed3dfa87cb79a89e316b347ee",
"size": "238... |
import re
import json
import dateutil
import logging
import urllib3
import collections
from bson import ObjectId
from urllib.parse import urlparse, parse_qs, parse_qsl
from datetime import date, datetime
import requests
from functools import partial
from time import time, sleep
from slovar.strings import split_strip,... | {
"content_hash": "baa38fa6c51658a13a1a912b149b2413",
"timestamp": "",
"source": "github",
"line_count": 651,
"max_line_length": 105,
"avg_line_length": 27.043010752688172,
"alnum_prop": 0.5413234876455553,
"repo_name": "vahana/prf",
"id": "6282ea7fbb0af6689b777f13dbe251b583b64d46",
"size": "17605",... |
import zlib
import cPickle
import sqlite3
try:
from cyordereddict import OrderedDict
except:
from collections import OrderedDict
def pack_blob(obj):
return sqlite3.Binary(zdumps(obj))
def unpack_genotype_blob(blob):
return cPickle.loads(zlib.decompress(blob))
def unpack_ordereddict_blob(blob):
... | {
"content_hash": "ad930efcd0071e2e3d9e277df6fc2bcd",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 73,
"avg_line_length": 22.48148148148148,
"alnum_prop": 0.7347611202635914,
"repo_name": "bpow/gemini",
"id": "63dbf34f94b2f5a84e8f9ce89d0ea1760c2f1c74",
"size": "607",
"... |
import collections
import six
import unittest2 as unittest
from fabricio import docker, utils
class OptionsTestCase(unittest.TestCase):
def test_str_version(self):
cases = dict(
empty_options_list=dict(
options=collections.OrderedDict(),
expected_str_version=... | {
"content_hash": "6558588923e1464d5f2163812333df28",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 81,
"avg_line_length": 36.744680851063826,
"alnum_prop": 0.47278517660683267,
"repo_name": "renskiy/fabricio",
"id": "b5ebdd3797ed9725c9b55e053c59bab3a63d7f15",
"size": "34... |
"""The fsl module provides classes for interfacing with the `FSL
<http://www.fmrib.ox.ac.uk/fsl/index.html>`_ command line tools. This
was written to work with FSL version 4.1.4.
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file_... | {
"content_hash": "6cc444438cbd64366033cf10821f3f32",
"timestamp": "",
"source": "github",
"line_count": 779,
"max_line_length": 206,
"avg_line_length": 50.03209242618742,
"alnum_prop": 0.6096215522771007,
"repo_name": "satra/NiPypeold",
"id": "85c59fa61e630dcb3c46e79f0a9c2b2fc34a29cb",
"size": "390... |
from GitClient import GitClient
from JumpScale import j
class GitFactory:
def __init__(self):
j.logger.consolelogCategories.append("git")
def getClient(self, basedir, remoteUrl="", branchname='master', cleandir=False,login=None,passwd=None):
"""
return a mercurial tool which you can h... | {
"content_hash": "c8c52ec8cd91cb10dbfec8904908cb2b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 132,
"avg_line_length": 42.45454545454545,
"alnum_prop": 0.684154175588865,
"repo_name": "Jumpscale/jumpscale6_core",
"id": "adf8719c51dc3f1650693e0c333702e2399b47d3",
"siz... |
"""Globals"""
from django.conf import settings
KEY_STUBS_OPEN_METEAR_API = "open_metear_api"
URL_STUBS_CHANGE_ROUTE_CONFIG = "%s/stubs/change_route_configuration/" % settings.SITE_URL
| {
"content_hash": "5e1d9c4935bf889d92a01ba7ffefcba7",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 90,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.7433155080213903,
"repo_name": "timevortexproject/timevortex",
"id": "7140d54dd9362cbc55187737acda63d952f4d32f",
"... |
"""
Support for interface with an Harman/Kardon or JBL AVR.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.harman_kardon_avr/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassista... | {
"content_hash": "86c96bd3eb9b7425c9fc12266b153c77",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 74,
"avg_line_length": 27.06766917293233,
"alnum_prop": 0.6191666666666666,
"repo_name": "PetePriority/home-assistant",
"id": "334757c086dbaf670512c8776d55e08dbc1cb8a0",
"... |
"""Common runtime ctypes."""
# pylint: disable=invalid-name
from __future__ import absolute_import
import ctypes
import json
import numpy as np
from .base import _LIB, check_call
from .. import _api_internal
tvm_shape_index_t = ctypes.c_int64
class TypeCode(object):
"""Type code used in API calls"""
INT = 0
... | {
"content_hash": "c95cba26a0e819cec737938519d9cecd",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 84,
"avg_line_length": 29.528301886792452,
"alnum_prop": 0.5304792332268371,
"repo_name": "mlperf/training_results_v0.7",
"id": "72cff1a10eadbd7d75c23276b043e47cf2d88d16",
... |
import Adafruit_Nokia_LCD as LCD
import Adafruit_GPIO.SPI as SPI
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from re import sub
# Edison software SPI config:
SCLK = 35 # 10
DIN = 26 # 11
DC = 25 # 32
RST = 45 # 46
CS = 31 # 23
disp = LCD.PCD8544(DC, RST, SCLK, DIN, CS)
with open('... | {
"content_hash": "31e987504572a5bdce4921282070cd81",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 100,
"avg_line_length": 24.375,
"alnum_prop": 0.6905982905982906,
"repo_name": "projectbuendia/server-status",
"id": "01b78579525ad7dec2895be9788bea08c2cdf83c",
"size": "60... |
"""A library containing exception types used by Endpoints ProtoRPC services."""
import httplib
from protorpc import remote
class ServiceException(remote.ApplicationError):
"""Base class for request/service exceptions in Endpoints."""
def __init__(self, message=None):
super(ServiceException, self).__ini... | {
"content_hash": "4ccfbdaa72df80bd448e08a2579bc29c",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 28.93548387096774,
"alnum_prop": 0.750278706800446,
"repo_name": "justingrayston/gae-python-endpoints-patch",
"id": "25c6513ff33ff705ac1ab4c191fee7a0d0... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickformatstop(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "indicator.gauge.axis"
_path_str = "indicator.gauge.axis.tickformatstop"
_valid_props... | {
"content_hash": "35f2d68f9a639bf2f0f37e6cb583f00d",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 82,
"avg_line_length": 33.745583038869256,
"alnum_prop": 0.5631413612565445,
"repo_name": "plotly/python-api",
"id": "c1229fce583d3e09171760092e83644dab96ac5a",
"size": "9... |
import os
import pytest
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def fixtures_dir():
return os.path.join(TESTS_DIR, 'fixtures')
| {
"content_hash": "bbaccb2b706d0ab817ff2472333b1b3d",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 18.333333333333332,
"alnum_prop": 0.7090909090909091,
"repo_name": "red-hat-storage/rhcephcompose",
"id": "b217a51a0479bfb18f18871cebe6f245fca14274",
... |
"""
sentry.conf.server
~~~~~~~~~~~~~~~~~~
These settings act as the default (base) settings for the Sentry-provided web-server
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf.global_se... | {
"content_hash": "7abf6141d1d1618de90b1770df689a48",
"timestamp": "",
"source": "github",
"line_count": 838,
"max_line_length": 113,
"avg_line_length": 29.011933174224342,
"alnum_prop": 0.6535867061533399,
"repo_name": "BayanGroup/sentry",
"id": "38ac7714a33cdc3573f545c04aa08f71552c789c",
"size": "... |
"""Utility to retrieve function args."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import os
import time
from tensorflow.python.platform import gfile
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python... | {
"content_hash": "463fd66b846bc1f17c3debd2479aca24",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 80,
"avg_line_length": 32.88172043010753,
"alnum_prop": 0.7164813603662524,
"repo_name": "allenlavoie/tensorflow",
"id": "bb4bdd3fdfb2e19dbc1c581d7771f2e1ac4442ba",
"size":... |
"""Classes and functions used to construct graphs."""
# pylint: disable=g-bad-name
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import os
import re
import sys
import threading
import numpy as np
import six
from six.moves im... | {
"content_hash": "09401ad4856b6f27d65cd3eb401011f7",
"timestamp": "",
"source": "github",
"line_count": 6106,
"max_line_length": 116,
"avg_line_length": 36.42581067802162,
"alnum_prop": 0.6636707790806416,
"repo_name": "ZhangXinNan/tensorflow",
"id": "5527f5286074baefaa29c6aec8a7c027a759f377",
"siz... |
import pytest
from spacy.serialize.packer import Packer
from spacy.attrs import ORTH, SPACY
from spacy.tokens import Doc
import math
@pytest.mark.models
def test_read_write(EN):
doc1 = EN(u'This is a simple test. With a couple of sentences.')
doc2 = EN(u'This is another test document.')
with open('/tmp/... | {
"content_hash": "32866957be4e772c525bd6afbb161343",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 68,
"avg_line_length": 28.764705882352942,
"alnum_prop": 0.6319018404907976,
"repo_name": "pombredanne/spaCy",
"id": "f90bb20c2473d6873041cc310118fc3f11ff25d4",
"size": "14... |
import pandas as pd
import pytz
from itertools import cycle
import numpy as np
from six import integer_types
from unittest import TestCase
import zipline.utils.factory as factory
from zipline.sources import (DataFrameSource,
DataPanelSource,
RandomWalkSource)... | {
"content_hash": "0445364ea2c108bafbf92cec340446bb",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 75,
"avg_line_length": 40.97560975609756,
"alnum_prop": 0.5583333333333333,
"repo_name": "mmilutinovic1313/zipline-with-algorithms",
"id": "3664acdd656bd1672aab548357645409c... |
"""bigtable instances update command."""
from googlecloudsdk.api_lib.bigtable import util
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.bigtable import arguments
from googlecloudsdk.core import log
from googlecloudsdk.core import resources
class UpdateInstance(base.UpdateCommand):
"""Mod... | {
"content_hash": "ce9653c98abb970e8813b7c062267222",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 34.61538461538461,
"alnum_prop": 0.7377777777777778,
"repo_name": "Sorsly/subtle",
"id": "2b28fb6b90c0c4e4433b4d912ea87009364cdd5e",
"size": "1945",
... |
import sys
import imp
import contextlib
@contextlib.contextmanager
def preserve_value(namespace, name):
""" A context manager to preserve, then restore, the specified binding.
:param namespace: The namespace object (e.g. a class or dict)
containing the name binding.
:param name: The n... | {
"content_hash": "18f58c4593698f7eea56f492546820c6",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 33.673469387755105,
"alnum_prop": 0.6442424242424243,
"repo_name": "kyleterry/tenyksclient",
"id": "f631707919076da94d7482af01e73b4cff1b41fe",
"size"... |
"""Provides device automations for Alarm control panel."""
from typing import List
import voluptuous as vol
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,
SUPPORT_ALARM_ARM_NIGHT,
)
from homeassistant.components.automation import Automation... | {
"content_hash": "95a5450d7c66404ac61f8bc5f888135f",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 80,
"avg_line_length": 31.814569536423843,
"alnum_prop": 0.5868026644462948,
"repo_name": "postlund/home-assistant",
"id": "95ae17aaaf5621041afa501292be150ce0a13bfd",
"siz... |
"""Microsoft SQLServer hook module"""
from __future__ import annotations
from typing import Any
import pymssql
from airflow.providers.common.sql.hooks.sql import DbApiHook
class MsSqlHook(DbApiHook):
"""Interact with Microsoft SQL Server."""
conn_name_attr = 'mssql_conn_id'
default_conn_name = 'mssql_... | {
"content_hash": "44d450d343a516b3b61b09224e3be1e6",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 107,
"avg_line_length": 32.81818181818182,
"alnum_prop": 0.6078793474915358,
"repo_name": "cfei18/incubator-airflow",
"id": "20c1d4a4530138ff597e4ee914cc45f59d838215",
"siz... |
'''
This example shows training of the POS tagger without the Language class,
showing the APIs of the atomic components.
This example was adapted from the gist here:
https://gist.github.com/kamac/a7bc139f62488839a8118214a4d932f2
Issue discussing the gist:
https://github.com/explosion/spaCy/issues/1179
The example ... | {
"content_hash": "4df6f9557c1640ef7c91f254e409943f",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 75,
"avg_line_length": 30.951219512195124,
"alnum_prop": 0.5986997635933806,
"repo_name": "raphael0202/spaCy",
"id": "ce1ab50d6406a46b19273ddfbd81dd9ff248d9cf",
"size": "5... |
import asyncio
import json
import logging
from aio_jsonrpc_20.exception import (
InvalidRequestException,
CustomJsonRpcException
)
from aio_jsonrpc_20.response import ResponseMaker
from aio_jsonrpc_20.utils import (
is_valid_params,
check_request,
lazy_check_request
)
logger = logging.getLogger(_... | {
"content_hash": "1cfabaa7c3c8bcbc564afdd5e8d24e6a",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 72,
"avg_line_length": 33.391304347826086,
"alnum_prop": 0.5210193452380952,
"repo_name": "steffgrez/aio-jsonrpc-2.0",
"id": "11a26337d475b97826c0d1401283469ea67c7c76",
"s... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/opee_sea_killer/shared_lair_opee_sea_killer_underwater.iff"
result.attribute_template_id = -1
result.stfName("lair_n","opee_sea_killer_underwater")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATION... | {
"content_hash": "023b96b8ac548ef2d3e7954d16787e14",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 100,
"avg_line_length": 26.46153846153846,
"alnum_prop": 0.7093023255813954,
"repo_name": "anhstudios/swganh",
"id": "0c9a96b926ff435092e71e00db4c5c2613c1849f",
"size": "48... |
"""AbstractCardRequest class.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License ... | {
"content_hash": "254d9a9cf831fd77299466ef417c9fdb",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 75,
"avg_line_length": 38.111111111111114,
"alnum_prop": 0.6495626822157434,
"repo_name": "mixja/eap-sim-lab",
"id": "ef3206f045180e1ab4920e97356979ca745c6418",
"size": "34... |
__author__ = 'adrian'
from PyQt4 import QtGui
from PyQt4 import QtCore
from parking_app.UI.WarningConfirmationUI import WarningConfirmationUI
import parking_app.Common as Common
import random
class SlotUI(QtGui.QWidget):
def __init__(self):
super(SlotUI, self).__init__()
self.initUI()
def... | {
"content_hash": "0ad7acf9de53f783d110df4055b828a4",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 70,
"avg_line_length": 27.234567901234566,
"alnum_prop": 0.642792384406165,
"repo_name": "Nebla/cylindricalParkingPrototype",
"id": "644f5de4bedcf8eb3d60142e804d81e1ec721687"... |
"""Data tests for cclib."""
| {
"content_hash": "228daa9de2075af935de84d8bb3fadd2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 27,
"avg_line_length": 28,
"alnum_prop": 0.6071428571428571,
"repo_name": "cclib/cclib",
"id": "888af5721a312dca5576ca313aed46d8b1adc27a",
"size": "226",
"binary": false,
... |
from amonagent.modules.processes import processes_data_collector
from amonagent.modules.core import (
get_uptime,
get_memory_info,
get_cpu_utilization,
get_load_average,
disk_check,
get_network_traffic,
get_ip_address,
get_cpu_info
)
from amonagent.modules.distro import get_distro
from amonagent.modules.plugins... | {
"content_hash": "444c76103935ebeb7f2afcc785a3ccc2",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 75,
"avg_line_length": 19.91304347826087,
"alnum_prop": 0.6899563318777293,
"repo_name": "amonapp/amonagent-legacy",
"id": "fa5554322f4c9dd81f36eb7ddb8bec3624d5d196",
"size... |
from bda.plone.shop.tests import set_browserlayer
from bda.plone.shop.tests import Shop_INTEGRATION_TESTING
from bda.plone.shop.utils import get_shop_settings
import plone.api
import unittest2 as unittest
class TestUser(unittest.TestCase):
layer = Shop_INTEGRATION_TESTING
def setUp(self):
self.porta... | {
"content_hash": "2c4ee309b1c148216c7b8c2e2568fce3",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 75,
"avg_line_length": 31.071428571428573,
"alnum_prop": 0.6505747126436782,
"repo_name": "TheVirtualLtd/bda.plone.shop",
"id": "b9998ec13b9c229fa90fc1bdf5422efbf9dead39",
... |
import click
@click.command()
def main(args=None):
"""Console script for mcmc"""
click.echo("Replace this message by putting your code into "
"mcmc.cli.main")
click.echo("See click documentation at http://click.pocoo.org/")
if __name__ == "__main__":
main()
| {
"content_hash": "2224ad9c9977916db08dad04cd5d056d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 68,
"avg_line_length": 22.53846153846154,
"alnum_prop": 0.6143344709897611,
"repo_name": "mchakra2/parallelmcmc",
"id": "4b5d817d54d3c434e5a2fcf9ead9658c39c2b498",
"size": ... |
import sharedLogger
import books
import parseUsfm
class AbstractRenderer(object):
def __init__(self, inputDir, outputDir, outputName, config):
self.identity = 'abstract renderer' if not self.identity else self.identity
self.outputDescription = outputName if not self.outputDescription else se... | {
"content_hash": "e372f788c4883ee00d6d0e34203036b2",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 114,
"avg_line_length": 49.687150837988824,
"alnum_prop": 0.662019338880144,
"repo_name": "openenglishbible/USFM-Tools",
"id": "7f20d963db9e3267327ee13d1f2d156ab27e2a4e",
... |
"""Generic device for the HomematicIP Cloud component."""
import logging
from typing import Optional
from homematicip.aio.device import AsyncDevice
from homematicip.aio.home import AsyncHome
from homeassistant.components import homematicip_cloud
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLo... | {
"content_hash": "a85fa6706dd0496437ea27b84ca0a271",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 77,
"avg_line_length": 35.72477064220183,
"alnum_prop": 0.6019517205957884,
"repo_name": "jnewland/home-assistant",
"id": "6bbbb8b4fab4a887ce98c9aa1111975715893d97",
"size... |
from unreal_engine.classes import PyFactory, StaticMesh, Object, Class
import unreal_engine as ue
from collada import Collada
from unreal_engine.structs import StaticMeshSourceModel, MeshBuildSettings
from unreal_engine import FRawMesh
import numpy
from unreal_engine import FVector, FRotator
from unreal_engine impo... | {
"content_hash": "7bbccb7a214be8516fdc3951c92f9d46",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 201,
"avg_line_length": 40.04964539007092,
"alnum_prop": 0.6047458827696122,
"repo_name": "getnamo/UnrealEnginePython",
"id": "33b8b0edcfd7cdf9c1d126ba8013ee308e209b0a",
"... |
import inspect
import six
import collections
__all__ = [
'is_simple_callable',
'is_iterable',
'force_str',
'get_object_by_source',
'filter_list',
]
def is_simple_callable(obj):
'''
True if the object is a callable and takes no arguments, else False.
'''
function = inspect.isfunct... | {
"content_hash": "9aaee13289e4db6cf8d65554dace189b",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 72,
"avg_line_length": 26.202380952380953,
"alnum_prop": 0.5856428895956384,
"repo_name": "localmed/pyserializer",
"id": "6149cc497f644e7a859391eab1a47820377017be",
"size":... |
__all__ = ['AutoARIMAProphet']
# %% ../../nbs/adapters.prophet.ipynb 3
import sys
from copy import deepcopy
import pandas as pd
from ..arima import AutoARIMA
if sys.version_info.minor != 6 or (sys.platform not in ["win32", "cygwin"]):
try:
from prophet import Prophet
except ModuleNotFoundError as e:
... | {
"content_hash": "d04682a31b8724ce9bff7d9ec31c45b1",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 204,
"avg_line_length": 35.7043795620438,
"alnum_prop": 0.5834611060002044,
"repo_name": "Nixtla/statsforecast",
"id": "ae4dea87d9a826a35a6a036d20bdf78a5eef505b",
"size": ... |
"""Command-line sample app demonstrating customer-supplied encryption keys.
This sample demonstrates uploading an object while supplying an encryption key,
retrieving that object's contents, and finally rotating that key to a new
value.
This sample is used on this page:
https://cloud.google.com/storage/docs/json... | {
"content_hash": "adef7e04060042722780d2ebab118538",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 79,
"avg_line_length": 39.20979020979021,
"alnum_prop": 0.6873550918494739,
"repo_name": "GoogleCloudPlatform/python-docs-samples",
"id": "4ddd4e78ccaac44e0570fc942598c859d1... |
from __future__ import absolute_import, division, print_function
def update_attributes(obj, dictionary, keys):
if not dictionary:
return
for key in keys:
if key not in dictionary:
continue
value = dictionary[key]
if getattr(obj, key) is not None and value is None... | {
"content_hash": "3f46eca852679cbc8bb5a56716c27b3f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 64,
"avg_line_length": 22.05,
"alnum_prop": 0.5963718820861678,
"repo_name": "fuzeman/trakt.py",
"id": "98be8ad35c9da8ef5fd9dc716ffdd5e3cf2aca8d",
"size": "441",
"binary"... |
import numpy as np
import cv2
import sys
from video import Video
import os
if __name__ == "__main__":
videopath = sys.argv[1]
video = Video(videopath)
video.negate()
| {
"content_hash": "a26068e4ff5c81b8cdaa194fc6aa4050",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 28,
"avg_line_length": 15.153846153846153,
"alnum_prop": 0.5989847715736041,
"repo_name": "adobe-research/video-lecture-summaries",
"id": "da8c04e4d49673a02332477243ae8ad89fa... |
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensi... | {
"content_hash": "65d259a03a469cdc96161de39b819728",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 80,
"avg_line_length": 28.267080745341616,
"alnum_prop": 0.6855636123928807,
"repo_name": "diefenbach/django-cba",
"id": "52b040a94ac639291fbedee56e7edc34d940facf",
"size"... |
"""Contains tests for oweb.views.basic.home"""
# Python imports
from unittest import skip
# Django imports
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from django.contrib.auth.models import User
# app imports
from oweb.tests import OWebViewTests
from oweb.models.account ... | {
"content_hash": "9294f7d50e3e85686e223caf8496952f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 93,
"avg_line_length": 39.93939393939394,
"alnum_prop": 0.6608497723823976,
"repo_name": "Mischback/django-oweb",
"id": "2798ef9da63ccbd6cce38817f60b5cd407e69587",
"size": ... |
from msrest.serialization import Model
class ReplicaInfo(Model):
"""Information about the identity, status, health, node name, uptime, and
other details about the replica.
:param replica_status: Possible values include: 'Invalid', 'InBuild',
'Standby', 'Ready', 'Down', 'Dropped'
:type replica_st... | {
"content_hash": "a893e6f9ea20cc74ea4827cd4c87009b",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 133,
"avg_line_length": 40.57142857142857,
"alnum_prop": 0.6413480885311871,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "1f3cc3d49400e6e97950a4984b40de0118968872",... |
from SDAWithVectorField import Obstacle
from SDAWithVectorField import Constants
class StationaryObstacle(Obstacle):
"""
Wrapper class for Stationary obstacles
"""
def __init__(self, point, radius, height):
"""
:param point: The point for the stationary obstacle
:type point: Nu... | {
"content_hash": "c0a7be051fccd825de6752963963029f",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 72,
"avg_line_length": 25.842105263157894,
"alnum_prop": 0.59979633401222,
"repo_name": "FlintHill/SUAS-Competition",
"id": "086baf076da8f74e366f7e3055f804a0b3043430",
"siz... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_rebel_specforce_guerrilla_human_female_01.iff"
result.attribute_template_id = 9
result.stfName("npc_name","human_base_female")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
re... | {
"content_hash": "88f9c868cf6232f412ea82fd25b0984b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 95,
"avg_line_length": 25.46153846153846,
"alnum_prop": 0.7099697885196374,
"repo_name": "anhstudios/swganh",
"id": "c699bf91c80d44045cdd976424c0ddd611ac3b12",
"size": "476... |
from tempest_lib import exceptions as lib_exc
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import test
class NetworksNegativeTestJSON(base.BaseNetworkTest):
@test.attr(type=['negative'])
@test.idempotent_id('9293e937-824d-42d2-8d5b-e985ea67002a')
def test... | {
"content_hash": "abae23ca80758ab2cf640d486d5b5ebc",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 79,
"avg_line_length": 42.125,
"alnum_prop": 0.6409495548961425,
"repo_name": "xbezdick/tempest",
"id": "4d1971f9f2f262a5df9b61a79a11f446978f905b",
"size": "4052",
"binar... |
import os
from os import path
import sys
from optparse import OptionParser
import json
dataset = {"dataset": {"listing": [], "ui": [], "manifest": [], "code": [] }}
def generate_target(source_dir, targetType):
for root, dirs, files in os.walk(source_dir):
if len(dirs) == 0:
entry = {"target": ... | {
"content_hash": "a6a271e4aac542e70067afa70b208bf2",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 116,
"avg_line_length": 35.214285714285715,
"alnum_prop": 0.6206896551724138,
"repo_name": "sieveable/sieveable-tools",
"id": "bdd161c22068445bac9cd5e53235699967547112",
"s... |
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('expenses.urls')),
] + static(settings.STATIC_URL, document_root=settings.STATIC_R... | {
"content_hash": "0efe738b48617aa4a52e09f56337c09e",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 67,
"avg_line_length": 32.5,
"alnum_prop": 0.7446153846153846,
"repo_name": "asyncee/home-bookkeeping-sample",
"id": "acfe22c2de42a8a3ce032c2847b421311d65db03",
"size": "32... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.