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 fabric.api import run, env, prompt, execute, sudo, open_shell, put
from fabric.contrib.project import rsync_project
from fabric.contrib.files import exists
import boto.ec2
import time
import os
env.aws_region = 'us-west-2'
env.hosts = ['localhost', ]
env.key_filename = '~/.ssh/pk-ins.pem'
env.myhost = 'ec2-54-1... | alibulota/Package_Installer | installer/fabfile.py | Python | mit | 6,507 |
__author__ = 'hs634'
from itertools import permutations, combinations
k = ["".join(i) for i in permutations("abc")]
print k
stuff = "abc"
for m in range(len(stuff)+1):
for i in combinations("abc", m):
print "".join(i)
def permute(s):
if s is None:
return None
return [s] if len(s) == 1 els... | hs634/algorithms | python/strings/permutation.py | Python | mit | 754 |
version = (1, 2, 0)
version_string = '.'.join(map(str, version))
| vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/django-auth-ldap-1.2.0/django_auth_ldap/__init__.py | Python | gpl-2.0 | 65 |
#!/usr/bin/env python
import sys
import socket
import getopt
import threading
import subprocess
# Define some global variables
listen = False
command = False
upload = False
execute = ""
target = ""
upload_destination = ""
port = 0
def usag... | Kediel/BHP | Ch. 2/bhnet.py | Python | mit | 6,352 |
#!/usr/bin/python
# interpolate scalar gradient onto nedelec space
from dolfin import *
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
Print = PETSc.Sys.Print
# from MatrixOperations import *
import numpy as np
#import matplotlib.pylab as plt
import PETScIO as IO
import common
import ... | wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/MHDstabtest3.py | Python | mit | 13,562 |
import unittest
from apidoc.service.source import Source as SourceService
from apidoc.object.source_raw import Root, Version, Parameter, Method
from apidoc.object.source_dto import Root as RootDto
from apidoc.factory.source.rootDto import Hydrator
class TestSource(unittest.TestCase):
def setUp(self):
se... | SolutionsCloud/apidoc | tests/unit/service/test_source.py | Python | gpl-3.0 | 1,460 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2020 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from __future__ import unicode_literals
import base64
import codecs
import datetime
from email import message_from_file
import hashlib
i... | sbidoul/pip | src/pip/_vendor/distlib/wheel.py | Python | mit | 42,943 |
# (c) 2017 Ansible By Red Hat
#
# 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 ... | sgerhart/ansible | lib/ansible/vars/reserved.py | Python | mit | 2,591 |
from typing import Type
import requests
from pydantic import BaseModel
from pyskroutz.client import SkroutzClient
class ApiResource:
_session: requests.Session
_client: SkroutzClient
BASE_URL: str = "https://api.skroutz.gr"
def __init__(self, client: SkroutzClient) -> None:
self._client = c... | sp1thas/pySkroutz | src/pyskroutz/resources/base.py | Python | gpl-2.0 | 1,413 |
'''
Created on Jun 26, 2013
@author: Jonas Zaddach <zaddach@eurecom.fr>
'''
import subprocess
def get_process_list():
processes = []
ps_output = subprocess.check_output(["ps", "-A", "-w", "-w", "-o", "pid", "-o", "command"])
ps_output = ps_output.decode('latin-1')
for line in ps_output.split("\n")[1:]... | jmatthed/avatar-python | avatar/util/processes.py | Python | apache-2.0 | 796 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, comma_or, nowdate, getdate
from frappe import _
from frappe.model.document import Document
def validate_sta... | ovresko/erpnext | erpnext/controllers/status_updater.py | Python | gpl-3.0 | 15,451 |
import sys
try:
import cProfile as profile
except ImportError:
import profile
import functools
import os.path
import pstats
from shimehari.shared import currentApp as current_app
from shimehari_debugtoolbar.panels import DebugPanel
from shimehari_debugtoolbar.utils import format_fname
class ProfilerDebugPane... | matsumos/shimehari-debugtoolbar | shimehari_debugtoolbar/panels/profiler.py | Python | bsd-3-clause | 3,658 |
from wt_translation.models import ServerlandHost, MachineTranslator, TranslationRequest, send_translation_requests
from pootle_store.models import Store, Unit, Suggestion
host = ServerlandHost.objects.all()[0]
host.fetch_translations()
| NickRuiz/wikitrans-pootle | tests/test_fetch_translations.py | Python | gpl-2.0 | 237 |
##############################################
# TOP-LEVEL PIPELINE CONTROL
##############################################
MAKE_MODELS = True
RUN_SA = True
DEBUG = True
output_directory = "../Test_Outputs"
modeling_description = "Car fuel-efficiency modeling"
##############################################
# DATA DESC... | MastenSpace/pysur | Examples/auto-mpg/config.py | Python | apache-2.0 | 1,697 |
# encoding: utf-8
import logging
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.db.utils import DatabaseError
from dimagi.utils.couch import sync_docs
from corehq.apps.userreports import models as userreports_models
from corehq.apps.userreports.sql import get_table_... | puttarajubr/commcare-hq | corehq/apps/userreports/migrations/0001_add_inserted_at_timestamp.py | Python | bsd-3-clause | 1,943 |
from __future__ import with_statement
from sympy import Matrix, Tuple, symbols, sympify, Basic, Dict, S, FiniteSet
from sympy.core.containers import tuple_wrapper
from sympy.utilities.pytest import raises, XFAIL
from sympy.core.compatibility import is_sequence, iterable
def test_Tuple():
t = (1, 2, 3, 4)
st =... | lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/core/tests/test_containers.py | Python | gpl-3.0 | 5,017 |
import datetime
import time
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Q
from django.db.models.signals import pre_save
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.auth.models import User
from tidings.models imp... | anushbmx/kitsune | kitsune/forums/models.py | Python | bsd-3-clause | 13,732 |
import cgi
from paste.urlparser import PkgResourcesParser
from pylons.middleware import error_document_template
from webhelpers.html.builder import literal
from quickcms.lib.base import BaseController
class ErrorController(BaseController):
"""Generates error documents as and when they are required.
The Erro... | CentroGeo/QuickCMS | quickcms/controllers/error.py | Python | gpl-2.0 | 1,672 |
from matplotlib import pyplot
import seaborn
import pandas
from wqio import utils
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
class Parameter(object):
def __init__(self, name, units, usingTex=False):
""" Class representing a single analytical parameter (p... | phobson/wqio | wqio/samples.py | Python | bsd-3-clause | 8,494 |
"""Groebner bases algorithms. """
from __future__ import print_function, division
from sympy.polys.monomials import monomial_mul, monomial_div, monomial_lcm, monomial_divides, term_div
from sympy.polys.orderings import lex
from sympy.polys.polyerrors import DomainError
from sympy.polys.polyconfig import query
from sy... | hrashk/sympy | sympy/polys/groebnertools.py | Python | bsd-3-clause | 23,280 |
from ray.rllib.utils.framework import try_import_torch
from ray.rllib.utils.framework import TensorType
torch, nn = try_import_torch()
class GRUGate(nn.Module):
"""Implements a gated recurrent unit for use in AttentionNet"""
def __init__(self, dim: int, init_bias: int = 0., **kwargs):
"""
in... | richardliaw/ray | rllib/models/torch/modules/gru_gate.py | Python | apache-2.0 | 1,760 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import FrozenInstanceError, dataclass
from hashlib import sha1
from typing import Any
from pants.base.payload_field import PayloadField
from pants.engine.platform import ... | tdyas/pants | src/python/pants/backend/native/targets/native_artifact.py | Python | apache-2.0 | 2,065 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="icicle.legendgrouptitle.font", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_... | plotly/plotly.py | packages/python/plotly/plotly/validators/icicle/legendgrouptitle/font/_color.py | Python | mit | 425 |
#
# 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... | ramineni/myironic | ironic/drivers/modules/drac/common.py | Python | apache-2.0 | 4,148 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | Vaidyanath/tempest | tempest/services/volume/v2/json/volumes_client.py | Python | apache-2.0 | 894 |
from pydgin.utils import trim_32
import epiphany.isa
#-----------------------------------------------------------------------
# nop16
#-----------------------------------------------------------------------
def execute_nop16(s, inst):
"""The instruction does nothing, but holds an instruction slot.
"""
s.p... | moreati/revelation | epiphany/execute_interrupt.py | Python | bsd-3-clause | 6,028 |
import unittest
from cockroach.call import Call
from cockroach.methods import Methods
from cockroach.proto import api_pb2
class CallTest(unittest.TestCase):
def test_reset_client_cmd_id(self):
call = Call(Methods.Increment, api_pb2.IncrementRequest())
call.reset_client_cmd_id()
self.asser... | abhishekgahlot/cockroach-python | cockroach/test_call.py | Python | apache-2.0 | 431 |
from javatests import Dict2JavaTest
import unittest, test.test_support
# Test the java.util.Map interface of org.python.core.PyDictionary.
# This tests the functionality of being able to pass a dictionaries
# created in Jython to a java method, and the ability to manipulate
# the dictionary object once in Java code. ... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/test/test_dict2java.py | Python | epl-1.0 | 5,947 |
# -*- coding: utf-8 -*-
"""
The module :mod:`openerp.tests.common` provides unittest2 test cases and a few
helpers and classes to write tests.
"""
import errno
import glob
import json
import logging
import os
import select
import subprocess
import threading
import time
import itertools
import unittest2
import urllib2
... | FlorianLudwig/odoo | openerp/tests/common.py | Python | agpl-3.0 | 14,148 |
# 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
# "License"); you may not u... | Mega-DatA-Lab/mxnet | tests/python/gpu/test_forward.py | Python | apache-2.0 | 2,972 |
# Note that all functions here assume django is available. So ensure
# this is the case before you call them.
def is_django_unittest(request_or_item):
"""Returns True if the request_or_item is a Django test case, otherwise False"""
from django.test import SimpleTestCase
cls = getattr(request_or_item, "c... | cloudera/hue | desktop/core/ext-py/pytest-django-3.10.0/pytest_django/django_compat.py | Python | apache-2.0 | 417 |
# Copyright 2018 The TensorFlow Probability Authors.
#
# 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... | tensorflow/probability | tensorflow_probability/examples/disentangled_vae_test.py | Python | apache-2.0 | 23,855 |
# Copyright 2019 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... | davidzchen/tensorflow | tensorflow/python/kernel_tests/linalg/sparse/csr_sparse_matrix_dense_mat_mul_grad_test.py | Python | apache-2.0 | 5,381 |
"""The Screenlogic integration."""
import asyncio
from datetime import timedelta
import logging
from screenlogicpy import ScreenLogicError, ScreenLogicGateway
from screenlogicpy.const import (
EQUIPMENT,
SL_GATEWAY_IP,
SL_GATEWAY_NAME,
SL_GATEWAY_PORT,
)
from homeassistant.config_entries import Config... | kennedyshead/home-assistant | homeassistant/components/screenlogic/__init__.py | Python | apache-2.0 | 6,104 |
import asyncio
import logging
import random
from collections import defaultdict
from again.utils import unique_hex
from functools import partial
from retrial.retrial import retry
from .packet import ControlPacket
from .protocol_factory import get_vyked_protocol
from .pinger import TCPPinger
def _retry_for_result(res... | sp1rs/vyked | vyked/registry_client.py | Python | mit | 6,600 |
import os
from route_model.config.master_config import MasterConfig
from bike_model.config.bike_choice_set_config import BikeChoiceSetConfig
class LinkEliminationMasterConfig(MasterConfig):
"""compile configuration data"""
def __init__(self, changes={}):
MasterConfig.__init__(self,changes)
self.choice_set_c... | sfcta/BikeRouter | Bike Model/bike_model/config/link_elimination_master_config.py | Python | gpl-3.0 | 412 |
from ctypes import POINTER, c_char_p, c_int, c_size_t, c_uint, c_bool, c_void_p
import enum
from llvmlite.binding import ffi
from llvmlite.binding.common import _decode_string, _encode_string
class Linkage(enum.IntEnum):
# The LLVMLinkage enum from llvm-c/Core.h
external = 0
available_externally = 1
... | numba/llvmlite | llvmlite/binding/value.py | Python | bsd-2-clause | 15,309 |
# coding=utf-8
from __future__ import division
from sorl.thumbnail.conf import settings
from sorl.thumbnail.helpers import toint
from sorl.thumbnail.parsers import parse_crop
from sorl.thumbnail.parsers import parse_cropbox
class EngineBase(object):
"""
ABC for Thumbnail engines, methods are static
"""
... | JordanReiter/sorl-thumbnail | sorl/thumbnail/engines/base.py | Python | bsd-3-clause | 8,093 |
import pytest
import requests
import hashlib
import sys
import os
import re
from PIL import Image
import dm3_lib as dm3
from tomviz.jsonrpc import jsonrpc_message
from .mock import test_image, test_dm3_tilt_series
from tomviz.acquisition.utility import tobytes
# Add mock modules to path
mock_dir = os.path.join(os.pat... | OpenChemistry/tomviz | acquisition/tests/passive_test.py | Python | bsd-3-clause | 7,427 |
# Copyright (C) 2007 Alexandre Conrad, alexandre (dot) conrad (at) gmail (dot) com
#
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import cgi
import warnings
import logging
from six import string_types
logger = logging.getLogger('formal... | FormAlchemy/formalchemy | formalchemy/forms.py | Python | mit | 36,884 |
#!/usr/bin/env python3
# Copyright (c) 2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test account RPCs.
RPCs tested are:
- getaccountaddress
- getaddressesbyaccount
- setaccount
... | appop/bitcoin | qa/rpc-tests/wallet-accounts.py | Python | mit | 3,307 |
# Copyright 2018 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... | aselle/tensorflow | tensorflow/python/keras/engine/training_eager.py | Python | apache-2.0 | 28,521 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-servicebus/azure/mgmt/servicebus/models/resource_namespace_patch.py | Python | mit | 1,536 |
#!/usr/bin/env python
'''To save memory, error/warning data is stored as a tuple:
element 0: MessageTupleAdaptor instance (immutable, shared across all errors/
warnings of the same type)
element 1: python memory address for the object or object reference
element 2: rich object address (i... | rvosa/peyotl | peyotl/nexson_validation/err_generator.py | Python | bsd-2-clause | 15,965 |
"""create index for querying messages by namespace and is_created
Revision ID: 576f5310e8fc
Revises: 3d4f5741e1d7
Create Date: 2015-05-19 15:47:16.760020
"""
# revision identifiers, used by Alembic.
revision = '576f5310e8fc'
down_revision = '3d4f5741e1d7'
from alembic import op
def upgrade():
op.create_index(... | nylas/sync-engine | migrations/versions/167_create_index_for_querying_messages_by_.py | Python | agpl-3.0 | 532 |
#!/usr/bin/env python
"""
common_elements.py
Find the common elements of 2 int arrays.
Author: Corwin Brown <blakfeld@gmail.com>
"""
from __future__ import print_function
import sys
def find_common_elements(list_a, list_b):
"""
Find the common elements in two arrays.
Args:
list_a (list): T... | blakfeld/Data-Structures-and-Algoritms-Practice | Python/general/common_elements.py | Python | mit | 540 |
class Solution:
def findPeakElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return None
if len(nums) == 1:
return 0
for i in range(0, len(nums)):
if i == 0:
if nums[i] > nums[i+1]:... | MingfeiPan/leetcode | array/162.py | Python | apache-2.0 | 647 |
'''
Module for accessing, analyzing and plotting calibration data'''
#
# History:
# 2014-Dec-11 DG
# First written (to analyze SOLPNTCAL scans)
# 2014-Dec-12 DG
# Lots of tweaks to make and beautify the plots. Lots more to do!
# 2014-Dec-14 DG
# Added delay after dump_tsys(), to allow ... | dgary50/eovsa | calibration_batch.py | Python | gpl-2.0 | 59,977 |
#!/usr/bin/env python
"""
Copyright (c) 2014-2022 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
import re
from core.common import retrieve_content
__url__ = "https://ransomwaretracker.abuse.ch/downloads/RW_URLBL.txt"
__check__ = "questions"
__info__ = ... | stamparm/maltrail | trails/feeds/ransomwaretrackerurl.py | Python | mit | 815 |
#!/usr/bin/env python
#Copyright (C) 2012 Niklas Thorne.
#This file is part of XMPPMote.
#
#XMPPMote 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 la... | nthorne/xmppmote | lib/guf/test/test_updater.py | Python | gpl-3.0 | 8,448 |
import os
from select import select
from subprocess import PIPE
import sys
import time
from itertools import chain
from plumbum.commands.processes import run_proc, ProcessExecutionError
from plumbum.commands.processes import BY_TYPE
import plumbum.commands.base
from plumbum.lib import read_fd_decode_safely
class Fut... | AndydeCleyre/plumbum | plumbum/commands/modifiers.py | Python | mit | 16,698 |
# Copyright 2020 Red Hat, 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 agr... | openstack/octavia | octavia/image/image_base.py | Python | apache-2.0 | 986 |
# -*- coding: utf-8 -*-
#
# Anaf documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 25 16:15:27 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.
#
# All co... | tovmeod/anaf | doc/conf.py | Python | bsd-3-clause | 7,134 |
"""Random variable generators.
integers
--------
uniform within range
sequences
---------
pick random element
pick random sample
generate random permutation
distributions on the real line:
------------------------------
uniform
... | 2015fallproject/2015fallcase1 | static/Brython3.2.0-20150701-214155/Lib/random.py | Python | agpl-3.0 | 25,882 |
# -*- coding: utf-8 -*-
#
# Manual documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 27 10:36:54 2014.
#
# 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 ... | JensAhrens/ssr | doc/manual/conf.py | Python | gpl-3.0 | 7,065 |
"""
Constants and functions for making matplotlib prettier.
"""
from __future__ import (division, absolute_import,
print_function)
import numpy as np
import matplotlib as mpl
from matplotlib import cm as mpl_cm
import matplotlib.dates as mdates
from matplotlib import rcParams
import matplotlib.... | eddiejessup/ciabatta | ciabatta/ejm_rcparams.py | Python | bsd-3-clause | 6,307 |
import os
import logging
from mimetypes import guess_type
logger = logging.getLogger(__name__)
from tkinter.filedialog import askopenfilenames, askdirectory
from tkinter.messagebox import askyesno, showwarning, showinfo
from tkinter.simpledialog import askstring
from tkgraphics import gallery_with_slideshow
from dial... | gokai/tim | gui2db.py | Python | unlicense | 8,146 |
"""
Tests for base command class.
"""
import os
from mock import patch
from django.test import TestCase
from django.utils import six
from django.core.files import File
from dbbackup.management.commands._base import BaseDbBackupCommand
from dbbackup.storage import get_storage
from dbbackup.tests.utils import DEV_NULL, H... | Ubiwhere/django-dbbackup | dbbackup/tests/commands/test_base.py | Python | bsd-3-clause | 5,785 |
#
email = {
"email_server" : "localhost",
"email_from_addr" : "email@example.com",
}
twilio = {
"account_sid": "twilio_account_sid",
"auth_token" : "twilio_auth_token",
"from_number": "twilio_from_number",
"code" : "intl_code",
}
| jstitch/gift_circle | gift_circle/config.py | Python | gpl-3.0 | 273 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | SRabbelier/Melange | thirdparty/google_appengine/google/appengine/ext/appstats/ui.py | Python | apache-2.0 | 8,746 |
# This file is part of ZS
# Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
| njsmith/zs | zs/tests/__init__.py | Python | bsd-2-clause | 132 |
import argparse
import json
from jinja2 import Environment, FileSystemLoader
from base64 import b64encode
import string
parser = argparse.ArgumentParser("Generate Manticore tests from the WASM Spec")
parser.add_argument("filename", type=argparse.FileType("r"), help="JSON file output from wast2json")
args = parser.pars... | montyly/manticore | tests/wasm/json2smc.py | Python | apache-2.0 | 5,561 |
# Author: Travis Oliphant, 2002
#
# Further enhancements and tests added by numerous SciPy developers.
#
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from numpy.random import RandomState
from numpy.testing import (TestCase, run_module_suite, assert_array_equal,
... | argriffing/scipy | scipy/stats/tests/test_morestats.py | Python | bsd-3-clause | 51,198 |
from spec.python import db_connection
import sam.common
import sam.constants
import web
app = web.application(sam.constants.urls, globals(), autoreload=False)
sam.common.session_store = web.session.DBStore(db_connection.db, 'sessions')
sam.common.session = web.session.Session(app, sam.common.session_store)
# TODO: th... | riolet/SAM | spec/python/test_server.py | Python | gpl-3.0 | 3,851 |
# Copyright 2016 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... | gojira/tensorflow | tensorflow/python/ops/special_math_ops.py | Python | apache-2.0 | 18,985 |
#!/usr/bin/env python3
import speech_recognition as sr
# obtain path to "english.wav" in the same folder as this script
from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "english.wav")
#AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "french.aiff")
#AUDIO_FILE = path.join... | rherlt/GoodVibrations | src/GoodVibrations.Listener/speech_recognition/examples/audio_transcribe.py | Python | mit | 3,488 |
"""
SUR and 3SLS estimation
"""
__author__= "Luc Anselin lanselin@gmail.com, \
Pedro V. Amaral pedrovma@gmail.com"
import numpy as np
import numpy.linalg as la
from scipy import stats
from . import summary_output as SUMMARY
from . import user_output as USER
from . import regimes as REGI
from .sur_uti... | lixun910/pysal | pysal/model/spreg/sur.py | Python | bsd-3-clause | 35,446 |
"""private_base will be populated from puppet and placed in this directory"""
import logging
import os
import dj_database_url
from lib.settings_base import (ALLOWED_HOSTS, CACHE_PREFIX, ES_INDEXES,
KNOWN_PROXIES, LOGGING, HOSTNAME)
from .. import splitstrip
import private_base as priv... | jinankjain/zamboni | sites/paymentsalt/settings_base.py | Python | bsd-3-clause | 5,336 |
#!/usr/bin/env python2
# Copyright (c) 2014 The VeriCoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test pruning code
# ********
# WARNING:
# This test uses 4GB of disk space.
# This test takes 30 mins or ... | vericoin/vericoin-core | qa/rpc-tests/pruning.py | Python | mit | 17,313 |
#!/usr/bin/env python
"""
@file pythonPropsMSVC.py
@author Michael Behrisch
@author Daniel Krajzewicz
@author Jakob Erdmann
@date 2011
@version $Id: pythonPropsMSVC.py 14425 2013-08-16 20:11:47Z behrisch $
This script rebuilds "../../build/msvc/python.props", the file which
gives information about the python ... | cathyyul/sumo-0.18 | tools/build/pythonPropsMSVC.py | Python | gpl-3.0 | 1,517 |
# -*- coding: utf-8 -*-
from amsn2.ui import base
from amsn2.views import AccountView, ImageView
from PyQt4 import Qt
from PyQt4 import QtCore
from PyQt4 import QtGui
try:
from ui_login import Ui_Login
except ImportError, e:
print " WARNING: To use the QT4 you need to run the generateFiles.sh, check the README... | kakaroto/amsn2 | amsn2/ui/front_ends/qt4/login.py | Python | gpl-2.0 | 7,200 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is a simple echo bot using decorators and webhook with flask
# It echoes any incoming text messages and does not use the polling method.
import flask
import telebot
import logging
API_TOKEN = '<api_token>'
WEBHOOK_HOST = '<ip/host where the bot is running>'
WEBH... | tr00m1k/zagruzki | examples/webhook_examples/webhook_flask_echo_bot.py | Python | gpl-2.0 | 2,444 |
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-std=c++11',
'-pedantic',
'-I',
'./src',
'-I',
'./lib/gmock/include',
'-I',
'./lib/gmock/gtest/include',
]
# Set this to ... | povilasb/gmock-sample | .ycm_extra_conf.py | Python | mit | 3,594 |
from google.appengine.api import memcache
from datetime import datetime
#from ithz.data import queryRSS, RssScheduledModel
from ithz.lib import feedparser
from ithz.template import getTemplate
def getBlog(id,page=0):
v = {}
tr = getTemplate("controls/blog",v)
return tr
def addBlog(id):
pass
| ergoithz/ithz | ithz/blogs.py | Python | mit | 311 |
def sum_square_diff(max_number):
numbers = xrange(1, max_number + 1)
return sum(numbers) ** 2 - sum(map(lambda n: n ** 2, numbers))
print sum_square_diff(100)
| jcdenton/project-euler | python/problem006.py | Python | mit | 169 |
#!/usr/bin/env python3
#
#
#
#
import hashlib
import json
import os
from os.path import join
import re
import shutil
import subprocess
import tarfile
import xml.etree.ElementTree as ET
SCENARIO_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
SCENARIO_PATH = os.path.dirname(os.path.realpath(__file_... | conorsch/securedrop | molecule/vagrant-packager/package.py | Python | agpl-3.0 | 9,481 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | QingChenmsft/azure-cli | src/azure-cli-core/azure/cli/core/tests/test_command_registration.py | Python | mit | 15,404 |
from __future__ import unicode_literals
from django.conf import settings
from django.forms import ChoiceField
from django.utils.translation import ugettext_lazy as _
from django_select2.forms import *
from .multiple import MultiSelectField
class InitMixin(object):
'''Support for declaring Model Select Field''... | django-leonardo/django-leonardo | leonardo/forms/fields/__init__.py | Python | bsd-3-clause | 880 |
# -*- coding: utf-8 -*-
"""
Sales Doctor - Strategy
SRP
Responsibility of this class:
Encapsulates a strategy for resolving a problem (business logic).
Interface
Created: 11 dec 2020
Last up: 12 dec 2020
"""
from __future__ import print_function
from __future__ i... | gibil5/openhealth | models/management/sales_doctor.py | Python | agpl-3.0 | 3,809 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2010 (ita)
"Module called for configuring, compiling and installing targets"
import os, shlex, shutil, traceback, errno, sys, stat
from waflib import Utils, Configure, Logs, Options, ConfigSet, Context, Errors, Build, Node
build_dir_override = None
no_clim... | tommo/gii | support/waf/waflib/Scripting.py | Python | mit | 15,159 |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
try:
from django.core.management import execute_from_command_line
except I... | msterin/play | vsc-play/python/helloworld/manage.py | Python | mit | 666 |
import numpy as np
import Tile
import random
import Move
from copy import deepcopy
class Board:
''' the Board class. to be treated as an abstract class. Use a subclass for the actual board with more
specific behaviour '''
BLUE = 0
RED = 1
GREEN = 2
YELLOW = 3
conversionDict = {"BLUE":0, "RED":1, "GREEN":2, "... | ajstarna/RicochetRobots | Brobot/Board.py | Python | bsd-2-clause | 27,806 |
from z3 import *
x = Real('x')
y = Real('y')
s = Solver()
s.add(x > 1, y > 1, Or(x + y > 3, x - y < 2))
print "asserted constraints..."
for c in s.assertions():
print c
print s.check()
print "statistics for the last check method..."
print s.statistics()
# Traversing statistics
for k, v in s.statisti... | anaoaktree/vcgen | vcgen/z3/pyz3.py | Python | mit | 355 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test suite for timeout_util.py"""
from __future__ import print_function
import datetime
from multiprocessing.pool import ... | endlessm/chromium-browser | third_party/chromite/lib/timeout_util_unittest.py | Python | bsd-3-clause | 7,025 |
'''objectives:
1. open the existing file 'abcde.json'
2. convert all data in file to a python type
3. perform a simple python operation such as adding 10 to each value
4. convert that object back to json and write it to a new file
5. repeat :)
'''
import json
with open('abcde.json', 'r') as fp:
abc_json = j... | razzius/PyClassLessons | instructors/course-2015/json/examples/in_class/work_json.py | Python | mit | 919 |
""" The default strategy that iterates through the whole parameter space """
from __future__ import print_function
import itertools
from kernel_tuner import util
def tune(runner, kernel_options, device_options, tuning_options):
""" Tune all instances in the parameter space
:params runner: A runner from ker... | benvanwerkhoven/kernel_tuner | kernel_tuner/strategies/brute_force.py | Python | apache-2.0 | 1,707 |
from math import cos, sin, pi, acos
import pygame as pg
from ext import evthandler as eh
import conf
ir = lambda x: int(round(x))
get_dx = lambda a: (-1 if pi / 2 < a <= 3 * pi / 2 else 1) * abs(cos(a))
get_dy = lambda a: (1 if a >= pi else -1) * abs(sin(a))
fix_angle = lambda a: (a * pi) % (2 * pi)
class Level:
... | ikn/sequence | sequence/level.py | Python | bsd-3-clause | 10,139 |
from pypi_vm.data.releases import Release
from pypi_vm.services import package_service
from pypi_vm.viewmodels.shared.viewmodel_base import ViewModelBase
class PackageDetailsViewModel(ViewModelBase):
def __init__(self, package_name: str):
super().__init__()
self.package_name = package_name
... | Wintellect/WintellectWebinars | 2019-06-06-ten-tips-python-web-devs-kennedy/code/top_10_web_explore/ex07_viewmodels/pypi_vm/viewmodels/packages/package_details_viewmodel.py | Python | apache-2.0 | 958 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack 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
#
# ... | salv-orlando/MyRepo | nova/virt/vmwareapi_conn.py | Python | apache-2.0 | 15,829 |
import pytest
import platform
import uuid
from time import sleep
import sciunit
from datetime import datetime
"""
1] Retrieve a test definition by its test_id or alias.
"""
#1.1) Without test_id or alias
def test_getTest_none(testLibrary):
test_library = testLibrary
with pytest.raises(Exception) as excinfo:
... | apdavison/hbp-validation-client | tests/test_tests.py | Python | bsd-3-clause | 22,801 |
#!/usr/bin/env python
import os
import sys
import inspect
import pkgutil
import importlib
from getopt import getopt
import ConfigParser
OBJECTS_TO_DOCUMENT = []
PACKAGES = []
class Module(object):
__is_package = None
def __init__(self, kwargs, name=None):
self.__module_name = self._check_name(nam... | michaelconnor00/simpledoc | simpledoc/simpledoc.py | Python | mit | 9,587 |
from conan.packager import ConanMultiPackager
if __name__ == "__main__":
builder = ConanMultiPackager(args = "-tf ./tests/PackageTests --build missing")
builder.add_common_builds()
builder.run()
| strootje/Grawlog | .conan/build.py | Python | mit | 208 |
from monads.state.monad import Monad, bound
class StateMonad(Monad):
def __init__(self, function=lambda x: x):
self.function = function
def run(self, state):
return self.function(state)
class Game(StateMonad):
def bind(self, method, args, kwargs):
def transformer(old_state):
... | jorgenschaefer/monads-for-normal-programmers | monads/state/state2.py | Python | bsd-2-clause | 838 |
# -*- coding: utf-8 -*-
# Copyright 2017 KMEE
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Sped Financeiro',
'summary': """
Integracão entre o controle financeiro e o módulo fiscal""",
'version': '10.0.1.0.0',
'license': 'AGPL-3',
'author': 'KMEE,Odoo Community... | thinkopensolutions/l10n-brazil | sped_finan/__manifest__.py | Python | agpl-3.0 | 650 |
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import fields, models
class SaleOrder(models.Model):
_inherit = 'sale.order'
carrier_rate_ids = fields.One2many(
string='Delivery Carrier Rates',
comodel_name... | OCA/carrier-delivery | sale_delivery_rate/models/sale_order.py | Python | agpl-3.0 | 390 |
#/u/GoldenSights
import praw # simple interface to the reddit API, also handles rate limiting of requests
import time
import sqlite3
'''USER CONFIGURATION'''
USERNAME = ""
#This is the bot's Username. In order to send mail, he must have some amount of Karma.
PASSWORD = ""
#This is the bot's Password.
USERAGENT = ""... | tehp/reddit | AutoContributor/autocontributor.py | Python | mit | 2,451 |
'''
Loop Dipole and the Chaoties
Created by R. Bassett Jr.
www.tpot.ca
General Public Licence v3
------------------------
User Interface Scripts
------------------------
Functions for the general interface.
'''
import Rasterizer
import GameLogic as G
import bge
from bge import logic
def showMouse():
Rasteriz... | Tatwi/LoopDipole | uiScripts.py | Python | gpl-3.0 | 6,879 |
#
# Copyright 2015-2021 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
""" Trace model recipe for Megara"""
from __future__ import division, print_function
import math
import bisect
import multiprocessing as mp
import num... | sergiopasra/megaradrp | megaradrp/recipes/calibration/modelmap.py | Python | gpl-3.0 | 15,586 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Red Hat, Inc
# Written by Seth Vidal <skvidal at fedoraproject.org>
# Copyright: (c) 2014, Epic Games, 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, p... | alexlo03/ansible | lib/ansible/modules/packaging/os/yum.py | Python | gpl-3.0 | 60,272 |
# vim: ts=4:sw=4:expandtab
# BleachBit
# Copyright (C) 2014 Andrew Ziem
# http://bleachbit.sourceforge.net
#
# 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
... | maximilianofaccone/puppy-siberian | usr/share/bleachbit/CleanerML.py | Python | gpl-3.0 | 8,532 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.