text stringlengths 4 1.02M | meta dict |
|---|---|
from bokeh.plotting import figure, output_file, show
from bokeh.models import ColumnDataSource, Circle, HoverTool
from bokeh.sampledata.glucose import data
output_file("hover_glyph.html")
x, y = data.ix['2010-10-06'].index.to_series(), data.ix['2010-10-06']['glucose']
# Basic plot setup
p = figure(width=600, height=... | {
"content_hash": "3b5cbcacc0a3bc358cd76a0b01027900",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 117,
"avg_line_length": 45.166666666666664,
"alnum_prop": 0.7001845018450185,
"repo_name": "maxalbert/bokeh",
"id": "1954f147c7e9c9bd307e1bc91fb7df789ec0bda5",
"size": "108... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'HostMaintenance.hostname'
db.add_column(u'maintenance_hostmaintenance', 'hostname... | {
"content_hash": "cf3db3e70fd8190fecfd6e8a293c5e8e",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 191,
"avg_line_length": 68.65277777777777,
"alnum_prop": 0.5737406433340076,
"repo_name": "globocom/database-as-a-service",
"id": "ec237010e3a587722a15500dc4b2bc1021e65a44",
... |
import os
import subprocess
import re
import getopt
import sys
import arch_handler as ah
from my_regex import *
#==================================================================
# Global functions
def runCommand(command, arguments):
ret = subprocess.check_output([command] + arguments)
return ret
def makeWotan(wo... | {
"content_hash": "c4d7875d5b41ea43245f2275a2be6a6f",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 94,
"avg_line_length": 28.497907949790793,
"alnum_prop": 0.6366172368227867,
"repo_name": "wotan-fpga/wotan",
"id": "e94159d6f7de70e960fae34a35165b63d3e5c4c3",
"size": "68... |
from django import forms
from cyder.base.eav.forms import get_eav_form
from cyder.cydhcp.workgroup.models import Workgroup, WorkgroupAV
class WorkgroupForm(forms.ModelForm):
class Meta:
model = Workgroup
WorkgroupAVForm = get_eav_form(WorkgroupAV, Workgroup)
| {
"content_hash": "fc4a2cfaf49b65a2fe232558018045cc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 64,
"avg_line_length": 21.307692307692307,
"alnum_prop": 0.7725631768953068,
"repo_name": "murrown/cyder",
"id": "a9b9a871d28a4764dfb7693ea647326d7012450b",
"size": "277",
... |
"""Loads datasets, dashboards and slices in a new superset instance"""
import json
import os
import zlib
from io import BytesIO
from typing import Any, Dict, List, Set
from urllib import request
from superset import app, db
from superset.connectors.connector_registry import ConnectorRegistry
from superset.models.slice... | {
"content_hash": "1ed868e0ce0ac573b764ee12f906df64",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 82,
"avg_line_length": 31.650793650793652,
"alnum_prop": 0.6740220661985958,
"repo_name": "apache/incubator-superset",
"id": "d8b2c59fb777d7e462a70e1d0d8f0643a676819a",
"si... |
'''
Script for building and uploading a STM8 project with dependency auto-detection
'''
# set general options
UPLOAD = 'BSL' # select 'BSL' or 'SWIM'
TERMINAL = False # set True to open terminal after upload
RESET = 1 # STM8 reset: 0=skip, 1=manual, 2=DTR line (RS232), 3=send 'Re5eT!' @ 1... | {
"content_hash": "6706e17f5a396116031373a8ded4c72b",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 137,
"avg_line_length": 34.683673469387756,
"alnum_prop": 0.6743159752868491,
"repo_name": "gicking/STM8_templates",
"id": "85485c77770ec2fd16cc435b26a76d30c287b74d",
"size... |
XXXXXXXXX XXX XXXXXXXXXX XXXXXXXX X XXXXXXXXX XXXXXXXX XXX XXXXXX XXXXXXXXX
XXX XXXXXXXXXX XXX XXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXX XX XXXXXXXX X
XXXXX XXXXXX XX XXXXXXXX X
XXXXX XXXXXX XX XXXXXXXX XX
XXXXX XXXXXX XX XXXXXXXX X
XXXXX XXXXXX XX XXXXXXXX X
XXXXX XXXXXX XX ... | {
"content_hash": "53a5f5c119d65c4318687ce1809443c0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 75,
"avg_line_length": 33.76,
"alnum_prop": 0.726303317535545,
"repo_name": "dnaextrim/django_adminlte_x",
"id": "b5b1ab42d7c058e3ac4de5d5bac7f87cbe1f4c7f",
"size": "844",
... |
"""Tests the graph quantization script.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.contrib.quantization.tools import quantize_graph
from tensorflow.python.framework import graph_util
fla... | {
"content_hash": "8048ac894adbd230ea8ad56c0ade1a7a",
"timestamp": "",
"source": "github",
"line_count": 684,
"max_line_length": 80,
"avg_line_length": 51.074561403508774,
"alnum_prop": 0.48226706741090597,
"repo_name": "neilhan/tensorflow",
"id": "4826ea26896c16a925b1a8407d1d7d6ffd057da0",
"size": ... |
"""Basic functions for probability features: Transitions matrix, motif probability..."""
from . import utils
def permutations(items, n):
if n == 0:
yield ''
else:
for i in range(len(items)):
for base in permutations(items, n - 1):
yield str(items[i]) + str(base)
de... | {
"content_hash": "1663681ef3b8f6f9663e6e5ef22253ae",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 101,
"avg_line_length": 38.1219512195122,
"alnum_prop": 0.6250799744081894,
"repo_name": "RNAEDITINGPLUS/main",
"id": "9e137eacb5d9147aa3309546e61a7d146da9a374",
"size": "1... |
"A Google Calendar Parser"
from datetime import datetime, date, timedelta
from time import strptime, mktime
from xml.sax.saxutils import unescape
from urllib2 import urlopen
# From Requirements.txt
from pytz import timezone
from icalendar.cal import Calendar, Event
from BeautifulSoup import BeautifulStoneSoup, Tag
... | {
"content_hash": "a450baa547c3bd5619cd7ad56f363a35",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 115,
"avg_line_length": 38.82706766917293,
"alnum_prop": 0.5562225664859283,
"repo_name": "dominicmeroux/Reading-In-and-Analyzing-Calendar-Data-by-Interfacing-Between-MySQL-an... |
import warnings
import threading
from django.core.mail import get_connection
from django.core.mail.backends.base import BaseEmailBackend
from email_tracker.conf import settings
from email_tracker.compat import make_msgid
from email_tracker.models import TrackedEmail
class EmailBackendWrapper(BaseEmailBackend):
... | {
"content_hash": "0dec921db06de092837e88b98be332dd",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 109,
"avg_line_length": 32.723684210526315,
"alnum_prop": 0.6437474869320466,
"repo_name": "IndustriaTech/django-email-tracker",
"id": "797cae53f3c7dd7c3161340d00a559fd2a1573... |
from __future__ import unicode_literals
from django.db import migrations, models
import model_utils.fields
import colorfield.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Activity',
fields=[
... | {
"content_hash": "f1cc73cb50d8fe6050b59a6a7a872185",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 395,
"avg_line_length": 53.46153846153846,
"alnum_prop": 0.5351003407800076,
"repo_name": "javierwilson/resilienciacafe",
"id": "88ba7f12639a8e0443b7f0a4451b7c5052fa8ec4",
... |
"""Test the sma config flow."""
from unittest.mock import patch
from pysma.exceptions import (
SmaAuthenticationException,
SmaConnectionException,
SmaReadException,
)
from homeassistant.components.sma.const import DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.data_entry_fl... | {
"content_hash": "b7602df65ea7ad95e07fefd47e0d3bbb",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 71,
"avg_line_length": 33.431654676258994,
"alnum_prop": 0.6511727996556919,
"repo_name": "mezz64/home-assistant",
"id": "eeaa0d75f074e954c60fdc0b70b034505a94726d",
"size"... |
"""
See docstring class Validator below for more details on validation
"""
from abc import abstractmethod
from copy import deepcopy
from moto.dynamodb2.exceptions import (
AttributeIsReservedKeyword,
ExpressionAttributeValueNotDefined,
AttributeDoesNotExist,
ExpressionAttributeNameNotDefined,
Incor... | {
"content_hash": "b0c9211e00f03645dbb1285b710dec61",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 118,
"avg_line_length": 37.93908629441624,
"alnum_prop": 0.6315226117206315,
"repo_name": "william-richard/moto",
"id": "79849e538c64febabf5026bfaf172aa8baa0d00e",
"size":... |
from . import Core
from .Core import Transform_Affine, Transform_Identity, Transform_6DOF, Transform_Scale, Transform_Translation, Transform_Rotation, Grid3D, Image3D, GridND, ImageND
from .Core import grid_from_box_and_affine
from .Core import nipy_to_occiput, nifti_to_occiput, occiput_from_array
from . import transf... | {
"content_hash": "aab1532971d7455b479239fef4b135b3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 164,
"avg_line_length": 48,
"alnum_prop": 0.8046875,
"repo_name": "kastman/occiput",
"id": "c43b9f5c2b6016e848a0a52a94d977d062b9f6f4",
"size": "515",
"binary": false,
"c... |
"""Tests for HomematicIP Cloud config flow."""
from unittest.mock import patch
from homeassistant.components.homematicip_cloud.const import (
DOMAIN as HMIPC_DOMAIN,
HMIPC_AUTHTOKEN,
HMIPC_HAPID,
HMIPC_NAME,
HMIPC_PIN,
)
from tests.common import MockConfigEntry
DEFAULT_CONFIG = {HMIPC_HAPID: "ABC... | {
"content_hash": "a494af025c538435b69e648920a6b032",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 91,
"avg_line_length": 35.83783783783784,
"alnum_prop": 0.6559577677224736,
"repo_name": "turbokongen/home-assistant",
"id": "0b573e66b1da0458b2562acd0d15db28a350a528",
"s... |
from __future__ import unicode_literals
import csv
from furl import furl
from datetime import datetime, timedelta
from django.views.generic import FormView, DeleteView, ListView
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import PermissionDenied
from django.core.mail impo... | {
"content_hash": "2b3ec9e3d5a21e914ae5d55ccaea1f1e",
"timestamp": "",
"source": "github",
"line_count": 441,
"max_line_length": 115,
"avg_line_length": 36.142857142857146,
"alnum_prop": 0.5766359244620114,
"repo_name": "monikagrabowska/osf.io",
"id": "1c556eb4a97a8b8cd63461a190dad9ad94bf347e",
"siz... |
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
class AproposTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
def test_apropos(self):
self.expect("apropos", error=True,
substrs=[' must be called with exa... | {
"content_hash": "1be6eb89fcf57a65a29ac8d746cb50bd",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 82,
"avg_line_length": 34.88461538461539,
"alnum_prop": 0.5865490628445424,
"repo_name": "endlessm/chromium-browser",
"id": "920f0dd0b2455677b644a35b3480f265720b3f89",
"siz... |
from photoshell.hash import hash_file
import os
def test_hash_file(tmpdir):
tmpdir.join('file.test').write("Test")
assert (hash_file(os.path.join(tmpdir.strpath, 'file.test')) ==
'640ab2bae07bedc4c163f679a746f7ab7fb5d1fa')
| {
"content_hash": "1353d70438de5d31de77497abd61730e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 67,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.7032520325203252,
"repo_name": "photoshell/photoshell",
"id": "6e5dbb56749d8b9339cb5cd0a1ad792378b37b20",
"size": ... |
import torch
import torch.multiprocessing as mp
class TrafficLight:
"""used by chief to allow workers to run or not"""
def __init__(self, val=True):
self.val = mp.Value("b", False)
self.lock = mp.Lock()
def get(self):
with self.lock:
return self.val.value
def swit... | {
"content_hash": "291029214fe730312a4bbe90c4129799",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 69,
"avg_line_length": 23.128205128205128,
"alnum_prop": 0.5532150776053215,
"repo_name": "alexis-jacq/Pytorch-DPPO",
"id": "7a2cd591c5960da2d25801595a2eec77d057107d",
"siz... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2015, Xtina Schelin <xtina.schelin@gmail.com>'
__docformat__ = 'restructuredtext en'
try:
from PyQt5 import Qt as QtGui
except ImportError:
from PyQt4 import QtGui
try:
from PyQt5.Qt... | {
"content_hash": "0016eb5ea6cb53020e129985d6fb74fb",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 113,
"avg_line_length": 41.66197183098591,
"alnum_prop": 0.742393509127789,
"repo_name": "XtinaSchelin/isfdb-calibre",
"id": "881b631fc4e09fc3011532618d04b44544d61e42",
"si... |
"""Daemon Component
Component to daemonize a system into the background and detach it from its
controlling PTY. Supports PID file writing, logging stdin, stdout and stderr
and changing the current working directory.
"""
from __future__ import print_function
import os
import sys
import fcntl
from logging import getL... | {
"content_hash": "029fcfd946458f2d11fe522c2756245f",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 95,
"avg_line_length": 28.189393939393938,
"alnum_prop": 0.5614082235958076,
"repo_name": "prologic/cgod",
"id": "43692cb0e45a89da644ce67c2b82db4101f5b59e",
"size": "3834"... |
"""
Relaxation methods
------------------
The multigrid cycle is formed by two complementary procedures: relaxation and
coarse-grid correction. The role of relaxation is to rapidly damp oscillatory
(high-frequency) errors out of the approximate solution. When the error is
smooth, it can then be accurately represent... | {
"content_hash": "ea1cdbd6b648133f99060acd8aa5da97",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 88,
"avg_line_length": 40.77777777777778,
"alnum_prop": 0.7704359673024523,
"repo_name": "pombreda/pyamg",
"id": "605c60ac63c82465f6a12fce91eb5735d0f8c58f",
"size": "1468",... |
from nova import db
from nova import objects
from nova.objects import base
from nova.objects import fields
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class PciDevice(base.NovaPersistentObject, base.NovaObject):
"""Object to rep... | {
"content_hash": "117094399c81084f73692f710a9c8b31",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 78,
"avg_line_length": 38.422222222222224,
"alnum_prop": 0.6278195488721805,
"repo_name": "virtualopensystems/nova",
"id": "32caadeebdfa73dcacd42618d157f71849e169b0",
"siz... |
try:
from BeautifulSoup import BeautifulSoup
except ImportError:
print("Error importing BeautifulSoup Library")
import re
from util import formatter
import datetime
class Parser(object):
response = {
"time_departure_s": [],
"time_departure_e": [],
"time_return_s": [],
"time... | {
"content_hash": "edb89cb38d6d9813cdcd258d4adb7295",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 79,
"avg_line_length": 37.22738386308068,
"alnum_prop": 0.4788519637462236,
"repo_name": "nmoya/fscan",
"id": "b0f5b0beb206da38125a8e6008fa6f28e5ace2a7",
"size": "15250",
... |
'''Utility Mixins to abstract common behavior for CC API Resources'''
from currencycloud.resources.actions.delete import DeleteMixin
from currencycloud.resources.actions.update import UpdateMixin
| {
"content_hash": "5034bbb159747cebe1ed874ab1dbb74e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 69,
"avg_line_length": 49.25,
"alnum_prop": 0.8426395939086294,
"repo_name": "CurrencyCloud/currencycloud-python",
"id": "8aa82e67f286b1fa66c8a564f23ac49d245ff909",
"size": ... |
"""Static data and helper functions."""
from __future__ import absolute_import
import collections
from datetime import timedelta
from datetime import tzinfo
import errno
import locale
import logging
import math
import multiprocessing
import os
import pkgutil
import re
import struct
import sys
import tempfile
import t... | {
"content_hash": "7599e2d88bf6effbc4748ffc01bf4328",
"timestamp": "",
"source": "github",
"line_count": 1788,
"max_line_length": 87,
"avg_line_length": 34.766219239373605,
"alnum_prop": 0.6900839741321064,
"repo_name": "BrandonY/gsutil",
"id": "262443723ced53dfccab5c3a5fee46908dd372e0",
"size": "62... |
from __future__ import print_function
import os
import sys
import traceback
import unittest2
import keystoneclient
from oslo.config import cfg
import requests
from fuel_health.common import log as logging
from fuel_health import exceptions
LOG = logging.getLogger(__name__)
identity_group = cfg.OptGroup(name='iden... | {
"content_hash": "3157709a41373038972f3abd1caad2db",
"timestamp": "",
"source": "github",
"line_count": 754,
"max_line_length": 79,
"avg_line_length": 37.673740053050395,
"alnum_prop": 0.5676969654298387,
"repo_name": "mcloudv/fuel-ostf",
"id": "4b141a69dad3414d412b7e1df976bd233dc0bacb",
"size": "2... |
from __future__ import print_function
from twisted.web.template import flattenString
from element_2 import ExampleElement
def renderDone(output):
print(output)
flattenString(None, ExampleElement()).addCallback(renderDone)
| {
"content_hash": "4dcfa9a5d2edf60224c565449b91e20b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 61,
"avg_line_length": 32.42857142857143,
"alnum_prop": 0.8105726872246696,
"repo_name": "EricMuller/mynotes-backend",
"id": "01baedf600b034bae44715314f97288e947e6259",
"siz... |
'''
actg.py
Reverse complement plugin for Sublime Text 2
'''
import sublime, sublime_plugin
class ReverseComplementCommand(sublime_plugin.TextCommand):
def complement(self, sequence, reverse=False):
"""
Compute the complement of a DNA sequence.
If reverse is True, reverse it too.
"""
flip = {
'A': ... | {
"content_hash": "39204cc077712dfb3416666090c1d541",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 65,
"avg_line_length": 20.263157894736842,
"alnum_prop": 0.6034632034632035,
"repo_name": "hackerfriendly/ACTG",
"id": "b7f56c861cec214dc588038ff847595bbc8db64d",
"size": "... |
from datetime import datetime
from django.conf import settings
from django.core.exceptions import BadRequest
import requests
import olympia.core.logger
from olympia.devhub.models import BlogPost
log = olympia.core.logger.getLogger('z.cron')
def update_blog_posts():
"""Update the blog post cache."""
resp... | {
"content_hash": "7c93bed6f6d572b9f8fdd4ae44991bbf",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 86,
"avg_line_length": 33.40909090909091,
"alnum_prop": 0.6401360544217687,
"repo_name": "mozilla/olympia",
"id": "032baa94e8126bd70ea186e37a78d317cbb3a2b9",
"size": "1470"... |
import logging
from random import randint
from django.conf import settings
from django.db import models
from django.db.utils import ProgrammingError
from django.utils.translation import ugettext_lazy as _
from ..utils import slugify, pick_attrs
from .common import CommonFields
from .media_spec import MediaSpec
logg... | {
"content_hash": "0c7c293872139a8e3e02e0df653189e5",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 117,
"avg_line_length": 33.572463768115945,
"alnum_prop": 0.622274983811785,
"repo_name": "conikuvat/edegal",
"id": "005617034ded733b671285fb02dce09e493439b2",
"size": "46... |
import os
# The fake password we will use to authenticate su'ed users
SECRET_PASSWORD = os.urandom(64)
__version__ = '0.4.7'
| {
"content_hash": "2419d0ef5bcfcf8e5923ff3e9c933582",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 59,
"avg_line_length": 21.166666666666668,
"alnum_prop": 0.7086614173228346,
"repo_name": "Stackdriver/django-su",
"id": "c17910edb38616a95787197d6a1719b475bb5dea",
"size": ... |
from core.himesis import Himesis
import uuid
class HUnionDaughterRule(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule UnionDaughterRule.
"""
# Flag this instance as compiled now
self.is_compiled = True
su... | {
"content_hash": "2d3500ca8fbb5c3db3ccf9b448a3ef26",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 132,
"avg_line_length": 36.43055555555556,
"alnum_prop": 0.5022874571101792,
"repo_name": "levilucio/SyVOLT",
"id": "9d895220642f73165a136e32125cf0df0f60945a",
"size": "52... |
from __future__ import absolute_import
from zerver.lib.statistics import seconds_usage_between
from optparse import make_option
from django.core.management.base import BaseCommand
from zerver.models import UserProfile
import datetime
from django.utils.timezone import utc
def analyze_activity(options):
day_start ... | {
"content_hash": "70b4b4d84ffad9dd80765fbe1ab62243",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 123,
"avg_line_length": 42.45614035087719,
"alnum_prop": 0.7,
"repo_name": "gkotian/zulip",
"id": "9bf5a0b510f277c75da6bf32026ccb257a1f524a",
"size": "2420",
"binary": fa... |
from .simple_content_view import SimpleContentView
| {
"content_hash": "ac7f10af6cf0e925e51fa250d527f2b8",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 50,
"avg_line_length": 51,
"alnum_prop": 0.8627450980392157,
"repo_name": "6aika/issue-reporting",
"id": "06f9c1a828555de7455b7567d426fb7f38d4d173",
"size": "51",
"binary"... |
"""
Window provides access to the DOM model's global Window.
"""
closingListeners = []
resizeListeners = []
from __pyjamas__ import JS, doc, wnd, get_main_frame
from pyjamas import Location
def init_listeners():
pass
def addWindowCloseListener(listener):
closingListeners.append(listener)
def addWindowR... | {
"content_hash": "6c8d9c8a64a019e58857f8c5f6c2c07b",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 69,
"avg_line_length": 19.659574468085108,
"alnum_prop": 0.68001443001443,
"repo_name": "lovelysystems/pyjamas",
"id": "c8e60f9bd8447b148ad8b7afb8c35afb617081f3",
"size": ... |
import os
import tempfile
import numpy as np
import pytest
import scipy.sparse
from hypothesis import given, settings, strategies
from scipy.sparse import csr_matrix, rand
import xgboost as xgb
from xgboost import testing as tm
rng = np.random.RandomState(1)
dpath = 'demo/data/'
rng = np.random.RandomState(1994)
... | {
"content_hash": "ee05e3e72f57f5ab35af819b64f81eaf",
"timestamp": "",
"source": "github",
"line_count": 455,
"max_line_length": 95,
"avg_line_length": 35.824175824175825,
"alnum_prop": 0.5571779141104295,
"repo_name": "dmlc/xgboost",
"id": "def3690275b53ab9787fc7ae2cbbd47792a7b609",
"size": "16320"... |
from __future__ import unicode_literals
from datetime import datetime
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return render(request, 'index.html', {
'current_time': datetime.now().strftime('%Y-%m-%d(%a) %H:%M:%S'),
}) | {
"content_hash": "d84eaa3f8d1af542133daca953673684",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 73,
"avg_line_length": 28.545454545454547,
"alnum_prop": 0.697452229299363,
"repo_name": "steny138/WorldTraveller",
"id": "5618354fbff32f0d17ecae16f4b3b4eca253ff63",
"size"... |
from django.test import TestCase
from django.test.client import Client
from django.conf import settings
from django.core.urlresolvers import reverse
class LadingPageTest(TestCase):
"""
Note: You should go ahead and do your own integration tests
with selenium or something like it.
This merely makes sur... | {
"content_hash": "251ac6cae62615b39689c5d134b6cbae",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 31.56,
"alnum_prop": 0.6945500633713562,
"repo_name": "bliti/tienda",
"id": "b8cc8793e18a872c7a2f8bfbad59bfc13139c9cb",
"size": "789",
"binary": fa... |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('numpy',parent_package,top_path)
config.add_subpackage('distutils')
config.add_subpackage('testing')
config.add_subpackage('f2py')
config.add_subpackage('core')
conf... | {
"content_hash": "9d3b4d69dc97e09edf5d040502262974",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 59,
"avg_line_length": 36.75,
"alnum_prop": 0.6870748299319728,
"repo_name": "plaes/numpy",
"id": "faa13d9d16f9c99b2f8c8a8104519bf915e66e3e",
"size": "905",
"binary": fal... |
from django.db import models
# Create your models here.
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.conf import settings
from django.core.validators import MinValueValidator, MaxValueValidator
from nr.formulas import mask_toggle
from datetime import d... | {
"content_hash": "0926c60996427f216025708b25d8284d",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 270,
"avg_line_length": 40.330677290836654,
"alnum_prop": 0.6954460140274622,
"repo_name": "shafiquejamal/socialassistanceregistry",
"id": "229e997b8ad1b4c7f3205613d917f26e9... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("apostello", "0018_auto_20170808_1045")]
operations = [migrations.RemoveField(model_name="smsinbound", name="matched_link")]
| {
"content_hash": "c6774a3bfae7681bc07d2373a7066143",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 87,
"avg_line_length": 26.7,
"alnum_prop": 0.7415730337078652,
"repo_name": "monty5811/apostello",
"id": "c81d499e90dba43967d095bcfb17660f24aca3f3",
"size": "340",
"binar... |
"""Mocks for the august component."""
import json
import os
import time
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
from yalexs.activity import (
ACTIVITY_ACTIONS_BRIDGE_OPERATION,
ACTIVITY_ACTIONS_DOOR_OPERATION,
ACTIVITY_ACTIONS_DOORBELL_DING,
ACTIVITY_ACTIONS_DOORBELL_MOTION,... | {
"content_hash": "efb4b37a96cb810931216e7775eae8c3",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 88,
"avg_line_length": 34.829787234042556,
"alnum_prop": 0.6589034819792303,
"repo_name": "toddeye/home-assistant",
"id": "e419488beccbfbcf01036f573e73ee46f012a273",
"size... |
import os
import shutil
import tempfile
import unittest
import mock
from cli_tools.pinboard import pinboard
from core.external_modules import pandas as pd
def StateItem(revision, **kwargs):
item = {'revision': revision,
'timestamp': kwargs.pop('timestamp', '2019-03-15'),
'jobs': []}
with_bot... | {
"content_hash": "0782d585267ee4a0695e63434ed5b38f",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 80,
"avg_line_length": 39.52173913043478,
"alnum_prop": 0.6471790036146472,
"repo_name": "endlessm/chromium-browser",
"id": "65481e48933f5ff57488f607276bab5902836049",
"si... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "user_tags.tests.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "ff75b0f94cb2007af21cb000ed18ec70",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 79,
"avg_line_length": 26.22222222222222,
"alnum_prop": 0.711864406779661,
"repo_name": "bitmazk/django-user-tags",
"id": "e3ac378eef38ef58b8fd7de70798c09700f4a896",
"size":... |
"""The Sonarr component."""
from __future__ import annotations
from datetime import timedelta
from sonarr import Sonarr, SonarrAccessRestricted, SonarrError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_API_KEY,
CONF_HOST,
CONF_PORT,
CONF_SSL,
CONF_VE... | {
"content_hash": "52f2e51bf5c26ee5d09e77e3e8879a10",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 82,
"avg_line_length": 28.944444444444443,
"alnum_prop": 0.6760076775431861,
"repo_name": "aronsky/home-assistant",
"id": "b2cc13abc37faf80cb51cdc8ea94984f01958f04",
"size"... |
"""Image v1 API Library Tests"""
from requests_mock.contrib import fixture
from keystoneclient import session
from openstackclient.api import image_v1
from openstackclient.tests import utils
FAKE_PROJECT = 'xyzpdq'
FAKE_URL = 'http://gopher.com'
class TestImageAPIv1(utils.TestCase):
def setUp(self):
... | {
"content_hash": "bb0ec6acf036d2fe3c7d7a9588428c41",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 67,
"avg_line_length": 25.729411764705883,
"alnum_prop": 0.5486968449931413,
"repo_name": "sjsucohort6/openstack",
"id": "34fcfca4436e3b39f80162ff7ee3c6ab0f5e7fd7",
"size":... |
from setuptools import setup, find_packages
setup(
name='django-misc-base',
version='1.1.1',
description='Base miscellaneous packages for django.',
long_description=open('README.md').read(),
author='BlackWizard',
author_email='BlackWizard@mail.ru',
url='http://github.com/BlackWizard/django-... | {
"content_hash": "f427e2ac9f30def4f936bb7313228b2f",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 58,
"avg_line_length": 30.214285714285715,
"alnum_prop": 0.6205673758865248,
"repo_name": "BlackWizard/django-misc-base",
"id": "ddf7b9342907179df13feabeea97658e16975ede",
... |
"""A simple handler to serve static assets."""
import logging
import mimetypes
import os
import os.path
import threading
import google
import webapp2
ASSETS_PATH = os.path.join(os.path.dirname(__file__), 'assets')
class StaticFileHandler(webapp2.RequestHandler):
"""A request handler for returning static files.... | {
"content_hash": "235be8574fd360b7abbb9a4ad4f3ed4e",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 80,
"avg_line_length": 28.34426229508197,
"alnum_prop": 0.6500867553499132,
"repo_name": "ychen820/microblog",
"id": "0d25b2f65e484fe64d2886a202c2a4eff8967a9e",
"size": "23... |
import decimal
import numpy as np
import pandas as pd
import pytest
import ibis
import ibis.common.exceptions as com
import ibis.util as util
from ibis import literal as L
@pytest.mark.parametrize(
('expr', 'expected'),
[
(ibis.NA.fillna(5), 5),
(L(5).fillna(10), 5),
(L(5).nullif(5),... | {
"content_hash": "112f49477da4ebbca836e36323bb234b",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 79,
"avg_line_length": 30.785074626865672,
"alnum_prop": 0.6125278774362455,
"repo_name": "cloudera/ibis",
"id": "901ac4fd2613b71aa5ace25c6330f56e65af0d15",
"size": "10313... |
"""
reader
======
A minimal feed reader.
Usage
-----
Here is small example of using reader.
Create a Reader object::
reader = make_reader('db.sqlite')
Add a feed::
reader.add_feed('http://www.hellointernet.fm/podcast?format=rss')
Update all the feeds::
reader.update_feeds()
Get all the entries, bo... | {
"content_hash": "d37d1342664d81d82f270b46eb75652d",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 69,
"avg_line_length": 15.796875,
"alnum_prop": 0.6775469831849654,
"repo_name": "kushalbhola/MyStuff",
"id": "0d1004df588bf15c122a18065963fe2b1e30ad29",
"size": "1011",
... |
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
setup(
name = "django-sort",
version = "0.1",
packages = ["sorting"],
py_modules = ['setup', 'ez_setup'],
author = "Agiliq and friends",
author_email ="shabda@agiliq.com",
description = "Sort arbitrary que... | {
"content_hash": "4b8c790f4a93d8008db9dabce592f7f7",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 59,
"avg_line_length": 30.714285714285715,
"alnum_prop": 0.6581395348837209,
"repo_name": "agiliq/django-sorting",
"id": "7f79e9825f772eabb756e0a700168dd9a2f5a78b",
"size":... |
import numpy as np
from PIL import Image
from wordcloud import WordCloud
def _load_mask(mask_fname):
return np.asarray(Image.open(mask_fname))
def generate_wordcloud(text, bgcolor, width, height, max_words, mask):
if mask is not None:
mask = _load_mask(mask)
wc = WordCloud(relative_scaling=.5, w... | {
"content_hash": "b152a3fde779c144bdde132c5f20a8d0",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 70,
"avg_line_length": 30.125,
"alnum_prop": 0.6680497925311203,
"repo_name": "neocortex/wcloud",
"id": "585aab0a54bf984cc6091be7cade380fc7573e1c",
"size": "506",
"binary... |
import time
import unittest
import node
LEADER = 1
ROUTER1 = 2
ED = 3
class Cert_6_2_1_NewPartition(unittest.TestCase):
def setUp(self):
self.nodes = {}
for i in range(1,4):
self.nodes[i] = node.Node(i)
self.nodes[LEADER].set_panid(0xface)
self.nodes[LEADER].set_mode(... | {
"content_hash": "9f02fae990c6b3fb248095ba67895e16",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 74,
"avg_line_length": 30.934426229508198,
"alnum_prop": 0.6104928457869634,
"repo_name": "JakubBrachTieto/openthread",
"id": "fac073dc4e8ba051de645bcc0a95a0afd5b2df99",
"s... |
"""
Copyright (c) 2016 - Sean Bailey - All Rights Reserved
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... | {
"content_hash": "9e3049fb80ae18f389a223f4efb1a772",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 96,
"avg_line_length": 35.6,
"alnum_prop": 0.6947565543071161,
"repo_name": "LuckehPickle/Comet",
"id": "bbac7647701cddedc3042774422af4056073acd9",
"size": "1068",
"binar... |
"""
Run regression on apartment data.
"""
from __future__ import print_function
import argparse
import pandas as pd
import numpy as np
import itertools
import matplotlib.pyplot as plt
def parse_args(*argument_array):
parser = argparse.ArgumentParser()
parser.add_argument('--csv',
help=... | {
"content_hash": "aeda3fa59b17ab7c765822d46a38eb93",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 82,
"avg_line_length": 28.48421052631579,
"alnum_prop": 0.647450110864745,
"repo_name": "mamikonyana/mamikonyana.github.io",
"id": "fa74512c5fdb15135161cd0243d22110211f530e",... |
"""Allows the creation of a sensor that breaks out state_attributes."""
import logging
from typing import Optional
import voluptuous as vol
from homeassistant.components.sensor import (
DEVICE_CLASSES_SCHEMA,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
AT... | {
"content_hash": "ad254a2d69a3f4f02c01b359ad78bcd4",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 86,
"avg_line_length": 33.4280701754386,
"alnum_prop": 0.5847591056995907,
"repo_name": "postlund/home-assistant",
"id": "0ca5571515a573bb6c1df393a0a49861d434ffcb",
"size"... |
from oslo_log import log as logging
from sqlalchemy import MetaData, Table, Index
from sqlalchemy.engine import reflection
from nova.i18n import _LI
LOG = logging.getLogger(__name__)
INDEX_COLUMNS_1 = ['project_id']
INDEX_NAME_1 = 'instances_project_id_idx'
INDEX_COLUMNS_2 = ['updated_at', 'project_id']
INDEX_NAME_... | {
"content_hash": "b22e02f98cf2d1fb96dce54b213cffdd",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 78,
"avg_line_length": 33.71739130434783,
"alnum_prop": 0.6595744680851063,
"repo_name": "hanlind/nova",
"id": "b87fcf6984855cf5f79223ac0955edc756ed2bd2",
"size": "2124",
... |
class TaobaoPipeline(object):
def process_item(self, item, spider):
return item
| {
"content_hash": "cf1b2b7ba2f6535db848f7a05872a8e0",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.6847826086956522,
"repo_name": "leopard7777777/taobao_deal_history",
"id": "ec6b09b74d3b646298c4b4c12130e4b55af0e870... |
"""MySQLdb - A DB API v2.0 compatible interface to MySQL.
This package is a wrapper around _mysql, which mostly implements the
MySQL C API.
connect() -- connects to server
See the C API specification and the MySQL documentation for more info
on other items.
For information on how MySQLdb handles type conversion, se... | {
"content_hash": "c7faeac21f64ae9bb1ac415ed0a0daec",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 78,
"avg_line_length": 31.96938775510204,
"alnum_prop": 0.6769869135014364,
"repo_name": "isabernardes/Heriga",
"id": "fc41481001dbab3b46acda7ef5170a84461ca612",
"size": "3... |
from app.api import api
from flask import abort, jsonify
from flask.ext.cors import cross_origin
from urllib.parse import unquote
# Models
from app.models.writer import Writer
@cross_origin()
@api.route('/writers', methods=['GET'])
def get_writer_names():
"""
Return all writer names existing in the database
... | {
"content_hash": "f72a076299c14f66edb6a652d691f5de",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 70,
"avg_line_length": 27.526881720430108,
"alnum_prop": 0.66875,
"repo_name": "boltzj/movies-in-sf",
"id": "c72bbef26b3b7e9d0e038cea60d0bb0e5b3186ff",
"size": "2567",
"b... |
'''
Copyright 2017 Fabio Lima and Filipe CN
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distr... | {
"content_hash": "22a187e7a13e671a1e85d8ceeb0b59cc",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 79,
"avg_line_length": 38.1219512195122,
"alnum_prop": 0.7370441458733206,
"repo_name": "limafabio/lazycf",
"id": "1a32bb728a0abdce6357666129a1a181284d3a20",
"size": "1577"... |
import tool_utils as tu
from PyQt4.QtGui import *
from PyQt4.QtCore import *
#class EmptyState(tu.StateBase):
#def __getstate__(self):
# state = tu.StateBase.__getstate__(self)
# my_state = [self.temporary]
# return {'parent_state': state, 'self': my_state}
#def __setstate__(self, state... | {
"content_hash": "daae0da7a18c20598f6bbb51baad6d07",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 179,
"avg_line_length": 33.564516129032256,
"alnum_prop": 0.6160499759730899,
"repo_name": "gt-ros-pkg/rcommander-core",
"id": "7b9b33302b76b8041311b30ee0eb2018a2d9c295",
"... |
__author__ = 'pascal'
import mysql.connector
from datetime import datetime
import json
class LSFEventDBAccess:
def __init__(self):
credentials = json.load(open('db_credentials_MYSQL.json', 'r'))
self.cnx = mysql.connector.connect(**credentials)
def add_events(self, events):
cursor = ... | {
"content_hash": "6ffa474b7c60e3cd03901660f6b94918",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 190,
"avg_line_length": 35.95890410958904,
"alnum_prop": 0.5318095238095238,
"repo_name": "pascalweiss/LSFEventScraper",
"id": "e25814903f09db486c9135f4c5dc60af1ed8fd16",
"... |
"""The WaveBlocks Project
This file contains a simple factory method for Grid instances.
The exact subtype of the instance is read from the description.
@author: R. Bourquin
@copyright: Copyright (C) 2012 R. Bourquin
@license: Modified BSD License
"""
def create_grid(description):
"""The method that creates a :... | {
"content_hash": "c662cc7a2db21e2e0d7f58dae0478fa7",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 96,
"avg_line_length": 32.6764705882353,
"alnum_prop": 0.6642664266426642,
"repo_name": "WaveBlocks/WaveBlocksND",
"id": "3972e0e08f7b37e94f28f4fff557d675edf9d452",
"size":... |
from pprint import pprint
from hpOneView.oneview_client import OneViewClient
from hpOneView.exceptions import HPOneViewException
from config_loader import try_load_from_file
# You can use username/password or sessionID for authentication.
# Be sure to inform a valid and active sessionID.
config = {
"ip": "<oneview... | {
"content_hash": "35aba52d8007a90c42fa5a9b5201a5e7",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 89,
"avg_line_length": 29.45762711864407,
"alnum_prop": 0.7266973532796318,
"repo_name": "HewlettPackard/python-hpOneView",
"id": "a95f5957bfbd94c0540b2eea63d6c67890d83563",
... |
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
import datetime
from django.db.models.aggregates import Count
from south.db import db
from south.v2 import DataMigration
from django.db import mod... | {
"content_hash": "654ecb63fdd4dd97418922f2882e427b",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 255,
"avg_line_length": 78.10795454545455,
"alnum_prop": 0.5418636793482214,
"repo_name": "acamposruiz/quecoins",
"id": "f786cc1cfefa50f6c7aa071283b8403aac69c13c",
"size":... |
from django.contrib.syndication.views import Feed
from django.urls import reverse
from django.utils.feedgenerator import Atom1Feed
from django.utils.translation import ugettext_lazy as _
from pybb.models import Post, Topic
class PybbFeed(Feed):
feed_type = Atom1Feed
def link(self):
return reverse('p... | {
"content_hash": "06c3843d669c2c5d99a0d94c80f4fa25",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 95,
"avg_line_length": 30.73170731707317,
"alnum_prop": 0.6603174603174603,
"repo_name": "thoas/pybbm",
"id": "ac87bd8854436323d858d0473f7de75595f4eef5",
"size": "1285",
... |
import matplotlib.pyplot as plt
class Logger(object):
def __init__(self,num_channels):
self.num_channels = num_channels
self.data = [[] for i in range(num_channels)]
def _subplot(self,chan_num):
res = self.num_channels * 100
res = res + 10 # one column only
res = res + c... | {
"content_hash": "e1f79b54adccc58d8895f4462cbc35b3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 53,
"avg_line_length": 29.2,
"alnum_prop": 0.589041095890411,
"repo_name": "travistang/late_fyt",
"id": "2100a861711db515ef8560a05f1bebb9594c3475",
"size": "438",
"binary... |
"""Treadmill vring manager."""
from __future__ import absolute_import
import signal
import sys
import logging
import yaml
import click
from .. import context
from .. import discovery
from .. import logcontext as lc
from .. import utils
from .. import vring
from .. import zkutils
_LOGGER = logging.getLogger(__name... | {
"content_hash": "2572e2d8e235d219e90177e077e63db5",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 77,
"avg_line_length": 33.32608695652174,
"alnum_prop": 0.5172863666014351,
"repo_name": "toenuff/treadmill",
"id": "11b59e3148589655a218d259137d1fdc82c243fc",
"size": "306... |
"""State management for eager execution."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
import copy
import os
import random
import threading
from absl import logging
import numpy as np
import six
from tensorflow.co... | {
"content_hash": "312579646406a764c11a301831b2d25b",
"timestamp": "",
"source": "github",
"line_count": 2435,
"max_line_length": 89,
"avg_line_length": 33.91129363449692,
"alnum_prop": 0.6876498655751205,
"repo_name": "freedomtan/tensorflow",
"id": "046a09f96382bf0f147ed561d116e5169edf5b0c",
"size"... |
"""URLs for the ``calendarium`` app."""
from django.conf.urls import url
from . import views
urlpatterns = [
# event views
url(r'^event/create/$',
views.EventCreateView.as_view(),
name='calendar_event_create'),
url(r'^event/(?P<pk>\d+)/$',
views.EventDetailView.as_view(),
... | {
"content_hash": "5591f0754486a8867b63adb3e21e59a5",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 96,
"avg_line_length": 29.098360655737704,
"alnum_prop": 0.5526760563380282,
"repo_name": "jimga150/HealthNet",
"id": "075dfe00884dffcec2359cec7b75eb10951a5b68",
"size": "1... |
import pickle
import greentest
from gevent.ares import ares_host_result
class TestPickle(greentest.TestCase):
# Issue 104: ares.ares_host_result unpickleable
def _test(self, protocol):
r = ares_host_result('family', ('arg1', 'arg2', ))
dumped = pickle.dumps(r, protocol)
loaded = pickl... | {
"content_hash": "49b1b507e80d4eb5e800d075f6605253",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 68,
"avg_line_length": 24.484848484848484,
"alnum_prop": 0.6039603960396039,
"repo_name": "ubuntuvim/GoAgent",
"id": "1881dd0e6574bc142c837c27bfc9d9ae67a9bca6",
"size": "80... |
"""This example adds various types of targeting criteria to a given campaign.
To get campaigns, run get_campaigns.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authent... | {
"content_hash": "bff03aef38bb340f01490ed36c477f4c",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 31.815068493150687,
"alnum_prop": 0.5939720129171152,
"repo_name": "richardfergie/googleads-python-lib",
"id": "16db54a21c3c96a5bd7745e4740392b57373b0... |
import datetime
from flask import Blueprint
from flask.ext.login import LoginManager
from flask import Flask
# from compass.api.v1.api import v1_app
from compass.utils import setting_wrapper as setting
from compass.utils import util
app = Flask(__name__)
app.debug = True
# blueprint = Blueprint('v2_app', __name__)
#... | {
"content_hash": "f1a9ef9e89ffb6c5f862944ecd103c36",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 69,
"avg_line_length": 27.357142857142858,
"alnum_prop": 0.737597911227154,
"repo_name": "baigk/compass-core",
"id": "784fe231cbe3cdc4d3bef4d7dec0e10509c2b7d9",
"size": "13... |
"""
WSGI config for depotexample project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "depotexample.settings")
from dj... | {
"content_hash": "da6018d4979eddbd03a17cc2faa2428e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 32.54545454545455,
"alnum_prop": 0.7946927374301676,
"repo_name": "amol-/depot",
"id": "68d77d03bb2ac994f6af71bc2511461ddbef1f67",
"size": "716",
"... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: tower_job_list
author: "Wayne Witzel III (@wwitzel3)"
short... | {
"content_hash": "7afcaeb0ce00de55a102f6e7f79cb27f",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 112,
"avg_line_length": 28.783333333333335,
"alnum_prop": 0.6137811233352635,
"repo_name": "GoogleCloudPlatform/sap-deployment-automation",
"id": "642a48b03b15cedcc067cc85a9... |
"""
Combinations from multiple sequences
Source: ASPN: Python Cookbook
Title: Generating combinations of objects from multiple sequences
Submitter: David Klaffenbach (other recipes)
Last Updated: 2004/08/29
Version no: 1.0
Category: Algorithms
Description:
The function combine takes multiple sequences and creates a ... | {
"content_hash": "1b6407fdf41ff5f1d193d9d8b94abc0b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 78,
"avg_line_length": 44.51851851851852,
"alnum_prop": 0.620216306156406,
"repo_name": "rothadamg/UPSITE",
"id": "feea9eba87c1d64c41ede8a1a7dd7f0a684a93ab",
"size": "2404"... |
"""The AES decrypter object implementation."""
from Crypto.Cipher import AES
from dfvfs.encryption import decrypter
from dfvfs.encryption import manager
from dfvfs.lib import definitions
class AESDecrypter(decrypter.Decrypter):
"""Class that implements a AES decrypter using pycrypto."""
ENCRYPTION_METHOD = def... | {
"content_hash": "a3c187ad427d7a9f478e36764b99798c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 33.12,
"alnum_prop": 0.6952495974235104,
"repo_name": "dc3-plaso/dfvfs",
"id": "bea363c02c378943d5f1b7b05a783b4786242746",
"size": "2508",
"binary"... |
import re
import textwrap
from flowui.widget import Widget
class Table(Widget):
'''Table widget
The table is a widget for structured data presentation. It is very similar
to the table widget of HTML or as used by many spreadsheet tools. A table
can consist of rows and or cells that are laid out in a... | {
"content_hash": "797105f4aa9073fbc93f0a8ad009106b",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 79,
"avg_line_length": 36.09540636042403,
"alnum_prop": 0.5211943220753793,
"repo_name": "dholm/FlowUI",
"id": "a7b76c4039680062aa16486eb6ea3dd701625fcc",
"size": "11804",... |
from __future__ import unicode_literals
import django.contrib.auth.models
import django.core.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0007_alter_validators_add_error_messages'),
... | {
"content_hash": "003a807b994143a46a6347ab20847831",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 421,
"avg_line_length": 66.97727272727273,
"alnum_prop": 0.6426874787919918,
"repo_name": "whitesmith/hawkpost",
"id": "752d31c0354ff2d0a45d6e9dffca024d96b695ac",
"size": "... |
from __future__ import unicode_literals
from django import http
from django.conf import settings
from django.contrib import messages
from django.core import exceptions
from daydreamer.core import urlresolvers
from . import base
__all__ = ("Denial",)
class Denial(base.Deny):
"""
An abstract base class pro... | {
"content_hash": "641fcef9490955e3864b6e527f8b0844",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 79,
"avg_line_length": 38.36466165413534,
"alnum_prop": 0.6295933365997061,
"repo_name": "skibblenybbles/django-daydreamer",
"id": "edff76611e339f6966470fedcd194e3277fc1a75"... |
from flask import Flask, request, jsonify, render_template, copy_current_request_context
from flask.ext.socketio import SocketIO, emit, session
import gevent
from lib import create_monitor
import os
app = Flask(__name__)
app.config['DEBUG'] = True
socketio = SocketIO(app)
monitor = create_monitor(os.environ["MONITOR_AD... | {
"content_hash": "b11fa602ee3282e489cd6ddb70a799ae",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 88,
"avg_line_length": 26.46875,
"alnum_prop": 0.7083825265643447,
"repo_name": "UFAL-DSG/cloud-asr",
"id": "f35b30e662bd64944f0265a1db70f72bf2aeca71",
"size": "847",
"bi... |
import unittest, random, sys, time
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_import as h2i, h2o_exec, h2o_glm, h2o_gbm, h2o_exec as h2e
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
global lo... | {
"content_hash": "c85a0279b03e137d0cecc2d08f79512c",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 135,
"avg_line_length": 38.256198347107436,
"alnum_prop": 0.5154461006696911,
"repo_name": "woobe/h2o",
"id": "3320cce54b64f0977ab0d787d8ed287e7b4d78e0",
"size": "4629",
... |
import struct
from sys import argv
from msc import *
from param import *
from time import sleep
from random import randint,random
from os.path import isfile
from argparse import ArgumentParser
from math import sqrt, cos, sin, atan2
class FunctionInfo:
def __init__(self, thisLocalVarPos, returnAddress, stackPos):
... | {
"content_hash": "7a718bc3db9519f517e0b30cab485968",
"timestamp": "",
"source": "github",
"line_count": 585,
"max_line_length": 935,
"avg_line_length": 40.24273504273504,
"alnum_prop": 0.5827032537592388,
"repo_name": "jam1garner/pymsc",
"id": "669b82fe6917e745cfaa0da2b315f64a826fee5b",
"size": "23... |
"""カスタムレイヤー。"""
# pylint: skip-file
# flake8: noqa
from .activations import *
from .attentions import *
from .blocks import *
from .convolutional import *
from .endpoint import *
from .misc import *
from .noise import *
from .normalization import *
from .pooling import *
| {
"content_hash": "11ceb89061296d971a46eecc972bc77d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 28,
"avg_line_length": 21,
"alnum_prop": 0.7289377289377289,
"repo_name": "ak110/pytoolkit",
"id": "ae22863ca61561f151e97dfe6419b3b244cfb1cd",
"size": "291",
"binary": fa... |
import os
import random
import shutil
from datapipe.io import images
NUM_IMAGES = 1000
INPUT_DIR_PATH = os.path.expanduser("~/data/astri_mini_array_konrad/fits/astri_v2/gamma/")
OUTPUT_FILE_PATH = "/dev/shm/.jd/astri_konrad/gamma"
NPE_MIN = 30
NPE_MAX = 2000
# TODO: filter contained images -> pb: la meth doit et... | {
"content_hash": "0816e2bbca1df17fd2beb10ec5de25a1",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 95,
"avg_line_length": 27.821428571428573,
"alnum_prop": 0.6251604621309371,
"repo_name": "jdhp-sap/data-pipeline-standalone-scripts",
"id": "148a60e4d1ef259609ae313f4d2050f5... |
import os.path
import sys
sys.path.append(os.path.abspath('../../'))
from FileSystem import FileSystem
from src.util.OctaveAST import OctaveAST
from termcolor import colored
class Printer(object):
@staticmethod
def highlightNode(octave, nodeId):
ast = OctaveAST(octave)
(startLine, startCol, endLine... | {
"content_hash": "d1ffaf437ac403f83eff482942d135e8",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 68,
"avg_line_length": 30.324324324324323,
"alnum_prop": 0.5686274509803921,
"repo_name": "tanonev/codewebs",
"id": "d6a2727267b04203c890cb54b07bcd860082ebcf",
"size": "112... |
"""Test cases for mupub.commands.check
"""
import os
from unittest import TestCase
from .tutils import PREFIX
import mupub
TEST_DATA = 'data'
class CheckTest(TestCase):
def test_basic_check(self):
"""Basic check command"""
basic = os.path.join(os.path.dirname(__file__),
... | {
"content_hash": "0e4a48da76bfa4275d462f4c9acffd9a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 63,
"avg_line_length": 26.875,
"alnum_prop": 0.5937984496124031,
"repo_name": "MutopiaProject/mupub",
"id": "737e6bd6fbc91a56b4ec191a9190f43e38e2559a",
"size": "645",
"bi... |
"""
StormSpans brings support for PostgreSQL's range types to Canonical's Storm
using PsycoSpans paired with Spans.
from spans import intrange
from storm.locals import *
from stormspans import IntRange
class Model(Storm):
id = Int(primary=True)
span = IntRange(default=intrange(1, 10))
... | {
"content_hash": "b638d43e179f63f99b913bc6d5233440",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 78,
"avg_line_length": 22.90625,
"alnum_prop": 0.694406548431105,
"repo_name": "runfalk/stormspans",
"id": "20b7ff486d38f4adad0920b32fce25e8c553c64f",
"size": "733",
"bin... |
import numpy as np
def estimate_slope(x, y):
poly_coeff = np.polyfit(np.log(x), np.log(y), 1)
return poly_coeff[0]
def is_strictly_decreasing(vector):
differences = np.diff(vector)
return np.all(differences < 0)
def errors_within_relative_tolerance(actual, expected, tolerance=1e-6):
actual = n... | {
"content_hash": "e9e727ec05eba3a150f7163a04d95f4a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 71,
"avg_line_length": 23.727272727272727,
"alnum_prop": 0.6743295019157088,
"repo_name": "Andlon/crest",
"id": "c84705cb238a08d8408f059f1010f9daa57ef61e",
"size": "522",
... |
from kubernetes_py.models.v1.AWSElasticBlockStoreVolumeSource import AWSElasticBlockStoreVolumeSource
from kubernetes_py.models.v1.EmptyDirVolumeSource import EmptyDirVolumeSource
from kubernetes_py.models.v1.GCEPersistentDiskVolumeSource import GCEPersistentDiskVolumeSource
from kubernetes_py.models.v1.GitRepoVolumeSo... | {
"content_hash": "f06b2318aab83ba05273fa15439c504e",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 113,
"avg_line_length": 38.15481171548117,
"alnum_prop": 0.5801074679241145,
"repo_name": "sebastienc/kubernetes-py",
"id": "a26fba3a75d48d64f28202a5b16a241a7ca6427a",
"si... |
import os
import pandas as pd
from zipfile import ZipFile
from sklearn.preprocessing import LabelEncoder
from ..contrib.category_encoder import CategoryEncoder
class DataSetLoader(object):
"""
Provides a number of pre-staged data sets to load into memory.
"""
def __init__(self):
pass
@sta... | {
"content_hash": "10a93a76f6267d7a7f55b91a67da0cb5",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 90,
"avg_line_length": 29.58695652173913,
"alnum_prop": 0.5464731814842028,
"repo_name": "jdwittenauer/ionyx",
"id": "244383e5b0178ae6ede9120bb81fb26136247d8e",
"size": "5... |
import os
import setuptools
from pok.version import get_version, read_requirements
readme = open('README.md').read()
dependencies, requirements = read_requirements('requirements.txt')
long_description = """
pok %s
Configuration should be easy.
To install use pip install git+git://git@github.com:iPlantCollaborativeOp... | {
"content_hash": "746245927734773132df16b3fa00540a",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 89,
"avg_line_length": 29.31111111111111,
"alnum_prop": 0.6823351023502654,
"repo_name": "iPlantCollaborativeOpenSource/pok",
"id": "0ab8f13103f69295063ebd7e637d9c3415221d8a"... |
"""Make node instance's version column not nullable
Revision ID: f1dab814a4a0
Revises: 7aae863786af
Create Date: 2017-10-08 12:59:58.047124
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f1dab814a4a0'
down_revision = '7aae863786af'
branch_labels = None
depend... | {
"content_hash": "299943223811c37de1ce8d20d3901279",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 51,
"avg_line_length": 22.607142857142858,
"alnum_prop": 0.6492890995260664,
"repo_name": "cloudify-cosmo/cloudify-manager",
"id": "de6c9a780563b5bc9598c0867a7f042dcd15b6f3",... |
"""Worker machine web server."""
import argparse
import BaseHTTPServer
import collections
import json
import logging
import os
import re
import SocketServer
import subprocess
import sys
import traceback
import urllib
import urlparse
import worker
_CHOICE_START = 'start'
_CHOICES = [
_CHOICE_START
]
_CLIENT_JS_PA... | {
"content_hash": "6a38db7949202898fac55ce9ba38462c",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 80,
"avg_line_length": 32.18245614035088,
"alnum_prop": 0.6250545137374618,
"repo_name": "google/coursebuilder-android-container-module",
"id": "47dca4a540870daf2f20d5519864... |
"""
Support for Loop Energy sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.loop_energy/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
fro... | {
"content_hash": "fce000391208aaa51a32eb6b4e1290fc",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 78,
"avg_line_length": 28.276315789473685,
"alnum_prop": 0.6675197766402978,
"repo_name": "Duoxilian/home-assistant",
"id": "06d1fd954f2abf360ec3b321e4a44748586fb727",
"si... |
import gym
import readchar
LEFT = 0
DOWN = 1
RIGHT = 2
UP = 3
arrow_keys = {'\x1b[A': UP, '\x1b[B': DOWN, '\x1b[C' : RIGHT, '\x1b[D' : LEFT}
env = gym.make("FrozenLake-v0")
env.reset()
env.render()
while True:
key = readchar.readkey()
if key not in arrow_keys.keys():
print("Game aborted!")
b... | {
"content_hash": "9b2c64ca6abde8a5c3fee72f4c5036e5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 83,
"avg_line_length": 20.642857142857142,
"alnum_prop": 0.5847750865051903,
"repo_name": "zzsza/TIL",
"id": "c6bca66a644016e24eba63867ed889b472d8e748",
"size": "578",
"b... |
from flask import Flask, make_response
from pulsar.apps import wsgi
def FlaskApp():
app = Flask(__name__)
@app.errorhandler(404)
def not_found(e):
return make_response("404 Page", 404)
@app.route('/', methods=['GET'])
def add_org():
return "Flask Example"
return app
class... | {
"content_hash": "14bdaf6caa229513d49d4e69ddb5d1a3",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 67,
"avg_line_length": 20.454545454545453,
"alnum_prop": 0.5896296296296296,
"repo_name": "nooperpudd/pulsar",
"id": "f04446a933965d86c673c2516d1f944127484836",
"size": "67... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.