text stringlengths 4 1.02M | meta dict |
|---|---|
"""Reorganize Pokemon, PokemonForm, etc. to Species, Pokemon, etc.
This is an unmaintained one-shot script, only included in the repo for
reference.
"""
import csv
import os
from pokedex import defaults
number_of_species = 649
high_id_start = 10000
csv_dir = defaults.get_default_csv_dir()
def to_dict(filename):
... | {
"content_hash": "70438795c02e48ffd69201c7bce4d97c",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 89,
"avg_line_length": 34.95092024539877,
"alnum_prop": 0.6262945409864841,
"repo_name": "RK905/pokedex-1",
"id": "fd1ba03f271273454b177b52c9122cdc6b408f16",
"size": "5715... |
""" Utilities for view configuration """
import fnmatch
import re
import functools
import inspect
import six
from pyramid.httpexceptions import HTTPFound
from .params import is_request
def match(pattern, path, flags):
"""
Check if a pattern matches a path
Parameters
----------
pattern : str
... | {
"content_hash": "fdf785437f5cfaafb348276828d39c45",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 87,
"avg_line_length": 28.25130890052356,
"alnum_prop": 0.532060785767235,
"repo_name": "stevearc/pyramid_duh",
"id": "d8c2141a3a0c9b92fa8aa3c36bc06c877ad20159",
"size": "... |
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from encrypted_fields import EncryptedCharField
from django.core.exceptions import ValidationError
from taggit.managers import TaggableManager
from django.conf import settings
from django.db.models.signals import ... | {
"content_hash": "af908248cce839d2ba2777f3ed24b137",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 78,
"avg_line_length": 35.64750957854406,
"alnum_prop": 0.6137145313843508,
"repo_name": "sqlviz/sqlviz",
"id": "9926ee341e2f3ebefe7da09df192adc8691b7f18",
"size": "9304",... |
"""Factories for compliance app"""
from factory import Faker, SubFactory, Trait
from factory.django import DjangoModelFactory
from factory.fuzzy import FuzzyChoice
from compliance.constants import RESULT_DENIED, RESULT_SUCCESS, RESULT_CHOICES
from compliance.models import ExportsInquiryLog
class ExportsInquiryLogFac... | {
"content_hash": "05f91d4db81609076d07bbf84286923c",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 78,
"avg_line_length": 31.88888888888889,
"alnum_prop": 0.7386759581881533,
"repo_name": "mitodl/bootcamp-ecommerce",
"id": "42d6dc22555cdb553ac7cfe36b54d2420da1ce97",
"siz... |
import matplotlib.pyplot as plt
import pandas as pd
normal = pd.read_csv('normal.csv', header=None)
normal.hist()
plt.savefig('normal_hist.pdf')
q = normal.quantile([0, 0.25, 0.5, 0.75, 1])
q.columns = ['quantiles']
q.to_latex('quantiles.tex')
| {
"content_hash": "8c782ebeac2524b89b7ffe28a65790f1",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 47,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.6935483870967742,
"repo_name": "clarkfitzg/templates",
"id": "aba06b43d2a278e449ea98e6d4b204a98b48ccdf",
"size": ... |
"""
Description here
"""
import logging as log
import argparse
import itertools
import madsenlab.axelrod.utils as utils
import madsenlab.axelrod.data as data
import csv
import random
import ming
from bson import ObjectId
def setup():
global args, simconfig
parser = argparse.ArgumentParser()
parser.a... | {
"content_hash": "9da31fe3455748dafa1fca676345b264",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 117,
"avg_line_length": 43.085427135678394,
"alnum_prop": 0.5779099603452298,
"repo_name": "mmadsen/axelrod-ct",
"id": "4625bb7f76e87801a081542b51a4bee1567f6863",
"size": ... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/tusken_raider/shared_lair_tusken_raider_npc.iff"
result.attribute_template_id = 9
result.stfName("lair_n","tusken_raider")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "ff5518e6c6897f6bc38ea8351cf36f6a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 89,
"avg_line_length": 24.53846153846154,
"alnum_prop": 0.7021943573667712,
"repo_name": "obi-two/Rebelion",
"id": "bb2fb5f08f037646ea89a98a5be62f0ab65ae459",
"size": "464"... |
"""
MoinMoin - AttachList Macro
A macro to produce a list of attached files
Usage: <<AttachList([pagename,mime_type])>>
If pagename isn't set, the current pagename is used.
If mime_type isn't given, all files are listed.
@copyright: 2004 Jacob Cohen, Nigel Metheringham,
... | {
"content_hash": "c360abc16ff1114bdaaccd82d3f2cf7f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 97,
"avg_line_length": 31.185185185185187,
"alnum_prop": 0.671021377672209,
"repo_name": "Glottotopia/aagd",
"id": "f367737060ca0d679e4dd8002da6fbce2e5f1f3d",
"size": "842"... |
from setuptools import setup
setup(name='awsclpy',
version='0.4',
description='Chain AWSCLI commands in Python.',
long_description='Run AWSCLI commands and use their outputs in next ' +
'commands.',
classifiers=[
'Programming Language :: Python',
'Programming Language ... | {
"content_hash": "48101a5ea8d6581660e94ffbd4d57230",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 77,
"avg_line_length": 33.078947368421055,
"alnum_prop": 0.5536992840095465,
"repo_name": "hamidnazari/awsclpy",
"id": "e728a58d5489e7c87edfdd8dfd4903ba7a9b063f",
"size": "... |
from django import forms
TOOLS = [
('all', 'All the tools'),
('travel', 'Where you could travel for work'),
('sectors', 'Discover jobs you could do'),
('discovery', 'Find jobs to apply for'),
]
FEEDBACK_TYPES = [
('not_working', 'Something isn\'t working'),
('new_idea', 'I would like to suggest... | {
"content_hash": "01a41f88f5b9e0c02e19eaa7c9f2d402",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 30.753846153846155,
"alnum_prop": 0.5927963981990996,
"repo_name": "lm-tools/situational",
"id": "76d5b6723eaf63c2d75cf1ed92cc63b8593951d6",
"size": ... |
from __future__ import absolute_import, unicode_literals
from unittest import TestCase
import six
__all__ = ['call', 'parametrize', 'ParametrizedTestCase']
try:
# Try Python3 version, maybe someone will back-port this in the future?
from functools import partialmethod
except ImportError:
def partialmeth... | {
"content_hash": "e6ad9e2ef1760bb191510f69119ed064",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 111,
"avg_line_length": 34.30357142857143,
"alnum_prop": 0.6272774596564289,
"repo_name": "canni/ptestcase",
"id": "53233da1396f8c07b770ea637986c177bf7a2483",
"size": "1945... |
subreddit = 'DunderMifflin'
t_channel = '@DunderMiff'
def send_post(submission, r2t):
return r2t.send_simple(submission, min_upvotes_limit=1)
| {
"content_hash": "fbfce5e894c6b493659036d2082bdbfa",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 59,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.7364864864864865,
"repo_name": "Fillll/reddit2telegram",
"id": "9d58ca61dd8729fc1557c161a67ee77b1f70f137",
"size":... |
"""
babel.core
~~~~~~~~~~
Core locale representation and locale data access.
:copyright: (c) 2013 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
import os
from babel import localedata
from babel._compat import pickle, string_types
__all__ = ['UnknownLocaleError', 'Locale', ... | {
"content_hash": "a874af57a5149beb5ca81bdb6ccd87c7",
"timestamp": "",
"source": "github",
"line_count": 940,
"max_line_length": 83,
"avg_line_length": 32.95744680851064,
"alnum_prop": 0.5711426726920594,
"repo_name": "nandoflorestan/babel",
"id": "56dbf559334ee7e086c1b3735ae40631c439fcac",
"size": ... |
from antlr4 import *
if __name__ is not None and "." in __name__:
from .FullFormParser import FullFormParser
else:
from FullFormParser import FullFormParser
# This class defines a complete generic visitor for a parse tree produced by FullFormParser.
class FullFormVisitor(ParseTreeVisitor):
# Visit a pars... | {
"content_hash": "75ef74b1230fe03a954f7804d5a45d0e",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 92,
"avg_line_length": 35.18181818181818,
"alnum_prop": 0.7670727205610927,
"repo_name": "rljacobson/FoxySheep",
"id": "b446d8551ef6be9313459bcc55c1f5266253aa04",
"size": "... |
from openshift_checks import OpenShiftCheck, get_var
class DockerImageAvailability(OpenShiftCheck):
"""Check that required Docker images are available.
This check attempts to ensure that required docker images are
either present locally, or able to be pulled down from available
registries defined in ... | {
"content_hash": "253dbe3ccd54b7b15a37408dd23a5ead",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 116,
"avg_line_length": 39.99438202247191,
"alnum_prop": 0.6040174181767102,
"repo_name": "DG-i/openshift-ansible",
"id": "4588ed634e6715a5a21c991da0b9533c0e9126d9",
"size... |
import sublime
import re
class FileInfo:
def __init__(self, view):
self.view = view
# Get current file extension
self.file_type = self.view.file_name().split('.')[-1] if self.view.file_name() else ''
# Get current document body
self.contents = view.substr(sublime.Region(0, v... | {
"content_hash": "5d65238bcdf3599357b5646504a098d5",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 98,
"avg_line_length": 31.8,
"alnum_prop": 0.6213836477987421,
"repo_name": "huntie/super-awesome-paste",
"id": "b0551aa93e5d410aac21ffbe95ccf4cad3145859",
"size": "1590",
... |
from django.db import models
# Create your models here.
class Musician(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
instrument = models.CharField(max_length=100)
class Album(models.Model):
artist = models.ForeignKey(Musician, verbose_name="Musician id")
... | {
"content_hash": "4aca5e93a3e89c897a3d128875fc3c49",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 65,
"avg_line_length": 25.307692307692307,
"alnum_prop": 0.71580547112462,
"repo_name": "yqian1991/Django",
"id": "5c847f809b9a3f6a16c078caa8381782250b32d4",
"size": "658",... |
"""Simple, schema-based database abstraction layer for the datastore.
Modeled after Django's abstraction layer on top of SQL databases,
http://www.djangoproject.com/documentation/mode_api/. Ours is a little simpler
and a lot less code because the datastore is so much simpler than SQL
databases.
The programming model ... | {
"content_hash": "9ebe1fc0257afb64b65954b553e4a0f5",
"timestamp": "",
"source": "github",
"line_count": 3403,
"max_line_length": 80,
"avg_line_length": 32.66588304437261,
"alnum_prop": 0.6665317284683615,
"repo_name": "SRabbelier/Melange",
"id": "9bec50a4bb5ca6689ad117b6fd4f2b567ca5a5a4",
"size": "... |
from oslo_log import log as logging
from oslo_middleware import base
from oslo_utils import strutils
import webob
import webob.exc as ex
from sahara.i18n import _
from sahara.i18n import _LW
LOG = logging.getLogger(__name__)
class AuthValidator(base.Middleware):
"""Handles token auth results and tenants."""
... | {
"content_hash": "d3fc6f91f0d1a49c98ae23162fda666f",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 78,
"avg_line_length": 36.46067415730337,
"alnum_prop": 0.5784283513097073,
"repo_name": "tellesnobrega/sahara",
"id": "5f83fc7383e7259b926642e34e90a9e638b7c1ed",
"size": "... |
from pants.base.build_environment import pants_version
from pants.version import VERSION as _VERSION
def test_version() -> None:
assert pants_version() == _VERSION
| {
"content_hash": "28b5f36331fb4d0707bcf4ac06579bc1",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 28,
"alnum_prop": 0.7619047619047619,
"repo_name": "jsirois/pants",
"id": "e2bf75378f3d1e1454b93afa49ed91ce6bccb4d4",
"size": "300",
"binary": false... |
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
lldbinline.MakeInlineTest(
__file__, globals(), [
decorators.expectedFailureAll(
oslist=["windows"], bugnumber="llvm.org/pr24764")])
| {
"content_hash": "5706ec5dc13565b42cbef1472fbde351",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 63,
"avg_line_length": 33.42857142857143,
"alnum_prop": 0.7051282051282052,
"repo_name": "youtube/cobalt",
"id": "af362f5be5d7708c63b0e447eb7ccf0b8b7297ab",
"size": "234",
... |
"""This code example creates new line item creative associations (LICAs) for an
existing line item and a set of creative ids.
To determine which LICAs exist, run get_all_licas.py."""
__author__ = ('Nicholas Chen',
'Joseph DiLallo')
# Import appropriate modules from the client library.
from googleads im... | {
"content_hash": "292df4e35997c1654ecd0eaa9efaae85",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 31.523809523809526,
"alnum_prop": 0.6722054380664653,
"repo_name": "dietrichc/streamline-ppc-reports",
"id": "a97611baed1cbc6e8cb42301b1bc0b3252fb762a"... |
"""
This script is called by update_route.sh. It is to set a default route for route tables to use the first online NAT instancein an OpsWorks stack.
Route tables should store the stack id and the layer short name that contain NAT instances in the NATStackId and NATLAyer tags respectively.
"""
import argparse
impor... | {
"content_hash": "e60ba0f5cd4444d84b94902009a4108d",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 146,
"avg_line_length": 39.723404255319146,
"alnum_prop": 0.6537225495447242,
"repo_name": "cloudtp/Cloud-Portal",
"id": "1f74e356cd53131570c764efcaaecc69b6ba3801",
"size":... |
from classytags.arguments import Argument, MultiValueArgument
from classytags.core import Options, Tag
from classytags.helpers import InclusionTag
from classytags.parser import Parser
from cms.models import Page, Placeholder as PlaceholderModel
from cms.plugin_rendering import render_plugins, render_placeholder
from cm... | {
"content_hash": "78a507a8d05e810aaaeaafa121a73948",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 105,
"avg_line_length": 35.28266033254157,
"alnum_prop": 0.6310084825636192,
"repo_name": "vipins/ccccms",
"id": "e05d9a06e3dba000810f7fa836161d1e7bbad0bf",
"size": "14878... |
"""
* Copyright 2012-14 Justin A. Debrabant <debrabant@cs.brown.edu> and Matteo Riondato <matteo@cs.brown.edu>
*
* 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... | {
"content_hash": "404652048541ef275c6487cd9bad14a9",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 107,
"avg_line_length": 32.955555555555556,
"alnum_prop": 0.6271072151045178,
"repo_name": "jdebrabant/parallel_arules",
"id": "bfc6f6b9aa78cf232a269d73fd4ae654ddc2c89a",
"... |
__author__ = 'Andrew Hawker <andrew.r.hawker@gmail.com>'
from flask import Blueprint
scores = Blueprint('scores', __name__, url_prefix='/api/scores')
@scores.route('/')
def f():
return 'hello world' | {
"content_hash": "6f611e8ff23525a7b657ea3be26607c0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 64,
"avg_line_length": 22.444444444444443,
"alnum_prop": 0.6782178217821783,
"repo_name": "ahawker/jpool",
"id": "43a183d39246254c79aaa620713353f5ac917c61",
"size": "202",
... |
import re
from importlib import import_module
from django.conf import settings
from django.contrib.admin.templatetags.admin_list import (result_headers,
result_hidden_fields,
results)
from django.urls im... | {
"content_hash": "e9bec724b01f6a5a45e469e232504d28",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 90,
"avg_line_length": 31.620111731843576,
"alnum_prop": 0.5996466431095406,
"repo_name": "sainipray/djadmin",
"id": "4ebab2414883df6f6b987f36ce61f3e5ebb46c77",
"size": "5... |
from ddt import data, ddt
from django.core.exceptions import ValidationError
from rest_framework import test
from waldur_core.core import validators
from waldur_core.structure.models import Customer
class NameValidationTest(test.APITransactionTestCase):
def test_name_should_have_at_least_one_non_whitespace_chara... | {
"content_hash": "36c20ca767358aad26cc3fcbc28773d4",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 92,
"avg_line_length": 33.65079365079365,
"alnum_prop": 0.6391509433962265,
"repo_name": "opennode/waldur-mastermind",
"id": "7c1241adbad7bcb7f9dde2335c90afa116993815",
"si... |
"""Utilities and helper functions."""
import collections
import datetime
import decimal
import errno
import functools
import hashlib
import multiprocessing
import netaddr
import os
import random
import signal
import socket
import sys
import tempfile
import uuid
import debtcollector
from eventlet.green import subproce... | {
"content_hash": "95afb167ec939b5d112ba9b3a7946a0a",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 79,
"avg_line_length": 33.84055118110236,
"alnum_prop": 0.5978709790006399,
"repo_name": "glove747/liberty-neutron",
"id": "f0b57e3793c799c33e792cfb97ffbd173f60a63c",
"siz... |
""":func:`~pandas.eval` parsers
"""
import ast
import operator
import sys
import inspect
import tokenize
import datetime
from functools import partial
import pandas as pd
from pandas import compat
from pandas.compat import StringIO, lmap, zip, reduce, string_types
from pandas.core.base import StringMixin
from pandas... | {
"content_hash": "80273e248dc47b5fdb289cdaee7acb93",
"timestamp": "",
"source": "github",
"line_count": 737,
"max_line_length": 86,
"avg_line_length": 34.576662143826326,
"alnum_prop": 0.5716359926225326,
"repo_name": "stevenzhang18/Indeed-Flask",
"id": "6da5cf4753a8e4959a7b37c589e3ea03214d75cf",
"... |
import os
import sys
import re
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Translate X color schemes to termiantor format')
parser.add_argument('xrdb_path', type=str, help='path to xrdb files')
parser.add_argument('-d', '--destiny', type=str, dest='out... | {
"content_hash": "87ccc852d3b99c2c5626566380130f85",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 79,
"avg_line_length": 34.53731343283582,
"alnum_prop": 0.5492653414001729,
"repo_name": "redlist/dotfiles",
"id": "a80c34b7bfdeef9a2b0a5e91ed7c6903569ccc50",
"size": "2541... |
"""Tests of PulpClearRepo script.
"""
from __future__ import print_function, unicode_literals
import unittest
import os
import sys
from mock import Mock, patch
DIR = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(DIR, ".."))
from releng_sop.pulp_clear_repos import get_parser, PulpClearRepos # noqa
from ... | {
"content_hash": "d4685fba1bd92f591f3235811188edee",
"timestamp": "",
"source": "github",
"line_count": 442,
"max_line_length": 114,
"avg_line_length": 38.56334841628959,
"alnum_prop": 0.5881490173071282,
"repo_name": "release-engineering/releng-sop",
"id": "2127925fca6eb1545de033106d0f4a3b58d54663",... |
"""
This module contains the main logic.
"""
import pandas as pd
import numpy as np
import shapely.ops as so
import gtfs_kit as gk
from . import constants as cs
def get_duration(timestr1, timestr2, units="s"):
"""
Return the duration of the time period between the first and second
time string in the give... | {
"content_hash": "6ac887761291fc2d83ff85b2dae21c3f",
"timestamp": "",
"source": "github",
"line_count": 442,
"max_line_length": 88,
"avg_line_length": 34.73076923076923,
"alnum_prop": 0.5879747247736303,
"repo_name": "araichev/make_gtfs",
"id": "9b8ce04b11a9e2f9cd4f998ffb31ac854ae1b0f3",
"size": "1... |
from django.shortcuts import render
from django.http import HttpResponse
from search import do_search
from time import clock
PAGE_SIZE = 10
def home(request):
return render(request, 'home.html')
def search(request):
if 'q' in request.GET:
q = request.GET['q']
if 'page' in request.GET:
... | {
"content_hash": "79be2e5ad0d839ec1c43baf4dc2a23d9",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 88,
"avg_line_length": 36.945945945945944,
"alnum_prop": 0.4272128749085589,
"repo_name": "Richardlihui/xundao",
"id": "a8bf17635b39be0d1a81146fa414e06b4b576e3f",
"size": "... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
#At a minimum you will need username,
default_shib_attributes = {
"Shibboleth-eppn": (True, "username"),
}
SHIB_ATTRIBUTE_MAP = getattr(settings, 'SHIBBOLETH_ATTRIBUTE_MAP', default_shib_attributes)
#Set to true if... | {
"content_hash": "492ada3e0b42ddbf96b3f55116a95746",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 98,
"avg_line_length": 40.827586206896555,
"alnum_prop": 0.7508445945945946,
"repo_name": "UCL-RITS/django-shibboleth-remoteuser",
"id": "e64b19fc1a1a86408bf6d1f5186b6ba7300b... |
from msrest.serialization import Model
class DataDisk(Model):
"""Describes a data disk.
:param lun: The logical unit number.
:type lun: int
:param name: The disk name.
:type name: str
:param vhd: The virtual hard disk.
:type vhd: :class:`VirtualHardDisk
<azure.mgmt.compute.compute.v2... | {
"content_hash": "f897788af64dc70c2ae9300bcaded9b3",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 99,
"avg_line_length": 40.80357142857143,
"alnum_prop": 0.6315098468271335,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "e5c703e1bdc6de65fcc83b6f908a241b88240986",
"siz... |
import unittest
import numpy as np
from .. import permutation_test as pt
from nipy.algorithms.graph import wgraph_from_3d_grid
nperms = 2
ndraws = 10
def make_data(n=10,mask_shape=(10,10,10),axis=0):
mask = np.zeros(mask_shape,int)
XYZ = np.array(np.where(mask==0))
p = XYZ.shape[1]
data = np.random.... | {
"content_hash": "ad18e7a2a72799c24e6614a635845241",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 136,
"avg_line_length": 40.309859154929576,
"alnum_prop": 0.6149545772187281,
"repo_name": "bthirion/nipy",
"id": "da57e345515522c6bb12e51deeb3fd143843d217",
"size": "2976"... |
import time
def find_closest(look_for, target_data):
def whats_the_difference(first, second):
if first == second:
return(0)
elif first > second:
return(first - second)
else:
return(second - first)
max_diff = 9999999
for each_thing in target_data... | {
"content_hash": "72f6cd35c541abc03f1f682d4accae5d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 61,
"avg_line_length": 27.066666666666666,
"alnum_prop": 0.5665024630541872,
"repo_name": "tdean1995/HFPythonSandbox",
"id": "f7f3d9fa4822c626cc3ed2ceaac1567d407ca197",
"si... |
import matplotlib.pyplot as plt
import pandas as pd
import itertools as it
import numpy as np
import pymc3 as pm
import sys
from pymc3.variational.callbacks import CheckParametersConvergence
def FitMyModel(trainDM,PredDM):
with pm.Model() as model:
# partition dataframes df
Ydf = trainDM[0]
... | {
"content_hash": "28587e56425da9a0c066abcc749a1922",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 127,
"avg_line_length": 37.277227722772274,
"alnum_prop": 0.6735723771580345,
"repo_name": "molgor/spystats",
"id": "d96ddf09d9741fc42b9770b4c400d667b49f1b76",
"size": "38... |
import argparse
from pyminutiaeviewer import gui
parser = argparse.ArgumentParser(description='Py Minutiae Viewer')
parser.add_argument('-d', '--draw-minutiae', nargs='+', dest='draw_minutiae',
metavar=('FINGERPRINT_IMAGE', 'MINUTIAE_FILE'),
help='Draws minutiae on to the FINGE... | {
"content_hash": "f40ac9984cbf5f4671fa458f88b69324",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 116,
"avg_line_length": 41.90909090909091,
"alnum_prop": 0.6193058568329718,
"repo_name": "IgniparousTempest/py-minutiae-viewer",
"id": "a96f3a872ef518140ef6869713d017010eef9... |
from django.apps import AppConfig
from django.core.checks import register, Tags
from django.utils.translation import gettext_lazy as _
class TourismConfig(AppConfig):
name = 'geotrek.tourism'
verbose_name = _("Tourism")
def ready(self):
from .forms import TouristicContentForm, TouristicEventForm
... | {
"content_hash": "ac2e349d3cfabbf64ad86baef9b7d875",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 34.8421052631579,
"alnum_prop": 0.7009063444108762,
"repo_name": "makinacorpus/Geotrek",
"id": "dbd5dd2beedfe63009b1aec63f7edc466a4b9c28",
"size": "6... |
import argparse
import re
import os
import shutil
import sqlite3
import subprocess
import sys
import tempfile
import zipfile
def extract_namespaces(source_path, base_namespace='', depth=1):
namespaces = set()
for entry in os.listdir(source_path):
full_path = os.path.join(source_path, entry)
i... | {
"content_hash": "c265acc6295a58251c75eb5b54eab66e",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 79,
"avg_line_length": 27.60287081339713,
"alnum_prop": 0.5917836713468538,
"repo_name": "craigcabrey/apk-namespace-analyzer",
"id": "efec82c624f844f4f9d2a95fdaec710bdde77c3... |
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.insert(0, os.path.abspath('.'))
# -- General configurati... | {
"content_hash": "711ecdccf587eae561af1bde73b7c121",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 80,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.7055353901996371,
"repo_name": "architv/dropbox-api-dev",
"id": "c455e0eda0f2158685b985eb589a1a24e0c1b999",
"size... |
"""Beta API server implementation."""
import threading
from grpc._links import service
from grpc.beta import interfaces
from grpc.framework.core import implementations as _core_implementations
from grpc.framework.crust import implementations as _crust_implementations
from grpc.framework.foundation import logging_pool... | {
"content_hash": "095a18936e241800916d7a774665872d",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 93,
"avg_line_length": 30.677777777777777,
"alnum_prop": 0.6608113002535313,
"repo_name": "miselin/grpc",
"id": "eb0aadb42f975a894ae1633f6d215910ce220967",
"size": "7051",... |
import numpy as np
import sys
sys.path.append("src")
import yamcmcpp
class Theta(yamcmcpp.Parameter):
def __init__(self, track, name, temperature=1.0):
yamcmcpp.Parameter.__init__(self, track, name, temperature)
self._data = None
self._ndata = 0
def setData(self, data):
... | {
"content_hash": "f7b2917d580e2d9e5b2998fe61f81e9c",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 75,
"avg_line_length": 25.60655737704918,
"alnum_prop": 0.6190781049935979,
"repo_name": "brandonckelly/yamcmcpp",
"id": "7b4049f1bdcbd1f614bfcd4cf5709f652ed5ccac",
"size":... |
""" Dummy Module
"""
from zope.interface import moduleProvides
from zope.interface.tests.idummy import IDummyModule
moduleProvides(IDummyModule)
def bar(baz):
# Note: no 'self', because the module provides the interface directly.
pass
| {
"content_hash": "5c425e2a832e04a6f2fc0e128b5c7b6f",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 75,
"avg_line_length": 25.6,
"alnum_prop": 0.73046875,
"repo_name": "timkrentz/SunTracker",
"id": "29a2a18f3c63cf9740d61b3056976c7757ddf567",
"size": "911",
"binary": fal... |
import grpc
import csv
#from tables import Table
from enum import IntEnum
from dynagatewaytypes import datatypes_pb2
from dynagatewaytypes import enums_pb2
from dynagatewaytypes import general_types_pb2
from dynagatewaytypes import authentication_pb2_grpc
from dynagatewaytypes import authentication_pb2
from dynagate... | {
"content_hash": "6925f2be9c870f18d2bbcfbaa216c6c6",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 111,
"avg_line_length": 34.99090909090909,
"alnum_prop": 0.6625097427903351,
"repo_name": "Dynactionize/Dyna-Python",
"id": "c9e8bf895cf17f30016a938ebad9adabdef9c7dc",
"si... |
import os
import shutil
import tempfile
from subprocess import call
def test_start_new_project():
"""
Test creating a new project with project bootstrap command.
"""
project_name = 'test_arctic_project'
project_path = tempfile.mkdtemp()
manage_py_bin = os.path.join(project_path, 'manage.py')
... | {
"content_hash": "83c10281b99bdc134df1302d040b6e94",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 27.27027027027027,
"alnum_prop": 0.6699702675916749,
"repo_name": "dgbc/django-arctic",
"id": "47d5a896cad677d6e35424abba21fb63c2234dca",
"size": "10... |
from helper import *
ev = 0.00000001
class Q:
def __init__(self, key, value):
self.key = key
self.value = value
self.left = None
self.right = None
def find(self, key):
if self.key is None:
return False
c = compare_by_y(key, self.key)
if c==0:
return True
elif c==-1:
if self.left:
self... | {
"content_hash": "f4180ec3f052be94edaaf3af7abbc787",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 41,
"avg_line_length": 19.2,
"alnum_prop": 0.6111111111111112,
"repo_name": "Maplenormandy/list-62x",
"id": "41f51aab1a29344c31e8e50cb376ec9d04cd6790",
"size": "1704",
"b... |
from collections import OrderedDict
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon import tabs
from horizon.utils import memoized
from openstack_dashboard import... | {
"content_hash": "eed4e5fa1016ea96a5e14c01b8cbeb42",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 37.15068493150685,
"alnum_prop": 0.6323746312684366,
"repo_name": "wolverineav/horizon",
"id": "831030d8221c8cbd39680405c0770cdfb815e042",
"size": "... |
"""
This script tests the steps of the promoter workflow.
- Checks the dlrn API that the hash under test has been promoted
to the promotion target
- Checks that containers with that hash are pushed to repo 2
- Checks that images are uploaded with that hash and linked to
promotion target
- Checks the promoter ... | {
"content_hash": "c2631ce6cdbd448cd25d5d35146ff498",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 80,
"avg_line_length": 40.04261363636363,
"alnum_prop": 0.6164597374955658,
"repo_name": "rdo-infra/ci-config",
"id": "9e4dbd91a5638d5e385f7e245c95d6a4b3f05797",
"size": "... |
"""Setup module for python-gflags."""
from distutils.core import setup
setup(name='python-gflags',
version='3.1.0',
description='Google Commandline Flags Module',
license='BSD',
author='Google Inc. and others',
author_email='google-gflags@googlegroups.com',
url='https://github.com/... | {
"content_hash": "9c21b730893d9ad6f57e0b3575c2adfd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 36.869565217391305,
"alnum_prop": 0.6025943396226415,
"repo_name": "damienmg/bazel",
"id": "663121a7d4053ba4539167bd24aacd4bb5cfadcb",
"size": "2396"... |
"""Timesketch datastores."""
| {
"content_hash": "8408825ff5b13a8f75c4c2c61cf0bb0b",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 28,
"avg_line_length": 29,
"alnum_prop": 0.6896551724137931,
"repo_name": "lockhy/timesketch",
"id": "4f40b96b4ef2624e7e4511a00af71f285a4812a6",
"size": "625",
"binary": f... |
import mock
import uuid
from rally.cmd.commands import task
from rally import exceptions
from rally.openstack.common import test
class TaskCommandsTestCase(test.BaseTestCase):
def setUp(self):
super(TaskCommandsTestCase, self).setUp()
self.task = task.TaskCommands()
@mock.patch('rally.cmd.c... | {
"content_hash": "c82f5cb3e8c4b24a3bf597f4a3e384c3",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 78,
"avg_line_length": 41.18045112781955,
"alnum_prop": 0.5963118495526748,
"repo_name": "ytsarev/rally",
"id": "1bb039273a7660347a761fe3fcb4edc0d99a75ca",
"size": "6107",... |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Logoff User',
'Author': ['@harmj0y'],
'Description': ("Logs the current user (or all users) off the machine."),
'Background' : False,
... | {
"content_hash": "26470841397afc21e9754ddf95e4b583",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 120,
"avg_line_length": 29.323076923076922,
"alnum_prop": 0.4727177334732424,
"repo_name": "Hackplayers/Empire-mod-Hpys-tests",
"id": "def27dc075745ba59309b0e834041b02208c266... |
"""Support for presenting detailed information in failing assertions."""
import sys
from typing import Any
from typing import Generator
from typing import List
from typing import Optional
from typing import TYPE_CHECKING
from _pytest.assertion import rewrite
from _pytest.assertion import truncate
from _pytest.assertio... | {
"content_hash": "bc8c63ad6b6ed2938040027a85ae6c9a",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 96,
"avg_line_length": 35.773480662983424,
"alnum_prop": 0.6661003861003861,
"repo_name": "Akasurde/pytest",
"id": "480a26ad867181b4d6213e98403230515ba987a9",
"size": "647... |
import sqlalchemy as sa
from neutron.db import model_base
# Model classes for test resources
class MehModel(model_base.BASEV2, model_base.HasTenant):
meh = sa.Column(sa.String(8), primary_key=True)
class OtherMehModel(model_base.BASEV2, model_base.HasTenant):
othermeh = sa.Column(sa.String(8), primary_key... | {
"content_hash": "41dbd792bb5a182dfa76c8530871a298",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 25.153846153846153,
"alnum_prop": 0.7522935779816514,
"repo_name": "wolverineav/neutron",
"id": "c8265f94fd682d47228413548ec3a03372f43152",
"size": "... |
import falcon
from falcon import API
from falcon_web_demo.person_resources import PersonListResource, PersonResource
from people.people_application import PeopleApplication
from .persistence import SessionScope
from .postgres_people_repository import PostgresPeopleRepository
def get_app() -> API:
session_scope =... | {
"content_hash": "028172de72c1d717b726fbcd9647c993",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 37.18181818181818,
"alnum_prop": 0.7787286063569682,
"repo_name": "wileykestner/falcon-sqlalchemy-demo",
"id": "91f007dbd963859bfdb8f91c3786557d35c4069... |
from a10sdk.common.A10BaseClass import A10BaseClass
class Ipsec(A10BaseClass):
""" :param uuid: {"description": "uuid of the object", "format": "string", "minLength": 1, "modify-not-allowed": 1, "optional": true, "maxLength": 64, "type": "string"}
:param packet_round_robin: {"default": 0, "optional": ... | {
"content_hash": "7f1ba1c4c9c9464be27550f3992134c2",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 196,
"avg_line_length": 40.02439024390244,
"alnum_prop": 0.6337599024984766,
"repo_name": "amwelch/a10sdk-python",
"id": "60031005fe9c8398032d39040ce1ff1dd734e5c8",
"size":... |
import platform
import sys
try:
from setuptools import setup, Extension
except:
from distutils.core import setup, Extension, Command
from distutils.command.build_ext import build_ext
from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
# Fix to build sdist under vagrant
impo... | {
"content_hash": "29fb0f2c08cb94d5b9304b756d0add61",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 87,
"avg_line_length": 30.427083333333332,
"alnum_prop": 0.593974666210202,
"repo_name": "siemens/thrift",
"id": "090544ce98b5ab15e16efc8e12fbc6b9b8676e24",
"size": "3728",... |
"""Tests for BPD's implementation of the MPD protocol.
"""
from __future__ import division, absolute_import, print_function
import unittest
from test.helper import TestHelper
import os
import sys
import multiprocessing as mp
import threading
import socket
import time
import yaml
import tempfile
from contextlib import... | {
"content_hash": "32f3d87dc002c12a3f8b77740b0abcca",
"timestamp": "",
"source": "github",
"line_count": 1030,
"max_line_length": 79,
"avg_line_length": 37.73495145631068,
"alnum_prop": 0.547276609977616,
"repo_name": "sampsyo/beets",
"id": "dd47ac62b6cdd68ff9cbbae60e0bfdae499fa9ac",
"size": "39538"... |
"""Settings Module"""
import logging
import os
MSW_API = os.environ.get('SF_MSW_API', None)
LOG_LEVEL = getattr(logging, os.environ.get('SF_LOG_LEVEL', 'DEBUG'))
| {
"content_hash": "173b693914a994780ad7f974488c56f1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 69,
"avg_line_length": 23.428571428571427,
"alnum_prop": 0.6951219512195121,
"repo_name": "Smotko/surfbot",
"id": "081eb6be2fbfd5ed43eb1b22b66b4cc64ac40bc4",
"size": "164",
... |
from scrapy.contrib.spiders.init import InitSpider
import datetime
class SpiderBase(InitSpider):
def extractor(self, xpathselector, selector):
"""
Helper function that extract info from xpathselector object
using the selector constrains.
"""
val = xpathselector.xpath(selec... | {
"content_hash": "e5daba7c89249783db50ba31cc29f704",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 77,
"avg_line_length": 27.974789915966387,
"alnum_prop": 0.6037849203965154,
"repo_name": "bopo/scrapy-project-template",
"id": "6abde84d17875dc470b4a79264fcd9de225aed27",
... |
from django.contrib.auth.mixins import LoginRequiredMixin
from rest_framework.response import Response
from rest_framework.schemas import SchemaGenerator
from rest_framework.views import APIView
from rest_framework_swagger import renderers
from .urls.v1 import urlpatterns
class SwaggerSchemaView(LoginRequiredMixin,... | {
"content_hash": "ce1f3b47242e4b5de5fe3a75ea3aa7ac",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 57,
"avg_line_length": 28.47826086956522,
"alnum_prop": 0.7145038167938931,
"repo_name": "DMPwerkzeug/DMPwerkzeug",
"id": "a9b43c71fc1977e9050dc8daf132741b4e8eb0dd",
"size"... |
import functools
from tempest_lib.cli import base
from tempest_lib.cli import output_parser
import testtools
from tempest.common import credentials
from tempest import config
from tempest import exceptions
from tempest.openstack.common import versionutils
from tempest import test
CONF = config.CONF
def check_clie... | {
"content_hash": "f1ad10beef65b66a0e9d3267bd64976e",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 79,
"avg_line_length": 38.4954954954955,
"alnum_prop": 0.6154926281301194,
"repo_name": "hpcloud-mon/tempest",
"id": "6733204736a4248469be1120c8be5a92ae0aed41",
"size": "4... |
from pysmt.shortcuts import And, Not, Symbol, Bool, Exists, Solver
from pysmt.shortcuts import get_env, qelim, Or
from pysmt.test import TestCase, skipIfSolverNotAvailable, main
from pysmt.test.examples import get_example_formulae
from pysmt.logics import BOOL
from pysmt.exceptions import PysmtValueError
class TestBdd... | {
"content_hash": "777bd09e5ccff6e67a7d2e7b56cc18f8",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 76,
"avg_line_length": 35.318471337579616,
"alnum_prop": 0.5796212804328224,
"repo_name": "agriggio/pysmt",
"id": "f1dbcd141113dcbb81c46c6ac81e6b5b8c079b52",
"size": "6195... |
from .baserequest import BaseRequest
from oandapyV20.types import Units, PriceValue
from oandapyV20.definitions.orders import (
OrderType,
TimeInForce,
OrderPositionFill)
class MarketOrderRequest(BaseRequest):
"""create a MarketOrderRequest.
MarketOrderRequest is used to build the body for a Mark... | {
"content_hash": "f958512671cc0fde872035fadf34f89d",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 77,
"avg_line_length": 33.58904109589041,
"alnum_prop": 0.5142740619902121,
"repo_name": "hootnot/oanda-api-v20",
"id": "1599ebde965e1cd77308b7bbc0ac2163e0131fbb",
"size":... |
"""Wikipedia Cirrus Extractor:
Extracts and cleans text from a Wikipedia Cirrus dump and stores output in a
number of files of similar size in a given directory.
Each file will contain several documents in the format:
<doc id="" url="" title="">
...
</doc>
"""
import sys, os.path, time
import re
imp... | {
"content_hash": "67e379fee2a768a8ebdbed16b2a50f07",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 91,
"avg_line_length": 32.38288288288288,
"alnum_prop": 0.5504242592850188,
"repo_name": "emrekgn/tr-rnn",
"id": "ff564b26b03993373949630dfeefd7c9f6f17f15",
"size": "8327"... |
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": "c69de09bd366f0c22f89fe3c47463477",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 80,
"avg_line_length": 32.536842105263155,
"alnum_prop": 0.7115820122937561,
"repo_name": "Lemma1/MAC-POSTS",
"id": "092ff21583d38363377a0847d01de1db801de1e6",
"size": "66... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... | {
"content_hash": "1b006005db5206e8dde032d4a850c7b6",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 189,
"avg_line_length": 45.6125,
"alnum_prop": 0.586736092080022,
"repo_name": "Fly-Style/metaprog_univ",
"id": "0edd52121113ec4c2b5a8abc1ec5ca1027ca6c06",
"size": "3722",
... |
import os
from subprocess import Popen, PIPE
def solve_it(input_data):
# Writes the inputData to a temporay file
tmp_file_name = 'tmp.data'
tmp_file = open(tmp_file_name, 'w')
tmp_file.write(input_data)
tmp_file.close()
# Runs the command: ./knapsack.bin tmp_file_name
process = Popen(['... | {
"content_hash": "49ef98bfb8e439562b37fc247c162fbc",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 131,
"avg_line_length": 27.323529411764707,
"alnum_prop": 0.6318622174381054,
"repo_name": "matematik7/Coursera-DiscreteOptimization",
"id": "56be7d1630a161734eb961ac6f83150e... |
from cinderclient.exceptions import NotFound as CinderNotFound
from cinderclient.exceptions import Forbidden as CinderForbidden
from glanceclient.exc import HTTPNotFound as GlanceNotFound
from glanceclient.exc import Unauthorized as GlanceUnauthorized
from glanceclient.exc import HTTPForbidden as GlanceForbidden
from k... | {
"content_hash": "100578cfba66f3e0cd2f329107b59e1a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 78,
"avg_line_length": 43.029411764705884,
"alnum_prop": 0.8311688311688312,
"repo_name": "chalupaul/roletester",
"id": "69b7b1c213ed60022e80f75cdcccc874740b052c",
"size": ... |
import copy
import logging
from nose.tools import assert_true, assert_false, assert_equal, assert_raises
from django.contrib.auth.models import User
from desktop.lib.django_test_util import make_logged_in_client
from desktop.lib.test_utils import grant_access
from liboozie.oozie_api_test import OozieServerProvider
f... | {
"content_hash": "aafc7d0e7b72eb02667b04d4b436cc52",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 103,
"avg_line_length": 36.75272727272727,
"alnum_prop": 0.6712179677451271,
"repo_name": "hortonworks/hortonworks-sandbox",
"id": "f2fdcbc405e0b52eb1deddfe8089adf9e3ab6012"... |
from aiohttp.web import Response
def get_all_todos(request):
return Response(text='get_all_todos')
def create_todos(request):
return Response(text='create_todos')
def update_todos(request):
return Response(text='update_todos')
def remove_todos(request):
return Response(text='remove_todos')
def... | {
"content_hash": "b7149ca438c43446390877f005ee2316",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 53,
"avg_line_length": 20.53125,
"alnum_prop": 0.684931506849315,
"repo_name": "alexeyraspopov/aiohttp-mongodb-example",
"id": "bb4e388569a71f1342c7fc07646396dcc6a0e3ba",
"... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Content.source_url'
db.add_column('canvas_content', 'source_url', self.gf('django.db.models.fields.CharField... | {
"content_hash": "3a301628289252d7f4c0debb8261d726",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 192,
"avg_line_length": 74.8,
"alnum_prop": 0.547614150555327,
"repo_name": "drawquest/drawquest-web",
"id": "099af6d67202427729a3cf636a2464185abdb8f9",
"size": "9742",
... |
from typing import Any, Callable, Dict, List, Optional, Text
from zerver.models import (
get_stream_recipient,
get_stream,
MutedTopic,
UserProfile
)
from sqlalchemy.sql import (
and_,
column,
func,
not_,
or_,
Selectable
)
def get_topic_mutes(user_profile: UserProfile) -> List[L... | {
"content_hash": "88206c17053c1eb3adbd0cb20980fa32",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 106,
"avg_line_length": 28.241935483870968,
"alnum_prop": 0.6096516276413478,
"repo_name": "mahim97/zulip",
"id": "c8878c5d212a61829c023d5ab4e5fe83898f0fa5",
"size": "3502... |
import re
import string
import unicodedata
from unstdlib.six import text_type, PY3, string_types, binary_type, u
from unstdlib.six.moves import xrange
if PY3:
text_type_magicmethod = "__str__"
else:
text_type_magicmethod = "__unicode__"
from .random_ import random
__all__ = [
'random_string',
'numb... | {
"content_hash": "f62d672e8b5ff05ba0f346155b0acd20",
"timestamp": "",
"source": "github",
"line_count": 430,
"max_line_length": 127,
"avg_line_length": 25.3,
"alnum_prop": 0.5530839231547017,
"repo_name": "shazow/unstdlib.py",
"id": "9ca4604f8c822b2240f4bc5b4b749361fbca7b98",
"size": "10879",
"bi... |
from setuptools import setup, find_packages
import vet_cond
with open('README.rst') as fh:
long_description = fh.read()
setup(
name='VetCond',
version=vet_cond.__version__,
author='Matthew Einhorn',
author_email='moiein2000@gmail.com',
url='http://matham.github.io/vet_cond/',
l... | {
"content_hash": "3b121672a24f389968fd0d216a02ab8a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 73,
"avg_line_length": 40.48275862068966,
"alnum_prop": 0.5732538330494037,
"repo_name": "matham/vet_cond",
"id": "983d1bc5b8933c87317de7275c961472f7377703",
"size": "1174"... |
import bisect
import random
# Temperature phrases & upper bounds
temp_phrases = ["It is going to be " + s + "." for s in
["a cold day today", "a cool day today", "a warm day today", "a hot day today"]];
temp_upper_bounds = [0.25, 0.50, 0.75, 1.0];
# Wind phrases & upper bounds
wind_phrases = ["It is g... | {
"content_hash": "20f9b8ce244f041f77d2eaec3c3fcd4f",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 108,
"avg_line_length": 37.208333333333336,
"alnum_prop": 0.5834266517357223,
"repo_name": "bitesandbytes/upgraded-system",
"id": "5611966dbf43b919b19df46e835796011a579fd5",
... |
from indy import IndyError
from indy import crypto
import pytest
from indy.error import ErrorCode
@pytest.mark.asyncio
async def test_anon_decrypt_works(wallet_handle, identity_trustee1, message):
(_, verkey) = identity_trustee1
encrypted_msg = await crypto.anon_crypt(verkey, message)
parsed_message = a... | {
"content_hash": "00b3094cb27f0e3f58b332c851caaca6",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 96,
"avg_line_length": 39.09756097560975,
"alnum_prop": 0.7461010605115409,
"repo_name": "srottem/indy-sdk",
"id": "a177a309c19359a8bda63d445b31a64b5de00aae",
"size": "1603... |
from Tkinter import *
import random
#what i want to accomplish:
#create timer to regular pipes
#use timer for bird to move
#user input up arrow moves bird up a certain increment
#if bird overlaps part of pipe, bird dies--> loss
#if bird goes through, score goes up
def run():
global canvas
global data
... | {
"content_hash": "10216262f9765ab715c436eca733bcf5",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 144,
"avg_line_length": 27.273504273504273,
"alnum_prop": 0.5785020369790035,
"repo_name": "ananyacleetus/15-112",
"id": "66c574dc1a61db95d2b29af623da43665eb30fd6",
"size"... |
import logging
import os
import sys
from rbtools.api.errors import APIError
from rbtools.clients import SCMClient, RepositoryInfo
from rbtools.utils.checks import check_gnu_diff, check_install
from rbtools.utils.filesystem import make_tempfile
from rbtools.utils.process import die, execute
# This specific import is n... | {
"content_hash": "402d2080d14436d7c32ccdcd65736fef",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 80,
"avg_line_length": 36.60620525059666,
"alnum_prop": 0.5652627461207459,
"repo_name": "clach04/rbtools",
"id": "b71bfde5dbd2955c02529827981ab58ec9aef54e",
"size": "1533... |
import os.path
import re
class MockInputApi(object):
"""Mock class for the InputApi class.
This class can be used for unittests for presubmit by initializing the files
attribute as the list of changed files.
"""
def __init__(self):
self.change = MockChange([], [])
self.files = []
self.presubmi... | {
"content_hash": "4e813a95c1eec6bdacc21622508039a6",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 78,
"avg_line_length": 27.647058823529413,
"alnum_prop": 0.6802431610942249,
"repo_name": "endlessm/chromium-browser",
"id": "510a553158b12ac2637b2bfde474aeaa8a50073b",
"s... |
from calvin.actor.actor import Actor, manage, condition, stateguard, calvinsys
class LightBreaker(Actor):
"""
React to changes in a sensor.
Output:
open : state true=closed, false=open
"""
@manage(include=[])
def init(self):
self.setup()
def setup(self):
self.sensor... | {
"content_hash": "8f073463e7185a84a9bb328cebdb7ff3",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 78,
"avg_line_length": 24.136363636363637,
"alnum_prop": 0.5894538606403014,
"repo_name": "EricssonResearch/calvin-base",
"id": "472e6d17ecd875e287e06ffdc8b8b3f265be2383",
... |
from collections import defaultdict
import sys
cnts = defaultdict(lambda: 0)
for line in sys.stdin:
for word in line.strip().split():
cnts[word] += 1
for k, v in sorted(cnts.items(), key=lambda x: -x[1]):
print(f'{k}\t{v}')
| {
"content_hash": "e11b7317ede26438f5d3059a9190b965",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 54,
"avg_line_length": 23.4,
"alnum_prop": 0.6623931623931624,
"repo_name": "neulab/compare-mt",
"id": "c8c2dc1af0e5fe06c3a2d2744919fad60d45bda6",
"size": "234",
"binary"... |
"""
Contains GUI forms for the Voronoi volume filter.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from . import base
from ...filtering.filters import voronoiVolumeFilter
################################################################################
class VoronoiVolumeSetting... | {
"content_hash": "2d1ff8cc8294ab0938d1e9ecd2055063",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 142,
"avg_line_length": 42.44736842105263,
"alnum_prop": 0.6212027278363298,
"repo_name": "chrisdjscott/Atoman",
"id": "8183eab735d35974a0a5bd65021be629c81d3632",
"size": "... |
import argparse
import logging
import os
commandDesc = "Executes a provided command once on every file or " \
"subdirectory in a particular directory. Can be used, " \
"for example, for pushing files from one location to " \
"another via a cron job."
parser = argparse.Argum... | {
"content_hash": "fba8f0e7731a1f998aeff3c97b9bbf9a",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 202,
"avg_line_length": 39.53703703703704,
"alnum_prop": 0.7217798594847775,
"repo_name": "cutchin/dirsend",
"id": "90f31c7fbd28f87e494e53695340f299ab489aaf",
"size": "2136... |
from __future__ import unicode_literals, absolute_import
from django.urls import reverse
from django.test import override_settings
from mock import patch
from ci.tests import DBTester, utils
from ci.github import api
@override_settings(INSTALLED_GITSERVERS=[utils.github_config()])
class Tests(DBTester.DBTester):
d... | {
"content_hash": "8a7eb3c238f9eb361efd091ac9042f17",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 94,
"avg_line_length": 43.19047619047619,
"alnum_prop": 0.6221058434399118,
"repo_name": "idaholab/civet",
"id": "45f778d9ed51832e99233729d0b0a8b6f67d2d52",
"size": "4223",... |
import theano
from theano import tensor as T
from theano.tensor.nnet import conv2d
import numpy
rng = numpy.random.RandomState(23450)
# instantiate 4D tensor for input
input = T.tensor4(name='input')
nr_channels = 5
w_bound = numpy.sqrt(4 * 9 * 9)
def func(i, j, k):
if k == 0:
if (i == 4 or j==4):
... | {
"content_hash": "d043c8d33ca4a25133db5c5f9ef58c09",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 107,
"avg_line_length": 31.414634146341463,
"alnum_prop": 0.6381987577639752,
"repo_name": "laputian/dml",
"id": "39ae502fbfd8ec0ab48ba101c99df2c85b639f5b",
"size": "3864"... |
class ImageSizeError(Exception):
pass
class ThumbnailOptionError(Exception):
pass
class ThumbnailWorksError(Exception):
"""Internal thumbnail_works error.
Should be raised any time a method encounters an argument having a bad type
or bad value. Write as many such checks as necessary in order ... | {
"content_hash": "bed6437a1c7e1a8742a4734d253133e3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 79,
"avg_line_length": 26.761904761904763,
"alnum_prop": 0.7259786476868327,
"repo_name": "frol/django-thumbnail-works",
"id": "04a6acf886f53fa1fe4489a244832d69b766c549",
"... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
import sys
from twitter.common.lang import Compatibility
from pants.base.config import Config
from pants.reporting.html_reporter import HtmlReporter
from p... | {
"content_hash": "d800e2b30241134617a5b5a8701e4701",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 98,
"avg_line_length": 43.698113207547166,
"alnum_prop": 0.6917098445595855,
"repo_name": "Ervii/garage-time",
"id": "0099ab5f5343ab525b27d257d9caa3ceca0da9cd",
"size": "4... |
import os
import uuid
import time
import traceback
import xml.etree.ElementTree as ET
from PyQt4 import QtCore, QtGui
from XSTAF.core.logger import LOGGER
from ui.ui_testsuite_generator import Ui_TestSuiteDialog
import ui.resources_rc
class Tool(object):
_description = "testsuite generator"
main_window = None... | {
"content_hash": "4eae0863493077a2c824869559989322",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 101,
"avg_line_length": 40.38728323699422,
"alnum_prop": 0.5988263918706168,
"repo_name": "xcgspring/XSTAF",
"id": "65bba31190dbef455c19e06eaaaf09641727cd3c",
"size": "698... |
import logging
import requests
import tables
import factual.common.session
class Session(factual.common.session.BaseSession):
def read(self, table):
'''Build a Read request on the provided Table type using this Session. See the requests module for details.'''
return requests.Read(self, table)
def input(self, ta... | {
"content_hash": "71c8889302eab5b644f92957810701c0",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 118,
"avg_line_length": 44.43478260869565,
"alnum_prop": 0.7592954990215264,
"repo_name": "casebeer/factual",
"id": "ee0f899d8ab92f99cc306fc41e08fe4d36fdeff7",
"size": "102... |
class Wiki(object):
def __init__(self, project, path):
pass
| {
"content_hash": "c4d4802eae6a10e642a807d797f8fb17",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 38,
"avg_line_length": 18.25,
"alnum_prop": 0.5616438356164384,
"repo_name": "douban/code",
"id": "055c3b87d26269060ceb5d7656dedeac2a99fbc0",
"size": "99",
"binary": false... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = """
---
module: asa_config
version_added: "2.2"
author: "Peter Sprygada (@p... | {
"content_hash": "e1e0a1573b79813ab80d50900daac4a7",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 98,
"avg_line_length": 34.833333333333336,
"alnum_prop": 0.650247078202212,
"repo_name": "thaim/ansible",
"id": "ad49118e8afbac7bae33cde966d407776a97a1bf",
"size": "12892"... |
from django.shortcuts import render
from upload_image_box.example.forms import *
from django.conf import settings
from upload_image_box.settings import *
# Example view
def upload_example(request):
# if you want to upload inside a custom directory
# request.session['CUSTOM_CROPPED_IMG_DIRECTORY'] = CUSTOM_CROP... | {
"content_hash": "c28f88575cf3d52b23f92ca16aeb1538",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 84,
"avg_line_length": 32.857142857142854,
"alnum_prop": 0.7028985507246377,
"repo_name": "entpy/beauty-and-pics",
"id": "eab6460aacabc6a22201f3167c8793074ece608d",
"size":... |
import sys, os
from opentreetesting import test_http_json_method, config
# peyotl setup
from peyotl.api.phylesystem_api import PhylesystemAPI
DOMAIN = config('host', 'apihost')
# get results from about method before
CONTROLLER = DOMAIN + '/v4/studies'
SUBMIT_URI = CONTROLLER + '/about'
r = test_http_json_method(SUBM... | {
"content_hash": "79b716aa7a6ba4753f198aeed064f3d0",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 72,
"avg_line_length": 30.931506849315067,
"alnum_prop": 0.6018600531443755,
"repo_name": "kcranston/ottreeindex",
"id": "24739924bef68d8ee3225b01c4c90333ac592fbb",
"size":... |
"""
==================================
Shifting time-scale in evoked data
==================================
"""
# Author: Mainak Jas <mainak@neuro.hut.fi>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne.viz import tight_layout
from mne.datasets import sample
print(__doc__)
data_path... | {
"content_hash": "02d9ea0bc7c5e8469eaed4f3fca8eb80",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 73,
"avg_line_length": 26.48936170212766,
"alnum_prop": 0.642570281124498,
"repo_name": "adykstra/mne-python",
"id": "808d011249a5a97e7c20c7439dd6c053498e1cc9",
"size": "12... |
from msrest.serialization import Model
class USqlTableColumn(Model):
"""A Data Lake Analytics catalog U-SQL table column item.
:param name: the name of the column in the table.
:type name: str
:param type: the object type of the specified column (such as
System.String).
:type type: str
"... | {
"content_hash": "ef977cd899ab87c2d8b0c69a3b11d76c",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 65,
"avg_line_length": 27,
"alnum_prop": 0.5875420875420876,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "07807ab364448a2024049143ee7ccb61d02940c1",
"size": "1068",
... |
import tensorflow as tf
from ..utils.argtools import graph_memoized
"""
Utils about parsing dependencies in the graph.
"""
__all__ = [
'dependency_of_targets', 'dependency_of_fetches'
]
@graph_memoized
def dependency_of_targets(targets, op):
"""
Check that op is in the subgraph induced by the dependenc... | {
"content_hash": "f28dd1ab239ddd324671453b2eac2243",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 106,
"avg_line_length": 32.54666666666667,
"alnum_prop": 0.6566980745596067,
"repo_name": "ppwwyyxx/tensorpack",
"id": "b63b0249d977a0ee7a28d30fd2a2eae04870ada0",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.