text stringlengths 4 1.02M | meta dict |
|---|---|
"""Test multiple RPC users."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import str_to_b64str, assert_equal
import os
import http.client
import urllib.parse
class HTTPBasicsTest (BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
def se... | {
"content_hash": "6b16335ac83e3636aa6a54628fafc20c",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 129,
"avg_line_length": 38.651006711409394,
"alnum_prop": 0.5990623372113214,
"repo_name": "brandonrobertz/namecoin-core",
"id": "ef538fdc608913638c9a59ddff501a689a47e530",
... |
try:
from urllib.parse import urlparse, urlunparse
except ImportError: # pragma: no cover
# Python 2 fallback
from urlparse import urlparse, urlunparse # noqa
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from django.contrib.auth.tokens impo... | {
"content_hash": "933fe4a9dacba171bbae01e7a85d44da",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 84,
"avg_line_length": 33.52857142857143,
"alnum_prop": 0.6574350234341713,
"repo_name": "ulule/django-safety",
"id": "6197a54a69e855474a2ec76b3453ef7f59de8e52",
"size": "2... |
import re
from warnings import warn
from compressor.exceptions import UncompressableFileError
from django.apps import AppConfig
from django.conf import settings
from django.template import Template, Context
class DezedeConfig(AppConfig):
name = 'dezede'
verbose_name = 'Dezède'
def ready(self):
#... | {
"content_hash": "984756af7a924da132510418d81a1afb",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 71,
"avg_line_length": 34.148148148148145,
"alnum_prop": 0.5921908893709328,
"repo_name": "dezede/dezede",
"id": "bc61c9921c9b55fef868ef3a430effda8506b08a",
"size": "923",
... |
from django.core.management.base import BaseCommand
from pytz import timezone
from dojo.models import Finding
from dojo.utils import update_issue, get_system_setting
locale = timezone(get_system_setting('time_zone'))
"""
Author: Aaron Weaver
This script will locate open, active findings and update them in Jira. Usef... | {
"content_hash": "3c76a10b2720769d67b538ab407086a7",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 121,
"avg_line_length": 31,
"alnum_prop": 0.6923076923076923,
"repo_name": "OWASP/django-DefectDojo",
"id": "91cc894a2a94c0d770d42b9bc51c7ba1f71fed5f",
"size": "806",
"bi... |
import datetime
import json
from celery.execute import send_task
from django.conf import settings
from django.db import models
from humfrey.sparql.models import Store
from humfrey.update.models import UpdateDefinition
INDEX_STATUS_CHOICES = (
('idle', 'Idle'),
('queued', 'Queued'),
('active', 'Active'),
... | {
"content_hash": "060b227fdda29766a4f6442d2e62f226",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 90,
"avg_line_length": 32.24175824175824,
"alnum_prop": 0.6414451261077028,
"repo_name": "ox-it/humfrey",
"id": "dd5309b30cfd65938e52dd40c98753050691ea9e",
"size": "2934",
... |
"""
The core of grab package: the Grab class.
"""
from __future__ import absolute_import
import logging
import os
#import urllib
from random import randint, choice
from copy import copy
import threading
import itertools
import collections
try:
from urlparse import urljoin
except ImportError:
from urllib.parse i... | {
"content_hash": "a01d5ff7391604aa8a2593d2064d7ea0",
"timestamp": "",
"source": "github",
"line_count": 791,
"max_line_length": 141,
"avg_line_length": 32.07458912768647,
"alnum_prop": 0.5614678175870088,
"repo_name": "boooka/GeoPowerOff",
"id": "984d02bc201fda7be5ccbfc42411ed9a8908f040",
"size": "... |
class While:
def __init__(self, condition, body):
self.condition = condition
self.body = body
def eval(self, env):
while self.condition.eval(env):
self.body.eval(env)
def __repr__(self):
return "While: {0} {1}".format(self.condition, self.bod... | {
"content_hash": "8c6421c03508e14927015a629f6b279c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 65,
"avg_line_length": 29.363636363636363,
"alnum_prop": 0.5356037151702786,
"repo_name": "henrik645/rpp",
"id": "e4b2b1573fb10e95019f564cf5b63b1a2190bc52",
"size": "323",
... |
import unittest
from httmock import HTTMock
from myria.connection import MyriaConnection
from myria.test.mock import *
from myria.udf import MyriaFunction, MyriaPostgresFunction, myria_function
from raco.backends.myria.connection import FunctionTypes
from raco.myrial.parser import Parser
class TestUDF(unittest.TestC... | {
"content_hash": "9f075a501aa6527b4d8a0d318d35b8c3",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 79,
"avg_line_length": 40.22727272727273,
"alnum_prop": 0.5966101694915255,
"repo_name": "uwescience/myria-python",
"id": "bd6b8fa87708237f95ad354053664855848c915e",
"size... |
from scipy.io.mmio import mmwrite
__author__ = 'hfriedrich'
import logging
import codecs
import sys
import numpy as np
from scipy.io import mmread
from scipy.sparse import csr_matrix, lil_matrix, tril, coo_matrix
from scipy.spatial.distance import pdist
from scipy.spatial.distance import squareform
from extrescal.ext... | {
"content_hash": "0b5971d0ce0d7b00c737acdaae8dbcb9",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 156,
"avg_line_length": 40.78767123287671,
"alnum_prop": 0.6502099076406381,
"repo_name": "researchstudio-sat/webofneeds",
"id": "ad39ac484fecdd55199103272b74b40ad632422f",
... |
from django import forms
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db.models import ObjectDoesNotExist
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.template import RequestContext
from django.utils.translation import uge... | {
"content_hash": "01f6abfa23cd217e21740b1882c768bd",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 85,
"avg_line_length": 30.75609756097561,
"alnum_prop": 0.6954797779540047,
"repo_name": "miraculixx/plata-restapi",
"id": "21b293fb8f72c425ba66421baaa461365b0fcb82",
"size... |
from encdec import RNNEncoderDecoder
from encdec import get_batch_iterator
from encdec import parse_input
from encdec import create_padded_batch
from state import\
prototype_state,\
prototype_phrase_state,\
prototype_encdec_state,\
prototype_search_state,\
prototype_search_with_coverage_state
| {
"content_hash": "fbb72e5b688287e422ca47c28604ae6a",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 28.636363636363637,
"alnum_prop": 0.7777777777777778,
"repo_name": "tuzhaopeng/NMT-Coverage",
"id": "3dfd8b7a9a534e78d7a9a1413339131638d072c5",
"size... |
import os
import shlex
import sys
from resources.lib.utils.kodipathtools import translatepath
def process_cmdline(cmd):
posspaths = []
cmds = cmd.encode('utf-8')
partss = shlex.split(cmds, posix= not sys.platform.lower().startswith('win'))
parts = []
for part in partss:
parts.append(unicode... | {
"content_hash": "7f444e92fc478f0a5cec277962356ef2",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 126,
"avg_line_length": 33.88732394366197,
"alnum_prop": 0.5170407315045719,
"repo_name": "TidalPaladin/Superliminal-resin",
"id": "eb43370e37820a67c1cb1ce5431329507958cf15",... |
from __future__ import absolute_import
import re
import os
import random
from hashlib import sha256
from twisted.web import client, http_headers
from ooni.utils.net import hasRawSocketPermission
client._HTTP11ClientFactory.noisy = False
from twisted.internet import reactor, defer
from ooni.utils import log
from oo... | {
"content_hash": "14ff44d68cc00dadba85faff81373cb2",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 120,
"avg_line_length": 30.71851851851852,
"alnum_prop": 0.5853629129491198,
"repo_name": "0xPoly/ooni-probe",
"id": "11800b6d840ac95d81735fcf295956a16a227904",
"size": "8... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "f4d5bbb8e71b6221e5b6fe5097a90956",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 98,
"avg_line_length": 42.528301886792455,
"alnum_prop": 0.6827861579414375,
"repo_name": "arenadata/ambari",
"id": "b2cdc42ce5a3354cdd34728da1edabb8a2441b74",
"size": "227... |
"""
FISSPy' Analysis module provides various tools for data analysis.
"""
from __future__ import absolute_import
__author__ = "Juhyung Kang"
__email__ = "[email protected]"
from fisspy.analysis.tdmap import TDmap
from fisspy.analysis.wavelet import *
from fisspy.analysis.doppler import *
from fisspy.analysis.fo... | {
"content_hash": "185f442deb30a45510bfa51e8c3d4cc2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 65,
"avg_line_length": 25.846153846153847,
"alnum_prop": 0.7529761904761905,
"repo_name": "SNU-sunday/fisspy",
"id": "678df2c528a3f831042f11776476b7a92fcd078f",
"size": "33... |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.ya... | {
"content_hash": "2af0588370cf9462dcce230a5a8fa3a9",
"timestamp": "",
"source": "github",
"line_count": 557,
"max_line_length": 505,
"avg_line_length": 41.52423698384201,
"alnum_prop": 0.5733927104500843,
"repo_name": "napalm-automation/napalm-yang",
"id": "420241d5fbebd6344d9c81327d098f8037839cd0",
... |
import argparse
import re
import subprocess
import sys
import os
from enum import Enum
import time
import urllib.request, urllib.error, urllib.parse
import urllib.parse
class Version(object):
def __init__(self, major, minor, bugfix, prerelease):
self.major = major
self.minor = minor
self.bugfix = bugfix
... | {
"content_hash": "f1dc94aaabec84cd68e036da74959688",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 116,
"avg_line_length": 32.565714285714286,
"alnum_prop": 0.6323916476574838,
"repo_name": "apache/solr-operator",
"id": "c453dabb8e98780422e10b6bef28d78fcff5aacd",
"size"... |
import _plotly_utils.basevalidators
class TextsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="textsrc", parent_name="scattersmith", **kwargs):
super(TextsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "75cee921584d0bb8b56e0a8ba348db97",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 84,
"avg_line_length": 36.27272727272727,
"alnum_prop": 0.6240601503759399,
"repo_name": "plotly/plotly.py",
"id": "2ce9eacdffe562b939b4733e23eb759cbcabd0f1",
"size": "399"... |
import inspect
import os
import unittest
from django.test.runner import DebugSQLTextTestResult, DiscoverRunner
class SensibleTextTestResult(unittest.TextTestResult):
def get_vi_command(self, test):
code_object = inspect.unwrap(getattr(test, test._testMethodName)).__code__
return 'vi +{} {}'.forma... | {
"content_hash": "8f44d91243440f0282a4336a64c96312",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 121,
"avg_line_length": 36.56410256410256,
"alnum_prop": 0.638148667601683,
"repo_name": "rapilabs/sensible-text-test-runner",
"id": "56f6b5c5de33b0954c4b25844e2f7222a403680a... |
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request, 'stateMap.html') | {
"content_hash": "00357f0fec9e9f2f2dcf12484e4d2e79",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 43,
"avg_line_length": 25.2,
"alnum_prop": 0.7619047619047619,
"repo_name": "SavenR/Map_-_Energy_Production",
"id": "ab71de823dbe06077687566d7ef0e1c40d398cbf",
"size": "126"... |
"""
Simple flask-based API to access FreeLing functionalities.
"""
__author__ = "Víctor Peinado"
__email__ = "[email protected]"
__date__ = "26/06/2013"
import freeling
from flask import Flask, Response, request
from flask.ext.restful import Api, Resource
import json
# ##############################################... | {
"content_hash": "ce5adb5b3df0799bc2819d346dc6c3d2",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 157,
"avg_line_length": 33.3646288209607,
"alnum_prop": 0.5241149139454224,
"repo_name": "vitojph/flws",
"id": "dfc78a18ecabac75198f2462a26b8bcb35decde7",
"size": "15329",... |
import datetime
class Signature(object):
"""
Returns ChatterBot's signature.
"""
def __init__(self, name):
self.name = name
self.time = self.create_timestamp()
def create_timestamp(self, fmt="%Y-%m-%d-%H-%M-%S"):
"""
Returns a string formatted timestamp of the cur... | {
"content_hash": "546a00bf5505d694fb682b8d9f3b3c20",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 65,
"avg_line_length": 21.92,
"alnum_prop": 0.5693430656934306,
"repo_name": "imminent-tuba/thesis",
"id": "044767e53d0c65286aaab94f098e10ab11f968e3",
"size": "548",
"bin... |
from typing import Any, TYPE_CHECKING
if TYPE_CHECKING:
from boxsdk import NetworkResponse
class BoxResponse:
"""Represents a response to a Box API request."""
def __init__(self, network_response):
self._network_response = network_response
def json(self) -> Any:
"""
Return t... | {
"content_hash": "967bfd3f60b5216a9e1009061efe5e6b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 57,
"avg_line_length": 24.232142857142858,
"alnum_prop": 0.58069270449521,
"repo_name": "box/box-python-sdk",
"id": "9b9e83dfa5f8384f28eecacf1c0cbfd3d80222d3",
"size": "135... |
from collections import OrderedDict
from gluon import current, URL
from gluon.storage import Storage
def config(settings):
"""
SHARE settings for Sri Lanka
@ToDo: Setting for single set of Sectors / Sector Leads Nationally
"""
T = current.T
# PrePopulate data
settings.base.prepo... | {
"content_hash": "431d91987aafa60361a284d3cb1ab961",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 88,
"avg_line_length": 43.53465346534654,
"alnum_prop": 0.2974755515123948,
"repo_name": "flavour/eden",
"id": "73bed3949836015bea0a712908fe42ad2a1281c5",
"size": "4422",
... |
from json import loads
from tenable_io.api.base import BaseApi
from tenable_io.api.base import BaseRequest
from tenable_io.api.models import AccessGroup, AccessGroupList, AssetRule, AssetRuleFilter, AssetRulePrincipal, Filters
class AccessGroupsApi(BaseApi):
def list(self, f=None, ft='and', w=None, wf=None, lim... | {
"content_hash": "86f3cdaedb6d18687e8092e9644764ea",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 120,
"avg_line_length": 50.94,
"alnum_prop": 0.6441565240151813,
"repo_name": "tenable/Tenable.io-SDK-for-Python",
"id": "bf989a614a0e93f0b5f6ac389d4dc632fe667c21",
"size"... |
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class VasSubscribeGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.article_code = None
self.nick = None
def getapiname(self):
return 'taobao.vas.s... | {
"content_hash": "31e5a0c1da6b91945b24f6fbf9efd81f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 55,
"avg_line_length": 27.916666666666668,
"alnum_prop": 0.6865671641791045,
"repo_name": "CooperLuan/devops.notes",
"id": "07d6ddb609814f3f5d407342ff2d9b7e0dbbd548",
"size... |
import os
import json
import itertools
# experimenting with dierent popups
def make_rows(headers):
varblock=[]
# makes a list of rows from a given input header
for row in headers:
newrow='\t\t\t\t + "<br>%s:" + feature.properties.place' % (row)
varblock.append(newrow)
return varblock
# the function actually... | {
"content_hash": "39596411f4d93d63e1d385bdd96f6769",
"timestamp": "",
"source": "github",
"line_count": 484,
"max_line_length": 203,
"avg_line_length": 28.47107438016529,
"alnum_prop": 0.6654571843251088,
"repo_name": "murphy214/berrl",
"id": "c3dd95f568a2fbebbc094c88b52becd409549b22",
"size": "137... |
from django.core.management.base import BaseCommand, CommandError
import __future__
from ModelTracker.models import History
import datetime
from django.apps import apps
def getModel(table_name):
return next((m for m in apps.get_models() if m._meta.db_table==table_name), None)
class Command(BaseCommand):
help =... | {
"content_hash": "5573806d4d9d31363a586dfb417c00ef",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 116,
"avg_line_length": 38.47826086956522,
"alnum_prop": 0.5689265536723164,
"repo_name": "mkalioby/ModelTracker",
"id": "1d7c11fbf09ffcd73700a97499b637e77475199a",
"size":... |
"""
3D visualization of activation maps using Mayavi
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# License: BSD
# Standard library imports
import os
# Standard scientific libraries imports (more specific imports are
# delayed, so that the part module can be used without them).
import num... | {
"content_hash": "2494a61493402658eedd098450501e6d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 80,
"avg_line_length": 31.103896103896105,
"alnum_prop": 0.5235908141962422,
"repo_name": "yarikoptic/NiPy-OLD",
"id": "7e253d5f0a29762f2ce61f0674e6c51c375ae1ef",
"size": "... |
import os
import inspect
class Environment(object):
"""
A class representing which environment the client library is using.
Pass in one of the following values as the first argument to
:class:`braintree.Configuration.configure() <braintree.configuration.Configuration>` ::
braintree.Environment... | {
"content_hash": "84cdfe59e8cb577eb991540a79b936ab",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 153,
"avg_line_length": 33.76190476190476,
"alnum_prop": 0.6720733427362482,
"repo_name": "eldarion/braintree_python",
"id": "2f8bcdc27bfee4da440c85b7384aa7f28e08dc1f",
"si... |
import fresh_tomatoes
import media
# Initializing Movie Data
shutter_island = media.Movie("Shutter Island",
"In 1954, a U.S. marshal investigates the \
disappearance of a murderess who escaped from \
a hospital for the crim... | {
"content_hash": "ff409ee1d9a92de3d8a0f357485f9eae",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 172,
"avg_line_length": 60.90384615384615,
"alnum_prop": 0.577202399747395,
"repo_name": "danaguinaldo/Movie-Trailer-Project",
"id": "4310fe3950fac707b26dc735f00e079ebd3f9ba2... |
import os
from werkzeug.utils import import_string
from flask import current_app
from flask.cli import with_appcontext
import click
from .tests import register_test_helpers
def create_shell_context(*paths):
result = {}
for path in paths:
if '.' in path:
name = path.split('.')[-1]
... | {
"content_hash": "049607f1e9562f5493684e62947d8f35",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 86,
"avg_line_length": 30.767123287671232,
"alnum_prop": 0.6024042742653607,
"repo_name": "vgavro/flask-vgavro-utils",
"id": "7158bc32fde75e5a17bbc5dd36335bdfa1814529",
"si... |
import os
import sys
import site
lib_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../lib/python2.4/site-packages'))
path = site.addsitedir(lib_path, set())
if path:
sys.path = list(path) + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = "django_de.settings"
from django.core.management import ca... | {
"content_hash": "c52f7d46cababeb2556531701fcf1798",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 147,
"avg_line_length": 32.48148148148148,
"alnum_prop": 0.6499429874572406,
"repo_name": "django-de/django-de-v2",
"id": "ab9bd842e718743a3e13dc1f560efb7713412869",
"size"... |
import glob
import os
import sys
from euca2ools.commands.eustore.installimage import *
class InstallUnpackedImage(InstallImage):
def get_tarball(self, workdir):
return None
def bundle_and_register_all(self, dir, tarfile):
names = glob.glob(os.path.join(dir, '*'))
kernel_id = None
... | {
"content_hash": "9a5e7ccb736f6e920f543af95bcf2383",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 40.79245283018868,
"alnum_prop": 0.5698427382053654,
"repo_name": "eucalyptus/silvereye",
"id": "8db2498ed0bfefc8800c3bcc88f47c84637f6e4f",
"size": "... |
import requests
import time
def action(**kwargs):
''' This method is called to action a reaction '''
redata = kwargs['redata']
jdata = kwargs['jdata']
logger = kwargs['logger']
run = True
# Check for Trigger
if redata['trigger'] > jdata['failcount']:
run = False
# Check for las... | {
"content_hash": "b8ed978998a861ba40ece70aa6a86030",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 106,
"avg_line_length": 28.761904761904763,
"alnum_prop": 0.5927152317880795,
"repo_name": "madflojo/cloudroutes-service",
"id": "e81683311cfeee17eff674e0bdfb6380d7d32fe0",
... |
import _plotly_utils.basevalidators
class TickangleValidator(_plotly_utils.basevalidators.AngleValidator):
def __init__(
self,
plotly_name="tickangle",
parent_name="scatterpolargl.marker.colorbar",
**kwargs,
):
super(TickangleValidator, self).__init__(
plotl... | {
"content_hash": "f866e118b0710613bfbfaf52b4bbec20",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 70,
"avg_line_length": 29,
"alnum_prop": 0.5883620689655172,
"repo_name": "plotly/plotly.py",
"id": "32d32209d7522af61ff45870ba48ebf6f4d7f256",
"size": "464",
"binary": f... |
def is_palindrome(n):
return str(n) == str(n)[::-1]
def is_lychrel_number(n, iteration=0):
if iteration >= 50:
return False
n += int(str(n)[::-1])
if is_palindrome(n):
return True
else:
return is_lychrel_number(n, iteration + 1)
# Testcases
assert is_lychrel_number(47), "T... | {
"content_hash": "304c67c6410939a4f60202b94e93e92c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 52,
"avg_line_length": 23.16,
"alnum_prop": 0.6373056994818653,
"repo_name": "fbcom/project-euler",
"id": "5edabeec76670df9b4c2dc11f9eac936bf11174b",
"size": "828",
"bina... |
import bz2
import gzip
from .basefile import BaseFile
class CompressedFile(BaseFile):
"""
The **CompressedFile** :py:class:`pynion.Multiton` is a file management object
created directly through the py:class:`pynion.File` factory.
Extends :py:class:`pynion.filesystem._filetypes.BaseFile`
It spec... | {
"content_hash": "711b1638f14c701c15d9c9180e53a2c5",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 82,
"avg_line_length": 24.584615384615386,
"alnum_prop": 0.5381727158948686,
"repo_name": "sadeghiafshin/rgCrawler",
"id": "14b78dc9849059d2279e5d181c7d1f896ff0d091",
"size... |
"""Exceptions defined within cellpy"""
class Error(Exception):
"""Base class for other exceptions"""
pass
class ConfigFileNotWritten(Error):
"""Raised when the configuration file cannot be written"""
pass
class ConfigFileNotRead(Error):
"""Raised when the configuration file cannot be read"""... | {
"content_hash": "4442f5c27c9596fc3a9e5d7436e42174",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 98,
"avg_line_length": 17.060606060606062,
"alnum_prop": 0.6802841918294849,
"repo_name": "jepegit/cellpy",
"id": "8a02aa5263acd8fed70f065fa571fd01afa816ec",
"size": "1126"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('browser', '0028_remove_compare_job_id'),
]
operations = [
migrations.AlterField(
model_name='compare',
name='year_range',
... | {
"content_hash": "218ebaefc570ac4d9bbb29ffe62a0e75",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 50,
"avg_line_length": 24.08695652173913,
"alnum_prop": 0.575812274368231,
"repo_name": "MRCIEU/melodi",
"id": "2148d6286fb69eec1852f4289e2f5dc38b98e936",
"size": "578",
... |
from decimal import Decimal as D
from django.conf import settings
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from oscar.core.loading import get_class, get_model
from . import exceptions
Order = get_model('order', 'Order')
Line = get_model('order', 'Line')
Or... | {
"content_hash": "9ab5da3615cf53294f964f610325ac92",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 79,
"avg_line_length": 38.406716417910445,
"alnum_prop": 0.5840862722238415,
"repo_name": "michaelkuty/django-oscar",
"id": "3c874f0eac02ff39bfa694053bf295ba07124da5",
"si... |
import sklearn.datasets
import numpy as np
from action.linear.perceptron import Perceptron
from action.linear.adalineGD import AdalineGD
import pandas as pd
iris = sklearn.datasets.load_iris()
X = iris.data
y = iris.target
df1 = pd.DataFrame(X)
df2 = pd.DataFrame(y)
df = pd.concat([df1, df2], axis=1)
size = X.shape[0]... | {
"content_hash": "ef7aa1e1059faaea248b793a50cec82b",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 71,
"avg_line_length": 24.823529411764707,
"alnum_prop": 0.6670616113744076,
"repo_name": "jt120/start-ml",
"id": "22915a2998c73d1ef55319d56f77961f31780686",
"size": "865",... |
"""
.. module:: zeroMQInterface
:synopsis: Wraps ZeroMQ library with a simplified publish/subscribe
interface. The serialize data protocol is MessagePack. The python
dictionary is used as a standardized format. The subscribe gets the
contents of messages, but also the publisher address and the topi... | {
"content_hash": "f7276e6d775c2c7f7a8f4f061b29c2cf",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 125,
"avg_line_length": 37.16438356164384,
"alnum_prop": 0.6343531146332473,
"repo_name": "ianwcarlson/python-zeromq-pubsub",
"id": "08d5dd714c0641cf44b22ed09faa01b0643dbccf... |
import math
import operator
class LOF2D:
def __init__(self, points):
# points = [
# [x, y],
# [x, y]
# ]
self.data = points
self.neighbours = {}
self.outliers = []
self.k_distances = {}
self.lrd = {}
self.reach_distance_sum = {}
self.lof = {}
self.sorted_lof = []
def crea... | {
"content_hash": "9d84a25ac68544f65ffbee37652f4025",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 139,
"avg_line_length": 25.50261780104712,
"alnum_prop": 0.6534592486142475,
"repo_name": "mnmnc/campephilus",
"id": "f9d5da3236f48482c47075b5d97cfa8209eab31e",
"size": "4... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _
from datetime import date
GENDER_CHOICES = (
('u', _('undefined')),
('M', _('Male')),
('F', _('Female')),
)
LOOKFOR_CHOICES = (
('a', _('any')),
('M', _('Man')),
('... | {
"content_hash": "68897b31f9d8988eff6eba6bfda943e2",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 75,
"avg_line_length": 24.51824817518248,
"alnum_prop": 0.5829115808276273,
"repo_name": "aneumeier/userprofile",
"id": "41236063286368b9206b7937d863cdc060a5b40e",
"size":... |
"""add geom column to pol shop table
Revision ID: 539cf8248905
Revises: 3fd9b2d19fb9
Create Date: 2015-12-06 15:48:43.979639
"""
# revision identifiers, used by Alembic.
revision = '539cf8248905'
down_revision = '3fd9b2d19fb9'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
d... | {
"content_hash": "c6f453b18b13e1bf0f01762cae3e02aa",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 99,
"avg_line_length": 20.82758620689655,
"alnum_prop": 0.7135761589403974,
"repo_name": "atlefren/beerdatabase",
"id": "dd1e85658ff582062da463e5cb36eff43f131a49",
"size": ... |
"""
Class that permits log messages to be sent back to the REST API by other Resources
"""
import json
import logging
from flask import request
from flask_restful import Resource
class RequestLogger(Resource):
"""
RequestLogger Resource class for flask_restful
"""
def __init__(self):
self.logg... | {
"content_hash": "ef1b5e1d1b408bed2325ce02d07f29f1",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 82,
"avg_line_length": 33.06060606060606,
"alnum_prop": 0.5921173235563703,
"repo_name": "untergeek/es_stats_zabbix",
"id": "2b6565e9f9dfd98fd0cbc91b0c3f0d6044ca7fc8",
"siz... |
"""Test the quantum amplitude estimation algorithm."""
import unittest
from test.python.algorithms import QiskitAlgorithmsTestCase
import numpy as np
from ddt import ddt, idata, data, unpack
from qiskit import QuantumRegister, QuantumCircuit, BasicAer
from qiskit.circuit.library import QFT, GroverOperator
from qiskit.... | {
"content_hash": "4fe6e8235e1de92346eefc755471f4c6",
"timestamp": "",
"source": "github",
"line_count": 669,
"max_line_length": 100,
"avg_line_length": 37.38714499252616,
"alnum_prop": 0.5820806013113705,
"repo_name": "QISKit/qiskit-sdk-py",
"id": "8360ff4fdd9137098a838ceb23bfa986e27a6912",
"size":... |
from base64 import b64decode, b64encode
from PIL import Image
from io import BytesIO
from os import stat
from IPython.nbformat import read, write
def compress(filename, output_filename=None, img_width=2048, img_format='png'):
"""Compress images in IPython notebooks.
Parameters
----------
filename : s... | {
"content_hash": "3608efc5adb12e2934340f4ba0548bc8",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 89,
"avg_line_length": 33.527027027027025,
"alnum_prop": 0.5783958081418783,
"repo_name": "arve0/ipynbcompress",
"id": "f484ef031b3c034c588cb8a1e4317bd1d9bb6275",
"size": "... |
"""
Utilities for local system calls, everything here is cross-platform.
become_daemon was originally taken from Django:
https://github.com/django/django/commit/5836a5771f2aefca83349b111f4191d6485af1d5#diff-f7d80be2ccf77f4f009d08dcac4b7736
We might want to refactor this into:
system/__init__.py
system/posix.py
syste... | {
"content_hash": "ff155ae59501a01b9e32c589eaa2e088",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 118,
"avg_line_length": 29.067924528301887,
"alnum_prop": 0.636764896793457,
"repo_name": "mrpau/kolibri",
"id": "324c44da47e8d8e70ee99a0f8e6f51c34ad745e5",
"size": "7703"... |
__version__ = '0.0.1'
__author__ = 'Cashiuus'
__license__ = 'MIT'
__copyright__ = 'Copyright (C) 2022 Cashiuus'
## =======[ IMPORTS ]========= ##
import argparse
import errno
import logging
from logging import handlers
import os
import platform
import subprocess
import sys
from pathlib import Path
from random import ra... | {
"content_hash": "7ed8fe7074e8b54fe5294a399d0a9a2a",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 122,
"avg_line_length": 30.716763005780347,
"alnum_prop": 0.5761196838539706,
"repo_name": "Cashiuus/penprep",
"id": "ad7b0c21fcc17b55ae446b0aed72ba0a27c458f5",
"size": "1... |
import subprocess
# Use GenerateEncryptedString() locally - DO NOT include in the script!
# The 'Encrypted String' will become a parameter for the script in the JSS
# The unique 'Salt' and 'Passphrase' values will be present in your script
def GenerateEncryptedString(inputString):
'''Usage >>> GenerateEncryptedSt... | {
"content_hash": "e5cc2e51e0e895dc0894a295a4df2c51",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 177,
"avg_line_length": 61.75,
"alnum_prop": 0.664545980335454,
"repo_name": "brysontyrrell/EncryptedStrings",
"id": "8b914b11a790fa75b61b81868ce0dc989454bdb2",
"size": "19... |
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 model 'Party'
db.create_table('distribution_party', (
('id', self.gf('django.db.models.fields.AutoField... | {
"content_hash": "3bb02ad3930f05bf9e16afd188abc97c",
"timestamp": "",
"source": "github",
"line_count": 834,
"max_line_length": 201,
"avg_line_length": 78.02997601918466,
"alnum_prop": 0.6078645297109578,
"repo_name": "bhaugen/nova",
"id": "092d529841eb20b31eff70cebda0c0d9a3dfe49a",
"size": "65095"... |
# GOAL: parse the DocLegalDescription to extract the physical address of the associated property
# CHALLENGES:
# 1.) inconsistent format of text in the field
# 2.) not all entries have a physical address listed..
# Last Name Conventions: ETAL, LLC, LLC ETAL, MORTGAGE COMPANY, DECEASED, ESTATE
... | {
"content_hash": "5e849342ebde9a22cca38fb3cdd0908b",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 144,
"avg_line_length": 43.40243902439025,
"alnum_prop": 0.6254565889294745,
"repo_name": "CamFlawless/python_projects",
"id": "7049a1819bf983929fe162d698d62e51fd996ba3",
"... |
import pymel.core as pm
import logging
log = logging.getLogger("ui")
class BaseTemplate(pm.ui.AETemplate):
def addControl(self, control, label=None, **kwargs):
pm.ui.AETemplate.addControl(self, control, label=label, **kwargs)
def beginLayout(self, name, collapse=True):
pm.ui.AETe... | {
"content_hash": "257d839af47f9e291fbcc3e2400ee5e8",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 77,
"avg_line_length": 38.755102040816325,
"alnum_prop": 0.6608741442864665,
"repo_name": "haggi/OpenMaya",
"id": "8452d5f52e6919936d17de77f648ef1642959b46",
"size": "1899"... |
from __future__ import absolute_import
import responses
import six
from six.moves.urllib.parse import parse_qs, urlencode, urlparse
from sentry.integrations.slack import SlackIntegration
from sentry.models import (
Identity, IdentityProvider, IdentityStatus, Integration,
OrganizationIntegration, UserIdentity... | {
"content_hash": "4a4949d6d96d0423e62c4595f3685bae",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 90,
"avg_line_length": 37.1747572815534,
"alnum_prop": 0.5863149647427527,
"repo_name": "gencer/sentry",
"id": "a2a11ff3ddeb3b326cba2a8ed622dc435534c603",
"size": "3829",
... |
"""Output formatters values only
"""
import six
from . import base
from cliff import columns
class ValueFormatter(base.ListFormatter, base.SingleFormatter):
def add_argument_group(self, parser):
pass
def emit_list(self, column_names, data, stdout, parsed_args):
for row in data:
... | {
"content_hash": "6aeea1e5fa686cb678067d6b779ff38a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 77,
"avg_line_length": 28.0625,
"alnum_prop": 0.5311804008908686,
"repo_name": "dtroyer/cliff",
"id": "24125c0e33dba7cf64c7c56beb729180467a0555",
"size": "1453",
"binary"... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/space/chassis/shared_texture_kit_s06.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "b463ccb9f121046da464dd260d7f6eb6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 84,
"avg_line_length": 24.076923076923077,
"alnum_prop": 0.6964856230031949,
"repo_name": "anhstudios/swganh",
"id": "f4c363bcfac15ba8fd1069f3b490658902ceacaa",
"size": "45... |
from cuttlebug.ui.controls import ListControl
import view
import wx
import cuttlebug.settings as settings
import cuttlebug.app as app
import cuttlebug.gdb as gdb
def tabify(s):
TAB_STOP = 5
retval = []
for c in s:
if c != '\t':
retval.append(c)
else:
... | {
"content_hash": "987cad437354cf39d06b959b6854f1f3",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 118,
"avg_line_length": 35.67045454545455,
"alnum_prop": 0.5798024848677923,
"repo_name": "ryansturmer/cuttlebug",
"id": "aba5105d24b763fb0b7be063642e506a827b0bfe",
"size":... |
from model.parameters import Group
import random
def test_delete_some_group(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create_new_group(Group(name="test"))
old_groups = db.get_group_list()
group = random.choice(old_groups)
app.group.delete_group_by_id(group.id)
new_gr... | {
"content_hash": "577e8a631b1679dca4ac1078a27387bd",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 113,
"avg_line_length": 31.88235294117647,
"alnum_prop": 0.6697416974169742,
"repo_name": "OlgaLa/task_1",
"id": "f53ae15106207be68dde8c5f481f650a1076ab1e",
"size": "542",
... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
class TestOnlyNew(object):
config = """
tasks:
test:
mock:
- {title: 'title 1', url: 'http://localhost/title1'}
onl... | {
"content_hash": "6afe704ff0da6bb183a7172233f7eca8",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 119,
"avg_line_length": 47.75757575757576,
"alnum_prop": 0.633248730964467,
"repo_name": "qvazzler/Flexget",
"id": "3eda24881e3e799bec3af1ffdefdd87dab154529",
"size": "1576... |
from skygrid.device import Device
from skygrid.project import Project
from skygrid.schema import Schema
from skygrid.subscription_manager import SubscriptionManager
from skygrid.user import User | {
"content_hash": "e3911e6a837b7232ebc61157f5002575",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 60,
"avg_line_length": 38.8,
"alnum_prop": 0.8711340206185567,
"repo_name": "skygridio/skygrid-sdk-python",
"id": "174134663be1bb9aa3d2dda85d447ac9443f4472",
"size": "194",
... |
"""configure script to get build parameters from user."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import errno
import os
import platform
import re
import subprocess
import sys
# pylint: disable=g-import-not-at-top
try:
from shutil import which
ex... | {
"content_hash": "ee415908ed580c1fe395a99bebd3e919",
"timestamp": "",
"source": "github",
"line_count": 1323,
"max_line_length": 80,
"avg_line_length": 35.99470899470899,
"alnum_prop": 0.6409567207744482,
"repo_name": "jwlawson/tensorflow",
"id": "cf16ef483763733cc12c838ea92b144c6493f0b1",
"size": ... |
try:
from unittest2 import TestCase # Python2.6
except ImportError:
from unittest import TestCase
import transaction
from webob.multidict import MultiDict
from pyramid import testing
from pyramid.httpexceptions import HTTPFound
# from pyramid.authorization import ACLAuthorizationPolicy
from mock import patc... | {
"content_hash": "68232de2f63251317ea654f8c887978d",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 78,
"avg_line_length": 27.504587155963304,
"alnum_prop": 0.6350900600400267,
"repo_name": "sayoun/pyvac",
"id": "0c75e3850c4fdecb8fba31800a8c1a1ec26a7b7b",
"size": "3000",... |
import json
# SBaaS
from .stage03_quantification_dG_f_query import stage03_quantification_dG_f_query
from SBaaS_base.sbaas_template_io import sbaas_template_io
# Resources
from io_utilities.base_importData import base_importData
from io_utilities.base_exportData import base_exportData
class stage03_quantification_dG_f... | {
"content_hash": "218a83b4e281ccdcdd97defa4ce86cc7",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 90,
"avg_line_length": 35.58139534883721,
"alnum_prop": 0.6679738562091503,
"repo_name": "dmccloskey/SBaaS_thermodynamics",
"id": "28d54aa76abcc81fe8b371623950287329ab1ce6",
... |
"""A module to produce a model validation plot
It uses one external program:
map_align for contact map alignment
*** This program needs to be installed separately from https://github.com/sokrypton/map_align***
"""
from __future__ import division
from __future__ import print_function
import os
from Bio.PDB.DSSP ... | {
"content_hash": "fb3deecbc3a5ca3afe33473324d417a1",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 120,
"avg_line_length": 43.46666666666667,
"alnum_prop": 0.6291829336307864,
"repo_name": "rigdenlab/conkit",
"id": "a70bec98c0555d81a1ea7743bdc61aeda6ad4000",
"size": "15... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import sentry.db.models.fields.bounded
import sentry.db.models.fields.foreignkey
class Migration(migrations.Migration):
# This flag is used to mark that a migration shoul... | {
"content_hash": "e39cf7362b73ff08159137eee6f458f4",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 170,
"avg_line_length": 46.58181818181818,
"alnum_prop": 0.6814988290398126,
"repo_name": "beeftornado/sentry",
"id": "3bdbd42e648d373a6404616dd6af8a9e6e1f9bba",
"size": "2... |
from google.cloud import apigee_registry_v1
def sample_delete_instance():
# Create a client
client = apigee_registry_v1.ProvisioningClient()
# Initialize request argument(s)
request = apigee_registry_v1.DeleteInstanceRequest(
name="name_value",
)
# Make the request
operation = cl... | {
"content_hash": "64b7b4f8855c01e915b76654a2078239",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 24.391304347826086,
"alnum_prop": 0.7094474153297683,
"repo_name": "googleapis/python-apigee-registry",
"id": "dca1a25a5f0d813d06eb2a17ead69fa40c966e80... |
from __future__ import unicode_literals
from wtforms import Form
from wtforms import TextField
from wtforms import HiddenField
from ez2pay.i18n import LocalizerFactory
get_localizer = LocalizerFactory()
class FormFactory(object):
def __init__(self, localizer):
self.localizer = localizer
_ ... | {
"content_hash": "23dba61c4bdfdeb88113c242ea86bdab",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 67,
"avg_line_length": 27.89189189189189,
"alnum_prop": 0.5416666666666666,
"repo_name": "victorlin/ez2pay",
"id": "6e5d0c45cbc5d1fa947ae5332c574c9f05e35649",
"size": "1032... |
"""Platform-specific support for compiling/executing C sources."""
import py, os, sys
from rpython.tool.runsubprocess import run_subprocess as _run_subprocess
from rpython.tool.udir import udir
from rpython.tool.version import rpythonroot
log = py.log.Producer("platform")
class CompilationError(Exception):
def... | {
"content_hash": "81ad0dbe841a09b8def38c80230038fa",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 93,
"avg_line_length": 36.221288515406165,
"alnum_prop": 0.6001082669553786,
"repo_name": "jptomo/rpython-lang-scheme",
"id": "9b85d3d38c7f455f1dea5a57bce39ea464038d71",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dictionary', '0003_comment_author_ip'),
]
operations = [
migrations.AlterField(
model_name='wordentry',... | {
"content_hash": "7b66cefe668992cdbdc56023f39d6233",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 162,
"avg_line_length": 31.625,
"alnum_prop": 0.6376811594202898,
"repo_name": "nirvaris/nirvaris-dictionary",
"id": "b0f69ac53bddf95aff761a2540f1caddd890b17a",
"size": "82... |
__revision__ = "src/engine/SCons/CacheDirTests.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
import os.path
import shutil
import sys
import unittest
from TestCmd import TestCmd
import TestUnit
import SCons.CacheDir
built_it = None
class Action(object):
def __call__(self, targets, sources, env, *... | {
"content_hash": "8cf39332ee65de2db60e225e4684c529",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 107,
"avg_line_length": 30.99644128113879,
"alnum_prop": 0.5788748564867968,
"repo_name": "EmanueleCannizzaro/scons",
"id": "2daa1778d64a6474b84ec553d434a1cfd4ae1020",
"si... |
import copy
import hashlib
import json
import os
import re
import uuid
import xml.sax
from StringIO import StringIO
from collections import namedtuple
from datetime import datetime
from urlparse import urljoin
from xml.sax import ContentHandler
from django.conf import settings
from django.core.cache import cache
from ... | {
"content_hash": "92d02ca0e9a55ea8824eba522327fecc",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 96,
"avg_line_length": 34.27205882352941,
"alnum_prop": 0.6350032181935207,
"repo_name": "Osmose/snippets-service",
"id": "bcf602d320969e24b71f03a880defb4034a33334",
"size... |
from __future__ import unicode_literals
import frappe
from frappe import _, msgprint
from frappe.utils import flt, cint, cstr, now, get_url_to_form
from frappe.modules import load_doctype_module
from frappe.model.base_document import BaseDocument
from frappe.model.naming import set_new_name
from werkzeug.exceptions imp... | {
"content_hash": "354f63809a975c51dec67530cc8aab8a",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 108,
"avg_line_length": 29.75855855855856,
"alnum_prop": 0.6775248244126907,
"repo_name": "gangadharkadam/office_frappe",
"id": "fe385cf022bb7916261891774e596a90729b5a1c",
... |
from SCons.Script import *
from SCons.Environment import Environment
import os
import os.path as path
"""
opts_dotnet
Options for dotnet core projects
"""
def setup_vars(env, vars):
Help("""
Dotnet Core Options:
""")
# Build directory to use
dotnet_builddir = path.join(env['common_bui... | {
"content_hash": "fe306f614e67c29a8572f5557b602644",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 106,
"avg_line_length": 29.365853658536587,
"alnum_prop": 0.6744186046511628,
"repo_name": "ASoftTech/Scons-Tools-Grbd",
"id": "57aada9c8e39e23cfb0fad80346c20528aa7f76e",
"... |
from timeit import timeit, Timer
from random import randrange
for i in range(1, 1000):
list_str = "x = " + str(list(range(i)))
list_time = Timer(list_str)
del_list_time = Timer(list_str + ";del x[randrange(%d)]"%i,
"from __main__ import randrange")
dict_str = "y = " + str({j:... | {
"content_hash": "5281cd3f42412bbb94b4c4d99160a556",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 89,
"avg_line_length": 42.5,
"alnum_prop": 0.5751633986928104,
"repo_name": "jackys-95/coding-practice",
"id": "581c403d6ba864d5fd584b09484b9f194e20d6b9",
"size": "765",
... |
diagnostics=False
#################################
## Import packages ##
#################################
import sys
import os
from trackeddy.tracking import *
from trackeddy.savedata import *
from numpy import *
from pylab import *
import random
import pytest
import time
##############################... | {
"content_hash": "9e30a21b57d5e182bed57de58e0e27ba",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 107,
"avg_line_length": 23.64864864864865,
"alnum_prop": 0.6205714285714286,
"repo_name": "Josue-Martinez-Moreno/trackeddy",
"id": "e3716beb41470d1b9a9cfb4534c8000c93233839",... |
''' Copyright 2017 Vprime
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | {
"content_hash": "896bfa6219de2e5dbfb80bd91100d2d5",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 86,
"avg_line_length": 37.76315789473684,
"alnum_prop": 0.7114982578397212,
"repo_name": "gabrielschulhof/iotivity-node",
"id": "af15d53aeb06ed813513f15f139411176f60d5f0",
... |
from ..orm import Factory
class Seeder:
factory = None
def __init__(self, resolver=None):
self._command = None
self._resolver = resolver
if self.factory is None:
self.factory = Factory(resolver=resolver)
else:
self.factory.set_connection_resolver(self... | {
"content_hash": "b465ab72b9a2ed5bd73964756cb190bf",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 71,
"avg_line_length": 22.85333333333333,
"alnum_prop": 0.5530921820303384,
"repo_name": "Hanaasagi/sorator",
"id": "93dd92a692a582fb597e2655410e83cbaa357cc7",
"size": "173... |
"""The Virtual File System (VFS) file entry interface.
The file entry can be various file system elements like a regular file,
a directory or file system metadata.
"""
import abc
from dfvfs.lib import definitions
from dfvfs.lib import py2to3
from dfvfs.resolver import resolver
from dfvfs.vfs import vfs_stat
class ... | {
"content_hash": "3595ad742e4faf8599635a2c1440cd13",
"timestamp": "",
"source": "github",
"line_count": 512,
"max_line_length": 80,
"avg_line_length": 26.990234375,
"alnum_prop": 0.6533757869599827,
"repo_name": "dc3-plaso/dfvfs",
"id": "b872f1eb1cad16647088bf563aa0c736304f4d48",
"size": "13843",
... |
"""Chapter 4 Practice Questions
Answers Chapter 4 Practice Questions via Python code.
"""
def main():
# 1. What does the following piece of code print to the screen?
print(len("Hello") + len("Hello"))
# 2. What does this code print?
i = 0
while i < 3:
print("Hello")
i = i + 1
... | {
"content_hash": "811ec282567e9075aeaa910c9f4e78a5",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 72,
"avg_line_length": 19.583333333333332,
"alnum_prop": 0.5219858156028369,
"repo_name": "JoseALermaIII/python-tutorials",
"id": "32f65350ab6faef2bee43efa6d53de0d18a27e97",
... |
from django.conf.urls.defaults import *
from views import descriptor, login_begin, login_init, login_process, logout
from metadata import get_deeplink_resources
def deeplink_url_patterns(
prefix='',
url_base_pattern=r'^init/%s/$',
login_init_func=login_init,
):
"""
Returns new deeplink URLs bas... | {
"content_hash": "c7dd5158fc933fdb089745c2cae6f66f",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 86,
"avg_line_length": 35.23684210526316,
"alnum_prop": 0.6153846153846154,
"repo_name": "anentropic/django-saml2-idp",
"id": "73a9778559d786348f4c2f71a688959269104e75",
"s... |
import os
import struct
import threading
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
from select import select
from socketserver import TCPServer, ThreadingTCPServer
from threading import RLock, Thread
import cv2
class JpegStreamer(Thread):
def __init__(self, camera):
Thread.__... | {
"content_hash": "5148c95223dce7beb1d70d2bec165e53",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 76,
"avg_line_length": 26.31451612903226,
"alnum_prop": 0.5562365920931658,
"repo_name": "quietcoolwu/python-playground",
"id": "4f052dae8680e196e11bdad5e67451ad7b71b3d7",
... |
"""
Gradient Boosted Trees Classification Example.
"""
from __future__ import print_function
from pyspark import SparkContext
# $example on$
from pyspark.mllib.tree import GradientBoostedTrees, GradientBoostedTreesModel
from pyspark.mllib.util import MLUtils
# $example off$
if __name__ == "__main__":
... | {
"content_hash": "1d036e19511c0541308eafcbff287648",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 98,
"avg_line_length": 43.525,
"alnum_prop": 0.6731763354394027,
"repo_name": "lhfei/spark-in-action",
"id": "e411a59bceed5e87533cde12b97233c23b1adbe3",
"size": "2541",
"... |
import numpy as np
from multiprocessing import Process
from sklearn import mixture
import time
import os
import sys
import logging
# counts = [0]*256
# path1 = "d:/count.txt"
# path2 = "d:/gaussian.txt"
# def save_count(path,count):
# file = open(path,'w')
# for i in range(len(count)):
# file.write(s... | {
"content_hash": "d997dd918379e191ce4554270b12bb98",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 137,
"avg_line_length": 34.27896995708154,
"alnum_prop": 0.5277325654188055,
"repo_name": "yslib/SGMMCluster",
"id": "f6087ad4d5acd6dda1439334fa021cccc6746f95",
"size": "7... |
"""Functions to plot ICA specific data (besides topographies)."""
from __future__ import print_function
# Authors: Denis Engemann <[email protected]>
# Alexandre Gramfort <[email protected]>
# Teon Brooks <[email protected]>
#
# License: Simplified BSD
from functools... | {
"content_hash": "572e139b9772c414eb438d9442c828dd",
"timestamp": "",
"source": "github",
"line_count": 989,
"max_line_length": 79,
"avg_line_length": 38.21840242669363,
"alnum_prop": 0.5829673527699878,
"repo_name": "jaeilepp/mne-python",
"id": "5e49be837c76c8415d158d026d12f91c5ec26af2",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Labels', '0001_initial'),
('Projects', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "682f5d864d917721a7f2bef7e53a9b38",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 167,
"avg_line_length": 49.88235294117647,
"alnum_prop": 0.597877358490566,
"repo_name": "matt-dale/designdb",
"id": "92eb449c3ee1b454faea48777fd38bc4e371303e",
"size": "26... |
"""Copyright 2015 Ericsson AB
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distri... | {
"content_hash": "99a540b8d80b6ba457775a7b4cbb36f9",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 91,
"avg_line_length": 32,
"alnum_prop": 0.6617647058823529,
"repo_name": "s87485759/Monad2015-trial",
"id": "e2f52a3744c40956bf3607f916d9a2bcb9347241",
"size": "3832",
... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 5, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 0); | {
"content_hash": "8218320ce68d74d026f50a1b4e2ad668",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 170,
"avg_line_length": 38.57142857142857,
"alnum_prop": 0.7111111111111111,
"repo_name": "antoinecarme/pyaf",
"id": "3b4cbe69c09daa2a448188d270fada1d1351ab22",
"size": "270... |
from __future__ import absolute_import, unicode_literals
import os
from mock import patch
from oauthlib import signals
from oauthlib.oauth2 import BackendApplicationClient
from ....unittest import TestCase
@patch('time.time', new=lambda: 1000)
class BackendApplicationClientTest(TestCase):
client_id = "somecl... | {
"content_hash": "8437694119fcff82e336b9d9d18e6537",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 104,
"avg_line_length": 37.160919540229884,
"alnum_prop": 0.6390349520569131,
"repo_name": "skion/oauthlib-oidc",
"id": "6b342f0e8f2d5a6eb5688a17d916718c145c6016",
"size": ... |
"""Utility to bulk load resources into the system, e.g. for initial preload"""
__author__ = 'Michael Meisinger'
import yaml
import re
import os
from pyon.core import MSG_HEADER_ACTOR, MSG_HEADER_ROLES, MSG_HEADER_VALID
from pyon.core.bootstrap import get_service_registry
from pyon.core.governance import get_system_a... | {
"content_hash": "8d1825063deddb482cf45ac4db016c4d",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 135,
"avg_line_length": 45.41372912801484,
"alnum_prop": 0.5722281232126808,
"repo_name": "crchemist/scioncc",
"id": "19dd4d724abf13fc73f00663230d5c32d5b86b62",
"size": "2... |
try:
frozenset
except NameError:
from sets import ImmutableSet as frozenset
def indent(width, s):
space = width * ' '
return '\n'.join([(space + line) for line in s.split('\n')])
def make_indenter(width):
def indenter(s): return indent(width, s)
return indenter
class AutoIndent(object):
r... | {
"content_hash": "171eebc4954ed9f00dbbf39990e6c0d8",
"timestamp": "",
"source": "github",
"line_count": 976,
"max_line_length": 119,
"avg_line_length": 32.43032786885246,
"alnum_prop": 0.5594907114874258,
"repo_name": "ActiveState/code",
"id": "a475fd237af4cfe27e2bc7cfc1ffea140c23eb48",
"size": "31... |
from unittest import skipUnless
from django.db import connection
from django.db.models.deletion import CASCADE
from django.db.models.fields.related import ForeignKey
from django.test import TestCase
from .models import Article, ArticleTranslation, IndexTogetherSingleList
class SchemaIndexesTests(TestCase):
"""
... | {
"content_hash": "82d881cd65abcbcf4a98415c11a8e8d1",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 97,
"avg_line_length": 44.24561403508772,
"alnum_prop": 0.6280729579698652,
"repo_name": "erikr/django",
"id": "81e2278b19bb83ac406dc9bd87b1b74bc8c5a05a",
"size": "5044",
... |
__author__ = 'Bohdan Mushkevych'
from threading import RLock
from bson import ObjectId
from db.model.site_statistics import SiteStatistics, DOMAIN_NAME, TIMEPERIOD
from synergy.db.manager import ds_manager
from synergy.system.decorator import thread_safe
class SiteDao(object):
""" Thread-safe Data Access Objec... | {
"content_hash": "a692e393391f02ad8a6361d444e4b727",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 115,
"avg_line_length": 39.23529411764706,
"alnum_prop": 0.672663668165917,
"repo_name": "mushkevych/scheduler",
"id": "fb7a0afc558fce15a4d4bab5c90c4b0e1787640c",
"size": "... |
'''
this algorithm is presented in:
Guibiao Xu, Zheng Cao, Bao-Gang Hu and Jose Principe, Robust support vector machines based on the
rescaled hinge loss, Pattern Recognition, 2017.
'''
import numpy as np
from sklearn.svm import SVC
from collections import OrderedDict
from config import config
class rsvm:
def __in... | {
"content_hash": "9b3659c3edc759049d347f787adae2fb",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 107,
"avg_line_length": 43.450331125827816,
"alnum_prop": 0.6622466087486664,
"repo_name": "FrankTsui/robust_rescaled_svm",
"id": "0f54d33c216f33db7e053889212d414df4479761",... |
import unittest
from redmate.keyformat import KeyPattern
from redmate.messaging import Message
class KeyFormatTest(unittest.TestCase):
test_data = (
("justkey", "justkey", (1,), ('id',)),
("key:1", "key:{id}", (1,), ('id',)),
("key:2:1", "key:{1}:{0}", (1, 2), ('id', 'val')),
("key... | {
"content_hash": "3eebf87e661cd62c33768718334bcda0",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 78,
"avg_line_length": 34.476190476190474,
"alnum_prop": 0.5290055248618785,
"repo_name": "roman-kashitsyn/redmate",
"id": "9b4f5bc2a1a191b0f653252939ddd019ae785c26",
"size... |
from datetime import date, datetime, time
import operator
import re
from threading import Thread, Event
import time as sleeper
from hydeengine import url
from hydeengine.file_system import File, Folder
class SiteResource(object):
def __init__(self, a_file, node):
super(SiteResource, self).__init__()
... | {
"content_hash": "11b7102793e4bfda684f20e63a998915",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 79,
"avg_line_length": 29.866863905325445,
"alnum_prop": 0.5631996037642397,
"repo_name": "cloudkick/cast-site",
"id": "7e2b240216a54a2346aae9f9caadd054b2c384b3",
"size": ... |
import unittest
import tutorial as validator
class TestTutorialValidators(unittest.TestCase):
pass
| {
"content_hash": "b58ef65edbf382dd6e575b73ea2bd748",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 48,
"avg_line_length": 20.8,
"alnum_prop": 0.8269230769230769,
"repo_name": "othieno/geotagx-tool-validator",
"id": "a6d79c76de53934648dcb9abeac0122c691cd347",
"size": "1414... |
"""
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": "47f7ff754b7565c851e633c0173bc4fe",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 105,
"avg_line_length": 21.142857142857142,
"alnum_prop": 0.6734234234234234,
"repo_name": "mbohlool/client-python",
"id": "7fbb7a25b1bfc412aacfb8af853ae9d3b9d86dd1",
"size... |
import random
def cxSimulatedBinary(var1, var2, eta=15):
"""Executes a simulated binary crossover that modify in-place the input
individuals. The simulated binary crossover expects :term:`sequence`
individuals of floating point numbers.
:param var1: The first variable participating in the crossover.
... | {
"content_hash": "ffcd82642acc42faead7c148b157960c",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 38.827586206896555,
"alnum_prop": 0.6047957371225577,
"repo_name": "DailyActie/Surrogate-Model",
"id": "2a8ef2404f5ae8e40b51ca04237873c0c6e66e99",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.