text stringlengths 4 1.02M | meta dict |
|---|---|
from AWSApiModule import *
import importlib
import pytest
AWS_EC2 = importlib.import_module("AWS-EC2")
VALID_ARGS = {"groupId": "sg-0566450bb5ae17c7d",
"IpPermissionsfromPort": 23,
"IpPermissionsToPort": 23,
"IpPermissionsIpProtocol": "TCP",
"region": "reg",
... | {
"content_hash": "a9251b3a78bc90d450a4cd51b609ec85",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 115,
"avg_line_length": 35.160493827160494,
"alnum_prop": 0.6260533707865169,
"repo_name": "demisto/content",
"id": "41189e2007691205977b92f8e68bf0becddaad60",
"size": "284... |
u"""
Copyright (c) 2016 Masaru Morita
This software is released under the MIT License.
See LICENSE file included in this repository.
"""
import random
import copy
import sys
sys.path.append('..')
from DeepNeuralNetworks.DenoisingAutoencoders import DenoisingAutoencoders
from SingleLayerNeuralNetworks.LogisticRegres... | {
"content_hash": "191b367a22c6af4e606db9663cbbdc37",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 128,
"avg_line_length": 46.09495548961424,
"alnum_prop": 0.5755761555298056,
"repo_name": "MoriKen254/DeepLearningWithPython",
"id": "74fe4077dec11fd89d58cf5a1cf7012fefc13e5... |
"""Retrieves CUDA compute capability from NVIDIA webpage and creates a `.csv`.
This script should be run in the root directory of `tensorflow_builder/`
(or relatively `../data/`).
This module is mainly written to supplement for `../config_detector.py`
which retrieves CUDA compute capability from existing golden file.... | {
"content_hash": "8950221174b067ba90f010619079ccd4",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 79,
"avg_line_length": 28.07296137339056,
"alnum_prop": 0.6376700810273659,
"repo_name": "alsrgv/tensorflow",
"id": "a0945d6e2ae5b8bd0088c58735a1577ca622c7d4",
"size": "72... |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-NetDomainController',
'Author': ['@harmj0y'],
'Description': ('Returns the domain controllers for the current domain or '
'the... | {
"content_hash": "f3ea39364459bb3c29fa28166ad8e49d",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 116,
"avg_line_length": 33.656565656565654,
"alnum_prop": 0.4774909963985594,
"repo_name": "rvazarkar/Empire",
"id": "6fdcf51620ac634911b0b50035ec3675a8adcdb5",
"size": "33... |
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.exceptions import ObjectDoesNotExist
from rest_framework.authtoken.models import Token
from datetime import tim... | {
"content_hash": "1029f6bfa246264e9692054ce755786b",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 94,
"avg_line_length": 35.01960784313726,
"alnum_prop": 0.6413773796192609,
"repo_name": "zserg/flashcard",
"id": "fb87a80cf9aa48a19de1cc7054edb9d4492c0de3",
"size": "3572... |
import multiprocessing # noqa # stop tests breaking tox
from setuptools import find_packages, setup
import tvrenamr
def long_desc():
with open('README.rst') as f:
readme = f.read()
with open('CHANGELOG.rst') as f:
changelog = f.read()
return readme + '\n\n' + changelog
setup(
nam... | {
"content_hash": "c24ff9db5d85cfc28deb925cea4a40c3",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 68,
"avg_line_length": 30.74418604651163,
"alnum_prop": 0.6059001512859304,
"repo_name": "wintersandroid/tvrenamr",
"id": "924c718a6cdb6d8293f34c03d5d2851ab4d83cdd",
"size"... |
import pytest
import unittest
from modules.sfp_openbugbounty import sfp_openbugbounty
from sflib import SpiderFoot
from spiderfoot import SpiderFootEvent, SpiderFootTarget
@pytest.mark.usefixtures
class TestModuleIntegrationOpenbugbounty(unittest.TestCase):
@unittest.skip("todo")
def test_handleEvent(self):... | {
"content_hash": "09cbd31b541edec65d45d3a9b51eacba",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 81,
"avg_line_length": 27.8125,
"alnum_prop": 0.6820224719101123,
"repo_name": "smicallef/spiderfoot",
"id": "9f30bb395e13a6171b0b6939d53196f8433fffb3",
"size": "890",
"b... |
"""
Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
plugin.
These tests are currently only supported when running against Darwin
targets.
"""
import lldb
from lldbsuite.test import decorators
from lldbsuite.test import lldbtest
from lldbsuite.test import darwin_log
class TestDarwinLogFi... | {
"content_hash": "557f159ae861f40c82613b7bd085bf15",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 115,
"avg_line_length": 36.024193548387096,
"alnum_prop": 0.5777927020371614,
"repo_name": "endlessm/chromium-browser",
"id": "f65b6fc55a942d1ba4b07d8245467c5c0cff8405",
"... |
def getXpathFirst(extract, default=None):
if extract:
return extract[0]
else:
return default
| {
"content_hash": "e79d3ed3506eb784176423516be7acfd",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 41,
"avg_line_length": 23.4,
"alnum_prop": 0.6324786324786325,
"repo_name": "myhearter/dianping",
"id": "0dd5773d0330ccb8f05addab87d038978d97e7aa",
"size": "246",
"binary"... |
import unittest
from flexmock import flexmock_teardown
from tests.dell import enable, configure, configuring_vlan, unconfigure_vlan, \
ssh_protocol_factory, telnet_protocol_factory
from tests.util.protocol_util import with_protocol
class DellConfigureTest(unittest.TestCase):
__test__ = False
protocol_fa... | {
"content_hash": "9c7bbd340da99bdf5977dfe82077469c",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 79,
"avg_line_length": 22.797752808988765,
"alnum_prop": 0.5795958600295712,
"repo_name": "mlecours/fake-switches",
"id": "cd14048d5a1adc709fe3a2c11b581bc568007614",
"size"... |
"""
Classes and methods related to user handling in Horizon.
"""
import logging
from django.utils.translation import ugettext as _
from horizon import api
from horizon import exceptions
LOG = logging.getLogger(__name__)
def get_user_from_request(request):
""" Checks the current session and returns a :class:`... | {
"content_hash": "716dfb5e331c599521d506cf8bae1d85",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 79,
"avg_line_length": 31.820689655172412,
"alnum_prop": 0.6090160381447768,
"repo_name": "asomya/test",
"id": "6e6be8e5a1d4f7c32df2f6a6b1a6a779801ca7e0",
"size": "5422",
... |
import synapseclient, os, subprocess, pybedtools
syn = synapseclient.login()
mergedGTF_entity = syn.get(entity='syn2338565', downloadLocation = os.getcwd())
#ENSGv70_entity = syn.get(entity='syn2215531', downloadLocation = os.getcwd())
mergedGTF = pybedtools.BedTool(mergedGTF_entity.path)
#ENSGv70_exons = pybedtool... | {
"content_hash": "a6e30aeef86645fd35d809f43d9dbbf0",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 168,
"avg_line_length": 54.61904761904762,
"alnum_prop": 0.7053182214472538,
"repo_name": "kkdang/sage-data-analysis",
"id": "d38b96a6b01fc56f8d0cc640d4f4d56ad5a0f621",
"si... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('slave', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Skill',
fields=[
... | {
"content_hash": "6fdce17966c03669435307228bd9e1fb",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 153,
"avg_line_length": 37.30232558139535,
"alnum_prop": 0.5511221945137157,
"repo_name": "ngr/sm_00",
"id": "6466a6d8f887c39d492c58a71c9ad0a7738b3bcd",
"size": "1628",
"... |
import itertools
from collections import defaultdict
from collections import namedtuple
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class keydefaultdict(defaultdict):
"""Inherit defaultdict class to customize default_factory.
Override __missing__ method to construct custom object... | {
"content_hash": "a25a48fcd1bcfea230e4324f2110c3c8",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 77,
"avg_line_length": 28.54140127388535,
"alnum_prop": 0.6049988841776389,
"repo_name": "openstack/networking-bagpipe-l2",
"id": "4ef29c4874a058851be42b3e515d008737f14c06",... |
from changes.testutils import APITestCase
class ClusterIndexTest(APITestCase):
def test_simple(self):
cluster_1 = self.create_cluster(label='bar')
cluster_2 = self.create_cluster(label='foo')
path = '/api/0/clusters/'
resp = self.client.get(path)
assert resp.status_code ==... | {
"content_hash": "30d2fc4b1749af274ee8eb40a75486cf",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 52,
"avg_line_length": 32.733333333333334,
"alnum_prop": 0.6130346232179226,
"repo_name": "alex/changes",
"id": "85370991e2504efa59dfb97f0755e59b07004f24",
"size": "491",
... |
import pbr.version
version_info = pbr.version.VersionInfo('python-ironic-inspector-client')
"""Installed package version."""
| {
"content_hash": "635be3604b09aaa8c9d33e44491876db",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 31.5,
"alnum_prop": 0.7777777777777778,
"repo_name": "openstack/python-ironic-inspector-client",
"id": "b0189b2cdcce0363e0429f8d146c62c32305979b",
"si... |
from django.conf import settings
from crispy_forms.layout import Div
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import gettext as _
from geotrek.common.forms import CommonForm
from geotrek.outdoor.models import RatingScale, Site, Course, OrderedCourseChild
... | {
"content_hash": "259c2f552e0e021a877407d36594ae19",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 160,
"avg_line_length": 43.73504273504273,
"alnum_prop": 0.5656634746922025,
"repo_name": "GeotrekCE/Geotrek-admin",
"id": "3bcd47e61bab068e560c21bf2f5f3077ba50f10d",
"siz... |
import logging
import tornado.auth
import tornado.escape
import tornado.ioloop
import tornado.web
import os.path
import uuid
from tornado import gen
from tornado.options import define, options, parse_command_line
define("port", default=8888, help="run on the given port", type=int)
class MessageBuffer(object):
d... | {
"content_hash": "c6bc79a0e8e1d6ff70d676ceb89a0367",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 78,
"avg_line_length": 31.380281690140844,
"alnum_prop": 0.6036804308797128,
"repo_name": "Nirlendu/Dummy-Search-Engine",
"id": "a8f5bb81f9c2d36eddefa9d6422bd824d1a1978a",
... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
from distutils.sysconfig import get_python_lib
PYTHON_LIB = os.path.relpath(get_python_lib(), sys.prefix)
if __name__ == '__main__':
print(PYTHON_LIB)
| {
"content_hash": "0a797e440b3a1fb606a3f0ee6e85b4b4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 58,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.722972972972973,
"repo_name": "Yelp/venv-update",
"id": "4c4af1a7b7c9e3702cbe3eadae9af51c64a63272",
"size": "318"... |
import re
def build_match_apply_fns(pattern_group):
pattern, search, replace = pattern_group
match_fn = lambda noun: re.search(pattern, noun)
apply_fn = lambda noun: re.sub(search, replace, noun)
return (match_fn, apply_fn)
patterns = (('[sxz]$', '$', 'es'),
('[^aeioudgkprt]h$', '$', 'es')... | {
"content_hash": "056761ce0a7aab622ea5513eab017ddf",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 95,
"avg_line_length": 28.864864864864863,
"alnum_prop": 0.5149812734082397,
"repo_name": "jmcguire/learning",
"id": "670ec15c94cd39382d28a47a2b71751e87cc485e",
"size": "10... |
import time
import socket
import struct
import codecs
import functools
def version_controlled(version):
"""
Wraps a function for version control:
This way we do not have to worry about reading too little if the structure has been extended.
"""
def decorator(func):
@functools.wraps(func)
... | {
"content_hash": "5148ef94e6be9eb9be10ba986c1f9946",
"timestamp": "",
"source": "github",
"line_count": 1945,
"max_line_length": 165,
"avg_line_length": 32.681233933161955,
"alnum_prop": 0.570250924250767,
"repo_name": "lamperi/pokemon-online-protocol",
"id": "b63fe72040752546819f029627360fae9a9f8369... |
import sys
import os
import time
import string
import __builtin__
from panda3d.core import *
from direct.showbase.MessengerGlobal import *
from direct.showbase.DirectObject import DirectObject
from direct.showbase.EventManagerGlobal import *
from direct.task.MiniTask import MiniTask, MiniTaskManager
from direct.directn... | {
"content_hash": "6ebe2a719d6956fc588c5a07df683742",
"timestamp": "",
"source": "github",
"line_count": 1870,
"max_line_length": 297,
"avg_line_length": 45.70160427807487,
"alnum_prop": 0.6295897591912195,
"repo_name": "ToontownUprising/src",
"id": "8e84e33c659e3f3de96bc7ef8ae5236a0932b13f",
"size"... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/naboo/shared_waterfall_mist_small.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "ca3b698c4dbaf616e854f33bfbe585ff",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 23.153846153846153,
"alnum_prop": 0.6910299003322259,
"repo_name": "anhstudios/swganh",
"id": "17d7255cbbb432149d81e3d2ed2397560ad84b21",
"size": "44... |
import json
import os
SERIAL_DIRECTORY = "/dev/serial/by-id/"
class BaseCommand(object):
def execute(self, gcon, data):
return {"error" : "Not yet implemented"}
class CommandListSerial(BaseCommand):
def execute(self, gcon, data):
if os.path.exists(SERIAL_DIRECTORY):
serialdevices... | {
"content_hash": "69218aecfcbf0a9285b090ba599f2b6e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 141,
"avg_line_length": 30.841269841269842,
"alnum_prop": 0.6376737004632013,
"repo_name": "laubed/gcon",
"id": "7ebdc4dd3c97ae8c48402be1cad87456ab42487d",
"size": "1967",
... |
import csv
from heapq import heappush, heappop
from random import sample, choice, shuffle, randint
from collections import OrderedDict
def read_data(filename):
with open(filename, 'r') as data_doc:
d = csv.reader(data_doc, delimiter=',')
return [list(map(lambda x: x.replace("'", ""), item)) for it... | {
"content_hash": "795a4b2af058881a8a97cb0e25db8edf",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 91,
"avg_line_length": 27.821428571428573,
"alnum_prop": 0.5858793324775353,
"repo_name": "mileto94/Data-Mining",
"id": "f10762a1e9968fd639b420f6d0bfd69c8ab319f9",
"size":... |
## Copyright (c) 2014 Citrix Systems, Inc. All Rights Reserved.
## You may only reproduce, distribute, perform, display, or prepare derivative works of this file pursuant to a valid license from Citrix.
import subprocess
def check_output(*popenargs, **kwargs):
if 'stdout' in kwargs:
raise ValueErro... | {
"content_hash": "4dd744841d9177aa60a8cfa71559ff58",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 138,
"avg_line_length": 42.25,
"alnum_prop": 0.672865595942519,
"repo_name": "chipchilders/migrate2cs",
"id": "5ca72da3e9f556f4db683911a77bbb2ba149b560",
"size": "1289",
... |
import yaml
from scadasim.fluids import *
from scadasim.devices import *
from scadasim.sensors import *
def parse_yml(path_to_yml_file):
config = None
with open(path_to_yml_file, 'r') as stream:
config = yaml.load(stream)
return config
def build_simulation(config):
settings = config['settings... | {
"content_hash": "bb47fbd08b1e4596e9144084a6b099e3",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 90,
"avg_line_length": 33.916666666666664,
"alnum_prop": 0.6351351351351351,
"repo_name": "sintax1/scadasim",
"id": "c9750c2c77c5425c17af31cb2327eeea81afd2f8",
"size": "162... |
'''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p
from OpenGL.GL import glget
EXTENSION_NAME = 'GL_ARB_texture_cube_map'
_p.unpack_constants( """GL_NORMAL_MAP_ARB 0x8511
GL_REFLECTION_MAP_ARB 0x8512
GL_TEXTURE_CUBE_MAP_ARB 0x8513
GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
GL_TE... | {
"content_hash": "386ccb6c313d7602df4ed451347c5985",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 71,
"avg_line_length": 41.52,
"alnum_prop": 0.7736030828516378,
"repo_name": "frederica07/Dragon_Programming_Process",
"id": "ddd9cea0b69f9b63aaf0779b69f02da9a72c3262",
"si... |
from django.core.management.base import BaseCommand, CommandError
from ionyse_contact.contact import flush_website
class Command(BaseCommand):
args = ''
help = 'Flush all the database'
def handle(self, *args, **options):
flush_website()
| {
"content_hash": "c5c04dd0402bccc3cdd6e488c4eb1dba",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 65,
"avg_line_length": 28.77777777777778,
"alnum_prop": 0.7142857142857143,
"repo_name": "Natim/ionyse-contact",
"id": "27647ec2ef91d340bfe3a517aaa6826ea898668c",
"size": "1... |
import importlib
import json
import os
import sys
sys.path.append(os.path.realpath('../modules'))
client_module = importlib.import_module('RestApiClient')
SampleUtilities = importlib.import_module('SampleUtilities')
def main():
# create the api client
client = client_module.RestApiClient(version='7.0')
... | {
"content_hash": "39f4263660b0df8609e09a2b8a05a2da",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 32.46478873239437,
"alnum_prop": 0.6104121475054229,
"repo_name": "ibm-security-intelligence/api-samples",
"id": "55d9004d30a84232607925dabed415cdbe2be... |
"""
Tests for epoll wrapper.
"""
import errno
import os
import select
import socket
import time
import unittest
from test import support
if not hasattr(select, "epoll"):
raise unittest.SkipTest("test works only on Linux 2.6")
try:
select.epoll()
except OSError as e:
if e.errno == errno.ENOSYS:
rai... | {
"content_hash": "399f84ec4cc1211e67125b8b6afa47a2",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 77,
"avg_line_length": 32.69915254237288,
"alnum_prop": 0.59504988985357,
"repo_name": "MalloyPower/parsing-python",
"id": "a7359e9c298082c28dca20936bc15fad86d2feda",
"siz... |
import itertools
import os
import inspect
from six import StringIO
def get_inputs_helper(step, ignore, target):
"""
Recursion helper used by get_inputs()
"""
outputs = set()
if not ignore and step.target == target:
outputs.add(step)
if ignore or not step.target:
for i in step... | {
"content_hash": "10b741b9eb30fff186ff151cad47e8a9",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 89,
"avg_line_length": 29.552845528455286,
"alnum_prop": 0.6415405777166437,
"repo_name": "potash/drain",
"id": "852008fbaf53d791b231ed1ae2be7cce7c8934db",
"size": "3635",... |
from django.views.generic import View,TemplateView
from django.http import JsonResponse, QueryDict
from opsweb.utils import GetLogger
from monitor.zabbix.client import cache_host, Zabbix, create_host, unlink_template, link_template
from resources.product.view import Ztree
from resources.server.models import Server... | {
"content_hash": "ec7466e5e398a5bb4864c3892eda9feb",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 103,
"avg_line_length": 37.6875,
"alnum_prop": 0.5590565690068178,
"repo_name": "mingziV5/opsweb_test",
"id": "c62737e1a3f8a765c860943ffd8bdc02a9152af8",
"size": "5581",
... |
from importlib import import_module
default_app_config = "config.apps.ConfigappConfig"
class _Config:
def __init__(self, caching=True, numeric=False):
self._use_cache = caching
self._numeric = numeric
def _ready(self):
self.__models = import_module("config.models")
def __... | {
"content_hash": "6227aa794a29fe4472efbaa5d7fb9c73",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 68,
"avg_line_length": 29.37704918032787,
"alnum_prop": 0.5608258928571429,
"repo_name": "baryon5/config",
"id": "e8e91c80b432bdfc7b141b86bb37a61f0f19e834",
"size": "1793",... |
from django.apps import AppConfig
class DiscussionsConfig(AppConfig):
name = 'discussions'
| {
"content_hash": "8edfc27220e87eb0153334db282eac60",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 35,
"avg_line_length": 24,
"alnum_prop": 0.78125,
"repo_name": "Udayraj123/dashboard_IITG",
"id": "1770b9f891e6b9a8cfba2a620f7183b4d67360cc",
"size": "96",
"binary": false... |
from oslo_config import cfg
from jacket.tests.compute.functional.api_sample_tests import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'compute.api.openstack.compute.legacy_v2.extensions')
class ServersIpsJsonTest(test_servers.ServersSampleBase):
sample_dir = 'server-ip... | {
"content_hash": "34e93a6c4a3e0b8f8921d149ca08a0df",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 75,
"avg_line_length": 36.26086956521739,
"alnum_prop": 0.6642685851318945,
"repo_name": "HybridF5/jacket",
"id": "92ce09411df44b71d1bbd27909591f6fec7536af",
"size": "1466"... |
"""Internet Relay Chat Utilities"""
from re import compile as compile_regex
from circuits.six import u
PREFIX = compile_regex("([^!].*)!(.*)@(.*)")
class Error(Exception):
"""Error Exception"""
def strip(s, color=False):
"""strip(s, color=False) -> str
Strips the : from the start of a string
... | {
"content_hash": "e70762a527cb1ea860ac88fdbcec99eb",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 20.928571428571427,
"alnum_prop": 0.5699658703071673,
"repo_name": "nizox/circuits",
"id": "bc3ddc99218a64b7c2b75100391f146357d65267",
"size": "2051"... |
"""Windows platform implementation."""
import errno
import os
import sys
import platform
import _psutil_mswindows
from _psutil_mswindows import ERROR_ACCESS_DENIED
from psutil.error import AccessDenied, NoSuchProcess, TimeoutExpired
from psutil._common import *
from psutil._compat import PY3, xrange, long
# Windows ... | {
"content_hash": "1de11d785fa49e8f8b6da10b2f7dfe3b",
"timestamp": "",
"source": "github",
"line_count": 415,
"max_line_length": 88,
"avg_line_length": 35.39277108433735,
"alnum_prop": 0.6067538126361656,
"repo_name": "ktan2020/legacy-automation",
"id": "aa57f87ef1035fb44db6cadb3f3c1a6e9f410eb7",
"s... |
"""Tests for stochastic graphs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib import distributions
from tensorflow.contrib.bayesflow.python.ops import stochastic_tensor
from tensorflow.contrib.bayesflow.python... | {
"content_hash": "cc676ced07f4f8030baf36f3c5264564",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 80,
"avg_line_length": 35.27922077922078,
"alnum_prop": 0.6709000552181116,
"repo_name": "handroissuazo/tensorflow",
"id": "7bdd0a3269c12bd5b3b14545b5e9493d31f0c2b7",
"siz... |
"""Various tests for querying the library database.
"""
from functools import partial
from unittest.mock import patch
import os
import sys
import unittest
from test import _common
from test import helper
import beets.library
from beets import dbcore
from beets.dbcore import types
from beets.dbcore.query import (None... | {
"content_hash": "066e977d16f4ba0be7360a63a048445b",
"timestamp": "",
"source": "github",
"line_count": 1087,
"max_line_length": 78,
"avg_line_length": 35.434222631094755,
"alnum_prop": 0.6002284705454735,
"repo_name": "beetbox/beets",
"id": "3c6d6f70a1ef070c91f807667a8e9b04e7015cbe",
"size": "3916... |
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import chainer
from chainer import functions as F
from chain... | {
"content_hash": "cf5f04be7c077851c47e739e1e613999",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 79,
"avg_line_length": 42.19521912350598,
"alnum_prop": 0.6095741667453498,
"repo_name": "toslunar/chainerrl",
"id": "e340750fa745d4fc19bf9a77aec06d66ca3b2e4d",
"size": "1... |
"""Test of Policy Engine For Tacker"""
import fixtures
import io
from unittest import mock
from urllib import request as urlrequest
from oslo_policy import policy as common_policy
from oslo_serialization import jsonutils as json
from oslo_utils import importutils
import tacker
from tacker.api.v1 import attributes
fr... | {
"content_hash": "9c63f344989e109e1a1b1731c67a378e",
"timestamp": "",
"source": "github",
"line_count": 542,
"max_line_length": 79,
"avg_line_length": 42.55719557195572,
"alnum_prop": 0.5832393999826585,
"repo_name": "stackforge/tacker",
"id": "8639070c0c7971fd3adbd35120a6d0aa089b6e10",
"size": "23... |
import sys
import os.path
import tempfile
from pip.req import parse_requirements
from setuptools import setup, find_packages
from distutils.command.install import install as _install
# create a temporary config file to hold a fake secret key
temp_cfg = tempfile.NamedTemporaryFile()
os.environ.setdefault('CLOTO_SETTIN... | {
"content_hash": "b382354d449877e6cc8d525f8e48047a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 119,
"avg_line_length": 38.56818181818182,
"alnum_prop": 0.6941661756040071,
"repo_name": "Fiware/cloud.Cloto",
"id": "952fefa6f4fb1f24909872cd41fb55c9c5af9112",
"size": "4... |
import unittest
import os
from collections import namedtuple
from conans.test.utils.tools import TestBufferConanOutput
from conans.paths import CONANFILE
from conans.client.deps_builder import DepsGraphBuilder
from conans.model.ref import ConanFileReference
from conans.model.options import OptionsValues, option_not_e... | {
"content_hash": "562bc4311d7162947fa3703e8ce31ff1",
"timestamp": "",
"source": "github",
"line_count": 1988,
"max_line_length": 121,
"avg_line_length": 38.787726358148895,
"alnum_prop": 0.6298275191285178,
"repo_name": "tivek/conan",
"id": "c12d51ff6e00ead5681a6fc320487a76de8426fc",
"size": "77110... |
from django.db import models
from reports.models import TipoPeriodo
class ZonaVentas(models.Model):
codigo = models.CharField(max_length=4, primary_key=True)
zona = models.CharField(max_length=50)
class Meta:
verbose_name = 'Zona de Ventas'
verbose_name_plural = 'Zonas de Ventas'
def ... | {
"content_hash": "64b0e6995ac4d5b6c2ac886429989889",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 84,
"avg_line_length": 31.49230769230769,
"alnum_prop": 0.6893014167073767,
"repo_name": "Teino1978-Corp/Teino1978-Corp-light_.gitignore",
"id": "80e0804e4f005f3180b8df5cdae... |
from django.db import connection, migrations, models
from django.db.migrations.state import ProjectState
from django.test import override_settings
from .test_operations import OperationTestBase
class AgnosticRouter:
"""
A router that doesn't have an opinion regarding migrating.
"""
def allow_migrate(... | {
"content_hash": "8caa261ea004584cd0bda4d5fe8d868e",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 101,
"avg_line_length": 40.538011695906434,
"alnum_prop": 0.6536353144835545,
"repo_name": "charettes/django",
"id": "e0c5a4d3c59be22af47669e4541955ee12331e21",
"size": "6... |
from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app
from flask.ext.login import UserMixin, AnonymousUserMixin
from .. import db, login_manager
class P... | {
"content_hash": "9c01d09d4371aea0d0d43b71b99ce2ba",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 73,
"avg_line_length": 32.55769230769231,
"alnum_prop": 0.6032191376255168,
"repo_name": "rahimnathwani/measure-anything",
"id": "b80b0d78aac4e50f3c8154469a284e23294cbcb2",
... |
import zeep
class EuromsgMailer(object):
"""
Provides a simple interface for sending an email over euro.message service.
"""
AUTHORIZATION_URL = "https://ws.euromsg.com/live/auth.asmx?wsdl"
POST_URL = "https://ws.euromsg.com/live/post.asmx?wsdl"
username = ""
password = ""
def __init... | {
"content_hash": "11ca878407a498da701e0ea0b8905d9d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 123,
"avg_line_length": 34.278688524590166,
"alnum_prop": 0.5719751315160211,
"repo_name": "nazmizorlu/python-euromsg",
"id": "84ed8f72d36d139866eeac4118fa6a1cb64328c9",
"s... |
import pymysql
import sys
import simplejson as json
# Returns MySQL database connection
def con_db(host, port, user, passwd, db):
try:
con = pymysql.connect(host=host, port=port, user=user, passwd=passwd, db=db)
except pymysql.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
s... | {
"content_hash": "549b7cec07001c484f9c2cf6fdcc067b",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 133,
"avg_line_length": 29.8375,
"alnum_prop": 0.5743611227482195,
"repo_name": "MonicaHsu/truvaluation",
"id": "6baddbf076701ff2a7cfab29d493d9039c68f470",
"size": "2387",
... |
import pyopencl as cl
import clutil
import numpy
class part2CL(clutil.CLProgram):
def loadData(self, pos_vbo, col_vbo, vel):
mf = cl.mem_flags
self.pos_vbo = pos_vbo
self.col_vbo = col_vbo
self.pos = pos_vbo.data
self.col = col_vbo.data
self.vel = vel
#Setu... | {
"content_hash": "3a8cc029cca1d77530ced9b50c26c962",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 96,
"avg_line_length": 38.027027027027025,
"alnum_prop": 0.5565031982942431,
"repo_name": "linan7788626/adventures_in_opencl",
"id": "deed42c22278d8e1f73279d2093a64258df62faf... |
from collections import defaultdict, OrderedDict
from bson import ObjectId
from django.shortcuts import render, redirect
from django.http import Http404
from django.views.decorators.http import require_http_methods
from billy.core import db, settings
from billy.utils import metadata
from billy.web.admin.decorators i... | {
"content_hash": "860c261d95634897a7e1c95a786f05a9",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 78,
"avg_line_length": 32.58709677419355,
"alnum_prop": 0.5678083547812315,
"repo_name": "mileswwatkins/billy",
"id": "79720e9b3f9f25f2220aa21e07122949a7088f87",
"size": "... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Subscription'
db.create_table('subscriptions_subscription', (
('id', self.gf('django.db.models.f... | {
"content_hash": "32aaf67a944e38a138018e2727d94506",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 182,
"avg_line_length": 62.053333333333335,
"alnum_prop": 0.5601633003867641,
"repo_name": "mjumbewu/django-subscriptions",
"id": "1d2914a23c4f6fa135169f7d0a50e039600a0202",
... |
import csv
import os
import re
import pytz
from datetime import datetime, timedelta
import requests
import lxml.html
from lxml.etree import tostring
from django.conf import settings
from django.utils import timezone
app_timezone = pytz.timezone(settings.TIME_ZONE)
def format_full_text(full_text):
'''
The sea... | {
"content_hash": "1319ff7e583f9b614d873a01aea14a29",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 136,
"avg_line_length": 34.953125,
"alnum_prop": 0.6776933392936969,
"repo_name": "datamade/la-metro-councilmatic",
"id": "3001be4cbdf5a617266c7a1d494958d1d0e6642b",
"size"... |
import getopt
import os
import sys
if __name__ == "__main__":
wd = os.path.dirname(__file__)
document_root = "."
user_max = 99
user_one = None
calendars = ("calendar.10", "calendar.100", "calendar.1000",)
options, args = getopt.getopt(sys.argv[1:], "n:d:o:")
for option, value in options:
... | {
"content_hash": "95c4125e16ee1ceafeffa5eea622517f",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 89,
"avg_line_length": 30.977272727272727,
"alnum_prop": 0.4746881878209831,
"repo_name": "red-hood/calendarserver",
"id": "36650a8eaee58fda1c0af0e42a4bf54a78fbc7af",
"size... |
from core.himesis import Himesis, HimesisPostConditionPattern
import cPickle as pickle
from uuid import UUID
class HMoveOneTraceLinkNoBackDiffRulesRHS(HimesisPostConditionPattern):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HMoveOneTraceLinkNoBackDiffRulesRHS.
... | {
"content_hash": "e481a8bc0c98513bedd0f53ce492a75d",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 132,
"avg_line_length": 49.854838709677416,
"alnum_prop": 0.5091394370753801,
"repo_name": "levilucio/SyVOLT",
"id": "2c52beb4909a7e3c7ea8e34110d023d6ab19cc53",
"size": "1... |
"""
This module implements memory BIO based TLS support. It is the preferred
implementation and will be used whenever pyOpenSSL 0.10 or newer is installed
(whenever L{twisted.protocols.tls} is importable).
@since: 11.1
"""
from __future__ import division, absolute_import
from zope.interface import implementer
from ... | {
"content_hash": "a155ab9ed2aaf44f9b8fce3946afea61",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 81,
"avg_line_length": 34.49812734082397,
"alnum_prop": 0.6685484746498751,
"repo_name": "EricMuller/mynotes-backend",
"id": "0eb331215464d0d911e1157db5194392cd6df2b1",
"s... |
from maze import Maze
import turtle
import sys
if __name__ == '__main__':
'''
This function uses Python's turtle library to draw a picture of the maze
given as an argument when running the script.
'''
# Create a maze based on input argument on command line.
testmaze = Maze( str(sys.argv[1]) )
... | {
"content_hash": "ee23883d0c59fdbb16494a7656b994b5",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 76,
"avg_line_length": 33.793103448275865,
"alnum_prop": 0.5418367346938775,
"repo_name": "naokishibuya/micro-mouse",
"id": "139d72665c9e7a7ad2f142394956fb404c48200d",
"siz... |
import string
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import fields
from django.contrib.auth.models import User
from bookmarks import managers
class Bookmark(models.Model):
"""
A user's bookmark for a content object.
This ... | {
"content_hash": "573af281d9d28149749df2a00d431a0d",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 77,
"avg_line_length": 29.214285714285715,
"alnum_prop": 0.6710133116001087,
"repo_name": "gradel/django-generic-bookmarks",
"id": "b67a544f4e782b04aa42c28a3cfaf2ac72cf53bf"... |
"""Clustal Omega is a multiple sequence alignment program that uses seeded
guide trees and HMM profile-profile techniques to generate alignments between
three or more sequences.
"""
from Bio.Align.Applications import ClustalOmegaCommandline
from Bio.Application import ApplicationError
from OrthoEvol.Tools.logit import... | {
"content_hash": "efc6fbccf52387f528340a80f8703bda",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 79,
"avg_line_length": 42.2,
"alnum_prop": 0.4971994829814735,
"repo_name": "datasnakes/Datasnakes-Scripts",
"id": "baa651e3c88a19b431f9740b987a3fda03858172",
"size": "2321... |
from django.conf.urls import re_path
from api.identifiers import views
app_name = 'osf'
urlpatterns = [
re_path(r'^(?P<identifier_id>\w+)/$', views.IdentifierDetail.as_view(), name=views.IdentifierDetail.view_name),
re_path(r'^(?P<node_id>\w+)/identifiers/$', views.IdentifierList.as_view(), name=views.Identi... | {
"content_hash": "982c38ab6e4ece0d4cbd149fa665ec91",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 117,
"avg_line_length": 34.3,
"alnum_prop": 0.7084548104956269,
"repo_name": "CenterForOpenScience/osf.io",
"id": "509705c733a49386c322efcb6e1be0c3bfc57940",
"size": "343",... |
from django.utils.translation import ugettext_lazy as _
OSCAR_SHOP_NAME = 'Oscar'
OSCAR_SHOP_TAGLINE = ''
# Basket settings
OSCAR_BASKET_COOKIE_LIFETIME = 7 * 24 * 60 * 60
OSCAR_BASKET_COOKIE_OPEN = 'oscar_open_basket'
OSCAR_BASKET_COOKIE_SAVED = 'oscar_saved_basket'
OSCAR_MAX_BASKET_QUANTITY_THRESHOLD = 10000
# Rec... | {
"content_hash": "41dcdac7cd865d2c82791582841d78fe",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 78,
"avg_line_length": 29.4017094017094,
"alnum_prop": 0.5093023255813953,
"repo_name": "MrReN/django-oscar",
"id": "c4514ecbf0d86d8653125a012c9185489e9db21b",
"size": "68... |
import asyncio
import logging
import json
from datetime import datetime
from dateutil.parser import parse as parse_date
import aiobotocore
from botocore.exceptions import BotoCoreError
from livebridge.storages.base import BaseStorage
logger = logging.getLogger(__name__)
class DynamoClient(BaseStorage):
# date f... | {
"content_hash": "bf314c06714dbe0fc792e273cf46d56a",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 116,
"avg_line_length": 43.361635220125784,
"alnum_prop": 0.5200522155341214,
"repo_name": "dpa-newslab/livebridge",
"id": "0904959cdc8ea52b4f4cc0a59c0c0a0cc4961368",
"siz... |
if ENABLE_PAYMENTS:
from gluon.tools import *
import uuid, datetime, re, os, time, stat
now=datetime.datetime.now()
######################################
### MANAGE BALANCE TRANSFER
######################################
db.define_table('payment',
Field('from_person', db.auth_user,... | {
"content_hash": "4d6f2f86eef47a8c267fea7f7f7c5ee8",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 114,
"avg_line_length": 41.85294117647059,
"alnum_prop": 0.5727336612789881,
"repo_name": "tectronics/web2conf",
"id": "21d9974fb11d5477f6db570b8309c2edc8858443",
"size": "... |
'''A tool for encrypting and decrypting data with the AWS KMS'''
from __future__ import print_function
import sys
import os
from argparse import ArgumentParser
from .kms import (
get_client,
EncryptionError,
)
from . import files
def parse_kv(kv_string):
values = {}
for kv in kv_string.split(','):
... | {
"content_hash": "c1ac13abbda565b0d712433a9314ca02",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 75,
"avg_line_length": 30.77027027027027,
"alnum_prop": 0.6095740008783487,
"repo_name": "gffhcks/kmstool",
"id": "bc5fd594a1471f0abedf291f23a68f30ae501ad1",
"size": "2277"... |
import types
try:
callable
except NameError:
# Python 3.1
from collections import Callable
callable = lambda x: isinstance(x, Callable)
try:
basestring
except NameError:
# Python 3.x
basestring = str
class FFIError(Exception):
pass
class CDefError(Exception):
def __str__(self):
... | {
"content_hash": "2d95ac1395920864a71e95acff7185e5",
"timestamp": "",
"source": "github",
"line_count": 446,
"max_line_length": 78,
"avg_line_length": 40.46860986547085,
"alnum_prop": 0.5941049365615824,
"repo_name": "ArneBab/pypyjs",
"id": "9257e6e3f61c6279ea5ccdad28a2d8f403d13353",
"size": "18049... |
from __future__ import division, print_function
from functools import partial
from itertools import product
import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer
from sklearn.utils.multiclass impo... | {
"content_hash": "0c1fd7095fbb106ee50198192d5f34a0",
"timestamp": "",
"source": "github",
"line_count": 1042,
"max_line_length": 79,
"avg_line_length": 40.036468330134355,
"alnum_prop": 0.6105757706505585,
"repo_name": "Garrett-R/scikit-learn",
"id": "efbaf244aee56ea02e27ea32e07b7313db6055fa",
"siz... |
import os
import sys
_upper_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..'))
if _upper_dir not in sys.path:
sys.path.append(_upper_dir)
import chdb
import config
import handlers.database as database
def update_intersections():
db = chdb.init_scratch_db()
cfg = config.get_localized... | {
"content_hash": "47006590128d79d18c9e90210b9bf643",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 80,
"avg_line_length": 36.30232558139535,
"alnum_prop": 0.6585522101217168,
"repo_name": "guilherme-pg/citationhunt",
"id": "0087d0a5fbdd2fef9fd7bb4dba638b4b1a18e244",
"siz... |
import six
from .. import errors
from ..constants import IS_WINDOWS_PLATFORM
from ..utils import check_resource, format_environment, split_command
class TaskTemplate(dict):
"""
Describe the task specification to be used when creating or updating a
service.
Args:
container_spec (ContainerSpe... | {
"content_hash": "cac6627d671883d95a0891cfd7b5a57d",
"timestamp": "",
"source": "github",
"line_count": 485,
"max_line_length": 79,
"avg_line_length": 36.62474226804124,
"alnum_prop": 0.5784495862185441,
"repo_name": "operepo/ope",
"id": "8411b70a400aa74a4b3ed9eb8cad348e8d6e84f8",
"size": "17763",
... |
from __future__ import unicode_literals
import os
__all__ = [
"SENDGRID_SMTP_SERVER", "SENDGRID_USERNAME", "SENDGRID_PASSWORD",
"SENDGRID_SMTP_PORT",
"EMAIL_HOST", "EMAIL_HOST_USER", "EMAIL_HOST_PASSWORD", "EMAIL_PORT",
"EMAIL_USE_TLS"
]
#: Sendgrid SMTP server host
SENDGRID_SMTP_SERVER = "smtp.sendg... | {
"content_hash": "f47da38931c7cf4986e7975c4c18ea52",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 73,
"avg_line_length": 23.62162162162162,
"alnum_prop": 0.7311212814645309,
"repo_name": "nigma/django-herokuify",
"id": "8a389578ad4c413c76fa75941daafa98d8c5a700",
"size":... |
from os import listdir
from os.path import isfile, join
import ctypes
import os
import time
def get_file_path(folder):
'''(String) -> String
Returns the absolute file path of folder in active directory (where the script is running)
'''
return (os.path.abspath(folder))
def get_file_names(path):
''... | {
"content_hash": "4f66b8b059d3d3e50f488a81b1ffc056",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 111,
"avg_line_length": 31.314285714285713,
"alnum_prop": 0.6605839416058394,
"repo_name": "zechamkank/animated-win-background",
"id": "d5bf4853a8517858ffa6fd0b42bc48d4de618a... |
from urllib2 import BaseHandler
from _util import deprecation
from _response import response_seek_wrapper
class SeekableProcessor(BaseHandler):
"""Deprecated: Make responses seekable."""
def __init__(self):
deprecation(
"See http://wwwsearch.sourceforge.net/mechanize/doc.html#seekable")
... | {
"content_hash": "84f52221ffebcf30f00c9d05c02d1085",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 79,
"avg_line_length": 30.25,
"alnum_prop": 0.6900826446280992,
"repo_name": "ericlink/adms-server",
"id": "4086d527927428a2be9f8e324cb3a9751ebbed2e",
"size": "484",
"bin... |
"""
This module implements the CASA kat7 data container format.
"""
import logging
from casacore.tables import table as casacore_table
from sourcefinder.accessors.casaimage import CasaImage
logger = logging.getLogger(__name__)
class Kat7CasaImage(CasaImage):
"""
Use casacore to pull image data out of a CAS... | {
"content_hash": "8ad34a3d3505cd3ccb4888dbd8975777",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 77,
"avg_line_length": 32.457142857142856,
"alnum_prop": 0.6866197183098591,
"repo_name": "transientskp/pyse",
"id": "4503eb67e6ea6dac71a3b0b0d9d9ff3473242302",
"size": "11... |
"""
Serve one or more output ports.
Every message received on any of the connected sockets will be sent to
every output port.
Example:
python serve_ports.py :8080 'SH-201' 'SD-20 Part A'
This simply iterates through all incoming messages. More advanced and
flexible servers can be written by calling the ``accept... | {
"content_hash": "b4d6fd0b01d73d1d889f3f9e8799f30f",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 70,
"avg_line_length": 28.571428571428573,
"alnum_prop": 0.7275,
"repo_name": "olemb/mido",
"id": "159d2ff8c1e6fcf83ab72c46c2febdf3ad349bb9",
"size": "822",
"binary": fal... |
import unittest
import sys
from os.path import join, dirname
from mozlog import structured
import pytest
sys.path.insert(0, join(dirname(__file__), "..", ".."))
from wptrunner.testloader import EqualTimeChunker
structured.set_default_logger(structured.structuredlog.StructuredLogger("TestChunker"))
class MockTest(o... | {
"content_hash": "c802108d8be4d6c880a087439ae782bf",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 87,
"avg_line_length": 33.05494505494506,
"alnum_prop": 0.5535239361702128,
"repo_name": "youtube/cobalt",
"id": "062b687fab9affccde72fe8c1d960d87dd3d8f76",
"size": "3008",... |
import Queue
import threading
import time
import traceback
from logger import Logger
from task import ExecutableTask, Task
class ThreadPool(object):
def __init__(self):
self._init_core_worker()
def _init_core_worker(self):
self.core_worker = CoreWorker()
self.core_worker.setDaemon(Tru... | {
"content_hash": "d0a7ab007eb61d62ae0f5e95ca350ba9",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 116,
"avg_line_length": 29.507109004739338,
"alnum_prop": 0.5648891744298105,
"repo_name": "act262/freeline",
"id": "e0547dd237dc239ebbfbdc1832de08ecfdd5a003",
"size": "62... |
import mock
import sys
import os
import unittest
from secretcrypt import encrypt_secret, mock_crypter, kms, plain, local, password
class TestEncryptHelper(unittest.TestCase):
def test_encrypt(self):
secret = encrypt_secret.encrypt_secret(
mock_crypter,
b'myplaintext',
... | {
"content_hash": "f913672cb2f3c77d8a41e3a4a49115a4",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 86,
"avg_line_length": 34.56944444444444,
"alnum_prop": 0.5789473684210527,
"repo_name": "Zemanta/py-secretcrypt",
"id": "d974d7a81de16bd9ca89d2cf397aef1c575dcdd7",
"size":... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"txt2react.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "ded6277d32afcb0bbd6fc54241896702",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 23.9,
"alnum_prop": 0.6861924686192469,
"repo_name": "makaimc/txt2react",
"id": "a4d19c1f4fd3bc4cafdd1a0f7acf465f59ca5749",
"size": "261",
"binary"... |
import subprocess
import pytest
from freezegun import freeze_time
from tests.test_helpers import mce_helpers
from tests.test_helpers.click_helpers import run_datahub_cmd
from tests.test_helpers.docker_helpers import wait_for_port
FROZEN_TIME = "2020-04-14 07:00:00"
@freeze_time(FROZEN_TIME)
@pytest.mark.integratio... | {
"content_hash": "7fcc254cb1d1d19ca8fafc03d062c470",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 81,
"avg_line_length": 35.794871794871796,
"alnum_prop": 0.6762177650429799,
"repo_name": "linkedin/WhereHows",
"id": "ddfb8154dbe80432b0d1ebe10c5f310f82bf9e9c",
"size": "1... |
"""
A simple command line tool for dumping a source file using the Clang Index
Library.
"""
def get_diag_info(diag):
return { 'severity' : diag.severity,
'location' : diag.location,
'spelling' : diag.spelling,
'ranges' : diag.ranges,
'fixits' : diag.fixits }
def... | {
"content_hash": "0b7000956f156f909ebb39cb5029349d",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 76,
"avg_line_length": 31.355263157894736,
"alnum_prop": 0.5702895509861519,
"repo_name": "llvm-mirror/clang",
"id": "46073b285cb36284e02c300f80a3eb6d29790a42",
"size": "27... |
from django.utils.translation import ugettext as _
from lyra import views
class DriveApp(views.Lyra):
app_name = "drive"
class crud_app(views.ScheduleApp.crud_app):
from lyra import forms
reservation_form = forms.ReservationExclusiveDisable
def get_app_name(self):
return _(u... | {
"content_hash": "670835437cf7d2c345c6fce4bc4e3c5f",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 75,
"avg_line_length": 33.535714285714285,
"alnum_prop": 0.6815761448349308,
"repo_name": "hylje/Lyra",
"id": "404f6ba78e40da1c923a3fdc0891f2e3f3715b6e",
"size": "939",
"... |
"""Command for listing URL maps."""
from googlecloudsdk.compute.lib import base_classes
class List(base_classes.GlobalLister):
"""List URL maps."""
@property
def service(self):
return self.compute.urlMaps
@property
def resource_type(self):
return 'urlMaps'
List.detailed_help = base_classes.GetGl... | {
"content_hash": "414d6d3c707ee89895e6e906631763f0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 65,
"avg_line_length": 20.41176470588235,
"alnum_prop": 0.723342939481268,
"repo_name": "wemanuel/smry",
"id": "eb23efe91c5c67506048505034191df86de4a5c9",
"size": "397",
... |
from setuptools import setup, find_packages
def read(filename):
"""
Read a file relative to setup.py location.
"""
import os
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, filename)) as fd:
return fd.read()
def find_version(filename):
"""
Find ... | {
"content_hash": "5e7072a8e910bbf87623d083e0d9a338",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 76,
"avg_line_length": 27.988095238095237,
"alnum_prop": 0.6065504040833688,
"repo_name": "HPENetworking/topology_connect",
"id": "a34eea3b63e577b0de2c13eba4ca259ffdc8f29a",
... |
from oslo.config import cfg
from oslo.utils import timeutils
import six
from nova import conductor
from nova import context
from nova.i18n import _, _LE
from nova.openstack.common import log as logging
from nova.servicegroup import api
CONF = cfg.CONF
CONF.import_opt('service_down_time', 'nova.service')
LOG = loggi... | {
"content_hash": "b62ea05e3c1e062bb1463fd2f296ee71",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 79,
"avg_line_length": 41.48421052631579,
"alnum_prop": 0.6054300938848008,
"repo_name": "vmthunder/nova",
"id": "0be32ce1a85e213b53ae424d1554d33942111a54",
"size": "4516",... |
from state_machine import State, Event, acts_as_state_machine, after, before
@acts_as_state_machine
class Process:
created = State(initial=True)
waiting = State()
running = State()
terminated = State()
blocked = State()
swapped_out_waiting = State()
swapped_out_blocked = State()
wait =... | {
"content_hash": "09bda5f573411e59e3a3b1a2ca705b0a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 117,
"avg_line_length": 29.318181818181817,
"alnum_prop": 0.6255813953488372,
"repo_name": "wy36101299/Mastering-Python-Design-Patterns-Example",
"id": "b260976158f58e5844bc5... |
import numpy as np
import os
import os.path as osp
from PIL import Image
import logging
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
class VOCDatasets:
"""Pascal VOC dataset load
Parameters
----------------
root: str, example:'./data/VOCdevk... | {
"content_hash": "37a4e1bcb1fb1c44f7fdabf39efeaf00",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 90,
"avg_line_length": 36.51006711409396,
"alnum_prop": 0.5286764705882353,
"repo_name": "intel-analytics/analytics-zoo",
"id": "e4f86f18351a7853a9dbad82abcb74d04164260a",
... |
__author__ = 'geebzter'
# Example of how to implement an RPS player within the framework
import Player
import Message
class RPSPlayerExample(Player.Player):
def __init__(self):
# Call super class constructor
Player.Player.__init__(self)
self.reset()
def play(self):
return Rp... | {
"content_hash": "c2188c23b036bca37d59fe0ffa55779d",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 123,
"avg_line_length": 28.75438596491228,
"alnum_prop": 0.5954850518608907,
"repo_name": "mccler89/RPS_Player",
"id": "fd0b834a59c1d6adf492353286dd2f89b7825093",
"size": ... |
import unittest
import IECore
import Gaffer
import GafferTest
import GafferScene
import GafferSceneTest
class CustomOptionsTest( GafferSceneTest.SceneTestCase ) :
def test( self ) :
p = GafferScene.Plane()
options = GafferScene.CustomOptions()
options["in"].setInput( p["out"] )
# check that the scene hie... | {
"content_hash": "46bc4f7147738f18b9df989c8a627b05",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 146,
"avg_line_length": 35.310810810810814,
"alnum_prop": 0.6546115575966323,
"repo_name": "chippey/gaffer",
"id": "a45ea940d319c41608b1b4ef24f3058e63f7f0a2",
"size": "708... |
""" GIS Module
@requires: U{B{I{gluon}} <http://web2py.com>}
@requires: U{B{I{shapely}} <http://trac.gispython.org/lab/wiki/Shapely>}
@copyright: (c) 2010-2015 Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this softwar... | {
"content_hash": "31a07c36d4a6de1b12444a0333cf2854",
"timestamp": "",
"source": "github",
"line_count": 9519,
"max_line_length": 233,
"avg_line_length": 41.29761529572434,
"alnum_prop": 0.43680426952115425,
"repo_name": "michaelhowden/eden",
"id": "a75cc289712442000b4d005c2f6308a0a06e4fc2",
"size":... |
import os
import subprocess
import sys
import lib
# Define a list of supported operating systems here. The OS is based on the
# "sys.platform" variable. The list and variable names need to be kept in sync,
# it is written so there will be a syntax error if an item was added to 1 list
# but not the other, although the... | {
"content_hash": "6d6d75ca1bf9f73efa7d46c0037d4181",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 79,
"avg_line_length": 27.829787234042552,
"alnum_prop": 0.669151376146789,
"repo_name": "davidbrazdil/nacl",
"id": "ec33ac66505261bd712685929756afe3401cac56",
"size": "54... |
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.uix.popup import Popup
import os
class LoadDialog(FloatLayout):
load = ObjectProperty(None)
cancel = ObjectProperty(None)
class SaveDialog(FloatLayout):... | {
"content_hash": "400e40146d3c9ea57bae467ed9002e17",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 85,
"avg_line_length": 26.783333333333335,
"alnum_prop": 0.671437461107654,
"repo_name": "vicgc/recognise",
"id": "16d62789a192a91c090a17492ec111e3fa7b6c07",
"size": "1629"... |
"""
tests.test_constants
~~~~~~~~~~~~~~~~~~~~
:copyright: 2013 by Daniel Neuhäuser
:license: BSD, see LICENSE.rst for details
"""
from relief import Unspecified, NotUnserializable
from relief._compat import text_type
class TestUnspecified(object):
def test_bool(self):
assert not Unspecifi... | {
"content_hash": "f5e06f542fbce8f187eb587db4fea5b9",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 61,
"avg_line_length": 23.675675675675677,
"alnum_prop": 0.6449771689497716,
"repo_name": "DasIch/relief",
"id": "397a02d2f84f4915018294b9ffcb3640358aaf50",
"size": "893",
... |
__version__=''' $Id$ '''
__doc__='''The parser used to process markup within paragraphs'''
import string
import re
import sys
import os
import copy
import base64
from pprint import pprint as pp
try:
import pickle as pickle
except:
import pickle
import unicodedata
import reportlab.lib.sequencer
from reportlab.... | {
"content_hash": "203c9d4bc1b64589359b43093e8b03eb",
"timestamp": "",
"source": "github",
"line_count": 1346,
"max_line_length": 135,
"avg_line_length": 34.00594353640416,
"alnum_prop": 0.5493314690203618,
"repo_name": "kanarelo/reportlab",
"id": "994b1853671e453b32c680a4e3bd85b7379d6aeb",
"size": ... |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... | {
"content_hash": "802c3d94152e50d20f7e3cbe8e1a3287",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 224,
"avg_line_length": 40.973684210526315,
"alnum_prop": 0.5653179190751445,
"repo_name": "dbestm/mbed",
"id": "447cabbfee7179e50550beb5be62321838a2acd8",
"size": "7785",... |
""" Properties are objects that can be assigned as class level
attributes on Bokeh models, to provide automatic serialization
and validation.
For example, the following defines a model that has integer,
string, and list[float] properties::
class Model(HasProps):
foo = Int
bar = String
baz ... | {
"content_hash": "f1be389a931469b0638952fa69ecc301",
"timestamp": "",
"source": "github",
"line_count": 1736,
"max_line_length": 140,
"avg_line_length": 36.16589861751152,
"alnum_prop": 0.6030995158002038,
"repo_name": "maxalbert/bokeh",
"id": "a8afaef93359a148cc4b09413e54de2e674f00fd",
"size": "62... |
import os
import sys
import time
import types
import atexit
import logging
import operator
import textwrap
import traceback
import supybot.ansi as ansi
import supybot.conf as conf
import supybot.utils as utils
import supybot.registry as registry
import supybot.ircutils as ircutils
deadlyExceptions = [KeyboardInterru... | {
"content_hash": "ebf59e7fa3e4e1c2cb5d43c021e20ba8",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 80,
"avg_line_length": 36.696335078534034,
"alnum_prop": 0.6450991582251391,
"repo_name": "jrabbit/ubotu-fr",
"id": "82d5c9866abf78332c11e91a129f487a61401211",
"size": "15... |
from __future__ import unicode_literals
from django.shortcuts import resolve_url
from django.test import SimpleTestCase, override_settings
from django.urls import NoReverseMatch, reverse_lazy
from django.utils import six
from .models import UnimportantThing
from .urls import some_view
@override_settings(ROOT_URLCON... | {
"content_hash": "f7b8b9666d91c2b5c19d4c4e5a4f155f",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 79,
"avg_line_length": 33.65909090909091,
"alnum_prop": 0.6100607697501688,
"repo_name": "darkryder/django",
"id": "ecccfa6c9ea77b53ea50157d3bc7c24172c12832",
"size": "2962... |
from cPickle import dump, load
from os import basename
from os.path import exists, isdir, join
from sys import argv
from Zcgi import *
image_extentions = '.bmp', '.gif', '.jpg', '.png'
def main():
# Default Settings
title = 'Image Viewer'
image = ''
action = basename(argv[0])
back = ''
forward... | {
"content_hash": "6505037e59f8389bcade647ce14124e1",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 76,
"avg_line_length": 28.842105263157894,
"alnum_prop": 0.5480535279805353,
"repo_name": "ActiveState/code",
"id": "2cff9b0f000c21bf49692c43158f777897920624",
"size": "165... |
import random
from fedlearner.data_join.join_expr.expression import Expr
class NegativeExampleGenerator(object):
def __init__(self, negative_sampling_rate, filter_expr=None):
"""Args
filter_expr: i.e. et(label, 1), select the sample from leader
meeting label=1
"""
se... | {
"content_hash": "a45a1fe03c978650b2cf723b73575b4b",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 73,
"avg_line_length": 36.57692307692308,
"alnum_prop": 0.5410094637223974,
"repo_name": "bytedance/fedlearner",
"id": "d2b5ec03a2804c0433a0134447919cecde57be24",
"size": "... |
from sqlalchemy import *
meta = MetaData()
meter = Table(
'meter', meta,
Column('id', Integer, primary_key=True, index=True),
Column('counter_name', String(255)),
Column('user_id', String(255), index=True),
Column('project_id', String(255), index=True),
Column('resource_id', String(255)),
... | {
"content_hash": "abbe65b1d5577518f098828a93453a56",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 62,
"avg_line_length": 28.28767123287671,
"alnum_prop": 0.6382566585956416,
"repo_name": "shootstar/ctest",
"id": "1dfdbcae9712fd7adabce0865edb25107bdafdba",
"size": "2678"... |
"""Test the entity helper."""
# pylint: disable=protected-access,too-many-public-methods
import unittest
import blumate.helpers.entity as entity
from blumate.const import ATTR_HIDDEN
from tests.common import get_test_home_assistant
class TestHelpersEntity(unittest.TestCase):
"""Test blumate.helpers.entity modul... | {
"content_hash": "77b83901ee6c38a7465a96ca856f170e",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 68,
"avg_line_length": 38.733333333333334,
"alnum_prop": 0.6316695352839932,
"repo_name": "bdfoster/blumate",
"id": "d26360618e3d209d71335a0b2e95e1d298afebe7",
"size": "174... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.