text stringlengths 4 1.02M | meta dict |
|---|---|
from spotify.utils.cache import Cache
class IntegrationTestCase(object):
def setUp(self):
Cache.clear()
def tearDown(self):
Cache.clear() | {
"content_hash": "106dca3f28b6d1bdb476f15cc4cefc1f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 37,
"avg_line_length": 18.22222222222222,
"alnum_prop": 0.6646341463414634,
"repo_name": "husman/WoTrack",
"id": "921b78d2af8e7856b3f6de9038ca41d59063fadb",
"size": "164",
... |
import qpid
from qpid.client import Client
from qpid.content import Content
class QpidAMQP08Hub(BaseAMQPHub):
client = None
def __init__(self, broker, username=None, password=None, ssl=False):
"""
Initialize the Moksha Hub.
`broker`
[amqps://][<user>[/<password>]@]<host>[... | {
"content_hash": "ebbf4a5bf20f94dc1e25c9a2746ef5cd",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 74,
"avg_line_length": 33.76470588235294,
"alnum_prop": 0.568815331010453,
"repo_name": "pombredanne/moksha",
"id": "bd802c4d59d8fbba13d09e2bdca1bf845092ba0a",
"size": "298... |
'''
Created on 21 janv. 2014
@author: Nicolas Carre
'''
from AbstractDAO import AbstractDAO
from system.Qualification import Qualification
from interfacebdd.CraftDAO import CraftDAO
from string import Template
class QualificationDAO(AbstractDAO):
'''
Classe QualificationDAO :
Herite de ... | {
"content_hash": "bcda06ede4ad729507e948edc43f7bf1",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 133,
"avg_line_length": 26.51219512195122,
"alnum_prop": 0.5749770009199632,
"repo_name": "gpierre42/optraj",
"id": "cc8a0c68d160abb0ce71c6a9f84ed203b3e72cce",
"size": "108... |
import unittest
from leetcode.no1_two_sum import Solution
class Test(unittest.TestCase):
def setUp(self):
self.solution = Solution()
def test_two_sum(self):
nums = [3, 2, 4]
target = 6
self.assertEqual(self.solution.twoSum(nums, target), [1, 2])
def test_two_sum_2(self):... | {
"content_hash": "9bd5714df77ea7056dd2323f4029daef",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 25.26086956521739,
"alnum_prop": 0.5834767641996558,
"repo_name": "minfun/leetcode",
"id": "5b627ad33c5ed3f8fd642c0baf9485ba82841a28",
"size": "712",... |
import os
from office365.sharepoint.file import File
from office365.sharepoint.file_creation_information import FileCreationInformation
from tests import random_seed
from tests.sharepoint_case import SPTestCase
from tests.test_methods import (
read_file_as_binary,
read_file_as_text,
ensure_list)
from offi... | {
"content_hash": "59812ce1d9bdf73cf8e5c1c0651c722d",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 117,
"avg_line_length": 40.25,
"alnum_prop": 0.6198475437605873,
"repo_name": "vgrem/SharePointOnline-REST-Python-Client",
"id": "320b5f43b988f260fb3c579c122e4610e30c7bf2",
... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:13144")
else:
access = Se... | {
"content_hash": "cb9c94483671aa33532fdb3f80623a55",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 79,
"avg_line_length": 24.188271604938272,
"alnum_prop": 0.661860405767513,
"repo_name": "LiveChains/Live-Coin",
"id": "a8846ab7f42b525c49c3e90ec595e9b3985a5f92",
"size": ... |
import sys
import os.path
import warnings
import unittest
def addParentToPath():
"""
Add the parent directory to sys.path to make it importable.
"""
try:
d = os.path.dirname(__file__)
except NameError:
d = os.path.dirname(sys.argv[0])
parent = os.path.normpath(os.path.join(d, '... | {
"content_hash": "0744717818a72583651bd2610303e72a",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 78,
"avg_line_length": 28.23497267759563,
"alnum_prop": 0.607122121153474,
"repo_name": "necaris/python3-openid",
"id": "ca0d036c53ac86659d0caf84c9f210f70a6e9901",
"size":... |
from django.db import models
from django.contrib.sites.models import Site
from shoppy.l10n.models import Language
class Link(models.Model):
"""
Simple link object. multi-site is supported.
"""
url = models.URLField()
added_date = models.DateTimeField(auto_now_add=True)
site = models.ForeignKey... | {
"content_hash": "79ac2ea5b49f7c986bfa8cbf37d2f16e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 76,
"avg_line_length": 32.03846153846154,
"alnum_prop": 0.673469387755102,
"repo_name": "pocketone/django-shoppy",
"id": "72cf892f4191c2749030a4725e984a61a3926f1e",
"size":... |
"""
Django settings for rooster project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
#... | {
"content_hash": "858f90efcf98ebb2d7352c907ed5090d",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 91,
"avg_line_length": 26.491803278688526,
"alnum_prop": 0.6896658415841584,
"repo_name": "thomasleese/rooster",
"id": "1af2c09967fbc83b469aa44685d17cada69381b2",
"size": ... |
AUTH = 'b9c39a336bb97a9c9bda2b82bdaacff3'
# directory to save output files to
ARCHIVE_DIR = 'archive'
#
# The below configs let you bake in the server IP and beacon interval
# into the final executable so it can simply be executed without supplying
# command line arguments.
#
# server IP
#
# if this is None, it *mus... | {
"content_hash": "c42a4062091bd2c50afcaa507a3038e3",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 74,
"avg_line_length": 24.76923076923077,
"alnum_prop": 0.734472049689441,
"repo_name": "mossberg/poet",
"id": "22ba1046cffc1942c326b5bdc6a74de8c8c6c39d",
"size": "744",
... |
import zmq
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--sub', help='django subscription socket', type=str, required=True)
parser.add_argument('-p', '--pub', help='tornado publication socket', type=str, required=True)
args = parser.parse_args()
ctx = ... | {
"content_hash": "4c6eccba80d0524633ff67593bcafec7",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 98,
"avg_line_length": 25.923076923076923,
"alnum_prop": 0.6439169139465876,
"repo_name": "mike-grayhat/djazator",
"id": "a47f24c01ad42fe3df5400c74b016c6c9f4a853b",
"size":... |
from __future__ import unicode_literals
from tgext.ecommerce.lib.exceptions import CategoryAssignedToProductException
from stroller2.lib import get_new_category_form, get_edit_category_form
from tg import expose, TGController, app_globals, validate, redirect, flash
import tg
from tgext.pluggable import plug_url
from tg... | {
"content_hash": "aaf6c87b2a68e2eaba3a862bef061c9f",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 106,
"avg_line_length": 44.38461538461539,
"alnum_prop": 0.6650779896013865,
"repo_name": "gasbasd/tgapp-stroller2",
"id": "6575a6e3c4c5e0f3ddc2b4fc860faef145a86d9f",
"size... |
from datetime import datetime
def convert_date(datestring):
return datetime.strptime(datestring, '%b %d %Y %I:%M%p')
def convert_to_json(lineEntry):
with open('data.txt') as f:
lines = f.readlines()
print lines
for entry in lines:
convert_to_json(entry)
| {
"content_hash": "18890400874f388f0748141d30dd9c65",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 57,
"avg_line_length": 15.705882352941176,
"alnum_prop": 0.7078651685393258,
"repo_name": "apokellypse/shout-webapp",
"id": "1421d09fa4017a95dea759ddf3cc459eb0786849",
"siz... |
from node import hex, nullid, nullrev, short
from lock import release
from i18n import _, gettext
import os, re, sys, difflib, time, tempfile
import hg, util, revlog, bundlerepo, extensions, copies, error
import patch, help, mdiff, url, encoding, templatekw
import archival, changegroup, cmdutil, sshserver, hbisect
from... | {
"content_hash": "6f4212f01acec1e741fa6bce7404b55a",
"timestamp": "",
"source": "github",
"line_count": 3866,
"max_line_length": 83,
"avg_line_length": 37.14692188308329,
"alnum_prop": 0.5599331522874451,
"repo_name": "joewalnes/idea-community",
"id": "d3135d385e60ad23e9896978692d5441462dc212",
"si... |
from .sub_resource import SubResource
class InboundNatRule(SubResource):
"""Inbound NAT rule of the load balancer.
Variables are only populated by the server, and will be ignored when
sending a request.
:param id: Resource ID.
:type id: str
:param frontend_ip_configuration: A reference to fr... | {
"content_hash": "28b7ccc0efd0e8d49ea7013cee4681cc",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 124,
"avg_line_length": 51.02469135802469,
"alnum_prop": 0.6803774497943382,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "a83812a22842f1c0ba7e9e462c34aa03d8d90133",
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from contextlib import contextmanager
from pants.backend.jvm.targets.jvm_binary import JvmBinary
from pants.backend.jvm.tasks.jar_task import JarBuilderTask
from pants.base.exceptions import TaskError
from pants.base.workunit... | {
"content_hash": "7375a7bf7cb439ab574680dbfa56bde5",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 95,
"avg_line_length": 34.541666666666664,
"alnum_prop": 0.6776236429433052,
"repo_name": "twitter/pants",
"id": "bb227f74bc463982c7aa56b52672328b3e7e641b",
"size": "3463",... |
import datetime
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from dox.models import Page, PageStatus, File
from dox.forms import PageForm
# https://bitbucket.org/codekoala/django-articles/src/fc6a1ae96dc8/articles/admin.py
#------... | {
"content_hash": "c04da6d067c7aa863ee29e139507006d",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 126,
"avg_line_length": 28.626168224299064,
"alnum_prop": 0.4286647078028077,
"repo_name": "mhulse/django-dox",
"id": "530b5e17fadf0a662e04ab7d5d9b1aa08de21db6",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
import autoslug.fields
class Migration(migrations.Migration):
dependencies = [
('momentum', '0006_auto_20150315_1329'),
]
operations = [
migrations.AlterField(
model_name='goal',
nam... | {
"content_hash": "c994b6df3d3699592c8c638ad314621a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 64,
"avg_line_length": 21.68421052631579,
"alnum_prop": 0.616504854368932,
"repo_name": "mod2/momentum",
"id": "dd3605842ed3a9372a7d7fac2e647187587e4dad",
"size": "436",
... |
"""Options manager for :class:`~diofant.polys.polytools.Poly` and public API functions."""
from __future__ import annotations
import re
from ..core import Basic, I
from ..core.sympify import sympify
from ..utilities import has_dups, numbered_symbols, topological_sort
from .polyerrors import FlagError, GeneratorsErro... | {
"content_hash": "9ad6b5e109973941cc5f6bd0dedee57f",
"timestamp": "",
"source": "github",
"line_count": 724,
"max_line_length": 109,
"avg_line_length": 26.97099447513812,
"alnum_prop": 0.5562042300404568,
"repo_name": "diofant/diofant",
"id": "2c77391895ca9e1700cffe8d14859589bb462031",
"size": "195... |
class RdopkgException(Exception):
msg_fmt = "An unknown error occurred"
def __init__(self, msg=None, **kwargs):
self.kwargs = kwargs
if not msg:
try:
msg = self.msg_fmt % kwargs
except Exception as e:
# kwargs doesn't mach those in message... | {
"content_hash": "7e236a78af57ba9ceac52134170e40ff",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 76,
"avg_line_length": 30.372549019607842,
"alnum_prop": 0.6610716591349257,
"repo_name": "yac/rdoupdate",
"id": "aa90c665e2e16a64795268dd16fe4a2c7e1b97a7",
"size": "1549",... |
from django.contrib import admin
from django.contrib.contenttypes import models as ct_models
from django.contrib.contenttypes.admin import GenericTabularInline
from django.forms import ModelForm
from waldur_core.core.admin import ReversionAdmin
from waldur_core.quotas import models, utils
class QuotaScopeClassListFi... | {
"content_hash": "5946698d7c95fc31d19979a2f19a467e",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 96,
"avg_line_length": 31.52054794520548,
"alnum_prop": 0.6549326379834854,
"repo_name": "opennode/nodeconductor",
"id": "dc3d92b6a12c0cf2e06f50fd93ac41a3e226dfca",
"size":... |
"""
Example to show managing rule entities under a ServiceBus Subscription, including
- Create a rule
- Create a rule with sql filter
- Get rule properties and runtime information
- Update a rule
- Delete a rule
- List rules under the given ServiceBus Subscription
"""
import os
import uuid
from... | {
"content_hash": "b0cc44ee94a71ad853a3a1329d7245a6",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 128,
"avg_line_length": 34.58762886597938,
"alnum_prop": 0.6742175856929955,
"repo_name": "Azure/azure-sdk-for-python",
"id": "3f6721d71a9554debb8fa38b8f769ed48dc669f2",
"s... |
from __future__ import unicode_literals
"""OAuth 2.0 Authentication"""
from hashlib import sha256
from urlparse import parse_qsl
from simplejson import dumps
from django.conf import settings
from django.http import HttpResponse
from oauth2app.exceptions import OAuth2Exception
from oauth2app.models import AccessToke... | {
"content_hash": "69475b2c3f01151125b9e53205156ccd",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 101,
"avg_line_length": 37.74174174174174,
"alnum_prop": 0.6066995544239338,
"repo_name": "mliu7/django-oauth2app",
"id": "3045725b3cb933a8919c13cf1e4fdf62105ab03e",
"size... |
import os
import pyntofdjango
MODULE_PATH = os.path.abspath(__file__)
pyntofdjango.setup_pod(MODULE_PATH)
from pynt import task
from pyntofdjango.tasks import python, pip, clean, delete_venv, create_venv, recreate_venv, manage, test_tox, \
runserver, dumpdata, migrate, docs, venv_bin
from pyntofdjango import util... | {
"content_hash": "cf582d77dbe8b1aea2f5cca09f388dce",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 111,
"avg_line_length": 25.574468085106382,
"alnum_prop": 0.6697171381031614,
"repo_name": "WimpyAnalytics/django-andablog",
"id": "ef06c09d073838b19f404f3a7ae8d1c81bc4b829",... |
"""
identitycrisis.py
Created by Sandro Gauci on 2014-04-23.
Copyright (c) 2014 Enable Security ltd. All rights reserved.
Inspired from Chris John Riley's excellent UATester:
<http://blog.c22.cc/toolsscripts/>
"""
from difflib import SequenceMatcher
import threading
from burp import IBurpExtender
from burp import I... | {
"content_hash": "9d58d20a7c5eb35ca0ce39083dd67845",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 156,
"avg_line_length": 45.0317848410758,
"alnum_prop": 0.6018568791399718,
"repo_name": "sandrogauci/Identity-Crisis",
"id": "561ec06a6e9c769fbb6b898a2402007c34220e1a",
"... |
TITLE = u""
SPEAKER = u""
COMPANY = u""
LOCATION = u""
DATE = u""
# Directory structure
ROOT_DIR = "."
SLIDES_DIR = "slides"
MEDIA_DIR = "media"
THEMES_DIR = "themes"
# Engine settings
THEME = "default"
CONTROL_VIS = "hidden"
DEFAULT_VIEW = "slideshow"
ENCODING = "utf-8"
# Syntax hig... | {
"content_hash": "a6a1c347a956236fe5cd843abe847f22",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 47,
"avg_line_length": 17.942857142857143,
"alnum_prop": 0.64171974522293,
"repo_name": "danielfm/pydozeoff",
"id": "30d4284f9fc38cb2a23939d854e1d11b136f4a14",
"size": "698... |
"""
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See also entry.
- Renumber references.
- Extract the signature from the docstring, if it can't be determined
otherwis... | {
"content_hash": "716b2ea4865af7611a07b77b3343ddd5",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 80,
"avg_line_length": 32.51219512195122,
"alnum_prop": 0.567741935483871,
"repo_name": "kaushik94/sympy",
"id": "f526d2e468216d7398ae76f950b319143e03e439",
"size": "6665"... |
import ConfigParser
import boto.exception
import boto.s3.connection
import bunch
import itertools
import os
import random
import string
from .utils import region_sync_meta
s3 = bunch.Bunch()
config = bunch.Bunch()
targets = bunch.Bunch()
# this will be assigned by setup()
prefix = None
calling_formats = dict(
o... | {
"content_hash": "156c23e7988d0615af48baff8eef760b",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 91,
"avg_line_length": 30.315363881401616,
"alnum_prop": 0.5899350938027919,
"repo_name": "SUSE/s3-tests",
"id": "51dd5067a690194c43c1d13ebc76426ce0f2a906",
"size": "11247... |
"""Commandline utility to run operator benchmarks"""
import argparse
import logging
import os
import sys
import mxnet as mx
from benchmark.opperf.nd_operations.unary_operators import run_mx_unary_operators_benchmarks
from benchmark.opperf.nd_operations.binary_operators import run_mx_binary_broadcast_operators_benchm... | {
"content_hash": "181bf22bb65761bda65e36d806399665",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 185,
"avg_line_length": 61.95631067961165,
"alnum_prop": 0.6992086500039175,
"repo_name": "apache/incubator-mxnet",
"id": "8cc48694d5ad23da29b5f00d5d8fe61ebe525b45",
"size... |
from oneview_redfish_toolkit import category_resource
from oneview_redfish_toolkit import multiple_oneview
def first_parameter_resource(resource, function, *args, **kwargs):
resource_id = args[0]
resp = multiple_oneview.query_ov_client_by_resource(
resource_id, resource, function, *args, **kwargs)
... | {
"content_hash": "800c908ff906fde1cb1608d4e37ecef5",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 113,
"avg_line_length": 39.758389261744966,
"alnum_prop": 0.5455773126266037,
"repo_name": "HewlettPackard/oneview-redfish-toolkit",
"id": "b655dbfc33f96d9e5e2bde84529eaacb5... |
import nbinteract as nbi
from .util import run_doctests
def test_doctests():
results = run_doctests(nbi.plotting)
assert results.failed == 0
| {
"content_hash": "a98a98462946514c3ad2c50a15edd86e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 40,
"avg_line_length": 19,
"alnum_prop": 0.7236842105263158,
"repo_name": "SamLau95/nbinteract",
"id": "5aa26b5ee4bfa4d5b74051389c88165a5899d516",
"size": "152",
"binary":... |
from gerencianet import Gerencianet
from ...credentials import credentials
gn = Gerencianet(credentials.CREDENTIALS)
response = gn.pix_create_evp()
print(response)
| {
"content_hash": "80ba52e43f6dcc098c2916055629a760",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 21,
"alnum_prop": 0.7976190476190477,
"repo_name": "gerencianet/gn-api-sdk-python",
"id": "b5347db1dff84882a30b38c9ed606c9ab9f97461",
"size": "187",
... |
"""
A filter middleware that inspects the requested URI for a version string
and/or Accept headers and attempts to negotiate an API controller to
return
"""
from oslo_config import cfg
from oslo_log import log as logging
from glance.api import versions
from glance.common import wsgi
CONF = cfg.CONF
LOG = logging.ge... | {
"content_hash": "b534311acb6b80b392c53fc13d016097",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 77,
"avg_line_length": 34.10476190476191,
"alnum_prop": 0.5858698687517453,
"repo_name": "rajalokan/glance",
"id": "d36a4a91d5ab0e2f99a66febee05b2dff318c9e8",
"size": "421... |
import json
from unittest import mock
import fixtures
from keystoneclient import discover as ks_discover
from oslo_config import cfg
from oslo_config import fixture as config_fixture
import testtools
from testtools import matchers
from zaqarclient.queues.v1 import message
from zaqarclient import transport
from zaqarcl... | {
"content_hash": "be23eeee24d35658accf3888f43e447d",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 79,
"avg_line_length": 39.082089552238806,
"alnum_prop": 0.6392018331105594,
"repo_name": "openstack/os-collect-config",
"id": "5c6bc59d8fa573f278541de91dd458d1b2b0dde2",
... |
import abc
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import base
from neutron.common import exceptions
from neutron import manager
# Attribute Map
RESOURCE_NAME = 'agent'
RESOURCE_ATTRIBUTE_MAP = {
RESOURCE_NAME + 's': {
'id': {'allow_post': Fals... | {
"content_hash": "7bb5f9ef9ec0f7ea7bccbda987811ae4",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 79,
"avg_line_length": 31.776315789473685,
"alnum_prop": 0.5614906832298137,
"repo_name": "nash-x/hws",
"id": "21ae446960b339892f721491aee0bd1245a250e2",
"size": "5421",
... |
from sklearn.naive_bayes import GaussianNB
class GNB(object):
""" Implements a Gaussian Naive Bayes classifier """
def __init__(self):
self.possible_labels = ['left', 'keep', 'right']
self.lane_width = 4.0
self.clf = GaussianNB()
def train(self, data, labels):
"""
... | {
"content_hash": "c8386ad6b7100dc9501db9efa80899b3",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 67,
"avg_line_length": 26.928571428571427,
"alnum_prop": 0.5193633952254642,
"repo_name": "Deborah-Digges/SDC-ND-term-3",
"id": "29bb96e5d5c519438b834f774e9920350ac4e6af",
... |
import numpy as np
import theano
from theano import function
from theano.sandbox.rng_mrg import MRG_RandomStreams
import theano.tensor as T
def energy(W, V, H):
"""
W : A theano matrix of RBM weights
num visible x num hidden
V : A theano matrix of assignments to visible units
Each row is a... | {
"content_hash": "6763dfbaa834d3d45c0ecbbb88a7cdd6",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 71,
"avg_line_length": 32.38028169014085,
"alnum_prop": 0.6285341452805567,
"repo_name": "goodfeli/theano_exercises",
"id": "4c6ba548fbf222d5ca58cb1d77626e934e2bc3cd",
"siz... |
import pytest
import os
from appr.new import new_package
import appr.manifest_jsonnet
@pytest.fixture()
def home_dir(monkeypatch, fake_home):
monkeypatch.chdir(str(fake_home))
return str(fake_home)
@pytest.fixture()
def new(home_dir):
new_package("organization/newpackage")
@pytest.fixture()
def new_wi... | {
"content_hash": "6f7cc40f33b3ab650b4bdb578adcec54",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 75,
"avg_line_length": 27.12,
"alnum_prop": 0.7087020648967551,
"repo_name": "app-registry/appr",
"id": "e03bd585a4d83ddd5f71c1043e1d0cff1bdfd0dd",
"size": "1356",
"binar... |
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import render
from estacionamientos.controller import *
from estacionamientos.forms import EstacionamientoExtendedForm
from estacionamientos.forms import EstacionamientoForm
from estacionamientos.forms import EstacionamientoReserva
from estaci... | {
"content_hash": "b497f6ccd68d99b73ecc171efe8a3620",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 141,
"avg_line_length": 44.851612903225806,
"alnum_prop": 0.6006904487917146,
"repo_name": "Sealos/SAGE",
"id": "51a4499f4f873dec922f68ab4f6ea89b32df5fb8",
"size": "6978",... |
from .resource import Resource
from .ec2 import EC2InstanceResource
from .iam import IAMRoleResource, IAMInstanceProfileResource
import pkg_resources
class ElasticBeanstalkEnvironment(EC2InstanceResource):
"""
Creates an EC2 server resource with the code deploy agent running.
Takes the same keyword paramet... | {
"content_hash": "075e95f8f5146ba0a617b440580dd58a",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 90,
"avg_line_length": 37.76086956521739,
"alnum_prop": 0.6029552868931107,
"repo_name": "mmcdermo/RedLeader",
"id": "16e4c0fba7202567cfc1895c4ef77b871bb834db",
"size": "5... |
from django.conf import settings
from django.conf.urls import include
from django.conf.urls.static import static
from django.urls import path
urlpatterns = [
path(settings.GEOREPORT_API_ROOT, include('issues.api.urls', namespace='georeport/v2')),
]
if 'issues_simple_ui' in settings.INSTALLED_APPS:
urlpatterns... | {
"content_hash": "e5d1971b3397851abc927d7ef7ded09d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 92,
"avg_line_length": 34.36842105263158,
"alnum_prop": 0.7565084226646248,
"repo_name": "6aika/issue-reporting",
"id": "d68301d640d8768f523ce46647a7bd3280b0168d",
"size": ... |
from sqlalchemy import Column, ForeignKey, Integer
from sqlalchemy.types import String
from sqlalchemy.orm import relationship, backref
from models import dbsession
from models.BaseModels import DatabaseObject, generate_uuid
class Browser(DatabaseObject):
uuid = Column(String(32), unique=True, default=generate_u... | {
"content_hash": "2c0de7fa970210d6d1b42dd41df12d84",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 78,
"avg_line_length": 23.710843373493976,
"alnum_prop": 0.6351626016260162,
"repo_name": "lunarca/fngrpt",
"id": "6dcf2a2bb851681d3cab154a8dc1e7fabd12fc60",
"size": "1993"... |
import datetime
import urllib
import warnings
from abc import abstractmethod
from typing import Union, Any, Dict, List, Optional
from pykechain.enums import FilterType, Category, PropertyType, ScopeStatus
from pykechain.exceptions import IllegalArgumentError, NotFoundError
from pykechain.models.input_checks import (
... | {
"content_hash": "259a8f1ae7a5e3bd28ddfebd00fd847b",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 119,
"avg_line_length": 35.51767676767677,
"alnum_prop": 0.5411304656949876,
"repo_name": "KE-works/pykechain",
"id": "e2afd2e934c71293fa079c005aa1d14804474d8a",
"size": "... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Version.version'
db.alter_column(u'pypi_version', 'version', self.gf('django.db.models.fields.CharField')(max_len... | {
"content_hash": "f13205a595663276337b31751414ccc4",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 141,
"avg_line_length": 54.104166666666664,
"alnum_prop": 0.5656526761648055,
"repo_name": "kitsunde/django-pypi",
"id": "f71c51eb340cae5fbedeec2b091b2ed5d2347d3b",
"size":... |
from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import Implicit
from App.class_init import InitializeClass
from OFS.PropertyManager import PropertyManager
from OFS.SimpleItem import SimpleItem
from Products.BeakerSessionDataManager.interfaces import ISessionDataObject
from Products.PageTemplat... | {
"content_hash": "a680636e26d0e3f0e222a245ef046028",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 89,
"avg_line_length": 29.655963302752294,
"alnum_prop": 0.6863109048723898,
"repo_name": "davisagli/Products.BeakerSessionDataManager",
"id": "fa54e071b60ef5237b1134c6a8d39... |
"""
Support for Volvo On Call.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/volvooncall/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD,
... | {
"content_hash": "15d939510be5d4697e3d7088ae48d51e",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 78,
"avg_line_length": 30.91078066914498,
"alnum_prop": 0.6198436560432953,
"repo_name": "tinloaf/home-assistant",
"id": "9f9b58ec8b6128fed329ed20f3871c84ef1d8c62",
"size"... |
class DoubanPipeline(object):
# def __init__(self, server, port):
# pass
# @classmethod
# def from_crawler(cls, crawler):
# return cls(crawler.settings['MONGO_SERVER'],
# crawler.settings['MONGO_PORT'])
def process_item(self, item, spider):
return item
| {
"content_hash": "c7937dfd5a2af455c8b41e9f45044977",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 54,
"avg_line_length": 26.25,
"alnum_prop": 0.5777777777777777,
"repo_name": "tzpBingo/github-trending",
"id": "a68d5238e29691b8453bb6d60dbd7c6f27175f62",
"size": "510",
... |
'''
zzz domains
'''
#import sys
#from imp import reload
#reload(sys)
#sys.setdefaultencoding('utf-8')
from sqlalchemy import Table, Column, ForeignKey, MetaData
from sqlalchemy import Integer, Boolean
from sqlalchemy import Unicode, UnicodeText, DateTime
from sqlalchemy import func
from sqlalchemy.ext.declarative impo... | {
"content_hash": "4bb5f7299a03859d500dde087792fe49",
"timestamp": "",
"source": "github",
"line_count": 363,
"max_line_length": 80,
"avg_line_length": 31.953168044077135,
"alnum_prop": 0.5912578670575049,
"repo_name": "xiexiao/zzz",
"id": "f3185da60826acd173f2ef72368ff60d059cf2a5",
"size": "11786",... |
# coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#---------------------------------------------------------------------... | {
"content_hash": "655dc395df02030ae60772463da99895",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 98,
"avg_line_length": 36.29213483146067,
"alnum_prop": 0.5894736842105263,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "c7262d1f50844db9e11232f8efb515341d52a255",
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
from ansible_collect... | {
"content_hash": "e22be17bd5bba74ceee1f1e5c107fa30",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 125,
"avg_line_length": 32.15533980582524,
"alnum_prop": 0.652475845410628,
"repo_name": "F5Networks/f5-ansible-modules",
"id": "8f1eca6bed212fc7ef688e027eaff6a87e9f86da",
... |
'''
Introduction:
Workshop Example Code from the Blockchain and Machine Learning Workshop at START Summit 2017 in Switzerland
Description:
The file user.py implements an easy chat-client for transmitting text and images to Blockchain smart contract.
Tags are automatically extracted from an image using a Deep Residual ... | {
"content_hash": "50e05dac9e8d4de243a1b17506023675",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 134,
"avg_line_length": 27.416666666666668,
"alnum_prop": 0.5576126001657916,
"repo_name": "Lyniat/hackaburg17-smartcontracts",
"id": "eb5078104bff74a866ecd0cee3472d504aa79c... |
from subprocess import Popen, PIPE
class rFactory(object):
""" A factory to execute CRAN scripts """
def __init__(self, log):
self._log = log
pass
def exec_module(self, file, args=None):
#'var/R/helloWorld.R'
p = Popen(['Rscript', file], stdout=PIPE, bufsize=1)
for... | {
"content_hash": "f43fe107faa825ae1c281a975e907619",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 73,
"avg_line_length": 33.25,
"alnum_prop": 0.5413533834586466,
"repo_name": "batoure/ScienceManager",
"id": "dc919ba111bee6a9fb2539cc618e5fd0235a127e",
"size": "665",
"b... |
"""
Load files created by the astrodendro package.
astrodendro must be installed in order to use this loader
"""
from __future__ import absolute_import, division, print_function
import numpy as np
from astrodendro import Dendrogram
from glue.core.data_factories.hdf5 import is_hdf5
from glue.core.data_factories.fits... | {
"content_hash": "67f5b52fd70d4b8510f367937b9a88e1",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 93,
"avg_line_length": 30.172727272727272,
"alnum_prop": 0.6022898463392589,
"repo_name": "stscieisenhamer/glue",
"id": "8c277b1a6206810e7e79b93e06e914d1f3642887",
"size":... |
from enum import Enum
import re
class OperatingSystemClasses(Enum):
#ENUM:START
DESKTOP = 1
SERVER = 2
EMBEDDED = 3
#ENUM:END
def parse(self, string):
for j in OperatingSystemClasses:
if (string.lower()).find(j.name.lower())>=0:
return j
return OperatingSystemClasses.DESKTOP
| {
"content_hash": "ed2454489cea8c39ff8c971c95d1daf9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 47,
"avg_line_length": 17.764705882352942,
"alnum_prop": 0.7052980132450332,
"repo_name": "PC-fit-Christian-Rupp/Enumeration-OS",
"id": "b9b5433290275b38c812791bf6e17f2cfa657... |
import re
import os
import subprocess
from .logger import Logger
from .tmux import Tmux
log = Logger()
class Git(object):
_config = {}
_repos = []
_root = ''
def __init__(self, config):
"""
:param config: Dictionary with config schema
"""
self._config = config
... | {
"content_hash": "2f25507d8b7f5b7889b05ca4546f83c1",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 79,
"avg_line_length": 36.75,
"alnum_prop": 0.4521615097651964,
"repo_name": "rafi/mx",
"id": "5cd98c9b61ce3130c1fd809eb51b6e5e00136bc2",
"size": "9144",
"binary": false... |
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self):
profile = Firef... | {
"content_hash": "0e9c741c1edaafcee57287c020576ed5",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 84,
"avg_line_length": 29.545454545454547,
"alnum_prop": 0.6543589743589744,
"repo_name": "tzvezda/python_training",
"id": "ade46ca054b419ee143c4e7644daa91df455b951",
"size... |
from re import findall
class Paragraph:
"""Paragraph of a chapter"""
def __init__(self, text):
self._text = text
def getText(self):
return self._text;
def getWordCount(self):
return findall(r'\w+', self._text);
def getCharCount(self):
return len(self._text)
| {
"content_hash": "74d83a47204d23f4dc342572a40a9436",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 43,
"avg_line_length": 19.6875,
"alnum_prop": 0.5873015873015873,
"repo_name": "Senth/ktouch-lesson-creator",
"id": "dc0aad4e751522ccc7887947850bbf1ede138c7d",
"size": "315... |
""" Unit tests:
- :class:`TestUniformityUniformSpanningTreeSampler` to check that the different procedures used for uniform spanning trees of a graph actually sample spanning trees uniformly at random.
"""
import unittest
import itertools as itt
from collections import Counter
import numpy as np
from scipy.stats imp... | {
"content_hash": "c0c24c90e205aeb382affbb5ff63ca81",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 185,
"avg_line_length": 32.48571428571429,
"alnum_prop": 0.5968924069187922,
"repo_name": "guilgautier/DPPy",
"id": "250d5ed9e325e348a798d7d0e395d626aad29442",
"size": "34... |
from numpy import cos, linspace, pi, sin
from bokeh.core.enums import LegendLocation
from bokeh.io import output_file, show
from bokeh.models import (Circle, ColumnDataSource, DataRange1d, Legend, Line,
LinearAxis, PanTool, Plot, SaveTool, WheelZoomTool,)
x = linspace(-2*pi, 2*pi, 400)
y = s... | {
"content_hash": "d73489a327d6667d59a5d0f36b071015",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 93,
"avg_line_length": 30.454545454545453,
"alnum_prop": 0.6776119402985075,
"repo_name": "ericmjl/bokeh",
"id": "dfdad63ac4d73a7ce86ffd65bdbb36e7ee4b93b8",
"size": "2010",... |
import pytest
from flask import json, url_for
from tests.conftest import create_authorization_header
from tests.db import create_fee
class WhenGettingEventTypes(object):
def it_returns_all_event_types(self, client, sample_event_type, db_session):
response = client.get(
url_for('event_types.... | {
"content_hash": "5d3488b34fe23897745e0d6ac49b5d33",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 110,
"avg_line_length": 37.48192771084337,
"alnum_prop": 0.5605914496946319,
"repo_name": "NewAcropolis/api",
"id": "36cfc8a9bb32ee2cb244252a90f8498ecd2d4558",
"size": "62... |
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
from .models import ApprovalTracking, Report
class ApprovalTrackingForm(forms.ModelForm):
c... | {
"content_hash": "17e2d62cf2ad2d3d469865d8da6d5153",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 127,
"avg_line_length": 37.411764705882355,
"alnum_prop": 0.6069182389937107,
"repo_name": "kdagley/midas_pr",
"id": "e52d6fd9e3ba07575ece8726af0bb585bc490dde",
"size": "32... |
from optparse import make_option
from django.core.management.base import BaseCommand
from narrative.models import Datum
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option(
'--verbose', action='store_true', dest='verbose', default=False,
help='Determ... | {
"content_hash": "20b437c70fc0bf141f2095670f1162a8",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 76,
"avg_line_length": 30.35,
"alnum_prop": 0.6523887973640856,
"repo_name": "ambitioninc/django-narrative",
"id": "5d5da140625748795b829c170fabd76786c86d4d",
"size": "607"... |
"""Unit tests for the SparseHamiltonian class."""
import pytest
from openfermion import FermionOperator
from fqe.hamiltonians import sparse_hamiltonian
def test_sparse():
"""Test some of the functions in SparseHamiltonian."""
oper = FermionOperator('0 0^')
oper += FermionOperator('1 1^')
test = spa... | {
"content_hash": "fa44f01c35d00a5ac1dcd055517bf01e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 28.428571428571427,
"alnum_prop": 0.6393076493579006,
"repo_name": "quantumlib/OpenFermion-FQE",
"id": "2fa6584bc195ac6f994d637045dcc9c80d123b99",
"s... |
"""
Copyright (c) 2017, Arm Limited and affiliates.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless requir... | {
"content_hash": "716e8ee76a5fc2f4e28e2662dfa3fb77",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 130,
"avg_line_length": 39.01123595505618,
"alnum_prop": 0.4873271889400922,
"repo_name": "andcor02/mbed-os",
"id": "40db26069dc5b5723bfcfd29f6422e4c14a02b63",
"size": "347... |
import logging
import pytest
import unittest.mock as mock
from alphatwirl.loop import MPEventLoopRunner
##__________________________________________________________________||
@pytest.fixture()
def communicationChannel():
return mock.Mock(name='communicationChannel')
@pytest.fixture()
def obj(communicationChanne... | {
"content_hash": "c697936a20c6d31dc57214c32697d7d1",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 100,
"avg_line_length": 30.62773722627737,
"alnum_prop": 0.644184938036225,
"repo_name": "alphatwirl/alphatwirl",
"id": "028be1972d09fd1e376c890a8562bb61f0dde970",
"size":... |
"""
.. module:: smart_dir_copy
:platform: Unix, Windows
:synopsis:
Recursively copy a directory, skipping any files that don't appear to
require updating.
.. moduleauthor:: Brandon Huber
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_fu... | {
"content_hash": "cf8d24d3f59f35d602084d24b1083b93",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 79,
"avg_line_length": 34.93043478260869,
"alnum_prop": 0.6183719193427931,
"repo_name": "shalesbridge/steamssdmanager",
"id": "fc1282485a540b566b3e7050b627199b299fa48c",
... |
from __future__ import print_function
import json
import fileinput
for line in fileinput.input():
tweet = json.loads(line)
if 'media' in tweet['entities']:
for media in tweet['entities']['media']:
print(media['media_url'])
| {
"content_hash": "68422887699a3917ddcacd557dbbf55f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 48,
"avg_line_length": 28,
"alnum_prop": 0.6468253968253969,
"repo_name": "edsu/twarc",
"id": "7c6ef6ffcd82cba242f46a33b31a2f5b5e5f3978",
"size": "275",
"binary": false,
... |
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'confluent_platform', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long descrip... | {
"content_hash": "a250a77c3540d35595dc1bdb895ffbee",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 88,
"avg_line_length": 31,
"alnum_prop": 0.6549235993208828,
"repo_name": "DataDog/integrations-core",
"id": "7dec01c2ad0f082fd7daab65fa75d6709c0ea31a",
"size": "2471",
"... |
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from toontown.toonbase.ToontownGlobals import *
from toontown.toonbase import ToontownTimer
from direct.distributed import DistributedObject
from direct.directnotify import... | {
"content_hash": "2512400ac1e014db7852fec2099d9eba",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 293,
"avg_line_length": 41.391836734693875,
"alnum_prop": 0.6398777240903264,
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"id": "95bf8bf81d9d15d1f314cc7d215c7f5420... |
from __future__ import unicode_literals
import logging
import django_filters
from django.contrib.auth.models import User
from rest_framework import permissions
from rest_framework import renderers
from rest_framework import viewsets
from rest_framework import filters
from rest_framework.decorators import detail_route
... | {
"content_hash": "cdda12a3087a770839ec33b64396f63d",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 33.67153284671533,
"alnum_prop": 0.6663776284413614,
"repo_name": "peterdv/pyreststore",
"id": "f5130513d8b15cefe38458928cc5bd6b51b40c6b",
"size": "... |
import numpy as np
from autocorrelation import autocorrelation
def decorrelation_length(x,min_autocorrelation):
""" decorrelation_length returns the first occurrence lag at which the autocorrelation becomes smaller than min_autocorrelation.
Inputs:
- x [1-dim numpy array of floats]: the time series (the time is... | {
"content_hash": "def1656e984d6e85ad655ffaaf9a5f64",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 129,
"avg_line_length": 31.0625,
"alnum_prop": 0.716297786720322,
"repo_name": "guillaumelenoir/WAVEPAL",
"id": "8f06595dc44893f0c0ae17fa50da9907a77ab8dc",
"size": "994",
... |
import CsHelper
import logging
class CsRoute:
""" Manage routes """
def __init__(self):
self.table_prefix = "Table_"
def get_tablename(self, name):
return self.table_prefix + name
def add_table(self, devicename):
tablenumber = devicename[3:]
tablename = self.get_tab... | {
"content_hash": "bae3934fbed44ee958836a31a1faca93",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 82,
"avg_line_length": 36.198019801980195,
"alnum_prop": 0.562089715536105,
"repo_name": "resmo/cloudstack",
"id": "927c2ae0d7487e43c9b29415e3c85443f3845723",
"size": "446... |
import os
import shutil
import fixtures
from oslo.config import cfg
from glance.common import exception
from glance.openstack.common import jsonutils
from glance import store
from glance.store import location
from glance.store import sheepdog
from glance.store import vmware_datastore
from glance.tests import stubs
fr... | {
"content_hash": "b52d54ef266ee9dd177ec86856d7302e",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 34.68235294117647,
"alnum_prop": 0.6282225237449118,
"repo_name": "tanglei528/glance",
"id": "f0fcfa24d2db3c88228844c23ae23ae63dd20acb",
"size": "358... |
"""Tests for proactor_events.py"""
import socket
import unittest
from unittest import mock
import asyncio
from asyncio.proactor_events import BaseProactorEventLoop
from asyncio.proactor_events import _ProactorSocketTransport
from asyncio.proactor_events import _ProactorWritePipeTransport
from asyncio.proactor_events ... | {
"content_hash": "d1cc1ba2538c31d2bb313f8c9bd3c6d0",
"timestamp": "",
"source": "github",
"line_count": 492,
"max_line_length": 77,
"avg_line_length": 36.58130081300813,
"alnum_prop": 0.6290698966551839,
"repo_name": "OptimusGitEtna/RestSymf",
"id": "0c536986ff7f157ee7a4b35d44120d2623441ce8",
"size... |
import sys, json, os, urlparse, re
print "Content-type:application/json\r\n\r\n"
data = json.loads(sys.stdin.read())
path = urlparse.urlparse(data["file"]).path
m = re.match('^/~(\w+/)(.+)', path)
real_path = os.path.realpath('/home/' + m.group(1) + 'public_html/' + m.group(2))
txt_path = os.path.splitext(real_path)[... | {
"content_hash": "bb3846df934faea6448a184e96a0b069",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 81,
"avg_line_length": 28.419354838709676,
"alnum_prop": 0.5845629965947786,
"repo_name": "wangchulab/CIMAGE",
"id": "7e1c832d8cf6d1e078f47770622e4a47140be88a",
"size": "90... |
"""Utilities to extract string literals from object files.
LookupElfRodataInfo():
Runs readelf to extract and return .rodata section spec of an ELF file.
ReadFileChunks():
Reads raw data from a file, given a list of ranges in the file.
ReadStringLiterals():
Reads the ELF file to find the string contents of a l... | {
"content_hash": "8f0978e897f9b0f037b167aaf1fddfcf",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 80,
"avg_line_length": 37.41159420289855,
"alnum_prop": 0.6706438366777717,
"repo_name": "chromium/chromium",
"id": "d8c7f67f896a624ee98eedc64273678641626472",
"size": "13... |
import os, sys
import multiprocessing
import time
from random import shuffle
newstdin = os.fdopen(os.dup(sys.stdin.fileno()))
def popup_words(level, stdin = newstdin):
with open("word-list/%s" %(level)) as f:
words = f.readlines()
shuffle(words)
correct_n = 0
total = 0
... | {
"content_hash": "1377c2eb43b60a9400e1a20e36375adf",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 69,
"avg_line_length": 24.225,
"alnum_prop": 0.5242518059855521,
"repo_name": "xiaohan2012/catch-phrase-game",
"id": "40a59d7995e5e049f3c1fa29a367111cad37f58a",
"size": "96... |
import argparse
import random
import numpy as np
import h5py
import qusp
import bossdata.path
import bossdata.remote
from astropy.io import fits
def main():
# parse command-line arguments
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argume... | {
"content_hash": "ec049f10c10e5716a2e8a547d0a7d2fd",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 122,
"avg_line_length": 37.270270270270274,
"alnum_prop": 0.6207396664249456,
"repo_name": "dmargala/qusp",
"id": "f7f25661f221f5e969c6b585f193a907fcba86f9",
"size": "8296... |
from django.db import models
from django.utils.html import escape
from django.utils.text import Truncator
from django.utils.translation import ugettext as _
from django import forms
from xadmin.sites import site
from xadmin.views import BaseAdminPlugin, ModelFormAdminView
from xadmin.util import vendor
class ForeignK... | {
"content_hash": "1218da34e9bf0a61bb1cbd268f994ecc",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 112,
"avg_line_length": 38.11666666666667,
"alnum_prop": 0.6270222999562746,
"repo_name": "lipengyu/django-bootstrap",
"id": "3d1516fe44f51223b37c307651009e3955771bb2",
"si... |
from typing import Any
import orjson
from fastapi import APIRouter, FastAPI
from fastapi.responses import HTMLResponse, JSONResponse, PlainTextResponse
from fastapi.testclient import TestClient
class ORJSONResponse(JSONResponse):
media_type = "application/x-orjson"
def render(self, content: Any) -> bytes:
... | {
"content_hash": "d1d8c179a2ebe2e41d92231202a32450",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 78,
"avg_line_length": 24.837962962962962,
"alnum_prop": 0.665237651444548,
"repo_name": "tiangolo/fastapi",
"id": "042fb1dea93231e9cfd06378f1b66366008a37e6",
"size": "536... |
"""
test_django-pj-core
------------
Tests for `django-pj-core` models module.
"""
from django.test import TestCase
from pjcore import models
class TestPjcore(TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self):
pass
| {
"content_hash": "0cdb5877a0432d57c34c3def4b269820",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 41,
"avg_line_length": 13.272727272727273,
"alnum_prop": 0.6164383561643836,
"repo_name": "jokimies/django-pj-core",
"id": "2b084ed536c23ec0134a751547f869556e2b1dd6",
"size... |
"""Lasagne layer implementing a variant of highway and residual networks.
"""
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
from deep_learning_layers import *
class MultiplicativeGatingLayer(nn.layers.MergeLayer):
"""
Generic layer that combines its 3 inputs t, h1, h2 as foll... | {
"content_hash": "32cff2942d8aa1a8670b38d806906dfc",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 134,
"avg_line_length": 43.20422535211268,
"alnum_prop": 0.5245313773431133,
"repo_name": "317070/kaggle-heart",
"id": "cfb887349ab8db2eb2281f1338e4a1b9ff342083",
"size": ... |
import flask
from designate.openstack.common import log as logging
from designate.central import rpcapi as central_rpcapi
LOG = logging.getLogger(__name__)
central_api = central_rpcapi.CentralAPI()
blueprint = flask.Blueprint('sync', __name__)
@blueprint.route('/domains/sync', methods=['POST'])
def sync_domains():... | {
"content_hash": "bf15f0d373bb7a178974b4c00e99427e",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 75,
"avg_line_length": 28.384615384615383,
"alnum_prop": 0.6901535682023487,
"repo_name": "melodous/designate",
"id": "5d1dd4d4e3f1dcbbe3aa78d1af17d05ba57fea18",
"size": "1... |
from __future__ import unicode_literals
import six
from tastypie.api import Api
from tastypie.fields import CharField
from tastypie.resources import Resource, ModelResource
from webtsaservices.models import DataSeries, Site, SourcesDataService, VariableCategory, Variable, QualityControlLevel
class UnicodeCharField(... | {
"content_hash": "dd2534c381b6f30e1fcbc01750ca7336",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 119,
"avg_line_length": 27.98181818181818,
"alnum_prop": 0.6598440545808967,
"repo_name": "UCHIC/WEBTSA",
"id": "4c65ef52f089a86fa8cfd08f1b8fe6e52ad36845",
"size": "3078",... |
from __future__ import annotations
import asyncio
import logging
import lzma
import os
import sys
import tarfile
from asyncio import Task
from datetime import datetime
from pathlib import Path
from typing import Any, Iterable, Optional, Type, TypeVar, overload
import aiohttp
import toml
from asyncqlio.db import Datab... | {
"content_hash": "75029995b345d454d9f38333c1ddcd2d",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 87,
"avg_line_length": 34.611111111111114,
"alnum_prop": 0.5849992703925289,
"repo_name": "BeatButton/beattie-bot",
"id": "8f9908a845f3fada2842d3bf53e3625a583b3b7a",
"size... |
from __future__ import absolute_import
import logging
import os
import shutil
from time import time
import click
from utils.process import silent_run
from workspace.commands import AbstractCommand
from workspace.commands.helpers import expand_product_groups
from workspace.config import config
from workspace.scm impor... | {
"content_hash": "6aa778886e07b22db999699bc2642f95",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 119,
"avg_line_length": 39.54430379746835,
"alnum_prop": 0.5672215108834827,
"repo_name": "maxzheng/workspace-tools",
"id": "44d45117de385fc9f64d33d2e40597ceda28bb51",
"siz... |
__author__ = 'Charlie'
# Utils used with tensorflow implemetation
import tensorflow as tf
import numpy as np
import scipy.misc as misc
import os, sys
from six.moves import urllib
import tarfile
import zipfile
def maybe_download_and_extract(dir_path, url_name, is_tarfile=False, is_zipfile=False):
if not os.path.ex... | {
"content_hash": "7cb69c8086c2c8db1d1498f193e51ea4",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 120,
"avg_line_length": 36.23107569721115,
"alnum_prop": 0.590169342423576,
"repo_name": "LarsDu/DeepPixelMonster",
"id": "395913f365dd7defd69be65ca291c2b4c84f8fb8",
"size... |
"""Astronomical and physics constants.
This module complements constants defined in `astropy.constants`,
with gravitational paremeters and radii.
Note that `GM_jupiter` and `GM_neptune` are both referred to the whole planetary system gravitational parameter.
Unless otherwise specified, gravitational and mass paramet... | {
"content_hash": "f9d4cb2398908db16a2cac18687c660f",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 119,
"avg_line_length": 59.23529411764706,
"alnum_prop": 0.6876152645765357,
"repo_name": "anhiga/poliastro",
"id": "dffc2ce80bb55c41417a26ba11233d5a1f72c6cd",
"size": "71... |
"""Tests for TPU outside compilation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tempfile
from absl.testing import parameterized
import numpy as np
from tensorboard.plugins.histogram import summary_v2 as histogram_summary_v2
from ... | {
"content_hash": "8ca1c69465a8513c2b429c8fe2bda40a",
"timestamp": "",
"source": "github",
"line_count": 736,
"max_line_length": 94,
"avg_line_length": 31.214673913043477,
"alnum_prop": 0.6495168451292765,
"repo_name": "annarev/tensorflow",
"id": "11fc7d54513ecf17ddb7d417493b0840e4307172",
"size": "... |
class Solution(object):
def inorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
res = []
stack = []
node = root
while node or stack:
while node:
stack.append(node)
node = node.left
... | {
"content_hash": "85d302440e6c228c6d4dc4f948ecdad8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 37,
"avg_line_length": 22.789473684210527,
"alnum_prop": 0.44341801385681295,
"repo_name": "yehzhang/RapidTest",
"id": "f15035833d03cd7aa7bcbae18fec96a940dc222d",
"size": "... |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class OrganizationsRequestsConfig(AppConfig):
name = 'watchdog_kj_kultura.organizations_requests'
verbose_name = _("Requests to organizations system")
| {
"content_hash": "2e519b8ddcc92ff0ec6a14330829180a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 56,
"avg_line_length": 35.857142857142854,
"alnum_prop": 0.7888446215139442,
"repo_name": "watchdogpolska/watchdog-kj-kultura",
"id": "2c9b1da13ba2f9995a55bc1ad8fd886868b393d3... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sonetworks', '0028_auto_20170509_0231'),
]
operations = [
migrations.AddField(
model_name='socialaccount',
name='bucket_id',... | {
"content_hash": "43298050477aef4895ad135208073110",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 27.178571428571427,
"alnum_prop": 0.5716162943495401,
"repo_name": "semitki/semitki",
"id": "46d4041a9f2e93a76e7b982de099671e6a49f70a",
"size": "834"... |
import os
import numpy as np
from panda3d.core import loadPrcFile
from panda3d.core import TextNode
from direct.task import Task
from direct.gui.OnscreenText import OnscreenText
from citysim3d.envs import SimpleQuadPanda3dEnv
from citysim3d.spaces import BoxSpace
import citysim3d.utils.transformations as tf
assert "C... | {
"content_hash": "bb599f834e7752869641d6018b9e56c7",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 134,
"avg_line_length": 44.10493827160494,
"alnum_prop": 0.5899230230930721,
"repo_name": "alexlee-gk/citysim3d",
"id": "1d2d781b020de8976f6d797d815cdf85a769cf2e",
"size":... |
from django import forms
from imager_profile.models import ImagerProfile
class EditProfileForm(forms.ModelForm):
"""Form to edit a profile."""
def __init__(self, *args, **kwargs):
"""Form."""
super(EditProfileForm, self).__init__(*args, **kwargs)
self.fields["name"] = forms.CharField(... | {
"content_hash": "018931d31b307fea14f345afd76b9db6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 109,
"avg_line_length": 47.63636363636363,
"alnum_prop": 0.6870229007633588,
"repo_name": "JSchatzman/django-imager",
"id": "11bd66edae45478d271e0293b158a5b231cd8357",
"siz... |
from keras.models import Sequential
from keras.layers.normalization import BatchNormalization
from keras.layers.convolutional import Conv2D
from keras.layers.convolutional import MaxPooling2D
from keras.layers.core import Activation
from keras.layers.core import Flatten
from keras.layers.core import Dropout
from keras.... | {
"content_hash": "6dabdbe2d4fa0fc6f5831ff592d9da7b",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 60,
"avg_line_length": 34.85897435897436,
"alnum_prop": 0.7138653916881207,
"repo_name": "CyberLabs-BR/face_detect",
"id": "47219b401e0bdc1057f50b24a69a34a93bbd02cf",
"size... |
import asyncio
import inspect
import sys
from datetime import datetime, timezone
from pathlib import Path
from typing import List
import pytest
from typing_extensions import Annotated, TypedDict
from pydantic import BaseModel, Extra, Field, ValidationError, validate_arguments
from pydantic.decorator import ValidatedF... | {
"content_hash": "8aa9aad3ef945faf3fe0acc061e5a1e8",
"timestamp": "",
"source": "github",
"line_count": 444,
"max_line_length": 120,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.5662455934195064,
"repo_name": "samuelcolvin/pydantic",
"id": "c2503dd72f25b161d5322bd22e3c27dbe6d17c01",
"size... |
"""
lunaport.domain.job
~~~~~~~~~~~~~~~~~~~
DESC
"""
import pprint
pp = pprint.PrettyPrinter(indent=4).pprint
from lunaport_worker.tasks.check import reduce_test
from .. dao.test import RDBMS as dao_test
class JobFabric(object):
""" Job static builder.
"""
req_attr_allowed = [
'name'... | {
"content_hash": "2d38eec2a27453b2dce08e44641a80bc",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 28.076923076923077,
"alnum_prop": 0.5420091324200913,
"repo_name": "greggyNapalm/lunaport_server",
"id": "0536ff4984376631b38920d2fd35b649b2bc7d73",
... |
from django_simptools.tests import AuthorizedViewTestCase
from django.core.urlresolvers import reverse
__author__ = 'Razzhivin Alexander'
__email__ = '[email protected]'
COMMON_FIXTURES = [
"payway_accounts_auth.json",
"payway_accounts_accounts.json",
"qiwi.json",
]
class QiwiViewTestCase(Authorize... | {
"content_hash": "8ddc5b2359061651bf8840bd7c46e115",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 95,
"avg_line_length": 33.45454545454545,
"alnum_prop": 0.688858695652174,
"repo_name": "RANUX/django-payway",
"id": "ed743dac832d01a9e7d55cf1fc7aaca4316ce166",
"size": "76... |
"""
Utilities for LaTeX to/from Unicode Text conversion.
Main Site:
https://github.com/phfaist/pylatexenc/
"""
from .version import version_str as _version_str
__version__ = _version_str
| {
"content_hash": "ec88faa4cdc8e0709578f4c45a43eb0e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 52,
"avg_line_length": 15.153846153846153,
"alnum_prop": 0.7055837563451777,
"repo_name": "phfaist/pylatexenc",
"id": "c7d2d393dc9eba35c406400b5224106c9785ed4f",
"size": "1... |
the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
#this first kind of for-loop goes through a list
for number in the_count:
print "This is count %d" % number
#same as above
for fruit in fruits:
print "A fruit of type: %s" % fruit
#als... | {
"content_hash": "5cb2cfad2f15d8e9a9e23a74fc549436",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 58,
"avg_line_length": 27.91176470588235,
"alnum_prop": 0.6838777660695469,
"repo_name": "liggettla/python",
"id": "686f0aaf47e8edae0e6966a94e6fa1326bae882a",
"size": "1009... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.