text stringlengths 4 1.02M | meta dict |
|---|---|
import os
ignoredContent = [
"is not safe, destructor throws exception",
# "::initialise' can be const.", # ignore, because some are not const and we keep all non-const for similarity
# "::shutdown' can be const.", # ignore, because some are not const and we keep all non-const for similarity
"(style) The function '"... | {
"content_hash": "832852ae1987d92f5b81da1bde108b79",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 155,
"avg_line_length": 57.98148148148148,
"alnum_prop": 0.7623762376237624,
"repo_name": "fmwviormv/mygui",
"id": "28b26384d36b0441764242360786c5711f4b004e",
"size": "3202... |
from unittest.mock import patch
import certifi
import pytest
from pyproj.network import set_ca_bundle_path
@patch.dict("os.environ", {}, clear=True)
@patch("pyproj.network._set_ca_bundle_path")
def test_ca_bundle_path__default(c_set_ca_bundle_path_mock):
set_ca_bundle_path()
c_set_ca_bundle_path_mock.assert... | {
"content_hash": "ba6892daa087aee2e61b5391b6f7ba13",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 87,
"avg_line_length": 36.52,
"alnum_prop": 0.6900328587075575,
"repo_name": "pyproj4/pyproj",
"id": "3c559c9a9ee1cfc9148121da981d29c8c24baf93",
"size": "1826",
"binary":... |
import unittest
import os
from conans.paths import CONANFILE, CONAN_MANIFEST
from conans.util.files import save, load
from conans.model.ref import ConanFileReference
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.model.manifest import FileTreeManifest
from conans.test.tools import TestCl... | {
"content_hash": "6e881f1ecfe4c1a20ae865e87fce14d9",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 99,
"avg_line_length": 44.06666666666667,
"alnum_prop": 0.6273711160246712,
"repo_name": "dragly/conan",
"id": "4325282e9d5675ca31fb769a88c10596c306897d",
"size": "8593",
... |
'''
Dummy Socks5 server for testing.
'''
from __future__ import print_function, division, unicode_literals
import socket, threading, Queue
import traceback, sys
### Protocol constants
class Command:
CONNECT = 0x01
class AddressType:
IPV4 = 0x01
DOMAINNAME = 0x03
IPV6 = 0x04
### Utility functions
def ... | {
"content_hash": "f79c8a24ea464f41b0648bd4ac918673",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 125,
"avg_line_length": 35.12738853503185,
"alnum_prop": 0.5592021758839528,
"repo_name": "marlengit/hardfork_prototype_1_mvf-bu",
"id": "844c0c64462a97cc6c0aafe5e3254951abb... |
from abc import ABCMeta
from abc import abstractmethod
import six
class CommunicatorBase(six.with_metaclass(ABCMeta)):
'''Interface definition of all communicators.
All communicators that have compatible set of methods with this
class is supposed to work in ChainerMN's parallel computation
implementa... | {
"content_hash": "ea48ae9ceeee9857470d5b22b52ff68f",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 81,
"avg_line_length": 31.39622641509434,
"alnum_prop": 0.6171875,
"repo_name": "tkerola/chainer",
"id": "978c3e8c2073eedb80f4ee56670b0bb95876e5bb",
"size": "9984",
"bin... |
import argparse,json
parser = argparse.ArgumentParser(description='Traefik acme.json key and cert extractor utility.')
parser.add_argument('filepath', metavar='<filepath>', help='Path to acme.json')
parser.add_argument('fqdn', metavar='<FQDN>', help="FQDN to match in a certificates 'main' or 'sans' field")
# ... | {
"content_hash": "fc27d34a4fd4b0ccb63277335fd350d0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 134,
"avg_line_length": 45.13157894736842,
"alnum_prop": 0.646064139941691,
"repo_name": "tomav/docker-mailserver",
"id": "e9e207df78d358f737fd241de3c0ff0220b2b424",
"size"... |
__author__ = 'tan'
import datetime
import pytz
from boto.dynamodb2.fields import HashKey, RangeKey, GlobalKeysOnlyIndex
from boto.dynamodb2.types import STRING
from juliabox.db import JBoxDB, JBoxDBItemNotFound
class JBoxAPISpec(JBoxDB):
NAME = 'jbox_apispec'
SCHEMA = [
HashKey('api_name', data_typ... | {
"content_hash": "5212a230602681315cd38e1b2f1ce46e",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 111,
"avg_line_length": 34.107142857142854,
"alnum_prop": 0.5660732984293194,
"repo_name": "EricForgy/JuliaBox",
"id": "77349cb3a598f738756eb61c25d1e1947064bef8",
"size": ... |
"""
oommfmif: A module for calling OOMMF from Python.
"""
import os
import subprocess
import sys
from textwrap import dedent
def retrieve_oommf_path():
"""
retrieve_oommf_path()
Gets value from the environment variable oommf_path.
Returns
-------
string
Path to folder containing oomm... | {
"content_hash": "689ff8c68235a98cb029234590f0f23d",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 79,
"avg_line_length": 29.42105263157895,
"alnum_prop": 0.6195587358378056,
"repo_name": "ryanpepper/oommf-python",
"id": "cd51e48c01e3107ecbb6633f433fafb607ff866b",
"size... |
"""Support for WLED updates."""
from __future__ import annotations
from typing import Any, cast
from homeassistant.components.update import (
UpdateDeviceClass,
UpdateEntity,
UpdateEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homea... | {
"content_hash": "381c3332f317e4fd601dab72ba510a2b",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 84,
"avg_line_length": 35.7,
"alnum_prop": 0.6641767818238407,
"repo_name": "nkgilley/home-assistant",
"id": "75546fdac1a64ff43bec4e87324e7e90c15fc10d",
"size": "3213",
"... |
import omniORB
omniORB.updateModule("CosTradingRepos__POA")
# ** 1. Stub files contributing to this module
import CosTradingRepos_idl
# ** 2. Sub-modules
# ** 3. End
| {
"content_hash": "1e74bdac5318da1ea72689fbfca75685",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 46,
"avg_line_length": 18.77777777777778,
"alnum_prop": 0.727810650887574,
"repo_name": "amonmoce/corba_examples",
"id": "f4379d70a82ec4c9433262b9abd82839bbe63463",
"size": ... |
from sudo.settings import COOKIE_NAME, COOKIE_AGE
from sudo.utils import (
grant_sudo_privileges,
revoke_sudo_privileges,
has_sudo_privileges,
)
from django.core.signing import BadSignature
from django.utils.http import is_safe_url
from .base import BaseTestCase
class GrantSudoPrivilegesTestCase(BaseTes... | {
"content_hash": "13963a43f504ec84f67ae351c5b8a72b",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 82,
"avg_line_length": 31.772727272727273,
"alnum_prop": 0.6306628516928946,
"repo_name": "mattrobenolt/django-sudo",
"id": "67b4c8dcfde82e3dc8ca87ad030473b204857573",
"si... |
'''
Created on Mar 3, 2016
@author: enikher
'''
import os
def create_env():
glanceclient.Client()
if __name__ == '__main__':
create_env() | {
"content_hash": "02769b58b6c49954a9fe9d6550471bac",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 26,
"avg_line_length": 10.066666666666666,
"alnum_prop": 0.5761589403973509,
"repo_name": "nikolas-hermanns/flash-test",
"id": "90a70597613137432f705ac2e2c5ec22092bf417",
"... |
from kuyruk import Kuyruk, Config
config = Config()
config.from_pyfile('/tmp/kuyruk_config.py')
kuyruk = Kuyruk(config=config)
@kuyruk.task()
def print_message(m):
print(m)
if __name__ == '__main__':
print_message('asdf')
| {
"content_hash": "836c997aa2ca659a957825cf9df5c14b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 43,
"avg_line_length": 15.733333333333333,
"alnum_prop": 0.6567796610169492,
"repo_name": "cenkalti/kuyruk",
"id": "8e1f09bb5d1ab7a6b9ab44494e001f4e32d47dc1",
"size": "236"... |
from cms import VERSION
import platform
from setuptools import setup, find_packages
import sys
DEPENDENCIES = [
'django',
'django-suit',
'Pillow',
'django-reversion==1.8.7',
'django-historylinks',
'django-watson',
'django-extensions',
'Werkzeug',
'opbeat',
'bcrypt',
'djang... | {
"content_hash": "6a827ff399a8ad7eb377ad1589a32865",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 68,
"avg_line_length": 26.367088607594937,
"alnum_prop": 0.6197791646663466,
"repo_name": "danielsamuels/cms",
"id": "aded01ad58394d1e1b204f040208b96217767d49",
"size": "21... |
from __future__ import print_function
from __future__ import division
import os
import sys
import math
import logging
import argparse
import threading
from rpaths import PosixPath
from tej import RemoteQueue, JobNotFound, RemoteCommandFailure, JobAlreadyExists
import loading
def msg(message, *args, **kwargs):
pr... | {
"content_hash": "6ed102bd1d83cd7151a8f0e387156883",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 120,
"avg_line_length": 33.12359550561798,
"alnum_prop": 0.5293984622342831,
"repo_name": "JosuaKrause/parcell",
"id": "ea9f1389d66ab9db6b32dbd9e3e87d53d4b5badf",
"size": ... |
from twisted.internet.defer import inlineCallbacks
from twisted.internet import reactor
from twisted.internet.protocol import ClientCreator
from twisted.python import log
from txamqp.protocol import AMQClient
from txamqp.client import TwistedDelegate
from helpers import random_queue, process_config, update_or_create_... | {
"content_hash": "6461cfcfbfc3fa1c58af4cfe9b08022b",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 91,
"avg_line_length": 36.8,
"alnum_prop": 0.6101449275362318,
"repo_name": "silentrob/smart-app-update",
"id": "b2897254305a34ca17903e6bdde9d801a2e7c8b2",
"size": "2760",
... |
import mock
from flask import request
from tests.base import OsfTestCase
from website.ember_osf_web.decorators import ember_flag_is_active
from osf_tests.factories import FlagFactory, UserFactory
from django.contrib.auth.models import Group
class TestEmberFlagIsActive(OsfTestCase):
def setUp(self):
sup... | {
"content_hash": "2ff655c538311e6d2f4cefd48a1719fd",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 126,
"avg_line_length": 42.50909090909091,
"alnum_prop": 0.7031650983746792,
"repo_name": "icereval/osf.io",
"id": "ab7f5dc56e326ec95acde2bf5bc0fc5c58c8d49c",
"size": "2339... |
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django_webtest import WebTest
from testing.common import create_team
from testing.common import generate_fake_links
class TeamToolUsageTests(WebTest):
def test_list_top_tools_ordered(self):
# Create and lo... | {
"content_hash": "9996c33485248c30ef3eb0947193411a",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 76,
"avg_line_length": 26.65,
"alnum_prop": 0.5287054409005628,
"repo_name": "dstl/lighthouse",
"id": "40faf10f090ae49fd0e84e76b9e52659dbaf3e90",
"size": "2707",
"binary... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description fr... | {
"content_hash": "2ed2d7528d80ca78ad010d62ea1c4f05",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 134,
"avg_line_length": 34.63333333333333,
"alnum_prop": 0.6458132820019249,
"repo_name": "aquatix/python-utilkit",
"id": "b9e5d658c5432fdc149e056c16fdc83a1a22f6f2",
"size"... |
from distutils.core import setup, Extension
from distutils.command.build import build
import os
import sys
import setuptools
# Replicating the methods used in the RAVEN Makefile to find CROW_DIR,
# If the Makefile changes to be more robust, so should this
# We should be doing a search for CROW, I would think, we shoul... | {
"content_hash": "4e219eedc25bc361ead7564dec597ccb",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 394,
"avg_line_length": 58.74025974025974,
"alnum_prop": 0.6634976785319479,
"repo_name": "idaholab/raven",
"id": "a82a49c24798864ab9d413fdba62c9bc246e1f8b",
"size": "5112"... |
from __future__ import absolute_import
from st2common.models.db.rbac import RoleDB
from st2common.models.db.rbac import UserRoleAssignmentDB
from st2common.models.db.rbac import PermissionGrantDB
from st2common.models.db.rbac import GroupToRoleMappingDB
from st2common.persistence.rbac import Role
from st2common.persist... | {
"content_hash": "15bd8cea26842a002e17dd10921b5868",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 81,
"avg_line_length": 31.17910447761194,
"alnum_prop": 0.7161321206318813,
"repo_name": "Plexxi/st2",
"id": "d9c3fcc958a3d6639b169331325f42e7e02248ba",
"size": "2717",
"... |
import unittest, sys, random, time
sys.path.extend(['.','..','py'])
import h2o, h2o_browse as h2b, h2o_import as h2i, h2o_hosts
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
pass
print "Will build clouds with in... | {
"content_hash": "8e275363088743eef7be8aea03dc192d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 128,
"avg_line_length": 35.28888888888889,
"alnum_prop": 0.5969773299748111,
"repo_name": "janezhango/BigDataMachineLearning",
"id": "6c2e7c3f9f606e87e06fa4b3cf64043930c23fe2... |
from __future__ import unicode_literals
from django.views.generic import TemplateView
from django.contrib.auth.mixins import LoginRequiredMixin
class HomeView(LoginRequiredMixin, TemplateView):
login_url = 'accounts/login/'
redirect_field_name = 'home'
template_name = 'pages/home.html'
| {
"content_hash": "e3ee56f93cf85a5a0648977e9a0b54b5",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 57,
"avg_line_length": 30.2,
"alnum_prop": 0.7682119205298014,
"repo_name": "mjj55409/cpq-exporter",
"id": "88e2f1e97bfed56457317a32844aa0ffc82a860c",
"size": "326",
"bin... |
from pprint import pprint # pylint: disable=unused-import
from test_server import Response
# from grab.error import (
# GrabInternalError,
# GrabCouldNotResolveHostError,
# GrabTimeoutError,
# GrabInvalidUrl,
# )
from tests.util import build_grab
from tests.util import BaseGrabTestCase
class GrabReque... | {
"content_hash": "f0aa9da5617788f40e75ab8903b459d4",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 80,
"avg_line_length": 32.87234042553192,
"alnum_prop": 0.580906148867314,
"repo_name": "lorien/grab",
"id": "af9a3ef6b8f0609108640c479f068d248306cb10",
"size": "3090",
"... |
import sys
import socket
import select
import time
import re
import json
import struct
import imp
import traceback
import random
import os
import io
import inspect
import types
from collections import deque
import os
import warnings
from encodings import utf_8, ascii
try:
import thread
except ImportError:
# Ren... | {
"content_hash": "37acce07c8ea01dca1afe4e6947d48f9",
"timestamp": "",
"source": "github",
"line_count": 586,
"max_line_length": 114,
"avg_line_length": 31.638225255972696,
"alnum_prop": 0.5481121898597626,
"repo_name": "lgeiger/ide-python",
"id": "0f5c360ee0dfba815eeed0fbd55b4de553e6e599",
"size": ... |
"""
Copyright (c) 2016, Marcelo Leal
Description: Simple Azure Media Services Python library
License: MIT (see LICENSE.txt file for details)
"""
import os
import json
import azurerm
import time
#import pytz
import logging
import datetime
#################################################################################... | {
"content_hash": "94fb80646ff10f36eb292ea31d38909c",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 124,
"avg_line_length": 42.847457627118644,
"alnum_prop": 0.5628955696202531,
"repo_name": "gbowerman/azurerm",
"id": "eda08c0797e5814543b8eabc9a0d071d32fdb831",
"size": "2... |
"""Base Estimator class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import collections
import copy
import os
import tempfile
import numpy as np
import six
from google.protobuf import message
from tensorflow.contrib import layers
from te... | {
"content_hash": "cea3b3c57d4c7ffc72fba3ac8f334b2e",
"timestamp": "",
"source": "github",
"line_count": 1457,
"max_line_length": 85,
"avg_line_length": 40.29993136582018,
"alnum_prop": 0.649164637157893,
"repo_name": "mavenlin/tensorflow",
"id": "0816844df8ee6a0ebbf493a4e39ada5ad6f733b7",
"size": "... |
import numpy as np
import pandas as pd
from .base import BaseExtensionTests
class BaseDtypeTests(BaseExtensionTests):
"""Base class for ExtensionDtype classes"""
def test_name(self, dtype):
assert isinstance(dtype.name, str)
def test_kind(self, dtype):
valid = set('biufcmMOSUV')
... | {
"content_hash": "2d9f53266826363e7dae70e4dcae1902",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 62,
"avg_line_length": 30.3125,
"alnum_prop": 0.6508591065292096,
"repo_name": "louispotok/pandas",
"id": "63d3d807c270c8c5d3716af9aecfa24d5d466c97",
"size": "1455",
"bin... |
import time
import os
import random
import json
import locale
import stories
def clear():
os.system(['clear','cls'][os.name == 'nt'])
class Player(object):
def __init__(self):
self.health = 100
self.armor = 0
self.weapon = 0
self.enchantment = 0
self.level = 0
s... | {
"content_hash": "f0fcb11ec2dc019ce651be8c08845885",
"timestamp": "",
"source": "github",
"line_count": 1105,
"max_line_length": 461,
"avg_line_length": 34.335746606334844,
"alnum_prop": 0.51334967449461,
"repo_name": "shakna-israel/dragonsandheroes",
"id": "6d0ee8a4c860e769fbd82ac61bb3578189685195",... |
import os
import time
import struct
import time
from datetime import datetime, date, timedelta
from kbutils import KBCapabilities, makeFCS
from GoodFETCCSPI import GoodFETCCSPI
class TELOSB:
def __init__(self, dev):
'''
Instantiates the KillerBee class for our TelosB/TmoteSky running GoodFET firmwa... | {
"content_hash": "5b8b078b6cd2fecd43870116e13239d2",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 199,
"avg_line_length": 35.87378640776699,
"alnum_prop": 0.6148849797023004,
"repo_name": "silicrax/killerbee",
"id": "e13069b632fc4264efab8ba2174794a5612cf6e6",
"size": "... |
"""The MIT License
Copyright (c) 2007 Nigel Brady
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... | {
"content_hash": "510a2f7ff9bece0eb4c2a4f395ecedc9",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 101,
"avg_line_length": 33.50990099009901,
"alnum_prop": 0.6142709410548087,
"repo_name": "nigelbrady/OAuthVerifier",
"id": "71544bc4533dc78684dbdc4111613e48ec844a0d",
"si... |
from .device import Device
from .device_manager import DeviceManager
from .group import DeviceGroup | {
"content_hash": "af73ed3a64b6202b22a7e31aa07f1656",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 33,
"alnum_prop": 0.8484848484848485,
"repo_name": "ttaanngg/petal",
"id": "e8acc9aeec34163a79b50758bcbd060a44e70906",
"size": "99",
"binary": false... |
import json
import logging
import os
import uuid
from datetime import datetime, timedelta
from unittest.mock import patch, Mock
import yaml
from django.conf import settings
from django.contrib.auth.models import Group, User
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.geos import GEOSGeometry... | {
"content_hash": "234b43759e2b6c6d40442d978ac44560",
"timestamp": "",
"source": "github",
"line_count": 2185,
"max_line_length": 120,
"avg_line_length": 44.60228832951945,
"alnum_prop": 0.624261205056641,
"repo_name": "venicegeo/eventkit-cloud",
"id": "cbea13985878e6ebb9dd77c872425f33f56c330d",
"si... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import o3d3xx
import sys
import time
if len(sys.argv) > 1:
address=sys.argv[1]
else:
address='192.168.0.69'
pcic = o3d3xx.ImageClient(address, 50010)
pcic.debug = True
# repeatedly read frames from the proce... | {
"content_hash": "53a1f2e42269c62c589c3fb86b026e1d",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 149,
"avg_line_length": 27.17142857142857,
"alnum_prop": 0.729758149316509,
"repo_name": "cfreundl/o3d3xx-python",
"id": "eae98bf2bd5e50a06a52f95242a8dd459ed0cc60",
"size":... |
from __future__ import annotations
from datetime import datetime
import gc
import numpy as np
import pytest
from pandas._libs import iNaT
from pandas._libs.tslibs import Timestamp
from pandas.core.dtypes.common import (
is_datetime64tz_dtype,
is_float_dtype,
is_integer_dtype,
is_unsigned_integer_dty... | {
"content_hash": "b1ca01c2e7585eef4b1981727c938625",
"timestamp": "",
"source": "github",
"line_count": 873,
"max_line_length": 87,
"avg_line_length": 34.376861397479956,
"alnum_prop": 0.5653926893472393,
"repo_name": "rs2/pandas",
"id": "a8684ca4d3c25ee6191544a9a26744ec2446e06f",
"size": "30011",
... |
from urlparse import urlparse
from django import http
from django.views.decorators.csrf import csrf_exempt
from webalyzer.collector.models import Page, Stylesheet
@csrf_exempt
def collect(request):
if request.method in ('GET', 'HEAD'):
response = http.HttpResponse('Works')
response['Access-Contr... | {
"content_hash": "44b182f98f4b8a91918e5c384140e49e",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 77,
"avg_line_length": 28.447916666666668,
"alnum_prop": 0.5382643720248993,
"repo_name": "mdn/webalyzer",
"id": "bb7da0c3ae7cf18ae091d8e3e45b3356da23c6c3",
"size": "2731",... |
import re
import nova.conf
from nova.virt.libvirt import utils as libvirt_utils
from nova.virt.libvirt.volume import fs
from nova.virt.libvirt.volume import remotefs
CONF = nova.conf.CONF
USERNAME_REGEX = re.compile(r"(user(?:name)?)=(?:[^ ,]+\\)?([^ ,]+)")
class LibvirtSMBFSVolumeDriver(fs.LibvirtBaseFileSystemVo... | {
"content_hash": "66f0a289cea4e12750f0ed0b811f6503",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 75,
"avg_line_length": 39.52542372881356,
"alnum_prop": 0.6355060034305318,
"repo_name": "Juniper/nova",
"id": "8841bcb86eee1cbc952c568e87591c3c2ebf12e7",
"size": "2905",
... |
import copy
import numpy as np
import os
import pandas as pd
from datetime import datetime, timedelta
class WodProfile(object):
""" Main class to parse a WOD ASCII file
Input:
fid: File object of an open WOD ASCII file.
Output:
Each time this class is initialised it reads ... | {
"content_hash": "41f6191eba8d50c4945af36070d7aea0",
"timestamp": "",
"source": "github",
"line_count": 877,
"max_line_length": 144,
"avg_line_length": 40.43443557582668,
"alnum_prop": 0.5204026959194609,
"repo_name": "BillMills/wodpy",
"id": "ae15e52c7208da02489823cec5b03f03731d02e4",
"size": "354... |
from mindwave.parser import ThinkGearParser, TimeSeriesRecorder
import bluetooth
import time
import sys
import argparse
from mindwave.bluetooth_headset import connect_magic, connect_bluetooth_addr
from mindwave.bluetooth_headset import BluetoothError
from example_startup import mindwave_startup
description = """Simp... | {
"content_hash": "620daa6feece082b4f153f2573fd8324",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 76,
"avg_line_length": 32.72222222222222,
"alnum_prop": 0.6502546689303905,
"repo_name": "akloster/python-mindwave",
"id": "fcdec91d20444729b4363374d7b54812f7f3e8cf",
"size... |
"""
Launch a Docker image with Ubuntu and LXDE window manager, and
automatically open up the URL in the default web browser.
It also sets up port forwarding for ssh.
"""
# Author: Xiangmin Jiao <xmjiao@gmail.com>
from __future__ import print_function # Only Python 2.x
import sys
import subprocess
import time
import... | {
"content_hash": "884b30e601aad22573a11317f61f9687",
"timestamp": "",
"source": "github",
"line_count": 602,
"max_line_length": 102,
"avg_line_length": 29.64950166112957,
"alnum_prop": 0.4845089360748501,
"repo_name": "numgeom/docker-desktop",
"id": "5485d100828c55430fe25a97821e023bc2aaf645",
"size... |
import re
import os
import sys
import datetime
import json
import traceback
import requests
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
try:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
except Exception:
pass
from s... | {
"content_hash": "302a0320e2a13fdb5c8ba4a7de65a6a7",
"timestamp": "",
"source": "github",
"line_count": 1590,
"max_line_length": 134,
"avg_line_length": 41.99245283018868,
"alnum_prop": 0.5238287802540139,
"repo_name": "PanDAWMS/panda-jedi",
"id": "d4427815763a67453b5f50ebdcb1344017595d2e",
"size":... |
import requests
from core.cache.tokencache import TokenCache
class WdAPI(self):
baseURL = 'https://api.vdian.com/api'
_token_cache = TokenCache()
def fetch
def getAccessToken(self):
return _token_cache.get_cache(self._token_cache.KEY_WD_ACCESS_TOKEN)
| {
"content_hash": "d93b7be0320c842723b128781d95f4b9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 76,
"avg_line_length": 23.916666666666668,
"alnum_prop": 0.6829268292682927,
"repo_name": "Maru-zhang/FilmHub-Tornado",
"id": "73e01f6328cd15cccec475afd07886d615a2b35c",
"s... |
from __future__ import print_function
import argparse
import socket
import random
import capnp
import calculator_capnp
def read_value(value):
'''Helper function to asynchronously call read() on a Calculator::Value and
return a promise for the result. (In the future, the generated code might
include some... | {
"content_hash": "909104af4c32fb2b7ccece0090cc7353",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 113,
"avg_line_length": 31.5,
"alnum_prop": 0.6648263170002301,
"repo_name": "zielmicha/capnp.nim",
"id": "a1bf926ab1754e08ec7144c111c61cf6d77c1819",
"size": "4405",
"bi... |
try:
import pyclamd
HAVE_CLAMD = True
except ImportError:
HAVE_CLAMD = False
from viper.common.abstracts import Module
from viper.core.session import __sessions__
class ClamAV(Module):
cmd = 'clamav'
description = 'Scan file from local ClamAV daemon'
authors = ['neriberto']
def __init__(... | {
"content_hash": "3f63f22b60a104c0b6a92ddca26b94f8",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 110,
"avg_line_length": 30.366197183098592,
"alnum_prop": 0.5320037105751392,
"repo_name": "MeteorAdminz/viper",
"id": "0d2859e4a36d3305738516511acbb683745141b1",
"size": "... |
from parser import parse_prefix
class Limit_Plugin:
""" Plugin to control which users can use which commands.
Saves list of commands and their permissions to limit.cfg
in format "command regexp".
"""
def __init__(self, mib, params=None):
self.mib = mib
self.mib.register_pri... | {
"content_hash": "ca96684c0273dc4b8db9fabb313ee360",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 77,
"avg_line_length": 28.75,
"alnum_prop": 0.5125858123569794,
"repo_name": "aalien/mib",
"id": "05f3cf9d6024091f3e9aecb96c2616be2e261a5d",
"size": "2185",
"binary": fal... |
def dist(a, b, limit=None):
return BerghelRoach(a).getDistance(b, limit or len(a) + len(b))
# This is a modification of the original Berghel-Roach edit
# distance (based on prior work by Ukkonen) described in
# ACM Transactions on Information Systems, Vol. 14, No. 1,
# January 1996, pages 94-106.
#
# I observe... | {
"content_hash": "c079d986eacf600dae303708e6626212",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 86,
"avg_line_length": 41.428969359331475,
"alnum_prop": 0.6230081355476367,
"repo_name": "madhusudancs/test-infra",
"id": "37f6b4822129c4c55e3626a56a2fda6f20dc0299",
"siz... |
import functools
import operator
from chainer.functions.normalization import layer_normalization
from chainer import link
from chainer import variable
class LayerNormalization(link.Link):
"""Layer normalization layer on outputs of linear functions.
.. warning::
This feature is experimental. The in... | {
"content_hash": "ce3a81998801e7c365d2cc59b67f252f",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 35.75,
"alnum_prop": 0.6356976356976357,
"repo_name": "anaruse/chainer",
"id": "b70dde2f9c8b7975030b5e719006feee5a1569d8",
"size": "3003",
"binary"... |
def connected_components(self):
"""
Connected components determines groups all the vertices in a particular graph
by whether or not there is path between these vertices. This method returns
a frame with the vertices and their corresponding component
Parameters
----------
:return: (Frame) ... | {
"content_hash": "e0d49c3d8e1f008945a6720d27257b27",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 81,
"avg_line_length": 31.44736842105263,
"alnum_prop": 0.5188284518828452,
"repo_name": "dmsuehir/spark-tk",
"id": "860dc34e491390258cfa08a8c11e5d45f5a11f10",
"size": "190... |
import pipeCore.common as common
import pipeCore.config as pcConfig
def outputMayaSetVars():
mayaVersion = pcConfig.getProjectMayaVersion(common.CLIENT, common.PROJECT)
mayaExePath = pcConfig.getProjectMayaExePath(common.CLIENT, common.PROJECT)
mayaBatchExePath = pcConfig.getProjectMayaBatchExePath(common.CLIENT, ... | {
"content_hash": "816947db20fe06dc7a4cbe71e080c44a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 88,
"avg_line_length": 46.125,
"alnum_prop": 0.7768744354110207,
"repo_name": "wgergely/After-Effects",
"id": "045cead16c9218fc62b1a97be4f7d17042d74f30",
"size": "1107",
... |
"""A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirectly). Since... | {
"content_hash": "a5be49e61cf9f8caea58135366ef52a3",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 80,
"avg_line_length": 35.79381443298969,
"alnum_prop": 0.6661866359447005,
"repo_name": "kevinmel2000/brython",
"id": "12c2c8751f6157399fe26d7ccd5dda9a129b9481",
"size": "... |
import numpy as np
import code
from imagernn.utils import merge_init_structs, initw, accumNpDicts
from imagernn.lstm_generator import LSTMGenerator
from imagernn.rnn_generator import RNNGenerator
def decodeGenerator(generator):
if generator == 'lstm':
return LSTMGenerator
if generator == 'rnn':
return RNNG... | {
"content_hash": "13d5b14ac71d41192d173e3bf6235428",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 131,
"avg_line_length": 37.26143790849673,
"alnum_prop": 0.6576039291352395,
"repo_name": "sethuiyer/mlhub",
"id": "0dc1e6251bff513ce35e6663ab635ebcf0b388c8",
"size": "570... |
"""
Build a half-adder quantum circuit that takes two bits as input,
encodes them into qubits, then runs the half-adder circuit calculating
the sum and carry qubits, observed over 1000 runs of the experiment
.
References:
https://en.wikipedia.org/wiki/Adder_(electronics)
https://qiskit.org/textbook/ch-states/atoms-com... | {
"content_hash": "3b9dc19b95b1586328b174f422f5d317",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 88,
"avg_line_length": 26.275862068965516,
"alnum_prop": 0.6253280839895013,
"repo_name": "wuweilin/python",
"id": "4af704e640be4ba3693aba377d7db6ac498f1931",
"size": "1547... |
import sys
import socket
import paramiko
import ConfigParser
from time import sleep
#=================================
# Class: PySSH
#=================================
class pySSH(object):
def __init__ (self):
self.ssh = None
self.transport = None
self.ftp = None
def disconne... | {
"content_hash": "e065581e3cb9678aac54f74fe2b942e3",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 85,
"avg_line_length": 33.21052631578947,
"alnum_prop": 0.5804278922345484,
"repo_name": "satroutr/pod-cloud",
"id": "629cf99b86f68db4dfaaedb96b9aa0cd0b64f3f3",
"size": "25... |
from InputManager import *
from CharMaps import STANDARD_ALLOWED_KEYCODES as CASE_INSENSITIVE_KEYCODE_MAP | {
"content_hash": "f4c5ea867de11592ca904369b81e9ffd",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 78,
"avg_line_length": 27.5,
"alnum_prop": 0.8181818181818182,
"repo_name": "tectronics/enso",
"id": "fcdf92510862d61c9b55c76a1b2e08b0bd5e9ac7",
"size": "165",
"binary": f... |
"""Handlers for custom HTML tags."""
__author__ = 'John Orr (jorr@google.com)'
import inspect
import logging
import mimetypes
import os
import pkgutil
from xml.etree import cElementTree
import html5lib
import safe_dom
import webapp2
import appengine_config
from common import schema_fields
from extensions import ta... | {
"content_hash": "6fee366a7d8b08af1b630a06395f5717",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 80,
"avg_line_length": 36.21739130434783,
"alnum_prop": 0.6402561024409764,
"repo_name": "wavemind/mlgcb",
"id": "02ca8a1b31826a4b8339c29c62689b7947b014ab",
"size": "15592... |
"""
Very simple module to solve linear equation systems in finite fields.
Author: Ivo Kubjas
BSD 2-Clause License
"""
import numpy as np
from gmpy import mpz, invert
import pdb # XXX: Delete when done
from math import floor
def solve_bottom(mat, base):
localmat = mat.copy()
n, m = mat.shape
for i in ra... | {
"content_hash": "e35c2bd933ce052ca1beb5483047a400",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 93,
"avg_line_length": 29.071428571428573,
"alnum_prop": 0.5761670761670762,
"repo_name": "ivokub/polyrecon",
"id": "baa3efb87beb29054467496fcc2be3330d41eff5",
"size": "40... |
from bingads.v13.bulk.entities.audiences.bulk_ad_group_audience_association import BulkAdGroupAudienceAssociation
class BulkAdGroupInMarketAudienceAssociation(BulkAdGroupAudienceAssociation):
""" Represents an Ad Group In Market Audience Association that can be read or written in a bulk file.
For more informa... | {
"content_hash": "4b62c818a6503072d68c592884d1c874",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 120,
"avg_line_length": 41,
"alnum_prop": 0.7543554006968641,
"repo_name": "bing-ads-sdk/BingAds-Python-SDK",
"id": "bee26cf6c665c697eb50bc08736ce8a83e6215ab",
"size": "574... |
"""
get_terminal_size() -- return width and height of terminal as a tuple
code from:
http://stackoverflow.com/questions/566746/how-to-get-console- window-width-in-
python
written by
Harco Kuppens (http://stackoverflow.com/users/825214/harco-kuppens)
It is mentioned in the stackoverflow response that this code works
... | {
"content_hash": "e581ae8cd40a37ee9fba5df99491b824",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 79,
"avg_line_length": 28.351724137931033,
"alnum_prop": 0.5757723181707614,
"repo_name": "ryfeus/lambda-packs",
"id": "52262ea05bf96336ce9e5577992821374c7b7548",
"size": ... |
import numpy as np
import pytest
from pandas import DataFrame, SparseDataFrame, SparseSeries
from pandas.util import testing as tm
@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.xfail(reason="Wrong SparseBlock initialization (GH#17386)")
def test_quantile():
# GH 17386
data = [[1, 1]... | {
"content_hash": "39d86a6edf95504a3c438b14b18d7f8b",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 72,
"avg_line_length": 30.146341463414632,
"alnum_prop": 0.6974110032362459,
"repo_name": "toobaz/pandas",
"id": "fae879b3d33b598ea57c9c18f9d9b7d4fb0d12f0",
"size": "1236",... |
"""Support for Homekit Alarm Control Panel."""
from __future__ import annotations
from typing import Any
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import Service, ServicesTypes
from homeassistant.components.alarm_control_panel import (
AlarmControlPanelEntit... | {
"content_hash": "2f62335e31b4d6509ec1c696a091f9f5",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 88,
"avg_line_length": 32.53658536585366,
"alnum_prop": 0.6766616691654173,
"repo_name": "toddeye/home-assistant",
"id": "c7e499b6e89e6ba7a6d15dc67844b24ddc173171",
"size"... |
import pickle
from athletelist import AthleteList
def get_coath_data(fileName):
try:
with open(fileName) as myfile:
data = myfile.readline()
templ = (data.strip().split(','))
return (AthleteList(templ.pop(0), templ.pop(0),templ))
except IOError as ioerr:
print ('IOE... | {
"content_hash": "d24b1383f2e9e0cfbfcca4b6b2859ddb",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 62,
"avg_line_length": 26.761904761904763,
"alnum_prop": 0.5951957295373665,
"repo_name": "ColorPenBoy/PythonClass",
"id": "e946c63e0df0157957b3444644dc3fdf9d77faf2",
"size... |
import ctypes
import time
from .tmex import *
from .system import ISPYTHON3, iteritems
from datetime import datetime
if not ISPYTHON3:
import binascii
DEVICEINFO = {
0x01: ("DS1990A", "Serial Number iButton"),
0x10: ("DS18S2", "High-Precision 1-Wire Digital Thermometer"),
0x26: ("DS2438"... | {
"content_hash": "180ce63fc1b0f13efb707cc9fd2f6d95",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 205,
"avg_line_length": 37.080128205128204,
"alnum_prop": 0.5201832483360705,
"repo_name": "valnoverm/pytmex-git",
"id": "59c6de2d21cce3a153dce74e6a1359d617983f38",
"size"... |
import numpy as np
import matplotlib.pyplot as plt
centers = np.load("model.npy")
data_dir = "/home/bsprague/Projects/CS589/MovieLens/Data/"
Items = np.load(data_dir + "items.npy")
Genres = np.load(data_dir + "genres.npy")
genresSub = [np.zeros(19),np.zeros(19),np.zeros(19)]
genresTotal = [np.zeros(19),np.zeros(... | {
"content_hash": "ceb2b4b05e5b2fb1969dbeb6fb3630c0",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 83,
"avg_line_length": 32.93103448275862,
"alnum_prop": 0.6607329842931937,
"repo_name": "bcspragu/Machine-Learning-Projects",
"id": "f574c903faf9ead7cdbe49c0ec4643fa795804c5... |
from unittest import TestCase
from unittest.mock import patch
from easy2fa import cli
class TestCheckInput(TestCase):
@patch('builtins.input')
def test_default(self, mock_input):
mock_input.return_value = ''
self.assertEquals(cli.check_input('prompt', default='one'), 'one')
mock_input... | {
"content_hash": "448458ff564c3b9a4407c62a322e258b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 74,
"avg_line_length": 35,
"alnum_prop": 0.6148571428571429,
"repo_name": "lutostag/easy2fa",
"id": "86acd82b514b30458fa54cefc7db6d72f32e8646",
"size": "875",
"binary": f... |
import pytest
from dcicutils.qa_utils import notice_pytest_fixtures
from ..util import delay_rerun
from .workbook_fixtures import app_settings, app, workbook
# NOTE WELL: Even though app_settings and app are not autouse fixtures, they must be imported.
# Removing these will not cause fixtures by those names not to ... | {
"content_hash": "72b8ec56be4ad29500edfb0f4796b682",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 96,
"avg_line_length": 43.45945945945946,
"alnum_prop": 0.6635572139303483,
"repo_name": "hms-dbmi/fourfront",
"id": "c59ab7cc069fa50789ad009a716b6c7356b77161",
"size": "32... |
import redis
from django.conf import settings
from django_haikus.models import BaseHaikuText
class BigramHistogram:
def __init__(self, *args, **kwargs):
self.model = BaseHaikuText.get_concrete_child()
redis_conf = getattr(settings, 'REDIS', False)
if redis_conf:
client = redis.... | {
"content_hash": "3d2c90db3613bd2c774cea8d021558a5",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 80,
"avg_line_length": 30.276923076923076,
"alnum_prop": 0.5564024390243902,
"repo_name": "wieden-kennedy/django-haikus",
"id": "b859291ac8671607f85fe2cce9395013d2fd596e",
... |
import pkg_resources
try:
pkg_resources.get_distribution('numpy')
except pkg_resources.DistributionNotFound:
numpyPresent = False
print("Error: Numpy package not available.")
else:
numpyPresent = True
import numpy as np
try:
pkg_resources.get_distribution('pandas')
except pkg_resources.Distri... | {
"content_hash": "06e08e95242c8b8fdcae0bf150388e59",
"timestamp": "",
"source": "github",
"line_count": 1124,
"max_line_length": 242,
"avg_line_length": 53.77669039145908,
"alnum_prop": 0.5408884109521053,
"repo_name": "lvphj/epydemiology",
"id": "1e3d39b0d572d4118ca625dcd56563065341d2a6",
"size": ... |
from primes import sieve
primes = sieve()
result = 0
for prime in primes:
if prime > 2000000:
break
result += prime
print result, prime
| {
"content_hash": "2712f8db9d2a25e920e97221802d54ab",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 24,
"avg_line_length": 13,
"alnum_prop": 0.6474358974358975,
"repo_name": "jreese/euler",
"id": "dfb0fdad466f86ef89a27e1ee22478ae7c8b2c1d",
"size": "157",
"binary": false... |
from __future__ import absolute_import
import sys
from google.api_core.protobuf_helpers import get_messages
from google.cloud.vision_v1p3beta1.proto import geometry_pb2
from google.cloud.vision_v1p3beta1.proto import image_annotator_pb2
from google.cloud.vision_v1p3beta1.proto import product_search_pb2
from google.cl... | {
"content_hash": "b0698552fe673c90490db16244ab4363",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 74,
"avg_line_length": 29.385964912280702,
"alnum_prop": 0.7385074626865672,
"repo_name": "tseaver/google-cloud-python",
"id": "c075adb06aa4739006fdb2692cc2ef4102f270f0",
"... |
from app import create_app, db
from app.models import Article , Category, User
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
app = create_app('default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
if __name__ == '__m... | {
"content_hash": "0727d2a7605434be63bc1dc574d53411",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 53,
"avg_line_length": 24.714285714285715,
"alnum_prop": 0.7283236994219653,
"repo_name": "Millyn/Flask_blog",
"id": "c4ac1d7768346d087d08190c46bb13ed830eb589",
"size": "36... |
import unittest
import numpy as np
import tensorboard
import torch
from monai.visualize import make_animated_gif_summary
class TestImg2Tensorboard(unittest.TestCase):
def test_write_gray(self):
nparr = np.ones(shape=(1, 32, 32, 32), dtype=np.float32)
summary_object_np = make_animated_gif_summary... | {
"content_hash": "0e4d1485cb14ef33282643dd1e2b9fdf",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 106,
"avg_line_length": 36,
"alnum_prop": 0.6519097222222222,
"repo_name": "Project-MONAI/MONAI",
"id": "58c4d3cfabb532933b8d04403e4e8baebfa372b2",
"size": "1726",
"binar... |
"""Tests for the Google Assistant integration."""
DEMO_DEVICES = [{
'id':
'light.kitchen_lights',
'name': {
'name': 'Kitchen Lights'
},
'traits': [
'action.devices.traits.OnOff', 'action.devices.traits.Brightness',
'action.devices.traits.ColorSpectrum',
'action.devic... | {
"content_hash": "725784d526c0ecf8974f0435f677811e",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 78,
"avg_line_length": 24.205882352941178,
"alnum_prop": 0.5508809234507898,
"repo_name": "HydrelioxGitHub/home-assistant",
"id": "03cc327a5c51f775c3e305b5501074f0908f2bf7",... |
"""
robo.tests.test_misawa_handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for robo.handlers.misawa.
:copyright: (c) 2016 Shinya Ohyanagi, All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import os
import logging
import requests
from mock import patch
from unittest import TestCa... | {
"content_hash": "ebb11ee5428fa92fc2ab5acfe532da57",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 77,
"avg_line_length": 29.719101123595507,
"alnum_prop": 0.629867674858223,
"repo_name": "heavenshell/py-robo-misawa",
"id": "7878889163f8e14df9aab62a0f8f99696ce465e0",
"si... |
from unittest import TestCase, main
from datetime import datetime
from qiita_core.exceptions import IncompetentQiitaDeveloperError
from qiita_core.qiita_settings import qiita_config
from qiita_core.util import qiita_test_checker
import qiita_db as qdb
# ----------------------------------------------------------------... | {
"content_hash": "e262f1a78be2b64292f8f94055be08b7",
"timestamp": "",
"source": "github",
"line_count": 911,
"max_line_length": 79,
"avg_line_length": 42.50054884742042,
"alnum_prop": 0.5911204091120409,
"repo_name": "antgonza/qiita",
"id": "23663046d21b3eaca58039e45ae0475d41c57aae",
"size": "38718... |
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
def test_zabbixagent_running_and_enabled(Service, SystemInfo):
zabbixagent = Service("zabbix-agent")
assert zabbixagent.is_running
# Find out why it fails on debian
... | {
"content_hash": "2f15fbd3a098d318a723dfe2b15e9c56",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 79,
"avg_line_length": 31.704545454545453,
"alnum_prop": 0.7089605734767025,
"repo_name": "bititanb/ansible-taskmngr",
"id": "874c51ca274778ebae37063734f9b4358079b72c",
"si... |
import json
from webob import Request
class PrintJsonMiddleware(object):
""" JSON prettyprinter WSGI middleware.
If a special query parameter (by default "pj", for "Print JSON")
is found in the query string, assume the response body contains JSON data
which should be "printed" to the response as text/p... | {
"content_hash": "07e40b7ece40943dcaf62259df1cdc17",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 37.064516129032256,
"alnum_prop": 0.5918189730200174,
"repo_name": "sbrauer/print_json_middleware",
"id": "5a755b46deec2acf1cb32448b23c9d82e92a14c3",
... |
import sys
if "--noxp" in sys.argv:
import win32gui
else:
import winxpgui as win32gui
import win32gui_struct
import win32api
import win32con, winerror
import struct, array
import commctrl
import Queue
import os
IDC_SEARCHTEXT = 1024
IDC_BUTTON_SEARCH = 1025
IDC_BUTTON_DISPLAY = 1026
IDC_LISTBOX = 1027
WM_SEAR... | {
"content_hash": "acb9ccad942f0b6f424e4588fd79a746",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 172,
"avg_line_length": 40.00840336134454,
"alnum_prop": 0.5939228453406147,
"repo_name": "PopCap/GameIdea",
"id": "4cf1fb13bb7b2249d5d107fb7ecd6197c03ba269",
"size": "148... |
from corehq.motech.repeaters.utils import RepeaterMigrationHelper
from corehq.motech.dhis2.repeaters import SQLDhis2EntityRepeater
class Command(RepeaterMigrationHelper):
@classmethod
def couch_doc_type(cls):
return 'Dhis2EntityRepeater'
@classmethod
def sql_class(cls):
return SQLDhi... | {
"content_hash": "4f7271f0f185f6c28ca131c0b7b61860",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 30.13888888888889,
"alnum_prop": 0.6156682027649769,
"repo_name": "dimagi/commcare-hq",
"id": "35d8ef95ca15ace26821b21cab37b69c01fbdb37",
"size": "10... |
import getpass
import mycuinfo
# fix for python 3.x
try:
raw_input = input
except NameError:
pass
# define the username & password for the cuSession
user0 = raw_input("username: ")
pass0 = getpass.getpass("password: ")
# create the cuLog Session
cu_student = mycuinfo.CUSession(user0, pass0)
# if the loggin ... | {
"content_hash": "83513dcc15ba5fc77a658e2da5819951",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 77,
"avg_line_length": 24.727272727272727,
"alnum_prop": 0.6911764705882353,
"repo_name": "719Ben/myCUinfo-API",
"id": "1712ba97b14b096c6c2db4bf808cfcafdc4f023d",
"size": "... |
from __future__ import absolute_import, unicode_literals
import os
import pytest
from IPython.display import display
from psd_tools.psd.descriptor import (
TYPES, Descriptor, Reference, Double, String, Bool, LargeInteger, Integer,
UnitFloat
)
from psd_tools.terminology import Unit
from ..utils import check_wr... | {
"content_hash": "d1ac8a48e4a94550eed7e360e345ac70",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 25.620253164556964,
"alnum_prop": 0.6635375494071146,
"repo_name": "psd-tools/psd-tools",
"id": "c8c1a8968766902dce585d6d2d777309f2421335",
"size": "... |
import acq4.pyqtgraph as pg
import numpy as np
import acq4.pyqtgraph.opengl as gl
import acq4.Manager
import acq4.analysis.atlas.CochlearNucleus as cn
man = acq4.Manager.getManager()
initialized = False
def __reload__(old): ## re-use existing objects if module is reloaded
global initialized, w, v, atlas
ini... | {
"content_hash": "60cee48d81e516e740b68ae2f92d1daf",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 204,
"avg_line_length": 38.63636363636363,
"alnum_prop": 0.5790950226244344,
"repo_name": "hiuwo/acq4",
"id": "8c38ed9f60881d1bf6b8c2c56014647389ee1ada",
"size": "11076",
... |
import os
import sys
import yaml
try:
from functools import lru_cache
except ImportError:
from backports.functools_lru_cache import lru_cache
from trello import TrelloClient, Unauthorized
class TrelloConnector(object):
"""
Retrieves trello credentials if they exist.
TODO: creates trello credentia... | {
"content_hash": "baabc09eb5f8ab307e86e28d47e8a44d",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 107,
"avg_line_length": 34.56164383561644,
"alnum_prop": 0.5830360681728102,
"repo_name": "DataKind-SG/test-driven-data-cleaning",
"id": "3d4127326785a8b2e5b8d4a4f660b396f020... |
from setuptools import find_packages, setup
setup(name='simplewheel',
version='1.0',
packages=find_packages()
)
| {
"content_hash": "152051316933b59f9fde21a7cabf0584",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 43,
"avg_line_length": 21.833333333333332,
"alnum_prop": 0.6564885496183206,
"repo_name": "zvezdan/pip",
"id": "f54a4502c5d8dc6bb66046830598bd5f842555b8",
"size": "153",
"... |
class SomeClass(object):
def __init__(self):
pass
def some_method(self):
pass
class NewClass(object):
def new_method(self):
pass
| {
"content_hash": "e6eb58a851cb8b3aaad68205b4422ea7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 26,
"avg_line_length": 16.7,
"alnum_prop": 0.5688622754491018,
"repo_name": "mkwiatkowski/pythoscope",
"id": "e328c2408d1efb4e8962c764f1ba877b1178b3a5",
"size": "167",
"b... |
from django.http import HttpResponseRedirect, Http404, HttpResponseBadRequest, HttpResponse
from django.shortcuts import get_object_or_404
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django.core.serializers.json import DjangoJSONEncoder
fro... | {
"content_hash": "6bddd906e11bb369a630e1fbf065f8fc",
"timestamp": "",
"source": "github",
"line_count": 1380,
"max_line_length": 120,
"avg_line_length": 39.82028985507247,
"alnum_prop": 0.5896600669675353,
"repo_name": "django-danceschool/django-danceschool",
"id": "7f14f2644d33185a673f38ebd9d6466f4d... |
from django.contrib import admin
from .models import post
admin.site.register(post)
| {
"content_hash": "3a2620d005966c829bc2ad43d66132b1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 32,
"avg_line_length": 17.2,
"alnum_prop": 0.8023255813953488,
"repo_name": "Udayraj123/dashboard_IITG",
"id": "254909a9fd474e98688c31136dd8c0ea86be0e25",
"size": "86",
"b... |
"""
Contains the logic behind creating and configuring new plots
from a set of user-supplied arguments.
"""
# Standard library imports
import re
# Major library imports
from numpy import all, array, arange, asarray, reshape, shape, transpose
# Chaco imports
from chaco.api import (create_line_plot, create_scatter_plo... | {
"content_hash": "9a4f759079ba54a72076815934486260",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 101,
"avg_line_length": 32.39088729016787,
"alnum_prop": 0.5578588879840083,
"repo_name": "ContinuumIO/chaco",
"id": "64fd3f21ba491f50ee436032c8fa986015c89381",
"size": "1... |
import urllib2
import urllib
import json
######
#
# cd ~/sc/showcase-workshop-apis/rest-api/simple-example/
# ./rest-api-sample.py
#
#####
### CONFIGURE HERE
DEV_KEY = 'XXX'
### END CONFIGURATION
dst_url = 'https://app.showcaseworkshop.com/api/v1/data'
access_token_part = '?access_token=' + DEV_KEY
#
# Add some... | {
"content_hash": "b9d7895d19a0b36aaf8b2a958e9a2e16",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 68,
"avg_line_length": 24.02912621359223,
"alnum_prop": 0.5846464646464646,
"repo_name": "ShowcaseSoftwareLtd/showcase-workshop-apis",
"id": "9052c88ebf9b077b603fbadc87702e9... |
"""`main` is the top level module for your Flask application."""
__author__ = 'rohitsm'
__page__ = 'https://github.com/rohitsm/spsoldboys'
# Python
import urllib2
import json
import sys
import cgi
# Flask
from flask import Flask
from flask import request, redirect, url_for
from flask import render_template
# App En... | {
"content_hash": "a257d38d094d6e393ccc37a710c8db76",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 102,
"avg_line_length": 30.611510791366907,
"alnum_prop": 0.5945945945945946,
"repo_name": "rohitsm/spsoldboys",
"id": "59d576430d651f0f7b93ba1ca0a67df228911f26",
"size": ... |
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundEr... | {
"content_hash": "15e1b66f4b8e3308b9e716d1a1f0e98e",
"timestamp": "",
"source": "github",
"line_count": 1145,
"max_line_length": 190,
"avg_line_length": 48.73187772925764,
"alnum_prop": 0.6367790960249471,
"repo_name": "Azure/azure-sdk-for-python",
"id": "b7ab2e3e848b14d24c3f515bc41bf90da08dc05f",
... |
from twisted.internet import reactor
from autobahn.wamp1 import protocol as wamp
from autobahn.twisted.websocket import listenWS
from pubsubclub import (
ConsumerMixin, ProducerMixin, ConsumerServer, ProducerClient, consul,
)
class WampServerProtocol(wamp.WampServerProtocol):
def onSessionOpen(self):
... | {
"content_hash": "ae548a245ec8d9092e4885e6c81b0eb9",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 78,
"avg_line_length": 27.728813559322035,
"alnum_prop": 0.6552567237163814,
"repo_name": "luhn/pubsubclub",
"id": "97355aa1367153d891cf233b418caa2d0403b0f4",
"size": "1636... |
"""
The MIT License (MIT)
Copyright (c) 2015 Christian Uhsat <christian@uhsat.de>
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 u... | {
"content_hash": "f954e50fe154a4c3b68e10241d038719",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 78,
"avg_line_length": 28.16216216216216,
"alnum_prop": 0.7111324376199616,
"repo_name": "cuhsat/tinycrypt",
"id": "a19c0ffa3d44fa52d3602caf9b73b99b7a35d6a8",
"size": "2106... |
import time
script = u'''
// Time stamp: %s
// (This ensures the source text is *not* a byte-for-byte match with any
// previously-fetched version of this script.)
// This no-op fetch handler is necessary to bypass explicitly the no fetch
// handler optimization by which this service worker script can be skipped.
add... | {
"content_hash": "63fb300b0845aa1bf7dbbc25a7cd46e6",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 77,
"avg_line_length": 27.541666666666668,
"alnum_prop": 0.6959152798789713,
"repo_name": "chromium/chromium",
"id": "64914a9dfe5f13d7ae0f6b97ce8d18a5b46c30b4",
"size": "66... |
from __future__ import division
if __name__ == '__main__':
import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)
import json
import os
import platform
import string
import subprocess
import sys
import threading
from PyQt4 import QtCore, QtGui
encode_list = [['\xe2\x80\x90', '-'],
[... | {
"content_hash": "fef3897792bbf052aa469c542e3f9b16",
"timestamp": "",
"source": "github",
"line_count": 1152,
"max_line_length": 199,
"avg_line_length": 40.85503472222222,
"alnum_prop": 0.5674280250717093,
"repo_name": "hjanime/VisTrails",
"id": "ad17e14b19552878b30b72f3be42c050faadd650",
"size": "... |
"""Provides the Session class and related utilities."""
import weakref
from itertools import chain
from sqlalchemy import util, sql, engine, log, exc as sa_exc
from sqlalchemy.sql import util as sql_util, expression
from sqlalchemy.orm import (
SessionExtension, attributes, exc, query, unitofwork, util as mapperut... | {
"content_hash": "d4619814e77bda39aba500697a3e06da",
"timestamp": "",
"source": "github",
"line_count": 1726,
"max_line_length": 100,
"avg_line_length": 38.137891077636155,
"alnum_prop": 0.6010391030899644,
"repo_name": "eunchong/build",
"id": "fe38f01be8314aa4bc3a394228d4f43777771799",
"size": "66... |
__doc__="""
Distributes the selected nodes horizontally.
"""
import GlyphsApp
Font = Glyphs.font
selectedLayer = Font.selectedLayers[0]
try:
try:
# until v2.1:
selection = selectedLayer.selection()
except:
# since v2.2:
selection = selectedLayer.selection
selectionXList = [ n.x for n in selection ]
lef... | {
"content_hash": "ee0d1a6b7e656f85a7bb6d9aa19f7d2b",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 25.305555555555557,
"alnum_prop": 0.7233809001097695,
"repo_name": "schriftgestalt/Mekka-Scripts",
"id": "56247ed79acd3001e4011bc8bef03ec36b27e57e",
... |
import os
import sys
import shodan
import tools
import module_locater
import logging
import datetime
import getopt
import shodan_modules
import optparse
import whois_modules
import time
import dns.resolver
import dns_modules
SHODAN_API_KEY = "tENIC6XGeNrYJHt0xzGYN5NT7RaZAvq6"
scriptdir = module_locater.module_path()
m... | {
"content_hash": "83b270bc6ac5fc51cb6bab12e67c7126",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 102,
"avg_line_length": 31.255555555555556,
"alnum_prop": 0.5657660860291504,
"repo_name": "dmartinez7500/Spoor",
"id": "7599c77d0ec5e6ce9f074c881ee3e9676e0aa4f1",
"size":... |
class StreamObject:
def __init__(self, data=None): self.data = data; self.accs = False
def is_accs(self): return self.accs
def get(self, accs=True): self.accs = accs; return self.data
def show(self, accs=True): print(self.get(accs))
class Stream:
def __init__(self): self.stream = []
def get_las... | {
"content_hash": "03fbbfc2c68dca9e4ef595c3b1658459",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 70,
"avg_line_length": 41.705882352941174,
"alnum_prop": 0.6332863187588152,
"repo_name": "chuckwoodjohn/py_console_a1.0",
"id": "91fe7832c478aa3b906b6a00ee7b2e4d230d987d",
... |
import base64
import binascii
import requests
from jcsclient import exception
from jcsclient import utils
from jcsclient import requestify
def describe_instances(url, verb, headers, version, args):
params = {}
params['Action'] = utils.dash_to_camelcase(args[0])
params['Version'] = version
args = args[1... | {
"content_hash": "758665d08eef151343ba49d7e39cc341",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 77,
"avg_line_length": 43.54814814814815,
"alnum_prop": 0.6735839428474231,
"repo_name": "jiocloudservices/jcsclient",
"id": "ef725f7907737df94801e3043248f68889ec0d31",
"s... |
"""Implement training process including curriculum and hard negative mining."""
import argparse
import collections
import copy
from ..tqdm_utils import tqdm_for
from difflogic.dataset.utils import RandomlyIterDataset
from difflogic.thutils import monitor_gradrms
import jacinle.random as random
from jacinle.logging ... | {
"content_hash": "13cd8e5ad91007e283d41b0e2c84fa06",
"timestamp": "",
"source": "github",
"line_count": 704,
"max_line_length": 81,
"avg_line_length": 36.46448863636363,
"alnum_prop": 0.6530715593471232,
"repo_name": "google/neural-logic-machines",
"id": "497cb27d8a4d6ff24ce10f951bed0ea470511ca3",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.