text stringlengths 4 1.02M | meta dict |
|---|---|
# This program is free software; you can redistribute it and/or modify it under
# the terms of the (LGPL) GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it... | {
"content_hash": "24668a0254b9fc399408c6be8ff954fe",
"timestamp": "",
"source": "github",
"line_count": 559,
"max_line_length": 79,
"avg_line_length": 35.58855098389982,
"alnum_prop": 0.5337790288529205,
"repo_name": "c2theg/DDoS_Infomation_Sharing",
"id": "6afb2050eb3e29a84d1515af759361f4430a5931",
... |
import sys
import os
on_rtd = os.environ.get('READTHEDOCS') == 'True'
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.in... | {
"content_hash": "9be4f4dfde250c3e754ef9b3027f9678",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 79,
"avg_line_length": 30.232558139534884,
"alnum_prop": 0.6826923076923077,
"repo_name": "has2k1/onelib",
"id": "1097f435b57b4f467d7a927d2b81b57873a6b6e8",
"size": "10824... |
import os
import platform
import sys
from webkitpy.common.system import environment, executive, filesystem, platforminfo, user, workspace
class SystemHost(object):
def __init__(self):
self.executive = executive.Executive()
self.filesystem = filesystem.FileSystem()
self.user = user.User()
... | {
"content_hash": "e34500809e7aacd77887624d3ccbe228",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 100,
"avg_line_length": 34,
"alnum_prop": 0.7214532871972318,
"repo_name": "indashnet/InDashNet.Open.UN2000",
"id": "3b4439ee4785bdc220ee72333179268499ad12a3",
"size": "210... |
import sys
import inspect
import rospy
import std_srvs.srv
import std_msgs.msg
import rosgraph
import rosservice
import rospy.core
import json
from pprint import pprint as pp
from rospy.impl.tcpros_base import TCPROSTransport
# we use the most accurate timer available to the system
from timeit import default_timer a... | {
"content_hash": "6741d51aedeb2b245cce0358b06bed56",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 111,
"avg_line_length": 34.86713286713287,
"alnum_prop": 0.6307661452065784,
"repo_name": "ChrisTimperley/rostrace",
"id": "4214428104ee534deb473ffcf808ddb84a1bd89d",
"siz... |
"""
:class:`GeoNames` geocoder.
"""
from geopy.compat import urlencode
from geopy.geocoders.base import Geocoder, DEFAULT_TIMEOUT
from geopy.location import Location
from geopy.exc import (
GeocoderInsufficientPrivileges,
GeocoderServiceError,
ConfigurationError
)
from geopy.util import logger
__all__ =... | {
"content_hash": "8549dcfe947a8018d435078c111c2f29",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 85,
"avg_line_length": 31.961748633879782,
"alnum_prop": 0.5525730894169943,
"repo_name": "SoftwareArtisan/geopy",
"id": "812d3129a196c7ebb2de273e6d8bc54ee89b6aa3",
"size"... |
import json
from django.core import mail
from olympia import amo
from olympia.abuse.models import AbuseReport
from olympia.amo.tests import (
APITestClient, TestCase, addon_factory, reverse_ns, user_factory)
class AddonAbuseViewSetTestBase(object):
client_class = APITestClient
def setUp(self):
... | {
"content_hash": "d3670e6fc4e17de2d05aa89d2a9afac0",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 75,
"avg_line_length": 35.42,
"alnum_prop": 0.5909655561829474,
"repo_name": "lavish205/olympia",
"id": "cb48331189b1410f66c8cb9ed4d49f98bc0c5d45",
"size": "8855",
"bina... |
"""Tests for the binary exercise
Implementation note:
If the argument to parse_binary isn't a valid binary number the
function should raise a ValueError with a meaningful error message.
"""
import unittest
from binary import parse_binary
class BinaryTests(unittest.TestCase):
def test_binary_1_is_decimal_1(self)... | {
"content_hash": "1b80a38c6cb2ec2c670709f36ac689f4",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 67,
"avg_line_length": 29.838709677419356,
"alnum_prop": 0.6713513513513514,
"repo_name": "pheanex/xpython",
"id": "510cdc52016b69a00cbdb943cea3cd6488788eb0",
"size": "1850... |
"""Django haystack `SearchIndex` module."""
from pages.models import Page
from pages import settings
from haystack.indexes import (
SearchIndex, CharField, DateTimeField, RealTimeSearchIndex,
Indexable)
if settings.PAGE_REAL_TIME_SEARCH:
class RealTimePageIndex(RealTimeSearchIndex, Indexable):
... | {
"content_hash": "886d4271aa3f2a75755fa911c6470b77",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 71,
"avg_line_length": 35.810810810810814,
"alnum_prop": 0.6513207547169811,
"repo_name": "ArabellaTech/django-page-cms",
"id": "59f4754cf90c4ace2618b09130ecd6d91fbc8611",
... |
""" version related stuff. """
## jsb imports
from jsb.lib.config import getmainconfig
## basic imports
import os
import binascii
## defines
version = "0.91.0"
__version__ = version
## getversion function
def getversion(txt=""):
""" return a version string. """
return "JSONBOT %s DEVELOPMENT %s" % (vers... | {
"content_hash": "1bd6952a21dbc35de307ef8f26c4c8c6",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 55,
"avg_line_length": 15.714285714285714,
"alnum_prop": 0.6666666666666666,
"repo_name": "Petraea/jsonbot",
"id": "f45e651b9361b02372749e4c2c397cbc3031b3ab",
"size": "352"... |
import unittest
import sqlalchemy as sa
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
)
from zope.sqlalchemy import ZopeTransactionExtension
from sqla_declarative.declarative import extended_declarative_base, _marker
import transaction
class TestExtendedBase(unittest.TestCase):
def setUp... | {
"content_hash": "a6dde4bf616f973f85cd4772672a9494",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 89,
"avg_line_length": 33.01449275362319,
"alnum_prop": 0.6007462686567164,
"repo_name": "LeResKP/sqla_declarative",
"id": "2757a05d9e32507d74ee0944d137523357c64f08",
"siz... |
import os
import tornado.httpserver
import tornado.ioloop
from tornado.options import define, options
import tornado.options
import tornado.web
import motor
from ui_modules import picture
define("port", default=8000, help="run on the given port", type=int)
define("loadnum", default=10, help="pic number to load adt o... | {
"content_hash": "c1dc1390a551a2b4f4f724a97533b2a4",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 75,
"avg_line_length": 32.674418604651166,
"alnum_prop": 0.6,
"repo_name": "evolsnow/tornado-web",
"id": "2aa2cda1837137230b9678ed500c1d1ae829faba",
"size": "1428",
"bina... |
app = {
'root': 'cauth.controllers.root.RootController',
'modules': ['cauth'],
'static_root': '%(confdir)s/public',
'template_path': '%(confdir)s/cauth/templates',
'priv_key_path': '/srv/cauth_keys/privkey.pem',
'cookie_domain': 'tests.dom',
'debug': False,
'cookie_period': 43200
}
logg... | {
"content_hash": "40f48287bdecd3729a0cccb44fdd03af",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 77,
"avg_line_length": 27.583333333333332,
"alnum_prop": 0.5163141993957704,
"repo_name": "enovance/cauth",
"id": "389215c314bf7a9539dc50bb0b336bd605766077",
"size": "3954... |
import os
import random
import re
from collections import OrderedDict
from typing import Any, Dict, Tuple
from django.conf import settings
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
from django.template import loader
from django.views.generic import TemplateView
from zerver.context_proces... | {
"content_hash": "0a9a3559378368171686701f6c95724b",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 99,
"avg_line_length": 43.746192893401016,
"alnum_prop": 0.6626827570201903,
"repo_name": "brainwane/zulip",
"id": "b2cdba721ff78f964f45474f9b4d26cae481a3de",
"size": "861... |
"""Support for wake on lan."""
import logging
import platform
import subprocess as sp
import voluptuous as vol
import wakeonlan
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import CONF_BROADCAST_ADDRESS, CONF_HOST, CONF_MAC, CONF_NAME
import homeassistant.helpers.... | {
"content_hash": "04f3f9cee2072eabe5951afa5dbd9576",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 87,
"avg_line_length": 29.91346153846154,
"alnum_prop": 0.586628093860495,
"repo_name": "Teagan42/home-assistant",
"id": "8200a0309fa7a76db2e6a8b9bc0ad63406fe9500",
"size"... |
import io
from setuptools import find_packages, setup
# This reads the __version__ variable from openfermioncirq/_version.py
__version__ = None
exec(open('openfermioncirq/_version.py').read())
# Readme file as long_description:
long_description = ('================\n' +
'OpenFermion-Cirq\n' +
... | {
"content_hash": "1f9a12ee9178cbf138c734ddf68695ea",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 76,
"avg_line_length": 34.325581395348834,
"alnum_prop": 0.6802168021680217,
"repo_name": "quantumlib/OpenFermion-Cirq",
"id": "285c3ddeef89ad82ad6fa71177ebe89a5630ed66",
"... |
def extractWwwWastedproductionsCom(item):
'''
Parser for 'www.wastedproductions.com'
'''
badwords = [
'#ninerwrimo',
'#NaNoWriMo',
'#ThursdayTales',
'#StoryCubes',
]
if any([bad in item['tags'] for bad in badwords]):
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item[... | {
"content_hash": "cf4a9a76bfb897fa80beb2678389efb2",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 104,
"avg_line_length": 24.34375,
"alnum_prop": 0.6110397946084724,
"repo_name": "fake-name/ReadableWebProxy",
"id": "f7703d0183e494da3ae039a1d74f8b13ddbcd3be",
"size": "77... |
import http.client
import logging
import os
import urllib
from unittest.mock import patch, MagicMock, ANY, mock_open
import requests
from django.test import TransactionTestCase
from mapproxy.client.http import _URLOpenerCache, VerifiedHTTPSConnection
from eventkit_cloud.utils import auth_requests
logger = logging.ge... | {
"content_hash": "ce3dc71f45c07ef4e9e8d9bfa6fab49d",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 115,
"avg_line_length": 43.66326530612245,
"alnum_prop": 0.6515541014255667,
"repo_name": "venicegeo/eventkit-cloud",
"id": "11a9cf403f25ea5c198d78c5572401274134157b",
"siz... |
from django import forms
from django.core.exceptions import ValidationError
import ipaddr
import socket
import struct
from cyder.base.constants import IP_TYPES, IP_TYPE_4, IP_TYPE_6
from cyder.base.eav.forms import get_eav_form
from cyder.base.eav.models import Attribute
from cyder.base.mixins import UsabilityFormMixi... | {
"content_hash": "ab7ece396ebe7733362c504fdf9c0ab6",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 112,
"avg_line_length": 42.71195652173913,
"alnum_prop": 0.5638121898460364,
"repo_name": "OSU-Net/cyder",
"id": "28ff36c9dfd3275a3dcace18a5fddb339f0d4cad",
"size": "7859"... |
class Singleton(type):
def __init__(self, *args, **kwargs):
self.__instance = None
super(type, self).__init__(*args, **kwargs)
def __call__(self, *args, **kwargs):
if self.__instance is None:
self.__instance = type.__call__(self, *args, **kwargs)
... | {
"content_hash": "bc76ffee58b0d55a87f6355dd806d3bf",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 66,
"avg_line_length": 19.90909090909091,
"alnum_prop": 0.5403348554033486,
"repo_name": "rbprogrammer/advanced_python_topics",
"id": "63cd0eea7e5494cfe8e81d1601563100d50ebb1... |
from .add_binary import *
from .breaking_bad import *
from .decode_string import *
from .delete_reoccurring import *
from .domain_extractor import *
from .encode_decode import *
from .group_anagrams import *
from .int_to_roman import *
from .is_palindrome import *
from .is_rotated import *
from .license_number import *... | {
"content_hash": "a854a7c08360d3e2105a4061c51756e7",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 37,
"avg_line_length": 30.22222222222222,
"alnum_prop": 0.7619485294117647,
"repo_name": "amaozhao/algorithms",
"id": "98306f61da1528552048a0816d31832a3fdd8015",
"size": "1... |
from __future__ import print_function
from sensu_plugin.plugin import SensuPlugin
class SensuPluginCheck(SensuPlugin):
def check_name(self, name=None):
if name:
self._check_name = name
if hasattr(self, '_check_name'):
return self._check_name
return self.__class__.... | {
"content_hash": "3aadd5b72f71389784ed42a88a399d54",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 72,
"avg_line_length": 27.73076923076923,
"alnum_prop": 0.5492371705963939,
"repo_name": "zsprackett/python_sensu_plugin",
"id": "fca7def438663390d98c30b1c8160fdfa4273931",
... |
import inspect
import re
from oslo_db import exception as db_exc
from oslo_log import log as logging
import six
from yaql.language import exceptions as yaql_exc
from yaql.language import factory
from mistral import exceptions as exc
from mistral.expressions.base_expression import Evaluator
from mistral.utils import e... | {
"content_hash": "eaba33020ddfe0d4d3611309864b62b8",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 78,
"avg_line_length": 34.08130081300813,
"alnum_prop": 0.5985209923664122,
"repo_name": "StackStorm/mistral",
"id": "8cd500a3db89b225d265a273501349b9c18ca6fb",
"size": "4... |
from __future__ import absolute_import
from mayavi.tools.mlab_scene_model import *
| {
"content_hash": "56d9ec264ab705a53f3a8d31a4c3024a",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 43,
"avg_line_length": 41.5,
"alnum_prop": 0.7831325301204819,
"repo_name": "enthought/etsproxy",
"id": "8bb736be629fe460cf9018ff83d72990e0924088",
"size": "98",
"binary":... |
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
from msrest import Serializer
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import Pipelin... | {
"content_hash": "a0395976de5eb3ab6f89e673a16b062c",
"timestamp": "",
"source": "github",
"line_count": 467,
"max_line_length": 253,
"avg_line_length": 44.43254817987152,
"alnum_prop": 0.653012048192771,
"repo_name": "Azure/azure-sdk-for-python",
"id": "f08381a1a61ad058b38b0cba17260bc22733fb1e",
"s... |
from __future__ import absolute_import
__all__ = ['WebSocketServerProtocol',
'WebSocketServerFactory',
'WebSocketClientProtocol',
'WebSocketClientFactory',
'WrappingWebSocketServerFactory',
'WrappingWebSocketClientFactory',
'listenWS',
'conne... | {
"content_hash": "3e0794426a327de58b7638b32f1e7d54",
"timestamp": "",
"source": "github",
"line_count": 604,
"max_line_length": 179,
"avg_line_length": 32.71523178807947,
"alnum_prop": 0.6739878542510122,
"repo_name": "mrrrgn/AutobahnPython",
"id": "41b8a17e7f4c198d714b8d347215a92232d7a790",
"size"... |
"""
test the pvgis IO tools
"""
import json
import numpy as np
import pandas as pd
import pytest
import requests
from pvlib.iotools import get_pvgis_tmy
from conftest import DATA_DIR
@pytest.fixture
def expected():
return pd.read_csv(DATA_DIR / 'pvgis_tmy_test.dat', index_col='time(UTC)')
@pytest.fixture
def us... | {
"content_hash": "7312db2722e02350355ef3f15d94c0b4",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 79,
"avg_line_length": 36.17307692307692,
"alnum_prop": 0.621832358674464,
"repo_name": "rubennj/pvlib-python",
"id": "5227c45841a56abf90fe92a888c9b25a3d32a8da",
"size": "... |
from pyboleto.data import BoletoData, CustomProperty
class BoletoHsbc(BoletoData):
'''
Gera Dados necessários para criação de boleto para o banco HSBC
'''
numero_documento = CustomProperty('numero_documento', 13)
def __init__(self):
super(BoletoHsbc, self).__init__()
self.co... | {
"content_hash": "e1dcfaf8560b09a4ff166ff01e9cbaf9",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 75,
"avg_line_length": 31.946666666666665,
"alnum_prop": 0.5655258764607679,
"repo_name": "eduardocereto/pyboleto",
"id": "87dd0cf41f42bab17aca3d66bb952476216d70ce",
"size"... |
from __future__ import unicode_literals
from django.db import models, migrations
import galaxy.main.mixins
MAIN_TITLE_BLOCK = """
<h1><span class="ansible-color">Galaxy</span> is your hub for finding,
reusing and sharing Ansible content</h1>
"""
MAIN_SHARE_BLOCK = """
<div class="share-icon"><i class="fa fa-share-a... | {
"content_hash": "04cec0df17eee193e0b5f47472f35c10",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 91,
"avg_line_length": 37.23762376237624,
"alnum_prop": 0.6527519276788089,
"repo_name": "chouseknecht/galaxy",
"id": "8092e647ab58adaa9515731f295fdda89d6f9c92",
"size": "... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'WormholeType'
db.create_table('Map_wormholetype', (
('id', self.gf('django.db.models.fields.AutoField')(... | {
"content_hash": "ffc6e80d3a9ddb785db96e9fd1f61f64",
"timestamp": "",
"source": "github",
"line_count": 431,
"max_line_length": 182,
"avg_line_length": 68.88631090487239,
"alnum_prop": 0.5730549006399461,
"repo_name": "hybrid1969/eve-wspace",
"id": "80d48f127f37ad428d6e18b2e5060f08a0fde79f",
"size"... |
"""This example adds a campaign group and sets a performance target for it.
To get campaigns, run get_campaigns.py. To download reports, run
download_criteria_report_with_awql.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your ... | {
"content_hash": "a9b462934b2797d660e6a6acc2c4be22",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 79,
"avg_line_length": 32.095588235294116,
"alnum_prop": 0.6492554410080184,
"repo_name": "Aloomaio/googleads-python-lib",
"id": "31cfdf32fc37725969a415cdd0429233de70568a",
... |
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
def show_channels(chmaps, n_cols=8, normalize=None, ofpath=None):
"""Display multiple channels of 2D images.
Parameters
----------
chmaps : numpy.ndarray like
The channel maps to be displayed. The shape of `chmaps` s... | {
"content_hash": "3fdb04a285b0d5970326c8e8abde7287",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 31.26923076923077,
"alnum_prop": 0.6107011070110702,
"repo_name": "Cysu/dlearn",
"id": "3ac7e45bcd68b49e720ec553a75f31f53d71b5ab",
"size": "1626",
... |
import os
import pulleffect
import unittest
import tempfile
import json
import flask
import requests
from mock import patch
from mock import MagicMock
import pulleffect.lib.timeclock
from pulleffect.lib.utilities import Widgets
import logging
class TestCases(unittest.TestCase):
def setUp(self):
"""Before e... | {
"content_hash": "79e33c25bdb16d4dca8e54832df610d7",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 74,
"avg_line_length": 28.475409836065573,
"alnum_prop": 0.5820379965457686,
"repo_name": "wesleyan/pulleffect",
"id": "5bac46f27c55c30034834971374374d597027dca",
"size": "... |
from msrest.serialization import Model
class RepairTaskDeleteDescription(Model):
"""Describes a request to delete a completed repair task.
This type supports the Service Fabric platform; it is not meant to be used
directly from your code.
.
:param task_id: The ID of the completed repair task to b... | {
"content_hash": "fa25b9a15d235baef2ca198222fdc911",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 31.4,
"alnum_prop": 0.638004246284501,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "f9b26058d9cdb83eab101cd9fce87b36c8f690e9",
"size": "141... |
"""Apache Configuration based off of Augeas Configurator."""
# pylint: disable=too-many-lines
import filecmp
import logging
import os
import re
import shutil
import socket
import time
import zope.component
import zope.interface
from acme import challenges
from letsencrypt import errors
from letsencrypt import interf... | {
"content_hash": "b73a1597ac339e8b9a7f1e164f7a6477",
"timestamp": "",
"source": "github",
"line_count": 1615,
"max_line_length": 94,
"avg_line_length": 39.61176470588235,
"alnum_prop": 0.5801666327982118,
"repo_name": "TheBoegl/letsencrypt",
"id": "cbc451ac94ed80ae383b6cd6d8f99fc77ca01c5c",
"size":... |
"""A collection of converters, and converter creators
For the purposes of this module, a converter is any function that takes a single value and returns
another value.
"""
from decimal import Decimal
from uuid import UUID, uuid4
from bidon.util import date
def identity(val):
"""Returns the value it is given."""
... | {
"content_hash": "fa351441da5e7e8bb5a493d34e01a9a0",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 99,
"avg_line_length": 21.895027624309392,
"alnum_prop": 0.668433005299016,
"repo_name": "treycucco/bidon",
"id": "f7bb8fa0fa72dc3476697c21508994e06d434a8d",
"size": "3963... |
import os, sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from flask.ext.script import Manager, Server
from tumblelog import app
manager = Manager(app)
# Turn on debugger by default and reloader
manager.add_command("runserver", Server(
use_debugger = True,
use_reloader = ... | {
"content_hash": "20c2438f2178df7921a163ec8e4ea7a1",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 79,
"avg_line_length": 23.235294117647058,
"alnum_prop": 0.6683544303797468,
"repo_name": "HiroIshikawa/21playground",
"id": "18338af34346f30af9950919f9815728f347ae9c",
"si... |
import logging
import xgboost as xgb
import traceback
from tracker import RabitTracker
from utils import read_train_data, extract_xgbooost_cluster_env
logger = logging.getLogger(__name__)
def train(args):
"""
:param args: configuration for train job
:return: XGBoost model
"""
addr, port, rank, w... | {
"content_hash": "87a5e2fd07908e8354f3ca60df895bac",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 79,
"avg_line_length": 31.807692307692307,
"alnum_prop": 0.5308343409915357,
"repo_name": "kubeflow/training-operator",
"id": "290f09d892d61690cc2c59bd9c27b17f4937cdc8",
"s... |
"""Support to interface with the Roon API."""
import logging
from homeassistant.components.media_player import BrowseMedia
from homeassistant.components.media_player.const import (
MEDIA_CLASS_DIRECTORY,
MEDIA_CLASS_PLAYLIST,
MEDIA_CLASS_TRACK,
)
from homeassistant.components.media_player.errors import Bro... | {
"content_hash": "7f4a03fa6d0064e0d31156ad8a669221",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 106,
"avg_line_length": 27.559006211180126,
"alnum_prop": 0.6168582375478927,
"repo_name": "rohitranjan1991/home-assistant",
"id": "2f132ee9d23999a740c34186fbfddf51bf87a55e"... |
class Perro(object):
def __init__(self, nombre, raza, edad):
self.nombre = nombre
self.raza = raza
self.edad = edad
def ladra(self):
print (self.nombre)
mascota = Perro("Lassie", "Collie", 18)
#mascota.ladra()
| {
"content_hash": "2e55dea851abf0c780b6e21a13c2651f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 42,
"avg_line_length": 22,
"alnum_prop": 0.6033057851239669,
"repo_name": "ihidalgo/uip-prog3",
"id": "be2eb10b56be4aee416e6be20329366d265bb8c5",
"size": "242",
"binary":... |
import itk
dim = 2
PType = itk.US
# check the repr string
assert "<itkTemplate itk::Image>" == repr(itk.Image)
# template should work with CType instance and with numbers
IType = itk.Image[PType, dim]
# template should return the same class with a class as parameter
# or with an object of this class, and should als... | {
"content_hash": "d20a1d2b80c5da14b996e02b3597d0d3",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 111,
"avg_line_length": 26.272727272727273,
"alnum_prop": 0.7488465974625144,
"repo_name": "CapeDrew/DITK",
"id": "a48b28f1823d5abde65c86bab69811aa3e4ff9e4",
"size": "4240... |
def sqlQuery_GetStyleVendor_ByPO(ponum):
import sqlalchemy
orcl_engine = sqlalchemy.create_engine('oracle+cx_oracle://prod_team_ro:9thfl00r@borac101-vip.l3.bluefly.com:1521/bfyprd11')
#orcl_engine = sqlalchemy.create_engine('oracle+cx_oracle://jbragato:Blu3f!y@192.168.30.66:1531/dssprd1')
connection = o... | {
"content_hash": "e21b251f33d1d7595dfb40f4e233ee89",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 362,
"avg_line_length": 36.52427184466019,
"alnum_prop": 0.5778841041998937,
"repo_name": "relic7/prodimages",
"id": "44a2ac0b7f27207ee574389269f5542ef42d51f6",
"size": "3... |
import time
from threading import Lock
import xml.etree.ElementTree as etree
import libvirt
from see.interfaces import Context
from see.environment import load_configuration
NOSTATE = 0
RUNNING = 1
BLOCKED = 2
PAUSED = 3
SHUTDOWN = 4
SHUTOFF = 5
CRASHED = 6
SUSPENDED = 7
STATES_MAP = {NOSTATE: (),
RUN... | {
"content_hash": "9757ee4a9232dfe323ac88e2d24bc27f",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 80,
"avg_line_length": 29.838983050847457,
"alnum_prop": 0.5987882230426962,
"repo_name": "F-Secure/see",
"id": "b669dfde3c8b4686d842ef5b37cf753e71d4aa34",
"size": "11140"... |
def create(left, bottom, right, top):
left, right = sorted([left, right])
bottom, top = sorted([bottom, top])
return [
(left, bottom),
(left, top),
(right, top),
(right, bottom),
]
| {
"content_hash": "3dc21b4ce61d1545c826e06d2a79cfac",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 39,
"avg_line_length": 23,
"alnum_prop": 0.508695652173913,
"repo_name": "tartley/zerkcom",
"id": "0e1fc482ddc10663b49b6be1734f9d9886782b8a",
"size": "231",
"binary": fal... |
"""
resources
~~~~~~~~~
Location of our different resources for Falcon.
Resources are responsible for registering responders & tend
to follow the same general workflows for our Mongo documents.
"""
from ..resources.base import Resource as BaseResource
from ..resources.json_7159 import Resource as... | {
"content_hash": "914678d8e02946b6b29572783a1a478b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.7707865168539326,
"repo_name": "sassoo/goldman",
"id": "4f6839a2cede9621d7bd244ba2f21e71745ae45d",
"size": "890",... |
from django.conf.urls import patterns, include, url
from rest_framework import routers
from quickstart import views
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.registe... | {
"content_hash": "422cafe7c3cb2b71bae5613801f6518f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 82,
"avg_line_length": 34.88,
"alnum_prop": 0.7052752293577982,
"repo_name": "sharehub/metacodes",
"id": "85686b026b5247e3e78ecaa49246fe79e95b3204",
"size": "872",
"binar... |
'''
Code Input
==========
.. versionadded:: 1.5.0
.. image:: images/codeinput.jpg
The :class:`CodeInput` provides a box of editable highlited text like the one
shown in the image.
It supports all the features provided by the :class:`~kivy.uix.textinput` as
well as code highliting for `languages supported by pygmen... | {
"content_hash": "35b42fca4319ab81b97fb26f5cb8d63f",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 80,
"avg_line_length": 32.045,
"alnum_prop": 0.5809018567639257,
"repo_name": "hansent/kivy",
"id": "1bbbbe3a294decac964dffb66ee0e395272da079",
"size": "6409",
"binary":... |
import unittest
from katas.kyu_8.multiply import multiply
class MultiplyTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(multiply(3, 4), 12)
def test_equals_2(self):
self.assertEqual(multiply(10, 10), 100)
| {
"content_hash": "3737fca06728cc927b4684b8353f6f66",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 47,
"avg_line_length": 23.09090909090909,
"alnum_prop": 0.7007874015748031,
"repo_name": "the-zebulan/CodeWars",
"id": "f65e7d8bdaf42a582b57ac565d4ef339390098c1",
"size": "... |
import creds
import rauth
import requests
import re
import json
import pprint
from hashlib import sha1
from random import random
import parser
import time
import sys
user_agent = '/u/worldwise001\'s reddit crawler (github.com/worldwise001/reddit-crawler)'
auth_url = 'https://ssl.reddit.com/api/v1/authorize'
access_ur... | {
"content_hash": "6e0134d0ebbdd936011170feac79018c",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 132,
"avg_line_length": 38.15289256198347,
"alnum_prop": 0.5275641719917686,
"repo_name": "aleboz/reddit-crawler",
"id": "c68eff17314b4099370fd6b8331b56bbbb952ec8",
"size"... |
import random
from string import Template
import tinydb
from flask import Flask, redirect, url_for, abort
app = Flask(__name__)
db = tinydb.TinyDB('./db.json')
HTML = """<!DOCTYPE html>
<html>
<head>
<title>Dulux Swatch</title>
<link rel="StyleSheet" href="/static/main.css" type="text/css">
</head>
<bo... | {
"content_hash": "4753da6f18db22e8900a3a3236cd4e67",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 114,
"avg_line_length": 24.711111111111112,
"alnum_prop": 0.6285971223021583,
"repo_name": "leohemsted/duluxswatch",
"id": "791267bb75a5f2f7082cdc96339c90ac7ba9ea9e",
"size... |
"""
test_ciscoace
----------------------------------
Tests for `ciscoace` module.
"""
import unittest
import os
from Harvester.devices.ciscoace import CiscoAce
class TestCiscoAce(unittest.TestCase):
def setUp(self):
TESTDATA_FILENAME = os.path.join(
os.path.dirname(__file__), 'samples/cisco... | {
"content_hash": "b3ef7ea9648269076ecef325104e41f6",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 78,
"avg_line_length": 28.170731707317074,
"alnum_prop": 0.5852813852813853,
"repo_name": "clay584/Harvester",
"id": "916d07c39659c0f04180d9260d3c516e782b7a90",
"size": "12... |
import pandas as pd
from functions import *
import numpy as np
import matplotlib.pyplot as plt
from johansen_test import coint_johansen
from numpy.matlib import repmat
if __name__ == "__main__":
###########################################################################
# import data fro... | {
"content_hash": "a48868d4b2df448b6a464633e0bd324f",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 88,
"avg_line_length": 37.96913580246913,
"alnum_prop": 0.48268574215574706,
"repo_name": "JavierGarciaD/AlgoRepo",
"id": "38aa6c5255b3db6d4d3b77f43a49ed8bde64bbd9",
"size... |
"""Calculate single-path (steepest direction) flow directions.
Given a ModelGrid, calculates single-path (steepest direction) flow directions,
drainage area, and (optionally) discharge.
The "dn" in the name means that this is a generalization of the D8 algorithm,
for a grid in which a node has N neighbors (N might ha... | {
"content_hash": "b2675e67d2bcde054bfadbbf7e6d7e2a",
"timestamp": "",
"source": "github",
"line_count": 479,
"max_line_length": 87,
"avg_line_length": 42.561586638830896,
"alnum_prop": 0.5323490459606612,
"repo_name": "laijingtao/landlab",
"id": "6f6472730a51497dfffe84897357e532c38314de",
"size": "... |
import click
from sigopt.orchestrate.identifier import parse_identifier
def identifiers_callback(ctx, p, value): # pylint: disable=unused-argument
try:
return [parse_identifier(raw) for raw in value]
except ValueError as ve:
raise click.BadParameter(str(ve)) from ve
identifiers_argument = click.argumen... | {
"content_hash": "3d74293649fea9b4e03847e8b0d91dcb",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 109,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.7429718875502008,
"repo_name": "sigopt/sigopt-python",
"id": "354fd3b722f78bae11b6964c1bf63d3b7ecb4889",
"size":... |
"""
fs.expose.dokan
===============
Expose an FS object to the native filesystem via Dokan.
This module provides the necessary interfaces to mount an FS object into
the local filesystem using Dokan on win32::
http://dokan-dev.net/en/
For simple usage, the function 'mount' takes an FS object and a drive letter,
... | {
"content_hash": "60f2c7fae1b90b76bfcf4b624eab1030",
"timestamp": "",
"source": "github",
"line_count": 1053,
"max_line_length": 118,
"avg_line_length": 35.35707502374169,
"alnum_prop": 0.6078536703284897,
"repo_name": "simonluijk/pyFilesystem",
"id": "51974a9864fccecf9d16583f83a0b7462fa45dd5",
"si... |
import re
from collections import deque
from files.configurationFile import Configurations
from mysql.connector import connect, Error
from files.twitter_feed import userAuth
from files.status import status
def databaseConnect(Configurations):
try:
cnx = connect(**Configurations().dbApiConfig())
... | {
"content_hash": "fcae0390367d1a470760f4fb64484c72",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 121,
"avg_line_length": 37.294326241134755,
"alnum_prop": 0.6284111438623181,
"repo_name": "saurabhkumar1989/traffic_data_backend",
"id": "8bd3fd14eb101baf9c74811c19d6d4ea81... |
"""
This module provides a library of Visual classes, which are drawable objects
intended to encapsulate simple graphic objects such as lines, meshes, points,
2D shapes, images, text, etc.
These classes define only the OpenGL machinery and connot be used directly in
a scenegraph. For scenegraph use, see the complement... | {
"content_hash": "10034abf81b1bcc56a2100dcef47ca58",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 77,
"avg_line_length": 43.18421052631579,
"alnum_prop": 0.7909811090798293,
"repo_name": "jay3sh/vispy",
"id": "ec2253a4a2ae3da1b54672be7f95940cede2d5fd",
"size": "1785",
... |
from .main import setup
from .middlewares import middleware
from .utils import APP_KEY
__version__ = "0.6.0"
__all__ = ("setup", "middleware", "APP_KEY")
| {
"content_hash": "b4825e05ae01b9c93784a9289cb0b4c9",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 44,
"avg_line_length": 22.285714285714285,
"alnum_prop": 0.6730769230769231,
"repo_name": "aio-libs/aiohttp-debugtoolbar",
"id": "e22d0b20950a3143067613253f90a67a917f2ddd",
... |
import json
import re
memoryfilename = '03-result-memory.json'
magicnumberfilename = '05-magic-numbers.json'
outputfilename = '06-result-memory.json'
inputfile = open(memoryfilename)
memorydata = json.load(inputfile)
inputfile.close()
print('Eingabeatei {0} enthält {1} Einträge.'.format(memoryfilename, len(memorydata... | {
"content_hash": "de677c0bfccd1c694d7f6d44c3d42f94",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 96,
"avg_line_length": 29.45,
"alnum_prop": 0.7113752122241087,
"repo_name": "fibonacca/coding-da-vinci-kenom",
"id": "b260c8f58dbe2c506a372e6da096e94255734a52",
"size": "1... |
"""Integration test for branch.py"""
import json
import os
import subprocess
import tempfile
import textwrap
import unittest
INFRA_CONFIG_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
BRANCH_PY = os.path.join(INFRA_CONFIG_DIR, 'scripts', 'branch.py')
class BranchIntegrationTest(unittest.TestCase):
... | {
"content_hash": "08a2eb5c74731cf6a5f8fc5591fdc2a3",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 80,
"avg_line_length": 32.11,
"alnum_prop": 0.5805045157271878,
"repo_name": "chromium/chromium",
"id": "dcadf8e80a56c65202b84daff9c3f145e1ed3472",
"size": "3375",
"bina... |
import locale
import os
import shutil
import socket
import stat
import subprocess
import sys
import tempfile
import unittest
class Error(Exception):
"""Base class for errors in this module."""
pass
class ArgumentError(Error):
"""A function received a bad argument."""
pass
class EnvVarUndefinedError(Error)... | {
"content_hash": "83c1bbbbdabeda8a46dd21c07de64b50",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 80,
"avg_line_length": 34.6745027124774,
"alnum_prop": 0.6038591916558018,
"repo_name": "perezd/bazel",
"id": "f980f8fd85b3ee5feb1d473cc23a19521c2721d3",
"size": "19851",
... |
"""
Custodian is a simple, robust and flexible just-in-time (JIT) job management
framework written in Python.
"""
__author__ = "Shyue Ping Ong, William Davidson Richards, Stephen Dacek, Xiaohui Qu, Matthew Horton, Samuel M. Blau"
__version__ = "2022.5.26"
from .custodian import Custodian
| {
"content_hash": "9149691dc5e124b08ccfd2188dd3c342",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 115,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.7319587628865979,
"repo_name": "materialsproject/custodian",
"id": "e080e44d7f36737dbfc7ed9ea039c3e903524446",
"s... |
import re
class ParseError(Exception):
def __init__(self, msg):
self.message = msg
def __str__(self):
return self.message
class ParseNode:
def __init__(self, kind, value, head):
self.kind = kind
self.value = value
self.prev = None
if head:
self.p... | {
"content_hash": "d48479925c58411ad3b1641f2d4f817e",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 86,
"avg_line_length": 34.1,
"alnum_prop": 0.49093575046654225,
"repo_name": "perfectsearch/sandman",
"id": "fe8349c69b22088aebfe14334ff25b116463c83d",
"size": "7678",
"... |
import inspect
from itertools import chain
import json
import logging
from flask_wtf import Form
from werkzeug.exceptions import NotFound
from werkzeug.utils import redirect
from flask import render_template, make_response, request, url_for, flash
from . import ViewSetupError
from . import get_or_404, ... | {
"content_hash": "3777b1c843b7fb7e90c7a50ca4263943",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 110,
"avg_line_length": 32.94117647058823,
"alnum_prop": 0.5756868131868131,
"repo_name": "wooyek/glosuj-w-lomiankach",
"id": "a21fa6f1f9fa77cfd7849ca38b75652802146700",
"... |
"""
Various bayesian regression
"""
# Authors: V. Michel, F. Pedregosa, A. Gramfort
# License: BSD 3 clause
from math import log
import numbers
import numpy as np
from scipy import linalg
from ._base import LinearModel, _preprocess_data, _rescale_data
from ..base import RegressorMixin
from ._base import _deprecate_n... | {
"content_hash": "f895e294ba3b64f9980aff47307226df",
"timestamp": "",
"source": "github",
"line_count": 869,
"max_line_length": 88,
"avg_line_length": 33.51783659378596,
"alnum_prop": 0.5686133141071857,
"repo_name": "saiwing-yeung/scikit-learn",
"id": "85f5dab656c431e1fbc1189207ab52c9fa36c251",
"s... |
from __future__ import absolute_import, division, print_function
from builtins import *
import numpy
from cubeaccess.core import StorageUnitDimensionProxy, StorageUnitStack
from cubeaccess.storage import GeoTifStorageUnit
def _time_from_filename(f):
from datetime import datetime
dtstr = f.split('/')[-1].spl... | {
"content_hash": "5e00526a879c2e607fecce43d2ecd90c",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 117,
"avg_line_length": 27.29090909090909,
"alnum_prop": 0.6302465023317788,
"repo_name": "v0lat1le/cube-data",
"id": "525554f34d096e5fdb106d793055084924880c3f",
"size": "2... |
"""Contains a helper context for running queue runners.
@@NestedQueueRunnerError
@@QueueRunners
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import threading
# pylint:disable=g-direct-tensorflow-import
from tensorflow.python.frame... | {
"content_hash": "3d48912e2871dc4365a148755e84400e",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 80,
"avg_line_length": 23.35483870967742,
"alnum_prop": 0.7292817679558011,
"repo_name": "google-research/tf-slim",
"id": "a1dc3d694cf43858b09aa7e06c5f62b33c2bc6b6",
"size"... |
"""Prints CUDA library and header directories and versions found on the system.
The script searches for CUDA library and header files on the system, inspects
them to determine their version and prints the configuration to stdout.
The paths to inspect and the required versions are specified through environment
variable... | {
"content_hash": "20290ccc675cc0c146f8547aeded6177",
"timestamp": "",
"source": "github",
"line_count": 633,
"max_line_length": 80,
"avg_line_length": 34.720379146919434,
"alnum_prop": 0.6248976248976249,
"repo_name": "frreiss/tensorflow-fred",
"id": "24fd9034bb8203d9189675b4117090c7fa74f249",
"siz... |
import abc
import six
from poppy.storage.base import controller
@six.add_metaclass(abc.ABCMeta)
class FlavorsControllerBase(controller.StorageControllerBase):
"""Flavors Controller Base definition."""
def __init__(self, driver):
super(FlavorsControllerBase, self).__init__(driver)
@abc.abstract... | {
"content_hash": "8a501c3a50ab88d4994ec96a38dfbbe6",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 62,
"avg_line_length": 20.177777777777777,
"alnum_prop": 0.6233480176211453,
"repo_name": "obulpathi/poppy",
"id": "2d883b72755aa57e9a993e62a5a74e69db9e2092",
"size": "1493... |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name = 'Adafruit_PN532',
version = '1.0.0',
author = 'Tony DiCola',
author_email = 'tdicola@adafruit.com',
description = 'Python library for access... | {
"content_hash": "1f6c9ece1966378281d1116262dae562",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 144,
"avg_line_length": 52.57142857142857,
"alnum_prop": 0.6114130434782609,
"repo_name": "t0adie/Adafruit_python_PN532",
"id": "dabc6a3a8c72ebae92addeafff6d55d1732560e7",
... |
from .mtset import MTSet
| {
"content_hash": "276780629ebcc5a24d3e04f2b8d7dacf",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 24,
"avg_line_length": 25,
"alnum_prop": 0.8,
"repo_name": "PMBio/limix",
"id": "1a6b4aae1d30b4c79475b991eb2a13fd42c5cd25",
"size": "25",
"binary": false,
"copies": "1",... |
"""
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
from __future__ import print_function, division, unicode_li... | {
"content_hash": "c8fa97ef952eb3bd8ccf5ce7ca77ac60",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 100,
"avg_line_length": 39.833333333333336,
"alnum_prop": 0.5471028274375555,
"repo_name": "mick-d/nipype",
"id": "c4b3ece2f1238b5ecf228ac5b20d5dc61a7ea2e9",
"size": "1579... |
from __future__ import unicode_literals
from jinja2 import Template
from six.moves.urllib.parse import parse_qs, urlparse
from moto.core.responses import BaseResponse
from .models import route53_backend
import xmltodict
class Route53(BaseResponse):
def list_or_create_hostzone_response(self, request, full_url, h... | {
"content_hash": "909fcc66a11c6eb6102dcd5c9e345446",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 128,
"avg_line_length": 40.80054644808743,
"alnum_prop": 0.5877586553271278,
"repo_name": "rocky4570/moto",
"id": "6679e7945cf3ce96f38432ccb24698b2ec518719",
"size": "1493... |
class Echo:
def echo(self, string):
return string
# Echo server program
import Scarab
server = Scarab.server_on()
server.globals['root'] = Echo()
print "Server listening on: " + server.url
server.run_loop()
| {
"content_hash": "1bf143b7382047216b046e3f8fe10d7c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 42,
"avg_line_length": 15.357142857142858,
"alnum_prop": 0.7069767441860465,
"repo_name": "mworks/mworks",
"id": "c1fe22b59cd3bde876e4a8ebebc73c057e88a87f",
"size": "305",
... |
"""
copy_rename.py -- Copy and rename a file to a given destination
"""
import logging
import optparse
import os
import shutil
import sys
def CopyAndRename(options):
if not options.source_dir:
print('You must specify the source directory')
return 1
if not options.destination_dir:
print('You must spec... | {
"content_hash": "7916cca19cf7958b5bdb5d87fc6107b0",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 66,
"avg_line_length": 29.923076923076923,
"alnum_prop": 0.6587403598971723,
"repo_name": "heke123/crosswalk",
"id": "b8226bf5e5f968330f705c97287cff52cf9e2b67",
"size": "17... |
import pprint
from django.template.defaultfilters import slugify
from django.template.loader import render_to_string
from django.views.generic import TemplateView
from .data import data
class StyleguideView(TemplateView):
template_name = 'styleguide/index.html'
def get_template_names(self):
template... | {
"content_hash": "659f917a88f8fa16d1225053e761b7ca",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 87,
"avg_line_length": 34.86046511627907,
"alnum_prop": 0.6130753835890593,
"repo_name": "bruecksen/isimip",
"id": "a72811c9c069331365b6903aa7d30fd1a3850844",
"size": "1499... |
from . import index as indexfinder
from . import compound as compoundfinder
class CreateCompoundTypeSubFinder(object):
def __init__(self, parser_factory, matcher_factory):
self.parser_factory = parser_factory
self.matcher_factory = matcher_factory
def __call__(self, project_info, *args):
... | {
"content_hash": "061b2ec7656feaa3505cfe74761dd65b",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 94,
"avg_line_length": 30.610526315789475,
"alnum_prop": 0.6764099037138928,
"repo_name": "frontg8/frontg8lib",
"id": "98666ee73621a5d3588900811bb9123394267457",
"size": "2... |
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# --... | {
"content_hash": "bc491bf020647d884c619f5f95d8551f",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 79,
"avg_line_length": 33.044444444444444,
"alnum_prop": 0.7099305088545169,
"repo_name": "dez-php/DesignPatternsPHP",
"id": "87f2d277b7d18b95bea6695a0023139df6036c3c",
"s... |
from __future__ import unicode_literals
import six
from tests import TestCase
class GenericRelationshipTestCase(TestCase):
def test_set_as_none(self):
event = self.Event()
event.object = None
assert event.object is None
def test_set_manual_and_get(self):
user = self.User()
... | {
"content_hash": "a7494aa1890daba68b54706dab55ed1d",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 71,
"avg_line_length": 25.55140186915888,
"alnum_prop": 0.5950987564008778,
"repo_name": "joshfriend/sqlalchemy-utils",
"id": "caabb0cf29cbc91219cffb5752272492cd681a5d",
"... |
"""Data prep, train and evaluate DNN model."""
import logging
import os
import numpy as np
import tensorflow as tf
from tensorflow.keras import callbacks, models
from tensorflow.keras.layers import (
Concatenate,
Dense,
Discretization,
Embedding,
Flatten,
Input,
Lambda,
)
from tensorflow.k... | {
"content_hash": "220f4643ba5cd2ceb6159941a8b5bc44",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 78,
"avg_line_length": 28.267543859649123,
"alnum_prop": 0.6449961210240497,
"repo_name": "GoogleCloudPlatform/training-data-analyst",
"id": "5826327263148a63cdb7b33634978ce... |
"""
This module contains a BigQuery Hook, as well as a very basic PEP 249
implementation for BigQuery.
"""
import time
import warnings
from copy import deepcopy
from typing import Any, Dict, Iterable, List, Mapping, NoReturn, Optional, Tuple, Type, Union
from googleapiclient.discovery import build
from googleapiclien... | {
"content_hash": "c092ebf617a15a0905cf1b8d5b2f7c4a",
"timestamp": "",
"source": "github",
"line_count": 2405,
"max_line_length": 168,
"avg_line_length": 43.49313929313929,
"alnum_prop": 0.577470578675156,
"repo_name": "Fokko/incubator-airflow",
"id": "f42a875b55e1c1a51f1f0057747d41a5b7fb60e7",
"siz... |
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.functional import lazy
from mapentity import registry
from extended_choices import Choices
from multiselectfield import MultiSelectField
DATA_SOURCE_TYPES = Choices(
('GEOJSON'... | {
"content_hash": "d2959c48ee79cfe4699d3a17a37102e4",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 97,
"avg_line_length": 35.40677966101695,
"alnum_prop": 0.6098611775969364,
"repo_name": "camillemonchicourt/Geotrek",
"id": "cb024633db617a57aafe16ebf8b9cce4fd456b23",
"si... |
from wef.decorators import log_decorator
import os
import requests
import json
class SendSMS():
@log_decorator
def send_sms(self, buyer_nickname, buyer_phone, saler_phone, selected_bookname):
appid = os.environ.get("APPID")
apikey = os.environ.get("APIKEY")
sender = '01020370706'
... | {
"content_hash": "969564fa3c5c572dc97b66683c3275f2",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 100,
"avg_line_length": 30.558823529411764,
"alnum_prop": 0.5899903753609239,
"repo_name": "deadlylaid/book_connect",
"id": "1277267fbd7267bd401ff8397a23cd00de21216d",
"siz... |
import uuid
from oslo_config import cfg
from st2common import log as logging
from st2actions.runners.ssh.fabric_runner import BaseFabricRunner
from st2actions.runners.ssh.fabric_runner import RUNNER_COMMAND
from st2actions.runners.ssh.paramiko_ssh_runner import BaseParallelSSHRunner
from st2common.models.system.actio... | {
"content_hash": "f3cb4545d580e1204d8dd81650102d16",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 94,
"avg_line_length": 44.383720930232556,
"alnum_prop": 0.5496463190987687,
"repo_name": "alfasin/st2",
"id": "f968f426130a282ae77ded3dc200d57e126ca767",
"size": "4597",
... |
"""
Scraper for Massachusetts Supreme Court
CourtID: mass
Court Short Name: MS
Author: Andrei Chelaru
Reviewer: mlr
History:
- 2014-07-12: Created.
- 2014-08-05, mlr: Updated regex.
- 2014-09-18, mlr: Updated regex.
"""
import re
import time
from datetime import date
from juriscraper.OpinionSite import OpinionSite
... | {
"content_hash": "6c1c2cf851d071eefb81cc0ee8566631",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 123,
"avg_line_length": 35.78846153846154,
"alnum_prop": 0.6120365394948952,
"repo_name": "brianwc/juriscraper",
"id": "aec5de67ed22cd131905808064404783dff08f74",
"size": "... |
import imath
import IECore
import Gaffer
import GafferUI
import GafferImage
def colorSpacePresetNames( plug ) :
return IECore.StringVectorData( [ "None" ] + sorted( map( lambda x: "Roles/{0}".format( x.replace( "_", " ").title() ), GafferImage.OpenColorIOTransform.availableRoles() ) ) + sorted( GafferImage.OpenCol... | {
"content_hash": "8086d1d176758ed6abd3352944147b73",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 245,
"avg_line_length": 27.685393258426966,
"alnum_prop": 0.703327922077922,
"repo_name": "ivanimanishi/gaffer",
"id": "00657f8a871959a4ce7cc023886b9b6278dbd1a8",
"size": "... |
from __future__ import unicode_literals
from unittest import TestCase
from zplgen import Command, Font
class CommandsTestCase(TestCase):
"""
Tests for the interesting command types.
"""
def test_field_encoding(self):
"""
Tests that Command.field handles unicode characters by encodin... | {
"content_hash": "702244da061357cccc010cb70279ca3c",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 77,
"avg_line_length": 26.014388489208635,
"alnum_prop": 0.5627765486725663,
"repo_name": "kolonialno/zplgen",
"id": "26b4cc404806e1ebf44af4c6fed10b4cd24f7a2f",
"size": "3... |
from __future__ import unicode_literals
from .base import Base
from .generator import generator_of
from .normal import normal_attr
from .other import other_obj
from .urls import (
TOPIC_ACTIVITIES_URL,
TOPIC_BEST_ANSWERERS_URL,
TOPIC_BEST_ANSWERS_URL,
TOPIC_CHILDREN_URL,
TOPIC_DETAIL_URL,
TOPIC... | {
"content_hash": "b73145f02bb9f0481bb734008a12f6c3",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 79,
"avg_line_length": 22.83112582781457,
"alnum_prop": 0.5496736765772299,
"repo_name": "7sDream/zhihu-oauth",
"id": "cbbcea8a53f7cf545bf2f46b847df94044ab3699",
"size": "... |
'''
Author:
Description:
'''
from core.broadcast import say, bang
from core.config.settings import logger
class Reaction:
"""class Reaction"""
response = ''
request = ''
def __str__(self):
return 'My new reaction'
@classmethod
def __init__(self, *args, **kwargs):
""" original... | {
"content_hash": "dc392ec6250c199df72ae143d3145938",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 79,
"avg_line_length": 25.571428571428573,
"alnum_prop": 0.5522745411013568,
"repo_name": "vsilent/smarty-bot",
"id": "c6b81c3f05be5bf03dc02af0cfb1bc45d5d335bf",
"size": "3... |
"""
Copyright 2014 Magnus Briden
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 to in writing, software
... | {
"content_hash": "22f1eff2f60192a4dabef99ac4bc221a",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 143,
"avg_line_length": 32.26829268292683,
"alnum_prop": 0.7214663643235072,
"repo_name": "Haxtastic/FatbotIRC",
"id": "28bf38073fd35eb6a14906486b353900be23f4bd",
"size": "... |
"""
Yandex OpenID and OAuth2 support.
This contribution adds support for Yandex.ru OpenID service in the form
openid.yandex.ru/user. Username is retrieved from the identity url.
If username is not specified, OpenID 2.0 url used for authentication.
"""
try:
import json as simplejson
except ImportError:
try:
... | {
"content_hash": "309fe0edfe8c4188b1090f1923c8965a",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 76,
"avg_line_length": 28.55757575757576,
"alnum_prop": 0.5925297113752123,
"repo_name": "jdavidagudelo/django-social-auth-corrected",
"id": "46f9f003a2ae63217cb5b42b5c9b38f... |
import html5lib
import random
import re
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
def render_mail_as_js(dom_id, email, text=None, autoescape=None):
text = text or email
if autoescape:
email = ... | {
"content_hash": "7a1fb1f6715b0e3969eb30d106628df6",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 81,
"avg_line_length": 35.17142857142857,
"alnum_prop": 0.5548334687246141,
"repo_name": "rouxcode/django-md",
"id": "a907788474edd2ac41ae68db443a0ec9a3344616",
"size": "12... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import range
from future import standard_library
standard_library.install_aliases()
import sys
PYTHON_VERSION = sys.version_info[:3]
PY2 = (PYTHON_VERSION[0... | {
"content_hash": "e8896682ff21985cdc35a329120f5710",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 105,
"avg_line_length": 31.578512396694215,
"alnum_prop": 0.5878042397278199,
"repo_name": "ufcg-lsd/python-hpOneView",
"id": "e10273eb02a7dd422c948435f851ed54355ff13b",
"... |
import time,urllib
from vsa.client.gui.pages import DefaultHeader
PageHeader2="""
<html><head><title>%s</title>
<script>
function expand(sec)
{thisSec = eval('sec' + sec);
if (thisSec != null){
if (thisSec.length){
if (thisSec[0].style.display != 'none'){
for (var i=0;i<th... | {
"content_hash": "ad126e9c1d0ef999a4c96c6e462340bc",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 133,
"avg_line_length": 28.693617021276594,
"alnum_prop": 0.5376686934598843,
"repo_name": "mellanox-openstack/vsa",
"id": "0d8e5c45945dd0aeb0dac1bce79c5e3cb51dff88",
"siz... |
from disassemble import disassemble
from decompile import decompile_functions
from objdump import objdump
import control_flow
import debug
import representation
if __name__=="__main__":
import sys
from optparse import OptionParser
usage = "usage: %prog [options] file"
parser = OptionParser(usage=usage... | {
"content_hash": "33603777b1e5bb4477c473a88b232b35",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 124,
"avg_line_length": 31.147540983606557,
"alnum_prop": 0.6163157894736843,
"repo_name": "drx/ocd",
"id": "b2f6e4f24ecc6b73c0d868ab3ec1c7d04335b269",
"size": "1923",
"b... |
from django.conf.urls import include, patterns, url
from . import views
urlpatterns = patterns('',
url(r'^(?P<slug>\w+)/', views.ProfileView.as_view(), name='profile'),
)
| {
"content_hash": "7b18082f3d7502b2e1d9e5d334c2b96d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 73,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.6761363636363636,
"repo_name": "Clemson-DPA/dpa-pipe-backend",
"id": "8718c3a6c9a5652dd6848ec65b61cc9a109b8ea0",
"... |
"""Development settings and globals."""
from __future__ import absolute_import
from os.path import join, normpath
from .base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-deb... | {
"content_hash": "4b757baf64e645c3838dab4ee28a955c",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 93,
"avg_line_length": 25.824324324324323,
"alnum_prop": 0.6677132391418106,
"repo_name": "linhyo/todo",
"id": "aa402e8eb22331259306993a03dae9111f02e827",
"size": "1911",
... |
import sys
import os
import unittest
import subprocess
from tests.context import sbpipe
from sbpipe.utils.dependencies import is_py_package_installed
class TestPs1Snake(unittest.TestCase):
_orig_wd = os.getcwd()
_ir_folder = 'snakemake'
_output = 'OK'
@classmethod
def setUpClass(cls):
os... | {
"content_hash": "8a409e5f805aee4327e8ac915048b8a7",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 75,
"avg_line_length": 31.947916666666668,
"alnum_prop": 0.5024453863710466,
"repo_name": "pdp10/sbpipe",
"id": "2aedcb6b71ad700d8ed07d1a4f3d29f7bf28c7e3",
"size": "4214",
... |
from django import http
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
from django.conf import settings
import os
import gettext as gettext_module
def set_language(request):
"""
Redirect to a given url while setting the ... | {
"content_hash": "c96c9454c95df5225e3918f68f343824",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 124,
"avg_line_length": 35.05232558139535,
"alnum_prop": 0.6065682534416985,
"repo_name": "jonaustin/advisoryscan",
"id": "0fec6b6c6fad1e78e16a37740725de72159d3028",
"size... |
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.core import core_select_lib
__all__ = ('NFCBase', 'NFCScanner')
class NFCBase(Widget):
''' This is the base Abstract definition class that the actual hardware dependent
implementations would be based on. If you want to def... | {
"content_hash": "a20018616a2dbf5364dfe07649fcb18f",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 130,
"avg_line_length": 28.041666666666668,
"alnum_prop": 0.637444279346211,
"repo_name": "fujicoin/electrum-fjc",
"id": "d9935d231babe9468b50e162963527e82d000612",
"size":... |
from importlib import import_module
from fabric.api import env
from fabric.api import cd, run, settings, sudo
from fabric.contrib.files import append, comment, exists
from .deploy import AllowedException, checkout_branch, deploy, get_repo_dir, WEBADMIN_GROUP
env.use_ssh_config = True
REPO_FULL_NAME = 'GitHubU... | {
"content_hash": "e01d6162bfb42f7db98d02101acfcb77",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 122,
"avg_line_length": 35.1731843575419,
"alnum_prop": 0.6099110546378653,
"repo_name": "kbarnes3/BaseDjangoSite",
"id": "a0baae285b227202348d2e5b5455d366fc84c447",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.