code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from __future__ import print_function
#import glob
import os
from collections import defaultdict
from six import iteritems
import numpy as np
#from numpy import where, unique, array, zeros, searchsorted, log10, array_equal
from pyNastran.bdf.bdf import BDF
from pyNastran.op2.op2 import OP2, read_op2, FatalError
from ... | saullocastro/pyNastran | pyNastran/applications/aero_panel_buckling/split_model.py | Python | lgpl-3.0 | 10,773 |
"""The PiStacking module defines the PiStackingType and
PiStackingInx for explicit hydrogens.
"""
import itertools as it
from collections import namedtuple
import numpy as np
import numpy.linalg as la
from scipy.spatial.distance import cdist
import mastic.config.interactions as masticinxconfig
from mastic.interact... | salotz/mast | mastic/interactions/pi_stacking.py | Python | mit | 22,652 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# $Id$
"""
CGI - TestBox Interaction (see testboxscript or the other party).
"""
__copyright__ = \
"""
Copyright (C) 2012-2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free sof... | svn2github/vbox | src/VBox/ValidationKit/testmanager/cgi/testboxdisp.py | Python | gpl-2.0 | 2,121 |
# Copyright 2014 eBay Inc.
#
# Author: Ron Rickard <rrickard@ebay.com>
#
# 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 ... | tonyli71/designate | designate/backend/impl_bind9.py | Python | apache-2.0 | 3,615 |
# Copyright 2015 Internap.
#
# 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, so... | lindycoder/netman | tests/adapters/flask_helper.py | Python | apache-2.0 | 1,418 |
import aiohttp
def example_processor(): # extends processor from gen_scraperV2
async def route(scrape_bundle):
pass
return route
| puddl3glum/gen_scraper | example/example_processor.py | Python | mit | 158 |
from __future__ import print_function
size(800,700)
background(0.7)
speed( 2 )
import itertools
import pprint
# Set the font and create the text path.
fonts = fontnames()
chars = (u"abcdefghijklmnopqrstuvwxyzäöüß"
u"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ"
u"!§$%&/()=¡“¶¢[]|{}≠»„‰¸˝ˇÁÛØ∏°ÅÍ™Ï... | karstenw/nodebox-pyobjc | examples/New Functions/Example var menu 1.py | Python | mit | 2,919 |
#############################################################################
# Copyright (c) 2010 by Casey Duncan
# 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 c... | wrightjb/bolt-planar | box.py | Python | bsd-3-clause | 15,045 |
# gridpanel-5.py
from wax import *
class MainFrame(Frame):
def Body(self):
gp = GridPanel(self, rows=3, cols=3, hgap=0, vgap=0)
gp.AddComponent(0, 0, Button(gp, "(0, 0)"), expand=1)
gp.AddComponent(1, 0, Button(gp, "(1, 0)"), expand=1)
gp.AddComponent(2, 0, Button(gp, "(2, 0)"), ex... | MSMBA/msmba-workflow | msmba-workflow/srclib/wax/examples/gridpanel-5.py | Python | gpl-2.0 | 859 |
# Copyright (C) 2008-2010 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | virtuald/exaile | xl/main.py | Python | gpl-2.0 | 28,843 |
import numpy as np
from threeML.bayesian.sampler_base import MCMCSampler
from threeML.config.config import threeML_config
from threeML.parallel.parallel_client import ParallelClient
from astromodels import use_astromodels_memoization
try:
import zeus
except:
has_zeus = False
else:
has_zeus = True
... | giacomov/3ML | threeML/bayesian/zeus_sampler.py | Python | bsd-3-clause | 4,215 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-11-25 04:08
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | sebastienbarbier/723e_server | seven23/models/currency/migrations/0002_currency_favorite.py | Python | mit | 599 |
# -*- coding: utf-8 -*-
num1 = 0x1010;
num2 = 11;
num3 = 10.25;
num4 = 1 + 1j;
num5 = "12.25";
num6 = "1245";
print cmp(num1,num2);
print str(num1);
print type(num1);
print float(num1);
print long(num1);
print complex(num2);
print "float('12.25') = %f" % (float(num5));
print long(num6);
| zhangjl/python-learn-notes | src/number.py | Python | gpl-2.0 | 295 |
# Unix SMB/CIFS implementation.
# Copyright (C) Michael Adam 2012
#
# 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.
#
# ... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/samba/tests/samba_tool/group.py | Python | mit | 7,464 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterf... | aperigault/ansible | lib/ansible/modules/cloud/amazon/rds.py | Python | gpl-3.0 | 56,646 |
from django.http import HttpResponseRedirect, Http404
from django.utils.translation import ugettext as _
from django.contrib import messages
from notifications.models import CommentNotification, PostNotification, AlreadyNotifiedError
def notify(request, NotificationType, name,
login_msg=_('You need to log... | nathangeffen/tbonline-old | tbonlineproject/notifications/views.py | Python | mit | 3,929 |
#locomotion mirror
if scene.getMotion('ChrMarine@WalkCircleLf01') == None:
#locomotion smooth cycle
print 'locomotion smooth cycle'
smoothMotion = scene.getMotion("ChrMarine@RunCircleRt01")
smoothMotion.smoothCycle("ChrMarine@RunCircleRt01_smooth",0.1);
smoothMotion = scene.getMotion("ChrMarine@WalkCircleRt0... | USC-ICT/gift-integration-demo | GiftDemo/Assets/StreamingAssets/SB/locomotion-ChrMarine-init.py | Python | bsd-3-clause | 4,135 |
"""
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Tensor-product of cos, exp, or tanh.
"""
import numpy as np
from smt.problems.problem import Problem
class TensorProduct(Problem):
def _initialize(self):
self.options.declare("name", "TP", types=str)
... | relf/smt | smt/problems/tensor_product.py | Python | bsd-3-clause | 2,048 |
import os
import time
from random import Random
from pyqtgraph.Qt import QtCore, QtGui
app = QtGui.QApplication([])
from qtreactor import pyqt4reactor
pyqt4reactor.install()
from twisted.internet import defer, task, threads
from orchstr8.services import LbryServiceStack
import pyqtgraph as pg
class Profiler:
p... | lbryio/lbry | lbry/scripts/publish_performance.py | Python | mit | 4,344 |
# Copyright 2015 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | F5Networks/f5-common-python | f5/bigip/tm/ltm/test/unit/test_nat.py | Python | apache-2.0 | 2,807 |
import random
from igraph import *
from utils import weighted_choice
def BATFGraph(m0 = 10, m = 1):
# initialize graph with m0 vertices
g = Graph(n = m0, directed=True)
for v in xrange(m0):
# PA step
weights = g.vs.degree()
u = weighted_choice(weights)
g.add_edges((v,u))
... | talevy/hetnet | hetnet/graphs.py | Python | bsd-2-clause | 564 |
"""
fuzza.cli
---------
Entry point to the application.
"""
import click
from . import __description__
from . import __prog__
from . import __version__
from . import configuration as Configuration
from . import data as Data
from . import dispatcher as Dispatcher
from . import transformer as Transformer
from . import ... | Raphx/fuzza | fuzza/cli.py | Python | mit | 3,100 |
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django import forms
from django.forms.utils import flatatt
from django.utils.html import format_html
class HeaderWidget(forms.widgets.Widget):
def render... | fnp/wolnelektury | src/contact/widgets.py | Python | agpl-3.0 | 459 |
#!/usr/bin/env python
from __future__ import print_function
import pyslurm
from time import gmtime, strftime
def display(block_dict):
if block_dict:
date_fields = [ ]
print('{0:*^80}'.format(''))
for key, value in block_dict.items():
print("{0} :".format(key))
... | edf-hpc/python-pyslurm | examples/blocks_list.py | Python | gpl-2.0 | 1,695 |
# -*- coding: utf-8 -*-
from django.shortcuts import get_object_or_404, render_to_response, redirect
from django.template import RequestContext
from django.core.context_processors import csrf
from django.views.decorators.csrf import csrf_exempt
from django.http import Http404, HttpResponse, HttpResponseForbidden, Http... | agepoly/mezzanine | mezzanine/forms/views.py | Python | bsd-2-clause | 4,648 |
# Generated by Django 3.0.7 on 2021-04-03 18:37
import django.core.validators
from django.db import migrations, models
import report.models
class Migration(migrations.Migration):
dependencies = [
('report', '0014_purchaseorderreport_salesorderreport'),
]
operations = [
migrations.AlterF... | inventree/InvenTree | InvenTree/report/migrations/0015_auto_20210403_1837.py | Python | mit | 1,333 |
#!/usr/bin/env python
"""
Run a jsbsim model as a child process.
"""
import atexit
import errno
import fdpexpect
import math
import os
import select
import signal
import socket
import struct
import sys
import time
import pexpect
from pymavlink import fgFDM
from .. pysim import util
class control_state(object):
... | WickedShell/ardupilot | Tools/autotest/jsb_sim/runsim.py | Python | gpl-3.0 | 12,739 |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head is None:return
... | hufeiya/leetcode | python/82_Remove_Duplicates_from_Sorted_List_II.py | Python | gpl-2.0 | 790 |
from flask import Blueprint
import os
main = Blueprint('main', __name__, static_folder="/app/app/static")
from . import views, errors
from ..models import Permission
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
| adamwwt/chvac | app/main/__init__.py | Python | mit | 263 |
"""
Overview
========
Used to spawn new processes, this module works only on unix-like
platforms.
Commands
========
Command: hbash
Description: Start a new bash process whose output
is directed to a horizontal pane.
Command: vbash
Description: Start a new bash process whose output
is directed to a vertical pane.
C... | iogf/vy | vyapp/plugins/spawn/unix_platform.py | Python | mit | 3,231 |
# Copyright 2014 NEC 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 ... | hanlind/nova | nova/api/openstack/compute/schemas/user_data.py | Python | apache-2.0 | 894 |
from abc import ABC, abstractmethod
from asyncio import Future, ensure_future
from collections import OrderedDict
from pulsar.api import chain_future, ImproperlyConfigured
from pulsar.apps.http import HttpClient
from pulsar.apps.greenio import GreenPool
from pulsar.apps.data.channels import Connector
from pulsar.utils... | quantmind/pulsar-queue | pq/mq.py | Python | bsd-3-clause | 5,657 |
# Copyright 2013 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 agreed to in... | openstack/keystone | keystone/credential/backends/sql.py | Python | apache-2.0 | 4,819 |
#!/usr/bin/env python
import sys, re, operator, string, inspect
def read_stop_words():
""" This function can only be called from a function
named extract_words."""
# Meta-level data: inspect.stack()
if inspect.stack()[1][3] != 'extract_words':
return None
with open('../stop_words.txt'... | mathkann/exercises-in-programming-style | 16-introspective/tf-16.py | Python | mit | 1,338 |
from yanntricks import *
def KScolorD():
pspict,fig = SinglePicture("KScolorD")
pspict.dilatation(1)
x=var('x')
C=Circle(Point(0,0),1)
N1=C.graph(90,180)
N2=C.graph(270,360)
C.parameters.color="blue"
N1.parameters.color="black"
N2.parameters.color=N1.parameters.color
N1.wave(0.... | LaurentClaessens/mazhe | src_yanntricks/yanntricksKScolorD.py | Python | gpl-3.0 | 526 |
#!/usr/bin/env python
# coding: utf8
from setuptools import setup, find_packages
# Get long_description from README
import os
here = os.path.dirname(os.path.abspath(__file__))
f = open(os.path.join(here, 'README.rst'))
long_description = f.read().strip()
f.close()
setup(
name='onkyo-eiscp',
version='1.2.8',
... | miracle2k/onkyo-eiscp | setup.py | Python | mit | 1,149 |
"""
Tests for line search routines
"""
from __future__ import division, print_function, absolute_import
from numpy.testing import assert_, assert_equal, \
assert_array_almost_equal, assert_array_almost_equal_nulp, assert_warns
from scipy._lib._numpy_compat import suppress_warnings
import scipy.optimize.linesearch... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/optimize/tests/test_linesearch.py | Python | mit | 9,849 |
# coding=utf-8
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
from flask import request, jsonify, make_response
from octoprint.settings import settings
from octoprint.printer import getConnectionOptions
from octoprint.server import p... | koenkooi/OctoPrint | src/octoprint/server/api/connection.py | Python | agpl-3.0 | 1,794 |
from glob import glob
from sys import path
import numpy as np
from matplotlib import use as mpluse
mpluse('Agg')
import matplotlib.pyplot as plt
path.append("./../bin/")
from plothelp import plot_fit
from plothelp import read_logf
from filter import filter
import resx
I_EMFs = list()
T_MSs = list()
aliemfs = list... | cbosoft/pi_rheo_proj | etc/rd.py | Python | gpl-3.0 | 2,119 |
"""
Page objects for patternfly/bootstrap modal window.
Modal window is a window which makes itself the only active element on the
page, so that one needs to close it first to access the rest of the page again.
"""
# Copyright 2016 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may ... | Webstr-framework/webstr | webstr/patternfly/modal/pages.py | Python | apache-2.0 | 1,363 |
# Copyright 2021 The FedLearner 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... | bytedance/fedlearner | web_console_v2/api/test/fedlearner_webconsole/sparkapp/apis_test.py | Python | apache-2.0 | 3,416 |
from quipp import *
def run():
num_components = 2
point_dim = 5
ComponentsType = Vector(num_components, Double)
PointType = Vector(point_dim, Double)
get_point = rand_function(ComponentsType, PointType)
def sample():
components = [normal(0, 1) for i in range(num_components)]
return (components, ... | jessica-taylor/quipp2 | src/python/examples/factor_analysis.py | Python | mit | 394 |
from flask_tryton import Tryton
import flask_restful as restful
from flask_login import LoginManager, login_required
from .utils import output_xml
#### Extensions
tryton = Tryton()
login_manager = LoginManager()
# Handle different outputs
class Api(restful.Api):
def __init__(self, *args, **kwargs):
# Set ... | teffalump/fhir | common/extensions.py | Python | gpl-3.0 | 897 |
"""Implementation of packaging-related magic functions.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2018 The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with ... | sserrot/champion_relationships | venv/Lib/site-packages/IPython/core/magics/packaging.py | Python | mit | 3,775 |
# Copyright 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
def parse_file_name():
parser = argparse.ArgumentParser(description="Outputs given file.")
parser.add_argum... | facebook/buck | test/com/facebook/buck/testutil/endtoend/testdata/mobile/ios/plist/py_cat.py | Python | apache-2.0 | 578 |
[('GROUP', 10),
('UNITED STATES SENATOR', 8),
("''", 4),
# media outlet
('NEWS ORGANIZATION', 5),
('NEWSPAPER', 4),
('MAGAZINE', 3),
('TELEVISION SHOW', 2),
('NEWS WEBSITE', 1),
# media person
('BLOGGER, THE WASHINGTON POST', 1),
('ANCHOR, FOX NEWS', 1),
('FOX NEWS ANCHOR', 1),
("CONTRIBUTOR, 'THE VIEW'", 1... | philpot/trump-insult-haiku | nytorg.py | Python | apache-2.0 | 4,644 |
from .ga import GeneticAlgorithm
| Ewande/kheppy | kheppy/evocom/ga/__init__.py | Python | mit | 33 |
import climate
import numpy as np
def main(dataset, output, codebook):
np.save(output, np.random.randn(int(codebook, 10), np.load(dataset).shape[1]))
if __name__ == '__main__':
climate.call(main)
| lmjohns3/movement-classify-experiment | scripts/train-random-codebook.py | Python | mit | 208 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-cdn/azure/mgmt/cdn/operations/edge_nodes_operations.py | Python | mit | 3,846 |
#!/usr/bin/python
import argparse
import os
import signal
import sys
import numpy as np
from time import strftime
from rtlsdr import RtlSdr
import pysdrscan
def terminate(signal, frame):
print "\nCaught SIGINT. Salvaging data."
header['enddate'] = strftime("%Y-%m-%dT%H:%M:%S")
save_fits(header, data, argv... | jordanhalase/pysdrscan | src/pysdrscan_cli/__main__.py | Python | isc | 5,857 |
# coding=utf-8
from __future__ import absolute_import
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
import unittest
import mock
import os
import ddt
import sys
import octo... | masterhou/OctoPrint | tests/util/test_file_helpers.py | Python | agpl-3.0 | 6,690 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Programm name : IDDB.py
Date : 2012-10-25
Author : Steffen Eichhorn [mail@indubio.org]
License : GPL
Description : abstrahiert den Zugriff auf Daten aus der SQL-Datenbank vom ID Scorer
"""
import os.path
import pyodbc
import datetime
import csv
... | indubio/BES | system/BESpy/IDDB.py | Python | agpl-3.0 | 23,819 |
#---------------------------------------------------------------------------------------------------
# Python Module File to describe a cleaner
#
# Author: C.Paus (Jun 16, 2016)
#------------------------------------------------------------------------... | cpausmit/Kraken | python/cleaner.py | Python | mit | 12,891 |
"""Solution to Project Euler Problem 8
https://projecteuler.net/problem=8
"""
from functools import reduce
from operator import mul
FILENAME = "resources/p008_number.txt"
SEGMENT_SIZE = 13
def compute(filename=FILENAME, segment_size=SEGMENT_SIZE):
"""Compute the largest product of `segment_size` adjacent digit... | 2Cubed/ProjectEuler | euler/p008.py | Python | mit | 676 |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2017 Christian Pfarr
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... | PfarrCh/openrsa | key.py | Python | mit | 9,416 |
# coding=utf-8
# URL: http://code.google.com/p/sickbeard
# Originally written for SickGear
#
# This file is part of SickRage.
#
# SickRage 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 th... | hernandito/SickRage | sickbeard/providers/titansoftv.py | Python | gpl-3.0 | 5,198 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# ===========================================================================
# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
# Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2012 Mateusz Loskot (mateusz@loskot.net), Lon... | rkq/cxxexp | third-party/src/boost_1_56_0/libs/geometry/doc/make_qbk.py | Python | mit | 6,060 |
# Copyright 2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
import functools
from pyramid.settings import asbool
# Define default values for options.
DEFAULT_BUNDLESERVICE_URL = 'https://api.jujucharms.com/bundleservice/'
DEFAULT_CHARMST... | mitechie/juju-gui | jujugui/options.py | Python | agpl-3.0 | 2,966 |
#!/usr/bin/env python
import clip, logging, logtool, temporary
from path import Path
from cfgtool.cmdbase import CmdBase
LOG = logging.getLogger (__name__)
class Action (CmdBase):
@logtool.log_call
def run (self):
if not self.conf.force:
self.error (" Must force writes (--force).")
clip.exit (e... | clearclaw/cfgtool | cfgtool/cmd_process.py | Python | lgpl-3.0 | 1,277 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/models/update_transaction_response.py | Python | mit | 3,447 |
# encoding: utf-8
"""
Step implementations for image characterization features
"""
from __future__ import absolute_import, print_function, unicode_literals
from behave import given, then, when
from docx.image.image import Image
from helpers import test_file
# given ===============================================... | LuoZijun/uOffice | temp/pydocxx/features/steps/image.py | Python | gpl-3.0 | 2,273 |
"""
Context processor for lightweight session messages.
Time-stamp: <2008-07-19 23:16:19 carljm context_processors.py>
"""
from django.conf import settings as django_settings
from django.contrib import messages as django_messages
from django.utils.encoding import StrAndUnicode
from askbot.user_messages import get_an... | knowledgepoint-devs/askbot-devel | askbot/user_messages/context_processors.py | Python | gpl-3.0 | 1,115 |
import os
import sys
import time
# get the utils from the parent directory
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils import SEx_head
from pipe_utils import tableio, deredden
# Find the eBV dust correction for each source in the catalogs
def DustCorrection(self):
''' T... | boada/planckClusters | MOSAICpipe/plugins/_dust.py | Python | mit | 3,312 |
# Copyright 2015: Mirantis 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 ... | yeming233/rally | tests/unit/plugins/openstack/context/murano/test_murano_environments.py | Python | apache-2.0 | 3,203 |
# -*- coding: utf-8 -*-
#Copyright (c) 2010, Walter Bender
#Copyright (c) 2010, Tony Forster
#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 th... | walterbender/turtleartmini | plugins/camera_sensor/tacamera.py | Python | mit | 2,820 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterf... | tsdmgz/ansible | lib/ansible/modules/cloud/amazon/iam_managed_policy.py | Python | gpl-3.0 | 15,784 |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the 'context_processors' option of the configuration
of a DjangoTemplates backend and use... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/template/context_processors.py | Python | mit | 2,407 |
from setuptools import setup
package_dir = {"": "src"}
packages = ["extended"]
package_data = {"": ["*"]}
setup_kwargs = {
"name": "extended",
"version": "0.1",
"description": "Some description.",
"long_description": "Module 1\n========\n",
"author": "Sébastien Eustace",
"author_email": "seb... | python-poetry/poetry-core | tests/masonry/builders/fixtures/src_extended/setup.py | Python | mit | 598 |
from mock import patch
from django.test import TestCase
from django.core.urlresolvers import reverse
from ..models import Contact
class ContactViewTest(TestCase):
def setUp(self):
self.url = reverse('contact')
self.response = self.client.get(self.url)
def test_contact_view_is_accessible(sel... | prontointern/django-contact-form | django_contact_form_project/contacts/tests/test_views.py | Python | mit | 14,146 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/grant_access_data_py3.py | Python | mit | 1,464 |
import requests
from requests.auth import HTTPBasicAuth
class GithubRequester:
def __init__(self, auth):
self.auth = auth
def retrieve_issues(self, repo, filters):
#GET /repos/:owner/:repo/issues
f = self._join_filters(filters)
r = requests.get('http://api.github.com/repos... | sterchelen/ghtracker | ghtracker/github_requests.py | Python | apache-2.0 | 981 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | ravens/ravens/agents/conv_mlp.py | Python | apache-2.0 | 10,399 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import datetime
import errno
import json
import os
import shutil
import subprocess
import sys
import tarfile
from enum import Enum
try:
# Python3
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
... | Delphine-L/tools-iuc | data_managers/data_manager_build_kraken2_database/data_manager/kraken2_build_database.py | Python | mit | 11,226 |
import os
import boto
# Before running this script, set envars AWS_ACCESS_KEY_ID
# and AWS_SECRET_ACCESS_KEY, Boto uses them automatically
# ember build --environment="production"
print boto.s3.regions()
conn = boto.connect_s3()
bucket = conn.get_bucket('nodember-rain')
for root, folder, files in os.walk('frontend/d... | holandes22/nodember-rain | deploy.py | Python | mit | 674 |
import interop
url = "http://10.10.130.10:80"
username = "ucsd-auvsi"
password = "1979543783"
connection = interop.InterOp(url, username, password)
#start interop connection
connection.commandLoop()
#start the sending of data
#connection.start_interop()
| UCSD-AUVSI/MissionDirector | interoperability/test.py | Python | gpl-3.0 | 259 |
import sys, os, glob
# add the converter tools to the syspath
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
from pynmrml import io
from pynmrml import nmrML
#for filename in files:
input_file = "sucrose.fid"
output_file = "sucrose.nmrML"
writer = io.factory.varian_converter(input_file)
# Add ... | nmrML/nmrML | tools/Parser_and_Converters/python/pynmrml/examples/adding_annotation.py | Python | mit | 1,379 |
import abc
import warnings
from pathlib import Path
import pandas as pd
import ibis
import ibis.expr.types as ir
from ibis.backends.base import BaseBackend, Database
from ibis.backends.pandas.core import execute_and_reset
# Load options of pandas backend
ibis.pandas
class FileDatabase(Database):
def __init__(s... | cloudera/ibis | ibis/backends/base/file/__init__.py | Python | apache-2.0 | 5,137 |
# Time: O(n)
# Space: O(n)
# Given a binary tree, return the tilt of the whole tree.
#
# The tilt of a tree node is defined as the absolute difference
# between the sum of all left subtree node values and
# the sum of all right subtree node values. Null node has tilt 0.
#
# The tilt of the whole tree is defined as th... | kamyu104/LeetCode | Python/binary-tree-tilt.py | Python | mit | 1,289 |
from django.urls import path
from wishlist import views
app_name = 'wishlist'
urlpatterns = [
path('add/<int:product_id>/', views.add, name='add'),
path('remove/<int:product_id>/', views.remove, name='remove')
]
| pmaigutyak/mp-shop | wishlist/urls.py | Python | isc | 229 |
'''
FBO example
===========
This is an example of how to use FBO (Frame Buffer Object) to speedup graphics.
An Fbo is like a texture that you can draw on it.
By default, all the children are added in the canvas of the parent.
When you are displaying thousand of widget, you'll do thousands of graphics
instructions eac... | kpiorno/kivy3dgui | kivy3dgui/fbowidget.py | Python | mit | 6,221 |
#!/usr/bin/env python
#/******************************************************************************
# * $Id$
# *
# * Project: GDAL Make Histogram and Cumulative graph from Tab delimited tab as
# generated by gdal_hist.py
# * Purpose: Take a gdal_hist.py output and create a histogram plot using matp... | USGS-Astrogeology/GDAL_scripts | gdal_baseline_slope/python2/slope_histogram_cumulative_graph.py | Python | unlicense | 4,103 |
from __future__ import absolute_import
from .version import __version__
from .auxiliary import *
from .simulation import Simulation
from .data_record import DataRecord
from .server import Server
from .individual import Individual
from .arrival_node import ArrivalNode
from .exit_node import ExitNode
from .node import N... | CiwPython/Ciw | ciw/__init__.py | Python | mit | 495 |
#!/usr/bin/env python3
# ################################################################
# Copyright (c) 2018-2020, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
# in ... | Cyan4973/zstd | tests/rateLimiter.py | Python | bsd-3-clause | 1,168 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/incubator-superset | superset/views/redirects.py | Python | apache-2.0 | 2,758 |
from ConfigParser import SafeConfigParser, NoSectionError, NoOptionError, Error
import os
import logging
import sys
class Config:
rethinkdb = {
"host" : "localhost",
"port" : 28015,
"db" : "myops2"
}
def __init__(self):
self.system = os.path.abspath("/e... | onelab-eu/myslice-v2 | myops2/settings.py | Python | mit | 1,049 |
#!/usr/bin/env python
# coding=utf-8
# Contributor:
# Phus Lu <phus.lu@gmail.com>
__version__ = '2.1.11'
__password__ = ''
__hostsdeny__ = () # __hostsdeny__ = ('.youtube.com', '.youku.com')
import sys
import os
import re
import time
import struct
import zlib
import binascii
import logging
import httplib... | imwiththou/GoAgent | server/python/wsgi.py | Python | mit | 16,708 |
import base64
import os
import re
import logging
from datetime import datetime
from uuid import uuid4
from django.conf import settings
fmt = getattr(settings, 'LOG_FORMAT', None)
lvl = getattr(settings, 'LOG_LEVEL', logging.DEBUG)
logging.basicConfig(format=fmt, level=lvl)
from watson import search as watson
from au... | wso2/security-tools | external/django-DefectDojo-1.2.1/dojo/models.py | Python | apache-2.0 | 53,517 |
# -*- coding: utf-8 -*-
# Copyright: See the LICENSE file.
from __future__ import unicode_literals
import collections
import logging
import warnings
from . import builder
from . import declarations
from . import enums
from . import errors
from . import utils
logger = logging.getLogger('factory.generate')
# Factory... | rbarrois/factory_boy | factory/base.py | Python | mit | 25,261 |
from .drastic import nonable, init, strict, enable, disable | clemtoy/drastic | drastic/__init__.py | Python | mit | 59 |
from distutils.core import setup, Extension
import commands
raw_libs = commands.getoutput('Wand-config --libs').split(' ')
libs = []
libdirs = ['/usr/local/lib']
for k,lib in enumerate(raw_libs):
if lib[0:2] == '-l':
libs.append(lib[2:])
elif lib[0:2] == '-L':
libdirs.append(lib[2:])
imagemag... | hsuaz/ferrox | ferrox/contrib/needed_imagemagick_calls/setup.py | Python | mit | 828 |
import os
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_TRACK_MODIFICATIONS = True
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config):
DEBUG = True
DEVELOPMENT = True
class DevelopmentConfig(... | mdsrosa/routes_api_python | config.py | Python | mit | 419 |
# -*- coding: utf-8 -*-
"""solve problem 2"""
n = 1
m = 1
result = 0
while n < 4000000:
s = n + m
n = m
m = s
if s % 2 == 0:
result += s
print result
| zikrach/euler | euler_2.py | Python | gpl-2.0 | 183 |
import numpy as np
import cv2
def detect(img, cascade):
rects = cascade.detectMultiScale(img, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30))
if len(rects) == 0:
return []
rects[:,2:] += rects[:,:2]
return rects
def detect_turned(img, cascade):
img = cv2.cvtColor(img, cv2.COL... | petterreinholdtsen/cinelerra-hv | thirdparty/OpenCV-2.3.1/samples/python2/obj_detect.py | Python | gpl-2.0 | 3,343 |
import _plotly_utils.basevalidators
class ThicknessmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="thicknessmode",
parent_name="histogram2dcontour.colorbar",
**kwargs
):
super(ThicknessmodeValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2dcontour/colorbar/_thicknessmode.py | Python | mit | 546 |
from time import sleep
from tqdm import tqdm
import requests
url = "http://raw.githubusercontent.com/Alafazam/lecture_notes/master/Cormen%20.pdf"
response = requests.get(url, stream=True)
with open("10MB", "wb") as handle:
total_length = int(response.headers.get('content-length'))/1024
for data in tqdm(response.it... | Alafazam/simple_projects | misc/test_tqdm.py | Python | mit | 615 |
# -*- coding: utf-8 -*-
"""
Exif compare unit tests.
"""
import unittest
from exif_compare import main
# pylint: disable=E1103
class ExifCompareViewsTestCase(unittest.TestCase):
"""
Views tests.
"""
def setUp(self):
"""
Before each test, set up a environment.
"""
self... | sargo/exif-compare | src/exif_compare/tests.py | Python | mit | 1,237 |
import copy
import os
import pytest
import salt.modules.grains as grainsmod
import salt.utils.dictupdate as dictupdate
from salt.exceptions import SaltException
from salt.utils.odict import OrderedDict
from tests.support.mock import MagicMock, patch
from tests.support.runtests import RUNTIME_VARS
@pytest.fixture
def... | saltstack/salt | tests/pytests/unit/modules/test_grains.py | Python | apache-2.0 | 26,855 |
"""All forms for the extension."""
from django.forms import ModelForm
from .models import WebResource
class WebResourceForm(ModelForm):
"""Form for a single web resource."""
class Meta:
"""Form meta."""
model = WebResource
fields = ('name', 'description', 'url', 'colour', 'symbol')... | ExCiteS/geokey-webresources | geokey_webresources/forms.py | Python | mit | 321 |
import __init__ as markdown
import re
def isString(s):
""" Check if it's string """
return isinstance(s, unicode) or isinstance(s, str)
class Processor:
def __init__(self, markdown_instance=None):
if markdown_instance:
self.markdown = markdown_instance
class Treeprocessor(Processor):
... | natestedman/Observatory | observatory/lib/markdown/treeprocessors.py | Python | isc | 11,444 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py | Python | mit | 13,189 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.