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
""" WSGI config for generic 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/1.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
wasit7/tutorials
django/django_generic_view/generic/generic/wsgi.py
Python
mit
392
# cloudscope.utils.timez # Time string utilities for ensuring that the timezone is properly handled. # # Author: Benjamin Bengfort <benjamin@bengfort.com> # Created: Tue Nov 24 17:35:49 2015 -0500 # # Copyright (C) 2015 Bengfort.com # For license information, see LICENSE.txt # # ID: timez.py [d0f0ca1] benjamin@bengf...
bbengfort/cloudscope
cloudscope/utils/timez.py
Python
mit
3,309
from __future__ import print_function import importlib import numpy as np import matplotlib.pyplot as plt import swe.derives as derives import swe.unsplit_fluxes as flx import mesh.boundary as bnd from simulation_null import NullSimulation, grid_setup, bc_setup import util.plot_tools as plot_tools import particles.p...
harpolea/pyro2
swe/simulation.py
Python
bsd-3-clause
8,797
from __future__ import print_function import os, sys import subprocess import atexit import time import argparse class File(object): def __init__(self, path): self.m_path = path def exists(self): return os.path.exists(self.m_path) def read(self): with open(self.m_path, 'r') as fd: return fd.read().str...
gerstner-hub/xwmfs
tests/base/base.py
Python
gpl-2.0
6,170
# # (c) 2016 Red Hat Inc. # # 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 version. # # Ansible is d...
adityacs/ansible
lib/ansible/plugins/action/vyos.py
Python
gpl-3.0
4,460
#!/usr/bin/env python # # Copyright 2007 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...
ychen820/microblog
y/google-cloud-sdk/platform/google_appengine/google/appengine/ext/webapp/__init__.py
Python
bsd-3-clause
5,929
from CCH import CCH from config import * from GSM import * import numpy as np class BCCH(CCH): def __init__(self,slot): CCH.__init__(self) self.config = (range(2,6),slot) self.name = "BCCH" def callback(self,b,fn,state): b.training = state.bcc return CCH.callback(self,b,fn,state)
ruishihan/R7-with-notes
src/host/python/gsmlib/BCCH.py
Python
apache-2.0
303
""" LWR job manager that uses a CLI interface to a job queue (e.g. Torque's qsub, qstat, etc...). """ from .base.external import ExternalBaseManager from .util.external import parse_external_id from .util.cli import CliInterface, split_params from .util.job_script import job_script from logging import getLogger log =...
jmchilton/lwr
lwr/managers/queued_cli.py
Python
apache-2.0
2,771
# -*- coding: utf-8 -*- # Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz> # Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net> # Copyright (C) 2014-2017 Anler Hernández ...
dayatz/taiga-back
taiga/projects/userstories/utils.py
Python
agpl-3.0
7,817
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_pyramid_sendgrid_webhooks ---------------------------------- Tests for `pyramid_sendgrid_webhooks` module. """ from __future__ import unicode_literals import unittest import pyramid_sendgrid_webhooks as psw from pyramid_sendgrid_webhooks import events, errors ...
GoodRx/pyramid-sendgrid-webhooks
tests/test_pyramid_sendgrid_webhooks.py
Python
mit
6,637
#!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/thumbor/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com timehome@corp.globo.com import sys import optparse from thumbor import __version__ from libt...
wking/thumbor
thumbor/url_composer.py
Python
mit
5,855
import time, sys, getopt, configparser from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC def main(argv): try: opts, args = getopt.getopt(argv, "hcus", ["config=", "url="...
ryanskidmore/PyPhantom
pyphantom.py
Python
mit
2,928
import logging, traceback, time ''' Phidget abstraction layer ''' from Phidgets.Manager import Manager from Phidgets import Devices from Phidgets.PhidgetException import PhidgetException _ENCODER_TICKS_PER_REVOLUTION = 80 class __PhidgetWrapper: def __init__(self, phidget): self._phidget = p...
Denney/SimScript
modules/phidgets.py
Python
bsd-3-clause
5,242
"""Formal Power Series""" from __future__ import print_function, division from collections import defaultdict from sympy import oo, zoo, nan from sympy.core.expr import Expr from sympy.core.add import Add from sympy.core.mul import Mul from sympy.core.function import Derivative, Function from sympy.core.singleton im...
wxgeo/geophar
wxgeometrie/sympy/series/formal.py
Python
gpl-2.0
34,626
class Node: def __init__(self, car=None, prevNode=None, nextNode=None): self.prevNode = prevNode self.nextNode = nextNode self.data = car class LinkedList: def __init__(self): self.head = None class Car: def __init__(self, identification, name, brand, price, active): ...
Pyronia/cvut.zal
07/showroom.py
Python
apache-2.0
3,922
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
2013Commons/HUE-SHARK
apps/jobsub/src/jobsub/tests.py
Python
apache-2.0
8,310
class Solution(object): def findMin(self, nums): """ :type nums: List[int] :rtype: int """ idx = 0 while True: if nums[idx-1] < nums[idx]: idx = idx-1 else: return nums[idx]
dborzov/practicin
52-minimum-in-rotated-array/sol.py
Python
mit
282
#!/cfme_pristine_venv/bin/python2 try: from cfme.utils import conf except ImportError: from utils import conf import subprocess import sys key_list = [key[-9:].replace(' ', '') for key in conf['gpg']['allowed_keys']] proc = subprocess.Popen(['gpg', '--recv-keys'] + key_list) proc.wait() sys.exit(proc.returnco...
jteehan/cfme_tests
scripts/dockerbot/pytestbase/get_keys.py
Python
gpl-2.0
324
# -*- coding: utf-8 -*- import os import codecs import yaml from jinja2 import Template from flask import current_app _forms = {} def get_mapping(blueprint, endpoint): global _forms if not _forms: forms_yaml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'forms.yml') with cod...
360skyeye/kael
kael/web_admin/forms.py
Python
apache-2.0
556
from django.db import reset_queries from celery import Task, current_task import dogstats_wrapper as dog_stats_api import json import logging from util.db import outer_atomic from time import time from lms.djangoapps.instructor_task.models import InstructorTask, PROGRESS TASK_LOG = logging.getLogger('edx.celery.task...
fintech-circle/edx-platform
lms/djangoapps/instructor_task/tasks_helper/runner.py
Python
agpl-3.0
5,085
# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2021, Roland Rickborn (r_2@gmx.net) # # 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, includi...
gitRigge/CardDAV2MicroSIP
bridge.py
Python
mit
5,902
# -*- coding: utf-8 -*- """ *************************************************************************** fixedaspectsvgwidget.py --------------------- Date : August 2016 Copyright : (C) 2016 Boundless, http://boundlessgeo.com ***************************************************...
boundlessgeo/qgis-connect-plugin
boundlessconnect/gui/fixedaspectsvgwidget.py
Python
gpl-2.0
1,963
# -*- coding: utf-8 -*- # # Project Unit Tests # # To run this script use: # python web2py.py -S eden -M -R applications/eden/modules/unit_tests/s3db/project.py # import unittest from gluon import * from gluon.storage import Storage from s3dal import Row from eden.project import S3ProjectActivityModel from unit_test...
flavour/eden
modules/unit_tests/s3db/project.py
Python
mit
2,145
# Copyright (c) 2010 Google 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 source code must retain the above copyright # notice, this list of conditions and the ...
leighpauls/k2cro4
third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py
Python
bsd-3-clause
11,698
# This file is part of Rubber and thus covered by the GPL # (c) Emmanuel Beffara, 2002--2006 # Modified by Olivier Verdier <olivier.verdier@gmail.com> import re import string import codecs # The function `_' is defined here to prepare for internationalization. def _ (txt): return txt re_loghead = re.compile("This i...
alexvh/pydflatex
pydflatex/latexlogparser.py
Python
bsd-3-clause
10,271
#!/usr/bin/env python """ script that ingests the job launch scripts """ from datetime import datetime, timedelta import os import re from supremm.scripthelpers import getdbconnection import sys import logging import glob from getopt import getopt from supremm.config import Config MAX_SCRIPT_LEN = (64 * 1024) - 1 c...
iMurfyD/supremm
supremm/ingest_jobscripts.py
Python
lgpl-3.0
6,249
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Google Maps', 'category': 'Website/Website', 'summary': 'Show your company address on Google Maps', 'version': '1.0', 'description': """ Show your company address/partner address on Google M...
ygol/odoo
addons/website_google_map/__manifest__.py
Python
agpl-3.0
526
#!/usr/bin/env python # -*- coding: UTF-8 -*- from setuptools import setup def get_version(): import os import re version_file = os.path.join("theoldreader", "__init__.py") initfile_lines = open(version_file, 'rt').readlines() version_reg = r"^__version__ = ['\"]([^'\"]*)['\"]" for ...
KurochkinVasiliy/theoldreader
setup.py
Python
mit
1,752
# -*- coding: utf-8 -*- ''' Copyright (C) 2016 Rafael Picanço. The present file is distributed under the terms of the GNU General Public License (GPL v3.0). You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import os,sys...
cpicanco/player_plugins
self_contained/ellipse_detector.py
Python
gpl-3.0
6,498
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution Addon # Copyright (C) 2009-2013 IRSID (<http://irsid.ru>), # Paul Korotkov (korotkov.paul@gmail.com). # # This program is free software: you can redistribute it...
prospwro/odoo
addons/irsid_edu/models/module.py
Python
agpl-3.0
11,983
# © Christian Sommerfeldt Øien # All rights reserved class Pause: def __init__(self, d): self.span = d class Note(Pause): def __init__(self, d, i, p): Pause.__init__(self, d) self.duration = self.span self.label = i self.params = p def __call__(self)...
biotty/rmg
sound/py/music.py
Python
bsd-2-clause
1,436
# # Copyright (C) 2013, 2014 Red Hat, Inc. # # 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 version. # # This program is distrib...
giuseppe/virt-manager
virtcli/cliconfig.py
Python
gpl-2.0
2,910
# coding=utf-8 # Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. import pytest from distutils import version import sys from _pytest.config import get_plugin_manager from pkg_resources import iter_entry_points...
siosio/intellij-community
python/helpers/pycharm/_jb_pytest_runner.py
Python
apache-2.0
1,933
# !/usr/bin/env python # -*- coding: utf-8 -*- from algos import CollectionException, Collection, UNLIMITED class QueueException(CollectionException): pass class Queue(Collection): def __init__(self, capacity=UNLIMITED): if capacity == 0 or capacity < UNLIMITED: raise QueueException( ...
DiogoNeves/PyAlgo
algos/queue.py
Python
mit
1,027
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus 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 opti...
JamesLinEngineer/RKMC
addons/plugin.video.phstreams/resources/lib/sources/scenedown_mv_tv.py
Python
gpl-2.0
6,721
from setuptools import setup, find_packages setup( name='hello_cnn', version='0.0.1', description='A text classifier that leveragge CNN', url='https://github.com/nryotaro/hello_cnn', author='Nakamura, Ryotaro', author_email='nakamura.ryotaro.kzs@gmail.com', license='Copyright (c) 2017 Nakam...
nryotaro/hello_cnn
setup.py
Python
mit
903
# Copyright (c) 2008 Yann Ramin # This file is part of quickmovie. # # quickmovie 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. # # q...
theatrus/quickmovie
quickmovie/template.py
Python
gpl-3.0
1,168
from django.conf import settings from xbrowse.variant_search import utils as search_utils from xbrowse_server.api.utils import add_extra_info_to_variants_project from xbrowse_server.mall import get_reference, get_mall def get_variants_in_gene(family_group, gene_id, variant_filter=None, quality_filter=None): """ ...
macarthur-lab/xbrowse
xbrowse_server/analysis/family_group.py
Python
agpl-3.0
1,157
# Copyright 2012 Nebula, 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 agree...
FNST-OpenStack/horizon
openstack_dashboard/dashboards/project/volumes/urls.py
Python
apache-2.0
1,686
from django.conf.urls import include, url from django.contrib.auth.views import logout from django.conf import settings from . import views urlpatterns = [ url(r'^login/', views.user_login, name='login'), url(r'^logout/$', logout, {'next_page': settings.LOGOUT_REDIRECT_URL}, name='logout'), url(r'^setting...
greenstatic/maas-reservation-system
maas_reservation_system/reservation_system/urls.py
Python
mit
1,810
from __future__ import absolute_import from django.db import models from django.test import TestCase from django.utils import six from .models import ( First, Third, Parent, Child, Category, Record, Relation, Car, Driver) class ManyToOneRegressionTests(TestCase): def test_object_creation(self): Thir...
atruberg/django-custom
tests/many_to_one_regress/tests.py
Python
bsd-3-clause
5,479
# -*- coding: utf-8 -*- """ Provides textual descriptions for :mod:`behave.model` elements. """ from behave.textutil import indent # ----------------------------------------------------------------------------- # FUNCTIONS: # ----------------------------------------------------------------------------- def escape_ce...
WillisXChen/django-oscar
oscar/lib/python2.7/site-packages/behave/model_describe.py
Python
bsd-3-clause
3,364
# -*- coding: utf-8 -*- from decimal import Decimal import logging from django.core.cache import cache from django.db.models import Sum log = logging.getLogger(__name__) CACHE_PREFIX = 'dgsproxy_stats_' class ProxyStats(object): def __init__(self): self.hits_proxied = 0 self.hits_cached = 0 ...
hzlf/discogs-proxy
website/apps/dgsproxy/stats.py
Python
mit
2,133
import os import time from datetime import date import osgtest.library.core as core import osgtest.library.files as files import osgtest.library.osgunittest as osgunittest import osgtest.library.service as service class TestStartPBS(osgunittest.OSGTestCase): pbs_config = """ create queue batch queue_type=executi...
efajardo/osg-test
osgtest/tests/test_170_pbs.py
Python
apache-2.0
5,425
from django.dispatch import receiver from django.core.urlresolvers import get_callable from dbconnect.signals import connection_created_to from signals import namespace_changed from dbconnect.plugins.namespace.conf import settings @receiver(connection_created_to) def switch_namepsace(sender, alias=None, connection=...
allanlei/django-dbconnect
dbconnect/plugins/namespace/models.py
Python
bsd-2-clause
1,320
# 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 # distributed u...
MCDong/barbican
barbican/api/controllers/orders.py
Python
apache-2.0
9,049
import unittest import shutil import tempfile import os.path import sqlite3 import createrepo_c as cr from fixtures import * class TestCaseSqlite(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix="createrepo_ctest-") def tearDown(self): shutil.rmtree(self.tmpdir) ...
lmacken/createrepo_c
tests/python/tests/test_sqlite.py
Python
gpl-2.0
10,463
#!/usr/bin/python2.4 # # Copyright (C) 2009 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 l...
frickler/WaveBots
waveapi/waveservice_test.py
Python
apache-2.0
2,240
import datetime import json import os from flask import Flask, abort, g, render_template, session, request from flask_bootstrap import Bootstrap from flask_login import LoginManager, current_user from flask_mail import Mail from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from config import con...
nycrecords/intranet
app/__init__.py
Python
mit
1,884
from StrongHold import WeightedNewick with open('data/data.dat') as input_data: trees = [line.split('\n') for line in input_data.read().strip().split('\n\n')] # The majority of the work is done by the Weighted Newick class in the Data Structures script. distances = [str(WeightedNewick(tree[0]).distance(*tree[1].spli...
crf1111/Bio-Informatics-Learning
Bio-StrongHold/src/Newick_Format_with_Edge_Weights.py
Python
mit
400
"""Automatic keyboard layout switcher""" import functools import logging import subprocess from typing import Iterable from typing import Set import xkbgroup import swytcher.settings as settings import swytcher.xwindow as xwindow from swytcher.util import suppress_err log = logging.getLogger(__name__) # pylint: dis...
eddie-dunn/swytcher
swytcher/swytcher.py
Python
mit
3,436
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
dmlc/mxnet
example/gluon/lipnet/utils/preprocess_data.py
Python
apache-2.0
8,781
# This file is part of Indico. # Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN). # # Indico 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 (a...
nop33/indico
indico/modules/categories/serialize.py
Python
gpl-3.0
8,146
""" The basic iterator-classes for iterating over the blocks and transactions of the blockchain. """ from collections import deque from sortedcontainers import SortedList from .defs import GENESIS_PREV_BLOCK_HASH, HEIGHT_SAFETY_MARGIN from .misc import hash_hex_to_bytes, FilePos, Bunch from .rawfiles import RawDataIt...
fungibit/chainscan
chainscan/scan.py
Python
mit
20,770
# -*- coding: utf-8 -*- import pickle class Enum(set): def __getattr__(self, name): if name in self: return name raise AttributeError class ItemSet(object): def __iter__(self): return self.items.__iter__() def __next__(self): return self.items.__next__() ...
PythonSanSebastian/docstamp
docstamp/collections.py
Python
apache-2.0
1,012
import os from django.core.management.base import NoArgsCommand from reviews.models import Screenshot class Command(NoArgsCommand): def handle_noargs(self, **options): prefix = os.path.join("images", "uploaded") new_prefix = os.path.join("uploaded", "images") for screenshot in Screensho...
Khan/reviewboard
reviewboard/reviews/management/commands/fixscreenshots.py
Python
mit
574
class BankException(Exception): pass class WrongPINException(Exception): pass class ShopWizardException(Exception): pass class ItemOutOfStockException(ShopWizardException): def __init__(self, item_name): super(ItemOutOfStockException, self).__init__('Item is out of stock: ' + item_name) cla...
Smetterleen/Neopets-Python-API
neopapi/shops/Exceptions.py
Python
gpl-3.0
487
import datetime from django.test import SimpleTestCase import sqlalchemy from ..sql import get_indicator_table from ..views import process_url_params from .test_data_source_config import get_sample_data_source class ParameterTest(SimpleTestCase): def setUp(self): config = get_sample_data_source() ...
dimagi/commcare-hq
corehq/apps/userreports/tests/test_export.py
Python
bsd-3-clause
1,374
# -*- coding: utf-8 -*- ############################################################################### # # ShowGroup # Shows information for an existing group. # # Python versions 2.6, 2.7, 3.x # # Copyright 2014, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this f...
jordanemedlock/psychtruths
temboo/core/Library/Zendesk/Groups/ShowGroup.py
Python
apache-2.0
3,603
# =============================================================================== # Copyright 2016 Jake Ross # # 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...
UManPychron/pychron
pychron/managers/stream_graph_manager.py
Python
apache-2.0
8,276
# -*- coding: utf-8 -*- import copy import os from django.contrib import auth from django.contrib.auth.models import User from django.core.files.uploadedfile import SimpleUploadedFile from django.db.models import QuerySet from django.test import TestCase, Client, mock from django.urls import reverse from ..forms imp...
OlegKlimenko/Plamber
app/tests/test_models.py
Python
apache-2.0
53,921
# coding: utf-8 from flask import Flask, request, render_template import utils, config import sys reload(sys) sys.setdefaultencoding('utf-8') app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def index(): url = None if request.method == 'POST': account = request.form['account'] password = request....
solupro/kancolle
app.py
Python
unlicense
698
# Copyright 2014 OpenStack Foundation # # 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 w...
bigswitch/neutron
neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py
Python
apache-2.0
27,788
# -*- coding: utf-8 -*- """ Copyright (C) 2014 Dariusz Suchojad <dsuch at zato.io> Licensed under LGPLv3, see LICENSE.txt for terms and conditions. """ from __future__ import absolute_import, division, print_function, unicode_literals # stdlib import weakref from copy import deepcopy from logging import getLogger f...
AmrnotAmr/zato
code/zato-server/src/zato/server/store.py
Python
gpl-3.0
4,970
# Problem c diag = lambda x : (x[0]*x[0]+x[1]*x[1])**0.5 def solve(n, p, ip): t = 2 * sum(map(sum,ip)) _min = 2*min(map(min,ip)) if t + _min > p: return t _max = 2*sum(map(diag,ip)) if t + _max == p: return p if t + _max < p: return t + _max all_min = 2*sum(map(...
subhrm/google-code-jam-solutions
solutions/2018/1A/C/c.py
Python
mit
1,448
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on Jul 14, 2014 @author: anroco How to working the format method of a python str? ¿Como funciona el metodo format de un string en python? ''' # #review https://docs.python.org/3/library/string.html#formatstrings # #Using the comma as a thousands separator (...
OxPython/Python_str_format
src/format3_str.py
Python
epl-1.0
955
#!/usr/bin/env python # -*- coding: utf-8 -*- import platform def format_args(args): """ Format the args to pass to the subprocess Linux requires a string with spaces (if an argument contains spaces it must be surrounded with quotes), whereas Windows requires a list :param args: A list of arguments ...
ValyrianTech/BitcoinSpellbook-v0.3
helpers/platformhelpers.py
Python
gpl-3.0
652
# ----------------------------------------------------------------------- # OpenXenManager # # Copyright (C) 2009 Alberto Gonzalez Rodriguez alberto@pesadilla.org # Copyright (C) 2014 Daniel Lintott <daniel@serverb.co.uk> # # This program is free software; you can redistribute it and/or # modify it under the terms of t...
OpenXenManager/openxenmanager
src/OXM/window.py
Python
gpl-2.0
90,995
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('meta', '0002_auto_20170521_0304'), ] operations = [ migrations.AddField( model_name='meta', name='fo...
google/mirandum
alerts/meta/migrations/0003_auto_20170521_1611.py
Python
apache-2.0
2,155
# -*- coding: utf-8 -*- # # MyTemplateWebsite documentation build configuration file, created by # sphinx-quickstart. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration val...
zooming-tan/MyTemplateWebsite
docs/conf.py
Python
bsd-3-clause
7,873
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2015 Cutting Edge QA Marcin Koperski import os import time import sys import csv # import unicodecsv as csv from robot.libraries import DateTime from robot.utils import asserts from TestToolsMK import robot_instances from TestToolsMK.robot_instances impor...
IlfirinPL/robotframework-MarcinKoperski
src/TestToolsMK/csv_keywords.py
Python
mit
5,221
from django.template import loader, RequestContext from django.http import Http404, HttpResponse from django.core.xheaders import populate_xheaders from django.core.paginator import QuerySetPaginator, InvalidPage from django.core.exceptions import ObjectDoesNotExist def object_list(request, queryset, paginate_by=None,...
rawwell/django
django/views/generic/list_detail.py
Python
bsd-3-clause
5,439
#!/usr/bin/env python # -*- coding: utf-8 -*- DEBUG = False SECRET_KEY = "development key" REDIS_PORT = 6379 REDIS_PREFIX = "osrc" GITHUB_ID = None GITHUB_SECRET = None
errietta/osrc
osrc/default_settings.py
Python
mit
172
""" Cornice services.""" import logging from cornice import Service import json import re from schema import create_table, Zopper from exceptions import (NoFilterPassed, InvadilDataException, InvalidFilterFoundException, NoDataPassedException) fr...
itssafi/zopper.ws
zopper/ws/views.py
Python
gpl-3.0
6,300
"""HomeKit session fixtures.""" from unittest.mock import patch from pyhap.accessory_driver import AccessoryDriver import pytest from homeassistant.components.homekit.const import EVENT_HOMEKIT_CHANGED from homeassistant.core import callback as ha_callback @pytest.fixture def hk_driver(loop): """Return a custom...
turbokongen/home-assistant
tests/components/homekit/conftest.py
Python
apache-2.0
982
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utilities for generating the version string for Astropy (or an affiliated package) and the version.py module, which contains version info for the package. Within the generated astropy.version module, the `major`, `minor`, and `bugfix` variables hold ...
astropy/astropy-helpers
astropy_helpers/version_helpers.py
Python
bsd-3-clause
12,694
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2015 Comunitea Servicios Tecnológicos All Rights Reserved # $Omar Castiñeira Saavedra <omar@comunitea.com>$ # # This program is free software: you can redistribute it and/or modify # it u...
jgmanzanas/CMNT_004_15
project-addons/test_management/users.py
Python
agpl-3.0
2,882
#______________________________________________________________________________ # Turn our site into a pdf printable document using princexml #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import grok, re from interfaces import ISiteRoot, IArticle, IArticleSorter from menu import UtilI...
prsephton/Grok4Noobs
mkbook.py
Python
lgpl-2.1
5,654
# Support for "neopixel" leds # # Copyright (C) 2019-2020 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import logging BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000 BIT_MAX_TIME=.000004 RESET_MIN_TIME=.000050 MAX_MCU_SIZE = 500 # Sanity check on LED...
KevinOConnor/klipper
klippy/extras/neopixel.py
Python
gpl-3.0
6,836
from __future__ import absolute_import import json import sys from os import makedirs from os.path import join, normpath, isdir, isfile from .base import * DEBUG = True SECRET_KEY = 'make-a-secret-key' LOCAL_SETUP_DIR = join(PROJECT_DIR, 'test_setup') if not isdir(LOCAL_SETUP_DIR): makedirs(LOCAL_SETUP_DIR) DA...
arnarb/greenhousedb
plants/settings/laptop.py
Python
gpl-3.0
774
#!/usr/bin/env python from django import forms from djtokeninput.widgets import TokenWidget class TokenField(forms.ModelMultipleChoiceField): kwargs_for_widget = ("search_url",) widget = TokenWidget @staticmethod def _class_name(value): return value.replace(" ", "-") def __init__(self, model, *args, ...
jgruhl/djtokeninput
lib/djtokeninput/fields.py
Python
mit
735
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-06 20:01 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='CodeRu...
RadoRado/EuroPython2017
run_python_run/repl/migrations/0001_initial.py
Python
mit
665
""" Discrete Fourier Transforms Routines in this module: fft(a, n=None, axis=-1) ifft(a, n=None, axis=-1) rfft(a, n=None, axis=-1) irfft(a, n=None, axis=-1) hfft(a, n=None, axis=-1) ihfft(a, n=None, axis=-1) fftn(a, s=None, axes=None) ifftn(a, s=None, axes=None) rfftn(a, s=None, axes=None) irfftn(a, s=None, axes=None...
LumPenPacK/NetworkExtractionFromImages
win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/fft/fftpack.py
Python
bsd-2-clause
45,497
#!/usr/bin/env python """PyQt4 port of the tools/regexp example from Qt v4.x""" from PySide import QtCore, QtGui class RegExpDialog(QtGui.QDialog): MaxCaptures = 6 def __init__(self, parent=None): super(RegExpDialog, self).__init__(parent) self.patternComboBox = QtGui.QComboBox() s...
Southpaw-TACTIC/Team
src/python/Lib/site-packages/PySide/examples/tools/regexp.py
Python
epl-1.0
6,001
#!/usr/bin/env python # -*- coding: utf-8 -*- from getpass import getpass from gmusicapi import Webclient def ask_for_credentials(): """Make an instance of the api and attempts to login with it. Return the authenticated api. """ # We're not going to upload anything, so the webclient is what we want...
jimyx17/gmusic
example.py
Python
bsd-3-clause
2,590
import numpy as np import gdspy from picwriter import toolkit as tk import picwriter.components as pc X_SIZE, Y_SIZE = 15000, 15000 exclusion_region = 2000.0 # region where no devices are to be fabricated x0, y0 = X_SIZE / 2.0, Y_SIZE / 2.0 # define origin of the die step = 100.0 # standard spacing between componen...
DerekK88/PICwriter
docs/source/tutorial3.py
Python
mit
2,255
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ # imports from __future__ import unicode_literals import os from collections import deque # matplotlib import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d impor...
ericdill/miniature-hipster
miniature-hipster/plotting/waterfall.py
Python
bsd-3-clause
4,362
from django.forms import ModelForm from django.forms.widgets import NumberInput from django import forms from django.db.models import Q from .models import * def qs_to_opt_choice(qs): empty = [('',''),] empty.extend((obj,obj) for obj in qs) return empty class ZugSearchForm(forms.Form): def __init__(s...
jonathanp0/zusidatenbank
zusidatenbank/datenbank/forms.py
Python
agpl-3.0
7,729
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013, John McNamara, jmcnamara@cpan.org # import unittest import os from ...workbook import Workbook from ..helperfunctions import _compare_xlsx_files class TestCompareXLSXFiles(unittest.TestC...
ivmech/iviny-scope
lib/xlsxwriter/test/comparison/test_image01.py
Python
gpl-3.0
2,429
# coding: utf-8 # Copyright (C) 1994-2016 Altair Engineering, Inc. # For more information, contact Altair at www.altair.com. # # This file is part of the PBS Professional ("PBS Pro") software. # # Open Source License Information: # # PBS Pro is free software. You can redistribute it and/or modify it under the # term...
subhasisb/test2
test/fw/setup.py
Python
agpl-3.0
2,871
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from django import template from django.conf import settings from django.template.loader import get_template from pdc import get_version def pdc_version(): return get_version() def login_url(redirect=No...
xychu/product-definition-center
pdc/apps/utils/templatetags/pdctags.py
Python
mit
1,551
import os from setuptools import setup, find_packages # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(os.path....
groakat/sound4python
setup.py
Python
mit
879
from tamproxy import SyncedSketch, Timer from tamproxy.devices import Motor, Encoder # Cycles a motor back and forth between -255 and 255 PWM every ~5 seconds HUGS_MOTOR_CONTROLLER_DIRECTION = 8 HUGS_MOTOR_CONTROLLER_PWM = 9 HUGS_MOTOR_ENCODER_YELLOW = 31 HUGS_MOTOR_ENCODER_WHITE = ...
pravinas/et-maslab-2016
sandbox/test_hugs.py
Python
mit
2,236
# Copyright (c) 2018 Charles University, Faculty of Arts, # Institute of the Czech National Corpus # Copyright (c) 2018 Tomas Machalek <tomas.machalek@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 publis...
tomachalek/kontext
lib/plugins/rdbms_corparch/registry/parser.py
Python
gpl-2.0
7,234
""" Django settings for rational_whimsy project. Generated by 'django-admin startproject' using Django 1.10.3. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ i...
nhuntwalker/rational_whimsy
rational_whimsy/rational_whimsy/settings.py
Python
mit
5,068
"""Execute Ansible sanity tests.""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type import abc import glob import os import re import collections from ... import types as t from ...io import ( read_json_file, ) from ...util import ( ApplicationError, SubprocessErr...
thnee/ansible
test/lib/ansible_test/_internal/commands/sanity/__init__.py
Python
gpl-3.0
43,765
from abc import ABCMeta, abstractmethod, abstractproperty from ruleset import Ruleset from device import Device from propagation_model import PropagationModel from region import Region from boundary import Boundary from data_map import DataMap2D, DataMap3D, DataMap2DWithFixedBoundingBox from population import Populatio...
kate-harrison/west
west/data_management.py
Python
gpl-2.0
23,067
# -*- coding: utf-8 -*- # Copyright 2007-2020 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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...
dnjohnstone/hyperspy
hyperspy/misc/machine_learning/import_sklearn.py
Python
gpl-3.0
1,124
""" sphinx.cmd.make_mode ~~~~~~~~~~~~~~~~~~~~ sphinx-build -M command-line handling. This replaces the old, platform-dependent and once-generated content of Makefile / make.bat. This is in its own module so that importing it is fast. It should not import the main Sphinx modules (like sph...
sonntagsgesicht/regtest
.aux/venv/lib/python3.9/site-packages/sphinx/cmd/make_mode.py
Python
apache-2.0
6,580
from flask.ext.assets import Bundle from . import wa js_libs = Bundle('js/libs/jquery.min.js', 'js/libs/bootstrap.min.js', 'js/libs/lodash.min.js', #filters='jsmin', output='js/libs.js') js_board = Bundle('js/libs/drawingboard.min.js', ...
luizdepra/sketch_n_hit
app/assets.py
Python
mit
984