text stringlengths 4 1.02M | meta dict |
|---|---|
from testnado import AuthenticatedFetchCase
from tornado.testing import AsyncHTTPTestCase
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
class HandlerTestCase(AuthenticatedFetchCase, AsyncHTTPTestCase):
def assert_redirected_path_equals(self, expected_path, response):
i... | {
"content_hash": "afe06960d0947d88b9aaa5981644f9d1",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 69,
"avg_line_length": 33.470588235294116,
"alnum_prop": 0.7381370826010545,
"repo_name": "joshmarshall/testnado",
"id": "84a6fe07eec280a28ff5fda8c429fe9ea74bcb5e",
"size":... |
from cms.api import add_plugin, create_page
from cms.models import Page
from cms.plugin_pool import plugin_pool
from cms.test_utils.project.pluginapp.plugins.caching.cms_plugins import NoCachePlugin, SekizaiPlugin
from cms.test_utils.testcases import CMSTestCase
from cms.test_utils.util.context_managers import Settings... | {
"content_hash": "3433538e50c2efd707864bf082896ab9",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 112,
"avg_line_length": 43.344569288389515,
"alnum_prop": 0.6083124513954895,
"repo_name": "intgr/django-cms",
"id": "6b9f27a04913448e0a9bcc212a8228278ce92581",
"size": "1... |
""" Test nonlocal uses and unused-variable. """
__revision__ = 1
def test_nonlocal():
""" Test that assigning to a nonlocal does not trigger
an 'unused-variable' warnings.
"""
attr = True
def set_value(val):
""" Set the value in a nonlocal. """
nonlocal attr
attr = val
... | {
"content_hash": "1be1bdb895db2c0228f74d5dcfef185e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 58,
"avg_line_length": 24.071428571428573,
"alnum_prop": 0.5934718100890207,
"repo_name": "Titulacion-Sistemas/PythonTitulacion-EV",
"id": "ffcc9783f9a38f2a37d8f425fe19ccd30d... |
"""Top-level namespace for spm."""
from nipype.interfaces.spm.base import (Info, SPMCommand, logger, no_spm,
scans_for_fname, scans_for_fnames)
from nipype.interfaces.spm.preprocess import (SliceTiming, Realign, Coregister,
Normalize... | {
"content_hash": "def3a84135e5c8ec39fa07b1fee790a3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 84,
"avg_line_length": 59,
"alnum_prop": 0.47231638418079097,
"repo_name": "satra/NiPypeold",
"id": "f948a87755308826be628a35f2246515042a6555",
"size": "999",
"binary": f... |
from peewee import *
from playhouse.sqlite_ext import SqliteExtDatabase
db = SqliteExtDatabase('store/virus_manager.db',
threadlocals=True)
class BaseModel(Model):
class Meta:
database = db
class ManagedMachine(BaseModel):
image_name = TextField(unique=True)
reference_image = TextField()
... | {
"content_hash": "be8de72ccfdf7cac89a046c6ff3af477",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 51,
"avg_line_length": 23.434782608695652,
"alnum_prop": 0.7235621521335807,
"repo_name": "nsgomez/vboxmanager",
"id": "53c518786997eb30dcc18cd3cb48f487eff25bfb",
"size": "... |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import salt.states.incron as incron
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
class IncronTestCase(TestCase, LoaderModuleMockMixin):
"""
Test cas... | {
"content_hash": "b8c02d456d25dfe1ee197ef0e2e2cc17",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 86,
"avg_line_length": 39.495049504950494,
"alnum_prop": 0.546001504136375,
"repo_name": "saltstack/salt",
"id": "066676567ca74e102014eacc08b3166cc44751aa",
"size": "3989"... |
"""
Personal deployment (same host) settings
Data is kept in personal home directory area.
Service configuration is kept under personal home directory.
This is also useful for non-system deployment on a shared host.
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_fu... | {
"content_hash": "74f65bb6b1ddad565dfc14c53b835b33",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 95,
"avg_line_length": 34.813793103448276,
"alnum_prop": 0.5671553090332805,
"repo_name": "gklyne/annalist",
"id": "4d16df8f80376a1884c4f6f9154265db7bac983a",
"size": "504... |
import base64
import binascii
import bz2
import logging
import plistlib
import re
from typing import Any, Union, Dict
from xml.parsers.expat import ExpatError
Plist = Dict[str, Any]
Text = Union[str, bytes]
logger = logging.getLogger(__name__)
def class_to_title(text):
return re.sub(r'([a-z](?=[A-Z])|[A-Z](?=... | {
"content_hash": "7db01024e7cb4102e84e1cd4270e2b9c",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 82,
"avg_line_length": 30.218487394957982,
"alnum_prop": 0.639599555061179,
"repo_name": "sheagcraig/sal",
"id": "c0766843e1a63ab189b202e66a6382107b838d54",
"size": "3596"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Article',
fields=[
('id', models.AutoField(auto_cre... | {
"content_hash": "70d234571baeaf97addf3d497632f6a9",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 114,
"avg_line_length": 28.814814814814813,
"alnum_prop": 0.5398457583547558,
"repo_name": "tongxindao/shiyanlou",
"id": "7428df6b41cced23530f56001e6293bad3b443e1",
"size":... |
import functools
import shlex
from namesync.packages import six
class RecordParseError(Exception): pass
DEFAULT_PRIORITY = 10
@functools.total_ordering
class Record(object):
def __init__(self, type, name, content, priority=None, ttl=None, data=None):
self.type = type
self.name = name
sel... | {
"content_hash": "4927228176f7450e88496959c0f22b0a",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 84,
"avg_line_length": 28.544973544973544,
"alnum_prop": 0.5564411492122335,
"repo_name": "dnerdy/namesync",
"id": "24f34e04905e0ed1ff10dd4e107b214db3ee1668",
"size": "539... |
import threading
import struct
import sys
import re
import socket
import json
from websocket import create_connection
#THIS CLASS IS DEFINITELY NOT COMPLETE. TODO: FINISH.
class VoiceGateway(threading.Thread):
def __init__(self, serverId, userId, sessionId, token, endpoint):
threading.Thread.__init__(self)
self... | {
"content_hash": "c7fbbfd197a040c792d46e0188d35fee",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 104,
"avg_line_length": 29.056818181818183,
"alnum_prop": 0.6716855690262026,
"repo_name": "alanrossx2/DiscordBot-PurpleMinion",
"id": "d41b486030a4d93cfd5a56decb8bb01e27ff4... |
import unittest
import threading
from heronpy.api import global_metrics
import heron.instance.tests.python.utils.mock_generator as mock_generator
class GlobalMetricsTest(unittest.TestCase):
def setUp(self):
self.metrics_collector = mock_generator.MockMetricsCollector()
global_metrics.init(self.metrics_colle... | {
"content_hash": "b83f47cbfe550e2ee3c8bb56a2cf7ad7",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 73,
"avg_line_length": 32.06521739130435,
"alnum_prop": 0.6813559322033899,
"repo_name": "lucperkins/heron",
"id": "319f229bcc8a021b220d39cc19b1bf2e5ba8335b",
"size": "2154... |
import logging
import math
import os
import timeit
from collections import defaultdict
import pytest
import torch
from torch.autograd import grad
from torch.distributions import constraints, kl_divergence
import pyro
import pyro.distributions as dist
import pyro.optim
import pyro.poutine as poutine
from pyro import i... | {
"content_hash": "733344d6d19b91d6c773aedd4f2df91e",
"timestamp": "",
"source": "github",
"line_count": 4105,
"max_line_length": 94,
"avg_line_length": 35.44652862362972,
"alnum_prop": 0.5454957803007395,
"repo_name": "uber/pyro",
"id": "503d773d3c40e64c47e59cc18f87e3e17f28fea4",
"size": "145597",
... |
import os
import sys
import logging
from importlib import import_module
# 3rd party
import click
import yaml
from flask_appbuilder import const as fab_const
LOGGER = logging.getLogger(__name__)
FLASK_PROJECT_DIRECTORY = '/opt/trans_passports/code/trans_passports'
def import_application(app_package, appbuilder):... | {
"content_hash": "cc8bfd6366e78d0e6e2c84fcddaa8777",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 139,
"avg_line_length": 35.94444444444444,
"alnum_prop": 0.6093508500772797,
"repo_name": "approximatelylinear/trans-passports-docker",
"id": "09240a4521a25e4dd80a6845088ed5d... |
"""A middleware that turns exceptions into parsable string. Inspired by
Cinder's faultwrapper
"""
import sys
import traceback
from oslo.config import cfg
import webob
from murano.common import wsgi
from murano.packages import exceptions as pkg_exc
cfg.CONF.import_opt('debug', 'murano.openstack.common.log')
class ... | {
"content_hash": "ec0176b5e90c628c319822525df826f0",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 75,
"avg_line_length": 29.73109243697479,
"alnum_prop": 0.6031656302996043,
"repo_name": "sergmelikyan/murano",
"id": "278c73fe45690174db8faed9b069acfcabc85df7",
"size": "... |
import urllib
try:
import simplejson as json
except ImportError:
import json
import os
import httplib
import mimetypes
import re
import csv
# This is the main interface class. You can see an example of it in use
# below, implementing a command-line tool, but you basically just instantiate
# dstk = DSTK()
# an... | {
"content_hash": "f4ad18ab2d0fb2948ad14dabcafb7b24",
"timestamp": "",
"source": "github",
"line_count": 658,
"max_line_length": 133,
"avg_line_length": 31.416413373860184,
"alnum_prop": 0.5784152476780186,
"repo_name": "SwoopSearch/pyaddress",
"id": "a2bc28143176b37e1b0d938c2c9925590d59cbf6",
"size... |
from setuptools import setup
import pymesh
setup(
name=pymesh.__title__,
packages=[pymesh.__title__],
version=pymesh.__version__,
author=pymesh.__author__,
author_email="taxpon@gmail.com",
description="Library for manipulating (Translate, Rotate and Scale) 3D data using numpy.",
url=pymesh.... | {
"content_hash": "12bc4bd6f6dbcaa75f42a8ad13343c8a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 94,
"avg_line_length": 25.095238095238095,
"alnum_prop": 0.6204933586337761,
"repo_name": "taxpon/pymesh",
"id": "1fc38170772a629e22919dff2ed0bedc6ab6bd70",
"size": "527",
... |
import time
from datetime import datetime
from flask import render_template, jsonify, redirect, \
url_for, flash, request
from flask_login import login_required, login_user,\
logout_user, current_user
from src import app, db, login_manager
from src.forms import TaskForm, LoginForm, SignInForm
from src.models ... | {
"content_hash": "f8cb335d03ba42bcbcf26654754e5063",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 74,
"avg_line_length": 28.887755102040817,
"alnum_prop": 0.6026139173436948,
"repo_name": "hs3city/pythonhacking-flask",
"id": "7e4a1fef4652e5fb3d880213fcc9e85fcff108b5",
"... |
import ujson
from typing import Mapping, Any, Tuple, Optional
from django.utils.translation import ugettext as _
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view, return_success_on_head_request
from zerver.lib.response import json_success, json_error
from zerver.l... | {
"content_hash": "7a6d2e82ed82741b5273076c91883782",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 100,
"avg_line_length": 43.166666666666664,
"alnum_prop": 0.7302813017098732,
"repo_name": "jackrzhang/zulip",
"id": "d600c2966460fecabd9e81bc26a815013f182d7d",
"size": "18... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
'argh',
'mako',
'mandrill',
'sqlalchemy',
'pytz',
'zope.sqlalchemy',
'trans... | {
"content_hash": "26b7ec8973eff049be69e3c76edc611c",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 66,
"avg_line_length": 25.014492753623188,
"alnum_prop": 0.6019698725376593,
"repo_name": "gcarothers/threethings",
"id": "0c89ae482b47f708a73ea90bd7b7305a56501311",
"size"... |
import sys
from PySide import QtCore, QtGui
import pixelator_rc
ItemSize = 256
class PixelDelegate(QtGui.QAbstractItemDelegate):
def __init__(self, parent=None):
super(PixelDelegate, self).__init__(parent)
self.pixelSize = 12
def paint(self, painter, option, index):
if option.state... | {
"content_hash": "c91d323b79efdf428dc1e5c4e24cf31b",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 105,
"avg_line_length": 33.37549407114624,
"alnum_prop": 0.5900047370914259,
"repo_name": "mmanhertz/elopic",
"id": "f2d45745ddfd9273572b5f0deb74c93b961ef273",
"size": "95... |
#!/usr/bin/env python3
# Tool that assists in upgrading the Envoy source tree to the latest API.
# Internally, Envoy uses the latest vN or vNalpha for a given package. Envoy
# will perform a reflection based version upgrade on any older protos that are
# presented to it in configuration at ingestion time.
#
# Usage (f... | {
"content_hash": "6de232f017be9cd718d2ac48bc4f2ab7",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 98,
"avg_line_length": 42.685,
"alnum_prop": 0.6785756120417008,
"repo_name": "envoyproxy/envoy-wasm",
"id": "eda6eaf94088136f84eef73eb98206c87cfa2b59",
"size": "8541",
... |
import errno
import os
import ddt
import mock
from oslo_config import cfg
from oslo_utils import importutils
from manila import exception
from manila.share import configuration as config
from manila.share import driver
from manila.share.drivers.glusterfs import layout
from manila import test
from manila.tests import ... | {
"content_hash": "a9db47b66ae5a51dde25e4544336d4a6",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 79,
"avg_line_length": 38.9746835443038,
"alnum_prop": 0.6066904839233518,
"repo_name": "bswartz/manila",
"id": "5582cee1f43434b1290c29593a020025bd81641c",
"size": "12949"... |
"""Test Waze Travel Time sensors."""
from WazeRouteCalculator import WRCError
import pytest
from homeassistant.components.waze_travel_time.const import (
CONF_AVOID_FERRIES,
CONF_AVOID_SUBSCRIPTION_ROADS,
CONF_AVOID_TOLL_ROADS,
CONF_REALTIME,
CONF_UNITS,
CONF_VEHICLE_TYPE,
DOMAIN,
)
from h... | {
"content_hash": "f7abdfef9a098210e772634dd968a531",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 87,
"avg_line_length": 32.84920634920635,
"alnum_prop": 0.6663445276636869,
"repo_name": "nkgilley/home-assistant",
"id": "67ba7c6e3115d508dc30d6ac2495419ba4b6174f",
"size... |
from __future__ import print_function
import os
import sys
import warnings
if __name__ == '__main__' and sys.argv[1] == "gevent_nosetests":
print("Running gevent tests")
from gevent.monkey import patch_all
patch_all()
if __name__ == '__main__' and sys.argv[1] == "eventlet_nosetests":
print("Running ev... | {
"content_hash": "de7f4cf8892956279ad7b62d2b15d4b9",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 131,
"avg_line_length": 34.38109756097561,
"alnum_prop": 0.5816263190564867,
"repo_name": "beobal/python-driver",
"id": "b92063bfac5edd0753e635553bc1bf4581c7c702",
"size":... |
import account_analytic_default
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| {
"content_hash": "b74c682f92ddc61526eacf6b7fc3245b",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 65,
"avg_line_length": 33,
"alnum_prop": 0.8282828282828283,
"repo_name": "cristianquaglio/odoo",
"id": "1734f02dc579fc775a6c575063c3f3d2564ae3aa",
"size": "1087",
"binary... |
from mtTkinter import *
from threading import Thread, Lock
from datetime import datetime, timedelta
from time import sleep
import os
class GameClock(Thread):
def __init__(self, scorebox):
Thread.__init__(self)
self.daemon = True
self.active = True
self.l = Lock()
self.win = ... | {
"content_hash": "afd26d2757e554bd116512e8294d550f",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 75,
"avg_line_length": 27.805825242718445,
"alnum_prop": 0.5321229050279329,
"repo_name": "jheidel/scrabble-opencv",
"id": "6860c5ed64d3230c47b5408190c09c8cb5bb4e03",
"siz... |
import mock
import requests
from keystoneclient import httpclient
from keystoneclient.tests.unit import utils
FAKE_RESPONSE = utils.TestResponse({
"status_code": 200,
"text": '{"hi": "there"}',
})
REQUEST_URL = 'https://127.0.0.1:5000/hi'
RESPONSE_BODY = '{"hi": "there"}'
def get_client():
cl = httpcl... | {
"content_hash": "8921bd784ac05e4d5203f9eef332fbd4",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 79,
"avg_line_length": 35.05263157894737,
"alnum_prop": 0.6015015015015015,
"repo_name": "darren-wang/ksc",
"id": "e574d375053f63c3aaaa11ee2f899aec654fef68",
"size": "3903"... |
from __future__ import print_function
import os, sys, argparse
from object_recognition_core.db import models
from object_recognition_core.db.tools import args_to_db_params
import object_recognition_core.db.tools as dbtools
import couchdb
def parse_args():
parser = argparse.ArgumentParser(description='Add an objec... | {
"content_hash": "4037163cf8da481af206ce428032cbc4",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 111,
"avg_line_length": 41.490566037735846,
"alnum_prop": 0.5898135516143702,
"repo_name": "WalkingMachine/sara_commun",
"id": "0855bb788c8807b62cdd5c0539981735b94e68b7",
"... |
import tensorflow as tf
from ..utils import logger
def describe_model():
""" print a description of the current model parameters """
train_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
msg = [""]
total = 0
for v in train_vars:
shape = v.get_shape()
ele = shape.num_elem... | {
"content_hash": "70d4d35fc6d0321168bcba97279cbbe3",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 102,
"avg_line_length": 34.857142857142854,
"alnum_prop": 0.5959016393442623,
"repo_name": "yinglanma/AI-project",
"id": "6b0046744b8c8868c476e83bc18d0f5e9420a567",
"size":... |
import os
import sys
from azure import (
WindowsAzureError,
DEFAULT_HTTP_TIMEOUT,
DEV_ACCOUNT_NAME,
DEV_ACCOUNT_KEY,
_ERROR_STORAGE_MISSING_INFO,
)
from azure.http import HTTPError
from azure.http.httpclient import _HTTPClient
from azure.storage import _storage_error_handler
#-----------------... | {
"content_hash": "3dc09b2b85a94e5072a6d9472794e870",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 78,
"avg_line_length": 34.98125,
"alnum_prop": 0.5913882437019832,
"repo_name": "dominoFire/azure-sdk-for-python",
"id": "74b1fa02117386d99ffc5e41dcc582434c4d3cae",
"size"... |
""" Unit tests for the Assessment object """
from sqlalchemy.orm import attributes
from ggrc import db
from ggrc.models import Assessment
from ggrc.models import mixins
from ggrc.models import object_document
from ggrc.models import object_person
from ggrc.models import relationship
from ggrc.models import track_obje... | {
"content_hash": "63b8c26c1dc0e99e12b9856c20a4d12f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 96,
"avg_line_length": 51.55,
"alnum_prop": 0.6110572259941804,
"repo_name": "josthkko/ggrc-core",
"id": "f1abd02c5022560d29234b22f230c0105cd5de8f",
"size": "3206",
"bina... |
from __future__ import unicode_literals, absolute_import
import unittest
from whispy_lispy import interpreter2, scopes2
from ..constructors import *
class InterpreterTestCase(unittest.TestCase):
def test_return_native_int(self):
tree = ast.RootAbstractSyntaxNode((ast.Value((types.Int((3, )),)),))
... | {
"content_hash": "3c57354eb8dd03a65f3f2a69e0f88be8",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 32.632183908045974,
"alnum_prop": 0.5036984853821769,
"repo_name": "vladiibine/whispy_lispy",
"id": "fe968130e920d5432fa8163c57d8d27c3fffa332",
"size... |
import argparse
import os
import shutil
import time
import random
import tqdm
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import densenet ... | {
"content_hash": "9ad379a6afb9f574575f066f361baeb5",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 130,
"avg_line_length": 38.204663212435236,
"alnum_prop": 0.5848647182477792,
"repo_name": "volzkzg/densenet-pytorch",
"id": "edbe3d1be985c0303fe4eaa1a678e01e78f1db27",
"s... |
import attr
import datetime
import logging
import socket
import sakia.i18n_rc
import async_timeout
import aiohttp
from PyQt5.QtCore import QObject, pyqtSignal, QTranslator, QCoreApplication, QLocale, Qt
from . import __version__
from .options import SakiaOptions
from sakia.data.connectors import BmaConnector
from sakia... | {
"content_hash": "ca5bdbbea3776e99f2a11b2fa0321391",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 145,
"avg_line_length": 48.74458874458875,
"alnum_prop": 0.6417406749555951,
"repo_name": "ucoin-io/cutecoin",
"id": "ecfe2e41f2d99d3d6e7fa45a43013f8e23ba4e06",
"size": "1... |
"""
GENERATE DOC: [MAJORS] csv/tsv for R processing
"""
import os, sys
import pymongo
from pymongo import MongoClient
import json
import ipdb
BASE_DIR = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__))) )
counts_dir = os.path.join(BASE_DIR,'dataR/counts')
ne_counts = os.path.join(counts_d... | {
"content_hash": "9ccd4bd8dcf4115175d265ef904bde69",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 115,
"avg_line_length": 31.6875,
"alnum_prop": 0.5746219592373438,
"repo_name": "ronaldahmed/labor-market-demand-analysis",
"id": "950d3998d47ac9f080e5b9bb77a9e5ab06cbd4e0",
... |
'''
Created on 2014-7-10
Author: Gavin_Han
Email: muyaohan@gmail.com
'''
import time
import threading
class UserCrawler(threading.Thread):
def __init__(self, callbacks=None):
super(UserCrawler, self).__init__()
self.callbacks = callbacks
def crawl(self):
#print self.thre... | {
"content_hash": "66a61ba032fa18010266f05ed0d061ed",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 43,
"avg_line_length": 20.181818181818183,
"alnum_prop": 0.581081081081081,
"repo_name": "GavinHan/sina_weibo_crawler",
"id": "34e0528b463f092fb311331283d58ca2d063fac4",
"s... |
import hashlib
import pytest
from pex.hashing import (
HashlibHasher,
MultiDigest,
Sha1Fingerprint,
Sha256Fingerprint,
new_fingerprint,
)
def test_fingerprint_equality():
# type: () -> None
assert Sha1Fingerprint("foo") == Sha1Fingerprint("foo")
assert Sha1Fingerprint("foo") != Sha1... | {
"content_hash": "b616072ac0cd41bd5460cf9bdad0abb8",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 93,
"avg_line_length": 28.191176470588236,
"alnum_prop": 0.6645800730307773,
"repo_name": "jsirois/pex",
"id": "26604e26a7c5879be91ea4c339f3313667abf786",
"size": "2049",
... |
"""Set up the MyAppConfig function to be called"""
default_app_config = 'profiles.apps.MyAppConfig'
| {
"content_hash": "e4947d845a2aee16ff2b5498de3c7ad6",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 50,
"avg_line_length": 50,
"alnum_prop": 0.76,
"repo_name": "nbeck90/game-chat",
"id": "66910bb9caf5ee876efea202ce7ed42a8196eb09",
"size": "100",
"binary": false,
"copie... |
global squidclient_options
squidclient_options = os.getenv('DSTAT_SQUID_OPTS') # -p 8080
class dstat_plugin(dstat):
'''
Provides various Squid statistics.
'''
def __init__(self):
self.name = 'squid status'
self.type = 's'
self.width = 5
self.scale = 1000
self.... | {
"content_hash": "f467a15751d9271d74461159d340329d",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 100,
"avg_line_length": 33.63636363636363,
"alnum_prop": 0.529054054054054,
"repo_name": "dongyoungy/dbseer_middleware",
"id": "738517e97bd704c8c9f56243b91233a6b2f46ff4",
"... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "issueTracking.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "50eed12001a912c972ea031b68ee022f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 77,
"avg_line_length": 26,
"alnum_prop": 0.717948717948718,
"repo_name": "asifmohd/issueTracking",
"id": "b0b8b0b9f2156540b619ee0b426809ebe0afcb6d",
"size": "256",
"binary... |
'''
The FBX contect class initializes FBX, and loads and prepares a scene for parsing.
'''
from ...core import *
from fbx import *
from ..fbxutil.geometry import removeBadPolygons
#-------------------------------------------------------------------------------
class Context :
'''
Initialize the FBX manager, lo... | {
"content_hash": "d69d7aabc9ea6f730de3924c6f106fab",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 86,
"avg_line_length": 32.644067796610166,
"alnum_prop": 0.6048805815160956,
"repo_name": "floooh/drahtgitter",
"id": "8e8bd83f6702c86bf3de172c4a1f1df0260b1feb",
"size": "1... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0004_productimage_file_field'),
]
operations = [
migrations.AlterField(
model_name='product',
name='publish_date',
... | {
"content_hash": "5728390cffad967e02b1c06827a9f078",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 175,
"avg_line_length": 28.444444444444443,
"alnum_prop": 0.638671875,
"repo_name": "ryneeverett/cartridge",
"id": "ebdf1096c96a06ea139472b526b2b7a487973627",
"size": "536"... |
"""
Transformation Based Learning
A general purpose package for Transformation Based Learning,
currently used by nltk.tag.BrillTagger.
"""
from nltk.tbl.template import Template
#API: Template(...), Template.expand(...)
from nltk.tbl.feature import Feature
#API: Feature(...), Feature.expand(...)
from... | {
"content_hash": "2b6b96e5d078835745e6bc1cd8890738",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 60,
"avg_line_length": 23.210526315789473,
"alnum_prop": 0.7165532879818595,
"repo_name": "MyRookie/SentimentAnalyse",
"id": "4d6a30b748b211e7c9c5dd5a2b65218250585139",
"si... |
class SpotifyException(Exception):
def __init__(self, http_status, code, msg, reason=None, headers=None):
self.http_status = http_status
self.code = code
self.msg = msg
self.reason = reason
# `headers` is used to support `Retry-After` in the event of a
# 429 status c... | {
"content_hash": "74eef97cafad818891f6e9c587196c5f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 35.5,
"alnum_prop": 0.5704225352112676,
"repo_name": "plamere/spotipy",
"id": "df503f10bf330346cbd9d8e0aa34a37e17412f01",
"size": "568",
"binary": ... |
__author__ = "Kosuke Akizuki <kosuke19952000@gmail.com>"
__status__ = "OK"
__version__ = "1.0"
__date__ = "11 Mar 2015"
from .processing import execute
def merge(dir_src, dir_dst, pattern, symlinks=False, ignore=list()):
if _isNotNone(dir_src, dir_dst, pattern) and \
_isNotEmpty(dir_src, dir_dst, patter... | {
"content_hash": "0314d79b35f03d6953fb98d1e18617b0",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 87,
"avg_line_length": 31.176470588235293,
"alnum_prop": 0.5877358490566038,
"repo_name": "k4zzk/mercre",
"id": "7a04065edb8c3d1d71b9503367c678cfedfd2e6b",
"size": "1510",
... |
"""Initial database commit
Revision ID: 35e7157127b
Revises: None
Create Date: 2014-06-01 21:15:45.151351
"""
# revision identifiers, used by Alembic.
revision = '35e7157127b'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adj... | {
"content_hash": "f553ac888c22e9a1f421c2f64d549c06",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 63,
"avg_line_length": 19.076923076923077,
"alnum_prop": 0.6834677419354839,
"repo_name": "Kerbas-ad-astra/KerbalStuff",
"id": "e819d71f73fc4df96eca4a72c948e9ff8aa5285e",
"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.layers as layers
from ray.rllib.models import ModelCatalog
def _build_q_network(inputs, num_actions, config):
dueling = config["dueling"]
hiddens = c... | {
"content_hash": "b972027e6cfefbffd11380239ac4e7d9",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 79,
"avg_line_length": 38.244131455399064,
"alnum_prop": 0.6016449791308618,
"repo_name": "alanamarzoev/ray",
"id": "a4e28381f4c818d40429c05ed16f64ca6fba11ac",
"size": "81... |
import sqlalchemy as sa
from sqlalchemy import orm
from neutron.db import l3_db
from neutron.db import model_base
from neutron.db import models_v2
from networking_cisco.plugins.cisco.db.device_manager import hd_models
class RouterType(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
"""Represents Neutr... | {
"content_hash": "a560de6bcf555512d1aee07fae345c3d",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 79,
"avg_line_length": 49.3780487804878,
"alnum_prop": 0.6591751049641887,
"repo_name": "CiscoSystems/networking-cisco",
"id": "18eaa04aa5e7a6787eea50d5201e12b8698b94d7",
"... |
import h5py
import numpy as np
from boadata.core import DataObject
from boadata.core.data_conversion import ChainConversion, DataConversion
from boadata.data.mixins import GetItemMixin
@DataObject.register_type(default=True)
@ChainConversion.enable_to(
"pandas_data_frame", through="numpy_array", condition=lambda... | {
"content_hash": "2dae317376795a9b4c2fbc9ca146aa7b",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 84,
"avg_line_length": 27.765217391304347,
"alnum_prop": 0.5991230817413091,
"repo_name": "janpipek/boadata",
"id": "a658fd0f315f4cb2ec8eba8791a26b904808a2eb",
"size": "31... |
"""Default variable filters."""
from __future__ import unicode_literals
import re
import random as random_module
import unicodedata
from decimal import Decimal, InvalidOperation, Context, ROUND_HALF_UP
from functools import wraps
from pprint import pformat
from django.template.base import Variable, Library, VariableD... | {
"content_hash": "8627e05601093bdc09f5f88fef372ad1",
"timestamp": "",
"source": "github",
"line_count": 903,
"max_line_length": 84,
"avg_line_length": 31.427464008859356,
"alnum_prop": 0.6102399661721696,
"repo_name": "aleida/django",
"id": "b9cdd942966208a50419d20f84897e15d4cc78f5",
"size": "28379... |
""" Automatic File """
| {
"content_hash": "61e19a74416adff20a94a44660161ef7",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 22,
"avg_line_length": 23,
"alnum_prop": 0.5652173913043478,
"repo_name": "imvu/bluesteel",
"id": "b0eec1eba0f5274d00b89aee5ae682d296ff993d",
"size": "23",
"binary": false... |
import sys
import json
import struct
def check_answer(fn, name = None):
def wrapped(*args, **kwargs):
ans = fn(*args, **kwargs)
assert ans.get("answer") == "ok", \
"Error during " + (name if name else fn.__name__) + \
" " + ans.get("msg", "")
return ans
return wr... | {
"content_hash": "115a05b92e81262ba3af74b2866df07e",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 78,
"avg_line_length": 31.135021097046412,
"alnum_prop": 0.5297465781271175,
"repo_name": "RomanKharin/lrmq",
"id": "370efff5025e2d0980a7c9f3486151363bdd753e",
"size": "85... |
from math import log
import operator
# Chapter 3.1.1 - Information gain (Program List 3-1)
def calculate_shannon_entropy(dataset):
entry_count = len(dataset)
label_counts = {}
for feat_vec in dataset:
current_label = feat_vec[-1]
if current_label not in label_counts.keys():
lab... | {
"content_hash": "84489e61c31d0429837007ee0ffa7df4",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 113,
"avg_line_length": 39.41880341880342,
"alnum_prop": 0.6266261925411969,
"repo_name": "metesa/MachineLearningInAction-Code",
"id": "67b7f17de8682a2bcaeb982cb77ccde117fda... |
import ode
#enzyme initial condition setup
GlucoseGA3P_vmax =
GlucoseGA3P_gamma =
GlucoseGA3P_rate =
GlucoseGA3P_km =
GA3PDHAP_vmax =
GA3PDHAP_gamma =
GA3PDHAP_rate =
GA3PDHAP_km =
DHAPG3P_vmax =
DHAPG3P_gamma =
DHAPG3P_rate =
DHAPG3P_km =
G3PGlycerol_vmax =
G3PGlycerol_gamma =
G3PGlycerol_rate =
G3PGlycerol_km =
... | {
"content_hash": "36f7498ae28bafaa98252c519f1935dd",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 420,
"avg_line_length": 31.050847457627118,
"alnum_prop": 0.7372270742358079,
"repo_name": "imwiththou/PathwayNet",
"id": "95b120859e2dc19ed447bd4f60fab396b3fcbf88",
"size... |
from django.core.serializers import serialize
from django.db.models.query import QuerySet
from django.utils import simplejson
from django.template import Library
register = Library()
def jsonify(obj):
if isinstance(obj, QuerySet):
return serialize('json', obj)
return simplejson.dumps(obj)
register.fi... | {
"content_hash": "2c7358f2095f487ed80519364c387edf",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 45,
"avg_line_length": 26.46153846153846,
"alnum_prop": 0.7674418604651163,
"repo_name": "hamicornfury/storyscape.django-",
"id": "46057a0bbc43fbbe5bf1277c22ea7a18c6b597ec",
... |
'''
motion.py: part of mriqc package
'''
import numpy as np
import pylab as plt
import seaborn as sns
from mriqc.misc import plot_vline
from matplotlib.figure import Figure
from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas
from matplotlib.gridspec import GridSpec
def calc_frame_dispalcement(... | {
"content_hash": "ce2847c1133a41c035c8e3db47e5a40f",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 104,
"avg_line_length": 32.08695652173913,
"alnum_prop": 0.6585365853658537,
"repo_name": "vsoch/mriqc",
"id": "cec7702218cd60ee4ea276614a5fe8d10120630b",
"size": "2214",
... |
import numpy as np
from .VariableUnitTest import VariableUnitTest
from gwlfe.MultiUse_Fxns.Runoff import NewCN
class TestNewCN(VariableUnitTest):
def test_NewCN(self):
z = self.z
np.testing.assert_array_almost_equal(
NewCN.NewCN_f(z.NRur, z.NUrb, z.CN),
NewCN.NewCN(z.NRur,... | {
"content_hash": "e7a8cc94315b3b7caf67fb5bb4b09418",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 57,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.6714697406340058,
"repo_name": "WikiWatershed/gwlf-e",
"id": "d0e17d6280f6e7171373c9b9ce320d919fda4a19",
"size": ... |
import json
import os
import sys
import shutil
# TODO: PUT THIS SOMEWHERE ELSE, Extend it for more primitives
def map_types(params):
""" Takes a dict of params in the form i:{'value':'val','type':type} and maps them to i:value according to type """
type_map = {
'int':int,
'real':float,
'string':str,
'boo... | {
"content_hash": "add4c4257bccde2a2de410857cbe975c",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 132,
"avg_line_length": 27.209876543209877,
"alnum_prop": 0.6633393829401089,
"repo_name": "ProtoML/ProtoML-transforms",
"id": "35ebabf5dd6d659f704a7af266e0466619c20404",
"... |
import argparse
import json
import os
import re
import urllib.request
_REPO_URL = 'https://repo.maven.apache.org/maven2'
_GROUP_NAME = 'com/google/dagger'
_MODULE_NAME = 'dagger'
_FILE_EXT = 'jar'
_OVERRIDE_LATEST = None
_PATCH_VERSION = 'cr1'
def do_latest():
if _OVERRIDE_LATEST is not None:
print(_OVER... | {
"content_hash": "f7954309bb7cc57151c72f76fd4e4238",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 31.385714285714286,
"alnum_prop": 0.5930814747382794,
"repo_name": "chromium/chromium",
"id": "951ba8d9ffe3129aa98806813601db32f3346fcf",
"size": "24... |
"""
Generalized Linear Models.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Vincent Michel <vincent.michel@inria.fr>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Mathieu Blond... | {
"content_hash": "f7c7db03f2fca56f2352ed140300517d",
"timestamp": "",
"source": "github",
"line_count": 642,
"max_line_length": 79,
"avg_line_length": 35.6183800623053,
"alnum_prop": 0.5940438186032274,
"repo_name": "ndingwall/scikit-learn",
"id": "2399e1216238f6360db9f7834c5c4d3e1b740381",
"size":... |
"""Extensions module. Each extension is initialized in the app factory located in app.py."""
from flask_bcrypt import Bcrypt
from flask_caching import Cache
from flask_debugtoolbar import DebugToolbarExtension
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy... | {
"content_hash": "ae80d8f8f0e5c3d297e99f13c3d52582",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 92,
"avg_line_length": 30.894736842105264,
"alnum_prop": 0.8023850085178875,
"repo_name": "ChristoferHuynh/web",
"id": "3cf5f9e0def7d84242f3a843c5627f7f558f6542",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0009_account_ownedcard'),
]
operations = [
migrations.AlterField(
model_name='account',
name='center',
fi... | {
"content_hash": "40d0197e85aacbdde4d14f279589a78d",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 159,
"avg_line_length": 31.08108108108108,
"alnum_prop": 0.5565217391304348,
"repo_name": "SchoolIdolTomodachi/SchoolIdolAPI",
"id": "c686a47b715dfe19aba6977ef1c6476289710304... |
from __future__ import unicode_literals
from collections import OrderedDict
from datetime import datetime, timedelta
from dateutil import rrule
from flask import flash, jsonify, request, session
from werkzeug.exceptions import BadRequest
from indico.modules.events.cloning import EventCloner
from indico.modules.event... | {
"content_hash": "231e7a26514f8a17a3578fbb9b6aa73f",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 117,
"avg_line_length": 39.80628272251309,
"alnum_prop": 0.6080494541628305,
"repo_name": "mvidalgarcia/indico",
"id": "0199915d83b8473fd3c77f0f849d1cad142c2c5d",
"size": ... |
"""
.. _ex-publication-figure:
===================================
Make figures more publication ready
===================================
In this example, we show several use cases to take MNE plots and
customize them for a more publication-ready look.
"""
# Authors: Eric Larson <larson.eric.d@gmail.com>
# ... | {
"content_hash": "b1fa443192b76f9b0a82699e613ff8cb",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 79,
"avg_line_length": 37.43589743589744,
"alnum_prop": 0.6858121330724071,
"repo_name": "mne-tools/mne-tools.github.io",
"id": "fc9385c385f5564a6bbd8101c83d6fe09da25441",
... |
from __future__ import unicode_literals
import base64
import json
import boto
import boto3
import os
import sure # noqa
import sys
from boto.exception import BotoServerError
from botocore.exceptions import ClientError
from moto import mock_iam, mock_iam_deprecated
from moto.iam.models import aws_managed_policies
from... | {
"content_hash": "94764223cae018464d847f69456939fe",
"timestamp": "",
"source": "github",
"line_count": 1463,
"max_line_length": 152,
"avg_line_length": 38.05604921394395,
"alnum_prop": 0.6651339895107408,
"repo_name": "whummer/moto",
"id": "e7507e2e52027f381b90b4702b8f13411857f957",
"size": "55676... |
from setuptools import setup
setup(
name='armstrong.apps.couchdb',
version='0.1.1',
description='Provides a few generic views for wrapping calls to CouchDB',
author='Texas Tribune',
author_email='tech@texastribune.org',
url='http://github.com/texastribune/armstrong.apps.couchdb/',
packages=... | {
"content_hash": "85dc7b97097bbc3f155d424fc9b63afb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 77,
"avg_line_length": 27.096774193548388,
"alnum_prop": 0.5976190476190476,
"repo_name": "texastribune/armstrong.apps.couchdb",
"id": "dacd176b72a57f4681e3ad383501b44ce9e9f0... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str, super, zip)
__version__ = "1.2.1"
import sys
if sys.version_info[0] == 2:
from .py2parser import (FoostacheLex... | {
"content_hash": "0ed13db137a6ae53ccf0beaadf50e33a",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 129,
"avg_line_length": 41.4,
"alnum_prop": 0.7536231884057971,
"repo_name": "ldgabbay/foostache-python",
"id": "ec47144085baaafb429b726a7c153b257bbedfbb",
"size": "621",
... |
from django import forms #cuz it is a package
import datetime
from lessons.models import Lesson, Assessment
# lolling about the difference between ModelForm and Form
class LessonAddForm(forms.Form):
name = forms.CharField()
url = forms.URLField() # IT BETTER VALIDATE IT
choices = ( (1,'Yes'),
(0,... | {
"content_hash": "1381e3254f707515124c011e218f2e3a",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 114,
"avg_line_length": 35.44444444444444,
"alnum_prop": 0.6943573667711599,
"repo_name": "selenamarie/teach-today",
"id": "b84f3642c6b332227aa0ebc6ba5abd178d4f9bad",
"size... |
import sys
import nicknamer
IS_PY2 = sys.version_info[0] == 2
if IS_PY2:
def dict_iteritems(d):
return d.iteritems()
def dict_iterkeys(d):
return d.iterkeys()
else:
def dict_iteritems(d):
return iter(d.items())
def dict_iterkeys(d):
return iter(d.keys())
class Comm... | {
"content_hash": "e72e9dd253c25da5820f287010148545",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 544,
"avg_line_length": 29.283842794759824,
"alnum_prop": 0.6039367730390695,
"repo_name": "ganeshmurthy/qpid-dispatch",
"id": "248e65fdeb64c5cf7ea403b4c4e4aaec9134f120",
... |
"""Support for streamed reading and writing of multipart MIME content."""
from base64 import b64encode
from cgi import parse_header
try:
from hashlib import md5
md5; # Pyflakes workaround
except ImportError:
from md5 import new as md5
import sys
__all__ = ['read_multipart', 'write_multipart']
__docformat_... | {
"content_hash": "ec8cf0af9919619f526ae3e9b21f004e",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 79,
"avg_line_length": 35.2125,
"alnum_prop": 0.5792213939178795,
"repo_name": "couchbaselabs/priority15",
"id": "a46f4a2f26a13d2ec774fa83857900bf0f793520",
"size": "8671"... |
from oscar.apps.address.abstract_models import AbstractPartnerAddress
from oscar_vat_moss import fields
class PartnerAddress(AbstractPartnerAddress):
vatin = fields.vatin()
from oscar.apps.partner.models import * # noqa
| {
"content_hash": "f623ff8a893496c5fcb26e9aba9ebc2f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 69,
"avg_line_length": 21,
"alnum_prop": 0.7922077922077922,
"repo_name": "fghaas/django-oscar-vat_moss",
"id": "d500671f7c9644b18c0169cc1d5da507fdab3a02",
"size": "231",
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, schema, scope, workspace
from caffe2.python.layers.layers import (
ModelLayer,
)
import caffe2.proto.caffe2_pb2 as caffe2_pb2
import n... | {
"content_hash": "0f4db279c5d2433df7d870173d47d7f5",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 80,
"avg_line_length": 40.358333333333334,
"alnum_prop": 0.5572991947140202,
"repo_name": "pietern/caffe2",
"id": "7a860d25c82fa6b071a0aa5dda9ebd6c3b6bd5ee",
"size": "5577... |
import os
import logging
import subprocess
def spawn(args, **kwargs):
"""Spawn a subprocess and return it back
"""
if 'cwd' not in kwargs:
kwargs['cwd'] = os.path.dirname(os.path.abspath(__file__))
kwargs['bufsize'] = -1
if os.name == 'nt':
startupinfo = subprocess.STARTUPINFO()
... | {
"content_hash": "5a00022b11a6161274c5e13c2817af5c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 74,
"avg_line_length": 25.2,
"alnum_prop": 0.5984126984126984,
"repo_name": "prisis/sublime-text-packages",
"id": "667c6801d2c33e59ed4eef1e0d30c56d11e3f9f3",
"size": "759",... |
import csv
import time
from controller.CouponMaster import CouponMaster
from controller.UserMaster import UserMaster
from model.User import User
__author__ = "Ivon Liu"
# How to print unicode properly
# print(str(row).encode('ascii', 'ignore'))
print("Hello world")
# Read user_list
UserMaster.load_from_csv()
# prin... | {
"content_hash": "015821d75c7e87356f23ddbfabcb17df",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 49,
"avg_line_length": 25.56,
"alnum_prop": 0.7355242566510172,
"repo_name": "AJLiu/SPCSAI-CouponPurchasePrediction",
"id": "4de20d08f127527d1d60a48bef06727b18da4b6e",
"siz... |
"""RAND Health Insurance Experiment Data"""
from statsmodels.datasets import utils as du
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is in the public domain."""
TITLE = __doc__
SOURCE = """
The data was collected by the RAND corporation as part of the Health
Insurance Experiment (HIE).
http:/... | {
"content_hash": "3808ecfbb9cf04ab833df6451dbff329",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 77,
"avg_line_length": 27.094117647058823,
"alnum_prop": 0.6435084672166739,
"repo_name": "josef-pkt/statsmodels",
"id": "a82c4679ac1a5410755c105f5db173f64dcc8c77",
"size":... |
"""NVP Plugin exceptions"""
from neutron.common import exceptions as q_exc
class NvpPluginException(q_exc.NeutronException):
message = _("An unexpected error occurred in the NVP Plugin:%(err_msg)s")
class NvpInvalidVersion(NvpPluginException):
message = _("Unable to fulfill request with version %(version)s... | {
"content_hash": "8266a09f32400d8355eaa523fafc6b8a",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 78,
"avg_line_length": 34.08196721311475,
"alnum_prop": 0.6916786916786917,
"repo_name": "netscaler/neutron",
"id": "e26a49acabaaab757883a9cdf46042eeba9277f7",
"size": "276... |
from __future__ import unicode_literals, division, absolute_import, print_function
import unittest
import sys
import os
from asn1crypto import pem, algos, keys, core
from oscrypto import asymmetric, errors, backend
from ._unittest_compat import patch
patch()
if sys.version_info < (3,):
byte_cls = str
int_t... | {
"content_hash": "e30b3b01a1aba782e51abd976c9424a6",
"timestamp": "",
"source": "github",
"line_count": 636,
"max_line_length": 110,
"avg_line_length": 47.02358490566038,
"alnum_prop": 0.6521215768883539,
"repo_name": "wbond/oscrypto",
"id": "e1fca1c7e800ef89bba4e5d1742a8c80d14a5605",
"size": "2992... |
"""DB API v2.0 required
"""
import time
import datetime
import constants
class _DBAPITypeObject:
def __init__(self,*values):
self.values = values
def __cmp__(self,other):
if other in self.values:
return 0
if other < self.values:
return 1
e... | {
"content_hash": "46dc01122a05795652e68dce7344221f",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 70,
"avg_line_length": 23.29268292682927,
"alnum_prop": 0.6785340314136126,
"repo_name": "GetSomeBlocks/Score_Soccer",
"id": "57fdcf1624ec5f466557d944649e19ca689451f8",
"si... |
"""Support for interacting with Spotify Connect."""
from asyncio import run_coroutine_threadsafe
import datetime as dt
from datetime import timedelta
import logging
from typing import Any, Callable, Dict, List, Optional
from aiohttp import ClientError
from spotipy import Spotify, SpotifyException
from yarl import URL
... | {
"content_hash": "421d4282a7259051bfa2f5091ca6ecd9",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 87,
"avg_line_length": 31.03921568627451,
"alnum_prop": 0.6085190867250249,
"repo_name": "robbiet480/home-assistant",
"id": "1b74855c9f99fc3f8ced3352adc72d0f0db7c526",
"si... |
from __future__ import absolute_import
from blockcanvas.numerical_modeling.numeric_context.nan_filter import *
| {
"content_hash": "559e78fec72f438cdb6b2732c97b7c57",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 71,
"avg_line_length": 55.5,
"alnum_prop": 0.8198198198198198,
"repo_name": "enthought/etsproxy",
"id": "aba722ae2658ff3e088611e78ac2f0131d2824a9",
"size": "126",
"binary"... |
from google.cloud import securitycenter_v1beta1
def sample_update_source():
# Create a client
client = securitycenter_v1beta1.SecurityCenterClient()
# Initialize request argument(s)
request = securitycenter_v1beta1.UpdateSourceRequest(
)
# Make the request
response = client.update_source... | {
"content_hash": "86495192c9909f9393285ac2af863881",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 73,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.7456521739130435,
"repo_name": "googleapis/python-securitycenter",
"id": "16168c1bcb747522259ecf11d98cdf8222e3b1be"... |
from __future__ import unicode_literals
from collections import defaultdict
from operator import attrgetter
from flask import flash, jsonify, request, session
from sqlalchemy.orm import joinedload, subqueryload
from indico.core.db import db
from indico.modules.events.abstracts.controllers.base import RHManageAbstrac... | {
"content_hash": "1a3fd237054497e488b28745fa58560b",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 120,
"avg_line_length": 49.083333333333336,
"alnum_prop": 0.6636582968456796,
"repo_name": "mic4ael/indico",
"id": "198ff7d18b0f4586610787c6489a601c51beda4d",
"size": "114... |
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
def on_clic():
print("Hello!")
app = QApplication(sys.argv)
# The default constructor has no parent.
# A widget with no parent is a window.
window = QMainWindow()
window.resize(250, 150)
window.setWindowTitle('Hello')
button = QPushB... | {
"content_hash": "205ebe63134bd5abb41886371ae0b4f2",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 120,
"avg_line_length": 27.555555555555557,
"alnum_prop": 0.7446236559139785,
"repo_name": "jeremiedecock/snippets",
"id": "deae82bfb79ad301b4280355470a3604f81a3bdd",
"size... |
def listOnOneLine(items):
for item in items:
print(item, end=' ')
listOnOneLine(['apple', 'banana', 'pear'])
print('This may not be what you expected!')
| {
"content_hash": "4799b04bb1843a90b334d51d165b2295",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 43,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.6445783132530121,
"repo_name": "hwheeler01/comp150",
"id": "d8fd56fec28ced104203678eb2c42a8e6b7b380a",
"size": "16... |
from difflib import SequenceMatcher
def scour(find, tlist):
x = 0
def ke(z):
return SequenceMatcher(None, z, find).ratio() * -1
try:
while tlist[x]:
SequenceMatcher(None, tlist[x], find).ratio()
#print comp[x] + " compared to " + find;
x = x + 1
except... | {
"content_hash": "55ca506374d4a3c26517b71a4b604dde",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 58,
"avg_line_length": 29.307692307692307,
"alnum_prop": 0.5485564304461942,
"repo_name": "notanewbie/BRIAN",
"id": "8c10895ad84c3e2b24f72a61b4445e99b0ebac8a",
"size": "381... |
'''Generates Go source files from a mojom.Module.'''
from itertools import chain
import os
import re
from mojom.generate.template_expander import UseJinja
import mojom.generate.generator as generator
import mojom.generate.module as mojom
import mojom.generate.pack as pack
class KindInfo(object):
def __init__(self... | {
"content_hash": "947c9867f77dce2045b9f2483b3db465",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 79,
"avg_line_length": 38.11581920903955,
"alnum_prop": 0.6731638627436448,
"repo_name": "collinjackson/mojo",
"id": "e20e9e4f6b4ac69e95823bf9621c230bec48c707",
"size": "1... |
"""
This modules implements the CrawlSpider which is the recommended spider to use
for scraping typical web sites that requires crawling pages.
See documentation in docs/topics/spiders.rst
"""
import copy
from scrapy.http import Request, HtmlResponse
from scrapy.utils.spider import iterate_spider_output
from scrapy.... | {
"content_hash": "f44dfa5e72f2e55fec8cd2616c2d71df",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 129,
"avg_line_length": 35.714285714285715,
"alnum_prop": 0.6286153846153846,
"repo_name": "xtmhm2000/scrapy-0.22",
"id": "61b97e5a3b433fa245e3b5f7543f8036ab8fac82",
"size"... |
import warnings
import numpy as np
from scipy.integrate import quad, dblquad
from dpmm.density import t_density, multivariate_t_density, scaled_IX_density
from test_utils import timer
@timer
def test_scaled_IX_density():
nu = 3
sigsqr = 1.0
# test that probability integrates to 1.0
r = quad(lambda x... | {
"content_hash": "2cae6da123e489a3b278154538dd1c66",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 109,
"avg_line_length": 40.57462686567164,
"alnum_prop": 0.5885598675740298,
"repo_name": "jmeyers314/DPMM",
"id": "037b4138519dca72cf0332d174fb2053795d0d7a",
"size": "543... |
"""
ELEVATOR ANIMATED
This sample code simulates an elevator using salabim's capabilities, including animation.
The user can set some values on the animation screen: number of floors, number of elevator cabins,
capacity of the cabins (persons) and the number of visitors requesting an elevator.
The default values set in... | {
"content_hash": "550dc9a6df18b13fda0d20dcacf735ef",
"timestamp": "",
"source": "github",
"line_count": 492,
"max_line_length": 108,
"avg_line_length": 38.63414634146341,
"alnum_prop": 0.5959069865319865,
"repo_name": "salabim/salabim",
"id": "e5555aae5c38e90b991e4112648db3ef7e1641f2",
"size": "190... |
import importlib
import re
import json
import networkx as nx
import numpy as np
import networkx.algorithms.dag as nx_dag
import collections
from .tools import flatten_all, nested_update, group_by_function
from .tools import is_iterable, is_mappable, is_numpy_iterable
from . import tools
from .class_lookup import is_sto... | {
"content_hash": "256a342cde0b4b87b3fd6c822873fd31",
"timestamp": "",
"source": "github",
"line_count": 513,
"max_line_length": 77,
"avg_line_length": 34.96101364522417,
"alnum_prop": 0.6225815444661277,
"repo_name": "dwhswenson/openpathsampling",
"id": "419a53d6d3d8571514cc7a698544fad6b2cc11ea",
"... |
"""
Example of Minimum Component Filtering
--------------------------------------
Figure 10.13
A minimum component filter applied to the spectrum of a white dwarf from SDSS
data set (mjd= 52199, plate=659, fiber=381). The upper panel shows a portion
of the input spectrum, along with the continuum computed via the mini... | {
"content_hash": "bde34a8393f9145d628614876a265cfd",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 33.255102040816325,
"alnum_prop": 0.6287204664007364,
"repo_name": "kcavagnolo/astroML",
"id": "7c4d49bf51ced0659d64db445cd1ea1051f06306",
"size": "3... |
from flask import Blueprint, render_template, request, session
from flask.ext.login import login_required
from websterton.user.models import User
import json
blueprint = Blueprint("user", __name__, url_prefix='/users',
static_folder="../static")
@blueprint.route("/")
@login_required
def membe... | {
"content_hash": "f8cec843755c00fdca17faecf87f6189",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 63,
"avg_line_length": 25.53846153846154,
"alnum_prop": 0.7108433734939759,
"repo_name": "RylanGotto/web-dash",
"id": "d9895cb647ab08945c736eea000a7ff8ec452831",
"size": "6... |
import os
import re
import csv
import glob
import pandas as pd
from datetime import datetime
def merge_subdirectories(input_folder_path, output_filename):
"""
Cleans and processes multiple .csvs
Creates new merged .csv file
folder_path: string of top-level file folder with subfolders
output_filena... | {
"content_hash": "9b3c4be337d22d842b131ac50b365540",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 82,
"avg_line_length": 41.43283582089552,
"alnum_prop": 0.5399855907780979,
"repo_name": "CSDE-UW/paa_2017_social_media",
"id": "54c6142c8b7bec8ca98e69923abc1449c889947c",
... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_commoner_tatooine_aqualish_male_01.iff"
result.attribute_template_id = 9
result.stfName("npc_name","aqualish_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return r... | {
"content_hash": "311244c882ec376207ccfd64db8063c1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 25,
"alnum_prop": 0.7076923076923077,
"repo_name": "anhstudios/swganh",
"id": "c99f5a5acaa16e07e409928c449d83889d4de2e6",
"size": "470",
"binary": ... |
import requests
import os
import sys
import json
class SalecontrolClient(object):
def __init__(self, cfg_name):
self.cfg = json.loads(open(cfg_name).read())
self.auth = (self.cfg['username'], self.cfg['password'])
self.url = self.cfg['url']
self.post_headers = {'Content-type': 'appl... | {
"content_hash": "f304d6a62135e8500fbbde80e08e74b6",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 105,
"avg_line_length": 32.52857142857143,
"alnum_prop": 0.5368906455862977,
"repo_name": "baraujo/salecontrol",
"id": "8f98dedf4508501109e4a64dbdc6f8e1d0d17303",
"size": ... |
__author__ = 'greg'
import aggregation
import cPickle as pickle
import os.path
class CondorTools(aggregation.ClassificationTools):
def __init__(self):
aggregation.ClassificationTools.__init__(self,scale=1.875)
def __classification_to_markings__(self,classification):
annotations = classificati... | {
"content_hash": "ccd3cd7fe4fd40f00ba2e98ab68f2b3c",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 144,
"avg_line_length": 40.35820895522388,
"alnum_prop": 0.6187130177514792,
"repo_name": "camallen/aggregation",
"id": "8a2a7981905bd79ea8672d13e472e54bd2a53361",
"size": ... |
""" ietf_system
This module contains a collection of YANG definitions for the
configuration and identification of some common system
properties within a device containing a NETCONF server. This
includes data node definitions for system identification,
time\-of\-day management, user management, DNS resolver
configura... | {
"content_hash": "5e79b69d013afcf90aee8d8b6c80bd62",
"timestamp": "",
"source": "github",
"line_count": 1695,
"max_line_length": 626,
"avg_line_length": 31.811209439528024,
"alnum_prop": 0.5109792284866469,
"repo_name": "111pontes/ydk-py",
"id": "f7eadec0c9d92b417ed6af09829fedccbda4eada",
"size": "... |
"""
Created on Nov 30, 2015
@author: jakob
"""
from django.dispatch.dispatcher import receiver
from cms.models.titlemodels import Title
from cms.signals import post_publish, post_unpublish
from .signals import add_to_index, remove_from_index
@receiver(post_publish, dispatch_uid='publish_cms_page')
def publish_cms_p... | {
"content_hash": "44e2cd4187bc48c51c871e7fd5f71040",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 83,
"avg_line_length": 35.13636363636363,
"alnum_prop": 0.7645536869340233,
"repo_name": "aldryn/aldryn-search",
"id": "1e7e54b23e74acddd251d23466b508dd09660546",
"size": "... |
import logging
import posixpath
import traceback
from data_source import DataSource
from docs_server_utils import FormatKey
from extensions_paths import (
ARTICLES_TEMPLATES, INTROS_TEMPLATES, PRIVATE_TEMPLATES)
from file_system import FileNotFoundError
from future import All
from path_util import AssertIsDirector... | {
"content_hash": "3b548629422c5606836a34bad6d0ea76",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 76,
"avg_line_length": 29.46551724137931,
"alnum_prop": 0.6974839087185488,
"repo_name": "xin3liang/platform_external_chromium_org",
"id": "c7ba8069151f635bf3daa5ba28b6e81d52... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.