text stringlengths 4 1.02M | meta dict |
|---|---|
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from PIL import Image
from rabbitgw.nn import WGAN_TF,WGAN_GP_TF
from rabbitgw.util.net import mlp_tf
from rabbitgw.util.process import inverse_standardlize,standardlize
Mnist = input_data.read_data_sets('MNIST_data/', one_hot=True)
X,_... | {
"content_hash": "a910b6cfa3f4680a24d4652ce805a0b8",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 67,
"avg_line_length": 35.30769230769231,
"alnum_prop": 0.7189542483660131,
"repo_name": "MashiMaroLjc/rabbitgw",
"id": "f41c411545bc4a7f62ad82ccfbe5ed7fe3cc1292",
"size": ... |
"""A collection of analytical results which return the exact solution to a
trial problem to benchmark particle movers
Includes:
* Motion in a constant electric field
* Motion in a constant magnetic field
* Crossed motion in perpendicular electric and magnetic fields
"""
__author__ = 'swebb'
import numpy as np
impo... | {
"content_hash": "d808758a5622ffbd775cb28495790db7",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 77,
"avg_line_length": 29.19626168224299,
"alnum_prop": 0.545774647887324,
"repo_name": "radiasoft/radtrack",
"id": "d65019b6d41f05ffe61ed8122b9aa1056a0a167b",
"size": "31... |
from collections import namedtuple
CacheEntry = namedtuple('CacheEntry', 'model_plural class_name cache_type')
MappingEntry = namedtuple('MappingEntry', 'class_name attr polymorph')
def resource(model_plural, class_name, cache_type='memcache'):
return CacheEntry(model_plural, class_name, cache_type)
def mapping(... | {
"content_hash": "5ecebe6a5716ffe36e6f0435ab6343d0",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 76,
"avg_line_length": 33.94607843137255,
"alnum_prop": 0.6453429602888087,
"repo_name": "kr41/ggrc-core",
"id": "494310d829f9a057e8e290c8e392ed7ddf37fab6",
"size": "7039"... |
import sys
import os
import django
django.setup()
from django.core.files import File
from recipes.models import Lesson
dir = sys.argv[1]
exts = set()
for fn in os.listdir(dir):
if 'groenten' in fn: continue
base, ext = os.path.splitext(fn)
exts.add(ext)
if ext not in ('.odt', '.doc'):
continue
... | {
"content_hash": "3a2d9d93d84c3cea344415a4a89bbe14",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 25.727272727272727,
"alnum_prop": 0.6537102473498233,
"repo_name": "vanatteveldt/luctor",
"id": "505f0f4fe2d2bee7f1b36346beb91fb5e0b77fb6",
"size": "... |
import sys
if sys.version_info < (3, 7):
from ._zsrc import ZsrcValidator
from ._zmin import ZminValidator
from ._zmid import ZmidValidator
from ._zmax import ZmaxValidator
from ._zauto import ZautoValidator
from ._z import ZValidator
from ._ytype import YtypeValidator
from ._ysrc impor... | {
"content_hash": "5cf9dbacf764ea4d3e7d756d74aa885d",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 56,
"avg_line_length": 37.71875,
"alnum_prop": 0.6335266500966584,
"repo_name": "plotly/python-api",
"id": "47c7037349a6601adef3873072fff6d2bbe2a505",
"size": "3621",
"bi... |
from oslo_config import cfg
from oslo_policy import policy
from monasca_api import policies
CONF = cfg.CONF
DEFAULT_AUTHORIZED_ROLES = policies.roles_list_to_check_str(
cfg.CONF.security.default_authorized_roles)
READ_ONLY_AUTHORIZED_ROLES = policies.roles_list_to_check_str(
cfg.CONF.security.read_only_author... | {
"content_hash": "b06e6575b98b284cec2c6c6025911099",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 99,
"avg_line_length": 36.301886792452834,
"alnum_prop": 0.6237006237006237,
"repo_name": "openstack/monasca-api",
"id": "cf2614e230cefc46c483a5e46a2f362cf13edd4e",
"size":... |
from flask import Flask, jsonify
# import request
app = Flask(__name__)
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
},
{
'id': 2,
'title': u'Learn Python',
'description': u'Nee... | {
"content_hash": "0e175dc6778029fa298e834973eb0387",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 74,
"avg_line_length": 22.59259259259259,
"alnum_prop": 0.5508196721311476,
"repo_name": "VisGroup/streaming-storyline",
"id": "e83c29c29b2767402e67ea82aaea4425fc105518",
"... |
from __future__ import absolute_import
from sentry.models import Integration
from sentry.testutils import AcceptanceTestCase
class OrganizationIntegrationSettingsTest(AcceptanceTestCase):
def setUp(self):
super(OrganizationIntegrationSettingsTest, self).setUp()
self.user = self.create_user('foo@e... | {
"content_hash": "1f256899d309957d296372dfeb929507",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 81,
"avg_line_length": 33.20454545454545,
"alnum_prop": 0.5975359342915811,
"repo_name": "ifduyue/sentry",
"id": "1f7bea09832a59780d41abbbb467afebed510f4f",
"size": "1461",... |
from __future__ import absolute_import, print_function, unicode_literals
from django.test import TestCase
from mock import patch
import ntpath
import os
import posixpath
import sys
from .dummydata import windows_data, osx_data, linux_data
from ..utils.filesystem import enumerate_mounted_disk_partitions, EXPORT_FOLDE... | {
"content_hash": "baaa24d56cdfa8602a257fd014e142d8",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 135,
"avg_line_length": 35.98623853211009,
"alnum_prop": 0.6455066921606119,
"repo_name": "66eli77/kolibri",
"id": "f47e4a0d70eab6085e28a828af70fd0ac8e65912",
"size": "784... |
"""server.py: Handle application's run command and its parameters."""
import app
import config
import session
def run(**kwargs):
info = dict(
server=config.SERVER_WSGI,
host=config.SERVER_HOST,
port=config.SERVER_PORT,
debug=config.SERVER_DEBUG,
reloader=config.SERVER_RELOA... | {
"content_hash": "aa01e1cb3eb33aa1435ce0d545adc009",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 69,
"avg_line_length": 24.842105263157894,
"alnum_prop": 0.6588983050847458,
"repo_name": "ejelome/archaic",
"id": "0e283df1681a09f3533cece96ef1d1d6d9abb363",
"size": "518"... |
from contextlib import contextmanager
from traits.has_traits import HasTraits
from traits.trait_types import Instance, Bool, Str, Int
import unicodedata
from traits.traits import Property
from traitsui.message import error
from traitsui.ui import UI
from pyanno.database import PyannoDatabase
from pyanno.modelBt import ... | {
"content_hash": "0841830eb30ad6a91133af1c655cd3fa",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 80,
"avg_line_length": 28.480198019801982,
"alnum_prop": 0.629236919867895,
"repo_name": "enthought/uchicago-pyanno",
"id": "7b0bca45264a1166b664863c9c9ad5788cb9ee35",
"si... |
"""This module implements DataFutures.
We have two basic types of futures:
1. DataFutures which represent data objects
2. AppFutures which represent the futures on App/Leaf tasks.
"""
import os
import logging
from concurrent.futures import Future
from parsl.dataflow.futures import AppFuture
from parsl.app.err... | {
"content_hash": "2dcc8842970180763f0d638dec7ce371",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 100,
"avg_line_length": 30.469635627530366,
"alnum_prop": 0.5611214456550625,
"repo_name": "swift-lang/swift-e-lab",
"id": "375b297f47ea1a91491a5c06d04ef3756ae52734",
"siz... |
import io
import re
import torch
__all__ = [
"generate_sp_model",
"load_sp_model",
"sentencepiece_numericalizer",
"sentencepiece_tokenizer",
"numericalize_tokens_from_iterator",
"filter_wikipedia_xml",
"to_map_style_dataset",
]
"""
This file contains experimental functionality.
All of th... | {
"content_hash": "08156736a17d356f047e2f86f5a6970f",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 122,
"avg_line_length": 30.905844155844157,
"alnum_prop": 0.5548902195608783,
"repo_name": "pytorch/text",
"id": "7806595e679fff1d205b0050abb58c7333af2372",
"size": "9519"... |
import copy
from yahtr.core.hex_lib import index_of_direction
from yahtr.utils import attr, clamp
from yahtr.utils.event import Event
from yahtr.data.actions import ActionType
from yahtr.data.skill_template import Target
from yahtr.rank import Rank
from yahtr.weapon import RankedWeapon
class Unit:
""" Unit in a ... | {
"content_hash": "0dd3d4375dc1a6305982bcd12bebac10",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 115,
"avg_line_length": 36.41935483870968,
"alnum_prop": 0.6193534100974314,
"repo_name": "fp12/yahtr",
"id": "66bc2f9442c6c754220a50bc31152465eacc9406",
"size": "4516",
... |
"""helloworld.py
Illustrate how to load some data, and cache the results.
"""
from environment import Session
from model import Person
from caching_query import FromCache
# load Person objects. cache the result under the namespace "all_people".
print "loading people...."
people = Session.query(Person).options(From... | {
"content_hash": "a411745d3e7bd1330ec8d4013dcaac20",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 83,
"avg_line_length": 40.41935483870968,
"alnum_prop": 0.6548284118116521,
"repo_name": "rclmenezes/sqlalchemy",
"id": "e2e4d4f7861c291e87d37c6cec350dfcefd878d4",
"size": ... |
from unittest import TestCase
from tape import Tape
class TestTape(TestCase):
def test_initially_blank_head(self):
t = Tape()
self.assertEqual(t.read(), 0)
def test_all_blanks(self):
t = Tape()
t.shift_left()
t.shift_left()
t.shift_left()
t.shift_left()... | {
"content_hash": "40c5913c6389fbd2becacd56de8c0021",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 57,
"avg_line_length": 26.613861386138613,
"alnum_prop": 0.5379464285714286,
"repo_name": "nahumj/turing-ga",
"id": "de887408f95e0cbb9263194062538240795a3edb",
"size": "26... |
from decimal import Decimal as D
from django.core.validators import MinValueValidator
from django.db import models
from django.utils.translation import gettext_lazy as _
from oscar.core import loading, prices
from oscar.models.fields import AutoSlugField
Scale = loading.get_class('shipping.scales', 'Scale')
class ... | {
"content_hash": "970b2fa6ec1b92af0c4042d33db922b9",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 89,
"avg_line_length": 36.1889400921659,
"alnum_prop": 0.6252387622564625,
"repo_name": "solarissmoke/django-oscar",
"id": "bc89d0c71025f2fa820c740cc3bd11f9e7ba9422",
"siz... |
import uuid
import glance_store
import mock
import six
import webob
import glance.api.policy
import glance.api.v2.image_data
from glance.common import exception
from glance.common import wsgi
from glance.tests.unit import base
import glance.tests.unit.utils as unit_test_utils
import glance.tests.utils as test_utils
... | {
"content_hash": "a8cf4dd3c886b1ae2a231f7024ccf085",
"timestamp": "",
"source": "github",
"line_count": 574,
"max_line_length": 79,
"avg_line_length": 41.01567944250871,
"alnum_prop": 0.6055303062481417,
"repo_name": "darren-wang/gl",
"id": "3bbb0c882f1815b0a81a0eb9228e881764040846",
"size": "24179... |
"""The kodi component."""
import asyncio
import voluptuous as vol
from homeassistant.components.kodi.const import DOMAIN
from homeassistant.components.media_player.const import DOMAIN as MP_DOMAIN
from homeassistant.const import ATTR_ENTITY_ID, CONF_PLATFORM
from homeassistant.helpers import config_validation as cv
... | {
"content_hash": "1a61f1ce14cb1075cfa06550598dc666",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 87,
"avg_line_length": 32.40659340659341,
"alnum_prop": 0.6052899287894201,
"repo_name": "Teagan42/home-assistant",
"id": "1f2d3cb5cd09568a1860c90ae95a06b0f76f910c",
"size"... |
from concurrent.futures import ThreadPoolExecutor
from functools import partial, wraps
import time
import tornado.ioloop
import tornado.web
EXECUTOR = ThreadPoolExecutor(max_workers=4)
def unblock(f):
@tornado.web.asynchronous
@wraps(f)
def wrapper(*args, **kwargs):
self = args[0]
... | {
"content_hash": "bf37aaca92c4fa3381a4144e492e1b32",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 100,
"avg_line_length": 23.11111111111111,
"alnum_prop": 0.6129807692307693,
"repo_name": "tgonzales/tornado-handson",
"id": "4919dae4738e8be4e6f1b7e8c4bde9d6190f70e5",
"si... |
from __future__ import unicode_literals
import re
try:
from urllib.parse import urljoin, urlencode
except ImportError:
from urllib import urlencode
from urlparse import urljoin
try:
from django.db.models import get_model
except ImportError:
from django.apps import apps
get_model = apps.get_model... | {
"content_hash": "308e9e94cb3c85a9eaf1e773be2b87b5",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 78,
"avg_line_length": 32.48026315789474,
"alnum_prop": 0.6169738707717237,
"repo_name": "artursmet/django-payments",
"id": "649fbae950737a13e5e6926948d977283df8a4eb",
"si... |
import urllib, urllib2, json, base64, datetime
from pprint import pprint
class FreedomPop:
refreshToken = None
token = None
tokenExpireTimestamp = None
accessToken = None
_apiUsername = "3726328870"
_apiPassword = "pNp6TIgVm4viVadoyoUdxbsrfmiBwudN"
endPoint = "https://api.freedompop.com"
... | {
"content_hash": "05f7c153cfbc0135a3d2b6da386304ac",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 237,
"avg_line_length": 35.07874015748032,
"alnum_prop": 0.6074074074074074,
"repo_name": "dodysw/fpopclient",
"id": "802d20ab49f46c9ed134d7d7de6d4cd5eb7683af",
"size": "4... |
from django.utils.encoding import force_str
from pyquery import PyQuery as pq
from olympia import amo
from olympia.addons.models import Addon, AddonReviewerFlags
from olympia.amo.tests import TestCase, addon_factory, file_factory, version_factory
from olympia.constants.reviewers import REVIEWER_DELAYED_REJECTION_PERI... | {
"content_hash": "fb36609cc4bb867817bea19fffca658c",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 86,
"avg_line_length": 43.55095541401274,
"alnum_prop": 0.629908592321755,
"repo_name": "bqbn/addons-server",
"id": "1c0a4bfdd04cd7bcedde9684efc651e0d3b4117f",
"size": "13... |
from docutils import nodes, utils
import re
def tag_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
tag_class = 'default'
tag_text = utils.unescape(text)
tag_array = tag_text.split('::')
# @type tag_array a
if len(tag_array) == 2:
if tag_array[0]:
tag_clas... | {
"content_hash": "27066203ff0cdaae55ce372ed2b61e3e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 100,
"avg_line_length": 32.926829268292686,
"alnum_prop": 0.6014814814814815,
"repo_name": "Open-Wide/sphinx_rtd_theme",
"id": "4d67ff21c63b92b550f7eff3873cad8caececfb3",
"... |
from setuptools import setup, find_packages
setup(
name='panlex_API',
version='1.2.0',
author="Maxwell Joslyn; Caroline Glazer; Gary Krug; Alex DelPriore; Ben Yang",
author_email="info@panlex.org",
py_modules=["panlex"],
url="https://github.com/longnow/panlex_python_API",
description='Pytho... | {
"content_hash": "d2b20dec2c72c7c9013f8bedad6ee36d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 122,
"avg_line_length": 47.4,
"alnum_prop": 0.6610407876230661,
"repo_name": "longnow/panlex_python_API",
"id": "0823ed02496ba20ca8671668a9a4422178536dd3",
"size": "711",
... |
import unittest
from streamlink.plugins.rtve import Rtve
class TestPluginRtve(unittest.TestCase):
def test_can_handle_url(self):
should_match = [
'http://www.rtve.es/directo/la-1',
'http://www.rtve.es/directo/la-2/',
'http://www.rtve.es/directo/teledeporte/',
... | {
"content_hash": "a4d5be4e9bffc720e4c013065eeee512",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 54,
"avg_line_length": 30.545454545454547,
"alnum_prop": 0.5803571428571429,
"repo_name": "wlerin/streamlink",
"id": "42b1c5e683d32dc7b95cebfb13cb16f4df8c4995",
"size": "67... |
"""
Created on Sun Jun 28 16:53:49 2015
@author: warpinski.matthew
"""
import re
DATAFILE_PATTERN = '^(.+),"(.+)",(.*),(.*),(.*)'
def removeQuotes(s):
""" Remove quotation marks from an input string
Args:
s (str): input string that might have the quote "" characters
Returns:
str: a strin... | {
"content_hash": "d2f40d1b3e049882edd7324d96119411",
"timestamp": "",
"source": "github",
"line_count": 798,
"max_line_length": 237,
"avg_line_length": 36.788220551378444,
"alnum_prop": 0.6596723098409238,
"repo_name": "aleph-w/ApacheSparkLearning",
"id": "25a040ae191b73940a06705b996a1c8ef2060e88",
... |
import itertools
from copy import deepcopy
import numpy as np
import pandas as pd
from scipy.spatial.distance import squareform
from skbio._base import SkbioObject
from skbio.stats._misc import _pprint_strs
from skbio.util import find_duplicates
from skbio.util._decorator import experimental, classonlymethod
from skb... | {
"content_hash": "cf98dd78ed092de41effb25c5afdfd7c",
"timestamp": "",
"source": "github",
"line_count": 1416,
"max_line_length": 79,
"avg_line_length": 34.4795197740113,
"alnum_prop": 0.5707146222067468,
"repo_name": "gregcaporaso/scikit-bio",
"id": "f659397ef2346c732a9f910741d84a290ede134e",
"size... |
"""
base_solver.py
Copyright 2016 Brian Romanchuk
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | {
"content_hash": "4189d7db5bcdcdd446abf622f4ceb49d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 72,
"avg_line_length": 31.775,
"alnum_prop": 0.6341463414634146,
"repo_name": "brianr747/SFC_models",
"id": "13c45494062e987c0e6559e18ef417c6e7283fbf",
"size": "1271",
"b... |
import argparse
import sqlite3
import os
import csv
import statistics
NORMALIZE = "normalize"
CATEGORIZE = "categorize"
NOTHING = "nothing"
ENUMERATE = "enumerate"
#######################################################
################ Configuration ########################
#############################... | {
"content_hash": "88264c55e38f8ca7a6a4202b2968e475",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 117,
"avg_line_length": 36.711974110032365,
"alnum_prop": 0.5298836389280677,
"repo_name": "lattrelr7/cse802",
"id": "d12bd911af528e214d5b9b97f2690a776590be1e",
"size": "1... |
import sys
from setuptools import setup, find_packages
from codecs import open
from os import path
current_path = path.abspath(path.dirname(__file__))
with open(path.join(current_path, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='SentimentClassifier',
version='0.0.75',
... | {
"content_hash": "274c308bcf4f4084b8be0a6ef95a21ad",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 71,
"avg_line_length": 24.88095238095238,
"alnum_prop": 0.6296650717703349,
"repo_name": "mayk93/SentimentAnalysis",
"id": "1080c05d732274277ff11ed96d73c7822899fd91",
"size... |
import numpy, scipy
from pyamg import gallery, rootnode_solver
from pyamg.gallery import stencil_grid
from pyamg.gallery.diffusion import diffusion_stencil_2d
from cvoutput import *
from convergence_tools import print_cycle_history
##
# Run Rotated Anisotropic Diffusion
n = 10
nx = n
ny = n
stencil = diffusion_stenc... | {
"content_hash": "4f0dbb06c3a0578b0ed470274960fd69",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 177,
"avg_line_length": 36.51162790697674,
"alnum_prop": 0.7203821656050955,
"repo_name": "pombreda/pyamg",
"id": "8dad3ca308945e808161a9e8821ce9e511ec331a",
"size": "1607"... |
"""NoteSequence processing pipelines."""
import copy
from magenta.music import constants
from magenta.music import sequences_lib
from magenta.pipelines import pipeline
from magenta.pipelines import statistics
from magenta.protobuf import music_pb2
import tensorflow as tf
# Shortcut to chord symbol text annotation ty... | {
"content_hash": "44bcff3c96373a48940557b672ab98e9",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 80,
"avg_line_length": 36.53191489361702,
"alnum_prop": 0.6895748398369249,
"repo_name": "adarob/magenta",
"id": "7d7baad5272306bc176aa0c29ed84bcc857727e3",
"size": "7453"... |
import unittest
import sys
try:
import aula1_resp as aula1
except ImportError:
print('Erro: o arquivo aula1.py não foi encontrado')
sys.exit(1)
MAX_PRIMES = 10000
def primes_sieve(limit):
limitn = limit+1
not_prime = [False] * limitn
primes = []
for i in range(2, limitn):
if not_prime[i]:
continue
for... | {
"content_hash": "dfc36784c13dfb67569b96b47813dc4f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 53,
"avg_line_length": 21.174603174603174,
"alnum_prop": 0.6671664167916042,
"repo_name": "CalicoUFSC/minicurso-python",
"id": "1a58bf14f278628307ba469c1664385de9dcf958",
"... |
import glob
import io
import re
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
from setuptools import setup
def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *names),
encoding=kw... | {
"content_hash": "9fa3e5b39c22f98bb5fc0f1c423c8c28",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 113,
"avg_line_length": 30.09375,
"alnum_prop": 0.5950155763239875,
"repo_name": "ionelmc/nose-htmloutput",
"id": "ef20bc38a8a7598d577c54f687fde168755ba252",
"size": "1954"... |
import sys, types
class DbData(object):
def __init__(self, metadata, DeclarativeBase, session):
self.metadata = metadata
self.DeclarativeBase = DeclarativeBase
self.session = session
class BaseProcessor(object):
def __init__(self, to_mud, to_console):
"""Called when a... | {
"content_hash": "e481edf1a0cc9647342b65989a706da7",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 32.77906976744186,
"alnum_prop": 0.5877970911670806,
"repo_name": "sh-ft/mudwyrm_engine",
"id": "58a9dbf15fa51c16b7d2567add012a1444fb33c1",
"size": "... |
import argparse
import os
import re
def parse_invocations(path):
# # tt_run_test(test_minimal_func_decl, number_of_tests_run, number_of_tests_failed); \
with open(path, 'r') as content:
test_funcs = re.findall(
r'static char ?\* ?test_([\w_]+)\(', conte... | {
"content_hash": "dcf0337990f9a6032467b513dbc77aa5",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 128,
"avg_line_length": 39.026315789473685,
"alnum_prop": 0.6608226567768037,
"repo_name": "owensd/proteus",
"id": "305dc0c7a4dbc00f916e8905071e5af78fc53faf",
"size": "3013... |
import json
import requests
class NotAuthorizedException(BaseException):
pass
class IncorrectAuthInfoException(Exception):
pass
class RequestErroredException(Exception):
pass
def make_url(url, params):
url += '?'
for k,v in params.iteritems():
url += "%s=%s&" % (k, v)
... | {
"content_hash": "091777025436b205aafb6391602a8ccb",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 125,
"avg_line_length": 29.803571428571427,
"alnum_prop": 0.5395446375074895,
"repo_name": "falceeffect/PyVk",
"id": "ce3bb6d318fdc811bdd537e950b76da24a7af5b7",
"size": "3... |
import contextlib
from unittest import mock
from heat.common import exception as exc
from heat.engine import stack
from heat.engine import template
from heat.tests import common
from heat.tests import utils
class SoftwareConfigTest(common.HeatTestCase):
def setUp(self):
super(SoftwareConfigTest, self).s... | {
"content_hash": "1c9b71501e30c8c57203f758a9d959e1",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 73,
"avg_line_length": 37.72222222222222,
"alnum_prop": 0.6078792341678939,
"repo_name": "openstack/heat",
"id": "f194ec7355a4d9c706ec5d12aea9d6deb79f6dc6",
"size": "3291",... |
import sys, os
# 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.append(os.path.abspath('.'))
# -- General configuration... | {
"content_hash": "565e2a719fd5f7b2a539414f4181440f",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 92,
"avg_line_length": 32.966850828729285,
"alnum_prop": 0.7125858890564772,
"repo_name": "m000/django_generic_confirmation",
"id": "b1177c00ea29a533277a6eaa01b4f352a20c2e16... |
from datetime import time
from flask import request
from wtforms.fields import BooleanField, HiddenField, IntegerField, StringField, TextAreaField
from wtforms.validators import DataRequired, InputRequired, Optional, ValidationError
from indico.modules.events.papers.fields import PaperEmailSettingsField
from indico.m... | {
"content_hash": "904c16bb658dda51987d87441d820e79",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 120,
"avg_line_length": 43.37931034482759,
"alnum_prop": 0.6263910969793323,
"repo_name": "pferreir/indico",
"id": "e2bf40b50986cb414c79447590875f1f390c225c",
"size": "650... |
"""
Run all the examples in the $CLAW/doc/sphinx subdirectories that are used in the
documentation webpages.
"""
import os,sys
example_dirs = ["example-acoustics-1d", \
"example-acoustics-2d/1drad", \
"example-acoustics-2d", \
"example-acoustics-2d-amr"]
rootdir = os.g... | {
"content_hash": "0e4590d9687b3ef6075e88187e161a5a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 80,
"avg_line_length": 24.625,
"alnum_prop": 0.6209813874788495,
"repo_name": "clawpack/clawpack-4.x",
"id": "25d1182821a7d3b1b06361af6b3a8c862034e849",
"size": "591",
"b... |
from __future__ import absolute_import
from __future__ import print_function
import logging
from barf import BARF
from barf.core.reil import ReilMnemonic
logger = logging.getLogger(__name__)
def check_path_satisfiability(code_analyzer, path, start_address):
"""Check satisfiability of a basic block path.
... | {
"content_hash": "d7e13364fcbf492d671e6e6c1d51194d",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 127,
"avg_line_length": 42.20261437908497,
"alnum_prop": 0.5037943317330029,
"repo_name": "programa-stic/barf-project",
"id": "bd5428af3b39e646d955da6faa0736eb021e0910",
"... |
import pytest
from pyscipopt import Model, Eventhdlr, SCIP_RESULT, SCIP_EVENTTYPE, SCIP_PARAMSETTING
class NodeEventHandler(Eventhdlr):
def __init__(self):
self.calls = []
def eventinit(self):
self.model.catchEvent(SCIP_EVENTTYPE.NODEFOCUSED, self)
def eventexit(self):
self.mod... | {
"content_hash": "d4b4d358b24d2dde911c9d244e28da7b",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 103,
"avg_line_length": 27.28787878787879,
"alnum_prop": 0.61188228761799,
"repo_name": "SCIP-Interfaces/PySCIPOpt",
"id": "74f0c7e691d89a85f031a51532e704dc9f760f2e",
"size... |
import copy
import mock
from neutron.api.v2 import attributes as attr
from neutron.plugins.common import constants
from neutron.tests import base
from neutron.tests.unit.api.v2 import test_base as test_api_v2
from neutron.tests.unit.extensions import base as test_api_v2_extension
from oslo_utils import uuidutils
from ... | {
"content_hash": "5749feea17d5d4dcaa2f794da552dca2",
"timestamp": "",
"source": "github",
"line_count": 568,
"max_line_length": 77,
"avg_line_length": 43.730633802816904,
"alnum_prop": 0.5061395386287693,
"repo_name": "gaolichuang/neutron-fwaas",
"id": "65ce5f3679de78cf82b1e57069e1c611163de028",
"s... |
import os
from oslo_log import log as logging
from oslo_utils import uuidutils
from ironic.conf import CONF
from ironic.dhcp import base
LOG = logging.getLogger(__name__)
class DnsmasqDHCPApi(base.BaseDHCP):
"""API for managing host specific Dnsmasq configuration."""
def update_port_dhcp_opts(self, port_i... | {
"content_hash": "ced18669b38a03f4de6e7e3eaf60c462",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 78,
"avg_line_length": 35.145833333333336,
"alnum_prop": 0.5455443588223671,
"repo_name": "openstack/ironic",
"id": "c6f27afe467df8ad38a097a8ab10ecea4ef3f862",
"size": "56... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/furniture/all/shared_frn_all_decorative_lg_s1.iff"
result.attribute_template_id = 6
result.stfName("frn_n","frn_art")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "020be6274160c2a393f791f4f431ad1b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 86,
"avg_line_length": 23.76923076923077,
"alnum_prop": 0.6925566343042071,
"repo_name": "obi-two/Rebelion",
"id": "fb76809b3702c82a09735a0d134a69bde1a6860e",
"size": "454"... |
from webpay import WebPay
from httmock import HTTMock
import pytest
import tests.helper as helper
import webpay.errors as errors
class TestErrors:
def test_request_raises_api_exception(self):
with pytest.raises(errors.ApiError) as excinfo:
with HTTMock(helper.mock_api('/charges',
... | {
"content_hash": "9ca3c57dcc9a60957559bed8ca1fe240",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 76,
"avg_line_length": 42.57142857142857,
"alnum_prop": 0.565324384787472,
"repo_name": "yamaneko1212/webpay-python",
"id": "95b70a180ed15c32a9f31f87e2a6ae89aff9ff60",
"si... |
import vim
import sys
import os
from inspect import getsourcefile
closure_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(getsourcefile(lambda _:None))), '..'))
gflags_path = os.path.abspath(os.path.join(closure_path, 'gflags'))
if closure_path not in sys.path:
sys.path += [closure_path]
if gfla... | {
"content_hash": "1164b326a7b167456892977b8dcbe7fc",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 114,
"avg_line_length": 28.727272727272727,
"alnum_prop": 0.6424050632911392,
"repo_name": "asankah/closure-linter",
"id": "8a59b662d73d6e4a2147a278ae90491e34d7965d",
"size... |
from om.base import *
from sqlalchemy.orm import relationship, backref, column_property
from sqlalchemy import Table, MetaData, create_engine, Column, Integer, \
String, Float, ForeignKey, select
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.schema import UniqueConstraint,PrimaryKeyConstraint
... | {
"content_hash": "2ec457599f75d7d9d575c6a82b047149",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 123,
"avg_line_length": 33.06012658227848,
"alnum_prop": 0.5728917392552886,
"repo_name": "steve-federowicz/om",
"id": "e82f4d38b48365cc5fc9207a39839b1874a09fee",
"size": ... |
from runtime import classonlymethod
import console
def sum(x, y):
return x + y
def nop():
pass
class Foo(object):
def __init__(self, x):
self.x = x
def getX(self):
return self.x
def addX(self, y):
print Foo.bar(5)
return self.x + y
def nop(self):
pas... | {
"content_hash": "3afd401c1e602707457e3f5630715689",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 35,
"avg_line_length": 16.142857142857142,
"alnum_prop": 0.5787610619469027,
"repo_name": "kevinb7/js2py",
"id": "a01344be6d99da0c9e7e8e1b6223c9e0e8bd9522",
"size": "565",
... |
__author__ = 'fahadadeel'
import jpype
class AddSmartArt:
def __init__(self, dataDir):
print "init func"
self.dataDir = dataDir
self.Presentation=jpype.JClass("com.aspose.slides.Presentation")
self.SaveFormat=jpype.JClass("com.aspose.slides.SaveFormat")
self.SmartArtLayoutT... | {
"content_hash": "50cb4d00ae85003a678bf67d90e74f77",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 105,
"avg_line_length": 31.962025316455698,
"alnum_prop": 0.6605940594059406,
"repo_name": "asposeslides/Aspose_Slides_Java",
"id": "8165f2ca989f279b18e21bb070d0c3766a438749"... |
"""Commands for reading and manipulating target HTTPS proxies."""
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA)
class TargetHTTPSProxies(base.Group):
"""List, create, and delete target HTTPS proxies."""
TargetHTTPSProxies.detailed_help = {
'brie... | {
"content_hash": "8ff1c33d5ccf7f733bcc84ccb8e5a5e1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 68,
"avg_line_length": 28.846153846153847,
"alnum_prop": 0.7626666666666667,
"repo_name": "wemanuel/smry",
"id": "5f5e540c04f75aaba68a51c96f97788e99c10b7a",
"size": "425",
... |
from __future__ import with_statement
import logging
l = logging.getLogger(__name__)
from datetime import timedelta
from django.conf import settings
from django.core.management.base import CommandError
from django_lean.experiments.models import (Experiment, DailyEngagementReport,
... | {
"content_hash": "26e1f1f4459e241642d09d0ee0350cc7",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 87,
"avg_line_length": 40.829787234042556,
"alnum_prop": 0.6347055758207399,
"repo_name": "MontmereLimited/django-lean",
"id": "86286591631db8bbab61a43f5110f07891414d8c",
"... |
"""Config flow for elmax-cloud integration."""
from __future__ import annotations
import logging
from typing import Any
from elmax_api.exceptions import ElmaxBadLoginError, ElmaxBadPinError, ElmaxNetworkError
from elmax_api.http import Elmax
from elmax_api.model.panel import PanelEntry
import voluptuous as vol
from ... | {
"content_hash": "96be7b9a435e9bfdd075e5a1a73ce557",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 113,
"avg_line_length": 37.69111969111969,
"alnum_prop": 0.5820528580208973,
"repo_name": "toddeye/home-assistant",
"id": "6872a555b8a2a75a23809ba40460d8df1cb14082",
"size... |
import itertools
from werkzeug.datastructures import MultiDict
def to_multidict(value):
if not isinstance(value, MultiDict) and isinstance(value, dict):
value = _dict_to_multidict(value)
return value
def flatten(to_flatten_list):
if not isinstance(to_flatten_list, (list, tuple)):
return... | {
"content_hash": "b0d21c33429280452065ded3578fc634",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 68,
"avg_line_length": 24.568181818181817,
"alnum_prop": 0.6197964847363552,
"repo_name": "cbrand/python-filterparams",
"id": "4cae7e61bde0bd0bd5be5a747ddb535c6c59f050",
"s... |
"""
FILE: strategy.py
DESC: describes an arbitrage strategy.
"""
__author__ = 'Luis F. Serazo'
__email__ = 'lserazo.projects@gmail.com'
from collections import OrderedDict
class Arbitrage(object):
"""
Only want differences that are within the (lower, upper) interval
"""
def __init__(self, lower: int, upper: in... | {
"content_hash": "6646dc2d199560dee06636a1263f441c",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 72,
"avg_line_length": 23.761904761904763,
"alnum_prop": 0.6285905143620575,
"repo_name": "luserazo/OracleReloaded",
"id": "855af9ca0180989764982ce15fd911a9a57f3d3f",
"size... |
"""
SST-2 Binary text classification with XLM-RoBERTa model
=======================================================
**Author**: `Parmeet Bhatia <parmeetbhatia@fb.com>`__
"""
######################################################################
# Overview
# --------
#
# This tutorial demonstrates how to train a text... | {
"content_hash": "6e92106d2a59695712b563381317d246",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 139,
"avg_line_length": 36.205882352941174,
"alnum_prop": 0.6506904955320877,
"repo_name": "pytorch/text",
"id": "fbd602db9c19d5b5119c5edb99b4938c42a5d2be",
"size": "8677"... |
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.utils import override_settings
from django.views.generic.base import View
from django.utils.encoding import force_str
from .models import Author, Artist
class ListViewTest... | {
"content_hash": "fbd0888d76eae684587b83996954e1d7",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 92,
"avg_line_length": 48.58986175115207,
"alnum_prop": 0.65847875569044,
"repo_name": "jgeskens/django",
"id": "cc4d2f5966ae760c17d6a5133aca5815c1990796",
"size": "10544"... |
import os
import yaml
from oslo_config import cfg
CONF = cfg.CONF
def update_fabscript_map(fabscript_map):
for fabscript_name, fabscript in fabscript_map.items():
splited_name = fabscript_name.rsplit('/', 1)
fabscript_cluster = splited_name[0]
script = splited_name[1]
fabscript_ya... | {
"content_hash": "6a9385aa6f9ea1d6f07d44def00e044c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 77,
"avg_line_length": 33.73684210526316,
"alnum_prop": 0.6037441497659907,
"repo_name": "fabrickit/fabkit",
"id": "12558a9b734a9305bcd9b79ca1fd602e270f9bca",
"size": "658"... |
"""The tests for WebOS TV device triggers."""
import pytest
from homeassistant.components import automation
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutomationConfig,
)
from homeassistant.components.... | {
"content_hash": "39475177004aba35ec053ff4d9b31e34",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 97,
"avg_line_length": 32.33519553072626,
"alnum_prop": 0.531271596406358,
"repo_name": "nkgilley/home-assistant",
"id": "db15ce3a5920a617684024fff37da35d7166e996",
"size"... |
'''
This state downloads artifacts from artifactory.
'''
# Import python libs
from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
def downloaded(name, artifact, target_dir='/tmp', target_file=None):
'''
Ensures that the artifact from artifactory exists at given location.... | {
"content_hash": "a8943aa4379d79a5800869c6d1a34f3b",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 139,
"avg_line_length": 50.60606060606061,
"alnum_prop": 0.48008982035928144,
"repo_name": "smallyear/linuxLearn",
"id": "a535d17f1b167861f81e25787fce852ada6cabb2",
"size"... |
import os
import sys
import re
import logging
import fcntl
from optparse import OptionParser
from ksscommand import KssCommand, KssCommandException, KssCommandOptException
import __cmd__
try:
import karesansui
from karesansui import __version__
from karesansui.lib.utils import load_locale, execute_command... | {
"content_hash": "9a0e80d4ef7c92b58cad9019d7dd7444",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 128,
"avg_line_length": 37.86065573770492,
"alnum_prop": 0.5245724182723533,
"repo_name": "karesansui/karesansui",
"id": "538393cc29560b460720272e7c19dfd694c92a5f",
"size"... |
import numpy as np
import pytest
from inverse_covariance import (
QuicGraphicalLassoEBIC,
AdaptiveGraphicalLasso,
QuicGraphicalLassoCV,
)
from inverse_covariance.profiling import ClusterGraph
class TestAdaptiveGraphicalLasso(object):
@pytest.mark.parametrize(
"params_in",
[
... | {
"content_hash": "febe0308f5e2faec057cb8bbacdaa6cc",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 88,
"avg_line_length": 32.792682926829265,
"alnum_prop": 0.46374116772034213,
"repo_name": "skggm/skggm",
"id": "ada96d601a49d1e85041c045e4a7fca6ac4db9a3",
"size": "2689",
... |
import logging
import re
import unicodedata
from lxml import etree
from moxie.places.importers.helpers import prepare_document
logger = logging.getLogger(__name__)
rx = re.compile(' +')
# Normalization Form Compatibility Decomposition
UNICODE_NORMALIZE = "NFKD"
# Values for policies from librarydata
POLICIES = {
... | {
"content_hash": "136d287551486cb1ac21017d99c0ebf5",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 100,
"avg_line_length": 33.55345911949686,
"alnum_prop": 0.5746954076850984,
"repo_name": "ox-it/moxie",
"id": "dca489b71d05ea218d6e4931c423622eff86583a",
"size": "5335",
... |
import logging
from openerp import http
from openerp.http import request
_logger = logging.getLogger(__name__)
class BarcodeController(http.Controller):
@http.route(['/barcode/web/'], type='http', auth='user')
def a(self, debug=False, **k):
if not request.session.uid:
return http.local_r... | {
"content_hash": "e76d4d0f5f84d2e85fee3933a09feaca",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 74,
"avg_line_length": 27.866666666666667,
"alnum_prop": 0.6818181818181818,
"repo_name": "diogocs1/comps",
"id": "fa2744a4498cbe5d8335d6bb7def637fac76cfc0",
"size": "442",... |
from __future__ import absolute_import
import os
import re
import subprocess
from setuptools import setup
from setuptools import find_packages
from io import open
def version():
try:
pkg_info_version_re = re.compile("\nVersion: ([^\s]*)\n")
caller_path = os.path.dirname(__file__)
fd = open... | {
"content_hash": "aa2368ec1e64676e8e763366f5a23e62",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 76,
"avg_line_length": 34.09090909090909,
"alnum_prop": 0.5808,
"repo_name": "peragro/peragro-at",
"id": "1bbdabf6023b0a18aa4978ecf2139f717502ea83",
"size": "1875",
"bina... |
"""
Django settings for codebin project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | {
"content_hash": "da0bb458b9cd52734d023f031482d633",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 71,
"avg_line_length": 24.213483146067414,
"alnum_prop": 0.7150812064965197,
"repo_name": "UALR-CodeTalks/codetalks",
"id": "f5d6c49f9450087ed7222d34938f46250884629f",
"siz... |
import json
import os
from pathlib import Path
import pytest
from anchore_engine.configuration.localconfig import (
DEFAULT_CONFIG,
get_config,
load_defaults,
load_filepath_to_config,
load_policy_bundle_paths,
load_policy_bundles,
validate_config,
)
DEFAULT_CONFIG_FN = "config.yaml"
DEFAU... | {
"content_hash": "c34f9393ae8ad3d70b6c3a0e21fddc95",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 87,
"avg_line_length": 31.31904761904762,
"alnum_prop": 0.6515128478029497,
"repo_name": "anchore/anchore-engine",
"id": "845a3a57e04f203e4d1cfbd56f68515dfb278bd6",
"size"... |
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder import objects
from cinder.objects import base
from cinder.objects import fields as c_fields
from oslo_versionedobjects import fields
@base.CinderObjectRegistry.register
class Group(base.CinderPersistentObject, base.CinderObject,... | {
"content_hash": "a86a3282c5cabed88e2462817c12d84d",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 79,
"avg_line_length": 39.56284153005465,
"alnum_prop": 0.562292817679558,
"repo_name": "NetApp/cinder",
"id": "a7d0e6c15d710df9e674b609ff9f7d0c3d8854eb",
"size": "7851",
... |
from __future__ import with_statement, print_function
from math import fabs
from typing import List, Tuple
Instruction = Tuple[str, int]
Dir = Tuple[int, int]
NORTH = (0, 1)
SOUTH = (0, -1)
EAST = (1, 0)
WEST = (-1, 0)
DIRS = [NORTH, EAST, SOUTH, WEST]
def move_right(dir: Dir) -> Dir:
idx = DIRS.index(dir)
if i... | {
"content_hash": "d4304ecf99ea1012323aa5565ccfe4fd",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 75,
"avg_line_length": 22.93846153846154,
"alnum_prop": 0.608316566063045,
"repo_name": "mvader/advent-of-code",
"id": "b07743ea70870f3be94d9885c249c3f4921e5d9a",
"size": "... |
from flask import Flask
import connexion
from connexion.resolver import RestyResolver
from flask.ext.cors import CORS
app = connexion.FlaskApp(__name__)
app.add_api('swagger.yml', resolver=RestyResolver('api'))
CORS(app.app)
@app.route('/')
def default_landing():
return 'See <a href="/v1/ui">swagger api</a> and t... | {
"content_hash": "341bd3230caccf0c74080ce2056cfceb",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 102,
"avg_line_length": 28,
"alnum_prop": 0.6919642857142857,
"repo_name": "s-rusev/github-matchmaker",
"id": "467ce61a4e0e457396c3f994b2ec4facd846d731",
"size": "448",
"... |
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit(0)
with open('README.rst', 'r') as f:
long_description = f.read()
# Dynamically calculate the version based... | {
"content_hash": "5832be9261ea5e4f11cbe31885842a1d",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 80,
"avg_line_length": 29.34090909090909,
"alnum_prop": 0.6452362509682417,
"repo_name": "jonge-democraten/mezzanine-fullcalendar",
"id": "959063da43f75eee1546cf0acc5e6984b9b... |
import datetime
import glob
import heapq
import logging
import os
import os.path
import random
import re
import shutil
import subprocess as subprocess
import sys
import tempfile
import time
from catapult_base import cloud_storage # pylint: disable=import-error
import dependency_manager # pylint: disable=import-error... | {
"content_hash": "6044983ca0f662a8d797b433c6ec1e35",
"timestamp": "",
"source": "github",
"line_count": 602,
"max_line_length": 80,
"avg_line_length": 37.785714285714285,
"alnum_prop": 0.6502395920341144,
"repo_name": "SummerLW/Perf-Insight-Report",
"id": "4044ad9914189c20c16aa82bb210c5980c79410f",
... |
"""
Tests for Results.predict
"""
from statsmodels.compat.pandas import testing as pdt
import numpy as np
import pandas as pd
from numpy.testing import assert_allclose, assert_equal
from statsmodels.regression.linear_model import OLS
from statsmodels.genmod.generalized_linear_model import GLM
class CheckPredictRet... | {
"content_hash": "f903c0f32dd487f7d3bfd62fd5ec4a64",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 79,
"avg_line_length": 35.05263157894737,
"alnum_prop": 0.6004129129129129,
"repo_name": "jseabold/statsmodels",
"id": "1acc717023a35840ab6450b909a95c91f42e0a66",
"size": ... |
"""
WSGI config for djangoblog project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... | {
"content_hash": "4648d6f53c254ae51443b70f760d8069",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 79,
"avg_line_length": 44.71875,
"alnum_prop": 0.7945492662473794,
"repo_name": "NikhilKalige/DjangoBlog",
"id": "94e15f2161578f1d81e180cf65dffaac88967bf2",
"size": "1431",... |
import frappe
from frappe import _
from frappe.model import no_value_fields
from frappe.model.document import Document
from frappe.translate import set_default_language
from frappe.twofactor import toggle_two_factor_auth
from frappe.utils import cint, today
from frappe.utils.momentjs import get_all_timezones
class Sy... | {
"content_hash": "27982ac052bd0e3e3a0227d9d5c483ab",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 105,
"avg_line_length": 32.26,
"alnum_prop": 0.7120272783632982,
"repo_name": "frappe/frappe",
"id": "1fc27ca1147e72411ce01c5a69d0fc8142c37a7f",
"size": "3324",
"binary"... |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import NoArgsCommand
from docutil.commands_util import recocommand
from docutil.str_util import smart_decode
from codebase.actions import diff_codebases
class Command(NoArgsCommand):
option_list = NoArgsComm... | {
"content_hash": "7aea94a6ff8acce47da47da48d723eb3",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 66,
"avg_line_length": 40.275862068965516,
"alnum_prop": 0.6523972602739726,
"repo_name": "bartdag/recodoc2",
"id": "980667d901e48ad982d6002944a424c3f561ce2e",
"size": "116... |
import ustruct
from ubinascii import hexlify, unhexlify
from micropython import const
"""
Fixed channel ids for L2CAP packets
References can be found here:
* https://www.bluetooth.org/en-us/specification/adopted-specifications - Core specification 4.1
** [vol 3] Part A (Section 2.1) - Channel identifiers
"""
... | {
"content_hash": "4542919dcbcf1606c6a2b25c9cad94c3",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 99,
"avg_line_length": 33.61304347826087,
"alnum_prop": 0.5884102962100634,
"repo_name": "dmazzella/uble",
"id": "7192b498d45c04c2f10b1a2ba938423d1ffa0fd0",
"size": "7803"... |
from __future__ import with_statement
import re
from .basecase import BaseTestCase, cqlsh
from .cassconnect import testrun_cqlsh
import unittest
import sys
BEL = '\x07' # the terminal-bell character
CTRL_C = '\x03'
TAB = '\t'
# completions not printed out in this many seconds may not be acceptable.
# tune if needed... | {
"content_hash": "e0c57aa318ee219b0bd42754dba236b4",
"timestamp": "",
"source": "github",
"line_count": 787,
"max_line_length": 119,
"avg_line_length": 52.38754764930114,
"alnum_prop": 0.48480438526280045,
"repo_name": "Imran-C/cassandra",
"id": "8485ff08a4a9e4d671df78695ff04917b8214a29",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('article', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.... | {
"content_hash": "ecf205192851b44f3efe058dda9f70be",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 114,
"avg_line_length": 27.75862068965517,
"alnum_prop": 0.5416149068322982,
"repo_name": "F483/trainlessmagazine.com",
"id": "0fa3eedd8df4692e50b33ad097b2c22bd72c5ce3",
"s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import sys
from __main__ import cli
from ansible.compat.six import iteritems
from ansible.errors import AnsibleError
from ansible.parsing.dataloader import DataLoader
from ansible.parsing.yaml.objects import AnsibleMappi... | {
"content_hash": "9028f5a564f67f6b81149cb742ce686d",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 143,
"avg_line_length": 40.96842105263158,
"alnum_prop": 0.6138232271325796,
"repo_name": "alan-c/trellis",
"id": "c9dadfbd012979115885de3dcb4ec16e87389aab",
"size": "3892"... |
import unittest
import subprocess
import os
import shutil
from rmgpy import getPath
from rmgpy.qm.main import QMSettings, QMCalculator
from rmgpy.molecule import Molecule
from rmgpy.qm.gaussian import Gaussian
from rmgpy.qm.mopac import Mopac
class TestQMSettings(unittest.TestCase):
"""
Contains unit tests f... | {
"content_hash": "36f6e0257a816c7b3c92e74fa8088aef",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 117,
"avg_line_length": 36.90421455938697,
"alnum_prop": 0.7003737541528239,
"repo_name": "pierrelb/RMG-Py",
"id": "4c6ad6b66c753afbd4a4e0cf9be2ae03ca86236a",
"size": "967... |
import sys, os
# 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.append(os.path.abspath('.'))
# -- General conf... | {
"content_hash": "c2a3298a307a1b40c58f3a50632b4c9a",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 86,
"avg_line_length": 33.82608695652174,
"alnum_prop": 0.6908740359897172,
"repo_name": "mowema/verano",
"id": "bfd57654c6bf0167a9d0de5cd8f3db3cf0adaf6f",
"size": "6659",... |
from __future__ import unicode_literals
import logging
from collections import OrderedDict
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.contrib.auth.tokens import default_token_generator
fro... | {
"content_hash": "f76052107d7e2cd4f0927a94323d9ae0",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 100,
"avg_line_length": 33.54705882352941,
"alnum_prop": 0.6273014203051026,
"repo_name": "stackdio/stackdio",
"id": "36ce86f49f44ff0784c3e8e2c9cda55adf094886",
"size": "1... |
from __future__ import print_function
import flask
from app import database_read
def main():
if 'order_nr' not in flask.request.args:
flask.abort(404, 'Unknown order_nr')
body = "<p>Your payment status is '%s'" % database_read(flask.request.args['order_nr'])
body += '<p>'
body += '<a href="/... | {
"content_hash": "243b07ea6c69288c08a1ecb0c15e6106",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 91,
"avg_line_length": 21.55,
"alnum_prop": 0.5893271461716937,
"repo_name": "Akoten/mollie-api-python",
"id": "a340a5131752c107f4d93235816248ea81e5c0fc",
"size": "613",
... |
from sugerencias import *
from efectivo import *
from yes_no import *
from aceptar import *
| {
"content_hash": "82effba4de40cd42840f1ae52f68d37c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 25,
"avg_line_length": 23,
"alnum_prop": 0.7717391304347826,
"repo_name": "vallemrv/tpvB3",
"id": "a878c0378cda3d3223340094b3616cfa006d9b51",
"size": "286",
"binary": fals... |
"""Generates chains of network neighbour from the results of traceroute
From the current host, a set of hosts can be tried to be reached by using the
``traceroute`` facility. Then the chains of neighbour hosts are going to be
dumped into a pickle file to be further processed.
"""
import subprocess
import ipaddress
i... | {
"content_hash": "6d4f4dd6bd0e389ff510a1d950ccddcc",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 79,
"avg_line_length": 22.612068965517242,
"alnum_prop": 0.6126572626763248,
"repo_name": "tschijnmo/TopologyFromTraceroute",
"id": "64865c0fefb5a99b95e2d341e0de1af5be074f2f... |
"""
Created on Feb 2, 2018
@author: nhan.nguyen
This module contains class "PerformanceTestRunner" that executes the test base
on the mode that user pass to system.
"""
import os
import argparse
import time
import threading
import asyncio
import sys
import perf_add_requests
import perf_get_requests
import perf_load
... | {
"content_hash": "ebd198692376c320d4045da2f382b3ea",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 79,
"avg_line_length": 38.649732620320854,
"alnum_prop": 0.509789000345901,
"repo_name": "spivachuk/sovrin-node",
"id": "53e2a9d9b1f9069fd5c7165a228b7c675df46b06",
"size":... |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def is_active(context, url):
current_path = context.request.get_full_path()
if current_path.startswith(url):
return 'active'
return ''
| {
"content_hash": "44b97642a4ac55745c86a054e8acb62b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 50,
"avg_line_length": 23.363636363636363,
"alnum_prop": 0.7042801556420234,
"repo_name": "allcaps/django-scaffold",
"id": "a0700f62c1fd936cc17e7037f2e1d1c3dac0c991",
"size... |
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax):
def __init__(self):
GenericSyntax.__init__(self)
@staticmethod
def escape(expression, qu... | {
"content_hash": "a28bd63f1cdd7c2a4f84a711bdaf04c3",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 126,
"avg_line_length": 33.36363636363637,
"alnum_prop": 0.6158038147138964,
"repo_name": "JeyZeta/Dangerous",
"id": "48c8781475b548dd45f55501139db07615b1f9ad",
"size": "75... |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.internal_gains import ElectricEquipment
log = logging.getLogger(__name__)
class TestElectricEquipment(unittest.TestCase):
def setUp(self):
self.fd, self.path = temp... | {
"content_hash": "6c479293bff3cb45a19d43be52a89ef9",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 121,
"avg_line_length": 39.34615384615385,
"alnum_prop": 0.6728576083414793,
"repo_name": "rbuffat/pyidf",
"id": "606ad7c1e55e4398344081a3e8efea976b6d9a31",
"size": "3069",... |
from .util import journalpump_initialized
from journalpump.journalpump import JournalPump
from subprocess import Popen
from time import sleep
import json
import logging
import logging.handlers
import os
import random
import re
import socket
import string
import threading
RSYSLOGD = "/usr/sbin/rsyslogd"
RSYSLOGD_TCP_... | {
"content_hash": "ab33ca955658ef7ac559f7684ad9ec5f",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 120,
"avg_line_length": 33.1063829787234,
"alnum_prop": 0.5616966580976864,
"repo_name": "aiven/kafkajournalpump",
"id": "1bfa7a47ae3a0c1f1260553d65964e59b3836b7c",
"size"... |
"""An executor for running Hadoop/Hive jobs in Qubole cluster.
For more information about Qubole and its API, please check:
- https://api.qubole.com
"""
import getpass
import logging
import os
import re
import subprocess
import sys
import StringIO
import time
from qds_sdk.commands import Command
from qds_sdk.com... | {
"content_hash": "298582faedd595e28f3e0a21e2fd6e41",
"timestamp": "",
"source": "github",
"line_count": 444,
"max_line_length": 91,
"avg_line_length": 38.53603603603604,
"alnum_prop": 0.5548801870251315,
"repo_name": "jparise/pinball",
"id": "f353c91a3fe15eeeb0c111258add41eab659b77e",
"size": "1769... |
"""Data structures for programs executable on a quantum runtime."""
import abc
import dataclasses
from dataclasses import dataclass
from typing import Union, Tuple, Optional, Sequence, cast, Dict, Any, List, Iterator
import cirq
from cirq import _compat, study
class ExecutableSpec(metaclass=abc.ABCMeta):
"""Spe... | {
"content_hash": "bae4e6b324e884c3a9732920e1679c5a",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 100,
"avg_line_length": 39.65,
"alnum_prop": 0.665534969444175,
"repo_name": "quantumlib/Cirq",
"id": "3b256aac305aa86dbd5a89d0b97677fc1fb47bf3",
"size": "10894",
"binar... |
import unittest
import copy
import config
import thread_cert
from pktverify.packet_verifier import PacketVerifier
LEADER = 1
ROUTER = 2
MTD = 3
FRAGMENTED_DATA_LEN = 256
# Test Purpose and Description:
# -----------------------------
# The purpose of this test case is to validate the Realm-Local addresses
# that the... | {
"content_hash": "0705cdb3bf75ab7b7c36293791a3cf66",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 83,
"avg_line_length": 36.208888888888886,
"alnum_prop": 0.5428992267092181,
"repo_name": "bukepo/openthread",
"id": "41cfc7c970a4ac72b521849400e212ce25da1357",
"size": "9... |
import threading
import sys
import os
import json
import itertools
import time
from queue import Queue
import urllib.parse
import requests
from .common.utils import log
from .common import utils
# names to export
__all__ = ['stackhut_api_call', 'stackhut_api_user_call', 'keen_client', 'get_res_path', 'Spinner']
# Se... | {
"content_hash": "aab94dd8da062e5fb7357aa76f0f3d84",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 105,
"avg_line_length": 35.62043795620438,
"alnum_prop": 0.5885245901639344,
"repo_name": "StackHut/stackhut",
"id": "626cd6ef5392d74964e9f7de43caa984f6a9e294",
"size": "5... |
import requests
from send_mail import SendMail
import logging
from string import Template
import base64
class SendReminders:
'''Class responsible in filter the data, to configure the template data and to send the email.
'''
def __init__(self, db_cursor, mandrill_config):
self.db_cursor = db_curs... | {
"content_hash": "9115139ba69702600e2abebe83495c29",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 138,
"avg_line_length": 29.428571428571427,
"alnum_prop": 0.6157580283793876,
"repo_name": "alexgarzao/email_reminders",
"id": "634ef8b0385bc4e8dd74e8d7e779332d1a8a170f",
"... |
import os
import time
from subprocess import Popen as execute
from twisted.internet.defer import Deferred
#---------------------------------------------------------------------------#
# configure the client logging
#---------------------------------------------------------------------------#
import logging
log = log... | {
"content_hash": "8ac67fd43d306df1b6b73584257a0e60",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 81,
"avg_line_length": 37,
"alnum_prop": 0.5643056849953402,
"repo_name": "uzumaxy/pymodbus3",
"id": "2782485587ab79f8290117dc747194f32c49e7e2",
"size": "2146",
"binary":... |
"""
WSGI config for djangoSRV project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`... | {
"content_hash": "1dd3d6f2e764bb6791c110dadcdf7c20",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 79,
"avg_line_length": 44.625,
"alnum_prop": 0.7941176470588235,
"repo_name": "varun-verma11/CodeDrill",
"id": "cfbc6160ee3aa768a8103698ff0a3b3f627a6550",
"size": "1428",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.