text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import absolute_import
import os
from apollo import ApolloInstance
from .config import read_global_config, global_config_path
def get_instance(instance_name=None):
# I don't like reading the config twice.
conf = read_global_config()
if not os.path.exists(global_config_path()):
# Pr... | {
"content_hash": "6c844b8e8e063eab2efb9909f90d8874",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 96,
"avg_line_length": 34,
"alnum_prop": 0.6859243697478992,
"repo_name": "galaxy-genome-annotation/python-apollo",
"id": "7307afd86ce9e94f19f2dab057b30cf4198c3c54",
"size"... |
'''
Created on Apr 28, 2010
@author: jnaous
'''
from django.contrib import admin
from models import UserProfile
admin.site.register(UserProfile)
| {
"content_hash": "89998b308d0d27ccd203d5126557b7e0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 32,
"avg_line_length": 16.333333333333332,
"alnum_prop": 0.7687074829931972,
"repo_name": "dana-i2cat/felix",
"id": "7546f7b99cbcdbc9c150af6e4f631beb00b9d40a",
"size": "147"... |
from nose.tools import eq_
from kitsune.karma.templatetags.jinja_helpers import karma_titles
from kitsune.karma.models import Title
from kitsune.users.tests import TestCase, UserFactory, GroupFactory
class KarmaTitleHelperTests(TestCase):
def setUp(self):
super(KarmaTitleHelperTests, self).setUp()
... | {
"content_hash": "4d38e5722e22a163d55f6889000c5810",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 67,
"avg_line_length": 29.933333333333334,
"alnum_prop": 0.5983667409057164,
"repo_name": "anushbmx/kitsune",
"id": "7d8897728957c655f2b8ae0de4c8c4727d07ba53",
"size": "134... |
''' common module '''
__all__ = ['common']
from heron.tools.ui.src.python.handlers.common.consts import *
from heron.tools.ui.src.python.handlers.common.utils import *
| {
"content_hash": "d13fe4ade4564a19be9f8fadbbd60212",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 62,
"avg_line_length": 33.8,
"alnum_prop": 0.7218934911242604,
"repo_name": "nlu90/heron",
"id": "4ace12b20556e6d08730c7161160cde9d81c2fca",
"size": "954",
"binary": false... |
import logging
import hashlib
from django.conf import settings
from django.dispatch import Signal, receiver
from django.utils.timezone import now as tz_now
from django.utils.crypto import get_random_string
from .models import ImpersonationLog
logger = logging.getLogger(__name__)
# signal sent when an impersonation se... | {
"content_hash": "ca29c771c6dcc3699d752fffbeab04e2",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 77,
"avg_line_length": 30.60185185185185,
"alnum_prop": 0.6420574886535552,
"repo_name": "Top20Talent/django-impersonate",
"id": "cbed2f15f2dda3a21d05ec44d841040e82922cee",
... |
from pykickstart.version import *
from pykickstart.commands import *
# This map is keyed on kickstart syntax version as provided by
# pykickstart.version. Within each sub-dict is a mapping from command name
# to the class that handles it. This is an onto mapping - that is, multiple
# command names can map to the sam... | {
"content_hash": "6db1256484f2488353aff4425156980b",
"timestamp": "",
"source": "github",
"line_count": 1288,
"max_line_length": 77,
"avg_line_length": 38.838509316770185,
"alnum_prop": 0.6096873500719655,
"repo_name": "marcosbontempo/inatelos",
"id": "d8c8f2b89941c7c8de37393b7127e483f6a341b0",
"si... |
"""
homeassistant.components.device_tracker.owntracks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OwnTracks platform for the device tracker.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.owntracks/
"""
import json
import logging
im... | {
"content_hash": "effaf2392f2853fc8a19fcaac0109083",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 75,
"avg_line_length": 29.943396226415093,
"alnum_prop": 0.5422180214240706,
"repo_name": "sfam/home-assistant",
"id": "e1b0e1de306b0bbe15c12524552ee6b6f9e4f300",
"size": ... |
from django.contrib import admin
from django.contrib.gis import admin as gis_admin
from geo.models import Region, Place
class RegionAdmin(gis_admin.OSMGeoAdmin):
point_zoom = 11
list_display = ['name', 'parent', 'level', 'description', 'code', 'iso3']
fields = ['name', 'level', 'description', 'code', 'is... | {
"content_hash": "385ead0744d0d05721f62b1180fc5c08",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 83,
"avg_line_length": 29.321428571428573,
"alnum_prop": 0.6699147381242387,
"repo_name": "jleivaizq/freesquare",
"id": "ff17bca8b5ffae697c34faf78d5e62fd85f578b8",
"size": ... |
from django.core.urlresolvers import reverse, resolve
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from pretix.base.signals import register_payment_providers
from .payment import BankTransfer
from pretix.control.signals import nav_event
@receiver(register_payment_prov... | {
"content_hash": "a9fbe0cfc442ad824e2f3f93eca275eb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 93,
"avg_line_length": 31.483870967741936,
"alnum_prop": 0.6577868852459017,
"repo_name": "Unicorn-rzl/pretix",
"id": "634bbcd4a0ee3b8eb6c8a68f1219f6bd25de7068",
"size": "9... |
"""Get the App Engine app ID from environment.
Not to be confused with `google.appengine.api.app_identity.get_application_id()`
which gets a "display" app ID.
"""
import os
from typing import MutableMapping, Text, Optional
OsEnvironLike = Optional[MutableMapping[Text, Text]]
def get(environ: OsEnvironLike = None... | {
"content_hash": "e3b4c2845245629ab0e9dc2fd5c9148b",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 80,
"avg_line_length": 25.304761904761904,
"alnum_prop": 0.6751975912683478,
"repo_name": "GoogleCloudPlatform/appengine-python-standard",
"id": "00f256bf11d82322782220d4f0b... |
"""
Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
This file is part of Toolium.
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... | {
"content_hash": "eba40ae9a6f9199b8d28f45f5db7bbea",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 119,
"avg_line_length": 35.03061224489796,
"alnum_prop": 0.7292455578211476,
"repo_name": "Telefonica/toolium",
"id": "d11724dd2dc4a965803a4336c25c15d1a86a22e0",
"size": "... |
"""Defines all Student's models.
Many of these modules are admin by Django Admin UI.
"""
from django.db import models
from apps.settings.models import Time
from django.conf import settings
class Grade(models.Model):
"""Grade table class."""
name = models.CharField(max_length='45', db_column='name', null=False, bla... | {
"content_hash": "d7b2fab342e27aab35d509145045bc2a",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 117,
"avg_line_length": 33.38345864661654,
"alnum_prop": 0.7036036036036036,
"repo_name": "dairdr/notes",
"id": "3cd6a19c14cefa0d9e3c64b7313c993eb3964433",
"size": "4466",... |
"""
Handles sequence of messages that are used to send OMCI to the ONU
"""
import structlog
from scapy.automaton import ATMT
from voltha.adapters.microsemi_olt.BaseOltAutomaton import BaseOltAutomaton
from voltha.adapters.microsemi_olt.PAS5211 import PAS5211MsgSendFrame, PAS5211MsgGetOltVersionResponse, PAS5211MsgSend... | {
"content_hash": "aaea026f0229f0045f5c330b39cf7b75",
"timestamp": "",
"source": "github",
"line_count": 711,
"max_line_length": 176,
"avg_line_length": 45.17862165963432,
"alnum_prop": 0.6630346802814271,
"repo_name": "opencord/voltha",
"id": "8a529bcfda850ea1237b5733a5669bf998a9dcb5",
"size": "327... |
import argparse
import random
import re
import sys
import binascii
class vbs_gen:
def __init__(self, args):
self.vb_code = ""
self.args = args
if not args.cmd and not args.writeFilePath:
sys.stderr.write("Error: must execute a command or write a file (or both). See --help")
self.create_vartable()
self.... | {
"content_hash": "3d6a612e8d3ceac3eb3e42bdb9cd0dce",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 149,
"avg_line_length": 41.5819209039548,
"alnum_prop": 0.6188858695652174,
"repo_name": "zigitax/webstersprodigy",
"id": "f0b75a40179daf371bd04bcd0ffd5805513f8a7d",
"size... |
__author__ = "Mark Pilgrim <http://diveintomark.org/>"
__license__ = """
Copyright (c) 2010-2012 Kurt McKee <contactme@kurtmckee.org>
Copyright (c) 2004-2008 Mark Pilgrim
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following cond... | {
"content_hash": "01ee1b7f93f30ebe3c06354f3a2fc160",
"timestamp": "",
"source": "github",
"line_count": 857,
"max_line_length": 137,
"avg_line_length": 45.85180863477246,
"alnum_prop": 0.611757221020486,
"repo_name": "milkey-mouse/SongRater",
"id": "aadcf79df084e5baa0b2f293c45a75c3e28befc6",
"size"... |
import sys, getopt
from integrate import integrate
########
# Usage
# python phishing_detection.py -s [string] -f [file]
########
DEFAULT_URL = "https://www.naver.com/"
def call_integrate(url):
try:
return integrate(url)
except:
print("Error(001): integrate() failed")
def call_integrate_for_... | {
"content_hash": "aa906e30ebe6328fa3b878864a7f39f0",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 112,
"avg_line_length": 33.27777777777778,
"alnum_prop": 0.5321368948247078,
"repo_name": "jaeyung1001/phishing_site_detection",
"id": "6b0d7ffc44f2247417cb5c931772bd9b4db159... |
import _plotly_utils.basevalidators
class ArrayminussrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="arrayminussrc", parent_name="scatter3d.error_x", **kwargs
):
super(ArrayminussrcValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "a15c12f057460d959cfa9c38b81d476b",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 84,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.60625,
"repo_name": "plotly/python-api",
"id": "159dbff9da6e6b6045949b5665d44cb22359731b",
"size": "480",
"bina... |
from calyptos.plugins.validator.validatorplugin import ValidatorPlugin
class Storage(ValidatorPlugin):
def validate(self):
self.topology = self.environment['default_attributes']['eucalyptus']['topology']
if 'system-properties' in self.environment['default_attributes']['eucalyptus']:
sel... | {
"content_hash": "87361780abc0840a739ce71b674e3beb",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 120,
"avg_line_length": 73.20588235294117,
"alnum_prop": 0.5162715950180795,
"repo_name": "nephomaniac/calyptos",
"id": "1c8bba32300d722d190015a77d7c9ecb2549bf5d",
"size": ... |
from ex_fifo36 import convert
def test_fifo36_conversion():
convert()
| {
"content_hash": "f3ce5854058012fd16085a620d7248ea",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 29,
"avg_line_length": 12.833333333333334,
"alnum_prop": 0.7142857142857143,
"repo_name": "NickShaffner/rhea",
"id": "ca235f946f2638f8d2eb30f4e53e61f9b96b747b",
"size": "79"... |
from django.conf.urls import url
from . import views
app_name = 'base'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^problems/$', views.problem_report, name='problem')
]
| {
"content_hash": "5b4fb33d8c12e81237a80c37fd38b3c5",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 61,
"avg_line_length": 21.77777777777778,
"alnum_prop": 0.6530612244897959,
"repo_name": "bit-bots/imagetagger",
"id": "a463903d4b4ac530a4ef00524cdddaf1a78b872a",
"size": "1... |
import sys
def solveGomoku(size, grid, findAll=False):
"""Find the winning player from a gomoku game state.
If findAll is True, try to find all winning sets of 5 pawns."""
# Function to read the grid
def getPawn(row, col):
if (row < 0) or (row >= size) or (col < 0) or (col >= size):
... | {
"content_hash": "36f7f19e2210f13634e3a104e15b4038",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 78,
"avg_line_length": 34.25925925925926,
"alnum_prop": 0.49405405405405406,
"repo_name": "France-ioi/taskgrader",
"id": "ef05103f81fc23174236ed70866e268794b5c3aa",
"size":... |
"""Test createwallet watchonly arguments.
"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error
)
class CreateWalletWatchonlyTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = False
... | {
"content_hash": "0ab22c65984ed9365102f80066ec7657",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 126,
"avg_line_length": 42.271028037383175,
"alnum_prop": 0.6734468273269953,
"repo_name": "litecoin-project/litecoin",
"id": "2bf7c094e56f93591268a182434407a5dedf040a",
"... |
class computed_property(object):
def __init__(self, get_func):
self.get_func = get_func
def __get__(self, instance, owner):
if instance is None:
return self
return self.get_func(instance)
| {
"content_hash": "2b373257e1cdec7ae4a45d0922586fda",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 37,
"avg_line_length": 26.375,
"alnum_prop": 0.6492890995260664,
"repo_name": "uskudnik/ggrc-core",
"id": "2f723ffc520c20e13995cc97d5abd8454f159e2c",
"size": "451",
"binar... |
import pytest
from machina.core.db.models import get_model
from machina.test.factories import (
PostFactory, UserFactory, create_category_forum, create_forum, create_link_forum, create_topic
)
Post = get_model('forum_conversation', 'Post')
Topic = get_model('forum_conversation', 'Topic')
@pytest.mark.django_db... | {
"content_hash": "64d109ff0326419fc415342b40bf0778",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 98,
"avg_line_length": 36.58,
"alnum_prop": 0.6593767085839256,
"repo_name": "ellmetha/django-machina",
"id": "ea5dd4f2141837a283dde0a43908b86559998750",
"size": "1829",
... |
"""Workflow_Event TQL Filter"""
# standard library
from enum import Enum
# first-party
from tcex.api.tc.v3.api_endpoints import ApiEndpoints
from tcex.api.tc.v3.filter_abc import FilterABC
from tcex.api.tc.v3.tql.tql_type import TqlType
class WorkflowEventFilter(FilterABC):
"""Filter Object for WorkflowEvents"""... | {
"content_hash": "46a1a9e16c9cf6f189fd721c311aafd8",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 93,
"avg_line_length": 37.04545454545455,
"alnum_prop": 0.618159509202454,
"repo_name": "ThreatConnect-Inc/tcex",
"id": "6ba4a4a6f8ab767e7728907d1455021621209863",
"size":... |
""" Jekyll at Rackspace Cloud Files with Clean URLs """
import os
import cloudfiles
# Rackspace Cloud API credentials
USERNAME = "RACKSPACECLOUD_USERNAME"
API_KEY = "RACKSPACECLOUD_API_KEY"
# The name of your container.
# I create containers in the format: www.domain.com
CONTAINER_NAME = "www.yourdomain.com"
conn = ... | {
"content_hash": "5ecf2d12c01c79ea410d62bd5db1893a",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 64,
"avg_line_length": 34.41463414634146,
"alnum_prop": 0.6236711552090716,
"repo_name": "nicholaskuechler/jekyll-rackspace-cloudfiles-clean-urls",
"id": "e7e6bda6d823234e55e... |
import pytest
from deepctr.models import DeepFM
from ..utils import check_model, get_test_data, SAMPLE_SIZE, get_test_data_estimator, check_estimator, TEST_Estimator
@pytest.mark.parametrize(
'hidden_size,sparse_feature_num',
[((2,), 1), #
((3,), 2)
] # (True, (32,), 3), (False, (32,), 1)
)
def t... | {
"content_hash": "3613b76a3a00715ae3d9078fad7b6d6e",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 122,
"avg_line_length": 37.191489361702125,
"alnum_prop": 0.5577803203661327,
"repo_name": "shenweichen/DeepCTR",
"id": "b466fbc8182147d1752e156d0747c3f0f23571cb",
"size": ... |
"""This example gets all ad groups for a given campaign.
To add an ad group, run add_ad_group.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication information"... | {
"content_hash": "aae882dd7d28b15cb25167c28fa76b17",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 77,
"avg_line_length": 27.327868852459016,
"alnum_prop": 0.611877624475105,
"repo_name": "losnikitos/googleads-python-lib",
"id": "c295768f54e2c1f614aff5974409cfaa90e9f9f6",
... |
from __future__ import division
import csv
def load_inflation_data(filename='usinf.csv'):
with open(filename, 'rb') as inflation:
reader = csv.reader(inflation)
reader.next() #ignore first line
data = {int(row[0]): float(row[1]) for row in reader}
return data
def calculate_inflation(p... | {
"content_hash": "01b9fc08683fafa842ac94c3a520eebf",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 126,
"avg_line_length": 35.24324324324324,
"alnum_prop": 0.6449386503067485,
"repo_name": "cgkanchi/usinflation",
"id": "739de87fbf0f2df5a4fe27e7794028648342de40",
"size": ... |
from nose.tools import raises
from . import ChadoTestCase, ci
class GFFTest(ChadoTestCase):
def _del_dbxref(self):
self.ci.session.query(self.ci.model.dbxref).filter(
self.ci.model.dbxref.db_id == 1,
(self.ci.model.dbxref.accession.like('VNBP%') | self.ci.model.dbxref.accession.l... | {
"content_hash": "127b29a7169c938190decc0582c5f787",
"timestamp": "",
"source": "github",
"line_count": 1673,
"max_line_length": 224,
"avg_line_length": 57.75313807531381,
"alnum_prop": 0.659577110566026,
"repo_name": "abretaud/python-chado",
"id": "cb8efbf57e23f1773e16baff74bd67525b3c0dff",
"size"... |
import numpy as np
import pylab as pl
def scatter_contour(x, y,
levels=10,
threshold=100,
log_counts=False,
histogram2d_args={},
scatter_args={},
contour_args={},
contour_lw={},
... | {
"content_hash": "6c813e0dd314aefc66d03e11380fa8d7",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 78,
"avg_line_length": 34.22352941176471,
"alnum_prop": 0.5256101753179787,
"repo_name": "philrosenfield/ResolvedStellarPops",
"id": "ac8be9ca9ac8a88e608b43d51d1a72834df6135b... |
from flask import Blueprint
from flask_appbuilder import BaseView as AppBuilderBaseView, expose
from airflow.executors.base_executor import BaseExecutor
# Importing base classes that we need to derive
from airflow.hooks.base import BaseHook
from airflow.models.baseoperator import BaseOperator
# This is the class you... | {
"content_hash": "2c836b96066dc7d48bebcd54a3275cdd",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 99,
"avg_line_length": 26.944,
"alnum_prop": 0.7354513064133017,
"repo_name": "apache/incubator-airflow",
"id": "bae3d93db4768d126ed035c2ea40b82acc3c509d",
"size": "4156",... |
from __future__ import absolute_import
from ....pipeline import engine as pe
from ....interfaces import utility as niu
from ....interfaces import fsl
from ....algorithms import misc
# backwards compatibility
from .epi import create_eddy_correct_pipeline
def transpose(samples_over_fibres):
import numpy as np
... | {
"content_hash": "ca61b95bb0b635f934a9ecf0a4b2ead5",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 102,
"avg_line_length": 39.266666666666666,
"alnum_prop": 0.5271147508239289,
"repo_name": "carolFrohlich/nipype",
"id": "ebcd46c84ffce8633e56f439ffb389238c0043a8",
"size"... |
"""Tests for image_segmenter."""
import enum
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
from tensorflow_lite_support.python.task.core import base_options as base_options_module
from tensorflow_lite_support.python.task.processor.proto import segmentation_options_pb2
from tensorf... | {
"content_hash": "a85b4be87c2896292810d7021c24f2e6",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 88,
"avg_line_length": 43.69642857142857,
"alnum_prop": 0.7155700858193706,
"repo_name": "chromium/chromium",
"id": "3b0a01e1b135809e88eb573bdbc15b49ae373709",
"size": "10... |
"""Models related to Oppia improvement tasks."""
from __future__ import annotations
from core.constants import constants
from core.platform import models
from typing import Dict, List, Optional
MYPY = False
if MYPY: # pragma: no cover
from mypy_imports import base_models
from mypy_imports import datastore_s... | {
"content_hash": "2f8ae08b1b6c571954091470ee493ce5",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 80,
"avg_line_length": 39.271844660194176,
"alnum_prop": 0.6260403790688093,
"repo_name": "kevinlee12/oppia",
"id": "dc71ac16464fb4f2f2468ad306d85364fa0495a1",
"size": "12... |
"""
This module holds a wsgi server and future web-related code.
"""
| {
"content_hash": "7bd862bca9821fe8055518e72e480715",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 60,
"avg_line_length": 24,
"alnum_prop": 0.6805555555555556,
"repo_name": "ionelmc/python-cogen",
"id": "e4bfb67aac754164137851c62bf9b3407fa28601",
"size": "72",
"binary":... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'User.verified'
db.alter_column('fandjango_user', 'verified', self.gf('django.db.models.fields.NullBooleanF... | {
"content_hash": "fa495abe9f3c1e5549a57bb453cd379d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 138,
"avg_line_length": 65.9074074074074,
"alnum_prop": 0.5580219162686147,
"repo_name": "jgorset/fandjango",
"id": "185a027fcd972e552900d26c471e47e7ef190873",
"size": "357... |
from flask import Blueprint
wechat = Blueprint('wechat', __name__)
from . import views | {
"content_hash": "12475ca88a5be7669727b2fb704a9b2b",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 38,
"avg_line_length": 17.6,
"alnum_prop": 0.7272727272727273,
"repo_name": "archever/archever_me",
"id": "33cbaf4368049f10e772de18841a8422870b64cd",
"size": "89",
"binary... |
import six
from . import unittest
from kafka.partitioner import (Murmur2Partitioner)
class TestMurmurPartitioner(unittest.TestCase):
def test_hash_bytes(self):
p = Murmur2Partitioner(range(1000))
self.assertEqual(p.partition(bytearray(b'test')), p.partition(b'test'))
def test_hash_encoding(se... | {
"content_hash": "1e1887f9bfad52ef666075a845fed61f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 88,
"avg_line_length": 40.26086956521739,
"alnum_prop": 0.6825053995680346,
"repo_name": "gamechanger/kafka-python",
"id": "67cd83bc4114ee0f18946e74b17e2b0fb0121406",
"size... |
import socket
import sys
import time
from functools import partial
from tornado import gen
from tornado.testing import AsyncTestCase, gen_test
from zookeeper_monitor import zk
from .fixtures import host as FIXTURE
try:
from unittest.mock import call, patch, Mock, MagicMock
except:
from mock import call, patch... | {
"content_hash": "eb4db16d284d8716f9f4b95399620c8c",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 110,
"avg_line_length": 39.48880597014925,
"alnum_prop": 0.6078616649343287,
"repo_name": "kwarunek/zookeeper_monitor",
"id": "8727c499730eeca32f3badc16a2b33991884bce0",
"... |
import cv2
import os
import numpy as np
from copy import copy
clicks = []
click_counter = 0
def _click_callback(event, x, y, flags, param):
global click_counter
global clicks
if event == cv2.EVENT_LBUTTONDOWN:
clicks.append((x, y))
click_counter -= 1
def click_on_image(
image, t... | {
"content_hash": "f0020ec57067cd8b7cfad59f0850d32d",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 73,
"avg_line_length": 30.0531914893617,
"alnum_prop": 0.5830088495575221,
"repo_name": "Wing0/oskui",
"id": "1eab7dd7f4dfa1917844da9f577e3d7b575c10bc",
"size": "2825",
"... |
"""Media Source models."""
from __future__ import annotations
from abc import ABC
from dataclasses import dataclass
from homeassistant.components.media_player import BrowseMedia
from homeassistant.components.media_player.const import (
MEDIA_CLASS_CHANNEL,
MEDIA_CLASS_DIRECTORY,
MEDIA_TYPE_CHANNEL,
ME... | {
"content_hash": "38b4be2d36e2d1d07ef99dfc46e1e72b",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 80,
"avg_line_length": 29.398373983739837,
"alnum_prop": 0.5998340707964602,
"repo_name": "adrienbrault/home-assistant",
"id": "aa17fff320efe1f1e7cd1147f3808e9256fb417f",
... |
class LadLoggingConfigException(Exception):
"""
Custom exception class for LAD logging (syslog & filelogs) config errors
"""
pass
class LadPerfCfgConfigException(Exception):
"""
Custom exception class for LAD perfCfg (raw OMI queries) config errors
"""
pass
| {
"content_hash": "294e1284ebd8e9760a8f4431d7314313",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 76,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.6952054794520548,
"repo_name": "Azure/azure-linux-extensions",
"id": "7d84b3c1edcb10e3ddcd3e67b119a74102632e95",
... |
"""Python layer for set_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.framework.python.framework import tensor_util
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import load_library
from te... | {
"content_hash": "6ec3f974b24c971e2029fadd6364359d",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 79,
"avg_line_length": 37.16751269035533,
"alnum_prop": 0.6857416006555586,
"repo_name": "Lab603/PicEncyclopedias",
"id": "4ed4370d92ceda53e081016164ef36a202feb75e",
"size... |
import flask, flask.views
users = {'jake':'bacon'}
class Login(flask.views.MethodView):
def get(self):
return flask.render_template('login.html')
def post(self):
if 'logout' in flask.request.form:
flask.session.pop('username', None)
return flask.redirect... | {
"content_hash": "bc5996dcfbe5f912e95cfedba85c6167",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 71,
"avg_line_length": 39.291666666666664,
"alnum_prop": 0.5832449628844114,
"repo_name": "sergeimoiseev/egrixcalc",
"id": "cdd2d7a7e8c4c47856f39211324f82327beb4f46",
"size... |
from flask import Flask, request, send_from_directory
import os
port = int(os.getenv("PORT", 9099))
app = Flask(__name__)
@app.route("/<path:path>")
def serve_page(path):
return send_from_directory("static", path)
@app.route("/")
def main():
"""Adjust the presentation_name if you rename the jupyter notebook... | {
"content_hash": "a01b84d27126fb8dba16c1c5f7f73b3c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 74,
"avg_line_length": 26.473684210526315,
"alnum_prop": 0.6719681908548708,
"repo_name": "mlmerile/presagir",
"id": "b0608d93ea7a7cde101ee9b8ab5c8fa310293af7",
"size": "50... |
import json
import argparse
import datetime
import os
from filters import valid_json_filter
from functools import partial
from pyspark import SparkContext, SparkConf
def rmkey(k, o):
if k in o:
del o[k]
return o
def extractKeys(keys, o):
rtn = {}
for k in keys:
if k in o:
r... | {
"content_hash": "3bd1df51145ce8c51f45dae9529eb0e9",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 161,
"avg_line_length": 33.55421686746988,
"alnum_prop": 0.6434470377019749,
"repo_name": "Sotera/pst-extraction",
"id": "fe1814dc88069e65d37c870c638724429c4c553e",
"size":... |
from __future__ import absolute_import
from Queue import *
| {
"content_hash": "fd3a7a355720d9c819aef2b7fe935569",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 38,
"avg_line_length": 20,
"alnum_prop": 0.75,
"repo_name": "AbsoluteMSTR/pies",
"id": "8cd58f380da1b2154e25e8c3ba52947bac39a50e",
"size": "60",
"binary": false,
"copies... |
"""
Support for Eufy lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.eufy/
"""
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP, SUPP... | {
"content_hash": "2c8093cd87892aadbf9514a09b64759c",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 78,
"avg_line_length": 31.405882352941177,
"alnum_prop": 0.5663982019104701,
"repo_name": "PetePriority/home-assistant",
"id": "7a44a58cd81d09e9a444d43fd92526668b651a2c",
... |
from nltk.classify import PositiveNaiveBayesClassifier
from detie.data import PickleData, DictData
def features(words):
return {char: True for char in words}
def train(spam_words, unlabeled_words):
spams = list(map(features, spam_words))
unlabeled = list(map(features, unlabeled_words))
model = Posi... | {
"content_hash": "82d7e77050e87577aa37a8864d893a46",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 69,
"avg_line_length": 25.8,
"alnum_prop": 0.6821705426356589,
"repo_name": "shanzi/detie",
"id": "63ad88665c17ff0a94bb8b83d5a8b3adc7f6c211",
"size": "903",
"binary": fal... |
from __future__ import absolute_import, unicode_literals
import json
from django import forms
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase
from wagtail.tests.testapp.models import FormField, FormPage, JadeFormPage
from wagtail.tests.utils import WagtailTe... | {
"content_hash": "100ee126a8d0ded3daf40e2e2e096186",
"timestamp": "",
"source": "github",
"line_count": 760,
"max_line_length": 120,
"avg_line_length": 38.71184210526316,
"alnum_prop": 0.6175520886441658,
"repo_name": "kurtrwall/wagtail",
"id": "962f071967588f1f9d736732077e882808f1dac1",
"size": "2... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# 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.apa... | {
"content_hash": "ecb2dc4e23e7bb15227774180d2278a6",
"timestamp": "",
"source": "github",
"line_count": 1349,
"max_line_length": 106,
"avg_line_length": 40.223128243143066,
"alnum_prop": 0.6013895799929968,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "83dd5e85c09d35486b40483990b3f98150d5532e",
... |
from . import AWSHelperFn, AWSObject, AWSProperty
from .validators import (
boolean, exactly_one, integer, integer_range,
network_port, positive_integer
)
try:
from awacs.aws import Policy
policytypes = (dict, Policy)
except ImportError:
policytypes = dict,
class Tag(AWSProperty):
props = {
... | {
"content_hash": "a4215d4acae567de30b44f346f7bfe8f",
"timestamp": "",
"source": "github",
"line_count": 674,
"max_line_length": 73,
"avg_line_length": 27.4540059347181,
"alnum_prop": 0.5985732814526589,
"repo_name": "7digital/troposphere",
"id": "80201ec3534cb5fc2e48a8dd4c54e22c1afc8d90",
"size": "... |
"""
Implemention of groupby/aggregation in Myrial.
The inputs are a child Operator and a list of column mappings, each defined
by tuples of the form: (column_name, scalar_expression). The outputs are
(possibly) revised operators and list of column mappings.
The basic algorithm:
1) Scan the list of columns looking f... | {
"content_hash": "1af54c014cbd4525b421e44f5d357763",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 78,
"avg_line_length": 37.78767123287671,
"alnum_prop": 0.6931303244516948,
"repo_name": "uwescience/raco",
"id": "525f5bdf94f88d0122d7fbc1a5bf847fbe9a7b57",
"size": "5518... |
"""Storage backend management
"""
import urlparse
from oslo.config import cfg
from stevedore import driver
from ceilometer.openstack.common.gettextutils import _ # noqa
from ceilometer.openstack.common import log
from ceilometer import service
from ceilometer import utils
LOG = log.getLogger(__name__)
STORAGE_EN... | {
"content_hash": "2a717de08b0923b72b362c6ef4ad1e43",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 76,
"avg_line_length": 32.587786259541986,
"alnum_prop": 0.6312953853361443,
"repo_name": "rackerlabs/instrumented-ceilometer",
"id": "a0c39f3c437c540ccc3f6baeaedf5d3bf6026c... |
"""
tests specific to "pip install --user"
"""
import imp
import os
import textwrap
import pytest
from os.path import curdir, isdir, isfile
from pip.compat import uses_pycache
from tests.lib.local_repos import local_checkout
from tests.lib import pyversion
def _patch_dist_in_site_packages(script):
sitecustomiz... | {
"content_hash": "ab61e573e66b1ff148ffb718a5880724",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 79,
"avg_line_length": 38.62328767123287,
"alnum_prop": 0.6079978719631141,
"repo_name": "davidovich/pip",
"id": "049c7c8ee1fca9f0ffe31aff283def7ba5bd311e",
"size": "11278... |
import os
import os.path
import unittest
import shutil
from simiki.config import get_default_config
from simiki.initiator import Initiator
class TestInitiator(unittest.TestCase):
def setUp(self):
BASE_DIR = os.path.join(os.path.dirname(__file__), '..')
self.default_config = get_default_config()
... | {
"content_hash": "d3bbadd7291037b36a0a9faad03d0d8d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 78,
"avg_line_length": 31.360655737704917,
"alnum_prop": 0.5703084161003659,
"repo_name": "tankywoo/simiki",
"id": "f028e7d0c745b6794ae7b7d81fc2728ea358a6ad",
"size": "1960... |
"""Rest alarm notifier."""
import eventlet
from oslo.config import cfg
from oslo.serialization import jsonutils
import requests
import six.moves.urllib.parse as urlparse
from ceilometer.alarm import notifier
from ceilometer.openstack.common import context
from ceilometer.openstack.common.gettextutils import _
from ce... | {
"content_hash": "cb5108bafb23bf39e73e062efdb28129",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 78,
"avg_line_length": 38.67058823529412,
"alnum_prop": 0.5935503498630971,
"repo_name": "m1093782566/openstack_org_ceilometer",
"id": "e99022638ce336b8c1eb765076c197e1f28c36... |
import sqlalchemy as sa
from sqlalchemy import orm
from neutron.db import l3_db
from neutron.db import model_base
from neutron.db import models_v2
from neutron.plugins.vmware.common import nsxv_constants
class NsxvRouterBinding(model_base.BASEV2, models_v2.HasStatusDescription):
"""Represents the mapping between... | {
"content_hash": "145309f03d8f6aa84960f309ff8341ed",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 77,
"avg_line_length": 37.57077625570776,
"alnum_prop": 0.6109625668449198,
"repo_name": "blueboxgroup/neutron",
"id": "395238db0673b23509fa8f65f5782976cac98a37",
"size": ... |
"""Test for gen_client module."""
import os
import unittest2
from apitools.gen import gen_client
from apitools.gen import test_utils
def GetDocPath(name):
return os.path.join(os.path.dirname(__file__), 'testdata', name)
@test_utils.RunOnlyOnPython27
class ClientGenCliTest(unittest2.TestCase):
def testHe... | {
"content_hash": "7e0e3378d0fbb5902118a9dd101b0f7b",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 79,
"avg_line_length": 35.71287128712871,
"alnum_prop": 0.4835042971998891,
"repo_name": "catapult-project/catapult-csm",
"id": "25e9e23506eaa6443d64348739ea84241e7b429f",
... |
import click
def create_provider_command(group):
@group.command()
@click.argument("hosts", nargs=-1)
def hosts(hosts):
return hosts
| {
"content_hash": "8f2274baf3394beb547e6c513b978255",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 38,
"avg_line_length": 19.25,
"alnum_prop": 0.6493506493506493,
"repo_name": "Trundle/harpoon",
"id": "6039be8ce9268a499ad52a696a5f5efedd51b3fa",
"size": "154",
"binary": ... |
import os
from ctypes import CDLL, c_char_p, c_int, c_void_p, c_uint, c_double, byref, Structure, get_errno,\
POINTER, c_short, c_size_t, create_string_buffer
from ctypes.util import find_library
from psistats.libsensors.lib import stdc
version_info = (0, 0, 3)
__version__ = '.'.join(map(str, version_info))
__d... | {
"content_hash": "7271073b3abd0a750e46e77adcd3f759",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 99,
"avg_line_length": 26.296774193548387,
"alnum_prop": 0.5789990186457311,
"repo_name": "psistats/linux-client",
"id": "90c27b2903fa4997be8f9483adfff7bc898816a7",
"size"... |
import sys
import os
test_root = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
slideatlas_root = os.path.abspath(os.path.join(test_root, ".."))
sys.path.append(test_root)
sys.path.append(slideatlas_root)
from selenium import webdriver
from selenium.webdriver.common.by import By
from ... | {
"content_hash": "370750eb6cc821b6c188c37f586c1fcc",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 202,
"avg_line_length": 33.074074074074076,
"alnum_prop": 0.6161254199328108,
"repo_name": "SlideAtlas/SlideAtlas-Server",
"id": "9e9fa61274cb26e6a4371228c7915c8db65de6a9",
... |
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
from urllib import quote
def user_passes_test(test_func, login_url=None):
"""
Decorator for views that checks that the user passes the given test,
redirecting to the log-in page if necessary. The test should be... | {
"content_hash": "f13819032e5adb5d633eddb719cf3de1",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 118,
"avg_line_length": 37.282051282051285,
"alnum_prop": 0.6671251719394773,
"repo_name": "jonaustin/advisoryscan",
"id": "2fb4a6f510d645dbf94b948f1c0df123c08e0f8e",
"size... |
import asyncio
import importlib
import sys
class ServerLoop:
def __init__(self, loop, inputs, filters, outputs):
self.loop = loop
self.inputs = inputs
self.filters = filters
self.outputs = outputs
self.records_available = asyncio.Event(loop=loop)
# TODO: reload sup... | {
"content_hash": "9479a1f19ae00595b136c5e65f8fad99",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 36.34,
"alnum_prop": 0.5586130985140341,
"repo_name": "lablup/logger",
"id": "a3435bf13df14221270685482896543cc0b67de3",
"size": "1842",
"binary": ... |
"""
Copies the modules into the resources folder
"""
from os.path import join, relpath
import shutil
import sys
import rjsmin
from modular_build import read_file, write_file
def main(argv):
try:
input_path_flag_index = argv.index('--input_path')
input_path = argv[input_path_flag_index + 1]
... | {
"content_hash": "0bfd537d070bac56479a48f01f89dd41",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 121,
"avg_line_length": 34.02,
"alnum_prop": 0.6072898295120517,
"repo_name": "youtube/cobalt_sandbox",
"id": "5517596786d28034b49fdc3fdd259f9abf41b71d",
"size": "1911",
... |
import tasks
wait_min = 60
import rq
if __name__ == "__main__":
tasks.q_update.enqueue(tasks.update_all,wait_min)
tasks.q_new.enqueue(tasks.get_new_url)
tasks.q_retry.enqueue(tasks.retry)
#tasks.update_worker.work()
#tasks.new_worker.work()
print "Start....."
| {
"content_hash": "5a6386d39be82a21501cf89bfc585f14",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 53,
"avg_line_length": 24,
"alnum_prop": 0.6423611111111112,
"repo_name": "seraphlnWu/in_trip",
"id": "ba6d5f015a3da8d446b9a7747bd5d2efd87763a7",
"size": "288",
"binary":... |
"""Functions for inference."""
import os
import argparse
import functools
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
from lib import pose_resnet
from utils.transforms import flip_back
from utils.utility import *
parser = argparse.ArgumentParser(description=__doc__)
add_arg = func... | {
"content_hash": "3a2e76bb80dfa432f4e353da7acc4cf0",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 100,
"avg_line_length": 36.219298245614034,
"alnum_prop": 0.5616372002906272,
"repo_name": "kuke/models",
"id": "aebbe517133fe589bac819dd337c03d264136cc2",
"size": "4797",... |
import collections
def main():
form = Form()
test_user_interaction_with(form)
class Form:
def __init__(self):
self.create_widgets()
self.create_mediator()
def create_widgets(self):
self.nameText = Text()
self.emailText = Text()
self.okButton = Button("OK")
... | {
"content_hash": "308f81676a43f91a4e4c7f93ce536ce7",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 74,
"avg_line_length": 23.7421875,
"alnum_prop": 0.5656465942744324,
"repo_name": "iceihehe/pipeg",
"id": "6629bab811ff1edbdfd6033d96f4b80241a7e740",
"size": "3648",
"bi... |
"""Illustrates the problem where a finally block raises an exception. This
can mask the original exception that caused the problem in the first place.
The user sees the ExceptionCleanUp but not the ExceptionNormal which was masked
(in Python 2.x). Python 3 reports both exceptions.
Created on Aug 19, 2011
@author: pa... | {
"content_hash": "923206d747552512efa845d8c4476faf",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 20.775,
"alnum_prop": 0.6666666666666666,
"repo_name": "manahl/PythonTrainingExercises",
"id": "b4a7885783bccbec5418dd30a93f80caf7e4d796",
"size": "8... |
"""
Django settings for emergencyTransport project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_D... | {
"content_hash": "255c36f66da1824dd012b5bd77fd7ff2",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 71,
"avg_line_length": 24.276190476190475,
"alnum_prop": 0.7175362887406826,
"repo_name": "MatthewGWilliams/Staff-Transport",
"id": "06ab4c787a3bc8c3e7f58634eb5cf6a8721273e3... |
from . import parentpath
import unittest
from cacheman.cachewrap import CacheWrap, NonPersistentCache, PersistentCache
from .common import CacheCommonAsserter
class CacheWrapTest(CacheCommonAsserter, unittest.TestCase):
def __init__(self, *args, **kwargs):
CacheCommonAsserter.__init__(self)
... | {
"content_hash": "45a6a43d77533e8765b0ff04423c8e4d",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 115,
"avg_line_length": 39.627450980392155,
"alnum_prop": 0.6120732310737259,
"repo_name": "OpenGov/py_cache_manager",
"id": "6b655fdbfefd50101aa7f113eb4779dc565c227e",
"s... |
"""Support for D-Link W215 smart switch."""
from datetime import timedelta
import logging
import urllib
from pyW215.pyW215 import SmartPlug
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import (
ATTR_TEMPERATURE,
CONF_HOST,
CONF... | {
"content_hash": "bc2b3d1bedd1006c8b815b2125f0dfc1",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 86,
"avg_line_length": 29.748502994011975,
"alnum_prop": 0.6217793880837359,
"repo_name": "postlund/home-assistant",
"id": "7fa391e8060619177b9a429f0dfff9ffbcb66921",
"siz... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alpha.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "52317a2eabbc1d93c7b08d92503fe488",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 69,
"avg_line_length": 25.11111111111111,
"alnum_prop": 0.7079646017699115,
"repo_name": "appdotnet/alpha",
"id": "814bc1d89a57d2d1ebc01659d713e0c5cd6c98b0",
"size": "248",
... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from oscar.core.compat import AUTH_USER_MODEL, AUTH_USER_MODEL_NAME
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_column(u'order_order', 'ba... | {
"content_hash": "2d0f0a59ff0db57d42c745257aa499f2",
"timestamp": "",
"source": "github",
"line_count": 480,
"max_line_length": 238,
"avg_line_length": 93.45416666666667,
"alnum_prop": 0.5573141914485711,
"repo_name": "elliotthill/django-oscar",
"id": "b90cc13da20f03f7bebfcff6769a3ff6e231c6f8",
"si... |
from sys import argv
import os
import math
import urllib2
import time
import random
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * n)
return ... | {
"content_hash": "a0392df2f16f8f14ff144ad2d9d1cee1",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 96,
"avg_line_length": 25.737704918032787,
"alnum_prop": 0.6535031847133758,
"repo_name": "ipepe/rails-real-tram-map",
"id": "3a23237cf58dce47ba093b056e72d43580fb6f58",
"si... |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
| {
"content_hash": "72927ff4bd62e2f2be4acf0202783bec",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 26,
"avg_line_length": 13.272727272727273,
"alnum_prop": 0.547945205479452,
"repo_name": "talapus/Ophidian",
"id": "d71338e01739b738a922cbf289a01c0df3c788db",
"size": "146"... |
from django.conf import settings
from horizon import forms
from horizon.utils import functions as utils
from openstack_dashboard.dashboards.settings.user import forms as user_forms
class UserSettingsView(forms.ModalFormView):
form_class = user_forms.UserSettingsForm
template_name = 'settings/user/settings.ht... | {
"content_hash": "0ab668f58f10213ffb00b2082a54cdcd",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 38.125,
"alnum_prop": 0.6437158469945355,
"repo_name": "spandanb/horizon",
"id": "bd551f74bc362c56443509f2db0d65d6cbe69554",
"size": "1520",
"binar... |
"""
This example shows how to add an interface (for example a real
hardware interface) to a network after the network is created.
"""
import re, sys
from mininet.cli import CLI
from mininet.log import setLogLevel, info, error
from mininet.net import Mininet
from mininet.link import Intf
from mininet.topolib import Tr... | {
"content_hash": "c2205740ba96978423ede842812e2e3b",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 77,
"avg_line_length": 31,
"alnum_prop": 0.6063199473337723,
"repo_name": "5GExchange/escape",
"id": "1e010fd35ff409f146546c161cb9a38bb490a190",
"size": "1538",
"binary":... |
import os
import time
import unittest
from openstack import connection
from openstack import exceptions
from openstack import service_filter
def requires_service(**kwargs):
"""Check whether a service is available for this test
When the service exists, the test will be run as normal.
When the service doe... | {
"content_hash": "ce1a4c6ff1cdcdc89faea045146b41d9",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 68,
"avg_line_length": 28.017543859649123,
"alnum_prop": 0.6224170319348779,
"repo_name": "dudymas/python-openstacksdk",
"id": "c9765307be3a3713fe9064d6e35c6a10869f84ae",
"... |
"""Magnum base exception handling.
Includes decorator for re-raising Magnum-type exceptions.
"""
import functools
import sys
import uuid
from keystoneclient import exceptions as keystone_exceptions
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
import pecan
import si... | {
"content_hash": "611da3a1cd6fd19c24e914ab1cbac9d7",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 79,
"avg_line_length": 30.13111111111111,
"alnum_prop": 0.6267423851316469,
"repo_name": "paulczar/magnum",
"id": "7585d7abfbb08f3e80b01f7367aa03f28da13137",
"size": "1413... |
from pdf2txt import pdfTotxt1, pdfTotxt2
import os
def handleStock(stock_dir, dir, root_txt_path):
for stock in stock_dir:
years_dir=os.listdir(dir+stock)
for y in years_dir:
type_dir=os.listdir(dir+stock+'/'+y)
for t in type_dir:
report_dir=os.listdir(dir+s... | {
"content_hash": "b615c282018919f539128c929bb9e416",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 82,
"avg_line_length": 35.59375,
"alnum_prop": 0.5329236172080772,
"repo_name": "FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code",
"id": "e14d3f3318c44... |
from __future__ import print_function, unicode_literals
import optparse
from proton import Message
from proton.handlers import MessagingHandler
from proton.reactor import Container
class Send(MessagingHandler):
def __init__(self, url, messages):
super(Send, self).__init__()
self.url = url
s... | {
"content_hash": "41aa0c11eb843a14ab02ee0076046599",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 84,
"avg_line_length": 33.8780487804878,
"alnum_prop": 0.6371490280777538,
"repo_name": "grs/amqp_subscriptions",
"id": "ded0af56df9574fa97c578c7e2e4436164b9c089",
"size": ... |
import binascii
import datetime
import warnings
from time import sleep
from unittest.mock import DEFAULT, Mock, call, patch
import pytest
from redis import Redis
from redis.cluster import (
PRIMARY,
REDIS_CLUSTER_HASH_SLOTS,
REPLICA,
ClusterNode,
NodesManager,
RedisCluster,
get_node_name,
... | {
"content_hash": "b099d640b6365676368e720e31347b96",
"timestamp": "",
"source": "github",
"line_count": 2795,
"max_line_length": 88,
"avg_line_length": 37.979248658318426,
"alnum_prop": 0.5424485643228578,
"repo_name": "alisaifee/redis-py",
"id": "de41a107dc80176d64837162d1bbdb5a3c0ff0a1",
"size": ... |
from django.db import models
NAME_GENDER_CHOICE = (
(0, u'male'),
(1, u'female'),
(2, u'neutral'), ... | {
"content_hash": "e4793c13e88bb9ba868fbf65f66152e1",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 91,
"avg_line_length": 34.65,
"alnum_prop": 0.5202020202020202,
"repo_name": "masiqi/ename",
"id": "14ddb9bb2ef0b9fd7ab1e8c3f11fc7987f0b704a",
"size": "1406",
"binary": f... |
"""
Functions that help with dynamically creating decorators.
:copyright: 2008 by Takanori Ishikawa
:license: MIT, see LICENSE for more details.
"""
from types import NoneType
from modipyd.utils.core import sequence
def require(**types):
"""
Lets you annotate function with argument type requirements... | {
"content_hash": "c98c234fb27b008b461224639b5dcc0a",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 80,
"avg_line_length": 34.88405797101449,
"alnum_prop": 0.5118404653095139,
"repo_name": "ishikawa/modipyd",
"id": "10f6e4cb927ac5215574556aa913e91eaa307472",
"size": "2407... |
"""Prepares a local hermetic Go installation.
- Downloads and unpacks the Go toolset in ../golang.
"""
import contextlib
import logging
import os
import platform
import shutil
import stat
import subprocess
import sys
import tarfile
import tempfile
import urllib
import zipfile
# TODO(vadimsh): Migrate to new golang.o... | {
"content_hash": "4f3607adb7b1aa6641393618d8b2a9a8",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 77,
"avg_line_length": 27.615384615384617,
"alnum_prop": 0.6686502912129653,
"repo_name": "MichaLasry/ImageTalke",
"id": "5661be2d3660931a641a33afc651f93e85e9d7b3",
"size"... |
"""
H5T tests. This handles the general API behavior and exceptions; full
type-specific tests (including conversion) are tested elsewhere.
"""
from h5py import tests
from h5py import *
import numpy as np
class Base(tests.HTest):
pass
class TestCreate(Base):
def test_create(self):
""" (H5T)... | {
"content_hash": "b052ffd0e691217dcdadf37461160a47",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 74,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.5937072503419972,
"repo_name": "qsnake/h5py",
"id": "a012407cf0dd8e555f060e190122f57fc5cd5340",
"size": "3656",
... |
"""
Our own implementation of the Newton algorithm
Unlike the scipy.optimize version, this version of the Newton conjugate
gradient solver uses only one function call to retrieve the
func value, the gradient value and a callable for the Hessian matvec
product. If the function call is very expensive (e.g. for logistic
... | {
"content_hash": "26499988b3e05200f67c3d780b03abcd",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 78,
"avg_line_length": 27.886699507389164,
"alnum_prop": 0.5797562268150503,
"repo_name": "DailyActie/Surrogate-Model",
"id": "0ecb5e0e18db73965d70e8dc6b0f3fd5ddaa4472",
"... |
import logging
import sys
from lib.wikipediaresolver import WikipediaResolver
from lib.prettyfier import Prettyfier
__author__ = 'jnowak'
logging.basicConfig(format='%(message)s', level=logging.DEBUG)
try:
finish_at = sys.argv[2].decode('utf-8')
except IndexError:
finish_at = 'Straż Pożarna'
try:
star... | {
"content_hash": "3d30678a7bd795ca695f926112514880",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 79,
"avg_line_length": 21.40740740740741,
"alnum_prop": 0.7249134948096886,
"repo_name": "diego351/wikiparser",
"id": "b7382b816e06962703bd1577cc65a21ae3f68955",
"size": "6... |
import argparse
import sys
from collections import defaultdict
import re
line_re_24 = re.compile(r"""
^(?P<timestamp>[\d\.]+)\s(\(db\s(?P<db>\d+)\)\s)?"(?P<command>\w+)"(\s"(?P<key>[^(?<!\\)"]+)(?<!\\)")?(\s(?P<args>.+))?$
""", re.VERBOSE)
line_re_26 = re.compile(r"""
^(?P<timestamp>[\d\.]+)\s\[(?P<db>\d+... | {
"content_hash": "caefdd5bca74e3b38a19e904156f4ff6",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 140,
"avg_line_length": 36.76966292134831,
"alnum_prop": 0.545912910618793,
"repo_name": "facebookarchive/redis-faina",
"id": "73de63d9115721633d19b1052cc3c81442f2c22e",
"... |
import collections, subprocess, shlex, shm, gevent, imp
procstat = collections.namedtuple('procstat', ['code', 'stdout', 'stderr'])
def proc_running(process):
return shell('pgrep -f {}'.format(process)).code == 0
def shell(command):
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr... | {
"content_hash": "2596d698783705117e61375622379da8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 96,
"avg_line_length": 23.53125,
"alnum_prop": 0.6308100929614874,
"repo_name": "cuauv/software",
"id": "92b4f02aaa03123fd107fef20b609cf825ce5287",
"size": "753",
"binary... |
'''This module contains a script for generating Pathfinder character
sheets in LaTeX'''
import argparse
import fileinput
import os
import shutil
from string import Template
from core.pf_character import PFCharacter
__all__ = []
# --- Constants ---
TEMPLATE_FILES = [
'/main.tex',
'/character.tex',
'... | {
"content_hash": "902b4c89a9bfa28dbf6660331ea19d4c",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 78,
"avg_line_length": 32.371428571428574,
"alnum_prop": 0.6654898499558694,
"repo_name": "lot9s/pathfinder-rpg-utils",
"id": "98a15d46f582f8baa56b2f4b9b9a5c4791aaf039",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
# This flag is used to mark that a migration shouldn't be automatically run in
# production. We set this to True for operations that we think are risky and want
# someone from ops to ru... | {
"content_hash": "fa694b327e9e1a612d8821cdd16c7f9f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 88,
"avg_line_length": 41.114285714285714,
"alnum_prop": 0.6942321056289089,
"repo_name": "beeftornado/sentry",
"id": "efdf871209ebf7ce25c5ef97d0e5b409f756b007",
"size": "1... |
import pytest
@pytest.fixture
def resources(plan_runner):
_, resources = plan_runner()
return resources
def test_resource_count(resources):
"Test number of resources created."
assert len(resources) == 2
def test_iam(resources):
"Test IAM binding resources."
bindings = [r['values'] for r in resources i... | {
"content_hash": "43901c8216dd5386a29c30d9a38efef4",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 57,
"avg_line_length": 23.4,
"alnum_prop": 0.6816239316239316,
"repo_name": "GoogleCloudPlatform/cloud-foundation-fabric",
"id": "abaf45781f1ea55d77e601df8e2e8633528720a4",
... |
"""Implementation of JSONEncoder
"""
import re
try:
from _json import encode_basestring_ascii as c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from _json import encode_basestring as c_encode_basestring
except ImportError:
c_encode_basestring = None
try:... | {
"content_hash": "a8a648c4796897808916061e8a85e69d",
"timestamp": "",
"source": "github",
"line_count": 440,
"max_line_length": 78,
"avg_line_length": 37.31363636363636,
"alnum_prop": 0.5159580947740285,
"repo_name": "Suwmlee/XX-Net",
"id": "a071cc677a6f2f59e4919cc1cec472a6e8f2c86a",
"size": "16418... |
"""
WSGI config for buildservice project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
import dotenv
dotenv.read_dote... | {
"content_hash": "1da586e123c9ac55e922d102a2902c80",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 84,
"avg_line_length": 29.555555555555557,
"alnum_prop": 0.7631578947368421,
"repo_name": "m-vdb/github-buildservice-boilerplate",
"id": "1abe720589cc58deef36286bdc6162680566... |
"""A module for architecture output directory fixups."""
from __future__ import print_function
import cr
class _ArchInitHookHelper(cr.InitHook):
"""Base class helper for CR_ARCH value fixups."""
def _VersionTest(self, old_version):
_ = old_version
return True
def _ArchConvert(self, old_arch):
re... | {
"content_hash": "5e0e679874c8717462454baa0a069d42",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 80,
"avg_line_length": 28.568627450980394,
"alnum_prop": 0.7021276595744681,
"repo_name": "chromium/chromium",
"id": "837a1f9dc6c79b22784b24bb5fb94661e8bb7b6f",
"size": "15... |
"""
Model for Projects
Copyright (C) 2020 Anders Lowinger, anders@abundo.se
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | {
"content_hash": "aaaefa49914bc35cf674ae7421aa26ca",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 70,
"avg_line_length": 28.84375,
"alnum_prop": 0.7193932827735645,
"repo_name": "lowinger42/ergotime",
"id": "c79dd350fbe963ce6762552fe1d3e0d4e06ad8ed",
"size": "946",
"b... |
import os
import psycopg2
import sqlalchemy
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from os.path import join, dirname
database_url = os.environ.get("DATABASE_URL")
engine = create_engine(database_url)
Base = declarative_base(engine)
meta=MetaData(bind=engine)
# All my db tabl... | {
"content_hash": "686d21f61401163f50f1b1ee820745b8",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 120,
"avg_line_length": 32.42458100558659,
"alnum_prop": 0.6171605789110958,
"repo_name": "Boijangle/GroupMe-Message-Bot",
"id": "ec990661a8dfd9d2442b3cdb854e2c4cbc3b1524",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.