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 |
|---|---|---|---|---|---|
"""
WSGI config for Yummy_Pies project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | Piotr95/Yummy_Pies | src/wsgi.py | Python | mit | 391 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-securitycenter | samples/generated_samples/securitycenter_v1p1beta1_generated_security_center_run_asset_discovery_async.py | Python | apache-2.0 | 1,656 |
import unittest
foo = 'bar'
| siosio/intellij-community | python/testData/debug/test_ignore_exceptions_in_unittest.py | Python | apache-2.0 | 29 |
#! /usr/bin/env python
"""
Automatically shutdown this cloud server when it's idle in a cost-aware
fashion. Take in to account the fact that some providers (like AWS EC2) charge
you for partial hours, so there's no reason to shutdown early if you've already
paid for the whole hour.
## Using This Script
### Run This S... | PolicyStat/shutdown-if-idle | shutdown_if_no_usage.py | Python | mit | 10,248 |
#
# Copyright (c) 2005 Canonical
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as publi... | 64studio/smart | smart/backends/rpm/pm.py | Python | gpl-2.0 | 13,902 |
from django.db import models
import checkinatfmi.translations_bg as translate
from university.models import Place
class Client(models.Model):
mac = models.CharField(max_length=63, verbose_name=translate.client_mac)
status = models.BooleanField(verbose_name=translate.state)
status_changed = models.DateTim... | TheCodingMonkeys/checkin-at-fmi | checkinatfmi_project/clients/models.py | Python | agpl-3.0 | 645 |
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'', include('tracpro.contacts.urls')),
url(r'', include('tracpro.groups.urls')),
... | ewheeler/tracpro | tracpro/urls.py | Python | bsd-3-clause | 1,223 |
# SDT4PrintOneM2MSVG.py
#
# Generate SVG in oneM2M's Resource format
import datetime, os, pathlib, string
from .SDT4Classes import *
from common.SDTSVG import *
from common.SDTHelper import *
# definition of cardinality constants
cardinality1 = '1'
cardinality01 = '0..1'
cardinality0n = '0..n'
# variable that hold ... | Homegateway/SDTTool | sdtv4/SDT4PrintOneM2MSVG.py | Python | apache-2.0 | 9,572 |
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
from IndexableBunch import IndexableBunch
#from OrderedBunch import OrderedBunch
import types
from copy import deepcopy
from warnings ... | aerialhedgehog/VyPy | trunk/VyPy/data/DataBunch.py | Python | bsd-3-clause | 6,198 |
from django.conf.urls import url
from . import views
app_name = 'judge'
urlpatterns = [
url(r'^$',
views.index,
name='index'),
url(r'^login/$',
views.login,
name='login'),
url(r'^logout/$',
views.logout,
name='logout'),
url(r'^problems/$',
v... | hyl0327/esoe_oop_judge | web/judge/urls.py | Python | mit | 650 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isBalanced(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
return self... | liupangzi/codekata | leetcode/Algorithms/110.BalancedBinaryTree/Solution.py | Python | mit | 712 |
#!/usr/bin/python
# encoding: utf-8
import torch
import torch.nn as nn
import collections
import torch.nn.parallel
def data_parallel(model, input, ngpu):
if isinstance(input.data, torch.cuda.FloatTensor) and ngpu > 1:
output = nn.parallel.data_parallel(model, input, range(ngpu))
else:
outpu... | lywen52/quantproject | model/ocr/english/utils.py | Python | apache-2.0 | 3,275 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2012 Kouhei Maeda <mkouhei@palmtb.net>
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,... | mkouhei/hatena2rest | setup.py | Python | gpl-3.0 | 2,308 |
from main import *
def testbench():
clk = Signal(bool(0))
reset = ResetSignal(1, active=0, async=True)
state_reset = Signal(bool(0))
state = Signal(m_state.init)
hall1_not = Signal(bool(1))
hall2_not = Signal(bool(1))
drive2pos1_manual = Signal(bool(0))
drive2pos2_manual = Signal(bool(0... | DeadBugEngineering/MirrorBoxController | tb.py | Python | mit | 2,918 |
#!/usr/bin/python
"""
File is part of Malzoo
This service gives access to the API's of MalZoo, Viper and Cuckoo.
It makes it possible to submit samples to the specified service.
For now the classes are in one file, if they get expanded too far they might
be splitted in the future to seperate services.
"""
#Default l... | nheijmans/MalZoo | malzoo/core/services/apis.py | Python | gpl-2.0 | 2,457 |
from django.apps import AppConfig
class EcommerceConfig(AppConfig):
name = 'carrinho'
| lamenezes/django-ecom | ecom/carrinho/apps.py | Python | gpl-3.0 | 92 |
#===============================================================================
# Copyright 2009 Matt Chaput
#
# 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... | jerem/Whoosh | src/whoosh/filedb/filereading.py | Python | apache-2.0 | 8,910 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.a... | vmahuli/contrail-controller | src/api-lib/tools/install_venv_common.py | Python | apache-2.0 | 6,620 |
"""
WSGI config for columbus project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
# import sys
import socket
from django.core.wsgi import get_wsgi_application
# sys.pa... | jkachika/columbus | columbus/wsgi.py | Python | mit | 699 |
# 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 ... | Kami/libcloud | libcloud/common/types.py | Python | apache-2.0 | 6,989 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module provides classes to perform fitting of molecule with arbitrary
atom orders.
This module is supposed to perform exact comparisons without the atom order
correspondence prerequisite, while molecule_structure_comp... | materialsproject/pymatgen | pymatgen/analysis/molecule_matcher.py | Python | mit | 47,300 |
''' Helpers for interacting with OpenvSwitch '''
import subprocess
import os
from charmhelpers.core.hookenv import (
log, WARNING
)
from charmhelpers.core.host import (
service
)
def add_bridge(name):
''' Add the named bridge to openvswitch '''
log('Creating bridge {}'.format(name))
subprocess.che... | CiscoSystems/juju-vem | hooks/charmhelpers/contrib/network/ovs/__init__.py | Python | apache-2.0 | 2,516 |
import unittest
class SrecException(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class SrecExceptionWrongLength(Exception):
def __init__(self):
self.msg = 'Wrong length of record line'
def __str__(self):
return self.msg
cl... | pavelrevak/pystlink | lib/srec.py | Python | mit | 6,387 |
import pytest
from ..sync_flake8_versions import get_revisions
def test_wrong_yesqa_flake8(capsys):
precommit_config = {
"repos": [
{
"repo": "https://gitlab.com/pycqa/flake8",
"rev": "0.1.1",
"hooks": [
{
... | rs2/pandas | scripts/tests/test_sync_flake8_versions.py | Python | bsd-3-clause | 6,345 |
#
# Copyright 2019 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
""" main function to run the blocktool api from the command line. """
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literal... | skoslowski/gnuradio | gr-utils/blocktool/__main__.py | Python | gpl-3.0 | 373 |
#!/usr/bin/env python3
import csv, codecs, io
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)
def __iter__(self):
return self
def __next__(self):
... | yam655/splitoutline | splitoutline/csvhelpers.py | Python | apache-2.0 | 1,756 |
'''
pool.py - this file is part of S3QL.
Copyright © 2008 Nikolaus Rath <Nikolaus@rath.org>
This work can be distributed under the terms of the GNU GPLv3.
'''
from ..logging import logging # Ensure use of custom logger class
import threading
from contextlib import contextmanager
log = logging.getLogger(__name__)
c... | singleton7/main | src/s3ql/backends/pool.py | Python | gpl-3.0 | 1,872 |
# -*- coding: utf-8 -*-
#
# This file is part of GetTor, a Tor Browser distribution system.
#
# :authors: Israel Leiva <ilv@torproject.org>
#
# :copyright: (c) 2015, The Tor Project, Inc.
# (c) 2015, Israel Leiva
#
# :license: This is Free Software. See LICENSE for license information.
#
import os
imp... | shahabedinh/gettor | upload/fetch_latest_torbrowser.py | Python | bsd-3-clause | 4,130 |
#!/usr/bin/python
""" this is interface module
(c) 2018, NetApp, Inc
# 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... | direvus/ansible | lib/ansible/modules/storage/netapp/na_ontap_interface.py | Python | gpl-3.0 | 13,378 |
from prompt_toolkit.filters import Filter
class HasSelectedCompletion(Filter):
"""Enable when the current buffer has a selected completion."""
def __call__(self, cli):
complete_state = cli.current_buffer.complete_state
return (complete_state is not None and
complete_state.curre... | d33tah/pgcli | pgcli/filters.py | Python | bsd-3-clause | 413 |
def total_occurences(s1, s2, ch):
"""(str, str, str) -> int
Precondition: len(ch) == 1
Return the total number of times ch appears in s1 and s2.
>>> total_occurences('red', 'blue', 'u')
1
"""
# total_occurences('Yellow', 'Blue', 'u')
return (s1 + s2).count(ch)
if __name__ == '__main... | JSBCCA/pythoncode | early_projects/totalocc.py | Python | mit | 492 |
#----------------------------------------------------------------------------
# Copyright 2016 Florian Schumacher (Ruhr-Universitaet Bochum, Germany)
#
# This file is part of ASKI version 1.2.
#
# ASKI version 1.2 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | seismology-RUB/ASKI | py/cubit2ASKIecartInversionGrid.py | Python | gpl-2.0 | 4,101 |
from typing import List, Dict, Optional
from datedelta import datedelta
from datetime import datetime, timedelta
import regex
from recognizers_text import RegExpUtility, ExtractResult
from recognizers_number import Constants as NumberConstants
from ...resources.chinese_date_time import ChineseDateTime
from ..constant... | matthewshim-ms/Recognizers-Text | Python/libraries/recognizers-date-time/recognizers_date_time/date_time/chinese/date_parser.py | Python | mit | 12,178 |
# Authors: David Goodger
# Contact: goodger@users.sourceforge.net
# Revision: $Revision: 21817 $
# Date: $Date: 2005-07-21 22:39:57 +0200 (Thu, 21 Jul 2005) $
# Copyright: This module has been placed in the public domain.
"""
Simple internal document tree Writer, writes indented pseudo-XML.
"""
__docformat__ = 'reStr... | baoboa/Crystal-Space | docs/support/docutils/writers/pseudoxml.py | Python | lgpl-2.1 | 829 |
"""
Django migrations for email_log app
This package does not contain South migrations. South migrations can be found
in the ``south_migrations`` package.
Thank you, Trey Hunner! http://treyhunner.com/2014/03/migrating-to-django-1-dot-7/
"""
SOUTH_ERROR_MESSAGE = """\n
For South support, customize the SOUTH_MIGRATI... | 0x07Ltd/django-condition-chain | django_condition_chain/migrations/__init__.py | Python | unlicense | 713 |
# -*- coding: UTF-8 -*-
"""
``cd_hit``
------------------------
:Authors: Menachem Sklarz
:Affiliation: Bioinformatics core facility
:Organization: National Institute of Biotechnology in the Negev, Ben Gurion University.
A module for clustering with cd-hit/ch-hit-est:
This module runs both cd-hit and cd-hit-est. T... | bioinfo-core-BGU/neatseq-flow_modules | neatseq_flow_modules/clustering/cd_hit.py | Python | gpl-3.0 | 8,681 |
"""
Copyright 2015-2020 Knights Lab, Regents of the University of Minnesota.
This software is released under the GNU Affero General Public License (AGPL) v3.0 License.
"""
import csv
import os
import re
from collections import defaultdict, Counter
import pandas as pd
from shogun import logger
from shogun.wrappers i... | knights-lab/NINJA-SHOGUN | shogun/aligners/utree_aligner.py | Python | mit | 2,596 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# CREATED:2015-03-25 08:13:01 by Brian McFee <brian.mcfee@nyu.edu>
'''Sox-based deformations'''
import os
import six
import subprocess
import tempfile
import librosa
import json
import pysoundfile as psf
from pkg_resources import resource_filename
from ..base import Bas... | silky/muda | muda/deformers/sox.py | Python | apache-2.0 | 2,603 |
import sys
import platform
import pytest
import numpy as np
# import the c-extension module directly since _arg is not exported via umath
import numpy.core._multiarray_umath as ncu
from numpy.testing import (
assert_raises, assert_equal, assert_array_equal, assert_almost_equal, assert_array_max_ulp
)
# TODO: ... | mhvk/numpy | numpy/core/tests/test_umath_complex.py | Python | bsd-3-clause | 23,067 |
# -*- coding: utf-8 -*-
# filename: lesson_117_if_else.py
import sys
def hello(name):
if name == 'wlad' or name == 'tset':
name = name + '!!!'
print('Hello %s' % (name).capitalize())
else:
name = name + '!'
print('Bey Bey %s' % (name).capitalize())
def main():
hello((sys.a... | Tset-Noitamotua/_learnpython | google-python-class/lesson_117_if_else.py | Python | gpl-2.0 | 376 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""An extensible ASCII table reader and writer.
daophot.py:
Classes to read DAOphot table format
:Copyright: Smithsonian Astrophysical Observatory (2011)
:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)
"""
from __future__ import absolute_import,... | piotroxp/scibibscan | scib/lib/python3.5/site-packages/astropy/io/ascii/daophot.py | Python | mit | 9,785 |
#
# Copyright (C) 2010 - 2012 Red Hat, Inc.
# Red Hat Author(s): Satoru SATOH <ssato@redhat.com>
#
# License: MIT
#
import codecs
import cStringIO as StringIO
import csv
# @see http://docs.python.org/release/2.5.2/lib/csv-examples.html
class UnicodeWriter(object):
"""
A CSV writer which will write rows to CSV... | ssato/python-xls-tools | xlstools/csvx.py | Python | mit | 1,433 |
files = [ "dsp_cores_pkg.vhd" ];
modules = { "local" : [
"multiplier",
"pipeline",
"ce_synch",
"counters_gen",
"cic",
"cordic",
"cordic_iter",
"divider",
"delta_sigma",
"pipeline",
"strob... | lnls-dig/dsp-cores | hdl/modules/Manifest.py | Python | lgpl-3.0 | 430 |
# -*- coding: utf-8 -*-
import logging
import time
from odoo import models
from odoo.http import request
_logger = logging.getLogger(__name__)
class IrHttp(models.AbstractModel):
_inherit = 'ir.http'
@classmethod
def _serve_page(cls):
response = super(IrHttp, cls)._serve_page()
if respon... | ygol/odoo | addons/crm_iap_lead_website/models/ir.py | Python | agpl-3.0 | 2,266 |
import logging
import fmcapi
def test__ip_addresses(fmc):
logging.info("Test IPAddresses. This only returns a full list of IP object types.")
obj1 = fmcapi.NetworkAddresses(fmc=fmc)
logging.info("IPAddresses -->")
result = obj1.get()
logging.info(result)
logging.info("Test IPAddresses done.... | daxm/fmcapi | unit_tests/ip_addresses.py | Python | bsd-3-clause | 325 |
# win32.py - utility functions that use win32 API
#
# Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import ctypes, errno, msvcrt, os, subprocess, random
_kernel32 = ... | hekra01/mercurial | mercurial/win32.py | Python | gpl-2.0 | 17,339 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_maindialog.ui'
#
# Created: Thu Jan 12 14:45:12 2017
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
import resources_rc
try:
_fromUtf8 = QtCore.QStr... | lucacasagrande/qgis2web | ui_maindialog.py | Python | gpl-2.0 | 11,089 |
""" Multicast DNS Service Discovery for Python, v0.12
Copyright (C) 2003, Paul Scott-Murphy
This module provides a framework for the use of DNS Service Discovery
using IP multicast. It has been tested against the JRendezvous
implementation from <a href="http://strangeberry.com">StrangeBerry</a>,
a... | joewalnes/idea-community | plugins/hg4idea/testData/bin/hgext/zeroconf/Zeroconf.py | Python | apache-2.0 | 46,021 |
import ode
#-------------------Enzyme initial condition setup-------------------
# Hexokinase initial condition
Hexokinase_Vmax =
Hexokinase_Rate =
Hexokinase_Km =
Hexokinase_Gamma =
# Phosphoglucoisomerase initial condition
Phosphoglucoisomerase_Vmax =
Phosphoglucoisomerase_Rate =
Phosphoglucoisomerase_Km = ... | imwiththou/PathwayNet | Glucose.Hexokinase/F16P.py | Python | mit | 1,262 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | afaheem88/rally | tests/unit/verification/test_compare2html.py | Python | apache-2.0 | 1,680 |
# coding=utf-8
from splinter import Browser
import unittest
from google.appengine.ext import testbed
browser = Browser()
class StaticPagesTest(unittest.TestCase):
def setUp(self):
global browser
self.tb = testbed.Testbed()
self.tb.activate()
self.tb.init_memcache_stub()
def t... | iandouglas/flask-gae-skeleton | tests/integration/static/test_social_twitter.py | Python | mit | 708 |
# Copyright 2014-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import argparse
import logging
import sys
import pkg_resources
from functools import reduce
# subcommand modules, , add subcommands, internal
from . import version
from ... | bridadan/yotta | yotta/main.py | Python | apache-2.0 | 5,999 |
#!/usr/bin/env python
"""
Helper to generate constructor function for clingo's python API.
Attention: Because this code exists just for code generation and won't run in
production, the functions in this module have been written with the least
amount of effort possible. Always check the generated code!
"""
import sys
... | potassco/clingo | libpyclingo/compile.py | Python | mit | 13,662 |
from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os
import logging
log = logging.getLogger( __name__ )
category_name = 'Test 0470 Tool dependency repository type'
category_description = 'Test script 0470 for changing repository types.'
package_libx11_repository_name = 'package_x11_client_1_5_proto_... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/test/tool_shed/functional/test_0470_tool_dependency_repository_type.py | Python | gpl-3.0 | 17,968 |
# Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import glob
import json
import platform
import traceback
import os
import flask
from flask.ext.socketio import join_room, leave_room
from werkzeug import HTTP_STATUS_CODES
import werkzeug.exceptions
from .conf... | Deepomatic/DIGITS | digits/views.py | Python | bsd-3-clause | 24,369 |
from django.conf.urls import url
from django.http import Http404, HttpResponse
def test_view(request):
if request.method != "GET":
raise Http404()
return HttpResponse("Test view")
def test_view_http401(request):
return HttpResponse("Unauthorized", status=401)
def test_view_that_deletes_is_enab... | ottoyiu/django-cors-headers | tests/urls.py | Python | mit | 627 |
import sys, pygame, math, random
class Ghost():
def __init__(self, name, pos=[0,0]):
if name == "purple":
self.imageliving = pygame.image.load("Ghost/purple.png")
self.imageliving = pygame.transform.scale(self.imageliving,[45,45])
self.maxSpeed = 3
elif name == "... | KRHS-GameProgramming-2015/Manpac | Ghost.py | Python | bsd-2-clause | 4,322 |
# -*- coding: utf-8 -*-
from tests.base import *
from tempfile import NamedTemporaryFile
import tagexpressions
from radish.parser import FeatureParser
from radish.feature import Feature
from radish.scenario import Scenario
from radish.scenariooutline import ScenarioOutline
from radish.scenarioloop import ScenarioLoo... | SamuelYvon/radish | tests/unit/test_parser.py | Python | mit | 41,470 |
# Copyright 2015, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.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 requi... | tomfotherby/tower-cli | tests/test_resources_job.py | Python | apache-2.0 | 16,518 |
# Copyright 2009 Google Inc. Released under the GPL v2
"""This is a convenience module to import all available types of hosts.
Implementation details:
You should 'import hosts' instead of importing every available host module.
"""
from autotest_lib.client.common_lib import utils
import base_classes
Host = utils.imp... | clebergnu/autotest | client/common_lib/hosts/__init__.py | Python | gpl-2.0 | 435 |
# File: etl.py
# Purpose: To do the `Transform` step of an Extract-Transform-Load.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Thursday 22 September 2016, 03:40 PM
def transform(words):
new_words = dict()
for point, letters in words.items():
for letter in letters:
... | amalshehu/exercism-python | etl/etl.py | Python | mit | 382 |
### Join images (XOR)
import cv2
from . import print_image
def logical_xor(img1, img2, device, debug=False):
# Join two images using the bitwise XOR operator
# img1, img2 = image objects, grayscale
# device = device number. Used to count steps in the pipeline
# debug = True/False. If True, print image
devic... | dlebauer/plantcv | lib/plantcv/logical_xor.py | Python | gpl-2.0 | 460 |
str = "INSERT INTO user (name) VALUES ('a');"
mysql.query_db(str)
| jiobert/python | Gildner_Tyler/Assignments/flask_mysql copy/insert.py | Python | mit | 66 |
#!/usr/bin/env python
from __future__ import print_function, division
import xml.etree.ElementTree as ET
import glob
import sys
import re
import os
import os.path
import argparse
import subprocess
import shutil
desc= """run tests"""
def warn(*objs):
print(*objs, file=sys.stderr)
dirRe = re.compile("\$dir")
outdi... | chemalot/chemalot | test/runTests.py | Python | apache-2.0 | 5,533 |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.random import random
from numpy.testing import (
run_module_suite, assert_array_almost_equal, assert_array_equal,
assert_raises,
)
import threading
import sys
if sys.version_info[0] >= 3:
import q... | Ziqi-Li/bknqgis | numpy/numpy/fft/tests/test_fftpack.py | Python | gpl-2.0 | 7,097 |
import sys
header = True
ROI = sys.argv[1:]
if 'AllROI' in ROI:
ROI.pop(ROI.index('AllROI'))
for i in range(len(ROI)):
ROI[i] = 'bold' + ROI[i]
ROI_cols = []
for line in sys.stdin:
row = line.strip().split()
if header:
for h in row:
if h in ROI:
ROI_cols.append(row.... | modelblocks/modelblocks-release | resource-fmri/scripts/averageROI.py | Python | gpl-3.0 | 559 |
import chess
from chess import uci
from sys import argv, exit
usage = "usage engine1 engine2"
if len(argv) < 3:
print usage
exit(1)
engine1, engine2 = None, None
try:
engine1, engine2 = uci.popen_engine(argv[1]), uci.popen_engine(argv[2])
engine1.uci()
engine2.uci()
engine1.info_handlers.append(u... | bpachev/Katyusha | engine_play.py | Python | gpl-3.0 | 1,410 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Repute.node'
db.add_column(u'repute', 'node', self.gf('django.db.models.fie... | CLLKazan/iCQA | qa-engine/forum/migrations/0017_auto__add_field_repute_node__add_field_repute_canceled.py | Python | gpl-3.0 | 27,043 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Post'
db.delete_table(u'app_post')
# Adding model 'SimilarBand'
db.create... | amagnus/pulsegig | app/migrations/0008_auto__del_post__add_similarband__del_field_guy_zipcode.py | Python | mit | 8,203 |
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
# Copyright 2013-2014 Sebastian Werner
#
import os
import jasy
import jasy.core.Console as Console
from jasy.item.Script import ScriptError
from jasy.item.Script import ScriptItem
import jasy.script.Resolver as ScriptResolver
from jasy.script.Resolve... | sebastian-software/jasy | jasy/build/Script.py | Python | mit | 9,074 |
# This file is part of Buildbot. Buildbot 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.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/test/unit/test_process_buildrequest.py | Python | gpl-3.0 | 14,362 |
from pymongo import MongoClient
import json
client = MongoClient("mongodb://localhost")
db = client.echo
def load_tags(tag_data):
tag_coll = db.tag
tag_coll.delete_many({})
for tag in tag_data:
tag_coll.insert_one(tag)
if __name__ == '__main__':
data_file = open('init_data.json', 'r')
da... | ideaworld/Echo | Echo_Backend/load_data.py | Python | mit | 387 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import skimage
import skimage.morphology
from skimage import io
import matplotlib.pyplot as plt
def plot_comparison(original, filtered, filter_name):
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4), sharex=True, sharey=True)
ax1.imshow(original, cmap=plt.cm.gray)... | sangwook236/general-development-and-testing | sw_dev/python/rnd/test/image_processing/skimage/skimage_morphology.py | Python | gpl-2.0 | 7,583 |
"""Fields useful for edX API implementations."""
from rest_framework.serializers import Field, URLField
class ExpandableField(Field):
"""Field that can dynamically use a more detailed serializer based on a user-provided "expand" parameter.
Kwargs:
collapsed_serializer (Serializer): the serializer to us... | Learningtribes/edx-platform | openedx/core/lib/api/fields.py | Python | agpl-3.0 | 2,163 |
from flask_babel import gettext
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SelectField
from wtforms.validators import InputRequired, Email, EqualTo, URL, \
ValidationError
class Length(object):
def __init__(self, min=-1, max=-1, message=None):
self.min = min
... | NemoNessuno/SecretSanta | forms.py | Python | mit | 2,858 |
# -*- coding: utf-8 -*-
"""Module for converting the Abaqus mesh format."""
# Copyright (C) 2012 Arve Knudsen and Garth N/ Wells
#
# This file is part of DOLFIN.
#
# DOLFIN 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 ... | FEniCS/dolfin | site-packages/dolfin_utils/meshconvert/abaqus.py | Python | lgpl-3.0 | 16,272 |
# -*- coding: utf-8 -*-
# Copyright 2015 Spanish National Research Council
# Copyright 2015 LIP - INDIGO-DataCloud
#
# 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.... | LIP-Computing/occi-net | ooi/api/helpers.py | Python | apache-2.0 | 38,225 |
#Stanley Zheng
#CS495/595 Assignment 1
#Q2 Parse and grab scores from ESPN website
#usage python ./q2.py team time website
#sources
#using .encode('utf-8') to solve ascii errors
#http://stackoverflow.com/questions/9942594/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-20
#Hany ~ office hours ... | 0111001101111010/cs595-f13 | assignment1/q2/q2.py | Python | mit | 1,437 |
#!/usr/bin/python
#XML remote connector(version 1.0)-Python based xml server for remote services
# Copyright (C) 2015 Shubham Dubey
#
# 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 ver... | shubham0d/XML-Remote-Connector | xmlclient.py | Python | gpl-2.0 | 10,117 |
#
# as_component_test.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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... | kperun/nestml | tests/as_component_test.py | Python | gpl-2.0 | 2,988 |
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | huaweiswitch/neutron | neutron/db/migration/alembic_migrations/env.py | Python | apache-2.0 | 2,972 |
# -*- coding: utf-8 -*-
import json
import logging
import requests
from requests.exceptions import ConnectionError, HTTPError
from .errors import RequestError, NotFoundError
from .services import (CustomerService, InvoiceService, DraftService,
TaxService)
logger = logging.getLogger('pydebitoor... | idlead/pydebitoor | pydebitoor/client.py | Python | mit | 7,309 |
from setuptools import setup
from codecs import open
from os import path
def readme():
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
return f.read()
__version__ = None
exec(open('glpi/version.py').read())
setup(
name='glpi',
pac... | mtulio/glpi-sdk-python | setup.py | Python | apache-2.0 | 788 |
from setuptools import setup
setup(name='libhpc-cf',
version='0.4',
description='Libhpc coordination forms and components library',
url='https://www.github.com/london-escience/libhpc-cf',
author='Jeremy Cohen',
author_email='jeremy.cohen@imperial.ac.uk',
license='BSD 3-Clause',
... | london-escience/libhpc-cf | setup.py | Python | bsd-3-clause | 435 |
"""Microscoper is a wrapper around bioformats using a forked
python-bioformats to extract the raw images from Olympus IX83
CellSense .vsi format, into a more commonly used TIFF format.
Images are bundled together according to their channels.
This code is used internally in SCB Lab, TCIS, TIFR-H.
You're free to modify... | pskeshu/microscoper | microscoper/io.py | Python | mit | 6,962 |
from django.core.management.base import NoArgsCommand, CommandError
from django.db import transaction
from orm.models import Build
from bldcontrol.bbcontroller import getBuildEnvironmentController, ShellCmdException, BuildSetupException
from bldcontrol.models import BuildRequest, BuildEnvironment, BRError
import os
cl... | wwright2/dcim3-angstrom1 | sources/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py | Python | mit | 3,297 |
##
# wrapping: A program making it easy to use hyperparameter
# optimization software.
# Copyright (C) 2013 Katharina Eggensperger and Matthias Feurer
#
# 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 Found... | claesenm/HPOlib | tests/unittests/test_experiment.py | Python | gpl-3.0 | 10,618 |
# -*- coding: utf-8 -*-
# © 2014-2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, fields, models
from openerp.exceptions import UserError
class CleanupPurgeLineMenu(models.TransientModel):
_inherit = 'cleanup.purge.line'
_name = '... | be-cloud-be/horizon-addons | server-tools/database_cleanup/models/purge_menus.py | Python | agpl-3.0 | 1,704 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# License: MIT. See LICENSE
# import frappe
from frappe.model.document import Document
class WebsiteThemeIgnoreApp(Document):
pass
| frappe/frappe | frappe/website/doctype/website_theme_ignore_app/website_theme_ignore_app.py | Python | mit | 217 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2015 Douglas Blank <doug.blank@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 2 of the License, o... | beernarrd/gramps | gramps/plugins/db/bsddb/bsddb.gpr.py | Python | gpl-2.0 | 1,293 |
def _safeFormat(value):
try:
return '{value:.1f}'.format(value=float(value))
except ValueError:
return '{}'.format(value)
def formatValues(status):
values = []
if len(status) == 1:
value = list(status.values())[0]
return _safeFormat(value)
for key, value in status.i... | scylladb/scylla | tools/scyllatop/views/helpers.py | Python | agpl-3.0 | 439 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# 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
import sys
imp... | pilou-/ansible | test/units/module_utils/test_vmware.py | Python | gpl-3.0 | 4,952 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/tantan/package.py | Python | lgpl-2.1 | 1,699 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Widiot/simpleblog | venv/lib/python3.5/site-packages/selenium/webdriver/common/actions/interaction.py | Python | mit | 1,300 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Same:
def checkSam(self, stringA, stringB):
# write code here
setA = sorted(stringA)
setB = sorted(stringB)
if setA == setB:
return True
return False
if __name__ == '__main__':
s = Same()
print s.check... | ZenQ3/Data-Structures | algorithms/string/checkSam.py | Python | mit | 363 |
import py
import sys
import weakref
import struct
import os
import platform
from rpython.rlib import jit
from rpython.tool.udir import udir
from rpython.tool.version import rpythonroot
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.ji... | oblique-labs/pyVM | rpython/rlib/rjitlog/rjitlog.py | Python | mit | 21,183 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Jocelyn Jaubert
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the... | laurentb/weboob | modules/societegenerale/test.py | Python | lgpl-3.0 | 1,120 |
from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^admin/apps/tinymce/', include('tinymce.urls')),
url(r'^admin/apps/tags/', include('taggit_autosuggest.urls')),
url(r'^admin/', admin.site.urls),
url(r'^comments/', include('fluent_com... | edoburu/django-fluent-blogs | example/example_fluent_comments/urls.py | Python | apache-2.0 | 435 |
from PyQt5 import QtGui
from PyQt5.Qt import Qt
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QLabel, QGridLayout
from GUI import gui_scale
from PyDesignGUI.PyDesignStyleSheets import get_stylesheet
__author__ = 'mamj'
class RibbonPane(QWidget):
def __init__(self, parent, name):
QWidget.... | pracedru/pyDesign | GUI/RibbonPane.py | Python | mit | 2,389 |
#!/usr/bin/env python
#
# Sidebar.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; w... | amohanta/thug | src/DOM/Sidebar.py | Python | gpl-2.0 | 1,718 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.