text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Based on:
http://stackoverflow.com/questions/7861196/check-if-a-geopoint-with-latitude-and-longitude-is-within-a-shapefile
"""
from osgeo import ogr
import sys
DATAPATH = '/home/kedo/Dropbox/CS 194-16/neighborhoods/'
drv = ogr.GetDriverByName('ESRI Shapefile') #We will load a shape file
#Get the contents of the sh... | {
"content_hash": "a6d92ffbabbfea8fb3884fe6c43ad694",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 112,
"avg_line_length": 38.354166666666664,
"alnum_prop": 0.7409016838674634,
"repo_name": "kennydo/datascience-hanzai-keisu",
"id": "6411030c195a4105c26b71f6c202fc587cec8032... |
"""Loss for a Joint Multimodal Variational Auto-Encoder (JMVAE).
Closely follows the implementation in the following paper:
Joint Multimodal Learning with Deep Generative Models
Masahiro Suzuki, Kotaro Nakayama, Yutaka Matsuo
ArXiv: https://arxiv.org/abs/1611.01891
"""
from __future__ import absolute_import
from __fut... | {
"content_hash": "7f031879a6bb0d935a439b7c18c1acc7",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 80,
"avg_line_length": 35.805,
"alnum_prop": 0.6427873202066751,
"repo_name": "google/joint_vae",
"id": "e246c5cfbf427e9b93b4b1331802e7f568f154b5",
"size": "7740",
"bina... |
"""Bio.SeqIO support for the "phd" file format.
PHD files are output by PHRED and used by PHRAP and CONSED.
You are expected to use this module via the Bio.SeqIO functions, under the
format name "phd". See also the underlying Bio.Sequencing.Phd module.
For example, using Bio.SeqIO we can read in one of the example P... | {
"content_hash": "021bf0f64746a5683a6fe95d70838ab8",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 77,
"avg_line_length": 38.69387755102041,
"alnum_prop": 0.5831575246132208,
"repo_name": "zjuchenyuan/BioWeb",
"id": "92771e21adf864cbd360b80aaa1f9b25259e7c12",
"size": "5... |
"""
Module containing useful exceptions for pepperstack
"""
class PepperstackException(Exception):
"""
Base class for all pepperstack exception to make
catch-all easier
"""
pass
class DoesNotExistsException(PepperstackException):
"""
An exception class raised when a model is not found
... | {
"content_hash": "8261d213a7bda30f2419b995c2c855f1",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 61,
"avg_line_length": 17.36111111111111,
"alnum_prop": 0.6896,
"repo_name": "Korrigan/pepperstack",
"id": "ae5a130506b5c1e325896d1fdc391b9b74bd8080",
"size": "625",
"bin... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shutil
import sys
from hashlib import sha1
from pants.build_graph.build_graph import sort_targets
from pants.build_graph.target import Target
from pa... | {
"content_hash": "871b649683c427b82e3ac7d3585e5055",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 118,
"avg_line_length": 41.73314606741573,
"alnum_prop": 0.6835834959951538,
"repo_name": "peiyuwang/pants",
"id": "508a42ad47789eb6da6c427c18cce1c10d128d1b",
"size": "150... |
from .base import * # noqa
DEBUG = True
TEMPLATE_DEBUG = True
| {
"content_hash": "1c57e7f47ae6e6b939a5eef93b76f1f7",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 27,
"avg_line_length": 16,
"alnum_prop": 0.6875,
"repo_name": "uppsaladatavetare/foobar-api",
"id": "57c40671a7d08c11d15766e3ce246c21dee7a5a0",
"size": "64",
"binary": fal... |
from django.contrib import admin
import models
from django.utils.html import format_html
# Register your models here.
class ReporteProductoAdmin(admin.ModelAdmin):
list_display = ['id_reporte', 'nombre', 'inicio', 'fin', 'accion_reporte']
search_fields = ['id ', 'nombre', 'inicio', 'fin']
list_display... | {
"content_hash": "f372f013b57d1a38391ed1e27e81f228",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 88,
"avg_line_length": 30.62857142857143,
"alnum_prop": 0.6147388059701493,
"repo_name": "vpadillar/pventa",
"id": "7c7b47c6dd4ad8a161cd0e34114f5d29d0d09204",
"size": "1072... |
from django.apps import AppConfig
class MoonTrackerConfig(AppConfig):
name = 'moon_tracker'
verbose_name = 'Moon Scan Tracker'
def ready(self):
import moon_tracker.signals
| {
"content_hash": "f19a273dde1d78c691c2c263af6f6a6c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 38,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.7025641025641025,
"repo_name": "StephenSwat/eve_lunar_mining_organiser",
"id": "a75f09e146974ab23fee68da000f7acffa71... |
import sitefile
class Channel(object):
def __init__(self, xml, config):
if "site" in xml.attrib:
self.basic = True
self.site = xml.attrib['site']
self.site_id = xml.attrib['site_id']
self.update = xml.attrib['update'] # TODO: Something useful with this
... | {
"content_hash": "9676fc3e51770a4c2d76b1e98af9a2c0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 82,
"avg_line_length": 36.27777777777778,
"alnum_prop": 0.552833078101072,
"repo_name": "cyberjacob/pygrab",
"id": "80f9fa3388b13f3b1794b58573979b8510df1775",
"size": "676"... |
from __future__ import absolute_import
import logging
import weakref
from .base import SubsystemBase
from ..dispatch import Signal
from ..results import ResultsDictionary
__all__ = ['PeerList']
_log = logging.getLogger(__name__)
class PeerList(SubsystemBase):
def __init__(self, core):
self.core = we... | {
"content_hash": "e88177aa31841562071b11bc7d8f6b48",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 77,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.5694524495677233,
"repo_name": "schandrika/volttron",
"id": "df33fc820f836a2f133077510d0d6f39c950305f",
"size": "... |
from jsonmodels.models import Base
from .channel import Channel
class Device(Base):
""" Contains info about a device and it's channels. """
def __init__(self, **kwargs):
"""
Initializes a Device object by looping through the
keywords in kwargs and setting them as attributes.
:... | {
"content_hash": "e911946ce224ffc06a1f7af2135c032d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 39.1578947368421,
"alnum_prop": 0.5806451612903226,
"repo_name": "keerts/pyninjasphere",
"id": "4aab4aec66dcbdcbda6ed1d64c795c8a60461e88",
"size": "7... |
def convert_to_list_of_dicts(header_row, data_rows):
return [dict(zip(header_row, data_row)) for data_row in data_rows]
def convert_to_table_structure(list_of_dicts):
header_row = sorted(list_of_dicts[0].keys())
data_rows = []
for dictionary in list_of_dicts:
data_row = []
for key in... | {
"content_hash": "bd0458af0db981e09faa0cbabbff897a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 70,
"avg_line_length": 22.535714285714285,
"alnum_prop": 0.6196513470681458,
"repo_name": "spothero/py-responsys",
"id": "fab44b942fd671a0887a8d44ea9469c9509850ec",
"size":... |
from enable.savage.svg.svg_extras import *
| {
"content_hash": "9bb1aabee64870c3ae0adfe0e4cf66e6",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 42,
"avg_line_length": 43,
"alnum_prop": 0.7906976744186046,
"repo_name": "enthought/etsproxy",
"id": "860d5f1b59b72a173b024147a416dc1bc2746d1f",
"size": "58",
"binary": f... |
from starthinker.util.google_api import API_DCM
from starthinker.util.cm import get_profile_for_api
def bulkdozer_test(config, task):
print('testing bulkdozer')
if 'verify' in task['traffic']:
is_admin, profile_id = get_profile_for_api(
config, task['auth'], task['traffic']['account_id'])
for en... | {
"content_hash": "cd4a0386d16bbcbf24c018680b887a21",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 114,
"avg_line_length": 35.857142857142854,
"alnum_prop": 0.6347941567065073,
"repo_name": "google/starthinker",
"id": "e8c7ac0877242387e133884e44c492ad242412d4",
"size": "... |
"""
Show vector field flow
"""
from __future__ import division
from vispy import app, scene, visuals, gloo
from vispy.util import ptime
import numpy as np
class VectorFieldVisual(visuals.Visual):
vertex = """
uniform sampler2D field;
attribute vec2 index;
uniform vec2 shape;
uniform vec2 field_s... | {
"content_hash": "270fdba0e73c20b7fe23255cdec26c71",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 79,
"avg_line_length": 33.442708333333336,
"alnum_prop": 0.5530291231895343,
"repo_name": "Eric89GXL/vispy",
"id": "471e56885940a820587c2418ebdcecff6a96018c",
"size": "674... |
from pymongo import Connection
connection = Connection('localhost', 27017)
db = connection.gobblerbot
| {
"content_hash": "fc7e73314bac5151e938d4f6b902cece",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 43,
"avg_line_length": 20.8,
"alnum_prop": 0.7980769230769231,
"repo_name": "alxlit/gobblerbot",
"id": "eb6dcaa58bc2d807dd5ca2e2bb13aecdb960e031",
"size": "127",
"binary":... |
"""Keras backend API.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import itertools
import json
import os
import threading
import weakref
import numpy as np
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.cl... | {
"content_hash": "dff3f7bc8d74ff3abe96a2e2e8122a05",
"timestamp": "",
"source": "github",
"line_count": 5221,
"max_line_length": 95,
"avg_line_length": 30.37751388622869,
"alnum_prop": 0.6332620853588565,
"repo_name": "hehongliang/tensorflow",
"id": "c7654642d0178abca7cd89f6cd629060f8cefa87",
"size... |
"""
Written by Tong He and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
import os
import time
import random
import argparse
import numpy as np
from pathlib import PurePath
import torch
import torch.utils.data
import torch.nn as nn
import torch.optim as optim
from torch.utils... | {
"content_hash": "26c83e715f2530ec2eb1080c7dc503a4",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 79,
"avg_line_length": 33.353233830845774,
"alnum_prop": 0.6027744630071599,
"repo_name": "ThomasYeoLab/CBIG",
"id": "bcb3cbf38a988b428f6dde7829a9bc2dad6ba615",
"size": "6... |
import base64
import binascii
import fcntl
import itertools
import os
import stat
import struct
import sys
import tempfile
import textwrap
import time
import math
try:
from Crypto.Hash import RIPEMD
except ImportError:
RIPEMD = 'RIPEMD'
try:
from cStringIO import StringIO
except ImportError:
from Strin... | {
"content_hash": "0b0c43d764dd39ac5060310d5bdfdc48",
"timestamp": "",
"source": "github",
"line_count": 3604,
"max_line_length": 89,
"avg_line_length": 34.06326304106548,
"alnum_prop": 0.5918510312469454,
"repo_name": "fedora-conary/conary",
"id": "afef956bfab3b6b397c4bec76780b8a60ad26d46",
"size":... |
from __future__ import unicode_literals
from itsdangerous import URLSafeTimedSerializer
from .. import app
ts = URLSafeTimedSerializer(app.config["SECRET_KEY"])
| {
"content_hash": "0fc81ed97cd4af10ccf4ad3398ff2461",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 53,
"avg_line_length": 24.428571428571427,
"alnum_prop": 0.7602339181286549,
"repo_name": "qisanstudio/qsapp-suibe",
"id": "a6f335c1dd6f7c193c60bfa490f79493826432cc",
"size"... |
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('curling', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='sessi... | {
"content_hash": "3866ce826de4f4974231e9714dde7412",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 109,
"avg_line_length": 28.4,
"alnum_prop": 0.5915492957746479,
"repo_name": "zbassett/curling-robot",
"id": "ca9324e504e3b5c4ec5db57b5cab464054b74081",
"size": "925",
"b... |
import sqlalchemy.types as sqltypes
from sqlalchemy.sql import operators, expression
from sqlalchemy.sql import default_comparator
from sqlalchemy.ext.mutable import Mutable
import geojson
class MutableList(Mutable, list):
@classmethod
def coerce(cls, key, value):
""" Convert plain list to MutableLi... | {
"content_hash": "36cd0c3e87b39199ea965947ea34ffd7",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 115,
"avg_line_length": 29.169354838709676,
"alnum_prop": 0.5616533038429637,
"repo_name": "crate/crate-python",
"id": "1a3d7a0655bcd114447211a558cc72b539cd5ec3",
"size": ... |
from nose.tools import * # noqa
from query.helpers import setup_demo_env
import os
def test_demo_setup():
setup_demo_env()
assert os.environ.get("QUERY_DB_DRIVER") is "sqlite"
assert os.environ.get("QUERY_DB_HOST") is None
assert os.environ.get("QUERY_DB_PORT") is None
# Test override of existin... | {
"content_hash": "c9504fbe1d8cf8013be6a58035ed5433",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 56,
"avg_line_length": 32.23529411764706,
"alnum_prop": 0.677007299270073,
"repo_name": "boydgreenfield/query",
"id": "fe7475b36f23ebc5ccbe4d80bd6f9fe6f4c4152f",
"size": "5... |
import glob
import multiprocessing
import os
import platform
import shlex
import subprocess
import sys
from collections import namedtuple
from contextlib import contextmanager
from datetime import date
from distutils import log, sysconfig
from distutils.spawn import find_executable
from textwrap import dedent
import s... | {
"content_hash": "9665fac600984ab5377101b9fca2ef9d",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 140,
"avg_line_length": 35.031413612565444,
"alnum_prop": 0.5348976236735914,
"repo_name": "onnx/onnx",
"id": "e78d09804a19551a971454a08c403e5fa9dfffdc",
"size": "13421",
... |
'''
Simple interface for reporting metrics to DataDog.
'''
from __future__ import print_function
from functools import wraps
import time
class DataDogMetrics(object):
'''
Datadog supports printing to stdout to report metrics. This only gives us
counts and gauges:
https://www.datadoghq.com/blog/mo... | {
"content_hash": "c9eef4b3a921c1fe8d937575b6080c6c",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 89,
"avg_line_length": 36,
"alnum_prop": 0.606815578465063,
"repo_name": "500px/lambda_dd_metrics",
"id": "59d34429388629420d3b0870dc99391fbf8c2cbd",
"size": "3514",
"bin... |
from ctypes import Structure, c_char_p, c_int, c_void_p, CDLL
import ctypes.util
import os, sys
class error(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class datum(Structure):
_fields_ = [
('dptr', c_char_p),
('dsize', c_int),
]
... | {
"content_hash": "3c2a6aeab74acfc3d28d04e141760dc5",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 85,
"avg_line_length": 30.593220338983052,
"alnum_prop": 0.554016620498615,
"repo_name": "sauloal/pycluster",
"id": "6839a4d1a8e4194d0842051991f485d952c51fe9",
"size": "54... |
"""
Given a table of changes (gotten from mesh_changes.py, create the change in the working owl file (doid-edit.owl), using
owltools, then create a new branch and commit it to github. Then create a pull request with a comment containing the
metadata.
"""
import pandas as pd
import requests
from requests.auth import HT... | {
"content_hash": "b9825807d19c9f92de0c2a7d3d2ba676",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 119,
"avg_line_length": 43.472,
"alnum_prop": 0.6076555023923444,
"repo_name": "SuLab/scheduled-bots",
"id": "51522f2ef7f5e81b0180b4e6402b4a5c0b2c36f4",
"size": "5434",
... |
from datetime import datetime
from datetime import timedelta
import time
import json
import googlemaps
import os
HOMEDIR=os.path.expanduser('~')
def commuteEstimate(client, subject, d1, d2, time_threshold):
now = datetime.now()
alternates=False
routes = client.directions(d1, d2,
... | {
"content_hash": "41ef04f1f4e763a1d93cc675435e9756",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 106,
"avg_line_length": 36.43103448275862,
"alnum_prop": 0.6062470421202082,
"repo_name": "jfaulkner/googleAPIUtil",
"id": "ce3b12ea42bb750215f47079fbd9227633e871e6",
"size... |
import belaylibs.models as bcap
from django.db import models
class BelayAccount(bcap.Grantable):
station_url = models.CharField(max_length=200)
class PendingLogin(bcap.Grantable):
# Key is for this server to trust the openID provider's request
key = models.CharField(max_length=36)
# ClientKey is a secret pro... | {
"content_hash": "9f785be2f1c025523a94eef39211bf29",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 66,
"avg_line_length": 33.21212121212121,
"alnum_prop": 0.7782846715328468,
"repo_name": "brownplt/k3",
"id": "1bd4e4cde648002802df7c3fb3837d086c05bd19",
"size": "1096",
... |
import boto
import boto.s3.connection
from django.conf import settings
import logging
log = logging.getLogger(__name__)
def get_s3_connection():
if settings.S3_ACCESS_KEY and settings.S3_SECRET_KEY and settings.S3_HOST:
log.debug('Connecting to {}, with secure connection is {}'.
forma... | {
"content_hash": "f382259788780dd0057c1a10f9a8c47a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 32.42857142857143,
"alnum_prop": 0.6806167400881057,
"repo_name": "2gis/badger-api",
"id": "47e7862c43cb73c1e5f5914222fcb5111e48eeb8",
"size": "908",... |
from setuptools import setup, find_packages
setup(
name = "a10-neutron-lbaas",
version = "1.5.2a",
packages = find_packages(),
author = "A10 Networks",
author_email = "[email protected]",
description = "A10 Networks Openstack LBaaS Driver Middleware",
license = "Apache",
keywords =... | {
"content_hash": "64440cba72e0bc718df9db7d84530839",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 78,
"avg_line_length": 31.264705882352942,
"alnum_prop": 0.6274694261523989,
"repo_name": "Cedev/a10-neutron-lbaas",
"id": "9d8a6b860cbfdf2111eb331f5e7b0aa28addab0a",
"size... |
"""Groebner bases algorithms. """
from __future__ import print_function, division
from sympy.polys.monomials import monomial_mul, monomial_lcm, monomial_divides, term_div
from sympy.polys.orderings import lex
from sympy.polys.polyerrors import DomainError
from sympy.polys.polyconfig import query
from sympy.core.symbo... | {
"content_hash": "82dde99e2afc815c675509ece49f019f",
"timestamp": "",
"source": "github",
"line_count": 861,
"max_line_length": 116,
"avg_line_length": 27.18466898954704,
"alnum_prop": 0.5449457404084422,
"repo_name": "AunShiLord/sympy",
"id": "0f8af05bde60f6fc85cfbcd8530aaea487526afe",
"size": "23... |
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import logging
from amaascore.assets.utils import json_to_asset
from amaascore.config import ENVIRONMENT
from amaascore.core.interface import Interface
from amaascore.core.amaas_model import json_handler
class AssetsInter... | {
"content_hash": "4309a05bf25e3e724e6be90982581f7a",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 120,
"avg_line_length": 47.803149606299215,
"alnum_prop": 0.6101136550815351,
"repo_name": "paul-rs/amaas-core-sdk-python",
"id": "7a328ef2b3ebb3e2c9ad5b4663a4966089721ff8",... |
from typing import Union, Optional
CompressType = Optional[Union[str,bool]]
ParallelType = Union[int,bool]
CacheType = Union[bool,str]
SecretsType = Optional[Union[str,dict]] | {
"content_hash": "a9eac553f7ca6aa171c722be2fad4946",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 40,
"avg_line_length": 29.166666666666668,
"alnum_prop": 0.7828571428571428,
"repo_name": "seung-lab/cloud-volume",
"id": "f4e387799327159b96d01b3810e1fc3e3930ce24",
"size":... |
from django.contrib import admin
from django.conf.urls import url
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import render, redirect
from django.conf import settings
import os
from celery import group
from app_reservas.tasks import obtener_eventos_recurso_especifico
from ..models import R... | {
"content_hash": "64fa9fbc5d76a318bbd232d0eaa5015d",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 126,
"avg_line_length": 29.944444444444443,
"alnum_prop": 0.6181818181818182,
"repo_name": "desarrollogt-frm-utn/reservas",
"id": "78613fe0360f7dd16e59f202646dcf7083deeef1",
... |
from ansible import errors
from ansible import utils
import os
import ansible.utils.template as template
class Task(object):
__slots__ = [
'name', 'meta', 'action', 'only_if', 'when', 'async_seconds', 'async_poll_interval',
'notify', 'module_name', 'module_args', 'module_vars', 'default_vars',
... | {
"content_hash": "35bd149f3e696976ab664246839d47d5",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 152,
"avg_line_length": 45.07017543859649,
"alnum_prop": 0.5682172051381861,
"repo_name": "dlab-berkeley/collaboratool-archive",
"id": "ba7599772e3563d6009ec6b11f68d810f2b63... |
from bson.objectid import ObjectId
from jsonpath_rw import parse
from girder.models.model_base import ValidationException
from girder.constants import AccessType
from girder.api.rest import getCurrentUser
from girder.utility.model_importer import ModelImporter
from .base import BaseModel
from ..utility.volume_adapters... | {
"content_hash": "b5f4d7d6982346489aaf561dbef9c65d",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 79,
"avg_line_length": 32.24107142857143,
"alnum_prop": 0.5801716975906951,
"repo_name": "Kitware/cumulus",
"id": "78f0b96777dd29192d0434bdf7530aea0c3d6fcb",
"size": "4405... |
"""empty message
Revision ID: 2f941b1e9680
Revises: 1a850f7e0aa6
Create Date: 2015-04-04 03:05:00.315217
"""
# revision identifiers, used by Alembic.
revision = '2f941b1e9680'
down_revision = '1a850f7e0aa6'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | {
"content_hash": "2571c5baf8058d095d6b8423b8cf9c03",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 98,
"avg_line_length": 30.147058823529413,
"alnum_prop": 0.6878048780487804,
"repo_name": "codeforamerica/template-maker",
"id": "b39ff328195dd1a9975adeb39b7a6f2ab65090dc",
... |
import json
from persistent_message.models import Message
from myuw.test.api import MyuwApiTest, require_url
@require_url('myuw_banner_message')
class PersistentMessageAPITest(MyuwApiTest):
fixtures = ['persistent_messages.json']
def get_response(self):
return self.get_response_by_reverse('myuw_banne... | {
"content_hash": "927db65d39dbbd29dcac0c43323705c7",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 66,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.684010152284264,
"repo_name": "uw-it-aca/myuw",
"id": "ac1e56fc5bf06fe29eea0653121e1754f82806f0",
"size": "876",
... |
from flask import request, abort
def require_apikey(key):
"""
Decorator for view functions and API requests. Requires
that the user pass in the API key for the application.
"""
def _wrapped_func(view_func):
def _decorated_func(*args, **kwargs):
passed_key = request.args.get('k... | {
"content_hash": "5087f5ae038ae088a0401d1eca703150",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 60,
"avg_line_length": 30.352941176470587,
"alnum_prop": 0.5813953488372093,
"repo_name": "hkpeprah/television-2.0",
"id": "9571eca66a1564bf34cb67adc5b1ee30c55fe4de",
"size... |
from django import template
from django.core.urlresolvers import reverse
register = template.Library()
SKIP_PAGINATION = True # When new filter adds\removes - remove page variable from GET, to jump to first page
@register.simple_tag
def query(GET, name, value, simple_query=True):
result = u'?'
if simple_quer... | {
"content_hash": "6007e1db0885606ce6e68c029270f398",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 127,
"avg_line_length": 39.04494382022472,
"alnum_prop": 0.640863309352518,
"repo_name": "ProstoKSI/django-filters",
"id": "777df02ac65710e3e0d35aebaaf67ab6348fd3fe",
"size... |
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models
from ._configuration import AzureMapsManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operati... | {
"content_hash": "a88d80404eb3661bfdaf6b4db555ae96",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 106,
"avg_line_length": 43.611111111111114,
"alnum_prop": 0.6929936305732484,
"repo_name": "Azure/azure-sdk-for-python",
"id": "84532f21e4a7ba5d2d1d437137bad1e900b2bf33",
"... |
class Graph():
def __init__(self, vertices):
self.vertices = vertices
self.graph = [[0 for column in range(vertices)] for row in range(vertices)]
def min_distance(self, dist, min_dist_set):
min_dist = float("inf")
for v in range(self.vertices):
if dist[v] < min_dist... | {
"content_hash": "ca1132345c3c7579d233e94a7b527250",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 110,
"avg_line_length": 33.1764705882353,
"alnum_prop": 0.5452127659574468,
"repo_name": "amaozhao/algorithms",
"id": "fe5772ec53deb7de5744bb8ae94097eac7ab41ec",
"size": "1... |
from __future__ import absolute_import
import sys, os
if __name__ == '__main__':
if len(sys.argv) < 2:
from .launcher import application_launcher
application_launcher()
else:
from .launcher import start_app
start_app(sys.argv[1]) | {
"content_hash": "32f45ae44ce08ac7bd65a39c9cc9913f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 47,
"avg_line_length": 22.454545454545453,
"alnum_prop": 0.6720647773279352,
"repo_name": "lukacu/manus",
"id": "43dde93c073173dc14db7a4ad8a9da6ea6955aa1",
"size": "247",
... |
from ceph_deploy import exc, mon
from ceph_deploy.conf.ceph import CephConf
from mock import Mock
import pytest
def make_fake_conf():
return CephConf()
# NOTE: If at some point we re-use this helper, move it out
# and make it even more generic
def make_fake_conn(receive_returns=None):
receive_returns = rece... | {
"content_hash": "d4e66dfcdd1163ddaddd1acbc1a28450",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 78,
"avg_line_length": 36.96842105263158,
"alnum_prop": 0.6332574031890661,
"repo_name": "ceph/ceph-deploy",
"id": "7e73cad704e496d38940b648e0255aee6bac346e",
"size": "3512... |
from rest_framework import serializers as ser
from api.base.serializers import JSONAPISerializer, LinksField, JSONAPIListField
from website.models import Subject
class TaxonomyField(ser.Field):
def to_representation(self, subject):
if not isinstance(subject, Subject):
subject = Subject.load(su... | {
"content_hash": "300a650d998ab2ff6aaefda6a6a4da14",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 28.73170731707317,
"alnum_prop": 0.6324278438030561,
"repo_name": "rdhyee/osf.io",
"id": "9a435ad9911180b2f0b2f6f1ed43b25be18705bc",
"size": "1178",
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from datetime import datetime
from enum import Enum
from glob import glob, iglob
from pathlib import Path
from lxml.etree import XMLSyntaxError
from zipfile import ZipFile
from matrix_runner import main, matrix_axis, matrix_action, matrix_command, matrix_filt... | {
"content_hash": "f1e23dd92cbc76f7b69220af1b2cc274",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 133,
"avg_line_length": 33.21686746987952,
"alnum_prop": 0.5984766050054406,
"repo_name": "ARM-software/CMSIS_5",
"id": "e6084b35155f01e5faf7902b7f4b997efa3ea8f6",
"size":... |
sky_model = {}
sky_model['sky_original'] = ('SKY/models/sky_model_original.fits', {})
sky_model['sky_updarm_gaussian'] = ('SKY/models/sky_model_updarm_gaussian.fits', {})
sky_model['sky_updarm_gaussian_hole'] = ('SKY/models/sky_model_updarm_gaussian.fits', {'hole': (4.5, 1.)})
sky_model['sky_updarm_gaussian_hole_morep... | {
"content_hash": "749d9ddb08e7bb24bac00b45085081b2",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 134,
"avg_line_length": 69,
"alnum_prop": 0.6690821256038647,
"repo_name": "hyperion-rt/paper-galaxy-rt-model",
"id": "3d267cca1245308cedab800660291f8ee0301932",
"size": "41... |
from django.conf.urls import patterns, include, url
from homepage.views import HomeIndexView, HomeLoginView, HomeLogoutView, HomeRegisterView
urlpatterns = patterns('',
url( r'^$', HomeIndexView.as_view(), name='index'),
url( r'^logout/', HomeLogoutView.as_view(), name='logout_page' ),
url( r'^login/', Hom... | {
"content_hash": "8d4843bf3253ae1ea7bce7d939059073",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 89,
"avg_line_length": 49,
"alnum_prop": 0.6961451247165533,
"repo_name": "polarkac/ReaderSS",
"id": "db1090876b0a617856d00d21200786834a6d7e2f",
"size": "441",
"binary": f... |
from django.shortcuts import render
# Create your views here.
from .models import Book, Author, BookInstance, Genre
# Function based views
def index(request):
"""
View function for the home page of the site.
"""
# Generate counts of some of the main objects
num_books=Book.objects.all().count()
num_instances=B... | {
"content_hash": "090a3175c76c13a0c57ba7ade5b38f37",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 165,
"avg_line_length": 29.857988165680474,
"alnum_prop": 0.7526753864447087,
"repo_name": "byronvhughey/django_local_library",
"id": "40c3c5aee9f0c89bd62a5e2cea06b36ba1b0c5... |
"""Loose reimplementation of the t2t tokenizer.
Original code:
https://github.com/tensorflow/tensor2tensor/blob/v1.5.5/tensor2tensor/data_generators/tokenizer.py
Provides a WordpiecePreprocessor, a higher order function which takes a
vocabulary object and returns a preprocessor, and a WordpiecePostprocessor.
Note th... | {
"content_hash": "326ac08b0ae8b5111fc5fb714f0cab9b",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 98,
"avg_line_length": 34.94308943089431,
"alnum_prop": 0.6582131223825035,
"repo_name": "ufal/neuralmonkey",
"id": "4a8fe4185010a4a8861b4f4a9395be1afb5fc386",
"size": "42... |
import json
import requests
resp = requests.get('http://samples.openweathermap.org/data/2.5/weather?zip=44143,us&appid=b1b15e88fa797225412429c1c50c122a1')
test = json.dumps(json.loads(resp.content), indent=4)
print("Test: " + test) | {
"content_hash": "e61a70dc714e02ecb642b404725af879",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 126,
"avg_line_length": 29.25,
"alnum_prop": 0.7735042735042735,
"repo_name": "snowsc/Python",
"id": "820f410d005574a638d2e599d701eba11952727a",
"size": "234",
"binary": f... |
from ..service_func import service_func, meta_arg, func_error
class answer_question(service_func):
def __init__(self):
service_func.__init__(self, "/question/answer")
self.name = "Answer question"
self.description = "Answer the current question"
self.args.append(meta_arg("key", "P... | {
"content_hash": "ed14324710026d8860a965ec7fa797d3",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 177,
"avg_line_length": 40.421052631578945,
"alnum_prop": 0.5520833333333334,
"repo_name": "jordsti/hacker-jeopardy",
"id": "f3b1c3fc3a26dc7acef0f6b61a879149401d8d17",
"siz... |
from tastypie.authorization import Authorization
class OwnerBasedAuthorization(Authorization):
def read_list(self, object_list, bundle):
return object_list.filter(owner=bundle.request.user)
def read_detail(self, object_list, bundle):
return bundle.obj.owner == bundle.request.user
# TODO ... | {
"content_hash": "962705a41e9716f945bd198e6b366851",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 62,
"avg_line_length": 36.903225806451616,
"alnum_prop": 0.708916083916084,
"repo_name": "pavelkuchin/tracktrains",
"id": "5d491eb1004194af4d0adc666f62e3ef32d2aa77",
"size"... |
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
from typing import Dict, Optional, Tuple, Union, cast
from ._typing import IcmpReplies
class PingStats:
def __init__(self, *args, **kwargs) -> None:
self.__destination = kwargs.pop("destination", None)
self.__packet_transmit... | {
"content_hash": "d175831cd0f1992b91a9e6ae041bf4fa",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 249,
"avg_line_length": 27.48605577689243,
"alnum_prop": 0.5254384693433831,
"repo_name": "thombashi/pingparsing",
"id": "3801af2f1359cb45721ed1b22c8b155c2eab6b2c",
"size"... |
"""Test site urls.
URLs
----
project/<project_slug>/
content/<content_id>/
"""
from django.conf.urls import patterns, url
from apps.test_crawl import views
urlpatterns = patterns('',
url(r'^content/(?P<content_id>[\w-]+)/$', views.ContentView.as_view(),
name='content')
)
| {
"content_hash": "c153c6349063d755532b8117e2ea0c31",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 17.235294117647058,
"alnum_prop": 0.6382252559726962,
"repo_name": "0x0mar/memex-explorer",
"id": "d4eef146c9d0f82df85a5c6dc00c6b141170e59b",
"size":... |
from sys import argv
from sys import exit
import sys
import re
import os
from subprocess import Popen,PIPE
# read in command line args
params = list(argv)
del params[0]
imgToken = params[0:2]
annoToken = params[2:4]
queryFile = params[4:6]
useSemaphore = params[6:8]
serviceLocation = params[8:10]
dilXY = params[10:1... | {
"content_hash": "cef0e6a93cdbfb385bb38d7a227b6247",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 228,
"avg_line_length": 30,
"alnum_prop": 0.6845238095238095,
"repo_name": "iscoe/cajal3d-i2g",
"id": "fb4388698c9fb9304973bda5effbf344892e83a4",
"size": "3932",
"binary"... |
"""
WSGI config for eeep 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS... | {
"content_hash": "8dbfe02df65ff7a01b1892a88eeb5f6c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.0625,
"alnum_prop": 0.7662337662337663,
"repo_name": "lowitty/eeep",
"id": "cceb1f396fa34fd7ad9d3d87d73c2fee84a5e2a5",
"size": "385",
"binary": ... |
from datetime import datetime
try:
import simplejson as json
except ImportError:
import json
from libcloud.utils.py3 import httplib
from libcloud.utils.misc import reverse_dict
from libcloud.loadbalancer.base import LoadBalancer, Member, Driver, Algorithm
from libcloud.loadbalancer.base import DEFAULT_ALGORIT... | {
"content_hash": "851a607a6ddc6b85849c464878f17e86",
"timestamp": "",
"source": "github",
"line_count": 1523,
"max_line_length": 79,
"avg_line_length": 36.181221273801704,
"alnum_prop": 0.6027874564459931,
"repo_name": "Jc2k/libcloud",
"id": "1aa7fd51563cb8c3c76d7920c8a59778bd632abd",
"size": "5588... |
"""
Module with NMF algorithm in concentric annuli for ADI/RDI.
"""
__author__ = 'Valentin Christiaens'
__all__ = ['nmf_annular']
import numpy as np
from multiprocessing import cpu_count
from sklearn.decomposition import NMF
from ..preproc import cube_derotate, cube_collapse, check_pa_vector
from ..preproc.derotation... | {
"content_hash": "2f38bae3d675dc113971fa42ca8bc105",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 88,
"avg_line_length": 44.973837209302324,
"alnum_prop": 0.5997026695106974,
"repo_name": "vortex-exoplanet/VIP",
"id": "530f9785fe31fe4de1944251d4dab12458b04453",
"size":... |
from pprint import pprint
from libcloud.autoscale.providers import get_driver as as_get_driver
from libcloud.autoscale.types import Provider as as_provider
ACCESS_ID = 'your access id'
SECRET_KEY = 'your secret key'
# Initialize the drivers
as_driver = as_get_driver(as_provider.AWS_AUTOSCALE)(ACCESS_ID, SECRET_KEY)
... | {
"content_hash": "4e38f03165fadc8fd0cdcf9a6c898ce4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 75,
"avg_line_length": 29.23076923076923,
"alnum_prop": 0.781578947368421,
"repo_name": "Cloud-Elasticity-Services/as-libcloud",
"id": "2135595cf7ed9ed1a6986ab1755cd32edc3cfe... |
"""
Created on Jan 21, 2020
@author: alfoa, wangc
Least Angle Regression model
"""
#Internal Modules (Lazy Importer)--------------------------------------------------------------------
#Internal Modules (Lazy Importer) End----------------------------------------------------------------
#External Modules-------... | {
"content_hash": "80a57af7364e4ad3c41fabc8cd8759f8",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 135,
"avg_line_length": 61.7319587628866,
"alnum_prop": 0.5362391449565799,
"repo_name": "idaholab/raven",
"id": "47e0df48ba702b4a8c8d37c4a553a2549cc2e419",
"size": "6579",... |
from traceback import print_exc
from pprint import pformat
import cStringIO
from flask import request
from werkzeug import Response
def handle_traceback(exc):
out = cStringIO.StringIO()
print_exc(file=out)
formatted_environ = pformat(request.environ)
response = Response(
'%s\n%s\n' % (out.get... | {
"content_hash": "4acff4d111de95d1790bd617595beccd",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 57,
"avg_line_length": 23.176470588235293,
"alnum_prop": 0.700507614213198,
"repo_name": "dreamhost/akanda-appliance",
"id": "cb272b6b4be0d6e96eae9b3d31d705fc8c570e8f",
"si... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '@1-e&noh8w5@=lzhi^9szjd&_a^ai6y@#n)bx-=&($ldg8q7gm'
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessi... | {
"content_hash": "a929d4b2ca505ae240158d543c66ed48",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 65,
"avg_line_length": 22.87272727272727,
"alnum_prop": 0.6868044515103339,
"repo_name": "fluffels/ytlist",
"id": "4f2b18df34f3aea40415e6e2c38ce624c5460f80",
"size": "1258"... |
import pytest
def setup_module(mod):
mod.nose = pytest.importorskip("nose")
def test_nose_setup(testdir):
p = testdir.makepyfile(
"""
values = []
from nose.tools import with_setup
@with_setup(lambda: values.append(1), lambda: values.append(2))
def test_hello():
... | {
"content_hash": "187f526d5a98b972ee1333f582f45e29",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 88,
"avg_line_length": 23.477453580901855,
"alnum_prop": 0.5445712348887132,
"repo_name": "tomviner/pytest",
"id": "16d8d1fc0e088e1131c49c0d31547ef8405abf92",
"size": "885... |
class BeansException(Exception):
code = ''
message = ''
def __init__(self, error):
if 'code' in error:
self.code = error['code']
if 'message' in error:
self.message = error['message']
Exception.__init__(self, self.message) | {
"content_hash": "9e5688afe5963ada4da3329c049aaa3d",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 46,
"avg_line_length": 23.75,
"alnum_prop": 0.5333333333333333,
"repo_name": "trybeans/Beans-API-Python",
"id": "2f0bb9cf083c7bda30415fa85187026a235fe93d",
"size": "285",
... |
import os
import sys
import pandas as pd
from glob import glob
import subprocess
def main():
if len(sys.argv) != 3:
print("Usage: extract_logs_from_nextflow.py <nextflow_trace_file> <task_tag>:<stderr|stdout|both>",file=sys.stderr)
# Load Nextflow trace
nextflow_trace = pd.read_csv(sys.arg... | {
"content_hash": "273c63a1a65db840be72e1fcec01202a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 133,
"avg_line_length": 34.36363636363637,
"alnum_prop": 0.6126984126984127,
"repo_name": "maubarsom/biotico-tools",
"id": "5923ee6d9a18e47688fc8ccfb2e8e576c26d1c03",
"size... |
import Evtx.Evtx as evtx
import Evtx.Views as e_views
def main():
import argparse
parser = argparse.ArgumentParser(
description="Print the structure of an EVTX record's template.")
parser.add_argument("evtx", type=str,
help="Path to the Windows EVTX file")
parser.add_a... | {
"content_hash": "abdded46e06428bf09fe3b48e071df84",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 72,
"avg_line_length": 27.384615384615383,
"alnum_prop": 0.5758426966292135,
"repo_name": "williballenthin/python-evtx",
"id": "29f21678b31441f8ce8d1df6559f0b10927193c3",
"... |
"""
Copyright (C) 2014 Maruf Maniruzzaman
Website: http://cosmosframework.com
Author: Maruf Maniruzzaman
License :: OSI Approved :: MIT License
""" | {
"content_hash": "1f80575cadb3609199e4c5ef4ebc5b64",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 40,
"avg_line_length": 25.5,
"alnum_prop": 0.7254901960784313,
"repo_name": "kuasha/cosmos",
"id": "27874dd85d78bd83881b7941bc6ccea7fe693d60",
"size": "153",
"binary": fal... |
'''
author:Crisschan
time:2016-6-30
'''
from mitmproxy import controller, proxy,flow
from mitmproxy.proxy import ProxyServer,ProxyConfig
import os
import sys
import pdb
import requests
import datetime
from F2requests import F2requests
from Cfg import Cfg
class FriedRing(controller.Master):
#fscript =
def __ini... | {
"content_hash": "e4602b8987d515ddbe362fdba492e5d7",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 109,
"avg_line_length": 30.313432835820894,
"alnum_prop": 0.6193993106843919,
"repo_name": "crisschan/FriedRing",
"id": "6f5a4478c98856b348f9aea130dfff8fd5efe296",
"size": ... |
'''
A SPARQL driver
Copyright 2012-2020 Codinuum Software Lab <https://codinuum.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
U... | {
"content_hash": "c6bfe30239e12f7b3ba264a13f8bd854",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 86,
"avg_line_length": 26.764912280701754,
"alnum_prop": 0.5384111169375984,
"repo_name": "codinuum/cca",
"id": "33ae152bbabe4ed80c590a6167698df987833f0b",
"size": "7653",... |
from ds.vortex.core import baseNode
from ds.vortex.core import plug as plugs
class ScalarNode(baseNode.BaseNode):
def __init__(self, name):
"""
:param name: str, the name of the node
"""
baseNode.BaseNode.__init__(self, name)
def initialize(self):
baseNode.... | {
"content_hash": "80042715010b4c4101a9ceaf5957fa26",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 85,
"avg_line_length": 31.13888888888889,
"alnum_prop": 0.6244424620874219,
"repo_name": "dsparrow27/vortex",
"id": "ad8d1207529a612ca9a6cb05f3f2534eb9db3598",
"size": "112... |
import os
import hashlib
import gzip
import time
from sys import argv
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from config import (AWS_KEY, AWS_SECRET_KEY, AWS_BUCKET, AWS_DIRECTORY,
HTML_EXPIRES, STATIC_EXPIRES, IGNORE_DIRECTORIES, IGNORE_FILES,
IGNORE_FILE_TYPES)
content_types ... | {
"content_hash": "467f4ca03921eccc7936c6aa094c16c6",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 79,
"avg_line_length": 31.596638655462186,
"alnum_prop": 0.5444148936170212,
"repo_name": "vprnet/dorothy-2013",
"id": "3265447e95db06d8738a2cd1d84b38d059110383",
"size": ... |
import sys, os, re
import urllib
import json
import random
def results(parsed, original_query):
number = parsed.get('number', '')
number = re.sub(r'[^0-9]', '', number)
html = open("kuaidi.html").read().replace("<!--NUMBER-->", number)
return {
"title": u'快递 100 搜索 "%s" 结果' % number,
"h... | {
"content_hash": "6a6d7abdfb9bbea63159d9f24c5021e6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 168,
"avg_line_length": 35.75,
"alnum_prop": 0.6125874125874126,
"repo_name": "allenhsu/FlashlightPlugins",
"id": "0da71c2516ca088b3f1fb95e5f3eb6a90a26ae36",
"size": "770",... |
try:
import simplejson as json
except ImportError:
import json
from flask import Flask, Response, render_template, request
from werkzeug.contrib.cache import SimpleCache
import requests
app = Flask('roundup')
app.config.from_object('settings')
# TODO: In a production environment, you would never use an in-me... | {
"content_hash": "71834cdc0df16c9a619783c1f6196df3",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 80,
"avg_line_length": 28.47457627118644,
"alnum_prop": 0.6351190476190476,
"repo_name": "Parsely/api-examples",
"id": "92f9fa618fcd16d593f4d8c9d8b5288df5077672",
"size": "... |
from MorcoWrapper2D.mw2_Application import *
from ProjectExample.ExampleScene import *
from ProjectExample.ExampleManager import *
mw2_Application.Settings.width = 400
mw2_Application.Settings.height = 400
mw2_Application.Settings.icon = "../__Resources/Pong/pong_logo.png"
mw2_Application.Settings.title = "Example Pr... | {
"content_hash": "d8e4dcc11617d99a041bb44e460040ad",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 92,
"avg_line_length": 42,
"alnum_prop": 0.7904761904761904,
"repo_name": "MorcoFreeCode/2014__MorcoWrapper2D",
"id": "1e029acfa86632ae4cc23c3bfd219d4706c09bbd",
"size": "6... |
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.utils.html import format_html, format_html_join
from wagtail.wagtailcore import hooks
from . import urls
@hooks.register('register_admin_urls')
def register_admin_urls():
return [
... | {
"content_hash": "2a38c524c06f15286bec80f73dc4ed2a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 27.51851851851852,
"alnum_prop": 0.676985195154778,
"repo_name": "takeflight/wagtail-readability",
"id": "e2df64be967cb638e0fce3ac08ee3eaa15fc58e8",
... |
import sys
import time
import csv
from itertools import combinations
# Join n-item set itself and generate (n+1)-item set
# Then prune all the set that are not frequent
def join_prune(k):
rt = {}
if not any(k):
return
keys = k.keys()
if len(keys) < 2:
return
leng = len(keys[0])
candidates = []
for i in... | {
"content_hash": "cab9276a7596f84477d11cee01c08835",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 71,
"avg_line_length": 23.86868686868687,
"alnum_prop": 0.6214557765552264,
"repo_name": "HaoLyu/Association-rule-learning",
"id": "c43c3b4b9d90479aa0ac7422e6dd1cce51cd9068"... |
import sys
import argparse
from cyber_py.record import RecordReader
from modules.control.proto import control_cmd_pb2
from modules.planning.proto import planning_pb2
from modules.canbus.proto import chassis_pb2
from modules.drivers.proto import pointcloud_pb2
from modules.perception.proto import perception_obstacle_pb2... | {
"content_hash": "5188166d1368276eee1c7ab90887cff6",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 38.642857142857146,
"alnum_prop": 0.6481823783117683,
"repo_name": "wanglei828/apollo",
"id": "da9525214c62b9e51f26933760fe72253ec73bc3",
"size": "24... |
from __future__ import print_function
from Dbg import Dbg
from Tst import Tst
from Stencil import Stencil
import os, sys, time, json
dbg = Dbg()
def find_py_file(name):
for path in sys.path:
fn = os.path.join(path, name)
if (os.path.isfile(fn)):
return fn
class JobSubmitBase(obje... | {
"content_hash": "469c589ba5d6314e80d897c4ab90dd44",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 77,
"avg_line_length": 28.296703296703296,
"alnum_prop": 0.5753398058252427,
"repo_name": "rtmclay/Themis",
"id": "06db117ba15d8de2392e7382a48ce6414712f921",
"size": "5150... |
import logging
import logging.handlers
import sys
from opennode.cli.config import get_config
_configured = False
def get_logger(level=None):
logger = logging.getLogger('opennode-tui')
if level is not None:
logger.setLevel(level)
return logger
def _configure():
logger = get_logger()
glo... | {
"content_hash": "b6d94de29480016ffd8bedbe5aa864f8",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 101,
"avg_line_length": 30.20408163265306,
"alnum_prop": 0.620945945945946,
"repo_name": "tsudmi/opennode-tui",
"id": "f381eb52dbaf4a8f9609cc4f6d90783ff0770a46",
"size": "1... |
from tempest.api.network import base
from networking_fortinet.tests.tempest_plugin.tests import fwaas_client
class BaseFWaaSTest(fwaas_client.FWaaSClientMixin, base.BaseNetworkTest):
_delete_wrapper = base.BaseNetworkTest._try_delete_resource
| {
"content_hash": "8c09fac0a342d84b5eeb0377ec23f1d6",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 73,
"avg_line_length": 32.375,
"alnum_prop": 0.7953667953667953,
"repo_name": "samsu/networking-fortinet",
"id": "3618b82bb31e0f1e35a739a199822ae5896a0766",
"size": "905",
... |
from grow.common import utils
from grow.pods import storage
import jinja2
import logging
import os
import webapp2
import webob
import werkzeug
_root = os.path.join(utils.get_grow_dir(), 'server', 'templates')
_loader = storage.FileStorage.JinjaLoader(_root)
_env = jinja2.Environment(loader=_loader, autoescape=True, tr... | {
"content_hash": "30ee5cf19692670a69778d5856ebffad",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 76,
"avg_line_length": 30.48936170212766,
"alnum_prop": 0.7083042568039079,
"repo_name": "vitorio/pygrow",
"id": "602e1e03db850faa33300d3230c30e472ed407b2",
"size": "1433",... |
"""
# Meta-info
Author: Nelson Brochado
Created: 10/09/2016
Updated: 07/03/2018
# Description
The forward Euler's method is the easiest method for approximately solving an
initial value ODE problem. In practice, it's used as a vehicle for studying
several important and basic notions on numerical ODE methods.
## E... | {
"content_hash": "7c85bb8f03df01854b5a831c4c09f41e",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 113,
"avg_line_length": 29.26993865030675,
"alnum_prop": 0.6285893942569691,
"repo_name": "nbro/ands",
"id": "8c92084241ad3f00e412ac20da30221f4b620b60",
"size": "5004",
... |
import sys
import textwrap
from math import sqrt, ceil
from itertools import zip_longest
s = input().strip()
s = ''.join(s.split())
w = ceil(sqrt(len(s)))
for word in zip_longest(*textwrap.wrap(s, width=w)):
print(''.join([i for i in word if i]), end=' ')
| {
"content_hash": "4bce8ca6bfb954e7de05ae08b8e786e7",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 52,
"avg_line_length": 21.916666666666668,
"alnum_prop": 0.6577946768060836,
"repo_name": "avtomato/HackerRank",
"id": "6c7f72fffa3daf2725ef08521a4f819f48800db4",
"size": "... |
import string
def prep_string(sentence):
#strip out non white space punctuation and replace with white space
for char in string.punctuation:
sentence = sentence.replace(char, " ")
return sentence.split()
def word_count(sample):
process_sample = prep_string(sample)
# print(process_samp... | {
"content_hash": "0fd7525bbe4c790fc2ba1cd6b1f48e37",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 71,
"avg_line_length": 22.035714285714285,
"alnum_prop": 0.6110210696920584,
"repo_name": "developerQuinnZ/this_will_work",
"id": "115b9b49368d33242510bc70860e43cc176dcd19",
... |
import pkg_resources
__version__ = pkg_resources.get_distribution("kinto_remote_settings").version
def includeme(config):
config.include("kinto_remote_settings.changes")
config.include("kinto_remote_settings.signer")
| {
"content_hash": "131c2e45a44e77c8a8aa8bfde18a14af",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 77,
"avg_line_length": 25.444444444444443,
"alnum_prop": 0.7554585152838428,
"repo_name": "mozilla-services/kinto-dist",
"id": "8c1dda1d66daafb39cbbc4a5847b946c5205f1fe",
"s... |
__author__ = 'thomros'
from ckan.lib.base import (BaseController, render)
class FgpController(BaseController):
def ramp_view(self):
return render('ramp.html') | {
"content_hash": "9c806d8c7768b9a15a719aab4f462f9e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 50,
"avg_line_length": 24.571428571428573,
"alnum_prop": 0.7034883720930233,
"repo_name": "open-data/ckanext-fgp",
"id": "5e8d83339b7fd35c16948d3deb2ca35eb28bad38",
"size": ... |
"""Tests for the multi-processing base process."""
import unittest
from plaso.engine import configurations
from plaso.multi_processing import base_process
from tests import test_lib as shared_test_lib
class TestProcess(base_process.MultiProcessBaseProcess):
"""Implementation of the multi-processing base process ... | {
"content_hash": "ed605d71705f813889d380956937e5a5",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 77,
"avg_line_length": 26.83606557377049,
"alnum_prop": 0.7098350641417227,
"repo_name": "Onager/plaso",
"id": "6b788afa0daa5389ec92b2de876c5abc2a5b95d2",
"size": "1684",
... |
import logging
# RESTServer imports
from MiniREST.RESTServer import RESTServer, responseCodes, responseTypes
class RESTCommunicator(RESTServer):
"""RESTCommunicator - creates a new RESTCommunicator instance.
Extends RESTServer with custom functions.
"""
def __init__(self, rcubic, bind='0.0.0.0', po... | {
"content_hash": "b69ac616449505bf4b0dda988d61929c",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 106,
"avg_line_length": 38.63551401869159,
"alnum_prop": 0.6473149492017417,
"repo_name": "amplify-education/rcubic",
"id": "ead0551e3570b71b1ff7d9789c9b0f6e9dd5dd1e",
"si... |
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
if sys.version_info >= (3, 8):
from typing import ... | {
"content_hash": "60e58d2e9b428ec8738300e5c4b75d91",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 108,
"avg_line_length": 52.261538461538464,
"alnum_prop": 0.7218133647335885,
"repo_name": "Azure/azure-sdk-for-python",
"id": "fb8ddebc34b6cc8286cd49172c7f0f23e5b6f079",
"... |
from .util import readline_google_store
| {
"content_hash": "35d845fdc82b45c97a930629e5c823b2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 39,
"avg_line_length": 40,
"alnum_prop": 0.825,
"repo_name": "xtc283/Ngrams",
"id": "9a48636f17d4808a556abca515d3a1796bc660a6",
"size": "40",
"binary": false,
"copies": ... |
from distutils.core import setup
setup(name='sane3d',
version='0.1',
description='A sane interface to mplot3d',
author='Johannes Kulick',
author_email='[email protected]',
url='http://github.com/hildensia/sane3d',
install_requires=['matplotlib'],
packages=['sane3d']
)
| {
"content_hash": "a79b568d39c8fc0b32782ec6f8a13ecf",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 48,
"avg_line_length": 28.727272727272727,
"alnum_prop": 0.6518987341772152,
"repo_name": "hildensia/sane3d",
"id": "a07cbe137287cb7f718ff8d8d8d775fe04f2441b",
"size": "339... |
import abc
import subprocess
import json
import logging
#
# This is a base command class.
# Subclasses can override the exec_impl method for handling messages.
# Messages responses are automatically sent and the base class can
# do some error handling.
#
class Command(object):
__metaclass__ = abc.ABCMeta
# lo... | {
"content_hash": "534e5595a17476b5cf46f7ef8fdb22ff",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 80,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.5838122605363985,
"repo_name": "manylabs/flow",
"id": "c7059a1b10962967548ffdbc8bacdf039eca9e43",
"size": "2088",
... |
import fnmatch
import os
import jsonpath_rw
from oslo_config import cfg
from oslo_utils import timeutils
import six
import yaml
from ceilometer.event.storage import models
from ceilometer.i18n import _
from ceilometer.openstack.common import log
OPTS = [
cfg.StrOpt('definitions_cfg_file',
default=... | {
"content_hash": "8ca7e4634e608ac4da730ddc28b564be",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 78,
"avg_line_length": 39.29842931937173,
"alnum_prop": 0.5839994670929922,
"repo_name": "Juniper/ceilometer",
"id": "4ba177e3eefc010480bcd8586b26ae4cf5c2c53e",
"size": "1... |
import json
import pyrax
pyrax.set_environment("scale12x")
pyrax.keyring_auth()
cf = pyrax.cloudfiles
try:
cf.delete_container("python-demo", del_objects=True)
print "Container deleted."
except pyrax.exceptions.NoSuchContainer:
print "Container does not exist."
| {
"content_hash": "87288f21f48014853f34056e77528f02",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 23,
"alnum_prop": 0.7536231884057971,
"repo_name": "rackerlabs/sdk_workshops",
"id": "39de3156ee64da8f51e9257546ad7933182ad8e4",
"size": "322",
"bi... |
"""
Module to hold application settings.
"""
import os
from time import strftime
#: Width of cells in pixels
CELL_WIDTH = 32
#: Height of cells in pixels
CELL_HEIGHT = 32
#: Max draw FPS of the simulation
MAX_FPS = 60
#: Time per simulation step in miliseconds (a lower step time results in a faster simulation, 0 = e... | {
"content_hash": "68c19df78c0a90354842355f9e4b8394",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 118,
"avg_line_length": 34.733333333333334,
"alnum_prop": 0.7130518234165067,
"repo_name": "Beskhue/enactive-agents",
"id": "e28a0b336a16a37ff00446108f28774391858d85",
"siz... |
"""
Cuteness Delivery System.
This program requests the top links from various subreddits of cute animals
and email them to participants.
"""
from __future__ import unicode_literals, absolute_import
import re
import sys
import praw
import django
import calendar
import requests
from pytz import timezone
from bs4 impor... | {
"content_hash": "b938ad6dcdf3e8708748db5c07fc01a8",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 79,
"avg_line_length": 30.40776699029126,
"alnum_prop": 0.6256385696040868,
"repo_name": "WillWeatherford/deliver-cute",
"id": "727fb766226b105566d1d1e5469343df80ea35af",
... |
import os
from unittest import mock
import tempfile
from cinderclient import exceptions as cinder_exception
import eventlet
from oslo_concurrency import processutils
from oslo_serialization import jsonutils
from ec2api.api import image as image_api
from ec2api import exception
from ec2api.tests.unit import base
from... | {
"content_hash": "53d801738f609d6dcb99e79af0029750",
"timestamp": "",
"source": "github",
"line_count": 971,
"max_line_length": 79,
"avg_line_length": 43.42739443872296,
"alnum_prop": 0.5139916524378676,
"repo_name": "openstack/ec2-api",
"id": "5885ca45746e9bb0fb12de9fd25a9e6b8faeab8d",
"size": "42... |
import logging
from fabric import api
from oslo_config import cfg
from cloudferrylib.copy_engines import base
from cloudferrylib.utils import cmd_cfg
from cloudferrylib.utils import utils
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class SSHFileToFile(base.BaseCopier):
def transfer(self, data):
i... | {
"content_hash": "4eb46607e00e89e26711510fde10d51e",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 78,
"avg_line_length": 40.673469387755105,
"alnum_prop": 0.49573507275464124,
"repo_name": "mgrygoriev/CloudFerry",
"id": "b4ca598e1b1bc149e2a44a188262acb5229e83f1",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.