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 |
|---|---|---|---|---|---|
# coding=utf-8
from data_packer import RequiredField, constant, converter
from common import demo_run
cvt = converter.TypeConverter(str)
fields = [
RequiredField('a', 'a', converter=cvt)
]
demo_run(fields, '类型转换为str')
| ideascf/data-packer | example/demo/demo_converter.py | Python | mit | 234 |
from django.conf.urls import patterns, url
from rest_framework.urlpatterns import format_suffix_patterns
from . import api_views
from . import views
urlpatterns = patterns(
'',
url(r'^munger_builder_index/', views.munger_builder_index, name='munger_builder_index'),
url(r'^new_munger_builder/', views.new_m... | cscanlin/munger-builder | script_builder/urls.py | Python | mit | 1,506 |
# Dealer.py
# controls the actual game flow and logic
import Game
import CardDeck
class Dealer():
def __init__(self):
self.currentGame = self.setupNewGame()
self.currentDeck = CardDeck.CardDeck()
self.button = 0 # human starts on the button until card flip is implemented
def setupNewG... | KristianL1415/python-poker | Dealer.py | Python | mit | 2,358 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from nose.tools import assert_equals, assert_raises
from ..log.mixin import LoggerMixin
class LoggableStub(object, LoggerMixin):
pass
def test_logger_mixin():
obj = LoggableStub()
from logging.handlers import MemoryHandler
import logging
log... | dimagi/rapidsms-core-dev | lib/rapidsms/tests/test_logger.py | Python | bsd-3-clause | 1,194 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import os
import re
import traceback
from .printer import print_err, colors
from typing import cast, Any, Callable, Dict, List, Optional, Tuple
RuleList = List[Dict[str, Any]] # mypy currently requires Aliases at ... | vaidap/zulip | tools/linter_lib/custom_check.py | Python | apache-2.0 | 24,661 |
# Copyright 2015 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... | laosiaudi/tensorflow | tensorflow/python/client/session.py | Python | apache-2.0 | 50,538 |
"""
slothpal.context
~~~~~~~~~~~~~~~~
"""
from peak.util.proxies import ObjectProxy
from slothpal import constants
from slothpal.attributes import AttributeDict
context = ObjectProxy(None)
class PayPalContext(AttributeDict):
def __init__(self, **kwargs):
self.update(kwargs)
def push(self):
... | hahnicity/slothpal | slothpal/context.py | Python | unlicense | 1,294 |
#!/usr/bin/env python
import os.path
import setuptools
import sprockets.mixins.cors
def read_requirements(file_name):
requirements = []
try:
with open(os.path.join('requires', file_name)) as req_file:
for req_line in req_file:
req_line = req_line.strip()
i... | sprockets/sprockets.mixins.cors | setup.py | Python | bsd-3-clause | 1,977 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './Preferences/ProgramsDialog.ui'
#
# Created: Tue Nov 18 17:53:56 2014
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_ProgramsDialog(obj... | davy39/eric | Preferences/Ui_ProgramsDialog.py | Python | gpl-3.0 | 1,757 |
import logging
import subprocess as sp
import threading
from . import stats
from .frame import Frame
from .service import Service
class Reader(Service):
def __init__(self, name, queue, source, shape, capture_options=None, bufsize=10 ** 8):
super().__init__()
self.name = name
self.queue = ... | bkmeneguello/surveillance | surveillance/reader.py | Python | unlicense | 3,126 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-29 01:58
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('magic', '0006_auto_20170928_2238'),
]
o... | Angoreher/xcero | magic/migrations/0007_auto_20170928_2258.py | Python | mit | 2,691 |
'''
Forms for Prizes.
Created on Nov 4, 2012
@author: Cam Moore
'''
from django import forms
from apps.managers.challenge_mgr.models import RoundSetting
class ChangePrizeRoundForm(forms.Form):
"""change prize round form."""
round_choice = forms.ModelChoiceField(queryset=RoundSetting.objects.all(), required=... | KendyllD/boukenda-project | makahiki/apps/widgets/prizes/forms.py | Python | mit | 326 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
config = {
"suite_definitions": {
"mochitest": {
"options": [
"--total-chunks=%(... | vladikoff/fxa-mochitest | tests/config/mozharness/b2g_desktop_config.py | Python | mpl-2.0 | 1,440 |
# Django settings for example project.
import os
PROJECT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.... | caktus/django-template-graph | example/example/settings.py | Python | bsd-2-clause | 5,564 |
"""
Resources for equipment from `NKT Photonics <https://www.nktphotonics.com/>`_.
"""
from .nktpdll import (
NKT,
PortStatusCallback,
DeviceStatusCallback,
RegisterStatusCallback,
RegisterPriorityTypes,
RegisterDataTypes,
RegisterStatusTypes,
PortStatusTypes,
DeviceModeTypes,
De... | MSLNZ/msl-equipment | msl/equipment/resources/nkt/__init__.py | Python | mit | 402 |
from django.conf.urls import patterns, include, url, handler404
from django.views.generic import TemplateView
from django.contrib import admin
admin.autodiscover()
handler404 = 'pyquiz.views.page_not_found'
handler500 = 'pyquiz.views.internal_error'
urlpatterns = patterns('',
# Examples:
#url(r'^(.*)$', Templa... | vivekhas3/python_quizzup | python_quizzup/urls.py | Python | mit | 708 |
import requests
from lib.base import OpscenterAction
class GetClusterRepairStatusAction(OpscenterAction):
def run(self, cluster_id=None):
if not cluster_id:
cluster_id = self.cluster_id
url = self._get_full_url([cluster_id, 'services', 'repair'])
return requests.get(url).jso... | pidah/st2contrib | packs/opscenter/actions/get_repair_status.py | Python | apache-2.0 | 324 |
from wishbonedevice import WishBoneDevice
import fractions as _frac
import logging
import time
logging.getLogger(__name__).addHandler(logging.NullHandler())
class LMX2581(WishBoneDevice):
""" LMX2581 Frequency Synthesizer """
DICTS = [
#00
{
'ID' : 1 << 31,
'FRAC_DITHER' : 0b11 << 29,
'NO_FCAL' : 1 << 28,... | ska-sa/casperfpga | src/synth.py | Python | gpl-2.0 | 10,000 |
from JumpScale import j
class system_infomgr(j.code.classGetBase()):
"""
this is an example actor
"""
def __init__(self):
pass
self._te={}
self.actorname="infomgr"
self.appname="system"
#system_infomgr_osis.__init__(self)
def addInfo(self, info, **... | Jumpscale/jumpscale6_core | apps/portalbase/system/system__infomgr/methodclass/system_infomgr.gen.py | Python | bsd-2-clause | 3,098 |
"""Implements optimization and model problems."""
from cobra.flux_analysis.parsimonious import add_pfba
from micom.duality import fast_dual
from micom.solution import CommunitySolution
from micom.util import (_format_min_growth, _apply_min_growth,
check_modification)
from micom.logger import lo... | cdiener/micom | micom/problems.py | Python | apache-2.0 | 12,424 |
'''
This file contains all the functions that constitute the "frontend of the backend",
i.e. native Python plotting functions. All actual plots are generated by plotting.py --
this is purely about displaying them. manualfit() and geogui() rely on PyQt4, which
is likely to fail, so it's sequestered.
Version: 2019aug06
... | optimamodel/Optima | optima/gui.py | Python | lgpl-3.0 | 48,120 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='hubsync',
packages=['hubsync'],
version='0.2.9',
description='Get your github workspace synced!',
author='Mario Corchero',
author_email='mariocj89@gmail.com',
url='https://github.com/Mariocj89/hubsync',
keywords=['github', ... | Mariocj89/hubsync | setup.py | Python | mit | 507 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_modes', '0002_coursemode_expiration_datetime_is_explicit'),
]
operations = [
migrations.AlterField(
model... | solashirai/edx-platform | common/djangoapps/course_modes/migrations/0003_auto_20151113_1443.py | Python | agpl-3.0 | 463 |
# 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 field 'RestoreRequest.error_message'
db.add_column('backup_restorerequest', 'error_message', self... | fgaudin/aemanager | backup/migrations/0003_auto__add_field_restorerequest_error_message__add_field_backuprequest_.py | Python | agpl-3.0 | 5,669 |
# -*- coding: utf-8 -*-
""" skratchlib
Library Package for Skratch Tool
Author: Andrew Paxson
Created: 2017-09-01
"""
#TODO Add List Scratch Files
import argparse
import os
import re
import subprocess
SCRATCH_FILENAME_CONSTANT = "scratch"
SCRATCH_LOCATION_CONSTANT = os.path.expanduser("~")
SCRATCH_RE_PATTERN_CONSTAN... | paxsonsa/skratch | skratchlib/__init__.py | Python | mit | 5,224 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-16 00:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0005_queue_name'),
]
operations = [
... | falcaopetri/enqueuer-api | api/migrations/0006_auto_20161015_2113.py | Python | bsd-3-clause | 543 |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | fengbeihong/tempest_automate_ironic | tempest/scenario/test_dashboard_basic_ops.py | Python | apache-2.0 | 3,454 |
# -*- coding: utf-8 -*-
"""
Class and program to colorize python source code for ANSI terminals.
Based on an HTML code highlighter by Jurgen Hermann found at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298
Modifications by Fernando Perez (fperez@colorado.edu).
Information on the original HTML highligh... | cloud9ers/gurumate | environment/lib/python2.7/site-packages/IPython/utils/PyColorize.py | Python | lgpl-3.0 | 9,600 |
# Copyright 2015-2017 Capital One Services, 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 agreed ... | jdubs/cloud-custodian | tests/test_policy.py | Python | apache-2.0 | 16,608 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Billy Kimble <basslines@gmail.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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | rosmo/ansible | lib/ansible/modules/notification/hall.py | Python | gpl-3.0 | 3,365 |
# -*- coding: utf-8 -*-
# Copyright 2014-17 Neil Freeman
# 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 License, or
# (at your option) any later version.
# This program... | fitnr/twitter_bot_utils | src/twitter_bot_utils/args.py | Python | gpl-3.0 | 3,523 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework import serializers
from drf_haystack.serializers import HaystackSerializer
class ProductSearchSerializer(HaystackSerializer):
"""
The base serializer to represent one or more product fields for being returned as a
result l... | schacki/django-shop | shop/search/serializers.py | Python | bsd-3-clause | 1,131 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# Copyright (C) 2014-2017 Anler Hernández ... | dayatz/taiga-back | tests/integration/test_hooks_gogs.py | Python | agpl-3.0 | 19,291 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"gui2py's Components Object Model: base & super classes, metaclasses and mixins"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2013- Mariano Reingart" # where applicable
# Initial implementation was based on PythonCard's compone... | reingart/gui2py | gui/component.py | Python | lgpl-3.0 | 51,589 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-28 13:41
# flake8: noqa
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import normandy.recipes.validators
class Migration(mi... | Osmose/normandy | recipe-server/normandy/recipes/migrations/0034_recipe_revisions.py | Python | mpl-2.0 | 3,780 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#Art Rand
"""
This is a module of FASTA/.qual and FASTQ parsers.
The functions in this module are intended for use with biological sequence data
(DNA, and amino acid) in the form of FASTA, .qual (which accompany FASTA),
and FASTQ files. There are two kinds of functions... | mitenjain/signalAlign | src/signalalign/utils/parsers.py | Python | mit | 14,540 |
import chaospy
import numpy
import pytest
@pytest.fixture
def collocation_model(expansion_small, samples_small, evaluations_small):
return chaospy.fit_regression(expansion_small, samples_small, evaluations_small)
def test_collocation_mean(collocation_model, joint, true_mean):
assert numpy.allclose(chaospy.E... | jonathf/chaospy | tests/test_point_collocation.py | Python | mit | 534 |
from __future__ import absolute_import, unicode_literals
import os
from django import VERSION as DJANGO_VERSION
from django.utils.translation import ugettext_lazy as _
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``de... | nikdval/cloudSolar | solarApp/solar/settings.py | Python | artistic-2.0 | 11,845 |
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y' # 04 نوفمبر 2020
TIME_FORMAT = 'g:i A'
# DATETIME_FORMAT =
YEAR_MONTH_FORMAT = 'F Y'
MONTH_... | kaedroho/django | django/conf/locale/ar_DZ/formats.py | Python | bsd-3-clause | 728 |
from .navigation import Navigation, MenuItem
shared = MenuItem('Logout', 'account_logout')
member = MenuItem('Clients', 'users:list')
checkin = MenuItem('Check-ins', url='checkin:list')
template = MenuItem('Template', url='checkin:list')
leaderboard = MenuItem('Lifestyle Leaderboard', url='lifestyle:list')
libr... | airportmarc/the416life | src/apps/utls/navigation/navigationBuild.py | Python | mit | 2,085 |
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
# A reminder: The 2 fields, 'file_urls' and 'files' are special fields
# required by scrapy pipeline for storing files to local disk.
# See https://groups.google.com/forum/print/msg/scrapy-user... | comsaint/legco-watch | app/raw/scraper/items.py | Python | mit | 4,319 |
##
# Copyright (C) 2018 Jessica Tallon & Matt Molyneaux
#
# This file is part of Inboxen.
#
# Inboxen 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
#... | Inboxen/Inboxen | inboxen/utils/ip.py | Python | agpl-3.0 | 1,663 |
def test(fmt, *args):
print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<')
test("{:10.4}", 123.456)
test("{:10.4e}", 123.456)
test("{:10.4e}", -123.456)
#test("{:10.4f}", 123.456)
#test("{:10.4f}", -123.456)
test("{:10.4g}", 123.456)
test("{:10.4g}", -123.456)
test("{:10.4n}", 123.456)
test("{:e}", 100)
tes... | MrSurly/micropython-esp32 | tests/float/string_format_fp30.py | Python | mit | 1,002 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ***********************IMPORTANT NMAP LICENSE TERMS************************
# * *
# * The Nmap Security Scanner is (C) 1996-2013 Insecure.Com LLC. Nmap is *
# * also a registered trademark of Inse... | grongor/school_rfid | lib/nmap-6.40/zenmap/zenmapGUI/higwidgets/higspinner.py | Python | gpl-2.0 | 21,695 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('developers', '0005_auto_20150827_1230'),
]
operations = [
migrations.RemoveField(
model_name='preloadtestplan',
... | ingenioustechie/zamboni | mkt/developers/migrations/0006_auto_20151110_1117.py | Python | bsd-3-clause | 442 |
#!/usr/bin/python
#
# 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 later version.
#
# Ansible is distribut... | kbrebanov/ansible | lib/ansible/modules/network/nxos/nxos_udld.py | Python | gpl-3.0 | 8,829 |
from __future__ import absolute_import
import time
from celery import shared_task
@shared_task
def test_task():
time.sleep(20)
return 'Completed'
| baranbartu/djcelery-admin | sample_project/celeryapp/tasks.py | Python | mit | 157 |
#!/usr/bin/env python2
import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 5005
BUFFER_SIZE = 20 # Normally 1024, but we want fast response
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connection address:', addr
data = conn.recv(BUFFER_SIZ... | sbinet-staging/pyrame | acq_chain/acq_plugins/tcpclient/tcp_server.py | Python | lgpl-3.0 | 402 |
import os
import pytest
from topaz.modules import process
from ..base import BaseTopazTest
class TestProcess(BaseTopazTest):
def test_euid(self, space):
w_res = space.execute("return Process.euid")
assert space.int_w(w_res) == os.geteuid()
def test_pid(self, space):
w_res = space.e... | kachick/topaz | tests/modules/test_process.py | Python | bsd-3-clause | 2,459 |
from unittest import TestCase
from ..utils import Pieces
class TestPieces(TestCase):
def setUp(self):
self.torrent = {
b'info': {
b'piece length': 4,
b'pieces': '\00'*(20*20)
}
}
self.pieces = Pieces(self.torrent)
de... | jeanfrancoisdrapeau/autotorrent | autotorrent/tests/test_utils.py | Python | mit | 442 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
JoinAttributes.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
************************... | myarjunar/QGIS | python/plugins/processing/algs/qgis/JoinAttributes.py | Python | gpl-2.0 | 4,402 |
#! /usr/bin/env python
descr = """A set of Python modules for functional MRI..."""
import sys
import os
from setuptools import setup, find_packages
def load_version():
"""Executes nistats/version.py in a globals dictionary and return it.
Note: importing nistats is not an option because there may be
de... | bthirion/nistats | setup.py | Python | bsd-3-clause | 3,134 |
# Program main_remote. Look up new phone numbers and maybe add to the blacklist.
# Copyright (C) 2014 David Brown
#
# 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 Licens... | smurfless1/jcmanage | main_remote.py | Python | gpl-3.0 | 1,627 |
from .functional import *
from .unit import *
| HumanExposure/factotum | feedback/tests/__init__.py | Python | gpl-3.0 | 46 |
# Get the difference between the greatest and smallest number in the given array
def checkio(*args):
if (len(args) == 0):
return 0
x = max(args) - min(args);
return x
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
def almos... | lisprolog/python | most_numbers.py | Python | bsd-3-clause | 735 |
from atila import Atila
import confutil
import skitai
from rs4 import asyncore
import os
from rs4 import jwt as jwt_
import time
def test_route_root (app, dbpath):
@app.route ("/index")
@app.require ("URL", ints = ["t"])
def index (was, t = 0):
t = int (t)
if t == 0:
... | hansroh/skitai | tests/level3/test_api_fault.py | Python | mit | 1,690 |
import time as real_time
import unittest
import jwt as jwt_lib
from mock import patch
from twilio.jwt import Jwt, JwtDecodeError
class DummyJwt(Jwt):
"""Jwt implementation that allows setting arbitrary payload and headers for testing."""
ALGORITHM = 'HS256'
def __init__(self, secret_key, issuer, subje... | twilio/twilio-python | tests/unit/jwt/test_jwt.py | Python | mit | 9,331 |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2019 Jun-ya HASEBA
#
# 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 applic... | 7pairs/twingo | tests/test_views.py | Python | apache-2.0 | 8,174 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Campaign.user'
db.alter_column(u'campaign_campaign', '... | fandrefh/AnjoMeu | anjo/campaign/migrations/0005_auto__chg_field_campaign_user.py | Python | gpl-2.0 | 4,461 |
import subprocess
import random, string, os, socket, json, time
from glob import glob
from urllib import request
import threading
import configparser
import yaml
import logging
import logging.config
import fcntl
import datetime
USBDEVFS_RESET = 21780
try:
logging.config.fileConfig("logging.ini")
except:
pass
... | borevitzlab/Gigvaision-ControlSoftware | libs/SysUtil.py | Python | mit | 24,107 |
from .reader_utils import regist_reader, get_reader
from .feature_reader import FeatureReader
from .kinetics_reader import KineticsReader
from .nonlocal_reader import NonlocalReader
regist_reader("ATTENTIONCLUSTER", FeatureReader)
regist_reader("NEXTVLAD", FeatureReader)
regist_reader("ATTENTIONLSTM", FeatureReader)
r... | kuke/models | fluid/PaddleCV/video/datareader/__init__.py | Python | apache-2.0 | 474 |
import json
from random import shuffle
class City:
def __init__(self, cityName, population):
self.cityName = cityName
self.population = population
self.listOfDistancesToOtherCities = []
self.distanceToInStraightLineWarsaw = 0
self.latitude = 0
self.longitude = 0
cla... | DPP93/SearchGraphCities_PL | Searching/routing/routing.py | Python | gpl-3.0 | 20,838 |
"""
Basic MLP class methods for parameters initialization, saving, loading
plotting
"""
import os
from six.moves import cPickle as pickle
import yaml
import numpy as np
from copy import deepcopy
from lxmls.deep_learning.utils import Model
def load_parameters(parameter_file):
"""
Load model
"""
with op... | LxMLS/lxmls-toolkit | lxmls/deep_learning/rnn.py | Python | mit | 6,642 |
"""
Statistical tools for time series analysis
"""
from statsmodels.compat.numpy import lstsq
from statsmodels.compat.pandas import deprecate_kwarg
from statsmodels.compat.python import lzip
from statsmodels.compat.scipy import _next_regular
import warnings
import numpy as np
from numpy.linalg import LinAlgError
impo... | jseabold/statsmodels | statsmodels/tsa/stattools.py | Python | bsd-3-clause | 89,818 |
import urllib2
import base64
import simplejson as json
from pprint import pprint
import os
import time
import inspect
def exc_dec(f):
def wrapper(*args, **kwargs):
try:
f(*args, **kwargs)
except Exception:
print -1
return wrapper
class Rabbitmq_Helper:
def __init_... | ngelik/python | RabbitmQ_mon/rabbitmq_helper.py | Python | mit | 4,124 |
#-------------------------------------------------------------------------------
# Name: levels
# Purpose:
#
# Author: novirael
#
# Created: 17-04-2012
# Copyright: (c) novirael 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------... | novirael/arkanoid-pygame | levels.py | Python | gpl-2.0 | 1,317 |
# -*- coding:utf-8 -*-
import unittest
from boto.exception import SWFResponseError
from boto.swf.layer1 import Layer1
from mock import patch
import swf.settings
from swf.exceptions import DoesNotExistError, ResponseError
from swf.models.activity import ActivityType
from swf.models.domain import Domain
from swf.query... | botify-labs/simpleflow | tests/test_swf/querysets/test_activity.py | Python | mit | 5,019 |
# https://zenpack-sdk.zenoss.com/en/2.0.0/changes.html
from ZenPacks.zenoss.ZenPackLib import zenpacklib
CFG = zenpacklib.load_yaml()
schema = CFG.zenpack_module.schema
| daviswr/ZenPacks.daviswr.OSX.Server.Caching | ZenPacks/daviswr/OSX/Server/Caching/__init__.py | Python | mit | 169 |
import matplotlib.pyplot as plt
import models.model as model
import earthquake.catalog as catalog
from collections import OrderedDict
def histogramEarthquakes(catalog_, region):
"""
Creates the histogram of earthquake events by a given region.
Saves the histogram to the follwing path ./code/Zona2/histogram... | PyQuake/earthquakemodels | code/runExperiments/histogramEarthquakes.py | Python | bsd-3-clause | 1,708 |
#===============================================================================
# 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 License, or
# (at your option) a... | cmotc/reddit-desk | Reddit_Desk.py | Python | gpl-3.0 | 10,219 |
import json
from urllib.parse import urlencode
from django import template
from django.conf import settings
from django.apps import apps
from vault.models import GroupProjects
from identity.keystone import KeystoneNoRequest
register = template.Library()
@register.simple_tag(takes_context=True)
def get_vault_env(co... | globocom/vault | vault/templatetags/vault_tags.py | Python | apache-2.0 | 2,418 |
# -*- coding: utf-8 -*-
from tornado import ioloop
class StatusJob(ioloop.PeriodicCallback):
CALLBACK_TIME = 10000
def __init__(self, sample_service, ws_service):
super().__init__(self.callback, self.CALLBACK_TIME)
self.sample_service = sample_service
self.ws_service = ws_service
... | maveron58/indiana | web/jobs/status_job.py | Python | mit | 434 |
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | aljim/deploymentmanager-samples | examples/v2/common/python/container_instance_template.py | Python | apache-2.0 | 2,534 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# i... | aricchen/openHR | openerp/addons/l10n_be_invoice_bba/invoice.py | Python | agpl-3.0 | 11,922 |
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
from keras.datasets import mnist, cifar10, cifar100
from sklearn.preprocessing import LabelBinarizer
from nets import LeNet, LeNetVarDropout, VGG, VGGVarDropout
sess = tf.Session()
def main():
dataset ... | cjratcliff/variational-dropout | main.py | Python | gpl-3.0 | 1,649 |
from pytest_regressions.data_regression import DataRegressionFixture
import gdsfactory as gf
from gdsfactory.component import Component
def test_get_bundle_optical(
data_regression: DataRegressionFixture, check: bool = True
) -> Component:
lengths = {}
c = gf.Component("test_get_bundle_optical")
w... | gdsfactory/gdsfactory | gdsfactory/tests/test_get_bundle_optical.py | Python | mit | 1,657 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-07 18:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMo... | Hawk94/coin_tracker | main/stocks/migrations/0001_initial.py | Python | mit | 3,287 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:et
import unittest
import pycurl
from . import util
from . import appmanager
setup_module, teardown_module = appmanager.setup(('app', 8380))
class XferinfoCbTest(unittest.TestCase):
def setUp(self):
self.curl = pycurl.Curl()
self.curl.seto... | buaabyl/pycurl-win32 | tests/xferinfo_cb_test.py | Python | lgpl-2.1 | 2,113 |
from HTMLParser import HTMLParser
import urllib2
class myParser(HTMLParser):
def handle_starttag(self, tag, attrs):
if (tag == "a"):
for a in attrs:
if (a[0] == 'href'):
link = a[1]
if (link.find('http') >= 0):
print(link)
newParse = myParser()
newParse.feed(link)
url = "http://w... | dreweggers/Vectrons_Klaw | net/spider.py | Python | mit | 445 |
"""Kombu transport using SQLAlchemy as the message store."""
from Queue import Empty
from anyjson import loads, dumps
from sqlalchemy import create_engine
from sqlalchemy.exc import OperationalError
from sqlalchemy.orm import sessionmaker
from .. import virtual
from .models import Queue, Message, metadata
VERSION... | kumar303/rockit | vendor-local/kombu/transport/sqlalchemy/__init__.py | Python | bsd-3-clause | 3,337 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP - Account renumber wizard
# Copyright (C) 2009 Pexego Sistemas Informáticos. All Rights Reserved
# Copyright (c) 2013 Servicios Tecnológicos Avanzados
# (http://www.servicios... | ClearCorp-dev/account-financial-tools | account_renumber/__openerp__.py | Python | agpl-3.0 | 2,370 |
# -*- coding: utf-8 -*-
# OpenERP, Open Source Management Solution
# Copyright (c) 2015 Rooms For (Hong Kong) Limited T/A OSCG
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundat... | rfhk/rfhk-addons | website_crm_notify/controllers/__init__.py | Python | agpl-3.0 | 900 |
# -*- coding: UTF-8 -*-
from django.shortcuts import render
from django.template import loader, Context
from django.http import HttpResponse, HttpResponseRedirect
from travels.models import *
from photo.models import *
from favourite.models import *
from accounts.models import *
from django.shortcuts import render_to_r... | liuasliy/rdstourcms | travels/views.py | Python | mit | 9,812 |
from pylab import *
import pyasf
gamma = 1
bg = 1e-12
det = pyasf.AreaDetector((22, 0, 0.2)) # delta, nu, dist
energy = [28000] # eV
alpha = 15.7 # angle of incidence
psi = 0 # azimuth
cs = pyasf.unit_cell("7101739") # from crystallography open database
s = pyasf.Geometry.ThreeCircleVertical(cs, (1,1,1))
fig, ax = su... | carichte/pyasf | pyasf/examples/Diffraction2d.py | Python | gpl-3.0 | 744 |
import os
from django.shortcuts import render
from django.http import HttpResponseNotFound
from django.contrib.staticfiles import finders
def view_presentation(request, filename):
# Find the file in staticfiles.
full_path = finders.find(os.path.join("presentation", filename + ".htm"))
if not full_path o... | w0rp/w0rpzone | presentation/views.py | Python | bsd-2-clause | 645 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("utilities", "doctype", "address")
webnotes.conn.auto_commit_on_many_writes = True
for lead in webnotes.conn.sql("""select name as lead, lead_name,... | Yellowen/Owrang | patches/june_2013/p10_lead_address.py | Python | agpl-3.0 | 1,899 |
"""
Run gdb with:
gdb -ex 'source factory-test.py' -ex 'target remote localhost:3333' -ex 'break orchardShellRestart' -ex 'continue' -ex 'testpane' build/orchard.elf
"""
import gdb
import sys
import gtk
def run_test(test_name, test_type):
tests = list_tests()
test_index = tests.index(test_name)
testidx = ... | bunnie/chibios-orchard | orchard/factory-test.py | Python | gpl-3.0 | 3,923 |
from django.conf.urls import include, url
from django.views.generic.base import RedirectView
from cms.models import *
from cms.views import show
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
url(r'^$', show,{'slug':"/%s"%settings.HOME_... | eliasfernandez/django-simplecms | cms/urls.py | Python | bsd-2-clause | 537 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 7, transform = "Logit", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingAverage/cycle_7/ar_/test_artificial_128_Logit_MovingAverage_7__20.py | Python | bsd-3-clause | 264 |
#!/usr/bin/env python
# Author Version Date
# -----------------------------------------------
# Keith Smith (Nottingham) 0.8 23 Nov 2007
# Module for finding SALT guide star
# - full changelog is in /doc/changelog.txt
# - manual is (will be?) in /doc/manual.txt
__version__ = "0.8"
__... | crawfordsm/pysalt | plugins/guide_stars.py | Python | bsd-3-clause | 20,834 |
#!/usr/bin/env python
from __future__ import print_function
import rospy
import sys
import mavros
import argparse
import threading
from std_msgs.msg import Float64
from mavros.utils import*
#latitude = hold2[0].latitude
#longitude = hold2[0].longitude
#altitude = hold2[0].altitude
#latitude = 7
#longitude = 6
#alti... | medhijk/soi_waypoint_work | scripts/deprecated/altitude_node_new.py | Python | bsd-3-clause | 4,179 |
from dream.plugins import plugin
from pprint import pformat
from copy import copy, deepcopy
import json
import time
import random
import operator
import xmlrpclib
import signal
from multiprocessing import Pool
# # run an ant in a subrocess. Can be parrallelized.
# def runAntInSubProcess(ant):
# ant['result'] = plugi... | nexedi/dream | dream/plugins/Enumeration.py | Python | gpl-3.0 | 3,711 |
#!/usr/bin/env python
'''
Mulliken population analysis with NAO
'''
import numpy
from pyscf import gto, scf, lo
from functools import reduce
x = .63
mol = gto.M(atom=[['C', (0, 0, 0)],
['H', (x , x, x)],
['H', (-x, -x, x)],
['H', (-x, x, -x)],
... | gkc1000/pyscf | examples/local_orb/01-pop_with_nao.py | Python | apache-2.0 | 997 |
"""
The various HTTP responses for use in returning proper HTTP codes.
"""
from django.http import HttpResponse
class HttpCreated(HttpResponse):
status_code = 201
def __init__(self, *args, **kwargs):
location = kwargs.pop('location', '')
super(HttpCreated, self).__init__(*args, **kwargs)
... | hzlf/openbroadcast | website/apps/tastypie__/http.py | Python | gpl-3.0 | 1,267 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set fileencodings=utf-8
import os
import re
import sys
import csv
import ast
import json
import argparse
import calendar
from types import *
from datetime import datetime
class NotSupportedError(NotImplementedError):
pass
class InputConverter(object):
def... | crate/crate-utils | migrations/mysql/csv2json.py | Python | apache-2.0 | 2,610 |
import unittest
from queue import Queue
import os
from bears.general.IndentationBear import IndentationBear
from bears.general.AnnotationBear import AnnotationBear
from coala_utils.string_processing.Core import escape
from coalib.settings.Section import Section
from coalib.settings.Setting import Setting
class Inden... | mr-karan/coala-bears | tests/general/IndentationBearTest.py | Python | agpl-3.0 | 9,764 |
# Copyright 2015 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 or agreed to in writing, ... | GoogleCloudPlatform/SourceXCloud | lib/sxc/actuator.py | Python | apache-2.0 | 1,235 |
import json
import uuid
import functions
import flask
import httplib2
import requests
from flask import Flask
from apiclient import discovery
from oauth2client import client
app = Flask(__name__)
# CLIENT_SECRETS, name of a file containing the OAuth 2.0 information for this
# application, including client_id and ... | Kraxi/YTplaylist | playlist.py | Python | gpl-2.0 | 1,868 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Cédric Krier
# 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 License, or
# (at your opt... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/health_nursing/setup.py | Python | gpl-3.0 | 3,333 |
# Django settings for Django Generic Counter project.
import os
from tempfile import gettempdir
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.jo... | 0x07Ltd/django-generic-counter | tests/settings14.py | Python | unlicense | 5,470 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.