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 -*-
import pytest
import os
from tempfile import mkdtemp
from wasp_launcher.version import revision
@pytest.fixture()
def cwd(request):
curdir = os.getcwd()
def fin():
os.chdir(curdir)
request.addfinalizer(fin)
@pytest.mark.usefixtures('cwd')
def test_revision(tmpdir):
revision()
os.ch... | a1ezzz/wasp-launcher | tests/wasp_launcher_version_test.py | Python | lgpl-3.0 | 368 |
#
# Copyright (C) 2010-2014 Stanislav Bohm
# 2011 Ondrej Garncarz
# 2012 Martin Surkovsky
#
# This file is part of Kaira.
#
# Kaira is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | Kobzol/kaira | gui/net.py | Python | gpl-3.0 | 39,085 |
#!/usr/bin/env python2.7
from nltk.book import *
print text4.collocations()
print
print text8.collocations() | prinsmike/nltk_book | ch01/17-collocations.py | Python | apache-2.0 | 110 |
#
# Copyright 2017 CNIT - Consorzio Nazionale Interuniversitario per le Telecomunicazioni
#
# 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/LICE... | superfluidity/RDCL3D | code/lib/oshi/oshi_rdcl_graph.py | Python | apache-2.0 | 2,216 |
"""engine.SCons.Variables.ListVariable
This file defines the option type for SCons implementing 'lists'.
A 'list' option may either be 'all', 'none' or a list of names
separated by comma. After the option has been processed, the option
value holds either the named list elements, all list elemens or no
list elements a... | cournape/numscons | numscons/scons-local/scons-local-1.2.0/SCons/Variables/ListVariable.py | Python | bsd-3-clause | 4,560 |
# Copyright (C) 2002-2005 Stephen Kennedy <[email protected]>
# Copyright (C) 2011-2013, 2015 Kai Willadsen <[email protected]>
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code... | yousseb/meld | meld/vc/svn.py | Python | gpl-2.0 | 7,923 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | eLBati/odoo | addons/document/document.py | Python | agpl-3.0 | 83,826 |
#!/usr/bin/env python
# coding: utf-8
# Datasets
# ============================
#
# Datasets tell PHOEBE how and at what times to compute the model. In some cases these will include the actual observational data, and in other cases may only include the times at which you want to compute a synthetic model.
#
# Addin... | phoebe-project/phoebe2-docs | development/tutorials/datasets.py | Python | gpl-3.0 | 8,874 |
import asyncio
import functools
import logging
import re
import signal
import sys
from unittest.mock import MagicMock
import msgpack
import pytest
from arq.connections import ArqRedis, RedisSettings
from arq.constants import abort_jobs_ss, default_queue_name, health_check_key_suffix, job_key_prefix
from arq.jobs impo... | samuelcolvin/arq | tests/test_worker.py | Python | mit | 31,932 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from hyputils.memex.util import markdown
class TestRender(object):
def test_it_renders_markdown(self):
actual = markdown.render("_emphasis_ **bold**")
assert "<p><em>emphasis</em> <strong>bold</strong></p>\n" == actua... | tgbugs/hypush | test/memex/util/markdown_test.py | Python | mit | 3,893 |
# -*- coding: utf-8 -*-
# Copyright 2016 LasLabs Inc.
# License GPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.tests.common import TransactionCase
from odoo import fields
class TestMedicalPatientDisease(TransactionCase):
def setUp(self):
super(TestMedicalPatientDisease, self).setUp(... | laslabs/vertical-medical | medical_patient_disease/tests/test_medical_patient_disease.py | Python | agpl-3.0 | 2,806 |
# 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 unittest
import doctest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import doctest_setup, doctes... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/account_stock_continental/tests/test_account_stock_continental.py | Python | gpl-3.0 | 890 |
# Generated by Django 2.2.19 on 2021-04-24 14:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('conference', '0028_changes_to_conferencetag_and_conferencetaggeditem'),
]
operations = [
migrations.AddField(
model_name='talk'... | EuroPython/epcon | conference/migrations/0029_talk_availability.py | Python | bsd-2-clause | 527 |
"""
The radical of n, rad(n), is the product of distinct prime factors of n. For
example, 504 = 2^3 x 3^2 x 7, so rad(504) = 2 x 3 x 7 = 42.
If we calculate rad(n) for 1 n 10, then sort them on rad(n), and sorting on n
Let E(k) be the kth element in the sorted n column; for example, E(4) = 8 and
E(6) = 9.
If rad(n... | peterstace/project-euler | OLD_PY_CODE/project_euler_old_old/124/124.py | Python | unlicense | 561 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
import logging
import docopt
import psd_tools.reader
import psd_tools.decoder
from psd_tools import PSDImage
from psd_tools.user_api.layers import group_layers
from psd_tools.debug import pprint
from psd_tools.version impo... | EvgenKo423/psd-tools | src/psd_tools/cli.py | Python | mit | 1,922 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Števko <[email protected]>
# 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.0',
... | tszym/ansible | lib/ansible/modules/network/illumos/flowadm.py | Python | gpl-3.0 | 14,817 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | USGSDenverPychron/pychron | pychron/spectrometer/thermo/source/base.py | Python | apache-2.0 | 5,373 |
# ==========================================================================
# This module performs unit tests for the GammaLib CTA module.
#
# Copyright (C) 2012-2021 Juergen Knoedlseder
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | gammalib/gammalib | inst/cta/test/test_CTA.py | Python | gpl-3.0 | 25,438 |
from localtv.tests.selenium import WebdriverTestCase
from localtv.tests.selenium.pages.front import listing_page
from django.core import management
import datetime
class ListingPages(WebdriverTestCase):
"""Tests for the various listing pages, new, featured and popular.
"""
NEW_BROWSER_PER_TEST_CASE = Fal... | pculture/mirocommunity | localtv/tests/selenium/test_listing_pages.py | Python | agpl-3.0 | 8,846 |
"""
Utility Routines for Working with Matplotlib Objects
====================================================
"""
import itertools
import io
import base64
import numpy as np
import warnings
import matplotlib
from matplotlib.colors import colorConverter
from matplotlib.path import Path
from matplotlib.markers import ... | phobson/bokeh | bokeh/core/compat/mplexporter/utils.py | Python | bsd-3-clause | 11,503 |
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from provider.utils import get_provider
@view_config(route_name='pyramid-social-auth.auth', request_method='GET')
def auth(request):
provider_name = request.matchdict.get('provider')
if provider_name not in request.registry.se... | marinewater/pyramid-social-auth | pyramid_app/views.py | Python | mit | 1,027 |
# The MIT License(MIT)
# Copyright (c) 2013-2014 Matt Thomson
# 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, mo... | tino/pyembed | pyembed/core/test/auto_discovery_test.py | Python | mit | 3,677 |
""" Visualize :class:`~pySPACE.resources.data_types.feature_vector.FeatureVector` elements"""
import itertools
import pylab
import numpy
try:
import mdp.nodes
except:
pass
from pySPACE.missions.nodes.base_node import BaseNode
class LLEVisNode(BaseNode):
""" Show a 2d scatter plot of all :class:`~pySPACE.r... | pyspace/test | pySPACE/missions/nodes/visualization/feature_vector_vis.py | Python | gpl-3.0 | 5,341 |
import os
import subprocess
from deriva.core import format_exception
from launcher.impl import LauncherTask, Task
class SubprocessTask(LauncherTask):
def __init__(self, parent=None):
super(SubprocessTask, self).__init__(parent)
class ViewerTask(SubprocessTask):
def __init__(self, executable, is_owne... | informatics-isi-edu/synspy | launcher/launcher/impl/process_tasks.py | Python | bsd-3-clause | 1,975 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from .base import ArticleTestBase
from wiki.models import Article, URLPath
from wiki.plugins.attachments.models import Attachment
__doc__ = """
Tests that the custom queryset methods work, this i... | PolyLAN/django-wiki | wiki/tests/test_managers.py | Python | gpl-3.0 | 2,973 |
#!/usr/bin/python2
from sys import argv
import os.path
from distutils import sysconfig
def getProgramsMenuPath():
"""getProgramsMenuPath() -> String|None
@return the filesystem location of the common Start Menu.
"""
try:
return get_special_folder_path("CSIDL_COMMON_PROGRAMS")
except OS... | Cynary/distro6.01 | arch/6.01Soft/lib601-F13-4/build/scripts-2.7/installsoar.py | Python | mit | 1,742 |
#!/usr/bin/env python3
"""EOTF functions"""
import eotf_bt1886
import eotf_hlg
import eotf_pq
import eotf_gamma_2_2
import eotf_gamma_2_4
eotfs = [ eotf_bt1886,
eotf_hlg,
eotf_pq,
eotf_gamma_2_2,
eotf_gamma_2_4,
]
| arvehj/jvcprojectortools | eotf.py | Python | apache-2.0 | 265 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('CHANGELOG.rst') as changelog_file:
changelog = changelog_file.read()
requirements = [
... | zoidbergwill/cookiecutter-demands-pypackage | {{cookiecutter.repo_name}}/setup.py | Python | mit | 1,701 |
def add(s, i, x):
n = len(s)
while i < n:
s[i] += x
i += (i&(-i))
def get(s, i):
ret = 0
while i != 0:
ret += s[i]
i -= (i&(-i))
return ret
def find(s, k):
n = len(s)
beg = 0
end = n
tt = get(s, n-1)
while beg < end:
mid = (beg + end) // ... | FiveEye/ProblemSet | LeetCode/lc992.py | Python | mit | 1,820 |
# -*- coding: utf-8 -*-
from argh.decorators import arg
from lain_admin_cli.helpers import Node, Container, is_backupd_enabled
from lain_admin_cli.helpers import yes_or_no, info, error, warn, _yellow, volume_dir
from subprocess import check_output, check_call, CalledProcessError
import requests, os, json, time
@arg(... | laincloud/lainctl | lain_admin_cli/drift.py | Python | mit | 7,980 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0004_auto_20141104_2241'),
]
operations = [
migrations.AddField(
model_name='userprofile',
... | Stupeflix/japper | japper/users/migrations/0005_userprofile_slack_nickname.py | Python | mpl-2.0 | 470 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | pypa/warehouse | warehouse/admin/__init__.py | Python | apache-2.0 | 2,024 |
# -*- coding:utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 versio... | s-leger/archipack | archipack_roof.py | Python | gpl-3.0 | 197,868 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from collections import defaultdict
from datetime import datetime... | mic4ael/indico | indico/modules/rb/operations/conflicts.py | Python | mit | 7,342 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mig_main', '0002_initial_split'),
('history', '0002_auto_20140918_0318'),
]
operations = [
migrations.CreateModel(
... | tbpmig/mig-website | history/migrations/0003_backgroundcheck.py | Python | apache-2.0 | 907 |
#!/var/www/horizon/.venv/bin/python
# $Id: rst2html.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <[email protected]>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing HTML.
"""
try:
import locale
locale.setlocale(loc... | neumerance/deploy | .venv/bin/rst2html.py | Python | apache-2.0 | 611 |
# Copyright (C) 2014-2015 Andrey Antukh <[email protected]>
# Copyright (C) 2014-2015 Jesús Espino <[email protected]>
# Copyright (C) 2014-2015 David Barragán <[email protected]>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | bdang2012/taiga-back-casting | taiga/feedback/api.py | Python | agpl-3.0 | 1,982 |
import json
data = json.loads ( '''{
"type": "PPL",
"names": [
{
"name": "Wollongong",
"language": "en"
}
]
}''' ) | rob-metalinkage/django-gazetteer | gazetteer/work.py | Python | cc0-1.0 | 126 |
"""
Django settings for {{ cookiecutter.project_name }} 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/
"""
import os
import dj_database_url
from decouple im... | istrategylabs/mo-django | {{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/settings.py | Python | mit | 6,441 |
def fadein(clip, duration):
""" Makes the clip fade to black progressively, over ``duration``
seconds. For more advanced fading, see
``moviepy.video.composition.crossfadein`` """
return clip.fl(lambda gf, t: min(1.0 * t / duration, 1) * gf(t... | DevinGeo/moviepy | moviepy/video/fx/fadein.py | Python | mit | 323 |
# 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... | Huyuwei/tvm | topi/python/topi/testing/l2_normalize_python.py | Python | apache-2.0 | 1,619 |
import _plotly_utils.basevalidators
class SizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="size", parent_name="densitymapbox.hoverlabel.font", **kwargs
):
super(SizeValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/python-api | packages/python/plotly/plotly/validators/densitymapbox/hoverlabel/font/_size.py | Python | mit | 558 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0022_add_help_text_for_metadata_tags'),
]
operations = [
migrations.AddField(
model_name='languagepage',... | praekelt/molo | molo/core/migrations/0023_languagepage_main_language.py | Python | bsd-2-clause | 469 |
# Copyright (C) 2008-2009 Open Society Institute
# Thomas Moroz: tmoroz.org
# 2010-2011 Large Blue
# Fergus Doyle: [email protected]
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License Version ... | damilare/opencore | opencore/utilities/groupsearch.py | Python | gpl-2.0 | 3,509 |
from BidirectionalCategoryEnum import BidirectionalCategoryEnum
from CharacterDecompositionMappingEnum import CharacterDecompositionMappingEnum
from GeneralCategoryEnum import GeneralCategoryEnum
class CPPGenerator:
def __init__(self, output, datas, specialCasing):
self.__output = output
self.__... | Gawaboumga/String | U8String/UnicodeDataGenerator/CPPGenerator.py | Python | mit | 9,116 |
import logging
import string
import time
from django import forms
from django.contrib.auth.decorators import login_required
from django.core.files.base import ContentFile
from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response, redirect
from django.template import Context, loader
f... | ComputerNetworks-UFRGS/Aurora | cloud/views/metrics.py | Python | gpl-2.0 | 6,878 |
################################################################################
# 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... | aljoscha/flink | flink-python/pyflink/dataset/execution_environment.py | Python | apache-2.0 | 8,613 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# isprime.py
#
# Author: Billy Wilson Arante
# Created: 2016/06/16 PHT
# Modified: 2016/10/01 EDT (America/New York)
from sys import argv
def isprime(x):
"""Checks if x is prime number
Returns true if x is a prime number, otherwise false.
"""
if x <= 1:
... | arantebillywilson/python-snippets | py2/cool-things/isprime.py | Python | mit | 565 |
# -*- coding: utf-8 -*-
"""
This module offers a parser for ISO-8601 strings
It is intended to support all valid date, time and datetime formats per the
ISO-8601 specification.
..versionadded:: 2.7.0
"""
from datetime import datetime, timedelta, time, date
import calendar
from dateutil import tz
from fu... | SickGear/SickGear | lib/dateutil/parser/isoparser.py | Python | gpl-3.0 | 13,509 |
# This script reads the carrier database
# and display it along a path in histogram form
# along with a representation of the carriers in energy space
from __future__ import print_function
from yambopy import *
import matplotlib.gridspec as gridspec
from scipy.optimize import curve_fit
import os
############
# SETTIN... | alexandremorlet/yambopy | scripts/realtime/plot_occ2.py | Python | bsd-3-clause | 7,553 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Spotify AB
#
# 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... | eddelbuettel/annoy | setup.py | Python | apache-2.0 | 3,711 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import whatstyle
if __name__ == "__main__":
import doctest
doctest.testmod(whatstyle)
| mikr/whatstyle | tests/test_doc.py | Python | mit | 142 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SciFabric LTD.
#
# PyBossa 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 License, or
# (at your op... | geotagx/pybossa | test/test_jobs/test_send_mail.py | Python | agpl-3.0 | 1,418 |
# coding=utf-8
from system.translations import Translations
__author__ = 'Sean'
_ = Translations().get()
class Channel(object):
"""
A channel - Represents a channel on a protocol. Subclass this!
@ivar name The name of the channel
@ivar users A set containing all the User objects in the channel
... | UltrosBot/Ultros | system/protocols/generic/channel.py | Python | artistic-2.0 | 1,538 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths i... | maciek263/django2 | mysite/settings.py | Python | mit | 3,005 |
# -*- coding: UTF-8 -*-
# Copyright (C) 2007 Sylvain Taverne <[email protected]>
# Copyright (C) 2007-2008 Henry Obein <[email protected]>
# Copyright (C) 2007-2008 Juan David Ibáñez Palomar <[email protected]>
# Copyright (C) 2007-2008, 2010 Hervé Cauwelier <[email protected]>
# Copyright (C) 2008 Gautier Hayoun <gauti... | hforge/wiki | page.py | Python | gpl-3.0 | 13,317 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple wrapper around sr_lobo.py to see output in graphic mode.
"""
import os
import sys
import subprocess
from threading import Thread
from Queue import Queue, Empty
from collections import deque
from itertools import islice
from Tkinter import Tk, BOTH, RIGHT, LEFT... | pacoqueen/ginn | ginn/api/tests/tk_sr_lobo.py | Python | gpl-2.0 | 8,568 |
#!/usr/bin/env python
# File: plot_histograms3.py
# Created on: Mon Aug 20 22:14:33 2012
# Last Change: Tue Jan 15 16:03:45 2013
# Purpose of script: <+INSERT+>
# Author: Steven Boada
import pylab as pyl
from mk_galaxy_struc import mk_galaxy_struc
galaxies = mk_galaxy_struc()
verylow =[]
low =[]
med=[]
high=[]
appen... | boada/ICD | sandbox/legacy_plot_code/plot_pie_IH.py | Python | mit | 2,930 |
#!/usr/bin/python
# Copyright (c) 2016 Intel Corporation.
# SPDX-License-Identifier: MIT
import unittest as u
import re, fnmatch, os, sys
sampleMappingFile = '../examples/samples.mapping.txt'
cSamplesDir = '../examples/'
javaSamplesDir = '../examples/java/'
cppSamplesDir = '../examples/c++/'
class SampleNames(u.Test... | Propanu/mraa | tests/check_samplenames.py | Python | mit | 2,291 |
#! python
# A small program to match either a fasta or qual file based on whether the barcode was found or not.
# Need a group file that designates sequences without a recognized barcode as "none".
# To use the program entries should look like the following:
# python matchFastaGroup.py <fastaORqualFile> <groupFilew> ... | marcsze/pythonPrograms | addToSeqName.py | Python | mit | 2,790 |
# Non-dimensional mesh size
mesh_width = 1.0
mesh_height = 0.4 * mesh_width
# Number of cells in each dimension
nx = 8
ny = nx
nz = nx
| mroyluna/summer17mantlesim | mantle_simulation/constants.py | Python | mit | 137 |
from rest_framework.test import APITestCase
from rest_framework import status
from .factories import UserFactory
from django.contrib.auth.models import User
class AuthTestCase(APITestCase):
url = '/auth/'
def setUp(self):
self.user = UserFactory()
self.data = {
'username': self.u... | chepe4pi/sokoban_api | sk_auth/tests/tests.py | Python | gpl-2.0 | 4,236 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from datetime import datetime as dt
from bs4 import BeautifulSoup
from unittest import TestCase, main
from pitchpx.game.boxscore import BoxScore
from pitchpx.game.game import Game
from pitchpx.game.players import Players
__author__ = 'Shinichi Nakagawa'
cla... | Shinichi-Nakagawa/pitchpx | tests/pitchpx/game/test_boxscore.py | Python | mit | 78,596 |
"""
Amazon auth backend, docs at:
http://psa.matiasaguirre.net/docs/backends/twilio.html
"""
from re import sub
from social.p3 import urlencode
from social.backends.base import BaseAuth
class TwilioAuth(BaseAuth):
name = 'twilio'
ID_KEY = 'AccountSid'
def get_user_details(self, response):
""... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/social/backends/twilio.py | Python | agpl-3.0 | 1,384 |
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
import redis
from relo.core.log import logger
dirname = os.path.dirname(os.path.abspath(__file__))
up_dir = os.path.dirname(dirname)
sys.path.append(up_dir)
from relo.core.interfaces import Backend
class REDISDB(Backend):
name = "redis"
expiretime... | cwoebker/relo | relo/core/backend/redisdb.py | Python | bsd-3-clause | 1,633 |
"""
Based entirely on Django's own ``setup.py``.
"""
import os
import sys
from distutils.command.install import INSTALL_SCHEMES
from distutils.command.install_data import install_data
try:
from setuptools import setup
except ImportError:
from distutils.core import setup # NOQA
try:
from setuptools.comman... | jpadilla/django-extensions | setup.py | Python | mit | 4,834 |
"""Test CoolProp interaction."""
import pytest
import pygaps
import pygaps.utilities.exceptions as pgEx
@pytest.mark.utilities
class TestCoolProp():
"""Test CoolProp interaction."""
def test_backend_change(self):
"""Test if backend can change."""
previous_backend = pygaps.thermodynamic_backe... | pauliacomi/pyGAPS | tests/utilities/test_coolprop_interaction.py | Python | mit | 1,431 |
# slightly modified from https://gist.github.com/udibr/67be473cf053d8c38730
# variation to https://github.com/ryankiros/skip-thoughts/blob/master/decoding/search.py
import numpy as np
def beamsearch(predict, end, k=1, maxsample=400):
"""return k samples (beams) and their NLL scores, each sample is a sequence of lab... | milankinen/c2w2c | src/textgen/search.py | Python | mit | 2,223 |
# -*- coding: utf-8 -*-
from resources.lib.parser import cParser
from resources.lib.handler.requestHandler import cRequestHandler
import re
import urlresolver
class cHosterHandler:
def getUrl(self, oHoster):
sUrl = oHoster.getUrl()
if (oHoster.checkUrl(sUrl)):
oRequest = cRequestHandle... | StoneOffStones/plugin.video.xstream | resources/lib/handler/hosterHandler.py | Python | gpl-3.0 | 1,990 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='lkd',
version='2',
packages=['lkd', 'tests'],
author='Karan Goel',
author_email='[email protected]',
maintainer='Karan Goel',
maintainer_email='[email protected]',
url='http://www.goel.im... | karan/py-lkd.to | setup.py | Python | mit | 1,225 |
import logging
import os
import re
from glob import glob
from toolbox.config.docker import CONFIG_KEYS, CRP_CONFIG_ITEM_KEYS, CAPABILITIES
from toolbox.utils import check_common_files, counted_error, validate_bool, validate_flag, validate_ports
from .utils import sorted_container_configs, yield_dockerfiles
def chec... | avatao-content/challenge-toolbox | toolbox/docker/check.py | Python | apache-2.0 | 3,414 |
"""EB for the unit level model.
This module implements the basic EB unit level model. The functionalities are organized in
classes. Each class has three main methods: *fit()*, *predict()* and *bootstrap_mse()*.
Linear Mixed Models (LMM) are the core underlying statistical framework used to model the hierarchical nat... | survey-methods/samplics | src/samplics/sae/eb_unit_model.py | Python | mit | 26,920 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License.
import json
from azurelinuxagent.common.protocol.restapi import ExtensionStatus
from azurelinuxagent.ga.exthandlers import parse_ext_status
from tests.tools import *
class TestExtHandlers(AgentTestCase):
def test_par... | andyliuliming/WALinuxAgent | tests/ga/test_exthandlers.py | Python | apache-2.0 | 2,603 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
class HProperty2_connectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HProperty2_connectedLHS.
"""
# Flag this instance as compiled now
se... | levilucio/SyVOLT | ECore_Copier_MM/properties/positive/himesis/HProperty2_connectedLHS.py | Python | mit | 12,317 |
from zope.interface import implements
from twisted.internet import reactor
from twisted.internet import defer
from webut.skin import iskin
from ldaptor.protocols import pureldap
from ldaptor.protocols.ldap import ldapsyntax, distinguishedname
from ldaptor import generate_password, interfaces
from ldaptor.apps.webui.uri... | antong/ldaptor | ldaptor/apps/webui/change_password.py | Python | lgpl-2.1 | 15,552 |
import gtk.glade
import sys, os
import os.path
import locale, gettext
locale.setlocale (locale.LC_NUMERIC, '')
import string
import sys
import re
GtkSV = True
try:
import gtksourceview
except:
try:
import gtksourceview2 as gtksourceview
except:
print 'No gtksourceview import possible.... | BackupTheBerlios/cuon-svn | cuon_client/cuon/Editor/editor.py | Python | gpl-3.0 | 14,061 |
"""Component for handling Air Quality data for your location."""
from datetime import timedelta
import logging
from homeassistant.const import (
ATTR_ATTRIBUTION,
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
)
from homeassistant.helpers.config_validation import ( # noqa: F401
PLATFORM_SCHEMA,
PLATFORM_SC... | partofthething/home-assistant | homeassistant/components/air_quality/__init__.py | Python | apache-2.0 | 3,964 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import rest.models
from .base import from_django_model
WsAuthGroup = from_django_model(rest.models.WsAuthGroup)
| lavalamp-/ws-backend-community | lib/sqlalchemy/models/auth.py | Python | gpl-3.0 | 178 |
import unittest
from fylm.model.timestamp import Timestamps
class MockExperiment(object):
def __init__(self):
self.data_dir = "/tmp/"
self.fields_of_view = [1, 2]
self.time_periods = [1, 2]
self.base_path = None
self.field_of_view_count = 2
class TimestampsTests(unittest.... | jimrybarski/fylm | tests/model/timestamp.py | Python | mit | 2,372 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | USGSDenverPychron/pychron | pychron/hardware/watlow/watlow_ezzone.py | Python | apache-2.0 | 8,596 |
import re
import random
from discord.ext import commands
from . import util
table_expression = re.compile(r'^\s*(?:(\d+)\s*\|\s*)?(.*)\s*$')
class TableCategory (util.Cog):
@commands.command()
async def choose(self, ctx, *, table: str):
'''
Randomly choose an item from a list
This ... | b-hodges/dice-bot | dicebot/cogs/tables.py | Python | mit | 1,339 |
# -*- coding: utf-8 -*-
from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin
class SuccessDeleteMessageMixin(SuccessMessageMixin):
"""
Mixin criado para propagar mensagem de sucesso em
ações de exclusão.
"""
def get_success_message(self):
ret... | gilsondev/balin | balin/utils/views/mixins.py | Python | mit | 681 |
"""add-hikes
Revision ID: f7888bd46c75
Revises: 820bb005f2c5
Create Date: 2017-02-16 07:36:06.108806
"""
# revision identifiers, used by Alembic.
revision = 'f7888bd46c75'
down_revision = 'fc92ba2ffd7f'
from alembic import op
import sqlalchemy as sa
import geoalchemy2
def upgrade():
### commands auto generate... | thusoy/blag | blag/migrations/versions/f7888bd46c75_add_hikes.py | Python | mit | 1,664 |
import numpy as np
| fourtriple/bt-dist | trilateration.py | Python | gpl-3.0 | 22 |
from os import listdir
from os.path import isfile, join
import paer
mypath = 'aedat/'
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) and f.endswith('.aedat')]
for file in onlyfiles:
ae = paer.aefile(mypath + str(file))
aed= paer.aedata(ae).downsample((16,16))
paer.create_pngs(aed, '16... | darioml/fyp-public | data/make_pngs.py | Python | gpl-2.0 | 394 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | jsilhan/dnf | dnf/yum/packages.py | Python | gpl-2.0 | 3,808 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: ts=4
###
#
# CommieCC is the legal property of J. Félix Ontañón <[email protected]>
# Copyright (c) 2009 J. Félix Ontañón
#
# 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
# pub... | amian84/commiecc | commiecc/slavelib/core.py | Python | gpl-3.0 | 8,617 |
# -*- coding: utf-8 -*-
# Copyright(C) 2017 Vincent A
#
# This file is part of a weboob module.
#
# This weboob module 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... | laurentb/weboob | modules/lameteoagricole/module.py | Python | lgpl-3.0 | 1,524 |
''' -- Imports from python libraries -- '''
import datetime
import json
import pymongo
import re
''' -- imports from installed packages -- '''
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render_to_response, redirect, render
from django.template import RequestContex... | AvadootNachankar/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/views/feeds.py | Python | agpl-3.0 | 2,596 |
"""Test for RFLink cover components.
Test setup of RFLink covers component/platform. State tracking and
control of RFLink cover devices.
"""
import logging
from homeassistant.components.rflink import EVENT_BUTTON_PRESSED
from homeassistant.const import (
SERVICE_OPEN_COVER,
SERVICE_CLOSE_COVER,
STATE_OP... | fbradyirl/home-assistant | tests/components/rflink/test_cover.py | Python | apache-2.0 | 12,737 |
"""
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.
"""
# Definition for singly-linked list.... | Ahmed--Mohsen/leetcode | delete_node_in_a_linked_list.py | Python | mit | 767 |
__version_info__ = {
'major': 0,
'minor': 1,
'micro': 0,
'releaselevel': 'alpha',
'serial': 1
}
def get_version(short=False):
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
v... | bruth/resources | resources/__init__.py | Python | bsd-2-clause | 580 |
#!/usr/bin/env python
# encoding: utf-8
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="cubehelix",
version="0.1.0",
author="James Davenport",
# author_email="",
description="Cubehelix colormaps for matp... | jradavenport/cubehelix | setup.py | Python | bsd-2-clause | 605 |
import pytest
@pytest.fixture
def biosample(submitter, lab, award, source, organism):
return {
'award': award['uuid'],
'biosample_term_id': 'UBERON:349829',
'biosample_term_name': 'heart',
'biosample_type': 'tissue',
'lab': lab['uuid'],
'organism': organism['uuid'],... | T2DREAM/t2dream-portal | src/encoded/tests/test_schema_biosample.py | Python | mit | 4,368 |
class Solution:
def maxProduct(self, nums: List[int]) -> int:
local_min = nums[0]
local_max = nums[0]
global_max = nums[0]
# Maintain local max, local min and global max!
for i in range(1,len(nums)):
# Once we have encountered a negative element we consid... | saisankargochhayat/algo_quest | leetcode/152.MaxProductSubarray/soln.py | Python | apache-2.0 | 734 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Jérémie DECOCK (http://www.jdhp.org)
# run:
# mpirun -np 4 python3 broadcast_pickle.py
# or
# mpiexec -n 4 python3 broadcast_pickle.py
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.rank
if rank == 0:
data = {'key1': [1, 2.5, ... | jeremiedecock/snippets | python/mpi4py/broadcast_pickle.py | Python | mit | 444 |
# coding=utf-8
from __future__ import absolute_import
try:
# noinspection PyUnresolvedReferences
from argh.decorators import arg
argh_installed = True
except ImportError:
argh_installed = False
__author__ = 'Tyler Butler <[email protected]>'
if argh_installed:
# noinspection PyUnresolvedRefe... | tylerbutler/engineer | engineer/commands/argh_helpers.py | Python | mit | 1,055 |
import xyz
class Mpfr(xyz.Package):
pkg_name = 'mpfr'
deps = ['texinfo', 'gmp']
configure = xyz.Package.host_lib_configure
rules = Mpfr
| BreakawayConsulting/xyz | rules/mpfr.py | Python | mit | 150 |
"""The tests for the Tasmota sensor platform."""
import copy
import datetime
from datetime import timedelta
import json
from unittest.mock import Mock, patch
import hatasmota
from hatasmota.utils import (
get_topic_stat_status,
get_topic_tele_sensor,
get_topic_tele_will,
)
import pytest
from homeassistant... | aronsky/home-assistant | tests/components/tasmota/test_sensor.py | Python | apache-2.0 | 33,360 |
# Copyright 2021 The TF-Coder Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | google-research/tensorflow-coder | tf_coder/filter_group_test.py | Python | apache-2.0 | 947 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.