code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Zuza Software Foundation
#
# This file is part of Virtaal.
#
# 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 ... | elric/virtaal-debian | virtaal/controllers/unitcontroller.py | Python | gpl-2.0 | 10,352 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | crossbario/autobahn-python | examples/twisted/websocket/multiproto/client.py | Python | mit | 2,469 |
from gi.repository import Gtk
from plugin_base.provider import FileType, Mode
from plugin_base.find_extension import FindExtension
class ContentsFindFiles(FindExtension):
"""Extension for finding specified contents in files"""
def __init__(self, parent):
FindExtension.__init__(self, parent)
# connect notify s... | cmallwitz/Sunflower | application/plugins/find_file_extensions/contents.py | Python | gpl-3.0 | 1,824 |
from django.conf.urls import url
from oioioi.oisubmit import views
app_name = 'oisubmit'
contest_patterns = [
url(r'^oisubmit/$', views.oisubmit_view, name='oisubmit'),
]
| sio2project/oioioi | oioioi/oisubmit/urls.py | Python | gpl-3.0 | 178 |
import unittest
from tests.server import TestServer
from vscphelper.exception import *
from vscphelper.websocket import websocket, answer
from vscphelper import VSCPConstant as const
from time import sleep
import logging
class createAnswer:
def __init__(self, message):
self.is_binary = False
self.d... | nos86/VSCP-Helper-for-Python | tests/test_websocket.py | Python | mit | 2,509 |
from django.http import HttpResponse
from polls.models import Poll
from django.template import RequestContext
from pyjade.ext.django.loader import Loader
from django.shortcuts import render, get_object_or_404
from django.views.generic import ListView, DetailView
from editor.models import Object, Job
class ObjectList(... | debben/RepPREP | editor/views.py | Python | lgpl-3.0 | 602 |
from flask import Flask, request, session, send_from_directory, render_template
from flask import Blueprint
import api
from api.common import WebSuccess, WebError
from api.annotations import api_wrapper, require_login, require_teacher, require_admin, check_csrf
from api.annotations import block_before_competition, blo... | IceCTF/ctf-platform | api/api/routes/stats.py | Python | mit | 2,064 |
#!/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.
"""
IDLNamespace for PPAPI
This file defines the behavior of the AST namespace which allows for resolving
a symbol as one or more ... | blackenough/mediaAdapter | ppapitest/sdk/ppapi/generators/idl_namespace.py | Python | gpl-3.0 | 7,357 |
'''
Created by auto_sdk on 2012.10.17
'''
from top.api.base import RestApi
class FenxiaoOrderRemarkUpdateRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.purchase_order_id = None
self.supplier_memo = None
self.supplier_memo_flag = None
... | colaftc/webtool | top/api/rest/FenxiaoOrderRemarkUpdateRequest.py | Python | mit | 393 |
from chainer import function
class Reshape(function.Function):
"""Reshapes an input array without copy."""
def __init__(self, shape):
self.shape = shape
def forward(self, x):
return x[0].reshape(self.shape),
def backward(self, x, gy):
return gy[0].reshape(x[0].shape),
def... | tereka114/chainer | chainer/functions/reshape.py | Python | mit | 644 |
#!/home/vagrant/miniconda3/bin/python
import pexpect
p = pexpect.spawn("./get_tok.py")
print("Expecting Name:")
p.expect("Name:")
p.sendline("Shantnu")
print("Expecting Age:")
p.expect("Age:")
p.sendline("16")
print("Expecting token:")
p.expect("Your token is:")
print(p.readline())
p.expect(pexpect.EOF) | shantnu/Python-Awesome-Job | ch02/pexcept_ex.py | Python | agpl-3.0 | 311 |
# -*- coding: UTF-8 -*-
# date: 30.08.2014 13:39:12
#
LANG_TEXT = {
"it_IT": {
"T1": "Selezionare la propria lingua utilizzando i tasti Sù/Giù. Premere OK per confermare.",
"T2": "Selezione lingua",
"T3": "Annull.",
"T4": "Salvare",
},
"en_GB": {
"T1": "Please use the UP and DOWN keys to select your languag... | trunca/enigma2 | lib/python/Components/Language_cache.py | Python | gpl-2.0 | 7,720 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# Copyright (c) 2013 Hewlett-Pa... | rajalokan/nova | nova/virt/libvirt/guest.py | Python | apache-2.0 | 38,072 |
import shutil
import os, errno
import hashlib
import tempfile
import math
import urllib
import urllib2
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest, QueryDict
from django.shortcuts import render_to_response, get_object_or_404, redirect, render
from django.template import Context, ... | blackball/an-test6 | net/views/album.py | Python | gpl-2.0 | 4,432 |
#!/usr/bin/env python3
#
# Unix SMB/CIFS implementation.
#
# Utility methods for generating error codes from a file.
#
# Copyright (C) Noel Power <noel.power@suse.com> 2014
# Copyright (C) Catalyst IT Ltd. 2017
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gen... | kernevil/samba | source4/scripting/bin/gen_error_common.py | Python | gpl-3.0 | 2,850 |
"""
Test create_site_configuration management command
"""
import json
from django.contrib.sites.models import Site
from django.core.management import call_command
from django.test import TestCase
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
class TestCreateSiteConfiguration(TestCas... | ESOedX/edx-platform | openedx/core/djangoapps/site_configuration/management/commands/tests/test_create_site_configuration.py | Python | agpl-3.0 | 1,800 |
# -*- coding: utf-8 -*-
#
# allantools documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 3 14:39:58 2015.
#
# 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.
#
... | telegraphic/allantools | docs/conf.py | Python | gpl-3.0 | 9,830 |
# Copyright (c) 2005 Nokia Corporation
#
# 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... | flyher/pymo | symbian/app.py | Python | mit | 208,550 |
# Copyright 2022 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from .abstract_mandate import DEFAULT_RETROCESSION_MODE
class StaMandate(models.Model):
_inherit = "sta.mandate"
retrocession_mode = fields.Selection(
required=True,
... | mozaik-association/mozaik | mozaik_retrocession_mode/models/sta_mandate.py | Python | agpl-3.0 | 363 |
"""
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 this ... | arenadata/ambari | ambari-server/src/main/resources/stacks/ADH/1.0/services/FLUME/package/scripts/flume_check.py | Python | apache-2.0 | 1,830 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... | NiclasEriksen/py-towerwars | src/pyglet/font/fontconfig.py | Python | cc0-1.0 | 11,188 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | rnirmal/openstack-dashboard | django-openstack/django_openstack/tests/view_tests/dash/container_tests.py | Python | apache-2.0 | 4,373 |
from flask import Flask
from flask.ext.pymongo import PyMongo
from flask.ext.restful import Api
from calabaza.calabaza_auth import CalabazaAuth
from calabaza.modules.calabaza_game import calabaza_game
from calabaza.modules.mongoKit import *
app = Flask(__name__)
api = Api(app)
mongo = PyMongo(app)
game = calabaza_ga... | Eibriel/Calabaza | server/calabaza/__init__.py | Python | gpl-2.0 | 1,549 |
from direct.wxwidgets.WxAppShell import *
import os, re, shutil
import ObjectGlobals as OG
CLOSE_STDIN = "<CLOSE STDIN>"
class StartupError(Exception):
pass
class Process:
def __init__(self, parent, cmd, end_callback):
self.process = wx.Process(parent)
self.process.Redirect()
self.pro... | mgracer48/panda3d | direct/src/leveleditor/MayaConverter.py | Python | bsd-3-clause | 7,225 |
# coding=utf-8
from bottle import Bottle, HTTPError
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.orm import joinedload
import model
from utils import jsonplugin
import auth
app = Bottle()
app.install(model.plugin)
app.install(jsonplugin)
@app.get('/<id:int>')
@auth.require_login
def read_one(db, us... | spktklr/kansalaisrajoite | python/vote.py | Python | agpl-3.0 | 1,105 |
#!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('compat',parent_package,top_path)
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(configuration=c... | beiko-lab/gengis | bin/Lib/site-packages/numpy/compat/setup.py | Python | gpl-3.0 | 335 |
#!/usr/bin/env python
#
# Copyright (c) 2014, Kleydson Stenio (ninloth@gmail.com)
# 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 copy... | shugaa/estrella | python_controller/estrella_classes/structs.py | Python | bsd-3-clause | 4,628 |
#!/usr/bin/env python
import sys
import os
os.chdir(sys.argv[1] or ".")
args = ['-Wall', '-lua', '-c++']
os.system("swig %s -Ipackages -o wrappers/lua_grind_wrap.cxx packages/lua_grind.i" % ' '.join(args))
| amireh/grind | src/bindings/SWIG/generate_wrappers.py | Python | mit | 210 |
"""IMAP4 client.
Based on RFC 2060.
Public class: IMAP4
Public variable: Debug
Public functions: Internaldate2tuple
Int2AP
ParseFlags
Time2Internaldate
"""
# Author: Piers Lauder <piers@cs.su.oz.au> December 1997.
#
# Auth... | kenshay/ImageScript | Script_Runner/PYTHON/Lib/imaplib.py | Python | gpl-3.0 | 53,027 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | MobinRanjbar/hue | desktop/core/src/desktop/models.py | Python | apache-2.0 | 49,607 |
from __future__ import unicode_literals
from django.core.management import call_command
from django_evolution import models as django_evolution
from reviewboard.diffviewer.models import FileDiff
def init_evolutions(app, created_models, **kwargs):
"""
Attempts to initialize the Django Evolution schema signat... | 1tush/reviewboard | reviewboard/admin/management/evolutions.py | Python | mit | 2,662 |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def flipMatchVoyage(self, root: TreeNode, voyage: List[int]) -> List[int]:
result = []
i = 0
def dfs(root):
if ... | jiadaizhao/LeetCode | 0901-1000/0971-Flip Binary Tree To Match Preorder Traversal/0971-Flip Binary Tree To Match Preorder Traversal.py | Python | mit | 734 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ==============================================================================
# File: file.py
# Author: Cashiuus
# Created: 09-Feb-2022 - Revised:
#
# Depends: n/a
# Compat: 3.7+
#
#-[ Usage ]----------------------------------------... | Cashiuus/penprep | templates/geany/main.py | Python | mit | 11,478 |
from paddle.trainer_config_helpers import *
settings(batch_size=1000, learning_rate=1e-5)
num_channels = 3
filter_size = 3
filter_size_y = 3
filter_size_z = 3
stride = 2
stride_y = 2
stride_z = 2
padding = 1
padding_y = 1
padding_z = 1
groups = 1
data = data_layer(
name='data', size=12096 * num_channels, height=... | hedaoyuan/Paddle | python/paddle/trainer_config_helpers/tests/configs/test_deconv3d_layer.py | Python | apache-2.0 | 1,107 |
import re
from datetime import datetime
from django.http import HttpResponseServerError, HttpResponseRedirect, HttpResponseBadRequest, HttpResponseNotAllowed
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.template import RequestCo... | andbof/plantdb | plant/views.py | Python | gpl-2.0 | 8,112 |
import select, time, queue
# import electrum
from electrum import Connection, Interface, SimpleConfig
from electrum.network import parse_servers
from collections import defaultdict
# electrum.util.set_verbosity(1)
def get_interfaces(servers, timeout=10):
'''Returns a map of servers to connected interfaces. If an... | romanz/electrum | scripts/util.py | Python | mit | 3,031 |
#!/usr/bin/env python
from ddpg import *
import rospy
import numpy as np
from geometry_msgs.msg import PoseArray as PA
from geometry_msgs.msg import Vector3
from geometry_msgs.msg import PoseStamped as PS
from soft_arm.srv import *
from sensor_msgs.msg import PointCloud as PC
from geometry_msgs.msg import Point
import... | ZhiangChen/soft_arm | src/training2.py | Python | mit | 8,026 |
import sys
import re
class InstallerIO:
"""
chorus installer io class
"""
def __init__(self, silent=False):
self.silent = silent
def prompt(self, msg, default=None):
while True:
sys.stdout.write(msg + " [default=\'%s\']:" % str(default))
if not self.sile... | prakash-alpine/chorus | packaging/setup/installer_io.py | Python | apache-2.0 | 3,373 |
#!/usr/bin/env python3
# Quantopian, Inc. licenses this file to you 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 ... | quantopian/PenguinDome | client/plugins/sshd.py | Python | apache-2.0 | 2,713 |
from __future__ import absolute_import, division, print_function
import sys
__all__ = ['PY3', 'b', 'basestring_', 'bytes', 'next', 'is_unicode',
'iteritems']
PY3 = True if sys.version_info[0] == 3 else False
if sys.version_info[0] < 3:
def next(obj):
return obj.next()
def iteritems(d, ... | DailyActie/Surrogate-Model | 01-codes/numpy-master/tools/npy_tempita/compat3.py | Python | mit | 1,098 |
# This file is part of twitterscraper.
# Architype is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Architype is distributed in... | squeakus/twitterscraper | twitterstream.py | Python | lgpl-3.0 | 2,794 |
#!/usr/bin/python
import unittest
from assignment_6 import min_index, selection_sort, partitions
from assignment_6 import my_row, my_col, dot_product
class Test_Assignment_6(unittest.TestCase):
def setup(self):
pass
def test_min_index(self):
case_1 = [2, [3, 5, 1, 8, 9, 2]]
case_2 = ... | rfolk/CS-471 | Python/test_assignment_6.py | Python | bsd-2-clause | 3,016 |
# Copyright 2014-2018 The PySCF Developers. 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 appl... | gkc1000/pyscf | pyscf/nao/m_dens_elec_vec.py | Python | apache-2.0 | 1,396 |
'''Trains a Siamese MLP on pairs of digits from the MNIST dataset.
Get 96.7% accuracy on test data after 20 epochs training.
For more details, see the reference paper.
# References
- Dimensionality Reduction by Learning an Invariant Mapping
http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
'''
... | zsdonghao/tensorlayer | examples/basic_tutorials/tutorial_mnist_siamese.py | Python | apache-2.0 | 4,566 |
#!/usr/bin/python
from pisi.actionsapi import shelltools, get, autotools, pisitools
def setup():
autotools.configure ("--prefix=/usr\
--disable-static")
def build():
autotools.make ()
def install():
autotools.rawInstall ("DESTDIR=%s" % get.installDIR())
pisitools.dodoc ... | richard-fisher/repository | system/base/libffi/actions.py | Python | gpl-2.0 | 355 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("name", "0013_add_dbtemplates_types"),
)
def forwards(self, orm):
# Adding model 'ReminderDates'
d... | mcr/ietfdb | ietf/nomcom/migrations/0001_initial.py | Python | bsd-3-clause | 33,374 |
# Copyright 2010-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | mongodb/mongo-python-driver | bson/timestamp.py | Python | apache-2.0 | 4,225 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "abilis.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| archerelf/abilis | manage.py | Python | gpl-3.0 | 249 |
#! /usr/bin/env python
from setuptools import setup, Command
from subprocess import check_call
from distutils.spawn import find_executable
import cpplint as cpplint
class Cmd(Command):
'''
Superclass for other commands to run via setup.py, declared in setup.cfg.
These commands will auto-install setup_requ... | stan-dev/math | lib/cpplint_1.4.5/setup.py | Python | bsd-3-clause | 3,003 |
from intermol.decorators import *
class TorsionTorsionCMAP(object):
@accepts_compatible_units(None, None, None, None, None, None, None, None, None, None)
def __init__(self, atom1, atom2, atom3, atom4, atom5, atom6, atom7, atom8, type, chart):
"""
"""
self.type = type
self.atom1... | mrshirts/InterMol | intermol/forces/torsion_torsion_cmap.py | Python | mit | 707 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012 - 2013
# Matías Herranz <matiasherranz@gmail.com>
# Joaquín Tita <joaquintita@gmail.com>
#
# https://github.com/PyRadar/pyradar
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... | PyRadar/pyradar | pyradar/utils/sar_debugger.py | Python | lgpl-3.0 | 1,335 |
import matplotlib.image as mpimg
import cv2
import os
import detectClass
def testImages():
test_images = os.listdir("../test_images/")
try:
processed_images = os.listdir("../test_images/processed_images/")
except FileNotFoundError:
print("File not found")
x = detectClass.Detect()
... | swirlingsand/self-driving-car-nanodegree-nd013 | p5-car-detection/project/methods/tests.py | Python | mit | 1,309 |
from pprint import pprint
from pyroute2 import IPDB
ip = IPDB()
# create an interface
i = ip.create(kind='dummy', ifname='pr2test').commit()
prev_state = i.nlmsg
# change the state
i.address = '00:11:22:33:44:55'
i.up()
i.commit()
# show, what has been changed, excluding statistics --
# it changes all the time
ppri... | jazzmes/pyroute2 | examples/nla_operators2.py | Python | gpl-2.0 | 613 |
#!/usr/bin/env python
""" Main program to run pySPACE
For further instructions take a look at the pySPACE documentation and the tutorials
in there!
.. note::
Due to errors in configuration files, data or the software, the software may
crash. Because of internal parallelization and threading, it is currently
... | pyspace/test | pySPACE/run/launch.py | Python | gpl-3.0 | 15,340 |
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__author__ = "d01"
__email__ = "jungflor@gmail.com"
__copyright__ = "Copyright (C) 2016, Florian JUNG"
__license__ = "MIT"
__version__ = "0.1.0"
_... | the01/python-paps | examples/measure/echo_server.py | Python | mit | 1,803 |
# Copyright (c) 2018 PaddlePaddle 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 app... | Canpio/Paddle | python/paddle/fluid/tests/unittests/test_assign_value_op.py | Python | apache-2.0 | 1,867 |
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants, Player
from django.http import HttpResponse, HttpResponseRedirect
import re
#######################
# Animation toggling
#######################
def set_anim(request, sessioncode, participantlabel):... | anthropo-lab/XP | activecitizenship_project/PSE/pages.py | Python | gpl-3.0 | 19,726 |
#!/usr/bin/python
#
# Copyright 2012 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 b... | krux/adspygoogle | examples/adspygoogle/dfp/v201208/create_orders.py | Python | apache-2.0 | 1,978 |
# Copyright (c) 2017-2019 Serpent-Tools developer team, GTRC
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDER... | CORE-GATECH-GROUP/serpent-tools | examples/nodal_writer.py | Python | mit | 7,618 |
import numbers
import numpy as np
import pandas as pd
import scprep
from scipy import sparse
try:
import anndata
except (ImportError, SyntaxError):
# anndata not installed
pass
def check_positive(**params):
"""Check that parameters are positive as expected
Raises
------
ValueError : unac... | pkathail/magic | python/magic/utils.py | Python | gpl-2.0 | 5,366 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | jaddison/ansible | lib/ansible/executor/task_executor.py | Python | gpl-3.0 | 23,169 |
#Faça um algoritmo para ler a idade de 5 pessoas e informar qual foi a maior idade informada
m=0
i1=int(input("Digite uma idade: "))
if(i1>m):
m=i1
i2=int(input("Digite uma idade: "))
if(i2>m):
m=i2
i3=int(input("Digite uma idade: "))
if(i3>m):
m=i3
i4=int(input("Digite uma idade: "))
if(i4>... | erikaklein/algoritmo---programas-em-Python | Idade5PessoaseInformarMaiorIdade.py | Python | mit | 416 |
from testcases_base import TestcasesBase
import os, random, pytoml, unittest, uuid
from js9 import j
class TestJSTATE(TestcasesBase):
@classmethod
def get_state(cls):
with open(cls.state_path, 'r') as f:
content = pytoml.load(f)
return content
@classmethod
def reset_state(... | Jumpscale/core9 | tests/jumpscale_test/test02_j_state.py | Python | apache-2.0 | 9,450 |
from __future__ import division
import math
import torch
import torch.nn as nn
# this is one block for a resnet
class Residual(nn.Module):
def __init__(self, n_channels=64):
super(Residual, self).__init__()
self.n_channels = n_channels
self.conv1 = nn.Conv2d(in_channels=self.n_channels,... | krottmann/PyTorch-SRGAN | model.py | Python | apache-2.0 | 4,202 |
# -*- coding: utf-8 -*-
'''
Created on Nov 14, 2014
Adapters to handspeed segmentation
@author: Arturo Curiel
'''
import zope.interface as zi
import zope.component as zc
import pandas as pd
import numpy as np
from nixtla.tracking.text_based.markers import ITextBasedTracker
from nixtla.segmentation.handspeed_based.... | acuriel/Nixtla | nixtla/segmentation/handspeed_based/adapters.py | Python | gpl-2.0 | 3,861 |
import re
def parse_xml(xmltree, index_tag):
'''
Parse -x xml output for various commands
:param xml.etree.ElementTree.Element xmltree: etree xml from pbsnodes -x
:param str index_tag: tag to index dictionary elements by
:return: dict of {index_tag: {attr1:val,}}
'''
nodes = {}
for nod... | VDBWRAIR/pypbs | pypbs/pbsxml.py | Python | gpl-2.0 | 2,630 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('DrydenMusicApp', '0004_auto_20160824_2150'),
]
operations = [
migrations.CreateModel(
name='teaching_link',
... | jdovi/drydenmusic | DrydenMusicApp/migrations/0005_teaching_link.py | Python | gpl-3.0 | 1,017 |
# -*- coding: utf-8 -*-
import re
import sys
import vcf
from genestack.bio import bio_meta_keys
from genestack.genestack_indexer import Indexer
from genestack.genestack_exceptions import GenestackException
from genestack.bio.reference_genome.reference_genome_file import ReferenceGenome
from genestack.metainfo import... | genestack/task-library | genestack/bio/variation/variation_indexer.py | Python | mit | 16,269 |
"""
Copyright 2011-2012 Kyle Lancaster
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in ... | Sakartu/simplekml | simplekml/region.py | Python | gpl-3.0 | 8,410 |
"""
Utility library used by build tools.
"""
VERSION = '1.6.3'
from typing import Callable, Iterable, Any
from textwrap import TextWrapper
import os
import sys
from itertools import dropwhile
from typing import Optional, NoReturn, Generator
import itertools
from contextlib import contextmanager
__all__ = ['all_pred'... | bmc/build-tooling | db_edu_util/__init__.py | Python | apache-2.0 | 8,946 |
class Role(object):
def __init__(self, d):
super(Role, self).__init__()
self.__dict__ = d
| michimussato/pypelyne2 | pypelyne2/src/modules/role/role.py | Python | gpl-2.0 | 110 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Aliases to ease access to jsonrpclib classes
:authors: Josh Marshall, Thomas Calmant
:copyright: Copyright 2015, isandlaTech
:license: Apache License 2.0
:version: 0.2.4
..
Copyright 2015 isandlaTech
Licensed under the Apache License, Version 2.0 (the "L... | scith/htpc-manager_ynh | sources/libs/jsonrpclib/__init__.py | Python | gpl-3.0 | 1,168 |
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False
from __future__ import absolute_import
import json
import logging
from multiprocessing.dummy import Pool
from pip._vendor import six
from pip._vendor.requests.adapters import DEFAULT_POOLSIZE
from pip._interna... | mdworks2016/work_development | Python/20_Third_Certification/venv/lib/python3.7/site-packages/pip/_internal/commands/list.py | Python | apache-2.0 | 10,511 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness, PyAPITestHarness
import openmc
class ScoreTotalTestHarness(PyAPITestHarness):
def _build_inputs(self):
filt = openmc.Filter(type='cell', bins=(10, 21, 22, 23))
tallies = [openmc.Tally... | kellyrowland/openmc | tests/test_score_total/test_score_total.py | Python | mit | 1,040 |
MONGODB_SETTINGS = {
'HOST': 'localhost',
'PORT': 27017,
'DB': 'MongoHN',
}
| bsandrow/MongoHN | MongoHN/config.py | Python | mit | 100 |
#
# The Qubes OS Project, https://www.qubes-os.org/
#
# Copyright (C) 2015 Joanna Rutkowska <joanna@invisiblethingslab.com>
# Copyright (C) 2015 Wojtek Porczyk <woju@invisiblethingslab.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... | QubesOS/qubes-core-admin | qubes/tools/__init__.py | Python | lgpl-2.1 | 19,598 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl
from . import models
| factorlibre/l10n-spain | l10n_es_aeat_mod390/__init__.py | Python | agpl-3.0 | 84 |
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
import lutin.macro as macro
def get_type():
return "LIBRARY"
#return "BINARY"
def get_sub_type():
return "TOOLS"
def get_desc():
return "ZEUS test service1"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "com"
def... | atria-soft/zeus | test/service1/lutin_zeus-service-test-service1.py | Python | apache-2.0 | 734 |
#! /usr/bin/python
import os
import sys
import tempfile
base = os.path.splitext (os.path.split (sys.argv[1])[1])[0]
input = os.path.abspath (sys.argv[1])
output = os.path.abspath (sys.argv[2])
program_name = os.path.split (sys.argv[0])[1]
print program_name
dir = tempfile.mktemp (program_name)
os.mkdir (dir, 0777)
o... | janneke/schikkers-list | scripts/genicon.py | Python | agpl-3.0 | 833 |
# pylint: disable=no-self-use,invalid-name
import numpy
from deep_qa.common.params import Params
from deep_qa.data import DataGenerator, IndexedDataset
from deep_qa.testing.test_case import DeepQaTestCase
class TestDataGenerator(DeepQaTestCase):
def setUp(self):
super(TestDataGenerator, self).setUp()
... | allenai/deep_qa | tests/data/data_generator_test.py | Python | apache-2.0 | 6,767 |
# -*- encoding: utf-8 -*-
from abjad import *
from abjad.tools.quantizationtools import *
def test_quantizationtools_QGrid___call___01():
q_grid = QGrid()
a = QEventProxy(SilentQEvent(0, ['A']), 0)
b = QEventProxy(SilentQEvent((1, 20), ['B']), (1, 20))
c = QEventProxy(SilentQEvent((9, 20), [... | mscuthbert/abjad | abjad/tools/quantizationtools/test/test_quantizationtools_QGrid___call__.py | Python | gpl-3.0 | 3,905 |
# encoding: UTF-8
# 默认空值
EMPTY_STRING = ''
EMPTY_UNICODE = u''
EMPTY_INT = 0
EMPTY_FLOAT = 0.0
# 方向常量
DIRECTION_NONE = u'none'
DIRECTION_LONG = u'long'
DIRECTION_SHORT = u'short'
DIRECTION_UNKNOWN = u'unknown'
DIRECTION_NET = u'net'
DIRECTION_SELL = u'sell' # IB接口
DIRECTION_COVEREDSHORT = u'covered short' # 证... | rrrrrr8/vnpy | vnpy/trader/language/english/constant.py | Python | mit | 3,505 |
# Copyright 2015 Christian Aichinger <Greek0@gmx.net>
#
# 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 ... | Grk0/docker-cleanup | docker_cleanup/dates.py | Python | apache-2.0 | 4,122 |
# Copyright 2018 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from functools import partial
from c7n.provider import Provider, clouds
from c7n.registry import PluginRegistry
from c7n.utils import local_session
from .session import Session
from c7n_azure.res... | capitalone/cloud-custodian | tools/c7n_azure/c7n_azure/provider.py | Python | apache-2.0 | 1,171 |
"""
Revision ID: 0157_add_rate_limit_to_service
Revises: 0156_set_temp_letter_contact
Create Date: 2018-01-08 16:13:25.733336
"""
from alembic import op
import sqlalchemy as sa
revision = '0157_add_rate_limit_to_service'
down_revision = '0156_set_temp_letter_contact'
def upgrade():
op.add_column('services', s... | alphagov/notifications-api | migrations/versions/0157_add_rate_limit_to_service.py | Python | mit | 630 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
encode_base_n,
ExtractorError,
int_or_none,
merge_dicts,
parse_duration,
str_to_int,
url_or_none,
)
class EpornerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www... | yan12125/youtube-dl | youtube_dl/extractor/eporner.py | Python | unlicense | 4,539 |
from sakura.common.errors import APIObjectDeniedError
from sakura.client.apiobject.operators import APIOperator
from sakura.client.apiobject.links import APILink
from sakura.client.apiobject.base import APIObjectBase, APIObjectRegistryClass
from sakura.client.apiobject.grants import APIGrants
from sakura.common.streams... | eduble/panteda | sakura/client/apiobject/dataflows.py | Python | gpl-3.0 | 4,014 |
import lldbsuite.test.lldbtest as lldbtest
from builder_base import *
def buildDsym(
sender=None,
architecture=None,
compiler=None,
dictionary=None,
testdir=None,
testname=None):
"""Build the binaries with dsym debug info."""
commands = []
commands.append(g... | endlessm/chromium-browser | third_party/llvm/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py | Python | bsd-3-clause | 648 |
"""Views for items (modules)."""
import hashlib
import logging
from uuid import uuid4
from collections import OrderedDict
from functools import partial
from static_replace import replace_static_urls
from xmodule_modifiers import wrap_xblock
from django.conf import settings
from django.core.exceptions import Permissi... | pku9104038/edx-platform | cms/djangoapps/contentstore/views/item.py | Python | agpl-3.0 | 21,675 |
'''
author: kinkin
'''
import time,datetime
import xbmc
import xbmcaddon
import settings
from datetime import date, timedelta
ADDON = settings.addon()
class AutoUpdater:
def runProgram(self):
self.last_run = 0
while not xbmc.abortRequested:
if settings.enabl... | odicraig/kodi2odi | addons/plugin.video.tv4me/service.py | Python | gpl-3.0 | 1,715 |
import numpy as np
import os
from iri12py import iri_sub as iri12
from iri16py import iri_sub as iri16
from iri16py import read_ig_rz, readapf107
from .constants import DIR_FILE, nan
IONS = ['O+', 'H+', 'HE+', 'O2+', 'NO+']
# Global variable indicating if IRI 2016 has been initialized with the contents
# of the iono... | timduly4/pyglow | src/pyglow/iri.py | Python | mit | 7,646 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError
from odoo.tools import float_is_zero, float_round
class ChangeProductionQty(models.Transient... | maxive/erp | addons/mrp/wizard/change_production_qty.py | Python | agpl-3.0 | 5,916 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from... | magacoin/magacoin | qa/rpc-tests/p2p-mempool.py | Python | mit | 3,262 |
from twisted.internet.defer import succeed
from landscape.lib.sysstats import MemoryStats
class Memory(object):
def __init__(self, filename="/proc/meminfo"):
self._filename = filename
def register(self, sysinfo):
self._sysinfo = sysinfo
def run(self):
memstats = MemoryStats(sel... | CanonicalLtd/landscape-client | landscape/sysinfo/memory.py | Python | gpl-2.0 | 606 |
from enum import Enum
class PenCapStyle(Enum):
"""Styles controlling how pen strokes are capped.
See also http://doc.qt.io/qt-5.9/qt.html#PenCapStyle-enum
"""
SQUARE = 0x10
"""A square cap that extends beyond the end point by half the pen width"""
FLAT = 0x00
"""A square cap that does ... | ajyoon/brown | brown/core/pen_cap_style.py | Python | gpl-3.0 | 401 |
import mysql.connector
from model.config import Config
class Database:
"""
"""
def __init__(self):
self.__conn = None
self.__cursor = None
def start_connection(self):
"""
Initiates a connection to the database.
:return:
"""
self.__conn = mysq... | dita-programming/dita-access | model/database.py | Python | gpl-2.0 | 1,804 |
import logging
from boto3.resources.base import ServiceResource
logger = logging.getLogger(__name__)
class AIOBoto3ServiceResource(ServiceResource):
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
await self.meta.client.close()
return Fa... | terrycain/aioboto3 | aioboto3/resources/base.py | Python | apache-2.0 | 386 |
# -*- coding: utf-8 -*-
# Copyright 2014-2018 The PySCF Developers. 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
#
#... | gkc1000/pyscf | pyscf/pbc/mpitools/mpi_pool.py | Python | apache-2.0 | 5,680 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-27 12:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0004_auto_20160327_1100'),
]
operations = [
migrations.AlterFiel... | Southern-Exposure-Seed-Exchange/Order-Manager-Prototypes | django/products/migrations/0005_auto_20160327_1201.py | Python | gpl-3.0 | 917 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import os
from marmot.features.phrase.token_count_feature_extractor import TokenCountFeatureExtractor
# test a class which extracts source and target token count features, and the source/target token count ratio
class TokenCountFeatureExtractorTests(unittest.... | qe-team/marmot | marmot/features/phrase/tests/test_token_count_feature_extractor.py | Python | isc | 1,945 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.