text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Not mine, found over there:
http://code.activestate.com/recipes/576819-logging-to-console-without-surprises/
Licensed under the MIT License and slightly modified.
"""
import logging
import sys
class LevelHandler(logging.StreamHandler):
"""A handler that logs to console in the sensible way.
StreamHandler ... | {
"content_hash": "79ed69008c936f94ee5e55ccdb07545f",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 84,
"avg_line_length": 32.950819672131146,
"alnum_prop": 0.609950248756219,
"repo_name": "pbenas/smoker",
"id": "4567633fd9c41d9956dd2c80ab68f27624c017ed",
"size": "2032",
... |
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics.permutations import Permutation
from sympy.utilities.iterables import uniq
_af_new = Permutation._af_new
def DirectProduct(*groups):
"""
Returns the direct product of several groups as a permutation group.
This is impl... | {
"content_hash": "f9af05de01807ce717bceb3661779047",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 79,
"avg_line_length": 33.91228070175438,
"alnum_prop": 0.6409725814795655,
"repo_name": "amitjamadagni/sympy",
"id": "89fe888cc8b04709241619042d4d163a32502a84",
"size": "1... |
from driven.vizualization.plotting import plotting
__all__ = ['plotting']
| {
"content_hash": "d2249bf8825dfbc0c44240fc2f08b112",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 50,
"avg_line_length": 25,
"alnum_prop": 0.7466666666666667,
"repo_name": "biosustain/driven",
"id": "ef27ed9718fe160776b849a3cae8622c628ff10e",
"size": "690",
"binary": f... |
from datetime import timedelta
from datetime import date
from datetime import datetime
import gzip
from shutil import copyfileobj
from os.path import isfile
from os.path import getsize
from os.path import isfile
from os.path import getmtime
from os.path import join
import csv
from report_data.utils import find_data
fr... | {
"content_hash": "09e24157a49cb50f66d36737e95b16f9",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 127,
"avg_line_length": 34.40184049079755,
"alnum_prop": 0.6092732946946054,
"repo_name": "jfalkner/acumen",
"id": "6d50758415a6f0b8a65821f19b3f64b6faa1a247",
"size": "112... |
import numpy as np
from collections import defaultdict
import itertools
from utils import plotting
from utils.policy import make_epsilon_greedy_policy
def sarsa(env, num_episodes, discount_factor=1.0, alpha=0.5, epsilon=0.1):
"""
SARSA algorithm: On-policy TD control. Finds the optimal epsilon-greedy policy.
... | {
"content_hash": "5ba6ac1f5d1f386ee8aad29225ebca8a",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 102,
"avg_line_length": 38.261538461538464,
"alnum_prop": 0.6397265782066747,
"repo_name": "transedward/ml-playground",
"id": "bbf08f5ea45c51c0a1265e21561477edfd0e8dcb",
"s... |
from unittest import TestCase
from unicore.languages.constants import LANGUAGES
class LanguagesTestCase(TestCase):
def test_total_languages(self):
self.assertEqual(len(LANGUAGES), 438)
| {
"content_hash": "f170bd241c274bb99b55a0b9c214fe89",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 49,
"avg_line_length": 28.428571428571427,
"alnum_prop": 0.7788944723618091,
"repo_name": "universalcore/unicore.languages",
"id": "6faee2b90bd87bb456a9499dfb5c9827a570cac5",
... |
"""
sphinxcontrib.odfbuilder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Open Document Format builder
:copyright: Copyright 2017 by Christopher Hoskin <christopher.hoskin@gmail.com>
:license: BSD, see LICENSE for details.
"""
import pbr.version
__version__ = pbr.version.VersionInfo(
'sphinxcontr... | {
"content_hash": "f20f80d7fd9e01d9a28803ae7796a45c",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 83,
"avg_line_length": 23.533333333333335,
"alnum_prop": 0.6345609065155807,
"repo_name": "mans0954/odfbuilder",
"id": "400d7a93995c2a8e2457b17848741a593623440e",
"size": "... |
class Solution:
def canDistribute(self, nums: List[int], quantity: List[int]) -> bool:
numbersMap={}
for x in nums:
if x not in numbersMap:
numbersMap[x]=0
numbersMap[x]+=1
index=0
numbers=[0]*len(numbersMap)
for k,v in numbers... | {
"content_hash": "3c1c6360417f5513635cf1fd3c215d78",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 74,
"avg_line_length": 36.06896551724138,
"alnum_prop": 0.5,
"repo_name": "Magic07/online-judge-solutions",
"id": "d83df9dc27a4a23393ca206b1e9977b8a3aecaf1",
"size": "1046"... |
import call_go
print("Output is:")
print(call_go.add(1,4))
| {
"content_hash": "29e0c0796aa46a02116430f11d78e9e4",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 23,
"avg_line_length": 15,
"alnum_prop": 0.6833333333333333,
"repo_name": "swt02026/golang-with-other-langauage-example",
"id": "0f4736360481728cc9b3d34aa1a520282cd15dd7",
"... |
"""Declarative class for defining hnadling of preferences.
"""
from atom.api import List, Str
from enaml.core.api import Declarative, d_, d_func
class Preferences(Declarative):
""" Declarative class for defining a workbench preference contribution.
Preferences object can be contributed as extensions child t... | {
"content_hash": "09934336121ea7cbda78785a01eab83c",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 35.08,
"alnum_prop": 0.6721778791334093,
"repo_name": "Ecpy/ecpy",
"id": "db5c7940f0f5f25c740b1d5e1b9bc5a032ef6059",
"size": "2137",
"binary": fals... |
import glob
import os
import sys
import numpy as np
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness
from openmc.statepoint import StatePoint
class FixedSourceTestHarness(TestHarness):
def _get_results(self):
"""Digest info in the statepoint and return as a string."""
# Read t... | {
"content_hash": "750ca4b9c1cc249b7cdd34b2b7f1fc93",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 86,
"avg_line_length": 32.904761904761905,
"alnum_prop": 0.5463096960926194,
"repo_name": "mjlong/openmc",
"id": "12dbb8d7693d52bcadf0356cfd8a16d92c883975",
"size": "1405",... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "ac2f9e0dd0dc3feab48636b9b2121861",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 80,
"avg_line_length": 32.06113537117904,
"alnum_prop": 0.7017161536366113,
"repo_name": "christoph2806/py-ethscan",
"id": "25b061ab5ed22c6c526ab2dde0a34fb447405424",
"siz... |
"""Script for running all test files (except memory leaks tests)."""
import os
import sys
from psutilcli.test import unittest
from psutilcli.test import VERBOSITY
def get_suite():
HERE = os.path.abspath(os.path.dirname(__file__))
testmodules = [os.path.splitext(x)[0] for x in os.listdir(HERE)
... | {
"content_hash": "a2750336bfe84d496c6c44d0f53f8c58",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 26.357142857142858,
"alnum_prop": 0.6680216802168022,
"repo_name": "giampaolo/psutil-cli",
"id": "1891b0090b58998b4966917c2feb92d5c463648c",
"size": ... |
from rest_framework import viewsets, mixins
from rest_framework.views import APIView
from robocrm.models import RoboUser
from projects.models import Project
from officers.models import Officer
from webcams.models import Webcam
from social_media.models import SocialMedia
from sponsors.models import Sponsor
from faq.mode... | {
"content_hash": "438fc3fe29e94eccec39bb88e55fb434",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 155,
"avg_line_length": 28.782077393075358,
"alnum_prop": 0.6918341352957826,
"repo_name": "sreidy/roboticsclub.org",
"id": "a611f61f0e0e40c3b03f664d2fda2419ba1ace69",
"si... |
import os
import ddt
import mock
from oslo_config import cfg
import requests
import six
from six.moves.urllib import parse
from rally import exceptions
from rally.verification.tempest import config
from tests.unit import fakes
from tests.unit import test
CONF = cfg.CONF
CREDS = {
"admin": {
"username":... | {
"content_hash": "b7044c7a8f3d37a669180f958a2db6d4",
"timestamp": "",
"source": "github",
"line_count": 465,
"max_line_length": 79,
"avg_line_length": 42.21935483870968,
"alnum_prop": 0.5960676446617766,
"repo_name": "varuntiwari27/rally",
"id": "2873cfb9f427bae5a6ac285cdf4f75476a83e1a9",
"size": "... |
from django import forms
from django.forms.util import ErrorDict
FORM_MODEL_TRANSLATION = {
'billing__first_name': 'bill_first_name',
'billing__last_name': 'bill_last_name',
'billing__street_address': 'bill_street1',
'billing__extended_address': 'bill_street2',
'billing__locality': 'bill_city',
... | {
"content_hash": "67d810aeef2ad0d5cf52d1a3e2407cac",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 94,
"avg_line_length": 39.02739726027397,
"alnum_prop": 0.6433836433836434,
"repo_name": "hiidef/hiicart",
"id": "bb3b8130dfcd94b9c947bd93f4db45cd3e39fdfa",
"size": "2849",... |
import ujson
from gnocchiclient.v1 import base
class ArchivePolicyManager(base.Manager):
url = "v1/archive_policy/"
def list(self):
"""List archive policies
"""
return self._get(self.url).json()
def get(self, name):
"""Get an archive policy
:param name: Name o... | {
"content_hash": "4abc5d8fe137a0686f412cda9d6ae704",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 67,
"avg_line_length": 24.763636363636362,
"alnum_prop": 0.5697503671071953,
"repo_name": "sileht/python-gnocchiclient",
"id": "2f87f391935d0f76ca79cae6ae510e46492afef3",
"... |
import os
import re
import librosa
import subprocess
from datetime import datetime
from decimal import Decimal
from influxdb import InfluxDBClient
from influxdb.exceptions import InfluxDBClientError
from ..acoustics import analyze_pitch, analyze_formant_tracks, analyze_formant_points, analyze_intensity, \
analyze... | {
"content_hash": "db3ef1392dcc84b089bb64ac9edb39c6",
"timestamp": "",
"source": "github",
"line_count": 1354,
"max_line_length": 172,
"avg_line_length": 41.540620384047266,
"alnum_prop": 0.5434697578494471,
"repo_name": "PhonologicalCorpusTools/PyAnnotationGraph",
"id": "e08a4258b122cd0ed56ee391a85a5... |
from __future__ import print_function # Python 2
import os
import time
import hashlib
import random
import socket
import logging
try:
import Queue as queue # noqa: N813
#except ModuleNotFoundError: # Python 3
except Exception:
import queue # Python 3
from json import dumps #, loads
from re import findal... | {
"content_hash": "3f018f73ecda60b97769c0f128022080",
"timestamp": "",
"source": "github",
"line_count": 2742,
"max_line_length": 155,
"avg_line_length": 38.62253829321663,
"alnum_prop": 0.6106437022558379,
"repo_name": "mlassnig/pilot2",
"id": "cbd5487b2473ff4624c3c4e8bdffa20330e269ed",
"size": "10... |
import logging
import os
from scrapy import cmdline
if not os.path.exists('log'):
os.makedirs('log')
logging.basicConfig(
filename = 'log/main.log',
format = '%(levelname)s %(asctime)s: %(message)s',
level = logging.DEBUG
)
cmdline.execute("scrapy crawl assetstore".split())
| {
"content_hash": "23622aa29aebe5d0e9647efb0978a11f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 58,
"avg_line_length": 20.466666666666665,
"alnum_prop": 0.6579804560260586,
"repo_name": "awolfly9/Python-Crawl-UnityAssetStore",
"id": "bdd36f7ca0c41b2f2963d715bf1e93c1d118... |
def add_native_methods(clazz):
def getNumGcExtAttributes__java_lang_management_GarbageCollectorMXBean__(a0, a1):
raise NotImplementedError()
def fillGcAttributeInfo__java_lang_management_GarbageCollectorMXBean__int__java_lang_String____char____java_lang_String____(a0, a1, a2, a3, a4, a5):
raise... | {
"content_hash": "9d6795e41cee07d4523d00bbc53ac0b5",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 251,
"avg_line_length": 74.7,
"alnum_prop": 0.7617135207496654,
"repo_name": "laffra/pava",
"id": "dc3e532b6a8e99e365a2a6a36611cadd91b92686",
"size": "747",
"binary": fal... |
import os
from setuptools import setup
from imp import load_source
burgaur = load_source("burgaur", "burgaur")
def read(fname):
filename = os.path.join(os.path.dirname(__file__), fname)
return open(filename).read().replace('#', '')
setup(
name="burgaur",
version=burgaur.__version__,
author=burga... | {
"content_hash": "e684dc64d523e2df199356db0d0b6991",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 61,
"avg_line_length": 27.32,
"alnum_prop": 0.6603221083455344,
"repo_name": "vga-/burgaur",
"id": "25c40b20301e8d6944a18b85bf20d488bae99e1d",
"size": "683",
"binary": fa... |
"""
This node does the transform tree setup for my robot 'minibot'.
It also publishes these transforms into ROS.
Author: Markus Knapp, 2017
Website: https://direcs.de
"""
import logging
import rospy
import tf
if __name__ == '__main__':
# init node
rospy.init_node('robot_tf_broadcaster', anonymous=False)
... | {
"content_hash": "47a7472144551f5f3e4e5238c30c3698",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 88,
"avg_line_length": 39.833333333333336,
"alnum_prop": 0.4920502092050209,
"repo_name": "markusk/minibot",
"id": "1899541e9710a0bd27452af199abf63a18a65e66",
"size": "2428... |
from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.client_message_type import *
REQUEST_TYPE = CLIENT_AUTHENTICATIONCUSTOM
RESPONSE_TYPE = 107... | {
"content_hash": "794932bacbb1eb521af169a87c0eb27d",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 151,
"avg_line_length": 39.96875,
"alnum_prop": 0.727130570758405,
"repo_name": "LifeDJIK/S.H.I.V.A.",
"id": "9d3c8b4f5aaa5ce95fd373c7f88dbffe4886ffd0",
"size": "2558",
"... |
"""
Backend file for interfacing with video hosts
This backend is for movshare.net
"""
import re
import urllib.parse
import urllib.request
#http://www.movshare.net/api/player.api.php?file=481200e9d928e&key=76%2E10%2E136%2E30-39ce698e365bd646007293ddce454e25
id = "movshare"
domain = "movshare.net"
vidType = "flash"
... | {
"content_hash": "3be482288541693bf007d32ceb6f92dd",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 137,
"avg_line_length": 23.157894736842106,
"alnum_prop": 0.6833333333333333,
"repo_name": "anthonynguyen/watch-tv",
"id": "ff9dffe9d43fbb9d91df5dae03f1944a7c164081",
"size... |
from django import forms
from django.contrib.auth.models import Permission
from django.core import validators
from django.db.models import get_model
from django.utils.translation import ugettext_lazy as _
from oscar.apps.customer.forms import EmailUserCreationForm, CommonPasswordValidator
from oscar.core.compat import... | {
"content_hash": "1f806ce81f9350853a8d805987268240",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 84,
"avg_line_length": 34.32258064516129,
"alnum_prop": 0.6282894736842105,
"repo_name": "saadbinakhlaq/django-oscar",
"id": "c19323ca9f4a4288f996451d32a2ce04ed161a71",
"s... |
from __future__ import print_function
from __future__ import with_statement
import collections
import getopt
import os
import re
import sys
import tables
class Dtrace(object):
class DtraceLine(object):
prefix_maps = {
"/usr/share/caldavd/lib/python/": "{caldavd}/",
"/System/Libra... | {
"content_hash": "e8185950c6412aa75661fd6720393b5b",
"timestamp": "",
"source": "github",
"line_count": 443,
"max_line_length": 115,
"avg_line_length": 35.598194130925506,
"alnum_prop": 0.48788839568801523,
"repo_name": "trevor/calendarserver",
"id": "f68b9bcb51a692309c8c5c45d729b6344f875289",
"siz... |
import argparse
import os
import sys
from collections import defaultdict
from pprint import pprint
import config
from postprocess import processdata
from utility import utility
import itertools
parser = argparse.ArgumentParser(
description="Prints out general statistics about FIRST/COPY")
parser.add_argument(
... | {
"content_hash": "7cd8641e79156183268dcbe2174ee3b1",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 81,
"avg_line_length": 30.214285714285715,
"alnum_prop": 0.6347517730496454,
"repo_name": "Wikidata/QueryAnalysis",
"id": "ec698c3ad2916025f717c17047e258f291d44d1e",
"size"... |
"""Incremental Principal Components Analysis."""
# Author: Kyle Kastner <kastnerkyle@gmail.com>
# Giorgio Patrini
# License: BSD 3 clause
import numpy as np
from scipy import linalg, sparse
from ._base import _BasePCA
from ..utils import gen_batches
from ..utils.extmath import svd_flip, _incremental_mean_and... | {
"content_hash": "033ab60e40e56ba5a002a4a60f3d7bb7",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 87,
"avg_line_length": 38.281984334203656,
"alnum_prop": 0.6044877915700451,
"repo_name": "shyamalschandra/scikit-learn",
"id": "634ed779f63f3195fa5133f542aacd90aabd8eb3",
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0030_realm_org_type'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='avatar_source',
field=models.CharField(choices=[... | {
"content_hash": "f805ce311df7847ee38d822dafd1a670",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 128,
"avg_line_length": 26.375,
"alnum_prop": 0.5781990521327014,
"repo_name": "brainwane/zulip",
"id": "7e57a2c01a971a1651cc810343c6ffaea93105fe",
"size": "422",
"binary... |
"""
Given a string, sort it in decreasing order based on the frequency of characters.
"""
from collections import defaultdict
class Solution(object):
def frequencySort(self, s):
"""
Brute force: counter, sort O(n log n)
There is a uppper limit of the counter, thus bucket sort possible
... | {
"content_hash": "2120df043e217cf76db09d58653f639a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 81,
"avg_line_length": 25.852941176470587,
"alnum_prop": 0.5358361774744027,
"repo_name": "algorhythms/LeetCode",
"id": "8f713188786f442d804707948ba31dd81199e508",
"size": ... |
"""
Functions for working with constant values.
"""
from typing import Union
from enum import Enum
import json
from penman.types import Constant
from penman.exceptions import ConstantError
pytype = type # store because type() is redefined below
class Type(Enum):
"""
An enumeration of constant value types... | {
"content_hash": "2b470d5dc4776af831ba5fe8f8834b59",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 77,
"avg_line_length": 29.131034482758622,
"alnum_prop": 0.5745738636363636,
"repo_name": "goodmami/penman",
"id": "9119b25ad10568ba0913c70189f4fce97da19adf",
"size": "422... |
import pytest
from django.contrib.auth.models import AnonymousUser
from django.contrib.messages.storage import default_storage
from shop.conf import app_settings
from shop.models.cart import CartModel
from shop.models.defaults.customer import Customer
from shop.modifiers.pool import CartModifiersPool
from shop.views.ca... | {
"content_hash": "d6040daf6a49efc21552f757de244d07",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 81,
"avg_line_length": 39.34013605442177,
"alnum_prop": 0.6979076603838837,
"repo_name": "awesto/django-shop",
"id": "5491f8d1f8cbeb4e573ccf372fe77830f4a7dd70",
"size": "5... |
from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import *
def login_user(request):
username = password = ''
if request.POST:
username = request.POST.get('username')
password = request... | {
"content_hash": "6715c15a9be140388b52a91b18ff3efa",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 104,
"avg_line_length": 35.2,
"alnum_prop": 0.6852272727272727,
"repo_name": "wegtam/weather-api",
"id": "ae2d49eb5107dc9f716fcdc7b5f00210166a4ee9",
"size": "882",
"binar... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: cloudtrail
short_description: manage CloudTrail create, del... | {
"content_hash": "087e18d76406f99ba9a5f807c17d216d",
"timestamp": "",
"source": "github",
"line_count": 615,
"max_line_length": 160,
"avg_line_length": 38.40813008130081,
"alnum_prop": 0.634985817704585,
"repo_name": "SergeyCherepanov/ansible",
"id": "932d2effcea9cc6259d2c92f13e454d7dfc2e55c",
"siz... |
import json
from climate.api import context as api_context
from climate import context
from climate import exceptions
from climate import tests
class ContextTestCase(tests.TestCase):
def setUp(self):
super(ContextTestCase, self).setUp()
self.fake_headers = {u'X-User-Id': u'1',
... | {
"content_hash": "6102e275ecd7284593ea109b2d6b22e8",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 74,
"avg_line_length": 41.361702127659576,
"alnum_prop": 0.48199588477366256,
"repo_name": "paramite/blazar",
"id": "ef4d6f76d253fa592c04b6abe99c4683dd38a42b",
"size": "252... |
'''
Taken from https://github.com/xzela/prawns
'''
from django.core.management import setup_environ
from djprawn import settings
from optparse import OptionParser
setup_environ(settings)
from rtube import api
# TODO store this in the database
PROVIDERS = ['rtube', 'kink']
api_urls = {
'rtube': {
'vi... | {
"content_hash": "50fd5010ad0b40cd028e673ae72d2deb",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 140,
"avg_line_length": 35.34825870646766,
"alnum_prop": 0.5452498240675581,
"repo_name": "xzela/code-samples",
"id": "2c550e411a0a502ec4f683035e55dca86bba16cf",
"size": "... |
from panda3d.core import NodePath, Point3, VBase4
from direct.fsm.FSM import FSM
from direct.interval.IntervalGlobal import Sequence, Parallel, ActorInterval, Func, Wait, ParticleInterval, Track, LerpColorScaleInterval, LerpScaleInterval, LerpHprInterval
from direct.task.Task import Task
from toontown.battle import... | {
"content_hash": "59f66dd78b1a19bd6dac32fc2e149878",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 380,
"avg_line_length": 45.48863636363637,
"alnum_prop": 0.6724123573986177,
"repo_name": "DedMemez/ODS-August-2017",
"id": "b31b4572ecce1f354836324741a1e9babc45eef2",
"si... |
import hashlib
import logging
import time
from mako.template import Template
from pyramid.response import Response
from pyramid.view import view_config
from pyramid.config import Configurator
from pyramid.httpexceptions import HTTPBadRequest
from waitress import serve
main_template = Template("""<html><hea... | {
"content_hash": "f7e2ac8f341e10077af47e3debcb8e60",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 80,
"avg_line_length": 31.64485981308411,
"alnum_prop": 0.5856467808623745,
"repo_name": "petrblahos/tricycles",
"id": "747e1deb884febf226027a8181fbbce97d8f04b4",
"size": ... |
'''XML Canonicalization
Patches Applied to xml.dom.ext.c14n:
http://sourceforge.net/projects/pyxml/
[ 1444526 ] c14n.py: http://www.w3.org/TR/xml-exc-c14n/ fix
-- includes [ 829905 ] c14n.py fix for bug #825115,
Date Submitted: 2003-10-24 23:43
-- include dependent namespace declar... | {
"content_hash": "12d66d4e7a09d9e4ef794be5af1dbd35",
"timestamp": "",
"source": "github",
"line_count": 432,
"max_line_length": 124,
"avg_line_length": 37.91203703703704,
"alnum_prop": 0.5802295762608377,
"repo_name": "acigna/pywez",
"id": "33305bf2b162e92b8df121a1f1200af6b204a843",
"size": "16401"... |
"""
ZMQ example using python3's asyncio
Litecoind should be started with the command line arguments:
litecoind -testnet -daemon \
-zmqpubrawtx=tcp://127.0.0.1:28332 \
-zmqpubrawblock=tcp://127.0.0.1:28332 \
-zmqpubhashtx=tcp://127.0.0.1:28332 \
... | {
"content_hash": "1a3b7883a0efaa87dbef1ccad5da89d4",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 107,
"avg_line_length": 36.1375,
"alnum_prop": 0.6281563472846766,
"repo_name": "untrustbank/litecoin",
"id": "acb6d6dee293110c0e37b00ad22407ff2d3e9b3c",
"size": "3106",
... |
import os
import sys
import re
from collections import namedtuple
import GeoIP
OUTPUT_FMT = "{0} - {country_code}, {region}, {region_name}, {city}, " + \
"{area_code}"
# borrowed from https://gist.github.com/nathangrigg/2363393
regex = r'(?P<owner>\S+) (?P<bucket>\S+) (?P<time>\[[^]]*\]) (?P<ip>\S+) ' +... | {
"content_hash": "42bf5cc921176710cac8a5748840247c",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 78,
"avg_line_length": 28.627906976744185,
"alnum_prop": 0.5641754670999187,
"repo_name": "bradfordboyle/python-projects",
"id": "4ebebaea65e36e279109dd735197ec7b846b44f9",
... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from io import open
from os import path
from re import search, MULTILINE
def read(filename, encoding='utf-8'):
base_dir = path.abspath(path.dirname(__file__))
with open(path.join(base_dir, filename), 'r', encoding=e... | {
"content_hash": "2c49e32f1f510d0e3234c174137a68f0",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 80,
"avg_line_length": 28.97142857142857,
"alnum_prop": 0.621301775147929,
"repo_name": "jmarini/nanoscope",
"id": "07abb39dc737f96e8f5484386a4b736a7a72eb57",
"size": "2074... |
import pytest
import masfotos
import os
from urllib.parse import urlparse
"""
Fixtures
"""
@pytest.fixture
def app():
return masfotos.app.test_client()
"""
Helpers
"""
def toBytes(s):
return bytes(s, 'UTF-8')
def test_should_redirect_to_about_with_signin_when_request_to_home_is_from_unauthenticated_user(app):
... | {
"content_hash": "0385cbf02c2d3b61fd17f13601dd0112",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 113,
"avg_line_length": 32.22516556291391,
"alnum_prop": 0.7184545828195643,
"repo_name": "ikumen/masfotos",
"id": "d308b7baf96c87898702f03ad7f8d2a35ee30d99",
"size": "486... |
import hashlib
from neutron.api.v2 import attributes
from neutron.openstack.common import log
from neutron import version
LOG = log.getLogger(__name__)
MAX_DISPLAY_NAME_LEN = 40
NEUTRON_VERSION = version.version_info.release_string()
# Allowed network types for the NSX Plugin
class NetworkTypes:
"""Allowed pro... | {
"content_hash": "cf17f20504b3374072d3f8ba282451b9",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 78,
"avg_line_length": 30.75,
"alnum_prop": 0.6647904940587868,
"repo_name": "leeseuljeong/leeseulstack_neutron",
"id": "49f5cf01d91176cfb3b5f353c7db161834292d21",
"size": ... |
def is_prime(num):
for i in range(2, num):
if num % i == 0:
return False
return True
def get_prime(last_prime):
num = last_prime + 1
while True:
if is_prime(num):
return num
num = num + 1
def main():
last_prime = 0
while True:
c = raw_i... | {
"content_hash": "ee136e85bdb1d0bfe22b47c59a593ecc",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 69,
"avg_line_length": 19.357142857142858,
"alnum_prop": 0.48154981549815495,
"repo_name": "igleyy/Python-Projects",
"id": "13aafbd67f7d2d5dfcc55f5ed54566e6d87f3b76",
"size... |
from .server import Application | {
"content_hash": "e204721cdefff123fb6a48f03cafffeb",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 31,
"alnum_prop": 0.8709677419354839,
"repo_name": "chakki-works/arXivTimesIndicator",
"id": "70ecc3bb253029a64b550829a901f26d30203690",
"size": "31",... |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
from environ import Env
########## PATH CONFIGURATION
PACKAGE_PATH = dirname(dirname(abspath(__file__)))
PACKAGE_NAME = basename(PACKAGE_PATH)
PROJECT_PATH = dirname(PACKAGE_PATH)
PROJECT_NAME = "... | {
"content_hash": "82f0dabd9ed8764014d0b87756c4088e",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 105,
"avg_line_length": 30.244514106583072,
"alnum_prop": 0.6566127694859039,
"repo_name": "guglielmo/mosic2-db-delibere",
"id": "c9cc627d65f7385af74b85b5111edf2b33633874",
... |
from __future__ import annotations
import argparse
from typing import Iterable
from typing import Iterator
from typing import Sequence
from pre_commit_hooks.util import added_files
from pre_commit_hooks.util import cmd_output
def lower_set(iterable: Iterable[str]) -> set[str]:
return {x.lower() for x in iterabl... | {
"content_hash": "ef21ba254d12c75eb8f70c5fc805abbc",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 67,
"avg_line_length": 28.430555555555557,
"alnum_prop": 0.6580361504640938,
"repo_name": "pre-commit/pre-commit-hooks",
"id": "33a13f1b94709a6c756ef46ead60eb9b1ade2efb",
"... |
"""Tests for extensions module."""
import unittest
import zlib
import set_sys_path # Update sys.path to locate mod_pywebsocket module.
from mod_pywebsocket import common
from mod_pywebsocket import extensions
class ExtensionsTest(unittest.TestCase):
"""A unittest for non-class methods in extensions.py"""
... | {
"content_hash": "00ef558a24065d1b30b8be9957913322",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 79,
"avg_line_length": 44.24404761904762,
"alnum_prop": 0.682900578501278,
"repo_name": "haoxli/web-testing-service",
"id": "b50d74a244ec5cd3cc19f70fc13390cd60cd03c9",
"si... |
import os
from unittest import SkipTest
from django.contrib.staticfiles.testing import StaticLiveServerCase
from django.utils.module_loading import import_by_path
from django.utils.translation import ugettext as _
class AdminSeleniumWebDriverTestCase(StaticLiveServerCase):
available_apps = [
'django.con... | {
"content_hash": "a6d2475ea7fdbdfcef6619c7a4ecb6e9",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 89,
"avg_line_length": 39.26829268292683,
"alnum_prop": 0.6277432712215321,
"repo_name": "adambrenecki/django",
"id": "4b424b72cd4cb097100f3ed21a679753bc523c32",
"size": "... |
"""
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname(os.path.realpath(__file__ ))
>>> datadir = os.path.realpath(os.path.join(filepath,
... '../../testing/data'))
>>> os.chdir(datadir)
"""
from __future__ import prin... | {
"content_hash": "0303c45fa6a1e4fb7ba2ab101901b808",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 87,
"avg_line_length": 37.370558375634516,
"alnum_prop": 0.6154577560445531,
"repo_name": "carolFrohlich/nipype",
"id": "8f96154909de37b54d29b53ae813ae98e90fbafd",
"size":... |
from distutils.core import setup
setup(name='itunes-web',
version='1.0',
description='control itunes over rest api',
author='Anuj Patel',
author_email='patelanuj28@gmail.com',
url='https://github.com/patelanuj28/itunes-web.git',
package_dir={'': 'src'},
py_modules=['itunes_api... | {
"content_hash": "f56396693da3f798c6bac35fe128119c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 58,
"avg_line_length": 26.941176470588236,
"alnum_prop": 0.574235807860262,
"repo_name": "patelanuj28/itunes-web",
"id": "b035e15b755148f2ef5eb28051d3eb9466bb4f15",
"size":... |
import os
from mattermost_bot import get_version
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'mattermost_bot'
copyright = u'2016, '
version = get_version()
release = get... | {
"content_hash": "87c3fcc389883cf7651ac3737def447c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 70,
"avg_line_length": 27.096774193548388,
"alnum_prop": 0.680952380952381,
"repo_name": "tuwmft/MatterBot",
"id": "c0ab149969e017a477f4ee66b161757dd8c1b954",
"size": "865"... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/food/shared_ingredient_marinade.iff"
result.attribute_template_id = -1
result.stfName("","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "92ed3e960f2389254049745c49f87e96",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 22.615384615384617,
"alnum_prop": 0.6904761904761905,
"repo_name": "obi-two/Rebelion",
"id": "b3d637ecfd47b1bf710a05c40186bd223c2992bf",
"size": "439... |
"""Tests for the MacOS Document Versions plugin."""
import unittest
from plaso.lib import definitions
from plaso.parsers.sqlite_plugins import mac_document_versions
from tests.parsers.sqlite_plugins import test_lib
class MacDocumentVersionsTest(test_lib.SQLitePluginTestCase):
"""Tests for the MacOS Document Vers... | {
"content_hash": "71930f54501b1ad3c3fd28d3cb19c420",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 33.925,
"alnum_prop": 0.6949152542372882,
"repo_name": "Onager/plaso",
"id": "9bb71bd9ad21be84b5b8092bdb7761d1f6034103",
"size": "1404",
"binary": ... |
from __future__ import absolute_import
__author__ = "czerwin@scalyr.com"
import os
from scalyr_agent.__scalyr__ import get_install_root, get_package_root, SCALYR_VERSION
from scalyr_agent.test_base import ScalyrTestCase
class TestUtil(ScalyrTestCase):
def test_version(self):
self.assertTrue(SCALYR_VERS... | {
"content_hash": "be2cac43bb8b872da06636f85244c182",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 86,
"avg_line_length": 30.526315789473685,
"alnum_prop": 0.7155172413793104,
"repo_name": "imron/scalyr-agent-2",
"id": "ff316f4d2035496695bc22665e5f38a983fe85d2",
"size": ... |
"""This example gets all custom channels in an ad client.
To get ad clients, run get_all_ad_clients.py.
Tags: customchannels.list
"""
__author__ = 'api.Dean.Lukies@gmail.com (Dean Lukies)'
import argparse
import sys
from apiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
a... | {
"content_hash": "c79bef35f4540afd71743dbd6b0a68c7",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 80,
"avg_line_length": 34.984375,
"alnum_prop": 0.6493970522554712,
"repo_name": "googleads/googleads-adxseller-examples",
"id": "d769da02738a8247f85d1689b64057b1913fc220",
... |
import textwrap
from pkg_resources import parse_version
from setuptools import __version__ as SETUPTOOLS_VERSION
import sympy as sm
from sympy.core.function import AppliedUndef
from sympy.utilities.iterables import iterable
from sympy.physics.mechanics import dynamicsymbols
SYMPY_VERSION = sm.__version__
def sympy_... | {
"content_hash": "e6ddffac4adc15e1b2581de813d9c3a7",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 79,
"avg_line_length": 31.75,
"alnum_prop": 0.65748031496063,
"repo_name": "Shekharrajak/pydy",
"id": "14ef67c43c764e9b972b7bd6b188404181d1a165",
"size": "2817",
"binary"... |
from .base import REGISTERED_ENVS, MujocoEnv
ALL_ENVIRONMENTS = REGISTERED_ENVS.keys()
| {
"content_hash": "4d0beafbd29b5ef38859f9364ec5d57f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 44,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.7954545454545454,
"repo_name": "ARISE-Initiative/robosuite",
"id": "fff6081f09064994187ac1154f62c57066bd455c",
"si... |
import math
import pytest
import numpy as np
import dartpy as dart
def kinematics_tester(joint):
num_tests = 2
joint.setTransformFromChildBodyNode(dart.math.expMap(np.random.rand(6)))
joint.setTransformFromParentBodyNode(dart.math.expMap(np.random.rand(6)))
dof = joint.getNumDofs()
q = np.zeros... | {
"content_hash": "f4f6418358773e1d4c5e8d81b3c7a92d",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 77,
"avg_line_length": 30.040816326530614,
"alnum_prop": 0.6329257246376812,
"repo_name": "dartsim/dart",
"id": "a94384f3ec314caa4eb4833fc3428644bd7b0c4f",
"size": "4416",... |
'''manages mongor
'''
from mongor import Maintenence
import argparse
from pprint import pprint
from bson.json_util import loads, dumps
from distutils.util import strtobool
def list_nodes(args):
m = Maintenence(args.config_host, args.config_port, args.config_ssl)
nodes = m.config.get_nodes({})
for node in n... | {
"content_hash": "f7e02d316bb40b28794a86e0cae521fa",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 118,
"avg_line_length": 45.390728476821195,
"alnum_prop": 0.6477969069156697,
"repo_name": "lmco/python-mongor",
"id": "8ac51fb3117d27eeb82b99384743d92e0d3899a2",
"size": ... |
import unittest
import requests
import requests_mock
from airflow.models.dag import DAG
from airflow.providers.apache.druid.transfers.hive_to_druid import HiveToDruidOperator
class TestDruidHook(unittest.TestCase):
# To debug the large json diff
maxDiff = None
hook_config = {
'sql': 'SELECT * ... | {
"content_hash": "3f5b74d132df5dadaa6f3e625e473287",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 102,
"avg_line_length": 39.97,
"alnum_prop": 0.49862396797598196,
"repo_name": "mrkm4ntr/incubator-airflow",
"id": "968dd1d78f90ab0b4d734cc1d7387391120403f4",
"size": "478... |
import sys
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
longest = 0
def longestUnivaluePath(self, root: TreeNode) -> int:
self.longestUnivaluePathHelper(sys.maxsize, root)
return self.longest
... | {
"content_hash": "c761098f8a59224307d179bbaa2245be",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 73,
"avg_line_length": 28.08823529411765,
"alnum_prop": 0.6387434554973822,
"repo_name": "shobhitmishra/CodingProblems",
"id": "e7ae9c48e6fc36c36c1f055aaa7d7213ca859b3e",
"... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = """
---
module: ce_bfd_global
version_added: "2.4"
short_description: Manages BFD global configuration on HUAWEI CloudEngine devices.
description:
- Manages BFD... | {
"content_hash": "d818c49188fc39cabae033d5c5a0e4ba",
"timestamp": "",
"source": "github",
"line_count": 531,
"max_line_length": 120,
"avg_line_length": 38.578154425612055,
"alnum_prop": 0.5579204295826214,
"repo_name": "SergeyCherepanov/ansible",
"id": "c1416013d8e3f7c80959a501f59486238dedc025",
"s... |
"""File to convert the output of PATH to a list."""
from optparse import OptionParser
import os
import sys
def path2list(thePath):
"""Converts a path listing to a whitespace separated list."""
theItems = thePath.split( os.pathsep )
theResult = '\n'.join( theItems )
return theResult
... | {
"content_hash": "31aea136c81c4043c4109e8f087b0e60",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 28.15625,
"alnum_prop": 0.5749167591564928,
"repo_name": "mrwizard82d1/pyutils",
"id": "e4134de92015354e4a27a0dd06c5bf3adcf4c8df",
"size": "912",
"... |
import logging
import datetime as dt
import wukong.errors as solr_errors
from wukong.request import SolrRequest
from wukong.zookeeper import Zookeeper
import json
logger = logging.getLogger(__name__)
def _add_scheme_if_not_there(url, scheme='http'):
if not (
url.startswith('http://')
or url.starts... | {
"content_hash": "5f0fed1a12f0c72eaf885a1beb3d996b",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 79,
"avg_line_length": 29.15,
"alnum_prop": 0.5428816466552315,
"repo_name": "SurveyMonkey/wukong",
"id": "f5352362409c5f673ca76b36a03f6228c109d2bd",
"size": "8162",
"bi... |
import os
import tempfile
import json
from dusty import constants
from dusty.systems.docker.config import registry_from_image, get_authed_registries
from ....testcases import DustyTestCase
class TestDockerConfigSystem(DustyTestCase):
def setUp(self):
super(TestDockerConfigSystem, self).setUp()
sel... | {
"content_hash": "bcf90bb8b513d661d2227b801e99d68a",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 95,
"avg_line_length": 43.892857142857146,
"alnum_prop": 0.6419853539462979,
"repo_name": "gamechanger/dusty",
"id": "e831326ac32afe70ed30e59b0fdecd03a3a72aeb",
"size": "24... |
from numpy.testing import TestCase
from parameterized import parameterized
from .. import palindrome as pl
class ShortPalindromesTest(TestCase):
@parameterized.expand(
[("RACE", "ECARACE"), ("TOPCODER", "REDTOCPCOTDER"), ("Q", "Q"),
("MADAMIMADAM", "MADAMIMADAM"),
("ALRCAGOEUAOEURGCOEU... | {
"content_hash": "9da30dda156110414a5fd346a87a7dad",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 75,
"avg_line_length": 34.15,
"alnum_prop": 0.5980966325036603,
"repo_name": "aliciawyy/dmining",
"id": "b4a369f9523b796121310ec164fa4b9c74678335",
"size": "1366",
"binar... |
"""Library of TPU helper functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import enum
import typing
from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union
from absl import logging
import numpy as np
f... | {
"content_hash": "4db6212cd12d933a611e60d0c594e93f",
"timestamp": "",
"source": "github",
"line_count": 2269,
"max_line_length": 104,
"avg_line_length": 42.3415601586602,
"alnum_prop": 0.6878519459161263,
"repo_name": "sarvex/tensorflow",
"id": "ad40555ceeaca3b64465e6d082cc99ba25c0dac2",
"size": "9... |
"""Tests for certbot.error_handler."""
import signal
import sys
import unittest
import mock
class ErrorHandlerTest(unittest.TestCase):
"""Tests for certbot.error_handler."""
def setUp(self):
from certbot import error_handler
self.init_func = mock.MagicMock()
self.init_args = set((42... | {
"content_hash": "cd11d7e41e2c81cd2d507aaf43471b9c",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 70,
"avg_line_length": 34.46478873239437,
"alnum_prop": 0.5713118103800572,
"repo_name": "wteiken/letsencrypt",
"id": "5434b36be8f4b217239377b62cc9e0246068bf1c",
"size": "2... |
"""
Base class for all nodes created and used by the binary expression
BooleanExpressionTree defines an interface used for evaluating the tree.
"""
class Node(object):
def evaluate(self, evaluation_param):
raise NotImplementedError("evaluate not implemented")
def add_child(self, node):
raise ... | {
"content_hash": "57465d98270568821295aa16d7573cde",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 114,
"avg_line_length": 30.770642201834864,
"alnum_prop": 0.6437090041741205,
"repo_name": "bheni/sql4json",
"id": "6aae120bf2f7bf70d248d03a663cac318fcd1815",
"size": "335... |
from rulengine.core import (import_class, get_date, ConditionOperator,
ExecutableCondition)
def execute_condition(cond):
"""
Get a rule instance for given operator and
return condition lambda func
"""
condition_method = 'rulengine.conditions.c_{0}_{1}'.format(
... | {
"content_hash": "773418b9fc5be14e2a6d2091356d3128",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 25.152941176470588,
"alnum_prop": 0.6641721234798877,
"repo_name": "baranbartu/rulengine",
"id": "3146d2562d43818617c7a33761f5f7aaa46d4e6d",
"size": ... |
import functools
import time
from keystoneauth1 import exceptions as ks_exc
from keystoneauth1 import loading as keystone
from keystoneauth1 import session
from oslo_log import log as logging
from nova.compute import utils as compute_utils
import nova.conf
from nova.i18n import _LE, _LI, _LW
from nova import objects
... | {
"content_hash": "13d84507da43510a490d9b64e78dc2b3",
"timestamp": "",
"source": "github",
"line_count": 437,
"max_line_length": 79,
"avg_line_length": 39.13729977116705,
"alnum_prop": 0.5490264865813015,
"repo_name": "xuweiliang/Codelibrary",
"id": "fa5041e664b52a50acbb37a7fa1cf090531878bf",
"size"... |
from __future__ import print_function
from django.core.management.base import BaseCommand
from apps.django_crontab.crontab import Crontab
class Command(BaseCommand):
args = '<add|show|remove>'
help = 'run this command to add, show or remove the jobs defined in CRONJOBS setting from/to crontab'
crontab_li... | {
"content_hash": "12312f24bd823f0aaff1e00642039d64",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 105,
"avg_line_length": 33.03030303030303,
"alnum_prop": 0.5174311926605505,
"repo_name": "SnailJin/house",
"id": "d044111a36ce9e90981d7891b47affa22a713136",
"size": "1090"... |
import django.core.validators
import django_inet.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("django_peeringdb", "0017_facility_fields"),
]
operations = [
migrations.AddField(
model_name="facility",
name... | {
"content_hash": "b0d890010bc9c0b49fdf13338696a90c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 55,
"avg_line_length": 29.4375,
"alnum_prop": 0.46709129511677283,
"repo_name": "peeringdb/django-peeringdb",
"id": "90672c711e1ebc19ff4efe55ec6281d2fe461ade",
"size": "991... |
"""
Exceptions raised by the Horizon code and the machinery for handling them.
"""
import logging
import os
import sys
import six
from django.core.management import color_style # noqa
from django.http import HttpRequest # noqa
from django.utils import encoding
from django.utils.translation import ugettext_lazy as ... | {
"content_hash": "e748f25463cc6a717061cf5bb0c43cfb",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 79,
"avg_line_length": 38.45,
"alnum_prop": 0.6568595578673602,
"repo_name": "394954369/horizon",
"id": "a282764c472484f609feaf31acffd724ded6692e",
"size": "12909",
"bin... |
from heapq import heappush, heappop
import unittest
class Heap:
def __init__(self, max_heap=False):
self.max_heap = max_heap
self._heap = []
def push(self, val):
if self.max_heap:
val *= -1
heappush(self._heap, val)
def pop(self):
ret = heappop(self._... | {
"content_hash": "d7cd79fa109030dcbdf3470d9d93a35a",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 96,
"avg_line_length": 28.21153846153846,
"alnum_prop": 0.5589638718473074,
"repo_name": "MFry/pyAlgoDataStructures",
"id": "497fe12ab3ae81e490843ec99215cb8634ea7cd2",
"si... |
"""
warning for 'import queue' in 2.7 from the future
Problem appears to be that pyinstaller cannot have two modules of the same
name that differ only by lower/upper case. The from the future 'queue' simply
imports all of the 'Queue' module. So by my reading, since 'queue' and 'Queue'
can not coexist in a frozen app... | {
"content_hash": "49aa4b29f60cea1df74a497e29cc3659",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 79,
"avg_line_length": 35.608695652173914,
"alnum_prop": 0.717948717948718,
"repo_name": "ivandeex/dz",
"id": "240c4e1533df521ec1eb1d27fb033ee6ef0bf107",
"size": "1230",
... |
from __future__ import print_function
# Author: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import os
import os.path as op
import warnings
from nose.tools import assert_true, assert_raises, assert_equal
from copy import ... | {
"content_hash": "a4617c6bf2c559594aec68f9efed29e5",
"timestamp": "",
"source": "github",
"line_count": 579,
"max_line_length": 79,
"avg_line_length": 39.9153713298791,
"alnum_prop": 0.5915797672104193,
"repo_name": "lorenzo-desantis/mne-python",
"id": "36664fd92c5ddc67c126066ed01d4eb4b901486a",
"s... |
import unittest
from pychbase._pychbase import _connection, _table
from pychbase import Connection, Table, Batch
from StringIO import StringIO
from config import ZOOKEEPERS, TABLE_NAME
from datetime import datetime
class TestCConnection(unittest.TestCase):
def test_bad_cldbs(self):
# Cloudera struggles wit... | {
"content_hash": "fc9e7d900aa188dc383b8b9b41c5bca1",
"timestamp": "",
"source": "github",
"line_count": 1835,
"max_line_length": 155,
"avg_line_length": 35.8708446866485,
"alnum_prop": 0.5455236011728423,
"repo_name": "mkmoisen/pychbase",
"id": "a98859da1ac8d2bb30d7030755a9f37cc154be48",
"size": "6... |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem357.py
#
# Prime generating integers
# =========================
# Published on Saturday, 5th November 2011, 04:00 pm
#
# Consider the divisors of 30: 1,2,3,5,6,10,15,30. It can be seen that for
# every divisor d of 30, d+30/d is prime. Find the sum of all ... | {
"content_hash": "f6441647510a6d344decbd82ac1d97fd",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 26.842105263157894,
"alnum_prop": 0.6333333333333333,
"repo_name": "olduvaihand/ProjectEuler",
"id": "c78c37bb1957fcdeb6b39feec60594a6339fe96c",
"siz... |
from users.alltests.users_models_tests import *
from users.alltests.users_forms_tests import *
from users.alltests.users_views_tests import * | {
"content_hash": "b6d72c6fb148acebc7e693e7ac789182",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 47,
"avg_line_length": 47,
"alnum_prop": 0.8156028368794326,
"repo_name": "none-da/zeshare",
"id": "bb411db073861aad8dabec19aa3581bf8c270ced",
"size": "141",
"binary": fal... |
from __future__ import print_function, division, absolute_import
import unittest
from flypy import jit, typeof
from flypy.runtime.obj import exceptions
class TestExceptionObjs(unittest.TestCase):
def test_typeof(self):
self.assertEqual(typeof(StopIteration()), exceptions.StopIteration.type)
if __name__... | {
"content_hash": "35ebf256b5b4bfd5f8809f06f0ce0241",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 80,
"avg_line_length": 26.733333333333334,
"alnum_prop": 0.7331670822942643,
"repo_name": "flypy/flypy",
"id": "03228101a9e6cc5ad57bd9e9d1294530dcd6e902",
"size": "425",
... |
import json
import sys
import csv
row=[]
csvPath = sys.argv[1] #Input Path to csv file
with open(csvPath,"r") as f:
lines = csv.reader(f.read().splitlines(), delimiter=' ')
for line in lines:
row.append(line)
data={}
for i in range(len(row)):
if "x-coordinate" in row[i][0].split(","):
... | {
"content_hash": "e275a273be6e756082b6d977d015a5d0",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 99,
"avg_line_length": 26.886363636363637,
"alnum_prop": 0.5841081994928149,
"repo_name": "RashmiNalwad/tika-similarity",
"id": "8e7978bde4ab24fedac95570d6f82dba058ccec0",
... |
import pickle
import numpy as np
# import pycuda.autoinit
from chainer import cuda, Function, FunctionSet, gradient_check, Variable, optimizers
import chainer.functions as F
from SuperClass import SuperClass
from dA import DenoisingAutoencoder
class StackedDenoisingAutoencoder(SuperClass):
def __init__(self, n... | {
"content_hash": "a96348eeac476b7d2e453e2f555cad37",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 112,
"avg_line_length": 32.940298507462686,
"alnum_prop": 0.5690983235160851,
"repo_name": "TakuTsuzuki/Hackathon2015",
"id": "972dba7caf09a4bc3c7d1c9ac1281790e8b4adef",
"s... |
"""Look ahead mechanism in regular expressions.
use (?=)
"""
import re
pattern = re.compile(r'(?=fox)')
result = pattern.search("The quick brown fox")
print result
"""
Match any word followed by a comma.
The example below is not the same as re.compile(r"\w+,")
For this will result in ['me,', 'myself,']
"""
patt = re... | {
"content_hash": "754ffe47cc12504ce9bd57165928e752",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 59,
"avg_line_length": 22.84,
"alnum_prop": 0.6532399299474606,
"repo_name": "andela-ggikera/regex",
"id": "023bd79e4e592c3e1e3751639efeee018d762a78",
"size": "571",
"bin... |
from datetime import datetime
from django.test import TestCase
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.es.tests.utils import es_test, populate_user_index
from corehq.apps.users.bulk_download import parse_web_users
from corehq.apps.users.models import Invitation, UserRole, WebUser
from ... | {
"content_hash": "9d0833c0b012af506358dd8269f96e3e",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 110,
"avg_line_length": 34.21656050955414,
"alnum_prop": 0.5819061801935964,
"repo_name": "dimagi/commcare-hq",
"id": "eefe76a2d29f265054c5830051fee578eabea4ee",
"size": "... |
"""
.. pakage:: patmat
:synopsis: Functional programming style pattern matching in Python.
"""
__version__ = '1.0.1'
__author__ = 'Xitong Gao'
__email__ = '@'.join(['gxtfmx', 'gmail.com'])
__license__ = 'MIT'
from patmat.mimic import (
Val, ZeroFsGiven, _, Type, Attr, Seq, List, Tuple, Dict, Pred, Or, Mimic,
... | {
"content_hash": "2dbc8d8463d76ff9f34c4977a5ab1c59",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 26.214285714285715,
"alnum_prop": 0.6348773841961853,
"repo_name": "pitcons/patmat",
"id": "f586a13c2271270c317595a14c825c2f456f8a8c",
"size": "367",... |
try:
from setuptools.core import setup
except ImportError:
from distutils.core import setup
PACKAGE = 'django_exceptional_middleware'
VERSION = '1.2.1'
package_data = {
'exceptional_middleware': [ 'templates/http_responses/*.html' ],
}
setup(
name=PACKAGE, version=VERSION,
description="Django... | {
"content_hash": "2cf6a31451cee674660790e2d7f2dc7d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 100,
"avg_line_length": 27.476190476190474,
"alnum_prop": 0.7036395147313691,
"repo_name": "jaylett/django_exceptional_middleware",
"id": "a780acc76ced37b0682fbc0a9441dce4c40... |
import collections
import os
import yaml
class Config(collections.UserDict):
"""
Instantiate this object with a dictionary or by parsing a YAML file with from_yaml method.
Once instantiated use to_env to dump all the data into environment variables.
Or use key assignment to assign specific values to ... | {
"content_hash": "3bca6299a6da8eb65b8817a3f6dc569b",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 94,
"avg_line_length": 31.426666666666666,
"alnum_prop": 0.5570640644887569,
"repo_name": "bvujicic/yml-to-env",
"id": "3f8f73f4ac818221125d75817172596fbf9859e3",
"size": "... |
"""
Code taken from SmartMeshSDK. The origin code was modified.
Copyright (c) 2012, Dust Networks
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the abo... | {
"content_hash": "9112e5ef208eeb7948d6ffc28854ea41",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 88,
"avg_line_length": 29.452229299363058,
"alnum_prop": 0.5140570934256056,
"repo_name": "realms-team/sol",
"id": "9227973374a26dc4433ec12517a714a16e0efbb8",
"size": "926... |
"""Handles all processes relating to instances (guest vms).
The :py:class:`ComputeManager` class is a :py:class:`nova.manager.Manager` that
handles RPC calls relating to creating instances. It is responsible for
building a disk image, launching it via the underlying virtualization driver,
responding to calls to check... | {
"content_hash": "a5b70ae8dbc2d3514108837485c04fd1",
"timestamp": "",
"source": "github",
"line_count": 2950,
"max_line_length": 79,
"avg_line_length": 46.784745762711864,
"alnum_prop": 0.5495706988370829,
"repo_name": "paulmathews/nova",
"id": "bbb71ddec74b6ddd27eb5b9d9ab36622ec839e8e",
"size": "1... |
"""onnx shape inference. Shape inference is not guaranteed to be
complete.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import onnx
import onnx.onnx_cpp2py_export.shape_inference as C
from onnx import ModelProt... | {
"content_hash": "a85266a45821c33e1603469dabc230ff",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 69,
"avg_line_length": 30.972972972972972,
"alnum_prop": 0.7373472949389179,
"repo_name": "mlperf/training_results_v0.6",
"id": "83d2495e0b1fbc384e26047406fc43880d478daa",
... |
# Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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 requ... | {
"content_hash": "36d65410e9f9459f2549e2380c3cf405",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 80,
"avg_line_length": 41.78125,
"alnum_prop": 0.6443530291697831,
"repo_name": "HewlettPackard/python-proliant-sdk",
"id": "89282598f68a840f50fe6a99b5b85a756ac69696",
"siz... |
import sqlite3
def create_table():
conn = sqlite3.connect('swipeat.db')
c = conn.cursor()
c.execute("CREATE TABLE swipeat_accounts (username text, password text)")
conn.commit()
# Check if account exists
def account_exists(username):
# Connection and cursor
conn = sqlite3.connect('swipeat.db'... | {
"content_hash": "58524b6a0f7b9db89bba3d59a26a1674",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 149,
"avg_line_length": 28.453125,
"alnum_prop": 0.6106534870950028,
"repo_name": "swipeat/back",
"id": "9d6160995b5009b40f2d9358a43bed90cfbf111d",
"size": "1822",
"binar... |
import re
from .base import BasePlugin
class JiwonPlugin(BasePlugin):
PATTERN = re.compile(r'jiwon\?\s*(.*)')
def process_message(self, data):
if ('text' in data) and ('subtype' not in data):
matched = re.match(self.PATTERN, data['text'])
if matched:
try:
... | {
"content_hash": "91bf36295daae82780ea663749641809",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 87,
"avg_line_length": 27.77777777777778,
"alnum_prop": 0.5266666666666666,
"repo_name": "askdjango/python-rtmbot",
"id": "cd54e45bcf290b6aaa73fa6cee88ae2a676f1063",
"size"... |
"""
BOSH OpenStack Ironic CPI
"""
# Python 2 and 3 compatibility
from __future__ import unicode_literals
import sys
from ironic_cpi.settings import CPISettings as CPISettings
def is_py3():
"""Check if data can be converted to boolean"""
return sys.version_info[0] == 3
def boolean(data):
"""Check if d... | {
"content_hash": "712d49524643c20eec4f4a67da45430c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 64,
"avg_line_length": 23.851063829787233,
"alnum_prop": 0.6342551293487957,
"repo_name": "jriguera/bosh-ironic-cpi-release",
"id": "412becff0eb448c77c47ecffeccdd8f20e31f0da"... |
"""
@copyright Copyright (c) 2013 Submit Consulting
@author Angel Sullon (@asullom)
@package utils
Descripcion: Clases para controlar la seguridad de la información en la nube
"""
#from apps.utils.messages import Message
from django.utils.translation import ugettext as _, ungettext
from django.contrib impo... | {
"content_hash": "4e4ff899348dc91f3dc1d6f890514853",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 110,
"avg_line_length": 31.254641909814325,
"alnum_prop": 0.5833828396842909,
"repo_name": "tiposaurio/venton",
"id": "576376c66d842ae0ba32c1590f67f2a8675e7c2c",
"size": "... |
import zmq
import sys
import argparse
from datetime import datetime
def get_arguments():
ap = argparse.ArgumentParser(description="ZMQ Proxy tool")
def common_arguments(ap):
ap.add_argument(
"--front-bind",
metavar="ADDR",
action="append",
help="Binds f... | {
"content_hash": "5afdaa928f61c0fe1ca6ec0f7f776497",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 88,
"avg_line_length": 28.936708860759495,
"alnum_prop": 0.586832895888014,
"repo_name": "aio-libs/aiozmq",
"id": "39db9b8bf3375bbdd63d9c141049137983af5c34",
"size": "4572... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.