text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from htmldoc import *
from chunk import *
from module import *
from js import *
#? This global variable is used to specify where the javascript files are on the server.
JavascriptDir = "./"
#<_ view="internal">A Marker showing where the RPCs are installed</_>
rpcim = Marker("js")
rpcs=["""
<script language='JavaScri... | gandrewstone/yadog | PyHtmlGen/json.py | Python | gpl-3.0 | 2,038 | 0.034838 |
"""Test template specific functionality.
Make sure tables expose their functionality to templates right. This
generally about testing "out"-functionality of the tables, whether
via templates or otherwise. Whether a test belongs here or, say, in
``test_basic``, is not always a clear-cut decision.
"""
from django.temp... | commtrack/commtrack-core | apps/django_tables/tests/test_templates.py | Python | bsd-3-clause | 5,249 | 0.004585 |
"""
Benchmark dataset from:
https://github.com/ekzhu/set-similarity-search-benchmark.
Use "Canada US and UK Open Data":
Indexed sets: canada_us_uk_opendata.inp.gz
Query sets (10 stratified samples from 10 percentile intervals):
Size from 10 - 1k: canada_us_uk_opendata_queries_1k.inp.gz
Size fro... | chubbymaggie/datasketch | benchmark/lshensemble_benchmark.py | Python | mit | 10,558 | 0.004262 |
"""
The Fibonacci numbers, which we are all familiar with, start like this:
0,1,1,2,3,5,8,13,21,34,...
Where each new number in the sequence is the sum of the previous two.
It turns out that by summing different Fibonacci numbers with each other, you can create every single positive integer.
In fact, a much stronger... | DayGitH/Python-Challenges | DailyProgrammer/DP20120709A.py | Python | mit | 2,709 | 0.005537 |
#-*- coding: utf-8 -*-
import inspect
from django import forms
from django.conf import settings as globalsettings
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.contrib.admin.sites import site
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import revers... | thomasbilk/django-filer | filer/fields/file.py | Python | bsd-3-clause | 5,490 | 0.002186 |
# Copyright (C) 2012 Thomas "stacks" Birn (@stacksth)
#
# 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, either version 3 of the License, or
# (at your option) any later version.
#
# This program... | 0x00ach/zer0m0n | signatures/sniffer_winpcap.py | Python | gpl-3.0 | 1,246 | 0.00321 |
# -*- coding: utf-8 -*-
"""
Newspaper treats urls for news articles as critical components.
Hence, we have an entire module dedicated to them.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import logging
import re
from urlparse import (
... | cantino/newspaper | newspaper/urls.py | Python | mit | 9,141 | 0.004376 |
import networkx as nx
import numpy as np
import pandas as pd
def normalise(x):
x = x[:]#deepcopy error
x -= min(x)
x /= max(x)
return x
def jgraph(posjac):
'''
networkx graph object from posjac at timestep
'''
posjac = 1 - normalise(np.log10(posjac).replace([np.inf,-np.inf],np.nan... | wolfiex/DSMACC-testing | zgraph.py | Python | gpl-3.0 | 2,805 | 0.023173 |
##
# Copyright 2009-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# Flemish Research Foundation ... | wpoely86/easybuild-easyblocks | easybuild/easyblocks/q/quantumespresso.py | Python | gpl-2.0 | 15,419 | 0.003178 |
import json
from django.contrib.auth.decorators import user_passes_test
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.shortcuts import render
from crits.core.user_tools import user_can_view_data
from crits... | Magicked/crits | crits/dashboards/views.py | Python | mit | 14,127 | 0.00446 |
#
# 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 writing, software
# ... | rdo-management/heat | heat/api/cfn/v1/signal.py | Python | apache-2.0 | 2,047 | 0 |
import numpy, matplotlib, random, pylab, math
def matrix_square_root(sigma) :
eigen, vect = numpy.linalg.eig(sigma)
dim = len(sigma)
res = numpy.identity(dim)
for i in range(0,dim) :
res[i,i] = eigen[i]**0.5
return vect * res * vect.transpose()
def chi2_level (alpha = 0.95) :
N = 1... | sdpython/ensae_teaching_cs | _todo/pvalues/pvalues_sigma.py | Python | mit | 2,697 | 0.071932 |
"""
Demo of the errorbar function.
"""
import numpy as np
import matplotlib.pyplot as plt
# example data
x = np.arange(0.1, 4, 0.5)
y = np.exp(-x)
plt.errorbar(x, y, xerr=0.2, yerr=0.4)
plt.show()
| cactusbin/nyt | matplotlib/examples/statistics/errorbar_demo.py | Python | unlicense | 200 | 0.005 |
s="the quick brown fox jumped over the lazy dog"
t = s.split(" ")
for v in t:
print(v)
r = s.split("e")
for v in r:
print(v)
x = s.split()
for v in x:
print(v)
# 2-arg version of split not supported
# y = s.split(" ",7)
# for v in y:
# print v
| naitoh/py2rb | tests/strings/split.py | Python | mit | 266 | 0.003759 |
from common_fixtures import * # NOQA
def _clean_clusterhostmap_for_host(host):
for cluster in host.clusters():
cluster.removehost(hostId=str(host.id))
def _resource_is_inactive(resource):
return resource.state == 'inactive'
def _resource_is_active(resource):
return resource.state == 'active'
... | gpndata/cattle | tests/integration/cattletest/core/test_cluster.py | Python | apache-2.0 | 6,493 | 0 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Renaming column for 'Comment.parent_content' to match new field type.
db.rename_column('canvas_comment',... | drawquest/drawquest-web | website/canvas/migrations/0021_auto__chg_field_comment_parent_content__chg_field_comment_reply_conten.py | Python | bsd-3-clause | 9,191 | 0.007399 |
# -*- coding: utf-8 -*-
# Copyright 2015 Objectif Libre
#
# 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 ... | stackforge/cloudkitty | cloudkitty/rating/pyscripts/datamodels/script.py | Python | apache-2.0 | 1,854 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import random
import sys
from couchdb import client
from couchdb import ServerError
class TempDatab... | laroque/couchdb-python3 | couchdb/tests/testutil.py | Python | bsd-3-clause | 1,378 | 0.000726 |
#!/usr/bin/env python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Library for manipulating naclports packages in python.
This library can be used to build tools for working with naclports
p... | adlr/naclports | build_tools/naclports.py | Python | bsd-3-clause | 7,198 | 0.010975 |
from ubuntutweak.janitor import JanitorCachePlugin
class ChromeCachePlugin(JanitorCachePlugin):
__title__ = _('Chrome Cache')
__category__ = 'application'
root_path = '~/.cache/google-chrome/Default'
class ChromiumCachePlugin(JanitorCachePlugin):
__title__ = _('Chromium Cache')
__category__ = 'a... | frdb194/ubuntu-tweak | ubuntutweak/janitor/chrome_plugin.py | Python | gpl-2.0 | 377 | 0.002653 |
#!/usr/bin/env python
# encoding: utf-8
import logging
import math
import time
from django.utils import timezone
import django
from modularodm import Q
from oauthlib.oauth2 import OAuth2Error
from dateutil.relativedelta import relativedelta
django.setup()
from framework.celery_tasks import app as celery_app
from sc... | chrisseto/osf.io | scripts/refresh_addon_tokens.py | Python | apache-2.0 | 3,392 | 0.003833 |
__author__= "barun"
__date__ = "$20 May, 2011 12:19:25 PM$"
## Defines a collection of metrics that can be used to analyze the performance
# of a network.
class Metrics(object):
## Calculate average throughput as: total_bytes_rcvd / duration.
#
# @param pkts_list An iterator object in the... | barun-saha/ns2web | ns2trace/metrics.py | Python | gpl-2.0 | 8,308 | 0.011916 |
# -*- coding: utf-8 -*-
"""
Pygments unit tests
~~~~~~~~~~~~~~~~~~
Usage::
python run.py [testfile ...]
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys, os
if sys.version_info >= (3,):
# copy test suite over ... | sysbot/pastedown | vendor/pygments/tests/run.py | Python | mit | 1,247 | 0.00401 |
"""
Caching instances via ``related_name``
--------------------------------------
``cache_relation`` adds utility methods to a model to obtain ``related_name``
instances via the cache.
Usage
~~~~~
::
from django.db import models
from django.contrib.auth.models import User
class Foo(models.Model):
... | synergeticsedx/deployment-wipro | openedx/core/djangoapps/cache_toolbox/relation.py | Python | agpl-3.0 | 3,965 | 0.000252 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Product.date_added'
db.add_column(u'clone_product', 'date... | indradhanush/Instamojo-Clone | clone/migrations/0002_auto__add_field_product_date_added.py | Python | gpl-3.0 | 4,593 | 0.00762 |
# found at http://stackoverflow.com/questions/855759/python-try-else
# The statements in the else block are executed if execution falls off
# the bottom of the try, i.e. if there was no exception.
try:
operation_that_can_throw_ioerror()
except IOError:
handle_the_exception_somehow()
else:
# we don't wan... | jabbalaci/PrimCom | data/python/my_except.py | Python | gpl-2.0 | 660 | 0.007576 |
# Copyright 2016 The TensorFlow Authors. 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 by applica... | kobejean/tensorflow | tensorflow/contrib/distributions/python/ops/vector_student_t.py | Python | apache-2.0 | 10,470 | 0.001242 |
import ast
import traceback
import os
import sys
userFunctions = {}
renames = ['vex.pragma','vex.motor','vex.slaveMotors','vex.motorReversed']
classNames = []
indent = ' '
sameLineBraces = True
compiled = {}
def module_rename(aNode):
if aNode.func.print_c() == 'vex.pragma':
asC = '#pragma '
useComma =... | NoMod-Programming/PyRobotC | pyRobotC.py | Python | mit | 19,127 | 0.023997 |
# Copyright (c) 2016, German Neuroinformatics Node (G-Node)
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
from __future__ import (absolute_import, division, ... | stoewer/nixpy | nixio/pycore/h5group.py | Python | bsd-3-clause | 10,059 | 0 |
#
# disOps.py v 1.0.0
#
# Copyright (C) 2011 Gil Dabah, http://ragestorm.net/disops/
#
# disOps is a part of the diStorm project, but can be used for anything.
# The generated output is tightly coupled with diStorm data structures which can be found at instructions.h.
# The code in diStorm that actually walks th... | abahdanovich/distorm | disOps/disOps.py | Python | gpl-3.0 | 22,792 | 0.031985 |
#!/usr/bin/env python3
import time
import random
import socket
from flask import Flask, render_template, redirect, url_for, request, jsonify
import config
log = None
# classes
class Agent():
def __init__(self, ip, cw=True, node=None, state='initial'):
self.ip = ip
self.cw = cw
self.state... | secgroup/MTFGatheRing | code/web.py | Python | mit | 7,006 | 0.007708 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from ionyweb.plugin_app.plugin_video.models import Plugin_Video
admin.site.register(Plugin_Video)
| makinacorpus/ionyweb | ionyweb/plugin_app/plugin_video/admin.py | Python | bsd-3-clause | 157 | 0 |
from flask import request, Response, current_app as app, g, abort
from functools import wraps
def requires_auth(endpoint_class):
""" Enables Authorization logic for decorated functions.
:param endpoint_class: the 'class' to which the decorated endpoint belongs
to. Can be 'resource... | opticode/eve | eve/auth.py | Python | bsd-3-clause | 9,706 | 0.000103 |
# -*- coding: utf-8 -*-
#
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import nose
from nose.tools import *
import numpy as np
from sknano.structures import Graphene, PrimitiveCellGraphene, \
ConventionalCellGraphene, GraphenePrimitiveCell, GrapheneConv... | androomerrill/scikit-nano | sknano/structures/tests/test_graphene.py | Python | bsd-2-clause | 1,925 | 0 |
# ============================================================
# modelparser.py
#
# (C) Tiago Almeida 2016
#
# Still in early development stages.
#
# This module uses PLY (http://www.dabeaz.com/ply/ply.html)
# and a set of grammar rules to parse a custom model
# definition language.
# =======================... | jumpifzero/morango | modelparser.py | Python | mit | 5,062 | 0.01857 |
from django.db import models
from django.contrib.auth.models import User
from helper_functions import my_strftime
# Create your models here.
#This only contains metadata about this thread (i.e. just the subject for now)
#It is used in a Many-to-Many relationship with User, with a through object that contains the has_... | rishabhsixfeet/Dock- | MessagesApp/models.py | Python | mit | 1,894 | 0.015312 |
import mock
import simplejson as json
from auslib.global_state import dbo
from auslib.test.admin.views.base import ViewTest
class TestUsersAPI_JSON(ViewTest):
def testUsers(self):
ret = self._get('/users')
self.assertEqual(ret.status_code, 200)
data = json.loads(ret.data)
data['u... | aksareen/balrog | auslib/test/admin/views/test_permissions.py | Python | mpl-2.0 | 45,228 | 0.004533 |
"""
The file preprocesses the files/train.txt and files/test.txt files.
I requires the dependency based embeddings by Levy et al.. Download them from his website and change
the embeddingsPath variable in the script to point to the unzipped deps.words file.
"""
from __future__ import print_function
import numpy as np
... | UKPLab/deeplearning4nlp-tutorial | 2017-07_Seminar/Session 4 - LSTM Sequence Classification/code/preprocess.py | Python | apache-2.0 | 6,664 | 0.012905 |
import pytest
from ..context import dnsimple, fixture_path
from ..request_helper import RequestHelper, request
from dnsimple.client import Client
class TestClient(RequestHelper, object):
def test_constructor_raises_errors_when_improperly_configured(self):
with pytest.raises(dnsimple.credentials.... | vigetlabs/dnsimple | tests/unit/test_client.py | Python | mit | 3,371 | 0.019875 |
from storitell.tastypie.resources import ModelResource
from storitell.stories.models import Story
from storitell.stories.extra_methods import moderate_comment
from storitell.tastypie.validation import Validation
# Stories can be read through a REST-ful interface. It'd be nice
# to be able to POST as well, but that req... | esten/StoriTell | StoriTell/stories/api.py | Python | bsd-3-clause | 583 | 0.015437 |
# vim: ts=4:sw=4:expandtab
# BleachBit
# Copyright (C) 2008-2020 Andrew Ziem
# https://www.bleachbit.org
#
# 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, either version 3 of the License, or
# ... | tstenner/bleachbit | tests/TestWinapp.py | Python | gpl-3.0 | 19,272 | 0.00109 |
# -*- coding: utf-8 -*-
"""
This file contains the Qudi module base class.
Qudi 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 option) any later version.
Qudi is dis... | drogenlied/qudi | core/base.py | Python | gpl-3.0 | 10,150 | 0.001872 |
# coding: utf8
# Copyright 2014-2020 CERN. This software is distributed under the
# terms of the GNU General Public Licence version 3 (GPL Version 3),
# copied verbatim in the file LICENCE.md.
# In applying this licence, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as... | blond-admin/BLonD | blond/toolbox/parameter_scaling.py | Python | gpl-3.0 | 21,008 | 0.004665 |
# -*- coding: utf-8 -*-
"""Parser for AWS ELB access logs.
This parser is based on the log format documented at
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html
Note:
The AWS documentation is not clear about the meaning
of the "target_port_list" field. The assumption ... | joachimmetz/plaso | plaso/parsers/aws_elb_access.py | Python | apache-2.0 | 14,893 | 0.00235 |
def extractStealtranslationHomeBlog(item):
'''
Parser for 'stealtranslation.home.blog'
'''
return None | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractStealtranslationHomeBlog.py | Python | bsd-3-clause | 108 | 0.055556 |
import utils
import os
import shutil
import sys
def go( boost_root ):
OUTPUT = "src/third_party/boost"
if os.path.exists( OUTPUT ):
shutil.rmtree( OUTPUT )
cmd = [ "bcp" , "--scan" , "--boost=%s" % boost_root ]
src = utils.getAllSourceFiles()
cmd += src
cmd.append( OUTP... | robotpilot/robomongo | src/third-party/mongodb/buildscripts/bcp.py | Python | gpl-3.0 | 824 | 0.053398 |
def save_model_as(X, columns, model, save_model, flatten):
'''Model Saver
WHAT: Saves a trained model so it can be loaded later
for predictions by predictor().
'''
model_json = model.to_json()
with open(save_model+".json", "w") as json_file:
json_file.write(model_json)
model.save... | botlabio/autonomio | autonomio/save_model_as.py | Python | mit | 1,376 | 0.001453 |
"""@brief MTTT's core commands, stems from the original version created using Gtk https://github.com/roxana-lafuente/MTTT"""
# !/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
#
# Machine Translation Training Tool
# Copyright (C) 2016 Roxan... | PaulaEstrella/MTTT-PyQT | MTTTCore.py | Python | gpl-3.0 | 15,580 | 0.005969 |
'''
Proxy for drivers.
Copyright (c) 2009, 2013 Peter Parente
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR ... | openrobotics/openrobotics_thunderbot | pyttsx/pyttsx/driver.py | Python | mit | 6,982 | 0.000573 |
# Copyright 2010 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, Inc
# 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.apach... | nkrinner/nova | nova/api/openstack/compute/servers.py | Python | apache-2.0 | 61,851 | 0.00042 |
"""
This config file extends the test environment configuration
so that we can run the lettuce acceptance tests.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=wildcard-import, unused-wildcard-import
from .test import *
f... | nttks/edx-platform | lms/envs/acceptance.py | Python | agpl-3.0 | 6,447 | 0.002482 |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#
#modification, are permitted provided that the following conditions are
#met:
#
... | DLR-SC/DataFinder | src/datafinder/gui/admin/datastore_configuration_wizard/gridftp/__init__.py | Python | bsd-3-clause | 1,999 | 0.018009 |
# Helpers for pytest tests
import subprocess
import json
import os
def find_cppcheck_binary():
possible_locations = [
"./cppcheck",
"./build/bin/cppcheck",
r".\bin\cppcheck.exe",
]
for location in possible_locations:
if os.path.exists(location):
break
else:
... | boos/cppcheck | addons/test/util.py | Python | gpl-3.0 | 1,250 | 0.0008 |
from django.contrib import admin
from .models import User
from application.models import (Contact, Personal, Wife, Occupation, Children,
Hod, Committee, UserCommittee, Legal)
# Register your models here.
class ContactInline(admin.StackedInline):
model = Contact
class PersonalInli... | dhosterman/hebrew_order_david | accounts/admin.py | Python | mit | 1,111 | 0.0018 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | pmghalvorsen/gramps_branch | gramps/gen/utils/string.py | Python | gpl-2.0 | 3,058 | 0.014716 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.safezone.DistributedFindFour
from panda3d.core import BitMask32, CollideMask, CollisionHandler, CollisionHandlerQueue, CollisionNode, CollisionRay, CollisionSphere, CollisionTube, Lens, NodePath, TextNode, Vec3, Vec4
from direct.distributed.ClockDelt... | DedMemez/ODS-August-2017 | safezone/DistributedFindFour.py | Python | apache-2.0 | 35,125 | 0.001964 |
# For some reason, probably because we were trying to serialize the default
# object, we put the "filter" field into the metadata. But the filter doesn't
# make sense for data other than location, so it doesn't seem like it should be
# in the metadata. Putting it into the metadata also means that it is not
# accessible... | yw374cornell/e-mission-server | emission/storage/timeseries/format_hacks/move_filter_field.py | Python | bsd-3-clause | 2,215 | 0.006321 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | OSSESAC/odoopubarquiluz | addons/document_page/wizard/document_page_create_menu.py | Python | agpl-3.0 | 3,491 | 0.002292 |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
DIRECTOR = 0
ACTOR = 1
PRODUCER = 2
SCREENPLAY = 3
PHOTOGRAPHY = 4
WRITER = 5
PEOPLE_ROLE = (
(DIRECTOR, 'Director'),
(ACTOR, 'Actor'),
(PRODUCER, 'Producer'),
(SCREENPLAY, 'Sc... | pdevetto/super-duper-disco | movies/models.py | Python | gpl-3.0 | 1,963 | 0.027509 |
from django.apps import AppConfig
class GeoPositionConfig(AppConfig):
name = 'geoposition'
verbose_name = "GeoPosition"
| philippbosch/django-geoposition | geoposition/apps.py | Python | mit | 129 | 0.007752 |
import numpy as np
from . import errors
from .container import DiskImageContainer
from .segments import SegmentData
class DCMContainer(DiskImageContainer):
valid_densities = {
0: (720, 128),
1: (720, 256),
2: (1040, 128),
}
def get_next(self):
try:
data = self... | robmcmullen/atrcopy | atrcopy/dcm.py | Python | gpl-2.0 | 1,753 | 0.001711 |
import pytest
from cli_config.tag import tag
from utility.nix_error import NixError
def test_tag_show_no_tag(capsys):
with pytest.raises(SystemExit) as _excinfo:
tag.tag("nixconfig", ["show"])
_out, _err = capsys.readouterr()
assert "2" in str(_excinfo.value), "Exception doesn't contain expecte... | mbiciunas/nix | test/cli_config/tag/test_tag_show.py | Python | gpl-3.0 | 1,291 | 0.001549 |
"""Support for an interface resource in Skytap."""
import json
from skytap.framework.ApiClient import ApiClient # noqa
from skytap.models.PublishedServices import PublishedServices # noqa
from skytap.models.SkytapResource import SkytapResource # noqa
class Interface(SkytapResource):
"""One Skytap (network) In... | mapledyne/skytap | skytap/models/Interface.py | Python | mit | 1,497 | 0 |
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pant... | UnrememberMe/pants | contrib/codeanalysis/src/python/pants/contrib/codeanalysis/tasks/index_java.py | Python | apache-2.0 | 3,430 | 0.010496 |
#some useful operations in module arithmetic
def power2(base, mod):
return (base ** 2) % mod
def prod(num1, num2, mod):
return (num1 * num2) % mod
def power(base, exp, mod):
k = 0
while exp >> k != 0:
k += 1
k -= 1
result = base
for i in range(k - 1, -1, -1):
... | AC130USpectre/Python-programs | ModuleOperators.py | Python | gpl-3.0 | 1,078 | 0.004638 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - cli show script
@copyright: 2006 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin.script import MoinScript
from MoinMoin.wsgiapp import run
class PluginScript(MoinScript):
"""\
Purpose:
========
Just run a CLI request... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/script/cli/show.py | Python | mit | 723 | 0.002766 |
import unittest2
from models.event import Event
from models.match import Match
from models.team import Team
class TestKeyNameValidators(unittest2.TestCase):
def setUp(self):
self.valid_team_key = "frc177"
self.valid_team_key2 = "frc1"
self.invalid_team_key = "bcr077"
self.invalid_... | bdaroz/the-blue-alliance | tests/test_key_name_validators.py | Python | mit | 2,185 | 0.003204 |
import Logger
import os
# The following five lines of code MUST ABSOLUTELY appear in this order. DO NOT MOVE OR CHANGE THE FOLLOWING FOUR LINES OF CODE.
# Logger.initPins() Should never be called by the user. It should only be called when this script is automatically run.
Logger.init() # Initialzie the Logger Pytho... | UCHIC/WaterMonitor | Current_Designs/Computational_Datalogger/Software/template.py | Python | bsd-3-clause | 1,582 | 0.006953 |
from neo.io.basefromrawio import BaseFromRaw
from neo.rawio.plexonrawio import PlexonRawIO
class PlexonIO(PlexonRawIO, BaseFromRaw):
"""
Class for reading the old data format from Plexon
acquisition system (.plx)
Note that Plexon now use a new format PL2 which is NOT
supported by this IO.
Co... | samuelgarcia/python-neo | neo/io/plexonio.py | Python | bsd-3-clause | 594 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 9 21:30:31 2019
@author: Rignak
"""
import os
from os.path import join, split
lines = []
for root, folders, filenames in os.walk('..'):
for filename in filenames:
if filename == 'readme.md':
lines += ['']
with open(join(root, filena... | Rignak/Scripts-Python | Servlet/readme_maker.py | Python | gpl-3.0 | 1,062 | 0.000942 |
class Student(object):
"""For student records"""
def __init__(self, name=None):
# This special method is called a "constructor"
self.name = name
def print_name(self):
print self.name
jenny = Student('Jenny')
jenny.print_name() # prints 'Jenny'
### Exercise Time ###
bill = Stud... | karlalopez/hackbright | objects-tom/solution/objects4.py | Python | apache-2.0 | 344 | 0.008721 |
# -*- coding: UTF-8 -*-
# Copyright 2009-2018 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
"""Defines the :class:`DisableDeleteHandler` class.
See :doc:`/dev/delete`.
"""
# import logging ; logger = logging.getLogger(__name__)
from django.conf import settings
from dj... | lino-framework/lino | lino/core/ddh.py | Python | bsd-2-clause | 3,228 | 0.00031 |
import importlib
import json
from .base import MongoEnginericsAdapter
class ApistarWSGIAdapter(MongoEnginericsAdapter):
def __init__(self, *args, **kwargs):
self.engine = importlib.import_module('apistar')
self._wsgi = importlib.import_module('apistar.frameworks.wsgi')
super(ApistarWSGIAda... | monumentum/mongoenginerics | mongoenginerics/adapter/apistar.py | Python | mit | 1,346 | 0 |
import re
import requests
import bs4
from ralybot import hook
from ralybot.util import web
# different forks of cloudflare-scrape have different package layouts
try:
from cfscrape import cfscrape
except ImportError:
import cfscrape
except ImportError:
cfscrape = None
class SteamError(Exception):
pa... | Jakeable/Ralybot | plugins/steamdb.py | Python | gpl-3.0 | 3,386 | 0.003839 |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox()
elif browser == "ch... | Lenchik13/Testing | fixture/application.py | Python | apache-2.0 | 1,000 | 0.001 |
#!/usr/bin/env python
# encoding: utf-8
"""
nim-game.py
Created by Shuailong on 2015-12-21.
https://leetcode.com/problems/nim-game/.
"""
class Solution1(object):
def canWinNim(self, n):
"""
:type n: int
:rtype: bool
"""
'''Too time consuming'''
win1 = True
... | Shuailong/Leetcode | solutions/nim-game.py | Python | mit | 920 | 0.007609 |
# Copyright 2017 The TensorFlow Authors. 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 by applica... | gojira/tensorflow | tensorflow/contrib/tpu/profiler/pip_package/setup.py | Python | apache-2.0 | 2,551 | 0 |
"""Softmax."""
scores = [3.0, 1.0, 0.2]
import numpy as np
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
return np.exp(x) / sum(np.exp(x))
print(softmax(scores))
# Plot softmax curves
import matplotlib.pyplot as plt
x = np.arange(-2.0, 6.0, 0.1)
scores = np.vstack([x, np.ones_... | ds-hwang/deeplearning_udacity | python_practice/quiz1.py | Python | mit | 409 | 0.007335 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bitcamp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jerrrytan/bitcamp | bitcamp/manage.py | Python | mit | 250 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | StefanRijnhart/stock-logistics-warehouse | stock_reserve/model/stock_reserve.py | Python | agpl-3.0 | 6,546 | 0 |
from __future__ import absolute_import
from __future__ import print_function
import theano
import theano.tensor as T
import numpy as np
import time, json, warnings
from collections import deque
from .utils.generic_utils import Progbar
class CallbackList(object):
def __init__(self, callbacks=[], queue_length=10... | zhangxujinsh/keras | keras/callbacks.py | Python | mit | 8,643 | 0.00162 |
# Python test set -- part 6, built-in types
from test_support import *
print '6. Built-in types'
print '6.1 Truth value testing'
if None: raise TestFailed, 'None is true instead of false'
if 0: raise TestFailed, '0 is true instead of false'
if 0L: raise TestFailed, '0L is true instead of false'
if 0.0: raise TestFai... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.2/Lib/test/test_types.py | Python | mit | 14,942 | 0.025833 |
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""Runs some tests about the notification framework.
You can run only these tests by issuing::
$ go team
$ python manage.py test tests.test_notify
Or::
$ go noi
$ python setup.py test -s tests.Project... | lino-framework/book | lino_book/projects/eric/tests/test_notify.py | Python | bsd-2-clause | 5,765 | 0.002951 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-access-approval | google/cloud/accessapproval_v1/services/access_approval/__init__.py | Python | apache-2.0 | 769 | 0 |
# Copyright 2019 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | CanonicalLtd/subiquity | subiquitycore/async_helpers.py | Python | agpl-3.0 | 2,411 | 0 |
# Copyright 2019 Apex.AI, Inc.
#
# 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 writing... | ros2/launch | launch_testing/launch_testing/loader.py | Python | apache-2.0 | 12,234 | 0.002779 |
# Natural Language Toolkit: API for Corpus Readers
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
API for corpus readers.
"""
from __future__ import unicode_litera... | nelango/ViralityAnalysis | model/lib/nltk/corpus/reader/api.py | Python | mit | 17,836 | 0.001682 |
from pele.systems import BaseSystem
import pele.utils.elements.elements as elem # This is a dictionary of element parameters for atoms
class MolecularSystem(BaseSystem):
"""
Representation for a molecular system, this system stores info about atoms, bonds,
angles and torsions.
It is possible to re... | js850/pele | pele/systems/molecularsystem.py | Python | gpl-3.0 | 861 | 0.012776 |
# -*- coding: utf-8 -*-
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
if PY3:
import urllib.parse as urlparse # Es muy lento en PY2. En PY3 es nativo
else:
import urlparse # Usamos... | alfa-addon/addon | plugin.video.alfa/channels/sexgalaxy.py | Python | gpl-3.0 | 4,331 | 0.009242 |
verifyOrder = {
'orderId': 1234,
'orderDate': '2013-08-01 15:23:45',
'prices': [{
'id': 1,
'laborFee': '2',
'oneTimeFee': '2',
'oneTimeFeeTax': '.1',
'quantity': 1,
'recurringFee': '2',
'recurringFeeTax': '.1',
'hourlyRecurringFee': '2',
... | cloudify-cosmo/softlayer-python | SoftLayer/testing/fixtures/SoftLayer_Product_Order.py | Python | mit | 433 | 0 |
# yellowbrick.model_selection
# Visualizers that wrap the model selection libraries of Scikit-Learn
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Fri Mar 30 10:36:12 2018 -0400
#
# ID: __init__.py [c5355ee] benjamin@bengfort.com $
"""
Visualizers that wrap the model selection libraries of Scikit-Le... | DistrictDataLabs/yellowbrick | yellowbrick/model_selection/__init__.py | Python | apache-2.0 | 818 | 0.001222 |
import unittest
import numpy as np
from numpy.testing import assert_allclose
import theano
from keras.layers import convolutional
class TestConvolutions(unittest.TestCase):
def test_convolution_1d(self):
nb_samples = 9
nb_steps = 7
input_dim = 10
filter_length = 6
nb_filte... | johmathe/keras | tests/auto/keras/layers/test_convolutional.py | Python | mit | 6,580 | 0.001976 |
# Authors:
# Pedro Jose Pereira Vieito <pvieito@gmail.com> (Twitter: @pvieito)
#
# URL: https://github.com/mr-orange/Sick-Beard
#
# This file is part of SickRage.
#
# SickRage 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 Softwa... | drglove/SickRage | sickbeard/clients/download_station.py | Python | gpl-3.0 | 2,700 | 0.007037 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Test mempool limiting together/eviction with the wallet
from test_framework.test_framework import Bitc... | bitcoinclassic/bitcoinclassic | qa/rpc-tests/mempool_limit.py | Python | mit | 2,225 | 0.007191 |
#!/usr/bin/pythonTest
# -*- coding: utf-8 -*-
#
# Web functions want links
#
# 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; either version 2 of the License, or
# (at your option) any later vers... | netvigator/myPyPacks | pyPacks/Web/WantLinks.py | Python | gpl-2.0 | 2,653 | 0.026008 |
###############################################################################
#
# file: urlfetcher.py
#
# Purpose: refer to module documentation for details
#
# Note: This file is part of Termsaver application, and should not be used
# or executed separately.
#
#####################################... | wkentaro/termsaver | termsaverlib/screen/urlfetcher.py | Python | apache-2.0 | 2,181 | 0.001834 |
import numpy as np
import sys
import os
import time
from ase import Atom, Atoms
from ase.visualize import view
from ase.units import Bohr
from ase.structure import bulk
from gpaw import GPAW
from gpaw.atom.basis import BasisMaker
from gpaw.response.df import DF
from gpaw.mpi import serial_comm, rank, size
from gpaw.uti... | ajylee/gpaw-rtxs | gpaw/test/aluminum_testcell.py | Python | gpl-3.0 | 1,942 | 0.026262 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Tue 31 May 2016
@author: Fabrizio Coccetti (fabrizio.coccetti@centrofermi.it) [www.fc8.net]
Query Run Db and extract several infos
"""
import os
import MySQLdb
from datetime import datetime, timedelta
import ConfigParser
import logging
import logging.config... | centrofermi/e3monitor | stats/e3sTrackDayStation.py | Python | gpl-3.0 | 3,202 | 0.004685 |
#
# 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... | airbnb/airflow | airflow/contrib/operators/emr_terminate_job_flow_operator.py | Python | apache-2.0 | 1,226 | 0.001631 |
from __future__ import unicode_literals
import collections
import copy
import datetime
import decimal
import math
import warnings
from base64 import b64decode, b64encode
from itertools import tee
from django.db import connection
from django.db.models.loading import get_model
from django.db.models.query_utils import Q... | rogerhu/django | django/db/models/fields/__init__.py | Python | bsd-3-clause | 63,210 | 0.00068 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.