repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
vinilios/feincms-1 | aw/migrate/medialibrary/0001_initial.py | # -*- 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):
# Adding model 'Category'
db.create_table('medialibrary_category', (
('id', self.gf('django.db.m... |
mconlon17/vivo-absolute-dates | absolute_dates.py | """
absolute_dates.py -- convert the data store from duplicated dates to
absolute date time value entities. All date time values become first
class objects in VIVO, reusable and invertible.
Version 0.0 2013-12-03 MC
-- Complete first draft
Version 0.1 2014-08-23 MC
-- Upgrading to curren... |
jasonmccampbell/scipy-refactor | iron_install.py | # This file performs the installation step once the build is complete.
# Installation primarily involves copying the build results to the
# IronPython site-packages directory.
import os
import sys
import shutil
import tempfile
from os.path import dirname, isdir, isfile, join
src_dir = join(os.getcwd(), "scipy")
def ... |
pv/git-cl | rietveld_upload.py | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
aldebaran/qibuild | python/qicd.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" QiCd """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_fu... |
randlet/Orbis | orbis/orbis.py | import gui
import gui.grid_utils
import numpy
import settings
import shmo
import sys
import os
os.chdir(os.path.dirname(__file__))
import wx
#====================================================================================
class MainFrame(gui.VOrbisFrame):
"""The main Orbis application frame"""
#---------... |
benjamin9999/python-stix | examples/xml_parser.py | #!/usr/bin/env python
# Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
'''
Prints certain fields from a STIXPackage object using the python interface
'''
import sys
from stix.core import STIXPackage
from stix.indicator import Indicator
from cybox.core import Obje... |
zblz/naima | src/naima/tests/test_interactive.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import astropy.units as u
import numpy as np
from astropy.io import ascii
from astropy.tests.helper import pytest
from astropy.utils.data import get_pkg_data_filename
from ..model_fitter import InteractiveModelFitter
from ..models import ... |
potar/django_test | django_test/dynamic_models/models.py |
import yaml
from django.db import models
from .utils import get_model_fields
from .config import DYNAMIC_MODELS
def create_dynamic_models(config):
dynamic_models = yaml.load(open(config))
for model, settings in dynamic_models.iteritems():
attrs = dict(
Meta=type('Meta',
... |
topwebmaster/cookiecutter-django | {{cookiecutter.project_slug}}/config/settings/base.py | """
Base settings to build other settings files upon.
"""
import environ
ROOT_DIR = environ.Path(__file__) - 3 # ({{ cookiecutter.project_slug }}/config/settings/base.py - 3 = {{ cookiecutter.project_slug }}/)
APPS_DIR = ROOT_DIR.path('{{ cookiecutter.project_slug }}')
env = environ.Env()
READ_DOT_ENV_FILE = env.b... |
foxmask/orotangi | orotangi/management/commands/import.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
import os
import io
import dateutil.parser
# django
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from logging import getLogger
from orotangi.models import Books, Notes
# create logger
logg... |
imitrichev/cantera | interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py | # -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (c) 2014 Thomas Fiala (fiala@td.mw.tum.de), Lehrstuhl für
# Thermodynamik, TU München. For conditions of distribution and use, see
# copyright notice in License.txt.
#
############################... |
serivt/corptierrayfuego | cocutifu/web/migrations/0002_auto_20161114_2147.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-11-15 02:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0001_initial'),
]
operations = [
migrations.CreateModel(
n... |
SUNET/eduid-webapp | src/eduid_webapp/letter_proofing/ekopost.py | # -*- encoding: utf-8 -*-
import base64
import json
from datetime import datetime
from hammock import Hammock
from eduid_webapp.letter_proofing.settings.common import LetterProofingConfig
__author__ = 'john'
class EkopostException(Exception):
pass
class Ekopost:
def __init__(self, config: LetterProofin... |
elysium001/zamboni | mkt/extensions/urls.py | from django.conf.urls import include, patterns, url
from rest_framework.routers import SimpleRouter
from rest_framework_nested.routers import NestedSimpleRouter
from mkt.extensions.views import (ExtensionSearchView, ExtensionVersionViewSet,
ExtensionViewSet,
... |
SasView/sasmodels | sasmodels/models/peak_lorentz.py | r"""
This model describes a Lorentzian shaped peak on a flat background.
Definition
----------
The scattering intensity $I(q)$ is calculated as
.. math::
I(q) = \frac{scale}{\bigl(1+\bigl(\frac{q-q_0}{B}\bigr)^2\bigr)} + background
with the peak having height of $I_0$ centered at $q_0$ and having
a HWHM (half-... |
macro/django-purls | purls/templatetags/purl_tags.py | import urlparse
from django.conf import settings
from django import template
from purls import serverring
register = template.Library()
def _make_server_mapper(from_domain, to_domains):
ring = serverring.ServerRing(nodes=to_domains)
def url_rewriter(url, domain):
new_domain = ring.get_node(url)
... |
ej2/pixelpuncher | pixelpuncher/npc/utils/relationships.py | from annoying.functions import get_object_or_None
from pixelpuncher.game.utils.game_settings import RELATIONSHIP_GOOD_POINTS, \
RELATIONSHIP_BEST_POINTS, RELATIONSHIP_BAD_POINTS, RELATIONSHIP_HORRIBLE_POINTS
from pixelpuncher.npc.models import NPCRelationship, RelationshipLevels
def adjust_relationship_score(rel... |
w495/python-video-shot-detector | shot_detector/filters/filter.py | # -*- coding: utf8 -*-
"""
This is part of shot detector.
Produced by w495 at 2017.05.04 04:18:27
"""
from __future__ import absolute_import, division, print_function
import logging
import operator
from shot_detector.filters.dsl import DslPlainFilter
from shot_detector.filters.util import BulkFilter
class ... |
VISTAS-IVES/pyvistas | source/vistas/ui/windows/main.py | import os
import wx
from PIL.Image import Image
from vistas.core.graphics.overlay import BasicOverlayButton
from vistas.core.paths import get_resource_bitmap, get_resources_directory
from vistas.core.plugins.visualization import EVT_VISUALIZATION_UPDATED
from vistas.core.utils import get_platform
from vistas.ui.contro... |
Rcio/NNCommandServer | src/NNTCPServer.py | import socket
import select
import errno
import NNLogger
import NNError
import traceback
class TCPConnectionHandle(object):
def __init__(self, socket, addr, port):
self.socket = socket
self.peerAddr = addr
self.peerPort = port
self.sendBuffer = ''
self.writable = Fa... |
vsajip/django | django/contrib/localflavor/si/forms.py | """
Slovenian specific form helpers.
"""
from __future__ import absolute_import, unicode_literals
import datetime
import re
from django.contrib.localflavor.si.si_postalcodes import SI_POSTALCODES_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields... |
JensRantil/cligh | cligh/config.py | import ConfigParser
import getpass
import os
from github import Github
from xdg import BaseDirectory
from . import utils
USERNAME = None
TOKEN = None
def get_username():
global USERNAME
return USERNAME
def get_token():
global TOKEN
return TOKEN
def get_config_dir():
"""Return the name of the directory containi... |
fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNovelswithyunBlogspotCom.py | def extractNovelswithyunBlogspotCom(item):
'''
Parser for 'novelswithyun.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Fierce Silk Flower', 'Fierce Silk Flower', ... |
BiaDarkia/scikit-learn | examples/plot_missing_values.py | """
====================================================
Imputing missing values before building an estimator
====================================================
Missing values can be replaced by the mean, the median or the most frequent
value using the basic ``SimpleImputer``.
The median is a more robust estimator f... |
DavidB-CMU/herbpy | examples/graspFuzeBottle.py | #!/usr/bin/env python
import herbpy
import os
import numpy
import math
import openravepy
import sys # exit()
# get the location of some objects (you'll need the pr_ordata package)
from catkin.find_in_workspaces import find_in_workspaces
package_name = 'pr_ordata'
directory = 'data/objects'
objects_path = find_in_work... |
mjamesruggiero/tripp | tests/test_knn.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from .context import tripp
from tripp import knn
import logging
logging.basicConfig(level=logging.INFO, format="%(lineno)d\t%(message)s")
class TestKnn(unittest.TestCase):
def setUp(self):
cities = [
(-86.75, 33.5666666666667, '... |
bitcraft/pyglet | pyglet/canvas/cocoa.py | """
"""
from ctypes import *
from ctypes import util
from pyglet import app
from .base import Display, Screen, ScreenMode, Canvas
from pyglet.libs.darwin.cocoapy import *
class CocoaDisplay(Display):
def get_screens(self):
max_displays = 256
active_displays = (CGDirectDisplayID * max_displays)... |
MeirKriheli/Open-Knesset | simple/parsers/utils/laws_parser_utils.py | # -*- coding: utf-8 -*
import re
def normalize_correction_title_dashes(raw_title):
"""returns s with normalized spaces before and after the dash"""
if not raw_title:
return None
m = re.match(r'(תיקון)( ?)(-)( ?)(.*)'.decode('utf8'), raw_title)
if not m:
return raw_title
return ' '.... |
CKehl/pylearn2 | pylearn2/datasets/experiment.py | """
.. todo::
WRITEME
"""
import os
import logging
import string
import numpy
#N = np = numpy
from theano.compat.six.moves import xrange
from pylearn2.datasets import cache, dense_design_matrix
from pylearn2.expr.preprocessing import global_contrast_normalize
from pylearn2.utils import contains_nan
from pylearn2... |
santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/numpy-1.0.4-py2.5-linux-x86_64.egg/numpy/f2py/lib/extgen/c_support.py |
__all__ = ['CLine', 'Keyword', 'CTypeSpec', 'CDeclarator', 'CDeclaration',
'CArgument', 'CCode', 'CFunction', 'CSource', 'CHeader', 'CStdHeader']
from base import Component
from utils import Line, Code, FileSource
class CLine(Line):
pass
class Keyword(CLine):
pass
class CInitExpr(CLine):
pas... |
mdalp/reportexport | reportexport/models.py | # -*- coding: utf-8 -*-
"""Report models."""
from __future__ import absolute_import, unicode_literals
import json
from cached_property import cached_property
from .extensions import db
# From Mike Bayer's "Building the app" talk
# https://speakerdeck.com/zzzeek/building-the-app
class SurrogatePK(object):
"""A mix... |
andyfaff/scipy | dev.py | #!/usr/bin/env python
"""
dev.py [OPTIONS] [-- ARGS]
Run tests, building the project first with Meson
Examples::
$ python dev.py
$ python dev.py -s {SAMPLE_SUBMODULE}
$ python dev.py -t {SAMPLE_TEST}
$ python dev.py --ipython
$ python dev.py --python somescript.py
$ python dev.py --bench
... |
lojack/wagtail | wagtail/wagtailsearch/backends/db.py | from django.db import models
from wagtail.wagtailsearch.backends.base import BaseSearch
from wagtail.wagtailsearch.indexed import Indexed
from wagtail.wagtailsearch.utils import normalise_query_string
class DBSearch(BaseSearch):
def __init__(self, params):
super(DBSearch, self).__init__(params)
def ... |
youtube/cobalt | third_party/proxy_py/tests.py | # -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
HTTP Proxy Server in Python.
:copyright: (c) 2013-2018 by Abhinav Singh.
:license: BSD, see LICENSE for more details.
"""
import sys
import base64
import socket
import logging
import unittest
from threading import Thread
from contextlib import closing
... |
jotes/pontoon | pontoon/base/adapter.py | import base64
import hashlib
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth.models import User
from django.utils.encoding import smart_bytes, smart_str
class PontoonSocialAdapter(DefaultSocialAccountAdapter):
def save_user(self, request, sociallogin, form=None):
... |
networkdynamics/zenlib | docs/technical/conf.py | # -*- coding: utf-8 -*-
#
# Zen Library Documentation documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 10 02:00:27 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogener... |
themaxx75/lapare-bijoux | lapare.ca/lapare/wsgi.py | """
WSGI config for lapare.ca project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
from os.path import abspath, dirname
from sys import path
SITE_ROOT = dirname(dirname... |
fwenzel/stapler | staplelib/tests.py | #!/usr/bin/env python
import os.path
import shutil
from subprocess import check_call
import tempfile
import unittest
from PyPDF2 import PdfFileReader
HERE = os.path.abspath(os.path.dirname(__file__))
TESTFILE_DIR = os.path.join(HERE, 'testfiles')
STAPLER = os.path.join(HERE, '..', 'stapler')
ONEPAGE_PDF = os.path.j... |
zygmuntz/pybrain | pybrain/supervised/trainers/backprop.py | from __future__ import print_function
__author__ = 'Daan Wierstra and Tom Schaul'
from scipy import dot, argmax
from random import shuffle
from math import isnan, sqrt
from pybrain.supervised.trainers.trainer import Trainer
from pybrain.utilities import fListToString
from pybrain.auxiliary import GradientDescent
from... |
desihub/desisim | py/desisim/test/test_io.py | import unittest, os
from uuid import uuid1
from shutil import rmtree
import numpy as np
import desisim
from desisim import io
from astropy.io import fits
desimodel_data_available = 'DESIMODEL' in os.environ
desi_templates_available = 'DESI_ROOT' in os.environ
desi_basis_templates_available = 'DESI_BASIS_TEMPLATES' i... |
fulfilio/trytond-product-notebook | tests/test_views_depends.py | # -*- coding: utf-8 -*-
"""
tests/test_views_depends.py
"""
import sys
import os
DIR = os.path.abspath(os.path.normpath(os.path.join(
__file__, '..', '..', '..', '..', '..', 'trytond'
)))
if os.path.isdir(DIR):
sys.path.insert(0, os.path.dirname(DIR))
import unittest
import trytond.tests.test_tryton
from ... |
wylieswanson/agilepyfs | fs/tests/test_wrapfs.py | """
fs.tests.test_wrapfs: testcases for FS wrapper implementations
"""
import unittest
from fs.tests import FSTestCases, ThreadingTestCases
import os
import sys
import shutil
import tempfile
from fs import osfs
from fs.errors import *
from fs.path import *
from fs import wrapfs
import six
from six import PY3,... |
liesbethvanherpe/NeuroM | neurom/core/types.py | # Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... |
cancerregulome/inspectra | python/fiedler.py | #!/usr/bin/env python
# Copyright (c) 2012, the GraphSpectrometer Contributors listed at
# http://github.com/ryanbressler/GraphSpectrometer/graphs/contributors
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... |
shackra/thomas-aquinas | summa/audio/vector.py | """
Binding for the CSFML Vector2x structures.
"""
##########################################################################################
#============================== standard library imports ================================#
######################################################################################... |
xiaojunwu/crosswalk-test-suite | webapi/tct-notification-tizen-tests/inst.wgt.py | #!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=u... |
justinvanwinkle/wextracto | tests/test_ftp.py | from wex.url import URL
expected_lines = [
b"FTP/1.0 200 OK\r\n",
b"X-wex-url: ftp://anonymous:me@ftp.kernel.org/pub/site/README\r\n",
b"\r\n",
b"This directory contains files related to the operation of the\n",
]
expected_content = b''.join(expected_lines)
url = 'ftp://anonymous:me@ftp.kernel.org/pub... |
kobiluria/openbudgets | openbudgets/apps/transport/incoming/parsers/sheet.py | from copy import deepcopy
from datetime import datetime
from django.utils.translation import ugettext as _
from openbudgets.apps.sheets.models import Template, Sheet, SheetItem
from openbudgets.apps.entities.models import Entity
from openbudgets.apps.international.utilities import translated_fields
from openbudgets.app... |
Neurita/cajal | cajal/nifti.py | # coding=utf-8
#-------------------------------------------------------------------------------
#Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
#Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
#Universidad del Pais Vasco UPV/EHU
#
#2013, Alexandre Manhaes Savio
#Use this at your own risk!
#-----------... |
fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractPigcowTranslationsCom.py | def extractPigcowTranslationsCom(item):
'''
Parser for 'pigcow-translations.com'
'''
badwords = [
'Learn Japanese',
'Learn Japanese Level 1',
'Interviews',
]
if any([bad in item['tags'] for bad in badwords]):
return None
titlestr = item['title'] + " ".join(item['tags'])
vol, chp, frag, postfix = e... |
canvasnetworks/canvas | website/drawquest/apps/drawquest_auth/models.py | import httplib
import socket
import string
import urllib2
from cachecow.cache import invalidate_namespace
from django.conf import settings
from django.db import models
from django.db.models import signals
from facebook import GraphAPI, GraphAPIError
from canvas import json
from canvas.exceptions import ServiceError
f... |
python-hospital/hospital | hospital/wsgi.py | # -*- coding: utf-8 -*-
"""WSGI utilities to collect and run healthchecks as web service.
.. warning::
Implementation is not mature, i.e. this part of hospital API may change
in future releases. That said, it does the job ;)
"""
import json
import unittest
from wsgiref.simple_server import make_server
from ho... |
villalonreina/dipy | doc/examples/viz_ui.py | import numpy as np
from dipy.data import read_viz_icons
# Conditional import machinery for vtk.
from dipy.utils.optpkg import optional_package
# Allow import, but disable doctests if we don't have vtk.
from dipy.viz import ui, window
vtk, have_vtk, setup_module = optional_package('vtk')
if have_vtk:
vtkInterac... |
rafal-jaworski/bazaNGObackend | src/bazango/contrib/organization/migrations/0008_auto_20170909_0707.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-09 05:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization', '0007_auto_20170909_0704'),
]
operations = [
migrations.AddF... |
wdv4758h/ZipPy | lib-python/3/importlib/test/extension/util.py | import imp
import os
import sys
import unittest
PATH = None
EXT = None
FILENAME = None
NAME = '_testcapi'
_file_exts = [x[0] for x in imp.get_suffixes() if x[2] == imp.C_EXTENSION]
try:
for PATH in sys.path:
for EXT in _file_exts:
FILENAME = NAME + EXT
FILEPATH = os.path.join(PATH, ... |
dbaty/deform_ext_autocomplete | tests/test_includeme.py | import deform
from pkg_resources import resource_filename
from pyramid.config import Configurator
import deform_ext_autocomplete
def test_basics():
config = Configurator()
deform_ext_autocomplete.includeme(config)
search_path = deform.Form.default_renderer.loader.search_path
our_path = resource_file... |
solos/pylons | tests/test_webapps/filestotest/base_with_xmlrpc.py | from pylons import c, g, cache, request, session
from pylons.controllers import WSGIController, XMLRPCController
from pylons.controllers.util import abort, redirect_to, etag_cache
from pylons.decorators import jsonify, validate
from pylons.templating import render, render_response
from pylons.i18n import N_, _, ungette... |
drawquest/drawquest-web | website/canvas/migrations/0175_add_multi_col_visibility_id_index.py | # -*- 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):
db.execute("create index canvas_comment_id_and_visibility on canvas_comment (id, visibility);")
def backwards(s... |
praekelt/vumi-go | go/api/go_api/tests/test_client.py | import json
from mock import patch
from go.vumitools.tests.helpers import djangotest_imports
with djangotest_imports(globals()):
from django.conf import settings
from go.api.go_api import client
from go.base.tests.helpers import GoDjangoTestCase
class TestClient(GoDjangoTestCase):
@patch('requests... |
matagus/django-generic-links | generic_links/forms.py | # -*- coding: UTF-8 -*-
from django import forms
from generic_links.models import GenericLink
class AddLinkForm(forms.ModelForm):
class Meta:
model = GenericLink
fields = ("title", "url", "description", "is_external")
def __init__(self, user, content_type, object_id, *args, **kwargs):
... |
Kroisse/flask-factory | flask_factory/utils.py | from __future__ import absolute_import
from importlib import import_module
import pkgutil
NotFound = type('NotFound', (object,), {})()
def import_string(import_name, package=None, default=NotFound):
try:
module_name, object_name = import_name.split(':', 1)
except ValueError:
module_name = im... |
periscope-ps/unis | periscope/handlers/mainhandler.py | # =============================================================================
# periscope-ps (unis)
#
# Copyright (c) 2012-2016, Trustees of Indiana University,
# All rights reserved.
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# T... |
Pawamoy/keycut | scripts/update_changelog.py | """Insert the new version changes in the changelog."""
import re
import sys
from typing import List, Optional, Pattern
import httpx
from git_changelog.build import Changelog, Version
from jinja2.sandbox import SandboxedEnvironment
TEMPLATE_URL = "https://raw.githubusercontent.com/pawamoy/jinja-templates/master/keepa... |
flyfj/deepmodels | deepmodels/tf/core/dm_models/dm_inception_resnet.py | """Inception Resnet models.
"""
import os
from deepmodels.tf.core import commons
from deepmodels.tf.core.dm_models import common as model_common
from deepmodels.shared.tools import data_manager
from deepmodels.tf.models import net_downloader_tf
class InceptionResNetDM(model_common.NetworkDM):
"""Inception resnet ... |
siggame/Joueur.py | joueur/base_game_object.py | from joueur.delta_mergeable import DeltaMergeable
# the base class that every game object within a game inherit from for Python
# manipulation that would be redundant via Creer
class BaseGameObject(DeltaMergeable):
def __init__(self):
DeltaMergeable.__init__(self)
def __str__(self):
return "{... |
mattpap/py2js | tests/test_compile_js.py | """
This test only tests that Python code can be compiled using the py2js.
It doesn't test if the resulting javascript makes any sense.
"""
def is_on_the_left(c, a, b, pts_list):
ax, ay = pts_list[a]
bx, by = pts_list[b]
cx, cy = pts_list[c]
ux = float(bx - ax)
uy = float(by - ay)
vx = float(cx - ax... |
APICloud-com/python-sdk | testStatistics.py | # -*- coding: UTF-8 -*-
import sys
from statistic import Statistics, Push
reload(sys)
sys.setdefaultencoding( "utf-8" )
############Statistics test#######################
# statistic_cloud = Statistics('A6965066952332','62587239-AD3C-8190-47B4-37DE080D7E9D')
# print 'config content is:'
# print statistic_cloud.print... |
Amber-Creative/amber-frappe | frappe/core/report/permitted_documents_for_user/permitted_documents_for_user.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, throw
import frappe.utils.user
from frappe.permissions import check_admin_or_system_manager
from frappe.model.db_schema import type_map
def ex... |
brain-research/mirage-rl-qprop | rllab/exploration_strategies/ou_strategy.py | from rllab.misc.overrides import overrides
from rllab.misc.ext import AttrDict
from rllab.core.serializable import Serializable
from rllab.spaces.box import Box
from rllab.exploration_strategies.base import ExplorationStrategy
import numpy as np
import numpy.random as nr
class OUStrategy(ExplorationStrategy, Serializ... |
skdaccess/skdaccess | skdaccess/engineering/la/generic/stream.py | # The MIT License (MIT)
# Copyright (c) 2018 Massachusetts Institute of Technology
#
# Author: Cody Rude
# This software has been created in projects supported by the US National
# Science Foundation and NASA (PI: Pankratius)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sof... |
pindex/ppm | ppm/main.py | #!/usr/bin/python
import argparse
import os
from distutils.version import StrictVersion
import utility
from config import REQDEPS_FILE_PATH, DEPSINSTALL_DIR_PATH, CURRENTDEPS_FILE_PATH, GENERATED_ENVIRONMENT_PATH
from registryclient import RegistryClient
from repositoryclient import RepositoryClient
from dependencyman... |
normanjaeckel/Homepage-2015 | esg_leipzig_homepage_2015/admin.py | from datetime import timedelta
from django import forms
from django.contrib import admin
from django.contrib.auth.models import Group
from django.utils import timezone
from django.utils.translation import ugettext_lazy
from .models import Event, FlatPage, LinkToFlatPage, MediaFile, News
class ComingEventsFilter(adm... |
ubuntuvim/GoAgent | local/gevent-1.0rc2/greentest/lock_tests.py | """
Various tests for synchronization primitives.
"""
from __future__ import with_statement
import sys
import time
from thread import start_new_thread, get_ident
import threading
import unittest
from test import test_support as support
def _wait():
# A crude wait/yield function not relying on synchronization pr... |
matplotlib/basemap | examples/simpletest.py | from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# read in topo data (on a regular lat/lon grid)
etopo=np.loadtxt('etopo20data.gz')
lons=np.loadtxt('etopo20lons.gz')
lats=np.loadtxt('etopo20lats.gz')
# create ... |
THEMVFFINMAN/Python-Games | Codingame.com/chucknorris.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
message = input()
binaries = []
for ch in message:
binaries.append(bin(ord(ch))[2:].zfill(7))
stringer = ""
zero = False
one = False
for binary in binaries:
for char in bina... |
jigarkb/CTCI | LeetCode/345-E-ReverseVowelsOfAString.py | # Write a function that takes a string as input and reverse only the vowels of a string.
#
# Example 1:
# Given s = "hello", return "holle".
#
# Example 2:
# Given s = "leetcode", return "leotcede".
#
# Note:
# The vowels does not include the letter "y".
class Solution(object):
def reverseVowels(self, s):
... |
demisto/content | Packs/Campaign/Scripts/SplitCampaignContext/SplitCampaignContext_test.py | import pytest
import SplitCampaignContext
CONTEXT_EXAMPLE = [
{
"emailfrom": "example@example.com",
"emailfromdomain": "example.com",
"id": "1",
"name": "example1",
"occurred": "2021-07-15T11:24:46.869394623Z",
"recipients": [
"victim-test2@demistodev.onm... |
Distrotech/scons | build/scons/engine/SCons/Tool/mssdk.py | #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# 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, incl... |
moyogo/pysilfont | examples/fontforge-old/FFlistRefNum.py | #!/usr/bin/env python
'FontForge: Report Glyph name, Number of references (components)'
__url__ = 'http://github.com/silnrsi/pysilfont'
__copyright__ = 'Copyright (c) 2015 SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__ = 'David Raym... |
MrCreosote/workspace_deluxe | performance/us/kbase/workspace/performance/workspace/get_from_shock.py | #!/usr/bin/env python
import requests
import time
import sys
import os
from pymongo.mongo_client import MongoClient
import subprocess
MONGO_DB = 'ws_test'
SHOCK_HOST = 'http://localhost:7044'
def main():
token = sys.argv[1]
use_curl = len(sys.argv) > 2
if not token:
raise ValueError('no token')
... |
erdc-cm/air-water-vv | 3d/floating_bar_scorec/dissipation_n.py | from proteus import *
from dissipation_p import *
timeIntegration = BackwardEuler_cfl
stepController = Min_dt_cfl_controller
femSpaces = {0:basis}
massLumping = False
numericalFluxType = Dissipation.NumericalFlux
conservativeFlux = None
subgridError = Dissipation.SubgridError(coefficients=coefficients,n... |
LaunchKey/launchkey-python | features/steps/managers/kobiton_manager.py | import requests
from time import sleep
class Version:
def __init__(self, id, state=None, version=None, native_properties=None, latest=None):
"""
Kobiton App Version.
Note that no values are required based on the spec so any value can
default to None.
See: See: https://api... |
pennersr/django-allauth | allauth/socialaccount/providers/zoom/views.py | import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider import ZoomProvider
class ZoomOAuth2Adapter(OAuth2Adapter):
provider_id = ZoomProvider.id
access_token_url = "https://zoom.us/oauth/token"
authorize... |
johnny-die-tulpe/illuminati | sauron/utils/__init__.py | #! /usr/bin/env python
#
# Copyright (c) 2015 johnny-die-tulpe
#
# 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 limitation the rights to use, copy,... |
andredias/nikola | nikola/filters.py | # -*- coding: utf-8 -*-
# Copyright © 2012-2017 Roberto Alsina and others.
# 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 limitation
# the rights t... |
CentralLabFacilities/m3meka | python/scripts/demo/m3_demo_trajectories.py | #! /usr/bin/python
#Copyright 2010, Meka Robotics
#All rights reserved.
#http://mekabot.com
#Redistribution and use in source and binary forms, with or without
#modification, are permitted.
#THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDI... |
slideclick/shadowsocks-gtk | shadowsocks_gtk/utils.py | # Copyright (c) 2014 apporc
#
# 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 limitation the rights
# to use, copy, modify, merge, publish, distribute, ... |
lmazuel/azure-sdk-for-python | azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/operation.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
palashahuja/pgmpy | pgmpy/tests/test_readwrite/test_ProbModelXML.py | #!/usr/bin/env python
import unittest
from io import StringIO
import networkx as nx
import numpy as np
from pgmpy.readwrite import ProbModelXMLReader, ProbModelXMLWriter, get_probmodel_data
from pgmpy.models import BayesianModel
from pgmpy.factors import TabularCPD
import numpy.testing as np_test
import warnings
import... |
dbcollection/dbcollection | tests/utils/test_hdf5.py | """
Test the HDF5 metadata manager class.
"""
import os
import numpy as np
import pytest
from dbcollection.utils.hdf5 import HDF5Manager
@pytest.fixture()
def test_data():
return {
"filename": '/path/to/filename.h5'
}
@pytest.fixture()
def mock_hdf5manager(mocker, test_data):
mocker.patch.obj... |
schreiberx/sweet | benchmarks_sphere/uq_galewsky_mac_cluster/postprocessing_output_h.py | #! /usr/bin/env python3
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import re
from matplotlib.lines import Line2D
#
# First, use
# ./postprocessing.py > postprocessing_output.txt
# to generate the .txt file
#
fig, ax = plt.subplots(figsize=(10,7))
ax.set_xscale("log", nonpo... |
schlos/eden | modules/templates/RW/config.py | # -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from gluon import current
from gluon.html import A, URL, TR, TD
from gluon.storage import Storage
from s3 import s3_fullname, S3Represent, S... |
atyenoria/platformio | platformio/builder/scripts/ststm32.py | # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
"""
Builder for ST STM32 Series ARM microcontrollers.
"""
import platform
from os.path import isfile, join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, Exit, SConscript... |
landportal/landbook-importers | old-importers/RAWImporter/es/weso/raw/ExcelManagement/excel_reader.py | '''
Created on Apr 21, 2014
@author: Borja
'''
import os.path
import xlrd
import __data__
class XslReader(object):
def __init__(self):
if not os.path.exists(__data__.path()):
os.makedirs(__data__.path())
self._data_path = __data__.path();
def load_ind... |
amymok/owning-a-home-api | setup.py | import os
from setuptools import setup, find_packages
def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except IOError:
return ''
setup(
name='ow... |
pablooliveira/ask | tests/test-0000-driver.py | # Copyright (c) 2011-2012, Universite de Versailles St-Quentin-en-Yvelines
#
# This file is part of ASK. ASK is free software: you can redistribute
# it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the h... |
repotvsupertuga/tvsupertuga.repository | script.module.live.sports/resources/lib/cfdeco7.py | import logging, random, time, re
'''''''''
Disables InsecureRequestWarning: Unverified HTTPS request is being made warnings.
'''''''''
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
''''''
from requests.sessions ... |
luisivan/QtOctave | xmlwidget/examples/python/xrcs/xrcs.py | #!/usr/bin/python
# -*- coding: utf8 -*-
#/* Copyright (C) 2007 P.L. Lucas
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation; either version 2 of the License, or
#* (at your option) any... |
chen0031/rekall | rekall-core/rekall/plugins/renderers/linux.py | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later ver... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.