text stringlengths 4 1.02M | meta dict |
|---|---|
"""Support for Goal Zero Yeti Sensors."""
from __future__ import annotations
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import... | {
"content_hash": "883a3daa09929b02776494b353443131",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 84,
"avg_line_length": 30.884393063583815,
"alnum_prop": 0.6500093580385551,
"repo_name": "sander76/home-assistant",
"id": "957891e67ed9699c88fb88ac59543ed7feb73df0",
"siz... |
"""
SQLAlchemy models for nova data.
"""
from oslo.config import cfg
from oslo.db.sqlalchemy import models
from sqlalchemy import Column, Index, Integer, BigInteger, Enum, String, schema
from sqlalchemy.dialects.mysql import MEDIUMTEXT
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import orm
... | {
"content_hash": "7c8f2a16075e39cfcbf04a1df683475c",
"timestamp": "",
"source": "github",
"line_count": 1400,
"max_line_length": 79,
"avg_line_length": 36.97071428571429,
"alnum_prop": 0.6212059738402983,
"repo_name": "sajeeshcs/nested_quota",
"id": "7d14a443a69dd7821f29c1e45fac563668edb702",
"size... |
import os
import urwid
from twython.twython import Twython, TwythonError
import command
from messages import messages as _
command_handler = None
class EditHandler(urwid.Edit):
def keypress(self, size, key):
if key == 'enter':
data = self._edit_text.split(None, 1)
if len(data) ... | {
"content_hash": "d502673d48f737908b40be39b3f3ec8a",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 76,
"avg_line_length": 31.932773109243698,
"alnum_prop": 0.5371052631578948,
"repo_name": "xintron/twiclr",
"id": "b9bc2d7c7a9eef395771f3e8820170ac74dd820d",
"size": "5380... |
import base64
import cgi
import hashlib
import hmac
import md5
import os
import re
import sys
import time
import traceback
import types
from ZSI.dispatch import _CGISendXML, _CGISendFault
from ZSI import Fault
from tashi.aws.wsdl.AmazonEC2_services_server import *
from tashi.aws.impl import address, bundle, images, in... | {
"content_hash": "a4d6c63c54a032b274c93a7ae4a7a0ab",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 124,
"avg_line_length": 29.6231884057971,
"alnum_prop": 0.684931506849315,
"repo_name": "stroucki/tashi",
"id": "1cea92dbcd2e68e97b5a5288f78d6a7d94d271de",
"size": "2859",
... |
from collections import OrderedDict
from django.contrib import admin
from django.conf.urls import patterns
from django.shortcuts import render_to_response
class ParticipantAdmin(admin.ModelAdmin):
def link(self, instance):
url = instance.start_url()
return '<a href="{}" target="_blank">{}</a>'.fo... | {
"content_hash": "fee4ef81055c84340f731b9af7692623",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 124,
"avg_line_length": 42.728971962616825,
"alnum_prop": 0.6843832020997376,
"repo_name": "pombredanne/django-ptree",
"id": "0a1a6c0ea93e6ade39b320a4ec8fc65f44f2c739",
"s... |
import os
import re
import bz2
import glob
import json
import jieba
import logging
import argparse
import coloredlogs
import cPickle as pickle
from collections import defaultdict
SYM = re.compile(ur'[^\u4e00-\u9fa5]+')
coloredlogs.install()
class Indexer(object):
"""Indexer index questions and persist them for... | {
"content_hash": "85cb4c6aca22f58e41e686372a9573ba",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 88,
"avg_line_length": 29.057471264367816,
"alnum_prop": 0.59375,
"repo_name": "shanzi/thesiscode",
"id": "8894873dfdb110db3186aab365a44dfabb13864b",
"size": "2575",
"bin... |
"""
Django Reformation
(c) 2013 Curtis Maloney, Danielle Madeley
See LICENSE.
"""
from django.forms import BaseForm
class ReformerMixin(BaseForm):
"""
"""
| {
"content_hash": "d26c501567d3bcbc3dbfd97005ef062d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 42,
"avg_line_length": 12.923076923076923,
"alnum_prop": 0.6845238095238095,
"repo_name": "funkybob/django-reformation",
"id": "ae956dda9dd29d2a60c7f1f64e2519118779a2c0",
"... |
from django import template
import datetime
register = template.Library()
def dayssince(value):
"Returns number of days between today and value."
today = datetime.date.today()
diff = today - value
if diff.days > 1:
return '%s days ago' % diff.days
elif diff.days == 1:
return 'yest... | {
"content_hash": "453b725ad286c5f7c3691b64f541c780",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 55,
"avg_line_length": 26.2,
"alnum_prop": 0.6335877862595419,
"repo_name": "issackelly/cohpy2011",
"id": "b976744800b12912f31a2ba0c52a57a51e8d6285",
"size": "524",
"bina... |
from datetime import datetime
from django.db import models
from django.core.urlresolvers import reverse
from sorl.thumbnail import ImageField, get_thumbnail
from sorl.thumbnail.helpers import ThumbnailError
class Author(models.Model):
name = models.CharField(max_length=200)
short_bio = models.TextField(max_... | {
"content_hash": "e6d7592ed57e537338cd0039d61770da",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 71,
"avg_line_length": 31.365591397849464,
"alnum_prop": 0.5320534796023312,
"repo_name": "daviferreira/defprogramming",
"id": "31ad0add354e89d5a1c96fd161834bc9dde1dca9",
"... |
import math
import m5
from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
#
# Note: the L1 Cache latency is only used by the sequencer on fast path hits
#
class L1Cache(RubyCache):
latency = 3
#
# Note: the L2 Cache latency is not currently used
#
class L2Cache(RubyCache):
l... | {
"content_hash": "39ea440d1e8e3f8e22c4b63057e0e4c1",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 82,
"avg_line_length": 34.0650406504065,
"alnum_prop": 0.5300715990453461,
"repo_name": "liangwang/m5",
"id": "ca5a7aa4626d51fc1e9ae645f72e81d5cf3fbf30",
"size": "5820",
... |
"""
Copyright 2014-2016 University of Illinois
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 agreed to in writ... | {
"content_hash": "3405bb2ba54313093751831c294df26b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 72,
"avg_line_length": 27.161290322580644,
"alnum_prop": 0.7684085510688836,
"repo_name": "opena11y/fae2",
"id": "acbfdf384e629114092a0647be29f2c13c5d87b7",
"size": "842",
... |
from django.db import models
import datetime
from django.utils import timezone
# Create your models here.
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self): # Python 3: def __str__(self):
return self.questi... | {
"content_hash": "ee26af4455d8a4f77a58a844907cef96",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 76,
"avg_line_length": 41.56521739130435,
"alnum_prop": 0.6872384937238494,
"repo_name": "davidaparicio/django_officialtutorial",
"id": "399d19564110c3adf92a5c2a0f531ed9d6942... |
"""Support for deCONZ binary sensors."""
from pydeconz.sensor import Presence, Vibration
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import ATTR_BATTERY_LEVEL, ATTR_TEMPERATURE
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_... | {
"content_hash": "21aa77379c608b807cda4f42ea18e430",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 76,
"avg_line_length": 32.94845360824742,
"alnum_prop": 0.6623904881101377,
"repo_name": "jabesq/home-assistant",
"id": "6fe8b4324b3c1a40e0ae372f04d3b832df809bf8",
"size": ... |
from Hindlebook.models.validators import UuidValidator
from Hindlebook.models.server_models import Settings, Node
from Hindlebook.models.user_models import Author
from Hindlebook.models.post_models import Post, Comment, Image, Category | {
"content_hash": "357f8d0b60ed59460677ca104d4bc0c4",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 58.75,
"alnum_prop": 0.8553191489361702,
"repo_name": "Tamarabyte/cmput410-project",
"id": "ea7278721a7ff7fbe7e2c578a026d92a2e342e88",
"size": "235",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'LineItem'
db.create_table(u'billing_lineitem', (
(u'id', self.gf('django.db.models.fields.AutoField')(pr... | {
"content_hash": "26c56b40c964fd5e1f08a5f4dd1040ba",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 187,
"avg_line_length": 70.4963503649635,
"alnum_prop": 0.5580865603644647,
"repo_name": "praekelt/vumi-go",
"id": "5289f9d3a80a04fecb807c2c0feed1ac9b4042c1",
"size": "968... |
'''
Created on Jun 20, 2015
@author: Daniil Sorokin<sorokin@ukp.informatik.tu-darmstadt.de>
'''
from classfiers import *
from vector_representation import *
from scale import *
if __name__ == '__main__':
parser = argparse.ArgumentParser()
# parser.add_argument('-l', action='store_true', help = "Normalize fre... | {
"content_hash": "646a90d87c1b29bae6acafb2ba3af8ef",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 164,
"avg_line_length": 60.924528301886795,
"alnum_prop": 0.6491173737999381,
"repo_name": "daniilsorokin/Web-Mining-Exercises",
"id": "82b9341052c2670e8b121dd7d2ef0f2e04b41f... |
from django import forms
from django.core.exceptions import ValidationError
from prosodyauth import fields, authenticate
from prosodyauth.prosody.parsejid import nodeprep
from prosodyauth.models import User
from simplecaptcha import captcha
from helpers.forms import PlaceholderForm
class LoginForm(PlaceholderForm... | {
"content_hash": "ed3f5d2dfb000a1f1ae0898608366855",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 115,
"avg_line_length": 37.30379746835443,
"alnum_prop": 0.6783169324737021,
"repo_name": "Kromey/akwriters",
"id": "1db4afbe88a243a8442f368f30310d8c7990ea4a",
"size": "294... |
"""The ``foo`` subcommand."""
import click
@click.group()
def foo():
"""Manage the FOO component."""
pass
@foo.command()
def version():
"""The current FOO version."""
click.echo("Version TBD...")
| {
"content_hash": "a1924380e6d76df8708530bc4eb1a074",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 35,
"avg_line_length": 14.466666666666667,
"alnum_prop": 0.5852534562211982,
"repo_name": "jtpaasch/tabu",
"id": "bc6535d4c597f017dc38e910a29ddde274aacbdb",
"size": "242",
... |
import basepage
class NavigationBars(basepage.BasePage):
def expand_project_panel(self):
elm = self.driver.find_element_by_css_selector(
'a[data-target="#sidebar-accordion-project"]')
state = elm.get_attribute('class')
if 'collapsed' in state:
elm.click()
e... | {
"content_hash": "5d9f2c0bb5fa38749138afe1065d0371",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 72,
"avg_line_length": 34.97727272727273,
"alnum_prop": 0.6191249729261425,
"repo_name": "rcbops-qe/horizon-selenium",
"id": "19c6d146b640ef731a004eb8e881332225dcda9d",
"s... |
"""
Test displayed value of a vector variable while doing watchpoint operations
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestValueOfVectorVariableTestCase(TestBase):
mydir = Tes... | {
"content_hash": "2ed024648b05fd6279f66e01ec8d8021",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 30.872340425531913,
"alnum_prop": 0.6485182632667126,
"repo_name": "llvm-mirror/lldb",
"id": "c1b3fb9485b5692a4bab169bcced73e171001e72",
"size": "145... |
"""
The base Command class.
All commands in Evennia inherit from the 'Command' class in this module.
"""
from builtins import range
import re
from django.conf import settings
from evennia.locks.lockhandler import LockHandler
from evennia.utils.utils import is_iter, fill, lazy_property, make_iter
from future.utils ... | {
"content_hash": "5822ee8d950173c1e40fb0a7ede1fa1c",
"timestamp": "",
"source": "github",
"line_count": 460,
"max_line_length": 98,
"avg_line_length": 37.25869565217391,
"alnum_prop": 0.6229068207013244,
"repo_name": "whitehorse-io/encarnia",
"id": "c5d1515d83d746d4a0f81a40de6509d807b13088",
"size"... |
import datetime
import os
import sys
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.core.files.base import ContentFile
from django.utils.translation import ugettext as _
from django.utils.hashcompat import md5_constructor
from django.utils.encoding... | {
"content_hash": "826f7f9426383f7f0a97493a18c6e67b",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 99,
"avg_line_length": 36.35911602209945,
"alnum_prop": 0.5982373499468165,
"repo_name": "mliu7/django-avatar",
"id": "236f19637928ea6f56b674693fc35e04ebfbb2c7",
"size": "... |
from setuptools import setup
import os
import ticketpy
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='ticketpy',
version=ticketpy.__version__,
author=ticketpy.__author__,
author_email='git@edward.sh',
description="Python wrapper/SDK for the T... | {
"content_hash": "3c210b4b532e5fcf6c0d38ae42de2065",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 24.818181818181817,
"alnum_prop": 0.6813186813186813,
"repo_name": "arcward/ticketpy",
"id": "7da461df5c0aeabfacfb1c9697ef3a7d48bc9f3c",
"size": "546... |
from __future__ import absolute_import, unicode_literals
import json
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, render
from wagtail.utils.pagination import paginate
from wagtail.wagtailadmin.forms import SearchForm
from wagtail.wagtailadmin.modal_workflow import rend... | {
"content_hash": "3cfbde4714ac6eae3125ca77d387a588",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 117,
"avg_line_length": 34.617801047120416,
"alnum_prop": 0.6107078039927405,
"repo_name": "hamsterbacke23/wagtail",
"id": "83764dff6cf9456bae6e96784d02efe20202b2d5",
"siz... |
import os
from ctypes import *
# Taken from c/cukf.h
UKF_PRECISION_FLOAT = 0
UKF_PRECISION_DOUBLE = 1
state = None
state_error = None
innovation = None
covariance = None
parameters = None
parameters_error = None
# Internal globals, set during init
_cukf = None
_REAL_T = None
# Internal classes, wrapping cukf st... | {
"content_hash": "01589a3ff62f6080bee2d26d7e893af3",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 87,
"avg_line_length": 30.14457831325301,
"alnum_prop": 0.6317612576605383,
"repo_name": "sfwa/ukf",
"id": "0412701d3031478948082b3ac86b6e803acd3203",
"size": "8581",
"b... |
class price_validation:
# STATE will be TRUE if rule validates for arguments value otherwise FALSE
STATE = None
# It takes 3 arguments netAmount, maxPrice, and minPrice to validate procurement price
def __init__(self, netAmount, maxPrice, minPrice):
self.netAmount=netAmount
sel... | {
"content_hash": "f295f61e15d3d9fcb5f8c34274316dba",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 134,
"avg_line_length": 44.90909090909091,
"alnum_prop": 0.6568825910931174,
"repo_name": "santosh26a/Semantic-Data-Validation-using-Python",
"id": "d076c362ba148d21277df3c7e... |
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
import logging
import logging.config
#logging.config.fileConfig('logging.conf')
# logging.basicConfig(level=logging.DEBUG)
b1 = tsds.load_ozone_exogenous()
df = b1.mPastData
H = b1.mHorizon;
N = df.... | {
"content_hash": "41700fe0b84a9ef948105ce24d6e00e8",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 87,
"avg_line_length": 28.244897959183675,
"alnum_prop": 0.6828034682080925,
"repo_name": "antoinecarme/pyaf",
"id": "9c49d793d8e2eb6bacaa911b4af1fffee22610ba",
"size": "13... |
from abc import ABCMeta, abstractmethod
from pymongo.errors import DuplicateKeyError
from .config import get_config
from .util import get_default_database, sanitize, skeleton
class Sink(object):
__metaclass__ = ABCMeta
def filter(self, data, address):
return False
def handle(self, data, addres... | {
"content_hash": "e3058967af0662091223e64be76af36f",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 79,
"avg_line_length": 32.022222222222226,
"alnum_prop": 0.5537820957668286,
"repo_name": "gregbanks/mongodrums",
"id": "799cdec618dbd20c2ef2796e09431dc29415861a",
"size":... |
"""Test for the debugging wordcount example."""
from __future__ import absolute_import
import logging
import re
import tempfile
import unittest
from apache_beam.examples import wordcount_debugging
from apache_beam.testing.util import open_shards
class WordCountDebuggingTest(unittest.TestCase):
SAMPLE_TEXT = 'xx... | {
"content_hash": "c2994dd01101979092b5a3710eb56d16",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 79,
"avg_line_length": 29.25531914893617,
"alnum_prop": 0.6654545454545454,
"repo_name": "RyanSkraba/beam",
"id": "124b6802f2add255afb3c973e6de3e0c072ed623",
"size": "2160"... |
from msrest.service_client import ServiceClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.dictionary_operations import DictionaryOperations
from . import models
class AutoRestSwaggerBATdictionaryServiceConfiguration(Configuration):
"""Configuration fo... | {
"content_hash": "d68da260928c08c1edf8a4474b135734",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 98,
"avg_line_length": 34.86538461538461,
"alnum_prop": 0.7231108659680088,
"repo_name": "fhoring/autorest",
"id": "26d72d68088730ee0f414e7c3bd671c573f91f4f",
"size": "2287... |
"""Routine for decoding the CIFAR-10 binary file format."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
# Process images of this size. Note that this d... | {
"content_hash": "a7627e8ed2a045ba18eb95e1e711b0e4",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 78,
"avg_line_length": 38.299180327868854,
"alnum_prop": 0.6806848582129481,
"repo_name": "rossumai/keras-multi-gpu",
"id": "97690af7fe81d6106dcfdd94ea454b83536050ea",
"si... |
import os
import json
import logging
import argparse
import requests
import xmltodict
from requests.auth import HTTPBasicAuth
from requests.exceptions import ConnectionError, Timeout
LOG = logging.getLogger(__name__)
#-------------------------------------------------------------------------------
# Class 'Controlle... | {
"content_hash": "8a12e4b5e47aba2b08b7c7551e109131",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 131,
"avg_line_length": 39.059479553903344,
"alnum_prop": 0.5495384029694489,
"repo_name": "brocade-apj/anzsdnhackathon2016",
"id": "5a96b66a9bce610df84075aaf28372d99ed57478... |
"""The CleverHans adversarial example library"""
from cleverhans.devtools.version import append_dev_version
# If possible attach a hex digest to the version string to keep track of
# changes in the development branch
__version__ = append_dev_version("4.0.0")
| {
"content_hash": "5bcd5d36328bb96a052dfb10e5c946a0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 72,
"avg_line_length": 43.333333333333336,
"alnum_prop": 0.7730769230769231,
"repo_name": "cleverhans-lab/cleverhans",
"id": "519ff0442481857c28a87f77d0bf6582738ac7bc",
"siz... |
from django.db.models.signals import post_save
from django.dispatch import receiver
from videos.models import Video, Rating, Analytic
@receiver(post_save, sender=Video)
def create_analytics(sender, instance, created, **kwargs):
if created:
Analytic.objects.create(video=instance)
@receiver(post_save, se... | {
"content_hash": "e130b04d98cd9d179374689a9ed96b74",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 58,
"avg_line_length": 28.0625,
"alnum_prop": 0.7505567928730512,
"repo_name": "lotube/lotube",
"id": "a5128374762548c3e780e59de57a1442a22729b4",
"size": "449",
"binary":... |
from user_metrics.utils import nested_import
from user_metrics.config import settings
query_mod = nested_import(settings.__query_module__)
| {
"content_hash": "ba60dd33bcb3b60a91618e3e70c7b4b5",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 52,
"avg_line_length": 35,
"alnum_prop": 0.8,
"repo_name": "wikimedia/user_metrics",
"id": "e604a4713acb64106dbd3cb8ae2b9744d447cfa1",
"size": "213",
"binary": false,
"c... |
import uuid
# Abstract class
class Primitive(object):
def __init__(self):
self.is_success = False # flags weather the primitive's action resulted in a success or not
self.exception = None # holds the exception object if one was raised
self._id = uuid.uuid4()
... | {
"content_hash": "1ba86ea23bcf06683cf2c03133c9afe8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 104,
"avg_line_length": 28.8125,
"alnum_prop": 0.5639913232104121,
"repo_name": "levilucio/SyVOLT",
"id": "4f5ce94eed3beef5aaa85de726b103a190d25001",
"size": "461",
"bina... |
import enum
from django.conf import settings
from django.db import models
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _
postgresql_engine_names = [
'django.db.backends.postgresql',
'django.db.backends.postgresql_psycopg2',
]
if settings.DATABASES['default'... | {
"content_hash": "fca31d3f9a6dffe23e7e3145eb32eb42",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 100,
"avg_line_length": 32.11363636363637,
"alnum_prop": 0.5980184005661713,
"repo_name": "awesto/django-shop",
"id": "6248faf7aa67b7e9241540384f435ba28595fa06",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('demo_models', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='bar',
name='foos',
field=models... | {
"content_hash": "a892efad9d2105098b140d34d6a3fd93",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 22.31578947368421,
"alnum_prop": 0.5849056603773585,
"repo_name": "AbhiAgarwal/django-report-builder",
"id": "17f4ca890358f99ca95f98706e342972dc1ec9f8"... |
'''
fabfile_sample.py
edit this to your satisfaction, then move it in your project root as fabfile.py
usage:
$ fab dev pack deploy
$ fab dev uptime
'''
import os
from fabric.api import *
def dev():
env.user = 'nathaniel'
env.hosts = ['tycho']
env.virtualenv_dir = '/home/nathaniel/conf/virtualenvs/p... | {
"content_hash": "a470af7b8841dd9c9f484b926b5ac4dc",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 79,
"avg_line_length": 26.93548387096774,
"alnum_prop": 0.6191616766467066,
"repo_name": "aquaya/pipeline",
"id": "dacf0c9914256bbda059a1030eee9305d78e6277",
"size": "2505"... |
import unittest
import io
import os
import tempfile
from kivy import setupconfig
class ImageTestCase(unittest.TestCase):
def setUp(self):
from kivy.core.window import Window
from kivy.core.image import Image
import os
self.cls = Image
self.image = os.path.join(os.path.dirn... | {
"content_hash": "9d445c79fa91af52363b8e1a115c9b2a",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 32.527027027027025,
"alnum_prop": 0.5911923556294142,
"repo_name": "matham/kivy",
"id": "8883be4857fb2ea1020fea3862dc74de04d70819",
"size": "2407",
... |
from django.conf.urls import url, include
from taxonomy.models import Taxon, Rank
from references.models import Reference, Author, AuthorOrder
from rest_framework import routers, serializers, viewsets
from rest_framework.authtoken import views
# Serializers define the API representation.
class TaxonSerializer(seriali... | {
"content_hash": "60464a903a0ad201e451ade756693baa",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 98,
"avg_line_length": 39.390243902439025,
"alnum_prop": 0.7145510835913312,
"repo_name": "wabarr/census-paleo",
"id": "364aec24d155e89287a54251847cc6673c0f5cef",
"size": ... |
"""
.. py:currentmodule:: leepstools.file.__init__
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Package for read and write LEEPS input / output files.
"""
###############################################################################
# Copyright 2017 Hendrix Demers
#
# Licensed under the Apache ... | {
"content_hash": "7024090f8fcde4622076f8a7225eec28",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 31.606060606060606,
"alnum_prop": 0.6337488015340365,
"repo_name": "drix00/leepstools",
"id": "104f274c30b6f88173de6c40f9118e3c51ae8041",
"size": "10... |
"""
Copyright (c) 2009 Barry Schwartz
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, distribute,... | {
"content_hash": "90ffdb88406d704f6925a0c9e4461fd8",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 77,
"avg_line_length": 36.72549019607843,
"alnum_prop": 0.6518953550453818,
"repo_name": "chemoelectric/sortsmill",
"id": "b8c95e80e274fab59c92bf1a8d5cce524d519fee",
"size"... |
import os
import sys
import smtplib
import mimetypes
from email.Encoders import encode_base64
from email.MIMEBase import MIMEBase
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
# =====================================
# CONFIG
TEST = False
MAIL_FROM = 'your-nas@host.tld'
MAIL_TO ... | {
"content_hash": "8300538141a759a7c6c8eacc4a13b433",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 73,
"avg_line_length": 21.930232558139537,
"alnum_prop": 0.6164722516790385,
"repo_name": "hotzen/SolarStatus",
"id": "50e2b6e5eabc44fe5de7e2a375e978db15f16b3b",
"size": "... |
import subprocess
import shlex
from shutil import copy
from sys import argv, stdout, stderr, exit
from platform import dist
from os import getuid, path, access, W_OK
class Color:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m... | {
"content_hash": "cba0797a3577f8d2b2ae81065317fe1a",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 76,
"avg_line_length": 29.299145299145298,
"alnum_prop": 0.5606767794632439,
"repo_name": "ssut/ngx-fancyindex-stylisher",
"id": "be9c97d0e126fa21c393bad7dbd63fef68db2c09",
... |
from __future__ import absolute_import, division, print_function, \
unicode_literals
import json
from datetime import date, datetime, time, tzinfo
from typing import Hashable, Iterable, Mapping, Optional, Sequence, Sized, Text, \
Union
from dateutil.parser import parse as dateutil_parse
from dateutil.tz impor... | {
"content_hash": "500cdee665f6770c399936d96d605f71",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 94,
"avg_line_length": 27.904013961605585,
"alnum_prop": 0.5314278566514479,
"repo_name": "eflglobal/filters",
"id": "b80a811fd0c1a8c2e3d8fc2390312f8f7fc9f007",
"size": "1... |
from bot import fetch_submission, get_comments, extract_urls
import shelve
submission = fetch_submission()
comments = get_comments(submission)
# shelve doesn't support unicode keys
sub_id = submission.id.encode('utf-8')
d = shelve.open('cache/urls.data', writeback=True)
if sub_id not in d:
d[sub_id] = {'urls':... | {
"content_hash": "833f6f0db03e94ff88ec4b7a34506f03",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 88,
"avg_line_length": 23.392857142857142,
"alnum_prop": 0.6687022900763359,
"repo_name": "yaph/threaddit",
"id": "ee3f7b5cb714683e316f5c248bc6cd3b12344584",
"size": "746",... |
"""
This sample shows how to create a list in json
of all items in a group
Python 2.x
ArcREST 3.0.1
"""
import arcrest
import os
import json
from arcresthelper import orgtools, common
import csv
def trace():
"""
trace finds the line, the filename
and error message and returns it
... | {
"content_hash": "0e618419e938405264e6126f57a6312e",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 122,
"avg_line_length": 38.308411214953274,
"alnum_prop": 0.5530617223713101,
"repo_name": "DShokes/ArcREST",
"id": "8f742e3e3e8eb1fcdbaefff723a4698296a4b6ce",
"size": "40... |
import os
import time
from microbenchmarks import benchmark_plan_list
from utils import dump2json
class MicroBenchmark:
suite_name = 'microbenchmarks'
config = {
'cuda': {
'enable': True
},
'vulkan': {
'enable': False
},
'opengl': {
... | {
"content_hash": "4c5c5370dcb90f87c48caebfda9bc4a4",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 70,
"avg_line_length": 31.060606060606062,
"alnum_prop": 0.5073170731707317,
"repo_name": "yuanming-hu/taichi",
"id": "dc8e8305404c1f28dee47a087497eb85c45bb105",
"size": "2... |
import unittest
import mock
from test import safe_repr
from test.unit import MockTrue
from swift.common.swob import HTTPBadRequest, Request, HTTPException
from swift.common.http import HTTP_REQUEST_ENTITY_TOO_LARGE, \
HTTP_BAD_REQUEST, HTTP_LENGTH_REQUIRED
from swift.common import constraints
class TestConstrai... | {
"content_hash": "feb55c1826ab9744c7784d2e307e116f",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 79,
"avg_line_length": 45.22649572649573,
"alnum_prop": 0.5873570821128224,
"repo_name": "gotostack/swift",
"id": "aaf5269ac79d50973814da47ea7f085e2056b6ff",
"size": "1117... |
import unittest
import json
from six.moves.urllib import parse as urlparse
from six.moves import cStringIO as StringIO
import requests
from httmock import urlmatch, HTTMock
import ipfsApi.commands
import ipfsApi.exceptions
@urlmatch(netloc='localhost:5001', path=r'.*/simple')
def cmd_simple(url, request):
return... | {
"content_hash": "fdb965a567abbcdd00e19589c5dcd674",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 53,
"avg_line_length": 26.2625,
"alnum_prop": 0.569728700618753,
"repo_name": "moreati/python-ipfs-api",
"id": "5c84e399646f502742bee304579ebcae49457644",
"size": "2101",
... |
import sys
import zipfile
import os.path
import xml.etree.ElementTree
from rdflib import Graph
from rdflib import Namespace
import urllib
from rdflib.term import URIRef
Scufl2NS = Namespace("http://ns.taverna.org.uk/2010/scufl2#")
NS_CONTAINER="{urn:oasis:names:tc:opendocument:xmlns:container}"
import rdflib
clas... | {
"content_hash": "45813da71af0a75519f375193a914426",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 103,
"avg_line_length": 33.46017699115044,
"alnum_prop": 0.5770960063475271,
"repo_name": "taverna-incubator/incubator-taverna-language",
"id": "d1d62fa7027c77c39c4b1943cabb... |
"""
Module containing all exceptions thrown througout the git package,
"""
class InvalidGitRepositoryError(Exception):
"""
Thrown if the given repository appears to have an invalid format.
"""
class NoSuchPathError(Exception):
"""
Thrown if a path could not be access by the system.
"""
class... | {
"content_hash": "178a2a5e89961d0ade998e623fd1653c",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 75,
"avg_line_length": 26.444444444444443,
"alnum_prop": 0.6358543417366946,
"repo_name": "kergoth/git-origin",
"id": "2632d5f34c27210fc5090d78659e68e23cddc807",
"size": "9... |
"""
Developed by Robin Bhattacharyya (memecache for GAE)
Released under the web2py license (LGPL)
from gluon.contrib.gae_memcache import MemcacheClient
cache.ram=cache.disk=MemcacheClient(request)
"""
import time
from google.appengine.api.memcache import Client
class MemcacheClient(Client):
def __init__(self, ... | {
"content_hash": "55e0864358aa720fa7b02306839e96ec",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 61,
"avg_line_length": 23.71153846153846,
"alnum_prop": 0.5425790754257908,
"repo_name": "SEA000/uw-empathica",
"id": "920690d6f0014f101c266a76fe6aad2a1264de47",
"size": "1... |
from prettyupload import PrettyUpload
from buildbot.process.properties import WithProperties
def conf(c):
pass
def factory(f):
f.addStep(PrettyUpload('/thisfile/does/not/exist',
masterdest='public_html/eexist.txt',
haltOnFailure=False))
f.addStep(Pret... | {
"content_hash": "236d67f2c1cdf7b920287e0d5617fdad",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 94,
"avg_line_length": 37.3,
"alnum_prop": 0.5978552278820375,
"repo_name": "wanders/buildbot-extras",
"id": "ec02262b358ffa815bd45f41d6d9a97b03e49e37",
"size": "747",
"b... |
import glob
import os
import re
import time
import types
import plugin
import telepot
import telepot.namedtuple
when = '9am'
telegram, util = plugin.get("telegram", "util")
def msg_cb(self, msg):
content_type, chat_type, chat_id = telepot.glance(msg)
print("content_type, chat_type, chat_id", content_type, c... | {
"content_hash": "f36975fce7155218ebc2315db2450e95",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 88,
"avg_line_length": 30.847457627118644,
"alnum_prop": 0.5785714285714286,
"repo_name": "alobbs/autome",
"id": "ff48adb5a2a38f30b63841785dcd22f78339e02e",
"size": "1829",... |
import hashlib, time, random
def generate_nonce(bits, randomness=None):
"This could be stronger"
if bits%8 != 0:
raise ValueError, "bits must be a multiple of 8"
nonce = hashlib.sha1(str(randomness) + str(time.time()) +
str(random.random()) ).hexdigest()
nonce = nonce[:bits/4]
... | {
"content_hash": "45f4e5d92b14bf8dc08d10a4ef14bb32",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 73,
"avg_line_length": 37.07692307692308,
"alnum_prop": 0.573997233748271,
"repo_name": "habnabit/divmod-sine",
"id": "bb73ad752c4040aafa4b763f180e362d03427245",
"size": "... |
import asyncio
import base64
from datetime import datetime
import functools
import hashlib
from itertools import repeat
import json
from urllib.parse import urlsplit, parse_qsl
import webbrowser
import aiohttp
class CustomDecoder(json.JSONDecoder):
def __init__(self, *args, **kargs):
super(CustomDecoder,... | {
"content_hash": "59ea7272ad5e0b44f323baa6070f53af",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 89,
"avg_line_length": 27.43421052631579,
"alnum_prop": 0.5860911270983213,
"repo_name": "stefanw/scrapa",
"id": "5d3b92e28b48b440cbe7a36e9463fada23467b2c",
"size": "4170"... |
"""connection full name
Revision ID: e1855559096
Revises: 401bc82cc255
Create Date: 2015-09-26 17:40:20.742180
"""
# revision identifiers, used by Alembic.
revision = 'e1855559096'
down_revision = '401bc82cc255'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alemb... | {
"content_hash": "12e8152c2824ef7dc00609e4c4ecbd8f",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 93,
"avg_line_length": 24.346153846153847,
"alnum_prop": 0.6951026856240127,
"repo_name": "ArthurPBressan/sisgep1",
"id": "8421e6f29dc860c958defcb0f8837716e7ec31c1",
"size"... |
import sys, urllib, time
from mod_pywebsocket import common, msgutil, util
def web_socket_do_extra_handshake(request):
request.connection.write(b'x')
time.sleep(2)
request.connection.write(b'x')
time.sleep(2)
request.connection.write(b'x')
time.sleep(2)
request.connection.write(b'x')
ti... | {
"content_hash": "d91f8e2e5ab7d3f422290c5a6b0781c6",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 58,
"avg_line_length": 26.47826086956522,
"alnum_prop": 0.6617405582922824,
"repo_name": "youtube/cobalt",
"id": "ddf9e98267035be59ef0957e474be9c944918a4a",
"size": "628",
... |
import unittest
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
from django.utils.six import PY3
class TokenGeneratorTest(TestCase):
def test_make... | {
"content_hash": "bd8da6bde94ec5c063cdcadb91c8c417",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 88,
"avg_line_length": 38.774647887323944,
"alnum_prop": 0.6498365419542318,
"repo_name": "cloudera/hue",
"id": "7ff3f15f3d80544c9420673723c2aa7da9a99375",
"size": "2753",
... |
import numpy as np
from iminuit import Minuit
from matplotlib import pyplot as plt
from numpy.random import randn
from probfit import AddPdfNorm, BinnedLH, gaussian, rename
peak1 = randn(1000) * 0.5 + 1.0
peak2 = randn(500) * 0.5 + 0.0
# two peaks data with shared width
data = np.concatenate([peak1, peak2])
# Share ... | {
"content_hash": "b70f7bc77a16c6bf91c5557ca7d49f13",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 78,
"avg_line_length": 27.606060606060606,
"alnum_prop": 0.6937431394072447,
"repo_name": "iminuit/probfit",
"id": "f06e6f80e74b7e4552ebfd4f84a7146eaec4c816",
"size": "935"... |
"""Tests for git store"""
from contextlib import contextmanager
import os
from shutil import rmtree
import subprocess
import tempfile
import unittest
from store.git.git import LocalGitStore
class GitStoreTest(unittest.TestCase):
TEST_STORE = "test_store"
TEST_KEY = "test_key"
GIT_ROOT = "git_root"
STATUS_FIL... | {
"content_hash": "3bfefada64abcb98132a1326c6bedeb9",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 88,
"avg_line_length": 33.407407407407405,
"alnum_prop": 0.6840354767184036,
"repo_name": "GoogleContainerTools/base-images-docker",
"id": "0d2ac58c6046d8852bf4558cb3b63192d... |
import sys
import java.awt as awt
import javax.swing as swing
import java.lang as lang
import java.lang.System as System
import java.io.File as File
from java.lang import Object
import threading
import dircache
import os
import pickle
import math
class YayGuiCore:
def buildGui(self):
self.frame = swing.JFrame... | {
"content_hash": "98ea5cc9c814080dd472bacb60d50c20",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 92,
"avg_line_length": 30.717391304347824,
"alnum_prop": 0.7484076433121019,
"repo_name": "jacktasia/yay",
"id": "dcacc3c79b93b3008938996cb2f5db42424f943c",
"size": "2952",... |
import http.server
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
http.server.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
... | {
"content_hash": "6588f1c884cfbf0fad44dc62223f6bd8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 80,
"avg_line_length": 41.10526315789474,
"alnum_prop": 0.6696542893725992,
"repo_name": "japgolly/scalajs-benchmark",
"id": "84ee85c3c2fb9ff2018065994fa64b02aadb391c",
"si... |
import os
import sys
import signal
import psutil
import logging
logging.basicConfig(filename='daemon.log', level=logging.INFO)
def stop(pgid):
logging.info(f"Stopping pgid {pgid} by ray_daemon.")
try:
# SIGTERM may not kill all the children processes in the group.
os.killpg(pgid, signal.SIGKIL... | {
"content_hash": "c649076d64ca8309e9cc711cc88849ff",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 71,
"avg_line_length": 22.857142857142858,
"alnum_prop": 0.6515625,
"repo_name": "intel-analytics/analytics-zoo",
"id": "fe5ff7533ea84bf23c27cee2a27be6c499787f63",
"size": ... |
"""
history
A great place for reviews on filibuster
--------------------------------------------------------------------
"""
__version__ = '3.0.0'
__author__ = "someone"
content = {
'review': [
'<#review_intro#> <#review_conclusion#>',
],
'review_intr... | {
"content_hash": "8750cbea6e4bc7038ccac8a06f8ff88c",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 148,
"avg_line_length": 47.65686274509804,
"alnum_prop": 0.4834396214770623,
"repo_name": "petrvanblokland/Xierpa3",
"id": "c2ffc97a573723da5297446a28ba4e76140eb5cf",
"siz... |
"""A module that handles series: find a limit, order the series etc.
"""
from .order import Order
from .limits import limit, Limit
from .gruntz import gruntz
from .series import series
from .approximants import approximants
from .residues import residue
from .sequences import (EmptySequence, SeqPer, SeqFormula, sequenc... | {
"content_hash": "1c1e87bf8a187e7364166e0d971c9dba",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 33.041666666666664,
"alnum_prop": 0.6872635561160151,
"repo_name": "kaushik94/sympy",
"id": "96eee4b8106c2be8318e67c25cee8d1a3edf7efd",
"size": "793"... |
from os.path import basename, dirname, join
import sys
from PyQt4 import QtCore, QtGui, uic
# Translation function
def tr(context, text):
return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
class PatcherApp(QtGui.QApplication):
def __init__(self, patches=[], patch_f... | {
"content_hash": "87d2ad557f0b5fe5753b30e4aee00648",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 100,
"avg_line_length": 33.927083333333336,
"alnum_prop": 0.6229659195578754,
"repo_name": "jwiggins/keyenst",
"id": "9bbd3da11f26ab1ba68fc17949fce6d5f5182051",
"size": "32... |
'''
Created by prinkk
Developer Kristian Øllegaard
Mail kristian@prinkk.net
www http://www.prinkk.net
License Copyright 2011 prinkk
Filename livestats.py
'''
from django import template
from django.template.defaultfilters import stringfilter
register = template.Librar... | {
"content_hash": "d1683b4296cf2d3d4854f8b67959fdab",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 55,
"avg_line_length": 20.55,
"alnum_prop": 0.7031630170316302,
"repo_name": "frankk00/django-livestats",
"id": "58ed0d0d03cacc1c466f84711b1b33e37ff03749",
"size": "436",
... |
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_subfolder not in sys.path:
sys.path.insert(0, cmd_subfolder)
import ... | {
"content_hash": "6ee8c59a91ae0999ba0b289867e06336",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 129,
"avg_line_length": 30.11904761904762,
"alnum_prop": 0.6861660079051384,
"repo_name": "jgarybanks/blenderbottle",
"id": "295b01731b40a51eea80139c0df623c3fb80c43e",
"siz... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/interior_components/shared_weapon_interior.iff"
result.attribute_template_id = 8
result.stfName("space/space_item","weapon_interior_n")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
r... | {
"content_hash": "25d691adb40d1a0b23b567cdfb40aec6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 25.53846153846154,
"alnum_prop": 0.713855421686747,
"repo_name": "anhstudios/swganh",
"id": "b0e5ced05a8557c7821e23d2182d55c2232cf035",
"size": "477"... |
import maya.cmds as cmds
from mayaGeom import MayaGeom
class MayaSphere(MayaGeom):
def __init__(self, name='Sphere'):
MayaGeom.__init__(self)
parts = cmds.sphere(name=name, object=True, radius=1.0)
self.name = parts[0]
| {
"content_hash": "2957497f531ebe1fa158f40ac94332e6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 63,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.6465863453815262,
"repo_name": "madoodia/codeLab",
"id": "10fe419e5f9241a00b46b3da9ddc17ebcba0487a",
"size": "249"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from hashlib import md5
def dedup_data_hash(todedup_data, todedup_labels, base_data):
"""Fast deduplicate datasets by hashing: MD5.
Args:
todedup_data: A NumPy array. Dataset... | {
"content_hash": "7068e804437f4c2da118592e253d3ea9",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 75,
"avg_line_length": 29.24390243902439,
"alnum_prop": 0.6522101751459549,
"repo_name": "bowen0701/python_handson",
"id": "1bd9dfb809c243a29129c2da08018e0b16a54a27",
"size... |
"""
Author: Alok Jani
binomial_distribution_table.py
Builds Table for calculating probability of
r successes in
n independent trials,
each with probability of success p
"""
import math
def combinatorial(n, r):
return math.factorial(n) // math.factorial(r) // math.factorial(n-r)
def binomial_prob... | {
"content_hash": "466fd9d5bf4ec45c8c1da41d42724f4e",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 85,
"avg_line_length": 25.047619047619047,
"alnum_prop": 0.5399239543726235,
"repo_name": "alokjani/python-mathmodeling",
"id": "ce7e2e454538a53756888a49fccd942dd27e0bec",
... |
import os
import sys
import unittest
from nose.config import Config
from nose.core import TestProgram
here = os.path.abspath(os.path.dirname(__file__))
support = os.path.join(here, 'support')
units = os.path.normpath(os.path.join(here, '..', 'unit_tests'))
if units not in sys.path:
sys.path.insert(0, units)
from ... | {
"content_hash": "06f7dd584003601dac098ee256ce8299",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 78,
"avg_line_length": 41.71830985915493,
"alnum_prop": 0.6164753544902093,
"repo_name": "cloudera/hue",
"id": "eff6c7a4f381b8881dfd47c11cbdccdf85f8dac4",
"size": "2962",
... |
"""Reports memory usage stats.
The code is based on:
https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import errno
import fnmatch
import io
import l... | {
"content_hash": "07fc4ef11984c8a6a5060ca01323c59c",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 78,
"avg_line_length": 28.1324200913242,
"alnum_prop": 0.5690634637234215,
"repo_name": "Morgan-Stanley/treadmill",
"id": "583339d088015acf962918aa31063287cd951b4d",
"size... |
"""
The "Api" class is used when an instance
of an API is required in the athena.apis.api_lib
Use "from athena.apis import api_lib" & "api_lib['(api_name_key)']"
to access instances of APIs.
"""
import traceback
class Api(object):
def __init__(self, key, save_data=None, enabled=True):
""" M... | {
"content_hash": "c2d34bc49b64151b861f45fff11aa9d4",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 78,
"avg_line_length": 33.972972972972975,
"alnum_prop": 0.5147175815433572,
"repo_name": "hey-athena/hey-athena-client",
"id": "2a171914887bd0c60c4f45c0ea1e6a5bc4c1690e",
... |
import sys
import os.path
import platform
major = sys.version_info[0]
minor = sys.version_info[1]
path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.join(path, "source/module"))
sys.path.append(
os.path.join(path,
"build/lib.{}-{}-{}.{}".format(
platfor... | {
"content_hash": "3f59f5b6bc5ede72dd712eee0db93989",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 95,
"avg_line_length": 34.74664107485604,
"alnum_prop": 0.6013367950063525,
"repo_name": "hanya/pyuno3",
"id": "c0010da168654dce3b504da2012066574aaf5834",
"size": "18167",... |
"""Provide info to system health."""
from homeassistant.components import system_health
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import system_info
@callback
def async_register(
hass: HomeAssistant, register: system_health.SystemHealthRegistration
) -> None:
"""Registe... | {
"content_hash": "e97385714a357022970863939cedfea8",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 73,
"avg_line_length": 33.41935483870968,
"alnum_prop": 0.6476833976833977,
"repo_name": "partofthething/home-assistant",
"id": "ff3562a24f926655d083ae9f98cd4c14d4d24184",
... |
'''
A perfect number is a number for which
the sum of its proper divisors is exactly equal to the number.
For example, the sum of the proper divisors of 28 would be
1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
A number n is called deficient if the sum of its proper divisors is
less than n and it i... | {
"content_hash": "18217644fe4a7eb3a9ff4c8036a2236f",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 82,
"avg_line_length": 31.537037037037038,
"alnum_prop": 0.6365237815619496,
"repo_name": "smrmkt/project_euler",
"id": "d442a9b1db80de65e3d83e62f5c4f3a448d29709",
"size": ... |
from django.http.request import HttpRequest
from json import JSONDecoder
from json import JSONEncoder
def request_principal_get(self):
return getattr(self, '_principal', None)
def request_principal_set(self, value):
setattr(self, '_principal', value)
def request_principal_del(self):
delattr(self, '_p... | {
"content_hash": "1af206e9ff9fe39f4548d2aa06592762",
"timestamp": "",
"source": "github",
"line_count": 397,
"max_line_length": 152,
"avg_line_length": 37.04785894206549,
"alnum_prop": 0.587299428882241,
"repo_name": "triflesoft/django-application-talos",
"id": "5f7ab1e2097a573e30a88d2e109ae4d3c61574... |
import cv2
import numpy as np
def get_data(input_path):
found_bg = False
all_imgs = {}
classes_count = {}
class_mapping = {}
visualise = True
with open(input_path,'r') as f:
print('Parsing annotation files')
for line in f:
line_split = line.strip().split(',')
(filename,x1,y1,x2,y2,class_name) = ... | {
"content_hash": "18a827be23fa279a663a18b460a73805",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 135,
"avg_line_length": 27.984375,
"alnum_prop": 0.6353992183137912,
"repo_name": "yhenon/keras-frcnn",
"id": "8bfb55aa53c7684cbbfc1941a34a32735870a5d6",
"size": "1791",
... |
"""
===========================
Upper Air Sounding Tutorial
===========================
Upper air analysis is a staple of many synoptic and mesoscale analysis
problems. In this tutorial we will gather weather balloon data, plot it,
perform a series of thermodynamic calculations, and summarize the results.
To learn mor... | {
"content_hash": "019297da149a8558baaaf706c866988f",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 92,
"avg_line_length": 35.68811881188119,
"alnum_prop": 0.6712442779858511,
"repo_name": "metpy/MetPy",
"id": "107ecdda1d83c0f0df0b3d11c8d93d4436f3fd12",
"size": "7352",
... |
from astropy.nddata import NDData, NDDataRef, NDIOMixin
# Alias NDDataAllMixins in case this will be renamed ... :-)
NDDataIO = NDDataRef
def test_simple_write_read():
ndd = NDDataIO([1, 2, 3])
assert hasattr(ndd, "read")
assert hasattr(ndd, "write")
| {
"content_hash": "d870d4cd50b84c472d4b614a25ad3586",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 60,
"avg_line_length": 26.6,
"alnum_prop": 0.6917293233082706,
"repo_name": "mhvk/astropy",
"id": "1667f4d4c760e6becd6afc2d80b3de3017d543a6",
"size": "266",
"binary": fal... |
ACCOUNT_NAME = 'Fab Furnish'
| {
"content_hash": "aaf06678e13655cc965276c3ac5c6c00",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 28,
"avg_line_length": 29,
"alnum_prop": 0.7241379310344828,
"repo_name": "ddy88958620/lib",
"id": "bee068e8fb64f56beea68a27c2518ac391035887",
"size": "29",
"binary": fals... |
from django.db import models
from django.contrib.auth.models import User
from django.shortcuts import resolve_url as r
class Doctor(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
slug = models.SlugField('slug')
address = models.CharField('endereço', max_length=255, blank=True)
... | {
"content_hash": "c6e2d80162d8d03e8928bb69814587f0",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 73,
"avg_line_length": 38.208333333333336,
"alnum_prop": 0.6673936750272628,
"repo_name": "vribeiro1/plainsboro_221",
"id": "803f91b02312167a6e5db6ba47989f9533c5d1e3",
"siz... |
import doctest
import glob
import os
import sys
sys.path.append(".\src")
opts = doctest.REPORT_ONLY_FIRST_FAILURE|doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE
files = glob.glob('tests\*.rst')
failure = False
for f in files:
failed, tested = doctest.testfile(f, optionflags=opts)
if failed > 0:... | {
"content_hash": "b628689fe2560f669e303f556e5acacb",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 86,
"avg_line_length": 21.25925925925926,
"alnum_prop": 0.6637630662020906,
"repo_name": "thisismyrobot/gedit-pytts",
"id": "7afe49b839911944a4fb91ecfaf49d5caed2db83",
"siz... |
"""
Test lldb watchpoint that uses '-s size' to watch a pointed location with size.
"""
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class HelloWatchLocationTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
... | {
"content_hash": "3ffbad90647eb6ab84a71358d7f7442a",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 79,
"avg_line_length": 38.944954128440365,
"alnum_prop": 0.6061248527679624,
"repo_name": "endlessm/chromium-browser",
"id": "55bf929b25fcf0eea6a84b14920331d9f01d6113",
"s... |
import logging
from horizon.test import helpers as test
from selenium.common import exceptions as selenium_exceptions
class BrowserTests(test.SeleniumTestCase):
def test_jasmine(self):
url = "%s%s" % (self.live_server_url, "/jasmine/")
self.selenium.get(url)
wait = self.ui.WebDriverWait(s... | {
"content_hash": "62da92e624bcfbd319ea229754717add",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 76,
"avg_line_length": 38,
"alnum_prop": 0.6237553342816501,
"repo_name": "openstack/watcher-dashboard",
"id": "189326858758b1a889144bf1c6a3d8b5f720c08b",
"size": "1979",
... |
def extractWwwMoonsTavernCom(item):
'''
Parser for 'www.moons-tavern.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', '... | {
"content_hash": "520625e32df45be9b73305850491021f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 26.19047619047619,
"alnum_prop": 0.6272727272727273,
"repo_name": "fake-name/ReadableWebProxy",
"id": "77d8e68d50502a612f61e7b571c9490dac21e5d0",
"s... |
"""
Forward messages sent to the configured email gateway to Zulip.
For zulip.com, messages to that address go to the Inbox of emailgateway@zulip.com.
Zulip voyager configurations will differ.
Messages meant for Zulip have a special recipient form of
<stream name>+<regenerable stream token>@streams.zulip.com
Th... | {
"content_hash": "1e85322e3f8d4f62918aed6eeac53712",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 106,
"avg_line_length": 40.06944444444444,
"alnum_prop": 0.634315424610052,
"repo_name": "krtkmj/zulip",
"id": "6f147f21d1e16cf1efb2222379d43f9df9a66457",
"size": "5793",
... |
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 2, 4)
__version__ = '.'.join(map(str, __version_info__))
| {
"content_hash": "7cf2c2e38d848e13289b8014c55b26f9",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 66,
"avg_line_length": 37,
"alnum_prop": 0.6418918918918919,
"repo_name": "concordusapps/strudel",
"id": "7d2695abd566a83e641ceecacd83fb8593505ba9",
"size": "172",
"binary... |
"""
A server process manager providing different locking strategies to processes
accessing a shared resource. See strategies for concrete implementations.
"""
from multiprocessing.managers import BaseManager
from .strategies import (no_starve, writer_preference, LOCK_STRATEGY_NO_STARVE,
LOCK... | {
"content_hash": "17d72b352a9943b0f2e4b660f90bac60",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 79,
"avg_line_length": 29.683333333333334,
"alnum_prop": 0.6855699045480067,
"repo_name": "meteotest/hurray",
"id": "e87db0740d83284d2125a745b24d491e0ce93931",
"size": "330... |
from django.test import TestCase
from tastypie.http import HttpAccepted, HttpBadRequest, HttpConflict,\
HttpCreated, HttpGone, HttpMethodNotAllowed, HttpNoContent, HttpNotFound,\
HttpNotImplemented, HttpNotModified, HttpSeeOther, HttpTooManyRequests,\
HttpUnauthorized
class HttpTestCase(TestCase):
def... | {
"content_hash": "b1b9734caadd1c4a3771d6521a3d9126",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 78,
"avg_line_length": 45.65,
"alnum_prop": 0.6861993428258488,
"repo_name": "ipsosante/django-tastypie",
"id": "f1724e13a8dba51305f4ae50bfd0c91ea93cf945",
"size": "1911",
... |
from django.contrib import admin
from NutmegCRM.apps.crm.models import Customer
# Register your models here.
class CustomerAdmin(admin.ModelAdmin):
list_display = ['first_name']
list_filter = ['first_name', 'created', 'last_name']
search_fields = ['first_name', 'last_name', 'email']
date_heirachy = 'c... | {
"content_hash": "f26777cb6f71cf81fd5db732699e6d85",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 56,
"avg_line_length": 31.714285714285715,
"alnum_prop": 0.6936936936936937,
"repo_name": "Justasic/NutmegCRM",
"id": "2c134035d09c4d1c01a63c59f3c1e84de601cc1a",
"size": "4... |
import sys
from twisted.internet.defer import Deferred
def got_poem(poem):
print poem
from twisted.internet import reactor
reactor.stop()
def poem_failed(err):
print >>sys.stderr, 'poem download failed'
print >>sys.stderr, 'I am terribly sorry'
print >>sys.stderr, 'try again later?'
from ... | {
"content_hash": "43462cee2b989c0d971bf8acfcece842",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 58,
"avg_line_length": 20.071428571428573,
"alnum_prop": 0.7206405693950177,
"repo_name": "tidalmelon/twisted-intro",
"id": "7b8c71ca95701663fe89033a4799dfa2e0ca8d21",
"siz... |
class Transaction(object):
def __init__(self, database, isolation_level):
self.database = database
self.isolation_level = isolation_level
def __enter__(self):
self.database.start_transaction(self.isolation_level)
def __exit__(self, exception_type, exception, traceback):
if... | {
"content_hash": "14d360d6827ecf2ed28cefe310e35563",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 29.857142857142858,
"alnum_prop": 0.6220095693779905,
"repo_name": "hugollm/rebel",
"id": "d437565d41bf371c0509f8b63f1f1f29ecbc7d1e",
"size": "418",
... |
"""Functions that aid with generating text from templates and maps."""
import re
# POSIX shell variable syntax:
# Expansions with unset var
# ${var}=
# ${var+WORD}=
# ${var:+WORD}=
# ${var-WORD}=WORD
# ${var:-WORD}=WORD
# Expansions with empty var
# ${var}=
# ${var+WORD}=WORD
# ${var:+WORD}=
# ${var-WORD}=... | {
"content_hash": "69bb856a355bc181355dcd9bb0de2e85",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 125,
"avg_line_length": 35.391752577319586,
"alnum_prop": 0.6481211768132829,
"repo_name": "jonfoster/pyxb1",
"id": "74e56705223276b453b8518291a6dbdfa31e15bc",
"size": "402... |
"""
Talon.One API
Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) are used to integrate with our platform - Use the operation in the [Management API section](#management-api) to manage ap... | {
"content_hash": "cc227c36212692e2a71077ca42f4d06a",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 732,
"avg_line_length": 38.44886363636363,
"alnum_prop": 0.6383921974286981,
"repo_name": "talon-one/talon_one.py",
"id": "816e16d07c09af7d73f718c70a86d51419262eb7",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.