text stringlengths 4 1.02M | meta dict |
|---|---|
import re
import typing
from typing import List, Tuple
from anchore_engine.common import os_package_types
from anchore_engine.db.entities.policy_engine import ImageCpe, ImagePackage
def compare_fields(lhs, rhs):
"""
Comparison function for cpe fields for ordering
- * is considered least specific and any ... | {
"content_hash": "c66aa24f037001ba462c9c132fcb4d9c",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 140,
"avg_line_length": 32.32044198895028,
"alnum_prop": 0.607008547008547,
"repo_name": "anchore/anchore-engine",
"id": "34b75445907221f4fbaa899c816013f3757d7e73",
"size"... |
import enum
from collections import namedtuple
class GameOptions:
PredefinedOptions = namedtuple('PredefinedOptions', ['app_id', 'context_id'])
STEAM = PredefinedOptions('753', '6')
DOTA2 = PredefinedOptions('570', '2')
CS = PredefinedOptions('730', '2')
TF2 = PredefinedOptions('440', '2')
PU... | {
"content_hash": "6b3765359e1cd4e8e1183e1d131568b9",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 82,
"avg_line_length": 26.33823529411765,
"alnum_prop": 0.6231155778894473,
"repo_name": "bukson/steampy",
"id": "2ef244f8f85b92abdb21f676dad1a7a3fcdaeed3",
"size": "1791",... |
import urllib2
import json
import sys
import datetime
from bs4 import BeautifulSoup
def parse_matches(url='http://en.wikipedia.org/wiki/2014_FIFA_World_Cup'):
response = urllib2.urlopen(url)
soup = BeautifulSoup(response.read())
ret = dict()
for h3 in soup('h3'):
if not h3.text.startswith('Group'):
... | {
"content_hash": "2dae92f6e15b3966bf48dc23d0c3efe2",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 26.3265306122449,
"alnum_prop": 0.5984496124031008,
"repo_name": "shadow-broker/WorldCup2014",
"id": "27e31b87771ac59d876db7dc0a4a70c272244c77",
"siz... |
import math
import numpy as np
# Back Propergation
#
#
#
def back_propergation(errs, unit_output, preunit_output, func, learning_rate, solved = 'fitting'):
if solved == 'fitting' or solved == 'fit':
if func == sigmoid : delta_part = (errs * unit_output * (1 - unit_output))
elif func == tanh ... | {
"content_hash": "6c5eb85a326778bf603a6d9fe783fa06",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 98,
"avg_line_length": 30.015625,
"alnum_prop": 0.5929203539823009,
"repo_name": "WaterIsland/DLStudy",
"id": "0b65fdbc0a3d4303a8ae45d725e32d9ab526d240",
"size": "2100",
... |
from ..osid import managers as osid_managers
from ..osid import sessions as osid_sessions
class LocaleProfile(osid_managers.OsidProfile):
"""The locale profile describes the interoperability of locale services."""
def get_language_types_for_source(self, source_language_type, source_script_type):
"""G... | {
"content_hash": "37717493a7e599bd171904c9cf9b64f7",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 133,
"avg_line_length": 35.57203389830509,
"alnum_prop": 0.6527695056581299,
"repo_name": "birdland/dlkit-doc",
"id": "5733f6fbca68d297e8f4d6102c86f4995ec96cc3",
"size": "... |
import dj_database_url
from decouple import config
from .base import * # noqa
DEBUG = True
SECRET_KEY = 'secret'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'fixmydjango',
}
}
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
MEDIA_ROOT = 'mediafiles'
... | {
"content_hash": "d2ce789320719ddd9cf5dc66919ec477",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 50,
"avg_line_length": 14.923076923076923,
"alnum_prop": 0.634020618556701,
"repo_name": "vintasoftware/fixmydjango",
"id": "db7a53bc2cd08248400c0feca9b84808e9e75475",
"siz... |
import bitcoin.core.script
import colorcore.caching
import openassets.protocol
import tests.helpers
import unittest
class SqliteCacheTests(unittest.TestCase):
@tests.helpers.async_test
def test_colored_output(self, loop):
target = colorcore.caching.SqliteCache(':memory:')
output = openassets.... | {
"content_hash": "410f56862b5b0998903ffe08e146f649",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 109,
"avg_line_length": 33.90217391304348,
"alnum_prop": 0.629368387303623,
"repo_name": "OpenAssets/colorcore",
"id": "d3248e6101e9906745e14c62c09b7d933327ef18",
"size": "... |
import struct
import sys
import tempfile
from mock import Mock, patch
from nose.tools import *
from behave.formatter import formatters
from behave.formatter import pretty
from behave.formatter import tag_count
from behave.model import Tag, Feature, Match, Scenario, Step
class TestGetTerminalSize(object):
def s... | {
"content_hash": "e3a182ccc208fccae18686a42ae341c4",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 83,
"avg_line_length": 27.71356783919598,
"alnum_prop": 0.585312783318223,
"repo_name": "memee/behave",
"id": "5efca9c9e25089389965116bfff42a93d689d71d",
"size": "5515",
... |
import datetime
import glance_store
from oslo_config import cfg
from oslo_serialization import jsonutils
from six.moves import http_client as http
import webob
import glance.api.v2.image_members
import glance.tests.unit.utils as unit_test_utils
import glance.tests.utils as test_utils
DATETIME = datetime.datetime(201... | {
"content_hash": "6d9f2aa2fcd0889068404c39f8e745d5",
"timestamp": "",
"source": "github",
"line_count": 557,
"max_line_length": 77,
"avg_line_length": 40.94075403949731,
"alnum_prop": 0.5995439396597089,
"repo_name": "rajalokan/glance",
"id": "6a4a12cf8df2fbfc74f0c525aa7f8d7080e446c6",
"size": "234... |
"""\
=====================================
Parse RDF data received from a uri
=====================================
Fetch and parse RDF data, and then send out TopologyViewer commands
Example Usage
-------------
A simple console driven RDF parser and draw them with 3D topology viewer::
Pipeline( ConsoleReader()... | {
"content_hash": "a3b5a8193efb28c6486bd8531fa43175",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 116,
"avg_line_length": 35.38028169014085,
"alnum_prop": 0.6540605095541401,
"repo_name": "sparkslabs/kamaelia",
"id": "830daf3328ada01e1d1d6f285cab7c776d2b0188",
"size": "... |
from __future__ import absolute_import # Avoid importing `importlib` from this package.
import imp
from importlib import import_module
import os
import sys
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
def import_by_path(dotted_path, error_prefix=''):
"""
Import a dot... | {
"content_hash": "a3d2c1590215398a3489fbcc2c1df248",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 93,
"avg_line_length": 37.49,
"alnum_prop": 0.5380101360362763,
"repo_name": "adambrenecki/django",
"id": "9c8ea98d509a66970e21e933a8af116c7a66812c",
"size": "3749",
"bi... |
from django.db import models
# Create your models here.
class Account(models.Model):
balance = models.DecimalField(decimal_places=2, max_digits=12)
def withdraw(self, amount):
print(f"Withdraw {amount} from {self}")
self.balance -= amount
def deposit(self, amount):
print(f"Depo... | {
"content_hash": "94ab09c26944a062443d6ac6fa0ba395",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 23.5,
"alnum_prop": 0.651595744680851,
"repo_name": "amolenaar/roles",
"id": "c6e322aec3e959e914db2972bb6be0b934b52bef",
"size": "376",
"binary": f... |
import sys
from src.functions import multiply, add
def test_multiply():
assert multiply(1, 2) == 2
assert multiply(0, 1) == 0
def test_add():
assert add(1, 1) == 2
def test_python3():
if sys.version_info[0] == 3:
assert True
else:
assert True
| {
"content_hash": "8665f41753eadd496cab47879e197c23",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 39,
"avg_line_length": 15.833333333333334,
"alnum_prop": 0.5929824561403508,
"repo_name": "filaton/basic_travis",
"id": "6a0d5101c6ebb9de1ecd707a91441d02022c4438",
"size": ... |
import os.path
import saml2
def create_conf(sp_host='sp.example.com', idp_hosts=['idp.example.com']):
BASEDIR = os.path.dirname(os.path.abspath(__file__))
config = {
'xmlsec_binary': '/usr/bin/xmlsec1',
'entityid': 'http://%s/saml2/metadata/' % sp_host,
'attribute_map_dir': os.path.j... | {
"content_hash": "c1988088551fb352ed84208af89f3f14",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 109,
"avg_line_length": 36.53333333333333,
"alnum_prop": 0.46970802919708027,
"repo_name": "sdelements/djangosaml2",
"id": "3c4119b9c240bf2ebf2229b90e905b8391e71cf2",
"size... |
def checkio(text):
char = [list(append(wd) for wd in text.split() ]
print(char)
return 'a'
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio("Hello World!") == "l", "Hello test"
assert checkio("How do you do?") == "o", ... | {
"content_hash": "6762ca9a280ce85244d61a0add0a480d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 84,
"avg_line_length": 38.94444444444444,
"alnum_prop": 0.5891583452211127,
"repo_name": "hkaushalya/CheckIO",
"id": "03e363492e8945f17680a6649f45e8fff5729469",
"size": "70... |
"""
Django settings for BusyBot project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | {
"content_hash": "f0b9fa99ad06eaa65e9f2724b3ca6a58",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 71,
"avg_line_length": 23.931623931623932,
"alnum_prop": 0.7160714285714286,
"repo_name": "bytedreamer/BusyBot",
"id": "3f0601ed7f8b6df3c5bd8ef18818ba7a019ba480",
"size": ... |
'''
OpenShiftCLI class that wraps the oc commands in a subprocess
'''
# pylint: disable=too-many-lines
import atexit
import json
import os
import re
import shutil
import subprocess
import ruamel.yaml as yaml
#import yaml
#
## This is here because of a bug that causes yaml
## to incorrectly handle timezone info on t... | {
"content_hash": "ce8952e4b8ad4b0f245ea40bb015166e",
"timestamp": "",
"source": "github",
"line_count": 1180,
"max_line_length": 118,
"avg_line_length": 32.947457627118645,
"alnum_prop": 0.5296568753536705,
"repo_name": "themurph/openshift-tools",
"id": "94332a3eb3ba95a99c8d73d177c96ea9a463a6e7",
"... |
from itertools import chain
from contextlib import contextmanager
from plumbum.machines.local import CommandsProvider
from plumbum.commands.base import BaseCommand
from plumbum.commands.processes import run_proc, CommandNotFound, ProcessExecutionError
class EmptyCluster(Exception):
"""Raised by :class:`Cluster <... | {
"content_hash": "773a3a7cce1e1769cd77cc208dd18763",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 109,
"avg_line_length": 30.965384615384615,
"alnum_prop": 0.5704881381194883,
"repo_name": "weka-io/plumbum",
"id": "d1574befc5f5d52ef2fdaed95e1618d5a01b7ba0",
"size": "80... |
import re
# Extract variable definitions from a Makefile.
# Return a dictionary mapping names to values.
# May raise IOError.
makevardef = re.compile('^([a-zA-Z0-9_]+)[ \t]*=(.*)')
def getmakevars(filename):
variables = {}
fp = open(filename)
pendingline = ""
try:
while 1:
... | {
"content_hash": "e1d8d0699771a0ce035327c74f95903b",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 65,
"avg_line_length": 27.693693693693692,
"alnum_prop": 0.47397527651268706,
"repo_name": "MattDevo/edk2",
"id": "b14a6dac47b1989abecbc150222e9720dbead68a",
"size": "3122... |
hiddenimports = ['scipy.io.matlab.streams']
| {
"content_hash": "a87f3f25e95c560086fa822fba91038f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 43,
"avg_line_length": 44,
"alnum_prop": 0.75,
"repo_name": "TeamSWAP/swap",
"id": "60da0fdc4e2b50b33dee6b9c28e6724cbb42dd28",
"size": "554",
"binary": false,
"copies": ... |
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_required
from issues.views import *
urlpatterns = patterns("issues.views",
(r"^delete-comment/(\d+)/$", "delete_comment", {}, "delete_comment... | {
"content_hash": "26e8191e147036a5f2cae12536c84c6c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 119,
"avg_line_length": 46.37837837837838,
"alnum_prop": 0.6357808857808858,
"repo_name": "akulakov/mangotrac",
"id": "07d2419f07f2ec1e57156d1f4ebbe77d666964c2",
"size": "1... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('human_resources', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='identification',
name='id',
field=models.BigAutoField(auto_created... | {
"content_hash": "9002175814a3f506e227e0ab60b6c9e5",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 111,
"avg_line_length": 35.02777777777778,
"alnum_prop": 0.5900079302141158,
"repo_name": "Semprini/cbe",
"id": "6ca6e4ef99a94831ff01d021e750332a38e092b5",
"size": "1310",
... |
"""Generates various info tables from SPIR-V JSON grammar."""
from __future__ import print_function
import errno
import json
import os.path
import re
# Prefix for all C variables generated by this script.
PYGEN_VARIABLE_PREFIX = 'pygen_variable'
# Extensions to recognize, but which don't necessarily come from the S... | {
"content_hash": "0ea0ea8a5b8218dbddb65779dd2f33ec",
"timestamp": "",
"source": "github",
"line_count": 735,
"max_line_length": 102,
"avg_line_length": 39.310204081632655,
"alnum_prop": 0.6122244142179767,
"repo_name": "septag/termite",
"id": "ae948d3886e542e7bd08120a61c9fdd07ab8d6f7",
"size": "294... |
"""
list of subjects that are to be excluded, can be a text file or a list
"""
#exclusionSubjectList = '/home/data/settings/ex_subjects.txt'
#exclusionSubjectList = ['sub001', 'sub003']
exclusionSubjectList = None
"""
list of subjects that are included, can be a text file or a list
if None, extract data runs on all t... | {
"content_hash": "acb4d87a2dd8832b11c48c576a339879",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 73,
"avg_line_length": 25.755555555555556,
"alnum_prop": 0.722174288179465,
"repo_name": "sgiavasis/C-PAC",
"id": "163c1bad23f6aabe999ea4b202355dda0088fc29",
"size": "1159"... |
"""
Implements operations on volumes residing on VMware datastores.
"""
from oslo_log import log as logging
from oslo_utils import units
from oslo_vmware import exceptions
from oslo_vmware import pbm
from oslo_vmware import vim_util
import six
from six.moves import urllib
from cinder.i18n import _, _LE, _LI
from cin... | {
"content_hash": "88096f72ab7d4ca81b0a362a119cfb3b",
"timestamp": "",
"source": "github",
"line_count": 1554,
"max_line_length": 79,
"avg_line_length": 43.68790218790219,
"alnum_prop": 0.5665699429968626,
"repo_name": "scality/cinder",
"id": "c238e32c62f59a176e26b7588eab50c2efcf1b3c",
"size": "6852... |
import http.client as httplib
from email.errors import MultipartInvariantViolationDefect, StartBoundaryNotFoundDefect
from ..exceptions import HeaderParsingError
def is_fp_closed(obj: object) -> bool:
"""
Checks whether a given file-like object is closed.
:param obj:
The file-like object to chec... | {
"content_hash": "92599db31d73e6559802ce35ed2ab331",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 87,
"avg_line_length": 33.717171717171716,
"alnum_prop": 0.6824445775913721,
"repo_name": "sigmavirus24/urllib3",
"id": "38ed9d3bed425ac9bde346f9d1e4299c51cbd84c",
"size": ... |
import asyncio
import os
from datetime import datetime
import pytest
import sqlalchemy as sa
from asyncpg.pool import Pool
from puckdb import db, fetch
from puckdb.db import get_connection_str, metadata
db_name = os.getenv('PUCKDB_DB_TEST_DATABASE', os.getenv('PUCKDB_DB_DATABASE'))
@pytest.fixture(scope='function'... | {
"content_hash": "33b0070e9a6577ae76863baf411525a0",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 86,
"avg_line_length": 31.944444444444443,
"alnum_prop": 0.6569565217391304,
"repo_name": "aaront/puckdb",
"id": "31f403ed8c1faf45ce10764a4965674ac664c2fc",
"size": "2300",... |
from __future__ import unicode_literals
# Standard library imports
import json
import unittest
# Local imports
from binstar_client.errors import Conflict
from binstar_client.scripts.cli import main
from binstar_client.tests.urlmock import urlpatch
from binstar_client.tests.fixture import CLITestCase
class Test(CLITe... | {
"content_hash": "9cbd8b2076a0114e8750aa81d014f372",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 119,
"avg_line_length": 38.675,
"alnum_prop": 0.5872656755009696,
"repo_name": "Anaconda-Platform/anaconda-client",
"id": "3ede632933e7a574728729e1ee41bfe7aaa78a51",
"size"... |
import re
import os
import csv
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from product_spiders.items import Product, ProductLoaderWithNameStrip as... | {
"content_hash": "aedd7c6bd5c982b11f0dff600fbaf18a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 117,
"avg_line_length": 39.30952380952381,
"alnum_prop": 0.6238643246517263,
"repo_name": "ddy88958620/lib",
"id": "687f9c7513aa0c333ab159f2df793ed6e17f0483",
"size": "1651... |
from pyface.viewer.content_provider import *
| {
"content_hash": "41532c61fb387d56fa4edccd5507b871",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 44,
"avg_line_length": 45,
"alnum_prop": 0.8222222222222222,
"repo_name": "enthought/etsproxy",
"id": "cd633287d96bfaf02d2af0844762b4067e6c9051",
"size": "60",
"binary": f... |
'''
Copyright (c) 2008 Georgios Giannoudovardis, <vardis.g@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use,... | {
"content_hash": "cb69452fc7ff49a7c28336bf8109aaeb",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 99,
"avg_line_length": 37.89473684210526,
"alnum_prop": 0.5868055555555556,
"repo_name": "vardis/pano",
"id": "e1c9ef79fc8832cf4a4836f09852ee8537875242",
"size": "5760",
... |
import mock
from heat.engine import resource
from heat.engine import stack
from heat.engine import template
from heat.tests import common
from heat.tests import utils
from ..resources import role # noqa
keystone_role_template = {
'heat_template_version': '2013-05-23',
'resources': {
'test_role': {
... | {
"content_hash": "d7a12528b5a4c269347936c298346f55",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 79,
"avg_line_length": 32.49180327868852,
"alnum_prop": 0.636226034308779,
"repo_name": "pshchelo/heat",
"id": "a2e7b557b8e71679cd846351eb07c2c51fdc8eb9",
"size": "4539",
... |
from django import template
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.utils.http import int_to_base36
from inviter.models import OptOut
from inv... | {
"content_hash": "4a8c25caa46b2182811e9f8bf453a53d",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 91,
"avg_line_length": 33.80508474576271,
"alnum_prop": 0.6565555277011782,
"repo_name": "caffeinehit/django-inviter",
"id": "1e332f380a23e68ccd998fc599bdd44ec48aed28",
"s... |
"""Definitions for the `Line` class."""
import numexpr as ne
import numpy as np
from astropy import constants as c
from astropy import units as u
from mosfit.modules.seds.sed import SED
from mosfit.constants import SQRT_2_PI
# Important: Only define one ``Module`` class per file.
class Line(SED):
"""Line spectr... | {
"content_hash": "9cc19b804a195a6fbd4ce1014c1964d7",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 72,
"avg_line_length": 36.59036144578313,
"alnum_prop": 0.548238393151136,
"repo_name": "villrv/MOSFiT",
"id": "8642868fc9f095c6c8607f843e3be3c3edeacb83",
"size": "3037",
... |
import socket
import pytest
import concurrent_server
from multiprocessing import Process
from server import ADDR
from time import sleep
###################################################
# Constants
###################################################
CRLF = b'\r\n'
DUMMY_DATE = b"Sun, 21 Jul 2001 23:32:15 GTM"
STAT... | {
"content_hash": "cb7cfe2e99df633b61ac735b4a2904f0",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 78,
"avg_line_length": 33.47663551401869,
"alnum_prop": 0.5501116694584032,
"repo_name": "jay-tyler/http-server",
"id": "4e7336299a42afa7177054a34bde99f1a9574619",
"size":... |
from ...errors.httpbadrequestexception import HttpBadRequestException
import saklient
# module saklient.cloud.errors.paramresnotfoundexception
class ParamResNotFoundException(HttpBadRequestException):
## 不適切な要求です。パラメータで指定されたリソースが存在しません。IDをご確認ください。
## @param {int} status
# @param {str} code=None
#... | {
"content_hash": "2119a50660e5c4e51d6d77616c23045e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 165,
"avg_line_length": 40.785714285714285,
"alnum_prop": 0.7338003502626971,
"repo_name": "hnakamur/saklient.python",
"id": "eb1edbe2a382b6334d5d843eeeaab55799771f11",
"si... |
from __future__ import annotations
import unittest
from unittest.mock import call, patch
import pytest
from hdfs import HdfsError
from airflow.models.connection import Connection
from airflow.providers.apache.hdfs.hooks.webhdfs import AirflowWebHDFSHookException, WebHDFSHook
class TestWebHDFSHook(unittest.TestCase... | {
"content_hash": "0d288d50aa57d0d675deb0d68b180a58",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 110,
"avg_line_length": 46.22348484848485,
"alnum_prop": 0.6599196918790461,
"repo_name": "apache/airflow",
"id": "71e1231dac3d9cd9026db5f3ffd6406ef716febf",
"size": "1299... |
import logging
from gensim.models.word2vec import Word2Vec, Text8Corpus
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
def pprint(result):
for word, score in result:
print "%s\t%f" % (word, score)
def generate_model(filename, **kwag):
sentences = Text8Cor... | {
"content_hash": "eeeb8a862759a8050e1f2eaccca77aca",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 91,
"avg_line_length": 28.45945945945946,
"alnum_prop": 0.597340930674264,
"repo_name": "yamitzky/word2vec-japanese-twitter",
"id": "b59b16417de24162518c1445cd9e476432f0ef57"... |
import inspect
from ...listener import EventListener
class Trampoline(object):
def __init__(self, name, events, lock):
self.name = name
self.events = events
self.lock = lock
def __call__(self, **kwargs):
with self.lock:
try:
self.events.put_nowait... | {
"content_hash": "e03bb0f8d904b54cacb28231b4c628bb",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 85,
"avg_line_length": 25.6,
"alnum_prop": 0.5890625,
"repo_name": "renatahodovan/fuzzinator",
"id": "2e32e18053ee7470f848655429b6f72892060f32",
"size": "922",
"binary": ... |
import json
import datetime
from libdlt.protocol.exceptions import AllocationError
from libdlt.protocol.ibp.allocation import IBPExtent
from libdlt.depot import Depot
import libdlt.protocol.ibp.services as services
import libdlt.protocol.ibp.flags as flags
from lace import logging
from lace.logging import trace
from ... | {
"content_hash": "2ddc89e4fda4baac5426ffc1b24ed9ec",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 123,
"avg_line_length": 36.05464480874317,
"alnum_prop": 0.6048802667474993,
"repo_name": "datalogistics/libdlt",
"id": "7e38891ca70388aa1b903fd881ecdb0a10a39c3b",
"size":... |
from lxml import etree
from pykml.factory import KML_ElementMaker as KML
import shapefile
import sys
def create_reader(args):
shp_fname = args[1]
dbf_fname = args[2]
shp_file = open(shp_fname, 'rb')
dbf_file = open(dbf_fname, 'rb')
reader = shapefile.Reader(shp=shp_file, dbf=dbf_file)
ret... | {
"content_hash": "de8a30d4d1a39af56212fc2d9d243d4b",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 93,
"avg_line_length": 24.5,
"alnum_prop": 0.5704081632653061,
"repo_name": "cthrall/shp2kml",
"id": "3076925d12dd4203f533c7b8d0f656d40678f85f",
"size": "980",
"binary": ... |
"""
The MIT License (MIT)
Copyright (c) 2015-2016 Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, ... | {
"content_hash": "009287e1e2483dc2cd446c8d94c59ab8",
"timestamp": "",
"source": "github",
"line_count": 3304,
"max_line_length": 140,
"avg_line_length": 33.301755447941886,
"alnum_prop": 0.5829554026665698,
"repo_name": "OthmanEmpire/project_othbot",
"id": "c7c7f08ae3ab7d671f64834f4905d264df12aca1",
... |
async def f11(x):
y = (await<error descr="Expression expected"> </error>for await<error descr="Expression expected"> </error>in []) # fail
await x
def f12(x):
y = (await for await in [])
return x
async def f21(x):
y = (mapper(await<error descr="Expression expected">)</error> for await<error des... | {
"content_hash": "dd8cc0a83b187f95bbb490fd851ee39e",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 134,
"avg_line_length": 24.12,
"alnum_prop": 0.6194029850746269,
"repo_name": "dahlstrom-g/intellij-community",
"id": "3e27aca6991c8b6ce70fdc0447a665143735e734",
"size": "1... |
"""
Classes and functions related to IRI/URI processing, validation, resolution, etc.
Copyright 2008-2020 Uche Ogbuji and Mike Brown
"""
__all__ = [
'IriError',
'I',
# IRI tools
"iri_to_uri",
"nfc_normalize",
"convert_ireg_name",
# RFC 3986 implementation
'matches_uri_ref_syntax', 'matches_uri_synta... | {
"content_hash": "b28214696063eb65f750fa859b91a3d4",
"timestamp": "",
"source": "github",
"line_count": 1693,
"max_line_length": 148,
"avg_line_length": 41.54459539279386,
"alnum_prop": 0.6042653017701002,
"repo_name": "uogbuji/amara3-iri",
"id": "866471b0c73f2f93666fdb97ccbb217f73144489",
"size": ... |
from django.db import models
from django.contrib.auth.models import User
class Fox(models.Model):
user = models.OneToOneField(User)
ip = models.GenericIPAddressField(protocol='IPv4')
def __unicode__(self):
return self.ip
| {
"content_hash": "e9cf2344df10b03a538227d58db85e46",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 27,
"alnum_prop": 0.7160493827160493,
"repo_name": "TechnicalFox/Fox-Latch",
"id": "786832bbc85cb6d9654239c3591dfdac71c7fccb",
"size": "243",
"binar... |
from gunstar.http import RequestHandler
class IndexHandler(RequestHandler):
def get(self):
self.render_template('index.html')
class OtherHandler(RequestHandler):
def get(self, name):
self.render_template('index.html', name=name)
| {
"content_hash": "71f3e184bf911bde97a8adb6c820d496",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 53,
"avg_line_length": 20.53846153846154,
"alnum_prop": 0.6853932584269663,
"repo_name": "allisson/gunstar",
"id": "bbc22e62fc74c5fe8c4d90fc2a579af51f6da6b0",
"size": "291"... |
from __future__ import unicode_literals
from django.db import models, migrations
import autoslug.fields
class Migration(migrations.Migration):
dependencies = [
('flisol_event', '0007_auto_20150110_1133'),
]
operations = [
migrations.AlterField(
model_name='flisolevent',
... | {
"content_hash": "e2caeae4a33a9916ffb9fc688db3a51e",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 121,
"avg_line_length": 30.1875,
"alnum_prop": 0.6004140786749482,
"repo_name": "ikks/flisol-connect",
"id": "8f61646ee350ff8f145e4aaf50f879d5214b1a97",
"size": "990",
"b... |
""" This is just a very basic module to find a specific prime number. This is my first python program. Everything I do and plan to do is CC-BY-SA. Thanks for stopping by. Alpha32
"""
how_high = int(input("Enter the range: "))
nth_prime = int(input("Enter the prime to find: "))
def find_a_prime(nth_prime, how_high):
... | {
"content_hash": "a8ebabbd6090b82823f213223165a8c5",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 178,
"avg_line_length": 26.14814814814815,
"alnum_prop": 0.6628895184135978,
"repo_name": "amneher/python_stuff",
"id": "beac28f90b379562dc0c8aa9f8c32633f0640a17",
"size": ... |
r"""Module doctest -- a framework for running examples in docstrings.
In simplest use, end each module M to be tested with:
def _test():
import doctest
doctest.testmod()
if __name__ == "__main__":
_test()
Then running the module as a script will cause the examples in the
docstrings to get executed and v... | {
"content_hash": "e619d15b8bdbfbeaf4aaa5a9ded6b6e1",
"timestamp": "",
"source": "github",
"line_count": 2841,
"max_line_length": 79,
"avg_line_length": 37.404787046814505,
"alnum_prop": 0.5683137756782444,
"repo_name": "mrgriffin/doctest-eval",
"id": "17b498d7c181d7af264baa4e609cffe1f1b0cc17",
"siz... |
from bson.objectid import ObjectId
from datetime import datetime
from scraper.repository import Repository, Property, Collection
STATUS_CREATED = "created"
STATUS_EXECUTING = "executing"
STATUS_FINISHED = "finished"
class Job(Collection, Repository):
__collection__ = 'job'
_id = Property(ObjectId, "job id"... | {
"content_hash": "ab1af9a5fd384ffa52033c0c6e7bda47",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 63,
"avg_line_length": 28.88888888888889,
"alnum_prop": 0.7230769230769231,
"repo_name": "victorpantoja/webscraper",
"id": "ded33489300e3821524185a821190c12fb9ce651",
"size... |
from flask import current_app, redirect, request, session, url_for
from flask.views import MethodView
from oauth2client.client import OAuth2WebServerFlow
from freight.config import db
from freight.constants import PYTHON_VERSION
from freight.models import User
GOOGLE_AUTH_URI = "https://accounts.google.com/o/oauth2/a... | {
"content_hash": "7086e594245b838bc2d858ba5e1b6485",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 35.916666666666664,
"alnum_prop": 0.6476632416307591,
"repo_name": "getsentry/freight",
"id": "468159446081847a85add0e92c7d3baade962a42",
"size": "30... |
import argparse
import sys
from ros_buildfarm.argument import add_argument_source_dir
from ros_buildfarm.common import Scope
from ros_buildfarm.sourcedeb_job import build_sourcedeb
def main(argv=sys.argv[1:]):
with Scope('SUBSECTION', 'build sourcedeb'):
parser = argparse.ArgumentParser(
desc... | {
"content_hash": "d4d917321e018324ff52cd3d3c736b88",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 58,
"avg_line_length": 26.65,
"alnum_prop": 0.6923076923076923,
"repo_name": "mani-monaj/ros_buildfarm",
"id": "c3d8210ef931cb4cae3e59dc92eebd6b98f222d8",
"size": "557",
... |
import datetime
from django.contrib import messages
from django.core.mail import BadHeaderError
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse_lazy
from django.utils import timezone
from django.views.generic import DetailView, ListView, FormView
from pydotorg.mixins import Lo... | {
"content_hash": "cf131c40e47ae1440c672220414cf233",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 146,
"avg_line_length": 32.38513513513514,
"alnum_prop": 0.6645107448362195,
"repo_name": "manhhomienbienthuy/pythondotorg",
"id": "2490626e3d97e7e1e6c28e616f6a10eb658160b4"... |
"""TensorSpec factory for ragged tensors."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import tensor_spec
from tensorf... | {
"content_hash": "259455a88d45fdc70fb64f8dc8824f72",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 78,
"avg_line_length": 38.77777777777778,
"alnum_prop": 0.7028243962341384,
"repo_name": "ghchinoy/tensorflow",
"id": "9da282cea3c99af4f05fb6926e091f4c9ec7bdca",
"size": "3... |
import sys, os
# Append the top level directory of the docs, so we can import from the config dir.
sys.path.insert(0, os.path.abspath('..'))
# Pull in all the configuration options defined in the global config file..
from config.all import *
language = 'en'
| {
"content_hash": "073863d4cb059d64974c322996805d48",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 83,
"avg_line_length": 29,
"alnum_prop": 0.7318007662835249,
"repo_name": "cakephp/chronos",
"id": "f638bda2257a926dc478e25b869358c894214189",
"size": "261",
"binary": fal... |
import sys
class Message(object):
def __init__(self):
self.classname = self.__class__.__name__
self.errorcolor = "\033[31m"#red
self.infocolor = "\033[34m"#blue
self.warningcolor = "\033[33m"#yellow
self.successcolor = "\033[32m"#green
self.endcolor = "\033[0m"#reset... | {
"content_hash": "7951b4670976e0f9add0c570cf2aa2d0",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 130,
"avg_line_length": 39.61538461538461,
"alnum_prop": 0.574757281553398,
"repo_name": "gammapy/enrico",
"id": "c7d2630ea1e0477fe3793279895e814e08d84c83",
"size": "1545",... |
from gi.repository import Gdk
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
#from FlatCAMApp import *
from FlatCAM_GTK import FlatCAMApp
class PlotCanvas:
"""
Class handling the plotting area in the application.
"""
def __init... | {
"content_hash": "be7a6dc488dc189c1ee1e520f9cfbcf5",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 103,
"avg_line_length": 30.31290322580645,
"alnum_prop": 0.5560285197403426,
"repo_name": "silasb/flatcam",
"id": "2096c11c1c0ac695a1580afb077485d05f7be96a",
"size": "9825... |
"""Utility functions for managing customer supplied encryption keys."""
import base64
import json
from googlecloudsdk.calliope import exceptions
EXPECTED_RECORD_KEY_KEYS = set(['uri', 'key'])
BASE64_KEY_LENGTH_IN_CHARS = 44
class MissingCsekKeyException(exceptions.ToolException):
def __init__(self, resource):
... | {
"content_hash": "7f58123a8267111af1420c655dba68cb",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 80,
"avg_line_length": 30.49824561403509,
"alnum_prop": 0.6585365853658537,
"repo_name": "wemanuel/smry",
"id": "45ce64edac8479cd76816b1ab1c096b289424987",
"size": "8742",... |
import matplotlib as mpl
mpl.use('Agg') # required to prevent DISPLAY error; must be before pyplot (REF 050)
import matplotlib.pyplot as plt
import numpy as np
class PlotTestCase(object):
'''Adatped from seaborn.'''
def setUp(self):
np.random.seed(33)
d... | {
"content_hash": "501d695ee1872f8f42b995d8cbd6c7b3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 127,
"avg_line_length": 28,
"alnum_prop": 0.5989010989010989,
"repo_name": "par2/lamana",
"id": "3586331909a4517a66040042bc3c67e40d945141",
"size": "365",
"binary": false... |
import numpy as np
def init_random_normal(lower, upper, n_points, mean=None, std=None, rng=None):
"""
Returns as initial design N data points sampled from a normal
distribution.
Parameters
----------
lower: np.ndarray (D)
Lower bound of the input space
upper: np.ndarray (D)
... | {
"content_hash": "1f79fc71bd262cb9e88ce4519f302166",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 87,
"avg_line_length": 27.73170731707317,
"alnum_prop": 0.5980650835532102,
"repo_name": "numairmansur/RoBO",
"id": "56088503338aecaaccaf55cc530671139d51f5ab",
"size": "113... |
'''
Created on 2013-01-22
@author: levi
'''
from util.parser import load_parser
from util.test_script_base import Test
class ATLTest(Test):
def __init__(self, args):
Test.__init__(self)
#============TRANSFORMATION=================
self.full_transformation = [
['HCo... | {
"content_hash": "66ba81f96963e4300930672d74884a39",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 97,
"avg_line_length": 33.06306306306306,
"alnum_prop": 0.5743869209809265,
"repo_name": "levilucio/SyVOLT",
"id": "2328b958c63a49ad558855bdb2764bf2711976ac",
"size": "367... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 7, transform = "Integration", sigma = 0.0, exog_count = 20, ar_order = 0); | {
"content_hash": "45a0337bd5db2864334986b9bc7f1081",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 165,
"avg_line_length": 37.857142857142854,
"alnum_prop": 0.7056603773584905,
"repo_name": "antoinecarme/pyaf",
"id": "13c6bdd554e07985475bcc1366101d5e773429b0",
"size": "26... |
import sys
import re
import dns
import navcoin
import dnssec
from util import StoreDict, print_error
from i18n import _
class Contacts(StoreDict):
def __init__(self, config):
StoreDict.__init__(self, config, 'contacts')
def resolve(self, k):
if navcoin.is_address(k):
return {
... | {
"content_hash": "2e36c3a8f046c4374c497072ed0c64a7",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 86,
"avg_line_length": 29.580645161290324,
"alnum_prop": 0.4989094874591058,
"repo_name": "sherlockcoin/Electrum-NavCoin",
"id": "2ac128ff94749f9de3523225eca41cdf6a7ba64b",
... |
import lldb
import commands
import optparse
import shlex
class StackArgument:
def __init__(self, frame, index):
self.index = index
self.frame = frame
def GetValueAs(self, type):
return self.frame.EvaluateExpression('*(' + type + '*)($rsp+' + str(self.index) + ')').value
def ... | {
"content_hash": "514cb1bd9fe334220c2623d17bdd7cdf",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 187,
"avg_line_length": 45.136752136752136,
"alnum_prop": 0.49981064192387803,
"repo_name": "ScrimpyCat/pmsg",
"id": "e3dd2d9e9b1f24d349387f9273e7eb2cce8434c1",
"size": "1... |
from rest_framework.generics import ListCreateAPIView
from apis.betterself.v1.mood.filters import UserMoodLogFilter
from apis.betterself.v1.mood.serializers import MoodReadOnlySerializer, MoodCreateUpdateSerializer
from apis.betterself.v1.utils.views import ReadOrWriteSerializerChooser, UUIDDeleteMixin, UUIDUpdateMixi... | {
"content_hash": "3d106e2adbd9b0b27f954873ba272e46",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 105,
"avg_line_length": 45.13636363636363,
"alnum_prop": 0.8227593152064451,
"repo_name": "jeffshek/betterself",
"id": "641afa5733a23a2115a8c78fd585f830e540c8d1",
"size": "... |
"""
Analyze docstrings to detect errors.
If no argument is provided, it does a quick check of docstrings and returns
a csv with all API functions and results of basic checks.
If a function or method is provided in the form "pandas.function",
"pandas.module.class.method", etc. a list of all errors in the docstring for... | {
"content_hash": "dc596f0d1683f9407b672a524ec74f34",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 87,
"avg_line_length": 32.3235294117647,
"alnum_prop": 0.5834524892759652,
"repo_name": "pandas-dev/pandas",
"id": "a86630eba7d5dc07bc5a17b84fee2f03cdf5ce5c",
"size": "154... |
''' CoordsConf: Configure QGIS coordinate display
Store this script as .qgis2/python/startup.py
Redoute, 19.10.2013 '''
from __future__ import unicode_literals, division
import qgis
QgsPoint = qgis.core.QgsPoint
CoordinateReferenceSystem = qgis.core.QgsCoordinateReferenceSystem
CoordinateTransform = qgis.core.QgsCoo... | {
"content_hash": "a8499a44d4369623e594c640dccf8f80",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 130,
"avg_line_length": 34.60648148148148,
"alnum_prop": 0.6816053511705685,
"repo_name": "ActiveState/code",
"id": "9249fafa82a1f25102a84180a92501f204f6143a",
"size": "75... |
"""
CeilometerConf - file ``/etc/ceilometer/ceilometer.conf``
=========================================================
"""
from insights.core import IniConfigFile
from insights.core.plugins import parser
from insights.specs import Specs
@parser(Specs.ceilometer_conf)
class CeilometerConf(IniConfigFile):
"""
... | {
"content_hash": "edf671efd179af917c4694f57bb8d601",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 80,
"avg_line_length": 31.196428571428573,
"alnum_prop": 0.5941614195764167,
"repo_name": "RedHatInsights/insights-core",
"id": "189c44caeaf9e9cbd78ac5fed7360e9b381a8485",
... |
"""Provides a class for controlling the TI ADS105."""
from time import sleep
import RPi.GPIO as GPIO
# ACHTUNG: Das SMBus-Protokoll geht bei der Übertragung von Werten mit
# mehr als einem Byte Länge (16-bit-Word) davon aus, dass das LSB zuerst
# übertragen wird. Der ADS1015 sendet jedoch das MSB zuerst, daher ist
# e... | {
"content_hash": "ddaf5ee02a8b9026e2d65afd08606629",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 100,
"avg_line_length": 33,
"alnum_prop": 0.6125841750841751,
"repo_name": "alex-Symbroson/BotScript",
"id": "171a871525d07a0af3b5fb0a944b52941524300e",
"size": "4775",
... |
import lib.record_rate
import lib.commonclient
import lib.getconfig
import lib.puylogger
import lib.basecheck
import json
marathon_url = lib.getconfig.getparam('Mesos-Marathon', 'stats')
check_type = 'marathon'
class Check(lib.basecheck.CheckBase):
def precheck(self):
try:
marathon_stats = l... | {
"content_hash": "6c94a506acd9d27717d6b4a4c9974848",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 228,
"avg_line_length": 52.67391304347826,
"alnum_prop": 0.5815105241436236,
"repo_name": "oddeyeco/oe-agent2",
"id": "8a2367731d07c5b550a79dd2d2c11b2333068fe6",
"size": "2... |
import _plotly_utils.basevalidators
class NticksValidator(_plotly_utils.basevalidators.IntegerValidator):
def __init__(
self, plotly_name="nticks", parent_name="layout.polar.radialaxis", **kwargs
):
super(NticksValidator, self).__init__(
plotly_name=plotly_name,
parent_... | {
"content_hash": "f9e7b6de3eeabf6ddf27a6f3996941e8",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 83,
"avg_line_length": 33.86666666666667,
"alnum_prop": 0.5846456692913385,
"repo_name": "plotly/python-api",
"id": "6134ec43f3a3d8670dc5e806fccc1c6f337b1db3",
"size": "508... |
from functools import partial
import pyspark.context
from pyspark_cassandra.rdd import CassandraRDD
def monkey_patch_sc(sc):
sc.__class__ = CassandraSparkContext
sc.__dict__["cassandraTable"] = partial(CassandraSparkContext.cassandraTable, sc)
sc.__dict__["cassandraTable"].__doc__ = CassandraSparkContext.cassandr... | {
"content_hash": "ad348a5d7222b1f55baec39cc8d88496",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 85,
"avg_line_length": 37.72222222222222,
"alnum_prop": 0.7717231222385862,
"repo_name": "omriiluz/pyspark-cassandra",
"id": "aefe6470a942163d0c83f5012d5cd922dd9ed4ad",
"si... |
"""
This module, views.py, is where all the backend and frontend server requests are handled and returned to the user.
"""
# Needed to send back a rendered HTML page.
from django.shortcuts import render
# Needed for sending a simple HttpResponse such as a string response.
from django.http import HttpResponse
# Needed ... | {
"content_hash": "d382f107dc4a4d71325be7303e24cafc",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 253,
"avg_line_length": 36.20912547528517,
"alnum_prop": 0.695999159928594,
"repo_name": "utarsuno/urbtek",
"id": "d4eb5a8f1b8a99fdca5f523b995fb0380a93241b",
"size": "9539... |
""" OAuth 1.0 Authorization.
Uses python-oauth2 library to perform 3-way handshake.
1. Create a new instance OAuth 1.0
2. Call the generateAuthorizationURL method to create
the authorization URL
3. Once the user grants access
4. Call the authorize method to upgrade to an access
token.
"""
__author__ = 'kbrisbin@goog... | {
"content_hash": "42de71c79feb226017f06ff784319d2f",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 121,
"avg_line_length": 38.71052631578947,
"alnum_prop": 0.5781781101291639,
"repo_name": "MapofLife/MOL",
"id": "4abcfa90c2f7119f87dada29b56fec18a7e1089e",
"size": "2996",... |
import _plotly_utils.basevalidators
class CmaxValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="cmax", parent_name="treemap.marker", **kwargs):
super(CmaxValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "463a5bb1acaceb6479246ed5d0ae508e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 83,
"avg_line_length": 39,
"alnum_prop": 0.6132478632478633,
"repo_name": "plotly/plotly.py",
"id": "691f37e2e353cdaeac6d639c008b4754b81db3ee",
"size": "468",
"binary": f... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('zoning', '0005_auto_20201126_0706'),
]
operations = [
# 10_zoning
migrations.RunSQL('DROP INDEX IF EXISTS couche_communes_geom_idx;'),
migrations.RunSQL('DROP INDEX IF EXISTS l_comm... | {
"content_hash": "f467bb34ff06a3eedeae3bb5a5a85c21",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 88,
"avg_line_length": 39.08695652173913,
"alnum_prop": 0.67853170189099,
"repo_name": "GeotrekCE/Geotrek-admin",
"id": "b2bb240f6c631bb64a90a8e9f926c771e0761708",
"size": ... |
import demistomock as demisto
def test_main(mocker):
from RegexExtractAll import main
# test basic functionality
with open('TestData/data.txt', 'r') as f:
test_data = f.read()
mocker.patch.object(demisto, 'args', return_value={
'value': test_data,
'regex': r'\b[A-Za-z0-9._%=+... | {
"content_hash": "ca9ec44b21e72f0809b0ea1d2b5b8945",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 82,
"avg_line_length": 33.39705882352941,
"alnum_prop": 0.5830030823425804,
"repo_name": "demisto/content",
"id": "6590ca656921e86fafb30dac24fe913f86234f70",
"size": "2271"... |
from django.contrib.sites.models import SiteManager
from threaded_multihost import sites
import logging
log = logging.getLogger('threaded_multihost')
def site_get_current(self):
"""Overridden version of get_current, which is multihost aware."""
return sites.by_host()
SiteManager.get_current = site_get_curren... | {
"content_hash": "bb9fbf4b83954759d6de927397c8807a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 70,
"avg_line_length": 31.076923076923077,
"alnum_prop": 0.7797029702970297,
"repo_name": "diver-in-sky/django-threaded-multihost",
"id": "845c9bd059bb2cb673e2622d0f0274e332c... |
"""
Written by Luckylau
Github: https://github.com/Luckylau
Email: laujunbupt0913@163.com
# Note: Example code For testing purposes only
"""
from pyVim.connect import SmartConnect, Disconnect
import atexit
from pyVmomi import vim
import sys
import argparse
import getpass
import ssl
def add_nic(vm, mac, port):
s... | {
"content_hash": "bd5a5332820ce487f3b8eed60a94554f",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 78,
"avg_line_length": 30.36094674556213,
"alnum_prop": 0.583122198401871,
"repo_name": "jm66/pyvmomi-community-samples",
"id": "bb6d4c793cb7d476386eb3d8b886ce2eeac04af8",
... |
'''
Copyright (c) 2017 Vanessa Sochat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute... | {
"content_hash": "958eba130f16bc240d991186d3485d03",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 131,
"avg_line_length": 41.20967741935484,
"alnum_prop": 0.6044357469015004,
"repo_name": "vsoch/docfish",
"id": "0000342b1d618c2364aae93fb20732e00e14a2b7",
"size": "7665"... |
import attr
import datetime
from ._abc import ThreadABC
from .._common import log, attrs_default
from .. import _util, _session, _models
from typing import Optional
GENDERS = {
# For standard requests
0: "unknown",
1: "female_singular",
2: "male_singular",
3: "female_singular_guess",
4: "male... | {
"content_hash": "1aa308d75f918271dfdb1a1a72cecdf9",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 85,
"avg_line_length": 31.506787330316744,
"alnum_prop": 0.5619704150509838,
"repo_name": "carpedm20/fbchat",
"id": "00bbeab791bcfb420151e59ee23f026541ac888b",
"size": "69... |
"""Recursive feature elimination for feature ranking"""
import numpy as np
from ..utils import check_X_y, safe_sqr
from ..base import BaseEstimator
from ..base import MetaEstimatorMixin
from ..base import clone
from ..base import is_classifier
from ..cross_validation import _check_cv as check_cv
from ..cross_validatio... | {
"content_hash": "bd85029f0dc62ccdf6089a014e89108e",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 79,
"avg_line_length": 37.68292682926829,
"alnum_prop": 0.6137360661632506,
"repo_name": "thilbern/scikit-learn",
"id": "a0589fd0c3d946bda615eb3afa01be4e0e6c11ae",
"size":... |
from django.contrib import admin
from .models import QuestionSet
# Register your models here.
admin.site.register(QuestionSet) | {
"content_hash": "8c58b75eff11b1642877d670196441e2",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 32,
"avg_line_length": 25.4,
"alnum_prop": 0.8267716535433071,
"repo_name": "jolahde/rak",
"id": "74a129a901c5f235efd497e21e1a4e20c6622820",
"size": "127",
"binary": false... |
"""Tests for Cloud Spanner Operations api."""
from tests.gcloud import emulator
class GCloudOperationsTest(emulator.TestCase):
def testDescribeOperation(self):
# Create an instance to start a LRO.
operation_uri = self.CreateInstance('test-instance')
# Describe the operation.
# Describe returns st... | {
"content_hash": "8e754efeed5eb3980dc2b23f3812ac1d",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 34.87179487179487,
"alnum_prop": 0.6125,
"repo_name": "GoogleCloudPlatform/cloud-spanner-emulator",
"id": "099a4885a477e4312bf511f957c8abef47a6f3f3",
... |
from netkit.line_box import LineBox
class KolaBox(LineBox):
def __init__(self, init_data=None):
# 不要让顶层初始化init_data
super(KolaBox, self).__init__(None)
if init_data:
self.set_json(init_data)
@property
def values(self):
if not getattr(self, '_values', None):
... | {
"content_hash": "0cdc6fc92e69dc23f5279bfcd85b7733",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 48,
"avg_line_length": 21.225,
"alnum_prop": 0.5217903415783275,
"repo_name": "yangdw/PyRepo",
"id": "d64a3c2ba9ad20bc1795e58252614423879c6284",
"size": "912",
"binary": ... |
"""
FLI
Object-oriented interface for handling Finger Lakes Instrumentation devices
author: Craig Wm. Versek, Yankee Environmental Systems
author_email: cwv@yesinc.com
"""
from camera import USBCamera
from filter_wheel import USBFilterWheel
from focuser import USBFocuser
| {
"content_hash": "0b5dc21aec3a57762a8b4f64b2502021",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 76,
"avg_line_length": 26,
"alnum_prop": 0.7867132867132867,
"repo_name": "tzuchiangshen/python-FLI",
"id": "f14b5898464a59ac1b71a6242602544d7f4e5ac5",
"size": "286",
"bi... |
"""Tests for classroom models."""
from __future__ import annotations
import types
from core.platform import models
from core.tests import test_utils
MYPY = False
if MYPY: # pragma: no cover
from mypy_imports import base_models
from mypy_imports import classroom_models
(base_models, classroom_models) = mode... | {
"content_hash": "c1935865847e8f07229bd0803359963f",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 79,
"avg_line_length": 38.36879432624114,
"alnum_prop": 0.5975970425138633,
"repo_name": "oppia/oppia",
"id": "539028fbbac9200a99592a026d949533d67e9575",
"size": "6033",
... |
from typing import Iterator
from google.cloud import bigquery
import pytest
from conftest import prefixer
import update_with_dml
@pytest.fixture
def table_id(
bigquery_client: bigquery.Client, project_id: str, dataset_id: str
) -> Iterator[str]:
table_id = f"{prefixer.create_prefix()}_update_with_dml"
y... | {
"content_hash": "690ee07d129a2f6501c35ebb1b53c3c4",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 27.035714285714285,
"alnum_prop": 0.6895640686922061,
"repo_name": "googleapis/python-bigquery",
"id": "ef5ec196ac8423a17ce508b5b8a81ed715136048",
"s... |
from ....compiler import CompiledProgram
from ....data_feeder import DataFeeder
from .... import executor
from .graph_wrapper import GraphWrapper
__all__ = ['SlimGraphExecutor']
class SlimGraphExecutor(object):
"""
Wrapper of executor used to run GraphWrapper.
"""
def __init__(self, place):
... | {
"content_hash": "39cdb0d5cbf4da638fa0bdfc73e7f9cc",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 93,
"avg_line_length": 35.46808510638298,
"alnum_prop": 0.563887222555489,
"repo_name": "chengduoZH/Paddle",
"id": "1573d3aa1ce5d28c58bd8dbeaf0bfda622b998e5",
"size": "2279... |
"""
@file comm_ethernet.py
"""
##
# @addtogroup ethernet ethernet
# @brief This is ethernet component
# @{
# @addtogroup comm_ethernet comm_ethernet
# @brief This is comm_ethernet module
# @{
##
import time
import os
import string
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.helper import shell_cmd_timeout
f... | {
"content_hash": "9e7aaca2847ad698eed839bc16c52798",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 109,
"avg_line_length": 34.63503649635037,
"alnum_prop": 0.5656480505795575,
"repo_name": "ostroproject/meta-iotqa",
"id": "e4d3a79b4388790ef845077e612bbad62f677302",
"siz... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os.path
import time
import json
from six.moves import input
def print_shafts(draft, connected):
"""
Print the shaft lift state, as for a table loom.
"""
up_shafts = [' ' if shaft in co... | {
"content_hash": "e2290c673365eb2d90c46090e49e488a",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 79,
"avg_line_length": 30.12,
"alnum_prop": 0.5680979784565442,
"repo_name": "storborg/pyweaving",
"id": "de56604d28531b6af4cbcb0dfd0ce1cd545cb74a",
"size": "6777",
"bin... |
from sqlalchemy.test.testing import eq_
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.test import testing
from test.orm import _fixtures
from test.orm._base import MappedTest, ComparableEntity
from sqlalchemy.test.schema import Table, Column
class SingleInheritanceTest(MappedTest):
@class... | {
"content_hash": "74e71f8bb3d674437e6fec1526ca22b3",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 113,
"avg_line_length": 37.17955112219451,
"alnum_prop": 0.57233885572473,
"repo_name": "dbbhattacharya/kitsune",
"id": "4b7078eb51d96cf6c0b507cdcc59a12c409d075d",
"size":... |
NAME_CHOICES = (
('Apparel/Accesory', 'Apparel/Accesory'),
('Entertainment', 'Entertainment'),
('Food/Beverage', 'Food/Beverage'),
('Skin care/Cosmetics', 'Skin care/Cosmetics'),
('Computer/Mobile', 'Computer/Mobile'),
('Books/Newspapers', 'Books/Newspapers'),
('Other', 'Other'),
)
| {
"content_hash": "c448c3b770d979ce4293c1dce64fdaeb",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 48,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.6632302405498282,
"repo_name": "sSwiergosz/FinancialOrganiser",
"id": "09ee3eebecb15ef0965bd6120fa750ef7eef5425",
... |
from collections import namedtuple
from datetime import timedelta
from numpy import random
from django.core.urlresolvers import reverse
from django.views.generic.base import TemplateView
from braces.views import JSONResponseMixin
from corehq.apps.reports_core.exceptions import FilterException
from dimagi.utils.decora... | {
"content_hash": "7d186f0d2b734cb644aa57d0e002c71d",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 96,
"avg_line_length": 31.625,
"alnum_prop": 0.6174242424242424,
"repo_name": "puttarajubr/commcare-hq",
"id": "5b37da68fd9541ffbd9d45246aa2028ec8626477",
"size": "6072",
... |
r"""Convert old ("regex") regular expressions to new syntax ("re").
When imported as a module, there are two functions, with their own
strings:
convert(s, syntax=None) -- convert a regex regular expression to re syntax
quote(s) -- return a quoted string literal
When used as a script, read a Python string litera... | {
"content_hash": "9b5e296b88fccce73eda5099cd02110f",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 77,
"avg_line_length": 27.903225806451612,
"alnum_prop": 0.5676300578034682,
"repo_name": "Integral-Technology-Solutions/ConfigNOW",
"id": "59708dac9f04a9d7eb9bfef5411a77670... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import colino.digraph
class Condition(object):
def evaluate(self, context, event):
"""return true or false"""
raise NotImplemented
class RuleNode(digraph.Node):
def __init__(self... | {
"content_hash": "f7da3fa9f3e37eaf4f1ada09fbe3a90c",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 66,
"avg_line_length": 21.339285714285715,
"alnum_prop": 0.5790794979079498,
"repo_name": "gmambro/colino",
"id": "52d3a29576eaa1204329e0985fb170f93737f80f",
"size": "1219"... |
class LocalFTP(object):
"""
Class adding recursive nlst() behavior to ftplib.FTP instance. The
ftplib.FTP instance is available through the connection attribute, and
is exposed through __getattr__.
The behavior added by this class (recursive directory listing) is most
appropriate for ftp connec... | {
"content_hash": "0ba99a40a28af82203543daa585e2d94",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 80,
"avg_line_length": 32.423645320197046,
"alnum_prop": 0.599969614099058,
"repo_name": "ActiveState/code",
"id": "f413263e6010c402888becace041b616a4adfa8c",
"size": "658... |
from django.test import TestCase
from backend.models import Festival
from backend.tests.helpers import login, create_user, create_festival
from backend.tests.helpers import create_client
class UpdateFestivalInfoTests(TestCase):
def test_no_client_name_provided(self):
"""
update_festival_info() is... | {
"content_hash": "8f131df54271d8b036368a4d66834a43",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 105,
"avg_line_length": 37.54814814814815,
"alnum_prop": 0.5480370881830736,
"repo_name": "amentis/FestPal-Server",
"id": "eae90e9c2cc7d0a6932ffdeffed4e712ea2b5762",
"size... |
import unittest
from django.test.client import Client
from lifeflow.models import *
import datetime
import pygments.lexers as lexers
#response = self.client.get('/api/case/retrieve/', {})
#self.assertEquals(response.content, 'etc')
class commentTest(unittest.TestCase):
def setUp(self):
self.client = Cli... | {
"content_hash": "a451f3bb8a5ac90612359feec71366fb",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 350,
"avg_line_length": 38.77165354330709,
"alnum_prop": 0.5306661251015434,
"repo_name": "rajeev/lifeflow",
"id": "051e7ae1e4744bac9d5a8c29b21cd464cb189c46",
"size": "492... |
from setuptools import setup
setup(
name='librpc_lint',
version='1.0',
description='librpc IDL file linter',
author='Jakub Klama',
author_email='jakub.klama@twoporeguys.com',
url='https://github.com/twoporeguys/librpc',
include_package_data=True,
packages=['librpc_lint'],
entry_poi... | {
"content_hash": "1473a6ad3ba5393cabfe4b9de40a56e0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 48,
"avg_line_length": 22.88888888888889,
"alnum_prop": 0.616504854368932,
"repo_name": "twoporeguys/librpc",
"id": "f5237a5957ff87c289ffbd253b339e86e412620f",
"size": "170... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.