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
# -*- coding:utf-8 -*-
import threading
import json
import Queue
import requests
import logging
logging.basicConfig(level=logging.INFO,
format='%(filename)s %(asctime)s %(thread)d [%(levelname)s] %(message)s')
logger = logging.getLogger(__name__)
DEFAULT_HTTPS_TEST_URL = 'ht... | sheepmen/SpiderManage | script/proxy.py | Python | mit | 5,375 |
from hdlConvertorAst.hdlAst._expr import HdlOp, HdlOpType, HdlValueId
from hdlConvertorAst.to.verilog.constants import SIGNAL_TYPE
from hdlConvertorAst.translate._verilog_to_basic_hdl_sim_model.utils import hdl_index
from hdlConvertorAst.translate.common.name_scope import LanguageKeyword
from hwt.hdl.types.array import... | Nic30/HWToolkit | hwt/serializer/systemC/type.py | Python | mit | 2,796 |
# coding=utf-8
# Copyright (c) 2015 EMC 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.org/licenses/LICENSE-2.0
#
#... | emc-openstack/storops | storops_comptest/vnx/test_cg.py | Python | apache-2.0 | 2,687 |
from __future__ import unicode_literals
# Authentication and Authorisation
from functools import wraps
from . import http
def permit(test_func):
'''Decorate a handler to control access'''
def decorator(view_func):
@wraps(view_func)
def _wrapped_view(self, *args, **kwargs):
if test... | MarkusH/django-nap | nap/auth.py | Python | bsd-3-clause | 909 |
import wx
class ContextMenuMixin(wx.Menu):
def __init__(self):
super(ContextMenuMixin, self).__init__()
actions = self.actions
for actionFunc, actionLabel, kw in actions:
setattr(self, actionFunc.__name__, wx.MenuItem(self, wx.NewId(), actionLabel, **kw))
self.AppendItem(getattr(self, actionFunc.__name__... | mush42/Bright | interface/contextmenu.py | Python | gpl-2.0 | 743 |
# import unittest
#
# from pyramid import testing
#
#
# class ViewTests(unittest.TestCase):
# def setUp(self):
# self.config = testing.setUp()
#
# def tearDown(self):
# testing.tearDown()
#
# def test_my_view(self):
# from .views import my_view
# request = testing.DummyReques... | mikeckennedy/cookiecutter-pyramid-talk-python-starter | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/tests.py | Python | mit | 793 |
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2017 Chris Lamb <lamby@debian.org>
#
# diffoscope 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,... | ReproducibleBuilds/diffoscope | diffoscope/comparators/odt.py | Python | gpl-3.0 | 1,450 |
import unittest
#from zope.testing import doctestunit
#from zope.component import testing
from Testing import ZopeTestCase as ztc
from Products.Five import zcml
from Products.Five import fiveconfigure
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneTestCase.layer import PloneSite
ptc.setupP... | erikriver/eduIntelligent-cynin | src/eduintelligent.zipcontent/eduintelligent/zipcontent/__tests.py | Python | gpl-3.0 | 1,605 |
# fsDiff Module
# For now, it just compares two configs (before and after)
# Change logic later for multiple sets
import sys
import argparse
import os
from collections import defaultdict
import difflib
import re
from datadiff import diff as di
class Compute:
def __init__(self, key, wTD, switches):
self.key = key... | 52-41-4d/fs-generic | fsDiff/diff.py | Python | gpl-2.0 | 10,118 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | bitcraft/pyglet | examples/programming_guide/events.py | Python | bsd-3-clause | 2,394 |
import boto3
from s3_encryption import crypto
from s3_encryption.handler import EncryptionHandler, DecryptionHandler
from s3_encryption.exceptions import ArgumentError
from s3_encryption.key_provider import DefaultKeyProvider
class S3EncryptionClient(object):
def __init__(self, encryption_key=None, **kwargs):
... | boldfield/s3-encryption | s3_encryption/client.py | Python | bsd-3-clause | 2,351 |
__all__ = ['SitesQuery', 'BaseQuery', 'DataBySites']
from urllib import parse, request
import json
from datetime import datetime, timedelta
import gzip
import io
class pyUSGSError(Exception):
pass
class BaseQuery(object):
"""
The basic query class to access the USGS water data service
Par... | jsharples/usgs_nwis | usgs_nwis/usgs_nwis.py | Python | mit | 8,887 |
"""
This file is a python style sheet which describes layers and styles for Mapnik.
Describe layers and styles by this way is simple and easy-readable
It is not usable by Mapnik directly, you have to translate it with Pycnik, if
you want to try execute pycnik_sample.py
"""
from pycnik.model import *
# Standard zoom le... | Mappy/pycnikr | pycnikr/style_sheets/example2.py | Python | lgpl-3.0 | 967 |
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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... | CedricCabessa/repo | subcmds/sync.py | Python | apache-2.0 | 19,623 |
from cmath import exp
class Solution:
def maxProfit(self, prices: list[int]) -> int:
pclosed, popen = 0, float("Inf")
for p in prices:
pclosed = max(pclosed, p - popen)
popen = min(popen, p)
return pclosed
# TESTS
for prices, expected in [
([7, 1, 5, 3, 6, 4],... | l33tdaima/l33tdaima | p121e/max_profit_1.py | Python | mit | 508 |
# vim: expandtab tabstop=4 shiftwidth=4
#
# Copyright (c) 2016 Christian Schmitz <tynn.dev@gmail.com>
#
# This program 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 Foundation, either version 3 of the License... | tynn/lunchdate.bot | tests/api/action.py | Python | lgpl-3.0 | 2,380 |
# coding=utf-8
import argparse
import sys
from xml2htmlreport.xml2html import copy_static, get_features_and_convert_into_dict, parse_screenshots, \
get_overall_results, \
render_templates
parser = argparse.ArgumentParser(
description="jUnit XML2HTML Report Converter CLI",
)
parser.add_argument(
"-x"... | KorolevskyMax/jUnitXML2HTML | xml2htmlreport/cli.py | Python | gpl-2.0 | 1,870 |
#!/usr/bin/python
import pytest
from AnnotatorCore import *
import os
ONCOKB_API_TOKEN = os.environ["ONCOKB_API_TOKEN"]
setoncokbapitoken(ONCOKB_API_TOKEN)
log.info('test-----------', os.environ["ONCOKB_API_TOKEN"], '------')
VARIANT_EXISTS_INDEX = 1
MUTATION_EFFECT_INDEX = 2
ONCOGENIC_INDEX = 4
LEVEL_1_INDEX =5
LE... | oncokb/oncokb-annotator | test_Annotation.py | Python | agpl-3.0 | 12,000 |
"""
Author: Seyed Hamidreza Mohammadi
This file is part of the shamidreza/uniselection software.
Please refer to the LICENSE provided alongside the software (which is GPL v2,
http://www.gnu.org/licenses/gpl-2.0.html).
This file includes the code for putting all the pieces together.
"""
from utils import *
from extra... | shamidreza/unitselection | experiment.py | Python | gpl-2.0 | 3,464 |
# DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2011 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... | halbbob/dff | ui/console/completion.py | Python | gpl-2.0 | 35,082 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2008 Spanish Localization Team
# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Jordi Es... | jmesteve/saas3 | openerp/addons_extra/l10n_es_partner/l10n_es_partner.py | Python | agpl-3.0 | 7,221 |
##############################################################################
# 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... | EmreAtes/spack | var/spack/repos/builtin.mock/packages/dtuse/package.py | Python | lgpl-2.1 | 1,546 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM Corp
# 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/licens... | eltonkevani/tempest_el_env | tempest/services/compute/xml/certificates_client.py | Python | apache-2.0 | 1,474 |
#!/usr/bin/env python3
"""
"""
import getopt
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pickle
import re
import seaborn as sns
import sys
from matplotlib.backends.backend_pdf import PdfPages
import scipy.spatial.distance
from sklearn.cluster import DBSCAN
from sklearn impo... | dacb/elvizCluster | elviz_cluster.py | Python | bsd-3-clause | 10,182 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# inventory cache
DOCUMENTATION = r'''
options:
cache:
description:
- Toggle to enable/disable the caching ... | EvanK/ansible | lib/ansible/plugins/doc_fragments/inventory_cache.py | Python | gpl-3.0 | 1,231 |
#!/usr/bin/python
#
# Coinorama/coinref: watch and store raw Kraken ETH market info
#
# This file is part of Coinorama <http://coinorama.net>
#
# Copyright (C) 2013-2016 Nicolas BENOIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License ... | coinorama/coinorama | src/markets/watcher/watcher-krakenETH.py | Python | agpl-3.0 | 5,237 |
"""
Project AI
Joost van Amersfoort - 10021248
Otto Fabius - 5619858
"""
#example: python trainffscikit.py
import VariationalAutoencoder
import numpy as np
import gzip,cPickle
print "Loading data"
f = gzip.open('mnist.pkl.gz', 'rb')
(x_train, t_train), (x_valid, t_valid), (x_test, t_test) = cPickle.load(f)
f.close(... | KyriacosShiarli/Variational-Autoencoder | scikit-learn/demo/trainmnistscikit.py | Python | mit | 681 |
#!/usr/bin/env python
# make_squarify -- render image with squares representing source files
#
# USAGE:
# make_squarify flask.pkl
# -- outputs flask.png
import argparse
import os
import sys
from collections import Counter
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
import pandas as pd
i... | johntellsall/shotglass | ex-treemap/make_squarify.py | Python | mit | 2,013 |
#MenuTitle: Floating Features
# -*- coding: utf-8 -*-
__doc__="""
Floating window for activating features in the frontmost Edit tab.
"""
import vanilla
import GlyphsApp
class FeatureActivator( object ):
def __init__( self ):
featurelist = [ f.name for f in Glyphs.font.features ]
numOfFeatures = len( featurelist ... | weiweihuanghuang/Glyphs-Scripts | OpenType/Floating Features.py | Python | apache-2.0 | 1,366 |
from .utils import is_active
| potatolondon/django-hashbrown | hashbrown/__init__.py | Python | bsd-2-clause | 29 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'DjangoAnalysisTestApp.views.home', name='home'),
# url(r'^DjangoAnalysisTestApp/', include(... | Microsoft/PTVS | Python/Tests/TestData/DjangoAnalysisTestApp/DjangoAnalysisTestApp/urls.py | Python | apache-2.0 | 619 |
'''
Convolution using sparse matrix.
'''
from __future__ import division
import numpy as np
import pdb
import time
from scipy import sparse as sps
from .lib.spconv import lib as fspconv
from .lib.spconv_cc import lib as fspconv_cc
from .utils import scan2csc, tuple_prod, spscan2csc,\
masked_concatenate, dtype2tok... | GiggleLiu/poorman_nn | poornn/spconv.py | Python | mit | 16,879 |
__source__ = 'https://leetcode.com/problems/binary-search-tree-iterator/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/binary-search-tree-iterator.py
# Time: O(1)
# Space: O(h), h is height of binary tree
#
# Description: Leetcode # 173. Binary Search Tree Iterator
#
# Implement an iterator over a binary ... | JulyKikuAkita/PythonPrac | cs15211/BinarySearchTreeIterator.py | Python | apache-2.0 | 4,212 |
from Components.Language import language
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
import os,gettext
PluginLanguageDomain = "CrossEPG"
PluginLanguagePath = "SystemPlugins/CrossEPG/po"
def localeInit():
lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "langu... | tectronics/crossepg | src/enigma2/python/crossepg_locale.py | Python | lgpl-2.1 | 889 |
import pkg_resources
import os
import subprocess
import re
import requests
import json
from hamcrest import *
from behave import step
FNULL = open(os.devnull, 'w')
@step('an installed {} module')
def pip_modules(context, module_name):
installed_modules = [p.project_name for p in pkg_resources.working_set]
a... | provonet/e2j2 | features/steps/steps.py | Python | mit | 2,470 |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of t... | tempbottle/ironpython3 | Tests/interop/com/compat/__init__.py | Python | apache-2.0 | 1,661 |
import numpy as np
import pandas as pd
from scipy import stats
__all__ = ['bootci_pd',
'permtest_pd']
def bootci_pd(df, statfunction, alpha=0.05, n_samples=10000, method='bca'):
"""Estimate bootstrap CIs for a statfunction that operates along the rows of
a pandas.DataFrame and return a dict or pd.S... | agartland/utils | bootstrap_pd.py | Python | mit | 6,385 |
import pytest
from . import *
def find_or_create_contact(client, email):
contact = client.contact(email)
if not contact:
contact = client.contacts().add({
'first_name': 'First',
'last_name': 'Last',
'address1': '1 Main Street',
'city': ... | vigetlabs/dnsimple | tests/integration/test_registrations.py | Python | mit | 1,893 |
from __future__ import division
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from easy_thumbnails.files import get_thumbnailer
from models import ImageSetItem
def lightbox_item(request, id=None, lightbox_max_dimension=400):
item = get_object_... | evildmp/Arkestra | arkestra_image_plugin/views.py | Python | bsd-2-clause | 1,642 |
if not("condition" in self.get_theta("userid", self.context["userid"])):
self.action["note"] = "First allocation"
draw = random.choice(["baseline", "random", "lockin"])
self.set_theta({"condition":draw}, "userid", self.context["userid"])
self.action["condition"] = self.get_theta("userid", self.context["use... | Nth-iteration-labs/streamingbandit | app/defaults/Social_Science_Experiment/get_action.py | Python | mit | 339 |
# -*- coding: utf-8 -*-
"""
Density Filter Tool
Created on Thu May 11 11:03:05 2017
@author: cheny
"""
from arcpy import Parameter
import arcpy
from section_cpu import dens_filter_cpu
from multiprocessing import cpu_count
class DensFilterTool(object):
def __init__(self):
"""Classify Tool"""
self... | lopp2005/spatial_cluster_fs | tool_densfilter.py | Python | apache-2.0 | 5,412 |
#
# Copyright (C) 2012-2013 Carnegie Mellon University
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHO... | cmusatyalab/django-s3 | django_s3/models.py | Python | gpl-2.0 | 10,016 |
from datadog import initialize, api
from datadog.api.constants import CheckStatus
options = {
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
}
initialize(**options)
check = 'app.ok'
host = 'app1'
status = CheckStatus.OK
api.ServiceCheck.check(check=check... | macobo/documentation | code_snippets/api-checks-post.py | Python | bsd-3-clause | 381 |
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... | ltcmelo/qt-creator | tests/system/suite_debugger/tst_qml_locals/test.py | Python | lgpl-3.0 | 8,230 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Lucy B
#
# 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 version... | lucyb/photo_import | photoimport/cli.py | Python | gpl-3.0 | 1,920 |
import pytest
import json
import os.path
import importlib
import jsonpickle
from fixture.application import Application
from fixture.db import DbFixture
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__f... | Manolaru/Python_train | WorkingVersion/conftest.py | Python | apache-2.0 | 2,443 |
import Transaction
import time
from decimal import *
import ppApiConfig
# Note: For now, these are explict imports.
# Evntually, we want to make this automatic, and essentially
# create a dynamic array of adapters and loaders based on
# what we find in some directory so that it is easily
# extendable. But that woul... | GSA/PricesPaidAPI | SearchApi.py | Python | unlicense | 11,101 |
##############################################################################
# Copyright (c) 2013-2017, 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... | skosukhin/spack | lib/spack/spack/compilers/nag.py | Python | lgpl-2.1 | 2,899 |
# -*- coding: utf-8 -*-
from . import conftest as utils
from . import test_media, test_mixins
def test_audio_Artist_attr(artist):
artist.reload()
assert utils.is_datetime(artist.addedAt)
assert artist.albumSort == -1
if artist.art:
assert utils.is_art(artist.art)
if artist.countries:
... | mjs7231/python-plexapi | tests/test_audio.py | Python | bsd-3-clause | 11,538 |
# -*- coding: utf-8 -*-
# Django settings for example project.
import os
import sys
DEBUG = True
TEMPLATE_DEBUG = DEBUG
APP = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJ_ROOT = os.path.abspath(os.path.dirname(__file__))
sys.path.append(APP)
ADMINS = (
# ('Your Name', 'your_email@domain.com')... | rangertaha/django-boilerplate-pages | example/settings.py | Python | mit | 4,733 |
"""
Unit tests for the asset upload endpoint.
"""
# pylint: disable=C0111
# pylint: disable=W0621
# pylint: disable=W0212
from datetime import datetime
from io import BytesIO
from pytz import UTC
import json
from contentstore.tests.utils import CourseTestCase
from contentstore.views import assets
from contentstore.ut... | bdero/edx-platform | cms/djangoapps/contentstore/views/tests/test_assets.py | Python | agpl-3.0 | 8,653 |
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
from django... | blaze33/django | tests/regressiontests/admin_widgets/tests.py | Python | bsd-3-clause | 36,922 |
# (c) 2012-2018, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... | chouseknecht/galaxy | galaxy/accounts/models.py | Python | apache-2.0 | 5,571 |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Administrator
#
# Created: 08/10/2011
# Copyright: (c) Administrator 2011
# Licence: <your licence>
#--------------------------------------------------------------------... | hemmerling/codingdojo | src/game_of_life/python_coderetreat_socramob/cr_socramob08/field.py | Python | apache-2.0 | 646 |
import collections
class _JamomaMember(object):
__slots__ = ('_client', '_subscribers', '_value', 'data_type', 'name', 'range_bounds', 'range_clipmode')
def __init__(self, client, name):
from j264.Max5.JamomaModule import JamomaModule
self._subscribers = [ ]
self.name = name
... | josiah-wolf-oberholtzer/j264-objects | python/j264/Max5/_JamomaMember/_JamomaMember.py | Python | gpl-3.0 | 1,654 |
# -*- coding: utf-8 -*-
"""
This module contains the implementation of a tab widget specialised to
show code editor tabs.
"""
import logging
import os
from pyqode.core.dialogs.unsaved_files import DlgUnsavedFiles
from pyqode.core.modes.filewatcher import FileWatcherMode
from pyqode.core.widgets.tab_bar import TabBar
f... | jmwright/cadquery-x | gui/libs/pyqode/core/widgets/tabs.py | Python | lgpl-3.0 | 16,288 |
import requests
import json
from extra import *
from base import BaseMethods
from dateutil import parser
class SocialAPIs:
def facebook(self, BaseMethods = BaseMethods()):
self.GAweekEnd, self.GAweekStart, self.SMweekEnd, self.SMweekStart = BaseMethods.dateselector()
short_lived_token = 'EAACEd... | michealjroberts/stepjockey-data | social.py | Python | gpl-3.0 | 1,512 |
# -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager 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 ... | wger-project/wger | wger/nutrition/views/bmi.py | Python | agpl-3.0 | 7,575 |
# Set up Twitter OAuth
class TwitterOAuth:
# Create an app and generate keys
consumer_key=""
consumer_secret=""
# Generate tokens
access_token=""
access_token_secret=""
| Sapphirine/Predicting-The-United-States-Presidential-Election-Results-Using-TwitterSentiment | src/auth.py | Python | apache-2.0 | 176 |
##########################################################################
#
# QGIS-meshing plugins.
#
# Copyright (C) 2012-2013 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a
# full list of copyright holders.
#
# Dr Adam S. Candy, adam.candy@imperia... | adamcandy/QGIS-Meshing | plugins/mesh_surface/mesh_surface.py | Python | lgpl-2.1 | 16,160 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its
# containing dir.
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative t... | homeworkprod/byceps | docs/conf.py | Python | bsd-3-clause | 7,688 |
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#... | vegeclic/django-regularcom | mailbox/views.py | Python | agpl-3.0 | 6,489 |
#!/usr/bin/python
import os
from time import sleep
from threading import Thread
try:
import smbus
except ImportError:
print 'smbus is not installed! Please run \'sudo apt-get install python-smbus\''
CHECK_TIME = 1
PRIMARY_POWER = 'primary_power'
SECONDARY_POWER = 'secondary_power'
BATTERY_LOW = 'battery_low... | schneuwlym/pyusv | PyUSV.py | Python | lgpl-2.1 | 2,705 |
#! -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import base64
import errno
import hashlib
import json
import os
import shutil
import tempfile as sys_tempfile
from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http.... | waseem18/oh-mainline | vendor/packages/Django/tests/regressiontests/file_uploads/tests.py | Python | agpl-3.0 | 15,969 |
from twisted.internet import defer
from jflow.core.timeseries import parsets, tojson, unwind
from jflow.core.rates import cacheObject
__all__ = ['TimeseriesAnalysis']
class jsonResult(object):
def __init__(self, name):
self.json = {'function': str(name),
'success'... | lsbardel/flow | flow/finance/rates/factory/analysis.py | Python | bsd-3-clause | 5,063 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-19 22:26
from __future__ import unicode_literals
import ads.models
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migr... | razisayyed/django-ads | ads/migrations/0001_initial.py | Python | apache-2.0 | 5,949 |
# ----------------------------------------------------------------------- #
# The OpenSim API is a toolkit for musculoskeletal modeling and #
# simulation. See http://opensim.stanford.edu and the NOTICE file #
# for more information. OpenSim is developed at Stanford University #
# and supported ... | jimmyDunne/perimysium | perimysium/modeling.py | Python | bsd-3-clause | 34,048 |
from unittest import TestCase
class Test(TestCase):
def test_sample(self):
pass
| yephper/django | tests/test_discovery_sample/tests/tests.py | Python | bsd-3-clause | 102 |
import argparse
import numpy as np
import pprint
parser = argparse.ArgumentParser(description='will remove lines with duplicate data regardless of key')
parser.add_argument('--input', type=argparse.FileType('r'), required=True, help='file to process')
args = parser.parse_args()
lineas = args.input.readlines()
arreg... | elaeon/breast_cancer_networks | scripts_toolbox/dedup.py | Python | gpl-3.0 | 950 |
#!/usr/bin/python
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('PersistenceEngine')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import time
import threading
import traceback
class PersistenceEngine(threading.Thread):
... | dustcloud/dustlink | DustLinkData/PersistenceEngine.py | Python | bsd-3-clause | 4,768 |
"""
Django settings for DiabloDjango project.
"""
from os import path
PROJECT_ROOT = path.dirname(path.abspath(path.dirname(__file__)))
MEDIA_ROOT = PROJECT_ROOT + '/DiabloDjango/static/Images/'
DEBUG = False
ALLOWED_HOSTS = (
'localhost',
'diablodjango.dev',
'diablodjango.localhost'
)
#Used for session... | Vegan6/DiabloDjango | DiabloDjango/DiabloDjango/settings.py | Python | gpl-2.0 | 5,548 |
import time
import datetime
import json
# Usage: json.dumps(data, cls=JSONEncoder, indent=4, sort_keys=True, ensure_ascii=False)
class JSONEncoder(json.JSONEncoder):
# this class is useful for serialization of objects into JSON
# it helps to deal with complex types that standard JSON parser does not know a... | ba1dr/tplgenerator | templates/django/__APPNAME__/apps/utils/json_utils.py | Python | mit | 673 |
from functools import wraps
from corehq.apps.users.models import Permissions
from corehq.apps.domain.decorators import login_and_domain_required
from corehq.apps.users.decorators import require_permission
def require_cloudcare_access_ex():
"""
Decorator for cloudcare users. Should require either data editing
... | puttarajubr/commcare-hq | corehq/apps/cloudcare/decorators.py | Python | bsd-3-clause | 1,155 |
from unittest import TestCase
from mock import patch
from regparser import federalregister
class FederalRegisterTest(TestCase):
@patch('regparser.federalregister.requests')
@patch('regparser.federalregister.build_notice')
def test_fetch_notices(self, build_note, requests):
requests.get.return_v... | grapesmoker/regulations-parser | tests/federalregister.py | Python | cc0-1.0 | 728 |
"""
Show how to use a lasso to select a set of points and get the indices
of the selected points. A callback is used to change the color of the
selected points
This is currently a proof-of-concept implementation (though it is
usable as is). There will be some refinement of the API and the
inside polygon detection ro... | ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/mpl_examples/event_handling/lasso_demo.py | Python | gpl-2.0 | 2,508 |
import re
import urllib
from contextlib import contextmanager
from warnings import warn
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse as django_reverse
from django.http import HttpResponsePerma... | akatsoulas/mozillians | mozillians/common/middleware.py | Python | bsd-3-clause | 6,780 |
import domain as dom
import ui
from sys import argv
pc = dom.ParametersContainer(argv)
fm = dom.FamilyManager(pc)
interface = ui.CLInterface(pc, fm)
| HerrSubset/FamilyTreeManager | ftm/__init__.py | Python | unlicense | 150 |
"""Test script for the dumbdbm module
Original by Roger E. Masse
"""
import os
import unittest
import dumbdbm
from test import test_support
_fname = test_support.TESTFN
def _delete_files():
for ext in [".dir", ".dat", ".bak"]:
try:
os.unlink(_fname + ext)
except OSError:
... | svanschalkwyk/datafari | windows/python/Lib/test/test_dumbdbm.py | Python | apache-2.0 | 5,178 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import pytest
from pootle_project.models im... | unho/pootle | tests/pootle_project/models.py | Python | gpl-3.0 | 649 |
#!/usr/bin/env python
import unittest
from os.path import realpath
from path_tools import create_filepath
class TestCreateFilepath(unittest.TestCase):
def test_identity(self):
original_filepath = realpath('E:/GoPro/2018-04-18/GH010926.MP4')
dest_filepath = create_filepath(original_filepath)
... | jujumo/gpsbip-configurator | source/task/path_tools_test.py | Python | mit | 2,315 |
# Copyright 2016 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... | elibixby/gcloud-python | gcloud/monitoring/client.py | Python | apache-2.0 | 11,212 |
from django.contrib import admin
from models import Discipline
class DisciplineAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
admin.site.register(Discipline, DisciplineAdmin)
| caseywstark/colab | colab/apps/disciplines/admin.py | Python | mit | 210 |
# Copyright 2018 ZTE 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | stackforge/solum | solum/common/policies/service.py | Python | apache-2.0 | 1,970 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | alexgorban/models | research/slim/nets/s3dg_test.py | Python | apache-2.0 | 6,242 |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | hanlind/nova | nova/volume/encryptors/__init__.py | Python | apache-2.0 | 4,561 |
#!/usr/bin/python
from __future__ import division
import sys
try:
dec = int(sys.argv[1])
if dec < -1 or dec > 255: raise IndexError()
except IndexError, ValueError:
print "Convert decimal to binary to a maximum of 255."
print "Usage: ./dec2bin.py <dec>"
sys.exit(1)
pwr = 8
bits = ''
while pwr > -1:
bits += str(d... | polarise/RP-python | dec2bin.py | Python | gpl-2.0 | 371 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module provides classes to interface with the Materials Project REST
API v2 to enable the creation of data structures and pymatgen objects using
Materials Project data.
To make use of the Materials AP... | gVallverdu/pymatgen | pymatgen/ext/matproj.py | Python | mit | 62,936 |
#Python program
#Python version used : P2.5
import urllib #library for fetching internet resources
import json #library for json operations
#import os
#title=os.environ["word"]
title = raw_input("Enter word to search: ") #Input word to search dictionary
print "Word: ",title
#stores the json formatted outpu... | manojitballav/terminal-dictionary | dictionary.py | Python | gpl-3.0 | 649 |
#!/usr/bin/python
# 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 distributed... | cchurch/ansible-modules-core | cloud/amazon/iam.py | Python | gpl-3.0 | 31,916 |
# Copyright 2020-2021 Peppy Player peppy.player@gmail.com
#
# This file is part of Peppy Player.
#
# Peppy Player 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 you... | project-owner/Peppy | util/imageutil.py | Python | gpl-3.0 | 42,494 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Margins by Products',
'category': 'Sales/Sales',
'description': """
Adds a reporting menu in products that computes sales, purchases, margins and other interesting indicators based on invoices.
==... | jeremiahyan/odoo | addons/product_margin/__manifest__.py | Python | gpl-3.0 | 737 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2010 The GemRB Project
#
# 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 the License, or (at your option) ... | NickDaly/GemRB-FixConfig-Branch | gemrb/GUIScripts/InventoryCommon.py | Python | gpl-2.0 | 24,564 |
# -*- coding: utf-8 -*-
"""
@author: ci_knight <ci_knight@msn.cn>
@date: 2016年01月1日
"""
# Attempted relative import do not running
import logging
from __init__ import manager
#logging.basicConfig(filename='myapp.log', level=logging.INFO)
if __name__ == "__main__":
manager.run()
| ciknight/doge | manage.py | Python | mit | 294 |
"""Tests for functions and classes in model/estimators.py."""
import glob
import os
from absl.testing import absltest
import heatnet.data.generators as generators
import heatnet.file_util as file_util
import heatnet.model
import heatnet.model.estimators as estimators
import heatnet.test.test_util as test_util
import p... | google-research/heatnet | test/test_estimators.py | Python | gpl-3.0 | 2,675 |
"""Rest interface for accessing a remote library.
Copyright (c) 2013 Clarinova. This file is licensed under the terms of the
Revised BSD License, included in this distribution as LICENSE.txt
"""
from ambry.client.siesta import API
import ambry.client.exceptions
import requests
import json
class NotFound(Exception)... | kball/ambry | ambry/client/rest.py | Python | bsd-2-clause | 17,399 |
""" Check whether the DOAJ contains records with invalid country, currency or language datasets """
import json
from portality import constants
from portality.models import Suggestion, Journal
from portality.datasets import country_options, currency_options, language_options
country_codes = [co[0] for co in country_o... | DOAJ/doaj | portality/scripts/orphaned_datasets.py | Python | apache-2.0 | 2,075 |
# -*- coding: utf-8 -*-
from .backends import *
from .message import *
from .utils import *
| alexandrevicenzi/fluentmail | fluentmail/__init__.py | Python | mit | 93 |
# Copyright 2013, 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 ... | eharney/cinder | cinder/api/contrib/snapshot_actions.py | Python | apache-2.0 | 4,486 |
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# --------------------------------------------
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF"), and the Individual or Organization ("Licensee") accessing and
# otherwise using this software ("Python") in source or binary form and
# its ass... | jaddison/ansible | lib/ansible/vars/unsafe_proxy.py | Python | gpl-3.0 | 6,221 |
import httplib
import re
import os
import requests
import json
from datetime import datetime
from distutils.version import LooseVersion
from cumulusci.core.exceptions import GithubApiNotFoundError
from cumulusci.core.utils import import_class
from cumulusci.tasks.release_notes.exceptions import CumulusCIException
fr... | e02d96ec16/CumulusCI | cumulusci/tasks/release_notes/generator.py | Python | bsd-3-clause | 7,241 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.