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 |
|---|---|---|---|---|---|
class Tier(object):
name = ''
WEB = Tier()
WEB.name = 'WEB'
JAVA = Tier()
JAVA.name = 'JAVA'
DB = Tier()
DB.name = 'DB'
| travisby/kronos2 | hermes_api/tier.py | Python | bsd-2-clause | 127 |
TESTS = {
"Basics": [
{
"input": "hieeelalaooo",
"answer": "hello",
},
{
"input": "hoooowe yyyooouuu duoooiiine",
"answer": "how you doin",
},
{
"input": "aaa bo cy da eee fe",
"answer": "a b c d e f",
... | Bryukh-Checkio-Tasks/checkio-task-bird-language | verification/tests.py | Python | mit | 1,726 |
# Authors:
# Petr Vobornik <[email protected]>
#
# Copyright (C) 2013 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | encukou/freeipa | ipatests/test_webui/data_hostgroup.py | Python | gpl-3.0 | 3,009 |
# coding: utf-8
import os
import networkx as nx
import matplotlib.pyplot as plt
import cython
import numpy as np
import pandas as pd
from networkx.algorithms import bipartite
# load in merged data
data_path = '../../../UCB_dept_merge.csv'
mergeData = pd.read_csv(data_path)
# cut out unnecessary info on department nam... | BIDS-collaborative/purchasing | script/network_analysis/network_analysis.py | Python | isc | 907 |
# -*- coding: utf-8 -*-
# © 2017 Antonio Mignolli - Didotech srl (www.didotech.com)
from openerp.osv import orm, fields
class sale_order(orm.Model):
_inherit = 'sale.order'
def _has_services(self, cr, uid, ids, field_name, args, context=None):
context = context or self.pool['res.users'].context_get... | iw3hxn/LibrERP | sale_order_modify_confirmed_service/models/sale_order.py | Python | agpl-3.0 | 787 |
"""
Test for split test XModule
"""
from unittest.mock import MagicMock
from django.urls import reverse
from lms.djangoapps.courseware.model_data import FieldDataCache
from lms.djangoapps.courseware.module_render import get_module_for_descriptor
from openedx.core.djangoapps.user_api.tests.factories import UserCourse... | edx/edx-platform | lms/djangoapps/courseware/tests/test_split_module.py | Python | agpl-3.0 | 10,817 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015-2017 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: David Coninckx, Emanuel Cino
#
# The licence is in the file __manifest__.py
... | maxime-beck/compassion-modules | sponsorship_tracking/models/contracts.py | Python | agpl-3.0 | 13,289 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 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 the h... | tsdgeos/snapcraft | snapcraft/plugins/python.py | Python | gpl-3.0 | 13,115 |
"""
Program to convert binary number into decimal and vce versa
"""
def binaryToDecimal(binaryNum):
decNum = 0
j=1
while(binaryNum !=0):
remainder = binaryNum%10
decNum=decNum+remainder*j
j=j*2
binaryNum = binaryNum/10
print "Equivalent decimal numb... | nbhavana/python-practice-programs | binToDecConverter.py | Python | gpl-2.0 | 1,076 |
#!/usr/bin/env python2
#
# Script creates self signed SSL cert and the key necessary to sign it.
# This is based off of the code in this article:
#
# https://skippylovesmalorie.wordpress.com/2010/02/12/how-to-generate-a-self-signed-certificate-using-pyopenssl/
import argparse
import os
from OpenSSL import cryp... | rlbabyuk/integration_tests | scripts/gen_ssl_cert.py | Python | gpl-2.0 | 2,666 |
from starstoloves.lib.comparable import Comparable
class LastfmTrack(Comparable):
loved = False
def __init__(self, url, track_name=None, artist_name=None, listeners=None):
self.url = url
self.track_name = track_name
self.artist_name = artist_name
self.listeners = listeners
... | tdhooper/starstoloves | starstoloves/lib/track/lastfm_track.py | Python | gpl-2.0 | 641 |
from datetime import datetime
from django.test import SimpleTestCase
from corehq.apps.reports_core.exceptions import FilterValueException
from corehq.apps.reports_core.filters import DatespanFilter, ChoiceListFilter, \
NumericFilter, DynamicChoiceListFilter, Choice
from corehq.apps.userreports.exceptions import Bad... | puttarajubr/commcare-hq | corehq/apps/userreports/tests/test_report_filters.py | Python | bsd-3-clause | 10,455 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/proxies/schemas/gateway/redirect.py | Python | apache-2.0 | 1,003 |
"""Add a tonne of indexes, because postgres doesn't automatically create referencing FK indexes.
Revision ID: 53928162b90
Revises: None
Create Date: 2014-05-10 10:57:48.380065
"""
# revision identifiers, used by Alembic.
revision = '53928162b90'
down_revision = None
from alembic import op
import sqlalchemy as sa
... | Herkemer/pynab | alembic/versions/53928162b90_add_a_tonne_of_indexes_because_postgres_.py | Python | gpl-2.0 | 4,935 |
from parler.managers import TranslatableManager
class QuestionManager(TranslatableManager):
def displayed(self):
return self.all().filter(display=True).order_by("position")
| tanzquotient/tq_website | faq/managers.py | Python | gpl-2.0 | 187 |
#!/usr/bin/env python
class Placeholders(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually."""
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and the value is attribute type.
... | sohail-aspose/Aspose_Slides_Cloud | SDKs/Aspose.Slides_Cloud_SDK_for_Python/asposeslidescloud/models/Placeholders.py | Python | mit | 1,026 |
import logging
from .._resource_model_base import ResourceModelBase
from ..resources import ImmutableResource
_LOG = logging.getLogger(__name__)
class ImmutableResourceModel(ResourceModelBase):
__resource_cls__ = ImmutableResource
__resource_indexes__ = tuple()
| artPlusPlus/elemental-backend | elemental_backend/resource_models/_immutable_resource_model.py | Python | mpl-2.0 | 275 |
# -*- coding: utf-8 -*-
import argparse
from . import core
class Command(core.Command):
def call(self, args):
if args.decrement:
vol = 'decrement'
elif args.increment:
vol = 'increment'
else:
vol = args.set
self.xbmc.Application.SetVolume({'vo... | mychris/xbmc-command | xbmc_command/volume.py | Python | gpl-3.0 | 1,670 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015 Université Catholique de Louvain.
#
# This file is part of INGInious.
#
# INGInious 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 o... | layus/INGInious | backend/tests/TestRemoteAgentCrash.py | Python | agpl-3.0 | 3,076 |
# -*- coding: utf-8 -*-
"""
twython.endpoints
~~~~~~~~~~~~~~~~~
This module provides a mixin for a :class:`Twython <Twython>` instance.
Parameters that need to be embedded in the API url just need to be passed
as a keyword argument.
e.g. Twython.retweet(id=12345)
This map is organized the order functions are docume... | Devyani-Divs/twython | twython/endpoints.py | Python | mit | 34,352 |
# -*- coding: utf-8 -*-
"""
Small utility to convert p2p format of IP Blocklists to IPSet format.
Usage:
{program} generate [options] BLOCKLIST_URL...
{program} example_restore_ipset_job [options] IPTABLES_NAME IPSET_PATH
{program} example_update_ipset_job [options] IPSET_PATH BLOCKLIST_URL...
{program} -h | -... | 9seconds/iblocklist2ipset | iblocklist2ipset/__init__.py | Python | mit | 1,343 |
# Copyright (c) 2016 Cisco Systems
# 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 require... | noironetworks/aci-integration-module | aim/context.py | Python | apache-2.0 | 1,124 |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... | nicko7i/vcnc | api-python/setup.py | Python | apache-2.0 | 4,104 |
# -*- coding: utf-8 -*-
import pytest
from giraffez._teradata import RequestEnded, StatementEnded, StatementInfoEnded
import giraffez
from giraffez.constants import *
from giraffez.errors import *
from giraffez.types import *
class ResultsHelper:
"""
Helps to emulate how exceptions are raised when working w... | capitalone/giraffez | tests/test_cmd.py | Python | apache-2.0 | 11,099 |
import logging
class CoreMesosObject(object):
'''
Internal class to manage driver
'''
def __init__(self, mesos_url, frameworkId, streamId, requests_auth=None, verify=True):
self.logger = logging.getLogger(__name__)
self.mesos_url = mesos_url
self.streamId = streamId
se... | osallou/python-mesos-http | mesoshttp/core.py | Python | apache-2.0 | 421 |
# -*- coding: utf-8 -*-
# pylint: disable=unused-argument
"""
In order to make our test suit work, we must use a MockDockerDaemon rather than communicating with a real Docker instance.
"""
#external imports
import json
import os
#internal imports
from subuserlib.classes.userOwnedObject import UserOwnedObject
import s... | shannara/subuser | logic/subuserlib/classes/docker/mockDockerDaemon.py | Python | lgpl-3.0 | 3,606 |
from lof_game_core import *
from lof_game_actions import *
| Max-E/Line-of-Fire | lof_game.py | Python | mit | 59 |
# -*- coding: utf-8 -*-
import re
from datetime import datetime
def test_freezing_time(testdir):
testdir.makepyfile("""
import pytest
from datetime import date, datetime
@pytest.mark.freeze_time('2017-05-20 15:42')
def test_sth():
assert datetime.now().date() == date(... | ktosiek/pytest-freezegun | tests/test_freezegun.py | Python | mit | 7,458 |
# coding=utf-8
from .git_commit_utils import *
from .git_etl import GitETL
from .git_client import GitClient
| ashapochka/saapy | saapy/vcs/__init__.py | Python | apache-2.0 | 110 |
import mir3.data.base_object as bo
import mir3.data.metadata as md
class DataObject(bo.BaseObject):
"""Standard base for interface objects.
Provides some methods to make it easier to develop interface objects.
Attributes:
metadata: object of type Metadata with information about the data
... | pymir3/pymir3 | mir3/data/data_object.py | Python | mit | 972 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-27 18:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dash', '0011_auto_20170326_2020'),
]
operations = [
migrations.RenameField(
... | CMPUT404W17T06/CMPUT404-project | dash/migrations/0012_auto_20170327_1808.py | Python | apache-2.0 | 450 |
#!/usr/bin/env python
r"""rna_plot_density.py - generate a density plot
Don't open Excel, Jupyter. Simple plot a density of one column and save it to a file.
Example::
# file
fn rmsd_all
0 19_Bujnicki_Human_4_rpr_n0-000001.pdb-000001_A... 14.73
... | mmagnus/rna-pdb-tools | rna_tools/tools/plotting/rna_plot_boxplotlike.py | Python | gpl-3.0 | 2,276 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2011 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you m... | sacharya/nova | nova/virt/firewall.py | Python | apache-2.0 | 21,771 |
import urllib2
import re
import pdb
import time
"""
this scraper is a utility to try to map old joomla urls to joomla content ids
theoretically this could help create redirects for old urls to new wordpress urls,
if the ingestion script were modified to map the old url to new url at import by inspecting the ids
al... | mattkiefer/headlineclub | scripts/hc_scraper.py | Python | gpl-2.0 | 1,551 |
# Copyright (C) 2020 leafcloud b.v.
# Copyright (C) 2020 FUJITSU LIMITED
# 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/lice... | mahak/cinder | cinder/tests/unit/backup/drivers/test_backup_s3.py | Python | apache-2.0 | 25,032 |
#!/usr/bin/env python3
# Copyright (c) 2014-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the wallet accounts properly when there are cloned transactions with malleated scriptsigs."""
fro... | syscoin/syscoin | test/functional/wallet_txn_clone.py | Python | mit | 6,115 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/test/unit/test_status_web_hooks_gitlab.py | Python | gpl-3.0 | 5,731 |
import os
import click
import flask_init
from flask_init.helper import creator
# Project type
simple_module_name = 'templates/simple'
single_module_name = 'templates/single_module'
@click.command()
@click.argument('project-name')
@click.option('--simple', is_flag=True)
@click.option('--single-module', is_flag=True)
... | rajasimon/Flask-Init | flask_init/commands.py | Python | mit | 1,037 |
from SDWLE.cards.base import SpellCard
from SDWLE.constants import CHARACTER_CLASS, CARD_RARITY
from SDWLE.tags.base import BuffUntil, Buff
from SDWLE.tags.event import TurnStarted
from SDWLE.tags.status import Stealth, Taunt, Frozen
import SDWLE.targeting
class TheCoin(SpellCard):
def __init__(self):
sup... | jomyhuang/sdwle | SDWLE/cards_copy/spells/neutral.py | Python | mit | 3,616 |
# -*- coding: utf-8 -*-
"""
https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-16.html#%_thm_2.63
"""
from Chapter2.themes.lisp_list_structured_data import (
append, car, cdr,
lisp_list, nil,
print_lisp_list, cons,
)
from Chapter2.themes.sets_as_binary_trees import (entry, left_branch,
... | aoyono/sicpy | Chapter2/exercises/exercise2_63.py | Python | mit | 2,567 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import os
import platform
from collections import defaultdict
from gutenbergtozim.database import Book, BookFormat, Url
from gute... | kiwix/gutenberg | gutenbergtozim/urls.py | Python | gpl-3.0 | 7,238 |
# mode: run
class plop(object):
def __init__(self):
pass
class testobj(object):
def __init__(self):
pass
def __eq__(self, other):
return plop()
def test_equals():
"""
>>> result = test_equals()
>>> isinstance(result, plop)
True
"""
blah = testobj()
eq ... | larsmans/cython | tests/run/richcmp_str_equals.py | Python | apache-2.0 | 396 |
# -*- coding: utf-8 -*-
######################################################################
#
# Note: Program metadata is available in /__init__.py
#
######################################################################
from openerp.osv import fields, osv
from openerp import tools
class account_aging_customer(o... | gmathers/iii-addons | partner_aging/customer.py | Python | agpl-3.0 | 12,591 |
import re
from widgetastic_patternfly import Input, BootstrapSelect
from wrapanapi.hawkular import Hawkular
from cfme.common import TopologyMixin, TimelinesMixin
from cfme.common.provider import DefaultEndpoint, DefaultEndpointForm
from cfme.utils.appliance import Navigatable
from cfme.utils.appliance.implementations... | okolisny/integration_tests | cfme/middleware/provider/hawkular.py | Python | gpl-2.0 | 7,755 |
# Given the variables defined here, write Python
# code that prints out the distance, in meters,
# that light travels in one processor cycle.
# speed_of_light in meters per second
# cycles_per_second is 2.7 GHz
speed_of_light = 299792458.0
cycles_per_second = 2700000000.0
print speed_of_light / cycles_per_second
| JoseALermaIII/python-tutorials | pythontutorials/Udacity/CS101/Lesson 01 - How to get Started/Q18-Variables Quiz.py | Python | mit | 317 |
__author__ = 'Keyvan'
| meatcomputer/opencog | opencog/python/examples/__init__.py | Python | agpl-3.0 | 23 |
"""
Python values representing HTML elements. These allow for the creation of HTML
documents and fragments in Python. The standard HTML tags, such as "p" and
"div" are represented as a "builder" instance, like ``mythril.html.div``
and as a specific type, like ``mythril.html.DivType`` that represents
elements of that t... | ejones/mythril | mythril/html.py | Python | mit | 18,742 |
class Solution:
# @param board, a 9x9 2D array
# @return a boolean
def isValidSudoku(self, board):
# Check rows
for i in range(9):
d = {}
for j in range(9):
if board[i][j] == '.':
pass
elif board[i][j] in d:
... | huanqi/leetcode-python | valid_sudoku/solution.py | Python | bsd-2-clause | 1,185 |
#!/usr/bin/env python
# This file is part of tcollector.
# Copyright (C) 2011-2013 The tcollector Authors.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | OpenTSDB/tcollector | collectors/0/elasticsearch.py | Python | lgpl-3.0 | 6,838 |
"""
.. module: celeryconfig
:platform: Unix
:synopsis: Use this file to set up the Celery configuration for task scheduling.
.. version:: $$VERSION$$
.. moduleauthor:: Mike Grima <[email protected]>
"""
# Broker source: Place yours here:
broker_url = 'redis://localhost:6379/0' # Default assume Redis on l... | markofu/security_monkey | celeryconfig.py | Python | apache-2.0 | 712 |
"""distutils.command.config
Implements the Distutils 'config' command, a (mostly) empty command class
that exists mainly to be sub-classed by specific module distributions and
applications. The idea is that while every "config" command is different,
at least they're all named the same, and users always see "conf... | babyliynfg/cross | tools/project-creator/Python2.6.6/Lib/distutils/command/config.py | Python | mit | 13,759 |
import os
import io
import cv2
import cv
import picamera
import threading
import numpy as np
import time
class CameraInterface(threading.Thread):
def __init__(self,img_path="/img/live.jpg"):
super(CameraInterface, self).__init__()
self.setDaemon(True)
# set our path for ouput images
... | kscottz/SkinnerBox | modules/CameraInterface.py | Python | mit | 2,818 |
import time
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import spearmanr
def xcorr(x, y, k, normalize=True):
n = x.shape[0]
# initialize the output array
out = np.empty((2 * k) + 1, dtype=np.double)
lags = np.arange(-k, k + 1)
# pre-compute E(x), E(y)
mu_x = x.mean()
... | pjmaker/python-tsi-tools | weather/compute-corr.py | Python | bsd-3-clause | 1,984 |
# Sample Runs of analyzeStructure3D module.
import pymatgen as mg
from analyzeStructure3D import analyzePerovskite3D
from analyzeStructure3D import makePerovskite3D
# Make poscar structures.
poscar_01 = mg.Structure.from_file('POSCAR_01')
poscar_03 = mg.Structure.from_file('POSCAR_03')
# Run analyzePerovskite3D ... | ornl-abinitio/codesScripts | ramScripts/analyzePerovskiteRunSample.py | Python | lgpl-2.1 | 2,340 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2008 TÜBİTAK UEKAE
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt.
"""For banning unwanted users"""
from django.contrib.auth import logout
from oi.profile.models import ForbiddenUsername
class Ban... | ozgurlukicin/ozgurlukicin | middleware/ban.py | Python | gpl-3.0 | 511 |
# -*- coding: utf-8 -*-
from .app import create_app | jellyDean/flaskell-master | flaskell/__init__.py | Python | mit | 52 |
#!/usr/bin/env python
import sys
#Finding 'Next Link' on a given web page
def get_next_link(s):
start_link = s.find("href=")
if start_link == -1: #If no links are found then give an error!
end_quote = 0
link = "no_links"
return link, end_quote
else:
start_quote = s.find('... | hardikvasa/hadoop-mapreduce-examples-python | wikipedia-link-analysis-mapper.py | Python | mit | 2,412 |
# stdlib
import os
import unittest
# 3p
import mock
# project
from checks.check_status import AgentStatus
class TestRunFiles(unittest.TestCase):
""" Tests that runfiles (.pid, .sock, .pickle etc.) are written to internal agent folders"""
# Mac run directory expected location
_my_dir = os.path.dirname(os... | pmav99/praktoras | tests/core/test_run_files.py | Python | bsd-3-clause | 2,577 |
lloyd = {
"name": "Lloyd",
"homework": [90.0, 97.0, 75.0, 92.0],
"quizzes": [88.0, 40.0, 94.0],
"tests": [75.0, 90.0]
}
alice = {
"name": "Alice",
"homework": [100.0, 92.0, 98.0, 100.0],
"quizzes": [82.0, 83.0, 91.0],
"tests": [89.0, 97.0]
}
tyler = {
"name": "Tyler",
"homework":... | Aeolus0/My-stuff | Gradebook.py | Python | unlicense | 1,040 |
#
# errors.py: Kickstart error handling.
#
# Chris Lumens <[email protected]>
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# wil... | boonchu/pykickstart | pykickstart/errors.py | Python | gpl-2.0 | 3,811 |
# Copyright 2019 Akretion - Renato Lima <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests import common
class TestIbptService(common.TransactionCase):
def setUp(self):
super().setUp()
self.company = self._create_compay()
self._... | akretion/l10n-brazil | l10n_br_fiscal/tests/test_ibpt_service.py | Python | agpl-3.0 | 3,741 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_records = frappe.get_test_records('Project Health Weekly Report')
class TestProjectHealthWeeklyReport(unittest.T... | indictranstech/internal-erpnext | erpnext/projects/doctype/project_health_weekly_report/test_project_health_weekly_report.py | Python | agpl-3.0 | 336 |
#
import os
import unittest
class TestBase(unittest.TestCase):
@classmethod
def datafilename(cls, name):
fname = os.path.join(
os.path.dirname(__file__),
"data",
name,
)
assert os.path.exists(fname)
return fname
| deets/pyCamBam | tests/base.py | Python | gpl-2.0 | 295 |
# -*- coding: utf-8 -*-
# Copyright © 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should ha... | beav/katello | cli/src/katello/client/utils/option_validator.py | Python | gpl-2.0 | 7,743 |
# 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 requ... | rzarzynski/tempest | tempest/services/compute/json/networks_client.py | Python | apache-2.0 | 1,227 |
import ipaddress
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from .connection import NetworkAddress
def encode_address(addr: NetworkAddress) -> bytes:
return ipaddress.ip_address(add... | asajeffrey/servo | tests/wpt/web-platform-tests/tools/third_party/aioquic/src/aioquic/quic/retry.py | Python | mpl-2.0 | 1,449 |
########################################################################
# amara/xslt/exslt/datetime.py
"""
EXSLT - Dates an Times (http://www.exslt.org/date/index.html)
"""
import re
import calendar
from amara.xpath import datatypes
EXSL_DATE_TIME_NS = 'http://exslt.org/dates-and-times'
## EXSLT Core Functions ##
... | zepheira/amara | lib/xslt/exslt/datetime.py | Python | apache-2.0 | 38,339 |
from django.core.urlresolvers import reverse
from django.test import Client
from amcat.models import ArticleSet, Sentence, Article, Role
from amcat.tools import amcattest, sbd
import navigator.forms
from navigator.views.article_views import ArticleSplitView, handle_split, get_articles, ArticleDetailsView
class TestSp... | amcat/amcat | navigator/views/tests/test_article_views.py | Python | agpl-3.0 | 10,397 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.zone_airflow import ZoneRefrigerationDoorMixing
log = logging.getLogger(__name__)
class TestZoneRefrigerationDoorMixing(unittest.TestCase):
def setUp(self):
self.fd... | rbuffat/pyidf | tests/test_zonerefrigerationdoormixing.py | Python | apache-2.0 | 2,165 |
#!/usr/bin/env python
VERSION='1.00'
import os,sys,time
import optparse
from RecoLuminosity.LumiDB import pileupParser
from RecoLuminosity.LumiDB import selectionParser
from math import exp
from math import sqrt
def parseInputFile(inputfilename):
'''
output ({run:[ls:[inlumi, meanint]]})
'''
selectf=op... | iamjakob/lumiCalc | LumiDB/scripts/pileupCalc.py | Python | apache-2.0 | 10,205 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
from cffi import FFI
from pprint import pprint
ffi = FFI()
ffi.cdef('''
typedef struct {
int cmd;
int version;
} ProtoHelo;
''')
ffi.cdef('''
typedef struct {
int cmd;
int msgLen;
char msg[10];
} ProtoEcho;
''')
@asyncio.coroutine
def samp... | c86j224s/snippet | Python_Asyncio_Cffi/sample_cli.py | Python | apache-2.0 | 1,254 |
from pylab import *
from scipy import sparse
from scipy.integrate import odeint
import os, time
from osc_eqn import osc2
from my_parameters import *
detune=0.001
alpha0=3.08
alpha1=1e-3*random(Nosc)+alpha0
alpha1=1.0/(alpha1)
length1=length*stepsize+1
tlength=translength*stepsize+1
S1=zeros((Nosc,Nosc))
for i in ra... | sideshownick/Snaking_Networks | MyPython/run_solve.py | Python | gpl-2.0 | 1,751 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | anotherjesse/nova | nova/adminclient.py | Python | apache-2.0 | 13,966 |
import converters as c
s1 = c.ScaleConverter('inches', 'mm', 25)
print(s1.description())
print('converting 2 inches')
print(str(s1.convert(2)) + s1.units_to) | ebarnes1212/MyTestArea | testScaleConverter.py | Python | epl-1.0 | 159 |
"""
Renderers are used to serialize a response into specific media types.
They give us a generic way of being able to handle various media types
on the response, such as JSON encoded data or HTML output.
REST framework also provides an HTML renderer the renders the browsable API.
"""
from __future__ import unicode_li... | DeltaEpsilon-HackFMI2/FMICalendar-REST | venv/lib/python2.7/site-packages/rest_framework/renderers.py | Python | mit | 23,117 |
# Copyright (c) 2013 by Gilbert Ramirez <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-or-later
import unittest
import fixtures
from suite_dfilter.dfiltertest import *
@fixtures.uses_fixtures
class case_bytes_ipv6(unittest.TestCase):
trace_file = "ipv6.pcap"
def test_eq_1(self, checkDFilterCoun... | zzqcn/wireshark | test/suite_dfilter/group_bytes_ipv6.py | Python | gpl-2.0 | 3,366 |
__author__ = 'jcranwellward'
| jamescw/little_printer_django | django_printer/publication/tests/__init__.py | Python | mit | 29 |
from collections import Iterator
class Sequencer(Iterator):
__slots__ = ('start', 'value', 'step')
def __init__(self, start=0, step=1):
self.start = start
self.value = start
self.step = step
def __next__(self):
value = self.value
self.value += 1
return va... | PSU-OIT-ARC/django-arcutils | arcutils/auditor/utils.py | Python | mit | 378 |
# Generated by Django 2.2.19 on 2021-03-01 13:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('enterprise', '0123_enterprisecustomeridentityprovider_default_provider'),
]
operations = [
migrations.AlterField(
model_name='e... | edx/edx-enterprise | enterprise/migrations/0124_auto_20210301_1309.py | Python | agpl-3.0 | 788 |
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'precision.accounts'
verbose_name = "Accounts"
| FreeCodeCampRoma/precision_school-management | precision/accounts/apps.py | Python | mit | 131 |
# Copyright (c) 2015 David Wilson
# Icarus 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.
# Icarus is distributed in the hope that it... | jeroanan/GameCollection | Persistence/MongoPersistence.py | Python | gpl-3.0 | 18,210 |
# Copyright (c) 2018 PaddlePaddle 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 applic... | kuke/models | fluid/PaddleCV/HiNAS_models/build/ops.py | Python | apache-2.0 | 3,523 |
import mock
import simplejson as json
from auslib.global_state import dbo
from auslib.test.admin.views.base import ViewTest
class TestUsersAPI_JSON(ViewTest):
def testUsers(self):
ret = self._get('/users')
self.assertEqual(ret.status_code, 200)
data = json.loads(ret.data)
data['u... | aksareen/balrog | auslib/test/admin/views/test_permissions.py | Python | mpl-2.0 | 45,228 |
import gameDefs
Game = gameDefs.Game
Drive = gameDefs.Drive
Play = gameDefs.Play
Event = gameDefs.Event
def getPlay(game, drive, play, item, itemWNames):
play.body = itemWNames
gain = 0
kickoffLoc = item.find(' kickoff')
onsideLoc = item.find('on-side kick')
fieldGoalLoc = item.find(' field goal')
extraPointL... | erikjohannessen/cfb-ballots | CFBDB/parser.py | Python | mit | 35,803 |
# -*- coding: utf-8 -*-
from framework.routing import Rule, json_renderer
from website.addons.mendeley import views
api_routes = {
'rules': [
Rule(
[
'/settings/mendeley/accounts/',
],
'get',
views.mendeley_get_user_accounts,
jso... | njantrania/osf.io | website/addons/mendeley/routes.py | Python | apache-2.0 | 2,083 |
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request, 'index.html')
def about(request):
return render(request, 'about.html')
def contact(request):
return render(request, 'contact.html')
def Members(request):
return render(request, 'Members.html')
d... | PAHB/SIgma-Nu-idea-1 | Backend_stuff/sigma_nu/home_page/views.py | Python | apache-2.0 | 379 |
import os
from flask import Flask, render_template, request
import luigi
from luigi.contrib.gcs import GCSTarget, GCSClient
import subprocess
from merge_video import MergeVideoAndAudio
app = Flask(__name__)
@app.route('/')
def hello_world():
target = os.environ.get('TARGET', 'World')
return 'Hello {}!\n'.fo... | Alexander-Minyushkin/aistreamer | worker/app.py | Python | apache-2.0 | 1,520 |
ROW_TITLE = 0
ROW_WIDTH = 1
ROW_VALUE = 2
ROW_FORMAT = 3
ROW_BOX = 4
| pcolmant/repanier | repanier/xlsx/const.py | Python | gpl-3.0 | 69 |
# encoding: utf-8
"""
update/__init__.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2012 Exa Networks. All rights reserved.
Modified by Orange - 2014
"""
from copy import deepcopy
from bagpipe.exabgp.structure.address import AFI,SAFI
from bagpipe.exabgp.message import Message,prefix
from bagpipe.exa... | murat1985/bagpipe-bgp | bagpipe/exabgp/message/update/__init__.py | Python | apache-2.0 | 2,921 |
# Copyright (c) 2003-2010 Sylvain Thenault ([email protected]).
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# 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 L... | tlksio/tlksio | env/lib/python3.4/site-packages/pylint/reporters/__init__.py | Python | mit | 3,784 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import datetime
import random
import re
import sqlalchemy as sa
import structlo... | mozilla/build-relengapi | relengapi/blueprints/tooltool/__init__.py | Python | mpl-2.0 | 14,685 |
"""
Contains the base class for series
Made using sequences in mind
"""
from __future__ import print_function, division
from sympy.core.expr import Expr
from sympy.core.singleton import S
from sympy.core.cache import cacheit
from sympy.core.compatibility import integer_types
class SeriesBase(Expr):
"""Base Clas... | wxgeo/geophar | wxgeometrie/sympy/series/series_class.py | Python | gpl-2.0 | 3,031 |
# -*- coding: utf8 -*-
DEFAULT_URL_FIELDS = ['_text', 'href']
DEFAULT_SELECT_FIELDS = ['_text', 'value']
TEXT_FIELD = "_text"
TAG_FIELD = "_tag"
DEFAULT_FIELDS = ['_tag', 'class', 'id', '_text']
URL_TAG_TYPES = ['href', 'src', 'srcset']
DEFAULT_CACHE_TIMEOUT = 3600
DEFAULT_USER_AGENT = 'Mozilla/5.0 (Linux; Android 6.... | ivbeg/lazyscraper | lazyscraper/consts.py | Python | apache-2.0 | 426 |
#! /usr/bin/python
""" This file is an extension for the Nautilus
file manager, to provide a contextual menu to
clean metadata
"""
import logging
import urllib
try:
import gettext
gettext.install("mat")
except:
logging.warning("Failed to initialise gettext")
_ = lambda x: x
from gi.reposito... | jubalh/MAT | nautilus/nautilus-mat.py | Python | gpl-2.0 | 2,869 |
#python2.x
times = (int)(raw_input())
res_array = []
for i in range(times):
s = raw_input()
l = len(s)
res = 0
for j in range(l / 2):
res += abs(ord(s[j]) - ord(s[l-j-1]))
res_array.append(res)
for r in res_array:
print r | xbfool/hackerrank_xbfool | src/algorithms/warmup/love-letter.py | Python | mit | 230 |
import math
import prime
ps = prime.primes(100)
print ps
a=1
c=0
step=31
for x in ps:
a*=x
b=math.log(a)/math.log(2)
cl=c
c=int(b)
if( cl<step and c >=step ):
print "x=%d b=%f" % (x,b)
step+=32
c = [23,47,61]
a=1
for x in ps:
a*=x
if x in c:
b=math.log(a)/math.log(2)
print "x=%d a=%d b=%f" % (x,a,b)
... | a4a881d4/xm | python/test.py | Python | mit | 326 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-27 02:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inscricao_monitor', '0011_auto_20161224_1804'),
]
operations = [
migrations... | dparaujo/projeto | app_inscricoes/inscricao_monitor/migrations/0012_auto_20161226_2309.py | Python | gpl-3.0 | 520 |
#!/usr/bin/env python
#This file is part of DNApy. DNApy is a DNA editor written purely in python.
#The program is intended to be an intuitive, fully featured,
#extendable, editor for molecular and synthetic biology.
#Enjoy!
#
#Copyright (C) 2014 Martin Engqvist |
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | openpaul/DNApy | options.py | Python | gpl-3.0 | 1,948 |
# 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... | cpcloud/arrow | python/pyarrow/util.py | Python | apache-2.0 | 5,001 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('stats', '0005_auto_20150730_1234'),
]
operations = [
migrations.AlterField(
model_name='country',
na... | arnoldtan/cep_2015_sem2_assign2 | stats/migrations/0006_auto_20150730_1237.py | Python | apache-2.0 | 443 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.