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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
import os.path
from picupwebapp.picture.models import Picture
class Command(BaseCommand):
args = ''
help = 'Update size width and height'
def handle(self, *args, **options):
pictures = ... | BogusCurry/picup-it | picupwebapp/picupwebapp/picture/management/commands/update_sizes.py | Python | bsd-3-clause | 709 |
# pylint: disable=too-few-public-methods
""" Crops a selected component from a SANS."""
from __future__ import (absolute_import, division, print_function)
from mantid.kernel import (Direction, StringListValidator)
from mantid.api import (DataProcessorAlgorithm, MatrixWorkspaceProperty, AlgorithmFactory, PropertyMode,... | dymkowsk/mantid | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSCrop.py | Python | gpl-3.0 | 3,158 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | vongazman/libcloud | libcloud/utils/py3.py | Python | apache-2.0 | 5,244 |
# 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.
"""A collection of statistical utility functions to be used by metrics."""
import math
def Clamp(value, low=0.0, high=1.0):
"""Clamp a value between som... | 7kbird/chrome | tools/telemetry/telemetry/util/statistics.py | Python | bsd-3-clause | 10,867 |
#!/usr/bin/env python
import argparse, random
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('prefix', metavar='R', nargs=1, help='filename prefix')
parser.add_argument('n_files', metavar='F', type=int, nargs=1, help='number of files')
parser.add_argument('n_pids', ... | furious-luke/cmpi | examples/gen_halos.py | Python | gpl-3.0 | 1,363 |
import os, sys
try:
import MacOS
except:
MacOS = None
from pygame.pkgdata import getResource
from pygame import sdlmain_osx
__all__ = ['Video_AutoInit']
def Video_AutoInit():
"""This is a function that's called from the c extension code
just before the display module is initialized"""
if Mac... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pygame/macosx.py | Python | gpl-2.0 | 887 |
#!/usr/bin/env python
# TBD Finish Python port
import sys
#from AlgsSedgewickWayne.BoyerMoore import BoyerMoore
#
##****************************************************************************
## Compilation: javac BoyerMoore.java
## Execution: java BoyerMoore pattern text
## Dependencies: StdOut.java
##
## Reads ... | dvklopfenstein/PrincetonAlgorithms | tests/test_BoyerMoore.py | Python | gpl-2.0 | 2,225 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Cubic ERP SAC (<http://cubicerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | jolevq/odoopub | extra-addons/customize/res_company.py | Python | agpl-3.0 | 1,213 |
from itertools import permutations
def euler38():
n = [''.join(p) for p in permutations('123456789')]
ns = set(n)
results = []
for x in range(2, 10000):
case = ''
for y in range(1, 50):
case += str(x*y)
if case in ns:
results.append(case)
prin... | mbaltes/euler | Euler038.py | Python | gpl-3.0 | 348 |
from PyQt5.QtWidgets import QComboBox, QTableWidget, QTableWidgetItem, QHeaderView, QPushButton, QFileDialog, QCheckBox
from PyQt5.QtGui import QColor, QBrush
from PyQt5.QtCore import pyqtSignal, Qt
from peacock.base.MooseWidget import MooseWidget
from ParameterInfo import ParameterInfo
import os
class ParamsTable(QTa... | liuwenf/moose | python/peacock/Input/ParamsTable.py | Python | lgpl-2.1 | 13,564 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012-2014 Florent Fourcot
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the... | vicnet/weboob | modules/freemobile/__init__.py | Python | lgpl-3.0 | 852 |
"""
SpatialDescriptormodel utils
----------------------------
Group different commmon utils to improve the usability for common tasks.
"""
import numpy as np
from pySpatialTools.Retrieve import CircRetriever, KRetriever
from pySpatialTools.FeatureManagement.Descriptors import Interpolator,\
DummyDescriptor, Null... | tgquintela/pySpatialTools | pySpatialTools/api/spatialdesc_utils.py | Python | mit | 7,510 |
#!/usr/bin/env python3.5
import time
from raspi_io import Serial
import raspi_io.utility as utility
if __name__ == "__main__":
cnt = 0
port = Serial(utility.scan_server()[0], '/dev/ttyUSB0', 115200)
while True:
port.write("{0:d}".format(cnt).encode("utf-8"))
cnt += 1
time.sleep(0.1... | amaork/raspi-io | example/serial_example.py | Python | mit | 323 |
#----------------------------------------------------------------------
# Name: popup
# Purpose: Generic popup control
#
# Author: Gerrit van Dyk
#
# Created: 2002/11/20
# Version: 0.1
# RCS-ID: $Id: PopupControl.py,v 1.30 2012/08/16 11:04:25 oleg Exp $
# License: wxWindows licen... | onoga/toolib | toolib/wx/controls/PopupControl.py | Python | gpl-2.0 | 21,909 |
#!/usr/bin/python
#
# Clonse channels by a particular date
#
# Copyright (c) 2008--2015 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 FIT... | xkollar/spacewalk | utils/cloneByDate.py | Python | gpl-2.0 | 37,054 |
from django.contrib import admin
from .utils import get_flag_model
FLAG_MODEL = get_flag_model()
@admin.register(FLAG_MODEL)
class FlagModelAdmin(admin.ModelAdmin):
list_display = (
'time_created',
'content_type',
'object_id',
'status',
)
search_fields = (
'obje... | idlesign/django-siteflags | siteflags/admin.py | Python | bsd-3-clause | 553 |
the_count = [1,2,3,4,5]
fruits =['apples','oranges','pears','apricots']
change = [1,'pennies',2,'dimes',3,'quarters']
for number in the_count:
print "This is count %d." % number
for fruit in fruits:
print "A fruit of type: %s" % fruit
for i in change:
print "I got %r" % i
elements =[]
for i in range(0,... | jdhaines/PythonHardWay | ex32.py | Python | mit | 437 |
import codecs
import logging
import os
import re
import shutil
from bzt import TaurusException
from tests.unit import BZTestCase, RESOURCES_DIR, BUILD_DIR
from bzt.cli import CLI, ConfigOverrider, get_option_parser
from bzt.engine import Configuration
from tests.unit import EngineEmul
from tests.unit.mocks import Mod... | Blazemeter/taurus | tests/unit/test_CLI.py | Python | apache-2.0 | 14,043 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-08 22:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_post_published_date'),
]
operations = [
migrations.AlterField(... | aileron-split/aileron-web | server/blog/migrations/0004_auto_20171108_2220.py | Python | gpl-3.0 | 1,424 |
# -*- coding: utf-8 -*-
# Copyright 2018 ProjectQ-Framework (www.projectq.ch)
#
# 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
#
# ... | ProjectQ-Framework/ProjectQ | projectq/ops/_uniformly_controlled_rotation.py | Python | apache-2.0 | 5,824 |
##############################################################################
# #
# This file is part of SonSilentSea, a free ships based combatr game. #
# Copyright (C) 2014 Jose Luis Cercos Pita <jlcercos@gmail.com> #
# ... | sanguinariojoe/sonsilentsea | resources/sssSDK/objects/destroyable.py | Python | gpl-3.0 | 5,119 |
"""Default test suite."""
import os
import cquery
import cquery.tests
class TestQueries(cquery.tests.BaseCQueryTestCase):
"""Test making queries
.. note:: This doesn't make any new tags or alter the file-system
in any way.
"""
def test_selector(self):
count = 0
for match in... | mottosso/pyblish-magenta | pyblish_magenta/vendor/cquery/tests/test_reading.py | Python | lgpl-3.0 | 3,851 |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" è un\'espressione opzionale come "campo1=\'nuovo valore\'". Non si può fare "update" o "delete" dei risultati di un JOIN ',
'%Y-%m-%d': '%d/%m/%Y',
'%Y-%m-%d %H:%M:%S': '%d/%m/%... | house4hack/openSHAC | web2py_shac/applications/enter/languages/it.py | Python | mit | 4,775 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | BorgERP/borg-erp-6of3 | server/openerp/report/printscreen/ps_form.py | Python | agpl-3.0 | 5,265 |
# These are Quisk widgets
import sys, re
import wx, wx.lib.buttons, wx.lib.stattext
from types import *
# The main script will alter quisk_conf_defaults to include the user's config file.
import quisk_conf_defaults as conf
def FreqFormatter(freq): # Format the string or integer frequency by adding blanks
freq = int... | gonesurfing/Quisk_rpi_remote | quisk_widgets.py | Python | gpl-2.0 | 29,159 |
# Copyright 2017 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/in-silico-labeling | isl/augment_test.py | Python | apache-2.0 | 2,507 |
"""
The ``pvsystem`` module contains functions for modeling the output and
performance of PV modules and inverters.
"""
from __future__ import division
import io
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
import numpy as np
import pandas as pd
from pvlib import t... | ianctse/pvlib-python | pvlib/pvsystem.py | Python | bsd-3-clause | 58,924 |
"""
Key bindings, for scrolling up and down through pages.
This are separate bindings, because GNU readline doesn't have them, but
they are very useful for navigating through long multiline buffers, like in
Vi, Emacs, etc...
"""
from __future__ import unicode_literals
from six.moves import range
__all__ = [
'scro... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/prompt_toolkit/key_binding/bindings/scroll.py | Python | mit | 5,363 |
# coding=utf-8
from datetime import datetime
from os import path
from nextgisweb import DBSession
from pyramid.httpexceptions import HTTPForbidden
import transaction
from nextgisweb.vector_layer import VectorLayer
from nextgisweb_compulink.compulink_deviation.deviation_checker import PROCESSING_LAYER_TYPES
from nextg... | nextgis/nextgisweb_compulink | nextgisweb_compulink/compulink_deviation/view.py | Python | gpl-2.0 | 10,895 |
import os
SCRIPT_PATH = os.path.dirname(__file__)
class Lua:
def __init__(self, redis):
self.redis = redis
scripts = filter(lambda s: s.endswith('.lua'), os.listdir(SCRIPT_PATH))
for scriptname in scripts:
with open(os.path.join(SCRIPT_PATH, scriptname)) as script:
... | getfleety/coralillo | coralillo/lua/__init__.py | Python | mit | 512 |
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
import os
# Activate django-dbindexer for the default database
DATABASES['native'] =... | mikebull/simpleblog | settings.py | Python | bsd-3-clause | 1,939 |
"""Example of hierarchical training using the multi-agent API.
The example env is that of a "windy maze". The agent observes the current wind
direction and can either choose to stand still, or move in that direction.
You can try out the env directly with:
$ python hierarchical_training.py --flat
A simple hierar... | stephanie-wang/ray | rllib/examples/hierarchical_training.py | Python | apache-2.0 | 7,942 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2015 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License,... | ndp-systemes/odoo-addons | mrp_manufacturing_order_update/tests/test_manufacturing_order_update.py | Python | agpl-3.0 | 27,006 |
#################################################################################
# Copyright (c) 2013, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# ... | PacificBiosciences/rDnaTools | src/pbrdna/__init__.py | Python | bsd-3-clause | 1,847 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Yahoo! 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... | pombredanne/taskflow-1 | taskflow/tests/unit/test_arguments_passing.py | Python | apache-2.0 | 8,290 |
# Copyright 2020 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, ... | googleapis/python-talent | samples/snippets/job_search_histogram_search.py | Python | apache-2.0 | 2,435 |
# -*- coding: utf-8 -*-
#
# test_growth_curves.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 Lice... | sanjayankur31/nest-simulator | testsuite/pytests/test_sp/test_growth_curves.py | Python | gpl-2.0 | 14,933 |
from django.db import models
from django.contrib.auth.models import User
from posts.models import Section
from images.models import Image, ImageCollection
TYPE_OF_RELATED = (
('N', 'Note'),
('L', 'Link'),
('I', 'Image'),
('C', 'ImageCollection'),
('V', 'Video'),
('2', 'LinkAndNote'),
('4',... | palletorsson/random_project | related/models.py | Python | gpl-2.0 | 1,480 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Comunitea All Rights Reserved
# $Jesús Ventosinos Mayor <jesus@comunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... | Comunitea/CMNT_00040_2016_ELN_addons | account_analytic_cost_line/__openerp__.py | Python | agpl-3.0 | 1,457 |
#!/usr/bin/env python
import argparse
import logging
from colorlog import ColoredFormatter
import time
import os
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal
import scipy.constants
import itertools
def load_signal(directory, filename):
sig = np.load("{d}/{f}".format(
d = director... | jgowans/correlation_plotter | correlation_plotter.py | Python | mit | 9,168 |
import os
dburl = os.getenv('TEMPUS_DB_URL', '')
port = os.getenv('TEMPUS_PORT', 5000)
redisurl = os.getenv('TEMPUS_REDIS_URL', 'localhost')
# Environment variables set by Docker Compose
_opencpu_host = os.getenv('OPENCPU_1_PORT_80_TCP_ADDR', 'localhost')
_opencpu_port = os.getenv('OPENCPU_1_PORT_80_TCP_PORT', '80')... | giantoak/tempus | app/config.py | Python | mit | 485 |
"""add question type
Revision ID: 26ef95fc6f2c
Revises: 2335f2c85292
Create Date: 2015-03-30 13:20:33.312616
"""
# revision identifiers, used by Alembic.
revision = '26ef95fc6f2c'
down_revision = '2335f2c85292'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembi... | fairdemocracy/vilfredo-core | migrations/versions/26ef95fc6f2c_add_question_type.py | Python | agpl-3.0 | 1,258 |
"""
Classes and functions to handle block/disk images for libvirt.
This exports:
- two functions for get image/blkdebug filename
- class for image operates and basic parameters
- class for storage pool operations
"""
import re
import logging
from autotest.client.shared import error
import storage
import virsh
... | spiceqa/virt-test | virttest/libvirt_storage.py | Python | gpl-2.0 | 10,028 |
from openpathsampling.engines.trajectory import Trajectory
from openpathsampling.netcdfplus import ObjectStore, LoaderProxy
class TrajectoryStore(ObjectStore):
def __init__(self):
super(TrajectoryStore, self).__init__(Trajectory)
def to_dict(self):
return {}
def _save(self, trajectory, i... | choderalab/openpathsampling | openpathsampling/storage/stores/trajectory.py | Python | lgpl-2.1 | 3,542 |
import sys, os, getpass, logging, time, inspect, requests, json, pprint
import h2o_test_utils
from h2o_test_utils import log, log_rest
import h2o_print as h2p
class H2O(object):
# static (class) variables
ipaddr_from_cmd_line = None
debugger = False
json_url_history = []
python_test_name = inspect.... | jangorecki/h2o-3 | py/h2o.py | Python | apache-2.0 | 46,333 |
import numpy as np
import scipy.io as io
dataStructure = io.loadmat('starfish.mat')
receiverPoints = dataStructure['receivers']
sourcePoints = dataStructure['receivers']
scattererPoints = dataStructure['scatterer']
scatteredData = dataStructure['scatteredData']
recordingTimes = dataStructure['recordTimes']
recordingT... | aaronprunty/starfish | vezda/examples/starfish-tutorial/data/extractData.py | Python | apache-2.0 | 609 |
# -*- coding: utf-8 -*-
#
# This document is free and open-source software, subject to the OSI-approved
# BSD license below.
#
# Copyright (c) 2011 - 2013 Alexis Petrounias <www.petrounias.org>,
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted p... | petrounias/django-cte-trees | cte_tree/query.py | Python | bsd-3-clause | 19,181 |
import json
import mwclient
import re
import requests
from bs4 import BeautifulSoup
def get_character_list():
r = requests.get('http://www.detectiveconanworld.com/wiki/Category:Characters')
html = r.text
soup = BeautifulSoup(html, 'html.parser')
#There should only ever be one section
character_sect... | lethargilistic/dcapi | dcapi/data/images/characterimages.py | Python | mit | 6,486 |
"""
Module with universal etree module
"""
__all__ = ('etree', )
try:
from lxml import etree
except ImportError:
try:
import xml.etree.cElementTree as etree
except (ImportError, SystemError):
import xml.etree.ElementTree as etree
| bacher09/gpackages-metadata | packages_metadata/generic_metadata/my_etree.py | Python | gpl-2.0 | 262 |
import MySQLdb, string, sys, time, os, math
from pyslalib import slalib as s
RADTODEG = float('57.295779513082320876798154814105170332405472466564')
DEGTORAD = float('1.7453292519943295769236907684886127134428718885417e-2')
RADTOHRS = float('3.8197186342054880584532103209403446888270314977710')
HRSTORAD = ... | nrao/FLAG-Beamformer-Devel | src/vegas_hpc/python/GBTStatus.py | Python | gpl-2.0 | 9,716 |
# disable missing docstring
#pylint: disable=C0111
from lettuce import world, step
@step('I have created a Discussion Tag$')
def i_created_discussion_tag(step):
world.create_component_instance(
step, '.large-discussion-icon',
'discussion',
'.xmodule_DiscussionModule',
has_multiple... | praveen-pal/edx-platform | cms/djangoapps/contentstore/features/discussion-editor.py | Python | agpl-3.0 | 964 |
# -*- coding: utf-8 -*-
#
# papyon - a python client library for Msn
#
# Copyright (C) 2010 Collabora Ltd.
#
# 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
#... | emesene/papyon | tests/test_conversation.py | Python | gpl-2.0 | 4,764 |
config = {"display.fallback_width": 88}
| Horta/limix | limix/_config.py | Python | apache-2.0 | 40 |
"""
Django settings for psipcam project.
Generated by 'django-admin startproject' using Django 1.11.1.
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 os... | fifajan/pysecipcam | djcam/psipcam/psipcam/settings.py | Python | gpl-3.0 | 3,099 |
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path = dir_path.replace("rif", "")
import sys
try:
from configparser import SafeConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
s = SafeConfigParser(strict=False)
#Get Clarissa setting
def getClarissaSetting(section,key):... | Clarissa-Bot/Clarissa | rif/reader.py | Python | apache-2.0 | 784 |
# -*- coding: utf-8 -*-
import pytest
from validators import Max, Min
@pytest.mark.parametrize(('value',), [
(None,),
('',),
(12,),
(Min,),
])
def test_max_is_greater_than_every_other_value(value):
assert value < Max
assert Max > value
def test_max_is_not_greater_than_itself():
assert n... | kvesteri/validators | tests/test_extremes.py | Python | mit | 814 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from imp import load_source
from inspect import isabstract
from os import listdir, mkdir
from os.path import isdir, isfile, join
from threading import Lock
from pkg_resources import DistributionNotFound, require, VersionConflict
from . import items, uti... | timbuchwaldt/bundlewrap | bundlewrap/repo.py | Python | gpl-3.0 | 25,477 |
from pwd import getpwnam
from subprocess import PIPE, Popen, call
shells = {
'bash': '/bin/bash',
'zsh': '/bin/zsh',
'tmux': '/usr/bin/tmux'
}
def try_getpwnam(name):
try:
return getpwnam(name)
except KeyError:
return None
def create_user(username, full_name, room_number, work_p... | hacsoc/kraller | kraller/user_management.py | Python | bsd-2-clause | 942 |
# -*- coding: utf-8 -*-
import os, shutil
import logging
import logging.config
import const
path = os.path.dirname(__file__)
LOGGING_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(asctime)s %(levelname)s %(module)s - %(message)s'
},
'simple': {
'fo... | rolandwz/pymisc | matrader/rwlogging.py | Python | mit | 1,488 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import threading
from collections import namedtuple
from exhibitionist.decorators import mlock
import exhibitionist.log
logger = exhibitionist.log.getLogger(__name__)
Entry = namedtuple("Entry", "priority sub")
class PubSubMixin(object):
def __init... | kentfrazier/Exhibitionist | exhibitionist/mixins/pubsub.py | Python | bsd-3-clause | 3,167 |
from graphviz import Digraph
from docopt import docopt
import yaml
__doc__ = """SOA Graph Generator.
Usage:
gen.py [options] all <descriptor>
gen.py [options] <node> <descriptor>
Options:
-h --help Show this screen.
--format=<fmt> Format [default: pdf]
--engine=<engine> Engine [default: d... | ninowalker/ymlgraph | gen.py | Python | bsd-3-clause | 1,971 |
# -*- coding: utf-8 -*-
# YAFF is yet another force-field code.
# Copyright (C) 2011 Toon Verstraelen <Toon.Verstraelen@UGent.be>,
# Louis Vanduyfhuys <Louis.Vanduyfhuys@UGent.be>, Center for Molecular Modeling
# (CMM), Ghent University, Ghent, Belgium; all rights reserved unless otherwise
# stated.
#
# This file is pa... | molmod/yaff | yaff/sampling/test/test_harmonic.py | Python | gpl-3.0 | 4,266 |
# -*- coding: iso-8859-1 -*-
"""
Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the... | fabrice-lecuyer/QuantLib-SWIG | Python/QuantLib/__init__.py | Python | bsd-3-clause | 3,198 |
'''
This file contains the classes, functions and globals used for visualizing
Deadlock Detection algorithms
'''
# Kivy libraries
from kivy.properties import ObjectProperty
from kivy.uix.scrollview import ScrollView
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label... | osava-nsit/osava | screens/deadlock_detection_screens.py | Python | apache-2.0 | 13,031 |
#
# Copyright 2012 Facebook
#
# 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, s... | lilydjwg/tornado | tornado/concurrent.py | Python | apache-2.0 | 8,154 |
from mudpyl.metaline import Metaline
def test_Metaline_change_fg_sets_colour():
m = Metaline('foo', RunLengthList([(0, None)]), None)
m.change_fore(0, 5, 'foo')
assert m.fores.items() == [(0, 'foo'), (5, None)]
def test_Metaline_change_bg_sets_colour():
m = Metaline("foo", None, RunLengthList([(0, Non... | Nik0las1984/mudpyl | mudpyl/tests/test_metaline.py | Python | gpl-2.0 | 12,182 |
class PCB(dict):
"""
Abstraction Layer for the PICLANG Program Control Block (PCB)
"""
def __init__(self,datablock):
import picos.core as pcore
word_size = pcore.word_size
if len(datablock) != pcore.pcb_size:
raise Exception("Not a valid PCB block. Expected size %d b... | kd0kfo/picos | tools/python/picos/piclang.py | Python | gpl-3.0 | 1,527 |
#!/usr/bin/env python
"""Tunir project"""
from setuptools import find_packages, setup
setup(name = 'tunir',
version = '0.17.3',
description = "Simple testing system.",
long_description = "A simple testing system which can be maintained.",
platforms = ["Linux"],
author="Kushal Das",
author_email... | kushaldas/tunir | setup.py | Python | gpl-2.0 | 818 |
import json
from collections import OrderedDict
from coalib.bearlib.spacing.SpacingHelper import SpacingHelper
from coalib.bears.LocalBear import LocalBear
from coalib.results.Diff import Diff
from coalib.results.Result import Result
class JSONFormatBear(LocalBear):
try:
DecodeError = json.decoder.JSONDe... | mr-karan/coala-bears | bears/js/JSONFormatBear.py | Python | agpl-3.0 | 2,303 |
from django.test import TestCase
from whats_fresh.whats_fresh_api.models import Product
from django.contrib.gis.db import models
class ProductTestCase(TestCase):
def setUp(self):
self.expected_fields = {
'name': models.TextField,
'variety': models.TextField,
'alt_name... | iCHAIT/whats-fresh-api | whats_fresh/whats_fresh_api/tests/models/test_products_model.py | Python | apache-2.0 | 2,377 |
#MenuTitle: Find And Replace In Anchor Names
# -*- coding: utf-8 -*-
__doc__="""
Replaces strings in anchor names of all selected glyphs.
"""
import vanilla
import GlyphsApp
class SearchAndReplaceInAnchorNames( object ):
def __init__( self ):
# Window 'self.w':
windowWidth = 520
windowHeight = 58
windowWidt... | schriftgestalt/Mekka-Scripts | Anchors/Find and Replace in Anchor Names.py | Python | apache-2.0 | 3,730 |
"""
Visualizing Random Walks
========================
This shows the use of transparent lines to visualize random walk data.
There is also a custom plugin defined which causes lines to be highlighted
when the mouse hovers over them.
Use the toolbar buttons at the bottom-right of the plot to enable zooming
and panning, ... | jakevdp/mpld3 | examples/random_walk.py | Python | bsd-3-clause | 2,304 |
class Node(object):
def __init__(self, val, left = None, right = None):
self.val = val
self.left = left
self.right = right
def find_subtree(root,count):
if root is None:
return True
l_subtree = find_subtree(root.left,count)
r_subtree = find_subtree(root.right,count)
... | bkpathak/HackerRank-Problems | python/tree/find_unival.py | Python | mit | 1,228 |
import os
import sys
from time import sleep
# Ambari includes
from resource_management.core.exceptions import ComponentIsNotRunning
from resource_management.libraries.script import Script
# Custom service test classes includes
from integrated_base_test import IntegratedBaseTestCase
SCRIPT_DIR = os.path.dirname(os.pa... | supergarotinho/ambari-mongodb | package/test/integrated_replicaset_mongod_test.py | Python | bsd-3-clause | 22,812 |
# -*- coding: utf-8 -*-
import Storage_Classes
import matplotlib.pyplot as plt
import Features
## display AP which sent most packets
def show_biggest_ap(senders):
## find biggest
max_s = Storage_Classes.Sender()
for addr in senders:
s = senders[addr]
if ( s.type == Storage_Classes.Sender.T... | stephansigg/IPSN_localisation_passive-DF | Data_CaseStudies/CaseStudy_1401_corners/Visualization.py | Python | gpl-2.0 | 4,451 |
import subprocess
import time
import locale
import logging
from pyp2rpm import version
from pyp2rpm import utils
logger = logging.getLogger(__name__)
def get_deps_names(runtime_deps_list):
'''
data['runtime_deps'] has format:
[['Requires', 'name', '>=', 'version'], ...]
this function creates list of... | pombredanne/pyp2rpm | pyp2rpm/package_data.py | Python | mit | 3,355 |
#!/usr/bin/env python
from wutils import get_version, generate_version_py
from distutils.core import setup
generate_version_py()
setup(name='PyBindGen',
version=get_version(),
description='Python Bindings Generator',
author='Gustavo Carneiro',
author_email='gjcarneiro@gmail.com',
url='h... | cawka/pybindgen-old | setup.py | Python | lgpl-2.1 | 455 |
from django.utils.html import strip_tags
from django.utils.text import unescape_entities
from tendenci.apps.meta.utils import generate_meta_keywords
from tendenci.apps.site_settings.utils import get_setting
from tendenci.apps.base.utils import truncate_words
class PhotoMeta():
"""
SEO specific tags carefully c... | alirizakeles/tendenci | tendenci/apps/photos/module_meta.py | Python | gpl-3.0 | 3,743 |
"""Core factories test suite."""
import pathlib
import holocron
def test_create_app_processors_discover():
"""Processors must be discovered and setup."""
testapp = holocron.create_app({})
assert set(testapp._processors) == {
"archive",
"chain",
"commonmark",
"feed",
... | ikalnytskyi/holocron | tests/_core/test_factories.py | Python | bsd-3-clause | 2,343 |
import brian_no_units
from brian.units import *
from brian.group import *
import time
import scipy.signal as sg
import scipy.stats as stats
import numpy as np
from brian.stdunits import *
from brian.network import run, Network, network_operation
from brian.connections.connection import Connection
from brian.directcontr... | inincs/pyNCS | src/pyNCS/api/IFSLWTA_brian_model.py | Python | gpl-2.0 | 5,381 |
#-
# Copyright (c) 2011 Robert N. M. Watson
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# License... | 8l/beri | cheritest/trunk/tests/alu/test_slti.py | Python | apache-2.0 | 2,352 |
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | axbaretto/beam | sdks/python/.tox/py27gcp/lib/python2.7/site-packages/googledatastore/helper_test.py | Python | apache-2.0 | 10,110 |
#!/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/polypod/compiler/contexts/kubeflow/mpi_job.py | Python | apache-2.0 | 1,837 |
#!/usr/bin/env python3
import shutil, os, argparse, sys, stat, fnmatch
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-etcFolder', type=str, required =True)
parser.add_argument('-dest', type=str, required =True)
parser.add_argument('-rmDir', action = "store_true", help = "Re... | weng-lab/TwoBit | scripts/setUpScripts/installEtc.py | Python | apache-2.0 | 728 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2013, IOhannes m zmölnig, IEM
# This file is part of WILMix
#
# 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 th... | iem-projects/WILMAmix | WILMA/net/discovery.py | Python | gpl-2.0 | 1,855 |
import datetime
import os
from django.conf import settings
import mock
from nose.tools import eq_, ok_
from pyquery import PyQuery as pq
import mkt
import mkt.site.tests
from mkt.comm.models import CommunicationNote
from mkt.constants.applications import DEVICE_TYPES
from mkt.developers.models import ActivityLog, Ap... | elysium001/zamboni | mkt/developers/tests/test_views_versions.py | Python | bsd-3-clause | 30,364 |
"""
Logout Page.
"""
from bok_choy.page_object import PageObject
from common.test.acceptance.pages.common import BASE_URL
class LogoutPage(PageObject):
"""
Logout page to logout current logged in user.
"""
url = BASE_URL + "/logout"
def is_browser_on_page(self):
return self.q(css='.si... | eduNEXT/edunext-platform | common/test/acceptance/pages/common/logout.py | Python | agpl-3.0 | 340 |
#!/usr/bin/env python
import json
import netaddr
import os
import random
import re
import requests
import sys
from azure.storage.blob import AppendBlobService
from azure.storage.table import TableService
import azure.mgmt.network
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.network ... | kenazk/azure-quickstart-templates | bosh-setup/scripts/setup_env.py | Python | mit | 7,468 |
from django.core.management.base import BaseCommand
import os
import re
import subprocess
from pymediainfo import MediaInfo
from flicksapp.models import Movie, File, Track
from flicksapp.choices import FILE_TYPES, PICTURE_TYPE, VIDEO_TYPE, NFO_TYPE, \
SUBTITLES_TYPE, OTHER_TYPE, AUDIO_TYPE
IGNORES = (
'^\..+... | buzz/flicks | flicksapp/management/commands/scan_files.py | Python | gpl-2.0 | 7,514 |
"""Support for reading vehicle status from BMW connected drive portal."""
import logging
from bimmer_connected.state import ChargingState
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
CONF_UNIT_SYSTEM_IMPERIAL,
LENGTH_KILOMETERS,
LENGTH_MILES,
PERCENTAGE,
... | w1ll1am23/home-assistant | homeassistant/components/bmw_connected_drive/sensor.py | Python | apache-2.0 | 5,261 |
#!/usr/bin/env python
import fileinput
import sys
import os
import re
import math
import json
import numpy as np
import subprocess
from optparse import OptionParser
# These kernels have guaranteed correct Jacobians
whitelisted_kernels = ['Diffusion', 'TimeDerivative']
# regular expressions to parse the PETSc debug... | wgapl/moose | python/jacobiandebug/analyzejacobian.py | Python | lgpl-2.1 | 12,104 |
from api import * # noqa
from errors import * # noqa
| cogniteev/docido-python-sdk | docido_sdk/index/__init__.py | Python | apache-2.0 | 56 |
import random
import functools as fcn
from itertools import islice, chain, combinations
def get_twoopt_mutation(adjacency_matrix, mutation_probability):
return fcn.partial(__twoopt_mutation, adjacency_matrix,
mutation_probability)
def __twoopt_mutation(adjacency_matrix, mutation_probility... | sglumac/pyislands | pyislands/permutation/tsp/mutation.py | Python | mit | 1,550 |
import json
from urllib.parse import urlencode
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from django.t... | mattseymour/django | tests/test_client_regress/views.py | Python | bsd-3-clause | 4,990 |
"""
module for generating and serializing xml and html structures
by using simple python objects.
(c) holger krekel, holger at merlinux eu. 2009
"""
import sys, re
if sys.version_info >= (3,0):
def u(s):
return s
def unicode(x, errors=None):
if hasattr(x, '__unicode__'):
return x._... | pdxwebdev/yadapy | yada/lib/python2.7/site-packages/py/_xmlgen.py | Python | gpl-3.0 | 8,154 |
from util import tictoc, normalize_array, WeightsParser, build_batched_grad, add_dropout
from optimizers import sgd, rms_prop, adam, bfgs
from io_utils import get_output_file, get_data_file, load_data, load_data_slices, output_dir
from rdkit_utils import smiles_to_fps
from build_convnet import build_conv_deep_net, buil... | HIPS/neural-fingerprint | neuralfingerprint/__init__.py | Python | mit | 776 |
#!/usr/bin/env python2
# vim: set fileencoding=utf-8:
# @Author: Vayn a.k.a. VT <vayn@vayn.de>
# @Name: filter.py
# @Date: 2011年07月21日 星期四 18时06分21秒
'''
vinergy.util.filter
~~~~~~~~~~~~~~~~~~~~~~
Custom Pygments Filter
'''
import re
from pygments.util import get_int_opt
from pygments.filter import Filter
clas... | Vim-cn/Vinergy | vinergy/util/filter.py | Python | gpl-3.0 | 832 |
# ============================================================================
#
# Copyright (C) 2007-2012 Conceptive Engineering bvba. All rights reserved.
# www.conceptive.be / project-camelot@conceptive.be
#
# This file is part of the Camelot Library.
#
# This file may be used under the terms of the GNU General... | jeroendierckx/Camelot | camelot/art/__init__.py | Python | gpl-2.0 | 1,069 |
# -*- encoding: utf-8 -*-
_cim_response_codes = [
['I00001', 'Successful', 'The request was processed successfully.'],
['I00003', 'The record has already been deleted.', 'The record has already been deleted.'],
['E00001', 'An error occurred during processing. Please try again.', 'An unexpected system error... | simplegeo/authorize | authorize/responses.py | Python | mit | 11,524 |
#! /usr/bin/env python
from openturns import *
from math import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Instanciate one distribution object
dim = 2
copula = FarlieGumbelMorgensternCopula(0.7)
copula.setName("a farlieGumbelMorgenstern copula")
print "Copula ", repr(copula)
print "Co... | dbarbier/ot-svn | python/test/t_FarlieGumbelMorgensternCopula_std.py | Python | gpl-3.0 | 2,648 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.