text stringlengths 4 1.02M | meta dict |
|---|---|
import logging
import textwrap
import time
from datetime import date, datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import Group
from django.core.mail import send_mail
from django.db import connection, transaction
import cronjobs
from kitsune.questions import config
from kitsun... | {
"content_hash": "819bfad1a05daf54b0f1595c57387647",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 96,
"avg_line_length": 35.183098591549296,
"alnum_prop": 0.6451828129170003,
"repo_name": "feer56/Kitsune2",
"id": "bceb1c70b480f19913ebe7706e46913915074d3e",
"size": "749... |
import mock
from webob import exc
from heat.api.openstack.v1 import util
from heat.common import context
from heat.common import policy
from heat.common.wsgi import Request
from heat.tests.common import HeatTestCase
class TestGetAllowedParams(HeatTestCase):
def setUp(self):
super(TestGetAllowedParams, s... | {
"content_hash": "5fb524afffdf4d5682965035eb1ede96",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 69,
"avg_line_length": 34.700934579439256,
"alnum_prop": 0.6186372205763534,
"repo_name": "NeCTAR-RC/heat",
"id": "8208b512cdbbfe27cd88dfb313fd9b6111e80069",
"size": "4287... |
total = 0
totalRibbon = 0
f = open("input.txt")
for line in f:
temp = ""
length = 0
width = 0
height = 0
for c in line:
if c.isdigit():
temp += c
else:
if length == 0:
length = int(temp)
elif width == 0:
width = int(temp)
elif height == 0:
height = int(temp)
temp = ""
area = ... | {
"content_hash": "0806170af33ed8ede5177be6d43b5c74",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 91,
"avg_line_length": 20.74418604651163,
"alnum_prop": 0.6087443946188341,
"repo_name": "protocol114/AdventOfCode",
"id": "8bf1b74476cacc0642d9c3c4f4f66389037bc14a",
"size... |
from __future__ import absolute_import
try:
import cPickle as pickle
except ImportError:
import pickle
import zlib
from django.utils.encoding import smart_str
def loads(value, compress=False):
# Integers are not pickled when storing in the cache because we allow
# methods like incr/decr which would fail on ... | {
"content_hash": "531436324f409a19e2a826225677ff65",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 77,
"avg_line_length": 26.86842105263158,
"alnum_prop": 0.7247796278158668,
"repo_name": "Locu/djredis",
"id": "0614bc6ff89330b93e954e4cb623812c720ff12d",
"size": "1038",
... |
"""gRPC's Python API."""
import abc
import enum
import sys
import six
from grpc._cython import cygrpc as _cygrpc
############################## Future Interface ###############################
class FutureTimeoutError(Exception):
"""Indicates that a method call on a Future timed out."""
class FutureCancell... | {
"content_hash": "8467449b6a93d0de4e22e97223e81e5d",
"timestamp": "",
"source": "github",
"line_count": 1331,
"max_line_length": 84,
"avg_line_length": 35.61081893313298,
"alnum_prop": 0.6769061985737795,
"repo_name": "ininex/geofire-python",
"id": "fe2997179921870d02aa9197c1d06b33f3becb30",
"size"... |
from Acquisition import aq_inner
from Acquisition import aq_parent
from bika.lims.permissions import *
def upgrade(tool):
"""AJS changes
"""
# Hack prevent out-of-date upgrading
# Related: PR #1484
# https://github.com/bikalabs/Bika-LIMS/pull/1484
from bika.lims.upgrade import skip_pre315
... | {
"content_hash": "9bad2721fcb501c6508c30f948c3216c",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 26.954545454545453,
"alnum_prop": 0.6981450252951096,
"repo_name": "hocinebendou/bika.gsoc",
"id": "3f38fa632358506381aba084f436a3807f7d8cae",
"size"... |
"""
Django settings for _2michaeltaylor project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Bu... | {
"content_hash": "80c602fcf4e8676e0b74ae4311101350",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 71,
"avg_line_length": 26.327731092436974,
"alnum_prop": 0.6974146185764443,
"repo_name": "mjt145/2michaeltaylor",
"id": "4a078699f572a5189ecac85685b523705cccf793",
"size"... |
"""
Volume driver common utilities for HPE 3PAR Storage array
The 3PAR drivers requires 3.1.3 firmware on the 3PAR array.
You will need to install the python hpe3parclient module.
sudo pip install python-3parclient
The drivers uses both the REST service and the SSH
command line to correctly operate. Since the
ssh c... | {
"content_hash": "c0291cde19981823772666dbdbc33d99",
"timestamp": "",
"source": "github",
"line_count": 3696,
"max_line_length": 79,
"avg_line_length": 43.85768398268398,
"alnum_prop": 0.535052869251934,
"repo_name": "cloudbase/cinder",
"id": "eafbb90da1f05d684d529478155e94a867924eee",
"size": "162... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from pex.interpreter import PythonInterpreter
from pants.backend.python.binary_builder import PythonBinaryBuilder
from pants.backend.python.test_builder import Python... | {
"content_hash": "d4b407a0cb05961631289fac91764b0f",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 99,
"avg_line_length": 31.48076923076923,
"alnum_prop": 0.681734880879658,
"repo_name": "square/pants",
"id": "aeee0ec902c36ad3e0ab47288804c73a327d3602",
"size": "1784",
... |
import hashlib
import sys
def solve(secret_key, starts_with):
result = 1
while True:
hash_input = "%s%s" % (secret_key, result)
hash_result = hashlib.md5(hash_input).hexdigest()
if hash_result.startswith(starts_with):
return result
result += 1
if __name__ == '__ma... | {
"content_hash": "a71a882dc78791f0bfb43f5d71a18436",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 103,
"avg_line_length": 30.896551724137932,
"alnum_prop": 0.6261160714285714,
"repo_name": "loisaidasam/adventofcode",
"id": "389ad066f4c179f629af7f2ace67fc034241d8bb",
"si... |
'''
Exercise 7 - Class 8 - Thread connection to each device and run the command
Gleydson Mazioli <gleydsonmazioli@gmail.com>
'''
from net_system.models import NetworkDevice
import netmiko
import django
import time
from multiprocessing import Process
def get_cred_type(l_credentials, l_type):
'''
Get the associ... | {
"content_hash": "3d56c746898060b662579e32fb716265",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 79,
"avg_line_length": 28.013157894736842,
"alnum_prop": 0.611085016439643,
"repo_name": "gleydsonm/pynet_ex",
"id": "b1c60db95108ab5d60edb3a16157872e1985f2a1",
"size": "21... |
import unittest
from unittest.mock import patch
from flask import json
from pipeline_notifier_test.test_utils import *
from pipeline_notifier.main import build_app
class IntegrationTests(unittest.TestCase):
def test_status_page_returns_ok(self):
client = self.buildClient()
result = client.get('/s... | {
"content_hash": "d2879a1d55ab357da9127fac4628328f",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 96,
"avg_line_length": 37.671875,
"alnum_prop": 0.5407161620351169,
"repo_name": "pimterry/pipeline-notifier",
"id": "2ec442bf5e1c83dedd6eba2bcf57c48e2a005733",
"size": "7... |
"""
Zappa CLI
Deploy arbitrary Python programs as serverless Zappa applications.
"""
from __future__ import unicode_literals
from __future__ import division
import argcomplete
import argparse
import base64
import pkgutil
import botocore
import click
import collections
import hjson as json
import inspect
import imp... | {
"content_hash": "e4eb5618c03ef048b79fe4b84a04689f",
"timestamp": "",
"source": "github",
"line_count": 2087,
"max_line_length": 177,
"avg_line_length": 41.94489698131289,
"alnum_prop": 0.5502004820708484,
"repo_name": "parroyo/Zappa",
"id": "a8123298ec1e8275dec0b400d8a64437a8928d52",
"size": "8798... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('organization', '0011_auto_20160619_2345'),
('organization', '0015_auto_20160619_1852'),
]
operations = [
]
| {
"content_hash": "20217bd3128b22d24a4ae0db88861049",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 52,
"avg_line_length": 19.642857142857142,
"alnum_prop": 0.6472727272727272,
"repo_name": "sakset/getyourdata",
"id": "4478bfea2d880bc234fd025f9732eec27ddf2927",
"size": "3... |
import json
import os
from unittest.mock import patch
from importlib import reload
from django.apps import apps
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.db import models
from django.test import Client, TestCase, override_settings
from django.urls import r... | {
"content_hash": "94d333a9251b25cf87e47e7cdd5e77a8",
"timestamp": "",
"source": "github",
"line_count": 564,
"max_line_length": 126,
"avg_line_length": 35.81382978723404,
"alnum_prop": 0.618545472548146,
"repo_name": "summernote/django-summernote",
"id": "c7677f5986dbaed8cba0446795c317fbb04b8b17",
... |
import time
from uuid import getnode as get_mac
import agentRcvModule
import agentManager
import agentFreLib as freLib
from agentUtil import *
from agentSndModule import *
from hone_message import *
HostId = str(get_mac())
ControllerPort = 8866
HostRelayPort = 8877
def ToUpperLevel(jobId, flowId, level):
def pu... | {
"content_hash": "f1196a4a6dfd42e6e7a4367e447a1c02",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 183,
"avg_line_length": 43.27906976744186,
"alnum_prop": 0.6217087587318646,
"repo_name": "pupeng/hone",
"id": "ffc1a91014ecdc8d31885a518d110ae3d7d50771",
"size": "2067",
... |
"""
GoGrid driver
"""
import time
import hashlib
import copy
from libcloud.utils.py3 import b
from libcloud.common.types import InvalidCredsError, LibcloudError
from libcloud.common.gogrid import GoGridConnection, BaseGoGridDriver
from libcloud.compute.providers import Provider
from libcloud.compute.types import Node... | {
"content_hash": "6164572525e22ffc26364c61cebdda47",
"timestamp": "",
"source": "github",
"line_count": 449,
"max_line_length": 79,
"avg_line_length": 32.224944320712694,
"alnum_prop": 0.5226345981062962,
"repo_name": "Kami/libcloud",
"id": "0226f7bb6350b89e3b0a0504b8cdedbbf0e260e9",
"size": "15250... |
"""Gradients for operators defined in array_ops.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from math import ceil
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.eager import context
from tensorflow.python.framework import... | {
"content_hash": "e066c22fd432b1e4a9b3ebfa6f9e362f",
"timestamp": "",
"source": "github",
"line_count": 800,
"max_line_length": 100,
"avg_line_length": 35.54875,
"alnum_prop": 0.6709096663033158,
"repo_name": "lukeiwanski/tensorflow",
"id": "fe459a96b98733f8a706b0c3b84000c5a74894ad",
"size": "29128... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', '')
requirements = [
# TODO: put package re... | {
"content_hash": "bed690af12de9efedee050bcb0212877",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 93,
"avg_line_length": 28.471698113207548,
"alnum_prop": 0.6209410205434063,
"repo_name": "gautsi/test_package",
"id": "e88bdf58245f4b4f54a7ce44fc1de39b424911df",
"size": "... |
import json
import yaml
import sys
import re
import traceback
from os.path import expanduser
import os
import urllib
import pyxb
from uforge.objects.uforge import *
import ussclicore.utils.download_utils
from ussclicore.utils import printer
from ussclicore.utils import generics_utils
from hammr.utils.bundle_utils impo... | {
"content_hash": "3668c745badec674e51f444e9e2586c1",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 180,
"avg_line_length": 32.65758754863813,
"alnum_prop": 0.6107470511140236,
"repo_name": "MaxTakahashi/hammr",
"id": "8eb49991604d23325e798968bc0f5027c84b930d",
"size": "... |
import unittest
from app.launch_scrubber import Scrubber
class LaunchScrubberTests(unittest.TestCase):
def setUp(self):
self.scrubber = Scrubber()
def test_launch_is_scrubbed_when_its_too_cold(self):
# ...
self.assertFalse(self.scrubber.go_for_launch())
def test_launch_is_go_whe... | {
"content_hash": "c2594b612fbef7f7fd85a0bd7996eb1c",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 66,
"avg_line_length": 26.071428571428573,
"alnum_prop": 0.6315068493150685,
"repo_name": "greghaskins/launch-scrubber-kata",
"id": "1cebceeeb1e630ade343ca565e26f147c01d0dd3"... |
import skimage.morphology
import skimage.filter
import skimage.feature
import numpy as np
import timeit
import mahotas
from os import path
luispedro_image = path.join(
path.dirname(mahotas.__file__),
'demos',
'data',
'luispedro.jpg')
f = mahotas.imread(luispedro_image, a... | {
"content_hash": "ac024d11e8c6b7270d768c35c622302d",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 81,
"avg_line_length": 27.62,
"alnum_prop": 0.6217716630461019,
"repo_name": "Chaparqanatoos/kaggle-knowledge",
"id": "d3c859f5ea74a23fa4e2e504740a9ad309e1af4b",
"size": "... |
import numpy
import theano
import theano.tensor as T
from seq_to_seq.layers_core import Layer
class Embedding(Layer):
"""
Embedding class.
:param size: int
The size of the layer (i.e., the number of rows, the size of the input vocabulary).
:param dim_proj: int
The size of the projec... | {
"content_hash": "91598c703fd17e4b36d93f7e3864a4d8",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 97,
"avg_line_length": 30.228395061728396,
"alnum_prop": 0.5721870532979375,
"repo_name": "giancds/seq_to_seq",
"id": "358b4bcaf3f24b667bf5fd4ff8543caeb4c6de78",
"size": "... |
"""
This Module contains classes for decoding and encoding of datatypes
Available datatypes:
- Boolean TODO
- Byte TODO
- Unsigned Byte TODO
- Short TODO
- Unsigned Short DONE!
- Int TODO
- Long TODO
- Float TODO
- Double TODO
... | {
"content_hash": "3caeed43b7deba28cf25f42dd9154fec",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 124,
"avg_line_length": 20.57312252964427,
"alnum_prop": 0.6217098943323727,
"repo_name": "fabian0010/Blaze",
"id": "4db0a3642fb3f8a80ff7b40de3949bd6d797795f",
"size": "52... |
def decode_line(encoded):
"""Decodes a polyline that was encoded using the Google Maps method.
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
This is a straightforward Python port of Mark McClure's JavaScript polyline decoder
(http://facstaff.unca.edu/mcmcclur/GoogleMaps/En... | {
"content_hash": "97378bfb40268731024c3884bc2ed7e9",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 91,
"avg_line_length": 26.058823529411764,
"alnum_prop": 0.5312264860797592,
"repo_name": "ryankanno/hitraffic-alert",
"id": "ceaa585dde424173cc4cf7f5f8388f567e35cf7a",
"si... |
# This module, and the timer.pyd core timer support, were written by
# Sam Rushing (rushing@nightmare.com)
import timer
import time
# Timers are based on Windows messages. So we need
# to do the event-loop thing!
import win32event, win32gui
# glork holds a simple counter for us.
class glork:
d... | {
"content_hash": "298f36d2b91331fd6d270954d9e5db0f",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 84,
"avg_line_length": 33.78787878787879,
"alnum_prop": 0.568609865470852,
"repo_name": "zhanqxun/cv_fish",
"id": "3d4a9d51c43849fabad4c7a73dc6591b56046c4c",
"size": "2271"... |
from telemetry.core.platform.profiler import iprofiler_profiler
from telemetry.core.platform.profiler import perf_profiler
from telemetry.core.platform.profiler import sample_profiler
_PROFILERS = [iprofiler_profiler.IprofilerProfiler,
perf_profiler.PerfProfiler,
sample_profiler.SampleProf... | {
"content_hash": "d6c28ff1207ce040b92ef09b7bfe6044",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 63,
"avg_line_length": 27.57894736842105,
"alnum_prop": 0.7461832061068703,
"repo_name": "loopCM/chromium",
"id": "9ae251084ebbb64a75d2d665f9eed3b2a5c24de3",
"size": "691",... |
import numpy as np
import rbmpy.plotter as plotter
import rbmpy.datasets as datasets
import math
from sklearn.utils.extmath import safe_sparse_dot
from sklearn.utils.extmath import log_logistic
from sklearn.linear_model import Perceptron
def log_likelyhood_score(sample, target):
"""Lets find the log likelyhood"""
... | {
"content_hash": "b9984fbc34fe54bb398c5c11713c060f",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 155,
"avg_line_length": 38.04216867469879,
"alnum_prop": 0.6231195566112431,
"repo_name": "garibaldu/multicauseRBM",
"id": "16317ce259a070710e6625da3f0a8a53f320c675",
"siz... |
from nltk.stem import PorterStemmer
from nltk.tokenize import sent_tokenize, word_tokenize,
import sys
def remove_stopwords(tweets):
stemmer = PorterStemmer()
with open(tweets, 'r', buffering=1028) as read_tweet:
for tweet in read_tweet:
#Use stop word method
stop_words = se... | {
"content_hash": "c01d77f65f2134b79c1812a32ce846f0",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 104,
"avg_line_length": 25.470588235294116,
"alnum_prop": 0.6096997690531177,
"repo_name": "aseciwa/independent-study",
"id": "85ef93ab0ce79b1cf2d13fd6da67419338c1d3ca",
"s... |
import sys
import numpy as np
import scipy as sp
import scipy.ndimage
import scipy.interpolate
import os
import time
from struct import *
import glob
import png
from scipy.spatial import cKDTree
import multiprocessing
from joblib import Parallel, delayed
# read binary displacement data
def readBinary(fname):
coor... | {
"content_hash": "b8ba04f39bdee9c04ef01669d9f004e4",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 108,
"avg_line_length": 31.22,
"alnum_prop": 0.5712150330984411,
"repo_name": "UoA-eResearch/earthquake-viz",
"id": "4823dc1dbdb43caa64cbfcdfdceeab2887c0162b",
"size": "47... |
from base64 import b64encode
from datetime import (
datetime,
timedelta,
)
from hashlib import md5
import re
import struct
import zlib
try:
import simplejson as json
except ImportError:
import json
from webob.byterange import ContentRange
from webob.cachecontrol import (
CacheControl,
seri... | {
"content_hash": "31a1e85d9b27bf5ab904dde9ee138247",
"timestamp": "",
"source": "github",
"line_count": 1611,
"max_line_length": 89,
"avg_line_length": 33.92551210428305,
"alnum_prop": 0.5582756980275918,
"repo_name": "stefanv/aandete",
"id": "1f369e1df928c5de1555cd31e156a116ef33892c",
"size": "546... |
from dj_diabetes.models.foods import Foods
from dj_diabetes.tests import MainTest
class FoodsTest(MainTest):
def setUp(self):
super(FoodsTest, self).setUp()
title = 'Chocolate'
self.food = Foods.objects.create(title=title)
def test_foods(self):
self.assertTrue(isinstance(sel... | {
"content_hash": "ac1157445d0af5a61d3edcd322782622",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 69,
"avg_line_length": 27.066666666666666,
"alnum_prop": 0.6625615763546798,
"repo_name": "foxmask/dj-diabetes",
"id": "2317864f37e554715ca572d2e9d06523d0dbede0",
"size": "... |
__version__ = '0.0.8'
__all__ = ('Flacro', 'FlacroFor', 'AccordionItem', 'AccordionGroupMacro',
'TabItem', 'TabGroupMacro', 'ListMacro', 'LiItem')
from .flacro import (Flacro, FlacroFor)
from .packaged_macros import (AccordionItem, AccordionGroupMacro,
TabItem, TabGroupMacro, ListMacro, LiItem)
| {
"content_hash": "88ffe680c9e4741f2505c93cfacd80a9",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 73,
"avg_line_length": 38.25,
"alnum_prop": 0.7091503267973857,
"repo_name": "thrisp/flacro",
"id": "c11c051d84ad01e9fc6e43a5df85f26e9a58056f",
"size": "306",
"binary": fa... |
from atom.api import Unicode
from enaml.core.declarative import d_
from html_object import HTMLObject
from lxml.html import builder as E
class Item(HTMLObject):
tag = E.LI
text = d_(Unicode())
def initialize(self):
super(Item, self).initialize()
def buildHTML(self, *args):
self.add... | {
"content_hash": "67c2f606d3577b217585eaf1658fde7d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 49,
"avg_line_length": 20.857142857142858,
"alnum_prop": 0.6598173515981736,
"repo_name": "ContinuumIO/ashiba",
"id": "c2972cbee4ec49496a22c9f97ac8883d9d7c9989",
"size": "4... |
import pytest
from testtools import ExpectedException
from testtools.assertions import assert_that
from testtools.matchers import (
Equals, Is, IsInstance, MatchesAll, MatchesDict, MatchesListwise,
MatchesPredicate, MatchesStructure)
from testtools.twistedsupport import failed, succeeded
from twisted.internet... | {
"content_hash": "048c211b5371dce548d007c75e288415",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 78,
"avg_line_length": 37.773809523809526,
"alnum_prop": 0.6208635360857233,
"repo_name": "praekeltfoundation/certbot",
"id": "4fb53b0fabfcb79590fd8c58f86eff220b763186",
"s... |
import json
import logging
import os
import threading
from datetime import datetime, timedelta
from typing import NamedTuple, Optional
import dateutil.parser
from dateutil.tz import tzutc
from botocore import UNSIGNED
from botocore.compat import total_seconds
from botocore.config import Config
from botocore.exception... | {
"content_hash": "8609afdce274cfa6d685cd5f7f7b3f6f",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 79,
"avg_line_length": 32.74203821656051,
"alnum_prop": 0.5936192977336835,
"repo_name": "boto/botocore",
"id": "12b38ba113502d980c98a0a986f07ec29636d9cf",
"size": "10842"... |
from __future__ import absolute_import
from __future__ import print_function
from collections import deque
from contextlib import contextmanager
import logging
import os
import re
import sys
from scss import config
from scss.calculator import Calculator
from scss.compiler import _prop_split_re
from scss.compiler impo... | {
"content_hash": "c6e7a2fab84cdabfc3a14040967e1a99",
"timestamp": "",
"source": "github",
"line_count": 427,
"max_line_length": 152,
"avg_line_length": 40.07025761124122,
"alnum_prop": 0.54833430742256,
"repo_name": "Kronuz/pyScss",
"id": "f9b83b49a5ab70bd1df1aa47e9404df74825b6c0",
"size": "17132",... |
import base64
from xdrlib import Packer, Unpacker
from .transaction_history_entry_ext import TransactionHistoryEntryExt
from .transaction_set import TransactionSet
from .uint32 import Uint32
__all__ = ["TransactionHistoryEntry"]
class TransactionHistoryEntry:
"""
XDR Source Code::
struct Transactio... | {
"content_hash": "dc25eb0030458e6c57e9f2f0bb017802",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 69,
"avg_line_length": 26.755555555555556,
"alnum_prop": 0.5643687707641196,
"repo_name": "StellarCN/py-stellar-base",
"id": "35d3860c819d77097759956dd0969c1f2619fdcf",
"si... |
"""This module implements the chamfer distance."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow_graphics.util import export_api
from tensorflow_graphics.util import shape
from tensorflow_graphics.util import type_... | {
"content_hash": "9cd6f257c52ebbaa7530fd45c20bd64e",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 79,
"avg_line_length": 37.566265060240966,
"alnum_prop": 0.6799230275817832,
"repo_name": "tensorflow/graphics",
"id": "e22e404258b724cc6392a0c644a9cd0efa6034e7",
"size": "... |
import braintree
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.forms import AuthenticationForm
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404, JsonResponse
from django.shortcuts import render, get_object_or_404, redirec... | {
"content_hash": "2a505e97ad0f4c6bb8d5d784824fbc19",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 93,
"avg_line_length": 26.15018315018315,
"alnum_prop": 0.6849698837372181,
"repo_name": "codingforentrepreneurs/ecommerce-2",
"id": "687a569c69d2098a65c9a2ef088bcb4aa3b3cbc... |
"""Configuration for Elmax tests."""
import json
from elmax_api.constants import (
BASE_URL,
ENDPOINT_DEVICES,
ENDPOINT_DISCOVERY,
ENDPOINT_LOGIN,
)
from httpx import Response
import pytest
import respx
from . import MOCK_PANEL_ID, MOCK_PANEL_PIN
from tests.common import load_fixture
@pytest.fixtur... | {
"content_hash": "a3047e8b9e8446ec836a98c91d73f31d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 88,
"avg_line_length": 30.27906976744186,
"alnum_prop": 0.6351766513056836,
"repo_name": "nkgilley/home-assistant",
"id": "70e3af7670277c3c428eff03ab9d974ec82b1993",
"size"... |
import gettext
gettext.install('glance', unicode=1)
| {
"content_hash": "08b59aa041e9f8b61f28effe6d1c5604",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 36,
"avg_line_length": 17.666666666666668,
"alnum_prop": 0.7735849056603774,
"repo_name": "tylertian/Openstack",
"id": "b6d314b4074e836bf6223f7c6be292db22ebb542",
"size": "7... |
import matplotlib
import os
import socket
import struct
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import FigureManagerBase, ShowBase
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
HOST = 'localhost'
PORT = os.getenv("PYCHARM_MATPLOTLIB_POR... | {
"content_hash": "43c6da8635e07b7c248111b087f15f50",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 88,
"avg_line_length": 27.1,
"alnum_prop": 0.6249580677624959,
"repo_name": "xfournet/intellij-community",
"id": "1c70df0ab5ad842de5b6064450bf7d5b4e685b33",
"size": "2981"... |
import logging
from random import sample
import numpy as np
import Q_Learning_Agent as Q
from Agent import agent_controls
class helicopter(agent_controls):
"""
Class that Controls, interacts and links all the other classes togeather
Q-Learning, Agent Movements, World
"""
def __init__(sel... | {
"content_hash": "686921a40d4dd1a1f7b2b2ecddfd01da",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 78,
"avg_line_length": 36.819397993311036,
"alnum_prop": 0.4819692978472159,
"repo_name": "dandxy89/rf_helicopter",
"id": "45bd613f2b72f856b3088e151e48eaae3fd3660d",
"size... |
from ncclient import manager
host = '127.0.0.1'
user = 'root'
password = 'Juniper'
port = 2200
with manager.connect(host=host,
port=port,
username=user,
hostkey_verify=False,
password=password,
device_params={'nam... | {
"content_hash": "a032beed6306dc481ea5d019d8b4bb4a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 67,
"avg_line_length": 24.307692307692307,
"alnum_prop": 0.6060126582278481,
"repo_name": "SivagnanamCiena/nwkauto",
"id": "aa191724a8e80fff7825ccc8881bf657a2f2d652",
"size... |
from pytest import fixture
from beyond.dates import Date, timedelta
from beyond.io.ccsds import dumps, loads
from beyond.utils.measures import MeasureSet, Range, Azimut, Elevation
@fixture
def measureset(orbit, station):
path = "{0} {1} {0}".format(station.name, orbit.cospar_id).split()
aos = Date(2008, 9,... | {
"content_hash": "d467f3ef9706102e57b1ee6a50f87403",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 74,
"avg_line_length": 29.25581395348837,
"alnum_prop": 0.6820349761526232,
"repo_name": "galactics/beyond",
"id": "dd31cbfc759baf16970cb190e456897be325962c",
"size": "1259... |
from __future__ import absolute_import, division, print_function
import datetime
import operator
from cryptography import utils, x509
from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.backends.openssl.decode_asn1 import (
_asn1_integer_to_int,
_asn1_string_to_bytes,
_decode... | {
"content_hash": "33e4ba8337043d114cd5d62dce84884d",
"timestamp": "",
"source": "github",
"line_count": 583,
"max_line_length": 79,
"avg_line_length": 36.77358490566038,
"alnum_prop": 0.6081440365688698,
"repo_name": "kimjinyong/i2nsf-framework",
"id": "4d0dac7649a60060efd1d86c2fa1fba8cd126b43",
"s... |
import cv2
import time
import rpyc
import logging
import Tkinter as tk
import numpy as np
from PIL import Image, ImageTk
import UI_Mobot_Configuration as ui
def profile(fn):
# A decorator function to determine the run time of functions
def with_profiling(*args, **kwargs):
start_time = time.time()
... | {
"content_hash": "b26e5333b8a8b8bf1462faaf215a16f8",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 74,
"avg_line_length": 31.24,
"alnum_prop": 0.6515151515151515,
"repo_name": "harveybia/the-flash",
"id": "c29075b646318ac285d446a27d002a5c555aa9c2",
"size": "4686",
"bi... |
"""Setup application's models."""
import datetime as dt
from pathlib import Path
import peewee as pw
from muffin_peewee import JSONField, Plugin
from . import app
db = Plugin(app, connection=f"sqlite:///{ Path(__file__).parent.parent / 'db.sqlite' }")
class BaseModel(db.Model):
"""Automatically keep the mode... | {
"content_hash": "25f830c354670bbde44a38bf8c8268b5",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 88,
"avg_line_length": 23.79032258064516,
"alnum_prop": 0.6569491525423728,
"repo_name": "klen/muffin-admin",
"id": "332c9f8c6cdc772e3899c1d4e9f08887aa8b110f",
"size": "147... |
from fcntl import flock, LOCK_EX, LOCK_UN, LOCK_NB
from imp import load_source
from os import listdir, system
from os.path import dirname, isfile, join, realpath
from shutil import move
from subprocess import Popen, PIPE
from sys ... | {
"content_hash": "353c3070f3c6d4f120d3aa5be32eb830",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 167,
"avg_line_length": 40.65635738831615,
"alnum_prop": 0.6028230918772716,
"repo_name": "MSFTOSSMgmt/WPSDSCLinux",
"id": "46983a08aff02fb9e1f3dd1c55d1bb56ffe041d7",
"siz... |
from __future__ import absolute_import, unicode_literals
DEBUG = True
USE_TZ = True
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
}
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"thecut.forms",
"test_app",
... | {
"content_hash": "a2598faaddc7ee95e875f7bd3346eb11",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 69,
"avg_line_length": 20.31578947368421,
"alnum_prop": 0.5712435233160622,
"repo_name": "thecut/thecut-forms",
"id": "d449f9e937f15252eb3cd5ea5293ad0781eed6c2",
"size": "7... |
"""
Django settings for zhihumonitor project.
Generated by 'django-admin startproject' using Django 1.10.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impo... | {
"content_hash": "1ee5f1ed0b51f213a8917b30536c58f9",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 91,
"avg_line_length": 26.132231404958677,
"alnum_prop": 0.6872232764073372,
"repo_name": "WebMonitor/ZhihuMonitor",
"id": "3a263fa6f1a3e98cd252139bd02fff607729dd58",
"siz... |
import scipy.io as sio
import numpy as np
def load_mat(filename):
"""
this function should be called instead of direct spio.loadmat
as it cures the problem of not properly recovering python dictionaries
from mat files. It calls the function check keys to cure all entries
which are still mat-object... | {
"content_hash": "e46694aab7d9adba3c3fb5c3373fc7fb",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 79,
"avg_line_length": 27.15714285714286,
"alnum_prop": 0.5994213571804313,
"repo_name": "gentnerlab/glab-common-py",
"id": "ad4a2fc581aaecf2efcabd405afc04b638b23134",
"si... |
import antlr3
import testbase
import unittest
class t015calc(testbase.ANTLRTest):
def setUp(self):
self.compileGrammar()
def _evaluate(self, expr, expected, errors=[]):
cStream = antlr3.StringStream(expr)
lexer = self.getLexer(cStream)
tStream = antlr3.CommonTokenStream(lexer)... | {
"content_hash": "c3ac452a76eb809e8943953b1083602b",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 79,
"avg_line_length": 25.804347826086957,
"alnum_prop": 0.6015164279696714,
"repo_name": "indashnet/InDashNet.Open.UN2000",
"id": "0f1fe8a39af4648512f9e83f96293f45b7308e07",... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('information_technology', '0002_auto_20180131_1525'),
]
operations = [
migrations.AlterField(
model_name='component',
name='id',
field=models.BigAutoField... | {
"content_hash": "49d22cec9963b23993d615605ee9ccf4",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 111,
"avg_line_length": 30.095238095238095,
"alnum_prop": 0.6060126582278481,
"repo_name": "Semprini/cbe",
"id": "f99002c0981816e02e4a090555171b3fc1d9bc7f",
"size": "681",
... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
im... | {
"content_hash": "3c54cb311ce20c3453b089fa8f807ecb",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 105,
"avg_line_length": 22.476190476190474,
"alnum_prop": 0.6927966101694916,
"repo_name": "mbohlool/client-python",
"id": "32c579c489242bf1f312e42647f8f37aafb6b74c",
"size... |
revision = '07ea7b63c8fc'
down_revision = '3cecf6a39f78'
branch_labels = None
depends_on = None
import alembic
import sqlalchemy
def upgrade():
alembic.op.alter_column("cards", "cardid", new_column_name="id")
alembic.op.alter_column("card_multiverse", "multiverseid", new_column_name="id")
alembic.op.alter_column("... | {
"content_hash": "8be6d6af5f780c84ea348a5845e43bec",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 81,
"avg_line_length": 42.666666666666664,
"alnum_prop": 0.7299107142857143,
"repo_name": "andreasots/lrrbot",
"id": "f9fe3132800f549a0d3cb124e0e4b21ff587bb25",
"size": "89... |
"""
Middleware detection and setup code
"""
import sys
def startupMiddleware():
"""
Do the actual detection and startup, also defines all necessary globals
:returns: tuple -- current server rank and total world size
"""
if "MPI" in globals():
# Force local simulation
return 0, 1
... | {
"content_hash": "3dadfe35fcee548d223983eeb0804d2e",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 111,
"avg_line_length": 31.037037037037038,
"alnum_prop": 0.6217183770883055,
"repo_name": "kdheepak89/pypdevs",
"id": "7bf26851e10e33f752ee84a927b0dce96334edb5",
"size": "... |
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
HEADRequest,
unified_strdate,
ExtractorError,
)
class ORFIE(InfoExtractor):
_VALID_URL = r'https?://tvthek\.orf\.at/(?:programs/.+?/episodes|topics/.+?|program/[^/]+)/(?P<id>\d+)'
... | {
"content_hash": "5b05165c995f118746d65ec368eed6d4",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 225,
"avg_line_length": 35.85849056603774,
"alnum_prop": 0.4861878453038674,
"repo_name": "Grassboy/plugin.video.plurkTrend",
"id": "03421d1d5c78f2acd712e560ae17fb96d4a323be... |
import socket
import os
import sys
import time
BUFFER_SIZE = 200000
METRICS_REQ = "{\"action\":0,\"command\":\"ports_all_stat_values\",\"data\":null}"
API_REG = "{\"action\":1,\"command\":\"clients\",\"data\":{\"client_path\":\""
API_UNREG = "{\"action\":2,\"command\":\"clients\",\"data\":{\"client_path\":\""
GLOBAL_... | {
"content_hash": "0bcedebcf8981a31d9a7ca7546334b8c",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 106,
"avg_line_length": 36.8780487804878,
"alnum_prop": 0.576058201058201,
"repo_name": "john-mcnamara-intel/dpdk",
"id": "df41d04fbe9ea4b27640dcaf96f460c273663a68",
"size... |
from django.db import models
sexes = ((1, "Male"), (2, "Female"), (3, "Other"))
class Person(models.Model):
sex = models.PositiveSmallIntegerField(choices=sexes)
first = models.CharField(max_length=60)
last = models.CharField(max_length=60)
age = models.PositiveSmallIntegerField()
alive = models.Bo... | {
"content_hash": "544bce55345503911016fff0a398e83a",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 102,
"avg_line_length": 39.97142857142857,
"alnum_prop": 0.7019299499642602,
"repo_name": "hodgesds/django-hammer",
"id": "b08fd7db4d2a2d3d9272824411ea90ac5edca5d8",
"size"... |
"""Find location of test executable."""
import os
import layout_exceptions
build_target_suggestion_message = (
'Did you forget to build the ninja target "lb_layout_tests" first?')
def FindTestExecutable(default_build_order, use_build, exe_name, exe_base_dir):
def PathToExe(build):
return os.path.join(exe... | {
"content_hash": "397eb4f01de605050af697be93fb2a8e",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 35.72222222222222,
"alnum_prop": 0.6671850699844479,
"repo_name": "snibug/gyp_example",
"id": "de4f4987f858cf724caee6ace356a83ef6f8e743",
"size": "12... |
import asyncio
import functools
import wrapt
def futurized(o):
''' Makes the given object to be awaitable.
:param any o: Object to wrap
:return: awaitable that resolves to provided object
:rtype: asyncio.Future
Anything passed to :code:`futurized` is wrapped in :code:`asyncio.Future`.
This m... | {
"content_hash": "ce316d1b8ae2f50ccbc6fc48a06dcc5e",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 147,
"avg_line_length": 30.986928104575163,
"alnum_prop": 0.5872178865218308,
"repo_name": "kwarunek/aiounittest",
"id": "a6d709dd7d01b81531a58fd3db4fc083efe71b55",
"size"... |
import os
import io
from zipfile import ZipFile, is_zipfile
from contextlib import contextmanager
import pandas as pd
__author__ = 'Semyon'
def extract_csv(filepath):
zp = ZipFile(filepath)
csv = [f for f in zp.namelist() if os.path.splitext(f)[-1] == '.csv']
return zp.open(csv.pop())
@contextmanager
... | {
"content_hash": "4914b70337cbed7354f3e2ed737f47b3",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 89,
"avg_line_length": 24.083333333333332,
"alnum_prop": 0.6608996539792388,
"repo_name": "SammyVimes/san_francisco_crimes",
"id": "961361211a59c40311f23203bd1fcdbf23c91d13",... |
from tashi.aws.wsdl.AmazonEC2_services_server import *
from tashi.aws.util import *
def ConfirmProductInstance(productCode, instanceId):
res = ConfirmProductInstanceResponseMsg()
res.requestId = genRequestId()
res.__dict__['return'] = True
for i in client.getInstances():
if i.id == int(instanceId):
res.ownerI... | {
"content_hash": "41a92f58dc6f8c395fdf2fcc374c5c20",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 54,
"avg_line_length": 27.125,
"alnum_prop": 0.728110599078341,
"repo_name": "stroucki/tashi",
"id": "43da3db687b5d5b6abe5597375483c9fa5f54f60",
"size": "1226",
"binary":... |
from RGT.XML.SVG.Attribs.basicSvgAttribute import BasicSvgAttribute
from types import StringType
class XlinkAttributes(BasicSvgAttribute):
ATTRIBUTE_XLINK_HREF = 'xlink:href'
ATTRIBUTE_XLINK_SHOW = 'xlink:show'
ATTRIBUTE_XLINK_ACTUATE = 'xlink:actuate'
ATTRIBUTE_XLINK_TYPE = 'xlink:type'
... | {
"content_hash": "0d340c24829c491e90b7a3a7889c4c13",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 85,
"avg_line_length": 34.85123966942149,
"alnum_prop": 0.5648565330803889,
"repo_name": "danrg/RGT-tool",
"id": "53d3188a921af12ff069484522f98a16a26b5dc0",
"size": "4217"... |
"""
A web interface built on Flask and the Cisco UCS Python SDK that has the
following basic functionality:
- Connect to a UCSM domain
- View and Add VLANs
- Add a VLAN to a vNIC
The web UI currently has little to none error handling in place so proceed
accordingly.
"""
from flask import Flask, render_template, req... | {
"content_hash": "d7d2a54ef8a7ba0918291dffb7be1cc2",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 74,
"avg_line_length": 20.155555555555555,
"alnum_prop": 0.6571113561190739,
"repo_name": "drew-russell/Cisco-UCS-VLAN-Management",
"id": "6ef8d3e535ebc0c31c7b8744af6ccfb676d... |
from datadog_checks.base import AgentCheck
EVENT_TYPE = SOURCE_TYPE_NAME = 'gnatsd'
class GnatsdConfig:
def __init__(self, instance):
self.instance = instance
self.host = instance.get('host', '')
self.port = int(instance.get('port', 8222))
self.url = '{}:{}'.format(self.host, self... | {
"content_hash": "1f39a463a98020c1d2a3653447a1f2fd",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 112,
"avg_line_length": 35.21768707482993,
"alnum_prop": 0.5122657909986479,
"repo_name": "DataDog/integrations-extras",
"id": "0a718aacbdfebf803c3e08f6cfbfd090bbc90fa9",
... |
import dnslib
import argparse
from scapy.all import *
try:
from termcolor import colored
except ImportError:
colored = lambda msg, color: msg
def show_packet(pkt):
if ARP in pkt:
print(pkt.summary())
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP... | {
"content_hash": "f080f83bb8f1f8ac99e91ace0bac78d8",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 106,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.5779494382022472,
"repo_name": "calebmadrigal/network-hacking-scripts",
"id": "f3ef2ae278b5ebd9a47f994d71fa999fb2b... |
from client.sources.common import interpreter
from client.sources.common import pyconsole
import client
import unittest
class PythonConsoleTest(unittest.TestCase):
def createConsole(self, verbose=True, interactive=False, timeout=None):
return pyconsole.PythonConsole(
verbose, interactive, t... | {
"content_hash": "8999a74cee842378f27a6844fb0c31c0",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 75,
"avg_line_length": 24.81761006289308,
"alnum_prop": 0.4237202230106437,
"repo_name": "jackzhao-mj/ok-client",
"id": "3b093547203a93dc93d45606b4f1433cdac81de2",
"size":... |
"""
State to synchronize files and directories with rsync.
.. versionadded:: 2016.3.0
.. code-block:: yaml
/opt/user-backups:
rsync.synchronized:
- source: /home
- force: True
"""
import logging
import os
import salt.utils.path
log = logging.getLogger(__name__)
def __virtual__():
... | {
"content_hash": "0d1036b815d581dad191f4510d6a5774",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 88,
"avg_line_length": 23.309941520467838,
"alnum_prop": 0.5559458103361766,
"repo_name": "saltstack/salt",
"id": "79be3def58350c5f5be0b849d4314ef5f851b8a1",
"size": "4556... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import with_statement
import warnings
class FSM(object):
"""
Override Matcher and Handler and pass instances to add_handler to
create transitions between states. If a transition handles
something, it returns ... | {
"content_hash": "76573aef3e69434af41b6e7e80607d32",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 73,
"avg_line_length": 29.53435114503817,
"alnum_prop": 0.5285603515120186,
"repo_name": "ghtdak/txtorcon",
"id": "05a7f18f1137559850bcd712e030ad8ee9732889",
"size": "3894... |
import sys, os
parent_path = os.path.split(os.path.abspath("."))[0]
if parent_path not in sys.path:
sys.path.insert(0, parent_path)
from pyspec import *
from pyspec.mockobject import *
import pyspec.framework
import pyspec.reloader as reloader
import StringIO, string
class AssertionMethods_Behaivior(object):
... | {
"content_hash": "a154e07569568d8644b4ff69fab8ecdb",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 73,
"avg_line_length": 24.99047619047619,
"alnum_prop": 0.5891768292682927,
"repo_name": "shibu/pyspec",
"id": "a420f77f4a1b33bcc17c7847cd8e319ab6177d2e",
"size": "5273",
... |
"""
eve.methods.post
~~~~~~~~~~~~~~~~
This module imlements the POST method, supported by the resources
endopints.
:copyright: (c) 2013 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from datetime import datetime
from flask import current_app as app, request
from eve.util... | {
"content_hash": "cf75b14a70274f980cacbf3050a0b6b0",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 79,
"avg_line_length": 37.971098265895954,
"alnum_prop": 0.6227736337342061,
"repo_name": "PulsePod/evepod",
"id": "740e07d0c4a32ceb40c2cc76e3e1b83f4dd316f3",
"size": "659... |
from setuptools import setup, find_packages
from marten import __version__, __doc__
def parse_requirements(requirements):
with open(requirements) as f:
return [l.strip('\n') for l in f if l.strip('\n') and not l.startswith('#')]
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
imp... | {
"content_hash": "6194fdf59aa430ecb9eccf0e623aa89e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 78,
"avg_line_length": 23.41176470588235,
"alnum_prop": 0.7185929648241206,
"repo_name": "nick-allen/marten",
"id": "e231a6767fcb95c8608ab4fb1899b9f75b77811b",
"size": "124... |
import errno
import functools
import logging
import os
import subprocess
import sys
import unittest
import unittest.mock
from copy import deepcopy
import pytest
from airflow import models
from airflow.jobs.backfill_job import BackfillJob
from airflow.utils.db import add_default_pool_if_not_exists
from airflow.utils.s... | {
"content_hash": "d10718b0992791df441ab712c075c745",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 104,
"avg_line_length": 33.27638190954774,
"alnum_prop": 0.6411960132890365,
"repo_name": "airbnb/airflow",
"id": "686142ebcb8e95ac17ad36580b0250797b41dfd1",
"size": "7410... |
"""
test_django-watchman
------------
Tests for `django-watchman` views module.
"""
from __future__ import unicode_literals
import json
import sys
import unittest
from importlib import reload
from unittest.mock import patch
import django
from django.conf import settings
from django.contrib.auth.models import Anonym... | {
"content_hash": "1e95fc7567b99a0d7ae80e9714159bd9",
"timestamp": "",
"source": "github",
"line_count": 512,
"max_line_length": 88,
"avg_line_length": 34.89453125,
"alnum_prop": 0.6143512817642449,
"repo_name": "mwarkentin/django-watchman",
"id": "9d83ab2b18f7c6bc9474117bbac6196bc686a887",
"size": ... |
"""Implementation of DPLL algorithm.
Further improvements: eliminate calls to pl_true, implement branching rules,
efficient unit propagation.
References
==========
* https://en.wikipedia.org/wiki/DPLL_algorithm
* https://www.researchgate.net/publication/242384772
"""
from ...core.compatibility import default_sort_... | {
"content_hash": "77d221a6d313ad384d2259e94cef8934",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 80,
"avg_line_length": 27.982954545454547,
"alnum_prop": 0.5981725888324874,
"repo_name": "skirpichev/omg",
"id": "bb14c6cd3878374098746ffc2f50c8c7687a2324",
"size": "4925... |
from unittest import TestCase
from .util import (
connect_db,
destroy_db
)
class ConnectionTestCase(TestCase):
def setUp(self):
self.connection = None
import django
django.setup()
def tearDown(self):
if None is not self.connection:
destroy_db(self.connect... | {
"content_hash": "196fd1033db22147064f6f127adfd134",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 72,
"avg_line_length": 22.583333333333332,
"alnum_prop": 0.6337638376383764,
"repo_name": "Knotis/djangocassandra",
"id": "d3ba5d410da8cd1d067bce47197324aa9870640f",
"size"... |
from collections import defaultdict
from datetime import datetime
from io import StringIO
import math
import operator
import re
import numpy as np
import pytest
from pandas.compat import IS64
from pandas.errors import InvalidIndexError
from pandas.util._test_decorators import async_mark
import pandas as pd
from pand... | {
"content_hash": "b4380e78cd93334706eb3cd43536d6c2",
"timestamp": "",
"source": "github",
"line_count": 1620,
"max_line_length": 88,
"avg_line_length": 34.614814814814814,
"alnum_prop": 0.562415293530209,
"repo_name": "datapythonista/pandas",
"id": "43b893b0846726be67bbc1eb07afd01ead80696d",
"size"... |
from applications.price_list.models import PriceList, ActivityPriceListItem, TimePriceListItem, UnitPriceListItem, \
PriceListItemEquipment, PriceListItemService
from applications.price_list.serializers import PriceListSerializer, ActivityPriceListItemSerializer, \
TimePriceListItemSerializer, UnitPriceListItem... | {
"content_hash": "384a80aeb2aa3629a63ad9191ad914bc",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 116,
"avg_line_length": 31.944444444444443,
"alnum_prop": 0.7756521739130435,
"repo_name": "awwong1/apollo",
"id": "c66a7d2b1aa2861981a6decf68483e7cdff06dff",
"size": "1725... |
from flask import Flask
from photo import photo
from routes import Routes
blueprints = (
(photo.create_blueprint(), '/services/photo'),)
base_routes = Routes()
class Eclipse2017PhotoApp(Flask):
"""
Eclipse 2017 Photo application.
"""
def __init__(
self, project_id, session_enc_key,... | {
"content_hash": "eec10bd5e3729d9f4e7211c949c76c64",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 80,
"avg_line_length": 27.696969696969695,
"alnum_prop": 0.6367614879649891,
"repo_name": "google/eclipse2017",
"id": "3c616d043886bb1257405ba16a54e9179c782f6e",
"size": "1... |
"""Library for constructing data for imagenet experiments."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import os
from absl import flags
from absl import logging
import attr
import robustness_dhtd
from six.moves import range
import t... | {
"content_hash": "c0c122c46f742ba907a558137b6b4eba",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 80,
"avg_line_length": 34.49650349650349,
"alnum_prop": 0.6918710723697548,
"repo_name": "google-research/google-research",
"id": "26ac6681b82563f3f49abac2bd802544451fd903",... |
from coverage import *
| {
"content_hash": "063eb9c5d34cf1570041f2f06cfea1d0",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 23,
"avg_line_length": 24,
"alnum_prop": 0.75,
"repo_name": "sassoftware/testutils",
"id": "1888c32466718482bed082e04112de881a0a8b88",
"size": "24",
"binary": false,
"co... |
import unittest, os, datetime
from flask import json, request, Response, session
import MySQLdb
from app.views import create_app
from app.dbconnect import DbConnect
class BasicConnectionTestCase(unittest.TestCase):
"""Checks for app and db connectivity"""
def setUp(self):
"""Setup test app"""
... | {
"content_hash": "5c63935c9df27b70226189728d9e0718",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 90,
"avg_line_length": 44.9,
"alnum_prop": 0.5281822854205928,
"repo_name": "DefendersOfNemo/SavingNemo",
"id": "24e5c7ac7f3fdbcd9910fdd1afaf663be81adb1d",
"size": "5847",... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
('umibukela', '0016_auto_20170116_1216'),
]
operations = [
migrat... | {
"content_hash": "1807e4efdde27042db0e667f6e40f7f1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 111,
"avg_line_length": 26.681818181818183,
"alnum_prop": 0.5945485519591142,
"repo_name": "Code4SA/umibukela",
"id": "6da0508b6c0d6f291b69e9a8b657d6bd9f1cd991",
"size": "6... |
from __future__ import unicode_literals
"""Test replica set MotorClient."""
import unittest
import pymongo
import pymongo.auth
import pymongo.errors
import pymongo.mongo_replica_set_client
from tornado import gen
from tornado.testing import gen_test
import motor
import motor.core
import test
from test import SkipTe... | {
"content_hash": "fdd2ee482739be6eab024ddea555acce",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 78,
"avg_line_length": 34.39047619047619,
"alnum_prop": 0.6577125450013847,
"repo_name": "wujuguang/motor",
"id": "3d5253113a60742fc75c80f383424b59e62c7c6d",
"size": "4190... |
import requests
from lib.base import OpscenterAction
class ListRequestsAction(OpscenterAction):
def run(self, request_type, list_all=True, cluster_id=None):
if not cluster_id:
cluster_id = self.cluster_id
url = self._get_full_url([cluster_id, 'request', request_type])
return... | {
"content_hash": "66a0f21b85a9444b8e1df3fc9afae4ec",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 75,
"avg_line_length": 29.384615384615383,
"alnum_prop": 0.6701570680628273,
"repo_name": "pidah/st2contrib",
"id": "c1d4fc726c7df460bc4798992d91277a10619990",
"size": "382... |
import kfp
import kfp.dsl as dsl
from kfp import components
from kubeflow.katib import ApiClient
from kubeflow.katib import V1beta1ExperimentSpec
from kubeflow.katib import V1beta1AlgorithmSpec
from kubeflow.katib import V1beta1ObjectiveSpec
from kubeflow.katib import V1beta1ParameterSpec
from kubeflow.katib import V1... | {
"content_hash": "6a3d78f798ff4c2d30aba423377d406f",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 134,
"avg_line_length": 37.42586750788644,
"alnum_prop": 0.5101146325016858,
"repo_name": "kubeflow/kfp-tekton",
"id": "f9573dae38083a7c3fe3a64ab6729a0cdbea8593",
"size": ... |
from typing import Any, Dict
from airflow.sensors.sql_sensor import SqlSensor
from airflow.utils.decorators import apply_defaults
class MetastorePartitionSensor(SqlSensor):
"""
An alternative to the HivePartitionSensor that talk directly to the
MySQL db. This was created as a result of observing sub opti... | {
"content_hash": "39dea08d70baf48aa4529c585e28629b",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 89,
"avg_line_length": 37.69444444444444,
"alnum_prop": 0.6138540899042004,
"repo_name": "mrkm4ntr/incubator-airflow",
"id": "09552917cc7761d48914e147b500c42445a64f29",
"si... |
import time
import unittest
from .basetest import BasetTest, measure, flask_profiler
def doWait(seconds, **kwargs):
time.sleep(seconds)
return seconds
class MeasurementTest(BasetTest):
def setUp(self):
flask_profiler.collection.truncate()
def test_01_returnValue(self):
wrapped = m... | {
"content_hash": "7414820beb2d5a0ce16fbc4fbbc8c6cb",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 66,
"avg_line_length": 31.102040816326532,
"alnum_prop": 0.6194225721784777,
"repo_name": "muatik/flask-profiler",
"id": "20009a712af9805ee898f27d71494a298ecb41a7",
"size":... |
class MandrelException(Exception):
pass
class MissingBootstrapException(MandrelException):
pass
class UnknownConfigurationException(MandrelException):
pass
| {
"content_hash": "2d7177ed466f4969150a8b76dbc44b4d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 54,
"avg_line_length": 21.25,
"alnum_prop": 0.8117647058823529,
"repo_name": "ethanrowe/python-mandrel",
"id": "1a0fcd5543d91eeb6c2b86ae1f745e8b62a47441",
"size": "170",
"... |
"""
sentry.utils.javascript
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import six
from collections import defaultdict
from datetime import timedelta
from django.core.urlres... | {
"content_hash": "5f6d930fd607edc657bd6cb64f122bf0",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 119,
"avg_line_length": 33.9954128440367,
"alnum_prop": 0.5846714343543381,
"repo_name": "zenefits/sentry",
"id": "81d6f19c6c4ff633154c2bb459f42640ea6bfbf6",
"size": "7411... |
"""Implements core PredicateResult specializations when operating on paths."""
# pylint: disable=too-many-arguments
from .path_value import (
PATH_SEP,
PathValue)
from .predicate import (
CloneableWithNewSource,
PredicateResult)
class PathResult(PredicateResult, CloneableWithNewSource):
"""Common... | {
"content_hash": "a1ec0fe3852ec920405930963d805f65",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 79,
"avg_line_length": 37.25255972696246,
"alnum_prop": 0.6520384791571232,
"repo_name": "google/citest",
"id": "ff5be42a8dab6ffa9781dd70e4511e64b80c10a7",
"size": "11513"... |
from __future__ import print_function
import sys
from functools import total_ordering
import re
import itertools as it
try:
izip = it.izip
except AttributeError:
izip = zip
basestring = str
old_snpeff_effect_so = {'CDS': 'coding_sequence_variant',
'CODON_CHANGE': 'coding_sequence_variant',
... | {
"content_hash": "1c3b44b28f6b0824d9ec460f14fcab44",
"timestamp": "",
"source": "github",
"line_count": 642,
"max_line_length": 287,
"avg_line_length": 37.889408099688474,
"alnum_prop": 0.5818705035971223,
"repo_name": "brentp/geneimpacts",
"id": "75f0233c4a46fb8a41d164878c3af3605eeec9b9",
"size": ... |
r"""
This script runs commands on each entry in the API caches.
Syntax: cache.py [-password] [-delete] [-c '...'] [dir ...]
If no directory are specified, it will detect the API caches.
If no command is specified, it will print the filename of all entries.
If only -delete is specified, it will delete all entries.
T... | {
"content_hash": "828bbbbb7a2e64567607a1e955d8d9af",
"timestamp": "",
"source": "github",
"line_count": 363,
"max_line_length": 79,
"avg_line_length": 30.049586776859503,
"alnum_prop": 0.5803080308030804,
"repo_name": "hperala/kontuwikibot",
"id": "fe69f74f59ae097c08b7613fb3d5e11e5a2f4767",
"size":... |
try:
import ast
from ast import iter_child_nodes
except ImportError:
from flake8.util import ast, iter_child_nodes
__version__ = "1.1"
class UnicodeStringLiteral(object):
name = "unicode-string-literal"
version = __version__
forbidden_str_methods = {'format', }
W742 = 'W742 Usage of non-u... | {
"content_hash": "f73876311f30df95efcb43a359ae3d80",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 36.58490566037736,
"alnum_prop": 0.5740072202166066,
"repo_name": "cogniteev/flake8-unicode-string-literal",
"id": "e9c7640c1a25977fa1b19ddf790fcbedf1a... |
"""
ui celery tasks
"""
from odl_video import logging
from odl_video.celery import app
from ui import api as ovs_api
from ui.models import VideoFile
log = logging.getLogger(__name__)
@app.task
def post_hls_to_edx(video_file_id):
"""Loads a VideoFile and calls our API method to add it to edX"""
video_file = (... | {
"content_hash": "c3e6c8c7569838e6b8cee2ba6e144d46",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 72,
"avg_line_length": 27.62962962962963,
"alnum_prop": 0.6528150134048257,
"repo_name": "mitodl/odl-video-service",
"id": "5e36ab9a72e3fa357b2f2afa95bb1fa604ca1e6a",
"size... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Event.mozillian'
db.add_column(u'main_event', 'mozillian',
self.gf('django.db.models.fields.Ch... | {
"content_hash": "0ed9ab62f6b9006207ccab1b399e1f6a",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 209,
"avg_line_length": 85.72672672672672,
"alnum_prop": 0.5499001646407679,
"repo_name": "bugzPDX/airmozilla",
"id": "e10a840db7fa216592f87e961af0265bf1bde862",
"size": "... |
import unittest
import urllib2
from flask.ext.testing import LiveServerTestCase, TestCase
from tmb import app as tmbapp, db
from tmb.models import User
class TestTMB(TestCase):
def setUp(self):
db.create_all()
super(TestCase, self).setUp()
def tearDown(self):
db.session.remove()
... | {
"content_hash": "6fc82d529c885f5894346b90d42cd633",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 70,
"avg_line_length": 25.428571428571427,
"alnum_prop": 0.6027287319422151,
"repo_name": "TinyMultiplayerBot/TinyMultiplayerBot",
"id": "0310d0a40d0ff88cac9217fc8303c2529485... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.