text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
from cpuinfo import *
import helpers
class MockDataSource:
bits = '32bit'
cpu_count = 1
is_windows = False
arch_string_raw = 'armv7l'
uname_string_raw = ''
@staticmethod
def has_proc_cpuinfo():
return True
@staticmethod
def has_cpufreq_info():
return True
@staticmethod
def cat_proc_c... | {
"content_hash": "e99d258e07bc7bef0b12e2367a12f096",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 86,
"avg_line_length": 31.66923076923077,
"alnum_prop": 0.7070682535827059,
"repo_name": "workhorsy/py-cpuinfo",
"id": "fb9a3a192ac870675428f51e8e9420bfbd154ca9",
"size": ... |
from __future__ import annotations
import unittest
from unittest import mock
from unittest.mock import call, patch
import pytest
from airflow.exceptions import AirflowException
from airflow.providers.google.cloud.hooks.datastore import DatastoreHook
GCP_PROJECT_ID = "test"
def mock_init(
self,
gcp_conn_id... | {
"content_hash": "9cd01debdf9df2bfc2abe5ff68eba984",
"timestamp": "",
"source": "github",
"line_count": 388,
"max_line_length": 108,
"avg_line_length": 40.56958762886598,
"alnum_prop": 0.6561209580077505,
"repo_name": "cfei18/incubator-airflow",
"id": "9a90fa6845f3419be1458d0537adde7d1d33842c",
"si... |
"""Unit tests for converting TensorFlow debugging ops to Relay."""
try:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
except ImportError:
import tensorflow as tf
import numpy as np
from tvm import relay
from tvm.relay.frontend.tensorflow import from_tensorflow
def run_relay(graph):
mod, ... | {
"content_hash": "508383e61ea7178de1ffd8feb6251c15",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 71,
"avg_line_length": 28.03125,
"alnum_prop": 0.6443701226309922,
"repo_name": "dmlc/tvm",
"id": "4f8583f71cff4bfedd6ba6b2b80daa8df799eaed",
"size": "1682",
"binary": fa... |
from __future__ import division, absolute_import, print_function, unicode_literals
# monkey patching
from kasaya.core.lib.mpatcher import damonkey
damonkey()
del damonkey
# imports
from kasaya.conf import settings
from kasaya.core.lib import LOG, system
from kasaya.core.events import add_event_handler
from kasaya.core.... | {
"content_hash": "7b774f8b6f47a8048d50bed029f49814",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 102,
"avg_line_length": 34.640845070422536,
"alnum_prop": 0.6184183777190486,
"repo_name": "AYAtechnologies/Kasaya-esb",
"id": "4074a5488f59ad79ab3dd280edcd2635aeb04fdf",
... |
'''
Scatter
=======
.. image:: images/scatter.gif
:align: right
:class:`Scatter` is used to build interactive widgets that can be translated,
rotated and scaled with two or more fingers on a multitouch system.
Scatter has its own matrix transformation: the modelview matrix is changed
before the children are draw... | {
"content_hash": "714adc59ff55b7103651fe744634c424",
"timestamp": "",
"source": "github",
"line_count": 624,
"max_line_length": 79,
"avg_line_length": 34.12019230769231,
"alnum_prop": 0.6088018411535391,
"repo_name": "jkankiewicz/kivy",
"id": "cd92be05fa151b61e090384e09c1b1fff2149687",
"size": "212... |
import json
from kombu import Connection
from oslo_config import cfg
from st2common import log as logging
from st2common.constants.action import LIVEACTION_STATUS_SUCCEEDED
from st2common.constants.action import LIVEACTION_FAILED_STATES
from st2common.constants.action import LIVEACTION_COMPLETED_STATES
from st2common... | {
"content_hash": "3a3b86ee1b32c926f5553a0de623a210",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 99,
"avg_line_length": 45.35686274509804,
"alnum_prop": 0.628220646723154,
"repo_name": "dennybaa/st2",
"id": "d6249b597139c4b8fda2eaad1466a36181f20bed",
"size": "12346",
... |
'''
@author Jiexin Guo
a set of methods that using json or the changing of class that related to json
Copyright (C) 2013-2014 sysu-software. All Rights Reserved.
'''
import json
import jsonUtil
import string
from database import SqliteDatabase
class modeling:
def __init__(self,database,AValue,BValue,ProteinAName,Pro... | {
"content_hash": "fc0f20720a8a78a1ae6c4d00814aa291",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 149,
"avg_line_length": 48.682758620689654,
"alnum_prop": 0.7512395523445248,
"repo_name": "igemsoftware/SYSU-Software2013",
"id": "7d9f571af44ebd7935498f6c573b1f2e7e748983"... |
from django.core.management.base import BaseCommand
from hc.api.models import Flip
from hc.lib.date import month_boundaries
class Command(BaseCommand):
help = "Prune old Flip objects."
def handle(self, *args, **options):
threshold = min(month_boundaries(months=3))
q = Flip.objects.filter(cr... | {
"content_hash": "a9ba2cf239bd17b41b7ee8149e6d85d9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 54,
"avg_line_length": 26.625,
"alnum_prop": 0.6737089201877934,
"repo_name": "iphoting/healthchecks",
"id": "faa45963fffd65e437f0e1351decba3427eda514",
"size": "426",
"b... |
"""
WSGI config for depot project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` se... | {
"content_hash": "53ff9b8fa3cd2fcb45924389ca8ae586",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 40.42857142857143,
"alnum_prop": 0.799469964664311,
"repo_name": "qianyu668899/Django",
"id": "3da45261a822596fcda5009c8ed766900f7701cb",
"size": "11... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('simplemooc.core.views',
url(r'^$', 'home', name='home'),
url(r'^contact/$', 'contact', name='contact'),
) | {
"content_hash": "8d75aa59436afeb83a155a256bb459e8",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 51,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.6756756756756757,
"repo_name": "kaiocesar/simplemooc",
"id": "5821814bde2ccfcf42564127a44350111fe5dc08",
"size": "... |
from libs.models.student_vgg import VGGStudent
from libs.models.student_rrdb import RRDBStudent
from libs.models.student_residual import ResidualStudent
| {
"content_hash": "e6d36f013320e4f706ebe07808f2b538",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 56,
"avg_line_length": 51,
"alnum_prop": 0.8627450980392157,
"repo_name": "captain-pool/GSOC",
"id": "9dbcbfa8325c12ed6c2a7c263132f35f2bfb4818",
"size": "153",
"binary": f... |
import sys
import numpy as np
from scipy.cluster.vq import whiten
from scipy.cluster.vq import kmeans
from scipy.cluster.vq import vq
import pickle
if len(sys.argv)<3:
print "Usage: python get_clusters.py word_vecs.txt N_CLUST"
print "Perhaps necessary:\n\tcut -d ' ' -f 2- my_reps.txt > word_vecs.txt\n\tawk '{... | {
"content_hash": "23d1c11a5f14950c50a68b2a7e94133c",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 134,
"avg_line_length": 31,
"alnum_prop": 0.7202233250620348,
"repo_name": "corcra/word_reps",
"id": "47d54096bb32856fae9f1fc62600f8697ca62977",
"size": "2761",
"binary":... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/base/shared_lair_base_nest_tree_lg_dark.iff"
result.attribute_template_id = -1
result.stfName("lair_n","generic_nest")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "e32f16796a8b8f41096e0d2a8d23b77d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 24.23076923076923,
"alnum_prop": 0.692063492063492,
"repo_name": "anhstudios/swganh",
"id": "07c85a092f966cbb5af722588b0aa45adbc3de0a",
"size": "460"... |
"""
test_get_vcard.py -- Given the URI of a vcard, return values and uris
assocuiated withe vcard. Handle repeating values such as telephone
and email.
Version 0.1 MC 2014-07-24
-- Initial version for tools 2.0
"""
__author__ = "Michael Conlon"
__copyright__ = "Copyright 2014, University of Flor... | {
"content_hash": "b2c4a082090362160c06155fe3fcb0a1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 73,
"avg_line_length": 28.318181818181817,
"alnum_prop": 0.6725521669341894,
"repo_name": "mconlon17/vivo-1.6-upgrade",
"id": "261490b7837277e8b9f238ff85745135f7669c7d",
"s... |
from yapsy.IPlugin import IPlugin
from api.motor import Motor
from helpers.diode import Diode
class GreenLed(Motor, IPlugin):
def __init__(self):
super().__init__()
self._diode = Diode(led_pin=8)
self._diode.on()
def on_trigger(self, current_state):
if current_state['terminat... | {
"content_hash": "e53c4b10f22560bb1018406a8c05c0a0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 99,
"avg_line_length": 26.642857142857142,
"alnum_prop": 0.561662198391421,
"repo_name": "sceeter89/command-center",
"id": "71a2da692b199370d9ef955bf2ae4d1e434e2a5d",
"size... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 30, transform = "None", sigma = 0.0, exog_count = 0, ar_order = 12); | {
"content_hash": "1cfd53a2f6b0b6a89b1a844ad70f679d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 160,
"avg_line_length": 37.142857142857146,
"alnum_prop": 0.7,
"repo_name": "antoinecarme/pyaf",
"id": "b65ff2113af1dba24b3a2fa74c498e514c35b3e7",
"size": "260",
"binary":... |
import hr_job
| {
"content_hash": "0c14ed3219573684d396e2a1034149f9",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 13,
"avg_line_length": 14,
"alnum_prop": 0.7857142857142857,
"repo_name": "jesus-gh/sumar",
"id": "113786087b71f8a01f49a714cf9403d252fd2be8",
"size": "38",
"binary": false... |
from __future__ import division
import numpy
from chainer.training import extension
class PolynomialShift(extension.Extension):
"""Trainer extension to polynomially shift an optimizer attribute.
This extension polynomially decreases the specified attribute of the
optimizer. The typical use case is a p... | {
"content_hash": "d501077e4ec4387170efd0f3a4097893",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 79,
"avg_line_length": 35.776595744680854,
"alnum_prop": 0.6092774308652988,
"repo_name": "rezoo/chainer",
"id": "5c4a9935b8d25bd0788bff3355ce98a2dea2630f",
"size": "3363",... |
from django import forms
from . import models
class StatusForm(forms.ModelForm):
message = forms.CharField(widget=forms.Textarea)
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
super().__init__(*args, **kwargs)
def save(self, commit=True):
instance = super(... | {
"content_hash": "724b1efa91d34650a967fcb5506e1343",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 52,
"avg_line_length": 22.695652173913043,
"alnum_prop": 0.5919540229885057,
"repo_name": "consideratecode/csrf_example",
"id": "5cdf89ac63ee5e2da1fd26161ab76a98e3c8fc50",
... |
"""
Class for Handling KeystoneEvents in OpenStack's RabbitMQ/QPID
Uses either pika or proton libraries for handling the AMQP protocol, depending whether the message broker is RabbitMQ or QPID, and then implements
the necessary callbacks for Keystone events, such as tenant creation
"""
__copyright__ = "Istituto Nazi... | {
"content_hash": "5e3c20214067f8defe0af555e5ec3502",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 182,
"avg_line_length": 46,
"alnum_prop": 0.6476113794954375,
"repo_name": "egiorgio/ProZaC",
"id": "9c733d4757fd563a0c1b2877e20f4668f8225c90",
"size": "3726",
"binary": ... |
""" An adapter factory that caches adapters per instance. """
import weakref
from traits.api import Any, Bool, HasTraits, Property
from traits.util.api import import_symbol
class CachedAdapterFactory(HasTraits):
""" An adapter factory that caches adapters per instance.
We provide this class to provide the... | {
"content_hash": "c74aa44546c38d91c6f26ec65eafbd04",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 80,
"avg_line_length": 32.46987951807229,
"alnum_prop": 0.5996289424860853,
"repo_name": "burnpanck/traits",
"id": "11af5f10638bc30280b76481215dd767825b50d4",
"size": "3283... |
from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class AbsTests(TranspileTestCase):
def test_abs_not_implemented(self):
self.assertCodeExecution("""
class NotAbsLike:
pass
x = NotAbsLike()
try:
print(abs(x))
exc... | {
"content_hash": "5b5604d3f3cd7acf264573ad41c89695",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 74,
"avg_line_length": 24.608695652173914,
"alnum_prop": 0.568904593639576,
"repo_name": "gEt-rIgHt-jR/voc",
"id": "6f127df258687291b819f50816b87c6b79aaab47",
"size": "566"... |
import pygame, sys, os, utils, animation, button, options, world, save, game
util = utils.Utils()
class Menu(object):
def __init__(self, screen, clock, fps, resolution, version):
self.screen = screen
self.clock = clock
self.fps = fps
self.resolution = resolution
self.halfResolution = (self.resolution[0] //... | {
"content_hash": "c04ad878d29447e81f2ba09345f4c0c4",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 135,
"avg_line_length": 35.673758865248224,
"alnum_prop": 0.6671968190854871,
"repo_name": "pedro-b/layer-switcher",
"id": "38c101839758b46475ae649507b77c7cccc0625f",
"siz... |
""" CISCO_IETF_FRR_MIB
This MIB module contains managed object definitions for MPLS
Fast Reroute (FRR) as defined in\:Pan, P., Gan, D., Swallow, G.,
Vasseur, J.Ph., Cooper, D., Atlas, A., Jork, M., Fast Reroute
Techniques in RSVP\-TE, draft\-ietf\-mpls\-rsvp\-lsp\-fastreroute\-
00.txt, January 2002.
"""
import re
... | {
"content_hash": "c403b990c5b495d16079a538b0ddf17c",
"timestamp": "",
"source": "github",
"line_count": 984,
"max_line_length": 915,
"avg_line_length": 42.11585365853659,
"alnum_prop": 0.6140630278461464,
"repo_name": "111pontes/ydk-py",
"id": "92cbd92e5edb7001a14549068f9e3b83463cd01a",
"size": "41... |
import bac,bcm
import json
import sys
import util
import difflib
from collections import OrderedDict
OUT = "../../../sf4tools-gh-pages/"
BASE = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Super Street Fighter IV - Arcade Edition\\"
HEADER = '''---
layout: default
---
'''
FOOTER = ''''''
def diffCollectionsHea... | {
"content_hash": "6140fefc3d4acc0829dd57b5d6dd5a98",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 175,
"avg_line_length": 39.90747330960854,
"alnum_prop": 0.5291599785981809,
"repo_name": "dantarion/sf4tools",
"id": "0fa0b23ef91297fe212e692be31aaafdbfcf2c5b",
"size": "... |
"""
Module containing the FooWrapper1 class
"""
import subprocess
import time
from wopmars.utils.Logger import Logger
from wopmars.models.ToolWrapper import ToolWrapper
class FooWrapper4(ToolWrapper):
"""
This class has been done for example/testing purpose.
Modifications may lead to failure in tests.
... | {
"content_hash": "dd109e381e8778f0e1517a988baca93d",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 25.607142857142858,
"alnum_prop": 0.6513249651324965,
"repo_name": "aitgon/wopmars",
"id": "78723894f343f909f10f0c39f921cf177b1838fc",
"size": "717",... |
import json
import requests
from django.conf import settings
from .models import Token
def check_token(token):
resp = requests.get(settings.HEROES_URL.format(token))
if resp.status_code == 404:
return False
return True
def new_token():
resp = requests.get(settings.GET_API_KEY_URL)
resp = json.loads(resp.con... | {
"content_hash": "5bf2ddac5cada6e08cd44dcd4b1bc0f7",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 63,
"avg_line_length": 20.08955223880597,
"alnum_prop": 0.7109955423476969,
"repo_name": "devrishik/Heroes",
"id": "da84ea520726f6c4c9e41bed0ad54b66b1a602e8",
"size": "1346... |
from django.db import models
# Create your models here.
class Page(models.Model):
outlinks = models.ManyToManyField('self', related_name='inlinks', symmetrical=False)
title = models.TextField()
contents = models.TextField()
access_probability = models.FloatField()
date = models.DateTimeField(db_in... | {
"content_hash": "6f2c82681f12ac42eab8ed5d0db39097",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 88,
"avg_line_length": 33,
"alnum_prop": 0.7303030303030303,
"repo_name": "eob/synckit-research",
"id": "60626ab08dd700da4be0ef02f6f09b077df5405a",
"size": "330",
"binary... |
import chain_flow
import datetime
import time
class Execute_Cf_Environment():
def __init__(self,cf ):
self.cf = cf
def execute(self):
time_stamp = datetime.datetime.today()
old_day = time_stamp.day
old_hour = time_stamp.hour
old_minute = time_stamp.minute
old_second = time_s... | {
"content_hash": "55a32cbffbb47613a5456825cd593d65",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 73,
"avg_line_length": 26.67515923566879,
"alnum_prop": 0.579512893982808,
"repo_name": "glenn-edgar/local_controller_2",
"id": "f74994e64ddb29be14c738d7dc623dc75f682c27",
... |
from kubernetes_py.utils import is_valid_string, filter_model
class ConfigMapEnvSource(object):
"""
https://kubernetes.io/docs/api-reference/v1.8/#configmapenvsource-v1-core
ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.
The contents of the target ConfigMap's Data... | {
"content_hash": "a12bc3e6c42152380fb69bcfb33ca39d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 114,
"avg_line_length": 31.278688524590162,
"alnum_prop": 0.5225366876310272,
"repo_name": "mnubo/kubernetes-py",
"id": "db661ce0151cdfbdae024e47c519a25f85b0d2ff",
"size": ... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "spring_batch_dashboard.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | {
"content_hash": "1d87aee6619b0121182bb94ef9e65861",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 86,
"avg_line_length": 38,
"alnum_prop": 0.62531328320802,
"repo_name": "vishu-guntupalli/spring-batch-dashboard",
"id": "cd11932a93c9184f0e0114e038fe8f0e59015ad7",
"size":... |
from typing import Union
from selene.core.entity import Element
from selene.core.wait import Command
# noinspection PyPep8Naming
class js:
@staticmethod
def set_value(value: Union[str, int]) -> Command[Element]:
def fn(element: Element):
element.execute_script(
"""
... | {
"content_hash": "7828153fad43a282036a9ac1396a66fd",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 79,
"avg_line_length": 31.5364238410596,
"alnum_prop": 0.49601007979840406,
"repo_name": "yashaka/selene",
"id": "ecd9cef2104013b9f84bd2c7381a7c049c2510c9",
"size": "5878"... |
from .common import *
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
ALLOWED_HOSTS = ['*']
_MIDDLEWARE_CLASSES = (
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
_INSTALLE... | {
"content_hash": "6f090d6222b383a8edbe05cb6ddc8f32",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 65,
"avg_line_length": 19.393939393939394,
"alnum_prop": 0.6453125,
"repo_name": "LucasMagnum/pyexplain",
"id": "4a29b8a9c4bd6287c2ee8b7c994bc0a09ac096fa",
"size": "640",
... |
def test_formula(salt):
'''
Test that the states are synced to minion
'''
dirs = salt('cp.list_master_dirs')
assert 'states' in dirs
def test_wordpress_module(salt):
'''
Test that the wordpress dir grain was set on the minion
'''
wordpressdir = salt('grains.get', 'wordpressdir')
... | {
"content_hash": "48e563a6209381ba71990ef016b8749c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 59,
"avg_line_length": 28.692307692307693,
"alnum_prop": 0.6541554959785523,
"repo_name": "saltstack/salt",
"id": "ac23d2c543c5ea392b650a3f9c73ef6ceb852bc9",
"size": "373",... |
from __future__ import absolute_import, print_function
from base64 import b64encode
import boto.ec2
from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType
from boto.ec2.networkinterface import (
NetworkInterfaceCollection, NetworkInterfaceSpecification)
from .clusterconfig import ClusterConfigu... | {
"content_hash": "5f0453bf092e4285404d3f19824f79f0",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 79,
"avg_line_length": 31.985645933014354,
"alnum_prop": 0.6016454749439043,
"repo_name": "dacut/slurm-ec2-utils",
"id": "433d20bc4b3203318e5fae455793550f103011fb",
"size"... |
"""Class that is responsible for building and assessing proposed.
bonding patterns.
"""
import operator
from typing import List
import numpy as np
from smu import dataset_pb2
from smu.parser import smu_utils_lib
class MatchingParameters:
"""A class to specify optional matching parameters for TopologyMolecule... | {
"content_hash": "5e7da0ffaca89d867c290f28c2682a13",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 106,
"avg_line_length": 32.20065789473684,
"alnum_prop": 0.6527735212994177,
"repo_name": "google-research/google-research",
"id": "90de92e32dc740256962b58783421b63a9ff9fdb"... |
"""
Systemd services
================
This module provides low-level tools for managing `systemd`_ services.
.. _systemd: http://www.freedesktop.org/wiki/Software/systemd
"""
from __future__ import print_function
from fabric.api import hide, settings
from burlap.utils import run_as_root
def action(action, servic... | {
"content_hash": "ea41544f52711601ac43215c1b9549e2",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 83,
"avg_line_length": 17.970149253731343,
"alnum_prop": 0.5930232558139535,
"repo_name": "chrisspen/burlap",
"id": "b24ce36983a1af32e02fb7576588df2978f0ad7d",
"size": "24... |
"""
The module provides all database models at current HEAD.
Its purpose is to create comparable metadata with current database schema.
Based on this comparison database can be healed with healing migration.
"""
from neutron.db import agents_db # noqa
from neutron.db import agentschedulers_db # noqa
from neutron.d... | {
"content_hash": "102aa2513060a869460ccf9a90ad9a57",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 74,
"avg_line_length": 47.85245901639344,
"alnum_prop": 0.7855429941760877,
"repo_name": "bgxavier/neutron",
"id": "a2649a12237dae5da3ded4915d51c2d511128f56",
"size": "3560... |
import random
from deap import base
from deap import creator
from deap import tools
IND_SIZE = 5
creator.create("FitnessMin", base.Fitness, weights=(-1.0, -1.0))
creator.create("Individual", list, fitness=creator.FitnessMin)
toolbox = base.Toolbox()
toolbox.register("attr_float", random.random)
toolbox.register("in... | {
"content_hash": "315c56008d183e35214aca8f5a2bffd4",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 72,
"avg_line_length": 26.607142857142858,
"alnum_prop": 0.6973154362416107,
"repo_name": "GrimRanger/GeneticAlgorithm",
"id": "ff59e088ac3f333e64530cfb29b6ed6afbd24705",
"... |
from verta._swagger.base_type import BaseType
class ModeldbCreateJob(BaseType):
def __init__(self, description=None, start_time=None, end_time=None, metadata=None, job_status=None, job_type=None):
required = {
"description": False,
"start_time": False,
"end_time": False,
"metadata": False... | {
"content_hash": "e0d7d4f40d60a9c4a471c19bdb39c21a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 118,
"avg_line_length": 28.69090909090909,
"alnum_prop": 0.6311787072243346,
"repo_name": "mitdbg/modeldb",
"id": "f1ebc9168b07400f34161183d0edbe447536e65c",
"size": "1621"... |
import pytest
import cupy
from cupy import cuda
from cupy import testing
import cupyx
@pytest.mark.skipif(cuda.runtime.is_hip,
reason='HIP does not support this')
@pytest.mark.skipif(cuda.driver.get_build_version() < 10010,
reason='Only CUDA 10.1+ supports this')
class TestGra... | {
"content_hash": "8f458f8cf16ab1033528969d74d61850",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 79,
"avg_line_length": 34.405797101449274,
"alnum_prop": 0.5653748946925021,
"repo_name": "cupy/cupy",
"id": "6d70f85806bf7ab184ac2515abe6c6840096626e",
"size": "11870",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('foodle_polls', '0006_auto_20160211_2050'),
]
operations = [
migrations.AlterField(
model_name='poll',
name='description',
... | {
"content_hash": "249f50858e6dcc92aa8974258a17031b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 91,
"avg_line_length": 28.892857142857142,
"alnum_prop": 0.5834363411619283,
"repo_name": "FabianWe/foodle",
"id": "f1feeab714b1ac9a83499cd0e370d19d353992bf",
"size": "881"... |
"""Self-tests for (some of) Crypto.Util.number"""
__revision__ = "$Id$"
from Crypto.Util.python_compat import *
import unittest
# NB: In some places, we compare tuples instead of just output values so that
# if any inputs cause a test failure, we'll be able to tell which ones.
class MiscTests(unittest.TestCase):
... | {
"content_hash": "0c1cd634ad5624284ecc2922bdc372a1",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 90,
"avg_line_length": 41.17131474103586,
"alnum_prop": 0.5745113218502033,
"repo_name": "cipicip/appengine",
"id": "1ce8e9071c4e07729e07a40ecc3815c1bd4e1449",
"size": "11... |
import os
import numpy as np
from pyhlm.model import WeakLimitHDPHLM, WeakLimitHDPHLMPython
from pyhlm.internals.hlm_states import WeakLimitHDPHLMStates
from pyhlm.word_model import LetterHSMM, LetterHSMMPython
import pyhsmm
import warnings
from tqdm import trange
warnings.filterwarnings('ignore')
import time
#%%
def ... | {
"content_hash": "d2b0b35c53b85eaed0d653f45dfc0599",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 133,
"avg_line_length": 29.93069306930693,
"alnum_prop": 0.6619252398279855,
"repo_name": "EmergentSystemLabStudent/NPB_DAA",
"id": "a4382dc4cfdea1251ac954ac793d44317c79c58a... |
from . import Validator
from ..errors import InvalidLength
class Length(Validator):
"""Validates the size of value"""
def __init__(self, min=None, max=None):
"""
Args:
min (int): minimum length
max (int): maximum length
"""
self._min = min
self.... | {
"content_hash": "8dd030386faab91a2fdefdcb84a9af96",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 67,
"avg_line_length": 28.096774193548388,
"alnum_prop": 0.5419058553386912,
"repo_name": "holinnn/lupin",
"id": "53cb5ccbbdf802f10acb3428051a048eb8b88cea",
"size": "871",
... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Firefox()
browser.get('http://www.yahoo.com')
assert 'Yahoo' in browser.title
elem = browser.find_element_by_name('p') # Find the search box
elem.send_keys('seleniumhq' + Keys.RETURN)
browser.quit() | {
"content_hash": "5cbe1bc4bd5cb69045b962f6c83c5366",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 63,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.7582781456953642,
"repo_name": "dichovsky/tests",
"id": "f878fa09e72f86645a6a026542a5fc26ccc3e523",
"size": "302"... |
import json
import os
import platform
import tempfile
import time
import unittest
from unittest import mock
import uuid
from knack.util import CLIError
from azure.cli.testsdk.scenario_tests import AllowLargeResponse, record_only
from azure.cli.core.profiles import ResourceType
from azure.cli.testsdk import (
Scena... | {
"content_hash": "14ecb8613c5cf4794227b904e9a4a380",
"timestamp": "",
"source": "github",
"line_count": 1697,
"max_line_length": 764,
"avg_line_length": 51.58868591632292,
"alnum_prop": 0.6102963013729925,
"repo_name": "yugangw-msft/azure-cli",
"id": "4b46db317f2238f330b946fadc98c7a1bcaeae9f",
"siz... |
"""
Providing iterator functions that are not in all version of Python we support.
Where possible, we try to use the system-native version and only fall back to
these implementations if necessary.
"""
def is_iterable(x):
"A implementation independent way of checking for iterables"
try:
iter(... | {
"content_hash": "d343aeb716e1450008594a4fea6cdcb2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 78,
"avg_line_length": 26.733333333333334,
"alnum_prop": 0.6758104738154613,
"repo_name": "diego-d5000/MisValesMd",
"id": "70627e0be4840d2fd205a419ccba95e78e8c910a",
"size"... |
import unittest
import googleapiclient.discovery
from google.cloud import storage
from google.cloud import billing_v1
from resources.base import Resource
storage_client = storage.Client()
billing_client = billing_v1.CloudBillingClient()
resource_client = googleapiclient.discovery.build("cloudresourcemanager", "v3")
p... | {
"content_hash": "282f1a2e11770c317a49caea9a9ceaf5",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 35.07692307692308,
"alnum_prop": 0.7010233918128655,
"repo_name": "GoogleCloudPlatform/professional-services",
"id": "97619e15c51187e7f6ac9be92ba01370d... |
"""MySQLdb type conversion module
This module handles all the type conversions for MySQL. If the default
type conversions aren't what you need, you can make your own. The
dictionary conversions maps some kind of type to a conversion function
which returns the corresponding value:
Key: FIELD_TYPE.* (from MySQLdb.const... | {
"content_hash": "df224bec99ea4cb1c9d43596362db8eb",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 108,
"avg_line_length": 27.674033149171272,
"alnum_prop": 0.6612098223198243,
"repo_name": "mdsafwan/Deal-My-Stuff",
"id": "14b1f522846e7f8d296e9976a3946004e2a05e5b",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('work_entries', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='workentry',
name='end',
fiel... | {
"content_hash": "4e4f2d0391d1ae2a61dd7a479afe7c54",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 59,
"avg_line_length": 21.166666666666668,
"alnum_prop": 0.5905511811023622,
"repo_name": "Clarity-89/clarityv2",
"id": "734c490986c737309d87cad2ca5eca3dce7eb13c",
"size": ... |
from fabric.api import cd
from fabric.api import run
from fabric.api import env
from fabric.api import prefix
from fabric.contrib.files import exists
env.user = 'dhites'
env.host_string = 'hites.org'
env.forward_agent = True
env.no_agent = True
REPO_DIR = '~/repositories'
HITES_REPO_DIR = '~/repositories/hites'
PRO... | {
"content_hash": "db82546b099c940ec4d9dde2c7273e60",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 60,
"avg_line_length": 25.783783783783782,
"alnum_prop": 0.640461215932914,
"repo_name": "Nizebulous/hites",
"id": "46aee94a30420ff34aefa2a86847fda8b6782c75",
"size": "954"... |
"""
Utils for parsing wikipedia category graph
"""
import sys
import re
from string import lower
from bz2 import *
from collections import defaultdict
from operator import itemgetter
from glob import glob
from math import log, exp
def open_or_bz2(file):
if file.endswith('.bz2'):
import bz2
return b... | {
"content_hash": "dd247b60a6e220ca91da5b738015fca8",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 139,
"avg_line_length": 39.00246305418719,
"alnum_prop": 0.5532680770445216,
"repo_name": "josephreisinger/lvm-toolkit",
"id": "71acec579d261bcf34eb953e0db6ec2978480eb1",
... |
from PyObjCTools.TestSupport import *
from AppKit import *
try:
unicode
except NameError:
unicode = str
class TestNSPrintInfo (TestCase):
def testConstants(self):
self.assertEqual(NSPortraitOrientation, 0)
self.assertEqual(NSLandscapeOrientation, 1)
self.assertEqual(NSAutoPaginati... | {
"content_hash": "f8a11e017222f548e0d34b8c302a2d2a",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 46.12643678160919,
"alnum_prop": 0.7530525791178669,
"repo_name": "Khan/pyobjc-framework-Cocoa",
"id": "c9999fd144635b40828563032abfd1669a87da33",
"s... |
__author__ = 'Aaron Hosford'
import unittest
from xcs.bitstrings import BitString
from xcs.scenarios import MUXProblem
class TestMUXProblem(unittest.TestCase):
def setUp(self):
self.scenario = MUXProblem(10)
def test_get_possible_actions(self):
actions = self.scenario.get_possible_actions(... | {
"content_hash": "298ef47c23193cc67b5675595b80a43d",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 62,
"avg_line_length": 31.581818181818182,
"alnum_prop": 0.6234887737478411,
"repo_name": "hosford42/xcs",
"id": "ef5b1ebe1816280dbd8a43787049e74637aa7fc9",
"size": "1737",... |
import os
import importlib
import random
import logging
from flask.ext.script import Command
logger = logging.getLogger()
def load_from_packages(app):
pass
def load_from_folder(app):
"""
This code looks for any modules or packages in the given
directory, loads them
and then register... | {
"content_hash": "f78de54b469df2fa67280530775985bd",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 77,
"avg_line_length": 37.173469387755105,
"alnum_prop": 0.5492725775459786,
"repo_name": "felipevolpone/quokka",
"id": "6e976ebc0852a94e49b670419c8af0468e0efa77",
"size": ... |
__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
import datetime
import calendar
import json
import uuid
import math
from decimal import *
from mock import Mock
from gremlin_python.statics import *
from gremlin_python.structure.graph import Vertex, Edge, Property, VertexProperty, Path
from gremlin_pytho... | {
"content_hash": "2eb7ebbc6e29f0b7dc96b7e2ecffa9f3",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 917,
"avg_line_length": 50.9,
"alnum_prop": 0.5421655484301442,
"repo_name": "apache/tinkerpop",
"id": "c80fa4ab681632e5978a134b875055c734940e1b",
"size": "27767",
"bina... |
import os
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10... | {
"content_hash": "c4c78a287c8ddac86584ec8ae6754162",
"timestamp": "",
"source": "github",
"line_count": 543,
"max_line_length": 133,
"avg_line_length": 31.83977900552486,
"alnum_prop": 0.6662039447047255,
"repo_name": "ngageoint/geoq",
"id": "5ea319112cfa9a3f5127bc3f141f5c16eb5a8799",
"size": "1752... |
from pysnmp.entity import engine, config
from pysnmp.carrier.asynsock.dgram import udp6
from pysnmp.entity.rfc3413 import cmdgen
# Create SNMP engine instance
snmpEngine = engine.SnmpEngine()
#
# SNMPv3/USM setup
#
# user: usr-md5-des, auth: MD5, priv NONE
config.addV3User(
snmpEngine, 'usr-md5-none',
config... | {
"content_hash": "0b8e1cd1ea3dedb7259c6070c7ad6961",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 76,
"avg_line_length": 26.615384615384617,
"alnum_prop": 0.6757225433526012,
"repo_name": "ww9rivers/pysnmp",
"id": "2a9e93a12015c03c4d1249829d6c00f5a0cd45a9",
"size": "219... |
"""A library of tasks.
This interface is intended to implement a wide variety of navigation
tasks. See go/navigation_tasks for a list.
"""
import abc
import collections
import math
import threading
import networkx as nx
import numpy as np
import tensorflow as tf
#from pyglib import logging
#import gin
from envs impor... | {
"content_hash": "798b2ef6c0db0e58c65f622b1c04c8c5",
"timestamp": "",
"source": "github",
"line_count": 1492,
"max_line_length": 80,
"avg_line_length": 39.40080428954423,
"alnum_prop": 0.6464124111182935,
"repo_name": "derekjchow/models",
"id": "c3ef6ca328f7454ffe9aec61a704d1322d680d31",
"size": "5... |
from __future__ import print_function
from math import fabs
import operator
from random import shuffle
from functools import reduce
try:
from scipy.stats.stats import betai
except ImportError:
betai = None
from nltk.compat import xrange, izip
from nltk.util import LazyConcatenation, LazyMap
def accuracy(ref... | {
"content_hash": "99a275c6af9fe207db2108f717513b19",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 88,
"avg_line_length": 34.4027149321267,
"alnum_prop": 0.6410627383927398,
"repo_name": "bbengfort/TextBlob",
"id": "3ec544ab7e37cf2b2147ef5ae76b6e30fe931b39",
"size": "78... |
"""Operations for embeddings."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensor... | {
"content_hash": "ce17952e8db01e1022cebb94311b1595",
"timestamp": "",
"source": "github",
"line_count": 832,
"max_line_length": 81,
"avg_line_length": 42.60216346153846,
"alnum_prop": 0.6440682747919312,
"repo_name": "ageron/tensorflow",
"id": "55f9a9ea0ba699befb0b01dd9d94cc7057abec04",
"size": "36... |
from django.db.models import CharField
from django.db.models.functions import Upper
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class UpperTests(TestCase):
def test_basic(self):
Author.objects.create(name="John Smith", alias="smithj")
... | {
"content_hash": "06a73f105bef054caac75b1dfa8c3461",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 76,
"avg_line_length": 32.395348837209305,
"alnum_prop": 0.5384063173007897,
"repo_name": "MarkusH/django",
"id": "728ea8226504a6e69074f8f85233d4ef6158452a",
"size": "1393"... |
'''
Created on May 20, 2015
This module implements a simple crawler that can start from a given url and collect all urls
and linked content iteratively. You have to specify the amount of pages to download.
Use python3 crawler.py --help for help.
If you want to use it as an API look at the Crawler class.
@author:... | {
"content_hash": "3bd9d359ac39bae090ca2cd731555805",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 151,
"avg_line_length": 46.29100529100529,
"alnum_prop": 0.5920676648759858,
"repo_name": "daniilsorokin/Web-Mining-Exercises",
"id": "b140a11778177dbb4f54cb4bafed2f96ef9ef3... |
"""Test KNX scene."""
from homeassistant.components.knx.const import KNX_ADDRESS
from homeassistant.components.knx.schema import SceneSchema
from homeassistant.const import CONF_ENTITY_CATEGORY, CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassi... | {
"content_hash": "326bd3e766a76b39271fad47eda79718",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 72,
"avg_line_length": 32.853658536585364,
"alnum_prop": 0.6473645137342242,
"repo_name": "home-assistant/home-assistant",
"id": "37e4ac12728aea715e6dde0caade3714011dc2ae",
... |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('duplicates')
class Duplicates(object):
"""
Take action on entries with duplicate field values
Example::
duplicates:
field:... | {
"content_hash": "808eb4cbfe10530da590e53710000551",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 94,
"avg_line_length": 29.29787234042553,
"alnum_prop": 0.5374001452432825,
"repo_name": "gazpachoking/Flexget",
"id": "3390dd5035222f680aad81597089600eb3e1b5e7",
"size": "... |
import os
import tempfile
import unittest
from django.conf import settings
from django.core.cache import cache
from django.core.validators import ValidationError
from django.utils import translation
import mock
from nose.tools import eq_, assert_raises, raises
from amo.utils import (cache_ns_key, escape_all, find_la... | {
"content_hash": "487450449e5c6d5c545da9c60f3dddcb",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 78,
"avg_line_length": 31.63855421686747,
"alnum_prop": 0.5548362528560549,
"repo_name": "wagnerand/zamboni",
"id": "08ff6bb279fd7a01695f7ecca0a764c541087bc5",
"size": "79... |
import os
import pandas as pd
import requests
from datetime import datetime
from furl import furl
SQUASH_API_URL = os.environ.get('SQUASH_API_URL',
'http://localhost:8000/dashboard/api/')
def get_endpoint_urls():
"""
Lookup API endpoint URLs
"""
r = requests.get(SQUAS... | {
"content_hash": "b96508c08c0fa4f4a3c679f47c673b97",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 87,
"avg_line_length": 26.5,
"alnum_prop": 0.5880302848215359,
"repo_name": "lsst-sqre/qa-dashboard",
"id": "f711e50db3b1e0ae05786cda0ee212109cd501ae",
"size": "8321",
"... |
import codecs
import collections
import copy
import csv
import datetime
import logging
import os
import re
import shutil
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom
from king_phisher import archive
from king_phisher import ipaddress
from king_phisher import serializers
from king_phisher import... | {
"content_hash": "8b3a9906a515963d181b80f300470d91",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 135,
"avg_line_length": 40.75369458128079,
"alnum_prop": 0.7331076997461622,
"repo_name": "hdemeyer/king-phisher",
"id": "5bd26482c667798702793fa012827049855d3d5d",
"size"... |
#Redacted information as requested.
#It does so by placing the data into a pandas dataframe and processing the data such that data types
# are correct and anomalous domains are removed.
#Of interest is how since there was not much data - nor many features - natural language processing of
# the domain names wa... | {
"content_hash": "b8f7e245f9c88f230d23bdc6fa52e390",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 192,
"avg_line_length": 43.778625954198475,
"alnum_prop": 0.6750653879686138,
"repo_name": "MichaelMKKang/Projects",
"id": "1b4ddf0bcb9992c08aabca5f3076120bf88b954b",
"siz... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.optim as optim
from utils.helpers import Experience
class Agent(object):
def __init__(self, args, env_prototype, model_prototype, memory_prototype=None):
# logging
... | {
"content_hash": "4de02b0b00af56236526c8e9109374f2",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 188,
"avg_line_length": 48.63436123348018,
"alnum_prop": 0.5750905797101449,
"repo_name": "AlekseyZhelo/pytorch-rl",
"id": "bb19ac593674c5a628b8b0c2d82ceb41e11a6a26",
"siz... |
from __future__ import unicode_literals
from django.db import models, migrations
from cms.utils.i18n import get_language_tuple
class Migration(migrations.Migration):
dependencies = [
('cms', '__first__'),
]
operations = [
migrations.CreateModel(
name='InheritPagePlaceholder'... | {
"content_hash": "dc3e59fc21679dca8bfacf842de5ec2e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 204,
"avg_line_length": 39.65384615384615,
"alnum_prop": 0.6139670223084384,
"repo_name": "bittner/djangocms-inherit",
"id": "2fdfe2240594cb61006ee5f213df5ca30973f795",
"si... |
import dictconfig
import logging
import os
# get the right settings module
settingmodule = os.environ.get('DJANGO_SETTINGS_MODULE', 'settings_local')
if settingmodule.startswith(('zamboni', # typical git clone destination
'workspace', # Jenkins
'project', #... | {
"content_hash": "17282e4670172f708ca5e03e747e9e1b",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 76,
"avg_line_length": 31.044117647058822,
"alnum_prop": 0.6295594504973946,
"repo_name": "clouserw/zamboni",
"id": "ab3f0bd6bb6db835bcbe906a791c9ba7888a3a85",
"size": "211... |
import datetime
import logging
import webapp2
from cosmopolite.lib import models
from cosmopolite.lib import utils
import config
class CleanupPollingInstances(webapp2.RequestHandler):
@utils.local_namespace
def get(self):
cutoff = datetime.datetime.now() - datetime.timedelta(minutes=1)
query = (
... | {
"content_hash": "21984eca9a398e712df11bac46de4e96",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 83,
"avg_line_length": 22.73076923076923,
"alnum_prop": 0.7106598984771574,
"repo_name": "flamingcowtv/cosmopolite",
"id": "32baa05fea847b015540fcf4e08eda33c85a4233",
"size... |
import imp
import os.path
import sys
import unittest
from mojom.generate import module as mojom
from mojom.generate import translate
from mojom.parse import ast
class TranslateTest(unittest.TestCase):
"""Tests |parser.Parse()|."""
def testSimpleArray(self):
"""Tests a simple int32[]."""
# pylint: disabl... | {
"content_hash": "8fb62c9828f86226fa2f363a39b1560a",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 80,
"avg_line_length": 36.53488372093023,
"alnum_prop": 0.6543602800763845,
"repo_name": "scheib/chromium",
"id": "5c9300bec73ed367fb3bb3fc184a3cd4ff1487de",
"size": "3305"... |
import numpy as np
import os, sys, time
sys.path.append('../')
from commons.utils import logger
from commons import utils
from commons import dataloader
import evaluator
# parameter config area
para = {'dataPath': '../data/', # data path
'dataName': 'google-cluster-data', # set the dataset name
'dataT... | {
"content_hash": "a8bbe7c1f23465413dd36a1a56e75499",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 104,
"avg_line_length": 42.75,
"alnum_prop": 0.6239766081871345,
"repo_name": "cuhk-cse/CoMonitor",
"id": "7f3b39d24eb001dec19614c52d21ea71457c826d",
"size": "1936",
"bin... |
from typing import Any
from django.conf import settings
from django.core.cache import cache
from django.core.management.base import BaseCommand
from django.db.models import F
from zerver.models import UserMessage
class Command(BaseCommand):
help = """Script to mark all messages as unread."""
def handle(sel... | {
"content_hash": "26563935c3bf5962dcf075510e2ce94a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 90,
"avg_line_length": 30.58823529411765,
"alnum_prop": 0.7288461538461538,
"repo_name": "brainwane/zulip",
"id": "0e4029459894686a17f98a4729b44f3a7a71f85a",
"size": "520",... |
"""Unit tests for traffic statistics stuff."""
import unittest
import grokapi.queries
class TestGrok(unittest.TestCase):
"""Test Traffic class."""
def test_make_url(self):
"""Test _make_url()."""
grok = grokapi.queries.Grok('fr')
result = grok._make_url('France', 2013, 01)
e... | {
"content_hash": "801ff430afce669a383dd715f6ec9eb7",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 92,
"avg_line_length": 33.964285714285715,
"alnum_prop": 0.6256572029442692,
"repo_name": "Commonists/Grokapi",
"id": "c4ecaf64c750d6a4847556e2534dee632f545323",
"size": "1... |
import nltk
from nltk.collocations import *
import re
import codecs
import logging
import os
class Collocator(object):
def __init__(self, words):
self.words = words
path = os.path.dirname(__file__)
try:
f = codecs.open(os.path.join(path,'stopwords.txt'), 'r', 'utf-8')
... | {
"content_hash": "bfe2e2d4548aa874472682266402b514",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 87,
"avg_line_length": 36.34146341463415,
"alnum_prop": 0.6201342281879194,
"repo_name": "yakxxx/memek",
"id": "ad3ec15e81b82ba96b93d92a77ca0d11a126115d",
"size": "1505",
... |
""" Demo of PipelineDP with Spark.
For running:
1. Install Python and run on the command line `pip install pipeline-dp pyspark absl-py`
2. Run python python run_on_beam.py --input_file=<path to data.txt from 3> --output_file=<...>
"""
from absl import app
from absl import flags
import pyspark
import pipeline_dp
from ... | {
"content_hash": "91092929a5fc110ebc500014c8d38eac",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 94,
"avg_line_length": 34.63013698630137,
"alnum_prop": 0.6550632911392406,
"repo_name": "OpenMined/PipelineDP",
"id": "8da4911b1d6bf5b89dde0982b987172a425aa14f",
"size": "... |
"""
Project views loaded by configuration settings.
Use these views instead of calling the views directly, in order to allow for
settings override of the view class.
"""
from readthedocs.core.utils.extend import SettingsOverrideObject
from readthedocs.projects.views import private
# Project Import Wizard
class Impo... | {
"content_hash": "24b8b1785edd797e1609cb7399eab265",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 76,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.7934959349593496,
"repo_name": "rtfd/readthedocs.org",
"id": "ebae2d8b17313e94399d7e706d0fdac95876e197",
"size": ... |
from __future__ import print_function, division
from .rv import (probability, expectation, density, where, given, pspace, cdf,
sample, sample_iter, random_symbols, independent, dependent)
from sympy import sqrt, simplify
__all__ = ['P', 'E', 'density', 'where', 'given', 'sample', 'cdf', 'pspace',
'sam... | {
"content_hash": "81d6aaf403ea65e03ef676ab6c85acaf",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 78,
"avg_line_length": 24.43867924528302,
"alnum_prop": 0.570546226597182,
"repo_name": "ojengwa/sympy",
"id": "3ac496ed3fd9dcd7a70877b80a65de0b9c35629c",
"size": "5181",
... |
from flask.ext import restful
class Test(restful.Resource):
def get(self):
return {'hello': 'world'}
| {
"content_hash": "c979e24ee01ff85a972d728be09155c0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 33,
"avg_line_length": 19.166666666666668,
"alnum_prop": 0.6521739130434783,
"repo_name": "wtneal/example-web",
"id": "63701c420f72761dfe9e5b0628a65d4077ddd774",
"size": "11... |
"""Class CollectiveAllReduceStrategy implementing DistributionStrategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
from tensorflow.contrib.distribute.python import mirrored_strategy
from tensorflow.core.protobuf import rewriter_config_p... | {
"content_hash": "6d26ceaa4054913e906f6e221fb0516b",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 101,
"avg_line_length": 39.855828220858896,
"alnum_prop": 0.6596628954052182,
"repo_name": "asimshankar/tensorflow",
"id": "346513dc586f208315fd777dc7ddfa500c82f0d7",
"siz... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('basicviz', '0034_alphacorroptions'),
]
operations = [
migrations.AddField(
model_name='alphacorroptions',
name='normalise_al... | {
"content_hash": "d7284b38d7167310a7b9c0e0b15c362e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 52,
"avg_line_length": 22.789473684210527,
"alnum_prop": 0.6096997690531177,
"repo_name": "sdrogers/ms2ldaviz",
"id": "062232047d8fd4a48999acf4c8fedd9e9fc0b685",
"size": "4... |
from wallaby.pf.room import *
from wallaby.backends.couchdb import *
from wallaby.plugins.couchdb.document import *
from twisted.internet import defer
from datetime import date
class Allcontracts(Room):
def __init__(self, name):
Room.__init__(self, name)
self.catch('Custom.In.CreateDueInvoices', s... | {
"content_hash": "10562b64b0295f0fc388f34df53db6d7",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 145,
"avg_line_length": 33.62264150943396,
"alnum_prop": 0.5286195286195287,
"repo_name": "FreshXOpenSource/wallaby-app-crm",
"id": "0cb419526753cf5bbc6cad0a422feb5d53e89e32"... |
"""Adds pre hook to data store queries to hide internal-only data.
Checks if the user has a google.com address, and hides data with the
internal_only property set if not.
"""
import webapp2
from google.appengine.api import apiproxy_stub_map
from google.appengine.api import users
from google.appengine.datastore impor... | {
"content_hash": "39c7704a5a0c743803bb52400591535e",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 80,
"avg_line_length": 32.38461538461539,
"alnum_prop": 0.7294140934283452,
"repo_name": "catapult-project/catapult-csm",
"id": "15aaaba6aabf02a0061c219278084416c2d98793",
... |
'''
@author: frank
'''
import sys, os, os.path
import cephagent
from zstacklib.utils import log
from zstacklib.utils import linux
import zstacklib.utils.iptables as iptables
pidfile = '/var/run/zstack/ceph-backupstorage.pid'
log.configure_log('/var/log/zstack/ceph-backupstorage.log')
logger = log.get_logg... | {
"content_hash": "78106b8a0114e958aed612408475741f",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 105,
"avg_line_length": 30,
"alnum_prop": 0.5948717948717949,
"repo_name": "ghxandsky/zstack-utility",
"id": "4a2d3b5f6ddee16969e4ed443f625157772a29cb",
"size": "1560",
"... |
import csv
# Put the full path to your CSV/Excel file here
MY_FILE = "2016Q2.csv"
opened_file = open(MY_FILE)
# Read the CSV data
csv_data = csv.reader(opened_file, delimiter=',')
# Setup an empty list
parsed_data = []
# Skip over the first line and save the second as headers
next(... | {
"content_hash": "674a73434a62d58c87faea1aee872740",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 27.482758620689655,
"alnum_prop": 0.6424090338770388,
"repo_name": "BadWizard/Inflation",
"id": "b0ef6ce00966b1eeceea44edaeb2f877648e5542",
"size": "... |
from .models import Model | {
"content_hash": "2a886a2174faec3b46dd7cf5fc327536",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 25,
"avg_line_length": 25,
"alnum_prop": 0.84,
"repo_name": "uetke/experimentor",
"id": "c5861bec602afe49128885336325c1f557e7d0e5",
"size": "25",
"binary": false,
"copie... |
from __future__ import print_function
import collections
import itertools
import logging
import sys
import gold_inexact_matching.iterative_parameter_optimizer\
as iterative_optimizer
from gold_inexact_matching import parameter_set
class LocalMinimaParameterOptimizer(
iterative_optimizer.IterativeParameterOp... | {
"content_hash": "7804ad8a70372bff90a79eec474e2181",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 80,
"avg_line_length": 40.77777777777778,
"alnum_prop": 0.6898092643051771,
"repo_name": "scheib/chromium",
"id": "4389dc9619224a85be8091d5dc0defe72cd28c29",
"size": "9338... |
import json
from itertools import ifilter
from django import forms
from django.core.exceptions import ObjectDoesNotExist,ValidationError
from django.forms.widgets import HiddenInput,TextInput
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
from tablemanager.models import (Normalise,NormalTable,Norm... | {
"content_hash": "1bf79a86fd4ce85db3a265fae6b4b87c",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 197,
"avg_line_length": 44.2111801242236,
"alnum_prop": 0.6262995223377353,
"repo_name": "parksandwildlife/borgcollector",
"id": "4aecefe825764240c385197d5ff10c3471109fb2",
... |
import attr
@attr.s()
class UserParameters:
"""
The user parameters entity
"""
profile_name = attr.ib(convert=str, default="Default Profile")
lang = attr.ib(convert=str, default="en")
referential = attr.ib(convert=int, default=0)
expert_mode = attr.ib(convert=bool, default=False)
digit... | {
"content_hash": "fb12f266ed219b4ac95821fddeb1c4da",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 83,
"avg_line_length": 42.4375,
"alnum_prop": 0.569219440353461,
"repo_name": "ucoin-io/cutecoin",
"id": "9bd51205ad63604cef636833f7991f448f4ae52e",
"size": "1358",
"bina... |
from django import forms
# our new form
class ContactForm(forms.Form):
contact_name = forms.CharField(required=True)
contact_email = forms.EmailField(required=True)
content = forms.CharField(
required=True,
widget=forms.Textarea
)
def __init__(self, *args, **kwargs):
super... | {
"content_hash": "79c2af29a373be4cfb096a9f59bcc5bd",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 60,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6336996336996337,
"repo_name": "skylifewww/pharmacognosy",
"id": "d4ad91322c5c9a78b0e21975f44a16e59af7d219",
"siz... |
""" Command Line Interface Module """
import optparse
import sys
import os
import requests
import json
import yaml
import getpass
import curses
import time
import signal
from outbit.parser import yacc
session = requests.Session()
sig_bg_pressed = 0
sig_kill_pressed = 0
# UNICODE
import locale
locale.setlocale(locale.... | {
"content_hash": "de4b4acdaec2ae57c1a0f8b27422470f",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 115,
"avg_line_length": 38.82943925233645,
"alnum_prop": 0.50033094650701,
"repo_name": "starboarder2001/outbit",
"id": "8cd024a5c7e4cdfb0b65dbaed4f063b284638294",
"size":... |
'''This is the main zarkov event server. It uses gevent for a fast event loop in
a single thread. It should typically be invoked with the zarkov-server script.'''
import sys
import time
import logging
from datetime import datetime, timedelta
import bson
import gevent
from gevent_zeromq import zmq
from zarkov import... | {
"content_hash": "40f8f78ca0fbe209cd5c8772527653a2",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 85,
"avg_line_length": 35.721804511278194,
"alnum_prop": 0.5207324773731846,
"repo_name": "joeywen/zarkov",
"id": "0282e61effce69621c62a038e31bb4d42e3d3b4e",
"size": "4751... |
import re
from sqlalchemy.ext.hybrid import hybrid_property
from indico.core.db import db
from indico.util.string import format_repr
class Location(db.Model):
__tablename__ = 'locations'
__table_args__ = (db.Index(None, 'name', unique=True, postgresql_where=db.text('NOT is_deleted')),
... | {
"content_hash": "3f6e0371ea2d099cfb4bc22dc8844601",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 102,
"avg_line_length": 27.025316455696203,
"alnum_prop": 0.5569086651053864,
"repo_name": "DirkHoffmann/indico",
"id": "0370d5e57fc4128ae118bfd28c315406f7789075",
"size": ... |
"""SQL routines for full-text indexing."""
from ggrc import db
from ggrc.fulltext import Indexer
class SqlIndexer(Indexer):
def records_generator(self, record):
for prop, value in record.properties.items():
for subproperty, content in value.items():
if content is not None:
yield self.re... | {
"content_hash": "02c42f5e909f1ddcf4a4fc774785d86a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 72,
"avg_line_length": 32.25454545454546,
"alnum_prop": 0.6364148816234498,
"repo_name": "AleksNeStu/ggrc-core",
"id": "fed13c33f802ba143498b059c990463dc76ec918",
"size": "... |
exec("do evil")
| {
"content_hash": "2a5eb0d5588dbf43f0dcc2b653a6df55",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 15,
"avg_line_length": 16,
"alnum_prop": 0.625,
"repo_name": "pombredanne/bandit",
"id": "17ac83a2731212f5957f0bad0d8eceebe1aa5b3a",
"size": "16",
"binary": false,
"copi... |
import random
from string import ascii_lowercase
from django.db import models
from django import forms
from staging.generators import BaseGenerator
class Generator(BaseGenerator):
name = 'Random full name'
slug = 'random-full-name'
for_fields = [models.CharField]
options_form = None
def __init__(... | {
"content_hash": "5ded135ddfefd8f06fb98b311e2c4b90",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 90,
"avg_line_length": 30.609756097560975,
"alnum_prop": 0.600796812749004,
"repo_name": "code-on/django-staging",
"id": "cb45d4e11f1a252c289d92afd25635ff3298489a",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.