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 -*-
def uri(num = 100):
for i in range(1, int(num) + 1):
if i % 2 == 0:
print(i)
if __name__ == '__main__':
uri() | gustavolcorreia/uri | iniciante/exerc1059.py | Python | apache-2.0 | 171 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | opinkerfi/check_mk | doc/treasures/check_bi_local.py | Python | gpl-2.0 | 3,129 |
from typing import Any, Callable, Dict, Optional
import tensorflow as tf
from tensorflow.keras.losses import Loss
from tensorflow_similarity.types import FloatTensor
@tf.keras.utils.register_keras_serializable(package="Similarity")
class Barlow(Loss):
"""Barlow Loss"""
def __init__(self,
l... | tensorflow/similarity | tensorflow_similarity/losses/barlow.py | Python | apache-2.0 | 2,344 |
def resolve(args, frame):
if len(args) == 1:
angular_speed = args[0]
if type(angular_speed) not in (int, float):
raise TypeError("Wrong type argument : angular_speed")
else:
raise Exception("Wrong number of arguments")
result = '_y_spt_afterframes {} "_y_spt_pitchspeed {}"'.format(frame, angular_speed)
ret... | Dicatoro/YACLWiN | modules/setyanglespeed.py | Python | gpl-3.0 | 337 |
import unittest
import pickle
from urllib3.exceptions import (HTTPError, MaxRetryError, LocationParseError,
ClosedPoolError, EmptyPoolError,
HostChangedError, ReadTimeoutError,
ConnectTimeoutError, HeaderParsingError)
from ... | Lukasa/urllib3 | test/test_exceptions.py | Python | mit | 1,843 |
from PyQt4.QtGui import QListWidget, QListWidgetItem
__author__ = 'mouton'
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QAbstractItemView, QMessageBox
from gui.EditorItem import ViewWidget
class ViewsManagerWidget(QListWidget):
def __init__(self, parent=None, propertiesEditor=None, mainWindow=None, node... | mouton5000/DiscreteEventApplicationEditor | gui/ScenesManagerItems.py | Python | mit | 3,506 |
"""
This is the boilerplate default configuration file.
Changes and additions to settings should be done in the config module
located in the application root rather than this config.
"""
config = {
# webapp2 sessions
'webapp2_extras.sessions' : {'secret_key': 'Force_be_with'},
# webapp2 authentication
'webapp2_extras... | LuckDragon82/demo | config/localhost.py | Python | lgpl-3.0 | 4,151 |
##############################################################################################
# Copyright 2014-2015 Cloud Media Sdn. Bhd.
#
# This file is part of Xuan Application Development SDK.
#
# Xuan Application Development SDK is free software: you can redistribute it and/or modify
# it under the terms of... | TheStackBox/xuansdk | SDKLibrary/com/cloudMedia/theKuroBox/sdk/deviceController/sensorDeviceController.py | Python | gpl-3.0 | 3,123 |
"""
Support for Xiaomi Yeelight Wifi color bulb.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.yeelight/
"""
import logging
import colorsys
from typing import Tuple
import voluptuous as vol
from homeassistant.util.color import (
color_temper... | ct-23/home-assistant | homeassistant/components/light/yeelight.py | Python | apache-2.0 | 15,296 |
from setuptools import setup
APP = ['gui.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'includes': ['sip', 'PyQt4','gpg','gui']}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
| Lightjohn/gpgProtector | setup.py | Python | mit | 239 |
# coding: utf-8
import io
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.encoding import smart_text
from rest_framework.negotiation import DefaultContentNegotiation
from rest_framework.renderers import BaseRenderer
from rest_framework.renderers import TemplateHTMLRenderer
from rest_framework.r... | kobotoolbox/kobocat | onadata/libs/renderers/renderers.py | Python | bsd-2-clause | 4,636 |
import nltk
import pickle
import argparse
from collections import Counter
from pycocotools.coco import COCO
class Vocabulary(object):
"""Simple vocabulary wrapper."""
def __init__(self):
self.word2idx = {}
self.idx2word = {}
self.idx = 0
def add_word(self, word):
if not wo... | yunjey/pytorch-tutorial | tutorials/03-advanced/image_captioning/build_vocab.py | Python | mit | 2,459 |
#!/usr/bin/env python3
"""
Pipe informations to lemonboy's bar
"""
from os import path
from setuptools import setup
here = path.abspath(path.dirname(__file__))
setup(
name="barython",
version="0.0.1",
description="Pipe informations to lemonboy's bar",
url="https://github.com/Anthony25/barython",
... | Anthony25/barython | setup.py | Python | bsd-3-clause | 841 |
#!/usr/bin/env python
#coding=gb2312
from downloader import *
logger.addHandler(console)
console.setLevel(logging.DEBUG)
#################### Get query screen ###########33
def getqscr(tn):
read_all(tn,TIMEOUT_0)
pu = re.compile(".+\\x1b\[2;\d+H",re.S) #user query page
pb = re.compile(".+\\x1b\[\d+;2H") ... | newsun/newsmth | query_user.py | Python | apache-2.0 | 4,348 |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import encode as der_encoder
... | etingof/pyasn1-modules | tests/test_rfc7914.py | Python | bsd-2-clause | 3,206 |
# Copyright 2004-2015 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... | joxer/Baka-No-Voltron | tmp/android.dist/private/renpy/display/movetransition.py | Python | gpl-2.0 | 20,082 |
import os
import sys
if sys.version_info[:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
from avocado.utils import process
basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')
basedir = os.path.abspath(basedir)
class StandaloneTests(unittest.TestCase):
def ... | Hao-Liu/avocado | selftests/functional/test_standalone.py | Python | gpl-2.0 | 2,525 |
# Copyright 2013: Mirantis 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 b... | gluke77/rally | rally/osclients.py | Python | apache-2.0 | 32,680 |
""" Module for the integration of the TUM structural clustering algorithm
author: Tobias Girschick; tobias.girschick@in.tum.de
TUM - I12 (wwwkramer.in.tum.de/girschic)
dependencies: gSpan, java
Please cite the following article if you use the structural clustering procedure or results produced with it in any p... | JonnaStalring/AZOrange | azorange/AZutilities/structuralClustering.py | Python | lgpl-3.0 | 4,151 |
# Unit tests for the boundary shape class and the boundary sphere class.
import unittest
import numpy as N
from tracer.spatial_geometry import generate_transform, rotx
from tracer.boundary_shape import *
class TestInBounds(unittest.TestCase):
def setUp(self):
self.points = N.array([
[0.,0.,0.... | yosefm/tracer | tests/test_boundary_surface.py | Python | gpl-3.0 | 4,024 |
# -*- coding: UTF-8 -*-
# =============================================================================
# Copyright (C) 2012 Brad Hards <bradh@frogmouth.net>
#
# Based on wms.py, which has the following copyright statement:
# Copyright (c) 2004, 2006 Sean C. Gillies
# Copyright (c) 2005 Nuxeo SARL <http://nuxeo.com>
#
... | Jenselme/OWSLib | owslib/wmts.py | Python | bsd-3-clause | 31,462 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
from opus_core.simulation_state import SimulationState
from numpy import maximum, ma, logical_... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/gridcell/building_age_masked.py | Python | gpl-2.0 | 2,316 |
# Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... | matthiaskramm/corepy | corepy/arch/spu/lib/util.py | Python | bsd-3-clause | 6,974 |
"""Tests of monomial orderings. """
from sympy.polys.orderings import (
monomial_key, lex, grlex, grevlex, ilex, igrlex, igrevlex,
LexOrder, InverseOrder, ProductOrder, build_product_order,
)
from sympy.abc import x, y, z, t
from sympy.core import S
from sympy.utilities.pytest import raises
def test_lex_orde... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/polys/tests/test_orderings.py | Python | mit | 4,262 |
'''
CORE WINDOW
================
it's a core window use in globally needed, in this module provide standard,
variable, object and anything the window needed.
:package : core stigma
'''
from kivy.config import Config
class _CWindows(object):
'''
this is windows base class, is used for inheritance for... | Kzulfazriawan/stigma-game-demo | core/window.py | Python | mit | 1,062 |
"""
[2015-04-27] Challenge #212 [Easy] Rövarspråket
https://www.reddit.com/r/dailyprogrammer/comments/341c03/20150427_challenge_212_easy_rövarspråket/
# Description
When we Swedes are young, we are taught a SUPER-SECRET language that only kids know, so we can hide secrets from our
confused parents. This language is k... | DayGitH/Python-Challenges | DailyProgrammer/DP20150427A.py | Python | mit | 3,445 |
from django.conf import settings
from samaritan import DEFAULT_USER_MODEL
USER_MODEL_NAME = getattr(settings, 'USER_MODEL', DEFAULT_USER_MODEL)
| benslavin/django-samaritan | samaritan/utils.py | Python | bsd-3-clause | 145 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | tkaitchuck/nupic | examples/opf/experiments/multistep/hotgym_best_tp_5step/description.py | Python | gpl-3.0 | 3,192 |
import re
def isPalindrome(file):
infile = open(file, 'r')
lines = infile.readlines()
num_lines = int(lines[0])
total_string = "";
for line in lines[1: (num_lines+1)]:
total_string += line
total_string = re.sub('[^a-zA-Z0-9]', '', total_string)
total_string = total_string.lower()... | JonShepChen/DailyProgrammerChallenges | challenges/232-Palindromes.py | Python | mit | 488 |
import string
import unittest
from yyproto.dict import Dict
from yyproto.list import List
from yyproto.packer import Packer
from yyproto.set import Set
class TestPacker(unittest.TestCase):
def test_integer(self):
buf = bytearray(1024)
packer = Packer(buf)
packer.pack_integer('b', 42)
... | decimalbell/yyproto | python/yyproto/tests/test_packer.py | Python | bsd-3-clause | 5,419 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_secure_score_control_definitions_operations.py | Python | mit | 8,156 |
import time
import smbus
import Adafruit_DHT
# Change to 0 if using pi with 256MB
i2c_bus = smbus.SMBus(1)
class AbstractSensor():
def __init__(self):
self.last_failure = 0
self.last_success = 0
def read(self):
raise('Abstract')
class DHTSensor(AbstractSensor):
def __init__(s... | jdupl/iot-greenhouse-ctrl | sensors.py | Python | gpl-3.0 | 1,502 |
from sys import maxint
class BellmanFord( object ):
def __init__( self ):
'''
Constructor
'''
def singleSourceShortestPath( self, weight, source ) :
# auxiliary constants
SIZE = len( weight )
EVE = -1; # to indicate no predecessor
INFINITY = maxint
# declare and initializ... | salman-bhai/DS-Algo-Handbook | Algorithms/Graph_Algorithms/Bellman_Ford/bellman_ford.py | Python | mit | 1,400 |
#!/usr/bin/python
#-*-coding:utf-8-*-
import redis
class DupFilter:
dup_key_taobao = 'dupefilter_t'
REDIS_HOST = 'youhost'
REDIS_PORT = 6379
"""Redis-based request duplication filter"""
# def __init__(self, server, key):
# """Initialize duplication filter
#
# Param... | muzixinly/matrix | matrix/store/redis.py | Python | gpl-2.0 | 1,425 |
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | andrei4ka/fuel-web-redhat | fuel_agent/fuel_agent/tests/test_partition_utils.py | Python | apache-2.0 | 11,339 |
# -*- coding: utf-8 -*-
###############################################################################
#
# DeleteWalk
# Deletes a given walk action.
#
# 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 file except ... | jordanemedlock/psychtruths | temboo/core/Library/Facebook/Actions/Fitness/Walks/DeleteWalk.py | Python | apache-2.0 | 3,181 |
#!/usr//bin/python3
import wiringpi2 as wiringpi
from time import sleep
wiringpi.wiringPiSetupGpio
pin = 17
wiringpi.pinMode(pin, 1)
while True:
wiringpi.digitalWrite(pin, 0)
sleep(0.5)
wiringpi.digitalWrite(pin, 1)
sleep(0.5)
| citizensense/csk | libraries/windspeed.py | Python | gpl-3.0 | 245 |
import operator
from functools import reduce
from database import db
def generic_aggregator(attribute, flatten=False, is_callable=False):
def aggregator(self, data_filter=lambda x: x):
data = data_filter(self.data)
aggregated = [
getattr(datum, attribute)(data_filter) if is_callable ... | reimandlab/Visualistion-Framework-for-Genome-Mutations | website/helpers/models.py | Python | lgpl-2.1 | 1,911 |
"""SCons.Tool.aixcc
Tool-specific initialization for IBM xlc / Visual Age C compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any... | timj/scons | src/engine/SCons/Tool/aixcc.py | Python | mit | 2,228 |
#!/usr/bin/python3
import sys
import os
pwd = os.getcwd()
if not sys.argv[1:]:
print("Give me at least 1 file")
else:
for dir in sys.argv[1:]:
dirPath = pwd + "/" + dir
if os.path.exists(dirPath) and os.path.isfile(dirPath):
with open(str(dir), "r") as file:
print(f... | lesina/labs2016 | Laba09/exercise03.py | Python | gpl-3.0 | 417 |
# Copyright 2019 The Kubeflow Authors
#
# 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... | kubeflow/pipelines | sdk/python/kfp/deprecated/azure.py | Python | apache-2.0 | 2,272 |
from django.conf import settings
from .site_parser import SiteParser, SiteSettingsParser
class SiteManager(object):
def __new__(cls, *args, **kwargs):
return super(SiteManager, cls).__new__(cls)
def __init__(self, url=settings.MYTARDIS_SITES_URL):
self.url = url
try:
sel... | iiman/mytardis | tardis/apps/sync/site_manager.py | Python | bsd-3-clause | 1,434 |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'Dean'
| qicfan/lightfile | file.py | Python | gpl-2.0 | 57 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Search tools
refactor in progress, don't commit to common until done
svns pre commit hook should stop me from commiting this file!
"""
import config, connection
from itertools import imap
def iterblocks(iterable, size, **kwds):
"""
http://code.activest... | mdomans/insol | insol/tools.py | Python | apache-2.0 | 2,970 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Author: Thomas Beucher
Module: Experiments
Description: Class used to generate all the trajectories of the experimental setup and also used for CMAES optimization
'''
import numpy as np
import time
#from Utils.ThetaNormalization import normalization, unNormalization... | osigaud/ArmModelPython | Control/Experiments/Experiments.py | Python | gpl-2.0 | 14,422 |
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge... | stonekyx/binary | vendor/scons-local-2.3.4/SCons/Tool/MSCommon/common.py | Python | gpl-3.0 | 9,169 |
"""The Airly component."""
import asyncio
from datetime import timedelta
import logging
from math import ceil
from aiohttp.client_exceptions import ClientConnectorError
from airly import Airly
from airly.exceptions import AirlyError
import async_timeout
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CON... | tchellomello/home-assistant | homeassistant/components/airly/__init__.py | Python | apache-2.0 | 4,810 |
# Copyright 2015 Cloudbase Solutions SRL
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | openstack/networking-hyperv | networking_hyperv/tests/unit/neutron/test_mech_hyperv.py | Python | apache-2.0 | 2,652 |
from pymt import *
# callback for the buttons
def test_button(btn, *largs):
print 'button pressed', btn.label
# create a grid layout with 2 rows
layout = MTGridLayout(rows=2)
for x in xrange(22):
btn = MTToggleButton(label='label%d' % x)
btn.connect('on_press', curry(test_button, btn))
layout.add_widg... | nuigroup/pymt-widgets | examples/framework/ui_widgets_list.py | Python | lgpl-3.0 | 562 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/rogerthat/bizz/job/unschedule_service_api_callback_records.py | Python | apache-2.0 | 1,183 |
#!/usr/bin/env python
#
# Copyright 2015-2020 Blizzard Entertainment. Subject to the MIT license.
# See the included LICENSE file for more information.
#
from heroprotocol.decoders import *
import six
# Decoding instructions for each protocol type.
typeinfos = [
('_int',[(0,7)]), #0
('_int',[(0,4)]), #1
... | Blizzard/heroprotocol | heroprotocol/versions/protocol68406.py | Python | mit | 26,730 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pppcemr', '0014_auto_20151001_1108'),
]
operations = [
migrations.CreateModel(
name='EncounterType',
... | sstebbins/pppcpro | pppcemr/migrations/0015_auto_20151001_1549.py | Python | agpl-3.0 | 970 |
# -*- coding: utf-8 -*-
import os
from pysignfe.nfe.manual_500 import consrecinfe_310
from pysignfe.nfe.manual_600 import ESQUEMA_ATUAL
from pysignfe.xml_sped import *
from pysignfe.nfe.manual_600.nfe_310 import NFe
DIRNAME = os.path.dirname(__file__)
class ConsReciNFe(consrecinfe_310.ConsReciNFe):
def __init__(... | thiagopena/PySIGNFe | pysignfe/nfe/manual_600/consrecinfe_310.py | Python | lgpl-2.1 | 5,380 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 0, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingAverage/cycle_0/ar_12/test_artificial_32_RelativeDifference_MovingAverage_0_12_0.py | Python | bsd-3-clause | 276 |
import asyncio
import os
import codecs
import time
import cloudbot
from cloudbot import hook
from cloudbot.event import EventType
# +---------+
# | Formats |
# +---------+
from cloudbot.util.formatting import strip_colors
base_formats = {
EventType.message: "[{server}:{channel}] <{nick}> {content}",
EventTy... | jkramarz/zuombot | plugins/log.py | Python | gpl-3.0 | 8,130 |
import numpy as np
from matplotlib import image as img
import requests
from StringIO import StringIO
class Map(object):
def __init__(self, lat, long, satellite=True,zoom=10, size=(400,400), sensor=False):
base="http://maps.googleapis.com/maps/api/staticmap?"
params=dict(
sensor= str(sensor).lower(),
zoom= ... | ernestwcl/greengraph | greengraph/map.py | Python | apache-2.0 | 1,314 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-21 14:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('loans', '0006_auto_20160721_1640'),
]
operations = [
migrations.AddField(
... | lubegamark/senkumba | loans/migrations/0007_loan_compound.py | Python | mit | 524 |
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# Copyright 2017 IBM RESEARCH. 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/licen... | atilag/qiskit-sdk-py | qiskit/extensions/qasm_simulator_cpp/snapshot.py | Python | apache-2.0 | 2,505 |
from django.forms import CharField, ValidationError
from django.forms.fields import EMPTY_VALUES
import re, string
class TinyMCEField(CharField):
def clean(self, value):
"Validates max_length and min_length. Returns a Unicode object."
if value in EMPTY_VALUES:
return u''
... | saebyn/django-classifieds | classifieds/forms/fields.py | Python | bsd-3-clause | 1,278 |
# testing/util.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
import decimal
import gc
import random
import sys
import types
from . import confi... | zzzeek/sqlalchemy | lib/sqlalchemy/testing/util.py | Python | mit | 12,503 |
# -*- coding: utf-8 -*-
#
# Read the Docs Template documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 26 14:19:49 2014.
#
# 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
# autogenera... | DigitalSkills-fr/Docs | docs/conf.py | Python | apache-2.0 | 8,474 |
# 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 ... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py | Python | bsd-3-clause | 29,255 |
# Copyright 2013-2020 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 XcbUtilXrm(AutotoolsPackage):
"""XCB util-xrm module provides the 'xrm' library, i.e. uti... | rspavel/spack | var/spack/repos/builtin/packages/xcb-util-xrm/package.py | Python | lgpl-2.1 | 886 |
from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from markdown import markdown
import bleach
from flask import current_app, request, url_for, Markup
from flask.ext.login import Us... | VincentFF/personal-blog | app/models.py | Python | mit | 13,862 |
# -*- 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-datacatalog | samples/generated_samples/datacatalog_v1beta1_generated_data_catalog_create_tag_async.py | Python | apache-2.0 | 1,604 |
import pytest
import time
import requests as req
from support.constants import request_detail, launch_detail, workitem_constants, dynamic_vars
import support.helpers as helpers
start_time = time.time()
local_run = False
class TestClass_SetupGettingStarted(object):
def test_setup_gettingStarted(self, sut, offline... | ldimaggi/fabric8-test | EE_API_automation/pytest/src/test_getting_started.py | Python | apache-2.0 | 3,767 |
"""
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Module to hold helper classes and functions to determine run-time test IP
information. Currently,
"""
import flogging
import ipaddress
import netifaces
import socket
import fit_common
logs = flogging.get_loggers()
class TestHostInterfacer(objec... | johren/RackHD | test/common/env_ip_helpers.py | Python | apache-2.0 | 5,200 |
import os
from time import time
from sklearn.externals import joblib
from sklearn import tree
from preprocessData import getDataXY
trainX, trainY, testX, testY, validX, validY = getDataXY()
# print len(trainX), len(trainY), len(testX), len(testY), len(validX), len(validY)
X = trainX
y = trainY
# clf = SGDClassifier(l... | TheaGao/SklearnModel | DecisionTree.py | Python | mit | 978 |
# -*- coding: utf-8 -*-
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
]
intersphinx_mapping = {
'pyexcel': ('http://pyexcel.readthedocs.org/en/latest/', None)
}
spelling_word_list_filename = 'spelling_wordlist.txt'
templates_path = ['_te... | fondelsur/todopinturas | doc/source/conf.py | Python | bsd-3-clause | 1,177 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='calc',
version='0.0',
packages=find_packages(),
scripts=['scripts/calc'])
| ewtoombs/python-calc | setup.py | Python | mit | 187 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('restaurant', '0020_cuisine_menu'),
]
operations = [
migrations.AlterField(
model_name='cuisine',
nam... | gauravbose/digital-menu | digimenu2/restaurant/migrations/0021_auto_20150704_1154.py | Python | bsd-3-clause | 424 |
# coding=utf-8
# имена девушек генерируются из списков имен (тип девушки_first) и фамилий (тип девушки_last). Если списка фамилий
# нет - генерируется только из списка имен.
girls_names = {
'peasant_first': [
u'Жанна', u'Герда', u'Баббета', u'Cюзи', u'Альба', u'Амели', u'Аннета', u'Жоржетта', u'Бетти',
... | OldHuntsman/DefilerWings | game/pythoncode/girls_data.py | Python | bsd-3-clause | 58,860 |
"""
Documentation
-------------
Documentation is done with `Sphinx <http://sphinx.pocoo.org/>`_
and some helper functions coming with the software for more customization.
The folder that contains all the documentation is called ``docs``.
To compile, you first have to install Sphinx 1.1 or a better version and
pySPACE ... | pyspace/pyspace | docs/__init__.py | Python | bsd-3-clause | 796 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | taigaio/taiga-contrib-gitlab-auth | back/tests/unit/test_connectors_gitlab.py | Python | agpl-3.0 | 6,904 |
# Copyright 2014-2015 University of Chicago
#
# 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 ... | globus/globus-release-tools | share/python/repo/__init__.py | Python | apache-2.0 | 17,563 |
# -*- coding: utf-8 -*-
# Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
# This library 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 Fo... | savoirfairelinux/num2words | tests/test_currency.py | Python | lgpl-2.1 | 3,103 |
import pytest
import numpy as np
import pandas as pd
import networkx as nx
from neuprint import Client, default_client, set_default_client
from neuprint import (fetch_skeleton, heal_skeleton, reorient_skeleton, skeleton_df_to_nx, skeleton_df_to_swc, skeleton_swc_to_df)
from neuprint.tests import NEUPRINT_SERVER, DATA... | connectome-neuprint/neuprint-python | neuprint/tests/test_skeleton.py | Python | bsd-3-clause | 4,220 |
"""Tests for cement.ext.ext_reload_config."""
import platform
from cement.utils import test
system = platform.system()
if not system in ['Linux']:
raise test.SkipTest('ext_reload_config not supported on %s' % system)
import os
import shutil
import signal
from time import sleep
from cement.utils.misc import rando... | akhilman/cement | tests/ext/reload_config_tests.py | Python | bsd-3-clause | 2,223 |
import asyncio
import copy
import json
import math
import os
import pickle
import re
import sys
import time
from datetime import datetime
from functools import partial
from pprint import pformat
import aiocron
import biothings.utils.mongo as mongo
from biothings import config as btconfig
from biothings.hub import BUI... | biothings/biothings.api | biothings/hub/databuild/builder.py | Python | apache-2.0 | 74,414 |
"""Unit tests for the ``tables`` module.
Each test case in this module tests a single table. For example, the
``CampaignTableTestCase`` tests just the ``CampaignTable`` table.
"""
from django.test import TestCase
from gurps_manager import factories, models, tables
# pylint: disable=E1101
# Class 'FooForm' has no 'cr... | Ichimonji10/gurps-manager | apps/gurps_manager/test_tables.py | Python | gpl-3.0 | 5,019 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import unittest
from satellite_sanity_lib.rules import sat6_task_pending
class TestSat6TaskPending(unittest.TestCase):
def test_match(self):
input_data = {}
input_data['hammer_task_list_paused_pending'] = \
"""Id,Name,Owner,Started at,Ended at,State,Result,... | RedHatSatellite/satellite-sanity | satellite_sanity_lib/rules/tests/test_sat6_task_pending.py | Python | gpl-3.0 | 1,420 |
a=1
def f():
a=2
def g():
print a
return g
func=f()
func()
| wonghoifung/learning-python | python_yuanmapouxi/C.py | Python | mit | 65 |
import json
from kraken.core.maths import *
mat33 = Euler().toMat33()
print "mat33:" + str(mat33)
print "clone:" + str(mat33.clone())
otherMat33 = Mat33()
otherMat33.row0 = Vec3(0, 1, 0)
print "equal:" + str(mat33 == otherMat33)
print "not equal:" + str(mat33 != otherMat33)
print "add:" + str(mat33 + otherMat33)
... | goshow-jp/Kraken | tests/MathTests/mat33.py | Python | bsd-3-clause | 408 |
# -*- coding: utf-8 -*-
class Solution:
# @param m, an integer
# @param n, an integer
# @return an integer
def rangeBitwiseAnd(self, m, n):
offset = 0
while m!=n:
m = m >> 1
n = n >> 1
offset = offset + 1
return m<<offset
| AtlantisFox/Green-Point-Challenge | leetcode/Bitwise_AND_of_Numbers_Range.py | Python | mit | 299 |
"""
This page is in the table of contents.
Cleave is a script to cleave a shape into svg slice layers.
==Settings==
===Add Layer Template to SVG===
Default is on.
When selected, the layer template will be added to the svg output, which adds javascript control boxes. So 'Add Layer Template to SVG' should be selected ... | natetrue/ReplicatorG | skein_engines/skeinforge-31/skeinforge_application/skeinforge_plugins/craft_plugins/cleave.py | Python | gpl-2.0 | 9,814 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-23 16:52
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookings', '0004_auto_20170523_1637'),
]
operations =... | BdEINSALyon/resa | bookings/migrations/0005_auto_20170523_1652.py | Python | gpl-3.0 | 1,255 |
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy_utils import get_columns
class TestGetColumns(object):
def setup_method(self, method):
Base = declarative_base()
class Building(Base):
__tablename__ = 'building'
id = sa.Column... | rmoorman/sqlalchemy-utils | tests/functions/test_get_columns.py | Python | bsd-3-clause | 1,915 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 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... | armando-migliaccio/neutron | neutron/db/migration/alembic_migrations/versions/1c33fa3cd1a1_extra_route_config.py | Python | apache-2.0 | 2,289 |
from twisted.trial import unittest
from opennsa import nsa
class LabelTest(unittest.TestCase):
def testLabelParsing(self):
self.assertEquals(nsa.Label('', '1,2').values, [ (1,2) ] )
self.assertEquals(nsa.Label('', '1,2,3').values, [ (1,3) ] )
self.assertEquals(nsa.Label... | jab1982/opennsa | test/test_nsa.py | Python | bsd-3-clause | 1,927 |
import experiment
from ..util import dirs
from ..util import file_handling as fh
from optparse import OptionParser
import sys
def main():
usage = "%prog project logfile "
parser = OptionParser(usage=usage)
parser.add_option('-n', dest='new_name', default=None,
help='New name for e... | dallascard/guac | core/experiment/rerun.py | Python | apache-2.0 | 1,879 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and... | baloo/shinken | shinken/modules/livestatus_broker/livestatus_stack.py | Python | agpl-3.0 | 4,999 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility functions for sum_adjoint in pypaw
:copyright:
Wenjie Lei (lei@princeton.edu), 2016
:license:
GNU Lesser General Public License, version 3 (LGPLv3)
(http://www.gnu.org/licenses/lgpl-3.0.en.html)
"""
from __future__ import print_function, division, a... | wjlei1990/pytomo3d | pytomo3d/adjoint/sum_adjoint.py | Python | lgpl-3.0 | 7,230 |
# -*- 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_training/models/time_category.py | Python | agpl-3.0 | 1,424 |
import random
class TetrisObject:
"""A TetrisObject represents the actual object that the player
can control. It consists of four blocks (positioned depending on
the shape) and can move down, to the sides or be rotated."""
# Actual position
x = 3;
y = 0;
# The current state of rot... | introprogramming/exercises | exercises/tetris/TetrisObject.py | Python | mit | 4,329 |
import logging
from prompt_toolkit.keys import Keys
from prompt_toolkit.key_binding.manager import KeyBindingManager
from prompt_toolkit.filters import Condition
from .filters import HasSelectedCompletion
_logger = logging.getLogger(__name__)
def pgcli_bindings(get_vi_mode_enabled, set_vi_mode_enabled):
"""
... | d33tah/pgcli | pgcli/key_bindings.py | Python | bsd-3-clause | 2,756 |
from demosys.test.testcase import DemosysTestCase
from demosys.effects.registry import effects
class TextTestCase(DemosysTestCase):
"""Crude test executing text code"""
def setUp(self):
effects.add_package('demosys.effects.text')
self.project.load()
def test_create(self):
instanc... | Contraz/demosys-py | tests/test_text.py | Python | isc | 613 |
'''
Created on Dec 23, 2013
@author: Chris
'''
import sys
import wx
from gooey.gui.lang import i18n
from gooey.gui.message_event import EVT_MSG
class MessagePump(object):
def __init__(self):
# self.queue = queue
self.stdout = sys.stdout
# Overrides stdout's write method
def write(self, text):
... | lrq3000/pyFileFixity | pyFileFixity/lib/gooey/gui/windows/runtime_display_panel.py | Python | mit | 1,831 |
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... | JackKelly/neuralnilm_prototype | scripts/e367.py | Python | mit | 5,841 |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import pyroms
import pyroms_toolbox
def plot_mask(gridid, Cpos='rho', proj=None, **kwargs):
# get grid
if type(gridid).__name__ == 'ROMS_Grid':
grd = gridid
else:
grd = pyroms.grid.get_ROMS_grid(g... | kshedstrom/pyroms | pyroms_toolbox/pyroms_toolbox/plot_mask.py | Python | bsd-3-clause | 2,034 |
"""
WSGI config for webApp 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webApp.settings")
from django.core.wsg... | ctames/conference-host | webApp/wsgi.py | Python | mit | 387 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.