text stringlengths 4 1.02M | meta dict |
|---|---|
import pickle
import textwrap
from collections import OrderedDict
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from astropy.nddata.nddata import NDData
from astropy.nddata.nduncertainty import StdDevUncertainty
from astropy import units as u
from astropy.utils import NumpyRNGContext
f... | {
"content_hash": "23eb0de164e8ca64ea02d4659abc0d52",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 96,
"avg_line_length": 31.11088295687885,
"alnum_prop": 0.6169229753811629,
"repo_name": "MSeifert04/astropy",
"id": "954317e211f7779d299052ac48c683b0ae7c815b",
"size": "1... |
import re
from utils import *
from entities.record import Record
def __extractTag(text):
"""
Extracts tag from record.
@tag
@param {string} text.
@return {string} tag.
"""
return re.match('@\w+', text).group(0)
def __extractType(text, tag):
"""
Extracts type... | {
"content_hash": "b6c7954b0c7a77bfb49e3b6fb7f23e8a",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 77,
"avg_line_length": 22.844660194174757,
"alnum_prop": 0.5410114747131322,
"repo_name": "LiveTex/Livetex-Tools",
"id": "8367ac06bf7a8d1d5f2effe922aa8b24777618aa",
"size"... |
"""
:mod:`nexenta.iscsi` -- Driver to store volumes on Nexenta Appliance
=====================================================================
.. automodule:: nexenta.volume
.. moduleauthor:: Victor Rodionov <victor.rodionov@nexenta.com>
.. moduleauthor:: Mikhail Khodos <mikhail.khodos@nexenta.com>
.. moduleauthor:: Y... | {
"content_hash": "5c5cf83d579bf361d095bc281b8636b4",
"timestamp": "",
"source": "github",
"line_count": 587,
"max_line_length": 79,
"avg_line_length": 41.0221465076661,
"alnum_prop": 0.5683554817275748,
"repo_name": "NeCTAR-RC/cinder",
"id": "7635ea606eb69991ffe392b498c199d9706533b0",
"size": "2471... |
import subprocess
import os
def burn_subtitle(video, subtitle):
ffmpeg = "/home/zousiyu1/bin/ffmpeg/ffmpeg"
exec_list = [ffmpeg, "-i"]
# parameters
exec_list.append(video) # video file
exec_list.append("-vf") # subtitle
vf_args = "ass=" + subtitle
exec_list.append(vf_args)
# output... | {
"content_hash": "ab184ed662dc446032f8fe537dff658a",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 53,
"avg_line_length": 19.90909090909091,
"alnum_prop": 0.6210045662100456,
"repo_name": "Zousiyu/code_snippet",
"id": "7d73ff9acc1a2e110e618d7743d72f5b7ef189bd",
"size": "... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'types06.xlsx'
... | {
"content_hash": "4db8b02dd0fa5dfadc16a48bf83a6f83",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 68,
"avg_line_length": 28.457142857142856,
"alnum_prop": 0.5953815261044176,
"repo_name": "jkyeung/XlsxWriter",
"id": "302a826d377619d089a6c5763b36c58f0116e6b9",
"size": "1... |
import collections
import json
import math
import re
import six
import uuid
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import strutils
from oslo_utils import units
from cinder import context
from cinder import coordination
from cinder import excepti... | {
"content_hash": "d28999c57ba0e12e41c801d3ec38162b",
"timestamp": "",
"source": "github",
"line_count": 2360,
"max_line_length": 79,
"avg_line_length": 41.970338983050844,
"alnum_prop": 0.5421201413427562,
"repo_name": "j-griffith/cinder",
"id": "1638fe460bfdd7a886d6021542b8649c865e4888",
"size": "... |
from datetime import datetime, timedelta
import mraa
import pickle
import pywapi
import subprocess
import threading
import time
import unirest
import calendar_api
# initialize Buttons
stop_button = mraa.Gpio(4)
stop_button.dir(mraa.DIR_IN)
snooze_button = mraa.Gpio(3)
snooze_button.dir(mraa.DIR_IN)
# initialize glob... | {
"content_hash": "0cd6b9f69153d996ef32d925204534d3",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 93,
"avg_line_length": 30.51260504201681,
"alnum_prop": 0.6700633434315616,
"repo_name": "julianaklulo/clockwise",
"id": "4590efb956e57a88d9b41c6d499c485042fbb7b9",
"size"... |
from typing import Iterable
class Index:
def __init__(self, item):
try:
self.length = len(item)
except TypeError:
self.length = int(item)
def index(self, item: int, error=None) -> int:
if item < 0:
result = self.length + int(item)
else:
... | {
"content_hash": "5269c9bd9b93b41c98cfe5eb0ab1ded2",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 53,
"avg_line_length": 26.76,
"alnum_prop": 0.5171898355754858,
"repo_name": "mozman/ezdxf",
"id": "76d36f0243c00a8a8c6b849f36175aafd4f1982a",
"size": "751",
"binary": fa... |
print 'Hello, World!'
| {
"content_hash": "139a7c5835bd83f7c2bf4bbad5161ee3",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.6818181818181818,
"repo_name": "dheerajgoudb/Hackerrank",
"id": "36fa3f056aa9a4d0ae33fcd856c0d5d9a43ee33c",
"size": "22",
"binar... |
import os
import sys
import csv
import shutil
import tempfile
import traceback
import contextlib
import multiprocessing
import cPickle as pickle
import simplejson as json
from google.protobuf.descriptor import FieldDescriptor
from distributions.io.stream import open_compressed
from distributions.io.stream import json_l... | {
"content_hash": "a0b800c0afa949f220e4f0612c8893c4",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 74,
"avg_line_length": 26.18661971830986,
"alnum_prop": 0.5993007933306441,
"repo_name": "fritzo/loom",
"id": "4414f4b8d4a7b84771d577fdb93e690e33996c56",
"size": "9014",
... |
from setuptools import setup, find_packages
setup(
name='id_token_verify',
version='0.1',
packages=find_packages('src'),
package_dir={'': 'src'},
url='https://github.com/its-dirg/id_token_verify',
license='Apache 2.0',
author='Rebecka Gulliksson',
author_email='rebecka.gulliksson@umu.se... | {
"content_hash": "4e69a9163852c5e468e9c1d1bac85cf7",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 81,
"avg_line_length": 32,
"alnum_prop": 0.6741071428571429,
"repo_name": "its-dirg/id_token_verify",
"id": "ccebf0241a55d7545cfa59e995ef01bf37b75687",
"size": "448",
"bi... |
from typing import Callable, Tuple, Optional, List, Dict, Any, TYPE_CHECKING
from ray.rllib.env.external_env import ExternalEnv
from ray.rllib.env.external_multi_agent_env import ExternalMultiAgentEnv
from ray.rllib.env.multi_agent_env import MultiAgentEnv
from ray.rllib.env.vector_env import VectorEnv
from ray.rllib.... | {
"content_hash": "956e293fa57bd972f066f23e41759eeb",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 79,
"avg_line_length": 39.59148936170213,
"alnum_prop": 0.5512145313843508,
"repo_name": "robertnishihara/ray",
"id": "6c9544833eef726b0eafc4ffe640a1e9481e1026",
"size": "... |
import os
import re
from datetime import datetime, timedelta
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.db import transaction
from django.utils.encoding import force_text
from django_statsd.clients import statsd
from multidb import get_replica
import... | {
"content_hash": "aedca5730fa2351276ae21295ca890b2",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 79,
"avg_line_length": 40.11851851851852,
"alnum_prop": 0.6256462333825702,
"repo_name": "eviljeff/olympia",
"id": "0bebf5a00a268c9299915a228b7c947552c34795",
"size": "108... |
from opbeat.instrumentation.packages.base import AbstractInstrumentedModule
class PythonMemcachedInstrumentation(AbstractInstrumentedModule):
name = 'python_memcached'
method_list = [
'add',
'append',
'cas',
'decr',
'delete',
'delete_multi',
'disconnect... | {
"content_hash": "230e6cf3db9bc1862e735858a61c41d6",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 80,
"avg_line_length": 27.657894736842106,
"alnum_prop": 0.5737392959086585,
"repo_name": "daikeren/opbeat_python",
"id": "0528946dac75126e7e85782a74340126056c63d2",
"size"... |
"""Tools to work with checkpoints."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.python.ops import gen_io_ops
from tensorflow.python.ops import state_ops
from tensorflow.python.ops import variable_scope as vs
from tensorflow... | {
"content_hash": "a229975832f488bd8be119d7c2d7e9ef",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 80,
"avg_line_length": 37.50813008130081,
"alnum_prop": 0.6539503630649182,
"repo_name": "sachinpro/sachinpro.github.io",
"id": "da42175570cddb2395bf3aaf10f7dbd568508498",
... |
'''
Created by auto_sdk on 2014.06.04
'''
from top.api.base import RestApi
class FuwuSaleLinkGenRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.nick = None
self.param_str = None
def getapiname(self):
return 'taobao.fuwu.sale.link.ge... | {
"content_hash": "5a6a0c872697efd28cfbeaf14a998a28",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 55,
"avg_line_length": 27,
"alnum_prop": 0.6820987654320988,
"repo_name": "colaftc/webtool",
"id": "ad7beca886c5bcaae45a42718405a344aa4527f6",
"size": "324",
"binary": fa... |
import sys
import unittest
import mykaze
_mysql = mykaze
from mykaze.constants import FIELD_TYPE
from mykaze.tests import base
class TestDBAPISet(unittest.TestCase):
def test_set_equality(self):
self.assertTrue(mykaze.STRING == mykaze.STRING)
def test_set_inequality(self):
self.assertTrue(my... | {
"content_hash": "b9e0e31627eb383b5e7744ea180ebfca",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 80,
"avg_line_length": 31.789473684210527,
"alnum_prop": 0.6089403973509934,
"repo_name": "methane/MyKaze",
"id": "30ee1a4e561bbfeb35708b411473a5f28246baa9",
"size": "3020"... |
"""Resolvers for resource parameters."""
from googlecloudsdk.core import exceptions
class Error(exceptions.Error):
"""Errors for this module."""
class InconsistentArgumentError(Error):
def __init__(self, param, values):
super(InconsistentArgumentError, self).__init__(
'got multiple values for [{pa... | {
"content_hash": "edc14b6c48a7f153cee6046835780cbb",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 79,
"avg_line_length": 24.654545454545456,
"alnum_prop": 0.6762536873156342,
"repo_name": "Sorsly/subtle",
"id": "6771a80ccafb9ef9cf4ea4336fbae54ce0e67021",
"size": "1952",... |
from __future__ import unicode_literals
from django import forms
from django.forms.models import ModelForm
from .models import AceEditorPluginModel
from django.utils.translation import ugettext_lazy as _
class AceEditorPluginAdminForm(ModelForm):
class Meta:
model = AceEditorPluginModel
exclud... | {
"content_hash": "18ac83af83322285b53bdd299a6ae173",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 24.5,
"alnum_prop": 0.7188208616780045,
"repo_name": "TigerND/djangocms-ace",
"id": "8e32339c6c6f196533a726ccbe4f212a3be5b7c3",
"size": "465",
"bin... |
"""File downloading functions."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import os
import shutil
import time
from .progressbar import ProgressBar
from .numerics import hashfunc
from .misc import sizeof_fmt
from ._logging import logger, verbose
# Adapted from nilearn
... | {
"content_hash": "0d47489d3df89c8472b88410ba28e0e3",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 78,
"avg_line_length": 38.19444444444444,
"alnum_prop": 0.586,
"repo_name": "kambysese/mne-python",
"id": "e1f7b9b86b1935558132a40bdfc1303b7b1f4a5e",
"size": "5524",
"bi... |
from feed import Feed
from live import LiveFeedWidget
| {
"content_hash": "a1db1d94aac1f28e2545837b75756a7a",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 31,
"avg_line_length": 27,
"alnum_prop": 0.8518518518518519,
"repo_name": "mokshaproject/moksha",
"id": "4b550c42804c1b0602c80924713b41d1003a2b11",
"size": "672",
"binary"... |
import factory
from django.contrib.auth.hashers import make_password
from resrc.userprofile.models import Profile
class UserF(factory.django.DjangoModelFactory):
FACTORY_FOR = Profile
first_name = factory.Sequence(lambda n: "First%s" % n)
last_name = factory.Sequence(lambda n: "Last%s" % n)
email = factory.Se... | {
"content_hash": "c50f8a5ff7b77a32193d027aebf9d086",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 66,
"avg_line_length": 36.42857142857143,
"alnum_prop": 0.7352941176470589,
"repo_name": "sergiolimajr/resrc",
"id": "ed95abb0ccde7c1ffea19d82f0c1c1ad91e4fae2",
"size": "51... |
"""Module that provides the default converters and converter registry.
Converters will be auto registered in the ConverterRegistry like Django Model.
If you haven't specify the name attribute in Meta class, registry will auto use the class name.
Example:
class ConverterExample(BaseConverter):
@staticmeth... | {
"content_hash": "71a4f2f920407561ab385d2d5de94345",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 95,
"avg_line_length": 24.523255813953487,
"alnum_prop": 0.6154575628259839,
"repo_name": "romain-li/django-validator",
"id": "21784d83c35312880aa1953d707556f26df7f040",
"... |
import os
import sys
import time
import traceback
from _pydev_bundle import pydev_imports
from _pydevd_bundle.pydevd_utils import save_main_module
from socket import AF_INET
from socket import SOCK_STREAM
from socket import socket
from _prof_imports import ProfilerResponse
from prof_io import ProfWriter, ProfReader
fr... | {
"content_hash": "8d321131f32b6983653823556dc43e4f",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 126,
"avg_line_length": 28.220689655172414,
"alnum_prop": 0.6111925708699902,
"repo_name": "Soya93/Extract-Refactoring",
"id": "8c2ed576f815fda3fc9a562f726d3e4e33e32e04",
... |
"""
This is an example settings/local.py file.
These settings overrides what's in settings/base.py
"""
import logging
# To extend any settings from settings/base.py here's an example:
#from . import base
#INSTALLED_APPS = base.INSTALLED_APPS + ['debug_toolbar']
DATABASES = {
'default': {
'ENGINE': 'djang... | {
"content_hash": "60431ce05500e4e4cb714cb8d9f40b04",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 77,
"avg_line_length": 28.225490196078432,
"alnum_prop": 0.6634248002778743,
"repo_name": "sloria/wtfhack",
"id": "b1c9cf7e14171d84f0916275e24b91ec73e2f0b6",
"size": "2879... |
from __future__ import absolute_import
from __future__ import print_function
import unittest
import set_test_path
from weave_wdm_next_test_base import weave_wdm_next_test_base
import WeaveUtilities
class test_weave_wdm_next_mutual_subscribe_40(weave_wdm_next_test_base):
def test_weave_wdm_next_mutual_subscribe_4... | {
"content_hash": "d4576e853cf23aaa5a83378a13e4c223",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 173,
"avg_line_length": 60.625,
"alnum_prop": 0.5762886597938144,
"repo_name": "openweave/openweave-core",
"id": "1d270389293a3b4776beb9edccc810ae35af3ad5",
"size": "3782",... |
"""
Files Pipeline
See documentation in topics/media-pipeline.rst
"""
import hashlib
import os
import os.path
import time
import logging
from email.utils import parsedate_tz, mktime_tz
from six.moves.urllib.parse import urlparse
from collections import defaultdict
import six
try:
from cStringIO import StringIO a... | {
"content_hash": "a1880e2a4fa32ac0f84d821f91276df1",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 99,
"avg_line_length": 36.56845238095238,
"alnum_prop": 0.595588833726703,
"repo_name": "coderabhishek/scrapy",
"id": "a449793c9a72c84820ed6f4e008006fe849dbddf",
"size": "... |
from __future__ import absolute_import, print_function
import click
from sentry.runner.decorators import configuration
def _get_field(field_name):
from sentry.models import User
return User._meta.get_field(field_name)
def _get_email():
from django.core.exceptions import ValidationError
rv = click... | {
"content_hash": "426b97d5e40ecbdc18306c9dfc8836fa",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 96,
"avg_line_length": 30.464646464646464,
"alnum_prop": 0.6651193633952255,
"repo_name": "mvaled/sentry",
"id": "f84305e0b07e25841dd01d2f46dc578f9583a0a0",
"size": "3016",... |
import optparse, sys
from twisted.internet import defer
from twisted.internet.protocol import Protocol, ClientFactory
from twisted.protocols.basic import NetstringReceiver
def parse_args():
usage = """usage: %prog [options] [hostname]:port ...
This is the Get Poetry Now! client, Twisted version 7.0
Run it like ... | {
"content_hash": "4e9af6bf7b3510bb4c3a4c062b5f82e9",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 68,
"avg_line_length": 25.224489795918366,
"alnum_prop": 0.6383495145631068,
"repo_name": "jdavisp3/twisted-intro",
"id": "e430be72ac3fa65dfc68e56da3de3bc75f2de591",
"size... |
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import resource_helper
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
def _validate_list_of_port_dicts(values, data):
if not isinstance(values, list):
msg = _("'%s' is not a list")... | {
"content_hash": "fcab7c5177b4cfddcb3896cc13bd8f68",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 74,
"avg_line_length": 28.411290322580644,
"alnum_prop": 0.5410161793925632,
"repo_name": "lmaycotte/quark",
"id": "637c42f26d4cf9a30b0610bc8d7ec12f1cd60169",
"size": "411... |
desc="""calling a stored procedure"""
setup="""
"""
cleanup="""
"""
notes="""
To call a procedure which is part of a package, or a procedure which
is part of another schema, use dotted notation like this:
<ul>
<li>package_name.procedure_name
<li>schema_name.procedure_name
<li>schema_name.package_name.procedure_name
... | {
"content_hash": "2ee3a602ba22f9154d651f09d7712b2f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 68,
"avg_line_length": 24.186046511627907,
"alnum_prop": 0.7028846153846153,
"repo_name": "marhar/sqlminus",
"id": "9a8afd4443a53eae9e45570ef1915cb720421e00",
"size": "1281... |
"""Unpacker for Dean Edward's p.a.c.k.e.r"""
import re
import string
class UnpackingError(Exception):
"""Badly packed source or general error. Argument is a
meaningful description."""
pass
PRIORITY = 1
def detect(source):
"""Detects whether `source` is P.A.C.K.E.R. coded."""
return source.replace... | {
"content_hash": "362b857b1d9fd9ef29967e80f01b3979",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 74,
"avg_line_length": 32.258620689655174,
"alnum_prop": 0.5825761624799572,
"repo_name": "rysson/filmkodi",
"id": "9760505678af90a63ef8de2b73e9ea07eda7b331",
"size": "2161... |
"""
File: simpio.h
--------------
This file exports a set of functions that simplify input/output
operations in Python and provide some error-checking on console input.
Modified from Marty Stepp's CPP libraries.
@author sredmond
"""
GETINTEGER_DEFAULT_PROMPT = "Enter an integer: ";
GETINTEGER_DEFAULT_REPROMPT = "Ill... | {
"content_hash": "d1e1bf474ae51a136c09d7ce959abade",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 104,
"avg_line_length": 29.4125,
"alnum_prop": 0.6578835529111772,
"repo_name": "sredmond/acmpy",
"id": "03f524b2327a0f87cddfbd915ddff1f360642f5b",
"size": "2380",
"binar... |
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class MyHandler(FileSystemEventHandler):
def on_modified(self, event):
print "Got it!"
if __name__ =="__main__":
event_handler= MyHandler()
observer = Observer()
observer.schedule(event_handler, path="/home/p... | {
"content_hash": "2fba5cd03785d9c2820ca7a0e205f8ce",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 92,
"avg_line_length": 23.047619047619047,
"alnum_prop": 0.75,
"repo_name": "mauerflitza/Probieren2",
"id": "9529b00467ae47e94081ff1a8158301d2a4bba41",
"size": "502",
"bi... |
"""Tests for the elementbase class"""
import unittest
from starstruct.elementbase import ElementBase
# pylint: disable=line-too-long,invalid-name,no-self-use
class TestElementBase(unittest.TestCase):
"""ElementBase module tests"""
def test_valid(self):
"""Test field formats that are valid ElementBa... | {
"content_hash": "3d296df34b7a13a287837e2909566b31",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 73,
"avg_line_length": 32.27272727272727,
"alnum_prop": 0.4936619718309859,
"repo_name": "sprout42/StarStruct",
"id": "0de7955e46eb8f4c739b0f2ae91091472b6a9017",
"size": "1... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'GlobalRegion.icon_path'
db.add_column('location_globalregion', 'icon_path',
self.gf('django.db... | {
"content_hash": "c9d3dd9439cb934214de21f378787522",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 176,
"avg_line_length": 72.25,
"alnum_prop": 0.5432525951557093,
"repo_name": "uq-eresearch/uqam",
"id": "24c074f3217e6db31441071dff497e01603f538e",
"size": "8116",
"bin... |
import argparse
import csv
import re
# parser definition
parser = argparse.ArgumentParser(prog='Make csv file from wikipedia data')
parser.add_argument('--data_dir', type=str, default='wikipedia/',
help='Local dir to the txt files.')
parser.add_argument('--output_path', type=str, default='wiki.cs... | {
"content_hash": "bfbfb584d60d56ef93f5ccc796e7cac6",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 74,
"avg_line_length": 24.17391304347826,
"alnum_prop": 0.6163069544364509,
"repo_name": "random-forests/tensorflow-workshop",
"id": "61847ed1ccda619cc57acb54de3e1f9c50b7fcb7... |
from __future__ import unicode_literals
"""
Server side functions for tagging.
- Tags can be added to any record (doctype, name) in the system.
- Items are filtered by tags
- Top tags are shown in the sidebar (?)
- Tags are also identified by the tag_fields property of the DocType
Discussion:
Tags are shown in the d... | {
"content_hash": "8c790a4272cf6028cd975487c7db9bb6",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 89,
"avg_line_length": 25.36936936936937,
"alnum_prop": 0.6502130681818182,
"repo_name": "gangadhar-kadam/sapphite_lib",
"id": "00776f2913fb6cede004b65e9536d6017e02bf69",
... |
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as la
import sys
sys.path.append('..')
import uncompiled_floq.helpers as h
import uncompiled_floq.blockmatrix as bm
import uncompiled_floq.fixed_system as fs
import uncompiled_floq.errors as errors
import itertools
import copy
import cmath
def ge... | {
"content_hash": "8645fb2b60c9c41388125534ec6a58f0",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 97,
"avg_line_length": 28.176470588235293,
"alnum_prop": 0.6052974947807933,
"repo_name": "sirmarcel/floq",
"id": "1a0e32dcef9549f02a6fd968f816398c4c1ab714",
"size": "7664... |
from __future__ import unicode_literals
import multiprocessing
bind = "127.0.0.1:8000"
workers = multiprocessing.cpu_count() * 2 + 1
errorlog = "/opt/adcap.biz/log/adcap.biz_error.log"
loglevel = "info"
preload_app = True
| {
"content_hash": "1ebc469421eeaab43a8ec8e2d0979fff",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 51,
"avg_line_length": 28,
"alnum_prop": 0.7232142857142857,
"repo_name": "RobSpectre/salt-states",
"id": "0726c7f9eafc036248ff44f5bd2dcfcf3748e71d",
"size": "224",
"binar... |
"""Subfunction for the Google command line tool, GoogleCL.
This function handles the authentication and storage of
credentials for the services which use OAuth2
"""
import httplib2
import logging
import pickle
import os
import googlecl
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebSer... | {
"content_hash": "36625ee91479051185b8171b8f48e5ec",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 72,
"avg_line_length": 34.673469387755105,
"alnum_prop": 0.7098293113596233,
"repo_name": "charany1/googlecl",
"id": "8fca3b14304e47830af43008a242d917144846a2",
"size": "22... |
import functools
import os
import pytest
from limejudge import anscompare
def test_compare_no_extra_ws(tmpdir):
outfile = tmpdir.join('outfile')
ansfile = tmpdir.join('ansfile')
outname = str(outfile)
ansname = str(ansfile)
nonexistent = os.path.join(str(tmpdir), 'nonexistent')
cmp_noextraw... | {
"content_hash": "e7d333e00a746b353a375e5b2b330fe6",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 72,
"avg_line_length": 31.71,
"alnum_prop": 0.6549984232103437,
"repo_name": "yyt16384/limejudge",
"id": "44d7d45c96a80c687d4fa48905f344c897755ee2",
"size": "3171",
"bin... |
def bigend_24b(self, b1, b2, b3):
"""This function converts big endian bytes to readable value 0~255"""
b1 = int(b1, 16)
b2 = int(b2, 16)
b3 = int(b3, 16)
return (b1*256*256) + (256*b2) + b3
#return int(b1,16)*65536+int(b2,16)*256+int(b3,16)
class Parser(object):
"""The parser class of... | {
"content_hash": "410c6a95c2a418f1a0cc378074f03f36",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 101,
"avg_line_length": 36.55913978494624,
"alnum_prop": 0.44735294117647056,
"repo_name": "osrf/gsoc-ros-neural",
"id": "0c8f816fd66a0135e636e65c604f1afefdbcdf20",
"size"... |
from __future__ import absolute_import
import pytest
from .utils import create_test_db # noqa
from mandroobi.models.metrics import ClosingBalance, Metric
def test_metric():
metric = Metric()
metric.account_id = '50000'
metric.accounting_period_id = '19991231'
metric.business_unit_id = 'NORTH'
m... | {
"content_hash": "b570fbd0b6f8f33890961be245b47bba",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 28.435897435897434,
"alnum_prop": 0.678990081154193,
"repo_name": "ivansabik/mandroobi",
"id": "bbf6c13f2218f77fdf2eddb4cf9852467f3c9d4a",
"size": "1... |
import random
import re
import unicodedata
from eventlet import greenthread
from oslo.utils import excutils
from oslo.utils import strutils
import six
from cinder import context
from cinder import exception
from cinder.i18n import _, _LE, _LI, _LW
from cinder.openstack.common import log as logging
from cinder.opensta... | {
"content_hash": "36187469852cc86224abb1b378592b9c",
"timestamp": "",
"source": "github",
"line_count": 956,
"max_line_length": 79,
"avg_line_length": 41.49058577405858,
"alnum_prop": 0.5260809277700744,
"repo_name": "hguemar/cinder",
"id": "acc4de9fae7e1fbe92b0df37fd5e2bcf88f8f362",
"size": "40292... |
from .schema import Class, Field, Union, Constant, Map, Sequence, Boolean, Integer, String, Base64, SchemaError
class Registry(object):
def __init__(self, type, url, verify, user, password, namespace=None):
self.type = type
self.url = url
self.verify = verify
self.user = user
... | {
"content_hash": "d84c2b900bd08ef998312b405402d6d6",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 240,
"avg_line_length": 42.0551724137931,
"alnum_prop": 0.6280747786159396,
"repo_name": "datawire/forge",
"id": "520fa71937fc45871664e98951835ae8adebaa67",
"size": "6693"... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.pa... | {
"content_hash": "ba59eae29e2e811aa87b227ec4e850c8",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 193,
"avg_line_length": 32.94871794871795,
"alnum_prop": 0.703242542153048,
"repo_name": "dustywind/bachelor-thesis",
"id": "03184cc606ae0a260fde89ea5d51556810bab86f",
"si... |
import os
import re
import sys
from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE
import six
from _version import __version__
# imported lazily to avoid startup performance hit if it isn't used
compiler = None
# A dictionary mapping BOM to
# the encoding to decode with, and what to set the
# encodin... | {
"content_hash": "a7c3968dd866dfd23e91e125b669ab21",
"timestamp": "",
"source": "github",
"line_count": 2468,
"max_line_length": 114,
"avg_line_length": 36.09724473257698,
"alnum_prop": 0.5180832435344828,
"repo_name": "mudbungie/NetExplorer",
"id": "ba886e8639291feabd045dcdf2aedb5ba5a7667a",
"size... |
from openflow.optin_manager.sfa.rspecs.elements.element import Element
class OpenFlowSwitch(Element):
fields = [
'component_id',
'component_manager_id',
'dpid',
'port',
]
| {
"content_hash": "65047f72ac03fd0ad69abe6e8ad48e5f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 70,
"avg_line_length": 18.181818181818183,
"alnum_prop": 0.65,
"repo_name": "ict-felix/stack",
"id": "38ac938b0f43396a07f45e9a25dda0b6ca6d79e7",
"size": "200",
"binary": ... |
from msrest.serialization import Model
class ApplicationGatewayBackendHealthServer(Model):
"""Application gateway backendhealth http settings.
:param address: IP address or FQDN of backend server.
:type address: str
:param ip_configuration: Reference of IP configuration of backend server.
:type i... | {
"content_hash": "c59cd5fad201d5e97898b0a7931615ad",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 87,
"avg_line_length": 42.214285714285715,
"alnum_prop": 0.6683587140439933,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "94f4dee82abeb2e71dbb391bb2f6e9bf0c610ded",
... |
<<<<<<< HEAD
<<<<<<< HEAD
# Check that multiple features can be enabled.
from __future__ import unicode_literals, print_function
import sys
import unittest
from test import support
class TestMultipleFeatures(unittest.TestCase):
def test_unicode_literals(self):
self.assertIsInstance("", str)
def tes... | {
"content_hash": "3faa1c4499ba2b3d1d483123a2986cb5",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 55,
"avg_line_length": 24.202898550724637,
"alnum_prop": 0.6706586826347305,
"repo_name": "ArcherSys/ArcherSys",
"id": "228469643f4b3340230152274b7cd8d8bfc2107b",
"size": "... |
"""Live value resolution.
Live values are extracted from the known execution context.
Requires activity analysis annotations.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gast
from tensorflow.contrib.py2tf.pyct import anno
from tensorflow.c... | {
"content_hash": "b6f7916fffa05a7efacfe459595267de",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 80,
"avg_line_length": 40.89795918367347,
"alnum_prop": 0.655938123752495,
"repo_name": "av8ramit/tensorflow",
"id": "9c0a9a9e74eccb3d22840032e8f0c2b81e051e7e",
"size": "46... |
from underscore.underscore import _
from ctf import *
import json
def handle(data, *a):
return _(data['courses']).map(lambda x, *a: (data['school'], x['name']))
data = json.load(open('courses.json'))
result = _(data).chain()
.pluck('response')
.map(lambda x, *a: json.loads(x))
.map(handle)
.flatte... | {
"content_hash": "672802d7eebc0e64f735756efeade056",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 76,
"avg_line_length": 23.058823529411764,
"alnum_prop": 0.6096938775510204,
"repo_name": "ripples-alive/Crawler",
"id": "0f632d7e0b81e8584910a05fa1c5371d4c57f24f",
"size":... |
import sys
from itertools import ifilter
import requests
import json
from pprint import pprint
class FacebookDataIngestSource:
"""Ingest data from Facebook"""
def __init__(self, config):
self.config = config
self.pages = []
self.post = []
self.index = 0
def __iter__(self):
if 'track' ... | {
"content_hash": "18c1aa6a2d59bbc445e7e7c93d4b7a8c",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 156,
"avg_line_length": 33.541666666666664,
"alnum_prop": 0.6244306418219462,
"repo_name": "W205-Social-Media/w205-data-ingest",
"id": "5d51ec424101e6f4adbc528af305134dd47941... |
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.httpclient
import time
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
class SleepHandler(tornado.web.RequestHandler):
def get(self):
t... | {
"content_hash": "efe7c4bdbc0c6f1fe9e53f434b1df2f0",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 73,
"avg_line_length": 30,
"alnum_prop": 0.7037037037037037,
"repo_name": "dongweiming/speakerdeck",
"id": "271359c1f51ed43a6c4bd59b41b5da52833dbf21",
"size": "829",
"bin... |
"""Common functions for skydoc."""
import collections
import re
import textwrap
from xml.sax.saxutils import escape
ARGS_HEADING = "Args:"
EXAMPLES_HEADING = "Examples:"
EXAMPLE_HEADING = "Example:"
OUTPUTS_HEADING = "Outputs:"
class InputError(Exception):
pass
class ExtractedDocs(object):
"""Simple class to... | {
"content_hash": "b35f450d9367605cbdfff69bd1d5b7b2",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 88,
"avg_line_length": 30.790123456790123,
"alnum_prop": 0.6672012830793905,
"repo_name": "bazelbuild/skydoc",
"id": "8ec4bd5982fe3959ee8310b3090de30ecc64259e",
"size": "5... |
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.core.urlresolvers import reverse, reverse_lazy
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect, rende... | {
"content_hash": "fbbf1ce17702e56e38c0e23f34ce7a74",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 79,
"avg_line_length": 36.670967741935485,
"alnum_prop": 0.6340605207600282,
"repo_name": "pythonindia/wye",
"id": "d28e9f661eeb36275908ae5ac762f87fc435efe3",
"size": "113... |
from pyramid import httpexceptions
from . import BaseTest
class ModelTest(BaseTest):
def setUp(self):
super(ModelTest, self).setUp()
self.record = self.model.create_record({'field': 'value'})
def test_list_gives_number_of_results_in_headers(self):
self.resource.collection_get()
... | {
"content_hash": "9b27ec88b4e9f1da0f022ad2614d4eda",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 76,
"avg_line_length": 36.111111111111114,
"alnum_prop": 0.6483916083916084,
"repo_name": "monikagrabowska/osf.io",
"id": "e676c6276c62068c856fc229ad3a9e6640484741",
"size"... |
print(__doc__)
# Authors: Vlad Niculae, Alexandre Gramfort
# License: BSD 3 clause
import logging
from time import time
import os
import sys
import numpy as np
from numpy.random import RandomState
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_olivetti_faces
from sklearn.cluster import MiniBatch... | {
"content_hash": "ea1b4069a0c4b287f4afc3310e61947b",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 112,
"avg_line_length": 34.94202898550725,
"alnum_prop": 0.6061800082953132,
"repo_name": "gregversteeg/LinearSieve",
"id": "1e9dc965a5bfc6f11b14862b703e832408c79cc0",
"si... |
"""Base implementation of event loop.
The event loop can be broken up into a multiplexer (the part
responsible for notifying us of IO events) and the event loop proper,
which wraps a multiplexer with functionality for scheduling callbacks,
immediately or at a given time in the future.
Whenever a public API takes a ca... | {
"content_hash": "3dbda64efe86531868dddf185f52528e",
"timestamp": "",
"source": "github",
"line_count": 828,
"max_line_length": 79,
"avg_line_length": 38.51932367149758,
"alnum_prop": 0.5510440835266821,
"repo_name": "leetreveil/tulip",
"id": "d2bdc07d36c23b1d963f088a8e8d44ec75481055",
"size": "318... |
from __future__ import print_function, unicode_literals
from django.core.cache import cache
from django.db.models import signals
from cmstemplates import models as m
def delete_templategroup_cache(sender, instance, **kwargs):
cache.delete(instance.cache_key)
def delete_template_templategroup_cache(sender, ins... | {
"content_hash": "9c61bb72a991c837c87ca3217c19a54d",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 68,
"avg_line_length": 25.743589743589745,
"alnum_prop": 0.7599601593625498,
"repo_name": "asyncee/django-cmstemplates",
"id": "f6e121b371e7eefd158cc502bf4e33d05f4c52c2",
"... |
from warnings import warn
from itertools import product
import numpy as np
from skbio.alignment import TabularMSA
from skbio.alignment._ssw_wrapper import StripedSmithWaterman
from skbio.sequence import DNA, RNA, Protein
from skbio.sequence import GrammaredSequence
from skbio.util import EfficiencyWarning
from skbio.... | {
"content_hash": "bbcced1e3977338905b2d0dd28b1fc6a",
"timestamp": "",
"source": "github",
"line_count": 1029,
"max_line_length": 79,
"avg_line_length": 42.2575315840622,
"alnum_prop": 0.5672331715842973,
"repo_name": "anderspitman/scikit-bio",
"id": "9669962e70df8fb10ea77017427dc67a7bd1194f",
"size... |
from traceback import format_exc
from logging import getLogger
# pylint: disable=F0401
from paste.deploy.converters import asbool
# pylint: enable=F0401
from simplejson import JSONEncoder
# pylint: disable=C0103
_json_encoder = JSONEncoder(encoding='utf-8', separators=(',',':'))
# pylint: enable=C0103
from turbulenz... | {
"content_hash": "409e8f1e618f777f2a57e92dbc8c20a3",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 109,
"avg_line_length": 41.54054054054054,
"alnum_prop": 0.5858815875081327,
"repo_name": "turbulenz/turbulenz_local",
"id": "8b9b712dfde2b042907b560fe1ad84e4577709d4",
"si... |
from contextlib import contextmanager
import filecmp
import os
import posix
import stat
import sys
import sysconfig
import time
import unittest
from ..helpers import st_mtime_ns
from ..xattr import get_all
try:
import llfuse
# Does this version of llfuse support ns precision?
have_fuse_mtime_ns = hasattr(l... | {
"content_hash": "ede9b707e17327cd33827425c88a1a6e",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 86,
"avg_line_length": 37.73076923076923,
"alnum_prop": 0.6083078491335372,
"repo_name": "level323/borg",
"id": "cd790b57149091c7b61e98fbe63ec36d8ecc42cc",
"size": "3924",... |
import logging
logger = logging.getLogger(__name__)
def configure_logging():
"""Definiciones y configuraciones iniciales."""
handler_console = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s | %(levelname)-8s | %(message)s')
handler_console.setFormatter(formatter)
logger.add... | {
"content_hash": "6d89ca41298e0972393699566f4bc6f7",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 80,
"avg_line_length": 23.033333333333335,
"alnum_prop": 0.6685962373371924,
"repo_name": "javiromero/pycones2017",
"id": "5161890f5dba6ce6281b0937fee0a98dbd42cb8d",
"size"... |
"""Generates a toy v1 saved model for testing."""
import shutil
from absl import app
from absl import flags
from tensorflow.python.client import session
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import array_ops
from tensorflow.python.... | {
"content_hash": "4210e756698e0dc4e683d2e6fc4b9763",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 80,
"avg_line_length": 34.671875,
"alnum_prop": 0.7278053177106805,
"repo_name": "Intel-Corporation/tensorflow",
"id": "a425b6c6e2fed5f1afa0b636f9ac15d87339cbc6",
"size": "... |
"""Test the -alertnotify, -blocknotify and -walletnotify options."""
import os
from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE, keyhash_to_p2pkh
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
hex_str_to_bytes,
)
# Linux allow all cha... | {
"content_hash": "99cc0d38a2578ebd302fbed692b936d9",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 152,
"avg_line_length": 50.59722222222222,
"alnum_prop": 0.6437002470491353,
"repo_name": "jnewbery/bitcoin",
"id": "f2313bac13c868ed039d7e348cbdfd958424af3b",
"size": "75... |
from setuptools import setup
# auto-convert README.md
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except (ImportError, OSError):
# we'll just use the poorly formatted Markdown file instead
long_description = open('README.md').read()
setup(
name='wireless',
vers... | {
"content_hash": "42b7138a365c180ba7b19a132dc501cb",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 25.87878787878788,
"alnum_prop": 0.639344262295082,
"repo_name": "joshvillbrandt/wireless",
"id": "fc0a98672febefc92bf5587debfa4abf2a8d9069",
"size":... |
"""Test the fundrawtransaction RPC."""
from decimal import Decimal
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_fee_amount,
assert_greater_than,
assert_greater_than_or_equal,
assert_raises_rpc_error,
connect_nodes,
cou... | {
"content_hash": "7bb7c36dff765b21ffbe2860383f7220",
"timestamp": "",
"source": "github",
"line_count": 769,
"max_line_length": 174,
"avg_line_length": 44.77113133940182,
"alnum_prop": 0.6216271166748961,
"repo_name": "midnightmagic/bitcoin",
"id": "57c8f511acd1f2766296480680a42b4eaeacf95c",
"size"... |
from __future__ import absolute_import
from .mock import _all_auth_mock_
from .mock import public_incursion
from .mock import public_incursion_no_expires
from .mock import public_incursion_no_expires_second
from .mock import public_incursion_warning
from .mock import public_incursion_server_error
from esipy import App... | {
"content_hash": "fe55227ce8f54e87636a776e3348f678",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 78,
"avg_line_length": 36.375,
"alnum_prop": 0.6311978399607265,
"repo_name": "a-tal/EsiPy",
"id": "171b6e3810a757de3c8c9c53741600a3b5540f6a",
"size": "8174",
"binary": ... |
"""
Feature file parser.
One Feature file parser instance is able to parse one feature file.
"""
import os
import io
import re
import json
import filecmp
import copy
import string
from .compat import RecursionError
from .exceptions import RadishError, FeatureFileSyntaxError, LanguageNotSupportedError
from .feature im... | {
"content_hash": "c3a6f5a4748263d7d2c17d6ad00edd86",
"timestamp": "",
"source": "github",
"line_count": 782,
"max_line_length": 116,
"avg_line_length": 33.39897698209719,
"alnum_prop": 0.5567424764530209,
"repo_name": "radish-bdd/radish",
"id": "181fa6fed6d0894a953c038419c1f4c8fc832614",
"size": "2... |
'''
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License");... | {
"content_hash": "4bfde01f656ee7cd61a6b6d5e6c46220",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 172,
"avg_line_length": 43.75,
"alnum_prop": 0.7496774193548387,
"repo_name": "clearswift/trafficserver",
"id": "15b845d9cc7de3aa1902d07379e03a1dc899e093",
"size": "5425",... |
from oslo_log import log as logging
from neutron.api import extensions
from neutron.api.v2 import attributes
LOG = logging.getLogger(__name__)
FLAVOR_NETWORK = 'flavor:network'
FLAVOR_ROUTER = 'flavor:router'
FLAVOR_ATTRIBUTE = {
'networks': {
FLAVOR_NETWORK: {'allow_post': True,
... | {
"content_hash": "1354b64a553af973a7843acb1d51809d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 66,
"avg_line_length": 24.53061224489796,
"alnum_prop": 0.559900166389351,
"repo_name": "eonpatapon/neutron",
"id": "9cafb13ef0a33659694366d4c53f3efeab0cba46",
"size": "184... |
import gc
import linecache
import tracemalloc
tracemalloc.start()
def display_top(snapshot, key_type="lineno", limit=10):
# via: https://docs.python.org/3/library/tracemalloc.html#pretty-top
snapshot = snapshot.filter_traces(
(
tracemalloc.Filter(False, "<frozen importlib._bootstrap_exter... | {
"content_hash": "302537079e341469d3dd2b90323c1afd",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 95,
"avg_line_length": 30.34246575342466,
"alnum_prop": 0.5932279909706546,
"repo_name": "mandiant/capa",
"id": "349f6ee90d0fc91042de08f8b77777cf9006a894",
"size": "2215",
... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from .visualize import violinplot
def add_noise(data, iteration_per_noise=100,
noise_percentages=np.arange(0, 101, step=10), plot=True,
violinplot_kws=None, figure_prefix='anchor_simulation'):
... | {
"content_hash": "53049574eb078f27426d442819635f29",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 38.89393939393939,
"alnum_prop": 0.5056486170627191,
"repo_name": "olgabot/anchor",
"id": "75ee38eb472fe95316f4e0e4f1bab2f43a92e657",
"size": "2568",... |
from xd.build.core.recipe_file import *
from case import *
import unittest
import io
class tests(unittest.case.TestCase):
def test_split_no_version(self):
name, version = RecipeFile.split_name_and_version('foo')
self.assertEqual(name, 'foo')
self.assertEqual(str(version), '')
def tes... | {
"content_hash": "33ccbdadba7306329545da8b934f31a0",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 77,
"avg_line_length": 35.278688524590166,
"alnum_prop": 0.6194237918215614,
"repo_name": "XD-embedded/xd-build-core",
"id": "1cc803032bd71ae23a8a5845fea14a55f21678cc",
"s... |
class Directory(object):
def __init__(self, name):
self._name = name
self._content = []
self._directories = {}
def __len__(self):
return len(self._directories)
def __getitem__(self, i):
return self._directories[i]
def get_directory(self, name):
return s... | {
"content_hash": "4a1a1a1fc8ea663fa65ae92b434252a4",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 85,
"avg_line_length": 29.386554621848738,
"alnum_prop": 0.5756362596511295,
"repo_name": "sondree/b2_fuse",
"id": "f08da24efa0ad1c95eb3a53a25684f272165ad3b",
"size": "464... |
import pandas as pd
import numpy as np
import math
import copy
import QSTK.qstkutil.qsdateutil as du
import datetime as dt
import QSTK.qstkutil.DataAccess as da
import QSTK.qstkutil.tsutil as tsu
import QSTK.qstkstudy.EventProfiler as ep
import time
#Holds data related to order
#Executes order on a given timeseries
cl... | {
"content_hash": "145dd1e7d77eef1ba5a631594718d201",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 30.87037037037037,
"alnum_prop": 0.6250749850029994,
"repo_name": "GedRap/voyager",
"id": "741bc3435cfcab6f69b4b58b62a1bf5111a67607",
"size": "1667",... |
BROKER_URL = 'sqla+sqlite:///perfrunner.db'
CELERY_RESULT_BACKEND = 'database'
CELERY_RESULT_DBURI = 'sqlite:///results.db'
| {
"content_hash": "0cf0c574e79077c48bba0544b3ccbc1e",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 44,
"avg_line_length": 41.333333333333336,
"alnum_prop": 0.7258064516129032,
"repo_name": "pavel-paulau/perfrunner",
"id": "435c01b39da33bcd9ab90bb85704ee443eb1c249",
"size"... |
"""Main entry point into the Identity service."""
import abc
import functools
import os
import uuid
from oslo.config import cfg
from oslo.utils import importutils
import six
from keystone import clean
from keystone.common import dependency
from keystone.common import driver_hints
from keystone.common import manager
... | {
"content_hash": "18e8118d76e93d04dd4c3273adc67e92",
"timestamp": "",
"source": "github",
"line_count": 1110,
"max_line_length": 79,
"avg_line_length": 39.51891891891892,
"alnum_prop": 0.614553412665846,
"repo_name": "hughsaunders/keystone",
"id": "ef0b36f6fcd7e7f2c7928c14ff5d7e963f00ccf4",
"size":... |
from org.o3project.odenos.core.component.network.flow.ofpflow.ofp_flow_action_set_ip_ttl\
import OFPFlowActionSetIpTtl
import unittest
class OFPFlowActionSetIpTtlTest(unittest.TestCase):
def setUp(self):
self.target = OFPFlowActionSetIpTtl("OFPFlowActionSetIpTtl",
... | {
"content_hash": "8f5c70bab228777b60807c045e354d0d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 89,
"avg_line_length": 32.82222222222222,
"alnum_prop": 0.5964793500338524,
"repo_name": "y-higuchi/odenos",
"id": "b97e3ca058edeec3f655c0409402289872e093de",
"size": "2503... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
# -- General conf... | {
"content_hash": "d10252fcb4cadef82779efd39a9fd021",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 79,
"avg_line_length": 31.857142857142858,
"alnum_prop": 0.7040358744394619,
"repo_name": "baharev/sdopt-tearing",
"id": "dbc336277c1900b025bc2b1f682c9a0a6764cc5d",
"size"... |
import argparse
import os
import platform
import subprocess
import sys
from lib.config import get_target_arch, PLATFORM
from lib.util import get_host_arch, import_vs_env
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def main():
os.chdir(SOURCE_ROOT)
if PLATFORM != 'win32' and platf... | {
"content_hash": "84432002a65f539b9f4ae06edfb7027e",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 78,
"avg_line_length": 31.92391304347826,
"alnum_prop": 0.6561116785835887,
"repo_name": "kcrt/electron",
"id": "a67a49e7ab518f1b2989b05e1acb7dae4c902b96",
"size": "2960",
... |
import psutil
# project
from checks import AgentCheck
class SystemCore(AgentCheck):
def check(self, instance):
instance_tags = instance.get('tags', [])
cpu_times = psutil.cpu_times(percpu=True)
self.gauge("system.core.count", len(cpu_times), tags=instance_tags)
for i, cpu in enu... | {
"content_hash": "8e10ab3573516b7d7eccbf9cdce26863",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 75,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.5365853658536586,
"repo_name": "serverdensity/sd-agent-core-plugins",
"id": "2b1b1de1c6e2fdf465f7714940dfdb22e549cf... |
"""momentsinfo_convroll4_doublescale_fs5"""
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
batch_size = 128
chunk_size = 32768
num_chunks_train = 240
momentum = 0.9
learning_rate_schedule = {
... | {
"content_hash": "f69601bd2ff7f8de15eabf9f330c3dc4",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 186,
"avg_line_length": 32.38823529411765,
"alnum_prop": 0.7083181983290955,
"repo_name": "freakynit/kaggle-ndsb",
"id": "3974cc00a61141ff6c309cd69bde76a1326884f2",
"size":... |
import threading
import logging
class MyThreadWithArgs(threading.Thread):
def __init__(self, group=None, target=None, name=None,
args=(), kwargs=None, *, daemon=None):
super().__init__(group=group, target=target, name=name,
daemon=daemon)
self.args = args... | {
"content_hash": "46d9409a42338cce72640e6b869ba63d",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 64,
"avg_line_length": 23.607142857142858,
"alnum_prop": 0.5642965204236006,
"repo_name": "jasonwee/asus-rt-n14uhp-mrtg",
"id": "ce9076cb4ef022c31975903b0017e19021f088dc",
... |
from __future__ import unicode_literals
import json
import requests
import six
from datetime import datetime
from six.moves.urllib.parse import parse_qs
from xml.etree.ElementTree import tostring, SubElement, Element
from .exceptions import (
XeroBadRequest, XeroExceptionUnknown, XeroForbidden, XeroInternalError... | {
"content_hash": "d005dc5c805474ec5660e033c2ecfe72",
"timestamp": "",
"source": "github",
"line_count": 373,
"max_line_length": 105,
"avg_line_length": 36.06970509383378,
"alnum_prop": 0.5398394529507953,
"repo_name": "wegotpop/pyxero",
"id": "57234f4bc7d44174316ff8a6d006e8b78c3a64a6",
"size": "134... |
"""Leetcode 958. Check Completeness of a Binary Tree
Medium
URL: https://leetcode.com/problems/check-completeness-of-a-binary-tree/
Given a binary tree, determine if it is a complete binary tree.
Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is ... | {
"content_hash": "517473b841e5b416c9f4fd0d0d5ab0c8",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 167,
"avg_line_length": 28.681818181818183,
"alnum_prop": 0.6446117274167987,
"repo_name": "bowen0701/algorithms_data_structures",
"id": "95b0395e5072c0805496d8f0dcd1ea3aea89... |
"""Generate an Abstract Syntax Tree (AST) for C++."""
__author__ = 'nnorwitz@google.com (Neal Norwitz)'
# TODO:
# * Tokens should never be exported, need to convert to Nodes
# (return types, parameters, etc.)
# * Handle static class data for templatized classes
# * Handle casts (both C++ and C-style)
# * Hand... | {
"content_hash": "31102fcd0600ce7b4edf4c468404371e",
"timestamp": "",
"source": "github",
"line_count": 1716,
"max_line_length": 82,
"avg_line_length": 36.20804195804196,
"alnum_prop": 0.539278644198735,
"repo_name": "NervanaSystems/aeon",
"id": "4e0aca423144de214cb7b9e538318c8aee5c0ec0",
"size": "... |
def extractAviantlWordpressCom(item):
'''
Parser for 'aviantl.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous'... | {
"content_hash": "00187a772eeef7acc2a39f39f78cc65c",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.6311030741410488,
"repo_name": "fake-name/ReadableWebProxy",
"id": "2bb285743b98dfc3f842e7d7f2566376b4c2fbb1",
"... |
import warnings
import sys
import argparse
from etk.extractors.cve_extractor import CVEExtractor
cve_extractor = CVEExtractor()
def add_arguments(parser):
"""
Parse arguments
Args:
parser (argparse.ArgumentParser)
"""
parser.description = 'Examples:\n' \
'python ... | {
"content_hash": "12df8e537b3005a362f5349ad7964dcc",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 96,
"avg_line_length": 26.303030303030305,
"alnum_prop": 0.6105990783410138,
"repo_name": "usc-isi-i2/etk",
"id": "e2200b514d7a06fe8b8a6d55ac816a0561e2e136",
"size": "868",... |
import sahara.exceptions as e
from sahara.i18n import _
from sahara.service.edp import api
from sahara.utils import edp
JOB_SCHEMA = {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 50,
"format": "valid_name"
... | {
"content_hash": "c306af4f04d252e0c8a08fcf78f876c1",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 78,
"avg_line_length": 30.49438202247191,
"alnum_prop": 0.4848931466470155,
"repo_name": "redhat-openstack/sahara",
"id": "3d51c9673e33ebce349ef74a162383e4977acbb5",
"size"... |
from django.shortcuts import render, get_object_or_404
from django.template import loader
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views import generic
from django.utils import timezone
# Create your views here.
from .models import Ques... | {
"content_hash": "e76962821410aab2e6ce9e37cbe34227",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 82,
"avg_line_length": 33.29824561403509,
"alnum_prop": 0.6743940990516333,
"repo_name": "kapucko/fit2gether",
"id": "b707c2c5aa54020b9d1d57bdde4e1bc381bdbad3",
"size": "18... |
import rospy
from monitored_navigation.monitor_state import MonitorState
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
from std_msgs.msg import Bool
class MonitorStuckOnCarpet(MonitorState):
def __init__(self):
self.goal_z=0
self.current_z=0
self.n_fails... | {
"content_hash": "2a5b7a7abc3df7de6b119b89c24033b8",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 147,
"avg_line_length": 25.8,
"alnum_prop": 0.5983086680761099,
"repo_name": "strands-project/strands_recovery_behaviours",
"id": "fe09b64fb2cf01267fb540d32d761d52464efc07",
... |
import matplotlib.pylab as plt
import numpy as np
from renderer import PlottingFun as pf
fig = plt.figure(figsize=(8,6))
ax = fig.add_subplot(111)
pf.AxisFormat()
ax.plot(np.arange(0,100), np.arange(0,100), 'b-', linewidth =2)
plt.show() | {
"content_hash": "ee45cc6a0d6366e8d3f24e00b0045113",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 65,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.692,
"repo_name": "bps10/emmetrop",
"id": "7380c83ae34bf7ea596ecd9e9640b80b0e9d15c5",
"size": "250",
"binary": ... |
"""
Bayesian Estimation of MSMs
< http://msmbuilder.org/latest/examples/bayesian-msm.html>
"""
import numpy as np
from matplotlib import pyplot as plt
plt.style.use("ggplot")
from mdtraj.utils import timing
from msmbuilder.example_datasets import load_doublewell
from msmbuilder.cluster import NDGrid
from msmbuilder.m... | {
"content_hash": "81f69f58b4465adb21a516831e7c62ee",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 69,
"avg_line_length": 25.8,
"alnum_prop": 0.7926356589147286,
"repo_name": "jeiros/Scripts",
"id": "dfc34539ce9de5d350acd9e8400063b383caa58c",
"size": "538",
"binary": f... |
'''
Created on Apr 21, 2014
@author: ronald
'''
import math
from counter import *
LOG = 'logaritmic'
SQRT = 'sqrt'
TRUNC = 'truncation'
def makeJSON(NG):
""" input: (str) formato: lista de {name:ngram,size:score}
output: string en formato json
descrip: construye dict tipo json
"""
json... | {
"content_hash": "06438d8ef6a5d9076da09ceb34c592c6",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 145,
"avg_line_length": 35.83173076923077,
"alnum_prop": 0.5727894807460083,
"repo_name": "ronaldahmed/labor-market-demand-analysis",
"id": "26b7a08358499df54245e3e05fb466d0... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('exercise', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='exercise',
old_name='type_of_game',
... | {
"content_hash": "a183eb01321444057f5da07d3c471c29",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 74,
"avg_line_length": 23.565217391304348,
"alnum_prop": 0.559040590405904,
"repo_name": "DADco/convalesense-web",
"id": "6011273fc3ccbc7e5071781e93deed54bd81e0b5",
"size":... |
"""Tests for f_net.input_pipeline."""
import functools
from typing import Sequence
from absl.testing import absltest
from absl.testing import parameterized
import numpy as np
import tensorflow_datasets as tfds
from f_net import input_pipeline
import sentencepiece as spm
class MockTokenizer(spm.SentencePieceProcess... | {
"content_hash": "021082b88c4d3416122a7ee723236e87",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 78,
"avg_line_length": 29.52857142857143,
"alnum_prop": 0.6415094339622641,
"repo_name": "google-research/google-research",
"id": "04529373f2c02e8ea41d2e1b942d935b654b077f",
... |
import json
import gconf
import MySQLdb
from dbutils import execute_sql
def get_users():
sql = 'select * from user'
rt = []
columns=("id","username","password","age")
count, rt_list = execute_sql(sql)
for line in rt_list:
rt.append(dict(zip(columns, line)))
return rt
def validate_login(username, password):
... | {
"content_hash": "30112fd472a7015e04a9e9c75ad62309",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 124,
"avg_line_length": 28.548387096774192,
"alnum_prop": 0.672316384180791,
"repo_name": "51reboot/actual_09_homework",
"id": "2bd6fd9b280abcbbfadd28a9a32f8a61a41376a0",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.