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 |
|---|---|---|---|---|---|
#
# junitxml: extensions to Python unittest to get output junitxml
# Copyright (C) 2009 Robert Collins <robertc@robertcollins.net>
#
# Copying permitted under the LGPL-3 licence, included with this library.
"""unittest compatible JUnit XML output."""
import datetime
import re
import time
import unittest
# same f... | kraziegent/mysql-5.6 | xtrabackup/test/python/junitxml/__init__.py | Python | gpl-2.0 | 7,719 |
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies libraries (in identical-names) are properly handeled by xcode.
The names for all libraries participating in this buil... | Jet-Streaming/gyp | test/mac/gyptest-identical-name.py | Python | bsd-3-clause | 1,592 |
# flake8: noqa
from .base import Settings, Configuration
from .decorators import pristinemethod
__version__ = '0.8'
__all__ = ['Configuration', 'pristinemethod', 'Settings']
def _setup():
from . import importer
importer.install()
# django >=1.7
try:
import django
django.setup()
... | blindroot/django-configurations | configurations/__init__.py | Python | bsd-3-clause | 818 |
from setuptools import setup
setup(name='staticbs',
version='0.11',
description='A simple 3D electro-magnetostatic biot-savart solving simulator',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Programming Language :: Py... | grungy/staticbs | setup.py | Python | mit | 751 |
from django.conf.urls import patterns, url
urlpatterns = patterns('leonardo.module.media.server.views',
url(r'^(?P<path>.*)$', 'serve_protected_thumbnail',),
)
| django-leonardo/django-leonardo | leonardo/module/media/server/thumbnails_server_urls.py | Python | bsd-3-clause | 208 |
"""
Contains content applicability management classes
"""
from gettext import gettext as _
from logging import getLogger
from celery import task
from pulp.plugins.conduits.profiler import ProfilerConduit
from pulp.plugins.config import PluginCallConfiguration
from pulp.plugins.loader import api as plugin_api, except... | credativ/pulp | server/pulp/server/managers/consumer/applicability.py | Python | gpl-2.0 | 31,340 |
#
# Copyright 2008-2017 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 program is distributed ... | EdDev/vdsm | lib/vdsm/virt/vmdevices/storage.py | Python | gpl-2.0 | 29,125 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='nose-unittest',
version='0.1.1',
author='DISQUS',
author_email='opensource@disqus.com',
url='http://github.com/disqus/nose-unittest',
package_dir={'': 'src'},
packages=find_packages('src'),
zip_safe=False,
... | disqus/nose-unittest | setup.py | Python | apache-2.0 | 569 |
from __future__ import absolute_import, print_function, division
import argparse
import sys
class GPUCommand:
def __init__(self, logger):
self.logger = logger
self.client = None
self.registered = False
self.active = True
def main(self, args):
import aetros.cuda_gpu
... | aetros/aetros-cli | aetros/commands/GPUCommand.py | Python | mit | 1,123 |
"""
Created on 26.05.2017
:author: Humbert Moreaux
Tuleap REST API Client for Python
Copyright (c) Humbert Moreaux, All rights reserved.
This Python module 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;... | djurodrljaca/tuleap-rest-api-client | Tuleap/RestClient/Git.py | Python | lgpl-3.0 | 2,316 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from ....unittest import TestCase
import datetime
from oauthlib import common
from oauthlib.oauth2.rfc6749 import utils
from oauthlib.oauth2 import Client
from oauthlib.oauth2 import InsecureTransportError
from oauthlib.oauth2.rfc6749.cli... | metatoaster/oauthlib | tests/oauth2/rfc6749/clients/test_base.py | Python | bsd-3-clause | 10,495 |
r'''Parse strings using a specification based on the Python format() syntax.
``parse()`` is the opposite of ``format()``
The module is set up to only export ``parse()``, ``search()`` and
``findall()`` when ``import *`` is used:
>>> from parse import *
From there it's a simple thing to parse a string:
... | nateprewitt/pipenv | pipenv/vendor/parse.py | Python | mit | 43,969 |
# -*- coding: utf-8 -*-
# borrowed from https://github.com/kevinhendricks/KindleUnpack and modified
from __future__ import unicode_literals, division, absolute_import, print_function
import struct
import string
import re
from PIL import Image
from io import BytesIO
# note: struct pack, unpack, unpack_from all requi... | rupor-github/fb2mobi | modules/mobi_split.py | Python | mit | 30,736 |
#Example mathlocal.py
from math import sin # sin is imported as local
print sin(0.5)
| csparkresearch/eyes-online | app/static/scripts/Maths/mathlocal.py | Python | gpl-3.0 | 90 |
"""
@file
@brief Data about timeseries.
"""
from datetime import datetime, timedelta
import numpy
def generate_sells(duration=730, end=None,
week_coef=None, month_coef=None,
trend=1.1):
"""
Generates dummy data and trends and seasonality.
"""
if week_coef is None:... | sdpython/ensae_teaching_cs | src/ensae_teaching_cs/data/data_ts.py | Python | mit | 1,197 |
# -*- coding: utf-8 -*-
"""
Tests for old bugs
~~~~~~~~~~~~~~~~~~
Unittest that test situations caused by various older bugs.
:copyright: (c) 2009 by the Jinja Team.
:license: BSD.
"""
from jinja2 import Environment, DictLoader, TemplateSyntaxError
env = Environment()
from nose import SkipTest
f... | yesudeep/cmc | app/jinja2/tests/test_old_bugs.py | Python | mit | 2,707 |
'''
Monkey patch setuptools to write faster console_scripts with this format:
import sys
from mymodule import entry_function
sys.exit(entry_function())
This is better.
(c) 2016, Aaron Christianson
http://github.com/ninjaaron/fast-entry_points
'''
from setuptools.command import easy_install
@classmethod... | pomarec/core | fastentrypoints.py | Python | gpl-3.0 | 2,205 |
import sys
from java.util import Vector
def addTemplate(core):
mobileTemplates = Vector()
mobileTemplates.add('graul_mauler')
mobileTemplates.add('graul_mangler')
core.spawnService.addLairTemplate('dantooine_graul_mauler_lair_1', mobileTemplates , 15, 'object/tangible/lair/base/poi_all_lair_rocks_large_evil_fi... | agry/NGECore2 | scripts/mobiles/lairs/dantooine_graul_mauler_lair_2.py | Python | lgpl-3.0 | 340 |
def get_codeset(encoding):
coding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
ecoding = coding + '-.'
return {
'simple': {
'coding': coding,
'max_value': 61,
'char': ',',
'dchar': '',
'none': '_',
'value... | justquick/google-chartwrapper | gchart/encoding.py | Python | bsd-3-clause | 4,463 |
#!/usr/bin/python
input_path = './src/'
output_path = './www/editor.js'
import re, os, time, sys
class CompileError(Exception):
def __init__(self, text):
Exception.__init__(self, text)
class Source:
def __init__(self, path):
self.path = path
self.name = os.path.basename(path)
self.code = open(path, 'r').r... | superarts/JekyllMetro | games/rapt/editor/build.py | Python | mit | 2,729 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies building a target from a .gyp file a few subdirectories
deep when the --generator-output= option is used to put the build
confi... | devcline/mtasa-blue | vendor/google-breakpad/src/tools/gyp/test/generator-output/gyptest-subdir2-deep.py | Python | gpl-3.0 | 1,034 |
#!/usr/bin/env python
#
# https://launchpad.net/wxbanker
# transactionlist.py: Copyright 2007-2010 Mike Rooney <mrooney@ubuntu.com>
#
# This file is part of wxBanker.
#
# wxBanker is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | mrooney/wxbanker | wxbanker/bankobjects/transactionlist.py | Python | gpl-3.0 | 1,282 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import inspect
import sys
import warnings
from collections import defaultdict
from collections import deque
from collections import OrderedDict
import attr
import py
import six
from more_itert... | hackebrot/pytest | src/_pytest/fixtures.py | Python | mit | 49,942 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_odu_odu_named_payload_type import TapiOduOduNamedPayloadType # noqa: F401,E501
from tapi_... | karthik-sethuraman/ONFOpenTransport | RI/flask_server/tapi_server/models/tapi_odu_odu_payload_type.py | Python | apache-2.0 | 3,032 |
#
# -*- coding: utf-8 -*-
# import subman fixture
# override plugin manager with one that provides
# the ostree content plugin
# test tree format
#
# test repo model
#
# test constructing from Content models
# ignores wrong content type
import ConfigParser
import mock
from nose.plugins.skip import SkipTest
import f... | nguyenfilip/subscription-manager | test/test_ostree_content_plugin.py | Python | gpl-2.0 | 41,650 |
# -*- coding: utf-8 -*-
from openprocurement.tender.core.utils import optendersresource
from openprocurement.tender.openeu.views.complaint_document import TenderEUComplaintDocumentResource
@optendersresource(name='esco:Tender Complaint Documents',
collection_path='/tenders/{tender_id}/complaints/{c... | openprocurement/openprocurement.tender.esco | openprocurement/tender/esco/views/complaint_document.py | Python | apache-2.0 | 688 |
#!/usr/bin/python
# android-build.py
# Build android
import sys
import os, os.path
import shutil
from optparse import OptionParser
CPP_SAMPLES = ['cpp-empty-test', 'cpp-tests']
LUA_SAMPLES = ['lua-empty-test', 'lua-tests']
ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES
def get_num_of_cpu():
''' The build process can be... | cmdwin32/tileMapHomework | tillmap/cocos2d/build/android-build.py | Python | unlicense | 10,110 |
#!/usr/bin/env python
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.version_info < (2, 6):
raise NotImplementedError("Sorry, you need at least Python 2.6 or Python 3.2+ to use bottle.")
import bottle
setup(name='bottle',
version=bottle.__v... | taisa007/bottle-ja | setup.py | Python | mit | 1,742 |
"""
Unit tests for the NeuroTools.signals module
"""
import matplotlib
matplotlib.use('Agg')
from NeuroTools import io
import NeuroTools.signals.spikes as spikes
import NeuroTools.signals.analogs as analogs
from NeuroTools.signals.pairs import *
import numpy, unittest, os
from NeuroTools.__init__ import check_numpy_... | NeuralEnsemble/NeuroTools | test/test_spikes.py | Python | gpl-2.0 | 21,780 |
import re
import subprocess
import os
def get_git_info(path='.', abort_dirty=True):
info = {}
if not is_git(path):
return None
if abort_dirty and not is_clean(path):
return None
info['url'] = get_repo_url(path)
info['commit'] = get_commit(path)
return info
def is_git(path='... | studioml/studio | studio/git_util.py | Python | apache-2.0 | 2,399 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# File: imagenet-resnet.py
import cv2
import sys
import argparse
import numpy as np
import os
import multiprocessing
import tensorflow as tf
from tensorflow.contrib.layers import variance_scaling_initializer
from tensorpack import *
from tensorpack.utils.stats import Rati... | haamoon/tensorpack | examples/ResNet/imagenet-resnet.py | Python | apache-2.0 | 10,934 |
import os
import django
from channels.routing import get_default_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timestrap.settings.docker")
django.setup()
application = get_default_application()
| cdubz/timestrap | timestrap/asgi.py | Python | bsd-2-clause | 217 |
#
# 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... | wileeam/airflow | airflow/example_dags/example_latest_only_with_trigger.py | Python | apache-2.0 | 1,630 |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... | MOA-2011/enigma2-plugin-extensions-openwebif | plugin/controllers/views/mobile/movies.py | Python | gpl-2.0 | 8,464 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse_lazy
from django.conf import settings
from rest_framework import serializers
from rest_flex_fields import FlexFieldsModelSerializer
from rest_flex_fields.serializers import FlexFieldsSerializerMixin
from easy... | hzlf/openbroadcast.org | website/apps/alibrary/apiv2/serializers.py | Python | gpl-3.0 | 9,901 |
def OPCODE(value):
global OPCODE_SENT
for k,v in OPCODE_SENT.iteritems():
if v is value:
return int(k)
break
OPCODE_RECV = dict()
OPCODE_RECV["0"] = "CoreProtocol"
OPCODE_RECV["1"] = "OptionsInfo"
OPCODE_RECV["3"] = "DefineSearches"
OPCODE_RECV["4"] = "ResultInfo"
OPCODE_RECV["... | tassia/DonkeySurvey | src/GUIProtoDefinitions.py | Python | gpl-3.0 | 3,753 |
x, y = int(5), int(4)
| python-security/pyt | examples/example_inputs/assignment_multiple_assign_call.py | Python | gpl-2.0 | 22 |
# Not used now
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SSL_DISABLE = False
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_RECORD_QUERIES = True
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_POR... | sysuwangrui/Flask-BBS | config.py | Python | mit | 3,310 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
from odoo.osv import expression
try:
from cn2an import an2cn
except ImportError:
an2cn = None
class AccountMove(models.Model):... | jeremiahyan/odoo | addons/l10n_cn/models/account_move.py | Python | gpl-3.0 | 1,602 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyslvs_ui/synthesis/structure_synthesis/structure_widget.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from qtpy import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def... | KmolYuan/Pyslvs-PyQt5 | pyslvs_ui/synthesis/structure_synthesis/structure_widget_ui.py | Python | agpl-3.0 | 17,172 |
import nox
PYTHON_VERSIONS = ["3.8", "3.9"]
PACKAGE = "abilian"
@nox.session(python=PYTHON_VERSIONS)
def pytest(session):
session.run("poetry", "install", external="True")
session.install("psycopg2-binary")
session.run("yarn", external="True")
session.run("pip", "check")
session.run("pytest", "-... | abilian/abilian-sbe | noxfile.py | Python | lgpl-2.1 | 802 |
import glob
import json
import nltk
from nltk import word_tokenize
class DataSanitizer:
@staticmethod
def sanitize():
reviews = []
total_reviews = 0
raw_files_urls = glob.glob("raw_data/*.json")
for raw_files_url in raw_files_urls:
raw_reviews = json.load(open(raw_files_url))
total_reviews += le... | rberman/PSA | DataSanitizer.py | Python | mit | 683 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/tree-math | setup.py | Python | apache-2.0 | 1,243 |
# -*- coding: utf-8 -*-
#
# rotterdam documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 1 11:54:37 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | lvh/rotterdam | docs/conf.py | Python | apache-2.0 | 8,780 |
from django import forms
from django.contrib.gis.geos import Point
from widgets import AddAnotherWidgetWrapper
from django.core.exceptions import ValidationError
from .models import (Site, CycleResultSet, Monitor, ProgrammeResources,
ProgrammeImage)
class SiteForm(forms.ModelForm):
latitude ... | Code4SA/umibukela | umibukela/forms.py | Python | mit | 5,345 |
# Generated by Django 2.2.10 on 2020-02-04 09:02
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import main.models.user
import timezone_field.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_p... | makeev/django-boilerplate | back/main/migrations/0001_initial.py | Python | mit | 3,330 |
# -*- coding: utf-8 -*-
#-------------------------------------------------
#-- reconstruction workbench
#--
#-- microelly 2016 v 0.1
#--
#-- GNU Lesser General Public License (LGPL)
#-------------------------------------------------
from say import *
import cv2
import reconstruction.mpl
reload(reconstruction.mpl)
... | microelly2/reconstruction | reconstruction/pathfinder.py | Python | lgpl-3.0 | 4,547 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009, 2013 Zuza Software Foundation
#
# This file is part of Pootle.
#
# Pootle 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 t... | arky/pootle-dev | pootle/apps/pootle_terminology/templatetags/terminology_tags.py | Python | gpl-2.0 | 1,119 |
# Copyright (C) 2012,2013,2016
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms... | kkreis/espressopp | src/tools/pathintegral.py | Python | gpl-3.0 | 9,666 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""Core rules for Pants to operate correctly.
These are always activated and cannot be disabled.
"""
from pants.core.goals import fmt, lint, package, repl, run, tailor, test, typecheck
f... | jsirois/pants | src/python/pants/core/register.py | Python | apache-2.0 | 1,474 |
import sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
from maya.mel import eval as meval
from mesh_maya_tube import MayaTube
kPluginNodeTypeName = "tubeDeformer"
tubeDeformerId = OpenMaya.MTypeId(0x0020A52C)
class tubeDeformer(OpenMayaMPx.MPxNode):
# class variables
#firs... | ainaerco/meshTools | python/tubeDeformer.py | Python | gpl-2.0 | 13,150 |
# 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... | xhochy/arrow | python/pyarrow/hdfs.py | Python | apache-2.0 | 7,221 |
import time
from amberclient.common import amber_client
from amberclient.common.listener import Listener
from amberclient.dummy import dummy
__author__ = 'paoolo'
class DummyListener(Listener):
def handle(self, response):
print str(response)
if __name__ == '__main__':
ip = raw_input('IP (default:... | project-capo/amber-python-clients | src/amberclient/examples/dummy_example.py | Python | mit | 982 |
#!/usr/bin/env python
# --!-- coding: utf8 --!--
import os
from collections import OrderedDict
from PyQt5.QtCore import QSize
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QFileDialog
from manuskript import exporter
from manuskript.ui.expor... | gedakc/manuskript | manuskript/ui/exporters/exportersManager.py | Python | gpl-3.0 | 4,984 |
#
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests.mock import patch
from ansible.modules.network.ml... | le9i0nx/ansible | test/units/modules/network/mlnxos/test_mlnxos_l3_interface.py | Python | gpl-3.0 | 4,186 |
# Copyright 2014 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 logging
from pylib import valgrind_tools
from pylib.base import base_test_result
from pylib.base import test_run
from pylib.base import test_collecti... | guorendong/iridium-browser-ubuntu | build/android/pylib/local/device/local_device_test_run.py | Python | bsd-3-clause | 3,224 |
# The code for changing pages was derived from: http://stackoverflow.com/questions/7546050/switch-between-two-frames-in-tkinter
# License: http://creativecommons.org/licenses/by-sa/3.0/
import matplotlib
matplotlib.use("TkAgg")
#from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
... | AIAA-BOR-2017/ground-station | tkinter_gui_example.py | Python | mit | 1,877 |
"""
Copyright (C) 2013-2018 Calliope contributors listed in AUTHORS.
Licensed under the Apache 2.0 License (see LICENSE file).
"""
import ruamel.yaml
from calliope.core.util.logging import log_time
from calliope import exceptions
from calliope.backend import checks
import numpy as np
import xarray as xr
import calli... | brynpickering/calliope | calliope/backend/run.py | Python | apache-2.0 | 14,098 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | frreiss/tensorflow-fred | tensorflow/python/data/experimental/service/__init__.py | Python | apache-2.0 | 17,192 |
from thread import start_new_thread
from pyaudio import PyAudio
from pyspeech import best_speech_result, put_audio_data_in_queue
from time import sleep
import Queue
def background_stt(queue, profile, stt_type = 'google'):
start_new_thread(_spawn_listeners, (queue, profile, stt_type,))
def _spawn_listeners(queue, pr... | MattWis/constant_listener | constant_listener/constant_listener.py | Python | mit | 895 |
# ----------------------------------------------------------------------------
# Copyright (c) 2014--, biocore development team
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ------------------------------------------------... | ekopylova/burrito-fillings | bfillings/align.py | Python | bsd-3-clause | 1,310 |
#!/usr/bin/env python3
from nltk.corpus import wordnet as wn
import sys, argparse, inflect
def explode_hyponyms(ss):
hs = ss.hyponyms()
l = []
if hs:
for h in hs:
l += explode_hyponyms(h)
return l
else:
return [ ss ]
def wordlist(synsets, plurals=False):
name... | spikelynch/bots | amightyhost/hyponyms.py | Python | gpl-2.0 | 1,589 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ava.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| benhoff/ava | src/manage.py | Python | gpl-3.0 | 246 |
#!/usr/bin/env python
"""
Module containing all the player classes for the TicTacToe game. These should not be define directley and instead
only defined by the game classes
"""
import datetime
import logging
import socket
import pygame
import ai
class TTTPlayer(object):
"""
Base ttt player. All subclasses mu... | DevelopForLizardz/TicTacTio | tttio/players.py | Python | mit | 22,587 |
# Copyright 2015, Rackspace, US, 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 w... | BiznetGIO/horizon | openstack_dashboard/api/rest/swift.py | Python | apache-2.0 | 9,164 |
import typing
from typing import Any, Callable, List, Optional, Sequence
import jax
import jax.nn as jnn
import jax.random as jrandom
from ..custom_types import Array
from ..module import Module, static_field
from .linear import Linear
def _identity(x):
return x
if getattr(typing, "GENERATING_DOCUMENTATION", ... | patrick-kidger/equinox | equinox/nn/composed.py | Python | apache-2.0 | 3,841 |
# -*- coding: utf-8 -*-
# Copyright 2005 Michael Urman
# Copyright 2016 Christoph Reiter
#
# 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... | hzlf/openbroadcast.org | website/tools/mutagen/id3/_tags.py | Python | gpl-3.0 | 21,234 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygtk
pygtk.require('2.0')
import gtk
import json
from collections import namedtuple
from array import *
import pango
import random
from gettext import gettext as _
import copy
''' Scales '''
IMAGES_SCALE = [100, 100]
LETTERS_SCALE = [100, 100]
'''Color Selec... | ggimenez/HomeworkDesigner.activity | template.activity/simpleassociation.py | Python | gpl-2.0 | 17,950 |
from __future__ import absolute_import
from plotly import optional_imports
# Require that numpy exists for figure_factory
np = optional_imports.get_module("numpy")
if np is None:
raise ImportError(
"""\
The figure factory module requires the numpy package"""
)
from plotly.figure_factory._2d_density ... | plotly/plotly.py | packages/python/plotly/plotly/figure_factory/__init__.py | Python | mit | 2,397 |
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Switzerland Account Tags",
"category": "Localisation",
"summary": "",
"version": "14.0.1.0.0",
"author": "Camptocamp SA, Odoo Community Association (OCA)",
"website": "https://github.com/OCA... | OCA/l10n-switzerland | l10n_ch_account_tags/__manifest__.py | Python | agpl-3.0 | 561 |
"""
WSGI config for pycontw2016 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/dev/howto/deployment/wsgi/
"""
import os
from django.conf import settings
from django.core.wsgi import get_wsgi_application
... | pycontw/pycontw2016 | src/pycontw2016/wsgi.py | Python | mit | 1,200 |
from __future__ import absolute_import
from .arrow import (ArrowArchivedMixin, ArrowCreatedMixin,
ArrowCreatedModifiedMixin)
from .base import ArchivedMixin, CreatedMixin, CreatedModifiedMixin
from .pendulum import (PendulumArchivedMixin, PendulumCreatedMixin,
PendulumCreated... | croscon/fleaker | fleaker/peewee/mixins/time/__init__.py | Python | bsd-3-clause | 335 |
from mumax import *
from math import *
# material
msat(800e3)
aexch(1.3e-11)
alpha(0.02)
# geometry
nx = 512
ny = 512
gridsize(nx, ny, 1)
partsize(1500e-9, 1500e-9, 3e-9)
# initial magnetization
uniform(1, 1, 0)
alpha(2)
run(5e-9) # relax
alpha(0.01)
save("m", "text")
# run
autosave("m", "omf", 10e-12... | mumax/1 | test/fieldmask/spinwaves.py | Python | gpl-3.0 | 582 |
import sys
import urlparse
import requests
from itertools import chain
from motherbrain.helpers.tlds import tlds
TLD_URL = 'http://data.iana.org/TLD/tlds-alpha-by-domain.txt'
def domain_by_netloc(netloc):
all_levels = netloc.split('.')
top_levels = [x for x in all_levels if x.upper() in tlds]
other_l... | urlist/urlist | motherbrain/helpers/fetch.py | Python | gpl-3.0 | 834 |
import unittest
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'datastructure'))
import binary_heap
class BinaryHeapFindMinTest(unittest.TestCase):
def test_return_minimum_item_from_heap(self):
heap = binary_heap.BinaryHeap()
heap.insert(5)
heap.insert(3)
hea... | gwtw/py-data-structures | test/binary_heap_find_min_test.py | Python | mit | 418 |
# 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 unicode_literals
import collections
import inspect
import types
from .base import (
MachErr... | michath/ConMonkey | python/mach/mach/decorators.py | Python | mpl-2.0 | 6,038 |
import json
import os
import unittest
import uuid
import pytest
from six.moves.urllib.error import HTTPError
wptserve = pytest.importorskip("wptserve")
from .base import TestUsingServer, doc_root
class TestFileHandler(TestUsingServer):
def test_GET(self):
resp = self.request("/document.txt")
sel... | youtube/cobalt | third_party/web_platform_tests/tools/wptserve/tests/functional/test_handlers.py | Python | bsd-3-clause | 11,798 |
import os
import pytest
from YSOVAR import plot
from . import outroot
@pytest.mark.usefixtures("data")
class Test_plots():
def test_lc_plots(self, data):
plot.make_lc_plots(data, outroot, twinx = True)
def test_cmd_plots(self, data):
plot.make_cmd_plots(data, outroot)
def test_ls_plots(... | YSOVAR/YSOVAR | test/test_plot.py | Python | gpl-3.0 | 1,134 |
# coding: utf-8
#
# xiaoyu <xiaokong1937@gmail.com>
#
# 2014/12/24 Merry Christmas
#
"""
Tests for xlink SDK.
"""
import unittest
from xlink import XlinkClient
class XlinkTestCase(unittest.TestCase):
def setUp(self):
APIKEY = '727c554409d5fa166860008db6385987782d5728'
APIUSER = 'apiuser'
... | xkong/xlinkwot | xlink_open_wrt/xlink_sdk/tests.py | Python | bsd-3-clause | 519 |
import stripe
from stripe.test.helper import (
StripeResourceTest, DUMMY_DISPUTE, NOW
)
class DisputeTest(StripeResourceTest):
def test_list_all_disputes(self):
stripe.Dispute.list(created={'lt': NOW})
self.requestor_mock.request.assert_called_with(
'get',
'/v1/disput... | colehertz/Stripe-Tester | venv/lib/python3.5/site-packages/stripe/test/resources/test_disputes.py | Python | mit | 1,903 |
# Reverse digits of an integer.
# Example1: x = 123, return 321
# Example2: x = -123, return -321
# If the input number is big enough, the number may overflow in C or Java. However, the int type
# number in Python doesn't overflow beyond 32 bits (4 bytes). So the code below works for Python without
# handling overflo... | lijunxyz/leetcode_practice | reverse_integer_easy/Solution2.py | Python | mit | 777 |
#!/usr/bin/env python
import sys
import polyglot_tokenizer as tok
if __package__ is None and not hasattr(sys, "frozen"):
# direct call of __main__.py
import os.path
path = os.path.realpath(os.path.abspath(__file__))
sys.path.append(os.path.dirname(os.path.dirname(path)))
if __name__ == '__main__':
... | irshadbhat/indic-tokenizer | polyglot_tokenizer/__main__.py | Python | mit | 335 |
"""
ThottleObject: Base class for throttable objects.
"""
class ThrottleObject(object):
"""
ThrottleObject: Base class for throttable objects.
Inputs:
The address of a host to check
The method to use for a metric
Threshold to measure metric result against.
If method() returns ... | birm/dbThrottle | dbThrottle/ThrottleObject.py | Python | gpl-3.0 | 1,141 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-21 12:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('account', '0001_initial'),
('course', '0001_initial... | spyua/budda_scanner | budda/course/migrations/0002_lecture.py | Python | gpl-3.0 | 766 |
#!/usr/bin/env python
"""
Copyright 2016 ARC Centre of Excellence for Climate Systems Science
author: Scott Wales <scott.wales@unimelb.edu.au>
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
h... | ScottWales/mosrs-setup | mosrs/setup.py | Python | apache-2.0 | 7,573 |
thepath = 'C:\Users\Spyros\OneDrive\workspace\lerot\output_data\listwise_LL_evaluation_data\\Fold1\\data.csv'
data = []
with open(thepath, 'r') as f:
datastring = f.read()
data = datastring.strip().split('\n')
performance = []
my_wins = 0.0
site_wins = 0.0
for i in data:
current_run = i.split(',')
if int(... | m0re4u/LeRoT-SCLP | scripts/makeTsv.py | Python | gpl-3.0 | 1,359 |
import requests
from requests.adapters import HTTPAdapter
from requests.exceptions import RetryError
from requests.packages.urllib3.util.retry import Retry
import urllib.parse
import os
from . import _agent
from . import errors
class Client():
"""A base class to define clients for the ols servers.
This is a ... | elopio/snapcraft | snapcraft/storeapi/_client.py | Python | gpl-3.0 | 3,393 |
# -*- coding: utf-8 -*-
import operator
import os
import re
import subprocess
import time
import urllib
from xml.dom.minidom import parseString as parse_xml
from module.network.CookieJar import CookieJar
from module.network.HTTPRequest import HTTPRequest
from ..internal.Hoster import Hoster
from ..internal.misc impo... | synopat/pyload | module/plugins/hoster/YoutubeCom.py | Python | gpl-3.0 | 42,175 |
# -*- encoding: utf-8 -*-
# pilas engine: un motor para hacer videojuegos
#
# Copyright 2010-2014 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# Website - http://www.pilas-engine.com.ar
from pilasengine import colores
from pilasengine.fondos.fondo import Fondo
class Fondos(object):
... | hgdeoro/pilas | pilasengine/fondos/__init__.py | Python | lgpl-3.0 | 2,302 |
from django.conf import settings
from site_news.models import SiteNewsItem
def site_news(request):
"""
Inserts the currently active news items into the template context.
This ignores MAX_SITE_NEWS_ITEMS.
"""
# Grab all active items in proper date/time range.
items = SiteNewsItem.current_a... | glesica/django-site-news | site_news/context_processors.py | Python | bsd-3-clause | 379 |
from tests.helpers import create_ctfd, register_user, login_as_user
from CTFd.models import Teams
def test_admin_panel():
"""Does the admin panel return a 200 by default"""
app = create_ctfd()
with app.app_context():
client = login_as_user(app, name="admin", password="password")
r = client... | liam-middlebrook/CTFd | tests/test_admin_facing.py | Python | apache-2.0 | 2,420 |
from .log_loss import *
from .log_loss_weighted import *
try:
from .fast_log_loss import *
except ImportError:
print("warning: could not import fast log loss")
print("warning: returning handle to standard loss functions")
# todo replace with warning object
import log_loss as fast_log_loss
try:
... | ustunb/risk-slim | riskslim/loss_functions/__init__.py | Python | bsd-3-clause | 572 |
# Copyright 2016 Google 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,... | catapult-project/catapult | third_party/gae_ts_mon/gae_ts_mon/protobuf/google/auth/compute_engine/__init__.py | Python | bsd-3-clause | 719 |
'''
Accepts csv number, and fractions as arguments and writes random subsamples out.
'''
import argparse
import json
import random
import pandas as pd
def random_df_sample(df, fraction):
indicies = list(df.index)
sample = random.sample(indicies, int(fraction * len(indicies)))
return df.loc[sample]
def ma... | c-bun/CrossCompare | subsample.py | Python | apache-2.0 | 1,477 |
'''
Author: Alex Walter
Date: 5/13/2013
For computing and comparing QE measurements
(Originally for comparing QE measurements with different polariztions of light.
If you just want to look at a single QE measurement choose a dummy polariztion angle = 0)
Usage:
$ python QECalibration.py
Then click the buttons
Advan... | bmazin/ARCONS-pipeline | QEcal/QECalibration.py | Python | gpl-2.0 | 54,351 |
"""Python CLI for Microsoft SQL."""
# Copyright (C) 2016 Russell Troxel
# 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.... | rtrox/mssqlcli | mssqlcli/__init__.py | Python | gpl-3.0 | 728 |
from .emitter import Emitter
from .parser import Parser, Packet
from .transports.polling import Polling
import gevent
import gevent.event
import gevent.queue
import json
import logging
logger = logging.getLogger(__name__)
class Client(Emitter):
TRANSPORTS = {
'polling': Polling
}
def __init__(se... | max00xam/service.maxxam.teamwatch | lib/engineio_client/client.py | Python | gpl-3.0 | 5,306 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------
# Filename : trello_search.py
# Description :
# Created By : Joe Pistone
# Date Created : 16-Mar-2017 10:07
# Date Modified :
#
# License : Development
#
# Description : Search for trello users... | daguy666/scripts | trello_search.py | Python | unlicense | 2,154 |
#!/usr/bin/env python
# coding=utf-8
# Copyright (C) 2015 by Serge Poltavski #
# serge.poltavski@gmail.com #
# #
# This program is free software; you can redistribute it... | uliss/pddoc | pddoc/pd/externals/core/xletsdb_core.py | Python | gpl-3.0 | 7,201 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from textwrap import... | ity/pants | contrib/findbugs/tests/python/pants_test/contrib/findbugs/tasks/test_findbugs_integration.py | Python | apache-2.0 | 5,278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.