text stringlengths 4 1.02M | meta dict |
|---|---|
def allLongestStrings(in_array):
# Given an array of strings, return another containing only
# the longest strings (all strings with longest length equal).
lengths = [(len(str), str) for str in in_array]
max_len = max(lengths)
# Filter only lengths of strings with same length as max.
# These tup... | {
"content_hash": "0a54281006b176221ec8fae9ca5691cf",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 66,
"avg_line_length": 47.166666666666664,
"alnum_prop": 0.6908127208480566,
"repo_name": "Zubieta/CPP",
"id": "5eb1108fab75a71f9204b17a3582bc357cbe4cd1",
"size": "634",
... |
"""Command line tool help you debug your event definitions.
Feed it a list of test notifications in json format, and it will show
you what events will be generated.
"""
import json
import sys
from oslo.config import cfg
from stevedore import extension
from ceilometer.event import converter
from ceilometer import se... | {
"content_hash": "06d5f62889b234b65958a6dccfeccd9f",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 72,
"avg_line_length": 27.426470588235293,
"alnum_prop": 0.6375335120643432,
"repo_name": "lexxito/monitoring",
"id": "d9b6d70bfcc170fe6b78a4f351094d48e8b9a6f4",
"size": "2... |
import demistomock as demisto
from CommonServerPython import *
import nltk
import re
from html.parser import HTMLParser
from html import unescape
html_parser = HTMLParser()
CLEAN_HTML = (demisto.args().get('cleanHtml', 'yes') == 'yes')
REMOVE_LINE_BREAKS = (demisto.args().get('removeLineBreaks', 'yes') == 'yes')
TOKEN... | {
"content_hash": "757a08124a988a9891ce2dd05b7cf306",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 88,
"avg_line_length": 27.12987012987013,
"alnum_prop": 0.6069889899473432,
"repo_name": "VirusTotal/content",
"id": "28d6ee737a55190e9582fcaa25ba594225964b49",
"size": "20... |
from __future__ import absolute_import
from mock import patch
from datetime import datetime
from django.core.urlresolvers import reverse
from sentry.models import (
Activity, File, Release, ReleaseCommit,
ReleaseFile, ReleaseProject, Repository
)
from sentry.testutils import APITestCase
class ReleaseDetails... | {
"content_hash": "dd860b7442069527bcf03f955b101167",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 91,
"avg_line_length": 32.22037422037422,
"alnum_prop": 0.5696864111498258,
"repo_name": "JackDanger/sentry",
"id": "cf580b1f27f91799891f950deb0128abe7fc5438",
"size": "15... |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qrtextedit import ScanQRTextEdit
import re
from decimal import Decimal
from electrum import bitcoin
import util
RE_ADDRESS = '[1-9A-HJ-NP-Za-km-z]{26,}'
RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>'
frozen_style = "QWidget { background-color:none; bor... | {
"content_hash": "bbffec352899ac05322054676d39fe7a",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 113,
"avg_line_length": 29.661921708185055,
"alnum_prop": 0.5454109178164367,
"repo_name": "fireduck64/electrum",
"id": "d71753162f23e61f07605703fa1e265f5069e731",
"size":... |
import os
from flask import Flask, request
from freeipa_api_client import IPAPassword
import requests
app = Flask(__name__)
FREEIPA_API_SERVER_URL = os.environ['FREEIPA_API_SERVER_URL']
@app.route('%s/' % os.environ.get('FREEIPA_CHANGE_PASSWORD_URL_PREFIX'), methods=['GET', 'POST'])
def hello_world():
if req... | {
"content_hash": "39823aeb82c701d0b9bfcef6be3b8a1d",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 123,
"avg_line_length": 44.464285714285715,
"alnum_prop": 0.5839357429718876,
"repo_name": "frol/freeipa-change-password-service",
"id": "f11e09946b95b5e39d4fa1d2e1e90e2315df... |
from .model import * # noqa
from .transformer_layer_xmod import * # noqa
| {
"content_hash": "e5978217f7a75fc972f72a91a4fa6863",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 45,
"avg_line_length": 37.5,
"alnum_prop": 0.7066666666666667,
"repo_name": "pytorch/fairseq",
"id": "bbf7694920eb00bed27e17dac272611be1ab44f9",
"size": "253",
"binary": f... |
from . import Arduino
from . import ARDUINO_GROVE_I2C
__author__ = "Marco Rabozzi, Luca Cerina, Giuseppe Natale"
__copyright__ = "Copyright 2016, NECST Laboratory, Politecnico di Milano"
ARDUINO_GROVE_HAPTIC_MOTOR_PROGRAM = "arduino_grove_haptic_motor.bin"
CONFIG_IOP_SWITCH = 0x1
START_WAVEFORM = 0x2
STOP_WAVEFORM ... | {
"content_hash": "cbee1e122bae1a0a95e461a774f0638d",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 79,
"avg_line_length": 30.875,
"alnum_prop": 0.5789473684210527,
"repo_name": "schelleg/PYNQ",
"id": "b42bef17bc5650c803824b1df50df26c0876cac5",
"size": "5600",
"binary"... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_commoner_naboo_bothan_female_02.iff"
result.attribute_template_id = 9
result.stfName("npc_name","bothan_base_female")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return resu... | {
"content_hash": "f067d5dd93de67bcb129b2190fd1cce9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 24.76923076923077,
"alnum_prop": 0.7049689440993789,
"repo_name": "anhstudios/swganh",
"id": "4c5a397282a24369e190d17e20f3828335e18041",
"size": "467... |
"""Common utility classes and functions for testing."""
import io
import os
import pytest
from google.auth import credentials
from google.auth import transport
from requests import adapters
from requests import models
import firebase_admin
def resource_filename(filename):
"""Returns the absolute path to a test... | {
"content_hash": "b4e02677d6c8b5d7e07220ede4bd9fd8",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 94,
"avg_line_length": 30.68553459119497,
"alnum_prop": 0.6591514654642344,
"repo_name": "firebase/firebase-admin-python",
"id": "92755107c2a44fea231ec1475bbb907304c33def",
... |
""" vim:ts=4:expandtab
(c) Jerzy Kędra 2013
TODO:
1.Check only last few podcasts by date
Don't try to download older podcasts than date specified.
For example - test last week only for regular podcast
donwload.
2.Non-verbose mode to be used from cron.
... | {
"content_hash": "43253e248449ce581c38047d7689bf2e",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 119,
"avg_line_length": 31.835897435897436,
"alnum_prop": 0.5958440721649485,
"repo_name": "jkedra/PodcastMirror",
"id": "6b748e57345164d5d2eeefd45509bcba413e1c2b",
"size"... |
import arcpy
import os
import sys
import time
import string
import subprocess
#set executable program location
executablepath = os.path.dirname(os.path.abspath(__file__))
arcpy.AddMessage(executablepath)
executablename = '\CutFillStatistics.exe'
executablestr = '"' + executablepath + executablename + '"'
arcpy.AddMess... | {
"content_hash": "e3688bc470ee820d1b9ec67d4f776983",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 84,
"avg_line_length": 29.065217391304348,
"alnum_prop": 0.74943904263276,
"repo_name": "crwr/OptimizedPitRemoval",
"id": "bd30b9de11209b04b63c3164e70645432b241a29",
"size"... |
"""
vg composite command
Build composite images from centered images, based on records in composites.csv.
See also vgInitComposites.py, which builds initial pass at composites.csv.
Note: even single channel images get a composite image (bw).
Uses centered image if available, otherwise uses the plain adjusted image.
"... | {
"content_hash": "595fa7a3ea898fa4d0b6116facf76c12",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 95,
"avg_line_length": 38.611510791366904,
"alnum_prop": 0.6520402459474567,
"repo_name": "bburns/PyVoyager",
"id": "21536581f691fc0827baa1ae8416c69cd4b3387a",
"size": "10... |
"""Utilities used throughout for internationalization
"""
from django.utils import formats
import six
import decimal
def _date_format(date, date_format, decode=False):
formatted = formats.date_format(
date,
date_format,
use_l10n=True
)
if decode:
return formatted
retur... | {
"content_hash": "1c453a4054f0ae079aa6d0cd7b51ca0f",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 71,
"avg_line_length": 27.80327868852459,
"alnum_prop": 0.6120283018867925,
"repo_name": "mercycorps/TolaActivity",
"id": "d8fdec8f0c9c27396d986dbf2391eb6d4c0e17f6",
"size"... |
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path = os.path.join(os.path.expanduser(pytan_loc)... | {
"content_hash": "9dc1c6d373f6daebaa0f1d5ef0c25e14",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 90,
"avg_line_length": 32.51111111111111,
"alnum_prop": 0.7194121667805878,
"repo_name": "tanium/pytan",
"id": "c6b52b36baddda05cc513a639b8c407fadb6a123",
"size": "2969",
... |
import functools
import inspect
import math
import time
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils import excutils
from oslo_utils import strutils
import six
import webob
import webob.exc
from cinder.api.openstack import api_version_... | {
"content_hash": "7c9ab927738697d269044fc314651f2c",
"timestamp": "",
"source": "github",
"line_count": 1397,
"max_line_length": 79,
"avg_line_length": 36.87831066571224,
"alnum_prop": 0.5949455540674314,
"repo_name": "bswartz/cinder",
"id": "cc4718e55fdac01cb9e03dc5138dfe5b83cf85aa",
"size": "5218... |
from setuptools import setup, find_packages
from codecs import open
from os import path
setup(
name='multilabel-metrics',
version='0.0.1',
description='Multilabel classification metrics for Python',
long_description=open('README.txt').read(),
url='https://github.com/llabhishekll/multi-label-metrics'... | {
"content_hash": "11302423ee2e31244d77e1500551f9c2",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 63,
"avg_line_length": 37.25,
"alnum_prop": 0.6577181208053692,
"repo_name": "hell-sing/multi-label-metrics",
"id": "d5e756be0b723718ef8093fc205db9dd68641b54",
"size": "918... |
from pyxley.charts import Chart
from flask import jsonify, request
class PlotlyAPI(Chart):
def __init__(self, options, route_func):
super(PlotlyAPI, self).__init__("PlotlyAPI", options, route_func)
class PlotlyLines(PlotlyAPI):
def __init__(self, xypairs, data_source,
mode="lines+markers", lay... | {
"content_hash": "49d79874e532e4e39e3572cad297bb09",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 73,
"avg_line_length": 28.65573770491803,
"alnum_prop": 0.425629290617849,
"repo_name": "subodhchhabra/pyxley",
"id": "2d443b10082d908b7c581ce49b638a1aab1a87d5",
"size": "1... |
import os
import getopt
import pickle
import sys
import time
import simpleubjson
try:
import json
except ImportError:
json = None
try:
import simplejson
except ImportError:
simplejson = None
try:
import ujson
except ImportError:
ujson = None
try:
import erlport
except ImportError:
erlpor... | {
"content_hash": "dc4df59b4783ff357bdb17a4b777ede1",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 78,
"avg_line_length": 29.223880597014926,
"alnum_prop": 0.5677562138236295,
"repo_name": "samipshah/simpleubjson",
"id": "d05c7f7767ad0c4a6c8c6f84455492d6f6d016f3",
"size... |
from amaranth import *
from amaranth_cfu import InstructionBase, InstructionTestBase, simple_cfu, CfuTestBase
import unittest
# See proj_example for further example instructions
class TemplateInstruction(InstructionBase):
"""Template instruction
"""
def elab(self, m):
with m.If(self.start):
... | {
"content_hash": "001c4e4d897f36aae6f793862a402e66",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 86,
"avg_line_length": 22.01923076923077,
"alnum_prop": 0.5694323144104804,
"repo_name": "google/CFU-Playground",
"id": "3761c1231e17abc25f98e9edf17bf6e42f1f62ee",
"size": ... |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^$', views.index, name="index"),
url(r'^about', views.about, name="about"),
url(r'^settings', views.settings, name="settings")
]
| {
"content_hash": "2d26ef7b4f10eaed11b427c2c06b8308",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 54,
"avg_line_length": 28.25,
"alnum_prop": 0.6548672566371682,
"repo_name": "signalw/charliechat",
"id": "0a7ac96f08e86fcc7b4bad353b5de6025053de11",
"size": "226",
"binar... |
import sys
from keystone.common import cms
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import importutils
from oslo_utils import timeutils
import six
from keystone.common import controller
from keystone.common import dependency
from keystone.common imp... | {
"content_hash": "75fe02aa5ed7414e19300cb64fcdc7ba",
"timestamp": "",
"source": "github",
"line_count": 561,
"max_line_length": 79,
"avg_line_length": 41.03030303030303,
"alnum_prop": 0.5816752107046659,
"repo_name": "darren-wang/ks3",
"id": "47c36ada0ce1c8bb7e861d685e7ed49a532661ff",
"size": "2360... |
from django.conf import settings as django_settings
from django.contrib.sites.models import Site
from django.template.defaultfilters import slugify
from django.test import RequestFactory, TestCase
from django.utils import translation
from feincms.extensions.translations import (
translation_set_language,
user_... | {
"content_hash": "ca6da1a000e5d5ebc751478eaff25bf9",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 97,
"avg_line_length": 36.956896551724135,
"alnum_prop": 0.6207137858642408,
"repo_name": "feincms/feincms",
"id": "803c18221e357c231141de2e2ccdb8c884eed0de",
"size": "428... |
from setuptools import setup
setup(
name='djangocms-tonicdev',
version='0.1.7',
description='DjangoCMS Tonic Notebook',
author='Aleksandr Zykov',
author_email='tiger@vilijavis.lt',
url='https://github.com/TigerND/djangocms-tonicdev',
packages=[
'djangocms_tonicdev',
'djangoc... | {
"content_hash": "048a316c9e7ff6779334881656869160",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 56,
"avg_line_length": 25.85185185185185,
"alnum_prop": 0.6045845272206304,
"repo_name": "TigerND/djangocms-tonicdev",
"id": "307dd1ea8a3638f3ddf6cedc11e8799b78f5d2fc",
"si... |
import requests
# Create your views here.
from django.views.generic import TemplateView
from intro.models import Staff
from intro.utils import toPersianDigit
class HomeView(TemplateView):
template_name = 'intro/home.html'
def get_context_data(self, *args, **kwargs):
registration_url = "http://ce.sh... | {
"content_hash": "1e39a370092f41603a2e3b2e8ea7b750",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 85,
"avg_line_length": 29.4,
"alnum_prop": 0.6993197278911565,
"repo_name": "Kianoosh76/webelopers-scoreboard",
"id": "88846b4106c3e03e46d6e111c9e6921f0e0a7591",
"size": "7... |
"""Unit tests for the "list_collectors" function."""
import unittest
from unittest import mock
from google.auth.transport import requests
from . import list_collectors
class ListCollectorsTest(unittest.TestCase):
@mock.patch.object(requests, "AuthorizedSession", autospec=True)
@mock.patch.object(requests.requ... | {
"content_hash": "6d23d21dd92c69859b0a7098041f0e66",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 73,
"avg_line_length": 36.2972972972973,
"alnum_prop": 0.5662695457930007,
"repo_name": "chronicle/api-samples-python",
"id": "d2d07a7999da9c0f666e1b52eb7a453ed31fb6a2",
"s... |
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
from oslo_utils import units
import taskflow.engines
from taskflow.patterns import linear_flow
from taskflow.types import failure as ft
from cinder import exception
from cinder import flow_utils
from cinder.i18n import _, ... | {
"content_hash": "2adaeb0e477945e0bd2cc6408adf3517",
"timestamp": "",
"source": "github",
"line_count": 763,
"max_line_length": 79,
"avg_line_length": 44.51376146788991,
"alnum_prop": 0.5818808149805677,
"repo_name": "JioCloud/cinder",
"id": "5f1a4adfcbb5b22d6f107ba73e1194d430a90a39",
"size": "3453... |
class NetworkDevice(object):
def __init__(self, ip, username, password):
self.ip = ip
self.username = username
self.password = password
def connect(self):
pass
def enable(self):
pass
def sh_ver(self):
pass
class NetworkDevice2(object):
def __init__(self, ip,... | {
"content_hash": "db39ef048c8fe3d6939928de8d85e52e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 47,
"avg_line_length": 22.363636363636363,
"alnum_prop": 0.5894308943089431,
"repo_name": "bdlamprecht/python_class",
"id": "5286ba15a622b2d39cad96c1722463d0daf61f89",
"siz... |
from wires import *
from models.post import Post
from models.user import User
from models.comment import Comment
from pdb import set_trace as debug
def index(parameters):
template = open('./templates/posts/index.html').read()
posts = Post.all(Post.cxn, "posts")
post_template = open('./templates/posts/sho... | {
"content_hash": "0cf7837dd7205daccc950dd69cad7bb5",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 261,
"avg_line_length": 47.80882352941177,
"alnum_prop": 0.6748692709935404,
"repo_name": "zackmdavis/Wires",
"id": "d6510d865568a586caac0046dd29735e2680f74f",
"size": "325... |
from django.db.backends import BaseDatabaseIntrospection
import pyodbc as Database
SQL_AUTOFIELD = -777555
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Map type codes to Django Field types.
data_types_reverse = {
SQL_AUTOFIELD: 'AutoField',
Database.SQL_BIGINT: ... | {
"content_hash": "b2622595ce33b48d92147e0efe70ffee",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 124,
"avg_line_length": 45.26923076923077,
"alnum_prop": 0.6302949387061536,
"repo_name": "chuck211991/django-pyodbc",
"id": "128a77cd44b2983e50b4ce0ab16790b9b73abfae",
"s... |
"""Test Home Assistant package util methods."""
import asyncio
import logging
import os
from subprocess import PIPE
import sys
from unittest.mock import MagicMock, call, patch
import pkg_resources
import pytest
import homeassistant.util.package as package
RESOURCE_DIR = os.path.abspath(
os.path.join(os.path.dirn... | {
"content_hash": "4a21a0e1de3b6b4096b2dc7d0c18ca27",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 80,
"avg_line_length": 28.68951612903226,
"alnum_prop": 0.6143359100491919,
"repo_name": "partofthething/home-assistant",
"id": "0c25166244440670fefe784071ab1971906c64ba",
... |
from google.net.proto import ProtocolBuffer
import array
import dummy_thread as thread
__pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
unusednames=printElemNumber,debug_strs no-special"""
if hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'):
_extension_runtime = True
_ExtendablePro... | {
"content_hash": "676eb7de346701ec4080787c36ddc779",
"timestamp": "",
"source": "github",
"line_count": 3221,
"max_line_length": 281,
"avg_line_length": 29.480596088171374,
"alnum_prop": 0.6338342618237729,
"repo_name": "adviti/melange",
"id": "274b04995f9a42ef58999b97a0cb61b047806113",
"size": "95... |
import argparse
from bakery_cli.fixers import CharacterSymbolsFixer
description = 'Fixes TTF NAME table strings to be ascii only'
parser = argparse.ArgumentParser(description=description)
parser.add_argument('ttf_font', nargs='+',
help="Font in OpenType (TTF/OTF) format")
args = parser.parse_arg... | {
"content_hash": "260caacf6b3810e6edb274b734449d0a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 28.428571428571427,
"alnum_prop": 0.7286432160804021,
"repo_name": "jessamynsmith/fontbakery",
"id": "eb02a8f1aac14f8e78b543587cf77c1a027ea752",
"siz... |
"""
Provide functions for the creation and manipulation of 3D Spheres.
Sphere are represented using a numpy.array of shape (4,).
The first three values are the sphere's position.
The fourth value is the sphere's radius.
"""
from __future__ import absolute_import, division, print_function
import numpy as np
from math3... | {
"content_hash": "bdd6d2670804dabe0485c22bc8d47008",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 82,
"avg_line_length": 28.630769230769232,
"alnum_prop": 0.6765180010746911,
"repo_name": "PhloxAR/math3",
"id": "615c9d1be3efb2a88a9880db0aa114f647972488",
"size": "1885",... |
"""
WSGI config for agazeta project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "agazeta.settings")
from django.core.... | {
"content_hash": "733aa42dfe707c6a8ba2402b97dced07",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 27.42105263157895,
"alnum_prop": 0.7773512476007678,
"repo_name": "Scoppio/a-gazeta-de-geringontzan",
"id": "92f84952c385a84b612f896bbc009f823d0894d1",... |
import requests
import os
import codecs
from bs4 import BeautifulSoup
from mtgreatest.rdb import Cursor, serialize
from update_events import clean_magic_link
def write_as(text, filename):
f = codecs.open(filename, 'w', 'utf-8')
f.write(text)
f.close()
def scrape_info_type(info_type, soup, event_id):
... | {
"content_hash": "4aca95b92bafd76ff12ce2a30838faf8",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 134,
"avg_line_length": 32.75609756097561,
"alnum_prop": 0.6023827252419955,
"repo_name": "oelarnes/mtgreatest",
"id": "56ae64840459a60fdbc8cb03ba0f2eb4dd5a1868",
"size": "... |
from keras.datasets import mnist
import numpy as np
from PIL import Image
import math
import os
import keras.backend as K
K.set_image_data_format('channels_first')
print(K.image_data_format)
################################
# GAN 모델링
################################
from keras import models, layers, optimizers
cla... | {
"content_hash": "757857530b869c98e0362cf3376b30db",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 81,
"avg_line_length": 31.171122994652407,
"alnum_prop": 0.5735117515868932,
"repo_name": "jskDr/keraspp",
"id": "4d2a1012b32df35744475a71372e3e058798e5e2",
"size": "5953"... |
from glad.loader import BaseLoader
from glad.loader.volt import LOAD_OPENGL_DLL
_GLX_LOADER = \
LOAD_OPENGL_DLL % {'pre':'private', 'init':'open_gl',
'proc':'get_proc', 'terminate':'close_gl'} + '''
bool gladLoadGLX() {
StructToDg structToDg;
structToDg.func = cast(void*)get_proc;
... | {
"content_hash": "e6d78b6817c41fa922f5484dc6156905",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 71,
"avg_line_length": 22.75,
"alnum_prop": 0.5864135864135864,
"repo_name": "dbralir/glad",
"id": "dbdeeaeb5821ed22f1c3591f92489b3c5508be50",
"size": "1001",
"binary": f... |
from reports import *
from plotting import plot_measures, plot_mosaic, plot_all, plot_fd
| {
"content_hash": "0d9618730a5b355228dc47464c6a6b41",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 66,
"avg_line_length": 44.5,
"alnum_prop": 0.7865168539325843,
"repo_name": "wangkangcheng/ccc",
"id": "c874f8ab80a76e844b31c7c4a375d1e6f0796499",
"size": "226",
"binary":... |
from utils import TreeNode, construct
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if root is None:
return 0
root.level = 1
queue = [root]
i, last = 0, 0
while i <= last:
node = queue[i]
if node.left:
node.le... | {
"content_hash": "7bbb75c4b19f5c893b655afe8be47b92",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 51,
"avg_line_length": 26.84375,
"alnum_prop": 0.48661233993015135,
"repo_name": "shenfei/oj_codes",
"id": "4de83bd5990e7e7d4463fb546c03386c03a415af",
"size": "1021",
"bi... |
'''
New Integration Test for Starting Windows VM with Multi Data Volumes.
@author: Mirabel
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.resource_operations as res_ops
impo... | {
"content_hash": "858ea2407d523fa274a225438aa924ca",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 99,
"avg_line_length": 37.61904761904762,
"alnum_prop": 0.6453164556962026,
"repo_name": "zstackorg/zstack-woodpecker",
"id": "4c53f224f8004891a9fd7e126faa34fd10939cfa",
"... |
'''
Created on Oct 29, 2015
@author: ev0l
'''
from handlers import BaseHandler
class LogOutHandler(BaseHandler):
def get(self):
self.clear_all_cookies()
self.redirect("/")
route = [(r"/logout", LogOutHandler), ]
| {
"content_hash": "14e4ffa0ace07a81b490d0f664ffb289",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 39,
"avg_line_length": 16.857142857142858,
"alnum_prop": 0.6440677966101694,
"repo_name": "evolsnow/tornado-web",
"id": "578961f695b1d3e728efe2fd01f3595bdcd4743c",
"size": ... |
import unittest
from .test_oauth import UAOauth2ClientTest
def suite():
tests = ['UAOauth2ClientTest']
return unittest.TestSuite(map(WidgetTestCase, tests))
if __name__ == '__main__':
suite()
| {
"content_hash": "a8b5d2a16cb1fb15bc0cb2e7d09da841",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 57,
"avg_line_length": 20.7,
"alnum_prop": 0.6859903381642513,
"repo_name": "igorfala/python-under-armour",
"id": "1f953934f7e77a792a7a271571302e4b3a8a7d11",
"size": "207",... |
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
import uuid
from .. import models
class StorageAccountsOperations(object):
"""StorageAccountsOperations operations.
:param client: Client for service... | {
"content_hash": "26e5a681d1ea18101c751b61aec336c8",
"timestamp": "",
"source": "github",
"line_count": 671,
"max_line_length": 154,
"avg_line_length": 46.666169895678095,
"alnum_prop": 0.6528278989557053,
"repo_name": "sharadagarwal/autorest",
"id": "d2583af6ef3d7e11bd00adead7d7ba9dae0d0fe4",
"siz... |
from django.conf.urls.defaults import *
from registration.views import activate
from registration.views import register
urlpatterns = patterns('',
url(r'^register/$',
register,
{'backend': 'userprofile.backends.simple.SimpleBackend'},
name='registration_register'),
)
| {
"content_hash": "0b7943a76a2c2a0c31f63feca60aebc2",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 61,
"avg_line_length": 23.916666666666668,
"alnum_prop": 0.7317073170731707,
"repo_name": "praekelt/django-userprofile",
"id": "5bc6865f379e0cab17ae13ca8df88fc37ec147cb",
"... |
import importlib
import pianette.config
import sys
from pianette.Pianette import Pianette
from pianette.PianetteArgumentParser import PianetteArgumentParser
from pianette.utils import Debug
Debug.println("INFO", " ")
Debug.println("INFO", " ################################## ")
Debug.println("INFO", " | PI... | {
"content_hash": "e1c22ae416ad140a9d607d04d11e935a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 76,
"avg_line_length": 33.648648648648646,
"alnum_prop": 0.7132530120481928,
"repo_name": "tchapi/pianette",
"id": "3dc86c2ec6e724ee83aaa26e05e8506e067dbd26",
"size": "1524... |
from aquilon.exceptions_ import NotFoundException, ArgumentError
from aquilon.worker.broker import BrokerCommand
from aquilon.worker.dbwrappers.host import hostname_to_host
from aquilon.worker.dbwrappers.resources import get_resource_holder
from aquilon.worker.dbwrappers.change_management import ChangeManagement
clas... | {
"content_hash": "387d07235784659c9641b3d58f69ba63",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 99,
"avg_line_length": 38.05882352941177,
"alnum_prop": 0.639361154044307,
"repo_name": "quattor/aquilon",
"id": "1ebbfe1ccd3ac4d57f4260e92fa06616bf712b5a",
"size": "2635",... |
import cvxpy
from .solver import Solver
from sklearn.utils import check_array
class NuclearNormMinimization(Solver):
"""
Simple implementation of "Exact Matrix Completion via Convex Optimization"
by Emmanuel Candes and Benjamin Recht using cvxpy.
"""
def __init__(
self,
... | {
"content_hash": "7bca3112742a1e07adc64de86269ab0c",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 78,
"avg_line_length": 29.775862068965516,
"alnum_prop": 0.569195136074117,
"repo_name": "iskandr/fancyimpute",
"id": "30c66b635561d3582cf392f27edad74131afb2b0",
"size": "... |
import os
import sys
import time
import getpass
sys.path.append("./library")
import argparse
import ConfigParser
from utils import *
from na_funcs import *
from cisco_funcs import *
def check_on_switch(mds, zoneset, pwwns, zones, vsan, fabric, switch):
non_existent_zones = []
alias_exists = {}
zoneset_exi... | {
"content_hash": "007e1ea35eadd31e26506978eb73d0c1",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 161,
"avg_line_length": 39.7979797979798,
"alnum_prop": 0.6138324873096447,
"repo_name": "scottharney/python-mdszoning",
"id": "21495b33ee4516f2639ddb1bcaec64f13b7da72d",
... |
import unittest
from SevenStories import game
from SevenStories import parse
class TestGame(unittest.TestCase):
def setUp(self):
"""Set up for all the tests
Creates a sample character and stores the GameMap object.
Creates a sample load with 'health name' as sample input.
"""
... | {
"content_hash": "aebd4565f5c7324a426369b2fe0d6443",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 84,
"avg_line_length": 37.61538461538461,
"alnum_prop": 0.62719836400818,
"repo_name": "huntermalm/SevenStories",
"id": "bfc9bc0c07c1ee8bc888c273d2f18b5bd9ec4b1b",
"size":... |
from pyquery import PyQuery as pq
import calendar
import urllib2
import codecs
import time
import re
import os, os.path
def shouldRetrieve(pseudoToCheck):
try:
if os.stat("datafiles/tweets_party_generales.csv").st_size == 0:
print "return because file empty"
return True
except:
... | {
"content_hash": "e0ddda0daec61d9139184a94d2501780",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 192,
"avg_line_length": 38.75568181818182,
"alnum_prop": 0.6091482187362557,
"repo_name": "florence-nocca/spanish-elections",
"id": "eeec1317c53b072c7df0686189f526ac20275af7... |
from MAT.PluginMgr import PluginTaskDescriptor, \
PluginError, FindPluginClass, PluginStep, TagStep, WholeZoneStep
from MAT.PluginDocInstaller import PluginDocInstaller
from ReplacementEngine import PIIReplacementEngine, DOC_CACHE_SCOPE, \
BATCH_CACHE_SCOPE, NO_CACHE_SCOPE
from ClearReplacementStrategy import... | {
"content_hash": "5fc5e33186e96da331192f7411b7afcb",
"timestamp": "",
"source": "github",
"line_count": 1347,
"max_line_length": 357,
"avg_line_length": 44.18634001484781,
"alnum_prop": 0.6065626102589089,
"repo_name": "VHAINNOVATIONS/DmD",
"id": "c1b4afe06b10a1f4f73064ab188d6ae80a75b6fe",
"size": ... |
import logging
import requests
import unittest
from unittest.mock import MagicMock, patch, PropertyMock
from pyhik.hikvision import HikCamera
from pyhik.constants import (CONNECT_TIMEOUT)
XML = """<MotionDetection xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0">
<enabled>{}</enabled>
<enableHig... | {
"content_hash": "358d4af3878a64a064c54e2161a5516d",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 107,
"avg_line_length": 37.464285714285715,
"alnum_prop": 0.6835081029551954,
"repo_name": "mezz64/pyHik",
"id": "21d4687b07961a50ceb170d54a3a559f78f7a9fb",
"size": "3171",... |
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils import translation
from openbudgets.apps.transport.incoming.importers.initial import InitImporter
class Command(BaseCommand):
help = 'Loads initial data for the instance from formatted CSV files.'
... | {
"content_hash": "7ccf010683400b97264e6e50d958d3ea",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 96,
"avg_line_length": 39.55555555555556,
"alnum_prop": 0.6867977528089888,
"repo_name": "shaib/openbudgets",
"id": "615f10dad115c68f123031565541a7408c977fc1",
"size": "142... |
"""Support for ANEL PwrCtrl switches."""
from datetime import timedelta
import logging
from anel_pwrctrl import DeviceMaster
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
import homeassistant.h... | {
"content_hash": "a020d6178cee7095be6eb956aa482a71",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 87,
"avg_line_length": 28.08411214953271,
"alnum_prop": 0.6369384359400998,
"repo_name": "sdague/home-assistant",
"id": "0669a3bb6c6a4fa79dfa225f47b60cd25a68711c",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization', '0014_auto_20160619_1837'),
]
operations = [
migrations.AlterField(
model_name='organization',
name='verified... | {
"content_hash": "45b79bc4208488e6c68c809f0b2373bc",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 139,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.6416666666666667,
"repo_name": "sakset/getyourdata",
"id": "159033cdd60bdcd91b41d54b7069963f002ffbb3",
"size": "... |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... | {
"content_hash": "d2a55d8232d8ce04e6a937c088d1a7d6",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 166,
"avg_line_length": 55.348837209302324,
"alnum_prop": 0.7224789915966386,
"repo_name": "cjcjameson/gpdb",
"id": "a1d328604252cb7388470fba2309dd50955e0f81",
"size": "476... |
"""Copyright 2008 Python Software Foundation, Ian Bicking, and Google."""
import cStringIO
import inspect
import mimetools
HTTP_PORT = 80
HTTPS_PORT = 443
_UNKNOWN = 'UNKNOWN'
# status codes
# informational
CONTINUE = 100
SWITCHING_PROTOCOLS = 101
PROCESSING = 102
# successful
OK = 200
CREATED = 201
ACCEPTED = 202... | {
"content_hash": "ccc7299329fce4cfb211f306df0b0ddc",
"timestamp": "",
"source": "github",
"line_count": 815,
"max_line_length": 80,
"avg_line_length": 30.80490797546012,
"alnum_prop": 0.6577710507448419,
"repo_name": "Kazade/NeHe-Website",
"id": "1edee85707013d9b822f42e1e575875869aa8b57",
"size": "... |
import unittest
from atbash_cipher import (
decode,
encode,
)
# Tests adapted from `problem-specifications//canonical-data.json`
class AtbashCipherTest(unittest.TestCase):
def test_encode_yes(self):
self.assertEqual(encode("yes"), "bvh")
def test_encode_no(self):
self.assertEqual(en... | {
"content_hash": "2505ca983cf53553c5c732bc6ce8a96d",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 88,
"avg_line_length": 29.388059701492537,
"alnum_prop": 0.638395124428644,
"repo_name": "exercism/python",
"id": "98c1072afc7b41930252b9043726d94000cf4db6",
"size": "1969"... |
from unittest import main
from numpy.testing import assert_array_equal
import numpy as np
from calour._testing import Tests
from calour.filtering import _balanced_subsample
import calour as ca
class FTests(Tests):
def setUp(self):
super().setUp()
self.test2 = ca.read(self.test2_biom, self.test2_... | {
"content_hash": "36dd78539930b9cd5ffc26c653e59a21",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 111,
"avg_line_length": 46.31699346405229,
"alnum_prop": 0.6118676356452409,
"repo_name": "RNAer/Calour",
"id": "2ab91da2a6fccd2c6d544f8c3bdd4516b9d49125",
"size": "14524"... |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
def GetSheetSetViews(set):
if hasattr(set, 'Views'):
return [x.ToDSType(True) for x in set.Views]
else: return []
viewsheetsets = UnwrapElement(IN[0])
if isins... | {
"content_hash": "758a8cd289e73f62f8c2fc3655d815a3",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 78,
"avg_line_length": 25.529411764705884,
"alnum_prop": 0.7603686635944701,
"repo_name": "CAAD-RWTH/ClockworkForDynamo",
"id": "725ee11f7447ae3b71b4e5ee5af9e9c86b09a6f4",
... |
import sys
import argparse
import os
import urllib
import requests
from daypicts import get_picture_url, get_picture_urls
from daypicts import validate_date, gen_dates, picture_type
from daypicts import NoPictureForDate
from daypicts import REMOTE_PICT_BASE_URL, PICT_EXCEPTIONS
FIXTURE_DOC_DIR = 'fixture/docroot/'
F... | {
"content_hash": "4af1144db9c51fd8562693d0f4956e3a",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 71,
"avg_line_length": 27.917525773195877,
"alnum_prop": 0.5997045790251108,
"repo_name": "oxfordyang2016/learnfluentpython",
"id": "dece76b34bbdff2027f1f9c8104cda66fa6ed1a4"... |
from numpy import loadtxt, append, array, arange;
from predictors import NaiveBayes;
from pickle import load, dump;
from sys import argv;
import os, urllib, json, time;
os_brack = '/'; #directory separator for os engine is running on
def loadData(datSRC, path, delim, typ):
return loadtxt(path + os_brack + datSRC, de... | {
"content_hash": "1dd4a1fa239bb84a1b96c09bcaf68eaf",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 116,
"avg_line_length": 34.81290322580645,
"alnum_prop": 0.6643810229799851,
"repo_name": "parejadan/accurp-engine",
"id": "88e651a0d9357652ab9faa41968432dbc4cebcc8",
"siz... |
from .handler import Handler
from .device_hive import DeviceHive
from .device_hive_api import DeviceHiveApi
from .transports.transport import TransportError
from .api_request import ApiRequestError
from .api_response import ApiResponseError
from .device import DeviceError
from .network import NetworkError
from .device_... | {
"content_hash": "81e625473ddb6c3d41cd3e90f69455a0",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 48,
"avg_line_length": 38.18181818181818,
"alnum_prop": 0.8523809523809524,
"repo_name": "devicehive/devicehive-python",
"id": "339e154436d1578918285cda1a5c4c8ed144665c",
"... |
class EventBase(object):
"""
The base of all event classes.
A Ryu application can define its own event type by creating a subclass.
"""
def __init__(self):
super(EventBase, self).__init__()
class EventRequestBase(EventBase):
"""
The base class for synchronous request for RyuApp.s... | {
"content_hash": "799fe28d151d8bd93e98e1104200b6fb",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 24.1875,
"alnum_prop": 0.6020671834625323,
"repo_name": "fujita/ryu",
"id": "3f5c3dbf85f0fcbeebde13d7e944356267771d78",
"size": "1452",
"binary": f... |
import collections
from supriya.ugens.PV_MagSquared import PV_MagSquared
class PV_MagNoise(PV_MagSquared):
"""
Multiplies magnitudes by noise.
::
>>> pv_chain = supriya.ugens.FFT(
... source=supriya.ugens.WhiteNoise.ar(),
... )
>>> pv_mag_noise = supriya.ugens.PV... | {
"content_hash": "315b9f1b59e3af61cf70e175c42e6bf7",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 22,
"alnum_prop": 0.5527272727272727,
"repo_name": "Pulgama/supriya",
"id": "ecaa0ca5064dcf587b15d4d42ff500a5eb243506",
"size": "550",
"binary": fa... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from builtins import range
from past.builtins import basestring
from past.utils import old_div
from builtins import object
import zipfile
import numpy as np
import matplotlib.pyplot as plt
from osgeo import gdal... | {
"content_hash": "6ddc50f722c1ac0f7bc8bd707e9df65e",
"timestamp": "",
"source": "github",
"line_count": 1090,
"max_line_length": 164,
"avg_line_length": 34.15321100917431,
"alnum_prop": 0.5718967416122707,
"repo_name": "JRoehrig/GIRS",
"id": "c501406da022256c6e274e5a821773aca7cdbe7c",
"size": "3722... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("zerver", "0203_realm_message_content_allowed_in_email_notifications"),
]
operations = [
migrations.RemoveField(
model_name="realm",
name="has_seat_based_plan",
),
... | {
"content_hash": "c75f890a3db353632c176e9fe77a96df",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 80,
"avg_line_length": 22.63157894736842,
"alnum_prop": 0.5627906976744186,
"repo_name": "andersk/zulip",
"id": "98da63f4dbfdb70868228745440e98405faeab43",
"size": "481",
... |
'''
This is the Python version of the Random Search algorithm
presented in
"Clever Algorithms: Nature-Inspired Programming Recipes".
Find the book and the Ruby source codes on GitHub:
https://github.com/jbrownlee/CleverAlgorithm:s
'''
import random
def objective_function(vector):
return sum([x ** 2.... | {
"content_hash": "5e766210da1ac7e92817e9330d8f6518",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 105,
"avg_line_length": 29.16216216216216,
"alnum_prop": 0.623725671918443,
"repo_name": "mkrapp/semic",
"id": "b9bb45fa7cfff26a08c55d2309ac56dd0316eb87",
"size": "1079",
... |
__name__ = 'jsonrpc2'
__author__ = 'Max <qiwi360@gmail.com>'
__version__ = 1, 0
__detail__ = 'Based on https://github.com/subutux/json-rpc2php'
import logging
logger = logging.getLogger(__name__)
import json
import requests
import pprint
class jsonrpc2(object):
'''jsonrpc2 client'''
host = ''
default_op... | {
"content_hash": "d238a56f6058f2ec8eabd11029c06a45",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 108,
"avg_line_length": 32.78761061946903,
"alnum_prop": 0.5201079622132254,
"repo_name": "vesellov/callfeed.net",
"id": "0c5333c0e38620e4f72120bacf361c05af511235",
"size"... |
import tests.expsmooth.expsmooth_dataset_test as exps
exps.analyze_dataset("frexport.csv" , 2);
exps.analyze_dataset("frexport.csv" , 4);
exps.analyze_dataset("frexport.csv" , 8);
exps.analyze_dataset("frexport.csv" , 12);
| {
"content_hash": "23b40d0919d22219d242f73e61063f61",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 53,
"avg_line_length": 22.8,
"alnum_prop": 0.7324561403508771,
"repo_name": "antoinecarme/pyaf",
"id": "5ed92c5c4a30c0144b5e10e5cd4cc90eabd0ed81",
"size": "228",
"binary"... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/space/weapon/shared_wpn_medium_blaster.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "6ceabc68575c056119ac32d16203ee2f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 86,
"avg_line_length": 24.23076923076923,
"alnum_prop": 0.6984126984126984,
"repo_name": "obi-two/Rebelion",
"id": "04674734c0d9a1fe1cc042cb52bc21a3b8eb2a58",
"size": "460"... |
__author__ = 'avathar'
class Chromosome(object):
"""
Chromosome represents an individual
"""
def __init__(self, genes):
self.genes = genes
self.fitness = 0
def __str__(self):
"""
String representation of a chromosome, with fitness and genes
"""
... | {
"content_hash": "b850ee15e551a7054049c0a271bb588c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 73,
"avg_line_length": 23.94736842105263,
"alnum_prop": 0.512087912087912,
"repo_name": "avathardev/ppolom",
"id": "a35f20e72936a1824ac3aac22e1a45969ecfca04",
"size": "455"... |
"""Assists with installing symlinks for all dotfiles/configs under this dir."""
import os
import sys
import errno
FILE_MAP = {
'bashrc': '~/.bashrc',
'colordiffrc': '~/.colordiffrc',
'gitconfig': '~/.gitconfig',
'pystartup': '~/.pystartup',
'tmux.conf': '~/.tmux.conf',
'vimrc': '~/.vimrc',
'alacritty.y... | {
"content_hash": "9c0e532886033a2ad0611d87b6e2ab18",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 26.027397260273972,
"alnum_prop": 0.6368421052631579,
"repo_name": "minism/config",
"id": "b64d9e841c215ed201da924f8c944cecf1884457",
"size": "1923",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('statmaps', '0002_auto_20141001_2036'),
]
operations = [
migrations.AddField(
model_name='collection',
name='journal_name',
... | {
"content_hash": "95eb1526fee6cc40e5348e24a936e810",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 88,
"avg_line_length": 24.210526315789473,
"alnum_prop": 0.6065217391304348,
"repo_name": "erramuzpe/NeuroVault",
"id": "8ed78489a2424a7e1507a00e951e217343bec449",
"size": ... |
from oslo.serialization import jsonutils
from nova import db
from nova import objects
from nova.objects import base
from nova.objects import fields
from nova.openstack.common import log as logging
from nova import utils
LOG = logging.getLogger(__name__)
# TODO(berrange): Remove NovaObjectDictCompat
class PciDevice... | {
"content_hash": "3821577addf20e79398d4a2c11e5bd9a",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 78,
"avg_line_length": 38.45077720207254,
"alnum_prop": 0.6292952432286754,
"repo_name": "silenceli/nova",
"id": "53e0a840cdd47badc43846e7fb0dc3710782a689",
"size": "8054"... |
from arelle import PluginManager
from arelle.ModelValue import qname
from arelle import XbrlConst
try:
import regex as re
except ImportError:
import re
from collections import defaultdict
def compile(list, traceRows):
if traceRows:
# compile so each row can be traced by separate expression (slow)
... | {
"content_hash": "b8b3421db68b06c99c03e17f7b9a8d83",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 242,
"avg_line_length": 54.882697947214076,
"alnum_prop": 0.591023243387657,
"repo_name": "sternshus/Arelle",
"id": "97ff6efe0baf81402f019f92b53acf70be03b596",
"size": "18... |
from json import loads, dumps
from winload import Winload
from linload import Linload
from network import Network
from sys import platform
class LocalController:
def __init__(self):
self.platform = ''
self.data = {}
self.dataGetter = None
self.networkWorker = None
self.conf... | {
"content_hash": "523c57836f88ac03a77ed6baedb399c8",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 61,
"avg_line_length": 28.23913043478261,
"alnum_prop": 0.6058506543494996,
"repo_name": "arseniypetrikor/lc-client",
"id": "dc6cf5b9b0376f948b77320a3947555d4401cad7",
"siz... |
def space_out_camel_case(camel):
"""
Converts a "CamelCasedName" to "Camel Case Name".
"""
chars = []
for char in camel:
if len(chars) >= 2 and chars[-1] != ' ':
if char.isupper() and chars[-1].islower():
chars.append(' ')
elif char.islower() and char... | {
"content_hash": "6d3fc23e81052c8398a5ead9e2dc547e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 80,
"avg_line_length": 29.125,
"alnum_prop": 0.5128755364806867,
"repo_name": "servee/servee",
"id": "498394b734eeec12aed9463097d99bdd52ab95cd",
"size": "466",
"binary": ... |
import unittest
import os.path
import codecs
import json
from datetime import datetime
from mock import sentinel
from pyhy.api.registry import HyvesRegistry
from pyhy.api.jsonreader.scrapparser import ScrapParser
class Test(unittest.TestCase):
def setUp(self):
self.r = HyvesRegistry(sentinel.connectiono... | {
"content_hash": "6b1b279af50e1d59e245def4b6bdcdfa",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 91,
"avg_line_length": 34.55555555555556,
"alnum_prop": 0.7020364415862809,
"repo_name": "valhallasw/pyhy",
"id": "23b563d353ce1888a40d4185b6c267d364ad780e",
"size": "933",... |
""" Downloading dataset
"""
from world import world, setup_module, teardown_module
import create_source_steps as source_create
import create_dataset_steps as dataset_create
class TestDownloadDataset(object):
def test_scenario1(self):
"""
Scenario: Successfully exporting a dataset:
... | {
"content_hash": "21be98009488c13f4d986ffa2d46e8d3",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 81,
"avg_line_length": 42.82857142857143,
"alnum_prop": 0.580386924616411,
"repo_name": "ShaguptaS/python",
"id": "971487b85edaa674d0ede9c87dd2199fb1aeed56",
"size": "2118"... |
import sys
import os
import csv
import cv2
from collections import OrderedDict
import argparse
import numpy as np
import pandas as pd
from seqlearn.perceptron import StructuredPerceptron
from seqlearn.evaluation import SequenceKFold
from sklearn.metrics import accuracy_score
from sklearn.externals import joblib
from ... | {
"content_hash": "1fc62b0c44cd3960660d2cb367b31cbb",
"timestamp": "",
"source": "github",
"line_count": 445,
"max_line_length": 81,
"avg_line_length": 32.33483146067416,
"alnum_prop": 0.46806588366113006,
"repo_name": "luigivieira/fsdk",
"id": "bcbb5963cc44b6916b160017403c8a0c21842de2",
"size": "15... |
import pints
import pints.toy
import unittest
import numpy as np
class TestGermanCreditHierarchicalLogPDF(unittest.TestCase):
"""
Tests the logpdf toy distribution from fitting a hierarchical logistic
model to German credit data.
"""
@classmethod
def setUpClass(cls):
""" Set up problem... | {
"content_hash": "d39541f81108f451ef55c5f3579fc09a",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 37.229729729729726,
"alnum_prop": 0.6127041742286752,
"repo_name": "martinjrobins/hobo",
"id": "1cb3e5071351154dad8e1bcc2326d135394eb626",
"size": "3... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('workflow', '0032_auto_20190127_1536'),
('tola_management', '0002_indicatorauditlog'),
]
operations = [
migr... | {
"content_hash": "1c34e8d3b1b6c4169e4abf696ade0c5a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 137,
"avg_line_length": 41.851851851851855,
"alnum_prop": 0.6132743362831858,
"repo_name": "mercycorps/TolaActivity",
"id": "faab5dd6e20c1594857df62fb2ef70aad60eff03",
"siz... |
import flask
from werkzeug.contrib.cache import SimpleCache
import config
import odkviewer.connector
app = flask.Flask(__name__)
cache = SimpleCache()
cache.default_timeout = config.cache_timeout
conn = odkviewer.connector.OdkConnector(config.odkurl, config.odkuser, config.odkpass)
@app.after_request
def gnu_ter... | {
"content_hash": "a06554b1aba1b020a2a386a9b75f4e80",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 86,
"avg_line_length": 24.68421052631579,
"alnum_prop": 0.681592039800995,
"repo_name": "Ongawa/odk-viewer",
"id": "af6abed4011af47e43a1fb1e95dc473b1909495d",
"size": "1430... |
import numpy as np
from astropy.units import UnitsError, UnitConversionError, Unit
from astropy import log
from .nddata import NDData
from .nduncertainty import NDUncertainty
from .mixins.ndslicing import NDSlicingMixin
from .mixins.ndarithmetic import NDArithmeticMixin
from .mixins.ndio import NDIOMixin
from .flag... | {
"content_hash": "b6db4979b1e5d817c39c67ade58e4fec",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 88,
"avg_line_length": 34.52097902097902,
"alnum_prop": 0.582801580066849,
"repo_name": "bsipocz/astropy",
"id": "a230151d918666471f8803f18b339dcbd17703b7",
"size": "10000... |
"""
Installation script for Quantum's development virtualenv
"""
import os
import subprocess
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
VENV = os.path.join(ROOT, '.venv')
PIP_REQUIRES = os.path.join(ROOT, 'tools', 'pip-requires')
PY_VERSION = "python%s.%s" % (sys.version_info[0], ... | {
"content_hash": "4880c9d9c4a538fae2d1640c4790de48",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 77,
"avg_line_length": 28.205357142857142,
"alnum_prop": 0.6293130737575182,
"repo_name": "rcbops/quantum-buildpackage",
"id": "040adbfe8b99c2de2854a6f922ef7369a8534413",
... |
"""A module containing tests for the library implementation of accessing resources."""
import collections
from decimal import Decimal
import os
import re
import pytest
import iati.constants
import iati.resources
import iati.utilities
import iati.validator
import iati.version
import iati.tests.resources
class TestReso... | {
"content_hash": "5697c6aad0478b8cbaf4d0ba30309004",
"timestamp": "",
"source": "github",
"line_count": 687,
"max_line_length": 189,
"avg_line_length": 52.41048034934498,
"alnum_prop": 0.6968005332444592,
"repo_name": "IATI/iati.core",
"id": "36ee80c695f37c99b96335d3d3427961a6eae8fa",
"size": "3600... |
def func_1(apple, my_list):
if apple<10:
# Do something
my_list.append(apple)
return my_list[1:]
def func_2(spongebob, squarepants):
"""A less messy function"""
for char in spongebob:
if char in squarepants:
return char
unused=1
return None
| {
"content_hash": "f00177f73ab6b3b3555738296fc8c0f4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 35,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.5927152317880795,
"repo_name": "edx/diff-cover",
"id": "08991bc7eede1d7399bda54bfa86a0b4adce1ea6",
"size": "302",... |
import math
from collections import defaultdict
from olymap.utilities import get_oid, get_name, get_subkind, to_oid, loop_here2, get_ship_damage
from olypy.db import loop_here
from olymap.utilities import calc_ship_pct_loaded
from olymap.storm import build_basic_storm_dict
from olymap.char import build_basic_char_dict... | {
"content_hash": "54dda084964c49525c8e20bb58fe3a5a",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 102,
"avg_line_length": 35.630872483221474,
"alnum_prop": 0.4925598041062347,
"repo_name": "olympiag3/olypy",
"id": "7a5d33e37b83803e86f99f09330935b477f10b87",
"size": "53... |
import sys
import os
import re
import gzip
#@lint-avoid-python-3-compatibility-imports
# Make directory for output if it doesn't exist
try:
os.mkdir(sys.argv[2] + "/" + sys.argv[1].split("/")[-2])
except OSError:
pass
# Strip off .gz ending
end = "/".join(sys.argv[1].split("/")[-2:])[:-len(".xml.gz")] + ".tx... | {
"content_hash": "459b281d539548bf19a49095d7b3a0b2",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 70,
"avg_line_length": 26.236842105263158,
"alnum_prop": 0.5336008024072216,
"repo_name": "W4ngatang/NAMAS",
"id": "e7ac88b65da255d821b3d5cdcf4c9354adde4973",
"size": "2446... |
import sys
import os
import matplotlib
import numpy
import matplotlib
matplotlib.use('AGG')
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
from matplotlib.ticker import FormatStrFormatter
def getArg(param, default=""):
if (sys.argv.count(param) == 0): return default
i = sys.argv.in... | {
"content_hash": "833477a5752b4bcd02f478a635f568e4",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 77,
"avg_line_length": 24.32,
"alnum_prop": 0.6916118421052632,
"repo_name": "antonyms/AntonymPipeline",
"id": "6533ebd6ffefefed3e7df35379937b7a46bd0f6e",
"size": "1235",
... |
""" unit tests for the model and descriptor packager """
from rdkit import RDConfig
from rdkit.ML.Data import DataUtils
import unittest,os,sys
import io
from rdkit.six.moves import cPickle
from rdkit.ML.ModelPackage import Packager
from rdkit import Chem
import random
def feq(a,b,tol=1e-4):
return abs(a-b)<=tol
cl... | {
"content_hash": "a862268180ef3e9f03e5a1801a2dba3e",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 81,
"avg_line_length": 35.62406015037594,
"alnum_prop": 0.5844238075137189,
"repo_name": "strets123/rdkit",
"id": "b4dce747630637d9b7597360f47705409dc59925",
"size": "4877... |
import mock
from neutron.api import extensions as neutron_extensions
from neutron.api.v2 import attributes
from neutron import context
import neutron.db.api as db
from neutron.extensions import portbindings
from neutron import manager
from neutron.plugins.cisco.common import cisco_constants as c_const
from neutron.plu... | {
"content_hash": "4c6d21cedf6735c75d620161bc02b7cb",
"timestamp": "",
"source": "github",
"line_count": 808,
"max_line_length": 79,
"avg_line_length": 49.14108910891089,
"alnum_prop": 0.5516546617639652,
"repo_name": "virtualopensystems/neutron",
"id": "0d71bf4ab99e6493507132d9e815e9efb76440d5",
"s... |
import argparse
import os
from scheduled_bots.utils import make_deletion_templates, create_rfd
from wikidataintegrator import wdi_core, wdi_helpers
try:
from scheduled_bots.local import WDUSER, WDPASS
except ImportError:
if "WDUSER" in os.environ and "WDPASS" in os.environ:
WDUSER = os.environ['WDUSER... | {
"content_hash": "f08707a635b3f7451d8d4e25fbc46853",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 119,
"avg_line_length": 38.71084337349398,
"alnum_prop": 0.6308745720510427,
"repo_name": "SuLab/scheduled-bots",
"id": "f2c0ae848262c8778c9d6e227c6658ad132d6865",
"size": ... |
'''
Clipboard Gtk3: an implementation of the Clipboard using Gtk3.
'''
__all__ = ('ClipboardGtk3',)
from kivy.utils import platform
from kivy.support import install_gobject_iteration
from kivy.core.clipboard import ClipboardBase
if platform != 'linux':
raise SystemError('unsupported platform for gtk3 clipboard')... | {
"content_hash": "4107dbb2447fb6e25252963072b0c7e7",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 64,
"avg_line_length": 26.6,
"alnum_prop": 0.6265664160401002,
"repo_name": "el-ethan/kivy",
"id": "ce53a3d1b974bc971adda77832c3a46728650d4b",
"size": "1197",
"binary": f... |
"""
Maximum cardinality matching in general graphs.
This module implements the general matching algorithm given in "The General
Maximum Matching Algorithm of Micali and Vazirani" by Paul A. Peterson and
Michael C. Loui, Algorithmica, 1988.
Many terms used in the code comments are explained in the paper by... | {
"content_hash": "bc9bfed16d142bd439f98a724bfcc0d1",
"timestamp": "",
"source": "github",
"line_count": 702,
"max_line_length": 123,
"avg_line_length": 38.13247863247863,
"alnum_prop": 0.5050244686017408,
"repo_name": "AlexanderSoloviev/mv-matching",
"id": "b41e3290386625dea1cf5827618413c1ca75606f",
... |
from django.http import HttpResponse
def home(request):
return HttpResponse("Hello world!") | {
"content_hash": "1c1101cef2585ad5b91a7eaf6dc51825",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 39,
"avg_line_length": 19.4,
"alnum_prop": 0.7628865979381443,
"repo_name": "alex/tracebin",
"id": "1b5680c8b2dd626a52a534a3bb5cdc8a50867e8d",
"size": "97",
"binary": fals... |
"""
based on a Java version:
Based on original version written in BCPL by Dr Martin Richards
in 1981 at Cambridge University Computer Laboratory, England
and a C++ version derived from a Smalltalk version written by
L Peter Deutsch.
Java version: Copyright (C) 1995 Sun Microsystems, Inc.
Translation from C++, Ma... | {
"content_hash": "32fa503c7bbb28ae534f6b59aac1ecbf",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 83,
"avg_line_length": 22.55082742316785,
"alnum_prop": 0.5377922214068561,
"repo_name": "python/performance",
"id": "b9167d1e5574007e89694fc38ac0b19ce25d4fdb",
"size": "9... |
'''
Functions to start and configure the Flask
application. Loads routes from the routes.py
script.
'''
import flask
from app.classes.ckan import CKAN
from app.routes.users import blueprint_users
from app.routes.queues import blueprint_queues
from app.routes.status import blueprint_status
from app.routes.datasets imp... | {
"content_hash": "a2bb743fc220c53e3e0a687bfa65ee4f",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 60,
"avg_line_length": 31.435897435897434,
"alnum_prop": 0.800978792822186,
"repo_name": "luiscape/hdx-monitor-sql-collect",
"id": "6df3da4c0e05f97264ef865d4ac13c3de86668d7",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.