text stringlengths 4 1.02M | meta dict |
|---|---|
import numpy as np
import yaml
from qutip import *
from pylab import *
from scipy.fftpack import fft
import matplotlib.pyplot as plt
import yaml
from scipy.interpolate import interp1d
from scipy.optimize import fsolve
from qutip.ui.progressbar import TextProgressBar
class Parameters:
def __init__(self, wc, wq, eps... | {
"content_hash": "cd77a0ed862708e2983f3ec2fb5f8b3f",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 131,
"avg_line_length": 45.40677966101695,
"alnum_prop": 0.6423416697772801,
"repo_name": "paulsbrookes/cqed_sims_qutip",
"id": "2672cca70f20fe0646e97f39f06b68a2c451d259",
... |
"""Persistence Models"""
from __future__ import (absolute_import, print_function,
division)
from future.utils import text_to_native_str as n
# Base
from .base import Model, MetaModel
# Database Models
from .activation import Activation
from .dependency import Dependency
from .environment_attr... | {
"content_hash": "cdb88f5af1596af273dc1f040118f377",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 58,
"avg_line_length": 24.62264150943396,
"alnum_prop": 0.7348659003831418,
"repo_name": "gems-uff/noworkflow",
"id": "7a3d7981f21111eff7daed2aec8e0ad919dec25f",
"size": "1... |
from setuptools import find_packages, setup
setup(
name='cmsplugin_gallery_filer',
version='0.5.2.1',
author='GISA Elkartea',
author_email='kontaktua@gisa-elkartea.org',
url='http://lagunak.gisa-elkartea.org/projects/cmsplugin-gallery-filer',
description = 'DjangoCMS image gallery plugin with d... | {
"content_hash": "0563da79ec10a9474d5340b44c9b3643",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 76,
"avg_line_length": 40.23529411764706,
"alnum_prop": 0.652046783625731,
"repo_name": "shagi/cmsplugin_gallery_filer",
"id": "131c3e7fa556e90e7fde78a44db384cb3cb638a3",
"... |
"""
Created on Mon Nov 03 10:50:30 2014
@author: User
"""
import lxml.etree as ET
dom = ET.parse("default.xsd")
xslt = ET.parse("XTSM_xsd_to_xsl_light.xsl")
transform = ET.XSLT(xslt)
newdom = transform(dom)
print(ET.tostring(newdom, pretty_print=True))
f = open('default.xsl','w')
f.write('<?xml version="1.0" encodin... | {
"content_hash": "1c556e6271634409f9f50888a496e514",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 51,
"avg_line_length": 23.11764705882353,
"alnum_prop": 0.6870229007633588,
"repo_name": "gemelkelabs/timing_system_software",
"id": "7676ac712a3a38c6ca4ea749a101517e16d3b900... |
from setuptools import setup, find_packages
description = """
Compiler plugin to use Django Pipeline package with Compass
"""
setup(
name='django-pipeline-compass-compiler',
version='0.1.2',
description=description,
long_description=open('README.md').read(),
author='Javi Velasco',
author_email... | {
"content_hash": "da067ebe458ad7bd81cae259ab3e9618",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 74,
"avg_line_length": 30.275862068965516,
"alnum_prop": 0.6526195899772209,
"repo_name": "javivelasco/django-pipeline-compass-compiler",
"id": "980dedf7d28566de918398222b17f... |
'''
8 puzzle problem, a smaller version of the fifteen puzzle:
http://en.wikipedia.org/wiki/Fifteen_puzzle
States are defined as string representations of the pieces on the puzzle.
Actions denote what piece will be moved to the empty space.
States must allways be inmutable. We will use strings, but internally most of
... | {
"content_hash": "f2028f5b6317b20c136744993ac91c21",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 87,
"avg_line_length": 27.792,
"alnum_prop": 0.6134139320667819,
"repo_name": "iamaziz/simpleai",
"id": "e8313d1c85199f35759b32fd3d61b5073889a608",
"size": "3474",
"bina... |
from __future__ import print_function, division # requires Python >= 2.6
# numpy and scipy imports
import numpy as np
from scipy.sparse import kron, identity, lil_matrix
from scipy.sparse.linalg import eigsh # Lanczos routine from ARPACK
# We will use python's "namedtuple" to represent the Block and EnlargedBlock
#... | {
"content_hash": "83625ee7c644f5fd7a147c8d36d642aa",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 123,
"avg_line_length": 46.83445945945946,
"alnum_prop": 0.6459640770396018,
"repo_name": "simple-dmrg/simple-dmrg",
"id": "c25879f3017eab5a5cdf44755df3681e7ff74306",
"siz... |
from flask import request,render_template, redirect,session
from utils import getone,check,_update,_delete,insert_sql,list
from . import app
from sessions import sessionmsg
import json
field=['id','name','idc_id','u_num','power']
idc_fields = ['id','name']
# 机柜列表
@app.route('/cabinet',methods=['GET', 'POST'])
def ca... | {
"content_hash": "4a1162ec8087cb5a903a98c9af07778c",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 70,
"avg_line_length": 34.148648648648646,
"alnum_prop": 0.5797388207360507,
"repo_name": "1032231418/python",
"id": "4894936213471d613aa7ae64c0f4f5b2b2173c7c",
"size": "26... |
"I want to format{} as well as" <ref>"{kwd}".format("positional args", kwd="keyword") | {
"content_hash": "c6ab2b44e5ad3e03107bf95b396c3ffe",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 85,
"avg_line_length": 85,
"alnum_prop": 0.6705882352941176,
"repo_name": "MER-GROUP/intellij-community",
"id": "9f31881539948d92df06f6c1b24e3a391c7b332c",
"size": "85",
"... |
from __future__ import print_function, division
import collections
import logging
import math
import string
import time
import pgdata
import sector
import system_internal as system
import util
import vector3
app_name = "pgnames"
log = logging.getLogger(app_name)
# #
# Publicly-useful functions
# #
"""
Check whethe... | {
"content_hash": "30523b2af39a50d72d06f2068d63b7c1",
"timestamp": "",
"source": "github",
"line_count": 899,
"max_line_length": 154,
"avg_line_length": 35.383759733036705,
"alnum_prop": 0.6834014460861364,
"repo_name": "KayJohnston/jackies-map",
"id": "64f7b7783415247bd359ed9202743ed9b4447976",
"si... |
import django.contrib.auth.models
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import modeltranslation.tests.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0001_initial'),
]
operations = [
... | {
"content_hash": "b4ca3abb0f1b94417596b2a0fc7d3e96",
"timestamp": "",
"source": "github",
"line_count": 986,
"max_line_length": 100,
"avg_line_length": 41.869168356997974,
"alnum_prop": 0.43155778407576967,
"repo_name": "deschler/django-modeltranslation",
"id": "98171623fd23836f79e5594fc094322a7baf2d... |
"""
Module to define matching template for checklist spreadsheet
"""
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2011-2013, University of Oxford"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
from gridmatch import (
GridMatchReport, GridMatchError, GridMatch,
text... | {
"content_hash": "07e8acba4cf60a57cf70536be4522c27",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 229,
"avg_line_length": 38.21546961325967,
"alnum_prop": 0.6567876246927858,
"repo_name": "ninebynine/sds",
"id": "0701a473deb9409d52c1e4ae6be4f4a91e0139f6",
"size": "6940... |
'''Unit tests for the admin template gatherer.'''
from __future__ import print_function
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
import unittest
from six import StringIO
from grit.gather import admin_template
from grit import util
from grit... | {
"content_hash": "203941ae0f45dd34b0c1bb0e3e61fae4",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 91,
"avg_line_length": 33.127272727272725,
"alnum_prop": 0.6599890230515917,
"repo_name": "chromium/chromium",
"id": "61755b37582be52eefcd1d9eb810ee939d012f0c",
"size": "3... |
import uuid
import mock
from mock import patch
from oslo_utils import encodeutils
from oslo_utils import units
# NOTE(jokke): simplified transition to py3, behaves like py2 xrange
from six.moves import range
from glance.common import exception
from glance.common import store_utils
import glance.quota
from glance.tes... | {
"content_hash": "3b2f0a5f1dad5101eb30240f61545e37",
"timestamp": "",
"source": "github",
"line_count": 700,
"max_line_length": 79,
"avg_line_length": 41.488571428571426,
"alnum_prop": 0.5661800151504718,
"repo_name": "stevelle/glance",
"id": "22bd39561390c92b038587705750ca2abf7aca02",
"size": "296... |
import datetime
import pymongo
import os
import sys
from pymongo import MongoClient
from subprocess import call
def update(args):
print('Beginning migrations...')
HOST = 'localhost'
PORT = 27017
for index, arg in enumerate(args):
if arg == '-h':
HOST = args[index+1]
if arg == '-p':
PORT = int(args[inde... | {
"content_hash": "a12699b3978eeb6d5da1496abb1b49ce",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 143,
"avg_line_length": 29.92,
"alnum_prop": 0.6439393939393939,
"repo_name": "jawm/mongo-migrate",
"id": "daefad9ed79b02d1edfb49d8091c0a5592834e2d",
"size": "2265",
"bin... |
try:
set
except NameError:
from sets import Set as set # Python 2.3 fallback
from django.db import connection, transaction, IntegrityError
from django.db.models.fields import DateField
from django.db.models.query_utils import Q, select_related_descend
from django.db.models import signals, sql
from django.u... | {
"content_hash": "11420ec277ec0673b75d63324e04ecd5",
"timestamp": "",
"source": "github",
"line_count": 884,
"max_line_length": 127,
"avg_line_length": 35.3235294117647,
"alnum_prop": 0.5668993787228591,
"repo_name": "Shrews/PyGerrit",
"id": "2ff1c26344f0b279e2f9bba8a0026acb9cbfd11d",
"size": "3122... |
from msrest.serialization import Model
class FirstParameterGroup(Model):
"""
Additional parameters for a set of operations, such as:
parameterGrouping_postMultiParamGroups,
parameterGrouping_postSharedParameterGroupObject.
:param header_one:
:type header_one: str
:param query_one: Query p... | {
"content_hash": "42512bf922a74d73c36dadaefaaf991d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 29.166666666666668,
"alnum_prop": 0.6952380952380952,
"repo_name": "csmengwan/autorest",
"id": "172a4349ff36cb3683804a5ac5075f95dbbd1193",
"size": "9... |
import collections
from supriya import CalculationRate
from supriya.ugens.UGen import UGen
class Wrap(UGen):
"""
Wraps a signal outside given thresholds.
::
>>> source = supriya.ugens.SinOsc.ar()
>>> wrap = supriya.ugens.Wrap.ar(
... maximum=0.9,
... minimum=0.1,... | {
"content_hash": "2684a1d3bc7a26f83c2bc88ee14dba68",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 55,
"avg_line_length": 20.86111111111111,
"alnum_prop": 0.5499334221038615,
"repo_name": "Pulgama/supriya",
"id": "0d744e20b5cd6965c297ea8079aceb68964192b8",
"size": "751",... |
"""
make-release
~~~~~~~~~~~~
Helper script that performs a release. Does pretty much everything
automatically for us.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
import os
import re
from datetime import datetime, date
from subprocess im... | {
"content_hash": "2407c029533a856dd1e57217f0964c22",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 98,
"avg_line_length": 25.331550802139038,
"alnum_prop": 0.5913025121384843,
"repo_name": "xen/flask-rq",
"id": "54fe0a57ea87d4399d642db7ef23f4648e610993",
"size": "4783",... |
"""
This is the module that defines the invoke namespace.
It is imported by :func:`atelier.invlib.setup_from_tasks` which passes
it to :func:`invoke.Collection.from_module`.
"""
import os
import sys
import glob
import time
import datetime
from datetime import timedelta
import shutil
from atelier.utils import i2d
fro... | {
"content_hash": "2a8f05e528f44dca250b79afd180986e",
"timestamp": "",
"source": "github",
"line_count": 810,
"max_line_length": 160,
"avg_line_length": 32.18641975308642,
"alnum_prop": 0.5769629089793257,
"repo_name": "lsaffre/atelier",
"id": "a557fd9a70ceb26e8fa983eed6cc4d2c2e480694",
"size": "261... |
from taiga.requestmaker import RequestMaker
from taiga.models import Role, Roles
import unittest
from mock import patch
class TestRoles(unittest.TestCase):
@patch('taiga.models.base.ListResource._new_resource')
def test_create_role(self, mock_new_resource):
rm = RequestMaker('/api/v1', 'fakehost', 'f... | {
"content_hash": "e0c7fdb166e002ec8c8b05761623d66b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 61,
"avg_line_length": 31.176470588235293,
"alnum_prop": 0.6622641509433962,
"repo_name": "jespino/python-taiga",
"id": "f1319755eacb0f68efa96d6834494233f256ac8d",
"size": ... |
from functional import seq
ascii_control_chars = ''.join([chr(x) for x in range(0,32)])
invalid_filename_chars = set(":*?\"<>|/\\ \n" + ascii_control_chars)
def sanitize_anki_deck_name(name: str, replace_char='_'):
"""
Get name that conforms to fs standards from deck name
"""
return seq(list(name)) \... | {
"content_hash": "11ca7a5c154fb954a0ef0a062a2aac45",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 32.53846153846154,
"alnum_prop": 0.6288416075650118,
"repo_name": "Stvad/CrowdAnki",
"id": "3f40c1397ea411b827dde2de2c73062e0d3bff6a",
"size": "423",... |
import seaborn as sns
import matplotlib.pyplot as plt
# Data Set
tips = sns.load_dataset('tips')
# total_bill | tip | sex | smoker | day | time | size
# 16.99 | 1.01 | Female | No | Sun | Dinner | 2
# Linear Model Plot
# scatter_kws parameter to adjust size of markers
sns.lmplot(x='total_bill', y='tip', data=tips, hu... | {
"content_hash": "5ac2793907b5887ba63383e8cccdc482",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 85,
"avg_line_length": 32.23809523809524,
"alnum_prop": 0.654357459379616,
"repo_name": "leon-lei/learning-materials",
"id": "5aa4a4a766225ed71f23d3627e67bbab5a89cf1a",
"si... |
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
def configure_cache_dir(cache_dir):
r"""Setup menpobench by configuring a directory for caching datasets and
methods. datasets are generally large, so you will want to choose a
directory on a volume with a fairly l... | {
"content_hash": "9244b308b12b76d3436274b798b2d9bc",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 76,
"avg_line_length": 28.433962264150942,
"alnum_prop": 0.7073656270736562,
"repo_name": "nontas/menpobench",
"id": "272a2622ad297a6204f762784b2e2e2192cac978",
"size": "15... |
"""
fileiobase provides general purpose NMR file IO functions and classes
used by multiple nmrglue.fileio modules.
"""
from __future__ import division
import os
import string
import sys
import itertools
from functools import reduce
import numpy as np
def create_blank_udic(ndim):
"""
Create a blank universa... | {
"content_hash": "c92500c0a5945123d49c320d459f0a9c",
"timestamp": "",
"source": "github",
"line_count": 754,
"max_line_length": 79,
"avg_line_length": 28.419098143236074,
"alnum_prop": 0.5440545081202165,
"repo_name": "kaustubhmote/nmrglue",
"id": "3c7f38e32e5281a90624626865c430bfc642e245",
"size":... |
from euca2ools.commands.iam import IAMRequest, AS_ACCOUNT
from requestbuilder import Arg
class DeleteUserPolicy(IAMRequest):
DESCRIPTION = 'Remove a policy from a user'
ARGS = [Arg('-u', '--user-name', dest='UserName', metavar='USER',
required=True,
help='user the policy is att... | {
"content_hash": "e3c82ffaa52912d427929dfc331337dc",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 79,
"avg_line_length": 43.583333333333336,
"alnum_prop": 0.621414913957935,
"repo_name": "Juniper/euca2ools",
"id": "0288680e4c745f4c88dbd6bc80e3f94005e6585a",
"size": "187... |
"""
NaiveBayes
"""
__author__ = "Manan Kalra"
__email__ = "manankalr29@gmail.com"
import nltk
import random
from nltk.corpus import movie_reviews
# # training-data
documents = [(list(movie_reviews.words(fileid)), category)
for category in movie_reviews.categories()
for fileid in movie_rev... | {
"content_hash": "c9d3bae1aa740d62c3b807b8a646cd8e",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 118,
"avg_line_length": 27.060606060606062,
"alnum_prop": 0.7082866741321389,
"repo_name": "manankalra/Twitter-Sentiment-Analysis",
"id": "f9e53fee5c636afc70d39e849d1e26d8212... |
"""
.. _basic-mat-mult:
Simple Matrix Multiply
======================
**Author**: `Thierry Moreau <https://homes.cs.washington.edu/~moreau/>`_
In this tutorial, we will build on top of the :ref:`vta-get-started` tutorial
and introduce additional concepts required to implement matrix multiplication
on VTA with the TVM... | {
"content_hash": "e81c63dab8f8c52b15fc462a5e5d1d74",
"timestamp": "",
"source": "github",
"line_count": 465,
"max_line_length": 100,
"avg_line_length": 40.39354838709677,
"alnum_prop": 0.6532502795080658,
"repo_name": "mlperf/training_results_v0.7",
"id": "70a899bb534fd7c2123e84dd01ecb33e27da5c2f",
... |
import six
from mod_pywebsocket import msgutil
def web_socket_do_extra_handshake(request):
pass # Always accept.
def web_socket_transfer_data(request):
while True:
line = msgutil.receive_message(request)
if line == b'exit':
return
if line is not None:
if isins... | {
"content_hash": "5e2b1c1d337c5337d145cf1920470818",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 50,
"avg_line_length": 26.9375,
"alnum_prop": 0.6148491879350348,
"repo_name": "youtube/cobalt_sandbox",
"id": "0d5de62c1cb5f9f8d8444b587612077c384e159c",
"size": "450",
... |
"""
Simple Training CLI.
"""
import argparse
import os
import shutil
import sys
import tempfile
from contextlib import ExitStack
from typing import Any, cast, Optional, Dict, List, Tuple
import mxnet as mx
from . import arguments
from . import checkpoint_decoder
from . import constants as C
from . import convolution
... | {
"content_hash": "7b60f123d593ff5a47a611e66886e8b4",
"timestamp": "",
"source": "github",
"line_count": 867,
"max_line_length": 130,
"avg_line_length": 53.5121107266436,
"alnum_prop": 0.5802564931565901,
"repo_name": "mlperf/training_results_v0.6",
"id": "85393915011ea3f0e24ba23be15808e7c3cbe442",
... |
__revision__ = "test/python-version.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
"""
Verify the behavior of our check for unsupported or deprecated versions
of Python.
"""
import os
import re
import TestCmd
import TestSCons
test = TestSCons.TestSCons(match = TestCmd.match_re_dotall,ignore_python_ver... | {
"content_hash": "6230c47fb92261af48e2b9b5b3e3272d",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 96,
"avg_line_length": 24.84,
"alnum_prop": 0.6843800322061192,
"repo_name": "EmanueleCannizzaro/scons",
"id": "a1b19540741c4c6214c641c573c0a83b802e4b63",
"size": "2377",
... |
__author__ = 'yuens'
################################### PART1 IMPORT ######################################
import MySQLdb
import logging
import time
################################### PART2 CLASS && FUNCTION ###########################
class CreateDatabaseTable(object):
def __init__(self):
self.start =... | {
"content_hash": "df534974c715d8b17c1ecc2d79cd0211",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 167,
"avg_line_length": 46.38167938931298,
"alnum_prop": 0.5380184331797235,
"repo_name": "ysh329/spider",
"id": "d929e45c4e66fb7854890a66b4960e63d9c75999",
"size": "6354"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.synapse import SynapseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-synapse
# USAGE
python get_sql_pool_metadata_sync_config.py
Before run the sample, please set the values of the client ID, tena... | {
"content_hash": "297fa0cb2f8b8fd2ca13409f46109487",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 139,
"avg_line_length": 34.73529411764706,
"alnum_prop": 0.7366638441998307,
"repo_name": "Azure/azure-sdk-for-python",
"id": "b7033687e925989b197446f6a05b23129becfb71",
"s... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
cwd = os.getcwd()
paren... | {
"content_hash": "64b6cafe409cb82d1827afd02a585b59",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 80,
"avg_line_length": 31.925311203319502,
"alnum_prop": 0.7039251364699766,
"repo_name": "qba73/grinderpy",
"id": "2d551fbcf356c0fde84feb6bddbc64d795750191",
"size": "811... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Clients',
fields=[
('id', models.AutoField(auto_cre... | {
"content_hash": "e2da7ce41b2f41893826082a3ab907f8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.5662824207492796,
"repo_name": "rexhepberlajolli/RHChallenge",
"id": "930d73f92b8b860f52f09689c3b354ecf6a45e0a",
... |
from datetime import timedelta
from icalendar import Calendar as ICalendar
import requests
from .models import EventLocation, Event, OccurringRule
from .utils import extract_date_or_datetime
DATE_RESOLUTION = timedelta(1)
TIME_RESOLUTION = timedelta(0, 0, 1)
class ICSImporter:
def __init__(self, calendar):
... | {
"content_hash": "e3f9d2b51efbe2337713970961cbc909",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 78,
"avg_line_length": 32.72222222222222,
"alnum_prop": 0.6103565365025467,
"repo_name": "proevo/pythondotorg",
"id": "847394fa04691ed63194c123e99040f63f1a8fa5",
"size": "2... |
"""Workflow execution engines."""
from resolwe.flow.engine import BaseEngine
class BaseExecutionEngine(BaseEngine):
"""A workflow execution engine."""
def evaluate(self, data):
"""Return the code needed to compute a given Data object."""
raise NotImplementedError
def get_expression_engin... | {
"content_hash": "18b580f95db695981a5b58a09174c8d7",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 68,
"avg_line_length": 31.444444444444443,
"alnum_prop": 0.6631330977620731,
"repo_name": "genialis/resolwe",
"id": "8da5fc63c798aa66ccb89a13fe7428cf8b0112cb",
"size": "849... |
from django.test import RequestFactory
from test_plus.test import TestCase
from ..views import (
ComparisonCreateView,
ComparisonUpdateView,
ComparisonDetailView,
ComparisonListView,
ComparisonItemCreateView
)
class BaseComparisonTestCase(TestCase):
def setUp(self):
self.user = self.m... | {
"content_hash": "33a96dad63534bfb289ca9d5650cf4d9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 39,
"avg_line_length": 23.1875,
"alnum_prop": 0.7358490566037735,
"repo_name": "EricZaporzan/compare",
"id": "84b95353e7a0136de96640b52664bf82d8141903",
"size": "371",
"b... |
"""
Copyright 2016 Jeffrey D. Walter
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, softwa... | {
"content_hash": "5696345cadfb3e1138ae58a4653b66c6",
"timestamp": "",
"source": "github",
"line_count": 1760,
"max_line_length": 910,
"avg_line_length": 50.055113636363636,
"alnum_prop": 0.5973529178065088,
"repo_name": "jeffreydwalter/arlo",
"id": "34ee1ffc88e1614bb6549fef5849801a3db26de3",
"size"... |
from model import model
import numpy as np
import tensorflow as tf
import os
import sys
import time
TRAIN = 'train.csv'
tf.app.flags.DEFINE_string('data_directory', './data/', 'directory containing the data sets')
tf.app.flags.DEFINE_float('validation_fraction', 0.2, 'fraction of training data set aside for validat... | {
"content_hash": "c921832fc92f8bcdf11ecd183e91aaae",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 107,
"avg_line_length": 43.553719008264466,
"alnum_prop": 0.6335863377609108,
"repo_name": "priyathamkat/digit-recognizer",
"id": "931a72e6f52c9723b490d30781e7eb6f0c03b8f5",... |
from __future__ import unicode_literals
from django.conf import settings
from django.template import Library
register = Library()
@register.inclusion_tag("aldryn_google_tag_manager/google_tag_manager.html")
def google_tag_manager(tag_id=''):
if not tag_id and hasattr(settings, 'GOOGLE_TAG_MANAGER_ID'):
... | {
"content_hash": "b7e2d40463baff520795947d1e9e7bf7",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 76,
"avg_line_length": 26.933333333333334,
"alnum_prop": 0.7029702970297029,
"repo_name": "aldryn/aldryn-google-tag-manager",
"id": "9d308ff31e86188ae9f9176caaabb341d22fd9d2"... |
from ..schemas import Schema, fields
from ..utils import FrozenMixin
from ..enums import EnumField, CardTypeEnum
class CardSchema(Schema):
CardNumber = fields.String()
ExpirationMonth = fields.String()
ExpirationYear = fields.String()
CVV = fields.String()
Track1Data = fields.String()
Track2Da... | {
"content_hash": "dbc2e2c1ce78cff00d90114e3776769a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 49,
"avg_line_length": 25.344827586206897,
"alnum_prop": 0.6965986394557823,
"repo_name": "SambaDemon/python_vantiv",
"id": "bc7f34ad80f4fa638ce0778b164fc196540cdf1f",
"siz... |
from typing import TYPE_CHECKING
from airflow.providers.google.cloud.links.base import BaseGoogleLink
if TYPE_CHECKING:
from airflow.utils.context import Context
BASE_LINK = "https://console.cloud.google.com"
VERTEX_AI_BASE_LINK = BASE_LINK + "/vertex-ai"
VERTEX_AI_MODEL_LINK = (
VERTEX_AI_BASE_LINK + "/loca... | {
"content_hash": "ef7a1b34bc1d068c32912e2667c62af8",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 109,
"avg_line_length": 29.30065359477124,
"alnum_prop": 0.6127593129600714,
"repo_name": "Acehaidrey/incubator-airflow",
"id": "910049c81a5a07024102d60c3c6959e4493e0d64",
... |
"""Main module."""
import time
import threading
class SingletonMixin(object):
__singleton_lock = threading.Lock()
__singleton_instance = None
@classmethod
def instance(cls):
if not cls.__singleton_instance:
with cls.__singleton_lock:
if not cls.__singleton_instanc... | {
"content_hash": "e2c33b6c2df287732d51e2dc9c14ddb3",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 52,
"avg_line_length": 19.75609756097561,
"alnum_prop": 0.571604938271605,
"repo_name": "yoophi/guid-server",
"id": "096c442a8ca950681a1ae05e034b1ad1eac75c9f",
"size": "810... |
import sys
from collections import namedtuple
from avroknife.error import error
class EqualitySelection:
"""Specification of a desired value assigned to a key"
The key can be nested, e.g. 'opt1.opt2'.
"""
def __init__(self, string_):
"""
Args:
string_: a string in a fo... | {
"content_hash": "d6d0751ca6594205389671ba5174ebd7",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 84,
"avg_line_length": 31.594444444444445,
"alnum_prop": 0.519606119219272,
"repo_name": "CeON/avroknife",
"id": "ee65c38bdb332c72e71da5d95fda4efd15f8fcad",
"size": "6280"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Scholien', '0003_auto_20171027_1709'),
]
operations = [
migrations.AddField(
model_name='buechlein',
name='admin_kaeufe',
... | {
"content_hash": "b9e8883051712fbbfc458c52745668a3",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 48,
"avg_line_length": 21.27777777777778,
"alnum_prop": 0.5900783289817232,
"repo_name": "valuehack/scholarium.at",
"id": "2839b18208338d7c99714d00d985e27224f5f364",
"size"... |
import logging
import unittest
class TestCloudLoggingHandler(unittest.TestCase):
PROJECT = "PROJECT"
@staticmethod
def _get_target_class():
from google.cloud.logging.handlers.handlers import CloudLoggingHandler
return CloudLoggingHandler
def _make_one(self, *args, **kw):
re... | {
"content_hash": "c3b725a8dc0f1e5434c2fcd90a68ff6a",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 85,
"avg_line_length": 28.44,
"alnum_prop": 0.6427566807313643,
"repo_name": "dhermes/google-cloud-python",
"id": "ff738046d892f952f0034f60c08767667b74ac40",
"size": "3419... |
"""Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
Created on Tue Dec 30 23:17:20 2014
@author: shaotch
"""
class Solution:
# @return an integer
def trailingZeroes(self, n):
r = 0
while n... | {
"content_hash": "3398a91ab1aa8afb8a037af69a03c989",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 63,
"avg_line_length": 19.375,
"alnum_prop": 0.5935483870967742,
"repo_name": "au9ustine/org.au9ustine.puzzles.leetcode",
"id": "24c24a91f05da65211e474ee495265ea71ffd7a0",
... |
from pathlib import Path
import pytest
from _pytest.tmpdir import TempPathFactory
from rasa.core.agent import Agent
from rasa.core.policies.policy import Policy
from rasa.engine.storage.local_model_storage import LocalModelStorage
from rasa.shared.nlu.training_data.formats import RasaYAMLReader
from rasa.utils.tensor... | {
"content_hash": "2ce090ca0f60069e9f55826fb540e620",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 88,
"avg_line_length": 32.34090909090909,
"alnum_prop": 0.6223940032794566,
"repo_name": "RasaHQ/rasa_nlu",
"id": "ecc544a0354ed4e1ed8ce9456faf1020638c7a08",
"size": "8538... |
from thriftpy.protocol import TCyBinaryProtocolFactory
from thriftpy.thrift import TClient
from thriftpy.transport import (
TCyBufferedTransportFactory,
TSocket)
PROTO_FACTORY = TCyBinaryProtocolFactory
TRANS_FACTORY = TCyBufferedTransportFactory
def make_client(service, host, port, timeout=None):
"""
... | {
"content_hash": "d015f685dec3bdda205ba548795de6fa",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 65,
"avg_line_length": 29.448979591836736,
"alnum_prop": 0.6645876645876646,
"repo_name": "eleme/archer",
"id": "083809e35edd044ae0cdcff6650f2bfb3833f572",
"size": "1469",
... |
from rest_framework import serializers
from stats.models import *
from collections import OrderedDict, Counter
import json
import stats
static_path = stats.__path__[0]+'/static/'
with open(static_path+'city_location.json', 'r') as f:
map_locations = json.load(f)
def cast_value(s):
if (type(s) != unicode):
... | {
"content_hash": "034d5c5e73786dc6989e335b0e4f0e59",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 139,
"avg_line_length": 34.9,
"alnum_prop": 0.583810888252149,
"repo_name": "CKrawczyk/volcrowe",
"id": "82417906e3c8b95bc5a0b4edf75b9818af7486ae",
"size": "8376",
"bina... |
import os
from numpy.random import randint
import json
try:
import cPickle as pickle
except:
import pickle
import warnings
class Vocabulary(object):
"""An implementation that manages the interface between a token dataset and the
machine learning algorithm.
[1] Tim Vieira; https://github.com/t... | {
"content_hash": "93f3044b21ad4896e379674b2c908253",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 96,
"avg_line_length": 30.670682730923694,
"alnum_prop": 0.5166950373183187,
"repo_name": "braingineer/ikelos",
"id": "b93eb5953b88f7d5ae1fd261d3bb123afe21f3cd",
"size": "... |
"""A simple grep flow."""
import stat
from grr.lib import aff4
from grr.lib import flow
from grr.lib import rdfvalue
from grr.proto import flows_pb2
class SearchFileContentArgs(rdfvalue.RDFProtoStruct):
protobuf = flows_pb2.SearchFileContentArgs
class SearchFileContent(flow.GRRFlow):
"""A flow that runs a gl... | {
"content_hash": "3d816a5c6a2f2c8f88eba5f55b3efd77",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 80,
"avg_line_length": 36.54,
"alnum_prop": 0.6655719759168035,
"repo_name": "pchaigno/grreat",
"id": "018df9b4309c82664e56b2bb5b353a94b388927d",
"size": "3676",
"binary... |
import os
import platform
import sys
def is_active():
return True
def get_name():
return "LinuxBSD"
def can_build():
if os.name != "posix" or sys.platform == "darwin":
return False
# Check the minimal dependencies
x11_error = os.system("pkg-config --version > /dev/null")
if x11_er... | {
"content_hash": "ce2de316068256bbf6e9ac7a0001fbab",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 276,
"avg_line_length": 37.46420323325635,
"alnum_prop": 0.5979533966218715,
"repo_name": "DmitriySalnikov/godot",
"id": "8eb22c1c72265ddaecf82a5126cac7d5ed593e46",
"size"... |
from lib import BaseTest
class ListMirror1Test(BaseTest):
"""
list mirrors: regular list
"""
fixtureCmds = [
"aptly mirror create --ignore-signatures mirror1 http://mirror.yandex.ru/debian/ wheezy",
"aptly mirror create -with-sources --ignore-signatures mirror2 http://mirror.yandex.ru/... | {
"content_hash": "f54cf34f72e7be66ee0da23f49970e58",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 137,
"avg_line_length": 28.416666666666668,
"alnum_prop": 0.6715542521994134,
"repo_name": "github/aptly",
"id": "f97759f3ce43f8442c06ae271e86d1bf794af273",
"size": "1023",... |
from ckan.plugins import toolkit
import ckan.lib.helpers as h
class ModerationController(toolkit.BaseController):
def all_reported_issues(self, organization_id):
'''show all issues over max_strikes and are not moderated'''
try:
issues, organization = all_reported_issues(organization_id... | {
"content_hash": "3f38bf14e98a3c11dc6630791ec7642c",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 83,
"avg_line_length": 40.4639175257732,
"alnum_prop": 0.5620382165605096,
"repo_name": "datagovuk/ckanext-issues",
"id": "8c2e3a887dbea8fe514d9dfbbe87a2512aafefa5",
"size"... |
""" Puppet plugin operations. The code that handles puppet_config is split
into two parts. The part that does transformations such as extract
per-operation info resides in this file. Rest of the properties are handled
in manager.py """
import copy
from cloudify.decorators import operation as _operation
from puppet_p... | {
"content_hash": "15a77d6e59fc2f798c72aa5dc09323ea",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 77,
"avg_line_length": 33.64601769911504,
"alnum_prop": 0.5376117832719621,
"repo_name": "cloudify-cosmo/cloudify-puppet-plugin",
"id": "1ab48d4d6e7b0e60614ebc01ee26148e245a... |
import unittest
from StringIO import StringIO
import time
# third party
from mock import MagicMock
# this package
from theape.parts.wifi.iwconfig import IwconfigQuery, IwconfigExpressions
from theape.parts.wifi.iwconfig import IwconfigEnum
from theape import ApeError
try:
source = open('iwconfig.txt').read()
... | {
"content_hash": "4395a539301b103a62ff834da45cd05f",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 96,
"avg_line_length": 31.77777777777778,
"alnum_prop": 0.5747057820228552,
"repo_name": "rsnakamura/theape",
"id": "99070a2ccd093d166ad24fdd05fb2435f0a0f64a",
"size": "11... |
import sys
if (sys.version_info >= (2,7)):
import unittest
else:
import unittest2 as unittest
import pydevtest_sessions as s
from pydevtest_common import assertiCmd, assertiCmdFail, interruptiCmd
from resource_suite import ResourceBase
import commands
import os, stat
import datetime
import time
import shutil
im... | {
"content_hash": "a27852002eadbd94c9e01d8f5787fbc5",
"timestamp": "",
"source": "github",
"line_count": 865,
"max_line_length": 180,
"avg_line_length": 49.53179190751445,
"alnum_prop": 0.6073520830902089,
"repo_name": "leesab/irods",
"id": "c7055528d28431a2d229dc6240bb39f42df97a2f",
"size": "42845"... |
"""Univariate polynomials with galois field coefficients."""
import random
import modint
import sparse_poly
def GFPolyFactory(p):
"""Create custom class for specific coefficient type."""
coefficient_type = modint.ModularIntegerFactory(p)
class newClass(sparse_poly.SparsePolynomial):
coeff_type = ... | {
"content_hash": "8427515fe25d495ab95116ae7dd6a9aa",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 80,
"avg_line_length": 28.96062992125984,
"alnum_prop": 0.5216150081566069,
"repo_name": "certik/sympy-oldcore",
"id": "60555186f9aeeb12f5c6920cb8a17155dde50c1a",
"size": ... |
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.db.models import Model
from django.db.models.base import ModelBase
from django.db.models.query import QuerySet
from django.shortcuts import get_object_or_... | {
"content_hash": "4e61eff580d0cff7b0ee967a7ffd252e",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 102,
"avg_line_length": 48.44927536231884,
"alnum_prop": 0.6172599461561472,
"repo_name": "benkonrath/django-guardian",
"id": "c9e3306e0fa11fbc90ece6cd0321c55cca8c1eb6",
"... |
import pytest
pytest.importorskip("ethosu.vela")
import tvm
from tvm import relay
from tvm.relay.testing import run_opt_pass
from tvm.relay.backend.contrib.ethosu.tir import spec
from tvm.relay.backend.contrib.ethosu.tir.compiler import lower_to_tir
from .infra import make_ethosu_identity, get_pooling_args
@pytest.... | {
"content_hash": "da7ae7fcae164eee9a1481549bdbb7fc",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 83,
"avg_line_length": 32.06060606060606,
"alnum_prop": 0.5775047258979206,
"repo_name": "Laurawly/tvm-1",
"id": "1ce55c49ea96ea8b607d2ae26711a24efca2a0e8",
"size": "3959",... |
from django.http import HttpResponse
def home(request):
return HttpResponse("Hello from django, try out <a href='/admin/'>/admin/</a>\n") | {
"content_hash": "d303b8a8f2f0f88f7b6424a9f4414a48",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 85,
"avg_line_length": 35.5,
"alnum_prop": 0.7183098591549296,
"repo_name": "Si-elegans/Web-based_GUI_Tools",
"id": "1a735e5f09e4022faf3dc26c1a9be44cb854c7be",
"size": "142"... |
"""Tests for tensorflow.ops.math_ops."""
from absl.testing import parameterized
import numpy as np
from tensorflow.python import tf2
from tensorflow.python.eager import backprop
from tensorflow.python.eager import context
from tensorflow.python.eager import def_function
from tensorflow.python.framework import constant... | {
"content_hash": "18aa9a13621d08e49d6fb4499de8a69d",
"timestamp": "",
"source": "github",
"line_count": 1231,
"max_line_length": 116,
"avg_line_length": 39.588952071486595,
"alnum_prop": 0.6287807280338162,
"repo_name": "Intel-Corporation/tensorflow",
"id": "5e871a6904ebef24d1bb3a7804b77ef8528c0433",... |
import sys
sys.path.append("..")
from hackathon import Component, RequiredFeature
from flask import g
from hackathon.database.models import UserHackathonRel, Experiment, UserProfile
from hackathon.hackathon_response import bad_request, precondition_failed, internal_server_error, not_found, ok
from hackathon.constants ... | {
"content_hash": "76a4861e9d89dc2e41c1adf6fd1eedad",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 111,
"avg_line_length": 42.50867052023121,
"alnum_prop": 0.5974979602937177,
"repo_name": "Fendoe/open-hackathon-o",
"id": "aaf0c143f91ee25929b8498324a4c63117eeea03",
"siz... |
from enum import Enum
class Language(Enum):
english = 'en'
turkish = 'tr'
| {
"content_hash": "bae8f2e95929745a20c9154016c41fff",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 21,
"avg_line_length": 14,
"alnum_prop": 0.6309523809523809,
"repo_name": "metinsay/docluster",
"id": "971d9900ca909d7a1d444b0a90833c3bf80f97e5",
"size": "84",
"binary": f... |
import sys
import subprocess
procs = []
runserver = subprocess.Popen([sys.executable, "runserver.py"])
runsheduler = subprocess.Popen([sys.executable, "runsheduler.py"])
runworker = subprocess.Popen([sys.executable, "runworker.py"])
procs.append(runserver)
procs.append(runsheduler)
procs.append(runworker)
for proc in... | {
"content_hash": "deec605f18a18c18330f0c8d3c9b9a93",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 66,
"avg_line_length": 26.46153846153846,
"alnum_prop": 0.7616279069767442,
"repo_name": "bzyx/precious",
"id": "3759ebb4a6cdf0f1ecfd37c273a5dd7837c50f1e",
"size": "344",
... |
class ApiPackage1Class1:
def __init__(self, arg1, arg2):
self.value1 = "value1"
def public1(self, arg1):
pass
def public2(self):
pass
@property
def public_property1(self):
return self._public_property
@property
def public_property2(self):
return se... | {
"content_hash": "7aa58e11beb859de9545bf30e53d03ba",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 42,
"avg_line_length": 17.512820512820515,
"alnum_prop": 0.6193265007320644,
"repo_name": "touilleMan/samarche",
"id": "30bcc297a7ee49633b66bae767491a23f3afcd31",
"size": "... |
import account_voucher
| {
"content_hash": "e9e15df8c9a235a88fbf4c4e9b680996",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 22,
"avg_line_length": 23,
"alnum_prop": 0.8695652173913043,
"repo_name": "vileopratama/vitech",
"id": "b4d48ed534edfa4e021c80fc294cf2dd25bbe903",
"size": "123",
"binary":... |
import os
import math
import json
from string import punctuation
from pymongo import MongoClient
from nltk.corpus import stopwords
class Article:
'Article Class'
def __init__(self, filepath, domain):
self.filepath = filepath
self.wordDic = {}
self.wordAmount = 0
self.domain = do... | {
"content_hash": "432dbfffc58685e8f099dd36d8f51973",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 114,
"avg_line_length": 35.73142857142857,
"alnum_prop": 0.5338237645929954,
"repo_name": "riteshkasat/GeoTweets",
"id": "b66a5a152bad9d5f0abe997b3f13055e76e1160d",
"size"... |
"""Install Dallinger as a command line utility."""
import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text(encoding="utf-8")
setup_args = dict(
name="dallinger",
packages=["dallinger", "dallinger_scripts"],... | {
"content_hash": "651dab5a2dd082ec6fb974e08b1cab6a",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 83,
"avg_line_length": 28.076271186440678,
"alnum_prop": 0.5203742831270751,
"repo_name": "Dallinger/Dallinger",
"id": "6799dda55be2c459addd5c588fe74b33eaab39e7",
"size": ... |
import pika
import json
import base64
import time
import os
import redis
import logging
import construct_graph
global connection
class Remote_Interface_server():
def __init__(self, redis_handle ):
self.redis = redis_handle
self.cmds = {}
self.cmds["PING"] = True
se... | {
"content_hash": "b3b5f3d97cce2b1c0784f94854eccf75",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 124,
"avg_line_length": 31.37735849056604,
"alnum_prop": 0.5139306474243336,
"repo_name": "glenn-edgar/local_controller_2",
"id": "b40bfc0d311ead311679335494ba0e6eddd0434d",... |
import numpy as np
from .base import OdeSolver, DenseOutput
from .common import (validate_max_step, validate_tol, select_initial_step,
norm, warn_extraneous, validate_first_step)
from . import dop853_coefficients
# Multiply steps computed from asymptotic behaviour of errors by this.
SAFETY = 0.9
... | {
"content_hash": "e785426c982b3a36a625d4baee1265b8",
"timestamp": "",
"source": "github",
"line_count": 575,
"max_line_length": 107,
"avg_line_length": 37.02608695652174,
"alnum_prop": 0.5810709253170503,
"repo_name": "pizzathief/scipy",
"id": "fa3504e36d0228f7ac3876154682676d2b462330",
"size": "21... |
from parser import Parser
import re
import pdb
import csv
debug=False
def load_yaml(filename):
"""
Reads any yaml file and returns it as object.
"""
import yaml
stream = file(filename)
return yaml.load(stream)
class Scanner:
"""
Handles metrically scansion.
"""
def __init__(s... | {
"content_hash": "64f1f8616019efa60cb8cedc3f698e7c",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 124,
"avg_line_length": 41.83453237410072,
"alnum_prop": 0.5343938091143594,
"repo_name": "seanpue/hastac2015_pue",
"id": "91c2b16ad21dadf039bd53f089e7b1561834c03b",
"size... |
"""
instabot example
Workflow:
Like and follow likers of last medias from your timeline feed.
"""
import sys
import os
import time
import random
from tqdm import tqdm
import argparse
sys.path.append(os.path.join(sys.path[0], '../'))
from instabot import Bot
def like_and_follow(bot, user_id, nlikes=... | {
"content_hash": "f00ee7e6c34f8196447c3983504dee9e",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 71,
"avg_line_length": 24.638297872340427,
"alnum_prop": 0.6899827288428325,
"repo_name": "rasperepodvipodvert/instabot",
"id": "0872e03ff5f0a9a2901f41108fb862367088ebee",
... |
from abc import ABC, abstractmethod
class Pipe(ABC):
@abstractmethod
def pipe(self, data):
pass
@abstractmethod
def __enter__(self):
pass
@abstractmethod
def __exit__(self, exit_type, value, traceback):
pass
| {
"content_hash": "ed3ad3da6feda15a23e2aa82a07acdcb",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 52,
"avg_line_length": 17.333333333333332,
"alnum_prop": 0.6,
"repo_name": "jstriebel/webcam-effects",
"id": "52e2d873b403c55c42efc16d2c123dbf2087c472",
"size": "260",
"b... |
import os
import cv2
import glob
import datetime
import logging
import numpy as np
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from data_io import load_imageset... | {
"content_hash": "21bd6625fd64324def13edfbc381f2ca",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 140,
"avg_line_length": 30.229885057471265,
"alnum_prop": 0.7190114068441065,
"repo_name": "yao-matrix/mLearning",
"id": "2c5fdacd562b6e29ae8e9d74848369fff78f5534",
"size":... |
from streams import BufferedStream, Stream
from multiprocessing import Process
from twython import TwythonStreamer
import json
import sys
class FileInputStream(Stream):
"""
Loads the lines of a text file into a Stream for processing.
"""
def __init__(self, filename):
self.input = open(filenam... | {
"content_hash": "38dc413fec5a8e39d3a03e81de2213e5",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 99,
"avg_line_length": 29.172043010752688,
"alnum_prop": 0.6008109104312569,
"repo_name": "daviesjamie/spout",
"id": "2cf15996e334726d60d3f62597a658cd27df12be",
"size": "27... |
from random import choice
startups = ["Google", "Facebook", "Dropbox", "SpaceX", "Uber", "Snapchat", "Twitter", "Stripe",
"AirBnB", "Digital Ocean", "Github", "Tinder"]
demographies = ["Pets", "the elderly", "Robots", "noisy kids", "Cats", "Fruits",
"Programming Languages", "Teachers", "Co... | {
"content_hash": "73ca524416477d4b04f88ce3ab01de0b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 105,
"avg_line_length": 40.166666666666664,
"alnum_prop": 0.6058091286307054,
"repo_name": "MAPSuio/spring-challenge16",
"id": "21b3db3dc38e10b94e7e36099b0738a6ef2e9820",
"... |
"""
AUTHOR : Lang
PURPOSE : Multi Self Deep Learning
"""
__author__ = 'Lang'
import os;
tracing = open("After_First_Purification.txt",'w')
tracing.close()
total_count = 0
for dirs in sorted(os.listdir(".")):
try:
count = 0
for files in sorted(os.listdir(dirs)):
if ".jpg" in files:
... | {
"content_hash": "e3d02882dc6bb926bda6164df5464ac7",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 105,
"avg_line_length": 24.64,
"alnum_prop": 0.5568181818181818,
"repo_name": "HeavenMin/PlantImageRecognition",
"id": "df4ea8a3a52e5a5fb4d65dad9cd65620b4e491e7",
"size": "... |
import time
import roslib; roslib.load_manifest('aubo_new_driver')
import rospy
import actionlib
from control_msgs.msg import *
from trajectory_msgs.msg import *
from sensor_msgs.msg import JointState
from math import pi
JOINT_NAMES = ['shoulder_joint', 'upperArm_joint', 'foreArm_joint',
'wrist1_joint',... | {
"content_hash": "5565caf4fb77eeaabcd083693d744f58",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 141,
"avg_line_length": 40.62658227848101,
"alnum_prop": 0.628602586072597,
"repo_name": "robotlinker/robotlinker_core",
"id": "a3dd87af538a4b07fcf59fac4f06f8ae4fdba94a",
... |
from collections import Counter
class Solution(object): # bad solution
def minMoves2(self, _nums):
"""
:type nums: List[int]
:rtype: int
"""
if not _nums: return 0
C = Counter(_nums)
nums = C.items()
nums.sort()
prevTarget = nums[0][0] - 1
moves = minMoves = sum((n - prevTarget) * c for n, c in n... | {
"content_hash": "b338fd63bf44a9b9bf18e44a4b29a20f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 96,
"avg_line_length": 28.59259259259259,
"alnum_prop": 0.6761658031088082,
"repo_name": "xiaonanln/myleetcode-python",
"id": "02c0efa4f8ce7278dcc0abe22d4c9efb1e53e755",
"s... |
config = {
'CONTEXT': 'We are in TestFrontend context',
'IntanceType': 'medium',
'InstanceMin': '2',
'InstanceMax': '6',
'ServiceVersion': 'v3.65'
}
| {
"content_hash": "6facda8da577fb4f5974dea6858562e4",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 48,
"avg_line_length": 25.142857142857142,
"alnum_prop": 0.5568181818181818,
"repo_name": "aljim/deploymentmanager-samples",
"id": "f5f0f954c2b8d2a48b7f16cbe1af17507a203d29",
... |
import unittest
import paddle.fluid.core as core
from paddle.fluid.executor import Executor
import paddle.fluid.layers as layers
from paddle.fluid.backward import append_backward
from paddle.fluid.framework import default_main_program, switch_main_program
from paddle.fluid.framework import Program
import numpy as np
... | {
"content_hash": "b4e25013d29d54c3d5d5ef94ee3ad553",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 78,
"avg_line_length": 39.640449438202246,
"alnum_prop": 0.608843537414966,
"repo_name": "putcn/Paddle",
"id": "1d93230e7b74c5b6c00bbe125e3ae2d3a649b4b9",
"size": "4141",
... |
import unittest
from parameterized import parameterized
from conans.test.utils.tools import TestClient
conanfile = """from conans import ConanFile
class Pkg(ConanFile):
def requirements(self):
if self.develop:
self.output.info("Develop requirements!")
def source(self):
if self.dev... | {
"content_hash": "e5b31842fa78e30342a6f7ed9f55a330",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 70,
"avg_line_length": 37.8041237113402,
"alnum_prop": 0.6310335424052359,
"repo_name": "memsharded/conan",
"id": "a0c893a6eb78c228a3fa974197b72d877ae6307c",
"size": "3667"... |
import bluebox, fec
import config, parser, tracker, ircreporter
import threading
import argparse
import time
import binascii
from datetime import datetime
class bb_frontend(threading.Thread):
LOGFILE = "log.txt"
def __init__(self, qth=None, config_file=None, enable_tracking=False, enable_auth=False):
... | {
"content_hash": "d6154eb464ef85787451db702959adf7",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 131,
"avg_line_length": 37.50349650349651,
"alnum_prop": 0.5578966996084281,
"repo_name": "aausat/aausat4_beacon_parser",
"id": "d6686d8c78e9388271dd0319075c1907480cbcf4",
... |
from redlock import RedLock
import time
def test_default_connection_details_value():
"""
Test that RedLock instance could be created with
default value of `connection_details` argument.
"""
lock = RedLock("test_simple_lock")
def test_simple_lock():
"""
Test a RedLock can be acquired.
... | {
"content_hash": "17f04fa49088d48625ca17af397ff4e9",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 84,
"avg_line_length": 27.70769230769231,
"alnum_prop": 0.6296501943364797,
"repo_name": "mjschultz/redlock",
"id": "5115498b4902f84ef73d8cbed060868774e88a78",
"size": "180... |
"""Rofication indicator
https://github.com/DaveDavenport/Rofication
simple module to show an icon + the number of notifications stored in rofication
module will have normal highlighting if there are zero notifications,
"warning" highlighting if there are nonzero notifications,
... | {
"content_hash": "3d352fed3fbacf0c380ad5925a6b6e3a",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 126,
"avg_line_length": 38.13559322033898,
"alnum_prop": 0.6204444444444445,
"repo_name": "tobi-wan-kenobi/bumblebee-status",
"id": "1fd53553beb1ba7ab0b62888223da6e979be50d1"... |
import sys
def createReasonsForCheckFailure(clauses):
output=[]
for clause in clauses:
output.append(0)
for l in clause:
output.append(l)
if len(output) == 0:
output.append(0)
output.append(0)
return output
def createWeakConstraints(weak):
output=[]
f... | {
"content_hash": "b2af9e49933b8be003c58ad116bf87d4",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 79,
"avg_line_length": 23.626666666666665,
"alnum_prop": 0.5725169300225733,
"repo_name": "alviano/wasp",
"id": "a692c11fc865285df4fac0908aed190dee88f484",
"size": "3544",... |
import time
import threading
import apigen
# automatically added verison command will use module version if present
# rpc exceptions will also include module version if persent
__version__ = "1.0.0"
class Calculator(apigen.Definition): # Programm name taken from class name.
"""Example Programm""" # Programm h... | {
"content_hash": "c029cb021385bd6075f56be39d894ef3",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 77,
"avg_line_length": 31.363636363636363,
"alnum_prop": 0.6270531400966184,
"repo_name": "F483/apigen",
"id": "9daefe66aba77f23c208cf49afd2b6f8c4db125b",
"size": "1172",
... |
import numpy as np
import pandas as pd
def read_matrix(file_handle):
"""
(matrix, tokenlist, category) = read_matrix(file_handle)
Reads the file handle pointed to by 'file_handle', which is of the format of
MATRIX.TEST, and returns a 3-tuple. The first part is 'sp_matrix',
an m-by-n sparse matrix... | {
"content_hash": "0531bb2b08284bd051940dd7541917a2",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 36.58620689655172,
"alnum_prop": 0.644674835061263,
"repo_name": "stallmanifold/cs229-machine-learning-stanford-fall-2016",
"id": "602029b86a7f3c55723e... |
import yaml
class Config(object):
def __init__(self):
with open("../config.yml", 'r') as stream:
try:
self.globals = yaml.load(stream)
except yaml.YAMLError as exc:
print(exc)
| {
"content_hash": "f1e7d4a06eac883891fd39630d9faf19",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 50,
"avg_line_length": 24.6,
"alnum_prop": 0.5040650406504065,
"repo_name": "innusource/siteg.py",
"id": "1e8a38f7528c3931c12c2f67fef9c0c263b94fe4",
"size": "246",
"binar... |
import os.path
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from django.test import TestCase
from django.test.client import Client
from radpress.compat import User
from radpress.models import Article, Page, Tag
from radpress.readers import get_reader
from radpress.set... | {
"content_hash": "396e9a4daba5db69694c697d76645217",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 79,
"avg_line_length": 37.3728813559322,
"alnum_prop": 0.654119425547997,
"repo_name": "ifearcompilererrors/fle_redesign",
"id": "71613c7108f55f6772c439c02f95fb8ad88d2ab9",
... |
import fiona
import pytest
import struct
from collections import OrderedDict
from .conftest import requires_gpkg
@requires_gpkg
def test_binary_field(tmpdir):
meta = {
"driver": "GPKG",
"schema": {
"geometry": "Point",
"properties": OrderedDict([
("name", "... | {
"content_hash": "f29b800e1f486a8f2a1451aaf0af0ca7",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 67,
"avg_line_length": 26.928571428571427,
"alnum_prop": 0.5305039787798409,
"repo_name": "rbuffat/Fiona",
"id": "d35868fba0454ef713dcab37beb5f6bca84b9315",
"size": "1131",... |
from django.core.urlresolvers import reverse # noqa
from django import http
from django.utils.html import escape # noqa
from horizon.workflows import views
from mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
from openstack_dashboard.dashboards.proje... | {
"content_hash": "2915a2e13a0e40a0acdbdb25d2650c59",
"timestamp": "",
"source": "github",
"line_count": 1468,
"max_line_length": 79,
"avg_line_length": 44.237057220708444,
"alnum_prop": 0.55247921157992,
"repo_name": "ikargis/horizon_fod",
"id": "9d2919ef1ef5c16ff35659b5ec5d88fab12d0331",
"size": "... |
"""
This module can do slight modifications to tidy a wiki page's source code.
The changes are not supposed to change the look of the rendered wiki page.
If you wish to run this as an stand-alone script, use scripts/cosmetic_changes.py
For regular use, it is recommended to put this line into your user-config.py:
... | {
"content_hash": "27472cbefc259dc6803ebd9816366e72",
"timestamp": "",
"source": "github",
"line_count": 994,
"max_line_length": 127,
"avg_line_length": 41.99496981891348,
"alnum_prop": 0.5199195074623291,
"repo_name": "darthbhyrava/pywikibot-local",
"id": "7ba4c8e4d74f91362c675a9dd9e7c98992629c82",
... |
from __future__ import print_function
from __future__ import division
from builtins import range
from past.utils import old_div
import argparse
import time
import matplotlib
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
import numpy as np
elaps... | {
"content_hash": "2cd7406d4172ee6165cf6cc53f80fa5b",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 79,
"avg_line_length": 27.00925925925926,
"alnum_prop": 0.6109016112444292,
"repo_name": "russel/pychapel",
"id": "9fbd83faa17ce32d02862865d081d3540cb2e463",
"size": "2939... |
from __future__ import annotations
import pytest
@pytest.fixture(autouse=True)
def no_warnings(recwarn):
yield
warnings = tuple(
f'{warning.filename}:{warning.lineno} {warning.message}'
for warning in recwarn
# cheetah raises this warning when compiling a trivial file
if not (... | {
"content_hash": "37cf59cc08052eaaa6488a0e78c9c9f0",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 67,
"avg_line_length": 26.65,
"alnum_prop": 0.6097560975609756,
"repo_name": "asottile/cheetah_lint",
"id": "6e37d556a520655ec3b254fe2cc7f9320a04b1b9",
"size": "533",
"bi... |
import cgi
import cgitb
cgitb.enable() # Show errors to browser.
import sys
import os
import time
import md5
sys.stderr = sys.stdout
cgi.maxlen = 1024*1024
debug = True
print 'Content-type: text/plain\n\n'
if debug:
print 'Debug\n\n'
print 'Python was here 5'
print 'os.environ:', repr(os.environ).replac... | {
"content_hash": "f1495f2caec998a9678a78ee180b06b1",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 57,
"avg_line_length": 15.857142857142858,
"alnum_prop": 0.6906906906906907,
"repo_name": "svn2github/SVGKit",
"id": "421cb7182b602274cff4be87d1a14ac5cfa95d42",
"size": "35... |
"""Chromium auto-bisect tool
This script bisects a range of commits using binary search. It starts by getting
reference values for the specified "good" and "bad" commits. Then, for revisions
in between, it will get builds, run tests and classify intermediate revisions as
"good" or "bad" until an adjacent "good" and "b... | {
"content_hash": "95d6c5af5576525e2d3068ce196351f0",
"timestamp": "",
"source": "github",
"line_count": 2871,
"max_line_length": 80,
"avg_line_length": 39.95402298850575,
"alnum_prop": 0.6455696202531646,
"repo_name": "joone/chromium-crosswalk",
"id": "5167b1d3c1a1376fd295b22119de45bfb5a5d7f3",
"si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.