text stringlengths 4 1.02M | meta dict |
|---|---|
import os
import os.path
import sys
import ast
import imp
# Functions & classes =========================================================
def filter_private(tree):
"""Filter private AST elements."""
return filter(lambda x: not x.name.startswith("_"), tree)
def get_func(tree):
"""Pick functions from AST ... | {
"content_hash": "ca611916b1b56b6bdcf6341cfd665659",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.575591985428051,
"repo_name": "edeposit/uml_templater",
"id": "38be0bdb1ad699e50bfc6520081519831f4d0cce",
"size"... |
from __future__ import unicode_literals
from builtins import str
# from lino.utils.test import DocTest
from lino.utils.djangotest import WebIndexTestCase
from django.db import models
from django.conf import settings
from lino.api import rt
from lino.utils.djangotest import TestCase
class TestCase(TestCase):
ma... | {
"content_hash": "a22b34d6ceb8dfd3a5450f4a20c2081d",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 107,
"avg_line_length": 37.054054054054056,
"alnum_prop": 0.5280816921954777,
"repo_name": "khchine5/book",
"id": "f7911baf3528b0e8243101cf38404c6801a6d909",
"size": "4261... |
from oauth2_provider.settings import oauth2_settings
from oauthlib.common import generate_token
from django.http import JsonResponse
from oauth2_provider.models import AccessToken, Application, RefreshToken
from django.utils.timezone import now, timedelta
def get_token_json(access_token):
"""
Takes an Acces... | {
"content_hash": "a2488e1254d4c29a86fef3c572253783",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 73,
"avg_line_length": 29.661971830985916,
"alnum_prop": 0.6324786324786325,
"repo_name": "wasit7/tutorials",
"id": "931b01d7beb045a7e348342cad52a488f9e71926",
"size": "210... |
import unittest
from airflow.utils.weight_rule import WeightRule
class TestWeightRule(unittest.TestCase):
def test_valid_weight_rules(self):
self.assertTrue(WeightRule.is_valid(WeightRule.DOWNSTREAM))
self.assertTrue(WeightRule.is_valid(WeightRule.UPSTREAM))
self.assertTrue(WeightRule.is_... | {
"content_hash": "8be8e8435165902383e8109a53006fb2",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 67,
"avg_line_length": 37.45454545454545,
"alnum_prop": 0.7524271844660194,
"repo_name": "owlabs/incubator-airflow",
"id": "c862263387cc31e2152a8aa4520cdc842278d218",
"size... |
import unittest
from . import db
class TestDB(unittest.TestCase):
def test_in_db(self):
self.assertIn(3, db)
def test_index(self):
self.assertEqual(db.index(2), 1)
| {
"content_hash": "dd4332d7bf663280f803d0523fb9e2aa",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 40,
"avg_line_length": 16.083333333333332,
"alnum_prop": 0.6373056994818653,
"repo_name": "weijarz/python-testpkg",
"id": "a6a5e79a493ac15d594c3b645349568138f6745f",
"size"... |
from __future__ import division, absolute_import, print_function
from future.builtins import super
from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.disconnect import DisconnectData
from iris_sdk.models.notes import Notes
from iris_sdk.models.disconnect_order_response import DisconnectOr... | {
"content_hash": "5a75baf0bcc8fa808419c10c0a5c58f2",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 77,
"avg_line_length": 30.714285714285715,
"alnum_prop": 0.6757475083056479,
"repo_name": "bandwidthcom/python-bandwidth-iris",
"id": "25b06c6e27aedf1b0fbd93855854e056883f457... |
import sys
import os
import spotlight
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
... | {
"content_hash": "6e3aaa6df0199b5e29b7c9beab704a24",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 80,
"avg_line_length": 31.92517006802721,
"alnum_prop": 0.7028553164287237,
"repo_name": "maciejkula/spotlight",
"id": "ba04298eda058f1adb5e08a2a39e4424da073c76",
"size": ... |
import requests
url = "https://maps.googleapis.com/maps/api/directions/json?origin=Sydney%2C%20AU&destination=Perth%2C%20AU&waypoints=side_of_road%3Avia%3Aenc%3AlexeF%7B~wsZejrPjtye%40%3A&key=YOUR_API_KEY"
payload={}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.... | {
"content_hash": "6170d768f890d5784e34dc0002be6db1",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 189,
"avg_line_length": 32,
"alnum_prop": 0.7734375,
"repo_name": "googlemaps/openapi-specification",
"id": "354dfda4a3403a67983705936dc678a92ec292e5",
"size": "444",
"bi... |
import operator
from django.utils.six import iteritems
from bson import SON, DBRef
from mongoengine.base import ALLOW_INHERITANCE, BaseDocument
from mongoengine.common import _import_class
from mongoengine import fields
from django_town.mongoengine_extension.fields.base import *
def to_dict_document(self, serialize... | {
"content_hash": "4de0dcfc196d905dea50c52ec0e42d9a",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 96,
"avg_line_length": 36.153333333333336,
"alnum_prop": 0.5898948921261294,
"repo_name": "uptown/django-town",
"id": "a2560aaeb9692059319f1dd4de0acb280d4abb07",
"size": "... |
from typing import Any, Dict
from ..utils.projector import register_projector_element
# Important: All functions have to be prune. This means, that thay can only
# access the data, that they get as argument and do not have any
# side effects. They are called from an async context. So they have
... | {
"content_hash": "85b6339305744e5447217355a1b35afd",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 29.09090909090909,
"alnum_prop": 0.6625,
"repo_name": "boehlke/OpenSlides",
"id": "5779059a2937b384f2f384a2169bf01981ebe0be",
"size": "640",
"binar... |
from django.contrib.gis import admin as geoadmin
from website.models import ApartmentsNY
class ApartmentsNYAdmin(geoadmin.OSMGeoAdmin):
list_display = ('name', 'city', 'price', 'wifi', 'breakfast')
search_fields = ['name']
list_filter = ('city',)
default_lon = -8236306.48
default_lat = 5028376.2... | {
"content_hash": "f4c490eafc7348a11c971f4c9303e305",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 65,
"avg_line_length": 31.076923076923077,
"alnum_prop": 0.7004950495049505,
"repo_name": "pvsalgado/maps_web_gsa",
"id": "458b83145545027077012075dff8e93bd7a4662e",
"size"... |
from io import BytesIO
from django.contrib.auth.decorators import login_required
from django.contrib.messages.views import SuccessMessageMixin
from django.views.generic.detail import SingleObjectMixin
from django.core.files.images import ImageFile
from django.core.files.uploadedfile import InMemoryUploadedFile
from dja... | {
"content_hash": "8c706b0b72f0b9e4e22792450e98248f",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 134,
"avg_line_length": 40.32222222222222,
"alnum_prop": 0.6342243042160375,
"repo_name": "jmennen/group5",
"id": "ed2c05c08cd2494b8f8f2068dd54200fa1a9f967",
"size": "1814... |
from itertools import groupby
# TODO: BNODE_KEY used to be '$bnode', but this *should* be more compliant with
# "de-facto json-with-refs"(?). All that is left is to "stdize" uri, lang and
# datatype..
URI_KEY = '$uri'
BNODE_KEY = '$id'
DATATYPE_KEY = '$datatype'
VALUE_KEY = '$value'
LANG_TAG = '@'
LAX_ONE = True
X... | {
"content_hash": "a9497bba00a8dc56c680f6e98310ad90",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 82,
"avg_line_length": 30.676258992805757,
"alnum_prop": 0.5884146341463414,
"repo_name": "tectronics/oort.python",
"id": "49f8be83ef19582e051b0f22e4ba1f4b9385c258",
"size... |
import datetime
import os
from decimal import Decimal
from unittest import mock, skipUnless
from django import forms
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldError, ImproperlyConfigured,
)
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import Validation... | {
"content_hash": "265108aecad201596c30b0a2c5c966ef",
"timestamp": "",
"source": "github",
"line_count": 3130,
"max_line_length": 129,
"avg_line_length": 40.777955271565496,
"alnum_prop": 0.6000626787323227,
"repo_name": "tomchristie/django",
"id": "7af2aff825db49613261d8fa267a41e82eda5197",
"size":... |
import org.vertx.java.platform.impl.JythonVerticleFactory
import org.vertx.java.core.buffer.Buffer
import org.vertx.java.core.Handler
import org.vertx.java.core.AsyncResultHandler
import org.vertx.java.core.json.JsonObject
import java.lang
from core.javautils import map_to_java, map_from_java
from core.buffer import B... | {
"content_hash": "7257724979f46e75cbe503a8ef247d80",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 162,
"avg_line_length": 39.344339622641506,
"alnum_prop": 0.6633497182592015,
"repo_name": "fhg-fokus-nubomedia/signaling-plane",
"id": "8c32e6943d414905a2a895016c90dc778a05... |
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 = "LinearTrend", cycle_length = 0, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 0); | {
"content_hash": "aac36b1d860cba616562a679894a7c0b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 174,
"avg_line_length": 39.142857142857146,
"alnum_prop": 0.7153284671532847,
"repo_name": "antoinecarme/pyaf",
"id": "7a7bdaaa571df0ad7a5d11a5b52cbf7b0fa4bef8",
"size": "27... |
import requests
from ..exceptions import ClientError
class PGDBClient(object):
"""
Simple client for interacting with ISCAN servers.
"""
def __init__(self, host, token=None, corpus_name=None):
self.host = host
self.token = token
if self.host.endswith('/'):
self.hos... | {
"content_hash": "c4906d51073107f3974afec247f0a7dd",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 108,
"avg_line_length": 33.426877470355734,
"alnum_prop": 0.5263095660399669,
"repo_name": "PhonologicalCorpusTools/PyAnnotationGraph",
"id": "75fe4ffed842895823f432c3592116... |
import logging
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import workflows
from openstack_dashboard import api
from bgpvpn_dashboard.api import bgpvpn as bgpvpn_api
LOG = logging.getLogger(__name__)
class AddRouterParametersInfoActi... | {
"content_hash": "3f761de922258f64ec5fe6282419dc66",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 79,
"avg_line_length": 38.32592592592592,
"alnum_prop": 0.5983764978739853,
"repo_name": "openstack/networking-bgpvpn",
"id": "b3f3aad71aae0dab60bfed9183fbfb3058f555ef",
"... |
from typing import Dict, List, Optional
from joueur.base_game import BaseGame
# import game objects
from games.pirates.game_object import GameObject
from games.pirates.player import Player
from games.pirates.port import Port
from games.pirates.tile import Tile
from games.pirates.unit import Unit
# <<-- Creer-Merge: i... | {
"content_hash": "022014bb5bff6f133c5a9bf3fec07971",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 206,
"avg_line_length": 32.22222222222222,
"alnum_prop": 0.5954433497536946,
"repo_name": "JacobFischer/Joueur.py",
"id": "91babe791e091a6b8573d0a632a57f29c56cfe6d",
"size... |
from svtplay_dl.service.aftonbladet import Aftonbladet
from svtplay_dl.service.aftonbladet import Aftonbladettv
from svtplay_dl.service.angelstudios import Angelstudios
from svtplay_dl.service.barnkanalen import Barnkanalen
from svtplay_dl.service.bigbrother import Bigbrother
from svtplay_dl.service.cmore import Cmore
... | {
"content_hash": "4eabff28db9a75e98077458adea43a31",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 56,
"avg_line_length": 29.40449438202247,
"alnum_prop": 0.7833397019487963,
"repo_name": "spaam/svtplay-dl",
"id": "3869c4c008018fb166fbb7a11207b4828d5b8c16",
"size": "2617... |
'''
Copyright (C) 2013 onwards University of Deusto
All rights reserved.
This software is licensed as described in the file COPYING, which
you should have received as part of this distribution.
This software consists of contributions made by many individuals,
listed below:
@author: Aitor Gómez Goiri <a... | {
"content_hash": "6feaeb3aad8eb7b7333f7e37767f119f",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 108,
"avg_line_length": 32.219858156028366,
"alnum_prop": 0.611930442438917,
"repo_name": "gomezgoiri/reusingWebActuatorsFromSemanticSpace",
"id": "939a790e0d87be22696b1fe20... |
__author__ = 'thorwhalen'
import numpy as np
def idf_log10(num_of_docs_containing_term, num_of_docs):
return np.log10(float(num_of_docs) / np.array(num_of_docs_containing_term))
| {
"content_hash": "aa6f97fe60699591fe6154b870e41453",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 79,
"avg_line_length": 23.25,
"alnum_prop": 0.7043010752688172,
"repo_name": "thorwhalen/ut",
"id": "49aa0dfe7e4f5c342700e4b388236247f5ffc035",
"size": "186",
"binary": fa... |
from . import bottle, werkzeug # noqa
| {
"content_hash": "00c7ebe620130d761fa810d647832af7",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 38,
"avg_line_length": 39,
"alnum_prop": 0.717948717948718,
"repo_name": "lucuma/authcode",
"id": "f5e142e1cd5c351a17820189baabbf31bc9fe72a",
"size": "54",
"binary": false... |
from __future__ import print_function
import pytest
@pytest.mark.xfail(reason="Deleting an existing pet always returns a 500")
def test_200_success(petstore):
pets = petstore.pet.findPetsByStatus(status=['available']).result()
if not pets:
pytest.mark.xtail(reason="No pets to delete")
pet_to_delet... | {
"content_hash": "cc8e8532cd6e109be4eab8f547f9626e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 74,
"avg_line_length": 33.05263157894737,
"alnum_prop": 0.7101910828025477,
"repo_name": "vi4m/bravado",
"id": "5037c3b0ca3c210b48a75395e04208405f38f4c2",
"size": "628",
... |
import sys
sys.path.append('../..')
import web
from web.contrib.template import render_jinja
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from social.utils import setting_name
from social.apps.webpy_app.utils import strategy, backends
from social.apps.webpy_app import... | {
"content_hash": "84d2451708cfcbaf66985ded3dac7968",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 69,
"avg_line_length": 28.723214285714285,
"alnum_prop": 0.7118433322971712,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "5321190b7c937e1d6e08cafe13f7290f8c1031cd",
"size... |
import unittest
import pika
from tavrida import config
class ConnectionConfigTestCase(unittest.TestCase):
def setUp(self):
super(ConnectionConfigTestCase, self).setUp()
self.user = "user"
self.password = "password"
self.credentials = config.Credentials(self.user, self.password)
... | {
"content_hash": "7725c9117d8e93fe6167deb1c68652c2",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 75,
"avg_line_length": 30.818181818181817,
"alnum_prop": 0.6194690265486725,
"repo_name": "sbunatyan/tavrida",
"id": "39a47b5c08350d21d64efff2e78d1f4cad914977",
"size": "67... |
import os
import sys
import psycopg2
import json
from bson import json_util
from pymongo import MongoClient
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
def create_app():
app = Flask(__name__)
return app
app = create_app()
# REPLACE WITH YOUR DATABASE... | {
"content_hash": "28634273b0579fecc033bda1141c6368",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 73,
"avg_line_length": 24.546666666666667,
"alnum_prop": 0.6653992395437263,
"repo_name": "bregonesi/IIC2413-FlaskDB",
"id": "6c384da2657ce197038fbdd2867f0af6a2abc5af",
"si... |
from oslo_log import log as logging
import nova.conf
from nova import exception
from nova.i18n import _
from nova import utils
from nova.virt.libvirt.volume import volume as libvirt_volume
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)
class LibvirtNetVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
... | {
"content_hash": "52b478135594adf71ca90b2cd58b3cdb",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 79,
"avg_line_length": 49.904,
"alnum_prop": 0.6059634498236615,
"repo_name": "mikalstill/nova",
"id": "fdc6842d14597f0d12cfe94a1e726c416eecd66a",
"size": "6811",
"binar... |
def main(request, response):
response.headers.set(b"Access-Control-Allow-Origin", b"*")
response.headers.set(b"Access-Control-Max-Age", 0)
response.headers.set(b'Access-Control-Allow-Headers', b"x-test")
if request.method == u"OPTIONS":
if not request.headers.get(b"User-Agent"):
res... | {
"content_hash": "95ec2d8e886e82374e8332384a885f9b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 87,
"avg_line_length": 43.2,
"alnum_prop": 0.6358024691358025,
"repo_name": "chromium/chromium",
"id": "ac6af13afe0fd6d8d44df51998f84100cf6f3414",
"size": "648",
"binary"... |
"""Compatibility module defining operations on duck numpy-arrays.
Currently, this means Dask or NumPy arrays. None of these functions should
accept or return xarray objects.
"""
from __future__ import annotations
import contextlib
import datetime
import inspect
import warnings
from functools import partial
from impor... | {
"content_hash": "b38878e29b105fb0a9082647519d1cd7",
"timestamp": "",
"source": "github",
"line_count": 671,
"max_line_length": 95,
"avg_line_length": 33.3532041728763,
"alnum_prop": 0.6370866845397677,
"repo_name": "jhamman/xarray",
"id": "29ab44bb8ba3878608e14e44134380cf01d52005",
"size": "22380"... |
import numpy as np
import pytest
from pandas import DataFrame, Series, SparseDataFrame, bdate_range
from pandas.core import nanops
from pandas.core.sparse.api import SparseDtype
from pandas.util import testing as tm
@pytest.fixture
def dates():
return bdate_range('1/1/2011', periods=10)
@pytest.fixture
def emp... | {
"content_hash": "ff2c247116178c872dd40ef04499e422",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 77,
"avg_line_length": 28.742857142857144,
"alnum_prop": 0.621272365805169,
"repo_name": "MJuddBooth/pandas",
"id": "b5ea0a5c90e1ab6cdf56b45aa9392a93149e3433",
"size": "30... |
"""
Created on 28 Mar 2014
@author: Max Demian
"""
# Ideally, we would do this with collections.Counter or just str.count but here
# are some ways to use data structures to count letters in a string.
#==============================================================================
# Dicts
#====================... | {
"content_hash": "89209061f0aab20758ac8f3d537b2ff3",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 80,
"avg_line_length": 31.410112359550563,
"alnum_prop": 0.5845108209622608,
"repo_name": "mikar/60-days-of-python",
"id": "255ef6754b36d34d1658629fa13309ea0d1ae0c5",
"siz... |
import copy
import datetime
import hashlib
import os
class Struct(dict):
"""Like dict but does not whine for non-existent attributes"""
def __getattr__(self, name):
if name == 'id':
name = '_id'
try:
return self[name]
except KeyError:
return None
def __setattr__(self, name, value):... | {
"content_hash": "a06b5301a66fbfd2cf04fff118b2924c",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 97,
"avg_line_length": 28.004444444444445,
"alnum_prop": 0.6246627519441359,
"repo_name": "haldun/tornado-mongodb-template",
"id": "69dae9e7d4a9724aa8b44194a26e43a6d8905ab7"... |
from django.contrib.gis.db.models import PointField
from location_field.forms import spatial as forms
from location_field.models.base import BaseLocationField
class LocationField(BaseLocationField, PointField):
formfield_class = forms.LocationField
def __init__(self, *args, **kwargs):
super(Location... | {
"content_hash": "5976d5b14ca88ace5860dff39fad2b8f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 60,
"avg_line_length": 30.647058823529413,
"alnum_prop": 0.6871401151631478,
"repo_name": "voodmania/django-location-field",
"id": "451a35f806aa93b8b0f77fd05c89b214cd8a3e34",... |
"""Supporting definitions for the Python regression tests."""
# if __name__ != 'test.test_support':
# raise ImportError('test_support must be imported from the test package')
import contextlib
# import errno
# import functools
# import gc
# import socket
import sys
import os
# import platform
# import shutil
impo... | {
"content_hash": "724634087778ee38365cc765a6266bfb",
"timestamp": "",
"source": "github",
"line_count": 1687,
"max_line_length": 97,
"avg_line_length": 36.84113811499704,
"alnum_prop": 0.5814065743109523,
"repo_name": "pombredanne/grumpy",
"id": "906ace0c0b7db6d923d06eb4a19ee0980f081ee1",
"size": "... |
"""
This is a general function for all broadening. Importing this
will let the user do rotational broadening, macroturbulent
broadening, and Gaussian broadening (reducing the resolution)
"""
from __future__ import print_function, division, absolute_import
from scipy.special import erf # Error function
from sci... | {
"content_hash": "ab8c5edfdc5ea6a6f6b8962d41e0c3a4",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 30.256410256410255,
"alnum_prop": 0.627542372881356,
"repo_name": "kgullikson88/gullikson-scripts",
"id": "26f29b76eefc85acff68e087f2d46fd91b8b6d77",
... |
from __future__ import unicode_literals
import itertools
import os
import re
from django import forms
from django.conf import settings as django_settings
from django.contrib import messages
from django.contrib.admin import helpers
from django.core.exceptions import PermissionDenied
from django.core.exceptions import ... | {
"content_hash": "1c383d0c3ae46548c89d10772e9ee357",
"timestamp": "",
"source": "github",
"line_count": 1238,
"max_line_length": 186,
"avg_line_length": 44.11066235864297,
"alnum_prop": 0.5892801552857587,
"repo_name": "DylannCordel/django-filer",
"id": "2d167de17275706c22d02e5796251670b46d2269",
"... |
import unittest
import re
import os
import os.path
import shutil
import tempfile
import tarfile
import xml.etree.ElementTree as ET
import io
import stat
import mimetypes
import flask
from werkzeug.utils import cached_property
import browsepy
import browsepy.file
import browsepy.manager
import browsepy.__main__
impor... | {
"content_hash": "22e52ea033b4923109caa003172d5e5d",
"timestamp": "",
"source": "github",
"line_count": 1089,
"max_line_length": 79,
"avg_line_length": 32.97337006427915,
"alnum_prop": 0.563774089339423,
"repo_name": "dolphx/browsepy",
"id": "93ecc206c46decd59275f88736b9d7acf95ea7fe",
"size": "3595... |
"""
Module for working with Data Observatory tokens
.. module:: carto.DoToken
:platform: Unix, Windows
:synopsis: Module for working with Data Observatory tokens
.. moduleauthor:: Simon Martin <simon@carto.com>
"""
from pyrestcli.fields import CharField, BooleanField
from .paginators import CartoPaginator
fr... | {
"content_hash": "9a7e52547c663932d41ed7090cdac85d",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 74,
"avg_line_length": 24.865384615384617,
"alnum_prop": 0.6937354988399071,
"repo_name": "CartoDB/carto-python",
"id": "48d78b91d7a6a53ee5a2b9dbb36ad8b842bdf78b",
"size": ... |
import functools
import IECore
import Gaffer
import GafferUI
from . import _Algo
from ._RowsPlugValueWidget import _RowsPlugValueWidget
from ._SectionChooser import _SectionChooser
# _Menus
# ------
#
# Code that provides extensions to standard Gaffer menus.
# Plug context menu
# =================
def __spreadshe... | {
"content_hash": "fd93609c0a0727160a95bf422b5d5470",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 143,
"avg_line_length": 29.70873786407767,
"alnum_prop": 0.7271241830065359,
"repo_name": "ImageEngine/gaffer",
"id": "4d5467dcefe92f7af63e0866db2fef122a1fc94d",
"size": "... |
from datetime import datetime
from django.conf import settings
from django.core.mail import mail_admins
import cronjobs
import requests
from kitsune.sumo.tasks import measure_queue_lag
@cronjobs.register
def enqueue_lag_monitor_task():
"""Fires a task that measures the queue lag."""
measure_queue_lag.delay... | {
"content_hash": "ebaaafe8f954f8dae42ae078c5d9cd98",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 28.03448275862069,
"alnum_prop": 0.6014760147601476,
"repo_name": "brittanystoroz/kitsune",
"id": "177cf7601a8a909c92e4420bb40e0ac168aafeda",
"size":... |
import unittest
from integrationtest_support import IntegrationTestSupport
class Test (IntegrationTestSupport):
def test(self):
self.write_build_file("""
from pybuilder.core import init, task
name = "integration-test"
default_task = "any_task"
@init(environments="test_environment")
def initialize (pro... | {
"content_hash": "04055e530e20c5ba48294c110ff204d4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 60,
"avg_line_length": 22.533333333333335,
"alnum_prop": 0.6982248520710059,
"repo_name": "onesfreedom/pybuilder",
"id": "c324a73a1e957d10089de6748f2f45dbbeaf080e",
"size":... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class IsValid(Choreography):
def __init__(self, temboo_session):
"""
Create a new i... | {
"content_hash": "0d1c0f44dbcd70585a03bd891c6a9bd0",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 159,
"avg_line_length": 35.589285714285715,
"alnum_prop": 0.6984445559458103,
"repo_name": "jordanemedlock/psychtruths",
"id": "2ee735cda6219e43f52ca957f37f31ae6b7cd1df",
"... |
from random import *
from voronoi import *
import wx
class Canvas(wx.Panel):
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize, name = "Canvas"):
wx.Panel.__init__(self, parent, id, pos, size, wx.NO_BORDER, name)
self.Bind(wx.EVT_PAINT, s... | {
"content_hash": "5ff7ef88677ca054fe1326ce1df0bfcf",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 98,
"avg_line_length": 34.51851851851852,
"alnum_prop": 0.5507868383404864,
"repo_name": "shinjin-cr/voronoi",
"id": "8e9d3e69c56d9aea6cd539c1a8ebda1251ca4228",
"size": "28... |
import numpy as np
import scipy.interpolate as interpolate
import scipy.optimize as optimize
import kcorrect.response
import multiprocessing
class Fitter(object):
"""Nonnegative SED fitting object
Parameters
----------
abcorrect : bool
correct maggies to AB (default False)
responses : l... | {
"content_hash": "aafdacbd51dc0569b4abd118f053464b",
"timestamp": "",
"source": "github",
"line_count": 440,
"max_line_length": 98,
"avg_line_length": 31.988636363636363,
"alnum_prop": 0.5686678507992895,
"repo_name": "blanton144/kcorrect",
"id": "774c884f75f0006fbb6783f8ba1be16877725e13",
"size": ... |
"""
protoc.py: Protoc Builder for SCons
This Builder invokes protoc to generate C++ and Python
from a .proto file.
NOTE: Java is not currently supported.
Based off https://bitbucket.org/scons/scons/wiki/ProtocBuilder
"""
import SCons.Action
import SCons.Builder
import SCons.Defaults
import SCons.Node.FS
import SCon... | {
"content_hash": "28eef6e3df36b4dda402f70b7f235d2c",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 116,
"avg_line_length": 34.02597402597402,
"alnum_prop": 0.6870229007633588,
"repo_name": "CALISCO/common-proto",
"id": "20647665af186c95a0b358d9968dd6e892509498",
"size": ... |
import json
import time
import urllib
from spiderfoot import SpiderFootEvent, SpiderFootPlugin
class sfp_grayhatwarfare(SpiderFootPlugin):
meta = {
'name': "Grayhat Warfare",
'summary': "Find bucket names matching the keyword extracted from a domain from Grayhat API.",
'flags': ["apikey"... | {
"content_hash": "1a0eea97ca6fca805c82860e38294f84",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 146,
"avg_line_length": 31.970760233918128,
"alnum_prop": 0.5560636546552039,
"repo_name": "smicallef/spiderfoot",
"id": "7fc2ef53853bab78032f138f48bd93c95a124800",
"size"... |
from pyquery import PyQuery
from django.core.urlresolvers import reverse
import debug # pyflakes:ignore
from ietf.utils.test_utils import TestCase
from ietf.doc.models import StateType
class StateHelpTest(TestCase):
def test_state_index(self):
url = reverse('ietf.help.views.s... | {
"content_hash": "b341f0c8d15dcee9f731f844819d0f18",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 69,
"avg_line_length": 30.869565217391305,
"alnum_prop": 0.6225352112676056,
"repo_name": "wpjesus/codematch",
"id": "6f03e433eb660f770bad4450aa6622d6f46e474c",
"size": "71... |
from django.contrib.auth import logout
from django_roa.db.exceptions import ROAException
from django_roa.remoteauth.backends import reset_api_auth
from .models import Profile
def get_profile(request):
if not hasattr(request, '_cached_profile'):
try:
request._cached_profile = Profile.objects.ge... | {
"content_hash": "0412e35712678eec5a2b3ff6165db3af",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 82,
"avg_line_length": 34.54838709677419,
"alnum_prop": 0.6237161531279178,
"repo_name": "aaee-enscachan/aaee-front",
"id": "3de8ea7d1f8fed2053e2c4d2334139d5d15d8eb4",
"siz... |
import climate
import matplotlib.pyplot as plt
import numpy as np
import theanets
from utils import load_cifar, plot_layers, plot_images
logging = climate.get_logger('cifar')
g = climate.add_group('CIFAR Example')
g.add_argument('--features', type=int, default=0, metavar='N',
help='train a model using... | {
"content_hash": "854f2b6a5288248bb04b043239e5b21d",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 75,
"avg_line_length": 25.41269841269841,
"alnum_prop": 0.6083697688944409,
"repo_name": "devdoer/theanets",
"id": "0e65436564a632c98d6fd44c1fe832ed19387f8e",
"size": "1624... |
"""
Django settings for milo_test project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | {
"content_hash": "c214abfb37e8ac63d9cda6084413fbf6",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 91,
"avg_line_length": 24.71698113207547,
"alnum_prop": 0.6737913486005089,
"repo_name": "klekhaav/django-rest-custom-user",
"id": "9b5364c6a154a73247726c39a614325e36287ad6"... |
from calvin.actor.actor import Actor, manage, condition
class Identity(Actor):
"""
forward a token unchanged
Inputs:
token : a token
Outputs:
token : the same token
"""
@manage(['dump'])
def init(self, dump=False):
self.dump = dump
def log(self, data):
prin... | {
"content_hash": "956667930992421f56cfaec4ac0213f4",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 69,
"avg_line_length": 21.375,
"alnum_prop": 0.49415204678362573,
"repo_name": "EricssonResearch/calvin-base",
"id": "e071e8f040bdf582004f39746a4acd5bb5f0e5cc",
"size": "12... |
"""Test Mongo Connector's behavior when its source MongoDB system is
experiencing a rollback.
"""
import os
import sys
import time
from pymongo.read_preferences import ReadPreference
from pymongo import MongoClient
sys.path[0:0] = [""]
from mongo_connector.util import retry_until_ok
from mongo_connector.locking_di... | {
"content_hash": "b5a468c4c262670a080e00ed5cb89542",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 79,
"avg_line_length": 39.21649484536083,
"alnum_prop": 0.5932351910269892,
"repo_name": "keithhigbee/mongo-connector",
"id": "57686555da808833f697477fb28a1c06acfd98c2",
"... |
import itertools
import os
def getDefaultFlags():
return [
'-Wall',
'-Wextra',
'-Wno-unused-result',
'-Weffc++',
'--pipe',
'-std=c++11',
'-x', 'c++',
]
def getSystemIncludeFlags():
return getIncludePaths('-isystem', [
'/usr/include',
... | {
"content_hash": "707aacefcac487e9e1346d6eea80b7bf",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 26.424836601307188,
"alnum_prop": 0.5419243136284937,
"repo_name": "Peaches491/dotfiles",
"id": "018234910a60708bebf342c2b24a0b4c8a0c6126",
"size": ... |
import unittest
import transaction
from pyramid import testing
from .models import DBSession
class TestMyViewSuccessCondition(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
from sqlalchemy import create_engine
engine = create_engine('sqlite://')
from .models i... | {
"content_hash": "1290f91f8f3d69223dd1335f5c254471",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 56,
"avg_line_length": 27.30909090909091,
"alnum_prop": 0.6091877496671105,
"repo_name": "Akagi201/learning-python",
"id": "caeb74cea3ae1c47044cee1eb9438bac81ee902c",
"size... |
import os
messages_json = os.path.join(os.path.dirname(__file__), 'messages.json')
with open(messages_json, 'r') as message_file:
message_data = message_file.read()
ver = message_data.splitlines()[-2].split(':')[0].strip().replace('"', '')
version = tuple([int(i) for i in ver.split('.')])
| {
"content_hash": "b51a4d0b7f6dfe1b6c3284cf720af499",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 74,
"avg_line_length": 37,
"alnum_prop": 0.6486486486486487,
"repo_name": "j5shi/ST3_Config",
"id": "351f53269b12eb7849de8e957d00bb93859b15c2",
"size": "425",
"binary": fa... |
import sys
from mixbox.binding_utils import *
from . import cybox_common
from . import win_handle_object
class WaitableTimerType(cybox_common.BaseObjectPropertyType):
"""WaitableTimerType specifies Windows waitable timer types via a union
of the WaitableTimerTypeEnum type and the atomic xs:string type.
I... | {
"content_hash": "261fa231c0760752115a21b87173be03",
"timestamp": "",
"source": "github",
"line_count": 367,
"max_line_length": 449,
"avg_line_length": 48.689373297002724,
"alnum_prop": 0.6948905926464828,
"repo_name": "CybOXProject/python-cybox",
"id": "9f0af718262a25e2f6e4eb2199608a458466321f",
"... |
#!/usr/bin/env python
from setuptools import setup
import os
import sys
import glob
from distutils.core import Command
from distutils.command.build import build as build_
from distutils.command.clean import clean as clean_
from setuptools.command.develop import develop as develop_
from setuptools.command.egg_info im... | {
"content_hash": "6d524b1833012a4126f874d5e458a939",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 110,
"avg_line_length": 32.181395348837206,
"alnum_prop": 0.6002312472900708,
"repo_name": "thesamet/webilder",
"id": "ac8b35e204b9b10b3edc0fb8bba5d7b88acddcf8",
"size": "... |
from sparts.tasks.file import DirectoryWatcherTask
from sparts.vservice import VService
class DevWatcher(DirectoryWatcherTask):
INTERVAL = 1.0
PATH = '/dev'
DevWatcher.register()
if __name__ == '__main__':
VService.initFromCLI()
| {
"content_hash": "7752a027d9c63e8529c56b44b4f0df1f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 50,
"avg_line_length": 18.923076923076923,
"alnum_prop": 0.7154471544715447,
"repo_name": "bboozzoo/sparts",
"id": "40671276164c7001bc8a5927b8b009b93b2dd89d",
"size": "534"... |
from numpy import array, ndim, argsort
import sys
from ut.util.pobj import inject_method
__author__ = 'thor'
non_methods_set = set(dir(sys.modules[__name__]))
def cumul_before_partial_fit(self, min_data_len):
raise DeprecationWarning("Don't use. Dangerous.")
if not isinstance(min_data_len, (int, float)):
... | {
"content_hash": "00db3a581ca5503850e9d56a42d9a634",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 116,
"avg_line_length": 36.883720930232556,
"alnum_prop": 0.6025641025641025,
"repo_name": "thorwhalen/ut",
"id": "a28ad3ad9f3b11853ac7795bfaee4f6a9e9ed6b0",
"size": "4758... |
from django.core.management.base import BaseCommand
from elvanto_subgroups.elvanto import refresh_elvanto_data
class Command(BaseCommand):
help = 'Pulls info from elvanto'
def handle(self, *args, **options):
refresh_elvanto_data()
| {
"content_hash": "d7c60a75b493b93f88a0dabf721d8a7f",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 58,
"avg_line_length": 25.1,
"alnum_prop": 0.7370517928286853,
"repo_name": "monty5811/elvanto_subgroups",
"id": "31a2e9452b9a0d5359259461ce24fd962f51a5f2",
"size": "251",
... |
from __future__ import print_function
from flowgen.graph import Graph
from flowgen.language import Code
from flowgen.options import parser
from pypeg2 import parse
from pypeg2.xmlast import thing2xml
class FlowGen(object):
def __init__(self, args):
self.args = parser.parse_args(args)
def any_output(... | {
"content_hash": "9cee64d02191c30c76a7ceb82f319ad0",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 87,
"avg_line_length": 28.27027027027027,
"alnum_prop": 0.6195028680688337,
"repo_name": "ad-m/flowgen",
"id": "bff201afbc30f4216d47c3e59f5126d04d7628ec",
"size": "1070",
... |
import unittest
from aarhus.aarhus import custom_stopwords
class TestStopwords(unittest.TestCase):
def test_basic(self):
stopwords = custom_stopwords.get_stopwords()
print (stopwords)
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "022df6ae054c1883a3f41ccdef14db07",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 52,
"avg_line_length": 19.692307692307693,
"alnum_prop": 0.67578125,
"repo_name": "mikedelong/aarhus",
"id": "87505ceed1e5d1c38ff9aff8ea4612846e2570bf",
"size": "256",
"b... |
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
'''
Collection of useful statistics routines
'''
def simpSample(f, numTest, xMin, xMax, M = None, verb = False):
'''
Use the rejection sampling method to generate a
probability distribution according to the given function f,
between some ra... | {
"content_hash": "507039dd53fab731473bcda33753f1e7",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 71,
"avg_line_length": 24.610169491525422,
"alnum_prop": 0.5888429752066116,
"repo_name": "dgarrett622/FuncComp",
"id": "72c698c53222e9eb39bbd69bded44ffce468c26f",
"size": ... |
"""Jerod Gawne, 2018.06.28
https://github.com/jerodg/hackerrank
"""
import sys
import traceback
def capitalize(string) -> str:
"""Jerod Gawne, 2017.10.13
print(input().title()) will not work because the question is
asking to capitalise firse letter of each word keeping in mind
that "if it is a lette... | {
"content_hash": "01cc2b89d70be57628775ca736d13308",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 98,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.6611764705882353,
"repo_name": "jerodg/hackerrank-python",
"id": "182e7a835029cf323f8b705f8fd8e9ceec740ec8",
"siz... |
"""
Created on Tue Feb 28 12:48:16 2017
@author: pconsidine
"""
def convert_to_celsius(fahrenheit):
'''(number) -> number
Return the number of Celsius degrees equivalent to fahrenheit degrees
>>> convert_to_celsius(32)
0.0
>>> convert_to_celsius(212)
100.0
'''
retur... | {
"content_hash": "ecb8650bc16e4fbb33a6ead85500b163",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 73,
"avg_line_length": 19.38888888888889,
"alnum_prop": 0.5931232091690545,
"repo_name": "pjconsidine/codingclass",
"id": "a832dbf1b648f355a6a68a771a29a7c08dc923d8",
"size"... |
from collections import defaultdict
from glob import glob
import os
import time
from xml.etree.ElementTree import ElementTree
# project
from checks import AgentCheck
from util import get_hostname
class Skip(Exception):
"""
Raised by :class:`Jenkins` when it comes across
a build or job that should be excl... | {
"content_hash": "4d99696ce90d0c24620f5aab1c2338a6",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 107,
"avg_line_length": 43.98453608247423,
"alnum_prop": 0.5356849876948319,
"repo_name": "indeedops/dd-agent",
"id": "4278d307efe931110004088d856fe29f5f90ba81",
"size": "... |
from flask import Flask, render_template, session, redirect, url_for, flash
from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from wtforms.validators import Required
from flask_de... | {
"content_hash": "28d0056c83d9b6a41dcb0d1f4c7b0dd0",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 75,
"avg_line_length": 25.185185185185187,
"alnum_prop": 0.7110294117647059,
"repo_name": "Craicerjack/socdems",
"id": "3fab1f18b985c3b3fec4c2557548e9263eb84e2d",
"size": "... |
import crm_claim_report
| {
"content_hash": "fcdcf0a023e5e676e04900314874fc40",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 23,
"avg_line_length": 24,
"alnum_prop": 0.8333333333333334,
"repo_name": "vileopratama/vitech",
"id": "869d301e20cc08c00780f67628dbfa6c599df953",
"size": "124",
"binary":... |
from invoker import ReplyObject
from commands import URL
from room import Room
from user import User
from app import PSBot
import re
psb = PSBot()
test_room = Room('test')
test_user = User('user')
""" Tests the commands that are within the CommandInvoker
"""
def testInvalidCommand():
reply = psb.invoker.execute... | {
"content_hash": "c74af20fadab58a5fc6dd4bde7aca6e5",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 137,
"avg_line_length": 32.95454545454545,
"alnum_prop": 0.7186206896551725,
"repo_name": "QuiteQuiet/PokemonShowdownBot",
"id": "76945a30c3f4563f781c2e48b22ff693b1a0e473",
... |
import atexit
import logging
import os
import re
import readline
import Stemmer
import sys
import time
from .bot import Runner
from .brain import Brain
log = logging.getLogger("cobe")
class InitCommand:
@classmethod
def add_subparser(cls, parser):
subparser = parser.add_parser("init", help="Initiali... | {
"content_hash": "f87222c73e70c4cfe5e5bd03f01065b5",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 79,
"avg_line_length": 30.755395683453237,
"alnum_prop": 0.5063157894736842,
"repo_name": "pteichman/cobe",
"id": "68a9b7ecbe70e4a06da0297950bd92c26f7ed0c5",
"size": "8587... |
from datetime import time
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import Client, TestCase, override_settings
from model_mommy import mommy
from .. models import Course, OfficeHours
TEST_SESSION_ENGINE = 'django.con... | {
"content_hash": "a43a60858b89e2ec6e074d46c20789a9",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 79,
"avg_line_length": 31.06578947368421,
"alnum_prop": 0.6429479034307497,
"repo_name": "tndatacommons/tndata_backend",
"id": "c5cf4d6b6599be1db4488ef1fab6a081c9ab62e8",
"... |
import os.path
from graphite_api._vendor import whisper
from . import TestCase, WHISPER_DIR
class MetricsTests(TestCase):
def _create_dbs(self):
for db in (
('test', 'foo.wsp'),
('test', 'wat', 'welp.wsp'),
('test', 'bar', 'baz.wsp'),
):
db_path = o... | {
"content_hash": "6ce1708e090de35c1604689fcad363f2",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 79,
"avg_line_length": 36.5098814229249,
"alnum_prop": 0.4387788242936018,
"repo_name": "alphapigger/graphite-api",
"id": "18c195274d4106b2227fe5f8ef1c5ce4b6e48675",
"size... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Alarm_Item_Details'
db.delete_table(u'ddsc_core_alarm_item_details')
# Deleting model 'Alarm_Property'
... | {
"content_hash": "6d95948ab62dd4e88547ccdca86218bb",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 200,
"avg_line_length": 74.7,
"alnum_prop": 0.5544771679309832,
"repo_name": "ddsc/ddsc-core",
"id": "dd15a84c7c97cb83582f7b4a023c5a16c38e8996",
"size": "26916",
"binary... |
from flask import Flask
import requests
requests_service = requests.Session()
server = Flask(__name__)
server.config['SERVER_NAME'] = '127.0.0.1:5000'
# from app.simple_blueprint import simple_page
from app import home, clicktrack, performance, sql, twitter_api
# server.register_blueprint(simple_page, url_prefix='/n... | {
"content_hash": "c8a011abf777c115e77c4197efae01da",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 75,
"avg_line_length": 39.22222222222222,
"alnum_prop": 0.7662889518413598,
"repo_name": "buckbaskin/Insight",
"id": "2b0aece51e5c36f16a0af35f12f2a0ba3f7572f5",
"size": "70... |
from __future__ import absolute_import, division, print_function
from stripe.stripe_object import StripeObject
class CreditNoteLineItem(StripeObject):
OBJECT_NAME = "credit_note_line_item"
| {
"content_hash": "f6408c4766f0c5f4c1f0d7f3ed7ad7e0",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 64,
"avg_line_length": 28,
"alnum_prop": 0.7857142857142857,
"repo_name": "stripe/stripe-python",
"id": "6e5eab5993c7956f19b45d354bf400a56f12569c",
"size": "259",
"binary"... |
from PyQt4 import QtCore, QtGui
class Ui_RAddNuclideDialog(object):
def setupUi(self, RAddNuclideDialog):
RAddNuclideDialog.setObjectName("RAddNuclideDialog")
RAddNuclideDialog.setWindowModality(QtCore.Qt.NonModal)
RAddNuclideDialog.resize(640, 480)
RAddNuclideDialog.setMinimumSize(... | {
"content_hash": "ea5c21e2a44acb3658c6128e5415faf1",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 205,
"avg_line_length": 64.15873015873017,
"alnum_prop": 0.7542058386937159,
"repo_name": "tetra5/radiance",
"id": "c16b600c48d06e3364c89582e10c39b2c6a50f43",
"size": "833... |
from models.models import Topic, TopicInTopic
import json
def visual(vis, params):
root_topic = Topic.objects.get(model=vis.model, layer=0)
return json.dumps({"children": build_circles(vis.model, root_topic)})
def build_circles(model, topic):
answer = []
if topic.layer == model.layers_count:
... | {
"content_hash": "af7f16721d76ded7d3055434b3fde833",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 79,
"avg_line_length": 32.61904761904762,
"alnum_prop": 0.637956204379562,
"repo_name": "bigartm/visartm",
"id": "f1f74d0594936b459fa5a9762ae3231fff610a6a",
"size": "685",
... |
from django.conf.urls.defaults import *
urlpatterns = patterns('contact.views',
(r'^contactForm', 'contactForm')
) | {
"content_hash": "e32674f04b7ee302686189bb34426860",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 39,
"avg_line_length": 23.8,
"alnum_prop": 0.7226890756302521,
"repo_name": "pombredanne/algos-urv",
"id": "4d69848d584eb196af7fe987fd813e5733bbebea",
"size": "119",
"bina... |
from flask import request
from .core import db
from .model import PersonalAccessToken
class PersonalAccessTokenManager(object):
def __init__(self, app=None):
self.app = app
self.before_request_funcs = []
self.current_user_id = None
if app is not None:
self.init_app(app)... | {
"content_hash": "ab41333fdbf49aa5297b0df08de7f437",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 101,
"avg_line_length": 31.661290322580644,
"alnum_prop": 0.6265919510952623,
"repo_name": "soasme/flask-personal-access-token",
"id": "aa122c9da7246b487ca8beb596fd375d8568d0... |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from moto.ec2.utils import filters_from_querystring
def try_parse_int(value, default=None):
try:
return int(value)
except (TypeError, ValueError):
return default
def parse_sg_attributes_from_dict(sg_attribu... | {
"content_hash": "9fd42951b74fdab96e51e928775fd92c",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 134,
"avg_line_length": 42.691699604743086,
"alnum_prop": 0.5566151282288677,
"repo_name": "botify-labs/moto",
"id": "4aecfcf78b81ada34cd11352974a4ab79a1edf6f",
"size": "1... |
import os
import json
import logging
import re
import requests
import sys
import traceback
from flask import Flask, request, abort
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
# Setup Logging
logging.basicConfig(level="INFO", format='%(levelname)s: %(message)s')
LOG = logging.getLogger("deploy_seld... | {
"content_hash": "0cb4ecf4b658f9387ac3ae9c1721e32b",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 123,
"avg_line_length": 40.3,
"alnum_prop": 0.6358560794044665,
"repo_name": "kubeflow/pipelines",
"id": "2f8c7bbfd119b166082e2936148466c1eb0be719",
"size": "15049",
"bi... |
"""A window that can be used for tools that handle the referene workflow."""
from PySide import QtGui
from PySide import QtCore
from jukeboxcore import reftrack
from jukeboxcore import djadapter
from jukeboxcore.gui.main import JB_MainWindow, get_icon
from jukeboxcore.gui import treemodel
from jukeboxcore.gui import ... | {
"content_hash": "d1b5db6626afe05a43365c7899bfdeee",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 107,
"avg_line_length": 36.850828729281766,
"alnum_prop": 0.6263868065967017,
"repo_name": "JukeboxPipeline/jukebox-core",
"id": "c39523be6237d2b51e9f059ef07b4854bcb6afae",
... |
"""URL definitions for news stories
"""
try:
from django.conf.urls.defaults import patterns, url
except ImportError:
from django.conf.urls import patterns, url
from django.views.generic import (ArchiveIndexView, YearArchiveView,
MonthArchiveView, WeekArchiveView, DayArchiveView, TodayArchiveView,
DateDe... | {
"content_hash": "78b9a17a7e1cb4f3a7009293937228c9",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 96,
"avg_line_length": 29.012345679012345,
"alnum_prop": 0.5697872340425532,
"repo_name": "callowayproject/django-stories",
"id": "767a219b41ff409a015579e951b9af53916b4d06",
... |
import json
import time
import fabric.api
from cloudify_rest_client.executions import Execution
from cosmo_tester.framework.test_cases import MonitoringTestCase
def limit_dpoints(num):
return float("{0:.3f}".format(num))
def num(s):
return int(s)
class ManyDeploymentsTest(MonitoringTestCase):
def ... | {
"content_hash": "9fbd055891aaa3168ce978de364cace8",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 79,
"avg_line_length": 46.97938144329897,
"alnum_prop": 0.5025235900811937,
"repo_name": "isaac-s/cloudify-system-tests",
"id": "afabc1b2b5cbc126497f2c328c710c136a722242",
... |
import os
import sys
import codecs
import platform
try:
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages, Command
from... | {
"content_hash": "55f04658e6e51e261d1169f8fea28833",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 85,
"avg_line_length": 28.760330578512395,
"alnum_prop": 0.631896551724138,
"repo_name": "mavarick/pyes",
"id": "941459e9473004eda3df4ad5b0890477b589409b",
"size": "3526",... |
"""Helper methods for various modules."""
import asyncio
from datetime import datetime, timedelta
from itertools import chain
import threading
import re
import enum
import socket
import random
import string
from functools import wraps
from types import MappingProxyType
from unicodedata import normalize
from typing impo... | {
"content_hash": "d9fc185a38320c0201226517413f0a9f",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 78,
"avg_line_length": 33.03012048192771,
"alnum_prop": 0.5805216122560642,
"repo_name": "persandstrom/home-assistant",
"id": "17849154ff766c19ff42245166135c315e5ce9d4",
"... |
"""Helpers for data entry flows for config entries."""
from typing import Any, Awaitable, Callable, Dict, Optional, Union
from homeassistant import config_entries
from .typing import HomeAssistantType
DiscoveryFunctionType = Callable[[], Union[Awaitable[bool], bool]]
class DiscoveryFlowHandler(config_entries.Confi... | {
"content_hash": "7a569c1e7547ec3f1d72050b47e496e0",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 88,
"avg_line_length": 33.752631578947366,
"alnum_prop": 0.6271635739903322,
"repo_name": "tboyce021/home-assistant",
"id": "6b9df47c4d8ccc6c3cdbd12eb475a35bb2995e3e",
"si... |
def check_results_adequacy(results, error_group):
error_group.add_message("invalid_results")
error_group.invalid_results.clear()
if results is None:
return None
if results.data is None:
error_group.invalid_results(
"Results do not include information on test data")
elif n... | {
"content_hash": "06d1686904f533298c9824716dc54ed4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 37.38461538461539,
"alnum_prop": 0.668724279835391,
"repo_name": "cheral/orange3",
"id": "fd9e7590ae24be9f45017104290b4e8129eaeb90",
"size": "486",
... |
"""
Copyright (c) 2013, Jurriaan Bremer
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the followi... | {
"content_hash": "c2180c5519e04566fe2102af877fdbfe",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 76,
"avg_line_length": 50.47692307692308,
"alnum_prop": 0.6152087778116427,
"repo_name": "epanalytics/darm",
"id": "654f0c43236d862a20ddaa033e10129bcdabe968",
"size": "656... |
from ConfigParser import ConfigParser, NoOptionError
import os
import settings
class Config(ConfigParser):
"""
``ConfigParser`` subclass that looks into your home folder for a file named
``.gvoice`` and parses configuration data from it.
"""
def __init__(self):
GV_ROOT = os.path.abspath(os.path.dirname(__file_... | {
"content_hash": "f1c34edcfe562da0e9a3780c0aae0a78",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 76,
"avg_line_length": 24.160714285714285,
"alnum_prop": 0.6866223207686623,
"repo_name": "kwantopia/shoppley-migrate",
"id": "0b68a113802dc96d152b103398a6130c9e5a0513",
"s... |
"""Helpers for config validation using voluptuous."""
from datetime import timedelta
import jinja2
import voluptuous as vol
from homeassistant.loader import get_platform
from homeassistant.const import (
CONF_PLATFORM, CONF_SCAN_INTERVAL, TEMP_CELSIUS, TEMP_FAHRENHEIT,
CONF_ALIAS, CONF_ENTITY_ID, CONF_VALUE_T... | {
"content_hash": "7e93e5703883cb8b6eb0cdbc38eecb35",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 79,
"avg_line_length": 30.005194805194805,
"alnum_prop": 0.6314923822714681,
"repo_name": "Zyell/home-assistant",
"id": "031ab5227dcea2656b8ab3c65ae19ae21551ebe3",
"size":... |
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import subprocess
import re
from setuptools import setup
from setuptools.command.sdist import sdist as _sdist
from setuptools.command.install import install as _install
VERSION_PY = """
# This file is originally generat... | {
"content_hash": "535227b5d38a9884918056d2500e49e6",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 104,
"avg_line_length": 30.266129032258064,
"alnum_prop": 0.5787370103916867,
"repo_name": "dmaticzka/EDeN",
"id": "46e6ec54ccaa0c75144422dd3ba9430c44f9b653",
"size": "377... |
from specparser import HadoopRuntime
from collections import OrderedDict
import json
import os
import sys
import subprocess
def cmd(cmd_str):
ret = subprocess.call(cmd_str, shell=True)
return ret
def get_the_line_of_transaction(path):
abs_path = os.path.join(path,'*')
cmd_str = "hadoop fs -text %s | w... | {
"content_hash": "0fbe6081bc70a5d53e471c639bd5e27d",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 102,
"avg_line_length": 35.14492753623188,
"alnum_prop": 0.6428865979381443,
"repo_name": "DataCanvasIO/example-modules",
"id": "301b1d1620023155de16047faa4fb18f40baeb98",
... |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
domain_apikey = db.Table(
'domain_apikey',
db.Column('domain_id', db.Integer, db.ForeignKey('domain.id')),
db.Column('apikey_id', db.Integer, db.ForeignKey('apikey.id')))
| {
"content_hash": "cb7f9220a785cca85aa2760cdec895b6",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 67,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.6942148760330579,
"repo_name": "ngoduykhanh/PowerDNS-Admin",
"id": "7ade5db3d4efd337809d23ebbcaa8936847e3acd",
"siz... |
import json
import sys
import pandas as pd
args = sys.argv[1:]
assert len(args) == 1
store = pd.HDFStore(args[0], "r")
print store
for key in store.keys():
print "\n\nTABLENAME", key
print store[key]
print store[key].dtypes
print store[key].describe()
| {
"content_hash": "4a38c73cc62e3dca439a4cf06b8afa77",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 33,
"avg_line_length": 15.222222222222221,
"alnum_prop": 0.6605839416058394,
"repo_name": "bricegnichols/urbansim",
"id": "47e9f0f49e6a4099e4b470c0f8a5f7df9ac7cac5",
"size"... |
import unittest
import io
class TestFileBasedBuffer(unittest.TestCase):
def _makeOne(self, file=None, from_buffer=None):
from waitress.buffers import FileBasedBuffer
return FileBasedBuffer(file, from_buffer=from_buffer)
def test_ctor_from_buffer_None(self):
inst = self._makeOne('file'... | {
"content_hash": "57c2c53312f594d2bb23cf90a09efecb",
"timestamp": "",
"source": "github",
"line_count": 454,
"max_line_length": 71,
"avg_line_length": 30.993392070484582,
"alnum_prop": 0.5843223651481771,
"repo_name": "korbenzhang/vim-ycm-win",
"id": "f7c90b4eaddf1316d7cf89cca9671f60989c1c87",
"siz... |
import os
import shutil
from revision.config import Config, read_config
def test_read_config():
#: pass path string
test_revision_path = os.path.join(
os.path.dirname(__file__),
'.revision/config.json'
)
config = read_config(test_revision_path)
assert isinstance(config, Config... | {
"content_hash": "c6f4da800fd2854263108b69051560e5",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 56,
"avg_line_length": 21.56140350877193,
"alnum_prop": 0.5663140764849471,
"repo_name": "COLORFULBOARD/revision",
"id": "c29286cd252370512202436bede1391aa81e5781",
"size":... |
"""The machinery of importlib: finders, loaders, hooks, etc."""
import _imp
from ._bootstrap import (SOURCE_SUFFIXES, DEBUG_BYTECODE_SUFFIXES,
OPTIMIZED_BYTECODE_SUFFIXES, BYTECODE_SUFFIXES,
EXTENSION_SUFFIXES)
from ._bootstrap import BuiltinImporter
from ._bo... | {
"content_hash": "fc928e02ed3ec6b362cfec4e5d303af9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 38.7,
"alnum_prop": 0.7299741602067183,
"repo_name": "severb/flowy-website",
"id": "cec86adfc58fe521eb99bf0b52436efa864d72dd",
"size": "774",
"bina... |
def test_config(parse_options):
from pylama.config import get_config
config = get_config()
assert config
options = parse_options()
assert options
assert options.skip
assert options.max_line_length
assert not options.verbose
assert options.paths
assert "pylama" in options.paths[... | {
"content_hash": "9610cc0f7fd44a7088cb69017c1c0b06",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 80,
"avg_line_length": 29.03030303030303,
"alnum_prop": 0.675365344467641,
"repo_name": "klen/pylama",
"id": "bef7a631093d91216ce164477e2007f99ce37851",
"size": "958",
"b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.