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/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia_ | Code/Python/Apps/FileProcessor/App/BatchFileProcessor.py | Python | apache-2.0 | 8,474 |
from unittest import TestCase
import boto3
from botocore.exceptions import NoRegionError
from aq import BotoSqliteEngine
from aq.engines import get_resource_model_attributes
import os, tempfile
from nose.tools import eq_
class TestCommandLineArg(TestCase):
def setUp(self):
try:
del os.envir... | lebinh/aq | tests/test_command_line_arg.py | Python | mit | 2,606 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016 F5 Networks Inc.
#
# 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
# ... | mcgonagle/ansible_f5 | library_old/bigip_device_ntp.py | Python | apache-2.0 | 7,840 |
#! /usr/bin/env python
#PyInvaders2 (c) 2018 by Karsten Lehmann
###############################################################################
# #
# This file is a part of PyInvaders2 #
# ... | kalehmann/PyInvaders2 | pyinvaders2/level_creator.py | Python | gpl-3.0 | 8,701 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
filament_watch_uc.py
Interface to microcontroller connected to encoder
"""
##############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Richard L. Lynch <rich@richlynch.com>
#
# Permission is hereby g... | rllynch/filament_watch | filament_watch/microcontroller_if.py | Python | mit | 3,107 |
from django.shortcuts import render
from .forms import SearchForm, ClassifyForm
from whoosh.qparser import MultifieldParser, QueryParser
from whoosh import index as i
from whoosh import scoring
import whoosh.query as QRY
import time
import pandas as pd
from datetime import datetime
from indexing.crawl import crawl_and_... | BhavyaLight/information-retrival-search-engine | informationRetrival/frontend/views.py | Python | mit | 6,155 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-06-16 12:12
from __future__ import unicode_literals
import autoslug.fields
from django.db import migrations
import webconference.models
class Migration(migrations.Migration):
dependencies = [
('webconference', '0003_auto_20170323_1535'),
... | amadeusproject/amadeuslms | webconference/migrations/0004_webconference_jitsi_slug.py | Python | gpl-2.0 | 641 |
# encoding: UTF-8
'''
风控模块相关的GUI控制组件
'''
from vnpy.trader.app.riskManager.language import text
from vnpy.trader.uiBasicWidget import QtWidgets
########################################################################
class RmSpinBox(QtWidgets.QSpinBox):
"""调整参数用的数值框"""
#-------------------------------------... | cmbclh/vnpy1.7 | vnpy/trader/app/riskManager/uiRmWidget.py | Python | mit | 5,492 |
import java_lang_System
import java_lang_Object
import java_lang_Class
import java_lang_Float
import java_lang_String
import java_lang_Throwable
import java_lang_Double
import java_lang_Thread
import java_lang_Runtime
import java_security_AccessController
import sun_misc_VM
import sun_misc_Unsafe
import sun_reflect_Ref... | MrHamdulay/myjvm | klasses/__init__.py | Python | mit | 1,010 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
#
# 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
#
# Unle... | derekchiang/keystone | keystone/token/backends/memcache.py | Python | apache-2.0 | 9,447 |
import requests
from requests_oauthlib import OAuth1
from . import __version__
from .compat import json, parse_qsl, urlencode, urlparse
from .exceptions import TumblpyAuthError, TumblpyError
from .helpers import _split_params_and_files
class Tumblpy(object):
def __init__(self, app_key=None, app_secret=None, oaut... | michaelhelmick/python-tumblpy | tumblpy/api.py | Python | bsd-2-clause | 9,263 |
# setTexture.py
#
# Copyright (c) 2009 Javier Romero
#
# Author: Javier Romero <jrgn@kth.se>
#
# 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 ... | libicocco/poser-hand-generator | setTexture.py | Python | gpl-2.0 | 1,394 |
#!/usr/bin/python
#
# 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 b... | caioserra/apiAdwords | examples/adspygoogle/dfp/v201311/contact_service/create_contacts.py | Python | apache-2.0 | 2,467 |
# -------------------------------------------------------------
#
# 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 unde... | apache/incubator-systemml | src/main/python/systemds/operator/algorithm/builtin/scale.py | Python | apache-2.0 | 1,766 |
from .data_asset import DataAsset
from .file_data_asset import FileDataAsset
| great-expectations/great_expectations | great_expectations/data_asset/__init__.py | Python | apache-2.0 | 77 |
{
'name' : 'Improvements for mass mailing',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category' : 'Mail',
'website' : 'https://yelizariev.github.io',
'description': """
Modules adds:
* partners info in mail.mail.statistics tree
* partners info ... | ufaks/addons-yelizariev | mass_mailing_extra/__openerp__.py | Python | lgpl-3.0 | 519 |
import time
import json
import sys
import yaml
import MySQLdb
import pickle
import dbcrawler_util as util
from collections import defaultdict
from bs4 import BeautifulSoup
from urllib2 import urlopen
from datetime import datetime
def main(argv):
'''
arg[1]: outDir
arg[2:]: seedPlantListFPaths, e.g. ijah_ja... | tttor/csipb-jamu-prj | database/crawler/crawl_knapsack.py | Python | mit | 3,107 |
__a, _A__a, _B__a, __b, _A__b, _B__b, __c, _A__c, _B__c = 0, 1, 2, 3, 4, 5, 6, 7, 8
print __a, _A__a, _B__a, __b, _A__b, _B__b, __c, _A__c, _B__c
class A(object):
__a = 9
print __a, _A__a, _B__a, __b, _A__b, _B__b, __c, _A__c, _B__c
def f(self):
print __a, _A__a, _B__a, __b, _A__b, _B__b, __c, _A__c... | csvoss/onelinerizer | tests/mangle.py | Python | mit | 552 |
from sop_embed.da import DenoisingAutoencoder
from sop_embed.tools import NonLinearity
from sop_embed.tools import CostType
from sop_embed.tools import ModelMLP
from sop_embed.tools import train_one_epoch_chuncks
from sop_embed.tools import theano_fns
from sop_embed.tools import sharedX_value
from sop_embed.tools impor... | sbelharbi/structured-output-ae | sop_embed/experiments/lfpw_4l_in_out.py | Python | lgpl-3.0 | 15,118 |
#!/usr/bin/env python
# encoding: utf-8
"""Implements a container for parsed snippets."""
class SnippetDictionary(object):
"""See module docstring."""
def __init__(self):
self._snippets = []
self._cleared = {}
self._clear_priority = float("-inf")
def add_snippet(self, snippet):
... | linkinpark342/ultisnips | pythonx/UltiSnips/snippet/source/_snippet_dictionary.py | Python | gpl-3.0 | 1,399 |
from unittest import TestCase, main
from skbio.util import get_data_path
from microprot.scripts.split_search import (mask_sequence,
parse_pdb_match,
_parse_hit_block)
class ParsersTests(TestCase):
def setUp(self):
se... | biocore/microprot | microprot/tests/test_split_search_parseerror.py | Python | bsd-3-clause | 1,539 |
#!usr/bin/env python
import sys
import os
import itertools
from itertools import izip
#import matplotlib.pyplot as plt
from Bio import SeqIO
import scipy as np
from scipy import median, mean
from scipy.optimize import curve_fit
from scipy.stats.distributions import t
from struct import pack
from random import shuffle, ... | Rinoahu/fastclust | deprecate/py27/scripts/deprecate/pangenome.py | Python | gpl-3.0 | 11,736 |
import calendar
from collections import OrderedDict
from datetime import datetime
import fauxfactory
import pytest
from humanfriendly import parse_size
from humanfriendly import tokenize
from cfme import test_requirements
from cfme.containers.provider import ContainersProvider
from cfme.intelligence.chargeback import... | izapolsk/integration_tests | cfme/tests/containers/test_chargeback.py | Python | gpl-2.0 | 14,502 |
# -*- coding: utf-8 -*-
# Copyright 2022 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_trial_sync.py | Python | apache-2.0 | 1,389 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/root/package.py | Python | lgpl-2.1 | 4,028 |
# 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, software
# d... | openstack/smaug | karbor/tests/unit/common/test_karbor_keystone_plugin.py | Python | apache-2.0 | 1,967 |
from flask import Flask
from flaskext.cache import Cache
from flaskext.mongokit import BSONObjectIdConverter
from werkzeug.routing import BaseConverter
import settings
app = Flask(__name__)
app.config.from_object('woerterbuch.settings')
app.secret_key = settings.SECRET_KEY
## Hook up custom URL converters.
class Re... | fwenzel/strassendeutsch | woerterbuch/__init__.py | Python | gpl-3.0 | 739 |
"""
Django settings for flocs project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import dj_data... | effa/flocs | flocs/settings.py | Python | gpl-2.0 | 8,803 |
# Copyright (C) 2014-2015 Kate Cook
#
# This file is part of rnascan.
#
# rnascan 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, or
# (at your option) any later versio... | cookkate/rnascan | rnascan/average_structure.py | Python | agpl-3.0 | 6,283 |
#!/usr/bin/env python
# vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import os
from test import prompty
from test import UnitTestWrapper
class My... | ltn100/prompty | test/test_functionContainer.py | Python | mit | 1,265 |
# Copyright (c) 2014 Dell Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Hybrid-Cloud/cinder | cinder/tests/unit/volume/drivers/dell/test_dellfc.py | Python | apache-2.0 | 45,305 |
from django.contrib.auth.models import User
from django.test import TestCase
from ESSArch_Core.auth.models import Group, GroupType
class CurrentOrganizationTests(TestCase):
def setUp(self):
self.user = User.objects.create(username="admin")
self.member = self.user.essauth_member
self.org_g... | ESSolutions/ESSArch_Core | ESSArch_Core/auth/tests/test_signals.py | Python | gpl-3.0 | 1,852 |
from typing import List, Optional
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: Optional[str] = None
description: Optional[str] = None
price: Optional[float] = None
tax: float = 10.5
tags: Lis... | tiangolo/fastapi | docs_src/body_updates/tutorial002.py | Python | mit | 1,054 |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | SVilgelm/CloudFerry | cloudferry/cloud/os2os.py | Python | apache-2.0 | 3,746 |
#!/usr/bin/env python3
from paramecio.citoplasma.keyutils import create_key_encrypt, create_key_encrypt_256, create_key
from oslo_concurrency import lockutils
try:
from settings import config
except:
class config:
cookie_name='paramecio.session'
key_encrypt=create_key_encrypt_256(30)
... | paramecio/parameciofm | paramecio/citoplasma/sessions.py | Python | gpl-3.0 | 6,082 |
#!/usr/bin/env python2
"""Script to do basic sanity checking for target_link_libraries() commands in
CMakeLists.txt files.
Scans C++ sources specified in add_library() commands for includes that look
like they are in the Quickstep source tree, then makes sure that the
corresponding libraries appear in the target_link... | pivotalsoftware/quickstep | validate_cmakelists.py | Python | apache-2.0 | 23,918 |
# Copyright 2012 OpenStack Foundation
#
# 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... | jumpstarter-io/keystone | keystone/token/persistence/core.py | Python | apache-2.0 | 13,981 |
def quicksort(unsorted_list):
if len(unsorted_list) < 1:
return unsorted_list
else:
pivot = unsorted_list[-1]
pivot_list = [pivot] #using pivot_list should help with quicksort's difficulties with repeating elements
left_partition = []
right_partition = []
for i... | markableidinger/sorting | quicksort.py | Python | mit | 1,291 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: mail
type: notification
short_d... | vmindru/ansible | lib/ansible/plugins/callback/mail.py | Python | gpl-3.0 | 8,479 |
__author__ = 'Dani'
from wikidata_exp.wdexp.communications.input.wikidata.interfaces import IdTracker
from decimal import *
class Json01IdsParser(IdTracker):
"""
FORMAT JSON01:
Summary: It consist of a dict with a depth of 1. The keys are wikidata IDs
and the values of those keys are nu... | DaniFdezAlvarez/wikidataExplorer | wikidata_exp/wdexp/communications/input/wikidata/json01_ids_parser.py | Python | gpl-2.0 | 2,122 |
'''
This bottle-cql plugin allows for the passing of Cassandra Connection pools
around your application
The plugin inject an argument to all route callbacks that require a `db`
keyword.
Usage Example::
import bottle
from bottle import HTTPError
from bottle.ext import cql as bottle_cql
import cql
... | EmergingThreats/bottle-cql | bottle_cql.py | Python | mit | 2,951 |
import os
from config import Package
from libXML2 import libXML2
from MPI import MPI
from pcu import pcu
class StGermain(Package):
def setup_dependencies(self):
self.mpi = self.add_dependency(MPI, required=True)
self.libxml2 = self.add_dependency(libXML2, required=True)
self.pcu = self.add... | geodynamics/gale | config/packages/StGermain.py | Python | gpl-2.0 | 735 |
# encoding: 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 'ParameterMapping'
db.create_table('lizard_wbconfiguration_parametermapping', (
... | lizardsystem/lizard-wbconfiguration | lizard_wbconfiguration/migrations/0001_initial.py | Python | gpl-3.0 | 54,331 |
#!/usr/bin/env python
from itertools import count
from nodes import Node
#Modulo
#Every
#Indexes
class Mod(Node):
char = "%"
args = 2
results = 1
contents = ["Padding", 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
@Node.test_func([2,3], [2])
@Node.test_func([6,5], [1])
def modulo... | muddyfish/PYKE | node/mod.py | Python | mit | 1,106 |
from switchboard.module import SwitchboardModule
@SwitchboardModule(
inputs=['client1.input.i'], # We have one input...
outputs={'client2.output.o':555}) # ...and one output that is set to 555 in case of error
def module(inp, out): # The 'inp' arg maps to 'input.i' whil... | josefschneider/switchboard | examples/simple_counters/test_module.py | Python | mit | 394 |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import report
from . import wizard
| OCA/account-financial-reporting | partner_statement/__init__.py | Python | agpl-3.0 | 113 |
"""Retrieve As information out of GeoIP (MaxMind) binding.
Beware: database location is hardcoded!"""
import GeoIP
import re
import numpy as np
import INDEX_VALUES
#WARNING: hard coded
GAS=GeoIP.open('/home/louis/streaming/flows/AS/GeoIPASNum.dat',
GeoIP.GEOIP_STANDARD)
#ugly but more efficient: compile only... | LouisPlisso/analysis_tools | add_ASN_geoip.py | Python | gpl-3.0 | 2,116 |
# Copyright 2010-2011 Dusty Phillips
# This file is part of Prickle.
# Prickle 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, or (at your option) any later version.... | buchuki/prickle | prickle/controllers/projects.py | Python | agpl-3.0 | 2,138 |
import pandas
class StateCollectionFactory(object):
"""
Factory class that builds a StateCollection.
Attributes
----------
state_list : list
The states in the model.
state_id_list : list
The identifier strings for each state.
"""
def __init__(self):
super(StateC... | milapour/palm | palm/state_collection.py | Python | bsd-2-clause | 4,073 |
import csv
import xml.etree.ElementTree as ET
import argparse
from collections import defaultdict
# Extracts questions, PAUs from Ground Truth Snapshot XML and creates a CSV file for NLC training purposes
# Pre-Requisite : The XML must be exported from WEA ExperienceManager using the GroundTruthSnapshot export option
#... | mkaufmann1/Lightning | python/extract.py | Python | apache-2.0 | 4,532 |
#-------------------------------------------------------------------------------
# Name: lineFollower.py
# Purpose: Use line follower sensors for FortiTo's BuzzBot
# Author: Anasol Pena-Rios
# Created: 19/02/2014
# Copyright: (c) FortiTo 2014
# Version: 1.0
#----------------------... | prlosana/BuzzBoards | lineFollower.py | Python | agpl-3.0 | 2,633 |
import pytest
import dill
import os
from backports.tempfile import TemporaryDirectory
from velox.obj import VeloxObject, register_object
from velox.lite import save_object, load_object
from velox.exceptions import VeloxConstraintError
from sklearn.linear_model import SGDClassifier
from sklearn.datasets import make_blo... | lukedeo/Velox | test/test_lite.py | Python | apache-2.0 | 5,048 |
def extractDevastatranslationsWordpressCom(item):
'''
Parser for 'devastatranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'tra... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractDevastatranslationsWordpressCom.py | Python | bsd-3-clause | 578 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
class BaseC... | superdesk/superdesk-core | apps/common/components/base_component.py | Python | agpl-3.0 | 653 |
__author__ = 'tonycastronova'
"""
Standard classes
"""
# On OSX you also need to install geos. e.g, sudo port install geos
import datetime
import hashlib
import uuid
from bisect import bisect_left, bisect_right
import numpy
from osgeo import osr, ogr
from emitLogging import elog
from sprint import *
class Statu... | Castronova/EMIT | stdlib.py | Python | gpl-2.0 | 21,220 |
"""Support for Obihai Sensors."""
from datetime import timedelta
import logging
from pyobihai import PyObihai
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_USERNAME,
DEVICE_CLASS_TIMESTAMP,
)
import... | tchellomello/home-assistant | homeassistant/components/obihai/sensor.py | Python | apache-2.0 | 4,124 |
'''
the following import is only necessary because eip.py is not in this directory
'''
import sys
sys.path.append('..')
'''
Set the PLC clock
Sets the PLC clock to the same time as your computer
'''
from pylogix import PLC
with PLC() as comm:
comm.IPAddress = '192.168.1.9'
comm.SetPLCTime()
| dmroeder/pylogix | examples/22_set_plc_clock.py | Python | apache-2.0 | 304 |
import _plotly_utils.basevalidators
class YanchorValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="yanchor", parent_name="layout.xaxis.rangeselector", **kwargs
):
super(YanchorValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/xaxis/rangeselector/_yanchor.py | Python | mit | 556 |
#!/usr/bin/env python
"""
Example 2.3.2: Symbolic differentiation
"""
def deriv(exp, var):
if is_const(exp, var):
return 0
if is_var(exp, var):
return 1
if isinstance(exp, Sum):
return Sum(
deriv(exp.left, var),
deriv(exp.right, var))
if isinsta... | blazk/sicp | ch2_building_abstractions_with_data/examples/2.3.2_symb_diff.py | Python | gpl-2.0 | 3,150 |
# -*- coding: utf-8 -*-
from operator import itemgetter
import time
from openerp import api, fields, models, _
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.exceptions import ValidationError
class AccountFiscalPosition(models.Model):
_name = 'account.fiscal.position'
_description = '... | aifil/odoo | addons/account/models/partner.py | Python | gpl-3.0 | 22,008 |
"""Box node for use in geometry attribute of Shapes"""
from vrml import cache
from OpenGLContext.arrays import array
from OpenGL.arrays import vbo
from OpenGL.GL import *
from vrml.vrml97 import basenodes
from vrml import protofunctions
class Box( basenodes.Box ):
"""Simple Box object of given size centered about ... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGLContext/scenegraph/box.py | Python | lgpl-3.0 | 5,301 |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer.functions.activation import tanh
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'shape': [(3, 2), ()]... | anaruse/chainer | tests/chainer_tests/functions_tests/activation_tests/test_tanh.py | Python | mit | 5,799 |
#!/usr/bin/env python
import sys
from os.path import dirname, abspath
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASE_ENGINE='sqlite3',
# HACK: this fixes our threaded runserver remote tests
# TEST_DATABASE_NAME='test_sentry',
INSTALLED_APP... | brilliant-org/nexus-memcache | runtests.py | Python | apache-2.0 | 1,054 |
from django_currentuser.db.models.fields import CurrentUserField
__all__ = ['CurrentUserField']
| PaesslerAG/django-currentuser | django_currentuser/db/models/__init__.py | Python | bsd-3-clause | 98 |
'''
Created on 2014. 3. 21.
@author: Su-Jin Lee
'''
from ast import literal_eval
from time import time, sleep
from twisted.internet.protocol import ServerFactory, ClientFactory
from twisted.protocols.basic import LineReceiver
class LFProtocol(LineReceiver):
def verifyMsg(self, msg):
if self.verifyFunc:
... | NecromancerLev0001/LightingFury | LF/lfprotocol.py | Python | mit | 1,561 |
"""Mailcap file handling. See RFC 1524."""
import os
__all__ = ["getcaps","findmatch"]
# Part 1: top-level interface.
def getcaps():
"""Return a dictionary containing the mailcap database.
The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
to a list of dictionaries corre... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/mailcap.py | Python | gpl-3.0 | 7,740 |
def main():
N = int(input())
H = [int(x) for x in input().split()]
dp = [0] * N
for i in range(1, N):
if i == 1:
dp[i] = abs(H[i] - H[i-1])
else:
dp[i] = min(dp[i-1] + abs(H[i] - H[i-1]), dp[i-2] + abs(H[i] - H[i-2]))
print(dp[-1])
if __name__ == '__main__':... | knuu/competitive-programming | atcoder/dp/edu_dp_a.py | Python | mit | 332 |
#!/usr/bin/env python2
#
##############################################################################
### NZBGET POST-PROCESSING SCRIPT ###
# Post-Process to CouchPotato, SickBeard, NzbDrone, Mylar, Gamez, HeadPhones.
#
# This script sends the download to your automated media... | DxCx/nzbToMedia | nzbToGamez.py | Python | gpl-3.0 | 2,702 |
from .__version__ import __version__
from .environment import get_active_envrionment
| vmalloc/pydeploy | pydeploy/__init__.py | Python | bsd-3-clause | 85 |
#!/usr/bin/env python
"""Make sequence context specific bigbed per sample"""
import argparse
import os
from nested_dict import nested_dict
from Bio import SeqIO
def parse_args():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(description='Concatenate reference for display in jbrowse')
... | thomasvangurp/epiGBS | jbrowse/bed_split_sample_bigwig.py | Python | mit | 7,605 |
import numpy as np
import parabem
from parabem import pan3d
v1 = parabem.PanelVector3(-0.5,-0.5, 0)
v2 = parabem.PanelVector3( 0.5,-0.5, 0)
v3 = parabem.PanelVector3( 0.5, 0.5, 0)
v4 = parabem.PanelVector3(-0.5, 0.5, 0)
p = parabem.Panel3([v1, v2, v3, v4])
v5 = parabem.Vector3(0.5, 0, 0.5)
v6 = parabem.Vector3(0.49... | looooo/panel-method | examples/tests/test_doublet_src.py | Python | gpl-3.0 | 576 |
#!/usr/bin/env python
# [SublimeLinter pep8-max-line-length:150]
# -*- coding: utf-8 -*-
"""
black_rhino is a multi-agent simulator for financial network analysis
Copyright (C) 2016 Co-Pierre Georg (co-pierre.georg@keble.ox.ac.uk)
Pawel Fiedor (pawel@fiedor.eu)
This program is free software: you can redistribute it a... | cogeorg/BlackRhino | src/measurement.py | Python | gpl-3.0 | 6,855 |
from datetime import datetime
import glob
import re
import os
import warnings
import h5py
import numpy as np
from uncertainties import ufloat
import openmc
import openmc.checkvalue as cv
_VERSION_STATEPOINT = 17
class StatePoint:
"""State information on a simulation at a certain point in time (at the end
o... | nelsonag/openmc | openmc/statepoint.py | Python | mit | 23,386 |
from typing import TYPE_CHECKING, Optional
from babel.numbers import LC_NUMERIC
from babel.numbers import format_currency as babel_format_currency
if TYPE_CHECKING:
from . import Money
def format_money(
money: "Money",
format: Optional[str] = None,
locale: str = LC_NUMERIC,
currency_digits: bool... | limist/py-moneyed | src/moneyed/l10n.py | Python | bsd-3-clause | 781 |
__author__ = 'sibirrer'
import numpy as np
import scipy.ndimage.interpolation as interp
import astropy.io.fits as pyfits
import pyextract.pysex as pysex
import easylens.util as util
class ImageAnalysis(object):
"""
class for analysis routines acting on a single image
"""
def __init__(self):
... | DES-SL/EasyLens | easylens/Data/image_analysis.py | Python | mit | 7,851 |
# -*- coding: utf-8 -*-
import re
import json
def parse_input(string, replace_vkurl=True, replace_url=True, replace_nl=True):
new_string = string
if replace_vkurl:
new_string = re.sub(r'\b(https?://)?m\.?vk\.com/?.*\b',
'__vkurl__',
new_string # поиск ссылок vk.com
)
if replace_url:
new_string = re.su... | Fogapod/ChatBot | utils.py | Python | mit | 3,253 |
#!/usr/bin/env python
"""A simple TopicServer stress-test.
Start the TopicServer and then run this test,
which will check the TopicServer's advertised capacities
and basic error handling.
Judiciary Pag
March 2016
"""
from __future__ import print_function
import ConfigParser
import datetime
import httplib
from twis... | JudiciaryPag/TopicServer | client/stress.py | Python | apache-2.0 | 8,417 |
import json
import re
from datetime import datetime, timedelta
import scrapy
from feeds.loaders import FeedEntryItemLoader
from feeds.spiders import FeedsSpider
class DelinskiAtSpider(FeedsSpider):
name = "delinski.at"
feed_title = "Delinski"
feed_link = "https://{}".format(name)
feed_logo = "https... | nblock/feeds | feeds/spiders/delinski_at.py | Python | agpl-3.0 | 2,150 |
from flask.views import View
from flask import render_template, request
class CompanyDir(View):
def dispatch_request(self):
return render_template('company_directory.html', komuna='prishtina')
| opendatakosovo/municipality-procurement-visualizer | gpv/views/pages/company_dir_pages.py | Python | gpl-2.0 | 207 |
# -*- coding: utf-8 -*-
import logging
import odoo
from odoo.tools.func import lazy_property
from .sessionstore import PostgresSessionStore
_logger = logging.getLogger(__name__)
class RootTkobr(odoo.http.Root):
@lazy_property
def session_store(self):
# Setup http sessions
_logger.debug('HT... | meta-it/misc-addons | base_session_store_psql/http.py | Python | lgpl-3.0 | 500 |
#print("not init")
#import core
#from core import PiUMP
#print("init")
| xavigisbeg/ELECTROAD_PiUMP | src/__init__.py | Python | apache-2.0 | 71 |
#!/usr/bin/env python
#------------------------------------------------------------------------------
#
# sensor metadata-extraction profiles - spot4 and spot5 scene 1A products
#
# Project: XML Metadata Handling
# Authors: Martin Paces <martin.paces@eox.at>
#
#---------------------------------------------------------... | DREAM-ODA-OS/tools | metadata/profiles/spot_scene_1a.py | Python | mit | 14,275 |
CHEMICAL = {
'typeclass': 'typeclasses.objects.Chemical',
'key': 'generic chemical',
'desc': 'A blob of some generic chemical',
'effect': 'GenericEffect()'
}
def GenericEffect():
print("You've got a chemical in you!")
| maxsond/Spacebase | Hail/typeclasses/prototypes/chemicals.py | Python | bsd-3-clause | 239 |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test
@file mi-dataset/mi/dataset/parser/test/test_ctdbp_cdef.py
@author Jeff Roy
@brief Test code for ctdbp_cdef data parser
Files used for testing:
data1.log
Contains Header + 100 Sensor records
invalid_data.log
Contains 7 lines of invalid data
no_sensor_da... | janeen666/mi-instrument | mi/dataset/parser/test/test_ctdbp_cdef.py | Python | bsd-2-clause | 6,282 |
# Copyright (c) Moshe Zadka
# See LICENSE for details.
from twisted.application.service import ServiceMaker
serviceMaker = ServiceMaker(
"Web-based write-only editor",
"nanoauto.web",
"An editor which allows writing only",
"nanoauto",
)
| moshez/nanoauto | twisted/plugins/nanoauto.py | Python | mit | 255 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py | Python | mit | 1,113 |
# -*- coding: utf-8 -*-
################################################
###### Copyright (c) 2016, Alexandre Popoff
###
import numpy as np
import itertools
import time
from .categoryaction import CatObject
class MultQ(object):
def __init__(self,x):
"""Initializes an element of the multiplicative quantal... | AlexPof/opycleid | opycleid/q_categoryaction.py | Python | bsd-3-clause | 33,498 |
from pontoon.checks import DB_LIBRARIES
def bulk_run_checks(translations):
"""
Run checks on a list of translations
*Important*
To avoid performance problems, translations have to prefetch entities and locales objects.
"""
from pontoon.checks.libraries import run_checks
from pontoon.check... | mathjazz/pontoon | pontoon/checks/utils.py | Python | bsd-3-clause | 3,083 |
# -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | tosfan4ever/hacktheplanet | config/settings/local.py | Python | bsd-3-clause | 2,187 |
import tensorflow as tf
from .template import BaseLayer
class Linear(BaseLayer):
@BaseLayer.init_name_scope
def __init__(self, this_dim=None, W=None, b=None, stddev=0.1):
"""
Description:
This is a fully connected layer
Args:
this_dim (int): dimension of this ... | hycis/TensorGraph | tensorgraph/layers/linear.py | Python | apache-2.0 | 4,195 |
from ..Qt import QtCore, QtGui, QtOpenGL, USE_PYQT5
from OpenGL.GL import *
import OpenGL.GL.framebufferobjects as glfbo
import numpy as np
from .. import Vector
from .. import functions as fn
##Vector = QtGui.QVector3D
ShareWidget = None
class GLViewWidget(QtOpenGL.QGLWidget):
"""
Basic widget for displayin... | onlyjus/pyqtgraph | pyqtgraph/opengl/GLViewWidget.py | Python | mit | 18,189 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014 Contributor
#
# 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... | quattor/aquilon | lib/aquilon/worker/formats/share.py | Python | apache-2.0 | 1,959 |
# Generated by Django 2.2.24 on 2022-01-27 22:04
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("course_catalog", "0088_change_image_src_type")]
operations = [
migrations.AddField(
model_name="conten... | mitodl/open-discussions | course_catalog/migrations/0089_contentfile_learning_resource_types.py | Python | bsd-3-clause | 607 |
def factor(n):
if n == 1: return [1]
i = 2
limit = n**0.5
while i <= limit:
if n % i == 0:
ret = factor(n/i)
ret.append(i)
return ret
i += 1
return [n]
d... | Jiri-Kremser/euler | 243/Problem.py | Python | gpl-2.0 | 980 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Doriancoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test running doriancoind with the -rpcbind and -rpcallowip options."""
import socket
import sys
fr... | doriancoins/doriancoin | test/functional/rpc_bind.py | Python | mit | 4,886 |
# -*- coding: utf-8 -*-
##
## Some functions about dates
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 Fr... | kntem/webdeposit | modules/miscutil/lib/dateutils.py | Python | gpl-2.0 | 19,589 |
import logging
import numpy as np
import os
import pkgutil
import pytest
import aacgmv2
# @pytest.mark.skip(reason="Not meant to be run alone")
class TestModuleStructure:
def setup(self):
# Define the acceptable output
if not hasattr(self, "reference_list"):
self.reference_list = lis... | cmeeren/aacgmv2 | aacgmv2/tests/test_struct_aacgmv2.py | Python | mit | 7,911 |
#!/usr/bin/env python3
# dirtool.py - diff tool for directories
# Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | Grumbel/dirtool | experiments/qnotify/qnotify.py | Python | gpl-3.0 | 1,673 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\MillerLab\Desktop\database-development\Views\ui_dialog_addsitecolumn.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = ... | bibsian/database-development | Views/ui_dialog_addsitecolumn.py | Python | mit | 6,845 |
from django.conf.urls import url
from downloads import views
urlpatterns = [
url(r'^$', views.index, name='downloads'),
] | FSavoy/visuo-server | downloads/urls.py | Python | bsd-3-clause | 127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.