text stringlengths 4 1.02M | meta dict |
|---|---|
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render, get_object_or_404, Http404
from django.contrib.auth.decorators import login_required
from .models import Comment
from .forms imp... | {
"content_hash": "287be702393ee8e6700ca91afd093c31",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 82,
"avg_line_length": 34.848101265822784,
"alnum_prop": 0.5909916454776607,
"repo_name": "alien3211/lom-web",
"id": "8f0394cf7bae407b2cd7d77348f6d407eb1a5b8c",
"size": "27... |
"""Miscellaneous file manipulation functions
"""
from __future__ import print_function, division, unicode_literals, absolute_import
from builtins import str, bytes, open
from future import standard_library
standard_library.install_aliases()
import sys
import pickle
import gzip
import hashlib
from hashlib import md5
... | {
"content_hash": "f62b1bff33f47904f86a4d0e6ccd2a9f",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 82,
"avg_line_length": 28.514705882352942,
"alnum_prop": 0.5660778751933987,
"repo_name": "carolFrohlich/nipype",
"id": "7cf81c06495b8ea1e002f692cca0c75d0e7cabad",
"size":... |
import ccxt.pro
from asyncio import gather, run
async def symbol_loop(exchange, method, symbol):
print('Starting', exchange.id, method, symbol)
while True:
try:
response = await getattr(exchange, method)(symbol)
now = exchange.milliseconds()
iso8601 = exchange.iso86... | {
"content_hash": "708ca741ff727aa3298e6c4e6bb19c59",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 128,
"avg_line_length": 35.574074074074076,
"alnum_prop": 0.6017699115044248,
"repo_name": "ccxt/ccxt",
"id": "c9ff7d494d68d04871cf1e8cdaa4368a2a59df4d",
"size": "1946",
... |
from google.cloud.bigquery import analyticshub_v1
async def sample_delete_data_exchange():
# Create a client
client = analyticshub_v1.AnalyticsHubServiceAsyncClient()
# Initialize request argument(s)
request = analyticshub_v1.DeleteDataExchangeRequest(
name="name_value",
)
# Make the... | {
"content_hash": "0895de97a70760b60adee5fe206ee408",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 78,
"avg_line_length": 27.352941176470587,
"alnum_prop": 0.7483870967741936,
"repo_name": "googleapis/python-bigquery-analyticshub",
"id": "1ebb980d70eb5950ecd6573abd48a1e218... |
import subprocess
import StringIO
import tempfile
import re
FIRST_RESPONSE_VALUE_REGEX = re.compile('.*\n[ ]+[^ ]+ ([^ ]+).*', re.MULTILINE)
class Dbus(object):
def get_first_response_value(self, std_out):
match = FIRST_RESPONSE_VALUE_REGEX.search(std_out)
if match is not None:
return ... | {
"content_hash": "8763e22b5db78dedd35910a12c617183",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 121,
"avg_line_length": 40.13725490196079,
"alnum_prop": 0.6570591108939912,
"repo_name": "epickrram/controller",
"id": "242f69518a6814ef54d7b7613eb92226922853e6",
"size": ... |
from gensim.models import Word2Vec
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import numpy
from .corrector import correct, prepare_dictionary
class TextProcessor(object):
def __init__(self, language, stopwords_whitelist, word2vec):
"""
Initialize text processor
... | {
"content_hash": "ab203b1169bd06cc4c0bf53912d20854",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 129,
"avg_line_length": 37.21649484536083,
"alnum_prop": 0.5637119113573407,
"repo_name": "b09dan/universities_sentiment",
"id": "36511a9e3f927931d371efc76f87af58155b1ff9",
... |
from __future__ import unicode_literals
from itertools import groupby
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import (
AuthenticationForm,
PasswordResetForm as djangoPasswordResetForm,
)
from django.contrib.auth.tokens import default_token_generato... | {
"content_hash": "a23d5b3e1dafb061081c8cf969577b34",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 78,
"avg_line_length": 31.207142857142856,
"alnum_prop": 0.6241702906843671,
"repo_name": "brasilcomvc/brasilcomvc",
"id": "b41b78238b2db32571e69741531cd521ccec89af",
"siz... |
from beritest_tools import BaseBERITestCase
from nose.plugins.attrib import attr
#
# Test for a control flow problem with a particular version of Cheri2.
# A CP2 instruction followed by a jump caused the jump to be skipped.
#
class test_cp2_cmove_j(BaseBERITestCase):
@attr('capabilities')
def test_cp2_cmove_u... | {
"content_hash": "e7508f32eed9e08507c43bee0b18688c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 102,
"avg_line_length": 40.395348837209305,
"alnum_prop": 0.6902705814622913,
"repo_name": "8l/beri",
"id": "b02e9d6ea6f4672785cd93dc197d21904087410e",
"size": "2915",
"b... |
import os
import dj_database_url
import django
from django.utils import six
gettext = lambda s: s
urlpatterns = []
def _get_migration_modules(apps):
modules = {}
for module in apps:
module_name = '%s.migrations_django' % module
try:
__import__(module_name)
except ImportE... | {
"content_hash": "ec0da9ed4fc71247087d42eef29c722b",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 99,
"avg_line_length": 35.79746835443038,
"alnum_prop": 0.4957567185289958,
"repo_name": "iddqd1/django-cms",
"id": "9180484f089fb47fb6cd72e8318e3e1977bc2dbb",
"size": "11... |
"""
This is our testing framework.
Goals:
* it should be compatible with py.test and operate very similarly (or
identically)
* doesn't require any external dependencies
* preferably all the functionality should be in this file only
* no magic, just import the test file and execute the test functions, that's it
* port... | {
"content_hash": "030585bf117f0e91d3b7ed92d8aa0046",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 95,
"avg_line_length": 33.009049773755656,
"alnum_prop": 0.5104866346812885,
"repo_name": "gnulinooks/sympy",
"id": "cd514e2aa170250691f95adf2f310748f0c161e7",
"size": "21... |
__author__ = 'orhan'
class UnionFind(object):
def __init__(self, n):
self.n = n
self.__initArray()
def __initArray(self):
self.arr = [i for i in xrange(self.n)]
def connect(self, item1, item2):
raise Exception("Not implemented")
def parent(self, index):
rais... | {
"content_hash": "c3c887a279d99724c68604da70b3416f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 55,
"avg_line_length": 22.4,
"alnum_prop": 0.5915178571428571,
"repo_name": "ocozalp/Algorithms",
"id": "3a51f2f4ee4c697b11320df5e99251dab72c20eb",
"size": "448",
"binary... |
import sys
import os
import numpy as np
import pathlib
import itk
def custom_callback(name, progress):
if progress == 0:
print(f"Loading {name}...", file=sys.stderr)
if progress == 1:
print("done", file=sys.stderr)
import itkConfig
itkConfig.ImportCallback = custom_callback
# test setting... | {
"content_hash": "36e3ded2a9aa52d8f2f5bfa8a29b76b8",
"timestamp": "",
"source": "github",
"line_count": 613,
"max_line_length": 90,
"avg_line_length": 34.58727569331158,
"alnum_prop": 0.6863031789453825,
"repo_name": "vfonov/ITK",
"id": "89839eb3ffec265f23e2d89bd27e2c4c260f6c76",
"size": "21998",
... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('monitor', '0006_auto_20180809_1109'),
]
operations = [
migrations.AddField(
model_name='portlog',
name='host',
field=mod... | {
"content_hash": "851bf5e187b6930d10136abaea7e7fd5",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 111,
"avg_line_length": 25.176470588235293,
"alnum_prop": 0.6191588785046729,
"repo_name": "chonpz28/django-monitor",
"id": "060ec6610c044a2119946a64143cfdafbf7d9144",
"siz... |
"""
Lexer generate tokens for parsing.
"""
from typing import List
from src.token import Token, TokenType
from src.source import BaseSource
from src.exceptions import InvalidTokenException
KEYWORDS = ("if", "else", "case", "while",
"do", "break", "continue", "return", "switch",
"default", "int... | {
"content_hash": "eaaea4f150f250cd984c647db07f8790",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 133,
"avg_line_length": 41.247191011235955,
"alnum_prop": 0.547534731680741,
"repo_name": "Thrimbda/Thrive-Compiler",
"id": "d067d14c27e694d7fed1f98bfbc800afadf58141",
"si... |
from designateclient import exceptions as designate_exception
from designateclient.v1 import records
import mock
from heat.engine.resources.openstack.designate import record
from heat.engine import stack
from heat.engine import template
from heat.tests import common
from heat.tests import utils
sample_template = {
... | {
"content_hash": "361d2ac2b5d68dc6c5bdb4d9963ff67c",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 79,
"avg_line_length": 35.667870036101085,
"alnum_prop": 0.5467611336032389,
"repo_name": "noironetworks/heat",
"id": "747ed51e8e21ac628239ba6f95e3c4b04f153039",
"size": "... |
"""Makes sure that the app/ code is cpplint clean."""
INCLUDE_CPP_FILES_ONLY = (
r'.*\.cc$', r'.*\.h$'
)
EXCLUDE = (
# Autogenerated window resources files are off limits
r'.*resource.h$',
)
def CheckChangeOnUpload(input_api, output_api):
results = []
black_list = input_api.DEFAULT_BLACK_LIST + EXCLUDE
s... | {
"content_hash": "1fd9b58f32d0be1e48ef2411f54a65f4",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 64,
"avg_line_length": 29.05263157894737,
"alnum_prop": 0.697463768115942,
"repo_name": "rwatson/chromium-capsicum",
"id": "b15b852b6b30c1210f4a4743cf23023505212c64",
"size... |
from __future__ import absolute_import, unicode_literals
from celery import Celery
app = Celery('celery')
app.config_from_object('config.settings.celery', namespace='CELERY')
app.autodiscover_tasks()
| {
"content_hash": "0eded2134f0a2a87c369cace27d4354c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 68,
"avg_line_length": 25.375,
"alnum_prop": 0.7684729064039408,
"repo_name": "artinnok/django-default-skeleton",
"id": "3b312d4b47d13092829e6e75d08d889a55f697f0",
"size": "... |
import os
import sys
import arcpy
try:
if (sys.version_info[0] < 3): # _winreg has been renamed as (winreg) in python3+
from _winreg import *
else:
from winreg import *
except ImportError as e:
print ('winreg support is disabled!\n{}'.format(e))
from datetime import datetime
from ... | {
"content_hash": "4900ce5bc64b674c3a000739366a685d",
"timestamp": "",
"source": "github",
"line_count": 871,
"max_line_length": 187,
"avg_line_length": 37.20206659012629,
"alnum_prop": 0.5021448631299571,
"repo_name": "Esri/mdcs-py",
"id": "f907b12b9258d2e421d17690f6a2ae3b7f95354c",
"size": "33408"... |
from __future__ import print_function
import numpy as np
from statsmodels.regression.linear_model import OLS, GLSAR
from statsmodels.tools.tools import add_constant
from statsmodels.datasets import macrodata
import statsmodels.regression.tests.results.results_macro_ols_robust as res
d2 = macrodata.load(as_pandas=Fals... | {
"content_hash": "54e148e9543e48879b562d4b0dd2555e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 30.063492063492063,
"alnum_prop": 0.6837381203801478,
"repo_name": "ChadFulton/statsmodels",
"id": "5252ff228473a5b5f62bba7c1f67801f52cb9ed5",
"size"... |
"""
Created on Mon Nov 7 15:03:00 2016
dHocTD implementation
@author: leno
"""
from adhoc import AdHoc
import math
import random
import actions
class AdHocTD(AdHoc):
logAdv = False
logAsk = []
logAdvice = []
def __init__(self,agentIndex,alpha=0.2,gamma=0.9,T=0.4,budgetAsk = 350,budgetAdv = 350):
... | {
"content_hash": "9334effb833a4d97d591a0086209d420",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 135,
"avg_line_length": 35.474747474747474,
"alnum_prop": 0.5506833712984055,
"repo_name": "cowhi/HFO",
"id": "c7b4622c6c4fb93328728dbb48f78505a32b624c",
"size": "3536",
... |
def main():
maxRange = int(raw_input("What is the max range of numbers you want tested for being prime? "))
numRange= range(3, maxRange +1, 2) #currently has composites, they will be removed @end of program
primes = [2]
while numRange:
repeat = 1
guess = numRange[0]
pr... | {
"content_hash": "a216c4a6d2afe8da4a6aadc992350f14",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 103,
"avg_line_length": 28.434782608695652,
"alnum_prop": 0.5229357798165137,
"repo_name": "Ic3Venom/primefinder",
"id": "231fbdd517b2a90a2d31ffba809da42198ec884e",
"size":... |
import hashlib
import json
import re
from enum import Enum
from os import listdir, makedirs
from os.path import dirname, isfile, join, realpath
import jsonschema
import yaml
from jinja2 import Environment, PackageLoader
from yaml import MarkedYAMLError
from binary import FixedEntryListTypes, FixedLengthTypes, FixedLi... | {
"content_hash": "5fe61cae087f30e94fa2beccefc83395",
"timestamp": "",
"source": "github",
"line_count": 576,
"max_line_length": 104,
"avg_line_length": 38.470486111111114,
"alnum_prop": 0.6026445236698407,
"repo_name": "mmedenjak/hazelcast-client-protocol",
"id": "f07375836b749e12db7d746a2af9d94a9dbc... |
from collections import OrderedDict
import functools
import os
import re
from typing import (
Dict,
Mapping,
Optional,
Iterable,
Iterator,
Sequence,
Tuple,
Type,
Union,
)
import warnings
import pkg_resources
from google.api_core import client_options as client_options_lib
from googl... | {
"content_hash": "2ec352a429c52780bfd16f2bc904b146",
"timestamp": "",
"source": "github",
"line_count": 2629,
"max_line_length": 107,
"avg_line_length": 41.7527577025485,
"alnum_prop": 0.5875027330369507,
"repo_name": "googleapis/sphinx-docfx-yaml",
"id": "6f08e2792e1a65b5bed7ce0c07bcc0a34fc38912",
... |
from emd_functions import * | {
"content_hash": "e43d1d8bbe635fb79f9f5d99fe64e398",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 27,
"avg_line_length": 27,
"alnum_prop": 0.8148148148148148,
"repo_name": "parkus/emd",
"id": "1645515561301330600546652feeefd6f05509c4",
"size": "27",
"binary": false,
... |
from django.db import models
class Paste(models.Model):
name = models.CharField(max_length=128)
code = models.TextField(blank=True)
def __unicode__(self):
return "paste number "+str(self.pk)
| {
"content_hash": "467524383ad5a8fb700b60a00baca073",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 40,
"avg_line_length": 22.11111111111111,
"alnum_prop": 0.7236180904522613,
"repo_name": "piratos/paste",
"id": "294cea7694a7f320ce2d30e4679d7b78b90203e5",
"size": "199",
... |
import unittest
import bmemcached
class DistributedClientHashingTest(unittest.TestCase):
def test_get_server_is_consistent(self):
key = 'the_key'
servers = ['localhost:11211', 'localhost:11212', 'localhost:11213']
for _ in range(10):
client = bmemcached.DistributedClient(serve... | {
"content_hash": "413fd16f7edaca3c02e843827b89d31b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 75,
"avg_line_length": 32.5,
"alnum_prop": 0.6743589743589744,
"repo_name": "jaysonsantos/python-binary-memcached",
"id": "87bea13fb2577defc4736ee23574cd7d0bbd8f74",
"size"... |
import pytest
from .as_status_codes import AerospikeStatus
from .index_helpers import ensure_dropped_index
from .test_base_class import TestBaseClass
from aerospike import exception as e
import aerospike
class TestIndex(object):
@pytest.fixture(autouse=True)
def setup(self, request, as_connection):
f... | {
"content_hash": "f3c83494dabc69a9308880de9eef9f53",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 113,
"avg_line_length": 40.470338983050844,
"alnum_prop": 0.6196209820961156,
"repo_name": "aerospike/aerospike-client-python",
"id": "f298fd6c9f106b5cc1ea5ff0fec40d0bda2fe7... |
from sympy.core.symbol import symbols
from sympy.printing.ccode import ccode
from sympy.codegen.ast import Declaration, Variable, float64, int64
from sympy.codegen.cnodes import (
alignof, CommaOperator, goto, Label, PreDecrement, PostDecrement, PreIncrement, PostIncrement,
sizeof, union, struct
)
x, y = symbo... | {
"content_hash": "ee743594fe8919ad4a84b01d26bcab4c",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 98,
"avg_line_length": 25.68,
"alnum_prop": 0.589563862928349,
"repo_name": "kaushik94/sympy",
"id": "3050fffa1a2f9afdc36c0baa5116b244517d6136",
"size": "2568",
"binary"... |
from GUI.PopUps.FileSavingDialogPopUp import FileSavingDialogPopUp
from kivy.logger import Logger
from Utils.FileHandler import write_file, get_filename_only
class ProjectCopyDialogPopUp(FileSavingDialogPopUp):
FOLDER_NAME = "project folder"
DISMISS_BTN_TEXT = "Cancel"
def __init__(self, source, destinati... | {
"content_hash": "e1006d6a542f3aaca92fcce86fd29e2a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 95,
"avg_line_length": 44.758620689655174,
"alnum_prop": 0.539291217257319,
"repo_name": "RemuTeam/Remu",
"id": "cbd14d1597b2a604920db0a3dd3617567ac2b109",
"size": "1298",
... |
"""
Plot function module for basic facts.
"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
plt.style.use('ggplot')
import matplotlib as mpl
bl = '#58ACFA'
def plot_attack_ferq_per_year(attacks):
plt.subplots(figsize=(15,6))
sns.countplot(attacks['Ye... | {
"content_hash": "eb8982535984f2179214e473b897e6b7",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 141,
"avg_line_length": 34.9296875,
"alnum_prop": 0.7219861328561843,
"repo_name": "mdeff/ntds_2017",
"id": "23f8163979d74b4043072d250ad5b6cf5b0d5124",
"size": "4471",
"... |
import re
import ipdb # noqa
marker_pattern = re.compile(r'[\(](\d+)x(\d+)[\)]')
compressed = ''
remaining = ''
decompressed = ''
with open('input.txt', 'r') as input_file:
remaining = compressed = input_file.read().strip()
# iterative partial decompression
while remaining:
match = marker_pattern.search(re... | {
"content_hash": "8f9ceaad4a53e2245fe7c80d1fd51bd7",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 75,
"avg_line_length": 30.945454545454545,
"alnum_prop": 0.6139835487661575,
"repo_name": "Apreche/advent2016",
"id": "f900530f2ded906d53ce080e5380bcb314e42b11",
"size": "1... |
import array
from pymaging.colors import Color
from pymaging.affine import AffineTransform
from pymaging.exceptions import FormatNotSupported, InvalidColor
from pymaging.formats import get_format, get_format_objects
from pymaging.helpers import get_transformed_dimensions
from pymaging.pixelarray import get_pixel_array
... | {
"content_hash": "ad5c80b001a7beabf0303cbf8a7ca26e",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 107,
"avg_line_length": 35.24463519313305,
"alnum_prop": 0.5482221139795421,
"repo_name": "wdv4758h/ZipPy",
"id": "69577bd7b05a4638a5a5c9ca6744ecb57a99cbed",
"size": "9765... |
import os
import time
try:
from pysqlite2 import dbapi2 as sqlite
vi = sqlite.version_info
if vi[0] > 2 or vi[1] > 6:
# latest pysqlite breaks anki
raise ImportError()
except ImportError:
from sqlite3 import dbapi2 as sqlite
Error = sqlite.Error
class DB(object):
def __init__(self... | {
"content_hash": "6d1ac753d34764804ad454d6c8aa2bb1",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 61,
"avg_line_length": 26.00943396226415,
"alnum_prop": 0.5070729053318824,
"repo_name": "jlitven/vexer",
"id": "6b596b6bef9c77e66f86a08bea93b7f993fce519",
"size": "2904",... |
import urllib.request
import collections
import string
import itertools
# Get the input data from the problem webpage
url = 'http://www.pythonchallenge.com/pc/def/ocr.html'
with urllib.request.urlopen(url) as response:
html = response.read().decode('utf-8')
data = html.split('<!--')[2].strip('\n-->')
print(f'Input ... | {
"content_hash": "0f58c1d0db5eb674500519eb3e049003",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 99,
"avg_line_length": 36.53846153846154,
"alnum_prop": 0.7010526315789474,
"repo_name": "medwig/pythonchallenge-solutions",
"id": "c7141d2e08cd819767b51675f38b6ee060df205d",... |
from functools import partial
import unittest
##
# test helpers
#
from testutils import mock
##
# promise modules
#
from promise import Promise
class PromiseTestCase(unittest.TestCase):
def setUp(self):
self.d = mock.Mock()
def test_init_expects_one_arg_1(self):
self.assertRaises(TypeError... | {
"content_hash": "b3851ce44fae899dbae54375fd19dcc4",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 73,
"avg_line_length": 25.826923076923077,
"alnum_prop": 0.6358897989575577,
"repo_name": "michalbachowski/pypromise",
"id": "5395d63960e256eed0cad5447d57946585e2f2b7",
"si... |
"""
Created on Tue May 31 16:56:03 2016
@author: login
"""
from GEO_Database import GEO_Database
mystic_lake = GEO_Database(name="test_db", TestBool=True, BuildBool=True)
mystic_lake.read_combined_URL_list()
mystic_lake.download_data(type="metadata")
mystic_lake.write_metadata_table(tags = ['RangeDateTime', 'Granule... | {
"content_hash": "52e62117367c68f2da12e67ff8a1abba",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 31.6875,
"alnum_prop": 0.7593688362919132,
"repo_name": "karoraw1/GLM_Wrapper",
"id": "997aa495550dd07adaf5d836893162d72c3fb3fc",
"size": "531",
"b... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AutomaticLink',
fields=[
('id', models.AutoField(verbose_name='ID', ser... | {
"content_hash": "2ca8e9d8d4545ab531815c43264360ae",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 204,
"avg_line_length": 49,
"alnum_prop": 0.5801749271137027,
"repo_name": "silentsokolov/django-automatic-links",
"id": "89bd2f593cba6cf4cb2f381f12787c5e9a027d24",
"size":... |
from setuptools import setup, find_packages
from setuptools.command.test import test as test_command
from sped import __version__
class PyTest(test_command):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
test_command.initialize_options(self)
... | {
"content_hash": "f1ae5cd321aa53b9ee981d72d01910a3",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 118,
"avg_line_length": 33.07843137254902,
"alnum_prop": 0.6378186129223473,
"repo_name": "mileo/python-sped",
"id": "969ac7b53e36d84b769ed3c19257b94b65e299a6",
"size": "16... |
"""Sub command to manage trained generators associated with your account.
Run `hazy generator --help` for usage.
"""
import click
@click.group()
def generator():
'''Manage trained generators associated with your account.
'''
@generator.command()
def train():
'''Train a new generator with your data.
... | {
"content_hash": "24dea87781377a3062d952ab1a48117e",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 21.155555555555555,
"alnum_prop": 0.680672268907563,
"repo_name": "anon-ai/toolbelt",
"id": "d26a9dc80220ab9689db1ab0b77ce02900613b16",
"size": "952"... |
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from threading import local
USER_ATTR_NAME = getattr(settings, 'LOCAL_USER_ATTR_NAME', '_current_user')
_thread_locals = local()
def _do_set_current_user(user_fun):
setattr(_thread_locals, USER_ATTR_NAME, user_fun.__get__(user... | {
"content_hash": "1bfb61659bb225d3bdcf46042bbe45dc",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 78,
"avg_line_length": 26.683333333333334,
"alnum_prop": 0.6658338538413492,
"repo_name": "PaesslerAG/django-currentuser",
"id": "dec921f316336144d089387662a52aa5f30884fa",
... |
import getopt
import os
import re
import shlex
import sys
from lxml import etree as ET
from lxml.cssselect import CSSSelector
from sh import parseopt
def pxml(root, method="xml"):
if type(root) is list:
dummy = ET.Element("results")
for n in root:
dummy.append(n)
root = dummy
print(ET.tostri... | {
"content_hash": "b80b9c9f4f96779eabeb07b1b13e00ef",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 60,
"avg_line_length": 18.436363636363637,
"alnum_prop": 0.6173570019723866,
"repo_name": "spiralx/mypy",
"id": "86e30af0f967bfcfd221e4b494e749ef378a3029",
"size": "1015",
... |
import sys
# This sequence will get a lot cleaner for Python 3, for which the necessary
# flags should all be in the os module.
import ctypes
flags = ctypes.RTLD_GLOBAL
try:
import DLFCN
flags |= DLFCN.RTLD_NOW
except ImportError:
flags |= 0x2 # works for Linux and Mac, only platforms I care about now.
sy... | {
"content_hash": "5397255895fe868f756f77ea8ff6e5cb",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 77,
"avg_line_length": 27.875,
"alnum_prop": 0.742152466367713,
"repo_name": "TallJimbo/python-cpp-challenge",
"id": "976f54f4b2b64e7957b1758e172d8eed566b2861",
"size": "44... |
import atexit
import functools
import socket
import warnings
import weakref
import time
# So that 'setup.py doc' can import this module without Tornado or greenlet
requirements_satisfied = True
try:
from tornado import iostream, ioloop
except ImportError:
requirements_satisfied = False
warnings.warn("Torna... | {
"content_hash": "b32befda3d29b9a95a870e18ba00cd29",
"timestamp": "",
"source": "github",
"line_count": 681,
"max_line_length": 80,
"avg_line_length": 34.57856093979442,
"alnum_prop": 0.5814081875318499,
"repo_name": "ContextLogic/mongoengine",
"id": "fd72c4e519ffa0c60272c24f1202ebdfe5edc0cc",
"siz... |
""" Tests for VPN in VPC
"""
# Import Local Modules
from marvin.codes import PASS, FAILED
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import (validateList,
wait_until)
from marvin.lib.base import (Account,
VPC,
... | {
"content_hash": "7c413a8fdf4affeecb13fd8c65ab914e",
"timestamp": "",
"source": "github",
"line_count": 1572,
"max_line_length": 167,
"avg_line_length": 38.80279898218829,
"alnum_prop": 0.531427259910161,
"repo_name": "GabrielBrascher/cloudstack",
"id": "26b1daf946f05a188fc0be0dfd4ed1117e7740ea",
"... |
import responses
import json
from .helpers import mock_file, ClientTestCase
class TestClientPayment(ClientTestCase):
def setUp(self):
super(TestClientPayment, self).setUp()
self.base_url = '{}/payments'.format(self.base_url)
@responses.activate
def test_payment_all(self):
result... | {
"content_hash": "2f81eb3e552645c475517818c50c50fe",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 110,
"avg_line_length": 40.56573705179283,
"alnum_prop": 0.5696326851306227,
"repo_name": "razorpay/razorpay-python",
"id": "0440f94ffd2e8435421ee37f54e2e759f495bc09",
"si... |
from django.contrib import admin
from django.contrib.admin.sites import AlreadyRegistered
from .models import HOTPDevice
class HOTPDeviceAdmin(admin.ModelAdmin):
"""
:class:`~django.contrib.admin.ModelAdmin` for
:class:`~django_otp.plugins.otp_hotp.models.HOTPDevice`.
"""
fieldsets = [
('... | {
"content_hash": "c9fc0f3a8f6ed030659274deabfdbbd7",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 60,
"avg_line_length": 25.29032258064516,
"alnum_prop": 0.5956632653061225,
"repo_name": "robintema/django-otp",
"id": "aec1538ed0d98b95f980fd3d8b7044a62678ae73",
"size": "... |
import operator
def sze(cores, input_tasks):
tasks = []
for task, (p, k, c) in enumerate(input_tasks):
tasks.append((task, p, k - p - c, c))
tasks.sort(key=operator.itemgetter(2))
time = 0
while True:
available_cores = cores
unfinished_tasks = []
for task, start, ... | {
"content_hash": "2012719997cfb4207d3db771c7e9126e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 68,
"avg_line_length": 28.62162162162162,
"alnum_prop": 0.46175637393767704,
"repo_name": "grucin/Potyczki-Algorytmiczne-2016",
"id": "4d369a3b25e3ed8b1da769271574734434b5aa5... |
"""
Given low and high limits on the Wilson coefficients c_j, produce
gridpacks for a grid of points with dimensionality equal to the
number of coeffients, and each axis spanning low < c_j < high.
"""
from __future__ import print_function
import argparse
import os
import re
import shutil
import subprocess
import nump... | {
"content_hash": "b3ed3336e2f463b816267338307a0131",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 116,
"avg_line_length": 43.36842105263158,
"alnum_prop": 0.6834546925566343,
"repo_name": "annawoodard/EffectiveTTVProduction",
"id": "34acf1498595a4636a2dfd33ef501edde551c6... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General conf... | {
"content_hash": "d2bd4c3258355ca9a3d04b62fbbfa849",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 80,
"avg_line_length": 30.91167192429022,
"alnum_prop": 0.7055822022655373,
"repo_name": "amikrop/pokercore",
"id": "af8391d85a1e5e16fd18dc4f624efc3b6cf558ac",
"size": "10... |
from django.apps import AppConfig
from .utils import load_all_tasks
class DjangoLightweightQueueConfig(AppConfig):
name = 'django_lightweight_queue'
def ready(self) -> None:
load_all_tasks()
| {
"content_hash": "564a8db02436c2160f515d51c0944f6e",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 46,
"avg_line_length": 21.1,
"alnum_prop": 0.7203791469194313,
"repo_name": "thread/django-lightweight-queue",
"id": "07a4c999bcadb575a6663e1fda4c306cd096d206",
"size": "21... |
'''
Unit tests for MergePairSelector.py
Verifies that we can successfully select components to merge
'''
import numpy as np
import unittest
from bnpy.learnalg import MergeTracker
from bnpy.learnalg import MergePairSelector
class TestMergePairSelector(unittest.TestCase):
def shortDescription(self):
return None
... | {
"content_hash": "15399ba1e0d46efb0c7b620cdcfcc44b",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 90,
"avg_line_length": 31.855555555555554,
"alnum_prop": 0.66829438437391,
"repo_name": "daeilkim/refinery",
"id": "cc67e18d687ce5703e25ad63c282e9d753e43a80",
"size": "2867... |
from __future__ import absolute_import, division, print_function
import sys
try:
from ez_setup import use_setuptools
use_setuptools()
except ImportError:
# Try to use ez_setup, but if not, continue anyway. The import is known
# to fail when installing from a tar.gz.
print('Could not import ez_setu... | {
"content_hash": "f8b73b9d37eab9fadd6ec790c698bf17",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 77,
"avg_line_length": 28.173333333333332,
"alnum_prop": 0.628490298154283,
"repo_name": "posita/stone",
"id": "894e52ea28c59dd20f550c81bd67944a24da216f",
"size": "2240",
... |
import sqlite3
import bcrypt
import os
import htpasswd
import re
from email.utils import parseaddr
from . import config
# ------------------------------------------------------------------------------
BCRYPT_ROUNDS = 5
DATABASE = config.DB_DATABASE
PASSWDFILE = config.DB_PASSFILE
EMAIL_REGEX = re.compile(r"[^@ ]+@[^@... | {
"content_hash": "c1fff92cbe772e333d304e7176e53385",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 80,
"avg_line_length": 28.304347826086957,
"alnum_prop": 0.47043010752688175,
"repo_name": "TRUFA-rnaseq/trufa-users-sqlite",
"id": "c65b7ebbfda607cef84c65f3f5d5ea5cf2b46703... |
"""System utils in python"""
| {
"content_hash": "55df2a01dd97963bbafc740f9c28ea89",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 28,
"avg_line_length": 29,
"alnum_prop": 0.6551724137931034,
"repo_name": "thorwhalen/ut",
"id": "6412074bf1b989355dccdaf199767667b1e09d33",
"size": "29",
"binary": false,... |
"""
homeassistant.components.group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to group devices that can be turned on or off.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/group/
"""
import homeassistant.core as ha
from homeassistant.const im... | {
"content_hash": "b440b41cae0567bfb679d1c6cae23e2f",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 79,
"avg_line_length": 29.910344827586208,
"alnum_prop": 0.5786257781876873,
"repo_name": "coteyr/home-assistant",
"id": "3d157f32eea9cf58dae83d68dad26daad905b5fb",
"size"... |
import subprocess
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from splinter.driver.webdriver import BaseWebDriver, WebDriverElement as BaseWebDriverElement
from splinter.driver.webdriver.cookie_manager import CookieManager
class WebDriver(BaseWebDriver... | {
"content_hash": "102ae3e27511a6da05d2b858718452a5",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 93,
"avg_line_length": 30.88235294117647,
"alnum_prop": 0.6680952380952381,
"repo_name": "softak/webfaction_demo",
"id": "4be1c45bfaa8aa53d0e537d792a21335c0bd8dcf",
"size":... |
"""Encoders that use time series inputs to predict SEIR terms."""
import abc
import logging
import sys
from typing import List
import numpy as np
import tensorflow as tf
from covid_epidemiology.src import constants
from covid_epidemiology.src.models.shared import feature_utils
class VariableEncoder(abc.ABC):
"""Enc... | {
"content_hash": "122b048a787a59ed54fa04101ed07c96",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 84,
"avg_line_length": 39.37220843672456,
"alnum_prop": 0.6512258145837272,
"repo_name": "google-research/google-research",
"id": "78bc4a43c6f7c6abb8a9ab205547408fe7c1cd6a",... |
from gurobipy import *
from datetime import datetime
def read_input_csv(filename):
row_header, matrix, col_header = list(), dict(), set()
with open(filename) as f:
for csvline in f:
csvline = csvline.strip()
if len(row_header) == 0:
row_header = csvline.split(',... | {
"content_hash": "183b04a66d96533381272eed590db7a1",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 138,
"avg_line_length": 33.52105263157895,
"alnum_prop": 0.5638247762600094,
"repo_name": "bbalegere/MILP-Interview-Scheduler",
"id": "9290b87ebb22ca6666e9c3aec0635666cfdfa4... |
"""Tests for the repository class."""
import os
import tempfile
from pybel import to_bel_script, to_nodelink_file, to_pickle
from pybel.examples import egf_graph
from pybel.repository import BELRepository
from pybel.testing.cases import TemporaryCacheMixin
class TestRepository(TemporaryCacheMixin):
"""Tests for... | {
"content_hash": "223f7ecf135040d7c38b74121ec7827c",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 35.69642857142857,
"alnum_prop": 0.5637818909454727,
"repo_name": "pybel/pybel",
"id": "a0fd2a40f304a5d1ef1b3690fec197eb17815efb",
"size": "2024",
... |
import random
class Menu(object):
"""
Handles menu options
"""
def __init__(self):
self._current_index = 0
self._keys = []
self._items = {}
def __len__(self):
return len(self._keys)
def append(self, name, item):
self._keys.append(name)
self._items[name] = item
@property
... | {
"content_hash": "49a1ab27c733e99d61acc67152bcbb70",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 72,
"avg_line_length": 18.381818181818183,
"alnum_prop": 0.6211671612265084,
"repo_name": "mattgrogan/ledmatrix",
"id": "253f1ae0f8b191ef519603ad88d4c5e06bd2a744",
"size": ... |
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | {
"content_hash": "65472590121e4b7e7b39f8fae84a95e2",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 81,
"avg_line_length": 28.640287769784173,
"alnum_prop": 0.6114041698065813,
"repo_name": "RNAcentral/rnacentral-import-pipeline",
"id": "2b2d81d68efec277ef84c107aab2037acd6... |
"""dli_powerswitch.py unit tests."""
from unittest import mock
from gazoo_device.auxiliary_devices import dli_powerswitch
from gazoo_device.tests.unit_tests.utils import dli_powerswitch_logs
from gazoo_device.tests.unit_tests.utils import fake_device_test_case
from gazoo_device.utility import host_utils
from gazoo_dev... | {
"content_hash": "20bc08dd0308036bff92cee22a30a7be",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 77,
"avg_line_length": 38.94845360824742,
"alnum_prop": 0.7088406564319746,
"repo_name": "google/gazoo-device",
"id": "e5d53dbbb442d2b512e4d5b6502db5c2e0bbb85b",
"size": "4... |
"""Support testing with Pytest."""
import logging
import os
import pytest
from asgi_tools.tests import ASGITestClient, manage_lifespan
def pytest_addoption(parser):
"""Append pytest options for testing Muffin apps."""
parser.addini("muffin_app", "Set path to muffin application")
parser.addoption(
... | {
"content_hash": "25d16305fe5eb896ed8f4f53e42b88f7",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 86,
"avg_line_length": 29.28767123287671,
"alnum_prop": 0.6543498596819457,
"repo_name": "klen/muffin",
"id": "483fb2f456359bfbb8a20b2a878acabe308902a3",
"size": "2138",
... |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from lamson import commands, utils as lamson_utils
class Command(BaseCommand):
help = 'Stops the lamson daemon'
option_list = BaseCommand.option_list + (
make_option('--kill',
action='store... | {
"content_hash": "35e4fce5961df0dd97ab64f1a951328b",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 104,
"avg_line_length": 28.083333333333332,
"alnum_prop": 0.533135509396637,
"repo_name": "vvangelovski/django-lamson",
"id": "5229ad75159d95da1c6f8c7b12384444ff71fe8d",
"s... |
from __future__ import print_function, division, absolute_import
from struct import pack
from ..message import BulkFrontendMessage
class SslRequest(BulkFrontendMessage):
message_id = None
SSL_REQUEST = 80877103
def read_bytes(self):
bytes_ = pack('!I', self.SSL_REQUEST)
return bytes_
| {
"content_hash": "56b2dc2f48391708196dd692316a48e2",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 22.714285714285715,
"alnum_prop": 0.7012578616352201,
"repo_name": "uber/vertica-python",
"id": "8604cf7d5b3abfb293a110bffc06e44f84a87fcf",
"size": "... |
import functools
import unittest
from taskflow import states
from taskflow import task
from taskflow import wrappers
from taskflow.patterns import linear_workflow as lw
def null_functor(*args, **kwargs):
return None
class LinearWorkflowTest(unittest.TestCase):
def makeRevertingTask(self, token, blowup=Fal... | {
"content_hash": "78c04593fefae771fa73393d5bafbac1",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 76,
"avg_line_length": 32.153225806451616,
"alnum_prop": 0.5758715826435917,
"repo_name": "JohnGarbutt/TaskFlow",
"id": "4ad37d7212dd6e0d328ab579aded2470e56b27f3",
"size":... |
import functools
import inspect
import math
import time
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils import excutils
from oslo_utils import strutils
import six
import webob
import webob.exc
from jacket.api.openstack import api_version_... | {
"content_hash": "839f49771910b50b599593298a50f5db",
"timestamp": "",
"source": "github",
"line_count": 1418,
"max_line_length": 79,
"avg_line_length": 36.903385049365305,
"alnum_prop": 0.595004681916337,
"repo_name": "HybridF5/jacket",
"id": "6ec60b66a6016f2dd3cb9876de69d2f46e65ce9f",
"size": "529... |
from .base import Plugin
from ..canvastools import RectangleTool
from ...viewer.widgets import SaveButtons
__all__ = ['Crop']
class Crop(Plugin):
name = 'Crop'
def __init__(self, maxdist=10, **kwargs):
super(Crop, self).__init__(**kwargs)
self.maxdist = maxdist
self.add_widget(SaveB... | {
"content_hash": "6e74d1634ebaa7daed4581cf495a2579",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 29.514285714285716,
"alnum_prop": 0.5721200387221684,
"repo_name": "newville/scikit-image",
"id": "04a853213859d0e90be342a9430a21ff11a11cbf",
"size":... |
import importlib
import logging
import random
import string
from time import strftime
import sys
import os
from os.path import dirname, abspath
formatter = logging.Formatter(
fmt='%(asctime)s.%(msecs)03d %(levelname)s %(message)s',
datefmt='%d.%m.%Y %H:%M:%S'
)
# from stackoverflow.com/a/11233293/2474159
def... | {
"content_hash": "2a3563a57f390051fda4706fc8c640a7",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 107,
"avg_line_length": 34.81132075471698,
"alnum_prop": 0.6905149051490515,
"repo_name": "nathbo/GO_DILab",
"id": "390632d8e65a89d3c8402afb134f0a24c4a706c1",
"size": "1845... |
from __future__ import annotations
import ctypes
from dataclasses import dataclass, field
from typing import *
from ctypes import *
from rich.pretty import pprint
import json
import logging
import builtins
import base64
import chip.exceptions
from chip import ChipDeviceCtrl
import copy
from .storage import PersistentS... | {
"content_hash": "fd051ae31d228b58daa25024bbd4869a",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 199,
"avg_line_length": 40.34959349593496,
"alnum_prop": 0.6510175297199274,
"repo_name": "project-chip/connectedhomeip",
"id": "97a729035f811e58a1f4b643c598d4a6d6450337",
... |
"""ZenIRCBot API"""
# These are at the top to ensure gevent can monkey patch before
# threading gets imported.
from gevent import monkey
monkey.patch_all()
import atexit
import json
import gevent
from redis import StrictRedis
__version__ = '2.2.7'
def load_config(name):
""" Loads a JSON file and returns an obj... | {
"content_hash": "4defa21784db4a53b01c4d87331c0ea9",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 85,
"avg_line_length": 39.236607142857146,
"alnum_prop": 0.48833769484583,
"repo_name": "zenirc/zenircbot-api-python",
"id": "87fb55abd0e2b925377852a0f99f14c8539933c6",
"s... |
import logging
import os
from pathlib import Path
import click
from platformio import fs
from platformio.package.exception import UnknownPackageError
from platformio.package.manager.library import LibraryPackageManager
from platformio.package.manager.platform import PlatformPackageManager
from platformio.package.mana... | {
"content_hash": "8d42dfaed4e9e21f57ed5b3475d81d24",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 88,
"avg_line_length": 36.44701986754967,
"alnum_prop": 0.6298718997001908,
"repo_name": "platformio/platformio",
"id": "9bbe9505ff92c3febba365c6f2a1c9adf5003c29",
"size":... |
import unittest
class TestPolyStruct (unittest.TestCase):
def test_tetrahedron (self):
pstruct = CrankShape.PolyStruct ()
pstruct.set_nvertices (4)
pstruct.add_face_vertex_array ([0, 2, 1])
pstruct.add_face_vertex_array ([3, 0, 1])
pstruct.add_face_vertex_array ([3, 1, 2])... | {
"content_hash": "b764ff9998a1b4a85ec12b1ed1b16205",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 54,
"avg_line_length": 33.27777777777778,
"alnum_prop": 0.5934891485809682,
"repo_name": "WSID/crank-system",
"id": "7416eac3de603130748a26ac1748437a259fe117",
"size": "228... |
import binascii
import pytest
@pytest.fixture
def icmp_packet(simple_capture):
return simple_capture[7]
@pytest.mark.parametrize('access_func', [
lambda pkt: pkt[-1],
lambda pkt: pkt['icmp'],
lambda pkt: pkt['ICMP'],
lambda pkt: pkt.icmp,
])
def test_can_access_layer(icmp_packet, access_func):
... | {
"content_hash": "72be57b909eda1f5385224f4baf5a7c8",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 99,
"avg_line_length": 28.763157894736842,
"alnum_prop": 0.6980786825251601,
"repo_name": "KimiNewt/pyshark",
"id": "72fa68aefd8b3a9af85d2eca99a7dff6d7c46d75",
"size": "109... |
from venster.windows import *
from venster.wtl import *
from venster import comctl
from venster import gdi
from venster import shell
from venster.lib import form
from venster.lib import list
from venster.lib import tray
from venster.lib import menu
FILE_MENU = (MF_POPUP, "&File",
[(MF_STRING, "&... | {
"content_hash": "de28c431d812b21b8bc7872b3c1f9ffa",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 79,
"avg_line_length": 26.327433628318584,
"alnum_prop": 0.5784873949579832,
"repo_name": "toymachine/venster",
"id": "88dd5d614c0932d440057cd41f4108c54a92ad54",
"size": "... |
from __future__ import unicode_literals, print_function, division
__author__ = "mozman <[email protected]>"
# Standard Library
import unittest
# trusted or separately tested modules
from ezodf2.xmlns import etree, CN
# objects to test
from ezodf2.base import GenericWrapper
TEXT_NS = "urn:oasis:names:tc:open... | {
"content_hash": "82d0d7e4e66981e0ef48963947d97fef",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 112,
"avg_line_length": 34.426008968609864,
"alnum_prop": 0.6079197603230428,
"repo_name": "iwschris/ezodf2",
"id": "3667fe002422c88508c0e773a0addc5cd1b35a9b",
"size": "78... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wmdadict', '0013_auto_20170824_2204'),
]
operations = [
migrations.AlterField(
model_name='emdisfield',
name='field_descript... | {
"content_hash": "1ce1eefd5a514cd3f6c8cedf2016147e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 51,
"avg_line_length": 21.944444444444443,
"alnum_prop": 0.6050632911392405,
"repo_name": "antmont/wmda-stuff",
"id": "906fa7e625a6fb6b323f61bd23c1b0ef899afa3c",
"size": "4... |
import argparse
import os
import pwd
import signal
import subprocess
import sys
import traceback
from urllib.parse import urlunparse
# check for the venv
from lib import sanity_check
sanity_check.check_venv(__file__)
from tornado import httpclient
from tornado import httputil
from tornado import gen
from tornado imp... | {
"content_hash": "81177191be1e30ccfb5f1a4d6e8e2f5f",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 93,
"avg_line_length": 34.81455399061033,
"alnum_prop": 0.6202548715528285,
"repo_name": "tommyip/zulip",
"id": "4b3e978bd347bfe818f1d92f24a1fdf37fe0bbaa",
"size": "14855"... |
from rapp_robot_api_motion import Motion
class DeviceMotion(Motion):
def __init__(self, parameters):
pass
def enableMotors(self):
return {'error': 'Not implemented yet'}
def disableMotors(self):
return {'error': 'Not implemented yet'}
def moveByVelocity(self, x_vel, y_vel, t... | {
"content_hash": "52edcbbf05cffec541501e904e86f23e",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 65,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.6162420382165605,
"repo_name": "rapp-project/rapp-robots-api",
"id": "354977a8c6c63201cbb95f343aefa75042053260",
... |
import sys
from PyQt5.QtWidgets import QApplication, QWidget
import pandas as pd
import tables
import cv2
import numpy as np
import matplotlib
matplotlib.use("Qt5Agg")
import matplotlib.pylab as plt
import h5py
if getattr(sys, 'frozen', False):
print('Frozen.')
print(sys._MEIPASS)
else:
print('Not frozen.... | {
"content_hash": "3855eb2bd44d020e3c6e14a0902a46f1",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 55,
"avg_line_length": 19.645833333333332,
"alnum_prop": 0.630965005302227,
"repo_name": "ver228/tierpsy-tracker",
"id": "71523b00d159daae5d08cecf545a60fb1fe553fe",
"size":... |
'''
Created on Jul 11, 2012
@author: joseph
'''
from http_client import HttpClient
import urllib,urllib2,hashlib
class User():
def __init__(self):
self.http = HttpClient()
def login(self,loginData):
signup_url = "http://localhost/signup/"
xsrf = self.http.getXsrf(signu... | {
"content_hash": "09b08679eb56f255b57cc5a394589292",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 66,
"avg_line_length": 25.257142857142856,
"alnum_prop": 0.5520361990950227,
"repo_name": "ptphp/PyLib",
"id": "a7b233f15f665f69809e3e5692abaeb34d8343c3",
"size": "1814",
... |
import helper
import common
from actions_menu import actions_menu
from data_provider import data_provider
from control_recorder import ControlRecorder
from localization import *
from recordings import *
class RecordingsMenu(object):
# private fields
channel_list_ = []
recording_list_ = []
def __init__(self):
... | {
"content_hash": "3e3e0412d151f3e52de50fbc27a39ff5",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 119,
"avg_line_length": 34.58620689655172,
"alnum_prop": 0.7324692588899967,
"repo_name": "cpaton/dvblink-plex-client",
"id": "73ebc5077bd30c62235186837f5b13c41ccdb4fe",
"s... |
from surrogate.selection.tests.test_individuals import Individuals
individuals = Individuals()
from surrogate.selection import selDoubleTournament
print '\nTest selection.selDoubleTournament: selDoubleTournament'
print '\tInput: ind=\t' + '\t'.join(map(str, individuals)) + ''
out = selDoubleTournament(individuals=l... | {
"content_hash": "9de58160f76309626cd7933d4e44a105",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 84,
"avg_line_length": 45.90909090909091,
"alnum_prop": 0.7623762376237624,
"repo_name": "DailyActie/Surrogate-Model",
"id": "ff4ccadafbc7cf87001b9074d5675149df07ff3a",
"si... |
import pygame
from pygame.locals import *
from vector2 import Vector2
from random import *
import math
class Vex():
"""
Vector sprite class (consider renaming) - consists of a list of points which
are rendered relative to an x and y at draw time
@author: James Heslin (PROGRAM_IX)
"""
r... | {
"content_hash": "9da1e062743ea849944335b17f427063",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 86,
"avg_line_length": 33.296052631578945,
"alnum_prop": 0.5322400052690509,
"repo_name": "PROGRAM-IX/pystroke",
"id": "d89dabd841c2bfd8c9e55e2f27f246a75dc594b1",
"size": ... |
import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="tickvals", parent_name="choropleth.colorbar", **kwargs
):
super(TickvalsValidator, self).__init__(
plotly_name=plotly_name,
par... | {
"content_hash": "e71ff29ff8d66d1a9b75fd4a9fb45d22",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 81,
"avg_line_length": 33.38461538461539,
"alnum_prop": 0.619815668202765,
"repo_name": "plotly/plotly.py",
"id": "4be520f8198523ff483d8f403370c5117fea8c48",
"size": "434",... |
class Environment():
def __init__(self):
##initialize environmental variables:
self.objects = []
self.ground = Plane(0,0,0,100,100)
self.objects.append(self.ground)
def update(self):
##print("Update Environment...")
self.animate()
def animate(self):
fo... | {
"content_hash": "218ff4f8dfefc7f96804ec384371b98a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 60,
"avg_line_length": 30.227272727272727,
"alnum_prop": 0.5473684210526316,
"repo_name": "ultimatedeath11/VandyHacks2017",
"id": "787068850bbad95f7437ac7bf51c8dc6a8c08512",
... |
"""
This is the code to accompany the Lesson 2 (SVM) mini-project.
Use a SVM to identify emails from the Enron corpus by their authors:
Sara has label 0
Chris has label 1
"""
# enable python 3 style printing
from __future__ import print_function
import sys
from time import time
sys.path.append(".... | {
"content_hash": "09dbfa13bd147dc526cf4928f2024b94",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 87,
"avg_line_length": 28.618181818181817,
"alnum_prop": 0.6766200762388819,
"repo_name": "stefanbuenten/nanodegree",
"id": "1187fce6c7725de5f70599a3eaf67386c8db5d5e",
"siz... |
import os
##############################################################################
# setup environment setup
def setup(i):
"""
Input: {
cfg - meta of this soft entry
self_cfg - meta of module soft
ck_kernel - import CK kernel module ... | {
"content_hash": "cd4e00ddbbc3bae1a5373a1c3207a350",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 78,
"avg_line_length": 24.936708860759495,
"alnum_prop": 0.46751269035532994,
"repo_name": "ctuning/ck-env",
"id": "b43aabac17cd7e44932eb490fcf8055e5d5a2a03",
"size": "2134... |
"""
Test installation of the Quotient offering, as well as testing
signup with different combinations of selected benefactor factories
"""
from time import time
from twisted.trial.unittest import TestCase
from twisted.python.reflect import qual
from axiom.scripts import axiomatic
from axiom.store import Store
from a... | {
"content_hash": "f40779c6e800a0e899385dd5af8085bc",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 92,
"avg_line_length": 32.89915966386555,
"alnum_prop": 0.6610472541507024,
"repo_name": "twisted/quotient",
"id": "c762f4be6db752ec413c9782ce94a363b079178f",
"size": "391... |
import pytest
from distutils.version import LooseVersion
from f5.bigip.resource import MissingRequiredCreationParameter
from f5.bigip.tm.security.shared_objects import Address_List
from f5.bigip.tm.security.shared_objects import Port_List
from requests.exceptions import HTTPError
DESC = 'TESTADDED'
@pytest.fixture... | {
"content_hash": "44eb1862ab7e619c15ca900cc4258b0e",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 148,
"avg_line_length": 42.18468468468468,
"alnum_prop": 0.6367325146823278,
"repo_name": "F5Networks/f5-common-python",
"id": "b79ecbb3ddbe5da90ffbc681b63ef55bdfd6263f",
... |
from __future__ import print_function
import os
import sys
sys.setrecursionlimit(10000)
import time
import json
import argparse
import densenet
import tensorflow as tf
import math
import numpy as np
import pandas as pd
import cv2
from tqdm import tqdm
import scipy
from sklearn.metrics import fbeta_score
from sklearn.... | {
"content_hash": "8710dc421768dc4d953c08e8b6c9ff12",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 146,
"avg_line_length": 32.5141065830721,
"alnum_prop": 0.6566718087157732,
"repo_name": "root-master/DenseNet-Kaggle-Planet",
"id": "5eb1e2b3408a95ccfc052f1a48d412590188247... |
import signify.pure as signify
import unittest
class SignifyTest(unittest.TestCase):
KAT = [
{
'pub': b"""untrusted comment: bjorntest public key
RWQ100QRGZoxU+Oy1g7Ko+8LjK1AQLIEavp/NuL54An1DC0U2cfCLKEl
""",
'priv': b"""untrusted comment: bjorntest secret key
RWRCSwAAACqHVbmAUokJc... | {
"content_hash": "c28131e80d495e880b5bf74e3543898a",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 216,
"avg_line_length": 40.0650406504065,
"alnum_prop": 0.6034902597402597,
"repo_name": "bjornedstrom/python-signify",
"id": "f8fb85e1e7c271b013d859a7e25bcb5d8c7b1310",
"... |
from __future__ import unicode_literals
import os.path
import subprocess
from pre_commit.util import cmd_output
class PrefixedCommandRunner(object):
"""A PrefixedCommandRunner allows you to run subprocess commands with
comand substitution.
For instance:
PrefixedCommandRunner('/tmp/foo').run(['{... | {
"content_hash": "9387d6e365d450804a6561a5c3837c54",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 27.94,
"alnum_prop": 0.5977093772369363,
"repo_name": "philipgian/pre-commit",
"id": "6ae850997c1a2f5281debce5ff484dde747cfb33",
"size": "1397",
"b... |
import web
from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.v1.handlers.base import CollectionHandler
from nailgun.api.v1.handlers.base import SingleHandler
from nailgun.api.v1.handlers.base import content_json
from nailgun.api.v1.validators.node_group import NodeGroupValidator
from nailgun.db i... | {
"content_hash": "18800729eb7a3fe2a79e9104fdb8b496",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 72,
"avg_line_length": 25.847058823529412,
"alnum_prop": 0.6149294492489759,
"repo_name": "andrei4ka/fuel-web-redhat",
"id": "31e92728903af5da5a4a27bc737268a8896c30bd",
"si... |
"""Package contenant la commande 'autoquête' et ses sous-commandes.
Dans ce fichier se trouve la commande même.
"""
from primaires.interpreteur.commande.commande import Commande
from .edit import PrmEdit
from .liste import PrmListe
class CmdAutoquete(Commande):
"""Commande 'autoquête'.
"""
... | {
"content_hash": "ba426c75094abdf68089d9241ad1ef46",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 69,
"avg_line_length": 28.344827586206897,
"alnum_prop": 0.6386861313868614,
"repo_name": "vlegoff/tsunami",
"id": "3eda6e18865857e246879bf4470780e9726f6b62",
"size": "2401... |
import re, getpass
from kokoropy import request
from kokoropy.model import DB_Model, or_, and_, Column, ForeignKey, func,\
Integer, String, Date, DateTime, Boolean, Text, relationship, backref, association_proxy
from _config import session, encrypt_password
from _all import engine, Cms, Group, Third_Party_Authentic... | {
"content_hash": "f62599b98776503ba3cf9ca34d916b1a",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 141,
"avg_line_length": 43.951388888888886,
"alnum_prop": 0.46974245536419656,
"repo_name": "goFrendiAsgard/kokoropy",
"id": "19b29c8dacef3f55ea7260d49069d7d2390576b4",
"s... |
from collections import OrderedDict
import json
import logging
import sys
import django
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME # noqa
from django.core.urlresolvers import reverse
from django.forms import widgets
from django import http
import django.test
from django.utils... | {
"content_hash": "c9f18af3ff8acac25ac5c7db2238ce69",
"timestamp": "",
"source": "github",
"line_count": 4915,
"max_line_length": 82,
"avg_line_length": 45.099287894201424,
"alnum_prop": 0.5334404027735797,
"repo_name": "Tesora-Release/tesora-horizon",
"id": "cf828e51811a368d1e93a236b9f83ff1ddcb41f1",... |
"""This module contains the ListConverter class."""
from dc.converters.base import Converter
class ListConverter(Converter):
"""Converter used to store a list in a data connector.
We need this converter because the list is not a 'list' object, but a
model.represent.dc_list.DCList object, whereas... | {
"content_hash": "3edb1beb57a237f3cf89421a0afd4989",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 73,
"avg_line_length": 28.88888888888889,
"alnum_prop": 0.6730769230769231,
"repo_name": "v-legoff/pa-poc3",
"id": "6c5b8272985ed4bddb9e69158bc06cf9ad05a511",
"size": "2063... |
"""Global registry for OpDefs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from mxconsole.protobuf import op_def_pb2
_registered_ops = {}
def register_op_list(op_list):
"""Register all the ops in an op_def_pb2.OpList."""
if not isinstance(op_... | {
"content_hash": "46387ddc64d0788fc1d65ceb4e928264",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 58,
"avg_line_length": 27.074074074074073,
"alnum_prop": 0.6621067031463749,
"repo_name": "bravomikekilo/mxconsole",
"id": "c39f5094b9bf134bc8e718a1a4f167f84087923f",
"size... |
from common.api.permissions import IsStaffOrTeamCaptain
# from common.api.serializers import PlayerMembershipSerializer
from common.models import Position, SkillBracket, TeamMember
# from teamfinder.api.serializers import PlayerMembershipSerializer, TeamSerializer
from teams.api.serializers import EditableFlatTeamSeria... | {
"content_hash": "999ff93e2aa536baa7503875b5e6ddbe",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 119,
"avg_line_length": 44.15,
"alnum_prop": 0.6521328803322008,
"repo_name": "prattl/teamfinder-api",
"id": "ac0b5b93513a19f0d82eede20030a78d1d9645fe",
"size": "5298",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.