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 |
|---|---|---|---|---|---|
# third party
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
# relative
from . import Base
class UserEnvironment(Base):
__tablename__ = "userenvironment"
id = Column(Integer(), primary_key=True, autoincrement=True)
user = Column(Integer, ForeignKey("syft_u... | OpenMined/PySyft | packages/syft/src/syft/core/node/common/node_table/user_environment.py | Python | apache-2.0 | 555 |
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt
from time import strftime
class DateTime(QtGui.QDialog):
def __init__(self,parent = None):
QtGui.QDialog.__init__(self, parent)
self.parent = parent
self.formats = ["%A, %d. %B %Y %H:%M",
"%A, %d. %B %Y",... | janusnic/21v-python | unit_15/staff3/ext/datetime.py | Python | mit | 1,546 |
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter(name='pretty_crop')
@stringfilter
def pretty_crop(text, length):
""" Crops text after whole words.
text - text to crop
length - maximum length of cropped text
"""
... | livni/old-OK | src/knesset/auxiliary/templatetags/common_text_handling.py | Python | bsd-3-clause | 605 |
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Framework repository exceptions module}.
"""
class Warning(Exception):
""" Exception raised for important warnings like data
trun... | mudler/entropy | lib/entropy/db/exceptions.py | Python | gpl-2.0 | 3,210 |
"""
Classify a color and a gray tone.
The color can be classifiedd by looking at the distribution of the different
values: one will spike out.
On the color histogram, we can use the same as the gray-ness-detection.
"""
#!/usr/bin/env python3
import numpy as np
import cv2
import scipy.cluster.vq as vq
import time
impo... | niccokunzmann/pulse-programming | color_classification.py | Python | gpl-3.0 | 2,295 |
#
# 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... | spektom/incubator-airflow | airflow/providers/snowflake/hooks/snowflake.py | Python | apache-2.0 | 5,152 |
#!/usr/bin/env python2
#
# This file is part of the dune-hdd project:
# https://github.com/pymor/dune-hdd
# Copyright Holders: Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import division, print_function
import numpy as np
from pymor.core.logger impo... | pymor/dune-hdd | examples/linearelliptic/OS2015_SISC__6_2__online.py | Python | bsd-2-clause | 15,870 |
#!/usr/bin/env python
"""
Copyright 2015 Brocade Communications Systems, 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 appl... | SivagnanamCiena/pynos | pynos/versions/base/bgp.py | Python | apache-2.0 | 10,316 |
# Tests for the samba-tool user sub command reading Primary:userPassword
#
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2017
#
# 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 vers... | kernevil/samba | python/samba/tests/samba_tool/user_virtualCryptSHA.py | Python | gpl-3.0 | 21,786 |
# -*- coding: utf-8 -*-
from brainiak.utils.links import merge_schemas, pagination_schema
SUGGEST_PARAM_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Describe the parameters given to the suggest primitive",
"type": "object",
"required": ["search"],
"additionalProp... | bmentges/brainiak_api | src/brainiak/suggest/json_schema.py | Python | gpl-2.0 | 6,725 |
import unittest
from butler_offline.viewcore import configuration_provider
from butler_offline.core import file_system
from butler_offline.test.core.file_system_stub import FileSystemStub
class TesteConverter(unittest.TestCase):
def set_up(self):
file_system.INSTANCE = FileSystemStub()
configur... | RosesTheN00b/BudgetButlerWeb | butler_offline/test/viewcore/configuration_provider_test.py | Python | agpl-3.0 | 1,464 |
"""
Django settings for bcblink project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | binRick/thc.digital | BitCoin-Blink-Lottery/bcblink/settings_local.py | Python | unlicense | 3,034 |
# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2013, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any l... | hachreak/invenio-utils | invenio_utils/serializers.py | Python | gpl-2.0 | 3,746 |
# SecuML
# Copyright (C) 2017 ANSSI
#
# SecuML is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# SecuML is distributed in the hope t... | ah-anssi/SecuML | SecuML/experiments/ActiveLearning/QueryStrategies/RandomSamplingExp.py | Python | gpl-2.0 | 1,264 |
###############################################################
# Copyright 2020 Lawrence Livermore National Security, LLC
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
#
# This file is part of the Flux resource manager framework.
# For details, see https://github.com/flux-framework.
#
# SPDX-License-Identifier: LGPL-3.0
####... | grondo/flux-core | src/bindings/python/flux/job/wait.py | Python | lgpl-3.0 | 6,643 |
# -*- coding: utf-8 -*-
""" Models for graph database """
from rapydo.services.neo4j.models import \
StructuredNode, IdentifiedNode, \
StringProperty, DateTimeProperty, EmailProperty, \
RelationshipTo, RelationshipFrom
from neomodel import OneOrMore, ZeroOrMore, ZeroOrOne
class User(IdentifiedNode):
... | EUDAT-B2STAGE/http-api-base | rapydo/models/neo4j.py | Python | mit | 2,137 |
#!/usr/bin/env python3
'''exfi.arguments.py: submodule to deal with the argument parsers'''
import argparse
from exfi import __version__
DEFAULT_K = 25
DEFAULT_BLOOM_SIZE = '500M'
DEFAULT_LEVELS = 2
DEFAULT_THREADS = 1
DEFAULT_MAX_FP_BASES = 5
DEFAULT_MAX_OVERLAP = 10
DEFAULT_MAX_GAP_SIZE = 10
DEFAULT_NUMBER_OF_NS ... | jlanga/exfi | exfi/arguments.py | Python | mit | 11,601 |
# (c) Crown Copyright 2014 Defence Science and Technology Laboratory UK
# Author: Rich Brantingham
import datetime
from mongoengine import Document, BooleanField, IntField, EmbeddedDocument, DateTimeField, ListField, StringField, EmbeddedDocumentField
#TODO: How to implement a sort by protective marking?
cl... | dstl/ideaworks | backend/ideaworks/contentapp/documents.py | Python | agpl-3.0 | 6,054 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
作者:古怪
时间:2015-03-01
地址:http://www.qjwgg.com
'''
import random
from sudoku_solving import sudoku_solving
def get_random_num(sudoku,index): # 从候选数中随机获取
'''
index 为单元格下标
1. 首先根据此单元格所在的行、列和3*3的小矩阵,对此单元格的候选数进行更新
2. 从更新后的候选数中随机选取一个作为此单元格的值
'''
candid... | mgautamk/sudoku | sudoku_generate.py | Python | apache-2.0 | 3,738 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2011, 2012, 2013 CERN.
##
## Invenio 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... | MSusik/invenio | invenio/ext/session/interface.py | Python | gpl-2.0 | 7,011 |
#!/usr/bin/python3
try:
from setuptools import setup
from setuptools.extension import Extension
except Exception:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
_extra = [
'-O3',
'-ffast-math'
]
req = [
'cairocffi',
... | inconvergent/fast-sand-paint | setup.py | Python | mit | 736 |
#-*- coding: utf-8 -*-
'''
Created on 24 дек. 20%0
@author: ivan
'''
import random
all_agents = """
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3
Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Mozilla/5.0 (Windows; U; Win... | foobnix/foobnix | foobnix/util/agent.py | Python | gpl-3.0 | 1,348 |
"""The pencom component."""
| fbradyirl/home-assistant | homeassistant/components/pencom/__init__.py | Python | apache-2.0 | 28 |
# -*- coding: utf-8 -*-
def myfunction(a, b):
if(a.isalpha() and b.isalpha()):
print "Получены строки"
if (len(a) > len(b)):
print "Строка А больше Б"
else:
print "Строка Б больше А"
else:
if(a.isdigit() and b.isdigit()):
print "Получены числа"... | pybursa/homeworks | a_kopitsa/hw1/task6.py | Python | gpl-2.0 | 689 |
#!/usr/bin/env python
""" Marcos Moyano - marcos@anue.biz
Logout users of a specified period of idle time.
Copyright (c) 2006 Marcos Moyano
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 Foun... | marcosmoyano/idleout | src/idleoutd.py | Python | gpl-2.0 | 22,171 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.conf.urls import patterns, url
from util import page
import views
urlpatterns = patterns('',
url('^$',... | mahinthjoe/bedrock | bedrock/mozorg/urls.py | Python | mpl-2.0 | 15,690 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
# 2011 ~ 2012 Wang Yong
#
# Author: Wang Yong <lazycat.manatee@gmail.com>
# Maintainer: Wang Yong <lazycat.manatee@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under t... | netphi/deepin-ui | dtk/ui/global_key.py | Python | gpl-3.0 | 5,932 |
from lib2to3.fixes.fix_except import FixExcept
| uclaros/QGIS | scripts/qgis_fixes/fix_except.py | Python | gpl-2.0 | 47 |
f1 = 1
f2 = 1
count = 2
found = 0
while(found == 0):
count += 1
next = f1 + f2
n_digit = 10**999
if(next/n_digit != 0):
found = 1
print count
print next
break
f1 = f2
f2 = next
| khaleeque-ansari/Online-Coding- | ProjectEulerCode/prob25.py | Python | apache-2.0 | 274 |
from sauna.consumers.base import QueuedConsumer
from sauna.consumers import ConsumerRegister
my_consumer = ConsumerRegister('Stdout')
@my_consumer.consumer()
class StdoutConsumer(QueuedConsumer):
def _send(self, service_check):
print(service_check)
@staticmethod
def config_sample():
ret... | bewiwi/sauna | sauna/consumers/ext/stdout.py | Python | bsd-2-clause | 415 |
# coding: utf-8
"""
Created on 28 June 2017
@author: N'DOYE Joachim
Examples of tests to illustrate the basic of VirtualTest
"""
#############################################################################
# VirtualPyTest - 2017 - AngelCorp.
# Copyright (C) 2017 N'DOYE Joachim
# GNU General Public Licens... | jndoye/virtualPyTest | examples/basic_test.py | Python | gpl-3.0 | 4,374 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, cint
from frappe import throw, _
from frappe.model.document import Document
class RootNotEditable(frappe.V... | elba7r/lite-system | erpnext/accounts/doctype/account/account.py | Python | gpl-3.0 | 10,147 |
import learn
import inject
import project
from build_surrogate import build_surrogate
from ActiveSubspace import ActiveSubspace
| aerialhedgehog/VyPy | trunk/VyPy/regression/active_subspace/__init__.py | Python | bsd-3-clause | 139 |
# Copyright (c) 2011-2013 Peng Sun. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYRIGHT file.
# hone_util.py
# util functions for HONE
import datetime
import logging
import os
import time
import multiprocessing
import inspect
class LogUtil:
_LogL... | bolshoibooze/hone | Controller/hone_util.py | Python | bsd-3-clause | 2,832 |
from datetime import datetime
BUGZILLA_TIME_STAMP = "%Y-%m-%dT%H:%M:%SZ"
class Comment(object):
def __init__(self, data):
if data and 'author' in data:
self.author = data['author']
if data and 'count' in data:
self.count = data['count']
if data and 'bug_id' in da... | marquesarthur/BugAnalysisRecommender | dataset/bugzilla/comment.py | Python | mit | 2,522 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# Copyright (C) 2016 Michel Müller, Tokyo Institute of Technology
# This file is part of Hybrid Fortran.
# Hybrid Fortran 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... | muellermichel/Hybrid-Fortran | hf/tools/patterns.py | Python | lgpl-3.0 | 4,276 |
from django.conf.urls import patterns, url
from rango import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^about/', views.about, name='about')
)
| Newticus/room8 | rango/urls.py | Python | gpl-2.0 | 181 |
# vim: ts=4:sw=4:expandtab
# -*- coding: UTF-8 -*-
# BleachBit
# Copyright (C) 2008-2020 Andrew Ziem
# https://www.bleachbit.org
#
# 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 versio... | tstenner/bleachbit | bleachbit/GuiPreferences.py | Python | gpl-3.0 | 21,061 |
from turtle import shape, forward, left, right, exitonclick
from math import sqrt, acos, degrees
shape('turtle')
def vypocti_preponu(sirka, vyska):
return sqrt(sirka**2+vyska**2)
def vykresli_domecek(sirka, vyska):
prepona = vypocti_preponu(sirka, vyska)
striska = vypocti_preponu(sirka, vyska)/2
uhel... | Ajuska/pyladies | 05/domecek_sirka_vyska.py | Python | mit | 794 |
# BurnMan - a lower mantle toolkit
# Copyright (C) 2012-2014, Myhill, R., Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
# This is a standalone program that converts a tabulated version of the Stixrude and Lithgow-Bertelloni data format into the standard burnman format (printed ... | QuLogic/burnman | burnman/data/input_raw_endmember_datasets/HHPH2013data_to_burnman.py | Python | gpl-2.0 | 3,130 |
import argparse
import json
from api_handler import start_api
from log import init_logger
from processor import process_torrent
class Application(object):
def __init__(self):
super(Application, self).__init__()
self.destination = None
self.torrent = None
self.port = None
s... | miguelaferreira/transmission-postprocess | trdone/application.py | Python | mit | 2,416 |
# -*- coding: utf-8 -*-
"""The format analyzer."""
import pysigscan
from dfvfs.analyzer import specification
from dfvfs.lib import definitions
from dfvfs.resolver import resolver
class Analyzer(object):
"""Class that implements the format analyzer."""
_SCAN_BUFFER_SIZE = 33 * 1024
_analyzer_helpers = {}
... | dc3-plaso/dfvfs | dfvfs/analyzer/analyzer.py | Python | apache-2.0 | 13,677 |
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
import Build, os, sys, Options, Utils, Task, re, fnmatch, Logs
from TaskGen import feature, before
from Configure import conf, ConfigurationContext
from Logs import debug
import shlex
# TODO:... | rchicoli/samba | buildtools/wafsamba/samba_utils.py | Python | gpl-3.0 | 21,279 |
from unittest import TestCase
import o3d3xx
import xmlrpc
from .config import *
class TestDevice(TestCase):
def setUp(self):
self.device = o3d3xx.Device(deviceAddress)
def test_get_sw_version(self):
result = self.device.getSWVersion()
self.assertIsInstance(result, dict)
def test_request_session(self):
se... | cfreundl/o3d3xx-python | tests/test_device.py | Python | mit | 679 |
"""
Test Suite for chess:
Chess_Board Class
"""
import sys
sys.path.insert(0,'../components')
from Chess_Piece import *
from Chess_Board import *
import unittest
from data import *
class Test_Suite(unittest.TestCase):
"""
Class for testing
Chess Board
"""
def test_board(self):
board = ... | apeterson91/Chess_Game | tests/test_05.py | Python | mit | 2,944 |
# 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... | anish/buildbot | pkg/test_buildbot_pkg.py | Python | gpl-2.0 | 3,733 |
# -*- coding: utf-8 -*-
#
# Sigal documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 9 00:01:10 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... | muggenhor/sigal | docs/conf.py | Python | mit | 9,393 |
# Copyright (2021) Binovo IT Human Project SL
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import base64
from enum import Enum
from odoo import models, fields, api, _
from ..lroe.lroe_xml_schema import LROEXMLSchema,\
LROEXMLSchemaModeNotSupported,\
LROEOperationTypeEnum
from .lroe_operation... | factorlibre/l10n-spain | l10n_es_ticketbai_api_batuz/models/lroe_operation_response.py | Python | agpl-3.0 | 16,313 |
# 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | vmturbo/nova | nova/tests/unit/fake_instance.py | Python | apache-2.0 | 5,158 |
# -*- 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):
# Adding field 'Question.short_instruction'
db.add_column(u'questionnaire_question', 'short_instruction',
... | testvidya11/ejrf | questionnaire/migrations/0014_auto__add_field_question_short_instruction.py | Python | bsd-3-clause | 15,710 |
""" Module handling the snapshots """
import datetime
import yaml
import boto3
from botocore.exceptions import ClientError
from boto.exception import EC2ResponseError
import kayvee
import logging
import os
aws_backup_region = os.environ.get('AWS_BACKUP_REGION')
""" Configure the valid backup intervals """
VALID_INTE... | Clever/ebs-snapshots | ebs_snapshots/snapshot_manager.py | Python | apache-2.0 | 12,433 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .. import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
phonenumber_prefixes = [134, 135, 136, 137, 138, 139, 147, 150,
151, 152, 157, 158, 159, 182, 187, 188,
130, 1... | Nebucatnetzer/tamagotchi | pygame/lib/python3.4/site-packages/faker/providers/phone_number/zh_CN/__init__.py | Python | gpl-2.0 | 589 |
from .core import send_email
| avinassh/della | della/email_service/__init__.py | Python | mit | 29 |
include_dirs = ['/usr/include']
library_dirs = ['/usr/lib']
runtime_library_dirs = ['/usr/lib']
libraries = ['kadm5clnt', 'com_err']
define_macros = [('NO_DEBUG', 1)]
from distutils.core import setup, Extension
setup(name='pykadm5',
version='0.2',
py_modules=['pykadm... | redondomarco/useradm | doc/pykadm5/setup.py | Python | gpl-3.0 | 1,039 |
import sys
for line in sys.stdin:
data = line.strip().split(" ")
if len(data) == 10:
page = data[6]
ip_address = data[0]
print "{0}\t{1}".format(page, ip_address) | mi1980/projecthadoop3 | udacity/ud617-intro-hadoop/code/lesson3/server-project/mapper1.py | Python | mit | 170 |
# Copyright (c) 2014 Freescale, 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 wr... | samsu/neutron | tests/unit/ml2/drivers/freescale/test_mechanism_fslsdn.py | Python | apache-2.0 | 11,225 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
import StringIO
import gc
import re
import sys
import textwrap
import types
from twisted.trial import unittest
from twisted.trial.runner import (
TrialRunner, TestSuite, DestructiveTestSuite, TestLoader)
from twisted.trial._dist.disttrial imp... | engdan77/edoAutoHomeMobile | twisted/trial/test/test_script.py | Python | mit | 29,653 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.cElementTree as ET
import pprint
import re
"""
Your task is to explore the data a bit more.
Before you process the data and add it into MongoDB, you should
check the "k" value for each "<tag>" and see if they can be valid keys in MongoDB,
as well as see if ... | tommysiu/udacity-data-analyst | P2-openstreetmap-data-wrangling/tags.py | Python | mit | 1,849 |
#!/usr/bin/env python3
# Copyright 2013 Iain Peddie inr314159@hotmail.com
#
# This file is part of WellBehavedPython
#
# WellBehavedPython 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 v... | iain-peddie/well-behaved-python | tests/WellBehavedPythonTests/Discovery/ModuleExaminerTests.py | Python | gpl-3.0 | 3,114 |
from __future__ import unicode_literals
from dlkit.json_ import types
from dlkit.json_.id.objects import IdList
from dlkit.json_.assessment.objects import ItemList, Item, AssessmentTaken, AssessmentTakenList
from dlkit.json_.utilities import JSONClientValidated, arguments_not_none, is_string
from dlkit.json_.osid impo... | mitsei/dlkit | dlkit/records/assessment/basic/base_records.py | Python | mit | 13,840 |
from threading import Event
exit = Event()
| abranches/pumba | runtime_flags.py | Python | gpl-2.0 | 44 |
import random
from unittest import TestCase
from hamcrest import *
from chapter12.exercise12_3_4 import safe_tree_delete
from tree_util import get_random_binary_search_tree, assert_binary_search_tree, assert_parent_pointers_consistent, \
get_binary_tree_keys
class TestExercise12_3_4(TestCase):
def test_saf... | wojtask/CormenPy | test/test_chapter12/test_exercise12_3_4.py | Python | gpl-3.0 | 750 |
# From
# https://cloud.coiled.io/examples/notebooks
import superimport
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
class HiddenLayerNet(nn.Module):
def __init__(self, n_features=10, n_outputs=1, n_hidden=100, activation="relu"):
super().__init__()
... | probml/pyprobml | scripts/torch_model.py | Python | mit | 557 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blogg', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Comment',
fields=[
... | ishahid/django-blogg | source/blogg/migrations/0002_comment.py | Python | mit | 1,206 |
# Copyright 2016, IBM US, 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 writing... | open-power-ref-design/opsmgr | plugins/devices/powernode/opsmgr/plugins/devices/powernode/PowerNodePlugin.py | Python | apache-2.0 | 5,846 |
#(C) Copyright Syd Logan 2018
#(C) Copyright Thousand Smiles Foundation 2018
#
#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... | slogan621/tscharts | returntoclinicstation/urls.py | Python | apache-2.0 | 844 |
# position/views.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.http import JsonResponse
from django.shortcuts import render
from django.contrib.messages import get_messages
from election_office_measure.models import CandidateCampaignManager
from follow.models import FollowOrganizationLis... | wevoteeducation/WeVoteBase | position/views.py | Python | mit | 24,607 |
"""Run kfctl delete as a pytest.
We use this in order to generate a junit_xml file.
"""
import logging
import pytest
import os
from kubeflow.testing import util
def test_kfctl_delete(record_xml_attribute, cluster_deletion_script,
cluster_name):
util.set_pytest_junit(record_xml_attribute, "t... | kubeflow/kfctl | py/kubeflow/kfctl/testing/pytests/kfctl_delete_cluster_test.py | Python | apache-2.0 | 939 |
import fire
import imageio
import matplotlib.pyplot as plt
import scipy.misc as misc
from .parsers import *
from .utils import *
# ========= FRAMEWORK =========== #
class PaintRequestABC(object):
def __init__(self, file, **kwargs):
"""
Args::
file : string
filename of... | Fafa87/EP | examples/ep/evalplatform/draw_details.py | Python | mit | 11,702 |
#!/usr/bin/env python
import libCloudSnakeClient as SnakeClient
import pprint, sys
client = SnakeClient.CloudSnakeClient( 'http://localhost:8101', 'main' )
push = client.get_method( 'push' )
print push( event = sys.argv[ 1 ], content = sys.argv[ 2 ] )
| Alshain-Oy/Cloudsnake-Application-Server | clients/cometPushEvent.py | Python | apache-2.0 | 263 |
import sys
import gzip
import os
import numpy as np
import util
class TestSNP:
def __init__(self, name, geno_hap1, geno_hap2, AS_target_ref, AS_target_alt,
hetps, totals, counts):
self.name = name
self.geno_hap1 = geno_hap1
self.geno_hap2 = geno_hap2
self.AS_targe... | bmvdgeijn/WASP | CHT/cht_data.py | Python | apache-2.0 | 8,083 |
#!/usr/bin/python3
"""
Bilateral histogram.
"""
from __future__ import print_function
from __future__ import division
from halide import *
import numpy as np
from scipy.misc import imread, imsave
import os.path
int_t = Int(32)
float_t = Float(32)
def get_bilateral_grid(input, r_sigma, s_sigma):
x = Var('x')
... | dan-tull/Halide | python_bindings/apps/bilateral_grid.py | Python | mit | 6,515 |
import status
import unittest
class StatusTestCase(unittest.TestCase):
def setUp(self):
status.app.config['TESTING'] = True
self.app = status.app.test_client()
def test_empty_config(self):
status.app.config['SITES'] = []
r = self.app.get('/')
assert 'No sites have been... | waits/status | status_test.py | Python | bsd-3-clause | 1,574 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import change_production_qty
from . import stock_warn_insufficient_qty
from . import mrp_production_backorder
from . import mrp_consumption_warning
from . import mrp_immediate_production
| rven/odoo | addons/mrp/wizard/__init__.py | Python | agpl-3.0 | 294 |
from .component import Component
class Food(Component):
def __init__(self, health):
self.healing = health
def attach(self, obj):
self.owner = obj
def use(self, user):
fighter = user.getComponent("fighter")
if fighter:
fighter.heal(self.... | jmdejong/Asciifarm | asciifarm/server/components/food.py | Python | gpl-3.0 | 447 |
#-*- coding: utf-8 -*-
"""
Group Configuration Tests.
"""
from __future__ import absolute_import
import json
from operator import itemgetter
import ddt
import six
from mock import patch
from six.moves import range
from contentstore.course_group_config import CONTENT_GROUP_CONFIGURATION_NAME, ENROLLMENT_SCHEME, Grou... | ESOedX/edx-platform | cms/djangoapps/contentstore/views/tests/test_group_configurations.py | Python | agpl-3.0 | 48,420 |
# example from:
# https://www.toptal.com/python/beginners-guide-to-concurrency-and-parallelism-in-python
import logging
import os
from time import time
from queue import Queue
from threading import Thread
from downloadIMGUR import setup_download_dir, get_links, download_link
logging.basicConfig(level=logging.DEBUG, ... | samcheck/Scripts | py3/IMGURdl/threadIMGUR.py | Python | mit | 1,831 |
from fabric.api import *
from fabric.contrib.files import exists, upload_template
from fabric.contrib.project import rsync_project
import time
env.user = 'root'
env.project_name = 'boar'
env.hosts = ['137.205.98.90']
env.path = '/var/www/theboar.org'
env.version = 'current'
######################################
# He... | boar/boar | fabfile.py | Python | bsd-3-clause | 2,939 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set sts=4 sw=4 et:
import unittest
from tupelo import rpc
from tupelo.server import TupeloRPCInterface as I
from tupelo.server.jsonapi import TupeloJSONDispatcher as D
from tupelo.players import Player
class TestTupeloJSONDispatcher(unittest.TestCase):
def tes... | jait/tupelo | tests/test_server.py | Python | bsd-3-clause | 6,469 |
#!/usr/bin/env python
import optparse
from os import system
class ReplicationData:
tableList = [{'database':'xgds_basalt',
'tables':[
'xgds_video_videosegment',
'xgds_video_videoepisode',
'xgds_core_constant',
... | xgds/xgds_basalt | apps/basaltApp/scripts/setReplicationFilters.py | Python | apache-2.0 | 4,119 |
#
# -*- coding: utf-8 -*-
#
from __future__ import print_function
r"""
.. currentmodule:: pylayers.simul.link
.. autosummary::
:members:
"""
try:
from tvtk.api import tvtk
from mayavi.sources.vtk_data_source import VTKDataSource
from mayavi import mlab
except:
print('Layout:Mayavi is not install... | pylayers/pylayers | pylayers/simul/link.py | Python | mit | 78,614 |
#! /usr/bin/env python
MIN_INNER = 150
MAX_INNER = 770
MIN_OUTER = 30
#MAX_OUTER = 940
#MAX_OUTER = 800 # changing because Robot hits antenna
MAX_OUTER = 680 # changing because screws still interfere
#MIN_CENTER = 512 - 180
#MAX_CENTER = 512 + 180
MIN_CENTER = 512 - 120
MAX_CENTER = 512 + 120
NORM_CENTER = 512
POS_F... | booi/aracna | RaspberryPypose/robotPi/RobotConstants.py | Python | gpl-3.0 | 1,069 |
from setuptools import setup
setup(name='resup',
version='1.3.1',
description='Batch up- and download of CKAN resources',
url='https://github.com/eawag-rdm/resup',
author='Harald von Waldow',
author_email='harald.vonwaldow@eawag.ch',
license='GNU Affero General Public License',
... | eawag-rdm/resup | setup.py | Python | agpl-3.0 | 638 |
#!/usr/bin/env python
# encoding: utf-8
"""Test CLI."""
from hdfs.__main__ import _Progress, configure_client, main, parse_arg
from hdfs.config import Config, NullHandler
from hdfs.util import HdfsError, temppath
from logging.handlers import TimedRotatingFileHandler
from nose.tools import eq_, nottest, ok_, raises
fr... | mtth/hdfs | test/test_main.py | Python | mit | 5,675 |
#!/Users/tom/Documents/tomwallis.net/venv/bin/python
# Author:
# Contact: grubert@users.sf.net
# Copyright: This module has been placed in the public domain.
"""
man.py
======
This module provides a simple command line interface that uses the
man page writer to output from ReStructuredText source.
"""
import local... | probablytom/tomwallis.net | venv/bin/rst2man.py | Python | artistic-2.0 | 634 |
# coding: utf-8
# pylint: disable= too-many-lines, redefined-builtin, protected-access
# pylint: disable=import-error, no-name-in-module, undefined-variable
"""NDArray API of MXNet."""
from __future__ import absolute_import
from __future__ import division
try:
from __builtin__ import slice as py_slice
except Import... | hesseltuinhof/mxnet | python/mxnet/ndarray.py | Python | apache-2.0 | 85,427 |
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
from sqlalchemy.orm import mapper, relation, backref
import forge.models
metadata = forge.models.metadata
machines_table = Table('machines', metadata,
Column('ip',String, primary_key=True),
Column('profile', String),
Co... | blhughes/forge | forge/models/machines.py | Python | gpl-2.0 | 751 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013 BatOnBots-ML.
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 versi... | BatOnBots-ML/batonbots-ml | battle/robot/radar.py | Python | gpl-3.0 | 2,107 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2015 Glencoe Software, Inc. All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
# 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... | dpwrussell/openmicroscopy | components/tools/OmeroPy/test/integration/test_reimport.py | Python | gpl-2.0 | 9,615 |
# -*- encoding: utf-8 -*-
from abjad.tools.abctools import AbjadObject
class LilyPondLanguageToken(AbjadObject):
r'''A LilyPond file ``\language`` token.
.. container:: example
::
>>> lilypondfiletools.LilyPondLanguageToken()
LilyPondLanguageToken('english')
'''
#... | andrewyoung1991/abjad | abjad/tools/lilypondfiletools/LilyPondLanguageToken.py | Python | gpl-3.0 | 1,937 |
# -*- coding: utf-8 -*-
#
#
# Copyright (C) 2011-2013 Associazione OpenERP Italia
# (<http://www.openerp-italia.org>).
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2012-2015 Agile Business Group sagl
# Copyright (C) 2012-15 LinkIt Spa (<http://http://www.linkgroup.it>)
# ... | odoo-isa/l10n-italy | l10n_it_vat_registries/__openerp__.py | Python | agpl-3.0 | 1,747 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 10... | klintwood/python_koans | python2/koans/about_scoring_project.py | Python | mit | 2,631 |
from django.conf.urls import url
from .views import (
NotificationsAPIView,
NotificationAPIView,
)
urlpatterns = [
url(r'^$', NotificationsAPIView.as_view(), name="notifications"),
url(r'^(?P<pk>\d+)/$', NotificationAPIView.as_view(), name="notification"),
]
| unicef/un-partner-portal | backend/unpp_api/apps/notification/urls.py | Python | apache-2.0 | 278 |
from bs4 import BeautifulSoup as BS
import Util
def clean_story(file_name):
print('Processing story ' + file_name)
# extract the basic data out of html flags
with open(file_name) as f:
soup = BS(''.join(f.readlines()), 'html.parser')
title = soup.title.text
parser = Util.Parser()
parser.skip_non_empty_attrs... | daphnei/nn_chatbot | story_corpus/vi/clean_story.py | Python | mit | 438 |
import copy
import warnings
from bisect import bisect
from collections import OrderedDict, defaultdict
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db import connections
from django.db.mo... | bak1an/django | django/db/models/options.py | Python | bsd-3-clause | 34,798 |
############ A METTRE AILLEURS ?
import django
from rest_framework import serializers
from django_apogee.serializers import InsAdmEtpInitialSerializer, IndividuSerializer
from duck_examen.models import RattachementCentreExamen, ExamCenter
from django_apogee.models import Adresse, InsAdmEtp
class RattachementCentreExa... | iedparis8/duck_examen | serializers.py | Python | mit | 2,427 |
import prettytensor as pt
import tensorflow as tf
from net_modules.common import *
from net_modules.hourglass import hourglass
import zutils.tf_math_funcs as tmf
import zutils.pt_utils as ptu
from net_modules.auto_struct.generic_decoder import Factory as GenericDecoderFactory
from net_modules.auto_struct.keypoint_... | YutingZhang/lmdis-rep | nets/decoder/general_80x80.py | Python | apache-2.0 | 2,682 |
#------------------------------------------------------------------------------
# Copyright 2013 Esri
# 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/LICENS... | JudTown17/solutions-geoprocessing-toolbox | capability/test/test_erg_tools/TestUtilities.py | Python | apache-2.0 | 1,365 |
"""
This file contains the tests for the PEOPLE APP
"""
from django.core.urlresolvers import reverse
from django.test import TestCase
from .models import Individual, ResidenceType, Residence, OccupationType, OccupationTitle, Occupation, RelationshipType, Relationship
from places.models import State, Location
from cit... | jabauer/ProjectQuincy | people/tests.py | Python | gpl-3.0 | 3,223 |
import json
from thrift.TSerialization import deserialize as thrift_deserialize
from gen.twitter.thrift.endpoint.ttypes import (
Endpoint as ThriftEndpoint,
ServiceInstance as ThriftServiceInstance)
try:
from twitter.common import log
except ImportError:
import logging as log
from twitter.common.lang import ... | foursquare/commons-old | src/python/twitter/common/zookeeper/serverset/endpoint.py | Python | apache-2.0 | 5,617 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.