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 |
|---|---|---|---|---|---|
from sys import getdefaultencoding, version_info
from subprocess import Popen, PIPE
basestr = (str, unicode) if version_info[0] == 2 else (str,)
default_encoding = getdefaultencoding()
def run(*args, **kw):
p = Popen(stdout=PIPE, stderr=PIPE, shell=True, *args, **kw)
out, err = p.communicate()
ret = p.po... | gvalkov/git-link | gitlink/utils.py | Python | bsd-3-clause | 949 |
x = 'spam' if True else 42
| siosio/intellij-community | python/testData/formatter/spacesAroundElseInConditionalExpression_after.py | Python | apache-2.0 | 27 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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 appl... | lcy-seso/models | fluid/neural_machine_translation/rnn_search/infer.py | Python | apache-2.0 | 4,754 |
# coding=utf-8
from __future__ import division, print_function
import datetime as dt
import math
import os
import random
import faker
from vfp2py import vfpfunc
from vfp2py.vfpfunc import DB, Array, C, F, M, S, lparameters, parameters, vfpclass
@lparameters()
def MAIN():
pass
@lparameters()
def select_tests()... | mwisslead/vfp2py | testbed/test_lib.py | Python | mit | 13,352 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-12-28 00:48:23
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-12-28 00:48:35
import sys
import queue
class Vertex:
def __init__(self):
self.edges = {}
def get_edges(self):
return self.edges
... | zeyuanxy/hacker-rank | practice/algorithms/graph-theory/primsmstsub/primsmstsub.py | Python | mit | 1,583 |
# -*- coding: utf-8 -*-
'''
Insert documents from folder into the iatv_documents
collection in the metacorps database. That database is set by Flask
and flask-mongoengine in the
Flask config given in app.py for development purposes at this time.
After the documents are inserted then various corpora can be made from
th... | mtpain/metacorps | insert_iatv_docs.py | Python | bsd-3-clause | 6,893 |
"""
A machine profile object that holds all values for a specific profile.
"""
import json
import os
import re
import logging
def _getprofiledir(profiledir):
if None is profiledir:
profiledir = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'profiles') # Path of the profiles direc... | abinashk-inf/AstroBox | src/ext/makerbot_driver/profile.py | Python | agpl-3.0 | 2,567 |
def stopat42():
nums = []
while True:
i = raw_input()
if i == '42':
break
else:
nums.append(i)
return nums
if __name__ == "__main__":
nums=stopat42()
for n in nums: print n
| jamtot/HackerEarth | Problems/Life, the Universe, and Everything/42.py | Python | mit | 242 |
#!/usr/bin/env python
#
# Activity Learning
#
# Copyright (C) 2015 Tinghui Wang <tinghui.wang@wsu.edu>
#
# License: 3-Clause BSD
#
# Package Setup and Compilation
PACKAGE_NAME = 'actlearn'
PACKAGE_DISCRIPTION = 'Activity Learning Package'
MAINTAINER = 'Tinghui Wang (Steve)'
MAINTAINER_EMAIL = 'tinghui.wang@wsu.edu'
P... | TinghuiWang/ActivityLearning | setup.py | Python | bsd-3-clause | 2,520 |
from __future__ import absolute_import
from django.conf.urls import include, patterns, url
from horizon_contrib.forms.views import (CreateView,
UpdateView)
from horizon_contrib.generic.views import GenericIndexView
# override native horizon-contrib views
GenericIndexView.temp... | amboycharlie/Child-Friendly-LCMS | leonardo/module/web/urls.py | Python | apache-2.0 | 695 |
import sys
from typing import Any, Dict
import requests
WEATHER_URL = "http://api.wunderground.com/api"
JsonDict = Dict[str, Any]
class Weather:
def __init__(self, api_key: str) -> None:
self._api_key = api_key
self._full_location = self.get_location()
self.zipcode = self._full_location... | roghu/py3_projects | src/Web/weather.py | Python | mit | 1,553 |
#
# This script can be used to set up and start ScrabbleBot tournaments
# Use the players, num_rounds, and verbosity parameters to tweak
#
__author__ = 'Sebastian Wernicke'
# Import utilities
from ScrabbleBot import ScrabbleMatch
from ScrabbleBot import ScrabbleAI
# Import robots
from QUBot import QUBot
from GreedyB... | wernicke/ScrabbleBot | ScrabbleTournament.py | Python | mit | 849 |
#!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | googleartsculture/cluster-analysis | src/models/polygon.py | Python | apache-2.0 | 7,310 |
# Copyright 2015 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... | peterbraden/tensorflow | tensorflow/python/training/tensorboard_logging.py | Python | apache-2.0 | 5,312 |
"""Test kytos.lib.helpers module."""
import asyncio
from unittest import TestCase
from unittest.mock import MagicMock
from kytos.core.controller import Controller
from kytos.lib.helpers import (get_connection_mock, get_controller_mock,
get_interface_mock, get_kytos_event_mock,
... | kytos/kytos | tests/unit/test_lib/test_helpers.py | Python | mit | 3,813 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 version.
#
# This program is distrib... | oscurart/BlenderAddons | oscurart_select_intersect_faces_objects.py | Python | gpl-2.0 | 2,527 |
'''
This file is part of GEAR_mc.
GEAR_mc is a fork of Jeremie Passerin's GEAR project.
GEAR is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at... | miquelcampos/GEAR_mc | workgroup/Addons/gear/Application/Plugins/gear_synoptic/tabs/_common/hands_feet/layout.py | Python | lgpl-3.0 | 1,761 |
#!/usr/bin/env python
import os
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('pyMMFD', parent_package, top_path)
config.add_library('mmfd',
sources=[os.path.join('source', '*.f')])
config.add_e... | DailyActie/Surrogate-Model | 01-codes/pyOpt-1.2.0/pyOpt/pyMMFD/setup.py | Python | mit | 629 |
# 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
# distributed under the... | openstack/ironic-inspector | ironic_inspector/test/unit/test_plugins_capabilities.py | Python | apache-2.0 | 3,002 |
### refer Zhizheng and Simon's ICASSP'16 paper for more details
### http://www.zhizheng.org/papers/icassp2016_lstm.pdf
import numpy as np
import theano
import theano.tensor as T
from theano import config
from theano.tensor.shared_randomstreams import RandomStreams
class VanillaRNN(object):
""" This class impleme... | bajibabu/merlin | src/layers/gating.py | Python | apache-2.0 | 41,108 |
from __future__ import division, print_function, absolute_import
import logging
from dipy.utils.six import iteritems
from dipy.workflows.base import IntrospectiveArgumentParser
def get_level(lvl):
""" Transforms the loggin level passed on the commandline into a proper
logging level name.
"""
try:
... | nilgoyyou/dipy | dipy/workflows/flow_runner.py | Python | bsd-3-clause | 2,985 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_bulletbot
----------------------------------
Tests for `bulletbot` module.
"""
import os
import sys
import unittest
import bulletbot
from bulletbot.driver import SQLAlchemyDriver
from bulletbot.bulletbot import BulletBot
import logging
logging.root.setLevel(le... | millerjs/bulletbot | tests/test_bulletbot.py | Python | isc | 2,480 |
# vim: expandtab tabstop=4 shiftwidth=4
#
# Copyright (c) 2016 Christian Schmitz <tynn.dev@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License... | tynn/lunchdate.bot | impl/messenger/matching.py | Python | lgpl-3.0 | 4,411 |
# Copyright (c) 2005, XenSource Ltd.
import string, re, os
from xen.xend.server.blkif import BlkifController
from xen.xend.XendLogging import log
from xen.util.xpopen import xPopen3
phantomDev = 0;
phantomId = 0;
blktap1_disk_types = [
'aio',
'sync',
'vmdk',
'ram',
'qcow',
'qcow2',
'ioemu... | YongMan/Xen-4.3.1 | tools/python/xen/xend/server/BlktapController.py | Python | gpl-2.0 | 10,719 |
#!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | airbnb/airflow | scripts/ci/pre_commit/pre_commit_check_provider_yaml_files.py | Python | apache-2.0 | 14,097 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Envelopes/Unknown6.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.pro... | obiben/pokemongo-api | pogo/POGOProtos/Networking/Envelopes/Unknown6_pb2.py | Python | mit | 3,867 |
import os
from label_templates.sites import SiteLabels, SiteChoice
PROJECT_DIR = os.path.dirname(__file__)
BASE_DIR = PROJECT_DIR # setting present in new startproject
SITE_ID = 1
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sites',
'label_templates',
'tests.app',
]
ROOT_UR... | maykinmedia/django-label-loaders | tests/settings.py | Python | mit | 1,165 |
import os
import sys
import subprocess
from ConfigParser import ConfigParser
COMMIT_INFO_FNAME = 'COMMIT_INFO.txt'
def pkg_commit_hash(pkg_path):
''' Get short form of commit hash given directory `pkg_path`
There should be a file called 'COMMIT_INFO.txt' in `pkg_path`. This is a
file in INI file format,... | christianbrodbeck/nipype | nipype/pkg_info.py | Python | bsd-3-clause | 3,018 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import pickle
import unittest
try:
import simplejson as json
except ImportError:
import json
from optionaldict import optionaldict
class optionaldictTestCase(unittest.TestCase):
def test_init_with_none(self):
d = op... | messense/optionaldict | test_optionaldict.py | Python | mit | 1,545 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# l... | stormi/tsunami | src/primaires/scripting/fonctions/terrain.py | Python | bsd-3-clause | 1,997 |
# coding=utf-8
import unittest
from oslash.list import List
from oslash.util import identity, compose, fmap
pure = List.pure
unit = List.unit
empty = List.empty
class TestList(unittest.TestCase):
def test_list_null(self):
xs = empty()
assert xs.null()
def test_list_not_null_after_cons_and_t... | dbrattli/OSlash | tests/test_list.py | Python | apache-2.0 | 7,675 |
import os
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import filesizeformat
from django.db.models import FileField
from django.forms import forms
from django.core.exceptions import SuspiciousOperation
from django.utils._os import safe_join
from django.utils.encoding impo... | thoas/pybbm | pybb/fields.py | Python | bsd-2-clause | 5,267 |
def bubble_sort(lst):
output_list = list(lst)
n = 1
while n < len(output_list): # Сужаем неотсортированныю часть массива.
for i in range(len(
output_list) - n): # Сравниваем соседние элементы в этом цикле. Самые большие значения будут "оседать" в конце массива.
if outpu... | PavlovVitaly/python__homework_ITMO | task_02_02.py | Python | gpl-3.0 | 710 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RBfast(RPackage):
"""bfast: Breaks For Additive Season and Trend (BFAST)"""
homepage ... | LLNL/spack | var/spack/repos/builtin/packages/r-bfast/package.py | Python | lgpl-2.1 | 912 |
#!/usr/bin/env python
'''Same as abstract_masterpiece.py but uses a virtual plotter to view the ouptut.'''
from chiplotle import *
from chiplotle.tools.plottertools import instantiate_virtual_plotter
import random
def main():
plotter = instantiate_virtual_plotter(Coordinate(0, 0), Coordinate(30000, 20000))
... | drepetto/chiplotle | chiplotle/examples/abstract_masterpiece_virtual.py | Python | gpl-3.0 | 3,387 |
#!/usr/bin/env python3
# Copyright (c) 2013, Ruslan Baratov
# All rights reserved.
# Open files by extension
wiki='https://github.com/ruslo/configs/wiki/open.py-usage'
import argparse
import configparser
import os
import subprocess
import sys
import detail.command
import detail.os
import detail.os_detect
parser =... | ruslo/configs | python/open.py | Python | bsd-2-clause | 4,254 |
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
"""
Annalist action confirmation view definition
"""
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2014, G. Klyne"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
# impor... | gklyne/annalist | src/annalist_root/annalist/views/profile.py | Python | mit | 3,554 |
""" implement the TimedeltaIndex """
from datetime import datetime
import warnings
import numpy as np
from pandas._libs import (
NaT, Timedelta, index as libindex, join as libjoin, lib)
import pandas.compat as compat
from pandas.util._decorators import Appender, Substitution
from pandas.core.dtypes.common import... | GuessWhoSamFoo/pandas | pandas/core/indexes/timedeltas.py | Python | bsd-3-clause | 27,500 |
import os
import sys
import argparse
import math
import time
from struct import unpack, pack
import numpy as np
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import matplotlib
# matplotlib needs a window framework, lets use QT4
matplotlib.use('Qt4Agg')
from colors import *
import lineplot
PrintColors = (BRIGH... | trafferty/utils | python/Process_PSD.py | Python | gpl-2.0 | 7,904 |
"""
WSGI config for cg4 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cg4.settings")
from django.core.wsgi impo... | cybojenix/projects_reward_system | cg4/wsgi.py | Python | apache-2.0 | 381 |
class MoreninesError(Exception):
"""The base class for unrecoverable errors during morenines execution."""
class PathError(MoreninesError):
"""Errors involving user-supplied path arguments."""
def __init__(self, message, path, *args):
self.path = path
super(PathError, self).__init__(messa... | mcgid/morenines | morenines/exceptions.py | Python | mit | 697 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free ... | timvideos/flumotion | flumotion/component/producers/dvswitch/dvswitch.py | Python | lgpl-2.1 | 6,678 |
# -*- coding: utf-8 -*-
import sys, os, time
from Tools.HardwareInfo import HardwareInfo
def getVersionString():
return getImageVersionString()
def getImageVersionString():
try:
if os.path.isfile('/var/lib/opkg/status'):
st = os.stat('/var/lib/opkg/status')
else:
st = os.stat('/usr/lib/ipkg/status')
tm ... | 68foxboris/enigma2-openpli-vuplus | lib/python/Components/About.py | Python | gpl-2.0 | 4,073 |
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk, Gdk
class cTextResultWin(Gtk.Window):
def __init__(self, parent, caption, text):
super(cTextResultWin, self).__init__()
self.parent = parent
self.set_title(caption)
self.set_mo... | jtk1rk/xsubedit | gcustom/textResultWin.py | Python | gpl-3.0 | 1,272 |
import numpy
from chainer.utils import walker_alias # NOQA
# import class and function
from chainer.utils.conv import get_conv_outsize # NOQA
from chainer.utils.conv import get_deconv_outsize # NOQA
from chainer.utils.experimental import experimental # NOQA
from chainer.utils.walker_alias import WalkerAlias # N... | aonotas/chainer | chainer/utils/__init__.py | Python | mit | 1,058 |
#!/usr/bin/env python
"""
LDfeatureselect.py -
LD (Lang-Domain) feature extractor
Marco Lui November 2011
Based on research by Marco Lui and Tim Baldwin.
Copyright 2011 Marco Lui <saffsd@gmail.com>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
... | wikiteams/github-gender-studies | sources/gender_checker/deprecated/langid/train/LDfeatureselect.py | Python | mit | 4,805 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__init__.py
~~~~~~~~~~~
:copyright: (c) 2017 Archive Labs.
:license: see LICENSE for more details.
"""
__title__ = 'ia-iiif'
__version__ = '0.0.2'
__author__ = 'mek'
| mekarpeles/iiif.archive.org | iiify/__init__.py | Python | gpl-3.0 | 235 |
__author__ = 'beau'
import pyb
class PDM():
def __init__(self,pout='X11',tim=4,freq=50):
"""
:param pout: output pin nr
:param tim: timer number
:param freq: frequency of the bitstream
"""
self.max = 2**24-1#2**31-1 crashes with larger ints? 24bit resolution is fin... | B3AU/micropython | PDM.py | Python | lgpl-3.0 | 1,141 |
# -*- coding: utf-8; -*-
#
# @file eventmessage.py
# @brief Views related to the event message model.
# @author Frédéric SCHERMA (INRA UMR1095)
# @date 2016-09-01
# @copyright Copyright (c) 2016 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
from django.core.exceptions import SuspiciousOperation
from django.... | coll-gate/collgate | server/main/eventmessage.py | Python | mit | 4,137 |
# Yith Library Server is a password storage server.
# Copyright (C) 2012-2013 Yaco Sistemas
# Copyright (C) 2012-2013 Alejandro Blanco Escudero <alejandro.b.e@gmail.com>
# Copyright (C) 2012-2013 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is... | Yaco-Sistemas/yith-library-server | yithlibraryserver/user/schemas.py | Python | agpl-3.0 | 3,689 |
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... | nijinashok/sos | sos/plugins/dbus.py | Python | gpl-2.0 | 745 |
# gLifestream Copyright (C) 2013 Wojciech Polak
#
# 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... | wojciechpolak/glifestream | glifestream/wsgi.py | Python | gpl-3.0 | 976 |
import builtins as python_lib_Builtins
class Script:
@staticmethod
def main():
data = sys_io_File.getContent("crime_rates.csv")
print(str(data))
class haxe_io_Eof:
def toString(self):
return "Eof"
class sys_io_File:
@staticmethod
def getContent(path):
f = python_lib_Builtins.open(path,"r",-1,"utf... | ustutz/dataquest | Data_Analyst/Step_1_Introduction_to_Python/2_Files_and_loops/3_Reading_in_files/script.py | Python | mit | 401 |
class Model(object):
def __init__(self):
pass
| Azurras/Survithon | survive/generic/model.py | Python | mit | 58 |
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2015, David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
#-----------------------------------------------------------------------------
"""
IEEE 48-bit EUI (M... | DaKnOb/mwhois | netaddr/strategy/eui48.py | Python | mit | 8,693 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
from cfgm_common import jsonutils as json
import string
from provision_defaults import *
from cfgm_common.exceptions import *
from pysandesh.gen_py.sandesh.ttypes import SandeshLevel
class VncPermissions(object):
mode_str = {PERMS_R: ... | vpramo/contrail-controller | src/config/api-server/vnc_perms.py | Python | apache-2.0 | 3,590 |
'''
Copyright 2018 University of Michigan
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... | mozafari/verdict | pyverdict/tests/test_verdictcontext.py | Python | apache-2.0 | 4,044 |
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import EmailMessage, EmailMultiAlternatives
import base64
from postmark.core import PMMail, PMBatchMail
class PMEmailMessage(EmailMessage):
de... | themartorana/python-postmark | postmark/django_backend.py | Python | mit | 6,739 |
#!/usr/bin/env python
#
# Copyright 2010 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... | rolepoint/appengine-mapreduce | python/src/mapreduce/namespace_range.py | Python | apache-2.0 | 14,002 |
#<ImportSpecificModules>
import collections
import copy
import numpy
import tables
import os
import ShareYourSystem as SYS
import sys
#</ImportSpecificModules>
#<DefineLocals>
JoinStr='__'
JoinDeepStr='/'
BasingLocalTypeStr="Shaper"
BaseClass=getattr(SYS,SYS.getClassStrWithTypeStr(BasingLocalTypeStr))
#</DefineLocals>... | Ledoux/ShareYourSystem | Pythonlogy/ShareYourSystem/Standards/Modelers/Joiner/draft/Joiner copy 5.py | Python | mit | 19,202 |
#!/usr/bin/env python
import argparse
import time
import ray
from ray import tune
from ray.tune.schedulers import AsyncHyperBandScheduler
def evaluation_fn(step, width, height):
time.sleep(0.1)
return (0.1 + width * step / 100)**(-1) + height * 0.1
def easy_objective(config):
# Hyperparameters
wid... | richardliaw/ray | python/ray/tune/examples/async_hyperband_example.py | Python | apache-2.0 | 1,918 |
"""
Support for Wink sensors.
For more details about this platform, please refer to the documentation at
at https://home-assistant.io/components/sensor.wink/
"""
import logging
from homeassistant.const import (CONF_ACCESS_TOKEN, STATE_CLOSED,
STATE_OPEN, TEMP_CELSIUS)
from homeassista... | deisi/home-assistant | homeassistant/components/sensor/wink.py | Python | mit | 2,580 |
"""
# Notes:
- This simulation seeks to emulate the CUBA benchmark simulations of (Brette
et al. 2007) using the Brian2 simulator for speed benchmark comparison to
DynaSim. However, this simulation does NOT include synapses, for better
comparison to Figure 5 of (Goodman and Brette, 2008).
- The time taken to si... | asoplata/dynasim-benchmark-brette-2007 | Brian2/brian2_benchmark_CUBA_nosyn_compiled_250.py | Python | gpl-3.0 | 2,137 |
#-*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.contrib.auth import logout as django_logout, login as django_login, authenticate
from django.contrib.auth.models import User
from users.forms import LoginForm
from posts.models import Post
from users.forms import SignupForm
from django.cor... | jsmdev/Wordplease-Python-Django | users/views.py | Python | gpl-2.0 | 3,039 |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... | hanlind/nova | nova/policies/virtual_interfaces.py | Python | apache-2.0 | 1,114 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... | windskyer/nova | nova/db/api.py | Python | gpl-2.0 | 65,731 |
from __future__ import annotations
from typing import Union, List
from ..base import Base
class Column(Base):
_auto_increment: bool = None
_character_set: str = None
_collate: str = None
_column_type: str = None
_has_default: bool = False
_default: Union[str, int] = None
_length: Union[str, ... | cmancone/mygrations | mygrations/core/definitions/columns/column.py | Python | mit | 9,401 |
import json
from datetime import datetime
import mongoengine
from mongoengine import DoesNotExist
from users.models import CashTagUser
__author__ = '2b||!2b'
class Contribution(mongoengine.Document):
username = mongoengine.StringField()
amount = mongoengine.DecimalField()
cashtag_pk = mongoengine.String... | 2b-or-not-2b/hackathon-app | back/cashtag/models.py | Python | mit | 3,575 |
import time
from pprint import pprint
import pyeapi
def rm_vlan_func():
if '963' in current_vlans:
print 'VLAN 963 exists. Deleting now!'
pynet_sw3.config(rm_vlan)
else:
print "VLAN 963 does not exist"
def add_vlan_func():
if '963' in current_vlans:
print 'VLAN 963 already exists'
... | bonno800/pynet | class7/exercise2FIXED.py | Python | apache-2.0 | 960 |
class Solution(object):
def containsNearbyDuplicate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: bool
"""
hashmap = {}
for i in xrange(len(nums)):
if nums[i] not in hashmap:
hashmap[nums[i]] = i
elif i ... | hufeiya/leetcode | python/219_Contains_Duplicate_II.py | Python | gpl-2.0 | 449 |
# Tested on Python 2.7.6 on Max OS X 10 (Yosemite)
# Inbuilt
import sys
import datetime
import time
import sqlalchemy
import json
from pprint import pprint
# External
import dataset # https://dataset.readthedocs.org/en/latest/api.html
import requests # http://docs.python-requests.org/en/latest/
# API we're going to ... | antonylewis/blockstrap_downloader | blockstrap.py | Python | mit | 5,342 |
{"fs": {"link_test": {
"info": {
"name": "link_test",
"version": "0.1",
"date": "May 6, 2016",
"author": "Jeff Teeters",
"contact": "jteeters@berkeley.edu",
"description": "Test defining a link in an extension to debug schema_id."
},
"schema": {
"/analysis/": {
"aibs_spike_times/... | NeurodataWithoutBorders/api-python | examples/create_scripts/extensions/e-link_test.py | Python | bsd-3-clause | 1,604 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('sa_api_v2', '0003_auto_20160304_0527'),
]
operations = [
migrations.CreateModel(
na... | smartercleanup/api | src/sa_api_v2/migrations/0004_auto_20171027_0547.py | Python | gpl-3.0 | 1,740 |
def extractWwwBlsfeedCom(item):
'''
Parser for 'www.blsfeed.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterou... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWwwBlsfeedCom.py | Python | bsd-3-clause | 542 |
# -*- coding: utf-8 -*-
# @Author: Zachary Priddy
# @Date: 2016-06-23 15:45:29
# @Last Modified by: Zachary Priddy
# @Last Modified time: 2016-06-23 15:54:34
| zpriddy/Firefly | Firefly/devices/ffEcobee/__init__.py | Python | apache-2.0 | 162 |
# Copyright (c) 2016, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of ... | VectorBlox/PYNQ | python/pynq/iop/pmod_tmp2.py | Python | bsd-3-clause | 7,026 |
# Generated by Django 2.0.3 on 2018-08-08 11:55
from django.db import migrations, models
from django.utils import timezone
class Migration(migrations.Migration):
dependencies = [
('rsd', '0005_number_of_events_observation'),
]
operations = [
migrations.AddField(
model_name='e... | gis4dis/poster | apps/processing/rsd/migrations/0006_created_updated.py | Python | bsd-3-clause | 1,385 |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from jsrs.users.models import User
from jsrs.audio.models import Audio, Reader, Sentence
from .r import mdprefml, c5ml, biplot
from .thurstone import thurstone
impor... | borh/jsrs | jsrs/ratings/models.py | Python | mit | 15,560 |
# pylint: disable-msg=E0611
from __future__ import print_function
import sys
from PySide import QtCore, QtGui
from src.documentwatcher import DocumentWatcher
from src.geometrywidget import GeometryWidget
from src.cadfileparser import FcadParser
from src.printcapturecontext import PrintCaptureContext
from src.svggenera... | fablab-ka/OpenSCAD2D | src/openscad2d.py | Python | gpl-2.0 | 2,313 |
from django.apps import AppConfig as BaseAppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from imagekit import register
from .utils import load_path_attr
class AppConfig(BaseAppConfig):
name = "pinax.images"
label = "pinax_images"
verbose_name = _("Pinax ... | arthur-wsw/pinax-images | pinax/images/apps.py | Python | mit | 1,677 |
#
# Copyright (C) 2020 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be... | jkonecny12/anaconda | tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_scheduler.py | Python | gpl-2.0 | 33,004 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import find_packages, setup
from echoices import __version__
REPO_URL = "https://github.com/mbourqui/django-echoices/"
README = ''
for ext in ['md', 'rst']:
try:
with open(os.path.join(os.path.dirname(__file__), 'README.' + ext)) a... | mbourqui/django-echoices | setup.py | Python | gpl-3.0 | 1,934 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "constant", cycle_length = 7, transform = "sqrt", sigma = 0.0, exog_count = 100, ar_order = 12);
| antoinecarme/pyaf | tests/bugs/issue_34/test_artificial_1024_sqrt_constant_7_12_100.py | Python | bsd-3-clause | 261 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Ensure filenames for test-*.bash scripts match the config name registered
inside them.
"""
from __future__ import print_function
import os.path
import re
import sys
for line in sys.stdin.readlines():
filename, content = line.split(':', 1)
filename_parts = os... | CoryMcCartan/chapel | util/cron/verify_config_names.py | Python | apache-2.0 | 965 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/textlabels.py
__version__=''' $Id$ '''
import string
from reportlab.lib import colors
from reportlab.lib.utils import simpleSplit, _si... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/reportlab/graphics/charts/textlabels.py | Python | gpl-3.0 | 18,353 |
from flask_wtf import FlaskForm
from wtforms import validators, StringField, PasswordField, BooleanField
from wtforms.fields.html5 import EmailField
from frasco.i18n import lazy_translate
__all__ = ('LoginWithEmailForm', 'LoginWithUsernameForm', 'LoginWithIdentifierForm',
'Login2FAForm', 'SignupForm', 'Sig... | frascoweb/frasco | frasco/users/forms.py | Python | mit | 2,168 |
# from email import utils
# import math
import re
from backend.common.helpers.youtube_video_helper import YouTubeVideoHelper
from backend.common.models.match import Match
# import time
# import urllib
#
# from models.match import Match
defense_render_names_2016 = {
"A_ChevalDeFrise": "Cheval De Frise",
"A_Po... | the-blue-alliance/the-blue-alliance | src/backend/web/jinja2_filters.py | Python | mit | 4,054 |
#!/usr/bin/env python
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | hastef88/andes | modules/andes-core/systests/etc/bin/fail.py | Python | apache-2.0 | 3,242 |
"""
Tests for course_overviews app.
"""
from cStringIO import StringIO
import datetime
import ddt
import itertools
import math
import mock
from nose.plugins.attrib import attr
import pytz
from django.conf import settings
from django.test.utils import override_settings
from django.utils import timezone
from PIL import ... | romain-li/edx-platform | openedx/core/djangoapps/content/course_overviews/tests.py | Python | agpl-3.0 | 45,720 |
#
# Copyright (C) 2016 Dang Duong
#
# This file is part of Open Tux World.
#
# Open Tux World 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 op... | khanhduong95/Open-Tux-World | scripts/AI_player_check.py | Python | gpl-3.0 | 2,187 |
""" Implementation for account reader that gets data from the XDMoD datawarehouse """
from MySQLdb import OperationalError, ProgrammingError
from supremm.config import Config
from supremm.accounting import Accounting, ArchiveCache
from supremm.scripthelpers import getdbconnection
from supremm.Job import Job
from supre... | ubccr/supremm | src/supremm/xdmodaccount.py | Python | lgpl-3.0 | 20,327 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | iceman1989/Check_mk | modules/inventory.py | Python | gpl-2.0 | 10,134 |
#!/usr/bin/env python
#
# pylibssh2 - python bindings for libssh2 library
#
# Copyright (C) 2010 Wallix Inc.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of the Li... | shengqi158/pylibssh2 | examples/ssh_x11.py | Python | lgpl-2.1 | 5,501 |
"""
WSGI config for nomadgram project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`... | bokjk/nomadgram | config/wsgi.py | Python | mit | 1,669 |
"""prettyunit - prettysite views.py
Andrew Scott 10/21/2016"""
#pylint: disable=line-too-long, invalid-name, bare-except, broad-except
import json
import datetime
import logging
from flask import render_template, request
from prettysite import app, config
from prettysite.models import Suite, TestCase, Test, Project, P... | beatsbears/prettyunit | prettysite/views.py | Python | mit | 19,810 |
#!/usr/bin/env python3
from distutils.core import setup
from distutils.log import info
import distutils.command.install_data
import os, os.path, subprocess, sys
if os.path.abspath(os.path.curdir) != os.path.abspath(os.path.dirname(__file__)):
print("The 'setup.py' must be run in its containing directory!")
sy... | xflux-gui/xflux-gui | setup.py | Python | mit | 5,019 |
#!/usr/bin/python
# -*- coding: latin-1 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in t... | pronexo-odoo/odoo-argentina | l10n_ar_pyafipws/pyafipws/cot.py | Python | agpl-3.0 | 11,925 |
from mainsite.apps.evolvinglife import models
landgeography = models.Geography.objects.get(category = "land")
for x in range(0, 50):
for y in range (0, 50):
newpoint = models.GeographyPoint(x = x, y = y, geography = landgeography)
newpoint.save() | jack-song/evolving-life | mainsite/apps/evolvinglife/database/defaultmap.py | Python | mit | 253 |
# Converts xml / python names into java names and vice-versa
from sys import argv
import re
convert_to_java = '-toJava'
convert_to_xml = '-toXML'
associate_xml = '-a'
if len(argv) > 1 :
mode = argv[1]
if len(argv) > 2:
input_text = argv[2]
def convert_xml ( java ):
return re.sub(r'([a-z])([A-Z])', r'\1_\2', java... | zgrannan/Technical-Theatre-Assistant | scripts/nameConverter.py | Python | mit | 1,079 |
from django.contrib.auth.decorators import user_passes_test, login_required
from profiles.models import Musician, NonMusician
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import redirect
# import login_required user_passes_test
# these functions are made to be passed into user_passes_tes... | lancekrogers/music-network | cleff/custom_wrappers.py | Python | apache-2.0 | 1,287 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.