text stringlengths 4 1.02M | meta dict |
|---|---|
import sys
from pathlib import Path
from typing import Any, List, Optional, Tuple
from airflow_breeze import global_constants
from airflow_breeze.console import console
from airflow_breeze.global_constants import BUILD_CACHE_DIR
def check_if_cache_exists(param_name: str) -> bool:
return (Path(BUILD_CACHE_DIR) / ... | {
"content_hash": "a32970deb090b1a85c5bf30f8ccf8322",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 102,
"avg_line_length": 35.16438356164384,
"alnum_prop": 0.666536813400857,
"repo_name": "mistercrunch/airflow",
"id": "bc00b1fe0ea650203ff327e52f7a3d090b4b3a70",
"size": "... |
"""Schema processing for discovery based APIs
Schemas holds an APIs discovery schemas. It can return those schema as
deserialized JSON objects, or pretty print them as prototype objects that
conform to the schema.
For example, given the schema:
schema = \"\"\"{
"Foo": {
"type": "object",
"properties": {
... | {
"content_hash": "d6e15b1e5f87bbca58342ccc91e81850",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 79,
"avg_line_length": 29.24125874125874,
"alnum_prop": 0.6258519669974889,
"repo_name": "gdg-garage/knihovna-db",
"id": "915f5f4811dc761b55336cae217649c5b97373b0",
"size"... |
from setuptools import setup, find_packages, Extension
from codecs import open
from os import path
# sum up:
# mktmpenv (Python version should not matter)
# pip install numpy cython pypandoc
# python setup.py sdist
# twine upload dist/blabla.tar.gz [-r testpypi]
try:
import numpy as np
except ImportError:
exi... | {
"content_hash": "05bfa563bf6cdd90e36301ae89850ed0",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 92,
"avg_line_length": 33.66019417475728,
"alnum_prop": 0.6325353331410442,
"repo_name": "charmoniumQ/Surprise",
"id": "7fb85916820f94b01cad8d2aeedc2e22d0cecf86",
"size": ... |
import string
from textwrap import wrap
MIN = 1
UNBIASED = 2
def display_table(rows, # List of tuples of data
headings=[], # Optional headings for columns
col_widths=[], # Column widths
col_justs=[], # Column justifications (str.ljust, etc... | {
"content_hash": "aa73ae2c879d66914e26b4624cae7d29",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 110,
"avg_line_length": 37.56521739130435,
"alnum_prop": 0.5302854938271605,
"repo_name": "ActiveState/code",
"id": "9a77c483576aeeb361726d2615c1c8b2300ab5cd",
"size": "51... |
try:
# Try using ez_setup to install setuptools if not already installed.
from ez_setup import use_setuptools
use_setuptools()
except ImportError:
# Ignore import error and assume Python 3 which already has setuptools.
pass
from codecs import open
from os import path
here = path.abspath(path.dirna... | {
"content_hash": "f82f478a0cd14e4ae72cd8b5f4aa2ab5",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 160,
"avg_line_length": 41.214285714285715,
"alnum_prop": 0.6158290005777007,
"repo_name": "adafruit/Adafruit_Python_BMP",
"id": "aa9a270351bd5bede6d4b7a61e543eb8fbae7217",
... |
import math
import Pyro4, time, psutil
#import sqlite3 as sqlite
#import datetime as dt
#perhaps needs to be set somewhere else
Pyro4.config.HMAC_KEY='pRivAt3Key'
#lists for return
stressValues = []
runStartTimeList=[]
runDurations = []
RESTYPE = "null"
MALLOC_LIMIT = 4095
import sys
from collections import OrderedD... | {
"content_hash": "39324112203dbff92fc8d679817d74a9",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 236,
"avg_line_length": 41.05555555555556,
"alnum_prop": 0.6562922868741543,
"repo_name": "cragusa/cocoma",
"id": "b477c8b57feb7d4de811578641ae16a770ccc6bb",
"size": "6625... |
import random
import places
import persons
import actions
import options
from state import GameState
from character import Character
from multiple_choice import MultipleChoice
def lords_victory(state):
if not state.persons.persons_dict["lord_arthur"].alive and \
not state.persons.persons_dict["lord_barthol... | {
"content_hash": "8526522fb5a5c665f267750db1c823a9",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 76,
"avg_line_length": 38.85507246376812,
"alnum_prop": 0.6105930622901903,
"repo_name": "SageBerg/St.GeorgeGame",
"id": "e9e0f8ce621c9b6ecb8092b79289882a42d016ce",
"size":... |
from .sql import (
alias,
all_,
and_,
any_,
asc,
between,
bindparam,
case,
cast,
collate,
column,
delete,
desc,
distinct,
except_,
except_all,
exists,
extract,
false,
func,
funcfilter,
insert,
intersect,
intersect_all,
j... | {
"content_hash": "27b8781181fe27f81d3787e25729d66c",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 77,
"avg_line_length": 14.297101449275363,
"alnum_prop": 0.5631018753167765,
"repo_name": "franekp/millandict",
"id": "e7810239c1af809ba120bd9b8a78a95c64476b4c",
"size": "... |
from cliff import show
# noinspection PyAbstractClass
class HealthCheck(show.ShowOne):
"""Check api health status"""
def take_action(self, parsed_args):
return self.dict2columns(self.app.client.healthcheck.get())
| {
"content_hash": "326d6338d1dbb7234e61ba66c816189b",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 67,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.728448275862069,
"repo_name": "openstack/python-vitrageclient",
"id": "9838dbd3839a06876e95d516753f2c4fc55d484e",
"... |
classmates=["Michael","Bob","Tracy"]
classmates
# ['Michael', 'Bob', 'Tracy']
len(classmates)
#3
classmates[0] # Start from 0
#'Michael'
classmates[1]
#'Bob'
classmates[3] # list index out of range
# len(classmates) - 1 is the python rule
classmates[-1] # get the last
# 'Tracy'
classmates[-2]
# 'Bob'
## add one more ... | {
"content_hash": "c85f12c17b4499e7ee6c9b2625006df8",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 78,
"avg_line_length": 22.225490196078432,
"alnum_prop": 0.6479929422143802,
"repo_name": "yujingma45/PythonLearning_Liaoxuefeng",
"id": "6daaa6e499c1a00b7e0eb255a5cf8eb39f2... |
"""This module exports the FileExists plugin class."""
from SublimeLinter.lint import Linter, util
import re
import os
import sublime
import sublime_plugin
import json
import logging
# PLUGIN_SETTINGS = sublime.load_settings("fileExists.sublime-settings")
# SYNTAX = PLUGIN_SETTINGS.get("syntax")
# DEBUG = PLUGIN_SETT... | {
"content_hash": "9b5da97145493845a36a8b2b7db622e1",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 116,
"avg_line_length": 35.3971119133574,
"alnum_prop": 0.5525752167261602,
"repo_name": "gawells/SublimeLinter-contrib-fileExists",
"id": "9185ac3c042a1a5416c34ba4d85630732... |
from JapaneseTokenizer.common import sever_handler
# client module
import six
if six.PY2:
from JapaneseTokenizer.jumanpp_wrapper.__jumanpp_wrapper_python2 import JumanppWrapper
else:
from JapaneseTokenizer.jumanpp_wrapper.__jumanpp_wrapper_python3 import JumanppWrapper
# else
import sys
import unittest
import o... | {
"content_hash": "1be389565caf22f976dbc1382fcf9c06",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 105,
"avg_line_length": 41.890625,
"alnum_prop": 0.659828422230511,
"repo_name": "Kensuke-Mitsuzawa/JapaneseTokenizers",
"id": "65a15045275ee1d6bffe818db1fe3a1ee806f648",
"... |
import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from pimp_board import app, db
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run() | {
"content_hash": "5be1f3e7f78e61fdcaf93a9c1941f027",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 49,
"avg_line_length": 18.928571428571427,
"alnum_prop": 0.7245283018867924,
"repo_name": "peterprokop/PimpBoard",
"id": "374bf032cb652b3c3d988bc4f5123ec085a069c6",
"size":... |
from flask_testing import TestCase
from mock import Mock
import yawt.utils
import yawtext
from yawt.cli import create_manager
from yawtext.sync import Sync
from yawtext.test import TempGitFolder
class TestFolder(TempGitFolder):
def __init__(self):
super(TestFolder, self).__init__()
self.files = {... | {
"content_hash": "58f9099dab36d43202b2cb9095a1be9c",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 77,
"avg_line_length": 35.37692307692308,
"alnum_prop": 0.583605131550337,
"repo_name": "drivet/yawt",
"id": "ab80dd549509cfca37958e7b7f426ceda0b7827d",
"size": "4618",
... |
from setuptools import setup, find_packages
setup(
name='glu',
packages=find_packages(),
url='https://github.com/chongkong/glu',
license='MIT',
version='0.0.18',
description='Glue for DRY configurations',
author='Park Jong Bin',
author_email='[email protected]',
keywords=['glue'... | {
"content_hash": "d0103ab24aec95d85dde6f1c2e9a61e6",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 80,
"avg_line_length": 28.35483870967742,
"alnum_prop": 0.5699658703071673,
"repo_name": "chongkong/glu",
"id": "fe212568bc06a4a6bafb3ca5f7a94fe7d5e498fb",
"size": "879",
... |
from dataclasses import dataclass
from typing import Any
from pants.backend.codegen.protobuf.lint.buf.skip_field import SkipBufLintField
from pants.backend.codegen.protobuf.lint.buf.subsystem import BufSubsystem
from pants.backend.codegen.protobuf.target_types import (
ProtobufDependenciesField,
ProtobufSource... | {
"content_hash": "9114147f492a581a452fba95ddbdb9a1",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 98,
"avg_line_length": 32.92307692307692,
"alnum_prop": 0.6905503634475597,
"repo_name": "pantsbuild/pants",
"id": "7449bf5575559f575eeb2c9f9463a052cd052881",
"size": "398... |
import unittest
import json
from base64 import b64encode
from flask import url_for
from app import create_app, db
from app.models import User
class APITestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.... | {
"content_hash": "b465695b31baff8d1cbb2c4a31be05d7",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 79,
"avg_line_length": 33.324561403508774,
"alnum_prop": 0.5740984469597262,
"repo_name": "iamgroot42/braindump",
"id": "102a3e4941e75fa3c664d7d5b24caa70513d48bc",
"size":... |
import csv
import random
# Checkout the README.md file for some other notes.
if __name__ == "__main__":
# Dictionary to hold players loaded from the JSON file
players = {}
# The three teams with lists that will hold the
# players assigned to each.
teams = {
'Sharks': { 'players': [] },
... | {
"content_hash": "35a69d508f4cf95a93f0b199a44118b5",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 132,
"avg_line_length": 42.55714285714286,
"alnum_prop": 0.5589123867069486,
"repo_name": "alanwsmith/treehouse-soccer-league",
"id": "1e995c426623f86633bf08e0bd711c2a1cf1aa6... |
"""A script to prepare version informtion for use the gtest Info.plist file.
This script extracts the version information from the configure.ac file and
uses it to generate a header file containing the same information. The
#defines in this header file will be included in during the generation of
the Info.plis... | {
"content_hash": "54889e8bd832a0a1cba5793fbde502d0",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 80,
"avg_line_length": 42.57746478873239,
"alnum_prop": 0.7158451869004301,
"repo_name": "AOSPU/external_chromium_org_testing_gtest",
"id": "88ac186ffdc3ad8f14de4a138a6e86516... |
from google.cloud import memcache_v1beta2
async def sample_get_instance():
# Create a client
client = memcache_v1beta2.CloudMemcacheAsyncClient()
# Initialize request argument(s)
request = memcache_v1beta2.GetInstanceRequest(
name="name_value",
)
# Make the request
response = awa... | {
"content_hash": "34721af3fd7dd37b7644120151cee7bf",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 66,
"avg_line_length": 25,
"alnum_prop": 0.72,
"repo_name": "googleapis/python-memcache",
"id": "16fbc6d6f8b8b154c11476b091c105b4c317019d",
"size": "1864",
"binary": fals... |
__author__ = 'Taio'
# itertools.chain
import itertools
a = [1, 2, 3, 4]
for p in itertools.chain(itertools.combinations(a, 2), itertools.combinations(a, 3)):
print p
for subset in itertools.chain.from_iterable(itertools.combinations(a, n) for n in range(len(a) + 1)):
print subset | {
"content_hash": "96ed78e01182df1ed8199a0d9e7adbcf",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 101,
"avg_line_length": 22.53846153846154,
"alnum_prop": 0.6928327645051194,
"repo_name": "jiasir/python-examples",
"id": "e0a1d646f631bf959b47aa1d862964f357b75281",
"size"... |
from typing import List
from pystarling.api_objects.transactions.TransactionDirectDebit import TransactionDirectDebit
from pystarling.api_services.BaseApiService import BaseApiService
class TransactionDirectDebitService(BaseApiService):
ENDPOINT = 'transactions/direct-debit'
def __init__(self, config):
... | {
"content_hash": "9c90b741b98c816ac6f56f6db5ceaf74",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 105,
"avg_line_length": 38.81818181818182,
"alnum_prop": 0.7295081967213115,
"repo_name": "rdcrt/pystarling",
"id": "6ae2d78b9ce4aa511009b23b9a1e7ac77c2312e1",
"size": "854... |
"""Eval libraries."""
from absl import app
from absl import flags
from absl import logging
import tensorflow as tf
from tensorflow_examples.lite.model_maker.third_party.efficientdet import coco_metric
from tensorflow_examples.lite.model_maker.third_party.efficientdet import dataloader
from tensorflow_examples.lite.mod... | {
"content_hash": "c9cc4b49964e1e851db18b56b7ac2cf1",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 98,
"avg_line_length": 45.55084745762712,
"alnum_prop": 0.6792558139534883,
"repo_name": "tensorflow/examples",
"id": "84fd95f7f4345b64d659d239862cb832aba61ce7",
"size": "... |
from rauth.service import OAuth1Service, OAuth1Session
import xmltodict
class GRSessionError(Exception):
""" Custom request exception """
def __init__(self, error_msg):
self.error_msg = error_msg
def __str__(self):
return self.error_msg + "\n"
class GRSession:
""" Handles OAuth sessi... | {
"content_hash": "6ddae8fcb5c72e6b52328c064d6a12e7",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 107,
"avg_line_length": 37.09473684210526,
"alnum_prop": 0.5956299659477866,
"repo_name": "solvire/goodreads_api",
"id": "1ae5a845789f71c52cb08476aaf7605f16bf8988",
"size":... |
import collections.abc
import contextlib
import copy
import itertools
import random
import string
import threading
from functools import total_ordering, wraps
from typing import TYPE_CHECKING, Iterable, List, Optional, Union
from loguru import logger
from sqlalchemy import Column, Integer, String, Unicode
from flexge... | {
"content_hash": "1b37ef369fb297618dcacf8fdb72292e",
"timestamp": "",
"source": "github",
"line_count": 792,
"max_line_length": 115,
"avg_line_length": 35.87626262626262,
"alnum_prop": 0.5811571760399803,
"repo_name": "crawln45/Flexget",
"id": "b7a033bf57a7c961efe329c9f3500b727554c615",
"size": "28... |
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| {
"content_hash": "389e1aa9fe1d5a60e949299b911b8b5e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 42,
"avg_line_length": 26.5,
"alnum_prop": 0.6792452830188679,
"repo_name": "ossdemura/django-miniblog",
"id": "ab2b104a7548229bace859c2e9e1f3f9c888b08e",
"size": "156",
"... |
def extractFictionweeklyNet(item):
'''
Parser for 'fictionweekly.net'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loit... | {
"content_hash": "edbe58f467f2d6cbf16b2db657c09aa6",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 26,
"alnum_prop": 0.6282051282051282,
"repo_name": "fake-name/ReadableWebProxy",
"id": "4030e34de28cee5e22867f7563405e2a28c38cd0",
"size": "547",
... |
import flask
import pytest
from dash import Dash, Input, Output, State, MATCH, ALL, ALLSMALLER, html, dcc
from dash.testing import wait
debugging = dict(
debug=True, use_reloader=False, use_debugger=True, dev_tools_hot_reload=False
)
def check_errors(dash_duo, specs):
# Order-agnostic check of all the error... | {
"content_hash": "eaf3d2f29142767a0413ccdbecf64101",
"timestamp": "",
"source": "github",
"line_count": 821,
"max_line_length": 88,
"avg_line_length": 30.89890377588307,
"alnum_prop": 0.5056764427625354,
"repo_name": "plotly/dash",
"id": "0e758a6889bfb2911ec0e8eb0604b7e899ace913",
"size": "25368",
... |
from gcp_common import BaseTest
class AppEngineAppTest(BaseTest):
def test_app_query(self):
project_id = 'cloud-custodian'
app_name = 'apps/{}'.format(project_id)
session_factory = self.replay_flight_data(
'app-engine-query', project_id=project_id)
policy = self.load_... | {
"content_hash": "a71c5a437144eea62b80692d2eacdef8",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 97,
"avg_line_length": 42.358381502890175,
"alnum_prop": 0.6368722707423581,
"repo_name": "thisisshi/cloud-custodian",
"id": "8e616529d0b286522cb4896a5be2338bb6198709",
"s... |
import numpy as np
from .query import PWEQuery
from .helper import pw_slicer
class PWEFeatureCalculation:
@staticmethod
def custom_feature_calculation(pws_rel_dfs, rel_schemas, pw_objs, func=lambda pw_dfs, rel_schemas, pw_obj: 0):
features = {}
for pw_obj in pw_objs:
pw_id = pw_o... | {
"content_hash": "20ae49080bb2a34fabd1a550c2d87706",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 117,
"avg_line_length": 39.62162162162162,
"alnum_prop": 0.6084583901773534,
"repo_name": "idaks/PW-explorer",
"id": "00fac08395e5cf392bb8e453aecfdf6cdf80883c",
"size": "14... |
import functools
from wadl2rst.nodes.base import BaseNode
from wadl2rst.nodes.parameters import ParametersNode
def collapse_resources(tree):
""" In the input wadl, the resource uris are split out into a nested
structure with each resource slug having it's own level. For the output,
we only care about th... | {
"content_hash": "3f6d93cdbb97ab2b52f108480051dfc8",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 114,
"avg_line_length": 33.7625,
"alnum_prop": 0.62217697149204,
"repo_name": "annegentle/wadl2rst",
"id": "5c86a229ed26546c211d9153eb69f50389e82ba4",
"size": "5403",
"b... |
from rosidl_adapter.parser import parse_service_string
from rosidl_adapter.resource import expand_template
def convert_srv_to_idl(package_dir, package_name, input_file, output_dir):
assert package_dir.is_absolute()
assert not input_file.is_absolute()
assert input_file.suffix == '.srv'
abs_input_file ... | {
"content_hash": "898150e3d71a5241c87c13cd16c3a61d",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 37.11538461538461,
"alnum_prop": 0.6787564766839378,
"repo_name": "ros2/rosidl",
"id": "c57b7013fc5052e0e3c72e4f4fdc330c314de8ad",
"size": "1567",
... |
import psycopg2
import sys
def drop_if_exists(tbl_name, conn):
"""
delete a table if exists
"""
cur = conn.cursor()
cur.execute("drop table if exists %s" % tbl_name)
conn.commit()
def summarize(conn, tbl_name):
cur = conn.cursor()
cur.execute("select * from %s" % tbl_name)
tree = cur.fetcha... | {
"content_hash": "9bd394f9d524219f811add82951799d6",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 144,
"avg_line_length": 33.13846153846154,
"alnum_prop": 0.6573816155988857,
"repo_name": "spininertia/graph-mining-rdbms",
"id": "096184dacc5d73125aeb6bd4c1615ad6fe64f00f",
... |
import json
import logging
from io import BytesIO
from urllib.parse import urlencode
import tornado
from tornado import gen
from tornado.httpclient import HTTPRequest, HTTPResponse
from tornado.httputil import HTTPHeaders
from smart_sentinel.tornado_client import TornadoStrictRedis
logger = logging.getLogger(__name_... | {
"content_hash": "3ab53c0abb9def8998d20b019938bef9",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 79,
"avg_line_length": 34.61832061068702,
"alnum_prop": 0.6227122381477398,
"repo_name": "globocom/tornado-stale-client",
"id": "8e44a87c983edabaad54f127bfb75680a9c9f850",
... |
"""
This file contains classes and functions for representing,
solving, and simulating agents who must allocate their resources
among consumption, saving in a risk-free asset (with a low return),
and saving in a risky asset (with higher average return).
This file also demonstrates a "frame" model architecture.
"""
imp... | {
"content_hash": "63f43f6a6c56d09a6d3ae70620636367",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 108,
"avg_line_length": 34.01310043668122,
"alnum_prop": 0.5331878289896007,
"repo_name": "econ-ark/HARK",
"id": "c17b23b7bf32e263df3a3924993364772368494a",
"size": "7789"... |
import warnings
import cx_Oracle
from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo, TableInfo,
)
from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.encoding import force_text
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps ty... | {
"content_hash": "3b2392db5b5169b6e4b306a7628eaf5c",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 115,
"avg_line_length": 40.74911660777385,
"alnum_prop": 0.5445716267776621,
"repo_name": "yewang15215/django",
"id": "2d91cc049fae797e73b4ef08e47576554d7fb806",
"size": "... |
import json
import logging
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
from vio.pub.msapi import extsys
from vio.pub.vim.vimapi.nova import OperateServers
from vio.swagger import nova_utils
from vio.pub.exceptions import VimDriverVioException... | {
"content_hash": "10afd6ae8f772e05199c10528c8d32f9",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 79,
"avg_line_length": 39.63636363636363,
"alnum_prop": 0.5576671035386632,
"repo_name": "johnsonlau/multivimdriver-vmware-vio",
"id": "966d5aacdbaab3ffeb22392d9b48dff4dfc95... |
from ..summary import Reader, Summarizer, NextKeyComposer, KeyValueComposer
from ..collector import ToTupleListWithDatasetColumn
from ..collector import WriteListToFile
from ..loop import Collector
##__________________________________________________________________||
def build_counter_collector_pair(tblcfg):
keyV... | {
"content_hash": "d1506a1d51b7da46f6757c4987e5d8e1",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 101,
"avg_line_length": 41.515151515151516,
"alnum_prop": 0.6481751824817519,
"repo_name": "alphatwirl/alphatwirl",
"id": "880a3ea5db1957f846d73b768963a61ef3216a6a",
"size"... |
import pyaudio
###################
# COMMAND GLOBALS #
###################
global COMMAND_NAME
COMMAND_NAME = 'jeeves' # We have a name!
global COMMAND_KEYWORDS
COMMAND_KEYWORDS = [COMMAND_NAME, 'record', 'talk', 'google']
#####################
# DEBUGGING GLOBALS #
#####################
global DEBUG_VERBOSITY
DE... | {
"content_hash": "0e742d39d2ab4a85779be3e01ac6d5c8",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 61,
"avg_line_length": 20.53846153846154,
"alnum_prop": 0.6154806491885143,
"repo_name": "Baveau/jeeves",
"id": "c1ef18827afbb236b82bcc6adf16a55729f2e539",
"size": "801",
... |
import subprocess
from time import *
import sqlite3
import os
########################################################################################################################
DOOR_NUMBER = 101
NETWORK = "Airport"
PASSOWRD = "passpass"
IP_ADDRESS = "192.168.0.53"
SUB_MASK = "255.255.255.0"
ROUTER = "192.168.0... | {
"content_hash": "9ceac433ebae232de9e40724a04f7626",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 120,
"avg_line_length": 33.34054054054054,
"alnum_prop": 0.4275291828793774,
"repo_name": "maestromark55/bust-radio",
"id": "f4ff9921c496543865c2e429d9837e31e7a618ac",
"si... |
import _plotly_utils.basevalidators
class YpadValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="ypad", parent_name="mesh3d.colorbar", **kwargs):
super(YpadValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "02e2927eb34d8f4e0a28250ef667c4c6",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 84,
"avg_line_length": 36.583333333333336,
"alnum_prop": 0.6059225512528473,
"repo_name": "plotly/plotly.py",
"id": "7287f8f6de4c5ac5a4d4dd4393eac4433d918207",
"size": "439... |
"""Constants for working with Chinese characters."""
from __future__ import unicode_literals
import sys
#: Character code ranges for pertinent CJK ideograph Unicode blocks.
characters = cjk_ideographs = (
'\u3007' # Ideographic number zero, see issue #17
'\u4E00-\u9FFF' # CJK Unified Ideographs
'... | {
"content_hash": "8c2e287205c26c7f7913941e8b74c480",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 32.35632183908046,
"alnum_prop": 0.6884547069271758,
"repo_name": "JohnnyZhao/zhon",
"id": "22d0436f1a595a1cdccfc569cb2853fcb93a05f6",
"size": "2869"... |
import os
from warnings import warn
from collections import Mapping
from .. import yaml_io
import numpy as np
from .. Error import GroupMissingDataError
from . Group import Group, Descriptor
from . Scheme import GroupAdditivityScheme
from . DataDir import get_data_dir
class GroupLibrary(Mapping):
"""Represent li... | {
"content_hash": "20227b4e36be5b44fe11023a9f5ad8d6",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 79,
"avg_line_length": 37.51020408163265,
"alnum_prop": 0.5789678221669516,
"repo_name": "VlachosGroup/VlachosGroupAdditivity",
"id": "b5611acf134a542f37e86ba3aff1faedf03e54... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0003_auto_20151113_1545'),
]
operations = [
migrations.AlterModelOptions(
name='user_details',
options={'ordering':... | {
"content_hash": "539f7b1dc93088b89239d0840b411e8e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 105,
"avg_line_length": 26.307692307692307,
"alnum_prop": 0.5628654970760234,
"repo_name": "mdsafwan/Deal-My-Stuff",
"id": "c0273127b731c6b402920ec57ee96c91e7932dcd",
"size... |
import sys
from leapp.exceptions import InvalidTopicDefinitionError
from leapp.utils.meta import get_flattened_subclasses, with_metaclass
class TopicMeta(type):
"""
Meta class for the registration of topics
"""
def __new__(mcs, name, bases, attrs):
klass = super(TopicMeta, mcs).__new__(mcs, ... | {
"content_hash": "a208a936f71822d0b70af512938baf37",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 117,
"avg_line_length": 27.020833333333332,
"alnum_prop": 0.6468774094063223,
"repo_name": "vinzenz/prototype",
"id": "0331ec25ceef8a6f5cba9fb91d748223873eecea",
"size": "1... |
from django.core.management.base import BaseCommand
from transfer.functions import run_transfer
class Command(BaseCommand):
help = 'Transfer children '
def handle(self, *args, **options):
run_transfer()
| {
"content_hash": "55d7555ffe69f138063b4dce541beb1c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 51,
"avg_line_length": 22.3,
"alnum_prop": 0.7219730941704036,
"repo_name": "mitrofun/kids2",
"id": "4a8cf61567a0ad83f25d2e03cc59b1e3e82771d7",
"size": "247",
"binary": f... |
from IPython import get_ipython
from prompt_toolkit.enums import DEFAULT_BUFFER
from prompt_toolkit.filters import (HasFocus, HasSelection, ViInsertMode)
from prompt_toolkit.key_binding.vi_state import InputMode
ip = get_ipython()
def switch_mode(event):
" Map 'kj' to Escape. "
vi_state = event.cli.vi_state
... | {
"content_hash": "848321ba4f4c931f4713386a97000ee3",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 88,
"avg_line_length": 42.86046511627907,
"alnum_prop": 0.6673901247965274,
"repo_name": "achalddave/dotfiles",
"id": "de9cdf36f5b29ba460448af4c32aa6238dc4a831",
"size": "1... |
from wtforms import validators
from werkzeug.datastructures import FileStorage
import wtforms
def validate_required_iff(**kwargs):
"""
Used as a validator within a wtforms.Form
This implements a conditional DataRequired
Each of the kwargs is a condition that must be met in the form
Otherwise, no v... | {
"content_hash": "b9421038accb61c87ff72ed7680d7070",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 156,
"avg_line_length": 37.57272727272727,
"alnum_prop": 0.5952092910718606,
"repo_name": "delectable/DIGITS",
"id": "721e92575a541eb173ad19c862a46601836d7353",
"size": "8... |
from optparse import OptionParser
import docker
import logging
import json
from configuration.ganger_conf import GangerConfiguration
import util.utility as utility
from dns.ganger_dns import GangerDns
global docker_host
docker_client = None
docker_host = None
logger = logging.getLogger(__name__)
def get_client():
... | {
"content_hash": "b72818d40e23a8cd8f6ba0f409881abf",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 94,
"avg_line_length": 38.785714285714285,
"alnum_prop": 0.6028238182934316,
"repo_name": "GordonWang/ganger",
"id": "610e7d89a2ba51d0e3abc7208dcf2647bb85c7fc",
"size": "4... |
import numpy as np
from sklearn import cluster
from sklearn import datasets
from sklearn import metrics
from sklearn.cross_validation import train_test_split
from sklearn.metrics import homogeneity_score, completeness_score, v_measure_score, adjusted_rand_score, \
adjusted_mutual_info_score, silhouette_score
from s... | {
"content_hash": "f04599c9f95125e4a4a45820cf75e2b7",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 114,
"avg_line_length": 31.68918918918919,
"alnum_prop": 0.646908315565032,
"repo_name": "monal94/digits-scikit-learn",
"id": "86084deded9b7dd37b95209a644bb9f777d57291",
"s... |
"""
Commands that update or process the application data.
"""
from datetime import datetime
import json
from fabric.api import task
from facebook import GraphAPI
from twitter import Twitter, OAuth
import app_config
import copytext
@task(default=True)
def update():
"""
Stub function for updating app-specific ... | {
"content_hash": "87d645093b4d7d17e8aec75c788fe337",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 271,
"avg_line_length": 35.36875,
"alnum_prop": 0.5317193850503622,
"repo_name": "PostDispatchInteractive/app-template",
"id": "1f0ced6b29502ae0fa569850cfb50b2f0a74ae87",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PasswordReset'
db.create_table('accounts_passwordreset', (
('id', self.gf('django.db.models.fiel... | {
"content_hash": "aba26568af86f873174a429a22b1d479",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 182,
"avg_line_length": 61.4375,
"alnum_prop": 0.5664874291527394,
"repo_name": "softak/webfaction_demo",
"id": "7c4364429c9ecffb0fa29af74a371cd3ae77f177",
"size": "6899",... |
"""
Write and read logs that can be re-parsed back into mostly intact records,
regardless of the contents of the log message.
"""
import logging
import os
import time
from collections import namedtuple
from conary.lib import util
class StructuredLogFormatter(logging.Formatter):
def __init__(self):
logg... | {
"content_hash": "561ee8e6da3944419beae86e65ce3ade",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 79,
"avg_line_length": 30.682008368200837,
"alnum_prop": 0.5746624846583935,
"repo_name": "sassoftware/rmake3",
"id": "336c181605914aed7dd46727f49ccc2b1ad0a39b",
"size": "... |
from pymba import Vimba
if __name__ == '__main__':
with Vimba() as vimba:
print(vimba.interface_ids())
| {
"content_hash": "757ce7929ea11ab02e75053a22b90806",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 36,
"avg_line_length": 16.857142857142858,
"alnum_prop": 0.576271186440678,
"repo_name": "morefigs/pymba",
"id": "9a7cbecd27bce8918d0fae406479e098cda7cdcd",
"size": "118",
... |
from __future__ import absolute_import, division, print_function
import os
import math
import hmac
import json
import hashlib
import argparse
from random import shuffle
from pathlib2 import Path
import numpy as np
import tensorflow as tf
from tensorflow.data import Dataset
def info(msg, char="#", width=75):
print... | {
"content_hash": "5b95ca1af0bba8e6c6a1eb5ffa9577e7",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 98,
"avg_line_length": 30.848341232227487,
"alnum_prop": 0.5954831771393455,
"repo_name": "kubeflow/examples",
"id": "a67f23f636bcd48dc31aea63dbec7654684a507d",
"size": "6... |
import RPi.GPIO as GPIO
import time
pin = 17
first = 1
gap = 1
second = 1
# B Letter
firstCount = 3
secondCount = 7
firstSleepTimeOn = 0.02
firstSleepTimeOff = 0.04
secondSleepTimeOn = 0.04
secondSleepTimeOff = 0.06
gapSleepTime = 0.1
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin,GPIO.OUT)
if (first == 1):
... | {
"content_hash": "f795e06b43895a0c8ae75f26fc4e1819",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 34,
"avg_line_length": 16.933333333333334,
"alnum_prop": 0.7047244094488189,
"repo_name": "larssima/AmiJukeBoxRemote",
"id": "65d424bbc5957009f693ac1f0a9cb422a62b720e",
"si... |
import numpy
from matplotlib.pyplot import figure, show, rc
from numpy.random import normal
from kapteyn import kmpfit
from scipy.odr import Data, Model, ODR, RealData, odr_stop
def model(p, x):
# Model: Y = a + b*x
a, b = p
return a + b*x
def residuals(p, data):
# Merit function for data with errors in b... | {
"content_hash": "29a98bbe6bebb9227e6ac4cef02f1afc",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 86,
"avg_line_length": 30.88888888888889,
"alnum_prop": 0.6326438848920863,
"repo_name": "kapteyn-astro/kapteyn",
"id": "847d337fa650053436ff346e2f819632a2b8fcdd",
"size": ... |
from nova.policies import base
POLICY_ROOT = 'os_compute_api:os-availability-zone:%s'
availability_zone_policies = [
base.create_rule_default(
POLICY_ROOT % 'list',
base.RULE_ADMIN_OR_OWNER,
"Lists availability zone information without host information",
[
{
... | {
"content_hash": "fb9fe2266bc95eae70a432c784f9f982",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 77,
"avg_line_length": 24.46875,
"alnum_prop": 0.5389527458492975,
"repo_name": "rajalokan/nova",
"id": "281d8c675eea8027be86827b3b1d400e430d8a82",
"size": "1422",
"binar... |
"""
pyshtools Global Spectral Analysis Routines.
This submodule of pyshtools defines the following functions:
Real spectral analysis
----------------------
SHPowerL Compute the power of a real function for a single
spherical harmonic degree.
SHPowerDensityL ... | {
"content_hash": "62949a32c5290856fe2a470a9709a82f",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 50.785714285714285,
"alnum_prop": 0.6545710267229254,
"repo_name": "heroxbd/SHTOOLS",
"id": "6b60cb375467e8374c1707cf01eb174f99e6ebfc",
"size": "3555... |
import functools
from .errors import ClaripyOperationError, ClaripyTypeError, ClaripyZeroDivisionError
from .backend_object import BackendObject
def compare_bits(f):
@functools.wraps(f)
def compare_guard(self, o):
if self.bits == 0 or o.bits == 0:
raise ClaripyTypeError("The operation is no... | {
"content_hash": "81a48b4d8e317563e4a0b4b99622215c",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 105,
"avg_line_length": 23.68075117370892,
"alnum_prop": 0.5688937351308485,
"repo_name": "Ruide/angr-dev",
"id": "8be5f4208ab21f8cb67df7d3f1a19a9e4c151be2",
"size": "1008... |
import hashlib
import sys
import time
import warnings
from django.conf import settings
from django.db.utils import load_backend
from django.utils.deprecation import RemovedInDjango18Warning
from django.utils.encoding import force_bytes
from django.utils.functional import cached_property
from django.utils.six.moves imp... | {
"content_hash": "fd59ca6b0b24efe94d3e68ebb4859e74",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 120,
"avg_line_length": 41.86055045871559,
"alnum_prop": 0.5718418514946962,
"repo_name": "wfxiang08/django178",
"id": "25e3aa16e033f8ad5234e6e7adb2d9e63f8defcf",
"size": ... |
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foundation, either version 2.0 of the License, o... | {
"content_hash": "ae56f7330800576d3621e28c0e4474f1",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 76,
"avg_line_length": 31.20408163265306,
"alnum_prop": 0.6602354480052322,
"repo_name": "hivesolutions/netius",
"id": "48ae3e847d175d33428cdf7a046df87a8ae8da0f",
"size": "... |
"""
Python-based HLA:peptide binding prediction cache and IEDB-tool wrapper
========================================================
"""
from .cache import hlaPredCache, RandCache
from .helpers import *
from . import predict
from .iedb_src import predict_binding as iedb_predict
from .new_iedb_predict import *
__all_... | {
"content_hash": "0efb0a19273082be95ed0ff553665ce3",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 71,
"avg_line_length": 26.8125,
"alnum_prop": 0.5,
"repo_name": "agartland/HLAPredCache",
"id": "fda6e044aa0a00d4c1b9ba00e1b230be1c643f70",
"size": "859",
"binary": false... |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ct', '0015_migrate_fsm'),
]
operations = [
migrations.AlterField(
model_name='concept',
name='title',
field=models.CharField(max_length=200),
... | {
"content_hash": "46739f53c86ae59db45ad5f3d95ded4f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 521,
"avg_line_length": 41.58620689655172,
"alnum_prop": 0.5754560530679934,
"repo_name": "cjlee112/socraticqs2",
"id": "5eb100dbb0d696d5a60712b084844f646f003f84",
"size": ... |
"""
This script discovers all the listening ports and then enumerates the method
calls it sees on each port.
Make sure you have the library installed:
```
$ pip install thrift-tools
```
And then run it as root:
```
$ sudo examples/methods_per_port.py
On port 3030, method rewrite was called
On port 3031, method sear... | {
"content_hash": "1406f68636e94534bcafecd104f783ae",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 78,
"avg_line_length": 23.084745762711865,
"alnum_prop": 0.6035242290748899,
"repo_name": "shrijeet/thrift-tools",
"id": "77e0b803e0005972c47ce86b3c30cbb1fad9e5f5",
"size"... |
import _plotly_utils.basevalidators
class IdsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="ids", parent_name="candlestick", **kwargs):
super(IdsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edi... | {
"content_hash": "0120785e8b5dcbcdbc7eaf2f240961eb",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 79,
"avg_line_length": 35.63636363636363,
"alnum_prop": 0.6173469387755102,
"repo_name": "plotly/plotly.py",
"id": "6f32ec6b9b65375516b8571883590f37a3f89adc",
"size": "392"... |
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
fr... | {
"content_hash": "ad4fbf616b8a7e3314f015fb0faa44b4",
"timestamp": "",
"source": "github",
"line_count": 694,
"max_line_length": 244,
"avg_line_length": 44.038904899135446,
"alnum_prop": 0.6570362857049373,
"repo_name": "Azure/azure-sdk-for-python",
"id": "d367044f22364dc4e7358e8c73f3c098d326bcaa",
... |
"""
toradbapi
=========
Wrapper for twisted.enterprise.adbapi.ConnectionPool to use with tornado.
Copyright (c) 2014, Timofey Trukhanov.
MIT, see LICENSE for more details.
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from twisted.enterprise.adbapi ... | {
"content_hash": "f69bb4a7a3033099b1df90439fbcfd3b",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 29.6,
"alnum_prop": 0.6539039039039038,
"repo_name": "geerk/toradbapi",
"id": "42a4e154968ca87f5460b1ab5cd27ec22727aea5",
"size": "1332",
"binary":... |
from django import template
from finial.util import user_has_override
register = template.Library()
@register.filter
def has_finial_flag(user, flag):
return user_has_override(user, flag)
| {
"content_hash": "185abcd9859bc52fd6e10b2650a78029",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 24.125,
"alnum_prop": 0.772020725388601,
"repo_name": "urbanairship/django-finial",
"id": "a294633dc7fdeb80ec753920725678b18be31d94",
"size": "193",
... |
from cargo import *
import json
import pickle
from psycopg2.extensions import *
from psycopg2.extras import *
from cargo.fields.binary import cargobytes
from vital.debug import Compare, RandData
from vital.cache import high_pickle
c = Compare(cargobytes, bytes)
c.time(1E6, high_pickle.dumps('foo'))
| {
"content_hash": "45b5f619ff88a65d8ac06932280e7149",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 42,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.7947019867549668,
"repo_name": "jaredlunde/cargo-orm",
"id": "1bc335cd27362ce6157a5d0a7be87da4de7c3a85",
"size": ... |
MAIN_TEMPLATE="""# PROD BUILDING STEPS
options:
machineType: 'E2_HIGHCPU_32'
env:
- DOCKER_CLI_EXPERIMENTAL=enabled
steps:
- name: 'docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64'
- name: 'gcr.io/cloud-builders/docker'
id: multi_arch_step1
args:
- 'buildx'
- 'create'
- '--name'
- 'mybuilder'... | {
"content_hash": "3543c8d3e2be3bb3a2168868428f61c2",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 109,
"avg_line_length": 34.995024875621894,
"alnum_prop": 0.575774808075064,
"repo_name": "GoogleCloudPlatform/cloud-sdk-docker",
"id": "02fedbdfaebbb9b65a24344d8a2fdc5f6202... |
import numpy as np
from glumpy import app
from glumpy.graphics.collections import PointCollection
from glumpy.transforms import PowerScale, Position, Viewport
window = app.Window(1024,1024, color=(1,1,1,1))
@window.event
def on_draw(dt):
window.clear()
points.draw()
@window.event
def on_mouse_scroll(x,y,dx,d... | {
"content_hash": "444d2c9d62e961f889f994be7de09c71",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 25.71875,
"alnum_prop": 0.6998784933171325,
"repo_name": "glumpy/glumpy",
"id": "392c8237d8a3d9d3c0d802f7eaf312b140d801cf",
"size": "1093",
"binary... |
from django.conf.urls import patterns, include, url
from django.views.decorators.csrf import csrf_exempt
from bootcamp.traceroute import views
urlpatterns = [
url(r'^$', views.traceroute, name='traceroute'),
url(r'^inttraceroute$', views.inttraceroute, name='inttraceroute'),
## traceroute with ansible
url... | {
"content_hash": "174d434ea28421fef168db9bafebd7bb",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 112,
"avg_line_length": 53.84615384615385,
"alnum_prop": 0.6914285714285714,
"repo_name": "davismathew/netbot-django",
"id": "6453786b8752f10274cd418f81613a7282db4a0a",
"si... |
"""
A script removing animations from SVG graphics.
"""
import sys, os, re
# etree fails utterly at producing nice-looking XML
from xml.dom import minidom
def process(inpt, outp):
def traverse(node):
for child in node.childNodes:
if child.nodeType != minidom.Node.ELEMENT_NODE:
... | {
"content_hash": "5202dab3ecedc4343c58e0ce42d1b2a9",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 71,
"avg_line_length": 34.255319148936174,
"alnum_prop": 0.5627329192546584,
"repo_name": "CylonicRaider/Instant",
"id": "be44a976b641ca294be115a5fcc626a3cd29e12c",
"size":... |
"""
Provides FileStorage implementation for local filesystem.
This is usefull for storing files inside a local path.
"""
import os
import uuid
import shutil
import json
from datetime import datetime
from .interfaces import FileStorage, StoredFile
from . import utils
from .._compat import unicode_text
class LocalSt... | {
"content_hash": "4696bfd7506b7b598f0515f0d14b82d3",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 92,
"avg_line_length": 33.157575757575756,
"alnum_prop": 0.5907512337781027,
"repo_name": "amol-/depot",
"id": "a5574da259470fe2dd5f29276514d3555e843bd3",
"size": "5471",
... |
import httplib # Used only for handling httplib.HTTPException (case #26701)
import urllib2
import traceback
import json
from kunai.log import logger
from kunai.collector import Collector
class RabbitMQ(Collector):
def launch(self):
logger.debug('getRabbitMQStatus: start')
if 'rabbitMQStatusUrl... | {
"content_hash": "7be6e406365fd06ca33fc8641c507e4a",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 130,
"avg_line_length": 38.25892857142857,
"alnum_prop": 0.577362893815636,
"repo_name": "pombredanne/kunai-1",
"id": "af3f106cfe5eaab3b1eb893eb9eaa4da4b4e3feb",
"size": "... |
from flask import make_response
from flask import request
from .constants import OK, NO_CONTENT
from .resources import Resource
class FlaskResource(Resource):
"""
A Flask-specific ``Resource`` subclass.
Doesn't require any special configuration, but helps when working in a
Flask environment.
"""... | {
"content_hash": "1d6182b4f892da01c356cb6c6a1f0d6a",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 81,
"avg_line_length": 33.41525423728814,
"alnum_prop": 0.5830585848338828,
"repo_name": "toastdriven/restless",
"id": "a41a7d63ab520d2cb387bd166f3f160c491de519",
"size": ... |
"""Utilities for testing the mapreduce backend."""
import collections
import numpy as np
import tensorflow as tf
from tensorflow_federated.python.core.backends.mapreduce import forms
from tensorflow_federated.python.core.impl.compiler import building_blocks
from tensorflow_federated.python.core.impl.computation impo... | {
"content_hash": "50299a71053eab3e67e0070ff766370c",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 91,
"avg_line_length": 39.644444444444446,
"alnum_prop": 0.6916106128550075,
"repo_name": "tensorflow/federated",
"id": "bd8cc63886e531498a3c2acacdf52e428c1d8bc4",
"size":... |
import operator
import numpy as np
import math
from numpy import (pi, asarray, floor, isscalar, iscomplex, real,
imag, sqrt, where, mgrid, sin, place, issubdtype,
extract, inexact, nan, zeros, sinc)
from . import _ufuncs as ufuncs
from ._ufuncs import (mathieu_a, mathieu_b, iv, jv,... | {
"content_hash": "d7312c3fa9e7937691f03a9f8cc758e5",
"timestamp": "",
"source": "github",
"line_count": 2540,
"max_line_length": 94,
"avg_line_length": 27.96771653543307,
"alnum_prop": 0.5674850080238746,
"repo_name": "nmayorov/scipy",
"id": "c0a125fdc73ef20df2c5ecb826f3bab29c7cb331",
"size": "7107... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.AutoField(auto_cre... | {
"content_hash": "8b635c92d0735f0e8f1a7975a88e9fba",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 28.75,
"alnum_prop": 0.5695652173913044,
"repo_name": "juandc/platzi-courses",
"id": "7b8d64c187fdcc636efc81a641eaec28b097118b",
"size": "762",
"b... |
from setuptools import setup
setup(name='fieldbook_py',
version='0.4.1',
description='Helper package for using the Fieldbook.com API',
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Prog... | {
"content_hash": "3442c677cde7071bb13f1e0e923a892b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 69,
"avg_line_length": 30.208333333333332,
"alnum_prop": 0.576551724137931,
"repo_name": "mattstibbs/fieldbook_py",
"id": "4c89f086edc432a795c32aa4317ef5da4905c3eb",
"size"... |
get_credentials = '''
select password, password_salt
from person
where id = %(id)s
'''
get_person = '''
select *
from person
where id = %(id)s
'''
create_user = '''
insert into person (id, password, password_salt)
values (%(id)s, %(passwo... | {
"content_hash": "9b79608dc6e256c2168b6d31af096240",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 64,
"avg_line_length": 21.8125,
"alnum_prop": 0.498567335243553,
"repo_name": "best-coloc-ever/globibot",
"id": "944d97f9c90e58382a86bb480fa295f0371b1f6f",
"size": "349",
... |
import sys
from form_designer.exceptions import HttpRedirectException
from django.template.base import TemplateSyntaxError
from django.http import HttpResponseRedirect
class RedirectMiddleware(object):
def process_exception(self, request, exception):
#django wraps the original exception in a template excep... | {
"content_hash": "cfc6e117f194b7d79f363cefd4b2f32e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 35.111111111111114,
"alnum_prop": 0.6930379746835443,
"repo_name": "guilleCoro/django-form-designer",
"id": "062d7b4689189abc953ded283eb324119aee549e",... |
import time, select, errno
from gearman.compat import *
from gearman.connection import GearmanConnection
from gearman.task import Task, Taskset
class GearmanBaseClient(object):
class ServerUnavailable(Exception):
pass
class CommandError(Exception):
pass
class InvalidResponse(Exception):
... | {
"content_hash": "e1506dcc7c7a728d3676d3f5a224156c",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 112,
"avg_line_length": 38.27428571428572,
"alnum_prop": 0.5809196775156763,
"repo_name": "samuel/python-gearman",
"id": "44be53368695f13977c3ac9ced9ad57757589691",
"size"... |
"""Deploy GPFS cache cluster.
"""
import logging
import math
import os
import tempfile
import time
from orchestrate import base
log = logging.getLogger(__name__)
class GPFS(base.OrchestrateSystem):
"""Deploy GPFS instance."""
def __init__(self):
super(GPFS, self).__init__()
# Storage
self.cluster_... | {
"content_hash": "225b079b9efc6d753485a414691512d5",
"timestamp": "",
"source": "github",
"line_count": 431,
"max_line_length": 250,
"avg_line_length": 32.4338747099768,
"alnum_prop": 0.6308748837542028,
"repo_name": "GoogleCloudPlatform/solutions-cloud-orchestrate",
"id": "d8acd0871bde4bc04c06122750... |
import pandas as pd
import numpy as np
from scipy.optimize import minimize
from ex5_utils import *
import scipy.io
import matplotlib.pyplot as plt
# Part 1 -- Loading and visualizing data
raw_mat = scipy.io.loadmat("ex5data1.mat")
X = raw_mat.get("X")
y = raw_mat.get("y")
ytest = raw_mat.get("ytest")
yval = raw_mat.ge... | {
"content_hash": "1737b750d8ce2ce3ecdcfffe4d08d69c",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 77,
"avg_line_length": 31.705263157894738,
"alnum_prop": 0.7138114209827358,
"repo_name": "lukemans/Hello-world",
"id": "435547c62792561ab2e8651d69bdfdfa47fae96f",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('councilmatic_core', '0024_auto_20161017_1201'),
]
operations = [
migrations.AlterField(
model_name='eve... | {
"content_hash": "49970dfabc3984b86f0c21bc952cc5a6",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 158,
"avg_line_length": 28.210526315789473,
"alnum_prop": 0.6585820895522388,
"repo_name": "datamade/django-councilmatic",
"id": "8c751e6d4fb57c0082be168db4c8a089a1287733",
... |
import sys
import os
import os.path as op
import subprocess
import time
import json
from distutils.version import LooseVersion
from mne import pick_types
from mne.utils import logger, set_log_file
from mne.report import Report
from mne.io.constants import FIFF
def get_data_picks(inst, meg_combined=False):
"""Ge... | {
"content_hash": "8eca95cbce803cb4945e4a73350dbf8b",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 80,
"avg_line_length": 29.946902654867255,
"alnum_prop": 0.5960401891252955,
"repo_name": "cmoutard/meeg-preprocessing",
"id": "838657a15037c2e6c4aa6bf2c0500c5f21225f6d",
... |
import sys
from __init__ import read_fastq_sequences
import DBConstants
# A shell interface to the screed FQDBM database writing function
if __name__ == "__main__":
# Make sure the user entered the command line arguments correctly
if len(sys.argv) != 2:
sys.stderr.write("ERROR: USAGE IS: %s <dbfilename... | {
"content_hash": "395efaa96da2c2f498879dd9ec3f8e12",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 77,
"avg_line_length": 31.9375,
"alnum_prop": 0.6673189823874756,
"repo_name": "poojavade/Genomics_Docker",
"id": "45596228699e0da63661199f1708821fd80976e7",
"size": "588",... |
"""
Challenge #258 [Intermediate] IRC: Responding to commands
https://www.reddit.com/r/dailyprogrammer/comments/4anny5/challenge_258_intermediate_irc_responding_to/
# Description
In the last challenge we initiated a connection to an IRC server. This time we are going to utilise that connection by
responding to user i... | {
"content_hash": "df2c981ccfa4325f15911235ff414101",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 120,
"avg_line_length": 59.80733944954128,
"alnum_prop": 0.7623868691517104,
"repo_name": "DayGitH/Python-Challenges",
"id": "35ab010d95436337b2910fd17d9d2e5441d8651b",
"s... |
"""Automatic addition of additional markup to the doc strings used by pygrametl,
which should allow them to be readable in the source code and in the
documentation after Sphinx has processed them.
"""
# Copyright (c) 2014-2020, Aalborg University ([email protected])
# All rights reserved.
# Redistribution and... | {
"content_hash": "62b1b6e6ebf171dfdd421ea04c570e72",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 80,
"avg_line_length": 42.4180790960452,
"alnum_prop": 0.6885988279168886,
"repo_name": "chrthomsen/pygrametl",
"id": "178ede7b9147dc21ce69a2a3f2418490547b22ac",
"size": "... |
from django.db import migrations
import touchtechnology.common.db.models
class Migration(migrations.Migration):
dependencies = [
("news", "0005_auto_20191122_1340"),
]
operations = [
migrations.AddField(
model_name="article",
name="copy",
field=toucht... | {
"content_hash": "597522352cbe43dc227a727bc29761a7",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 61,
"avg_line_length": 21.9,
"alnum_prop": 0.5730593607305936,
"repo_name": "goodtune/vitriolic",
"id": "0aa8e543a08e1368c55b6689cbaf6331cede563d",
"size": "438",
"binary... |
from django import forms
from django.forms import ValidationError
from generic.models import Module, StaticModuleContent
import datetime
class FilterForm(forms.Form):
""" abstract filter class for filtering contacts"""
def __init__(self, data=None, **kwargs):
self.request = kwargs.pop('request')
... | {
"content_hash": "58d56e09d7eb70559360bfa2f9490583",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 143,
"avg_line_length": 43.12048192771084,
"alnum_prop": 0.6811958647666946,
"repo_name": "unicefuganda/edtrac",
"id": "1729e161ec14f55fe058682357177a3624af6ef7",
"size": "... |
DOCUMENTATION = '''
---
module: hashivault_rekey
version_added: "3.3.0"
short_description: Hashicorp Vault rekey module
description:
- Module to (update) rekey Hashicorp Vault. Requires that a rekey
be started with hashivault_rekey_init.
options:
url:
description:
- url for vault
... | {
"content_hash": "770df63ddf99c0b3aeed99660331d308",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 167,
"avg_line_length": 31.244444444444444,
"alnum_prop": 0.6408250355618776,
"repo_name": "cloudvisory/ansible-modules-hashivault",
"id": "e391d435f3df260e5515a9608242f92045... |
from kanaria.core.model import ApplicationIndex
from kanaria.core.service.brain import Brain
class kintoneInterface(object):
def __init__(self):
from kanaria.core.environment import Environment
self._env = Environment()
self.service = Environment.get_kintone_service(self._env)
sel... | {
"content_hash": "528a34c15a5015b20d28cff94b89285e",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 103,
"avg_line_length": 38.47239263803681,
"alnum_prop": 0.5732738000318929,
"repo_name": "icoxfog417/kanaria",
"id": "5121c1b4cfa4b1a7fbce5de894a4e555f9b69989",
"size": "... |
"""Models for menu app."""
from __future__ import unicode_literals
import re
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.core.urlresolvers import reverse, NoReverseMatch
@python_2_unicode_compatible
class Menu(models.Model):
"""Menu model."""
name = ... | {
"content_hash": "49e9a18d364234ee2435f974fa29d67b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 61,
"avg_line_length": 32.017857142857146,
"alnum_prop": 0.5192414947016174,
"repo_name": "gilmrjc/djangopress",
"id": "aba723841ba55434e203f58701eed094bff025ed",
"size": "... |
__author__ = 'mikeknowles, akoziol'
""" Includes threading found in examples:
http://www.troyfawkes.com/learn-python-multithreading-queues-basics/
http://www.ibm.com/developerworks/aix/library/au-threadingpython/
https://docs.python.org/2/library/threading.html
Revised with speed improvements
"""
from Bio.Blast.Applica... | {
"content_hash": "e4ccb9c02dee028e560d20f3143c118d",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 142,
"avg_line_length": 49.5635103926097,
"alnum_prop": 0.6214528679931037,
"repo_name": "adamkoziol/pythonGeneSeekr",
"id": "1af2bff8d717a2f2367f419e98e8443541407421",
"s... |
from ClassyClient import ClassyClient
from ClassyClientResponse import ClassyClientResponse
from Exceptions import ClassyAuthError, ClassyRequestError, ClassyNotACollection
| {
"content_hash": "522595017cbb8e62c4a11f8ba560e7d4",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 80,
"avg_line_length": 57.666666666666664,
"alnum_prop": 0.9075144508670521,
"repo_name": "dnussbaum/classy-python-client-library",
"id": "1c78306792a4b80e30e9fa8bfdc3930aacce... |
import uuid
class User(object):
def __init__(self):
self.id = uuid.uuid4().hex
self.username = None
self.passwordHash = None
self.authToken = None
self.clientId = None
self.files = None
self.apiCredits = 15
self.apiChallenge = None
self.apiResponse = None
class File(object):
de... | {
"content_hash": "2f5c455d1a616398ba6040c9a0d12bc5",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 56,
"avg_line_length": 23.161290322580644,
"alnum_prop": 0.6288300835654597,
"repo_name": "somethingnew2-0/CS739-ShareBox",
"id": "1b0e0a31da70ba96017d0e95df698e12216b1890",
... |
from mongoengine import connect, Document
import pytest
DB_NAME = 'test_mongonengine_objectidmapfield'
@pytest.fixture(autouse=True)
def doctests_fixture(doctest_namespace):
doctest_namespace['Document'] = Document
@pytest.fixture(scope='session', autouse=True)
def conn(request):
conn = connect(DB_NAME)
... | {
"content_hash": "dd2ff6cc9c323c7f4e0a466af942cef9",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 46,
"avg_line_length": 20.38095238095238,
"alnum_prop": 0.7313084112149533,
"repo_name": "peergradeio/mongoengine-objectidmapfield",
"id": "caf62f8c3a041697550e4fd6df89b24083... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.