repo_name stringlengths 6 61 | path stringlengths 4 230 | copies stringlengths 1 3 | size stringlengths 4 6 | text stringlengths 1.01k 850k | license stringclasses 15
values | hash int64 -9,220,477,234,079,998,000 9,219,060,020B | line_mean float64 11.6 96.6 | line_max int64 32 939 | alpha_frac float64 0.26 0.9 | autogenerated bool 1
class | ratio float64 1.62 6.1 | config_test bool 2
classes | has_no_keywords bool 2
classes | few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
111t8e/h2o-2 | py/testdir_multi_jvm/test_rf_parity_cmp.py | 9 | 3669 | import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i, h2o_rf
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init(3, java_heap_GB=4)
@classmethod
def tear... | apache-2.0 | -1,359,742,464,387,223,300 | 43.204819 | 146 | 0.56773 | false | 3.438613 | false | false | false |
viswimmer1/PythonGenerator | data/python_files/31241242/paragraph.py | 1 | 5151 | import html
import inline
import re
def forge_line(modifiers, line):
for modifier in modifiers:
line = modifier(line)
return line
class Paragraph:
lines = []
def __init__(self, lines):
self.lines = lines
def build(self):
return self.tail(
reduce(lambda r, ... | gpl-2.0 | -4,387,755,949,561,151,500 | 25.689119 | 80 | 0.584741 | false | 3.542641 | false | false | false |
ver228/tierpsy-tracker | tierpsy/analysis/food_cnt/getFoodContour.py | 1 | 2474 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 18 16:55:14 2017
@author: ajaver
"""
import os
import tables
import numpy as np
import warnings
from .getFoodContourNN import get_food_contour_nn
from .getFoodContourMorph import get_food_contour_morph
from tierpsy.helper.misc import TimeCounter, ... | mit | 7,047,628,497,492,391,000 | 33.84507 | 205 | 0.545675 | false | 3.564841 | false | false | false |
maxalbert/bokeh | bokeh/sphinxext/collapsible_code_block.py | 2 | 3129 | """ Display code blocks in collapsible sections when outputting
to HTML.
Usage
-----
This directive takes a heading to use for the collapsible code block::
.. collapsible-code-block:: python
:heading: Some Code
from __future__ import print_function
print("Hello, Bokeh!")
Options
------... | bsd-3-clause | 8,304,154,637,717,243,000 | 23.445313 | 159 | 0.643976 | false | 3.551646 | false | false | false |
yslib/SGMMCluster | SGMM/TrainSGMM.py | 1 | 11875 | import numpy as np
from multiprocessing import Process
from sklearn import mixture
import time
import os
import sys
# volume data order: width > depth > height
# block order: width > depth > height
# version 1.0 only for int raw data
# by gxchen
# single gauss component
class Gauss:
def __init__(self, weight, me... | mit | -5,475,334,288,070,634,000 | 36.225705 | 282 | 0.530105 | false | 3.486494 | false | false | false |
lorcan/CSVJoin | csvjoin/csvfilter.py | 1 | 1491 | """
csvfilter.py
Copyright (c) 2013 Lorcan Coyle, http://lorcancoyle.org
License: MIT License
Documentation: https://github.com/lorcan/CSVJoin
"""
import argparse
import csv
import sys
parser = argparse.ArgumentParser(description='Takes a CSV files a column header and value and generates a new file that ... | mit | 1,164,402,537,131,164,200 | 34.5 | 170 | 0.697518 | false | 3.736842 | false | false | false |
luzfcb/documentos | src/core/fields.py | 1 | 31981 | import weakref
import django
from django.db import models
from django.db.models import F, Q
from django.db.models.signals import post_init, m2m_changed, post_delete, post_save
from django.utils import six
try:
from django.db.models.expressions import Combinable
QueryExpressionType = Combinable
except ImportErro... | mpl-2.0 | 6,099,096,065,673,854,000 | 42.991747 | 83 | 0.585222 | false | 4.634256 | false | false | false |
etienne-gauvin/music-player-core | tests/test_ffmpeg_memleak.py | 2 | 1471 | # MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import better_exchook
better_exchook.install()
import sys, os, gc
def step():
gc.collec... | bsd-2-clause | 6,221,640,735,279,427,000 | 18.355263 | 101 | 0.717199 | false | 2.75985 | false | false | false |
YeEmrick/learning | stanford-tensorflow/2017/examples/03_linear_regression_starter.py | 1 | 1802 | """ Simple linear regression example in TensorFlow
This program tries to predict the number of thefts from
the number of fire in the city of Chicago
Author: Chip Huyen
Prepared for the class CS 20SI: "TensorFlow for Deep Learning Research"
cs20si.stanford.edu
"""
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
impor... | apache-2.0 | 5,057,828,337,622,505,000 | 26.318182 | 102 | 0.707547 | false | 3.189381 | false | false | false |
benjamindeleener/scad | scripts/scad_validation.py | 1 | 10654 | #!/usr/bin/env python
#########################################################################################
#
# Validation script for SCAD (Spinal Cord Automatic Detection)
#
# Brainhack MTL 2015: Algorithms for automatic spinal cord detection on MR images
#
# This repository is intented to develop and test new alg... | mit | 5,965,855,604,423,026,000 | 40.617188 | 124 | 0.548433 | false | 4.254792 | false | false | false |
Mirantis/disk_perf_test_tool | wally/utils.py | 1 | 3311 | import os
import sys
import uuid
import logging
import datetime
import contextlib
from typing import Any, Tuple, Iterator, Iterable
try:
from petname import Generate as pet_generate
except ImportError:
def pet_generate(_1: str, _2: str) -> str:
return str(uuid.uuid4())
from cephlib.common import run_... | apache-2.0 | -8,652,072,735,847,001,000 | 25.918699 | 102 | 0.621867 | false | 3.385481 | false | false | false |
gstiebler/odemis | src/odemis/gui/comp/text.py | 1 | 36004 | # -*- coding: utf-8 -*-
"""
@author: Rinze de Laat
Copyright © 2012 Rinze de Laat, Delmic
This file is part of Odemis.
Odemis is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License version 2 as published by the Free
Software Foundation.
Odemis is distributed i... | gpl-2.0 | 7,774,501,785,606,925,000 | 34.39823 | 100 | 0.604056 | false | 3.972195 | false | false | false |
davidt/reviewboard | reviewboard/notifications/webhooks.py | 2 | 14135 | from __future__ import unicode_literals
import hashlib
import hmac
import logging
from django.contrib.sites.models import Site
from django.http.request import HttpRequest
from django.utils.six.moves.urllib.parse import urlencode
from django.utils.six.moves.urllib.request import Request, urlopen
from django.template i... | mit | 1,640,804,939,275,645,000 | 36.693333 | 79 | 0.598444 | false | 4.504461 | false | false | false |
robertnishihara/ray | python/ray/tests/test_tempfile.py | 1 | 4486 | import os
import shutil
import sys
import time
import pytest
import ray
from ray.test_utils import check_call_ray
def unix_socket_create_path(name):
unix = sys.platform != "win32"
return os.path.join(ray.utils.get_user_temp_dir(), name) if unix else None
def unix_socket_verify(unix_socket):
if sys.plat... | apache-2.0 | 3,022,115,868,531,882,000 | 33.775194 | 78 | 0.633304 | false | 3.18608 | true | false | false |
yasharmaster/scancode-toolkit | tests/textcode/test_pdf.py | 4 | 3476 | #
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | apache-2.0 | -2,979,898,856,624,776,000 | 38.5 | 82 | 0.709724 | false | 3.832415 | true | false | false |
niklaskorz/pyglet | contrib/wydget/wydget/dragndrop.py | 29 | 1090 |
from pyglet.window import mouse
import event
def DragHandler(rule, buttons=mouse.LEFT):
class _DragHandler(object):
original_position = None
mouse_buttons = buttons
@event.select(rule)
def on_drag(self, widget, x, y, dx, dy, buttons, modifiers):
if not buttons & self.... | bsd-3-clause | -1,381,028,845,524,798,200 | 33.0625 | 73 | 0.569725 | false | 4.160305 | false | false | false |
palletorsson/random_project | project/models.py | 1 | 2628 | #-*-coding:utf-8-*-
from django.db import models
from django.contrib.auth.models import User
from filebrowser.fields import FileBrowseField
import datetime
from posts.models import Post
TYPE_OF_PROJECT = (
('Cases', 'Case'),
('Projects', 'Project'),
('Workshops', 'Workshops'),
('Installation', 'Insta... | gpl-2.0 | -263,856,529,863,515,460 | 34.513514 | 117 | 0.635845 | false | 3.870398 | false | false | false |
srault95/netcall | netcall/base_client.py | 1 | 6680 | # vim: fileencoding=utf-8 et ts=4 sts=4 sw=4 tw=0
"""
Base RPC client class
Authors:
* Brian Granger
* Alexander Glyzov
* Axel Voitier
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012-2014. Brian Granger, Min Ragan-Kelley, Alexander Glyzov,
# Axel Voitier
#
#... | bsd-3-clause | 3,439,111,206,406,363,600 | 31.745098 | 96 | 0.504641 | false | 4.260204 | false | false | false |
edquist/autopyfactory | misc/test-pandamon.py | 1 | 10541 | #!/usr/bin/env python
#
# urllib.urlencode({'abc':'d f', 'def': '-!2'})
# 'abc=d+f&def=-%212'
# urllib.quote_plus()
#
# r = Request(url='http://www.mysite.com')
# r.add_header('User-Agent', 'awesome fetcher')
# r.add_data(urllib.urlencode({'foo': 'bar'})
# response = urlopen(r)
#
# datetime.datetime(2000,1,1)
#
#... | gpl-3.0 | 5,064,762,909,898,847,000 | 43.104603 | 736 | 0.676501 | false | 2.533285 | true | false | false |
alanwill/aws-tailor | sam/functions/talr-director/handler.py | 1 | 7337 | # coding: utf-8
from __future__ import (absolute_import, division, print_function, unicode_literals)
import json
import logging
import boto3
import os
import sys
import time
# Path to modules needed to package local lambda function for upload
currentdir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os... | gpl-3.0 | -1,121,825,964,071,724,800 | 34.616505 | 117 | 0.615102 | false | 4.110364 | false | false | false |
jGaboardi/Facility_Location | LP_File_Creation/PCenter_CODE.py | 1 | 5634 | #p-Center Facility Location Problem
#This script creates a linear programming file to be read into an optimizer.
'''
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbat... | lgpl-3.0 | 3,377,818,703,683,004,400 | 31.373563 | 136 | 0.594993 | false | 3.203641 | false | false | false |
ramnes/qtile | test/widgets/test_check_updates.py | 2 | 5942 | import libqtile.config
from libqtile.bar import Bar
from libqtile.widget.check_updates import CheckUpdates, Popen # noqa: F401
def no_op(*args, **kwargs):
pass
wrong_distro = "Barch"
good_distro = "Arch"
cmd_0_line = "export toto" # quick "monkeypatch" simulating 0 output, ie 0 update
cmd_1_line = "echo toto... | mit | 970,441,983,041,094,500 | 30.606383 | 92 | 0.612083 | false | 3.640931 | true | false | false |
xq262144/hue | desktop/core/ext-py/Django-1.6.10/django/contrib/messages/tests/urls.py | 119 | 2470 | from django.conf.urls import patterns, url
from django.contrib import messages
from django.core.urlresolvers import reverse
from django import forms
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext, Template
from django.template.response import TemplateResponse
from ... | apache-2.0 | -2,582,673,930,275,093,500 | 32.835616 | 91 | 0.703239 | false | 4.04918 | false | false | false |
mfherbst/spack | var/spack/repos/builtin/packages/r-biostrings/package.py | 2 | 1937 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | -6,643,904,999,085,127,000 | 45.119048 | 78 | 0.671141 | false | 3.828063 | false | false | false |
hasteur/hasteurbot_task_3 | families/gentoo_family.py | 4 | 2683 | # -*- coding: utf-8 -*-
import family
__version__ = '$Id$'
# An inofficial Gentoo wiki project.
# Ask for permission at http://gentoo-wiki.com/Help:Bots before running a bot.
# Be very careful, and set a long throttle: "until we see it is good one edit
# ever minute and one page fetch every 30 seconds, maybe a *bit... | gpl-2.0 | -8,546,192,166,647,687,000 | 27.698925 | 79 | 0.480704 | false | 3.493455 | false | false | false |
zeroSteiner/smoke-zephyr | smoke_zephyr/utilities.py | 1 | 27644 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# smoke_zephyr/utilities.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this l... | bsd-3-clause | -767,310,314,023,425,400 | 30.811277 | 184 | 0.704927 | false | 3.28743 | true | false | false |
dmlc/tvm | python/tvm/micro/artifact.py | 3 | 11630 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 | -3,022,239,664,703,990,300 | 38.423729 | 100 | 0.580567 | false | 4.38537 | false | false | false |
andrewyoung1991/supriya | supriya/tools/servertools/test/test_Group_append.py | 1 | 2248 | # -*- encoding: utf-8 -*-
import pytest
from abjad.tools import systemtools
from supriya import synthdefs
from supriya.tools import servertools
@pytest.fixture(scope='function')
def server(request):
def server_teardown():
server.quit()
server = servertools.Server().boot()
request.addfinalizer(serv... | mit | 1,280,575,556,176,140,500 | 24.258427 | 51 | 0.604982 | false | 3.803723 | true | false | false |
petecummings/django-blog-zinnia | zinnia/tests/test_templatetags.py | 7 | 52239 | """Test cases for Zinnia's templatetags"""
from datetime import date
from django.test import TestCase
from django.utils import timezone
from django.template import Context
from django.template import Template
from django.template import TemplateSyntaxError
from django.db.models.signals import post_save
from django.cor... | bsd-3-clause | -3,821,941,366,989,071,400 | 43.195431 | 79 | 0.598805 | false | 4.028611 | true | false | false |
ksmaheshkumar/My-Gray-Hacker-Resources | Network_and_802.11/port_knocking/port_knocking.py | 4 | 1374 | #!/usr/bin/python
from scapy.all import *
import random
import requests
conf.verb=0
base_URL = "http://10.13.37.23:"
def knock(ports):
print "[*] Knocking on ports"+str(ports)
for dport in range(0, len(ports)):
ip = IP(dst = "10.13.37.23")
SYN = ip/TCP(dport=ports[dport], flags="S", window=1... | mit | 4,092,851,726,131,293,000 | 21.9 | 89 | 0.667394 | false | 2.577861 | false | false | false |
manulera/ModellingCourse | ReAct/Python/GenerateMasterEq.py | 1 | 1118 |
import numpy as np
from Gilles import *
import matplotlib.pyplot as plt
from DeviationAnalysis import *
from mpl_toolkits.mplot3d import Axes3D
# Initial conditions
user_input = ['A', 100,
'B', 0]
# Constants (this is not necessary, they could be filled up already in the reaction tuple)
k = (10,10)
# Re... | gpl-3.0 | 2,223,789,481,659,576,000 | 24.431818 | 101 | 0.662791 | false | 2.457143 | false | false | false |
freevoid/yawf | yawf/messages/submessage.py | 1 | 1640 | from . import Message
class Submessage(object):
need_lock_object = True
def __init__(self, obj, message_id, sender,
params=None, need_lock_object=True, raw_params=None):
self.obj = obj
self.sender = sender
self.message_id = message_id
self.params = params
s... | mit | -6,258,077,018,383,261,000 | 31.156863 | 73 | 0.608537 | false | 3.970944 | false | false | false |
WheatonCS/Lexos | lexos/receivers/top_words_receiver.py | 1 | 1409 | """This is the topword receiver for the topword model."""
from enum import Enum
from lexos.receivers.base_receiver import BaseReceiver
class TopwordAnalysisType(Enum):
"""This is the class that assigns the options to constants."""
ALL_TO_PARA = "Each Document to the Corpus"
CLASS_TO_PARA = "Each Documen... | mit | -83,500,371,162,787,890 | 37.081081 | 79 | 0.651526 | false | 4.308869 | false | false | false |
codito/pomito | pomito/plugins/task/text.py | 1 | 1568 | # -*- coding: utf-8 -*-
"""A text file based task plugin implementation."""
import logging
from pomito.plugins import task
from pomito.task import Task
from io import open
__all__ = ['TextTask']
logger = logging.getLogger('pomito.plugins.task.text')
class TextTask(task.TaskPlugin):
"""Implements a plugin to r... | mit | 8,663,580,078,890,446,000 | 29.745098 | 88 | 0.581633 | false | 3.706856 | false | false | false |
pulsar-chem/Pulsar-Core | scripts/newmodulebase.py | 1 | 1154 | #!/usr/bin/env python3
import os
import argparse
import shutil
import psr_common
thispath = os.path.dirname(os.path.realpath(__file__))
modpath = os.path.join(os.path.dirname(thispath), "pulsar", "modulebase")
parser = argparse.ArgumentParser()
parser.add_argument("--author", required=True, help="Author of the file... | bsd-3-clause | 182,136,112,746,278,560 | 30.189189 | 89 | 0.710572 | false | 3.13587 | false | false | false |
cggh/DQXServer | wsgi_api.py | 1 | 3433 | # This file is part of DQXServer - (C) Copyright 2014, Paul Vauterin, Ben Jeffery, Alistair Miles <info@cggh.org>
# This program is free software licensed under the GNU Affero General Public License.
# You can find a copy of this license in LICENSE in the top directory of the source code or at <http://opensource.org/... | agpl-3.0 | 3,646,523,974,521,507,000 | 38.388235 | 136 | 0.631809 | false | 4.091776 | false | false | false |
mlibrary/image-conversion-and-validation | falcom/test/hamcrest/has_attrs.py | 1 | 1640 | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from hamcrest.core.base_matcher import BaseMatcher
class HasAttrs (BaseMatcher):
def __init__ (self, description_text, **kwargs):
... | bsd-3-clause | -3,407,238,684,599,043,000 | 31.156863 | 69 | 0.557927 | false | 4.327177 | false | false | false |
open-switch/ops-cli | ops-tests/feature/test_vtysh_banner.py | 1 | 21649 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | gpl-2.0 | -2,321,846,893,456,399,000 | 32.254992 | 79 | 0.681602 | false | 3.707655 | true | false | false |
jocelynj/weboob | weboob/backends/canalplus/browser.py | 1 | 2453 | # -*- coding: utf-8 -*-
# Copyright(C) 2010 Nicolas Duhamel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will... | gpl-3.0 | 3,005,965,407,463,023,000 | 33.069444 | 108 | 0.67183 | false | 3.560232 | false | false | false |
SciTools/cartopy | lib/cartopy/tests/crs/test_stereographic.py | 2 | 3840 | # Copyright Cartopy Contributors
#
# This file is part of Cartopy and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
import numpy as np
from numpy.testing import assert_almost_equal
import cartopy.crs as ccrs
from .helpers import check_... | lgpl-3.0 | 3,732,546,708,278,523,000 | 42.636364 | 77 | 0.572396 | false | 3.40124 | true | false | false |
Nuttycomputer/pan-os-scripts | panexport.py | 2 | 9602 | #!/usr/bin/env python3
# noinspection PyPackageRequirements
from datetime import datetime
import pan.xapi
import tablib
import xmltodict
import yaml
HEADERS_DEFAULT_MAP = {'rule-type': 'universal', 'negate-source': 'no', 'negate-destination': 'no'}
HEADERS_REMOVE = ['option', 'profile-setting', 'disabled', 'log-end... | mit | 8,419,862,138,909,192,000 | 37.103175 | 119 | 0.639763 | false | 4.03615 | true | false | false |
ptphp/PyLib | src/wmi/service.py | 1 | 2638 | # -*- coding=utf-8 -*-
import win32serviceutil
import win32service
import win32event
import os, sys
import time
import wmi,zlib,json
def log(log_string):
f=open("c:\\log.txt",'a+')
f.write(str(log_string)+"\n\n")
f.close()
def get_sys_info():
syinfo = {}
tmplist = []
encrypt_str = ""
... | apache-2.0 | -5,676,230,241,672,146,000 | 27.988889 | 77 | 0.583589 | false | 3.284635 | false | false | false |
indikaudagedara/frec | scripts/eig_report.py | 1 | 4377 | #!/usr/bin/python
import sys;
import os;
import glob;
import string;
import imp;
import shutil;
import re;
###############################################################
### set up
if len(sys.argv) != 3:
print "usage:"
print "%s <config file> <output dir>" % sys.argv[0];
sys.exit(1);
OutPath = sys.argv[2];
Con... | gpl-2.0 | 6,929,900,721,357,966,000 | 24.300578 | 108 | 0.566598 | false | 2.665652 | true | false | false |
s3nn/NessusExporterMerge | nessus_exporter.py | 1 | 7768 | #!/usr/bin/python
# Modified from averagesecurityguy
# Props to him
# https://github.com/averagesecurityguy/
#
# Command-line parser taken from from below:
# by Konrads Smelkovs (https://github.com/truekonrads)
#
# merger.py
# based off: http://cmikavac.net/2011/07/09/merging-multiple-nessus-scans-python-script... | gpl-3.0 | 4,584,339,561,658,623,500 | 33.678571 | 146 | 0.597451 | false | 3.750845 | false | false | false |
google-research/google-research | ncsnv3/models/layersv3.py | 1 | 6564 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | apache-2.0 | 7,303,468,976,946,167,000 | 28.434978 | 79 | 0.570232 | false | 2.94614 | false | false | false |
Zouyiran/ryu | ryu/app/reduce_t/route_calculator.py | 1 | 3647 | # -*- coding: utf-8 -*-
import networkx as nx
'''
###reduce_t###
--> route calculator
singleton pattern
1) mpls path calculation
2) end to end route calculation
'''
class RouteCalculator(object):
# singletone
_instance = None
def __init__(self):
super(RouteCalculator, self).__init__()
#... | apache-2.0 | 7,582,138,831,157,655,000 | 31.571429 | 85 | 0.46833 | false | 3.830882 | false | false | false |
pmdscully/python_snippets | function_validation_with_decorators/function_validators.py | 1 | 5428 | """
Module provides function argument type and return type validators for @accept(a,b,c) and @returns(x,y,z) function decorators.
This simplifies the formalisation all function validation, particularly useful for API interfaces definition.
Usage Example:
@accepts(int, int)
@returns(int)
def add(a, b)... | apache-2.0 | 7,686,753,299,474,606,000 | 38.05036 | 125 | 0.611275 | false | 4.53467 | false | false | false |
googleinterns/data-dependency-graph-analysis | graph_generation/connection_generator.py | 1 | 12654 | """
This module implements methods for generating random connections between nodes in a graph.
Method generate() will create all the necessary connections for the graph:
dataset <-> dataset collection
system <-> system collection
dataset collection <-> collection
system collection <-> collection
da... | apache-2.0 | 2,970,110,968,751,282,700 | 52.846809 | 124 | 0.642643 | false | 4.374006 | false | false | false |
bgribble/mfp | mfp/gui/modes/patch_edit.py | 1 | 8028 | #! /usr/bin/env python
'''
patch_edit.py: PatchEdit major mode
Copyright (c) 2010 Bill Gribble <grib@billgribble.com>
'''
from ..input_mode import InputMode
from .autoplace import AutoplaceMode
from .selection import SingleSelectionEditMode, MultiSelectionEditMode
from ..text_element import TextElement
from ..proces... | gpl-2.0 | 8,480,811,452,379,209,000 | 38.940299 | 91 | 0.623692 | false | 3.870781 | false | false | false |
wwitzel3/awx | awx/main/models/ad_hoc_commands.py | 1 | 7575 | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import logging
from urlparse import urljoin
# Django
from django.conf import settings
from django.db import models
from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import Valid... | apache-2.0 | -1,621,048,749,649,910,800 | 32.517699 | 113 | 0.622838 | false | 4.148412 | false | false | false |
demisto/content | Packs/FeedDShield/Integrations/FeedDShield/FeedDShield.py | 1 | 1393 | from CommonServerPython import *
def main():
params = {k: v for k, v in demisto.params().items() if v is not None}
params['indicator_type'] = FeedIndicatorType.CIDR
params['url'] = 'https://www.dshield.org/block.txt'
params['ignore_regex'] = "[#S].*"
params['indicator'] = json.dumps({
"r... | mit | -4,287,493,720,206,089,700 | 27.428571 | 78 | 0.460158 | false | 2.976496 | false | false | false |
benhoff/CHATIMUSMAXIMUS | chatimusmaximus/gui/status_bar.py | 1 | 1501 | import os
from PyQt5 import QtWidgets, QtGui, QtCore
class StatusBar(QtWidgets.QStatusBar):
def __init__(self, parent=None):
super(StatusBar, self).__init__(parent)
file_dir = os.path.dirname(__file__)
resource_dir = os.path.join(file_dir, 'resources', 'buttons')
red_button = os.pa... | gpl-3.0 | 3,342,233,628,808,679,000 | 33.113636 | 69 | 0.608261 | false | 3.91906 | false | false | false |
gsathya/flow | backend/app.py | 1 | 2339 | from flask import Flask, json, jsonify, request, render_template, send_from_directory, url_for, redirect
import os
import db
app = Flask(__name__)
@app.route("/", methods=["GET"])
def main():
path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'frontend'))
return send_from_directory(path, "... | mit | -5,937,402,188,431,586,000 | 28.987179 | 104 | 0.640445 | false | 3.131191 | false | false | false |
Entropy512/libsigrokdecode | decoders/pwm/pd.py | 3 | 4862 | ##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2014 Torsten Duwe <duwe@suse.de>
## Copyright (C) 2014 Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public Lic... | gpl-3.0 | -7,475,465,038,127,626,000 | 33.475177 | 84 | 0.575602 | false | 3.587454 | false | false | false |
openstax/openstax-cms | global_settings/models.py | 2 | 2455 | from django.db import models
from wagtail.contrib.settings.models import BaseSetting, register_setting
@register_setting(icon='doc-empty')
class StickyNote(BaseSetting):
start = models.DateTimeField(null=True, help_text="Set the start date to override the content of the Give Sticky. Set the header and body below ... | agpl-3.0 | 6,579,150,917,937,969,000 | 43.636364 | 160 | 0.692872 | false | 4.037829 | false | false | false |
HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/traits-4.3.0-py2.7-macosx-10.10-x86_64.egg/traits/traits_listener.py | 1 | 48349 | #-------------------------------------------------------------------------------
#
# Copyright (c) 2007, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions ... | gpl-2.0 | -5,167,762,272,629,971,000 | 37.070079 | 88 | 0.447248 | false | 5.343021 | false | false | false |
joshzarrabi/e-mission-server | emission/analysis/intake/cleaning/cleaning_methods/speed_outlier_detection.py | 1 | 1328 | # Techniques for outlier detection of speeds. Each of these returns a speed threshold that
# can be used with outlier detection techniques.
# Standard imports
import logging
logging.basicConfig(level=logging.DEBUG)
class BoxplotOutlier(object):
MINOR = 1.5
MAJOR = 3
def __init__(self, multiplier = MAJOR... | bsd-3-clause | -492,698,684,567,668,540 | 33.947368 | 91 | 0.641566 | false | 3.295285 | false | false | false |
veger/ansible | lib/ansible/modules/network/ftd/ftd_file_download.py | 7 | 4441 | #!/usr/bin/python
# Copyright (c) 2018 Cisco and/or its affiliates.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your ... | gpl-3.0 | 3,861,226,979,782,728,700 | 32.900763 | 124 | 0.675749 | false | 3.993705 | false | false | false |
ioiogoo/Vue-News-Board | server/spider/jobbole_news.py | 1 | 1660 | # *-* coding:utf-8 *-*
'''
@author: ioiogoo
@date: 17-1-7 下午1:31
'''
from bs4 import BeautifulSoup
import requests
from base import Base
from models import Jobbole_news
from peewee import IntegrityError
class Jobbole_new(Base):
def __init__(self):
super(Jobbole_new, self).__init__()
self.name = 'J... | gpl-2.0 | 1,136,395,338,779,901,300 | 30.826923 | 97 | 0.489426 | false | 3.761364 | false | false | false |
jmartinm/invenio-master | modules/bibcheck/lib/plugins/dates.py | 21 | 2853 | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) a... | gpl-2.0 | 6,745,335,022,067,054,000 | 34.6625 | 97 | 0.698563 | false | 4.01831 | false | false | false |
andreagrandi/drf3-test | drftest/shop/management/commands/initshopdb.py | 1 | 1247 | from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
from shop.tests.factories import ProductFactory
from shop.models import Product
class Command(BaseCommand):
args = ''
help = ('Initialize an empty DB creating a User... | mit | -6,342,357,560,103,815,000 | 39.225806 | 100 | 0.651965 | false | 3.95873 | false | false | false |
JimCircadian/ansible | lib/ansible/module_utils/network/exos/exos.py | 57 | 3764 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 | -8,666,686,739,159,465,000 | 36.267327 | 94 | 0.707492 | false | 4.306636 | true | false | false |
wcmckee/signinlca | signinlca.py | 1 | 8850 |
# coding: utf-8
# <h1>signinlca</h1>
#
# script to signin for volunteers at lca2015!
#
# The script asks for input of firstname, lastname, tshirt size, amount of coffee volc and comments.
# It creates a python dict with this data along with the current date and hour.
# It gets the username of user and saves the d... | mit | -637,597,969,727,885,300 | 19.533643 | 203 | 0.640904 | false | 2.831094 | true | false | false |
desihub/desisim | py/desisim/spec_qa/s2n.py | 1 | 13194 | """
desisim.spec_qa.s2n
=========================
Module to examine S/N in object spectra
"""
from __future__ import print_function, absolute_import, division
import matplotlib
# matplotlib.use('Agg')
import numpy as np
import sys, os, glob
from matplotlib import pyplot as plt
import matplotlib.gridspec as gridspec
... | bsd-3-clause | 2,979,636,215,285,394,400 | 35.65 | 101 | 0.53926 | false | 3.094278 | false | false | false |
bratsche/Neutron-Drive | google_appengine/google/appengine/ext/ndb/stats.py | 20 | 16377 | """Models to be used when accessing app specific datastore usage statistics.
These entities cannot be created by users, but are populated in the
application's datastore by offline processes run by the Google App Engine team.
"""
# NOTE: All constant strings in this file should be kept in sync with
# those in google/a... | bsd-3-clause | -8,705,452,872,683,001,000 | 35.312639 | 79 | 0.749954 | false | 4.193854 | false | false | false |
CINPLA/expipe-dev | py-open-ephys/pyopenephys/OpenEphys.py | 1 | 17635 | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 3 15:18:38 2014
@author: Dan Denman and Josh Siegle
Loads .continuous, .events, and .spikes files saved from the Open Ephys GUI
Usage:
import OpenEphys
data = OpenEphys.load(pathToFile) # returns a dict with data, timestamps, etc.
"""
import os
import numpy as np... | gpl-3.0 | -8,029,719,130,456,929,000 | 36.364407 | 172 | 0.617522 | false | 3.586537 | false | false | false |
Reilithion/xmms2-reilithion | wafadmin/Environment.py | 1 | 4349 | #!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005 (ita)
"""Environment representation
There is one gotcha: getitem returns [] if the contents evals to False
This means env['foo'] = {}; print env['foo'] will print [] not {}
"""
import os, copy, re
import Logs, Options
from Constants import *
re_imp = re.com... | lgpl-2.1 | 3,419,586,826,123,011,600 | 24.582353 | 86 | 0.663831 | false | 3.097578 | false | false | false |
numbas/editor | editor/email_notification.py | 1 | 4221 | from django.conf import settings
from django.contrib.sites.models import Site
from django.core.mail import send_mail
from django.template.loader import get_template
from accounts.email import unsubscribe_token
class NotificationEmail(object):
plain_template = ''
html_template = ''
def __init__(self,notif... | apache-2.0 | -2,600,545,200,062,274,600 | 33.884298 | 189 | 0.660981 | false | 4.237952 | false | false | false |
creimers/graphene-auth-examples | src/config/base_settings.py | 1 | 4743 | """
Django settings for art_app project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
#... | mit | -1,530,724,595,500,124,000 | 25.06044 | 91 | 0.669197 | false | 3.414687 | false | false | false |
hiunnhue/libchewing | contrib/python/chewing.py | 10 | 1836 | from ctypes import *
from functools import partial
import sys
_libchewing = None
if sys.platform == "win32": # Windows
import os.path
# find in current dir first
dll_path = os.path.join(os.path.dirname(__file__), "chewing.dll")
if not os.path.exists(dll_path):
dll_path = "chewing.dll" # search ... | lgpl-2.1 | -6,890,735,222,982,853,000 | 30.655172 | 69 | 0.626362 | false | 3.170984 | false | false | false |
eonpatapon/contrail-controller | src/config/utils/provision_analytics_node.py | 3 | 6327 | #!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
import time
import argparse
import ConfigParser
from vnc_api.vnc_api import *
from vnc_admin_api import VncApiAdmin
from cfgm_common.exceptions import *
class AnalyticsNodeProvisioner(object):
def __init__(self, a... | apache-2.0 | 2,034,345,302,968,062,200 | 34.948864 | 92 | 0.544492 | false | 4.124511 | true | false | false |
GaretJax/ipd | ipd/libvirt/types.py | 1 | 5162 | import xdrlib
import struct
from collections import namedtuple
class TypeBase(object):
def pack(self, stream, value):
raise NotImplementedError()
def unpack(self, stream):
raise NotImplementedError()
class Type(TypeBase):
def __init__(self, packer, unpacker):
self.pack = packer
... | mit | -3,772,138,830,028,306,000 | 24.428571 | 79 | 0.612941 | false | 3.53078 | false | false | false |
xantage/code | vilya/models/git/diff/diff.py | 1 | 2142 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from itertools import groupby
from vilya.models.utils.decorators import cached_property
from vilya.models.git.diff.patch import Patch
from vilya.models.git.diff.delta import Delta
class Diff(object):
def __init__(self, repo, diff, linecomments=[]):
... | bsd-3-clause | -6,475,592,780,976,578,000 | 28.260274 | 86 | 0.568352 | false | 3.926471 | false | false | false |
mikjo/bigitr | bigitr/gitmerge.py | 1 | 2736 | #
# Copyright 2012 SAS Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | 19,449,266,310,826,400 | 35.972973 | 84 | 0.62902 | false | 4.255054 | false | false | false |
broadinstitute/pywdl | wdl/spec.py | 1 | 1596 | import subprocess
import re
import os
import tempfile
import toc
def run(command, cwd=None):
proc = subprocess.Popen(
command,
shell=True,
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True,
cwd=cwd
)
stdout, stder... | apache-2.0 | -7,772,061,834,200,016,000 | 27 | 86 | 0.599624 | false | 3.179283 | false | false | false |
daeilkim/refinery | refinery/bnpy/bnpy-dev/bnpy/init/FromScratchBernRel.py | 1 | 1534 | '''
FromScratchMult.py
Initialize params of HModel with multinomial observations from scratch.
'''
import numpy as np
from scipy.special import digamma
from scipy.cluster import vq
hasRexAvailable = True
try:
import KMeansRex
except ImportError:
hasRexAvailable = False
def init_global_params(hmodel, Data, initna... | mit | 1,792,730,737,028,571,600 | 31.638298 | 83 | 0.664928 | false | 3.502283 | false | false | false |
josebamartos/np | nplib/pinger.py | 1 | 2341 | '''
Pinger class in nplib library for the np (Network Ping)
Copyright (C) 2015
Joseba Martos <joseba@otzarri.net>
This file is part of np (Network Ping)
Web site: http://otzarri.net/np
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Gener... | gpl-3.0 | -2,401,171,831,415,528,000 | 30.213333 | 73 | 0.599744 | false | 4.128748 | false | false | false |
arkanister/django-flickr-gallery | django_flickr_gallery/admin/photoset.py | 1 | 1194 | from django.contrib import admin
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django_flickr_gallery.admin.forms import PhotosetAdminForm
from django_flickr_gallery.utils.date import parse_unix_datetime
def display_attr(func, short_description=None, boolean... | bsd-3-clause | 834,874,264,519,688,200 | 41.642857 | 118 | 0.71273 | false | 3.802548 | false | false | false |
Atush/py_learning | fixture/contact.py | 1 | 6990 | from model.contact import Contact
from selenium.webdriver.common.by import By
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def create(self, contact):
wd = self.app.wd
# go to create contact page
wd.find_element_by_link_text("add new").click()
... | apache-2.0 | 1,759,000,431,022,635,000 | 43.814103 | 184 | 0.621173 | false | 3.362193 | false | false | false |
sony/nnabla | python/src/nnabla/experimental/parametric_function_class/convolution.py | 1 | 5159 | # Copyright 2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | apache-2.0 | 2,791,790,847,225,436,000 | 48.133333 | 271 | 0.686179 | false | 3.932165 | false | false | false |
glatard/nipype | nipype/interfaces/freesurfer/preprocess.py | 8 | 61456 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Provides interfaces to various commands provided by FreeSurfer
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ )... | bsd-3-clause | 2,728,094,450,304,617,000 | 44.489267 | 356 | 0.548246 | false | 3.887652 | false | false | false |
teamtaverna/core | app/timetables/migrations/0003_auto_20171107_1103.py | 1 | 1250 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-11-07 11:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timetables', '0002_auto_20171005_2209'),
]
operations = [
migrations.AlterFie... | mit | 7,383,553,580,154,259,000 | 30.25 | 133 | 0.5696 | false | 4.180602 | false | false | false |
danpoland/pyramid-restful-framework | pyramid_restful/pagination/linkheader.py | 1 | 1989 | import math
from pyramid.response import Response
from .pagenumber import PageNumberPagination
from .utilities import replace_query_param
__all__ = ['LinkHeaderPagination']
class LinkHeaderPagination(PageNumberPagination):
"""
Add a header field to responses called Link. The value of the Link header conta... | bsd-2-clause | -675,978,130,135,537,900 | 33.894737 | 112 | 0.639517 | false | 3.636197 | false | false | false |
braoru/check-openshift | check_nodes_openshift.py | 1 | 14336 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2013:
# Sébastien Pasche, sebastien.pasche@leshop.ch
# Benoit Chalut, benoit.chalut@leshop.ch
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# ... | agpl-3.0 | -3,173,243,693,299,770,400 | 29.308668 | 110 | 0.604255 | false | 3.954483 | false | false | false |
mbox/django | django/contrib/gis/forms/fields.py | 74 | 4444 | from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
# While this couples the geographic forms to the GEOS library,
# it decouples from database (by not importing SpatialBackend).
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from .... | bsd-3-clause | 2,887,019,537,537,169,400 | 33.184615 | 107 | 0.628038 | false | 4.497976 | false | false | false |
biswasvikrant/pairinteraction | gui/pairinteraction/loader.py | 1 | 3284 | # Copyright (c) 2016 Sebastian Weber, Henri Menke. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | apache-2.0 | -7,418,713,437,166,621,000 | 32.520408 | 81 | 0.576127 | false | 3.698198 | false | false | false |
hobbe/notifry-o | appengine/model/UserMessages.py | 1 | 2803 | # Notifry - Google App Engine backend
#
# Copyright 2011 Daniel Foote
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | apache-2.0 | -6,807,122,138,421,897,000 | 27.612245 | 79 | 0.726365 | false | 3.344869 | false | false | false |
mhvk/astropy | astropy/utils/metadata.py | 5 | 18215 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains helper functions and classes for handling metadata.
"""
from functools import wraps
import warnings
from collections import OrderedDict
from collections.abc import Mapping
from copy import deepcopy
import numpy as np
from astro... | bsd-3-clause | -8,522,740,677,389,237,000 | 35.284861 | 92 | 0.604063 | false | 4.373349 | false | false | false |
muodov/wildfire2 | sample.py | 1 | 1454 | import random
import sys
someconst = 3
def inc(x):
return x + 1
def very_understandable_function(x=5):
def get_eleet():
return x
import platform
print 'Hello, %s (%s)' % (platform.platform(), platform.architecture()[0])
r = 10
print 'I like doing stuff with number: %r' % (r % 42)
... | gpl-2.0 | -1,341,155,777,023,481,600 | 21.369231 | 82 | 0.595598 | false | 3.312073 | false | false | false |
lmaurits/phyltr | tests/clades_tests.py | 1 | 1632 | from phyltr import build_pipeline
from phyltr.commands.clades import Clades
def test_init_from_args():
clades = Clades.init_from_args("")
assert clades.opts.frequency == 0.0
assert clades.opts.ages == False
clades = Clades.init_from_args("--ages")
assert clades.opts.ages == True
clades = Clad... | gpl-3.0 | -6,552,524,085,940,536,000 | 38.804878 | 82 | 0.666667 | false | 2.961887 | false | false | false |
luhn/AutobahnPython | examples/twisted/websocket/echo_variants/client_with_proxy.py | 18 | 2286 | ###############################################################################
##
## Copyright (C) 2011-2013 Tavendo GmbH
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## h... | apache-2.0 | -6,353,372,803,692,614,000 | 30.75 | 79 | 0.583552 | false | 4.217712 | false | false | false |
fffonion/MAClient | plugins/query_tool.py | 1 | 9270 | # coding:utf-8
from _prototype import plugin_prototype
import sys
import re
import os
from cross_platform import *
# start meta
__plugin_name__ = 'query infomation of player'
__author = 'fffonion'
__version__ = 0.40
hooks = {}
extra_cmd = {'q_item':'query_item', 'qi':'query_item', 'q_holo':'query_holo', 'qh'... | gpl-3.0 | 6,578,374,010,661,083,000 | 42.902564 | 170 | 0.451108 | false | 3.327252 | false | false | false |
samitnuk/studentsdb | students/admin.py | 1 | 1802 | from django.contrib import admin
from django.core.urlresolvers import reverse
from django.forms import ModelForm, ValidationError
from .models import Student, Group, Exam, MonthJournal
class StudentAdminForm(ModelForm):
def clean_student_group(self):
"""Check if student is leader in any group.
I... | mit | -4,402,977,145,337,429,000 | 32.490566 | 73 | 0.642817 | false | 3.705637 | false | false | false |
drammock/mnefun | mnefun/_ssp.py | 3 | 26590 | """Preprocessing (SSP and filtering)."""
from collections import Counter
import os
import os.path as op
import warnings
import numpy as np
from mne import (concatenate_raws, compute_proj_evoked, compute_proj_epochs,
write_proj, pick_types, Epochs, compute_proj_raw, read_proj,
make_fi... | bsd-3-clause | 6,273,652,446,083,029,000 | 44.298126 | 79 | 0.53396 | false | 3.418617 | false | false | false |
Harmon758/discord.py | discord/voice_client.py | 1 | 22914 | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merg... | mit | -3,993,753,975,391,410,000 | 34.470588 | 148 | 0.610282 | false | 4.425261 | false | false | false |
rockfruit/bika.lims | bika/lims/jsonapi/datamanagers.py | 1 | 4059 | # -*- coding: utf-8 -*-
from zope import interface
from AccessControl import Unauthorized
from AccessControl import getSecurityManager
from Products.CMFCore import permissions
from bika.lims.jsonapi.exceptions import APIError
from bika.lims.jsonapi.interfaces import IDataManager
from bika.lims.jsonapi.interfaces im... | agpl-3.0 | -2,641,320,435,018,969,000 | 27.1875 | 79 | 0.612959 | false | 4.480132 | false | false | false |
openspending/os-conductor | conductor/blueprints/package/blueprint.py | 2 | 3436 | import logging
import os
import json
from flask import Blueprint, Response, request, abort
from flask.ext.jsonpify import jsonpify
from werkzeug.contrib.cache import MemcachedCache, SimpleCache
from . import controllers
if 'OS_CONDUCTOR_CACHE' in os.environ:
cache = MemcachedCache([os.environ['OS_CONDUCTOR_CACHE... | mit | -518,462,762,546,354,400 | 25.229008 | 74 | 0.639115 | false | 3.571726 | false | false | false |
evernym/plenum | plenum/server/pool_manager.py | 2 | 17041 | import ipaddress
from abc import abstractmethod
from collections import OrderedDict
from typing import Optional
from typing import List
from common.exceptions import LogicError
from plenum.common.messages.internal_messages import VoteForViewChange
from plenum.server.suspicion_codes import Suspicions
from stp_core.c... | apache-2.0 | 7,421,510,375,693,587,000 | 37.729545 | 105 | 0.579367 | false | 3.836335 | false | false | false |
ssoloff/tower-of-hanoi | functional/test/test_tower_of_hanoi.py | 1 | 8489 | import unittest
import unittest.mock as mock
from tower_of_hanoi import Disk, Game, Peg
class DiskTestCase(unittest.TestCase):
def test____eq____when_self_equals_other__returns_true(self):
self.assertEqual(Disk(1), Disk(1))
def test____eq____when_self_size_not_equals_other__returns_false(self):
... | gpl-3.0 | -5,961,525,183,534,607,000 | 36.396476 | 113 | 0.58888 | false | 3.026381 | true | false | false |
ArchiveTeam/blogger-discovery | discover.py | 1 | 3496 | import gzip
import re
import requests
import string
import sys
import time
import random
DEFAULT_HEADERS = {'User-Agent': 'ArchiveTeam'}
class FetchError(Exception):
'''Custom error class when fetching does not meet our expectation.'''
def main():
# Take the program arguments given to this script
# Nor... | unlicense | 4,426,961,121,204,855,000 | 26.527559 | 85 | 0.580378 | false | 4.032295 | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.