text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0005_auto_20151129_0421'),
]
operations = [
migrations.AlterField(
model_name='band',
name='assigned_members',
... | {
"content_hash": "ec2fef5caa508c35b4b8ecc22c822201",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 134,
"avg_line_length": 26.11111111111111,
"alnum_prop": 0.6297872340425532,
"repo_name": "KonichiwaKen/band-dashboard",
"id": "03c4eab55423fc2b1811d110f321f6b55eca8c52",
"... |
"""Wrappers for protocol buffer enum types."""
import enum
class Likelihood(enum.IntEnum):
"""
A bucketized representation of likelihood, which is intended to give clients
highly stable results across model upgrades.
Attributes:
UNKNOWN (int): Unknown likelihood.
VERY_UNLIKELY (int): It ... | {
"content_hash": "a9ba3f7aa276af27408a3a12af5a0197",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 104,
"avg_line_length": 37.62735849056604,
"alnum_prop": 0.5715181145794158,
"repo_name": "dhermes/google-cloud-python",
"id": "509e00fec15d1833e45f3ec9b01d8dd7ff3901fc",
... |
from flask import Flask
from flask import request
from os import popen
app = Flask(__name__)
@app.route('/')
def main_form():
data = popen('fortune').read()
return '<h1><blockquote><tt>{}</tt></blockquote></h1>'.format(data.replace('--', '<p>--'))
if __name__ == '__main__':
app.run()
| {
"content_hash": "514c2dd5eb7537104858d6f75afd1b88",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 94,
"avg_line_length": 20.133333333333333,
"alnum_prop": 0.5894039735099338,
"repo_name": "talapus/Ophidian",
"id": "9ae8837513f3411f5cec566919584f1235dfdd0f",
"size": "302... |
from __future__ import unicode_literals
from django.test import TestCase, override_settings
from rest_framework.settings import APISettings, api_settings
class TestSettings(TestCase):
def test_import_error_message_maintained(self):
"""
Make sure import errors are captured and raised sensibly.
... | {
"content_hash": "55d644fdd9e6e8470c5869c3d2f208e6",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 88,
"avg_line_length": 33.559322033898304,
"alnum_prop": 0.6368686868686869,
"repo_name": "kgeorgy/django-rest-framework",
"id": "51e9751b25da0c70d1928c24231bb46ee5fd6007",
... |
from rest_framework.serializers import Serializer, ModelSerializer, ValidationError
from .models import Activity, Location, Sleep
class BaseSerializer(Serializer):
"""
Base Serializer
"""
def validate(self, data):
if data['time_start'] >= data['time_end']:
raise ValidationError('... | {
"content_hash": "e52e2624f3265f4b7319905dba0d7595",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 83,
"avg_line_length": 21.725490196078432,
"alnum_prop": 0.5812274368231047,
"repo_name": "PEKTOP/metrics-api",
"id": "387a423cf986032004e8be6b4427640b61106ed1",
"size": "1... |
import spotipy.core.baseplaylist
import os
import mimetypes
class LocalPlayList(spotipy.core.baseplaylist.BasePlayList):
def __init__(self, wrapper, d, name = None):
spotipy.core.baseplaylist.BasePlayList.__init__(self, wrapper)
self.__local_dir = d
self.__name = name
def get_name(self... | {
"content_hash": "a9f76b33e95640d59a96787d704b4dab",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 91,
"avg_line_length": 33.484848484848484,
"alnum_prop": 0.5321266968325792,
"repo_name": "ZenHarbinger/spotipy",
"id": "1a0cb9d8dad50e243ae7633ad3676b132c9cf270",
"size": ... |
"""
This is an example dag for an Amazon EMR on EKS Spark job.
"""
import os
from datetime import datetime, timedelta
from airflow import DAG
from airflow.providers.amazon.aws.operators.emr import EmrContainerOperator
# [START howto_operator_emr_eks_env_variables]
VIRTUAL_CLUSTER_ID = os.getenv("VIRTUAL_CLUSTER_ID", ... | {
"content_hash": "14710a066826c7250273a897175c5950",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 175,
"avg_line_length": 34.90769230769231,
"alnum_prop": 0.6584398413397973,
"repo_name": "bolkedebruin/airflow",
"id": "11c1c5b5f6ffae1b165d4a498ec0093fbe73ea01",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('domain_api', '0006_auto_20170329_0320'),
]
operations = [
migrations.RenameField(
model_name='registereddomain',
old_name='anniversa... | {
"content_hash": "25108ce472cb1b9101c7ed34fe7c6a28",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 60,
"avg_line_length": 25.652173913043477,
"alnum_prop": 0.6016949152542372,
"repo_name": "heytrav/drs-project",
"id": "2a0c3cdb183f8de13f255cde68125de0c180df23",
"size": "... |
"""Show the status of a mel repository.
This idea is to show you active concerns and what you can do about them, with
executable examples.
This is meant to be similar in usage to 'git status', or perhaps 'ls'. Answers
the question 'What's happening here, and what shall I do next?'.
"""
# There are a few things to va... | {
"content_hash": "c8fe33ec74370ef0c889351b96f4d06a",
"timestamp": "",
"source": "github",
"line_count": 660,
"max_line_length": 79,
"avg_line_length": 31.006060606060608,
"alnum_prop": 0.5625488663017982,
"repo_name": "aevri/mel",
"id": "379674da737f7d46f32489402b8c2e7a28242494",
"size": "20464",
... |
from __future__ import division
import numpy as np
from util import as_row, as_col
def noise(d, variance=1.0):
m = np.zeros_like(d)
m[d == 0.0] = variance
return m
def constant(d, variance):
return variance * np.ones_like(d)
def grad_constant(d, variance):
return {'variance': np.ones_like(d)... | {
"content_hash": "9260fff354159bea8d652c6e15e1c3e4",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 72,
"avg_line_length": 21.384615384615383,
"alnum_prop": 0.60431654676259,
"repo_name": "pschulam/mypy",
"id": "ccdcb549ed906bd2504dc08d4f764d99149c7ba2",
"size": "1390",
... |
"""Module to help with parsing and generating configuration files."""
from collections import OrderedDict
# pylint: disable=no-name-in-module
from distutils.version import LooseVersion # pylint: disable=import-error
import logging
import os
import re
import shutil
from typing import ( # noqa: F401 pylint: disable=un... | {
"content_hash": "f9db096ac69d2a5afe83fe81b945c797",
"timestamp": "",
"source": "github",
"line_count": 850,
"max_line_length": 88,
"avg_line_length": 32.654117647058825,
"alnum_prop": 0.609814094249892,
"repo_name": "fbradyirl/home-assistant",
"id": "4d3d4dd841fd726a9b8f5e17a068d25e5f32abe2",
"siz... |
import logging
import os
import sys
from pprint import pprint
from datetime import datetime
from arps.util import LOREM, encrypt_password
import click
from arps.models import *
from flask.cli import with_appcontext
log = logging.getLogger()
@click.group()
def main():
pass
@main.command()
@with_appcontext
def she... | {
"content_hash": "047d813b098112647b780bd1057211a5",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 135,
"avg_line_length": 37.73684210526316,
"alnum_prop": 0.6577754532775453,
"repo_name": "sumpfgottheit/arps",
"id": "13b78e879242078e30ccdec99569dc7424c5088a",
"size": "... |
from .abstract_db import AbstractDatabaseTask
class BackupTask(AbstractDatabaseTask):
"""
Backs up the database.
"""
name = "backup"
def run(self, filename):
return self.postgres(
"pg_dump -Fc %s > %s" % (self.env.proj_name, filename))
| {
"content_hash": "1ba72efeb81b44f616ebb1b3170b63c0",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 67,
"avg_line_length": 23.25,
"alnum_prop": 0.6164874551971327,
"repo_name": "Numerical-Brass/Wool",
"id": "b39102c68fa8237856d5d48f63937698fc56a804",
"size": "279",
"bin... |
from msrest.serialization import Model
class MetricValue(Model):
"""Represents a metric value.
All required parameters must be populated in order to send to Azure.
:param time_stamp: Required. the timestamp for the metric value in ISO
8601 format.
:type time_stamp: datetime
:param average: ... | {
"content_hash": "3e319c73e6aef59fddbf1f9d6d972f25",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 155,
"avg_line_length": 36.44444444444444,
"alnum_prop": 0.6146341463414634,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "c6c65186df2547ed8c3609a5a6f10a29c05f8b76",
... |
"""
Support for Yr.no weather service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.yr/
"""
import asyncio
import logging
from random import randrange
from xml.parsers.expat import ExpatError
import aiohttp
import async_timeout
import voluptuo... | {
"content_hash": "8756cb83fb2072e00433d802b61b0a35",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 79,
"avg_line_length": 35.00389105058366,
"alnum_prop": 0.5840373499333037,
"repo_name": "PetePriority/home-assistant",
"id": "0cb9c3765ecab51c8c31a3c7a560f7b8275a786c",
"... |
from __future__ import unicode_literals
from prompt_toolkit.shortcuts import get_input
from prompt_toolkit.filters import Always
if __name__ == '__main__':
print('If you press meta-! or esc-! at the following prompt, you can enter system commands.')
answer = get_input('Give me some input: ', enable_system_bin... | {
"content_hash": "5e9182e820e34e55778b195a89e850db",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 97,
"avg_line_length": 41.22222222222222,
"alnum_prop": 0.7008086253369272,
"repo_name": "jaseg/python-prompt-toolkit",
"id": "0499f45dfd26116303eb740054be5deb8d99f11c",
"si... |
__author__ = 'johannes'
from flask import render_template, jsonify, url_for
from devviz import data_handler, app
from devviz.utils import sse_route
from devviz.views import View, Variable
import json
import time
@app.route('/variables/stream')
@sse_route
def variables_stream():
while True:
vars = [{"name"... | {
"content_hash": "580cbfd8e2beb5a5c0adbfd4dfab43b3",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 78,
"avg_line_length": 30.176470588235293,
"alnum_prop": 0.5997400909681612,
"repo_name": "hildensia/devviz",
"id": "d751d3cf9f41e91d8edfa2e9e621902ebf32ba12",
"size": "153... |
import urllib.request
#first run
#num = "12345"
#second part
num = str(int(92118/2))
url = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing="
for x in range(400):
page = urllib.request.urlopen(url + str(num))
mystr = page.read().decode()
parts = mystr.split()
num = parts[len(parts)-1]
... | {
"content_hash": "09adaef6b34b96c4c4d0f97e0433d630",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 69,
"avg_line_length": 18.636363636363637,
"alnum_prop": 0.6195121951219512,
"repo_name": "feliposz/python-challenge-solutions",
"id": "1b4bd3cfa3d81b2e237d9c6693abc6898b696d... |
from sqlalchemy import (
Column,
ForeignKey,
Integer,
String,
Enum,
Boolean,
Date,
Table
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from marshmallow_sqlalchemy import ModelSchema
Base = declarative_base()
TimeOfDayEnum = (
'M... | {
"content_hash": "ba17df652c39ef7bb553e19002d01d50",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 74,
"avg_line_length": 25.073170731707318,
"alnum_prop": 0.6167315175097277,
"repo_name": "bschuweiler/hunting-journal",
"id": "d0b266072128ec4d9be5384ed9e4c4b1f70aa44f",
... |
__author__ = 'fmoscato'
"""
The Publication DAO handles interactions with the publication collection
The DAO provides 3 levels interface (da scrivere meglio)
1 - ADMIN can add publications + validate
2- search publications
3- users level
"""
import sys
import re
from datetime import datetime
import json
import ast
... | {
"content_hash": "916cad48ca98cc013448c640bc2f845d",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 126,
"avg_line_length": 34.324503311258276,
"alnum_prop": 0.5213196990160139,
"repo_name": "lbmm/S.E.Arch",
"id": "c3d8783419d9186eaee8faa198462fe350174e8d",
"size": "1036... |
"""This module is deprecated. Please use :mod:`kubernetes.client.models.V1VolumeMount`."""
import warnings
with warnings.catch_warnings():
from airflow.providers.cncf.kubernetes.backcompat.volume_mount import VolumeMount # noqa: autoflake
warnings.warn(
"This module is deprecated. Please use `kubernetes.clie... | {
"content_hash": "5f76df2ecf90f57bd1c5139edb87d336",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 104,
"avg_line_length": 35.63636363636363,
"alnum_prop": 0.7653061224489796,
"repo_name": "lyft/incubator-airflow",
"id": "aff5f30d5840e5200362bc88146f8ae2462e1200",
"size"... |
import os
import bitcoin
import keystore
from keystore import bip44_derivation
from wallet import Wallet, Imported_Wallet, Standard_Wallet, Multisig_Wallet, wallet_types
from i18n import _
from plugins import run_hook
class BaseWizard(object):
def __init__(self, config, storage):
super(BaseWizard, self)._... | {
"content_hash": "effbe19d16e6baac7f68568a6813f4db",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 174,
"avg_line_length": 41.22554347826087,
"alnum_prop": 0.568255223782216,
"repo_name": "vertcoin/electrum-vtc",
"id": "0e647bcf2aa6e4634ea910779009f652b0ca82b6",
"size":... |
import numpy as np
from keras.layers import Lambda, Merge
from keras.layers.convolutional import Convolution2D
from keras import backend as K
from keras.engine import Layer
def crosschannelnormalization(alpha = 1e-4, k=2, beta=0.75, n=5,**kwargs):
"""
This is the function used for cross channel normalization... | {
"content_hash": "1a01bc92a019bb277a26be648ba3a5f6",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 77,
"avg_line_length": 29.761904761904763,
"alnum_prop": 0.5676,
"repo_name": "babraham123/deepdriving",
"id": "7c61c7a70ba721cac5427b691fd4688378796f6d",
"size": "2500",
... |
'''
InfCommonObject
'''
## InfLineCommentObject
#
# Comment Object for any line in the INF file
#
# #
# # HeaderComment
# #
# Line # TailComment
#
class InfLineCommentObject():
def __init__(self):
self.HeaderComments = ''
self.TailComments = ''
def SetHeaderC... | {
"content_hash": "794b3297298f76fad6941143363c415d",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 48,
"avg_line_length": 22.221476510067113,
"alnum_prop": 0.5288432497734823,
"repo_name": "tianocore/buildtools-BaseTools",
"id": "217b0941dac4df5810a7b8c46242da649b734783",... |
"""Setup file.
Copyright 2019 The AdaNet Authors. All Rights Reserved.
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicabl... | {
"content_hash": "72aa42964a40fd18ff02c626f40c8337",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 72,
"avg_line_length": 31.133333333333333,
"alnum_prop": 0.7398286937901499,
"repo_name": "tensorflow/adanet",
"id": "2e349eb3f4529983a46782967ce6c24f83d2ba20",
"size": "93... |
import glob
import hashlib
import logging
import os
import re
import shutil
import tempfile
import requests
from platforms.common import ReleaseException, run
from releases import get_version_and_timestamp_from_release
def brew(homebrew_dir, command, *run_args, **run_kwargs):
"""
Run brew that is installed i... | {
"content_hash": "777b03c22a90a51c2bb9a95d63819002",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 106,
"avg_line_length": 35.29545454545455,
"alnum_prop": 0.6256439150032196,
"repo_name": "JoelMarcey/buck",
"id": "cd67b358dc96031078dd16dd58aa7ce7a1e33c9c",
"size": "130... |
import click
from arrow.cli import pass_context
from arrow.decorators import custom_exception, dict_output
@click.command('updateValue')
@click.argument("id_number")
@click.argument("new_value")
@click.option(
"--metadata",
help=""
)
@pass_context
@custom_exception
@dict_output
def cli(ctx, id_number, new_val... | {
"content_hash": "fd7a3235005cbd17c2c4412201f615a5",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 83,
"avg_line_length": 20.608695652173914,
"alnum_prop": 0.7067510548523207,
"repo_name": "erasche/python-apollo",
"id": "f876da0b95d2aa1037ec8c6a3046600d4444c56b",
"size":... |
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from astropy.nddata import NDData, NDSlicingMixin
from astropy.nddata.nduncertainty import NDUncertainty, StdDevUncertainty
from astropy import units as u
# Just add the Mixin to NDData
# TODO: Make this use NDDataRef instead!
class NDData... | {
"content_hash": "7d6d99c2d1e80d5a8cd7bdc9220453ef",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 75,
"avg_line_length": 31.128205128205128,
"alnum_prop": 0.6583607907742999,
"repo_name": "bsipocz/astropy",
"id": "7fc29b701e68f4fec841af178e0a69c6a8ec8abf",
"size": "492... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lowfat', '0084_auto_20170112_1614'),
]
operations = [
migrations.AlterField(
model_name='expense',
name='funds_from',
... | {
"content_hash": "22decfaef64bf7519708b4728b96b4c6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 203,
"avg_line_length": 29.72222222222222,
"alnum_prop": 0.6149532710280374,
"repo_name": "softwaresaved/fat",
"id": "d4fe495523043b080dd042fcbffad3015b493cfa",
"size": "60... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
class Term(AbstractQuery):
def __init__(self, term=None):
"""
@param term: optional
@type term: dict
"""
super(Term, self).__init__()
if term is not None:
self.set_raw_term(term)
def set_r... | {
"content_hash": "7d71c5903b32cee315d1cf83ee89d2a4",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 73,
"avg_line_length": 23.41025641025641,
"alnum_prop": 0.49726177437020813,
"repo_name": "jlinn/pylastica",
"id": "981f011a8a1c91dbe612262a0f4c0da84252d312",
"size": "913"... |
"""
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import scipy.sparse.linalg
import scipy.linalg
import contextlib
from smt.utils.options_dictionary import OptionsDictionary
VALID_SOLVERS = (
"krylov-dense",
"dense-lu",
"d... | {
"content_hash": "1d82139f9b91d5cb6d061bd799f011fd",
"timestamp": "",
"source": "github",
"line_count": 537,
"max_line_length": 87,
"avg_line_length": 32.497206703910614,
"alnum_prop": 0.5104578534181422,
"repo_name": "SMTorg/smt",
"id": "46fe1af79f0216d9f4d595e6721aa8f685295a08",
"size": "17451",
... |
"""
View class of the website
~~~~~~~~~~~~~~~~~~~~~~~~~
The website respects the MVC design pattern and this class is the view.
"""
import os
import cherrypy
from Cheetah.Template import Template
import cgi
import csv
import StringIO
from csv import DictReader
import urllib2
import json
from cherrypy imp... | {
"content_hash": "6ed6a276c29d9f58103ad33c77ff2900",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 92,
"avg_line_length": 36.252066115702476,
"alnum_prop": 0.5768836201983358,
"repo_name": "CIRCL/bgpranking-redis-api",
"id": "8c80e078fe51caa087686b1f335f9aeed723f297",
"... |
from optparse import OptionParser
from campfin.seeder import *
Seeder().seed()
| {
"content_hash": "8d147dd41d14664badf1a754d7d496c4",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 33,
"avg_line_length": 20,
"alnum_prop": 0.7875,
"repo_name": "huffpostdata/campfin-linker",
"id": "05fcaeaee1a96af90bace71672472ac16f1b90b6",
"size": "80",
"binary": fals... |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import pdfrw
import tempfile
from spreadflow_delta.proc import ExtractorBase, util
class LoadPdfPages(ExtractorBase):
def __init__(self, key='path', slicekey=None, destkey='content'):
... | {
"content_hash": "a26c0efbdcb8d520acd8fd1468ee456e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 102,
"avg_line_length": 29.396825396825395,
"alnum_prop": 0.6123110151187905,
"repo_name": "znerol/spreadflow-pdf",
"id": "cecdef057a0d98277d992d57607cdb83ce47f399",
"size"... |
from robofab.pens.pointPen import BasePointToSegmentPen
from ufoLib.pointPen import AbstractPointPen
"""
Printing pens print their data. Useful for demos and debugging.
"""
__all__ = ["PrintingPointPen", "PrintingSegmentPen", "SegmentPrintingPointPen"]
class PrintingPointPen(AbstractPointPen):
"""A PointPen tha... | {
"content_hash": "e79fd2bfd42a4b8ca67b3554da023281",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 24.178571428571427,
"alnum_prop": 0.6976858690300345,
"repo_name": "metapolator/mutatormathtools",
"id": "ead2f86643bf23790c00acc2ac1ac68de3710dab",
... |
import pytest
import time
import unittest.mock
from girder import events
class EventsHelper:
def __init__(self):
self.ctr = 0
self.responses = None
def _raiseException(self, event):
raise Exception('Failure condition')
def _increment(self, event):
self.ctr += event.info[... | {
"content_hash": "c08a1117d40ee23ce016e40bfcbf5e39",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 91,
"avg_line_length": 36.10344827586207,
"alnum_prop": 0.6550143266475644,
"repo_name": "Kitware/girder",
"id": "7e89f08549436c44cf355258d9e76311482eb9f4",
"size": "5259"... |
import argparse
import datetime
import os
import os.path
import re
import shutil
import subprocess
import sys
import tempfile
import time
############################################################
# Classes
############################################################
class Log(object):
"""Pretty print to the co... | {
"content_hash": "680dd7830aa36f95ad16979ea3b94368",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 88,
"avg_line_length": 31.376044568245124,
"alnum_prop": 0.5563742897727273,
"repo_name": "brettwooldridge/buck",
"id": "f68949dd544e2e3c1d37636a1c0766d615b2b3be",
"size":... |
from __future__ import absolute_import
import six
from django.core.urlresolvers import reverse
from sentry.testutils import APITestCase, SnubaTestCase
from sentry.testutils.helpers.datetime import before_now, iso_format
class ProjectEventDetailsTest(APITestCase, SnubaTestCase):
def setUp(self):
super(Pr... | {
"content_hash": "9449b3416eb425d2807b553e1412ff96",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 100,
"avg_line_length": 39.27461139896373,
"alnum_prop": 0.5688654353562005,
"repo_name": "mvaled/sentry",
"id": "c682d498eb8b07f31e84703e7cc64879b68fa751",
"size": "7580"... |
import frappe
import unittest
class TestSMSSettings(unittest.TestCase):
pass
| {
"content_hash": "962ee84573724c68736c186aa42b9b71",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 41,
"avg_line_length": 15.8,
"alnum_prop": 0.8354430379746836,
"repo_name": "mhbu50/frappe",
"id": "b3be912f9e1fc9e36198d540252a0ffb79528046",
"size": "190",
"binary": fal... |
import struct
__author__ = 'tom1231'
from BAL.Header.RiCHeader import RiCHeader
RES_ID = 101
class ConnectionResponse(RiCHeader):
def dataTosend(self):
return RiCHeader.dataTosend(self) + struct.pack('<?', self._toConnect)
def __init__(self, toConnect):
RiCHeader.__init__(self)
self... | {
"content_hash": "d178ac5597a88631e17dbe78c1182a47",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 78,
"avg_line_length": 21.416666666666668,
"alnum_prop": 0.6206225680933852,
"repo_name": "robotican/ric",
"id": "db330975f1745efe66743590ae34fbe74cb5c926",
"size": "514",
... |
import crispy_forms
from setuptools import setup, find_packages
tests_require = [
'Django>=1.3,<1.8',
]
setup(
name='django-crispy-forms',
version=crispy_forms.__version__,
description="Best way to have Django DRY forms",
long_description=open('README.rst').read(),
classifiers=[
"Dev... | {
"content_hash": "a2a804f23aaeb8f362278b935fe2ef44",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 71,
"avg_line_length": 31.75,
"alnum_prop": 0.6110236220472441,
"repo_name": "zixan/django-crispy-forms",
"id": "79444dd90f91e18c47a6e28909c674c78388baea",
"size": "1270",
... |
from .ApplicationConfiguration import ApplicationConfiguration
import importlib
class PersistentImageManager(object):
""" Abstract base class for the Persistence managers """
_default_manager = None
@classmethod
def default_manager(cls):
if not cls._default_manager:
appconfig = ... | {
"content_hash": "801d4f354d055dccd8877e701bdd1fb9",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 119,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6184615384615385,
"repo_name": "redhat-imaging/imagefactory",
"id": "b5a0ce8e7130ada74d8536fcd969d1a0cc73c2d1",
... |
import logging
import tempfile
from uuid import uuid4
from mongo_orchestration.container import Container
from mongo_orchestration.errors import ShardedClusterError
from mongo_orchestration.servers import Servers
from mongo_orchestration.replica_sets import ReplicaSets
from mongo_orchestration.singleton import Single... | {
"content_hash": "f4909f5149a5bb55f471f5938cb3fb5d",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 117,
"avg_line_length": 37.904225352112675,
"alnum_prop": 0.5682223543400713,
"repo_name": "jyemin/mongo-orchestration",
"id": "34da95531da4deb2bfe5514f0b84051bfb0d7979",
... |
def seek_and_read(file_name, buf_size, byte_number):
with open(file_name) as f:
f.seek(byte_number)
buf = f.read(buf_size)
return buf
def main():
buf_size = 48
byte_number = 6
print seek_and_read(
'./files_random_access_input_output.py',
buf_size,
byte_number... | {
"content_hash": "c80503477534e486bbb97203e21a581f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 52,
"avg_line_length": 22.5625,
"alnum_prop": 0.556786703601108,
"repo_name": "adsznzhang/learntosolveit",
"id": "a98903ea8a69b75c90513e10b6a2336801bcca9d",
"size": "361",
... |
"""
IdleBot
Copyright (c) 2015, kernelpanic3, Sorch & JeDa
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of condition... | {
"content_hash": "1887c6748a5a981fdda9b9cac8396cbe",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 105,
"avg_line_length": 33.28125,
"alnum_prop": 0.7248826291079812,
"repo_name": "kernelpanic3/IdleBot",
"id": "2083c1841b3ec1a2441b18dae334b107892bd07b",
"size": "4260",
... |
import subprocess as sp
import tempfile as tmp
import cfl
import os
def bart(nargout, cmd, *args):
if type(nargout) != int or nargout < 0:
print("Usage: bart(<nargout>, <command>, <arguements...>)");
return None
bart_path = os.environ['TOOLBOX_PATH'] + '/bart ';
if not bart_path:
... | {
"content_hash": "e57a69bea8f2160856729aaede5078eb",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 79,
"avg_line_length": 27.71186440677966,
"alnum_prop": 0.5492354740061162,
"repo_name": "mjacob75/bart",
"id": "442bf80b102f362c80347d50cdcd9521a8fcea00",
"size": "1880",
... |
import time
import uuid
def get_random_id():
#NOTE: It is very important that these random IDs NOT start with a number.
random_id = '_' + uuid.uuid4().hex
return random_id
def get_time_string(delta=0):
return time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime(time.time() + delta))
| {
"content_hash": "27d19d7e8c1310f8f840da3f34dc8908",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 79,
"avg_line_length": 29.6,
"alnum_prop": 0.6655405405405406,
"repo_name": "unomena/django-saml2-sp",
"id": "a7e507beae60c74490deb54e95fd1e4378c4a692",
"size": "452",
"b... |
"""
Support for the Withings API.
For more details about this platform, please refer to the documentation at
"""
import voluptuous as vol
from withings_api import WithingsAuth
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant... | {
"content_hash": "c28934f0186f47d09e45a50ea0ef52ea",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 92,
"avg_line_length": 32.60909090909091,
"alnum_prop": 0.5996654586005018,
"repo_name": "qedi-r/home-assistant",
"id": "482c4e96e5cec54a78b816247495c948fde1f30b",
"size":... |
"""
Settings for the ctcf_peaks example script
"""
import gffutils
import metaseq
UPSTREAM = 1000
DOWNSTREAM = 1000
BINS = 100
FRAGMENT_SIZE = 200
GENOME = 'hg19'
CHROMS = ['chr1', 'chr2']
gtfdb = metaseq.example_filename('Homo_sapiens.GRCh37.66.cleaned.gtf.db')
G = gffutils.FeatureDB(gtfdb)
| {
"content_hash": "da635737874b64e2ec2584634788a8d3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 73,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.7322033898305085,
"repo_name": "agrimaldi/metaseq",
"id": "b22b94bd1ba91018c5d360c6edb1076bb4b81fbd",
"size": "29... |
import struct
import loxi
import util
import loxi.generic_util
import sys
ofp = sys.modules['loxi.of13']
class instruction_id(loxi.OFObject):
subtypes = {}
def __init__(self, type=None):
if type != None:
self.type = type
else:
self.type = 0
return
def pac... | {
"content_hash": "7614ab3144da98f79ca41fac85b97452",
"timestamp": "",
"source": "github",
"line_count": 1036,
"max_line_length": 76,
"avg_line_length": 27.75096525096525,
"alnum_prop": 0.5354782608695652,
"repo_name": "opencord/voltha",
"id": "c5f0ca6df18cdf5b1b9064295b904ebd3f7f6ea0",
"size": "297... |
import warnings
from datetime import datetime, timedelta
import datetime as pydt
import numpy as np
from dateutil.relativedelta import relativedelta
import matplotlib.units as units
import matplotlib.dates as dates
from matplotlib.ticker import Formatter, AutoLocator, Locator
from matplotlib.transforms import nonsin... | {
"content_hash": "034bd58bd74755af4ba3d1b3fbff7e1a",
"timestamp": "",
"source": "github",
"line_count": 1159,
"max_line_length": 79,
"avg_line_length": 33.442622950819676,
"alnum_prop": 0.5568369453044376,
"repo_name": "harisbal/pandas",
"id": "444b742ae706e455f1d37b63b8f827868487f97b",
"size": "38... |
from distutils.core import setup
from distutils.extension import Extension
import numpy
from Cython.Build import cythonize
setup(
ext_modules = cythonize([
Extension("shared",
["shared.pyx"],
language="c++",
extra_compile_args=["-O0"],
... | {
"content_hash": "371a061f0b5188b5f8c3c25fa5670bc5",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 53,
"avg_line_length": 32.96296296296296,
"alnum_prop": 0.451685393258427,
"repo_name": "rupertnash/gpu-swimmers",
"id": "7cabc09354dd4c3c912ed21d46d412d032d0295e",
"size":... |
import datetime
import flask
import json
import pytest
import re
from bs4 import BeautifulSoup
import dash_dangerously_set_inner_html
import dash_flow_example
import dash
from dash import Dash, html, dcc, Input, Output
from dash.exceptions import PreventUpdate
from dash.testing.wait import until
def test_inin003_... | {
"content_hash": "fd6bbc10cfb4bcc016291da7260e8247",
"timestamp": "",
"source": "github",
"line_count": 429,
"max_line_length": 105,
"avg_line_length": 29.762237762237763,
"alnum_prop": 0.5495770676691729,
"repo_name": "plotly/dash",
"id": "ab88a45b8f3d9e259e964be9a45bbb3953575675",
"size": "12768"... |
"""port_erspan_extension
Revision ID: 016a678fafd4
Revises: bda3c34581e0
Create Date: 2020-11-03 00:00:00.000000
"""
# revision identifiers, used by Alembic.
revision = '016a678fafd4'
down_revision = 'bda3c34581e0'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'apic_ai... | {
"content_hash": "bffdb8dc44fe6f7ce9680641964f5c66",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 78,
"avg_line_length": 27.53125,
"alnum_prop": 0.6424517593643587,
"repo_name": "noironetworks/group-based-policy",
"id": "8c8c8a885805351cff9bdf0415e24489edf43a8c",
"size"... |
import os
from glob import glob
from django import template
from django.conf import settings
register = template.Library()
STATIC_ROOT = settings.STATIC_ROOT
CSS_ROOT = os.path.join(settings.STATIC_ROOT, 'css/')
LINK_TAG = '<link href="%s" rel="stylesheet" type="text/css">'
@register.simple_tag
def all_stylesheets()... | {
"content_hash": "bbf34a128080e31063a8004eb980de6d",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 71,
"avg_line_length": 27.03846153846154,
"alnum_prop": 0.6842105263157895,
"repo_name": "JohnRandom/django-aggregator",
"id": "e6e733f7019ef9c7e6dd5b1e97c912382d3ede98",
"... |
import os
import sys
from config.db import MongoDB
from config.config import Production
from config.config import Staging
from config.config import Development
from config.config import Testing
try:
env = os.environ['FLASK_ENV']
except KeyError as e:
sys.exit('Please set the environment key FLASK_ENV to Produ... | {
"content_hash": "36216c352b2d5ac0d5f59a2a3619fa58",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 98,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.6368534482758621,
"repo_name": "wemoo/wemoo-center",
"id": "40bfabd306ae1e3fe67339abe0b205d671dd8bd4",
"size": "95... |
"""This module is deprecated. Please use :mod:`airflow.providers.microsoft.azure.secrets.key_vault`."""
import warnings
from airflow.providers.microsoft.azure.secrets.key_vault import AzureKeyVaultBackend # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.microsoft.azure.secrets.key... | {
"content_hash": "177504ac5f30f790014edc5c34a6bc6d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 103,
"avg_line_length": 34.09090909090909,
"alnum_prop": 0.7706666666666667,
"repo_name": "danielvdende/incubator-airflow",
"id": "000ae92b3ac28485db7df9441de3c76d833a95b4",
... |
"""private module containing functions used for copying data
between instances based on join conditions.
"""
from . import attributes
from . import exc
from . import util as orm_util
from .. import util
def populate(
source,
source_mapper,
dest,
dest_mapper,
synchronize_pairs,
uowcommit,
... | {
"content_hash": "b4df5613d750f2619a2aa49784301812",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 78,
"avg_line_length": 34.94375,
"alnum_prop": 0.5868359864067251,
"repo_name": "cloudera/hue",
"id": "ceaf54e5d332e1fe3436cd81ce9d0b0013afa2f9",
"size": "5823",
"binary... |
from collections import OrderedDict
import numpy as np
import theano as theano
import theano.tensor as T
from theano.ifelse import ifelse
######################
# PARAM UPDATE FUNCS #
######################
def norm_clip(dW, max_l2_norm=10.0):
"""
Clip theano symbolic var dW to have some max l2 norm.
"""... | {
"content_hash": "b7e09aef586240b0261bf8ba1ff34f98",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 74,
"avg_line_length": 29.96153846153846,
"alnum_prop": 0.6007702182284981,
"repo_name": "Philip-Bachman/ICML-2015",
"id": "e419f31216f5e32410746dde3271706ad5f4ccdd",
"size... |
from google.api_core.gapic_v1 import client_info as gapic_client_info
from google.api_core import client_info as http_client_info
import hive_to_bigquery
APPLICATION_NAME = "google-pso-tool/hive-bigquery"
USER_AGENT = "{}/{}".format(APPLICATION_NAME, hive_to_bigquery.__version__)
def get_gapic_client_info():
r... | {
"content_hash": "b625dd2648f4135336f55710bbd3aec7",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 75,
"avg_line_length": 27.705882352941178,
"alnum_prop": 0.7537154989384289,
"repo_name": "CloudVLab/professional-services",
"id": "df69a229742ec9cae3d7236cdc024c52efcba43b",... |
from aiojson.backends.python import Buffer, get_tokens
from .data import RAW_DATA, RAW_TOKENS
def test_get_tokens_all():
buf = Buffer(RAW_DATA)
parser = get_tokens(buf, more_data=False)
tokens = list(parser)
assert len(tokens) == len(RAW_TOKENS)
assert tokens == RAW_TOKENS
def test_get_tokens_c... | {
"content_hash": "3a0083e463d5e505c75c28a564fcce7a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 65,
"avg_line_length": 27.61904761904762,
"alnum_prop": 0.6681034482758621,
"repo_name": "ethanfrey/aiojson",
"id": "583ff861c35380da14f6f2c3518412621b202aff",
"size": "118... |
from clean_topology import cleanup
from create_topology import create_topo
print "\n -- "
cleanup()
create_topo('partial-topology.json')
print "\n -- "
| {
"content_hash": "d17b25eab61b75417949d7fa02f7618f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 39,
"avg_line_length": 19.25,
"alnum_prop": 0.7272727272727273,
"repo_name": "nikitamarchenko/open-kilda",
"id": "63bfd1fdecddcd0e0c544de07722ba9d7288b608",
"size": "776",
... |
import sys
import traceback
from core.game import *
from core.functions import *
# Coords format - (y, x)
def main():
try:
game_init();
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info();
tb = traceback.format_exception(exc_type, exc_value, exc_traceback);
string = ''.join(tb);
... | {
"content_hash": "bf2753c6a100d4500c91820d8ff7583c",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 70,
"avg_line_length": 21.227272727272727,
"alnum_prop": 0.6124197002141327,
"repo_name": "Melnick/Cnake",
"id": "9be388ead5a740ba17e822153a3b5019fb231b43",
"size": "467",
... |
import os
def run(*args):
print('Script called from: %s' % os.getcwd())
| {
"content_hash": "04c11fd5ebc36f0839d51d75f4d5d037",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 49,
"avg_line_length": 15.6,
"alnum_prop": 0.6153846153846154,
"repo_name": "django-extensions/django-extensions",
"id": "cc79d3a885946ef85002b89cf19b84feeefe55f3",
"size": ... |
from __future__ import absolute_import
import contextlib
from kombu.transport import virtual
from kombu import utils
from stomp import exception as exc
from . import stomp
class Message(virtual.Message):
"""Kombu virtual transport message class for kombu-stomp.
This class extends :py:class:`kombu.transport... | {
"content_hash": "ac2dce573a8b0fe081a052a2fadb0482",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 73,
"avg_line_length": 31.444444444444443,
"alnum_prop": 0.5609075692765483,
"repo_name": "ntteurope/kombu-stomp",
"id": "0735623de879ca3ecb9efda9766b7ca1bd76a47f",
"size"... |
"""
MySQL database backend for Django.
Requires mysqlclient: https://pypi.org/project/mysqlclient/
"""
from django.core.exceptions import ImproperlyConfigured
from django.db import IntegrityError
from django.db.backends import utils as backend_utils
from django.db.backends.base.base import BaseDatabaseWrapper
from dja... | {
"content_hash": "607e2543ea61af93d18c6f07fde26e90",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 112,
"avg_line_length": 39.92118226600985,
"alnum_prop": 0.59464461994077,
"repo_name": "koordinates/django",
"id": "a8dcc7c72a9d4a9d24fc32e884c83421961cdac2",
"size": "16... |
"""Including this as a dependency will result in tests NOT using MLIR bridge.
This function is defined by default in test_util.py to None. The test_util then
attempts to import this module. If this file is made available through the BUILD
rule, then this function is overridden and will instead cause Tensorflow graphs
... | {
"content_hash": "5e985fe2920cd11f727d99621266c63b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 80,
"avg_line_length": 37.8125,
"alnum_prop": 0.768595041322314,
"repo_name": "sarvex/tensorflow",
"id": "d2581a945017fda6bcbce83b273821f1750e4034",
"size": "1294",
"bina... |
from __future__ import absolute_import
import jsonschema
import mock
import six
from orquesta import statuses as wf_statuses
import st2tests
# XXX: actionsensor import depends on config being setup.
import st2tests.config as tests_config
tests_config.parse_args()
from tests.unit import base
from st2actions.notif... | {
"content_hash": "c9468558c1b20bef0e062197034650a1",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 88,
"avg_line_length": 45.0725,
"alnum_prop": 0.6533362915303123,
"repo_name": "Plexxi/st2",
"id": "ff7114a31867ced9dd2e26ce46943de5220ca285",
"size": "18657",
"binary":... |
import unittest
from vodem.api import sim_imsi
class TestSimImsi(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.valid_response = {
'sim_imsi': '',
}
def test_call(self):
resp = sim_imsi()
self.assertEqual(self.valid_response, resp)
| {
"content_hash": "222be0a22cd3783dcca4679a6ba14a96",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 51,
"avg_line_length": 19,
"alnum_prop": 0.6019736842105263,
"repo_name": "alzeih/python-vodem-vodafone-K4607-Z",
"id": "890bf32b2ab461664ce8002f15d1d06332579d8c",
"size": ... |
from itertools import repeat
import validator.testcases.packagelayout as packagelayout
from validator.errorbundler import ErrorBundle
from helper import _do_test, MockXPI
def test_blacklisted_files():
"""Tests that the validator will throw warnings on extensions
containing files that have extensions which ar... | {
"content_hash": "b0d5970941cae03da76b04ecd5c3a74d",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 78,
"avg_line_length": 32.26258992805755,
"alnum_prop": 0.6227004125320549,
"repo_name": "mattbasta/amo-validator",
"id": "8fba1a42a9973024a80a4647623e4182fe83da54",
"size... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('voucher', '0002_auto_20170418_2132'),
]
operations = [
migrations.AlterField(
model_name='voucher',
name='offers',
field=models.ManyToManyField(limit_cho... | {
"content_hash": "1c8c35c26ba1a6f1a48633d136e25137",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 162,
"avg_line_length": 28.125,
"alnum_prop": 0.6155555555555555,
"repo_name": "sasha0/django-oscar",
"id": "55bb676506480b0be6dbbcb512dbc39ec4250291",
"size": "497",
"bi... |
import urllib2
from urllib import urlencode
class DeCaptcher(object):
"""
Unofficial python client for de-captcher.com API
"""
def __init__(self, username, password):
self.url = "http://poster.de-captcher.com/"
self.username = username
self.password = password
def check_cr... | {
"content_hash": "4da9ed26b72f04b553e37e37fe5159e6",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 77,
"avg_line_length": 28.688524590163933,
"alnum_prop": 0.52,
"repo_name": "mmetince/captchasec",
"id": "67ccb8c6ec0763a8bda26b56947bbd1d24292f5d",
"size": "1797",
"bina... |
try:
import unittest2 as unittest
except ImportError:
import unittest # noqa
from datetime import datetime, date, time
from decimal import Decimal
from uuid import UUID, uuid4
from cassandra.cqlengine.models import Model
from cassandra.cqlengine.usertype import UserType
from cassandra.cqlengine import column... | {
"content_hash": "30c46fc381d13740ac6a2aeae178e931",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 143,
"avg_line_length": 37.14565826330532,
"alnum_prop": 0.6181283462785612,
"repo_name": "jregovic/python-driver",
"id": "bf2f37020c8a44cb6f6ddc0a2042aa7352b02030",
"size... |
import logging
from collections import OrderedDict
from time import sleep
from decimal import Decimal
from random import random
from django.conf import settings
from django.db import transaction
from django.utils.translation import ugettext_lazy as _
from localflavor.se.forms import SEPersonalIdentityNumberField
impor... | {
"content_hash": "e64f79c0532e33e8cc7bdec7d096d7cf",
"timestamp": "",
"source": "github",
"line_count": 531,
"max_line_length": 227,
"avg_line_length": 35.83427495291902,
"alnum_prop": 0.5399936935043095,
"repo_name": "ovidner/bitket",
"id": "5edd39df47aa10f557ca14ea347dce62edc55b86",
"size": "1902... |
def is_palindrome(string):
""" (str) -> bool
Return True if and only if string is a palindrome.
Precondition: string is all in lowercase.
>>>> is_palindrome('ABCDEFG')
''
>>>> is_palindrome('madamimadam')
True
>>>> is_palindrome('Racecar')
''
>>>> is_palindrome('racecar... | {
"content_hash": "44b34b58d8509cf30bc4fe1e4a19af1a",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 77,
"avg_line_length": 29.263157894736842,
"alnum_prop": 0.5849820143884892,
"repo_name": "mdnu/snake",
"id": "887341fab9e64471099f6dac18cf3f9521f9bffc",
"size": "2224",
... |
"""Geometric transforms (e.g. rigid transformation)."""
import dataclasses
from typing import Union
import tensorflow as tf
TensorLike = tf.types.experimental.TensorLike
@dataclasses.dataclass
class Isometry:
"""3D transform object used to represent an SE(3) (isometric) transform.
Underneath this class stores... | {
"content_hash": "e61b579c01aa8d203575dcef103f8fb2",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 80,
"avg_line_length": 30.11320754716981,
"alnum_prop": 0.6560150375939849,
"repo_name": "google-research/sunds",
"id": "ddfb4885f96378886114cee4a762244470dd7274",
"size":... |
"""
SQLite3 backend for django.
Works with either the pysqlite2 module or the sqlite3 module in the
standard library.
"""
from __future__ import unicode_literals
import datetime
import decimal
import warnings
import re
import sys
from django.db import utils
from django.db.backends import *
from django.db.backends.si... | {
"content_hash": "b30072a826aef41d89fcab07c42943b5",
"timestamp": "",
"source": "github",
"line_count": 431,
"max_line_length": 120,
"avg_line_length": 43.167053364269144,
"alnum_prop": 0.6437516796560064,
"repo_name": "blaze33/django",
"id": "1fcc222c80baa045106f62cfacf5b7c24d8c24d3",
"size": "186... |
"""Upgrader for Python scripts from pre-1.0 TensorFlow to 1.0 TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import ast
import collections
import os
import shutil
import sys
import tempfile
import traceback
class APIChangeSp... | {
"content_hash": "70054b8f67f0a1a80eb8f8227ceb00b1",
"timestamp": "",
"source": "github",
"line_count": 688,
"max_line_length": 82,
"avg_line_length": 37.21656976744186,
"alnum_prop": 0.6000781097441906,
"repo_name": "sugartom/tensorflow-alien",
"id": "43bee46f942e3f5e4e20375a361226cdf4bdd499",
"si... |
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
from functools import wraps
from flask import (
Flask,
Markup,
session,
request,
g,
url_for,
escape,
redirect,
render_template,
... | {
"content_hash": "e9e46aa2dbb6b6871fe0d38d1f058f60",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 109,
"avg_line_length": 30.608695652173914,
"alnum_prop": 0.6418087121212122,
"repo_name": "RemiZOffAlex/pycertauth",
"id": "ae837b13ebb4ddf4b63e5f6e2f16e04c554d7e1a",
"si... |
from django import http
from django.contrib import messages
from django.core.urlresolvers import reverse
from keystoneclient import exceptions as keystone_exceptions
from mox import IsA
from horizon import api
from horizon import test
SYSPANEL_INDEX_URL = reverse('horizon:syspanel:overview:index')
DASH_INDEX_URL = r... | {
"content_hash": "809b5130f4698e24e42be3806c9d984b",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 78,
"avg_line_length": 36.995215311004785,
"alnum_prop": 0.5624676668391102,
"repo_name": "andrewsmedina/horizon",
"id": "cbe4dab65ea6df8e6f18efc9fba6b5869d2a61d0",
"size"... |
from random import shuffle
def bogosort(seq):
while(not all(seq[i] <= seq[i + 1] for i in range(len(seq) - 1))):
shuffle(seq)
return seq | {
"content_hash": "37f5a833300e9b671347416c8de435e0",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 70,
"avg_line_length": 22,
"alnum_prop": 0.6103896103896104,
"repo_name": "wizh/algorithms",
"id": "6b25ddd62f14af20e8240985d2c0eb58b4a70cc1",
"size": "154",
"binary": fal... |
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
from django.core.management import call_command
from trusts import ENTITY_MODEL_NAME, GROUP_MODEL_NAME, PERMISSION_MODEL_NAME, DEFAULT_SETTLOR, ALLOW_NULL_SETTLOR, ROOT_PK
import trusts.models
def forwa... | {
"content_hash": "662fa30acfc91f8689df5ab9de53aec8",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 241,
"avg_line_length": 46.892857142857146,
"alnum_prop": 0.6097994414826098,
"repo_name": "beedesk/django-trusts",
"id": "6d20fd8ab7c0de57d9599f3fdbedc81b6a72898a",
"size"... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0060_false_p_dedupe_indices'),
]
def disable_webhook_secret_for_existing_installs(apps, schema_editor):
system_settings = apps.get_model('dojo', 'system_settings')
try:
... | {
"content_hash": "bae182e41e72c9136df3640fa40d1287",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 232,
"avg_line_length": 45.48780487804878,
"alnum_prop": 0.6386058981233244,
"repo_name": "rackerlabs/django-DefectDojo",
"id": "17568ddb148b418a681ee6c3f7c3e0670a9d6007",
... |
from django.db.models import Q
from django_jinja import library
from kitsune.karma.models import Title
@library.global_function
def karma_titles(user):
"""Return a list of titles for a given user."""
# Titles assigned to the user or groups
return Title.objects.filter(
Q(users=user) | Q(groups__i... | {
"content_hash": "91feca317befeb000e1b656e34087c2e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 27.153846153846153,
"alnum_prop": 0.7138810198300283,
"repo_name": "brittanystoroz/kitsune",
"id": "210f693be19fe357d64a920ff8c6bf1e24904f36",
"size"... |
import asyncio
import functools
import websockets
from websockets import handshake
from django.http import HttpResponse, HttpResponseServerError
def websocket(handler):
"""Decorator for WebSocket handlers."""
@functools.wraps(handler)
def wrapper(request, *args, **kwargs):
environ = request.MET... | {
"content_hash": "d0ad3888cf71808d052b4dec64062ef9",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 78,
"avg_line_length": 34.74698795180723,
"alnum_prop": 0.6137309292649098,
"repo_name": "aaugustin/django-c10k-demo",
"id": "3c2a9484b575631858d4a8a48b90bc839676a3ee",
"si... |
import os
from datetime import datetime
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from .models import File, Link
class FileTestCase(TestCase):
def setUp(self):
self.path = ... | {
"content_hash": "0a94f907f2633b86b2b2d0ac571486c3",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 83,
"avg_line_length": 41.68862275449102,
"alnum_prop": 0.6192186153404194,
"repo_name": "chaos-soft/chocola",
"id": "a9efa01bf9c40a0ea21bf1a47a6fc7f67f30b53d",
"size": "7... |
'''
Created on Oct 4, 2014
@author: theo
'''
from django.shortcuts import get_object_or_404
from django.views.generic.base import TemplateView
from acacia.data.models import Project, MeetLocatie, TabGroup, KeyFigure
from acacia.data.views import ProjectDetailView
class HomeView(ProjectDetailView):
template_name ... | {
"content_hash": "84b89bbe289eea6887cb9b19747d0994",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 85,
"avg_line_length": 33.89795918367347,
"alnum_prop": 0.6351595424443106,
"repo_name": "acaciawater/spaarwater",
"id": "10b9fa5ec0284097831b209e2a0d816d0a67829d",
"size":... |
import abc
import argparse
import os
import six
from stevedore import extension
from . import exceptions
_discovered_plugins = {}
def discover_auth_systems():
"""Discover the available auth-systems.
This won't take into account the old style auth-systems.
"""
global _discovered_plugins
_disco... | {
"content_hash": "c3ff2a91953e36d688fc9b816dac6dd5",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 77,
"avg_line_length": 30.801980198019802,
"alnum_prop": 0.6133076181292189,
"repo_name": "nttcom/eclcli",
"id": "2168b59c5929f6951b2bb2dfa5b613a2e8529315",
"size": "6222"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.billing import BillingManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-billing
# USAGE
python product.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
... | {
"content_hash": "ec4af532660238e8cd2a7d0f7678368a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 118,
"avg_line_length": 31.727272727272727,
"alnum_prop": 0.7249283667621776,
"repo_name": "Azure/azure-sdk-for-python",
"id": "cfb1f1eb3cd8093f5d4b71b0c0b53b57687c406c",
"... |
"""
byceps.blueprints.admin.shop.storefront.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2022 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from flask import abort, request
from flask_babel import gettext
from .....services.brand import service as brand_servi... | {
"content_hash": "f30ba531e3a78613244b44e6dffc51db",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 85,
"avg_line_length": 30.279693486590038,
"alnum_prop": 0.6765785144881691,
"repo_name": "homeworkprod/byceps",
"id": "7e2e7ef02831016d70763a372f6b6a2a23c6b889",
"size": ... |
import redis
import gaia.config as cfg
config = cfg.load_config('app.yaml') or cfg.load_config('redis.yaml') or cfg.load_config('redis.json') or cfg.load_config('redis.cfg')
client = redis.Redis(**config['redis'])
| {
"content_hash": "5ba184112c2faf1b053b9cd453df253d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 134,
"avg_line_length": 31,
"alnum_prop": 0.7188940092165899,
"repo_name": "caiyunapp/gaiabase",
"id": "00182f9eeae3395dbb350143936067d18655ac3d",
"size": "242",
"binary":... |
"""HTTP authentication-related tests."""
import requests
import pytest
from utils import http, add_auth, HTTP_OK, TestEnvironment
import httpie.input
import httpie.cli
class TestAuth:
def test_basic_auth(self, httpbin):
r = http('--auth=user:password',
'GET', httpbin.url + '/basic-auth/u... | {
"content_hash": "77ac182c7afe39ae0898ca4bc084be98",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 37.38709677419355,
"alnum_prop": 0.588869715271786,
"repo_name": "Irdroid/httpie",
"id": "5a94ad94098d2bca5042742151fb8a1aa0051396",
"size": "2318",
... |
from __future__ import annotations
import inspect
from typing import (
Callable,
Hashable,
)
import warnings
import numpy as np
from pandas._libs import (
index as libindex,
lib,
)
from pandas._typing import (
Dtype,
npt,
)
from pandas.util._decorators import (
cache_readonly,
doc,
)
... | {
"content_hash": "accf259a9fc6544c24773911c1b8962b",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 88,
"avg_line_length": 31.831353919239906,
"alnum_prop": 0.5959256771882695,
"repo_name": "datapythonista/pandas",
"id": "d114fe47fa0f1aa2e965979478111cf715e97360",
"size"... |
'''A trivial python program with experimental hacks to demonstrate usage of Git'''
#I don't know Python very well so this might break things
for i in range(0,10):
print(i)
print("hello, world, I can count!") #official K&$ style hello world
| {
"content_hash": "89d225103f3c4aaae57a8521fe2ddd70",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 82,
"avg_line_length": 30.75,
"alnum_prop": 0.7235772357723578,
"repo_name": "rgmerk/version-control-example-Monash",
"id": "ee55a443b5e2eed5e9475eb8275ba06adcb59bd5",
"size... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import random
from airflow import settings
from airflow.models import Connection
from airflow.exceptions import AirflowException
from airflow.utils.log.logging... | {
"content_hash": "1078a4e5294ab9a46da513283822abb9",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 75,
"avg_line_length": 28.36904761904762,
"alnum_prop": 0.6311372219890894,
"repo_name": "janczak10/incubator-airflow",
"id": "92313ca2671307786e0b6ed7a24c55c2781fc95f",
"s... |
"""Base bolt for integration tests"""
import copy
from heron.common.src.python.utils.log import Log
from heronpy.api.bolt.bolt import Bolt
from heronpy.api.stream import Stream
from heronpy.api.component.component_spec import HeronComponentSpec
import heron.common.src.python.pex_loader as pex_loader
from ..core impor... | {
"content_hash": "e5cdd2ab0b24f4d00d49a505967f3199",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 97,
"avg_line_length": 38.567567567567565,
"alnum_prop": 0.6757766876897922,
"repo_name": "twitter/heron",
"id": "89a06b58fc10e98af68dae3ee8524df4f6976eec",
"size": "5131"... |
from nose.tools import assert_true, assert_false, assert_raises
try:
from nose.tools import assert_is_instance, assert_dict_equal
except ImportError:
from landlab.testing.tools import assert_is_instance, assert_dict_equal
from six import StringIO
from landlab.core import load_params
from landlab.testing.tools ... | {
"content_hash": "444f5af1cdae0bd98fb6d6e4d7630692",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 75,
"avg_line_length": 26.244444444444444,
"alnum_prop": 0.6477561388653683,
"repo_name": "RondaStrauch/landlab",
"id": "50213e75d04d33423d1f30edb4ee6c57df48f915",
"size": ... |
"""
Demonstrates fetching id3 information for a song
Note: sudo pip install mutagen
eg: ./020-id3.py "data/06 Cliantro Vision.mp3"
"""
import argparse
from mutagen.easyid3 import EasyID3
def main():
parser = argparse.ArgumentParser(description='Download some videos')
parser.add_argument('song', type=str, nargs=... | {
"content_hash": "ea4ca42404e95d1e063b18b442373b0e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 87,
"avg_line_length": 21.76923076923077,
"alnum_prop": 0.6890459363957597,
"repo_name": "KitchenTableCoders/cli-video",
"id": "cd33a03f0fb4f5c24b3a3ac67c7318b9428ffd34",
"... |
"""
Class for grids of the two components of the horizontal gradient.
"""
import matplotlib as _mpl
import matplotlib.pyplot as _plt
import copy as _copy
import xarray as _xr
from .shgrid import SHGrid as _SHGrid
class SHGradient(object):
"""
Class for grids of the two components of the horizontal gradie... | {
"content_hash": "c67f98f11ff24448e6b0f8af6b121736",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 79,
"avg_line_length": 49.940677966101696,
"alnum_prop": 0.5664771763108774,
"repo_name": "MarkWieczorek/SHTOOLS",
"id": "f28392f2e8610e8d258959eb11c73d3e62fe5697",
"size"... |
"""
Setup script for Diofant.
This script uses Setuptools (https://setuptools.readthedocs.io/en/latest/).
"""
import setuptools
setuptools.setup()
| {
"content_hash": "2cd967599f0c939edb9eebd7323989b9",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 75,
"avg_line_length": 15.1,
"alnum_prop": 0.7417218543046358,
"repo_name": "skirpichev/omg",
"id": "fa06eee3402f8a5efa47fc993b9af1fe6d4c735c",
"size": "174",
"binary": f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.