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 |
|---|---|---|---|---|---|
import unittest
from django.db import connection
from django.test import TestCase
from django.test.runner import DiscoverRunner
from django.utils import six
from .models import Person
@unittest.skipUnless(connection.vendor == 'sqlite', 'Only run on sqlite so we can check output SQL.')
class TestDebugSQL(unittest.Te... | Sonicbids/django | tests/test_runner/test_debug_sql.py | Python | bsd-3-clause | 3,765 |
# This file is part of Androguard.
#
# Copyright (C) 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | androguard/androguard | androguard/decompiler/dad/dast.py | Python | apache-2.0 | 23,596 |
#####################################################################
# $HeadURL $
# File: ReqManagerHandler.py
########################################################################
"""
:mod: ReqManagerHandler
.. module: ReqManagerHandler
:synopsis: Implementation of the RequestDB service in the DISET framework
... | miloszz/DIRAC | RequestManagementSystem/Service/ReqManagerHandler.py | Python | gpl-3.0 | 12,725 |
# Copyright 2016 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... | pcm17/tensorflow | tensorflow/python/debug/cli/debugger_cli_common_test.py | Python | apache-2.0 | 45,146 |
import os
_, folder = os.path.split(os.getcwd())
import mne
raw=mne.io.Raw('MNE/'+folder+'_raw.fif');
events = mne.find_events(raw, stim_channel='STI 014')
event_id = 2048 # the event number in events
tmin = -0.5 # start of each epoch (200ms before the trigger)
tmax = 0.8 # end of each epoch (500ms after the trigg... | yuval-harpaz/MNE4D | pyScripts/average2048.py | Python | gpl-2.0 | 1,653 |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: CST05
#
# Created: 01/11/2013
# Copyright: (c) CST05 2013
# Licence: <your licence>
#-------------------------------------------------------------------------------
import arcpy... | adambreznicky/python | historic/addNewMeasures.py | Python | mit | 1,466 |
# pygsear
# Copyright (C) 2003 Lee Harr
#
#
# This file is part of pygsear.
#
# pygsear 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.... | davesteele/pygsear-debian | examples/twisted-pygame/twist_tac_toe/GameServer.py | Python | gpl-2.0 | 8,481 |
# Dorrie - Web interface for building Fedora Spins/Remixes.
# Copyright (C) 2009 Red Hat Inc.
# Author: Shreyank Gupta <sgupta@redhat.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation... | praveenkumar/dorrie | dorrie/urls.py | Python | agpl-3.0 | 1,805 |
# Copyright (c) 2018-2021 Micro Focus or one of its affiliates.
# Copyright (c) 2018 Uber Technologies, 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/licen... | uber/vertica-python | vertica_python/vertica/messages/backend_messages/parse_complete.py | Python | apache-2.0 | 2,037 |
import _plotly_utils.basevalidators
class OutlinecolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="outlinecolor", parent_name="choropleth.colorbar", **kwargs
):
super(OutlinecolorValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/choropleth/colorbar/_outlinecolor.py | Python | mit | 441 |
# -*- coding: utf-8 -*-
"""
Copyright 2016 Walter José and Alex de Sá
This file is part of the RECIPE Algorithm.
The RECIPE 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 (a... | RecipeML/Recipe | recipe/fit_map.py | Python | gpl-3.0 | 1,598 |
'''
read the input data, parse to int list;
create mappings of (user,item) -> review int list
@author: roseck
@date Mar 15, 2017
'''
from __builtin__ import dict
import gzip
class DataPairMgr():
def _int_list(self,int_str):
'''utility fn for converting an int string to a list of int
'''
... | rosecatherinek/TransNets | src/DatasetUtils/DataPairMgr.py | Python | gpl-3.0 | 1,772 |
import urllib2
import os
import subprocess
import time
jarfile = os.path.dirname(os.path.realpath("__file__")) + '/../lib/agent.jar'
def do_joloikia(java,juser,jclass,jmx_url):
port = jmx_url.split(':')[2].split('/')[0]
ps = subprocess.Popen(['sudo', '-u', juser, java, '-jar', jarfile, 'list'], stdout=subproc... | net-angels/puypuy | lib/jolostart.py | Python | apache-2.0 | 757 |
"""Resource manager for gitPlugin.
"""
import re
import commands
import os
import engage.drivers.resource_manager as resource_manager
import engage.drivers.resource_metadata as resource_metadata
import engage.utils.path as iupath
import engage_utils.process as iuprocess
import engage.utils.log_setup
logger = engage... | quaddra/engage | python_pkg/engage/drivers/trac/gitplugin.py | Python | apache-2.0 | 4,049 |
'''
FastSineGen module
'''
import math
from tuby.task import Task
class FastSineGen(Task):
'''
'Fast' sine generator. it accept a period that is a multiple of the basic scheduler frequency.
'''
def __init__(self, name, period_steps, amplitude=1.0, phase=0.0):
'''
the resulti... | Bellaz/Tuby | tuby/fastn_sine_gen.py | Python | gpl-3.0 | 1,368 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack LLC.
# 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/LICEN... | genius1611/Keystone | keystone/contrib/extensions/admin/__init__.py | Python | apache-2.0 | 1,232 |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | DataONEorg/d1_python | lib_common/src/d1_common/tests/test_nodelist.py | Python | apache-2.0 | 1,514 |
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | nuclear-wizard/moose | python/peacock/tests/utils/test_WidgetUtils.py | Python | lgpl-2.1 | 1,300 |
from collections import namedtuple
DataRecord = namedtuple('Record', [
'id_number',
'customer_class',
'node',
'arrival_date',
'waiting_time',
'service_start_date',
'service_time',
'service_end_date',
'time_blocked',
'exit_date',
'destination',
'queue_size_at_arrival',
... | CiwPython/Ciw | ciw/data_record.py | Python | mit | 371 |
#The DF of a tidal stream
import copy
import numpy
import multiprocessing
import scipy
from scipy import special, interpolate, integrate
if int(scipy.__version__.split('.')[1]) < 10: #pragma: no cover
from scipy.maxentropy import logsumexp
else:
from scipy.misc import logsumexp
from galpy.orbit import Orbit
fro... | followthesheep/galpy | galpy/df_src/streamdf.py | Python | bsd-3-clause | 117,381 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Ken Pepple
#
# 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
#
#... | tylertian/Openstack | openstack F/nova/nova/tests/test_versions.py | Python | apache-2.0 | 2,453 |
from BackgroundSubtractionAbstract import BackgroundSubtractionAbstract
import numpy as np
import cv2
__author__ = 'Luqman'
class KMeans(BackgroundSubtractionAbstract):
def __init__(self, image, k):
BackgroundSubtractionAbstract.__init__(self, "KMeans")
self.background_model = BackgroundModel(im... | umanium/trafficmon | id/trafficmon/backgroundsubtraction/KMeans.py | Python | mit | 2,326 |
import pytest
class TestHciattach:
@pytest.mark.complete("hciattach ")
def test_1(self, completion):
assert completion
| algorythmic/bash-completion | test/t/test_hciattach.py | Python | gpl-2.0 | 137 |
#!/usr/bin/python
from __future__ import division
import argparse
import datetime, sys, os
import urllib2, json
import ttbindec, defs
p = argparse.ArgumentParser()
p.add_argument('ttbin', nargs='*', type=argparse.FileType('rb'), default=sys.stdin, help='.ttbin files (default stdin)')
p.add_argument('-g', '--geolocate... | dlenski/ttbindec | ttbin_summary.py | Python | mit | 3,157 |
import sys
import unittest
# http://stackoverflow.com/a/17981937/1942837
from contextlib import contextmanager
from io import StringIO
@contextmanager
def captured_output():
new_out, new_err = StringIO(), StringIO()
old_out, old_err = sys.stdout, sys.stderr
try:
sys.stdout, sys.stderr = new_out, ... | gprMax/gprMax | tests/test_input_cmd_funcs.py | Python | gpl-3.0 | 2,726 |
from sprockets.handlers.status import __version__
needs_sphinx = '1.0'
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx']
source_suffix = '.rst'
master_doc = 'index'
project = 'sprockets.handlers.status'
copyright = '2015, AWeber Communications'
release = _... | sprockets/sprockets.handlers.status | docs/conf.py | Python | bsd-3-clause | 596 |
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from scrapy.item import Item, Field
class DianpingItem(Item):
# define the fields for your item here like:
# name = Field()
shop_name = Field()
street_address = Field()
sho... | MircroCode/dpSpider | dianping/dianping/items.py | Python | mit | 429 |
from __future__ import absolute_import
from qinfer.tomography.distributions import *
from qinfer.tomography.models import *
from qinfer.tomography.plotting_tools import *
from qinfer.tomography.bases import *
from qinfer.tomography.expdesign import *
| QInfer/python-qinfer | src/qinfer/tomography/__init__.py | Python | bsd-3-clause | 251 |
#
# Copyright 2014, NICTA
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
#
# @TAG(NICTA_BSD)
#
'''This code manages the name mangling (and reversal of such) that needs to
happen in the temp... | smaccm/camkes-tool | camkes/runner/NameMangling.py | Python | bsd-2-clause | 15,531 |
def gradingStudents(grades):
n = len(grades)
for i in range(n):
if grades[i] < 38:
grades[i] += 0
elif grades[i] % 5 == 3:
grades[i] += 2
elif grades[i] % 5 == 4:
grades[i] += 1
return grades
print(gradingStudents([73, 67, 38, 33]))
#https://pt.s... | maniero/SOpt | Python/Collection/LenghtList.py | Python | mit | 350 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-03-04 14:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Link',
... | yoophi/django_bookmarks | bookmarks/migrations/0001_initial.py | Python | mit | 543 |
"""SCons.Tool.dvipdf
Tool-specific initialization for dvipdf.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# P... | barnone/EigenD | tools/packages/SCons/Tool/dvipdf.py | Python | gpl-3.0 | 4,084 |
# rfkill tests
# Copyright (c) 2014, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import time
import hostapd
from hostapd import HostapdGlobal
import hwsim_utils
from wpasupplicant import Wpa... | s0lst1c3/eaphammer | local/hostapd-eaphammer/tests/hwsim/test_rfkill.py | Python | gpl-3.0 | 8,297 |
#!/usr/bin/env python
from unittest import TestCase
from {{ cookiecutter.repo_name }}.main import hello_world
class HelloWordTestCase(TestCase):
def test_hello_world(self):
self.assertEqual('Hello World!', hello_world())
| akun/aproject | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/test_{{cookiecutter.repo_name}}.py | Python | mit | 238 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 VT SuperDARN Lab
# Full license can be found in LICENSE.txt
"""Plotting/Retreiving SuperDARN gridded velocities, fitted convection
velocities and contour plotting routines
Class
-------
MapConv
-------
"""
import logging
import datetime as dt
import numpy as np
class Map... | vtsuperdarn/davitpy | davitpy/pydarn/plotting/plotMapGrd.py | Python | gpl-3.0 | 39,534 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | jtopjian/st2 | st2common/st2common/util/misc.py | Python | apache-2.0 | 1,245 |
import os
import json
from pyramid.response import Response
from pyramid.response import FileResponse
from pyramid.view import view_config
import pyramid.httpexceptions as httpexceptions
# database stuff
from sqlalchemy.exc import DBAPIError
from sqlalchemy import or_
from climasng.models import *
# json data stuff
... | jcu-eresearch/climas-ng | webapp/climasng/views/dataview.py | Python | apache-2.0 | 3,516 |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
An Integrater
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Specials.Simulaters.Eulerer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Class... | Ledoux/ShareYourSystem | Pythonlogy/draft/Integrater/__init__.py | Python | mit | 8,480 |
from collections import defaultdict
import logging
import itertools as it
from ..utilities.exceptions import GraphIntegrityError
log = logging.getLogger(__name__)
try:
profile
except NameError:
profile = lambda x: x
class BaseGraph(object):
"""
A Base-class for the BulgeGraph and BulgeGraphConstruc... | ViennaRNA/forgi | forgi/graph/_basegraph.py | Python | gpl-3.0 | 8,495 |
'''
Created on Dec 29, 2013
@author: ted
'''
#!/usr/bin/env python
import sys
import random
from pulp import LpVariable, LpBinary, lpSum, value, LpProblem, LpMaximize
try:
import path
except ImportError:
pass
try:
import src.dippy as dippy
except ImportError:
import coinor.dippy as dippy
d... | tkralphs/Dip | Dip/src/dippy/examples/milp/milp.py | Python | epl-1.0 | 2,935 |
"""Dataframe display tewmplates"""
__author__ = 'thor'
# Inline html table templates
# Note: Generated using
# templates = get_multiple_template_dicts(
# '/D/Dropbox/dev/web/templates/inline table formats/Multiple Inline Tables.html')
inline_html_table_template = {
'box-table-c': {'table': {... | thorwhalen/ut | daf/resources/disp_templates.py | Python | mit | 12,649 |
"""Support for GPSLogger."""
import logging
import voluptuous as vol
from aiohttp import web
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker import ATTR_BATTERY
from homeassistant.const import (
HTTP_UNPROCESSABLE_ENTITY,
HTTP_OK,
ATTR_LATITUDE,
ATTR_L... | fbradyirl/home-assistant | homeassistant/components/gpslogger/__init__.py | Python | apache-2.0 | 3,388 |
import unittest
import warnings
from urllib3.connection import HTTPConnection
class TestVersionCompatibility(unittest.TestCase):
def test_connection_strict(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
# strict=True is deprecated in Py33+
... | Lukasa/urllib3 | test/test_compatibility.py | Python | mit | 795 |
import json
import yaml
import sys
import os
# tree of YAML documents defining documentation
src_dir = sys.argv[1]
# JSON output file of the old format
dest_file = sys.argv[2]
# The contents of this file are prepended to the dest_file
header_file = sys.argv[3]
# Merged list of all sections defined in the input file... | rocio/rethinkdb | docs/rql/scripts/json_convert.py | Python | agpl-3.0 | 6,617 |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('update_permissions')
@click.argument("dataset_id", type=str)
@click.option(
"--access_ids",
help="role IDs which should have access permissions for the dataset.",
type=s... | galaxy-iuc/parsec | parsec/commands/datasets/update_permissions.py | Python | apache-2.0 | 1,127 |
"""
Django settings for svt_event project.
Generated by 'django-admin startproject' using Django 1.11.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... | ksu-svt/svt-event-web-app | svt_event/settings.py | Python | mit | 3,126 |
def isomorphism(graph_1, graph_2):
"""Определяет, являются ли два неориентированных графа graph_1 и graph_2,
представленных своими матрицами смежности изоморфными.
Если да, то возвращает список phi длины N (число вершин в графах),
состоящий из чисел 0..N-1, такой что phi[i] - номер вершины второго граф... | evgenymarkov/pygraph | pygraph/algorithms/isomorphism.py | Python | lgpl-3.0 | 3,924 |
try:
from setuptools import setup
except:
from distutils.core import setup
setup(
name='t',
version='1.2.0',
author='Steve Losh',
author_email='steve@stevelosh.com',
url='http://bitbucket.org/sjl/t',
py_modules=['t'],
entry_points={
'console_scripts': [
't = t:_m... | mayl/dotfiles | t/setup.py | Python | gpl-3.0 | 346 |
"""tests for pyfasst.tools.signalTools
2013 Jean-Louis Durrieu
"""
from ...testing import * # is this really legal?
import numpy as np
import pyfasst.tools.signalTools as st
def test_medianFilter():
"""median filtering an all 0 array, with one different value in the middle
"""
inputArray = np.zeros(100)... | wslihgt/pyfasst | pyfasst_tests/pyfasst/tools/test_signalTools.py | Python | gpl-2.0 | 2,480 |
from dataclasses import dataclass
from infection_monkey.exploit.powershell_utils.credentials import Credentials, SecretType
AUTH_BASIC = "basic"
AUTH_NEGOTIATE = "negotiate"
AUTH_NTLM = "ntlm"
ENCRYPTION_AUTO = "auto"
ENCRYPTION_NEVER = "never"
@dataclass
class AuthOptions:
auth_type: str
encryption: str
... | guardicore/monkey | monkey/infection_monkey/exploit/powershell_utils/auth_options.py | Python | gpl-3.0 | 1,150 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import click
import json
import subprocess
import re
import jinja2
import tempfile
import arrow
GIT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss ZZ"
RALLY_ITERATIONS_LIST_URL = ("https://rally1.rallydev.com/slm/webservice/v3.0/"
"iterat... | nickknissen/tag-tool | tag_tool/tag_tool.py | Python | mit | 7,352 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "AC850685e1d9b8c09dae0b938923dc0d42"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
fax = client.fax.v1.faxes.cr... | teoreteetik/api-snippets | fax/sip-send/example-1/example-1.6.x.py | Python | mit | 469 |
# --------------------------------------------------------------------------- #
# AUI Library wxPython IMPLEMENTATION
#
# Original C++ Code From Kirix (wxAUI). You Can Find It At:
#
# License: wxWidgets license
#
# http:#www.kirix.com/en/community/opensource/wxaui/about_wxaui.html
#
# Current wxAUI Version Tracked: ... | ezequielpereira/Time-Line | libs64/wx/lib/agw/aui/framemanager.py | Python | gpl-3.0 | 361,037 |
"""This module contains views related to shopping cart"""
import datetime
import decimal
import json
import logging
import pytz
import six
from config_models.decorators import require_config
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models imp... | cpennington/edx-platform | lms/djangoapps/shoppingcart/views.py | Python | agpl-3.0 | 41,660 |
import logging
import emission.core.wrapper.wrapperbase as ecwb
import emission.core.wrapper.motionactivity as ecwm
# Used for various metrics such as count, distance, mean speed calorie consumption,
# median speed calorie consumption
# Should come later: carbon footprint
# Optimal doesn't look like it fits this, beca... | yw374cornell/e-mission-server | emission/core/wrapper/modestattimesummary.py | Python | bsd-3-clause | 1,148 |
#!/usr/bin/python3
#
# Simple tic tac toe game
import board
import rules
def play():
print("Playing a game ...")
# Choose sides
# Create and initialize the board
game_board = board.Board()
# Control of the victory conditions achieved initialized
victory = False
# While victory has not... | jcastp/tictactoe | tictactoe.py | Python | gpl-3.0 | 1,055 |
import databaker.bake
from databaker.constants import *
from nose.tools import assert_equal
def per_file(tabs):
return tabs.names
def per_tab(tab):
tab.dimension("header_1", "static_value")
tab.excel_ref("A1").fill(RIGHT).is_not_blank().dimension(TIME, DIRECTLY, ABOVE)
obs = tab.excel_ref("A1").fill(R... | ONS-OpenData/ONSdatabaker | test/t.py | Python | agpl-3.0 | 1,714 |
# -*- coding: utf-8 -*-
from PyQt5.QtWidgets import QStyle
from ninja_ide import translations
#{
#"shortcut": "Change-Tab",
#"action": {'text': string,
#'image': [string for ninja, Int for qt, None for nothing],
#'section': string,
#'weight': int},
#"connect": "function_n... | centaurialpha/ninja-ide | ninja_ide/gui/main_panel/actions.py | Python | gpl-3.0 | 17,914 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2017 VoltDB Inc.
#
# 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 limitati... | deerwalk/voltdb | tests/sqlcoverage/normalizer/not-a-normalizer.py | Python | agpl-3.0 | 2,364 |
# Copyright 2014 Red Hat, 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, ... | JioCloud/nova | nova/tests/unit/objects/test_image_meta.py | Python | apache-2.0 | 7,727 |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#
# Un... | sony/nnabla | python/src/nnabla/backward_function/gelu.py | Python | apache-2.0 | 1,305 |
#!/usr/bin/env python
"""Compressor piece grip/release module"""
import argparse
import rospy
import baxter_interface
class Glove(object):
"""Provides an interface for attaching and releasing
Baxter's pusher glove.
"""
def __init__(self, gripper):
rospy.init_node("cs473_gripper")
s... | thomasweng15/cs473-baxter-project | cs473_baxter/scripts/glove.py | Python | mit | 1,826 |
from __future__ import division, absolute_import, print_function
import unittest
from .. import loader
| sergeyfarin/pyqt-fit | pyqt_fit/test/test_loader.py | Python | gpl-3.0 | 105 |
from __future__ import unicode_literals
import functools
import logging
import gmusicapi
import requests
logger = logging.getLogger(__name__)
def endpoint(default=None, require_all_access=False):
default = default() if callable(default) else default
def outer_wrapper(func):
@functools.wraps(fun... | jodal/mopidy-gmusic | mopidy_gmusic/session.py | Python | apache-2.0 | 4,579 |
"""Platform for Bosch BMP280 Environmental Sensor integration."""
from datetime import timedelta
import logging
from adafruit_bmp280 import Adafruit_BMP280_I2C
import board
from busio import I2C
import voluptuous as vol
from homeassistant.components.sensor import (
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERAT... | tchellomello/home-assistant | homeassistant/components/bmp280/sensor.py | Python | apache-2.0 | 5,118 |
#!/usr/bin/env python
#####################################################################
# xenmon is a front-end for xenbaked.
# There is a curses interface for live monitoring. XenMon also allows
# logging to a file. For options, run python xenmon.py -h
#
# Copyright (C) 2005,2006 by Hewlett Packard, Palo Alto and... | kaustubh-kabra/modified-xen | tools/xenmon/xenmon.py | Python | gpl-2.0 | 25,108 |
from tempfile import NamedTemporaryFile
import os
import math
import numpy as np
import subprocess
import types
def guess_fileformat(filename):
"""
Guess the format of a sound file.
"""
try:
return filename.split('.')[-1]
except IndexError:
raise ValueError('unknown file format')
... | sebpiq/pychedelic | pychedelic/core/files.py | Python | mit | 1,785 |
#!/usr/bin/env python
import sys
import optparse
import hotshot
import hotshot.stats
from daap2 import DAAPClient
def main():
prof = hotshot.Profile('daap.prof')
connection = DAAPClient()
# I'm new to this python thing. There's got to be a better idiom
# for this.
try: host = sys.argv[1]
e... | tominsam/PythonDaap | experimental/daap2_profile.py | Python | lgpl-2.1 | 1,196 |
import sys
from ..pakbase import Package
class Mt3dAdv(Package):
"""
MT3DMS Advection Package Class.
Parameters
----------
model : model object
The model object (of type :class:`flopy.mt3d.mt.Mt3dms`) to which
this package will be added.
mixelm : int
MIXELM... | brclark-usgs/flopy | flopy/mt3d/mtadv.py | Python | bsd-3-clause | 16,549 |
import numpy as np
import os, pyfits, pickle
from glob import glob
from astropy import coordinates as coord
from astropy import units as u
import reddening
class photometry(object):
"""A class to store photometry data output from DOLPHOT
Parameters
----------
name : string
The absolute path of... | djrs/photometry | photometry.py | Python | gpl-2.0 | 12,661 |
input = """
arc(a,b,2).
arc(a,c,3).
arc(b,d,3).
arc(c,d,2).
arc(d,a,2).
% maxint is deliberately set too large to detect wrong minima.
%#maxint=20.
path(X,Y,C) :- arc(X,Y,C).
path(X,Y,C) :- arc(X,Z,C1), path(Z,Y,C2), C = C1 + C2.
minpath(X,Y,C) :- path(X,Y,C), C = #min{ C1: path(X,Y,C1) }.
"""
output = """
arc(a,b,... | veltri/DLV2 | tests/parser/aggregates.min.propagation.6.test.py | Python | apache-2.0 | 599 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
class Options:
def __init__(self):
self.color = "black"
self.verbose = False
pass
| LaurentCabaret/pyVhdl2Sch | tools/tools.py | Python | bsd-2-clause | 177 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.model
import frappe.utils
import json, os
@frappe.whitelist()
def get(doctype, name=None, filters=None):
if filters and not n... | rohitw1991/smarttailorfrappe | frappe/client.py | Python | mit | 4,429 |
"""
Acceptance tests for the certificate web view feature.
"""
from common.test.acceptance.tests.helpers import UniqueCourseTest, EventsTestMixin, load_data_str, get_element_padding
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc, CourseUpdateDesc... | louyihua/edx-platform | common/test/acceptance/tests/lms/test_certificate_web_view.py | Python | agpl-3.0 | 9,795 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2019, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2... | F5Networks/f5-ansible | ansible_collections/f5networks/f5_modules/tests/unit/modules/network/f5/test_bigip_cgnat_lsn_pool.py | Python | gpl-3.0 | 9,569 |
from __future__ import absolute_import, unicode_literals
import datetime
timezone_names = {
'ut': 0, 'gmt': 0, 'z': 0,
'adt': -3, 'ast': -4, 'at': -4,
'edt': -4, 'est': -5, 'et': -5,
'cdt': -5, 'cst': -6, 'ct': -6,
'mdt': -6, 'mst': -7, 'mt': -7,
'pdt': -7, 'pst': -8, 'pt': -8,
'a': -1, 'n... | eleonrk/SickRage | lib/feedparser/datetimes/rfc822.py | Python | gpl-3.0 | 3,883 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Spar
author: Curtis L. Olson
website: madesigner.flightgear.org
started: November 2013
"""
import sys
from PyQt4 import QtGui, QtCore
#import xml.etree.ElementTree as ET
import lxml.etree as ET
from combobox_nowheel import QComboBoxNoWheel
class SimpleHoleUI():
def... | SterlingPeet/madesigner | creator/simple_hole_ui.py | Python | gpl-2.0 | 4,975 |
from sympy import (symbols, sympify, Dummy, simplify, Equality, S, Interval,
oo, EmptySet)
from sympy.logic.boolalg import (
And, Boolean, Equivalent, ITE, Implies, Nand, Nor, Not, Or, POSform,
SOPform, Xor, conjuncts, disjuncts, distribute_or_over_and,
distribute_and_over_or, eliminate_i... | ojengwa/sympy | sympy/logic/tests/test_boolalg.py | Python | bsd-3-clause | 17,882 |
# Partition List
# Given a linked list and a value x, partition it such that all nodes less
# than x come before nodes greater than or equal to x.
# You should preserve the original relative order of the nodes in each of
# the two partitions.
# For example,
# Given 1->4->3->2->5->2 and x = 3,
# return 1->2->2->4->3->... | asraf209/leetcode | src/partitionList/main.py | Python | gpl-3.0 | 1,464 |
from __future__ import absolute_import
from .celery_tasks import app as celery_app
| MRCIEU/melodi | melodi/__init__.py | Python | mit | 83 |
"""
Executors Directory
"""
| saltstack/salt | salt/executors/__init__.py | Python | apache-2.0 | 28 |
"""
Deuce Valere - Tests - API - System - Manager
"""
import datetime
import unittest
from deuceclient.tests import *
from deucevalere.api.system import *
class DeuceValereApiSystemManagerTest(unittest.TestCase):
def setUp(self):
super().setUp()
def tearDown(self):
super().tearDown()
... | rackerlabs/deuce-valere | deucevalere/tests/test_api_system_manager.py | Python | apache-2.0 | 2,461 |
#!/usr/bin/env python3
#
# Start the development server.
from painttheworld import app
app.run(
host='localhost',
port= 5000,
debug=True
)
| richardmin97/PaintTheWorld | Server/run.py | Python | gpl-3.0 | 152 |
import numpy as np
from matplotlib import pyplot as plt
dpi_res = 250
npoints = 200
figure = plt.figure(dpi= dpi_res)
ax = plt.axes()
# HA + H2O <<==>> H3O(+) + A(-)
# 2H2O <<==>> H3O(+) + HO(-)
pKa = 6.0
pKw = 14.0
pCT = 3.0
x = np.array([14 * x / float(npoints) for x in range(npoints + 1)])
ax.plot(x, -pCT - x - np... | santiago-salas-v/lit-imp | graph_approach.py | Python | mit | 2,847 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('SocialNetworkModels', '0006_remove_comments_post_author'),
]
operations = [
migrations.AddField(
model_name='com... | diego04/cmput410-project | Distributed_Social_Networking/SocialNetworkModels/migrations/0007_comments_comment_author.py | Python | apache-2.0 | 483 |
# Natural Language Toolkit: Cooper storage for Quantifier Ambiguity
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function
from nltk.sem.logic import LambdaExpression, ApplicationExpres... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/sem/cooper_storage.py | Python | mit | 4,067 |
from nba import enums
from nba.utils import clean_locals
from nba.endpoints.baseendpoint import BaseEndpoint
class Common(BaseEndpoint):
# def team_years(self, league_id=enums.LeagueID.Default):
# """
# Get information on when teams were playing in the league.
# :param league_id: define ... | rozzac90/nba | nba/endpoints/common.py | Python | mit | 4,806 |
#############################################################################
##
## Copyright (c) 2014 Riverbank Computing Limited <info@riverbankcomputing.com>
##
## This file is part of PyQt5.
##
## This file may be used under the terms of the GNU General Public License
## version 3.0 as published by the Free Softw... | dragondjf/PyQt5 | python2.7/PyQt5/uic/port_v2/proxy_base.py | Python | gpl-2.0 | 1,219 |
from __future__ import print_function
from pkg_resources import resource_string
from yapsy.IPlugin import IPlugin
from mako.template import Template
from mako import exceptions
import os
import distutils.dir_util
import shutil
import tempfile
import re
import sys
import platform
import logging
tmpl_dir = os.path.expa... | svacko/repacked | repacked/plugins/rpm.py | Python | lgpl-3.0 | 6,751 |
from __future__ import print_function
from permuta import *
import permstruct
import permstruct.dag
from permstruct import *
from permstruct.dag import taylor_dag
import sys
is_classical = True
# -- Examples from Vatter paper -- #
# STATUS ================================================ >
patts = map(Permutation,... | PermutaTriangle/PermStruct | examples/classical_computing_non_poly_bases/b6.py | Python | bsd-3-clause | 1,365 |
#!/usr/bin/env python
#
# Electrum - lightweight ParkByte client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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 withou... | parkbyte/electrumparkbyte | gui/qt/qrwindow.py | Python | mit | 3,180 |
"""
Test harness for the venv module.
Copyright (C) 2011-2012 Vinay Sajip.
Licensed to the PSF under a contributor agreement.
"""
import ensurepip
import os
import os.path
import shutil
import subprocess
import sys
import tempfile
from test.support import (captured_stdout, captured_stderr, run_unittest,
... | mancoast/CPythonPyc_test | fail/340_test_venv.py | Python | gpl-3.0 | 16,023 |
from pycp2k.inputsection import InputSection
from ._each421 import _each421
class _cartesian_eigs1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Add_last = None
self.Common_iteration_levels = None
self.Filename = None
... | SINGROUP/pycp2k | pycp2k/classes/_cartesian_eigs1.py | Python | lgpl-3.0 | 746 |
from collections import namedtuple
import botocore.waiter
from .command import Command
class DriftDetectOptions(namedtuple('DriftDetectOptions',
['no_wait', ])):
pass
waiter_model = botocore.waiter.WaiterModel({
"version": 2,
"waiters": {
"DriftDetectionCompl... | Kotaimen/awscfncli | awscfncli2/runner/commands/drift_detect_command.py | Python | mit | 2,473 |
import unittest
from unittest.mock import patch
from unittest.mock import MagicMock
from app.domain.entry import Entry
from app.application.services import handle_set_tags_for
class TestServices(unittest.TestCase):
@patch('app.application.services.extract_tags')
@patch('app.application.services.entries_repo'... | vklap/demo-ddd-python | tests/unit_tests/application/test_services.py | Python | mit | 777 |
#!/usr/bin/env python
__author__ = 'Horea Christian'
import numpy as np
import pandas as pd
from numpy.random import permutation, choice, sample
def hariri(top_stimuli, targets, distractors, forbid_identical_targets=True, suffix_characters=0):
randomness = list(permutation(np.tile([[True], [False]], (len(top_stim... | TheChymera/pystim | routines.py | Python | gpl-3.0 | 1,815 |
class BaseGroupRecommender(object):
"""docstring for BaseGroupRecommender"""
def __init__(self, model, user_list, expertise, social, dissimmilarity):
self.model = model
self.user_list = user_list
self.expertise = expertise
self.social = social
self.dissimmilarity = dissi... | anhlt/gr3 | recommendation/group/base.py | Python | gpl-2.0 | 432 |
from django.contrib import admin
from django.forms import ModelForm
from suit_redactor.widgets import RedactorWidget
from pebbles.models import (
Pebble,
Domain,
PebbleSettings,
PebblePage,
PebbleUser,
)
class PebblePageForm(ModelForm):
class Meta:
widgets = {
'content': ... | ImmaculateObsession/nest | pebbles/admin.py | Python | mit | 620 |
from __future__ import unicode_literals
from dash.orgs.forms import OrgForm
from django.contrib.auth.models import User
from django.db.models.functions import Lower
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from temba_client.exceptions import Tem... | rapidpro/tracpro | tracpro/orgs_ext/forms.py | Python | bsd-3-clause | 7,041 |
# -*- Mode: Python; -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Pu... | timvideos/flumotion | flumotion/test/test_icalbouncer.py | Python | lgpl-2.1 | 17,170 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.