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 |
|---|---|---|---|---|---|
from runtests.mpi import MPITest
from nbodykit.io.csv import CSVFile
import os
import numpy
import tempfile
import pickle
import pytest
@MPITest([1])
def test_no_trailing_newline(comm):
with tempfile.NamedTemporaryFile() as ff:
# generate data with blank lines
data = numpy.array([[1, 1, 1, 1], [... | bccp/nbodykit | nbodykit/io/tests/test_csv.py | Python | gpl-3.0 | 8,014 |
#!/usr/bin/python
"""Sorts alphabetically all the files within an nzb file.
If no file is provided, read stdin. Either way, spit out to stdout.
"""
import sys
import xml.dom.minidom as minidom
__version__ = "0.1.2"
__author__ = "Bertrand Janin <tamentis@neopulsar.org>"
__license__ = "ISC"
if __name__ == '__main__'... | tamentis/nzbsort | nzbsort.py | Python | isc | 2,364 |
"""
Detect a cycle in a linked list. Note that the head pointer may be 'None' if the list is empty.
A Node is defined as:
class Node(object):
def __init__(self, data = None, next_node = None):
self.data = data
self.next = next_node
"""
class Node(object):
def __init__(self, da... | pepincho/HackerRank-Challenges | linked_list_detect_cycle.py | Python | mit | 676 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-03-03 18:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('seqr', '0006_family_mme_notes'),
]
operations = [
migrations.AlterField(
model_name='individual',
... | macarthur-lab/seqr | seqr/migrations/0007_auto_20200303_1842.py | Python | agpl-3.0 | 678 |
from pandac.PandaModules import VBase4, VBase3
from direct.fsm import FSM
from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectButton import DirectButton
from toontown.toonbase import ToontownGlobals
from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import *
from toontown.toonba... | ksmit799/Toontown-Source | toontown/toontowngui/NewsPageButtonManager.py | Python | mit | 10,708 |
import datetime
from bottle import request, static_file
EXP_TIMESTAMP = '%a, %d %b %Y %H:%M:%S GMT'
def serve_static(path):
response = static_file(path, root=request.assets.directory)
exp = datetime.datetime.utcnow() + datetime.timedelta(365)
response.headers['Expires'] = exp.strftime(EXP_TIMESTAMP)
... | Outernet-Project/broadcast-portal | broadcast/routes/static.py | Python | gpl-3.0 | 669 |
"""
gw2copilot/utils.py
The latest version of this package is available at:
<https://github.com/jantman/gw2copilot>
################################################################################
Copyright 2016 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of gw2copilot.
... | jantman/gw2copilot | gw2copilot/utils.py | Python | agpl-3.0 | 5,105 |
from adonthell import gfx, input, main
import sys, time
class InputtestApp (main.AdonthellApp):
def __init__ (self):
main.AdonthellApp.__init__(self)
self.Letsexit = 0
## Callback fonction to handle keyboard events.
## It will be passed a keyboard_event as a parameter
## and is... | dreamsxin/adonthell | test/inputtest.py | Python | gpl-2.0 | 2,118 |
class TumblrError(Exception):
"""Generic exception class."""
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value) | ejesse/tumblrpy | tumblrpy/errors.py | Python | mit | 184 |
"""
watchdog device support class(es)
http://libvirt.org/formatdomain.html#elementsWatchdog
"""
import aexpect
import logging
from virttest.libvirt_xml import accessors
from virttest.libvirt_xml.devices import base
LOG = logging.getLogger('avocado.' + __name__)
class Watchdog(base.UntypedDeviceBase):
__slots... | avocado-framework/avocado-vt | virttest/libvirt_xml/devices/watchdog.py | Python | gpl-2.0 | 2,003 |
from pprint import pprint
import graphene
from django.db.models import Prefetch
from graphene_django import DjangoObjectType
from falmer.matte.types import Image
from falmer.schema.utils import create_connection
from . import models
class MSLStudentGroupCategory(DjangoObjectType):
class Meta:
model = mo... | sussexstudent/falmer | falmer/studentgroups/types.py | Python | mit | 2,522 |
#!/usr/bin/env python
from io import open
import os
import sys
from setuptools import setup, find_packages
readme = open('README.rst', encoding='utf-8').read()
setup(name='geoffrey-filecontent',
version='0.0.4',
description='Centralize multiple data source plugins.',
long_description=readme,
... | GeoffreyCI/geoffrey-filecontent | setup.py | Python | gpl-3.0 | 652 |
"""
Author: Conrad Meyer
Start Date: 30 Nov 2009
Description:
Wrapper around loggingrepy_core that provides restriction management
and nannying.
"""
import nanny
import loggingrepy_core
get_size = loggingrepy_core.get_size
myfile = loggingrepy_core.myfile
class flush_logger(loggingrepy_core.flus... | SeattleTestbed/repy_v2 | loggingrepy.py | Python | mit | 3,350 |
import logging
from pymongo import MongoClient
import json
from bson import json_util
import time
import datetime
logger = logging.getLogger(__name__)
class UIPusher:
def __init__(self,core,parm):
# register event handler
core.registerEventHandler("controlleradapter", self.controllerHandler)
# register webso... | starbops/OpenADM | core/src/floodlight_modules/uipusher.py | Python | gpl-2.0 | 6,838 |
import numpy as np
import struct
class MdaHeader:
def __init__(self, dt0, dims0):
uses64bitdims=(max(dims0)>2e9)
self.uses64bitdims=uses64bitdims
self.dt_code=_dt_code_from_dt(dt0)
self.dt=dt0
self.num_bytes_per_entry=get_num_bytes_per_entry_from_dt(dt0)
... | magland/mountainsort | packages/pyms/mlpy/mdaio.py | Python | mit | 9,662 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-30 03:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('webAdmin', '0001_initial'),
]
operations = [
migrations.AlterField(
... | DevNetMansur/dev-network | OpenVpnAdmin/webAdmin/migrations/0002_auto_20170830_1144.py | Python | gpl-3.0 | 458 |
class Main:
def __init__(self):
self.pi = 3.14159
self.r = int(input())
def volume(self):
return (4 * self.pi * (self.r ** 3)) / 3.0
def output(self):
print("VOLUME = %0.3f" % self.volume())
if __name__ == '__main__':
obj = Main()
obj.output()
| ProgDan/maratona | URI/uri1011.py | Python | gpl-3.0 | 300 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsComposerMap.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__... | bstroebl/QGIS | tests/src/python/test_qgscomposermap.py | Python | gpl-2.0 | 7,428 |
def is_integer(nr):
try:
int(nr)
return True
except ValueError:
return False
| leyyin/university-SE | school/util.py | Python | mit | 110 |
from django.utils.translation import ugettext_lazy as _
from oioioi.base.menu import MenuRegistry
from oioioi.base.permissions import not_anonymous
from oioioi.contests.utils import contest_exists
top_links_registry = MenuRegistry(_("Top Links Menu"), contest_exists & not_anonymous)
| sio2project/oioioi | oioioi/dashboard/menu.py | Python | gpl-3.0 | 286 |
from fixtures import MonkeyPatch
class FakeThreads(MonkeyPatch):
def __init__(self):
super(FakeThreads, self).__init__("threading.Thread", self)
self._threads = []
self._hang = False
def hang(self, flag=True):
self._hang = flag
def __getitem__(self, index):
retur... | debian-python/systemfixtures | systemfixtures/threads.py | Python | mit | 1,735 |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.task.goal... | UnrememberMe/pants | src/python/pants/task/target_restriction_mixins.py | Python | apache-2.0 | 3,286 |
#!/usr/bin/env python
class GmlParser(object):
def __init__(self, file_obj):
self.fileob = file_obj
self.linebuf = ""
def parse(self):
"""Read the entire file_obj and return a list of key, value pairs"""
self._advance()
return self._readArray(True)
def _advance(self):
self.linebuf = se... | johnynek/netmodeler | tools/gmlread.py | Python | gpl-2.0 | 2,500 |
import tensorflow as tf
"""tf.maximum(x,y,name=None)
功能:计算x,y对应位置元素较大的值。支持广播模式
输入:x,y为张量,可以为`half`,`float32`, `float64`, `int32`, `int64`类型。"""
x = tf.constant([[0.2, 0.8, -0.7], [-1, -3, -5]], tf.float64)
y = tf.constant([[0.2, 0.5, -0.3]], tf.float64)
z = tf.maximum(x, y)
sess = tf.Session()
print(sess.run(z))
ses... | Asurada2015/TFAPI_translation | math_ops_basicoperation/tf_maximum.py | Python | apache-2.0 | 443 |
#!/usr/bin/python
#========================================================================
# CreateDB.py: Create a CVE database to be populated by NVD data
# Install mysqldb module on Debian as follows:
# $ sudo apt-get install python-mysqldb
#========================================================================
i... | jourzero/AdvisoryEmail | CreateDB.py | Python | mit | 2,617 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2009 Douglas S. 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 L... | pmghalvorsen/gramps_branch | gramps/webapp/grampsdb/view/repository.py | Python | gpl-2.0 | 5,131 |
from __future__ import unicode_literals
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^upload/election/(?P<election>[^/]+)/post/(?P<post_id>[^/]+)/$',
views.CreateDocumentView.as_view(),
name='upload_document_view'),
url(r'^(?P<pk>\d+)/$',
views.DocumentVi... | mysociety/yournextmp-popit | official_documents/urls.py | Python | agpl-3.0 | 376 |
# -*- coding: utf-8 -*-
"""Module for caching `QColor <http://doc.qt.io/qt-5/qcolor.html>`_,
`QPen <http://doc.qt.io/qt-5/qpen.html>`_, and
`QBrush <http://doc.qt.io/qt-5/qbrush.html>`_ objects.
Could be extended to cache `QFont <http://doc.qt.io/qt-5/qfont.html>`_ objects
as well.
"""
from PyQt5.QtGui import (
QC... | scholer/cadnano2.5 | cadnano/gui/palette.py | Python | mit | 5,504 |
def get_scancode():
while not (inb(0x64) & 0x01):
pass
return inb(0x60)
def translate_scancode(scancode):
if (scancode & 0x80): # high bit set (key release)
return None
return "?E1234567890-=BTqwertyuiop[]N^asdfghjkl;'`Z\\zxcvbnm,./SXXXXXXXXX"[scancode & 0x3F]
tb = textbuffer()
tb[0:2... | jtauber/cleese | echo/kernel/keyboard.py | Python | mit | 523 |
# -*- coding: utf-8 -*-
"""
werkzeug.testsuite.local
~~~~~~~~~~~~~~~~~~~~~~~~
Local and local proxy tests.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import time
import unittest
from threading import Thread
from werkzeug.testsuite import WerkzeugTestC... | sauloal/PiCastPy | werkzeug/testsuite/local.py | Python | mit | 3,359 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 RERO.
#
# Invenio-Circulation is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Circulation Patron JSON Resolver module."""
import jsonresolver
from werkzeug.r... | inveniosoftware/invenio-circulation | invenio_circulation/records/jsonresolver/patron.py | Python | mit | 728 |
import os
import lxml.html
from cc.api.tests.test_common import *
####################
## Path constants ##
####################
RELAX_OPTIONS = os.path.join(RELAX_PATH, 'options.relax.xml')
RELAX_SELECT = os.path.join(RELAX_PATH, 'select.relax.xml')
##################
## Test classes ##
##################
class Tes... | doigoid/cc.api | cc/api/tests/test_simple.py | Python | mit | 3,263 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Savitzky-Golay smoother
Copyright © 2005-8 Vladimir Likic, Uwe Schmitt
New BSD License (python website)
or GPL v.2 (bioinformatics)
http://code.google.com/p/pyms/
"""
from math import *
from numpy import zeros, dot, concatenate, con... | fbianco/thoth | sgfilter.py | Python | gpl-3.0 | 2,766 |
plaintext = 'What is the purpose of our lives?' #insert plaintext here
def ReverseCipher(message):
""" This function accepts a string "message" and encrypts or decrypts the message by
performing the reverse cipher on the message."""
print message[::-1]
return message[::-1]
reversed_message = Rever... | AbhishekShah212/learningspace | cryptography/hackingsecretciphers/ReverseCipher.py | Python | gpl-3.0 | 384 |
from . import test_create_action
| OCA/management-system | mgmtsystem_action/tests/__init__.py | Python | agpl-3.0 | 33 |
from .rest import RestClient
class Hooks(object):
"""Hooks endpoint implementation.
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
token (str): Management API v2 Token
telemetry (bool, optional): Enable or disable Telemetry
(defaults to True)
... | auth0/auth0-python | auth0/v3/management/hooks.py | Python | mit | 5,808 |
import json
import py
class DummyS3Connection(object):
_temp_path = py.path.local('/tmp')
def __init__(self, **kwargs):
pass
def get_bucket(self, name):
b = DummyS3Bucket(name=name, path=self._temp_path.join(name))
return b
def get_all_buckets(self):
for p in self._temp... | nocarryr/s3-logparser | tests/utils.py | Python | gpl-3.0 | 2,444 |
#!/usr/bin/env python2
import sys
def main(version):
output = """
==** parameter inputs for pyRAD version %s **======================== affected step ==
./ ## 1. Working directory (all)
./*.fastq.gz ## 2. Loc. of non-demultiplexed files (if not ... | xguse/pyrad | pyrad/createfile.py | Python | gpl-3.0 | 3,821 |
import numpy as np
import random
import os
import shutil
import platform
import pytest
import ray
from ray.test_utils import wait_for_condition
from ray.internal.internal_api import memory_summary
MB = 1024 * 1024
def _init_ray():
return ray.init(
num_cpus=2,
object_store_memory=700e6,
_... | pcmoritz/ray-1 | python/ray/tests/test_plasma_unlimited.py | Python | apache-2.0 | 7,447 |
#!/usr/bin/env python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
from sys import argv
from bcc import BPF
from builtins import input
from ctypes import c_int, c_uint
from http.server import HTTPServer, SimpleHTTPRequestHandler
import json
from netaddr import EUI, IP... | mbudiu-bfn/bcc | examples/networking/distributed_bridge/tunnel_mesh.py | Python | apache-2.0 | 5,212 |
"""Mod docstring."""
# Comment
123
"Some string"
| guildai/guild | guild/tests/samples/scripts/no_breakable_lines.py | Python | apache-2.0 | 52 |
'''
Functions for working with DESI mocks and fiberassignment
TODO (maybe):
This contains hardcoded hacks, especially wrt priorities and
interpretation of object types
'''
from __future__ import print_function, division
import sys, os
import numpy as np
from astropy.table import Table, Column
from fiberassign import... | desihub/fiberassign | old/py/mock.py | Python | bsd-3-clause | 3,161 |
import json
import unittest
from subprocess import check_output
import tempfile
import fixtures
class SkinferScriptTest(unittest.TestCase):
script = 'skinfer'
def test_end_to_end_simple_run(self):
# given:
_, filename = tempfile.mkstemp()
with open(filename, 'w') as f:
f.wr... | stummjr/skinfer | tests/test_end_to_end.py | Python | bsd-3-clause | 2,001 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class StockQuant(models.Model):
_inherit = 'stock.quant'
removal_date = fields.Datetime(related='lot_id.removal_date', store=True, readonly=False)
use_expiration_date =... | jeremiahyan/odoo | addons/product_expiry/models/stock_quant.py | Python | gpl-3.0 | 1,195 |
#!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/sup... | ioanpocol/superdesk-core | superdesk/default_settings.py | Python | agpl-3.0 | 25,160 |
#Milton Orlando Sarria Paja
#USC
#Procesamiento digital de senales
#graficar audio en tiempo real
#plot audio data in real time
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import numpy as np
import sounddevice as sd
from scipy import signal
from sc... | miltonsarria/dsp-python | audio/plot_stream.py | Python | mit | 3,416 |
#!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | madhusudancs/test-infra | gubernator/main_test.py | Python | apache-2.0 | 9,085 |
# Copyright 2018 The Exoplanet ML Authors.
#
# 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 t... | google-research/exoplanet-ml | exoplanet-ml/astronet/data/generate_download_script.py | Python | apache-2.0 | 3,492 |
# -*- coding: utf-8 -*-
# Copyright (C) 2017 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., University of Heidelberg, and University of
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2010 - 2016 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., Universit... | jonasfoe/COPASI | copasi/bindings/python/unittests/Test_CReport.py | Python | artistic-2.0 | 2,748 |
import unittest
from event_scheduler import EventScheduler
from event import Event
import arrow
class EventSchedulerTestCase(unittest.TestCase):
def setUp(self):
self.event_scheduler = EventScheduler()
self.tz = 'local'
self.start_datetime = arrow.Arrow(2015, 12, 12, 11,
... | nkvelkov/Pyganizer | source/tests/test_event_scheduler.py | Python | gpl-2.0 | 3,886 |
"""
Convert notebooks listed in `chapters` into html files in the directory
`riemann_book_files`.
Run this code on the master branch with the latest set of notebooks,
adjusting the specification of `chapters` below first if you want to
process only a subset of the notebooks.
To post on the website, check out the `gh-... | rjleveque/riemann_book | make_html.py | Python | bsd-3-clause | 5,393 |
#!/usr/bin/env python
#
# SVGSlice
#
# Released under the GNU General Public License, version 2.
# Email Lee Braiden of Digital Unleashed at lee.b@digitalunleashed.com
# with any questions, suggestions, patches, or general uncertainties
# regarding this software.
#
usageMsg = """You need to add a layer called "slices"... | rgcjonas/adwaita-semidark | themes/Adwaita/cursors/src/renderpngs.py | Python | lgpl-2.1 | 10,176 |
# -*- coding: utf-8 -*-
import re
from setuptools import setup
def find_version(fname):
'''Attempts to find the version number in the file names fname.
Raises RuntimeError if not found.
'''
version = ''
with open(fname, 'r') as fp:
reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
... | adason/graph_algo | setup.py | Python | mit | 1,848 |
#!/usr/bin/python2.4
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | jscontreras/learning-gae | pgae-examples-master/1e/python/ch14/djangohelper/appengine_django/serializer/json.py | Python | lgpl-3.0 | 1,647 |
"""Define padrões de url para learning_logs"""
from django.conf.urls import url
from . import views
urlpatterns = [
# Pagina Inicial
url(r'^$', views.index, name='index'),
# Mostra todos os assuntos
url(r'^topics/$', views.topics, name='topics'),
# Mostra de detalhes do tópico
url(r'^topics/(... | alvarocneto/learning_log | learning_logs/urls.py | Python | mit | 702 |
# -*- coding: utf-8 -*-
import re
import copy
from pygments.lexer import RegexLexer, ExtendedRegexLexer, bygroups, using, \
include, this
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Other, Punctuation, Literal
__all__ = ['SolidityLexer']
class SolidityLexer(RegexLe... | asinyagin/solidity | docs/utils/SolidityLexer.py | Python | gpl-3.0 | 3,896 |
# Copyright (c) 2013 Chris Lucas, <chris@chrisjlucas.com>
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, ... | fernandog/Medusa | lib/rtorrent/common.py | Python | gpl-3.0 | 2,639 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/api/base.py | Python | apache-2.0 | 9,472 |
import threading
from minidinstall_ng.commands import COMMANDS
try:
import socketserver
except:
import SocketServer as socketserver
class IncomingRequestHandler(socketserver.StreamRequestHandler,
socketserver.BaseRequestHandler):
'''
Handler for mini-dinstall soket commands... | coffeemakr/mini-dinstall-ng | minidinstall_ng/sockethandler.py | Python | gpl-3.0 | 1,493 |
# A simple hive demo. If you do not have a table to load from look run
# MakeHiveTable.py
from pyspark import SparkContext
from pyspark.sql import HiveContext
import json
import sys
if __name__ == "__main__":
if len(sys.argv) != 3:
print "Error usage: LoadHive [sparkmaster] [inputtable]"
sys.exit(-... | holdenk/learning-spark-examples | src/python/LoadHive.py | Python | mit | 761 |
import pytest
@pytest.fixture
def create_repo(remote, token):
"""
Creates a Repository "testrepo0" with a mirror "http://www.sample.com/path/to/some/repo" and the attribute
"mirror_locally=0".
:param remote: The xmlrpc object to connect to.
:param token: The token to authenticate against the remo... | cobbler/cobbler | tests/xmlrpcapi/repo_test.py | Python | gpl-2.0 | 3,559 |
from sympy import sqrt, root, S, Symbol, sqrtdenest, Integral, cos
from sympy.simplify.sqrtdenest import _subsets as subsets
r2, r3, r5, r6, r7, r10, r15, r29 = [sqrt(x) for x in [2, 3, 5, 6, 7, 10,
15, 29]]
def test_sqrtdenest():
d = {sqrt(5 + 2 * r6): r2 + r3,
... | wxgeo/geophar | wxgeometrie/sympy/simplify/tests/test_sqrtdenest.py | Python | gpl-2.0 | 6,554 |
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
FEES_NOTE_STATES = [('draft',_('Draft')),
('prpose',_('Proposed')),
('check',_('Partially Accepted'))
('accept',_('Accepted')),
('piad',_('Paid')),
('canc... | RemiFr82/ck_addons | ck_treasury/models/trs_fees_note.py | Python | gpl-3.0 | 821 |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class GeoDistanceRangeTest(unittest.TestCase, Base):
def test_geo_point(self):
client = self._get_client()
index = client.get_index('test')
index.create(options=True)
doc_type = index.get_doc_type... | jlinn/pylastica | tests/filter/test_geodistancerange.py | Python | apache-2.0 | 1,259 |
"""Implementation of magic functions for interaction with the OS.
Note: this module is named 'osm' instead of 'os' to avoid a collision with the
builtin.
"""
from __future__ import print_function
#-----------------------------------------------------------------------------
# Copyright (c) 2012 The IPython Developmen... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/IPython/core/magics/osm.py | Python | artistic-2.0 | 29,004 |
# HeaderFinder.py
#
# Scans a list of pages for running headers, which we understand as lines, near
# the top of a page, that are repeated within the space of two pages,
# in either direction. The two-page window is necessary because headers
# are sometimes restricted to recto or verso. A very common pattern
# involves... | tedunderwood/genre | features/HeaderFinder.py | Python | mit | 3,834 |
from model.contact import Contact
def test_add_contact(app, db, json_contacts, check_ui):
contact = json_contacts
old_contacts = db.get_contacts_list()
app.contact.create(contact)
new_contacts = db.get_contacts_list()
old_contacts.append(contact)
if check_ui:
assert sorted(old_contacts... | wojab/python_training | test/test_add_contact.py | Python | apache-2.0 | 1,784 |
#from django.test import TestCase as BaseTestCase
from django.test import TestCase
from django.test import Client
from hir.models import Residency, Organization
from mezzanine.conf import settings
import sys
class test_stuff(TestCase):
fixtures = ['hir.json']
print >>sys.stderr, "fixtures? ", fixtures
d... | RichGibson/hir | tests.py | Python | mit | 1,693 |
# 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 u... | pkdevbox/stratos | components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/tenant/events.py | Python | apache-2.0 | 2,909 |
from __future__ import print_function
from sublime import Region, load_settings
from sublime_plugin import TextCommand
from collections import Iterable
DEBUG = False
def dbg(*msg):
if DEBUG:
print(' '.join(map(str, msg)))
class MyCommand(TextCommand):
def set_cursor_to(self, pos):
""" Set... | xsleonard/sublime-MoveByParagraph | move_by_paragraph.py | Python | mit | 6,621 |
LOG_SETTINGS = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'detailed': {
'format': '%(asctime)s | %(process)d | %(levelname)s | %(filename)s | %(lineno)d | %(funcName)s | %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S'
},
'simpl... | Hydrosys4/Master | loggerconfig.py | Python | gpl-3.0 | 1,697 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import logging
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MinValueValidator, MaxValueValidator
from common.utils import signer
from .base import BaseUser
from .asset import Asset
__all__ = [... | zsjohny/jumpserver | apps/assets/models/user.py | Python | gpl-2.0 | 7,355 |
import json
import os
import re
import subprocess
from setuptools import setup, find_packages, Command
from bfg9000.app_version import version
root_dir = os.path.abspath(os.path.dirname(__file__))
class Coverage(Command):
description = 'run tests with code coverage'
user_options = [
('test-suite=', ... | jimporter/bfg9000 | setup.py | Python | bsd-3-clause | 7,676 |
# This file is part of OtfBot.
#
# OtfBot 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.
#
# OtfBot is distributed in the hope that it... | otfbot/otfbot | otfbot/plugins/webServer/count.py | Python | gpl-2.0 | 3,777 |
# coding=utf-8
# Copyright 2021 DeepMind Technologies Limited.
#
# 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 applic... | deepmind/jax_verify | jax_verify/src/mip_solver/cvxpy_relaxation_solver.py | Python | apache-2.0 | 7,868 |
__version__ = "0.10.6" # noqa
| jdowner/gist | gist/version.py | Python | mit | 31 |
"""Base classes that are extended by low level AMQP frames and higher level
AMQP classes and methods.
"""
class AMQPObject(object):
"""Base object that is extended by AMQP low level frames and AMQP classes
and methods.
"""
NAME = 'AMQPObject'
INDEX = None
def __repr__(self):
items =... | blacktear23/py-servicebus | servicebus/pika/amqp_object.py | Python | bsd-3-clause | 1,659 |
from __future__ import division
from sympy import *
from sympy.plotting import plot
from sympy.functions import exp
from sympy.core.containers import Tuple
x,y,rs = symbols('x y r',real=True)
c = symbols('c')
r = sqrt(x**2+y**2)
phi = symbols(r'\phi',cls=Function)
diffphix2 = diff(diff(phi(r),x),x)
diffphix4 = diff(... | martinjrobins/filter_modelling | particular_wendland.py | Python | gpl-3.0 | 870 |
def convert_to_binary(decimal_number):
binary_rep = ""
quotient = decimal_number / 2
remainder = decimal_number % 2
while (quotient != 0):
if remainder == 0:
binary_rep = "0" + binary_rep
else:
binary_rep = "1" + binary_rep
remainder = quotient % 2
quotient = quotient / 2
if remain... | cynngah/virtualsynthesizer | convert_to_binary.py | Python | mit | 427 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import frappe
from frappe.model.document import Document
class TopBarItem(Document):
pass | mhbu50/frappe | frappe/website/doctype/top_bar_item/top_bar_item.py | Python | mit | 193 |
# -*- coding: utf-8 -*-
# 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... | shakhat/rally-runners | doc/source/conf.py | Python | apache-2.0 | 2,461 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
#
# export_af3.py
#
# Copyright 2010 Basmanov Illya <ffsdmad@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 Foundatio... | ffsdmad/af-web | cgi-bin/plugins/export_af3.py | Python | gpl-3.0 | 4,988 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "interrogator.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sirmmo/interrogator | manage.py | Python | apache-2.0 | 255 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import datetime
import random
import unittest
import dateutil.tz
import MySQLdb
import MySQLdb.cursors
import _mysql_exceptions
import basetranslate
import config
class ShortDBConn(object):
"""Connection to Short database.
Args:
data_table_name: name of... | dandersson/shortweb | swlib/dbinteraction.py | Python | gpl-2.0 | 12,341 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
from test import test_support
import marshal
import sys
import unittest
import os
class IntTestCase(unittest.TestCase):
def test_ints(self):
# Test the full range of Python ints.
n = sys.maxint
while n:
for expected in (-n, n):... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.7/Lib/test/test_marshal.py | Python | mit | 10,572 |
"""
Copyright 2020 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... | googleinterns/nlu-seq2graph | src/utils.py | Python | apache-2.0 | 1,791 |
#! /usr/bin/env python3
"""Team Password Manager administration via the API.
See http://teampasswordmanager.com/docs/api/ for specification.
Created 2015 by Mark Ruys <mark.ruys@peercode.nl>, Peercode BV
"""
__version__ = '1.0'
import json
import hmac
import hashlib
import time
import requests
class TPMException(E... | markruys/tpmadmin | tpmadmin.py | Python | mit | 5,460 |
from __future__ import print_function, unicode_literals, absolute_import
from agstools._helpers import create_argument_groups, execute_args, format_output_path
from ._helpers import open_map_document
def create_parser_save_copy(parser):
parser_copy = parser.add_parser("copy", add_help = False,
help = "Sav... | DavidWhittingham/agstools | agstools/arcpyext/_copy.py | Python | bsd-3-clause | 1,390 |
#pyCGM
# Copyright (c) 2015 Mathew Schwartz <umcadop@gmail.com>
# Core Developers: Seungeun Yeon, Mathew Schwartz
# Contributors Filipe Alves Caixeta, Robert Van-wesep
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software")... | cadop/pyCGM | HPC/pyCGM.py | Python | mit | 121,384 |
from JumpScale import j
app = j.tools.cuisine._getBaseAppClass()
class CuisineCaddy(app):
NAME = "caddy"
def __init__(self, executor, cuisine):
self._executor = executor
self._cuisine = cuisine
def install(self, ssl=False, start=True, dns=None, reset=False):
"""
Move bi... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/cuisine/apps/CuisineCaddy.py | Python | apache-2.0 | 3,794 |
import wx
import wx.grid
import numpy as N
ID=wx.ID_ANY
class TableBase(wx.grid.PyGridTableBase):
'''
#data is the abundance input of type OrderedDict.
# data: is a dataframe. columns are the level names and the
value rows are the database hierarhcies. ... | ecotox/pacfm | pacfm/view/gui/helper/data/grid_panel.py | Python | mit | 3,005 |
##############################################################################
# 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... | EmreAtes/spack | var/spack/repos/builtin/packages/mc/package.py | Python | lgpl-2.1 | 2,230 |
"""
Django settings for myclass project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
#... | wasit7/tutorials | django/Pieng/myclass/myclass/settings.py | Python | mit | 3,183 |
import json
import re
import datetime
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
try:
from mongoengine.base import ValidationError
except ImportError:
from mongoengine.errors import... | ckane/crits | crits/domains/handlers.py | Python | mit | 35,445 |
"""
The xml_simple_reader.py script is an xml parser that can parse a line separated xml text.
This xml parser will read a line seperated xml text and produce a tree of the xml with a document element. Each element can have an attribute table, childNodes, a class name, parentNode, text and a link to the document elem... | Pointedstick/ReplicatorG | skein_engines/skeinforge-44/fabmetheus_utilities/xml_simple_reader.py | Python | gpl-2.0 | 25,544 |
# -*- coding: utf-8 -*-
if __name__ == "__main__":
from nipype.interfaces.slicer.generate_classes import generate_all_classes
# NOTE: For now either the launcher needs to be found on the default path, or
# every tool in the modules list must be found on the default path
# AND calling the module with ... | carolFrohlich/nipype | nipype/interfaces/mipav/generate_classes.py | Python | bsd-3-clause | 2,614 |
from __future__ import unicode_literals
import sys
from django.utils.translation import ugettext_lazy as _
if sys.version_info.major != 2:
unicode = str
class GeneralError(object):
http_status = 500
name = 'general'
text = _('General OpenID error.')
@property
def msg(self):
return... | shenek/django-mojeid-auth | django_mojeid/errors.py | Python | bsd-2-clause | 2,248 |
import npyscreen
from npyscreen import NPSAppManaged
from pytg import Telegram
from pygram import __version__
from pygram.actionform import PyGramForm
from pygram.config import TELEGRAM_CLI_PATH, PUBKEY_FILE
TG = Telegram(telegram=TELEGRAM_CLI_PATH,
pubkey_file=PUBKEY_FILE)
class PyGramApp(NPSAppManag... | RedXBeard/pygram | pygram/app.py | Python | mit | 728 |
import os
from typing import List, Tuple
import psycopg2
from psycopg2.extensions import AsIs
from slackclient import SlackClient
api_token = os.environ.get('POINTY_APP_TOKEN')
def check_all_scores(conn, team_id: str, retry: bool = True) -> List[Tuple[str, int]]:
with conn.cursor() as cur:
try:
... | AlexLloyd1/pointy-mcpointface | pointy/database/team.py | Python | mit | 3,151 |
# -*- coding: utf-8 -*-
import re
from collections import OrderedDict
from odoo import api, fields, models, _
from PIL import Image
from cStringIO import StringIO
import babel
from odoo.tools import html_escape as escape, posix_to_ldml, safe_eval, float_utils
from .qweb import unicodifier
import logging
_logger = logg... | chienlieu2017/it_management | odoo/odoo/addons/base/ir/ir_qweb/fields.py | Python | gpl-3.0 | 16,571 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.