text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import unicode_literals
import json
import subprocess
def rf_command_line():
return 'pyfeld --json browse'
class DirLevel:
def __init__(self, path, friendly_name, items):
self.path = path
self.friendly_name = friendly_name
self.items = items
class DirBrowseExtended:
... | {
"content_hash": "62d339faa97c783efa37922e827aab9e",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 109,
"avg_line_length": 31.294642857142858,
"alnum_prop": 0.5728958630527817,
"repo_name": "scjurgen/pyfeld",
"id": "8917cf5c01fae801a91c561f8daf14e16a7d1b0c",
"size": "35... |
"""
https://en.wikipedia.org/wiki/Infix_notation
https://en.wikipedia.org/wiki/Reverse_Polish_notation
https://en.wikipedia.org/wiki/Shunting-yard_algorithm
"""
from .balanced_parentheses import balanced_parentheses
from .stack import Stack
def precedence(char: str) -> int:
"""
Return integer value represent... | {
"content_hash": "32cdc126bb036a0ebb2fd66f14cf838d",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 88,
"avg_line_length": 30.014492753623188,
"alnum_prop": 0.5615644616127474,
"repo_name": "TheAlgorithms/Python",
"id": "9017443091cf95f6525bf599c79e07781cc515b4",
"size": ... |
import clientPackets
import glob
def handle(userToken, packetData):
# Read token and packet data
userID = userToken.userID
packetData = clientPackets.matchInvite(packetData)
# Get match ID and match object
matchID = userToken.matchID
# Make sure we are in a match
if matchID == -1:
return
# Make sure the m... | {
"content_hash": "db248d30dec59b8c763d9cd61eb1ad6b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 51,
"avg_line_length": 20.916666666666668,
"alnum_prop": 0.7470119521912351,
"repo_name": "osuripple/ripple",
"id": "f27ccaa3eef3a9bc5273422bc6c0768008de436d",
"size": "502... |
import json
import logging
import os
from kombu import BrokerConnection
from kombu.mixins import ConsumerMixin
from entropy.queues import pass_events
LOG = logging.getLogger(__name__)
LOG_REPO = os.path.join(os.getcwd(), 'entropy', 'logs')
def get_vm_count(body, **kwargs):
LOG.warning("Received message: %r" %... | {
"content_hash": "efc4c3085b042f8de78858a20d621c0d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 76,
"avg_line_length": 28.558441558441558,
"alnum_prop": 0.561618917689859,
"repo_name": "ddutta/entropy",
"id": "6b9dec0a92aaf5e55a82ff0b99584ea93955a726",
"size": "2795",... |
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSlot as Slot
from .newconnectiondialog_ui import Ui_Dialog
from ....core2.devices.device.frontend import DeviceFrontend
class NewConnectionDialog(QtWidgets.QDialog, Ui_Dialog):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.se... | {
"content_hash": "78ae16a8827f63f6708bc85be7b78953",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 121,
"avg_line_length": 36.170731707317074,
"alnum_prop": 0.6877950101146325,
"repo_name": "awacha/cct",
"id": "4681ff918af2162501ef83dde0593aa8fdfcbc57",
"size": "1483",
... |
import os
import os.path
from django.conf import settings
from downloads.models import TEMP_UPLOAD_FOLDER
# create temporary downloads folder if it does not exist
tmp_abs_path = os.path.join(settings.MEDIA_ROOT, TEMP_UPLOAD_FOLDER)
if not os.path.exists(tmp_abs_path):
try:
os.mkdir(tmp_abs_path, 644)
... | {
"content_hash": "1083c2c5b19a13c71feebab2b5a14ff0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 68,
"avg_line_length": 23.4,
"alnum_prop": 0.7264957264957265,
"repo_name": "praekelt/jmbo-downloads",
"id": "69fdacd465ebdb50419d3d5cf2c64c689fa94aae",
"size": "351",
"b... |
"""
adjusts module path to account for virtual namespace
This is required primarily for testing.
"""
import sys
import os
import pkg_resources
VIRTUAL_NAMESPACE = 'tiddlywebplugins'
local_package = os.path.abspath(VIRTUAL_NAMESPACE)
sys.modules[VIRTUAL_NAMESPACE].__dict__['__path__'].insert(0, local_package)
| {
"content_hash": "7407f437d248db2b264e37ece8fc5c1d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 76,
"avg_line_length": 21,
"alnum_prop": 0.7587301587301587,
"repo_name": "TiddlySpace/tiddlyspace",
"id": "dbefd558ca4650208d44923636a65f9b821b5a26",
"size": "315",
"bin... |
"""
@brief test log(time=7s)
"""
import unittest
from pyquickhelper.loghelper import fLOG
from ensae_teaching_cs.faq.faq_python import get_month_name, get_day_name
class TestFaqPython(unittest.TestCase):
def test_month_name(self):
fLOG(
__file__,
self._testMethodName,
... | {
"content_hash": "22c4f9463d8fff5dbd66d4440df1162a",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 73,
"avg_line_length": 24.142857142857142,
"alnum_prop": 0.5609467455621302,
"repo_name": "sdpython/ensae_teaching_cs",
"id": "67e592e6383870f63ce68376a8e1a2950c5abcc0",
"s... |
"""
Combinatory Categorial Grammar.
For more information see nltk/doc/contrib/ccg/ccg.pdf
"""
from nltk.ccg.combinator import (UndirectedBinaryCombinator, DirectedBinaryCombinator,
ForwardCombinator, BackwardCombinator,
UndirectedFunctionApplication, F... | {
"content_hash": "c570f63dc0bab264f00d763cc9faf5a2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 89,
"avg_line_length": 52.06666666666667,
"alnum_prop": 0.6414852752880922,
"repo_name": "sivu22/nltk-on-gae",
"id": "5b66af7226ab6bb6cd0f263e3e6d80b68b6ba172",
"size": "10... |
'''
Created on Apr 16, 2013
@author: davey
'''
"""Implements the model for project management."""
from django.db import models
from apps.managers.player_mgr import player_mgr
from apps.managers.resource_mgr import resource_mgr
from apps.managers.team_mgr import team_mgr
from apps.managers.team_mgr.models import Grou... | {
"content_hash": "b98c7132fd6dfe270c14b28ac8fc02f6",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 99,
"avg_line_length": 31.759036144578314,
"alnum_prop": 0.6555386949924128,
"repo_name": "MakahikiKTUH/makahiki-ktuh",
"id": "825d36ecb7c3b832b29212d19bb6e0e6f788a4de",
"s... |
from pkg_resources import get_distribution
__import__('pkg_resources').declare_namespace(__name__)
__version__ = get_distribution("qamplus").version
__author__ = "QAMplus"
__copyright__ = "Copyright 2017, QAMplus Corp."
__credits__ = ["QAMplus"]
__license__ = "MIT"
__maintainer__ = "QAMplus Corp."
__email__ = "contac... | {
"content_hash": "219589e0259aa9e8ae37e314127e4d52",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 55,
"avg_line_length": 30,
"alnum_prop": 0.6666666666666666,
"repo_name": "jeniaoo/qamplus-python",
"id": "f6984f9fd10491f483005597b19445cf63bdf591",
"size": "360",
"bina... |
"""
wagtailsystemtext
----------
Simplified Wagtail system text management
"""
__title__ = 'wagtailsystemtext'
__version__ = '1.2.2'
__build__ = 122
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Copyright 2016-2018 Martin Sandström"
default_app_config = 'wagtailsystemtext.apps.WagtailSystemText... | {
"content_hash": "682c38b7cffc666d6cce9dad1cdaea51",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 69,
"avg_line_length": 23.428571428571427,
"alnum_prop": 0.6890243902439024,
"repo_name": "Frojd/wagtail-systemtext",
"id": "de04958327b767b5a2e2b375b771ed1d95942ed2",
"siz... |
'''
Widget class
============
The :class:`Widget` class is the base class required for creating Widgets.
This widget class was designed with a couple of principles in mind:
* *Event Driven*
Widget interaction is built on top of events that occur. If a property
changes, the widget can respond to the change in the... | {
"content_hash": "59957e67eafdc01d92016d37c48c5fba",
"timestamp": "",
"source": "github",
"line_count": 1629,
"max_line_length": 80,
"avg_line_length": 35.29711479435236,
"alnum_prop": 0.6023756934903216,
"repo_name": "akshayaurora/kivy",
"id": "e00b39e1b0d147a909f3f69516ad83b53f9aca91",
"size": "5... |
from setuptools import setup
setup(
name="pylint-guidelines-checker",
version="0.0.1",
url='http://github.com/Azure/azure-sdk-for-python',
license='MIT License',
description="A pylint plugin which enforces azure sdk guidelines.",
author='Microsoft Corporation',
author_email='azpysdkhelp@mic... | {
"content_hash": "0b48a4cd091d2a834deffaf8b5258be4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 71,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.7078947368421052,
"repo_name": "Azure/azure-sdk-for-python",
"id": "b4b89126e95a06b04230e410300c05600a3359b4",
"s... |
from .sports import * # noqa
from .picks import * # noqa
from .manage import * # noqa
| {
"content_hash": "601a09c923fd942c38e80146c5d7f2f5",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 29,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.6629213483146067,
"repo_name": "dakrauth/picker",
"id": "14c14bb026ee837b227f5b6a9a2344799d14fbd9",
"size": "89",
... |
from UtilityLayer import *
from Webserver import Webserver
import DatabaseLayer
import sys, argparse
import logging
import json
import os
class Butterfly():
'''
Butterfly 2.0
EM Data server
2017 VCG + Lichtman Lab
'''
log_info = {
'filename': 'bfly.log',
'level': logging.INFO
... | {
"content_hash": "249f8f37fc5819b8e457678ba9944d9b",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 89,
"avg_line_length": 36.54761904761905,
"alnum_prop": 0.594299674267101,
"repo_name": "Rhoana/butterfly2",
"id": "9cd70de4fc8f573c22c5e3319016678c96cc533a",
"size": "614... |
"""
``account_quotas`` is a middleware which blocks write requests (PUT, POST) if a
given account quota (in bytes) is exceeded while DELETE requests are still
allowed.
``account_quotas`` uses the ``x-account-meta-quota-bytes`` metadata entry to
store the quota. Write requests to this metadata entry are only permitted ... | {
"content_hash": "d78710ab15e1e796ebcc563b601913e1",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 79,
"avg_line_length": 30.57777777777778,
"alnum_prop": 0.659156976744186,
"repo_name": "ctbrizhp/swift1.9.2",
"id": "06b0d9aa6fd06ad63e7e1ab7ee9dda5fc517751d",
"size": "33... |
from oslo.config import cfg
from openstack.common.fixture import config
from tests.utils import BaseTestCase
conf = cfg.CONF
class ConfigTestCase(BaseTestCase):
def setUp(self):
super(ConfigTestCase, self).setUp()
self.config = self.useFixture(config.Config(conf)).config
self.config_fixt... | {
"content_hash": "494157f1d3db16ca48a7bf76a786d6dc",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 72,
"avg_line_length": 36.857142857142854,
"alnum_prop": 0.6579457364341085,
"repo_name": "JioCloud/oslo-incubator",
"id": "3368272d32ef949ff85cf25efa0fe03c38a4c5b5",
"size... |
from __future__ import absolute_import
from itertools import count
import numpy as np
from toolz import curry
from .core import Array, normalize_chunks
linspace_names = ('linspace-%d' % i for i in count(1))
arange_names = ('arange-%d' % i for i in count(1))
def _get_blocksizes(num, blocksize):
# compute blockd... | {
"content_hash": "b34ced6fe20422ec47af8128df28aa87",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 79,
"avg_line_length": 27.517482517482517,
"alnum_prop": 0.6035578144853876,
"repo_name": "esc/dask",
"id": "82820dfc17e81eba3c996bee56d36dd67fd70cac",
"size": "3935",
"... |
from django import forms
from .models import User
class UserForm(forms.ModelForm):
class Meta:
model = User
# Constrain the UserForm to just these fields.
fields = ("first_name", "last_name") | {
"content_hash": "e839a2b90673966f87656fcf91828183",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 54,
"avg_line_length": 18.666666666666668,
"alnum_prop": 0.6517857142857143,
"repo_name": "chhantyal/referly",
"id": "83e561a731ae8a227e957d139fb6f34c5319b3bf",
"size": "24... |
"""
Grader file for Columbus problem
"""
def grade(autogen, key):
if '1492' in key:
return (True, 'Good work!')
else:
return (False, 'Nope')
| {
"content_hash": "aeb487dc68a38c3f2078851661a2aa17",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 32,
"avg_line_length": 17.11111111111111,
"alnum_prop": 0.6103896103896104,
"repo_name": "stuyCTF/stuyCTF-Platform",
"id": "e35b02150e384d9135d8503e7e0aa788a075df56",
"size"... |
from AppKit import *
from PyObjCTools.TestSupport import *
class TestNSNibLoading (TestCase):
def testMethods(self):
self.assertResultIsBOOL(NSBundle.loadNibFile_externalNameTable_withZone_)
self.assertResultIsBOOL(NSBundle.loadNibNamed_owner_)
self.assertResultIsBOOL(NSBundle.loadNibFile_... | {
"content_hash": "79591ec7311cdac44561b6ba8e30a946",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 81,
"avg_line_length": 33.44444444444444,
"alnum_prop": 0.7358803986710963,
"repo_name": "ariabuckles/pyobjc-framework-Cocoa",
"id": "abbae38fd528e8e3b7d6157c4bab4dfdbdd77b68... |
default_app_config = __name__ + '.apps.CollGateMessengerTCPServer'
| {
"content_hash": "dbe45ceb1f7a242df3c61c28f46ad7e9",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 66,
"avg_line_length": 67,
"alnum_prop": 0.746268656716418,
"repo_name": "coll-gate/collgate",
"id": "c8f6648f9efe6370b6621a9858a869a3adeaf03e",
"size": "369",
"binary": f... |
from pystache import Template
import os.path
import re
from types import *
def get_or_attr(context_list, name, default=None):
if not context_list:
return default
for obj in context_list:
try:
return obj[name]
except KeyError:
pass
except:
try... | {
"content_hash": "411be14eab6b1e5bf5b144c49d239aef",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 153,
"avg_line_length": 29.69148936170213,
"alnum_prop": 0.5854532425653888,
"repo_name": "alex/pystache",
"id": "a4e73b29a121949b49183782e1e3e9c9a3e1f5d4",
"size": "2791",... |
import math
def isPrime(num):
for i in range(2, int(math.sqrt(num)) + 1):
if num % i == 0:
return False
return True
num = 0
numberOfPrimes = 0
while numberOfPrimes <= 10001:
num += 1
if isPrime(num):
numberOfPrimes += 1
print(num) | {
"content_hash": "6c579e5f79ea295411dc6ba95a815aca",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 47,
"avg_line_length": 17.3125,
"alnum_prop": 0.5776173285198556,
"repo_name": "asweigart/AlDoesProjectEuler",
"id": "3eca08f0bcd3d6ce13dab0e2a30f765c3e57cbe1",
"size": "27... |
import pygame, sys
from pygame.locals import *
FPS = 30
WINDOWWIDTH = 640
WINDOWHEIGHT = 480
REVEALSPEED = 8
BOXSIZE = 40
GAPSIZE = 10
BOARDWIDTH = 10
BORADHEIGHT = 7
assert (BOARDWIDTH * BOARDHEIGHT) % 2 == 0
XMARGIN = int((WINDOWWIDTH - (BOARDWIDTH *(BOXSIZE + GAPSIZE))) /2)
YMARGIN = int((WINDOWHEIGHT - (BORADHEIGH... | {
"content_hash": "8419765a82971cb5e2a6328e7ed355c2",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 81,
"avg_line_length": 29.328859060402685,
"alnum_prop": 0.5897025171624714,
"repo_name": "rve/invent-with-python",
"id": "02547248a352155b46557a267ad8d3a90852c8d5",
"size... |
from __future__ import division, print_function
import logging
from smac.facade.func_facade import fmin_smac
def rosenbrock_2d(x):
""" The 2 dimensional Rosenbrock function as a toy model
The Rosenbrock function is well know in the optimization community and
often serves as a toy problem. It can be defi... | {
"content_hash": "ad00e8d100f12a684dd64454f618cdb6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 74,
"avg_line_length": 29.84375,
"alnum_prop": 0.6020942408376964,
"repo_name": "SgnJp/SMAC3",
"id": "11a2aa95d577dafb380262bc64325cfa8ff3b792",
"size": "955",
"binary": ... |
import argparse
import unittest
from util import *
class TestMover(unittest.TestCase):
# test single move
def test_single_move(self):
for action in MOVE_TYPES:
cmd_create, cmd_move = move_random_file(action, FILE_SIZE)
self.assertTrue(cmd_create['state'] == "DONE")
... | {
"content_hash": "f47861525402c7aba2ec49235b624f71",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 108,
"avg_line_length": 37.83673469387755,
"alnum_prop": 0.6202804746494067,
"repo_name": "Intel-bigdata/SSM",
"id": "ab0dbab6f82566a791b7a8ce1d81320e00e397e6",
"size": "18... |
"""Support for Blinkt! lights on Raspberry Pi."""
import importlib
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
LightEntity,
)
from homeassistant.const import CONF_NAME
import homeassis... | {
"content_hash": "45eab656e3917569efa6b193028d1976",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 81,
"avg_line_length": 28.72289156626506,
"alnum_prop": 0.6396812080536913,
"repo_name": "jawilson/home-assistant",
"id": "e6a3ecd362dcd99c401b0a8289d519feb248a3b3",
"size"... |
import logging
import time
import re
from . import common
from ...systems import path
class ParsedFileException(Exception):
pass
class ParsedFileLine(object):
'''Lines returned by `find . -ls` have an inconsistent format. We
therefore have to do a bit of computation on the results to
correlate values... | {
"content_hash": "304f69264bb8b6088edf6a413adda260",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 110,
"avg_line_length": 31.288235294117648,
"alnum_prop": 0.5217146080090242,
"repo_name": "Doveps/mono",
"id": "635a64d3094d911797ab32233c65c041c990c220",
"size": "5398",... |
from enable.api import Container, TextField, Window
from enable.example_support import DemoFrame, demo_main
size = (500, 400)
class MyFrame(DemoFrame):
def _create_window(self):
text_field = TextField(position=[25,100], width=200)
text = "This a test with a text field\nthat has more text than\n... | {
"content_hash": "a0980ac37c3c1bb8974e2291966992f2",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 73,
"avg_line_length": 36.1,
"alnum_prop": 0.5909510618651893,
"repo_name": "tommy-u/enable",
"id": "1078decb4ce7c0fbfca3d6bc86571278ff8f268f",
"size": "1083",
"binary": ... |
import gc
import sys
from time import sleep
from threading import Event
import pytest
from gpiozero import *
def test_source_delay(mock_factory):
with OutputDevice(2) as device:
device.source_delay = 1
assert device.source_delay == 1
device.source_delay = 0.1
assert device.source... | {
"content_hash": "b539746be7b4df8ac718aaffc5809057",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 73,
"avg_line_length": 28.112068965517242,
"alnum_prop": 0.6074823673719718,
"repo_name": "waveform80/gpio-zero",
"id": "736e29e4b67ad06cda6db805269e9d90d10a1e57",
"size":... |
"""
Client side of the heat worker RPC API.
"""
from heat.common import messaging
from heat.rpc import worker_api
class WorkerClient(object):
'''Client side of the heat worker RPC API.
API version history::
1.0 - Initial version.
1.1 - Added check_resource.
'''
BASE_RPC_API_VERSION... | {
"content_hash": "e176c0aca3acaff61ff1d2db2c5ea9d1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 59,
"avg_line_length": 26.80952380952381,
"alnum_prop": 0.5968028419182948,
"repo_name": "rh-s/heat",
"id": "b8fa5f7ea8d0cbd6d6fd81b8a4bd9ace0d4b3697",
"size": "1737",
"b... |
"""
Commands work with servers. (Hiss, boo.)
"""
import copy
from fabric.api import local, put, settings, require, run, sudo, task
from fabric.state import env
from jinja2 import Template
import app_config
"""
Setup
"""
@task
def setup():
"""
Setup servers for deployment.
This does not setup services ... | {
"content_hash": "999bd8108f0790876bd4037721b1b4c5",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 129,
"avg_line_length": 31.50597609561753,
"alnum_prop": 0.6230399595346484,
"repo_name": "wbez/budget-tracker",
"id": "03bbbc3731916eef4b30370f0e03b9d230e395a6",
"size": ... |
import time
import re
from os.path import exists, getmtime
from twisted.internet.task import LoopingCall
from carbon import log
from carbon.aggregator.buffers import BufferManager
class RuleManager:
def __init__(self):
self.rules = []
self.rules_file = None
self.read_task = LoopingCall(self.read_rules)
... | {
"content_hash": "a18a06812644b8c6c32b037bdbf0d82f",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 110,
"avg_line_length": 27.223684210526315,
"alnum_prop": 0.6162397293378443,
"repo_name": "kharandziuk/carbon",
"id": "d0a589699132448e63e3d701345d5a293abd2f0c",
"size": ... |
import argparse
import json
import logging
import multiprocessing as mp
import os
import sys
import time
# Local modules
import result_writer
import snmp_query
# Settings
# Where to expect the config file,
# if it's not specified via --config
DEFAULT_CONFIGPATH='config.json'
# How many seconds to pause between run... | {
"content_hash": "ea0640db823c178576303326112f71a5",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 146,
"avg_line_length": 39.005917159763314,
"alnum_prop": 0.6236347087378641,
"repo_name": "equill/datadog-snmp",
"id": "f3f7e48038ea6c595208a10b5fa9ce249df92aec",
"size":... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tournament', '0167_auto_20171025_2304'),
]
operations = [
migrations.AddField(
model_name='section',
name='order',
field... | {
"content_hash": "333700d439a9bffe25cc15b8c8b76182",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 122,
"avg_line_length": 29.433333333333334,
"alnum_prop": 0.5832389580973952,
"repo_name": "cyanfish/heltour",
"id": "4558c6f95a46703508bdbb566a4237984824dfd3",
"size": "95... |
"""
FILE: sample_dynamic_classification.py
DESCRIPTION:
This sample demonstrates how to dynamically classify documents into one or multiple categories.
No model training is required to use dynamic classification.
The dynamic classification feature is part of a gated preview. Request access here:
https... | {
"content_hash": "9d670e29a513def6e593625f9bb4b2ba",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 99,
"avg_line_length": 35.83606557377049,
"alnum_prop": 0.6806953339432754,
"repo_name": "Azure/azure-sdk-for-python",
"id": "8b65bc3c7ef6cdf13e76e7b3937956982e78fd96",
"si... |
"""LVNFP Protocol Server."""
import uuid
import tornado.web
import tornado.httpserver
from empower.datatypes.etheraddress import EtherAddress
from empower.restserver.apihandlers import EmpowerAPIHandlerAdminUsers
from empower.core.image import Image
from empower.core.lvnf import LVNF
from empower.main import RUNTIME... | {
"content_hash": "244caa1585d549e92986662583841754",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 75,
"avg_line_length": 28.239819004524886,
"alnum_prop": 0.5345297228008332,
"repo_name": "Panagiotis-Kon/empower-runtime",
"id": "7f4e60e01d34ef36db93b0f0e6211db0b6c6ed4b",... |
import sys
import collections
import random
import csv
import numpy as np
from sklearn.utils import shuffle
config_keys = ["DIMS", "NCLASS", "TRAIN_SIZE", "NOT_VAL_SIZE", "TEST_SIZE", "SEED", "DEBUG"]
def dist(x, y):
return np.linalg.norm(y-x)
def nearest_neighbors(d, sample, in_dataset, class_dataset):
dist... | {
"content_hash": "6e55bfa5e15e846cbefcddd97fd83342",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 128,
"avg_line_length": 37.256,
"alnum_prop": 0.6274425595877174,
"repo_name": "mvpossum/machine-learning",
"id": "9291243cb31a10166a55ec06d6df3f9831d258d7",
"size": "4681... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "a91e8a26bd0d503d0e63dd2df2f0a89f",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 160,
"avg_line_length": 38.30769230769231,
"alnum_prop": 0.6773246833487797,
"repo_name": "zouzhberk/ambaridemo",
"id": "d3b14481fbbd0556c24f32ec14523b6a1a1d057a",
"size":... |
"""
This module contains the high-level functions to access the library. Care is
taken to make this as pythonic as possible and hide as many of the gory
implementations as possible.
"""
from x690.types import ObjectIdentifier
# !!! DO NOT REMOVE !!! The following import triggers the processing of SNMP
# Types and th... | {
"content_hash": "f7b05d2bc8cc2f818ce4d8736c155387",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 76,
"avg_line_length": 26.548387096774192,
"alnum_prop": 0.715674362089915,
"repo_name": "exhuma/puresnmp",
"id": "fd7f00d8d3fb7791dff064db616cd116431e3ad3",
"size": "823",... |
"""TF metrics for Bandits algorithms."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from typing import Callable, Optional, Text
import gin
import tensorflow as tf # pylint: disable=g-explicit-tensorflow-version-import
from tf_agents.bandits.policies... | {
"content_hash": "419162a44bfe067e91e59751ef5aa4b3",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 80,
"avg_line_length": 35.189320388349515,
"alnum_prop": 0.6956821630569734,
"repo_name": "tensorflow/agents",
"id": "7561dee8084c8b6d2e35573680df698ba08398cb",
"size": "7... |
"""====================
RNA-Seq pipeline
====================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
The RNA-Seq pipeline imports unmapped reads from one or more
RNA-Seq experiments and performs the basic RNA-Seq analysis steps:
1. Map reads to genome
2. Build transcript models
3... | {
"content_hash": "0542dfc569255a1f42b879a871d18f8f",
"timestamp": "",
"source": "github",
"line_count": 4586,
"max_line_length": 210,
"avg_line_length": 34.52006105538596,
"alnum_prop": 0.5051134174304682,
"repo_name": "CGATOxford/CGATPipelines",
"id": "9d16f8cf0fc5d217705a27b66331c6aa0504d70d",
"s... |
"""System tests for Google BigQuery hooks"""
import unittest
from unittest import mock
from airflow.gcp.hooks import bigquery as hook
from tests.gcp.utils.gcp_authenticator import GCP_BIGQUERY_KEY
from tests.test_utils.gcp_system_helpers import skip_gcp_system
@skip_gcp_system(GCP_BIGQUERY_KEY)
class BigQueryDatafr... | {
"content_hash": "5e9a57f3d452ec1b8ba43a1d1de810b4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 78,
"avg_line_length": 37.265625,
"alnum_prop": 0.6658280922431866,
"repo_name": "Fokko/incubator-airflow",
"id": "4bd854804054cb448b6cc2fe99b52d734a9cf4ca",
"size": "3196"... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.contrib.taggit
import modelcluster.fields
import taggit.managers
import wagtail.wagtailadmin.taggable
import wagtail.wagtailcore.blocks
import wagtail.w... | {
"content_hash": "8a61039a613572ffb305049eb7af1e18",
"timestamp": "",
"source": "github",
"line_count": 585,
"max_line_length": 385,
"avg_line_length": 52.07863247863248,
"alnum_prop": 0.5752314055012144,
"repo_name": "gogobook/wagtail",
"id": "2cab4e7acebb748b481f2d66334147d63b82f44f",
"size": "30... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('feedjack', '0007_auto_20150207_2007'),
]
operations = [
migrations.AlterField(
model_name='postprocessor',
name='base',
... | {
"content_hash": "b10cea5d30c8e304a2d7adcf571bdb0a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 440,
"avg_line_length": 41.86206896551724,
"alnum_prop": 0.6499176276771005,
"repo_name": "allo-/feedjack",
"id": "1cbd9159c3c5f4c4b59ec0b45660de6c32f8a0af",
"size": "1238"... |
from collections import OrderedDict
import os
import sys
def help(rc: int=0):
print("The pedtodot.py script transforms a pedigree file into a dot file that Graphiz can use to create a graph.")
print("")
print("\t-h: This help message.")
print("\t-f --file: The p... | {
"content_hash": "2ff18b9e9aab3fd3dca9db8520146e09",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 147,
"avg_line_length": 40.70860927152318,
"alnum_prop": 0.5566943224337075,
"repo_name": "BertRaeymaekers/scrapbook",
"id": "7c58f017b38d927bdd78a58360e4dbad523e77f6",
"s... |
class Solution:
# @param {integer[]} nums
# @return {integer[]}
def productExceptSelf(self, nums):
if not nums:
return []
left_product = [1 for _ in xrange(len(nums))]
for i in xrange(1, len(nums)):
left_product[i] = left_product[i - 1] * nums[i - 1]
... | {
"content_hash": "7acef9858c76bde037e7cfdd0f1dae60",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 63,
"avg_line_length": 30.529411764705884,
"alnum_prop": 0.5240847784200385,
"repo_name": "kamyu104/LeetCode",
"id": "02b3e1a83b09950d201763c9d4f6b64db64a8166",
"size": "98... |
import smtplib
from email.mime.text import MIMEText
class Notifier:
def __init__(self, mail_server, username, password):
self.mail_server = mail_server
self.username = username
self.password = password
def notify(self, from_addr, to_addrs, subject, body):
server = smtplib.SMTP(s... | {
"content_hash": "2be4cd5376277e7f83d9e23ced8cedbd",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 61,
"avg_line_length": 34.421052631578945,
"alnum_prop": 0.6116207951070336,
"repo_name": "jrlusby/asai-monitor-notifications",
"id": "d0785de63022bc5df535282737ba0cc4a88838a... |
"""Functionality for working with probability spaces and random variables.
Basic recap of probability theory, and thus of classes in this file:
* A probability space is a (finite or infinite) set Omega with a probability
measure defined on this.
* A random variable is a mapping from a probability space to ano... | {
"content_hash": "4fa13e7695f3023140908dd124a46741",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 80,
"avg_line_length": 30.43222506393862,
"alnum_prop": 0.6638372972518699,
"repo_name": "deepmind/mathematics_dataset",
"id": "3016d0523306bebdd9671a104be8c6da51a61170",
... |
"""
WSGI config for unesco project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "unesco.settings")
from django.core.wsg... | {
"content_hash": "ac65ee3d77ae7aeb4325d81b172f1799",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 27.642857142857142,
"alnum_prop": 0.772609819121447,
"repo_name": "robjordan/unesco_project",
"id": "9f8cc419a03add3f99dd5163c0bf81aa7d143d24",
"size... |
"""Implements the wiki WSGI application which dispatches requests to
specific wiki pages and actions.
"""
from os import path
from sqlalchemy import create_engine
from werkzeug.middleware.shared_data import SharedDataMiddleware
from werkzeug.utils import redirect
from werkzeug.wsgi import ClosingIterator
from . impor... | {
"content_hash": "df4a15b781f047bacc8c780c49611de5",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 81,
"avg_line_length": 37.223404255319146,
"alnum_prop": 0.6561874821377537,
"repo_name": "fkazimierczak/werkzeug",
"id": "e6efb4a5596a9b6a480ee69214caeac1f2a26890",
"size"... |
import numpy as np
from scipy import sparse
def build_projection_operator(l_x, n_dir, mask=None, exclude_diags=False):
X, Y = _generate_center_coordinates(l_x)
orig = X.min()
if mask is not None:
X = X[mask]
Y = Y[mask]
angles = np.linspace(0, np.pi, n_dir, endpoint=False)
# Remove ... | {
"content_hash": "ecb981981628fd9f8a2faa35aa3c83e8",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 76,
"avg_line_length": 36.84126984126984,
"alnum_prop": 0.6105127100387764,
"repo_name": "eddam/bp-for-tomo",
"id": "52059a75d7ffa26d7cd546249ad9f123ed26c485",
"size": "232... |
'''
Created on Mar 29, 2017
a one-off script to update the CCLE GCS paths in the production database
Copyright 2017, Institute for Systems Biology.
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 Lice... | {
"content_hash": "c41398975530754bab1ec27cb8ab4a70",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 160,
"avg_line_length": 38.95402298850575,
"alnum_prop": 0.6096193567424019,
"repo_name": "isb-cgc/ISB-CGC-data-proc",
"id": "77e1fbe9dd88f1698e481754ff44d07adf97f571",
"si... |
"""Contains an abstract base class for protocol messages."""
__author__ = 'robinson@googlepb.com (Will Robinson)'
class Error(Exception): pass
class DecodeError(Error): pass
class EncodeError(Error): pass
class Message(object):
"""Abstract base class for protocol messages.
Protocol message classes are almost... | {
"content_hash": "6d6cf6a60661b1d8e8a107c5ee37c07b",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 79,
"avg_line_length": 34.073170731707314,
"alnum_prop": 0.7140300644237653,
"repo_name": "beschulz/ved-decoder",
"id": "0911a7af11341741c8d2eb30ec798e1a68d72e51",
"size":... |
import zmarkdown
from zmarkdown import inlinepatterns, util, Extension
from zmarkdown.blockprocessors import BlockProcessor
import re
class MathJaxPattern(inlinepatterns.Pattern):
def __init__(self):
inlinepatterns.Pattern.__init__(self, r'(?<!\\)\$([^\n]+?)(?<!\\)\$')
def handleMatch(self, m):
... | {
"content_hash": "265c8a20140413275ddb4f53d601aee3",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 96,
"avg_line_length": 32.71153846153846,
"alnum_prop": 0.6231628453850676,
"repo_name": "zestedesavoir/Python-ZMarkdown",
"id": "7f57129c78a5bc46818c72edee151c035db3e3d6",
... |
from utils import CSVScraper
class KitchenerPersonScraper(CSVScraper):
# http://open-kitchenergis.opendata.arcgis.com/datasets/aa7c40a2bb5c4c95b3a373ff23844aab
csv_url = 'https://app2.kitchener.ca/appdocs/opendata/staticdatasets/Elected_Officials.csv'
| {
"content_hash": "2648b1b5772f7744b7dd24e0b8b79afd",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 95,
"avg_line_length": 43.666666666666664,
"alnum_prop": 0.8129770992366412,
"repo_name": "opencivicdata/scrapers-ca",
"id": "83ac43c81c335f6b2bd44f1dafbceacf2c55e8a9",
"siz... |
"""Utility functions, node construction macros, etc."""
# Author: Collin Winter
# Local imports
from .pgen2 import token
from .pytree import Leaf, Node
from .pygram import python_symbols as syms
from . import patcomp
###########################################################
### Common node-construction "macros"
##... | {
"content_hash": "4926d41fe81414a7b365a4aa4a03cda9",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 88,
"avg_line_length": 33.86904761904762,
"alnum_prop": 0.5575395430579965,
"repo_name": "DecipherOne/Troglodyte",
"id": "3b136694a663c2e5566118e907dd25230d8e02d2",
"size"... |
import argparse
import os
import update_tools
def main():
parser = argparse.ArgumentParser()
parser.add_argument("mar", metavar="MAR", help="MAR archive to (un)wrap")
parser.add_argument("dir", metavar="DIR", help="Source or destination " +
"directory for (un)wrapping MAR.")
parser.add_argument... | {
"content_hash": "18807ff1e200eca418deaffa941ce2ee",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 32.57575757575758,
"alnum_prop": 0.6130232558139534,
"repo_name": "wilebeast/FireFox-OS",
"id": "4c61a921d5e0064aa213a6d0816485649ae46405",
"size": "... |
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
import usuarios
import asignaturas
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('usuarios.urls', namespace='usuarios')),
ur... | {
"content_hash": "b8068fd4b2e6719028798623c6c89389",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 68,
"avg_line_length": 27.571428571428573,
"alnum_prop": 0.7331606217616581,
"repo_name": "Hikasgai/HikasgaiApp",
"id": "bf05d75f995fd1a1779423bc45f6186dba8e083d",
"size": ... |
"""
SSL Middleware
Stephen Zabel
This middleware answers the problem of redirecting to (and from) a SSL secured path
by stating what paths should be secured in urls.py file. To secure a path, add the
additional view_kwarg 'SSL':True to the view_kwargs.
For example
urlpatterns = patterns('some_site.some_app.views',
... | {
"content_hash": "c2f2957c3593b29e5107fc0a704b6b40",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 85,
"avg_line_length": 37.04807692307692,
"alnum_prop": 0.697119127952245,
"repo_name": "DrOctogon/Satchmo",
"id": "162ef6c6075c26c6eca567d74de7fd3173ebb627",
"size": "385... |
"""
@package ion.services.mi.test.test_zmq_driver_process
@file ion/services/mi/test_zmq_driver_process.py
@author Edward Hunter
@brief Test cases for ZmqDriverProcess processes.
"""
__author__ = 'Edward Hunter'
__license__ = 'Apache 2.0'
from gevent import monkey; monkey.patch_all()
import time
import unittest
impo... | {
"content_hash": "13410046183fc5c5df3984c17cac7229",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 84,
"avg_line_length": 30.634615384615383,
"alnum_prop": 0.6111111111111112,
"repo_name": "ronkyo/mi-instrument",
"id": "e805c2f6c7cdd917cbf73d2283f53533183aac33",
"size":... |
import sys
import os
from optparse import OptionParser
from dcs import base
def main():
usage = 'usage: %prog [--validate] --source=<path to the directory ' + \
'with attributes files> --output=<output directory>'
parser = OptionParser(usage=usage)
parser.add_option('--source', dest='source',
... | {
"content_hash": "7fa828b29b124bbab31fedebb77fef68",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 76,
"avg_line_length": 32.22222222222222,
"alnum_prop": 0.625,
"repo_name": "racker/python-dcs",
"id": "2321d744d580dc0da09695658e04f6a2499a8942",
"size": "1183",
"binary... |
from django import forms
from django.contrib.auth.models import User
from emailconfirmation.models import EmailAddress
from friends.models import *
try:
from notification import models as notification
except ImportError:
notification = None
class UserForm(forms.Form):
def __init__(self, user=None, ... | {
"content_hash": "0637b751a32bc1ff1ce1c3bcf3504355",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 129,
"avg_line_length": 44.09722222222222,
"alnum_prop": 0.6686614173228347,
"repo_name": "indro/t2c",
"id": "7bc7369b92ef09b600fe6ca27ae47086201a71b3",
"size": "3175",
"... |
import traceback
from django.http import HttpResponseServerError
from django.template import loader
def server_error(request, template_name='500.html'):
template = loader.get_template(template_name)
context = {'stacktrace' : traceback.format_exc()}
return HttpResponseServerError(template.render(context))
| {
"content_hash": "2462de921f2471d463c8f93b14474984",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 58,
"avg_line_length": 34.888888888888886,
"alnum_prop": 0.7961783439490446,
"repo_name": "mcoolive/graphite-web",
"id": "e4db58af893e818e3400022cfbfb6e449a75aeb4",
"size": ... |
from setuptools import setup
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
import simples3
intro = open("README", "U").read()
usage = "\nUsage\n-----\n\n" + simples3.__doc__
changes = open("changes.rst", "U").read()
long_description = intro + usage + "\n" + changes
setup(name="simples3", version=... | {
"content_hash": "d05adb9b0d9585ac79f27e9b7e781443",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 65,
"avg_line_length": 34.705882352941174,
"alnum_prop": 0.676271186440678,
"repo_name": "sirkamran32/simples3",
"id": "d5786b520db29f4e4d1bbf51ece760ff5ca43987",
"size": "... |
import numpy as np
import tensorflow as tf
from elbow import Model
from elbow.elementary import Gaussian
from elbow.joint_model import BatchGenerator
from elbow.models.neural import neural_bernoulli, neural_gaussian
from util import mnist_training_data
import time
def build_vae(d_z=2, d_hidden=256, d_x=784, N=100, ... | {
"content_hash": "77a4df6465bf6627860e524a5ba08142",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 84,
"avg_line_length": 26.976190476190474,
"alnum_prop": 0.6690203000882613,
"repo_name": "davmre/elbow",
"id": "6b892cf3bee07ff77af1a5079cb92ad8d0213bbe",
"size": "1133",
... |
"""Site services for use with a Web Site Process Bus."""
import os
import re
import signal as _signal
import sys
import time
import threading
from cherrypy._cpcompat import basestring, get_daemon, get_thread_ident, ntob, set, Timer, SetDaemonProperty
# _module__file__base is used by Autoreload to make
# absolute any... | {
"content_hash": "e47813d056b1579002ed154f3afe1f55",
"timestamp": "",
"source": "github",
"line_count": 690,
"max_line_length": 108,
"avg_line_length": 36.91014492753623,
"alnum_prop": 0.5741715093450604,
"repo_name": "hellsgate1001/bookit",
"id": "cfad3700723dae0165fe6b5dade0b1e052a43cec",
"size":... |
def quote(str):
''' encode spaces and comma '''
return None if not str else str.replace('\\', '\\\\').replace(' ','\\s').replace('|','\\v').replace(',','\\c').replace('\n','\\n')
def dequote(str):
''' decode spaces and comma '''
return None if not str else str.replace('\\n','\n').replace('\\c', ',').re... | {
"content_hash": "f7670f30fb548f281c6bcc3302268bdb",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 137,
"avg_line_length": 46.8,
"alnum_prop": 0.5192307692307693,
"repo_name": "voc/voctomix",
"id": "639ba462b6380b4e4348666b457893a58629b676",
"size": "468",
"binary": fa... |
from schematics.models import Model
from schematics.types import IntType, ListType, ModelType, StringType
class User(Model):
userid = IntType(required=True)
class Style(Model):
width = IntType(required=True)
height = IntType(required=True)
border_width = IntType(required=True)
border_style = Str... | {
"content_hash": "52a37f8a4c393dce710dbd80bb6d88e3",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 69,
"avg_line_length": 22.060606060606062,
"alnum_prop": 0.7019230769230769,
"repo_name": "guyskk/validater",
"id": "cde7b5fd74c40a6d523762d85a1d8dcfe3038a66",
"size": "728... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('digikey', '0009_auto_20151123_1442'),
]
operations = [
migrations.RenameField(
model_name='orders',
old_name='paied',
... | {
"content_hash": "4a10cc40d73f2697d38d804310972eb2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 47,
"avg_line_length": 20,
"alnum_prop": 0.5722222222222222,
"repo_name": "sonicyang/chiphub",
"id": "973e852abd05084a606273e01335b296ded99da8",
"size": "384",
"binary": ... |
from django import forms
from models import ShortURL, key_to_id, id_to_key
class ShortURLForm(forms.ModelForm):
key = forms.CharField(required=False)
class Meta:
model = ShortURL
fields = ('url', 'key')
def __init__(self, *args, **kwargs):
super(ShortURLForm, self).__init__(*arg... | {
"content_hash": "6631c590b4cd9711753c90eeda6301c2",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 66,
"avg_line_length": 28.4,
"alnum_prop": 0.596579476861167,
"repo_name": "butfriendly/friendly-django-urlshortener",
"id": "f699b0d4c22987f9b39879401523e4002a99e7c3",
"si... |
import base64
import mox
import webob
from nova.api.openstack.compute import servers
from nova.compute import vm_states
import nova.db
from nova import exception
from nova import flags
from nova.openstack.common import importutils
from nova import test
from nova.tests.api.openstack import fakes
from nova import utils... | {
"content_hash": "ff509eefd07c65afe2a2000fd8b9816b",
"timestamp": "",
"source": "github",
"line_count": 892,
"max_line_length": 79,
"avg_line_length": 36.20291479820628,
"alnum_prop": 0.5529371690459233,
"repo_name": "psiwczak/openstack",
"id": "77470036102159e00f7acb3c73a924e639be6506",
"size": "3... |
""" This file describe the module configuration box that is displayed when
the user selects a module's "Edit Configuration"
"""
from PyQt4 import QtCore, QtGui
from vistrails.core.modules.module_registry import get_module_registry, \
ModuleRegistryException
from vistrails.gui.modules.module_configure import Defaul... | {
"content_hash": "fa6a18472768d62c85d562a774237d95",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 83,
"avg_line_length": 35.416666666666664,
"alnum_prop": 0.582262443438914,
"repo_name": "celiafish/VisTrails",
"id": "e412129673f49d99e00b3eb756fa34cecceac408",
"size": "... |
import logging # noqa
import mock
import os
from oslo_config import cfg
from oslo_log import log as o_log
from oslo_utils import uuidutils
from oslotest import base
from sqlalchemy.orm import sessionmaker as sa_sessionmaker
from aim.agent.aid.universes.aci import aci_universe
from aim.agent.aid.universes.k8s import ... | {
"content_hash": "2bc29b45fc094ae8db3c48d19f68f3a3",
"timestamp": "",
"source": "github",
"line_count": 775,
"max_line_length": 79,
"avg_line_length": 37.43096774193548,
"alnum_prop": 0.5182529559791789,
"repo_name": "noironetworks/aci-integration-module",
"id": "effa17b4aa13ecddcf0ff9cdda369aa8ce13e... |
from django.http import HttpResponseRedirect
def username(request, *args, **kwargs):
if kwargs.get('user'):
username = kwargs['user'].username
else:
username = request.session.get('saved_username')
return {'username': username}
def redirect_to_form(*args, **kwargs):
if not kwargs['re... | {
"content_hash": "230cf15d664fd1813e58e49d686f8fa3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 64,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.6584269662921348,
"repo_name": "eduherraiz/foowill",
"id": "b10a6659f85d87c87b522f8d4c586799b2a601e3",
"size": "4... |
from __future__ import absolute_import
class FantasySport(object):
"""FantasySport Class
"""
url = 'http://fantasysports.yahooapis.com/fantasy/v2/'
def __init__(self, oauth, fmt=None, use_login=False):
"""Initialize a FantasySport object
"""
self.oauth = oauth
self.fm... | {
"content_hash": "3415e9dbb6dc4309432f53a8811b0b04",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 125,
"avg_line_length": 32.80361757105943,
"alnum_prop": 0.5174478141000394,
"repo_name": "josuebrunel/yahoo-fantasy-sport",
"id": "60a49ff7e1ada74b2bb26ccc8aa3f4cf044f6d73"... |
import os
from f1.a.user.session import Session
# start session
Session.start()
| {
"content_hash": "af4366865c045f4a1df0990cef30dfb6",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 37,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.7682926829268293,
"repo_name": "filemakergarage/zeroclient",
"id": "7fcbf6717b11e2fd425e2099e8d2d8505dab15ff",
"si... |
"""
korean.ext.jinja2
~~~~~~~~~~~~~~~~~
Jinja2_ is one of the most used template engines for Python. This module
contains Jinja2 template engine extensions to make :mod:`korean` easy to
use.
.. versionadded:: 0.1.5
.. versionchanged:: 0.1.6
Moved from :mod:`korean.l10n.jinja2ext` t... | {
"content_hash": "1934970801269d13da552d51a858e53f",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 78,
"avg_line_length": 29.58823529411765,
"alnum_prop": 0.6163021868787276,
"repo_name": "lqez/korean",
"id": "ca41066f080ea817416ce78179f087333ac2ad22",
"size": "2603",
... |
"""
Copyright 2012 GroupDocs.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | {
"content_hash": "24a8dbe2e06da25c82c1cad0e61c39d1",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 30.945945945945947,
"alnum_prop": 0.6497816593886463,
"repo_name": "liosha2007/temporary-groupdocs-python3-sdk",
"id": "5fd3e8a89a53f88707780f9fdc211f5... |
from unittest.mock import patch
import pytest
from faker import Faker, Generator
class BarProvider:
def foo_formatter(self):
return "barfoo"
class FooProvider:
def foo_formatter(self):
return "foobar"
def foo_formatter_with_arguments(self, param="", append=""):
return "baz" + ... | {
"content_hash": "75f1c59c4d2e246e28c9f693cc7f5a85",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 95,
"avg_line_length": 41.792,
"alnum_prop": 0.6763016845329249,
"repo_name": "joke2k/faker",
"id": "39aed2ac1ecd54311a66838fce2bf6ebfd13c79c",
"size": "5224",
"binary":... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("LGBMClassifier" , "BinaryClass_100" , "mysql")
| {
"content_hash": "f531473ae289dccbd5d726a7b8c03de2",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 36,
"alnum_prop": 0.7847222222222222,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "796c9eea967f78dae5f6db7cebe6c310d84ad4b5",
"size": "144",... |
class GiraffeError(Exception):
"""
Baseclass for all giraffez errors.
"""
class GiraffeTypeError(GiraffeError):
"""
Baseclass for all giraffez type errors.
"""
class GiraffeEncodeError(GiraffeError):
"""
Raised when unable to encode the provided object.
"""
class ConfigurationErro... | {
"content_hash": "9f1f2eb280163be11310eeafc014b2bd",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 98,
"avg_line_length": 26,
"alnum_prop": 0.6794871794871795,
"repo_name": "capitalone/giraffez",
"id": "e24e8c04022b8a4a39931d79d768cd0505a310a7",
"size": "2020",
"binary... |
import numpy as np
# physical/external base state of all entites
class EntityState(object):
def __init__(self):
# physical position
self.p_pos = None
# physical velocity
self.p_vel = None
# state of agents (including communication and internal/mental state)
class AgentState(EntityS... | {
"content_hash": "246a9d8de6cff3ecdc6456e6dbb821bf",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 118,
"avg_line_length": 35.66326530612245,
"alnum_prop": 0.5809728183118741,
"repo_name": "openai/multiagent-particle-envs",
"id": "c0662ca0c4e0751dee136aa14f6585c40095756d"... |
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Wc++98-comp... | {
"content_hash": "2533befa91d4e0db018d9f5299ac88c3",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 81,
"avg_line_length": 32.256,
"alnum_prop": 0.6574900793650794,
"repo_name": "pajamapants3000/vimfiles",
"id": "6daed438ff58a988ed4434d41a1a2a56a8212baf",
"size": "5432",... |
import sys
import web
import GlobalVars
try:
import json
except ImportError:
import simplejson as json
import os
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
from IRCResponse import IRCResponse, ResponseType
from IRCMessage import IRCMessage
from FunctionHandler impor... | {
"content_hash": "5aa1615174d3412912fdbe115dd3d8b4",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 94,
"avg_line_length": 28.972972972972972,
"alnum_prop": 0.5345149253731343,
"repo_name": "MatthewCox/MoronBot",
"id": "90506833cf9671735cdb90ce31f5120952ca57b1",
"size": "... |
"""TensorFlow collective Ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import device
from tensorflow.python.ops import gen_collective_ops
def all_reduce(t, group_size, group_key, instance_key, merge_op, final_op,
... | {
"content_hash": "b4bb0f4d46ec6af6c7d7382a84ddd59c",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 79,
"avg_line_length": 39.55621301775148,
"alnum_prop": 0.712789827973074,
"repo_name": "chemelnucfin/tensorflow",
"id": "e4f8dd8c2eaac4640dde84d1db24994def56bac3",
"size"... |
import config
import sys
#def listingUser(**k):
#return config.DB.select('users', **k)
#print **k
#return config.DB.select('usuarios', **k)
def listingUser(**k):
"""
Determina si el usuario y contraseña coinciden.
"""
#return config.DB.query("SELECT cliente_id AS clienteId, privilege_... | {
"content_hash": "b012c51924ff54e96a5dd4536bd58961",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 166,
"avg_line_length": 40.97096774193548,
"alnum_prop": 0.569955121643965,
"repo_name": "jolth/CowFleet-1.0.0",
"id": "17d6e04ea93f0efb1b528e5d07dd67ca75f7bb4d",
"size": ... |
from rpi_greenhouse import GreenhouseIndicator
from time import sleep
indicator = GreenhouseIndicator()
while True:
for index in range(3):
indicator.turn_leds_on(index=index)
print("#%i on" % index)
sleep(0.5)
indicator.turn_leds_off(index=index)
| {
"content_hash": "17c98be952fc47decbc17769ea37abaa",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 46,
"avg_line_length": 25.90909090909091,
"alnum_prop": 0.6771929824561403,
"repo_name": "bennuttall/rpi-greenhouse",
"id": "6f11b85d4bc2a699ac5108392f56be1038f320af",
"siz... |
from __future__ import absolute_import
import flask
import auth
import config
import model
import util
from main import app
twitter_config = dict(
access_token_url='https://api.twitter.com/oauth/access_token',
authorize_url='https://api.twitter.com/oauth/authorize',
base_url='https://api.twitter.com/1.1/',
... | {
"content_hash": "bf0093f931569ab9d879eba9dd3e4631",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 66,
"avg_line_length": 25.910714285714285,
"alnum_prop": 0.7160578911095796,
"repo_name": "topless/gae-init",
"id": "26b5c78ee91ad8aca029b76777a523a0cbcf30c9",
"size": "146... |
"""AtomService provides CRUD ops. in line with the Atom Publishing Protocol.
AtomService: Encapsulates the ability to perform insert, update and delete
operations with the Atom Publishing Protocol on which GData is
based. An instance can perform query, insertion, deletion, and
... | {
"content_hash": "022f8f99cdc11a227303d71f60e6c492",
"timestamp": "",
"source": "github",
"line_count": 699,
"max_line_length": 83,
"avg_line_length": 39.38340486409156,
"alnum_prop": 0.6566893094554833,
"repo_name": "csytan/pycmds",
"id": "73f0f27280b64b919b37d55a0d66ae654480b527",
"size": "28143"... |
from collections import namedtuple
ValidationRule = namedtuple('ValidationRule', 'vfunc errfunc getter')
def Rule(vfunc, on_error, getter=None):
"""Constructs a single validation rule. A rule effectively
is saying "I want to validation this input using
this function and if validation fails I want this (o... | {
"content_hash": "d8e9f74962a4c8e00caf3378854d0340",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 38.77777777777778,
"alnum_prop": 0.7249283667621776,
"repo_name": "amitgandhinz/cdn",
"id": "15214ad0af9c93409fdf8e08f04d0c0b8c37079b",
"size": "1283... |
import random
import os
# wasd movement
# change player to a dictionary with a key that hold onto where the player has been. Then when drawing map show every cell they've been in.
ROOMS = [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0),
(0, 1), (1, 1), (2, 1), (3, 1), (4, 1),
(0, 2), (1, 2), (2... | {
"content_hash": "154fcb0e919a2775ee9f42fc183afb87",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 203,
"avg_line_length": 40.92070484581498,
"alnum_prop": 0.5019916029712563,
"repo_name": "CaseyNord/Treehouse",
"id": "982b078c76e54e5c91108cacef2429c27d5bd3c7",
"size": ... |
import time
from cherrypy import log
from braubuddy.output import IOutput
class ListMemoryOutput(IOutput):
"""
Output to a list in memory.
This is a special output used internally by the Braubuddy engine to store
metrics for the dashboard and api. It could also be used by a thermostat
if it requi... | {
"content_hash": "cf950ed906ab9fab7dbbf15fab5199f6",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 35.490196078431374,
"alnum_prop": 0.6248618784530386,
"repo_name": "amorphic/braubuddy",
"id": "7ff5dcd4a6369d09fff6a9b2d387d913e585b285",
"size": "1... |
import logging
from collections import namedtuple
from .exceptions import ScreenError
from .version import __title__
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
logger = logging.getLogger(__title__)
Coords = namedtuple('Coords', ('top', 'left', 'right', 'bottom'))
class Grabber(tk.T... | {
"content_hash": "033f41bc0de387d388dd533f92e18db2",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 95,
"avg_line_length": 27.52252252252252,
"alnum_prop": 0.5950900163666121,
"repo_name": "andrei-shabanski/grab-screen",
"id": "0f45ab9813d8d97e7e3741def9654e13e19d4d32",
... |
from typing import Callable, cast
import numpy
from .backends import Ops
from .config import registry
from .types import FloatsXd, Shape
from .util import partial
# TODO: Harmonize naming with Keras, and fill in missing entries
# https://keras.io/initializers/ We should also have He normal/uniform
# and probably lecu... | {
"content_hash": "cc02123dacc23531856f6b9c47e6081c",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 88,
"avg_line_length": 31.401639344262296,
"alnum_prop": 0.6966849386583137,
"repo_name": "spacy-io/thinc",
"id": "4842f4f08019c334b30be1edec6218b37b4a4bd7",
"size": "3831... |
class Secret:
"""Defines Kubernetes Secret Volume"""
def __init__(self, deploy_type, deploy_target, secret, key):
"""Initialize a Kubernetes Secret Object. Used to track requested secrets from
the user.
:param deploy_type: The type of secret deploy in Kubernetes, either `env` or
... | {
"content_hash": "28492e50e70c7ab9a70202ada8503251",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 86,
"avg_line_length": 42.08695652173913,
"alnum_prop": 0.6208677685950413,
"repo_name": "artwr/airflow",
"id": "bf1526b1a393b173cc85b7abc3986fd154f99025",
"size": "1755",
... |
from mozfile import *
| {
"content_hash": "cbfb7b6591999fae4778a994a83f566c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.7727272727272727,
"repo_name": "sergecodd/FireFox-OS",
"id": "37b8babb80b2633e451d8ceb32ef982d70cf3997",
"size": "222",
"binary"... |
'''OpenGL extension EXT.blend_minmax
This module customises the behaviour of the
OpenGL.raw.GLES1.EXT.blend_minmax to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/EXT/blend_minmax.txt
'''
from OpenGL import platform, constant, a... | {
"content_hash": "db434cd53e24294299d0e1b8675f767d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 32.869565217391305,
"alnum_prop": 0.791005291005291,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "9e0f1b0b150d50fbe66a56e35d6d8f4d14789d95",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.