text stringlengths 4 1.02M | meta dict |
|---|---|
import random
from decimal import Decimal
from shop.models.productmodel import Product # is the overridden CategoryProduct (project.models.product.Product)
from shop_categories.models.categorymodel import Category # is the overridden Category (project.models.category.Category)
from django.test.testcases import TestCas... | {
"content_hash": "5978fc2ba20746f1da43418f8b47ccb2",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 164,
"avg_line_length": 49.47692307692308,
"alnum_prop": 0.6629353233830846,
"repo_name": "fivethreeo/django-shop-categories",
"id": "27c706b788372aa0a3a08b62fa16c192339efde... |
from django.db import models
from bluebottle.bb_tasks.models import BaseTask, BaseSkill, BaseTaskFile, BaseTaskMember
from django.utils.translation import ugettext as _
class Task(BaseTask):
"""
Extended Task model for 1%Club
"""
pass
class Skill(BaseSkill):
pass
class TaskMember(BaseTaskMembe... | {
"content_hash": "2d66326349e9815263eb38185ef162d4",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 88,
"avg_line_length": 17,
"alnum_prop": 0.7299465240641712,
"repo_name": "onepercentclub/onepercentclub-site",
"id": "b2f5628d34a97b25ab7f3df0b4afa35067c102c9",
"size": "3... |
import os
import gzip
import urllib
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
download_folder = settings.GEOIP_PATH
class Command(BaseCommand):
help = 'Updates GeoIP data in {}'.format(do... | {
"content_hash": "5acc4f746adc63a2ced7523e312c48e9",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 136,
"avg_line_length": 45.6,
"alnum_prop": 0.6641604010025063,
"repo_name": "wevote/WebAppPublic",
"id": "bc4711ed96b95976f4cb5505aab093ed85f293e9",
"size": "1596",
"bin... |
from django import db
from django.db import transaction
from django.core.management.base import NoArgsCommand
from django.core.exceptions import MultipleObjectsReturned
from data.models import State, Msn, ElectricEmissionsStateRaw, ElectricEmissionsState
# National Priorities Project Data Repository
# load_electric_em... | {
"content_hash": "c30ce7abf879c2a3c7488c2bab177750",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 109,
"avg_line_length": 38.39473684210526,
"alnum_prop": 0.5534612748457848,
"repo_name": "npp/npp-api",
"id": "3480c060533780701acc1b2a3fb9f853552af86b",
"size": "2918",
... |
import os
import argparse
parser = argparse.ArgumentParser(
description="compare one design from a regression result to a benchmark result")
parser.add_argument('--benchmark', '-b', action='store', required=True,
help="The csv file from which to extract the benchmark results")
parser.add_arg... | {
"content_hash": "6a8e53a0e3babe9ed5a1fbe4af629f96",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 133,
"avg_line_length": 36.315384615384616,
"alnum_prop": 0.6418131751747511,
"repo_name": "efabless/openlane",
"id": "6e7b60349954c4b082aee9381474db9f25af1ee2",
"size": "... |
import logging
from typing import List, Optional
from flask_appbuilder.security.sqla.models import User
from superset.annotation_layers.commands.exceptions import (
AnnotationLayerBulkDeleteFailedError,
AnnotationLayerBulkDeleteIntegrityError,
AnnotationLayerNotFoundError,
)
from superset.annotation_layer... | {
"content_hash": "a02818d75a76eb7b10b05d96a0348f54",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 73,
"avg_line_length": 36.7,
"alnum_prop": 0.7213896457765667,
"repo_name": "mistercrunch/panoramix",
"id": "148bdd0bd2d61270e6290e620b5132435e359b4d",
"size": "2253",
"b... |
import os
import sys
# sys.path.insert(0, os.path.abspath('.'))
hordak_dir = os.path.abspath("..")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_project.settings")
sys.path.insert(0, hordak_dir)
import django
django.setup()
# -- General configuration ------------------------------------------------
# If... | {
"content_hash": "a90059f4d788816107a03d2d99beba6b",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 94,
"avg_line_length": 30.292517006802722,
"alnum_prop": 0.6644958454974175,
"repo_name": "waldocollective/django-hordak",
"id": "93c0b021139c9805a55b8a7085f764c7a24e05ea",
... |
'''
OVERVIEW: Python module for generating plots for processed data automatically.
'''
import os, sys
import matplotlib.pyplot as plt
from pylab import *
class AutoPlot():
def __init__(self, datasetID, workingdir):
# Initialize output directories
self.datasetID = datasetID
self.workingd... | {
"content_hash": "77213490352ca145b16a8469cfc2cf89",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 200,
"avg_line_length": 39.30769230769231,
"alnum_prop": 0.6373124592302675,
"repo_name": "thomasgurry/amplicon_sequencing_pipeline",
"id": "7b47a1d05a83752dd662a294d6593449b... |
from ..base import BitbucketCloudBase
from .projects import Projects
from ..repositories import WorkspaceRepositories
class Workspaces(BitbucketCloudBase):
def __init__(self, url, *args, **kwargs):
super(Workspaces, self).__init__(url, *args, **kwargs)
def __get_object(self, data):
return Wo... | {
"content_hash": "83c62d76956586fbb7b3a61f30fecc0c",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 136,
"avg_line_length": 37.138888888888886,
"alnum_prop": 0.5801545749189728,
"repo_name": "MattAgile/atlassian-python-api",
"id": "75a78df39357cd254bdae8903cdfa251e951a79f"... |
"""
Views for managing instances.
"""
from django.core.urlresolvers import reverse
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.utils import memoized
from opens... | {
"content_hash": "f65f19d6b42a33319dde318de01f542f",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 79,
"avg_line_length": 37.26086956521739,
"alnum_prop": 0.6469078179696616,
"repo_name": "hep-gc/glint-horizon",
"id": "f061464dcb3c96384717c6cbee3f8a10ca42621f",
"size": ... |
"""
***Calculator button class***
Calculator by Ariel Haviv (ariel.haviv@gmail.com)
Instructors: Anatoly Peymer, Zehava Lavi
"""
from Tkinter import *
class CalcButton(Button):
def __init__(self, root, **args):
self.root = root
Button.__init__(self, root)
#b_args will contain only relevant button configura... | {
"content_hash": "8727cd563d63882c5a5c8035408c48c8",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 74,
"avg_line_length": 27.761904761904763,
"alnum_prop": 0.6792452830188679,
"repo_name": "ArielCabib/python-tkinter-calculator",
"id": "c74794ffad6269216ed1e0e5c17f67bd1043b... |
import unittest
import os
import time
from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer
from azure.cli.testsdk import JMESPathCheck as JMESPathCheckV2
from azure.cli.testsdk.vcr_test_base import (ResourceGroupVCRTestBase,
JMESPathCheck, NoneCheck)
TEST_DIR ... | {
"content_hash": "2bced1ea1ee3e1ab1721b7707e300d03",
"timestamp": "",
"source": "github",
"line_count": 732,
"max_line_length": 257,
"avg_line_length": 58.05874316939891,
"alnum_prop": 0.6278735970258124,
"repo_name": "samedder/azure-cli",
"id": "297e4014a3ab27e9dcc4bfb47eeb6bc95be597c0",
"size": "... |
from tensorflow.python import debug as tf_debug
import tensorflow as tf
from tensorflow.python.client import timeline
import numpy as np
tf.logging.set_verbosity(tf.logging.INFO)
x_train = np.random.rand(100000).astype(np.float32)
print(x_train)
noise = np.random.normal(scale=0.01, size=len(x_train))
y_train = x_t... | {
"content_hash": "35f1146b4ad3a90f026e0f2cc184c2cd",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 78,
"avg_line_length": 22.83582089552239,
"alnum_prop": 0.703921568627451,
"repo_name": "shareactorIO/pipeline",
"id": "612ae489a3f11badd4996983b17d20c35faa1e6a",
"size": "... |
"""
A two dimensional table having row and column headers.
"""
import copy
import h2o
from frame import _is_list_of_lists
class H2OTwoDimTable(object):
"""
A class representing an 2D table (for pretty printing output).
"""
def __init__(self, row_header=None, col_header=None, col_types=None,
tabl... | {
"content_hash": "11af5d4832fa1c993c1327ce2bd8aa9c",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 119,
"avg_line_length": 38.29545454545455,
"alnum_prop": 0.6498516320474778,
"repo_name": "madmax983/h2o-3",
"id": "53a013fb72b35448f41798d58dfbd239a788bfe2",
"size": "3370... |
"""Tests for aggregations."""
from __future__ import unicode_literals
import mock
from timesketch.lib.analyzers.similarity_scorer import SimilarityScorer
from timesketch.lib.analyzers.similarity_scorer import SimilarityScorerConfig
from timesketch.lib.testlib import BaseTest
from timesketch.lib.testlib import MockDat... | {
"content_hash": "2e1ab53fd43e897110430e4bdf5bfcfe",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 88,
"avg_line_length": 36.56,
"alnum_prop": 0.6422319474835886,
"repo_name": "google/timesketch",
"id": "255094457f8c701f7aadbe06f214fad0b712face",
"size": "2424",
"binar... |
import requests
import threading
from bs4 import BeautifulSoup
import Queue
from sys import argv
def formUrl(user_id, page):
return 'https://www.ratebeer.com/ajax/user/{0}/beer-ratings/{1}/5/'.format(user_id, page)
def getPagnination(soup):
try:
pages = int(soup.ul.findChildren()[-1]['href'].split('/')[-3])... | {
"content_hash": "e6191e6f558bfaf9b5f8a0e08723fb22",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 93,
"avg_line_length": 25.00943396226415,
"alnum_prop": 0.6589966050546964,
"repo_name": "gevurtz/beer-recommender",
"id": "63d729d33891c0cb1736aa7f7b428d4b751e6cb9",
"siz... |
from __future__ import unicode_literals
import math
import unittest
from nose.tools import *
from py_stringmatching.similarity_measure.soundex import Soundex
class SoundexTestCases(unittest.TestCase):
def setUp(self):
self.sdx = Soundex()
def test_valid_input_raw_score(self):
self.assertEqu... | {
"content_hash": "3398f7c876bd946a6cbf419d44a21163",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 80,
"avg_line_length": 36.980582524271846,
"alnum_prop": 0.6321869257022841,
"repo_name": "anhaidgroup/py_stringmatching",
"id": "e834aef8e2700f77af1a078611409bfefae0d4ed",
... |
from dateutil.parser import parse
import datetime
from pytz import timezone, UTC
import urllib
import urllib2
import cookielib
PROXY_FORMAT = '%Y-%m-%dT%H:%M:%S.%f%z'
def get_time_now():
"""
This will return the current UTC time, which will include UTC info
"""
return datetime.datetime.utcnow().repla... | {
"content_hash": "81a8a5d6f4d1cb28bc58d935f4980e89",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 70,
"avg_line_length": 25.11111111111111,
"alnum_prop": 0.6482300884955752,
"repo_name": "champs/lendingclub",
"id": "57dc47688c8afeb9fd2cec6b5d7db436c0530c73",
"size": "90... |
import copy
import json
import uuid
from django.conf import settings
from django.db import transaction
from django.db.models import Exists
from django.db.models import F
from django.db.models import OuterRef
from django.db.models import Q
from django.db.models import Subquery
from django_filters.rest_framework import ... | {
"content_hash": "3a458271089da931fa70e294a3e065c0",
"timestamp": "",
"source": "github",
"line_count": 494,
"max_line_length": 102,
"avg_line_length": 36.502024291497975,
"alnum_prop": 0.5944986690328306,
"repo_name": "DXCanas/content-curation",
"id": "53febd45740631432e69db071e370cc6f6a3c36d",
"s... |
print "Hello, World!"
| {
"content_hash": "21f3ef1b61e3df6600f4f5c474cf1509",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.6818181818181818,
"repo_name": "chicio/HackerRank",
"id": "687f563f030f613a6aa60405a0aff551e79c4cac",
"size": "169",
"binary": f... |
from short.backend.redis_backend import RedisBackend
backends = {
"redis": RedisBackend
}
def get_backend(name):
return backends[name]
| {
"content_hash": "97cb16666ee0a4db9474f3b66cf10b63",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 52,
"avg_line_length": 16.22222222222222,
"alnum_prop": 0.726027397260274,
"repo_name": "JuhaniImberg/short-piesome",
"id": "0a281f83969b011966fb82b505d57d9f79455abb",
"size... |
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
def get_search_object():
es_client = Elasticsearch()
search_object = Search(using=es_client, index="blog")
return search_object
def get_id_from_response(response):
id_list = []
for hit in response:
id_list.appen... | {
"content_hash": "b165eb2ee854a874468632b57253c6f5",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 70,
"avg_line_length": 28.1,
"alnum_prop": 0.6654804270462633,
"repo_name": "Prakash2403/Blog",
"id": "dbb6283a1b0b94afb2bffe902f27d5d0557368a2",
"size": "843",
"binary":... |
'''
Copyright (C) 2014 Parrot SA
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following di... | {
"content_hash": "334d90e04c7dc61d8822019ecc03b477",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 213,
"avg_line_length": 53.802919708029194,
"alnum_prop": 0.6163342830009497,
"repo_name": "149393437/ARSDKBuildUtils",
"id": "7df73ac33286e7733aa15ff40249cb23487390fb",
"... |
from django.template import Library
from ..forms import ContactForm
register = Library()
@register.assignment_tag(takes_context=True)
def get_contact_form(context):
return ContactForm(request=context.get('request'))
| {
"content_hash": "61e2b8bc8e4723ea68230b27ea5bf7c8",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 54,
"avg_line_length": 20.454545454545453,
"alnum_prop": 0.7733333333333333,
"repo_name": "caioariede/openimob",
"id": "bdc4550efdf6f9ebaed94fab5979884e3840ffcc",
"size": "... |
from builtins import str
import jaydebeapi
from airflow.hooks.dbapi_hook import DbApiHook
class JdbcHook(DbApiHook):
"""
General hook for jdbc db access.
JDBC URL, username and password will be taken from the predefined connection.
Note that the whole JDBC URL must be specified in the "host" field ... | {
"content_hash": "d1d338aa5dda237e409f9089676f99c1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 81,
"avg_line_length": 32.07142857142857,
"alnum_prop": 0.6109873793615441,
"repo_name": "RealImpactAnalytics/airflow",
"id": "8f0cd67c0c71cdd6b583fc3b2f50bd34e153ed74",
"s... |
from distutils.core import setup
setup(
name = 'richinput',
packages = ['richinput'],
version = '1.0.0',
description = 'Nonblocking text and password reader',
author = 'Riccardo Attilio Galli',
author_email = 'riccardo@sideralis.org',
url = 'https://github.com/riquito/richinput',
download_url = 'https:... | {
"content_hash": "d34a884bb5654d065d30722f4643cacd",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 89,
"avg_line_length": 37.04545454545455,
"alnum_prop": 0.6441717791411042,
"repo_name": "riquito/richinput",
"id": "3bb154b7013c44a4398b5ce56101b9ba44da75bb",
"size": "815... |
from django.db import models
from djes.models import Indexable
from elasticsearch_dsl import field
class ColorField(field.Object):
"""Just a sample custom field. In this case, a CharField that's formatted
something like "#FFDDEE"."""
def __init__(self, *args, **kwargs):
super(ColorField, self).... | {
"content_hash": "9d2f9ccc258940f295749d15d74ac4bc",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 85,
"avg_line_length": 22.36842105263158,
"alnum_prop": 0.6440641711229946,
"repo_name": "theonion/djes",
"id": "1352d3741f6da72104261d2ae0cdc4303f3d9513",
"size": "4675",... |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ct', '0002_auto_20141110_1820'),
]
operations = [
migrations.AlterField(
model_name='conceptlink',
name='relationship',
field=models.CharField(default='d... | {
"content_hash": "e642ce7cd5fafce3e6bf2f933265c6ce",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 460,
"avg_line_length": 47.0625,
"alnum_prop": 0.6069057104913679,
"repo_name": "cjlee112/socraticqs2",
"id": "84d0216fae9b5eb2cdae9ad2c7d9d12c213d9190",
"size": "753",
"... |
class AbstractLogger:
def __init__(self, log_level):
self.log_level = log_level
def log(self, message, severity):
raise NotImplementedError()
def debug(self, message):
raise NotImplementedError()
def info(self, message):
raise NotImplementedError()
def warn(self, message):
raise NotImplementedE... | {
"content_hash": "66e62091c2617966aeda46e95b7add3d",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 49,
"avg_line_length": 16.125,
"alnum_prop": 0.6666666666666666,
"repo_name": "sgibbons/longingly",
"id": "67e6be8166303ad4a3b1d522b2f4f30c600e9bae",
"size": "1291",
"bin... |
"""Utility functions supporting FAUCET/Gauge config parsing."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "Licens... | {
"content_hash": "69bbc23e602c3198c20f588dc084bf12",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 103,
"avg_line_length": 39.78431372549019,
"alnum_prop": 0.6521685559388861,
"repo_name": "mwutzke/faucet",
"id": "7ec0bb00c970bfe523473a28aab942b5597ceeb6",
"size": "8116... |
import os
from gunicorn.http import wsgi
# Used to configure gunicorn settings.
def build_header(name, value):
"""
Takes a header name and value and constructs a valid string to add to the headers list.
"""
stripped_value = value.lstrip(" ").rstrip("\r\n").rstrip("\n")
stripped_name = name.rstri... | {
"content_hash": "001dcb432ccfc6161581cb8749febbe7",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 92,
"avg_line_length": 33.23076923076923,
"alnum_prop": 0.6712962962962963,
"repo_name": "terranodo/eventkit-cloud",
"id": "715f552cce772eb09654bf70f4e1eacbeb4bde91",
"size... |
import datetime
import re
from warnings import (
catch_warnings,
simplefilter,
)
import numpy as np
import pytest
from pandas._libs.tslibs import Timestamp
from pandas.compat import is_platform_windows
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
_testing as tm,
bdat... | {
"content_hash": "7866e22378845b639b638d9dd1dbde3d",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 85,
"avg_line_length": 30.688288288288287,
"alnum_prop": 0.6031000469704086,
"repo_name": "pandas-dev/pandas",
"id": "ce71e9e99036423bbff108863bd48afd47b0bc23",
"size": "1... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
from subprocess import PIPE, Popen
from textwrap import dedent
from pants.fs.archive import ZIP
from pants.util.contextutil import temporary_dir
... | {
"content_hash": "afbe6f2ff525089d3d40b10eac279018",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 100,
"avg_line_length": 43.78341013824885,
"alnum_prop": 0.5970950426270919,
"repo_name": "kwlzn/pants",
"id": "770d1e71e262044a66d10c88f4b4a8492e527d73",
"size": "9648",
... |
import gnomekeyring as gkey
import argparse
parser = argparse.ArgumentParser(description='GNome Keyring Credentials Proxy')
parser.add_argument('-u',
dest='get_username',
action='store_const',
const=True,
default=False,
... | {
"content_hash": "6a49108bea6e8ad6e2f8ff6634df9e75",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 84,
"avg_line_length": 32.6144578313253,
"alnum_prop": 0.5895825637236793,
"repo_name": "derkling/dotfiles",
"id": "e39a916441df3b31a63e2e4598fbd4f33b30719a",
"size": "2731... |
from graphene.utils.str_converters import to_snake_case
from graphql import DirectiveLocation, GraphQLDirective
from ..registry import get_global_registry
class BaseExtraGraphQLDirective(GraphQLDirective):
def __init__(self):
registry = get_global_registry()
super(BaseExtraGraphQLDirective, self)... | {
"content_hash": "f54a7ea03a392f36358c461945cfbee9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 30.75,
"alnum_prop": 0.6178861788617886,
"repo_name": "eamigo86/graphene-django-extras",
"id": "6798999950489c381ce37c61911b6bd6e7af2eaa",
"size": "8... |
import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider import PaypalProvider
class PaypalOAuth2Adapter(OAuth2Adapter):
provider_id = PaypalProvider.id
supports_state = False
@property
def authorize_... | {
"content_hash": "737bf4b420e141bec5180c7b82434e04",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 71,
"avg_line_length": 30.6734693877551,
"alnum_prop": 0.6453759148369926,
"repo_name": "spool/django-allauth",
"id": "5e44e84c005d94067c2baa79610441f796c1c7e1",
"size": "1... |
from __future__ import absolute_import
import os
import tempfile
import unittest
import json
import six
from telemetry import project_config
from telemetry import decorators
from telemetry.core import util
from telemetry.internal.util import binary_manager
from telemetry.testing import run_tests
from telemetry.testin... | {
"content_hash": "8e9437b188a61158c69eedf156d52cd4",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 80,
"avg_line_length": 41.955,
"alnum_prop": 0.6519485162674293,
"repo_name": "catapult-project/catapult",
"id": "c6c7360a47360684100b8d4f3966accdfe48f2cf",
"size": "16945... |
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.standard import ProjectReport, ProjectReportParametersMixin, DatespanMixin
def div(num, denom, percent=False):
floater = 100.0 if percent else 1.0
val = num * floater / denom if denom != 0 else 0
return "%.2f" % val + ("... | {
"content_hash": "1f0862ad9bd8effaa020919b3f391111",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 106,
"avg_line_length": 40.63636363636363,
"alnum_prop": 0.5540641312453393,
"repo_name": "SEL-Columbia/commcare-hq",
"id": "07a87afb76dd532225eb47846b99993f54d9b243",
"siz... |
import sys
import pytest
import wx
from mock import MagicMock
from gooey.gui.lang import i18n
from gooey.gui.model import MyModel
from gooey.gui.presenter import Presenter
from gooey.gui.util.freeze import get_resource_path
from gooey.python_bindings import config_generator
@pytest.fixture
def build_s... | {
"content_hash": "d7b65f66ec1fb0597634d23dac708374",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 82,
"avg_line_length": 31.258426966292134,
"alnum_prop": 0.7286125089863408,
"repo_name": "jschultz/Gooey",
"id": "1bf17e7baadae4350f854be421815805a71acc9a",
"size": "2782"... |
import pyexiv2
import os
import Image
import time
import webbrowser
import sys
import gdata.gauth
import gdata.photos.service
import gdata.media
import gdata.geo
from picasaclient import PicasaClient
from pictureuploader import PictureUploader, FileWithCallback
import utils
SCOPES = "https://picasaweb.google.com/da... | {
"content_hash": "4933169b97dab94924f9f06b0e39b5a0",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 116,
"avg_line_length": 33.82539682539682,
"alnum_prop": 0.5631159080244017,
"repo_name": "hmrs-cr/PyArcPics",
"id": "cf02f5e1e8c03e8b628b46fa171c91cf3edec91f",
"size": "6... |
"""Tests for `models.py` (model cloning, mainly)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import os
from absl.testing import parameterized
import numpy as np
from tensorflow.python import keras
from tensorflow.python.eager impo... | {
"content_hash": "0dc605c7f61d6bb465587af2e87087fc",
"timestamp": "",
"source": "github",
"line_count": 560,
"max_line_length": 80,
"avg_line_length": 36.49107142857143,
"alnum_prop": 0.6601908490335209,
"repo_name": "petewarden/tensorflow",
"id": "12d1c39f100a65ecb7b879bdb6e8ec97449096e3",
"size":... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: newrelic_deployment
version_added: "1.2"
author: "Matt Codd... | {
"content_hash": "4bd286a84b9e67182ab077d926be5f43",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 138,
"avg_line_length": 30.401459854014597,
"alnum_prop": 0.6417767106842737,
"repo_name": "SergeyCherepanov/ansible",
"id": "4467bb7f0f54a687416bda0148f6a8759d6c19cd",
"s... |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
items = UnwrapElement(IN[0])
elementlist = list()
curvelist = list()
for item in items:
doc = item.Document
calculator = SpatialElementG... | {
"content_hash": "40686b7c0e5e3c65f983702aa53c40db",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 134,
"avg_line_length": 31.833333333333332,
"alnum_prop": 0.7943156320119671,
"repo_name": "CAAD-RWTH/ClockworkForDynamo",
"id": "a02785ec9876ce4828e2811dd6e73ce362a9452b",
... |
"""Test node responses to invalid transactions.
In this test we connect to one node over p2p, and test tx requests."""
from test_framework.blocktools import create_block, create_coinbase
from test_framework.messages import (
COIN,
COutPoint,
CTransaction,
CTxIn,
CTxOut,
)
from test_framework.p2p im... | {
"content_hash": "6462b817e01b385b62dfd3896c640fe4",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 113,
"avg_line_length": 45.708333333333336,
"alnum_prop": 0.6453965360072926,
"repo_name": "ElementsProject/elements",
"id": "fa12865c3def6d9fb39db42d54fa5ce4c4993942",
"s... |
"""
pyexcel_io.constants
~~~~~~~~~~~~~~~~~~~
Constants appeared in pyexcel
:copyright: (c) 2014-2017 by Onni Software Ltd.
:license: New BSD License
"""
# flake8: noqa
DEFAULT_NAME = 'pyexcel'
DEFAULT_SHEET_NAME = '%s_sheet1' % DEFAULT_NAME
MESSAGE_INVALID_PARAMETERS = "Invalid parameters"
MESSAG... | {
"content_hash": "093b2f685bb265d3f226e74409282e6d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 93,
"avg_line_length": 35.48837209302326,
"alnum_prop": 0.7208387942332897,
"repo_name": "fuhrysteve/pyexcel-io",
"id": "13c33fd1b533bdb6c60286a3ebaec46f7a8e5a77",
"size": ... |
"""
Faceted logistic regression
===========================
_thumb: .58, .5
"""
import seaborn as sns
sns.set(style="darkgrid")
# Load the example Titanic dataset
df = sns.load_dataset("titanic")
# Make a custom palette with gendered colors
pal = dict(male="#6495ED", female="#F08080")
# Show the survival probabilit... | {
"content_hash": "33c1ef74c127e85ef0b441d335100680",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 27.157894736842106,
"alnum_prop": 0.6317829457364341,
"repo_name": "petebachant/seaborn",
"id": "de6aafae387bdd2faad6e0d774c2270ce3a720fc",
"size": "... |
import os
import os.path
from setuptools import setup, find_packages
def get_package_data():
package_data = []
for root, dirnames, filenames in os.walk('./eva_cttv_pipeline/evidence_string_generation/resources'):
root = root.replace("./eva_cttv_pipeline/", "")
for filename in filenames:
... | {
"content_hash": "4e739b1588e8822bf7f2ded66cd6083b",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 105,
"avg_line_length": 30.916666666666668,
"alnum_prop": 0.6343216531895777,
"repo_name": "EBIvariation/eva-cttv-pipeline",
"id": "b5cc46db0d58d72bffae6162814ccef381faabd3",... |
from service import *
from jsonbuilder import *
from xmlbuilder import *
class ProductService(Service):
"""
This class represents the Product Service of the GittiGidiyor RESTLIKE API.
"""
def __init__(self, auth):
"""
Base Constructor. \n
auth = Auth(username = 'testuser', passw... | {
"content_hash": "41647997a00290167d2746a5aa133b1c",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 168,
"avg_line_length": 42.193548387096776,
"alnum_prop": 0.6276758409785933,
"repo_name": "Annelutfen/gittigidiyor-python",
"id": "a6f84ac48e715abe0afe52b9b21e5e1b64f5d628",... |
import collections
import idaapi
import idautils
import idc
import itertools
import struct
import inspect
_DEBUG_FILE = None
_DEBUG_PREFIX = ""
_INFO = idaapi.get_inf_structure()
# Map of the external functions names which does not return to a tuple containing information
# like the number of agruments and calling co... | {
"content_hash": "5f551bb3274de44a98c2a64802aba099",
"timestamp": "",
"source": "github",
"line_count": 793,
"max_line_length": 94,
"avg_line_length": 28.815889029003785,
"alnum_prop": 0.673405977856549,
"repo_name": "trailofbits/mcsema",
"id": "01c095d988e6ba3a7d03cd35c19d868199c5cfd7",
"size": "2... |
version = 14
print(version)
language = "python"
print(language)
# multiple declaration
name, age, day = "john", 25, "tuesday"
print(name, age, day)
# ValueError: too many values to unpack
# v1, v2 = "basics"
# multiple assignment
v1 = v2 = "basics"
print(v1, v2)
# data types: int, string, list, tuple, diction... | {
"content_hash": "a8a8a0b721d3238d581957950d9c7646",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 86,
"avg_line_length": 15,
"alnum_prop": 0.6695035460992907,
"repo_name": "juancarlosqr/datascience",
"id": "79db4e77e823e273cf3af58653ffc8fe443e7c4b",
"size": "1410",
"b... |
import os
from pathlib import Path
from .exceptions import CreateDirectoryException, MissingEnv
from redis import Redis
from redis.exceptions import ConnectionError
from datetime import datetime, timedelta
import time
import asyncio
from functools import lru_cache
def get_storage_path() -> Path:
if not os.environ... | {
"content_hash": "d81c170870c9650ea85eae6c358940e9",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 112,
"avg_line_length": 33.06542056074766,
"alnum_prop": 0.637648388920294,
"repo_name": "Rafiot/uwhoisd",
"id": "31544a673df7ab695d6ad37da7af61710d4c4682",
"size": "3585"... |
from django.test import TestCase
from django.conf import settings
from datetime import datetime, timedelta
from restclients.sws import SWS, encode_section_label, get_resource
from restclients.models.sws import Term, Curriculum, Person, College, Department
from restclients.exceptions import DataFailureException
from res... | {
"content_hash": "190fd23a72280573912f46b954dd9697",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 704,
"avg_line_length": 50.08771929824562,
"alnum_prop": 0.6348511383537653,
"repo_name": "uw-it-aca/uw-restclients",
"id": "a21855de93b0d1fa8073261b32148a1c3411ba5a",
"si... |
import sys
import marshal
import types
from sonLib.bioio import system
import importlib
class Target(object):
"""Each job wrapper extends this class.
"""
def __init__(self, time=sys.maxint, memory=sys.maxint, cpu=sys.maxint):
"""This method must be called by any overiding constructor.
... | {
"content_hash": "0999efe4c4f834842f2755a6a06c37d2",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 129,
"avg_line_length": 38.16571428571429,
"alnum_prop": 0.6300344362928582,
"repo_name": "cooketho/jobTree",
"id": "2d9afd55ea8338a6cf2584b7057f2f92143cfcbd",
"size": "78... |
from unittest.mock import Mock, patch
from django.test import RequestFactory, SimpleTestCase
from core.tests.utils import TemplateTagsTest
class IsCurrentUrlTagTest(TemplateTagsTest, SimpleTestCase):
""" """
def setUp(self):
# Every test needs access to the request factory.
self.request = R... | {
"content_hash": "f701876206e1f9a46eb2d2d01ada5bd5",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 79,
"avg_line_length": 36.982608695652175,
"alnum_prop": 0.5898189513284741,
"repo_name": "srtab/alexandriadocs",
"id": "a0d3cc4b94044f56a24ee67e1f6ebd7efec844d7",
"size":... |
import os
import unittest
from tempest.test_discover import plugins
def load_tests(loader, tests, pattern):
ext_plugins = plugins.TempestTestPluginManager()
suite = unittest.TestSuite()
base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
base_path = os.path.split(base_path)[0]
... | {
"content_hash": "259d10d6ed34d04ba852f6d0ef85e4a5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 77,
"avg_line_length": 36.82857142857143,
"alnum_prop": 0.5989138867339022,
"repo_name": "openstack/tempest",
"id": "a19f20b696ae98622c93a25e823e3e945c95719b",
"size": "189... |
from flask import Blueprint, g
from flask_restful import Api, Resource
from flask.ext.restful import abort, fields, marshal_with, reqparse
from app import db
from app.auth.models import Permission, User
from app.base.decorators import login_required
auth_bp = Blueprint('auth_api', __name__)
api = Api(auth_bp)
perm... | {
"content_hash": "392ca2014313fc70cd3caf1085a2073d",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 72,
"avg_line_length": 28.33076923076923,
"alnum_prop": 0.626934564213956,
"repo_name": "bmbove/flask-api-boilerplate",
"id": "75c2152a052964828d299943d20a9bba7e99ec05",
"... |
"""
Just a quick test to make sure there's no ``cls`` or ``self`` odness.
"""
from __future__ import print_function
import sys
import time
from yamicache import Cache
c = Cache(prefix="myapp", hashing=False, debug=False)
@c.cached()
def my_func(argument, power):
"""running my_func"""
return argument ** power... | {
"content_hash": "b71af69fabc4d3d16599972e370597fc",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 69,
"avg_line_length": 20.954545454545453,
"alnum_prop": 0.5929139551699205,
"repo_name": "mtik00/yamicache",
"id": "c7c4cc51b481a1ae156a149562a1faf2c7a1a20e",
"size": "138... |
from netCDF4 import Dataset
import netCDF4
import os
from Volume import Volume
#from Ray import Ray
from Sweep import Sweep
from numpy import *
from pylab import *
class CfRadial:
"""
A class for reading and parsing netCDF file.
Parameters
----------
filename : string
The file name with f... | {
"content_hash": "dbe54f82cafe6af68a282053e56d48ae",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 135,
"avg_line_length": 33.88145896656535,
"alnum_prop": 0.5598815824885619,
"repo_name": "ncareol/lrose-soloPy",
"id": "c0a0484eec48602a7a5885d9a0009fd31b048a0e",
"size":... |
from .MasirApp import MasirApp
| {
"content_hash": "924502ee180600037136083d5a8de79c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 30,
"avg_line_length": 31,
"alnum_prop": 0.8387096774193549,
"repo_name": "anguoyang/SMQTK",
"id": "a96e56816c744a339ab61ee125abe65de8705a68",
"size": "32",
"binary": fals... |
from fluent_contents.extensions import ContentPlugin, plugin_pool
from models import PromoPluginModel
from forms import PromoForm
from django.utils.translation import ugettext as _
@plugin_pool.register
class PromoPlugin(ContentPlugin):
model = PromoPluginModel # Model where data about this plugin is saved
ca... | {
"content_hash": "ed3e77c9fc5a50a9f45a228829ea2bc6",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 114,
"avg_line_length": 33.285714285714285,
"alnum_prop": 0.5912017167381974,
"repo_name": "Excentrics/publication-backbone",
"id": "ae8809fc32a009e7244136761ffef6c8a6c91479"... |
"""
Copyright 2016 Fedele Mantuano (https://twitter.com/fedelemantuano)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable... | {
"content_hash": "7cd6bf0edc7421237f23ecf8ad58f20a",
"timestamp": "",
"source": "github",
"line_count": 587,
"max_line_length": 79,
"avg_line_length": 28.061328790459967,
"alnum_prop": 0.5994414764448761,
"repo_name": "SpamScope/mail-parser",
"id": "b25fa34d84f72931fa4d0676f21d6509389d687d",
"size"... |
"""
Test directory for ensuring working Forseti library
"""
| {
"content_hash": "a14e0be1d8ec5b213e516305b41a2c5b",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 51,
"avg_line_length": 20,
"alnum_prop": 0.75,
"repo_name": "MasterOdin/forseti",
"id": "8441bfc790fba04dbf9c58239a5e6a9ded7e50b3",
"size": "60",
"binary": false,
"copie... |
import os
import numpy as np
import nibabel as nib
from nilabels.tools.detections.check_imperfections import check_missing_labels
from nilabels.tools.aux_methods.label_descriptor_manager import LabelsDescriptorManager
from tests.tools.decorators_tools import pfo_tmp_test, \
write_and_erase_temporary_folder_with_d... | {
"content_hash": "105b93334a492e2ce6c4e9f01142ca3d",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 111,
"avg_line_length": 35.30952380952381,
"alnum_prop": 0.7120701281186783,
"repo_name": "SebastianoF/LabelsManager",
"id": "95b49d012102185b16eb3c9bd32d6e5516821912",
"si... |
import argparse
import json
import os
import netaddr
PART = 'RPC'
PREFIX_NAME = 'RPC'
SNAT_POOL = (
'### CREATE SNATPOOL ###\n'
'create ltm snatpool /' + PART + '/' + PREFIX_NAME + '_SNATPOOL { members replace-all-with {'
' %(snat_pool_addresses)s } }'
)
#Persistance Profile:
PERSISTANCE = [
r'crea... | {
"content_hash": "c684ecaba670f941e995130b615724b4",
"timestamp": "",
"source": "github",
"line_count": 735,
"max_line_length": 222,
"avg_line_length": 35.30340136054422,
"alnum_prop": 0.5109449668567905,
"repo_name": "byronmccollum/rpc-openstack",
"id": "30737347758c0a9843210025506bd53cd9f4e7d8",
... |
"""
[2017-04-14] Challenge #310 [Hard] The Guards and the Mansion
https://www.reddit.com/r/dailyprogrammer/comments/65fkwh/20170414_challenge_310_hard_the_guards_and_the/
# Description
I recently came into some money and built myself a mansion. And I'm afraid of robbers who now want to come and steal
the rest of my m... | {
"content_hash": "d52f5a28eba410cdf7406db3ce00b082",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 119,
"avg_line_length": 36.592592592592595,
"alnum_prop": 0.7074898785425101,
"repo_name": "DayGitH/Python-Challenges",
"id": "98768a3d28dade67c67deea62face46e180bbaf5",
"s... |
import json
import re
import sys
from sandpiper.concurrency import KeyLocker
try:
import redis
except ImportError as e:
raise ImportError('Failed to import "redis" ({})'.format(e))
from .abstract import Abstract
from .abstract import NonJSONStringError, SearchError
import logging
require_backward_compatibi... | {
"content_hash": "222a54b83ede79fc1a2c2c9d2915c2cf",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 103,
"avg_line_length": 28.274074074074075,
"alnum_prop": 0.5889441970133613,
"repo_name": "shiroyuki/sandpiper",
"id": "a0e56d67ee509b9f04ec6dbd625690f99de76efc",
"size":... |
"""Unit tests for reviewboard.diffviewer.views.DownloadPatchErrorBundleView."""
import kgb
from django.http import HttpResponse
from reviewboard.diffviewer.errors import PatchError
from reviewboard.diffviewer.renderers import DiffRenderer
from reviewboard.site.urlresolvers import local_site_reverse
from reviewboard.t... | {
"content_hash": "9513abe3f771fb17afaedb2ea7f0c3dc",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 41.070422535211264,
"alnum_prop": 0.5847050754458162,
"repo_name": "reviewboard/reviewboard",
"id": "83385d43ebddbc7b3a1e9544a06334f85523fa4c",
"size... |
from __future__ import unicode_literals
from django.db import migrations, models
from django.utils.text import slugify
def gen_unique_slug(apps, schema_editor):
FrequentlyAskedQuestion = apps.get_model('cms', 'FrequentlyAskedQuestion')
for row in FrequentlyAskedQuestion.objects.all():
if not row.slu... | {
"content_hash": "da162cc970955d3570a6bd30de366eaa",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 96,
"avg_line_length": 35.723404255319146,
"alnum_prop": 0.6057176891006552,
"repo_name": "mitodl/micromasters",
"id": "f7d8057df654835aa9a261ffb322b58aebcdebe7",
"size": "... |
"""
"""
import sys, os
sys.path.append('..')
from mendeley import API
def test_definitions():
m = API(user_name='public')
academic_statuses = m.definitions.academic_statuses()
print('Retrieved academic statuses')
subject_areas = m.definitions.subject_areas()
print('Retrieved subject are... | {
"content_hash": "02de9c07e17beaef90ae9af2bc792433",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 57,
"avg_line_length": 20.88888888888889,
"alnum_prop": 0.6578014184397163,
"repo_name": "JimHokanson/mendeley_python",
"id": "b1e07cebed5b0cb78d31ac9c0866781eaf83a9e3",
"s... |
__revision__ = "test/MSVS/vs-14.0Exp-exec.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
"""
Test that we can actually build a simple program using our generated
Visual Studio 14.0 project (.vcxproj) and solution (.sln) files
using Visual C++ 14.0 Express edition.
"""
import os
import sys
import TestSC... | {
"content_hash": "281858b9377144419577379ff5b23c2f",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 102,
"avg_line_length": 25.458823529411763,
"alnum_prop": 0.6617375231053605,
"repo_name": "EmanueleCannizzaro/scons",
"id": "f933d07f48dc676a63c32c5297b48dcd17e3061c",
"si... |
"""momentsinfo_convroll4_doublescale_fs5"""
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
batch_size = 128
chunk_size = 32768
num_chunks_train = 240
momentum = 0.9
learning_rate_schedule = {
... | {
"content_hash": "e74135245005fd67549b2d134c76dad1",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 148,
"avg_line_length": 30.74418604651163,
"alnum_prop": 0.6993192133131618,
"repo_name": "benanne/kaggle-ndsb",
"id": "8ae1efe4eb3cddf0328681be496b884bceaff620",
"size": "... |
from os.path import join, dirname
PROJECT_ROOT = dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'data.db' ... | {
"content_hash": "5223e64cc7caa00711a5c687c37681bb",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 108,
"avg_line_length": 34.29761904761905,
"alnum_prop": 0.7056577577230129,
"repo_name": "jjdelc/django-ip-nongratae",
"id": "9f88080c0a86fea277fd6294d84e8ecffe95b318",
"s... |
import datetime
import random
import time
import glanceclient.exc
from nova import context
from nova import exception
from nova.image import glance
from nova import test
from nova.tests.api.openstack import fakes
from nova.tests.glance import stubs as glance_stubs
from nova.tests import matchers
class NullWriter(ob... | {
"content_hash": "0a02a164308d473f950be768afbbd542",
"timestamp": "",
"source": "github",
"line_count": 687,
"max_line_length": 79,
"avg_line_length": 36.65793304221252,
"alnum_prop": 0.5516597839898348,
"repo_name": "aristanetworks/arista-ovs-nova",
"id": "e8baf4353bf9a34f40d87108ddf843a53fd9a019",
... |
"""Test various command line arguments and configuration file parameters."""
import json
from pathlib import Path
from test_framework.test_framework import BitcoinTestFramework
from test_framework.test_node import ErrorMatch
from test_framework.util import assert_equal
class SettingsTest(BitcoinTestFramework):
... | {
"content_hash": "3280a657c01d28901a3325b8b33390ab",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 140,
"avg_line_length": 41.264367816091955,
"alnum_prop": 0.6050139275766017,
"repo_name": "particl/particl-core",
"id": "4f1472569fe2b7d043260ef4d6646a4cfadcba13",
"size":... |
import sys
import os
saved_path = sys.path.copy()
path = os.path.join(os.path.dirname(__file__), 'lib_cast_upgrade_1_5_20.zip')
sys.path.append(path)
from lib_cast_upgrade_1_5_20.internal.upgrader import apply_patch #@UnresolvedImport
apply_patch('1.5.20')
| {
"content_hash": "332f369dcd610b25640fe31e1a2a28fd",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 84,
"avg_line_length": 19.357142857142858,
"alnum_prop": 0.7011070110701108,
"repo_name": "CAST-Extend/com.castsoftware.uc.checkanalysiscompleteness",
"id": "748b36399df1ec83... |
"""
Functional test
Mistake Epic
Storyboard is defined within the comments of the program itself
"""
import unittest
from flask import url_for
from biblib.tests.stubdata.stub_data import UserShop, LibraryShop
from biblib.tests.base import TestCaseDatabase, MockEmailService
from biblib.views import DEFAULT_LIBRARY_NA... | {
"content_hash": "0af44164aaf38f6ad8d916f4235652aa",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 81,
"avg_line_length": 36.5859872611465,
"alnum_prop": 0.5788649025069638,
"repo_name": "adsabs/biblib-service",
"id": "44ac572270bf31a49c1c60e21e1cf343a12c2987",
"size": ... |
from __future__ import print_function
import Pyro4.core
import Pyro4.naming
import banks
with Pyro4.core.Daemon() as daemon:
with Pyro4.naming.locateNS() as ns:
uri = daemon.register(banks.Rabobank)
ns.register("example.banks.rabobank", uri)
uri = daemon.register(banks.ABN)
ns.regis... | {
"content_hash": "fff1997c79d16004e9017933a3bea763",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 60,
"avg_line_length": 32.05882352941177,
"alnum_prop": 0.6678899082568808,
"repo_name": "irmen/Pyro4",
"id": "9df02dce984311b49cb89b4a63adfd66e5349ee8",
"size": "571",
"... |
""" Util tests
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2016-08-20
:Copyright: 2016-2018, Karr Lab
:License: MIT
"""
from wc_utils.util.types import assert_value_equal, assert_value_not_equal, cast_to_builtins, is_iterable, get_subclasses, get_superclasses, TypesUtilAssertionError
import numpy as np
import unitt... | {
"content_hash": "4a9991c5cd5c6598d0de84540bf26d21",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 164,
"avg_line_length": 32.62643678160919,
"alnum_prop": 0.5973225295050203,
"repo_name": "KarrLab/wc_utils",
"id": "e874a4d03919267c1616a29dddab09c67f202318",
"size": "56... |
from ..translation import gettext_lazy as _
class ErrorChoicesMixin(object):
IMPORT_DATA = 0
UNDEFINED = 1
STEP_CHOICES = (
(IMPORT_DATA, _('import data')),
(UNDEFINED, _('unexpected error'))
)
| {
"content_hash": "5fb28737dcca0a711dc84127356bdb4d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 43,
"avg_line_length": 20.818181818181817,
"alnum_prop": 0.6026200873362445,
"repo_name": "mtrgroup/django-mtr-sync",
"id": "52f24001c3a7495d316d003495a721a323fd877f",
"siz... |
"""Revision management for django-reversion."""
from __future__ import unicode_literals
import operator, warnings
from functools import wraps, reduce, partial
from threading import local
from weakref import WeakValueDictionary
import copy
from collections import defaultdict
from django.apps import apps
from django.c... | {
"content_hash": "1a3d26c38f31d8bc679202b895b9ebce",
"timestamp": "",
"source": "github",
"line_count": 667,
"max_line_length": 137,
"avg_line_length": 40.82908545727136,
"alnum_prop": 0.6108397899607094,
"repo_name": "ixc/django-reversion",
"id": "fd2c052a9fe39dfcdf699f0bb33dddc5c95ceb8d",
"size":... |
class HDCloudException(Exception):
def __init__(self, code, message=None, details=None):
self.code = code
self.msg = message or self.__class__.__name__
self.details = details
def __str__(self):
return "%s (HTTP %s)" % (self.msg, self.code)
_code_map = dict((c.http_statu... | {
"content_hash": "3c816f331b67b4fcb719434b2dbe4b94",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 79,
"avg_line_length": 31.925925925925927,
"alnum_prop": 0.6032482598607889,
"repo_name": "jacobian-archive/python-hdcloud",
"id": "142bc41fc361c644a53c2e21fbec9f05c47490d3",... |
from __future__ import absolute_import, division, print_function
from functools import partial
from itertools import product
import numpy as np
from toolz import curry
from ..base import tokenize
from .core import Array, normalize_chunks
from .numpy_compat import full
def dims_from_size(size, blocksize):
"""
... | {
"content_hash": "4263584dadf9077e457706a0310412ea",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 82,
"avg_line_length": 25.860759493670887,
"alnum_prop": 0.6172295643661282,
"repo_name": "jeffery-do/Vizdoombot",
"id": "15de4a4e614792d86d0b8848a30e83b137617a41",
"size":... |
"""xblog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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='home')
Class-base... | {
"content_hash": "f74c39f6939c1bb30c6034b9ace5c6b0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 79,
"avg_line_length": 37.64,
"alnum_prop": 0.6886291179596175,
"repo_name": "yuchou/xblog",
"id": "abbcd06e185528621ab7ada879a5d9785df9be74",
"size": "941",
"binary": fa... |
from django.db import models
from django.utils import timezone
from django.utils.text import slugify
from django.conf import settings
from autoslug import AutoSlugField
from django.core.urlresolvers import reverse
from django.db.models import Sum, Max
import json, uuid
class Charity(models.Model):
name = models.C... | {
"content_hash": "75ece8dbe8c0cbaaebae05a6f1df06fc",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 118,
"avg_line_length": 31.30635838150289,
"alnum_prop": 0.6183530280649926,
"repo_name": "toast38coza/FlashGiving",
"id": "f9801455237384dcd916794d91dec822b0aa25f6",
"siz... |
from baselines.common.cmd_util import make_mujoco_env, mujoco_arg_parser
from baselines.common import tf_util as U
from baselines import logger
def train(env_id, num_timesteps, seed):
from baselines.ppo1 import mlp_policy, pposgd_simple
U.make_session(num_cpu=1).__enter__()
def policy_fn(name, ob_space, ac... | {
"content_hash": "fdd8637a7ea1d14ad180cd6c201c9d57",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 84,
"avg_line_length": 37.074074074074076,
"alnum_prop": 0.6473526473526473,
"repo_name": "dsbrown1331/CoRL2019-DREX",
"id": "638998316b397ede6e945886f7566f806415101a",
"si... |
X = 11 # Global (module) name/attribute (X, or manynames.X)
def f():
print(X) # Access global X (11)
def g():
X = 22 # Local (function) variable (X, hides module X)
print(X)
class C:
X = 33 # Class attribute (C.X)
def m(sel... | {
"content_hash": "c85248737f633a0d5416de371bb0a5bf",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 81,
"avg_line_length": 37.4,
"alnum_prop": 0.45276292335115864,
"repo_name": "dreadrel/UWF_2014_spring_COP3990C-2507",
"id": "9676a3051978d90e2f4519d8776c30ccb0d50420",
"si... |
from distutils.core import setup, Extension
from pythran.dist import PythranExtension, PythranBuildExt
setup(name = 'demo2',
version = '1.0',
description = 'This is another demo package',
packages = ['demo2'],
cmdclass={"build_ext": PythranBuildExt},
ext_modules = [PythranExtension('demo2... | {
"content_hash": "f8eda8099f63733c3f24ee1a53215e09",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 38.55555555555556,
"alnum_prop": 0.6714697406340058,
"repo_name": "serge-sans-paille/pythran",
"id": "159ef9479639a4397ff86f6f8a2edfd2183d7489",
"size... |
"""
工具类
Created on 03/01/2016
@author: Wen Gu
@contact: emptyset110@gmail.com
"""
import requests
import asyncio
import math
import time
from datetime import datetime
import pandas
import os
import ntplib
from pandas import DataFrame
import re
import json
import logging
def camel_to_underscore(name):
pass
def g... | {
"content_hash": "44f9f2d52a97e091453eb6d4c0b902bc",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 79,
"avg_line_length": 26.515503875968992,
"alnum_prop": 0.5700920917994445,
"repo_name": "Emptyset110/SinaL2",
"id": "064693874dab68d242d1b4916a2e1d59ddb0bfcb",
"size": "... |
"""This file should be updated as files/classes/functions are deprecated."""
import pytest
from praw.util import _deprecate_args
from .. import UnitTest
@_deprecate_args("arg2", "arg1", "arg3", "arg0")
def arg_test_global(*, arg0=None, arg1=None, arg2=None, arg3=None):
return arg0, arg1, arg2, arg3
@_deprecat... | {
"content_hash": "22fc0a1091e1d93223db1d803ac8f7e2",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 88,
"avg_line_length": 40.80930232558139,
"alnum_prop": 0.5741964896284477,
"repo_name": "praw-dev/praw",
"id": "650c3edc5eaaaf3a1a20c8f92ae6027d241fbf1d",
"size": "8774",... |
def printlist(head):
print head.val
while head.next:
head = head.next
print head.val
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def removeNthFromEnd(self, head, n):
... | {
"content_hash": "a3453d537ae3f6b7eacd864a531499ff",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 47,
"avg_line_length": 21.73469387755102,
"alnum_prop": 0.5098591549295775,
"repo_name": "zongtongyi/leetcode",
"id": "d2853ea57f56f3828553071065c7641dd8014044",
"size": "1... |
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.utils.dates import days_ago
DAG_NAME = 'dag-to-trigger'
args = {'owner': 'airflow', 'start_date': days_ago(1), 'schedule_interval': "None"}
with DAG(dag_id=DAG_NAME, default_args=args) as dag:
dag_task = DummyOperato... | {
"content_hash": "328991d6c3bc7dbed3bde13c4d1e2095",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 83,
"avg_line_length": 28.714285714285715,
"alnum_prop": 0.7114427860696517,
"repo_name": "GoogleCloudPlatform/python-docs-samples",
"id": "81883e51757c25c63cb8a669da7cbcaa6e... |
import os
from os.path import join, basename
from cmsis_svd.model import SVDDevice
import site
import json
import re
def formatNamespace(input):
r = re.compile('[^a-zA-Z0-9_]')
from operator import add
from functools import reduce
return reduce(add, map(lambda s: s.capitalize(), r.sub('',input).lower... | {
"content_hash": "0f6d063d462a7753dab3a962a92ed9ea",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 153,
"avg_line_length": 32.42758620689655,
"alnum_prop": 0.5920884729902169,
"repo_name": "porkybrain/Kvasir",
"id": "56e0a722a8808db8277be7e5b090fb1e5b0fb227",
"size": "4... |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="family", parent_name="bar.outsidetextfont", **kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=plotly_name,
parent_name=... | {
"content_hash": "fe59ab6573092aec23a30455b78b8b08",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 79,
"avg_line_length": 36.11764705882353,
"alnum_prop": 0.5798045602605864,
"repo_name": "plotly/python-api",
"id": "b781cdb6269881a0744b7287b8e2d7ff71c3216c",
"size": "614... |
from unittest.mock import patch
import pytest
from parameterized import parameterized
from airflow.models.dag import DAG
from airflow.sensors.date_time import DateTimeSensor
from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2015, 1, 1)
class TestDateTimeSensor:
@classmethod
def setup_clas... | {
"content_hash": "88e520f648f76f0adc8caf61b5c387c9",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 83,
"avg_line_length": 30.951612903225808,
"alnum_prop": 0.5648775403856175,
"repo_name": "airbnb/airflow",
"id": "f2011899fdcdfbef4bd8805e071e9bcb2b44e342",
"size": "2706"... |
"""
A lightweight Traits like module.
This is designed to provide a lightweight, simple, pure Python version of
many of the capabilities of enthought.traits. This includes:
* Validation
* Type specification with defaults
* Static and dynamic notification
* Basic predefined types
* An API that is similar to enthought... | {
"content_hash": "e30a1cbc5757cae30808a9091c691c87",
"timestamp": "",
"source": "github",
"line_count": 1437,
"max_line_length": 111,
"avg_line_length": 32.920668058455114,
"alnum_prop": 0.560191937768195,
"repo_name": "Carreau/IPConfigurable",
"id": "c6add7d1ce92a5917bfda15b76467598318f0a37",
"siz... |
import json
from tempodb.temporal.validate import convert_iso_stamp, check_time_param
from cursor import DataPointCursor, SeriesCursor, SingleValueCursor
class JSONSerializable(object):
"""Base class for objects that are serializable to and from JSON.
This class defines default methods for serializing each wa... | {
"content_hash": "b54ed8237111197e5576320395b08781",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 79,
"avg_line_length": 34.50844277673546,
"alnum_prop": 0.5959876039797749,
"repo_name": "tempodb/tempodb-python",
"id": "5ec686bd05141264d92d39336ffafc77b5064e46",
"size"... |
"""
The module ``search`` provides glob paths to search for content in a HDF5 file.
===============================================================================
Overview
===============================================================================
The module implements a strategy similar to Python's |glob|_ modul... | {
"content_hash": "acf323c28d83cce0b7f09fec9d688368",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 101,
"avg_line_length": 34.80444444444444,
"alnum_prop": 0.5404162942152981,
"repo_name": "DudLab/nanshe",
"id": "f176c4239fd2293854c06e625d4b19050a723d4d",
"size": "7831"... |
r"""
Punkt Sentence Tokenizer
This tokenizer divides a text into a list of sentences,
by using an unsupervised algorithm to build a model for abbreviation
words, collocations, and words that start sentences. It must be
trained on a large collection of plaintext in the target language
before it can be used.
The NLTK ... | {
"content_hash": "9c360249120b294e2a797c6644b38cdc",
"timestamp": "",
"source": "github",
"line_count": 1592,
"max_line_length": 118,
"avg_line_length": 38.391331658291456,
"alnum_prop": 0.5557682553706703,
"repo_name": "laiy/Database_Project",
"id": "27006612f85b4dfb1c973ca24d0030711ef4fc97",
"siz... |
factor0 = 6
factor1 = 7
answer = factor0 * factor1
print answer
| {
"content_hash": "4239dad99cdff7ac0a2542c57c7cfcb3",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 26,
"avg_line_length": 16,
"alnum_prop": 0.734375,
"repo_name": "nathano/Perl_to_Python_Converter",
"id": "946fc9224a49be056d87c6d5a0ee1a871c551582",
"size": "88",
"binary... |
import os
import sys
import copy
import json
import socket
import logging
from threading import local
from collections import OrderedDict
from contextlib import contextmanager
class SwagFormatter(logging.Formatter):
def __init__(self, swaglogger):
logging.Formatter.__init__(self, None, '%a %b %d %H:%M:%S %Z %Y')... | {
"content_hash": "49e7f8478e5966917da1ba348179587f",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 71,
"avg_line_length": 26.83582089552239,
"alnum_prop": 0.6351501668520578,
"repo_name": "heidecjj/openpilot",
"id": "2f1218452184db034043470df672d311215b107f",
"size": "3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.