text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
import argparse
from sys import argv
from vang.bitbucket.get_branches import get_branches
from vang.bitbucket.utils import get_repo_specs
def has_branch(repo_specs, branch):
for spec in repo_specs:
branches = [
b['displayId'] for spec, bs in get_branches((spec, ), branc... | bjuvensjo/scripts | vang/bitbucket/has_branch.py | Python | apache-2.0 | 1,977 | 0 |
# -*- coding: utf-8 -*-
# daemon/pidfile.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# Copyright © 2008–2015 Ben Finney <ben+python@benfinney.id.au>
#
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the Apache License, version 2.0 as published by the
#... | madflow/qnap-radicale | shared/lib/daemon/pidfile.py | Python | gpl-2.0 | 2,139 | 0 |
# -*- coding: utf-8 -*-
from contextlib import contextmanager
from django.conf import settings
from django.core.signals import request_started
from django.db import reset_queries
from django.template import context
from django.utils.translation import get_language, activate
from shutil import rmtree as _rmtree
from tem... | SinnerSchraderMobileMirrors/django-cms | cms/test_utils/util/context_managers.py | Python | bsd-3-clause | 6,028 | 0.004147 |
import os
import sys
import fnmatch
serp_directory = '/Users/david/Dropbox/Shares/Vu-David/data/iiix_serp_results/'
serp_directory_files = [z for z in os.listdir(serp_directory) if os.path.isfile(os.path.join(serp_directory, z))]
def get_user_topic_queries(queries):
"""
Taking the queries data structure (gene... | maxwelld90/searcher_simulations | configs/publications/cikm2015/scripts/user_summary_generator_cg.py | Python | gpl-2.0 | 13,051 | 0.009961 |
import sys
from stack import Stack
def parse_expression_into_parts(expression):
"""
Parse expression into list of parts
:rtype : list
:param expression: str # i.e. "2 * 3 + ( 2 - 3 )"
"""
raise NotImplementedError("complete me!")
def evaluate_expression(a, b, op):
raise NotImplementedErr... | tylerprete/evaluate-math | postfix.py | Python | mit | 792 | 0.001263 |
#!/usr/bin/env python
"""Test registry for builders."""
# These need to register plugins so, pylint: disable=unused-import
from grr.lib.builders import signing_test
# pylint: enable=unused-import
| pidydx/grr | grr/lib/builders/tests.py | Python | apache-2.0 | 196 | 0 |
from .polygon import *
| pygeo/geoval | geoval/polygon/__init__.py | Python | apache-2.0 | 23 | 0 |
import pickle
import unittest
import numpy as np
import scipy.sparse as sp
from sklearn import linear_model, datasets, metrics
from sklearn.base import clone
from sklearn.linear_model import SGDClassifier, SGDRegressor
from sklearn.preprocessing import LabelEncoder, scale, MinMaxScaler
from sklearn.utils.testing impor... | DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/sklearn/linear_model/tests/test_sgd.py | Python | mit | 44,262 | 0.000226 |
import json
import os
from flask import request, g, render_template, make_response, jsonify, Response
from helpers.raw_endpoint import get_id, store_json_to_file
from helpers.groups import get_groups
from json_controller import JSONController
from main import app
from pymongo import MongoClient, errors
HERE = os.pat... | CenterForOpenScience/scinet | scinet/views.py | Python | mit | 4,696 | 0.005537 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | nuagenetworks/vspk-python | vspk/v6/nutestsuite.py | Python | bsd-3-clause | 12,813 | 0.009444 |
"""The main model for all the views in pdsspect"""
import os
import warnings
import numpy as np
from astropy import units as astro_units
from ginga.util.dp import masktorgb
from planetaryimage import PDS3Image
from ginga.BaseImage import BaseImage
from ginga import colors as ginga_colors
from ginga.canvas.types.image ... | planetarypy/pdsspect | pdsspect/pdsspect_image_set.py | Python | bsd-3-clause | 26,738 | 0.000037 |
# encoding: utf-8
from django.contrib import admin
# Register your models here.
| valdergallo/raidmanager | manager/admin.py | Python | mit | 81 | 0 |
# -*- coding: utf-8 -*-
# TAMkin is a post-processing toolkit for normal mode analysis, thermochemistry
# and reaction kinetics.
# Copyright (C) 2008-2012 Toon Verstraelen <Toon.Verstraelen@UGent.be>, An Ghysels
# <An.Ghysels@UGent.be> and Matthias Vandichel <Matthias.Vandichel@UGent.be>
# Center for Molecular Modeling... | molmod/tamkin | tamkin/pftools.py | Python | gpl-3.0 | 21,612 | 0.004164 |
# (c) 2015, Ansible Inc,
#
# 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 is di... | salivatears/ansible | lib/ansible/plugins/action/service.py | Python | gpl-3.0 | 2,322 | 0.003876 |
import json
import re
import subprocess
from django.conf import settings
default_app_config = "peering.apps.PeeringConfig"
def call_irr_as_set_resolver(irr_as_set, address_family=6):
"""
Call a subprocess to expand the given AS-SET for an IP version.
"""
prefixes = []
if not irr_as_set:
... | respawner/peering-manager | peering/__init__.py | Python | apache-2.0 | 2,416 | 0.001656 |
"""
Settings validations for the theming app
"""
import os
import six
from django.conf import settings
from django.core.checks import Error, Tags, register
@register(Tags.compatibility)
def check_comprehensive_theme_settings(app_configs, **kwargs):
"""
Checks the comprehensive theming theme directory settings... | BehavioralInsightsTeam/edx-platform | openedx/core/djangoapps/theming/checks.py | Python | agpl-3.0 | 2,784 | 0.001796 |
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
######################################################... | arrayfire/arrayfire-python | arrayfire/features.py | Python | bsd-3-clause | 2,480 | 0.002823 |
from rpython.flowspace.model import *
import py
def test_mingraph():
g = FunctionGraph("g", Block([]))
g.startblock.closeblock(Link([Constant(1)], g.returnblock))
checkgraph(g)
def template():
g = FunctionGraph("g", Block([]))
g.startblock.closeblock(Link([Constant(1)], g.returnblock))
checkgr... | oblique-labs/pyVM | rpython/flowspace/test/test_checkgraph.py | Python | mit | 2,837 | 0.003525 |
# -*- coding: utf-8 -*-
#
# @file hocr.py
#
# @remark Copyright 2014 Philippe Elie
# @remark Read the file COPYING
#
# @author Philippe Elie
import os
import sys
import json
sys.path.append(os.path.expanduser('~/phe/common'))
import serialize
sys.path.append(os.path.expanduser('~/phe/jobs'))
import sge_jobs
import co... | WeftWiki/phetools | hocr/hocr_cgi.py | Python | gpl-3.0 | 10,682 | 0.008706 |
# tool_extrude.py
# Extrusion tool.
# Copyright (c) 2015, Lennart Riecken
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versi... | chrmoritz/zoxel | src/plugins/tool_extrude.py | Python | gpl-3.0 | 6,660 | 0.000601 |
# Pyperclip v1.4
# A cross-platform clipboard module for Python. (only handles plain text for now)
# By Al Sweigart al@coffeeghost.net
# Usage:
# import pyperclip
# pyperclip.copy('The text to be copied to the clipboard.')
# spam = pyperclip.paste()
# On Mac, this module makes use of the pbcopy and pbpaste com... | almc/speed_reader | pyperclip.py | Python | gpl-2.0 | 5,763 | 0.004164 |
# mhkutil - A utility for dealing with Mohawk archives
#
# mhkutil is the legal property of its developers, whose names
# can be found in the AUTHORS file distributed with this source
# distribution.
#
# mhkutil is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licen... | clone2727/mhkutil | stream.py | Python | gpl-3.0 | 3,692 | 0.026273 |
# -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api, _
import openerp.addons.decimal_precision as dp
class StockInformation(models.Model):
_inherit = 'stock.information'
@api.multi
def ... | agaldona/odoo-addons | stock_information_mrp_procurement_plan/models/stock_information.py | Python | agpl-3.0 | 8,497 | 0 |
from django.contrib import admin
from .models import Job
# Register your models here.
admin.site.register(Job)
| WilliamQLiu/job-waffle | employer/admin.py | Python | apache-2.0 | 113 | 0 |
from django.contrib import admin
from django.contrib.sites.models import Site
from . import models
class RedirectAdmin(admin.ModelAdmin):
list_display = ['slug', 'url', 'counter', 'created_at', 'full_url']
readonly_fields = ['counter', 'created_at', 'full_url']
fields = ['slug', 'url', 'counter', 'created... | fnp/wolnelektury | src/redirects/admin.py | Python | agpl-3.0 | 595 | 0 |
import numpy as np
import cv2
import matplotlib.pyplot as plt
img = cv2.imread('images/dolphin.png', 0)
cv2.imshow("Dolphin Image", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
print('The intensity value at row 50 & column 100 is : {}'.format(img[49, 99]))
print('Row 50 column values:')
print(img[49, :])
print('Row... | KECB/learn | computer_vision/01_inspecting_images.py | Python | mit | 412 | 0 |
def LetterCount(str):
words = str.split(" ")
result_word = ""
letter_count = 0
for word in words:
word_map = {}
for ch in word:
if ch in word_map:
word_map[ch] += 1
else:
word_map[ch] = 1
max_key = max(word_map.iterkeys(), ... | DevCouch/coderbyte_python | medium/letter_count.py | Python | gpl-2.0 | 614 | 0.004886 |
import urllib2
import logging
import os
import re
import string
import types
import glob
import ConfigParser
import StringIO
import commands
import shutil
from distutils import dir_util # virtualenv problem pylint: disable=E0611
from avocado.utils import process
from avocado.utils import genio
from avocado.utils impo... | vipmike007/avocado-vt | virttest/asset.py | Python | gpl-2.0 | 21,905 | 0.000228 |
# -*- coding: utf8 -*-
from time import time
from threading import Lock
from functools import wraps
STATE_CLOSED = "closed"
STATE_OPEN = "open"
STATE_HALF_OPEN = "half-open"
def get_now():
return int(time())
class CircuitBreakerError(Exception):
pass
class TooManyRequestsError(CircuitBreakerError):
... | xgfone/snippet | snippet/example/python/circuit_breaker.py | Python | mit | 8,647 | 0.000347 |
"""URLs."""
from django.conf.urls import include, url
from django.contrib import admin
import apps.status.views
admin.autodiscover()
# Examples:
# url(r'^$', 'gettingstarted.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
urlpatterns = [
url(r'^$', apps.status.views.index, name='index'),
... | ifnull/hello-tracking | project/urls.py | Python | apache-2.0 | 482 | 0 |
# vim: ts=4:sw=4:expandtab
# BleachBit
# Copyright (C) 2008-2020 Andrew Ziem
# https://www.bleachbit.org
#
# 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
# ... | tstenner/bleachbit | tests/TestCommon.py | Python | gpl-3.0 | 2,298 | 0.00087 |
from helper import unittest, PillowTestCase
from PIL import Image, CurImagePlugin
TEST_FILE = "Tests/images/deerstalker.cur"
class TestFileCur(PillowTestCase):
def test_sanity(self):
im = Image.open(TEST_FILE)
self.assertEqual(im.size, (32, 32))
self.assertIsInstance(im, CurImagePlugin... | davidwilson-85/easymap | graphic_output/Pillow-4.2.1/Tests/test_file_cur.py | Python | gpl-3.0 | 1,063 | 0 |
#!/usr/bin/env python3
from __future__ import unicode_literals
from builtins import bytes, dict, list, int, float, str
import os
import sys
import unittest
import pexpect
sys.path.append('..')
from reflectrpc.rpcsh import print_functions
from reflectrpc.rpcsh import split_exec_line
from reflectrpc.rpcsh import Ref... | aheck/reflectrpc | tests/rpcsh-tests.py | Python | mit | 16,724 | 0.011182 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/gcpdiag | gcpdiag/lint/gke/err_2021_001_logging_perm.py | Python | apache-2.0 | 1,986 | 0.007049 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 SINA Corporation
# 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.or... | kickstandproject/ripcord | ripcord/openstack/common/config/generator.py | Python | apache-2.0 | 8,281 | 0.000121 |
# Copyright 2014 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.
"""Run specific test on specific environment."""
import logging
import os
import tempfile
from pylib import constants
from pylib.base import base_test_resu... | vadimtk/chrome4sdp | build/android/pylib/remote/device/remote_device_gtest_run.py | Python | bsd-3-clause | 2,746 | 0.008012 |
#!/usr/bin/env python
"""
================================================
ABElectronics IO Pi | Digital I/O Read and Write Demo
Requires python smbus to be installed
For Python 2 install with: sudo apt-get install python-smbus
For Python 3 install with: sudo apt-get install python3-smbus
run with: python demo_iopire... | abelectronicsuk/ABElectronics_Python_Libraries | IOPi/demos/demo_iopireadwrite.py | Python | gpl-2.0 | 2,479 | 0.000403 |
# -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
import os
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEB... | goldhand/product-purchase | config/settings/local.py | Python | bsd-3-clause | 2,534 | 0.001184 |
# 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... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gcutil/lib/google_compute_engine/gcutil_lib/mock_api_types.py | Python | gpl-3.0 | 13,909 | 0.008412 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.util.cont... | sameerparekh/pants | tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_apt_compile_integration.py | Python | apache-2.0 | 4,227 | 0.009936 |
"""Tests for tensorflow.ops.tf.gather."""
import tensorflow.python.platform
import numpy as np
import tensorflow as tf
class GatherTest(tf.test.TestCase):
def testScalar1D(self):
with self.test_session():
params = tf.constant([0, 1, 2, 3, 7, 5])
indices = tf.constant(4)
gather_t = tf.gather(... | rickyHong/Tensorflow_modi | tensorflow/python/kernel_tests/gather_op_test.py | Python | apache-2.0 | 2,641 | 0.012874 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .envconf import *
from .path import *
__version__ = '0.3.5'
| achedeuzot/django-envconf | envconf/__init__.py | Python | mit | 131 | 0 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | psachin/swift | swift/common/manager.py | Python | apache-2.0 | 26,766 | 0.000037 |
# $Id: statemachine.py 6314 2010-04-26 10:04:17Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A finite state machine specialized for regular-expression-based text filters,
this module defines the following classes:
- `StateMachine`, a state ma... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/eggs/docutils-0.7-py2.7.egg/docutils/statemachine.py | Python | gpl-3.0 | 56,989 | 0.000544 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Team:
# J Phani Mahesh <phanimahesh@gmail.com>
# Barneedhar (jokerdino) <barneedhar@ubuntu.com>
# Amith KK <amithkumaran@gmail.com>
# Georgi Karavasilev <motorslav@gmail.com>
# Sam Tran <samvtran@gmail.com>
# Sam Hewitt <hewittsamuel@gmail.com>
# Angel Ar... | jokerdino/unity-tweak-tool | UnityTweakTool/section/appearance.py | Python | gpl-3.0 | 5,247 | 0.019821 |
import re
import click
import six
from httpie.context import Environment
from httpie.core import main as httpie_main
from parsimonious.exceptions import ParseError, VisitationError
from parsimonious.grammar import Grammar
from parsimonious.nodes import NodeVisitor
from six import BytesIO
from six.moves.urllib.parse i... | Yegorov/http-prompt | http_prompt/execution.py | Python | mit | 11,589 | 0 |
# coding: utf-8
from bernard import (
layers as lyr,
)
from bernard.analytics import (
page_view,
)
from bernard.engine import (
BaseState,
)
from bernard.i18n import (
translate as t,
)
class __project_name_camel__State(BaseState):
"""
Root class for __project_name_readable__.
Here you m... | BernardFW/bernard | src/bernard/misc/start_project/files/src/__project_name_snake__/states.py | Python | agpl-3.0 | 1,539 | 0 |
from mock import MagicMock, mock_open, patch
from unittest import TestCase
from warnings import simplefilter
import pconf
from pconf.store.env import Env
TEST_ENV_BASE_VARS = {
"env__var": "result",
"env__var_2": "second_result",
}
TEST_ENV_MATCHED_VARS = {"matched_var": "match"}
TEST_ENV_WHITELIST_VARS = {"... | andrasmaroy/pconf | tests/test_env.py | Python | mit | 9,384 | 0.000639 |
# -*- coding: utf-8 -*-
import datetime, time, csv, os
from utils.db import SqliteDB
from utils.rwlogging import log
from utils.rwlogging import strategyLogger as logs
from trader import Trader
from indicator import ma, macd, bolling, rsi, kdj
from strategy.pool import StrategyPool
highest = 0
def runStrategy(prices)... | rolandwz/pymisc | utrader/strategy/bollingTrader.py | Python | mit | 2,348 | 0.032794 |
#!/usr/bin/env python
"""
This module contains the :class:`.DataType` class and its subclasses. These
types define how data should be converted during the creation of a
:class:`.Table`.
A :class:`TypeTester` class is also included which be used to infer data
types from column data.
"""
from copy import copy
from ag... | JoeGermuska/agate | agate/data_types/__init__.py | Python | mit | 3,646 | 0.000274 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2018, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | rhyolight/nupic.research | projects/thing_classification/l2l4l6_experiment.py | Python | gpl-3.0 | 8,785 | 0.006716 |
# util/_collections.py
# Copyright (C) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Collection classes and helpers."""
import sys
import itertools
import weakref... | SohKai/ChronoLogger | web/flask/lib/python2.7/site-packages/sqlalchemy/util/_collections.py | Python | mit | 25,079 | 0.001156 |
from __future__ import print_function, absolute_import
import random
import unittest
from pysmoke import marshal
from pysmoke.smoke import ffi, Type, TypedValue, pystring, smokec, not_implemented, charp, dbg
from pysmoke import QtCore, QtGui
qtcore = QtCore.__binding__
qtgui = QtGui.__binding__
class MarshalTestCa... | pankajp/pysmoke | pysmoke/tests/test_marshal.py | Python | mit | 987 | 0.005066 |
#http://pymotw.com/2/socket/multicast.html
import socket
import struct
import sys
multicast_group = '224.3.29.71'
server_address = ('', 10000)
# Create the socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Bind to the server address
sock.bind(server_address)
# Tell the operating system to add the soc... | btbuxton/python-pomodoro | research/multi_recv.py | Python | mit | 864 | 0.002315 |
#!/usr/bin/python
'''
This programs is to integrate dog reference genome from chr to a single one.
Author: Hongzhi Luo
'''
import gzip
import glob
import shutil
path='/vlsci/LSC0007/shared/canine_alport_syndrome/ref_files/'
#path=''
prefix='cfa_ref_CanFam3.1'
def integrate_genome():
'''
@param: num: chr1...ch... | verityrise/Canine_Analysis | integrate_genome.py | Python | epl-1.0 | 753 | 0.01992 |
"""
This example uses OpenGL via Pyglet and draws
a bunch of rectangles on the screen.
"""
import random
import time
import pyglet.gl as GL
import pyglet
import ctypes
# Set up the constants
SCREEN_WIDTH = 700
SCREEN_HEIGHT = 500
RECT_WIDTH = 50
RECT_HEIGHT = 50
class Shape():
def __init__(self):
self.... | mwreuter/arcade | experimental/a_quick_test5.py | Python | mit | 4,042 | 0.000247 |
from datetime import datetime
from boto.resultset import ResultSet
class Stack(object):
def __init__(self, connection=None):
self.connection = connection
self.creation_time = None
self.description = None
self.disable_rollback = None
self.notification_arns = []
self... | catapult-project/catapult | third_party/gsutil/gslib/vendored/boto/boto/cloudformation/stack.py | Python | bsd-3-clause | 14,230 | 0.001195 |
import json
import datetime
import http.client
from time import time
########################################################################################################################
##################################################### ENVIRONMENTS #####################################################
########... | CALlanoR/virtual_environments | web/api_rest/mini_facebook/python_users_relationships_service_api_llano/manual_tests/consumer.py | Python | apache-2.0 | 1,939 | 0.009799 |
from pandarus.maps import Map, DuplicateFieldID
from rtree import Rtree
import fiona
import os
import pandarus
import pytest
dirpath = os.path.abspath(os.path.join(os.path.dirname(__file__), "data"))
grid = os.path.join(dirpath, "grid.geojson")
duplicates = os.path.join(dirpath, "duplicates.geojson")
raster = os.path... | cmutel/pandarus | tests/test_maps.py | Python | bsd-3-clause | 3,212 | 0.001868 |
#!/usr/bin/env python
import numpy
import datavision
def main():
print("\ngenerate two arrays of data")
a = numpy.random.normal(2, 2, size = 120)
b = numpy.random.normal(2, 2, size = 120)
print("\narray 1:\n{array_1}\n\narray 2:\n{array_2}".format(
array_1 = a,
array_2 = b
))
... | wdbm/datavision | datavision_examples_histograms_1.py | Python | gpl-3.0 | 1,130 | 0.040708 |
# -*- coding: utf-8 -*-
import random
import itertools
from functools import partial
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic_manageiq import Table
from cfme.base.ui import BaseLoggedInPage
from cfme.common import SummaryMixin, Taggable
from cfme.containers.provider import Labelab... | dajohnso/cfme_tests | cfme/containers/template.py | Python | gpl-2.0 | 3,341 | 0.001497 |
import os
import sys
import stat
from eyed3 import main, version
from . import RedirectStdStreams
def _initTag(afile):
afile.initTag()
afile.tag.artist = "Bad Religion"
afile.tag.title = "Suffer"
afile.tag.album = "Suffer"
afile.tag.release_date = "1988"
afile.tag.recording_date = "1987"
a... | nicfit/eyed3 | tests/test_jsonyaml_plugin.py | Python | gpl-2.0 | 1,938 | 0.001032 |
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import JupyterHubProvider
class JupyterHubTests(OAuth2TestsMixin, TestCase):
provider_id = JupyterHubProvider.id
def get_mocked_response(self):
return MockedResponse(200, """
... | bittner/django-allauth | allauth/socialaccount/providers/jupyterhub/tests.py | Python | mit | 614 | 0 |
/*Owner & Copyrights: Vance King Saxbe. A.*/""" Copyright (c) <2014> Author Vance King Saxbe. A, and contributors Power Dominion Enterprise, Precieux Consulting and other contributors. Modelled, Architected and designed by Vance King Saxbe. A. with the geeks from GoldSax Consulting and GoldSax Technologies email @vsaxb... | VanceKingSaxbeA/MarketsEngine | engine.py | Python | mit | 3,899 | 0.020518 |
import numpy as np
from bregman.suite import *
from cjade import cjade
from scipy.optimize import curve_fit
from numpy.linalg.linalg import svd
def cseparate(x, M=None, N=4096, H =1024, W=4096, max_iter=200, pre_emphasis=True, magnitude_only=False, svd_only=False, transpose_spectrum=False):
"""
complex-valued freque... | bregmanstudio/cseparate | cseparate.py | Python | mit | 2,850 | 0.04386 |
def extractJstranslationBlogspotCom(item):
'''
Parser for 'jstranslation.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
(... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractJstranslationBlogspotCom.py | Python | bsd-3-clause | 564 | 0.033688 |
#/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
""" This file uses the fpga_interchange to crea... | SymbiFlow/python-fpga-interchange | tests/example_netlist.py | Python | isc | 13,854 | 0.000289 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('agentex', '0003_auto_20150622_1101'),
]
operations = [
migrations.CreateModel(
name='LastLogins',
fi... | tomasjames/citsciportal | app/agentex/migrations/0004_lastlogins.py | Python | gpl-3.0 | 591 | 0.001692 |
#
# 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
# ... | dims/heat | heat/engine/clients/os/glance.py | Python | apache-2.0 | 4,221 | 0 |
#!/usr/bin/env python
#from distutils.core import setup
from setuptools import setup
import subprocess
import os
import platform
import re
def get_pi_version():
pi_versions = {
"0002" : "Model B Revision 1.0",
"0003" : "Model B Revision 1.0",
"0004" : "Model B Revision 2.0",
"0005" : "Model B Revision 2.0", ... | EmbeditElectronics/Python_for_PSoC | API_Python/setup.py | Python | mit | 3,289 | 0.057464 |
import os
import subprocess
import requests
import time
from urlparse import urlparse
from config import config
class Server(object):
"""
Simple helper to start/stop and interact with a tests server
TODO: add method to check what request has been send last by browser
might need this for connect-src ... | ilyanesterov/browser-csp-compatibility | utils/server.py | Python | mit | 4,620 | 0 |
from collections import namedtuple
def get_feature(stats):
feature_attributes = ApacheFeature(
stats['BusyWorkers'],
stats['IdleWorkers'],
stats['waiting_for_connection'],
stats['starting_up'],
stats['reading_request'],
stats['sending_reply'],
stats['keepali... | cloudviz/agentless-system-crawler | crawler/plugins/applications/apache/feature.py | Python | apache-2.0 | 1,135 | 0.000881 |
"""Client (Connection)."""
from __future__ import absolute_import, unicode_literals
import os
import socket
import sys
from collections import OrderedDict
from contextlib import contextmanager
from itertools import count, cycle
from operator import itemgetter
try:
from ssl import CERT_NONE
ssl_available = T... | urbn/kombu | kombu/connection.py | Python | bsd-3-clause | 38,239 | 0.000026 |
import time
import fractions
from functools import reduce
import logging
class Scheduler:
def __init__(self, jobs):
"""
Create a new Scheduler.
>>> s = Scheduler([Job(1, max, 100, 200)])
>>> for jobs in s:
... time.sleep(s.tick_duration)
:param jobs: Sequence ... | bewiwi/sauna | sauna/scheduler.py | Python | bsd-2-clause | 3,120 | 0 |
# encoding: utf-8
from django.contrib import auth
from django.contrib.auth import get_user_model
from django.core.exceptions import MultipleObjectsReturned
from django import forms
from django.utils.translation import ugettext_lazy as _
__all__ = ()
class SigninForm(forms.Form):
email = forms.EmailField(requir... | alexey-grom/django-userflow | userflow/forms/signin.py | Python | mit | 2,222 | 0.00045 |
from encodings import normalize_encoding, aliases
from types import MappingProxyType
from psycopg2.extensions import encodings as _PG_ENCODING_MAP
PG_ENCODING_MAP = MappingProxyType(_PG_ENCODING_MAP)
# python to postgres encoding map
_PYTHON_ENCODING_MAP = {
v: k for k, v in PG_ENCODING_MAP.items()
}
def get_... | portfoliome/postpy | postpy/pg_encodings.py | Python | mit | 627 | 0 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jlongever/redfish-client-python | on_http_redfish_1_0/models/power_1_0_0_power_supply.py | Python | apache-2.0 | 11,886 | 0.001599 |
from office365.directory.identities.identity_set import IdentitySet
from office365.entity import Entity
class CallRecord(Entity):
"""Represents a single peer-to-peer call or a group call between multiple participants,
sometimes referred to as an online meeting."""
@property
def join_web_url(self):
... | vgrem/Office365-REST-Python-Client | office365/communications/callrecords/call_record.py | Python | mit | 630 | 0.003175 |
#!/usr/bin/python
"""
Program that parses standard format results,
compute and check regression bug.
:copyright: Red Hat 2011-2012
:author: Amos Kong <akong@redhat.com>
"""
import os
import sys
import re
import commands
import warnings
import ConfigParser
import MySQLdb
def exec_sql(cmd, conf="../../global_config.i... | will-Do/avocado-vt | scripts/regression.py | Python | gpl-2.0 | 20,876 | 0.002299 |
from pybullet_utils import pd_controller_stable
from pybullet_envs.deep_mimic.env import humanoid_pose_interpolator
import math
import numpy as np
chest = 1
neck = 2
rightHip = 3
rightKnee = 4
rightAnkle = 5
rightShoulder = 6
rightElbow = 7
leftHip = 9
leftKnee = 10
leftAnkle = 11
leftShoulder = 12
leftElbow = 13
join... | nrz/ylikuutio | external/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/env/humanoid_stable_pd.py | Python | agpl-3.0 | 42,338 | 0.010345 |
import os
import sys
import yaml
from etllib.conf import Conf
from etllib.yaml_helper import YAMLHelper
from plugins import PluginEngine
class RulesEngine(list):
def __init__(self):
self.rules_path = os.path.dirname(os.path.realpath(__file__))
self.conf = Conf()
self.load()
self.f... | gr33ndata/rivellino | ruleset/__init__.py | Python | mit | 4,470 | 0.003803 |
# module pyparsing.py
#
# Copyright (c) 2003-2021 Paul T. McGuire
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... | JonnyWong16/plexpy | lib/pyparsing/__init__.py | Python | gpl-3.0 | 9,095 | 0.001649 |
#
# Copyright 2011-2019 Universidad Complutense de Madrid
#
# This file is part of Numina
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
"""Import objects by name"""
import importlib
import inspect
import warnings
def import_object(path):
"""Import an object given its fully qualified na... | guaix-ucm/numina | numina/util/objimport.py | Python | gpl-3.0 | 1,031 | 0.00097 |
# Python3
import numpy as np
import math
def nCr(n,r):
f = math.factorial
return f(n) // f(r) // f(n-r)
def long_to_int64_array(val, ln):
sz = ln / 64 + 1
ar = np.zeros(sz, dtype=int)
i64 = 2**64 - 1
for ii in range(sz):
ar[ii] = int(val & i64)
val = val >> 64
return ar
... | jskDr/jamespy_py3 | kmath.py | Python | mit | 3,201 | 0.000312 |
# -*- coding: utf-8 -*-
import unittest
import os # noqa: F401
import json # noqa: F401
import time
import requests
from os import environ
try:
from ConfigParser import ConfigParser # py2
except:
from configparser import ConfigParser # py3
from pprint import pprint # noqa: F401
from biokbase.workspace.c... | eapearson/eapearson_TestRichReports | test/eapearson_TestRichReports_server_test.py | Python | mit | 5,023 | 0.004181 |
# This script is used to parse BOOST special function test data into something
# we can easily import in numpy.
import re
import os
# Where to put the data (directory will be created)
DATA_DIR = 'scipy/special/tests/data/boost'
# Where to pull out boost data
BOOST_SRC = "boostmath/test"
CXX_COMMENT = re.compile(r'^\s... | anntzer/scipy | scipy/special/utils/convert.py | Python | bsd-3-clause | 3,448 | 0.00058 |
import unittest
import graph
class BreadthFirstSearchTest(unittest.TestCase):
__runSlowTests = False
def testTinyGraph(self):
g = graph.Graph.from_file('tinyG.txt')
bfs = graph.BreadthFirstSearch(g, 0)
self.assertEqual(7, bfs.count())
self.assertFalse(bfs.connected(7))
... | RobMcZag/python-algorithms3 | graph/tests/bfs_test.py | Python | apache-2.0 | 2,306 | 0.000434 |
from __future__ import absolute_import
import click
from datasciencebox.cli.main import cli, default_options
@cli.group(short_help='Install packages, applications and more')
@click.pass_context
def install(ctx):
pass
@install.command('miniconda', short_help='Install miniconda in the instances')
@click.option(... | danielfrg/datasciencebox | datasciencebox/cli/install.py | Python | apache-2.0 | 6,874 | 0.004946 |
# 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 by applicable law or agreed t... | zhangwenyu/packages | volt/volt/openstack/common/sslutils.py | Python | apache-2.0 | 2,842 | 0 |
from jinja2 import Environment, PackageLoader
import json
env = Environment(loader=PackageLoader('core_serializers', 'templates'))
class FormRenderer:
template_name = 'form.html'
def render_field(self, field_result, **options):
field, value, error = field_result
class_name = field.__class__.... | pombredanne/core-serializers | core_serializers/renderers.py | Python | bsd-2-clause | 2,026 | 0 |
import csv
import tempfile
import os
from transaction import Transaction
class LastTransactionsParser:
LAST_TRANSACTIONS_FILENAME = os.path.join(tempfile.gettempdir(), 'raapija_transactions_last.csv')
@staticmethod
def read():
try:
with open(LastTransactionsParser.LAST_TRANSACTIONS_FILENAME, 'r', e... | 2mv/raapija | last_transactions_parser.py | Python | isc | 884 | 0.015837 |
#!/usr/bin/env python
# Copyright (c) 2015, Scott D. Peckham
#------------------------------------------------------
# S.D. Peckham
# July 9, 2015
#
# Tool to break CSDMS Standard Variable Names into
# all of their component parts, then save results in
# various formats. (e.g. Turtle TTL format)
#
# Example of use at... | mprinc/McMap | src/scripts/CSN_Archive2/parse_csvn.py | Python | mit | 7,899 | 0.019243 |
from flask import Flask, Response
import twilio.twiml
app = Flask(__name__)
@app.route("/voice", methods=['POST'])
def get_voice_twiml():
"""Respond to incoming calls with a simple text message."""
resp = twilio.twiml.Response()
resp.say("Thanks for calling!")
return Response(str(resp), mimetype='t... | teoreteetik/api-snippets | client/response-twiml/response-twiml.5.x.py | Python | mit | 383 | 0 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Add CycleTaskGroupObject.object
Revision ID: 26d9c9c91542
Revises: 19a67dc67c3
Create Date: 2014-07-15 21:49:34.073412
"""
# revision identifiers, used by Alembic.
revision = '26d9c9c91542'
down_revis... | VinnieJohns/ggrc-core | src/ggrc_workflows/migrations/versions/20140715214934_26d9c9c91542_add_cycletaskgroupobject_object.py | Python | apache-2.0 | 1,141 | 0.006135 |
# coding: utf-8
__author__ = 'linlin'
import os
import logging
import re
import pdb
logger = logging.getLogger(__name__)
################################################################
root_dir = '/home/linlin/time/0903_classify_false_start/1003_raw_features/'
separator = '\t\t'
#####################################... | linkinwong/word2vec | src/crf-paper-script/preprocessor6_ssr_rep_increase_5_scale.py | Python | apache-2.0 | 8,443 | 0.008923 |
import pymark
pets_mod = pymark.unpack_file("pets_two.pmk")
print "TypeID: %i" % pets_mod["pets"]["catherine"]["type"]
print "Name: %s" % pets_mod["pets"]["catherine"]["name"]
print "Color: (%i, %i, %i)" % pets_mod["pets"]["catherine"]["color"]
| orangeduck/PyMark | tests/test3.py | Python | bsd-2-clause | 247 | 0 |
"""
Support for real-time departure information for public transport in Munich.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mvglive/
"""
import logging
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.confi... | MungoRae/home-assistant | homeassistant/components/sensor/mvglive.py | Python | apache-2.0 | 6,071 | 0 |
import inspect
import example
print(inspect.getsource(example.A.get_name))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_language_tools/inspect_getsource_method.py | Python | apache-2.0 | 76 | 0 |
'''
cloudelements: tests module.
Meant for use with py.test.
Organize tests into files, each named xxx_test.py
Read more here: http://pytest.org/
Copyright 2015, LeadGenius
Licensed under MIT
''' | rsimba/cloudelements | tests/__init__.py | Python | mit | 197 | 0.010152 |
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundat... | IfcOpenShell/IfcOpenShell | src/ifcopenshell-python/ifcopenshell/api/profile/add_parameterized_profile.py | Python | lgpl-3.0 | 1,101 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.