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 django.conf.urls import patterns
from django.conf.urls import url
from django.views.generic import TemplateView
from . import views
urlpatterns = patterns('',
url(
regex=r'^(?P<guide_version>\d+)/$',
view=views.EmailSignUpCreateView.as_view(),
name='email_signup'
),
url(
... | patrickbeeson/diy-trainer | diytrainer/guides/urls.py | Python | mit | 651 | 0.003072 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('calendars', '0004_auto_20150718_1529'),
]
operations = [
migrations.AlterField(
model_name='event',
... | Fisiu/calendar-oswiecim | webapp/calendars/migrations/0005_auto_20150718_1537.py | Python | agpl-3.0 | 451 | 0.002217 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014, 2015 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 opt... | SCOAP3/scoap3 | rawtext_search.py | Python | gpl-2.0 | 9,093 | 0.00176 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009 Arthur Furlan <arthur.furlan@gmail.com>
#
# 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) an... | Kazade/NeHe-Website | public/post_to_twitter.py | Python | bsd-3-clause | 2,865 | 0.001396 |
#!/usr/bin/env python
from setuptools import setup
from ipwb import __version__
with open('README.md') as f:
long_description = f.read()
desc = """InterPlanetary Wayback (ipwb): Web Archive integration with IPFS"""
setup(
name='ipwb',
version=__version__,
url='https://github.com/oduwsdl/ipwb',
do... | oduwsdl/ipwb | setup.py | Python | mit | 2,128 | 0 |
# setup.py
# only if building in place: ``python setup.py build_ext --inplace``
import os
import sys
import platform
import glob
from setuptools import setup, find_packages
from numpy.distutils.core import setup, Extension
os.environ['NPY_DISTUTILS_APPEND_FLAGS'] = '1'
#if os.name == 'nt': # Windows.
# extra_com... | WISDEM/pyFrame3DD | setup.py | Python | gpl-3.0 | 1,499 | 0.00934 |
"""
Demo platform that has two fake alarm control panels.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
import homeassistant.components.alarm_control_panel.manual as manual
def setup_platform(hass, config, add_devices, discovery_info=None):
... | Smart-Torvy/torvy-home-assistant | homeassistant/components/alarm_control_panel/demo.py | Python | mit | 462 | 0 |
#!/usr/bin/env python
#
# Copyright 2017 Google 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 o... | googlecreativelab/beat-blender | main.py | Python | apache-2.0 | 859 | 0.004657 |
import unittest
from nose.tools import ok_, eq_
import datetime
from pymongo import MongoClient
from tests.config import DB_HOST, DB_PORT, DB_NAME
from icePick.recorder import get_database, Structure, Recorder
db = get_database(DB_NAME, DB_HOST, DB_PORT)
class TestStructureModel(Structure):
pass
class TestR... | teitei-tk/ice-pick | tests/test_recorder.py | Python | mit | 2,731 | 0 |
from comics.aggregator.crawler import DagbladetCrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Rutetid"
language = "no"
url = "http://www.dagbladet.no/tegneserie/rutetid/"
rights = "Frode Øverli"
active = False
class Crawler(DagbladetCrawlerBa... | jodal/comics | comics/comics/rutetid.py | Python | agpl-3.0 | 442 | 0 |
# The MIT License
#
# Copyright (c) 2008 William T. Katz
#
# 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, mod... | arcticio/ice-bloc-hdr | handlers/gablog/contact.py | Python | mit | 4,409 | 0.016103 |
"""
This tests both the server and the client, by uppercasing the content of
different files.
"""
import os
import tempfile
import threading
import time
from jqueue import quickstart, server
# These are the names of the jobs, as well as their content
IN_FILES = {
'A': 'a lowercase test',
'B': 'miXeD-caSe',
... | adamnew123456/jqueue | test_all.py | Python | bsd-2-clause | 1,476 | 0.003388 |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... | chetan51/nupic.research | projects/rsm/util.py | Python | gpl-3.0 | 11,475 | 0.00061 |
#!/usr/bin/env python
#************************************************************#
# #
# Author: jacob Hurst #
# File name: create_pdb_file_list.py #
# Date: Wednesday 18 Mar 2009 ... | ACRMGroup/canonicals | extras/src/python/create_pdb_file_list.py | Python | gpl-3.0 | 2,213 | 0.009038 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# test_detect_face.py
import rospy
from std_msgs.msg import Bool
from sensor_msgs.msg import CompressedImage
import sys
import cv2
import numpy as np
class DetectFace:
def __init__(self):
rospy.init_node('detect_face')
self.pub = rospy.Publisher('/en... | utmi-2014/utmi-ros-enshu | enshu20141204/scripts/group15/test_detect_face.py | Python | mit | 2,428 | 0.00557 |
# -*- coding: utf-8 -*-
"""The mlob module calculates the maximum effects of a vehicle on a simply
supported span including the pier reaction for two adjacent simply supported
spans of differing lengths.
"""
import pdb
def analyze_vehicle(axle_spacing, axle_wt, span_length1, span_length2,
num_user_... | mwhit74/moving_loads | ml/mlob.py | Python | mit | 30,601 | 0.005784 |
# Copyright 2014 Mirantis 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 agre... | openstack/manila | manila/tests/network/linux/test_ovs_lib.py | Python | apache-2.0 | 2,893 | 0 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, merge, publish,
... | timj/scons | test/update-release-info/update-release-info.py | Python | mit | 7,263 | 0.014457 |
# -*- encoding: utf-8 -*-
#
# 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 ... | MLnick/spark | python/pyspark/sql/tests.py | Python | apache-2.0 | 110,593 | 0.002297 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... | Xarthisius/girder | girder/api/v1/user.py | Python | apache-2.0 | 19,521 | 0.000922 |
# File has been renamed.
raise DeprecationWarning("This file has been renamed to `fractional_gpus.py` "
"in the same folder!")
| pcmoritz/ray-1 | rllib/examples/partial_gpus.py | Python | apache-2.0 | 152 | 0 |
# 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 applicable ... | eadgarchen/tensorflow | tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver_test.py | Python | apache-2.0 | 5,570 | 0.003232 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | mfem/PyMFEM | mfem/_par/geom.py | Python | bsd-3-clause | 22,071 | 0.004621 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016-2017 University of Dundee & Open Microscopy Environment.
# All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
import requests
from Parse_OMERO_Properties import USERNAME, PASSWORD, OMERO_WEB_HOST, \
... | jburel/openmicroscopy | examples/Training/python/Json_Api/Login.py | Python | gpl-2.0 | 3,163 | 0 |
from staffjoy.resource import Resource
from staffjoy.resources.worker import Worker
from staffjoy.resources.schedule import Schedule
from staffjoy.resources.shift import Shift
from staffjoy.resources.shift_query import ShiftQuery
from staffjoy.resources.recurring_shift import RecurringShift
class Role(Resource):
... | Staffjoy/client_python | staffjoy/resources/role.py | Python | mit | 1,528 | 0.000654 |
# -*- coding: utf-8 -*-
"""
Organization Registry - Controllers
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# -----------------------------------------------------------------------------
def index(... | code-for-india/sahana_shelter_worldbank | controllers/org.py | Python | mit | 10,621 | 0.005932 |
#! python3
# countdown.py - A simple countdown script.
import time, subprocess
timeLeft = 60
while timeLeft > 0:
print(timeLeft, end='')
time.sleep(1)
timeLeft = timeLeft - 1
# TODO: At the end of the countdown, play a sound file.
subprocess.Popen(['start', 'alarm.wav'], shell=True)
| rfreiberger/Automate-the-Boring-Stuff | ch15/countdown.py | Python | bsd-2-clause | 317 | 0.0347 |
class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
for i in xrange(height):
foundzero = False
... | hufeiya/leetcode | python/73_Set_Matrix_Zeroes.py | Python | gpl-2.0 | 1,004 | 0.002988 |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Float32
import numpy as np
import soccer_PK.utils
rospy.init_node("reward")
pub = rospy.Publisher("reward", Float32, queue_size=10)
rate = rospy.Rate(3)
rospy.wait_for_service('/gazebo/get_model_state')
soccer_PK.utils.reset_world()
# intial postion
ball_p... | syoamakase/Re-ROS | re_environments/src/soccer_PK/soccer_PK_reward.py | Python | apache-2.0 | 1,763 | 0.003971 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/media/Home/Documents/SoftProjects/LDM/OAGui/src/Control/Ui/OAMultiplot.ui'
#
# Created: Tue Apr 16 14:32:36 2013
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, Qt... | wyrdmeister/OnlineAnalysis | OAGui/src/Control/Ui/Ui_OAMultiplot.py | Python | gpl-3.0 | 6,385 | 0.002819 |
import unittest
from nose.tools import * # flake8: noqa
from website.util import sanitize
class TestSanitize(unittest.TestCase):
def test_escape_html(self):
assert_equal(
sanitize.clean_tag('<script> evil code </script>'),
'<script> evil code </script>',
)
... | ckc6cz/osf.io | tests/test_sanitize.py | Python | apache-2.0 | 2,081 | 0.002883 |
from conans import ConanFile, tools, CMake
import os
class SceltaConan(ConanFile):
name = "scelta"
version = "0.1"
url = "https://github.com/SuperV1234/scelta.git"
build_policy = "missing"
settings = "os", "compiler", "build_type", "arch"
def source(self):
self.run("git clone https://g... | SuperV1234/scelta | conanfile.py | Python | mit | 777 | 0.003861 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------
# File: controller/controller_parser.py
# Created: 2015-01-17
# Purpose: Controll commandline arguments for parsing files
#
# Copyright
# ------------------------------------... | Ever-Never/smalisca | smalisca/controller/controller_parser.py | Python | mit | 10,504 | 0.000476 |
# -*- coding: utf-8 -*-
import cPickle
import sys, os
import numpy as np
# written by zhaowuxia @ 2015/5/22
# used for generate datasets for the adding problem
def generate_data(pkl_path, T, norm):
dataset = []
for f in os.listdir(pkl_path):
data = cPickle.load(open(os.path.join(pkl_path, f), 'rb'))
... | Dlyma/keras-plus | keras/datasets/stock.py | Python | mit | 1,315 | 0.008365 |
import warnings
from sqlalchemy.testing import eq_, is_, assert_raises, assert_raises_message
from sqlalchemy import *
from sqlalchemy import exc as sa_exc, util, event
from sqlalchemy.orm import *
from sqlalchemy.orm.util import instance_str
from sqlalchemy.orm import exc as orm_exc, attributes
from sqlalchemy.testing... | robin900/sqlalchemy | test/orm/inheritance/test_basic.py | Python | mit | 94,636 | 0.005653 |
from promise import Promise
from ..utils import base64, unbase64, is_str
from .connectiontypes import Connection, PageInfo, Edge
def connection_from_list(data, args=None, **kwargs):
'''
A simple function that accepts an array and connection arguments, and returns
a connection object for use in GraphQL. I... | public-ink/public-ink | server/appengine/lib/graphql_relay/connection/arrayconnection.py | Python | gpl-3.0 | 4,642 | 0.00237 |
#! /usr/bin/env python
"""
This script checks HighGUI's cvGetCaptureProperty functionality for correct return
of the frame width and height of an .avi file containing uncompressed 32bit Bitmap frames.
"""
# name if this test and it's requirements
TESTNAME = "size_bmp32"
REQUIRED = []
# needed for sys.exit(int), .wor... | shiftcontrol/UnityOpenCV | opencv/tests/swig_python/highgui/size_bmp32.py | Python | gpl-3.0 | 739 | 0.016238 |
# Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... | mancoast/CPythonPyc_test | fail/301_test_decimal.py | Python | gpl-3.0 | 53,155 | 0.006095 |
from iadfa import IncrementalAdfa
f = ["append", "appendice", "bappend"]
fsa = IncrementalAdfa(f, sorted = True)
fsa.graphVizExport("test.dot")
| jpbarrette/moman | finenight/python/iadfaTest.py | Python | mit | 146 | 0.013699 |
from numbers import Integral, Real
from itertools import chain
import string
import numpy as np
import openmc.checkvalue as cv
import openmc.data
# Supported keywords for continuous-energy cross section plotting
PLOT_TYPES = ['total', 'scatter', 'elastic', 'inelastic', 'fission',
'absorption', 'capture... | johnnyliu27/openmc | openmc/plotter.py | Python | mit | 38,526 | 0.000182 |
import io
import os
import sys
from atomicwrites import atomic_write
from copy import deepcopy
from multiprocessing import Pool, cpu_count
from six import ensure_text
from . import jsonlib
from . import vcs
from .item import (ConformanceCheckerTest,
CrashTest,
ManifestItem,
... | KiChjang/servo | tests/wpt/web-platform-tests/tools/manifest/manifest.py | Python | mpl-2.0 | 18,236 | 0.001206 |
# -*- coding: utf-8 -*-
# Aualé oware graphic user interface.
# Copyright (C) 2014-2020 Joan Sala Soler <contact@joansala.com>
#
# 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... | joansalasoler/auale | src/auale/gui/actors/label.py | Python | gpl-3.0 | 3,526 | 0 |
import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="tickvals", parent_name="parcoords.dimension", **kwargs
):
super(TickvalsValidator, self).__init__(
plotly_name=plotly_name,
par... | plotly/python-api | packages/python/plotly/plotly/validators/parcoords/dimension/_tickvals.py | Python | mit | 473 | 0.002114 |
"""
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.
Written (W) 2013 Heiko Strathmann
"""
from kameleon_mcmc.distribution.Gauss... | karlnapf/kameleon-mcmc | kameleon_mcmc/experiments/scripts/glass_ard/glass_ard_ground_truth.py | Python | bsd-2-clause | 4,033 | 0.011654 |
"""Class to hold all thermostat accessories."""
import logging
from pyhap.const import CATEGORY_THERMOSTAT
from homeassistant.components.climate.const import (
ATTR_CURRENT_HUMIDITY,
ATTR_CURRENT_TEMPERATURE,
ATTR_HUMIDITY,
ATTR_HVAC_ACTION,
ATTR_HVAC_MODE,
ATTR_HVAC_MODES,
ATTR_MAX_TEMP,
... | nkgilley/home-assistant | homeassistant/components/homekit/type_thermostats.py | Python | apache-2.0 | 25,247 | 0.00103 |
# -*- coding: utf-8 -*-
from ..algorithm import ga
import parameter
import tune
import sys
import os
import signal
import time
class Ui(object):
"""
This class handle both the CUI and the GUI.
:param rc: a instance of the `rapidconfig.RapidConfig`.
"""
def __init__(self, rc):
self.tuner = None
self.seq = N... | KNCT-KPC/RapidHouse | rapidhouse/lib/ui.py | Python | mit | 3,916 | 0.035291 |
# Copyright (C) 2014,2015 VA Linux Systems Japan K.K.
# Copyright (C) 2014,2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
# 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 t... | jerryz1982/neutron | neutron/plugins/openvswitch/agent/openflow/ovs_ofctl/br_tun.py | Python | apache-2.0 | 10,433 | 0 |
""" The bellman ford algorithm for calculating single source shortest
paths - CLRS style """
graph = {
's' : {'t':6, 'y':7},
't' : {'x':5, 'z':-4, 'y':8 },
'y' : {'z':9, 'x':-3},
'z' : {'x':7, 's': 2},
'x' : {'t':-2}
}
INF = float('inf')
dist = {}
predecessor = {}
def initialize_single_source(gr... | Bernardinhouessou/Projets_Autres | Python-Projets/Scripts/Algorithms-master/dp/bellman_ford.py | Python | mit | 1,115 | 0.020628 |
from .create2 import *
from .factory import *
__all__ = ["FactoryCreate", "FactorySimulation"]
| USC-ACTLab/pyCreate2 | pyCreate2/__init__.py | Python | mit | 96 | 0 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | platformio/platformio | platformio/commands/org.py | Python | apache-2.0 | 4,758 | 0.001471 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Gathers components according to their history.
This algorithm is a test: it can be a memory hog
:author: Thomas Calmant
:license: Apache Software License 2.0
:version: 3.0.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0... | isandlaTech/cohorte-devtools | qualifier/deploy/cohorte-home/repo/cohorte/composer/node/criteria/distance/history.py | Python | apache-2.0 | 7,358 | 0.000136 |
import openpnm as op
from numpy.testing import assert_allclose
class TransientAdvectionDiffusionTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[4, 3, 1], spacing=1.0)
self.geo = op.geometry.GenericGeometry(network=self.net,
pores=self... | PMEAL/OpenPNM | tests/unit/algorithms/TransientAdvectionDiffusionTest.py | Python | mit | 2,595 | 0.001156 |
# Node image tools (core)
# Copyright 2013 Victor Lavrentev
import json, sys
from node_lib import *
from PIL import Image, ImageDraw, ImageFilter
import numpy
print '\nNode image tools (core) v01a\n'
# Read node file *.json
try:
file_node=sys.argv[1]
except:
print '->Error. No script'
sys.... | shrimo/node_image_tools | node_core.py | Python | gpl-3.0 | 2,317 | 0.025896 |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. 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... | deepmind/neural_testbed | neural_testbed/likelihood/utils_test.py | Python | apache-2.0 | 1,794 | 0.005017 |
# =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sour... | smjurcak/csm | csmserver/work_units/inventory_work_unit.py | Python | apache-2.0 | 4,795 | 0.002294 |
# =============================================================================
# Copyright [2013] [Kevin Carter]
# License Information :
# This software has no warranty, it is provided 'as is'. It is your
# responsibility to validate the behavior of the routines and its accuracy
# using the code provided. Consult the ... | cloudnull/tribble-api | tribble/common/rpc.py | Python | gpl-3.0 | 3,626 | 0 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __open... | ndtran/compassion-modules | sponsorship_tracking/migrations/1.2/pre-migration.py | Python | agpl-3.0 | 1,284 | 0.000779 |
from __future__ import unicode_literals
notification_settings = {
# PostgreSQL backend with JSON fields
'STORAGE_BACKEND': 'notification.backends.DefaultBackend'
}
| Lysxia/dissemin | notification/settings.py | Python | agpl-3.0 | 173 | 0 |
# -*- coding: utf-8 -*-
import rules
from rules.predicates import is_staff
from rules.predicates import is_superuser
from core.journal.predicates import is_journal_member
from .defaults import AuthorizationConfig as AC
from .predicates import HasAuthorization
# This permission assume to use a 'Journal' object to p... | erudit/eruditorg | eruditorg/core/authorization/rules.py | Python | gpl-3.0 | 501 | 0.001996 |
# Copyright 2012-2015 MongoDB, 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 writin... | wujuguang/motor | test/tornado_tests/test_motor_client.py | Python | apache-2.0 | 11,652 | 0.000086 |
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.utils.domutils
from xml.dom import Node
import os.path
xst = '''<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:ele... | CantemoInternal/pyxb | tests/trac/test-trac-0218.py | Python | apache-2.0 | 1,347 | 0.012621 |
def maj_element(array):
maj = len(array)/2 #python does flooring on int division
num_dict = {}
for num in array:
if num in num_dict:
num_dict[num] += 1
else:
num_dict[num] = 1
for element in num_dict:
if num_dict[element] >= maj:
return element... | DakRomo/2017Challenges | challenge_3/python/kar-moore/src/challenge3.py | Python | mit | 496 | 0.090726 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | tejaswi2492/pmip6ns3.13new | src/tools/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 172,830 | 0.014749 |
# Copyright 2014 Cloudbase Solutions SRL
# 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 r... | rdo-management/neutron | neutron/tests/unit/hyperv/test_hyperv_security_groups_driver.py | Python | apache-2.0 | 7,747 | 0 |
#!/usr/bin/python3
"""
FileStats object, abstraction to take in HTML and spit out all the stats and
stuff that we want.
ALso has a handy function for returning a tuple for instertion into SQL databases.
@author mgmcgove
"""
import os
import get_tags as gt
import stats_lib
import url_validator as url... | mcgov/fishpaste | FileStats.py | Python | mit | 3,515 | 0.013656 |
from .common import Benchmark
import numpy as np
avx_ufuncs = ['sin',
'cos',
'exp',
'log',
'sqrt',
'absolute',
'reciprocal',
'square',
'rint',
'floor',
'ceil' ,
'tr... | WarrenWeckesser/numpy | benchmarks/benchmarks/bench_avx.py | Python | bsd-3-clause | 4,701 | 0.008722 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joël Grand-Guillaume (Camptocamp)
# Copyright 2010-2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pub... | scigghia/account-invoicing | account_invoice_validation_workflow/__openerp__.py | Python | agpl-3.0 | 1,645 | 0 |
# -*- coding: utf-8 -*-
#Copyright (c) 2007, Playful Invention Company
#Copyright (c) 2008-14, Walter Bender
#Copyright (c) 2009-13 Raul Gutierrez Segales
#Copyright (c) 2012 Alan Aguiar
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (... | walterbender/turtle3D | TurtleArtActivity.py | Python | mit | 79,936 | 0.000851 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from holmes.validators.base import Validator
from holmes.utils import _
class TitleValidator(Validator):
@classmethod
def get_violation_definitions(cls):
return {
'page.title.not_found': {
'title': _('Page title not found'),
... | holmes-app/holmes-api | holmes/validators/title.py | Python | mit | 2,893 | 0 |
# Copyright 2013 John Jarvis <john@jarv.org>
#
# 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 option) any later versio... | stvstnfrd/configuration | playbooks/callback_plugins/sqs.py | Python | agpl-3.0 | 6,158 | 0.001786 |
#!/usr/bin/env python
#coding=utf-8
'''
Created on 06 Ιουν 2011
@author: tedlaz
'''
import functions as f
import decimal as decim
from datetime import datetime, date, time
class d():
def __init__(self,val=0, txt='',desc='',decimals=4):
self.decimals = decimals
self.val = f.dec(val,self.decimals)
... | tedlaz/pyted | misthodosia/pyMisthodosia/src/tst.py | Python | gpl-3.0 | 11,303 | 0.045007 |
from api.mon.backends.zabbix.monitor import Zabbix, get_zabbix, del_zabbix
from api.mon.backends.zabbix.server import ZabbixMonitoringServer
get_monitoring = get_zabbix
del_monitoring = del_zabbix
MonitoringBackendClass = Zabbix
MonitoringServerClass = ZabbixMonitoringServer
__all__ = ('get_monitoring', 'del_monit... | erigones/esdc-ce | api/mon/backends/zabbix/__init__.py | Python | apache-2.0 | 379 | 0.002639 |
#!/usr/bin/env python
import unittest
from os.path import realpath
from path_tools import create_filepath
class TestCreateFilepath(unittest.TestCase):
def test_identity(self):
original_filepath = realpath('E:/GoPro/2018-04-18/GH010926.MP4')
dest_filepath = create_filepath(original_filepath)
... | jujumo/gpsbip-configurator | source/task/path_tools_test.py | Python | mit | 2,315 | 0.000864 |
from lingpy import *
from collections import defaultdict
invs = csv2list('inventories.tsv', strip_lines=False)
segments = defaultdict(dict)
langs = set()
for d, t, v, a, n in invs[1:]:
if a.strip():
allophone, context = a.split('/')
segments[allophone, t][d] = (v, context)
segments[v, t][d] = (a... | digling/cddb | datasets/Allen2007/raw/inventories.py | Python | gpl-3.0 | 838 | 0.002387 |
from __future__ import print_function, division
import unittest, numpy as np
from pyscf.nao import mf
class KnowValues(unittest.TestCase):
def test_fireball(self):
""" Test computation of matrix elements of overlap after fireball """
sv = mf(fireball="fireball.out", gen_pb=False)
s_ref = sv.hsx.s4_csr.... | gkc1000/pyscf | pyscf/nao/test/test_0100_fireball.py | Python | apache-2.0 | 441 | 0.013605 |
from django.forms.models import ModelForm
from django.utils.translation import ugettext_lazy as _
from djangocms_link.models import Link
from cms.models import Page
from django.forms.widgets import Media
class LinkForm(ModelForm):
try:
from djangocms_link.fields import PageSearchField
page_link = ... | SurfasJones/djcmsrc3 | venv/lib/python2.7/site-packages/djangocms_link/forms.py | Python | mit | 1,320 | 0.00303 |
# -----------------------------------------------------------------------------
# yacc_error7.py
#
# Panic mode recovery test using deprecated functionality
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yac... | JaDogg/__py_playground | reference/ply-3.8/test/yacc_error7.py | Python | mit | 1,790 | 0.013966 |
{
"name" : "parking",
"version" : "0.1",
"author" : "Castillo",
"website" : "http://openerp.com",
"category" : "Unknown",
"description": """ Module for a parking """,
"depends" : ['base'],
"init_xml" : [ ],
"demo_xml" : [ ],
"update_xml" : ... | xxjcaxx/openerp-learning-module2 | parking/__openerp__.py | Python | gpl-2.0 | 372 | 0.02957 |
#!/usr/bin/env python
'''
https://projecteuler.net/problem=20
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.
For example, the proper divi... | ArthurZey/toyproblems | projecteuler/0021_amicable_numbers.py | Python | mit | 1,028 | 0.013645 |
../../../../share/pyshared/twisted/__init__.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/twisted/__init__.py | Python | gpl-3.0 | 46 | 0.021739 |
# GBRT for Hjerkinn case study site
# Training data: manually digitized training areas, including water pixels
# Predictors: results of FCLS spectral unmixing
# Authors: Stefan Blumentrath
import numpy as np
import matplotlib.pyplot as plt
from sklearn import ensemble
from sklearn import datasets
from sklearn.utils i... | NINAnor/sentinel4nature | Tree canopy cover/regression/GBRT_Hjerkinn_manual_FCLS.py | Python | gpl-2.0 | 8,852 | 0.0061 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# streamondemand - XBMC Plugin
# Conector para iguide
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core impor... | Zanzibar82/streamondemand.test | servers_sports/iguide.py | Python | gpl-3.0 | 2,410 | 0.025726 |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 Nebula, Inc.
# Copyright 2013 Alessio Ababilov
# Copyright 2013 OpenStack Foundation
# 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
# ... | metacloud/python-keystoneclient | keystoneclient/apiclient/exceptions.py | Python | apache-2.0 | 1,124 | 0 |
# Goal 1
bread = 4
pb = 3
jelly = 10
sandwich = 0
while bread >= 2 and pb >= 1 and jelly >= 1:
sandwich = sandwich + 1
print "I am making sandwich number {0}".format(sandwich)
bread = bread - 2
pb = pb - 1
jelly = jelly - 1
print "All done! I made {0} sandwich(es)".format(sandwich)
#... | suellenf/hearmecode | playtime/lesson2_pbj.py | Python | mit | 958 | 0.004175 |
##############################################################################
# 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... | EmreAtes/spack | var/spack/repos/builtin/packages/viennarna/package.py | Python | lgpl-2.1 | 2,706 | 0.002217 |
__author__ = 'HarperMain'
import numpy as np
from scipy.stats import binom
class AmericanOption(object):
def __init__(self, strike, X, rate, volatility, T, n):
self.strike = strike
self.X = X
self.rate = rate
self.volatility = volatility
self.T = T
self.n = float(n)... | marioharper182/ComputationalMethodsFinance | Homework2/Options_American.py | Python | apache-2.0 | 1,728 | 0.004051 |
# Copyright (C) 2015 Kevin S. Graer
#
#
# This file is part of PseudoTV Live.
#
# PseudoTV 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 ver... | 7fever/script.pseudotv.live | utilities.py | Python | gpl-3.0 | 6,697 | 0.00881 |
'''
Find the median element in an unsorted array
'''
import heapq
def find_median(arr):
# O(n)
heapq.heapify(arr)
num_elements = len(arr)
if num_elements % 2 != 0:
return arr[(num_elements + 1)/2 - 1]
else:
return (arr[num_elements/2 - 1] + arr[num_elements/2 + 1 - 1])/2.0
assert f... | amitsaha/learning | python/search/find_median.py | Python | unlicense | 401 | 0.004988 |
import sys
from PyQt4 import Qt
from PyQt4.phonon import Phonon
class AIPYbody():
# in the class body are all functionalities of the AIPY Music Player
# body will be one window from PyQT
def __init__ (self):
pass
def Display():
# used for showing the remaining time, or elapsed time of song, it is posible to ... | MrIliev/AIPY-Music-Player | AIPY.py | Python | apache-2.0 | 1,128 | 0.036348 |
# Read inputs from Standard Input.
# Write outputs to Standard Output.
# Please, do not use fileinput module to read Standard Input.
import sys
try:
n = int(raw_input())
lis = raw_input().split()
except ValueError:
print "0 - Cannot process the data"
position = 0
less = 0
more = 0
s = map(int, lis)
... | STiago/Python | Code/temperatures.py | Python | gpl-3.0 | 571 | 0.008757 |
import requests
import json
import sir_exceptions
class Call:
def __init__(self, url, verify_ssl, method, params=None):
if method == 'GET':
r = requests.get(url, params=params, verify=verify_ssl)
elif method == 'POST':
r = requests.post(url, json=params, verify=verify_ssl)
... | dbarrosop/pySIR | pySIR/call.py | Python | apache-2.0 | 1,069 | 0.001871 |
import os
import requests
import sys
from google.cloud import firestore
from googleapiclient.discovery import build
from google.cloud import secretmanager
# Add our library utils to the path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from lib.constants import ISSUES_API_URL
from l... | GoogleCloudPlatform/covid-19-open-data | src/scripts/cloud_error_processing.py | Python | apache-2.0 | 3,450 | 0.003768 |
import requests
import json
import time
if __name__ == '__main__':
count = 0
#Non-threaded test
for i in range(0,1000):
res = requests.get('http://localhost:8055/?url=https://magic.import.io')
count += 1
print count
time.sleep(0.1)
if count%1000 == 0:
p... | Bam4d/Roxxy | tools/hammer_test.py | Python | gpl-3.0 | 335 | 0.01791 |
#
# gdb helper commands and functions for Linux kernel debugging
#
# per-cpu tools
#
# Copyright (c) Siemens AG, 2011-2013
#
# Authors:
# Jan Kiszka <jan.kiszka@siemens.com>
#
# This work is licensed under the terms of the GNU GPL version 2.
#
import gdb
from linux import tasks, utils
MAX_CPUS = 4096
def get_cu... | GuillaumeSeren/linux | scripts/gdb/linux/cpus.py | Python | gpl-2.0 | 4,543 | 0 |
################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless... | deeplearning4j/deeplearning4j | jumpy/jumpy/spark/fast_impl.py | Python | apache-2.0 | 4,802 | 0.002707 |
# -*- coding: utf-8 -*-
class Config(object):
def __init__(self, bucket, root):
self.bucket = bucket
self.root = root
| lyst/shovel | src/shovel/config.py | Python | apache-2.0 | 138 | 0 |
from __future__ import division
import numpy as np
from chainer.backends import cuda
import chainer.functions as F
from chainercv import transforms
exp_clip = np.log(1000 / 16)
def smooth_l1(x, t, beta):
return F.huber_loss(x, t, beta, reduce='no') / beta
# to avoid out of memory
def argsort(x):
xp = c... | chainer/chainercv | chainercv/links/model/fpn/misc.py | Python | mit | 974 | 0 |
__author__ = 'Ofner Mario'
| steelion/python-tools | mao/toolbox/__init__.py | Python | mit | 27 | 0 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 option) an... | abtreece/ansible | lib/ansible/plugins/strategy/__init__.py | Python | mit | 44,580 | 0.003993 |
import unittest
from pulp_auto.consumer.consumer_class import (Consumer, Binding, Event, ConsumersApplicability)
from pulp_auto.task import Task
from pulp_auto.pulp import Request
from pulp_auto import path_join
from tests.pulp_test import (ConsumerAgentPulpTest, agent_test)
class TestConsumer(ConsumerAgentPulpTest... | asmacdo/pulp-automation | tests/consumer_agent_tests/test_09_consumer.py | Python | gpl-2.0 | 9,939 | 0.008452 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.