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 |
|---|---|---|---|---|---|
# coding=utf8
#
# Copyright 2013 Dreamlab Onet.pl
#
# This library 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;
# version 3.0.
# This library is distributed in the hope that it will be useful,
# bu... | tikan/rmock | src/rmock/runners/http/proxy/handler.py | Python | lgpl-3.0 | 2,108 |
from __future__ import print_function
__all__ = [ 'BlockSparsityPattern' ]
from six.moves import zip as izip
from six.moves import range as irange
import numpy as np
import scipy.sparse as sp
from . import csr_utils
from . import misc_utils as util
from ..util.assert_helpers import assertEqual, assertEqLength
from ..... | baharev/SDOPT | sdopt/ordering/block_sparsity_pattern.py | Python | bsd-3-clause | 8,636 |
"""Simple XML-RPC Server.
This module can be used to create simple XML-RPC servers
by creating a server and either installing functions, a
class instance, or by extending the SimpleXMLRPCServer
class.
It can also be used to handle XML-RPC requests in a CGI
environment using CGIXMLRPCRequestHandler.
A list of possibl... | xrg/openerp-server | python25-compat/SimpleXMLRPCServer.py | Python | agpl-3.0 | 21,731 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 th... | unioslo/cerebrum | contrib/nis/generate_groups.py | Python | gpl-2.0 | 5,085 |
# Copyright (c) Jean-Paul Calderone
# See LICENSE file for details.
"""
Unit tests for L{OpenSSL.crypto}.
"""
from unittest import main
import os, re
from subprocess import PIPE, Popen
from datetime import datetime, timedelta
from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, Error, PKey, PKeyType
from OpenSSL.crypto i... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.py | Python | mit | 104,799 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('MSG', '0008_auto_20150913_1527'),
]
operations = [
migrations.CreateModel(
name='CourseGrade',
field... | rajeev001114/Grade-Recording-System | project/MSG/migrations/0009_coursegrade_errorcontent_grade_policy.py | Python | gpl-3.0 | 1,758 |
import torch
import numbers
from torch.nn.parameter import Parameter
from .module import Module
from .batchnorm import _BatchNorm
from .. import functional as F
from .. import init
from ..._jit_internal import weak_module, weak_script_method
@weak_module
class LocalResponseNorm(Module):
r"""Applies local response... | ryfeus/lambda-packs | pytorch/source/torch/nn/modules/normalization.py | Python | mit | 8,914 |
# coding: latin-1
"""
This is a Brian script implementing a benchmark described
in the following review paper:
Simulation of networks of spiking neurons: A review of tools and strategies (2007).
Brette, Rudolph, Carnevale, Hines, Beeman, Bower, Diesmann, Goodman, Harris, Zirpe,
Natschläger, Pecevski, Ermentrout... | asoplata/dynasim-benchmark-brette-2007 | Brian2/archaic/COBA.py | Python | gpl-3.0 | 2,236 |
# -*- coding: utf-8 -*-
# Scrapy settings for browser project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'browser'
SPIDER_MODULES = ['browser.spiders']
NEWS... | ashishtilokani/Cloaking-Detection-Tool | browser/browser/settings.py | Python | mit | 583 |
"""
sentry.tsdb.base
~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf import settings
from enum import Enum
ONE_MINUTE = 60
ONE_HOUR = ONE_MINUTE * 60
ONE_DAY = ONE_HOU... | llonchj/sentry | src/sentry/tsdb/base.py | Python | bsd-3-clause | 3,641 |
"""ASTNG hooks for the Python 2 standard library.
Currently help understanding of :
* hashlib.md5 and hashlib.sha1
"""
from logilab.astng import MANAGER
from logilab.astng.builder import ASTNGBuilder
MODULE_TRANSFORMS = {}
def hashlib_transform(module):
fake = ASTNGBuilder(MANAGER).string_build('''
class md5(... | gkarlin/django-jenkins | build/logilab-astng/brain/py2stdlib.py | Python | lgpl-3.0 | 4,116 |
from cli.wrappers.cli_caller import CliCaller
class CliFeed(CliCaller):
help_description = 'Access a JSON feed (summary information) of reports generated over the last X days by \'{}\''
def add_parser_args(self, child_parser):
parser_argument_builder = super(CliFeed, self).add_parser_args(child_pars... | PayloadSecurity/VxAPI | cli/wrappers/feed/cli_feed.py | Python | gpl-3.0 | 376 |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
from PyQt5.Qt import QDialog
from calibre.gui2.dialogs.saved_search_editor_ui import Ui_SavedSearchEditor
from calibre.utils.icu import sort_key
from calibre.gui2 import error_dialog
from calibre.gui2.dialogs.confirm_delete impor... | sharad/calibre | src/calibre/gui2/dialogs/saved_search_editor.py | Python | gpl-3.0 | 4,376 |
#!/usr/bin/env python
#to create a file in codesnippets folder
import pyperclip
import os
import re
import subprocess
def get_extension(file_name):
if file_name.find('.')!=-1:
ext = file_name.split('.')
return (ext[1])
else:
return 'txt'
def cut(str, len1):
return str[len1 + ... | nikhilponnuru/codeCrumbs | code/create_file.py | Python | mit | 4,006 |
class Solution:
def numSub(self, s: str) -> int:
def numOf1(n):
return int((1+n)*n/2)
answer=0
one=0
for i in range(len(s)):
if s[i]=='1':
one+=1
elif one!=0:
answer+=numOf1(one)
one=0
... | jianjunz/online-judge-solutions | leetcode/1636-number-of-substrings-with-only-1s.py | Python | mit | 416 |
# Copyright 2016 Capital One Services, 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... | taohungyang/cloud-custodian | tools/c7n_org/setup.py | Python | apache-2.0 | 1,317 |
# encoding: utf8
# models.py
from datetime import datetime
from miptclass import settings
from sqlalchemy import Boolean, Column, DateTime, Integer, ForeignKey, PrimaryKeyConstraint, String, func, create_engine
from sqlalchemy.ext.declarative import as_declarative, declared_attr
from sqlalchemy.orm import scoped_s... | daskol/mipt-classifier | miptclass/models.py | Python | mit | 2,918 |
import os
import sys
import warnings
import click
from great_expectations import DataContext
from great_expectations import exceptions as ge_exceptions
from great_expectations.cli import toolkit
from great_expectations.cli.cli_messages import (
COMPLETE_ONBOARDING_PROMPT,
GREETING,
HOW_TO_CUSTOMIZE,
L... | great-expectations/great_expectations | great_expectations/cli/init.py | Python | apache-2.0 | 4,043 |
import importlib
import json
def pack_args(args, kwargs):
return json.dumps({'args':args, 'kwargs': kwargs})
def unpack_args(args):
d = json.loads(args)
return d['args'], d['kwargs']
def find_function(func_module, func_name):
module = importlib.import_module(func_module)
return getattr(module, fu... | erezsh/tasq | utils.py | Python | mit | 329 |
import math
from django import template
register = template.Library()
@register.filter()
def col_md(var):
return 'col-md-' + str(int(math.floor(12/len(var))))
| fako/datascope | src/core/templatetags/bootstrap_tags.py | Python | gpl-3.0 | 166 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("RidgeClassifier" , "iris" , "oracle")
| antoinecarme/sklearn2sql_heroku | tests/classification/iris/ws_iris_RidgeClassifier_oracle_code_gen.py | Python | bsd-3-clause | 135 |
from vacker.analyser.base import BaseAnalyser
class GeolocationAnalyser(BaseAnalyser):
@classmethod
def _convert_to_degress(cls, value):
"""
Helper function to convert the GPS coordinates stored in the EXIF to degress in float format
:param value:
:type value: exifread.utils.... | MatthewJohn/vacker | vacker/analyser/geolocation.py | Python | apache-2.0 | 1,356 |
#!/usr/bin/python
from __future__ import print_function
import sys
import re
import yaml
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
class DataBaseModelProcessor(object):
def __init__(self):
self.db_models = {}
def add_model(self, model):
self.data = model... | iawells/gluon | gluon/common/particleGenerator/DataBaseModelGenerator.py | Python | apache-2.0 | 6,227 |
"""Support for monitoring juicenet/juicepoint/juicebox based EVSE sensors."""
from __future__ import annotations
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import (
DEVICE_CLA... | lukas-hetzenecker/home-assistant | homeassistant/components/juicenet/sensor.py | Python | apache-2.0 | 3,607 |
# Include the Dropbox SDK
import dropbox
# Get your app key and secret from the Dropbox developer website
app_key = '3hlhqwpriatnh49'
app_secret = 'b8fy7drsxmdnwmu'
flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)
# Have the user sign in and authorize this token
authorize_url = flow.start()
pr... | townbull/dome | kiwi/dropboxtest.py | Python | apache-2.0 | 1,068 |
"""ZAP Authenticator integrated with the tornado IOLoop.
.. versionadded:: 14.1
"""
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
from tornado import ioloop
from zmq.eventloop import zmqstream
from .base import Authenticator
class IOLoopAuthenticator(Authenticator):
... | josephkirk/PipelineTools | packages/zmq/auth/ioloop.py | Python | bsd-2-clause | 1,107 |
"""
API for communicating with the i3 window manager.
"""
import json
import subprocess
class I3Msg(object):
"""Send messages to i3."""
def __init__(self, socket=None, msgbin=None):
"""
Initialize the messager.
@param socket The socket to connect to i3 via.
@param msgbin The... | BlueDragonX/fm-dot | i3/lib/i3.py | Python | bsd-3-clause | 4,205 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
vfkPluginDialog
A QGIS plugin
Plugin umoznujici praci s daty katastru nemovitosti
-------------------
begin : 2015-06-11
... | ctu-osgeorel/qgis-vfk-plugin | vfkDocument.py | Python | gpl-2.0 | 3,027 |
# The Hazard Library
# Copyright (C) 2012-2014, GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
... | silviacanessa/oq-hazardlib | openquake/hazardlib/source/complex_fault.py | Python | agpl-3.0 | 11,452 |
# 134. Gas Station QuestionEditorial Solution My Submissions
# Total Accepted: 72748
# Total Submissions: 256809
# Difficulty: Medium
# Contributors: Admin
# There are N gas stations along a circular route, where the amount of gas at station i is gas[i].
#
# You have a car with an unlimited gas tank and it costs co... | shawncaojob/LC | QUESTIONS/134_gas_station.py | Python | gpl-3.0 | 848 |
"""
Definitions for VLBI Mark 4 Headers.
Implements a Mark4Header class used to store header words, and decode/encode
the information therein.
For the specification of tape Mark 4 format, see
https://www.haystack.mit.edu/tech/vlbi/mark5/docs/230.3.pdf
A little bit on the disk representation is at
https://ui.adsabs.h... | mhvk/baseband | baseband/mark4/header.py | Python | gpl-3.0 | 31,253 |
# This file exists to allow for different functionality
# between operating systems if so when required
# This function will add all the module build directories
# to the system path if the sysem is deemed Windows
def add_to_path_if_windows(file, funcs=list()):
import platform
if platform.system() == 'Windo... | X-DataInitiative/tick | tick/base/opsys.py | Python | bsd-3-clause | 556 |
# Copyright 2015 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 ag... | flgiordano/netcash | +/google-cloud-sdk/lib/surface/compute/instance_groups/managed/set_target_pools.py | Python | bsd-3-clause | 5,921 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
import logging
from socorro.external import (
MissingArgumentError,
BadArgumentError
)
from soc... | bsmedberg/socorro | socorro/external/postgresql/crashes.py | Python | mpl-2.0 | 27,990 |
# -*- coding: utf-8 -*-
from .const import MAX_REPRSTR
from .util import limstr, kind, reddit_url
from .exceptions import NoMoreError, UnexpectedResponse
def identify_thing(dict_):
if 'kind' in dict_:
k = kind(dict_['kind']).capitalize()
return globals()[k]
else:
return Blob
class B... | larryng/narwal | narwal/things.py | Python | isc | 21,613 |
from django.conf.urls.defaults import *
urlpatterns = patterns('basic.bookmarks.views',
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<object_id>\d+)/$',
view='bookmark_detail',
name='bookmark_detail',
),
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$',
... | hittu123/ruhive | src/basic/bookmarks/urls.py | Python | mit | 731 |
#!/usr/bin/env python
#
# download and build a standalone epics environment for the xspress3
#
# to use this script:
# mkdir /home/xspress3/epics
# cd /home/xspress3/epics
# wget https://raw.githubusercontent.com/epics-modules/xspress3/master/build_xspress3.py
# python build_xspress3.py all
# See IN... | epics-modules/xspress3 | build_xspress3.py | Python | lgpl-3.0 | 17,292 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010 Red Hat, Inc
#
# kitchen 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 2.1 of the License, or (at your option) any later version.
#
# ki... | fedora-infra/kitchen | kitchen3/kitchen/text/exceptions.py | Python | lgpl-2.1 | 1,267 |
import os
import inspect
import json
from obspy import read, Stream
from pyflex.window import Window
import pytomo3d.adjoint.adjoint_source as adj
import pytomo3d.adjoint.io as adj_io
import pytest
import matplotlib.pyplot as plt
# import pyadjoint.adjoint_source
def _upper_level(path, nlevel=4):
"""
Go the n... | wjlei1990/pytomo3d | pytomo3d/adjoint/tests/test_adjoint_source.py | Python | lgpl-3.0 | 7,231 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, copy, modify, merge, publ... | sidzan/netforce | netforce_jsonrpc/netforce_jsonrpc/controllers/__init__.py | Python | mit | 1,158 |
# Tests numpy methods of <class 'function'>
import itertools
import math
import platform
from functools import partial
import numpy as np
from numba.core.compiler import Flags
from numba import jit, njit, typeof
from numba.core import types
from numba.typed import List, Dict
from numba.np.numpy_support import numpy_... | sklam/numba | numba/tests/test_np_functions.py | Python | bsd-2-clause | 123,601 |
#
# 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) any later version.
#
# This program is distributed in the hope that it will be useful,
... | rlaager/python-virtinst | tests/clitest.py | Python | gpl-2.0 | 46,100 |
from trackback.models import Trackback
from trackback.forms import TrackbackForm
from xmlrpclib import Fault
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
from django.core.urlresolvers import get_resolver, NoReverseMatch, Resolver404
from django.contrib.sites.models import Site
PINGBACK_SOURCE_DOES_NOT_EXI... | DraXus/andaluciapeople | trackback/pingback.py | Python | agpl-3.0 | 4,642 |
"""
Summary:
Ief file data holder.
Contains the functionality for loading ISIS .ief files from disk.
Author:
Duncan Runnacles
Created:
01 Apr 2016
Copyright:
Duncan Runnacles 2016
TODO:
Updates:
"""
import os
from ship.utils import utilfunctions as uf
from ship.utils i... | duncan-r/SHIP | ship/fmp/ief.py | Python | mit | 11,467 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Rebuild module
Main program, cli parsing and api program control and operation
Author: Sławomir Lis <lis.slawek@gmail.com>
revdep-rebuild original author: Stanislav Brabec
revdep-rebuild original rewrite Author: Michael A. Smith
Current Maintainer: Paul Varner <fuzzyr... | zmedico/gentoolkit | pym/gentoolkit/revdep_rebuild/rebuild.py | Python | gpl-2.0 | 4,978 |
#
# This file is part of the vecnet.openmalaria package.
# For copyright and licensing information about this package, see the
# NOTICE.txt and LICENSE.txt files in its top-level directory; they are
# available at https://github.com/vecnet/vecnet.openmalaria
#
# This Source Code Form is subject to the terms of the Mozi... | vecnet/vecnet.openmalaria | vecnet/openmalaria/__init__.py | Python | mpl-2.0 | 1,715 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 12 01:27:07 2017
@author: edward
"""
from scipy.optimize import differential_evolution
def Find_PAR_DEv_Higuchi (Texp, Cexp, k_H_min=0., k_H_max=150.):
"""
Texp - an 1-D np.array of experimental data corresponding to the time elapsed from ... | Physiolution-Polska/MoDDiss | DD_basic_opt/Higuchi_models_opt.py | Python | gpl-2.0 | 5,708 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet._utilspy3}.
"""
from __future__ import division, absolute_import
import warnings
from twisted.trial import unittest
from twisted.internet import _utilspy3 as utils
from twisted.internet.defer import Deferred
fro... | geodrinx/gearthview | ext-libs/twisted/internet/test/test_utilspy3.py | Python | gpl-3.0 | 3,223 |
class Solution(object):
def countPrimes(self, n):
"""
:type n: int
:rtype: int
"""
if n < 3:
return 0
l = 0
while l * l < n:
l += 1
nums = [0] * n
for i in range(2, l + 1):
if nums[i] != 1:
j ... | hawkphantomnet/leetcode | CountPrimes/Solution.py | Python | mit | 535 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013-2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and... | rschnapka/partner-contact | base_contact_phone_extension/__init__.py | Python | agpl-3.0 | 1,023 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('impactassessapp', '0010_codebook'),
]
operations = [
migrations.AlterModelOptions(
name='codebook',
... | qliu/ImpactAssessmentReportingTool | impactassesstool/impactassessapp/migrations/0011_auto_20160726_1623.py | Python | gpl-3.0 | 727 |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | nmittler/grpc | src/python/src/grpc/_adapter/rear.py | Python | bsd-3-clause | 16,395 |
import os
from plantcv.plantcv import get_nir
def test_get_nir_sv(test_data):
"""Test for PlantCV."""
nirpath = get_nir(path=test_data.snapshot_dir, filename="VIS_SV_0_z300_h1_g0_e85_v500_93054.png")
expected = os.path.join(test_data.snapshot_dir, "NIR_SV_0_z300_h1_g0_e15000_v500_93059.png")
assert ni... | danforthcenter/plantcv | tests/plantcv/test_get_nir.py | Python | mit | 630 |
a = [1, 2, 3]
b = a
c = list(a)
print id(a), id(b), id(c) | schmit/intro-python-course | lectures/code/list_copy_id.py | Python | mit | 57 |
'''
Necessary settings for local deployment of <%= name %>.
'''
# local imports
from .base import *
# enable debugging support
DEBUG = True
# change the location we upload to in local dev
MEDIA_ROOT = os.path.join(RESOURCES_DIR, 'uploads')
# add django_toolbar to the installed apps
INSTALLED_APPS += ('debug_toolbar... | montemishkin/slush-django | templates/project/NAME/settings/local.py | Python | mit | 573 |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | spake/mindstormsy | mindstormsy-robot/waveapi/element.py | Python | apache-2.0 | 9,224 |
# -*- coding: utf-8 -*-
# © 2011 Cubic ERP - Teradata SAC(http://cubicerp.com)
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
import time
from osv import osv, fields
from tools.translate import _
import logging
_logger = logging.getLogger(__name__)... | Elico-Corp/openerp-7.0 | delivery_routes/wizard/fill_picking.py | Python | agpl-3.0 | 4,751 |
#!/usr/bin/env python
# Copyright 2002 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... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gcutil/lib/google_apputils/google/apputils/datelib.py | Python | gpl-3.0 | 12,322 |
"""This script reponsible put all of send_get_request() function results
into list, gracefull exit any script import it and return analytics
"""
import time
import signal
import sys
from requests_futures.sessions import FuturesSession
tasks = []
session = FuturesSession()
def bg_cb(sess, resp):
"Callback funct... | daikk115/test-rolling-upgrade-openstack | graceful_exit.py | Python | mit | 2,834 |
# -*- encoding: utf-8 -*-
"""Implements Discovered Hosts from UI."""
from robottelo.ui.base import Base, UIError
from robottelo.ui.locators import common_locators, locators
from robottelo.ui.navigator import Navigator
from time import sleep
class DiscoveredHosts(Base):
"""Manipulates Discovered Hosts from UI"""
... | elyezer/robottelo | robottelo/ui/discoveredhosts.py | Python | gpl-3.0 | 7,513 |
# Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | klmitch/nova | nova/scheduler/host_manager.py | Python | apache-2.0 | 42,159 |
# Copyright 2018 Cloudbase Solutions Srl
# 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 r... | openstack/compute-hyperv | compute_hyperv/nova/utils/placement.py | Python | apache-2.0 | 5,548 |
__author__ = 'pankaj'
n = 15
bases = [2, 3, 5]
nums = [1] * n
candidates_indexes = [0 for _ in bases]
candidates = [base for base in bases]
for i in range(1, n):
nextn = min(candidates)
nums[i] = nextn
for index, val in enumerate(candidates):
if val == nextn:
candidates_indexes[index... | pankajanand18/python-tests | ugly.py | Python | mit | 462 |
import re
import asyncio
import logging
from enum import Enum
from datetime import datetime, timezone
from bson.codec_options import CodecOptions
from pymongo import DESCENDING, ASCENDING
from .utils.indexes import check_index_names
log = logging.getLogger(__name__)
class Ordering(Enum):
title_asc = ('templa... | optiflows/nyuki | nyuki/workflow/db/workflow_instances.py | Python | apache-2.0 | 3,515 |
"""Useful utilities for higher level polynomial classes. """
from __future__ import print_function, division
from sympy.polys.polyerrors import PolynomialError, GeneratorsNeeded, GeneratorsError
from sympy.polys.polyoptions import build_options
from sympy.core.exprtools import decompose_power
from sympy.core import... | vipulroxx/sympy | sympy/polys/polyutils.py | Python | bsd-3-clause | 13,530 |
# pylint: disable=ungrouped-imports
import freezegun
import pytest
from league.fixtures.pytest_fixtures import (
cho_chikun,
kobayashi_koichi,
league_event,
sgf_cho_vs_kobayashi,
sgf_text,
ogs_response,
registry,
)
FROZEN_TIME = '2020-05-29T11:14:00'
@pytest.fixture(autouse=True)
def fr... | climu/openstudyroom | conftest.py | Python | gpl-3.0 | 392 |
import pyblish.api
import maya.cmds as cmds
import pymel
class ValidateConstructionHistory(pyblish.api.Validator):
""" Ensure no construction history exists on the nodes in the instance """
families = ['model']
optional = True
label = 'Model - Construction History'
def process(self, instance):
... | ProgressiveFX/pyblish-pfx | pyblish_pfx/plugins/maya/modeling/validate_construction_history.py | Python | lgpl-3.0 | 1,026 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2017 CERN.
#
# Zenodo is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later v... | jainaman224/zenodo | zenodo/modules/spam/forms.py | Python | gpl-2.0 | 1,827 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... | chshu/openthread | tools/harness-automation/autothreadharness/helpers.py | Python | bsd-3-clause | 2,441 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jart/tensorflow | tensorflow/contrib/data/python/kernel_tests/get_single_element_test.py | Python | apache-2.0 | 3,539 |
import sublime
def is_jsx_file(file):
return file and file.endswith('.jsx')
| Retozi/sublime-react-harmony | utils.py | Python | apache-2.0 | 82 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = Ser... | tamag901/LeapCoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,838 |
from bedlam_slack import app, slack_helper
from flask import jsonify
import requests
from bs4 import BeautifulSoup
CAT_API_URL = "http://thecatapi.com/api/images/get?format=xml&type=gif&results_per_page=1"
CAT_API_TOKEN = ""
# extract the url from the response text
def parse_cat_api_response(response_text):
s... | martinpeck/bedlam-slack | bedlam_slack/catgif.py | Python | mit | 1,338 |
# *****************************************************************************
# Copyright (c) 2019 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution,... | ibm-watson-iot/iot-python | test/test_codecs_utf8.py | Python | epl-1.0 | 1,309 |
#!/usr/bin/python
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
import procgame.game, sys, os
import procgame.config
import random
import procgame.sound
sys.path.insert(0,os.path.pardir)
import bingo_emulator.common.units as units
import bingo_em... | bingopodcast/bingos | bingo_emulator/circus/game.py | Python | gpl-3.0 | 68,199 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# Copyright (C) 2012 Canonical Ltd.
#
# 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) any later... | prescott66/Cnchi | src/canonical/nm.py | Python | gpl-3.0 | 20,645 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import copy
import numpy as np
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from matplotlib import pyplot as plt
from matplotlib.widgets import Slider, MultiCursor
from froi.algorithm import regio... | BNUCNL/FreeROI | froi/widgets/growdialog.py | Python | bsd-3-clause | 21,917 |
#Sample command: python pos1.py ds8.txt "/usr/share/red5/webapps/oflaDemo/transcripts" "/var/www/metadata/output/preprocess_audio" enable "Porter-Stemmer"
import sys
import nltk
import os
import subprocess
import math
from operator import itemgetter
from time import gmtime, strftime
from nltk import stem
from nltk.ste... | amudalab/concept-graphs | FastKeyphraseExt/preprocess_audio/pos1.py | Python | mit | 3,458 |
#-------------------------------------------------------------------------------
# Nombre: tarea#2 AMBULANCIA
# Autor: Rc
# Creado: 29/10/2015
# Copyright: (c) programar 2015
# Licence: <your licence 1.0>
# Crear un programa en python que resuelva el siguiente problema de fisica:
#Una ambulancia se m... | rubbenrc/uip-prog3 | tarea#2 ambulancia.py | Python | mit | 1,042 |
"""
grid.py
Driver function that creates an ARTView display for gridded radar data.
"""
import os
import sys
from ..core import Variable, QtGui, QtCore
from ..components import GridDisplay, Menu
from ._common import _add_all_advanced_tools, _parse_dir, _parse_field
def run(DirIn=None, filename=None, field=None):
... | jjhelmus/artview | artview/scripts/grid.py | Python | bsd-3-clause | 942 |
#!/usr/bin/python
#
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Copyright 2012, Google Inc.
#
"""
Responsible for generating the decoder based on parsed table representations.
"""
from __fu... | endlessm/chromium-browser | native_client/src/trusted/validator_mips/dgen/dgen_output.py | Python | bsd-3-clause | 5,796 |
#!/usr/bin/env python3
from mutagen.mp3 import MP3
import sys
if len(sys.argv) < 2:
print('error: didn\'t pass enough arguments')
print('usage: ./bitrate.py <file name>')
print('usage: find the bitrate of an mp3 file')
exit(1)
f = MP3(sys.argv[1])
print('bitrate: %s' % (f.info.bitrate / 1000))
| lehmacdj/.dotfiles | bin/bitrate.py | Python | gpl-3.0 | 314 |
from django.contrib import admin
from django.forms import TextInput
from models import Post, Tag, SPECIAL_SECTIONS
from forms import PostForm
class PostAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
exclude = ('tags','in_blog')
form = PostForm
def save_model(self, request, obj, f... | jlongster/jlongster-django | apps/ablog/admin.py | Python | bsd-3-clause | 1,265 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Pi-Yueh Chuang <pychuang@gwu.edu>
#
# Distributed under terms of the MIT license.
"""Definition of the Polynomial class"""
import numpy
from utils.poly.poly_operations import eval_poly_coeffs, eval_poly_roots
from utils.poly.poly_op... | piyueh/SEM-Toolbox | utils/poly/Polynomial.py | Python | mit | 8,516 |
from setuptools import setup, find_packages
import miseq_sync
setup(
name = miseq_sync.__projectname__,
version = miseq_sync.__release__,
packages = find_packages(),
author = miseq_sync.__authors__,
author_email = miseq_sync.__authoremails__,
description = miseq_sync.__description__,
licen... | VDBWRAIR/miseq_sync | setup.py | Python | gpl-2.0 | 498 |
# Copyright (c) 2010-2011 OpenStack, 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 ... | houseurmusic/my-swift | swift/container/updater.py | Python | apache-2.0 | 11,763 |
import os
import fitsio
import numpy
from collections import OrderedDict
import mock_tools
class IMAGEMAKER(object):
"""
A Class to create mock file to test LSST L1/Prompt processing
pipeline footprints
Felipe Menanteau, Nov 2016
"""
def __init__(self, **keys):
self.keys = keys
... | menanteau/lsstdev | mocker/python/mocker/filemaker.py | Python | gpl-3.0 | 3,137 |
#!/usr/bin/env python
import os
import json
import zmq
import common.realtime as realtime
from common.services import service_list
from selfdrive.swaglog import cloudlog
import selfdrive.messaging as messaging
import uploader
from logger import Logger
from selfdrive.loggerd.config import ROOT, SEGMENT_LENGTH
def g... | damienstanton/nanodegree | selfdriving_vehicle/openpilot/selfdrive/loggerd/loggerd.py | Python | mit | 2,523 |
# Copyright 2015 PerfKitBenchmarker 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 appli... | kivio/PerfKitBenchmarker | perfkitbenchmarker/alicloud/util.py | Python | apache-2.0 | 3,970 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Windows can't run .sh files, so this is a Python implementation of
update.sh. This script should replace update.sh on all platfo... | krieger-od/nwjs_chromium.src | tools/clang/scripts/update.py | Python | bsd-3-clause | 10,298 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import models
from django.utils import importlib
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ImproperlyConfigured
from django.contrib.auth.models import Group
from django.contrib.sites.models import Si... | SurfasJones/djcmsrc3 | venv/lib/python2.7/site-packages/cms/models/permissionmodels.py | Python | mit | 5,696 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import chagallpy
setup(
name='chagallpy',
version=chagallpy.__version__,
packages=find_packages(),
license='MIT',
description='CHArming GALLery in PYthon',
long_description_content_type="text/markdown",
long_description=open(... | janpipek/chagallpy | setup.py | Python | mit | 782 |
import os
import sys
import shutil
args = sys.argv[1:]
this_script_path = sys.argv[0]
this_script_dir = os.path.split(this_script_path)[0]
for arg in args:
if arg.startswith('--version='):
version = arg[len('--version='):]
LAST_VERSION_TAG = version
else:
LAST_VERSION_TAG = '5.0.0' # Not spec... | bobwalker99/Pydev | plugins/com.python.pydev.docs/build_both.py | Python | epl-1.0 | 6,484 |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import itk
import module_kits.itk_kit as itk_kit
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
class tpgac(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manag... | nagyistoce/devide | modules/insight/tpgac.py | Python | bsd-3-clause | 3,998 |
# -*- coding:utf-8 -*-
#
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, eit... | Endika/hr | hr_policy_absence/__openerp__.py | Python | agpl-3.0 | 1,609 |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the wallet backup features.
Test case is:
4 nodes. 1 2 and 3 send transactions between each other... | qtumproject/qtum | test/functional/wallet_backup.py | Python | mit | 8,576 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 LE GOFF Vincent
# 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 copyright notice, this
# l... | stormi/tsunami | src/secondaires/botanique/types/herbe.py | Python | bsd-3-clause | 1,899 |
from __future__ import absolute_import, division, print_function, unicode_literals
import struct
import datetime
from aspen import Response
from aspen.http.request import Request
from base64 import urlsafe_b64decode
from cryptography.fernet import Fernet, InvalidToken
from gratipay import security
from gratipay.model... | gratipay/gratipay.com | tests/py/test_security.py | Python | mit | 5,176 |
# Flexlay - A Generic 2D Game Editor
# Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | Karkus476/flexlay | flexlay/gui/editor_map_widget.py | Python | gpl-3.0 | 3,984 |
import traceback
import uuid
import ssl
import tornado.stack_context
from Crypto.Hash import SHA512
from greenlet import greenlet
from imc import auth
gr_idmap = {}
ret_idmap = {}
gr_main = greenlet.getcurrent()
def switch_top():
global gr_main
assert greenlet.getcurrent() != gr_main
old_idendata = au... | taiwan-online-judge/taiwan-online-judge | src/py/imc/async.py | Python | mit | 2,816 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.