text stringlengths 4 1.02M | meta dict |
|---|---|
"""Utility helpers to handle progress bars in `huggingface_hub`.
Example:
1. Use `huggingface_hub.utils.tqdm` as you would use `tqdm.tqdm` or `tqdm.auto.tqdm`.
2. To disable progress bars, either use `disable_progress_bars()` helper or set the
environment variable `HF_HUB_DISABLE_PROGRESS_BARS` to 1.
... | {
"content_hash": "3b636e3c7e5bb7fa103f8e478458abab",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 91,
"avg_line_length": 32.76190476190476,
"alnum_prop": 0.6718023255813953,
"repo_name": "huggingface/huggingface_hub",
"id": "c16beb58e79ba90694c08e5287493e1ca9e0c3c9",
"... |
import copy
import sys
import numpy as np
import json
import chainer
import chainer.links as L
import chainer.functions as F
from my_iterator import SerialIterator
from chainer import cuda
from chainer import training, Variable, ChainList
from chainer.training import extensions
from chainer.optimizer import WeightDecay... | {
"content_hash": "4821227d5b09378a7c6fd97cc5b77867",
"timestamp": "",
"source": "github",
"line_count": 466,
"max_line_length": 95,
"avg_line_length": 38.547210300429185,
"alnum_prop": 0.5760173690363525,
"repo_name": "masashi-y/myccg",
"id": "90344659cf053329f5da14fbc3bc22f5bef8c978",
"size": "179... |
__author__ = 'Andreas Bader'
__version__ = "0.01"
import threading
import time
import vagrant
import os
import Util
import re
from fabric.api import *
import subprocess
class Vm():
vagrantFolders=None
pathVagrantfile=None
credFiles=None
basicFilesFolder=None
pathFolder=None
tmpFolder=None
... | {
"content_hash": "6b12a13f4d565604e1545589262fe6c7",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 260,
"avg_line_length": 46.58139534883721,
"alnum_prop": 0.5649525711432851,
"repo_name": "TSDBBench/Overlord",
"id": "88c9b672abce7df290eb568a96c20f224dbcc162",
"size": "... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("site", "0029_auto_20210120_0934"),
]
operations = [
migrations.AddField(
model_name="sitesettings",
name="fulfillment_allow_unpaid",
field=models.Boolean... | {
"content_hash": "8d252047a4a85a212e527f6c1ddb708b",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 52,
"avg_line_length": 25.476190476190474,
"alnum_prop": 0.5813084112149532,
"repo_name": "mociepka/saleor",
"id": "a7216c810f18f32c4475c406bd6316b6b3f2af28",
"size": "584"... |
"""
Event pub/sub routines.
"""
import inspect
from .enum import EnumType, EnumBase
from .errors import prepare_for_reraise, reraise
class EventHook:
"""This type allows to implement event pattern.
Allowed operations on EventHook objects:
* hook.subscribe(handler) # subscribe
* hook.unsubscribe... | {
"content_hash": "2bd20d05f5628f87ccf6be401a82e26b",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 91,
"avg_line_length": 31.82170542635659,
"alnum_prop": 0.5821356069833536,
"repo_name": "quora/qcore",
"id": "8bd33ff39dda0892e5d98a45f85676ff92b0c05d",
"size": "12889",
... |
"""Spanish dictionary"""
es = {
"LANGUAGE": "Español",
# Client notifications
"config-cleared-notification": "Ajustes limpiados. Los cambios serán guardados cuando almacenes una configuración válida.",
"relative-config-notification": "Cargados los archivo(s) de configuración relativa: {}",
"conn... | {
"content_hash": "127f31a217e9640f25c52f51e6d36f06",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 701,
"avg_line_length": 80.4393063583815,
"alnum_prop": 0.7325620389000671,
"repo_name": "alby128/syncplay",
"id": "60ca7419ee64d6a4b60329abf0385df20a209293",
"size": "421... |
import lib.requests as requests
import conf.config as conf
base = conf.read_config(conf.path, 'API', 'baseUrl')
class AddImg(object):
def __addImg(self,data):
api = conf.read_config(conf.path, 'API', 'addImgApi')
url = base + api
s = requests.session()
result = s.post(url... | {
"content_hash": "c4569105e198506da0d703c29cafea02",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 61,
"avg_line_length": 30.258064516129032,
"alnum_prop": 0.5415778251599147,
"repo_name": "HH890612/MiliCloud",
"id": "0edc916f2c9bfd851ccc12b7c0e14b3b92ab6721",
"size": "9... |
"""
Contains view context classes.
Context is our own concept.
It's part of the View abstract layer in MTV paradigm.
Data flow looks like this:
Urls -> Context -> View.
So, by concept, View receives context directly
without accessing url args.
It stands between urls and view functions.
Every context class is used via... | {
"content_hash": "ecb6469d0cf46b4db680a943414bb010",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 94,
"avg_line_length": 29.99201596806387,
"alnum_prop": 0.6130041261812857,
"repo_name": "fidals/refarm-site",
"id": "a2ab2545b5c0914f268e7c839e96396e44b6d5a5",
"size": "1... |
try:
import smbus
except ImportError:
raise ImportError("Error : python-smbus not found.\nInstall with 'sudo apt-get install python-smbus'")
import re
"""
================================================
ABElectronics Python Helper Functions
Version 1.1 Created 20/01/2015
Python 2 only
Requires python 2 smbus ... | {
"content_hash": "2351ec80a01973285574000b944a118c",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 106,
"avg_line_length": 28.294573643410853,
"alnum_prop": 0.6389041095890411,
"repo_name": "CaptainStouf/python_libs",
"id": "d88fa5440889a5c6a255f9442e73b44c61c9b7eb",
"s... |
import telnetlib
import time
from .adapter import Adapter
class TelnetAdapter(Adapter):
""" Adapter class for using the Python telnetlib package to allow
communication to instruments
:param host: host address of the instrument
:param port: TCPIP port
:param query_delay: delay in seconds between ... | {
"content_hash": "54d072789794dde7e09e1179d8fa91ba",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 97,
"avg_line_length": 35.85245901639344,
"alnum_prop": 0.6360310928212163,
"repo_name": "ralph-group/pymeasure",
"id": "9efaa5e27921e385bf8dd10d84d401fba1354bc1",
"size": ... |
from __future__ import print_function # This *must* be the first line
import pytest
import os
import subprocess
from pyethereum import tester, utils, transactions, blocks, processblock, rlp
import serpent
from solc import solc
class TestMul7(object):
OWNER = {'address': tester.a0, 'key': tester.k0}
MANAGER1... | {
"content_hash": "c17e5e08d73748407d8c481ddd55e54f",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 80,
"avg_line_length": 34.67857142857143,
"alnum_prop": 0.631307929969104,
"repo_name": "joelcan/tools-eth-contract-dev",
"id": "cedc1b276580b2396ef44f37b7f72502403cacf2",
... |
from django.contrib import admin
from .models import (
InvoiceSettings,
TimeCode,
)
class InvoiceSettingsAdmin(admin.ModelAdmin):
pass
admin.site.register(InvoiceSettings, InvoiceSettingsAdmin)
class TimeCodeAdmin(admin.ModelAdmin):
pass
admin.site.register(TimeCode, TimeCodeAdmin)
| {
"content_hash": "6bd1ffd808b4861f248950552b9794e4",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 58,
"avg_line_length": 17,
"alnum_prop": 0.7777777777777778,
"repo_name": "pkimber/invoice",
"id": "6a85f05e74d5d8a2824f7ded1e6669fc758f4de4",
"size": "332",
"binary": fa... |
from typing import Any, List
import logging
from pajbot.managers.adminlog import AdminLogManager
from pajbot.managers.db import DBManager
from pajbot.managers.handler import HandlerManager
from pajbot.models.command import Command, CommandExample
from pajbot.modules.base import BaseModule
log = logging.getLogger(__n... | {
"content_hash": "30cbb28437f7a29ebdb82044e9f5b52b",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 264,
"avg_line_length": 42.15934065934066,
"alnum_prop": 0.53864199139841,
"repo_name": "pajlada/tyggbot",
"id": "9d86fe4e4213f7d1f73e9aa2ff1861e624383629",
"size": "7673"... |
import time
from urllib import urlencode
from threading import current_thread, RLock
from django.conf import settings
from graphite.http_pool import http
from graphite.readers import FetchInProgress
from graphite.logger import log
from graphite.util import unpickle
from graphite.worker_pool.pool import pool_apply
fr... | {
"content_hash": "0821f7fe78c9b411ca15b4620212adf2",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 100,
"avg_line_length": 31.815315315315317,
"alnum_prop": 0.5571286988531785,
"repo_name": "brutasse/graphite-web",
"id": "9509d717eacd5ad2c985b32b67d76524ef6621c3",
"size... |
"""Built-in volume type properties."""
from oslo_config import cfg
from oslo_db import exception as db_exc
import six
from cinder import context
from cinder import db
from cinder import exception
from cinder.i18n import _, _LE
from cinder.openstack.common import log as logging
CONF = cfg.CONF
LOG = logging.getLogg... | {
"content_hash": "f8b6ad35755699212e2376cd235d8157",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 79,
"avg_line_length": 34.61267605633803,
"alnum_prop": 0.5552390640895218,
"repo_name": "Akrog/cinder",
"id": "8624a10f4d367568de18c44959fe0d1f23f017cc",
"size": "10692",... |
from dirbalak import repomirrorcache
from upseto import gitwrapper
import collections
import logging
Dependency = collections.namedtuple(
"Dependency", "gitURL hash requiringURL requiringURLHash type masterHash broken")
class Traverse:
def __init__(self, visitMasterBranchOfEachDependency=True):
self... | {
"content_hash": "beaa02a68cb7982743fe25fb0aa98b65",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 107,
"avg_line_length": 42.656716417910445,
"alnum_prop": 0.6273617914625612,
"repo_name": "Stratoscale/dirbalak",
"id": "d9f0dd5eee34f3be81e469520b3eec00bcc550c1",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tracker', '0012_auto_20160221_1400'),
]
operations = [
migrations.AlterField(
model_name='system',
name='color_code',
... | {
"content_hash": "7b0db8236b3795149d79d0c97be79cfa",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 50,
"avg_line_length": 21.22222222222222,
"alnum_prop": 0.5916230366492147,
"repo_name": "paftree/WHturk",
"id": "08ccf9cc561fdd42c87501b60fbdcb0c0e42d602",
"size": "454",
... |
"""Tests for `imawurk` package."""
import pytest
from click.testing import CliRunner
from imawurk import imawurk
from imawurk import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.g... | {
"content_hash": "e31fe3a6cb45ebfcde18ed954efca9a6",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 27.314285714285713,
"alnum_prop": 0.696652719665272,
"repo_name": "gityom/imawurk",
"id": "35109761866d31af5b7fe6867aaa3181ce530260",
"size": "1003",... |
from django.apps import AppConfig
class ImraisingConfig(AppConfig):
name = 'imraising'
verbose_name = 'Imraising Application'
def ready(self):
import imraising.signals
| {
"content_hash": "cf5cc34959e80b7c9efabb3a3d163437",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 42,
"avg_line_length": 21.555555555555557,
"alnum_prop": 0.7010309278350515,
"repo_name": "google/mirandum",
"id": "994056232ab52842a4c5e554e01eb5c2650c3546",
"size": "808",... |
"""ML-ENSEMBLE
:author: Sebastian Flennerhag
:copyright: 2017-2018
:licence: MIT
Blend indexing.
"""
from __future__ import division
from numbers import Integral
import numpy as np
from ._checks import check_partial_index
from .base import BaseIndex
class BlendIndex(BaseIndex):
"""Indexer that generates two ... | {
"content_hash": "727f3c564457aef5d37ea59d5082a562",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 79,
"avg_line_length": 35.46,
"alnum_prop": 0.5190355329949239,
"repo_name": "flennerhag/mlens",
"id": "4ff7901c688487ce618e10b96ec527c0d6e90402",
"size": "7092",
"binar... |
from django.db import models
class Portal(models.Model):
TYPE_CHOICES = (
("CKAN", "CKAN"),
)
name = models.CharField(max_length=100)
type = models.CharField(max_length=8, choices=TYPE_CHOICES)
url = models.URLField()
def __str__(self):
return self.name
| {
"content_hash": "03473fe6ed4d643bd0423058d1163372",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 63,
"avg_line_length": 21.285714285714285,
"alnum_prop": 0.6174496644295302,
"repo_name": "bellisk/opendata-multisearch",
"id": "c1404f3ceac86c3c0b44181489b38641eb158c65",
... |
from django.conf.urls import patterns, url
urlpatterns = patterns('pythonMDA.apps.home.views',
url(r'^$', 'index_view', name='vista_principal',),
)
| {
"content_hash": "caa2729ea10befe08bdc5f7f11aa572a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 62,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.5815217391304348,
"repo_name": "caballerojavier13/python-mda",
"id": "64b238e8e1065a6340efa33f825c5978c1e67c4b",
"... |
import json
import os
from datetime import datetime
from dotenv import load_dotenv
from flask import Flask, jsonify, make_response, render_template, request, url_for
load_dotenv()
# set token value in order to validate posts
SECRET = os.getenv("TOKEN")
QUEUE_PATH = os.getenv("QUEUE_PATH", "cache/queue.json")
# Load ... | {
"content_hash": "ab66f4a2f65f0dcde3ba315a8eda44d7",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 82,
"avg_line_length": 29.214953271028037,
"alnum_prop": 0.5863723608445297,
"repo_name": "tym-oao/algoth",
"id": "eeaba00abbe355b9a790c6722483e172c2a3b29a",
"size": "3165... |
import uuid
from db.common import Base
from db.specific_event import SpecificEvent
from db.event import Event
from db.player import Player
from db.team import Team
class Faceoff(Base, SpecificEvent):
__tablename__ = 'faceoffs'
__autoload__ = True
HUMAN_READABLE = 'faceoff'
STANDARD_ATTRS = [
... | {
"content_hash": "77f5f311250b7b6331040639dacc1664",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 31.871794871794872,
"alnum_prop": 0.5905068382944489,
"repo_name": "leaffan/pynhldb",
"id": "a20e470aa0b4a82a9a375f5b348ece698d483e47",
"size": "1290... |
import os
import setuptools
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
with open('test-requirements.txt') as f:
test_required = f.read().splitlines()
setuptools.setup(
# Do not use underscores in the plugin name.
name='cloudify-deployment-proxy-plugin',
... | {
"content_hash": "37a6c94773b94645837971ec78823689",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 71,
"avg_line_length": 22.967741935483872,
"alnum_prop": 0.6657303370786517,
"repo_name": "denismakogon/cloudify-deployment-proxy-plugin",
"id": "6e137acee411f5987585d74c5936... |
"""
Tests are comprised of Python scripts. Files whose names begin with an
underscore will *not* be executed as test scripts.
Test scripts drive the browser with Selenium WebDriver by importing and
using SST actions.
The standard set of actions are imported by starting the test scripts with::
from sst.actions im... | {
"content_hash": "34e89e4051c6ff4ba21fe1f0850f2b72",
"timestamp": "",
"source": "github",
"line_count": 1434,
"max_line_length": 94,
"avg_line_length": 31.96792189679219,
"alnum_prop": 0.6330657475677326,
"repo_name": "ktan2020/legacy-automation",
"id": "aae07a3a93cc49d9e2629c34a31a6fe2e3ac4e30",
"... |
class Node( object ):
def __init__( self, attr, attrs, dataSet ):
self.falsePath = None # Destination Node for False
self.truePath = None # Destination Node for True
self.attribute = attr # Name of Attribute
self.attributes = attrs # Remaining possible attributes
self.dataSet = dataSet # Subset o... | {
"content_hash": "9ebbab1959600ae9e44fb7a91e8d468f",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 142,
"avg_line_length": 35.43956043956044,
"alnum_prop": 0.7007751937984497,
"repo_name": "CKPalk/MachineLearning",
"id": "e103d872a5cac8663113a0738ed1d4d68f32b520",
"size"... |
from f5.bigip import ManagementRoot
from f5.bigip.resource import OrganizingCollection
from f5.bigip.tm.analytics.dos_vis_common import Generate_Report
from f5.bigip.tm.analytics.dos_vis_common import Report_Results
from f5.sdk_exception import MissingRequiredCreationParameter
from f5.sdk_exception import UnsupportedOp... | {
"content_hash": "2da6dba131eb6a85dc8cc45c39cda702",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 91,
"avg_line_length": 38.111111111111114,
"alnum_prop": 0.7058632977000324,
"repo_name": "F5Networks/f5-common-python",
"id": "d39bc4b7aec9047b6724d025f5c54216daae68b1",
"... |
import os
from ._compat import itervalues
from ._globals import GLOBAL_LOCKER, THREAD_LOCAL
from ._load import OrderedDict
from .helpers._internals import Cursor
class ConnectionPool(object):
POOLS = {}
check_active_connection = True
def __init__(self):
_iid_ = str(id(self))
self._connect... | {
"content_hash": "93afa913dbc1e0ab792542a161869497",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 80,
"avg_line_length": 32.857988165680474,
"alnum_prop": 0.5515937331172339,
"repo_name": "niphlod/pydal",
"id": "b36a5969df72b74d0273ce502c69f4779a393819",
"size": "5577"... |
from setuptools import setup
import os
def get_version(version_tuple):
if not isinstance(version_tuple[-1], int):
return '.'.join(map(str, version_tuple[:-1])) + version_tuple[-1]
return '.'.join(map(str, version_tuple))
init = os.path.join(os.path.dirname(__file__), 'hupwatch', '__init__.py')
versi... | {
"content_hash": "2172212b071baf681b37ee1dd1b88169",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 105,
"avg_line_length": 26.112676056338028,
"alnum_prop": 0.6175836030204962,
"repo_name": "swistakm/hupwatch",
"id": "d591f160b4ba347d2ab9a256308dc262a69e19e1",
"size": "1... |
from osgeo import ogr
class Point(object):
""" Wrapper for ogr point """
def __init__(self, lat, lng):
""" Coordinates are in degrees """
self.point = ogr.Geometry(ogr.wkbPoint)
self.point.AddPoint(lng, lat)
def getOgr(self):
return self.point
ogr = property(getOgr)
cl... | {
"content_hash": "e1305577af736ecde8da232faa5c837d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 29.591836734693878,
"alnum_prop": 0.6186206896551724,
"repo_name": "rmichnovicz/Sick-Slopes",
"id": "06548990de94ac88942dc35135440f91926140e7",
"size... |
import cStringIO
import urllib
import numpy as np
import pylru
import utilities
from PIL import Image
def fetch_image_from_url(url):
"""
Returns a pil image from given url
:rtype Image.Image:
"""
if utilities.url_exists(url):
img_stream = cStringIO.StringIO(urllib.urlopen(url).read())
... | {
"content_hash": "a233c9eaaff88f8b2f946a68127dd231",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 119,
"avg_line_length": 29.203252032520325,
"alnum_prop": 0.6227728285077951,
"repo_name": "abhishekraok/GraphMap",
"id": "516064dd8435d5b5002cb9410d3db081e99ef6c1",
"size... |
from setuptools import setup
from querycount import __version__
url = "https://github.com/bradmontgomery/django-querycount/tarball/{0}".format(__version__)
setup(
name="django-querycount",
version=__version__,
author="Brad Montgomery",
author_email="brad@bradmontgomery.net",
description=("Middlewa... | {
"content_hash": "9287912a0ec209f06b12e049bd3e6264",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 94,
"avg_line_length": 33.225806451612904,
"alnum_prop": 0.6485436893203883,
"repo_name": "bradmontgomery/django-querycount",
"id": "68112dabfd5ca3b2a5b143f836de176cee979826"... |
import logging
import pytest
import salt.cache
from tests.pytests.functional.cache.helpers import run_common_cache_tests
log = logging.getLogger(__name__)
@pytest.fixture
def cache(minion_opts):
opts = minion_opts.copy()
opts["memcache_expire_seconds"] = 42
cache = salt.cache.factory(opts)
return c... | {
"content_hash": "6f832c0fac08e30bfd691e3128ddedaa",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 73,
"avg_line_length": 20.3,
"alnum_prop": 0.7315270935960592,
"repo_name": "saltstack/salt",
"id": "30bc5fec26b50f29c016b78c821997fdd401684a",
"size": "406",
"binary": f... |
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from ratelimitbackend import admin
from ratelimitbackend.views import login
admin.autodiscover()
from . import views
from .profiles.... | {
"content_hash": "41bd8738664c8df0364bba0c3c45d472",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 77,
"avg_line_length": 39.5625,
"alnum_prop": 0.7045813586097947,
"repo_name": "rmoorman/feedhq",
"id": "5d3e14cf1dd421799bdc87afbc22a863d6bfdd1d",
"size": "1290",
"binar... |
import requests
from bs4 import BeautifulSoup
import json
import urllib
headers = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0'}
queries = ["Happy human face", "Sad human face", "Angry human face", "Disgusted human face", "Surprised human face", "Fearful human face",
"... | {
"content_hash": "95ed7d0858de310e2245f96a001bc629",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 163,
"avg_line_length": 39.04,
"alnum_prop": 0.6004098360655737,
"repo_name": "mkeyran/EmotionRecognizer",
"id": "3cb3f8260248bf7e82afe37f87ebd41a871759e7",
"size": "4029"... |
import factory
from .base import BaseUserFactory
from libs.core.models.users.admin import AdminUser
class AdminProfileFactory(factory.Factory):
class Meta:
model = dict
first_name = factory.Faker('first_name')
last_name = factory.Faker('last_name')
class AdminUserFactory(BaseUserFactory):
... | {
"content_hash": "7781ec20017a67819ab9bfec61fe1197",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 53,
"avg_line_length": 20.7,
"alnum_prop": 0.7270531400966184,
"repo_name": "thnee/django-template",
"id": "2fb1afa6fd4a0ab336d16f92eb5090562016e5e8",
"size": "415",
"bin... |
"""Adds accounts to the specified multi-client account, in a single batch."""
from __future__ import absolute_import
from __future__ import print_function
import json
import sys
from shopping.content import common
from six.moves import range
# Number of accounts to insert.
BATCH_SIZE = 5
def main(argv):
# Authen... | {
"content_hash": "328fa38ef07e74926387bea1b661c1ea",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 27.963636363636365,
"alnum_prop": 0.5929778933680104,
"repo_name": "googleads/googleads-shopping-samples",
"id": "a7ee50fc38b79e2c5c6873ef5de59e3509e47... |
import optparse
from collections import defaultdict
import numpy as np
def silk_output_parser(input_file_name,output_file_name,id1,id2):
input_read = open(input_file_name,'rU') #read input file
train = open(output_file_name,'w') #write on output file
#write the headers
train.write(id1)
train.write(',')
... | {
"content_hash": "210f69e72263a51fbcb80df0501b0514",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 149,
"avg_line_length": 31.81578947368421,
"alnum_prop": 0.6286186931348222,
"repo_name": "enricopal/STEM",
"id": "82e36d23da46b455f3c889fd6c60dd7927278ed4",
"size": "2418"... |
import importlib
import pretend
import pytest
from fenrir.utils import resolve_app
def test_resolve_app_resolves(monkeypatch):
app = pretend.stub()
module = pretend.stub(myapp=app)
monkeypatch.setattr(importlib, "import_module", lambda x: module)
assert resolve_app("example:myapp") is app
def tes... | {
"content_hash": "9f91679dc14dcae805efecbf5e02ac41",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 69,
"avg_line_length": 23.703703703703702,
"alnum_prop": 0.715625,
"repo_name": "dstufft/fenrir",
"id": "f194843a56b282675f45453481335490759a0537",
"size": "1181",
"binar... |
""" Testing report generation
"""
from __future__ import absolute_import
from bigmler.tests.world import (world, common_setup_module,
common_teardown_module, teardown_class)
import bigmler.tests.basic_tst_prediction_steps as test_pred
def setup_module():
"""Setup for the modul... | {
"content_hash": "951a9de027631b90dd86923707b9cb38",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 148,
"avg_line_length": 35.46969696969697,
"alnum_prop": 0.5779581375480564,
"repo_name": "brokendata/bigmler",
"id": "11d3943c1b25f92b2633b9ea775eef53b2cf2926",
"size": "2... |
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
import ipdb
import matplotlib
ipdb.set_trace()
matplotlib.use('Agg')
import matplotlib.pyplot as plt
cifar10... | {
"content_hash": "84009d4d486f2271e6f2fe0660852c3b",
"timestamp": "",
"source": "github",
"line_count": 675,
"max_line_length": 603,
"avg_line_length": 39.06666666666667,
"alnum_prop": 0.6992036405005688,
"repo_name": "kitu2007/dl_class",
"id": "0df4a2a8be589dcd0ca6356c937a8b739e7cdf5e",
"size": "2... |
from unittest import TestCase
import pandas as pd
import numpy as np
import pandas_validator as pv
class DataFrameValidatorFixture(pv.DataFrameValidator):
"""Fixture for testing the validation of column type."""
integer_field = pv.IntegerColumnValidator('i')
float_field = pv.FloatColumnValidator('f')
c... | {
"content_hash": "1d9a90a77b83e5f0cc2fedd840609ccc",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 79,
"avg_line_length": 36.50526315789474,
"alnum_prop": 0.6594579008073818,
"repo_name": "c-bata/pandas-validator",
"id": "52111521c38284b2af8d09790799edc0205e4afa",
"size"... |
from enum import auto
from typing import Union
from fastapi import FastAPI
from fastapi_utils.enums import StrEnum
from fastapi_utils.tasks import repeat_every
from panoptes.utils.config.client import get_config
from pydantic import BaseModel
from panoptes.pocs.sensor.power import PowerBoard
class RelayAction(StrEn... | {
"content_hash": "eef23a35e6f33cdcfb0605dcb17b3cc5",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 24.86904761904762,
"alnum_prop": 0.7027285782671134,
"repo_name": "panoptes/POCS",
"id": "38b22acb374bf59810dc019221d662e2190ab448",
"size": "2089",
... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
def get_unspent(listunspent, amount):
for utx in listunspent:
if utx['amount'] == amount:
return utx
raise AssertionError('Could not find unspent with amount={}'.format(amount))
class RawTran... | {
"content_hash": "b72639ad0e619a1ef4c7cb697fba1a82",
"timestamp": "",
"source": "github",
"line_count": 659,
"max_line_length": 223,
"avg_line_length": 42.78907435508346,
"alnum_prop": 0.5523441378821193,
"repo_name": "precious-project/precious",
"id": "395a880fe3c8400d5a34c4756f40d02404281251",
"s... |
import serial
import time
import Reactive
import plot
from math import sqrt
serial = serial.Serial('/dev/ttyS0')
IPLOT=True
TURNING_TOWARDS_HOME = False
ANGLE_THRESH = 3
ANGLE_PRECISE_THRESH = 20
ANGLE_CAREFUL_THRESH = 10
DIST_THRESH = 8
DIST_NEAR = 60
DEFAULT_SPEED_ACTIVE = 0.05
DEFAULT_SPEED_HOME = 0.05
EXPLORE_... | {
"content_hash": "961cf6d6ced7607dbe10d676f569ad7c",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 105,
"avg_line_length": 35.559322033898304,
"alnum_prop": 0.5238322211630124,
"repo_name": "XapaJIaMnu/iar",
"id": "1b2ce7a1d5b5ddb26cba9f487db68e0b33d02290",
"size": "427... |
"""Paster"""
from os.path import dirname, exists
import promus.util as util
def paste(prs, name):
"Paste a template to current location. "
tmp = dirname(__file__)
if exists('%s/%s' % (tmp, name)):
util.exec_cmd('cp -r %s/%s/* ./' % (tmp, name), True)
else:
prs.dismiss("PASTE>> no temp... | {
"content_hash": "c91c028a4e3e2666f42a5ff984b0d8ce",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 26.928571428571427,
"alnum_prop": 0.5729442970822282,
"repo_name": "jmlopez-rod/promus",
"id": "04f76ebb9b803ab626c171a09af5bb5fc11fad7d",
"size": "3... |
"""Script to automatically roll dependencies in the libyuv DEPS file."""
import argparse
import base64
import collections
import logging
import os
import re
import subprocess
import sys
import urllib2
# Skip these dependencies (list without solution name prefix).
DONT_AUTOROLL_THESE = [
'src/third_party/gflags/src... | {
"content_hash": "8389930e6a526507745718faea83f82a",
"timestamp": "",
"source": "github",
"line_count": 493,
"max_line_length": 80,
"avg_line_length": 35.8316430020284,
"alnum_prop": 0.6393433342768186,
"repo_name": "endlessm/chromium-browser",
"id": "2b95e302cdbf9f552717ee1f5bb5cdd6dcd7bbc4",
"siz... |
"""
Django app
"""
from django.apps import AppConfig
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class RootConfig(AppConfig):
"""AppConfig for this project"""
name = 'main'
def ready(self):
missing_settings = [
setting_name for setting_name... | {
"content_hash": "6b66392a4106399563339c9d548e54c5",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 92,
"avg_line_length": 27.545454545454547,
"alnum_prop": 0.6353135313531353,
"repo_name": "mitodl/cookiecutter-djangoapp",
"id": "5ab6467da749dd11f65dfaffdedbc1a7acf553b1",
... |
"""
Client side of the compute RPC API.
"""
from oslo.config import cfg
from oslo import messaging
from nova import block_device
from nova import exception
from nova.objects import base as objects_base
from nova.openstack.common.gettextutils import _
from nova.openstack.common import jsonutils
from nova import rpc
r... | {
"content_hash": "8cf529536591a2be43de509dfb840281",
"timestamp": "",
"source": "github",
"line_count": 1015,
"max_line_length": 79,
"avg_line_length": 46.63743842364532,
"alnum_prop": 0.6004816528297103,
"repo_name": "eharney/nova",
"id": "c87e0c79f45ffa7d2f36193311ea26665f57422a",
"size": "47943"... |
from jingo import register
from tower import ugettext_lazy as _lazy
from fjord.feedback.config import CODE_TO_COUNTRY
@register.filter
def country_name(country, native=False, default=_lazy(u'Unknown')):
"""Convert a country code into a human readable country name"""
if country in CODE_TO_COUNTRY:
dis... | {
"content_hash": "3e6567f34bc15bebc2463c2659350544",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 67,
"avg_line_length": 32.642857142857146,
"alnum_prop": 0.7199124726477024,
"repo_name": "DESHRAJ/fjord",
"id": "ffa9ae7b23b8671d15cd1ca98c7fc5a1506692a0",
"size": "457",
... |
"""empty message
Revision ID: 324666fdfa8a
Revises: f18180ede802
Create Date: 2016-08-04 13:45:37.492317
"""
# revision identifiers, used by Alembic.
revision = '324666fdfa8a'
down_revision = 'f18180ede802'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | {
"content_hash": "b03b6beb8a9eca8cd6b3ae1b0e6f77fd",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 133,
"avg_line_length": 33.214285714285715,
"alnum_prop": 0.7043010752688172,
"repo_name": "schinke/solid-fortnight-ba",
"id": "70ac4b8866361736b8dccdec635e8aa522bb5941",
"... |
__author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
import rethinkdb as r # Rethinkdb Python driver
# Memory class
class Memory(object):
def __init__(self, starting_time, ending_time, data): # Initialize the object
self.starting_time = starting_time # Starting time attribute
self.ending_time = endi... | {
"content_hash": "2371485820a6080227481d7f4ed80efe",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 99,
"avg_line_length": 33.220338983050844,
"alnum_prop": 0.6811224489795918,
"repo_name": "mertyildiran/Cerebrum",
"id": "d64ba925f27bfdbf4b94051778f43f65ff19acf9",
"size":... |
from django.urls import path
from frequencia.calendario import views
app_name = 'calendario'
urlpatterns = [
#Feriados
path('', views.feriados, name='feriados'),
path('<int:ano>', views.feriados, name='feriados'),
path('feriado/novo/', views.feriado_create, name='feriado_create'),
path('feriado/remover/<int:pk>'... | {
"content_hash": "e9401241287662e5b9f6f5f1eead00c8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 79,
"avg_line_length": 30.75,
"alnum_prop": 0.7235772357723578,
"repo_name": "bczmufrn/frequencia",
"id": "a2b5198fca2afb0aaa31f8f0ba27f7db6f7179a2",
"size": "369",
"bina... |
from __future__ import print_function, division, absolute_import
from struct import pack
from ..message import BulkFrontendMessage
class LoadBalanceRequest(BulkFrontendMessage):
message_id = None
LOADBALANCE_REQUEST = 80936960
def read_bytes(self):
bytes_ = pack('!I', self.LOADBALANCE_REQUEST)
... | {
"content_hash": "8f54517f4872720b734bd33b533aeb79",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 24.428571428571427,
"alnum_prop": 0.7222222222222222,
"repo_name": "uber/vertica-python",
"id": "c0988a8ca6511b16a502e444a6baa7ac754f83e4",
"size": "... |
from django.core import serializers
from django.conf import settings
import os
import itertools
import json
from information.models import PageData
from urlocators.models import Page
from workers.models import Job
class Pull:
'''
'''
@classmethod
def set_job_id(cls, job_id):
'''
'''
... | {
"content_hash": "9e01127277a5f9fcfd38fdc691e78d89",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 84,
"avg_line_length": 29.43621399176955,
"alnum_prop": 0.49657486369355514,
"repo_name": "VulcanoAhab/delphi",
"id": "62bbc29d74cdb74767aed35e67539ab5068104dd",
"size": "... |
import m5
from m5.objects import *
from Caches import *
def config_cache(options, system):
if options.l2cache:
system.l2 = L2Cache(size='2MB')
system.tol2bus = Bus()
system.l2.cpu_side = system.tol2bus.port
system.l2.mem_side = system.membus.port
system.l2.num_cpus = options... | {
"content_hash": "e9d8c42af2950b4104804a187328dca0",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 73,
"avg_line_length": 32.77272727272727,
"alnum_prop": 0.5922330097087378,
"repo_name": "liangwang/m5",
"id": "075f6d235155025302490fe06ab38ad0fd449888",
"size": "2336",
... |
import pandas as pd
import numpy as np
import pyaf.HierarchicalForecastEngine as hautof
import pyaf.Bench.TS_datasets as tsds
import datetime
#get_ipython().magic('matplotlib inline')
def train_and_force_fail(b , error_message):
try:
df = b.mPastData;
lEngine = hautof.cHierarchicalForeca... | {
"content_hash": "4097d18e66e6df49a020bcf03e8413b1",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 100,
"avg_line_length": 27.82857142857143,
"alnum_prop": 0.63347022587269,
"repo_name": "antoinecarme/pyaf",
"id": "c23ebfc660a269f25ef848c6a20227468b6d3a2b",
"size": "974"... |
from __future__ import absolute_import
from chaco.label import Label
from kiva import FILL
from traits.trait_types import Bool, Float, Str
from traits.traits import Property
# ============= standard library imports ========================
# ============= local library imports ==========================
class Marker... | {
"content_hash": "1e60d88e8638726fbe0d5e52641af21a",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 78,
"avg_line_length": 30.383838383838384,
"alnum_prop": 0.515625,
"repo_name": "UManPychron/pychron",
"id": "676697ddf3ecd00c1ba4c1e0c990eae357b5afff",
"size": "3808",
"... |
"""
@created_at 2015-01-18
@author Exequiel Fuentes <efulet@gmail.com>
"""
import sys
import datetime
from lib.util import Options, SystemUtils
from lib.doc import BagOfWords
from lib.net import Network
from lib.stats import FMetrics
#import warnings
#warnings.filterwarnings("ignore", category=DeprecationWarning)
... | {
"content_hash": "f2e332bd72e0caaa3da8c2d6f783fead",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 128,
"avg_line_length": 35.07368421052632,
"alnum_prop": 0.5984393757503002,
"repo_name": "efulet/text_classification",
"id": "b5b97f2dd8350510cdd9e78155c49f13a71dbf51",
"s... |
""" Setuptools project configuration for rnglib. """
from os.path import exists
from setuptools import setup
long_desc = None
if exists('README.md'):
with open('README.md', 'r') as file:
long_desc = file.read()
setup(name='rnglib',
version='1.3.10',
author='Jim Dixon',
author_email='jdd... | {
"content_hash": "19d5be492e29cefd6467b39aa4755a0b",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 73,
"avg_line_length": 32.729729729729726,
"alnum_prop": 0.5871180842279108,
"repo_name": "jddixon/rnglib",
"id": "362a98a29424ad96f85f9471926a55ff15152685",
"size": "1249"... |
import math
from collections import Counter
# ==================================================
# Statistical tools
# ==================================================
# efficient combinatorial function to handle extremely large numbers
def log_choose(n, k):
r = 0.0
# swap for efficiency if k is more than h... | {
"content_hash": "45ead46f66173b1c7b15f41d19e05c63",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 99,
"avg_line_length": 29.442622950819672,
"alnum_prop": 0.6227728285077951,
"repo_name": "hall-lab/svtyper",
"id": "51cc3cdf5e370c95acf6ddaab3698445dd100387",
"size": "35... |
def get_volume_of_cuboid(length, width, height):
return length * width * height
# PEP8: kata function name should use snake_case not mixedCase
getVolumeOfCubiod = get_volume_of_cuboid
| {
"content_hash": "aafa2bf29772b8bfa96f0939fd6b002d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 62,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.7578947368421053,
"repo_name": "the-zebulan/CodeWars",
"id": "ea8f829caba29eedeab0465afb150380af5ca33f",
"size": "... |
"""
This script reads a text file with a list of species names and
SMILES strings and converts it to an RMG dictionary.
The text file should have one species per line, with the species
name/identifier first, followed by the SMILES string.
Comments marked with '!' are ignored.
"""
import argparse
import re
from rmgpy... | {
"content_hash": "5ca45095bddaf77e1df426c02154f8ea",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 74,
"avg_line_length": 28.77358490566038,
"alnum_prop": 0.6177049180327869,
"repo_name": "mliu49/RMG-stuff",
"id": "f487c9a59471b5b3f0e7dd9ce7442915ec6dfbeb",
"size": "1566... |
class jackstack:
"""stack that uses stacknodes"""
def __init__(self):
self.head = None
def push(self, value):
self.head = stacknode(value, self.head)
def pop(self):
result = self.head.value
self.head = self.head.fwdNode
return result
class stacknode:
... | {
"content_hash": "378cb8826f7a63bea627741834fdaaef",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 63,
"avg_line_length": 25.36842105263158,
"alnum_prop": 0.5892116182572614,
"repo_name": "sniboboof/data-structures",
"id": "8defdcc8cbe4dd1831a1eb0a67730fb28a77181a",
"siz... |
"""
tf.Variable
See https://www.tensorflow.org/api_docs/python/tf/Variable
"""
import tensorflow as tf
W = tf.Variable(tf.random_uniform([1], -1.0, 1.0), name='weight') #See https://www.tensorflow.org/api_docs/python/tf/random_uniform
b = tf.Variable(tf.zeros([1]), name='bias') #See https://www.tensorflow.org/api_docs/... | {
"content_hash": "43f5b5160ec4c689477fca439b6d34a6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 131,
"avg_line_length": 34.05555555555556,
"alnum_prop": 0.7177814029363785,
"repo_name": "KarateJB/Python.Practice",
"id": "dc99ee0493ee27e488f94b20c38aa91bf9b504ec",
"siz... |
import ast
import re
import sys
import codecs
from json import JSONEncoder
from ast import *
# Is it Python 3?
python3 = hasattr(sys.version_info, 'major') and (sys.version_info.major == 3)
class AstEncoder(JSONEncoder):
def default(self, obj):
if hasattr(obj, '__dict__'):
dic = obj.__dict_... | {
"content_hash": "2a06e6c78867c66c9642a0ab5f2097a8",
"timestamp": "",
"source": "github",
"line_count": 634,
"max_line_length": 91,
"avg_line_length": 26.1198738170347,
"alnum_prop": 0.5122584541062802,
"repo_name": "lambdalab/pysonar2",
"id": "67fb48014bc7e4330e5d24ee0ddfd86014d5f3b7",
"size": "16... |
from Tkinter import *
def sel():
selection = "Value = " + str(var.get())
label.config(text = selection)
root = Tk()
var = DoubleVar()
scale = Scale( root, variable = var, orient=HORIZONTAL )
scale.pack(anchor=CENTER)
button = Button(root, text="Get Scale Value", command=sel)
button.pack(anchor=CENTER)
label =... | {
"content_hash": "3dbef21dce6bc00f0da774810cc46ab5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 58,
"avg_line_length": 20.11111111111111,
"alnum_prop": 0.6906077348066298,
"repo_name": "divir94/News-Analytics",
"id": "b541460b59e1af52de93201dd35d6f084abd7e2f",
"size":... |
class AbstractTrade:
"""High-level class representing a trade from one coin to another.
"""
def __init__(
self,
sell_coin: str,
buy_coin: str,
reference_coin: str,
reference_value: float,
) -> None:
self._sell_coin = sell_coin
self._buy_coin = buy... | {
"content_hash": "8ec00f1ea3352a016cff4bfbe55ee5b8",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 70,
"avg_line_length": 24.322580645161292,
"alnum_prop": 0.5822281167108754,
"repo_name": "elsehow/moneybot",
"id": "98830c10b469b8d51ef43286f475b4e1ce6a406f",
"size": "780... |
import gspread
from oauth2client.service_account import ServiceAccountCredentials
# use creds to create a client to interact with the Google Drive API
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('Beautifulseodang-c0a5cc61a537.json', scope)
client = gsprea... | {
"content_hash": "85565be3029fd634b1728a948ccccc91",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 101,
"avg_line_length": 31.428571428571427,
"alnum_prop": 0.7931818181818182,
"repo_name": "yeongseon/django_beautifulseodang",
"id": "0ba96a49ee2a47b66e2d8e3cc64349fcbf22783... |
import theano
import theano.tensor as T
import numpy as np
from lasagne.layers import Layer
from lasagne.layers.recurrent import Gate
import lasagne.nonlinearities
import lasagne.init
class Controller(Layer):
r"""
The base class :class:`Controller` represents a generic controller
for the Neural Turing Ma... | {
"content_hash": "389f41f53a01b8cbc4a8da9ab22cd98f",
"timestamp": "",
"source": "github",
"line_count": 758,
"max_line_length": 122,
"avg_line_length": 55.098944591029024,
"alnum_prop": 0.6092661319286484,
"repo_name": "snipsco/ntm-lasagne",
"id": "525eca495e65dd354bc619b9ab4ba13680861bc1",
"size":... |
"""Helper functions for package setup.
"""
import ast
import sys
import subprocess
import pkg_resources
class SetupHelper(object):
"""
SetupHelper streamlines the population of setup() function calls with
contents from __init__.py and README.md.
"""
def __init__(self, initfile="__init__.py", rea... | {
"content_hash": "e96753c7e1bb8af7a5e16700b41b1458",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 93,
"avg_line_length": 35.2125,
"alnum_prop": 0.5686900958466453,
"repo_name": "tanghaibao/goatools",
"id": "fabadc9973325d107e06a92bbb3105eedc4f4fb8",
"size": "2864",
"b... |
from collections import OrderedDict
import numpy as np
from np_model_base import NNModelBase
from utils import softmax, safe_macro_f1
__author__ = "Christopher Potts"
__version__ = "CS224u, Stanford, Spring 2022"
class RNNClassifier(NNModelBase):
"""
Simple Recurrent Neural Network for classification problem... | {
"content_hash": "fe32abf8d5e69f23b630e6a209633d52",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 75,
"avg_line_length": 32.47148288973384,
"alnum_prop": 0.534192037470726,
"repo_name": "cgpotts/cs224u",
"id": "9f5c206053528e475fee0195408922ab68817537",
"size": "8540",... |
import unittest
from airflow import DAG, configuration, models
from airflow.contrib.sensors.weekday_sensor import DayOfWeekSensor
from airflow.contrib.utils.weekday import WeekDay
from airflow.exceptions import AirflowSensorTimeout
from airflow.models import DagBag, TaskFail
from airflow.settings import Session
from ai... | {
"content_hash": "53645a46e5dd218124fe4566f7bcc2e9",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 87,
"avg_line_length": 38.41258741258741,
"alnum_prop": 0.5876570180229382,
"repo_name": "r39132/airflow",
"id": "ac8a3354e6310445b55137d99be4174b9702bac3",
"size": "6307"... |
from tastypie.resources import ModelResource
from tastypie.constants import ALL
from tastypie import fields
from kvtags.models import *
class TagResource(ModelResource):
kv_pairs = fields.ToManyField('kvtags.api.KeyValueResource', 'kv_pairs', full=True)
class Meta:
queryset = Tag.objects.all()
... | {
"content_hash": "3013284e60319eb8129f24df23cb8820",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 87,
"avg_line_length": 25.41025641025641,
"alnum_prop": 0.6185671039354188,
"repo_name": "ozen/django-kvtags",
"id": "029223c4fcbde71cf8c3b8ded6815bb47055c97a",
"size": "99... |
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
from app import create_app, db
from app.models import Category, Item, User, Message
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, Migrat... | {
"content_hash": "ef19c1d9c3fd27a0ee6c8c95653868eb",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 75,
"avg_line_length": 27.62162162162162,
"alnum_prop": 0.7025440313111546,
"repo_name": "rosariomgomez/tradyfit",
"id": "f835d6b487798b46a9135a8e3be93abc283a76ff",
"size":... |
"""Run the py->rst conversion and run all examples.
Steps are:
analyze example index file for example py filenames
check for any filenames in example directory not included
do py to rst conversion, writing into build directory
run
"""
# ------------------------------------------------------------------... | {
"content_hash": "6d0d7886b454803086c9d57e5f41afca",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 79,
"avg_line_length": 33.15909090909091,
"alnum_prop": 0.6154900616860863,
"repo_name": "villalonreina/dipy",
"id": "d34ab28ff7ce359d775f568201fcca1352ee9177",
"size": "4... |
"""Grainbin tasks module."""
from celery.utils.log import get_task_logger
from fm_server.celery_runner import app
from .grainbin_update import process_grainbin_update
LOGGER = get_task_logger("fm.grainbin.tasks")
@app.task(name="grainbin.update")
def grainbin_update(info):
"""Celery task for grainbin update me... | {
"content_hash": "f520de93c8764b9f01d3bd6a5b0efd4b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 78,
"avg_line_length": 27.5,
"alnum_prop": 0.7090909090909091,
"repo_name": "nstoik/farm_monitor",
"id": "11dbfc0f4e04a20a0c0037d4aafff7c6ed1b13aa",
"size": "660",
"binar... |
def post_save(sender, instance, created, **kwargs):
"""
Receives a signal just after the object is saved.
"""
if created:
instance.at_first_save()
def remove_attributes_on_delete(sender, instance, **kwargs):
instance.db_attributes.all().delete()
| {
"content_hash": "71d558a29b9478697ea36400654c8950",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 60,
"avg_line_length": 27.6,
"alnum_prop": 0.6594202898550725,
"repo_name": "feend78/evennia",
"id": "49a24570664b08c91c43c7a4433ce95f41ff3ed6",
"size": "318",
"binary": ... |
"""Fake HPE client for testing LeftHand without installing the client."""
import sys
import mock
from cinder.tests.unit import fake_hpe_client_exceptions as hpeexceptions
hpelefthand = mock.Mock()
hpelefthand.version = "2.1.0"
hpelefthand.exceptions = hpeexceptions
sys.modules['hpelefthandclient'] = hpelefthand
| {
"content_hash": "98f22378464cfa8a98f26b1743e839f6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 24.46153846153846,
"alnum_prop": 0.789308176100629,
"repo_name": "bswartz/cinder",
"id": "2360de0977f75d0a0de6ebb79c71914e26ac2e44",
"size": "988",
... |
DESCRIPTION = "PyAnalog - Weather forecasting with analogous past dates."
DISTNAME = 'pyanalog'
MAINTAINER = 'Francisco M. Alvarez'
MAINTAINER_EMAIL = 'francisco.m.alvarez@gmail.com'
URL = 'https://github.com/mogismog/PyAnalog'
LICENSE = 'Apache v2 License'
DOWNLOAD_URL = 'https://github.com/mogismog/PyAnalog'
VERSION ... | {
"content_hash": "0d057671ec3bb82d1004a99c8c227ebd",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 115,
"avg_line_length": 35.542857142857144,
"alnum_prop": 0.6463022508038585,
"repo_name": "mogismog/PyAnalog",
"id": "728d1cf1e343fdba5d301ab01cce4600a39ddbfa",
"size": "1... |
import datetime
import time
from gppylib.operations.segment_reconfigurer import SegmentReconfigurer, FTS_PROBE_QUERY
from gppylib.test.unit.gp_unittest import GpTestCase
import pg
import pgdb
import mock
from mock import Mock, patch, call, MagicMock
import contextlib
class MyDbUrl:
pass
class SegmentReconfigu... | {
"content_hash": "b556d0cb93d13e01a3649aea18b1b04d",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 129,
"avg_line_length": 33.797872340425535,
"alnum_prop": 0.6185080264400378,
"repo_name": "jmcatamney/gpdb",
"id": "7db1c70d0e7d40578faf43a0d5b3e736ea796cf7",
"size": "317... |
class SprinklerQueueElementControl( ):
def __init__(self,redis_handle,io_control,alarm_queue,counter_devices):
self.redis = redis
self.alarm_queue = alarm_queue
self.io_control = io_control
self.counter_devices = counter_devices
self.app_files = l... | {
"content_hash": "4d35b3c3cf4775a40bd3e4399c62adf6",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 170,
"avg_line_length": 42.488207547169814,
"alnum_prop": 0.5473216763807938,
"repo_name": "glenn-edgar/local_controller_3",
"id": "11dd81c6dcfb4776a20fc549b8f387b09cff46d9"... |
import os
import json
from bs4 import BeautifulSoup
from flask import (abort, current_app, redirect, render_template, request,
url_for)
from models import SCHEMA
from rst import iteritems, get_hyperlink_target, rst_to_html_fragment
import search
from settings import INDEX, INDEX_PATH, SRC, BACKLINK... | {
"content_hash": "2809d357a3f523818b8acc0ea310537f",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 79,
"avg_line_length": 30.640449438202246,
"alnum_prop": 0.5775577557755776,
"repo_name": "Ceasar/Encyclopedia",
"id": "a49312abd5f2d4d2938a6a36381fe968fcfadf31",
"size": "... |
from http import HTTPStatus
import requests
from eth_utils import to_bytes, to_hex
from raiden.raiden_service import RaidenService
from raiden.storage.wal import WriteAheadLog
from raiden.transfer.mediated_transfer.events import SendSecretRequest
from raiden.transfer.mediated_transfer.state_change import ReceiveSecre... | {
"content_hash": "d088d498870a35e0a122fe973aa164fb",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 94,
"avg_line_length": 37.0625,
"alnum_prop": 0.7234401349072512,
"repo_name": "hackaugusto/raiden",
"id": "649953ab78fb37c33f128f645378bc560b913484",
"size": "1779",
"bi... |
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename('background05.xlsx')
def test_create_fil... | {
"content_hash": "f0e1072a5b748eaf3c492608982306ae",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 26.214285714285715,
"alnum_prop": 0.6743869209809265,
"repo_name": "jmcnamara/XlsxWriter",
"id": "0d835b4cc329bedc4e78e57e6e75c6af5c9e8a15",
"size": ... |
'''
Rackspace Cloud Module
======================
The Rackspace cloud module. This module uses the preferred means to set up a
libcloud based cloud module and should be used as the general template for
setting up additional libcloud based modules.
The rackspace cloud module interfaces with the Rackspace public cloud ... | {
"content_hash": "21e92c11d5a182f33eaa18666a4fe205",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 85,
"avg_line_length": 32.67035398230089,
"alnum_prop": 0.5552244870318954,
"repo_name": "MadeiraCloud/salt",
"id": "aa4a61d2294100d58cf9bbbcea1f8421bcbaf40b",
"size": "14... |
import sling
import sys
sys.path.insert(0, "sling/nlp/parser/trainer")
import corpora
# Error checking options.
class Options:
def __init__(self):
self.stop_on_first_bad_document = False
self.allow_mentions_without_frames = False
self.allow_duplicate_evokes = False
self.allow_nil_roles = False
s... | {
"content_hash": "a37f864f08ff4889d6a21fae7941d7a5",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 80,
"avg_line_length": 36.13920454545455,
"alnum_prop": 0.6361921232607499,
"repo_name": "google/sling",
"id": "3e3571f308a4db19774d0ef3027d8525021e8b77",
"size": "13505",... |
"""
WSGI config for citizenline project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | {
"content_hash": "2f6262158b1661c8302183c6c8ff8741",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.9375,
"alnum_prop": 0.7744360902255639,
"repo_name": "citizenline/citizenline",
"id": "a4b9dfaf9b3ab527d71e163a3397032c6032c433",
"size": "399",
... |
import json
import DbLiason
from mpUtils import JobRunner
class Connectable:
def __init__(self, address=None, attrManifestDict=None):
self.__dbLiason = None
self.__address = address
self.__jobRunner = JobRunner.JobRunner()
self.__attrManifestDict = attrManifestDict if isinstance(at... | {
"content_hash": "66169a1c7b9800551b5b58bac48585c9",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 112,
"avg_line_length": 40.32142857142857,
"alnum_prop": 0.6767050487156776,
"repo_name": "odeke-em/utils",
"id": "ea0ec68204ab7cd7dfe93254ba7eb70814600c10",
"size": "4585... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: azure_rm_image
version_added: "2.5"
short_description: Mana... | {
"content_hash": "0f2157d3c2b815dea8b3cca429bbe11c",
"timestamp": "",
"source": "github",
"line_count": 363,
"max_line_length": 147,
"avg_line_length": 39.30027548209367,
"alnum_prop": 0.5666619935511005,
"repo_name": "SergeyCherepanov/ansible",
"id": "b5dff335e47f160756ab8cf7b141d85ffe607500",
"si... |
from django.contrib import admin
from .models import *
class EventAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'open_date', 'close_date')
class AccommodationAdmin(admin.ModelAdmin):
list_display = ('id', 'event', '__str__', 'capacity')
list_filter = ('event',)
class ClassFeeAdmin(admin.ModelAdmin):
l... | {
"content_hash": "1492c18b97df6b84b4050b38867f2f19",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 62,
"avg_line_length": 30.147058823529413,
"alnum_prop": 0.72,
"repo_name": "peterkuma/tjrapid",
"id": "635390ac432d441c3a311952df9f7bdc4b159807",
"size": "1089",
"binary... |
from dynet import *
import time
import random
LAYERS = 2
INPUT_DIM = 256 #50 #256
HIDDEN_DIM = 256 # 50 #1024
VOCAB_SIZE = 0
from collections import defaultdict
from itertools import count
import sys
import util
class RNNLanguageModel:
def __init__(self, model, LAYERS, INPUT_DIM, HIDDEN_DIM, VOCAB_SIZE, builde... | {
"content_hash": "bb3a563e41267185b2d9b81e582b5e1f",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 102,
"avg_line_length": 31.504761904761907,
"alnum_prop": 0.530229746070133,
"repo_name": "kamigaito/cnn",
"id": "eb190be5f45ea88eeec2fb5a42d7595091ea2f8c",
"size": "3308"... |
from collections import defaultdict
from util import *
import re,sys
from optparse import OptionParser
#from DependencyGraph import *
# Error definitions
class LexerError(Exception):
pass
class ParserError(Exception):
pass
class Node():
#node_id = 0 #static counter, unique for each node
#mapping_... | {
"content_hash": "4f3744002d4084de1e532f420463c1c1",
"timestamp": "",
"source": "github",
"line_count": 826,
"max_line_length": 330,
"avg_line_length": 41.705811138014525,
"alnum_prop": 0.48889662980057474,
"repo_name": "masterkeywikz/seq2graph",
"id": "a9c8428c156d12e8f63cb143c7a4232da5437fa9",
"s... |
import logging
from time import sleep
from typing import List
from django.conf import settings
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, \
InputMediaPhoto, InputMediaVideo, TelegramError
from memes_reposter.telegram_bot import bot
from .models import ImgurConfig, Media, Post
logger = logg... | {
"content_hash": "2e9036a602f242b2af2d5f2b67f67466",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 80,
"avg_line_length": 30.16822429906542,
"alnum_prop": 0.6496282527881041,
"repo_name": "vaniakosmos/memes-reposter",
"id": "785a3f6f076a0976641b4681d4fa926f9209ce05",
"s... |
import re
def filter_objlist(olist, fieldname, fieldval):
"""
Returns a list with of the objects in olist that have a fieldname valued as fieldval
Parameters
----------
olist: list of objects
fieldname: string
fieldval: anything
Returns
-------
list of objets
"""
re... | {
"content_hash": "222d3532d2ec699c306104abaa9543ba",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 91,
"avg_line_length": 20.04597701149425,
"alnum_prop": 0.5726299694189603,
"repo_name": "Neurita/boyle",
"id": "798e060ad8d9e92faef5584ffed72e69edafd711",
"size": "5635",... |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.uic import *
import os
class ConnectorsInfoWnd(QDialog):
def __init__(self, treeModel, genus):
super(ConnectorsInfoWnd, self).__init__()
self.genus = genus
self.treeModel = treeModel
dirname, filename = os.path.sp... | {
"content_hash": "fa7cac093b9fba95bbfbaa1622637761",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 87,
"avg_line_length": 33.09375,
"alnum_prop": 0.5916902738432483,
"repo_name": "go2net/PythonBlocks",
"id": "2605900e400651a7dafc92f44c5f2c94fe672508",
"size": "5295",
... |
from base_model import WsModel
class ThemePackage(WsModel):
""" ThemePackage groups theme elements together for packaging and distribution"""
_modfields = [{"name":"name","type":"text"},
{"name":"themes","type":"selectmulti","list":"Theme","list_val":"key","list_name":"name"}]
name = WsModel.db.StringP... | {
"content_hash": "093363a1e664f413203978134d341357",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 109,
"avg_line_length": 39.63157894736842,
"alnum_prop": 0.650066401062417,
"repo_name": "webspinner/webspinner-gae-cms",
"id": "cc376bb63dfec90bc776d87e6d9b0f3cdcc314bd",
... |
import numpy as np
def print_test(network, testset, cost_function):
assert testset[0].features.shape[0] == network.n_inputs, \
"ERROR: input size varies from the defined input setting"
assert testset[0].targets.shape[0] == network.layers[-1][0], \
"ERROR: output size varies from the defined ou... | {
"content_hash": "a53f1c2e2bce941d45686522a3716fd9",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 81,
"avg_line_length": 28.803571428571427,
"alnum_prop": 0.6100433973961562,
"repo_name": "DailyActie/Surrogate-Model",
"id": "9f00b836635c310655d4e3c0dfe7d89ce3b48469",
"s... |
""""
Most Popular Collaborative Filtering Recommender
[Rating Prediction]
Most Popular predicts ratings for unobserved items for each user based on popularity of user and items.
"""
# © 2019. Case Recommender (MIT License)
from caserec.recommenders.rating_prediction.base_rating_prediction import BaseRat... | {
"content_hash": "87cd3d4a8364961a51348e82e46e0516",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 110,
"avg_line_length": 34.80869565217391,
"alnum_prop": 0.6025480889333,
"repo_name": "ArthurFortes/CaseRecommender",
"id": "41aa133f75904cba8ddbd32d69c116c00097245e",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.