code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
# (c) 2016, Indrajit Raychaudhuri <irc+code@indrajit.com>
#
# Based on homebrew (Andrew Dunham <andrew@du.nham.ca>)
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the... | andreaso/ansible | lib/ansible/modules/packaging/os/homebrew_tap.py | Python | gpl-3.0 | 7,344 |
"""
This file tests some of the YAML files in the maxout paper
"""
import os
import pylearn2
from pylearn2.datasets import control
from pylearn2.datasets.mnist import MNIST
from pylearn2.termination_criteria import EpochCounter
from pylearn2.testing.skip import skip_if_no_gpu
from pylearn2.utils.serial import load_tra... | fyffyt/pylearn2 | pylearn2/scripts/papers/maxout/tests/test_mnist.py | Python | bsd-3-clause | 1,773 |
#!/usr/bin/python
# Copyright 2017 Google Inc.
# 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',
'status': ['preview'],
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/google/gcp_healthcheck.py | Python | bsd-3-clause | 15,554 |
import re
import subprocess
def remove_long_path():
path = 'mtrand.c'
pat = re.compile(r'"[^"]*mtrand\.pyx"')
code = open(path).read()
code = pat.sub(r'"mtrand.pyx"', code)
open(path, 'w').write(code)
def main():
subprocess.check_call(['cython', 'mtrand.pyx'])
remove_long_path()
if __n... | numpy/numpy-refactor | numpy/random/mtrand/generate_mtrand_c.py | Python | bsd-3-clause | 352 |
# ===--- SwiftIntTypes.py ----------------------------*- coding: utf-8 -*-===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.t... | aschwaighofer/swift | utils/SwiftIntTypes.py | Python | apache-2.0 | 3,655 |
from __future__ import print_function, division
from .cartan_type import Standard_Cartan
from sympy.core.compatibility import range
from sympy.matrices import eye
class TypeB(Standard_Cartan):
def __new__(cls, n):
if n < 2:
raise ValueError("n can not be less than 2")
return Standard_... | Davidjohnwilson/sympy | sympy/liealgebras/type_b.py | Python | bsd-3-clause | 4,651 |
def func():
import module
module
# <ref> | ahb0327/intellij-community | python/testData/addImport/localImportInlineFunctionBody.after.py | Python | apache-2.0 | 58 |
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from __future__ import unicode_literals... | boxed/CMi | web_frontend/send2trash/plat_win.py | Python | mit | 1,660 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import itertools
import tempfile
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
callable_default_counter = itertools.count()
callable_def... | hackerbot/DjangoDev | tests/forms_tests/models.py | Python | bsd-3-clause | 3,657 |
from django.conf import settings
from django.core.handlers.base import get_path_info
from django.core.handlers.wsgi import WSGIHandler
from django.utils.six.moves.urllib.parse import urlparse
from django.utils.six.moves.urllib.request import url2pathname
from django.contrib.staticfiles import utils
from django.contrib... | edisonlz/fruit | web_project/base/site-packages/django/contrib/staticfiles/handlers.py | Python | apache-2.0 | 2,440 |
# Copyright (c) 2011, Apple Inc. All rights reserved.
# Copyright (c) 2009, 2011, 2012 Google 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:
#
# * Redistributions of source code must ret... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/common/config/committers.py | Python | bsd-3-clause | 11,526 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | diogocs1/comps | web/addons/mrp/wizard/mrp_workcenter_load.py | Python | apache-2.0 | 2,222 |
# -*- coding: utf-8 -*-
"""
pygments.styles.vs
~~~~~~~~~~~~~~~~~~
Simple style with MS Visual Studio colors.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Co... | emineKoc/WiseWit | wisewit_front_end/node_modules/pygmentize-bundled/vendor/pygments/pygments/styles/vs.py | Python | gpl-3.0 | 1,073 |
import socket
import subprocess
import sys
import time
import h11
import pytest
import requests
@pytest.fixture
def turq_instance():
return TurqInstance()
class TurqInstance:
"""Spins up and controls a live instance of Turq for testing."""
def __init__(self):
self.host = 'localhost'
#... | vfaronov/turq | tests/conftest.py | Python | isc | 3,212 |
#
# This is the library part of Anita, the Automated NetBSD Installation
# and Test Application.
#
import os
import pexpect
import re
import string
import subprocess
import sys
import time
import urllib
import urlparse
__version__='1.43'
# Your preferred NetBSD FTP mirror site.
# This is used only by the obsolete co... | utkarsh009/anita | anita.py | Python | isc | 82,722 |
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied, ValidationError
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponseRedirect
from django.utils.decorators import method_decorator
from django.views.generic import DetailView
f... | CarlFK/wafer | wafer/talks/views.py | Python | isc | 3,564 |
# -*- coding: utf-8 -*-
# EForge project management system, Copyright © 2010, Element43
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWA... | oshepherd/eforge | eforge/vcs/models.py | Python | isc | 2,863 |
from argparse import ArgumentParser
import socket
import struct
import sys
import threading
import time
from ._fakeds import FakeDS
__all__ = ["Netconsole", "main", "run"]
def _output_fn(s):
sys.stdout.write(
s.encode(sys.stdout.encoding, errors="replace").decode(sys.stdout.encoding)
)
sys.stdo... | robotpy/pynetconsole | netconsole/netconsole.py | Python | isc | 6,782 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# girc documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 10 20:20:32 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | DanielOaks/girc | docs/conf.py | Python | isc | 10,875 |
from funktional.layer import Layer, Dense, StackedGRU, StackedGRUH0, Convolution1D, \
Embedding, OneHot, clipped_rectify, sigmoid, steeper_sigmoid, tanh, CosineDistance,\
last, softmax3d, params, Attention
from funktional.rhn import StackedRHN0
import funktiona... | gchrupala/reimaginet | imaginet/defn/audiovis_rhn.py | Python | mit | 5,671 |
def sum(*args):
total = 0
for number in args:
if isinstance(number, int):
total += number
return total
print(sum(1,5)) | Fuchida/Archive | albme-py/script.py | Python | mit | 150 |
"""
File: base.py
Author: Me
Email: yourname@email.com
Github: https://github.com/yourname
Description:
"""
from datetime import timedelta
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_... | elastic7327/django-tdd-restful-api | src/posts/tests/base.py | Python | mit | 1,621 |
from __future__ import print_function
import numpy as np
import turtle
from argparse import ArgumentParser
from base64 import decodestring
from zlib import decompress
# Python 2/3 compat
try:
_input = raw_input
except NameError:
_input = input
'''TODO:
* add a matplotlib-based plotter
* add a path export functi... | perimosocordiae/pyhrm | extract_images.py | Python | mit | 2,304 |
"""Test cltk.prosody."""
__license__ = 'MIT License. See LICENSE.'
from cltk.prosody.latin.scanner import Scansion as ScansionLatin
from cltk.prosody.latin.clausulae_analysis import Clausulae
from cltk.prosody.greek.scanner import Scansion as ScansionGreek
from cltk.prosody.latin.macronizer import Macronizer
import u... | TylerKirby/cltk | cltk/tests/test_nlp/test_prosody.py | Python | mit | 3,978 |
from .. import __description__
from ..defender import VkRaidDefender, data, update_data
####################################################################################################
LOGO = '''\
_ _ _ _ __ _
__ _| | __ _ __ __ _(_) __| | __| | ___ / _| __... | r4rdsn/vk-raid-defender | vk_raid_defender/cli/cli.py | Python | mit | 7,730 |
'''
GameData.py
Last Updated: 3/16/17
'''
import json, os
import numpy as np
import pygame as pg
from GameAssets import GameAssets as ga
class GameData():
"""
GameData class is used to stores game state information.
"""
def __init__(self):
'''
Method initiates game state variables.
... | rz4/SpaceManBash | src/GameData.py | Python | mit | 8,056 |
"Usage: unparse.py <path to source file>"
import sys
import ast
import cStringIO
import os
# Large float and imaginary literals get turned into infinities in the AST.
# We unparse those infinities to INFSTR.
INFSTR = "1e" + repr(sys.float_info.max_10_exp + 1)
def interleave(inter, f, seq):
"""Call f on each item ... | h2oloopan/easymerge | EasyMerge/merger/unparse.py | Python | mit | 24,407 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup file for youtube_podcaster.
This file was generated with PyScaffold 2.4.2, a tool that easily
puts up a scaffold for your new Python project. Learn more under:
http://pyscaffold.readthedocs.org/
"""
import sys
from setuptools import setup
def s... | tomvanderlee/youtube-podcaster | setup.py | Python | mit | 660 |
#!/usr/bin/env python2.7
# -*- mode: python; coding: utf-8; -*-
"""Module for generating lexicon using Rao and Ravichandran's method (2009).
"""
##################################################################
# Imports
from __future__ import unicode_literals, print_function
from blair_goldensohn import build_mtx... | WladimirSidorenko/SentiLex | scripts/rao.py | Python | mit | 8,962 |
# Copyright (c) 2019 Valentin Valls <valentin.valls@esrf.fr>
# Copyright (c) 2020-2021 hippo91 <guillaume.peillex@gmail.com>
# Copyright (c) 2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2021 Pierre Sassoulas <pierre.sassoulas@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/astroid/astroid/brain/brain_scipy_signal.py | Python | mit | 2,437 |
# Copyright (C) 2011 Lukas Lalinsky
# Distributed under the MIT license, see the LICENSE file for details.
import re
import syslog
from logging import Handler
from logging.handlers import SysLogHandler
class LocalSysLogHandler(Handler):
"""
Logging handler that logs to the local syslog using the syslog modul... | lalinsky/mb2freedb | mb2freedb/utils.py | Python | mit | 2,120 |
"""
Q4- Write a Python function, odd, that takes in one number and returns True when the number is odd and False otherwise. You should use the % (mod) operator, not if. This function takes in one number and returns a boolean
"""
def odd( number ):
return number % 2 == 1
number = int( input( "Enter a number: ") )
p... | SuyashD95/python-assignments | Assignment 3/odd.py | Python | mit | 403 |
# 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, ... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/google/cloud/bigquery/client.py | Python | mit | 15,220 |
# encoding: utf-8
"""
Rules system.
"""
import copy
from operator import itemgetter
class RuleBase(object):
"""
All rules inherit from RuleBase. All rules needs a condition, a response.
RuleBase is the base model to all rules. with this class, the rules will can to access
to the main class (Gozokia)... | avara1986/gozokia | gozokia/core/rules.py | Python | mit | 7,566 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py | Python | mit | 56,685 |
import os
import sys
import numpy as np
from basic.common import checkToSkip
def process(options):
overwrite = options.overwrite
inputeFile = options.inputeFile
weightFile = options.weightFile
resultFile = options.resultFile
weightFile = os.path.join('result', weightFile)
weight... | danieljf24/cmrf | relevanceFusion.py | Python | mit | 1,905 |
"""
functions for evaluating spreadsheet functions
primary function is parse, which the rest revolves around
evaluate should be called with the full string by a parent program
A note on exec:
This uses the exec function repeatedly, and where possible, use of it
should be minimized, but the intention of this ... | TryExceptElse/pysheetdata | eval/parser.py | Python | mit | 4,789 |
# -*- coding: utf-8 -*-
import sys
PY2 = sys.version_info[0] == 2
if PY2:
long = long
unicode = unicode
basestring = basestring
from urllib import quote_plus, unquote_plus, quote, unquote
from urlparse import parse_qsl
else:
long = int
unicode = str
basestring = str
from urllib.... | sdispater/eloquent | eloquent/utils/__init__.py | Python | mit | 773 |
#! /usr/bin/env python2.5
# -*- coding: latin-1 -*-
import axiom_rules
import fact_groups
import instantiate
import pddl
import sas_tasks
import simplify
import sys
import PrecosatSolver
import copy
import os
import SASE_helper
import SolverAdapter
from SASE_helper import *
from SASE_base import *
import math
import s... | thierry1985/project-1022 | translate/STRIPS_SASE/SASE_plain.py | Python | mit | 20,076 |
# 主要是为了使用中文显示 app 于 admin 界面
default_app_config = 'bespeak_meal.apps.Bespeak_meal_config'
| zhengxinxing/bespeak_meal | __init__.py | Python | mit | 120 |
"""
Restores the uplifted horizons while restricting slip along the fault to the
specified azimuth.
"""
import numpy as np
import matplotlib.pyplot as plt
from fault_kinematics.homogeneous_simple_shear import invert_slip
import data
import basic
def main():
azimuth = data.fault_strike + 90
# azimuth = 304 # Pl... | joferkington/oost_paper_code | invert_slip_fixed_azimuth.py | Python | mit | 966 |
from itertools import product
from demos.auction_model import demo
def test02():
sellers = [4]
buyers = [100]
results = demo(sellers, buyers, time_limit=False)
expected_results = {100: 4, 4: 100}
for k, v in results.items():
assert expected_results[k] == v, "Hmmm... That's not right {}={}... | root-11/outscale | tests/auction_demo_tests.py | Python | mit | 2,607 |
#!/usr/bin/env python3
##### ##### ##### ##### #### ####
# # # # # # # # # # #### #### # # #
##### #### ##### ##### ##### # # # # ####
# # # # # # # # # # # # #
# # # # # # # # #### # #### # ####
#finds the password of a desired ... | jonDel/pyrarcr | old/pyrarcr-0.2.py | Python | mit | 2,210 |
import asyncio
import websockets
import duplex
rpc = duplex.RPC("json")
@asyncio.coroutine
def echo(ch):
obj, _ = yield from ch.recv()
yield from ch.send(obj)
rpc.register("echo", echo)
@asyncio.coroutine
def do_msgbox(ch):
text, _ = yield from ch.recv()
yield from ch.call("msgbox", text, async=True... | progrium/duplex | python/demo/demo.py | Python | mit | 626 |
import json
from app.api import bp
from app.easyCI.scheduler import GitlabCIScheduler
from flask import current_app, url_for, make_response, request
from werkzeug.local import LocalProxy
logger = LocalProxy(lambda: current_app.logger)
@bp.route('/dashboard/', methods=['GET'])
def dashboard():
url = url_for('api.... | znick/anytask | easyci2/flask/app/api/showDashboard.py | Python | mit | 1,107 |
"""Tests for Vizio config flow."""
from __future__ import annotations
from contextlib import asynccontextmanager
from datetime import timedelta
from typing import Any
from unittest.mock import call, patch
import pytest
from pytest import raises
from pyvizio.api.apps import AppConfig
from pyvizio.const import (
AP... | rohitranjan1991/home-assistant | tests/components/vizio/test_media_player.py | Python | mit | 25,064 |
'''
Copyright 2015-2020 HENNGE K.K. (formerly known as HDE, Inc.)
Licensed under MIT.
'''
import json
def read_event(path):
with open(path) as event:
data = json.load(event)
return data
| HDE/python-lambda-local | lambda_local/event.py | Python | mit | 206 |
import numpy as np
import matplotlib.pyplot as plt
import pymc as pm
def main():
sample_size = 100000
expected_value = lambda_ = 4.5
N_samples = range(1, sample_size, 100)
for k in range(3):
samples = pm.rpoisson(lambda_, size=sample_size)
partial_average = [samples[:i].mean() for i i... | noelevans/sandpit | bayesian_methods_for_hackers/LoLN_convergence_examples_ch04.py | Python | mit | 867 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-01-09 19:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('productdb', '0024_auto_20161227_1015'),
]
operations = [
migrations.AlterFi... | hoelsner/product-database | app/productdb/migrations/0025_auto_20170109_2017.py | Python | mit | 579 |
"""
This file includes commonly used utilities for this app.
"""
from datetime import datetime
today = datetime.now()
year = today.year
month = today.month
day = today.day
# Following are for images upload helper functions. The first two are used for product upload for the front and back.
# The last two are used f... | sunlaiqi/fundiy | src/shop/utils.py | Python | mit | 2,973 |
import pytest
from freezegun import freeze_time
import demistomock as demisto
integration_params = {
'url': 'http://test.com',
'credentials': {'identifier': 'test', 'password': 'pass'},
'fetch_time': '3 days',
'proxy': 'false',
'unsecure': 'false',
}
@pytest.fixture(autouse=True)
def set_mocks(m... | VirusTotal/content | Packs/PrismaCloud/Integrations/RedLock/RedLock_test.py | Python | mit | 5,638 |
""" Run this file to run bots as a standalone application, detached from the webapp """
from snoohelper.utils.teams import SlackTeamsController
TESTING = False
def main():
if not TESTING:
SlackTeamsController("teams.ini", 'snoohelper_master.db')
else:
SlackTeamsController("teams_test.ini", '... | Santi871/SnooHelper | standalone_bot.py | Python | mit | 381 |
f = open("io/data/file1")
print(f.read(5))
print(f.readline())
print(f.read())
| aitjcize/micropython | tests/io/file1.py | Python | mit | 79 |
from subprocess import check_call, call, Popen, PIPE
import os
import textwrap
import glob
os.putenv("DEBIAN_FRONTEND", "noninteractive")
#######
## Plumbing
#######
def get_output(cmd, **kwargs):
check = kwargs.pop("check", True)
kwargs["stdout"] = PIPE
p = Popen(cmd, **kwargs)
stdout, stderr = p.c... | akx/requiem | requiem.py | Python | mit | 2,960 |
# Python stubs generated by omniidl from /usr/local/share/idl/omniORB/COS/CosRelationships.idl
# DO NOT EDIT THIS FILE!
import omniORB, _omnipy
from omniORB import CORBA, PortableServer
_0_CORBA = CORBA
_omnipy.checkVersion(4,2, __file__, 1)
try:
property
except NameError:
def property(*args):
retur... | amonmoce/corba_examples | omniORBpy-4.2.1/build/python/COS/CosRelationships_idl.py | Python | mit | 42,484 |
from direction import Direction, Pivot
XMovement = {
Direction.left: -1,
Direction.up: 0,
Direction.right: 1,
Direction.down: 0,
Direction.up_left: -1,
Direction.up_right: 1,
Direction.down_left: -1,
Direction.down_right: 1
}
YMovement = {
Direction.left: 0,
Direction.up: -1,
... | somebody1234/Charcoal | directiondictionaries.py | Python | mit | 2,433 |
from rich.console import Console
from rich.markdown import Markdown
from rich.syntax import Syntax
def process_syntax(code, lang, theme, line_numbers, code_width, word_wrap):
syntax = Syntax(
code,
lang,
theme=theme,
line_numbers=line_numbers,
code_width=code_width,
... | seleniumbase/SeleniumBase | seleniumbase/console_scripts/rich_helper.py | Python | mit | 1,219 |
""" Sorted input and output.
"""
from collections import deque
from operator import itemgetter
from .buffer import _ReaderBuffer
from .buffer import _WriterBuffer
__all__ = "SortReader", "SortWriter"
class _Sorter(object):
""" Abstract base class for SortReader and SortWriter.
"""
def __init__(se... | mdklatt/serial-python | src/serial/core/sort.py | Python | mit | 3,047 |
# Make your image, region, and location changes then change the from-import
# to match.
from configurables_akeeton_desktop import *
import hashlib
import java.awt.Toolkit
import json
import os
import shutil
import time
Settings.ActionLogs = True
Settings.InfoLogs = True
Settings.DebugLogs = True
Set... | akeeton/MTGO-scry-bug-test | MTGO-scry-bug-test.sikuli/MTGO-scry-bug-test.py | Python | mit | 5,599 |
import logging
from logging.handlers import RotatingFileHandler
import os
from appdirs import user_cache_dir
def configure_logging():
cache_dir = user_cache_dir(appname='spoppy')
LOG_FILE_NAME = os.path.join(
cache_dir, 'spoppy.log'
)
LOG_LEVEL = getattr(
logging,
os.getenv(... | sindrig/spoppy | spoppy/logging_utils.py | Python | mit | 1,088 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2016 <Jamie McGowan> <jamiemcgowan.dev@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... | byohay/Remarkable | remarkable/AboutRemarkableDialog.py | Python | mit | 1,798 |
"""
SoftLayer.tests.CLI.modules.file_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
from SoftLayer import exceptions
from SoftLayer import testing
import json
import mock
class FileTests(testing.TestCase):
def test_access_list(self):
result = ... | kyubifire/softlayer-python | tests/CLI/modules/file_tests.py | Python | mit | 28,087 |
#! /usr/bin/env python
"""
Module with simplex (Nelder-Mead) optimization for defining the flux and
position of a companion using the Negative Fake Companion.
"""
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from .simplex_fmerit import c... | henry-ngo/VIP | vip_hci/negfc/simplex_optim.py | Python | mit | 16,676 |
import unittest
import syzoj
import hashlib
from random import randint
class TestRegister(unittest.TestCase):
def md5_pass(self, password):
md5 = hashlib.md5()
md5.update(password)
return md5.hexdigest()
def test_register(self):
user = "tester_%d" % randint(1, int(1e9))
... | cdcq/jzyzj | test/test_controller.py | Python | mit | 932 |
#!/usr/bin/python
#
# Request for symbolList. Currently RFA only support refresh messages
# for symbolList. Hence, polling is required and symbolListRequest is called
# internally by getSymbolList.
#
# IMAGE/REFRESH:
# ({'MTYPE':'REFRESH','RIC':'0#BMD','SERVICE':'NIP'},
# {'ACTION':'ADD','MTYPE':'IMAGE','SERVICE':... | devcartel/pyrfa | examples/symbollist.py | Python | mit | 814 |
def RGB01ToHex(rgb):
"""
Return an RGB color value as a hex color string.
"""
return '#%02x%02x%02x' % tuple([int(x * 255) for x in rgb])
def hexToRGB01(hexColor):
"""
Return a hex color string as an RGB tuple of floats in the range 0..1
"""
h = hexColor.lstrip('#')
return tuple([x... | bohdon/maya-pulse | src/pulse/scripts/pulse/colors.py | Python | mit | 381 |
from _pydev_runfiles import pydev_runfiles_xml_rpc
import pickle
import zlib
import base64
import os
from pydevd_file_utils import canonical_normalized_path
import pytest
import sys
import time
try:
from pathlib import Path
except:
Path = None
#==================================================... | glenngillen/dotfiles | .vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_pytest2.py | Python | mit | 10,660 |
from __future__ import print_function
import time
import numpy as np
from mpi4py import MPI
from python_compat import range
comm = MPI.COMM_WORLD
def r_print(*args):
"""
print message on the root node (rank 0)
:param args:
:return:
"""
if comm.rank == 0:
print('ROOT:', end=' ')
... | yishayv/lyacorr | mpi_helper.py | Python | mit | 2,068 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
readme = f.read()
requirements = [
'prov>=1.5.3',
]
test_require... | sanguillon/voprov | setup.py | Python | mit | 1,855 |
import pandas as pd
from sklearn import model_selection
from sklearn.ensemble import RandomForestClassifier
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data"
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
df = pd.read_c... | sindresf/The-Playground | Python/Machine Learning/ScikitClassifiers/Classifiers/Random_Forrest_Classification.py | Python | mit | 724 |
# -*- coding: utf-8 -*-
#
# scikit-learn documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 8 09:13:42 2010.
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | jbogaardt/chainladder-python | docs/conf.py | Python | mit | 8,890 |
from python.equal import Equal
def count_steps_test():
equal_instance = Equal()
array_a = [2, 2, 3, 7]
array_b = [53, 361, 188, 665, 786, 898, 447, 562, 272, 123, 229, 629, 670,
848, 994, 54, 822, 46, 208, 17, 449, 302, 466, 832, 931, 778,
156, 39, 31, 777, 749, 436, 138, 289... | AppliedAlgorithmsGroup/leon-lee | test/python/equal_tests.py | Python | mit | 4,152 |
from textwrap import dedent
from pprint import pformat
from collections import OrderedDict
import attr
from . import sentinel
from .ordering import Ordering
# adapted from https://stackoverflow.com/a/47663099/1615465
def no_default_vals_in_repr(cls):
"""Class decorator on top of attr.s that omits attributes from... | ricklupton/sankeyview | floweaver/sankey_definition.py | Python | mit | 9,779 |
# imports/modules
import os
import random
import json
import collections
from PIL import Image
# Convert (r, g, b) into #rrggbb color
def getRGBstring( (r, g, b) ):
s = "#"
s = s + format(r, '02x')
s = s + format(g, '02x')
s = s + format(b, '02x')
return s
def do_compute():
# Open the image
origImgFile = ... | CS205IL-sp15/workbook | demo_colorFreq_start/py/compute.py | Python | mit | 594 |
# Sample Python/Pygame Programs
# Simpson College Computer Science
# http://cs.simpson.edu
import pygame
# Define some colors
black = ( 0, 0, 0)
white = ( 255, 255, 255)
green = ( 0, 255, 0)
red = ( 255, 0, 0)
pygame.init()
# Set the height and width of the screen
size=[700,500]
screen=... | tapomayukh/projects_in_python | sandbox_tapo/src/refs/Python Examples_Pygame/Python Examples/pygame_base_template.py | Python | mit | 1,067 |
# -*- coding: utf-8 -*-
#
# makeenv documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 27 21:24:26 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | 0compute/makeenv | doc/conf.py | Python | mit | 8,696 |
from .Commerce import Commerce
from .Transaction import Transaction
| lexotero/python-redsys | redsys/__init__.py | Python | mit | 68 |
"""sandbox URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | nshafer/django-hashid-field | sandbox/sandbox/urls.py | Python | mit | 1,076 |
# -*- coding: utf-8 -*-
from django.db import models
from tweets.models import Tweet
class Tag(models.Model):
name = models.CharField(max_length=255, unique=True, db_index=True)
is_hashtag = models.BooleanField(default=False)
tweets = models.ManyToManyField(Tweet, related_name='tags')
class Meta:
... | kk6/onedraw | onedraw/tags/models.py | Python | mit | 345 |
'''A module containing a class for storing Creature objects in a
SQLite database.'''
import csv
import sqlite3
__all__ = ['CreatureDB']
class CreatureDB(object):
'''Class for storing Creature objects in a SQLite database.'''
def __init__(self, name='creature.db', use_nominal_cr=False):
self.... | lot9s/pathfinder-rpg-utils | data-mining/bestiary/db/creatureDB.py | Python | mit | 6,403 |
# Faça um Programa que pergunte quanto você ganha por hora
# e o número de horas trabalhadas no mês. Calcule e mostre o
# total do seu salário no referido mês.
salarioXhoras = float(input('Quanto voce ganha por hora? '))
horas = float(input('Quantas horas trabalhadas? '))
salario = horas * salarioXhoras
print('Voce g... | GlauberGoncalves/Python | Lista PythonBrasil/exer08.py | Python | mit | 378 |
from django_group_by import GroupByMixin
from django.db.models.query import QuerySet
class BookQuerySet(QuerySet, GroupByMixin):
pass
| kako-nawao/django-group-by | test_app/query.py | Python | mit | 141 |
#!/usr/bin/python
# ZetCode PyGTK tutorial
#
# This example shows how to use
# the Alignment widget
#
# author: jan bodnar
# website: zetcode.com
# last edited: February 2009
import gtk
import gobject
class PyApp(gtk.Window):
def __init__(self):
super(PyApp, self).__init__()
self.set_title(... | HPPTECH/hpp_IOSTressTest | Refer/Alignment.py | Python | mit | 995 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/QT/up-to-date.py | Python | mit | 4,303 |
from concurrent.futures import ThreadPoolExecutor
import os
import re
import gzip
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import logging
import mimetypes
from collections import defaultdict
from flask import url_for as flask_url_for
from flask import current_app, r... | spoqa/flask-s3 | flask_s3.py | Python | mit | 12,801 |
import os
import unittest
import zope.testrunner
from zope import component
from sparc.testing.fixture import test_suite_mixin
from sparc.testing.testlayer import SPARC_INTEGRATION_LAYER
from sparc.db.splunk.testing import SPARC_DB_SPLUNK_INTEGRATION_LAYER
from zope import schema
from zope.interface import Interface
c... | davisd50/sparc.db | sparc/db/splunk/tests/test_kvstore.py | Python | mit | 5,425 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-12 02:22
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('operation_finance', '0020_auto_20170711_1429'),
]
operations = [
... | michealcarrerweb/LHVent_app | operation_finance/migrations/0021_auto_20170712_0222.py | Python | mit | 519 |
# -*- coding: utf -8*-
from setuptools import setup
setup(
name="linked list, stack, double linked list, queue, deque implementation",
description="This package implements a linked list",
version=0.1,
license='MIT',
author="Steven Than, Tatiana Weaver",
author_email="email@email.com",
py_mo... | tanyaweaver/data-structures | setup.py | Python | mit | 496 |
import collections
CmdArgs = collections.namedtuple('CmdArgs', ['split_channels', 'merge', 'image', 'prefix', 'list', 'layer'])
| tiagoshibata/exrsplit | tests/cmdargs.py | Python | mit | 129 |
#! /usr/local/bin/python -u
# Given an array and a value, remove all instances of that value in place and return the new length.
# The order of elements can be changed. It doesn't matter what you leave beyond the new length.
class Solution:
# @param A a list of integers
# @param elem an integer,... | textsaurabh/code_base | src/leetcode/script/remove_element_inplace.py | Python | mit | 815 |
#!/usr/bin/env python
import unittest
import pentai.base.human_player as h_m
import pentai.base.rules as r_m
import pentai.base.game as g_m
import pentai.ai.priority_filter as pf_m
import pentai.ai.utility_calculator as uc_m
from pentai.ai.ab_state import *
def get_black_line_counts(ab_game_state):
return ab_ga... | cropleyb/pentai | pentai/ai/t_ab_state.py | Python | mit | 13,516 |
# -*- coding: utf-8 -*-
"""
Created on Feb 09, 2018
@author: Tyranic-Moron
"""
from twisted.plugin import IPlugin
from pymoronbot.moduleinterface import IModule
from pymoronbot.modules.commandinterface import BotCommand, admin
from zope.interface import implementer
import re
from collections import OrderedDict
from ... | MatthewCox/PyMoronBot | pymoronbot/modules/admin/Admin.py | Python | mit | 5,227 |
DATA_DIR = '/media/d/ssd2/dstl/' | danzelmo/dstl-competition | global_vars.py | Python | mit | 32 |
import pygame, math
pygame.init()
window = pygame.display.set_mode((600, 600))
pygame.display.set_caption("Fractal Tree")
screen = pygame.display.get_surface()
def drawTree(x1, y1, angle, depth):
if depth:
x2 = x1 + int(math.cos(math.radians(angle)) * depth * 10.0)
y2 = y1 + int(math.sin(math.ra... | kantel/Virtuelle-Wunderkammer | sources/treepy/tree.py | Python | mit | 680 |
import time
from os import system
import bot as cleanBot
def pp(message, mtype='INFO'):
mtype = mtype.upper()
print '[%s] [%s] %s' % (time.strftime('%H:%M:%S', time.gmtime()), mtype, message)
def ppi(channel, message, username):
print '[%s %s] <%s> %s' % (time.strftime('%H:%M:%S', time.gmtime()), channel,... | paulperrone/twitch-IRC | lib/misc.py | Python | mit | 1,101 |
from kaleidoscope.event import DataEvent
from kaleidoscope.options.option_query import OptionQuery
class OptionChainIterator(object):
def __init__(self, data):
self.data = data
# get all quote dates that can be iterated
self.dates = sorted(data['quote_date'].unique())
# turn list ... | michaelchu/kaleidoscope | kaleidoscope/options/iterator/option_chain.py | Python | mit | 849 |
''' While x is less than 10 it will print x and add 1 to that number,
then print it and so on until that condition is false, which is
when x equals 10 '''
condition = input('Enter number: ')
x = int(condition)
print (' ')
print ('While loop:')
while x <= 10:
print (x)
x += 1
# will stop adding 1 w... | lastralab/Statistics | Specialization/Personal/Loops.py | Python | mit | 855 |
import balanced
balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY')
debit = balanced.Debit.fetch('/debits/WD5EW7vbyXlTsudIGF5AkrEA')
debit.description = 'New description for debit'
debit.meta = {
'facebook.id': '1234567890',
'anykey': 'valuegoeshere',
}
debit.save() | balanced/balanced-python | scenarios/debit_update/executable.py | Python | mit | 284 |
import re
def getText(data):
res = []
resString = ""
pattern = re.compile(r"\(?M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})\)(.*?)\. *\n", re.I)
iteratable = pattern.finditer(data)
newPattern = re.compile(r"\(?M{0,4}CM|CD|D?C{0,3}XC|XL|L?X{0,3}IX|IV|V?I{0,3}\)", re.I)
checkPattern = re.compile(r"\(?M{... | Utkarshdevd/summer14python | getText.py | Python | mit | 665 |
#!/usr/bin/env python
# Takes apart large IATI XML files and outputs one file per reporting org.
# Copyright 2013 Mark Brough.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3.0 as
# published by the Free Software Foundation, e... | markbrough/iati-country-tester | segment_ro.py | Python | mit | 3,383 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.