text stringlengths 4 1.02M | meta dict |
|---|---|
from django.conf import settings
from django.db import models
from django.contrib.auth.models import User
class Request(models.Model):
STATE_WAITING = "waiting"
STATE_IN_PROGRESS = "in-progress"
STATE_HOLD = "hold"
STATE_REJECTED = "rejected"
STATE_FINISHED = "finished"
STATES = (
(S... | {
"content_hash": "555c8339e754b32d43e4896a59b7be43",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 75,
"avg_line_length": 30.55263157894737,
"alnum_prop": 0.661498708010336,
"repo_name": "dotwaffle/pinder",
"id": "7fb97280595eb749f77d829db1465a6d84914deb",
"size": "1161"... |
import unittest
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from s3query import s3open
class TestS3Query(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def _test_iterate(self, s3_loc, output_lines):
ref_lines = iter(o... | {
"content_hash": "92d76e41a642a071ab23f658b28333e6",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 76,
"avg_line_length": 32.645161290322584,
"alnum_prop": 0.558300395256917,
"repo_name": "realstraw/s3query",
"id": "1f1b520071d3dd9709dd0ecf8634a16c028fc8c4",
"size": "303... |
import spacy
nlp = spacy.load('en_core_web_sm')
| {
"content_hash": "33dd64b617e08d221b9d02a911a60a27",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 34,
"avg_line_length": 16.333333333333332,
"alnum_prop": 0.6938775510204082,
"repo_name": "seakers/daphne_brain",
"id": "6ca121b8332469a92f920debe6151cc578f3e2b8",
"size": "... |
from __future__ import absolute_import
from .schema import (
SchemaOpts,
ModelSchema,
)
from .convert import (
ModelConverter,
fields_for_model,
property2field,
column2field,
field_for,
)
from .exceptions import ModelConversionError
__version__ = '0.3.0'
__license__ = 'MIT'
__all__ = [
... | {
"content_hash": "ba18067b105a07fa5d9a5bddafdd6c28",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 44,
"avg_line_length": 16.93103448275862,
"alnum_prop": 0.6354378818737271,
"repo_name": "dpwrussell/marshmallow-sqlalchemy",
"id": "15197d03a2071c06c2948d826e6c84d3ac1517de"... |
import numpy as np
import os, sys, time
from commons.utils import logger
from commons import utils
from commons import evaluator
from commons import dataloader
# parameter config area
para = {'dataPath': '../data/',
'dataName': 'dataset#2',
'dataType': 'tp', # set the dataType as 'rt' or 'tp'
... | {
"content_hash": "610d5282c88f5dcf64d018519d9384c7",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 104,
"avg_line_length": 40.5,
"alnum_prop": 0.6313932980599647,
"repo_name": "wsdream/AMF",
"id": "ca5643c0d894684901b6a39d723d3c8f36f2a2ec",
"size": "1972",
"binary": fa... |
from serpent.input_controller import InputController
from serpent.utilities import SerpentError
import itertools
class GameAPI:
instance = None
def __init__(self, game=None):
self.game = game
if not self.game.is_launched:
self.game.launch(dry_run=True)
self.input_contr... | {
"content_hash": "b120da782aa1fb13c2e1f648a37faba3",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 115,
"avg_line_length": 31.84931506849315,
"alnum_prop": 0.589247311827957,
"repo_name": "SerpentAI/SerpentAI",
"id": "0e39ae64a14febe753a39776624623a5b6fda0da",
"size": "2... |
import json
class Mappable(object):
"""Dummy iface for plain object extraction"""
__slots__ = ()
def to_map(self):
"""
:return:
:rtype: dict of (str, str)
"""
result = {}
for key in self.__slots__:
field = getattr(self, key)
if isin... | {
"content_hash": "9bb20300f071458ea3e7823a79dd0c59",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 56,
"avg_line_length": 21.97087378640777,
"alnum_prop": 0.5311533362792753,
"repo_name": "vt-dev/sdk",
"id": "753ca8a9fed6110f2e81c569a3f87790e1a1c2ce",
"size": "2263",
... |
import json
import logging
import os
from yoconfigurator.base import get_config_module
from yoconfigurator.dicts import DotDict, MissingValue
log = logging.getLogger(__name__)
class LenientJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, MissingValue):
return '### M... | {
"content_hash": "ac75d79997527ce90d7b137f50330a12",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 76,
"avg_line_length": 34.11904761904762,
"alnum_prop": 0.5792044661549197,
"repo_name": "yola/yoconfigurator",
"id": "58af306ed7af172e8cc8b77a5530e67aec3fff64",
"size": "2... |
''' A plot showing the daylight hours in a city's local time (which are
discontinuous due to summer time) using the ``Patch`` and ``Line`` plot
elements to draw custom outlines and fills.
.. bokeh-example-metadata::
:sampledata: daylight
:apis: bokeh.models.glyphs.Line, bokeh.models.glyphs.Patch, bokeh.models.... | {
"content_hash": "cd4c635513987d903dddfb58d54c1d80",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 131,
"avg_line_length": 32.7027027027027,
"alnum_prop": 0.6994490358126721,
"repo_name": "bokeh/bokeh",
"id": "385991e38948c79d99b01c357ad926e6542cba67",
"size": "3630",
... |
'''
The base41 encoding scheme encodes pairs of bytes to three ASCII chars.
A single trailing byte is encoded to either a single ASCII char or to two
ASCII chars depending on its byte value.
The chars are all safe to use in filenames, pathnames, URIs, etc
This gives it an advantage over base64 which uses '/' as one of... | {
"content_hash": "fd1c859d18170b26fc4e1502591085ba",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 78,
"avg_line_length": 33.26431718061674,
"alnum_prop": 0.6013773010197325,
"repo_name": "JazzyServices/jazzy",
"id": "4229c1246eb04c2fdf3c0dd506cbf6bb4bba83d1",
"size": "... |
from django.shortcuts import render
from pupa.models import RunPlan
from opencivicdata.core.models import (Jurisdiction, Person, Organization,
Membership, PersonName, Post)
from opencivicdata.legislative.models import (Bill, VoteEvent, BillSponsorship,
... | {
"content_hash": "7471e02963fdf92f741ec78aa77d3866",
"timestamp": "",
"source": "github",
"line_count": 680,
"max_line_length": 79,
"avg_line_length": 42.88529411764706,
"alnum_prop": 0.5582264590905973,
"repo_name": "hiteshgarg14/admintools",
"id": "88b5dc30aa41dcd7e36e00624c1eab88152896b8",
"size... |
"""
WebDAV expand-property report
"""
__all__ = ["report_DAV__expand_property"]
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.python.failure import Failure
from twext.python.log import Logger
from txweb2 import responsecode
from txdav.xml import element
from txdav.xml.element import da... | {
"content_hash": "f78c7dd113e8deabdcd1a1880bccd192",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 127,
"avg_line_length": 40.20779220779221,
"alnum_prop": 0.6059431524547804,
"repo_name": "red-hood/calendarserver",
"id": "f38eb5e383cefa7db9162ceccf471027dd378425",
"siz... |
from django.conf.urls import url
from apps.wordtrack.views import WordTrackView
urlpatterns = [
url(r'^$', WordTrackView.as_view(), name='home'),
]
| {
"content_hash": "c245175d8146562252c42cabbda0893f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 53,
"avg_line_length": 25.5,
"alnum_prop": 0.7189542483660131,
"repo_name": "husman/WoTrack",
"id": "7ff1a46880d2bd82e90ca6b7f4bdd850c631722d",
"size": "153",
"binary": fa... |
import datetime
import pytest
from anchore_engine.subsys import logger, simplequeue
from anchore_engine.subsys.logger import enable_test_logging
enable_test_logging()
singleton_queue = "testq1"
multi_queue = "testq2"
std_queue = "testq3"
@pytest.fixture
def test_qs(anchore_db):
"""
Expects to initialize t... | {
"content_hash": "22e1c49c8e048780311028cc30e7dd08",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 115,
"avg_line_length": 33.503649635036496,
"alnum_prop": 0.642483660130719,
"repo_name": "anchore/anchore-engine",
"id": "7b09b2780a330651d867d59ef80f90b115907e5a",
"size... |
"""
stats.py module
(Requires pstat.py module.)
#################################################
####### Written by: Gary Strangman ###########
####### Last modified: Dec 18, 2007 ###########
#################################################
A collection of basic statistical functions for python. The function... | {
"content_hash": "86f7a52fb266bb30b00ca468cfb0074b",
"timestamp": "",
"source": "github",
"line_count": 4497,
"max_line_length": 177,
"avg_line_length": 34.68957082499444,
"alnum_prop": 0.5941320136667543,
"repo_name": "sniemi/SamPy",
"id": "2481dc678a6f8be88a2071b86e2f499cf79a9f23",
"size": "15708... |
import os
import tempfile
import psycopg2
import json
from hashlib import md5
from copy import deepcopy
from collections import defaultdict
from wextractor.loaders.loader import Loader
class PostgresLoader(Loader):
def __init__(self, connection_params, schema=None):
super(PostgresLoader, self).__init__(c... | {
"content_hash": "89e5f3486fb125361c999f394165043d",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 119,
"avg_line_length": 36.40922190201729,
"alnum_prop": 0.550023745448789,
"repo_name": "codeforamerica/w-drive-extractor",
"id": "8fd7ec1209396c20586695138d3481d40a0b720f"... |
import logging
import logging.config
import os
class NodepoolApp(object):
def __init__(self):
self.args = None
def setup_logging(self):
if self.args.logconfig:
fp = os.path.expanduser(self.args.logconfig)
if not os.path.exists(fp):
raise Exception("Una... | {
"content_hash": "a7285d3e348b06f65df18db59e8ee30d",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 31.954545454545453,
"alnum_prop": 0.519203413940256,
"repo_name": "seandst/nodepool",
"id": "b19a4b9c77e42f88655af3a7689ae2ca1f00a6b9",
"size": "1370... |
"""Utilities for the Nexmark suite.
The Nexmark suite is a series of queries (streaming pipelines) performed
on a simulation of auction events. This util includes:
- A Command class used to terminate the streaming jobs
launched in nexmark_launcher.py by the DirectRunner.
- A ParseEventFn DoFn to parse events ... | {
"content_hash": "e6bcd87dc1b31712a7e0a6baf5c9d03a",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 79,
"avg_line_length": 27.725274725274726,
"alnum_prop": 0.6492271105826397,
"repo_name": "iemejia/incubator-beam",
"id": "9079596a1a2ae7ce9f0caf52e78897f9a7c8fb4f",
"size"... |
DOCUMENTATION = '''
---
module: maas_boot_resources
short_description: Manage MAAS boot resources
options:
maas:
description:
- URL of MAAS server
default: http://localhost/MAAS/api/1.0/
key:
description:
- MAAS API key
required: yes
state:
description:
- possible states for ... | {
"content_hash": "39c187770160f64fbc916e420fea1c80",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 81,
"avg_line_length": 26.09009009009009,
"alnum_prop": 0.6104972375690608,
"repo_name": "opencord/maas",
"id": "4abec69577f9fc683c5c092e6dd396719960f109",
"size": "3511",... |
"""
Mercadopago API exceptions.
"""
class NoAccessTokenError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class UndefinedResponseError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
... | {
"content_hash": "22494d05de4a2d5fc33d4fabffc14dfa",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 44,
"avg_line_length": 17.526315789473685,
"alnum_prop": 0.6051051051051051,
"repo_name": "angvp/pymercadopago",
"id": "7811c90c08ac7af7df13ccc821bd51779eb42743",
"size": "... |
"""check for new / old style related problems
"""
from logilab import astng
from pylint.interfaces import IASTNGChecker
from pylint.checkers import BaseChecker
MSGS = {
'E1001': ('Use __slots__ on an old style class',
'Used when an old style class use the __slots__ attribute.'),
'E1002': ('Use ... | {
"content_hash": "3e1bae3048a9fbac3cd85a79ca9fd3d4",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 79,
"avg_line_length": 37.83695652173913,
"alnum_prop": 0.5360528583740305,
"repo_name": "dbbhattacharya/kitsune",
"id": "16d17c0ffd9dfc950d1e1a8e2f55d48c52b31336",
"size":... |
"""
Support for Buienradar.nl weather service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.buienradar/
"""
import asyncio
from datetime import datetime, timedelta
import logging
import async_timeout
import aiohttp
import voluptuous as vol
imp... | {
"content_hash": "9fe5d2db563825a8ca8d8f4aca52a1ae",
"timestamp": "",
"source": "github",
"line_count": 572,
"max_line_length": 79,
"avg_line_length": 39.30769230769231,
"alnum_prop": 0.5828144458281445,
"repo_name": "persandstrom/home-assistant",
"id": "c7ca0c097ffd7c299777fd453cdc932e588dadbd",
"... |
"""
Exception definitions.
"""
from manilaclient.openstack.common.apiclient.exceptions import * # noqa
class NoTokenLookupException(ClientException):
"""No support for looking up endpoints.
This form of authentication does not support looking up
endpoints from an existing token.
"""
pass
clas... | {
"content_hash": "6d8cc30a7da7941227d08f613d3eb716",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 79,
"avg_line_length": 25.76,
"alnum_prop": 0.6785714285714286,
"repo_name": "sniperganso/python-manilaclient",
"id": "4b405821849bdf3f199c6fa78a99500d313d16fa",
"size": "1... |
from __future__ import absolute_import
import linecache
import tokenize
from functools import partial
from os.path import basename
from os.path import exists
from os.path import splitext
from threading import current_thread
from .const import SITE_PACKAGES_PATHS
from .const import SYS_PREFIX_PATHS
from .util import C... | {
"content_hash": "31887d007a5f0acfbbfd83b0340b19a8",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 119,
"avg_line_length": 31.564102564102566,
"alnum_prop": 0.5456945572705117,
"repo_name": "ionelmc/python-hunter",
"id": "939d8c7bacd712a5c508812adef400517cecdb0d",
"size... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stein', '0018_remove_mineraltype_classification1'),
]
operations = [
migrations.AlterField(
model_name='mineraltype',
name='other',
field=models.TextFiel... | {
"content_hash": "95cfad82564de065230e55120c066267",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 87,
"avg_line_length": 24.5,
"alnum_prop": 0.6071428571428571,
"repo_name": "GeoMatDigital/django-geomat",
"id": "33465adafecf79e3a8c6391bc0249a5d337cb5e6",
"size": "467",
... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General conf... | {
"content_hash": "ceef82a8e7b187ca4308a9f36364215c",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 80,
"avg_line_length": 32.44607843137255,
"alnum_prop": 0.706904366218462,
"repo_name": "almost/django-pipeline",
"id": "1270f02a2ab1b689e12473c029a9d05caa2777fa",
"size":... |
import sys
import os
import codecs
import pygettext
MESSAGES = []
def detect_unicode_encoding(bytes):
encodings_map = [
(3, codecs.BOM_UTF8, 'UTF-8'),
(4, codecs.BOM_UTF32_LE, 'UTF-32LE'),
(4, codecs.BOM_UTF32_BE, 'UTF-32BE'),
(2, codecs.BOM_UTF16_LE, 'UTF-16LE'),
(2, codec... | {
"content_hash": "27e20e997e35fcbb2e2b24c72b0dc8f1",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 78,
"avg_line_length": 24.68979591836735,
"alnum_prop": 0.5088444370970409,
"repo_name": "dbrattli/python-gearshift",
"id": "c6c8f3813d522bbc2a896ca2f663b84baea868e9",
"si... |
import copy
import feedparser
import pendulum
import testfixtures
import unittest
from box import Box
from hashlib import md5
from unittest.mock import AsyncMock, MagicMock, patch
from rssalertbot.config import Config
from rssalertbot.feed import Feed
from rssalertbot.storage import BaseStorage
group = Box({
... | {
"content_hash": "add257d503d02db89ff7720287a6b34e",
"timestamp": "",
"source": "github",
"line_count": 381,
"max_line_length": 104,
"avg_line_length": 37.31496062992126,
"alnum_prop": 0.5754378560877822,
"repo_name": "jwplayer/rssalertbot",
"id": "13a93899efb2dfc29086cbdcf7bf045e9215182e",
"size":... |
import sys, getopt, requests, json
def printusertext(p_message):
#prints a line of text that is meant for the user to read
#do not process these lines when chaining scripts
print('@ %s' % p_message)
def printhelp():
#prints help text
printusertext("This is a script that prints a list of an organizat... | {
"content_hash": "f7a2d0984d2c1bcae998f9fd5d22c0b8",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 170,
"avg_line_length": 30.844444444444445,
"alnum_prop": 0.6431916426512968,
"repo_name": "meraki/automation-scripts",
"id": "536ea7f5a1a7cfc075faf2e46d6d7e3e24e616a4",
"... |
import unittest
from scripts.migrate_to_whatsapp_templates.prebirth3 import Prebirth3Migration
class Testprebirth3(unittest.TestCase):
def setUp(self):
self.prebirth3 = Prebirth3Migration()
def test_sequence_number_to_weeks(self):
"""
Given a certain sequence number for the prebirth ... | {
"content_hash": "194629cc8817e128cfa1af9cdb4b1bf7",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 88,
"avg_line_length": 37.354838709677416,
"alnum_prop": 0.6260794473229706,
"repo_name": "praekeltfoundation/ndoh-hub",
"id": "bdc451481f1a8c8cc9ac9464d916c01dfd163e77",
"... |
from . import QtWidgets, QtWebEngineWidgets
from ..config import get_user_or_default_config_path
from pygments import highlight
from pygments.lexers import HtmlLexer
from pygments.formatters import HtmlFormatter
import lxml.html
import lxml.etree
class SourceDialog(QtWidgets.QDialog):
'''Dialog displaying HTML... | {
"content_hash": "b8ce4e5c240ecca57a3dc64d7929bc3b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 34.1578947368421,
"alnum_prop": 0.662557781201849,
"repo_name": "janpipek/hlava",
"id": "a058d7d003fac3233004d4585c01f51ab2218675",
"size": "1298",
... |
"""
Olaf
~~~~~~~~~~~~~
command line tool to help you manage multiple requirements files.
"""
from __future__ import absolute_import
import glob
import click
import subprocess
import collections
@click.command()
@click.option('--prefix', '-p', default='requirements',
help='Match files on {pr... | {
"content_hash": "63e4565bd2ff4ae1803396af6cac88fb",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 92,
"avg_line_length": 30.385159010600706,
"alnum_prop": 0.502965461100128,
"repo_name": "hactar-is/olaf",
"id": "1e293d8a25ca88a374e71f4361432fccc8b88716",
"size": "8624"... |
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# good to go!
def main():
# The collection URL below.
collURL = 'http://www.thelatinlibrary.com/eucherius.html'
collOpen = urllib.request.urlopen(collURL)
co... | {
"content_hash": "fd431bd286b46c90cc9b161d47323655",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 110,
"avg_line_length": 36.38636363636363,
"alnum_prop": 0.4540911930043723,
"repo_name": "oudalab/phyllo",
"id": "95e6c595edfecb52036619172e312dfdc83b8831",
"size": "3202"... |
"""
Basic Encoding Rules (BER) for ASN.1
"""
from scapy.error import warning
from scapy.utils import inet_aton,inet_ntoa
from asn1 import ASN1_Decoding_Error,ASN1_Encoding_Error,ASN1_BadTag_Decoding_Error,ASN1_Codecs,ASN1_Class_UNIVERSAL,ASN1_Error,ASN1_DECODING_ERROR,ASN1_BADTAG
##################
## BER encoding ##... | {
"content_hash": "4d540c26f4895adc0584e4ec5174fb7d",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 159,
"avg_line_length": 30.63711911357341,
"alnum_prop": 0.550994575045208,
"repo_name": "lthurlow/python-tcpsnoop",
"id": "622cb4966c44448929cebed35d88b338b32f95f9",
"siz... |
from __future__ import unicode_literals
from django.db import models, migrations
from corehq.sql_db.operations import HqRunPython
def do_not_email_migration(apps, schema_editor):
Subscription = apps.get_model("accounting", "Subscription")
Subscription.objects.filter(do_not_email_invoice=True).update(do_not_e... | {
"content_hash": "6a03dec22911e7069fe1eb0cc5e12ed4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 93,
"avg_line_length": 31.2,
"alnum_prop": 0.6442307692307693,
"repo_name": "qedsoftware/commcare-hq",
"id": "b6dd5188b4791df4bd1dcade00041b6fba0aa262",
"size": "960",
"b... |
"""pudl setup"""
from setuptools import setup, find_packages
execfile('pudl/version.py')
setup(name='pudl',
version=__version__,
description="""pudl is an Active Directory client library and CLI""",
author='zulily, llc',
author_email='[email protected]',
packages=find_packages(),
... | {
"content_hash": "c9714597c4ff3e8293189d71e084028f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 90,
"avg_line_length": 33.114285714285714,
"alnum_prop": 0.5789473684210527,
"repo_name": "zulily/pudl",
"id": "0d823f56127916665227d24c180bfe686d7b5b5a",
"size": "1759",
... |
class Country(object):
def __init__(self, name, code):
self.name = name
self.code = code | {
"content_hash": "1ed228465c49f348b8d2780ac6ea2044",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 35,
"avg_line_length": 21.8,
"alnum_prop": 0.5596330275229358,
"repo_name": "M4gn4tor/mastercard-api-python",
"id": "9bbebf006dc1412a78c3b8208e735e5edb76167b",
"size": "109"... |
from pycompss.api.task import task
from pycompss.api.constraint import constraint
from storage.storage_object import StorageObject
from pycompss.api.parameter import *
class TNet(StorageObject):
def __init__(self):
super(TNet, self).__init__()
def main_extract_features(self, bs, image_paths, pooled, ... | {
"content_hash": "0b9b40278176d6d3578d7c51e162a803",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 30.772727272727273,
"alnum_prop": 0.6617429837518464,
"repo_name": "mF2C/COMPSs",
"id": "dc32c0e702fdd88db664f228dea2b39ae0766353",
"size": "677",
... |
import torch
from ..builder import BBOX_ASSIGNERS
from ..iou_calculators import build_iou_calculator
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
@BBOX_ASSIGNERS.register_module()
class GridAssigner(BaseAssigner):
"""Assign a corresponding gt bbox or background to each bbox.
... | {
"content_hash": "b1c2602291ce379daf5d1d8c6323304b",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 79,
"avg_line_length": 43.96774193548387,
"alnum_prop": 0.5801907556859868,
"repo_name": "open-mmlab/mmdetection",
"id": "a0c814e782ebc79600cae4ca4e66b4ebaf47c81e",
"size"... |
"""Bitmap font generator.
This will generate a bitmap font from input font files. This uses the
Python FreeType module (freetype-py). Rather than using config files,
this should be called directly from Python code.
"""
import collections
import freetype
import json
import numpy
import PIL.Image
from . import rectpac... | {
"content_hash": "23f60ca7143ee460844072d93f71232c",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 36.38059701492537,
"alnum_prop": 0.5142564102564102,
"repo_name": "depp/shifter-children",
"id": "e4c6c47ad19b5415d041dfbd0146ef9b8dc5807d",
"size":... |
from __future__ import unicode_literals
import random
from django.utils.encoding import python_2_unicode_compatible
from django.utils import six
from django.utils.six.moves import range
from django.db import models
@python_2_unicode_compatible
class Office(models.Model):
office = models.CharField('office', max_... | {
"content_hash": "c0693ccc0c10fd5a3ba871347839b0b7",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 69,
"avg_line_length": 27.05,
"alnum_prop": 0.5856438693776956,
"repo_name": "mtrgroup/django-mtr-sync",
"id": "638ea97d1d43199fa134cbef7caf2763a83ab379",
"size": "3264",
... |
"""
Logistic Regression classifier satisfying differential privacy.
"""
import numbers
import warnings
import numpy as np
from joblib import delayed, Parallel
from scipy import optimize
from sklearn.exceptions import ConvergenceWarning
from sklearn import linear_model
from sklearn.utils import check_array, check_consi... | {
"content_hash": "8d21029845be1ca266f9883603f4735d",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 120,
"avg_line_length": 43.03713527851459,
"alnum_prop": 0.6496764252696456,
"repo_name": "IBM/differential-privacy-library",
"id": "a775e50d9e20b0d076f9633006126ff7bacca159... |
import tensortools as tt
import numpy as np
# Make synthetic dataset.
I, J, K, R = 25, 25, 25, 4 # dimensions and rank
X = tt.randn_ktensor((I, J, K), rank=R).full()
X += np.random.randn(I, J, K)
# Fit CP tensor decomposition to first 20 trials.
U = tt.cp_als(X[:, :, :20], rank=R, verbose=True)
# Extend and re-init... | {
"content_hash": "59b0edb6cd3976310a4350a8faebefe4",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.6700507614213198,
"repo_name": "ahwillia/tensortools",
"id": "289239bd226828b0c637821dbdb94680452bd4be",
"size": ... |
from lib.PerfKit import PerfKit
from lib.Rally import Rally
from lib.Shaker import Shaker
from lib.WorkloadBase import WorkloadBase
import argparse
import logging
import sys
import yaml
import datetime
import os
from pykwalify import core as pykwalify_core
from pykwalify import errors as pykwalify_errors
_workload_opt... | {
"content_hash": "58ae92dea593796090b6c48e72818c62",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 100,
"avg_line_length": 37.886178861788615,
"alnum_prop": 0.6248927038626609,
"repo_name": "jtaleric/browbeat",
"id": "4edf0edc4318bd833187bb6c979347b48ae2b476",
"size": "... |
import datetime
import json
import random
import string
import webob
import webob.dec
from paste import urlmap
from glance import client as glance_client
from nova import auth
from nova import context
from nova import exception as exc
from nova import flags
from nova import utils
import nova.api.openstack.auth
from ... | {
"content_hash": "81d9472015f32020219babca3c279d31",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 75,
"avg_line_length": 27.467248908296945,
"alnum_prop": 0.6413354531001589,
"repo_name": "anotherjesse/nova",
"id": "fb282f1c97340c8e79b053216002ad637213d424",
"size": "6... |
from pbcore.io.FastaIO import FastaReader, FastaWriter
def fasta_count( fasta_file ):
count = 0
try:
for record in FastaReader( fasta_file ):
if len(record.sequence) > 0:
count += 1
except:
return 0
return count
def fasta_names( fasta_file ):
return set(... | {
"content_hash": "bcacdd7086b951d2a9c992db7412767d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 67,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.618801652892562,
"repo_name": "PacificBiosciences/rDnaTools",
"id": "0359652c5f8d9833b6848dc666dddc3e2b711580",
"... |
from pyglottolog.glottodata import GlottoData
db = GlottoData()
print len(db.GetLanguages())
print db.GetLanguages()[:10]
| {
"content_hash": "98a5312378f5a0a4d3704898e42d2014",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 45,
"avg_line_length": 24.6,
"alnum_prop": 0.7804878048780488,
"repo_name": "sarum90/glottodatagrab",
"id": "a7406d4cadb89529e297da532413d505ee8fb5f3",
"size": "124",
"bin... |
import FBConnect
import sys, traceback
class FBConnectIface:
friendsList = None
uid = None
fbconn = None
def __init__(self, randomToken):
try:
self.db_filename = 'C:/Stuffs/www/db.sqlite'
self.fbconn = FBConnect.FBConnect(self.db_... | {
"content_hash": "723d13ccc66c6c90f2b82b48ab97e468",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 109,
"avg_line_length": 30.466666666666665,
"alnum_prop": 0.5331874544128373,
"repo_name": "NareshPS/pyDCHub",
"id": "40b515b0dbe5b4ee76c41a207b39988c57b94f25",
"size": "13... |
"""
This module defines an :py:class:`aiohttp.ClientSession` adapter
that returns awaitable responses.
"""
# Standard library imports
import asyncio
import collections
import inspect
import threading
from concurrent import futures
# Third-party imports
try:
import aiohttp
except ImportError: # pragma: no cover
... | {
"content_hash": "780b5d7c9a1d87e3bc1733d53b0d0ecc",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 77,
"avg_line_length": 33.1207729468599,
"alnum_prop": 0.6474620770128354,
"repo_name": "prkumar/uplink",
"id": "4d3a3f362caef6ab8445e3294f5b6efb61d8f94a",
"size": "6856",... |
from collections import namedtuple
from unittest import mock
import pytest
from sklearn import datasets
import sklearn.neighbors as knn
import mlflow
import random
from mlflow import MlflowClient
from mlflow.entities.model_registry import ModelVersion
from mlflow.models import add_libraries_to_model
from mlflow.model... | {
"content_hash": "bdb2efe4b78055fe1fa87a248e1fa6db",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 99,
"avg_line_length": 36.39877300613497,
"alnum_prop": 0.674869374683971,
"repo_name": "mlflow/mlflow",
"id": "083bdf773fa632f1b5759b515196a2d7ac0a5459",
"size": "5933",
... |
from __future__ import with_statement
import logging
import traceback
import sys
from StringIO import StringIO
from django import forms
from django.forms.models import modelform_factory
from django.conf import settings
from django.shortcuts import render_to_response
from lxml import etree
from piston.handler import ... | {
"content_hash": "a398133cac7980555e72900d36cad253",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 138,
"avg_line_length": 34.20816326530612,
"alnum_prop": 0.5263095096050591,
"repo_name": "SanaMobile/middleware_mds_v1",
"id": "b8f1a01fbbe91ee4626e862ffaab8d75fa425b11",
... |
'''
onshape_api, based on onshape "apikey"
======
Demonstrates usage of API keys for the Onshape REST API
'''
__copyright__ = 'Copyright (c) 2016 Onshape, Inc.'
__license__ = 'All rights reserved.'
__title__ = 'onshape_api'
__all__ = ['onshape', 'client', 'utils']
| {
"content_hash": "2db19d70601bac798af7171300325ef0",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 55,
"avg_line_length": 24.272727272727273,
"alnum_prop": 0.6329588014981273,
"repo_name": "Rhoban/onshape-to-robot",
"id": "6d3966ec74eec53890e0f4257f2cd922cb37a1f1",
"size... |
import math
import sys
import pyopencl as cl
import numpy
from PIL import Image
from log import logCall
@logCall
def mergeImages(images, clContext, clQueue):
if not hasattr(mergeImages, "program"):
kernelFile = open('src/kernels/mergeImages.cl', 'r')
mergeImages.program = cl.Program(clContext, ke... | {
"content_hash": "a2e3468c18659aaf8b57f7740f1fa494",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 229,
"avg_line_length": 35.9,
"alnum_prop": 0.7047353760445683,
"repo_name": "hortont424/contrasty",
"id": "9fe193477a0ea3e4ebbf9f4d0fdafa638886d014",
"size": "1077",
"bi... |
from __future__ import unicode_literals, absolute_import
from django.dispatch import receiver
from django.db.models.signals import post_save
from ..models import Entry
@receiver(post_save, sender=Entry)
def on_entry_created(sender, instance, created, **kwargs):
if not created:
return
instance.send_... | {
"content_hash": "d530484e3fd08fc636f999630c35aec8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 58,
"avg_line_length": 23.571428571428573,
"alnum_prop": 0.7424242424242424,
"repo_name": "conikuvat/shoottikala",
"id": "1317d6e66e59de6e5e033d69a30cf9d212b716f1",
"size":... |
import urllib
from lxml import etree
from tempest.common import http
from tempest.common import rest_client
from tempest.common import xml_utils as common
from tempest import config
CONF = config.CONF
XMLNS = "http://docs.openstack.org/identity/api/v3"
class RegionClientXML(rest_client.RestClient):
TYPE = "xm... | {
"content_hash": "6a8f97c06572f234c097bed5d897a1f5",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 77,
"avg_line_length": 37.095238095238095,
"alnum_prop": 0.5427471116816431,
"repo_name": "Mirantis/tempest",
"id": "f854138bd5aedd46deb126a2e3f89f71c64048d1",
"size": "45... |
"""File operations for User authorization."""
from sqlalchemy import exists
from sqlalchemy.orm.exc import NoResultFound
from hydrus.data.exceptions import UserExists, UserNotFound
from hydrus.data.db_models import User, Token, Nonce
from hashlib import sha224
import base64
# import random
from sqlalchemy.orm.session ... | {
"content_hash": "4c24333f9d7b9a753a57bc53f8d65ed1",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 75,
"avg_line_length": 30.916666666666668,
"alnum_prop": 0.6439598137711345,
"repo_name": "xadahiya/hydrus",
"id": "bb2cf7b91c8b5310102a2c9d906f6026c0ad3145",
"size": "408... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('indicators', '0043_indicator_setup_remove_asterisks'),
]
operations = [
migrations.CreateModel(
name='ResultsIndicator',
fields=[
... | {
"content_hash": "0365e815830b42e1924477e5f231b0cc",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 64,
"avg_line_length": 21.47826086956522,
"alnum_prop": 0.5080971659919028,
"repo_name": "mercycorps/TolaActivity",
"id": "3377c69c1f2bbe6191bf475c5e5391acc8e47923",
"size"... |
from datetime import datetime
from django.core.exceptions import ValidationError
from django.core import mail
from django.core.mail import EmailMultiAlternatives
from django.core.urlresolvers import reverse
from django.template.defaultfilters import truncatewords, slugify
from django.template.loader import render_to_st... | {
"content_hash": "715236b690a9406188e4e8d3d7323d6d",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 77,
"avg_line_length": 32.87341772151899,
"alnum_prop": 0.6074316519060454,
"repo_name": "dominicrodger/tinyblog",
"id": "c8c2be54de7a43ce5c546c68bf68bc5500b2cf8c",
"size"... |
"""
Various asynchronous TCP/IP classes.
End users shouldn't use this module directly - use the reactor APIs instead.
Maintainer: Itamar Shtull-Trauring
"""
# System Imports
import os
import types
import socket
import sys
import operator
try:
import fcntl
except ImportError:
fcntl = None
from zope.interfac... | {
"content_hash": "e13f0c80ba7d9633eb5e34043103e3e1",
"timestamp": "",
"source": "github",
"line_count": 1029,
"max_line_length": 108,
"avg_line_length": 36.2798833819242,
"alnum_prop": 0.6018161362905818,
"repo_name": "hortonworks/hortonworks-sandbox",
"id": "40c578a3f49330ad1a9de73e150c78f96067bfef"... |
from .build import PROPOSAL_GENERATOR_REGISTRY, build_proposal_generator
from .rpn import RPN_HEAD_REGISTRY, build_rpn_head, RPN, StandardRPNHead
__all__ = list(globals().keys())
| {
"content_hash": "93e8c8a82bbd3bb439a0e3d4caa82cc9",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 45,
"alnum_prop": 0.7666666666666667,
"repo_name": "facebookresearch/detectron2",
"id": "3f4e4df7645c67b7a013295207b98fe70b2e574c",
"size": "231",
"... |
import datetime
import json
import logging
import os
from google.appengine.ext.deferred import deferred
from google.appengine.ext.webapp import template
from rogerthat.bizz import channel
from rogerthat.bizz.rtemail import generate_auto_login_url
from rogerthat.consts import NEWS_MATCHING_QUEUE
from rogerthat.dal.pro... | {
"content_hash": "5a3e0724a7057bcdb1f516540740671a",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 133,
"avg_line_length": 43.037974683544306,
"alnum_prop": 0.5790196078431372,
"repo_name": "our-city-app/oca-backend",
"id": "a753d36a4c79442e23e3035f9665382180dc80b4",
"s... |
from flask import (
Blueprint,
current_app,
jsonify,
request
)
from flask_jwt_extended import jwt_required
from app.dao.fees_dao import dao_create_fee, dao_get_fees, dao_update_fee, dao_get_fee_by_id
from app.errors import register_errors
from app.routes.fees.schemas import post_create_fee_schema, pos... | {
"content_hash": "e3c827d3041222007bb34bab085d7b0d",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 92,
"avg_line_length": 24.822580645161292,
"alnum_prop": 0.6900584795321637,
"repo_name": "NewAcropolis/api",
"id": "6b5912d02af13351113f8ab43897142437ef3391",
"size": "153... |
try:
os.remove('somefile.tmp')
except OSError:
pass
with ignored(OSError):
os.remove('somefile.tmp')
@contextmanager
def ignored(*exceptions):
try:
yield
except exceptions:
pass
| {
"content_hash": "e6665fbba5aed2bed990bc3d20db7af5",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 29,
"avg_line_length": 15.428571428571429,
"alnum_prop": 0.6388888888888888,
"repo_name": "klose911/klose911.github.io",
"id": "d9fd05b0b81e9dfffe41a9b6e3029095abce3d85",
"... |
import numpy as np
import pandas as pd
# Load the dataset
X = pd.read_csv('titanic_data.csv')
# Limit to numeric data
X = X._get_numeric_data()
# Separate the labels
y = X['Survived']
# Remove labels from the inputs, and age due to missing data
del X['Age'], X['Survived']
from sklearn.tree import DecisionTreeClassifi... | {
"content_hash": "b88001bf4cb877b971e926a0d7e526f9",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 85,
"avg_line_length": 27.91176470588235,
"alnum_prop": 0.7492096944151738,
"repo_name": "harish-garg/Machine-Learning",
"id": "a3fe35668e315a14c2508e3399502ac62af2ff8e",
"... |
"""
Dumps master config as JSON.
Uses master_cfg_utils.LoadConfig, which should be called at most once
in the same process. That's why this is a separate utility.
"""
import argparse
import json
import os
import sys
SCRIPTS_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir))
if not SCRIPTS... | {
"content_hash": "cdefc607241fff1e7a20f3e88053c71d",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 23.66,
"alnum_prop": 0.7016060862214708,
"repo_name": "eunchong/build",
"id": "54d4420087da971b8658f0223edf12aceedae1f2",
"size": "1368",
"binary":... |
from typing import List, Tuple
import os
import numpy as np
from pymorphy2 import MorphAnalyzer
from russian_tagsets import converters
from keras.layers import Input, Embedding, Dense, LSTM, BatchNormalization, Activation, \
concatenate, Bidirectional, TimeDistributed, Dropout
from keras.models import Model, model... | {
"content_hash": "992de1f338743e33f69053cb6786028e",
"timestamp": "",
"source": "github",
"line_count": 404,
"max_line_length": 117,
"avg_line_length": 47.87376237623762,
"alnum_prop": 0.6022956413835893,
"repo_name": "IlyaGusev/rnnmorph",
"id": "0079a23bcf22a929e2832ec8de626270a4bbc4a4",
"size": "... |
"""Contains a factory for building various models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
# from preprocessing import cifarnet_preprocessing
# from preprocessing import inception_preprocessing
# from preprocessing import... | {
"content_hash": "663f4b78c36ca2e2aa610b390129bdaf",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 81,
"avg_line_length": 33.06521739130435,
"alnum_prop": 0.6870479947403024,
"repo_name": "LevinJ/SSD_tensorflow_VOC",
"id": "869784d4296e82e77873dba757616981e6215909",
"siz... |
"""Autogenerated file, do not edit. Submit translations on Transifex."""
MESSAGES = {
"%d min remaining to read": "%d min demorantas de lectura",
"(active)": "(actiu)",
"Also available in:": "Tanben disponibla en :",
"Archive": "Archius",
"Atom feed": "Flux Atom",
"Authors": "Autors",
"Cate... | {
"content_hash": "713dbc57ff100594e2ad6f24bd99307d",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 72,
"avg_line_length": 39.8125,
"alnum_prop": 0.6227106227106227,
"repo_name": "getnikola/nikola",
"id": "a51a9f3ffde96c3891960b196558235e39f0645b",
"size": "1943",
"bina... |
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
... | {
"content_hash": "c1a2a93e66692bcb773ab42824383714",
"timestamp": "",
"source": "github",
"line_count": 1194,
"max_line_length": 267,
"avg_line_length": 46.29564489112228,
"alnum_prop": 0.6397054832932323,
"repo_name": "Azure/azure-sdk-for-python",
"id": "2ac5c095cd24898e9b445f04147e83ccaf4994d8",
... |
import hashlib
from utils.dict import mget
from sanetime import time
from django.db import models as djmodels
class Event(object):
@property
def hub(self): return self.account.hub
@property
def starts_at(self): return self._starts_at or self._started_at
@starts_at.setter
def starts_at(self, ... | {
"content_hash": "297f7945fe34fcc006f320d445379631",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 125,
"avg_line_length": 35.56481481481482,
"alnum_prop": 0.6258786774277532,
"repo_name": "prior/webinars",
"id": "446246b5b968cfdb8e537c394f13c8db283e2713",
"size": "3841... |
from __future__ import absolute_import
import hashlib
from google.appengine.ext import ndb
import model
import util
import config
class User(model.Base):
name = ndb.StringProperty(required=True)
username = ndb.StringProperty(required=True)
email = ndb.StringProperty(default='')
auth_ids = ndb.StringPropert... | {
"content_hash": "1aa0758672dd0bf5301b5207494b2eac",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 77,
"avg_line_length": 30.422535211267604,
"alnum_prop": 0.6606481481481481,
"repo_name": "mdxs/gae-init-docs",
"id": "ff3706d4ec3e110ac32905e258b09148a419bd2a",
"size": "2... |
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import namedtuple
from django import forms
from .widgets import RangeWidget, LookupTypeWidget
class RangeField(forms.MultiValueField):
widget = RangeWidget
def __init__(self, *args, **kwargs):
fields = ... | {
"content_hash": "d6cf73ac094f315fd3a61700f68bbfab",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 82,
"avg_line_length": 30.142857142857142,
"alnum_prop": 0.601303317535545,
"repo_name": "sanmugamk/django-filter",
"id": "0a791a727302cc696e535d82667fae4a584e223b",
"size"... |
from __future__ import print_function
import sys
import os
import re
import sqlite3
import qrcode
import codecs
import argparse
from urllib import quote, quote_plus
default_db = 'databases'
# https://code.google.com/p/google-authenticator/wiki/KeyUriFormat
def make_qrimage(url):
qr = qrcode.QRCode()
qr.add... | {
"content_hash": "385b889850cf2c5331f0be4bb0e6e12d",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 117,
"avg_line_length": 29.992125984251967,
"alnum_prop": 0.5571016014702022,
"repo_name": "folti/ga-qrdump",
"id": "890c1293e5d406d82cb0fea0c9acc26f82794ce5",
"size": "38... |
from rauth import OAuth1Service, OAuth2Service
from flask import current_app, url_for, request, redirect, session
class OAuthSignIn(object):
providers = None
def __init__(self, provider_name):
self.provider_name = provider_name
credentials = current_app.config['OAUTH_CREDENTIALS'][provider_na... | {
"content_hash": "b11482b0c957b9f381d5e6ad53159030",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 77,
"avg_line_length": 34.544117647058826,
"alnum_prop": 0.5627926777352065,
"repo_name": "gretahuang/calhacks2015",
"id": "8ba2264356265dfd8094c6a57a5f787619d2b19e",
"size... |
import socketserver
import threading
import struct
#
# Class to handle receiving UDP data from XPlane
#
class XPlaneUDPHandler(socketserver.BaseRequestHandler):
#
# Handler for receving data
#
def handle(self):
raw_data = self.request[0]
unpacked_data = self.unpack_data(raw_data)
print(unpacked_data)
#
... | {
"content_hash": "54a4160bf3c74a6392eee31e2d94d1c5",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 92,
"avg_line_length": 20.365079365079364,
"alnum_prop": 0.7061574434918161,
"repo_name": "jbumanlag/XPlaneCockpit",
"id": "a7e41e2e19888f4a5bca9f1f33c26406874d1d02",
"size... |
import binascii
import gzip
import os.path
import tempfile
import xml.etree.ElementTree as Et
from . import utils
STRIP_ATTRS = ['flags', 'source']
def create_imc_blob(xml_fname, dst_folder, dst_file, force):
dst_fname = os.path.join(dst_folder, dst_file)
xml_md5 = utils.compute_md5(xml_fname)
# Create... | {
"content_hash": "fd1389209fe141ddbd0b13d4060a29c9",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 92,
"avg_line_length": 28.476744186046513,
"alnum_prop": 0.5928950592078399,
"repo_name": "oceanscan/imctrans",
"id": "3b833da7b9fff0400a308c7286d1865b87159a52",
"size": "3... |
import asyncio
import collections
import logging
import time
from http.client import responses
from urllib.parse import urlparse
from urllib.parse import urlunparse
import aiohttp
from aiohttp import errors
from aiohttp import hdrs
from tsproxy import common
NO_CONTENT = 204
NOT_MODIFIED = 304
logger = logging.getL... | {
"content_hash": "37c9ac228c5c059cbbf7b21243fea0f8",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 166,
"avg_line_length": 39.37135922330097,
"alnum_prop": 0.5871401269958696,
"repo_name": "taige/PyTools",
"id": "4be9114872fc8fa19cf427713e3a98ea36ca5764",
"size": "16221... |
'''GradientCanvas
This creates a canvas with a gradient background. The colors
of the gradient can be set with the set_colors method. The
axis can be set with set_axis, and must be "x" or "y".
I'm not presently using this, but thought it might be useful
for tooltips or the window background or something.
'''
import ... | {
"content_hash": "95585076134f894f44bb16e20acfc97c",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 78,
"avg_line_length": 32.225,
"alnum_prop": 0.5616757176105508,
"repo_name": "boakley/robotframework-workbench",
"id": "c481dc66feee61cbe40623b57941f54958884eb5",
"size": ... |
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx... | {
"content_hash": "f4a41509581ff383321809d10eb1133d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 79,
"avg_line_length": 31.098360655737704,
"alnum_prop": 0.6736953083816553,
"repo_name": "sbauza/gerrit-dashboard-nfv",
"id": "db552ac13203a9282fa88e6dd5af8a7bc6ad5937",
"... |
'''This is test module
@author: sheng
@contact: [email protected]
@copyright: License according to the project license.
'''
import unittest
from sinoera.ganzhi import xinmao13
TestXinmao13Functions(unittest.TestCase):
def setUp(self):
pass
def test_XXX(self):
pass
if __name__ == "__... | {
"content_hash": "0e02c64841378f73c3df3a6d949dcbb7",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 53,
"avg_line_length": 17.45,
"alnum_prop": 0.6790830945558739,
"repo_name": "sinotradition/sinoera",
"id": "6f17e62712f2e76fcf7f9a612e955969ee97909a",
"size": "382",
"bi... |
from django.http import HttpResponse
import json
import datetime
class JSONResponse(HttpResponse):
def __init__(self, content=b'', **kwargs):
content = json.dumps(content, default=self.support_datetime_default, sort_keys=True)
kwargs['content_type'] = 'application/json'
super(JSON... | {
"content_hash": "9f0b669486cddea54842f3a861539c73",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 92,
"avg_line_length": 36.310344827586206,
"alnum_prop": 0.6229819563152896,
"repo_name": "zaubermaerchen/imas_cg_api",
"id": "e2d3a18daca7fdf33e66b713a188591576f035b0",
"s... |
"""Define version number here and read it from setup.py automatically"""
__version__ = "0.3.0"
| {
"content_hash": "4790b8b0ab5e97036ed0a5645261e34f",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 72,
"avg_line_length": 47.5,
"alnum_prop": 0.6947368421052632,
"repo_name": "quantumlib/OpenFermion-FQE",
"id": "ef9a9c7832a5f4cea6b5ce88996b8d674dc38326",
"size": "688",
... |
"""
@author: Ian
"""
import unittest
import os
import time
import numpy as np
import geosoft
import geosoft.gxapi as gxapi
import geosoft.gxpy.system as gsys
from base import GXPYTest
class Test(GXPYTest):
@classmethod
def tf(cls, f):
return os.path.join(os.path.dirname(cls._test_case_py), f)
d... | {
"content_hash": "eefde44525ae9f7916cb754d131da103",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 142,
"avg_line_length": 36.20289855072464,
"alnum_prop": 0.5221510541766746,
"repo_name": "GeosoftInc/gxpy",
"id": "2a88566182533ab2df3594edef138fa3ef8fba8b",
"size": "749... |
"""Test framework for merelcoin utils.
Runs automatically during `make check`.
Can also be run manually."""
from __future__ import division,print_function,unicode_literals
import argparse
import binascii
try:
import configparser
except ImportError:
import ConfigParser as configparser
import difflib
import j... | {
"content_hash": "4ca72977db8fa2a18bba8249bddfdfbb",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 125,
"avg_line_length": 37.074285714285715,
"alnum_prop": 0.6205302096177558,
"repo_name": "merelcoin/merelcoin",
"id": "be27545f7b7360852e4ce3ada87058f531474d8c",
"size":... |
__author__ = "Learning Equality"
__email__ = "[email protected]"
__version__ = "0.7.0"
import sys
if sys.version_info < (3, 6, 0):
raise RuntimeError("Ricecooker only supports Python 3.6+")
| {
"content_hash": "4208c7f51a0a5512ea6238cb3ab5472f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 62,
"avg_line_length": 22.77777777777778,
"alnum_prop": 0.6585365853658537,
"repo_name": "learningequality/ricecooker",
"id": "b075c69bc445fb9e24d40638bc67ffd9520b1e3c",
"si... |
import os
from textwrap import dedent
import unittest2 as unittest
from squarepants.build_component import JarFilesMixin
from squarepants.file_utils import temporary_dir
from squarepants.pom_file import PomFile
from squarepants.pom_utils import PomUtils
class BuildComponentTest(unittest.TestCase):
def setUp(self)... | {
"content_hash": "d79a82df081fdf167ecbc483504a58cc",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 106,
"avg_line_length": 39,
"alnum_prop": 0.45437745437745436,
"repo_name": "ericzundel/mvn2pants",
"id": "a378ce08cca2cd8a198585f7e2b21ff49883eaf3",
"size": "4499",
"bi... |
from core.model.direction import Direction
class Board(object):
tiles = {}
def __init__(self, width=4, height=4):
self.width = width
self.height = height
for x in range(self.width):
for y in range(self.height):
self.tiles[(x, y)] = None
def unmark_merg... | {
"content_hash": "7ee426c0e4de384681ec30de3e2fd57e",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 91,
"avg_line_length": 34.69230769230769,
"alnum_prop": 0.5399113082039911,
"repo_name": "the-dalee/gnome-2048",
"id": "aa657c0a3bb65c02c5f21d40a7f6034364612889",
"size": ... |
import pytest
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib/"))
import re
from dartsense.webapp import app as tl_app
tl_app.config['DEBUG'] = True
tl_app.config['TESTING'] = True
@pytest.fixture
def app(setup_db):
return tl_app
def login(client):
tl_app.config['TE... | {
"content_hash": "7e466052e6e25f0fda2d2bde32b24ecc",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 91,
"avg_line_length": 26.69298245614035,
"alnum_prop": 0.6496878080841275,
"repo_name": "basbloemsaat/dartsense",
"id": "615b4eba27b5704169c04c1496ff559b88a7b4f6",
"size"... |
mylist = [1, 2, 3] # this ideally comes from some place
assert 4 == len(mylist) # this will break
for position in range(4):
print(mylist[position])
| {
"content_hash": "ff929b5751ed44f655b72486035e50b9",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 56,
"avg_line_length": 26,
"alnum_prop": 0.6730769230769231,
"repo_name": "mkhuthir/learnPython",
"id": "f8470a2b1a4c89181c6b2f2655c1bc3b871b9b5c",
"size": "156",
"binary"... |
from __future__ import absolute_import
import uuid
import ldap as ldap
from keystone import assignment
from keystone import clean
from keystone.common import dependency
from keystone.common import driver_hints
from keystone.common import ldap as common_ldap
from keystone.common import models
from keystone import con... | {
"content_hash": "47edb2b369ff65ca52167bc457c4db8b",
"timestamp": "",
"source": "github",
"line_count": 702,
"max_line_length": 79,
"avg_line_length": 39.027065527065524,
"alnum_prop": 0.5477607037266854,
"repo_name": "derekchiang/keystone",
"id": "e3023886e08dbdf9f5eda0b53ab64905f979ebe8",
"size":... |
import os
import sys
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = [
'snovault',
'Pillow',
'PyBrowserID',
'SQLAlchemy>=1.0.0b1',
... | {
"content_hash": "607892a943cec8a3e1f6d93cfa2a8413",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 79,
"avg_line_length": 28.92792792792793,
"alnum_prop": 0.6474618498909996,
"repo_name": "T2DREAM/t2dream-portal",
"id": "2d9fcd89f8c25e8dc75d0e0e51e42d950b0786e3",
"size"... |
"""Config flow for Yeelight integration."""
import logging
import voluptuous as vol
import yeelight
from homeassistant import config_entries, exceptions
from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_ID, CONF_NAME
from homeassistant.core import callback
import homeassistant.helpers.config_validation as ... | {
"content_hash": "9df7d308d8568eb95bb734cb5d3c2c67",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 88,
"avg_line_length": 37.163366336633665,
"alnum_prop": 0.5688024510456907,
"repo_name": "adrienbrault/home-assistant",
"id": "0473cc1042c077196f94e7a3e2153318c0c275ff",
... |
import numpy as np
import pandas as pd
from bokeh.plotting import *
# Generate some synthetic time series for six different categories
cats = list("abcdef")
y = np.random.randn(2000)
g = np.random.choice(cats, 2000)
for i, l in enumerate(cats):
y[g == l] += i // 2
df = pd.DataFrame(dict(score=y, group=g))
# Find ... | {
"content_hash": "c8baa5ea7474a7b1fbc80e7af9fc28dc",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 95,
"avg_line_length": 30.931506849315067,
"alnum_prop": 0.6722763507528786,
"repo_name": "jakevdp/bokeh",
"id": "736b411ae2a1e9d73a5783bec1e66c291eec104b",
"size": "2258",... |
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('crimes2016OnlyLocationsTHEFTandBATTERY.csv')
X = dataset.iloc[:, 1:3].values
y = dataset.iloc[:, 0].values
# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_tes... | {
"content_hash": "c04398f5e44237c7b1ecb1dede54322a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 92,
"avg_line_length": 30.509090909090908,
"alnum_prop": 0.7377830750893921,
"repo_name": "jeanlks/ARP",
"id": "42fa6e60cbdea40c5130e3268d49c4a583fc7085",
"size": "1679",
... |
class EzConstants(object):
def __init__(self, serverport, clientport):
self.serverport = serverport
self.clientport = clientport
currentConstants = EzConstants(5611, 5611)
| {
"content_hash": "7c06abcae418e0fe63f90eb9090a9066",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 27.714285714285715,
"alnum_prop": 0.7010309278350515,
"repo_name": "WheelBarrow2/EzFileSender",
"id": "b2cb2952545539bbb22722737eefb8a4f1823614",
"siz... |
from __future__ import unicode_literals
import unittest
from hamcrest import equal_to, assert_that, raises, none, instance_of
from storops.exception import VNXBackendError, VNXInvalidMoverID, \
VNXFsExistedError
from storops.vnx.resource.fs import VNXFileSystem, VNXFileSystemList
from storops_test.vnx.nas_mock i... | {
"content_hash": "467bdba037d1ef7dc2c3c70f326739f4",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 79,
"avg_line_length": 33.815642458100555,
"alnum_prop": 0.5684784404427556,
"repo_name": "emc-openstack/storops",
"id": "8c8af55c2222443a9971271c41134c5a9bea2dcb",
"size"... |
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pages', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='page',
name='content',
... | {
"content_hash": "0898d8bdffdd80c9387d065e5a3368f1",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 72,
"avg_line_length": 21.105263157894736,
"alnum_prop": 0.6084788029925187,
"repo_name": "MeirKriheli/debian.org.il",
"id": "65e808fe29401e1c447a42919d4d99ae8c2364c3",
"si... |
"""Module contains Methods used for figuring out which/how many factors to retain
"""
import numpy as np
from fa_kit.broken_stick import BrokenStick
def retain_top_n(vals, num_keep):
"""Retain the top N largest components"""
if num_keep < 1:
raise ValueError(
"Must select num_keep >= 1 w... | {
"content_hash": "4813c7f5c5af177eae1d99a972258948",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 81,
"avg_line_length": 26.53488372093023,
"alnum_prop": 0.6205083260297984,
"repo_name": "bmcmenamin/fa_kit",
"id": "6e6b7756b05a1e30c86e196d5881963d5c42d1c6",
"size": "228... |
"""project related functions"""
import os
import shutil
import subprocess
import yaml
from mod import log, util, config, dep, template, settings, android, emsdk
from mod.tools import git, cmake, make, ninja, xcodebuild, xcrun, ccmake, cmake_gui, vscode, clion
#--------------------------------------------------------... | {
"content_hash": "12eaba2115161b05a14c4a343d0466cc",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 124,
"avg_line_length": 44.31414868105516,
"alnum_prop": 0.545321716543103,
"repo_name": "code-disaster/fips",
"id": "91a042b3013c327cdbd52fabed92831e6a702823",
"size": "1... |
"""
Python API for Product Hunt.
Unofficial Python API for Product Hunt.
@author Arindam Pradhan
@email [email protected]
"""
import re
import time
import operator
import urlparse
import requests
from bs4 import BeautifulSoup
from .utils import get_soup, comment_soup,striphtml,strp
from .constants import B... | {
"content_hash": "7e101cc6fc51a9bd2d803b82b4073ca3",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 128,
"avg_line_length": 39.90716180371353,
"alnum_prop": 0.5609837155201064,
"repo_name": "arindampradhan/ProductHunt_API",
"id": "5b41ee427ba5b6d315ac9913be6f83544f087a60",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.