code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Bruno Cauet
#
# 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 r... | shamangeorge/beets | test/test_thumbnails.py | Python | mit | 11,414 |
import fnmatch
import functools
import io
import ntpath
import os
import posixpath
import re
import sys
from collections import Sequence
from contextlib import contextmanager
from errno import EINVAL, ENOENT
from operator import attrgetter
from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO... | gautamMalu/rootfs_xen_arndale | usr/lib/python3.4/pathlib.py | Python | gpl-2.0 | 41,820 |
# -*- coding: utf-8 -*-
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Lars Buitinck
# Robert Layton <robertlayton@gmail.com>
# Jochen Wersdörfer <jochen@wersdoerfer.de>
# Roman Sinayev <roman.sinayev@gmail.com>
#
# License: B... | sergeyf/scikit-learn | sklearn/feature_extraction/text.py | Python | bsd-3-clause | 74,905 |
"""
WSGI config for recipefinder project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_... | miguelp1986/recipe-finder | recipefinder/recipefinder/wsgi.py | Python | mit | 401 |
#print "Hello World!"
#print "Hello Again"
#print "I like typing this, really?"
#print "This is 20% cooler"
print 'Single quote madness?'
#print "'Hello' Clarice"
#print 'There once was a man from "St Ives"'
| vanonselenp/Learning | Python/LPTHW/ex1.py | Python | mit | 208 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import traceback,sys
class WafError(Exception):
def __init__(self,msg='',ex=None):
self.msg=msg
assert not isinstance(msg,Exception)
self.stack=[]
if ex:
if not msg:
self.msg=str(ex)
... | Gnurou/glmark2 | waflib/Errors.py | Python | gpl-3.0 | 984 |
# coding: utf-8
"""
Module where grappelli dashboard modules classes are defined.
"""
# DJANGO IMPORTS
from django.utils.text import capfirst
from django.utils.translation import ugettext_lazy as _
from django.apps import apps as django_apps
# GRAPPELLI IMPORTS
from grappelli.dashboard.utils import AppListElementMix... | sivaprakashniet/push_pull | p2p/lib/python2.7/site-packages/grappelli/dashboard/modules.py | Python | bsd-3-clause | 12,712 |
"""
Fetch Build IDs from ELF core
In --list mode, print two names for each file,
one from the file note, and the other from the link map.
The first file (the executable) is not in the link map.
The names can differ because of symbolic links.
"""
from argparse import ArgumentParser
from . import memmap
from .elf impor... | wackrat/structer | structer/build_ids.py | Python | mit | 1,198 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from .validators import is_item_iterable
def coerce_sequence_of_tuple(sequence):
"""Make sure all items of a sequence are of type tuple.
Parameters
----------
sequence : sequence
A se... | compas-dev/compas | src/compas/data/coercion.py | Python | mit | 1,742 |
#!/usr/bin/env python
#
############################################################################
#
# MODULE: m.swim.subbasins v1.6
# AUTHOR(S): Michel Wortmann, wortmann@pik-potsdam.de
# PURPOSE: Preprocessing suit for the Soil and Water Integrated Model (SWIM)
# COPYRIGHT: (C) 2012-2022 by Wortmann/PI... | mwort/m.swim | m.swim.subbasins/m.swim.subbasins.py | Python | mit | 41,603 |
import sys
import errno
import m3u8
import urllib2
from Crypto.Cipher import AES
import StringIO
import socket
import os
blocksize = 16384
class resumable_fetch:
def __init__(self, uri, cur, total):
self.uri = uri
self.cur = cur
self.total = total
self.offset = 0
self._rest... | Kamekameha/crunchy-xml-decoder | crunchy-xml-decoder/hls.py | Python | gpl-2.0 | 3,161 |
from django.conf import settings
from django.db import models
from adhocracy4.categories.form_fields import IconChoiceField
from adhocracy4.modules import models as module_models
class IconField(models.CharField):
def __init__(self, *args, **kwargs):
kwargs['max_length'] = 254
kwargs['default'] ... | liqd/adhocracy4 | adhocracy4/categories/models.py | Python | agpl-3.0 | 1,280 |
from param_definition.parameter import Parameter
from cgi import FieldStorage
import Cookie
import base64
import os
from model.user_model import User
from model.db_session import DB_Session_Factory
import uuid
from datetime import datetime
from lib.conf import CFG
import sys
import json
class HTTP_Response_Builder(obj... | vovagalchenko/onsite-inflight | api/http_response_builder/http_response_builder.py | Python | mit | 4,184 |
# Django settings for RGT project.
import os
# import django
import django
from ownsettings import *
projectPath = os.path.normpath(os.path.join(os.path.dirname(__file__), '../../'))
DENDROGRAM_FONT_LOCATION = projectPath + '/src/RGT/LiberationSans-Regular.ttf'
HOST_NAME = 'localhost'
EMAIL_VERIFICATION = True
D... | danrg/RGT-tool | src/RGT/settings.py | Python | mit | 7,678 |
#!bin/python
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, request, Response
import urllib2
import xml.dom.minidom
import datetime
import json
import copy
from dateutil import parser
import csv
import StringIO
import re
from meteoalarm import get_weather_alarms
from ipma import get_weather_forecasted_pt
fr... | sergg75/dataModels | Weather/WeatherForecast/harvest/aemet.py | Python | mit | 8,482 |
from font import font
from qt import QFont
class b( font ):
"""
<b> makes text bold.
<p>
<b>Properties:</b>
<br>
See <a href="font.html"><font></a> for properties.
"""
def __init__( self, *args ):
"""
Initiate the container, contents, and properties.
-*args, arguments for the for constructo... | derekmd/opentag-presenter | tags/b.py | Python | bsd-2-clause | 619 |
###############################################################################
# volumina: volume slicing and editing library
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# modify it und... | jakirkham/volumina | volumina/api.py | Python | lgpl-3.0 | 1,718 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=1>
# Use the new Cartopy WMTS capabilities to plot some MODIS data
# <codecell>
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from owslib.wmts import WebMapTileService
# <codecell>
url = 'http://map1c.vis.earthdata.nasa.gov/wmts-... | rsignell-usgs/notebook | Cartopy_WMTS_test.py | Python | mit | 785 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.random_forest import H2ORandomForestEstimator
import random
import copy
def weights_vi():
###### create synthetic dataset1 with 3 predictors: p1 predicts response ~90% of the time, p2 ~70%, p3 ~50%
response... | madmax983/h2o-3 | h2o-py/tests/testdir_algos/rf/pyunit_weights_var_impRF.py | Python | apache-2.0 | 5,018 |
"""
Compute periods for the LINEAR data
-----------------------------------
"""
from __future__ import print_function
from time import time
import numpy as np
from astroML.datasets import fetch_LINEAR_sample
from astroML.time_series import lomb_scargle, multiterm_periodogram, \
search_frequencies
import sqlite3
... | nhuntwalker/astroML | book_figures/chapter10/compute_periods.py | Python | bsd-2-clause | 1,783 |
import pytz
from datetime import datetime
import time
import sys
import calendar
SECS_IN_MINUTE = 60
SECS_IN_HOURS = 60*SECS_IN_MINUTE
SECS_IN_DAYS = 24*SECS_IN_HOURS
class TimeHelpers:
@classmethod
def unix_time(cls,year,month,day,hour,minute,second,offset=0):
"""When it is midnight in London, ... | graphserver/graphserver | pygs/graphserver/util.py | Python | bsd-3-clause | 2,477 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectio... | mmottahedi/neuralnilm_prototype | scripts/e294.py | Python | mit | 8,331 |
import json
import math
__author__ = 'apostol3'
class Map:
def __init__(self, w, h):
self.max_time = 120
self.size = (w, h)
self.walls = []
self.headline = []
self.cars = []
self.finish = []
self.objects = []
self.car_size = (1.8/2, 4.6/2)
def ... | Apostol3/race_env_editor | map.py | Python | mit | 1,833 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-31 17:48
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('catalog', '0001_initial'),
... | gileno/djangoecommerce | checkout/migrations/0003_order_orderitem.py | Python | cc0-1.0 | 2,362 |
from datetime import datetime
from ..controllers import post_controller
from ..models.comment import Comment
def add(request):
comment = Comment()
if request.session['current_user'] is not None:
comment.author_id = int(request.session['current_user'])
else:
comment.authorEmail = reque... | jmescuderojustel/codeyourblogin-python-django-1.7 | src/blog/controllers/comment_controller.py | Python | mit | 644 |
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
a = 0.5
k = 7
d = 8
def f(t):
# This is the function that we want to plot
F = (a + np.cos(k / d * t))
x = F * np.cos(t)
y = F * np.sin(t)
return x, y
def f(t):
# Thi... | robertsj/ME701_examples | plots/animations/2D_ani_plot.py | Python | mit | 1,449 |
# -*- coding: utf-8 -*-
"""Single-elimination cups."""
# Copyright (C) 2015, 2016, 2017 Alexander Jones
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License... | happy5214/competitions-cup | competitions/cup/default/single_elimination.py | Python | lgpl-3.0 | 5,531 |
# maubot - A plugin-based Matrix bot system.
# Copyright (C) 2019 Tulir Asokan
#
# 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... | tulir/maubot | maubot/cli/commands/auth.py | Python | agpl-3.0 | 3,944 |
"""This module contains the general information for BiosVfOSBootWatchdogTimer ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class BiosVfOSBootWatchdogTimerConsts:
VP_OSBOOT_WATCHDOG_TIMER_DISABLED = "Disabled"
VP_OSBO... | ragupta-git/ImcSdk | imcsdk/mometa/bios/BiosVfOSBootWatchdogTimer.py | Python | apache-2.0 | 3,929 |
#
# 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
# ... | takeshineshiro/heat | heat/tests/test_remote_stack.py | Python | apache-2.0 | 26,392 |
# Copyright 2008 Michiel de Hoon.
# Revisions copyright 2009 Leighton Pritchard.
# Revisions copyright 2010 Peter Cock.
# All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Code t... | updownlife/multipleK | dependencies/biopython-1.65/build/lib.linux-x86_64-2.7/Bio/Emboss/Primer3.py | Python | gpl-2.0 | 5,485 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='RequestRoute... | jermowery/xos | xos/services/requestrouter/migrations/0001_initial.py | Python | apache-2.0 | 2,793 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 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 a copy of the License at
#
... | zestrada/nova-cs498cc | nova/cmd/xvpvncproxy.py | Python | apache-2.0 | 1,053 |
import pytest
from plenum.server.replica_validator_enums import STASH_CATCH_UP, STASH_WATERMARKS, STASH_VIEW_3PC
from plenum.test.helper import create_pre_prepare_no_bls, generate_state_root
from plenum.test.replica.helper import emulate_catchup
@pytest.fixture(scope='function')
def msg(replica):
pp = create_pre... | evernym/zeno | plenum/test/replica/stashing/test_replica_unstashing.py | Python | apache-2.0 | 1,561 |
from django.shortcuts import get_object_or_404, render
from django.utils import timezone
from django.views.generic import View
from dashboard.models import Dashboard
class DashboardDetail(View):
def get(self, request, dashboard_id):
dashboard = get_object_or_404(Dashboard, pk=dashboard_id)
ctx =... | akvo/butler | butler/dashboard/views.py | Python | agpl-3.0 | 1,062 |
from distutils.core import setup
setup(
name='python-logstash',
packages=['logstash'],
version='0.4.7',
description='Python logging handler for Logstash.',
long_description=open('README.rst').read(),
license='MIT',
author='Volodymyr Klochan',
author_email='vklochan@gmail.com',
url='h... | vklochan/python-logstash | setup.py | Python | mit | 859 |
# TO DO: Add a Python version of this code
# # View the specified parameters of your deep learning model
# model@parameters
#
# # Examine the performance of the trained model
# model # display all performance metrics
#
# h2o.performance(model, valid = FALSE) # training set metrics
# h2o.performance(model, valid = ... | tarasane/h2o-3 | h2o-docs/src/booklets/v2_2015/source/deeplearning/deeplearning_inspect_model.py | Python | apache-2.0 | 352 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import telestream_cloud_qc
from telestream_cl... | Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/test/test_gop_order.py | Python | mit | 1,271 |
"""metaclub URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | ClubCedille/metaclub | django/metaclub/metaclub/urls.py | Python | mit | 865 |
#!/usr/bin/env python3
import argparse
import pickle
import os
def output_one_best(problem, target, solution):
"""Return output for a solution for the one-best."""
return "{0}.{1} {2} :: {3};".format(problem.source_lex,
target,
pr... | alexrudnick/chipa | squoiawsd/util_run_experiment.py | Python | gpl-3.0 | 1,512 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the non_parametric module.
"""
import numpy as np
from ..non_parametric import gini
def test_gini():
"""
Test Gini coefficient calculation.
"""
data_evenly_distributed = np.ones((100, 100))
data_point_like = np.zeros(... | astropy/photutils | photutils/morphology/tests/test_non_parametric.py | Python | bsd-3-clause | 451 |
fo = file("hello")
data = fo.read()
print data
| sburnett/seattle | repy/tests/s_testfileinit.py | Python | mit | 47 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from itertools import groupby
from datetime import datetime, timedelta
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools import float_is_zero, float_compare, DEFAULT_SERVER_DA... | dfang/odoo | addons/sale/models/sale.py | Python | agpl-3.0 | 48,109 |
# Copyright (c) 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 agreed to in writ... | zhangjunli177/sahara | sahara/tests/unit/plugins/vanilla/test_utils.py | Python | apache-2.0 | 4,454 |
from __future__ import absolute_import
from django.contrib import admin
from .models import Genre
from .models import Tag
from .models import Book
from .models import Asset
from .models import Author
class GenreAdmin(admin.ModelAdmin):
list_display = ('name', 'id')
class BookAdmin(admin.ModelAdmin):
list_disp... | r-singh/Test2 | webapp_project/website/admin.py | Python | mit | 857 |
# -*- encoding: utf-8 -*-
#############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
# Copyright (C) 2004 OpenERP SA (<http://www.openerp.com>)
#
# ... | MarcosCommunity/odoo | comunity_modules/hotel_reservation/report/__init__.py | Python | agpl-3.0 | 1,167 |
import math
import webbrowser
from PySide import QtGui, QtCore
from ui.settingswindow import SettingsWindow
class SystemTray(QtGui.QSystemTrayIcon):
def __init__(self, parent=None):
QtGui.QSystemTrayIcon.__init__(self, parent)
self.parent = parent
#menu before logging into Smartfile
... | travcunn/kissync-python | ui/systemtray.py | Python | mit | 4,157 |
import os.path as op
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from mne.parallel import parallel_func
from mne.utils import ProgressBar, array_split_idx, use_log_level
def test_progressbar():
"""Test progressbar class."""
a = np.arange(10)
pbar = ProgressBar(a)
as... | Teekuningas/mne-python | mne/utils/tests/test_progressbar.py | Python | bsd-3-clause | 3,513 |
import importlib
import inspect
from . import path, random
from .path import *
from .random import *
__all__ = [
'NOT_SET',
'BOOL_STR_MAP',
'STR_BOOL_MAP',
'as_bool',
'filter_items',
'get_items_with_key_prefix',
'load_object',
] + path.__all__ + random.__all__
NOT_SET = type('NOT_SET', ... | TangledWeb/tangled | tangled/util/__init__.py | Python | mit | 4,706 |
#!/usr/bin/env python
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
__author__ = 'Max Arnold <arnold.maxim@gmail.com>'
__version__ = '0.1.6'
setup(
name='python-mpns',
version=__version__,
# Package dependencies.
install_requires=['requests>=... | max-arnold/python-mpns | setup.py | Python | bsd-3-clause | 1,171 |
from __future__ import division #Para não truncar a divisão de inteiros
from visual import * #Módulo com as funções gráficas do VPython
from random import random #Gerador de números aleatórios
print """
#############{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}}}}}}}}}}}}}}}}}}}##############
########*******... | carlosmccosta/Asteroid-Impact | Source code/Asteroid impact on Earth.py | Python | mit | 35,469 |
import os
import pynq
import pytest
from pyfakefs.fake_filesystem import FakeDirectory
class DtboDirectory(FakeDirectory):
def __init__(self, *args, update=True, **kwargs):
self._update = update
super().__init__(*args, **kwargs)
def add_entry(self, path_object):
if not isinstance(pat... | yunqu/PYNQ | tests/test_devicetree.py | Python | bsd-3-clause | 3,298 |
#!/usr/bin/python
# The MIT License (MIT)
#
# Copyright (c) 2017 Tag Games Limited
#
# 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... | ChilliWorks/CSTest | Projects/RPi/build.py | Python | mit | 3,307 |
#Alexa
Security_Profile_Description = "TheScrivener"
Security_Profile_ID = "amzn1.application.21a811c4248b41e484645877b7dc591c"
Client_ID = "amzn1.application-oa2-client.2285b83f7d214ff7b3960126aa97eed0"
Client_Secret = "6da338b5d6ca88522439d5235c1c4735239f551ae2cfd5b4af3dfba7079e9b7f"
Product_ID = "ConCoEcho"
#Redis... | kplus87/bartleby | static/creds.py | Python | mit | 371 |
__author__ = 'sarangis'
from src.ir.function import *
from src.ir.module import *
from src.ir.instructions import *
BINARY_OPERATORS = {
'+': lambda x, y: x + y,
'-': lambda x, y: x - y,
'*': lambda x, y: x * y,
'**': lambda x, y: x ** y,
'/': lambda x, y: x / y,
'//': lambda x, y: ... | ssarangi/spiderjit | src/ir/irbuilder.py | Python | mit | 9,699 |
import numpy as np
import sys, os
import nrrd
from scipy import ndimage
if (len(sys.argv) < 2):
print('Error: missing arguments!')
print('e.g. python centreOfMass.py imageIn.nrrd')
else:
Iin = str(sys.argv[1])
data1, header1 = nrrd.read(Iin)
print(list(np.array(ndimage.measurements.center_of_mass(... | Robbie1977/NRRDtools | centreOfMass.py | Python | mit | 348 |
#!/usr/bin/env python2
# Copyright (c) 2015 The Aureus Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import hashlib
import sys
import os
from random import SystemRandom
import base64
import hmac
if len(sys.ar... | hideoussquid/aureus-12-bitcore | share/rpcuser/rpcuser.py | Python | mit | 1,108 |
# -*- coding: utf-8 -*-
# Copyright © 2017 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models
from . import wizard
| oihane/temp-addons | stock_package_creator/__init__.py | Python | agpl-3.0 | 182 |
# coding: utf-8
from django.conf.urls import patterns, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.sitemaps import GenericSitemap
from django.contrib.sitemaps.views import sitemap
from models import ShortStory, Novel, Chapter
# SiteMap data
sitemaps = {
'sh... | SpaceFox/textes | literature/urls.py | Python | mit | 1,319 |
class summing_list:
layers = [[0]]
size = 0
def __init__(self, iter=None):
if iter != None:
for i in iter:
self.append(i)
def _sum(self, i):
t = 0
for r in self.layers:
if i % 2:
t += r[i - 1]
i >>= 1
r... | subhrm/google-code-jam-solutions | solutions/helpers/CodeJam-0.3.0/codejam/datastructures/summing_list.py | Python | mit | 1,482 |
#!/usr/bin/python
# -'''- coding: utf-8 -'''-
from glob import glob
import os
import subprocess
from PySide.QtCore import *
from PySide.QtGui import *
import BasketBuilder
import BasketGlobals as config
class WindowLayout(QTabWidget):
# Define Emitter Signals
launch = Signal(int, str)
createnew = Sign... | Hartman-/Basket | basket/gui/GUI_Launch.py | Python | bsd-3-clause | 15,300 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
import warnings
from pymatgen.core.bonds import (
CovalentBond,
get_bond_length,
get_bond_order,
obtain_all_bond_lengths,
)
from pymatgen.core.periodic_table import Element
fro... | gmatteo/pymatgen | pymatgen/core/tests/test_bonds.py | Python | mit | 3,958 |
import os
import pytest
import re
hostenv = os.environ['SECUREDROP_TESTINFRA_TARGET_HOST']
@pytest.mark.parametrize('sysctl_opt', [
('net.ipv4.conf.all.accept_redirects', 0),
('net.ipv4.conf.all.accept_source_route', 0),
('net.ipv4.conf.all.rp_filter', 1),
('net.ipv4.conf.all.secure_redirects', 0),
('net.i... | micahflee/securedrop | testinfra/common/test_system_hardening.py | Python | agpl-3.0 | 2,661 |
#! /usr/bin/env python
# encoding: utf-8
import TaskGen
from TaskGen import taskgen,feature
from Constants import*
TaskGen.declare_chain(name='luac',rule='${LUAC} -s -o ${TGT} ${SRC}',ext_in='.lua',ext_out='.luac',reentrant=0,install='LUADIR',)
def init_lua(self):
self.default_chmod=O755
def detect(conf):
conf.find_... | micove/libdesktop-agnostic | wafadmin/Tools/lua.py | Python | lgpl-2.1 | 388 |
# -*- coding: utf-8 -*-
#FUNCION PARA EL PAREO CON LATCH
def pair():
import os, json, latch
appid = input('Ingrese el Applicatrion ID:')
while len(appid) == 0:
print('Intente nuevamente...')
appid = input('Ingrese el Applicatrion ID:')
seckey = input('Ingrese Secret Key:')
while len(seckey) == 0... | maxssestepa/latchwake | parear.py | Python | lgpl-2.1 | 1,368 |
from django.utils.http import http_date
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has a ETag or
Last-Modified header, and the request has If-None-Match or
If-Modified-Since, the response is replaced by an HttpNotModified.
Also sets the Date and... | Shrews/PyGerrit | webapp/django/middleware/http.py | Python | apache-2.0 | 2,469 |
# TinyMCE editor dialog that works with pyjd as well as pyjs.
# add the following to the loader file:
# <script type="text/javascript"
# src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
#
# note: versions of tinymce from 3.0 to at least 3.5b1 have a bug
# where a 2nd editor instance in firefox will flick... | minghuascode/pyj | addons/TinyMCEditor.py | Python | apache-2.0 | 6,194 |
import pytest
# Write your own tests below!
# What logic would make sense in the tests below to ensure our data are "legal"?
# And how do we get access to the data in the other file?
def test_enforce_drinking_ages():
assert False, 'You need to write this test!
| Destaneon/python-fundamentals | challenges/04-Functions/test_D_your_own_test.py | Python | apache-2.0 | 270 |
def make_key(*args):
return "ti:" + ":".join(args)
def make_refset_key(pmid):
return make_key("article", pmid, "refset") | total-impact/biomed | db.py | Python | mit | 131 |
import unittest
from frisbee import *
class AnalysisTestCase(unittest.TestCase):
"""Tests all the analysis functions"""
def __get_cred_dict(self, catch, drop, throw, snatch, foul):
"""Returns a dictionary of player creds as expected from analysis"""
return dict(zip(["catch", "drop", "throw", "... | tecoholic/frisbee | test/test_frisbee.py | Python | mit | 4,594 |
# -*- encoding: utf-8 -*-
import pooler, time, base64
from osv import fields, osv
AVAILABLE_PRIORITIES = [
('1', '最高'),
('2', '高'),
('3', '中'),
('4', '低'),
('5', '最低'),
]
class fg_jobcontent(osv.osv):
_name = "fg_jobcontent"
_description = "工作项目进度表"
_columns = {
'nam... | Johnzero/erp | openerp/addons/fg_schedule/fg_schedule.py | Python | agpl-3.0 | 10,893 |
# Copyright © 2017-2019 Zuercher Hochschule fuer Angewandte Wissenschaften.
# 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/l... | EduJGURJC/elastest-service-manager | src/esm/controllers/service_instances_controller.py | Python | apache-2.0 | 14,612 |
# Copyright 2019 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... | tensorflow/addons | tensorflow_addons/metrics/tests/hamming_test.py | Python | apache-2.0 | 4,870 |
# Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor 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... | mozilla/caseconductor-ui | ccui/urls.py | Python | gpl-3.0 | 1,967 |
from django import VERSION
import os
from django.contrib.admin import ModelAdmin, helpers
from django.contrib.admin.util import unquote
from django.conf.urls import patterns, url
from django.utils.encoding import force_text
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext... | Excentrics/publication-backbone | publication_backbone/admin/modelcloneadmin.py | Python | bsd-3-clause | 11,957 |
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
#osl_concat
command += testshade("-t 1 -g 64 64 str_concat -od uint8 -o res concat_ref.tif -o res_m concat_m_ref.tif")
#osl_s... | lgritz/OpenShadingLanguage | testsuite/string-reg/run.py | Python | bsd-3-clause | 2,776 |
# Copyright 2014 Red Hat, 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | MDSLab/s4t-iotronic | iotronic/common/rpc.py | Python | apache-2.0 | 4,386 |
__author__ = 'dengzhihong'
from src.Regression.base import *
from scipy import optimize
class LASSO(RegressionBase):
@staticmethod
def run(sampx, sampy, K):
y = RegressionBase.strlistToFloatvector(sampy)
fai_matrix = RegressionBase.constructFaiMartix(sampx, K)
product_fai = np.dot(fai_... | dzh123xt/pythonML | src/Regression/lasso.py | Python | mit | 1,462 |
import unittest
import numpy as np
from .. import DataSet
from ..nodes import BaseNode
class TestBaseNode(unittest.TestCase):
def setUp(self):
data = np.random.rand(4, 10)
labels = np.ones((2, 10))
self.d = DataSet(data, labels)
self.n = BaseNode()
def test_existing_methods(sel... | wmvanvliet/psychic | psychic/tests/testbasenode.py | Python | bsd-3-clause | 1,594 |
#!/usr/bin/env python
import matplotlib
matplotlib.use('TkAgg')
from numpy import arange, sin, pi,log10,max,min,cos,isnan, meshgrid,sqrt,abs
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import pyPLUTO as pp
import string
import time
fro... | aywander/pluto-outflows | Tools/pyPLUTO/bin/GUI_pyPLUTO.py | Python | gpl-2.0 | 36,620 |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen, ConfigList
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigSubsection, ConfigBoolean, getConfigListEntry, ConfigSelection, ConfigYesNo, Config... | XTAv2/Enigma2 | lib/python/Screens/InstallWizard.py | Python | gpl-2.0 | 5,974 |
from __future__ import with_statement
from commands import getoutput
from contextlib import closing
from email.mime.text import MIMEText
from email.utils import make_msgid
from genshi.template import NewTextTemplate as TextTemplate
import json
import logging
import os
import requests
import smtplib
from socket import ... | CSIS/proccer | src/proccer/notifications.py | Python | mit | 4,433 |
if __name__ == '__main__':
a = int(raw_input())
b = int(raw_input())
print a + b
print a - b
print a * b
| LuisUrrutia/hackerrank | python/introduction/python-arithmetic-operators.py | Python | mit | 126 |
#-*-PYTHON-*-
import collections
import functools
# https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
class memoized(object):
'''Decorator. Caches a function's return value each time it is called.
If called later with the same arguments, the cached value is returned
(not reevaluated).
'''
... | leighklotz/traffic-map | pricing/memoizer.py | Python | gpl-2.0 | 1,030 |
"""
Wrapper for k-means clustering that takes cares of reshaping and generating labels.
"""
from __future__ import division
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import project_config
import sklearn.cluster
def perform_kMeans_clustering_analysis(feature_data, n_clusters):
""... | nhejazi/project-gamma | code/utils/kmeans.py | Python | bsd-3-clause | 1,066 |
from pywink.devices.base import WinkDevice
SENSOR_FIELDS_TO_UNITS = {"humidity": "%", "temperature": u'\N{DEGREE SIGN}', "brightness": "%", "proximity": ""}
class WinkSensor(WinkDevice):
"""
Represents a Wink sensor.
"""
def __init__(self, device_state_as_json, api_interface, sensor_type_info):
... | Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/pywink/devices/sensor.py | Python | gpl-2.0 | 1,453 |
import numpy as np
import theano as theano
import theano.tensor as T
from theano.gradient import grad_clip
import time
import operator
class GRUTheano:
def __init__(self, word_dim, hidden_dim=128, bptt_truncate=-1):
# Assign instance variables
self.word_dim = word_dim
self.hidden_dim... | ctogle/nnets | src/nnets/nnetworks/ngrurnn.py | Python | mit | 6,144 |
"""Template tags relating to plugins."""
from django import template
import importlib
from django.utils.safestring import mark_safe
from happening.utils import convert_to_underscore
register = template.Library()
@register.simple_tag(takes_context=True)
def navigation_items(context, *params):
"""Render navigatio... | jscott1989/happening | src/happening/templatetags/plugins.py | Python | mit | 2,896 |
import warnings
import pytest
from sqlalchemy.exc import SAWarning, SQLAlchemyError
from ichnaea.conftest import GB_LAT, GB_LON
from ichnaea.models import encode_mac, ReportSource
from ichnaea.models.wifi import WifiShard, WifiShard0, WifiShardF
from ichnaea import util
class TestWifiShard(object):
def test_sha... | mozilla/ichnaea | ichnaea/models/tests/test_wifi.py | Python | apache-2.0 | 3,732 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.compat import unicode
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Alias,
Typed,
Set,
NoneSet,
Sequence,
String,
Bool,
MinMax,
Integer
)
from ope... | saukrIppl/seahub | thirdpart/openpyxl-2.3.0-py2.7.egg/openpyxl/drawing/text.py | Python | apache-2.0 | 22,428 |
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
from tests.support.fixtures import create_dialog
from tests.support.inline import inline
alert_doc = inline("<script>window.alert()</script>")
def minimize(session):
return session.transport.send("POST", "session/%s/window/min... | n0max/servo | tests/wpt/web-platform-tests/webdriver/tests/minimize_window.py | Python | mpl-2.0 | 6,438 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 Licen... | oliver-sanders/cylc | tests/unit/cfgspec/test_globalcfg.py | Python | gpl-3.0 | 2,047 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def get_notification_config():
notifications = { "for_doctype":
{
"Issue": {"status": "Open"},
"Warranty Claim": {"status": "Op... | indictranstech/erpnext | erpnext/startup/notifications.py | Python | agpl-3.0 | 2,428 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | pmisik/buildbot | master/buildbot/test/fake/connection.py | Python | gpl-2.0 | 2,834 |
#
# Martin Gracik <mgracik@redhat.com>
#
# Copyright 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be use... | jikortus/pykickstart | tests/commands/url.py | Python | gpl-2.0 | 4,945 |
# Copyright 2014 Open Source Robotics Foundation, 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... | NikolausDemmel/catkin_tools | catkin_tools/verbs/catkin_build/executor.py | Python | apache-2.0 | 6,768 |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (C) 2005-2009 Håvard Gulldahl
# <havard@lurtgjort.no>
#
# Lisens: GPL2
#
# $Id$
###########################################################################
import fakturakomponenter
import types, sy... | kkoksvik/finfaktura | finfaktura/historikk.py | Python | gpl-2.0 | 3,291 |
import sys
res = """hmqskld
mqsd
lgfmlq
1234"""
print "Content-type:text/html"
print "Content-length:%s" %(len(res)+res.count('\n'))
print
sys.stdout.write(res.replace('\r\n','\n'))
| jhjguxin/PyCDC | Karrigell-2.3.5/webapps/cgi-bin/test.py | Python | gpl-3.0 | 185 |
#!/usr/bin/env python
"""
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")... | lavjain/incubator-hawq | contrib/hawq-ambari-plugin/src/main/resources/utils/add-hawq.py | Python | apache-2.0 | 18,999 |
import numpy as np
from screening_rules import AbstractScreeningRule
class Sasvi(AbstractScreeningRule):
""" Screening by Sasvi rule.
Liu et al (2014)
"""
debug = False
def __init__(self, tol=1e-9, debug=False):
AbstractScreeningRule.__init__(self, 'Sasvi', tol=tol)
self.deb... | nicococo/AdaScreen | adascreen/sasvi.py | Python | mit | 5,180 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.