text stringlengths 4 1.02M | meta dict |
|---|---|
"""
This runs the mail throttler as a window service
Base code for the service is taken from http://code.activestate.com/recipes/551780/
"""
#Internal Modules
from mailThrottler import MTDaemon
from core import _config
#Python BulitIns
from os.path import splitext, abspath
from sys import modules, argv
import... | {
"content_hash": "938726d63544768b31d0039e53d5ab37",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 157,
"avg_line_length": 34.09322033898305,
"alnum_prop": 0.6221725080785483,
"repo_name": "bobbynewmark/mailthrottler",
"id": "b6f2b0a639ba43946d6643bab8dab5a963721ce5",
"... |
from collections import OrderedDict
from random import randint
from time import time
d = OrderedDict()
players = list("ABCDEFGH")
start = time()
for i in xrange(8):
raw_input()
p = players.pop(randint(0,7 - i))
end = time()
print i+1, p ,end - start
d[p] = (i+i,end - start)
print
print '-' * 40
... | {
"content_hash": "6d8a3409d5480b73afa8f166d1dc6e6b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 37,
"avg_line_length": 16.40909090909091,
"alnum_prop": 0.6260387811634349,
"repo_name": "liuhll/BlogAndNotes",
"id": "5cff065db0b4513de2483ba2aba51486a4489990",
"size": "3... |
from __future__ import absolute_import, unicode_literals
import copy
import datetime
import os
import re
import sys
import time
import warnings
from io import BytesIO
from pprint import pformat
try:
from urllib.parse import quote, parse_qsl, urlencode, urljoin, urlparse
except ImportError: # Python 2
from... | {
"content_hash": "9e2c9d151d86006faa6a609bd3d478ea",
"timestamp": "",
"source": "github",
"line_count": 777,
"max_line_length": 134,
"avg_line_length": 37.17760617760618,
"alnum_prop": 0.5900924291203655,
"repo_name": "vsajip/django",
"id": "1a9f359ab342a7ec6f2557a427bf4f36f3a8f46a",
"size": "28887... |
from . import constants
from . import decorators
from . import exceptions
from . import helpers
from . import objects
from . import photodb
from . import searchhelpers
from . import tag_export
__all__ = [
'constants',
'decorators',
'exceptions',
'helpers',
'objects',
'photodb',
'searchhelpe... | {
"content_hash": "809d9e304c78b5515b6ac7094a0656f9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 27,
"avg_line_length": 18.157894736842106,
"alnum_prop": 0.6579710144927536,
"repo_name": "voussoir/etiquette",
"id": "498b1a6bc70f852431fb5e1c0b11e55a095f1b0a",
"size": "3... |
import sys
import json
import urllib
import urllib2
import argparse
def translate(target, text):
api = "https://www.googleapis.com/language/translate/v2?"
api_key = "AIzaSyBgBlJCogk_1Hd_7WaLQgLVbQss0_dvNUc"
parameters = urllib.urlencode({
'target': target,
'key': api_key,
'q': text
... | {
"content_hash": "bf611c50e7844dbd342f5259eef01ab5",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 27.513513513513512,
"alnum_prop": 0.6218074656188605,
"repo_name": "voidabhi/python-scripts",
"id": "76200e343cdc9e166ed8014c287918d49dfce880",
"size... |
import sys, os, json
import PARC_QRM_Toolkit
this_file_path = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.join(this_file_path, '..', 'CyPhy'))
print 'current dir {0}'.format(os.getcwd())
PARC_QRM_Toolkit.OMC = os.path.join(os.getenv("OPENMODELICAHOME"), 'bin', 'omc')
PARC_QRM_Toolkit.QRM = '... | {
"content_hash": "584cad23ef5480a48c4d036fa42d31b8",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 140,
"avg_line_length": 39.375,
"alnum_prop": 0.617636684303351,
"repo_name": "pombredanne/metamorphosys-desktop",
"id": "9b0721fed3713d97b52b18fb7e7654471a081cc0",
"size":... |
"""
Scrapes bill text available in PDF.
"""
from django.core.management.base import BaseCommand
from legislative.models import BillText
from tqdm import tqdm
import requests
import re
from time import sleep
import PyPDF2
import pdfquery
class Command(BaseCommand):
"""
Scrapes bill text available in html.
"... | {
"content_hash": "24ea16eb189088a84404e1187ea70000",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 84,
"avg_line_length": 31.38235294117647,
"alnum_prop": 0.5290534208059982,
"repo_name": "access-missouri/am-django-project",
"id": "d516c415fddf80a0dfc17ae3b9414d2a5ffe7820"... |
import os, sys, types, inspect
from StringIO import StringIO
# twisted & related imports
from zope.interface import classProvides, implements, Interface
# ZSI imports
from pyremotevbox.ZSI import _get_element_nsuri_name, EvaluateException, ParseException,\
fault, ParsedSoap, SoapWriter
from pyremotevbox.ZSI.twist... | {
"content_hash": "f7fc2018edee7d35a182088e71aaacae",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 212,
"avg_line_length": 32.399328859060404,
"alnum_prop": 0.6073537027446919,
"repo_name": "rameshg87/pyremotevbox",
"id": "bf5d047bec41242cfbd3cafd50e6cd1050d83bb3",
"siz... |
try: # pragma: no cover
from django_hosts.defaults import patterns, host
from django_hosts.reverse import reverse_host, reverse_full
except ImportError: # pragma: no cover
pass
# following PEP 386
__version__ = "0.6"
| {
"content_hash": "3acf94a06c8bb36fc031d5794f87915c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 63,
"avg_line_length": 29,
"alnum_prop": 0.7112068965517241,
"repo_name": "carlitux/django-hosts",
"id": "0f5786430d93f90e4a5854d5224eee55bc886490",
"size": "247",
"binary... |
import json
import uuid
from twisted.internet import threads
from twisted.internet.protocol import Factory, Protocol
from txsockjs.factory import SockJSResource
from hendrix.resources import NamedResource
from .messaging import hxdispatcher
from .signals import message_signal
def send_signal(transport, data):
... | {
"content_hash": "e071ff8b450d46db3a47b3c1c8056e06",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 78,
"avg_line_length": 29.988095238095237,
"alnum_prop": 0.6447002778880508,
"repo_name": "anthonyalmarza/hendrix",
"id": "a432fdcf6d8bd9aae81feac843169c91abe54385",
"size"... |
""" Splitting dataset
"""
from world import world, setup_module, teardown_module
import create_source_steps as source_create
import create_dataset_steps as dataset_create
class TestSplitDataset(object):
def test_scenario1(self):
"""
Scenario: Successfully creating a split dataset:
... | {
"content_hash": "ade204f971a30be3f0e0982b7111e96f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 77,
"avg_line_length": 47.975,
"alnum_prop": 0.5476810838978635,
"repo_name": "ShaguptaS/python",
"id": "cfeab07fffb070ed4ffd52f3d3b2173b28aa58f1",
"size": "2538",
"binar... |
import os
import sys
sys.path.append(os.environ['ceroot'])
from kpi import CostKpi, DurationKpi, AccKpi
# NOTE kpi.py should shared in models in some way!!!!
train_cost_kpi = CostKpi('train_cost', 0.02, actived=True)
test_acc_kpi = AccKpi('test_acc', 0.005, actived=True)
train_duration_kpi = DurationKpi('train_durati... | {
"content_hash": "5040983a75a355989d2cb194a41fcd0d",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 70,
"avg_line_length": 23.610169491525422,
"alnum_prop": 0.6037329504666188,
"repo_name": "lcy-seso/models",
"id": "9c2dba53526d2e976252fce05c7ff7f0f44b39b2",
"size": "1451... |
from diary import DiaryDB, Event
import unittest
import sqlite3
import os.path
class TestDiaryDB(unittest.TestCase):
TEMP_DB_PATH = os.path.join(os.path.dirname(__file__),
'testing_dir', 'temp.db')
SIMPLE_EVENT = Event("INFO", "LEVEL")
def setUp(self):
self.logdb ... | {
"content_hash": "86f934c4881aea450a9254b9ca1f44e2",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 38.96825396825397,
"alnum_prop": 0.5751527494908351,
"repo_name": "GreenVars/diary",
"id": "880d7920bcaf4ed01b24c42032057c0bbe7d5849",
"size": "2455"... |
import pandas as pd
import numpy as np
import os
import tensorflow as tf
import copy
from tensorflow.contrib import learn
import _pickle as pickle
def read_from_csv():
csv_fname = "/Users/shubhi/Public/CMPS296/friends.csv" #replace with local file loc
df = pd.DataFrame.from_csv(csv_fname)
df = df.dropna(... | {
"content_hash": "18058ad075d554c79edb3737243c12d1",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 106,
"avg_line_length": 27.309278350515463,
"alnum_prop": 0.6402416006040015,
"repo_name": "ProjectsUCSC/CMPS296",
"id": "bfb7e0d0d4fd72451c7eaa50ea7790ebcab32399",
"size":... |
SKIP = "SKIP"
FAIL = "FAIL"
PASS = "PASS"
OKAY = "OKAY"
TIMEOUT = "TIMEOUT"
CRASH = "CRASH"
SLOW = "SLOW"
FLAKY = "FLAKY"
NO_VARIANTS = "NO_VARIANTS"
# These are just for the status files and are mapped below in DEFS:
FAIL_OK = "FAIL_OK"
PASS_OR_FAIL = "PASS_OR_FAIL"
ALWAYS = "ALWAYS"
KEYWORDS = {}
for key in [SKIP, ... | {
"content_hash": "9837f47484d3f40542f0588f050ed46f",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 79,
"avg_line_length": 24.64864864864865,
"alnum_prop": 0.6410818713450293,
"repo_name": "imzcy/JavaScriptExecutable",
"id": "826b576f2308c6f4f66350867019ae6175115bd5",
"s... |
import sys
import socket
import tensorflow.contrib.keras as keras
import pandas as pd
import numpy as np
import vixstructure.models as models
def get_model(hidden_layers, step_size, dropout=None):
model = models.spread_price_prediction(hidden_layers, 12, dropout)
sgd = keras.optimizers.SGD(step_size)
mo... | {
"content_hash": "e9f98ad75c5ebdc41297ae93b25dd7a6",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 140,
"avg_line_length": 44.859375,
"alnum_prop": 0.6405433646812957,
"repo_name": "leyhline/vix-term-structure",
"id": "2dcc39ed2c1ed9f3f560dc5db49d2c83141f6eb4",
"size": "... |
import unittest
from collections import deque
import numpy as np
import pandas as pd
import pandas.util.testing as tm
from zipline.utils.data import RollingPanel
class TestRollingPanel(unittest.TestCase):
def test_basics(self):
items = ['foo', 'bar', 'baz']
minor = ['A', 'B', 'C', 'D']
... | {
"content_hash": "b35eb91e37f7fe4ed6fd644de5d28df9",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 69,
"avg_line_length": 26.978494623655912,
"alnum_prop": 0.5185332801913113,
"repo_name": "lsbardel/zipline",
"id": "ded2c8ca69fb529b58ea93057dd278aa4a036658",
"size": "309... |
import calendar
import json
import random
import traceback
import datetime
import sys
reload(sys)
sys.setdefaultencoding("utf8")
from fake_useragent import UserAgent
from datetime import date
import time
from dateutil.relativedelta import relativedelta
if __name__ == '__main__':
sys.path.append('... | {
"content_hash": "6b02a43a140a55e24a716c91f9802761",
"timestamp": "",
"source": "github",
"line_count": 463,
"max_line_length": 394,
"avg_line_length": 44.183585313174945,
"alnum_prop": 0.5419660751820893,
"repo_name": "Svolcano/python_exercise",
"id": "401cf43f43b75c1e2788aae3d2ce391b38a963eb",
"s... |
import flask
from sqlalchemy import exc as sa_exc
from sqlalchemy import sql
from sqlalchemy import orm
from dci.api.v1 import base, sso
from dci import auth
from dci import dci_config
from dci.common import exceptions as dci_exc
from dciauth.request import AuthRequest
from dciauth.signature import Signature
from dcia... | {
"content_hash": "9f24f0df33174338247a1ca770d5a591",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 88,
"avg_line_length": 36.26235741444867,
"alnum_prop": 0.5620216000838838,
"repo_name": "redhat-cip/dci-control-server",
"id": "4777813836961f6ec8f8b05d750d85fd84d9c23a",
... |
from indico.core.db import db
from indico.modules.events.cloning import EventCloner
from indico.modules.vc import VCRoomEventAssociation
from indico.modules.vc.models.vc_rooms import VCRoomLinkType
from indico.modules.vc.util import get_vc_plugins
from indico.util.i18n import _
class VCCloner(EventCloner):
name =... | {
"content_hash": "96f9c5a5b2add2a93b12def1e1fa3e70",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 110,
"avg_line_length": 43.16129032258065,
"alnum_prop": 0.6352765321375187,
"repo_name": "indico/indico",
"id": "1f919f0a01b6dc5841c5df16a649eda410cd0b06",
"size": "2890",... |
from time import time
import json
from webob import Request
class ForensicMiddleware(object):
"""
Log ALL request information as JSON, one request per line.
NOTE: Needs to set some reasonable restrictions on request content length
in order to be usable in production. Request bodies which are too lar... | {
"content_hash": "b294ebd95f97f6af679b8ca791a165c5",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 77,
"avg_line_length": 29.529411764705884,
"alnum_prop": 0.5846613545816733,
"repo_name": "storborg/maitai",
"id": "0bbd04aef1f7a9487e8e9e225c97dbd93c5981cb",
"size": "1004... |
from openflow.optin_manager.sfa.rspecs.elements.element import Element
class Property(Element):
fields = [
'source_id',
'dest_id',
'capacity',
'latency',
'packet_loss',
]
| {
"content_hash": "cfd935400d562c6ab882a96c828ac371",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 70,
"avg_line_length": 19.416666666666668,
"alnum_prop": 0.5407725321888412,
"repo_name": "dana-i2cat/felix",
"id": "d4096d659c017bd3533f285ffa95b35cbaba3a64",
"size": "233... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:12700")
else:
access = Se... | {
"content_hash": "d66c16afd1146bb93cf40dfc2b84826e",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 79,
"avg_line_length": 24.166666666666668,
"alnum_prop": 0.6614303959131546,
"repo_name": "aspaas/ion",
"id": "48f7cbb3d36f9b098f69fec415a4a6925039f304",
"size": "7830",
... |
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == "publish":
os.system("python setup.py sdist upload")
sys.exit()
required = ['requests']
setup(
name='chain-python',
version='0.0.3',
description="The Unofficia... | {
"content_hash": "fcc102d161fc5e5430d1551039d33ec4",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 68,
"avg_line_length": 28.125,
"alnum_prop": 0.6186666666666667,
"repo_name": "myusuf3/chain-python",
"id": "b2b1535a3c426701564fefe6bc8fb480b5c85b6c",
"size": "1172",
"b... |
"""count_word_api URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
C... | {
"content_hash": "76a1bfeafac0f1c78778e58b745a792e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 38.63636363636363,
"alnum_prop": 0.6952941176470588,
"repo_name": "rafaelhenrique/count_word_api",
"id": "1fdac152c39e6284159d4180edccd906629ebf77",
... |
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
to output the cont... | {
"content_hash": "dac43da7d29d070a30dea90bca4f7d80",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 55,
"avg_line_length": 25.456521739130434,
"alnum_prop": 0.6293766011955594,
"repo_name": "boosh/pwlocker",
"id": "b24438dd2b3e8e99b4fec384ce2816b3f9205966",
"size": "1171"... |
"""
Jedi is a static analysis tool for Python that can be used in IDEs/editors. Its
historic focus is autocompletion, but does static analysis for now as well.
Jedi is fast and is very well tested. It understands Python on a deeper level
than all other static analysis frameworks for Python.
Jedi has support for two di... | {
"content_hash": "920af817163eb7edd84f348158175086",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 79,
"avg_line_length": 38.16279069767442,
"alnum_prop": 0.7343083485679464,
"repo_name": "nitin-cherian/LifeLongLearning",
"id": "5fe878d310aab0670a85375ee83a15654fc68e79",
... |
"""
Unit tests for EC2 error responses.
"""
from lxml import etree
from nova.api import ec2
from nova import context
from nova import test
from nova import wsgi
class TestClientExceptionEC2(Exception):
ec2_code = 'ClientException.Test'
message = "Test Client Exception."
code = 400
class TestServerExce... | {
"content_hash": "7914d80b3b72aae7c55f6c9ae82b4382",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 76,
"avg_line_length": 38.28225806451613,
"alnum_prop": 0.5982725932167685,
"repo_name": "bclau/nova",
"id": "ce2661d5648d8d0935cb820edd071dabe60ed1b2",
"size": "5359",
... |
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('downloader', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Alarm',... | {
"content_hash": "5d8e020166e44bb356388dd9a2dafb76",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 118,
"avg_line_length": 28.791666666666668,
"alnum_prop": 0.5861070911722142,
"repo_name": "pietermarsman/wakeup",
"id": "645cbddc5cd02f7e596b18a4dab0849a4ea33efd",
"size":... |
"""ACME Identifier Validation Challenges."""
import abc
import codecs
import functools
import hashlib
import logging
import socket
from typing import Type
from cryptography.hazmat.primitives import hashes
import josepy as jose
from OpenSSL import crypto
from OpenSSL import SSL
import requests
from acme import crypto_... | {
"content_hash": "f45a30e87f216377c6f96fa5f2440c9c",
"timestamp": "",
"source": "github",
"line_count": 620,
"max_line_length": 98,
"avg_line_length": 32.475806451612904,
"alnum_prop": 0.6307424882046189,
"repo_name": "stweil/letsencrypt",
"id": "2737f9f22fcac2feeebd7f1fa9138bee008bf0fa",
"size": "... |
import unittest
from programy.config.client.webchat import WebChatConfiguration
from programy.config.file.yaml_file import YamlConfigurationFile
from programy.config.client.client import ClientConfiguration
from programy.config.client.webchat import WebChatClientConfiguration
class WebChatConfigurationTests(unittest... | {
"content_hash": "d43eabb40413e5dce5c092bfcf5852e3",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 74,
"avg_line_length": 32.59139784946237,
"alnum_prop": 0.5836357637743319,
"repo_name": "dkamotsky/program-y",
"id": "d0db380437f116fb45a4d59aa99e513b69dddfe1",
"size": "3... |
"""ansible module for ec2 ami copy to all regions"""
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
DOCUMENTATION = '''
---
module: aos_ami_copy_to_regions
short_description: this module copies an ami out to all regions
description:
- this module accepts an ami id and copies it to all regions
options:... | {
"content_hash": "6f7ca0d1e46735a8ebe6a67addd2e85e",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 90,
"avg_line_length": 29.962264150943398,
"alnum_prop": 0.5447103274559194,
"repo_name": "appuio/ansible-role-openshift-zabbix-monitoring",
"id": "86f8754821b3b2435d946350e... |
# coding=utf-8
__source__ = 'https://leetcode.com/problems/delete-node-in-a-bst/#/description'
# Time: O()
# Space: O()
#
# Description: 450. Delete Node in a BST
#
# Given a root node reference of a BST and a key,
# delete the node with the given key in the BST.
# Return the root node reference (possibly updated) of ... | {
"content_hash": "e648ca922b1881862137eef3a5c4b07a",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 79,
"avg_line_length": 25.257425742574256,
"alnum_prop": 0.5582124656997256,
"repo_name": "JulyKikuAkita/PythonPrac",
"id": "abced0cf8ca4979ca172e121a27820ea62c02c93",
"si... |
from builtins import str
import json
import logging
import pytz
from dateutil.parser import parse
from django.contrib.auth.decorators import permission_required
from django.core.exceptions import MultipleObjectsReturned, ValidationError
from django.core.urlresolvers import reverse, reverse_lazy
from django.db.utils im... | {
"content_hash": "26fadedcfe10b0c49625560cbc0e2e43",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 79,
"avg_line_length": 38.50828729281768,
"alnum_prop": 0.6128407460545193,
"repo_name": "AIFDR/inasafe-django",
"id": "f6b55f18ba59353c245d816733c401adb2678e53",
"size": ... |
from django.db import models
from django_autoslug.fields import AutoSlugField
class Page(models.Model):
title = models.CharField(max_length=255)
slug = AutoSlugField(populate_from=('title',), recursive='parent')
parent = models.ForeignKey('Page', blank=True, null=True)
def __unicode__(self):
r... | {
"content_hash": "efed6ce6e4410a39621b464b9b16a422",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 70,
"avg_line_length": 33.7,
"alnum_prop": 0.712166172106825,
"repo_name": "aljosa/django-autoslug-field",
"id": "b19dc00c865c2d3d0b187b70097fa99e05158f1c",
"size": "337",
... |
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
from test_framework.blocktools import create_block, create_coinbase
'''
AcceptBlockTest -- test processing of unrequested blocks.
Since behavior differs when receiving unr... | {
"content_hash": "5b242eac4498136eba986d514a00af23",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 107,
"avg_line_length": 42.78947368421053,
"alnum_prop": 0.6326363263632636,
"repo_name": "wargo32/Polcoin",
"id": "e715195f754d7358cba0b31247f4484bf0895790",
"size": "123... |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
tasks = Table('tasks', pre_meta,
Column('id', INTEGER, primary_key=True, nullable=False),
Column('priority', INTEGER, nullable=False),
Column('user_id', INTEGER),
Column('de... | {
"content_hash": "16ee6c4da22c8f3461654e62c39b7701",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 68,
"avg_line_length": 28.958333333333332,
"alnum_prop": 0.6438848920863309,
"repo_name": "jasonmaier/CircularEconomyBlog",
"id": "b9d5db7a27e1040ac9436dd76e6cdeef09439a79",
... |
import os
import sys
import unittest
from check_arg import valid_and_doc, default_doc_maker
class TestCheck_Arg(unittest.TestCase):
def setUp(self):
def must_have_key(*needed_keys):
def must_have_key(*a,**kw):
if not kw:
raise Exception("No keyword are provi... | {
"content_hash": "0736d427eb69aa72819382e8189cb1a2",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 112,
"avg_line_length": 33.96,
"alnum_prop": 0.5653710247349824,
"repo_name": "jul/check_arg",
"id": "fb86c7f5c1d0e0faca6c986da46a8001ebfd0cbd",
"size": "1719",
"binary":... |
import renderdoc as rd
import rdtest
import struct
class D3D12_AMD_Shader_Extensions(rdtest.TestCase):
demos_test_name = 'D3D12_AMD_Shader_Extensions'
def check_capture(self):
for pass_type in ["SM51", "SM60"]:
action = self.find_action(pass_type + " Draw")
if action is not N... | {
"content_hash": "19c17c7139f9cb50b5187773b1afff80",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 125,
"avg_line_length": 45.031496062992126,
"alnum_prop": 0.5707291484525266,
"repo_name": "moradin/renderdoc",
"id": "3816842dd9d321323ae3d21e1bf325b2a2ebd207",
"size": "... |
import sqlalchemy
from typing import List
from application.database import global_db
from core.job.helpers import expand_nodelist
class Job(global_db.Model):
__tablename__ = 'job'
__table_args__ = (
global_db.Index('job_index', "job_id", "task_id")
, global_db.UniqueConstraint('job_id', 'task_id', name='uniqu... | {
"content_hash": "9f5f1e9f4b0e74f46c7eaac844aab5fa",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 105,
"avg_line_length": 30.77,
"alnum_prop": 0.6798830029249269,
"repo_name": "srcc-msu/job_statistics",
"id": "f7b6c4bee7fed5123d2d012db189304c963376d7",
"size": "3077",
... |
import hashlib
import locale
import os
from codecs import open
from tempfile import mkdtemp
from shutil import rmtree
import unittest
import subprocess
from pelican import Pelican
from pelican.settings import read_settings
from pelican.tests.support import mute, skipIfNoExecutable, module_exists
CUR_DIR = os.path.dir... | {
"content_hash": "f936df0cb9d6a12f08e998a7bb9d83bd",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 88,
"avg_line_length": 34.77272727272727,
"alnum_prop": 0.6101960784313726,
"repo_name": "kura/kura.io",
"id": "0aaebf07984cb3a32385352966d3fcfd4a0025bb",
"size": "3892",
... |
import os
from pwd import getpwnam
from grp import getgrnam
from MirrorPlugin import MirrorPlugin
class ChangeOwnerException(Exception): pass
class ChangeOwner(MirrorPlugin):
def __init__(self, *args, **kwargs):
try:
m = kwargs['mirror']
config = kwargs['config']
supe... | {
"content_hash": "2c3c717e251aaa6e7e97a92dc9f76bc4",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 86,
"avg_line_length": 30.26829268292683,
"alnum_prop": 0.5616438356164384,
"repo_name": "vramiro/easy-wget-mirror",
"id": "7df166da93df043eca6b47a499cc03e8bfe9ba7b",
"size... |
from __future__ import absolute_import
import pytest
import responses
from requests.exceptions import RequestException
from sentry.lang.javascript.processor import (
BadSource, discover_sourcemap, fetch_sourcemap, fetch_url, generate_module,
trim_line, UrlResult
)
from sentry.lang.javascript.sourcemaps impor... | {
"content_hash": "d57cbb7aaba2ce5e668ca3f68ead41ba",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 238,
"avg_line_length": 49.87412587412587,
"alnum_prop": 0.6661525518788559,
"repo_name": "jokey2k/sentry",
"id": "2e5482fb5d4fd1ba430849180717a1b1891fda7b",
"size": "7157... |
import io
import os
import setuptools
name = 'google-cloud-iot'
description = 'Cloud IoT API API client library'
version = '0.1.0'
release_status = 'Development Status :: 3 - Alpha'
dependencies = [
'google-api-core[grpc] >= 1.4.1, < 2.0.0dev',
'grpc-google-iam-v1 >= 0.11.4, < 0.12dev',
'enum34; python_ve... | {
"content_hash": "70ac2cbca3182f78373a62ff3ded1318",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 69,
"avg_line_length": 29.75,
"alnum_prop": 0.6481792717086835,
"repo_name": "jonparrott/gcloud-python",
"id": "e856f5542affd288c9f2e25c34f848b93a1f77a0",
"size": "2361",
... |
import click
from .comm import pdserver_request
@click.group()
@click.pass_context
def routers(ctx):
"""
(deprecated) Access router information on the controller.
These commands are deprecated. Please use the equivalent commands under
`pdtools cloud --help`.
"""
ctx.obj['routers_url'] = ctx.... | {
"content_hash": "8572232b5bd214e53936d379c7da8a5d",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 85,
"avg_line_length": 25.61111111111111,
"alnum_prop": 0.6047722342733188,
"repo_name": "ParadropLabs/Paradrop",
"id": "1d05dd245ad187b6af590e8184d651ddd7efe879",
"size": ... |
import sys
import time
import random
import commands
import userinterface.Client as Client
from taskbuffer.JobSpec import JobSpec
from taskbuffer.FileSpec import FileSpec
site = sys.argv[1]
cloud = sys.argv[2]
prodDBlock = 'mc09_10TeV.105807.JF35_pythia_jet_filter.evgen.EVNT.e469_tid095268'
inputFile = 'EVNT.095268.... | {
"content_hash": "9d8d16db6b40108f52180706673d7602",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 122,
"avg_line_length": 29.772727272727273,
"alnum_prop": 0.6435114503816793,
"repo_name": "fbarreir/panda-server",
"id": "19b8d4e4b4b2d4f0428f57c744ba5b15cb2016df",
"size"... |
from ..core import dr
from .. import metadata
class MultinodeMetaclass(type):
def __init__(cls, name, bases, dct):
if name != 'MultinodeMetadata' and not name.endswith("Child"):
cls.products.append(name)
super(MultinodeMetaclass, cls).__init__(name, bases, dct)
class MultinodeMetadat... | {
"content_hash": "6edb0006af283a396203fbef6f6ce35e",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 80,
"avg_line_length": 23.843971631205672,
"alnum_prop": 0.6124330755502677,
"repo_name": "wcmitchell/insights-core",
"id": "5ded76c3799cd439e3082390459afff07fc13ff9",
"si... |
import pytest
from vtdiscourse import vtdiscourse
def test_sumary():
parm = vtdiscourse.Parser(name='directors-election-gitbook', githubfile='SUMMARY.md')
summary_data = parm.get_summary
assert len(summary_data) == 4
| {
"content_hash": "f20cfec19be813c1ecfb161bc0b74455",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 89,
"avg_line_length": 23.3,
"alnum_prop": 0.7339055793991416,
"repo_name": "chairco/vtdiscourse",
"id": "cc6dcec5ee82a72b79ca91526d163c2acbd2648c",
"size": "257",
"binar... |
from collections import namedtuple
import numpy as np
from .. import names, prims
from ..ndtypes import (IntT, FloatT, TupleT, FnT, Type, BoolT, NoneT, Float32, Float64, Bool,
ClosureT, ScalarT, PtrT, NoneType, ArrayT, SliceT, TypeValueT)
from ..syntax import (Const, Var, PrimCall, Attr... | {
"content_hash": "49dc6d78aa252898077d42508bfb0b61",
"timestamp": "",
"source": "github",
"line_count": 665,
"max_line_length": 104,
"avg_line_length": 35.51278195488722,
"alnum_prop": 0.584815379403794,
"repo_name": "pombredanne/parakeet",
"id": "3d5005e3565f763a79633f7370623b7172f95b01",
"size": ... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import tempfile
from abc import abstractmethod
from contextlib import contextmanager
from six import binary_type, string_types
from twitter.common.collectio... | {
"content_hash": "d9179e36840d756e87b6cd1dc20b7e17",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 100,
"avg_line_length": 35.83658536585366,
"alnum_prop": 0.6560266793711291,
"repo_name": "scode/pants",
"id": "f1b3222a05eb8752da4e0a3a6e3920a06656aa42",
"size": "14840",... |
from __future__ import absolute_import
import mock
import six
import time
from exam import fixture, patcher
from sentry.quotas.redis import (
is_rate_limited,
BasicRedisQuota,
RedisQuota,
)
from sentry.testutils import TestCase
from sentry.utils.redis import clusters
from six.moves import xrange
def te... | {
"content_hash": "cfcd178e3108ce44c2c5f340e3534dda",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 87,
"avg_line_length": 33.64143426294821,
"alnum_prop": 0.550213169114164,
"repo_name": "looker/sentry",
"id": "7beafece996560bf0614e94dbcad53e7497eaad6",
"size": "8469",
... |
import string
import sys
HEADER = """\
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file automatically generated by testing/generate_gmock_mutant.py.
// DO NOT EDIT.
#ifndef TESTING_GMO... | {
"content_hash": "7397fa7af3c3b1a1144dcec39099f6d0",
"timestamp": "",
"source": "github",
"line_count": 445,
"max_line_length": 80,
"avg_line_length": 33.05842696629213,
"alnum_prop": 0.6557677928081028,
"repo_name": "afandria/mojo",
"id": "9c5678c2f296df5beada9c5f2ecefee48635fc91",
"size": "14900"... |
"""Unit tests for compute API."""
import contextlib
import copy
import datetime
import iso8601
import mock
from mox3 import mox
from oslo.utils import timeutils
from nova.compute import api as compute_api
from nova.compute import arch
from nova.compute import cells_api as compute_cells_api
from nova.compute import d... | {
"content_hash": "427a8eae10cdb39782f9e394c678cfb8",
"timestamp": "",
"source": "github",
"line_count": 2840,
"max_line_length": 79,
"avg_line_length": 44.25774647887324,
"alnum_prop": 0.5654218247780288,
"repo_name": "sajeeshcs/nested_quota_latest",
"id": "c9f90289d9096bcdd61d7766ab4aee25a3cffd59",
... |
try:
import numpy
except ImportError:
pass
from nltk.cluster.util import Dendrogram, VectorSpaceClusterer, cosine_distance
class GAAClusterer(VectorSpaceClusterer):
"""
The Group Average Agglomerative starts with each of the N vectors as singleton
clusters. It then iteratively merges pairs of clu... | {
"content_hash": "98ef8d950e4ea80946fa508652f005c6",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 88,
"avg_line_length": 33.90184049079755,
"alnum_prop": 0.5808903365906624,
"repo_name": "nltk/nltk",
"id": "53d680c00517bfc08bc167d4e300420e0f16cd7f",
"size": "5751",
"... |
from setuptools import setup, find_packages
import sys, os
from dynaform import version
setup(name='dynaform',
version=version,
description="App para crear formularios dinámicos",
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
ins... | {
"content_hash": "9e669201ad470d08640677372017c1aa",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 74,
"avg_line_length": 31.4,
"alnum_prop": 0.6035031847133758,
"repo_name": "ninjaotoko/dynaform",
"id": "d7788f7c2b5c92e133833b870a84dc0d7e4f3bb0",
"size": "783",
"binar... |
import pygame
import threading
import time
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class MagicCard:
def __init__(self,dict):
self.self_servant_effect = dict['self_servant']
self.self_blood_effect = dict['self_blood']
self.enermy_servant_effect = dict['enermy_servant'... | {
"content_hash": "60624a81c9b1b941ceac109faf356234",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 92,
"avg_line_length": 38.49180327868852,
"alnum_prop": 0.5728279386712095,
"repo_name": "diyalujiaf/yewan-s-",
"id": "49c1903403e55dcff1c758b93561f2e5f65966c2",
"size": "2... |
"""
Load Homity Config, Start Services
"""
import logging
from Hub import app
from ConfigParser import SafeConfigParser, NoOptionError, NoSectionError
from couchdb import Server
from v1.Common.helpers import bool_or_string
'''
Parse Config
'''
hub_config = {}
hub_config_parser = SafeConfigParser()
hub_config_parser.... | {
"content_hash": "331d4173a090567ae106ed737296f3a5",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 31.24137931034483,
"alnum_prop": 0.5809418690213393,
"repo_name": "openhomity/homity-hub",
"id": "95e76c98ca3df98f62185469859cfcf8f90366ee",
"size": ... |
from ansible.module_utils.api import basic_auth_argument_spec
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: netapp_e_volume
version_added: "2.2"
short_description: Manage storage volumes (standard and t... | {
"content_hash": "547f9a16ba6db49a527f8486e868c380",
"timestamp": "",
"source": "github",
"line_count": 602,
"max_line_length": 127,
"avg_line_length": 42.63455149501661,
"alnum_prop": 0.5130133250214292,
"repo_name": "nwiizo/workspace_2017",
"id": "2610796585594a825d5fcc7ae3cac3c00bb7f3e5",
"size"... |
"""
Read some json files and print all keys
"""
import os
import sys
import argparse
from roblib import bcolors
import json
__author__ = 'Rob Edwards'
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=' ')
parser.add_argument('-f', help='json file', required=True)
parser.add_argum... | {
"content_hash": "d04a9c711728e972323d8f38bc2d974f",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 73,
"avg_line_length": 21.26923076923077,
"alnum_prop": 0.6220614828209765,
"repo_name": "linsalrob/EdwardsLab",
"id": "7bb356336db45546b57acc3c344840a74eb17ce4",
"size": "... |
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.core.context_processors import csrf
from django.template import RequestContext
from r_pas... | {
"content_hash": "d785a55e2eaf08ac8f17a70659f2c233",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 122,
"avg_line_length": 37.21142857142857,
"alnum_prop": 0.5999692874692875,
"repo_name": "abztrakt/r-pass",
"id": "f6a98df90a194d947ff54f0f3ce619d1d0dffefe",
"size": "651... |
import sys
from KerbalStuff.config import _cfg, _cfgi
from KerbalStuff.database import db, init_db
from KerbalStuff.objects import User
from KerbalStuff.email import send_confirmation
init_db()
if sys.argv[1] == 'delete_user':
user = User.query.filter(User.username == sys.argv[2]).first()
if not user:
... | {
"content_hash": "2c7f91489f832d0fc2a9caa44ffd69b9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 66,
"avg_line_length": 24.944444444444443,
"alnum_prop": 0.6570155902004454,
"repo_name": "ModulousSmash/Modulous",
"id": "73288fc351b3ebb86b865bf580c85de691e25600",
"size"... |
def extractRexjadeWordpressCom(item):
'''
Parser for 'rexjade.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous'... | {
"content_hash": "44fa68fd63c1d02cdcd4707194d3be98",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.6311030741410488,
"repo_name": "fake-name/ReadableWebProxy",
"id": "fd7b4f94d5d5723c157b1c5128961cb5cefa9768",
"... |
from devilry.devilry_message.utils.subject_generator import SubjectTextGenerator
class SubjectTextTestGenerator(SubjectTextGenerator):
def get_subject_text(self):
return 'Test subject'
| {
"content_hash": "cac23b4d81a83ec0d79ce09986aa134e",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 80,
"avg_line_length": 33.166666666666664,
"alnum_prop": 0.7989949748743719,
"repo_name": "devilry/devilry-django",
"id": "0b45a28169501545765263c9f1a028a095cec797",
"size":... |
from ipyparallel import Client
from EXOSIMS.Prototypes.SurveyEnsemble import SurveyEnsemble
import time
from IPython.core.display import clear_output
import sys
import os
import numpy as np
import os.path
import subprocess
class IPClusterEnsemble(SurveyEnsemble):
"""Parallelized suvey ensemble based on IPython pa... | {
"content_hash": "4c431d13d841e8344a35a1e1ce261090",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 130,
"avg_line_length": 39.425,
"alnum_prop": 0.4986683576410907,
"repo_name": "dsavransky/EXOSIMS",
"id": "e7d9f9319bdb6d80ceb4b80a3148748d15cc02b7",
"size": "7885",
"b... |
"""igcollect - MySQL Status
Copyright (c) 2016 InnoGames GmbH
"""
try:
from mysql.connector import connect
except ImportError:
from MySQLdb import connect
from argparse import ArgumentParser
from time import time
def parse_args():
parser = ArgumentParser()
parser.add_argument('--prefix', default='m... | {
"content_hash": "3932143fc563c84cd7faf6fccc232f93",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 92,
"avg_line_length": 26.175,
"alnum_prop": 0.5630372492836676,
"repo_name": "innogames/igcollect",
"id": "967f78b0bca71d1b6ae82253a0f5933c818ce148",
"size": "2116",
"bi... |
"""Tests for linear.py in the exp_framework module."""
from absl.testing import absltest
from sparse_data.exp_framework import linear
from sparse_data.exp_framework.dnn_test import TestModel
class TestLinear(TestModel):
def setUp(self):
super(TestLinear, self).setUp()
self.submodule = linear
if __name_... | {
"content_hash": "905793681f49b1ea0e1feeb58b6b73f8",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 56,
"avg_line_length": 20.88235294117647,
"alnum_prop": 0.7183098591549296,
"repo_name": "google-research/google-research",
"id": "4bdd2bdcd99eba1b8cdd475a4b2be164408206b3",
... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/naboo/shared_gungan_statue_s02.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "947347e26445681fa5f1894d91062763",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 79,
"avg_line_length": 23.692307692307693,
"alnum_prop": 0.6948051948051948,
"repo_name": "obi-two/Rebelion",
"id": "0264081f8a507880d69b3380a8d734f1bffa3fc2",
"size": "453... |
from django.shortcuts import render, redirect
from django.views.generic import View, TemplateView
from django.http import HttpResponse
from django.core.mail import EmailMessage
from django.conf import settings
from .forms import NewEmail
from .models import Tarea
class homework(View):
template_name = 'homework.html'
... | {
"content_hash": "128e875e5064a8c6f829684ba3387c8f",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 82,
"avg_line_length": 28.692307692307693,
"alnum_prop": 0.7292225201072386,
"repo_name": "diego-d5000/Estudiala",
"id": "c5bc512a73169149c2f785d7448a332a360eee98",
"size":... |
"""
Twitter Authentication
"""
from .oauthclient import client
from django.conf.urls import url
from django.urls import reverse
from django.http import HttpResponseRedirect
from helios_auth import utils
import logging
from django.conf import settings
API_KEY = settings.TWITTER_API_KEY
API_SECRET = settings.TWITTER... | {
"content_hash": "281c568b4dc05229e7ca594fc7b6c73e",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 178,
"avg_line_length": 32.54545454545455,
"alnum_prop": 0.7129888268156425,
"repo_name": "benadida/helios-server",
"id": "541ac4df7cd874259a71be3566246fa3b2a48b57",
"size... |
"""Extract date & time from text having today, tomorrow, yesterday, etc."""
import re
import datetime
from chronos.extractor.base import Extractor
class RelativeDayExtractor(Extractor):
def __init__(self, ref=None):
super(RelativeDayExtractor, self).__init__(ref)
self.patterns = {re.compile(r"""... | {
"content_hash": "ed7e145371c942d5c1894864d84c1ce7",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 114,
"avg_line_length": 40.0735294117647,
"alnum_prop": 0.5077064220183486,
"repo_name": "cnu/chronos",
"id": "19f51ad30db8ab33a22ca3553ee81ede0b93c0e4",
"size": "5497",
... |
"""
=====================
Workflow from scratch
=====================
"""
import nipype.interfaces.io as nio # Data i/o
import nipype.interfaces.spm as spm # spm
import nipype.pipeline.engine as pe # pypeline engine
import nipype.algorithms.modelgen as model # model specification
from ni... | {
"content_hash": "578cb838788b03c1018e168d0af9b8dd",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 80,
"avg_line_length": 51.2536231884058,
"alnum_prop": 0.7299589990103209,
"repo_name": "christianbrodbeck/nipype",
"id": "fc36a9ae65702231296bfc3710db5da6140930c2",
"size... |
import RPIO
def gpio_callback(gpio_id, val):
print("gpio %s: %s" % (gpio_id, val))
def socket_callback(socket, val):
print("socket %s: '%s'" % (socket.fileno(), val))
socket.send("echo: %s\n" % val)
# GPIO 中断回调
RPIO.add_interrupt_callback(7, gpio_callback)
RPIO.add_interrupt_callback(9, gpio_callback, pu... | {
"content_hash": "86886ba721086c62f949b8cda1031dfd",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 25.5,
"alnum_prop": 0.6862745098039216,
"repo_name": "quchunguang/test",
"id": "ae80f0a3f742e959fba14f2ba7aff8f5179bc1a6",
"size": "491",
"binary":... |
from itertools import tee
from six import string_types
import jmespath
import json
import base64
import logging
from botocore.exceptions import PaginationError
from botocore.compat import zip
from botocore.utils import set_value_from_jmespath, merge_dicts
log = logging.getLogger(__name__)
class PaginatorModel(obj... | {
"content_hash": "b2e17e5be9d86a25da12488b3e987515",
"timestamp": "",
"source": "github",
"line_count": 498,
"max_line_length": 79,
"avg_line_length": 40.592369477911646,
"alnum_prop": 0.5787286668315608,
"repo_name": "lordmuffin/aws-cfn-plex",
"id": "e817dd4e1ba251e6cd60ebebe99d50f6bc59c819",
"siz... |
"""
Type inference base on CPA.
The algorithm guarantees monotonic growth of type-sets for each variable.
Steps:
1. seed initial types
2. build constraints
3. propagate constraints
4. unify types
Constraint propagation is precise and does not regret (no backtracing).
Constraints push types forward fol... | {
"content_hash": "52ddda9487aac6bd226a6d799a5c9476",
"timestamp": "",
"source": "github",
"line_count": 1780,
"max_line_length": 97,
"avg_line_length": 39.938202247191015,
"alnum_prop": 0.5341960894640596,
"repo_name": "numba/numba",
"id": "98295d899b34719a09fa4992b091c389892b8df8",
"size": "71090"... |
from __future__ import unicode_literals
from django.core.management.base import NoArgsCommand, CommandError
from django.test.client import RequestFactory
from allaccess.models import Provider
class Command(NoArgsCommand):
"Convert existing providers from django-social-auth to django-all-access."
def handle... | {
"content_hash": "5f97269904c95045f6cbefd30a5793cb",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 96,
"avg_line_length": 48.24324324324324,
"alnum_prop": 0.584873949579832,
"repo_name": "hydroshare/hydroshare-demo-auth",
"id": "b579644888d281271d5d16cafd64ba54750fc6bd",
... |
from django.conf.urls import url, include
from django.views.generic import ListView, DetailView
from . import views
urlpatterns = [
url(r'^$', views.fetch_places, name= 'list'),
url(r'^foo/', views.fetch_places_loc, name='foo'),
url(r'^create/$', views.post_create),
url(r'^(?P<id>\d+)/$', views.post_detai... | {
"content_hash": "54e211f17ea69ef444686d0ac97d71ad",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 69,
"avg_line_length": 40.166666666666664,
"alnum_prop": 0.6244813278008299,
"repo_name": "radamizell/WallApp",
"id": "22fcb14c04cc74c1cf15646d73ff8cfa79ef030e",
"size": "4... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('ringapp', '0040_auto_20170906_22... | {
"content_hash": "e78b734eb924fef5d15ad011b136daaf",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 133,
"avg_line_length": 27.56,
"alnum_prop": 0.6298984034833092,
"repo_name": "rschwiebert/RingApp",
"id": "df15f54ee743de60200c1052e0a3f521756bccb6",
"size": "761",
"bin... |
if __name__ == "__main__":
import openpnm as op
import porespy as ps
import numpy as np
import os
from pathlib import Path
# %% Read image from file in fixtures
path = Path(os.path.realpath(__file__),
'../../../tests/fixtures/berea_100_to_300.npz')
data = np.load(path.... | {
"content_hash": "ff5c95ac843d67a71684ec5fade44943",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 86,
"avg_line_length": 37.108695652173914,
"alnum_prop": 0.5884592852958407,
"repo_name": "PMEAL/OpenPNM",
"id": "82e4ba93c289f271a039c8423e806747c8ee83ec",
"size": "3414",... |
"""RemoveKeyFromList
Removes a Key from a JSON-backed List
"""
import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
from typing import Dict, Any
import traceback
''' STANDALONE FUNCTION '''
def remove_key_from_... | {
"content_hash": "9be2c7a53ce4dd48eb9c2bd1033a515e",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 97,
"avg_line_length": 27.858974358974358,
"alnum_prop": 0.6438104003681546,
"repo_name": "VirusTotal/content",
"id": "d27544af10e70475b1a9bea3e3566e13e67575d5",
"size": "2... |
from setuptools import setup, find_packages
setup(
name='zeit.care',
version='0.3.dev0',
author='gocept, Zeit Online',
author_email='zon-backend@zeit.de',
url='http://www.zeit.de/',
description="Helper scripts for managing DAV content",
packages=find_packages('src'),
package_dir={'': '... | {
"content_hash": "5a73d0a1a0defd1abf0c4eb58c84a79f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 58,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.6415289256198347,
"repo_name": "ZeitOnline/zeit.care",
"id": "ae7100aa84f7913c14b14fb0cc058ee9610ce264",
"size": ... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "Quantization", sigma = 0.0, exog_count = 20, ar_order = 0); | {
"content_hash": "33fdf9a02a73ae82adbbe31fe0c0d928",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 166,
"avg_line_length": 38,
"alnum_prop": 0.706766917293233,
"repo_name": "antoinecarme/pyaf",
"id": "b0029ab23484ee3988c3e11377762fa4d9b36283",
"size": "266",
"binary": f... |
from django.db import migrations, models
import saleor.core.utils.json_serializer
class Migration(migrations.Migration):
dependencies = [
("page", "0013_update_publication_date"),
]
operations = [
migrations.AddField(
model_name="page",
name="metadata",
... | {
"content_hash": "73c0a320839680d5a33e35b8fecba68e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 76,
"avg_line_length": 26.12121212121212,
"alnum_prop": 0.5197215777262181,
"repo_name": "mociepka/saleor",
"id": "c01f53dfdcf2e2031e27c6b42578328e814898af",
"size": "911",... |
from __future__ import unicode_literals
import swapper
from accelerator_abstract.models.base_startup_program_interest import (
BaseStartupProgramInterest
)
class StartupProgramInterest(BaseStartupProgramInterest):
class Meta(BaseStartupProgramInterest.Meta):
swappable = swapper.swappable_setting(
... | {
"content_hash": "dccd625777ee191a564a5e42ef773713",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 71,
"avg_line_length": 29.357142857142858,
"alnum_prop": 0.7664233576642335,
"repo_name": "masschallenge/django-accelerator",
"id": "0e426651dcbd5c3b7514ce288caa460ce41fed3d"... |
from befh.ws_api_socket import WebSocketApiClient
from befh.market_data import L2Depth, Trade
from befh.exchanges.gateway import ExchangeGateway
from befh.instrument import Instrument
from befh.clients.sql_template import SqlClientTemplate
from befh.util import Logger
import time
import threading
import json
from funct... | {
"content_hash": "b00e6c2302d0b0eca4ad1cedfa072bd0",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 129,
"avg_line_length": 37.22314049586777,
"alnum_prop": 0.5721580817051509,
"repo_name": "Aurora-Team/BitcoinExchangeFH",
"id": "b5cb1e3d25414106e3dcd42f66fd03c8644eb755",
... |
__version__ = '0.2'
__all__ = ['opmap', 'opname', 'opcodes',
'cmp_op', 'hasarg', 'hasname', 'hasjrel', 'hasjabs',
'hasjump', 'haslocal', 'hascompare', 'hasfree', 'hascode',
'hasflow', 'getse',
'Opcode', 'SetLineno', 'Label', 'isopcode', 'Code',
'CodeList', 'printc... | {
"content_hash": "c66197fdf8d647f0b1b00e0acb141229",
"timestamp": "",
"source": "github",
"line_count": 903,
"max_line_length": 95,
"avg_line_length": 36.46843853820598,
"alnum_prop": 0.5346026540341927,
"repo_name": "rootpy/rootpy",
"id": "c73d5a979884c89e99533e4d3e8a08db08218a83",
"size": "33874"... |
from oslo_config import cfg
from oslo_utils import timeutils
import webob.exc
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
from cinde... | {
"content_hash": "834919f0f99d5e4142d75aad7b5e8f2d",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 79,
"avg_line_length": 34.68279569892473,
"alnum_prop": 0.5825453418074718,
"repo_name": "blueboxgroup/cinder",
"id": "c0971bec816d8ae184679a9c59c77284a313a279",
"size": "... |
"""
Set of "markup" template filters for Django. These filters transform plain text
markup syntaxes to HTML; currently there is support for:
* Textile, which requires the PyTextile library available at
http://loopcore.com/python-textile/
* Markdown, which requires the Python-markdown library from
... | {
"content_hash": "8fa8700a4e89940e5d74efabfec09f42",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 130,
"avg_line_length": 39.12222222222222,
"alnum_prop": 0.672536211303607,
"repo_name": "fcurella/django-markup-deprecated",
"id": "9fc5ed2f628fd43f1e9bff199c2cadb1da7c51ab"... |
"""
Views for managing Nova instances.
"""
import logging
from django import http
from django import template
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core import validators
from django.shortcuts import redirect, render_to_response
from django_openstack... | {
"content_hash": "ec9217b964b3d19be5bbfc8253a5e141",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 78,
"avg_line_length": 36.62280701754386,
"alnum_prop": 0.6634730538922156,
"repo_name": "cloud-smokers/openstack-dashboard",
"id": "5bdb7536f6ca3388825a5d77ba147c8e84519f62... |
"""
Read SAS7BDAT files
Based on code written by Jared Hobbs:
https://bitbucket.org/jaredhobbs/sas7bdat
See also:
https://github.com/BioStatMatt/sas7bdat
Partial documentation of the file format:
https://cran.r-project.org/web/packages/sas7bdat/vignettes/sas7bdat.pdf
Reference for binary data compression:
h... | {
"content_hash": "6f83c415eca6744361b221705d9153db",
"timestamp": "",
"source": "github",
"line_count": 687,
"max_line_length": 103,
"avg_line_length": 39.985443959243085,
"alnum_prop": 0.5664361121223153,
"repo_name": "louispotok/pandas",
"id": "4d187a828285981ecd5d338cda903156c25d4c1f",
"size": "... |
from urllib.parse import urljoin
from django.conf import settings
from django.template import TemplateSyntaxError
from django.templatetags.static import StaticNode
from django.test import SimpleTestCase, override_settings
from ..utils import setup
@override_settings(INSTALLED_APPS=[], MEDIA_URL='media/', STATIC_URL... | {
"content_hash": "c0b6edf6d8c3d9d58ca96e7737e5c81d",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 103,
"avg_line_length": 47.2906976744186,
"alnum_prop": 0.6513400540939267,
"repo_name": "atul-bhouraskar/django",
"id": "6f27d555bf6532f6e053671d93a9a0063d4fd2a7",
"size":... |
import ddt
from openstackinabox.tests.base import TestBase, DbFailure
from openstackinabox.models.keystone import exceptions
from openstackinabox.models.keystone.db.tenants import KeystoneDbTenants
@ddt.ddt
class TestKeystoneDbTenants(TestBase):
def setUp(self):
super(TestKeystoneDbTenants, self).setUp... | {
"content_hash": "cf385b86c0dc20b02535cb7033446b84",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 72,
"avg_line_length": 28.309322033898304,
"alnum_prop": 0.4964825624906451,
"repo_name": "TestInABox/openstackinabox",
"id": "93254bbb0379c69ffd8f1f8d8229e4c4eba42ef3",
"... |
import socket
import pickle
import zmq
import sys
import argparse,imp
parser = argparse.ArgumentParser()
parser.add_argument("--config_path", help="config.py file path")
args = parser.parse_args()
config=imp.load_module("config",*imp.find_module('config',[args.config_path]))
use_fdm=False
if use_fdm:
sys.path.a... | {
"content_hash": "b2c546922ac2b732ec0fa478a24a4229",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 118,
"avg_line_length": 25.977011494252874,
"alnum_prop": 0.6,
"repo_name": "orig74/DroneSimLab",
"id": "6250712b2194cd1deccaa75ac18b0250c645189b",
"size": "2314",
"binar... |
import functools
import operator
import unittest
from itertools import count
import six
from scrapy.utils.python import (
memoizemethod_noargs, isbinarytext, equal_attributes,
WeakKeyCache, stringify_dict, get_func_args, to_bytes, to_unicode,
without_none_values)
__doctests__ = ['scrapy.utils.python']
c... | {
"content_hash": "a19cd06a3fbf479471a8f5d8f5c30b25",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 85,
"avg_line_length": 33.15625,
"alnum_prop": 0.5796418473138548,
"repo_name": "jdemaeyer/scrapy",
"id": "4f08349020f9661b2dbbf7ec910a8be675d29cfd",
"size": "7427",
"bi... |
"""Delay space spectrum estimation and filtering."""
import typing
import numpy as np
from numpy.lib.recfunctions import structured_to_unstructured
import scipy.linalg as la
from caput import mpiarray, config
from cora.util import units
from ..core import containers, task, io
from ..util import random
class Delay... | {
"content_hash": "3b3bc9f62696e7acf80d5b522cfc95e0",
"timestamp": "",
"source": "github",
"line_count": 1292,
"max_line_length": 90,
"avg_line_length": 35.725232198142415,
"alnum_prop": 0.606321901336742,
"repo_name": "radiocosmology/draco",
"id": "0d3d9eb07f5e994f9161a4c02f40980f3869871c",
"size":... |
from abc import ABCMeta, abstractmethod
import numpy as np
class BatchIterator(object):
__metaclass__ = ABCMeta
def __init__(self, batch):
self.batch = batch
self.current_batch = -1
@abstractmethod
def next_batch(self):
pass
def back2start(self):
self.current_batch = -1
def next(self):
next_batch ... | {
"content_hash": "a71035e076554f94cdfb0e9f825cd5d9",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 117,
"avg_line_length": 23.2875,
"alnum_prop": 0.6859903381642513,
"repo_name": "jasonwbw/EffictiveRBM",
"id": "f06b682152aa2bf25bf93e4fc24e1bbe522b591b",
"size": "1942",
... |
""" RemoveNamedArguments turns named arguments into regular ones. """
from pythran.analyses import Aliases
from pythran.passmanager import Transformation
from pythran.syntax import PythranSyntaxError
import ast
class RemoveNamedArguments(Transformation):
'''
Replace call with named arguments to regular cal... | {
"content_hash": "12e8654e64ae3508b787d6b8acb0b5e4",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 79,
"avg_line_length": 38.44565217391305,
"alnum_prop": 0.5515973989256432,
"repo_name": "artas360/pythran",
"id": "198d64ee73afe4990b3266cdba8d1675a020be78",
"size": "3537... |
from django import template
register = template.Library()
class VarNode(template.Node):
def __init__(self, var_name, var_to_resolve):
self.var_name = var_name
self.var_to_resolve = var_to_resolve
def get_context(self, top_context):
for context in top_context.dicts:
... | {
"content_hash": "71a26d0a862ac7564f86070c7b17f79a",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 70,
"avg_line_length": 27.6,
"alnum_prop": 0.5523349436392915,
"repo_name": "manufacturedba/pinax",
"id": "e209fbf0610b30dcdb17ed3e47a5ff8a7044195c",
"size": "1242",
"bin... |
import re
try:
from urllib import quote
except ImportError:
from urllib.parse import quote
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
CLEAN_LINK = re.compile('(?<=^\/)\/+|\/+$')
CLEAN_WORD = re.compile('[\[\],().:;"\/\'?*%!*+=@$;#%{}`~\r\n\t]')
LONG_DASH = re.compile('(\—)')
MIN_TAG_LE... | {
"content_hash": "acb5a5ed58aeb3b53bacf90cf2fc2e9a",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 108,
"avg_line_length": 39.178082191780824,
"alnum_prop": 0.5223776223776224,
"repo_name": "ednapiranha/auto-tagify",
"id": "344d1f148d4f85b90f72e84da696990b4f659808",
"siz... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('conservation', '0006_managementaction_document'),
]
operations = [
migrations.RemoveField(
model_name='document',
name='management_actions',
),
]
| {
"content_hash": "f7d190e3fc38fb9be653202236a2b46a",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 59,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.5967213114754099,
"repo_name": "parksandwildlife/wastd",
"id": "910966f8810156e6f4e983828d5589135508e533",
"size"... |
"""Main entry point"""
import sys
if sys.argv[0].endswith("__main__.py"):
sys.argv[0] = "nose2"
__unittest = True
if __name__ == '__main__':
from nose2 import discover
discover()
| {
"content_hash": "d1f3d3257faac4aee7b4eba2471dd9d5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 39,
"avg_line_length": 16.25,
"alnum_prop": 0.5794871794871795,
"repo_name": "ezigman/nose2",
"id": "b8bbf93f48811aae7e8fd1f303e5f83af91a16c0",
"size": "195",
"binary": f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.