text stringlengths 4 1.02M | meta dict |
|---|---|
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Selected(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterternary"
_path_str = "scatterternary.selected"
_valid_props = {"marker", "textfont"... | {
"content_hash": "9729b6bb1d66cec29e2479988c0b18a4",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 86,
"avg_line_length": 30.25170068027211,
"alnum_prop": 0.5439622217225095,
"repo_name": "plotly/plotly.py",
"id": "ea416db8aa6c8d72ba21c32a092fc1cbade59ed6",
"size": "444... |
"""Add workouts table
Revision ID: 9cd42e48cd23
Revises:
Create Date: 2017-02-26 15:19:51.725179
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '9cd42e48cd23'
down_revision = None
branch_labels = None
depends_on = None... | {
"content_hash": "9ac2e4ddc84ab3d33bccb1ad99f162ee",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 87,
"avg_line_length": 22.75862068965517,
"alnum_prop": 0.693939393939394,
"repo_name": "vinntreus/training_stats",
"id": "00e4799706ea55ce2904f5a5799d607ac6c1a9b5",
"size"... |
from flask import Flask
from git import *
import shutil
import os
import stat
import time
app = Flask(__name__)
@app.route("/")
def pythonBlameHistory():
#path is the hardcoded folder for the last download of ghdata
repo_path = './ghdata'
#We must remove the old ghdata if we want to download a new copy.
... | {
"content_hash": "00a8e2dea798e841d1c9f814d6a9f175",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 202,
"avg_line_length": 47.46666666666667,
"alnum_prop": 0.6491573033707865,
"repo_name": "Hackers-To-Engineers/ghdata-sprint1team-2",
"id": "086d2bc26751b14ff017846f30b6569a... |
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.contenttypes.models import ContentType
from reversion.models import Version, has_int_pk
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."... | {
"content_hash": "a29b1f474b34a06caca48a051c355a9b",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 182,
"avg_line_length": 62.625,
"alnum_prop": 0.5590636908002178,
"repo_name": "vipins/ccccms",
"id": "51acdb156ba1ebe069fd4f2c98cd62c293d77335",
"size": "5529",
"binary"... |
import doctest
import unittest
import glob
import os
optionflags = (doctest.REPORT_ONLY_FIRST_FAILURE |
doctest.NORMALIZE_WHITESPACE |
doctest.ELLIPSIS)
def list_doctests():
print __file__
return [filename
for filename
in glob.glob(os.path.join(os.path.dir... | {
"content_hash": "8ad680f7140f2542c432f68dd708946c",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 75,
"avg_line_length": 28.228571428571428,
"alnum_prop": 0.5910931174089069,
"repo_name": "31415us/trajectory",
"id": "25d5f7a1ea4293ea9c68897a35dfd45b2c303475",
"size": "9... |
import pytest
import numpy as np
import nnabla.functions as F
from nbla_test_utils import list_context
def ref_softmax(x, axis):
x = x - x.max(axis, keepdims=True)
x = np.exp(x) / np.exp(x).sum(axis, keepdims=True)
return x
@pytest.mark.parametrize("seed", [313])
@pytest.mark.parametrize("axis", [0, 1, ... | {
"content_hash": "255a4184315212054c953a00db1418dc",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 38.54838709677419,
"alnum_prop": 0.6769874476987447,
"repo_name": "sony/nnabla",
"id": "69d3bb4b7c04e84cd4853d99acae339996dde6e7",
"size": "1797",
... |
__author__ = 'Gene'
import PIL
from PIL import Image
import random
def generate_random_seed(width, height, out_file_name):
file = Image.new("RGB", (width, height), 0)
for i in range(height):
for j in range(width):
file.putpixel((i,j),(random.randint(0, 255), random.randint(0, 255... | {
"content_hash": "1ca19a40710c517244053ec1141ff72d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 105,
"avg_line_length": 33.4375,
"alnum_prop": 0.6261682242990654,
"repo_name": "gene-levitzky/Cartographer",
"id": "0c72caaf7661bfe2bf1fd7194828730a38e6acc2",
"size": "535... |
from numpy import prod
from .. import check
from ..check import is_shape
class Memory(object):
def __init__(self, ops, size=128):
if size < 0:
raise ValueError("TODO error re negative size %d" % size)
self.ops = ops
self._mem = self.ops.allocate((2, size))
self._offse... | {
"content_hash": "d2ac17b5e8ebcd560df653a8246fb78b",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 75,
"avg_line_length": 30.732558139534884,
"alnum_prop": 0.555807794173288,
"repo_name": "ryfeus/lambda-packs",
"id": "13e6af3c56ffc2ae3ce97b3f9780718051322d82",
"size": "2... |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name="width",
parent_name="waterfall.increasing.marker.line",
**kwargs
):
super(WidthValidator, self).__init__(
plotly_name=plo... | {
"content_hash": "d8dec0bbe2fda91898cf7fccc20b7709",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 67,
"avg_line_length": 31.05263157894737,
"alnum_prop": 0.559322033898305,
"repo_name": "plotly/python-api",
"id": "80f8e4bf19368b237ddb50a80d1a052113098102",
"size": "590"... |
import os
import warnings
from nose.tools import assert_equals, assert_in, assert_true
from unittest import TestCase
from unittest.mock import patch
from test_botty.mocks import MockMessage, MockRequestGET
from botty_mcbotface.plugins.searches import google, youtube
# Short-circuit Message object that just returns res... | {
"content_hash": "72e77cdf1212b70e18860f69c023ff81",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 98,
"avg_line_length": 35.57142857142857,
"alnum_prop": 0.6742971887550201,
"repo_name": "ColumbiaSC-Tech/botty_mcbotface",
"id": "d754841bf2fbb5efe09085a6da136c33f9ae034e",
... |
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": "28e023afb49158ade3ccdef8fc881c63",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 79,
"avg_line_length": 31.65983606557377,
"alnum_prop": 0.7051132686084143,
"repo_name": "eucall-software/singfel",
"id": "b613db793e402896508f205a9438ce0580120282",
"size... |
"""Config Drive v2 helper."""
import os
import shutil
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import strutils
from oslo_utils import units
from nova import exception
from nova.i18n import _LW
from nova.openstack.common import fileutils
from nova import utils
from nova import v... | {
"content_hash": "bac184fc85f4ddfddca2b9fe8d9cce61",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 78,
"avg_line_length": 34.424418604651166,
"alnum_prop": 0.5374092214153015,
"repo_name": "cloudbase/nova-virtualbox",
"id": "6e546a76aa752977d9c78a9fc91789ed95da36bc",
"s... |
from __future__ import division
from matplotlib import pyplot as plt
from collections import Counter
variance = [1, 2, 4, 8, 16, 32, 64, 128, 256]
bias_squared = [256, 128, 64, 32, 16, 8, 4, 2, 1]
total_error = [x + y for x, y in zip(variance, bias_squared)]
xs = [i for i, _ in enumerate(variance)]
plt.plot(xs, vari... | {
"content_hash": "0fcbba6f371cb01007819f2e67607e4e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 61,
"avg_line_length": 25.90909090909091,
"alnum_prop": 0.6543859649122807,
"repo_name": "addamh/data-science-from-scratch",
"id": "377f926eb40c47602563ff46d4844c96346ad176",... |
from sys import stdin, stdout
from Bot import Planner
from Bot.Game.Game import Game
from Bot.Parser import Parser
class Bot:
def __init__(self, strategy):
self.game = Game()
self._parser = Parser(self.game)
self._planner = Planner.create(strategy, self.game)
def run(self):
w... | {
"content_hash": "86ef514389b82d5de2b346ef60162af3",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 59,
"avg_line_length": 22.58139534883721,
"alnum_prop": 0.5242018537590113,
"repo_name": "gtagency/tetris-python",
"id": "c662af69bbaf90a2b49463438be7888c2228a155",
"size":... |
import socket
import sys
import time
import threading
import select
import traceback
class Server(threading.Thread):
def initialise(self,receive):
self.receive=receive
def run(self):
lis=[]
lis.append(self.receive)
while 1:
read,write,err=select.select(lis,[],[])
... | {
"content_hash": "b3b155207cb6219d318a82a8bcdcff3d",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 71,
"avg_line_length": 29.2,
"alnum_prop": 0.4863013698630137,
"repo_name": "hehaichi/p2p-chat-python",
"id": "abd8dc5c93b00ad630d2e393e319966eb3e6ae0a",
"size": "1922",
... |
import networkx as nx
import os.path
import scipy.sparse
from numpy import log
import logging
from src.util.FileSystem import FileSystem
from cwsite.models.models import Octave
class AstNetwork(object):
def __init__(self, part, matrixFile, idMap):
self.matrixFile = matrixFile
self.subIdMap =... | {
"content_hash": "33d7206a1435723bebb105ea4f9ebf7a",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 89,
"avg_line_length": 36.86991869918699,
"alnum_prop": 0.5429988974641676,
"repo_name": "tanonev/codewebs",
"id": "e3746319be85571f78b0b6f92867c145c8f0c217",
"size": "907... |
from django.shortcuts import render
from django.views import generic
from models import *
from django.http import HttpResponse, HttpResponseRedirect
from home.models import Languages, Menu, MenuInfo
from django.http import Http404
import json, simplejson
import time
class IndexViews(generic.View):
templates_file ... | {
"content_hash": "02ec4d98a07c01cd8fd24a07cefd66c6",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 84,
"avg_line_length": 29.670731707317074,
"alnum_prop": 0.4928072338676531,
"repo_name": "CooloiStudio/Turanga.deskxd.com",
"id": "015339d8e9fd9baed8d7c2b9661e74ed625ad163",... |
""" Example demonstrating turning lines on and off - with JS only
"""
import numpy as np
from bokeh.io import output_file, show
from bokeh.layouts import row
from bokeh.palettes import Viridis3
from bokeh.plotting import figure
from bokeh.models import CheckboxGroup, CustomJS
output_file("line_on_off.html", title="... | {
"content_hash": "8047c9e2ac13a2503245e412459081cb",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 79,
"avg_line_length": 33.1875,
"alnum_prop": 0.6629001883239172,
"repo_name": "ptitjano/bokeh",
"id": "18891c00df6590008ecb6a42252263ed371f5c63",
"size": "1062",
"binary... |
import socket
import sys
HOST, PORT = "ec2-54-227-4-154.compute-1.amazonaws.com", 3000
data = " ".join(sys.argv[1:])
# Create a socket (SOCK_STREAM means a TCP socket)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
# Connect to server and send data
sock.connect((HOST, PORT))
sock.sendall(d... | {
"content_hash": "2859e21b59d2ef83be37b328e7cd5e16",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 61,
"avg_line_length": 25.285714285714285,
"alnum_prop": 0.6741996233521658,
"repo_name": "ketanbj/eapps",
"id": "7d7eaae645e066dae37e6abec08967552eb8538e",
"size": "531",
... |
"""Auto-generated file, do not edit by hand. DK metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_DK = PhoneMetadata(id='DK', country_code=45, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[2-9]\\d{7}', possible_length=(8,)),
... | {
"content_hash": "0f5e0c445abb278babd5c4c1a3e8f3af",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 145,
"avg_line_length": 89.36363636363636,
"alnum_prop": 0.6876907426246185,
"repo_name": "gencer/python-phonenumbers",
"id": "dcd434fe85e53bfc979a02ff699437e31d4c8c1d",
"s... |
import json
import urllib2
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from utils import get_blocked_videos
from utils import interpolated_prec_rec
from utils import segment_iou
class ANETdetection(object):
GROUND_TRUTH_FIELDS = ['database', 'taxonomy', 'version']
PREDICTION_... | {
"content_hash": "eb004ecfc6b752a588899febabda3f3e",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 110,
"avg_line_length": 40.426923076923075,
"alnum_prop": 0.58129578536771,
"repo_name": "activitynet/ActivityNet",
"id": "6c83c178bc39cbfa6da5e753dca1b72c7bb9c459",
"size... |
""" Course API module
This module offers a number of URL endpoints with which
you are able to GET, POST, PUT and DELETE all the content
of a course. There are other methods available in other
modules, but these are easier and simpler to use.
"""
from models import custom_modules
from modules.um_cours... | {
"content_hash": "b43c1f4cd2100ad8685a01bfa2e604af",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 66,
"avg_line_length": 29.774193548387096,
"alnum_prop": 0.6576381365113759,
"repo_name": "UniMOOC/AAClassroom",
"id": "cd20f9c1bad93d17dcaf767d513a144291a3a247",
"size": "... |
"""
A driver for XenServer or Xen Cloud Platform.
**Variable Naming Scheme**
- suffix "_ref" for opaque references
- suffix "_uuid" for UUIDs
- suffix "_rec" for record objects
"""
import math
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo.utils import units
import six.moves.urllib.p... | {
"content_hash": "3c0861fc6db35a0b400e5571c7d65a8e",
"timestamp": "",
"source": "github",
"line_count": 669,
"max_line_length": 79,
"avg_line_length": 42.72645739910314,
"alnum_prop": 0.6049538203190596,
"repo_name": "projectcalico/calico-nova",
"id": "fd56bc15debca92c534692176d80067d8adcf960",
"si... |
import re
from django import forms
from django.forms.util import ErrorList
from django.forms.widgets import HiddenInput, SelectMultiple
from crits.core import form_consts
from crits.core.handlers import get_source_names, get_item_names, ui_themes
from crits.core.user_role import UserRole
from crits.core.user_tools im... | {
"content_hash": "c4a26e126bb8359ed928ff32d7dd1900",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 116,
"avg_line_length": 46.459016393442624,
"alnum_prop": 0.5004116678428605,
"repo_name": "davidhdz/crits",
"id": "e7f962d1c11450b5fb654b4558a96d0daab9f6ca",
"size": "170... |
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.dates import DateFormatter
import matplotlib.ticker as mtick
import numpy as np
import datetime
dforlando = pd.read_csv("ORLANDO_Full.csv", usecols=[3,4], header=0, names=['url', 'text'], nrows=89999, parse_dates=True... | {
"content_hash": "b095164768f14a355eb105765b338c7c",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 141,
"avg_line_length": 44.125,
"alnum_prop": 0.684985835694051,
"repo_name": "Mattio89/visualization",
"id": "1c165d42cefc559f414bbb4ebc73bd326d85981a",
"size": "1781",
... |
from abc import ABCMeta, abstractmethod
from cryptol import cryptoltypes
from cryptol.quoting import to_cryptol_str_customf
from .utils import deprecated
from dataclasses import dataclass
import dataclasses
import re
from typing import Any, Dict, List, Tuple, Optional, Set, Union, overload
from typing_extensions import... | {
"content_hash": "e665e19d5c9852e0f472cffd302509c6",
"timestamp": "",
"source": "github",
"line_count": 716,
"max_line_length": 156,
"avg_line_length": 40.21648044692738,
"alnum_prop": 0.6039590206633096,
"repo_name": "GaloisInc/saw-script",
"id": "5d5ff39a0c2feecb305b81ac60a9e0f7e935cc0a",
"size":... |
"""Tests for the log2timeline CLI tool."""
import collections
import os
import platform
import unittest
from plaso.containers import events
from plaso.cli import log2timeline_tool
from plaso.lib import definitions
from plaso.lib import errors
from plaso.storage.sqlite import sqlite_file
from tests import test_lib as... | {
"content_hash": "6d13a2ad3b13e56ae8b2f36edb61758d",
"timestamp": "",
"source": "github",
"line_count": 571,
"max_line_length": 80,
"avg_line_length": 35.884413309982484,
"alnum_prop": 0.6838945827232796,
"repo_name": "joachimmetz/plaso",
"id": "fad359ceed1279bb9b0658ae9e512a373298c771",
"size": "2... |
from datetime import date
from dateutil.easter import easter
from dateutil.relativedelta import relativedelta as rd
from dateutil.relativedelta import MO, FR
from holidays.constants import SUN, JAN, MAY, JUN, OCT, DEC
from holidays.holiday_base import HolidayBase
class Kenya(HolidayBase):
"""
https://en.wik... | {
"content_hash": "64b885b6192509e000b49c7839894c0e",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 67,
"avg_line_length": 30.288888888888888,
"alnum_prop": 0.6206896551724138,
"repo_name": "dr-prodigy/python-holidays",
"id": "c805957f0305a52c5cea0c2500fab2d93cd83bb4",
"s... |
from .development import *
| {
"content_hash": "e00a2294b12ebef08c6e06df2affe7b7",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 26,
"avg_line_length": 27,
"alnum_prop": 0.7777777777777778,
"repo_name": "zwidny/djtemplate1_8",
"id": "c4acb52c5eb4abdeef847c5951a0a9ed1fc8e33f",
"size": "51",
"binary":... |
from .cqlhandling import CqlParsingRuleSet, Hint
from cassandra.metadata import maybe_escape_name
from cassandra.metadata import escape_name
simple_cql_types = set(('ascii', 'bigint', 'blob', 'boolean', 'counter', 'date', 'decimal', 'double', 'float', 'inet', 'int',
'smallint', 'text', 'time',... | {
"content_hash": "49177f7171d53d6848408e89b5aa0c61",
"timestamp": "",
"source": "github",
"line_count": 1377,
"max_line_length": 141,
"avg_line_length": 36.98983297022513,
"alnum_prop": 0.5439481692352999,
"repo_name": "mt0803/cassandra",
"id": "a46da9135d190e5a6727ebbb1914f47a3d87e063",
"size": "5... |
funcs = [
"abs", "all", "any", "ascii", "bin", "callable", "chr", "compile",
"delattr", "dir", "divmod", "eval", "exec", "exit", "format", "getattr",
"globals", "hasattr", "hash", "help", "hex", "id", "input", "isinstance",
"issubclass", "iter", "len", "locals", "max", "min", "next", "oct",
"open", ... | {
"content_hash": "986a275dd567c4c247b3d1fe38b3cab3",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 80,
"avg_line_length": 38.76923076923077,
"alnum_prop": 0.5496031746031746,
"repo_name": "jonathanverner/brython",
"id": "aaecc4b9ce72ea3eed4a678d3dca4256e5f4cafd",
"size":... |
from __future__ import (unicode_literals, absolute_import)
from django.db.models import CharField
from . import fields
class VATINField(CharField):
description = "A VIES VAT field."
def __init__(self, *args, **kwargs):
kwargs['max_length'] = 14
super(VATINField, self).__init__(*args, **kwa... | {
"content_hash": "7a91f9d088d4bed57f80314c8308daed",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 61,
"avg_line_length": 25.310344827586206,
"alnum_prop": 0.6362397820163488,
"repo_name": "vdboor/django-vies",
"id": "ed9b871cd31eab2c5296aa00ed16564b392661b8",
"size": "7... |
from django.test import TestCase
from geokey.contributions.models import Observation
from geokey.projects.tests.model_factories import ProjectF, UserF
from geokey.categories.tests.model_factories import (
CategoryFactory, LookupFieldFactory, LookupValueFactory,
TextFieldFactory, MultipleLookupFieldFactory, Mu... | {
"content_hash": "fcdc4386f1ea023ab4c72e517711e012",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 78,
"avg_line_length": 33.76129032258064,
"alnum_prop": 0.5730938276323333,
"repo_name": "nagyistoce/geokey",
"id": "2aaba5593ce356ee39f28ea950be2ba9bc800aa1",
"size": "52... |
from cyborg.tests.unit.api import base
class APITestV2(base.BaseApiTest):
PATH_PREFIX = '/v2'
| {
"content_hash": "2d74e4932e37b6efcc1cd76de7183f2b",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 16.833333333333332,
"alnum_prop": 0.7227722772277227,
"repo_name": "openstack/nomad",
"id": "889bd3a43bb250f079bbe04362a8bf944b8fd09c",
"size": "745",... |
from setuptools import setup
setup(
name='flaskr',
packages=['flaskr'],
include_package_data=True,
install_requires=[
'flask',
],
)
| {
"content_hash": "5817d6a2baa09a3c6236e4da34837ad6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 30,
"avg_line_length": 16.1,
"alnum_prop": 0.5962732919254659,
"repo_name": "chloeyangu/BigDataAnalytics",
"id": "eadb5914c5e1abb37965c5fada26242b7d3ab7c3",
"size": "161",
... |
"""
This module instantiates the Flask application and declares the main error
handling function ``make_json_error``.
"""
# IMPORTANT: updates to the following must also be done in setup.py.
__title__ = "birdlistn"
__version__ = "0.1.0"
__author__ = "Hugues Demers"
__email__ = "hdemers@gmail.com"
__copyright__ = "Copy... | {
"content_hash": "87053a2cb88bb1032ede9ae57cbed538",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 79,
"avg_line_length": 29.303030303030305,
"alnum_prop": 0.688210961737332,
"repo_name": "hdemers/birdlistn",
"id": "a39d412d1a480bd7499cde73e1fc3a2c75b448a1",
"size": "193... |
from datetime import datetime, timedelta
from nose.tools import * # noqa
from tests.base import OsfTestCase
from tests.factories import RegistrationFactory
from tests.factories import UserFactory
from scripts.retract_registrations import main
class TestRetractRegistrations(OsfTestCase):
def setUp(self):
... | {
"content_hash": "e8b7dae6d0be605989b941af0687b14f",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 109,
"avg_line_length": 40.41975308641975,
"alnum_prop": 0.6814294441050702,
"repo_name": "HarryRybacki/osf.io",
"id": "a1a4920e4dd7a17f74dd08a39d8e4fc611830dec",
"size": "... |
subreddit = 'eminem'
t_channel = '@sub_eminem'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| {
"content_hash": "b5f525ee5a9d3a272be73eaf652672c7",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 20,
"alnum_prop": 0.7083333333333334,
"repo_name": "Fillll/reddit2telegram",
"id": "af2a84da43bc0de65c40ee0b955468ffa1fbdcc8",
"size": "137",
"binar... |
import subprocess
from loguru import logger
def adb(device_id, cmd=None):
logger.info("ADB: Running on {}:{}".format(device_id, cmd))
subprocess.run('adb -s {} {}'.format(device_id, cmd), shell=True)
| {
"content_hash": "8c06248b26e7f2ba7f759f917ccca3e4",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 69,
"avg_line_length": 26.375,
"alnum_prop": 0.6682464454976303,
"repo_name": "androguard/androguard",
"id": "a60885186965b4ca25d601adb72dd51261847f81",
"size": "211",
"bi... |
from dragon.vm.tensorflow.contrib.learn.datasets.mnist import read_data_sets | {
"content_hash": "37b3dfe07ff5cb886f71793d785d53da",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 76,
"avg_line_length": 76,
"alnum_prop": 0.8552631578947368,
"repo_name": "neopenx/Dragon",
"id": "06d012c560ec402e6c244843db98770df048c7a6",
"size": "269",
"binary": fals... |
"""Tests for structures."""
import unittest
from grow.common import structures
from operator import itemgetter
class AttributeDictTestCase(unittest.TestCase):
"""Test the attribute dict structure."""
def test_attributes(self):
"""Keys are accessible as attributes."""
obj = structures.Attribu... | {
"content_hash": "f7a0a621f50138702477374a8c3d7eb6",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 72,
"avg_line_length": 33.092592592592595,
"alnum_prop": 0.5441149039358328,
"repo_name": "grow/pygrow",
"id": "337d96aa57f1d5395c7bc4adcd9571c4a758ec6c",
"size": "5361",
... |
from django.conf.urls.defaults import patterns, url
from desktop.lib.django_util import get_username_re_rule, get_groupname_re_rule
username_re = get_username_re_rule()
groupname_re = get_groupname_re_rule()
urlpatterns = patterns('useradmin.views',
url(r'^$', 'list_users'),
url(r'^users$', 'list_users'),
url(... | {
"content_hash": "2e43b3eb5c8dbd166945f4dd4689836b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 79,
"avg_line_length": 43.130434782608695,
"alnum_prop": 0.6522177419354839,
"repo_name": "yongshengwang/builthue",
"id": "3e46335fae2a3294b1a093738d910e7f79622860",
"size"... |
import json
import pytest
from f5_cccl.api import F5CloudServiceManager
from f5_cccl.exceptions import F5CcclConfigurationReadError
from f5_cccl.resource import ltm
from f5_cccl.resource.ltm.virtual import ApiVirtualServer
from f5_cccl.service.manager import ServiceConfigDeployer
from f5_cccl.service.config_reader imp... | {
"content_hash": "b3c576464b0deb19522f3261401c3b53",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 98,
"avg_line_length": 37.74576271186441,
"alnum_prop": 0.6403233048944769,
"repo_name": "ryan-talley/f5-cccl",
"id": "bd3413544ffbcf8695d531e57c0a628e4205aa8a",
"size": "2... |
from django.contrib.gis.db.models import PointField
from django.db.models import CharField, FloatField
from django.contrib.gis.db.models.functions import GeoFunc, GeomOutputGeoFunc
class Length(GeoFunc):
""" ST_Length postgis function """
output_field = FloatField()
class SimplifyPreserveTopology(GeomOutput... | {
"content_hash": "9aeaf540a4024867d101dd9bf95ac676",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 112,
"avg_line_length": 25.84090909090909,
"alnum_prop": 0.7044854881266491,
"repo_name": "GeotrekCE/Geotrek-admin",
"id": "239b01896943f5b598c78bbe2e5a6599cc3db19a",
"size... |
from recipe_scrapers.woop import Woop
from tests import ScraperTest
class TestWoopScraper(ScraperTest):
scraper_class = Woop
def test_host(self):
self.assertEqual("woop.co.nz", self.harvester_class.host())
def test_title(self):
self.assertEqual(
self.harvester_class.title(),
... | {
"content_hash": "6f7f44cdc9f9243035927083d157e570",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 519,
"avg_line_length": 46.9375,
"alnum_prop": 0.6284953395472703,
"repo_name": "hhursev/recipe-scraper",
"id": "5997c39235b9b8e5c641a065fb02f13664b5cd13",
"size": "3005",
... |
from scaleiopy.scaleio import ScaleIO
from scaleiopy.api.scaleio.mapping.snapshotspecification import SIO_SnapshotSpecification
from pprint import pprint
import sys
# How to run:
# python create-snapshot-of-volume.py ip-to-gw user pass volume_name
sio = ScaleIO("https://" + sys.argv[1] + "/api",sys.argv[2],sys.argv[3... | {
"content_hash": "e96f75e50a31d34a772385075c0c6d0e",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 183,
"avg_line_length": 35.096774193548384,
"alnum_prop": 0.6985294117647058,
"repo_name": "swevm/scaleio-py",
"id": "9562a6324313286cac23e15eed1820c22b740109",
"size": "10... |
from typing import TYPE_CHECKING
from decimal import Decimal
import datetime
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QVBoxLayout, QLabel, QGridLayout
from electrum_ltc.i18n import _
from .util import WindowModalDialog, ButtonsLineEdit, ColorScheme, Buttons, CloseButton, MONOSPACE_FONT
if TYPE_CHECK... | {
"content_hash": "370cfb571bd3008318498fa2279363da",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 103,
"avg_line_length": 40.357142857142854,
"alnum_prop": 0.6095575221238938,
"repo_name": "vialectrum/vialectrum",
"id": "10f3a7579d38e2e80c395a1387c64acad1ce9c5c",
"size"... |
from a10sdk.common.A10BaseClass import A10BaseClass
class AddressList(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param ipv4_address: {"type": "string", "description": "IP address", "format": "ipv4-address"}
:param ipv4_netmask: {"type": "string", "description":... | {
"content_hash": "d4ce65be902e6b3d044661873d689de1",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 340,
"avg_line_length": 45.00952380952381,
"alnum_prop": 0.6159542953872197,
"repo_name": "a10networks/a10sdk-python",
"id": "7e4954244d2b3e665b76539c1c87f77794cf5be2",
"s... |
__author__ = 'digao'
from collections import defaultdict
import sys
import re
def rec_depth(graph,k,seen,parents,cycles):
parents.append(k)
seen.add(k)
for other in graph[k]:
if len(parents)>1 and other in parents:
index = parents.index(other)
if index < len(parents)-2:
... | {
"content_hash": "53197252d3a82c85d8af17229ec1f66a",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 54,
"avg_line_length": 22.215686274509803,
"alnum_prop": 0.5939982347749339,
"repo_name": "digaobarbosa/algorithms",
"id": "c1bbceae90f4ec363051356b8e7fa73b3b321d79",
"size... |
import json
import functools
from django.conf import settings
from django.test import Client, TestCase
__all__ = ['JsonTestClient', 'JsonTestMixin', 'JsonTestCase']
class JsonTestClient(Client):
def _json_request(self, method, url, data=None, *args, **kwargs):
method_func = getattr(super(JsonTestClient,... | {
"content_hash": "8da8a508e1fb633ec61fc0cef3287d56",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 99,
"avg_line_length": 32.65853658536585,
"alnum_prop": 0.6325616131441374,
"repo_name": "fusionbox/django-argonauts",
"id": "0775979154abf59b2f6054b2e4eb2fb06da7fa46",
"si... |
"""
Created on Tue Feb 17 11:15:48 2015
@author: Andreu Mora
Example script to demonstrate the fundamentals of Hidden Markov Models based on
[Rabiner 89] A Tutorial on Hidden Markov Models and Selected Applications in
Speech Recognition.
"""
import pandas as pd
import numpy as np
class SimpleHMM:
... | {
"content_hash": "2854f85f91c1e913ef646104262b4b4f",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 127,
"avg_line_length": 38.37323943661972,
"alnum_prop": 0.5935033951183704,
"repo_name": "drublackberry/fantastic_demos",
"id": "03cb2244c26cfd1753ab830899f14bceb3198d02",
... |
"""File utitilies for Python:
Meta-Data
================================================================================
Author: Tavis Rudd <tavis@damnsimple.com>
License: This software is released for unlimited distribution under the
terms of the MIT license. See the LICENSE file.
Version: $Revision:... | {
"content_hash": "7dbf02cfbeca94d2929e74adca7c1977",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 81,
"avg_line_length": 31.048387096774192,
"alnum_prop": 0.5146320346320347,
"repo_name": "skyostil/tracy",
"id": "fb1ecc2bc0b0a6cda0797f999b816075c72eb6eb",
"size": "1163... |
lyr = iface.activeLayer()
feats = lyr.getFeatures()
xmin=180
ymin=90
xmax=-180
ymax=-90
vertices=0
for feat in feats:
bb = feat.geometry().boundingBox()
#print bb.toString()
xmin = xmin if xmin < bb.xMinimum() else bb.xMinimum()
ymin = ymin if ymin < bb.yMinimum() else bb.yMinimum()
xmax = xmax if x... | {
"content_hash": "b67115e226a50eba4f2998c2c9bf5a1f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 58,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.6742424242424242,
"repo_name": "BergWerkGIS/detect-corrupt-tiff",
"id": "8957ee6f55db5d99e2a4f80df4e369f310931cb9",... |
from django import template
from django.conf import settings
from django.shortcuts import render_to_response
import os
import subprocess
register = template.Library()
@register.simple_tag
def socketio_head():
return """
<script src="/socket.io/socket.io.js"></script>
<script type="text/ja... | {
"content_hash": "e3431f32a773fe3cc5b35a8b916fe75a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 81,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.5140845070422535,
"repo_name": "pztrick/django-socketio-events",
"id": "4547c8d301e0b42b04b920efd704a7bef58b5e3a",
... |
import copy
import glob
import os
import os.path as op
import shutil
import pathlib
import numpy as np
from numpy.testing import assert_equal
import pytest
from matplotlib import pyplot as plt
from mne import Epochs, read_events, read_evokeds
from mne.io import read_raw_fif
from mne.datasets import testing
from mne.r... | {
"content_hash": "2376e6365aadc6692d033c96e87e24ca",
"timestamp": "",
"source": "github",
"line_count": 492,
"max_line_length": 79,
"avg_line_length": 40.014227642276424,
"alnum_prop": 0.6387463808604663,
"repo_name": "cjayb/mne-python",
"id": "f8b555947d4707e571b960b41d94d56a4044f975",
"size": "19... |
from __future__ import unicode_literals
import logging
import sys
from raven.utils.testutils import TestCase
from raven.utils import six
from raven.base import Client
from raven.handlers.logging import SentryHandler
from raven.utils.stacks import iter_stack_frames
class TempStoreClient(Client):
def __init__(self... | {
"content_hash": "84c0e93e7f4b80462883f2f80cf3163c",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 105,
"avg_line_length": 40.99065420560748,
"alnum_prop": 0.6394208846329229,
"repo_name": "gregorynicholas/raven-python",
"id": "248cdcc69877e9e871948717550832d835fef0ca",
... |
#-*- coding: utf-8 -*-
# Copyright (c) 2015-2022, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Cube File Support
##########################
Cube files contain an atomic geometry and scalar field values corresponding to
a physical quantity.
"""
import os
import six
import n... | {
"content_hash": "ec6a5f02587a1b5c292932908037409b",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 94,
"avg_line_length": 41.293103448275865,
"alnum_prop": 0.5459986082115519,
"repo_name": "exa-analytics/exatomic",
"id": "7bf7d77d71bd169dc04310a38a568895c8cb4444",
"size... |
"""\
Please update your code to use authkit.authorize.wsgi_adaptors instead of this
module.
"""
from authkit.authorize.wsgi_adaptors import *
| {
"content_hash": "1c8c7fd73648e883dedfce0b53f17dda",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 78,
"avg_line_length": 23.833333333333332,
"alnum_prop": 0.7692307692307693,
"repo_name": "cedadev/AuthKit",
"id": "8f1dfea7d55a2ce38f31e841eb08e5986c3cd1b1",
"size": "143",... |
import os
import socket
import struct
import sys
import threading
import time
import urllib
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
from urllib import quote
input = raw_input
except ImportError:
from http.server import SimpleHTTPRequestHandler
... | {
"content_hash": "37a3a86308bfcd3592189177d06f5479",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 148,
"avg_line_length": 35.48550724637681,
"alnum_prop": 0.620992444353686,
"repo_name": "Jerry-Shaw/FBI",
"id": "9fb4a4d00f3fddd8b6d230ab9b01d251f77bc784",
"size": "4940"... |
def build_vocabulary(data):
reviews_file = open(data, "r")
megadoc = ""
for line in reviews_file:
megadoc = megadoc + line
words = megadoc.split()
words.sort()
count=1
freq=[]
vocab =[]
while len(words) > 0:
temp = words[0]
vocab.ap... | {
"content_hash": "b49c8a31caeabd79cb96eaff16d03f84",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 49,
"avg_line_length": 17.9672131147541,
"alnum_prop": 0.5155109489051095,
"repo_name": "bharathdintakurti/Natural-Language-Processing",
"id": "c8a4e266d2e6e30302fed2da887a20... |
import re
import time
import logging
import traceback
import colored
from dnutils import out, ifnone
from collections import defaultdict
import random
from functools import reduce
# math functions
USE_MPMATH = True
try:
if not USE_MPMATH:
raise Exception()
import mpmath # @UnresolvedImport
mp... | {
"content_hash": "6716e3a55f83c0392a08fb35e78aef10",
"timestamp": "",
"source": "github",
"line_count": 505,
"max_line_length": 153,
"avg_line_length": 27.532673267326732,
"alnum_prop": 0.5619965477560415,
"repo_name": "danielnyga/pracmln",
"id": "2c8ce33066e8e5b1f01506dacf7a6ab6ea93baa7",
"size": ... |
import copy # for deepcopy function
class Matrix(object):
'''This is the main class for all 2x2 and 3x3 matrices.
It contains all functions that can be used commonly for both the types of matrices that we deal with in this project.
It serves as the parent class for the classes: twoBytwo and threeBythree.
'''
def... | {
"content_hash": "83bf6c2a09ab8b3b0c5a902a37d2a32e",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 163,
"avg_line_length": 29.43452380952381,
"alnum_prop": 0.6537917087967644,
"repo_name": "agdhruv/cs101-matrices",
"id": "c20899f1c836f274620773895190d662da3f01d7",
"size... |
contacts = {
'Shannon': '202-555-1234',
'Amy': '410-515-3000',
'Jen': '301-600-5555',
'Julie': '202-333-9876'
}
# We can use the dictionary method .values() to give us a list of all of the values in contacts.
print contacts.values()
for phone in contacts.values():
print "{0}".format(phone)
# .va... | {
"content_hash": "be72042c54c1f98df06b9e99c0d11db4",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 139,
"avg_line_length": 34.94117647058823,
"alnum_prop": 0.6717171717171717,
"repo_name": "keum/python-lessons",
"id": "ea03e01d93b6b217e84d348d54f243d79959c888",
"size": "... |
import tarfile
import zipfile
from io import BytesIO
from textwrap import dedent
from pants.backend.python import target_types_rules
from pants.backend.python.goals import package_pex_binary
from pants.backend.python.target_types import PexBinary
from pants.backend.python.util_rules import pex_from_targets
from pants.... | {
"content_hash": "b20561165541f1fb70734c83f702634e",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 100,
"avg_line_length": 33.103585657370516,
"alnum_prop": 0.5756408713443254,
"repo_name": "jsirois/pants",
"id": "f40cdb506c2522ff3a8d60086f5e92a81a9b900f",
"size": "8441... |
import json
def main():
vertex_list = []
with open('../model/exxos_mask.json', 'rb') as fp:
data = json.load(fp)
# print(data)
for _object in data:
_object_dict = data[_object]['object']
_object_name = _object_dict['object_name']
print('Found an object, named \'%s\'' % _object_name)
... | {
"content_hash": "f8bfe26e732516a7366947e03645fe06",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 55,
"avg_line_length": 21.136363636363637,
"alnum_prop": 0.5956989247311828,
"repo_name": "astrofra/amiga-experiments",
"id": "2ae69ab861dfe9a766535189ba68807e474bde4e",
"s... |
import sys, os
import cloud_sptheme as csp
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# 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,... | {
"content_hash": "47c7f90cd53bad5dd1f213ed7db68c40",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 151,
"avg_line_length": 31.70294117647059,
"alnum_prop": 0.7011782169032378,
"repo_name": "Mellanox/fuel-docs",
"id": "d6b762ec89d802648aba6ce97fd584da7ad58978",
"size": "... |
from polyaxon.constants.globals import UNKNOWN
from polyaxon.utils.path_utils import module_type
from traceml.events import V1EventChart, V1EventChartKind
from traceml.logger import logger
from traceml.processors.errors import (
BOKEH_ERROR_MESSAGE,
MATPLOTLIB_ERROR_MESSAGE,
PLOTLY_ERROR_MESSAGE,
)
try:
... | {
"content_hash": "e3a007f858b616ad5abfe274caf292a5",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 98,
"avg_line_length": 28.9438202247191,
"alnum_prop": 0.6583850931677019,
"repo_name": "polyaxon/polyaxon",
"id": "ecf47af621936ebb4699b7f2bcf1275037bb7a4c",
"size": "3181... |
"""cinema: director."""
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cinema.models.commoninfo import CommonInfo
class Director(CommonInfo):
"""Director."""
name = models.CharField(_("name"), max_length=80, help_text=_("D... | {
"content_hash": "dbed03ebdc2f0137c09209ab79f3f86e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 98,
"avg_line_length": 29.627906976744185,
"alnum_prop": 0.6365777080062794,
"repo_name": "juliotrigo/restfulwebapi",
"id": "65f80db1b777cc8f0e9f678aa4084a1438441f37",
"siz... |
__author__ = 'mathijs'
import collections
from hbobject import HbObject
import logging
# e.g.
# dependencies =
# {
# 'parent':{'default': PointSet()}
#
# settings =
# {
# 'model':{
# 'default':['linear','seasonal'],
# 'help' :'Model to use in least squares parameter estimation',
# 'valid_set... | {
"content_hash": "9474b3d77972dab59f4418c269be53b6",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 92,
"avg_line_length": 29.301435406698566,
"alnum_prop": 0.5311887655127367,
"repo_name": "mwschouten/procapp",
"id": "05dcfe4a52d413263bd7866c06a5ab133935d04b",
"size": "... |
from _timer import * | {
"content_hash": "aff180acf9aa003b96ff31e0322d2026",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 20,
"avg_line_length": 20,
"alnum_prop": 0.75,
"repo_name": "utluiz/utluiz.github.io",
"id": "eef14f6fbf01e6c3ad629c653e140a7a89916473",
"size": "20",
"binary": false,
"... |
from __future__ import unicode_literals
from django.db import models, migrations
import user_management.api.models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AuthToken',
fields=[
... | {
"content_hash": "915d528b03599c14c86dd7cf206ebc6f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 116,
"avg_line_length": 30.045454545454547,
"alnum_prop": 0.6354009077155824,
"repo_name": "incuna/django-user-management",
"id": "f24ab98d8112e9332a4100b2cb7f6803853331ec",
... |
import pytest
import sqlparse
from sqlparse import sql, tokens as T
def test_issue9():
# make sure where doesn't consume parenthesis
p = sqlparse.parse('(where 1)')[0]
assert isinstance(p, sql.Statement)
assert len(p.tokens) == 1
assert isinstance(p.tokens[0], sql.Parenthesis)
prt = p.tokens[... | {
"content_hash": "ae1edd2bddc1a9066296aaf278d510f1",
"timestamp": "",
"source": "github",
"line_count": 429,
"max_line_length": 79,
"avg_line_length": 32.53146853146853,
"alnum_prop": 0.5644167383204357,
"repo_name": "andialbrecht/sqlparse",
"id": "4ffc69f3ea11a82cd1ebaf923accb8ad5fb1d369",
"size":... |
class URLNormalizingMiddleware(object):
"""Middleware filter to handle URL normalization."""
# NOTE(morgan): This must be a middleware as changing 'PATH_INFO' after
# the request hits the flask app will not impact routing.
def __init__(self, app):
self.app = app
def __call__(self, environ... | {
"content_hash": "e189a14f406c6ab1916bef836bd0192d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 79,
"avg_line_length": 38.82608695652174,
"alnum_prop": 0.6136618141097424,
"repo_name": "mahak/keystone",
"id": "faf98249034764f0b158cfb1f1f1c6714dedcf29",
"size": "1483",... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'SingleImage.image'
db.alter_column('content_singleimage', 'image', self.gf('dj... | {
"content_hash": "d307dcf818e5a5ff9f965f38888871e5",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 191,
"avg_line_length": 74.76612903225806,
"alnum_prop": 0.553985546327257,
"repo_name": "zniper/automag",
"id": "222d980b7086571b0aed407db246bd0128b102a5",
"size": "9295"... |
"""
Test cases for the dircache module
Nick Mathewson
"""
import unittest
from test.test_support import run_unittest, TESTFN
import dircache, os, time, sys, tempfile
class DircacheTests(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
def tearDown(self):
for fname i... | {
"content_hash": "1f566a8458e693e706aebed7b5379402",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 81,
"avg_line_length": 31.534246575342465,
"alnum_prop": 0.6198957428323197,
"repo_name": "MalloyPower/parsing-python",
"id": "68f6fc28b6c49292fa0db2a418efcbc17b070ec2",
"s... |
"""Reads vehicle status from BMW connected drive portal."""
import logging
import voluptuous as vol
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD
from homeassistant.helpers import discovery
from homeassistant.helpers.event import track_utc_time_change
import homeassistant.helpers.config_validation as c... | {
"content_hash": "43f1fa02af013cc3e0455c626f92e865",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 88,
"avg_line_length": 32.16883116883117,
"alnum_prop": 0.6483649576100121,
"repo_name": "Cinntax/home-assistant",
"id": "8e67da86dc3014a034677aaa447e60ae32e3fce5",
"size"... |
'''
Created on Mar 27, 2015
@author: maxz
'''
import seaborn as sns
import itertools
from GPyNotebook.util import lim
from GPyNotebook.plotting.plot import LabelDictPlot
class Scatter(LabelDictPlot):
def __init__(self, X, lab_dict, colors=None, markers=None, figsize=(4,3), figtype=None, *args, **kwargs):
... | {
"content_hash": "2971a4ae1363ebdf247fd5fa3b63b765",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 147,
"avg_line_length": 31.956521739130434,
"alnum_prop": 0.5573696145124717,
"repo_name": "mzwiessele/GPyNotebook",
"id": "ad9ac2f26191d0ca3096bb91bc83443a725929f9",
"size... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_spice_collective_miner_human_male_01.iff"
result.attribute_template_id = 9
result.stfName("npc_name","human_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return re... | {
"content_hash": "27aaf690974a16259e0bdc8adeae37f8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 90,
"avg_line_length": 24.923076923076923,
"alnum_prop": 0.7037037037037037,
"repo_name": "anhstudios/swganh",
"id": "71cbff82c491ee6482a2daf48753cad98b7a6bc5",
"size": "46... |
import xml.etree.ElementTree as ET
from Crypto.PublicKey import RSA
from Crypto import Random
from Crypto.Hash import SHA256
pubkey=RSA.importKey('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCbT3x5Uk2aQuExM/mozvXZvoZ3HC5hsHgG18FLAmb2mESHm2ZvPveqDt/dqOop+5hSoY5L5zsfi61Xec9kCKTn6AgVDWMG7EHyr4jyQ5bL6je+jdcIEVgCL+WqkWR16RNZzPI... | {
"content_hash": "177b84d614d4853f8e189e4348ee1d58",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 236,
"avg_line_length": 36.526315789473685,
"alnum_prop": 0.792507204610951,
"repo_name": "mitre-cyber-academy/2015-traditional-250b",
"id": "468e579ff866f6793b542af0e82e16f9... |
import re
import requests
from bs4 import BeautifulSoup
from models import Torrent
from abc import ABCMeta, abstractmethod
class TorrentApi(object):
__metaclass__ = ABCMeta
def __init__(self, base_url):
protocol_match = re.match(r'^https?://', base_url)
if not protocol_match:
base... | {
"content_hash": "541b895256008725cbc44f55702706d6",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 81,
"avg_line_length": 36.242105263157896,
"alnum_prop": 0.5965727563171652,
"repo_name": "DandyDev/flood",
"id": "0a8d80870b6011670f718f6f8d2ea6f9bbc9b50e",
"size": "3443"... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/droid/component/shared_item_storage_module_3.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return resul... | {
"content_hash": "9dd08ebe2709b1d1bf516702cd930017",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 92,
"avg_line_length": 24.692307692307693,
"alnum_prop": 0.7009345794392523,
"repo_name": "obi-two/Rebelion",
"id": "2c741cb9e45b03e80bfd00b338d6c2509d628945",
"size": "466... |
import re
import sys
import argparse
import compiler
import preprocessor
import config
import cli
import errno
def read_cli_args():
cli.printv("Read CLI arguments.");
# Define command line arguments.
ap = argparse.ArgumentParser('nsbcomp');
ap.add_argument('--input', '-i', action='store', nargs='+',
help='spec... | {
"content_hash": "abffe2f7b172c748c113aa38c239f6b2",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 61,
"avg_line_length": 24.526315789473685,
"alnum_prop": 0.6765021459227468,
"repo_name": "eerotal/nsbcomp",
"id": "9c1b34f5ede4046b689b1062f2a75cd62d1e883b",
"size": "1879... |
"""
This file contains Python code illustrating the creation and manipulation of
vtkTable objects.
"""
from vtk import *
#------------------------------------------------------------------------------
# Script Entry Point (i.e., main() )
#----------------------------------------------------------------------... | {
"content_hash": "2c2a1cec4136c4a92b6f98b8d40f5cbf",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 79,
"avg_line_length": 30.604166666666668,
"alnum_prop": 0.4200136147038802,
"repo_name": "timkrentz/SunTracker",
"id": "41004a51f72ace2efac94b3320d1b592b041f8a6",
"size": ... |
from __future__ import absolute_import
class LoginForm(object):
def __init__(self, name: str=None, password: str=None):
self._name = name
self._password = password
def __init__(self, post):
self._name = post.get('name') or None
self._password = post.get('password') or None
... | {
"content_hash": "13fc5dd33ac09a1a50c0ab1dcdb92992",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 59,
"avg_line_length": 22.571428571428573,
"alnum_prop": 0.5886075949367089,
"repo_name": "SWE574-Nerds/friendly-eureka",
"id": "a80c7dbb3034d5555a3f77403a3083a5809ee46f",
... |
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
from airflow.exceptions import AirflowException
import time
def invoke_sts_job(sts_id,project):
"""
This function synchronously invokes a transfer service job.
Args:
sts_id (str): the id of your transfer servi... | {
"content_hash": "6e82753b6b1c2cbdfcbc4161538228ae",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 116,
"avg_line_length": 37.935483870967744,
"alnum_prop": 0.6879251700680272,
"repo_name": "GoogleCloudPlatform/professional-services",
"id": "91c1f967cd0c99b626f0c16c6da451b... |
"""Manages watermarks of PCollections and AppliedPTransforms."""
from __future__ import absolute_import
import threading
from apache_beam import pipeline
from apache_beam import pvalue
from apache_beam.runners.direct.util import TimerFiring
from apache_beam.utils.timestamp import MAX_TIMESTAMP
from apache_beam.utils... | {
"content_hash": "04b844e864df69ca5096d0809434873a",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 80,
"avg_line_length": 38.83265306122449,
"alnum_prop": 0.695606474668909,
"repo_name": "staslev/incubator-beam",
"id": "935998d27de0f281f28a08460ab3791fd0d406a6",
"size":... |
import numpy as np
class ClassifierTrainer(object):
""" The trainer class performs SGD with momentum on a cost function """
def __init__(self):
self.step_cache = {} # for storing velocities in momentum update
def train(self, X, y, X_val, y_val,
model, loss_function,
reg=0.0,
... | {
"content_hash": "3aa1b9a77d6e8e2a2eaabe5e1a351f13",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 103,
"avg_line_length": 39.23463687150838,
"alnum_prop": 0.5823722056101381,
"repo_name": "Hex-iang/cs231n-practice",
"id": "1a347b7a4d813bda20e345004372629dd1b1bbec",
"si... |
__author__ = 'evancox'
import numpy as np
import hashlib
import os
import shutil
import subprocess
import logging
from lxml import etree
from sklearn_pmml.convert import TransformationContext
from sklearn_pmml.convert.features import *
_TARGET = [0, 1, 2]
_TARGET_NAME = 'y'
_TEST_DIR = 'jpmml_test_data'
logging.ba... | {
"content_hash": "a891ae29faccc17a3986b6c044720571",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 192,
"avg_line_length": 33.78125,
"alnum_prop": 0.6329324699352451,
"repo_name": "kod3r/sklearn-pmml",
"id": "fa486c6cd80b497d9901a308b42530444d7f0774",
"size": "5405",
... |
"""
WSGI config for theaterwecker 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | {
"content_hash": "5b120afa04f1dd0e3c7462582e966b36",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.25,
"alnum_prop": 0.7772277227722773,
"repo_name": "CodeforChemnitz/TheaterWecker",
"id": "6e02c34fb009ed55080647db731f94334d9b4fa5",
"size": "404... |
import sys
import pytest
import shutil
import numpy as np
import pandas as pd
from pysd.tools.benchmarking import assert_frames_close
from pysd import read_vensim, load
@pytest.fixture(scope="module")
def data_folder(_root):
return _root.joinpath("more-tests/data_model/")
@pytest.fixture(scope="module")
def d... | {
"content_hash": "a94208566ce41a6dd0d51cd6a76c8e00",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 77,
"avg_line_length": 30.941176470588236,
"alnum_prop": 0.5386565272496832,
"repo_name": "JamesPHoughton/pysd",
"id": "9bd650970286640b7c270ba52aa8a0522717062d",
"size": ... |
from .translate2csv import translate2csv
| {
"content_hash": "0e25ee6afd5d7933933e35bba0c08b4f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 40,
"avg_line_length": 41,
"alnum_prop": 0.8780487804878049,
"repo_name": "duboviy/study_languages",
"id": "485be08b7fe52ece0484392b897acf9887d37c3c",
"size": "41",
"binar... |
import os
import socket
import time
from django.core.cache import get_cache
from django.core.files.base import ContentFile
from django.utils import simplejson
from django.utils.encoding import smart_str
from django.utils.functional import SimpleLazyObject
from hashlib import md5
from django.utils.importlib import impo... | {
"content_hash": "5a5787cf95c9b567620f8b622313445e",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 77,
"avg_line_length": 30.085271317829456,
"alnum_prop": 0.6851326977583098,
"repo_name": "drawquest/drawquest-web",
"id": "e8a7749035bc0eade2c2bf91b57159bf4a291e2d",
"siz... |
"""
RPC-related utility functions
"""
__author__ = 'Dan Gunter <dkgunter@lbl.gov>'
__date__ = '8/24/15'
# Imports
# Stdlib
import argparse
import enum
import math
import re
import sys
# Third-party
from thrift.Thrift import TType
# Constants
FIXME = '// FIXME'
# Classes and functions
class InvalidField(Exception)... | {
"content_hash": "c49c3c1f46d2415b3da548d81c5e6422",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 86,
"avg_line_length": 31.039408866995075,
"alnum_prop": 0.5300745913347088,
"repo_name": "kbase/data_api",
"id": "68816ef3cad8d8ac2b3a4d36de1a7a24b8beea3d",
"size": "6301... |
from django.contrib import admin
from lomadee import models
@admin.register(models.Computer)
class ComputerAdmin(admin.ModelAdmin):
list_display = ('name', 'price', 'cpu', 'ram', 'disk',
'is_macbook', 'has_gpu', 'has_ssd')
| {
"content_hash": "b734283327039085862750429e6ce698",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 58,
"avg_line_length": 31.125,
"alnum_prop": 0.6506024096385542,
"repo_name": "msfernandes/facebook-chatbot",
"id": "f6e76088d34f74b70a3a3527e07cca9f616cb5cf",
"size": "249"... |
from __future__ import print_function, division, unicode_literals
from abc import ABCMeta, abstractproperty, abstractmethod
from collections import namedtuple
from distutils.version import LooseVersion
from functools import wraps
from itertools import takewhile, dropwhile
import operator
import re
import sys
try:
... | {
"content_hash": "69d3125737c152c9ac3faab8584d3d76",
"timestamp": "",
"source": "github",
"line_count": 1615,
"max_line_length": 79,
"avg_line_length": 25.11455108359133,
"alnum_prop": 0.5531558185404339,
"repo_name": "ChrisBeaumont/soupy",
"id": "ec4903efd2f1fc708a27d50e7945157d9a9e15da",
"size": ... |
"""
Copyright (c) 2017, Ryan Dellana
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the fol... | {
"content_hash": "8edcbe37996d03562336941d1cdd10f8",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 150,
"avg_line_length": 57.642857142857146,
"alnum_prop": 0.7050805452292441,
"repo_name": "DJTobias/Cherry-Autonomous-Racecar",
"id": "02734ccff3f48c0ff9d2cdf6327448dc05b235... |
import unittest
import datetime
import numpy as np
import desisurvey.plan
import desisurvey.etc
import desisurvey.config
import desisurvey.utils
from desisurvey.test.base import Tester
from desisurvey.scripts import surveyinit
from desisurvey.scheduler import Scheduler
class TestScheduler(Tester):
def test_sch... | {
"content_hash": "da23b569aac382e2bbbea7860a72ab42",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 91,
"avg_line_length": 44.73913043478261,
"alnum_prop": 0.6112730806608357,
"repo_name": "desihub/desisurvey",
"id": "7caa0c7d178df9f5b0d4118401039b65eb8ddf44",
"size": "30... |
"""
The MIT License (MIT)
Copyright (c) 2016, Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merg... | {
"content_hash": "2c7b03119fecb2c8b5e9d38ff31c46a2",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 78,
"avg_line_length": 40.25961538461539,
"alnum_prop": 0.6520181514210652,
"repo_name": "mrogaski/django-discord-bind",
"id": "364f56cb9b08398ca00de757aebb8dc6c3e71b87",
... |
def Thread(id, uri, title):
return {
"id": id,
"uri": uri,
"title": title
}
class Threads(object):
def __init__(self, db):
self.db = db
self.db.execute([
'CREATE TABLE IF NOT EXISTS threads (',
' id INTEGER PRIMARY KEY, uri VARCHAR(256) ... | {
"content_hash": "986e1770be187d857c6dd43059bf4bd1",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 96,
"avg_line_length": 29.70967741935484,
"alnum_prop": 0.5407166123778502,
"repo_name": "posativ/isso",
"id": "060f074c92689123d00bb8c781c807d772f942b5",
"size": "949",
... |
import io
from pkgutil import walk_packages
from setuptools import setup
def find_packages(path):
# This method returns packages and subpackages as well.
return [name for _, name, is_pkg in walk_packages([path]) if is_pkg]
def read_file(filename):
with io.open(filename) as fp:
return fp.read().s... | {
"content_hash": "48cfc24f64d6eec54bcfa882a206e089",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 33.18518518518518,
"alnum_prop": 0.6484375,
"repo_name": "darkrho/scrapy-inline-requests",
"id": "c30d1b7d06df9ffc1bc312e5ae73c41219a96d54",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.