text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Mobile IP.
"""
from scapy.fields import ByteEnumField, ByteField, IPField, LongField, \
ShortField, XByteField
from scapy.packet import Packet, bind_layers, bind_bottom_up
from scapy.layers.inet import IP, UDP
class MobileIP(Packet):
name = "Mobile IP (RFC3344)"
fields_desc = [ByteEnumField("type", 1... | {
"content_hash": "9234699bd69429599dd49c3f5c855c20",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 72,
"avg_line_length": 32.12765957446808,
"alnum_prop": 0.6059602649006622,
"repo_name": "4shadoww/hakkuframework",
"id": "67c2ce2059d841ab1a91963e2f7d5e0ca8ed93a9",
"size"... |
from Expression import *
class LinearExpression(Expression):
"""
Class representing a linear expression node in the AST of a MLP
"""
def __init__(self):
Expression.__init__(self)
class ValuedLinearExpression(LinearExpression):
"""
Class representing a valued linear expression node in ... | {
"content_hash": "4ac4fc1c439e095661f8a2b093d4af5a",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 123,
"avg_line_length": 29.5,
"alnum_prop": 0.6222760290556901,
"repo_name": "rafaellc28/Latex2MiniZinc",
"id": "a9100cfff21f249f59863ca5236d3b9be0b79ceb",
"size": "8260",... |
"""The Vilfo Router integration."""
from datetime import timedelta
import logging
from vilfo import Client as VilfoClient
from vilfo.exceptions import VilfoException
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, Platform
from homeassistant.core impo... | {
"content_hash": "e21f675c9cc12058f2e30bde7be24907",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 82,
"avg_line_length": 30.935185185185187,
"alnum_prop": 0.6477102663873092,
"repo_name": "GenericStudent/home-assistant",
"id": "ac3b8b87f3ff78f9dfe1bd4bb7e702fcc5799c72",
... |
'''
A program with bugs. Try to fix them all!
-----------------------------------------------------------
(c) 2013 Allegra Via and Kristian Rother
Licensed under the conditions of the Python License
This code appears in section 12.2.2 of the book
"Managing Biological Data with Python".
------------------... | {
"content_hash": "c2200dbc054a71a490d16f8e86dbfbd3",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 61,
"avg_line_length": 30.350877192982455,
"alnum_prop": 0.5630057803468208,
"repo_name": "raymonwu/Managing_Your_Biological_Data_with_Python_3",
"id": "19964a4d8d9da39ef3d29... |
"""This module offers methods and user interaction widgets/windows for handling
the table-like step functions of elementary cellular automatons.
* A bit of functionality to generate a rule number from arbitrary step
functions by running them on a pre-generated target and finding out how it
behaved.
* ...
.. ... | {
"content_hash": "2a79f41f9678461a1868cf5c6b3041b9",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 89,
"avg_line_length": 38.93877551020408,
"alnum_prop": 0.6865828092243187,
"repo_name": "timo/zasim",
"id": "f0743713349db2dc282c936c9167a66546cda8c1",
"size": "5724",
... |
import os
import sys
import random
from os import path
from termcolor import colored
from people import Staff, Fellow
from rooms import Office, LivingSpace
from database.schema import People, DataBaseConnection, Rooms, Unallocated
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
white_line = colored... | {
"content_hash": "b816f6710d252bd37b4284fa37a21924",
"timestamp": "",
"source": "github",
"line_count": 627,
"max_line_length": 94,
"avg_line_length": 48.75438596491228,
"alnum_prop": 0.47374791455395987,
"repo_name": "Alweezy/alvin-mutisya-dojo-project",
"id": "9f2cf5a4c99bdea4ec561cf64ca5beeaf60e35... |
def add_native_methods(clazz):
def sin__double__(a0):
raise NotImplementedError()
def cos__double__(a0):
raise NotImplementedError()
def tan__double__(a0):
raise NotImplementedError()
def asin__double__(a0):
raise NotImplementedError()
def acos__double__(a0):
... | {
"content_hash": "8e354451b559a0aaebfdb49dd928fc9f",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 89,
"avg_line_length": 31.5609756097561,
"alnum_prop": 0.6367851622874807,
"repo_name": "laffra/pava",
"id": "d7073997d1871a68e38d0ee04f2a37d907505e2b",
"size": "2588",
"... |
"""
Convolution layer tests
"""
import itertools as itt
import numpy as np
from neon import NervanaObject
from neon.layers.layer import Convolution
from neon.initializers.initializer import Uniform
from tests.utils import allclose_with_out
def pytest_generate_tests(metafunc):
np.random.seed(1)
if metafunc.con... | {
"content_hash": "e8185e7542629e8482245684809f05a4",
"timestamp": "",
"source": "github",
"line_count": 442,
"max_line_length": 86,
"avg_line_length": 36.463800904977376,
"alnum_prop": 0.5561829124526897,
"repo_name": "coufon/neon-distributed",
"id": "599b10b5e9132760783cd3bf3cfe3fa16b350940",
"siz... |
import os
import sys
import getopt
import traceback
import pprint
import time
import subprocess
import shlex
import re
import operator
calls = dict() # dict of dicts: {'name', 'bcet', 'wcet', 'lastcall', 'running'}
list_calls = False
pretty = False
coverage = False
covdata = {}
full_stats = False
filter_func = None
s... | {
"content_hash": "014d486065b7d9e729a720433c9a8ef0",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 147,
"avg_line_length": 34.220588235294116,
"alnum_prop": 0.5555282706120694,
"repo_name": "TRDDC-TUM/wcet-benchmarks",
"id": "0b7474e2fd7246a0055986f0c3037c6c7ff7d3be",
"... |
import mock
import neutron.plugins.ml2.drivers.openvswitch.agent.common.constants \
as ovs_const
from neutron.tests.unit.plugins.ml2.drivers.openvswitch.agent.\
openflow.ovs_ofctl import ovs_bridge_test_base
call = mock.call # short hand
class OVSPhysicalBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
... | {
"content_hash": "0e34b44315a20ffa6c11066a81a90b0f",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 78,
"avg_line_length": 35.72839506172839,
"alnum_prop": 0.580511402902557,
"repo_name": "noironetworks/neutron",
"id": "317294f5515b5f387b6cb45d3a1332dc5b52171c",
"size": "... |
"""
__LocalDef1orMoreDefPart2_Complete_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: gehan
Modified: Mon Mar 2 14:57:51 2015
______________________________________________________________________________________________
"""
from s... | {
"content_hash": "51b3977653f00f383179ae682f556ff8",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 632,
"avg_line_length": 52.51851851851852,
"alnum_prop": 0.6347751136185551,
"repo_name": "levilucio/SyVOLT",
"id": "c9e16150a709f6fc935af11914172d71997266c5",
"size": "12... |
"""
logbook.handlers
~~~~~~~~~~~~~~~~
The handler interface and builtin handlers.
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
import os
import re
import sys
import stat
import errno
import socket
try:
from hashlib import sha1
except Im... | {
"content_hash": "0e11853e0923ca6d63298919273a7590",
"timestamp": "",
"source": "github",
"line_count": 1631,
"max_line_length": 134,
"avg_line_length": 37.06866952789699,
"alnum_prop": 0.608114590052763,
"repo_name": "dplepage/logbook",
"id": "8725e98f4b24795b1714d769a44f5c9bbb6133c4",
"size": "60... |
"""
CacheItem interface:
'_id': string,
'url': string,
'response_url': string,
'body': string,
'head': string,
'response_code': int,
'cookies': None,#grab.response.cookies,
TODO: WTF with cookies???
"""
from hashlib import sha1
import zlib
import logging
import pymongo
from bson import Binary
import time
import six
fr... | {
"content_hash": "0e8fac1fc584ffdbdb8705278fa0e8d3",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 30.322314049586776,
"alnum_prop": 0.5696375034069229,
"repo_name": "huiyi1990/grab",
"id": "7f79dda385839742707f61e46853c3d104e45a80",
"size": "3669... |
"""
Application related tasks for Invoke.
"""
from invoke import Collection
from . import dependencies, env, db, run
from config import BaseConfig
namespace = Collection(
dependencies,
env,
db,
run,
)
namespace.configure({
'app': {
'static_root': BaseConfig.STATIC_ROOT,
}
})
| {
"content_hash": "b1002c64e762b32948641f3c91ac8015",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 46,
"avg_line_length": 14.227272727272727,
"alnum_prop": 0.6517571884984026,
"repo_name": "ssls/beetle-agent",
"id": "4ada6f6932b976f1086fde99b2633304ce520d24",
"size": "33... |
"""
Broadcast a message, with or without a price.
Multiple messages per block are allowed. Bets are be made on the 'timestamp'
field, and not the block index.
An address is a feed of broadcasts. Feeds may be locked with a broadcast whose
text field is identical to ‘lock’ (case insensitive). Bets on a feed reference
t... | {
"content_hash": "f8d92e1a771288a2ca102d1ff7dddbf8",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 182,
"avg_line_length": 43.213592233009706,
"alnum_prop": 0.5667640230659777,
"repo_name": "Litetokens/litetokensd",
"id": "ec57dbc5e3fa9cf019e133ded5b8f5a6855df0c8",
"siz... |
from win32clipboard import *
from pywin32_testutil import str2bytes # py3k-friendly helper
import win32con
import types
if not __debug__:
print "WARNING: The test code in this module uses assert"
print "This instance of Python has asserts disabled, so many tests will be skipped"
cf_names = {}
# Buil... | {
"content_hash": "4b050eb526a2ae5a903124178bb870f6",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 107,
"avg_line_length": 35.916030534351144,
"alnum_prop": 0.593836344314559,
"repo_name": "ntuecon/server",
"id": "ee94996f18260209f491b4b8dff9a3ec433f8939",
"size": "4776... |
"""
包含一些CTA因子的可视化函数
"""
import matplotlib
matplotlib.use('Qt4Agg')
import numpy as np
import pandas as pd
import seaborn as sns
#import matplotlib as mpl
#mpl.rcParams["font.sans-serif"] = ["Microsoft YaHei"]#
#mpl.rcParams['axes.unicode_minus'] = False
import matplotlib.pyplot as plt
from calcFunction import get_capi... | {
"content_hash": "1e4f68b260b0d9db58bacd61369740e1",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 99,
"avg_line_length": 35.229166666666664,
"alnum_prop": 0.6014192785334121,
"repo_name": "moonnejs/uiKLine",
"id": "8bbed72f388097273d3a7d08f8820484688ac87e",
"size": "179... |
"""
.. module:: Downsample test
:platform: Unix
:synopsis: unittest test classes for plugins
.. moduleauthor:: Mark Basham <mark.basham@diamond.ac.uk>
"""
import unittest
from savu.test.plugin_test import PluginTest
class DownsampleTest(PluginTest):
def setUp(self):
self.plugin_name = "savu.plu... | {
"content_hash": "c10f516f5ace9fac2b93cc379d5a1a3d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 59,
"avg_line_length": 18.666666666666668,
"alnum_prop": 0.6836734693877551,
"repo_name": "swtp1v07/Savu",
"id": "ec31e66eee3bf4fb1d9c778d2a4ed9b15d6d6d4b",
"size": "982",
... |
import json
from mock import patch
from onadata.apps.api.tests.viewsets.test_abstract_viewset import\
TestAbstractViewSet
from onadata.apps.api.viewsets.user_profile_viewset import UserProfileViewSet
from onadata.apps.main.models import UserProfile
from django.contrib.auth.models import User
from onadata.libs.seri... | {
"content_hash": "43a66d7b2cf9bbad23f31e99f5797533",
"timestamp": "",
"source": "github",
"line_count": 511,
"max_line_length": 79,
"avg_line_length": 40.08023483365949,
"alnum_prop": 0.5895708217372199,
"repo_name": "qlands/onadata",
"id": "559d8d3e099de89ee92afac2c3211cd9b21bdbb5",
"size": "20481... |
import json
import utils
import logger
import problemdb
import teamdb
from decorators import api_wrapper
from flask import Blueprint, request, session, jsonify, make_response
from decorators import admins_only
api = Blueprint("api", __name__)
@api.route("/api/register", methods=["POST"])
@api_wrapper
def register()... | {
"content_hash": "bd35aabf8c0ab8141dab2623d3e53e73",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 145,
"avg_line_length": 34.21604938271605,
"alnum_prop": 0.5987732274941368,
"repo_name": "james9909/IntroCTF",
"id": "9dd6ddb879ccc123066e7ccd9bd9bfcdbd764eec",
"size": "... |
import json
import bpy
import os
from bpy.types import Operator
from . import utils
from .assets.scripts.evertims import ( Evertims, evertUtils )
# to launch EVERTims raytracing client
import subprocess
# ---------------------------------------------------------------
# import components necessary to report EVERTims ... | {
"content_hash": "69f1aa9574aeaba2d09dbcf0b2c30a45",
"timestamp": "",
"source": "github",
"line_count": 666,
"max_line_length": 282,
"avg_line_length": 39.249249249249246,
"alnum_prop": 0.6285003825554706,
"repo_name": "EVERTims/game_engine_evertims",
"id": "f786220a92332d5b685721e30cc6a892f7994bf6",... |
import unittest
import snippet
class SnippetTest(unittest.TestCase):
def testParseWithImage(self):
img_snp = snippet.Snippet("2011-10-28T16:51:00.000-07:00")
self.assertEquals(datetime.datetime(2011, 10, 28, 16, 51), published)
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "53dc7150fec8d29983769fe19dfaf55b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 73,
"avg_line_length": 26,
"alnum_prop": 0.7027972027972028,
"repo_name": "starpow971/Stanford-Humanities-Center-Updater",
"id": "b5aa8e92b7d4a563ac35ee6397e9fbfc89ad86c0",
... |
"""This module contains regression tests for flows-related API handlers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from absl import app
from grr_response_core.lib import registry
from grr_response_core.lib import utils
from grr_response_core.lib.... | {
"content_hash": "c30818c4498bc08329f2e0050f38f4a0",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 80,
"avg_line_length": 34.51,
"alnum_prop": 0.6952332657200812,
"repo_name": "dunkhong/grr",
"id": "dbe5ad2a358198d33e2abbe08d766562b167cdb3",
"size": "13826",
"binary":... |
"""
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
This file is part of the Smart Developer Hub Project:
http://www.smartdeveloperhub.org
Center for Open Middleware
http://www.centeropenmiddleware.com/
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=... | {
"content_hash": "681b744e1504bbb22b4e8355d5e78198",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 76,
"avg_line_length": 39.0625,
"alnum_prop": 0.5504,
"repo_name": "fserena/agora-stoa",
"id": "d71f6eb331207dfd73ad38852a6539904bc22a2d",
"size": "1250",
"binary": false... |
import requests
import webbrowser
import re
import os
import sys
from bs4 import BeautifulSoup
BASE_URL = "http://www.reddit.com/r/dailyprogrammer/new/"
def get_soup(url):
return BeautifulSoup(requests.get(url).text)
def get_page_challenges(soup):
return [challenge for challenge in soup.find_all('div', cl... | {
"content_hash": "7a233d7840dfdb4d7821cdfc560fa288",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 78,
"avg_line_length": 26.79787234042553,
"alnum_prop": 0.5712584358872569,
"repo_name": "miguelgazela/reddit-dailyprogrammer",
"id": "6664ca5e55366a04dbc498a69eaf78433382047... |
import json
import re
import defusedxml.ElementTree as et
from geowatchutil.base import GeoWatchError
from geowatchutil.broker.base import GeoWatchBroker
from geowatchutil.codec.geowatch_codec_slack import GeoWatchCodecSlack
from slackbotosm.enumerations import URL_PROJECT_VIEW, URL_PROJECT_EDIT, URL_PROJECT_TASKS, ... | {
"content_hash": "07596c550d50323d693de6933e95e7a3",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 220,
"avg_line_length": 36.93333333333333,
"alnum_prop": 0.5186522262334536,
"repo_name": "pjdufour/slackbot-osm",
"id": "4f71e3a34fe2637063effee238ceb816b004ee70",
"size"... |
import abc
import json
import os
from typing import Dict
import six
from ...datastructures import JSONDict
from ...git import git_show_file
from ...utils import get_metadata_file, has_logs, is_metric_in_metadata_file, read_metadata_rows
from ..constants import V1, V1_STRING, V2, V2_STRING
class ValidationResult(obj... | {
"content_hash": "51fc41cc3e5dc78eb2407c7400a6f847",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 120,
"avg_line_length": 38.939682539682536,
"alnum_prop": 0.6128322191423446,
"repo_name": "DataDog/integrations-core",
"id": "6a9aac2b2607b904ba8024f0c8402a43cfc2ae5c",
"... |
from ._abstract import AbstractScraper
class EthanChlebowski(AbstractScraper):
@classmethod
def host(cls):
return "ethanchlebowski.com"
def author(self):
return self.schema.author()
def title(self):
return self.schema.title()
def category(self):
return self.schem... | {
"content_hash": "a5e2d7b11aba05573f6405ff62f45f31",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 85,
"avg_line_length": 21.45,
"alnum_prop": 0.6305361305361306,
"repo_name": "hhursev/recipe-scraper",
"id": "d555c438dc5a654f4cbf2a821612dc76f9cb8c66",
"size": "858",
"b... |
import unittest
from unittest import mock
from parameterized import parameterized
from airflow.api.common.experimental.trigger_dag import _trigger_dag
from airflow.exceptions import AirflowException
from airflow.models import DAG, DagRun
from airflow.utils import timezone
from tests.test_utils import db
class TestT... | {
"content_hash": "dbd3c095acb93058f0e71d6387d3a49e",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 110,
"avg_line_length": 37.77981651376147,
"alnum_prop": 0.6301602719766877,
"repo_name": "mrkm4ntr/incubator-airflow",
"id": "9fb772d3576f9079419be933b8d73160a58f9b2c",
"... |
from django.db import models
from django.utils import timezone
import datetime
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length = 200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_pu... | {
"content_hash": "ab798c3ee5f43a4d6e6a194f2760d493",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 97,
"avg_line_length": 32.275862068965516,
"alnum_prop": 0.7040598290598291,
"repo_name": "LoopSun/PythonWay",
"id": "10246668659f7ad3333713c3422d9b8968b79f7e",
"size": "93... |
import os
import subprocess
import benchmark.util as Util
import benchmark.tools.template
import benchmark.result as result
class Tool(benchmark.tools.template.BaseTool):
"""
This class serves as tool adaptor for LLBMC
"""
def getExecutable(self):
return Util.findExecutable('lib/native/x86_64... | {
"content_hash": "7852e7ff4deaf9a86bf973716fcdd55b",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 94,
"avg_line_length": 29.77922077922078,
"alnum_prop": 0.5503706934147405,
"repo_name": "TommesDee/cpachecker",
"id": "63ccf6c007eaf7c4eea84a4f0ee66f7845d2ba79",
"size": "... |
import subprocess
import os
from glim.core import Facade
from glim import Log
from glim import paths
OPTION_MAP = {
'nojs': '--no-js',
'lint': '--lint',
'verbose': '--verbose',
'units': '-sm=on',
'compress': '--compress'
}
DEFAULT_CONFIG = {
'source': os.path.join(paths.APP_PATH, 'assets/less/main.less'),
'de... | {
"content_hash": "3dcf9bb4a74e8278c054daf01cd00568",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 68,
"avg_line_length": 21.890625,
"alnum_prop": 0.635260528194147,
"repo_name": "aacanakin/glim-extensions",
"id": "9b5dcf78f4b4bb31bdbede42b67cc66f64aac0f6",
"size": "1401... |
"""
Pagination: select how many results to display.
"""
# Maybe refactor later the same way as variant_filter,
# but maybe not necessary as long as they are so simple.
def pagination_from_request(request):
lim = request.GET.get('limit')
off = request.GET.get('offset', '0')
assert off.isdigit(), "Argument t... | {
"content_hash": "1b34a2c1849a7b1100bef7135ac80648",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 70,
"avg_line_length": 29,
"alnum_prop": 0.5982008995502249,
"repo_name": "444thLiao/VarappX-flask",
"id": "23a47459be9689c0586a52bec877165ddc996c48",
"size": "1334",
"bi... |
import csv
import os
import re
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
import pkgutil
import inspect
import bb
import supportedrecipesreport
class Columns(object):
"""Base class for all classes which extend the SUPPORTED_RECIPES_SOURCES report.
Typically used to add c... | {
"content_hash": "1d611e7dbd42e0d375c43890ff08059b",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 108,
"avg_line_length": 42.114713216957604,
"alnum_prop": 0.6040383704405495,
"repo_name": "jairglez/intel-iot-refkit",
"id": "e9907eae1772761d8c6ab416e23b7d733a20cbc7",
"... |
"""An implementation of the Zephyr Abstract Syntax Definition Language.
See http://asdl.sourceforge.net/ and
http://www.cs.princeton.edu/research/techreps/TR-554-97
Only supports top level module decl, not view. I'm guessing that view
is intended to support the browser and I'm not interested in the
browser.
Changes... | {
"content_hash": "6e37e10bee26e62d84361cbee1cd5e47",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 79,
"avg_line_length": 26.96330275229358,
"alnum_prop": 0.5340251786321878,
"repo_name": "OptimusGitEtna/RestSymf",
"id": "fc1b16c668153f630234377d9b33e2059750ceee",
"size... |
import psycopg2 as db
import sys
import os
from flask import Flask, request, Response, render_template, session, redirect, json
from twilio import twiml
from twilio.rest import TwilioRestClient
import imp
#loads account_sid and auth_token from private space
config = imp.load_source('config', '../sensitive_data/config... | {
"content_hash": "a2d7efffd093beab510edc1277b23f2b",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 138,
"avg_line_length": 38.355555555555554,
"alnum_prop": 0.6235998455001931,
"repo_name": "danielseetoh/twilio185",
"id": "43ef0c0cd78ef4efbf7b32bf35b8172c36574a86",
"siz... |
import sys
import unittest
import libsbml
class TestModel_newSetters(unittest.TestCase):
global M
M = None
def setUp(self):
self.M = libsbml.Model(2,4)
if (self.M == None):
pass
pass
def tearDown(self):
_dummyList = [ self.M ]; _dummyList[:] = []; del _dummyList
pass
de... | {
"content_hash": "09d8a164ba13c6091411c7ab6e08fe1b",
"timestamp": "",
"source": "github",
"line_count": 991,
"max_line_length": 72,
"avg_line_length": 34.36629667003027,
"alnum_prop": 0.6057785477288076,
"repo_name": "TheCoSMoCompany/biopredyn",
"id": "52bfb95b8653fb8680e5455898da00c99e95fdd0",
"si... |
from mlscripts.ml.som.classes import *
from mlscripts.ml.som.flatten import *
import scipy as scipy
import mlscripts.ml.som.functions as fn
import re
from collections import Counter
def word_plot(matrix):
matrix = scipy.transpose(matrix)
nrows = len(matrix)
for i in range(nrows):
i = nrows - 1 - i
... | {
"content_hash": "dd6d1794e32f047d26e924240f7a415f",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 171,
"avg_line_length": 28.957943925233646,
"alnum_prop": 0.5460706793609811,
"repo_name": "IAS-ZHAW/machine_learning_scripts",
"id": "bd2e831585476cf37fde297aa5636db0b86a44... |
import copy
import itertools
import json
import logging
import math
import os
import socket
import traceback
from collections import defaultdict
from datetime import timedelta
import markdown
import nvd3
import pendulum
import sqlalchemy as sqla
from flask import (
redirect, request, Markup, Response, render_temp... | {
"content_hash": "ed9d6e11892303e7d3827618d746c8fd",
"timestamp": "",
"source": "github",
"line_count": 2411,
"max_line_length": 90,
"avg_line_length": 36.950642886768975,
"alnum_prop": 0.5419809626436781,
"repo_name": "malmiron/incubator-airflow",
"id": "49a9a734cc483ccb381ec2c3c9c35754262929a4",
... |
from django.conf import settings
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from django.urls import include, path
from core import views as core_views
from api.resources import OrderableResource, PostResource, SearchResource
from core.sitemap import IndexSitemap, BlogSitemap, St... | {
"content_hash": "62b903b50c3bf178f5778567cd813176",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 86,
"avg_line_length": 35.26923076923077,
"alnum_prop": 0.678298800436205,
"repo_name": "manti-by/M2MICRO",
"id": "712ba01a9ca4656d0141cd1ddd49f41e6c08d480",
"size": "1834"... |
from yapsy.IPlugin import IPlugin
from logbook.Importer import Plugin
from messages import TimeSeriesData,TimeSeriesMetaData,LogMetaData,UIData,TimeSeries
from sqlalchemy import *
import logging
from tools.profiling import timing
from PyQt5.QtWidgets import QLabel, QFormLayout, QLineEdit
class Swimming(IPlug... | {
"content_hash": "871da583e7ee588996c5c3ddd086829a",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 118,
"avg_line_length": 43.33796296296296,
"alnum_prop": 0.516718299326995,
"repo_name": "romses/FitView",
"id": "b91d249b7244981c0a637c3ad04b0ae685fc7620",
"size": "9361"... |
import unittest
from framework import TestCase
from earth.category import Category
class TestCategoryCase(TestCase):
def test_category(self):
# ADD
ctg_name = '社区'
ctg = Category.add(name=ctg_name)
assert ctg.id
assert ctg.name == ctg_name
assert ctg.pid == None
... | {
"content_hash": "11b2e17b688bcbf3baa6e3f335100820",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 57,
"avg_line_length": 22.939393939393938,
"alnum_prop": 0.5772787318361955,
"repo_name": "tottily/terabithia",
"id": "f7a953bf9a4231184e7d491d942a955786ec9db0",
"size": "8... |
"""
.. py:currentmodule:: __init__
:synopsis: Init for the package.
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Init for the package.
"""
###############################################################################
# Copyright 2007 Hendrix Demers
#
# Licensed under the Apache License, Vers... | {
"content_hash": "3a0c5234e47411646667dc4f8eee2ef2",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 30.264705882352942,
"alnum_prop": 0.6277939747327502,
"repo_name": "drix00/microanalysis_file_format",
"id": "39a1c38adcde014e7223139bc25599a60b273c7d"... |
# -*- coding: utf-8 -*-
import base64
import json
import os
import os.path
import shutil
import sys
import tarfile
import tempfile
import pytest
import six
try:
from ssl import OP_NO_SSLv3, OP_NO_SSLv2, OP_NO_TLSv1
except ImportError:
OP_NO_SSLv2 = 0x1000000
OP_NO_SSLv3 = 0x2000000
OP_NO_TLSv1 = 0x40... | {
"content_hash": "a8d04d9f4001c1a7e5685db3daeb5e7e",
"timestamp": "",
"source": "github",
"line_count": 956,
"max_line_length": 79,
"avg_line_length": 36.13284518828452,
"alnum_prop": 0.5668876472802015,
"repo_name": "mark-adams/docker-py",
"id": "87796d11752aa87ed4de8b7629080ccffce8a6c0",
"size": ... |
import numpy as np
import matplotlib.pyplot as plt
from directionFinder_backend.correlator import Correlator
import scipy.signal
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
if __name__ == '__main__':
c = Correlator()
c.fetch_t... | {
"content_hash": "c80b50b5e3ea01424cfb835f640b2c02",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 112,
"avg_line_length": 43.17333333333333,
"alnum_prop": 0.6065472513897467,
"repo_name": "jgowans/correlation_plotter",
"id": "5a0011f2e3058d2f6f22a732704f80aa208ca483",
"... |
from __future__ import division, print_function , unicode_literals, absolute_import
import os, sys, subprocess
crow_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
eigen_cflags = ""
try:
has_pkg_eigen = subprocess.call(["pkg-config","--exists","eigen3"]) == 0
except:
has_pkg_eigen = False
if ... | {
"content_hash": "5fbbb3420fc6a45b29e42a08857a4893",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 109,
"avg_line_length": 27.23076923076923,
"alnum_prop": 0.6949152542372882,
"repo_name": "joshua-cogliati-inl/raven",
"id": "86779741a78857a3581a50e6664461c19c447f29",
"si... |
from octopus.core import app
from service import dao
from octopus.lib import dataobj
class ContentLog(dataobj.DataObj, dao.ContentLogDAO):
'''
{
"id" : "<unique persistent account id>",
"created_date" : "<date account created>",
"last_updated" : "<date account last modified>",
... | {
"content_hash": "b778b42f5313b9f441e4b361aadb980e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 87,
"avg_line_length": 32,
"alnum_prop": 0.6403061224489796,
"repo_name": "JiscPER/jper",
"id": "a659421695ed3209acbfbc67d872174256c7258e",
"size": "1569",
"binary": fals... |
from random import randrange, shuffle
get_alpha = lambda: chr(randrange(97, 123))
get_word = lambda: ''.join([get_alpha() for i in range(randrange(4, 10))])
get_article = lambda: ' '.join([' '.join([get_word()] * randrange(10))
for i in range(randrange(2000, 3000))])
def get_words():
words = get_article... | {
"content_hash": "89e77c2ec21206bd1eaa18892f9cccf0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 21.58823529411765,
"alnum_prop": 0.6403269754768393,
"repo_name": "phyng/c-lang",
"id": "1ec14e3658eeb4de6097f9c84f0716c99702833c",
"size": "368",
... |
import six
from six.moves import range
from webob import exc
from nova import context
from nova import exception
from nova.i18n import _
from nova import objects
from nova import utils
CHUNKS = 4
CHUNK_LENGTH = 255
MAX_SIZE = CHUNKS * CHUNK_LENGTH
def extract_password(instance):
result = ''
sys_meta = util... | {
"content_hash": "38d7e35ccf645d5670bd3b6e19e23acd",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 79,
"avg_line_length": 32.15151515151515,
"alnum_prop": 0.6357210179076344,
"repo_name": "gooddata/openstack-nova",
"id": "c906de78908c479288bf20b19477fca0c752ab61",
"size"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# Module API
from .enum import check_enum
from .maximum import check_maximum
from .maxLength import check_maxLength
from .minimum import check_minimum
from .minLength i... | {
"content_hash": "766275695f40b516c88bf07285726a4a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 39,
"avg_line_length": 27.9375,
"alnum_prop": 0.7986577181208053,
"repo_name": "okfn/json-table-schema-py",
"id": "5854d663b216421c30284b30a840097b8fc105bc",
"size": "471",... |
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
os.sys.path.insert(0, parentdir)
from pybullet_envs.bullet.kukaCamGymEnv import KukaCamGymEnv
import time
def main():
environment = KukaCamGymEnv(rende... | {
"content_hash": "67b2e1b46023003c99a2fa2b3a32e057",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 86,
"avg_line_length": 36.375,
"alnum_prop": 0.7312714776632302,
"repo_name": "MTASZTAKI/ApertusVR",
"id": "6cf9909cb2953d0ab85fda760cf3ab617398ef8b",
"size": "1552",
"bi... |
"""
39. Testing using the Test Client
The test client is a class that can act like a simple
browser for testing purposes.
It allows the user to compose GET and POST requests, and
obtain the response that the server gave to those requests.
The server Response objects are annotated with the details
of the contexts and ... | {
"content_hash": "6216dfef691e7af10aa82778de6f9e7f",
"timestamp": "",
"source": "github",
"line_count": 507,
"max_line_length": 148,
"avg_line_length": 44.44181459566075,
"alnum_prop": 0.6615924019172732,
"repo_name": "vsajip/django",
"id": "1d9c999f21b0c0bc6279a5cca1a712c16f7f25bb",
"size": "22548... |
from __future__ import unicode_literals
import os
from django.core.wsgi import get_wsgi_application
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process,... | {
"content_hash": "35928ef686b573b72d4d4229717e873e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 78,
"avg_line_length": 45.86666666666667,
"alnum_prop": 0.7834302325581395,
"repo_name": "Swappsco/koalixerp",
"id": "dd179b1aa72659606dd4d3a6f97c8b28731107cb",
"size": "68... |
"""
The :mod:`sklearn.feature_extraction.text` submodule gathers utilities to
build feature vectors from text documents.
"""
from __future__ import unicode_literals
import array
from collections import Mapping, defaultdict
import numbers
from operator import itemgetter
import re
import unicodedata
import numpy as np
... | {
"content_hash": "6e55c7317190b2e2e0444240f304b4c3",
"timestamp": "",
"source": "github",
"line_count": 1254,
"max_line_length": 79,
"avg_line_length": 37.91866028708134,
"alnum_prop": 0.6154574132492113,
"repo_name": "RPGOne/Skynet",
"id": "d5590f06040672f581c38aec49ba5e6220c0b20a",
"size": "47905... |
from .base import *
from .fields import *
from .serializer_fields import *
from .time_fields import *
| {
"content_hash": "63ce6452b841a16e6b9d923772da3169",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 32,
"avg_line_length": 25.5,
"alnum_prop": 0.7450980392156863,
"repo_name": "onyg/aserializer",
"id": "0fbaa4ed4ee79a7fd35f9b7cad192a934236f9ee",
"size": "127",
"binary": ... |
'''
This module defines :class:`Segment`, a container for data sharing a common
time basis.
:class:`Segment` derives from :class:`Container`,
from :module:`neo.core.container`.
'''
from datetime import datetime
import numpy as np
from copy import deepcopy
from neo.core.container import Container
from neo.core.spik... | {
"content_hash": "ac66ab4f3c55ddad75f67d3b6a5336ad",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 99,
"avg_line_length": 37.24267782426778,
"alnum_prop": 0.5697112683968093,
"repo_name": "apdavison/python-neo",
"id": "db0004496092370b94ffc305f85bb85f0bf89929",
"size": ... |
""" GENERATED FILE. ALL CHANGES WILL BE OVERWRITTEN! """
from django import forms
from django.contrib.formtools.wizard.views import SessionWizardView
from cuescience_shop.models import {% for step in wizard.steps %}{%if step.form.model%}{%if not loop.first %}, {%endif%}{{step.form.model}}{%endif%}{%endfor%}
{% for step... | {
"content_hash": "4f8187cc8e98ce3afe4065688ec5e380",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 198,
"avg_line_length": 62.266666666666666,
"alnum_prop": 0.6274089935760171,
"repo_name": "cuescience/cuescience-shop",
"id": "4e179d3bd5d24521aa671468a7243b106fccdd1e",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('semesterpage', '0027_options_last_user_modification'),
]
operations = [
migrations.AlterField(
model_name='semester',
name='... | {
"content_hash": "2cec7fa10a4a96b1dcb7349c59b804c5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 323,
"avg_line_length": 49.285714285714285,
"alnum_prop": 0.6891304347826087,
"repo_name": "afriestad/WikiLinks",
"id": "2da07cbe1bf7c6480ca98f557013ee5fda183801",
"size": ... |
from storage import *
| {
"content_hash": "a230ab26b1fb333866db58bf64f1ee9e",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.7727272727272727,
"repo_name": "agniveshadhikari/edx-agea",
"id": "02d16cd1fc18fa425edb62be922fe0c6852fd449",
"size": "22",
"bin... |
"""Add ``root_dag_id`` to ``DAG``
Revision ID: b3b105409875
Revises: d38e04c12aa2
Create Date: 2019-09-28 23:20:01.744775
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
from airflow.migrations.db_types import StringID
# revision identifiers, used by Alembic.
revision = 'b3b10... | {
"content_hash": "e5a4512de8917915ffe5f50420a795cf",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 77,
"avg_line_length": 25.28125,
"alnum_prop": 0.6736711990111248,
"repo_name": "cfei18/incubator-airflow",
"id": "571338cf85f2cb316c6c049a50bf5c3a9edf2353",
"size": "1596"... |
"""Support for Home Assistant iOS app sensors."""
from homeassistant.components import ios
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.icon import icon_for_battery_level
DEPENDENCIES = ['ios']
SENSOR_TYPES = {
'level': ['Battery Level', '%'],
'state': ['Battery State', None]
}
... | {
"content_hash": "0d0b5a45f5a22818618dfa643da06e0a",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 78,
"avg_line_length": 36.15126050420168,
"alnum_prop": 0.6059972105997211,
"repo_name": "HydrelioxGitHub/home-assistant",
"id": "404b313368cebe42b64c97f9f66c9db6152ac9e8",
... |
from collections import deque;
if __name__ == "__main__":
queue = deque()
print (queue)
queue.append(2)
queue.append(4)
queue.append(6)
print (queue)
queue.popleft()
print (queue)
queue.pop()
print (queue) | {
"content_hash": "026a0455cc2e53a14e9da0b2fb2ab52a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 30,
"avg_line_length": 13.944444444444445,
"alnum_prop": 0.5657370517928287,
"repo_name": "cprakashagr/PythonClass",
"id": "a59cfc2890a23ed6898f2f13c8d363941190eb9b",
"size... |
from distutils.core import setup
from pyql import __author__, __version__, __email__, __license__, __maintainer__
short_description = 'YQL Queries and Yahoo Weather in Python v.%s' % __version__
try:
long_description = open('README.md').read()
except:
long_description = "YQL Queries and Yahoo Weather in Pyth... | {
"content_hash": "79d567c1d0f1f5449b8dc644cf9058ea",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 83,
"avg_line_length": 42.26190476190476,
"alnum_prop": 0.540281690140845,
"repo_name": "alexdzul/pyql-weather",
"id": "0acc91a884190a920219e44376a146e5d6569e69",
"size": "... |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLIST,... | {
"content_hash": "b2a4c6e9bcc0ae6fb08161ef3dca80d6",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 197,
"avg_line_length": 51.35647279549718,
"alnum_prop": 0.5026851276805612,
"repo_name": "111pontes/ydk-py",
"id": "67031c064833cf2e367b44ce94fecabff8c388ef",
"size": "27... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payments', '0005_auto_20170919_1621'),
]
operations = [
migrations.AlterModelOptions(
name='orderpayment',
options={'permiss... | {
"content_hash": "ca8fcb2f0664602e82de92caf8a2001d",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 393,
"avg_line_length": 54,
"alnum_prop": 0.6051373954599761,
"repo_name": "onepercentclub/bluebottle",
"id": "7be70c79239d4edca99502580f62a2c85c4bc813",
"size": "1747",
... |
"""
Python API for B2FIND.
Retrieve dataset info by given search criteria using CKAN portal
"""
__author__ = 'Roberto Mucci (r.mucci@cineca.it)'
import json
import requests
import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def e... | {
"content_hash": "dbe94ebc9bb71c5acae5e024dc4f08d7",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 82,
"avg_line_length": 31.20408163265306,
"alnum_prop": 0.5955962502725093,
"repo_name": "EUDAT-B2STAGE/EUDAT-Library",
"id": "af4ae2fd101204399a7ce238f06e7861b451b281",
"... |
"""
Known Issues:
-------------
- GlyphLineView does not properly handle fonts that are not saved to a file.
this is because there is not good way to find the font index for a given font
and the preview control requires a font index. so, the best thing i can
do at this point is get the font index by comparing fil... | {
"content_hash": "27fd2205c60f849f137efe6328d8406d",
"timestamp": "",
"source": "github",
"line_count": 730,
"max_line_length": 157,
"avg_line_length": 29.980821917808218,
"alnum_prop": 0.5673032989125468,
"repo_name": "anthrotype/dialogKit",
"id": "69210672d792ef78e059e29a69ed1cfacb9829c8",
"size"... |
from __future__ import print_function
import base64
import hashlib
import hmac
import json
import sys
import time
import datetime
import urllib
import urllib2
from socket import error as SocketError
import errno
class VDCApiCall(object):
"""
Class for making signed API calls to the Interoute VDC.
"""
... | {
"content_hash": "f87021cffe0b7483a890198208c83ef3",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 127,
"avg_line_length": 35.32824427480916,
"alnum_prop": 0.5252808988764045,
"repo_name": "Interoute/API-fun-and-education",
"id": "ad76f2465e86839564a5dffe15e6233613143ab7"... |
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.utils.domutils
from xml.dom import Node
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name... | {
"content_hash": "274112b597e0b4b667a2d36d09543c6a",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 60,
"avg_line_length": 25.29126213592233,
"alnum_prop": 0.5930902111324377,
"repo_name": "pabigot/pyxb",
"id": "b572edcab86a10428f592bb1a10c4b0d850495ea",
"size": "2629",
... |
""" Defines the MoveTool class.
"""
# Enthought library imports
from traits.api import Tuple
from enable.tools.drag_tool import DragTool
class MoveTool(DragTool):
""" A tool for moving a plot component.
"""
# The (x,y) offset of the start of the drag relative to the component.
_offset = Tuple((0,0))
... | {
"content_hash": "353ccb1141421d7eacfcfbb8ec027fa2",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 79,
"avg_line_length": 30.26829268292683,
"alnum_prop": 0.5954875100725222,
"repo_name": "burnpanck/chaco",
"id": "5dfe0ed72670b1c4b1afa0592d01086c49166749",
"size": "1241"... |
import subprocess
import datetime
from custom_logger import get_logger
import sys
__author__ = 'cenk'
logger = get_logger()
def daily_rollup(args):
keyspace = args[1]
now = datetime.datetime.now()
end_time = datetime.datetime(now.year, now.month, now.day, now.hour, 00)
end_time = int(end_time.strft... | {
"content_hash": "516d736fe3cd10cf83e1bf55f4356186",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 118,
"avg_line_length": 34.588235294117645,
"alnum_prop": 0.6445578231292517,
"repo_name": "egemsoft/cassandra-spark-rollup",
"id": "0f442f94afed419104695863467ec400614d7576"... |
from flask.templating import render_template, render_template_string
import logging
from waitlist import permissions
from typing import List, Optional, Dict, Union, Any
from flask_babel import lazy_gettext
from flask_login.utils import current_user
logger = logging.getLogger(__name__)
class OrderedItem(object):
... | {
"content_hash": "5505e85d6741cad42244d377c2b18320",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 97,
"avg_line_length": 35.75819672131148,
"alnum_prop": 0.576160458452722,
"repo_name": "SpeedProg/eve-inc-waitlist",
"id": "ffbfdb44482802c14fb25a3a1f0484fdb177b8b9",
"si... |
"""Constant values for pvpc_hourly_pricing."""
DOMAIN = "pvpc_hourly_pricing"
PLATFORMS = ["sensor"]
ATTR_POWER = "power"
ATTR_POWER_P3 = "power_p3"
ATTR_TARIFF = "tariff"
DEFAULT_NAME = "PVPC"
| {
"content_hash": "1a2af67dc29b02ee166c3946b6865c51",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 46,
"avg_line_length": 27.714285714285715,
"alnum_prop": 0.6958762886597938,
"repo_name": "aronsky/home-assistant",
"id": "ad97124c33089e1cfcc32ba745a3fef67074c3f7",
"size":... |
"""Errors used in the urlfetch API
developers.
"""
class Error(Exception):
"""Base URL fetcher error type."""
class DownloadError(Error):
"""Raised when we could not fetch the URL for any reason.
Note that this exception is only raised when we cannot contact the
server. HTTP errors (e.g., 404) ar... | {
"content_hash": "7d1d473ca455ca4e713eb5ec94b8981a",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 25.114942528735632,
"alnum_prop": 0.7423340961098398,
"repo_name": "zlsun/XX-Net",
"id": "df4d80a5f991508f9ceacc6438f790ded5d625c3",
"size": "2789",
... |
from django.contrib import admin
from accounts.models import TodoUser
admin.site.register(TodoUser)
| {
"content_hash": "1e412596e864fb97246af6209369ace8",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 36,
"avg_line_length": 20.4,
"alnum_prop": 0.8333333333333334,
"repo_name": "hirune525/todolist",
"id": "0db25aa1c5323d67f082140e4464bf1cc3705122",
"size": "125",
"binary"... |
response.logo = A('nStock',
_class="navbar-brand", _href=URL('default', 'index'),
_id="web2py-logo")
response.title = request.application.replace('_', ' ').title()
response.subtitle = ''
# ----------------------------------------------------------------------------------------------... | {
"content_hash": "2d9ca3389ba26d8ed5b4515fa08ca980",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 120,
"avg_line_length": 45.19298245614035,
"alnum_prop": 0.42274844720496896,
"repo_name": "ybenitezf/nstock",
"id": "b91aa70afdc086155aae1c324c80b2de73829a88",
"size": "8... |
"""Run and parse output from FastQC.
http://www.bioinformatics.babraham.ac.uk/projects/fastqc/
"""
import os
import shutil
import pandas as pd
try:
from fadapa import Fadapa
except ImportError:
Fadapa = None
from bcbio import bam, utils
from bcbio.distributed.transaction import tx_tmpdir
from bcbio.log impor... | {
"content_hash": "351b5ef3f3fd66c8163df466be1741f4",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 125,
"avg_line_length": 45,
"alnum_prop": 0.5563786008230452,
"repo_name": "lbeltrame/bcbio-nextgen",
"id": "f4a798c74ae06b4365aa92d7e8b7cffb020945e6",
"size": "6075",
"... |
"""This code example gets all child ad units of the effective root ad unit.
To create ad units, run create_ad_units.py
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authen... | {
"content_hash": "0f495be610766e4638c10a5baf407e76",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 78,
"avg_line_length": 31.25,
"alnum_prop": 0.6811428571428572,
"repo_name": "dietrichc/streamline-ppc-reports",
"id": "241907a191c2406029cfd623dfae0aa3dd54127d",
"size": "... |
import tests_query_eval
import test_query_files
| {
"content_hash": "171d63c170e0f1f686651523eed8d6d3",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 23,
"avg_line_length": 24,
"alnum_prop": 0.8333333333333334,
"repo_name": "BRAINSia/tract_querier",
"id": "3956084250fce40eb75ba411bda75e93fa4427c1",
"size": "48",
"binary... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
from tensorflow.contrib import slim
def _crop(image, offset_height, offset_width, crop_height, crop_width):
original_shape = tf.sh... | {
"content_hash": "7bfa1df06f3c77e5e7f939e3bc1d8b04",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 101,
"avg_line_length": 37.067796610169495,
"alnum_prop": 0.6317634506934918,
"repo_name": "CharlesShang/FastMaskRCNN",
"id": "373e573f9ae3ae1860e39743d41c59d8788ab40f",
"... |
from flask import current_app, escape
import redis
# Connect to redis. This is run only when this file is loaded; as
# long as the pod is alive, the connection is reused.
redisConnection = redis.StrictRedis(host='redis.guestbook', port=6379, db=0)
def main():
messages = redisConnection.lrange('guestbook', 0, -1)... | {
"content_hash": "b05c18c8fe5356fd19694dd6ec40fb27",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 34.47826086956522,
"alnum_prop": 0.5825977301387137,
"repo_name": "life1347/fission",
"id": "a95016b4fe0d687cfce0f36d87f4dabd25c7aefc",
"size": "894"... |
"""Podcache core extension."""
from grow import extensions
from grow.cache import podcache
from grow.collections import collection
from grow.extensions import hooks
class PodcacheDevFileChangeHook(hooks.DevFileChangeHook):
"""Handle the dev file change hook."""
# pylint: disable=arguments-differ
def tri... | {
"content_hash": "35c6a5add663a55309b1ce9772d8f6bb",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 85,
"avg_line_length": 36.883720930232556,
"alnum_prop": 0.667717528373266,
"repo_name": "grow/pygrow",
"id": "78c337c14fa9df65631d58250504dd0099347a17",
"size": "1586",
... |
"""Wildcard parsing."""
from __future__ import annotations
import re
import functools
import bracex
import os
from . import util
from . import posix
from . _wcmatch import WcRegexp
from typing import AnyStr, Iterable, Pattern, Generic, Optional, Sequence, overload, cast
UNICODE_RANGE = '\u0000-\U0010ffff'
ASCII_RANGE ... | {
"content_hash": "b88ea4ebb4aa37100922df17fadd2dba",
"timestamp": "",
"source": "github",
"line_count": 1686,
"max_line_length": 119,
"avg_line_length": 33.1773428232503,
"alnum_prop": 0.5040670754598924,
"repo_name": "facelessuser/wcmatch",
"id": "05912d1533964f9ded3d3fabed249642731b88b2",
"size":... |
"""AsyncIO support for zmq
Requires asyncio and Python 3.
"""
# Copyright (c) PyZMQ Developers.
# Distributed under the terms of the Modified BSD License.
# Derived from Python 3.5.1 selectors._BaseSelectorImpl, used under PSF License
from collections import Mapping
import zmq as _zmq
from zmq.eventloop import futu... | {
"content_hash": "016e52a09282c395e5bca2c9eeb939d5",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 89,
"avg_line_length": 28.92192192192192,
"alnum_prop": 0.5859204651645727,
"repo_name": "fzheng/codejam",
"id": "9e5eaf1c598258fbf9b81cfb240dd6d981d233b5",
"size": "9631"... |
from c7n_azure.provider import resources
from c7n_azure.resources.arm import ArmResourceManager
from c7n.filters.core import ValueFilter, type_schema
@resources.register('webapp')
class WebApp(ArmResourceManager):
"""Web Applications Resource
:example:
This policy will find all web apps with 10 or less... | {
"content_hash": "9940fa5afe16806421d7715bd491d804",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 93,
"avg_line_length": 28.148936170212767,
"alnum_prop": 0.5570672713529856,
"repo_name": "capitalone/cloud-custodian",
"id": "9ef8d630ad4dc17cb618a08999b965188b8c2b41",
"s... |
import subprocess
from . import base
class Cmus(base.ThreadPoolText):
"""A simple Cmus widget.
Show the artist and album of now listening song and allow basic mouse
control from the bar:
- toggle pause (or play if stopped) on left click;
- skip forward in playlist on scroll up;
... | {
"content_hash": "579e4f3a06686afa38c34d18356f171b",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 34.45762711864407,
"alnum_prop": 0.4955730447614363,
"repo_name": "soulchainer/qtile",
"id": "c032527882795073e04d65a41077c7a1ca4ca8c3",
"size": "47... |
'''
Add the hubble version to the grains
'''
import logging
from hubblestack import __version__
log = logging.getLogger(__name__)
def hubble_version():
'''
Add the hubble version to the grains
'''
return {'hubble_version': __version__}
| {
"content_hash": "f0a94036e1b41a1b16e74dad1cae2333",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 42,
"avg_line_length": 17.066666666666666,
"alnum_prop": 0.6484375,
"repo_name": "HubbleStack/Hubble",
"id": "00a7f89a43a66b799402e4b50b5b5e26e7e39749",
"size": "280",
"b... |
full_name = input('Enter your name: ')
list_of_names = full_name.split()
for index, name in enumerate(list_of_names):
if name[0].islower():
del list_of_names[index]
[print(name[0] + '.', end='') for name in list_of_names] | {
"content_hash": "11245836f7609bc7be4be436d6561318",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 56,
"avg_line_length": 26.22222222222222,
"alnum_prop": 0.635593220338983,
"repo_name": "KristianMariyanov/PythonPlayground",
"id": "e72ec34e3a022adb7b09798e5d484568e2b533e9",... |
"""
module for generating C, C++, Fortran77, Fortran90 and python routines that
evaluate sympy expressions. This module is work in progress. Only the
milestones with a '+' character in the list below have been completed.
--- How is sympy.utilities.codegen different from sympy.printing.ccode? ---
We considered the id... | {
"content_hash": "27031568e1f0c04f530a81b8be92ba32",
"timestamp": "",
"source": "github",
"line_count": 955,
"max_line_length": 109,
"avg_line_length": 36.27225130890052,
"alnum_prop": 0.6032332563510393,
"repo_name": "pernici/sympy",
"id": "801e5aa10b03b0582235b4b528cb83bb5a1cf466",
"size": "34640... |
"""
WSGI config for {{ project_name }} project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
from __future__ import unicode_literals
import os
os.environ.setdefault("DJANGO_SETTIN... | {
"content_hash": "69d4f4b9a680e9f94e9917693a806e64",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 83,
"avg_line_length": 30.4,
"alnum_prop": 0.7543859649122807,
"repo_name": "rkorkosz/django-base-template",
"id": "d29b619238362cf4ef4e7b3ab34ba96589f39d52",
"size": "456"... |
import argparse
import sys
import os
def write_header(fh, key, value):
fh.write("#" + key + "\t" + value + "\n")
# Argument handling
parser = argparse.ArgumentParser( description='Convert ONT model file into nanopolish format')
parser.add_argument('-i', '--input', type=str, required=True)
parser.add_argument('-o'... | {
"content_hash": "8948bba70863bde4495a42e8ce3b02e4",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 94,
"avg_line_length": 28.262295081967213,
"alnum_prop": 0.6519721577726219,
"repo_name": "mateidavid/nanopolish",
"id": "d39366543bf3d023443c3185742476c7e0e988f5",
"size":... |
from ._shared import InvalidArgs
from .Log import Log
from .Aide import Aide
from .Alias import Alias
from .Budget import Budget
from .Camera import Camera
from .Courses import Courses
from .Dis import Dis
from .Disclaimer import Disclaimer
from .Emprunt import Emprunt
from .Historique import Historique
from .Info impo... | {
"content_hash": "3c89fdd24cd70561bdd87d905ec96578",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 36,
"avg_line_length": 19.91111111111111,
"alnum_prop": 0.6774553571428571,
"repo_name": "hackEns/Jarvis",
"id": "e1bb1b8f04b3ce374408cbc63afc3b5710eb518c",
"size": "896",
... |
from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.tree import DecisionTree
from pyspark import SparkConf, SparkContext
from numpy import array
# Boilerplate Spark stuff:
conf = SparkConf().setMaster("local").setAppName("SparkDecisionTree")
sc = SparkContext(conf = conf)
# Some functions th... | {
"content_hash": "2814ee933c4bf73131f7a94d4bba7f31",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 82,
"avg_line_length": 36.48684210526316,
"alnum_prop": 0.6887847097006852,
"repo_name": "yevheniyc/C",
"id": "d507587cf786312934f334025dbd3608839ff41c",
"size": "2773",
... |
'''
..
Red9 Studio Pack: Maya Pipeline Solutions
Author: Mark Jackson
email: rednineinfo@gmail.com
Red9 blog : http://red9-consultancy.blogspot.co.uk/
MarkJ blog: http://markj3d.blogspot.co.uk
This is the General library of utils used throughout the modules
These are abstract gene... | {
"content_hash": "b1d567aaacb1786c2aa6a9a1ac725504",
"timestamp": "",
"source": "github",
"line_count": 924,
"max_line_length": 142,
"avg_line_length": 36.41558441558441,
"alnum_prop": 0.5874940561103186,
"repo_name": "Free3Dee/Red9_StudioPack",
"id": "392b04efc54f35f45ad21944fcdda72f1f0a0e17",
"si... |
from Event import PictureEvent, LightEvent, FeedEvent
import datetime
names = ['Feed','Light','Take picture']
events = []
enabled = True
idcounter = 0
today = datetime.datetime.today().date()
def createEvent(type):
if type == 0:
return FeedEvent()
elif type == 1:
return LightEvent()
elif type == 2:
return ... | {
"content_hash": "adcd20d29d3c94bfbb176b0323c5ce73",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 58,
"avg_line_length": 23.197916666666668,
"alnum_prop": 0.6834306241580602,
"repo_name": "marian42/fishtank",
"id": "235df5952a332c9bc68f2af5187755d8868655ae",
"size": "22... |
from gitlint.tests.base import BaseTestCase
from gitlint.rules import Rule, RuleViolation
class RuleTests(BaseTestCase):
def test_rule_equality(self):
self.assertEqual(Rule(), Rule())
# Ensure rules are not equal if they differ on their attributes
for attr in ["id", "name", "target", "opti... | {
"content_hash": "970e600dfa02053a565d76890a8eddee",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 91,
"avg_line_length": 38.523809523809526,
"alnum_prop": 0.6341161928306551,
"repo_name": "jorisroovers/gitlint",
"id": "199cc7e55308be7703f8f4099f6f7bdd42693076",
"size": ... |
"""
===============================
Test for qplotutils.chart.items
===============================
Autogenerated package stub.
"""
import unittest
import logging
import sys
import os
import numpy as np
from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtOpenGL import *
from qtpy.QtWidgets import *
from... | {
"content_hash": "9179210f623da6c54fe5b5082864d63a",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 63,
"avg_line_length": 20.54696132596685,
"alnum_prop": 0.5598279107286905,
"repo_name": "unrza72/qplotutils",
"id": "f4755959cb4d0dc71a15a54d8e07bb2bae6487c8",
"size": "3... |
"""
Description: Round-trip example. This script takes a STIX instance document from XML to
a binding object, then to a api object and then to a dictionary. That dictionary is then
converted back into an api object, which is then used to generate an XML document.
"""
# stdlib
from pprint import pprint
# python-stix
fr... | {
"content_hash": "73f0e179c73205a42d99933eeff94cbf",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 88,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.7010416666666667,
"repo_name": "STIXProject/python-stix",
"id": "80989a03b6131b04cd144634a001cba63c396250",
"size... |
import argparse
import os
import shutil
import BasketGlobals as config
# SET THE BASE LOCATION
SERVER = config.serverDir()
LOCAL = config.rootDir()
# Basic 'Safe' Server Directory make
def make_dir(indir, loc=SERVER):
baseDir = os.path.join(loc, indir)
try:
if not os.path.isdir(baseDir):
... | {
"content_hash": "5557bcafd6b648d38d60c2ad226fa847",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 88,
"avg_line_length": 29.118181818181817,
"alnum_prop": 0.6134873556041212,
"repo_name": "Hartman-/Basket",
"id": "2a71edce467c0f06598bcd264d379efe95769462",
"size": "322... |
import re
from datetime import datetime
def handle_parse_exception(soup):
print '\nException parsing HTML.', \
'Probably contained something unexpected.', \
'Check unexpected_output.html'
with open('unexpected_output.html', 'wb') as output:
output.write(soup.prettify().encode('UTF-8... | {
"content_hash": "01a6de27a363a06feb8ff13eabe6e05a",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 80,
"avg_line_length": 33.670731707317074,
"alnum_prop": 0.5313292285403839,
"repo_name": "openva/attorney-analysis",
"id": "0f9a227e03d385121814aae8564b2d6cb05c635e",
"siz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.