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 |
|---|---|---|---|---|---|
#
# Copyright (C) 2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is dis... | jkonecny12/anaconda | tests/glade_tests/test_glade_validity.py | Python | gpl-2.0 | 2,541 |
import itertools
import functools
import inspect
from sage.all import *
def mk_symbol_vector(dim,symbol):
return matrix(1,dim, lambda i,j: var(
symbol+"_"+str(j),
latex_name=symbol+"_{"+str(j)+"}"))
def mk_symbol_matrix(rdim,cdim,symbol):
return matrix(rdim,cdim, lambda i,j: var(
sy... | alpako/ilp-termination | sage/misc_matrix.py | Python | mit | 5,005 |
import os
import sys
from classtime import app
def is_main_process():
return os.environ.get('WERKZEUG_RUN_MAIN')
def idly_fill():
from classtime.brain import AcademicCalendar
for institution in ['ualberta']:
AcademicCalendar.idly_fill(institution, sleeptime=2, force_refresh=True)
def runserver():... | rosshamish/classtime | idlyfilldatabase.py | Python | mit | 479 |
""" Win32 API for interaction with windows """
import ctypes
from ctypes import wintypes, windll
from time import sleep
####################
# Constants
####################
HWND = wintypes.HWND #window handler
WPARAM = wintypes.WPARAM #message parameter
LPARAM = wintypes.LPARAM #message parameter
LRESULT... | DoumanAsh/collectionScripts | python/win32/windows.py | Python | mit | 6,517 |
#!/usr/bin/python3
#
# Copyright © 2017 jared <jared@jared-devstation>
#
# Class defines an array that is designed for managing
# similar samples and keeping them sorted.
# Requires a comparator. For two items,
# comparator(a, b) gives some measure of "distance".
# in our measurements.
class SampleArr:
def __ini... | techlover10/StochasticSoundscape | src/samplearr.py | Python | mit | 1,222 |
# -*- coding: utf-8 -*-
# Test links (random.bin):
# http://www13.zippyshare.com/v/18665333/file.html
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
__pattern__ = r'(?P<HOST>http:/... | estaban/pyload | module/plugins/hoster/ZippyshareCom.py | Python | gpl-3.0 | 2,928 |
# Copyright 2014 IBM Corp.
# 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 app... | openstack/tempest-lib | tempest_lib/tests/fake_identity.py | Python | apache-2.0 | 4,534 |
from __future__ import absolute_import
import logging
import re
import sys
import traceback
import types
import threading
__all__ = [
'log_stack',
'ExtendedLogger',
'RootLoggerWrapper',
]
LoggerClass = logging.getLoggerClass()
class ShowingStack(threading.local):
inside = False
showing_stack = Sho... | ndawe/rootpy | rootpy/logger/extended_logger.py | Python | bsd-3-clause | 8,610 |
#!venv/bin/python
from lossebladjes import app
if __name__ == '__main__':
app.debug = True
app.run(host='0.0.0.0', port=5000)
| berz/lossebladjes | run.py | Python | bsd-3-clause | 135 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import threading
import time
import urllib2
import traceback
import json
descriptors = list()
Desc_Skel = {}
_Worker_Thread = None
_Lock = threading.Lock() # synchronization lock
Debug = False
def dprint(f, *v):
if Debug:
print >>sys.st... | dmourati/monitor-core | gmond/python_modules/db/riak.py | Python | bsd-3-clause | 9,804 |
#python
import k3d
import testing
setup = testing.setup_mesh_modifier_test("PolyGrid", "ExtrudeFaces")
setup.source.rows = 3
setup.source.columns = 3
selection = k3d.geometry.selection.create(0)
face_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selec... | barche/k3d | tests/mesh/mesh.modifier.ExtrudeFaces.py | Python | gpl-2.0 | 639 |
from network.network import BaseNetwork
import numpy as np
class RelevanceBackpropagation:
"""
Relevance backpropagation limited to the first maxpool layer.
"""
def __init__(self, network: BaseNetwork):
self._network = network
def visualize(self, input_sample, eps=1) -> np.ndarray:
... | JarnoRFB/qtpyvis | visualizations/relevance_backpropagation.py | Python | mit | 7,471 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 2014, 2015 CERN.
#
# Invenio 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... | dset0x/invenio-checker-old | invenio_checker/views/admin.py | Python | gpl-2.0 | 19,129 |
# AUTHOR: Kale Miller
# DESCRIPTION: Contains the core classes for the program.
# 50726f6772616d6d696e6720697320627265616b696e67206f66206f6e652062696720696d706f737369626c65207461736b20696e746f20736576
# 6572616c207665727920736d616c6c20706f737369626c65207461736b732e
# DEVELOPMENT LOG:
# 05/12/16: Initialized... | kmiller96/Shipping-Containers-Software | lib/containers.py | Python | mit | 14,805 |
import os
from subprocess import call
import numpy as np
# Those are separate normalised input features for the neural network
INPUT_SIGNAL_TYPES = [
"body_acc_x_",
"body_acc_y_",
"body_acc_z_",
"body_gyro_x_",
"body_gyro_y_",
"body_gyro_z_",
"total_acc_x_",
"total_acc_y_",
"total_a... | Joshuaalbert/KAIRApy | src/kaira/examples/har/train_har_dataset.py | Python | apache-2.0 | 8,141 |
# 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... | dmlc/tvm | python/tvm/meta_schedule/testing/relay_workload.py | Python | apache-2.0 | 6,298 |
#!/usr/bin/env python
import pygame
import datetime
import sys
pygame.init()
modes_list = pygame.display.list_modes()
#screen = pygame.display.set_mode(modes_list[0], pygame.FULLSCREEN) # the highest resolution with fullscreen
screen = pygame.display.set_mode(modes_list[-1]) # the lowest resolu... | jeremiedecock/snippets | python/pygame/clock.py | Python | mit | 1,205 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import difflib
import logging
import functools
from string import punctuation as punct
from eplist import utils
from eplist.episode import Episode
from eplist.settings import Settings
try:
from bs4 import BeautifulSoup
Soup = functoo... | djt5019/episode_renamer | eplist/web_sources/anidb.py | Python | unlicense | 4,723 |
import unittest
from misc.interval_tree import IntervalTree
from misc.rb_node import RBNode
from misc.interval import Interval
from fractions import Fraction
import sys
if sys.version_info[0] < 3:
from mock import Mock, MagicMock
else:
from unittest.mock import Mock, MagicMock
class TestRBNode(unittest.Test... | dpazel/music_rep | tests/misc_tests/test_rb_node.py | Python | mit | 932 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Image.image'
db.alter_column('page_gallery_images_image', 'image', self.gf('django.db.mod... | makinacorpus/ionyweb | ionyweb/page_app/page_gallery_images/migrations/0003_auto__chg_field_image_image__add_field_pageapp_galleryimages_album_tit.py | Python | bsd-3-clause | 12,513 |
"""
Python toolbox utility and helper functions.
Python implementation by: Luis Fernando Lara Tobar and Peter Corke.
Based on original Robotics Toolbox for Matlab code by Peter Corke.
Permission to use and copy is granted provided that acknowledgement of
the authors is made.
@author: Luis Fernando Lara Tobar and Pet... | irzaip/chippy | scripts/robot/utility.py | Python | lgpl-3.0 | 3,691 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | berrange/nova | nova/tests/integrated/v3/test_server_diagnostics.py | Python | apache-2.0 | 1,092 |
#!/usr/bin/env python
"""
vg_map.py: map to vg graph producing gam for each chrom
"""
import argparse, sys, os, os.path, errno, random, subprocess, shutil, itertools, glob, tarfile
import doctest, re, json, collections, time, timeit
import logging, logging.handlers, struct, socket, threading
import string
import getp... | vgteam/toil-vg | src/toil_vg/vg_map.py | Python | apache-2.0 | 43,173 |
from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from dajaxice.core import dajaxice_autodiscover
dajaxice_autodiscover()
from RSSFeed import MailsFeed
urlpatterns = patterns('mailshareapp... | RobFisher/mailshare | urls.py | Python | bsd-3-clause | 1,049 |
# Sets the theme to the package embedded
html_theme = 'sphinx_bernard_theme'
html_theme_path = ['_themes']
project = u'Bernard'
copyright = u'MIT'
master_doc = 'index'
templates_path = ['_templates']
exclude_patterns = ['demo', 'README.rst']
html_static_path = ['_static']
html_additional_pages = {
'index' : 'i... | bernardphp/bernardphp-com | conf.py | Python | mit | 333 |
"""Unit tests for rbtools.utils.aliases."""
from __future__ import unicode_literals
from rbtools.testing import TestCase
from rbtools.utils.aliases import replace_arguments
class AliasTests(TestCase):
"""Tests for rbtools.utils.aliases."""
def test_replace_arguments_basic(self):
"""Testing replace_... | reviewboard/rbtools | rbtools/utils/tests/test_aliases.py | Python | mit | 3,898 |
#! /usr/bin/env python3
__author__ = 'Rafael Zamora, rz4@hood.edu'
from setuptools import setup, find_packages
setup(
name="PyAIDE",
version="1.0.0",
description="Python library for the development and testing of intelligent agents.",
license="GNU",
keywords="Artificial Intelligence Testing Deve... | rz4/PyAIDE | setup.py | Python | gpl-2.0 | 426 |
from zope.component import getMultiAdapter
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from plone.app.layout.viewlets import ViewletBase
class DocumentActionsViewlet(ViewletBase):
index = ViewPageTemplateFile("document_actions.pt")
def update(self):
super(DocumentActions... | tiramisusolutions/ts.theme | ts/theme/browser/viewlets/content.py | Python | gpl-2.0 | 564 |
"""
example_a.py
by Ted Morin
contains example code for 8-year Diabtes Mellitus risks using point system from
10.1001/archinte.167.10.1068
2007 Prediction of Incident Diabetes Mellitus in Middle Aged Adults
Framingham Heart Study
"""
from model_a import model
"Male Sex" "Age" "Systolic BP" "Diastolic BP" "Height" "... | doirisks/dori | models/10.1001:archinte.167.10.1068/example_a.py | Python | gpl-3.0 | 1,820 |
#! /usr/bin/env python
from gimpfu import *
from gimpmaps.renderergimp import TileRendererGimp, MapRendererGimp
"""
Run this file from the bash script provided in the directory above.
"""
def run(config_file, map_type):
if map_type == "tiles":
tile_renderer = TileRendererGimp(config_fi... | mucximilian/gimpmaps | gimprenderer/create_gimpmap.py | Python | gpl-2.0 | 1,001 |
import os
from setuptools import setup, find_packages
import img_resizer
def read_requirements(filename):
content = open(os.path.join(here, filename)).read()
requirements = map(lambda r: r.strip(), content.splitlines())
return requirements
here = os.path.abspath(os.path.dirname(__file__))
README = open... | g761007/img_resizer | setup.py | Python | mit | 1,258 |
from inspect import isclass
from django.conf import settings
from django.core.files.storage import get_storage_class
from celery.datastructures import AttributeDict
from tower import ugettext_lazy as _
__all__ = ('LOG', 'LOG_BY_ID', 'LOG_KEEP',)
class _LOG(object):
action_class = None
class CREATE_ADDON(_LOG... | Hitechverma/zamboni | mkt/site/log.py | Python | bsd-3-clause | 19,618 |
"""Here it is."""
import pickle
import socket
import sys
import os
import json
__author__ = 'alexander'
file_name = 'data_points.json'
app_dir = os.path.abspath(os.path.dirname(__file__))
def call_server(message):
"""
This function takes a dict and returns a dict.
{'r': ['self.VS1_GT1.temp',
... | gurkslask/hamcwebc | hamcwebc/connect_to_socket.py | Python | bsd-3-clause | 1,967 |
from gettext import gettext as _
import sys
from gi.repository import Gtk
import pygame
import sugar3.activity.activity
from sugar3.graphics.toolbarbox import ToolbarBox
from sugar3.activity.widgets import ActivityToolbarButton
from sugar3.graphics.toolbutton import ToolButton
from sugar3.activity.widgets import Stop... | ry60003333/grapes-of-math | grapesActivity.py | Python | mit | 2,645 |
# Copyright 2019 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.
from . import config
class TestConfig(config.CodeSignConfig):
def __init__(self,
identity='[IDENTITY]',
installer_id... | nwjs/chromium.src | chrome/installer/mac/signing/test_config.py | Python | bsd-3-clause | 1,290 |
# -*- coding: utf-8 -*-
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/... | argenisosorio/django-rest-framework-example | project/settings.py | Python | gpl-3.0 | 3,319 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
import os
import random
import zipfile
import numpy as np
from six.moves import urllib
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
... | praveenax/BotCentric | TFEngine/TF/word2vec.py | Python | gpl-3.0 | 8,875 |
#!/usr/bin/python
##########################################################################
# (C) Vrije Universiteit, Amsterdam (the Netherlands) #
# #
# This file is part of AmCAT - The Amsterdam Content Analysis Toolkit ... | amcat/amcat | amcat/scripts/actions/replace_medium.py | Python | agpl-3.0 | 2,978 |
# Generated by Django 2.0.13 on 2020-07-21 13:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('con... | ox-it/talks.ox | talks/users/migrations/0001_initial.py | Python | apache-2.0 | 4,037 |
# Generated by Django 1.11.20 on 2019-06-29 18:22
from django.db import migrations, models
DESKTOP_ICON_COUNT_DISPLAY_MESSAGES = 1
class Migration(migrations.Migration):
dependencies = [
("zerver", "0234_add_external_account_custom_profile_field"),
]
operations = [
migrations.AddField(
... | eeshangarg/zulip | zerver/migrations/0235_userprofile_desktop_icon_count_display.py | Python | apache-2.0 | 519 |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.mock import (
NO_MOCK,
NO_MOCK_REASON,
Mock,
MagicMock,
patch
)
from salttesting.helpers import ensure_in_syspath
ensure_in_sysp... | stephane-martin/salt-debian-packaging | salt-2016.3.3/tests/unit/states/grafana_datasource_test.py | Python | apache-2.0 | 3,938 |
import unittest
import copy
import anatomize.sentence.base as sentence
import anatomize.sentence.dependency as dependency
class DbssTestCase(unittest.TestCase):
sentence_goldfish_attributes = ["wform", "id", "parent", "relation"]
sentence_goldfish = \
[\
["my", "1", "2", "poss"],
... | FilippoC/anatomize | unittest/sentence/dbss_test_case.py | Python | mit | 3,968 |
from .base import SOLAR, EARTH, WATER, FIRE, AIR, LUNAR, Spell
from .. import effects
from .. import targetarea
from .. import enchantments
from .. import animobs
from .. import stats
from .. import context
from .. import invocations
# Necromancers get EARTH, LUNAR, and WATER magic. These spells use at least two
# of ... | jwvhewitt/dmeternal | old_game/spells/necrospells.py | Python | gpl-2.0 | 7,794 |
from werkzeug.exceptions import HTTPException
from werkzeug.wsgi import SharedDataMiddleware
from partial import routing, scanner
from partial.request import Request
class Application(object):
def dispatch_request(self, request):
scanner.LOCAL.request = request
adapter = scanner.GLOBAL['routemap'... | RentennaDev/partial | partial/application.py | Python | mit | 1,463 |
# propulsionSkillCapNeedBonusSkillLevel
#
# Used by:
# Implants named like: Zainou 'Gypsy' Propulsion Jamming PJ (6 of 6)
# Skill: Propulsion Jamming
type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
fit.modules.filteredItemBoost(lambda mod: mod.item... | bsmr-eve/Pyfa | eos/effects/propulsionskillcapneedbonusskilllevel.py | Python | gpl-3.0 | 464 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: GDFA word alignment symmetrization
#
# Copyright (C) 2001-2015 NLTK Project
# Authors: Liling Tan
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
import codecs
from collections import defaultdict
def grow_diag_final_and(srclen, trglen... | MyRookie/SentimentAnalyse | venv/lib/python2.7/site-packages/nltk/translate/gdfa.py | Python | mit | 6,024 |
"""
banyan_base_multi.py
Copyright (c) 2016 - 2019 Alan Yorinks All right reserved.
Python Banyan is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Version 3 as published by the Free Software Foundation; either
or (at your option) any later versio... | MrYsLab/python_banyan | python_banyan/banyan_base_multi/banyan_base_multi.py | Python | agpl-3.0 | 14,540 |
# 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... | Kongsea/tensorflow | tensorflow/contrib/slim/python/slim/data/dataset_data_provider.py | Python | apache-2.0 | 4,216 |
from django.views.generic import (CreateView, DeleteView,
DetailView, ListView, UpdateView)
from django.core.urlresolvers import reverse_lazy
from .forms import NoteForm
from .models import Note
class NoteList(ListView):
model = Note
context_object_name = 'notes'
class Not... | paulcwatts/codefellows-django-testing | notes/views.py | Python | bsd-3-clause | 1,104 |
from .distribution import Distribution
from .gaussian import GaussianDistribution, GaussianDiagonalDistribution, \
GaussianCholeskyDistribution
__all__ = ['Distribution',
'GaussianDistribution', 'GaussianDiagonalDistribution',
'GaussianCholeskyDistribution']
| carloderamo/mushroom | mushroom_rl/distributions/__init__.py | Python | mit | 286 |
import sys
import os
import csv
import json
import xml.etree.ElementTree as XML
import calendar
import requests
import argparse
import codecs
import paths
API_URL = 'http://pensyanet.cma.gov.il/Parameters/ExportToXML'
# API accepts a single param, vm, containing a JSON structure
# Functions should use API_VM_TEMPLATE... | hasadna/open-pension-net-scraper | web_sources/pensianet.py | Python | bsd-3-clause | 5,895 |
x = 3
print type(x) # Prints "<type 'int'>"
print x # Prints "3"
print x + 1 # Addition; prints "4"
print x - 1 # Subtraction; prints "2"
print x * 2 # Multiplication; prints "6"
print x ** 2 # Exponentiation; prints "9"
x += 1
print x # Prints "4"
x *= 2
print x # Prints "8"
y = 2.5
print type(y) # Prin... | cprakashagr/PythonClass | src/numpy-scipy/basicDataTypeInPython.py | Python | mit | 3,425 |
# -*- coding: utf-8 -*-
#
# Chargeback reports are supported for all infra and cloud providers.
import math
from datetime import date
import fauxfactory
import pytest
import re
import cfme.intelligence.chargeback.assignments as cb
import cfme.intelligence.chargeback.rates as rates
from cfme import test_requirements
... | mfalesni/cfme_tests | cfme/tests/intelligence/reports/test_validate_chargeback_report.py | Python | gpl-2.0 | 26,755 |
# -*- coding: utf-8 -*-
# Copyright YEAR(S), AUTHOR(S)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
| Gebesa-Dev/Addons-gebesa | stock_move_view_sale/__init__.py | Python | agpl-3.0 | 124 |
#!/usr/bin/python
#Demonstration of how to use the PyGithub library
#Reference: http://pygithub.readthedocs.io/en/latest/index.html
#
#Make sure you install the PyGithub library:
#pip install PyGithub
import getpass
from github import Github
varUser = raw_input("GitHub account: ")
varPassword = getpass.getpass("Passw... | jklee7/python101 | 15. PyGithub.py | Python | unlicense | 546 |
import logging
import pickle
from time import time
from hashlib import md5
from base64 import urlsafe_b64encode
from os import urandom
import redis
from flask import Flask, request, render_template
import config
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__,static_folder='public')
r = redis.Strict... | skooda/passIon | index.py | Python | mit | 1,879 |
import numpy as np
import pandas as pd
import pdb
from pprint import pprint
import unittest
from Month import Month
def make_test_train(test_time_period, train_n_months_back, trade_month_column_name, samples):
'return dataframes for testing and training; see valavm.do_val.fit_and_run'
assert isinstance(test_... | rlowrance/re-avm | make_test_train.py | Python | bsd-3-clause | 1,725 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gentle.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | BORN2LOSE/gentle | src/manage.py | Python | bsd-3-clause | 804 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet import Worksheet
class TestAss... | jkyeung/XlsxWriter | xlsxwriter/test/worksheet/test_cond_format15.py | Python | bsd-2-clause | 4,061 |
from flask import Blueprint, request
from tamarack.common import data_response
from tamarack.core.db import db
from tamarack.core.models import Application
from tamarack.core.models.request import process_minute_datapoint
from tamarack.tasks.request import process_request_data
receiverapi = Blueprint('receiverapi', _... | mhallin/tamarack | tamarack/receiverapi/views.py | Python | bsd-3-clause | 523 |
"""
Simulation of grating using very long boxes and 1D lattice.
Monte-carlo integration is used to get rid of
large-particle form factor oscillations.
"""
import bornagain as ba
from bornagain import deg, angstrom, nm, micrometer
def get_sample(lattice_rotation_angle=0.0*deg):
"""
Returns a sample with a grat... | waltervh/BornAgain | Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py | Python | gpl-3.0 | 2,608 |
import os
import sys
import unittest
import tempfile
import shutil
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
try:
# 'import as' required to protect nosetests
import catkin.test_results as catkin_test_results
except ImportError as impe:
raise ImportError(
... | shyamalschandra/catkin | test/unit_tests/test_test_results.py | Python | bsd-3-clause | 2,162 |
#!/usr/bin/python3
# coding=utf-8
"""
Module for initializing.
"""
__author__ = 'Hossein Noroozpour Thany Abady'
from gi.repository import Gtk
from hml.ui.HEventHandler import HEventHandler
import sys
class HGUI():
"""
GUI Initializer.
"""
def __init__(self, glade_file='hml/ui/gui.glade'):
se... | Hossein-Noroozpour/PyHDM | HMain.py | Python | mit | 3,539 |
#!/usr/bin/env python
import rospy
import sys
import time
import actionlib
from move_base_msgs.msg import MoveBaseAction
from std_msgs.msg import Float64MultiArray
from utils.general import load_coordinates
from utils.general import make_goal
U_OBST_PTS = [2.5,1.5,-1.5,1.5,-1.5,-1.5,2.5,-1.5]
U_OBST_CLEAR = [0,0,0,0... | RockRaidersInc/ROS-Main | autonomous_traversal/src/igvc_sim_demo.py | Python | gpl-3.0 | 2,010 |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
items = UnwrapElement(IN[0])
elementlist = list()
for item in items:
try:
if item.Document.GetElement(item.GroupId) == None:
elementlist.append(list())
else:... | andydandy74/ClockworkForDynamo | nodes/0.9.x/python/Element.Group.py | Python | mit | 438 |
from corehq.apps.hqwebapp.views import BaseSectionPageView
class BaseB3SectionPageView(BaseSectionPageView):
"""Subclass of BaseSectionPageView to immediately support Bootstrap3.
"""
def dispatch(self, request, *args, **kwargs):
# todo remove after bootstrap 3 migration is over
request.pr... | puttarajubr/commcare-hq | corehq/apps/style/views.py | Python | bsd-3-clause | 429 |
import discord
from redbot.core.bot import Red
from redbot.core import checks, commands, Config
from redbot.core.i18n import cog_i18n, Translator, set_contextual_locales_from_guild
from redbot.core.utils._internal_utils import send_to_owners_with_prefix_replaced
from redbot.core.utils.chat_formatting import escape, pag... | palmtree5/Red-DiscordBot | redbot/cogs/streams/streams.py | Python | gpl-3.0 | 39,323 |
#!/home/zrhans/.virtualenvs/django19/bin/python3.4
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| zrhans/pythonanywhere | .virtualenvs/django19/bin/django-admin.py | Python | apache-2.0 | 157 |
# Copyright (C) 2018 NTT DATA
# 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 ... | openstack/cinder | cinder/api/schemas/scheduler_hints.py | Python | apache-2.0 | 3,087 |
# This is a script to get part of the large TOA file data.
import numpy as np
# Define the start time of the TOA5 file
tStartTOA5 = np.datetime64('2016-06-14 18:20:52.5')
# Define time interval you would like to take from the TOA5 file
tStart = np.datetime64('2016-06-18T00:00:00.0')
tEnd = np.datetime64('2016-06-19T0... | dp7-PU/ECTools | CutTOA5File.py | Python | mit | 1,054 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | technologiescollege/Blockly-rduino-communication | scripts_XP/Lib/site-packages/autobahn/twisted/wamp.py | Python | gpl-3.0 | 31,939 |
# -*- coding: utf-8 -*-
from __future__ import division
from nltk.corpus import wordnet as wn #Importamos el lector del corpus de wordnet
import random
import operator
#########################################################################
## La función inicio crea la vista inicial que tendrá el usuario si no tiene... | iarroyof/define-semantic-annotation | define/controllers/particular.py | Python | gpl-2.0 | 21,463 |
from django.conf import settings
from tukey.cloud_attribute import get_cloud
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from openstack_dashboard.dashboards.project.images_and_snapshots.snapsh... | LabAdvComp/tukey_portal | tukey/dashboards/project/images_and_snapshots/snapshots/tables.py | Python | apache-2.0 | 2,937 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
NAME='bingwu33'
SPELL='bǐngwǔ'
CN='丙午'
SEQ='43'
if __name__=='__main__':
pass
| sinotradition/sinoera | sinoera/ganzhi/bingwu33.py | Python | apache-2.0 | 231 |
#!/usr/bin/env python
# setup.py - build and install the ovf2vtk package
#
# Copyright 2002-2009 Hans Fangohr, Richard Boardman
#
# This file is part of ovf2vtk.
#
#
# Authors: Hans Fangohr, Richard Boardman
#
#
"""ovf2vtk -- data conversion from OOMMF's ovf/ovf file format to VTK.
This program reads ovf files keepin... | fangohr/ovf2vtk | ovf2vtk/setup.py | Python | bsd-2-clause | 3,962 |
"""Tests for the Freckle api client of the freckle_budgets app."""
from django.test import TestCase
from . import fixtures
from .. import freckle_api
from .. import models
class GetProjectTimesTestCase(TestCase):
"""Tests for the ``get_project_times`` function."""
longMessage = True
def test_function(se... | bitmazk/django-freckle-budgets | freckle_budgets/tests/freckle_api_tests.py | Python | mit | 1,553 |
# Copyright 2015 Josh Kearney
#
# 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... | jk0/pyhole | pyhole/core/slack/message.py | Python | apache-2.0 | 1,989 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistribu... | code-google-com/cortex-vfx | test/IECore/LensDistortOpTest.py | Python | bsd-3-clause | 2,750 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditScriptAction.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | spaceof7/QGIS | python/plugins/processing/gui/EditScriptAction.py | Python | gpl-2.0 | 1,775 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @date 161228 - Impleated
"""
Url patterns for box app
"""
from box import views
def box_urls(app, prefix):
"""
Url patterns for demo.
"""
if prefix[0] != '/':
prefix = '/' + prefix
app.router.add_route('GET', prefix + '/get_worker/', vie... | grtfou/aio-tree | website/box/urls.py | Python | mit | 335 |
import argparse
import inspect
from django.contrib.gis import gdal
from django.core.management.base import BaseCommand, CommandError
class LayerOptionAction(argparse.Action):
"""
Custom argparse action for the `ogrinspect` `layer_key` keyword option
which may be an integer or a string.
"""
def __... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/contrib/gis/management/commands/ogrinspect.py | Python | mit | 5,738 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from dss.feed import *
from cropper.views import *
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from django.views.generic import ListView
from dss.models import *
from django.views.gen... | wanjohikibui/agrismart | cropper/urls.py | Python | mit | 1,614 |
# (c) 2016, Saran Ahluwalia <ahlusar.ahluwalia@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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... | azaghal/ansible | test/units/plugins/action/test_gather_facts.py | Python | gpl-3.0 | 3,598 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Hewlett Packard Enterprise Development LP
#
# 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
... | HPENetworking/topology_docker | lib/topology_docker/shell.py | Python | apache-2.0 | 2,063 |
from unittest import TestCase
from statstuff import probability as prob
class Tests(TestCase):
def test_single_random_event(self):
self.assertEqual(0, prob.random(1, []))
self.assertEqual(0, prob.random(1, [0, 0, 0, 0]))
self.assertEqual(0.25, prob.random(1, [1, 0, 0, 0]))
self.as... | lucasmauro/statstuff | tests/test_probability.py | Python | mit | 1,515 |
MAJOR = 0
MINOR = 0
PATCH = 0
VERSION = "%d.%d.%d" % (MAJOR, MINOR, PATCH)
| ElliottH/sitdown | satdown/version.py | Python | mit | 76 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.txt')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'pyramid',
'pyramid_jinja2',
'pyramid_debu... | asif-mahmud/Pyramid-Apps | pyramid_angular2/setup.py | Python | gpl-2.0 | 1,404 |
from kindled.configurators import DefaultConfigurator
from kindled.generators import CalibreEbookConvertGenerator
from kindled.logsetup import DefaultLogger
from kindled.publishers import SmtpEmailPublisher
class DefaultController(object):
""" Default Controller """
_DESCRIPTION = "Default Controller"
... | jinglemansweep/Kindled | kindled/controllers.py | Python | mit | 1,155 |
import os
import sys
import traceback
if __name__ == "__main__":
# for testing
if os.getenv("OPENCLOUD_PYTHONPATH"):
sys.path.append( os.getenv("OPENCLOUD_PYTHONPATH") )
else:
print >> sys.stderr, "No OPENCLOUD_PYTHONPATH variable set. Assuming that OpenCloud is in PYTHONPATH"
... | jcnelson/syndicate | opencloud/syndicate_observer/deleters/volumeaccessright_deleter.py | Python | apache-2.0 | 1,585 |
desc = "test that define'd lambda can include other files..."
filedata = [
"""
{$
locals { foo : ={ for (i, range (3)) { include ("$[1]")} } }
locals { bar : ={{ yo dog {% for (i, range (2)) { include ("$[2]") } %} }} }
print (foo, "\n", bar);
$}
""",
"chuck ",
"vest "
]
outcome = "chuck " * 3 + "yo dog "... | OkCupid/okws | test/regtest/cases/65.py | Python | gpl-2.0 | 335 |
import time
from selenium.webdriver.support.wait import WebDriverWait
from werkzeug.local import LocalProxy as _Proxy
from contesto import config
class JSONSerializable:
def to_json(self):
res = dict()
attrs = [name for name in vars(self) if not name.startswith('_')]
for attr in attrs:
... | 2gis/contesto | contesto/utils/__init__.py | Python | mit | 1,883 |
"""Flask web views for Caravel"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import logging
import re
import sys
import time
import traceback
from datetime import datetime
import functools
import pand... | tienhv/caravel | caravel/views.py | Python | apache-2.0 | 45,871 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/oval_5/defs/EscapeRegexFunctionType.py | Python | gpl-3.0 | 976 |
#
# ICRAR - International Centre for Radio Astronomy Research
# (c) UWA - The University of Western Australia, 2020
# Copyright by UWA (in the framework of the ICRAR)
# All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser G... | steve-ord/daliuge | daliuge-common/dlg/common/osutils.py | Python | lgpl-2.1 | 1,939 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.conn.sql("""update `tabCustom Script`
set script = replace(script, 'createLocal', 'wn.model.make_new_doc_and_get_name')
where script_type='Cl... | saurabh6790/med_new_app | patches/december_2012/replace_createlocal.py | Python | agpl-3.0 | 329 |
from simulate5 import *
# The goal here is to compare graph structure and performance with repeats and without.
# First, let's make a 2x2 table of vertex and edge counts, based on the number of items
maxSize = 3
basics = 3
repeats = 3
edges = [[0 for j in range(repeats+1)] for i in range(basics+1)]
vertices = [[0 fo... | aravart/speech-games | theory/exp_repeats.py | Python | mit | 1,362 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
import datetime
import logging
import csv
import six
from datetime import date
from django.apps import apps
from django.utils import timezone
logger = logging.getLogger(__name__)
ats_settings = apps.get_app_config('ats')
def get_user_rea... | dictoss/active-task-summary | ats/libs.py | Python | bsd-2-clause | 3,533 |
"""Add user table to support doorman and oauth authentication.
Revision ID: 0bc0a93ac867
Revises: fd28e46e46a6
Create Date: 2016-05-11 11:01:40.472139
"""
# revision identifiers, used by Alembic.
revision = '0bc0a93ac867'
down_revision = 'fd28e46e46a6'
from alembic import op
import sqlalchemy as sa
import doorman.d... | mwielgoszewski/doorman | migrations/versions/0bc0a93ac867_.py | Python | mit | 1,141 |
# TODO: interpret list as vectors (for multiplication)
rowsep = '\n'
colsep = ' '
class _matrix(object):
"""
Numerical matrix.
Specify the dimensions or the data as a nested list.
Elements default to zero.
Use a flat list to create a column vector easily.
By default, only mpf is used to sto... | pernici/sympy | sympy/mpmath/matrices/matrices.py | Python | bsd-3-clause | 31,309 |
import unittest
from application.caches.local_cache import LocalCache
class LocalCacheTest(unittest.TestCase):
def setUp(self):
self.cache = LocalCache()
def tearDown(self):
pass
def test_add_element(self):
self.cache.add("test.key", "test.value")
self.assertEqual(self.cache.get("test.key"), "test.value... | andrew749/andrew749.github.io | application/caches/test/test_local_cache.py | Python | apache-2.0 | 367 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.