text stringlengths 4 1.02M | meta dict |
|---|---|
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPT... | {
"content_hash": "b69eab83672ad281dc4136543a861735",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 99,
"avg_line_length": 30.16923076923077,
"alnum_prop": 0.4915859255481897,
"repo_name": "RohitRepo/onepunch",
"id": "f3366f5aa3ad3737375c09998b08bdf827de31ef",
"size": "19... |
from rest_framework import serializers
from text.models import Text
class AnalyzeSerializer(serializers.Serializer):
url = serializers.CharField(required=True)
class TextSerializer(serializers.ModelSerializer):
id = serializers.SerializerMethodField('get_id')
def get_id(self, obj):
return obj... | {
"content_hash": "996597f3f8e06d803261902a6ea31f83",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 53,
"avg_line_length": 21.25,
"alnum_prop": 0.7235294117647059,
"repo_name": "blumug/texapi",
"id": "239adda1946ea993212b09f93252d2a8bacad36a",
"size": "510",
"binary": f... |
from struct import unpack
# custom import
from .DataTypeConverters import readBew, readVar, varLen
class RawInstreamFile:
"""
It parses and reads data from an input file. It takes care of big
endianess, and keeps track of the cursor position. The midi parser
only reads from this object. N... | {
"content_hash": "7d7edfba4ae92b816fcd19d0f222368f",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 71,
"avg_line_length": 28.048076923076923,
"alnum_prop": 0.5831333561878642,
"repo_name": "hgijeon/the_PLAY",
"id": "fdde72591bcf06b60ab56b5f16b6844454c393b8",
"size": "29... |
import logging
import redis
import json
import re
import os
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from pylons.decorators import jsonify
from mapofinnovation.lib.base import BaseController, render
from datetime import datetime
log = log... | {
"content_hash": "4fb922e5c397d02271cd2e8fce035717",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 69,
"avg_line_length": 25.06451612903226,
"alnum_prop": 0.6748176748176749,
"repo_name": "AnanseGroup/map-of-innovation",
"id": "0d6059c220d30963501a77d0d4d9ade5182a044d",
... |
"""Post-processing model outputs to generate detection."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
from six.moves import range
import tensorflow.compat.v1 as tf
from utils import box_utils
def generate_detections_factory(params):... | {
"content_hash": "e2763419b0df3010224bd891288e5540",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 80,
"avg_line_length": 42.622837370242216,
"alnum_prop": 0.6583049196298101,
"repo_name": "tensorflow/tpu",
"id": "b3d327d886ee0d16e27150470b8ea810478ea96f",
"size": "1300... |
"""aniauth accounts app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='ho... | {
"content_hash": "04bd4d42a7bdb98ca71d47181ad21687",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 79,
"avg_line_length": 34.26923076923077,
"alnum_prop": 0.6823793490460157,
"repo_name": "randomic/aniauth-tdd",
"id": "83add2cdd8010e1e6369ce1dea7bd572dfba6453",
"size": "... |
"""
TMVA factory runs with classifier and additional information
"""
from __future__ import division, print_function, absolute_import
import sys
import os
from rootpy.io import root_open
import ROOT
from . import tmva
from six.moves import cPickle as pickle
__author__ = 'Tatiana Likhomanenko'
def tmva_proces... | {
"content_hash": "393f8ad18c5b9fef8b94866d3ec6e973",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 117,
"avg_line_length": 39.53086419753087,
"alnum_prop": 0.6574016239850093,
"repo_name": "Quadrocube/rep",
"id": "eefa50a41be6e86584dc4722015bb6d8f23084e9",
"size": "3202"... |
from __future__ import unicode_literals, print_function
from pprint import pformat
try:
from collections import OrderedDict
from argparse import ArgumentParser
except ImportError:
# Python 2.6 stuff
from tests.OrderedDict import OrderedDict
from tests.argparse import ArgumentParser
from ashes impo... | {
"content_hash": "eb1bcf72ae70588e657d39a699225e40",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 100,
"avg_line_length": 34.12162162162162,
"alnum_prop": 0.5762376237623762,
"repo_name": "jvanasco/ashes",
"id": "8cbdf304464d0f91eb4c90f458f48d95b6e7c278",
"size": "7597... |
from mock import Mock, patch
import unittest
from pin.lib import p
from tests import fixtures
class TestService(unittest.TestCase):
def setUp(self):
fixtures.reset()
self.service = p.modes["service"]
self.service.enable()
def test_menu_next(self):
p.events.post("switch_servic... | {
"content_hash": "4be95fcd23aeeb84bd7ac8a06a8e6447",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 79,
"avg_line_length": 41.74634146341464,
"alnum_prop": 0.6180182285580743,
"repo_name": "town-hall-pinball/project-omega",
"id": "88406e240af1b850161f33f081ea04ead7dd89fb",... |
import romeo #avoid import circularites, reference everything from the top object
@romeo.grammars.query(pattern="^select (?P<parameter>.+)", form="select <key>",
help="returns a list of objects with the given key")
def select_parameter(parameter):
for obj in romeo.foundation.RomeoKeyValue.search(parameter):
... | {
"content_hash": "73dafeba7eb0dbf9bb0344a948a617ce",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 88,
"avg_line_length": 43.666666666666664,
"alnum_prop": 0.6793893129770993,
"repo_name": "OrbitzWorldwide/droned",
"id": "ca4eac849546658c9b68634bb183b2ea32fa9e29",
"size"... |
import cookielib
import mechanize
#import weakref
import random
import time
import uuid
import sys
from loremipsum import get_sentence
from birdie_settings import *
from initialize_db import (
User,
DBSession,
)
class FakeUser(object):
def __init__(self, browser):
rand = random.randra... | {
"content_hash": "dc276642e86c81dc06f957289152682c",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 106,
"avg_line_length": 28.38317757009346,
"alnum_prop": 0.563549555482384,
"repo_name": "anhaflint/RedisBirdie",
"id": "c1a648da37513bad794b17a04f971f74675ae92c",
"size":... |
import time
import logging
import select
import gevent.queue as queue
from gevent.lock import RLock
class ConnectionWrapper(object):
"""ConnectionWrapper """
def __init__(self,pool,connection):
self.pool = pool
self.connection = connection
def getConnection(self):
return se... | {
"content_hash": "a677bc32576c0f4b77dec89d52fe2998",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 180,
"avg_line_length": 37.373801916932905,
"alnum_prop": 0.5759104120362455,
"repo_name": "slaff/attachix",
"id": "6e10f2edb396b0ceb5e46e31ac546d1b530728cf",
"size": "116... |
import os
import sys
sys.path.append("../..")
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangocelery_example.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "284912afb6cb2615a3917669731bb756",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 84,
"avg_line_length": 24.272727272727273,
"alnum_prop": 0.700374531835206,
"repo_name": "fatrix/django-golive",
"id": "856850c37b8e434d17a21e8d223ba3d32e9a1d8c",
"size": "... |
import inspect
import pathlib
import gdsfactory as gf
from gdsfactory.serialization import clean_value_json
filepath = pathlib.Path(__file__).parent.absolute() / "components.rst"
skip = {}
skip_plot = [
"component_lattice",
"component_sequence",
"extend_port",
"extend_ports_list",
]
skip_settings ... | {
"content_hash": "bff8b938087a64e66b2fa74f0aa4457d",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 112,
"avg_line_length": 20.473684210526315,
"alnum_prop": 0.5115681233933161,
"repo_name": "gdsfactory/gdsfactory",
"id": "5f3fbe66e93ef69c2ef2d7e8e11b5e5247b5f2d5",
"size"... |
import ConfigParser
import os
import os.path as os_path
from almanach.common.exceptions.almanach_exception import AlmanachException
configuration = ConfigParser.RawConfigParser()
def read(filename):
if not os_path.isfile(filename):
raise AlmanachException("Config file '{0}' not found".format(filename))
... | {
"content_hash": "cd33f0413a42dbfb9ab61a9d4e2a4601",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 79,
"avg_line_length": 20.918032786885245,
"alnum_prop": 0.679858934169279,
"repo_name": "internap/almanach",
"id": "97307f508324d1af35db6d45e262bd4774be1481",
"size": "31... |
import sys
import os
from optparse import OptionParser
import ConfigParser
CONFIG_FILE = '/etc/stratuslab/pdisk-host.conf'
class ListRegisteredVolumes(object):
"""
Utility to list the persistent disk volume URIs registered with
a virtual machine.
"""
def __init__(self, args):
self._rea... | {
"content_hash": "fbace42ec931324174fb776621ba10b0",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 94,
"avg_line_length": 26.96923076923077,
"alnum_prop": 0.5767256132344553,
"repo_name": "StratusLab/storage",
"id": "33c40d4d9e045d7dbc280a3220461f218e0645fa",
"size": "23... |
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class ReverseSequenceOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsReverseSequenceOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = ReverseS... | {
"content_hash": "17c4ff2ddccc0dff9a84d95200f3f953",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 114,
"avg_line_length": 36.06666666666667,
"alnum_prop": 0.7046210720887246,
"repo_name": "google-research/falken",
"id": "c185b09844cc7c3eec0af6c6f7196fcc5e91bb3e",
"size"... |
import networkx as nx
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import operator
import ast
class DrawGraph:
def __init__(self):
pass
# draw the graph specified in the bracket
# save to output.png
def draw_this_graph(self, k, pos, ind, mylist):
# would li... | {
"content_hash": "ee19489264251ce4c1ace76c4b33780e",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 127,
"avg_line_length": 41.21739130434783,
"alnum_prop": 0.5938818565400844,
"repo_name": "tautomer/mcmc",
"id": "7a54a6c49e95467f6ed8b8b9102cc25aacc7f129",
"size": "2966",... |
from __future__ import absolute_import, unicode_literals
urlpatterns = []
| {
"content_hash": "d3b438f58a7b0296d8df0380140198d1",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 56,
"avg_line_length": 25,
"alnum_prop": 0.7466666666666667,
"repo_name": "mspeedy/django-health-check",
"id": "82e8f9dd5a88987ab49e60b047ac1ded88acab3a",
"size": "99",
"b... |
import collections
import os
from abstractions import *
import data.jsonl
DATA_DIRECTORY = 'data'
USER_DIRECTORY = 'users'
def load_data(user_dataset, review_dataset, restaurant_dataset):
with open(os.path.join(DATA_DIRECTORY, user_dataset)) as f:
user_data = jsonl.load(f)
with open(os.path.join(DATA... | {
"content_hash": "694cd4c42bd77a74974856522413321e",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 94,
"avg_line_length": 33.77777777777778,
"alnum_prop": 0.6480263157894737,
"repo_name": "ajponte/yelpML",
"id": "3da5c9bd728b0c898b658c1d29b21823f727e081",
"size": "3040",... |
""" Return node
This one exits functions. The only other exit is the default exit of functions with 'None' value, if no return is done.
"""
from .NodeBases import ExpressionMixin, NodeBase, StatementChildrenHavingBase
class StatementReturn(StatementChildrenHavingBase):
kind = "STATEMENT_RETURN"
named_child... | {
"content_hash": "4b99f75c6aed1f53610c594be3c85737",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 119,
"avg_line_length": 29.523255813953487,
"alnum_prop": 0.6522252855454903,
"repo_name": "wfxiang08/Nuitka",
"id": "dcacdfe2e5096c4329034200da995f96d3a262d1",
"size": "33... |
"""Replay components for DQN-type agents."""
import collections
import typing
from typing import Any, Callable, Generic, Iterable, List, Mapping, Optional, Sequence, Text, Tuple, TypeVar
import dm_env
import numpy as np
import snappy
from tandem_dqn import parts
CompressedArray = Tuple[bytes, Tuple, np.dtype]
# Ge... | {
"content_hash": "a07a5e98c65c4099cdd85eaf5821a113",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 108,
"avg_line_length": 33.29220779220779,
"alnum_prop": 0.6621806124439243,
"repo_name": "deepmind/deepmind-research",
"id": "e9196901331790226f94aa885f2972a400991d79",
"... |
from collections import namedtuple
import dill as pickle # dill supports 'pickling nested classes'
from database import DatabaseTableModel
from tableview import *
class TableController(object):
# class defaults
__default_join_type = 'inner'
__default_direction = 'full'
def __init__(self, table_mo... | {
"content_hash": "d572e796e996f278e4c486ba4fc790b7",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 106,
"avg_line_length": 37.75229357798165,
"alnum_prop": 0.5491292021061158,
"repo_name": "sanchaez/python_labs",
"id": "146db54aed4ec2bfd7115c8f2160862731654953",
"size":... |
"""
Flip API
Flip # noqa: E501
The version of the OpenAPI document: 3.1
Contact: [email protected]
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_flip.configuration import Configuration
class DeletedResponse(... | {
"content_hash": "a8b410b139ca0eb798293112543f79a9",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 82,
"avg_line_length": 28.330578512396695,
"alnum_prop": 0.5644690781796966,
"repo_name": "Telestream/telestream-cloud-python-sdk",
"id": "ea128793c11d87903e8cb11ccde872e26c... |
from django.core.urlresolvers import reverse
from core.mixins import JSONView, JSONListView
from .mixins import VideoListMixin, VideoDetailMixin, VideoUserListMixin
from .mixins import VideoByTagListMixin, TagListMixin
def _get_item(db_video, request):
href_relative_uri = reverse('api:videos:video',
... | {
"content_hash": "5378b63662cced4a0fe554ecf609b152",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 77,
"avg_line_length": 31.63758389261745,
"alnum_prop": 0.5630038184132372,
"repo_name": "lotube/lotube",
"id": "def975cdb969e43d003064c7d3329d2076f3b9b9",
"size": "4714",... |
from .audiogrep import *
| {
"content_hash": "da08305e50e89e79d46f42b7b9b2809b",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 24,
"avg_line_length": 25,
"alnum_prop": 0.76,
"repo_name": "antiboredom/audiogrep",
"id": "b996c17656ec9b46727cab504f3b11d955d29691",
"size": "25",
"binary": false,
"co... |
def remove_trailing_slashes(url: str) -> str:
while url.endswith("/"):
url = url[:-1]
return url
| {
"content_hash": "f8d7267faecab9017a00866b34e68d7f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 28.25,
"alnum_prop": 0.5752212389380531,
"repo_name": "linkedin/WhereHows",
"id": "384ed34e4708ee61eb9b947babe9002a5b81a5b6",
"size": "113",
"binary... |
from __future__ import absolute_import
from __future__ import print_function
import logging
import mock
import requests
from typing import Any, Dict, Tuple, Text, Optional
from requests import Response
from zerver.lib.outgoing_webhook import do_rest_call, OutgoingWebhookServiceInterface
from zerver.lib.test_classes i... | {
"content_hash": "a6e7147c8b45c51aeefc26e41cb737f0",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 133,
"avg_line_length": 49.583333333333336,
"alnum_prop": 0.6443697478991597,
"repo_name": "verma-varsha/zulip",
"id": "97f9fa43fbdda3c72cf45a89ee8011291b13ab85",
"size": ... |
"""
Tests for the API /ports/ methods.
"""
import datetime
import mock
from oslo_config import cfg
from oslo_utils import timeutils
from oslo_utils import uuidutils
import six
from six.moves import http_client
from six.moves.urllib import parse as urlparse
from testtools import matchers
from wsme import types as wtyp... | {
"content_hash": "218d8df77a3baf87598da7cfd76db56d",
"timestamp": "",
"source": "github",
"line_count": 1423,
"max_line_length": 79,
"avg_line_length": 49.84961349262122,
"alnum_prop": 0.549481222510432,
"repo_name": "ruyang/ironic",
"id": "b6f1bc36e0fde31650aa11ddb6207bdba95d3e0c",
"size": "71536"... |
import logging
from ncclient import manager
import sys
# the variables below assume the user is requesting access to a
# Nexus device running in VIRL in the DevNet Always On Sandbox
# use the IP address or hostname of your Nexus device
HOST = '172.16.1.82'
# use the NETCONF port for your Nexus device
PORT = 22
# use... | {
"content_hash": "09547b6d72869b8d3cc27e94d20d29f3",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 79,
"avg_line_length": 32.266666666666666,
"alnum_prop": 0.6663223140495868,
"repo_name": "CiscoDevNet/netconf-examples",
"id": "64753bf77efbcb780b5bc9dec26149f4aab77554",
... |
import site
import getopt, string, sys
from PIL import Image
def usage():
print "PIL Convert 0.5/1998-12-30 -- convert image files"
print "Usage: pilconvert [option] infile outfile"
print
print "Options:"
print
print " -c <format> convert to format (default is given by extension)"
print
... | {
"content_hash": "6e248aaff179c35268a72fe9eeb57b2a",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 76,
"avg_line_length": 23.432098765432098,
"alnum_prop": 0.5305584826132771,
"repo_name": "DMLoy/ECommerceBasic",
"id": "a8b3ab0ecd8137443dcd79d97c6e7b66c34592f6",
"size": ... |
'''
utils.py
Functions that don't fit anywhere else.
'''
import random
import pickle
import math
from io import BytesIO
import os
import glob
import socket
import math
import zipfile
import itertools
from PIL import Image
import numpy as np
'''
IMAGES
'''
def scale(im, size=128):
'''
accepts: PIL image, ... | {
"content_hash": "78c96d8a37c334ec8a58a8333d5a785e",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 77,
"avg_line_length": 18.586854460093896,
"alnum_prop": 0.5950997726698661,
"repo_name": "SarthakJShetty/MyDonkey",
"id": "e4455a4a32c72c83dfca7f076aa93e15fc1d376f",
"siz... |
"""Given experimental parameters, runs the required experiments and obtains the data.
To be executed on the Hadoop main node.
"""
import argparse
import ConfigParser
import datetime
import re
from benchmark_utils import *
from paths import *
VALID_PARAMS = {"lambda", "minpart", "samplefrac", "oraclesize", "num-execut... | {
"content_hash": "ebf5a792686e444479e95ac5adc7ef67",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 125,
"avg_line_length": 45.475,
"alnum_prop": 0.5136888400219901,
"repo_name": "dalab/dissolve-struct",
"id": "27224ca08ee9b63c4b5f0d3cd73cb28f7776aeba",
"size": "9095",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('books', '0002_auto_20170804_0821'),
]
operations = [
migrations.RenameField(
model_name='book',
old_name='author',
... | {
"content_hash": "44a8d08070c3fc33e4bd60fbd9dcece0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 45,
"avg_line_length": 20,
"alnum_prop": 0.5722222222222222,
"repo_name": "nirajkvinit/python3-study",
"id": "1fa9967a16f247b3ab6e971f5f51171131f09e9e",
"size": "384",
"b... |
import _plotly_utils.basevalidators
class ColorbarValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="colorbar", parent_name="splom.marker", **kwargs):
super(ColorbarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "cb9e59eedbc11a48960b9f3c40e17dba",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 85,
"avg_line_length": 47.49561403508772,
"alnum_prop": 0.5228552959645396,
"repo_name": "plotly/python-api",
"id": "1b45201545daed20eb5a6873d6bd4067bd0c4294",
"size": "10... |
import os,os.path,sys,datetime,subprocess,string,urllib,zipfile
from time import strftime
if sys.version_info[0] >= 3:
import urllib.request as ur
#------------------------
# 2015-02-05 D. O'Hara - requires wget
# 2015-02-06 RSD - requires Python 3.2+, takes command line arguments
# 2015-02-18 RSD - Fix co... | {
"content_hash": "eadea5c5e8c371efa50230de265f3e5e",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 179,
"avg_line_length": 47.24226804123711,
"alnum_prop": 0.5788325150027278,
"repo_name": "OHDSI/ETL-CMS",
"id": "559236e9bad4b1ae5757e22bb2826d8a9598b4b2",
"size": "9165"... |
import os
import pytest
import shutil
import uuid
from django.conf import settings
from blog.models import Post
from core.services import (
convert_to_mp3_preview,
convert_to_ogg_preview,
convert_to_ogg_release,
)
class FFMpegTest:
@classmethod
@pytest.mark.django_db
def setup_class(cls):
... | {
"content_hash": "24fff712dcc6602cf4b562c2ad36140d",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 77,
"avg_line_length": 29.58108108108108,
"alnum_prop": 0.6180904522613065,
"repo_name": "manti-by/M2MICRO",
"id": "04c6379b9237bd07ad9761c1ee2e3eb0e58c19cd",
"size": "2189... |
from midonetclient import resource_base
from midonetclient import vendor_media_type
class L2Service(resource_base.ResourceBase):
media_type = vendor_media_type.APPLICATION_L2SERVICE_JSON
def __init__(self, uri, dto, auth):
super(L2Service, self).__init__(uri, dto, auth)
def get_id(self):
... | {
"content_hash": "95421afc398ee1feeb25367b62432617",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 61,
"avg_line_length": 22.958333333333332,
"alnum_prop": 0.6206896551724138,
"repo_name": "celebdor/python-midonetclient",
"id": "8e74dab7ce7ac3f3eb13347e3aabd24ffb0d663f",
... |
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.exceptions import APIException
class DefaultException(APIException):
pass
class PaymentFailed(DefaultException):
status_code = status.HTTP_402_PAY... | {
"content_hash": "e72dc0381c553fc8011b65ace3734e49",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 70,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.76775956284153,
"repo_name": "ovidner/bitket",
"id": "0235d99babd9925c008e8d19009a4e5e9ea0f6c7",
"size": "1464",
... |
class Image(object):
"""
"""
def __init__(self, param=None, hdr=None, orientation=None, absolutepath="", verbose=1):
from numpy import zeros, ndarray, generic
from sct_utils import extract_fname
from nibabel import AnalyzeHeader
# initialization of all parameters
se... | {
"content_hash": "9b8dd53f7fdcf906a22663a11d1f4d31",
"timestamp": "",
"source": "github",
"line_count": 562,
"max_line_length": 204,
"avg_line_length": 43.86476868327402,
"alnum_prop": 0.5487587214019146,
"repo_name": "3324fr/spinalcordtoolbox",
"id": "a3471605f7cea992a8a0b4e68d189794c6013d26",
"si... |
"""
Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
"""
__author__ = 'Danyang'
# Definition for an interval.
class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = ... | {
"content_hash": "1dcff6fb2365de9036053076b5a7b9bb",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 109,
"avg_line_length": 29.47887323943662,
"alnum_prop": 0.4773053033922599,
"repo_name": "algorhythms/LeetCode",
"id": "554aefbaceec5d3d1a8211945a01d8010f29ea30",
"size": ... |
"""
Implementation of a TableEditor demo plugin for Traits UI demo program
This demo shows the full behavior of a straightforward TableEditor. Only
one style of TableEditor is implemented, so that is the one shown.
"""
# Import statements:
from traits.api \
import HasTraits, HasStrictTraits, Str, Int, Regex, Lis... | {
"content_hash": "f16fd246d6b412baecb7de5526d516c0",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 73,
"avg_line_length": 27.897196261682243,
"alnum_prop": 0.6050251256281407,
"repo_name": "marshallmcdonnell/interactive_plotting",
"id": "85f53499ef76377c0e6c3ee665b9a9cfff... |
import sys
def main(filepath):
with open(filepath, 'r') as f:
for line in f.readlines():
if line:
line = line.strip()
print number_in_words(int(line)) + 'Dollars'
def number_in_words(number):
# set the word lists
numbers = ['Zero', '... | {
"content_hash": "9588940a971ad6d3c58bea8af98c6c7b",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 64,
"avg_line_length": 26.4375,
"alnum_prop": 0.5153664302600472,
"repo_name": "tdsymonds/codeeval",
"id": "f767656d99cf6f6944719407443635ce02aa9a99",
"size": "1692",
"bi... |
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['exotica_examples_py'],
package_dir={'': 'src'})
setup(**setup_args)
| {
"content_hash": "b74ed29d68f408ac8b739df0e655af59",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 60,
"avg_line_length": 28.22222222222222,
"alnum_prop": 0.7401574803149606,
"repo_name": "openhumanoids/exotica",
"id": "713b24095f409f567798672f03459b318e3c1236",
"size": "... |
from __future__ import absolute_import
from ._example import file_example
__all__ = ["file_example"]
| {
"content_hash": "775cc54c50b789018e7ec5a88fb8abe1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 38,
"avg_line_length": 20.6,
"alnum_prop": 0.6990291262135923,
"repo_name": "Horta/limix",
"id": "654925a0afabfb8839d89fabe829372cef29d0ea",
"size": "103",
"binary": false... |
'''
sota.parser
'''
from .parser import SotaParser
| {
"content_hash": "be416e83b754318d0d7e4c8dffb209b0",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 30,
"avg_line_length": 10.4,
"alnum_prop": 0.6923076923076923,
"repo_name": "sota/lang",
"id": "aefdd6daa205cb6495ef9621ce2f80779ff3390a",
"size": "101",
"binary": false,
... |
inversion_inicial = float(raw_input("Inversion inicial: "))
tasa = int(raw_input("% tasa de descuento: "))
#definimos algunas variables
van = -inversion_inicial #La inversion inicial es negativa
mes = 1
#Preguntamos por cada mes, hasta que VAN quede positivo.
while (van < 0):
flujo_mes = int(raw_input("Flujo mes "+st... | {
"content_hash": "6fd3fc05aff33b4c6fef4881773dd95b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 69,
"avg_line_length": 37.833333333333336,
"alnum_prop": 0.6938325991189427,
"repo_name": "csaldias/python-usm",
"id": "c5177b9f46852af4a90a7c5e732ce5ef1c7f22e3",
"size": "... |
from __future__ import print_function
import sys
from term2048.game import Game
# set this to true when unit testing
debug = False
__has_argparse = True
try:
import argparse
except ImportError:
__has_argparse = False
def __print_argparse_warning():
"""print a warning for Python 2.6 users who don't have... | {
"content_hash": "620cedd44f4931af2a5d9fb43d35353c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 77,
"avg_line_length": 28.303030303030305,
"alnum_prop": 0.6215203426124197,
"repo_name": "davidnk/term2048solver",
"id": "22f074c974d91088ae1ccbd2f87e51a74143007f",
"size"... |
import socket
from django.core.management import call_command
from django.template.loader import render_to_string
from dimagi.utils import gitinfo
from django.core.management.base import BaseCommand
from corehq.apps.hqadmin.models import HqDeploy
from datetime import datetime
from optparse import make_option
from djang... | {
"content_hash": "cbb98557633066c50703d24677897120",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 140,
"avg_line_length": 44.38775510204081,
"alnum_prop": 0.6501149425287356,
"repo_name": "puttarajubr/commcare-hq",
"id": "9f055758f7bfa332ab59447d21ad8366abf04f0b",
"size... |
"""Domain objects relating to stories."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from __future__ import unicode_literals # pylint: disable=import-only-modules
import copy
import json
import re
from constants import constants
from core.domain import android_validation_constants... | {
"content_hash": "695f19bdcfc3d412d910aa013670da36",
"timestamp": "",
"source": "github",
"line_count": 1625,
"max_line_length": 80,
"avg_line_length": 39.76,
"alnum_prop": 0.5954186658412011,
"repo_name": "prasanna08/oppia",
"id": "06511bb1cfc2ed4177cec13a32de62b58bb8b090",
"size": "65215",
"bin... |
"""
jsonapi.base.handler.base
=========================
"""
# local
from ..response import Response
from ..errors import MethodNotAllowed
class BaseHandler(object):
"""
The base class for a request handler.
:arg jsonapi.base.api.API api:
:arg jsonapi.base.database.Session db:
:arg jsonapi.base.r... | {
"content_hash": "c8e970cb8c825ccf8e8265c7d03ba0d1",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 46,
"avg_line_length": 21.569620253164558,
"alnum_prop": 0.5140845070422535,
"repo_name": "benediktschmitt/py-jsonapi",
"id": "8f41a7b5b7b4fb08f2e902bc0a1799449f32dd53",
"s... |
from torndb import Connection
from config import configs
_CONNS_ = {}
def get_conn(db_id):
if db_id in _CONNS_:
return _CONNS_[db_id]
_CONNS_[db_id] = db = Connection(**configs['db'][db_id])
db._db_args.pop('init_command', None)
db.execute("SET TIME_ZONE = 'SYSTEM'")
return db
| {
"content_hash": "bf2c184fa1eff6d647f3a57b6c46300b",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 60,
"avg_line_length": 22.142857142857142,
"alnum_prop": 0.6129032258064516,
"repo_name": "Geew/issue-task",
"id": "46e695587e6ecc9204b81b0cc60bf824b49f06a6",
"size": "327"... |
from django.conf.global_settings import * # noqa
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "mem_db",
}
}
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.messages",
"django.co... | {
"content_hash": "e138a3b86e30a164e8558d079f0456d4",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 70,
"avg_line_length": 25.37735849056604,
"alnum_prop": 0.6475836431226766,
"repo_name": "tuttle/python-useful",
"id": "40453ee464ef103580ab66342f3987fed70f5f54",
"size": "... |
from tornado.options import define
from handler.HealthCheck import HealthCheckHandler
from handler.Img import ImgHandler
from handler.Pdf import PdfHandler
from handler.Resize import ResizeHandler
from handler.Watermark import WatermarkHandler
define("port", default=33005, help="Application port")
define("max_buffer_s... | {
"content_hash": "b53cc65917eec186854fde1da7796830",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 105,
"avg_line_length": 36.91304347826087,
"alnum_prop": 0.7432273262661955,
"repo_name": "jiss-software/jiss-rendering-service",
"id": "c0099cd0a021a5ef31281ed65c44be18dc4dd... |
from django.core.exceptions import ObjectDoesNotExist
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
webapi_response_errors,
webapi_request_fields)
from djblets.webapi.err... | {
"content_hash": "920850af6b7eebe44fd0976b03b03cb5",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 39.30718954248366,
"alnum_prop": 0.6371799135350849,
"repo_name": "reviewboard/reviewboard",
"id": "e78b2b85d7f633e9f7bfcd2383c4656e3eb3e683",
"size... |
from . import MemoryMixin
class UnwrapperMixin(MemoryMixin):
"""
This mixin processes SimActionObjects by passing on their .ast field.
"""
def store(self, addr, data, size=None, condition=None, **kwargs):
return super().store(_raw_ast(addr), _raw_ast(data),
size=_raw_ast(size),
... | {
"content_hash": "20ae8dc6b68369b0b9972a5d038e338b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 113,
"avg_line_length": 38.857142857142854,
"alnum_prop": 0.6056985294117647,
"repo_name": "angr/angr",
"id": "60733582ced698b6a17f52e8417f92b9fc524fe3",
"size": "1088",
... |
import ssl
from pg8000.dbapi import connect
def test_md5_ssl(db_kwargs):
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
db_kwargs["ssl_context"] = context
with connect(**db_kwargs):
pass
| {
"content_hash": "06313725905591fb50e3e720cadd3761",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 42,
"avg_line_length": 23.083333333333332,
"alnum_prop": 0.6823104693140795,
"repo_name": "tlocke/pg8000",
"id": "6f065a7abce77b7118f02efe21d2fb226b2c7688",
"size": "277",
... |
from synapse.api.errors import SynapseError
from synapse.types import StreamToken
import logging
logger = logging.getLogger(__name__)
class SourcePaginationConfig(object):
"""A configuration object which stores pagination parameters for a
specific event source."""
def __init__(self, from_key=None, to... | {
"content_hash": "251bcb74442a1854cb1c2854a1a7bb50",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 78,
"avg_line_length": 32.613861386138616,
"alnum_prop": 0.5622343655130541,
"repo_name": "iot-factory/synapse",
"id": "167bfe0de3bfaf78dad93b104fac4df4163bb15b",
"size": ... |
import numpy as np
from baseline_constants import BYTES_WRITTEN_KEY, BYTES_READ_KEY, LOCAL_COMPUTATIONS_KEY
class Server:
def __init__(self, client_model):
self.client_model = client_model
self.model = client_model.get_params()
self.selected_clients = []
self.updates = []
... | {
"content_hash": "e1f7e61400a68a1e855bd5cc59147d15",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 94,
"avg_line_length": 37.48031496062992,
"alnum_prop": 0.6023109243697479,
"repo_name": "TalwalkarLab/leaf",
"id": "6d01f357e64f106228c2b69284a4a04b438754ba",
"size": "47... |
"""
Local Normalization Operation.
Easy-to-understand (but slow) naive numpy implementation.
"""
# Authors: Nicolas Pinto <[email protected]>
#
# License: Proprietary
__all__ = ['LNormScipyNaive']
# -- Imports
import numpy as np
from pythor3.operation.common.lsum import lsum
from pythor3.operation.lnorm_.plug... | {
"content_hash": "e374057ca9971609a09f74614d24c350",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 79,
"avg_line_length": 35.836283185840706,
"alnum_prop": 0.4554883318928263,
"repo_name": "npinto/sthor",
"id": "b5856bf3bfd26ac456d1d2bf3b2e877a8c86a4b3",
"size": "8099",... |
import os
from tori.cli.command import Command
from jinja2 import Template
class FlaskCreateSkeletonApp(Command):
""" Create a skeleton app """
def define_arguments(self, argument_parser):
argument_parser.add_argument('name', help='The name of the app and the app module (e.g. piano_and_violin)')
... | {
"content_hash": "0f1292148a361194f6a277f08bba05f7",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 132,
"avg_line_length": 33.208955223880594,
"alnum_prop": 0.5937078651685394,
"repo_name": "shiroyuki/nest",
"id": "12c58135c85d3e2ca2fef35d11a0c9423b759837",
"size": "2225... |
from tornado.websocket import WebSocketHandler
import json
import os
class DebugHandler(WebSocketHandler):
def check_origin(self, origin):
return True
def open(self, backtest_id):
self.uuid = backtest_id
print(backtest_id)
print("[DebugHandler] WebSocket opened")
def on_m... | {
"content_hash": "e512e09d52764267e65cfbfc607974c3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 57,
"avg_line_length": 24.142857142857142,
"alnum_prop": 0.6627218934911243,
"repo_name": "mequanta/z-dyno",
"id": "2f577a03ddf89c9f27c9f3dfa93f176cf6cea9f2",
"size": "507"... |
from cassandra.metadata import Metadata
from cassandra.cluster import Cluster
from multicorn import TableDefinition, ColumnDefinition
from cassandra.auth import PlainTextAuthProvider
import types_mapper
import logger
from logger import WARNING, ERROR
from properties import ISDEBUG
def import_schema(schema, srv_options... | {
"content_hash": "55b4431aaee593d192bb106a81e73191",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 163,
"avg_line_length": 43.08988764044944,
"alnum_prop": 0.6153846153846154,
"repo_name": "rankactive/cassandra-fdw",
"id": "e8fc0653529cfe9c2a0f918a4aef3cfa9f772759",
"siz... |
'''
FCorr: tests module.
Meant for use with py.test.
Organize tests into files, each named xxx_test.py
Read more here: http://pytest.org/
Copyright 2014, Dmytro Fishman
Licensed under MIT
''' | {
"content_hash": "477962610efb6ab701fcb2261979ec28",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 49,
"avg_line_length": 19.3,
"alnum_prop": 0.7461139896373057,
"repo_name": "skyfallen/FCorr",
"id": "a033ffded69a1b4caa101c10ebcaf9fe07ed5c9b",
"size": "193",
"binary": ... |
from torch.autograd import Variable
from utils import MAX_LENGTH
import torch.nn as nn
class AttnDecoderRNN(nn.Module):
def __init__(self, hidden_size, output_size, n_layers, dropout_p=0.1, max_length=MAX_LENGTH):
super(AttnDecoderRNN, self).__init__()
self.hidden_size = hidden_size
self.o... | {
"content_hash": "b4ccd06b82852a7f0400491ad084de53",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 97,
"avg_line_length": 42.458333333333336,
"alnum_prop": 0.662414131501472,
"repo_name": "dikshant2210/Neural-Machine-Translation",
"id": "1091a81296244a44044b9582531c19019e6... |
import pytest
from scout.exceptions import IntegrityError
#########################################################
################### Hpo tests #######################
#########################################################
def test_add_hpo_term(adapter):
## GIVEN a empty adapter
assert len([term for te... | {
"content_hash": "57b347bef4c1fbe1862bd7f3a49ad40d",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 66,
"avg_line_length": 29.027322404371585,
"alnum_prop": 0.5858433734939759,
"repo_name": "Clinical-Genomics/scout",
"id": "a2cc572e2371033a8ced6e1f667c6ed09fe9a1cb",
"siz... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('person', '0003_auto_20150223_2310'),
]
operations = [
migrations.CreateModel(
name='Branch',
fields=[
('id',... | {
"content_hash": "4a3a2f7111e6b0a2b538868f16b36696",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 114,
"avg_line_length": 32.38461538461539,
"alnum_prop": 0.505938242280285,
"repo_name": "Timurdov/Python",
"id": "a00a73b6d48a4451e5c1de0e2dea3533a78d5a4c",
"size": "2129"... |
import unittest
import uuid
from collections import namedtuple
from mock import Mock, patch
from spoppy import menus, responses
from . import utils
MockLoader = namedtuple('Loader', ('results', ))
class TestOptions(unittest.TestCase):
def setUp(self):
self.dct = {
'1': menus.MenuValue('A', ... | {
"content_hash": "9adb57d73497e168453319697a3bb2ac",
"timestamp": "",
"source": "github",
"line_count": 894,
"max_line_length": 78,
"avg_line_length": 36.355704697986575,
"alnum_prop": 0.612362316165159,
"repo_name": "sindrig/spoppy",
"id": "c67608ec59dab60cfbd550c5c3de7d31e5bd5cf5",
"size": "32502... |
from lxml import etree
import webob
from nova.api.openstack.compute.contrib import quota_classes
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import test
from nova.tests.unit.api.openstack import fakes
def quota_set(class_name):
return {'quota_class_set': {'id': class_n... | {
"content_hash": "f5c5ab8dca625f1a81b676cbbcdf5f63",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 78,
"avg_line_length": 41.68599033816425,
"alnum_prop": 0.5158187507243017,
"repo_name": "luzheqi1987/nova-annotation",
"id": "228b44f369ce02f49d3dcfbd94d7de0528a9e766",
"... |
from collections import defaultdict
# 3rd party
from boto.s3.connection import S3Connection
import simplejson as json
# project
from checks import AgentCheck
from config import _is_affirmative
def multidict(ordered_pairs):
"""Convert duplicate keys values to lists."""
# read all values into lists
d = de... | {
"content_hash": "fcf8fadaf0fc13becf9ea260426c909c",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 93,
"avg_line_length": 32.94444444444444,
"alnum_prop": 0.5865654862282181,
"repo_name": "pmav99/praktoras",
"id": "b47087dbef36356428b9cab520c227ca011d3084",
"size": "375... |
from dateutil.parser import parse as dateutil_parse
import json
import logging
import re
from django.conf import settings
from libya_elections.constants import INCOMING
from .models import VumiLog
logger = logging.getLogger(__name__)
LOG_PATTERN = {
'smpp_inbound': re.compile(
r'(?P<date>[\d\-\+\:\sT]+... | {
"content_hash": "cfe7dcfbb1d4e6f1df718519d91e450b",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 97,
"avg_line_length": 38.62068965517241,
"alnum_prop": 0.5678571428571428,
"repo_name": "SmartElect/SmartElect",
"id": "ff9720c9c0eb143ae60f5731ddcf45ed01efdebc",
"size":... |
from org.transcrypt.stubs.browser import __pragma__
import re
from basictests import *
def run (test):
""" basic tests of the re engine. The point is to
exercise most of the methods to make sure they behave as
expected. These tests are expected to provide exhaustive
coverage of the regex engi... | {
"content_hash": "be55bbe0773a9311e9c34a5c266eb419",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 85,
"avg_line_length": 27.484848484848484,
"alnum_prop": 0.6945975744211687,
"repo_name": "QQuick/Transcrypt",
"id": "05d433a2c3bd73cb00b30f8f61d82e1fe9afedaa",
"size": "10... |
import pytest
import numpy as np
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.utils._testing import assert_array_equal
from imblearn.ensemble import RUSBoostClassifier
@pytest.fixture
def imbalanced_dataset():
return make_classification(
... | {
"content_hash": "38261c373b82f7afbbef12b4391a6def",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 84,
"avg_line_length": 33.61682242990654,
"alnum_prop": 0.6750069502363081,
"repo_name": "scikit-learn-contrib/imbalanced-learn",
"id": "e1394a2b58b3895a01ef601020aa380953df... |
import os
import sys
import vcr
DIR = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(DIR, "../../limbo/plugins"))
from cat import on_message
def test_cat():
with vcr.use_cassette("test/fixtures/cat.yaml"):
ret = on_message({"text": u"!cat"}, None)
assert "https://cd... | {
"content_hash": "7db3b169c96e68e7776112b147a966b3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 72,
"avg_line_length": 24.466666666666665,
"alnum_prop": 0.662125340599455,
"repo_name": "llimllib/limbo",
"id": "6486e59d1ed84b35f5c4740aa430a5c1f9965608",
"size": "391",
... |
from . import read_table_bigquery
def test_read_table(capsys):
read_table_bigquery.read_table()
out, _ = capsys.readouterr()
assert "country_name" in out
| {
"content_hash": "af0cde55dec912f76142690865ee0218",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 36,
"avg_line_length": 24,
"alnum_prop": 0.6904761904761905,
"repo_name": "googleapis/python-bigquery-storage",
"id": "c8301857108fb6ae4f86b983d623583b25a7f700",
"size": "74... |
import shutil
import tempfile
import os
def _generate_class_single(a, b):
class C(a, b):
pass
return C
def generate_class_from_many(*args):
current = args[0]
args = args[1:]
for argument in args:
current = _generate_class_single(current, argument)
return current
class Temp... | {
"content_hash": "513b2746e2817065e114aec6cbc95b63",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 82,
"avg_line_length": 28.262295081967213,
"alnum_prop": 0.5904872389791184,
"repo_name": "jonatanSh/challenge-framework",
"id": "72215116768283f0aa0d0f3aab3f24047f051257",
... |
import renpy.display
from renpy.display.render import render
class Transition(renpy.display.core.Displayable):
"""
This is the base class of most transitions. It takes care of event
dispatching.
"""
def __init__(self, delay, **properties):
super(Transition, self).__init__(**properties)
... | {
"content_hash": "30b720e39d197596e75eaeac8674fe45",
"timestamp": "",
"source": "github",
"line_count": 1015,
"max_line_length": 151,
"avg_line_length": 31.219704433497537,
"alnum_prop": 0.5680068164604898,
"repo_name": "kfcpaladin/sze-the-game",
"id": "31ae488ae349023afde11fac05e992bd265def69",
"s... |
from bottle import *
import auth
import csv
import psycopg2, psycopg2.extensions, psycopg2.extras
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) # se znebimo problemov s sumniki
######################################################################
# priklopimo se na bazo
conn = psycopg2.connect(d... | {
"content_hash": "7fcf34307ca0839627d30ad79b611b40",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 164,
"avg_line_length": 24.654545454545456,
"alnum_prop": 0.6076696165191741,
"repo_name": "JanezRadescek/HearthStone",
"id": "689b548b524b5a37d480a3b5a402a9c161597973",
"s... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mapdata', '0012_rename_section_to_level'),
]
operations = [
migrations.AlterField(
model_name='locationslug',
name='slug',
... | {
"content_hash": "dc5739d311f59a35e2894ffdf9280617",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 80,
"avg_line_length": 23.166666666666668,
"alnum_prop": 0.6067146282973621,
"repo_name": "c3nav/c3nav",
"id": "ec37dd17b825786e4472fbc500f91d52c1f12160",
"size": "490",
... |
import zmq
import random
import time
import zmq_ports as ports
import zmq_topics as topic
from websocket import create_connection
RCV_DELAY=0.01
WSPORT = 9000
########### WEBSOCKET EVENTS
########### WEBSOCKET EVENTS
if __name__ == '__main__':
#print("Starting comm")
# IPC
context = zmq.Context()
# ... | {
"content_hash": "bd2a58deaebd9757796c031396ee911c",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 86,
"avg_line_length": 30.053763440860216,
"alnum_prop": 0.5738819320214669,
"repo_name": "jeryfast/piflyer",
"id": "8ea49c780943ff1b79ca51773c0ebb81e220b130",
"size": "279... |
import time,threading,subprocess
from Naked.toolshed.shell import execute_rb, muterun_rb
def foShizzleMyNizzlePollingTask():
print(time.ctime())
success = execute_rb('foshizzlemynizzle.rb')
threading.Timer(60,foShizzleMyNizzlePollingTask).start()
foShizzleMyNizzlePollingTask()
| {
"content_hash": "99c43d6fb9e34a71653a472dba7ff12e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 60,
"avg_line_length": 24.916666666666668,
"alnum_prop": 0.7759197324414716,
"repo_name": "jusleg/storyflow",
"id": "4cad2037c58b16da963d44793d02fd554bbd7166",
"size": "299... |
try:
from functools import lru_cache
except ImportError:
from functools32 import lru_cache
import base64
import cgi
import datetime
import httplib2
import jinja2
import json
import messageindex
import os
import re
import time
import urllib
import webapp2
from google.appengine.api import app_identity
from goog... | {
"content_hash": "7be9b954c9650a6e581d45c42119e780",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 87,
"avg_line_length": 35.50737463126843,
"alnum_prop": 0.6361219572983301,
"repo_name": "colohan/dschat",
"id": "9f8f5bfb7311c2a5d59c0ea7b240813b1e05036d",
"size": "12037... |
import argparse
import csv
import io
import operator
import os
import sys
from oslo_log import log as logging
import yaml
from ZanataUtils import IniConfig
from ZanataUtils import ZanataRestService
LOG = logging.getLogger(__name__)
class ZanataAccounts(object):
"""Object that retrieves Zanata account informatio... | {
"content_hash": "ed0da033bdc754fbe95dd46e64d3da6f",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 79,
"avg_line_length": 34.17460317460318,
"alnum_prop": 0.5706765753212572,
"repo_name": "openstack/i18n",
"id": "9c726312d9cefcf0212be1d71143e5361f549bdf",
"size": "7028"... |
"""Main script to run an experiment.
Usage example (run from this directory):
python run_experiment.py --config=configs/cifar10_wrn.py
"""
import functools
from absl import app
from absl import flags
from jax_privacy.src.training.image_classification import experiment
from jaxline import platform
if __name__ == ... | {
"content_hash": "be65329e7b3dd453fe77947744239466",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 68,
"avg_line_length": 25.823529411764707,
"alnum_prop": 0.7608200455580866,
"repo_name": "deepmind/jax_privacy",
"id": "7b96889b5de898d72f5e26d4d77dd037f421a0b1",
"size": ... |
import json
import pymongo
from flask import request, abort, json, Flask, render_template
from flask.ext import restful
from flask.ext.restful import reqparse
from flask_rest_service import app, api, mongo
from bson.objectid import ObjectId
from bson.code import Code
# ----- / returns status OK and the MongoDB instanc... | {
"content_hash": "b427edfadad8af506b8727c3d3a81239",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 80,
"avg_line_length": 26.19047619047619,
"alnum_prop": 0.6618181818181819,
"repo_name": "openfoodfacts/OpenFoodFacts-APIRestPython",
"id": "05e3562ffa4fa6927a1f76539d7f31af9... |
import logging
import optparse
import os
import sys
import tempfile
import zipfile
from util import build_utils
def _CreateCombinedMainDexList(main_dex_list_paths):
main_dex_list = []
for m in main_dex_list_paths:
with open(m) as main_dex_list_file:
main_dex_list.extend(l for l in main_dex_list_file if... | {
"content_hash": "187a0667be587cf12a81c91141b7373a",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 80,
"avg_line_length": 36.135416666666664,
"alnum_prop": 0.6532141827616028,
"repo_name": "Teamxrtc/webrtc-streaming-node",
"id": "59425d705955f8116f23fbceea332f933191cb6e",... |
from setuptools import setup, find_packages
setup(
name='pinax',
version='0.7.0',
description='Ariels fork of Pinax, a platform for rapidly developing websites.',
author='Ariel Nunez',
author_email='[email protected]',
url='http://github.com/ingenieroariel/pinax/tree/master',
package... | {
"content_hash": "16687afdd622ad0afdc176ec19a66bd1",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 84,
"avg_line_length": 36.55555555555556,
"alnum_prop": 0.662613981762918,
"repo_name": "ingenieroariel/pinax",
"id": "bbcf196ad9857424d738fffe00f1b7889237475e",
"size": "9... |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`json` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is derived from a
version of the externally m... | {
"content_hash": "3c497353d82275fcb0db1f840639a945",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 81,
"avg_line_length": 40.05120481927711,
"alnum_prop": 0.6406708280063173,
"repo_name": "batermj/algorithm-challenger",
"id": "ca2c611bd0e48ce4146117345687eca513eeac97",
... |
from wtforms.validators import StopValidation, ValidationError
from flask_bombril.r import R
from extensions import db
class TestUser(db.Model):
email = db.Column(db.String(), primary_key=True, unique=True)
class AlwaysError(object):
def __init__(self):
pass
def __call__(self, form, field):
... | {
"content_hash": "3d26ae252c8f7f19d65f9d177d488d85",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 65,
"avg_line_length": 25.714285714285715,
"alnum_prop": 0.6625,
"repo_name": "marcoprado17/flask-bone",
"id": "fa555bc4159b1f569f4962ce5683474ab847d195",
"size": "1221",
... |
"""
Django settings for App_BackEnd project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impor... | {
"content_hash": "4e96ca70f0b3aef41a8dac348ea590ad",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 91,
"avg_line_length": 25.711409395973153,
"alnum_prop": 0.679196032367528,
"repo_name": "jiafengwu0301/App_BackEnd",
"id": "53c1b4573a233ff34fef95b3bfd4b1fe0a116d11",
"si... |
from __future__ import (
absolute_import, print_function, division, unicode_literals
)
import logging
import re
import sys
from datetime import datetime
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
CURRENT_YEAR = datetime.today().year
LICENSE_BLOB = """Copyright (c) %d The Jaege... | {
"content_hash": "39d7916c8daa7be4e4e25cf99531c043",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 76,
"avg_line_length": 27.615384615384617,
"alnum_prop": 0.5984878631118186,
"repo_name": "NeoCN/jaeger",
"id": "0fd5f8b4603704df7984bd3db1ab5969548ab890",
"size": "2513",
... |
"""UDP hole punching server."""
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import sys
rendezvous_port = 7654
class ServerProtocol(DatagramProtocol):
def __init__(self):
"""Initialize with empty address list."""
self.addresses = []
def addressS... | {
"content_hash": "67ce95d63c4640851f62c353e28cc05f",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 71,
"avg_line_length": 31.574468085106382,
"alnum_prop": 0.601078167115903,
"repo_name": "intangere/NewHope_X25519_XSalsa20_Poly1305",
"id": "bcf85a047d788fd830b49db55cf86e4c... |
import os
import subprocess
import sys
if len(sys.argv) != 5:
print("dump_app_syms.py <dump_syms_exe> <strip_binary>")
print(" <binary_with_symbols> <symbols_output>")
sys.exit(1)
dumpsyms = sys.argv[1]
strip_binary = sys.argv[2]
infile = sys.argv[3]
outfile = sys.argv[4]
# Dump only when the o... | {
"content_hash": "fcc48b0b6a696be19def31149df795d4",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 70,
"avg_line_length": 28.181818181818183,
"alnum_prop": 0.6709677419354839,
"repo_name": "flutter/buildroot",
"id": "f5c2c54a0dda440ddda5815f6f498ecee82040b3",
"size": "87... |
from __future__ import unicode_literals
from django.core.cache import cache
from django.db import models
from django.contrib.contenttypes.models import ContentType
from guardian.compat import get_user_model
from guardian.core import ObjectPermissionChecker
from guardian.exceptions import ObjectNotPersisted
from guard... | {
"content_hash": "0ac9ea261d453a52cfd34305dd48d9d1",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 202,
"avg_line_length": 36.43283582089552,
"alnum_prop": 0.5925167281168919,
"repo_name": "mobstac/django-guardian",
"id": "1e2eb87df2f747dd0002f28da0fb57aefe3a4313",
"siz... |
import os
import librosa
import numpy
from multiprocessing import Pool
sample_rate = 44100
def scale(arr):
# get the average
avg = numpy.average(arr)
# scale from 20,20000 to 0,1
return (avg - 20) / (20000 - 20)
def analyse(file):
print(file)
y, sr = librosa.load(file, sr=sample_rate, d... | {
"content_hash": "86532aab355054473599c92d409ff88e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 32.745098039215684,
"alnum_prop": 0.6664670658682634,
"repo_name": "googlecreativelab/aiexperiments-drum-machine",
"id": "7437cdb5256fbf2b2bbf10993ede4... |
"""Audio source and audio processing compoenents
The two main base classes are :class:`AudioSource` which provides audio and
:class:`AudioProcessor` which act as a pipeline processor on another
:class:`AudioSource`.
"""
import asyncio
import audioop
import collections
import time
import wave
import janus
try:
i... | {
"content_hash": "3a30f815fd112acc549ee5ca911ab918",
"timestamp": "",
"source": "github",
"line_count": 602,
"max_line_length": 79,
"avg_line_length": 31.995016611295682,
"alnum_prop": 0.5940501531592337,
"repo_name": "ibm-dev/streamtotext",
"id": "8f1cb55769810d5033061708300dc5d783edab91",
"size":... |
"""One-line documentation for resource_registration module.
A detailed description of resource_registration.
"""
from googlecloudsdk.core import resources
def RegisterReleasedAPIs():
"""Register all official versions of released Cloud APIs.
"""
# pylint:disable=g-import-not-at-top
from googlecloudapis.bigq... | {
"content_hash": "4c1bad65bf0a3335b44f7ff4771f563d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 44.93333333333333,
"alnum_prop": 0.820969337289812,
"repo_name": "Plantain/sms-mailinglist",
"id": "e1c3bb3127943273563d9b0e20b38ad1e4029b64",
"size"... |
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... | {
"content_hash": "66fa3f504ce1657798d2bdac6274d3a7",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 155,
"avg_line_length": 31.51412429378531,
"alnum_prop": 0.5928648261025458,
"repo_name": "thaim/ansible",
"id": "8d7f48f2f80a2b66dd5793963382897a41a38822",
"size": "11174... |
from nose.tools import (
assert_equals,
assert_not_equals,
assert_true
)
from random import randint
import os
from rsk_mind.classifier import XGBoostClassifier
from rsk_mind.dataset import (
Splitter,
Dataset
)
class TestXGBoostClassifier(object):
@classmethod
def setup_class(cls):
... | {
"content_hash": "491c84430d78aee94decfa0d8acb443e",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 92,
"avg_line_length": 33.89320388349515,
"alnum_prop": 0.6582641077055285,
"repo_name": "rsk-mind/rsk-mind-framework",
"id": "9252077d88cfe548a48c6f1e67e470cac72245ae",
"... |
"""Generic presubmit checks that can be reused by other presubmit checks."""
import os as _os
_HERE = _os.path.dirname(_os.path.abspath(__file__))
# Justifications for each filter:
#
# - build/include : Too many; fix in the future.
# - build/include_order : Not happening; #ifdefed includes.
# - build/namespace ... | {
"content_hash": "39042c187efdee2a72eaede3970a86f1",
"timestamp": "",
"source": "github",
"line_count": 1132,
"max_line_length": 80,
"avg_line_length": 36.62720848056537,
"alnum_prop": 0.6637161738459312,
"repo_name": "junhuac/MQUIC",
"id": "96bd094c226a8ea0156a0e3b4a240105050e07f9",
"size": "41629... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.