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 -*-
#
# 2015-06-30 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add the OTP PIN handling
# 2015-06-29 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add the mangle policy
# 2015-04-03 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add WebUI ... | jshufelt/privacyidea | privacyidea/lib/policy.py | Python | agpl-3.0 | 43,171 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Hunter documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 22 19:58:21 2016.
#
# 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
# aut... | NeroBurner/hunter | docs/conf.py | Python | bsd-2-clause | 10,470 |
"""All plots of paper II
"""
import os
from collections import defaultdict
import numpy as np
from energy_demand.read_write import data_loader, read_data
from energy_demand.basic import date_prop
from energy_demand.basic import lookup_tables
from energy_demand.plotting import fig_weather_variability_priod
from energy_... | nismod/energy_demand | energy_demand/plotting/figs_p2.py | Python | mit | 11,623 |
#!/usr/bin/env python3
#
# Copyright (c) 2018, Foundries.io Ltd
# Copyright (c) 2018, Nordic Semiconductor ASA
# Copyright (c) 2017, Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
# Internal script used by the documentation's build system to create
# the "final" docs tree which is then compiled by Sphinx.
#... | nashif/zephyr | doc/_scripts/extract_content.py | Python | apache-2.0 | 9,216 |
import unittest
import numpy
import six
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'dtype': [numpy.float16, numpy.float32, numpy.float64],
... | okuta/chainer | tests/chainer_tests/functions_tests/loss_tests/test_triplet.py | Python | mit | 6,483 |
# Copyright 2012-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
ResolverPlaygroundTestCase)
class SlotConflictRebuildTestCase(TestCase):
def testSlotConflictRebui... | dol-sen/portage | pym/portage/tests/resolver/test_slot_conflict_rebuild.py | Python | gpl-2.0 | 10,626 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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 (... | vmax-feihu/hue | desktop/core/src/desktop/tests.py | Python | apache-2.0 | 34,931 |
# Copyright 2012 Google 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 applicable law or ... | danieldanciu/schoggi | models/courses.py | Python | apache-2.0 | 121,801 |
"""
Windows virtio-win utilities
"""
import re
from . import drive
from . import system
ARCH_MAP_ISO = {"32-bit": "x86", "64-bit": "amd64"}
ARCH_MAP_VFD = {"32-bit": "i386", "64-bit": "amd64"}
def arch_dirname_iso(session):
"""
Get architecture directory's name - iso media version.
:param session: Se... | chloerh/avocado-vt | virttest/utils_windows/virtio_win.py | Python | gpl-2.0 | 2,404 |
# -*- coding: utf-8 -*-
"""Racndicmd setup.py."""
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import os
import sys
class Tox(TestCommand):
"""Tox."""
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
... | mtoshi/rancidcmd | setup.py | Python | mit | 2,154 |
from django.db import models
class Client(models.Model):
name = models.CharField(max_length=64)
def __str__(self):
return self.name
class Company(models.Model):
client = models.ForeignKey(Client, related_name='companies')
name = models.CharField(max_length=64)
code = models.CharField(ma... | Bielicki/lcda | companies/models.py | Python | gpl-3.0 | 2,447 |
#!/usr/bin/python
import cwiid
import sys
import time
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
import atexit
# create a default object, no changes to I2C address or frequency
mh = Adafruit_MotorHAT(addr=0x60)
mesg = False
led = 0
rpt_mode = 0
rumble = 0
erect_state = 0 # Thing is down (1 is ... | JohnOmernik/pimeup | wii_thing/wii_thing.py | Python | apache-2.0 | 6,203 |
import logging
import sys
class StdOutWrapper(object):
"""
Call wrapper for stdout
"""
def __init__(self):
super(StdOutWrapper, self).__init__()
self.line = ""
self.logy = logging.getLogger()
self.stdout = sys.stdout
sys.stdout = self
def close(self):
... | CSB-at-ZIB/BioPARKIN | src/basics/logging/stdoutwrapper.py | Python | lgpl-3.0 | 815 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to add authorized_keys for ssh logins.
(c) 2012, Brad Olson <brado@movedbylight.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 ... | dochang/ansible-modules-core | system/authorized_key.py | Python | gpl-3.0 | 15,872 |
# -*- coding: UTF-8 -*-
# Copyright 2009-2013 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
#import time
#from datetime import date
#from dateutil import parser as dateparser
#from lino.projects.finan import models as finan
#~ import decimal
from decimal import Decimal
... | lino-framework/xl | lino_xl/lib/finan/fixtures/unused_demo.py | Python | bsd-2-clause | 2,082 |
"""
The primary task of the generic_potential module is to define the
:class:`generic_potential` class, from which realistic scalar field models can
straightforwardly be constructed. The most important part of any such model is,
appropiately, the potential function and its gradient. This module is not
necessary to defi... | clwainwright/CosmoTransitions | cosmoTransitions/generic_potential.py | Python | mit | 34,573 |
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: auto
author:
- Matt Davis (@nitzmahone)
version_added: "... | maxamillion/ansible | lib/ansible/plugins/inventory/auto.py | Python | gpl-3.0 | 2,372 |
# -*- coding: utf-8 -*-
# Copyright (C) 2009 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields
class ResCompany(models.Model):
_inherit = 'res.company'
purchase_fiscal_category_id = fields.Many2one(
'l10n_br_account.fiscal.cat... | thinkopensolutions/l10n-brazil | l10n_br_purchase/models/res_company.py | Python | agpl-3.0 | 427 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free... | kingmotley/SickRage | sickbeard/dailysearcher.py | Python | gpl-3.0 | 4,422 |
""" A model of a Cloud Provider in CFME
:var page: A :py:class:`cfme.web_ui.Region` object describing common elements on the
Providers pages.
:var discover_form: A :py:class:`cfme.web_ui.Form` object describing the discover form.
:var properties_form: A :py:class:`cfme.web_ui.Form` object describing the ma... | kzvyahin/cfme_tests | cfme/cloud/provider/__init__.py | Python | gpl-2.0 | 11,922 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
import numpy as np
import warnings
from affine import Affine
from shapely.geometry import shape
from .io import read_features, Raster
from .utils import (rasterize_geom, get_percentile, check_stats,
remap_... | doclements/python-rasterstats | src/rasterstats/main.py | Python | bsd-3-clause | 10,843 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" QiBuild """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print... | aldebaran/qibuild | python/qidoc/test/test_worktree.py | Python | bsd-3-clause | 1,734 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import typing # NOQA: F401
import six
from nixnet import _funcs
from nixnet import _props
from nixnet import constants
class Interface(object):
'''Interfaces associated with a physical hardware device.... | epage/nixnet-python | nixnet/system/_interface.py | Python | mit | 8,210 |
"""Test for RFLink light components.
Test setup of RFLink lights component/platform. State tracking and
control of RFLink switch devices.
"""
from homeassistant.components.light import ATTR_BRIGHTNESS
from homeassistant.components.rflink import EVENT_BUTTON_PRESSED
from homeassistant.const import (
ATTR_ENTITY_I... | tinloaf/home-assistant | tests/components/light/test_rflink.py | Python | apache-2.0 | 18,573 |
# 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 under the... | bigswitch/horizon | openstack_dashboard/dashboards/project/stacks/resource_types/tabs.py | Python | apache-2.0 | 1,170 |
from django.conf.urls.defaults import *
handler500 = 'djangotoolbox.errorviews.server_error'
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
('^_ah/warmup$', 'djangoappengine.views.warmup'),
('^$', 'django.views.generic.simple.direct_to_template',
{'template': 'index.htm... | whardier/MAC-Eater | django/mac-eater/urls.py | Python | mit | 673 |
#!/usr/bin/python3
import sys
complements_dict = {"A":"T",
"T":"A",
"C":"G",
"G":"C"}
def comp_letter(x, d=complements_dict):
if x in d:
return d[x]
else:
return ""
if __name__=="__main__":
for line in sys.stdin:
complem... | andrew-quinn/rosalind-exercises | problems/complementing-a-strand-of-dna.py | Python | mit | 394 |
from api_remote.backends import base
import json
import urllib2
class SBCatalogResourceBackend(base.ApiRemoteBackend):
def get_data(self, full_url, as_string=False, del_from_cache=False):
"""Retrieve data from cache or from url, cache result, return data
param:as_string set it to True if you w... | befair/gasistafelice | gasistafelice/api_remote/backends/sbcatalog.py | Python | agpl-3.0 | 791 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C)2004-TODAY Tech Receptives(<https://www.techreceptives.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the t... | GauravSahu/website_recaptcha | website_signup_recaptcha_reloaded/__openerp__.py | Python | agpl-3.0 | 1,602 |
# -*- coding: utf-8 -*-
import unittest
import sodaclient
SODA_URL = "http://localhost:8080"
LEXICON_NAME = "test_countries-3"
MATCHINGS = ["exact", "lower", "stop", "stem1", "stem2", "stem3"]
LOOKUP_ID = "http://test-countries-3.com/ABW"
TEXT = "Institute of Clean Coal Technology, East China University of Science an... | elsevierlabs-os/soda | src/main/python/sodaclient_test.py | Python | apache-2.0 | 2,973 |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class PostUniverseNamesNotFound(object):
"""
NOTE: This ... | minlexx/pyevemon | esi_client/models/post_universe_names_not_found.py | Python | gpl-3.0 | 2,971 |
from flask import url_for
from flask_babel import gettext
from decksite.view import View
from .. import APP
# pylint: disable=no-self-use
class AboutPdm(View):
def __init__(self) -> None:
super().__init__()
self.about_url = url_for('about')
def page_title(self) -> str:
return gettex... | PennyDreadfulMTG/Penny-Dreadful-Tools | decksite/views/about_pdm.py | Python | gpl-3.0 | 456 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from bi... | jimmykiselak/lbrycrd | qa/rpc-tests/getblocktemplate_proposals.py | Python | mit | 6,238 |
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import datetime
import requests
import os
import hmac
import hashlib
import threading
import markdown
from urllib.request import urlopen
import libpagure
import logging
import git_interface as git
import sqlite3
try:
import config
except ImportE... | yangl1996/docs-toolchain | github.py | Python | gpl-2.0 | 12,333 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial Lice... | qtproject/pyside-shiboken | tests/samplebinding/ownership_invalidate_child_test.py | Python | gpl-2.0 | 2,465 |
#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pyFlight as flight
flight.loadFromFile( "/home/prokop/git/SimpleSimulationEngine/cpp/apps/AeroCombat/data/AeroCraftMainWing1.ini" )
def getRotXZ( angle ):
ca=np.cos(angle)
sa=np.sin(angle)
... | ProkopHapala/SimpleSimulationEngine | python/test_Fly.py | Python | mit | 1,329 |
# http://stackoverflow.com/questions/1477294/generate-random-utf-8-string-in-python
import random
def get_random_unicode(length):
try:
get_char = unichr
except NameError:
get_char = chr
# Update this to include code point ranges to be sampled
include_ranges = [
(0x0021, ... | gouthambs/Flask-Blogging | test/utils.py | Python | mit | 948 |
"""
Routing configuration of the ias_webserver project.
"""
from django.conf.urls import url
from channels.routing import ProtocolTypeRouter, URLRouter
from alarms.consumers import CoreConsumer, ClientConsumer
from alarms.auth import TokenAuthMiddleware
application = ProtocolTypeRouter({
"websocket": URLRouter([
... | IntegratedAlarmSystem-Group/ias-webserver | ias_webserver/routing.py | Python | lgpl-3.0 | 454 |
# -*- coding: utf-8 -*-
# Copyright (C) 2021 Rocky Bernstein
#
import os
# Our local modules
from trepan.processor.command.base_subcmd import DebuggerSubcommand
class SetTempdir(DebuggerSubcommand):
"""**set tempdir** *directory*
Set the temporary directory for temporary decompiled python files.
Thi... | rocky/python2-trepan | trepan/processor/command/set_subcmd/tempdir.py | Python | gpl-3.0 | 1,293 |
from __future__ import unicode_literals
import frappe
from erpnext.regional.united_states.setup import make_custom_fields
def execute():
frappe.reload_doc('accounts', 'doctype', 'allowed_to_transact_with', force=True)
frappe.reload_doc('accounts', 'doctype', 'pricing_rule_detail', force=True)
frappe.reload_doc('cr... | saurabh6790/erpnext | erpnext/patches/v12_0/create_irs_1099_field_united_states.py | Python | gpl-3.0 | 578 |
import rope.base.builtins
import rope.base.pynames
import rope.base.pyobjects
from rope.base import ast, astutils, exceptions, pyobjects, arguments, worder
BadIdentifierError = exceptions.BadIdentifierError
def eval_location(pymodule, offset):
"""Find the pyname at the offset"""
return eval_location2(pymodu... | JetChars/vim | vim/bundle/python-mode/pymode/libs2/rope/base/evaluate.py | Python | apache-2.0 | 12,447 |
# coding: utf-8
from .base import TestCase
from .base import create_server, sqlalchemy_provider, cache_provider
from .base import db, Client, User
class TestDefaultProvider(TestCase):
def create_server(self):
create_server(self.app)
def prepare_data(self):
self.create_server()
oauth... | adambard/flask-oauthlib | tests/test_oauth2/test_implicit.py | Python | bsd-3-clause | 1,272 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qhangups/qhangupsconversations.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_QHangupsConversations(object):
def setupUi(self... | xmikos/qhangups | qhangups/ui_qhangupsconversations.py | Python | gpl-3.0 | 1,990 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RMultcomp(RPackage):
"""Simultaneous Inference in General Parametric Models
Simultane... | LLNL/spack | var/spack/repos/builtin/packages/r-multcomp/package.py | Python | lgpl-2.1 | 1,541 |
from celery import Celery
from celery.decorators import periodic_task
from celery.schedules import crontab
import datetime
import requests
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
app = Celery('tasks', backend='redis://localhost:6379/0', broker='redis://localhost:6379/0')
LAST_... | ryankanno/hitraffic-alert | tasks.py | Python | mit | 2,052 |
from openerp import models,fields
class OeMedicalMedicamentCategory(models.Model):
_name = 'oemedical.medicament.category'
childs = fields.One2many('oemedical.medicament.category',
'parent_id', string='Children', )
name = fields.Char(size=256, string='Name', required=True)
... | Manexware/medical | oemedical/oemedical_medicament_category/oemedical_medicament_category.py | Python | gpl-2.0 | 589 |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from time import time
from gevent import spawn, sleep
from collections import deque
from datetime import datetime
from iris.sender.shared import send_queue
from... | houqp/iris-api | src/iris/sender/quota.py | Python | bsd-2-clause | 12,577 |
#!/usr/bin/env python
# encoding: utf-8
'''
edu.cornell.gobii.LGduplicates -- shortdesc
edu.cornell.gobii.LGduplicates is a description
It defines classes_and_methods
@author: yn259
@copyright: 2016 Cornell University. All rights reserved.
@license: license
@contact: yn259@cornell.edu
@deffield upda... | gobiiproject/GOBii-System | gobiiscripts/loaders/LGduplicates.py | Python | mit | 3,181 |
import multiprocessing
import Library.interfaz
import Library.config
import handler
import server
try:
config = Library.config.read()
except:
import sys
print("FAILED TO OPEN CONFIG FILE, EXITING")
sys.exit()
man = multiprocessing.Manager()
adios = man.Value(bool, False)
interfaz = Library.interfaz.Int... | elan17/irc-terminal | server/main.py | Python | gpl-3.0 | 927 |
#!/usr/bin/env python
import django
import os
import sys
from django.core.management import call_command
def runtests():
os.environ['DJANGO_SETTINGS_MODULE'] = 'linaro_django_pagination.tests.settings'
try:
django.setup()
except AttributeError: # for Django 1.6 compatible
pass
fai... | Polyconseil/django-pagination | linaro_django_pagination/tests/runner.py | Python | bsd-3-clause | 449 |
import tensorflow as tf
from tf.keras.layers import LSTM, Dense, Bidirectional
from swl.machine_learning.tensorflow.simple_neural_net import SimpleNeuralNet
#--------------------------------------------------------------------
class SimpleRnnUsingKeras(SimpleNeuralNet):
def __init__(self, input_shape, output_shape, ... | sangwook236/sangwook-library | python/test/machine_learning/tensorflow/simple_rnn_keras.py | Python | gpl-2.0 | 5,227 |
import json
import argparse
import sys
import zmq
from multiprocessing import Process
def get_command_line_arguments( ):
parser = argparse.ArgumentParser(description='Server for Networkdroid')
parser.add_argument("configfile", help = "Set configuration file to be used")
return parser.parse_args()
def main... | susundberg/Networkdroid | src/main_test.py | Python | gpl-2.0 | 1,382 |
# -*- coding: utf-8 -*-
import os, sys
import configparser
import warnings
#
# Look for a global .ini in the current directory. If none is
# there, raise an exception and exit. Look for a local .ini
# in the same directory. If that isn't present, issue a warning
# but carry on and use the global values
#
gl... | westpark/robotics | piwars/core/config.py | Python | mit | 1,179 |
"""
Support for IPMA weather service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/weather.ipma/
"""
import logging
from datetime import timedelta
import async_timeout
import voluptuous as vol
from homeassistant.components.weather import (
Weathe... | persandstrom/home-assistant | homeassistant/components/weather/ipma.py | Python | apache-2.0 | 5,305 |
#!/usr/bin/python
# We need the following two lines in order for matplotlib to work
# without access to an X server.
from __future__ import division
import matplotlib
matplotlib.use('Agg')
import pylab, numpy, sys
mNpermeter = 6.4230498e-07 # in atomic units
nm = 18.8972613 # in atomic units
angstrom = 0.1*nm
spced... | droundy/deft | talks/colloquium/figs/sphere-energy.py | Python | gpl-2.0 | 1,500 |
"""
WSGI config for server_proj project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATIO... | uw-it-aca/scout-vagrant | provisioning/templates/sample.wsgi.py | Python | apache-2.0 | 1,364 |
import unittest
from pyscipopt import Model
class ReoptimizationTest(unittest.TestCase):
def test_reopt(self):
m = Model()
m.enableReoptimization()
x = m.addVar(name="x", ub=5)
y = m.addVar(name="y", lb=-2, ub=10)
m.addCons(2 * x + y >= 8)
m.setObjective(x + y)
... | SCIP-Interfaces/PySCIPOpt | tests/test_reopt.py | Python | mit | 838 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-20 03:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sketches', '0001_initial'),
]
operations = [
migrations.AlterField(
... | fatiherikli/komposto.org | sketches/migrations/0002_auto_20170420_0342.py | Python | mit | 459 |
## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" Add a group to the current worktree
"""
from qisys import ui
import qisrc.parsers
import sys
def configure_parser(parser):
qisrc.parsers... | dmerejkowsky/qibuild | python/qisrc/actions/add_group.py | Python | bsd-3-clause | 819 |
d = {1:'Z','y':88}
assert d.__class__ == dict
assert isinstance(d,dict)
assert str(d)=="{1: 'Z', 'y': 88}"
x = dict([['a',1],['r',2],['bg',3],['Z',4]])
y = dict(zip(['a','r','Z','bg'],[1,2,4,3]))
z = {'bg':3,'Z':4,'a':1,'r':2}
assert x==y
assert x==z
assert y==z
assert x['a']==1
assert x.get('a')==1
assert x.get('uio... | Hasimir/brython | www/tests/test_dict.py | Python | bsd-3-clause | 1,429 |
#! /usr/bin/env python
#! coding:utf-8
'''
Created on 2014/9/15
@author: hahaya
'''
from setuptools import setup
from hgsf import version
setup(
name = 'hgsf',
version = version.RELEASE_VERSION,
author = 'hahaya',
author_email = 'hahayacoder@gmail.com',... | hahaya/hgsf | setup.py | Python | apache-2.0 | 681 |
from hendrix.deploy.base import HendrixDeploy
from hendrix.experience import hey_joe
deployer = HendrixDeploy(options={'wsgi': 'example_app.wsgi.application', 'http_port': 7575})
websocket_service = hey_joe.WebSocketService("127.0.0.1", 9000)
deployer.add_non_tls_websocket_service(websocket_service)
deployer.run()
| jMyles/hendrix | examples/django_hx_chatserver/example_app/run.py | Python | mit | 320 |
# walk through all the permit files and combine into one csv
# run from same directory that contains /data/
import os
import csv
count = 0
fieldnames = []
with open("master_permit_data.csv", 'w') as outfile:
for root, dirs, files in os.walk('.'):
for name in files:
if ('master' not in name)... | open-austin/construction-permits | data-processing/create-master-table.py | Python | unlicense | 849 |
class Package:
def __init__(self, name, **kwargs):
state = kwargs.get("state", "latest")
pass
def apt_get(self):
pass
def yum(self):
pass
def plan(self):
pass
def apply(self):
pass
class Packages:
def __init__(self, *args):
self.packa... | meantheory/dotfiles | dos/src/dos/pkg/base.py | Python | mit | 584 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chart_axis23.py | Python | bsd-2-clause | 1,661 |
# Copyright 2015 Google 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 applicable law or a... | DeepThoughtTeam/tensorflow | tensorflow/python/kernel_tests/scatter_ops_test.py | Python | apache-2.0 | 2,727 |
'''
Kurgan AI Web Application Security Analyzer.
http://www.kurgan.com.br/
Author: Glaudson Ocampos - <glaudson@vortexai.com.br>
Created in May, 11th 2016.
'''
import db.db as db
import config as cf
class WebServer(object):
banner = None
os = None
server = None
framework = None
version = None
... | glaudsonml/kurgan-ai | libs/WebServer.py | Python | apache-2.0 | 3,716 |
# Unmodified from http://code.activestate.com/recipes/576693/
# other than to add MIT license header (as specified on page, but not in code).
# Linked from Python documentation here:
# http://docs.python.org/2/library/collections.html#collections.OrderedDict
#
# This should be deleted once Py2.7 is available on all bot... | pyokagan/gyp | pylib/gyp/ordered_dict.py | Python | bsd-3-clause | 10,338 |
import re
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy.sql.sqltypes import DateTime
from alembic import autogenerate
from alembic.migration import MigrationContext
from alembic.testing import eq_... | sqlalchemy/alembic | tests/test_autogen_composition.py | Python | mit | 16,541 |
# -*- coding: UTF-8 -*-
## Copyright 2011 Luc Saffre
## This file is part of the Lino project.
## Lino 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) ... | MaxTyutyunnikov/lino | lino/management/commands/makedocs.py | Python | gpl-3.0 | 9,370 |
# pyodbc
import pyodbc
# look for pyodbc providers
sources = pyodbc.dataSources()
dsns = list(sources.keys())
sl = [' %s [%s]' % (dsn, sources[dsn]) for dsn in dsns]
print("pyodbc Providers: (beware 32/64 bit driver and python version must match)\n", '\n'.join(sl))
# odbc to EXCEL .xls via pyodbc (beware 32/64 bi... | winpython/winpython_afterdoc | docs/test_data_access.py | Python | mit | 5,298 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2013, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... | chippey/gaffer | python/GafferRenderMan/__init__.py | Python | bsd-3-clause | 2,499 |
x = int(input())
y = int(input())
z = int(input())
ans = 0
if x % 2 != 0 and x > ans:
ans = x
if y % 2 != 0 and y > ans:
ans = y
if z % 2 != 0 and z > ans:
ans = z
if ans != 0:
print(ans)
else:
print('no positive odd numbers')
| knuu/Introduction_to_Computing_and_Programming_Using_Python | ch02/ex2-2.py | Python | mit | 250 |
# Copyright (C) 2008 Canonical Ltd
#
# 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 distributed in ... | Distrotech/bzr | bzrlib/tests/test_filters.py | Python | gpl-2.0 | 5,891 |
#!/usr/bin/env python
#
# Import CVS history into git
#
# Intended to be a near-workalike of Matthias Urlichs's Perl implementation.
#
# By Eric S. Raymond <esr@thyrsus.com>, December 2012
# May be redistributed under the license of the git project.
import sys
if sys.hexversion < 0x02060000:
sys.stderr.write("git... | mirror/cvsps | git-cvsimport.py | Python | gpl-2.0 | 17,145 |
from bs4 import BeautifulSoup
import requests
import nltk
import itertools
import hunspell
hobj = hunspell.HunSpell('en_US.dic', 'en_US.aff')
domain_terms = set()
# english_vocab = set(w.lower() for w in nltk.corpus.words.words())
def extract_tags(url, tag):
soup = BeautifulSoup(requests.get(url).text, "html.par... | liantze/domain_wordlists | do_linguistics.py | Python | gpl-3.0 | 1,255 |
# ===============================================================================
# Copyright 2012 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... | USGSDenverPychron/pychron | pychron/core/stats/core.py | Python | apache-2.0 | 3,844 |
# Copyright (c) 2018 PaddlePaddle 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 app... | PaddlePaddle/cloud | python/paddlecloud/paddlejob/specs/spec_master.py | Python | apache-2.0 | 3,271 |
from setuptools import setup, find_packages
tests_require = [
'mock',
'requests'
]
setup(
name='org.bccvl.tasks',
setup_requires=['setuptools_scm'],
use_scm_version=True,
description="BCCVL Tasks",
# long_description=open("README.txt").read() + "\n" +
# open(os.path.j... | BCCVL/org.bccvl.tasks | setup.py | Python | gpl-2.0 | 1,489 |
import pathlib # noqa: F401
import typing as t
from configparser import ConfigParser
def load_ini_from_filepath(filepath: t.Union[str, "pathlib.Path"]) -> dict:
config = ConfigParser()
config.read(filepath)
return {name: dict(section) for name, section in config.items()}
| lhaze/dharma | pca/utils/serialization/ini.py | Python | mit | 288 |
# ----------------------------------------------------------------------------
# Copyright (c) 2017-, labman development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------... | josenavas/labman | labman/db/configuration_manager.py | Python | bsd-3-clause | 5,785 |
# Copyright 2011 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | changsimon/trove | trove/db/sqlalchemy/session.py | Python | apache-2.0 | 3,759 |
# -*- coding: utf-8 -*-
# Part of bubble. See LICENSE file for full copyright and licensing details.
import arrow
import click
import importlib
import sys
import os
import six
from .store import put_file, get_file, get_file_name
from .delta import make_uniq, get_newest_uniq, get_uniq_list
from .dataset import lod_dum... | realopenit/bubble | bubble/util/cli_misc.py | Python | gpl-3.0 | 12,157 |
from .base import DerivedType
from categorical import CategoricalComparator
from .categorical_type import CategoricalType
from dedupe import predicates
import warnings
class ExistsType(CategoricalType) :
type = "Exists"
_predicate_functions = []
def __init__(self, definition) :
super(CategoricalT... | neozhangthe1/dedupe | dedupe/variables/exists.py | Python | mit | 1,390 |
#!/usr/bin/env python
# encoding: utf-8
# Copyright 2014 Xinyu, He <legendmohe@foxmail.com>
#
# 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
... | fangjing828/LEHome | util/thread.py | Python | apache-2.0 | 1,935 |
from django.core.management.base import BaseCommand, CommandError
from polls.models import Poll
from optparse import make_option
class Command(BaseCommand):
args = '<poll_id poll_id ...>'
help = 'Close the specified polls for vote'
option_list = BaseCommand.option_list + (
make_option('--delete',
... | JonasAZou/hellodjango | hello/polls/management/commands/closepoll.py | Python | mit | 1,023 |
import asyncio
import inspect
import warnings
from asgiref.sync import sync_to_async
class RemovedInDjango41Warning(DeprecationWarning):
pass
class RemovedInDjango50Warning(PendingDeprecationWarning):
pass
RemovedInNextVersionWarning = RemovedInDjango41Warning
class warn_about_renamed_method:
def _... | elena/django | django/utils/deprecation.py | Python | bsd-3-clause | 4,818 |
#!/usr/bin/env python
class Solution:
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
i, j = 0, len(height)-1
l, r = height[i], height[j]
maxArea = (j - i) * min(l, r)
while j > i:
if l < r:
while hei... | eroicaleo/LearningPython | interview/leet/011_Container_With_Most_Water.py | Python | mit | 845 |
# Copyright 2015, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.com>
#
# 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 requi... | tomfotherby/tower-cli | lib/tower_cli/utils/__init__.py | Python | apache-2.0 | 1,163 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jbedorf/tensorflow | tensorflow/python/summary/summary.py | Python | apache-2.0 | 17,400 |
#
# Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com
#
# This file is part of EigenD.
#
# EigenD 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) a... | barnone/EigenD | pi/constraints.py | Python | gpl-3.0 | 19,669 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dataproc | samples/generated_samples/dataproc_v1_generated_workflow_template_service_list_workflow_templates_sync.py | Python | apache-2.0 | 1,570 |
from gwv.dump import Dump
import unittest
from gwv import validator
from gwv import validators
class TestValidator(unittest.TestCase):
def test_validateEmpty(self):
timestamp = 334.0
expected_output = {
name: {
"timestamp": timestamp,
"result": {}
... | kurgm/gwv | tests/test_validator.py | Python | mit | 636 |
"""
Test Result
-----------
Provides a TextTestResult that extends unittest._TextTestResult to
provide support for error classes (such as the builtin skip and
deprecated classes), and hooks for plugins to take over or extend
reporting.
"""
import logging
from unittest import _TextTestResult
from nose.config import Co... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/nose-0.10.1-py2.5.egg/nose/result.py | Python | bsd-3-clause | 5,383 |
from djoser.compat import get_user_email, get_user_email_field_name
from djoser.email import ActivationEmail, PasswordResetEmail
def send_activation_email(user, request):
to = [get_user_email(user)]
ActivationEmail(request, {'user': user}).send(to)
def send_password_reset_email(user, request):
to = [get... | creimers/graphene-auth-examples | src/apps/account/utils.py | Python | mit | 396 |
from builtins import zip
import sys
sys.path.insert(1,"../../")
import h2o, inspect
from tests import pyunit_utils
def check_strict():
args, varargs, keywords, defaults = inspect.getargspec(h2o.init)
assert dict(list(zip(args[-len(defaults):], defaults)))['strict_version_check'], "strict version checking got turn... | YzPaul3/h2o-3 | h2o-py/tests/testdir_misc/pyunit_check_strict.py | Python | apache-2.0 | 455 |
# -*- coding: utf-8 -*-
import aiwar
import random
import logging
import logging.handlers
import math
logger = logging.getLogger('test')
hdlr = logging.handlers.RotatingFileHandler('./AIWar_GuiGui.log', mode='a', maxBytes=1000000, backupCount=2, encoding=None, delay=0)
logger.addHandler(hdlr)
logger.setLevel(logging.... | merovingien/AIWar | players_example/AIWar_GuiGui_06.py | Python | gpl-3.0 | 93,312 |
# Copyright 2014 Baidu, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | baidubce/bce-sdk-python | baidubce/services/tsdb/tsdb_client.py | Python | apache-2.0 | 9,136 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-02-07 17:05:11
import os
import time
import Queue
import logging
from task_queue import TaskQueue
from libs import counter
logger = logging.getLogger... | 1900/pyspider | scheduler/scheduler.py | Python | apache-2.0 | 15,463 |
#-*- coding: utf-8 -*-
import urllib,re,string,sys,os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
#Mash Up - by Mash2k3 2012.
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
art = main.art
prettyName = 'Catiii.tv'
def MAIN():
main.addDir('Search','extra... | marduk191/plugin.video.movie25 | resources/libs/international/catiii.py | Python | gpl-3.0 | 6,801 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.