text stringlengths 4 1.02M | meta dict |
|---|---|
import tokrules
import ply.lex as lex
from parser import *
import parser# as myparser
import ply.yacc as yacc
from tokrules import tokens
def unify(x, y, theta=None):
if not theta:
return
elif x is y:
return theta
elif isinstance(x, list) and isinstance(y, list):
if len(x)==1:
... | {
"content_hash": "221fcf78eb8e64d9420a8d937b8e0148",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 57,
"avg_line_length": 26.18,
"alnum_prop": 0.5752482811306341,
"repo_name": "saketkc/hatex",
"id": "f1654b5d98703cd09eaa9285c8765aa3b6d12602",
"size": "1309",
"binary": ... |
import time
import datetime
class ExecutionTime:
"""
前のstartからの時間を計測
"""
def __init__(self):
self._t = 0
def start(self):
print (datetime.datetime.today())
self._t = time.time()
def end(self):
end = time.time()
print (datetime.datetime.toda... | {
"content_hash": "079489555a0bb6edb6e6ea3e31078fe4",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 21.157894736842106,
"alnum_prop": 0.5099502487562189,
"repo_name": "AtsushiHashimoto/fujino_mthesis",
"id": "fee4668dadde9da0e8b83651484499db40017ee2",... |
from flask import redirect, request, url_for
from werkzeug.exceptions import NotFound
from indico.core.config import config
from indico.core.db import db
from indico.modules.events import Event
from indico.modules.events.controllers.display import RHDisplayEvent
from indico.modules.events.models.legacy_mapping import ... | {
"content_hash": "46e4753bab52e62df8ada5feefd4a4ae",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 112,
"avg_line_length": 48.702127659574465,
"alnum_prop": 0.6439493228484054,
"repo_name": "DirkHoffmann/indico",
"id": "cb0bdea92f79e1d5a4dc47330545f037fb7ef38b",
"size": ... |
import proto # type: ignore
from google.ads.googleads.v10.enums.types import lead_form_field_user_input_type
__protobuf__ = proto.module(
package="google.ads.googleads.v10.resources",
marshal="google.ads.googleads.v10",
manifest={
"LeadFormSubmissionData",
"LeadFormSubmissionField",
... | {
"content_hash": "b8f2455367b31220387189bba29b143a",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 116,
"avg_line_length": 28.38053097345133,
"alnum_prop": 0.5999376364203305,
"repo_name": "googleads/google-ads-python",
"id": "ee3263e79e11c0e07c38c755b9ce6f74d6f64bf0",
... |
import argparse
import sys
import os
import time
import traceback
import sys
import ctypes
import subprocess
from subprocess import Popen, PIPE
import shutil
from optparse import OptionParser
from biokbase.workspace.client import Workspace
import urllib
import urllib2
import re
import json
desc1 = '''
NAME
trns_... | {
"content_hash": "0bc2acb25c8a4e1d255888a70bd12a70",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 449,
"avg_line_length": 33.678260869565214,
"alnum_prop": 0.6480764265427318,
"repo_name": "olsonanl/transform",
"id": "37317761fabf2e7fb4cfc405f94fa8494ab76903",
"size": ... |
from django.db.backends.base.introspection import BaseDatabaseIntrospection, TableInfo
from pymysql import ProgrammingError, OperationalError
from django.utils.datastructures import OrderedSet
from pymysql.constants import FIELD_TYPE
import re
from .py3 import iteritems
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]... | {
"content_hash": "b12bdfaee633a380057cf564e7d16016",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 113,
"avg_line_length": 44.186440677966104,
"alnum_prop": 0.5770361846311214,
"repo_name": "cyaninc/django-mysql-pymysql",
"id": "3a7bbad3629e358e12944e59fd596795b0134387",
... |
import os, datetime
from numpy import array
import pylab as pl
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.dates import DateFormatter
from matplotlib.widgets import MultiCursor
from utils.rwlogging import tradeLogger as logt
from utils.rwlogging import balLogger as logb
from utils.rwloggin... | {
"content_hash": "4ff97375aa02fb974a880a48a3e5010b",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 168,
"avg_line_length": 31.60655737704918,
"alnum_prop": 0.6454011065006916,
"repo_name": "rolandwz/pymisc",
"id": "97247bd069ecc054c5cb5e4acf34c6700910a6b4",
"size": "580... |
import sys
import time
import asyncio
async def backgroundFutur():
await asyncio.sleep(5)
print("fetching some data after")
await asyncio.sleep(5)
return "backgrounb"
def foregroundData():
print("fetching some data now")
yield "foreground"
def testAsync():
print("getting some data eh ...")... | {
"content_hash": "62a3311592017a2651d553dc751f5134",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 25.88,
"alnum_prop": 0.6275115919629057,
"repo_name": "Grisou13/mawie",
"id": "36dbb060cca56c825d315dd2bcf7e6560384a5b4",
"size": "647",
"binary": ... |
''' Provide the Regex property.
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = log... | {
"content_hash": "c0b85006146031f864d57bac979969c0",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 117,
"avg_line_length": 31.95049504950495,
"alnum_prop": 0.39045553145336226,
"repo_name": "mindriot101/bokeh",
"id": "eb3808d269fa34a0ba542d6ac08a0f72155e13ec",
"size": "... |
""" Tests for swift.common.compressing_file_reader """
import unittest
import cStringIO
from slogging.compressing_file_reader import CompressingFileReader
class TestCompressingFileReader(unittest.TestCase):
def test_read(self):
plain = 'obj\ndata'
s = cStringIO.StringIO(plain)
expected ... | {
"content_hash": "a39bcf0f3d1bbe90f85bd17c40236ae6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 78,
"avg_line_length": 33.4,
"alnum_prop": 0.6392215568862275,
"repo_name": "rackerlabs/sloggingo",
"id": "65b2c8312c92c95dd1f4a877e86648603c570a63",
"size": "1258",
"bin... |
"""Upgrader for Python scripts from 1.x TensorFlow to 2.0 TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import six
from tensorflow.tools.compatibility import ast_edits
from tensorflow.tools.compatibility import ipynb
from ... | {
"content_hash": "9fff54b7647b090c46de0096dca43411",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 80,
"avg_line_length": 34.81481481481482,
"alnum_prop": 0.6376899696048632,
"repo_name": "jhseu/tensorflow",
"id": "7dcbfe19c397de70b239d55ed5941e75325545b4",
"size": "729... |
from typing import Sequence
import numpy as np
def purity_from_probabilities(
hilbert_space_dimension: int, probabilities: Sequence[float]
) -> float:
"""Purity estimator from speckle purity benchmarking.
Estimates purity from empirical probabilities of observed bitstrings.
This estimator assumes t... | {
"content_hash": "b7dddea987a1fdb33a22906d7893a23e",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 79,
"avg_line_length": 39.702127659574465,
"alnum_prop": 0.692390139335477,
"repo_name": "quantumlib/Cirq",
"id": "62d7396932e1c7e276ec7f3a1d266db3843c1ca9",
"size": "2467"... |
import pkg.sub.spam
| {
"content_hash": "0158bfb41247cd3c286bd270225886f5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 19,
"avg_line_length": 20,
"alnum_prop": 0.8,
"repo_name": "ordinary-developer/education",
"id": "a62aeaf860e91cd92133e9b530542eab18d8c734",
"size": "20",
"binary": false,... |
"""Fake hypervisor
"""
import os
import os.path
import logging
from ganeti import utils
from ganeti import constants
from ganeti import errors
from ganeti import objects
from ganeti import pathutils
from ganeti.hypervisor import hv_base
class FakeHypervisor(hv_base.BaseHypervisor):
"""Fake hypervisor interface.
... | {
"content_hash": "4eed9cb514615df8b4a200c1574e9ad2",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 76,
"avg_line_length": 30.535502958579883,
"alnum_prop": 0.6442205212673191,
"repo_name": "apyrgio/snf-ganeti",
"id": "4f04ef3b0469294feafd47c8642baeabe84fed79",
"size": "... |
from flask import Blueprint, render_template, flash
from flask import request, redirect, url_for, json, current_app
from ..core import db
from flask_security import login_required, current_user
from datetime import datetime
from .forms import EditProfileForm
from .models import User, Role
from sqlalchemy import exc
us... | {
"content_hash": "5172287d1d7c0b6816d62b2c452e9ef9",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 64,
"avg_line_length": 32.08163265306123,
"alnum_prop": 0.6743002544529262,
"repo_name": "doubledead/FlaskProject",
"id": "faca0c06ecf1356dc58069fdd82fa34ec5e27eb4",
"size"... |
from xml.etree import cElementTree as ET
from pybtex.database import Entry
from pybtex.database.output import BaseWriter
doctype = """<!DOCTYPE bibtex:file PUBLIC
"-//BibTeXML//DTD XML for BibTeX v1.0//EN"
"bibtexml.dtd" >
"""
class PrettyTreeBuilder(object):
def __init__(self):
self.tree_bui... | {
"content_hash": "1a43dd918f60c07698550865c4e2485b",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 89,
"avg_line_length": 30.6625,
"alnum_prop": 0.5356706074194864,
"repo_name": "oseledets/pybtex",
"id": "6f8c5c2a10a3e9cf12f95349fe8b379b875e975a",
"size": "3588",
"bina... |
import os
import logging
import bigbuild
from fs import path
from fs import copy
from django.urls import reverse
from django.http import Http404
from django.conf import settings
from bigbuild.forms import PageForm
from django.views.static import serve
from bigbuild import context_processors
from django.utils.encoding i... | {
"content_hash": "1a4d900b08f14c88d09881eb508f5df1",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 106,
"avg_line_length": 32.11673151750973,
"alnum_prop": 0.5993457717470317,
"repo_name": "datadesk/django-bigbuild",
"id": "07c8e756678a11b95a019ddea88eb02608013eac",
"si... |
from maths import * | {
"content_hash": "cbaade1a0d215ae42dad668465ba9433",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 19,
"avg_line_length": 19,
"alnum_prop": 0.7894736842105263,
"repo_name": "Widdershin/PyGM",
"id": "ab9a85ee1fd83c47c27d3157b4bb1e35eb56c9fa",
"size": "19",
"binary": fals... |
from typing import Sequence, Iterable, Optional, Dict, Callable, List, Any
from thinc.api import Model, set_dropout_rate, Optimizer, Config
from itertools import islice
from .trainable_pipe import TrainablePipe
from ..training import Example, validate_examples, validate_get_examples
from ..tokens import Doc
from ..voc... | {
"content_hash": "2aae05fa0d0ebd559019fddb005d1a19",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 104,
"avg_line_length": 41.71028037383178,
"alnum_prop": 0.6365673313914407,
"repo_name": "explosion/spaCy",
"id": "c742aaeaa1fda4fc246dc7c77e816fbf02909f4e",
"size": "133... |
import os
import discord
import copy
from discord.ext import commands
from .utils.dataIO import dataIO
from __main__ import send_cmd_help
class SmartReact:
"""Create automatic reactions when trigger words are typed in chat"""
def __init__(self, bot):
self.bot = bot
self.settings_path = "data... | {
"content_hash": "f757e5613875c5b0810002a7349c9389",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 115,
"avg_line_length": 36.90659340659341,
"alnum_prop": 0.5861247580765223,
"repo_name": "ptoast/FlapJack-Cogs",
"id": "0c436e9480b0493a033358c921795861438d1650",
"size":... |
try:
import coverage # pylint: disable=import-error
coverage.process_startup()
# pylint: disable=bare-except
except: # nopep8
pass
| {
"content_hash": "e227601bf5166c41d99140127f92f561",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 51,
"avg_line_length": 24.166666666666668,
"alnum_prop": 0.7034482758620689,
"repo_name": "JosuaKrause/quick_server",
"id": "f079472cfc98ad4124837cc014993be1396af031",
"size... |
from django.views.generic import View, TemplateView, FormView
from django.http import JsonResponse
from .models import DataMap, AreaMap
from .utils import start_datamap_import_task
from .tasks import poll_task_progress
from .forms import DataMapForm, DataMapImportSettingsForm
from .viewmixins import AuthenticateLoginV... | {
"content_hash": "899ee30951a0d84db61167cbf15135e1",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 105,
"avg_line_length": 31.120192307692307,
"alnum_prop": 0.6119264637725939,
"repo_name": "matthewoconnor/maps",
"id": "775dac818cfc3b2f88383eba79fa7f4f79c295dd",
"size":... |
import logging
import os
import pickle
import operator
import gzip
import pandas as pd
import numpy as np
def loadData(currency, interval, split):
logging.info('Data: loading {0} at {1}...'.format(currency, interval))
df = pd.read_csv(
r'{0}/../../data/{1}e{2}.csv'.format(os.path.realpath(os.path.dirn... | {
"content_hash": "4f8727e5ffda85305eb9d22c2067f766",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 116,
"avg_line_length": 34.48717948717949,
"alnum_prop": 0.5816604708798018,
"repo_name": "Tjorriemorrie/trading",
"id": "fa1972c653d2696d6dcea0147161a0d8cda7b117",
"size"... |
from __future__ import print_function, absolute_import, division
import logging
logger = logging.getLogger(__name__)
| {
"content_hash": "cd4e9056623f493112f277a9e3ee137b",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 64,
"avg_line_length": 23.8,
"alnum_prop": 0.7563025210084033,
"repo_name": "smok-serwis/coolamqp",
"id": "a28d91bcf87fa9e385f76d338b2b8fbc9c85b997",
"size": "134",
"binar... |
"""Formatter for the Mac appfirewall.log file."""
from plaso.formatters import interface
class MacAppFirewallLogFormatter(interface.ConditionalEventFormatter):
"""Formatter for Mac appfirewall.log file."""
DATA_TYPE = 'mac:asl:appfirewall:line'
FORMAT_STRING_PIECES = [
u'Computer: {computer_name}',
... | {
"content_hash": "68517cd24ec95ebf43ad6b58f126887b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 70,
"avg_line_length": 26.954545454545453,
"alnum_prop": 0.6627318718381113,
"repo_name": "cvandeplas/plaso",
"id": "66b4a77a5df3a0436929c7b9118b0ab5b835dc95",
"size": "129... |
import pytest
import os
import CHIP_IO.GPIO as GPIO
def teardown_module(module):
GPIO.cleanup()
class TestSetup:
def test_setup_output_key(self):
GPIO.setup("U14_37", GPIO.OUT)
assert os.path.exists('/sys/class/gpio/gpio138')
direction = open('/sys/class/gpio/gpio138/direction').read(... | {
"content_hash": "21bf6dcd9179cc4ffa36173e54a88cdd",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 68,
"avg_line_length": 33.733333333333334,
"alnum_prop": 0.6059288537549408,
"repo_name": "xtacocorex/CHIP_IO",
"id": "4dd13856d8aa20da54b7792cedb25082744199a0",
"size": "2... |
"""API functionality for the 'label' app"""
from django.conf import settings
from django.core.exceptions import FieldError, ValidationError
from django.http import HttpResponse, JsonResponse
from django.urls import include, re_path
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework impo... | {
"content_hash": "6d8b4fddd4b37c0306710dd863550eaa",
"timestamp": "",
"source": "github",
"line_count": 537,
"max_line_length": 121,
"avg_line_length": 31.46927374301676,
"alnum_prop": 0.584176578495769,
"repo_name": "inventree/InvenTree",
"id": "9a34a1a2a245264758eb63accae98a2379e0ec4d",
"size": "... |
from django.conf.urls import *
from signbank.attachments.views import *
urlpatterns = [
url(r'^$', permission_required('attachments.add_attachment') (AttachmentListView.as_view()), name="attachments"),
url(r'^upload/', upload_file),
]
| {
"content_hash": "0c92f25a2cfc98848c18d058502ada8d",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 117,
"avg_line_length": 27.77777777777778,
"alnum_prop": 0.696,
"repo_name": "Signbank/NGT-signbank",
"id": "c431a8b1eec4e0c10eb1c3cc97d9ee31258e9ba9",
"size": "250",
"bin... |
"""
Support for Yamaha Receivers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.yamaha/
"""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_... | {
"content_hash": "d580d6bf652199106d8d346fe2847047",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 79,
"avg_line_length": 34.1740614334471,
"alnum_prop": 0.6042145211225407,
"repo_name": "kyvinh/home-assistant",
"id": "928d15b595042ae614d7086958277b08802ba138",
"size": ... |
import pytest
from irc3.plugins import slack
pytestmark = pytest.mark.asyncio
async def test_simple_matches(irc3_bot_factory):
bot = irc3_bot_factory(includes=['irc3.plugins.slack'])
plugin = bot.get_plugin(slack.Slack)
setattr(plugin, 'config', {'token': 'xoxp-faketoken'})
assert '' == await plugin.... | {
"content_hash": "177bf91a2afae12ec6183260c3a222d9",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 68,
"avg_line_length": 38.870370370370374,
"alnum_prop": 0.6464983325393044,
"repo_name": "gawel/irc3",
"id": "cf97741fb26e36d7a032b98aec226d07955078d4",
"size": "2123",
... |
"""Default configurations used for R2R and NDH agents."""
from valan.framework import hparam
AGENT_CONFIG = {
'pretrained_embed_path': None,
'oov_bucket_size': 1,
'vocab_size': 1633, # size of common VLN+NDH tasks' vocab.
'word_embed_dim': 300,
# If True, use separate text encoders for NDH and VL... | {
"content_hash": "c8913667c8135c24b706168ac2637ff6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 73,
"avg_line_length": 29.318181818181817,
"alnum_prop": 0.6775193798449612,
"repo_name": "google-research/valan",
"id": "f279e07b8cb1e7377f14fe332c365d8f3442ad6b",
"size":... |
from pystratum_backend.Backend import Backend
class NoneBackend(Backend):
"""
Backend without implementations.
"""
pass
| {
"content_hash": "1203a6028718eb1f8fc87473f633a240",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 45,
"avg_line_length": 17.25,
"alnum_prop": 0.6956521739130435,
"repo_name": "SetBased/py-stratum",
"id": "ef851f2f7095d06956de6df90e3cfded20236a2d",
"size": "138",
"binar... |
from django.conf.urls import patterns, url
urlpatterns = patterns('StackSmash.apps.uploader.views',
url(r'^$', 'list', name='list'),
url(r'^delete/(\d+)$', 'delete', name='delete'),
)
| {
"content_hash": "e78af6c83c38ed5f9fc5a60633ade53d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 56,
"avg_line_length": 32.166666666666664,
"alnum_prop": 0.6424870466321243,
"repo_name": "Justasic/StackSmash",
"id": "73bad6dcb649441ee0f2be4335021b70769a0904",
"size": "2... |
import idc
import idaapi
import idautils
def reverse_map(dict_):
rdict_ = {}
for k,v in dict_.items():
rdict_[v] = k
return rdict_
def merge(d1,d2):
df = {}
if len(d2) == 0:
return d1
elif len(d1) == 0:
return d2
for i in d1:
df[i] = d1[i]... | {
"content_hash": "0d6c7c5c630816269d087b459470d534",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 74,
"avg_line_length": 25.25925925925926,
"alnum_prop": 0.5219941348973607,
"repo_name": "deeso/python_scrirpts",
"id": "bf9cd8b698ab274d63538d2151d7c76060344873",
"size":... |
import sys
import json
import unittest
from pprint import pprint
from collections import defaultdict
# Find paths in the original dataset which are never referenced by
# any other paths
def find_roots(closures):
roots = [];
for closure in closures:
path = closure['path']
if not any_refer_to(p... | {
"content_hash": "0dcff93fe6bfcc02c362f07056c03d85",
"timestamp": "",
"source": "github",
"line_count": 408,
"max_line_length": 98,
"avg_line_length": 28.28921568627451,
"alnum_prop": 0.43545312770750305,
"repo_name": "maximilianhuber/myconfig",
"id": "d67a5dfcf140d5bc0ac6487d818f700d93905cc6",
"si... |
from pyaudio import PyAudio, paInt16
from audioop import rms
from collections import deque
from os import path
import audiotools
import wave
import urllib2
import json
class Listener(object):
paudio = None
aformat = None
stream = None
nchannels = 1
bitrate = 16000
chunk = 1024
# Size of o... | {
"content_hash": "89c85655b048068bf817bed97a23a407",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 174,
"avg_line_length": 35.91554054054054,
"alnum_prop": 0.5258207130091243,
"repo_name": "Pent00/Olivia",
"id": "8fab0914dfea6db54c15a98c14043691fa6352f8",
"size": "11472... |
from django.db import models
from django.conf import settings
class PermittedManager(models.Manager):
def get_query_set(self):
# Filter objects for current site
return super(PermittedManager, self).get_query_set().filter(
sites__id__exact=settings.SITE_ID
)
| {
"content_hash": "bab239074dbe1e30b08c0b23f4beb932",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 68,
"avg_line_length": 27.363636363636363,
"alnum_prop": 0.6810631229235881,
"repo_name": "praekelt/jmbo-foundry",
"id": "7e5400eaf6be555d3da439acb988fef3e80caa56",
"size":... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random
from scipy.ndimage import minimum_position
from scipy import mgrid, zeros, tile, array, floor, sum
from module import Module
class KohonenMap(Module):
""" Implements a Self-Organizing Map (SOM), also known as a Kohonen Map.
C... | {
"content_hash": "2167efc7b4fb734b23770ee84f393c72",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 145,
"avg_line_length": 39.64935064935065,
"alnum_prop": 0.6229937766131673,
"repo_name": "hassaanm/stock-trading",
"id": "88a6719467acbbadc9905113d1feefd15ce82d84",
"size"... |
"""Unit tests for brcd fc san lookup service."""
import mock
import paramiko
from oslo.config import cfg
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import test
from cinder.volume import configuration as conf
import cinder.zonemanager.drivers.brocade.brcd_fc_san_lookup... | {
"content_hash": "421ba115eac264164da431c0729fd604",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 78,
"avg_line_length": 39.714285714285715,
"alnum_prop": 0.5881294964028777,
"repo_name": "Thingee/cinder",
"id": "5be6233208eb1c6c56323fbdf0e28b5c799b25ad",
"size": "5711... |
from urllib.parse import urlparse
from utils import get_url, weighted_random_subreddit
from utils import SupplyResult
t_channel = '@ya_metro'
subreddit = weighted_random_subreddit({'Subways': 0.6,
'LondonUnderground': 0.4,
'Trams': 0.3
})
def send_post(submission, r2t):
what, url, ext = get_url(submiss... | {
"content_hash": "4996434d0f03e3bd5763371a5230b9ad",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 69,
"avg_line_length": 33.58695652173913,
"alnum_prop": 0.5915857605177993,
"repo_name": "nsiregar/reddit2telegram",
"id": "f37b32687269519e4ed6c3cd21815b8f0939274e",
"size... |
"""Script that generates a page_set for the webpages_playback.py script."""
from __future__ import print_function
import jinja2
import os
PAGE_SET_TEMPLATE = 'page_set_template'
PAGE_SET_DIR = 'page_sets'
def main():
created_page_sets = []
while True:
user_agent = raw_input('user agent? (mobile/desktop/ta... | {
"content_hash": "45ba15cf2da68f41a2f3faf4ec817e51",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 81,
"avg_line_length": 27.80851063829787,
"alnum_prop": 0.613618974751339,
"repo_name": "aosp-mirror/platform_external_skia",
"id": "d257a9cf0a18e00f4e7ebf856b123de6e32256e5"... |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from django.core.management.base import BaseCommand
from zerver.models import get_realm
from zerver.lib.actions import set_default_streams
from optparse import make_option
import sys
class Command(BaseCommand):
... | {
"content_hash": "95fe04e0044d2a6f5a227bb5e44e9761",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 95,
"avg_line_length": 35.714285714285715,
"alnum_prop": 0.6468571428571429,
"repo_name": "krtkmj/zulip",
"id": "277355c13d540e86ac0944edd2e7487b5ad3207d",
"size": "1750",
... |
from os.path import dirname, basename, isfile, join
import glob
modules = glob.glob(join(dirname(__file__), "*.py"))
__all__ = [basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')]
| {
"content_hash": "e9657028f7284a44b1a201ffe03e96d5",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 92,
"avg_line_length": 52.5,
"alnum_prop": 0.6619047619047619,
"repo_name": "jvicu2001/alexis-bot",
"id": "d5d1dbd8bcdba7138f8fc236df0af520c7930e77",
"size": "210",
"binar... |
"""Test client RDFValues."""
import socket
from grr.lib import rdfvalue
from grr.lib import type_info
from grr.lib.rdfvalues import test_base
from grr.proto import jobs_pb2
class UserTests(test_base.RDFValueTestCase):
"""Test the User ProtoStruct implementation."""
rdfvalue_class = rdfvalue.User
USER_ACCOU... | {
"content_hash": "95e0940f8cd4e76fd85ad4d1b6c0f548",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 79,
"avg_line_length": 34.06091370558376,
"alnum_prop": 0.6584202682563338,
"repo_name": "defaultnamehere/grr",
"id": "27bebeb9c472ad30c62b3791e4857f4c99527e4d",
"size": "... |
__author__ = 'noe'
import numpy as _np
from pyemma.util.types import ensure_dtraj_list
from pyemma.msm.estimators.maximum_likelihood_hmsm import MaximumLikelihoodHMSM as _MaximumLikelihoodHMSM
from pyemma.msm.models.hmsm import HMSM as _HMSM
from pyemma.msm.estimators.estimated_hmsm import EstimatedHMSM as _Estimated... | {
"content_hash": "11419315a32cc85f2c5307b80c89a6a1",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 119,
"avg_line_length": 46.525,
"alnum_prop": 0.6369335482715386,
"repo_name": "arokem/PyEMMA",
"id": "64ba87ea1fc852294c614f97047979e49f867eeb",
"size": "5583",
"binary... |
__author__ = 'Raghav Sidhanti'
from terrace.db.model import db, List
def get_all():
return List.query.all()
def save(name):
l = List(name)
db.session.add(l)
db.session.commit()
return l
def get_by_id(list_id):
return List.query.get(list_id)
def update(list_id, name):
l = get_by_id... | {
"content_hash": "163b47c8d9d1a768976f18dd52062fb1",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 37,
"avg_line_length": 13.065217391304348,
"alnum_prop": 0.589018302828619,
"repo_name": "sudohippie/terrace",
"id": "7d004685c22a2d57e71f61abce737be7611004c6",
"size": "60... |
from cinderclient import exceptions as cinder_exception
from nova import context
from nova import exception
from nova import test
from nova.volume import cinder
class FakeCinderClient(object):
class Volumes(object):
def get(self, volume_id):
return {'id': volume_id}
def list(self, de... | {
"content_hash": "3042fceb27ce8528586f9e2c944282de",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 79,
"avg_line_length": 39.345588235294116,
"alnum_prop": 0.6019435619510372,
"repo_name": "qwefi/nova",
"id": "a235a526c1f477309fe46ddd29ec9a21e1703b9d",
"size": "11392",
... |
import resource
def _systemtime ():
ru_self = resource.getrusage (resource.RUSAGE_SELF)
ru_ch = resource.getrusage (resource.RUSAGE_CHILDREN)
return ru_self.ru_utime + ru_ch.ru_utime
class Stopwatch:
""" A stop watch """
def __init__ (self):
self._started = 0
self._finished = -1
self._elapsed = ... | {
"content_hash": "54d9e007460272a235ea65b84f8d282d",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 82,
"avg_line_length": 25.51086956521739,
"alnum_prop": 0.5225820195994887,
"repo_name": "caballa/crab-llvm",
"id": "220f8faff25b1dccce3e25f7958d9ba120769d40",
"size": "47... |
'''
.. module:: normalize
This module contains the functors which normalize all types of inputs,
from matrices to articles, to an expected format.
.. moduleauthor:: Christopher Phillippi <c_phillippi@mfe.berkeley.edu>
'''
import numpy as np
import scipy.sparse as sparse
from itertools import chain
cla... | {
"content_hash": "8f24b74f313fc9dd7531957ee2a888f0",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 107,
"avg_line_length": 40.9609375,
"alnum_prop": 0.4674804501239748,
"repo_name": "ccphillippi/AFP",
"id": "2cdfce66f6d77cad8dc519c689b2ebe38150e29f",
"size": "5243",
"... |
"""Tests for `tf.data.Dataset.padded_batch()`."""
from absl.testing import parameterized
import numpy as np
from tensorflow.python.data.kernel_tests import checkpoint_test_base
from tensorflow.python.data.kernel_tests import test_base
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework ... | {
"content_hash": "41a881687656dce203185bd20c7acb6f",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 80,
"avg_line_length": 43.405913978494624,
"alnum_prop": 0.6413575277141265,
"repo_name": "tensorflow/tensorflow-pywrap_tf_optimizer",
"id": "29534ce267e1c8cc9744d0ae8f02f0a... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('socialnet', '0023_auto_20161121_0001'),
]
operations = [
migrations.AlterField(
model_name='post',
name='visibility',
... | {
"content_hash": "3d877e755d0a873e4f3d13e1edd13a7e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 49,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.5887096774193549,
"repo_name": "CMPUT404F16T06/CMPUT404Project",
"id": "a9e15168cdf7783b4517ef3bf253950e55d64a48",
... |
"""Lowers break statements to conditionals."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.autograph.core import converter
from tensorflow.python.autograph.pyct import anno
from tensorflow.python.autograph.pyct import templates
fr... | {
"content_hash": "e42f61026bee70a2354b3ac216526442",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 79,
"avg_line_length": 30.295454545454547,
"alnum_prop": 0.6406601650412603,
"repo_name": "brchiu/tensorflow",
"id": "e4e32ab9761aa13b5a7eefbc297ad3ea79412e99",
"size": "4... |
"""Generate an updated requirements_all.txt."""
import importlib
import os
import pkgutil
import re
import sys
COMMENT_REQUIREMENTS = (
'RPi.GPIO',
'raspihats',
'rpi-rf',
'Adafruit_Python_DHT',
'Adafruit_BBIO',
'fritzconnection',
'pybluez',
'beacontools',
'bluepy',
'opencv-pytho... | {
"content_hash": "ef5bee82328919c0e774a572024c4732",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 76,
"avg_line_length": 26.25,
"alnum_prop": 0.5938682322243966,
"repo_name": "MungoRae/home-assistant",
"id": "ba7a49cc7c05c5f0fdbc3d9ebb6161808c08271c",
"size": "7688",
... |
import sys
from twisted.web import resource, static
from twisted.web.server import NOT_DONE_YET
from twisted.web.wsgi import WSGIResource, _WSGIResponse
import chalk
from hendrix.facilities.response import HendrixWSGIResponse, LoudWSGIResponse
class HendrixWSGIResource(WSGIResource):
ResponseClass = HendrixWSG... | {
"content_hash": "dd2d18ba746f36309891e2f7da7ad2c9",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 83,
"avg_line_length": 37.20809248554913,
"alnum_prop": 0.6339909895914245,
"repo_name": "SlashRoot/hendrix",
"id": "22351d48c4423b575c770d2b7d05ff217a427512",
"size": "64... |
import os
import numpy
import math
import pylab
import MMULT
from masks import generateMultipleAlignment
from masks import svdAnalysis
from entities import pdb
import libraries.OScommands
class MaskGenerator:
colors = [".color blue", ".color dark green", ".color olive drab", ".color brown", ".color red", ".co... | {
"content_hash": "f32a877ac4d26eb9930342063f5faeca",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 150,
"avg_line_length": 44.400611620795104,
"alnum_prop": 0.6067911013155176,
"repo_name": "julianah/cathAnalysis",
"id": "2fb7c36a9303feddd0da46774b4bf980f3425a1e",
"size... |
class DataSourceError(Exception):
pass
| {
"content_hash": "c51c5429e3a7a5ae008772a8fe1c913e",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 33,
"avg_line_length": 21.5,
"alnum_prop": 0.7674418604651163,
"repo_name": "YAmikep/datasource",
"id": "379ef64ea1725d726af3163ce4cb9df5ef91704b",
"size": "43",
"binary":... |
import os
import string
import nltk
import re
_alphabet = set(string.ascii_lowercase + string.digits + ' ')
word_regexp = r"(?u)\b[a-zA-Z_][a-zA-Z_]+\b"
class NltkNormalizer:
def __init__(self):
self.install_nltk_corpora('stopwords', 'wordnet', 'punkt')
self.lemmatizer = nltk.WordNetLemmatizer()
... | {
"content_hash": "42261cfb8bcb74466faf0877919db9d7",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 87,
"avg_line_length": 34.90196078431372,
"alnum_prop": 0.5921348314606741,
"repo_name": "quadflor/Quadflor",
"id": "58c84fd5444cd2456f93f11ed477869cc1a9f1f0",
"size": "178... |
import sys
import unittest
from libcloud.utils.py3 import httplib
try:
import simplejson as json
except ImportError:
import json
from libcloud.common.types import InvalidCredsError
from libcloud.compute.drivers.gridspot import GridspotNodeDriver
from libcloud.compute.types import NodeState
from libcloud.test... | {
"content_hash": "e69d4171d0fc3a2b3a32555cc72de500",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 79,
"avg_line_length": 33.16129032258065,
"alnum_prop": 0.6047804335742079,
"repo_name": "IsCoolEntertainment/debpkg_libcloud",
"id": "4886a8831e74a695f593912e63f0b344478dec... |
"""mahjong URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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-bas... | {
"content_hash": "b6fa97e535c1b1ed31104cc1088f309e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 79,
"avg_line_length": 39.30434782608695,
"alnum_prop": 0.6913716814159292,
"repo_name": "beatdown0514/mahjong",
"id": "9aa72e033cb496cfac6ff1fc8d4d23245934784b",
"size": "... |
import ast
def isFunction(stmt):
"""
Check if a python statement is a function
>>> isFunction('a = 1')
False
>>> isFunction('def f():\\n return True\\n')
True
>>> isFunction('f = lambda x: x*x')
True
"""
ast_tree = ast.parse(stmt)
body = ast_tree.body[0]
try:
re... | {
"content_hash": "4017b21ca4ed4e53c81b5012f7404f61",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 49,
"avg_line_length": 22.94736842105263,
"alnum_prop": 0.5894495412844036,
"repo_name": "IuryAlves/TryPython",
"id": "7158629c8549ba69ffcbf45ba3a9126ed3baa2df",
"size": "4... |
from checks import AgentCheck
from tests.checks.common import AgentCheckTest, load_check
class TestFileUnit(AgentCheckTest):
CHECK_NAME='storm_rest_api'
def assert_tags(self, expected_tags, present_tags):
for tag in expected_tags:
self.assertTrue(tag in present_tags,
... | {
"content_hash": "945a0dbaf700fed563670494ff063252",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 359,
"avg_line_length": 48.857142857142854,
"alnum_prop": 0.5231481481481481,
"repo_name": "stripe/stripe-datadog-checks",
"id": "a8afe9207a52d3ef1caf365dc40fe2d20f3c8c57",
... |
import os
import sys
'''
Parse the files from the Iterative HFold output
Find the keyword "energy:" in the file
Extract the energy from the file as function return
'''
def extract_energy(filename):
processing_file = open(filename, 'r')
keyword = "energy:"
tmpval=0.0
for line in processing_... | {
"content_hash": "85b4cdd9ea26a0834f9721aabc925fd6",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 84,
"avg_line_length": 27.244897959183675,
"alnum_prop": 0.5940074906367041,
"repo_name": "LingboTang/LearningFiles",
"id": "0bf6cde9a316c477ef2c5029fd1e08e0ab5280d6",
"siz... |
import uuid
from openstack_horizon.test import helpers as test
from openstack_horizon.utils import filters
class UtilsFilterTests(test.TestCase):
def test_accept_valid_integer(self):
val = 100
ret = filters.get_int_or_uuid(val)
self.assertEqual(val, ret)
def test_accept_valid_integer... | {
"content_hash": "69e8d869d4c2aa7b5d030c62a4076526",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 67,
"avg_line_length": 28.96,
"alnum_prop": 0.6519337016574586,
"repo_name": "mrunge/openstack_horizon",
"id": "7efee3e7f0f646cc2348488f0abf911b8b2f4ab2",
"size": "1364",
... |
"""
.. module: security_monkey.watchers.vpc.networkacl
:platform: Unix
.. version:: $$VERSION$$
.. moduleauthor:: Bridgewater OSS <opensource@bwater.com>
"""
from security_monkey.decorators import record_exception, iter_account_region
from security_monkey.watcher import Watcher
from security_monkey.watcher impor... | {
"content_hash": "7a0c01931917e28d7a470c562b3ff01f",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 98,
"avg_line_length": 34.96590909090909,
"alnum_prop": 0.5495612609684758,
"repo_name": "stackArmor/security_monkey",
"id": "10a62e9f4a2af495acb47a5d91082884c8841ce8",
"si... |
import pkg_resources
from testtools import matchers
from glance_store import backend
from glance_store.tests import base
class OptsTestCase(base.StoreBaseTest):
def _check_opt_groups(self, opt_list, expected_opt_groups):
self.assertThat(opt_list, matchers.HasLength(len(expected_opt_groups)))
gr... | {
"content_hash": "03a00beb6544057ede0740f225e3ded4",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 79,
"avg_line_length": 37.13392857142857,
"alnum_prop": 0.5575859581630199,
"repo_name": "saeki-masaki/glance_store",
"id": "5559dec1427930248be77fdf34417d3a9cebfde1",
"si... |
"""
Python exception and (Response error message, status code) mapping
"""
ERROR_CODE_TO_MSG = {
'ValidationError': ['Invalid request', 400],
'DoesNotExist': ['Resource does not exist', 404],
'InvalidId': ['Invalid request', 404],
'UserHasVoted': ['User cannot vote twice', 403],
'NotUniqueError': ... | {
"content_hash": "7ab970f6fc7c9bca90561f7c6d8f1e79",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 66,
"avg_line_length": 30.416666666666668,
"alnum_prop": 0.663013698630137,
"repo_name": "TeamGhostBuster/restful-api",
"id": "68b43f34abcddb9ba15ea7701f779d44dc2ec27e",
"s... |
from content_plugin import ContentPlugin
from gluon import URL, CAT, I, XML
import os
class ContentPackage(ContentPlugin):
"""docstring for ContentPackage."""
def get_item_url(self, item):
return URL('plugin_package', 'index.html', args=[item.unique_id])
def preview(self, item):
super(C... | {
"content_hash": "cf8d2517c278d6e2c9c0117f101a6d70",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 76,
"avg_line_length": 34.92307692307692,
"alnum_prop": 0.5908590308370044,
"repo_name": "ybenitezf/nstock",
"id": "daaf9de73f64431f3abf74930822932cb8686f08",
"size": "365... |
from charmhelpers.core.services.base import ServiceManager
from charmhelpers.core.services import helpers
import actions
def manage():
manager = ServiceManager([
{
'service': 'saiku',
'ports': [], # ports to after start
'provided_data': [
# context man... | {
"content_hash": "6c6bf95b1e598db142140e8e64283dfd",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 69,
"avg_line_length": 30.620689655172413,
"alnum_prop": 0.49099099099099097,
"repo_name": "qqming113/saiku",
"id": "b8830f03c40d01d3b6104e48f6ee3cd89bd9b493",
"size": "907... |
import sys, os
from time import *
sys.path.append('/var/projects')
os.environ['DJANGO_SETTINGS_MODULE'] ='mednet.settings'
from mednet import settings
from mednet.messaging.models import *
from googlevoice import Voice,util
voice = Voice()
voice.login(settings.GVOICE_USER, settings.GVOICE_PASS)
for message in voice... | {
"content_hash": "ccc949828dddf9a1dbced99eacc75aed",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 62,
"avg_line_length": 28,
"alnum_prop": 0.7373271889400922,
"repo_name": "jj0hns0n/mednet",
"id": "9b247eac0c6b58327b42f34c9aaa40226827245f",
"size": "868",
"binary": fa... |
import re
from django.template.defaultfilters import slugify
"""
Taken from https://djangosnippets.org/snippets/690/
"""
def unique_slugify(instance, value, slug_field_name='slug', queryset=None,
slug_separator='-'):
"""
Calculates and stores a unique slug of ``value`` for an instance.
... | {
"content_hash": "6d51153af336be1d60a7ffdd41c91115",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 81,
"avg_line_length": 35.77333333333333,
"alnum_prop": 0.6317554975773388,
"repo_name": "carquois/blobon",
"id": "2fbbe6bc7aff0f1d371d50a878864db1376d2234",
"size": "2683"... |
"""Test syscoin-cli"""
from decimal import Decimal
import re
from test_framework.blocktools import COINBASE_MATURITY
from test_framework.test_framework import SyscoinTestFramework
from test_framework.util import (
assert_equal,
assert_greater_than_or_equal,
assert_raises_process_error,
assert_raises_r... | {
"content_hash": "747105f3819edf6e64b53741752538e1",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 163,
"avg_line_length": 56.96646341463415,
"alnum_prop": 0.624939791276425,
"repo_name": "syscoin/syscoin",
"id": "c71ae77f0f79b49e4cbb6975e816c948ed326f5b",
"size": "1889... |
from twisted.internet.defer import inlineCallbacks, returnValue
from klein import Klein
from autobahn.twisted.wamp import Application
app = Klein()
wampapp = Application()
@app.route('/square/submit', methods=['POST'])
@inlineCallbacks
def square_submit(request):
x = int(request.args.get('x', [0])[0])
res = ... | {
"content_hash": "f7a0c551d585b262f898e8784f9c680f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 29.36,
"alnum_prop": 0.6989100817438693,
"repo_name": "crossbario/autobahn-python",
"id": "9ae885be2054f272b14122f250ae31dce5724eaf",
"size": "2028",... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('analytics', '0003_total_bigint'),
]
operations = [
migrations.RenameField(
model_name='subreddit',
old_name='average_gilded',
new_name='average_gilded_go... | {
"content_hash": "898acf7adbdc4f66f914e1391a368f5c",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 49,
"avg_line_length": 28.933333333333334,
"alnum_prop": 0.5276497695852534,
"repo_name": "xgi/aliendb",
"id": "e9a80b1210cfbca7608b095a16262ec6e5874f97",
"size": "1808",
... |
from flask_blog import app
from flask_blog.settings import POSTS_PER_PAGE
from flask import render_template, redirect, flash, url_for, session, abort, request
from blog.form import SetupForm, PostForm
from flask_blog import db, uploaded_images
from user.models import User
from blog.models import Blog, Post, Category
fr... | {
"content_hash": "ec55b950f9e6764d10f8ddb1c11797a6",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 116,
"avg_line_length": 33.8705035971223,
"alnum_prop": 0.6125743415463042,
"repo_name": "SocialProgrammingUnion/SamaritanAnalytics",
"id": "06e067df3d24379fbeefb95661c10e6d... |
import os
import unittest
import numpy as np
from pymatgen.analysis.defects.core import DefectEntry, Interstitial, Vacancy
from pymatgen.analysis.defects.defect_compatibility import DefectCompatibility
from pymatgen.core import PeriodicSite
from pymatgen.io.vasp import Outcar, Poscar, Vasprun
from pymatgen.util.testi... | {
"content_hash": "ca4043f9772d9713e35314b3ea2781a1",
"timestamp": "",
"source": "github",
"line_count": 441,
"max_line_length": 119,
"avg_line_length": 46.487528344671205,
"alnum_prop": 0.6379688795668504,
"repo_name": "fraricci/pymatgen",
"id": "03687ea551926e9ff64088f3edbe643a34295bd1",
"size": "... |
import sqlite3
class AmityDb(object):
"""
Class that defines methods for writing
and reading Amity data to the database
"""
def __init__(self, db_name):
self.conn = sqlite3.connect(db_name)
self.c = self.conn.cursor()
def create_tables(self):
with self.conn:
... | {
"content_hash": "a5e99437a16782e6685e2cef6d3d73a2",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 78,
"avg_line_length": 32.910714285714285,
"alnum_prop": 0.4671730873575692,
"repo_name": "andela-bmwenda/amity-cp1",
"id": "c3dc83fcce12c67545bb91c15b67a3bfacacd966",
"siz... |
from flask_simple_alchemy.factories import (RelationshipFactories,
simple_table_factory
)
class HasOneToOneWith(object):
def __init__(self, db, factory_instance):
self.db = db
self.factory = factory_instance
... | {
"content_hash": "e01143a5e7a8b8de35962012692f2f77",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 74,
"avg_line_length": 32.28865979381443,
"alnum_prop": 0.5922733077905492,
"repo_name": "elbow-jason/flask-simple-alchemy",
"id": "b6f2ab8d63953ee86802debfdc40a100d76e316b",... |
import argparse
import pdb
import os
parser = argparse.ArgumentParser()
parser.add_argument('--file_list', nargs='+', help='List with files containing the ids that will be compared with --refids', required=True)
args = parser.parse_args()
filelist=args.file_list
class AutoVivification(dict):
"""Implementation ... | {
"content_hash": "61ab892821b98c76a2f96e7fa419c4f8",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 185,
"avg_line_length": 27.322033898305083,
"alnum_prop": 0.5843672456575683,
"repo_name": "igsr/igsr_analysis",
"id": "c92e0f24b67d749a2050951f1d7da20b63f88bd0",
"size": "... |
import maya.cmds as m
import pymel.core as pm
import random
from fxpt.fx_prefsaver import prefsaver, serializers
WIN_NAME = 'fx_transformRandomizerWin'
WIN_TITLE = 'Transform Randomizer v1.1'
WIN_HELP_NAME = 'fx_transformRandomizerHelpWin'
WIN_HELP_TITLE = WIN_TITLE + ' Help'
OPT_VAR_NAME = 'fx_randomizer_prefs'
SPA... | {
"content_hash": "7cc35d1ae8ddcb5424f846390735e165",
"timestamp": "",
"source": "github",
"line_count": 496,
"max_line_length": 164,
"avg_line_length": 50.090725806451616,
"alnum_prop": 0.465647011471121,
"repo_name": "theetcher/fxpt",
"id": "3bfc0cc1e66a10ec9f0322519ad6057f98e316f3",
"size": "2484... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('plants', '0010_auto_20160330_0922'),
]
operations = [
migrations.AlterField(
model_name='plant',
name='shade_tolerance',
... | {
"content_hash": "a3f5281b30e7212895dc93597cb6b856",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 190,
"avg_line_length": 34.52173913043478,
"alnum_prop": 0.5982367758186398,
"repo_name": "mgnusl/herb-pi",
"id": "12f9d8df5e63799b8f130e800f516e1413819716",
"size": "866",... |
__all__ = ['dumps', 'loads']
import datetime
try:
import json
except ImportError:
import simplejson as json
class JSONDateTimeEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, (datetime.date, datetime.datetime)):
return obj.isoformat()
else:
re... | {
"content_hash": "4d50d02f580f6b54a72a8b39d897e67b",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 73,
"avg_line_length": 26.136986301369863,
"alnum_prop": 0.5487421383647799,
"repo_name": "bukun/ogcc",
"id": "7fba30c3fa2c061c87545b8e37647ac5f70f88a1",
"size": "2052",
... |
#===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistr... | {
"content_hash": "b287713efa2d5b0e90341996d9d48e8e",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 86,
"avg_line_length": 40.975,
"alnum_prop": 0.6512100874516982,
"repo_name": "smr547/agdc",
"id": "b6ffe7bca8944e16732f09aeddd646408ac53a5a",
"size": "4940",
"binary": ... |
import io
import os
import shlex
import six
from collections import namedtuple
from ..logs import warn
from ..utils import memoize
from ..conf import settings
from ..system import Path
ShellConfiguration = namedtuple('ShellConfiguration', (
'content', 'path', 'reload', 'can_configure_automatically'))
class Gene... | {
"content_hash": "6ee26ed995d3b40f664c1071f6eddd4a",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 96,
"avg_line_length": 31.8705035971223,
"alnum_prop": 0.562979683972912,
"repo_name": "Clpsplug/thefuck",
"id": "a810d8a7ce6738d9f52b9243d7bda478a5f4d8c9",
"size": "4430"... |
import simplejson
import json
import urllib
import urllib2
import hashlib
import time
import re
import nose
from nose.tools import assert_equals
import sys
import os
# This hack is to add current path when running script from command line
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
impo... | {
"content_hash": "1883c66a1af49b9987fe7af423d7fef5",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 437,
"avg_line_length": 40.836879432624116,
"alnum_prop": 0.6352900312608545,
"repo_name": "figshare/Total-Impact",
"id": "faeec2a218dbb0d0976870f0af1da9ac4dc302dd",
"size... |
import copy
import mock
from oslo_config import cfg
# XXX: actionsensor import depends on config being setup.
import st2tests.config as tests_config
tests_config.parse_args()
import st2common.bootstrap.runnersregistrar as runners_registrar
from st2common.runners.base import ActionRunner
import local_runner
from st2... | {
"content_hash": "3d90fae27724ff1de5bddf2e536ca13c",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 95,
"avg_line_length": 48.470588235294116,
"alnum_prop": 0.7255258899676376,
"repo_name": "peak6/st2",
"id": "6fb646be94cc08d9abed0afa4099dd434169dad9",
"size": "5724",
... |
from conary.lib.cfgtypes import CfgInt, CfgPath, CfgString
from conary.lib.cfgtypes import CfgList, CfgDict, CfgLineList
from conary.repository.netrepos import netserver
CFG_PATH = '/srv/conary/repository.cnr'
class UpsrvConfig(netserver.ServerConfig):
downloadDB = (CfgString, 'postgresql://upd... | {
"content_hash": "8f9d93fb2012971965989d79ff9d66dd",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 100,
"avg_line_length": 35.04,
"alnum_prop": 0.6541095890410958,
"repo_name": "sassoftware/rbm",
"id": "46a4d1b14d48e54f0228a8627240b3e3c6ded520",
"size": "1463",
"binary... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Review',
fields=[
('id', models.Auto... | {
"content_hash": "54005eb2d20f7aa516746052a040ed5a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 30.875,
"alnum_prop": 0.5519568151147098,
"repo_name": "bjorncooley/maleo",
"id": "173b6bed2060ccc384ff7e3b23db9d106586fc6e",
"size": "765",
"bina... |
from __future__ import unicode_literals
import frappe, os, copy, json, re
from frappe import _
from frappe.modules import get_doc_path
from jinja2 import TemplateNotFound
from frappe.utils import cint, strip_html
from frappe.utils.pdf import get_pdf
from pyPdf import PdfFileWriter, PdfFileReader
no_cache = 1
no_site... | {
"content_hash": "5e77fce7ebb73d335333138ec739f198",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 109,
"avg_line_length": 33.18181818181818,
"alnum_prop": 0.7347945205479453,
"repo_name": "elba7r/builder",
"id": "28952a45c1957ab078431e5267621beab69e2974",
"size": "1825"... |
'''
Created on 16/04/2013
@author: henar
'''
import httplib
import sys
import os
from xml.dom.minidom import parse, parseString
from xml.dom.minidom import getDOMImplementation
from xml.etree.ElementTree import Element, SubElement, tostring
import md5
import httplib, urllib
import utils
domine = "130.206.80.119"
por... | {
"content_hash": "03499fde2d688d0b11fd5aa131a3b2af",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 135,
"avg_line_length": 31.094017094017094,
"alnum_prop": 0.7193512919186366,
"repo_name": "Fiware/cloud.SDC",
"id": "d8c049045981a0d9667924e487f6e34e29721290",
"size": "4... |
import pandas as pd
import numpy as np
#Function for unpivot a dataframe (duplicate of WASP_Utils.unpivot - but we can remove the one in WASP_Utils later
#if we can figure out how to make modules within a package reference each other)
def unpivot(df,Keep_VARIABLEs):
#Unpivoting
N, K = df.shape
data = {'V... | {
"content_hash": "c61ad2c81e0b30168a80d7793295bdd1",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 114,
"avg_line_length": 34.806451612903224,
"alnum_prop": 0.680259499536608,
"repo_name": "Harefoot/TurboQUALTX",
"id": "93e0c6dd40bf1ad2b2011b0bf7ddab4200263693",
"size": ... |
"""Tests for `tf.data.experimental.make_csv_dataset()`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
import zlib
from absl.testing import parameterized
import numpy as np
from tensorflow.python.data.experimental.ops import reade... | {
"content_hash": "5e248ad5f8b6678f050dfc8f780cf2bc",
"timestamp": "",
"source": "github",
"line_count": 728,
"max_line_length": 80,
"avg_line_length": 34.23489010989011,
"alnum_prop": 0.5851622998836417,
"repo_name": "jhseu/tensorflow",
"id": "5f8382f43c4c6ddd6787b35753aee5fb86cf46b5",
"size": "256... |
from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message
from sqlalchemy import *
from sqlalchemy.orm import attributes
from sqlalchemy import exc as sa_exc
from sqlalchemy.orm import exc as orm_exc
from sqlalchemy.orm import *
from sqlalchemy.test.util import gc_collect
from sqlalchemy.test import... | {
"content_hash": "b70b8dbd81d8a08ba9b600ee0bafb7ee",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 111,
"avg_line_length": 29.155844155844157,
"alnum_prop": 0.5457842825326121,
"repo_name": "obeattie/sqlalchemy",
"id": "7022a9faa1decafeeb18c9ad6d9dfe7207851d7e",
"size":... |
import time
from pytibrv.Tibrv import *
import unittest
class DispatcherTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
status = Tibrv.open()
if status != TIBRV_OK:
raise TibrvError(status)
@classmethod
def tearDownClass(cls):
Tibrv.close()
def test... | {
"content_hash": "ed4d8a1208f1784e945badd0e2d8387b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 68,
"avg_line_length": 23.13157894736842,
"alnum_prop": 0.6052332195676906,
"repo_name": "arienchen/pytibrv",
"id": "9145d71e4edfdbb023e9f58364381d5157dd637e",
"size": "879... |
import os
import random
import struct
import uuid
# noinspection PyUnresolvedReferences
from Crypto.Cipher import AES
class CryptKeeper:
CHUNK_SIZE = 64 * 1024 # in bits
# KEY_SIZE = 32 # in bytes
TEST_STRING = 'TESTSTRING'
def encrypt(self, file_path, key=None):
"""
Encrypts the g... | {
"content_hash": "1c6e9f774b7e030a453195fb4e8d01a8",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 111,
"avg_line_length": 35.37404580152672,
"alnum_prop": 0.5725075528700906,
"repo_name": "azezpz1/SFT",
"id": "6a4ae62cefae0e63c41b81b9cb8335ddbabd6782",
"size": "4634",
... |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import time
import salt.modules.ldapmod as ldapmod
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
class LdapmodTestCase(TestCase, LoaderModuleMockMixin):
... | {
"content_hash": "9c78dff60640cd5f6c753ccb2b752ab1",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 79,
"avg_line_length": 28.904761904761905,
"alnum_prop": 0.4843492586490939,
"repo_name": "saltstack/salt",
"id": "02712a9874f15721beb1a36d53ab45dce9b1a045",
"size": "1821"... |
from discord.ext.commands import Bot
from discord.ext import commands
import random
import discord
import time
from time import sleep
description = 'Bot name >> Pandorium Bot ' + ' Author >> Luc Werkhoven.'
owner = 'Luc Werkhoven'
bot = commands.Bot(command_prefix='*', description=description, owner=owner... | {
"content_hash": "c2f984e467b568c26cfd146b0cb1e885",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 175,
"avg_line_length": 26.993506493506494,
"alnum_prop": 0.6487851816213616,
"repo_name": "CrafterLuc2/Python",
"id": "4a4ae6b53518f9e0d9c0b6900df2c6d97ede98ae",
"size": ... |
from modules import *
from classes import *
import re
"""
Just for reading recipes quick in txt file
Syntax in your recipe file:
<Category>
Recipename1
Recipename2
<Category2>
Recipemane3
...
Example:
<Fish>
Fish and Chips
Fish soup
<Pork>
Pulled pork
...
"""
regex_for_category = '<.*>'
category = ""
counter = 0
t... | {
"content_hash": "ba3afc37d190d6208feffd0ac83731dd",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 137,
"avg_line_length": 18.659574468085108,
"alnum_prop": 0.7172177879133409,
"repo_name": "Jntz/RuokalistaCommandLine",
"id": "22519b73c11755f80c84960217c8b237841690b2",
"... |
from __future__ import print_function
from setuptools import setup, find_packages
import io
import codecs
import os
import sys
here = os.path.abspath(os.path.dirname(__file__))
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filen... | {
"content_hash": "825b3823ff4f2c750de473a3b197a3f1",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 71,
"avg_line_length": 25.76923076923077,
"alnum_prop": 0.5982089552238806,
"repo_name": "dilgerma/shipwright",
"id": "3771b57561fdba68c62828ebf3660fc6119390a3",
"size": "1... |
#!/usr/bin/env python3
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from . import js_checker
from os import path as os_path
import re
from sys import path as sys_path
from . import test_util
import unit... | {
"content_hash": "2d74d86b202f20848e11f6086cb07494",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 85,
"avg_line_length": 36.11217948717949,
"alnum_prop": 0.6189757699476347,
"repo_name": "scheib/chromium",
"id": "cfd3e2a6b28679d757472b4c77c1e8d8b2e9c12a",
"size": "1126... |
from string import Template
from code_generator import CodeGenerator
from collections import OrderedDict
from java_class import InternalJavaFileData
class WrapperGenerator(CodeGenerator):
""" Generator class thar generates wrapper layer code."""
def __init__(self, java_data, class_loader):
super(WrapperGenera... | {
"content_hash": "b3028923bf1e15502b23d82e4676f27a",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 82,
"avg_line_length": 33.815699658703075,
"alnum_prop": 0.635446104158256,
"repo_name": "siovene/crosswalk",
"id": "815ae9e17c5df44a54cc08d6f0d503e11e9546f6",
"size": "10... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.