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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# @license Apache-2.0
#
# Copyright (c) 2018 The Stdlib 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
#
# ... | stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/cosh/benchmark/python/benchmark.py | Python | apache-2.0 | 2,165 |
"""Send a picture Fling"""
import pyfling
f = pyfling.Fling("XXXXXXXX")
img_url = f.upload("test.jpg")
#img_url = "http://lorempixel.com/640/1138"
result = f.send_image(img_url)
print(result) | davejm/pyfling | examples.sendimage.py | Python | mit | 194 |
# -*- coding: utf-8 -*-
#
# pytest-single_file_logging documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 1 00:43:18 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
# autoge... | darthghandi/pytest-single-file-logging | docs/conf.py | Python | apache-2.0 | 9,465 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000028.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000028 | BIOMD0000000028/model.py | Python | cc0-1.0 | 427 |
#
# The Python Imaging Library
# $Id$
#
# GRIB stub adapter
#
# Copyright (c) 1996-2003 by Fredrik Lundh
#
# See the README file for information on usage and redistribution.
#
import Image, ImageFile
_handler = None
##
# Install application-specific GRIB image handler.
#
# @param handler Handler ob... | robiame/AndroidGeodata | pil/GribStubImagePlugin.py | Python | mit | 1,558 |
'''
Copyright 2016, EMC, Inc.
Author(s):
FIT test script template
'''
import fit_path # NOQA: unused import
import sys
import subprocess
import pprint
import fit_common
import test_api_utils
# LOCAL
NODELIST = []
def get_switches():
# returns a list with valid node IDs that match ARGS_LIST.sku in 'Name' or ... | tannoa2/RackHD | test/tests/switch/test_rackhd11_switch_pollers.py | Python | apache-2.0 | 12,932 |
#!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | MTG/essentia | test/src/unittests/rhythm/test_superfluxextractor.py | Python | agpl-3.0 | 4,892 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
import datetime
CURYEAR = datetime.date.today().year
HO... | huisaddison/blog | publishconf.py | Python | gpl-3.0 | 911 |
import unittest
from kivy3 import Object3D
from tests.utils import Sandbox
class DummyObject:
pass
class Object3DTest(unittest.TestCase):
def setUp(self):
self.sandbox = Sandbox()
self.obj = Object3D()
def tearDown(self):
self.sandbox.restore()
def test_position(self):
... | nskrypnik/kivy3 | tests/core/test_object3d.py | Python | mit | 1,024 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests for the app.py functions. These tests use the chalice.test.Client
class provided by AWS Chalice to simplify route testing.
"""
import json
from unittest.mock import MagicMock
import pytest
from ch... | awsdocs/aws-doc-sdk-examples | python/cross_service/aurora_rest_lending_library/library_api/test/test_library_api_app.py | Python | apache-2.0 | 4,526 |
#!/usr/bin/env python
from PIL import Image, ImageDraw, ImageFont, ImageEnhance
import re
import sys
import argparse
import os.path
##
## @brief Recreates an image with code/text as pixels
##
## @param img The image
## @param text The text
## @param font The font
## @param font... | DavZim/imageCoder | imageCoder.py | Python | mit | 3,283 |
from decimal import Decimal
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql import AreaField
from django.contrib.gis.measure import (
Area as AreaMeasure, Distance as DistanceMeasure,
)
from django.core.exceptions import FieldError
from django.db.models import Fl... | whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/django/contrib/gis/db/models/functions.py | Python | mit | 15,760 |
import numpy as np
from scipy.io import netcdf_file
import bz2
import os
from fnmatch import fnmatch
from numba import jit
@jit
def binsum2D(data, i, j, Nx, Ny):
data_binned = np.zeros((Ny,Nx), dtype=data.dtype)
N = len(data)
for n in range(N):
data_binned[j[n],i[n]] += data[n]
return data_binn... | rabernat/satdatatools | satdatatools/aggregator.py | Python | mit | 1,349 |
# stdlib
import os
import types
import platform
import warnings
import traceback
# stdlib, in support of the the 'probe' method
import socket
import datetime
import time
import json
# 3rd-party packages
from lxml import etree
from ncclient import manager as netconf_ssh
import ncclient.transport.errors as NcErrors
imp... | mith1979/ansible_automation | applied_python/applied_python/lib/python2.7/site-packages/jnpr/junos/device.py | Python | apache-2.0 | 30,232 |
# Unit tests for typecast functions in django.db.backends.util
import datetime
import unittest
from django.db.backends import utils as typecasts
from django.utils import six
TEST_CASES = {
'typecast_date': (
('', None),
(None, None),
('2005-08-11', datetime.date(2005, 8, 11)),
('1... | moreati/django | tests/db_typecasts/tests.py | Python | bsd-3-clause | 2,490 |
from django.contrib import admin
from organization.models.Organization import Organization
# Register your models here.
admin.register(Organization)
| arcingio/arcing.io | services/cms/organization/admin.py | Python | mit | 149 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from pycket import values, values_parameter
from pycket.prims.expose import (expose, expose_val, default, make_procedure, procedure)
from pycket.cont import continuation, loop_label
class W_PlumberFlushHandle(values.W_Object):
_attrs_ = _immutable_fields_ = ["plumber... | pycket/pycket | pycket/prims/plumber.py | Python | mit | 3,398 |
# -*- test-case-name: twisted.python.test.test_dist -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Distutils convenience functionality.
Don't use this outside of Twisted.
Maintainer: Christopher Armstrong
@var _EXTRA_OPTIONS: These are the actual package names and versions that will... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/python/dist.py | Python | gpl-3.0 | 10,777 |
import email
import imaplib
import re
from imapclient import IMAPClient
from utils import Utils
class DigestServer(object):
def __init__(self, server, mid, digest_folder_name):
self.digest_folder_name = digest_folder_name
self.digest_inbox = server
self.previous_message_id = mid
def... | paul-hammant/imapdigester | digesters/digestion_processor.py | Python | mit | 6,530 |
import re
from typing import List
from urllib.parse import urlparse
import pytest
from bs4 import BeautifulSoup
from google.appengine.ext import ndb
from werkzeug.test import Client
from backend.common.consts.account_permission import AccountPermission
from backend.common.consts.media_type import MediaType
from backe... | the-blue-alliance/the-blue-alliance | src/backend/web/handlers/suggestions/tests/suggest_team_media_review_controller_test.py | Python | mit | 8,438 |
import _plotly_utils.basevalidators
class ValueValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="value", parent_name="isosurface", **kwargs):
super(ValueValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/isosurface/_value.py | Python | mit | 411 |
'''
HCSvLab Aspera download python script
Sample usage:
python aspera_download.py --key API_KEY --item_list_id 34 --destination ~/Downloads
Be sure to fill in API_URL, ASCP_COMMAND and ASCP_KEY to the correct values on your machine
API_URL: Alveo host you are using; QA URL, Staging URL etc.
ASCP_COMMAND: link to t... | IntersectAustralia/hcsvlab | script/aspera_download.py | Python | gpl-3.0 | 2,801 |
"""
_____________________________________________
___ < trtl - TwistedBot REPL for Testing Libraries >_
//_\\\\ _ ---------------------------------------------
/_|_|_('> /
" "
"""
import os
import sys
import traceback
import readline
import re
regex = re.compile("\x03(?:\d{1,2}(?:,\d{1,2})?)?... | andimiller/twistedbot | trtl.py | Python | mit | 1,914 |
import sys
import json
from agent import Agent, Handler
import udf_pb2
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s:%(name)s: %(message)s')
logger = logging.getLogger()
# Find outliers via the Tukey method. As defined in the README.md
class OutliersHandler(Handler):
... | alerta/kapacitor | udf/agent/examples/outliers/outliers.py | Python | mit | 4,428 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-asset | google/cloud/asset_v1p2beta1/services/asset_service/transports/grpc.py | Python | apache-2.0 | 15,773 |
# -*- coding: utf-8 -*-
#
# Diazo documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 2 18:58:07 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 c... | ebrehault/diazo | docs/conf.py | Python | bsd-3-clause | 6,987 |
from yass.reader import READER
import numpy as np
import os
import parmap
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
def get_cov(templates):
dat = templates.transpose(0, 2, 1).reshape(-1, templates.shape[1])
dat = dat[:, 30:-30]
dat = dat[dat.ptp(1) > 0.5]
dat = dat - np.me... | paninski-lab/yass | src/yass/visual/ptp_time.py | Python | apache-2.0 | 12,874 |
class Vertex(object):
def __init__(self, data, in_degree=0, out_degree=0, status='UNDISCOVERED', \
d_time=-1, f_time=-1, parent=-1, prioity=65532):
self.data = data
self.in_degree = in_degree
self.out_degree = out_degree
self.status = status
self.d_time = d_... | haoliangyu/basic-data-structure | GraphElement.py | Python | mit | 639 |
import numpy as np
from pandas import (
Categorical,
Index,
NaT,
Series,
date_range,
)
from ..pandas_vb_common import tm
class IsIn:
params = [
"int64",
"uint64",
"object",
"Int64",
"boolean",
"bool",
"datetime64[ns]",
"categor... | pandas-dev/pandas | asv_bench/benchmarks/algos/isin.py | Python | bsd-3-clause | 9,544 |
#!/usr/bin/python
#
# Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es)
#
# 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
... | mF2C/COMPSs | compss/programming_model/bindings/python/src/pycompss/api/dummy/ompss.py | Python | apache-2.0 | 1,125 |
# -*- coding: utf-8 -*-
#
# Freemix documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 24 11:38:38 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... | zepheira/freemix | docs/conf.py | Python | apache-2.0 | 6,571 |
# Copyright 2012 Nebula, Inc.
# 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/LICENSE-2.0
#
# Unless required... | HybridF5/jacket | jacket/tests/compute/functional/api_sample_tests/test_instance_usage_audit_log.py | Python | apache-2.0 | 1,937 |
import json
from astropy import units as u
from sunpy.net import vso
from sunpy.database import attrs as db_attrs
from sunpy.database.serialize import QueryEncoder, query_decode
def test_vso_wave():
attr = vso.attrs.Wave(100 * u.AA, 200 * u.AA)
expected = '{"Wave": [100.0, 200.0, "Angstrom"]}'
assert js... | Alex-Ian-Hamilton/sunpy | sunpy/database/tests/test_serialize.py | Python | bsd-2-clause | 5,068 |
# Copyright (c) 2014, Oracle and/or its affiliates. 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
#
# ... | NetApp/manila | manila/share/drivers/zfssa/restclient.py | Python | apache-2.0 | 12,868 |
# -*- coding: utf-8 -*-
import gi
gi.require_version('Peas', '1.0')
gi.require_version('Gtk', '3.0')
gi.require_version('Totem', '1.0')
from gi.repository import GLib, GObject # pylint: disable-msg=E0611
from gi.repository import Peas, Gtk, Gdk # pylint: disable-msg=E0611
from gi.repository import Gio, Pango, Totem # ... | ndufresne/totem | src/plugins/opensubtitles/opensubtitles.py | Python | gpl-2.0 | 26,489 |
import unittest
import openmesh
class TriMeshCirculatorVertexIHalfEdge(unittest.TestCase):
def setUp(self):
self.mesh = openmesh.TriMesh()
# Add some vertices
self.vhandle = []
self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0)))
self.vhandle.append(self.mes... | svn2github/OpenMesh2 | src/Python/Unittests/test_trimesh_circulator_vertex_ihalfedge.py | Python | bsd-3-clause | 3,197 |
import pytz
from django.apps import apps
from django.db.models import F, Q
from api.addons.views import AddonSettingsMixin
from api.base import permissions as base_permissions
from api.base.waffle_decorators import require_flag
from api.base.exceptions import Conflict, UserGone
from api.base.filters import ListFilter... | mattclark/osf.io | api/users/views.py | Python | apache-2.0 | 35,356 |
#!/usr/bin/python3
import sys
import json
def argument_for_question(question, all_choices=False):
question_type = question.get("type")
if question_type is None and question.get("choices"):
question_type = "boolean"
elif question_type in [None, "string"] and question.get("default"):
questi... | YunoHost/package_check | lib/manifest_parsing.py | Python | gpl-3.0 | 2,032 |
#!/usr/bin/env python
# Copyright 2014 Stanford University and Los Alamos National Security, 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/LICENS... | SKA-ScienceDataProcessor/legion-sdp-clone | deprecated/compiler/lib/lcomp/type_check.py | Python | apache-2.0 | 56,247 |
# import logging
from ast.visit import visit as v
from ast.node import Node
from ast.body.methoddeclaration import MethodDeclaration
from ast.stmt.minrepeatstmt import MinrepeatStmt
class Desugar(object):
def __init__(self):
self._cur_mtd = None
@v.on("node")
def visit(self, node):
"""... | plum-umd/java-sketch | java_sk/rewrite/desugar.py | Python | mit | 1,242 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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 ... | wozz/electrum-myr | lib/bitcoin.py | Python | gpl-3.0 | 24,716 |
b = 2
a = 1
| asedunov/intellij-community | python/testData/mover/simple_afterDown.py | Python | apache-2.0 | 12 |
from chowdren.writers.events.system import get_loop_index_name
def use_deferred_collisions(converter):
return False
def init(converter):
converter.add_define('CHOWDREN_IS_TE')
converter.add_define('CHOWDREN_IS_TEED')
converter.add_define('CHOWDREN_QUICK_SCALE')
converter.add_define('CHOWDREN_POINT... | joaormatos/anaconda | Chowdren/configs/teed.py | Python | gpl-3.0 | 904 |
import Queue
import time
from bpython.repl import Interaction as BpythonInteraction
from manual_readline import char_sequences as rl_char_sequences
class StatusBar(BpythonInteraction):
"""StatusBar and Interaction for Repl
Passing of control back and forth between calls that use interact api
(notify, co... | thomasballinger/scottwasright | scottsright/interaction.py | Python | mit | 4,438 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from .generic import *
from criacao.forms import *
from criacao.models import *
from gerenciamento.models import *
logger = logging.getLogger(__name__)
class LinkView(GenericView):
def criar(self, request):
if request.method == 'POST':
form = L... | wendellpbarreto/tronco | criacao/views/link.py | Python | mit | 3,423 |
# Try to Import module in same directory as me, but:
#from . import m1 # <==OK in package, not allowed in non-package mode in 2.X + 3.X
#import m1 # <==OK in program, fails to check package's own dir in 3.X
# set PYTHONPATH=c:\code
import dualpkg.m1 as m1 # <==works in both modes if sys.path includ... | simontakite/sysadmin | pythonscripts/learningPython/dualpkg/m2.py | Python | gpl-2.0 | 492 |
#
# Copyright (C) 2000 Stephen Davies
# Copyright (C) 2000 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
from Synopsis.Formatters.HTML.Tags import *
from Default import Default
class DetailCommenter(Default):
"""Add ann... | stefanseefeld/synopsis | Synopsis/Formatters/HTML/Fragments/DetailCommenter.py | Python | lgpl-2.1 | 523 |
"""
sentry.filters.helpers
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
# Widget api is pretty ugly
from __future__ import absolute_import
__all__ = ('get_filters',)
import logging
from django.utils.translation i... | chayapan/django-sentry | src/sentry/filters/helpers.py | Python | bsd-3-clause | 2,281 |
from backdoors.backdoor import *
class Shell(Backdoor):
prompt = Fore.RED + "(shell) " + Fore.BLUE + ">> " + Fore.RESET
def __init__(self, core):
cmd.Cmd.__init__(self)
self.intro = GOOD + "Using Shell backdoor..."
self.core = core
self.options = {
"name" ... | sovaa/backdoorme | backdoors/escalation/shell.py | Python | mit | 1,569 |
# -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout.
import pytest
from skidl import Net, Pin
from .setup_teardown import setup_function, teardown_function
def test_net_merge_1():
a = Net("A")
b = Net("B")
a += 5 * Pin()
assert len(a) == 5
b += Pin(), Pin(... | xesscorp/skidl | tests/test_merge.py | Python | mit | 386 |
# 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 ... | v-iam/azure-sdk-for-python | azure-graphrbac/azure/graphrbac/models/key_credential.py | Python | mit | 1,662 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.shell
~~~~~~~~~~~~~~~~~~~~~
Lexers for various shells.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, inclu... | aeppert/diaphora | pygments/lexers/shell.py | Python | gpl-2.0 | 15,794 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Provide a class for storing project information.
Besides providing properties for storing data, the class also provides
packing, unpacking and other helper methods to provide basic manipulation
of projects (e.g. saving/loading from drive).
'''
import pickle
import os... | quasipedia/Chasy | src/models/project.py | Python | gpl-3.0 | 8,489 |
#!/usr/bin/env python2
# coding: utf-8
'''Code to talk to the softstep foot controller.
Copyright 2014, Matthieu Amiguet
The midi sniffing has been done by Tom Swirly.
https://github.com/rec/swirly/blob/master/js/swirly/softstep/enable.js
This file is part of FooCoCo.
FooCoCo is free software: you can redistribut... | amiguet/foococo | hardware.py | Python | gpl-3.0 | 3,998 |
# 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
# d... | mrunge/openstack_horizon | openstack_horizon/dashboards/admin/aggregates/panel.py | Python | apache-2.0 | 1,258 |
"""The tests for the Netatmo climate platform."""
from unittest.mock import Mock, patch
from homeassistant.components.climate import (
DOMAIN as CLIMATE_DOMAIN,
SERVICE_SET_HVAC_MODE,
SERVICE_SET_PRESET_MODE,
SERVICE_SET_TEMPERATURE,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
)
from homeassistant.compo... | Danielhiversen/home-assistant | tests/components/netatmo/test_climate.py | Python | apache-2.0 | 26,123 |
import os
from example_builder import ExampleBuilder
RST_TEMPLATE = """
.. _%(sphinx_tag)s:
%(docstring)s
%(image_list)s
.. raw:: html
<div class="toggle_trigger"><a href="#">
**Code output:**
.. raw:: html
</a></div>
<div class="toggle_container">
.. literalinclude:: %(stdout)s
.. raw:: html
... | cigroup-ol/metaopt | docs/_extensions/gen_figure_rst.py | Python | bsd-3-clause | 1,626 |
#!/usr/bin/python
from participantCollection import ParticipantCollection
import string
import re
import datetime
import pyperclip
# Edit Me!
# Remember, this is during signup, so current month is not June, it's May.
currentMonthTotalDays = 31
currentMonthURL = "https://www.reddit.com/r/pornfree/comments/5lefq1/stay_c... | foobarbazblarg/stayclean | stayclean-2017-february/display-during-signup.py | Python | mit | 6,610 |
from rambutan3.check_args.annotation.ANY import ANY
from rambutan3.check_args.annotation.INT import INT
from rambutan3.check_args.annotation.ONE_OR_MORE_OF import ONE_OR_MORE_OF
def test():
assert ONE_OR_MORE_OF(ANY).matches(None)
assert ONE_OR_MORE_OF(ANY).matches([None])
assert ONE_OR_MORE_OF(INT).match... | kevinarpe/kevinarpe-rambutan3 | tests/check_args/annotation/test_ONE_OR_MORE_OF.py | Python | gpl-3.0 | 621 |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 30 19:07:37 2017
@author: AmatVictoriaCuramIII
"""
import numpy as np
import random as rand
import pandas as pd
import time as t
#from DatabaseGrabber import DatabaseGrabber
from YahooGrabber import YahooGrabber
from ListPairs import ListPairs
Empty = []
Sta... | adamrvfisher/TechnicalAnalysisLibrary | SpeedDaterSMAspread.py | Python | apache-2.0 | 9,366 |
"""A linting utility for targets.json
This linting utility may be called as follows:
python <path-to>/lint.py targets TARGET [TARGET ...]
all targets will be linted
"""
# mbed SDK
# Copyright (c) 2017 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except i... | betzw/mbed-os | tools/targets/lint.py | Python | apache-2.0 | 10,114 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Visit.service'
db.alter_column(u'clinics_visit', 'serv... | myvoice-nigeria/myvoice | myvoice/clinics/migrations/0013_auto__chg_field_visit_service.py | Python | bsd-2-clause | 13,197 |
"""
WSGI config for parker project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | banacer/parker.io | parker/parker/wsgi.py | Python | mit | 389 |
import unittest
from torchtext.data.metrics import bleu_score
class TestTorchtext(unittest.TestCase):
def test_bleu_score(self):
candidate = [['I', 'love', 'Kaggle', 'Notebooks']]
refs = [[['Completely', 'Different']]]
self.assertEqual(0, bleu_score(candidate, refs))
| Kaggle/docker-python | tests/test_torchtext.py | Python | apache-2.0 | 301 |
import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))
from pattern.web import Bing, plaintext
from pattern.en import parsetree
from pattern.search import Pattern
from pattern.db import Datasheet, pprint
# "X IS MORE IMPORTANT THAN Y"
# Here is a rough example of how to bui... | krishna11888/ai | third_party/pattern/examples/04-search/09-web.py | Python | gpl-2.0 | 1,296 |
import FWCore.ParameterSet.Config as cms
process = cms.Process('slim')
process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring())
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(10))
process.output = cms.OutputModule("PoolOutputModule",
outputComman... | matz-e/lobster | examples/simple_pset.py | Python | mit | 579 |
__author__ = 'M@Campbell'
from ooiservices.app import create_celery_app
from ooiservices.app.main.c2 import _compile_c2_toc
from flask.globals import current_app
import requests
from flask.ext.cache import Cache
CACHE_TIMEOUT = 172800
'''
Create the celery app, and configure it to talk to the redis broker.
Then in... | oceanzus/ooi-ui-services | ooiservices/app/tasks.py | Python | apache-2.0 | 11,401 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Radius(A10BaseClass):
"""Class Description::
RADIUS type.
Class radius supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param radius_username: {"description": "Sp... | amwelch/a10sdk-python | a10sdk/core/health/health_monitor_method_radius.py | Python | apache-2.0 | 2,951 |
username = 'admin'
pwd = '123321...'
dbname = 'Prueba'
host = '127.0.0.1'
port = '8069'
filepath = '/home/aphu/Downloads/'
filename = 'cantvnet.ods'
| ITPS/oerp_gap_analysis_ITPS | utils/odf2gap/settings.py | Python | gpl-3.0 | 149 |
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import dask.dataframe as dd
from dask.dataframe.utils import (shard_df_on_index, meta_nonempty, make_meta,
raise_on_meta_error)
import pytest
def test_shard_df_on_index():
df = pd.DataFrame({'x': [1, 2, 3, 4... | jeffery-do/Vizdoombot | doom/lib/python3.5/site-packages/dask/dataframe/tests/test_utils_dataframe.py | Python | mit | 7,032 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | tmerrick1/spack | var/spack/repos/builtin/packages/isaac-server/package.py | Python | lgpl-2.1 | 2,583 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetViewCount
# Returns the ticket count for a single view.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use ... | jordanemedlock/psychtruths | temboo/core/Library/Zendesk/Views/GetViewCount.py | Python | apache-2.0 | 3,674 |
"""Set User-Agent header per spider or use a default value from settings"""
from scrapy import signals
class UserAgentMiddleware(object):
"""This middleware allows spiders to override the user_agent"""
def __init__(self, user_agent='Scrapy'):
self.user_agent = user_agent
@classmethod
def fr... | agreen/scrapy | scrapy/downloadermiddlewares/useragent.py | Python | bsd-3-clause | 749 |
import pkgutil
class NoQuestionInModuleException(Exception): pass
# Define a dict to add all of our finds to.
categories = {}
def load(path):
# Path needs to be a list in order for the following calls to work.
if type(path) != list: path = [path]
# Walk the directory.
for loader, name, ispkg in pkgut... | alexander-bauer/swirlypy | swirlypy/questions/__init__.py | Python | gpl-3.0 | 881 |
# Copyright 2020 DeepMind Technologies Limited.
#
#
# 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 agre... | deepmind/deepmind-research | kfac_ferminet_alpha/utils.py | Python | apache-2.0 | 15,537 |
'''
qobuz.node.helper
~~~~~~~~~~~~~~~~~
:part_of: kodi-qobuz
:copyright: (c) 2012-2018 by Joachim Basmaison, Cyril Leclerc
:license: GPLv3, see LICENSE for more details.
'''
from qobuz.debug import getLogger
from qobuz.node import getNode, Flag
logger = getLogger(__name__)
def make_local_track_u... | tidalf/plugin.audio.qobuz | resources/lib/qobuz/node/helper.py | Python | gpl-3.0 | 1,876 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings... | aschn/goodtechgigs | goodtechgigs/config/production.py | Python | apache-2.0 | 4,647 |
import os
from angel_tree import app, bcrypt
from angel_tree.mod_family.controllers import *
from angel_tree.mod_family.models import *
from angel_tree.mod_auth.models import User
from flask import url_for
from flask_login import current_user
from flask_principal import PermissionDenied
from .mod_auth_test import creat... | TreeTopper/TreeTopper | tests/family_test.py | Python | mit | 1,349 |
import os
import random
import sys
from datetime import date
from urllib import urlencode
import mailpile.auth
from mailpile.defaults import CONFIG_RULES
from mailpile.i18n import ListTranslations, ActivateTranslation, gettext
from mailpile.i18n import gettext as _
from mailpile.i18n import ngettext as _n
from mailpil... | laborautonomo/Mailpile | mailpile/plugins/setup_magic.py | Python | apache-2.0 | 40,094 |
"""Exception classes raised by urllib.
The base exception class is URLError, which inherits from IOError. It
doesn't define any behavior of its own, but is the base class for all
exceptions defined in this package.
HTTPError is an exception class that is also a valid HTTP response
instance. It behaves this way beca... | wdv4758h/ZipPy | lib-python/3/urllib/error.py | Python | bsd-3-clause | 2,461 |
# -*- coding: utf-8 -*-
# Etalage-Passim -- Customization of Etalage for Passim
# By: Emmanuel Raviart <eraviart@easter-eggs.com>
#
# Copyright (C) 2011, 2012, 2013 Easter-eggs
# http://gitorious.org/passim/etalage-passim
#
# This file is part of Etalage-Passim.
#
# Etalage-Passim is free software; you can redistribu... | Gentux/etalage-passim | etalagepassim/subscribers.py | Python | agpl-3.0 | 2,843 |
"""
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.
Example 1:
Input:
"bbbab"
Output:
4
One possible longest palindromic subsequence is "bbbb".
Example 2:
Input:
"cbbd"
Output:
2
One possible longest palindromic subsequence is ... | franklingu/leetcode-solutions | questions/longest-palindromic-subsequence/Solution.py | Python | mit | 855 |
from __future__ import print_function
from bokeh.util.browser import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import Plot, LinearAxis, Grid, ColumnDataSource, PanTool, WheelZoomTool, Title
from bokeh.resources import INLINE
from... | mindriot101/bokeh | examples/models/file/iris.py | Python | bsd-3-clause | 1,904 |
#---------------------------------------------------------------------------
# Copyright 2013 The Open Source Electronic Health Record Alliance
#
# 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... | josephsnyder/VistA | Scripts/OTJParseEvidenceOutput.py | Python | apache-2.0 | 8,153 |
"""Script for generating annotated leaf."""
import argparse
import os
import logging
import json
from jicbioimage.core.io import AutoWrite
from jicbioimage.illustrate import AnnotatedImage
from utils import get_microscopy_collection
from parameters import Parameters
from surface import surface_from_stack
from projec... | JIC-Image-Analysis/cells-from-leaves | scripts/leaf_annotation.py | Python | mit | 4,107 |
# Copyright (c) 2020 kamyu. All rights reserved.
#
# Google Code Jam 2014 Qualification Round - Problem A. Magic Trick
# https://code.google.com/codejam/contest/2974486/dashboard#s=p0
#
# Time: O(1)
# Space: O(1)
#
def magic_trick():
ANS, ARR = [0]*2, [[] for _ in xrange(2)]
for i in xrange(2):
ANS[i]... | kamyu104/GoogleCodeJam-2014 | Qualification Round/magic_trick.py | Python | mit | 686 |
# Generated by Django 2.1.5 on 2019-06-07 13:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('validation', '0004_auto_20190607_1314'),
]
operations = [
migrations.AlterField(
model_name='fl... | linea-it/dri | api/validation/migrations/0005_auto_20190607_1351.py | Python | gpl-3.0 | 503 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2013-2016 Alex Forencich
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... | Diti24/python-ivi | ivi/rigol/rigolDP832A.py | Python | mit | 2,291 |
from django.db import models
from django.contrib.auth.models import User
import time
class ArtistManager(models.Manager):
def validate(self):
"""
Validate invalid artists.
"""
qs = self.get_query_set().filter(is_valid=False)
if qs.update(is_valid=True):
return ... | tsoporan/tehorng | submissions/managers.py | Python | agpl-3.0 | 3,158 |
# 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 cstr, flt, fmt_money, formatdate
from frappe import msgprint, _, scrub
from erpnext.controllers.accounts_controll... | mbauskar/alec_frappe5_erpnext | erpnext/accounts/doctype/journal_entry/journal_entry.py | Python | agpl-3.0 | 34,075 |
# 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... | ghchinoy/tensorflow | tensorflow/python/ops/linalg/linear_operator_diag.py | Python | apache-2.0 | 9,369 |
import unittest2 as unittest
from Products.CMFCore.utils import getToolByName
from Products.PythonScripts.PythonScript import PythonScript
from collective.portlet.pythonscript.content.interface import IPythonScriptManager
from collective.viewlet.pythonscript.testing import COLLECTIVE_VIEWLET_PYTHONSCRIPT_INTEGRATION
... | radekj/collective.viewlet.pythonscript | src/collective/viewlet/pythonscript/tests/base.py | Python | gpl-2.0 | 1,371 |
from django.conf.urls import include, url
from django.contrib import admin
from products.views import (
ProductCreateView,
ProductUpdateView,
SellerProductListView
)
from .views import (
SellerDashboard,
SellerProductDetailRedirectView,
SellerTransactionListView,
)
urlpattern... | codingforentrepreneurs/digital-marketplace | src/sellers/urls.py | Python | mit | 833 |
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.sql import ClauseElement
DB_URI = 'sqlite:///stuff.db'
db_endine = create_engine(DB_URI)
session = scoped_session(
sessionmaker(
autocommit=... | Haikson/sitemap-generator | pysitemap/db.py | Python | apache-2.0 | 852 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# daemon/daemon.py
# Part of python-daemon, an implementation of PEP 3143.
#
# Copyright © 2008–2010 Ben Finney <ben+python@benfinney.id.au>
# Copyright © 2007–2008 Robert Niederreiter, Jens Klein
# Copyright © 2004–2005 Chad J. Schroeder
# Copyright © 2003... | candlepin/virt-who | virtwho/daemon/daemon.py | Python | gpl-2.0 | 25,080 |
from __future__ import absolute_import
__author__ = 'katharine'
from six import iteritems
from enum import IntEnum
from libpebble2.protocol.base import PebblePacket
from libpebble2.protocol.base.types import *
class WebSocketRelayFromWatch(PebblePacket):
payload = BinaryArray()
class WebSocketRelayToWatch(Pe... | susundberg/pebble-linux-remote | host_python/libpebble2/communication/transports/websocket/protocol.py | Python | gpl-2.0 | 3,434 |
from SDWLE.cards.base import WeaponCard
from SDWLE.game_objects import Weapon
from SDWLE.tags.action import Damage
from SDWLE.tags.base import Battlecry, Buff
from SDWLE.tags.condition import GreaterThan, IsType
from SDWLE.tags.selector import CharacterSelector, UserPicker, Count, MinionSelector
from SDWLE.tags.status ... | jomyhuang/sdwle | SDWLE/cards_copy/weapons/rogue.py | Python | mit | 1,651 |
"""Classification example using sci-kit learn k-nearest
"""
import pandas as pd
import numpy as np
from sklearn import cross_validation, neighbors
# read data, replace missing values, drop useless id column
df = pd.read_csv('breast-cancer-wisconsin.data')
df.replace('?', -99999, inplace=True)
df.drop(['id'], 1, inpla... | FelixPM/Learning-Machine-Learning | sentdex/classification.py | Python | mit | 1,002 |
# -*- coding: utf-8 -*-
import pytest
from cfme import test_requirements
from cfme.cloud.stack import Stack
from cfme.common.vm import VM
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import toolbar, Quadicon
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from ... | kzvyahin/cfme_tests | cfme/tests/cloud/test_delete_cloud_object.py | Python | gpl-2.0 | 2,744 |
#!/usr/bin/env python3
#
# Copyright (c) 2016-2019, The OpenThread 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/LIC... | openthread/pyspinel | spinel-cli.py | Python | apache-2.0 | 73,319 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.