text stringlengths 4 1.02M | meta dict |
|---|---|
# Copyright 2014-2016 The Meson development team
# 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 agree... | {
"content_hash": "f15f6e71d0d9af670ae06b76505815a1",
"timestamp": "",
"source": "github",
"line_count": 783,
"max_line_length": 161,
"avg_line_length": 47.04214559386973,
"alnum_prop": 0.5484878101753814,
"repo_name": "winksaville/meson",
"id": "eb8b0b9da5d2ff67f6a4bb3a326d4bb087a4bae8",
"size": "3... |
import subprocess, time, sys
from copy import deepcopy
clear = 'cls'
if sys.platform != 'win32':
clear = 'clear'
class ParseError(Exception):
def __init__(self, message='Invalid input.'):
Exception.__init__(self, message)
class Stack(object):
"""A database of pages to display pages to the user.
... | {
"content_hash": "429d7fbe5d3bc949460c5b7844419db3",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 78,
"avg_line_length": 27.82127659574468,
"alnum_prop": 0.532425818293056,
"repo_name": "josieheartthrob/guescii",
"id": "516f515e8e734341d835148e239aa801ac38747c",
"size"... |
from django.db import models
from django.dispatch import receiver
from django.db.models.signals import pre_delete, post_save, m2m_changed, post_delete
from website.utils.fileutils import UniquePathAndRename
from image_cropping import ImageRatioField
from .project import Project
from .sponsor import Sponsor
class Ban... | {
"content_hash": "c18009289d0bcfeacdd85496fbf9aa99",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 281,
"avg_line_length": 47.470588235294116,
"alnum_prop": 0.6920693928128873,
"repo_name": "jonfroehlich/makeabilitylabwebsite",
"id": "3300f0ce5907d503b6f50a7d4c2d5d98b14a95... |
"""Provides device conditions for sensors."""
from typing import Dict, List
import voluptuous as vol
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutomationConfig,
)
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_UNIT_OF_MEASUREMENT,
CONF_ABOVE,
CONF_... | {
"content_hash": "a8bc68658f6f3b5822116c28dbfdfb6a",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 77,
"avg_line_length": 32.32142857142857,
"alnum_prop": 0.6176795580110497,
"repo_name": "partofthething/home-assistant",
"id": "e2efac7b141f69d26ea49c7abe141b6dc5e2565f",
... |
import numpy as np
import pickle
import cv2
import cv2.cv as cv
import time
import sys
from sklearn.externals import joblib
caffe_root = '/home/hayden/caffe-recurrent/' # this file is expected to be in {caffe_root}/examples
sys.path.insert(0, caffe_root + 'python')
import caffe
def main():
layers = ['pool5']
... | {
"content_hash": "44ac7cb8af73524692653b19a3a4b16b",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 147,
"avg_line_length": 44.77450980392157,
"alnum_prop": 0.5966717757827896,
"repo_name": "HaydenFaulkner/phd",
"id": "38680f1b935b946f0ea5cb1af66b1371060a1740",
"size": "... |
from __future__ import absolute_import, division, print_function, with_statement
import contextlib
import datetime
import functools
import socket
import sys
import threading
import time
from tornado import gen
from tornado.ioloop import IOLoop, TimeoutError
from tornado.log import app_log
from tornado.stack_context im... | {
"content_hash": "dfb6cb2b1af7d52e58258e4387540c33",
"timestamp": "",
"source": "github",
"line_count": 527,
"max_line_length": 88,
"avg_line_length": 37.51802656546489,
"alnum_prop": 0.6020129476026704,
"repo_name": "jonashagstedt/tornado",
"id": "5ea304463e2b187e3adbd8d96ffade8b62f63b3d",
"size":... |
import pytest
from mitmproxy.test import tflow
from mitmproxy.addons import view
from mitmproxy import flowfilter
from mitmproxy import options
from mitmproxy.test import taddons
def tft(*, method="get", start=0):
f = tflow.tflow()
f.request.method = method
f.request.timestamp_start = start
return f... | {
"content_hash": "7e28e5c4649babe89844752e5dce0f15",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 88,
"avg_line_length": 24.216836734693878,
"alnum_prop": 0.5890656273043295,
"repo_name": "xaxa89/mitmproxy",
"id": "7fa3819ef989d252b69e16099b730a24801bbdfc",
"size": "94... |
__author__ = 'Feng Wang'
from os import walk, path
from SingleFile.PyClustering import clustering
def wrapper(input_path, output_path, k, dist):
"""
A wrapper for PyClustering.clustering.
Do K-means clustering for all data file in a folder.
@param input_path: Data folder
@param k: Number of cent... | {
"content_hash": "4bb08c053dc4347fb4e601bd90d6e063",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 30.358974358974358,
"alnum_prop": 0.5945945945945946,
"repo_name": "wdwind/ImageTrends",
"id": "875525b500a1641c21426da0b6cd154d65b3df03",
"size": "1... |
"""Package resource API
--------------------
A resource is a logical file contained within a package, or a logical
subdirectory thereof. The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is. Do not use os.path operations to manipula... | {
"content_hash": "83849f8acfccefa57fdd5949e2405c32",
"timestamp": "",
"source": "github",
"line_count": 2837,
"max_line_length": 94,
"avg_line_length": 32.87275290800141,
"alnum_prop": 0.6002251769247265,
"repo_name": "jkshaver/virtualenv-1.8.2",
"id": "27b9f83451e2e93f6313f4332e6fbc5311158556",
"s... |
from numpy import random
import pandas as pd
class Generator(object):
def __init__(self):
self.alphabet = 'abcdefghijklmnopqrstuvwxyz'
self.people = {'name' : [], 'height' : [], 'city' : []}
self.cities = {
'name' : [
'Berkeley',
'Denver',
... | {
"content_hash": "1be1ed32f1af8e6809020b2fab80f721",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 125,
"avg_line_length": 32.26,
"alnum_prop": 0.536887786732796,
"repo_name": "deniederhut/workshop_pyintensive",
"id": "0f146ad4fc18acda961a095dac6804e0acb33acf",
"size": "... |
import parse as ps
import codecs
p=ps.parser()
result='hostname,tld,port,path,queue,segment\n'
with codecs.open('../data/result.txt',mode='r',encoding='utf-8') as f:
data=f.read()
data_arr=data.split(',')
data_arr=data_arr[:2000000]
hostnames={}
num=0
for line in data_arr:
line_result=''
line=line[10:-2... | {
"content_hash": "b73a71503d795f2f8cda8e6c70c04a68",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 70,
"avg_line_length": 23.023809523809526,
"alnum_prop": 0.59358841778697,
"repo_name": "xmeng17/Malicious-URL-Detection",
"id": "9dab16b3a071ce8316a2c8ec6090a630fecd861b",
... |
import sys
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot import inventory
class CollectLevelUpReward(BaseTask):
SUPPORTED_TASK_API_VERSION = 1
current_level = 0
previous_level = 0
def initialize(self):
self._process_config()
self.current_level = inventory.player().... | {
"content_hash": "2a0d2893a2e2b72a95bc55d934003295",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 139,
"avg_line_length": 39.346666666666664,
"alnum_prop": 0.5164351067434768,
"repo_name": "goedzo/PokemonGo-Bot",
"id": "2338dcc597ba2eb2294759045c146382234b09bf",
"size":... |
from __future__ import division
from vistrails.core.bundles.pyimport import py_import
import vistrails.core.requirements
from vistrails.gui.modules.source_configure import SourceConfigurationWidget
from PyQt4 import QtCore, QtGui
from vistrails.gui.theme import CurrentTheme
def TextEditor(parent=None):
try:
... | {
"content_hash": "9f07833ddc1d5cd8ea3c360851906666",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 101,
"avg_line_length": 37.51219512195122,
"alnum_prop": 0.5966623320329432,
"repo_name": "hjanime/VisTrails",
"id": "6c6c4461138bab39a42110f19673a7be0d6628fb",
"size": "6... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
import random
import string
from flexget import plugin
from flexget.event import event
from flexget.entry import Entry
log = logging.getLogger('gen_series')
PE... | {
"content_hash": "2df841dd3b983c917c50905fda38445e",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 117,
"avg_line_length": 31.294871794871796,
"alnum_prop": 0.5620647275706677,
"repo_name": "oxc/Flexget",
"id": "464ccb4a13d40d0c93e3e4c78d182d74fda7da80",
"size": "2441",
... |
import os
import json
def test_compendium(script_runner, tmpdir):
ret = script_runner.run('o2r-meta', '-debug', 'extract',
'-i', 'extract/compendium',
'-o', str(tmpdir),
'-xo', '-m')
print(ret.stdout)
print(ret.stderr)
assert ret.success, "process should return success"
as... | {
"content_hash": "d258193f16908d0977af5e121d98cbdc",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 129,
"avg_line_length": 42.29807692307692,
"alnum_prop": 0.6462832461923165,
"repo_name": "o2r-project/o2r-meta",
"id": "28c68a8c5c2c9d3d665d372774f8539bb1221e8d",
"size":... |
"""
test_django-frontend-decouple
------------
Tests for `django-frontend-decouple` models module.
"""
import os
import shutil
import unittest
from frontend import models
class TestFrontend(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self):
... | {
"content_hash": "7af3ae91d185b09fd714b31fb38c2062",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 51,
"avg_line_length": 13.833333333333334,
"alnum_prop": 0.6566265060240963,
"repo_name": "DjenieLabs/django-frontend-decouple",
"id": "01fb1159f3d8e4610a11afb50f55bfbe1e2404... |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class Operations(object):
"""Operations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An ob... | {
"content_hash": "1d6af6a76b853a036971b2952f4ffbf1",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 144,
"avg_line_length": 37.766666666666666,
"alnum_prop": 0.6301853486319505,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "ab97c65dfadcf2bdc01d5c81da926adf0593a677"... |
"""
Rotation around the z-axis.
"""
from qiskit import CompositeGate
from qiskit import Gate
from qiskit import InstructionSet
from qiskit import QuantumCircuit
from qiskit import QuantumRegister
from qiskit.extensions.standard import header # pylint: disable=unused-import
class RZGate(Gate):
"""rotation around ... | {
"content_hash": "65bc37ba1ff71b74d4eb05cf167beb24",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 87,
"avg_line_length": 26.647058823529413,
"alnum_prop": 0.6129506990434143,
"repo_name": "atilag/qiskit-sdk-py",
"id": "4959b8f6bab850367317a37fcf37a038612fd36f",
"size": ... |
import json
import unittest
from models import *
class TestAgent(unittest.TestCase):
def setUp(self):
self.agent = Agent(label="Agent")
def test_init(self):
self.assert_(isinstance(self.agent, Agent))
def test_rdf_properties(self):
self.assert_(hasattr(self.agent, 'authorityAssig... | {
"content_hash": "805cbcb12cf24c20e77681fa3d2cb6b5",
"timestamp": "",
"source": "github",
"line_count": 2587,
"max_line_length": 102,
"avg_line_length": 49.44994201778121,
"alnum_prop": 0.6692332345790959,
"repo_name": "jermnelson/flask_bibframe",
"id": "002771f2f6b59f795e2ae78ef1c9a3b2f4b76d92",
"... |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
tournament = Table('tournament', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('official_title', String(length=128)),
Column('host', String(length=1... | {
"content_hash": "33f75e912ee0a00a6708a32431bd0d6e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 68,
"avg_line_length": 32.542857142857144,
"alnum_prop": 0.6883230904302019,
"repo_name": "lawrluor/matchstats",
"id": "983ac84649e72e7936e07f42f090b73192d02781",
"size": "... |
__all__ = [
'OAuthToken',
]
class OAuthToken(object):
"""OAuth credentials base-class. Several implementations are available:
this class:
provides crawler what is require to authenticate against sources
via OAuth.
"""
def __init__(self, access_token, refresh_token=None,
... | {
"content_hash": "86dde8bd71b508c86796a8c45df3817c",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 30.32857142857143,
"alnum_prop": 0.6241168158266603,
"repo_name": "LilliJane/docido-python-sdk",
"id": "c889ddbc8ada7e6cbe076a76a714c990ea943afe",
"s... |
import re
import sys
import pgcs.core.data
import pgcs.core.diff
import pgcs.core.load
core = pgcs.core
def get_entries(named_object_list):
if named_object_list:
return named_object_list.entries
else:
return []
def get_object(entry):
obj1, obj2 = entry.diff.objects
if obj1 is not None and obj2 is None:
ret... | {
"content_hash": "abea27512a8e608f7302e4508f791aa6",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 64,
"avg_line_length": 24.211267605633804,
"alnum_prop": 0.6559045956951716,
"repo_name": "somia/pgcs",
"id": "ba32d572ce029bf3f2fa6309e794a373fcc37069",
"size": "3438",
... |
class Assign:
"""Expr for Asssignments.
This type of expressions can be parsed anywhere, but can only be resolved
within function call arguments.
"""
def __init__(self, name, value):
self.name = name
self.value = value
def __eq__(self, other):
if not isinstance(other, ... | {
"content_hash": "453583e69a0dda396556e55d670facc9",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 91,
"avg_line_length": 28.80327868852459,
"alnum_prop": 0.5655473344716373,
"repo_name": "bambinos/formulae",
"id": "13b60063b333df9c762e5e6e9bf43ec3d984bfa6",
"size": "52... |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the right... | {
"content_hash": "f0a446868411bf151028a02d8e856ff3",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 145,
"avg_line_length": 42.10857142857143,
"alnum_prop": 0.6103948975437644,
"repo_name": "croxis/SpaceDrive",
"id": "4b546d3a8a0e118d15724483ed3f687b87356e90",
"size": "7... |
from django.utils.translation import ugettext_lazy as _
from taiga.base.api import ModelCrudViewSet
from taiga.base.api import ModelUpdateRetrieveViewSet
from taiga.base.api.mixins import BlockedByProjectMixin
from taiga.base import exceptions as exc
from taiga.base import filters
from taiga.base import response
from... | {
"content_hash": "98cbdf6de2e10960bc03e6ed1d78ff11",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 101,
"avg_line_length": 42.46153846153846,
"alnum_prop": 0.7409420289855072,
"repo_name": "curiosityio/taiga-docker",
"id": "a11d6e31869f1423518100c756e89c683f72167c",
"si... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['deprecated'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: vultr_region_facts
deprecated:
removed_in: '2.13'
w... | {
"content_hash": "a516b6f46732aff693a3fab1c72253d8",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 99,
"avg_line_length": 25.872180451127818,
"alnum_prop": 0.6262714327230456,
"repo_name": "thaim/ansible",
"id": "ec0a81cadd9140f10e8bf163ef95f3b4e0f5c00a",
"size": "3633"... |
from datetime import datetime, timedelta
from time import time
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from canvas.browse import frontpage_algorithms
from canvas.models import Content, Comment, Category
class Command(BaseCommand):
args = ''
help = 'Up... | {
"content_hash": "a5bb694ff5680f0c0b96e96ab18daa9e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 105,
"avg_line_length": 33.795918367346935,
"alnum_prop": 0.6280193236714976,
"repo_name": "canvasnetworks/canvas",
"id": "b2f8b4e1fcb06696a0b922ab4ab64f8258116b6f",
"size"... |
def str2tuple(s, sep='/'):
"""
Given the string representation of a tagged token, return the
corresponding tuple representation. The rightmost occurrence of
*sep* in *s* will be used to divide *s* into a word string and
a tag string. If *sep* does not occur in *s*, return (s, None).
>>> f... | {
"content_hash": "efedda754a52d84f937d08654516ce63",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 69,
"avg_line_length": 32,
"alnum_prop": 0.6138059701492538,
"repo_name": "haya14busa/alc-etm-searcher",
"id": "6893f3602da948d035ffdcf2ab0f5143b3dbe12e",
"size": "2389",
... |
"""The tests for the Netatmo sensor platform."""
from unittest.mock import patch
import pytest
from homeassistant.components.netatmo import sensor
from homeassistant.components.netatmo.sensor import MODULE_TYPE_WIND
from homeassistant.helpers import entity_registry as er
from .common import TEST_TIME, selected_platf... | {
"content_hash": "4165e5e83d768ace989f6e5697eb712c",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 87,
"avg_line_length": 31.43404255319149,
"alnum_prop": 0.5850819006362529,
"repo_name": "aronsky/home-assistant",
"id": "bebd8e0191c487b5e5838e6d0bc0faed6ef14e17",
"size"... |
import os
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseForbidden, HttpResponseBadRequest
from django.contrib.sessions.models import Session
from... | {
"content_hash": "f9f8dc8e20502be6a8f703a72bdb694c",
"timestamp": "",
"source": "github",
"line_count": 367,
"max_line_length": 207,
"avg_line_length": 39.91280653950954,
"alnum_prop": 0.6060212998361552,
"repo_name": "stefanfoulis/django-image-filer",
"id": "bb00df54104dc453981b100432241108ecea7185"... |
'''
Copyright 2015 Planet Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... | {
"content_hash": "980b16c4cae08884617014689916f17f",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 78,
"avg_line_length": 41.90983606557377,
"alnum_prop": 0.6377860355955408,
"repo_name": "planetlabs/radiometric_normalization",
"id": "a4e971769d770b4c9e393dce212d1f22c86e6... |
import pickle
import os
import sys
import inspect
almost_current = os.path.abspath(inspect.getfile(inspect.currentframe()))
currentdir = os.path.dirname(almost_current)
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from models.tensorflow_model import TFWord2Vec # noqa
from models.gensim_model... | {
"content_hash": "81af62f58f282feb22d0c29764c7e8a5",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 76,
"avg_line_length": 35.92248062015504,
"alnum_prop": 0.5038843331894691,
"repo_name": "LIAMF-USP/word2vec-TF",
"id": "cc36c7eeb884f8512542553174430ba8a8021171",
"size":... |
"""End to end tests that run flows on actual clients."""
from grr.endtoend_tests import administrative
from grr.endtoend_tests import artifacts
from grr.endtoend_tests import base
from grr.endtoend_tests import collectors
from grr.endtoend_tests import discovery
from grr.endtoend_tests import file_finder
from grr.endt... | {
"content_hash": "ac4141a1bfaff4946e3b4165b8939287",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 56,
"avg_line_length": 35.05263157894737,
"alnum_prop": 0.8333333333333334,
"repo_name": "pchaigno/grreat",
"id": "b04e82a6d16a12ac917ab541110ab425c986acec",
"size": "688",... |
import unittest
from quickbooks.objects.customer import Customer
class CustomerTests(unittest.TestCase):
def test_unicode(self):
customer = Customer()
customer.DisplayName = "test"
self.assertEquals(unicode(customer), "test")
def test_to_ref(self):
customer = Customer()
... | {
"content_hash": "91772922ee0aa5e6beeb1187bb0825e8",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 52,
"avg_line_length": 24.954545454545453,
"alnum_prop": 0.6411657559198543,
"repo_name": "ferdiaz/python-quickbooks",
"id": "f3ab4d87edaca370884faef36f122cd7aa52ca60",
"si... |
from __future__ import print_function
from __future__ import unicode_literals
from io import open
from glob import glob
import sys
import os
import os.path
import subprocess
import optparse
VALGRIND_CMD = 'valgrind --tool=memcheck --leak-check=yes --undef-value-errors=yes'
class TestProxy(object):
def __init__(se... | {
"content_hash": "18b14fd039501959a70558ec6edabe51",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 109,
"avg_line_length": 33.936708860759495,
"alnum_prop": 0.6068631107795599,
"repo_name": "Huawei/eSDK_eLTE_SDK_Windows",
"id": "08850ec1a1da42eb98d2569ffd1a6c26b62454ab",
... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/spices/shared_spice_giggledust.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "c2e291a6ebea029387b4c2f4ccc856a9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 78,
"avg_line_length": 23.615384615384617,
"alnum_prop": 0.6970684039087948,
"repo_name": "obi-two/Rebelion",
"id": "4bac8e0c8cc5f8cb3c5965ea18b6dc289d8c9a02",
"size": "452... |
from django.utils.six.moves.urllib import parse as urlparse
from django.utils.six import BytesIO
import django
try:
from django.utils.deconstruct import deconstructible
except ImportError: # Django 1.7+ migrations
deconstructible = lambda klass, *args, **kwargs: klass
# Storage only accepts `max_length` in 1... | {
"content_hash": "0627b5cf25dab46e77ce22cf57e5ac95",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 36.107142857142854,
"alnum_prop": 0.7359050445103857,
"repo_name": "torchbox/django-storages",
"id": "8bb898f15596ef9bdd5509841721304d1ca76dd4",
"siz... |
import rospy
from race.msg import drive_values
from race.msg import drive_param
from std_msgs.msg import Bool
pub = rospy.Publisher('drive_pwm', drive_values, queue_size=10)
em_pub = rospy.Publisher('eStop', Bool, queue_size=10)
# function to map from one range to another, similar to arduino
def arduino_map(x, in_min... | {
"content_hash": "8cf226817bd60fd2543b67d34e23fa94",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 73,
"avg_line_length": 30.02857142857143,
"alnum_prop": 0.7117031398667936,
"repo_name": "rdelfin/cyberphysical-robot-car",
"id": "d99f19290c219225e275d97b6a5e0dfec9200dd7",
... |
"""
The MIT License (MIT)
Copyright (c) 2016 Daniele Linguaglossa <d.linguaglossa@mseclab.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation th... | {
"content_hash": "ff7fca0cbcd7b703b070abdcb6afaa0e",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 123,
"avg_line_length": 42.19259259259259,
"alnum_prop": 0.6234199438202247,
"repo_name": "mseclab/PyJFuzz",
"id": "13205ed6d7d32390b83079e07c0adc6c2888bc8b",
"size": "569... |
"""
Utility functions for supporting the XML Schema Datatypes hierarchy
"""
from rdflib import XSD
XSD_DTs = set(
(XSD.integer, XSD.decimal, XSD.float, XSD.double, XSD.string,
XSD.boolean, XSD.dateTime, XSD.nonPositiveInteger, XSD.negativeInteger,
XSD.long, XSD.int, XSD.short, XSD.byte, XSD.nonNegativeI... | {
"content_hash": "56671dcf2291c9ad944730aefc4352bb",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 80,
"avg_line_length": 31.12280701754386,
"alnum_prop": 0.62119503945885,
"repo_name": "dbs/rdflib",
"id": "be2351e203f8499c7e28755b6e272691f8ec6591",
"size": "1774",
"bi... |
"""
This script evaluates trained models that have been saved to the filesystem.
See mnist_tutorial_picklable.py for instructions.
"""
# pylint: disable=missing-docstring
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
... | {
"content_hash": "4cf5998b00897957e3bc49cbacc39568",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 79,
"avg_line_length": 29.236842105263158,
"alnum_prop": 0.660966096609661,
"repo_name": "cleverhans-lab/cleverhans",
"id": "b9de18e38f3f1c42bb5a38791ffcb4ee51b6549d",
"si... |
"""
https://leetcode.com/problems/majority-element/
https://leetcode.com/submissions/detail/109296614/
"""
class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
dic = dict()
for value in nums:
if not value in... | {
"content_hash": "7edcf4535f1213d66ad82d73d86a3cee",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 64,
"avg_line_length": 22.285714285714285,
"alnum_prop": 0.5512820512820513,
"repo_name": "vivaxy/algorithms",
"id": "81254bb8f5aeddf6db1858eab3f5fcc1bff8e48d",
"size": "78... |
from rspecs.commons import DEFAULT_XMLNS, DEFAULT_XS, DEFAULT_SCHEMA_LOCATION,\
DSL_PREFIX, PROTOGENI_PREFIX
from rspecs.commons_tn import DEFAULT_SHARED_VLAN
from rspecs.formatter_base import FormatterBase
from lxml import etree
DEFAULT_AD_SCHEMA_LOCATION = DEFAULT_SCHEMA_LOCATION
DEFAULT_AD_SCHEMA_LOCATION += DS... | {
"content_hash": "2820ca1ce0beb1341abaa395c47ba5bb",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 79,
"avg_line_length": 45.6,
"alnum_prop": 0.5893640350877193,
"repo_name": "ict-felix/stack",
"id": "3544c73f14c65e59510cac6cf63015e4b84ac5ea",
"size": "3648",
"binary":... |
import unittest
from zang.inboundxml.elements.refer import Refer
from zang.domain.enums.http_method import HttpMethod
from zang.inboundxml.elements.sip import Sip
class TestRefer(unittest.TestCase):
def test_init_with_required_values(self):
expected = '<Refer></Refer>'
assert Refer().xml == expec... | {
"content_hash": "dbc8053815f2531c9b8ef9059139705f",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 69,
"avg_line_length": 32.42253521126761,
"alnum_prop": 0.6185925282363163,
"repo_name": "zang-cloud/zang-python",
"id": "b6738d7a05ade3803c8b518f9f81cffdd3d373fc",
"size":... |
from mock import Mock
from allura.model import VotableArtifact
class TestVotableArtifact(object):
def setUp(self):
self.user1 = Mock()
self.user1.username = 'test-user'
self.user2 = Mock()
self.user2.username = 'user2'
def test_vote_up(self):
vote = VotableArtifact()
... | {
"content_hash": "49fdf58674ae81f1d2a91461504e7094",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 78,
"avg_line_length": 31.433333333333334,
"alnum_prop": 0.5885471898197243,
"repo_name": "Bitergia/allura",
"id": "cfb3bf84a0dfe17218a3c7c632cd1edeaea1d61c",
"size": "1886... |
def run(name, fields="+l", exclude=None, ctags="/usr/local/bin/ctags",
creates='tags'):
from os.path import join
if fields is None:
fields = []
elif isinstance(fields, str):
fields = [fields]
fields = " --fields=".join([""] + fields)
if exclude is None:
exclude = []
... | {
"content_hash": "d6c6e119a197f9df5fbebca393fc332a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 78,
"avg_line_length": 33.6,
"alnum_prop": 0.5357142857142857,
"repo_name": "mdavezac/pepper",
"id": "47afac521d4894723bb6514e0aa98b9b3a7bfd4f",
"size": "672",
"binary": ... |
import hashlib
import os
import platform
import re
import signal
import sys
import tempfile
import time
try:
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "lib")))
import psutil
except (ImportError, NotImplementedError):
class psutil(object):
class Process(object):
def __ini... | {
"content_hash": "50dd5574a4d0386dc343df7ee842a566",
"timestamp": "",
"source": "github",
"line_count": 636,
"max_line_length": 123,
"avg_line_length": 39.68238993710692,
"alnum_prop": 0.5718757429273318,
"repo_name": "blackberry/ALF",
"id": "8cda15eea03fb6468a915e60159c11c93e7db6b2",
"size": "2607... |
from sqlalchemy import Column, Integer, String, Boolean
from todo.database import Base
class Entry(Base):
__tablename__ = "entries"
id = Column(Integer, primary_key=True)
title = Column(String)
order = Column(Integer)
completed = Column(Boolean)
def __init__(self, title=None, order=None):
... | {
"content_hash": "378be16a62095a064f941c497f1b2ce7",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 55,
"avg_line_length": 27.88235294117647,
"alnum_prop": 0.6329113924050633,
"repo_name": "Faerbit/todo-backend-flask",
"id": "c97869a1d23a4d2de17c6d43c5d92529ff75bedc",
"si... |
from nose.tools import ok_, eq_, raises
from flask import Flask, request
from flask.views import MethodView
from flask.ext.admin import base
class MockView(base.BaseView):
# Various properties
allow_call = True
allow_access = True
visible = True
@base.expose('/')
def index(self):
ret... | {
"content_hash": "623cb6b439c08baa67adcf32a91ccc94",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 91,
"avg_line_length": 25.49438202247191,
"alnum_prop": 0.6067650947553989,
"repo_name": "michaelBenin/flask-admin",
"id": "ffa6c936cfc45b2ff004409b881fd03c2b8754f9",
"siz... |
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.service as service
import osgtest.library.osgunittest as osgunittest
class TestStopCondor(osgunittest.OSGTestCase):
def test_01_stop_condor(self):
core.skip_ok_unless_installed('condor')
self.skip_ok_u... | {
"content_hash": "78eae05ea1ccb8124e685fb09e50b477",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 89,
"avg_line_length": 42.23076923076923,
"alnum_prop": 0.7340619307832422,
"repo_name": "efajardo/osg-test",
"id": "b1e805af745b5fb421dd69a189d796075c9e2115",
"size": "549... |
import tensorflow as tf
import numpy as np
import unittest
from dnc.controller import BaseController
class DummyController(BaseController):
def network_vars(self):
self.W = tf.Variable(tf.truncated_normal([self.nn_input_size, 64]))
self.b = tf.Variable(tf.zeros([64]))
def network_op(self, X):... | {
"content_hash": "1bcf2e088d5ea4e0fb0795830e8f04d5",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 130,
"avg_line_length": 45.12658227848101,
"alnum_prop": 0.5706872370266479,
"repo_name": "nazoking/DNC-tensorflow",
"id": "7f3136630f59871d4ac2e8ff679a685ec95fc61b",
"siz... |
"""Execute the tests for snp_store.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage: run_tests.py SOURCE_ROOT_PATH ... | {
"content_hash": "a8481fa13db1af684279ccbc700ba657",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 79,
"avg_line_length": 39.84153005464481,
"alnum_prop": 0.5185845563022905,
"repo_name": "h-2/seqan",
"id": "b0841e1bdb75c30ed4f780b1062c188f8cb01613",
"size": "7313",
"... |
from .MusicWebsiteParser import MusicWebsiteParser
from ..FileDownload import FileDownload
from BeautifulSoup import BeautifulSoup
class YoutubeParser(MusicWebsiteParser):
def Parse(self,song_name):
song_name = '+'.join(song_name)
url="https://www.youtube.com/results?search_query="
url=url+song_name
file_dow... | {
"content_hash": "705df82acfb05e9bdb6ad4b3efe2aa1a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 132,
"avg_line_length": 34.21052631578947,
"alnum_prop": 0.7492307692307693,
"repo_name": "ankitmathur3193/song-cli",
"id": "ddecf390e4ece1a245d12bf534070c064cbfc12b",
"siz... |
"""
Copyright 2020 Google LLC
Copyright 2020 PerfectVIPs Inc.
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... | {
"content_hash": "805e1e1800a1e268767028d17b7bbdbf",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 91,
"avg_line_length": 34.64705882352941,
"alnum_prop": 0.5745816153286442,
"repo_name": "google/riscv-dv",
"id": "5de8125c66b8c67c4c36fe054faa3ed35ff43b82",
"size": "4123... |
import sys
import django
from django.conf import settings
SETTINGS = {
'DATABASES': {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
},
'INSTALLED_APPS': (
'django.contrib.auth',
'django.contrib.contenttypes',
'dj... | {
"content_hash": "622da2a849ad21c6543d1217a9591981",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 75,
"avg_line_length": 26.84,
"alnum_prop": 0.5946348733233979,
"repo_name": "tubaman/django-macaddress",
"id": "e94ea25fe1d8c54dd0c0615eac9ad857dd4408d8",
"size": "2035",
... |
"""
A module that contains the interfaces which describing our Logger API
"""
from zope.interface import Interface, Attribute
__author__ = 'dimd'
class ILogger(Interface):
"""
A Base logger interface
"""
default = Attribute("default logging module")
origin = Attribute("Current module")
def ... | {
"content_hash": "72acc1fa587f66896674fe90bfc63020",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 69,
"avg_line_length": 18.604166666666668,
"alnum_prop": 0.5274356103023516,
"repo_name": "dimddev/NetCatKS",
"id": "1b7121f3454dfcb00022a4c37b6127faeeb4a515",
"size": "893... |
from argparse import ArgumentParser
from datetime import datetime
from gocept.runner import once
from logging import getLogger
from pprint import pformat
from zeit.cms.interfaces import ICMSContent
import zeit.find.search
log = getLogger(__name__)
def convert(conditions):
for condition in conditions:
na... | {
"content_hash": "33b8c223ac73e292b272b10ed095cdf1",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 33.422222222222224,
"alnum_prop": 0.648936170212766,
"repo_name": "ZeitOnline/zeit.find",
"id": "cd9c1211f13afeabca3b750fcc93e14015f37d0c",
"size": "... |
import kid
import sys
import time
import webob
from webob import exc as web_exc
from mint import shimclient
from mint import userlevels
from mint.helperfuncs import getProjectText, weak_signature_call
from mint.mint_error import MintError
from mint.web import fields
from mint.web.admin import AdminHandler
from mint.we... | {
"content_hash": "7ea04a41caea5ec070a353e38c725cf9",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 139,
"avg_line_length": 37.55232558139535,
"alnum_prop": 0.5647933116581514,
"repo_name": "sassoftware/mint",
"id": "1a2fcf7cb5e06e69de07884ce6917862b2db8626",
"size": "70... |
from __future__ import division
import os
import sys
import socket
import signal
import functools
import atexit
import tempfile
from subprocess import Popen, PIPE, STDOUT
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty
from time import sleep
tr... | {
"content_hash": "0be41311196cd2ec3d3a619665d8589a",
"timestamp": "",
"source": "github",
"line_count": 482,
"max_line_length": 79,
"avg_line_length": 28.804979253112034,
"alnum_prop": 0.6011956208585422,
"repo_name": "tbabej/task",
"id": "d41ac09ccc792f5dd4e33aaf8e554891ccfeebf8",
"size": "13908",... |
import sys
import contextlib
import click
from ..consts import DEFAULT_APP_PORT
from ...client import Client
import __main__
@contextlib.contextmanager
def _client_ctx(app_name, service, host, port):
pass
@click.command()
@click.option('-h', '--host', default='localhost',
help='service host(defau... | {
"content_hash": "b82b5f71104df841bdf1af4ba5837dd7",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 76,
"avg_line_length": 26.742857142857144,
"alnum_prop": 0.6282051282051282,
"repo_name": "MrKiven/REST_ARCH",
"id": "ee1d7484252adae0280664d01d7c9a00ae58ee7d",
"size": "96... |
import os
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.security import Everyone, Authenticated, Allow
from pyramid.session import SignedCookieSessionFactory
from passlib.apps import custom_app_context as context
class MyRoot(objec... | {
"content_hash": "efd389cad3458c63b922f8ecc9073362",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 64,
"avg_line_length": 33.708333333333336,
"alnum_prop": 0.7033374536464772,
"repo_name": "Casey0Kane/pyramid-learning-journal",
"id": "859f0bafbbf2c9f37604513caddee2d3e8184e... |
from ehb_client.requests.base import JsonRequestBase, RequestBase, IdentityBase
import json
from ehb_client.requests.exceptions import InvalidArguments
from ehb_client.requests.subject_request_handler import Subject
from ehb_client.requests.external_record_request_handler import ExternalRecord
class Group(IdentityBas... | {
"content_hash": "f75d665959a479b083dda9144b0312b1",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 104,
"avg_line_length": 38.742990654205606,
"alnum_prop": 0.6046315281630684,
"repo_name": "chop-dbhi/ehb-client",
"id": "357caea0f2fb14167bb133a4325ceed14f6deb0e",
"size"... |
from abc import ABCMeta, abstractmethod
class Algorithm(object):
__meta__ = ABCMeta
def __init__(self, data, cache_size):
self.data = data
self.cache_size = cache_size
@abstractmethod
def compute(self):
pass
| {
"content_hash": "602c1f219e20dc2aedcb31c6fcc7e2ca",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 41,
"avg_line_length": 19.384615384615383,
"alnum_prop": 0.6150793650793651,
"repo_name": "vtemian/uni-west",
"id": "3d6bd7087d3b295d609e9f8e8d566d66c1b2a5cc",
"size": "252... |
import typer
def main(file: typer.FileBinaryWrite = typer.Option(...)):
first_line_str = "some settings\n"
# You cannot write str directly to a binary file, you have to encode it to get bytes
first_line_bytes = first_line_str.encode("utf-8")
# Then you can write the bytes
file.write(first_line_byt... | {
"content_hash": "77e728f5ed583e6b44cbb296069173d2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 88,
"avg_line_length": 32.1764705882353,
"alnum_prop": 0.6654478976234004,
"repo_name": "tiangolo/typer",
"id": "1fa3ae825c9f23b4e0ab3db5ab39759fe5de2f5f",
"size": "547",
... |
"""FederatedData backed by SQLite."""
from typing import Callable, Iterable, Iterator, Optional, Tuple, List
import zlib
from fedjax.core import client_datasets
from fedjax.core import federated_data
from fedjax.core import serialization
import numpy as np
import sqlite3
def decompress_and_deserialize(data: bytes):... | {
"content_hash": "7af53ce179d101dd4e3e28f35b71d661",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 117,
"avg_line_length": 36.19749216300941,
"alnum_prop": 0.6417251234086776,
"repo_name": "google/fedjax",
"id": "caec2883cd1114da3938caeb7c132361a0675bc3",
"size": "12122... |
import os
import sys
import subprocess
from numba import cuda
import unittest
try:
import git # noqa: F401 from gitpython package
except ImportError:
has_gitpython = False
else:
has_gitpython = True
try:
import yaml # from pyyaml package
except ImportError:
has_pyyaml = False
else:
has_pyya... | {
"content_hash": "4fda8e3d5c864ac9998864bf1cba7d2b",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 79,
"avg_line_length": 39.01990049751244,
"alnum_prop": 0.6033405584597731,
"repo_name": "stonebig/numba",
"id": "e99bd486d76fb4f2cf363a036ea65a8117586bfa",
"size": "7843"... |
import logging
#import logging.config
from logging.handlers import RotatingFileHandler
import sys
#logging.config.fileConfig('logging.conf')
LOG_FILENAME = "/home/tinyos/devel/BerePi/logs/berelogger.log"
#LOG_FILENAME = "/Users/tinyos/devel/BerePi/logs/berelogger.log"
logger = logging.getLogger('BereLogger')
logger.s... | {
"content_hash": "7d20a06664fb2c634f2c995bdb72ec14",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 122,
"avg_line_length": 29.092307692307692,
"alnum_prop": 0.6583818085668959,
"repo_name": "jeonghoonkang/BerePi",
"id": "dedfc984dcbf39ba7eb26058b4d6abca9623be30",
"size":... |
import itertools
import unittest
from distutils.version import StrictVersion
import numpy as np
import pandas as pd
import pytest
from coremltools._deps import _HAS_SKLEARN, _SKLEARN_VERSION
from coremltools.models.utils import (_is_macos, _macos_version,
evaluate_classifier)
if... | {
"content_hash": "9f6840fb0547f24fd9ae3c90e80734a6",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 88,
"avg_line_length": 35.580882352941174,
"alnum_prop": 0.623269270510436,
"repo_name": "apple/coremltools",
"id": "b1be9b5440f5f63119f3f330bc5a29df79a8b1db",
"size": "50... |
from __future__ import unicode_literals, print_function
from django.urls import reverse
from rest_framework import status
from mezzanine.blog.models import BlogCategory
from tests.utils import TestCase
class TestCategoryViewSet(TestCase):
"""
Test the API resources for categories
"""
def setUp(self):... | {
"content_hash": "7822a68e14095bf773dff10987b6dc76",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 102,
"avg_line_length": 36.4390243902439,
"alnum_prop": 0.6329763498438197,
"repo_name": "gcushen/mezzanine-api",
"id": "18bea6c60ee4709df27c23aeef2e4008e587511f",
"size":... |
import collections
import datetime
import random
import re
from dashie_sampler import DashieSampler
import requests
class JenkinsSampler(DashieSampler):
JOBS_KEY = ['name']
STATUS_KEY = ['color']
SEVERITY_MAP = {
'red': '1',
'notbuilt': '2',
'blue_anime': '11',
'blue': '... | {
"content_hash": "27c1feabf096f000161db7ed5ff19d0d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 135,
"avg_line_length": 26.766233766233768,
"alnum_prop": 0.5327510917030568,
"repo_name": "edhiley/pydashie",
"id": "362244d6873c9585c9e712fd5178efe08123a920",
"size": "20... |
from __future__ import absolute_import
from traits.api import Any, Bool
from pychron.envisage.tasks.base_editor import BaseTraitsEditor
# ============= standard library imports ========================
# ============= local library imports ==========================
class LaserEditor(BaseTraitsEditor):
componen... | {
"content_hash": "92aab2461247fd4d0c6f91f0cc872c60",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 65,
"avg_line_length": 25.272727272727273,
"alnum_prop": 0.5311750599520384,
"repo_name": "NMGRL/pychron",
"id": "ffa6179ac61a6a0660521f009d78da53e0ac489a",
"size": "1636",... |
import http.server
import socketserver
import argparse
import sys
import os
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--port', dest='port', default=8080, type=int, help='Serving port.')
parser.add_argument('-m', '--make', dest='make', default=True, action='store_true', help='Run the makefile.')
por... | {
"content_hash": "0be90db97e252fad5a9f306421056479",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 109,
"avg_line_length": 33.57142857142857,
"alnum_prop": 0.6627659574468086,
"repo_name": "vacancy/TensorArtist",
"id": "1794447fd56c312c7fe83928f5b5f9595332dd52",
"size": ... |
__version__ = "1.0.0"
"""
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
"""
| {
"content_hash": "ee842022d20738f8daaaf2493433d0b4",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 59,
"avg_line_length": 24.75,
"alnum_prop": 0.5909090909090909,
"repo_name": "nmante/image_deduplication",
"id": "ef50b94b7c5be23d16aa867b45a45e97616fa20e",
"size": "198",
... |
import sys
import unittest
from supervisor.web import MeldView, StatusView
from supervisor.xmlrpc import RPCError
from unittest.mock import call, patch, Mock
from supvisors.tests.base import ProcessInfoDatabase
class ViewProcAddressTest(unittest.TestCase):
""" Test case for the viewprocaddress module. """
... | {
"content_hash": "7aa67c7e37c69ef8d87bd1614fd7e20d",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 106,
"avg_line_length": 52.29441624365482,
"alnum_prop": 0.6008542030673656,
"repo_name": "julien6387/supervisors",
"id": "7d95710cc46d2235ee079184ba41c89eeee41c42",
"size... |
import os
from utils import DATA_PROCESSED_DIR
import numpy as np
from vocab import get_vocab, VOCAB_SIZE
from quatrains import get_quatrains
from gensim import models
from numpy.random import uniform
_w2v_path = os.path.join(DATA_PROCESSED_DIR, 'word2vec.npy')
_w2v_model_path = os.path.join(DATA_PROCESSED_DIR, 'word2... | {
"content_hash": "9e4c88291af756bb808c10510715d96b",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 118,
"avg_line_length": 44.46478873239437,
"alnum_prop": 0.6607538802660754,
"repo_name": "Disiok/poetry-seq2seq",
"id": "d1700481e700c6f59ca247b0ed38b6f51bd7eb99",
"size":... |
"""
Library functions for Bugbase. Contains all of Bugbase core and logic
"""
__author__ = 'Benjamin Schubert, benjamin.schubert@epfl.ch'
import inspect
def get_subclasses(base_class: callable) -> list:
"""
Gets all non abstract subclasses for a given base class
:param base_class: the base class of whic... | {
"content_hash": "668d1e49c63600bf9d1425fbb403a055",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 69,
"avg_line_length": 27.26086956521739,
"alnum_prop": 0.6842105263157895,
"repo_name": "dslab-epfl/bugbase",
"id": "2cd5f348e3f9ab52500d91c2302764b637591732",
"size": "66... |
"""Functional utilities for Python 2.4 compatibility."""
# License for code in this file that was taken from Python 2.5.
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# --------------------------------------------
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF"), and the Individual or... | {
"content_hash": "4384e7f33070b9a3544498cc5d9a850a",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 40.75912408759124,
"alnum_prop": 0.7036174785100286,
"repo_name": "pantheon-systems/kombu",
"id": "ad5da24e9a37c22ae7a42596cbe61131a1d075b8",
"size"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import *
from .meta import SnorkelBase, snorkel_postgres
from sqlalchemy import Column, String, Integer, Text, ForeignKey, UniqueConstraint
from sqlalchemy.... | {
"content_hash": "85023046773f24f350145808346bee3d",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 144,
"avg_line_length": 35.77989130434783,
"alnum_prop": 0.6128958760537708,
"repo_name": "jasontlam/snorkel",
"id": "57a0df449d44823c37e46e806f5545b3ba561ccc",
"size": "1... |
from zirkon.program_config import ModuleConfig
from . import mod0
| {
"content_hash": "a53c754bdfa25d9768481ad46f723e9c",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 46,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.8208955223880597,
"repo_name": "simone-campagna/zirkon",
"id": "bea533e56512ca39a9b374158678bce0c17fe30c",
"size":... |
import logging
import time,datetime
from futclient import FutClient
import futfunctions
def autocontract():
email = ["fut2.bryrmeg@neverbox.com"]
password = "Bryrmeg11"
the_hash = "Trondheim"
for i in email:
client = FutClient(i,password,the_hash)
logging.info("%s - %s - %s/30" % (i, c... | {
"content_hash": "3634ee0486dd2a15584daac67aec10b1",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 169,
"avg_line_length": 46.02127659574468,
"alnum_prop": 0.5446139620896903,
"repo_name": "bryrmeg/14",
"id": "399c551618f18b6098a0a6b45ff87ac484877dc1",
"size": "4326",
... |
"""
Buckets are a collection of events, properties, and funnels belonging to
a user.
"""
import ujson
from twisted.internet.defer import inlineCallbacks, returnValue, DeferredList
from telephus.cassandra.c08.ttypes import NotFoundException
from pylru import lrucache
from ..lib.cassandra import get_relation, delete_rel... | {
"content_hash": "4fb3bf875761489c64cf26b220b2d974",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 88,
"avg_line_length": 31.984848484848484,
"alnum_prop": 0.5780830570030001,
"repo_name": "hiidef/hiitrack-api",
"id": "0075dd8d2ac60da9cee379a77975ca0478b58abe",
"size": ... |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='netdrive-connector',
version='1.3.... | {
"content_hash": "aac93af63866b32b54cb4f96f88881a8",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 202,
"avg_line_length": 38.87755102040816,
"alnum_prop": 0.6341207349081365,
"repo_name": "ethoms/netdrive-connector",
"id": "af650bc50a4ceb7ca595905c6dca60d206daac8d",
"si... |
from runner.koan import *
class Proxy(object):
def __init__(self, target_object):
self._messages = []
#initialize '_obj' attribute last. Trust me on this!
self._obj = target_object
def __getattr__(self, attr_name):
self._messages.append(attr_name)
return self._obj.... | {
"content_hash": "9d2b76b5f4e7c4db8f10fe22b2bdd5d9",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 87,
"avg_line_length": 26.879518072289155,
"alnum_prop": 0.5434782608695652,
"repo_name": "rameshugar/koans",
"id": "43d4c28a06e3d66754cb27ed369c7f62a91c7edd",
"size": "51... |
__version__ = '1.4a0'
# Required for npm package for frontend
__semver__ = '1.4.0-alpha'
default_app_config = 'wagtail.wagtailcore.apps.WagtailCoreAppConfig'
def setup():
import warnings
from wagtail.utils.deprecation import removed_in_next_version_warning
warnings.simplefilter("default", removed_in_next... | {
"content_hash": "fa78e8e553c309e62ab93c31df25b7a6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 26.692307692307693,
"alnum_prop": 0.7377521613832853,
"repo_name": "gogobook/wagtail",
"id": "8f387d3272e78b14699c6fb0b5a722a0fa879988",
"size": "347... |
from core.himesis import Himesis, HimesisPostConditionPattern
import cPickle as pickle
from uuid import UUID
class HDeleteUncollapsedElementMatchDiffRulesRHS(HimesisPostConditionPattern):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HDeleteUncollapsedElementMatchDi... | {
"content_hash": "64279476f9cc18b20a3ab001375f3e1d",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 146,
"avg_line_length": 46.776595744680854,
"alnum_prop": 0.4232431203093018,
"repo_name": "levilucio/SyVOLT",
"id": "4ae6c716b91dbdaa3a0668888083efe2192a03ce",
"size": "43... |
from functools import wraps
def mproperty(fn):
attribute = "_memo_%s" % fn.__name__
@property
@wraps(fn)
def _property(self):
if not hasattr(self, attribute):
setattr(self, attribute, fn(self))
return getattr(self, attribute)
return _property
| {
"content_hash": "f3f196c782aafdacf225d9da90c89d80",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 46,
"avg_line_length": 21.071428571428573,
"alnum_prop": 0.6067796610169491,
"repo_name": "sionide21/memoize",
"id": "4a6ecdbc4c06986cebb73a958e1827debb81773f",
"size": "29... |
"""
Created by René Meusel
This file is part of the CernVM File System auxiliary tools.
"""
import shutil
import os
import tempfile
class FileSandbox:
""" Wraps the creation and automatic removal of temporary files """
def __init__(self, file_prefix):
self.file_prefix = file_prefix
self.tem... | {
"content_hash": "1c42449fde9318c65c970e4c40ff0b50",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 80,
"avg_line_length": 33.86363636363637,
"alnum_prop": 0.5973154362416108,
"repo_name": "reneme/python-cvmfsutils",
"id": "98ba4f419a50ad7415c129998fdf830af689989e",
"size... |
import os
import re
# Monkey patch for pygments reporting an error when generator expressions are
# used.
# https://bitbucket.org/birkenfeld/pygments-main/issue/942/cmake-generator-expressions-not-handled
from pygments.lexers import CMakeLexer
from pygments.token import Name, Operator
from pygments.lexer import bygrou... | {
"content_hash": "422ded8bae8ca7373da7bd22ca192900",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 98,
"avg_line_length": 39.848,
"alnum_prop": 0.5710366057685873,
"repo_name": "saschazelzer/CppMicroServices",
"id": "398cdbae332d63b87c953667275d297d444326cb",
"size": "1... |
"""
plot.py
This file contains shared functions for plotting graphs
and networks.
"""
from numpy import *
import numpy.random
import matplotlib.pyplot as plt
import networkx as nx
def save_plot(name=""):
def wrap(f):
def wrapped(*args, **kwargs):
fname = ""
fext = ".p... | {
"content_hash": "f0660caca38c8566469f0eb4ac423cb2",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 76,
"avg_line_length": 27.689873417721518,
"alnum_prop": 0.5586285714285715,
"repo_name": "hronellenfitsch/nesting",
"id": "1e1e7988b9d20c91e68a0046532904af486d18b2",
"siz... |
from locust import HttpLocust, TaskSet, task
from urllib import quote_plus
from random import choice
urls = [ 'http://code.jquery.com/jquery-2.1.3.min.js',
'http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js',
'http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js',
... | {
"content_hash": "2692a16f2f890e177506cb994250bda8",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 31.44,
"alnum_prop": 0.6259541984732825,
"repo_name": "52North/ckan-harvester",
"id": "4cb9b8d63b8a0464c0ef8357a25d3926187b67f6",
"size": "786",
"b... |
from .SGD import SGD
from .Momentum import Momentum
from .Nesterov import Nesterov
from .AdaGrad import AdaGrad
from .RMSProp import RMSProp
from .DQNProp import DQNProp
from .AdaDelta import AdaDelta
from .Adam import Adam
| {
"content_hash": "edfb7a7b8d12305d9fbcdf77ce4f6891",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 30,
"avg_line_length": 28,
"alnum_prop": 0.8214285714285714,
"repo_name": "yobibyte/DeepFried2",
"id": "b01a9020a622596d77f4887726fcd5156c7522e6",
"size": "224",
"binary":... |
import json
import MySQLdb
class DBManager:
def __init__(self, host, user, passwd, db):
self.columns = ('temperature', 'humidity')
self.db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)
self.cursor = self.db.cursor()
def latest(self):
self.cursor.execute("SELEC... | {
"content_hash": "ca178af3b3031b6a230285130c4106eb",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 89,
"avg_line_length": 37.25,
"alnum_prop": 0.5420450059218318,
"repo_name": "TeamProxima/predictive-fault-tracker",
"id": "6732e2436f77678d414be4fdd874eed7c71d796f",
"size... |
import bpy
from bpy.types import Operator
from mmd_tools import bpyutils
import mmd_tools.core.model as mmd_model
class CleanRiggingObjects(Operator):
bl_idname = 'mmd_tools.clean_rig'
bl_label = 'Clean'
bl_description = 'Clean temporary objects of rigging'
bl_options = {'PRESET'}
def execute(se... | {
"content_hash": "2b1a74bf15c48aa4c50276ab4167b617",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 82,
"avg_line_length": 32.31645569620253,
"alnum_prop": 0.6321974148061105,
"repo_name": "sugiany/blender_mmd_tools",
"id": "253b5574df39b65461636a00c4d6138296147217",
"siz... |
import os
from flask.cli import pass_script_info, get_debug_flag
import click
@click.command()
@click.option('--host', '-h', default='127.0.0.1',
help='The interface to bind to.')
@click.option('--port', '-p', default=5000,
help='The port to bind to.')
@click.option('--reload/--no-reload'... | {
"content_hash": "acae6c328da0a60d1c0f692c66ba87bd",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 78,
"avg_line_length": 40.6551724137931,
"alnum_prop": 0.631891433418151,
"repo_name": "sumedh123/debatify",
"id": "3952ecd94d624d8b5c70937fa574b006d657db15",
"size": "2358... |
import numpy as np
from bokeh.models import ColumnDataSource, Plot, LinearAxis, Grid
from bokeh.models.glyphs import AnnularWedge
from bokeh.io import curdoc, show
N = 9
x = np.linspace(-2, 2, N)
y = x**2
r = x/12.0+0.4
source = ColumnDataSource(dict(x=x, y=y, r=r))
plot = Plot(
title=None, plot_width=300, plot... | {
"content_hash": "5151b9c07366da613d2667944a3f3da3",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 123,
"avg_line_length": 24.5625,
"alnum_prop": 0.7099236641221374,
"repo_name": "stonebig/bokeh",
"id": "dae92253a30a8aaf4f01b67efc2b4ce1f6437d38",
"size": "786",
"binary... |
import datetime
from functools import partial
from typing import Any, Optional, Union
import pandas as pd
from pandas.api.types import is_hashable
from pyspark._globals import _NoValue
from pyspark import pandas as ps
from pyspark.pandas.indexes.base import Index
from pyspark.pandas.missing.indexes import MissingPand... | {
"content_hash": "0412f5a30686f498634f9f8b7dfff8c5",
"timestamp": "",
"source": "github",
"line_count": 756,
"max_line_length": 100,
"avg_line_length": 31.462962962962962,
"alnum_prop": 0.5587740687799546,
"repo_name": "BryanCutler/spark",
"id": "25dd5a478974ea0c1e6b79a2dcff1f4579462404",
"size": "... |
import stat
import pysftp
import logging
import datetime
from airflow.hooks.base_hook import BaseHook
class SFTPHook(BaseHook):
"""
Interact with SFTP. Aims to be interchangeable with FTPHook.
Pitfalls: - In contrast with FTPHook describe_directory only returns size, type and
modify. It d... | {
"content_hash": "f36fcea2bf684b686dfb64d851814daa",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 89,
"avg_line_length": 35.557046979865774,
"alnum_prop": 0.5790864477161193,
"repo_name": "sdiazb/airflow",
"id": "7340146625aa934cc291dce6b299f9c6c1dfbdb9",
"size": "5865... |
'Update vendors'
from quickbooks import QBRequestProcessor
from parameters import APPLICATION_NAME
# Get vendors from QuickBooks
qbRequestProcessor = QBRequestProcessor(applicationName=APPLICATION_NAME)
results = qbRequestProcessor.call('VendorQueryRq', {})
# Determine new vendors
allVendorNames = [
'xxx',
'y... | {
"content_hash": "a518fd4e4656cd35cb20a0eece549e5e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 75,
"avg_line_length": 32.642857142857146,
"alnum_prop": 0.6641137855579868,
"repo_name": "invisibleroads/inteum-quickbooks-sync",
"id": "ed90184c09c109fe9ad611b12f00a5d1d063... |
import logging
import datetime
from google.appengine.ext import ndb
class Mail(ndb.Model):
title = ndb.StringProperty(required=True)
title_path = ndb.StringProperty(required=False)
title_hover_text = ndb.StringProperty(required=False)
body = ndb.TextProperty(required=True)
birthday = ndb.DateTimeP... | {
"content_hash": "977ae354ed025e1c1bf0bad8df6f36ab",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 77,
"avg_line_length": 38,
"alnum_prop": 0.5615220483641536,
"repo_name": "stupidnetizen/miniblog",
"id": "adfc1de39dd0d5a54b243b7c52ffd86e2ff906eb",
"size": "2909",
"bin... |
import csv
import numpy
import matplotlib.pyplot as plt
numFiles = 5
numGenerations = 250
errorbarStep = 25
filenames = ['champion','average']
legend = ['Champion Fitness', 'Average Fitness']
colors = ['r', 'b']
styles = ['-','--']
linewidth = 2
plt.rcParams['ps.useafm'] = True
plt.rcParams['pdf.use14corefonts'] = Tr... | {
"content_hash": "05ecc8a92f8c46be64358f479debe88c",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 158,
"avg_line_length": 29.493150684931507,
"alnum_prop": 0.681374825824431,
"repo_name": "mhauskn/HyperNEAT",
"id": "514521b64dd9f945733c9f0fac758a5a96dcc2a5",
"size": "21... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.