code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#
# Copyright 2013 Tim O'Shea
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# PyBOMBS is distributed ... | scalable-networks/ext | pybombs/mod_pybombs/__init__.py | Python | gpl-2.0 | 852 |
# Copyright (c) 2009 Mitch Garnaat http://garnaat.org/
#
# 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, m... | apavlo/h-store | third_party/python/boto/vpc/__init__.py | Python | gpl-3.0 | 17,897 |
"""
Management command to resend all lti scores for the requested course.
"""
import textwrap
from django.core.management import BaseCommand
from opaque_keys.edx.keys import CourseKey
from lti_provider.models import GradedAssignment
from lti_provider import tasks
class Command(BaseCommand):
"""
Send all l... | caesar2164/edx-platform | lms/djangoapps/lti_provider/management/commands/resend_lti_scores.py | Python | agpl-3.0 | 1,857 |
#!/usr/bin/env python
#***************************************************************************
#* *
#* Copyright (c) 2009 Yorik van Havre <yorik@uncreated.net> *
#* ... | kkoksvik/FreeCAD | src/Tools/offlinedoc/buildqhelp.py | Python | lgpl-2.1 | 8,832 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# 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 obta... | muzixing/ryu | pbr-0.10.0-py2.7.egg/pbr/tests/test_setup.py | Python | apache-2.0 | 15,144 |
__version_info__ = (0, 6, 1)
__version__ = '.'.join(map(str, __version_info__))
| NeuPhysics/NumSolTUn | docs/_themes/alabaster/_version.py | Python | gpl-2.0 | 80 |
from lib.mmonit import MmonitBaseAction
class MmonitGetUptimeHost(MmonitBaseAction):
def run(self, host_id, uptime_range=0, datefrom=0, dateto=0):
self.login()
if datefrom != 0 and uptime_range != 12:
raise Exception("If datefrom is set, range should be 12")
data = {"id": host... | meirwah/st2contrib | packs/mmonit/actions/get_uptime_host.py | Python | apache-2.0 | 604 |
#!/usr/bin/env python
#
# Copyright (c) 2016 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | ibelem/crosswalk-test-suite | apptools/apptools-manifest-tests/comm.py | Python | bsd-3-clause | 8,359 |
##########################################################################
#
# Copyright (c) 2011, Image Engine Design 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:
#
# * Redistribu... | lento/cortex | test/IECore/DataConvertOpTest.py | Python | bsd-3-clause | 3,033 |
#!/usr/bin/env python
"""Execute the tests for the razers3 program.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage:... | rrahn/jst_bench | include/seqan/apps/razers3/tests/run_tests.py | Python | gpl-3.0 | 16,681 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'OrderAndItemCharges.code'
db.alter_column(u'shipping_o... | jinnykoo/christmas | src/oscar/apps/shipping/south_migrations/0006_auto__chg_field_orderanditemcharges_code__chg_field_weightbased_code.py | Python | bsd-3-clause | 5,032 |
import imghdr
import json
import logging
from django.conf import settings
from django.db.models import Q
from django.http import (HttpResponse, HttpResponseRedirect,
HttpResponseBadRequest, Http404)
from django.shortcuts import get_object_or_404, render
from django.views.decorators.clickjackin... | orvi2014/kitsune | kitsune/gallery/views.py | Python | bsd-3-clause | 9,805 |
#!/usr/bin/env python
#
# Copyright 2006, 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... | paoloach/zdomus | zigbee_lib/googletest/googletest/test/gtest_xml_test_utils.py | Python | gpl-2.0 | 8,876 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/export_strategy.py | Python | mit | 1,195 |
#!/usr/bin/env python
import sys
import re
from helpers import *
PROGRAM_USAGE = """
SeqAn script to replace invalid identifiers (previously collected) in the SeqAn
codebase.
USAGE: replace_identifiers.py BASE_PATH [REPLACEMENTS]
BASE_PATH is the root path of all the folders to be searched.
REPLACEMENTS is a file ... | bkahlert/seqan-research | raw/workshop13/workshop2013-data-20130926/trunk/misc/renaming/replace_identifiers.py | Python | mit | 2,256 |
from PyQt5.uic import properties
| drnextgis/QGIS | python/PyQt/PyQt5/uic/properties.py | Python | gpl-2.0 | 33 |
'''This module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.
* namedtuple factory function for creating tuple subclasses with named fields
* deque list-like container with fast appends and pops on either end
* Cha... | mdanielwork/intellij-community | python/testData/MockSdk3.7/Lib/collections/__init__.py | Python | apache-2.0 | 47,640 |
"""
Helpers for embarrassingly parallel code.
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
from __future__ import division
import os
import sys
from math import sqrt
import functools
import time
import threading
import itertools
fr... | herilalaina/scikit-learn | sklearn/externals/joblib/parallel.py | Python | bsd-3-clause | 33,164 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | thaim/ansible | lib/ansible/modules/cloud/ovirt/ovirt_job.py | Python | mit | 7,379 |
# flake8: NOQA
# "flake8: NOQA" to suppress warning "H104 File contains nothing but comments"
# TODO(okuta): Implement packbits
# TODO(okuta): Implement unpackbits
| tigerneil/chainer | cupy/binary/packing.py | Python | mit | 168 |
# -*- coding: utf-8 -*-
"""
Tests of extended hints
"""
import unittest
from ddt import ddt, data, unpack
# With the use of ddt, some of the data expected_string cases below are naturally long stretches
# of text text without whitespace. I think it's best to leave such lines intact
# in the test code. Therefore:
# ... | synergeticsedx/deployment-wipro | common/lib/capa/capa/tests/test_hint_functionality.py | Python | agpl-3.0 | 37,584 |
# -*- coding: utf-8 -*-
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Robert Layton <robertlayton@gmail.com>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Philippe Gervais <philippe.gervais@inria.fr>
# Lars Buitinck ... | mfjb/scikit-learn | sklearn/metrics/pairwise.py | Python | bsd-3-clause | 44,015 |
# Ansible module to manage CheckPoint Firewall (c) 2019
#
# 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 dist... | thaim/ansible | test/units/modules/network/check_point/test_cp_mgmt_time_facts.py | Python | mit | 2,820 |
"""SCons.Scanner.IDL
This module implements the depenency scanner for IDL (Interface
Definition Language) files.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and asso... | mastbaum/rat-pac | python/SCons/Scanner/IDL.py | Python | bsd-3-clause | 1,852 |
r"""
==============================================================
Compressed Sparse Graph Routines (:mod:`scipy.sparse.csgraph`)
==============================================================
.. currentmodule:: scipy.sparse.csgraph
Fast graph algorithms based on sparse matrix representations.
Contents
========
..... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/scipy/sparse/csgraph/__init__.py | Python | gpl-2.0 | 7,254 |
from sympy import *
from sympy.printing import print_ccode
from sympy.physics.vector import ReferenceFrame, gradient, divergence
from sympy.vector import CoordSysCartesian
R = ReferenceFrame('R');
x = R[0]; y = R[1];
a=-0.5; b=1.5;
visc=1e-1;
lambda_=(1/(2*visc)-sqrt(1/(4*visc**2)+4*pi**2));
print(" visc=%f" % visc)
... | pesser/dealii | examples/step-55/reference.py | Python | lgpl-2.1 | 1,071 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
from powerline.bindings.vim import buffer_name
def commandt(matcher_info):
name = buffer_name(matcher_info)
return name and os.path.basename(name) == b'GoToFile'
| gorczynski/dotfiles | vim/bundle/powerline/powerline/matchers/vim/plugin/commandt.py | Python | gpl-3.0 | 293 |
import mechanize._clientcookie
import mechanize._testcase
def cookie_args(
version=1, name="spam", value="eggs",
port="80", port_specified=True,
domain="example.com", domain_specified=False, domain_initial_dot=False,
path="/", path_specified=False,
secure=False,
expires=0,
discard=True,
... | mzdaniel/oh-mainline | vendor/packages/mechanize/test/test_cookie.py | Python | agpl-3.0 | 1,934 |
# -*- coding: utf-8 -*-
#
# Clang documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 9 20:01:55 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... | cd80/UtilizedLLVM | tools/clang/docs/conf.py | Python | unlicense | 9,132 |
# 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 use ... | StackPointCloud/libcloud | demos/example_aliyun_ecs.py | Python | apache-2.0 | 2,755 |
# merge_frontend.py
import sys
import io
import os
import pygit2
import collections
import typing
ENCODING = 'utf-8'
class MergeReturn(typing.NamedTuple):
success: bool
merge_result: typing.Optional[object]
class MergeDriver:
driver_id: typing.Optional[str] = None
def pre_announce(self, path: str... | erwgd/-tg-station | tools/hooks/merge_frontend.py | Python | agpl-3.0 | 5,937 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | kevin-coder/tensorflow-fork | tensorflow/contrib/training/python/training/bucket_ops_test.py | Python | apache-2.0 | 18,461 |
"""Tests for the NumpyVersion class.
"""
from __future__ import division, absolute_import, print_function
from numpy.testing import assert_, assert_raises
from numpy.lib import NumpyVersion
def test_main_versions():
assert_(NumpyVersion('1.8.0') == '1.8.0')
for ver in ['1.9.0', '2.0.0', '1.8.1']:
as... | kubaszostak/gdal-dragndrop | osgeo/apps/Python27/Lib/site-packages/numpy/lib/tests/test__version.py | Python | mit | 2,055 |
# Copyright 2013 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.
class TraceResult(object):
def __init__(self, impl):
self._impl = impl
def Serialize(self, f):
"""Serializes the trace result to a file-like obj... | DirtyUnicorns/android_external_chromium-org | tools/telemetry/telemetry/core/trace_result.py | Python | bsd-3-clause | 520 |
__author__ = 'bromix'
import unittest
"""
class TestCipher(unittest.TestCase):
def setUp(self):
pass
def test_load_javascript(self):
cipher = Cipher()
java_script = ''
with open ("html5player.js", "r") as java_script_file:
java_script = java_script_file.read()
... | azumimuo/family-xbmc-addon | zips/plugin.video.youtube/resources/lib/test_youtube/test_cipher.py | Python | gpl-2.0 | 585 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Dates on Sales Order',
'version': '1.1',
'category': 'Sales Management',
'description': """
Add additional date information to the sales order.
================================================... | minhphung171093/GreenERP_V9 | openerp/addons/sale_order_dates/__openerp__.py | Python | gpl-3.0 | 797 |
# -*- coding: utf-8 -*-
import os
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
# Register database schemes in URLs.
urlparse.uses_netloc.append('postgres')
urlparse.uses_netloc.append('postgresql')
urlparse.uses_netloc.append('pgsql')
urlparse.uses_netloc.append('postgis')
urlpa... | ramcn/demo3 | venv/lib/python3.4/site-packages/dj_database_url.py | Python | mit | 2,475 |
import os
import sys
import shutil
import tempfile
import contextlib
from ._compat import iteritems, PY2
# If someone wants to vendor click, we want to ensure the
# correct package is discovered. Ideally we could use a
# relative import here but unfortunately Python does not
# support that.
clickpkg = sys.modules[_... | gameduell/duell | pylib/click/testing.py | Python | bsd-2-clause | 10,834 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jalexvig/tensorflow | tensorflow/contrib/saved_model/python/saved_model/reader_test.py | Python | apache-2.0 | 4,761 |
# (c) 2020, Felix Fontein <felix@fontein.de>
#
# 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 versio... | dmsimard/ansible | lib/ansible/utils/fqcn.py | Python | gpl-3.0 | 1,268 |
# Copyright 2011 Justin Santa Barbara
# 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 requ... | jeffrey4l/nova | nova/tests/functional/test_extensions.py | Python | apache-2.0 | 1,578 |
#!/usr/bin/env python
"""Show python and pip versions."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
import warnings
warnings.simplefilter('ignore') # avoid python version deprecation warnings when using newer pip dependencies
try:
import pip
exc... | thnee/ansible | test/lib/ansible_test/_util/controller/tools/versions.py | Python | gpl-3.0 | 460 |
# Copyright 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.
import re
from telemetry.core import web_contents
def UrlToExtensionId(url):
return re.match(r"(chrome-extension://)([^/]+)", url).group(2)
class Exte... | 7kbird/chrome | tools/telemetry/telemetry/core/extension_page.py | Python | bsd-3-clause | 946 |
# Copyright 2011 Red Hat, Inc.
# Copyright 2003 Brent Fox <bfox@redhat.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; version 2 of the License.
#
# This program is distributed in the hop... | lhellebr/spacewalk | client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_choose_channel.py | Python | gpl-2.0 | 2,255 |
"""
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | Titan-C/scikit-learn | benchmarks/bench_mnist.py | Python | bsd-3-clause | 6,977 |
# Based on the buildah connection plugin
# Copyright (c) 2017 Ansible Project
# 2018 Kushal Das
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
#
# Written by: Kushal Das (https://github.com/kushaldas)
from __future__ import (absolute_import, division, print... | alxgu/ansible | lib/ansible/plugins/connection/qubes.py | Python | gpl-3.0 | 5,603 |
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... | ppanczyk/ansible | test/units/modules/network/nxos/test_nxos_static_route.py | Python | gpl-3.0 | 3,385 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import project
import company
import report
import res_partner
import res_config
import web_planner
| vileopratama/vitech | src/addons/project/__init__.py | Python | mit | 200 |
#!/usr/bin/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.
"""This script lays out the PNaCl translator files for a
normal Chrome installer, for one platform. Once run num-of-arches times,
... | GeyerA/android_external_chromium_org | ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py | Python | bsd-3-clause | 13,105 |
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for twisted.enterprise.adbapi.
"""
from twisted.trial import unittest
import os, stat, new
from twisted.enterprise.adbapi import ConnectionPool, ConnectionLost, safe
from twisted.enterprise.adbapi import Connection, Transac... | eunchong/build | third_party/twisted_10_2/twisted/test/test_adbapi.py | Python | bsd-3-clause | 26,501 |
print(xrange(<warning descr="Parameter 'start' unfilled">)</warning>)
print(xrange(1))
print(xrange(1, 2))
print(xrange(1, 2, 3))
print(xrange(1, 2, 3, <warning descr="Unexpected argument">4</warning>))
| akosyakov/intellij-community | python/testData/inspections/PyArgumentListInspection/xRange.py | Python | apache-2.0 | 203 |
#!/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 distribut... | tszym/ansible | lib/ansible/modules/network/nxos/nxos_snmp_location.py | Python | gpl-3.0 | 5,795 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/keras/api/keras/optimizers/__init__.py | Python | bsd-2-clause | 1,718 |
#!/usr/bin/python
#
# Copyright (c) 2011 The Chromium OS Authors.
#
# See file CREDITS for list of people who contributed to this
# 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; eit... | MarvellEmbeddedProcessors/u-boot-armada38x | tools/patman/patman.py | Python | gpl-2.0 | 5,394 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/ffmpeg/encode_audio_op_test.py | Python | apache-2.0 | 2,597 |
from __future__ import unicode_literals
import sys
from django.conf import settings
from django.template import Library, Node, TemplateSyntaxError, Variable
from django.template.base import TOKEN_TEXT, TOKEN_VAR, render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import six... | vitaly4uk/django | django/templatetags/i18n.py | Python | bsd-3-clause | 18,976 |
a = "two"
"one %s three" % a | idea4bsd/idea4bsd | python/testData/refactoring/introduceVariable/substringInExpressionStatement.after.py | Python | apache-2.0 | 28 |
# test equality for classes/instances to other types
class A:
pass
class B:
pass
class C(A):
pass
print(A == None)
print(None == A)
print(A == A)
print(A() == A)
print(A() == A())
print(A == B)
print(A() == B)
print(A() == B())
print(A == C)
print(A() == C)
print(A() == C())
| mhoffma/micropython | tests/basics/equal_class.py | Python | mit | 295 |
#!/usr/bin/env python3
def __safe_call(f, a):
"""Call a function and capture all exceptions."""
try:
return f(a)
except Exception as e:
return "{}@{}({})".format(a.__class__.__name__, id(a), e)
def __safe_error(msg, a, b):
"""Generate the error message for assert_XX without causing an ... | SymbiFlow/symbiflow-arch-defs | utils/lib/asserts.py | Python | isc | 1,746 |
from carapace import config
from carapace.sdk import registry
config.updateConfig()
registry.registerConfig(config)
| oubiwann/carapace | carapace/app/__init__.py | Python | mit | 118 |
logparser = r'(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2},\d{3})\s+' \
r'(DEBUG|ERROR|INFO)\s+\[(\w+):(\w+):?(\w+)?\]\s+(.+)$'
| the-zebulan/CodeWars | katas/kyu_6/parse_the_log.py | Python | mit | 134 |
'''dossier.fc Feature Collections
:class:`dossier.fc.FeatureCollection` provides
convenience methods for working with collections of features
such as :class:`dossier.fc.StringCounter`.
A feature collection provides ``__add__`` and ``__sub__`` so that
adding/subtracting FeatureCollections does the right thing for its
... | dossier/dossier.fc | python/dossier/fc/feature_collection.py | Python | mit | 26,206 |
#!/usr/local/bin/python3
import argparse
import gym
import logging
import tensorflow as tf
from dqn_agent import DQNAgent
from network import Network
from replay_memory import ReplayMemory
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--log_level', default='INFO', help='Log verbosity... | viswanathgs/dist-dqn | src/main.py | Python | mit | 7,997 |
import asynctest
from asynctest.mock import patch
import json
class TestRundeckJob(asynctest.TestCase):
def setUp(self):
patcher1 = patch('charlesbot_rundeck.rundeck_job.http_get_request')
self.addCleanup(patcher1.stop)
self.mock_http_get_request = patcher1.start()
from charlesbo... | marvinpinto/charlesbot-rundeck | tests/test_rundeck_job.py | Python | mit | 2,175 |
import re
import struct
from traitlets import Bytes, Unicode, TraitError
# reference to https://stackoverflow.com/a/385597/1338797
float_re = r'''
(?:
[-+]? # optional sign
(?:
(?: \d* \. \d+ ) # .1 .12 .123 etc 9.1 etc 98.1 etc.
|
(?: \d+ \.? ) # 1. 12. 123. etc 1 12 123 etc.
)... | K3D-tools/K3D-jupyter | k3d/validation/stl.py | Python | mit | 1,932 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Sphinx configuration."""
from __future__ import print_function
import os
# -- G... | inveniosoftware/invenio-search-ui | docs/conf.py | Python | mit | 10,173 |
# -*- coding: utf-8 -*-
"""
Send many mails
===============
Send mail to students. The script consider two columns from
one spreadsheets. The first one is about the receivers,
the second one about the customized message for each of them.
"""
#########################################
# logging et import
import os
impo... | sdpython/ensae_teaching_cs | _doc/examples/automation/send_mails.py | Python | mit | 3,434 |
from __future__ import unicode_literals
from django import template
from django.utils.html import mark_safe
from .. import conf
from ..models import Icon
register = template.Library()
@register.simple_tag
def svg_icons_icon(name, **kwargs):
filters = {'name__iexact': name}
value = ''
if kwargs.get('gr... | rouxcode/django-svg-icons | svg_icons/templatetags/svg_icons_tags.py | Python | mit | 1,258 |
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file i... | anler/django-paginator-ext | tests/settings.py | Python | mit | 5,356 |
import re, sys, os
from gunicorn.app.wsgiapp import run
if __name__ == '__main__':
sys.argv[0] = __file__
sys.exit(run())
| commitmachine/pg-hoffserver | pghoffserver/gunicorn_python.py | Python | mit | 131 |
from random import random
from functools import partial
import csv
import json
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.spinner import S... | romanchom/GestureRecognitionVR | MouseGestures/App.py | Python | mit | 8,792 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-02-22 15:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | cloudcomputinghust/IoT | co-ordinator/api/migrations/0002_auto_20170222_1514.py | Python | mit | 664 |
import datetime
from django.conf import settings
from django import template
from django.core.urlresolvers import reverse
from django.utils.dateformat import format
from schedule.conf.settings import CHECK_PERMISSION_FUNC
from schedule.models import Calendar
from schedule.periods import weekday_names, weekday_abbrs, M... | tscholze/py-hasi-home-analytical-system-interface | hasi/schedule/templatetags/scheduletags.py | Python | mit | 11,258 |
# """Test for views creation and link to html pages."""
# from pyramid import testing
# from pyramid_learning_journal.models import (
# Entry,
# get_tm_session,
# )
# from pyramid_learning_journal.models.meta import Base
# from pyramid_learning_journal.views.notfound import notfound_view
# from pyramid_learning... | endere/pyramid-learning-journal | pyramid_learning_journal/pyramid_learning_journal/tests.py | Python | mit | 9,988 |
# -*- test-case-name: xmantissa.test.test_sharing -*-
"""
This module provides various abstractions for sharing public data in Axiom.
"""
import os
import warnings
from zope.interface import implementedBy, directlyProvides, Interface
from twisted.python.reflect import qual, namedAny
from twisted.protocols.amp impor... | twisted/mantissa | xmantissa/sharing.py | Python | mit | 30,864 |
# -*- coding: utf-8 -*-
from jinja2 import Environment, FileSystemLoader, Template, TemplateNotFound
import jinja2.ext
import os
class TemplateProvider(object):
_template_dirs = []
def __init__(self, *args, **kwargs):
self._env = self._create_env(*args, **kwargs)
def _create_env(self, *args, **... | ra2er/templateit | templateit/providers.py | Python | mit | 3,011 |
#!/usr/bin/python
# load all opp file, store in a matrix, and print to files for significant interactions
import os, sys
import psyco
psyco.full()
class PW:
def __init__(self):
self.pw={}
self.pw={}
self.pw={}
self.pw={}
self.opps=[]
return
def get_opp_names(self):
fname... | MarilyGunnersLab/MCCE | mcce_stable/bin/thinopp.py | Python | mit | 1,775 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_12_01/operations/_load_balancer_load_balancing_rules_operations.py | Python | mit | 8,924 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import beanstalkc
from flask import Blueprint, current_app, jsonify, g, request
import config
api = Blueprint('api', __name__)
@api.before_request
def before_request():
g.beanstalk = beanstalkc.Connection(
host=config.BEANSTALKD_HOST, port=config.... | BeanYoung/push-turbo | src/api.py | Python | mit | 1,548 |
'''
Created on 1.12.2016
@author: Darren
'''
'''
A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in the group. The distance is calculated using Manhattan Distance, where distance(p1, p2) = |p2.x - p1.x|... | darrencheng0817/AlgorithmLearning | Python/leetcode/BestMeetingPoint.py | Python | mit | 610 |
# -*- coding: utf-8 -*-
import math
# Constants taken from http://cesiumjs.org/2013/04/25/Horizon-culling/
radiusX = 6378137.0
radiusY = 6378137.0
radiusZ = 6356752.3142451793
# Stolen from https://github.com/bistromath/gr-air-modes/blob/master/python/mlat.py
# WGS84 reference ellipsoid constants
# http://en.wikiped... | loicgasser/quantized-mesh-tile | quantized_mesh_tile/llh_ecef.py | Python | mit | 1,533 |
from uiot import *
d("led", "blue", onboardled, "off", "on")
d("button", "forward", d3, 0, 1)
d("button", "back", d4, 0, 1)
run()
| ulno/micropython-extra-ulno | examples/presentation_remote/remote1/copy/autostart.py | Python | mit | 132 |
import unittest
from Hero import Hero
class HeroTest(unittest.TestCase):
def setUp(self):
self.hero = Hero(10, 0)
def test_hero_default(self):
self.assertEqual(
(self.hero.health,
self.hero.magic,
self.hero.x,
self.hero.y), (10, 0, None, N... | vpachedzhi/Hero_Game_Qt | tests.py | Python | mit | 561 |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.animation as anm
#plt.rcParams['animation.ffmpeg_path'] = '/usr/bin/ffmpeg'
plt.close('all')
data = np.loadtxt('solar_system.dat')
data2 = data[:,0:15]
fig = plt.figure()
ax = p3.Axes3D(fi... | dcelisgarza/applied_math | solar_system/animatep2.py | Python | mit | 1,987 |
#!/usr/bin/env python3
__author__ = "Jeremy Brown"
__copyright__ = "2014 Jeremy Brown"
__license__ = "MIT"
"""
Improved Eurler's Method solver
Inspired by my math homework, which showed me that Euler's Method is a very
repetitive process. I couldn't find a tool that would easily let me solve
using this method an... | j-bro/improved-eulers-method | euler.py | Python | mit | 4,813 |
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# these are system modules
import commands
import numpy
import os
import sys
# these are my local modules
from env import gidgetConfigVars
import miscIO
import miscTCGA
import path
import tsvIO
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#... | cancerregulome/gidget | commands/feature_matrix_construction/main/new_Level3_miRNAseq.py | Python | mit | 11,860 |
# -*- coding: utf-8 -*-
from datetime import timedelta
from workalendar.core import WesternCalendar, ChristianMixin
class Cyprus(WesternCalendar, ChristianMixin):
"Cyprus"
include_epiphany = True
include_clean_monday = True
include_good_friday = True
include_easter_saturday = True
include_eas... | gregn610/workalendar | workalendar/europe/cyprus.py | Python | mit | 1,077 |
import psycopg2
def pg_connect(
host,
port,
user,
password,
database):
"""
Small connection class
If no password is suplied we try the default postgres user
and expect a setted pg_ident or something similar
"""
#if DEBUG: keep("Model().pg_connect()")
... | ragged/yapgt | utils/connect.py | Python | mit | 1,481 |
from binascii import hexlify
from struct import pack, unpack
import hashlib
import time
import sys
import traceback
import electrum_dgb as electrum
from electrum_dgb.bitcoin import EncodeBase58Check, DecodeBase58Check, TYPE_ADDRESS, int_to_hex, var_int
from electrum_dgb.i18n import _
from electrum_dgb.plugins import B... | protonn/Electrum-Cash | plugins/ledger/ledger.py | Python | mit | 22,169 |
# -*- coding: utf-8 -*-
"""
Facade patterns
"""
class Power(object):
"""
SubSystem
"""
@staticmethod
def start():
print "Power on!"
class Display(object):
"""
Subsystem
"""
@staticmethod
def start():
print "Display on!"
class Client(object):
"""
Fac... | xuwei0455/design_patterns | Facade.py | Python | mit | 645 |
#!/usr/bin/env python
import obd_io
import serial
import platform
import obd_sensors
from datetime import datetime
import time
from obd_utils import scanSerial
class OBD_Capture():
def __init__(self):
self.supportedSensorList = []
self.port = None
localtime = time.localtime(time.time())
... | iclwy524/asuradaProject | sensor/pyobd/obd_capture.py | Python | mit | 2,641 |
def mutate_string(string, position, character):
p=list(s)
p[int(position)]=c
p=''.join(p)
return p
if __name__ == '__main__':
s = input()
i, c = input().split()
s_new = mutate_string(s, int(i), c)
print(s_new)
| manishbisht/Competitive-Programming | Hackerrank/Practice/Python/3.string/17.Mutations.py | Python | mit | 268 |
#!/usr/bin/env python
import pywikibot
from pywikibot.data import api
site = pywikibot.Site()
reason = '[[WP:CSD#U2|U2]]: Userpage or subpage of a nonexistent user'
def user_does_not_exist(name):
req = api.Request(action='query', list='users', ususers=name)
data = req.submit()
return 'missing' in data[... | legoktm/pywikipedia-scripts | clean_up_mess.py | Python | mit | 747 |
import os
from coverage_reporter.options import Option, OptionList
DEFAULT_PLUGIN_DIRS = [ os.path.dirname(__file__) + '/collectors/',
os.path.dirname(__file__) + '/filters/',
os.path.dirname(__file__) + '/reports/',
]
DEFAULT_PLUGINS = [ 'figlea... | dugan/coverage-reporter | coverage_reporter/defaults.py | Python | mit | 1,043 |
# flake8: noqa
"""
Tools for object-modeling OSC responses received from ``scsynth``.
"""
from .bases import Request, RequestBundle, Requestable, Response
from .buffers import (
BufferAllocateReadChannelRequest,
BufferAllocateReadRequest,
BufferAllocateRequest,
BufferCloseRequest,
BufferCopyRequest... | josiah-wolf-oberholtzer/supriya | supriya/commands/__init__.py | Python | mit | 4,060 |
from Qt import QtWidgets, QtCore, QtGui
import math
from . import resource
from .exc import *
class ControlLayout(QtWidgets.QGridLayout):
def __init__(self, columns=1, parent=None):
super(ControlLayout, self).__init__(parent)
self._columns = columns
self.setContentsMargins(20, 20, 20, 20... | danbradham/psforms | psforms/widgets.py | Python | mit | 12,100 |
import re
_regex_default = re.compile('\S+')
def parse_save_file(filedata):
detectors, sources = [], []
for line in filedata:
if line.startswith('[SOURCE]'):
data = _regex_default.findall(line[len('[SOURCE]'):])
name, isotope, m, d_cover, mat_cover, pos, activity = data
pos = (0, 0, float(pos))
if m.... | industrialsynthfreak/xr3 | nist.py | Python | mit | 2,046 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='waypoint_event',
name='n... | flipjack/misrutas | project/app/migrations/0002_remove_waypoint_event_name.py | Python | mit | 343 |
# import jinja2
import flask as fk
from corrdb.common.core import setup_app
import tarfile
from StringIO import StringIO
from io import BytesIO
import zipfile
import json
import time
import boto3
import traceback
app = setup_app(__name__)
s3 = boto3.resource('s3')
# Templates
# loader = jinja2.PackageLoader('cloud'... | wd15/corr | corr-cloud/cloud/__init__.py | Python | mit | 9,419 |
import random, binascii
class HashOutput(bytearray):
def hexdigest(self) -> str:
return binascii.hexlify(self).decode('ascii')
class PearsonHasher:
def __init__(self, length: int, seed = 'ΑΓΕΩΜΕΤΡΗΤΟΣ ΜΗΔΕΙΣ ΕΙΣΙΤΩ'):
self.length = length
generator = random.Random()
generator.seed(seed)
self.table = l... | ze-phyr-us/pearhash | pearhash.py | Python | mit | 908 |