text stringlengths 4 1.02M | meta dict |
|---|---|
import itertools
import os
import posixpath
import sys
import unittest
import warnings
from posixpath import realpath, abspath, dirname, basename
from test import support, test_genericpath
try:
import posix
except ImportError:
posix = None
# An absolute path to a temporary filename for testing. We can't rely ... | {
"content_hash": "0d4686820c19100cd5e4af702b79a5f7",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 100,
"avg_line_length": 44.1219512195122,
"alnum_prop": 0.5543649274992558,
"repo_name": "IronLanguages/ironpython3",
"id": "1d4596e7b17499e6826c2dc55c19c2b2eaf25815",
"si... |
from django import forms
from django.db import models
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
# portlets imports
from portlets.models import Portlet
class TextPortlet(Portlet):
"""
A simple portlet to display some text.
"""
text = mo... | {
"content_hash": "4a5f5a53cb2958af153304a5f83314ee",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 63,
"avg_line_length": 23.236842105263158,
"alnum_prop": 0.6149490373725934,
"repo_name": "diefenbach/django-portlets",
"id": "5220ca2273a208c34ef0cbb198372fa448ca3e46",
"s... |
import intersect
import numpy
import random
from copy import copy
import common
class PolygonGenerator:
def __init__(self, numpoints, points, sidesmatrix, segmentsmatrix, connectiondict):
self.numpoints = numpoints
self.points = points
self.sidesmatrix = sidesmatrix
self.segmentsma... | {
"content_hash": "207a0a69efb8c6141aa70f1a86b4f8b7",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 122,
"avg_line_length": 39.91304347826087,
"alnum_prop": 0.6028050108932462,
"repo_name": "PIWEEK/polygon",
"id": "89b31f9f4ff0f1051bd0c0ee4e12a86dd23850f6",
"size": "7344... |
import time, random
import stockfighter_minimal as sf
sf.set_web_url("http://127.0.0.1:8000/ob/api/")
sf.change_api_key("exb123456")
ACCOUNT = "EXB123456"
VENUE = "TESTEX"
SYMBOL = "FOOBAR"
SEED = 155176
TEST_TIME = 30
random.seed(SEED)
INFO = sf.Order()
INFO.account = ACCOUNT
INFO.venue = VENUE
INFO.symbol =... | {
"content_hash": "b64898c6b4439a903127f6718afca540",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 118,
"avg_line_length": 17.491525423728813,
"alnum_prop": 0.6695736434108527,
"repo_name": "fohristiwhirl/disorderBook",
"id": "59db4ec6f6488fe03878b38b077471ccb490eec2",
"... |
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
class Petition(models.Model):
title = m... | {
"content_hash": "799227a73d6fb7db6bbef587b77a3df1",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 129,
"avg_line_length": 44.69565217391305,
"alnum_prop": 0.6939040207522698,
"repo_name": "rmanocha/django-petitions",
"id": "8045d645644b2e8ae6ca5692cdc064e66afe48b6",
"si... |
"""Expansion module
The module implements the taylor-based variance estimation methods. There are several good books
that provide the the taylor-based approximations of the sample variance. Some of these reference
books are Cochran, W.G. (1977) [#c1977]_, Kish, L. (1965) [#k1965]_, Lohr, S.L. (2010) [#l2010]_,
and ... | {
"content_hash": "1c9ca5f75771d2a71287b3f4d7e03163",
"timestamp": "",
"source": "github",
"line_count": 746,
"max_line_length": 99,
"avg_line_length": 41.72386058981233,
"alnum_prop": 0.5087386750626486,
"repo_name": "survey-methods/samplics",
"id": "1a61fcfb8175be28ee9e3a8d02bdeb7050785714",
"size... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('bibtex', '0003_auto_20141013_2253'),
]
operations = [
migrations.AddField(
model_name='entry',
name='docfile',
f... | {
"content_hash": "e53e0d8d2f50f99ed192777ddff4d9d9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 63,
"avg_line_length": 22.31578947368421,
"alnum_prop": 0.5849056603773585,
"repo_name": "iangray001/bibtex",
"id": "cf519e14f0e125bc73baa9e5a9cab73dbeb99b6d",
"size": "448... |
import html
import numbers
from singledispatch import singledispatch
from collections import abc
# Can't be used in python2.7
@singledispatch
def htmlsize(obj):
content = html.escape(repr(obj))
return '<pre>{}</pre>'.format(content)
@htmlsize.register(str)
def _(text):
content = html.escape(text).replace... | {
"content_hash": "59c5f1f87fe90df838dfe3c9d124e110",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 62,
"avg_line_length": 25.5,
"alnum_prop": 0.665158371040724,
"repo_name": "helloTC/LearnPython",
"id": "f8b777b9c18d8c52456a4fe4ea943dcde3bf1c59",
"size": "754",
"binary... |
from colour import Color as ColorBase
import re
class Color:
colour = None
def __init__(self, *args, **kwargs):
self.colour = ColorBase(*args, **kwargs)
def __getattr__(self, attr):
return self.colour.__getattr__(attr)
@property
def hex(self):
color = re.sub('^#', '', se... | {
"content_hash": "b08f7b43f4f435dd49a0eb7e683e4f0d",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 66,
"avg_line_length": 22.375,
"alnum_prop": 0.5493482309124768,
"repo_name": "elliottcarlson/pptx-canvas",
"id": "4ea2ca855cdc7666b866313dafc6ef5509c9b6e6",
"size": "537",... |
"""Support for bandwidth sensors with UniFi clients."""
import logging
from homeassistant.components.unifi.config_flow import get_controller_from_config_entry
from homeassistant.core import callback
from homeassistant.helpers import entity_registry
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_M... | {
"content_hash": "65fda4e4e85bc3c38d24d8bf7547290b",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 137,
"avg_line_length": 32.44767441860465,
"alnum_prop": 0.6498835334169504,
"repo_name": "joopert/home-assistant",
"id": "e4f9b0df6c9dab71635bc2362e9a246a923f4ff9",
"size... |
import mock
import pushmanager.testing as T
from pushmanager.core.settings import Settings
from pushmanager.core.requesthandler import RequestHandler
from pushmanager.testing.mocksettings import MockedSettings
class RequestHandlerTest(T.TestCase):
def test_get_api_page(self):
MockedSettings['api_app'] = ... | {
"content_hash": "5d191ba8b52bcca0b22db996b826c34c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 81,
"avg_line_length": 35.875,
"alnum_prop": 0.6898954703832753,
"repo_name": "hashbrowncipher/pushmanager",
"id": "19d9950e99c27875a371e9605530525ba147d86a",
"size": "597"... |
"""
.. module:: algorithm
:synopsis: Factorization recsys algorithms
.. moduleauthor:: Oscar Celma <ocelma@bmat.com>
"""
import os
import sys
import zipfile
try:
import divisi2
except:
from csc import divisi2
from numpy import loads, mean, sum, nan
from operator import itemgetter
from scipy.cluster.vq imp... | {
"content_hash": "773ce88bc1a22c96707fdcd835b13bd8",
"timestamp": "",
"source": "github",
"line_count": 686,
"max_line_length": 183,
"avg_line_length": 39.129737609329446,
"alnum_prop": 0.5617851953954476,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "00a9e61c67ef033e3e20938a79ca5eb3e81b25a8",
"siz... |
import numpy as np
import voxie
import tomopy_misc_phantom
args = voxie.parser.parse_args()
context = voxie.VoxieContext(args)
instance = context.createInstance()
if args.voxie_action != 'RunFilter':
raise Exception('Invalid operation: ' + args.voxie_action)
with context.makeObject(context.bus, context.busName,... | {
"content_hash": "6049f459b46915ae2f6d7f6cc5ce7cb1",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 162,
"avg_line_length": 37.310344827586206,
"alnum_prop": 0.6321626617375231,
"repo_name": "voxie-viewer/voxie",
"id": "27efe3088b8c3bbb8e27467a86ffab6d78fda131",
"size": "... |
import socket
# create a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# get local machine name
host = "192.168.0.5"
#ste the port
port = 9999
# connection to hostname on the port.
s.connect((host, port))
# Receive no more than 1024 bytes
tm = s.recv(1024)
cat = input("type a message > ")
# ... | {
"content_hash": "a3a5b5a275ac36518ba5667a8b3d7ba5",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 64,
"avg_line_length": 18.333333333333332,
"alnum_prop": 0.6931818181818182,
"repo_name": "afshaan4/random-python-programs",
"id": "4c9de96c3af839d12b5d1b21ef3a1f124ac6aa3e",... |
import threading
import asyncio
import itertools
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, Optional, Set, Tuple
from . import bitcoin
from .bitcoin import COINBASE_MATURITY, TYPE_ADDRESS, TYPE_PUBKEY
from .util import profiler, bfh, TxMinedInfo
from .transaction import Transaction, Tx... | {
"content_hash": "dd187d5cf684e990c8be63ebd239b72e",
"timestamp": "",
"source": "github",
"line_count": 776,
"max_line_length": 119,
"avg_line_length": 42.108247422680414,
"alnum_prop": 0.5530970743053005,
"repo_name": "fujicoin/electrum-fjc",
"id": "843f3679fcf63625c6cac891793c2b039eae6614",
"size... |
'''
Implements the base CFSNode class and a few inherited variants.
This file is part of RTSLib.
Copyright (c) 2011-2013 by Datera, Inc
Copyright (c) 2011-2014 by Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obta... | {
"content_hash": "730a2a5df9a2cda577878cabebf336a0",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 88,
"avg_line_length": 37.03846153846154,
"alnum_prop": 0.5766355140186916,
"repo_name": "cvubrugier/rtslib-fb",
"id": "415f45d675f9fcb428f4861740f267c7be4179e3",
"size": ... |
import collections
import datetime
import xlwt
from django import forms
from django.http import Http404, HttpResponse
from django.conf import settings
from django.shortcuts import render, redirect
from django.contrib.auth import login
from django.urls import reverse
from django.template.loader import render_to_string
... | {
"content_hash": "ea575535c38cdbe97a503e54a89f2471",
"timestamp": "",
"source": "github",
"line_count": 1027,
"max_line_length": 100,
"avg_line_length": 32.89581304771178,
"alnum_prop": 0.5557956429078854,
"repo_name": "ocwc/ocwc-members",
"id": "f4043cc20211b10bb29dd95361d93c0af8352d32",
"size": "... |
"""
https://leetcode.com/problems/restore-the-array/
"""
# inspired by:
# https://leetcode.com/problems/restore-the-array/discuss/585554/C%2B%2BPython-Simple-DP-with-python
class Solution:
def number_of_arrays(self, s: str, k: int) -> int:
# this is going to be hard
# we could use dynamic programmi... | {
"content_hash": "91c1493d6bc759a74a891f7c399b743a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 100,
"avg_line_length": 34.888888888888886,
"alnum_prop": 0.5254777070063694,
"repo_name": "kalyons11/kevin",
"id": "68d128665029bd84007dbe09a361908f3727b20a",
"size": "942... |
import unittest
import unittest.mock
from datetime import datetime, timedelta
from subprocess import PIPE, STDOUT
from tempfile import NamedTemporaryFile
import mock
from airflow import DAG, AirflowException
from airflow.operators.bash_operator import BashOperator
from airflow.utils import timezone
from airflow.utils... | {
"content_hash": "02285a88d8c7ffc3bfccd38c5302946a",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 89,
"avg_line_length": 34.8705035971223,
"alnum_prop": 0.5562203424798845,
"repo_name": "Fokko/incubator-airflow",
"id": "9b78b54e8b9537fd5fe4d1a2bac8ebdfc5a2d1e3",
"size"... |
import time
from gocd.api.response import Response
from gocd.api.endpoint import Endpoint
from gocd.api.artifact import Artifact
from gocd.api.stage import Stage
__all__ = ['Pipeline']
class Pipeline(Endpoint):
base_path = 'go/api/pipelines/{id}'
id = 'name'
#: The result of a job/stage has been finalise... | {
"content_hash": "2063859156b704e3909efa101ec7499c",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 95,
"avg_line_length": 33.899628252788105,
"alnum_prop": 0.5654128742186644,
"repo_name": "henriquegemignani/py-gocd",
"id": "d1cb666befd558b216755d825b0eb70619eb5454",
"s... |
from .ast_node import AstNode
from .errors import AstBuilderException
class AstBuilder(object):
def __init__(self):
self.reset()
def reset(self):
self.stack = [AstNode('None')]
self.comments = []
def start_rule(self, rule_type):
self.stack.append(AstNode(rule_type))
... | {
"content_hash": "79ada02e6991da6ec0bd5a986a1da517",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 97,
"avg_line_length": 39.65416666666667,
"alnum_prop": 0.5291583482189766,
"repo_name": "Zearin/gherkin3",
"id": "c9a71da2e279e5c17d5a9e2f8baf6a47dd0996ad",
"size": "9517... |
import unittest
class TestExceptions(unittest.TestCase):
def test_placeholder(self):
pass
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "c6359e86548674b5e98405074eed5827",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 14,
"alnum_prop": 0.6298701298701299,
"repo_name": "zaitcev/swift-lfs",
"id": "092ba5b172454616e54834e0d81751e1db965a9e",
"size": "759",
"binary": ... |
from django.contrib import admin
from mobile_framework import get_app_user_model
from mobile_framework.device.models import Device
from mobile_framework.version.models import AppVersion
AppUser = get_app_user_model()
class DeviceAdmin(admin.ModelAdmin):
fields = ('uuid', 'app_version', 'device_friendly', 'os', ... | {
"content_hash": "50a574d5337cfdec3563b8aa92228f53",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 142,
"avg_line_length": 45,
"alnum_prop": 0.6476190476190476,
"repo_name": "mstarinteractive/django-mobile-framework",
"id": "e486f68469ced55a05749f69a9f32639f3e55fe8",
"si... |
"""
sentry.search.django.backend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import functools
from datetime import timedelta
from django.db import router
from django.d... | {
"content_hash": "a5425a0dec91b29b6d753a8da46f6651",
"timestamp": "",
"source": "github",
"line_count": 548,
"max_line_length": 104,
"avg_line_length": 40.57664233576642,
"alnum_prop": 0.5406098219104155,
"repo_name": "ifduyue/sentry",
"id": "69fc09fd52fff2a18c5117537fcce8997ea7a5b8",
"size": "2223... |
from pystachio import Choice
from apache.thermos.config.schema import *
# TODO(wickman) Bind {{mesos.instance}} to %shard_id%
class MesosContext(Struct):
# The instance id (i.e. replica id, shard id) in the context of a task
instance = Required(Integer)
hostname = Required(String)
class UpdateConfig(St... | {
"content_hash": "18fd91fe291b82fd95d9f536cfbfaae3",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 97,
"avg_line_length": 31.00574712643678,
"alnum_prop": 0.6734012974976831,
"repo_name": "crashlytics/aurora",
"id": "18ce826363009e1cc0beac5cce4edf42610d487e",
"size": "6... |
"""
jinja2.visitor
~~~~~~~~~~~~~~
This module implements a visitor for the nodes.
:copyright: (c) 2009 by the Jinja Team.
:license: BSD.
"""
from jinja2.nodes import Node
class NodeVisitor(object):
"""Walks the abstract syntax tree and call visitor functions for every
node found. The vi... | {
"content_hash": "7f53591c6ce0cf384c767e1f410117e6",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 76,
"avg_line_length": 38.27906976744186,
"alnum_prop": 0.5859659781287971,
"repo_name": "yesudeep/cmc",
"id": "c27c24cef7537df3bf8e8e870a109952d8b33bdb",
"size": "3316",
... |
import sys
import os
import click
import importlib
class CommandsCollector(click.MultiCommand):
"""A MultiCommand to collect all click commands from a given
modules path and base name for the module.
The commands functions needs to be in a module inside commands
folder and the name of the file will be... | {
"content_hash": "bc0258c684fba0071a8799048c43b659",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 74,
"avg_line_length": 36.265306122448976,
"alnum_prop": 0.5520540236353405,
"repo_name": "alexandre/quokka",
"id": "ff323fb027eeb3cbef577db75dc3b6e187ae156f",
"size": "177... |
import json
import logging
from beaker.container import NamespaceManager, Container
from beaker.synchronization import file_synchronizer
from beaker.util import verify_directory
from beaker.exceptions import MissingCacheParameter, InvalidCacheBackendError
try:
import cPickle as pickle
except:
import pickle
t... | {
"content_hash": "30a021a52761bc7c1d944f5a01c05c0f",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 90,
"avg_line_length": 33.298507462686565,
"alnum_prop": 0.5748543254146122,
"repo_name": "aspyatkin/beakeredis",
"id": "13158e802820c6f74131bd46830a8f86c04eb871",
"size":... |
""" Example of actions in Chapter 3, page 34
rdd referes to a RDD. In this example we do not have an RDD
"""
from pyspark import SparkConf, SparkContext
# for standalone apps, you need to create a sparkcontext (sc) first
conf = SparkConf().setMaster("local").setAppName("transformations")
sc = SparkContext(appName="... | {
"content_hash": "d861b2329bc5e16b04fe57130ea30b46",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 67,
"avg_line_length": 29.928571428571427,
"alnum_prop": 0.7171837708830548,
"repo_name": "chendaniely/learning-spark",
"id": "c0c18894dd618b380eed667563cf8caedd1e48fc",
"s... |
"""MySensors notification service."""
from homeassistant.components import mysensors
from homeassistant.components.notify import ATTR_TARGET, DOMAIN, BaseNotificationService
async def async_get_service(hass, config, discovery_info=None):
"""Get the MySensors notification service."""
if not discovery_info:
... | {
"content_hash": "4c379ffd7b4f3acc52dc175865866ce2",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 88,
"avg_line_length": 33.78846153846154,
"alnum_prop": 0.651678998292544,
"repo_name": "partofthething/home-assistant",
"id": "50fca55ab39703d41b21ef8d1249e9985ec870a8",
"... |
"""Container for Google Cloud Bigtable Cells and Streaming Row Contents."""
import copy
import six
from gcloud_bigtable._helpers import _microseconds_to_timestamp
from gcloud_bigtable._helpers import _to_bytes
class Cell(object):
"""Representation of a Google Cloud Bigtable Cell.
:type value: bytes
:p... | {
"content_hash": "d23b16b033d3db2d6c9aee8bd4103c68",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 79,
"avg_line_length": 35.91029900332226,
"alnum_prop": 0.5898788046997873,
"repo_name": "joerideturck/gcloud-python-bigtable",
"id": "376edee2f40de5680d9ded125c974ed64f0660... |
from nipype.testing import assert_equal
from nipype.interfaces.freesurfer.preprocess import FitMSParams
def test_FitMSParams_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
flip_list=dict(),
ignore_exception=dict(nohash=True,
usedefault... | {
"content_hash": "baf67dc8a53af8d020a279f6c28eef8c",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.6283261802575107,
"repo_name": "wanderine/nipype",
"id": "78a14edd13a6242887e188244ea67c02de61a208",
"size": "1219... |
from absl.testing import absltest
from absl.testing import parameterized
# Register the classes so that pybind11 knows how to convert them from Python
# to C++.
# pylint: disable=unused-import
from clif.testing.python import lambda_expressions
# pylint: enable=unused-import
from clif.testing.python import type_caster
... | {
"content_hash": "02a309776ecd81dde4e469e536a973a5",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 77,
"avg_line_length": 38.666666666666664,
"alnum_prop": 0.7155172413793104,
"repo_name": "google/clif",
"id": "4aea7ec1f70771f1f50dfdb8af462f0af9838c8d",
"size": "3708",
... |
import os.path as op
from copy import deepcopy
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
import pytest
from mne import (read_source_spaces, pick_types, read_trans, read_cov,
make_sphere_model, create_info, setup_volume_source_space,
find_events,... | {
"content_hash": "86e0c941e1748ed0e3ccbd87bcb07807",
"timestamp": "",
"source": "github",
"line_count": 541,
"max_line_length": 79,
"avg_line_length": 43.072088724584106,
"alnum_prop": 0.6110205132606643,
"repo_name": "bloyl/mne-python",
"id": "8c42ee3ee362cf671da691edaf9af0d59d7ec8d6",
"size": "23... |
from logging import getLogger
logger = getLogger('yerba.services')
class Service(object):
def initialize(self):
'''Initializes the service'''
def update(self):
'''Update callback performed by the service.'''
def stop(self):
'''Stops the service'''
class InitializeServiceExceptio... | {
"content_hash": "5b2d1b0d89742f53f3d7d0a2f4bb79df",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 24.41176470588235,
"alnum_prop": 0.6746987951807228,
"repo_name": "LyonsLab/Yerba",
"id": "c5719fbb3582fef785462b0dba3e68b1e9f936d7",
"size": "439",
... |
import warnings
from functools import wraps
from twisted.internet import defer, threads
from scrapy.exceptions import ScrapyDeprecationWarning
def deprecated(use_instead=None):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the fu... | {
"content_hash": "4a078ef20b434191be92d4a74f51d954",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 83,
"avg_line_length": 28.31111111111111,
"alnum_prop": 0.641287284144427,
"repo_name": "eLRuLL/scrapy",
"id": "2e2c7adc1144941e5bede86449e056cd9b4aca05",
"size": "1274",
... |
"""
Import a Sourceforge project's tracker items into a Trac database.
Requires:
Trac 1.0 from http://trac.edgewall.org/
Python 2.5 from http://www.python.org/
1.0 clean-up by cboos **untested**, use at your own risks and send patches
The Sourceforge tracker items can be exported from the 'Backup' page
of the ... | {
"content_hash": "65fb25066d23861feff99c7511e1ba2c",
"timestamp": "",
"source": "github",
"line_count": 697,
"max_line_length": 240,
"avg_line_length": 35.08895265423242,
"alnum_prop": 0.5244715214458029,
"repo_name": "exocad/exotrac",
"id": "ec0f18406a66af09d53ba99a6dcd9af3c39d3b9a",
"size": "2511... |
from slackbot.bot import listen_to
from slackbot.bot import respond_to
from urllib.request import urlopen
import json
from socket import gethostname
import socket
import fcntl
import struct
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcn... | {
"content_hash": "93de3a27ed4529d4e43991d4c9bf17fe",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 82,
"avg_line_length": 30.40740740740741,
"alnum_prop": 0.6504263093788063,
"repo_name": "kodamap/slackbot",
"id": "28782f5aa77e159da0496a6770463b48b09eaecc",
"size": "846"... |
import os
import shutil
import argparse
import tempfile
import zipfile
def main():
cli_parser = argparse.ArgumentParser(
description='Arrange audio files from http://www.50languages.com/ '\
'in one convenient collection for better language acquisition.'
)
cli_parser.add_argument('sourc... | {
"content_hash": "ba00be3ccfe7b944da2c5d22ff378180",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 92,
"avg_line_length": 34.18181818181818,
"alnum_prop": 0.5884308510638298,
"repo_name": "avanov/book2arrange",
"id": "b0937faf13202ce74937c6e41a8b8cd4140499f7",
"size": "1... |
"""Import core names of TensorFlow.
Programs that want to build TensorFlow Ops and Graphs without having to import
the constructors and utilities individually can import this file:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
""... | {
"content_hash": "fb48657cb9462635569045305d511a56",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 78,
"avg_line_length": 30.705314009661837,
"alnum_prop": 0.7146003775959723,
"repo_name": "wchan/tensorflow",
"id": "50be1c0d4792aa45e6d2181d843fdeb5ff3386b1",
"size": "70... |
import serial, time
#===========================================================#
# RASPBERRY PI (tested with Raspbian Jan 2012):
# - Ensure that ttyAMA0 is not used for serial console access:
# edit /boot/cmdline.txt (remove all name-value pairs containing
# ttyAMA0) and comment out last line in /etc/inittab.
# - Fi... | {
"content_hash": "d588f81835bc3c073142af50380480db",
"timestamp": "",
"source": "github",
"line_count": 408,
"max_line_length": 124,
"avg_line_length": 37.583333333333336,
"alnum_prop": 0.5666492761184296,
"repo_name": "weejie/bitcoin-pos",
"id": "c20842efd697d631ca12239a97a384a2d1537e86",
"size": ... |
from PIL import Image, ImageTk
from numbers import Number
try:
import Tkinter as tk
import tkMessageBox as tkmb
except ImportError:
import tkinter as tk
import tkinter.messagebox as tkmb
import multiprocessing
import subprocess
import pyperclip
import tempfile
import platform
import numpy
import time
im... | {
"content_hash": "e860b662b1c64312b6ff45565e014e37",
"timestamp": "",
"source": "github",
"line_count": 2170,
"max_line_length": 168,
"avg_line_length": 42.06221198156682,
"alnum_prop": 0.5898000547795125,
"repo_name": "glitchassassin/lackey",
"id": "806d050b51ff238124a7170ec2a22ebdecb755ed",
"size... |
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource ... | {
"content_hash": "cff5f14e641673adf5b1e04b47289b98",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 119,
"avg_line_length": 36.73522458628842,
"alnum_prop": 0.6282257545530601,
"repo_name": "tysonholub/twilio-python",
"id": "e2c806f9f69e08efcc2432160905109d6e60e5c3",
"si... |
import json
import logging
import textwrap
import time
import typing as t
import jwt
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicKey
from globus_sdk import exc
from globus_sdk.response import GlobusHTTPResponse
logger = logging.getLogger(__name__)
if t.TYPE_CHECKING:
from ..client import ... | {
"content_hash": "671891c470d6174cc83449e2f0977dac",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 86,
"avg_line_length": 35.47232472324723,
"alnum_prop": 0.5820243420368252,
"repo_name": "globus/globus-sdk-python",
"id": "f56aaa276f4c258fde729762e372226ff3bd6632",
"siz... |
from random import random
from math import floor
from st2actions.runners.pythonrunner import Action
__all__ = [
'SubSolver'
]
ALPHABET = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
def _gen_cipher_mapping():
cipher = []
alphabet = list(ALPHABET)
for letter in ALPHABET:
random_letter = int(floor(ran... | {
"content_hash": "5f42aaee202fb1aabbbdf23e8b5df3f1",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 62,
"avg_line_length": 21.16822429906542,
"alnum_prop": 0.58719646799117,
"repo_name": "StackStorm/st2contrib",
"id": "aaba7d9f38a17f9163f2bdfe6d7aaefc729e80e9",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Operation',
fields=[
('id', models.AutoField(verbose_name='ID', seriali... | {
"content_hash": "e09cf03f2a26b5918d591a39b0c2a507",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 114,
"avg_line_length": 27,
"alnum_prop": 0.5555555555555556,
"repo_name": "Knowty/marksafe",
"id": "4971b47bf12c4a577ea1e259b8be8e215a29327d",
"size": "591",
"binary": f... |
import os
import unittest.mock
from pants.base.specs import SiblingAddresses, SingleAddress
from pants.build_graph.address import Address, BuildFileAddress
from pants.build_graph.address_mapper import AddressMapper
from pants.engine.internals.nodes import Throw
from pants.engine.legacy.address_mapper import LegacyAddr... | {
"content_hash": "a65e49a386827b057ac1870beddac10e",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 100,
"avg_line_length": 39.225641025641025,
"alnum_prop": 0.5859589488822068,
"repo_name": "tdyas/pants",
"id": "d82c3e5f3509af2a53bb3026ac828979458c540c",
"size": "7781",... |
from Deque import Deque
def palchecker(aString):
chardeque = Deque()
for ch in aString:
##chardeque.addRear(ch)
chardeque.addFront(ch)
while chardeque.size() > 1:
first = chardeque.removeFront()
last = chardeque.removeRear()
if first != last:
return Fals... | {
"content_hash": "8948ed33111b66b5ca7429843b8e85b2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 25.473684210526315,
"alnum_prop": 0.5847107438016529,
"repo_name": "NiuXWolf/Introduction-to-Algorithms",
"id": "0ef99d0ce971d5a052e9513d34885224f2bd23... |
"""
Simple document tree Writer, writes Docutils XML according to
http://docutils.sourceforge.net/docs/ref/docutils.dtd.
"""
__docformat__ = 'reStructuredText'
import sys
import xml.sax.saxutils
from StringIO import StringIO
import docutils
from docutils import frontend, writers, nodes
class RawXmlError(docutils.A... | {
"content_hash": "0d0f66b28590d269dc907b5322ea4a74",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 79,
"avg_line_length": 34.729885057471265,
"alnum_prop": 0.6021843455237464,
"repo_name": "neumerance/cloudloon2",
"id": "697066e7ef08009fa3bc661ef735b2171c20466b",
"size"... |
from twisted.web.client import Agent
from twisted.internet import defer
from twisted.web.http_headers import Headers
from twisted.internet.protocol import Protocol
from twisted.web._newclient import ResponseFailed, ResponseDone
from twisted.python.failure import Failure
import urllib, json, base64, copy
from wallaby.b... | {
"content_hash": "d9cf346cfa01abb0f4804847e31a69e0",
"timestamp": "",
"source": "github",
"line_count": 583,
"max_line_length": 174,
"avg_line_length": 33.289879931389365,
"alnum_prop": 0.5672918384171476,
"repo_name": "FreshXOpenSource/wallaby-backend-couchdb",
"id": "700d199ffbbcee1d8cf2adc081263bf... |
import datetime
import os
import random
from pprint import pprint
from time import sleep
import requests
import scrapy
import utm
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from is24crawler import settings
from is24crawler.apartment import Apartment
from is24crawle... | {
"content_hash": "67a5e0033446beea3f24d519dfd6f646",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 120,
"avg_line_length": 44.58646616541353,
"alnum_prop": 0.5635750421585161,
"repo_name": "pawod/gis-berlin-rents",
"id": "250aa2838eb95cd9d9a2ab3ac0c98ba7684c4a12",
"size... |
"""
Support for Zwave cover components.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/cover.zwave/
"""
# Because we do not compile openzwave on CI
# pylint: disable=import-error
import logging
from homeassistant.components.cover import (
DOMAIN, SUPPOR... | {
"content_hash": "cd0553e72580658dc015e51ef3b83117",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 103,
"avg_line_length": 35.774193548387096,
"alnum_prop": 0.624346257889991,
"repo_name": "morphis/home-assistant",
"id": "46f23a68515d09a234447611de1df4833990dba6",
"size... |
import os
import sys
from os.path import exists
from common.basedir import BASEDIR
from system.version import get_version
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))
VERSION = get_version()
# -- Project information -----------------------------------------------------
projec... | {
"content_hash": "93bdf47b791ffadc67ab0b350717308a",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 78,
"avg_line_length": 33.18045112781955,
"alnum_prop": 0.6610015862225244,
"repo_name": "commaai/openpilot",
"id": "fea921de1f0e54e8dad307173b1885bdc6ba4b99",
"size": "50... |
from oslo_policy import policy
from nova.policies import base
BASE_POLICY_NAME = 'os_compute_api:os-extended-server-attributes'
extended_server_attributes_policies = [
policy.DocumentedRuleDefault(
BASE_POLICY_NAME,
base.RULE_ADMIN_API,
"""Return extended attributes for server.
This ru... | {
"content_hash": "338e0d7e85346fdb414bb4063f8889d1",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 30.185185185185187,
"alnum_prop": 0.5803680981595092,
"repo_name": "rahulunair/nova",
"id": "40abacb99a8eb1fd43f3bb5b097adc9f2513469e",
"size": "2269... |
"""
Shuffle a set of numbers without duplicates.
Example:
// Init an array with set 1, 2, and 3.
int[] nums = {1,2,3};
Solution solution = new Solution(nums);
// Shuffle the array [1,2,3] and return its result. Any permutation of [1,2,3] must equally likely to be returned.
solution.shuffle();
// Resets the array ba... | {
"content_hash": "4f819aa689c30958ca136ca24cb62922",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 114,
"avg_line_length": 23.655172413793103,
"alnum_prop": 0.5940233236151603,
"repo_name": "algorhythms/LeetCode",
"id": "f38d5dd1ccdb721605b9d8f39e5f4e46578a9f62",
"size":... |
import unittest
import logging
from lxml import etree
from redi import redi
class TestCopyDataToPersonFormEventTree(unittest.TestCase):
def setUp(self):
# silence logger during testing
redi.logger = logging.getLogger('redi')
redi.logger.addHandler(logging.NullHandler())
self.for... | {
"content_hash": "bf1d63a4260675333914d6dfc79ff279",
"timestamp": "",
"source": "github",
"line_count": 696,
"max_line_length": 450,
"avg_line_length": 51.66235632183908,
"alnum_prop": 0.6073365408682593,
"repo_name": "indera/redi",
"id": "4ef20fe322164f46fe834870f1325cfb5fd064db",
"size": "35957",... |
"""Generated client library for developerprojects version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.
from googlecloudapis.apitools.base.py import base_api
from googlecloudapis.developerprojects.v1 import developerprojects_v1_messages as messages
class DeveloperprojectsV1(base_api.Bas... | {
"content_hash": "ecd184ce9ab2168040e1ddcca9fc7572",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 206,
"avg_line_length": 39.48942598187311,
"alnum_prop": 0.6259658786626884,
"repo_name": "ychen820/microblog",
"id": "24af8d471f5fefc5e95c1ea9989d36ccdb748006",
"size": "... |
import os
import shutil
import stat
import sys
import py
import pytest
from _pytest.config import ExitCode
from _pytest.pytester import Testdir
pytest_plugins = ("pytester",)
class TestNewAPI:
def test_config_cache_makedir(self, testdir):
testdir.makeini("[pytest]")
config = testdir.parseconfig... | {
"content_hash": "4a9e2da606001fe6079429cc162e0cf8",
"timestamp": "",
"source": "github",
"line_count": 1171,
"max_line_length": 98,
"avg_line_length": 34.05209222886422,
"alnum_prop": 0.5186206896551724,
"repo_name": "JoelMarcey/buck",
"id": "c133663ea1bcb5608788c49830188690383a72f4",
"size": "398... |
import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
from more_itertools import unique_everseen
import pylab
import matplotlib.dates as mdates
from math import exp, log
import math
from datetime import date, timedelta as td
import statsmodels.api as sm
import scipy
from tabulate import tabul... | {
"content_hash": "3935c027d3b1bf6b3bbb0188bed7d712",
"timestamp": "",
"source": "github",
"line_count": 817,
"max_line_length": 189,
"avg_line_length": 38.76744186046512,
"alnum_prop": 0.6722129258358854,
"repo_name": "JulianPasc/Final-Project-Julien-Pascal",
"id": "6df8302d37630da18a3c35f72f8c666673... |
"""List Snapshots
"""
from __future__ import print_function
from profitbricks.client import ProfitBricksService
client = ProfitBricksService(
username='username', password='password')
snapshots = client.list_snapshots()
for s in snapshots['items']:
print(s['properties']['name'])
"""Get Snapshot
"""
from p... | {
"content_hash": "3467c10917d19c2d76c2fad0ff7c6d2a",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 59,
"avg_line_length": 22.546666666666667,
"alnum_prop": 0.7179183914843288,
"repo_name": "StackPointCloud/profitbricks-sdk-python",
"id": "c6d39fede6677f315045d0dff18f4c0aae... |
"""
Utility methods to set testcases up for Swift and/or S3 tests.
"""
from __future__ import print_function
import BaseHTTPServer
import threading
from oslo_utils import units
FIVE_KB = 5 * units.Ki
class RemoteImageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_HEAD(self):
"""
Respo... | {
"content_hash": "9bdeee6df75c26f7da8bbe538fa9be81",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 74,
"avg_line_length": 28.19178082191781,
"alnum_prop": 0.598153547133139,
"repo_name": "wkoathp/glance",
"id": "89230f71e731d3ba5381628a62f25f8234b021e2",
"size": "2724",
... |
''' Provides a base class for defining subcommands of the Bokeh command
line application.
'''
from abc import ABCMeta, abstractmethod
from bokeh.util.future import with_metaclass
class Subcommand(with_metaclass(ABCMeta)):
''' Abstract base class for subcommands
Subclasses should implement an ``invoke(self, ... | {
"content_hash": "2078fa5a9fd7374d9b9b5cd6da66c49b",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 78,
"avg_line_length": 30.54901960784314,
"alnum_prop": 0.6290115532734275,
"repo_name": "htygithub/bokeh",
"id": "ee86794b400da80b0efa94c8e9ae6e71f6e7de36",
"size": "1558"... |
import App
def foo():
print 'hello world'
App.UserCommands['foo'] = foo | {
"content_hash": "3a5d4279a3b1e835cc5d1bd1fa8c4156",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 29,
"avg_line_length": 12.666666666666666,
"alnum_prop": 0.6710526315789473,
"repo_name": "IronLanguages/dlr",
"id": "bbef00db03099fb25013647af3ffa454a5b5b14c",
"size": "78"... |
import posixpath
import warnings
from collections import defaultdict
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.db.models import CharField, Q
from django.db.models.functions import Length, Substr
from django.db.models.query import BaseIterable
from treebeard.mp_... | {
"content_hash": "9b521f07721f4cf4460735bbaa5dec86",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 108,
"avg_line_length": 36.3783185840708,
"alnum_prop": 0.6127835553122909,
"repo_name": "takeflight/wagtail",
"id": "cc19c1e3fb9a588660371f42c7a06e60cc44e7c8",
"size": "1... |
import os
import shutil
import popen2
import re
import os.path
import sys
def usage():
print "Usage: "
print " %s path_to_itk_files destination_folder" % sys.argv[0]
sys.exit(1)
try:
path_to_libs = os.path.realpath(os.path.join(sys.argv[1],'bin'))
path_to_python_files = os.path.realpath(os.path.... | {
"content_hash": "32c66eb9b4c9d9a9ebe087379840eb6a",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 119,
"avg_line_length": 34.44705882352941,
"alnum_prop": 0.5440573770491803,
"repo_name": "minesense/VisTrails",
"id": "cfb1d05fb9718524e359de6d7b604099b0974492",
"size": ... |
"""
AngularJS, Django, and Jquery File-upload App.
Sandeep Jadoonanan
"""
from django.db import models
import uuid, os
class Image(models.Model):
"""
The default Image model.
"""
# The image file.
img = models.ImageField(upload_to = "uploaded_img")
# Name of the file.
name = mod... | {
"content_hash": "33b475cb4882551ad6d07e2fbf985103",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 87,
"avg_line_length": 25.45098039215686,
"alnum_prop": 0.5612480739599384,
"repo_name": "TunedMystic/file-upload-django-angular",
"id": "2064d54804b42297db9c9cd32c3447033ac... |
"""momentsinfo_convroll4_doublescale_fs5"""
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
batch_size = 128
chunk_size = 32768
num_chunks_train = 240
momentum = 0.9
learning_rate_schedule = {
... | {
"content_hash": "5d3514ab1f669fa37ae1806e4eaa17bd",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 175,
"avg_line_length": 32.0919540229885,
"alnum_prop": 0.7041547277936963,
"repo_name": "benanne/kaggle-ndsb",
"id": "14e1848688bc084e9a784d291751b8d2e93f02f7",
"size": "2... |
""" This module is a facade for AMT (Boto) services. """
import boto.rds
import boto.ec2
from boto.exception import EC2ResponseError
# from boto.rds import RDSConnection
from boto.mturk.connection import MTurkConnection, MTurkRequestError
from boto.mturk.question import ExternalQuestion
from boto.mturk.qualification i... | {
"content_hash": "d36e1586ef2533ed90707c3c08df08bc",
"timestamp": "",
"source": "github",
"line_count": 652,
"max_line_length": 94,
"avg_line_length": 39.263803680981596,
"alnum_prop": 0.551796875,
"repo_name": "berkeley-cocosci/psiTurk",
"id": "b1483845cc6db484d2067f500fc4f8e63ae333b3",
"size": "2... |
"""Fastfood - cookbook wizardry."""
from __future__ import print_function
from datetime import datetime
import json
import logging
import os
import sys
import threading
import urllib2
import fastfood
from fastfood import exc
from fastfood import food
from fastfood import pack
_local = threading.local()
LOG = loggin... | {
"content_hash": "826197b0e2fde2cf9eb843f60706aea5",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 78,
"avg_line_length": 33.15350877192982,
"alnum_prop": 0.5965074745336685,
"repo_name": "brint/fastfood",
"id": "f86b1ffa6b12d8fd20bd5c2cc635856535062740",
"size": "8165"... |
import json
from classes import checkArguments as check
from visvalingam import VisvalingamSimplification
input, output, threshold = check.getIOFilesThreshold();
#open a file, containing a pure GeoJSON-geometry
json_data=open(input,'r')
data = json.load(json_data) #parse JSON-content
json_data.close()
nPointsPrev = ... | {
"content_hash": "77868d7292be3db39865224671739fc0",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 67,
"avg_line_length": 29.565217391304348,
"alnum_prop": 0.7735294117647059,
"repo_name": "milkbread/Visvalingam-Wyatt",
"id": "44a7848420d9c9ccb251dc7c6bbe5908e8b2ae73",
"... |
"""
Copyright (c) 2013 The Regents of the University of California, AMERICAN INSTITUTES FOR RESEARCH
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the abo... | {
"content_hash": "8cbee240fc7d53c39fd3f81f7226fa8e",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 157,
"avg_line_length": 57.67741935483871,
"alnum_prop": 0.7167225950782998,
"repo_name": "CSSIP-AIR/PatentsProcessor",
"id": "d0982cd961549835910598f9183703f39b407398",
"s... |
"""Zero out all voxels in multi-file DICOM image according to a mask.
First index all filenames by slice position, then one-by-one open them again
and and set the non-selected voxel to zero according to the mask slice.
"""
# NOTE: This tool uses pydicom directly, not through dwi.dicomfile.
import argparse
import os
... | {
"content_hash": "3044a0c3c621fa04ebcaf5c16dbc0806",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 78,
"avg_line_length": 33.119565217391305,
"alnum_prop": 0.639317361339022,
"repo_name": "jupito/dwilib",
"id": "9d150e86f6beba497872cbe6abacb20f28e959ae",
"size": "3067",
... |
"""Branching operators"""
from typing import Dict, Iterable, Union
from airflow.models import BaseOperator
from airflow.models.skipmixin import SkipMixin
class BaseBranchOperator(BaseOperator, SkipMixin):
"""
This is a base class for creating operators with branching functionality,
similarly to BranchPy... | {
"content_hash": "4164258994b0d4fe0c8f99eb973c1ab9",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 36.027027027027025,
"alnum_prop": 0.7074268567141786,
"repo_name": "sekikn/incubator-airflow",
"id": "d1502b426425e7b9d6837ef8b61c4942f09f7673",
"siz... |
from __future__ import absolute_import
from blockcanvas.app.scripting import *
| {
"content_hash": "e65c03bc301d83397588f56588747dc6",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 39,
"avg_line_length": 39.5,
"alnum_prop": 0.7974683544303798,
"repo_name": "enthought/etsproxy",
"id": "648544f484b2339bb0de51b71208a2d1659b25d0",
"size": "94",
"binary":... |
import sys
class TeamcityServiceMessages:
quote = {"'": "|'", "|": "||", "\n": "|n", "\r": "|r", ']': '|]'}
def __init__(self, output=sys.stdout, prepend_linebreak=False):
self.output = output
self.prepend_linebreak = prepend_linebreak
def escapeValue(self, value):
if sys.... | {
"content_hash": "53a903803604f6fd2f5fa0ad2af1db0f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 97,
"avg_line_length": 37.76190476190476,
"alnum_prop": 0.619588062211013,
"repo_name": "IllusionRom-deprecated/android_platform_tools_idea",
"id": "24f4a2eec6ad5709af8c19b3a... |
import asyncio
from hotikeys import Hotkey, Key
from hotikeys.hotkey import EventArgs
MAX_RUN_TIME = 10
def automated_test(loop):
def key_handler(args: EventArgs):
print(args.vkey, Key[args.vkey], args.event, args.flags)
def stop_loop():
print('stopping')
loop.stop()
Hotkey(key... | {
"content_hash": "dae09360ed7610a91015f514db35c6bd",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 70,
"avg_line_length": 23.352941176470587,
"alnum_prop": 0.654911838790932,
"repo_name": "appul/HotiKeys",
"id": "e1b2a0f55ed1983e37473cf77a8d8042cf3be0b5",
"size": "794",
... |
import getopt, sys, os, re, socket, time, urllib.request, shutil
__version__ = "0.1.0"
__confpath__ = "hostsmerge.conf"
def default_paths(opts):
if not "hosts-file" in opts:
hosts_path = ""
if os.name == "posix":
hosts_path = "/etc/hosts"
elif os.name == "nt":
hosts_path = os.path.join(os.environ["SYSTEM... | {
"content_hash": "d9178af755edefd770e47b5e4894af3a",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 176,
"avg_line_length": 30.076305220883533,
"alnum_prop": 0.6226465482707971,
"repo_name": "sides/hostsmerge",
"id": "e68e4f8240794cf12497974fdaae0b8f3e2c61b5",
"size": "7... |
from thingface import Client
| {
"content_hash": "d58d13f3938e14c2bbe5c4bcebf137b1",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 28,
"avg_line_length": 29,
"alnum_prop": 0.8620689655172413,
"repo_name": "thingface/python",
"id": "45c1b3833587dc8b4def974b41e0657f5894092f",
"size": "29",
"binary": fal... |
from .rcmod import *
from .utils import *
from .palettes import *
from .linearmodels import *
from .distributions import *
from .timeseries import *
from .miscplot import *
from .axisgrid import *
set()
__version__ = "0.4.dev"
| {
"content_hash": "90ff0a6dc46f8b3efb39486a429c0c30",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 28,
"avg_line_length": 20.727272727272727,
"alnum_prop": 0.7192982456140351,
"repo_name": "yarikoptic/seaborn",
"id": "a8871a0f746903fa7e343da301daaa0630314734",
"size": "2... |
from __future__ import division
import datetime
from distutils.version import LooseVersion
import re
import time
import warnings
from vistrails.core.modules.vistrails_module import Module, ModuleError
from vistrails.core.bundles import py_import
from vistrails.core.utils import VistrailsWarning
PYTZ_MIN_VER = Loose... | {
"content_hash": "52f1981464623ba2a902ae7c4e473dbc",
"timestamp": "",
"source": "github",
"line_count": 589,
"max_line_length": 79,
"avg_line_length": 36.553480475382,
"alnum_prop": 0.5366000928936367,
"repo_name": "VisTrails/VisTrails",
"id": "ccc7e4c400b3a8566421fdfbb78917a4e67dfd60",
"size": "23... |
"""TuLiP Toolbox Transition System subpackage
Suggested abbreviation:
>>> from tulip import transys as trs
"""
from __future__ import absolute_import
__all__ = list()
from . import algorithms
from .algorithms import *
from . import automata
from .automata import *
from . import labeled_graphs
from .labeled_grap... | {
"content_hash": "fa0082490f431dafee079019b49fda20",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 45,
"avg_line_length": 23.5625,
"alnum_prop": 0.7029177718832891,
"repo_name": "tulip-control/tulip-control",
"id": "340702286b61fcc9c21305cddf0cd7d83b7442e3",
"size": "235... |
import pytest
from app import create_app, db as the_db
# Initialize the Flask-App with test-specific settings
the_app = create_app(dict(
TESTING=True, # Propagate exceptions
LOGIN_DISABLED=False, # Enable @register_required
MAIL_SUPPRESS_SEND=True, # Disable Flask-Mail send
SERVE... | {
"content_hash": "602b221ba45ba85fc59b08255d3dbf19",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 85,
"avg_line_length": 31.037037037037038,
"alnum_prop": 0.6861575178997613,
"repo_name": "brandonium21/theBilboard",
"id": "19db0461b6535bdd522160ea795bfc5f4b275d28",
"siz... |
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class LogChecker():
"""
LogChecker is an abstract class that integrations with WAFs MUST implement.
This class is used by the testrunner to test log lines against an expected
regex
"""
def __init__(self):
self.start = None
s... | {
"content_hash": "594f52573c3a212b51e5b45f03ec2119",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 28.357142857142858,
"alnum_prop": 0.646095717884131,
"repo_name": "CRS-support/ftw",
"id": "c99ad83edba8f8744a538aafb5f54042a76cdf42",
"size": "794",... |
__file__ = 'downloadUpdates_v1'
__date__ = '11/12/2015'
__author__ = 'ABREZNIC'
import arcpy, zipfile, os, shutil, urllib, urllib2, json, glob
# http://blogs.esri.com/esri/arcgis/2013/10/10/quick-tips-consuming-feature-services-with-geoprocessing/
updateClass = arcpy.GetParameterAsText(0)
org = arcpy.GetParameterAsTex... | {
"content_hash": "7749a8987320d01f5740aebaef9c0685",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 120,
"avg_line_length": 35.68666666666667,
"alnum_prop": 0.6390808892209976,
"repo_name": "adambreznicky/javascript",
"id": "0ce96e7c4743fc6dae0f4774263ab01b8fdd369e",
"si... |
import random
from arena.client.client import play, connect
from arena.gameplay.chess import Chess
def play_chess()
sock = connect()
return play(sock, get_move)
def get_move(state):
board = state['board']
while True:
game = Chess(board, state['player'])
moves = game.all_legal_moves... | {
"content_hash": "e74ab3b0ed311aae40a6a2bb469a1f88",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 45,
"avg_line_length": 18,
"alnum_prop": 0.6159420289855072,
"repo_name": "chirs/arena",
"id": "72fe04fa29abdeb138988993aa7d5bd1e365e139",
"size": "415",
"binary": false,... |
from oslo_utils import uuidutils
from ironic.common import context
from ironic.common import release_mappings
from ironic.db import api as db_api
from ironic.tests.unit.db import base
from ironic.tests.unit.db import utils
class UpgradingTestCase(base.DbTestCase):
def setUp(self):
super(UpgradingTestCas... | {
"content_hash": "734aa6d0d3e7224c76c1df862192d493",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 78,
"avg_line_length": 40.752,
"alnum_prop": 0.621711817824892,
"repo_name": "Wuguanping/Server_Manage_Plugin",
"id": "9d1a29a33ced68a893071dcc58b752be1251aed4",
"size": "... |
import os
import codecs
from setuptools import setup, find_packages
import pkgutil
import sys
from setuptools.command.develop import develop
from setuptools.command.install import install
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
develop.run(self)
class Post... | {
"content_hash": "83ce56e9593601e33410d77427f9bf75",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 102,
"avg_line_length": 25.586206896551722,
"alnum_prop": 0.6895777178796046,
"repo_name": "BastienFaure/jarvis",
"id": "2036cc9a36f923f4195b4853f2db21d6fe6976eb",
"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):
# Changing field 'FeedEntry.link'
db.alter_column('newspeak_feedentry', 'link', self.gf('django.db.models.fields.URLField')(max_len... | {
"content_hash": "9e6f712a906e6077895046c48b66bb0a",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 177,
"avg_line_length": 62.68852459016394,
"alnum_prop": 0.5593619246861925,
"repo_name": "bitsoffreedom/newspeak",
"id": "5616dce737439e7b445349c6bb93d38baa6872d0",
"size"... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('eboat.dashboard.views',
url(r'^$', 'index', name='eboat_dashboard_index'),
url(r'^boats/$', 'show_boats', name='eboat_dashboard_boats'),
url(r'^hosts/$', 'show_hosts', name='eboat_dashboard_hosts'),
)
| {
"content_hash": "1340572447536c68cd5e69286f125cf5",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 65,
"avg_line_length": 41.57142857142857,
"alnum_prop": 0.6666666666666666,
"repo_name": "deggs7/eboat",
"id": "5ef6ea2ce6d482f0d470ead32456d27bfaef829f",
"size": "291",
"... |
import _plotly_utils.basevalidators
class AlignValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="align", parent_name="scatterpolar.hoverlabel", **kwargs
):
super(AlignValidator, self).__init__(
plotly_name=plotly_name,
parent_... | {
"content_hash": "6b912ba64d1542cf886731335806294d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 82,
"avg_line_length": 36.8125,
"alnum_prop": 0.5823429541595926,
"repo_name": "plotly/python-api",
"id": "ef8f5e253d93d64649d30f545470b78ad8fa426c",
"size": "589",
"bina... |
"""SCons.Script.SConscript
This module defines the Python API provided to SConscript and SConstruct
files.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without r... | {
"content_hash": "9a3ef61acacfc04d6c0d47ce98cd7516",
"timestamp": "",
"source": "github",
"line_count": 603,
"max_line_length": 99,
"avg_line_length": 37.66998341625207,
"alnum_prop": 0.5797490644948272,
"repo_name": "datalogics/scons",
"id": "d25e44c6e67872dec9a6d9321e636c1c9b59eab0",
"size": "227... |
from django import forms
#from account.fields import ReCaptchaField
from django.utils.translation import ugettext_lazy as _
class LoginForm(forms.Form):
""" Form with ReCaptcha """
username = forms.CharField(label="用户名:", min_length=2, max_length=30, required=True)
password = forms.CharField(widget=forms... | {
"content_hash": "9dc012786e9fb4302ee397135f1b88fc",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 116,
"avg_line_length": 43.6,
"alnum_prop": 0.7305045871559633,
"repo_name": "xlk521/cloudguantou",
"id": "65b962502756ac4f18d832f3b0a34de7dc185963",
"size": "918",
"bina... |
class CVI_9003():
"""
rule class
"""
def __init__(self):
self.svid = 9003
self.language = "test"
self.author = "lorexxar"
self.vulnerability = "test"
self.description = "saaaa"
self.status = True
self.match_mode = "3"
self.match = "test... | {
"content_hash": "c91c5e4be86e43bc0a8726c18717501f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 41,
"avg_line_length": 19.037037037037038,
"alnum_prop": 0.49416342412451364,
"repo_name": "LoRexxar/Cobra-W",
"id": "0fe9b6e40177f7d59d489f892df4b8ba6f96a1c0",
"size": "51... |
from rctk.tests.base import BaseTest
class TestToolkit(BaseTest):
def test_root(self):
""" assert there's a root and it has an id of 0 """
assert self.tk.root().id == 0
def test_queue(self):
""" initially, the queue should be empty """
assert len(self.tk._queue) == 0
def t... | {
"content_hash": "6992b9d69e2a5ecc56872098b6dceda9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 64,
"avg_line_length": 31.05263157894737,
"alnum_prop": 0.5983050847457627,
"repo_name": "rctk/rctk",
"id": "62f7ec1c0ba7e06289f624af49303baef953c80e",
"size": "590",
"bi... |
from __future__ import unicode_literals
import json
from boto.glacier.layer1 import Layer1
import sure # noqa
from moto import mock_glacier_deprecated
@mock_glacier_deprecated
def test_init_glacier_job():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
... | {
"content_hash": "8a986b7c9f99f4947cdb047904e0d524",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 80,
"avg_line_length": 30.63,
"alnum_prop": 0.6167156382631407,
"repo_name": "Affirm/moto",
"id": "66780f6810af43e8309bc607808f55df34e18b20",
"size": "3063",
"binary": f... |
import pkg_resources
from testtools import matchers
from glance import opts
from glance.tests import utils
class OptsTestCase(utils.BaseTestCase):
def _check_opt_groups(self, opt_list, expected_opt_groups):
self.assertThat(opt_list, matchers.HasLength(len(expected_opt_groups)))
groups = [g for ... | {
"content_hash": "f9b4bfcdf79b2eb9861f224f7147d003",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 79,
"avg_line_length": 32.68166089965398,
"alnum_prop": 0.4982530439385918,
"repo_name": "darren-wang/gl",
"id": "0715ff99916320931d2861aa3665842f09f08d5b",
"size": "10036... |
from os.path import normpath, basename
def getv(template_var):
return template_var.get('value')
def getk(template_var):
return template_var.get('key')
def getvs(template_vars):
tempArr = []
for i in template_vars:
tempArr.append(i.get('value'))
return tempArr
def base(key):
return basename(normpath(key)) | {
"content_hash": "42f7791cf142de9901b5efd49bdeb9a4",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 38,
"avg_line_length": 19.9375,
"alnum_prop": 0.7241379310344828,
"repo_name": "gregdurham/pyconfd",
"id": "26e6df392dc28d79ac594e74ac512093dd20bc12",
"size": "319",
"bin... |
from __future__ import print_function
import sys, re;
from common import remove_comments, getTokens, getParameters, postProcessParameters
try:
if len(sys.argv) > 1:
module_name = sys.argv[1]
outfile = open('../../../../include/opencv2/core/opencl/runtime/autogenerated/%s.hpp' % module_name, 'w')
... | {
"content_hash": "466a400d3406dde501790f48723cae59",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 131,
"avg_line_length": 31.779411764705884,
"alnum_prop": 0.5939379916705229,
"repo_name": "opencv/opencv",
"id": "54133e808565162bab06e02c185fc7b4f3dead43",
"size": "4443... |
def func1():
print "world function"
class MyClass(object):
def __init__(self, w, x, y, z):
self.w = w
self.x = x
self.y = y
self.z = z
def hello(self):
print("and I say hello ({} {} {} and {})".format(self.w, self.x, self.y, self.z))
def not_hello(self):
... | {
"content_hash": "b231b26097741f5f39d71fa87b61f690",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 120,
"avg_line_length": 23.425,
"alnum_prop": 0.5421558164354322,
"repo_name": "mudzi42/pynet_class",
"id": "5dd9b219ad7d27ada2f19fa2db7a52c41dbb1108",
"size": "937",
"bi... |
from setuptools import setup
import io
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, encoding=encoding) as f:
buf.append(f.read())
return sep.join(buf)
long_des... | {
"content_hash": "101a6668f8c12f664edb1e2f202912e9",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 147,
"avg_line_length": 34.77777777777778,
"alnum_prop": 0.6541533546325878,
"repo_name": "yfauser/maxwindownotify",
"id": "cfa965bf80b9949be99339d7202c44f8ff038891",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.