text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Alembic CLI with simplified configuration.
Alembic is a terrific tool that makes some unfortunate choices about configuration,
expecting a verbose directory structure with several layers of configuration.
This module monkey patches Alembic's CLI tool to work better within a microcosm.
To use this entry enty poin... | {
"content_hash": "86c763522233620a23e9b9393a7b6a44",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 104,
"avg_line_length": 33.15584415584416,
"alnum_prop": 0.7050528789659224,
"repo_name": "globality-corp/microcosm-postgres",
"id": "61ab11a7247c300932dd1a0c0f931454eecd87c... |
import os
from os import path
from pathlib import Path
from ...exechelper import func_exec_run
from ...fileop import PosixFileSystem
from ....util import Utility
bwa = path.join(path.abspath(path.dirname(__file__)), path.join('bin', 'bwa'))
def build_bwa_index(ref):
cmdargs = ['index', ref]
return func_exec_... | {
"content_hash": "cca11eb7fc20bc56629507d0414da366",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 109,
"avg_line_length": 28.102272727272727,
"alnum_prop": 0.5830974524868581,
"repo_name": "mainulhossain/phenoproc",
"id": "d96fb1378a4b4ef7ee4438edf5f2a425f49737f6",
"siz... |
import os
import subprocess
import paramiko
import argparse
import json
# Manage the command line arguments
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--update', action='store_true', help='Update the application')
parser.add_argument('-b', '--build', action='store_true', help='If true, build applic... | {
"content_hash": "f1774a3b4a3b9379a7b53f79457a051c",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 125,
"avg_line_length": 28.13157894736842,
"alnum_prop": 0.6057062675397568,
"repo_name": "igio/webfaction-meteor",
"id": "152460c5cf031ec3ebf63d79a660c171e08a2503",
"size... |
import os, sys
from optparse import OptionParser
from configparser import ConfigParser
class Config():
#配置对象
__config = ""
#配置文件
__config_file = "Config.ini"
#初始化文件
def __init__(self, app_name=""):
#获取当前目录
cur_path = os.path.normpath(os.path.join(os.getcwd(), os.path.dirn... | {
"content_hash": "629e6c8d7da88810391757bc1ab76207",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 90,
"avg_line_length": 27.41176470588235,
"alnum_prop": 0.5221745350500715,
"repo_name": "lxy235/lserver",
"id": "3b2ad4b9a91617214222728bf0863897f7a784fc",
"size": "1582",... |
from zipfile import ZipFile
from scar.utils import FileUtils, SysUtils
def _extract_udocker_zip(supervisor_zip_path) -> None:
file_path = ""
with ZipFile(supervisor_zip_path) as thezip:
for file in thezip.namelist():
if file.endswith("udocker.zip"):
file_path = FileUtils.jo... | {
"content_hash": "5bdb3154b48dc2321bf004ce3b23251a",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 144,
"avg_line_length": 46,
"alnum_prop": 0.6224637681159421,
"repo_name": "grycap/scar",
"id": "17d486dcbe0202798461c812254dcda647894bd5",
"size": "3338",
"binary": fals... |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:18636")
pwd = raw_input("Enter old wallet passphrase: ")
pwd2 = raw_input("Enter new wallet passphrase: ")
access.walletpassphrasechange(pwd, pwd2)
| {
"content_hash": "eb017b6b158cf3bc6b98b62a6f3cabff",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 49,
"avg_line_length": 44.2,
"alnum_prop": 0.7601809954751131,
"repo_name": "DannyHex/Hexagon",
"id": "4c23380302db9c787adb794c6b7946ecbf10bf13",
"size": "221",
"binary": ... |
"""
Author: Diego da Hora
email: diego.da-hora@lip6.fr
Date: 23/06/2013
Updated by: Julio Adriazola
email: jcadriaz@uc.cl
Date: 15/02/2016
"""
import sqlalchemy, re, datetime, time
from sqlalchemy import Column, Integer, String, Float, BigInteger, TIMESTAMP
from sqlalchemy.ext.d... | {
"content_hash": "132f710df9dc6139573907149a59f64f",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 248,
"avg_line_length": 31.907894736842106,
"alnum_prop": 0.6240549828178694,
"repo_name": "inria-muse/hostview-processing",
"id": "089208dce717c9407f811ef59e544c173243cd6e"... |
import scrapy
import bs4
from google.cloud import storage
import os
import io
import re
from urllib import parse
BUCKET_NAME = 'cda-gazette-scraper'
REGS_FOLDER = 'regs'
class RegsSpider(scrapy.Spider):
name = "regs"
allowed_domains = ["www.gazette.gc.ca", "publications.gc.ca"]
def start_requests(self):... | {
"content_hash": "2280fb6853dac7ceddc6353c1aa1a177",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 133,
"avg_line_length": 45.83464566929134,
"alnum_prop": 0.5517952241882838,
"repo_name": "JasonMWhite/cda-gazette-scraper",
"id": "a22361218a1a465b501d04e44ac1c1c599b3f227"... |
"""freelance URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | {
"content_hash": "b75eff9f82bb1be416fa35f4bb6782ae",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 77,
"avg_line_length": 36.833333333333336,
"alnum_prop": 0.6877828054298643,
"repo_name": "halfnibble/django-intro",
"id": "cfd2b0892bcc850b50d6782f80695d454a5d9edc",
"size... |
import unittest
from oeqa.oetest import oeRuntimeTest, skipModule
from oeqa.utils.decorators import *
def setUpModule():
if not oeRuntimeTest.hasPackage("pax-utils"):
skipModule("pax-utils package not installed")
class ScanelfTest(oeRuntimeTest):
def setUp(self):
self.scancmd = 'scanelf --qui... | {
"content_hash": "c64ef65dc7b44f993cf00741203b60b2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 79,
"avg_line_length": 35.23076923076923,
"alnum_prop": 0.6561135371179039,
"repo_name": "marcosbontempo/inatelos",
"id": "b9abf24640ff22ac7e1b69a3d5d0e9fac53b58bd",
"size"... |
from __future__ import absolute_import
import logging
# App must be initialized before models or ADDONS_AVAILABLE are available
from website.app import init_app
init_app()
from osf.models import OSFUser, AbstractNode
from framework.database import paginated
from scripts.analytics.base import SnapshotAnalytics
from w... | {
"content_hash": "f2618fee72922757c8944c784e6043b4",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 181,
"avg_line_length": 41.65413533834587,
"alnum_prop": 0.6108303249097473,
"repo_name": "icereval/osf.io",
"id": "1df5b81fbeb325b31c3f7555c587477a13d7a795",
"size": "554... |
from hashlib import md5
from Crypto import Random
from Crypto.Cipher import AES
def _chr(i):
if isinstance(i, bytes):
return i # FIXME why is it mixed in python 2 ?
return chr(i).encode('utf-8')
def _derive_key_and_iv(password, salt, key_length, iv_length):
d = d_i = b''
while len(d) < key_... | {
"content_hash": "342bb6d566680c2230f330f60377f136",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 79,
"avg_line_length": 32.0377358490566,
"alnum_prop": 0.6195524146054181,
"repo_name": "littleskunk/storjcore",
"id": "adc8c245d9bced32a47a4aaf9fa831f0946cea76",
"size": ... |
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from payex import __version__
def publish():
"""Publish to Pypi"""
os.system("python setup.py sdist upload")
if sys.argv[-1] == "publish":
publish()
sys.exit()
# Requirements
install_... | {
"content_hash": "582d4edcad0a6ac52c89df7fc9001209",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 72,
"avg_line_length": 24.645833333333332,
"alnum_prop": 0.6306001690617076,
"repo_name": "funkbit/pypayex",
"id": "38a9f7df5efa6f982b4827a684332dbb4ebf3fce",
"size": "1205... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import errno
import logging
import os
import six
import subprocess
import warnings
from future import standard_library
standard_library.install_aliases()
fr... | {
"content_hash": "ef92ab169c63710a2ce19ce23f3b076e",
"timestamp": "",
"source": "github",
"line_count": 776,
"max_line_length": 79,
"avg_line_length": 31.362113402061855,
"alnum_prop": 0.6813493857090027,
"repo_name": "jbhsieh/incubator-airflow",
"id": "ad8b3e382386f427da5d2edb5e1923e5ce9784a0",
"s... |
'''
@author: MengLai
'''
import os
import tempfile
import uuid
import time
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstacklib.utils.ssh as ssh
import zstackwoodpecker.operations.scenario_operations ... | {
"content_hash": "472a15fbcad232072665ceed0b71b401",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 74,
"avg_line_length": 34.59375,
"alnum_prop": 0.6806684733514001,
"repo_name": "zstackio/zstack-woodpecker",
"id": "dc0eadb9422146857f8f9517fd6171ab9ea64c63",
"size": "221... |
from unittest import TestCase
import numpy as np
from scattertext.termranking import AbsoluteFrequencyRanker
from scattertext.termranking import DocLengthDividedFrequencyRanker
from scattertext.termranking import DocLengthNormalizedFrequencyRanker
from scattertext.termranking.OncePerDocFrequencyRanker import OncePerD... | {
"content_hash": "f26b4f8ca3a9f9c7e7a45b234e4a0e3c",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 87,
"avg_line_length": 43.278688524590166,
"alnum_prop": 0.6772727272727272,
"repo_name": "JasonKessler/scattertext",
"id": "dc86ff900632e0abf3da2cb50baa4bebf56a5d47",
"siz... |
from flask import Flask
from flask.ext.socketio import SocketIO
import redis
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('config.py')
redis_db = redis.StrictRedis(host=app.config['REDIS_SERVER'],
port=app.config['REDIS_PORT'],
db=ap... | {
"content_hash": "5735a3ab70cad1272f4139d05d87f2ec",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 27.6,
"alnum_prop": 0.6376811594202898,
"repo_name": "Belekkk/Presentations",
"id": "d4322e85d2c90690c7daa80b1eefdad89f8416db",
"size": "414",
"bin... |
from .spinner_asynicio import main | {
"content_hash": "c25554e753faca49399f3faf801699c5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 34,
"avg_line_length": 34,
"alnum_prop": 0.8529411764705882,
"repo_name": "kissf-lu/jupyter_app",
"id": "24f196cf46527de9f355bd6fc7b4038a24f91309",
"size": "34",
"binary":... |
import tempfile
import shutil
import os
from voltgrid import ConfigManager
VG_CFG = os.path.join(os.path.abspath(os.path.split(__file__)[0]), 'voltgrid.conf')
def test_config_manager():
c = ConfigManager(VG_CFG)
c.write_envs()
def test_config_is_empty():
with tempfile.NamedTemporaryFile() as tmp_f:
... | {
"content_hash": "744bb413801104e10185dc9fea08eca6",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 83,
"avg_line_length": 24.375,
"alnum_prop": 0.6418803418803419,
"repo_name": "voltgrid/voltgrid-pie",
"id": "d5dce222f13896687f9b41b417782ef8b3daa9a8",
"size": "1170",
"... |
import numpy as np
import sklearn.cross_validation as skl_cross_validation
from Orange.data import Table, Domain, ContinuousVariable, DiscreteVariable
__all__ = ["Results", "CrossValidation", "LeaveOneOut", "TestOnTrainingData",
"ShuffleSplit", "TestOnTestData", "sample"]
class Results:
"""
Clas... | {
"content_hash": "2c6975753969bfd2810a23a6c3411648",
"timestamp": "",
"source": "github",
"line_count": 611,
"max_line_length": 120,
"avg_line_length": 40.122749590834694,
"alnum_prop": 0.573648786457271,
"repo_name": "kwikadi/orange3",
"id": "9961d810740c7b8026bd978e71f7428a4421ee33",
"size": "245... |
"""
Handle objects from this module relevant to a Contact or a User
"""
from treeio.core.models import Object
from treeio.projects.templatetags.projects import projects_task_list
CONTACT_OBJECTS = {}
CONTACT_OBJECTS['manager'] = {'label': 'Managed Projects',
'objects': [],
... | {
"content_hash": "a86a12b06c384e0d888ea59c8daeef3b",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 71,
"avg_line_length": 32.03174603174603,
"alnum_prop": 0.5555004955401388,
"repo_name": "nuwainfo/treeio",
"id": "316404e3ae966766e4269835c51554fe357e988c",
"size": "2131"... |
from os.path import isdir, dirname, abspath
from os import getcwd
from inspect import currentframe, getfile, getsourcefile
from sys import getfilesystemencoding, stdout
from collections import OrderedDict, defaultdict
import datetime, re
import pytz
import warnings
import numpy as np
import pandas as pd
import networkx... | {
"content_hash": "8f7703a7576fe89362f4ea216a3fd302",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 105,
"avg_line_length": 28.095969289827256,
"alnum_prop": 0.5865555403743681,
"repo_name": "nilmtk/nilmtk",
"id": "b70b40b9d4fcf37805dcf67fd115b32258a15bfe",
"size": "1463... |
import logging
logging.basicConfig(level=logging.INFO)
import time
import multiprocessing as mp
from random import choice, uniform
import logstats
def important_task(stats):
logstats.thread.start(stats)
while True:
stats[choice(['A', 'B', 'C'])] += 1
time.sleep(uniform(0, 0.2))
if __name_... | {
"content_hash": "7c32019512ba9e67c93bfd3ae2576d5c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 20.72,
"alnum_prop": 0.640926640926641,
"repo_name": "vrde/logstats",
"id": "3a17166ccedbbe88554623675d053aa0ba783386",
"size": "518",
"binary": fa... |
__author__ = 'mmoisen'
import sys
import time
import os
from models import Probe
from datetime import datetime
import logging
LOG_FILENAME = 'ds18b20.log'
logger = logging.getLogger('test_ds18b20')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(LOG_FILENAME)
formatter = logging.Formatter('%(asctime)s ... | {
"content_hash": "c50482e211b8af24b8347a38d0a69e52",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 114,
"avg_line_length": 29.51063829787234,
"alnum_prop": 0.6286950252343186,
"repo_name": "mkmoisen/brew",
"id": "510f2dda2b2ddee81ee8a8feb13caaa412113e5b",
"size": "1387",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('useraudit', '0003_auto_20160406_1434'),
]
operations = [
migrations.AlterField(
model_name='failedloginlog',
name='user_agen... | {
"content_hash": "4064f0b810d2289c6c5db9bb04f45407",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 75,
"avg_line_length": 26.130434782608695,
"alnum_prop": 0.5906821963394343,
"repo_name": "muccg/django-useraudit",
"id": "1d0ced47a484e3198292ed09450c7071b1f11ede",
"size"... |
from typing import Dict
from datadog_checks.base import AgentCheck
ALLOWED_RESOURCES_FOR_FILTERS = ['database', 'forest', 'host', 'server']
BASE_ENDPOINT = '/manage/v2'
RESOURCE_TYPES = {
'cluster': {'plural': 'clusters', 'singular': 'cluster', 'tag_name': 'cluster_name'},
'clusters': {'plural': 'clusters',... | {
"content_hash": "af0c81e552ee61c0302b33ca48aef520",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 94,
"avg_line_length": 38.851851851851855,
"alnum_prop": 0.6120114394661582,
"repo_name": "DataDog/integrations-core",
"id": "0d46a7a0590b8d97c0adaa9ae8ec526c42d1304a",
"si... |
import os
import sys
import subprocess
import sets
import datetime
import argparse # requires Python 2.7
def indentLevel(line):
i = 0
while i < len(line) and line[i] == ' ':
i = i + 1
return i
class ParseTrace:
#
def __init__(self, OptimizerTraceFileName):
self.OptimizerTrace... | {
"content_hash": "97cebb7d5857ce03b2b39198f672aa36",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 119,
"avg_line_length": 36.26011560693642,
"alnum_prop": 0.46468994101705724,
"repo_name": "apache/incubator-trafodion",
"id": "f2b0268ba89ee06a4c674d4a3dda72472d96ef65",
... |
#import pycuda.autoinit
import pycuda.driver as drv
import numpy as np
import math
from pycuda.compiler import SourceModule
from bitstring import BitStream, BitArray
from jinja2 import Environment, PackageLoader
#helper functions
def bitlength(arg):
return math.ceil( math.log( arg , 2) )
def byt... | {
"content_hash": "22e09e693e6aa44f238a9d572eaca93e",
"timestamp": "",
"source": "github",
"line_count": 432,
"max_line_length": 182,
"avg_line_length": 42.942129629629626,
"alnum_prop": 0.6679963344294109,
"repo_name": "schroeder-dewitt/polyomino-self-assembly",
"id": "68060842449904935019e23b55b334b... |
"""The volumes snapshots api."""
from oslo.utils import strutils
import webob
from webob import exc
from cinder.api import common
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
from cin... | {
"content_hash": "f7459cf94fbb373eb462a6053e2f28b8",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 79,
"avg_line_length": 34,
"alnum_prop": 0.6007769145394006,
"repo_name": "hguemar/cinder",
"id": "64d1d28436724df1df814393b20084288e26703c",
"size": "9646",
"binary": f... |
class TestLimitNew:
config = """
tasks:
test:
mock:
- {title: 'Item 1'}
- {title: 'Item 2'}
- {title: 'Item 3'}
- {title: 'Item 4'}
accept_all: yes
limit_new: 1
"""
def test_limit_new(self, execute... | {
"content_hash": "56c911ae1ec34876c800f460f05928b2",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 95,
"avg_line_length": 35.5,
"alnum_prop": 0.5169014084507042,
"repo_name": "crawln45/Flexget",
"id": "ab3783dfe5046339dcf0f59477614b2fbe3d742f",
"size": "710",
"binary":... |
import os
import ycm_core
from clang_helpers import PrepareClangFlags
SOURCE_EXTENSIONS = {
"c++": (
".cpp",
".cxx"
),
"c": (
".c",
)
}
PATH_FLAGS = (
'-isystem',
'-I',
'-iquote',
'--sysroot='
)
def find_file(root, filename):
for root, _, files in os.wal... | {
"content_hash": "151ab979dbafae282ae44f582c4b529c",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 83,
"avg_line_length": 32.48854961832061,
"alnum_prop": 0.5634398496240601,
"repo_name": "mexus/ycm-flags",
"id": "d469c725f40684a433737fd820ee74d8f39fcff0",
"size": "4281... |
import sys, codecs, argparse
from nltk import word_tokenize
import javabridge
import gc
import regex as re
from termcolor import cprint
def get_decompounder():
"""
Restarts the JVM with the decompounder. It is necessary once in a while.
"""
javabridge.start_vm(class_path=["tf/jwordsplitter/target/jword... | {
"content_hash": "5b588a70393405770d7c9a1bdd429d29",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 119,
"avg_line_length": 46.4344262295082,
"alnum_prop": 0.48314210061782875,
"repo_name": "ufal/neuralmonkey",
"id": "d6b3f8efc0293013c35be59703a9b282c4f15a8a",
"size": "5... |
"""
Brocade backend.
Contributed by Balasubramania Pillai from MAX Gigapop.
Ported to OpenNSA NSIv2 by Henrik Thostrup Jensen (summer 2013)
Further contributions/fixes from Jeronimo Aguiar from AMPATH.
Notes:
configure terminal
vlan $vlan_id name $name
tagged $source_port
tagged $dest_port
end
Teardown:
configure t... | {
"content_hash": "c651e60fa848efb02370133bc494681b",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 136,
"avg_line_length": 29.926356589147286,
"alnum_prop": 0.628286491387126,
"repo_name": "jab1982/opennsa",
"id": "e0d0f77cefdc0d762c2c30d242997e2d80296a8b",
"size": "772... |
import timeit, numpy
array_size = 1e6
iterations = 10
# Choose the type you want to benchmark
#dtype = 'int8'
#dtype = 'int16'
#dtype = 'int32'
#dtype = 'int64'
dtype = 'float32'
#dtype = 'float64'
def compare_times(setup, expr):
print "Expression:", expr
namespace = {}
exec setup in namespace
numpy... | {
"content_hash": "0d7d764e4f3cd5b4ff8211897a66eaee",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 91,
"avg_line_length": 26.348148148148148,
"alnum_prop": 0.6123137475400618,
"repo_name": "jsalvatier/numexpr",
"id": "7c310faf3f3169c6cfef1afde539f5aec2d9f90f",
"size": "... |
from __future__ import unicode_literals
from PySide import QtGui
from PySide import QtCore
import os
from .constants import EXTENSION
from .widgets import TagCompletion
import noteorganiser.text_processing as tp
class Dialog(QtGui.QDialog):
"""
Model for dialogs in Note Organiser (pop-up windows)
"""
... | {
"content_hash": "950274f08a6b623ada39cf4e426e0712",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 82,
"avg_line_length": 36.993920972644375,
"alnum_prop": 0.6364308602415578,
"repo_name": "egolus/NoteOrganiser",
"id": "061f03ae93c6a55c7c7549d2e2fc061bfdda2d58",
"size":... |
import collections
import os
import re
CLANG_DIR = os.path.join(os.path.dirname(__file__), '../..')
FORMAT_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Format/Format.h')
INCLUDE_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Tooling/Inclusions/IncludeStyle.h')
DOC_FILE = os.path.join(CLANG_DIR, 'docs/Clang... | {
"content_hash": "b371959348c6fd267a72d1c3dd522581",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 95,
"avg_line_length": 32.82142857142857,
"alnum_prop": 0.5891496968754858,
"repo_name": "apple/swift-clang",
"id": "5feb793a4d705178790a7f2d079a235a27c1b5ca",
"size": "66... |
import requests
import bs4
from plugin import plugin, require
# TODO: handle errors and instructions better
@require(network=True)
@plugin('lyrics')
class lyrics():
"""
finds lyrics
the format is song,artist
song and artist are separated by a -
-- Example:
lyrics wonderful tonight-eric cl... | {
"content_hash": "07a3c59f3f5ad1f5bb62c7f7ce422d1e",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 91,
"avg_line_length": 30.215686274509803,
"alnum_prop": 0.5996106424399741,
"repo_name": "sukeesh/Jarvis",
"id": "af5173332588d84e5dcef033b61a8e8cc0e6d2f5",
"size": "3106... |
from .model_not_found_exception import ModelNotFoundException
class Importer:
def __init__(self, collection):
self.collection = collection
self.model = False
self.model_fields = []
def import_note(self, import_data):
self.__load_model(import_data['model'])
note = self.... | {
"content_hash": "85943ff161f81705e432987f466c8cab",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 31.3,
"alnum_prop": 0.5755362848014606,
"repo_name": "eljay26/anki-freeplane",
"id": "4ff26bdb68bb56325df605268d7b9b3276b660a0",
"size": "2191",
"b... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.support import MicrosoftSupport
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-support
# USAGE
python list_support_tickets_with_a_certain_service_id_for_a_subscription.py
Before run the sample, please set the valu... | {
"content_hash": "94bbe7f4a7af2e9f0fa53483d374a761",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 159,
"avg_line_length": 34.193548387096776,
"alnum_prop": 0.7424528301886792,
"repo_name": "Azure/azure-sdk-for-python",
"id": "6f6feee822eb1e4ef154a16d32d657e8e91ca521",
"... |
from locust import task
from base import LmsTasks
class CoursewareViewsTasks(LmsTasks):
"""
Models traffic for endpoints in lms.djangoapps.courseware.views
Traffic Distribution on courses.edx.org (last 7d as of 2014-02-24):
/courseware.views:course_about 6088 0.07%
/courseware.vi... | {
"content_hash": "431f04d00f0aa50eb1a24abc16969731",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 76,
"avg_line_length": 29.606060606060606,
"alnum_prop": 0.5578300921187308,
"repo_name": "edx/edx-load-tests",
"id": "6ab93585a3994cd8855750f324d127a64df4a235",
"size": "1... |
"""
Utility functions for decoding response bodies.
"""
import codecs
import collections
from io import BytesIO
import gzip
import zlib
import brotli
import zstandard as zstd
from typing import Union, Optional, AnyStr, overload # noqa
# We have a shared single-element cache for encoding and decoding.
# This is qui... | {
"content_hash": "141886b531436ac4f03e9e8314d43774",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 99,
"avg_line_length": 24.913419913419915,
"alnum_prop": 0.6116420503909644,
"repo_name": "vhaupert/mitmproxy",
"id": "164439422e113c8e1133bd90cfa387a74655a439",
"size": "... |
import os
from st2common.constants.pack import SYSTEM_PACK_NAME
from st2common.constants.sensors import MINIMUM_POLL_INTERVAL
from st2common.models.db.sensor import SensorTypeDB
from st2common.services import triggers as trigger_service
__all__ = [
'to_sensor_db_model',
'get_sensor_entry_point',
'create_t... | {
"content_hash": "eef703bff8da66bd60d4d3909ad63eb1",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 94,
"avg_line_length": 39.180851063829785,
"alnum_prop": 0.635894651099647,
"repo_name": "emedvedev/st2",
"id": "5b85d63223e46ba3fbdfd76dedc1f1f8405881ea",
"size": "4463",
... |
""" Extract features in time domain like simple amplitudes, signal differentiation or polynomial fit """
import numpy
import warnings
import logging
from pySPACE.missions.nodes.base_node import BaseNode
from pySPACE.missions.nodes.decorators import BooleanParameter, NoOptimizationParameter, NormalParameter, \
QNor... | {
"content_hash": "24684267a7bdf45114827847bdfd5cd8",
"timestamp": "",
"source": "github",
"line_count": 562,
"max_line_length": 118,
"avg_line_length": 42.329181494661924,
"alnum_prop": 0.5498759931060574,
"repo_name": "pyspace/pyspace",
"id": "78f13aff6d4cd6beed3d338e7950e3c46cff3727",
"size": "23... |
import requests
import mongoengine
import socket
import datetime
from flask import request
from flask_restful import abort
from irianas_server.models import \
Client, LogResource, HTTP, SSH, DATABASE, DNS, FTP
ip_server = socket.gethostbyname(socket.gethostname())
url_client = 'https://{ip}:9000/api/connect'
url_... | {
"content_hash": "9bbb1a2357ab6753cf7ba1e3c6325a5d",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 74,
"avg_line_length": 31.146198830409357,
"alnum_prop": 0.5257228689447991,
"repo_name": "Irigonzalez/irianas-server",
"id": "181fbffb7b80956dffddeda3e10d57574fe1d286",
"... |
import sublime
import sys
import imp
reloader = 'library.reloader'
try:
# ST3
reloader = 'ERB Autocomplete.' + reloader
except (ImportError, ValueError):
# ST2
pass
if reloader in sys.modules:
imp.reload(sys.modules[reloader])
try:
# ST3
from .library import reloader
from .library.co... | {
"content_hash": "f14cb313a7410d21203d564b0efa83f6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 67,
"avg_line_length": 30.875,
"alnum_prop": 0.7692307692307693,
"repo_name": "CasperLaiTW/ERBAutocomplete",
"id": "6d24503f3383c3ede4e77480587b1815e6c30111",
"size": "988"... |
from django.contrib import admin
from .models import DeviceToken
class DeviceTokenAdmin(admin.ModelAdmin):
list_filter = ["platform"]
admin.site.register(DeviceToken, DeviceTokenAdmin)
| {
"content_hash": "81282732c910b88d732d83acbfb6c86c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 50,
"avg_line_length": 24,
"alnum_prop": 0.796875,
"repo_name": "theju/wush",
"id": "3e869d6f9726ffa42f4226ed1ad75c4606e66bba",
"size": "192",
"binary": false,
"copies":... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_PathBenchmarks(object):
def setupUi(self, PathBenchmarks):
PathBenchmarks.setObjectName(_fromUtf8("PathBenchmarks"))
PathBenchmarks.resize(400, 300)
Path... | {
"content_hash": "7ecefa547d0665f90c54c779f57d863b",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 139,
"avg_line_length": 57.31578947368421,
"alnum_prop": 0.7223752678298133,
"repo_name": "ajavadia/ScaffCC",
"id": "5e124e3c7a4d568056601ebe9a8f6965eea07abf",
"size": "350... |
import optparse
import sys
import os
from reusable import parseFile
import math
'''Parse command line arguments'''
parser = optparse.OptionParser(description='Search for artifacts in secondary electron emission data.', usage='%prog filename')
(options, args) = parser.parse_args()
try:
filename = args[0]
except Index... | {
"content_hash": "d35a9aa694411a9026d4d450fbd6606d",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 127,
"avg_line_length": 30.289473684210527,
"alnum_prop": 0.7085143353605561,
"repo_name": "quells/ElectronDensityIntegration",
"id": "f3ff58384d9d61f79bba6f098cf67d078a93c13... |
"""Unit-test suite for `pptx.parts.chart` module."""
import pytest
from pptx.chart.chart import Chart
from pptx.chart.data import ChartData
from pptx.enum.chart import XL_CHART_TYPE as XCT
from pptx.opc.constants import CONTENT_TYPE as CT, RELATIONSHIP_TYPE as RT
from pptx.opc.package import OpcPackage
from pptx.opc.... | {
"content_hash": "0d53203b3e2b4c097e176c7ab56941c2",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 88,
"avg_line_length": 38.41290322580645,
"alnum_prop": 0.6467920725562647,
"repo_name": "scanny/python-pptx",
"id": "ca7fe777109f547d5958e21ff08f1b5eae1dd593",
"size": "5... |
import errno
import os
import platform
from lxml import etree
from oslo.config import cfg
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.openstack.common import units
from nova import... | {
"content_hash": "22959e8d4dfd87bb26179f75ceac69c1",
"timestamp": "",
"source": "github",
"line_count": 699,
"max_line_length": 78,
"avg_line_length": 32.26609442060086,
"alnum_prop": 0.5912476722532588,
"repo_name": "CiscoSystems/nova",
"id": "5378e335bc8b3cd1b174305be11b17a3cdbaccf0",
"size": "23... |
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
import uuid
from .. import models
class LocalNetworkGatewaysOperations(object):
"""LocalNetworkGatewaysOperations operations.
:param client: Client f... | {
"content_hash": "bd314db752dfceb717b11f7e79084ffa",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 157,
"avg_line_length": 45.85757575757576,
"alnum_prop": 0.6459393378708782,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "5da5462d5dcd7514be3cdb0986f987092fb899ea",
"s... |
import os.path
import threading
import tempfile
import flask
import mock
from mitmproxy.proxy.config import ProxyConfig
from mitmproxy.proxy.server import ProxyServer
import pathod.test
import pathod.pathoc
from mitmproxy import flow, controller, options
from mitmproxy import builtins
testapp = flask.Flask(__name__)
... | {
"content_hash": "a058242a2fdf1a212c42cecd41d988ef",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 99,
"avg_line_length": 26.141104294478527,
"alnum_prop": 0.5677071110068059,
"repo_name": "jvillacorta/mitmproxy",
"id": "1597f59cfd9fdbddc02a40efa68b482c016a7b6c",
"size"... |
from __future__ import absolute_import
import inspect
import os
import psutil
from pikos.monitors.line_monitor import LineMonitor
from pikos.monitors.records import LineMemoryRecord
class LineMemoryMonitor(LineMonitor):
""" Record process memory on python line events.
The class hooks on the settrace functi... | {
"content_hash": "9b5b8e9d8843996ebc11333e1117c652",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 76,
"avg_line_length": 31.486842105263158,
"alnum_prop": 0.6126201420810697,
"repo_name": "enthought/pikos",
"id": "b745f43e51aeb4c6b30096c93cd379be5df19ff1",
"size": "2733... |
"""
An example to compare classmethod and staticmethod
"""
class demo(object):
@classmethod
def klassmeth(*args):
return args
@staticmethod
def statmeth(*args):
return args
| {
"content_hash": "1f2cb990793861c43977886b43fbce46",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 50,
"avg_line_length": 19.09090909090909,
"alnum_prop": 0.6333333333333333,
"repo_name": "helloTC/LearnPython",
"id": "994966781fb168975435da2718a2e24b7d635b2d",
"size": "2... |
import numpy as np
from math import log
from rsfmodel import rsf, plot, staterelations
# This is really just the Ruina realtion, but let's pretend we invented it!
# We'll inherit attributes from rsf.StateRelation, but you wouldn't have to.
# It does provide velocity contribution calculation for us though!
class MySt... | {
"content_hash": "e7ca13c86f979ac65c8bb8b2b9751efd",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 92,
"avg_line_length": 32.924528301886795,
"alnum_prop": 0.7312320916905444,
"repo_name": "jrleeman/rsfmodel",
"id": "8e49a7267c47fa07ef30519ad29d301cd6974414",
"size": "17... |
from django.shortcuts import redirect
from cuckoo.common.config import config
from cuckoo.misc import version
class CuckooAuthentication(object):
def process_request(self, request):
if request.path.startswith(("/secret/", "/static/")):
return
# If no web_secret has been initialized, ig... | {
"content_hash": "f1a5900ce386879e7fd5da5fc6571499",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 75,
"avg_line_length": 36.42857142857143,
"alnum_prop": 0.6352941176470588,
"repo_name": "cuckoobox/cuckoo",
"id": "68380910cc6a828caf85ae913b5365cbdee4d0b4",
"size": "1229... |
from statsmodels.compat.python import lzip
import numpy as np
from scipy.stats import norm
from statsmodels.tools.decorators import cache_readonly
#### margeff helper functions ####
#NOTE: todo marginal effects for group 2
# group 2 oprobit, ologit, gologit, mlogit, biprobit
def _check_margeff_args(at, method):
"... | {
"content_hash": "5f16ed5474e9ecb783cf03361b4c683c",
"timestamp": "",
"source": "github",
"line_count": 730,
"max_line_length": 83,
"avg_line_length": 36.38493150684931,
"alnum_prop": 0.559542185911675,
"repo_name": "josef-pkt/statsmodels",
"id": "dc7be4ceae8be410ad7a8b70bdb9978b8c44827d",
"size": ... |
"""Python 2/3 compatibility definitions.
These are used by the rest of Elpy to keep compatibility definitions
in one place.
"""
import sys
if sys.version_info >= (3, 0):
PYTHON3 = True
from io import StringIO
def ensure_not_unicode(obj):
return obj
else:
PYTHON3 = False
from StringIO... | {
"content_hash": "6203f985e3244f324bf3f38920880432",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 73,
"avg_line_length": 20.393939393939394,
"alnum_prop": 0.6225854383358098,
"repo_name": "zhangyunfeng/.emacs.d",
"id": "ebe91a235ebbfe8f9b61fe68d88f461bc9eb1e5b",
"size":... |
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
engine = create_engine('sqlite:///agora.sqlite')
DBSession = scoped_session(sessionmaker())
DBSession.configure(bind=engine)
__all__ = ['DBSession']
| {
"content_hash": "1cacbde468117f8d656f9bc0d5ccf15f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 55,
"avg_line_length": 30.5,
"alnum_prop": 0.7745901639344263,
"repo_name": "cullerton/cullerton.agora",
"id": "2b28b522c1c6f7abca12ae419e6def011b32c6fe",
"size": "244",
"... |
import sublime
import os
import sys
from .pathhelper import *
def plugin_loaded():
global TEMPLATE_FOLDER
TEMPLATE_FOLDER = os.path.join(sublime.packages_path(), 'User', '.FileManager')
if not os.path.exists(TEMPLATE_FOLDER):
makedirs(TEMPLATE_FOLDER)
def md(*t, **kwargs):
sublime.message_dia... | {
"content_hash": "86dce98f7530166613233db61ff5488d",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 118,
"avg_line_length": 28.875,
"alnum_prop": 0.6011904761904762,
"repo_name": "ameistad/FileManager",
"id": "5771cff15f39ed3ae930f64c8f0190bfb9df82e5",
"size": "3696",
... |
import config
import urllib
import simpleoauth2
import rs as qboxrs
import rscli
import digestoauth
import uptoken
config.ACCESS_KEY = '<Please apply your access key>'
config.SECRET_KEY = '<Dont send your secret key to anyone>'
bucket = 'test_photos'
key = 'test.jpg'
customer = 'end_user_id'
demo_domain = 'test_photo... | {
"content_hash": "2aa76d15c23137a845a5c729c0b13193",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 75,
"avg_line_length": 24.9,
"alnum_prop": 0.7175368139223561,
"repo_name": "rnoldo/django-avatar",
"id": "bb601b92434c4ca50b9e3e48c49bccf5d9c99d33",
"size": "770",
"bina... |
""" a module to convert between the old (Python script) plugin format,
and the new (JSON) one
"""
from typing import Dict, Tuple # noqa: F401
import ast
import json
def assess_syntax(path):
with open(path) as file_obj:
content = file_obj.read()
syntax_tree = ast.parse(content)
docstring = "" ... | {
"content_hash": "361a8ebc9a11efec426baf844f938927",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 88,
"avg_line_length": 34.78654970760234,
"alnum_prop": 0.5645120618643356,
"repo_name": "chrisjsewell/ipypublish",
"id": "aa7f362366cfb2ef45f260446012fa04783f0929",
"size... |
import pytest
from mitmproxy.contentviews import xml_html
from . import full_eval
datadir = "mitmproxy/contentviews/test_xml_html_data/"
def test_simple(tdata):
v = full_eval(xml_html.ViewXmlHtml())
assert v(b"foo") == ('XML', [[('text', 'foo')]])
assert v(b"<html></html>") == ('HTML', [[('text', '<html... | {
"content_hash": "3baf01da681630a7536f0502e540f68d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 73,
"avg_line_length": 32.15217391304348,
"alnum_prop": 0.6118999323867478,
"repo_name": "Kriechi/mitmproxy",
"id": "fc1bac5c8eb81e644efc7d3a4229a0107f52c9e4",
"size": "147... |
'''
This module retrieves information of all the courses offered by Coursera
through their Catalog APIs
Link to documentation:
https://tech.coursera.org/app-platform/catalog/
'''
import requests
class CourseraAPI(object):
'''
This class defines attributes and methods for the Coursera Catalog API
'''
... | {
"content_hash": "fb0eb5ef3cca2b5675fda539f71a9d07",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 254,
"avg_line_length": 42.63953488372093,
"alnum_prop": 0.5939460049086447,
"repo_name": "ueg1990/mooc_aggregator_restful_api",
"id": "a006b1594bab4b229bc6c72f265094ab35ad40... |
from random import randint
from flask import Blueprint, Response, flash, redirect, render_template, \
request, url_for
from setman import settings
from setman.frameworks.flask_setman.forms import settings_form_factory
from setman.frameworks.flask_setman.utils import update_form_fields
from setman.utils.auth impor... | {
"content_hash": "45f1051c41bfa8b3e27717af9ff9a60c",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 30.054545454545455,
"alnum_prop": 0.6563823351482153,
"repo_name": "playpauseandstop/setman",
"id": "bc136385702937b350402842fbac4ccf60592d99",
"size... |
'''
OpenShiftCLI class that wraps the oc commands in a subprocess
'''
# pylint: disable=too-many-lines
import atexit
import json
import os
import re
import shutil
import subprocess
import ruamel.yaml as yaml
#import yaml
#
## This is here because of a bug that causes yaml
## to incorrectly handle timezone info on t... | {
"content_hash": "84848c4d5334f9452fc25a4f1dfdbd61",
"timestamp": "",
"source": "github",
"line_count": 1098,
"max_line_length": 118,
"avg_line_length": 32.55373406193078,
"alnum_prop": 0.5254028648164727,
"repo_name": "rhdedgar/openshift-tools",
"id": "c0f9ec0dda19471048663395392cbf50e2e81f71",
"s... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetCensusIDByTypeAndName(Choreography):
def __init__(self, temboo_session):
"""
... | {
"content_hash": "66a0c7addf2443721bd731b4424e61dc",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 277,
"avg_line_length": 47.88157894736842,
"alnum_prop": 0.7136575982412751,
"repo_name": "lupyuen/RaspberryPiImage",
"id": "c1511c1301b0f3f6290820226fb19077dc9673b2",
"siz... |
from edmunds.http.requestmiddleware import RequestMiddleware
from flask_security import auth_token_required
class TokenAuthMiddleware(RequestMiddleware):
"""
Token Authentication Middleware
"""
def before(self):
"""
Handle before the request
"""
decorator = auth_token... | {
"content_hash": "0f9db61d44b341262fb177333c53204b",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 60,
"avg_line_length": 22,
"alnum_prop": 0.6641414141414141,
"repo_name": "LowieHuyghe/edmunds",
"id": "e37ef4cc20489e3192404485005cb395ee542640",
"size": "397",
"binary"... |
from __future__ import unicode_literals
import pyxb
import pyxb.binding
import pyxb.binding.saxer
import io
import pyxb.utils.utility
import pyxb.utils.domutils
import sys
import pyxb.utils.six as _six
# Unique identifier for bindings created at the same time
_GenerationUID = pyxb.utils.utility.UniqueIdentifier('urn:u... | {
"content_hash": "cb8f271313c970bd439cf497e160e914",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 397,
"avg_line_length": 63.21063829787234,
"alnum_prop": 0.7554613080211384,
"repo_name": "HackTrain/darwinpush",
"id": "e8147fbb671a32d1e1e9abe5eb3738dee968c496",
"size":... |
import click
import os
from textx import GeneratorDesc
def codegen_flow_pu(metamodel, model, output_path, overwrite, debug=False,
**custom_args):
"""
This command transforms *.flow-files to *.pu files (plantuml).
"""
txt = "@startuml\n"
for a in model.algos:
txt += "co... | {
"content_hash": "a9829f0a113f0598a8b0b7fc7a3b0336",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 74,
"avg_line_length": 33.68292682926829,
"alnum_prop": 0.5843591600289645,
"repo_name": "igordejanovic/textX",
"id": "ac6c87d55c17895ebfe99ae0473879836506f1cf",
"size": "1... |
import unittest
from nosedep import depends
class TestSimpleDecorated(unittest.TestCase):
"""Specifically tests when inheriting from unittest.TestCase"""
@depends(after='test_simple_decorated_ok')
def test_simple_decorated_fail(self):
assert 1 == 0
def test_simple_decorated_ok(self):
... | {
"content_hash": "516901ac91b60d88cee69b3db7f22753",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 67,
"avg_line_length": 26.41176470588235,
"alnum_prop": 0.688195991091314,
"repo_name": "Zitrax/nose-dep",
"id": "9676393c8e3fd500698312264f6f4e2482051de5",
"size": "449",
... |
from easy_print import *
from working_init import *
def main():
"""
Working With Adversaries
"""
# optionally set max results
tc.set_max_results("500")
"""
Get Adversary by ID
Method:
get_adversary_by_id(id)
id -> adversary id #
Use this method to return a single adv... | {
"content_hash": "3c179ef645565556a2459a505c156aa1",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 87,
"avg_line_length": 29.36,
"alnum_prop": 0.5707538601271571,
"repo_name": "andybarilla/TCPy_V2",
"id": "e4c542c6c035d326c2dc82296d80af86f84a6284",
"size": "11010",
"b... |
import sys
import pysam
import numpy
global CACHE_CHROM
global CACHE_SAMFILE
CACHE_CHROM = None
CACHE_SAMFILE = None
def check_pysam_chrom(samFile, chrom=None):
"""Chech if samFile is a file name or pysam object, and if chrom format.
"""
global CACHE_CHROM
global CACHE_SAMFILE
if CACHE_CHROM is ... | {
"content_hash": "187e6f4b0a8bae25f16964356d3cd2e3",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 80,
"avg_line_length": 34.54867256637168,
"alnum_prop": 0.5581454918032787,
"repo_name": "huangyh09/brie",
"id": "ba77600ef8fff51308f4f07c67eaab6168f5a70b",
"size": "7928"... |
from msrest.serialization import Model
class Status(Model):
"""The status of an Azure resource at the time the operation was called.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar display_status: The short label for the status.
:vartype display_stat... | {
"content_hash": "7e8ebb12e6badedda64392617fcc6f84",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 77,
"avg_line_length": 30.514285714285716,
"alnum_prop": 0.6207865168539326,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "af9d5066c871f765eadc707f6ac10a15672bcee1",... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sms', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='SelfRegistrationInvitation',
fields=[
('id', models.AutoField(verbose_name='ID'... | {
"content_hash": "863d50e06c8b10091fbaeab829afda33",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 129,
"avg_line_length": 41.10344827586207,
"alnum_prop": 0.5503355704697986,
"repo_name": "dimagi/commcare-hq",
"id": "0348bfc3aede7a83ba1e69a06410cf061126d983",
"size": "1... |
"""
twython.streaming.types
~~~~~~~~~~~~~~~~~~~~~~~
This module contains classes and methods for :class:`TwythonStreamer` to use.
"""
class TwythonStreamerTypes(object):
"""Class for different stream endpoints
Not all streaming endpoints have nested endpoints.
User Streams and Site Streams are single st... | {
"content_hash": "3c8a820968860f183ee981fb26ab398b",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 103,
"avg_line_length": 33.443396226415096,
"alnum_prop": 0.6372355430183357,
"repo_name": "Oire/twython",
"id": "81c5c07fadcc062c1d812c7a4508c2fc36c17853",
"size": "3570"... |
from matplotlib import pyplot as plt
from matplotlib import animation
import numpy as np
from boids.flock import Flock
from boids.flight import Flight
from argparse import ArgumentParser
import yaml
import os
def process():
_ROOT = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(_ROOT,'config/co... | {
"content_hash": "4583da67f7deed0b484c6b0825005442",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 145,
"avg_line_length": 27.5,
"alnum_prop": 0.7032467532467532,
"repo_name": "cpmck/boids",
"id": "b7e8bcb7d52cb8bf553e75640f3065885ccc4c13",
"size": "1540",
"binary": fa... |
def getLatestTimestamp(projectPath):
NYI
| {
"content_hash": "e4f5ddda595437dbd8687b1691e6a4c2",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 36,
"avg_line_length": 22.5,
"alnum_prop": 0.7777777777777778,
"repo_name": "joehewitt/devon",
"id": "ac83c0732b03e662aff9ef4e9b000e5818f07927",
"size": "46",
"binary": fa... |
import webapp2
import urllib
from google.appengine.api import mail
import sys
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello!')
class CheckServer(webapp2.RequestHandler):
def sendmail(self, errormsg):
sender_a... | {
"content_hash": "221d0d64ff5abed102906e0b60c3007b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 72,
"avg_line_length": 27.5,
"alnum_prop": 0.6564593301435406,
"repo_name": "indianazhao/checkserver",
"id": "529edc01862ca4e7ba54383b1e70037aca28ec4b",
"size": "1045",
"... |
"""Module providing views for the folderish content page type"""
import json
from Acquisition import aq_inner
from Products.Five.browser import BrowserView
from plone import api
from zope.component import getMultiAdapter
IMG = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs='
class ProjectView... | {
"content_hash": "e1a35c74dad70dc34a16321104d85eec",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 78,
"avg_line_length": 30.76923076923077,
"alnum_prop": 0.581,
"repo_name": "a25kk/newe",
"id": "bb407ec4bc0e852acb6267c76632b96484f53083",
"size": "2024",
"binary": fals... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import modelcluster.fields
import wagtail.wagtailcore.fields
import modelcluster.tags
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0002_initial_data'),
... | {
"content_hash": "e5adc1a0f84c95b3a2f1bef5111b61b9",
"timestamp": "",
"source": "github",
"line_count": 584,
"max_line_length": 369,
"avg_line_length": 51.476027397260275,
"alnum_prop": 0.563701683188078,
"repo_name": "arvindram03/e-thagaval",
"id": "63a8b492aa1ebee7a1240475174f8d4e20ecbc48",
"size... |
"""Main function to train Attribute-Mask RCNN models.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import pprint
from absl import flags
from absl import logging
import six
from six.moves import range
import tensorflow.compat.v1 as tf
from... | {
"content_hash": "4e3d8de26d4b976c1a36ebd823d7b57f",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 79,
"avg_line_length": 32.35502958579882,
"alnum_prop": 0.6744696415508412,
"repo_name": "tensorflow/tpu",
"id": "a8b797f65643aa5035f76b16ef15b40f55fa3143",
"size": "6157"... |
import unittest
import azure.mgmt.compute
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = 'eastus'
class TestMgmtCompute(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.mgmt_client = self.create_mgmt_client(
... | {
"content_hash": "6168d2d74da7c777e28bf3e13bf4a0be",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 127,
"avg_line_length": 37.91954022988506,
"alnum_prop": 0.6217035465292513,
"repo_name": "Azure/azure-sdk-for-python",
"id": "35e4bb6212c61be77d296ffd6ab15fccd12f4848",
"s... |
import requests
from xml.etree import ElementTree
from datetime import datetime
from platform import python_implementation, python_version
from collections import OrderedDict
PACKAGE_VERSION = '0.1.4'
def timestamp():
return str(datetime.utcnow().isoformat())
class Api:
"""
Abstraction of the Internode... | {
"content_hash": "fe091517dcd2366a1870241c46d44526",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 133,
"avg_line_length": 36.25247524752475,
"alnum_prop": 0.5922436160043698,
"repo_name": "lachlanmcdonald/internode-py",
"id": "06e18cf4daa23b4e8dc53629df9be2bbfb4cd7d8",
... |
"""
StackState.
Kubernetes topology extraction
Collects topology from k8s API.
"""
from collections import defaultdict
# 3rd party
import requests
# project
from checks import AgentCheck
from utils.kubernetes import KubeUtil
class KubernetesTopology(AgentCheck):
INSTANCE_TYPE = "kubernetes"
SER... | {
"content_hash": "1af0c91919f033e91d438a9e0255c7d5",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 166,
"avg_line_length": 46.58447488584475,
"alnum_prop": 0.577827876886885,
"repo_name": "StackVista/sts-agent-integrations-core",
"id": "9792033741a77286d13595cc6abd7d92c20... |
"""
This is the SimKit :mod:`~simkit.core.models` module that contains
definitions for the :class:`~simkit.core.models.Model` class.
The SimKit model contains five layers:
:class:`~simkit.core.layers.Data`,
:class:`~simkit.core.layers.Formulas`,
:class:`~simkit.core.layers.Calculations`,
:class:`~simkit.core.layers.Ou... | {
"content_hash": "0f202160c08fb2154911ea225fc159ee",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 80,
"avg_line_length": 38.74635568513119,
"alnum_prop": 0.581339352896915,
"repo_name": "SunPower/Carousel",
"id": "276708349ee4d1f2f9eb0efb4776cb4d89c49820",
"size": "133... |
import doctest, test_support
test_support.run_doctest(doctest)
| {
"content_hash": "7888e6db11fa78a252fd548362f56c1b",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 33,
"avg_line_length": 31.5,
"alnum_prop": 0.8253968253968254,
"repo_name": "mariaantoanelam/Licenta",
"id": "f8ad6fdb6e11523c074bf7672411e09259bb68e7",
"size": "63",
"bin... |
class Token:
# Token types
UNKOWN, \
ID, \
PUNCTUATION, \
INT_LIT, \
STRING_LIT, \
KEYWORD, \
COMMENT, \
BLOCK_COMMENT, \
= range(8)
def __init__(self, tokenizer, tokenId, span):
self._tokenizer = tokenizer
self._id = tokenId
self._span = span
... | {
"content_hash": "ffcc1c0ae786418badcb1e7d99b6cc06",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 96,
"avg_line_length": 25.585714285714285,
"alnum_prop": 0.5203796761585706,
"repo_name": "spiricn/libIDL",
"id": "18c1bcab0e2c640920711560dc4b7831fb68a92a",
"size": "1791"... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.forms import model_to_dict
from django.shortcuts import get_object_or_404, render, redirect
from django.template.context import RequestContext
... | {
"content_hash": "c224478fac23a8ea33096391106115ff",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 114,
"avg_line_length": 30.375886524822697,
"alnum_prop": 0.6833994863413495,
"repo_name": "alazaro/django-notifications",
"id": "fa2d7402dac952d75d80102cd216c82573b01697",
... |
import os, logging
from sqlite3 import dbapi2 as sqlite3
from flask import Flask, request, session, url_for, redirect, \
render_template, abort, g, flash, _app_ctx_stack, send_from_directory
from werkzeug import check_password_hash, generate_password_hash, secure_filename
# configuration
DATABASE = 'data.db'
DEBU... | {
"content_hash": "778284af01721038e406e0b42e6e37cf",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 121,
"avg_line_length": 30.91044776119403,
"alnum_prop": 0.6122646064703042,
"repo_name": "howenx/py_flask_login_upload",
"id": "d5adda20da4f0a7bf75bc635a485a242d5f81c0f",
... |
"""
The main QuerySet implementation. This provides the public API for the ORM.
"""
import copy
import sys
import warnings
from collections import OrderedDict, deque
from django.conf import settings
from django.core import exceptions
from django.db import (
DJANGO_VERSION_PICKLE_KEY, IntegrityError, connections, ... | {
"content_hash": "e0e492963e2736487cfb67e97192a00d",
"timestamp": "",
"source": "github",
"line_count": 1714,
"max_line_length": 115,
"avg_line_length": 40.45565927654609,
"alnum_prop": 0.5872139138460651,
"repo_name": "sarthakmeh03/django",
"id": "7db076cc58dfe6a0079caa6d43cb7e7b75133dbe",
"size":... |
import MySQLdb as mdb
import sys
import os
if len(sys.argv) < 6:
sys.exit("usage: %s <job_name> <build_number> <workload> <iteration> <runtime>" % sys.argv[0])
host = os.environ["MYSQLHOST"]
user = os.environ["MYSQLUSER"]
pwd = os.environ["MYSQLPWD"]
db = os.environ["MYSQLDB"]
con = mdb.connect(host, user, pwd, db... | {
"content_hash": "b01dd0434d01a3cc657c5023da212c50",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 96,
"avg_line_length": 27.36,
"alnum_prop": 0.6549707602339181,
"repo_name": "andrwng/kudu",
"id": "a6b092a7a0023909629bc6a6423bccaa13ad01fd",
"size": "1490",
"binary": f... |
import gym
import math
import random
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from collections import namedtuple
from itertools import count
from copy import deepcopy
from PIL import Image
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from to... | {
"content_hash": "6500da7a355ef68427214d57f8b4da38",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 87,
"avg_line_length": 29.154676258992804,
"alnum_prop": 0.5895126465144972,
"repo_name": "nathbo/GO_DILab",
"id": "79bffae1ddd5849ebc93c5a99cd5b594af6e2774",
"size": "818... |
"""Start Home Assistant."""
import argparse
import asyncio
import os
import platform
import subprocess
import sys
import threading
from typing import List
from homeassistant.const import REQUIRED_PYTHON_VER, RESTART_EXIT_CODE, __version__
def set_loop() -> None:
"""Attempt to use different loop."""
from asyn... | {
"content_hash": "35830109d60f8e34896f7eca253631e3",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 87,
"avg_line_length": 30.237142857142857,
"alnum_prop": 0.6101294528961542,
"repo_name": "postlund/home-assistant",
"id": "d1d59482e6d077b7540559ff191603fcab80e866",
"siz... |
"""symbal.py: Check for braces to be balanced"""
from stack import Stack
__author__ = 'Rohit Sinha'
def match_braces(opener, closer):
return "({[".index(opener) == ")}]".index(closer)
def brace_checker(brace_string):
stack = Stack()
isbal = True
index = 0
while index < len(brace_string) and is... | {
"content_hash": "57920f1f2f78229a59c557e5e112b978",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 65,
"avg_line_length": 24.742857142857144,
"alnum_prop": 0.5311778290993071,
"repo_name": "rohitsinha54/Learning-Python",
"id": "e1560ddb7d2b490d418639ec12da095cf6aac913",
... |
import basic
import heapq
def _dijkstra_reconstruct(previous, source, target):
path = []
u = target
try:
while previous[u]:
path.append(u)
u = previous[u]
except:
pass
path.append(source)
path.reverse()
return path
def dijkstra(source, target=None):
... | {
"content_hash": "92d249009f641cdb35579caeaefb0447",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 77,
"avg_line_length": 31.81578947368421,
"alnum_prop": 0.5711331679073615,
"repo_name": "mrgaaron/vgraph",
"id": "4bc655318409907fc813e13f61a503187ffb8342",
"size": "2441"... |
"""
"""
import tables, os, distutils.dir_util, scipy
class h5file():
def __init__(self,fname):
""" initialization function """
self.fname = fname
self.fhandle = None
return
def openFile(self):
""" open file self.fname """
self.fhandle = tables.ope... | {
"content_hash": "c5b31c09293e91cb88c861bf1d9203f8",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 90,
"avg_line_length": 38.90196078431372,
"alnum_prop": 0.48403897849462363,
"repo_name": "jswoboda/NonMaxwellianExperiments",
"id": "c5573304fb529f2c861e0530919fa094b8b219e... |
__all__ = [
"OATime",
"OATimer"
]
import datetime as coretime
import time
from ._env import oalog
class OATime(object):
"""Executes time queries on database, returning
consistent time view to caller"""
def __init__(self, dt=None, extcur=None):
self.cur = extcur
self.dt = dt
... | {
"content_hash": "51b4e288c8ef2dd54c96d6b441a4289b",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 83,
"avg_line_length": 26.48936170212766,
"alnum_prop": 0.5879518072289157,
"repo_name": "kchoudhu/openarc",
"id": "08f822c968c739537251f51f18fb53f982bfee56",
"size": "1245... |
"""
views
~~~~~
Routes & views for this app!
"""
from flask import (
Blueprint, render_template, jsonify, request, current_app
)
from jinja2 import TemplateNotFound
import voweler
from string import ascii_lowercase
import json
simple_page = Blueprint('simple_page', __name__,
t... | {
"content_hash": "1a74491cf9c7b7c89cfc5d316dfc4c50",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 80,
"avg_line_length": 26.83783783783784,
"alnum_prop": 0.6299093655589124,
"repo_name": "bhtucker/perceptron_viz",
"id": "ff87071c90cdd3576813448fba89734e202ffbc9",
"size"... |
from distutils.core import setup
setup(
name = 'Raspberry_SDK',
packages = ['Raspberry_SDK'],
version = '0.1.4',
description = 'Countly IoT Analytics SDK for Raspberry Pi devices',
author = 'Countly',
author_email = 'hello@count.ly',
url = 'https://github.com/countly/countly-sdk-python',
download_url = ... | {
"content_hash": "3c997493ae72fbd325587f9a1889ef9e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 79,
"avg_line_length": 34.30769230769231,
"alnum_prop": 0.6748878923766816,
"repo_name": "Countly/countly-sdk-iot-python",
"id": "ea0a322e1fc038e80397da0608baa2f21154af3e",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.