text stringlengths 4 1.02M | meta dict |
|---|---|
from bs4 import BeautifulSoup
from collections import OrderedDict
from datetime import datetime
from json import load as parse_json, dump as dump_json
from os import stat
from os.path import basename
from urllib.parse import quote as urlquote
import optparse
import requests
with open('config.json') as json_data_file:
... | {
"content_hash": "d1179c83b72683fd04a51175701bc0b0",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 119,
"avg_line_length": 42.605633802816904,
"alnum_prop": 0.5457851239669421,
"repo_name": "KTH/canvas-import-social",
"id": "5dc2b8d7267add610939bd5a7151e8aff0e0e987",
"s... |
from __future__ import absolute_import, division
from desiutil.log import get_logger
import argparse
import numpy as np
from desispec.qa import __offline_qa_version__
def parse(options=None):
parser = argparse.ArgumentParser(description="Generate QA on Sky Subtraction residuals [v{:s}]".format(__offline_qa_versi... | {
"content_hash": "67776ceb91b72b0337fab6caa25aae9f",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 139,
"avg_line_length": 42.93788819875776,
"alnum_prop": 0.5602488065962679,
"repo_name": "desihub/desispec",
"id": "a7d9fbd05b10cdb0faee2d54c0bbb238517f5d9e",
"size": "69... |
from direct.showbase.DirectObject import DirectObject
from direct.directnotify.DirectNotifyGlobal import directNotify
class DistributedObjectBase(DirectObject):
"""
The Distributed Object class is the base class for all network based
(i.e. distributed) objects. These will usually (always?) have a
dcla... | {
"content_hash": "378d8fdc0075b083823ef1ff1efa29d7",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 80,
"avg_line_length": 35.09473684210526,
"alnum_prop": 0.6019796040791842,
"repo_name": "brakhane/panda3d",
"id": "e105e4c891fb7b373e0a419541b05151b17e1606",
"size": "3335... |
import alooma
import os
import sys
import pprint
api = alooma.Alooma(
hostname=os.environ['ALOOMA_HOST'],
port=int(os.environ['ALOOMA_PORT']),
username=os.environ['ALOOMA_USERNAME'],
password=os.environ['ALOOMA_PASSWORD'])
mapping_name = sys.argv[1]
schema_name = sys.argv[2]
table_name = sys.argv[3]
... | {
"content_hash": "952edc8d09acd48d34741dbcc037481b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 112,
"avg_line_length": 30,
"alnum_prop": 0.7027777777777777,
"repo_name": "rocketmiles/alooma-scripts",
"id": "35011b093a8c266123d09d75125409ef538a88d7",
"size": "720",
... |
import logging
__version__ = (0, 0, 1)
__author__ = "Rafał Furmański"
__contact__ = "r.furmanski@gmail.com"
__homepage__ = "http://github.com/r4fek/dsmcache"
__docformat__ = "markdown"
logging.getLogger('dsmcache').setLevel(logging.INFO)
| {
"content_hash": "050a664dce088e3834a540f4cbcce3cc",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 24.1,
"alnum_prop": 0.6721991701244814,
"repo_name": "r4fek/dsmcache",
"id": "e348dfd4ef78e93fbc9593bc5987640c66ff8dbf",
"size": "267",
"binary": f... |
from __future__ import absolute_import
from types import FrameType
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from django.core.management import CommandError
from django.conf import settings
from django.utils import autoreload
from zerver.worker.queu... | {
"content_hash": "f960c8d31e7c30ba5b7e7ee0904a16a2",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 102,
"avg_line_length": 37.80487804878049,
"alnum_prop": 0.5903225806451613,
"repo_name": "vikas-parashar/zulip",
"id": "48afef41260f6dc890821f844336274f2529cf2d",
"size": ... |
from etherscan.tokens import Tokens
import json
with open('../../api_key.json', mode='r') as key_file:
key = json.loads(key_file.read())['key']
# tokenname options are:
# DGD
# MKR
# TheDAO
address = '0x0a869d79a7052c7f1b55a8ebabbea3420f0d1e13'
api = Tokens(tokenname='TheDAO', api_key=key)
balance = ... | {
"content_hash": "98b84156247e15d299829441bd6cd7ea",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 54,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.7032085561497327,
"repo_name": "valerius21/ERMA17",
"id": "1e0b6bd259cec51d6454225959f054ca4da18e77",
"size": "37... |
from odoo import http
# class SarinahBarcodeScanning(http.Controller):
# @http.route('/sarinah_barcode_scanning/sarinah_barcode_scanning/', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/sarinah_barcode_scanning/sarinah_barcode_scanning/objects/', auth='public')
# ... | {
"content_hash": "bdd095b788b8bdba773fa70edce273f2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 160,
"avg_line_length": 48.8421052631579,
"alnum_prop": 0.6530172413793104,
"repo_name": "budihartono/odoo_addons",
"id": "422ed4319e58b14d67303e56544f02100ba99993",
"size"... |
"""BosonOperator stores a sum of products of bosonic ladder operators."""
from openfermion.ops._symbolic_operator import SymbolicOperator
class BosonOperator(SymbolicOperator):
r"""BosonOperator stores a sum of products of bosonic ladder operators.
In OpenFermion, we describe bosonic ladder operators using ... | {
"content_hash": "568947bee338587bceec033818c729cc",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 77,
"avg_line_length": 35.029411764705884,
"alnum_prop": 0.609291911558914,
"repo_name": "jarrodmcc/OpenFermion",
"id": "651a32475fc286ab27e900d76fbb198ba2f62bd3",
"size":... |
"""
PyPDF2 is a free and open-source pure-python PDF library capable of splitting,
merging, cropping, and transforming the pages of PDF files. It can also add
custom data, viewing options, and passwords to PDF files. PyPDF2 can retrieve
text and metadata from PDFs as well.
You can read the full docs at https://pypdf2.... | {
"content_hash": "1635e6cea45c26dc84e97d16e3cc814f",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 78,
"avg_line_length": 35.029411764705884,
"alnum_prop": 0.7313182199832073,
"repo_name": "xilopaint/alfred-pdf-tools",
"id": "08b03d5ec0b0e6298903d8a2fc90af384330b87f",
"s... |
import abc
from pandas.tseries.holiday import *
# helper for specifying months below
Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec = range(1, 13)
NewYearsDay = Holiday('New Years Day', month=Jan, day=1,
observance=weekend_to_monday)
SpringBankHoliday = Holiday('Spring Bank Holiday',... | {
"content_hash": "98627b25d002678fabb31de8a583d95f",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 36.22222222222222,
"alnum_prop": 0.647239263803681,
"repo_name": "paze-me/mambu",
"id": "83c536648b6f9eacc79a9b47581abe580381ded9",
"size": "1956",
... |
"""Class to generate a cosmic population of FRBs."""
import numpy as np
from frbpoppy.misc import pprint
from frbpoppy.number_density import NumberDensity
from frbpoppy.population import Population
import frbpoppy.direction_dists as did
import frbpoppy.dm_dists as dmd
import frbpoppy.time_dists as td
import frbpoppy.w... | {
"content_hash": "d19d2c6e83325f4609e1ac1a4521ab09",
"timestamp": "",
"source": "github",
"line_count": 587,
"max_line_length": 79,
"avg_line_length": 36.52810902896082,
"alnum_prop": 0.5515810092342133,
"repo_name": "davidgardenier/frbpoppy",
"id": "8ac420e5243c258b16771deea12e817cff298109",
"size... |
'''
# 1 create Company
# 2 Create sub department and set virtual id as OrganizationSupervisor
# (1) not less than 5 grades
# (2) the first three levels have only one department,and the latter two have ten brothers
# (3) the first three levels have two members in each department,and the latter two levels have 20 membe... | {
"content_hash": "dc5a61b61011bace4d67caba1d910739",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 212,
"avg_line_length": 59.93617021276596,
"alnum_prop": 0.6119985800496983,
"repo_name": "zstackorg/zstack-woodpecker",
"id": "10e77b6938454fd2a9acee26f4f83836ed1557b1",
"... |
from oslo_log import log
import six
from keystone.auth.plugins import base
from keystone.auth.plugins import mapped
from keystone.common import dependency
from keystone.common import wsgi
import keystone.conf
from keystone import exception
from keystone.i18n import _
from keystone.models import token_model
LOG = log... | {
"content_hash": "1e442072af32d1814154a1ae2a25dba7",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 79,
"avg_line_length": 40.9126213592233,
"alnum_prop": 0.624110109159943,
"repo_name": "ilay09/keystone",
"id": "8c8be5233804bae745723c2aff9d619fd1638b50",
"size": "4800",... |
import unittest
from conans.test.utils.tools import TestServer, TestClient
from conans.model.ref import ConanFileReference
import os
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.paths import CONANFILE, CONANFILE_TXT
from conans.util.files import load
generator = """
from conans.model... | {
"content_hash": "6e791220b422b5181349ac30c316c200",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 92,
"avg_line_length": 30.919354838709676,
"alnum_prop": 0.6604068857589984,
"repo_name": "mropert/conan",
"id": "f547a7459a1fb2cee14b25e72fec0009d05b9e96",
"size": "3834"... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/creature/npc/base/shared_gran_base_male.iff"
result.attribute_template_id = 9
result.stfName("npc_name","gran_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "893194c7dc2d52280320d39f170e6647",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 23.384615384615383,
"alnum_prop": 0.6907894736842105,
"repo_name": "anhstudios/swganh",
"id": "ac6f59ac075d446f8015bc20baf9a1f8d4f984cb",
"size": "44... |
import codecs
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def __init__(self, *args, **kwargs):
TestCommand.__init__(self, *args, **kwargs)
self.test_suite = True
def finalize_options(self):
TestCommand.finalize_option... | {
"content_hash": "a5cb405bcb04788e61d83fbd45102413",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 85,
"avg_line_length": 28.571428571428573,
"alnum_prop": 0.6425,
"repo_name": "RomanZacharia/pyethapp",
"id": "193017054f4981016d719fff58e0486782e6e5a0",
"size": "2446",
... |
import unittest
from conans.errors import ConanException
from conans.paths import CONANFILE, BUILD_INFO
from conans.test.utils.tools import TestClient
from conans.util.files import load, mkdir
import os
class SourceTest(unittest.TestCase):
def source_reference_test(self):
client = TestClient()
er... | {
"content_hash": "006e09a87afbeca7313da15a2ca2d461",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 102,
"avg_line_length": 33.292397660818715,
"alnum_prop": 0.6305989812049886,
"repo_name": "lasote/conan",
"id": "56a351fbe961b875a256199aa743f1d8da658d14",
"size": "5693"... |
import json
import requests
import jwt
from jwt import DecodeError
from datetime import datetime, timedelta
from app.models import User
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.generic import View
from django.core import serializers
class social(Vi... | {
"content_hash": "ddd66529a7fcd8af9f04a6b8c1a8da72",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 86,
"avg_line_length": 33.89622641509434,
"alnum_prop": 0.5713888115780684,
"repo_name": "cesardeazevedo/sniffle",
"id": "54441dd84e52ec319057e0a08154df9959163836",
"size"... |
from __future__ import print_function
import os
import sys
import json
import shutil
import tempfile
import optparse
import zipfile
# Try to detect if we're running from source via the buck repo by
# looking for the .arcconfig file. If found, add the appropriate
# deps to our python path, so we can find the twitter l... | {
"content_hash": "018e488972cd3f5b57b3aa6289d9fd9d",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 91,
"avg_line_length": 38.227586206896554,
"alnum_prop": 0.6516326898791268,
"repo_name": "rhencke/buck",
"id": "da1532863862c79ab52379c77eb34731380d7ad2",
"size": "5566",... |
from lib.logger import get_logger
from collections import OrderedDict
from tasks.hierarchy import DenormalizedHierarchy, GetParentsFunction, \
Hierarchy, HierarchyInfoUnion, HierarchyChildParentsUnion, \
HierarchyChildParent, LevelHierarchy, LevelInfo
from tasks.uk.cdrc import OutputAreas
from tasks.uk.census.o... | {
"content_hash": "c7cad567da0828a44d10b2d6749f89d8",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 85,
"avg_line_length": 33.09027777777778,
"alnum_prop": 0.6316894018887723,
"repo_name": "CartoDB/bigmetadata",
"id": "f7dbe4512604f28aef1a6cfdab2f516beccca55f",
"size": "... |
import uuid
from msrest.pipeline import ClientRawResponse
from .key_vault_authentication import KeyVaultAuthentication
from ..key_vault_client import KeyVaultClient as KeyVaultClientBase
from ..models import KeyVaultErrorException
from msrest.authentication import BasicTokenAuthentication
class CustomKeyVaultClient(... | {
"content_hash": "7c5ee00745bdf6381c526359b3c0379b",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 140,
"avg_line_length": 45.853932584269664,
"alnum_prop": 0.6897819161970106,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "a35a091f3ebca389157ef9eefbd3c7539051dc8d"... |
from . import Analysis, register_analysis
from .. import SIM_PROCEDURES
import logging
l = logging.getLogger('angr.analyses.callee_cleanup_finder')
class CalleeCleanupFinder(Analysis):
def __init__(self, starts=None, hook_all=False):
self.results = {}
if starts is None:
starts = [imp.... | {
"content_hash": "0fd61598e9b5e62567a38434303395b9",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 149,
"avg_line_length": 41.78125,
"alnum_prop": 0.5329094988780853,
"repo_name": "chubbymaggie/angr",
"id": "f74b4a8f31867a40c849036624f250ee474b40ba",
"size": "2674",
"b... |
from flask.ext.login import AnonymousUserMixin, UserMixin
from flask_truss.models.base import BaseModel, db
from passlib.hash import bcrypt
class Anonymous(AnonymousUserMixin):
pass
class User(UserMixin, BaseModel):
# __tablename__ needs to be specified depending on the database, since some eg postgres res... | {
"content_hash": "d6e5ea4954d2ec038592e5cca23c5230",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 116,
"avg_line_length": 31.25925925925926,
"alnum_prop": 0.6990521327014217,
"repo_name": "bmoar/flask-truss",
"id": "dcbe6bb2801b70596bbcd27dcd66a13f45fe5cd0",
"size": "84... |
from dynmen.dmenu import DMenu
from dynmen import new_dmenu
import pytest
def test_import():
menu = DMenu()
assert menu._trait_transformed['i'] == []
assert menu.i is False
assert menu.case_insensitive is False
menu.i = True
assert menu.i is True
assert menu.case_insensitive is True
as... | {
"content_hash": "0f9403a70489e3f1ba34e438da5decc1",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 49,
"avg_line_length": 23.85185185185185,
"alnum_prop": 0.6428571428571429,
"repo_name": "frostidaho/dynmen",
"id": "2fb64a5b221bac58ea990028222059acd094d110",
"size": "668... |
import os
from setuptools import setup, find_packages
version = '0.6.0'
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "cmislib",
description = 'Apache Chemistry CMIS client library for Python',
version = version,
install_requires = [
'is... | {
"content_hash": "af2c8deee46d192d1c92704deeafb268",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 70,
"avg_line_length": 31,
"alnum_prop": 0.6043643263757116,
"repo_name": "apache/chemistry-cmislib",
"id": "be22e3a5eb11f653f5707cbc1d88223cd09a2f24",
"size": "1913",
"b... |
import numpy
import random
import math
class TerrainGenerator:
def create_random(self, size, myrange, symmetric=False):
"""Creates a random terrain map"""
ret = numpy.random.random_integers(0, myrange, size)
if symmetric:
ret = self.make_symmetric(ret)
return ret
... | {
"content_hash": "92b58d184b938aed2370d121bf5c39b9",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 108,
"avg_line_length": 40.58888888888889,
"alnum_prop": 0.46222283055023267,
"repo_name": "matthewrobertharris/cells",
"id": "5c23fce4f9b56c1eee5f5928d853cd40ad288479",
"... |
"""Tests for the Run Windows Registry plugin."""
import unittest
from plaso.parsers.winreg_plugins import run
from tests.parsers.winreg_plugins import test_lib
class AutoRunsPluginTest(test_lib.RegistryPluginTestCase):
"""Tests for the auto rus Windows Registry plugin."""
def testFilters(self):
"""Tests t... | {
"content_hash": "9064bfdfd305019d9674e3ab95980ad4",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 80,
"avg_line_length": 37.21621621621622,
"alnum_prop": 0.6714596949891067,
"repo_name": "kiddinn/plaso",
"id": "69a0bd51e644e391acbe9dabcfe3e9bbfb54b309",
"size": "6932",... |
""" Cisco_IOS_XR_telemetry_model_driven_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR telemetry\-model\-driven package operational data.
This module contains definitions
for the following management objects\:
telemetry\-model\-driven\: Telemetry operational data
Copyright (c) 2013\-... | {
"content_hash": "1f8463d1a09b48f514c828aab489d5b9",
"timestamp": "",
"source": "github",
"line_count": 2827,
"max_line_length": 292,
"avg_line_length": 38.21188539087372,
"alnum_prop": 0.41191390881740336,
"repo_name": "111pontes/ydk-py",
"id": "d03fdeac11e1ccb9a4cefc4c74d6601bae1039b2",
"size": "... |
import datetime
from copy import deepcopy
from django.core.exceptions import FieldError, MultipleObjectsReturned
from django.db import models, transaction
from django.test import TestCase
from django.utils import six
from django.utils.translation import ugettext_lazy
from .models import (
Article, Category, Child... | {
"content_hash": "69f8a0fdea4b93ccefac362fd95da7f9",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 126,
"avg_line_length": 47.18401206636501,
"alnum_prop": 0.5820413643192789,
"repo_name": "marcelocure/django",
"id": "7b2a640b2bace7f6b123173d9eab199f7a15ea74",
"size": "... |
'''
tests/task
Tests for the task module.
'''
| {
"content_hash": "92a9428193beae53d1ae52c9ac443da5",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 26,
"avg_line_length": 11.5,
"alnum_prop": 0.6521739130434783,
"repo_name": "sublime-ycmd/sublime-ycmd",
"id": "d79d581f4ece543d02b5c858dd5d411aa925e177",
"size": "70",
"b... |
"""
This is a password generation and encryption tool.
This Software is provided as is without any warranty. In no case should the Author be liable for the Software.
Tim Hartmann , November 2015
"""
import random , os , binascii , base64 , getpass , hashlib
from tkinter import Tk
from Crypto.Cipher import AES
#https:/... | {
"content_hash": "5006f9ef2ebfa1b29a0276d8651dc71e",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 293,
"avg_line_length": 29.472826086956523,
"alnum_prop": 0.6107320671215195,
"repo_name": "TimseineLPs/PasswMngr",
"id": "94d3eec314701322d7a4620237c1993ed4d7aa7d",
"size... |
from difflib import SequenceMatcher
from django.forms import HiddenInput
from django.shortcuts import get_object_or_404
from form_utils.forms import BetterForm
from server.base import SUBSTITUTIONS
from .datacollection.pluginmanagementinterface import PluginManagementInterface
from .models import Plugin, Argument, Ex... | {
"content_hash": "a482b4374fb27a0165d16107436281b6",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 182,
"avg_line_length": 46.295081967213115,
"alnum_prop": 0.6281869688385269,
"repo_name": "smartshark/serverSHARK",
"id": "fbf4e74f60f2629eb8be8cca26802045f43e39e8",
"siz... |
from flask_restful import Resource
class DistributorDetail(Resource):
def get(self, _id):
return {_id: "1"}, 200
def put(self, _id):
return {_id: "2"}, 200
def delete(self, _id):
return {self, _id}, 200
class DistributorList(Resource):
def get(self):
return {}, 200
... | {
"content_hash": "011c9e5fe3f596beae0a5cf71a60837c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 43,
"avg_line_length": 19.2,
"alnum_prop": 0.5703125,
"repo_name": "ianjuma/sunpower",
"id": "aa5093c423e211e43540ed896cd4140b03c0def1",
"size": "384",
"binary": false,
... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HNeg_SchoolOrdFac_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HNeg_SchoolOrdFac_CompleteLHS.
"""
... | {
"content_hash": "e9f506643ae0a7dde95ab4525744561b",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 128,
"avg_line_length": 48.24666666666667,
"alnum_prop": 0.4572336603565013,
"repo_name": "levilucio/SyVOLT",
"id": "60a4ab75c9864f13ebe3a241b906b7c8317ca12a",
"size": "72... |
from xml.parsers import expat
from os.path import sep as path_sep
# ------------------------
# Django dependency Import
# ------------------------
from django.conf import settings
SOURCE_ROOT = settings.MEDIA_ROOT
class ParsedTreeNode(object):
"""
A parsed XML Element Node.
This class embeds all the inf... | {
"content_hash": "01dc2eb1f9675ba5b89ece11c8a1c622",
"timestamp": "",
"source": "github",
"line_count": 880,
"max_line_length": 105,
"avg_line_length": 34.872727272727275,
"alnum_prop": 0.5868743482794577,
"repo_name": "leriomaggio/code-coherence-evaluation-tool",
"id": "24c54b5bda2a232706fc720424b09... |
"""Base module for unittesting."""
from plone.app.testing import applyProfile
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import login
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandboxLayer
from plone.app.t... | {
"content_hash": "e2d3bbabd116a2caff385faf1deeb999",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 61,
"avg_line_length": 30.25,
"alnum_prop": 0.71849173553719,
"repo_name": "a25kk/apm",
"id": "a198f7ea43744d5a48dc05c8e7bfca83b679f502",
"size": "1960",
"binary": false,... |
'''
Code for cifar10_v1 network, and visualizing filters.
'''
from __future__ import print_function
import keras
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2... | {
"content_hash": "9425cf62736d5f06c63cf2fe0528e781",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 100,
"avg_line_length": 29.802197802197803,
"alnum_prop": 0.7352507374631269,
"repo_name": "santiagolopezg/MODS_ConvNet",
"id": "8fb4153dd1eaf98ac1639eff24eeb57a9998e989",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UrlImage.resource'
db.add_column(u'catalog_urlimage', 'resource',
self.gf('django.db.models.fi... | {
"content_hash": "45c2ba8ded7da45cb361159dc1f18165",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 206,
"avg_line_length": 75.54970760233918,
"alnum_prop": 0.547565601052713,
"repo_name": "openrural/open-data-nc",
"id": "cc1b2403e362e3961a5b8bdfeec31fe361ff3823",
"size"... |
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
from AdaptivePELE.atomset import atomset, SymmetryContactMapEvaluator
from AdaptivePELE.utilities import utilities
import matplotlib.pyplot as plt
def parseArguments():
desc = "Calculate the histogram of ContactMap ... | {
"content_hash": "ee9f58f8fabdc8679aa006a0d9db0c6d",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 121,
"avg_line_length": 40.97530864197531,
"alnum_prop": 0.6839409460680927,
"repo_name": "AdaptivePELE/AdaptivePELE",
"id": "16704d7a20e9c3c6f00ef1c9a7de39a3875fc7a5",
"si... |
"""
Created on Thu Mar 02 16:32:18 2017
@author: Colin Dryaton cdrayton@umich.edu
"""
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
from gensim import corpora, models, similarities
import gensim
#import json
#import pandas as pd
#from glob import glob
#imp... | {
"content_hash": "40e4f43610384f347a3b6cb330300ad6",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 159,
"avg_line_length": 33.03947368421053,
"alnum_prop": 0.7311827956989247,
"repo_name": "scramblingbalam/Alta_Real",
"id": "fee7ab166b63a7b97a78a7ef2b2e8aa277bed7a4",
"si... |
import asyncio
import collections
class EventResultOrError:
"""
This class wrappers the Event asyncio lock allowing either awake the
locked Tasks without any error or raising an exception.
thanks to @vorpalsmith for the simple design.
"""
def __init__(self, loop):
self._loop = loop
... | {
"content_hash": "f49004bc1280b38c3dca5a870e2f9c68",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 72,
"avg_line_length": 24.894736842105264,
"alnum_prop": 0.5835095137420718,
"repo_name": "rutsky/aiohttp",
"id": "e57ec2e5cd35b6c6d026e09aa42c83ab0372aede",
"size": "946",... |
"""prelude -- extra builtins"""
from __future__ import absolute_import
import os, logging
__all__ = ('log', )
log = logging.getLogger(os.path.basename(os.path.dirname(__file__)))
log.addHandler(logging.StreamHandler())
| {
"content_hash": "abc8e54b8947b08f5e340c03e7bd5141",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 68,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.6936936936936937,
"repo_name": "thisismedium/python-sasl",
"id": "c85ef899bdcca9477ba0e4eeef2c3e4c9e028f12",
"size... |
import os, platform
( system, node, release, version, machine, processor ) = platform.uname()
from SCons.Script import *
def _DoAssembleBundle( target, source, env ):
topdir = os.getcwd()
try:
print('create the bundle structure for %s' % str( target[0] ) )
bundle_dir = str( target[0] )
... | {
"content_hash": "811d1315268c41829cdb90aa3dd5b73c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 73,
"avg_line_length": 35,
"alnum_prop": 0.5814671814671815,
"repo_name": "modulexcite/es_core",
"id": "32e1b3dae29084dc3f2554acff9698336ef071d4",
"size": "1403",
"binary... |
"""
Support for MQTT JSON lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.mqtt_json/
"""
import asyncio
import logging
import json
import voluptuous as vol
from homeassistant.core import callback
import homeassistant.components.mqtt as mqtt... | {
"content_hash": "5e7b7a7aa30555a18e8563ade1147f45",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 79,
"avg_line_length": 31.87878787878788,
"alnum_prop": 0.5665399239543726,
"repo_name": "ewandor/home-assistant",
"id": "e3e3f7dafde6fb82480babe624c7b7857a2d421a",
"size"... |
import sys, os
import datetime
import jinja2.filters
# Needed to properly import project docstrings
import django.conf
django.conf.settings.configure()
# 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
# docum... | {
"content_hash": "7597fac8f43b89d9940010a54e32e12f",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 123,
"avg_line_length": 32.67755102040816,
"alnum_prop": 0.7060954284286785,
"repo_name": "nigma/django-herokuify",
"id": "bbfa4a9f9e914454ec875ab175f2d745ab700e3a",
"size... |
import json
id2handlerInfo = {}
class JSONSerializable:
def __str__(self):
return jsonify(self)
def __repr__(self):
return jsonify(self, indent=4)
class EventHandlerInfo(JSONSerializable):
def __init__(self):
self.selector = None
self.event = None
self.uiData = ... | {
"content_hash": "8a7d2f70554b223f6fa04715a69de0cd",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 103,
"avg_line_length": 24.040816326530614,
"alnum_prop": 0.5840407470288624,
"repo_name": "red8012/portkey",
"id": "22e891e14489ab2f02120d9ba1146be362d32ad6",
"size": "117... |
"""
:mod:`pyffi.spells.nif.modify` --- spells to make modifications
=================================================================
Module which contains all spells that modify a nif.
.. autoclass:: SpellTexturePath
:show-inheritance:
:members:
.. autoclass:: SpellSubstituteTexturePath
:show-inheritance:
... | {
"content_hash": "b7449ae77d4c78d49e4bd0f3481e4be7",
"timestamp": "",
"source": "github",
"line_count": 1272,
"max_line_length": 185,
"avg_line_length": 38.2185534591195,
"alnum_prop": 0.5918048298843954,
"repo_name": "griest024/PokyrimTools",
"id": "9ca3d8357f4af1dcfa4750d5721701e6704fb3b2",
"size... |
"""
sphinx.errors
~~~~~~~~~~~~~
Contains SphinxError and a few subclasses (in an extra module to avoid
circular import problems).
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import traceback
class SphinxError(Exception):
"... | {
"content_hash": "d266c2ead2773a91205041f3f105e9f6",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 74,
"avg_line_length": 26.236842105263158,
"alnum_prop": 0.6093279839518556,
"repo_name": "neerajvashistha/pa-dude",
"id": "8d695c19001c9e8f6678c2b5969007a58525634d",
"size... |
from __future__ import absolute_import, unicode_literals
import logging
import os
import gobject
import pygst
pygst.require('0.10')
import gst # noqa
import gst.pbutils # noqa
import pykka
from mopidy import exceptions
from mopidy.audio import playlists, utils
from mopidy.audio.constants import PlaybackState
fro... | {
"content_hash": "7189efc4e31ab6b8f86081ea0cee6078",
"timestamp": "",
"source": "github",
"line_count": 776,
"max_line_length": 79,
"avg_line_length": 36.123711340206185,
"alnum_prop": 0.6062357305936074,
"repo_name": "rawdlite/mopidy",
"id": "72750bdf6d3d80025ed87715eeb3665799665fbe",
"size": "280... |
from django.http import Http404
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from pressgang.accounts.decorators import can_manage_blogs
from pressgang.actions import clear_action, retrieve_action
from pressgang.utils.ajax import ajax_view, AjaxError
from p... | {
"content_hash": "9e1505e0f4410fd7c711ee00339e4ea0",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 118,
"avg_line_length": 28.423529411764704,
"alnum_prop": 0.7330298013245033,
"repo_name": "cilcoberlin/pressgang",
"id": "20731a4fbf21cbd74df45d2320b0e98722ecf723",
"size"... |
import os
import re
import sys
import urllib
import BeautifulSoup
import json
#import simplejson
from models import Song as AppSong
import random
from django.http import HttpResponse
import logging
from django.core import serializers
URLS_LIST = ['http://pigeonsandplanes.com/', 'http://www.2dopeboyz.com/', 'http://agr... | {
"content_hash": "b028f9ab28267413edf96bd56b7c4c04",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 174,
"avg_line_length": 25.68211920529801,
"alnum_prop": 0.6743166580711707,
"repo_name": "zackster/HipHopGoblin",
"id": "c470aef539d90cdccb2922677f7153ffe3bc35c4",
"size"... |
import unittest
import IECore
import sys
sys.path.append( "test/IECoreNuke" )
from KnobAccessorsTest import *
from FnAxisTest import *
from DeepImageReaderTest import *
from LensDistortTest import *
from StringUtilTest import *
from KnobConvertersTest import *
from ParameterisedHolderTest import ParameterisedHolderTe... | {
"content_hash": "9123fa37913373a962636c18d4f73e20",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 59,
"avg_line_length": 23.29032258064516,
"alnum_prop": 0.796398891966759,
"repo_name": "hradec/cortex",
"id": "64d049fa890c8e59b4c5b27d24c111efee14b79d",
"size": "2511",
... |
from test import test_support
import socket
import time
# Optionally test SSL support. This requires the 'network' resource as given
# on the regrtest command line.
skip_expected = not (test_support.is_resource_enabled('network') and
hasattr(socket, "ssl"))
def test_basic():
test_support.req... | {
"content_hash": "181488128c900cbc3e8f19288483eeed",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 77,
"avg_line_length": 24.81159420289855,
"alnum_prop": 0.5922897196261683,
"repo_name": "mosbasik/buzhug",
"id": "194c395940791b8be8ccee37b38834d542a486f9",
"size": "1790"... |
from distutils.core import setup
setup(
name = 'Flat',
description = 'Generative infrastructure for Python',
version = '0.3.2',
packages = ['flat'],
author = 'Juraj Sukop',
author_email = 'contact@xxyxyz.org',
url = 'https://xxyxyz.org/flat',
license = 'MIT',
classifiers = [
... | {
"content_hash": "17513cae3f1fd8f69e48268c41187f59",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 71,
"avg_line_length": 44.55882352941177,
"alnum_prop": 0.594059405940594,
"repo_name": "xxyxyz/flat",
"id": "eece443d754a2c2ca0c1214fc7eb5f305b903784",
"size": "1515",
"... |
import shutil
import os
import unittest
from q2_types.feature_table import (BIOMV100Format, BIOMV210Format,
BIOMV100DirFmt, BIOMV210DirFmt)
from qiime2.plugin.testing import TestPluginBase
class TestFormats(TestPluginBase):
package = 'q2_types.feature_table.tests'
def tes... | {
"content_hash": "0735c99ad332377885145ae163ff4eaf",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 75,
"avg_line_length": 33.91228070175438,
"alnum_prop": 0.6554578375581996,
"repo_name": "jairideout/q2-types",
"id": "6435563f9ab1b6a12ad79dd7541257722ee079e6",
"size": "2... |
"""Tools for managing evaluation contexts. """
from sympy.utilities.iterables import dict_merge
from sympy.polys.polyutils import PicklableWithSlots
__known_options__ = set(['frac', 'gens', 'wrt', 'sort', 'order', 'domain',
'modulus', 'gaussian', 'extension', 'field', 'greedy', 'symmetric'])
__global_options__ =... | {
"content_hash": "286c2c63123e551aae2ae717653b8fed",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 86,
"avg_line_length": 29.138461538461538,
"alnum_prop": 0.5712777191129884,
"repo_name": "amitjamadagni/sympy",
"id": "81030e0904e8ac13595c3316bdf4acd7d9dc3527",
"size": "... |
"""Fetch a git repository and restart the webapp service."""
import os, sys
__version__ = None
if __name__ == '__main__':
webapp_path = sys.argv[1]
os.chdir(webapp_path)
python_executable = os.path.join(
os.path.dirname(webapp_path), 'bin', 'python')
cmd = [ python_executable, './manage.py', ... | {
"content_hash": "610950744d939f691590958c5ee42dfc",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 60,
"avg_line_length": 29.928571428571427,
"alnum_prop": 0.5990453460620525,
"repo_name": "djaodjin/djaodjin-deployutils",
"id": "efcf1024101f0cef74c5a585c5e105aee5065292",
... |
import os
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
# To set up environmental variables, see http://twil.io/secure
account = os.environ['TWILIO_ACCOUNT_SID']
token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account, token)
binding = client.notify.services("IS... | {
"content_hash": "223407b75beb0c3d68c382426d81e12b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 33.61538461538461,
"alnum_prop": 0.7780320366132724,
"repo_name": "TwilioDevEd/api-snippets",
"id": "561a140d20540f0885990599baf3a399844191cb",
"size... |
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(... | {
"content_hash": "8647a5375ea4da4b884399e0f01fce74",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 94,
"avg_line_length": 27.340425531914892,
"alnum_prop": 0.6093385214007782,
"repo_name": "bennylope/sysenv",
"id": "03d74d23931247ef1a9da72ca0aa4608f1a4d9a4",
"size": "133... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_sharnaff_bull.iff"
result.attribute_template_id = 9
result.stfName("monster_name","sharnaff")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "415bf6889e00a81708a23d08dabff614",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 59,
"avg_line_length": 22.307692307692307,
"alnum_prop": 0.6931034482758621,
"repo_name": "anhstudios/swganh",
"id": "14ac5c66428d464975876d3633162af84910d8c5",
"size": "43... |
from datetime import datetime
from django.conf import settings
from django.core.urlresolvers import reverse
from onadata.apps.main.views import delete_data
from onadata.apps.viewer.models.parsed_instance import ParsedInstance
from onadata.apps.logger.models.instance import Instance
from onadata.libs.utils import comm... | {
"content_hash": "ce22ea8fe0c96ec648ae23ec985462a8",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 78,
"avg_line_length": 42.22522522522522,
"alnum_prop": 0.6396415617665885,
"repo_name": "eHealthAfrica/onadata",
"id": "3f3263072861963cedbc57f8c5dfc772299e8d00",
"size":... |
import json
from django.urls import reverse
from rest_framework.test import APIRequestFactory
from tests.support.decorators import mark_urls
from tests.support.serializers import (
get_artists,
get_albums,
get_tracks,
get_non_default_ids,
)
from tests.support.views import ArtistViewSet, AlbumViewSet, ... | {
"content_hash": "f772669dec77867a3a248c0eea232e4e",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 80,
"avg_line_length": 31.26153846153846,
"alnum_prop": 0.5346948818897638,
"repo_name": "paulcwatts/drf-json-schema",
"id": "81da30f9000dde334fa00d216be3f70e00a10768",
"s... |
"""Clustering v1 profile action implementations"""
import logging
import sys
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from osc_lib import utils
from senlinclient.common.i18n import _
from senlinclient.common import utils as senlin_utils
c... | {
"content_hash": "ce97f878a17b2fc93cdbdcd04a7f4884",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 79,
"avg_line_length": 34.76123595505618,
"alnum_prop": 0.5465858585858586,
"repo_name": "stackforge/python-senlinclient",
"id": "ac116cf7865122db1f1269920573ab9fe7bd411c",
... |
__all__ = [
'Process', 'current_process', 'active_children', 'freeze_support',
'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition',
'Event', 'Queue', 'Manager', 'Pipe', 'Pool', 'JoinableQueue'
]
#
# Imports
#
import threading
import sys
import weakref
import array
import itertools
import sys... | {
"content_hash": "5bd08ed73eeec8b2618f51c558a5b00a",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 79,
"avg_line_length": 24.0327868852459,
"alnum_prop": 0.6292633015006821,
"repo_name": "tsheasha/python-multiprocessing",
"id": "a6b1f8099ac0ae98372436a5ae8b94cfb3a0d236",
... |
import re
import os
import time
import requests
import MySQLdb
from bs4 import BeautifulSoup
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def get_titles(url):
response = requests.get(url)
if response.status_code == 200:
html = BeautifulSoup(response.content,'lxml')
title_list=[]
for ... | {
"content_hash": "72ffaf95fbc24c0f6414b78f43a00fa3",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 95,
"avg_line_length": 28,
"alnum_prop": 0.5933441558441559,
"repo_name": "dcclogin/TextGenerator",
"id": "cc09c3d534e70a100696a056dd1fba2133e750f3",
"size": "1256",
"bin... |
import bvpl_batch
import time
import os
#time.sleep(30);
bvpl_batch.register_processes();
bvpl_batch.register_datatypes();
class dbvalue:
def __init__(self, index, type):
self.id = index # unsigned integer
self.type = type # string
find_corners = 1;
pair_corners = 1;
save_corners_vrml = 1;
save_pairs_... | {
"content_hash": "aafe740a50623929368e76b3444f187c",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 96,
"avg_line_length": 35.15822784810127,
"alnum_prop": 0.70999099909991,
"repo_name": "mirestrepo/voxels-at-lems",
"id": "92db0d3bc89083abaffbe40a72089b7d31ff7295",
"size... |
"""
pyrseas.dbobject.textsearch
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This defines eight classes: TSConfiguration, TSDictionary,
TSParser and TSTemplate derived from DbSchemaObject, and
TSConfigurationDict, TSDictionaryDict, TSParserDict and
TSTemplateDict derived from DbObjectDict.
"""
from pyrseas.dbob... | {
"content_hash": "78055a8211e460db29d91a7123b878bd",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 98,
"avg_line_length": 38.86165048543689,
"alnum_prop": 0.5476859658984449,
"repo_name": "reedstrm/Pyrseas",
"id": "ba70d1f8c7f8dfbe5c53df358738d671b65dc337",
"size": "160... |
from datetime import datetime
import numpy as np
import pytest
from pandas import DataFrame, Series
from pandas.core.indexes.datetimes import date_range
from pandas.core.indexes.period import period_range
# The various methods we support
downsample_methods = [
"min",
"max",
"first",
"last",
"sum"... | {
"content_hash": "34cee9f80e476261b2f8d113495459b1",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 87,
"avg_line_length": 24.696428571428573,
"alnum_prop": 0.6861894432393347,
"repo_name": "jreback/pandas",
"id": "cb62263b885aa49601729256d34313afdf951092",
"size": "4149... |
from .errors import APIError
from .auth import Mac
from .client import Client
from .urls import rtmp_publish_url, rtmp_play_url, hls_play_url, hdl_play_url, snapshot_play_url
import conf | {
"content_hash": "c8d40270c11d733866e092d3c6471836",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 96,
"avg_line_length": 37.2,
"alnum_prop": 0.7903225806451613,
"repo_name": "fancl20/pili-python",
"id": "ecae01ada803bc5689acf8db479d3a721cd81a26",
"size": "186",
"binary... |
import Q.lua_executor as executor
import Q.utils as util
from Q import constants as q_consts
from Q.p_vector import PVector
from Q.p_reducer import PReducer
from Q.p_scalar import PScalar
import math
def call_lua_op(op_name, *args):
"""
this functions calls the given Q-lua function with specified arguments
... | {
"content_hash": "9e2009f34db13be18230631465cddb21",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 76,
"avg_line_length": 26.99173553719008,
"alnum_prop": 0.6227801592161666,
"repo_name": "NerdWalletOSS/Q",
"id": "71edbd4da5085bd8fdf750fb1eb957ce0851e35a",
"size": "3266... |
"""
SlipStream Client
=====
Copyright (C) 2013 SixSq Sarl (sixsq.com)
=====
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required ... | {
"content_hash": "4b5a29bc840f02b9cd0e525ca2788f09",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 31.17948717948718,
"alnum_prop": 0.6998355263157895,
"repo_name": "slipstream/SlipStreamClient",
"id": "781a07e932df37dce95196ffbbfa1ca4a78cfacb",
"s... |
"""Implements PatchCamelyon data class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import task_adaptation.data.base as base
from task_adaptation.registry import Registry
import tensorflow_datasets as tfds
@Registry.register("data.patch_camelyon", "... | {
"content_hash": "228558d01acd31e531f40ea87676547d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 37.51020408163265,
"alnum_prop": 0.6550598476605005,
"repo_name": "google-research/task_adaptation",
"id": "4f495881065e63c21b5db62ea9ee70b07f370046",
... |
"""A module that provides rapt authentication errors."""
class ReauthError(Exception):
"""Base exception for reauthentication."""
pass
class HttpAccessTokenRefreshError(Exception):
"""Error (with HTTP status) trying to refresh an expired access token."""
def __init__(self, message, status=None):
... | {
"content_hash": "bd965666e51664cf533423dcdd903aea",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 79,
"avg_line_length": 33.40816326530612,
"alnum_prop": 0.6603543066585217,
"repo_name": "kawamon/hue",
"id": "06e99cbabdde3ce732b6f1eaa47b6a8b4987d3c2",
"size": "2234",
... |
import numpy as np
class mlp:
""" A Multi-Layer Perceptron"""
def __init__(self,inputs,targets,nhidden,outtype='linear',hidtype='logistic'):
""" Constructor """
# Set up network size
self.nin = np.shape(inputs)[1]
self.nout = np.shape(targets)[1]
self.ndata = np.sha... | {
"content_hash": "a2d8c548d14e5b330320689b1127042c",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 108,
"avg_line_length": 40.103092783505154,
"alnum_prop": 0.5634961439588689,
"repo_name": "garibaldu/multicauseRBM",
"id": "4d4c16326251c42c3689aeb85dfe55ec78a65dcf",
"siz... |
import numpy as np
from onnx.reference.op_run import OpRun
class Gather(OpRun):
def _run(self, x, indices, axis=None): # type: ignore
if not x.flags["C_CONTIGUOUS"]:
x = np.ascontiguousarray(x)
if not indices.flags["C_CONTIGUOUS"]:
indices = indices.ascontiguousarray()
... | {
"content_hash": "7ce10f055bf42b27af45c83a8ae26475",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 64,
"avg_line_length": 33.55555555555556,
"alnum_prop": 0.5827814569536424,
"repo_name": "onnx/onnx",
"id": "0528f21f29552ddd742fff5b8d3ebc8e6ae8336e",
"size": "667",
"bi... |
"""
print_settings
==============
Django command similar to 'diffsettings' but shows all active Django settings.
"""
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from optparse import make_option
class Command(BaseCommand):
"""print_settings command"""
h... | {
"content_hash": "70dd88bcadc9fcc385f715b710400989",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 78,
"avg_line_length": 28.575,
"alnum_prop": 0.55249343832021,
"repo_name": "edisonlz/fruit",
"id": "9a4f938c26a018a533700ac8416fea6c7b4f9a1e",
"size": "2286",
"binary": ... |
'''Tests for connection objects.'''
__author__ = 'Mark Roach (mrroach@google.com)'
import unittest
import urllib.request, urllib.error, urllib.parse
from io import StringIO
from pyactiveresource import connection
from pyactiveresource import util
from pyactiveresource.tests import http_fake
class Error(Exception):... | {
"content_hash": "670fefbe190239e01c0605be3a6fb282",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 91,
"avg_line_length": 38.88944723618091,
"alnum_prop": 0.6260498772451221,
"repo_name": "PiratenBayernIT/pyactiveresource",
"id": "ee93fffef92e527cc82e0fc2de5b347cae096d60"... |
"""Manager to read and modify config data in JSON files."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import errno
import glob
import io
import json
import os
import copy
from traitlets.config import LoggingConfigurable
from traitlets.traitlets import Unicod... | {
"content_hash": "064dcd375fb4b0f641b37ad735295233",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 102,
"avg_line_length": 34.696969696969695,
"alnum_prop": 0.6063318777292577,
"repo_name": "sserrot/champion_relationships",
"id": "a15c2454b6743efb9ba1049d4cda4a9baad421d9"... |
class WKTAdapter(object):
"""
This provides an adaptor for Geometries sent to the
MySQL and Oracle database backends.
"""
def __init__(self, geom):
self.wkt = geom.wkt
self.srid = geom.srid
def __eq__(self, other):
if not isinstance(other, WKTAdapter):
... | {
"content_hash": "b86b2164e3b7e1e63d634c79fff4dedd",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 64,
"avg_line_length": 27.736842105263158,
"alnum_prop": 0.5578747628083491,
"repo_name": "yephper/django",
"id": "6d3212f928c2a86fa2d854d8ba31b91e2005a47e",
"size": "527",... |
"""This module contains Splittable DoFn logic that is specific to DirectRunner.
"""
# pytype: skip-file
import uuid
from threading import Lock
from threading import Timer
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterable
from typing import Optional
import apache_beam as beam
from ap... | {
"content_hash": "822d1e95152da5296d579f3c5ed57f1e",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 80,
"avg_line_length": 37.855287569573285,
"alnum_prop": 0.7102528915898844,
"repo_name": "axbaretto/beam",
"id": "381394ef7221bb4d0fdd5639cc8292a385493181",
"size": "2118... |
"""
Copyright (c) 2013 Rodrigo Baravalle
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following... | {
"content_hash": "1b720566efbe1432e8dfce0b383d9619",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 108,
"avg_line_length": 35.472636815920396,
"alnum_prop": 0.5570827489481066,
"repo_name": "rbaravalle/imfractal",
"id": "7562343c57fe08bd4b58ab4123eb72c691112db0",
"size"... |
import re
import warnings
import numpy as np
from matplotlib import rcParams
from astropy import units as u
from astropy.units import UnitsError
from astropy.coordinates import Angle
DMS_RE = re.compile('^dd(:mm(:ss(.(s)+)?)?)?$')
HMS_RE = re.compile('^hh(:mm(:ss(.(s)+)?)?)?$')
DDEC_RE = re.compile('^d(.(d)+)?$')
D... | {
"content_hash": "02e94870bc358e2df65d9af130542877",
"timestamp": "",
"source": "github",
"line_count": 571,
"max_line_length": 125,
"avg_line_length": 36.32749562171629,
"alnum_prop": 0.5153545774478138,
"repo_name": "dhomeier/astropy",
"id": "de95471cf5cb3d54c2d5b06e1cae26f015351178",
"size": "21... |
import sys
from nose.plugins.skip import SkipTest
sys.path[0:0] = [""]
import datetime
import unittest
import uuid
import math
import itertools
import re
try:
import dateutil
except ImportError:
dateutil = None
from decimal import Decimal
from bson import Binary, DBRef, ObjectId
from mongoengine import *
... | {
"content_hash": "59f39424a922b2381db7592ed863b6e5",
"timestamp": "",
"source": "github",
"line_count": 3755,
"max_line_length": 113,
"avg_line_length": 32.20825565912117,
"alnum_prop": 0.5828082882704106,
"repo_name": "starsirius/mongoengine",
"id": "fd083c7306a165a51a819a3271d9ece90eed82fc",
"siz... |
"""
BaseModel for database models
"""
from peewee import Model, SqliteDatabase
DATABASE = SqliteDatabase('/var/www/sourcemon/sourcemon.db')
class BaseModel(Model):
"""
BaseModel for database models
"""
def database(self):
"""
Returns database connection
"""
... | {
"content_hash": "d3a76ee8adcf1a0b83e2c5dbfa3d67fe",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 60,
"avg_line_length": 18.391304347826086,
"alnum_prop": 0.5602836879432624,
"repo_name": "michaelimfeld/sourcemon",
"id": "85868155ecd704ef80ba07688b273e15761b0def",
"size... |
import datetime
import json
import queue
import decimal
import uuid
import inspect
import distutils.util
import time
import argparse
import boto3
import ibapi.wrapper
from botocore.exceptions import ClientError
from ibapi import (comm)
from ibapi.client import EClient
from ibapi.common import *
from ibapi.contract impo... | {
"content_hash": "2d474a24224abae56272edbba9e8a675",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 120,
"avg_line_length": 40.46010638297872,
"alnum_prop": 0.5768093078288306,
"repo_name": "th3sys/capsule",
"id": "d86c6311bfcc91c859d07dc9a2ae2f41c915cde0",
"size": "1521... |
import dataclasses
from typing import Optional
from mobile_seg.const import EXP_DIR
from mylib.params import ParamsMixIn
@dataclasses.dataclass(frozen=True)
class TrainerParams(ParamsMixIn):
num_tpu_cores: Optional[int] = None
gpus: Optional[int] = None
epochs: int = 100
resume_from_checkpoint: Optio... | {
"content_hash": "18fe648e771d2ac5ad194fab2333e44b",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 48,
"avg_line_length": 21.94,
"alnum_prop": 0.5902461257976299,
"repo_name": "akirasosa/mobile-semantic-segmentation",
"id": "1120a9243acb024f5264802a3ff8134fd3796f0d",
"s... |
from frigg.builds.filters import BuildPermissionFilter
from frigg.builds.models import Build
from frigg.utils.tests import FiltersTestCase
class BuildsFilterTests(FiltersTestCase):
fixtures = FiltersTestCase.fixtures + ['frigg/builds/fixtures/test_permitted_objects.yaml']
def test_build_permitted_objects(sel... | {
"content_hash": "3786917842f9c80f01c11fc14d42bbf7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 95,
"avg_line_length": 39.7,
"alnum_prop": 0.7884130982367759,
"repo_name": "frigg/frigg-hq",
"id": "a8422b96217c0b9d03e9b93025a5ab4372e6a4f4",
"size": "397",
"binary": f... |
from sqlalchemy.orm import sessionmaker
from models import News, Jobs, db_connect
NEWS_SPIDERS = ["mediationworld", "mediatedotcom", "sciencedaily", "undotorg"]
JOBS_SPIDERS = ["findaphd", "dmejobs", "unjobs", "unpeacejobs"]
class NewsPipeline(object):
def __init__(self):
"""
Initializes databa... | {
"content_hash": "86bd354ebf9515472bcbe8f6df5faa40",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 85,
"avg_line_length": 28.51388888888889,
"alnum_prop": 0.5207014125669751,
"repo_name": "sebastianlees/Conflict-Gateway",
"id": "f0939d804cc1d71ede026ad9ece4c6f6d585f173",
... |
import datetime
from rqalpha.interface import AbstractEventSource
from rqalpha.events import Event, EVENT
from rqalpha.utils import get_account_type
from rqalpha.utils.exception import CustomException, CustomError, patch_user_exc
from rqalpha.utils.datetime_func import convert_int_to_datetime
from rqalpha.const import... | {
"content_hash": "3766bf19fbbbdb0b3d412301b4857cf9",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 110,
"avg_line_length": 46.838509316770185,
"alnum_prop": 0.5488661981169606,
"repo_name": "zhengwsh/InplusTrader_Linux",
"id": "d0c72195ce64e70f08449f56391051b7b7bcdc3c",
... |
"""
sql Module provide database-relevant functions
Required Library
- sys
- time
- MySQLdb
- pymssql
TODO:
-
"""
import sys
import time
import datetime
from sre_compile import isstring
reload(sys)
sys.setdefaultencoding("utf-8")
class DB:
def __init__(self, config):
self.con... | {
"content_hash": "c53d4bb9ed69b7884b91feafafa796ad",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 121,
"avg_line_length": 31.477678571428573,
"alnum_prop": 0.450148915047511,
"repo_name": "yan9yu/lib",
"id": "4c7c40846873e7b62f09178a16ee6dfa391cc262",
"size": "7114",
... |
import itertools
import functools
import operator
import warnings
from distutils.version import LooseVersion
import numpy as np
from pandas import compat
from pandas._libs import tslib, algos, lib
from pandas.core.dtypes.common import (
_get_dtype,
is_float, is_scalar,
is_integer, is_complex, is_float_dtyp... | {
"content_hash": "dae6ad246cf4b17988488c8f02c819f9",
"timestamp": "",
"source": "github",
"line_count": 819,
"max_line_length": 79,
"avg_line_length": 29.520146520146522,
"alnum_prop": 0.5791454688340159,
"repo_name": "Winand/pandas",
"id": "388b2ecdff445de3c81374ead3038f0c305512fe",
"size": "24177... |
_UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args'
class Parent(object):
def __init__(self):
pass
def parse(self):
vars(self).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
class Child(Parent):
def __init__(self):
self._cli = {}
def parse(self):
super(Child, self).parse()
... | {
"content_hash": "b075770e94ccd8b29ad37dd32e2c0f91",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 67,
"avg_line_length": 26.205128205128204,
"alnum_prop": 0.5283757338551859,
"repo_name": "ronaldbradford/os-demo",
"id": "f6b26605b99a0627b67df07c91b3be873928b122",
"size"... |
from google.analytics import admin_v1beta
async def sample_search_change_history_events():
# Create a client
client = admin_v1beta.AnalyticsAdminServiceAsyncClient()
# Initialize request argument(s)
request = admin_v1beta.SearchChangeHistoryEventsRequest(
account="account_value",
)
#... | {
"content_hash": "1ea8f568e71fd236e517236c348fd5fc",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 93,
"avg_line_length": 29.7,
"alnum_prop": 0.7441077441077442,
"repo_name": "googleapis/python-analytics-admin",
"id": "af023f8e951b3ee98766f41ee5a3340f71dbb81a",
"size": "... |
import unittest
import uuid
import re
import string
import random
from urllib3 import HTTPResponse
from datetime import datetime
from tests.compat import mock
try:
from kubernetes.client.rest import ApiException
from airflow import configuration
from airflow.configuration import conf
from airflow.execu... | {
"content_hash": "02af5332d31ccc1685a3fbadffdc0e77",
"timestamp": "",
"source": "github",
"line_count": 681,
"max_line_length": 105,
"avg_line_length": 45.80469897209985,
"alnum_prop": 0.5968646811784696,
"repo_name": "r39132/airflow",
"id": "a19e36b7f5ad7583ade861365146cd45c4fa800e",
"size": "3198... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Authenticator', fields ['user', 'type']
db.create_unique('auth_aut... | {
"content_hash": "2f496777b4f34ac8eb643f57d5d115b3",
"timestamp": "",
"source": "github",
"line_count": 644,
"max_line_length": 217,
"avg_line_length": 88.80590062111801,
"alnum_prop": 0.5732545330559004,
"repo_name": "JackDanger/sentry",
"id": "7e5696b303e734db93d45aedbdcd51b3f8b009cb",
"size": "5... |
from ...utils import verbose
from ..utils import (_data_path_doc,
_get_version, _version_doc, _download_mne_dataset)
@verbose
def data_path(path=None, force_update=False, update_path=True, download=True,
verbose=None): # noqa: D103
return _download_mne_dataset(
name='fi... | {
"content_hash": "cb3ffa080c8cc01119c6767dae47379c",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 30.91304347826087,
"alnum_prop": 0.6582278481012658,
"repo_name": "bloyl/mne-python",
"id": "f435ef57cfddeee91f5d4c3404180297c616d4f7",
"size": "849"... |
import cv2
import cv2.cv as cv
import numpy as np
import signal, os, subprocess, sys
import time
import threading
import requests
import io
from picamera.array import PiRGBArray
from picamera import PiCamera
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
from fractions import Fraction
#
GPIO.setup(18, GPIO.OUT)
ca... | {
"content_hash": "ad67f837095f553e286c2df38453d0b3",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 97,
"avg_line_length": 22.261904761904763,
"alnum_prop": 0.658288770053476,
"repo_name": "Cornell-iGEM/iGEM-Detection",
"id": "ed767af023726b891709db32c9714b005b010205",
"s... |
from collections import namedtuple
import os
# third party
from sklearn import datasets
from tabulate import tabulate
HousingData = namedtuple("HousingData", 'features prices names'.split())
def load_housing_data():
"""
Convenience function to get the Boston housing data
:return: housing_features, housing... | {
"content_hash": "d4bb49c777fa4d8bb88cc1de1d581c6b",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 118,
"avg_line_length": 36.45662100456621,
"alnum_prop": 0.5388276553106213,
"repo_name": "necromuralist/boston_housing",
"id": "9b7d10c8c4c95f8baab3c023f0f672b30ad0c073",
... |
from django.core.management.base import BaseCommand
from pyquery import PyQuery
from olympia.applications.models import AppVersion
from olympia.constants.applications import APP_GUIDS
class Command(BaseCommand):
help = "Import the application versions created on addons.mozilla.org."""
def handle(self, *arg... | {
"content_hash": "bb55d4b70e3fe5c6794e92f1fc3e72e2",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 78,
"avg_line_length": 38.391304347826086,
"alnum_prop": 0.6183465458663646,
"repo_name": "Prashant-Surya/addons-server",
"id": "9179c8c51debf1869caac8b864537f8af7c8df09",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.