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 . import test_dumpedmocktask
from .test_cacheabletask_directory import MixInTestDataDirectory
class TestDumpedMockTaskDirectory(MixInTestDataDirectory,
test_dumpedmocktask.TestDumpedMockTask):
pass
| tkf/buildlet | buildlet/tests/test_dumpedmocktask_directory.py | Python | bsd-3-clause | 243 |
# imports
import bpy
# object data
def ObjectData(self, context, layout, datablock):
'''
Object data buttons.
'''
if datablock.type != 'EMPTY':
# template id
layout.template_ID(datablock, 'data')
else:
if datablock.empty_draw_type == 'IMAGE':
layout.tem... | proxeIO/name-panel | addon/interface/buttons/objectdata.py | Python | gpl-3.0 | 25,779 |
## features.py
##
## Copyright (C) 2003-2004 Alexey "Snake" Nezhdanov
##
## 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, or (at your option)
## any later... | lezizi/A-Framework | python/net-soruce/src/xmpp/features.py | Python | apache-2.0 | 8,760 |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 27 00:36:01 2016
@author: Tian
"""
import sys
import re
TYPE_STR='<type> should be one of: func, cut, dug, other'
def _procCommon(header, data, headHeader, regPat, regRep):
newHeader=headHeader+header;
newData=[]
cr=re.compile(regPat)
for line in data:
... | yxtj/GSDM | SupportScript/tabularize-summary.py | Python | apache-2.0 | 3,107 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | lib_openshift/apis/apis.py | Python | apache-2.0 | 5,018 |
"Yang/Wu's OEP implementation, in PyQuante."
from math import sqrt
import settings
from PyQuante.NumWrap import zeros,matrixmultiply,transpose,dot,identity,\
array,solve
from PyQuante.Ints import getbasis, getints, getJ,get2JmK,getK
from PyQuante.LA2 import geigh,mkdens,trace2,simx
from PyQuante.hartree_fock impo... | berquist/PyQuante | PyQuante/OEP.py | Python | bsd-3-clause | 25,427 |
#!/usr/bin/env python3
# Copyright 2019 IBM Corp.
#
# 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 requir... | open-power-ref-design-toolkit/cluster-genesis | scripts/python/configure_data_switches.py | Python | apache-2.0 | 26,960 |
# -*- coding: utf-8 -*-
from django.db import models
class QueueItemManager(models.Manager):
def append(self, video):
return self.create(related_video=video)
def get_next(self):
try:
return self.get_queryset().select_related().\
filter(error=False).order_by('upload... | samsath/cpcc_backend | src/mediastore/mediatypes/video/managers.py | Python | gpl-3.0 | 426 |
from vigra import *
def computeFeatures():
pass
class FilterList(object):
def __init__(self, shape):
pass
filterList = FilterList()
| timoMa/vigra | vigranumpy/examples/rag_features.py | Python | mit | 161 |
# coding: utf-8
"""
AuthenticationApi.py
Copyright 2015 SmartBear Software
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 req... | fernandog/Medusa | lib/tvdbapiv2/apis/authentication_api.py | Python | gpl-3.0 | 7,036 |
"""Module containing a memory memory manager which provides a sliding window on a number of memory mapped files"""
import os
import sys
import mmap
from mmap import mmap, ACCESS_READ
try:
from mmap import ALLOCATIONGRANULARITY
except ImportError:
# in python pre 2.6, the ALLOCATIONGRANULARITY does not exist as... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/smmap/util.py | Python | agpl-3.0 | 10,076 |
from math import *
octree_node_size = 112
def recurse(depth):
if depth == 0:
return 1
else:
return pow(8, depth) + recurse(depth - 1)
def octree_size(depth):
return recurse(depth) * octree_node_size
print("Size %d" % (octree_size(3)))
| galek/anki-3d-engine | docs/drafts/octree.py | Python | bsd-3-clause | 246 |
INT_MAX = 2 ** 31 - 1
class Solution:
def divide(self, dividend: int, divisor: int) -> int:
if dividend == 0 or divisor == 1:
return dividend
if divisor == -1:
return -dividend if -dividend < INT_MAX else INT_MAX
sign = 1
if (dividend < 0 and divisor > 0) or... | BigEgg/LeetCode | Python/LeetCode/_001_050/_029_DivideTwoIntegers.py | Python | mit | 918 |
import logging
from django.contrib import messages
from django.contrib.auth import get_user_model, authenticate, login
from django.contrib.auth.models import User
from django.urls import reverse
from django.http import HttpResponse, HttpResponseRedirect, HttpRequest
from django.shortcuts import render
from django.cont... | luisen14/treatment-tracking-project | treatment_tracker/researchers/views.py | Python | apache-2.0 | 3,823 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <[email protected]>
#
# 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/L... | kiall/designate-py3 | designate/backend/impl_powerdns/__init__.py | Python | apache-2.0 | 5,270 |
"""
Arithmetic helper functions.
"""
def is_number(s):
"""
Determine if a given input can be interpreted as a number
This is possible for types like float, int and so on.
"""
try:
float(s)
return True
except ValueError:
return False
| mre/tracker | arith.py | Python | lgpl-3.0 | 264 |
# -*- coding: utf-8 -*-
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from email.message import Message
import email.message
import tempfile
import shutil
import socket
import threading
import ssl
import select
import time
import ... | Roguelazer/muttdown | tests/test_basic.py | Python | isc | 10,618 |
"""
Test the SLSQP optimizer driver
"""
import unittest
import numpy
# pylint: disable=F0401,E0611
from openmdao.main.api import Assembly, Component, set_as_top, Driver
from openmdao.main.datatypes.api import Float, Array, Str
from openmdao.lib.casehandlers.api import ListCaseRecorder
from openmdao.main.interfaces im... | HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/openmdao.lib-0.13.0-py2.7.egg/openmdao/lib/drivers/test/test_slsqpdriver.py | Python | gpl-2.0 | 9,605 |
# -*- coding: utf-8 -*-
"""
apps.accounts.models
~~~~~~~~~~~~~~
account related models
:copyright: (c) 2012 by arruda.
"""
import datetime
from decimal import Decimal
from django.db import models
from django.db.models import Sum
from django.utils.translation import ugettext_lazy as _
class User... | arruda/rmr | rmr/apps/accounts/models.py | Python | mit | 2,999 |
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from .job import PretrainedModelJob
__all__ = ['PretrainedModelJob']
| gheinrich/DIGITS-GAN | digits/pretrained_model/__init__.py | Python | bsd-3-clause | 174 |
# coding: utf-8
# pylint: disable=missing-docstring, invalid-name
from __future__ import absolute_import
from google.appengine.api import users
import flask
import auth
import model
import util
from main import app
@app.route('/signin/google/')
def signin_google():
auth.save_request_params()
google_url = ... | sidharta/hansel-app | main/auth/google.py | Python | mit | 1,359 |
#!/usr/bin/python
#
# Copyright 2017 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... | googleads/googleads-adxbuyer-examples | python/samples/v2_x/list_account_level_filter_sets.py | Python | apache-2.0 | 3,206 |
## Script (Python) "getProjectTypes"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=return list of project types
ptypes = { 'Auftragsforschung':'Auftragsforschung',
'Sachverstand':'Sachverstand',
'S... | syslabcom/imu | skins/imu/getProjectTypes.py | Python | gpl-2.0 | 475 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_crm_lead
| jeremiahyan/odoo | addons/crm_livechat/tests/__init__.py | Python | gpl-3.0 | 128 |
from chimera.core.manager import Manager
from chimera.core.chimeraobject import ChimeraObject
from chimera.core.proxy import Proxy
from chimera.core.event import event
from nose.tools import assert_raises
import time
import math
class Publisher (ChimeraObject):
def __init__ (self):
... | wschoenell/chimera_imported_googlecode | src/chimera/core/tests/test_events.py | Python | gpl-2.0 | 3,578 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import genetics
def main(argv):
spectrum = files.read_line_of_ints(argv[0])
counts = genetics.convolution_counts(spectrum)
print ' '.join(str(c) for c in genetics.convolution_list(counts))
if __nam... | cowboysmall/rosalind | src/textbook/rosalind_ba4h.py | Python | mit | 362 |
"""
WSGI config for Databaes project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | stevetu717/Databaes | Databaes/wsgi.py | Python | mit | 394 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SetVectorStyle.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
************************... | t-hey/QGIS-Original | python/plugins/processing/algs/qgis/SetVectorStyle.py | Python | gpl-2.0 | 2,499 |
import pytest
from api.base.settings.defaults import API_BASE
from api_tests import utils
from osf_tests.factories import (
AuthUserFactory,
ProjectFactory,
)
@pytest.mark.django_db
class TestFileMetadataRecordsList:
@pytest.fixture()
def user(self):
return AuthUserFactory()
@pytest.fix... | Johnetordoff/osf.io | api_tests/files/views/test_file_metadata_records_list.py | Python | apache-2.0 | 2,185 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/clusterfuzz | src/clusterfuzz/_internal/tests/core/bot/fuzzers/mutator_plugin_test.py | Python | apache-2.0 | 6,800 |
import textfsm
from utils import read_txt_file, convert_uptime
def parse_get_facts(text):
tplt = read_txt_file("textfsm_templates/fastiron_show_version.template")
t = textfsm.TextFSM(tplt)
result = t.ParseText(text)
if result is not None:
(os_version, model, serial_no, day, hour, minute, se... | gaberger/napalm-brocade-fastiron | napalm_brocade_fastiron/utils/parsers.py | Python | apache-2.0 | 561 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py | Python | mit | 8,706 |
#!/usr/bin/env python
# Copyright (C) 2006-2017 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... | MTG/essentia | test/src/unittests/highlevel/test_coversongsimilarity.py | Python | agpl-3.0 | 3,115 |
from setuptools import setup, find_packages
#install_requires = open('requirements.txt').readlines()
setup(name='moxie-feedback',
version='0.1',
packages=find_packages(),
description='Feedback module for Moxie',
author='Mobile Oxford',
author_email='[email protected]',
url='https://git... | ox-it/moxie-feedback | setup.py | Python | apache-2.0 | 497 |
"""Implement the rules of each Java build utility type."""
import json
import logging
import os
import subprocess
import mool.jar_merger as jm
import mool.shared_utils as su
import mool.jar_testng_runner as testng_runner
JAVA_VERSION_DEP_RULE_TYPES = [su.JAVA_BIN_TYPE, su.JAVA_LIB_TYPE,
... | rocketfuel/mool | build_tool/bu.scripts/mool/java_common.py | Python | bsd-3-clause | 20,823 |
"""customized version of pdb's default debugger.
- sets up a history file
- uses ipython if available to colorize lines of code
- overrides list command to search for current block instead
of using 5 lines of context
"""
try:
import readline
except ImportError:
readline = None
import os
import os.path as os... | h2oloopan/easymerge | EasyMerge/clonedigger/logilab/common/debugger.py | Python | mit | 5,651 |
from collections import OrderedDict
import itertools
import pandas as pd
import numpy as np
import pandas.util.testing as tm
from pandas_battery.tools.attrdict import attrdict
__all__ = ['frame_targets']
N = 10000
COLS = 5
FLAT_N = N * COLS
shape = (N, COLS)
data_types = OrderedDict()
data_types['int'] = range(N)
... | dalejung/pandas-battery | pandas_battery/target/frame.py | Python | mit | 1,571 |
# coding=utf-8
"""Send SMS using SMS API (currently only Free Mobile)"""
import re
import socket
import time
import urllib.error
import urllib.request
import urllib.parse
from nemubot import context
from nemubot.exception import IMException
from nemubot.hooks import hook
from nemubot.tools.xmlparser.node import Modu... | nbr23/nemubot | modules/sms.py | Python | agpl-3.0 | 5,550 |
# -*- coding: utf-8 -*-
# Copyright 2015, 2018 Juca Crispim <[email protected]>
# This file is part of toxicbuild.
# toxicbuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of ... | jucacrispim/toxicbuild | toxicbuild/core/vcs.py | Python | agpl-3.0 | 15,719 |
import urllib2
from bs4 import BeautifulSoup
from lxml import html
page = urllib2.urlopen("http://www.atlasobscura.com/articles/fleeting-wonders-miles-of-seaweed-choking-caribbean-beaches").read()
soup = BeautifulSoup(page)
taglist = [elem.get_text() for elem in soup.select('span.tags-list a')]
print taglist[1]
tagl... | facemelters/data-science | Atlas/parse_atlas.py | Python | gpl-2.0 | 353 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields
class account... | ClearCorp/account-financial-tools | account_transfer/models/account_journal.py | Python | agpl-3.0 | 559 |
__source__ = 'https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/verify-preorder-sequence-in-binary-search-tree.py
# Time: O(n)
# Space: O(1)]
# Stack
#
# Description: Leetcode # 255. Verify Preorder Sequence in Binary Se... | JulyKikuAkita/PythonPrac | cs15211/VerifyPreorderSequenceinBinarySearchTree.py | Python | apache-2.0 | 4,042 |
from hashlib import sha1
from django.core.cache import cache
from django.utils.encoding import smart_str
def cached(key=None, timeout=300):
"""
Cache the result of function call.
Args:
key: the key with which value will be saved. If key is None
then it is calculated automatically
... | govtrack/django-lorien-common | common/cache.py | Python | bsd-3-clause | 1,136 |
import os, sys, time
from glob import glob
import cv2
from pylab import *
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.backends.backend_pdf import PdfPages
matplotlib.rcParams['figure.facecolor'] = 'w'
from scipy.signal import argrelextrema
import scipy.stats as stats
import scipy.io as sio
from scipy imp... | i-namekawa/TopSideMonitor | plotting.py | Python | bsd-3-clause | 37,323 |
from django.db import models
class Event(models.Model):
name = models.CharField(max_length=50)
description = models.CharField(default=None, max_length=500)
date = models.DateField()
post_code = models.CharField(max_length=20)
contact_number = models.CharField(default=None, max_length=20)
| Glasgow2015/team-10 | project/events/models.py | Python | apache-2.0 | 311 |
from __future__ import absolute_import, division, print_function
import contextlib
import os
import platform
import socket
import sys
import textwrap
from tornado.testing import bind_unused_port
# Delegate the choice of unittest or unittest2 to tornado.testing.
from tornado.testing import unittest
skipIfNonUnix = u... | legnaleurc/tornado | tornado/test/util.py | Python | apache-2.0 | 4,446 |
# -*- coding: utf-8 -*-
#
# Positronic Brain - Opinionated Buildbot Workflow
# Copyright (C) 2014 Develer S.r.L.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# ... | develersrl/positronic-brain | positronic/brain/artifact.py | Python | gpl-2.0 | 3,920 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "rospy;tf2".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "tf2_py"
PROJECT_SPACE_DIR = ... | UnbDroid/robomagellan | Codigos/Raspberry/desenvolvimentoRos/build/tf2_py/catkin_generated/pkg.installspace.context.pc.py | Python | gpl-3.0 | 395 |
import os
from datetime import datetime
from PyQt5.QtWidgets import QWizard, QFileDialog
from ..guiresources.export_wizard_auto import Ui_ExportWizard
from ..utils import injector, system_util
from ..utils.exporters import json_exporter, csv_exporter
class ExportWizard(QWizard, Ui_ExportWizard):
def __init__(se... | MalloyDelacroix/DownloaderForReddit | DownloaderForReddit/gui/export_wizard.py | Python | gpl-3.0 | 3,166 |
# this file contains a set of classes that are 'pollable' objects.
"""
This file contains a set of classes called 'pollables'. A pollable is an object with a start(), cancel()
and poll() method. It encapsulates some set of asyncronous functionality that is started and monitored
for completion. The poll() method retu... | buzztroll/cloudinit.d | cloudinitd/pollables.py | Python | apache-2.0 | 20,714 |
import MySQLdb
import time
import cgi
from youtube_upload import *
from config import *
from text2html import *
# creating youtube object
youtube = Youtube(DEVELOPER_KEY)
debug("Login to Youtube API: email='%s', password='%s'" %
(EMAIL, "*" * len(PASSWORD)))
try:
youtube.login(EMAIL, PASSWORD)
except gdata.s... | kirti3192/spoken-website | cron/old/test-outl.py | Python | gpl-3.0 | 1,995 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) 2005-2009 Skomoroh
#
# This program is free software... | shlomif/PySolFC | pysollib/tile/soundoptionsdialog.py | Python | gpl-3.0 | 8,082 |
import unittest
from lyric_engine.modules.petitlyrics import PetitLyrics as Lyric
class PetitLyricsTest(unittest.TestCase):
def test_url_01(self):
url = 'https://petitlyrics.com/lyrics/914421'
obj = Lyric(url)
obj.parse()
self.assertEqual(obj.title, '猫背')
self.assertEqual(o... | franklai/lyric-get | lyric_engine/tests/test_petitlyrics.py | Python | mit | 1,090 |
# Copyright (c) 2013 - 2019 Adam Caudill and Contributors.
# This file is part of YAWAST which is released under the MIT license.
# See the LICENSE file or go to https://yawast.org/license/ for full license details.
from dns import resolver, exception, reversename
from yawast.shared import output
def get_ips(dom... | adamcaudill/yawast | yawast/scanner/plugins/dns/basic.py | Python | mit | 2,561 |
n = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
print(' '.join(map(str, reversed(arr))))
| rootulp/hackerrank | python/arrays-ds.py | Python | mit | 131 |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | mgagne/nova | nova/objects/pci_device_pool.py | Python | apache-2.0 | 3,410 |
# -*- coding: utf-8 -*-
import django
# location of patterns, url, include changes in 1.4 onwards
try:
from django.conf.urls import patterns, url, include
except ImportError:
from django.conf.urls.defaults import patterns, url, include
# in Django>=1.5 CustomUser models can be specified
if django.VERSION >=... | daafgo/Server_LRS | oauth_provider/compat.py | Python | apache-2.0 | 1,738 |
# -*- coding: utf-8 -*-
"""
Acceptance tests for CMS Video Editor.
"""
from nose.plugins.attrib import attr
from .test_studio_video_module import CMSVideoBaseTest
@attr('shard_2')
class VideoEditorTest(CMSVideoBaseTest):
"""
CMS Video Editor Test Class
"""
def setUp(self):
super(VideoEditorT... | eestay/edx-platform | common/test/acceptance/tests/video/test_studio_video_editor.py | Python | agpl-3.0 | 22,804 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Johann Prieur <[email protected]>
#
# 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) an... | billiob/papyon | papyon/service/AddressBook/scenario/groups/group_delete.py | Python | gpl-2.0 | 1,542 |
from cyder.cydns.views import CydnsDeleteView
from cyder.cydns.views import CydnsDetailView
from cyder.cydns.views import CydnsCreateView
from cyder.cydns.views import CydnsUpdateView
from cyder.cydns.views import CydnsListView
from cyder.cydns.cname.models import CNAME
from cyder.cydns.cname.forms import CNAMEForm
c... | ngokevin/cyder | cyder/cydns/cname/views.py | Python | bsd-3-clause | 808 |
# -*- coding: utf-8 -*-
import os
from datetime import datetime
from flask import (Blueprint, request, current_app, session, url_for, redirect,
render_template, g, flash, abort)
from flask_babel import gettext
from sqlalchemy.sql.expression import false
import store
from db import db
from models i... | ehartsuyker/securedrop | securedrop/journalist_app/main.py | Python | agpl-3.0 | 8,317 |
# Zadání:
#########
#
# Program načte kladné reálné číslo (označme ho x) a poté načte další kladné
# reálné číslo (označme ho y).
# Program vypočte logaritmus čísla x o základu y metodou půlení intervalu.
# Výsledek nalezněte s přesností na 8 desetinných míst (výpočet ukončíte
# pokud |x1−x2|<0.000000001.
# Použití něj... | malja/cvut-python | cviceni02/log.py | Python | mit | 2,700 |
from model.group import Group
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ['number of groups', 'file'])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "data/groups.json"
for o, a in opt... | Exesium/python_training | generator/group.py | Python | gpl-3.0 | 984 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Document.public'
db.add_column('mediaman_document', 'public', self.gf('django.db.models.fi... | uq-eresearch/uqam | mediaman/migrations/0006_auto__add_field_document_public.py | Python | bsd-3-clause | 20,584 |
#!/usr/bin/env python
#
# Author: Qiming Sun <[email protected]>
#
import numpy
from pyscf import gto, scf
'''
Concatenate two molecule enviroments
We need the integrals from different bra and ket space, eg to prepare
initial guess from different geometry or basis, or compute the
transition properties between two... | gkc1000/pyscf | examples/gto/21-concatenate_molecules.py | Python | apache-2.0 | 3,094 |
"""A chart parser and some grammars. (Chapter 22)"""
# (Written for the second edition of AIMA; expect some discrepanciecs
# from the third edition until this gets reviewed.)
from utils import *
#______________________________________________________________________________
# Grammars and Lexicons
def Rules(**rules... | ttalviste/aima | aima/nlp.py | Python | mit | 8,297 |
#!/usr/bin/env python3
import unittest
import itertools
import string
import random
import strjump
class TestCase(unittest.TestCase):
def test_compiler1(self):
string = [
'1:',
strjump.Reference(1),
',2:',
strjump.Reference(2),
'|',
... | ffunenga/strjump | tests/test_compiler.py | Python | mit | 4,964 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/compiler/tensorrt/test/int32_test.py | Python | apache-2.0 | 3,216 |
# PAY.JP Python bindings
# Configuration variables
api_key = None
api_base = 'https://api.pay.jp'
api_version = None
# TODO include Card?
__all__ = ['Account', 'Card', 'Charge', 'Customer', 'Event', 'Plan', 'Subscription', 'Token', 'Transfer']
# Resource
from payjp.resource import ( # noqa
Account, Charge, Cus... | moriyoshi/payjp-python | payjp/__init__.py | Python | mit | 372 |
#coding=utf-8
from datetime import datetime
import random
import numpy as np
import matplotlib.pyplot as plt
INF = 1000
BOUNDVAL = 1000
PATHLINE = []
def inf_set(cost_matrix,n):
for i in xrange(n):
for j in xrange(n):
if cost_matrix[i,j] > 900:
cost_matrix[i,j] = INF
def init... | CharLLCH/work-for-py | alg-train/hamilton-train3/hamilton.py | Python | gpl-2.0 | 6,538 |
# Stairbuilder - Stringer generation
#
# Generates stringer mesh for stair generation.
# Stair Type (typ):
# - id1 = Freestanding staircase
# - id2 = Housed-open staircase
# - id3 = Box staircase
# - id4 = Circular staircase
# Stringer Type (typ_s):
# - sId1 = Classic
# - sId2 = ... | Passtechsoft/TPEAlpGen | blender/release/scripts/addons_contrib/add_mesh_building_objects/stringer.py | Python | gpl-3.0 | 26,985 |
# -*- coding:utf-8 -*-
"""
/***************************************************************************
qgsplugininstallerinstallingdialog.py
Plugin Installer module
-------------------
Date : June 2013
Copyright ... | medspx/QGIS | python/pyplugin_installer/qgsplugininstallerinstallingdialog.py | Python | gpl-2.0 | 7,267 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os.path
from textwrap import dedent
import pytest
from pants.backend.go import target_type_rules
from pants.backend.go.target_types import GoMo... | pantsbuild/pants | src/python/pants/backend/go/util_rules/first_party_pkg_test.py | Python | apache-2.0 | 13,175 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# TODO:
# Ability to set CPU/Memory reservations
try:
import json
except ImportError:
import simplejson as json
HAS_PYSPHERE = False
try:
from pysphere import VIServer, VIProperty, MORTypes
from pysphere.resources import VimService_services as VI
from py... | axilleas/ansible-modules-core | cloud/vmware/vsphere_guest.py | Python | gpl-3.0 | 42,629 |
import hashlib
import logging
import os
import tempfile
import pickle
import random
import shutil
import string
import sys
class BlockMD5(object):
def __init__(self):
return None
def compare_blocks(offset, name1, name2):
'''compare two files byte-by-byte'''
info = os.stat(name1)
... | stevec7/iointegrity | iointegrity/iotools.py | Python | bsd-3-clause | 9,607 |
from django.urls import path
from . import views
urlpatterns = [
path('openid/login/', views.login, name="openid_login"),
path('openid/callback/', views.callback, name='openid_callback'),
]
| bittner/django-allauth | allauth/socialaccount/providers/openid/urls.py | Python | mit | 201 |
def http_datetime( dt=None ):
if not dt:
import datetime
dt = datetime.datetime.utcnow()
else:
try:
dt = dt - dt.utcoffset()
except:
pass # no timezone offset, just assume already in UTC
s = dt.strftime('%a, %d %b %Y %H:%M:%S GMT')
return s
de... | Dorwido/wowapi | wowapi/utilities.py | Python | mit | 2,021 |
# coding: utf-8
# Constants
USER = 'user'
XIMPIA = 'ximpia'
TWITTER = 'twitter'
FACEBOOK = 'facebook'
LINKEDIN = 'linkedin'
GOOGLE = 'google'
EMAIL = 'email'
SMS = 'sms'
READ = 'read'
UPDATE = 'update'
NET = 'net'
DELETE = 'delete'
WF = 'wf'
ZONE = 'zone'
GROUP = 'group'
CONDITION = 'condition'
COND... | Ximpia/ximpia | ximpia/xpcore/constants.py | Python | apache-2.0 | 760 |
"""
Electron transport chain (Oxidative phosphorylation) reaction rates
and mitochondial ion fluxes
"""
import common_const as cc
from config import USE_NUMPY_FUNCS, USE_NUMBA
if USE_NUMPY_FUNCS:
from numpy import sqrt, exp
DEL_PSI_B = +50.0 # Mitocondrial boundary potential (mV)
OFFSET_POTENTIAL = +91.0 # (mV)... | SosirisTseng/hearts-of-silicon | hos/ode/mito/oxphos_cortassa2006.py | Python | mit | 4,028 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import os.path as op
import math
import sys
import logging
from itertools import groupby, islice, cycle, izip
from Bio import SeqIO
from jcvi.apps.base import OptionParser, ActionDispatcher, sh, debug, need_update, \
mkdir, popen
debug()
FastaExt ... | sgordon007/jcvi_062915 | formats/base.py | Python | bsd-2-clause | 30,705 |
# Copyright 2011-2015 Therp BV <https://therp.nl>
# Copyright 2016 Opener B.V. <https://opener.am>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.modules.registry import Registry
from odoo.osv.expression import AND
from ..blacklist import (
BLACKLIST... | OCA/server-tools | upgrade_analysis/wizards/upgrade_install_wizard.py | Python | agpl-3.0 | 3,888 |
__author__ = 'joel'
from torrent import Torrent
import requests
from requests.auth import HTTPBasicAuth
class ruTorrentCommand(object):
__path = None
__post_data = None
__ru_torrent_instance = None
def __init__(self, path, post_data):
self.__path = path
self.__post_data = post_data
... | joelbitar/rfinder | rutorrent/commands.py | Python | lgpl-3.0 | 3,875 |
from django.contrib.auth.models import User
from django.db import models
class Article(models.Model):
title = models.CharField(max_length=30)
headline = models.CharField(max_length=100)
body = models.TextField()
author = models.ForeignKey(User)
create_date = models.DateField(auto_now_add=True)
... | azul-cloud/django-rest-server | blog/models.py | Python | mit | 366 |
import unittest
from models.words import Word
class SaddamTest(unittest.TestCase):
def test_get_word(self):
word_class = Word()
word = word_class.generar_palabra()
self.assertEqual('MORIN', word) | dimh/saddam | test/words_test.py | Python | gpl-3.0 | 224 |
from functools import reduce
from .homogeneous import Translation, UniformScale, Rotation, Affine, Homogeneous
def transform_about_centre(obj, transform):
r"""
Return a Transform that implements transforming an object about
its centre. The given object must be transformable and must implement
a metho... | patricksnape/menpo | menpo/transform/compositions.py | Python | bsd-3-clause | 4,180 |
#!/usr/bin/env python
import boto.ec2.autoscale
import boto.ec2.cloudwatch
def monitor(app):
return True
def init(app):
regions = ['us-east-1']
cloudwatch = {}
for r in regions:
cloudwatch[r] = boto.ec2.cloudwatch.connect_to_region(r)
| yadudoc/cloud_kotta | theWhip/whip.py | Python | apache-2.0 | 268 |
input = """
a | b.
a? %, not b ?
"""
output = """
a | b.
a? %, not b ?
"""
| veltri/DLV2 | tests/parser/query.22.test.py | Python | apache-2.0 | 83 |
#!/usr/bin/env python
# Remove .egg-info directory if it exists, to avoid dependency problems with
# partially-installed packages (20160119/dphiffer) ... | whosonfirst/py-mapzen-whosonfirst-pip-utils | setup.py | Python | bsd-3-clause | 1,676 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.sql_db.operations import HqRunPython
def copy_emails_to_email_list(apps, schema_editor):
BillingContactInfo = apps.get_model('accounting', 'BillingContactInfo')
for contact_info in BillingContactInf... | qedsoftware/commcare-hq | corehq/apps/accounting/migrations/0015_datamigration_email_list.py | Python | bsd-3-clause | 1,091 |
# Copyright 2016 Susan Bennett, David Mitchell, Jim Nicholls
#
# This file is part of AutoHolds.
#
# AutoHolds 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 opt... | SydneyUniLibrary/auto-holds | staff/models.py | Python | gpl-3.0 | 2,771 |
from distutils.core import setup
setup(
name='metwit-weather',
version='0.1.0',
packages=[
'metwit',
],
description='Metwit weather API client library',
author='Davide Rizzo',
author_email='[email protected]',
url='http://github.com/metwit/metwit-python',
classifiers=[
... | metwit/metwit-python | setup.py | Python | bsd-3-clause | 598 |
"""Test IAM Policy templates are valid JSON."""
import json
import jinja2
import pytest
from foremast.iam.construct_policy import render_policy_template
from foremast.utils.templates import LOCAL_TEMPLATES
def iam_templates():
"""Generate list of IAM templates."""
jinjaenv = jinja2.Environment(loader=jinja2... | gogoair/foremast | tests/iam/test_iam_valid_json.py | Python | apache-2.0 | 1,609 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_child_tasks
from . import test_sale_project
| jeremiahyan/odoo | addons/sale_project/tests/__init__.py | Python | gpl-3.0 | 163 |
# -*- coding: utf-8 -*-
"""
===============================================================================
Crystal structure classes (:mod:`sknano.core.crystallography._xtal_structures`)
===============================================================================
.. currentmodule:: sknano.core.crystallography._xta... | scikit-nano/scikit-nano | sknano/core/crystallography/_xtal_structures.py | Python | bsd-2-clause | 23,024 |
'''
Test Exception handling for Create VM
@author: Quarkonics
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.operations.primarysto... | zstackio/zstack-woodpecker | integrationtest/vm/simulator/negative/test_imagestore_nfs_create_vm.py | Python | apache-2.0 | 5,242 |
#! /usr/bin/python2.7
# -*- coding: utf-8 -*-
import os
import re
import sys
import math
import gevent
from gevent import monkey; monkey.patch_all()
import requests
import utils
from settings import BASEURL, DIR, PAGE_SIZE
def convert(assembly_id):
baseurl = '%sAGE_FROM=%d&AGE_TO=%d' % (BASEURL['list'], assembl... | lexifdev/crawlers | bills/meta/html.py | Python | agpl-3.0 | 1,875 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jaggu303619/asylum | openerp/addons/event_sale/event_sale.py | Python | agpl-3.0 | 4,880 |
# Internal Modules
import blockbuster.config_services
import blockbuster.bb_dbconnector_factory as bb_dbinterface
# Process a 'Current Status' command
def current_status(request):
# Create an analytics record for the request
bb_dbinterface.DBConnectorInterfaceFactory()\
.create().add_analytics_record... | mattstibbs/blockbuster-server | blockbuster/bb_command_processor.py | Python | mit | 1,771 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import numpy as np
__author__ = 'Yuji Ikeda'
class FCReorderer(object):
@staticmethod
def reorder_fc(fc, indices):
fc_reordered = np.full_like(fc,... | yuzie007/ph_analysis | ph_analysis/fc/fc_reorderer.py | Python | mit | 546 |
"""
Runs OCR on a given file.
"""
from os import system, listdir
from PIL import Image
from pytesseract import image_to_string
import editdistance
from constants import DATA_DIR
def classify(image, people_class, max_classify_distance=1, min_nonclassify_distance=3):
"""
Runs an OCR classifier on a given image... | kavigupta/61a-analysis | src/ocr.py | Python | gpl-3.0 | 1,475 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.