text stringlengths 4 1.02M | meta dict |
|---|---|
import string, types, sys, os, StringIO, re, shlex, json, zipfile
from collections import OrderedDict
from django.contrib.auth.decorators import login_required
from django.core.servers.basehttp import FileWrapper
from django.http import HttpResponse, HttpResponseNotFound
from django.shortcuts import render_to_response,... | {
"content_hash": "4aa29c9662493449db25c4664fded229",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 143,
"avg_line_length": 39.62138728323699,
"alnum_prop": 0.6168210664526953,
"repo_name": "LighthouseHPC/lighthouse",
"id": "fdf45681405514a28a999b9def306981cdc614fd",
"si... |
import numpy as np
def select(table, predicate, label):
col = table.data.ca[label]
nchunks = col.nchunks
query = np.vectorize(predicate)
qs = list()
for nchunk in range(nchunks):
qi = list(query(col.chunks[nchunk][:]))
qs.append(qi)
return qs
def select2(table, predicate, lab... | {
"content_hash": "4aac6fde6a972839585d494f1c360544",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 53,
"avg_line_length": 22.586206896551722,
"alnum_prop": 0.6030534351145038,
"repo_name": "seibert/blaze-core",
"id": "11ea9d10ff5ada939be992ad70fbb0340a54df90",
"size": "6... |
from django.conf.urls import patterns, include, url
from rest_framework.routers import DefaultRouter
from api import views as api_views
router = DefaultRouter(trailing_slash=False)
router.register('todos', api_views.TodoViewSet)
urlpatterns = router.urls
from django.shortcuts import redirect
urlpatterns += (
url(... | {
"content_hash": "0c30564f1b5d069e63a6430a0f387ea1",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 68,
"avg_line_length": 31.916666666666668,
"alnum_prop": 0.7754569190600522,
"repo_name": "dgouldin/djangocon-eu-2015",
"id": "0942074aa665c38c4cbfc2ce782932bc8371abaf",
"s... |
import os
import sys
import time
import errno
import select
import logging
import yaml
import argparse
import paramiko
def init_logger():
log = logging.getLogger('cluster_install')
log.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
formatter = lo... | {
"content_hash": "4b8783a8197ab8717ab80efcff9a209a",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 79,
"avg_line_length": 35.48148148148148,
"alnum_prop": 0.6128839844915002,
"repo_name": "cloudify-cosmo/cloudify-dev",
"id": "bbf03331c4191a654258b458f51b92a27c2044f2",
"... |
from __future__ import print_function, division
import sys
sys._running_pytest = True
import pytest
from sympy.core.cache import clear_cache
def pytest_report_header(config):
from sympy.utilities.misc import ARCH
s = "architecture: %s\n" % ARCH
from sympy.core.cache import USE_CACHE
s += "cache: ... | {
"content_hash": "85b02d15d4941495df2119ed52ea794e",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 73,
"avg_line_length": 28.096153846153847,
"alnum_prop": 0.6447638603696099,
"repo_name": "kmacinnis/sympy",
"id": "06bf053dc5204fb786599160bfbad8fdf5a499dd",
"size": "1461... |
from typing import Any, Dict, List, Optional, Sequence, Union
from airflow.models import BaseOperator
from airflow.utils.context import Context
from airflow.utils.email import send_email
class EmailOperator(BaseOperator):
"""
Sends an email.
:param to: list of emails to send the email to. (templated)
... | {
"content_hash": "307dfbc04ccf9cf70eab78704cb52c04",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 79,
"avg_line_length": 33.507246376811594,
"alnum_prop": 0.5994809688581315,
"repo_name": "lyft/incubator-airflow",
"id": "220bafa944b12d4a506753dfd6552499ee2ef9c6",
"size"... |
"""
test_distancetable
----------------------------------
Tests for `distancetable` module.
"""
import unittest
from smartrcs.scanner.distancetable import DistanceTable
class TestDistanceTable(unittest.TestCase):
def test___init__(self):
# Create a valid and common dt ad get inside table size
... | {
"content_hash": "dc45040a635e9574403e1bdfbd84f471",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 105,
"avg_line_length": 28.788235294117648,
"alnum_prop": 0.5823457294646506,
"repo_name": "ottoszika/smartrcs",
"id": "51521b7a6e19371d0034b59f49337633560859bb",
"size": "... |
import sys
from typing import Any
from google.api_core.extended_operation import ExtendedOperation
from google.cloud import compute_v1
def wait_for_extended_operation(
operation: ExtendedOperation, verbose_name: str = "operation", timeout: int = 300
) -> Any:
"""
This method will wait for the extended (l... | {
"content_hash": "af67d6f9301c107cb2da95497d55d48b",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 102,
"avg_line_length": 37.598130841121495,
"alnum_prop": 0.6982351478995774,
"repo_name": "googleapis/python-compute",
"id": "1041206c9144ef0c80e947b7099e44bf456dfd52",
"... |
from tests import unittest
from twisted.internet import defer
from synapse.storage.profile import ProfileStore
from synapse.types import UserID
from tests.utils import setup_test_homeserver
class ProfileStoreTestCase(unittest.TestCase):
@defer.inlineCallbacks
def setUp(self):
hs = yield setup_test_... | {
"content_hash": "c2b2be0d8cbd988e2d2112192625cf38",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 78,
"avg_line_length": 25.770833333333332,
"alnum_prop": 0.6273241713823767,
"repo_name": "howethomas/synapse",
"id": "1fa783f313ede08af3b01251c41497701f9d6264",
"size": "1... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion as deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "8d49ae34e9694587d01c93aea256052a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 114,
"avg_line_length": 34.38461538461539,
"alnum_prop": 0.6006711409395973,
"repo_name": "kpi-web-guild/django-girls-blog-pavlenk0",
"id": "31216b0b6a19f6df8d1296f1add58acca... |
from __future__ import unicode_literals
import frappe
import unittest
import requests
from frappe.utils import get_site_url
scripts = [
dict(
name='test_todo',
script_type = 'DocType Event',
doctype_event = 'Before Insert',
reference_doctype = 'ToDo',
script = '''
if "test" in doc.description:
doc.status ... | {
"content_hash": "dccce1cd55ee76b22ff76aa458aa2a05",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 115,
"avg_line_length": 27.21818181818182,
"alnum_prop": 0.6890447561790247,
"repo_name": "saurabh6790/frappe",
"id": "aac8b3deed8719531c396b71e345075c2b8e9210",
"size": "... |
import sys
print('%', ' '.join(sys.argv))
for line in sys.stdin:
sys.stdout.write(line)
| {
"content_hash": "4e25a494baa2fecba9ff68ac73460b31",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 30,
"avg_line_length": 23,
"alnum_prop": 0.6521739130434783,
"repo_name": "Lemma1/MAC-POSTS",
"id": "2a23d95fc20b81014bfb36fdc4c707f53e129da1",
"size": "114",
"binary": fa... |
"""Utilities to automate running tests under app verifier."""
import os
import os.path
import re
import subprocess
import sys
import tempfile
import win32com.client.gencache as gencache
import xml.sax
import xml.sax.handler
TRACE_RE_ = re.compile('(?P<module>\w+)' # Module
'(?:'
'!' # Separator
'(?... | {
"content_hash": "c242747c36ab958f8435e3fda6cc0389",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 80,
"avg_line_length": 26.614197530864196,
"alnum_prop": 0.6326104603966137,
"repo_name": "pombreda/syzygy",
"id": "2585cfa7545e5ec134ee3778558431a83dbb4fb0",
"size": "922... |
"""Climate platform for Advantage Air integration."""
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
FAN_AUTO,
FAN_HIGH,
FAN_LOW,
FAN_MEDIUM,
HVAC_MODE_AUTO,
HVAC_MODE_COOL,
HVAC_MODE_DRY,
HVAC_MODE_FAN_ONLY,
HVAC_MODE_... | {
"content_hash": "6a41e17999bf11125538756729c15721",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 86,
"avg_line_length": 31.590697674418603,
"alnum_prop": 0.5834805653710248,
"repo_name": "sander76/home-assistant",
"id": "1e6027b8db6117345f0bd5158188c6c9aa2ddb3d",
"siz... |
print("hello")
print("world")
print("bye.")
| {
"content_hash": "a7c7f0102e3385f42e7ba7a2a68208dc",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 14,
"avg_line_length": 14.666666666666666,
"alnum_prop": 0.6363636363636364,
"repo_name": "go-python/gpython",
"id": "fdbccfc16cc829c60e1db632f4b5b9599f9fff3d",
"size": "209... |
"""Self-test suite for Cryptodome.Cipher.DES3"""
import unittest
from binascii import hexlify
from Cryptodome.Cipher import DES3
from Cryptodome.Util.strxor import strxor_c
from Cryptodome.Util.py3compat import bchr, unhexlify, tostr
from Cryptodome.SelfTest.loader import load_tests
from Cryptodome.SelfTest.st_commo... | {
"content_hash": "a84d33f1b4d28705bd3fe12fbfa5a9cf",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 91,
"avg_line_length": 33.76335877862596,
"alnum_prop": 0.5880624010852362,
"repo_name": "chronicwaffle/PokemonGo-DesktopMap",
"id": "4049e67e25ffc717d02f9998cd90d1dbb4e5200... |
import Axon
import time
import Queue
class ThreadWrap(Axon.ThreadedComponent.threadedcomponent):
Inboxes = {
"inbox":"From the outside world",
"control":"From the outside world",
"_inbox":"From the component to go to the outside world",
"_control":"From the component to go to the outsid... | {
"content_hash": "39852bda685b81798dad17085c9b8518",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 92,
"avg_line_length": 32.28,
"alnum_prop": 0.5926270136307311,
"repo_name": "bbc/kamaelia",
"id": "af378333caf437c681d078b67c053af52da829d4",
"size": "4288",
"binary": ... |
"""Custom news feeds for the multilingual project blog."""
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from multilingual_news.feeds import NewsEntriesFeed
class CustomNewsEntriesFeed(NewsEntriesFeed):
"""
Customized to get the universal content link, tha... | {
"content_hash": "81786fcb1f1b24e3aed823e0ca459e10",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 33.21052631578947,
"alnum_prop": 0.6109350237717908,
"repo_name": "bigee/django-multilingual-project-blog",
"id": "6665600e383d206556f91b9ad4c798a0b073... |
import numpy as np
import re
from collections import defaultdict
from contextlib import closing
import MySQLdb
from webservices.ndwserror import NDWSError
import logging
logger = logging.getLogger("neurodata")
"""
.. module:: ramonddb
:synopsis: Manipulate/create/read annotations in the ramon format
.. moduleauth... | {
"content_hash": "bcb10da95d378a0159fad6e8af7420d6",
"timestamp": "",
"source": "github",
"line_count": 504,
"max_line_length": 221,
"avg_line_length": 33.8531746031746,
"alnum_prop": 0.5951236666275935,
"repo_name": "neurodata/ndstore",
"id": "ac6cde46546080e026ef5f1ab708d265b4dec3d4",
"size": "17... |
"""
flasticket
~~~~~~~~~~~~~
comment: Simple Ticket Reservation System
:copyright: (c) 2014 by liks. ( Jou Sung Shik, liks79 __at__ gmail.com )
:license: MIT LICENSE 2.0 (http://opensource.org/licenses/MIT).
"""
from flask import Flask, render_template, request, session, Response, redirect, url_fo... | {
"content_hash": "019ad420ed0f8832d6e288ef769bb248",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 87,
"avg_line_length": 21.964912280701753,
"alnum_prop": 0.639776357827476,
"repo_name": "liks79/flasticket",
"id": "ef720e71e5c6572e603bff5f440d07e6b2df71ec",
"size": "127... |
"""
Demo microbes service and methods
"""
__author__ = 'Dan Gunter <dkgunter@lbl.gov>, Bill Riehl <wjriehl@lbl.gov>, Michael Sneddon <mwsneddon@lbl.gov>, Roman Sutormin <rsutormin@lbl.gov>'
__date__ = '11/15/13'
## Imports
# Stdlib
import json
import os
import random
import numbers
import uuid
import hashlib
import re... | {
"content_hash": "574387340c18aa03917add4c3482cbe5",
"timestamp": "",
"source": "github",
"line_count": 1055,
"max_line_length": 179,
"avg_line_length": 36.55260663507109,
"alnum_prop": 0.6649638254285196,
"repo_name": "nlharris/narrative",
"id": "510f4315369e20ef847a1414caa92bfa2304958c",
"size": ... |
"""Tests for tensorflow.ops.gradients."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import warnings
import numpy as np
from tensorflow.python.client import session
from tensorflow.python.eager import backprop
from tensorflow.python.eager ... | {
"content_hash": "a3f0bb5f15b03589d52ab11a65891255",
"timestamp": "",
"source": "github",
"line_count": 1090,
"max_line_length": 84,
"avg_line_length": 36.35963302752294,
"alnum_prop": 0.6294660880096892,
"repo_name": "Bismarrck/tensorflow",
"id": "c53afef63bc1d2fc1ba1927c687f7ecad4eb46a4",
"size":... |
import os
from rbuild.productstore import dirstore
from testutils import mock
from rbuild_test import rbuildhelp, mockproddef
class EditTest(rbuildhelp.RbuildHelper):
def newProductDefinition(self):
self.cfg.initializeFlavors()
return mockproddef.getProductDefinition(self.cfg)
def testCommand... | {
"content_hash": "93b058aadeeffae99a9e6a841a1cbed2",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 78,
"avg_line_length": 38.613138686131386,
"alnum_prop": 0.6179584120982987,
"repo_name": "fedora-conary/rbuild",
"id": "4d83152afbc004ca1f2b1bb98c70b0903d0f72a5",
"size":... |
import re
from pallium.condition import GangliaBooleanTree
from pallium.config import load_json_config, _STR_RE_VALID_TAG, valid_tag
from pallium.util import SuperDict, files_from_dir
DEFAULT_ALERT = {
"name": None,
"description": None,
"options": {
"threshold": 1,
"priority": "low",
"grouped": False... | {
"content_hash": "68bfbc2e49a8fc65a19bc0113fb80459",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 81,
"avg_line_length": 25.597014925373134,
"alnum_prop": 0.580466472303207,
"repo_name": "jcmcken/pallium",
"id": "63fc5466522d9de4c6944dc86682941f18ecbbca",
"size": "3431... |
import pyPdf
def getPDFContent(path):
content = ""
# Load PDF into pyPDF
pdf = pyPdf.PdfFileReader(file(path, "rb"))
# Iterate pages
for i in range(0, pdf.getNumPages()):
# Extract text from page and add to content
content += pdf.getPage(i).extractText() + "\n"
# Collapse whites... | {
"content_hash": "42b241f03089f3cec785d4420e2a02a0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 76,
"avg_line_length": 32.733333333333334,
"alnum_prop": 0.6435845213849287,
"repo_name": "lamahechag/CC-QuantitativeAnalysis",
"id": "48a555ae66d77a0485327ebde108d1e6681a5a4... |
"""This module provides a function for reading dxf files and parsing them into a useful tree of objects and data.
The convert function is called by the readDXF fuction to convert dxf strings into the correct data based
on their type code. readDXF expects a (full path) file name as input.
"""
# --------------------... | {
"content_hash": "6b488d00984b72e087db2d22ff56c41c",
"timestamp": "",
"source": "github",
"line_count": 381,
"max_line_length": 121,
"avg_line_length": 31.089238845144358,
"alnum_prop": 0.6683832840861123,
"repo_name": "JohnyEngine/CNC",
"id": "85cbc53b9ddd67a9459fe260e2b8198469211464",
"size": "11... |
"""Moduyle containing the Reload plugin.
This plugin is derived from the Cherrypy Autoreloader monitor
and is used to reload a modified module through the Python
Aboard autoloader.
"""
import os
from cherrypy.process.plugins import Autoreloader
class Reloader(Autoreloader):
"""Class containing the Cherryp... | {
"content_hash": "0c25bc24ab0858e9030cb352753acb68",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 77,
"avg_line_length": 36.075471698113205,
"alnum_prop": 0.5387029288702929,
"repo_name": "v-legoff/pa-poc2",
"id": "4389e237c87e8c63744b5301653c6f3315f89a48",
"size": "345... |
import base64
import datetime
import logging
import urllib
from functools import wraps
from io import BytesIO
from typing import Callable, Dict, Optional, Sequence, Set, Tuple, TypeVar, Union, cast, overload
import django_otp
import orjson
from circuitbreaker import CircuitBreakerError, circuit
from django.conf import... | {
"content_hash": "c392a220de9ea5d117bac95a11dd5e75",
"timestamp": "",
"source": "github",
"line_count": 1072,
"max_line_length": 112,
"avg_line_length": 39.196828358208954,
"alnum_prop": 0.6607249101596897,
"repo_name": "kou/zulip",
"id": "eb13f08153f97f1fd96fdffea54377b391c1d0b4",
"size": "42019",... |
SECRET_KEY = 'secret'
DEBUG = True
DATABASE_URL = 'postgresql://dila:dilapasswd@localhost/dila'
| {
"content_hash": "a928d0ffbab17a1f0a1e7f93fb7c78e0",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 60,
"avg_line_length": 32,
"alnum_prop": 0.75,
"repo_name": "socialwifi/dila",
"id": "fa0a5aba5cc336e7b7a2abe2dc8862467e2d5231",
"size": "96",
"binary": false,
"copies":... |
import os
import sys
from optparse import OptionParser
sort_key = ['local', 'cage', 'hail', 'east', 'west', 'eu', 'asia']
def process_command_line(argv):
global operation_mode
parser = OptionParser(usage="usage: %prog [option]", version="MOPED Desktop Client")
parser.add_option(
'-i', '--inp... | {
"content_hash": "80a9dbe78861d5d22a4b16692c38e401",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 91,
"avg_line_length": 36.6241134751773,
"alnum_prop": 0.539697908597986,
"repo_name": "cmusatyalab/elijah-provisioning",
"id": "eaaaa69e6dd30551a60cfa91f5421d30e0588f10",
... |
from __future__ import unicode_literals
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import logging
from oauthlib.common import add_params_to_uri
from oauthlib.common import urldecode as _urldecode
from oauthlib.oauth1 import (
SIGNATURE_HMAC, SIGNATURE_RSA, SI... | {
"content_hash": "db54bb360077fec5bee972f319aa0436",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 145,
"avg_line_length": 43.498652291105124,
"alnum_prop": 0.6240550254058743,
"repo_name": "dltn/tortellini",
"id": "3064e334f73dd79ad39011697be27a7ce44c5a91",
"size": "16... |
'''
Created on 2012-12-25
@author: jock
'''
from xml.dom import minidom
import sys
import re
import os
import android_manifest
reload(sys)
sys.setdefaultencoding("utf-8")
class idtoname(object):
'''
classdocs
'''
mIdToNameDict = {}
def __init__(self, xmlPath, inDir):
'''
Construc... | {
"content_hash": "69f269e7b60a960de7050e9670556445",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 120,
"avg_line_length": 35.21935483870968,
"alnum_prop": 0.5590767539842462,
"repo_name": "FlymeOS/tools",
"id": "a1bad378f03639430b7f48076adedee5c6b3cd6d",
"size": "5482"... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
import matplotlib as mpl
import pandas as pd
import numpy as np
mpl.use('Agg')
import time
import matplotlib.pyplot as plt
def convolve_inner_layers(x, W, b):
'''
inner layers of network --- tanh activation
'''
y = tf.nn.conv2d(x,... | {
"content_hash": "aaa5fc6ede4fb780d15c1901f668c2b0",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 168,
"avg_line_length": 42.9392523364486,
"alnum_prop": 0.6521928392643378,
"repo_name": "michaelneuder/image_quality_analysis",
"id": "621e33127269b775a58e7935762308b73e7bd... |
import pymysql.cursors
connection = pymysql.connect(host="127.0.0.1", database="addressbook",
user="root", password="")
try:
cursor = connection.cursor()
cursor.execute("select * from group_list")
for row in cursor.fetchall():
print(row)
finally:
connection... | {
"content_hash": "b87844f818fc2bdf4553ac5d3597acf5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 70,
"avg_line_length": 27.416666666666668,
"alnum_prop": 0.601823708206687,
"repo_name": "eugene-petrash/address_book",
"id": "35dae4c9bd98f3c41b8bb0a3b312a0f06663eec5",
"s... |
import rexviewer as r
import circuits
import naali
import time
import sys
import traceback
user, pwd, server = "Test Bot", "test", "world.realxtend.org:9000"
#user, pwd, server = "d d", "d", "world.evocativi.com:8002"
class TestRunner(circuits.BaseComponent):
def __init__(self, cfsection=None):
self.confi... | {
"content_hash": "da1c59add14a854a6bfcc6296b5d1bab",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 122,
"avg_line_length": 32.504975124378106,
"alnum_prop": 0.5548327848779367,
"repo_name": "antont/tundra",
"id": "1da9d43f709174e21de937a103278376b913d865",
"size": "1306... |
"""
korean.morphology.morpheme
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012-2013 by Heungsub Lee
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, unicode_literals
import sys
from ..hangul import get_final, is_hangul
__all__ = ['Morpheme']
class MorphemeMe... | {
"content_hash": "8fabd33cbd62dd97c04f11a2dee3902d",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 79,
"avg_line_length": 26.119565217391305,
"alnum_prop": 0.5751144402829796,
"repo_name": "lqez/korean",
"id": "f7c0fe6be4a5e2253307ceaed44011b2a53b97c3",
"size": "2445",
... |
from collections import defaultdict, namedtuple
from minecraft_data.v1_8 import recipes as raw_recipes
RecipeItem = namedtuple('RecipeItem', 'id meta amount')
class Recipe(object):
def __init__(self, raw):
self.result = reformat_item(raw['result'], None)
if 'ingredients' in raw:
sel... | {
"content_hash": "423bb7ab2a729318828caeef949bf9b8",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 78,
"avg_line_length": 31.795180722891565,
"alnum_prop": 0.5767336112163698,
"repo_name": "Gjum/SpockBot",
"id": "5525b37d5e854b425684cc9cd0b1a4550af9f3c7",
"size": "2639",... |
"""
Interface definition for notifiers.
"""
import datetime
import string
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from ..exceptions import verify_type
__author__ = 'Aaron Hosford'
__all__ = [
'Notifier',
]
class Notifier(metaclass=ABCMeta):
"""
A notifier acts a... | {
"content_hash": "13e3d2bd9a6d2e33e3fc52d942a84c8e",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 119,
"avg_line_length": 32.3013698630137,
"alnum_prop": 0.6518235793044953,
"repo_name": "SaintAttila/attila",
"id": "092a67663b7ca1940d9de860959521aee9656ceb",
"size": "23... |
import logging
import json
from webob import Response
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller import dpset
# from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import CONFIG_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.of... | {
"content_hash": "ec40c6454a9ee1038c29e428bbd332e5",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 97,
"avg_line_length": 37.65581395348837,
"alnum_prop": 0.5872035573122529,
"repo_name": "oolorg/ool-l1patch-dev",
"id": "b2175e6a84cc7d373d62db48aee5e857fa3ba3a6",
"size"... |
from collections import defaultdict
# 3p
from kafka import KafkaClient
from kafka.common import OffsetRequestPayload as OffsetRequest
from kazoo.client import KazooClient
from kazoo.exceptions import NoNodeError
# project
from checks import AgentCheck
DEFAULT_KAFKA_TIMEOUT = 5
DEFAULT_ZK_TIMEOUT = 5
class KafkaChe... | {
"content_hash": "1a6a7a467abf958addfa31d2f1d76f51",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 100,
"avg_line_length": 41.34710743801653,
"alnum_prop": 0.5818508894663202,
"repo_name": "StackVista/sts-agent-integrations-core",
"id": "cca44a003bcf50ec4c24ef0a2526c11dad... |
from Foundation import NSObject
from AppKit import NSApp, NSWindow, NSPanel, NSScreen, NSWindowController, NSToolbar, NSToolbarItem, NSImage, NSNormalWindowLevel, NSFloatingWindowLevel, NSClosableWindowMask, NSMiniaturizableWindowMask, NSResizableWindowMask, NSTexturedBackgroundWindowMask, NSUnifiedTitleAndToolbarWindo... | {
"content_hash": "16a71ab8a80fff5b30bd311a2e787144",
"timestamp": "",
"source": "github",
"line_count": 1166,
"max_line_length": 841,
"avg_line_length": 44.343910806174954,
"alnum_prop": 0.5449956483899042,
"repo_name": "typesupply/vanilla",
"id": "485c1729ae19f9a55eb5d4bfd8e82b9c3073f282",
"size":... |
import os
from pyface.confirmation_dialog import confirm
from pyface.constant import YES
from pyface.message_dialog import information
from pyface.tasks.action.task_action import TaskAction
from traitsui.menu import Action
from pychron.envisage.resources import icon
from pychron.envisage.ui_actions import UIAction, U... | {
"content_hash": "78c5e0a2267737683d096c27d7d96374",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 89,
"avg_line_length": 24.0812324929972,
"alnum_prop": 0.6485983482610213,
"repo_name": "UManPychron/pychron",
"id": "9d06cb93b3e17eb33bb0d105efe4d1be63c8128b",
"size": "9... |
import operator
def create_summary(events, node_meta):
ob_types = node_meta['observation_types']
sensor_summaries = {ob_type: make_sensor_summary(ob_type, events)
for ob_type in ob_types}
return {
'version': node_meta['version'],
'sensors': sensor_summaries
}
... | {
"content_hash": "313a2685ee095d8e018a6346686f8541",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 71,
"avg_line_length": 29.6,
"alnum_prop": 0.581081081081081,
"repo_name": "UrbanCCD-UChicago/plenario-stream",
"id": "2f191f635cceffc066673be90ed8e05759d7028f",
"size": "5... |
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extens... | {
"content_hash": "f2f71654d8968022402081fb24b49f3a",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 78,
"avg_line_length": 29.384615384615383,
"alnum_prop": 0.6625416468348405,
"repo_name": "bluthen/hygrometry",
"id": "174bfcf071c5e45953c13ad8cfff3118e6b28e6d",
"size": "... |
from typing import Callable, TYPE_CHECKING, Optional, Union
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from decimal import Decimal
from kivy.clock import Clock
from electrum_ltc.util import InvalidPassword
from electrum_ltc.gui.ki... | {
"content_hash": "e151ae61ac0d9619b9aa56aa01765076",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 112,
"avg_line_length": 30.57875457875458,
"alnum_prop": 0.5103018687110685,
"repo_name": "vialectrum/vialectrum",
"id": "7e16de024816b608352ada6aeaa50c411b29fae7",
"size"... |
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
from django.contrib import admin
from django.views import defaults as default_views
from django.views.generic import RedirectView, TemplateView
urlpatter... | {
"content_hash": "d7b0da02099c02e12d53c82ec6bcc212",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 78,
"avg_line_length": 42.35,
"alnum_prop": 0.6694214876033058,
"repo_name": "jonaqp/heroku",
"id": "bd2e04be830c84ab4d8527c6796b5857d3333612",
"size": "1694",
"binary": ... |
from django.contrib import admin
from django.forms import SelectMultiple
from django.db import models
from .models import Product, Tag
from categories.models import Category
class ProductAdmin(admin.ModelAdmin):
formfield_overrides = {
models.ManyToManyField: {'widget': SelectMultiple(attrs={'size':'20'}... | {
"content_hash": "d2acf4395271a34a8ccc694d18c95bb7",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 81,
"avg_line_length": 29.176470588235293,
"alnum_prop": 0.7459677419354839,
"repo_name": "giovannicode/djangoseller",
"id": "90bff380936326ef776df5cf66929fd1e748bef8",
"si... |
import random
# ============= standard library imports ========================
from numpy import linspace
from numpy.core.umath import exp
# ============= enthought library imports =======================
from traitsui.api import View, Item, EnumEditor, Group, HGroup, spring, ButtonEditor
# ============= local libr... | {
"content_hash": "978c91de0826bd56da65a67ebad746ca",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 88,
"avg_line_length": 30.34931506849315,
"alnum_prop": 0.48408937034529453,
"repo_name": "USGSDenverPychron/pychron",
"id": "a54894b9a74df692bd466c3c81119f82031baf97",
"s... |
from django.conf.urls import include, url
from django.contrib import admin
from account.views import LoginView, AboutView, TermsView, PrivacyView
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^$', LoginView.as_view(), name='login'),
... | {
"content_hash": "5a68c30ba58b830865b98cec0f871749",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 70,
"avg_line_length": 39.642857142857146,
"alnum_prop": 0.6594594594594595,
"repo_name": "ragnarok22/socialProject",
"id": "e781e68c4e3d4c58773294b7584564953ed094fb",
"siz... |
import os
import logging
import six
import numpy as np
from .... import core
from ..core.strategy import Strategy
from ....log_helper import get_logger
__all__ = ['MKLDNNPostTrainingQuantStrategy']
_logger = get_logger(
__name__, logging.INFO, fmt='%(asctime)s-%(levelname)s: %(message)s')
class MKLDNNPostTraini... | {
"content_hash": "dfc75447e398db3f1da34e5cc204ca96",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 115,
"avg_line_length": 41.888888888888886,
"alnum_prop": 0.6245478659271763,
"repo_name": "chengduoZH/Paddle",
"id": "ad5ef33bf770395efd50fce06021e7ec7c4db4af",
"size": "4... |
from __future__ import unicode_literals
import sys
from os.path import abspath, dirname, join
# Make sure we get the version of this copy of Django
sys.path.insert(1, dirname(dirname(abspath(__file__))))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.pa... | {
"content_hash": "ad452febf8bd945d6f22acc5ab1f8a97",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 85,
"avg_line_length": 32.32871972318339,
"alnum_prop": 0.6989189767740555,
"repo_name": "denisenkom/django",
"id": "0c35e935e6f014ffc1f835977d72fc7f04214be3",
"size": "98... |
from boto.s3 import user
from boto.s3 import key
from boto import handler
import xml.sax
class CompleteMultiPartUpload(object):
"""
Represents a completed MultiPart Upload. Contains the
following useful attributes:
* location - The URI of the completed upload
* bucket_name - The name of the bu... | {
"content_hash": "e173480617db9ce7f09d9f9075932e4d",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 94,
"avg_line_length": 35.55048859934853,
"alnum_prop": 0.560197910940077,
"repo_name": "cloudera/hue",
"id": "1cf27609f620a1a92d1676aa6847f59090d02cc0",
"size": "12144",
... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... | {
"content_hash": "7b730cd03dce2ddb25192ff93d985da3",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 137,
"avg_line_length": 33.23148148148148,
"alnum_prop": 0.7297297297297297,
"repo_name": "atopuzov/nitro-python",
"id": "70a00c007647e56941980d3403499eb59cca6842",
"size"... |
import time, copy
import os, os.path
import sys
import numpy
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from scipy import optimize
from echem_plate_ui import *
from echem_plate_math import *
import pickle
#p='C:/Users/Gregoire/Documents/CaltechWork/echemdrop/20120728NiFeCoTiplate1_test21Aug2012'
#p='C:/Users... | {
"content_hash": "682e9b51f4d04f6629b94d95167b786f",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 195,
"avg_line_length": 41.10726643598616,
"alnum_prop": 0.6945286195286196,
"repo_name": "johnmgregoire/JCAPdatavis",
"id": "5704966d7c0d352ab83bd68fbb4a5da764bdbc05",
"s... |
from bisect import bisect_left
from collections import deque, Hashable
from Ranger.src.Collections.RangeMap import RangeMap
from Ranger.src.Range.Range import Range
from Ranger.src.Range.Cut import Cut
class RangeBucketMap(RangeMap):
""" Class used to represent a mapping of disjoint ranges to sets of items. Ranges... | {
"content_hash": "ad7c80372c5747b1bc6e59d8c6abfbc2",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 95,
"avg_line_length": 47.16863905325444,
"alnum_prop": 0.501160383867528,
"repo_name": "er432/Ranger",
"id": "78f0be993c7832de48f267670b383682d0623624",
"size": "15943",
... |
"""Tests for the custom pyfes types"""
import pytest
from pyfes.fes20 import expressions
from pyfes.fes20 import operators
from pyfes import errors
pytestmark = pytest.mark.unit
@pytest.mark.parametrize("operand", [
expressions.ValueReference("first"),
expressions.Literal("second"),
expressions.Functi... | {
"content_hash": "f98981e1e4e70aecc2f7256ceee67222",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 31.56198347107438,
"alnum_prop": 0.6509557475779,
"repo_name": "geopython/pyfes",
"id": "cbb36d0c8dd4c66e05109ced147f663cbdf0789e",
"size": "3819",
... |
import _plotly_utils.basevalidators
class AlignValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="align", parent_name="volume.hoverlabel", **kwargs):
super(AlignValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "359a2412b49a48d9f596ad46963384f5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 40.30769230769231,
"alnum_prop": 0.601145038167939,
"repo_name": "plotly/plotly.py",
"id": "699a124b262f38bbbd3b69884066b7bbb6a54fea",
"size": "524",... |
'''Simple window'''
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
w.show()
sys.exit(app.exec_())
| {
"content_hash": "91720cca3d1668e74645e4c51e891019",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 34,
"avg_line_length": 14.4,
"alnum_prop": 0.6944444444444444,
"repo_name": "aroberge/qt_py",
"id": "3a8ea0ec454eae44973acf3750a0a05b49c0d63b",
"size": "144",
"binary": f... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
VERSION = '0.2'
SETUP_DICT = dict(
name='smartserver',
packages=['egauge'],
version=VERSION,
author='mandarjog',
author_email='mandarjog@gmail.com',
url='https://github.com/PlotWatt/Smartmeters',
... | {
"content_hash": "1031ee5b46dd4a7b26997620f8004fed",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 93,
"avg_line_length": 29.151515151515152,
"alnum_prop": 0.6403326403326404,
"repo_name": "SoftwareArtisan/smartmeter",
"id": "f4761833b3e56157b36330f57213496a9de8d485",
"s... |
"""
CLI interface for nova management.
"""
import netaddr
import os
import sys
from oslo.config import cfg
from nova.api.ec2 import ec2utils
from nova import availability_zones
from nova.cells import rpc_driver
from nova.compute import flavors
from nova import config
from nova import context
from nova import db
fr... | {
"content_hash": "7d31ba86fd0e3df01751434e096b8b5a",
"timestamp": "",
"source": "github",
"line_count": 1289,
"max_line_length": 79,
"avg_line_length": 39.88130333591932,
"alnum_prop": 0.5206489388604665,
"repo_name": "Brocade-OpenSource/OpenStack-DNRM-Nova",
"id": "e9d50dfe31366b8ee8e68cef1ef09ca51c... |
"""
File : generic.py
Author : Bjorn Barrefors <bjorn dot peter dot barrefors AT cern dot ch>
Description: Generic service module
"""
# system modules
import logging
# package modules
from cuadrnt.utils.web_utils import get_secure_data
from cuadrnt.utils.web_utils import get_data
from cuadrnt.data_managemen... | {
"content_hash": "fcb29be3370b670e53a3b069c0a6ec0b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 116,
"avg_line_length": 40.93103448275862,
"alnum_prop": 0.6112047177759057,
"repo_name": "vlimant/IntelROCCS",
"id": "1f9e7ff4daa4c90bc44835968850754b227bbbec",
"size": "2... |
from __future__ import absolute_import
import sys, os
from . import common
from . import engine
from proton import *
from .common import pump, Skipped
from proton._compat import str2bin
def _sslCertpath(file):
""" Return the full path to the certificate,keyfile, etc.
"""
return os.path.join(os.path.dirna... | {
"content_hash": "ac30d12a195e1805b5e9a9b5a8a6073d",
"timestamp": "",
"source": "github",
"line_count": 575,
"max_line_length": 123,
"avg_line_length": 33.563478260869566,
"alnum_prop": 0.6687911290740453,
"repo_name": "bozzzzo/qpid-proton",
"id": "75b4828c9729f9504ba52ed6756d7088a96ba0b8",
"size":... |
import sys
def run_once():
'''
A helper that takes one trip through the event-loop to process any
pending Futures. This is a no-op for Twisted, because you don't
need to use the event-loop to get callbacks to happen in Twisted.
'''
import txaio
if txaio.using_twisted:
return
... | {
"content_hash": "e410de83f849b76bc6217ea77794abce",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 71,
"avg_line_length": 27.581818181818182,
"alnum_prop": 0.6242584047462096,
"repo_name": "crossbario/txaio",
"id": "9f56778c7d295e8b67ec0e18475b2fd27adc734f",
"size": "281... |
import os
from pathlib import Path
import json
def up(config, database, semester, course):
course_dir = Path(config.submitty['submitty_data_dir'], 'courses', semester, course)
config_file = Path(course_dir, 'config', 'config.json')
if config_file.is_file():
j = json.load(open(config_file,'r'))
... | {
"content_hash": "d44b74dd88e6f3c824cd6d7aea0e799c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 88,
"avg_line_length": 29.42105263157895,
"alnum_prop": 0.6565295169946332,
"repo_name": "Submitty/Submitty",
"id": "6e00cf7292144f43eabf28ebd4373044dac65831",
"size": "559... |
import time
import tensorflow as tf
import ffn
from ffn import *
if __name__ == '__main__':
minibatchSize = 1024
program_start_time = time.time()
# Create the model
if (FLAGS.noInputFeed):
features, labels = getFakeMinibatch(minibatchSize)
else:
features = tf.placeholder("fl... | {
"content_hash": "7353241db253d77c6a4b66d7d559c06a",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 105,
"avg_line_length": 32.86363636363637,
"alnum_prop": 0.6784232365145229,
"repo_name": "linmajia/dlbench",
"id": "2ed7ba401c476a9eb10ca249c59cbdf1be03535b",
"size": "151... |
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
import dson
from dson._compact import long
def test_dump():
sio = StringIO()
dson.dump({}, sio)
assert sio.getvalue() == 'such wow'
def test_dumps():
assert dson.dumps({}) == 'such wow'
def test_encode_truefalse(... | {
"content_hash": "6e48cbd4dcb43c3079cec64f9e233ef1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 100,
"avg_line_length": 29.482758620689655,
"alnum_prop": 0.6046783625730994,
"repo_name": "soasme/dogeon",
"id": "8564271d83f24843733971fef6eda9ae8af7e281",
"size": "855",... |
import os.path
import re # for folderfilter
from threading import Lock
boxes = {}
localroots = {}
config = None
accounts = None
mblock = Lock()
def init(conf, accts):
global config, accounts
config = conf
accounts = accts
def add(accountname, foldername, localfolders):
i... | {
"content_hash": "9d0362355d533bb3bb5b43d061a43124",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 83,
"avg_line_length": 37.12987012987013,
"alnum_prop": 0.6012591815320042,
"repo_name": "frioux/offlineimap",
"id": "8829ee52a719cb79daf658ffdc145ca2ce360dbf",
"size": "36... |
import json
import os
import shutil
import zipfile
from build import cd
def create_template(name, path, **kw):
os.makedirs(os.path.join(path, 'module'))
with open(os.path.join(path, 'module', 'manifest.json'), 'w') as manifest_file:
manifest = {
"name": name,
"version": "0.1",
"description": "My module t... | {
"content_hash": "ff17547568d6a31214417c43e4976e95",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 125,
"avg_line_length": 33.8375,
"alnum_prop": 0.680458071666051,
"repo_name": "mnaughto/trigger-statusbar",
"id": "42199445380b228895cd3b96961bebd6f0ecf74c",
"size": "2707... |
class CorePlugin:
def __init__(self, bot):
self.bot = bot
def startup(self, config):
self.bot.registerCommand("help", self.cmd_help)
self.bot.registerCommand("h", self.cmd_help)
self.bot.registerCommand("plugins", self.cmd_plugins)
self.bot.registerCommand("password", s... | {
"content_hash": "0451c1fdf46b31472426fe6a3c9d7885",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 77,
"avg_line_length": 32.0078125,
"alnum_prop": 0.4710763973639248,
"repo_name": "anthonynguyen/basebot",
"id": "11f528c1c5eb31441687882e9c79c0400b7152bd",
"size": "4097"... |
from . import cli
cli.main()
| {
"content_hash": "3302e2c8a807d8aa7d06976e3634839c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 17,
"avg_line_length": 7.75,
"alnum_prop": 0.6451612903225806,
"repo_name": "winny-/secret-manager",
"id": "88a04c40450257094b6cb5507f567f3306671d7d",
"size": "31",
"binar... |
"""Test error messages for 'getaddressinfo' and 'validateaddress' RPC commands."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_raises_rpc_error
BECH32_VALID = 'rltc1qhku5rq7jz8ulufe2y6fkcpnlvpsta7rqtc0r66'
BECH32_INVALID_BECH32 = 'rltc1p0xlxvlhemja6c4dqv22uap... | {
"content_hash": "27752367a62eb35b976c3ea526711b4a",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 102,
"avg_line_length": 35.5,
"alnum_prop": 0.725,
"repo_name": "litecoin-project/litecoin",
"id": "1786161ffa597d83dce06dd75a91b84f826e4580",
"size": "3049",
"binary": f... |
"""
This linter checks for databases with no tables
"""
from indexdigest.utils import LinterEntry
def get_empty_databases(database):
"""
:type database indexdigest.database.Database
:rtype: list[str]
"""
for db_name in database.query_list('SHOW DATABASES'):
# skip "core" MySQL databases
... | {
"content_hash": "84f84a2cb3bdfecff673aacf934a3d25",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 93,
"avg_line_length": 33.84375,
"alnum_prop": 0.5844875346260388,
"repo_name": "macbre/index-digest",
"id": "7b73df1edd5fe87efbbdf113a11161cf77647bd7",
"size": "1083",
"... |
import xml.dom.minidom as minidom
import urllib2
import datetime
import logging
signof = lambda x: x > 0 and 1 or -1
def parse_date(date, hd=None, md=None):
hour = ''
minute = ''
colon = 0
tz = False
tokens = []
for token in date:
if colon >= 2 and token in ('-', '+'):
tz = True
colon = 0
if token == ... | {
"content_hash": "de6a24addd33d25db5ceec4e45ee8dce",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 117,
"avg_line_length": 26.11111111111111,
"alnum_prop": 0.6443768996960486,
"repo_name": "mkrautz/mumble-iphoneos-betaweb",
"id": "8b58d4e3ed5f6cae5fd0b9c0a3f4873cb5767c90",... |
from .scg import SCG
from .optimization import *
| {
"content_hash": "456a6e89b5c2a9228b6c36d3e35112c5",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 27,
"avg_line_length": 24.5,
"alnum_prop": 0.7755102040816326,
"repo_name": "jameshensman/GPy",
"id": "909f897bc0d57d3ca9a50b626999a462933d5656",
"size": "49",
"binary": f... |
import copy
import pandas as pd
from threeML.plugins.SpectrumLike import SpectrumLike
from threeML.utils.OGIP.response import InstrumentResponse
from threeML.utils.spectrum.binned_spectrum import (
BinnedSpectrumWithDispersion,
ChannelSet,
)
__instrument_name = "General binned spectral data with energy dispe... | {
"content_hash": "dcacc58fcf06c1776af944c51c6a11d7",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 197,
"avg_line_length": 33.84251968503937,
"alnum_prop": 0.6386691484411354,
"repo_name": "giacomov/3ML",
"id": "035d57e076aa1b1e46d453b0364cc1943d4393a7",
"size": "8596",... |
import itertools
from .. import bytecode, error as error_types, opnames as ops
from .descriptors import parseFieldDescriptor, parseMethodDescriptor, parseUnboundMethodDescriptor
from .verifier_types import OBJECT_INFO, T_ADDRESS, T_ARRAY, T_DOUBLE, T_FLOAT, T_INT, T_INT_CONST, T_INVALID, T_LONG, T_NULL, T_OBJECT, T_U... | {
"content_hash": "7512fa2febb9d89f91bfd528f2a509f3",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 233,
"avg_line_length": 35.860236220472444,
"alnum_prop": 0.5895592029423067,
"repo_name": "orneryhippo/saturdays",
"id": "9ab8cb3f4d504a7d5a8dd6dc65f1ad870b70d26d",
"size... |
from __future__ import unicode_literals
import logging
import warnings
from admin_scripts.tests import AdminScriptTestCase
from django.core import mail
from django.core.files.temp import NamedTemporaryFile
from django.test import RequestFactory, TestCase, override_settings
from django.test.utils import LoggingCaptur... | {
"content_hash": "00742dc0455fd749927f3f29282917b5",
"timestamp": "",
"source": "github",
"line_count": 460,
"max_line_length": 116,
"avg_line_length": 34.53913043478261,
"alnum_prop": 0.6226711983887211,
"repo_name": "hackerbot/DjangoDev",
"id": "5ee1092c41baa1248ec15deca3f4a84ab13263f3",
"size": ... |
import random
def main(j, args, params, *other_args):
page = params.result = args.page
try:
macro_params = dict([p.strip() for p in param_pair.split('=')] for param_pair in args.cmdstr.split('|'))
except:
macro_params = {}
id = 'toc_' + str(random.randint(0, 9999))
page.a... | {
"content_hash": "5ca4ca4eaee05e8c2bb4de49be0f663d",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 112,
"avg_line_length": 35.86206896551724,
"alnum_prop": 0.43365384615384617,
"repo_name": "Jumpscale/jumpscale6_core",
"id": "bd5d67e6cb30077218adcf94352e5f042a7b1c7e",
"s... |
import pickle
import socket
import threading
# We'll pickle a list of numbers:
someList = [ 1, 2, 7, 9, 0 ]
pickledList = pickle.dumps ( someList )
# Our thread class:
class ClientThread ( threading.Thread ):
# Override Thread's __init__ method to accept the parameters needed:
def __init__ ( self, channel, det... | {
"content_hash": "307ddd3680bf3dd093730786e9d129bf",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 71,
"avg_line_length": 26.72222222222222,
"alnum_prop": 0.6486486486486487,
"repo_name": "vmiklos/vmexam",
"id": "d3e6189fe83b5d2f6d10b49daea7ec41661f5087",
"size": "962",
... |
import os
import sys
reload(sys)
sys.setdefaultencoding('utf8')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
| {
"content_hash": "bc34b2f78741be09840b4cdf0c7d2ab2",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 66,
"avg_line_length": 21.2,
"alnum_prop": 0.7971698113207547,
"repo_name": "Adward-R/Info-Retrieval-Project",
"id": "7ebbe87afdb49fe4649a21aaabb62c33bd08093a",
"size": "23... |
import os
import shutil
TEST_RESULTS = "testresults"
def setup(self):
if os.path.exists(TEST_RESULTS):
shutil.rmtree(TEST_RESULTS)
if not os.path.exists(TEST_RESULTS):
os.makedirs(TEST_RESULTS)
| {
"content_hash": "a74df24c1c84f8dd0b407fe8e2c33501",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 20.09090909090909,
"alnum_prop": 0.6832579185520362,
"repo_name": "murrayo/yape",
"id": "5f84f5dd7e1be7f6f18e5833ec0e468b75328356",
"size": "221",
... |
'''
Harness Toolset
Copyright (c) 2015 Rich Kelley
Contact:
@RGKelley5
RK5DEVMAIL[A T]gmail[D O T]com
www.frogstarworldc.com
License: MIT
'''
import threading
import builtins
import sys
from random import randint
from harness.core import framework
from harness.core import threads
from collections im... | {
"content_hash": "3258bacc9c864c2810e5dabb3b3ac795",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 146,
"avg_line_length": 20.685393258426966,
"alnum_prop": 0.6531776208582292,
"repo_name": "liorvh/Harness",
"id": "fe6f8561f25ead57e0b4c0036d61dea30e5c9181",
"size": "368... |
"""Common NeRF loss functions.
Loss functions defined in this module return a scalar weight in addition to the
raw loss value. This enables both logging of the raw values as well as weight
scheduling defined by the caller.
"""
from typing import Callable, Optional, Tuple
from etils.array_types import FloatArray
impo... | {
"content_hash": "5979243cf28ad046bf7ac96290591376",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 79,
"avg_line_length": 37.357541899441344,
"alnum_prop": 0.6720502467474204,
"repo_name": "google-research/jax3d",
"id": "6d78fe0fd4a5f62519e9871f9f612b49476cb1e7",
"size"... |
import base64
import logging
import socket
from typing import Any, Optional
import binascii
from ntlm_auth import gss_channel_bindings, ntlm
from mitmproxy import addonmanager, http
from mitmproxy import ctx
from mitmproxy.net.http import http1
from mitmproxy.proxy import commands, layer
from mitmproxy.proxy.context ... | {
"content_hash": "a49c26677d98676bf072ab22cf631f4a",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 114,
"avg_line_length": 43.3494623655914,
"alnum_prop": 0.6008929678779611,
"repo_name": "mhils/mitmproxy",
"id": "656d48b3ad67ddd215f6e15db04d033339a716f3",
"size": "8063... |
"""
This module contains the implementation of SSHSession, which (by default)
allows access to a shell and a python interpreter over SSH.
Maintainer: Paul Swartz
"""
import struct
from twisted.internet import protocol
from twisted.python import log
from twisted.conch.interfaces import ISession
from twisted.conch.ssh... | {
"content_hash": "c45fcfabd97af4961c52b36c3bbf07e4",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 112,
"avg_line_length": 30.40562248995984,
"alnum_prop": 0.6219786025624092,
"repo_name": "hortonworks/hortonworks-sandbox",
"id": "246fd189df2104ad5cb0e1d040e99e23af2a881e"... |
from google.appengine.api import users
import logging
def require_user(controller):
"""
Requires that a user is logged in
"""
if not controller.user:
return (False, "You must be logged in")
return True
def require_admin(controller):
"""
Requires that a user is logged in and that ... | {
"content_hash": "602d73e3a722d5f8a8c7f7494ecf6255",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 106,
"avg_line_length": 27.407894736842106,
"alnum_prop": 0.6764282285165627,
"repo_name": "yowmamasita/social-listener-exam",
"id": "f6376ecba59cb91689636d0bfc065da3eea2b66c... |
""" S3 Synchronization: Peer Repository Adapter
@copyright: 2011-15 (c) Sahana Software Foundation
@license: MIT
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
re... | {
"content_hash": "33b4d183e3aa9e46a7bd26842f805c08",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 79,
"avg_line_length": 35.38953488372093,
"alnum_prop": 0.4782322983407261,
"repo_name": "sahana/Turkey",
"id": "78f9cb9bd0b93976656af87438ea119cc10d0176",
"size": "18286"... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/space/booster/shared_booster_mk4.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "d5434d7bdea812dab179827277c314ff",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 80,
"avg_line_length": 23.76923076923077,
"alnum_prop": 0.6957928802588996,
"repo_name": "obi-two/Rebelion",
"id": "6509360fd755a5d28e0e8b593d1e1c78cb90d2fe",
"size": "454"... |
"""
Product model base implementation -- you do not need to use this
It may save you some typing though.
"""
from django.db import models
import plata
class ProductBase(models.Model):
"""
Product models must have two methods to be usable with Plata:
- ``get_price``: Return a price instance
- ``han... | {
"content_hash": "7e6ff0bccac28e425f3a757c1756eb47",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 32.5,
"alnum_prop": 0.64,
"repo_name": "allink/plata",
"id": "b682a351b7685f1140c1a51a6543cd5e1db82f4d",
"size": "1625",
"binary": false,
"copies... |
from datetime import date
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from vcms.www.fields import StatusField
class BlogPageManager(models.Manager):
def get_blog_page_from_string(self, page_name):
page = self.get(slug=page_name)
if page :
return ... | {
"content_hash": "55b36fc6efbae4f6dc71272295e57d6e",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 136,
"avg_line_length": 36.48837209302326,
"alnum_prop": 0.6153601019757807,
"repo_name": "francisl/vcms",
"id": "f08292527eee9be77fbfbd952fa0793873ff1504",
"size": "3293",... |
from __future__ import print_function
import argparse
import calendar
import json
import os
import sys
import time
import uuid
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import massage_qps_stats
gcp_utils_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), '../../gcp/utils'))
sys.path... | {
"content_hash": "07b0bba30f029522f7b72da404171ade",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 85,
"avg_line_length": 42.642857142857146,
"alnum_prop": 0.5896147403685092,
"repo_name": "ctiller/grpc",
"id": "b449e10505abe598c87159cbffd845b397293297",
"size": "14390"... |
import json
import unittest
from unittest import mock
from azure.batch import BatchServiceClient, models as batch_models
from airflow.models import Connection
from airflow.providers.microsoft.azure.hooks.azure_batch import AzureBatchHook
from airflow.utils import db
class TestAzureBatchHook(unittest.TestCase):
... | {
"content_hash": "dc6aaa85d1197f94ab373dc8e153b70d",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 89,
"avg_line_length": 42.26190476190476,
"alnum_prop": 0.5929577464788732,
"repo_name": "dhuang/incubator-airflow",
"id": "4361170b18fda4ce345defac12b9592b2dd0ab92",
"siz... |
"""Build data lineage build.
Example:
python3 ./deploy_data_lineage.py -p <GCP_ENVIRONMENT>
"""
import argparse
import sys
import datetime
from deployment_utils import BQUtils
from load_data_lineage import LoadDomainLevelDataLineage
from load_data_lineage import LoadProjectLevelDataLineage
from load_data_lineage... | {
"content_hash": "b6b1eb13b40d4de4bb6c3d8ae3697c83",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 80,
"avg_line_length": 27.46153846153846,
"alnum_prop": 0.6682673069227691,
"repo_name": "google/grizzly",
"id": "b5f3c0eb54fbae555a1bd3a2c390cac06e119ac3",
"size": "3075",... |
"""Factory method for easily getting imdbs by name."""
__sets = {}
from datasets.pascal_voc import pascal_voc
from datasets.coco import coco
import numpy as np
# Set up voc_<year>_<split> using selective search "fast" mode
for year in ['2007', '2012', '0712']:
for split in ['train', 'val', 'trainval', 'test']:
... | {
"content_hash": "fbbf6531e11e2b0a4603b80ae6ffb093",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 32.30555555555556,
"alnum_prop": 0.6087704213241617,
"repo_name": "Orpine/py-R-FCN",
"id": "339ea13c8ecd5542be6e2ea3a27cc0b4a4ae9009",
"size": "1412"... |
"""
Generic views that provide commonly needed behaviour.
"""
from rest_framework import views, mixins
from rest_framework.settings import api_settings
from django.views.generic.detail import SingleObjectMixin
from django.views.generic.list import MultipleObjectMixin
### Base classes for the generic views ###
class... | {
"content_hash": "a9370491e09da2051fb1098de03b8077",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 82,
"avg_line_length": 31.804651162790698,
"alnum_prop": 0.6286926001754899,
"repo_name": "cloudcopy/seahub",
"id": "dd8dfcf8da1c6ac175145919eab8c73d26ec0ead",
"size": "68... |
"""
pygments.sphinxext
~~~~~~~~~~~~~~~~~~
Sphinx extension to generate automatic documentation of lexers,
formatters and filters.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
import sys
f... | {
"content_hash": "455295baa66dbcbb822c4fe730c23b46",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 84,
"avg_line_length": 29.67948717948718,
"alnum_prop": 0.5485961123110151,
"repo_name": "amaozhao/blogular",
"id": "2dc9810fb370e547c34c9dc519062785ee9d5266",
"size": "46... |
import six
from cassandra import cluster
from cassandra.cluster import ContinuousPagingOptions
from cassandra.datastax.graph.fluent import DseGraph
from cassandra.graph import VertexProperty
from tests.integration import greaterthanorequaldse68
from tests.integration.advanced.graph import (
GraphUnitTestCase, Cla... | {
"content_hash": "484dd6235d41b4290d28931e8a5aab52",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 120,
"avg_line_length": 42.004366812227076,
"alnum_prop": 0.651626988252417,
"repo_name": "datastax/python-driver",
"id": "d46a74a146c2fa0d70076c0550257d2b0c8989bf",
"size... |
import notifications.settings as app_settings
available_backends = ["database",]
def get_format(action):
"""
find the suitable display format for the given action instance
"""
if action.target:
return app_settings.NOTIFICATION_FORMATS["basic"]
return app_settings.NOTIFICATION_FORM... | {
"content_hash": "b5465759e0112d448992bbc6f785a495",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 70,
"avg_line_length": 16.9375,
"alnum_prop": 0.6900369003690037,
"repo_name": "luterien/django-action-notifications",
"id": "41e46e4096a55136315658e6ed75c5bc6fedc790",
"si... |
import types
import tempfile
import pygsl
import pygsl._numobj as nummodule
from pygsl import vector, ArrayType
from pygsl import matrix_pierre
matrix = matrix_pierre
from pygsl import _block, get_typecode
from array_check import myord, myorda, array_check
import unittest
import sys
sys.stderr = sys.stdout
#pygsl.set... | {
"content_hash": "58013b72aaf63a40fb828f723f3004b4",
"timestamp": "",
"source": "github",
"line_count": 1812,
"max_line_length": 97,
"avg_line_length": 33.21081677704194,
"alnum_prop": 0.4732792714945661,
"repo_name": "juhnowski/FishingRod",
"id": "ae400ab2bce76d47a6109586111801c70bc9ec15",
"size":... |
"""
A simple component that dumps packet_in info to the log.
Use --verbose for really verbose dumps.
Use --show to show all packets.
"""
from pox.core import core
import pox.openflow.libopenflow_01 as of
import pox.lib.packet as pkt
from pox.lib.util import dpidToStr
log = core.getLogger()
_verbose = None
_max_leng... | {
"content_hash": "819c40d7ad24220addc4a1462325bfc1",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 67,
"avg_line_length": 23.783505154639176,
"alnum_prop": 0.5947117468573906,
"repo_name": "noxrepo/pox",
"id": "2e87802846f8333aba79f58a31f6fa634a605ecd",
"size": "2887",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.