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 |
|---|---|---|---|---|---|
##########################################################################
#
# Copyright (c) 2015, Image Engine Design 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:
#
# * Redistrib... | hradec/gaffer | python/GafferSceneTest/SceneLoopTest.py | Python | bsd-3-clause | 5,699 |
from .service import *
from .login import *
from .notification import *
| lpakula/django-ftp-deploy | ftp_deploy/server/forms/__init__.py | Python | mit | 75 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... | NaturalGIS/QGIS | python/plugins/db_manager/db_plugins/postgis/plugin.py | Python | gpl-2.0 | 17,099 |
# @ 2020 Akretion - www.akretion.com.br -
# Magno Costa <magno.costa@akretion.com.br>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from openupgradelib import openupgrade
_table_renames = [
('cnab_return_move_code', 'l10n_br_cnab_return_move_code'),
]
_model_renames = [
('cnab.return.... | kmee/l10n-brazil | l10n_br_account_payment_order/migrations/12.0.3.0.0/pre-migration.py | Python | agpl-3.0 | 700 |
from __future__ import division, print_function, absolute_import
from nose.plugins.attrib import attr
from nose.tools import raises
import numpy as np
from numpy.testing import (assert_equal,
assert_almost_equal)
from ..irr import (compute_ts,
simulate_ts_dist,
... | stefanv/permute | permute/tests/test_irr.py | Python | bsd-2-clause | 6,542 |
import glob
import os
myPath = os.path.dirname(os.path.realpath(__file__))
for file in os.listdir(myPath):
tmp = file
if '.svg' in tmp:
tmp = tmp.replace('.',"")
tmp = tmp.replace('(',"")
tmp = tmp.replace(')',"")
tmp = tmp.replace("svg","")
tmp = tmp + '.svg'
os.rename(file,tmp)
| istvanszoke/softlab4 | docs/chapters/chapter04/removeSpecCharacters.py | Python | lgpl-3.0 | 300 |
# *********************************************************************
# The MIT License (MIT)
#
# Copyright (c) 2016 Christopher Asakawa, Mathew O'Brien, Nicholas McHale, Corey Aing
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
#... | FishyByte/SushiRNG | app.py | Python | mit | 13,810 |
import collections
import uuid
Measurement = collections.namedtuple('Measurement', 'id x y value')
measurements = [
Measurement(str(uuid.uuid4()), 1, 1, 72),
Measurement(str(uuid.uuid4()), 2, 1, 40),
Measurement(str(uuid.uuid4()), 3, 1, 11),
Measurement(str(uuid.uuid4()), 2, 1, 90),
Measurement(st... | mikeckennedy/write-pythonic-code-demos | code/ch_04_collections/_06_express_yourself.py | Python | mit | 1,359 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# 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/LIC... | jeffrey4l/nova | nova/tests/unit/network/test_network_info.py | Python | apache-2.0 | 41,893 |
import unittest
import sys, os, io, subprocess
import quopri
ENCSAMPLE = b"""\
Here's a bunch of special=20
=A1=A2=A3=A4=A5=A6=A7=A8=A9
=AA=AB=AC=AD=AE=AF=B0=B1=B2=B3
=B4=B5=B6=B7=B8=B9=BA=BB=BC=BD=BE
=BF=C0=C1=C2=C3=C4=C5=C6
=C7=C8=C9=CA=CB=CC=CD=CE=CF
=D0=D1=D2=D3=D4=D5=D6=D7
=D8=D9=DA=DB=DC=DD=DE=DF
=E0=E1=E2=E... | ms-iot/python | cpython/Lib/test/test_quopri.py | Python | bsd-3-clause | 8,194 |
"""plot_percolation.py
Plot the average representation of the different classes as a function of
density for all MSA
"""
import csv
from math import log
import numpy as np
from matplotlib import pylab as plt
colours = {'Lower':'#4F8F6B',
'Higher':'#C1A62E',
'Middle':'#4B453C'}
#
# Preparation
#
... | rlouf/patterns-of-segregation | bin/plot_density.py | Python | bsd-3-clause | 2,704 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-02 08:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_auto_20160102_0834'),
]
operations = [
migrations.AlterField(
... | coders-circle/Notifica | web/posts/migrations/0004_auto_20160102_0839.py | Python | gpl-2.0 | 956 |
# -------------------------------------------------------------------------
#
# Copyright (c) 2009-2013, IMB, RWTH Aachen.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in simvisage/LICENSE.txt and may be redistributed only
# under the conditions des... | simvisage/oricreate | oricreate/gu/gu.py | Python | gpl-3.0 | 906 |
#!/usr/bin/env python
#
# Copyright (c) 2008 Google, Inc.
# Contributed by Arun Sharma <arun.sharma@google.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 in the Software without restriction, includi... | arm-hpc/papi | src/libpfm-3.y/python/sys.py | Python | bsd-3-clause | 2,299 |
# Copyright 2019 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... | google/timesketch | api_client/python/timesketch_api_client/sketch.py | Python | apache-2.0 | 66,968 |
#!/usr/bin/env python
# -------------------------------------------------------------------------
# This file is part of BayesOpt, an efficient C++ library for
# Bayesian optimization.
#
# Copyright (C) 2011-2015 Ruben Martinez-Cantin <rmcantin@unizar.es>
#
# BayesOpt is free software: you can redistribut... | rmcantin/bayesopt | python/demo_cam.py | Python | agpl-3.0 | 2,041 |
#!/usr/bin/env python
#
# Wrapper script for starting the biopet-vcfstats JAR package
#
# This script is written for use with the Conda package manager and is copied
# from the peptide-shaker wrapper. Only the parameters are changed.
# (https://github.com/bioconda/bioconda-recipes/blob/master/recipes/peptide-shaker/pep... | joachimwolff/bioconda-recipes | recipes/biopet-vcfstats/biopet-vcfstats.py | Python | mit | 3,367 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Rodrigo Alves Lima
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | rodrigoalveslima/runn | src/src/middleware.py | Python | agpl-3.0 | 917 |
"""Support for Steamist sensors."""
from __future__ import annotations
from aiosteamist import SteamistStatus
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.entity import Devic... | rohitranjan1991/home-assistant | homeassistant/components/steamist/entity.py | Python | mit | 1,670 |
import pytest
from thefuck.rules.az_cli import match, get_new_command
from thefuck.types import Command
no_suggestions = '''\
az provider: error: the following arguments are required: _subcommand
usage: az provider [-h] {list,show,register,unregister,operation} ...
'''
misspelled_command = '''\
az: 'providers' is ... | SimenB/thefuck | tests/rules/test_az_cli.py | Python | mit | 1,175 |
# Copyright 2011 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... | silenceli/nova | nova/api/openstack/compute/image_metadata.py | Python | apache-2.0 | 4,909 |
# Generated by Django 2.2 on 2019-04-21 09:17
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('dish', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Menu',
fields=[
... | bakie/whatsForDinner | whatsfordinner/apps/menu/migrations/0001_initial.py | Python | gpl-3.0 | 580 |
import json
import re
# This regex pattern has been shamelessly lifted from Mynt, licensed under the
# BSD license. Mynt is available at https://github.com/Anomareh/mynt
MATCHER = re.compile(r"\A---\s+^(.+?)$\s+---\s*(.*)\Z", re.M | re.S)
class Item(object):
def __init__(self, filename, site, raw, route=None):
... | veeti/vasara | vasara/item.py | Python | mit | 2,547 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'EventTag.group_id'
db.add_column(
'sentry_even... | looker/sentry | src/sentry/south_migrations/0253_auto__add_field_eventtag_group_id.py | Python | bsd-3-clause | 75,530 |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from django.db.models import Count, QuerySet
from django.utils.timezone import now as timezone_now
from zerver.models import User... | christi3k/zulip | analytics/management/commands/client_activity.py | Python | apache-2.0 | 3,069 |
from __future__ import print_function
import click
def load_module(state, mod_list=[]):
"""Dynamically load modules for states
USAGE
mod = load_module(state, ['datasource', 'loader'])
mod.datasource.Datasource()
"""
return __import__('openelex.us.%s' % state.lower(), fromlist=mod_list)... | openelections/openelections-core | openelex/tasks/utils.py | Python | mit | 930 |
# Copyright 2014 - Rackspace Hosting
#
# 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... | pravisankar/solum | solum/conductor/api.py | Python | apache-2.0 | 1,336 |
# -*- coding: utf-8 -*-
# author: zhaijinyuan
# date: 2018/1/9 下午8:50
from flask import render_template, redirect, request, url_for, flash, jsonify, current_app, make_response, session
from alipaylib import getOrderId, place_order, query_order
from flask_login import login_required, current_user
from . import alipay
f... | zjyfdu/flask_huxiaofei | app/alipay/views.py | Python | mit | 2,416 |
# Copyright (c) 2018 NEC, Corp.
#
# 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/watcher | watcher/cmd/status.py | Python | apache-2.0 | 1,829 |
# Copyright 2018 Red Hat, 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, ... | openvswitch/ovn-scale-test | rally_ovs/plugins/ovs/ovnclients.py | Python | apache-2.0 | 5,955 |
import numpy
import scipy.io as sio
import theano
import lasagne
import theano.tensor as T
import os
from collections import OrderedDict
import pylab #for graphing
import json
from random import shuffle
import time
#TODO:
#have a fully convolutional layer to account for variable recording time
#inputMat = sio.loa... | XPrize-McGill/thinking-cap | DeepEEG.py | Python | mit | 15,038 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-04-07 12:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization_network', '0099_organization_validation_status'),
]
operations = [
... | Ircam-Web/mezzanine-organization | organization/network/migrations/0100_organization_slug.py | Python | agpl-3.0 | 594 |
# 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 RRpostgresql(RPackage):
"""Database interface and PostgreSQL driver for R This package pro... | LLNL/spack | var/spack/repos/builtin/packages/r-rpostgresql/package.py | Python | lgpl-2.1 | 1,471 |
'''
Desc: Compiles an audio clip of a string of numbers with the human voice.
Author: Keely Hill
MIT License
Scroll down to main() and processRangeForLines() for the action.
'''
from pydub import AudioSegment
import pp
number_sounds = []
def loadBigNumFileToList():
print("Loading file.")
with open('M7420728... | KeelyHill/Prime-Number-Audio-Book | prime_audio.py | Python | mit | 2,901 |
#!/usr/bin/env python
from redbot.message import headers
from redbot.syntax import rfc7232
from redbot.type import AddNoteMethodType
class last_modified(headers.HttpHeader):
canonical_name = "Last-Modified"
description = """\
The `Last-Modified` header indicates the time that the origin server believes the
... | mnot/redbot | redbot/message/headers/last_modified.py | Python | mit | 1,311 |
import exceptions
class DescriptionFactory:
"""
This factory [1] creates complete DGDLDescription objects from supplied descriptions, [2] scaffolds minimal game or system objects, and [3] generates standard games such as DC
"""
def __init__(self):
pass
def minimal(self):
turns = Tu... | siwells/moot | src/dgdl.py | Python | gpl-2.0 | 15,823 |
# Time: O(n)
# Space: O(1)
# Definition for a Node.
class Node(object):
def __init__(self, val, next):
self.val = val
self.next = next
class Solution(object):
def insert(self, head, insertVal):
"""
:type head: Node
:type insertVal: int
:rtype: Node
"""... | kamyu104/LeetCode | Python/insert-into-a-cyclic-sorted-list.py | Python | mit | 1,168 |
'''
FFmpeg based video abstraction
==============================
To use, you need to install ffpyplyaer and have a compiled ffmpeg shared
library.
https://github.com/matham/ffpyplayer
The docs there describe how to set this up. But briefly, first you need to
compile ffmpeg using the shared flags while disabling... | BillBillBillBill/Tickeys-linux | tickeys/kivy_32/kivy/core/video/video_ffpyplayer.py | Python | mit | 10,744 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.web_perf.metrics import webrtc_rendering_stats as stats_helper
class FakeEvent(object):
"""Fake event class to mock render... | js0701/chromium-crosswalk | tools/telemetry/telemetry/web_perf/metrics/webrtc_rendering_stats_unittest.py | Python | bsd-3-clause | 12,489 |
from unittest import TestCase
from glashammer import make_app
from glashammer.utils import Response
from werkzeug.test import Client
from repoze.who.middleware import PluggableAuthenticationMiddleware
from repoze.who.interfaces import IIdentifier
from repoze.who.interfaces import IChallenger
from repoze.who.plugin... | passy/glashammer-rdrei | tests/test_repozewho.py | Python | mit | 3,219 |
# Copyright 2014 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 agreed to in writing, s... | jonparrott/google-cloud-python | datastore/google/cloud/datastore/_http.py | Python | apache-2.0 | 11,675 |
# coding: utf-8
from . import ir_cron
from . import ir_cron_inactivity_period
| acsone/server-tools | cron_inactivity_period/models/__init__.py | Python | agpl-3.0 | 78 |
import sys
sys.path.insert(1, "../../")
import h2o
def rbind_check(ip,port):
# Connect to a pre-existing cluster
frame = h2o.import_file(path=h2o.locate("smalldata/junit/cars.csv"))
row_orig = frame.nrow()
frame_2 = frame.rbind(frame)
row_2 = frame_2.nrow()
assert 2*row_orig == row_2, "E... | weaver-viii/h2o-3 | h2o-py/tests/testdir_munging/pyunit_rbind.py | Python | apache-2.0 | 876 |
# -*- coding: utf-8 -*-
# Description: traefik netdata python.d module
# Author: Alexandre Menezes (@ale_menezes)
# SPDX-License-Identifier: GPL-3.0-or-later
from collections import defaultdict
from json import loads
from bases.FrameworkServices.UrlService import UrlService
ORDER = [
'response_statuses',
're... | vlvkobal/netdata | collectors/python.d.plugin/traefik/traefik.chart.py | Python | gpl-3.0 | 6,730 |
#!/usr/bin/env python
"""This module contains a set of default tools that are
deployed with jip
"""
import jip
@jip.tool("cleanup")
class cleanup(object):
"""\
The cleanup tool removes ALL the defined output
files of its dependencies. If you have a set of intermediate jobs,
you can put this as a final... | thasso/pyjip | jip/scripts/__init__.py | Python | bsd-3-clause | 1,603 |
# Copyright 2020 Tensorforce Team. 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 la... | reinforceio/tensorforce | tensorforce/core/layers/rnn.py | Python | apache-2.0 | 11,937 |
# -*- coding: utf-8 -*-
"""Amazon SQS Connection."""
from __future__ import absolute_import, unicode_literals
from vine import transform
from kombu.asynchronous.aws.connection import AsyncAWSQueryConnection
from .ext import boto3
from .message import AsyncMessage
from .queue import AsyncQueue
__all__ = ('AsyncSQSC... | mdworks2016/work_development | Python/20_Third_Certification/venv/lib/python3.7/site-packages/kombu/asynchronous/aws/sqs/connection.py | Python | apache-2.0 | 7,005 |
import datetime
from django.test import TestCase
from django.utils import timezone
from mords_api.models import Note, Word, Learner, Book
from django.urls import reverse
from django.contrib.auth.models import User
def create_user(username, pwd):
"""
Creates a user with the given 'username' and 'pwd'.
:par... | cheng10/M-ords | mords_backend/mords/tests.py | Python | mit | 3,840 |
#!/usr/bin/env python
"""
Interfaces with openstack to start, stop, create and delete VM's
"""
import os
import sys
import ConfigParser
import argparse
import time
import subprocess
import glob # Used for finding files in dir
from keystoneauth1.identity import v3
from keystoneauth1 import session
import novaclien... | includeos/includeos-tools | openstack_control/openstack_control.py | Python | apache-2.0 | 13,180 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
i... | kubevirt/client-python | test/test_v1_virtual_machine_spec.py | Python | apache-2.0 | 943 |
import json as j
from homeautomationcli.utils import *
from homeautomationcli.encryption import *
import sys
# User Login
def login(useremail, userpass):
aes = EpsumCryptAES()
Authorization = aes.encrypt('{"message":"hello"}', userpass)
header = {'USER': useremail, 'Authorization': Authorization... | Epsumlabs/homeautomationcli | homeautomationcli/definations.py | Python | mit | 8,286 |
"""Google Cloud Hierarchical Firewall Generator.
Hierarchical Firewalls (HF) are represented in a SecurityPolicy GCP resouce.
"""
import copy
import re
from typing import Dict, Any
from absl import logging
from capirca.lib import gcp
from capirca.lib import nacaddr
class ExceededCostError(gcp.Error):
"""Raised ... | google/capirca | capirca/lib/gcp_hf.py | Python | apache-2.0 | 20,640 |
from __future__ import division
from statsmodels.compat.python import iterkeys, zip, lrange, iteritems, range
from numpy.testing import assert_, assert_raises, dec
from numpy.testing import run_module_suite
# utilities for the tests
from statsmodels.compat.pandas import sort_values
from statsmodels.compat.collection... | yl565/statsmodels | statsmodels/graphics/tests/test_mosaicplot.py | Python | bsd-3-clause | 19,198 |
# Copyright 2017 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
DEPS = [
'version',
]
| luci/recipes-py | recipe_modules/platform/__init__.py | Python | apache-2.0 | 238 |
sf = open('output_ir','r')
a = list()
c = 0
ma = 0
for l in sf:
part = l[:-1].split(' ')
if part[0] in part[1] or part[1] in part[0]:
if(int(part[2]) > 1024):
continue
c += 1
ma = max(ma,float(part[2]))
print(ma)
print(c)
| pzread/unstrip | cmp.py | Python | mit | 267 |
# -*- coding: utf-8 -*-
from datetime import datetime
from datetime import timedelta
import pytest
NOW = datetime.now()
TWO_DAYS_AGO = NOW - timedelta(days=2)
IN_TWO_DAYS = NOW + timedelta(days=2)
def test_default_values(line_factory, default_line_data):
line = line_factory()
assert line.client_ip == defa... | gforcada/haproxy_log_analysis | haproxy/tests/test_log_line.py | Python | gpl-3.0 | 6,412 |
from __future__ import print_function
from pandas import DataFrame
from pandas.compat import range, zip
import timeit
setup = """
from pandas import Series
import pandas._tseries as _tseries
from pandas.compat import range
import random
import numpy as np
def better_unique(values):
uniques = _tseries.fast_unique(... | linebp/pandas | bench/better_unique.py | Python | bsd-3-clause | 2,143 |
# -*- encoding: utf-8 -*-
from pyramid.view import view_config
from pyramid.response import Response
import json
from liblightbase.lbutils.codecs import *
@view_config(name = "teste")
def view_teste(request):
js = request.body.decode("utf-8")
dict_json = json2object(request.body.decode("utf-8"))
#dict_js... | Bleno/portfolio | portfolio/views/testes_view.py | Python | gpl-3.0 | 444 |
#! /usr/bin/env python
# -*- coding: Latin-1 -*-
# Définition d'un serveur réseau rudimentaire
# Ce serveur attend la connexion d'un client
import socket, sys
HOST = '192.168.0.235'
PORT = 50000
counter =0 # compteur de connexions actives
# 1) création du socket :
mySocket = socket.socket(socket.AF_INET, s... | widowild/messcripts | exercice/python2/chap18/streamserveur.py | Python | gpl-3.0 | 1,457 |
# -*- coding: utf-8 -*-
import datetime
from django.contrib.auth.decorators import login_required, user_passes_test
from django.shortcuts import render, get_object_or_404, redirect
from django.template import RequestContext, loader, Context
from django.core.urlresolvers import reverse
from django.contrib import messag... | dudanogueira/microerp | microerp/solicitacao/views.py | Python | lgpl-3.0 | 6,393 |
import logging
import sys
import gdax_utils
import utils
def usage():
# TODO: Maybe add short commands e.g. t, h, o, ...
"""Usage: gdaxcli <command> [arguments]
products Lists products available for trading.
ticker [product1 product2..] Get current market ticker.
balance ... | sonph/gdaxcli | gdaxcli/__main__.py | Python | mit | 3,023 |
#!/usr/bin/env python
import argparse
import os
import re
import sys
import tempfile
import matplotlib.pyplot as plt
from ortholotree import config
############################################
def define_arguments():
parser = argparse.ArgumentParser(description=
"Creates pie charts of the number of ... | oxpeter/small_fry | blast_breakdown.py | Python | gpl-2.0 | 18,214 |
import polib
from sportorg import config
from sportorg.language import get_languages
def test_duplicates():
locales = get_languages()
name = config.NAME.lower()
for locale in locales:
path = config.base_dir(config.LOCALE_DIR, locale, 'LC_MESSAGES', name)
po = polib.pofile(path + '.po', ch... | sportorg/pysport | tests/test_language.py | Python | gpl-3.0 | 385 |
from JumpScale import j
descr = """
fixed screwed-up default ubuntu dns setup
"""
organization = "vscalers"
author = "tim@incubaid.com"
license = "bsd"
version = "1.0"
category = "deploy.platform.update"
period = 1 # always in sec
startatboot = True
order = 1
enable = True
async = True
log = False
def action(node... | Jumpscale/jumpscale6_core | apps/admin/jumpscripts/varia/fix_dns.py | Python | bsd-2-clause | 489 |
# -*- coding: utf-8 -*-
"""
Extension method types.
"""
from __future__ import print_function, division, absolute_import
from numba.typesystem import *
#------------------------------------------------------------------------
# Extension Method Types
#----------------------------------------------------------------... | shiquanwang/numba | numba/exttypes/types/methods.py | Python | bsd-2-clause | 1,972 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | airflow/contrib/operators/gcp_sql_operator.py | Python | apache-2.0 | 34,684 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Holoscópio Tecnologia
# Author: Luciana Fujii Pontello <luciana@holoscopio.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | Geheimorganisation/sltv | sltv/effect/video_effect.py | Python | gpl-2.0 | 1,698 |
"Fixer that translates some APIs ignored by the default 2to3 fixers."
# FIXME: This fixer has some ugly hacks. Its main design is based on that of
# fix_imports, from lib2to3. Unfortunately, the fix_imports framework only
# changes module names "without dots", meaning it won't work for some changes
# in the email modu... | iaddict/mercurial.rb | vendor/mercurial/contrib/hgfixes/fix_leftover_imports.py | Python | mit | 4,692 |
#!/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... | CollabQ/CollabQ | .google_appengine/google/appengine/api/namespace_manager/__init__.py | Python | apache-2.0 | 2,505 |
from Products.CMFCore.DirectoryView import registerDirectory
from Products.CMFPlone.interfaces import IPloneSiteRoot
from Products.FacultyStaffDirectory.extenderInstallation import installExtenderGloballyIfLocallyIsNotSupported
from Products.GenericSetup import EXTENSION, profile_registry
from Products.IMSSSMembers.pe... | tkimnguyen/Products.IMSSSMembers | Products/IMSSSMembers/__init__.py | Python | gpl-2.0 | 1,100 |
from Tkinter import *
from tkSimpleDialog import askstring
from tkFileDialog import asksaveasfilename
from tkMessageBox import askokcancel
class Quitter(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent)
self.pack()
widget =... | ActiveState/code | recipes/Python/578568_Plain_Text_Editor_in_Python/recipe-578568.py | Python | mit | 3,577 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import inspect
from django.template.loader import render_to_string
from django.db import connection
import settings
from xformmanager.models import Metadata, FormDefModel, ElementDefModel
from reports.models import Case, SqlReport
from reports.util impor... | commtrack/temp-aquatest | apps/reports/custom/grameen.py | Python | bsd-3-clause | 7,153 |
# Copyright (c) 2014 Rackspace, 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 wr... | amitgandhinz/cdn | tests/unit/storage/cassandra/test_services.py | Python | apache-2.0 | 4,422 |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | gemzion/Final-project | tailbone/customce/__init__.py | Python | apache-2.0 | 2,280 |
# Copyright 2015 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 o... | jprovaznik/os-cloud-management | os_cloud_management/tests/test_updates.py | Python | apache-2.0 | 3,522 |
import unittest
import poxcom as pc
class TestFSM(unittest.TestCase):
def test_fsm1(self):
# idle, bad address, still idle
rxsm = pc.RXFSM()
self.assertEqual(rxsm.state, pc.RXFSM.STATE_IDLE)
result = rxsm.crank(7)
self.assertEqual(rxsm.state, pc.RXFSM.STATE_IDLE)
... | mwgit00/pox | test_com.py | Python | mit | 3,787 |
# coding=utf-8
"""Online Scout Manager Interface.
Usage:
osm.py <apiid> <token> [-d] [-s=<sectionid>]
osm.py <apiid> <token> [-d] [-s=<sectionid>] run <query>
osm.py <apiid> <token> [-d] -a <cred_file> <email> <password>
osm.py (-h | --help)
osm.py --version
Options:
-h --help Show this screen.
--... | hippysurfer/scout-records | osm.py | Python | gpl-2.0 | 37,606 |
"""DM Encounter List component."""
from component_objects import Component, Element
class EncounterList(Component):
"""Definition of Encounter List component."""
add_plus_icon_xpath = '//*[@id="encounter-tab"]/encounter/div/div/div[2]/div[1]/div/div/div/div/div' # noqa
add_encounter_detail_placeholder_x... | adventurerscodex/uat | components/core/dm/encounter_list.py | Python | gpl-3.0 | 748 |
from sakura.common.errors import APIObjectDeniedError
from sakura.client.apiobject.base import APIObjectBase, APIObjectRegistryClass
from sakura.client.apiobject.grants import APIGrants
from sakura.client.apiobject.pages import APIProjectPage
from sakura.common.tools import create_names_dict, snakecase
class APIProjec... | eduble/panteda | sakura/client/apiobject/projects.py | Python | gpl-3.0 | 2,901 |
# Copyright 2021 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... | GoogleCloudPlatform/python-docs-samples | composer/cicd_sample/dags/example2_dag.py | Python | apache-2.0 | 1,464 |
"""
Script to make the default settings file
"""
from sys import version_info
from serpentTools import __version__
from serpentTools.settings import rc
pyVersion = '{}.{}.{}'.format(*version_info[:3])
print("Making settings file with\n python: {}"
"\n serpentTools: {}".format(pyVersion, __version__))
FILE_PATH... | CORE-GATECH-GROUP/serpent-tools | docs/rstDefaultSettings.py | Python | mit | 459 |
import numpy as np
from nlp_playground.lib.sklearn.transformers import WordVectorSum
CORPUS = [
"the cake is a lie",
"jAMES is the best",
"jamesQisQtheQbest"
]
VECTORS = {
"the": np.ones(5) * 3,
"james": np.ones(5) * 4
}
def mock_wvs_transform(**kwargs):
"""Mock WordVectorSum.
If we di... | jamesmishra/nlp-playground | nlp_playground/tests/lib/sklearn/test_transformers.py | Python | mit | 2,239 |
from pythonforandroid.recipe import CythonRecipe
class SpineCython(CythonRecipe):
version = '0.5.1'
url = 'https://github.com/tileworks/spine-cython/archive/{version}.zip'
name = 'spine'
depends = ['setuptools']
site_packages_name = 'spine'
call_hostpython_via_targetpython = False
recipe = ... | kivy/python-for-android | pythonforandroid/recipes/spine/__init__.py | Python | mit | 334 |
input_string = input('Enter string: ')
symbol = input('Enter symbol: ')
position = input_string.find(symbol)
if position is -1:
print('The symbol "{}" not exist in the string "{}"'.format(symbol, input_string))
print(input_string)
else:
starting_index = position + len(symbol) + 1
print(input_string[st... | KristianMariyanov/PythonPlayground | softuni-course/Lecture02/get_string_after_symbol.py | Python | mit | 336 |
ENABLED = {{enabled | python}}
| Martin819/salt-formula-horizon | horizon/files/enabled/settings.py | Python | apache-2.0 | 32 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | kamal-gade/rockstor-core | src/rockstor/smart_manager/views/disk_stat.py | Python | gpl-3.0 | 1,449 |
import json
from datetime import datetime, timedelta
from babel.dates import format_datetime, format_date
from odoo import models, api, _, fields
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from odoo.tools.misc import formatLang
class account_journal(models.Model):
_inherit = "account.journal"
@... | ayepezv/GAD_ERP | addons/account/models/account_journal_dashboard.py | Python | gpl-3.0 | 18,263 |
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
import os
from . import FileStore, TCPStore
_rendezvous_handlers = {}
def register_rendezvous_handler(scheme, handler):
"""Registers a new rendezvous handler.
Before we can run collective algorithms, participa... | ryfeus/lambda-packs | pytorch/source/torch/distributed/rendezvous.py | Python | mit | 5,167 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/local_path32.py | Python | apache-2.0 | 1,663 |
# Detect motion from PIR module and PhotoInterrupterSwitch
# AC march 10 2014
# Import required Python libraries
import RPi.GPIO as GPIO, time
# Use BCM GPIO references instead of physical pin numbers
GPIO.setmode(GPIO.BCM)
# Define GPIO to use on Pi
GPIO.setup(17,GPIO.IN)
Switch_State = 0
if GPIO.inpu... | ThatGeoGuy/ENGO500 | Sensor_prototype/PhotoSensor_test.py | Python | apache-2.0 | 984 |
#-*- coding: utf-8 -*-
from django.db import models
class Assinante(models.Model):
email = models.EmailField(verbose_name='E-mail', unique=True)
data_assinatura = models.DateTimeField(auto_now_add=True, verbose_name='Data da Assinatura')
class Meta:
verbose_name = 'Assinante'
verbose_name... | pydawan/protetores_bucais | protetores_bucais/apps/newsletter/models.py | Python | mit | 397 |
from __future__ import division
import warnings
import os, sys
import numpy as np
import scipy.spatial
import scipy.weave
import scipy.stats.kde
import matplotlib.pyplot as pp
import bisect
# apparently scipy.weave is depricated. I really shouldn't have used it.
# the best thing would probably be to port entropy_nn()... | rampasek/seizure-prediction | features/entropy.py | Python | gpl-2.0 | 10,855 |
#{{{ valid_key
valid_key = """-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAyGE8JpvCpp/0aLm6s0C56V5JtVr/fWra/pdFviA8YSabUlur
kcVPwoZLPbYmZtqmjfLSp5k1aCQbSqQDuB3nduFvWS6TzB8ACRDfw4KHE2D76pNE
lPbPejzIF8AyNKLrqi/Tba17cmqw1FFICg3B5ftu7mBzhJCPS/mt1i89CuoKVWRo
VB1CCKqJ0XIUO5/GC8nH2TwAzhnQpCx5B0bUJZkPxB5qbjXPpewY0IpSMNLrAGB... | richo/groundstation | test/support/crypto_fixture.py | Python | mit | 10,569 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2016 CERN.
#
# INSPIRE 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... | Panos512/inspire-next | inspirehep/modules/records/serializers/cvformatlatex_serializer.py | Python | gpl-2.0 | 2,134 |
import numpy as np
from numpy.testing import assert_allclose
from scipy.ndimage.interpolation import shift as ndshift
from xni.adjust import shift
data = np.zeros((3,5,5), dtype='f4') + 3.0
def test_shift_all1():
res = shift.shift3d(data)
real = data
assert_allclose(data, res)
def test_shift_all2():
... | hyounggyu/xni | xni/adjust/tests/test_shift.py | Python | lgpl-3.0 | 675 |
import sys
from pycmef.section import Section
class SectionManagerMixin:
def init_section_manager(self):
self.initialized = False
self.current_section = None
self.current_subsection = None
def json_for_section(self, name):
for sect in self.sections:
if sect.name == name:
return sec... | zv1n/pycmef | pycmef/mixins/section_manager.py | Python | bsd-2-clause | 1,453 |
from flask import Flask, request
from twilio.rest import TwilioRestClient
from insituApi import UserRepo
from insituApi import ProductRepo
print("sending sms...")
acctID = "TWILLIO_ACCT_ID"
authTok = "TWILLIO_AUTH_TOKEN"
_prodRepo = ProductRepo()
client = TwilioRestClient(acctID, authTok)
product = _prodRepo.sear... | kramwens/order_bot | sms-sender.py | Python | mit | 525 |
import pytest
from mixer.backend.django import mixer
pytestmark = pytest.mark.django_db
class Test3D:
def test_init(self):
threed = mixer.blend('gardenbotvr.ThreeD')
assert threed.pk == 1, 'should save an instance'
| robertshiple/GARDEN-BOT-VR | gardenbotvr/tests/test_models.py | Python | mpl-2.0 | 240 |
# Copyright (c) 2013 Rackspace, 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 wr... | openstack/zaqar | zaqar/tests/functional/wsgi/v1/test_queues.py | Python | apache-2.0 | 14,348 |
import yaml
with open('config.yaml', 'r') as f:
loaded = yaml.safe_load(f.read())
locals().update(loaded)
| ThaTiemsz/jetski | rowboat/config.py | Python | mit | 115 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.