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 -*-
# Copyright (c) 2010 Mark Sandstrom
# Copyright (c) 2011-2015 Raphaël Barrois
#
# 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 ... | z1gm4/desarrollo_web_udp | env/lib/python2.7/site-packages/factory/base.py | Python | gpl-3.0 | 26,259 |
# -*- coding:utf-8 -*-
from ...errors.httpinternalservererrorexception import HttpInternalServerErrorException
import saklient
# module saklient.cloud.errors.unknownexception
class UnknownException(HttpInternalServerErrorException):
## 予期しないエラーが発生しました。このエラーが繰り返し発生する場合は、サポートサイトやメンテナンス情報をご確認ください。
## @para... | hnakamur/saklient.python | saklient/cloud/errors/unknownexception.py | Python | mit | 863 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0009_auto_20150320_2009'),
]
operations = [
migrations.AlterField(
model_name='post',
name=... | CMPUT410W15T02/CMPUT410W15-project | social_distribution/posts/migrations/0010_auto_20150320_2041.py | Python | gpl-2.0 | 541 |
import sqlite3
import sys
from tkinter import *
db=sqlite3.connect('animal.db')
ans=''
def init_database():
try:
db.execute('CREATE TABLE objects(id integer primary key AUTOINCREMENT,name text);')
db.execute('CREATE TABLE questions(id integer primary key AUTOINCREMENT,q text);')
db.execut... | sharadboni/Telepathist | Telepathist.py | Python | mit | 8,700 |
from .base import BaseHandler
class IndexHandler(BaseHandler):
def get(self):
self.template('front/index.html')
| jsannemo/programming-battle | battle/battle/frontend/controllers/front.py | Python | bsd-2-clause | 127 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/benchmarks | scripts/tf_cnn_benchmarks/models/tf1_only/nasnet_model.py | Python | apache-2.0 | 20,912 |
from django.core.exceptions import ValidationError
from django.forms.fields import MultipleChoiceField
from django.utils.translation import ugettext_lazy as _
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
'select_multiple_with_max.fields'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.... | mansonul/events | events/contrib/plugins/form_elements/fields/select_multiple_with_max/fields.py | Python | mit | 1,343 |
from os import system
import sys
for q in range(1,112):
q2 = (3-len(str(q)))*'0' + str(q)
system("./scfeatures none house/houses/house" + str(q) + " house/house" + q2 + ".scf")
| val-iisc/sketch-parse | retrieval-src/fgm-master/data/cmum/house/scfs.py | Python | mit | 182 |
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
GPSTest is a simple example using the SerialPort transport and the NMEA 0183
and Rockwell Zodiac GPS protocols to display fix data as it is received from
the device.
"""
from twisted.python import log, usage
import sys
... | waseem18/oh-mainline | vendor/packages/twisted/doc/core/examples/gpsfix.py | Python | agpl-3.0 | 2,616 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import uuid
import vobject
from trytond.model import fields, Unique
from trytond.report import Report
from trytond import backend
from trytond.transaction import Transaction
f... | tryton/party_vcarddav | party.py | Python | gpl-3.0 | 13,404 |
#!/usr/bin/env python3
#pylint: disable=missing-docstring
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
... | nuclear-wizard/moose | python/chigger/tests/range/minmax.py | Python | lgpl-2.1 | 826 |
'''
Created on 05/09/2017
@author: chernomirdinmacuvele
'''
from ui_compAmostra import Ui_frmDistComprimento
from PyQt5.Qt import QSpinBox, QDialog, QDoubleSpinBox, QSqlQuery
import FuncSQL
import rscForm
import QT_msg
class dialog_CompAmost(QDialog, Ui_frmDistComprimento):
def __init__(self, parent=None, TblNam... | InUrSys/PescArt2.0 | src/Fichas_src/dialog_CompAmost.py | Python | gpl-3.0 | 6,726 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-05 02:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('registration', '0002_auto_20161130_0157'),
('bike',... | BridgeCityBicycleCoop/workstand | bike/migrations/0002_auto_20170105_0238.py | Python | mit | 884 |
from .auth import (
INDEX_NAME,
INDEX_URL,
encode_header,
load_config,
resolve_authconfig,
resolve_repository_name,
) # flake8: noqa | Sorsly/subtle | google-cloud-sdk/lib/third_party/docker/docker/auth/__init__.py | Python | mit | 157 |
"""
Collection of helper classes to layout the gui using Widgets and Panels.
A widget is a any gui entity. A panel is a widget which can have children widgets.
The gui automatically does layout in a fashion sillier to wxPython.
A Widget is a gui entity that displays something. IE; button, text label.
A panel is a gui... | chrisrossx/DotStar_Emulator | DotStar_Emulator/emulator/gui/__init__.py | Python | mit | 470 |
from setuptools import setup, find_packages
setup(
name='segments',
version="2.1.4.dev0",
description='',
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
author='Steven Moran and Robert Forkel',
author_email='[email protected]',
url='https://... | bambooforest/segments | setup.py | Python | apache-2.0 | 1,528 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
import urllib, re
class AppURLopener(urllib.FancyURLopener):
version = "Mozilla/5.0"
urllib._urlopener = AppURLopener()
def suche( source , country, code ):
for line in source:
result = re.match ( '(.*)(upload.wikimedia)(.*)'+ country +'(.*)', line )
if re... | tzapzoor/marble | data/flags/downloadflags.py | Python | lgpl-2.1 | 4,626 |
# Copyright 2016 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... | vmturbo/nova | nova/policies/servers_migrations.py | Python | apache-2.0 | 2,279 |
#!/usr/bin/env python
'''
A scratch 2 parser written in Python
Copyright 2013 Joseph Lewis <[email protected]>
'''
import zipfile
import json
# an enumeration of all the hat blocks available
HAT_BLOCKS = frozenset([u"whenKeyPressed", u"whenClicked", u"whenSceneStarts",
u"whenSensorGreaterThan", u"whenIReceive", u... | josephlewis42/magpie | magpie/plugins/scratch2/decompiler.py | Python | bsd-3-clause | 5,722 |
import feedparser
import time
# Create display instance on default I2C address (0x70) and bus number.
from Adafruit_LED_Backpack import AlphaNum4
display = AlphaNum4.AlphaNum4()
# Initialize the display. Must be called once before using the display.
display.begin()
#create string(s) with rss address for multiple feed... | Epikarsios/RssLEDBackpack | RssLED.py | Python | gpl-3.0 | 1,628 |
"""Wrapper service for kraken api."""
class ApiService:
"""Serivce for kraken api call."""
def __init__(self):
"""Create service object."""
pass
| saukymo/kraken | src/services/api.py | Python | mit | 172 |
import os
from SystemInfo import SystemInfo
from Tools.HardwareInfo import HardwareInfo
from Tools.BoundFunction import boundFunction
from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigNothing, ConfigSubDict, ConfigOnOff, ConfigDa... | BlackHole/enigma2-obh10 | lib/python/Components/NimManager.py | Python | gpl-2.0 | 82,663 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
data_path = 'Bike-Sharing-Dataset/hour.csv'
rides = pd.read_csv(data_path)
rides.head()
rides[:24*10].plot(x='dteday', y='cnt')
# Dummy Variables
dummy_fields = ['season', 'weathersit', 'mnth', 'hr', 'weekday']
for each in dummy_fields:
dum... | guyk1971/deep-learning | first-neural-network/firstNN_nb.py | Python | mit | 11,102 |
from multiexplorer.models import IPTracker
from django.http import HttpResponse
from django.conf import settings
class IPLimiterMiddleware(object):
interval = "%s %s" % (
list(settings.IP_FILTER_INTERVAL.values())[0],
list(settings.IP_FILTER_INTERVAL.keys())[0],
)
def __init__(self, get_re... | priestc/MultiExplorer | multiexplorer/multiexplorer/middleware.py | Python | mit | 856 |
import yt
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import pylab
from yt.analysis_modules.halo_finding.api import HaloFinder
import os
#current files are from 20170706_1407
#previous files are from 20170705_0400
#finds the file
def find(name, path):
for root, dirs, files in os.walk(path):
... | rjl09c/ysp2017 | katieproteus.py | Python | gpl-3.0 | 2,304 |
import os
import mimetypes
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
f... | e-loue/django-storages | storages/backends/s3boto.py | Python | bsd-3-clause | 10,557 |
# -*- coding: utf-8 -*-
# **********************************************************************
#
# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ***********************************... | ljx0305/ice | cpp/test/IceStorm/rep1/test.py | Python | gpl-2.0 | 9,054 |
# 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... | gyang/horizon | horizon/tests/test_data/glance_data.py | Python | apache-2.0 | 1,563 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
sh % "hg init"
(
sh % "h... | facebookexperimental/eden | eden/hg-server/tests/test-revnum-deprecate-t.py | Python | gpl-2.0 | 2,980 |
import pytest
from ray.serve.kv_store import RayInternalKVStore
def test_ray_internal_kv(serve_instance):
with pytest.raises(TypeError):
RayInternalKVStore(namespace=1)
RayInternalKVStore(namespace=b"")
kv = RayInternalKVStore()
with pytest.raises(TypeError):
kv.put(1, b"1")
... | richardliaw/ray | python/ray/serve/tests/test_kv_store.py | Python | apache-2.0 | 1,027 |
from MathFunc import *
from copy import copy, deepcopy
from model.Game import Game
from model.World import World
from model.Move import Move
from CommonFunctions import *
def get_puck_owner(world: World):
h = None
for h in world.hockeyists:
if world.puck.owner_hockeyist_id == h.id:
return h... | pkosukhin/codehockey | Constants.py | Python | mit | 2,234 |
# -*- coding: utf-8 -*-
import logging
import random
import sys
import numpy as np
from copy import deepcopy
from . import SYMBOLS
from .ai import negamax
class BasePlayer(object):
def __init__(self, player):
self.log = logging.getLogger(self.__class__.__name__)
self.player = player
def ge... | gosom/tic-tac-toe | tictac/lib/player.py | Python | gpl-3.0 | 1,916 |
# -*- coding: utf-8 -*-
# @Author: Ram Krishna Sharma
# @Author Email: [email protected]
# @Date: 2021-07-26
# @Last Modified by: Ram Krishna Sharma
# @Last Modified time: 2021-08-03
import os
def ExecuteCommand(Command_):
print("===============================================================")
p... | ram1123/PPT_script | templates/utils.py | Python | unlicense | 2,257 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import unittest
from odoo.addons.stock_landed_costs.tests.common import TestStockLandedCostsCommon
from odoo.addons.stock_landed_costs.tests.test_stockvaluationlayer import TestStockValuationLCCommon
from odoo.addons.stoc... | rven/odoo | addons/stock_landed_costs/tests/test_stock_landed_costs_purchase.py | Python | agpl-3.0 | 19,955 |
import os
import sys
import numpy as np
import tensorflow as tf
# suppress output from tensorflow
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# Read in data from file
data = np.genfromtxt(sys.argv[1], delimiter=',')
data = np.reshape(data,(2,2))
# Generate graph of gpu computations
graph = tf.Graph()
with graph.as_defa... | CyberReboot/vent-plugins | gpu_example/example.py | Python | apache-2.0 | 744 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
from python cookbook 2nd edition.
"""
import sys
import inspect
class SuperMixin(object):
"""A way to use super.
Example:
>>> class Base(list, SuperMixin):
... pass
...
>>> class DerivedA(Base):
... def dmethod(self):
... ... | ptrsxu/snippetpy | builtinim/supermixin.py | Python | mit | 1,129 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-03-15 20:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crowdcop_web', '0002_campaign_num_tips'),
]
operations = [
migrations.AddFie... | bocaaust/CrowdCop | CrowdCop_test/crowdcop/crowdcop_web/migrations/0003_campaign_campaign_image_url.py | Python | apache-2.0 | 547 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
"""Classes for tabular data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import MutableSequence
from copy import copy, deepcopy
from types import N... | walsht26/PySelection | pyselection/table.py | Python | gpl-3.0 | 55,084 |
# pylint: disable=C0301
import decimal
from django.test import TestCase
from mock import patch, Mock
from ..models import Customer, Charge
from ..signals import card_changed
from ..utils import get_user_model
class TestCustomer(TestCase):
def setUp(self):
self.User = get_user_model()
self.user ... | wahuneke/django-stripe-payments | payments/tests/test_customer.py | Python | bsd-3-clause | 16,404 |
# (C) British Crown Copyright 2010 - 2013, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | bblay/iris | lib/iris/tests/test_util.py | Python | gpl-3.0 | 13,652 |
"""The Minecraft Server binary sensor platform."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from . import MinecraftServer, MinecraftServe... | tchellomello/home-assistant | homeassistant/components/minecraft_server/binary_sensor.py | Python | apache-2.0 | 1,464 |
from test_health_icd10 import suite
| kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/health_icd10/tests/__init__.py | Python | gpl-3.0 | 36 |
"""
Django settings for content_edit project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... | burke-software/django-content-edit | content_edit_proj/settings.py | Python | bsd-3-clause | 2,898 |
#!/usr/bin/python
#import lxml.etree
#import lxml.builder
from lxml import etree
#E = lxml.builder.ElementMaker()
#KINBODY=E.KinBody
#BODY=E.Body
#GEOM=E.Geom
#EXTENTS=E.Extents
#TRANSLATION=E.Translation
#DIFUSSECOLOR=E.diffuseColor
# User variables
boxHeight = 1.0
inFileStr = '/home/yo/repos/2018-ptmr/map1/map1.c... | roboticslab-uc3m/xgnitive | programs/kinbody-creator/openraveMapGeneratorFile.py | Python | lgpl-2.1 | 2,113 |
# Copyright Yopi Angi
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.tools import safe_eval
class GoogleMapDrawingShapeMixin(models.AbstractModel):
_name = 'google.map.drawing.shape.mixin'
_description = 'Google Maps Shape Mixin'
_rec_name = ... | OCA/geospatial | web_widget_google_map_drawing/models/drawing_mixin.py | Python | agpl-3.0 | 887 |
import sys
import numpy as np
import numpy.linalg as npl
from eric.molecule import Molecule
from eric.utils import print_mat
def getargs():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--stub', default="h2o_sto3g")
parser.add_argument('--nbasis', type=int, default=7)
... | berquist/programming_party | eric/project8/project8.py | Python | mpl-2.0 | 10,633 |
"""
SUMMON - Multiple Window Management
"""
import time
from summon.core import *
from summon import util
import summon
class WindowEnsemble:
"""This class coordinates the position, size, translation, and zoom of
multiple SUMMON Windows.
"""
def __init__(self, windows, stackx=False, sta... | mdrasmus/summon | lib/summon/multiwindow.py | Python | gpl-2.0 | 14,930 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 Simone Campagna
#
# 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... | simone-campagna/daikon | zirkon/validator/check_range.py | Python | apache-2.0 | 4,546 |
#!/usr/bin/env python3
import stringcase
from generator.Field import Field
class OneOfField:
def __init__(self, oneof_name, oneof_fields, context):
self.name = oneof_name
# Some booleans to describe the type
self.one_of = True
self.type = 'OneOf{}'.format(stringcase.pascalcase(... | Fastcode/NUClearExample | nuclear/message/generator/OneOfField.py | Python | mit | 936 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2013 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... | jun66j5/trac-ja | trac/util/tests/text.py | Python | bsd-3-clause | 16,422 |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.core import mail
from notifications.forms import MessageForm
class LoginTestCase(TestCase):
# inject these two functions
def login_user(self):
return self.clien... | irregulator/ganetimgr | notifications/tests.py | Python | gpl-3.0 | 3,209 |
import urllib, urllib2, sys, httplib
url = "/MELA/REST_WS"
HOST_IP="localhost:8180"
filename="./serviceDescription.xml"
if __name__=='__main__':
args = sys.argv;
if (len(args) > 1):
filename = str(args[1])
connection = httplib.HTTPConnection(HOST_IP)
description_file = open(f... | tuwiendsg/MELA | MELA-Extensions/MELA-ComplexCostEvaluationService/tests/spark/submitServiceDescription.py | Python | apache-2.0 | 674 |
# -*- coding: utf-8 -*-
"""
Base backend specific settings module.
"""
from __future__ import unicode_literals
from django_event import settings
HOST = settings.BACKEND_OPTIONS.get('HOST', 'localhost')
PORT = settings.BACKEND_OPTIONS.get('PORT')
PASSWORD = settings.BACKEND_OPTIONS.get('PASSWORD', '') | ailove-dev/django-event | django_event/backends/base/settings.py | Python | mit | 307 |
"""
Tests for dit.math.misc.
"""
import pytest
from dit.math.misc import combinations, is_integer, is_number, factorial
@pytest.mark.parametrize('n', range(-10, 10))
def test_number1(n):
assert is_number(n)
@pytest.mark.parametrize('n', range(-10, 10))
def test_number2(n):
assert is_number(n / 10)
@... | dit/dit | tests/math/test_misc.py | Python | bsd-3-clause | 1,530 |
# -*- coding: utf-8 -*-
import sys
import os
import json
import traceback
import warnings
import webob
from webob.exc import HTTPNotFound
import mock
from webtest import TestApp
import six
from six import b as b_
from six import u as u_
from six.moves import cStringIO as StringIO
from pecan import (
Pecan, Reque... | StackStorm/pecan | pecan/tests/test_base.py | Python | bsd-3-clause | 71,720 |
from __future__ import absolute_import
import sys, os, re, inspect
import imp
try:
import hashlib
except ImportError:
import md5 as hashlib
from distutils.core import Distribution, Extension
from distutils.command.build_ext import build_ext
import Cython
from ..Compiler.Main import Context, CompilationOptio... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/Cython/Build/Inline.py | Python | agpl-3.0 | 10,977 |
# coding: utf-8
"""
api_blueprint.py
~~~~~~~~~~~~~~~~~
This module implements the main Job api for Viki.
:license: Apache2, see LICENSE for more details.
"""
from flask import Blueprint, jsonify, request
from vikid.job import Job
blueprint_name = 'api_blueprint'
template_folder_name = 'templates'
job = Job()
api... | shanahanjrs/vikid | vikid/blueprints/api_blueprint.py | Python | apache-2.0 | 2,707 |
# -*- coding: utf-8 -*-
""" Sahana Eden Common Alerting Protocol (CAP) Model
@copyright: 2009-2014 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to dea... | gnarula/eden_deployment | modules/s3db/cap.py | Python | mit | 78,715 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
Python source code - replace this with a description of the code and write the code below this text.
"""
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
| muldy/dotvim | templates/python.py | Python | gpl-3.0 | 211 |
# 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... | rahul003/mxnet | python/mxnet/module/base_module.py | Python | apache-2.0 | 47,156 |
from decimal import Decimal
from django.template.defaultfilters import pluralize
from django.test import SimpleTestCase
from ..utils import setup
class PluralizeTests(SimpleTestCase):
def check_values(self, *tests):
for value, expected in tests:
with self.subTest(value=value):
... | atul-bhouraskar/django | tests/template_tests/filter_tests/test_pluralize.py | Python | bsd-3-clause | 2,290 |
from discord.ext import commands
import aiohttp
class Wikipedia:
"""
Le Wikipedia Cog
"""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, name='wikipedia', aliases=['wiki', 'w'])
async def _wikipedia(self, context, *query: str):
"""
Get information from Wikipedia
... | Injabie3/Red-DiscordBot | cogs/wikipedia.py | Python | gpl-3.0 | 1,456 |
# 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 a... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gcutil/lib/google_compute_engine/gcutil_lib/firewall_cmds.py | Python | gpl-3.0 | 12,747 |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | foursquare/commons-old | src/python/twitter/common/java/field_info.py | Python | apache-2.0 | 4,650 |
##############################################################################
#
# Copyright (c) 2012 RiTH-Tech (http://rith-tech.com). All Right Reserved
#
# Author : Huy Doan ([email protected])
#
##############################################################################
from osv import fields, osv
class p... | rgv151/Paracel-POS-Backend | paracelpos/paracelpos.py | Python | gpl-3.0 | 2,419 |
from datetime import timedelta
CELERYBEAT_SCHEDULE = {
"reddit-validations": {
"task": "reddit.tasks.process_validations",
"schedule": timedelta(minutes=10),
},
"eveapi-update": {
"task": "eve_api.tasks.account.queue_apikey_updates",
"schedule": timedelta(minutes=10),
},... | nikdoof/test-auth | app/conf/celeryschedule.py | Python | bsd-3-clause | 1,084 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Twist
pub = rospy.Publisher('/mobile_base/commands/velocity', Twist, queue_size=10)
def od_callback(robot_od):
x = robot_od.pose.pose.position.x
r = 2.0
k = 0.5
v = k * (r - x)
... | rafafigueroa/amrws | src/amrpkg/scripts/odom_control.py | Python | mit | 624 |
# -*- coding: utf-8 -*-
'''
@author: moloch
Copyright 2013
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... | lunarca/fngrpt | uimodules/Menu.py | Python | apache-2.0 | 1,356 |
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
MyLovelyCompanyTeamProjectComponent, # NOT DRY
)
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
MyLovelyCompanyTeamProjectComponent as component, # DRY
)
class C:
@pytest.ma... | psf/black | tests/data/comments4.py | Python | mit | 3,531 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2017 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of ... | kratman/psi4public | psi4/driver/wrapper_autofrag.py | Python | gpl-2.0 | 5,232 |
from django.contrib.auth.views import LoginView, LogoutView
from django.core.urlresolvers import reverse_lazy
from django.views.generic import ListView, TemplateView, CreateView, UpdateView, DeleteView
from vms.entities.models import Volunteer, VolunteerSchedule, Location
from vms.volunteers.forms import AddScheduleFo... | mitzaM/VolunteerManagementSystem | vms/volunteers/views.py | Python | gpl-3.0 | 1,982 |
from __future__ import absolute_import
import string
import math
print("Hello %r" % math.sqrt(2))
print(string.capwords('the quick brown fox'))
| storborg/futurify | futurify/tests/desired/simple.py | Python | mit | 147 |
from lib.actions import BaseAction
__all__ = [
'ListVehiclesAction'
]
class ListVehiclesAction(BaseAction):
def run(self):
return self.formatter.formatter(
self.connection.vehicles())
| pidah/st2contrib | packs/tesla/actions/list_vehicles.py | Python | apache-2.0 | 215 |
"""
Arithmetic operations for PandasObjects
This is not a public API.
"""
import operator
from typing import TYPE_CHECKING, Optional, Set
import warnings
import numpy as np
from pandas._libs.ops_dispatch import maybe_dispatch_ufunc_to_dunder_op # noqa:F401
from pandas._typing import Level
from pandas.util._decorato... | jreback/pandas | pandas/core/ops/__init__.py | Python | bsd-3-clause | 13,971 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
test_records = [] | rohitw1991/latestadbwnf | core/doctype/workflow_state/test_workflow_state.py | Python | mit | 104 |
#----------------------------------------------------------------------
# VMouse - OpenCV Virtual Mouse (HCI)
# Copyright (C) 2014 Kunal Dawn <[email protected]>
# Copyright (C) 2014 Medha Devaraj <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | kunaldawn/vmouse-opencv-qt-hand-gesture-hci | servers/serverMouseEvent.py | Python | gpl-3.0 | 1,649 |
# Dynamic Programming for 0-1 Knapsack with dominance
# By James Lao.
#!/usr/bin/env python3
from collections import deque
import sys
import time
INF = float("inf")
def knapsack(vw, limit, n):
vw = sorted(vw, key=lambda x: x[1], reverse=True) # Accelerate
A = deque([(0, 0)])
for i in range(0, n):
... | jameslao/Knapsack-in-Python | knapsack_dp_dominance.py | Python | mit | 1,294 |
# This file handles differences between BGL and PyOpenGL, and provides various
# utility functions for OpenGL
try:
from bgl import *
USING_BGL = True
except ImportError:
from OpenGL.GL import *
from OpenGL.GLU import *
from bgl import Buffer
if USING_BGL:
_glGenTextures = glGenTextures
def glGenTextures(n, tex... | Alwnikrotikz/bgui | bgui/gl_utils.py | Python | mit | 1,115 |
"""Test calling functions in static methods with a stripped binary."""
import os, time
import unittest2
import lldb
import lldbutil
from lldbtest import *
class TestObjCStaticMethodStripped(TestBase):
mydir = os.path.join("lang", "objc", "objc-static-method-stripped")
@unittest2.skipUnless(sys.platform.star... | s20121035/rk3288_android5.1_repo | external/lldb/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py | Python | gpl-3.0 | 2,939 |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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
# with... | ff94315/hiwifi-openwrt-HC5661-HC5761 | staging_dir/host/lib64/scons-2.1.0/SCons/compat/_scons_builtins.py | Python | gpl-2.0 | 5,045 |
# Copyright 2020 The dm_control 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 i... | deepmind/dm_control | dm_control/locomotion/examples/basic_rodent_2020.py | Python | apache-2.0 | 5,924 |
# -*- coding: utf-8 -*-
a=input('please input your age:')
age=int(a)
if age >=20:
print('adult')
elif age >=6:
print('teenager')
else:
print('kid')
| liysky/Python_life | Grammar - demos/age.py | Python | gpl-3.0 | 162 |
call = lambda b:(
b,
1, # Break here
)
call(1)
call(2)
print('TEST SUCEEDED') | fabioz/PyDev.Debugger | tests_python/resources/_debugger_case_lambda_multiline.py | Python | epl-1.0 | 99 |
# -*- coding: utf-8 -*-
{
'name': "website_register_b2b",
'summary': """
Registration form for site purchases """,
'description': """
Registration form for site purchases
""",
'author': "Alexsandro Haag <[email protected]>, HGSOFT",
'website': "http://www.hgsoft.com.br",
... | alexsandrohaag/odoo-website-addons | website_register_b2b/__manifest__.py | Python | agpl-3.0 | 514 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/py-unittest2py3k/package.py | Python | lgpl-2.1 | 1,758 |
from django.contrib.admin.utils import quote
from django.utils.encoding import force_str
from django.utils.translation import ugettext as _
class ButtonHelper:
default_button_classnames = ['button']
add_button_classnames = ['bicolor', 'icon', 'icon-plus']
inspect_button_classnames = []
edit_button_cl... | mikedingjan/wagtail | wagtail/contrib/modeladmin/helpers/button.py | Python | bsd-3-clause | 7,222 |
from executor.Executor import TBTAFExecutor
from common.suite import TBTestSuite
from common.sample_test import TBTAFSampleTest
import time
def sample_run():
ejecutor = TBTAFExecutor()
suite = TBTestSuite(1,'A')
for i in range(2):
newTest = TBTAFSampleTest()
suite.addTestCase(newTest)
n... | S41nz/TBTAF | tbtaf/test/executor/prueba_executor_invalid_test.py | Python | apache-2.0 | 634 |
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import subprocess, time
last_ch = 0
class TvServerHandler(BaseHTTPRequestHandler):
def do_GET(self):
global last_ch
cmd = self.path.split('/')
if 'favicon.ico' in cmd:
return
... | mimepp/umspx | htdocs/umsp/plugins/eyetv/eyetv-controller.py | Python | gpl-3.0 | 1,293 |
# This file is part of the Hotwire Shell project API.
# Copyright (C) 2007 Colin Walters <[email protected]>
# 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, includin... | SDX2000/hotwire | hotwire/builtins/httpget.py | Python | gpl-2.0 | 2,322 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
needed_by = (("oauth2_provider", "0001_initial"),)
def forwards(self, orm):
# Adding model 'Account'
db.create_table(u'accounts_... | openbudgets/openbudgets | openbudgets/apps/accounts/migrations/0001_initial.py | Python | bsd-3-clause | 6,585 |
# coding=utf-8
# Copyright 2021, The Facebook AI Research Team and The HuggingFace Inc. team. 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.or... | huggingface/transformers | src/transformers/models/mbart/modeling_flax_mbart.py | Python | apache-2.0 | 73,864 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import admin
from django.db.models import Q
from reversion.admin import VersionAdmin
from .models import RDFPrefix, SPARQLQuery, SPARQLUpdateQuery, CacheResource, UserGeneratedContent
class GroupOwnedAdmin(admin.ModelAdmin):
"""
Adm... | delving/nave | nave/lod/admin.py | Python | gpl-2.0 | 3,286 |
"""""
A mixin for staff grading.
"""
import logging
from xblock.core import XBlock
from submissions import team_api as team_sub_api
from openassessment.assessment.api import (
staff as staff_api,
teams as teams_api
)
from openassessment.assessment.errors import StaffAssessmentInternalError, StaffAssessmentR... | edx/edx-ora2 | openassessment/xblock/staff_assessment_mixin.py | Python | agpl-3.0 | 11,241 |
from __future__ import absolute_import
from bokeh.io import save
from bokeh.plotting import figure
plot = figure(toolbar_location=None)
l1 = plot.line([1, 2, 3], [1, 2, 3])
l2 = plot.line([1, 2, 3], [2, 4, 6])
plot.xaxis.visible = False
plot.ygrid.visible = False
l1.visible = False
l2.visible = True
save(plot)
| mindriot101/bokeh | examples/integration/plots/visible_property.py | Python | bsd-3-clause | 317 |
# -*- coding: utf-8 -*-
import pytest
from api.base.settings.defaults import API_BASE
from osf_tests.factories import (
AuthUserFactory,
InstitutionFactory,
)
@pytest.mark.django_db
class TestUserInstititutionRelationship:
@pytest.fixture()
def institution_one(self):
return InstitutionFactor... | aaxelb/osf.io | api_tests/users/views/test_user_institutions_relationship.py | Python | apache-2.0 | 5,760 |
from typing import Tuple
class Parents:
def __init__(self, parents):
# type: (Tuple(Human)) -> None
self.parents = parents
def is_parent(self, human):
# type: (Human) -> bool
return human in self.parents
| Diralf/evolution | app/entity/human/parents.py | Python | mit | 247 |
"""
Welcome to the TriFusion API reference guide. This reference guide details
the sub-packages and modules used for each component of TriFusion.
This guide is intended for power users and developers that wish to modify
the source and/or contribute with new code. A brief description of each
main component of TriFusion... | ODiogoSilva/TriFusion | trifusion/__init__.py | Python | gpl-3.0 | 7,541 |
import collections
import numpy as np
import os.path
from sklearn.feature_selection import *
from sklearn.model_selection import *
from scipy.stats import linregress
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from github_analysis_tool.analyzer.clustering im... | itu-oss-project-team/oss-github-analysis-project | github_analysis_tool/analyzer/network_analysis.py | Python | mit | 9,487 |
from assert_helpers import assert_difference, assert_no_difference
from ekklesia_portal.datamodel import ArgumentRelation, ArgumentVote
from ekklesia_portal.enums import ArgumentType
from webtest_helpers import assert_deform
def test_argumentrelation(client, argument_relation):
proposition = argument_relation.pro... | dpausp/arguments | tests/concepts/argument_relation/test_argument_relation.py | Python | agpl-3.0 | 2,982 |
# Implementa una clase para resolver el problema de "Misioneros y Caníbales"
# Incluye ejemplos de su uso para resolverlo mediante el algoritmo
# de búsqueda primero en anchura
#
# Autor: Dr. Santiago Enrique Conant Pablos
# Fecha: 24 de agosto de 2016
from search import ( # Bases para construcción de problemas... | nikodtbVf/aima-si | misioneros.py | Python | mit | 6,024 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.