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 |
|---|---|---|---|---|---|
# create own scenario and try to get the best possible strategy
import random
import math
class Strategy:
"""
Additional methods adding in choosing the right strategy
"""
def __init__(self):
"""
Constructor - unused
"""
pass
# deviation of current behavior ( - mor... | tgodzik/projects | blef/bastard.py | Python | apache-2.0 | 3,570 |
"""Base/null IIIF image manipulator.
Provides a number of utility methods to extract information necessary
for doing the transformations once one has knowledge of the source
image size.
"""
import logging
import os
import os.path
import re
import shutil
import subprocess
from .error import IIIFError, IIIFZeroSizeErr... | zimeon/iiif | iiif/manipulator.py | Python | gpl-3.0 | 15,198 |
# The MIT License (MIT)
#
# Copyright (c) 2017-2018 Niklas Rosenstein
#
# 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, ... | nodepy/nodepy | src/nodepy/extensions.py | Python | mit | 9,282 |
# Copyright 2015 VPAC
#
# This file is part of Karaage.
#
# Karaage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Karaage is dist... | Karaage-Cluster/karaage-debian | karaage/plugins/kgusage/graphs.py | Python | gpl-3.0 | 5,426 |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 6 23:59:59 2017
@author: Shabaka
"""
import sqlalchemy
# Import delete, select
from sqlalchemy import delete, select
# Build a statement to empty the census table: stmt
stmt = delete(census)
# Execute the statement: results
results = connection.execute(st... | qalhata/Python-Scripts-Repo-on-Data-Science | SQL_Delete_Table.py | Python | gpl-3.0 | 1,842 |
# -*- coding: utf8 -*-
from phystricks import *
def OYBTooNUcJLzDH():
pspict,fig = SinglePicture("OYBTooNUcJLzDH")
pspict.dilatation_X(2)
pspict.dilatation_Y(0.3)
x=var('x')
mx=0.5
Mx=3.5
f = phyFunction(3*(x-2)**2+3).graph(mx,Mx)
f.put_mark(0.3,text="f(x)=foo",pspict=pspict)
A=Poi... | LaurentClaessens/phystricks | testing/demonstration/phystricksOYBTooNUcJLzDH.py | Python | gpl-3.0 | 872 |
from nutils import *
from nutils.testing import *
class specialcases(TestCase):
def test_tensoredge_swapup_identifier(self):
lineedge = transform.SimplexEdge(1, 0, False)
for edge in transform.TensorEdge1(lineedge, 1), transform.TensorEdge2(1, lineedge):
with self.subTest(type(edge).__name__):
... | joostvanzwieten/nutils | tests/test_transform.py | Python | mit | 2,750 |
#!/usr/bin/env python
"""
* =========================================================================
* This file is part of sio.lite-python
* =========================================================================
*
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
*
* sio.lite-python is free softwar... | mdaus/coda-oss | modules/python/sio.lite/tests/test_read_sio.py | Python | lgpl-3.0 | 1,319 |
# Copyright (c) 2015 NTT, OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | openstack/congress | congress/tests/api/test_api_utils.py | Python | apache-2.0 | 2,124 |
# Copyright 2016 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... | plowman/python-mcparseface | models/inception/inception/imagenet_distributed_train.py | Python | apache-2.0 | 2,353 |
import myhdl
from myhdl import (Signal, intbv, concat, always, always_comb)
from . import SERDESInterface
@myhdl.block
def device_serdes_output_prim(serdes):
assert isinstance(serdes, SERDESInterface)
clockser, clockpar = (serdes.clock_serial,
serdes.clock_parallel)
nbits = ser... | cfelton/rhea | rhea/vendor/device_serdes_prim.py | Python | mit | 2,024 |
# Rhyme found in http://www.pitt.edu/~dash/type2035.html
import unittest
from house import rhyme, verse
class VerseTest(unittest.TestCase):
def test_verse_0(self):
expected = 'This is the house that Jack built.'
self.assertEqual(expected, verse(0))
def test_verse_1(self):
expected =... | GregMilway/Exercism | python/house/house_test.py | Python | gpl-3.0 | 6,048 |
"""
Processes the data from whatever format it was captured in and renders
it in a usable form to whoever's knocking.
"""
# Standard modules
import ConfigParser
import os
from os import path
import sys
# Third party
import numpy as N
def config(top_dir='.', debug=False):
# Parse the settings file, check for pro... | l3enny/lasana | parse.py | Python | mit | 4,091 |
"""
Tests for the Credit xBlock service
"""
from __future__ import absolute_import
import ddt
import six
from course_modes.models import CourseMode
from openedx.core.djangoapps.credit.api.eligibility import set_credit_requirements
from openedx.core.djangoapps.credit.models import CreditCourse
from openedx.core.djang... | ESOedX/edx-platform | openedx/core/djangoapps/credit/tests/test_services.py | Python | agpl-3.0 | 12,948 |
# A class capturing the platform's idea of local time.
from datetime import tzinfo, timedelta, datetime
import time as _time
ZERO = timedelta(0)
HOUR = timedelta(hours=1)
STDOFFSET = timedelta(hours=-5)
if _time.daylight:
DSTOFFSET = timedelta(seconds = -_time.altzone)
else:
DSTOFFSET = STDOFFSET
DSTDIFF = D... | gtracy/sms-reminders | timezone.py | Python | mit | 938 |
# Maestro is Copyright (C) 2006-2008 by Infiscape Corporation
#
# Original Author: Aron Bierbaum
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your ... | vrjuggler/maestro | maestro/util/winchecker.py | Python | gpl-2.0 | 2,466 |
"""Setup the nipap-www application"""
import logging
import pylons.test
from nipapwww.config.environment import load_environment
log = logging.getLogger(__name__)
def setup_app(command, conf, vars):
"""Place any commands to setup nipapwww here"""
# Don't reload the app if it was loaded under the testing env... | SoundGoof/NIPAP | nipap-www/nipapwww/websetup.py | Python | mit | 423 |
from datetime import datetime, timedelta
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.template.defaultfilters import slugify
from django.test import TestCase
from model_mommy import mommy
from goals.models import Goal, Subgoal
# Create your tests here.... | triump0870/mysana | src/goals/tests.py | Python | mit | 5,944 |
#!/usr/bin/env python
from socketIO_client import SocketIO, BaseNamespace
from gimpfu import *
import os
import time
from threading import Thread
from array import array
import requests
import configparser
import websocket
import _thread
import http.client
class GimpHubImage(object):
def __init__(self, drawabl... | Jolopy/GimpHub | app/Gimp_Plugins_Bak/continious_test.py | Python | gpl-2.0 | 10,833 |
"""
-------------------------------------------------------
color
a module to determine the chromatic number of a graph
-------------------------------------------------------
Author: Dallas Fraser
ID: 110242560
Email: fras2560@mylaurier.ca
Version: 2014-09-17
---------------------------------------------------... | fras2560/graph-helper | algorithms/color.py | Python | apache-2.0 | 14,060 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('users', '0001_initial'),
('vice',... | ViceVersusMe/ViceVersus | ViceVersus/users/migrations/0002_auto_20151122_1214.py | Python | mit | 713 |
from unittest import TestCase
import pandas as pd
import numpy as np
from scattertext.termscoring.BM25Difference import BM25Difference
from scattertext.test.test_termDocMatrixFactory import build_hamlet_jz_corpus
class TestBM25Difference(TestCase):
@classmethod
def setUpClass(cls):
cls.corpus = build_hamlet_jz_... | JasonKessler/scattertext | scattertext/test/test_BM25Difference.py | Python | apache-2.0 | 692 |
#! /usr/bin/env python
import json
import os.path
from keyword import iskeyword
codegen_dir = os.path.join(os.path.dirname(__file__), '..')
json_source = os.path.join(os.path.dirname(__file__),
'amqp-rabbitmq-0.9.1.json')
def gen_constant(specs):
constants_filename = os.path.join(code... | bufferx/stormed-amqp | stormed/method/codegen/tools/build.py | Python | mit | 3,822 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest import TestCase
import simplejson as S
class TestDefault(TestCase):
def test_default(self):
self.assertEquals(
S.dumps(type, default=repr),
S.dumps(repr(type)))
| cria/microSICol | py/simplejson/tests/test_default.py | Python | gpl-2.0 | 261 |
import imp
import os
import unittest
from nose.plugins.attrib import attr
parameter_functions_py = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'../zuul/parameter_functions.py')
imp.load_source('zuul_config', parameter_functions_py)
import zuul_config
class GatedRepos(set):
def __repr__(sel... | wikimedia/integration-config | tests/test_zuul_gate_and_dependencies.py | Python | gpl-2.0 | 1,455 |
from django.core.exceptions import ValidationError
from amweekly.slack.tests.factories import SlashCommandFactory
import pytest
pytest.mark.unit
def test_slash_command_raises_with_invalid_token(settings):
settings.SLACK_TOKENS = ''
with pytest.raises(ValidationError):
SlashCommandFactory()
| akrawchyk/amweekly | amweekly/slack/tests/test_models.py | Python | mit | 313 |
#!/usr/bin/python
#coding:utf-8
import struct
# struct 可以解析打包的二进制数据
f = open('data.bin', 'wb')
data = struct.pack('dafei', 7, 'xiaoming', 'xiaoj', 999)
print data
f.write(data)
f.close() | gensmusic/test | l/python/book/learning-python/t-struct.py | Python | gpl-2.0 | 213 |
# Generated by Django 2.0.13 on 2020-10-14 16:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("ddcz", "0035_wizard_spells"),
]
operations = [
migrations.RenameModel(
old_name="Kouzla",
new_name="WizardSpell",
)... | dracidoupe/graveyard | ddcz/migrations/0036_wizard_spells_rename.py | Python | mit | 328 |
import base64
import binascii
from cloudbot import hook
def encode(password, text):
"""
:type password: str
:type text: str
"""
enc = []
for i in range(len(text)):
key_c = password[i % len(password)]
enc_c = chr((ord(text[i]) + ord(key_c)) % 256)
enc.append(enc_c)
... | CrushAndRun/Cloudbot-Fluke | plugins/cypher.py | Python | gpl-3.0 | 1,533 |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation ... | arseneyr/essentia | test/src/unittest/standard/test_stereodemuxer.py | Python | agpl-3.0 | 1,657 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ItemWebsiteSpecification(Document... | indictranstech/focal-erpnext | stock/doctype/item_website_specification/item_website_specification.py | Python | agpl-3.0 | 328 |
# 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... | krummas/cassandra | pylib/cqlshlib/test/run_cqlsh.py | Python | apache-2.0 | 12,156 |
from zstacklib.utils import plugin
from zstacklib.utils import http
from zstacklib.utils import shell
from zstacklib.utils import log
from zstacklib.utils import jsonobject
from zstacklib.utils import daemon
from zstacklib.utils import linux
from zstacklib.utils import filedb
from zstacklib.utils import lock
i... | SoftwareKing/zstack-utility | consoleproxy/consoleproxy/console_proxy_agent.py | Python | apache-2.0 | 9,939 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import cvn.helpers
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20141008_0853'),
('cvn', '0003_auto_20141217_1109'),
]
operations = [
migration... | tic-ull/portal-del-investigador-cvn | migrations/0004_oldcvnpdf.py | Python | agpl-3.0 | 1,660 |
# Copyright 2017 Square, 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,... | square/pylink | tests/unit/test_main.py | Python | apache-2.0 | 25,414 |
from __future__ import unicode_literals
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.test import TestCase
from django.utils import six
from .models import Author, Book, Car, Person
class BaseSignalTest(TestCase):
def setUp(self):
# Sa... | lecaoquochung/ddnb.django | tests/signals/tests.py | Python | bsd-3-clause | 9,808 |
# Copyright (c) 2008 The Hewlett-Packard Development Company
# 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... | hoangt/tpzsimul.gem5 | src/python/m5/config.py | Python | bsd-3-clause | 2,085 |
###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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
##
## ht... | frivoal/presto-testo | wpt/websockets/autobahn/oberstet-Autobahn-643d2ee/lib/python/autobahn/case/case3_1.py | Python | bsd-3-clause | 1,350 |
"""
Module to handle custom colormaps.
`cmap_powerlaw_adjust`, `cmap_center_adjust`, and
`cmap_center_adjust` are from
https://sites.google.com/site/theodoregoetz/notes/matplotlib_colormapadjust
"""
import math
import copy
import numpy
import numpy as np
from matplotlib import pyplot, colors, cm
import matplotlib
imp... | agrimaldi/metaseq | metaseq/colormap_adjust.py | Python | mit | 5,162 |
# Copyright (c) 2016 IBM Corporation
# 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 req... | j-griffith/cinder | cinder/volume/drivers/ibm/ibm_storage/__init__.py | Python | apache-2.0 | 4,647 |
import sgplan
factfile = '/home/henrysky/Research/plantool/plantool/code/Deterministic/SGplan/seq-sat-sgplan6/fixit_ops.pddl'
operatorfile = '/home/henrysky/Research/plantool/plantool/code/Deterministic/SGplan/seq-sat-sgplan6/domain_ops.pddl'
sgplan.run(['sgplan', '-f', factfile, '-o', operatorfile, '-out', 'result.... | PlanTool/plantool | wrappingPlanners/Deterministic/SGPlan/test.py | Python | gpl-2.0 | 381 |
# $Id: lazy.py,v 1.5.2.1 2007/05/22 20:23:38 customdesigned Exp $
#
# This file is part of the pydns project.
# Homepage: http://pydns.sourceforge.net
#
# This code is covered by the standard Python License.
#
# routines for lazy people.
import Base
import string
def revlookup(name):
"convenience routine for doin... | chirilo/remo | vendor-local/lib/python/DNS/lazy.py | Python | bsd-3-clause | 1,487 |
"""Convert validated COLO-829 calls from Excel spreadsheets into VCF.
http://www.nature.com/nature/journal/v463/n7278/full/nature08658.html
Usage:
colo2vcf.py <nature08658-s2.xls> <nature08658-s3.xls> <fasta ref file>
"""
import sys
import pandas as pd
from pyfaidx import Fasta
def main(snp_file, indel_file, ref_... | hbc/tumor-only-prioritization | scripts/colo2vcf.py | Python | mit | 2,695 |
'''
Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
This is the message envelope. It is really just a dictionary, but we want to
pre-define the allowable keys.
Created on Apr 3, 2014
@author: dfleck
'''
import datetime
class Envelope(dict):
'''
T... | danfleck/Class-Chord | network-client/src/gmu/netclient/envelope.py | Python | apache-2.0 | 3,399 |
from cauldron.test import support
from cauldron.test.support.messages import Message
from cauldron.test.support import scaffolds
class TestConfigure(scaffolds.ResultsTest):
"""..."""
def test_list_all(self):
"""Should list configurations."""
response = support.run_command('configure --list')... | sernst/cauldron | cauldron/test/cli/commands/test_configure.py | Python | mit | 2,677 |
# coding: utf-8
def get_ax_fig_plt(ax=None, **kwargs):
"""
Helper function used in plot functions supporting an optional Axes argument.
If ax is None, we build the `matplotlib` figure and create the Axes else
we return the current active figure.
Args:
kwargs: keyword arguments are passed t... | abinit/abinit | tests/pymods/plotting.py | Python | gpl-3.0 | 6,772 |
# -*- coding: utf-8 -*-
# Copyright 2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This progra... | borisroman/vdsm | vdsm/network/tc/_parser.py | Python | gpl-2.0 | 3,380 |
import bincalc
function_mapper = {
int: bincalc.bytesToNumber,
long: bincalc.bytesToNumber,
unicode: bincalc.byteArrayToUnicode, # unicode(bytearray.decode("utf-8"))
# str: does not need conversion, works directly
}
class BinaryDecoder:
# final item dictionary. key:index, value:bytearray
item... | metachris/binary-serializer | python/decoder.py | Python | mit | 2,687 |
## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" Convert a binary archive into a qiBuild package and add it to a toolchain.
"""
import os
from qisys import ui
import qisys.parsers
import qi... | dmerejkowsky/qibuild | python/qitoolchain/actions/import_package.py | Python | bsd-3-clause | 2,459 |
###
# Copyright (c) 2009, Paul V
# 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 t... | kg-bot/SupyBot | plugins/HacklabNextbus/test.py | Python | gpl-3.0 | 1,742 |
import os
import sys
import tempfile
import time
import shutil
import aexpect
import psutil
if sys.version_info[:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
from avocado.utils import wait
from avocado.utils import process
from avocado.utils import script
from avocado.utils import data_fa... | Hao-Liu/avocado | selftests/functional/test_interrupt.py | Python | gpl-2.0 | 5,426 |
"""
WSGI config for django_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", "django_webapp.settings")
from d... | koehlma/pygrooveshark | examples/django_webapp/django_webapp/wsgi.py | Python | lgpl-3.0 | 401 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (http://tiny.be). All Rights Reserved
#
#
# This program is free software: you can redistribute it and/or modify
# ... | avanzosc/avanzosc6.1 | avanzosc_product_category_ext/__openerp__.py | Python | agpl-3.0 | 1,543 |
# 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 use ... | vongazman/libcloud | libcloud/container/drivers/kubernetes.py | Python | apache-2.0 | 13,004 |
import os
import discord
from discord.ext import commands
from cogs.utils import checks
from cogs.utils.dataIO import dataIO
class TrustRole:
"""
Assign roles based on trust rating
"""
def __init__(self, bot):
self.bot = bot
self.file_path = "data/trustrole/trust_data.json"
... | bobloy/Fox-Cogs | trustrole/trustrole.py | Python | agpl-3.0 | 6,462 |
from datetime import datetime
import os
from django.conf import settings
from django.core.files.storage import default_storage
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from ckedi... | makinacorpus/django-ckeditor | ckeditor/views.py | Python | bsd-3-clause | 3,866 |
# -*- coding: UTF-8 -*-
"""
LambdaScrapers Module
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This... | RuiNascimento/krepo | script.module.lambdascrapers/lib/lambdascrapers/modules/debrid.py | Python | gpl-2.0 | 2,055 |
# -*- coding: utf-8 -*-
import sys
import os.path
import subprocess
import json
import string
import tempfile
import shutil
import threading
import exceptions
import errno
from collections import defaultdict
from xml.etree import ElementTree
import nixops.statefile
import nixops.backends
import nixops.logger
import ni... | abuibrahim/nixops | nixops/deployment.py | Python | lgpl-3.0 | 50,217 |
import copy
import random
from six import text_type
import time
from unittest import TestCase, skipIf
import warnings
import mongomock
try:
import pymongo
from pymongo import ReturnDocument
_HAVE_PYMONGO = True
except ImportError:
_HAVE_PYMONGO = False
warnings.simplefilter('ignore', DeprecationWarn... | marcinbarczynski/mongomock | tests/test__collection_api.py | Python | bsd-3-clause | 28,411 |
# This module provides a base class for maintaining a single replicated
# value via multi-paxos. The responsibilities of this class are:
#
# * Loading and saving the state to/from disk
# * Maintaining the integrity of the multi-paxos chain
# * Bridging the composable_paxos.PaxosInstance object for the current ... | cocagne/multi-paxos-example | replicated_value.py | Python | mit | 8,017 |
# -*- coding: utf-8 -*-
# This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2014 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.... | kgao/MediaDrop | mediadrop/lib/tests/helpers_test.py | Python | gpl-3.0 | 1,256 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.task_router import TaskRouterTaskQueueCapability
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXX... | teoreteetik/api-snippets | rest/taskrouter/jwts/taskqueue/example-1/example-1.5.x.py | Python | mit | 819 |
# -*- coding: utf-8 -*-
# Copyright 2007-2021 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | erh3cq/hyperspy | hyperspy/extensions.py | Python | gpl-3.0 | 2,975 |
"""RSP board register access functions
def rspctl(tc, arg, applev=22)
def rspctl_write_sleep()
def i2bb(s)
def i2bbbb(s)
def swap2(s)
def swap4(s)
def calculate_next_sequence_value(in_word, seq='PRSG', width=12)
def reorder(data, index)
def write_mem(tc, msg, pid, regid, data, blpId=['blp0'], r... | jjdmol/LOFAR | LCU/StationTest/modules/rsp.py | Python | gpl-3.0 | 83,864 |
from conceptnet.models import *
from piston.handler import BaseHandler
from piston.doc import generate_doc
from conceptnet.webapi import handlers
from django.test.client import Client
from django.shortcuts import render_to_response
from django.template import RequestContext, Context, loader
from django.http import Htt... | riseofthetigers/conceptnet | conceptnet/webapi/docs.py | Python | gpl-2.0 | 1,890 |
from deployer.utils import isclass
from deployer.host_container import HostsContainer
__all__ = ('ALL_HOSTS', 'map_roles', 'DefaultRoleMapping', )
class _MappingFilter(object):
def __init__(self, name):
self._name = name
def __repr__(self):
return self._name
ALL_HOSTS = _MappingFilter('ALL... | jonathanslenders/python-deployer | deployer/node/role_mapping.py | Python | bsd-2-clause | 3,312 |
from SemanticTag import *
"""A TimeSemanticTag represents a time period in which a piece of information is relevant"""
class TimeSemanticTag(SemanticTag):
time = None #the starting time of the time period
duration = None #the duration of the time period
def __init__(self, name, si, time, duration):
... | SharedKnowledge/SharkPython | shark-python/TimeSemanticTag.py | Python | agpl-3.0 | 751 |
#!/usr/bin/env python
"""
Proxy front end to the dcc server
"""
import os
from eve import Eve
from flask import request, jsonify, Response, abort
from flask_cors import CORS
from flask import redirect, render_template
# our utilities
from keystone_authenticator import BearerAuth
import eve_util
import dcc_proxy
def... | ohsu-computational-biology/euler | services/api/run.py | Python | mit | 8,547 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import errno
import json
from uuid import uuid4
import shutil
import math
import logging
from subprocess import check_output, CalledProcessError
from .config import ConfigManager
config = ConfigManager.instance()
logger = logging.getLogger(__n... | lavalamp-/ws-backend-community | lib/filesystem.py | Python | gpl-3.0 | 16,528 |
# coding: utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from protocolle.core.models import (TipoInstituicao, Grupo, STATE_CHOICES)
class Pessoa(models.Model):
nome = models.CharField(_(u'Nome'), max_length=200)
email = ... | klebercode/protocolle | protocolle/auxiliar/models.py | Python | mit | 5,213 |
num = 1
num2 = 2
print("A subtração de", num, "e", num2, "é igual á:", num num2); | gkal19/myPythonCourse | 03-math/subtr.py | Python | mit | 87 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 vers... | markovmodel/PyEMMA | pyemma/coordinates/clustering/tests/test_mini_batch_kmeans.py | Python | lgpl-3.0 | 3,202 |
#!/usr/bin/env python
""" load metabolome into OSDF using info from data file """
import os
import re
from cutlass.Metabolome import Metabolome
import settings
from cutlass_utils import \
load_data, get_parent_node_id, list_tags, format_query, \
write_csv_headers, values_to_node_dict, write_out_csv, ... | JAX-GM/osdf_submit | nodes/metabolome.py | Python | gpl-3.0 | 5,275 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2019 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | chipaca/snapcraft | tests/unit/commands/test_export_login.py | Python | gpl-3.0 | 7,931 |
from __future__ import unicode_literals
from django.template import Context, Template
from django.test import SimpleTestCase, ignore_warnings
from django.utils import html, six, text
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_bytes
from django.utils.functional... | loic/django | tests/utils_tests/test_safestring.py | Python | bsd-3-clause | 4,933 |
import sys
import os.path
import logging
logger = logging.getLogger('server')
try:
import supp
except ImportError:
old_path = sys.path[:]
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
try:
import supp
finally:
sys.path = old_path
from supp import assistant, linter... | baverman/supp | supp/server.py | Python | mit | 3,201 |
__author__ = 'skeen'
import pylast
import sys
KEY_FILE_NAME = "lastfm.keyinfo"
keyfile = open(KEY_FILE_NAME)
apiKey = keyfile.readline().strip()
apiSecret = keyfile.readline().strip()
# print apiKey
#print apiSecret
keyfile.close()
network = pylast.LastFMNetwork(api_key=apiKey, api_secret=apiSecret)
artist = net... | shawnkeen/radio-playlists | lookup.py | Python | mit | 555 |
from django.shortcuts import render
from xh4x0r3r_blog.articles.models import Article
from xh4x0r3r_blog.utils import db, build_args
def index (request) :
quote = db.get_random_quote()
articles = {"Top posts" : db.get_top_articles(),
"Latests" : db.get_latest_articles()}
# removing colli... | xh4x0r3r/xh4x0r3r_blog | xh4x0r3r_blog/core/views.py | Python | gpl-3.0 | 932 |
import collections
import numpy as np
import openpnm as op
import openpnm.models.physics as pm
from numpy.testing import assert_allclose
from sympy import ln as sym_ln
from sympy import symbols
class GenericSourceTermTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[5, 5, 5])
Ps = se... | TomTranter/OpenPNM | tests/unit/models/physics/GenericSourceTermTest.py | Python | mit | 16,406 |
# -*- coding: utf-8 -*-
import errno
import logging
import os
import signal
import sys
import time
import traceback
from rq.connections import Connection, get_current_connection
from rq.exceptions import NoQueueError, UnpickleError, DequeueTimeout
from rq.job import Job, Status
from rq.logutils import setup_loghandlers... | matrixise/rq-arbiter | arbiter.py | Python | mit | 5,469 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import foo
import test1
import test2 | baixuexue123/note | python/basics/packages/conf/__init__.py | Python | bsd-2-clause | 83 |
import unittest
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # Insanity for getting parent folder in path
from geojson_extent import geojson_extent
class TestGeoJsonExtent(unittest.TestCase):
"""Tests geojson extent return correct extent for geojson file"""
de... | joykuotw/tiler | tiler/tiler-scripts/tests/test_geojson_extent.py | Python | mit | 689 |
from .client import RGApiClient
__all__ = ['RGApiClient']
| alex-pyasetskiy/rgapi | rgapi/__init__.py | Python | mit | 59 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2017 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licen... | ndp-systemes/odoo-addons | stock_change_quant_lot/stock_change_quant_lot.py | Python | agpl-3.0 | 3,168 |
# Copyright 2015 Abhijit Menon-Sen <ams@2ndQuadrant.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | ownport/ansiblite | src/ansiblite/parsing/utils/addresses.py | Python | gpl-3.0 | 8,160 |
from odoo import http
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
class PosWebsiteSale(http.Controller):
@http.route(["/shop/get_order_numbers"], type="json", auth="public", website=True)
def get_order_numbers(self):
res = {}
order = request... | it-projects-llc/website-addons | website_sale_add_to_cart/controllers/website_sale_add_to_cart.py | Python | mit | 971 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import ctypes
from distutils import version
import fnmatch
import glob
import hashlib
import logging
import os
import p... | plxaye/chromium | src/chrome/test/functional/nacl_sdk.py | Python | apache-2.0 | 28,639 |
from utils import load_json, write_json
COUNTS_FILE = "data_files/counts.json"
def update_user_counts(user, count_dict):
"""
return a dict of a user's total word counts so far,
pass an empty dict to clear the counts for that user
"""
# TODO this will all change once we switch to a db
all_use... | jkvoorhis/cheeseburger_backpack_bot | utils/db.py | Python | apache-2.0 | 1,140 |
# Copyright 2014 Alcatel-Lucent USA Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | nuagenetworks/nuage-openstack-neutron | nuage_neutron/plugins/common/config.py | Python | apache-2.0 | 6,133 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Thomas Scholtes.
#
# 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 ... | kelvinhammond/beets | test/test_keyfinder.py | Python | mit | 2,610 |
#!/usr/bin/env python
# Copyright 2015 Initios Desarrollos
#
# All rights reserved
import os
import setuptools
base_dir = os.path.dirname(__file__)
about = {}
with open(os.path.join(base_dir, 'junit_conversor', '__about__.py')) as f:
exec(f.read(), about)
with open(os.path.join(base_dir, 'README.rst')) as read... | initios/flake8-junit-report | setup.py | Python | bsd-3-clause | 1,331 |
import sys
import traceback
from dataactcore.utils.cloudLogger import CloudLogger
from dataactbroker.handlers.errorHandler import ErrorHandler
from dataactbroker.handlers.jobHandler import JobHandler
from dataactbroker.handlers.userHandler import UserHandler
class InterfaceHolder:
""" This class holds an interface... | fedspendingtransparency/data-act-broker | dataactbroker/handlers/interfaceHolder.py | Python | cc0-1.0 | 1,761 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# Author: "Chris Ward" <cward@redhat.com>
'''
metrique.cubes.gitdata.commits
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains the generic metrique cube used
for exctacting commit data from a git repository.
'''
fr... | kejbaly2/metrique | metrique/cubes/gitdata/commit.py | Python | gpl-3.0 | 4,747 |
from matplotlib import pyplot as plt
from cern.jpymad import JPymadService as pm
# this one line does it "all":
# - starts madx
# - loads model lhc, default parameters
# - runs twiss on default sequence
# - returns the twiss table as a python lookup dictionary
# - since "reference count" for the model instance reaches... | pymad/jpymad | demo/ipac11/one_line_to_rule_them_all.py | Python | apache-2.0 | 449 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial Lice... | qtproject/pyside-shiboken | tests/samplebinding/time_test.py | Python | gpl-2.0 | 5,497 |
import asyncio
import sys
import threading
import httpx
import pytest
from a2wsgi.wsgi import Body, WSGIMiddleware, build_environ
def test_body():
event_loop = asyncio.new_event_loop()
threading.Thread(target=event_loop.run_forever, daemon=True).start()
async def receive():
return {
... | abersheeran/a2wsgi | tests/test_wsgi.py | Python | apache-2.0 | 5,519 |
from django.test import TestCase
from . models import *
from www.settings import TIME_ZONE
class Dummy(AbstractAuditModel):
current_revision = models.ForeignKey('DummyRevision', null=True, default=None)
immutable_field = models.CharField(max_length=100)
class DummyRevision(AbstractRevision):
tracked_mod... | sheanmassey/django-audit-trails | django_audit/tests.py | Python | unlicense | 1,845 |
#This test the definitional nonces on sum.
#python3 test_def_nonces.py spaces/ukwac_reduced.txt /definitions/nonce.definitions.300.test
import sys
import re
import utils
background = sys.argv[1]
dataset = sys.argv[2]
mrr = 0.0
human_responses = []
system_responses = []
dm_dict = utils.readDM(background)
c = 0
f=op... | minimalparts/Tutorials | FastMapping/test_def_nonces.py | Python | mit | 1,016 |
# -*- coding: utf-8 -*-
version="0.2.5"
# plugins/IrfanView/__init__.py
#
# Copyright (C) 2007 Pako <lubos.ruckl@quick.cz>
#
# This file is a plugin for EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost is free software: you can redistribute it and/or modify it under... | WoLpH/EventGhost | plugins/IrfanView/__init__.py | Python | gpl-2.0 | 55,867 |
from random import uniform
import math
class Perceptron (object):
"""
Clase Perceptron para modelar un perceptón.
"""
def __init__ (self, n, activacion, tasa_aprendizaje = 0.1, error = 0.1):
"""
Inicializa un perceptrón con una cantidad fija de pesos para las
entradas, establecidos como números aleatorios e... | Gilberto-Lopez/Inteligencia-Artificial | Practica06/perceptron.py | Python | lgpl-3.0 | 3,264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.