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 |
|---|---|---|---|---|---|
from delphin.exceptions import (
PyDelphinException,
PyDelphinSyntaxError,
PyDelphinWarning,
)
class EDSError(PyDelphinException):
"""Raises on invalid EDS operations."""
class EDSSyntaxError(PyDelphinSyntaxError):
"""Raised when an invalid EDS string is encountered."""
class EDSWarning(PyDel... | delph-in/pydelphin | delphin/eds/_exceptions.py | Python | mit | 395 |
a, b = 9, 10
'''
normal if condition but having extra ordinary feature that we can insert values into string by using {} and format() method.
'''
if a > b:
print("a({}) is greater than b({})".format(a, b))
else:
print("a({}) is less than b({})".format(a, b))
'''
One more condition like ternary operat... | ramprakashmu/python | conditions.py | Python | apache-2.0 | 404 |
'''
Precondition
successfully pass a users test.
'''
from datetime import datetime, timedelta
import time
import pytest
import requests
from kii import AccountType, exceptions as exc, results as rs
from kii.data import BucketType, clauses as cl
from tests.conf import (
get_env,
get_api_with_test_user,
... | ta2xeo/python3-kii | tests/test_data/application/test_application_scope_data.py | Python | mit | 13,511 |
from nose.tools import eq_
from nose.plugins.attrib import attr
from abbr import AbbreviationExpander
from gi.repository import GObject
import threading
import time
class TestAbbreviationExpander():
def setup(self):
self.config = {
"auto-capitalize-expansion": False
}
self.abb... | BoGoEngine/ibus-bogo | ibus_engine/test/test_abbreviation.py | Python | gpl-3.0 | 1,666 |
# -*- coding: utf-8 -*-
#
# File : echotorch/nn/ESN.py
# Description : An Echo State Network module.
# Date : 26th of January, 2018
#
# This file is part of EchoTorch. EchoTorch 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 Sof... | nschaetti/EchoTorch | echotorch/nn/ICACell.py | Python | gpl-3.0 | 2,909 |
"""Adds Google Cloud test repos."""
import os
from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
from bootstrapvz.common.tools import log_check_call
class AddGoogleCloudStagingRepo(Task):
description = 'Adding Google Cloud Staging Repo'
phase = phase... | adjackura/compute-image-tools | daisy_workflows/image_build/debian/google_cloud_test_repos/tasks.py | Python | apache-2.0 | 1,314 |
#!/usr/local/bin/python3
#http://thehtmldom.sourceforge.net/#install
import requests
from htmldom import htmldom
import os
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
url = ''
inputUrl = input("Введите URL: ")
inputQuer... | imdevme/hlist | scripts/gethtml.py | Python | gpl-3.0 | 1,098 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Filename: MPL11.py
# Project: dap
# Author: Brian Cherinka
# Created: Friday, 26th February 2021 9:23:41 am
# License: BSD 3-clause "New" or "Revised" License
# Copyright (c) 2021 Brian Cherinka
# Last Modified: Friday, 26th February 2021 9:23:42 am
# Modified By: Bria... | sdss/marvin | python/marvin/utils/datamodel/dap/MPL11.py | Python | bsd-3-clause | 1,935 |
import bomb
#testing main function
def main():
failcount = 0
print('Creating bomb with three modules.')
b = bomb.Bomb(3)
if( isinstance(b, bomb.Bomb)):
testresult = 'PASS'
else:
testresult = 'FAIL'
failcount += 1
print('Type test: ' + testresult)
b.start()
print('Checking number of modules in bomb')
p... | Saucyz/explode | src/testbomb.py | Python | mit | 1,193 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of mtgsdk.
# https://github.com/MagicTheGathering/mtg-sdk-python
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2016, Andrew Backes <[email protected]>
from mtgsdk.querybuilder import QueryBuil... | MagicTheGathering/mtg-sdk-python | mtgsdk/supertype.py | Python | mit | 460 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# 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
import os
import json
import pytest
import sys
if sys.version_info < (2... | thaim/ansible | test/units/modules/network/f5/test_bigip_monitor_ldap.py | Python | mit | 2,959 |
from __future__ import division, absolute_import, print_function
import warnings
import sys
import numpy as np
from numpy.testing import (
run_module_suite, TestCase, assert_, assert_equal, assert_array_equal,
assert_almost_equal, assert_array_almost_equal, assert_raises,
assert_allclose, assert_array_max... | larsmans/numpy | numpy/lib/tests/test_function_base.py | Python | bsd-3-clause | 81,934 |
from django.db import models
class Reporter(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
email = models.EmailField()
facebook_user_id = models.BigIntegerField(null=True)
class Meta:
unique_together = ('first_name', 'last_name')
... | adrianholovaty/django | tests/regressiontests/introspection/models.py | Python | bsd-3-clause | 668 |
##############################################################################
# Copyright 2016-2018 Rigetti Computing
#
# 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... | rigetticomputing/pyquil | pyquil/quil.py | Python | apache-2.0 | 54,666 |
# 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 applicab... | cshallue/models | research/deeplab/utils/train_utils.py | Python | apache-2.0 | 7,949 |
#!/usr/bin/env python
###############################################################################
#
# fastg2graph
#
###############################################################################
# #
# This program is free software: you... | JoshDaly/scriptShed | fastg2graph.py | Python | gpl-2.0 | 6,439 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ExtendedProfile'
db.create_table('accounts_extendedprofile', (
('id', self.gf('d... | knowledgecommonsdc/kcdc3 | kcdc3/apps/accounts/migrations/0001_initial.py | Python | mit | 4,944 |
def getFileList(fileNameListFileName):
# Get a list of files from a file with a list of file names
fileNameListFile = open(fileNameListFileName)
fileList = []
for line in fileNameListFile:
# Iterate through the lines of the file with file names and open each file
fileList.append(gzip.open(line.strip()))
retu... | imk1/IMKTFBindingCode | makeBinarySummitRegionMat.py | Python | mit | 4,431 |
#!/usr/bin/env python
import os
from encryptedpickle import encryptedpickle
from utilis import Utilities
def parser():
basedir = os.path.abspath(os.path.dirname(__file__))
configFile = os.path.join(basedir, "../config/secret.ini")
return Utilities.parseConfiguration(configFile)
class createEncryptionOb... | pyVarad/jubliant-meme | jubliant-meme/webapp/FlaskApp/lib/manageCredentials.py | Python | mit | 2,345 |
from google.appengine.ext import db
import models
import forms
from crud_handler import CRUDHandler
class CurrentUserTelescopes(CRUDHandler):
model = models.Telescope
form = forms.TelescopeForm
| mhrivnak/ObservingReports | ajax/current_user_telescopes.py | Python | bsd-3-clause | 204 |
import os
import boto
import time
import hashlib
import logging
import mimetypes
from django.conf import settings
from optparse import make_option
from multiprocessing.pool import ThreadPool
from django.core.urlresolvers import get_callable
from django.core.management.base import BaseCommand, CommandError
logger = logg... | SCPR/accountability-tracker | bakery/management/commands/publish.py | Python | gpl-2.0 | 10,130 |
"""The asyncio package, tracking PEP 3156."""
import sys
# The selectors module is in the stdlib in Python 3.4 but not in 3.3.
# Do this first, so the other submodules can use "from . import selectors".
# Prefer asyncio/selectors.py over the stdlib one, as ours may be newer.
try:
from . import selectors
except Im... | gautamMalu/rootfs_xen_arndale | usr/lib/python3.4/asyncio/__init__.py | Python | gpl-2.0 | 1,376 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Jan-Piet Mens <jpmens () gmail.com>
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alxgu/ansible | lib/ansible/modules/notification/irc.py | Python | gpl-3.0 | 9,145 |
#!/usr/bin/env python
"""
NAME
pmd_magic.py
DESCRIPTION
converts PMD (Enkin) format files to MagIC format files
SYNTAX
pmd_magic.py [command line options]
OPTIONS
-h: prints the help message and quits.
-ID: directory for input file if not included in -f flag
-f FILE: specify infile file, req... | lfairchild/PmagPy | programs/conversion_scripts/pmd_magic.py | Python | bsd-3-clause | 3,224 |
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.client import Client
from django.utils import timezone
from channel_facebook.channel import FacebookChannel
from channel_facebook.models import FacebookAccount
from core import models
class FacebookBaseTestCase(TestCase):
... | daisychainme/daisychain | daisychain/channel_facebook/tests/test_base.py | Python | mit | 2,078 |
import pingo
from time import sleep
rpi = pingo.rpi.RaspberryPi()
# A B C D E F G dp
led_locations = [11, 7, 21, 24, 26, 13, 15, 19]
pins = [rpi.pins[loc] for loc in led_locations[:6]]
for pin in pins:
pin.mode = pingo.OUT
pin.low()
while True:
for pin in pins:
pin.h... | garoa/pingo | pingo/examples/rpi_examples/display7_anim.py | Python | mit | 363 |
# coding=utf-8
import os
import sys
# Dependencies for the tests
from mock import patch
from twisted.trial.unittest import TestCase
from twisted.test.proto_helpers import StringTransportWithDisconnection
from twisted.internet.protocol import Factory
from twisted.python import log
sys.path.append(os.path.abspath(os... | satnet-project/protocol | tests/test_receiveMsg.py | Python | apache-2.0 | 2,239 |
# -*- coding: utf-8 -*-
#
# 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
#... | Tagar/incubator-airflow | airflow/sensors/http_sensor.py | Python | apache-2.0 | 3,622 |
from django.conf import settings
def settings_context(request):
return {'GOOGLE_ANALYTICS_PROPERTY_ID': settings.GOOGLE_ANALYTICS_PROPERTY_ID,
'IS_PRODUCTION': settings.IS_PRODUCTION,
}
| albertoconnor/website | core/context_processors.py | Python | mit | 216 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.battle.PlayByPlayText
from panda3d.direct import ShowInterval
from toontown.toonbase import TTLocalizer
from toontown.toonbase.ToontownBattleGlobals import *
from toontown.toonbase.ToontownGlobals import *
from SuitBattleGlobals import *
from dir... | DedMemez/ODS-August-2017 | battle/PlayByPlayText.py | Python | apache-2.0 | 1,440 |
import os
from lib.base_plugin import BasePlugin
from lib.paths import MyDocumentsPath
class VVVVVVPlugin(BasePlugin):
Name = "VVVVVV"
support_os = ["Windows", "Darwin"]
def init(self):
self.path = os.path.join(MyDocumentsPath, 'VVVVVV')
def backup(self, _):
_.add_folder('Saves', sel... | Pr0Ger/SGSB | plugins/VVVVVV.py | Python | mit | 546 |
# Copyright 2012 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 requi... | Juniper/nova | nova/tests/unit/network/test_neutronv2.py | Python | apache-2.0 | 299,912 |
from logging import getLogger
logger = getLogger('keyboard_hook')
import ctypes
from ctypes import (
wintypes,
Structure,
c_long,
c_int,
)
HC_ACTION = 0
WH_KEYBOARD_LL = 13
LLKHF_INJECTED = 16
LLKHF_UP = 128
KF_EXTENDED = 0x0100
LLKHF_EXTENDED = KF_EXTENDED >> 8
class KBDLLHOOKSTRUCT(Structur... | NVDARemote/NVDARemote | addon/globalPlugins/remoteClient/keyboard_hook.py | Python | gpl-2.0 | 1,906 |
from graph import Graph
from basegraph import EdgeProperty, NodeProperty
def convert_matrix(matrix):
"""
Converts the input adj. matrix
(it's mandatory that all edges are numbers).
"""
result_graph = Graph(directed=True)
parsed_graph = [tuple(entry.strip(' \r\n').split('\t')) for entry... | thensgens/kaavio-lib | graph_utils.py | Python | mit | 4,429 |
from omnibus.factories import websocket_connection_factory
def mousemove_connection_factory(auth_class, pubsub):
class GeneratedConnection(websocket_connection_factory(auth_class, pubsub)):
def close_connection(self):
self.pubsub.publish(
'mousemoves', 'disconnect',
... | moccu/django-omnibus | examples/mousemove/example_project/connection.py | Python | bsd-3-clause | 485 |
# Get the Python helper library from https://twilio.com/docs/libraries/python
import os
from twilio.rest import Client
# Get your Account SID and Auth Token from https://twilio.com/console
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.envi... | TwilioDevEd/api-snippets | deployed-devices/rest/keys/update-key/update-key.7.x.py | Python | mit | 715 |
"""pye_web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | Falldog/pyconcrete | example/django/pye_web/pye_web/urls.py | Python | apache-2.0 | 764 |
# x = '1''''a-
# multi-
# lined- string!
# '''
#
# y = 'c'
# z = x + y
# print(x, y, z)
(____, _____) = ('1a-\nmulti-\nlined- string!\n', 'c')
_ = ____
__ = _____
___ = _ + __
print (_, __, ___)
(x, y, z) = (_, __, ___)
| huan/Underscore | examples/underscored/strings.py | Python | mit | 228 |
import sys
from starstoloves.models import User as UserModel
from starstoloves import model_repository
from starstoloves.lib.track import lastfm_track_repository
from .user import User
def from_session_key(session_key):
user_model, created = UserModel.objects.get_or_create(session_key=session_key)
return User... | tdhooper/starstoloves | starstoloves/lib/user/user_repository.py | Python | gpl-2.0 | 564 |
import cPickle
import gzip
import os
import sys
import time
import numpy
import theano
import theano.tensor as T
class LogisticRegression(object):
"""
Multi-class Logistic Regression Class
The logistic regression is fully described by a weight matrix :math:`W`
and bias vector :math:`b`. Classif... | zhenxuan00/mmdgm | conv-mmdgm/layer/LogisticRegression.py | Python | mit | 4,977 |
#!/usr/bin/env python
# PyRadmon - Python Radiance Monitoring Tool
# Copyright 2014 Albert Huang.
#
# 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/LICENS... | alberthdev/pyradmon | pyradmon/args.py | Python | apache-2.0 | 68,354 |
"Usage: unparse.py <path to source file>"
import sys
import ast
import tokenize
import io
import os
# Large float and imaginary literals get turned into infinities in the AST.
# We unparse those infinities to INFSTR.
INFSTR = "1e" + repr(sys.float_info.max_10_exp + 1)
def interleave(inter, f, seq):
"""Call f on e... | ms-iot/python | cpython/Tools/parser/unparse.py | Python | bsd-3-clause | 17,193 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
check same interface phos_binding patterns
"""
import os
import sys
import urllib
import urllib2
import cPickle as pickle
from multiprocessing import Pool
def get_entityid(p):
pdbid,interface_id,chain1,chain2 = p
url = 'http://www.rcsb.org/pdb/rest/customRepo... | lituan/tools | pisa/pisa_same_entity.py | Python | cc0-1.0 | 5,849 |
"""
This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
from django.contrib.gis.db.backends.postgis.pgraster import to_pgraster
from django.contrib.gis.geometry.backend import Geometry
class PostGISAdapter:
def __ini... | tysonclugg/django | django/contrib/gis/db/backends/postgis/adapter.py | Python | bsd-3-clause | 2,158 |
"""InventoryManagement URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='hom... | Hekaton/InventoryManagement | src/InventoryManagement/InventoryManagement/urls.py | Python | apache-2.0 | 776 |
import os
import sys
import logging
sys.path.append(os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir)))
import torch
from torch import optim
from torch.utils import data
import numpy as np
import candle
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(message)... | ynop/candle | example.py | Python | mit | 3,234 |
# 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... | renesugar/arrow | dev/archery/archery/benchmark/compare.py | Python | apache-2.0 | 3,878 |
#!/usr/bin/env python3
"""
This script tests and plots all Geodesy normalized Legendre functions.
Parameters can be changed in the main function.
"""
import numpy as np
import matplotlib.pyplot as plt
import pyshtools
from pyshtools import legendre
pyshtools.utils.figstyle()
# ==== MAIN FUNCTION ====
def main():
... | SHTOOLS/SHTOOLS | examples/python/TestLegendre/TestLegendre.py | Python | bsd-3-clause | 4,704 |
#!/usr/bin/env python
# http://pyrocko.org - GPLv3
#
# The Pyrocko Developers, 21st Century
# ---|P------/S----------~Lg----------
from __future__ import print_function
import sys
import re
import os.path as op
import logging
import copy
import shutil
from optparse import OptionParser
from pyrocko import util, trace,... | pyrocko/pyrocko | src/apps/fomosto.py | Python | gpl-3.0 | 36,133 |
from timeit import default_timer
from psychopy import core, event, visual
from psychopy.visual.rect import Rect
from toon.anim.easing import (ELASTIC_IN_OUT, SMOOTHERSTEP, SMOOTHSTEP,
EXPONENTIAL_OUT, LINEAR)
from toon.anim.interpolators import SELECT, LERP
from toon.anim import Track
fr... | aforren1/toon | demos/animation.py | Python | mit | 2,742 |
from pybrain.rl.environments.timeseries.maximizereturntask import DifferentialSharpeRatioTask
from pybrain.rl.environments.timeseries.timeseries import AR1Environment, SnPEnvironment
from pybrain.rl.learners.valuebased.linearfa import Q_LinFA
from pybrain.rl.agents.linearfa import LinearFA_Agent
from pybrain.rl.experim... | samstern/MSc-Project | pybrain/rl/environments/timeseries/test programs/ar1TestScript.py | Python | bsd-3-clause | 976 |
#!/usr/bin/env python
# coding=utf-8
"""
Longest Collatz sequence
Problem 14
The following iterative sequence is defined for the set of positive integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 →... | openqt/algorithms | projecteuler/ac/old/pe014_longest_collatz_sequence.py | Python | gpl-3.0 | 1,574 |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from openinghours.app_settings import PREMISES_MODEL
# isoweekday
WEEKDAYS = [
(1, _("Monday")),
(2, _("Tuesday")),
(3, _("Wednesday"))... | arteria/django-openinghours | openinghours/models.py | Python | mit | 2,740 |
# -*- 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-dataplex | samples/generated_samples/dataplex_v1_generated_dataplex_service_update_lake_async.py | Python | apache-2.0 | 1,513 |
from __future__ import absolute_import
import six
from rest_framework.response import Response
from sentry.api.base import DocSection
from sentry.api.bases.group import GroupEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.serializers import serialize
from sentry.models import (
Gr... | JackDanger/sentry | src/sentry/api/endpoints/group_tagkey_details.py | Python | bsd-3-clause | 2,409 |
# -*- coding: utf-8 -*-
"""Provides sync for podio."""
__all__ = [
'add_notification',
'AddNotification'
]
from pyramid_torque_engine import unpack
from pyramid_torque_engine import operations as ops
from pyramid_torque_engine import repo
from pyramid import path
from pyramid_simpleauth.model import get_ex... | thruflo/pyramid_torque_engine | src/pyramid_torque_engine/notification.py | Python | unlicense | 8,271 |
# CS110Exam_Colwell_C_Block.py
# Colwell, Andrew (Jan, 2016)
'''
Pseudocode:
import Random
set initial variables
loop until game ends
get random number
loop until player stops
get user guess
add one to guess counter
compare with random number
== print number of ... | MrColwell/PythonProfessionalLearning | PythonForTeachers/StudentCode/Exam Scripts/CS110Exam_Colwell_C_Block_NumGuess.py | Python | mit | 1,546 |
#First case
#http://www.geeksforgeeks.org/root-to-leaf-path-sum-equal-to-a-given-number/
'''Print all the paths from root, with a specified sum in Binary tree - For that Second If condition'''
'''Print all the paths from root, with a specified node in Binary tree - For that first If condition'''
class Node:
def ... | saurbkumar/programming_question_python | my_question/binary-tree-all-path-to-given-sum.py | Python | apache-2.0 | 1,163 |
# Copyright 2011 VMware, 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 a... | noironetworks/neutron | neutron/common/exceptions.py | Python | apache-2.0 | 5,937 |
#
# 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... | nathanielvarona/airflow | airflow/contrib/operators/bigquery_to_mysql_operator.py | Python | apache-2.0 | 1,219 |
from ppp_datamodel import Missing, Triple, Resource, List
from ppp_datamodel.communication import Request, TraceItem, Response
from ppp_libmodule.tests import PPPTestCase
from ppp_osm import app
class TestLocation(PPPTestCase(app)):
config_var = 'PPP_OSM_CONFIG'
config = '{"search_api": "http://nominatim.opens... | ProjetPP/PPP-OSM | tests/test_locations.py | Python | mit | 1,188 |
import unittest
class Solution:
# @param n, an integer
# @return an integer
def reverseBits(self, n):
# Hacker's Delight, Figure 7-1
# See OpenJDK Integer.reverse():
# https://github.com/openjdk/jdk/blob/f37d9c8abca50b65ed232831a06d60c1d015013f/src/java.base/share/classes/java/lang... | chrisxue815/leetcode_python | problems/test_0190.py | Python | unlicense | 899 |
#!/usr/local/bin/python3
def main():
for i in range(1, 8):
print("============================")
print("Towers of Hanoi: {} Disks".format(i))
towers_of_hanoi(i)
print("Number of moves: {}".format(2**i - 1))
print("============================")
return 0
def towers_of... | HKuz/Test_Code | Problems/towersOfHanoi.py | Python | mit | 866 |
from __future__ import division
import config
import re
from nltk.metrics import BigramAssocMeasures
from nltk.probability import FreqDist, ConditionalFreqDist
from nltk.tokenize.regexp import RegexpTokenizer
from nltk.corpus.reader import CategorizedPlaintextCorpusReader as Reader
class PolarityDataReader(object):
... | abilng/MTech-Assignments | NLP/Assign2/corpusReader.py | Python | mit | 6,610 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, publish... | rwl/PyCIM | CIM14/ENTSOE/Equipment/Wires/RatioTapChanger.py | Python | mit | 3,214 |
#!/usr/bin/env python
"""
@package DetectLanguage.reuters
a generic method to retrieve text from the reuters corpus
"""
from __future__ import print_function
# -----------------------------------------------------------------------
# - (C)opyright 2009 by Albert Weichselbraun <[email protected]>
# - ... | weblyzard/ewrt | src/eWRT/input/corpus/reuters/reuters.py | Python | gpl-3.0 | 3,154 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'test-inherits-depends',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to verify the inheritance using _inherits in non-original modules.""",
'depends': ['test_inherits'],
'data': [],... | ddico/odoo | odoo/addons/test_inherits_depends/__manifest__.py | Python | agpl-3.0 | 375 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. William H. Green ([email protected]) and the
# RMG Team ([email protected])
#
# Permission is hereby granted, free of c... | faribas/RMG-Py | rmgpy/data/kinetics/family.py | Python | mit | 100,418 |
# -*- coding: utf-8 -*-
from io import BytesIO
import pytest
from translate.convert import po2ical, test_convert
class TestPO2Ical:
ConverterClass = po2ical.po2ical
def _convert(self, input_string, template_string=None, include_fuzzy=False,
output_threshold=None, success_expected=True):
... | unho/translate | translate/convert/test_po2ical.py | Python | gpl-2.0 | 11,412 |
import logging
import time
import aexpect
from autotest.client.shared import error
from autotest.client.shared import utils
from virttest import utils_net
@error.context_aware
def run(test, params, env):
"""
Run two vms on one host. Disable network on the second vm and send
infinite ping -b -s 1472 on ... | swapnakrishnan2k/tp-qemu | qemu/tests/ping_kill_test.py | Python | gpl-2.0 | 4,972 |
from __future__ import unicode_literals
from django.db.models import signals
from django.dispatch import receiver
from django.test import TestCase
from django.utils import six
from .models import Person, Car
# #8285: signals can be any callable
class PostDeleteHandler(object):
def __init__(self, data):
... | denisenkom/django | tests/signals/tests.py | Python | bsd-3-clause | 5,273 |
# -*- coding: utf-8 -*-
# (c) 2017 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import test_sale_order_create_event_session_number
| avanzosc/event-wip | sale_order_create_event_session_number/tests/__init__.py | Python | agpl-3.0 | 190 |
"""
======================================
Generalized hyperfine component fitter
======================================
.. moduleauthor:: Adam Ginsburg <[email protected]>
Module API
^^^^^^^^^^
"""
import numpy as np
from astropy import units as u
from astropy import constants
import copy
from . import model... | low-sky/pyspeckit | pyspeckit/spectrum/models/hyperfine.py | Python | mit | 17,963 |
s = rf"f<caret>oo{'bar'}"
| siosio/intellij-community | python/testData/intentions/convertingRawFStringQuotes_after.py | Python | apache-2.0 | 26 |
import pytest
import os.path
import fs
from .setup import *
def test_rm_file():
if (not os.path.exists(TEST_FILE)):
raise ValueError("File %s does not exist!" % TEST_FILE)
if (not os.path.exists(TEST_FILE_2)):
raise ValueError("File %s does not exist!" % TEST_FILE_2)
fs.rmfiles([TEST_FIL... | chaosmail/python-fs | fs/tests/test_rmfiles.py | Python | mit | 431 |
# -*- coding: utf-8 -*-
'''
O=============================================================================O
relatives that can't take remain (taasib) :
o mother
o maternal_grandmother
o paternal_grandmother
o husband
o wife
o maternal_brother
o maternal_sister
relatives non eligible for inheritance :
o mothe... | abougouffa/pyIslam | pyIslam/mirath.py | Python | lgpl-3.0 | 33,280 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.version import Version
from twilio.rest.preview.trusted_comms.branded_call import BrandedCallList
from twilio.rest.preview.trusted_comms.cps import CpsList
from twilio.rest.preview.t... | tysonholub/twilio-python | twilio/rest/preview/trusted_comms/__init__.py | Python | mit | 2,500 |
# coding= utf-8
# Copyright (c) 2015 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | obulpathi/poppy | tests/api/admin/test_perform_action.py | Python | apache-2.0 | 29,784 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from tarrasque import *
import sys
from ..config.api import get_match_details
from ..config.db import db
from collections import defaultdict
from utils import HeroNameDict, unitIdx
from parser import Parser, run_single_parser
from preparsers import GameStartTime, PlayerHeroMap... | grschafer/alacrity | alacrity/parsers/hero_position.py | Python | mit | 2,027 |
from django.contrib import admin
from reversion.admin import VersionAdmin
from profiles.models import Profile
def username(obj):
return (obj.user.username)
username.short_description="User username"
def user_email(obj):
return (obj.user.email)
username.short_description="User email"
class ProfileAdmin(Vers... | audreyr/opencomparison | profiles/admin.py | Python | mit | 528 |
# -*- coding: utf-8 -*-
# Python 2.7.8
"""
Author:
Isaac Sanchez Ruiz
[email protected]
Copyright (C) 2014 Isaac Sanchez Ruiz
This file is part of SimpleRoboticsFramework.
RobotSimFramework is free software: you can redistribute it and/or modify
it under the terms of the Lesser GNU General Public Licen... | MioGit/RobotSimFramework | planner.py | Python | gpl-3.0 | 14,123 |
#!/usr/bin/python
_author_ = "Matthew Zheng"
_purpose_ = "Sets up the unit class"
class Unit:
'''This is a class of lists'''
def __init__(self):
self.baseUnits = ["m", "kg", "A", "s", "K", "mol", "cd", "sr", "rad"]
self.derivedUnits = ["Hz", "N", "Pa", "J", "W", "C", "V", "F", "ohm", "S", "Wb",... | MatthewZheng/UnitsPlease | unitClass.py | Python | mit | 3,134 |
# -*- coding: utf-8 -*-
"""
This module contains the tool of birdhousebuilder.recipe.pywps
"""
from setuptools import find_packages
from setuptools import setup
name = 'birdhousebuilder.recipe.pywps'
version = '0.10.0'
description = 'A Buildout recipe to install and configure PyWPS Web Processing Service with conda.'... | bird-house/birdhousebuilder.recipe.pywps | setup.py | Python | apache-2.0 | 1,729 |
# Copyright (C) 2013 Daniel creo Haslinger <[email protected]>
# Derived from plcscan by Dmitry Efanov (Positive Research)
#
# 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 versio... | 0x0mar/conpot | conpot/tests/helpers/s7comm_client.py | Python | gpl-2.0 | 13,622 |
#!/usr/bin/env python
from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('integrate', parent_package, top_path)
config.add_sconscript('SConstruct')
config.add_data_dir('tests')
return config
if... | stefanv/scipy3 | scipy/integrate/setupscons.py | Python | bsd-3-clause | 437 |
# scripts can set this to True before lrrbot.main is imported, if they want to
# be able to call utility functions without actually creating the bot object
FRAMEWORK_ONLY = False
| mrphlip/lrrbot | common/__init__.py | Python | apache-2.0 | 179 |
# -*- 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-os-config | google/cloud/osconfig_v1alpha/services/os_config_zonal_service/__init__.py | Python | apache-2.0 | 793 |
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print "You have %d cheeses!" % cheese_count
print "You have %d boxes of crackers!" % boxes_of_crackers
print "Man that's enough for party!"
print "Get a blanket.\n"
print "We can just give the function numbers directly:"
cheese_and_crackers(20, ... | mohitbs/mohitrepo | python/examples/lpthw/ex19_functions_variables.py | Python | gpl-2.0 | 684 |
from django.conf.urls import url
from . import views
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', views.forms ,name='forms'),
url(r'^save$', views.SaveForm ,name='saveforms'),
]
| TomoAnalytics/welcome | forms/urls.py | Python | gpl-3.0 | 210 |
"""yourcar URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | italopaiva/your.car | yourcar/yourcar/urls.py | Python | bsd-2-clause | 1,372 |
from django.conf.urls import patterns, include
from django.contrib import admin
from django.views.generic import TemplateView
admin.autodiscover()
urlpatterns = patterns('', (r'^weblog/', include('mysecuri.blog.urls')),
(r'^$', TemplateView.as_view(template_name="home.html")),
(r'^admin/doc/', include('djang... | jradd/Django-WIP | mysecuri/urls/base.py | Python | gpl-3.0 | 395 |
u'''
This module is an example Arelle controller in non-interactive mode
@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
from arelle import Cntlr
class CntlrEfmValidateExample(Cntlr.Cntlr):
def __init__(self):
super(self.__class__, self).__in... | sternshus/arelle2.7 | svr-2.7/arelle/examples/LoadEFMvalidate.py | Python | apache-2.0 | 1,110 |
## conversation_textview.py
##
## Contributors for this file:
## - Yann Le Boulanger <[email protected]>
## - Nikos Kouremenos <[email protected]>
##
## Copyright (C) 2003-2004 Yann Le Boulanger <[email protected]>
## Vincent Hanquez <[email protected]>
## Copyright (C) 2005 Yann Le Boulanger <as... | pacoqueen/bbinn | gajim-0.9.1/src/conversation_textview.py | Python | gpl-2.0 | 23,268 |
'''Example of autoencoder model on MNIST dataset
This autoencoder has modular design. The encoder, decoder and autoencoder
are 3 models that share weights. For example, after training the
autoencoder, the encoder can be used to generate latent vectors
of input data for low-dim visualization like PCA or TSNE.
Project... | roatienza/dl-keras | chapter4-autoencoders/autoencoder-mnist-4.2.1.py | Python | mit | 3,935 |
"""
Generic relations
Generic relations let an object have a foreign key to any object through a
content-type/object-id field. A ``GenericForeignKey`` field can point to any
object, be it animal, vegetable, or mineral.
The canonical example is tags (although this example implementation is *far*
from complete).
"""
f... | webostin/django-btc | tests/generic_relations/models.py | Python | bsd-3-clause | 4,228 |
##############################################################################
# Copyright (c) 2013-2017, 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... | skosukhin/spack | var/spack/repos/builtin/packages/xcb-util-wm/package.py | Python | lgpl-2.1 | 1,996 |
import requests
from backend.util.response.error import ErrorSchema
def test_order(domain_url, auth_session, es_create, willorders_ws_db_session):
prod_list = es_create("products", 2)
item_id = prod_list[0].meta["id"]
item_id2 = prod_list[1].meta["id"]
auth_session.post(
domain_url + "/api/c... | willrp/willbuyer | backend/tests/functional/api/cart/test_order.py | Python | mit | 1,226 |
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.deletion import ProtectedError
__all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address',
'CharLink', '... | blighj/django | tests/generic_relations_regress/models.py | Python | bsd-3-clause | 5,355 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import common
from . import test_mailing_internals
| ygol/odoo | addons/mass_mailing_sms/tests/__init__.py | Python | agpl-3.0 | 158 |
# -*- coding: utf-8 -*-
# © 2015 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp.tests.common import TransactionCase
class TestAuditlog(object):
def test_LogCreation(self):
"""First test, caching some data."""
auditlog_log = self.env['auditl... | initOS/server-tools | auditlog/tests/test_auditlog.py | Python | agpl-3.0 | 6,347 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.