text stringlengths 4 1.02M | meta dict |
|---|---|
"""Tests for gem5Run object"""
import hashlib
from pathlib import Path
import os
import unittest
from uuid import uuid4
from gem5art.artifact import artifact
from gem5art.run import gem5Run
class TestSERun(unittest.TestCase):
def setUp(self):
self.gem5art = artifact.Artifact(
{
... | {
"content_hash": "88030ad9424da964f8396483e7d9763e",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 28.989795918367346,
"alnum_prop": 0.44456177402323127,
"repo_name": "gem5/gem5",
"id": "1710dbc7069fbd39c7ac2e6e156d128b94bec6e6",
"size": "4397",
... |
"""
A Docker Hypervisor which allows running Linux Containers instead of VMs.
"""
import os
import random
import socket
import time
from oslo.config import cfg
from nova.compute import flavors
from nova.compute import power_state
from nova.compute import task_states
from nova import exception
from nova.image import ... | {
"content_hash": "4a3fb0c38bd942bda97b5c9bc26ca8cf",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 79,
"avg_line_length": 40.83582089552239,
"alnum_prop": 0.5745004873294347,
"repo_name": "russellb/nova-docker",
"id": "63d98123e5c0bd68913dcd797c0ce4fe0a427bff",
"size": ... |
import re
from bs4 import BeautifulSoup
from error import BookingServiceError
from model.booking import Booking
from model.event import Event
from service import raven_service
BOOKING_SERVICE_URL = 'https://www.mealbookings.cai.cam.ac.uk/index.php'
_AVAILABLE_EVENTS_CACHE = None
_ATTENDEE_NAME_CACHE = {}
_MENU_TEXT_C... | {
"content_hash": "6fae1cca48d9082a4ad752345b6ed2c8",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 79,
"avg_line_length": 42.67664670658683,
"alnum_prop": 0.6531499929844254,
"repo_name": "JackMorris/CaiusHallHelper",
"id": "2a0802ed51de0a32cc073cce0c1f526c0202f29c",
"s... |
from typing import Dict, List, no_type_check
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def findFrequentTreeSum(self, root: TreeNode) -> List[int]:
freq = {}
self.findFrequentTreeS... | {
"content_hash": "b34dfe2a31901940e95594f3c4af738b",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 85,
"avg_line_length": 27.55,
"alnum_prop": 0.5626134301270418,
"repo_name": "vermouth1992/Leetcode",
"id": "68104ed16a16e6d7a435bbff438d534eae5cd8a7",
"size": "2046",
"b... |
import scipy.io.wavfile as sciwave
from scipy.fftpack import fft
import math
import numpy as np
import RecPing
import time
import pylab
# ========= (1) ENREGISTREMENT ==========
filename = time.strftime("%d%b%Y_%H%M%S.wav") # titre du fichier = date
RecPing.recPing(filename) # enregistrement
# ========= (2) RECEIV... | {
"content_hash": "c28ba344391e39abc3f1816d96899741",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 177,
"avg_line_length": 31.404761904761905,
"alnum_prop": 0.5986858731362144,
"repo_name": "ENSTA-Bretagne-Guerledan-BoiteNoire/ROS_BUBBLE_Project",
"id": "c1b9a821975ed71bc... |
"""
======================================
The :mod:`mpi_array.comms_test` Module
======================================
Module defining :mod:`mpi_array.comms` unit-tests.
Execute as::
python -m mpi_array.comms_test
or::
mpirun -n 4 python -m mpi_array.comms_test
Classes
=======
.. autosummary::
:toctre... | {
"content_hash": "eb1275510ef5be2b240c63e1979a3c98",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 94,
"avg_line_length": 35.19252873563219,
"alnum_prop": 0.5861843716828611,
"repo_name": "mpi-array/mpi_array",
"id": "33d1b0a9fbfaada441e551108387fd89ede1acc9",
"size": "... |
from __future__ import print_function
from .client import Client
__title__ = 'Steamfront'
__author__ = 'Callum Bartlett'
__license__ = 'MIT'
__copyright__ = 'Copyright 2017 Callum Bartlett'
__version__ = '0.1.0'
if __name__ == '__main__':
from sys import argv
if len(argv) < 2:
print('Please give the name of a ga... | {
"content_hash": "70bad38bd738e18866f8a85275b39def",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 26.157894736842106,
"alnum_prop": 0.6257545271629779,
"repo_name": "4Kaylum/Steamfront",
"id": "19bab0767e7100d461bd4a1a0a0fd80e2a3ee724",
"size": "4... |
"""Added Section Layout Settings and Site Settings
Revision ID: 698cc06661d6
Revises: 958a9358a256
Create Date: 2016-02-29 00:03:36.777728
"""
# revision identifiers, used by Alembic.
revision = '698cc06661d6'
down_revision = '958a9358a256'
branch_labels = None
depends_on = None
from alembic import op
import sqlalc... | {
"content_hash": "0ab2616ad800131430d542ab91068154",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 99,
"avg_line_length": 36.02173913043478,
"alnum_prop": 0.6813518406759204,
"repo_name": "matslindh/kimochi",
"id": "b51138cb7bec817443c6ea15d03e8d5310a92f9d",
"size": "165... |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.ya... | {
"content_hash": "c3493eec9cde1cb5a0b23bb936541222",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 514,
"avg_line_length": 36.33513513513513,
"alnum_prop": 0.5584647426361202,
"repo_name": "napalm-automation/napalm-yang",
"id": "821d7b90bfe60239e280846acbbfdc869441a430",
... |
import warnings
from selene.core.entity import Browser
class SharedBrowser(Browser):
warnings.warn(
'SharedBrowser is deprecated, use Browser instead', DeprecationWarning
)
| {
"content_hash": "5ca3512f12037cd8c62b1725e18ad13a",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 78,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.75,
"repo_name": "yashaka/selene",
"id": "352bb714f3003babfbfc0b4b96cbf55a7ab00b8e",
"size": "1308",
"binary": f... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DownloadDelta'
db.create_table('packages_downloaddelta', (
('id', self.gf('django.db.models.fields.AutoF... | {
"content_hash": "81083873f997a2ddbee201d4aae8a9ab",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 197,
"avg_line_length": 74.2127659574468,
"alnum_prop": 0.5584862385321101,
"repo_name": "crate-archive/crate-site",
"id": "4a15bb7615383bf6e46e98c0c459ddbf56dbf551",
"siz... |
import sys
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = r"D:\Program Files\Python35\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = r"D:\Program Files\Python35\tcl\tk8.6"
includes = ["tkinter"]
include_files = [r"D:\Program Files\Python35\DLLs\tcl86t.dll", \
r"D:\Program ... | {
"content_hash": "ac8a67add3799e840f76cb3af91e69e9",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 92,
"avg_line_length": 30.416666666666668,
"alnum_prop": 0.6712328767123288,
"repo_name": "DanielZa2/SteamCategoriesBackup",
"id": "b56bd4c796307dc24309e00c2e5021d425c31c25",... |
import mwparserfromhell
import pywikibot
pywikibot.config.family = "wikipedia"
pywikibot.config.mylang = "en"
site = pywikibot.Site()
site.login()
templates = [
pywikibot.Page(site, "Template:Infobox language"),
pywikibot.Page(site, "Template:Infobox language family")
]
titles = list()
for template in templa... | {
"content_hash": "6addab5ca0c0efb33e5619dd31994afd",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 93,
"avg_line_length": 35.31818181818182,
"alnum_prop": 0.620978120978121,
"repo_name": "HazardSJ/HazardBot",
"id": "efb31d828f95e5f2a89e1d003e6e2ab4b404e888",
"size": "155... |
from iiits.config import templates | {
"content_hash": "b4ed77409e07f6a6a29f54f4a99d8278",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 34,
"avg_line_length": 34,
"alnum_prop": 0.8823529411764706,
"repo_name": "IIITS/iiits.ac.in",
"id": "c115669d75329ffe73e8751a730d1b08dfb08a28",
"size": "34",
"binary": fa... |
"""
Tests for the silent audio driver.
"""
from __future__ import division
from builtins import object
from tests import mock
import unittest
from pyglet.media.drivers.silent import (EventBuffer, SilentAudioBuffer, SilentAudioPacket,
SilentAudioPlayerPacketConsumer)
from pyglet.media.events import MediaEvent
... | {
"content_hash": "615d0ce2559f51517c1e9ad00f836121",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 92,
"avg_line_length": 35.8160621761658,
"alnum_prop": 0.6321880650994575,
"repo_name": "nicememory/pie",
"id": "99262ca0d04309af3be5e51280f5a75f196a2397",
"size": "13825"... |
from world.world import world
| {
"content_hash": "406d325de0c4707ddc8ef09c6d4252e8",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 29,
"avg_line_length": 30,
"alnum_prop": 0.8333333333333334,
"repo_name": "mwilliamson/python-vendorize",
"id": "728f17c8cad7d2ad365f3186e6224b1908fa860c",
"size": "30",
"... |
import json
"""
we make use of a string representation for musical events fed to the RNN.
this file provides encode/decode methods for that representation
"""
# used to separate pieces in the corpus
divtoken = "|"
def encode_rest(duration):
assert type(duration) is int
return "r{}".format(duration)
def encode_n... | {
"content_hash": "86047af34e82e208d7c9ecb3495f226d",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 80,
"avg_line_length": 26.808823529411764,
"alnum_prop": 0.6346681294569391,
"repo_name": "alexcoplan/p2proj",
"id": "6661a263aac97f059911f9940b6c87be206cf0af",
"size": "3... |
from sklearn_explain.tests.skl_datasets_reg import skl_datasets_test as skltest
skltest.test_reg_dataset_and_model("RandomReg_10" , "DecisionTreeRegressor_0")
| {
"content_hash": "11d612db508709e89bef06623f17785d",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 79,
"avg_line_length": 40.25,
"alnum_prop": 0.8012422360248447,
"repo_name": "antoinecarme/sklearn_explain",
"id": "a48e2051941f26e32ad714cbc2a5d7d785eb6c24",
"size": "161",... |
import os
import re
import codecs
from setuptools import setup, find_packages
package_name = "hera_librarian"
packages = find_packages(exclude=["*.tests"])
setup(
name=package_name,
version="1.1.1",
author="HERA Team",
author_email="[email protected]",
url="https://github.com/HERA-Team/lib... | {
"content_hash": "88f995289741dab7e69fff3f59bb2483",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 76,
"avg_line_length": 30.948275862068964,
"alnum_prop": 0.6217270194986072,
"repo_name": "HERA-Team/librarian",
"id": "7e1d3c626d377537041d8ffb6637787af1dea1af",
"size": "... |
'''error
Definitions for access/service return code errors/exceptions.
'''
import exceptions
SUCCESS = 0
#
# old style, pass through rc values
#
UNKNOWN = 1
DUPLICATE_KEY = 2
EXEC_TRACEBACK = 5
AFFINITY_ERROR = 6
#
# new style exceptions.
#
table = {}
lookup = lambda i, *a: table.get(i, AccessError)(*... | {
"content_hash": "dd0a0aa9443addec34d18220fd056c29",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 68,
"avg_line_length": 18.9125,
"alnum_prop": 0.6655651024454726,
"repo_name": "slideinc/notifier",
"id": "83718f5718fe87d00fcea9a9d207cf76c48f81a2",
"size": "3125",
"bin... |
import os
import re
from collections import defaultdict
from StringIO import StringIO
from flask import (Flask, jsonify, abort, request, send_file, current_app,
Response, render_template)
from lxml import etree
from wand.image import Image
import search_index
# NOTE: This directory should contain ... | {
"content_hash": "15a5fc3b561274b1dd10d895bc69de58",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 79,
"avg_line_length": 34.49047619047619,
"alnum_prop": 0.5867734364213724,
"repo_name": "jbaiter/hocrviewer",
"id": "5829814546144247872d078c9c28b6286287a84d",
"size": "7... |
"""
The Pygments reStructuredText directive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This fragment is a `Docutils <ttps://docutils.sf.net/>`_ 0.5 directive
that renders source code (to HTML only, currently) via Pygments.
To use it, adjust the options below and copy the code into a module
that you import on initializat... | {
"content_hash": "8ec42dc023cc3f588eeb9aeadbb48979",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 80,
"avg_line_length": 31.172043010752688,
"alnum_prop": 0.6857537081752328,
"repo_name": "tony/django-docutils",
"id": "205738ffcea71aa8a842616531927136939eb4b4",
"size": ... |
import json
from oslo_log import log as logging
from hpedockerplugin.backend_orchestrator import Orchestrator
import hpedockerplugin.etcdutil as util
import hpedockerplugin.file_manager as fmgr
LOG = logging.getLogger(__name__)
class FileBackendOrchestrator(Orchestrator):
fp_etcd_client = None
def __init_... | {
"content_hash": "9ca2a67efbf4b7e46324c9e1f682367a",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 74,
"avg_line_length": 36.02797202797203,
"alnum_prop": 0.5805512422360248,
"repo_name": "hpe-storage/python-hpedockerplugin",
"id": "e98e3feaafb0e20b562ee2cd710272bea48feb3... |
from unittest import mock
import ibis
import pydata_google_auth
import pytest
from google.auth import credentials as auth
from google.cloud import bigquery as bq
import ibis_bigquery
pytestmark = pytest.mark.bigquery
def test_repeated_project_name(project_id, credentials):
con = ibis_bigquery.connect(
... | {
"content_hash": "723186a18572797102f192ab67090709",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 80,
"avg_line_length": 28.956043956043956,
"alnum_prop": 0.6666034155597723,
"repo_name": "ibis-project/ibis-bigquery",
"id": "33e288d77058264aac0d33dce5699ae3a0faa30c",
"... |
"""pwkit.ucd_physics - Physical calculations for (ultra)cool dwarfs.
These functions generally implement various nontrivial physical relations
published in the literature. See docstrings for references.
Functions:
bcj_from_spt
J-band bolometric correction from SpT.
bck_from_spt
K-band bolometric correction from ... | {
"content_hash": "d0d3d412b7f3d4114e7ac12ec8061ac9",
"timestamp": "",
"source": "github",
"line_count": 334,
"max_line_length": 88,
"avg_line_length": 33.56287425149701,
"alnum_prop": 0.6125780553077609,
"repo_name": "pkgw/pwkit",
"id": "6e80a115faa29dd91759aa02d26ce85b02818abd",
"size": "11357",
... |
AUTHFAILURE = 'AuthFailure'
# 认证无效。
AUTHFAILURE_INVALIDAUTHORIZATION = 'AuthFailure.InvalidAuthorization'
# 实例安全组信息添加失败。
FAILEDOPERATION_ADDINSTANCEINFOFAILED = 'FailedOperation.AddInstanceInfoFailed'
# 绑定安全组失败。
FAILEDOPERATION_ASSOCIATESECURITYGROUPSFAILED = 'FailedOperation.AssociateSecurityGroupsFailed'
# 实例安全组信... | {
"content_hash": "51d5916b04149466e92a696b79e06729",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 115,
"avg_line_length": 30.667763157894736,
"alnum_prop": 0.8545532553898959,
"repo_name": "tzpBingo/github-trending",
"id": "45142b1383400f19df945dad724615a477cae7cf",
"s... |
import functools
import inspect
import os
import re
import sys
import threading
from collections import OrderedDict
import six
# noinspection PyUnresolvedReferences
from cheap_repr import cheap_repr, find_repr_function, try_register_repr
from snoop.utils import my_cheap_repr, ArgDefaultDict, iscoroutinefunction, \
... | {
"content_hash": "f613c63e94f2487373521ba3d215a2a8",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 106,
"avg_line_length": 34.246200607902736,
"alnum_prop": 0.5695393627407473,
"repo_name": "alexmojaki/snoop",
"id": "528cf687270b3a15bfacf697ab2f78c1d665a4a5",
"size": "1... |
""" BEIT: BERT Pre-Training of Image Transformers (https://arxiv.org/abs/2106.08254)
Model from official source: https://github.com/microsoft/unilm/tree/master/beit
and
https://github.com/microsoft/unilm/tree/master/beit2
@inproceedings{beit,
title={{BEiT}: {BERT} Pre-Training of Image Transformers},
author={Hangbo B... | {
"content_hash": "ab040363ab8f009625469cfc42209358",
"timestamp": "",
"source": "github",
"line_count": 502,
"max_line_length": 129,
"avg_line_length": 43.354581673306775,
"alnum_prop": 0.6368314648042639,
"repo_name": "rwightman/pytorch-image-models",
"id": "1f6bf82b577d6bfcb2524fd39645aa719c747763"... |
"""
Forms for PartyList app.
"""
from django import forms
from django.forms import ModelForm
from .models import BlacklistedGuest, GreylistedGuest, Guest, Party
class GuestForm(ModelForm):
"""
Form for adding a guest on the client.
"""
name = forms.CharField(max_length=100)
gender = forms.CharFi... | {
"content_hash": "2a3254e874a7eed91348c1fc64843541",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 67,
"avg_line_length": 20.857142857142858,
"alnum_prop": 0.5990516332982087,
"repo_name": "sigmapi-gammaiota/sigmapi-web",
"id": "3d31c6a53f182b6f88233d7b2937a606df5278ae",
... |
'''
Generates a Slurm script for running blast against the probes on various fasta files
@author: Andrew Robinson
'''
import sys, argparse, os, subprocess
import common
def main(argv):
''''''
parser = argparse.ArgumentParser(description='Generates a Slurm script for running blast against the probes on va... | {
"content_hash": "46f7319ff109b4785c5e4cca53806adf",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 191,
"avg_line_length": 43.90163934426229,
"alnum_prop": 0.6463778939507094,
"repo_name": "molecularbiodiversity/carlaseq",
"id": "aa082f3c973dac7962cbe8a1d8e8033426fce2db",
... |
import os
import glob
import math
import subprocess
import re
import sys
import string
from decimal import Decimal
from astropy.io import fits
from astropy import wcs
from dateutil import parser
def logme( str ):
log.write(str + "\n")
print str
return
#MODIFY THESE FIELDS AS NEEDED!
#input path *with* ending... | {
"content_hash": "245fdeda3e9aa5f3eed4f3d010177dea",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 206,
"avg_line_length": 28.35238095238095,
"alnum_prop": 0.598925092374874,
"repo_name": "mcnowinski/various-and-sundry",
"id": "c425bd710ef585b456b9bcd560e11b96a0a0650a",
... |
import datetime
from typing import Dict, List, Optional, TYPE_CHECKING, Union
from .. import _serialization
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
class AADProperties(_serialization.Model):
"""AADProperties.
:ivar service_principal_clien... | {
"content_hash": "459bb9f2c2c0e2dc95f1ae6d071311e4",
"timestamp": "",
"source": "github",
"line_count": 9618,
"max_line_length": 120,
"avg_line_length": 49.31648991474319,
"alnum_prop": 0.6691009980477561,
"repo_name": "Azure/azure-sdk-for-python",
"id": "e36298d0b708c8f078fa275a7ee4614b44501c5c",
... |
"""
Django settings for CityBudgetVisualization project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"... | {
"content_hash": "74214a3b3dc46f06b8bf0cc89b8bb8c8",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 71,
"avg_line_length": 26.362745098039216,
"alnum_prop": 0.6965414652287095,
"repo_name": "jmavis/GovernmentBudgetVisualization",
"id": "ec35c670d3bcfe745434c68341bab0042e39... |
import unittest
from django.test import TestCase
from operating_system.public import OperatingSystem
from remote_host.public import RemoteHost
from ..operating_system_support import OperatingSystemRelations, AbstractedRemoteHostOperator
RELATION_MOCK = {
'1': {
'2': {
'3': {
... | {
"content_hash": "9884b18e4706c4b1ed274702ca93e63c",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 108,
"avg_line_length": 28.066037735849058,
"alnum_prop": 0.6157983193277311,
"repo_name": "jdepoix/goto_cloud",
"id": "cee3690b528f36199b79280b65ec39c3859dab18",
"size": ... |
from django.shortcuts import render
from .models import Card
from .models import Deck
from django.contrib.auth.models import User
from .forms import CreateUserForm
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
from django.views.decorators.csrf import csrf_exempt
from .forms im... | {
"content_hash": "5d0cfa717a3888a32be850dfc28a5079",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 156,
"avg_line_length": 43.38095238095238,
"alnum_prop": 0.6655689718258324,
"repo_name": "introbig/srs",
"id": "ad35fbd929da6f3d4711d2a42fb3816120ddcf51",
"size": "5466",... |
import discord_logging
from classes.notification import Notification
from classes.subscription import Subscription
log = discord_logging.get_logger()
class _DatabaseNotification:
def __init__(self):
self.session = self.session # for pycharm linting
self.log_debug = self.log_debug
def add_notification(self, ... | {
"content_hash": "f418144190af0bf46ba59a42f317c801",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 85,
"avg_line_length": 28.43243243243243,
"alnum_prop": 0.7490494296577946,
"repo_name": "Watchful1/RedditSubsBot",
"id": "17ef588c2cfd72b65119099a7ebdd71b9f1a095c",
"size"... |
import unittest
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
def test_my_view(self):
from .views import my_view
request = testing.DummyRequest()
info = my_vie... | {
"content_hash": "79a5fd263f309a3fa8b83196e1f8d321",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 62,
"avg_line_length": 23.176470588235293,
"alnum_prop": 0.649746192893401,
"repo_name": "jfunez/metadata_collector",
"id": "8139132190540996b7e5c18b480564caf42a40c8",
"siz... |
from django.models.admin import log
from django.core import template
class AdminLogNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAdminLog Node>"
def render(self, context):
i... | {
"content_hash": "a5a6ce5e4723eddfeb591a62c3497f96",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 112,
"avg_line_length": 40.1764705882353,
"alnum_prop": 0.6349438750610054,
"repo_name": "tungvx/deploy",
"id": "b24f7c1dad9bbf0111f1fddb0ebc5c714b2bf0a5",
"size": "2049",
... |
"""defines constants for qjobs"""
from collections import OrderedDict, namedtuple
Itmtp = namedtuple('Itmtp', ['dscr', 'xml_tag'])
ITEMS = OrderedDict((
('i', Itmtp('job id', ['JB_job_number'])),
('p', Itmtp('job priority', ['JAT_prio'])),
('n', Itmtp('job name', ['JB_name'])),
('o', Itmtp('job owner... | {
"content_hash": "80364bcaedda031dcf21062afae3c6cd",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 70,
"avg_line_length": 40.04761904761905,
"alnum_prop": 0.535077288941736,
"repo_name": "amorison/qjobs",
"id": "45dcf7caf394f639e5178be7d72588ee35e4c921",
"size": "841",
... |
class Display:
def __init__(self, width=1, height=1):
self.grid = []
if width < 1 or height < 1:
raise Exception('width and height must both be > 0')
self.width = width
self.height = height
for y in range(height):
row = []
for x in range... | {
"content_hash": "38b2c4ea8ae5871bf5cf8fab850d6963",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 78,
"avg_line_length": 28.82089552238806,
"alnum_prop": 0.5075090626618333,
"repo_name": "Apreche/advent2016",
"id": "7d4e321540c5796fbba1e75b6fcc7a1b747a61df",
"size": "19... |
import os
import subprocess
import sys
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from setuptools.command.egg_info import egg_info
from distutils.command.install_data import install_data
from distutils.command.install import INSTALL_SCHEMES
from distutils.core imp... | {
"content_hash": "ab85fb8af12851a07610221f240bfe75",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 104,
"avg_line_length": 32.62893081761006,
"alnum_prop": 0.6266383962991519,
"repo_name": "Khan/reviewboard",
"id": "27d95a979778eb5a18956ad7bd5b403d75f2c856",
"size": "53... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"django_rv_apps.settings.local")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason.... | {
"content_hash": "5c0ab6b422355bc90798cf87ed7a5306",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 37.36363636363637,
"alnum_prop": 0.6034063260340633,
"repo_name": "davrv93/creed-en-sus-profetas-backend",
"id": "921ae6aa34947dce6653ddb190c44e04fbda5... |
from pymba import Vimba, VimbaException
if __name__ == '__main__':
with Vimba() as vimba:
interface = vimba.interface(0)
interface.open()
# get feature value via feature object
for feature_name in interface.feature_names():
feature = interface.feature(feature_name)
... | {
"content_hash": "b8b1775c3371407cb525a4da3100b838",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 84,
"avg_line_length": 29.818181818181817,
"alnum_prop": 0.49085365853658536,
"repo_name": "morefigs/pymba",
"id": "c07bec3ddd7199586283de8a95ad708eeff9dccc",
"size": "984"... |
"""This module contains Google BigQuery to BigQuery operator."""
import warnings
from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Union
from airflow.models import BaseOperator
from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook
if TYPE_CHECKING:
from airflow.utils.context impor... | {
"content_hash": "31fd2c5117727fce1e779562608eb53f",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 103,
"avg_line_length": 45.21951219512195,
"alnum_prop": 0.6614527148507731,
"repo_name": "lyft/incubator-airflow",
"id": "527033ac433d526217e17f7504e35bded7017f32",
"size... |
from .catalog_item import CatalogItem
class USqlExternalDataSource(CatalogItem):
"""A Data Lake Analytics catalog U-SQL external datasource item.
:param compute_account_name: the name of the Data Lake Analytics account.
:type compute_account_name: str
:param version: the version of the catalog item.
... | {
"content_hash": "716fa0362e0f312495b7990dfce634b8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 153,
"avg_line_length": 44.170731707317074,
"alnum_prop": 0.6570955273329652,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "524e08b359842ada3e7f6f95532ad331bc033b95",
... |
import functools
import inspect
from functools import partial
from django import forms
from django.apps import apps
from django.core import checks, exceptions
from django.db import connection, router
from django.db.backends import utils
from django.db.models import Q
from django.db.models.constants import LOOKUP_SEP
f... | {
"content_hash": "8ea3f3b21520b662cda88247683dd0e8",
"timestamp": "",
"source": "github",
"line_count": 1647,
"max_line_length": 119,
"avg_line_length": 41.523375834851244,
"alnum_prop": 0.5612890961996813,
"repo_name": "uranusjr/django",
"id": "cfb5ea1ef601349632b4d440436fdd9ec0a91462",
"size": "6... |
from oscar.util.selection import *
def train_unit(obs, building_id, action_train_id):
command_center = find_position(obs, building_id)
return [actions.FunctionCall(SELECT_POINT, [NEW_SELECTION, command_center]),
actions.FunctionCall(action_train_id, [NOT_QUEUED])]
| {
"content_hash": "0c800463195911420a423521bcda450c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 80,
"avg_line_length": 41,
"alnum_prop": 0.7177700348432056,
"repo_name": "Xaxetrov/OSCAR",
"id": "880a24ad68b58bd27a9549043c9dadfd7e8a10d4",
"size": "287",
"binary": fals... |
import pygame, sys, random
from pygame.locals import *
#Global Variables and Constants
WINDOW_WIDTH = 700
WINDOW_HEIGHT = 700
PADDLE_WIDTH = 10
PADDLE_LENGTH = 60
PADDLE_VELOCITY = 15
FONTSIZE = 30
BLACK = (0,0,0)
WHITE = (255,255,255)
SCORE_LIMIT=10
#create pygame window
pygame.init()
DS = pygame.display.set_mode((W... | {
"content_hash": "3d7b64441202c7a75786123973537611",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 242,
"avg_line_length": 31.406779661016948,
"alnum_prop": 0.5882352941176471,
"repo_name": "scottnm/Pong",
"id": "e496d0db2f73a2c13ffa77e19bc688af81c9e2bd",
"size": "9265"... |
xshutter_state=0 ## TODO: read the shutter state and set this accordingly
## Open shutter
def xshutter_trigger():
sleep_time = 0.005
caput('XF:11BMB-CT{MC:06}Asyn.AOUT','M112=1')
sleep(sleep_time)
caput('XF:11BMB-CT{MC:06}Asyn.AOUT','M111=1')
sleep(sleep_time)
caput('XF:11BMB-CT{MC:06}Asyn.AO... | {
"content_hash": "7422da46d77b88105f3971a715f5dfcd",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 32.476190476190474,
"alnum_prop": 0.5791788856304986,
"repo_name": "yugangzhang/GitTest",
"id": "b8fb4fc4e072b4a0e68cad9daeb9f3e77c7bb3ea",
"size": "... |
def rate():
# OP complained that the input compares were not working
# if x == [7, 10]
# I mentioned that the input is a string and the range compares were wrong
try:
x = int(raw_input('Rate service from 1 to 10: '))
except ValueError:
raise SystemExit('Enter a number between 1 and 1... | {
"content_hash": "189e5ad63dc0e013cf8f9c4a24c9c74a",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 78,
"avg_line_length": 42.333333333333336,
"alnum_prop": 0.6062992125984252,
"repo_name": "bandarji/lekhan",
"id": "91f8d323c724a5cf3c73206e29086150078cb976",
"size": "508"... |
from __future__ import unicode_literals
import unittest
from contextlib import contextmanager
import mock
import cloudping
class AWSContext(object):
"""Mock for the execution context."""
function_name = 'CloudPing'
function_version = '1.0'
invoked_function_arn = ''
memory_limit_in_mb = 128
... | {
"content_hash": "25ce4b8bee72201f819860e5b917de05",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 85,
"avg_line_length": 35.13253012048193,
"alnum_prop": 0.6128257887517147,
"repo_name": "mlavin/cloudping",
"id": "3c1a3c1a752f939223bb6ee493dfa4e7340037c9",
"size": "2916... |
from nova.openstack.common import log as logging
from nova.compute import vm_states
from nova import rpc
from nova import context
from nova import conductor
from paxes_nova import _
#from nova.openstack.common.rpc.amqp import RpcContext
LOG = logging.getLogger(__name__)
EVENT_TYPE_ERROR = 'ERROR'
EVENT_TYPE_WARN = 'W... | {
"content_hash": "84d7f77e37d059e9f61d23e66047a156",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 39.68888888888889,
"alnum_prop": 0.6259798432250839,
"repo_name": "windskyer/k_nova",
"id": "acd8d44de8be813ba0f51da8d6ad6da27388d528",
"size": "1967... |
from point import Point
import unittest
class TestPoint(unittest.TestCase):
def setUp(self): pass
def tearDown(self): pass
def test_init(self):
test = Point(2,3)
self.assertEqual(test.x, 2)
self.assertEqual(test.y, 3)
def test_str(self):
self.assertEqual(str(Point(14... | {
"content_hash": "e75bb6d9016b9c39454e37bd4eb9b781",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 66,
"avg_line_length": 24,
"alnum_prop": 0.603125,
"repo_name": "vyzyv/university",
"id": "57263564f39959f093ef16b423255375d876c176",
"size": "960",
"binary": false,
"c... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from wagtail.core import blocks
from wagtailstreamforms.conf import get_setting
from wagtailstreamforms.fields import BaseField, register
class SingleLineTextField(BaseField):
field_class = forms.CharField
label = _("Text field ... | {
"content_hash": "4d60ca5160f54119d2fbc27ad92cc579",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 80,
"avg_line_length": 29.317596566523605,
"alnum_prop": 0.593324549846289,
"repo_name": "AccentDesign/wagtailstreamforms",
"id": "8ce340906c3c549999dc4b623e86bf9904b7f7bf",... |
"""
Flask Extension Tests
~~~~~~~~~~~~~~~~~~~~~
Tests the Flask extensions.
:copyright: (c) 2010 by Ali Afshar.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import os
import sys
import shutil
import urllib2
import tempfile
import subprocess
import argpar... | {
"content_hash": "5bf7f9af51af54a07181e19f9febe3e8",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 82,
"avg_line_length": 31.1,
"alnum_prop": 0.590602634581475,
"repo_name": "HackingHabits/PersonalPasswordManager",
"id": "d1d5d991be77579a70cfd4763068548bb7a550b9",
"size... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from ...tests.helper import pickle_protocol, check_pickling_recovery
from ...extern.six.moves import zip
from ... import cosmology as cosm
originals = [cosm.FLRW]
xfails = [False]
@pytest.mark.parametrize(("original","x... | {
"content_hash": "68f3a770e96a9269dd01d56635a8fcb7",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 82,
"avg_line_length": 30.470588235294116,
"alnum_prop": 0.7046332046332047,
"repo_name": "kelle/astropy",
"id": "d9e199f62d7a8ebd70402c8d8d3292b0ab12cdeb",
"size": "582",
... |
"""Utilities for testing endpoints for permissions
To use, import and create class:
class Test<YourEndpointName>Endpoints(EndpointTestBase, test.TestCase):
def setUp(self):
self.init()
# call self.get_in_program_id() to get program_id that people _should_ have access to
# call self.get_out_pro... | {
"content_hash": "46304304f42bdd0f19de44fb6e544414",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 118,
"avg_line_length": 45.47565543071161,
"alnum_prop": 0.5921594465491682,
"repo_name": "mercycorps/TolaActivity",
"id": "a62b8ef37198489fc1c5689759c2ff7e0c8b7c52",
"siz... |
"""Helper methods for configuring deployment manager command flags."""
from googlecloudsdk.api_lib.deployment_manager import dm_v2_util
from googlecloudsdk.calliope import arg_parsers
def AddDeploymentNameFlag(parser):
"""Add properties flag."""
parser.add_argument('deployment_name', help='Deployment name.')
d... | {
"content_hash": "b46e05e83b2a339e7e773ef9e442987c",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 80,
"avg_line_length": 36.83050847457627,
"alnum_prop": 0.6728025770823746,
"repo_name": "Sorsly/subtle",
"id": "d1b21e3c03723fd4a7b509f2c84019e437d74a73",
"size": "2769",
... |
"""
Tests for DynamoDB v2 high-level abstractions.
"""
from __future__ import with_statement
import os
import time
from tests.unit import unittest
from boto.dynamodb2 import exceptions
from boto.dynamodb2.fields import (HashKey, RangeKey, KeysOnlyIndex,
GlobalKeysOnlyIndex)
from bot... | {
"content_hash": "cd528a921cecfc6a86a3919f760b6e73",
"timestamp": "",
"source": "github",
"line_count": 439,
"max_line_length": 79,
"avg_line_length": 31.555808656036447,
"alnum_prop": 0.5269616689525735,
"repo_name": "dablak/boto",
"id": "5cf00291f3a27e0b3cdec2eff285fa5dc48cfddd",
"size": "14977",... |
import loguru
import pytest
@pytest.fixture(autouse=True)
def reset_logger():
def reset():
loguru.logger.remove()
loguru.logger.__init__(
loguru._logger.Core(), None, 0, False, False, False, False, True, None, {}
)
loguru._logger.context.set({})
reset()
yield
... | {
"content_hash": "1803c2ac4c85685d0570a08bc489ea03",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 18.964285714285715,
"alnum_prop": 0.5781544256120528,
"repo_name": "twotwo/tools-python",
"id": "f46132ac442dabe73a3730b8b6f0b2f9b010aef6",
"size": "... |
import sys
import numpy
from math import sqrt,exp
from ase.data import atomic_numbers, chemical_symbols
from ase.units import Bohr
from asap3 import FullNeighborList
# Gobal parameters
parameters = {
# E0 s0 V0 eta2 kappa lambda n0 Lattice type
# eV bohr eV bohr^-1 boh... | {
"content_hash": "316290893cde0804de69af5db97af9a8",
"timestamp": "",
"source": "github",
"line_count": 454,
"max_line_length": 229,
"avg_line_length": 50.8942731277533,
"alnum_prop": 0.5791136501341643,
"repo_name": "auag92/n2dm",
"id": "ac1a722ba3d5ee244c19d64ae114791354fa9b05",
"size": "23251",
... |
from recipe_scrapers.momswithcrockpots import MomsWithCrockPots
from tests import ScraperTest
class TestMomsWithCrockPotsScraper(ScraperTest):
scraper_class = MomsWithCrockPots
def test_host(self):
self.assertEqual("momswithcrockpots.com", self.harvester_class.host())
def test_canonical_url(sel... | {
"content_hash": "769440a0db363a0cf1888829ec03f780",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 813,
"avg_line_length": 47.63265306122449,
"alnum_prop": 0.6636675235646958,
"repo_name": "hhursev/recipe-scraper",
"id": "57e53de4c263a1cc1e7479dbfbea35b93d526b5d",
"size"... |
import sys
import os
import shutil
from subprocess import call, check_output
import time
def job_is_running(job_id):
'''
Returns True if the PBS job with the given id is running.
'''
return call(['qstat', job_id]) == 0
def main():
'''
Brokers communication between Delft3D, MATLAB and Dakota th... | {
"content_hash": "4ae7af6817423b20fcf6228572b93183",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 76,
"avg_line_length": 36.56666666666667,
"alnum_prop": 0.6631722880583409,
"repo_name": "mdpiper/dakota-experiments",
"id": "405d7a806ca20278f48e18354301b6d2e7bc90aa",
"si... |
import random
import datetime as dt
from pyoperant import panels
from pyoperant import utils
class Shaper(object):
"""
Run a shaping routine in the operant chamber that will teach an
to peck the center key to hear a stimulus, then peck one of the side keys for reward.
training sequence:
Block 1: H... | {
"content_hash": "4f7813b313d10a2c9c6a1680a6268ed1",
"timestamp": "",
"source": "github",
"line_count": 610,
"max_line_length": 174,
"avg_line_length": 51.247540983606555,
"alnum_prop": 0.5352036083298679,
"repo_name": "theilmbh/pyoperant",
"id": "bee5bca7242a141b444c042a1f62579c4bb6121f",
"size": ... |
import pytest
from app.models import User
def test_password_setter():
u = User(password='supersecret')
assert u.password_hash is not None
def test_no_password_getter():
u = User(password='supersecret')
with pytest.raises(AttributeError):
u.password
def test_password_verification():
u =... | {
"content_hash": "051aec2d3804c7d61b3ea01cf57d0837",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 66,
"avg_line_length": 27,
"alnum_prop": 0.6794380587484036,
"repo_name": "teknik-eksjo/chronos",
"id": "ceba6828a43a1829d84800384c51c1652f9e339b",
"size": "1566",
"binar... |
from github_way.main import return_true
def test_return_true():
assert return_true() is True
| {
"content_hash": "095633f5c821f2c6447ce04e8a2275ff",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 39,
"avg_line_length": 24.5,
"alnum_prop": 0.7346938775510204,
"repo_name": "katakumpo/github-way",
"id": "65990008848fe52a57a67c1a466e32095a09280f",
"size": "98",
"binary... |
from core.himesis import Himesis
import uuid
class Hlayer2rule2(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer2rule2.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(Hlayer2rule2, self).__init__(name='Hlayer2rule2', num_nodes=0, edg... | {
"content_hash": "c723cd9e308cb5878ac8d2efe0543cc5",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 121,
"avg_line_length": 35.329268292682926,
"alnum_prop": 0.6738004832585434,
"repo_name": "levilucio/SyVOLT",
"id": "66680bb87ed295a17e154cf39ccc9708a6cb127f",
"size": "28... |
import unittest
from refiner.geometry import Box
class BoxTestCase(unittest.TestCase):
def test_width_height_constructor(self):
box = Box(10, 10, width=10, height=10)
self.assertEqual(box.left, 10, 'incorrect left')
self.assertEqual(box.top, 10, 'incorrect top')
self.assertEqual(bo... | {
"content_hash": "70d00cd061925affd729ead7b6a54fe8",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 74,
"avg_line_length": 48.083969465648856,
"alnum_prop": 0.6167645658040959,
"repo_name": "maxspencer/pdfrefiner",
"id": "f60d13342b67fada8185724f7c795ffd2569ebfd",
"size"... |
from django.db import models
# Create your models here.
class Challenge(models.Model):
challenge_title = models.CharField(max_length=120)
challenge_text = models.TextField()
solution = models.TextField()
# data for API
# usually in JSON
# some challenges need data to be generated on the fly
... | {
"content_hash": "f1afe7e13a5c789bae05e87250bc4df1",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 74,
"avg_line_length": 37.833333333333336,
"alnum_prop": 0.6769456681350955,
"repo_name": "avinassh/learning-scraping",
"id": "24705f28b495c706bfb85da290bced9411f66e0d",
"s... |
import copy
import six
from odin import exceptions, registration
from odin.exceptions import ValidationError
from odin.fields import NOT_PROVIDED
from odin.utils import cached_property
RESOURCE_TYPE_FIELD = '$'
META_OPTION_NAMES = ('name', 'namespace', 'name_space', 'verbose_name', 'verbose_name_plural', 'abstract', ... | {
"content_hash": "8f1d812b653d05c080302f3f55cf0d18",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 119,
"avg_line_length": 34.54907975460123,
"alnum_prop": 0.5787978336144899,
"repo_name": "tjmcewan/odin",
"id": "06aba2b6ecc56d28f9df25c49aede8d0bde3c536",
"size": "11287... |
import tensorflow as tf
from candidate_selection.tensorflow_models.components.abstract_component import AbstractComponent
class TargetComparator(AbstractComponent):
variable_prefix = None
variables = None
comparison = None
def __init__(self, variables, variable_prefix="", comparison="dot_product"):... | {
"content_hash": "920e1c15dbfb5af5d544950576189771",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 148,
"avg_line_length": 42.48717948717949,
"alnum_prop": 0.7012673506336753,
"repo_name": "MichSchli/QuestionAnsweringGCN",
"id": "ab4fe6a35fc834554cb2d16a3ed9674eb8eb6994",
... |
import re
class METAR:
"""
METAR
Purpose: Parses and keeps track of variables related to METAR observations
Started: 25 June 2010 by Tim Supinie ([email protected])
Completed: 26 June 2010
Modified: [not yet]
"""
# Private static list giving the priority for reporting the sky co... | {
"content_hash": "9d24e9062583822c5c772348299548e8",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 185,
"avg_line_length": 49.562814070351756,
"alnum_prop": 0.5665618980026361,
"repo_name": "pulsatrixwx/PulsatrixWx",
"id": "400a4f0aceb4f70c3afbeea942f3b7ed3b955c9f",
"si... |
import collections
import numpy as np
start_token = 'G'
end_token = 'E'
def process_poems(file_name):
poems = []
with open(file_name, "r", encoding='utf-8', ) as f:
for line in f.readlines():
try:
title, content = line.strip().split(':')
content = content.re... | {
"content_hash": "2f95fe163231b771a40d7d0fe0f37ace",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 110,
"avg_line_length": 35.67857142857143,
"alnum_prop": 0.5530530530530531,
"repo_name": "koala-ai/tensorflow_nlp",
"id": "534a62ef49c6daa19009aa40f9aa4594beb0e9d5",
"size... |
INDEX_DIR = "IndexFiles.index"
import sys, os, lucene
from java.nio.file import Paths
from org.apache.lucene.analysis.standard import StandardAnalyzer
from org.apache.lucene.index import DirectoryReader
from org.apache.lucene.queryparser.classic import QueryParser
from org.apache.lucene.store import SimpleFSDirectory... | {
"content_hash": "54e0f1f693b8241e037187087d3a7cfe",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 79,
"avg_line_length": 38.416666666666664,
"alnum_prop": 0.705531453362256,
"repo_name": "svn2github/pylucene",
"id": "9e037ed1af8af16950b0013313f0b5b09aceb4f0",
"size": "1... |
from .a_component import AComponent
class AHeading(AComponent):
def __init__(self, size, *args, **kwargs):
self.size = size
super().__init__(*args, **kwargs)
def tagname(self):
return "h{}".format(self.size)
| {
"content_hash": "7326581f8e123fdaf345149502856832",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 46,
"avg_line_length": 24.3,
"alnum_prop": 0.5925925925925926,
"repo_name": "Sefrwahed/Alfred",
"id": "458d8e8f8fcfcc2e3787a56fa2af30cbc41b9c56",
"size": "243",
"binary":... |
"""Shared constants and functions."""
import collections
import os
from official.nlp.data import tagging_data_lib
from official.nlp.configs import encoders
from official.nlp.tasks.tagging import TaggingConfig, ModelConfig
import tensorflow_hub as hub
import tensorflow as tf
from absl import logging
from training.mode... | {
"content_hash": "fa160b57e645965ff6337fc005a1bfb7",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 121,
"avg_line_length": 42.802083333333336,
"alnum_prop": 0.6260241745761337,
"repo_name": "googleinterns/bert-annotator",
"id": "fd7ef6abb8532e880cfbf7b3c2e784e62f9f61c8",
... |
from functools import update_wrapper
from collections import Mapping
VictronServicePrefix = 'com.victronenergy'
def safeadd(*values):
""" Adds all parameters passed to this function. Parameters which are None
are ignored. If all parameters are None, the function will return None
as well.
"""
values = [v for v... | {
"content_hash": "804dac919ba3169a3ba08fd81490ac9e",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 110,
"avg_line_length": 29.288888888888888,
"alnum_prop": 0.7139605462822458,
"repo_name": "victronenergy/dbus-systemcalc-py",
"id": "181bc2397e48fb814b6163227f13bcb71653a57c... |
__author__ = 'sachinpatney'
class IAction:
def __init__(self):
pass
def __do__(self):
raise Exception('This should be overridden')
| {
"content_hash": "b7bf587341381ae0d3e3b260be88d02b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 15.9,
"alnum_prop": 0.5660377358490566,
"repo_name": "sachinio/redalert",
"id": "7cb7c44bfe3acd134998576cd4f968a897486832",
"size": "159",
"binary"... |
"""
calico.calcollections
~~~~~~~~~~~~~~~~~~~~~
Collection classes and utils.
"""
import logging
_log = logging.getLogger(__name__)
class SetDelta(object):
"""Represents a change to a base set.
Tracks the minimum collection of additions and removals required to apply
the changes to the set.
"""
... | {
"content_hash": "c309e2b5d22cc0592f7b026f674ae22f",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 79,
"avg_line_length": 34.252941176470586,
"alnum_prop": 0.5620814013395157,
"repo_name": "TrimBiggs/calico",
"id": "993c635dbc2e8bf651deb82433e30ca369b16ca1",
"size": "64... |
from math import ceil
import pytest
from scipy.stats import norm, randint
import numpy as np
from sklearn.datasets import make_classification
from sklearn.dummy import DummyClassifier
from sklearn.experimental import enable_halving_search_cv # noqa
from sklearn.model_selection import StratifiedKFold
from sklearn.mod... | {
"content_hash": "dfea29d9303befabb37f576547409b95",
"timestamp": "",
"source": "github",
"line_count": 707,
"max_line_length": 88,
"avg_line_length": 35.605374823196605,
"alnum_prop": 0.618519842688595,
"repo_name": "amueller/scikit-learn",
"id": "93365809cb4d6b2b8592fb824db81c46f2e016c2",
"size":... |
import unittest
import numpy as np
import paddle
import paddle.static
from paddle.fluid.tests.unittests.ipu.op_test_ipu import IPUOpTest
def set_serialize_factor(serialize_factor):
main_prog = paddle.static.default_main_program()
op = main_prog.current_block().ops[-1]
op._set_attr('serialize_factor', ser... | {
"content_hash": "a11daba30c6591854880f1ecafd64868",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 77,
"avg_line_length": 31.428571428571427,
"alnum_prop": 0.5818181818181818,
"repo_name": "luotao1/Paddle",
"id": "6ee930f2475302aca93cf8875a127ffee95144fa",
"size": "3251"... |
from HandleFiles import HandleFiles
from DbHelper import DbHelper
path = raw_input('HandleFiles in Path : ')
a = HandleFiles()
b = DbHelper()
b.create_table_on_db()
a.scan_for_files_with_extension(path)
file = a.get_file()
files = file.split(" - ")
for file in files:
if not file: continue
b.insert_value... | {
"content_hash": "014e4a56bc686899024d7c9b420aa1a1",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 42,
"avg_line_length": 16.8,
"alnum_prop": 0.6964285714285714,
"repo_name": "AlucarDWeb/HandleFiles",
"id": "ae85e08c773fafef7935dbfc23c714c30ce66e54",
"size": "337",
"bi... |
import _plotly_utils.basevalidators
class TickcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self,
plotly_name="tickcolor",
parent_name="scatterternary.marker.colorbar",
**kwargs,
):
super(TickcolorValidator, self).__init__(
plotl... | {
"content_hash": "7b0d2d018bb286f4177396e5e253492b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 70,
"avg_line_length": 29.3125,
"alnum_prop": 0.5927505330490405,
"repo_name": "plotly/plotly.py",
"id": "d29d47c7723c26f6417b3aaecef0077b4881b844",
"size": "469",
"binar... |
import os
from MuseParse.tests.testUsingXML.xmlSet import xmlSet, parsePiece
from MuseParse.classes.ObjectHierarchy.ItemClasses import Directions
from MuseParse.classes.ObjectHierarchy.TreeClasses.PartNode import PartNode
from MuseParse.classes.ObjectHierarchy.TreeClasses.MeasureNode import MeasureNode
from MuseParse.... | {
"content_hash": "3a8fca620ac8b5c425e9283e1eda2f9e",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 82,
"avg_line_length": 30.16976127320955,
"alnum_prop": 0.5852822226129769,
"repo_name": "Godley/MuseParse",
"id": "6a68bb0c930b17e97556ac8d00a799a48095360e",
"size": "113... |
import mock
from oslo_config import cfg
cfg.CONF.import_group('keystone_authtoken',
'keystonemiddleware.auth_token')
import keystoneclient.exceptions as kc_exception # noqa
from solum.common import exception
from solum.common import solum_keystoneclient
from solum.tests import base
from solum.... | {
"content_hash": "5138d6168d982beef7c8dff381c6b9ed",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 79,
"avg_line_length": 45.11453744493392,
"alnum_prop": 0.5875402792696026,
"repo_name": "devdattakulkarni/test-solum",
"id": "55ac331f16a365f9819f0c21c560e12e18baf1f2",
"... |
import json
import itemlookup
import sys
import os
from riotcall import league
def main():
key = 'RGAPI-5593b315-1fc8-4ad8-be9e-45474b1f7308'
r = league.item_static(key)
if r.status_code != 200: # Ensure the request was successful
sys.std... | {
"content_hash": "1bf31cd98b7ef15ae57f8214b779ba4f",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 120,
"avg_line_length": 45.81666666666667,
"alnum_prop": 0.49836304110585666,
"repo_name": "LeulBM/ItemSetInteractions",
"id": "b8dc37acd9e49b3019073912e3035d182e7eef7f",
... |
pqueue.
| {
"content_hash": "2f254f8113c900e9e8ed98bd5f2bc849",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 7,
"avg_line_length": 8,
"alnum_prop": 0.75,
"repo_name": "SarahPythonista/acmpy",
"id": "f1bab14e15d9c4c5cd8852a95632b06869ab966d",
"size": "8",
"binary": false,
"copie... |
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
class TestimonialsApphook(CMSApp):
name = _("Testimonials Apphook")
app_name = 'testimonial'
def get_urls(self, page=None, language=None, **kwargs):
return ['allink_ap... | {
"content_hash": "c36e59fdbca07cb7110d00e6ab6402f3",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 59,
"avg_line_length": 27.714285714285715,
"alnum_prop": 0.7422680412371134,
"repo_name": "allink/allink-apps",
"id": "8bc07243b68e54350996869f4306a0deefcd763b",
"size": "4... |
"""
These examples illustrate algorithms implemented by nondeterministic
atomic actions. The examples are from the book, "Parallel Program
Design: A Foundation" by Chandy & Misra.
The efficient way to solve most problems is to execute a deterministic
sequence of actions. The examples are presented merely to show how... | {
"content_hash": "62564c4e7caa8835b87aa8ff7ae597b7",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 81,
"avg_line_length": 39.80882352941177,
"alnum_prop": 0.6214259327669006,
"repo_name": "AssembleSoftware/IoTPy",
"id": "719f449525c425c7ff9f4e13a5b3ea0744e9444c",
"size"... |
from django.shortcuts import get_object_or_404
from django import forms
from django.forms import Form, ModelForm, ModelChoiceField, ChoiceField
from django.contrib.auth.models import User, Group
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields impor... | {
"content_hash": "dc93227ccd9c562a4640e0c758a8eab7",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 273,
"avg_line_length": 43.64125560538117,
"alnum_prop": 0.677764077270859,
"repo_name": "laurenor/SchoolIdolAPI",
"id": "21004eaac8696ddec500ca4d658fd918fc23668e",
"size"... |
import lwmath.Vector
class Spring(object):
def __init__(self, p1, p2, rest_length=100, stiffness=1.0):
self.p1 = p1
self.p2 = p2
self.rest_length = rest_length
self.stiffness = stiffness
self._delta = lwmath.Vector.Vector()
def apply(self):
"""F = -kx"""
... | {
"content_hash": "346048eebec7ab46b61ac3cc0780dd7d",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 105,
"avg_line_length": 30.625,
"alnum_prop": 0.5795918367346938,
"repo_name": "gregroper/Pycipia",
"id": "602697ca4cb033e74112f53aec94d4983cf12de1",
"size": "750",
"bina... |
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models
from ..._serialization import Deserializer, Serializer
from ._configuration import SecurityCenterConfiguration
... | {
"content_hash": "6387118eb90453935ccd1c1a404dbd39",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 116,
"avg_line_length": 47.67058823529412,
"alnum_prop": 0.709279368213228,
"repo_name": "Azure/azure-sdk-for-python",
"id": "f2384c2be350def18c2c5c8c0daa8e6ae2432aca",
"si... |
import os
import platform
from collections import OrderedDict, defaultdict
from jinja2 import Environment, FileSystemLoader
from conan.tools.env.environment import ProfileEnvironment
from conans.errors import ConanException, ConanV2Exception
from conans.model.conf import ConfDefinition
from conans.model.env_info impo... | {
"content_hash": "cf25c80bfcd5502392b7271dbebaaa80",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 96,
"avg_line_length": 39.16860465116279,
"alnum_prop": 0.6239424075998219,
"repo_name": "conan-io/conan",
"id": "b484f68af833a55e5e3ce3a6b41690119d86a81f",
"size": "13474... |
from info import __doc__
from numpy.version import version as __version__
import multiarray
import umath
import _internal # for freeze programs
import numerictypes as nt
multiarray.set_typeDict(nt.sctypeDict)
import _sort
from numeric import *
from fromnumeric import *
from defmatrix import *
import ma
import defchara... | {
"content_hash": "c465ffba6d80841b298563432f210e33",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 51,
"avg_line_length": 23.10810810810811,
"alnum_prop": 0.7146198830409357,
"repo_name": "santisiri/popego",
"id": "4d22394d544f6c50a796826ee0f9218c566f8190",
"size": "856"... |
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.backend.python.targets.python_binary import PythonBinary
from pants.build_graph.app_base import AppBase
class PythonApp(AppBase):
"""A deployable Python application.
Invoking the ``bundle`` goal on one of these targets... | {
"content_hash": "975311aee0b308798f7f0cb32f5c8105",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 82,
"avg_line_length": 27.25,
"alnum_prop": 0.7549148099606815,
"repo_name": "twitter/pants",
"id": "22e9a6bdd7c7ff599159cbf4a9c18badd1f21206",
"size": "910",
"binary": f... |
_author__ = "Dilipbobby"
# Collect input from the user coverting str to flot
kilometers = float(input('How many kilometers?: '))
# conversion factor
#NOTE: kilometer is equal to 0.62137 miles. 2) Kilometer = Miles / 0.62137
conv_fac = 0.621371
# calculate miles
miles = kilometers * conv_fac
print('%0.3f ... | {
"content_hash": "0e1e2c100549dea1e223ccab9d831311",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 77,
"avg_line_length": 37.54545454545455,
"alnum_prop": 0.7046004842615012,
"repo_name": "dilipbobby/DataScience",
"id": "6ec2710243d54a6636933f6b4c69d1c3b94e2931",
"size":... |
fname = input('Enter the file name: ')
try:
fhand = open(fname)
except:
print('File cannot be opened:', fname)
exit()
count = 0
total = 0
for line in fhand:
words = line.split()
if len(words) != 2 : continue
if words[0] != 'X-DSPAM-Confidence:' : continue
try:
conf = float(words[1])
... | {
"content_hash": "712c395bf0070cb8835750a2b1c5cb5f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 51,
"avg_line_length": 23.15,
"alnum_prop": 0.6025917926565875,
"repo_name": "mkhuthir/learnPython",
"id": "8cd9f32644196435cf8975c24ca034d84b73f910",
"size": "463",
"bin... |
import sys
import subprocess
import shutil
copied = []
ignore = ["libSystem.B.dylib","libstdc++.6.dylib"]
basefolder = sys.argv[1].rsplit("/",2)[0]
copy = True
recur = True
if len(sys.argv) == 3:
copy = False
if len(sys.argv) == 4:
copy = False
recur = False
def update_libraries(executable):
# Find all the d... | {
"content_hash": "da802638e21fe1cdc552dbce665486bb",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 109,
"avg_line_length": 27.245283018867923,
"alnum_prop": 0.659972299168975,
"repo_name": "baubie/SpikeDB",
"id": "90f3280e0080115be2667dd6b5d95a7841e50c1d",
"size": "1444"... |
import os
import sys
sys.path.append(os.path.dirname(__file__))
import openstackdocstheme
# Avoid unactionable warnings
import requestsexceptions
requestsexceptions.squelch_warnings(requestsexceptions.InsecureRequestWarning)
# If extensions (or modules to document with autodoc) are in another directory,
# add these... | {
"content_hash": "08a4ebbbb15d2c368e860b5f8c5babaa",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 102,
"avg_line_length": 34.42960288808664,
"alnum_prop": 0.7042046765230157,
"repo_name": "AlekhyaMallina-Vedams/openstack-manuals",
"id": "815db31de991a82728bec3acc76d6d0a2... |
from numpy import ndarray, asarray, prod, concatenate, expand_dims
from numpy import any as npany
from collections import Iterable
def tupleize(arg):
"""
Coerce singletons and lists and ndarrays to tuples.
Parameters
----------
arg : tuple, list, ndarray, or singleton
Item to coerce
""... | {
"content_hash": "d7df221eda72453872d31da203c7cb81",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 90,
"avg_line_length": 25.401869158878505,
"alnum_prop": 0.5965783664459161,
"repo_name": "andrewosh/bolt",
"id": "77f59c7fc5227bbf17e13a3771be678fb0036dc7",
"size": "5436... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.