text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import absolute_import, unicode_literals
from future.builtins import chr, int, str
try:
from html.parser import HTMLParser
from html.entities import name2codepoint
try:
from html.parser import HTMLParseError
except ImportError: # Python 3.5+
class HTMLParseError(Excepti... | {
"content_hash": "d22cc62aed4de980a0f99c883d66bf00",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 75,
"avg_line_length": 31.016260162601625,
"alnum_prop": 0.5934469200524246,
"repo_name": "eino-makitalo/mezzanine",
"id": "12e08d9b5f7f061e4cf6ee60dfefe199eb73f573",
"siz... |
"""
Equivalent layer for griding and upward-continuing gravity data
-------------------------------------------------------------------------
The equivalent layer is one of the best methods for griding and upward
continuing gravity data and much more. The trade-off is that performing this
requires an inversion and lat... | {
"content_hash": "0cd4d5245d5e67b8d88c3baa7a484eb2",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 79,
"avg_line_length": 40.078947368421055,
"alnum_prop": 0.7137229152987524,
"repo_name": "fatiando/fatiando",
"id": "d654dd8d3aa334de09a4016285a17d332e6568bc",
"size": "30... |
from WebKit.Examples.ExamplePage import ExamplePage
class Main(ExamplePage):
def writeContent(self):
self.writeln('''<h2>DBUtils example</h2>
<p>You can set the DBUtils parameters in the following file</p>
<ul>
<li><tt>Configs/Database.config</tt></li>
</ul>
<p>With the default settings,</p>
<ul>
<li>you... | {
"content_hash": "63155b5743496197b8fe37ffbe84bef0",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 66,
"avg_line_length": 30.3,
"alnum_prop": 0.7046204620462047,
"repo_name": "jetyang2005/elastalert",
"id": "39bf4b6ee51aab70b905f32c5f6a4d747f8c46b3",
"size": "607",
"bi... |
from distutils.core import setup
setup_kwargs = {
'name': 'dalianmao',
'version': '0.10',
'description': 'A Web Crawling and Web Scraping microframework based on aiohttp',
'packages': ['dalianmao',],
'platforms': 'any',
'license': 'MIT',
'author': 'Zeng Jianxin',
'author_email': 'zengj... | {
"content_hash": "d01fe843d1c783e66456749a129a8bc8",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 85,
"avg_line_length": 28.903225806451612,
"alnum_prop": 0.5848214285714286,
"repo_name": "ZengJianxin/dalianmao",
"id": "e02cf0ca8f43efe589e212c6c25fc68c197ca7bd",
"size":... |
from __future__ import absolute_import
import unittest
from mock import patch
import mock
import pdb
import networkx as nx
import os
import sys
try:
# Python 2: "reload" is built-in
reload # pylint: disable=reload-builtin
except NameError:
from importlib import reload
test_path = os.path.abspath(os.path... | {
"content_hash": "77aa26a38b07394bb042952f9979c1f4",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 109,
"avg_line_length": 33.02150537634409,
"alnum_prop": 0.628785411917942,
"repo_name": "open-cloud/xos",
"id": "73ea213a80a74dbeef018c769797a6bd3710340c",
"size": "3666",... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
# Satisfied, she goes back to sleep
self.browser.quit()
def test_can_sta... | {
"content_hash": "89381caf81b4d3cda4e30453cc0030ea",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 80,
"avg_line_length": 39.44642857142857,
"alnum_prop": 0.6319601629696695,
"repo_name": "kevinmanncito/django-tdd",
"id": "1a3c92832ed274f38d35337279266f9c5b5d9e7a",
"size... |
import board_elements
from tile import Tile
__author__ = 'cenk'
class Board:
def __init__(self, height=3, width=3, cost_function=None, heuristic_function=None):
board_elements.board_width = width
board_elements.board_height = height
self.tiles = [x for x in range(height * width)]
... | {
"content_hash": "357e9bd50151eeb73914e5b10785c4e3",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 101,
"avg_line_length": 29.11111111111111,
"alnum_prop": 0.5916030534351145,
"repo_name": "cenkbircanoglu/8_puzzle_problem",
"id": "abb507b0f40546e8f2deb4126ea20ca57d7a770f",... |
import warnings
# TODO `_matplotlib` module should be private, so the plotting backend
# can be change. Decide whether all these should be public and exponsed
# in `pandas.plotting`, or remove from here (I guess they are here for
# legacy reasons
from pandas.plotting._matplotlib.converter import (
DatetimeConverte... | {
"content_hash": "c43c387b546972af8fc2a24f5b325e87",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 76,
"avg_line_length": 28.967741935483872,
"alnum_prop": 0.7305122494432071,
"repo_name": "kushalbhola/MyStuff",
"id": "c2b76188ad36bec4d8554f14835e5c54aacb8f76",
"size": "... |
class menuitem(object):
""" Represents a menu item """
def __init__(self, unselected, selected,
location, onhover, function, config, sounds):
"""
Default constructor
:param unselected: The surface representing the unselected button
:param selected: The surface r... | {
"content_hash": "ebf20c25a15f5b72916e8099b25c4e59",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 36.5,
"alnum_prop": 0.6202435312024354,
"repo_name": "Penaz91/Glitch_Heaven",
"id": "76a2f7cc0434bf9921a4123dbc65faf197f0ce22",
"size": "1431",
"bi... |
"""Alcatel-Lucent SROS support."""
import re
from netmiko.ssh_connection import SSHConnection
class AlcatelSrosSSH(SSHConnection):
"""Alcatel-Lucent SROS support."""
def session_preparation(self):
self.set_base_prompt()
self.disable_paging(command="environment no more\n")
def set_base_pro... | {
"content_hash": "f9e62766dd4267e967309922e6cd2a5a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 86,
"avg_line_length": 33.08,
"alnum_prop": 0.6203143893591294,
"repo_name": "mith1979/pynet_course",
"id": "ea436ce800f356d7c35796ba7a9b7172d306642b",
"size": "827",
"bi... |
"""
Copyright 2016 Brocade Communications Systems, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed t... | {
"content_hash": "cca94fb6d728738423956f32dd2b2843",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 40.694117647058825,
"alnum_prop": 0.5967042497831744,
"repo_name": "brocade/pynos",
"id": "5c181bd20e5f76fb1d4b1f5a277c54413d1df676",
"size": "3459",... |
"A framework for converting web-logs into various formats"
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
str = type('')
import os
import sys
from setuptools import setup, find_packages
if sys.version_info[0] == 2:
if not sys.version_info >= (2, 7):
... | {
"content_hash": "0cb70a92c8cc1538decbe88be94c1f34",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 106,
"avg_line_length": 31.652173913043477,
"alnum_prop": 0.5538003663003663,
"repo_name": "waveform80/lars",
"id": "345b3699127613c1d8d239fa418c0285273dda10",
"size": "56... |
from threading import Thread, RLock, Event
from Queue import Queue
from cloudify import amqp_client
from cloudify.exceptions import ClosedAMQPClientException
class AMQPWrappedThread(Thread):
"""
creates an amqp client before calling the target method.
This thread is always set as a daemon.
"""
d... | {
"content_hash": "75a0df3a2a28158edc439bdb0e79afbf",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 77,
"avg_line_length": 28.470588235294116,
"alnum_prop": 0.5935655253837072,
"repo_name": "cloudify-cosmo/cloudify-plugins-common",
"id": "d1ff66ac7945524b0d6f7e3d8d203a6546... |
'''
AND, Logical AND with Accumulator Test
This is a test for the logical instruction AND of
the 6502. In the 6502 the logical AND could be
performed against the content of the accumulator or
a content at a specific location.
'''
import unittest
from pynes.compiler import lexical, syntax, semantic
class AndTest(unit... | {
"content_hash": "7ab5614c2f433a81f97f3e3d824baf9a",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 69,
"avg_line_length": 40.29192546583851,
"alnum_prop": 0.6010482503468475,
"repo_name": "BmanisKing/Mine",
"id": "c9f66c554d1e79285876bdb04818c9225b13a0d5",
"size": "6511... |
import base64
import os
import tempfile
import time
import unittest
import warnings
import docker
from .. import helpers
class InformationTest(helpers.BaseTestCase):
def test_version(self):
res = self.client.version()
self.assertIn('GoVersion', res)
self.assertIn('Version', res)
... | {
"content_hash": "b9727947aaf64e5b2069ec34edf5f2e3",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 79,
"avg_line_length": 35.09090909090909,
"alnum_prop": 0.6036269430051814,
"repo_name": "Faylixe/docker-py",
"id": "67ed068703b37bfde15e5a64a295588c071e1ffc",
"size": "61... |
"""Test the SmartTub switch platform."""
import pytest
@pytest.mark.parametrize(
"pump_id,entity_suffix,pump_state",
[
("CP", "circulation_pump", "off"),
("P1", "jet_p1", "off"),
("P2", "jet_p2", "on"),
],
)
async def test_pumps(spa, setup_entry, hass, pump_id, pump_state, entity_... | {
"content_hash": "8fbc55471631bab8e4aa99cdcf8f9a3f",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 81,
"avg_line_length": 25.933333333333334,
"alnum_prop": 0.5886889460154242,
"repo_name": "partofthething/home-assistant",
"id": "89e0ec03b238cda6cb7c0120286889fe53095230",
... |
from .utils import (
LogbookTestCase,
activate_via_push_pop,
activate_via_with_statement,
capturing_stderr_context,
get_total_delta_seconds,
make_fake_mail_handler,
missing,
require_module,
require_py3,
)
from contextlib import closing, contextmanager
from datetime import datetime, t... | {
"content_hash": "ca679a613860eee0e446cf323e20a695",
"timestamp": "",
"source": "github",
"line_count": 1482,
"max_line_length": 162,
"avg_line_length": 40.44399460188934,
"alnum_prop": 0.5899262571323701,
"repo_name": "dplepage/logbook",
"id": "40b11a0e07fede3965e53c3a6bc6ffbc85b4f65f",
"size": "5... |
from typing import Optional, Union
from archinfo import Arch
from .optimization_pass import OptimizationPassStage
from .stack_canary_simplifier import StackCanarySimplifier
from .base_ptr_save_simplifier import BasePointerSaveSimplifier
from .expr_op_swapper import ExprOpSwapper
from .ite_expr_converter import ITEExp... | {
"content_hash": "0ec76a787ad3d4b1d626b6196f509e96",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 97,
"avg_line_length": 31.955882352941178,
"alnum_prop": 0.718361711919006,
"repo_name": "angr/angr",
"id": "f89a392fec5b8ae9cb632a0c8ceff146ea766c7e",
"size": "2214",
"b... |
"""Deploy domokit.github.io"""
# NOTE: Requires that download_material_design_icons to have been run from
# $build_dir/gen/dart-dpkg/sky.
import argparse
import logging
import os
import shutil
import subprocess
from mopy.paths import Paths
def git_revision():
return subprocess.check_output(['git', 'rev-parse',... | {
"content_hash": "2a222f39d2961f9402bfc0a603278286",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 80,
"avg_line_length": 31.79054054054054,
"alnum_prop": 0.6320935175345377,
"repo_name": "collinjackson/mojo",
"id": "64c3ca671adea9f0a8a955b605bdb54a4306ed59",
"size": "4... |
from django.http import Http404
from django.views.generic import DetailView
from simplesite.models import Page
class PageBaseDetailView(DetailView):
"""
Base View model specification. The remain views, will inherit from this
across de application.
"""
model = Page
def get_queryset(self, *arg... | {
"content_hash": "c3f39cb493ac1f527f9d503d233a767c",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 75,
"avg_line_length": 28.61111111111111,
"alnum_prop": 0.6161812297734628,
"repo_name": "marsxn/simple-site",
"id": "21261181f232557408bbd867b7a215b37d0ed6eb",
"size": "15... |
''' Assemble WebSocket wire message fragments into complete Bokeh Server
message objects that can be processed.
'''
from __future__ import absolute_import
import six
from tornado.concurrent import return_future
from .exceptions import ValidationError
import logging
log = logging.getLogger(__name__)
class Receiver(... | {
"content_hash": "19252e65158db41ec053f6fae3e1a5a8",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 131,
"avg_line_length": 33.029411764705884,
"alnum_prop": 0.6188780053428317,
"repo_name": "DuCorey/bokeh",
"id": "12cf54a730c2c2da9eb37ed042cf99d05a695c10",
"size": "4492... |
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from rest_framework import generics
from rest_fr... | {
"content_hash": "f550697cfa876257b83372d1410bea51",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 120,
"avg_line_length": 38.60655737704918,
"alnum_prop": 0.6217622080679406,
"repo_name": "lucabezerra/VinTwitta",
"id": "a7a56fb269c320c918a0ac5723fce22caa9c137e",
"size"... |
"""
Tests the trained CNN vessel segmentation mode on all test images
"""
import itertools
import os
import sys
import glob
import subprocess
import time
import matplotlib
matplotlib.use('AGG')
import matplotlib.pyplot as plt
import numpy as np
import skimage.io
import skimage.filters
from . import deploy
from . impo... | {
"content_hash": "9c148807fd029e2d39887117773afdf3",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 25.513157894736842,
"alnum_prop": 0.6637441980402269,
"repo_name": "aylward/ITKTubeTK",
"id": "45e4213c5fb055ba7a4648a131e61053f41c1fef",
"size": "19... |
"""Helpers for listening to events."""
import functools as ft
from homeassistant.helpers.sun import get_astral_event_next
from ..core import HomeAssistant, callback
from ..const import (
ATTR_NOW, EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL)
from ..util import dt as dt_util
from ..util.async import run_call... | {
"content_hash": "e3c24acde0593c6a9e4f837f4a505a0f",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 78,
"avg_line_length": 32.69705882352941,
"alnum_prop": 0.6359629396419898,
"repo_name": "MungoRae/home-assistant",
"id": "9b64c08af18a216d086d19bbb740428757bc6ca7",
"size... |
from io import StringIO
from html.parser import HTMLParser
# Inspired by: https://stackoverflow.com/questions/753052/strip-html-from-strings-in-python
# Note that this should not be used where Sanitization is required, as removing one tag
# could create a new tag in the new output
def strip_tags(html):
s = HTMLRe... | {
"content_hash": "976359f1bc6158608851770ec5b2c426",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 91,
"avg_line_length": 26.96,
"alnum_prop": 0.6691394658753709,
"repo_name": "dimagi/commcare-hq",
"id": "0a6eb7e1e32178958d5fa4886a62d7492551dd3a",
"size": "674",
"binar... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('produtos', '0003_auto_20170226_2251'),
]
operations = [
migrations.AlterField(
model_name='productorder',
name='amount',
... | {
"content_hash": "927caf4fd3a56dfc1069ebd10ba288f9",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 76,
"avg_line_length": 25.52173913043478,
"alnum_prop": 0.58603066439523,
"repo_name": "tyagow/FacebookBot",
"id": "573d5431990cce4cbba94f3e454c4997540f5ecc",
"size": "660"... |
import argparse
import json
import traceback
import requests
__author__ = "Isa Bostan isabostan@gmail.com"
latitude = None # Set this if IP location lookup does not work for you (must be a string)
longitude = None
api_key= ""
plc_ids = []
class GoogleMapScrapping():
def __init__(self,**kwargs):
super(G... | {
"content_hash": "ff72e3b1d5da5e22a87f146140340be8",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 160,
"avg_line_length": 37.475,
"alnum_prop": 0.46119635312430507,
"repo_name": "rockcastle/GoogleMap-Scrapping",
"id": "582711bc4bb3b2ac2a68bb393aa26ce8f68d8246",
"size":... |
import urllib.request
import psycopg2
import sys
import time
### CRAPS OUT after a few minutes
# hits pubmed for converting pmids to dois
PMID="http://www.pubmedcentral.nih.gov/utils/idconv/v1.0/"
OPTIONS="&versions=no&format=csv"
# hits postgres for pmid ids
DBNAME="medline"
USER="postgres"
PASSWORD="P0stgr3s!"
HOS... | {
"content_hash": "ff70d316eaca7bc0e85daaed0e9ab53a",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 82,
"avg_line_length": 26.087719298245613,
"alnum_prop": 0.7041022192333557,
"repo_name": "croeder/ccp_nlp",
"id": "b18b33d70281534cddd127b9306eaf6151fbf075",
"size": "1550... |
import random
import string
from django.test import override_settings
from functools import wraps
from konfera import settings
try:
from importlib import reload
except ImportError:
from imp import reload
def random_string(length=1, unicode=False):
"""
Returns random ascii or unicode string.
"""
... | {
"content_hash": "b7ba95d5d663b1eed9414cc93b5e9941",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 97,
"avg_line_length": 30.243243243243242,
"alnum_prop": 0.6693476318141197,
"repo_name": "pyconsk/django-konfera",
"id": "184cee7800a158cbfa16be558038f778e4f7ce72",
"size"... |
"""
Basic TestCases for BTree and hash DBs, with and without a DBEnv, with
various DB flags, etc.
"""
import os
import sys
import errno
import shutil
import string
import tempfile
from pprint import pprint
import unittest
try:
# For Pythons w/distutils pybsddb
from bsddb3 import db
except ImportError:
# F... | {
"content_hash": "b6f25bf85385345f63fb879c8fcc841f",
"timestamp": "",
"source": "github",
"line_count": 948,
"max_line_length": 120,
"avg_line_length": 29.53902953586498,
"alnum_prop": 0.5100882048351962,
"repo_name": "kontais/EFI-MIPS",
"id": "155705df1d9e03b62d896d2021c3412c1c3cbde9",
"size": "28... |
from .sub_resource import SubResource
class PatchRouteFilterRule(SubResource):
"""Route Filter Rule Resource.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:param id: Resource ID.
... | {
"content_hash": "675e2c53ed695ac7702d62079fd25db2",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 91,
"avg_line_length": 40.33846153846154,
"alnum_prop": 0.6224256292906178,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "ea31c3108cedb1b68fbb16a9566e8f5d12c25f3f",
"... |
import unittest
from pants.util.memo import (
memoized,
memoized_classmethod,
memoized_classproperty,
memoized_method,
memoized_property,
per_instance,
testable_memoized_property,
)
class MemoizeTest(unittest.TestCase):
def test_function_application_positional(self):
calculati... | {
"content_hash": "62149a013d4e62807783032d38b4c5f0",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 104,
"avg_line_length": 29.150887573964496,
"alnum_prop": 0.557292195270476,
"repo_name": "patricklaw/pants",
"id": "3c81f0f98f2ff9df332d74861e359070aff68f43",
"size": "99... |
from __future__ import division
from __future__ import print_function
#from decimal import Decimal
#from clint.textui import progress
#from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
#from django.core.exceptions import ObjectDoesNotExist
#from django.contrib.contentt... | {
"content_hash": "d4d2959bca68d81d046507404c0d21bd",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 117,
"avg_line_length": 31.529968454258675,
"alnum_prop": 0.6962481240620311,
"repo_name": "seanbell/opensurfaces",
"id": "be6625a470c90f945121db0904a7394350adbcfd",
"size... |
"""SCons.Tool.sunf90
Tool-specific initialization for sunf90, the Sun Studio F90 compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20... | {
"content_hash": "fe9b608109997affa987c5503e06831f",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 113,
"avg_line_length": 34.234375,
"alnum_prop": 0.730260155180283,
"repo_name": "Distrotech/scons",
"id": "55da42a18671dbbe4bc7e6f2ebf1801153673bec",
"size": "2191",
"bi... |
class SharePointException(Exception):
pass
class UpdateFailedError(SharePointException):
def __init__(self, row, update_type, code, text):
self.row, self.update_type = row, update_type
self.code, self.text = code, text
def __str__(self):
return 'Update ({0}) to row {1} ("{2}") fai... | {
"content_hash": "f4d3462120ce62caac31ff5524d7347f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 29.5,
"alnum_prop": 0.5572033898305084,
"repo_name": "ox-it/python-sharepoint",
"id": "5d93fb8779c2285d398ee79d6c9997e8a97f61ff",
"size": "472",
"b... |
import sys
import os
import socket
includeos_src = os.environ.get('INCLUDEOS_SRC',
os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0])
sys.path.insert(0,includeos_src)
from vmrunner import vmrunner
vm = vmrunner.vms[0]
counter = 0
def is_good(line):
global counter... | {
"content_hash": "95e28c5df97d9ed4f72fe5cc6b5b9ba5",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 100,
"avg_line_length": 26.956521739130434,
"alnum_prop": 0.6419354838709678,
"repo_name": "ingve/IncludeOS",
"id": "e112d913922f79529fa97de2413caaaaf2c7cfa1",
"size": "643... |
"" # lgtm
"" # lgtm[py/line-too-long]
"" # lgtm[py/line-too-long, py/non-callable-called]
"" # lgtm[@tag:security]
"" # lgtm[@tag:security,py/line-too-long]
"" # lgtm[@expires:2017-06-11]
"" # lgtm[py/non-callable-called] because I know better than lgtm
"" # lgtm: blah blah
"" # lgtm blah blah #falsepositive
"" # lgtm ... | {
"content_hash": "540bac6888e02e5217c16442ef811bcd",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 117,
"avg_line_length": 24.03174603174603,
"alnum_prop": 0.6380449141347424,
"repo_name": "github/codeql",
"id": "17c495ff1a44ed622ff66cbb2aadb5b62b51767e",
"size": "1536",... |
"""Tests for the Binary wrapper."""
import base64
import copy
import pickle
import sys
import uuid
sys.path[0:0] = [""]
import bson
from bson.binary import *
from bson.codec_options import CodecOptions
from bson.py3compat import u
from bson.son import SON
from test import client_context, unittest
from pymongo.mongo... | {
"content_hash": "494bc41cfc1f1646e221b96be10ea6d0",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 79,
"avg_line_length": 38.97014925373134,
"alnum_prop": 0.6039831482190732,
"repo_name": "felixonmars/mongo-python-driver",
"id": "dc1ffb888782db6a238ddfcb29f3b3f58d8c4a27",... |
""""""
# =============================================================================
# IMPORTS
# =============================================================================
import numpy as np
from .core import Extractor
# =============================================================================
# EXTRACTO... | {
"content_hash": "5cba7cdc49eab3d749cfc465961f3d52",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 26.830188679245282,
"alnum_prop": 0.45218002812939523,
"repo_name": "carpyncho/feets",
"id": "e86a55f52a0cb385b6e9a1a88300b9580d4c42b1",
"size": "275... |
"""
Nonogram (Painting by numbers) in Google CP Solver.
http://en.wikipedia.org/wiki/Nonogram
'''
Nonograms or Paint by Numbers are picture logic puzzles in which cells in a
grid have to be colored or left blank according to numbers given at the
side of the grid to reveal a hidden picture. In this puzzle... | {
"content_hash": "8252835eb1dc6ab54ba3de331ad7c36f",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 100,
"avg_line_length": 25.864306784660766,
"alnum_prop": 0.609603102189781,
"repo_name": "linsicai/or-tools",
"id": "6cd95eb1e9197945802f9a4fa6ce2dd0c661eecd",
"size": "9... |
import os
import hashlib
from django.core.files.base import File
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.core.urlresolvers import reverse
from onadata.apps.main.models import MetaData
from onadata.apps.main.views import show, edit, download_metadata,\
download_media_data, delet... | {
"content_hash": "92e90ddd870b2cdde6abec6b3725e998",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 78,
"avg_line_length": 43.730909090909094,
"alnum_prop": 0.6089306502577748,
"repo_name": "jomolinare/kobocat",
"id": "d1aa77f66936061fd8723d333eec370397847434",
"size": "... |
import hashlib
import mock
from neutron.common import constants
from neutron.common import exceptions
from neutron.plugins.nicira.common import config # noqa
from neutron.plugins.nicira.common import exceptions as nvp_exc
from neutron.plugins.nicira.common import utils
from neutron.plugins.nicira import nvp_cluster
f... | {
"content_hash": "9db18a1188786618c491d04fb2bfaeed",
"timestamp": "",
"source": "github",
"line_count": 1483,
"max_line_length": 79,
"avg_line_length": 47.8671611598112,
"alnum_prop": 0.5209404538859228,
"repo_name": "kaiweifan/neutron",
"id": "eb0823f7b3810bff38942606738316d33bbee2a7",
"size": "71... |
from __future__ import unicode_literals
import warnings
from django.core import management
from django.db import transaction
from django.test import TestCase, TransactionTestCase
from .models import Article, Book
class SampleTestCase(TestCase):
fixtures = ['fixture1.json', 'fixture2.json']
def testClassFi... | {
"content_hash": "62ba9327237f363e0a1ab6f5aef51895",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 90,
"avg_line_length": 32.71186440677966,
"alnum_prop": 0.5699481865284974,
"repo_name": "eltonsantos/django",
"id": "e0a35e300db00ac4d162e89cf8560466248c42ed",
"size": "3... |
import os
import re
import io
from contextlib import contextmanager
from datetime import datetime
from invoke import task, run
VERSION_FILE = 'pytest_catchlog.py'
CHANGE_LOG_FILE = 'CHANGES.rst'
def _path_abs_join(*nodes):
return os.path.abspath(os.path.join(os.path.dirname(__file__), *nodes))
def _path_open(... | {
"content_hash": "97c95c1dc1855d84c2932ae6afff09e0",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 77,
"avg_line_length": 32.37967914438503,
"alnum_prop": 0.5844756399669695,
"repo_name": "sirex/pytest-catchlog",
"id": "e271c99311533145b4dfecaaedffb6e9db7c1d0b",
"size":... |
import os
import furl
from mako.lookup import TemplateLookup
from mfr.core import extension
from mfr.extensions.image import settings
class ImageRenderer(extension.BaseRenderer):
TEMPLATE = TemplateLookup(
directories=[
os.path.join(os.path.dirname(__file__), 'templates')
]).get_te... | {
"content_hash": "c5d7c0c3570c536dfa84ba2c755b3c62",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 108,
"avg_line_length": 30.5,
"alnum_prop": 0.6622950819672131,
"repo_name": "rdhyee/modular-file-renderer",
"id": "e30d4cdc43cbbdef6c31585af058d32384005343",
"size": "1220... |
import os
import glob
import numpy as np
import pandas as pd
from keras import backend as K
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.layers.advanced_activations import PReLU
from keras.layers.core import Dense, Dropout
from keras.layers.normalization import BatchNormalization
from keras.mo... | {
"content_hash": "f0a42d9bc25f359f24c03d9e9eabbd25",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 121,
"avg_line_length": 39.62903225806452,
"alnum_prop": 0.6502849002849003,
"repo_name": "nixingyang/Kaggle-Competitions",
"id": "55a6ee84ce1ca3ee63cc409eeca4bc7412f21c2f",... |
from django import forms
from django.conf import settings
from django.core.mail import mail_admins, send_mail
class ShowContributorContactForm(forms.Form):
first_name = forms.CharField(
max_length=50,
widget=forms.TextInput(attrs={'class':'required'}),
error_messages={'required': 'P... | {
"content_hash": "ff1e880daea58e35404a3a6b114cdb44",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 150,
"avg_line_length": 40.44642857142857,
"alnum_prop": 0.5911699779249449,
"repo_name": "praekelt/panya-show",
"id": "5d5f2249997e0287a3df513aaf38f348881363fc",
"size": "... |
import json
import tornado.web
from tornado import gen
from data.models import HotWord
from data.session_mysql import SessionCM
from spider.hot_word import capture_hot_words
__author__ = 'f0x11'
class HotWordHandler(tornado.web.RequestHandler):
def get(self):
with SessionCM() as db_session:
... | {
"content_hash": "af6b49a83d01c0237c430488017a260f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 26.708333333333332,
"alnum_prop": 0.656786271450858,
"repo_name": "f0x11/Merak",
"id": "0fa602a1bb406abf9495361895433a4711a74f4c",
"size": "688",
"... |
DASHBOARD = 'mydashboard'
# If set to True, this dashboard will not be added to the settings.
DISABLED = False
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = [
'openstack_dashboard.dashboards.mydashboard',
] | {
"content_hash": "5ca452da0ee3b9199f56e3e0563d49ec",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 67,
"avg_line_length": 27,
"alnum_prop": 0.7489711934156379,
"repo_name": "TechBK/horizon-dev",
"id": "d54b259b43d18433b81816cd31ac99bbe3a9f061",
"size": "319",
"binary": ... |
"""A client to obtain metadata and text content from bioRxiv
(and to some extent medRxiv) preprints."""
import re
import logging
import requests
import datetime
logger = logging.getLogger(__name__)
# Browser link at https://connect.biorxiv.org/relate/content/181
collection_url = 'https://connect.biorxiv.org/relate/... | {
"content_hash": "77fcf40b2180b10f149b0f20544dcd07",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 78,
"avg_line_length": 32.24652777777778,
"alnum_prop": 0.6043932378593733,
"repo_name": "bgyori/indra",
"id": "616bb06a43ee587d21a286b1b6fd11aa5b72e046",
"size": "9287",
... |
"""
Misclassification related metrics.
"""
import logging
from neon.metrics.metric import Metric
from neon.util.param import opt_param
logger = logging.getLogger(__name__)
class MisclassSum(Metric):
"""
Metric that counts the number of misclassifications made (prediction does
not match the reference ta... | {
"content_hash": "e79e668017e8940537ddf5f05124f7af",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 79,
"avg_line_length": 36.682539682539684,
"alnum_prop": 0.5430549545651233,
"repo_name": "tambetm/neon",
"id": "454e10de46218182e7dc75367f4a54e81b597eec",
"size": "5363",... |
"""
Support for API.AI webhook.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/apiai/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.const import PROJECT_NAME, HTTP_BAD_REQUEST
from homeassistant.helpers import intent, t... | {
"content_hash": "86cd7b00007f7ad9df69961eec36b18c",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 79,
"avg_line_length": 29.571428571428573,
"alnum_prop": 0.6114924993643529,
"repo_name": "LinuxChristian/home-assistant",
"id": "eb6cd0027f7e8cf85765c29c45dbc464eb9cf58f",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('visit', '0095_auto_20150903_1349'),
]
operations = [
migrations.AlterField(
model_name='student',
name='racial_identity',
... | {
"content_hash": "4b523bc1b037bda4b9e2309ee98b7ab0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 22.77777777777778,
"alnum_prop": 0.6048780487804878,
"repo_name": "koebbe/homeworks",
"id": "15026b7355a3762ac424c54be445d225075570e2",
"size": "434"... |
import os
from holland.backup.lvm.pylvm.objects import *
from nose.tools import *
from lvm_helper import *
def test_find_lv():
lv, = LogicalVolume.find('%s/%s' % (VGNAME, LVNAME))
assert lv.lv_name == LVNAME
assert lv.volume_group.vg_name == VGNAME
lv = LogicalVolume.find_one("%s/%s" % (VGNAME, LVNAME)... | {
"content_hash": "a7d48b32501f08d25d9b7016b764c061",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 78,
"avg_line_length": 31.87837837837838,
"alnum_prop": 0.6807969478592624,
"repo_name": "m00dawg/holland",
"id": "05780f7d6a9e65af481b7d5cef822ad19c1d88de",
"size": "2359"... |
import types
import logging
import asyncio
import functools
import noir.util as util
from noir.router.service_handler import ServiceHandler
from noir.router.service_rewrite import service_rewrite
logger = logging.getLogger()
__all__ = [
'register_service_handler',
]
def register_service_handler(path, handler, ... | {
"content_hash": "f679f61f71e8b942220b9bb812b75b0d",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 109,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.5888429752066116,
"repo_name": "RyouZhang/nori",
"id": "3e9de3fb2df3aeb42be127ba52f55e19e94608ca",
"size": "2445"... |
"""Represent the Netgear router and its devices."""
from __future__ import annotations
from abc import abstractmethod
import asyncio
from datetime import timedelta
import logging
from typing import Any
from pynetgear import Netgear
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ... | {
"content_hash": "7513ebac52ff1b699ec28407a97d4921",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 124,
"avg_line_length": 32.072625698324025,
"alnum_prop": 0.5828252917610173,
"repo_name": "toddeye/home-assistant",
"id": "67e573d0e920179506786213310a0e218187078d",
"siz... |
"""Bridge for using cclib data in Psi4 (http://www.psicode.org/)."""
from cclib.parser.utils import find_package
_found_psi4 = find_package("psi4")
if _found_psi4:
from psi4.core import Molecule
def _check_psi4(found_psi4):
if not found_psi4:
raise ImportError("You must install `psi4` t... | {
"content_hash": "54022ec70bb8cb1c9aede3ea009f2777",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 73,
"avg_line_length": 24.20689655172414,
"alnum_prop": 0.6267806267806267,
"repo_name": "ATenderholt/cclib",
"id": "3c99b0cc526c8123b491386e41a92256cd871312",
"size": "905... |
def calc_growth(df, df_prev, columns, years_ago=1):
for column in columns:
growth_column = "%s_growth" % column
if years_ago > 1:
growth_column = "{0}_{1}".format(growth_column, years_ago)
df[growth_column] = (df[column] / df_prev[column]) ** (1.0 / years_ago) - 1
return df
| {
"content_hash": "775b2c1bedf8b6c6da4d5845e70fcba1",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 83,
"avg_line_length": 40,
"alnum_prop": 0.575,
"repo_name": "DataViva/dataviva-scripts",
"id": "9bff0f36c817989c12e2d2f01b0d05fbc8807aac",
"size": "321",
"binary": false,... |
from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
#url(r'^graph/$', views.graph, name='graph'),
url(r'^success/$', views.success, name='success'),
url(r'^success/graph/(?P<hash>.*)/$', views.graph, name =... | {
"content_hash": "be560eceb36009fa956f6cfb50d80a0e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 71,
"avg_line_length": 37,
"alnum_prop": 0.6396396396396397,
"repo_name": "CMPUT401W17Words/WordsOverTime",
"id": "ef912edba63eb77d18beae9899564cec489f8452",
"size": "333",
... |
import simplegui
# define global variables
cntr,x,y = 0,0,0
timer_has_been_stopped = None
# define helper function format that converts time
# in tenths of seconds into formatted string A:BC.D
def format(t):
A = t // 600
B = (t%600)//100
C = (t%100)//10
D = t%10
return str(A)+":"+... | {
"content_hash": "1ddbe763caf91a7c300c6ce1abae662a",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 61,
"avg_line_length": 24.615384615384617,
"alnum_prop": 0.635625,
"repo_name": "SioJL13/Coursera-Interactive-Programming-Python",
"id": "c2368d9c1c704c81baebc4544c1cd0d4d21c... |
r"""
Example of a chi-squared distribution
---------------------------------------
Figure 3.14.
This shows an example of a :math:`\chi^2` distribution with various parameters.
We'll generate the distribution using::
dist = scipy.stats.chi2(...)
Where ... should be filled in with the desired distribution paramete... | {
"content_hash": "3694c177ae518d922040d8efb954b36d",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 79,
"avg_line_length": 33.43055555555556,
"alnum_prop": 0.6456169505608641,
"repo_name": "eramirem/astroML",
"id": "365d5f8b6dd239f323fa1800c2a758fd56c3d13a",
"size": "2407... |
import logging
import multiprocessing
import os
import signal
import subprocess
import time
import unittest
from contextlib import suppress
from subprocess import CalledProcessError
from tempfile import NamedTemporaryFile
from time import sleep
from unittest import mock
import psutil
import pytest
from airflow.except... | {
"content_hash": "45a7d55627d47c75cb5637c9a756e5a2",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 107,
"avg_line_length": 38.84102564102564,
"alnum_prop": 0.6263533139688408,
"repo_name": "bolkedebruin/airflow",
"id": "65f49a54a4178bf1d1440dc0eb45c602a646d683",
"size":... |
from functools import wraps
class InvalidResponseError(Exception):
pass
def get_backend(path):
if not path:
raise ImportError
try:
module, cls = path.rsplit('.', 1)
except ValueError:
raise ImportError
try:
from importlib import import_module
except ImportEr... | {
"content_hash": "65c09b5ee7d58eab71ffab9f19381b15",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 65,
"avg_line_length": 22.945945945945947,
"alnum_prop": 0.6219081272084805,
"repo_name": "armstrong/armstrong.apps.embeds",
"id": "40ffadb42d6e37af2ac66564334204875b72146e",... |
from __future__ import division, unicode_literals
"""
This module contains some utility functions and classes that are used in the chemenv package.
"""
__author__ = "David Waroquiers"
__copyright__ = "Copyright 2012, The Materials Project"
__credits__ = "Geoffroy Hautier"
__version__ = "2.0"
__maintainer__ = "David W... | {
"content_hash": "d52364de619dbae3d784c2bca5157bf2",
"timestamp": "",
"source": "github",
"line_count": 867,
"max_line_length": 118,
"avg_line_length": 39.49134948096886,
"alnum_prop": 0.5660504103507696,
"repo_name": "aykol/pymatgen",
"id": "af2e04d7d1a44eb1216ac2fc9cfb0a04ad2edb05",
"size": "3434... |
"""Brocade NOS Driver CLI."""
import argparse
from neutron.openstack.common import log as logging
from neutron.plugins.brocade.nos import nosdriver as nos
LOG = logging.getLogger(__name__)
class NOSCli(object):
def __init__(self, host, username, password):
self.host = host
self.username = user... | {
"content_hash": "041c87b0a9baff7f6211c4133cac7173",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 75,
"avg_line_length": 30.985714285714284,
"alnum_prop": 0.6122637159981559,
"repo_name": "CiscoSystems/quantum",
"id": "a009e3c0a8928c5ae9f3bbc0d137b852d0b67656",
"size": ... |
"""Allow users to set and activate scenes."""
from __future__ import annotations
from collections import namedtuple
import logging
from typing import Any
import voluptuous as vol
from homeassistant import config as conf_util
from homeassistant.components.light import ATTR_TRANSITION
from homeassistant.components.sce... | {
"content_hash": "538c10ea7cad738c1a67d4b2d0afddb2",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 87,
"avg_line_length": 29.830188679245282,
"alnum_prop": 0.6075268817204301,
"repo_name": "adrienbrault/home-assistant",
"id": "3173d2d8c32abf1e29f3819dfbafbca1dd12cbeb",
... |
import os
import time
import unittest
from processor import project_module
class TestProjectModule(unittest.TestCase):
base_task = {
'taskid': 'taskid',
'project': 'test.project',
'url': 'www.baidu.com/',
'schedule': {
'priority': 1,
'... | {
"content_hash": "60536d05ac1bed34b69447fa61155879",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 96,
"avg_line_length": 36.15094339622642,
"alnum_prop": 0.5258350730688935,
"repo_name": "wyrover/pyspider",
"id": "b97f6cbab5b57e408585de798176547d8695ebd1",
"size": "401... |
from google.cloud import dialogflow_v2beta1
def sample_get_fulfillment():
# Create a client
client = dialogflow_v2beta1.FulfillmentsClient()
# Initialize request argument(s)
request = dialogflow_v2beta1.GetFulfillmentRequest(
name="name_value",
)
# Make the request
response = cli... | {
"content_hash": "ecdd3cf1170666c2fd0dd74d9aba4098",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 80,
"avg_line_length": 25.57894736842105,
"alnum_prop": 0.7283950617283951,
"repo_name": "googleapis/python-dialogflow",
"id": "e9610e862f45fa93b5f5255e2e59b2b452f76890",
"... |
"""Run a recognizer using the Google Assistant Library.
The Google Assistant Library has direct access to the audio API, so this Python
code doesn't need to record audio. Hot word detection "OK, Google" is supported.
The Google Assistant Library can be installed with:
env/bin/pip install google-assistant-library=... | {
"content_hash": "02acba38f23b681453d89a369135f888",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 94,
"avg_line_length": 29.88888888888889,
"alnum_prop": 0.6976456009913259,
"repo_name": "hanmy75/voice-recognizer",
"id": "dc398a6644268b76b1adf166698ac585aba18035",
"size... |
"""
This module is used to estimate the Herfindahl-Hirschman Index, or HHI, of
chemical compounds. The HHI is a measure of how geographically confined or
dispersed the elements comprising a compound are. A low HHI is desirable
because it means the component elements are geographically dispersed.
Data/strategy from "Da... | {
"content_hash": "a5b1720a2f693d4aa08e80db1b44a026",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 82,
"avg_line_length": 29.03174603174603,
"alnum_prop": 0.5688901038819026,
"repo_name": "montoyjh/pymatgen",
"id": "d211de07635d5c932fc70c35886d199b7b5af369",
"size": "37... |
import os
import urllib
import json
import requests
def get_existing_pages():
pages = []
for root, dirs, filenames in os.walk('static'):
for f in filenames:
pages.append({urllib.unquote_plus(f[:-4]): f[:-4]})
return sorted(pages, key=lambda k: k)
def get_result_statements(responses, an... | {
"content_hash": "b7b5d35565c85808312463555763d347",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 160,
"avg_line_length": 44.75247524752475,
"alnum_prop": 0.5216814159292036,
"repo_name": "adlnet-archive/qr_bottle_demo",
"id": "96b7ee39c6ebf83e98feba149c7fecb899ff301b",
... |
__author__ = 'dmorina, megha'
from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.owner == request.user | {
"content_hash": "0a416298079be5abf12a3a5fb34c6d80",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 56,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.71,
"repo_name": "ryosuzuki/crowdsource-platform",
"id": "c6114e9b0d2837f847d77f70e849346d050b1d9d",
"size": "300"... |
from ...errors.saklientexception import SaklientException
from ..client import Client
from .resource import Resource
from .icon import Icon
from ..enums.escope import EScope
from ..enums.escriptclass import EScriptClass
from ...util import Util
import saklient
# module saklient.cloud.resources.script
class Script(Res... | {
"content_hash": "76d661b64024517c58d7a43e15773fb4",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 134,
"avg_line_length": 30.25,
"alnum_prop": 0.5578512396694215,
"repo_name": "hnakamur/saklient.python",
"id": "4c2d90936aeed137cf05dbd498de1990f42e77b0",
"size": "10682"... |
import unittest
from gbpservice.neutron.tests.unit.nfp.configurator.test_data import (
fw_test_data as fo)
from gbpservice.nfp.configurator.lib import demuxer
""" Implements test cases for demuxer of configurator.
"""
class ServiceAgentDemuxerTestCase(unittes... | {
"content_hash": "773164cf36746614c0aee7f7aed8b363",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 31.828125,
"alnum_prop": 0.6269023073146784,
"repo_name": "jiahaoliang/group-based-policy",
"id": "dd076622cb95c88490f39440dfa7f3dac29e6864",
"size":... |
from __future__ import division
import numpy as np
from menpo.shape import TriMesh
from menpo.image import MaskedImage
from menpo.transform import Scale, Translation
from menpo.transform.piecewiseaffine import PiecewiseAffine
from menpo.transform.thinplatesplines import ThinPlateSplines
from menpo.model import PCAMode... | {
"content_hash": "a4299309e971e6995729cd7ce283c25b",
"timestamp": "",
"source": "github",
"line_count": 742,
"max_line_length": 81,
"avg_line_length": 37.370619946091644,
"alnum_prop": 0.6381405748494356,
"repo_name": "jabooth/menpo-archive",
"id": "ca7d1a7f7b99e2c80cd533814277864d5eca0b16",
"size"... |
"""
This is the
"""
import csv
import zipfile
from gooey import Gooey, GooeyParser
import os
from io import TextIOWrapper
path = os.path.join(os.path.dirname(__file__), 'sample_data', 'worldcities.zip')
with zipfile.ZipFile(path) as zf:
with zf.open('worldcities.csv', 'r') as f:
reader = csv.reader(TextI... | {
"content_hash": "0792b846a0f64e732c15228dc715c184",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 92,
"avg_line_length": 28.35,
"alnum_prop": 0.5758377425044092,
"repo_name": "chriskiehl/GooeyExamples",
"id": "5304ea9294616c1d691d1b7a65eb756199eadc95",
"size": "3402",
... |
import webob
from quantum.common.wsgi import Serializer
def create_request(path, body, content_type, method='GET'):
req = webob.Request.blank(path)
req.method = method
req.headers = {}
req.headers['Accept'] = content_type
req.body = body
return req
def _network_list_request(tenant_id, forma... | {
"content_hash": "7a89708daa86e4e8140d97bb0700a2c7",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 78,
"avg_line_length": 38.49707602339181,
"alnum_prop": 0.6308673856904147,
"repo_name": "genius1611/quantum",
"id": "cd3cce0063b520eb5dd9844f64f2ba029ba5bb1c",
"size": "6... |
"""Experiment script for setting up DVS recording with Lipreading dataset.
This script uses Sacred from IDSIA lab to setup the experiment.
This allows me to configure experiment by JSON file.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
from sacred import Experiment
import os
import cPickle as pickle
import ... | {
"content_hash": "cafd68591711325b45fa9c701455a550",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 78,
"avg_line_length": 34.34532374100719,
"alnum_prop": 0.5643066610808546,
"repo_name": "duguyue100/spikefuel",
"id": "c46ca59563ebe1275b19543d6087b1eab3fd6b2d",
"size": ... |
str_to_token = {'True':True,
'False':False,
'and':lambda left, right: left and right,
'or':lambda left, right: left or right,
'(':'(',
')':')'}
empty_res = False
def create_token_lst(s, str_to_token=str_to_token):
"""create token lis... | {
"content_hash": "cb3f266215bfc8c99e06fe60b7c4b7b0",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 80,
"avg_line_length": 27.225,
"alnum_prop": 0.5725436179981634,
"repo_name": "Unicyde/Flat",
"id": "487935487c0236a2169682c75e84af1e59683cfa",
"size": "2178",
"binary": ... |
"""
A template for unsigned transactions.
The MIT License (MIT)
Copyright (c) 2013 by Richard Kiss
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... | {
"content_hash": "ae3fb59d86ce6417d06a64e6d5bbb630",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 169,
"avg_line_length": 51.71844660194175,
"alnum_prop": 0.6846254927726675,
"repo_name": "tuomassiren/proofofexistence",
"id": "c982b60828353139799a33d0ff713dc07a7d1b8d",
... |
"""Command-line flag library.
Emulates gflags by wrapping cfg.ConfigOpts.
The idea is to move fully to cfg eventually, and this wrapper is a
stepping stone.
"""
import socket
from oslo_config import cfg
from oslo_log import log
from oslo_middleware import cors
from oslo_utils import netutils
import six
from manil... | {
"content_hash": "8201a43c91d34548dfc3b9c460801f31",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 79,
"avg_line_length": 40.65482233502538,
"alnum_prop": 0.5598701460856537,
"repo_name": "vponomaryov/manila",
"id": "f9abe9148e3475fe78556d7b2a3700929c6ecd68",
"size": "8... |
"This is the locale selecting middleware that will look at accept headers"
from django.conf import settings
from django.core.urlresolvers import (is_valid_path, get_resolver,
LocaleRegexURLResolver)
from django.http import HttpResponseRedirect
from django.utils.cache import patch_... | {
"content_hash": "e26bfa0ead8a33159597bc5d26f3c1d6",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 74,
"avg_line_length": 43.65277777777778,
"alnum_prop": 0.6401527203308941,
"repo_name": "piyush82/icclab-rcb-web",
"id": "4e0a4753ce38dbd01d9d928418e42cbc956ba478",
"size"... |
from twisted.internet import reactor
import codecs
import datetime
import copy
import sys
from twisted.internet.protocol import ServerFactory
from twisted.conch import manhole, telnet, insults, recvline
from dtx.core import logger
log = logger.log(__name__)
TRANSMIT_BINARY = chr(0)
class TelnetBootstrapProtocol(te... | {
"content_hash": "4bee08d408bf6b53dcc213af981a27cb",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 155,
"avg_line_length": 42.227450980392156,
"alnum_prop": 0.6388372956909361,
"repo_name": "TigerND/dtx-core",
"id": "0b0c2915c04e2c176b149b032c7608c49ea43f28",
"size": "1... |
from setup.linux.installer import Installer
from setup.linux import setup_util
from benchmark import framework_test
from benchmark.test_types import *
from utils import header
from utils import gather_tests
from utils import gather_frameworks
from utils import verify_database_connections
import os
import shutil
impor... | {
"content_hash": "0da25cb375f33234d4738e222e4a1bba",
"timestamp": "",
"source": "github",
"line_count": 1043,
"max_line_length": 242,
"avg_line_length": 40.65388302972195,
"alnum_prop": 0.5129003348898636,
"repo_name": "valyala/FrameworkBenchmarks",
"id": "e4cad4001eed9f22d6b90798949d756e3a6bfe7f",
... |
from blinker import ANY
from future.moves.urllib.parse import urlparse
from contextlib import contextmanager
from addons.osfstorage import settings as osfstorage_settings
def create_test_file(target, user, filename='test_file', create_guid=True, size=1337):
osfstorage = target.get_addon('osfstorage')
root_nod... | {
"content_hash": "acd5e40187536b57acaa4986f1bafffa",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 95,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.6522198731501057,
"repo_name": "saradbowman/osf.io",
"id": "279f682c561bb356e91873fd502c7327ca2b32c8",
"size": "1... |
import json
import os
import re
import shlex
import struct
import warnings
from datetime import datetime
import requests
import requests.exceptions
import six
from . import constants
from . import errors
from .auth import auth
from .unixconn import unixconn
from .ssladapter import ssladapter
from .utils import utils,... | {
"content_hash": "ccc0f1a145d1cd062028b30825a5f48b",
"timestamp": "",
"source": "github",
"line_count": 1149,
"max_line_length": 79,
"avg_line_length": 36.8798955613577,
"alnum_prop": 0.5459823008849558,
"repo_name": "runcom/docker-py",
"id": "5781db69adc4eef920fac79ca83067ba7b33355d",
"size": "429... |
"""Tests for distutils.dep_util."""
import unittest
import os
from distutils.dep_util import newer, newer_pairwise, newer_group
from distutils.errors import DistutilsFileError
from distutils.tests import support
from test.support import run_unittest
class DepUtilTestCase(support.TempdirManager, unittest.TestCase):
... | {
"content_hash": "90c15db0d3e0f141314a95cf540f6c69",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 78,
"avg_line_length": 35.25,
"alnum_prop": 0.6046099290780141,
"repo_name": "anbangleo/NlsdeWeb",
"id": "c6fae39cfb1e07628e99334eccc8ab38dbad7acb",
"size": "2820",
"bina... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ITDB.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "3d907bdddcb280f32a3e038c210e9004",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 68,
"avg_line_length": 25,
"alnum_prop": 0.7066666666666667,
"repo_name": "Plaudenslager/ITDB",
"id": "f42df6864b9311dc41ddb9695b3a91d75d8b667b",
"size": "247",
"binary": ... |
class Schema(object):
"""
Represents a DynamoDB schema.
:ivar hash_key_name: The name of the hash key of the schema.
:ivar hash_key_type: The DynamoDB type specification for the
hash key of the schema.
:ivar range_key_name: The name of the range key of the schema
or None if no range... | {
"content_hash": "b4e7578a0eb923e7532035a71434fac6",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 75,
"avg_line_length": 30.5,
"alnum_prop": 0.6085245901639345,
"repo_name": "ehudmagal/robotqcapp",
"id": "34ff212a1cc7db598663ed8a18d683a4d8a0d803",
"size": "2705",
"bin... |
"""
Additional handlers for the logging package for Python. The core package is
based on PEP 282 and comments thereto in comp.lang.python.
Copyright (C) 2001-2016 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging.handlers' and log away!
"""
import logging, socket, os, pickle, struct, time, re
from sta... | {
"content_hash": "be4fa78fb392d21636d0c53ebdd699e7",
"timestamp": "",
"source": "github",
"line_count": 1493,
"max_line_length": 122,
"avg_line_length": 38.1098459477562,
"alnum_prop": 0.5718478681148722,
"repo_name": "xyuanmu/XX-Net",
"id": "34ff7a056ef54761832820dbcd3633109951813c",
"size": "5788... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'PersonLite.middle_names'
db.alter_column('contacts_and_people_personlite', 'mi... | {
"content_hash": "42eb777d35f3ee5e901263d748fb765c",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 262,
"avg_line_length": 97.9060606060606,
"alnum_prop": 0.564765235692841,
"repo_name": "evildmp/Arkestra",
"id": "e7fe5d68553778c332dbc25153e968f041f6b531",
"size": "3233... |
import astropy.coordinates as coord
import astropy.units as u
from astropy.utils.data import get_pkg_data_filename
import numpy as np
# This package
from ..gd1 import GD1Koposov10, GD1
def test_simple():
c = coord.ICRS(coord.Angle(217.2141, u.degree),
coord.Angle(-11.4351, u.degree))
c.tra... | {
"content_hash": "958abd3964ffbf4f35543ce20017587d",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 66,
"avg_line_length": 35.18181818181818,
"alnum_prop": 0.6270456503014643,
"repo_name": "adrn/gary",
"id": "450c6cce5789adbb9f7d742d4f95154d2b6c7f4d",
"size": "2336",
"b... |
import cProfile
import pstats
from config import config
def cprofile(func):
def profiled_func(*args, **kwargs):
profile = cProfile.Profile()
try:
profile.enable()
result = func(*args, **kwargs)
profile.disable()
return result... | {
"content_hash": "9c1704b953b6963621bec3cd3134c580",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 75,
"avg_line_length": 26.045454545454547,
"alnum_prop": 0.5497382198952879,
"repo_name": "SAAVY/magpie",
"id": "5ca5c4cf6d04a51af6fe2fccbf1521eb9f0b8586",
"size": "573",
... |
from nose.tools import eq_
from remo.base.templatetags.helpers import get_country_code
from remo.base.tests import RemoTestCase
class GetCountryNameTests(RemoTestCase):
def test_base(self):
eq_(get_country_code('Greece'), 'gr')
eq_(get_country_code('greece'), 'gr')
def test_country_name_does... | {
"content_hash": "1021701564ad6c32303c66cefc2a3d2a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 59,
"avg_line_length": 29.153846153846153,
"alnum_prop": 0.683377308707124,
"repo_name": "tsmrachel/remo",
"id": "2d34776c824bbe9e15a45e23c9f09ca68b981dc3",
"size": "379",
... |
"""
DBSCAN: Density-Based Spatial Clustering of Applications with Noise
"""
# Author: Robert Layton <robertlayton@gmail.com>
# Joel Nothman <joel.nothman@gmail.com>
# Lars Buitinck
#
# License: BSD 3 clause
import warnings
from numbers import Integral, Real
import numpy as np
from scipy import sparse... | {
"content_hash": "044ea26b18bed2ac27f1521969a28511",
"timestamp": "",
"source": "github",
"line_count": 446,
"max_line_length": 83,
"avg_line_length": 38.44170403587444,
"alnum_prop": 0.6437445319335083,
"repo_name": "AlexandreAbraham/scikit-learn",
"id": "0ee4690aa0f3e57e2e6f87e43b16ed16801e7568",
... |
import random
import hashlib
import collections
import hmac
def S_saltgen(g, N, P):
serverdata= collections.namedtuple('serverdata', 'salt v g N P')
salt= random.randint(0, pow(2,32))
xH= hashlib.sha256(str(salt) + str(P)).hexdigest()
x= int(xH, 16)
v= pow(g, x, N)
S_saved= serverdata(salt=sal... | {
"content_hash": "4595a84eabb700576f1214b0cfd76507",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 160,
"avg_line_length": 31.471910112359552,
"alnum_prop": 0.6283470189218137,
"repo_name": "arvinddoraiswamy/blahblah",
"id": "67626337301c31558fef400d598f980a19fefc2d",
"s... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetTicketsFromAView(Choreography):
def __init__(self, temboo_session):
"""
Cr... | {
"content_hash": "9cb4a01958a7032ff73c7cd94239b65d",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 145,
"avg_line_length": 41.014084507042256,
"alnum_prop": 0.6991758241758241,
"repo_name": "jordanemedlock/psychtruths",
"id": "59511d33e22069b68c9ad918a328797fe264cd8e",
"... |
from games.catastrophe.game_object import GameObject
# <<-- Creer-Merge: imports -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
# you can add additional import(s) here
# <<-- /Creer-Merge: imports -->>
class Job(GameObject):
"""The class representing the Job ... | {
"content_hash": "e7e7259465c53a1e3cdb328773fbab4a",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 156,
"avg_line_length": 33.8,
"alnum_prop": 0.6172052799271734,
"repo_name": "siggame/Joueur.py",
"id": "87844cca2c91bfd33f85a1c3b4a55be556194397",
"size": "2433",
"binar... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/weapon/shared_blaster_barrel_wp_muzzle_lg_s07.iff"
result.attribute_template_id = -1
result.stfName("craft_weapon_ingredients_n","blaster_barrel_l_t7")
#### BEGIN MODIFICATIONS ####
#### END MOD... | {
"content_hash": "59750955a5345b98fc107f88ae007a84",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 96,
"avg_line_length": 27.153846153846153,
"alnum_prop": 0.7138810198300283,
"repo_name": "anhstudios/swganh",
"id": "234ef0c02d08b075a3d07964433c406343c53022",
"size": "49... |
from smeuhoverride.tests import BaseTestCase
class TestTimeline(BaseTestCase):
def test_get_user_timeline(self):
response = self.client.get('/timeline/user/bob/')
self.assertEqual(response.status_code, 200)
def test_get_following_timeline(self):
self.client.login(username='bob', pass... | {
"content_hash": "233c996072a4ca9862497cdf39bf3ab4",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 60,
"avg_line_length": 34.578947368421055,
"alnum_prop": 0.6894977168949772,
"repo_name": "amarandon/smeuhsocial",
"id": "81190dd798d4a5388e1f5441eb74f1850f52f786",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.