text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
import maillib
class BasicTests(unittest.TestCase):
def test_body(self):
msg = maillib.Message.from_string(RAW_MESSAGE)
self.assertEqual(msg.body, u'test\n')
def test_html(self):
msg = maillib.Message.from_string(RAW_MESSAGE)
self.assertEqual(msg.html, u'test\n'... | {
"content_hash": "6bcff6b130f635d98bca401dbb9025b1",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 74,
"avg_line_length": 27.022727272727273,
"alnum_prop": 0.7325483599663583,
"repo_name": "jkocherhans/maillib",
"id": "3850083bd4cff9eb065e6d9dffb3ef94e0240191",
"size": "... |
from os import mkdir
from os.path import join
from fsyscall.share import FSLAVE_SYSCALLS, SYSCALLS, Variable, \
bufsize_of_datatype, data_of_argument, \
concrete_datatype_of_abstract_datatype, \
drop_pointer... | {
"content_hash": "475a0336dd35a0f8ce833e5889d36a17",
"timestamp": "",
"source": "github",
"line_count": 443,
"max_line_length": 81,
"avg_line_length": 32.47178329571106,
"alnum_prop": 0.5635036496350365,
"repo_name": "SumiTomohiko/fsyscall2",
"id": "8864f1bb827f6c0a4bf0c5667fac5754428f388b",
"size"... |
import importlib
import traceback
from pathlib import Path
from functools import partial
from multiprocessing import cpu_count
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
import yaml
import requests
from pandas import DataFrame, concat
from .anomaly import detect_anomaly_all, detect_stale_col... | {
"content_hash": "b2889b405d0477e5bbaf70997bd13c96",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 100,
"avg_line_length": 43.04714640198511,
"alnum_prop": 0.6228960110675582,
"repo_name": "GoogleCloudPlatform/covid-19-open-data",
"id": "286644c21d73cc305a64013125ad68ae3a... |
from sklearn import neighbors, svm, linear_model
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import numpy as np
import xgboost as xgb
from sklearn.grid_search import GridSearchCV
from sklearn.metrics import accuracy_score
class ML:
def __init_... | {
"content_hash": "835857bbbcb6580460e6906a5338fd47",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 142,
"avg_line_length": 48.98738170347003,
"alnum_prop": 0.5498744284886342,
"repo_name": "simonward86/MySJcLqwwx",
"id": "ea0136912eb68a59512420a1e10fe7ebf0de2564",
"size... |
import os
import signal
import subprocess
from unittest import mock
from django.db.backends.postgresql.client import DatabaseClient
from django.test import SimpleTestCase
class PostgreSqlDbshellCommandTestCase(SimpleTestCase):
def _run_it(self, dbinfo):
"""
That function invokes the runshell com... | {
"content_hash": "eaa87aec92b225df09a6c531279899c4",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 84,
"avg_line_length": 34.621848739495796,
"alnum_prop": 0.4766990291262136,
"repo_name": "fenginx/django",
"id": "40d2deae6235f8b76a4f988470ba4adc6285adbb",
"size": "4122... |
frenchFries, salads, sandwiches, wraps, totalPrice = 10, 6, 4, 5, 118.5
| {
"content_hash": "28c2a5cf1c30af95e0eb8aa6882527b3",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 71,
"avg_line_length": 72,
"alnum_prop": 0.7083333333333334,
"repo_name": "the-zebulan/CodeWars",
"id": "3e91bc1cf95439437802b275759357cc9483f802",
"size": "72",
"binary":... |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
MAX_UNCHANGE_COUNT = 100
STATE_INIT_PULL_DOWN = 1
STATE_INIT_PULL_UP = 2
STATE_DATA_FIRST_PULL_DOWN = 3
STATE_DATA_PULL_UP = 4
STATE_DATA_PULL_DOWN = 5
def read_dht11_dat(params):
GPIO.setup(params.pin, GPIO.OUT)
GPIO.output(params.pin, GPIO.HIGH)
... | {
"content_hash": "0ddceb864ed62acae5a0d08937ffd9a7",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 81,
"avg_line_length": 26.35593220338983,
"alnum_prop": 0.5157556270096463,
"repo_name": "cyrillegin/Aquaponics",
"id": "a87b039634054935ae2d6e7cfe4d5d82cabf2599",
"size":... |
"""
State changes for accounts.
Also, the account is the aggregate root for invoices and charges,
so the creation of those is managed here.
"""
from collections import defaultdict
from datetime import date
from decimal import Decimal
from typing import DefaultDict, Dict, List, Optional, Sequence, Tuple
from uuid impo... | {
"content_hash": "88a7566bd2f408ba5613d9dceddea0f6",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 118,
"avg_line_length": 36.52328767123288,
"alnum_prop": 0.6463881179206361,
"repo_name": "skioo/django-customer-billing",
"id": "32a57b38cc1cebbfd4104f7df2223224f34c2a98",
... |
from __future__ import division
from otree.common import Currency as c, currency_range, safe_json
from . import models
from ._builtin import Page, WaitPage
from .models import Constants
class Choice1(Page):
form_model = models.Player
form_fields = ['first_choice']
def vars_for_template(s... | {
"content_hash": "9bb777d3c14741772fc6b06ab0e6a337",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 88,
"avg_line_length": 32.76729559748428,
"alnum_prop": 0.6024952015355086,
"repo_name": "ogaway/ExEcon",
"id": "2f97f9c892cffc621bcf0697002272f40536273b",
"size": "5235",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('finance', '0006_auto_20141125_0121'),
]
operations = [
migrations.RenameModel(
old_name='WeekDay',
new_name='WeekNumber',
... | {
"content_hash": "89918b267899fadbee0f26b8e0c1ec32",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 47,
"avg_line_length": 19.705882352941178,
"alnum_prop": 0.5940298507462687,
"repo_name": "junqueira/balance",
"id": "36c9bb0990c234e503213c84569227e73cd2d59b",
"size": "35... |
"""
Exception raised when depended on another request and that request failed.
"""
from rinzler.exceptions import RinzlerHttpException
__author__ = ["Rinzler<github.com/feliphebueno>", "4ndr<github.com/4ndr>"]
class FailedDependencyException(RinzlerHttpException):
"""
FailedDependencyException
"""
st... | {
"content_hash": "8ee6121348f3e2ed1736479db4520b02",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 26.928571428571427,
"alnum_prop": 0.7374005305039788,
"repo_name": "feliphebueno/Rinzler",
"id": "ff1d8195650b1161c3436c8fb4d3d084ba565277",
"size": ... |
from twilio.rest import TwilioRestClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)
client.sip \
.ip_addresses("AL32a3c49700934481addd5ce1659f04d2") \
.delet... | {
"content_hash": "05de0c223957461d85abb849ef7cc5b1",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 62,
"avg_line_length": 36,
"alnum_prop": 0.7972222222222223,
"repo_name": "teoreteetik/api-snippets",
"id": "9c70bab7bed57d8a1adcaa01d57c3b5cb6055bd4",
"size": "433",
"bi... |
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from proton import Message
from system_test import Logger, TestCase, Qdrouterd, main_module, unittest, TIMEOUT, TestTimeout, PollTimeout
from proton.handlers import Messa... | {
"content_hash": "93ea151850cb7abbc6180385f8471f7e",
"timestamp": "",
"source": "github",
"line_count": 597,
"max_line_length": 135,
"avg_line_length": 39.62311557788945,
"alnum_prop": 0.5446628619742127,
"repo_name": "bhardesty/qpid-dispatch",
"id": "36d7a91ab6de37f9581f83e1c7afb5e87ed30ef9",
"siz... |
from __future__ import unicode_literals
from hy import HyString
from hy.models import HyObject
from hy.compiler import hy_compile
from hy.errors import HyCompileError, HyTypeError
from hy.lex.exceptions import LexException
from hy.lex import tokenize
from hy._compat import PY3
import ast
def _ast_spotcheck(arg, roo... | {
"content_hash": "ddb426f586a01d7ca39acb856d4b08fa",
"timestamp": "",
"source": "github",
"line_count": 571,
"max_line_length": 78,
"avg_line_length": 28.430823117338004,
"alnum_prop": 0.5998521621288654,
"repo_name": "jakirkham/hy",
"id": "9a1a05e72485d38ee0580d9eb9bd9d8f3fd03e73",
"size": "17408"... |
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
@api_view(['GET'])
def api_root(request, format=None):
return Response({
'deployments': reverse('deployment-list', request=request, format=format),
'images': revers... | {
"content_hash": "dab28470672bc5a03e96198cf1440b78",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 92,
"avg_line_length": 58.095238095238095,
"alnum_prop": 0.6901639344262295,
"repo_name": "wathsalav/xos",
"id": "4ac267a01dbf0ad888d886d0665a33ff478aa09f",
"size": "1220",... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trips', '0009_auto_20160924_0206'),
]
operations = [
migrations.AddField(
model_name='article',
name='domain',
f... | {
"content_hash": "2c7fdfd43aa71187be84e1d954c33def",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 22.166666666666668,
"alnum_prop": 0.5964912280701754,
"repo_name": "MianBot/site",
"id": "e4fccd7e4e1f319b47e1dbb888c935a8b75e76dd",
"size": "470",
... |
from app.app_and_db import app, db
from app.startup.init_app import init_app
import os
from flask_sslify import SSLify
from OpenSSL import SSL
from flask_user import UserManager, SQLAlchemyAdapter
from app.users.models import User
init_app(app, db)
#sslify = SSLify(app)
from werkzeug.contrib.fixers import ProxyFix
ap... | {
"content_hash": "bf11a6252c69cb5f145de1a0135cbb5a",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 53,
"avg_line_length": 29.2,
"alnum_prop": 0.7488584474885844,
"repo_name": "TheRushingWookie/MotivateOpen",
"id": "e006c3345c2e0fc4e3cd16ff23410f5d169051dd",
"size": "686"... |
import sys
import itertools, collections
import tree
try:
_, parsefilename, goldfilename = sys.argv
except:
sys.stderr.write("usage: evalb.py <parse-file> <gold-file>\n")
sys.exit(1)
def _brackets_helper(node, i, result):
i0 = i
if len(node.children) > 0:
for child in node.children:
... | {
"content_hash": "e862926d6491c2d40fd3600b2ea6320e",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 83,
"avg_line_length": 30.9,
"alnum_prop": 0.6653721682847896,
"repo_name": "zaycev/pcfg_parser",
"id": "c62178128f7cadbde6fef1f147d9b575d858ba61",
"size": "1568",
"binar... |
import queue
ROOM_ENTERED = 'roomEntered'
class Event:
def __init__(self, eventType='', userParam=dict()):
self.type = eventType
self.userParam = userParam
class EventSystem:
def __init__(self):
self._eventQueue = queue.Queue()
self._eventHandlers = dict()
def registerE... | {
"content_hash": "9a4b3b47f3990bdf597d6ec2ea0d9484",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 80,
"avg_line_length": 31.138461538461538,
"alnum_prop": 0.6388339920948617,
"repo_name": "JeFaProductions/TextAdventure2",
"id": "706720f9584247fe1387ca09ddee93c7af47920a",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('orders', '0002_auto_20151025_1910'),
]
operations = [
migrations.CreateModel(
name='UserAddress',
fields=[
(... | {
"content_hash": "60e6b755eecd906ce585f4f396bdc20e",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 119,
"avg_line_length": 35.48,
"alnum_prop": 0.5625704622322435,
"repo_name": "abhijitbangera/ecommerce",
"id": "2baafe5c77282356aa1a288da384462ad056e69e",
"size": "911",
... |
import random
import engine
from network import server
from network import service
from protocols import gate_to_game
from protocols import game_to_gate
class Connection:
def __init__(self):
self.gameid = None
def connection_made(self):
print('game connection made')
def connection_lost(self):
print('game ... | {
"content_hash": "db62da76cc6be46a5dcf682fbeea69e4",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 65,
"avg_line_length": 25.602739726027398,
"alnum_prop": 0.7142857142857143,
"repo_name": "dennisding/ether",
"id": "2b39f3d550d5e20829a01ea7faeebf646389975b",
"size": "189... |
from __future__ import unicode_literals
from collections import OrderedDict
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.db.models import Manager
from django.db.models.query import QuerySet
from django.urls import NoReverseMatch, Resolver404, get_script_prefix, resolve
from ... | {
"content_hash": "e310c84dbc1c5a31f849622d6b49e99c",
"timestamp": "",
"source": "github",
"line_count": 536,
"max_line_length": 90,
"avg_line_length": 36.51865671641791,
"alnum_prop": 0.6163277817513028,
"repo_name": "jpadilla/django-rest-framework",
"id": "22078e64a4f620d3d8ab835ba6c065c2cb0a0d8d",
... |
import sublime
from sublime_plugin import WindowCommand
from ..git_command import GitCommand
from ...common import util
NO_REMOTES_MESSAGE = "You have not configured any remotes."
START_PUSH_MESSAGE = "Starting push..."
END_PUSH_MESSAGE = "Push complete."
PUSH_TO_BRANCH_NAME_PROMPT = "Enter remote branch name:"
SET_... | {
"content_hash": "1b2817a278768a66af8b6c468d414d48",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 106,
"avg_line_length": 33.984771573604064,
"alnum_prop": 0.5856609410007468,
"repo_name": "asfaltboy/GitSavvy",
"id": "a8934684840c80e8323c38c3bae7d1e2f0eaebc9",
"size": ... |
__engines__ = {}
def get_engine_list():
return sorted(__engines__.keys())
def get_engine(name, default=None):
return __engines__.get(name, default)
def register_engine(name, engine):
__engines__[name] = engine
# maybe an engine should be a class that supports two methods:
# "process" and "documentation... | {
"content_hash": "d5238b311281675160b4d7a7fe21b8d7",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 85,
"avg_line_length": 29.321428571428573,
"alnum_prop": 0.6766138855054811,
"repo_name": "gdamjan/vezilka",
"id": "44402c2c30bb359ed57126ec92c59eca850dc802",
"size": "1667... |
from ScrollText import ScrollText
from Tkinter import *
from Prolog import PrologException
from FastIndex import FastIndex
import ErrDialog
import re
import AnnotationColours
import sets
#import Colour
import parser
def startCompare(x, y):
(xLine, xCol) = x[1].split('.')
(yLine, yCol) = y[1].split('.')
if xLi... | {
"content_hash": "1b10c6a7c400eb0399542eda66de778f",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 138,
"avg_line_length": 31.821958456973295,
"alnum_prop": 0.5014919806042522,
"repo_name": "leuschel/logen",
"id": "b8587cbd804fae40899011a96360a5b0916c3197",
"size": "107... |
import requests
# Do work within JSON
import json
# Set our Auth URL
auth_url = 'https://identity.api.rackspacecloud.com/v2.0/tokens'
# Set our Openstack User Name
user_name = '<SOMEUSERID>'
# Set our Openstack API Key
api_key = '<SOMERAXAPIKEY>'
# Create some basic Headers
basic_headers = {'Content-Type': 'ap... | {
"content_hash": "370f330b85958ef754a43d09a72a87af",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 64,
"avg_line_length": 19.169811320754718,
"alnum_prop": 0.6692913385826772,
"repo_name": "os-cloud/intros",
"id": "38d171221f690219f7bf843cd4ae3ba6e6c9f5d9",
"size": "1037... |
import io
import os
import re
from setuptools import setup, find_packages
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
) as fp:
return fp.read()
def find_version(*file_paths):
version_file... | {
"content_hash": "0465ff8040dd672cebf19611474794c8",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 99,
"avg_line_length": 32.45454545454545,
"alnum_prop": 0.6211484593837535,
"repo_name": "thinkAmi/django-auth-ldap3-ad-backend",
"id": "67592aab6086a7d3386afb471a5d88ca57572... |
import networkx as nx
from scipy.spatial import ConvexHull
import matplotlib.pyplot as plt
import logging
from django.db import transaction
import qmpy
from qmpy.utils import *
from . import phase
from .reaction import Reaction
from .equilibrium import Equilibrium
logger = logging.getLogger(__name__)
if qmpy.FOUND_... | {
"content_hash": "d4e66a025277b5a824826eeeeb972144",
"timestamp": "",
"source": "github",
"line_count": 1783,
"max_line_length": 103,
"avg_line_length": 32.004486819966345,
"alnum_prop": 0.503539885041357,
"repo_name": "wolverton-research-group/qmpy",
"id": "5e22832dfee835728f2d8da40e258b636d951ed7",... |
"""Scalyr Agent Plugin Module - Windows Process Metrics
This module extends the ScalyrMonitor base class to implement it's functionality, a process
metrics collector for the Windows (Server 2003 and newer) platforms, as a monitor plugin into
the Scalyr plugin framework.
The two most important object in this monitor a... | {
"content_hash": "02756f26f21312308fc7f55b4f29c36b",
"timestamp": "",
"source": "github",
"line_count": 672,
"max_line_length": 350,
"avg_line_length": 38.572916666666664,
"alnum_prop": 0.5639057135141391,
"repo_name": "scalyr/scalyr-agent-2",
"id": "ca9639fb4355361ff1f42be172d06c31ab7b542b",
"size... |
import matplotlib.pyplot as plt
import numpy as np
def center_data(X, cols_to_center):
"""
Parameters:
@X {2D numpy array} dataset with variables to be centered
@cols_to_center {list} list of columns (i.e., variables to center)
Return:
@centered_data {2D numpy array} the dataset, but... | {
"content_hash": "0cd36c343b140460d148d7ee9f80ac3b",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 85,
"avg_line_length": 35.388888888888886,
"alnum_prop": 0.6335252049537764,
"repo_name": "johnash1990/stat527_final_project",
"id": "af47031f712e14cc80047ca62de32788b808b58... |
from openerp.osv import fields, osv
class stock_warehouse_orderpoint(osv.osv):
_inherit = "stock.warehouse.orderpoint"
_columns = {
'calendar_id': fields.many2one('resource.calendar', 'Calendar',
help="In the calendar you can define the days that the goods will b... | {
"content_hash": "a3449970a5a7050333afa3b2108043e9",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 270,
"avg_line_length": 60.72727272727273,
"alnum_prop": 0.6841317365269461,
"repo_name": "vileopratama/vitech",
"id": "7388990026d5b5081db4e8e966274709c9d52152",
"size": "... |
"""This script is used to download the clang update script. It runs as a
gclient hook.
It's equivalent to using curl to download the latest update script:
$ curl --silent --create-dirs -o tools/clang/scripts/update.py \
https://raw.githubusercontent.com/chromium/chromium/master/tools/clang/scripts/update.py
... | {
"content_hash": "52d22e85b51768aadc0b5e77118d7018",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 94,
"avg_line_length": 28.59016393442623,
"alnum_prop": 0.6972477064220184,
"repo_name": "endlessm/chromium-browser",
"id": "0d707060920f869f74cf48316d679bde73eae869",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('olympic', '0008_add_wa_age_group_categories'),
]
operations = [
migrations.AddField(
model_name='olympicround',
name='team_t... | {
"content_hash": "18640d96a14b779c91958c5709911846",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 139,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.5859213250517599,
"repo_name": "mjtamlyn/archery-scoring",
"id": "74e1ef7fa5e0aea692c100b266550e29e7a8cad3",
"si... |
from django import template
register = template.Library()
def submit_row(context):
"""
Displays the row of buttons for delete and save.
"""
opts = context['opts']
change = context['change']
is_popup = context['is_popup']
save_as = context['save_as']
return {
'show_delete_link'... | {
"content_hash": "d75213deb5f74de8410947855884f099",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 99,
"avg_line_length": 39.91304347826087,
"alnum_prop": 0.6078431372549019,
"repo_name": "brilliant-org/nexus",
"id": "d4ca8302851f22a0722ba13601290ca61ce332c9",
"size": "9... |
"""
Runs GATK best practices pipeline for germline SNP and INDEL discovery.
BWA Alignment
0: Download FASTQ(s) or BAM
1: Align to reference
2: Sort BAM
3: Index Bam
GATK Preprocessing
4: Mark duplicates
5: Indel realignment
6: Base quality score recalibration
7: Apply recalibration
GATK Variant Discovery
8: Call va... | {
"content_hash": "d473dab664b0b9cb43bd1318dcc82935",
"timestamp": "",
"source": "github",
"line_count": 897,
"max_line_length": 120,
"avg_line_length": 45.99888517279822,
"alnum_prop": 0.5701752260003393,
"repo_name": "BD2KGenomics/toil-scripts",
"id": "de7c0fae9dfea46a0cd09b19b29e3a92ebcaf356",
"s... |
__author__ = "Alok Kumar"
from setuptools import setup, find_packages
setup(
name="wc14",
version="0.2",
author="Alok Kumar",
author_email="[email protected]",
url="https://github.com/rajalokan/wc14",
download_url="https://github.com/rajalokan/wc14/archive/0.1.tar.gz",
description=("Comm... | {
"content_hash": "0c9682429581631a3948ea12116f5f5f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 89,
"avg_line_length": 30.05,
"alnum_prop": 0.6505823627287853,
"repo_name": "rajalokan/wc14",
"id": "71e8a1c9dc99ed93dd1f6459b289a901781c4b48",
"size": "624",
"binary": ... |
from __future__ import unicode_literals
import mimetypes
from os import path
import unittest
from django.conf.urls.static import static
from django.http import HttpResponseNotModified
from django.test import SimpleTestCase
from django.test.utils import override_settings
from django.utils.http import http_date
from dj... | {
"content_hash": "85f199899d8b5afea1a5b9631e6a666c",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 104,
"avg_line_length": 40.59836065573771,
"alnum_prop": 0.6367857863920856,
"repo_name": "AlexHill/django",
"id": "34e4021080dd0d7b50325857d3ab50f4cc224854",
"size": "495... |
""" All the sqlite3 functions needed for querying the db (encapsulates the sql code)
DB object used by the data_retriever"""
import os
import sqlite3
import threading
import time
class DB:
def __init__(self):
# establish a connection w/ the database (check_same_thread=False is possibly ske... | {
"content_hash": "d5ef43639d7a41429a169da8ff30bf0a",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 138,
"avg_line_length": 39.08196721311475,
"alnum_prop": 0.49559563758389263,
"repo_name": "operant/knowledge-management",
"id": "985488eb74d49a5d51d3f2dfbb489bc4b9093ffe",
... |
import os
import sys
import time
from sys import platform as _platform
class colors:
red = '\033[31m' # red
blue = '\033[34m' # blue
magenta = '\033[35m' # purple
cyan = '\033[36m' # cyan
reset = "\033[0m"
def main_master():
if _platform == "linux" or _platform == "linux2":
print'[!] ... | {
"content_hash": "ce6c0a4581661791ec44baa7c3a047ec",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 57,
"avg_line_length": 28.867924528301888,
"alnum_prop": 0.5294117647058824,
"repo_name": "triggerNZ/illacceptanything",
"id": "8b6dbf17f581fe3415d8fa3f612c887399b1bebc",
"... |
"""
PostgreSQLConf - file /var/lib/pgsql/data/postgresql.conf
=========================================================
The PostgreSQL configuration file is in a fairly standard 'key = value'
format, with the equals sign being optional. A hash mark (#) marks the
rest of the line as a comment.
The configuration then ... | {
"content_hash": "0373f97717e63f2f3006f2284219b85c",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 84,
"avg_line_length": 37.88202247191011,
"alnum_prop": 0.5642888921844876,
"repo_name": "PaulWay/insights-core",
"id": "629c153e1ddf22f97e2b83c398c28457ed887ed4",
"size":... |
"""Testing for datatset loading."""
# Author: Johann Faouzi <[email protected]>
# License: BSD-3-Clause
import numpy as np
import pytest
from ..load import (load_basic_motions, load_coffee, load_gunpoint,
load_pig_central_venous_pressure)
@pytest.mark.parametrize(
'function, data_train... | {
"content_hash": "46a5390752785dd779abd54867d794dc",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 73,
"avg_line_length": 39.59090909090909,
"alnum_prop": 0.6274397244546498,
"repo_name": "johannfaouzi/pyts",
"id": "63f6d9e1c3dfb8b775ea055ce263faac504c5d8f",
"size": "174... |
default_app_config = 'queue.apps.QueueConfig'
| {
"content_hash": "fe24dfb650450aab029981dba6834c68",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 45,
"avg_line_length": 46,
"alnum_prop": 0.782608695652174,
"repo_name": "ngageoint/scale",
"id": "b87911a66d0c0137763c5c4d66525862e1df9c15",
"size": "46",
"binary": false... |
import numpy as np
import pytest
from pandas.compat import pa_version_under2p0
from pandas.errors import PerformanceWarning
from pandas.core.dtypes.common import is_datetime64tz_dtype
import pandas as pd
import pandas._testing as tm
from pandas.core.api import NumericIndex
from pandas.tests.base.common import allow_... | {
"content_hash": "786b91e1016b95a5287c4855c93ba93e",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 88,
"avg_line_length": 36.61392405063291,
"alnum_prop": 0.6551426101987899,
"repo_name": "datapythonista/pandas",
"id": "eac1e35699585a6a005b653f6668843080588b50",
"size":... |
"""
Customadmin is an application that allow admin interface's customization.
""" | {
"content_hash": "31da16960d90504e9aee38a3d782c5bd",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 74,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.7682926829268293,
"repo_name": "20tab/upy",
"id": "6530665367dd252c629e3d9ab688d11c1870d54f",
"size": "82",
"bin... |
import proto # type: ignore
__protobuf__ = proto.module(
package="google.ads.googleads.v12.errors",
marshal="google.ads.googleads.v12",
manifest={"KeywordPlanCampaignErrorEnum",},
)
class KeywordPlanCampaignErrorEnum(proto.Message):
r"""Container for enum describing possible errors from applying a
... | {
"content_hash": "b31eddc143c11e71fbd6ea674145c6ea",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 72,
"avg_line_length": 24.93548387096774,
"alnum_prop": 0.6429495472186287,
"repo_name": "googleads/google-ads-python",
"id": "c343069718721376c4502ee0602c5faadf98fd50",
"s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: vultr_dns_record
short_description: Manages DNS records on ... | {
"content_hash": "c99adeefd18b17a9d6486425e08a90ba",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 117,
"avg_line_length": 27.002732240437158,
"alnum_prop": 0.5617727410705251,
"repo_name": "thaim/ansible",
"id": "1aec81f60b359a8554dbd61925de6445b8ce10da",
"size": "1006... |
import re
class Preprocess:
def __init__(self):
self.html_regex = re.compile(
r'(http|https)://[a-zA-Z0-9-./"#$%&\':?=_]+')
self.newline_regex = re.compile(r'\n')
self.cont_spaces_regex = re.compile(r'\s+')
def _subs(self, regex: "re obj", repl: str, text: str):
r... | {
"content_hash": "03d1b53fdc0847b2311874d4c5e75894",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 67,
"avg_line_length": 27.670454545454547,
"alnum_prop": 0.5330595482546201,
"repo_name": "kenkov/nlp",
"id": "8960747f3cf742354351d6fdb273f69031d89329",
"size": "2474",
... |
import datreant.core as dtr
import datreant.data.attach
import pandas as pd
import numpy as np
import pytest
import os
import py
from datreant.data.tests import test_data
class TestTreant:
treantname = 'testtreant'
treanttype = 'Treant'
treantclass = dtr.treants.Treant
@pytest.fixture
def treant... | {
"content_hash": "67376ca66137f9272649a2d7f062d70d",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 77,
"avg_line_length": 33.67080745341615,
"alnum_prop": 0.5368013281682347,
"repo_name": "datreant/datreant.data",
"id": "52a8e30e6f9b6d7e527592cfbf6ed365002d6823",
"size"... |
"""
Cmd2 unit/functional testing
"""
import sys
from contextlib import (
redirect_stderr,
redirect_stdout,
)
from typing import (
List,
Optional,
Union,
)
from unittest import (
mock,
)
from pytest import (
fixture,
)
import cmd2
from cmd2.rl_utils import (
readline,
)
from cmd2.utils ... | {
"content_hash": "4e613dd9b80566223dc54a1a6b09f8e6",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 122,
"avg_line_length": 38.1413612565445,
"alnum_prop": 0.5478380233356211,
"repo_name": "python-cmd2/cmd2",
"id": "07039504d58036ecf557a811c6d33c2c9584d1f9",
"size": "730... |
import ast
from pyxc.importing import SourcePath, orderedModules
from pyxc.transforming import Transformer, SourceMap, exportSourceMap
from pyxc.util import topLevelNamesInBody
import pj.js_ast
import pj.transformations
#### Code to Code
def codeToCode(py):
t = Transformer(pj.transformations, pj.js_ast.JSS... | {
"content_hash": "f06129165afbf4e2914259d72886c190",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 99,
"avg_line_length": 28.22047244094488,
"alnum_prop": 0.44503348214285715,
"repo_name": "andrewschaaf/pyxc-pj",
"id": "5fd6ed85f5895d1917e88341470b3a440a037916",
"size":... |
"""
WSGI config for servers_openomf project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "servers_openomf.settings")
fr... | {
"content_hash": "939307f825d98adbf192c96e9e45b1f3",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 28.928571428571427,
"alnum_prop": 0.7777777777777778,
"repo_name": "omf2097/servers.openomf.org",
"id": "808dbb363ed684d0d98bf4f24bbd87dd67945374",
"... |
""" OpenAI GPT configuration """
from ...configuration_utils import PretrainedConfig
from ...utils import logging
logger = logging.get_logger(__name__)
OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"}
class OpenAIGPTConfig(PretrainedConfig):
... | {
"content_hash": "d198a118fb42085347aabf301cea05b8",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 119,
"avg_line_length": 47.838509316770185,
"alnum_prop": 0.6504803947026746,
"repo_name": "huggingface/pytorch-transformers",
"id": "1e7bf8ec8caeaa688dd44fe9961717e9305b9e4... |
from .dataset import Dataset
class AzureSearchIndexDataset(Dataset):
"""The Azure Search Index.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param description: Dataset description.
:type d... | {
"content_hash": "b5366aa96d2772b084b4d746c69d65db",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 208,
"avg_line_length": 45.212765957446805,
"alnum_prop": 0.6748235294117647,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "2058678b113acba852c15e81204afaf10bbba7b9"... |
from django.apps import apps
from django.conf import settings
from taiga.base.utils.db import to_tsquery
from taiga.projects.userstories.utils import attach_total_points
MAX_RESULTS = getattr(settings, "SEARCHES_MAX_RESULTS", 150)
def search_epics(project, text):
model = apps.get_model("epics", "Epic")
query... | {
"content_hash": "b608cfddcb3e4050ababf9e82fb862dd",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 107,
"avg_line_length": 37.166666666666664,
"alnum_prop": 0.6095205243187306,
"repo_name": "mattcongy/itshop",
"id": "adda60bbdeb8d3cca6e11a7a714dc0c05837ebfe",
"size": "38... |
from __future__ import absolute_import;
import re;
import os;
import sys;
from pymfony.component.system import Object;
from pymfony.component.system import Tool;
from pymfony.component.system.oop import interface;
from pymfony.component.system.oop import abstract;
from pymfony.component.system.exception import Runtim... | {
"content_hash": "067733662c9cb8b89a6b77f578ab0f6c",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 139,
"avg_line_length": 25.609756097560975,
"alnum_prop": 0.6108424908424909,
"repo_name": "pymfony/pymfony",
"id": "972b596037f799c0ae0a096a15ca79ddc0a77e0d",
"size": "13... |
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import Permission
from django.core.urlresolvers import reverse
from django.http import HttpResponseRe... | {
"content_hash": "35bf5dcccd8e6662a7486a55877db67a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 66,
"avg_line_length": 33.142857142857146,
"alnum_prop": 0.8146551724137931,
"repo_name": "plankter/augeo-cloud",
"id": "54b3289c7a859349eefcdbdfb41fe2f12427a987",
"size": ... |
"""todolist URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"content_hash": "970b01f151f573375c43246a7ea8db91",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 36.095238095238095,
"alnum_prop": 0.6992084432717678,
"repo_name": "udumge/todolist",
"id": "e416e80f0b525981223196a302b29fbb45292f27",
"size": "758"... |
import os
import re
import shutil
import olympia.core.logger
from olympia import amo
from olympia.addons.models import AddonUser
from olympia.amo.celery import task
from olympia.files.utils import update_version_number
from olympia.lib.crypto.signing import sign_file
from olympia.addons.models import Addon
from olymp... | {
"content_hash": "8f025082a2022ad2fcfd3453c40cf7a0",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 79,
"avg_line_length": 38.12337662337662,
"alnum_prop": 0.6368591381366037,
"repo_name": "psiinon/addons-server",
"id": "513477cb138449914ac2e6956c3dba0543304675",
"size":... |
'''
Usage::
./decoder.py [module] [data_file]
Sample::
./decoder.py pyroute2.netlink.rtnl.tcmsg.tcmsg ./sample_packet_01.data
./decoder.py pyroute2.netlink.nl80211.nl80211cmd ./nl80211.data
Module is a name within rtnl hierarchy. File should be a
binary data in the escaped string format (see samples).
'... | {
"content_hash": "0197847a433ec790c8c749bc9942ed26",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 74,
"avg_line_length": 21.22222222222222,
"alnum_prop": 0.6740837696335078,
"repo_name": "mtiny/pyroute2",
"id": "c39c7527f7e4f98a343e51e4d491b92b1a75680e",
"size": "782",
... |
__all__ = ['FileConfDriver']
"""This module specifies file drivers.
They work relatively to system/user conf directories and an optional conf
directory given by the environment variable ``B3J0F_CONF_DIR``.
"""
from os import environ, getenv
from os.path import exists, join, expanduser, sep, abspath
from ..base impo... | {
"content_hash": "f1dc346f79c31ad0abde9cba9cff9378",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 25.298850574712645,
"alnum_prop": 0.6383462062698774,
"repo_name": "b3j0f/conf",
"id": "2ac49ad6e678b66751c0dd4c9772b5558c2bd4fc",
"size": "3521",
... |
import collections
def dicts_are_equal(dict1, dict2):
if len(set(dict1.keys()).symmetric_difference(set(dict2.keys()))) > 0:
return False
result = True
for key in dict1.keys():
if isinstance(dict1[key], dict) and isinstance(dict2[key], dict):
result &= dicts_are_equal(dict1[key... | {
"content_hash": "fd271ff75fe7728d06e1e1cc559cd1a2",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 119,
"avg_line_length": 39.872727272727275,
"alnum_prop": 0.622891016871865,
"repo_name": "aganezov/bg",
"id": "8894eba3c7c94fa1762d6d9ddf245731ea6860a4",
"size": "2217",
... |
""" This module returns stats about the DynamoDB table """
import math
from datetime import datetime, timedelta
from boto.exception import DynamoDBResponseError
import dynamodb
from dynamic_dynamodb.log_handler import LOGGER as logger
from cloudwatch import CLOUDWATCH_CONNECTION as cloudwatch_connection
def get_con... | {
"content_hash": "7a07b5d76aee55da445db09bee698352",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 79,
"avg_line_length": 32.777142857142856,
"alnum_prop": 0.650278940027894,
"repo_name": "jamiepg1/dynamic-dynamodb",
"id": "b31a72f3dac6dd71861c7f9f202fb0e29793c3bb",
"si... |
from nose.tools import *
import datetime
import myanimelist.session
import myanimelist.manga
class testMangaClass(object):
@classmethod
def setUpClass(self):
self.session = myanimelist.session.Session()
self.monster = self.session.manga(1)
self.mystery = self.session.genre(7)
self.mystery_tag = se... | {
"content_hash": "69020f92d1b20fe3aa8b4b9b96282583",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 228,
"avg_line_length": 59.62443438914027,
"alnum_prop": 0.7467557107080519,
"repo_name": "XueAlfred/MALAnalysis",
"id": "7f179eeba0388472036a15f9520bc759ee6be479",
"size"... |
from __future__ import unicode_literals, print_function
from datetime import datetime, timedelta, date
from kivy.storage.jsonstore import JsonStore
from kivy.clock import Clock, mainthread
import os
class DBInterface(object):
def __init__(self, data_dir, name, do_date=False, do_hour=False, **kwargs):
supe... | {
"content_hash": "b9b1ade89eaf2fa56cb331f1751b0890",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 79,
"avg_line_length": 31.962162162162162,
"alnum_prop": 0.5124302384576357,
"repo_name": "Kovak/Kivy-DriveSync",
"id": "451649b621eaf4fddcefc575010c06ee539b1baf",
"size":... |
import hashlib
import json
from django.shortcuts import render_to_response, redirect, render, get_object_or_404
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth import login, logout, authenticate
from django.contrib import messages
from django.contrib.... | {
"content_hash": "29d78d0580155140b81c9284158efdf4",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 105,
"avg_line_length": 39.21818181818182,
"alnum_prop": 0.7269355586462679,
"repo_name": "underlost/GamerNews",
"id": "93aa128ab2ef0e94abfb3b130cff3ad018412289",
"size": "... |
import datetime
from typing import Dict, List, Optional, TYPE_CHECKING, Union
from ... import _serialization
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
class CheckNameAvailabilityResult(_serialization.Model):
"""The CheckNameAvailability operatio... | {
"content_hash": "fa88d140986898b9914ed13895a5a565",
"timestamp": "",
"source": "github",
"line_count": 651,
"max_line_length": 107,
"avg_line_length": 42.47004608294931,
"alnum_prop": 0.6431568287037037,
"repo_name": "Azure/azure-sdk-for-python",
"id": "8ea96cca8ab67497b42ab454d1a2c1653ce530be",
"... |
import json
import os
import tempfile
import pytest
import sqlalchemy as sa
import testing.postgresql
import tornado.options
import tornado.testing
from sqlalchemy.orm import sessionmaker
from .. import app
from .. import dbinterface as dbi
from .. import models
def setup_module(module):
module.PG_FACTORY = tes... | {
"content_hash": "2cde9f8c86c67d4b7c65cb6417a42026",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 74,
"avg_line_length": 27.392857142857142,
"alnum_prop": 0.6008567703482958,
"repo_name": "jiffyclub/ipythonblocks.org",
"id": "e9e99ba2c465304e635a8ea993a0c17aeae81764",
... |
from gevent.event import Event, AsyncResult, Timeout
from six.moves import xrange
__all__ = ['Events', 'AsyncResults', 'DaemonState']
class AsyncResultWrapper(object):
def __init__(self):
self.async_result = None
def create(self):
if self.async_result is not None:
assert False, 'T... | {
"content_hash": "0f8abf763ab472d8e532c9313c3792e5",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 24.555555555555557,
"alnum_prop": 0.6135746606334842,
"repo_name": "sapo/meocloud-cli",
"id": "73d27210640114ec1b10775ad5521168e16495b2",
"size": "11... |
import sys
extra = {}
if sys.version_info >= (3, 0):
extra.update(use_2to3=True)
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
author = "Rune Halvorsen"
email = "[email protected]"
version = "0.3"
desc = """Wraps the best available JSO... | {
"content_hash": "c774bdd0f13c4c35b5d3dbd901335cd7",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 89,
"avg_line_length": 31.325581395348838,
"alnum_prop": 0.5924276169265034,
"repo_name": "kennethreitz-archive/anyjson",
"id": "4f601ce5ede795092d38e7a4609ec63e12cd59fc",
... |
import logging
import os
import json
import threading
from media.item import item_builders, item_id_generators, dict_to_item
import media.file
import media.url
import media.url_from_playlist
import media.radio
from database import MusicDatabase, Condition
import variables as var
import util
class ItemNotCachedError... | {
"content_hash": "aaa75bd88eda9986d0a23e542117ff95",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 116,
"avg_line_length": 30.968992248062015,
"alnum_prop": 0.5862327909887359,
"repo_name": "azlux/botamusique",
"id": "0202ca62074e68a1ef7f7d8e36e8ac3062ebfec8",
"size": "... |
"""
Python Markdown
===============
Python Markdown converts Markdown to HTML and can be used as a library or
called from the command line.
## Basic usage as a module:
import markdown
html = markdown.markdown(your_text_string)
See <http://packages.python.org/Markdown/> for more
information and instructions ... | {
"content_hash": "bc448fd4f98cb7ab7c91a13364c06ca9",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 109,
"avg_line_length": 36.33644859813084,
"alnum_prop": 0.5920138888888888,
"repo_name": "GoSteven/Diary",
"id": "31009011602470e93a4c52ea3467bd476828907d",
"size": "1555... |
import math
from collections import namedtuple
Customer = namedtuple("Customer", ['index', 'demand', 'x', 'y'])
def length(customer1, customer2):
return math.sqrt((customer1[1] - customer2[1])**2 + (customer1[2] - customer2[2])**2)
######### TODO replace may with list comperhensions
def grade(input_data, qualit... | {
"content_hash": "cbbfeebff07bdecc85f66ac346fe7ce4",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 314,
"avg_line_length": 50.906474820143885,
"alnum_prop": 0.6445732052006784,
"repo_name": "discreteoptimization/assignment",
"id": "5d4e02247f55c25ad5e587b4a139079cd7003acf... |
from blocks.bricks import Tanh
from blocks.algorithms import BasicMomentum, AdaDelta, RMSProp, Adam, CompositeRule, StepClipping, Momentum
from blocks.initialization import IsotropicGaussian, Constant, Orthogonal
from model.index_attention import Model
add_cnn_data = 0.0
batch_size = 64
sort_batch_count = 20
shuffl... | {
"content_hash": "fc06fc30e39ca40cb265caca482a82c9",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 107,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.740546218487395,
"repo_name": "arianhosseini/Question-Answering",
"id": "1965b4db74ca8f6f53030fda7e5fdf8c1c28a17d"... |
import wtforms_json
from wtforms import (Form, PasswordField, SelectField, StringField,
TextAreaField)
from wtforms.validators import URL, DataRequired, Email
wtforms_json.init()
class LoginForm(Form):
username = StringField(
u'Nome',
validators=[DataRequired()],
rend... | {
"content_hash": "bfa03a648ea6861a5cb7e09b6c3c220f",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 75,
"avg_line_length": 30.875,
"alnum_prop": 0.6124927703875073,
"repo_name": "saskenuba/simple-flask-blog",
"id": "8866e6d7e7cee3b099b6cce072b3ed2f43ecba0d",
"size": "1733... |
from lab_assistant.storage.backends.base import StorageBackend
class NullBackend(StorageBackend):
def get(self, key):
return None
def set(self, key, result):
return None
def remove(self, key):
return None
def clear(self):
return None
def list(self):
retu... | {
"content_hash": "53b17cfc34a89e2188d79b663d2d840c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 62,
"avg_line_length": 18.11111111111111,
"alnum_prop": 0.6196319018404908,
"repo_name": "joealcorn/lab_assistant",
"id": "eba300df412280b75ce74749f4ebac761dd42a91",
"size"... |
import sqlalchemy
from nark import DateTime, Timestamp
class UTCDateTime(sqlalchemy.types.TypeDecorator):
"""Store this DateTime object as a UTC timestamp """
impl = sqlalchemy.types.Integer
def process_bind_param(self, value, dialect):
return DateTime.as_timestamp(value)
def process_result_... | {
"content_hash": "1d482fcd0955ff67eb8185385efbcf64",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 56,
"avg_line_length": 30.083333333333332,
"alnum_prop": 0.7188365650969529,
"repo_name": "shadowmint/python-nark",
"id": "d5b15f1a52324dcf1f32e773d439facea7e529b9",
"size"... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from datetime import timedelta, date
from workalendar.core import WesternCalendar
from workalendar.core import SUN, MON
from workalendar.core import ChristianMixin
class SouthAfrica(WesternCalendar, ChristianM... | {
"content_hash": "de7a09d18aa6df63ee94e39b3b40d1ca",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 41.55102040816327,
"alnum_prop": 0.5530451866404715,
"repo_name": "sayoun/workalendar",
"id": "06141f7d1ed98dffcdc922c4a16bdfa8c82f8bd3",
"size": "40... |
import os
from django.core.exceptions import ImproperlyConfigured
def get_env_variable(var_name):
"""Get the environment variable or return exception."""
try:
return os.environ[var_name]
except KeyError:
error_msg = "Set the {} environment variable".format(var_name)
raise Improper... | {
"content_hash": "ba5cee516757e3375cc4e7f2be800e62",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 99,
"avg_line_length": 29.366812227074234,
"alnum_prop": 0.5727881040892193,
"repo_name": "olivmaurel/termsearch",
"id": "75907dc0177271551cc87e45732e9d293e58413c",
"size"... |
import wx
import wx.lib.ogl as ogl
class Dialog_text_edit(wx.Dialog):
def __init__(self, parent, title):
super(Dialog_text_edit, self).__init__(parent, title=title,size=(240,200))
self.parent = parent
self.texto = wx.TextCtrl( self, wx.ID_ANY, style=wx.TE_MULTILINE , size=(220,120), pos=(10,10))
aceptar... | {
"content_hash": "ec80463fe78a5d6b79574cdaf9c5e5e0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 97,
"avg_line_length": 26.733333333333334,
"alnum_prop": 0.6733167082294265,
"repo_name": "pacpac1992/mymockup",
"id": "cfdde5d3db1cf9e0fe41e11b7f8e2421da833d9a",
"size": "... |
from .ast_node import AstNode
from .errors import AstBuilderException
class AstBuilder(object):
def __init__(self):
self.reset()
def reset(self):
self.stack = [AstNode('None')]
self.comments = []
def start_rule(self, rule_type):
self.stack.append(AstNode(rule_type))
... | {
"content_hash": "0299da1636a806704eb243a69a7a6879",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 107,
"avg_line_length": 39.629464285714285,
"alnum_prop": 0.5315985130111525,
"repo_name": "chebizarro/gherkin3",
"id": "91aa1e4f272637d193648b343978b42dbe82fa69",
"size":... |
from taiga.base.api import serializers
from taiga.base.fields import MethodField
class VoteResourceSerializerMixin(serializers.LightSerializer):
is_voter = MethodField()
total_voters = MethodField()
def get_is_voter(self, obj):
# The "is_voted" attribute is attached in the get_queryset of the vie... | {
"content_hash": "076bc45df91b0f86e5d0c6c217fd6619",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 86,
"avg_line_length": 37.266666666666666,
"alnum_prop": 0.7066189624329159,
"repo_name": "mattcongy/itshop",
"id": "9f9d10498405ebe87851f9ca1ca7a05f9c8d2fcf",
"size": "149... |
'''
Created on 22-08-2012
@author: piotrhol
'''
__author__ = "piotrhol"
__copyright__ = "PNSC (@@check)"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
import logging
import rdflib
import mimetypes
from rocommand import ro_uriutils
from rocommand.ro_remote_metadata import ROSRS_Error
log = log... | {
"content_hash": "a827a3346a77a849732090939886c386",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 171,
"avg_line_length": 49.56218905472637,
"alnum_prop": 0.6024894599478017,
"repo_name": "wf4ever/ro-manager",
"id": "32b5bb5d3576741e6c32803708a755b028326cac",
"size": "... |
from alembic.ddl.base import RenameTable
from alembic import migration
from redshift_sqlalchemy import dialect
def test_configure_migration_context():
context = migration.MigrationContext.configure(
url='redshift+psycopg2://mydb'
)
assert isinstance(context.impl, dialect.RedshiftImpl)
def test_... | {
"content_hash": "ab11d47001649715189c9ba8cdedbb75",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 75,
"avg_line_length": 31.58823529411765,
"alnum_prop": 0.7374301675977654,
"repo_name": "jklukas/redshift_sqlalchemy",
"id": "a957b3e4f496ff445e664c4019c8cb17358851a8",
"s... |
"""Use pygame to visualize well_bouncer_game.Game."""
import pygame
import well_bouncer_game
_screen = None
_PLAY_AREA_WIDTH = 200
_PLAY_AREA_HEIGHT = 800
_BORDER_WIDTH = 10
_PLAY_AREA_SCALE = 8
def game_to_screen_point(x, y):
x = float(x) * _PLAY_AREA_SCALE + _BORDER_WIDTH
y = float(y) * _PLAY_AREA_SCALE... | {
"content_hash": "d9a11da09acb8d95ebb79f685de9ae61",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 77,
"avg_line_length": 31.72641509433962,
"alnum_prop": 0.5560511448111805,
"repo_name": "brianquinlan/learn-machine-learning",
"id": "cbc04090719119e78da1117b0fa968b858a0f0... |
import os
import shutil
from PyQt5.Qt import QUuid, QDir, QFile, QFileInfo, QObject, Qt, QTextStream, QIODevice, QUrl, QByteArray, QMessageBox, QApplication
class Utility:
Casing_Uppercase = 0 # Change characters to uppercase
Casing_Lowercase = 1 # Change characters to lowercase
Casing_Titlecase = 2 # Cha... | {
"content_hash": "2413784b4427bf58a79be36af4f2fef7",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 200,
"avg_line_length": 39.81184668989547,
"alnum_prop": 0.6165762296516716,
"repo_name": "tcp813/tolo",
"id": "92b05aa1d612bb4b9c1874b6559dca8c6d0c9540",
"size": "11427",... |
"""Settings that need to be set in order to run the tests."""
import os
DEBUG = True
FILER_DEBUG = True
SITE_ID = 1
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
USE_I18N = True
ROOT_URLCONF = 'cmsplugin_blog_authors.tests.urls'
STATIC_URL = '/s... | {
"content_hash": "e9e710c302da4d81e1bef52779f04a31",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 78,
"avg_line_length": 25.26851851851852,
"alnum_prop": 0.6665445218028582,
"repo_name": "bitmazk/cmsplugin-blog-authors",
"id": "7e4c9bcc19a994765eb76f8fd5979127a1ec0c90",
... |
from .about import about, contact
from .alerts import alertUsers, postAlertPolygon, readAlertPoint
from .disclaimer import disclaimer
from .edit import editHazards, editShape, updateHazard
from .index import index
from .postPoint import (postHazard, postIncident, postNearmiss,
postNewInfra... | {
"content_hash": "39dc77456656556fbcf3881c78d74631",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 56.9,
"alnum_prop": 0.695079086115993,
"repo_name": "SPARLab/BikeMaps",
"id": "f386dc7c105df6d781663e9b23e34682beba9ff5",
"size": "1138",
"binary":... |
from flask import Flask, render_template
import datetime
app = Flask(__name__)
@app.route("/")
def hello():
now = datetime.datetime.now()
timeString = now.strftime("%Y-%m-%d %H:%M")
templateData = {
'title' : 'HELLO!',
'time': timeString
}
return render_template('main.html', **templateDat... | {
"content_hash": "0d33530faadb44117990e4ee52955a04",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 61,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.5894736842105263,
"repo_name": "emgreen33/easy_bake",
"id": "7588627557ad7a8ab0f1372bdf50ac700162cb65",
"size": "... |
"""A preprocessor that extracts all of the outputs from the
notebook file. The extracted outputs are returned in the 'resources' dictionary.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from textwrap import dedent
from binascii import a2b_base64
import sys
... | {
"content_hash": "41771e96f46c8e2a96efd669e149f530",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 92,
"avg_line_length": 43.4078947368421,
"alnum_prop": 0.5401636859654441,
"repo_name": "sserrot/champion_relationships",
"id": "eb8c8594eeb76749e65f505ab790937e311dde7f",
... |
import json
class CuCoursecatalogSpiderPipeline(object):
def __init__(self):
self.file = open('cu_catalog.json', 'wb')
def process_item(self, item, spider):
line = json.dumps(dict(item)) + '\n'
self.file.write(line)
return item
| {
"content_hash": "cbd5490561ff804632cd6831a6ec864f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 44,
"avg_line_length": 21.90909090909091,
"alnum_prop": 0.6846473029045643,
"repo_name": "xaviablaza/course-catalog-api",
"id": "e12003fc6e5177f05ff445656fe03234012a1eba",
... |
key_val_store = {}
def put(key, data, client_addr=None):
if key == "__all__":
import json
return 0, json.dumps(key_val_store)
elif key == "peer":
try:
host,port = data.split('-')
# Extract host from client_addr, as visible to coordinator
host = client... | {
"content_hash": "d6a60e7dac640a43203a07e150a1a546",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 98,
"avg_line_length": 35.92356687898089,
"alnum_prop": 0.5703900709219858,
"repo_name": "varunmittal91/Distributed-Key-Value-Store",
"id": "c0a989434c1a8bf0ffff66929355671b... |
"""Logging utilities."""
from absl import logging
import tensorflow.compat.v1 as tf
# Alias to TF summary module that supports eager mode and is TF2 compatible.
tf_summary = tf.compat.v2.summary
class ScalarSummary(object):
"""Enables logging a scalar metric to Tensorboard.
Example:
num_rounds = tf.Variable... | {
"content_hash": "d09a3dd93cd82584209ed1ee37d3a3c9",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 79,
"avg_line_length": 31.454545454545453,
"alnum_prop": 0.6589595375722543,
"repo_name": "google-research/google-research",
"id": "3128d61e0b5f430dccc10d110301ac032300c324",... |
import json
from unittest import TestCase
from core.curlcommand import CurlCommand
class CurlCommandTest(TestCase):
def test_get_method(self):
method = "get"
url = "http://example.com/api/v2/test"
data = "{\"id\": 1, \"name\": \"Foo\"}"
headers = json.loads('{}')
curlcomm... | {
"content_hash": "bff44f5fa17c7d915030afa7524932d0",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 110,
"avg_line_length": 41.5,
"alnum_prop": 0.5550774526678142,
"repo_name": "Teebytes/TnT-Fuzzer",
"id": "8a2a892266b6a064375553f4c399ef93bc077ffa",
"size": "2324",
"bin... |
"""
Django settings for stalkexchange project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Buil... | {
"content_hash": "5a1a1fd32633284c4f69b91090c1ef4e",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 106,
"avg_line_length": 30.009615384615383,
"alnum_prop": 0.7005767382249279,
"repo_name": "jmickela/stalkexchange",
"id": "7e12dd645ce6707b8111d8fd24fb0103383807fa",
"siz... |
""" Get data regarding platform specific results
input table is our length data file
1. read name
2. alignment type
3. best aligned length
4. total aligned length
5. read length
"""
import sys, argparse, re, gzip, inspect, os
from seqtools.statistics import average
def main(args):
#define read name pr... | {
"content_hash": "609027978e9f045a5419e7f86dafdb6e",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 141,
"avg_line_length": 41.91525423728814,
"alnum_prop": 0.6101900525677315,
"repo_name": "jason-weirather/AlignQC",
"id": "f30e93c0410e846bb79dd98864a33c17b81b9424",
"siz... |
"""
<Program Name>
test_gpg.py
<Author>
Santiago Torres-Arias <[email protected]>
Lukas Puehringer <[email protected]>
<Started>
Nov 15, 2017
<Copyright>
See LICENSE for licensing information.
<Purpose>
Test gpg/pgp-related functions.
"""
import os
import shutil
import sys
import tempfile
import... | {
"content_hash": "c8b932005c8dc10078a020835246294b",
"timestamp": "",
"source": "github",
"line_count": 988,
"max_line_length": 114,
"avg_line_length": 39.49898785425101,
"alnum_prop": 0.6165022421524664,
"repo_name": "secure-systems-lab/securesystemslib",
"id": "5431de739eabf52204a14fc5283da33f9e2b4... |
"""
Author: Benjamin Torben-Nielsen
Date: 18/08/2015
"""
import sys
import numpy as np
import scipy
import scipy.optimize
import matplotlib.pyplot as plt
import pylab as p, time
class BTStats :
'''
Compute morphometric features and statistics of a single morphology
Assume the "3 point" soma of the curate... | {
"content_hash": "9a5f30ee1255b1df6d81d62f138cb2d9",
"timestamp": "",
"source": "github",
"line_count": 529,
"max_line_length": 113,
"avg_line_length": 34.880907372400756,
"alnum_prop": 0.5175590721872968,
"repo_name": "WillemWybo/SGF_formalism",
"id": "c1f78c6b2ac55f3b862b11203fcc852b071087f2",
"s... |
from slipstream.command.DescribeInstancesCommand import DescribeInstancesCommand
from slipstream_okeanos.OkeanosCommand import OkeanosCommand
class OkeanosDescribeInstances(DescribeInstancesCommand, OkeanosCommand):
def __init__(self):
super(OkeanosDescribeInstances, self).__init__()
def _vm_get_sta... | {
"content_hash": "34385c2ccf57e9e47920fa814dbcb15b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 80,
"avg_line_length": 31.25,
"alnum_prop": 0.7626666666666667,
"repo_name": "CELAR/SlipStreamConnector-Okeanos",
"id": "ba3cfe46b208115749fca92dd7480fc5d7f651eb",
"size": ... |
import sklearn.datasets as sd
import argparse
p = argparse.ArgumentParser(description="Create a toy dataset for testing tinygrad.")
p.add_argument("--task", type=str, choices=["classification", "regression"], dest="task", required=True)
p.add_argument("--rows", type=int, default=100, dest="rows", required=False, help=... | {
"content_hash": "000053a20d4bb1eeec170e0f6e9574c2",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 119,
"avg_line_length": 57.125,
"alnum_prop": 0.6739606126914661,
"repo_name": "nikoreun/tinygrad",
"id": "011dfdef1c6a2344a55a2dbd35817bdb4904d598",
"size": "914",
"bina... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('desktop', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='document2',
na... | {
"content_hash": "adf8c73b520b4beaaeccfaac3bf3e93c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 178,
"avg_line_length": 28,
"alnum_prop": 0.6484962406015038,
"repo_name": "cloudera/hue",
"id": "420751ad33951c1d5cbf06a64e957fb249f7ee60",
"size": "606",
"binary": fals... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.