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 __future__ import absolute_import
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for the Earth and Planetary Sciences
# Copyright (C) 2012 - 2015 by the BurnMan team, released under the GNU
# GPL v2 or later.
import scipy.optimize as opt
from . import equation_of_state as eos
from ..t... | bobmyhill/burnman | burnman/eos/morse_potential.py | Python | gpl-2.0 | 7,014 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-03-06 02:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ticketing', '0008_auto_20160305_1840'),
]
operations = [
migrations.AlterFie... | himadriganguly/featurerequest | ticketing/migrations/0009_auto_20160306_0248.py | Python | gpl-3.0 | 671 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# This is the runner of this task: it reads the input, and then executes the
# function 'min3nombres' of the solution
import sys, traceback
# Import the function min3nombres from the solution
try:
from solution import min3nombres
except:
# Remove the runner fr... | France-ioi/taskgrader | examples/taskRunner/tests/gen/runner.py | Python | mit | 696 |
# coding=utf-8
# Copyright 2014 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)
import os
import re
... | pombredanne/pants | contrib/android/tests/python/pants_test/contrib/android/tasks/test_aapt_builder_integration.py | Python | apache-2.0 | 3,770 |
import os
def read_file(path):
lines = []
with open(path, "r", encoding="utf-8") as f:
lines = f.readlines()
lines = [ln.strip(os.linesep) for ln in lines]
return lines
def write_file(path, rows, separator="\t"):
with open(path, "wb") as outfile:
for row in rows:
... | icoxfog417/python_training | basic/file_service.py | Python | mit | 557 |
import unittest
import os
import printapp
import flask
from printapp.api import _has_supported_filetype
import printapp.test.util
class ApiTestCase(unittest.TestCase):
def setUp(self):
printapp.app.secret_key = 'test key'
printapp.app.config['TESTING'] = True
self.get_client = printapp... | tylervz/calvinwebprint | src/printapp/test/test-api.py | Python | mit | 8,634 |
from django.test import TestCase, tag
from ..lab import AliquotType, LabProfile, ProcessingProfile, RequisitionPanel
from ..lab import PanelAlreadyRegistered, ProcessingProfileInvalidDerivative
from ..lab import RequisitionPanelError, Process, InvalidProcessingProfile
from ..lab import RequisitionPanelModelError
cla... | botswana-harvard/edc-lab | edc_lab/tests/test_lab_profile.py | Python | gpl-2.0 | 6,159 |
#!/usr/bin/env python
import os
import sys
import xapi
import xapi.storage.api.plugin
from xapi.storage import log
class Implementation(xapi.storage.api.plugin.Plugin_skeleton):
def query(self, dbg):
return {
"plugin": "tapdisk",
"name": "The tapdisk user-space datapath plugin",
... | jjd27/xapi-storage-datapath-plugins | src/tapdisk/plugin.py | Python | lgpl-2.1 | 1,061 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This file is part of DaBroker, a distributed data access manager.
##
## DaBroker is Copyright © 2014 by Matthias Urlichs <matthias@urlichs.de>,
## it is licensed under the GPLv3. See th... | smurfix/DaBroker | dabroker/__init__.py | Python | gpl-3.0 | 2,194 |
"""Test fixtures for integration tests only"""
# pylint: disable=redefined-outer-name
from datetime import datetime
import os
from pathlib import Path
import pytest
import requests
from redcap import Project
SUPER_TOKEN = os.getenv("REDCAPDEMO_SUPERUSER_TOKEN")
def create_project(url: str, super_token: str, proje... | redcap-tools/PyCap | tests/integration/conftest.py | Python | mit | 2,373 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | djkonro/client-python | kubernetes/test/test_v1_network_policy_spec.py | Python | apache-2.0 | 893 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#******************************************************************************
# $Id$
#
# Project: GDAL Python Interface
# Purpose: Application for converting raster data to a vector polygon layer.
# Author: Frank Warmerdam, warmerdam@pobox.com
#
#*****************... | worldbank/cv4ag | utils/gdal_polygonize.py | Python | mit | 6,981 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the EPRCOIN-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
inF... | EPRCOIN/EPRCOIN | share/qt/clean_mac_info_plist.py | Python | mit | 895 |
#!/usr/bin/env python
import pyscf
r = 1.1941
mol = pyscf.gto.M(
atom=[['C', (0.0, 0.0, 0.0)],
['N', (0.0, 0.0, r)]],
basis='sto-3g',
spin=1,
verbose=1,
symmetry=False,
)
if __name__ == '__main__':
from pyci.tests.test_runner import test_runner
test_runner(mol)
| shivupa/pyci | examples/cn_sto3g.py | Python | gpl-3.0 | 305 |
import binascii
import itertools
import os
import time
import numpy
import six
import chainer
from chainer import configuration
from chainer import cuda
from chainer import function
from chainer.functions.activation import relu
from chainer.functions.activation import tanh
from chainer.functions.array import concat
f... | kiyukuta/chainer | chainer/functions/connection/n_step_rnn.py | Python | mit | 36,446 |
# changegroup.py - Mercurial changegroup manipulation functions
#
# Copyright 2006 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import weakref
from i18n import _
from node import nullrev, nullid,... | ya790206/temp_hg | mercurial/changegroup.py | Python | gpl-2.0 | 26,986 |
import mock
from twisted.trial import unittest
from tests.mocks import mock_conf_settings
from lbrynet.daemon.auth import server
class AuthJSONRPCServerTest(unittest.TestCase):
# TODO: move to using a base class for tests
# and add useful general utilities like this
# onto it.
def setUp(self):
... | zestyr/lbry | tests/unit/lbrynet_daemon/auth/test_server.py | Python | mit | 3,256 |
# Script save model renders for selected cameras (or all aligned cameras if no aligned cameras selected)
# to the same folder where the source photos are present with the "_render" suffix.
#
# This is python script for Metashape Pro. Scripts repository: https://github.com/agisoft-llc/metashape-scripts
import Metashape... | agisoft-llc/photoscan-scripts | src/render_photos_for_cameras.py | Python | mit | 1,728 |
import re
from django.contrib.gis.db import models
class BaseSpatialFeatures:
gis_enabled = True
# Does the database contain a SpatialRefSys model to store SRID information?
has_spatialrefsys_table = True
# Does the backend support the django.contrib.gis.utils.add_srs_entry() utility?
supports_... | theo-l/django | django/contrib/gis/db/backends/base/features.py | Python | bsd-3-clause | 3,370 |
'''import json, pickle
from sklearn.feature_extraction.text import TfidfVectorizer
# load terms
with open('../Dataset/Collection/Stopwords/collection_terms.json', 'r') as f:
collection_terms = json.load(f)
f.close()
# load tf-idf matrix
with open('../Dataset/Collection/Stopwords/collection_tfidf.pkl', 'r' ) as f... | lidalei/IR-Project | src/UnitTest.py | Python | gpl-2.0 | 4,092 |
# -*- coding: UTF-8 -*-
'''
Authorized by vlon Jang
Created on May 16, 2016
Email:zhangzhiwei@ict.ac.cn
From Institute of Computing Technology
All Rights Reserved.
'''
import pandas as pd
import pymysql
from sklearn.linear_model import LinearRegression
from sklearn.ensemble import RandomForestRegressor
fr... | wangqingbaidu/aliMusic | models/run_u_a_model.py | Python | gpl-3.0 | 28,923 |
import json
from django.test import LiveServerTestCase
from data_api.models import Command, LocalComputer, COMMAND_NOOP, Signal, System, Blob, Event, Setting
from vm.base import Configurator
from vm.data_connection import DataConnection
import datetime
import pytz
class TestDataConnection(LiveServerTestCase):
"""... | kietdlam/Dator | vm/tests/test_data_connection.py | Python | mit | 6,916 |
# Copyright (c) 2015 Mirantis, 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 requir... | igor-toga/local-snat | neutron/tests/functional/pecan_wsgi/test_hooks.py | Python | apache-2.0 | 22,555 |
import re
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.contrib.sites.models import Site
from django.db.models import Q
from django.db.models.query import EmptyQuerySet
from django.template import RequestContext
from django.test.client import RequestFactory
from d... | piquadrat/django-cms-search | cms_search/search_indexes.py | Python | bsd-3-clause | 4,930 |
# -*- 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, soft... | zongweil/open-location-code | python/openlocationcode/openlocationcode.py | Python | apache-2.0 | 23,113 |
import time
import dataLoader
from itertools import combinations
positions = dataLoader.loadData("CrowdsourcingResults.csv")
dataLoader.printPositions(positions)
print ""
print ""
bold = lambda val: ("*" + str(val) + "*")
def getHighestKey(positions, pos, key, usedPlayers=[]):
bestPlayer = None
def doBest(pos, be... | ktarrant/freeAgents | freeAgents.py | Python | mit | 2,258 |
import unittest
from app import smartdb, model
from model import MachineCurrentState, MachineInterface, Machine, MachineStates
from repositories import machine_state_repo
class TestMachineStateRepo(unittest.TestCase):
@classmethod
def setUpClass(cls):
db_uri = 'sqlite:///:memory:'
cls.smart ... | kirek007/enjoliver | app/tests/unit/test_machine_state_repo.py | Python | mit | 3,449 |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 05 09:16:37 2016
Code adapted from http://stackoverflow.com/a/26695514
@author: Benben
"""
import time
# Generator that returns time differences
def TicTocGenerator():
initaltime = 0
finaltime = time.time()
while True:
init... | chngchinboon/intercomstats | scripts/tictocgen.py | Python | mit | 802 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2017-05-09 21:48
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | jimga150/HealthNet | HealthNet/messaging/migrations/0001_initial.py | Python | mit | 1,156 |
# -*- coding: utf-8 -*-
import time
import wda
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from PIL import Image
# 截图距离 * time_coefficient = 按键时长
# time_coefficient:
# iphonex: 0.00125
# iphone6: 0.00196
# iphone6s plus: 0.00120
time_coefficient = 0.00120
c = ... | JianmingXia/StudyTest | JumpTool/wechat_jump_iOS_py3.py | Python | mit | 1,667 |
'''
Created on May 15, 2010
@author: ebakan
'''
import sys
if __name__ == '__main__':
ints = sys.stdin.readline().split()
for i in range(len(ints)):
ints[i]=int(ints[i])
while ints[0]<=6 and ints[1]<=6 and ints[2]<=6:
sys.stdout.write("R")
ints[2]+=ints[0]
if ints[2]>6:
... | ebakan/ProCo | ProCo2010/Speed Round/adv01.py | Python | gpl-3.0 | 665 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... | thinkopensolutions/tkobr-addons | tko_partner_multiple_phones/__manifest__.py | Python | agpl-3.0 | 2,154 |
#!/usr/bin/env python
from distutils.core import setup
print "\n\n\n\n************************************************************"
print " If you're installing MyUW, you must also install"
print " each dependency in requirements.txt"
print "*****************************************************... | fanglinfang/myuw | setup.py | Python | apache-2.0 | 473 |
# -*- coding: utf-8 -*-
'''
IPython notebook compatability module for highcharts-python
Adapted from python-nvd3: https://github.com/areski/python-nvd3/blob/develop/nvd3/ipynb.py
'''
try:
_ip = get_ipython()
except:
_ip = None
if _ip and (_ip.__module__.startswith('IPython') or _ip.__module__.startswith('ipy... | kyper-data/python-highcharts | highcharts/ipynb.py | Python | mit | 1,226 |
#!/usr/bin/python3
# TF-IDF library downloaded from: https://github.com/hrs/python-tf-idf
# Slightly modified to be compatible with Python 3.
"""
The simplest TF-IDF library imaginable.
Add your documents as two-element lists `[docname, [list_of_words_in_the_document]]` with `addDocument(docname, list_of_words)`. Ge... | pwalch/joke-scraper | tfidf.py | Python | gpl-3.0 | 1,830 |
from test_base import TestCase
class Test_PageCheck(TestCase):
pages = (
'/mypage.php',
'/new_illust.php',
'/bookmark_new_illust.php',
'/mypixiv_new_illust.php',
'/ranking.php?mode=daily',
'/ranking.php?mode=daily&content=ugoira',
'/ranking_area.php',
'/stacc/p/activity',
'/stacc/... | crckyl/pixplus | test/test01_pagecheck.py | Python | mit | 852 |
# Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
# Only windows 32-bit has different calling conventions.
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sizeof(c_void_p) == sizeof(c_int),
... | zhjunlang/kbengine | kbe/src/lib/python/Lib/ctypes/test/test_win32.py | Python | lgpl-3.0 | 4,199 |
"""equinox_spring16_api URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='hom... | ivanprjcts/equinox-spring16-API | equinox_spring16_api/equinox_spring16_api/urls.py | Python | lgpl-3.0 | 1,431 |
# -*- encoding: utf-8 -*-
"""
staticdhcpdlib.databases.generic
================================
Provides a uniform datasource API, to be implemented by technology-specific
backends.
Legal
-----
This file is part of staticDHCPd.
staticDHCPd is free software; you can redistribute it and/or modify
it under the terms of t... | flan/staticdhcpd | staticDHCPd/staticdhcpdlib/databases/generic.py | Python | gpl-3.0 | 11,915 |
from theano import tensor
from theano.scan_module import until
from blocks.bricks import Initializable
from blocks.bricks.base import lazy, application
from blocks.roles import add_role, WEIGHT
from blocks.utils import shared_floatx_nans
from blocks.bricks.recurrent import BaseRecurrent, recurrent
class ConditionedR... | EderSantana/blocks_contrib | bricks/recurrent.py | Python | mit | 6,518 |
import io
from collections import Counter
import kenlm
from extract import extract_candidates_only
model_file = '/home/alvas/test/food.arpa'
textfile = '/home/alvas/test/food.txt'
model = kenlm.LanguageModel(model_file)
fout = io.open('food.candidates', 'w', encoding='utf8')
for text, candidates in extract_candida... | alvations/Terminator | terminator/extract_candidates.py | Python | mit | 395 |
class ContactHelper:
def __init__(self, app):
self.app = app
def add_new_contact(self, contact):
self.open_add_contact_page()
self.fill_contact_form(contact)
self.submit_contact()
def modify_first_contact(self, contact):
wd = self.app.wd
# start modify co... | GiSDeCain/Python_Kurs_Ex1 | fixture/contact.py | Python | gpl-3.0 | 4,106 |
"""
user interface for viewing radiation field
"""
import sys
import os
import csv
import time
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.colors as colors # for wigner log scale
import numpy as np
import logging
from ocelot.gui.settings_plot import *
from ocelot.adaptors.genesis import *
fr... | ocelot-collab/ocelot | ocelot/gui/dfl_plot.py | Python | gpl-3.0 | 61,275 |
# Copyright (C) 2002-2007 Python Software Foundation
# Contact: email-sig@python.org
"""Email address parsing code.
Lifted directly from rfc822.py. This should eventually be rewritten.
"""
__all__ = [
'mktime_tz',
'parsedate',
'parsedate_tz',
'quote',
]
import time
SPACE = ' '... | ericlink/adms-server | playframework-dist/play-1.1/python/Lib/email/_parseaddr.py | Python | mit | 15,467 |
#MenuTitle: Export Open Instances to InDesign 1.0
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Export all open instances in OTF in Indesign font's folder.
"""
import os, glob, shutil
from os.path import expanduser
# path to the folder where all files will be ... | filipenegrao/glyphsapp-scripts | old_stuff/exportAllOpenInstances2Indesign.py | Python | apache-2.0 | 1,545 |
import colorsys
import random
import math
import kmath
class KColor:
def __init__(self, red, green, blue, alpha):
self.red = red
self.green = green
self.blue = blue
self.alpha = alpha
def normalize(self):
m = max(self.red, self.green, self.blue)
self.red /= m
... | simian201/Kykliskos | src/color.py | Python | gpl-3.0 | 2,612 |
import os
import csv
import numpy as np
from eqep.interpolation.rbf_pgvinterpolator import RbfPGVInterpolator
class EarthQuake:
"""Stores the data of an earthquake
It has a grid of coordinates with a certain (interpolated)
peak ground velocity for every cell.
This class is usually used in combinatio... | TGM-HIT/eqep-api | eqep/data/earthquake.py | Python | mit | 3,507 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
import urllib3
except:
print('BlastPDB requires urllib3')
class BlastPDB:
"""BlastPDB - run Blast online on the PDB database.
This can be used in Jupiter based RNA notebooks, e.g.
https://github.com/mmagnus/rna-pdb-tools/blob/master/rp18.ipynb
... | m4rx9/rna-pdb-tools | rna_tools/BlastPDB.py | Python | mit | 1,305 |
#!/usr/bin/env python3
import string
import sys
import os
import subprocess
import json
import argparse
import re
DMCC_ROOT = os.path.join( os.getcwd(), ".." )
LOG_FILE = open( "build_rules.log", "w" )
RULES_DIR = os.path.join( DMCC_ROOT, "BuildRules" )
DEPLOY_DIR = os.path.join( DMCC_ROOT, "Deploy" )
MAKE_DI... | benjaminy/DoesMyCodeCompile | Source/process_build_rules.py | Python | apache-2.0 | 5,830 |
from django.db import models
class Tag(models.Model):
market = models.ManyToManyField('markets.Market', related_name='tags')
tag = models.CharField(verbose_name='Tag', unique=True, max_length=255)
| we-inc/mms-snow-white-and-the-seven-pandas | webserver/apps/tags/models.py | Python | mit | 207 |
#!/usr/bin/env python
"""
Copyright (C) 2013 Legoktm
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, merge, publi... | legoktm/mtirc | tests/main.py | Python | mit | 4,313 |
# Copyright 2014 VMware, 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 by ... | CingHu/neutron-ustack | neutron/db/migration/alembic_migrations/versions/1421183d533f_nsx_dhcp_metadata.py | Python | apache-2.0 | 2,169 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
"""
@author: Raven
@contact: aducode@126.com
@site: https://github.com/aducode
@file: __init__.py
@time: 2016/2/9 23:05
""" | aducode/Gaeapy | gaea/__init__.py | Python | apache-2.0 | 165 |
import ambush
import VS
import Director
import directions_mission
class ambush_scan(ambush.ambush):
def __init__(self,savevar,systems,delay,faction,numenemies,dyntype='',dynfg='',greetingText=["You have been scanned and contraband has been found in your hold.","You should have dumped it while you had the chance.","... | vegastrike/Assets-Production | modules/missions/ambush_scan.py | Python | gpl-2.0 | 2,799 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'painindex.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'', include('... | xanv/painindex | painindex/urls.py | Python | mit | 398 |
import datetime
import os
from utilities import load_template
def create_sidebar(caches, index_template, target, cache_dir):
header_template = load_template('sidebar_header')
item_template = load_template('sidebar_item')
img_template = load_template('sidebar_img')
desc_template = load_template('sideba... | flopp/safari | py/sidebargen.py | Python | mit | 2,550 |
# General ES Constants
COUNT = 'count'
CREATE = 'create'
DOCS = 'docs'
FIELD = 'field'
FIELDS = 'fields'
HITS = 'hits'
ID = '_id'
INDEX = 'index'
INDEX_NAME = 'index_name'
ITEMS = 'items'
KILOMETERS = 'km'
MAPPING_DYNAMIC = 'dynamic'
MAPPING_MULTI_FIELD = 'multi_field'
MAPPING_NULL_VALUE = 'null_value'
MILES = 'mi'
OK ... | wan/bungee | bungee/const.py | Python | bsd-2-clause | 978 |
from rctk.layouts.layouts import Layout
class TabbedLayout(Layout):
type = "tabbed"
| rctk/rctk | rctk/layouts/tabbed.py | Python | bsd-2-clause | 89 |
#!/usr/bin/env python
# We attempted to make this program work with both python2 and python3
"""This script takes a set of files and a cluster configuration describing a set of machines.
It uploads the files to the given machines in round-robin fashion.
The script can also be given an optional schema file.
Th... | mbudiu-vmw/hiero | bin/upload-data.py | Python | apache-2.0 | 3,589 |
"""
http://code.google.com/codejam/contest/8284486/dashboard
"""
from .util import (SolverBase, sum_of_int_cube, sum_of_int_square,
sum_of_int)
class SquareCountSolver(SolverBase):
def __call__(self):
result = []
for line in self._iter_input():
n_dots, n_col = self._... | aliciawyy/dmining | puzzle/square_count.py | Python | apache-2.0 | 1,204 |
import uuid
from django.db import models
class TestModel(models.Model):
name = models.CharField(max_length=50, default='test data')
class TestForeignKey(models.Model):
name = models.CharField(max_length=50)
test_fk = models.ForeignKey(TestModel, on_delete=models.CASCADE)
class TestM2M(models.Model):
... | soynatan/django-easy-audit | easyaudit/tests/test_app/models.py | Python | gpl-3.0 | 1,664 |
def f():
return 'string'
with f() as a:
a = 3
a = {}
| clark800/pystarch | test/testcases/with.py | Python | mit | 64 |
# HF XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# HF X
# HF X f90wrap: F90 to Python interface generator with derived type support
# HF X
# HF X Copyright James Kermode 2011
# HF X
# HF X These portions of the source code are released under the GNU General
# HF X Public License, ve... | davidovitch/f90wrap | f90wrap/transform.py | Python | gpl-2.0 | 42,373 |
from django.db import models
from django.contrib import admin
import datetime, time
from mptt.models import MPTTModel, TreeForeignKey
class Location(MPTTModel):
name = models.CharField(max_length=45)
description = models.TextField(blank=True)
created_at = models.DateTimeField(auto_now_add = True)
upd... | holachek/ecosense | app/grapher/models.py | Python | mit | 3,408 |
import sys, os
import csv
import mysql.connector
from mysql.connector.constants import ClientFlag
import traceback
class SendDataToMysql:
def __init__(self):
self = self
def add_test_cases_to_h2o(self):
#Connect to mysql database
h2o = mysql.connector.connect(client_flags=[ClientFlag.... | YzPaul3/h2o-3 | scripts/send_to_mysql.py | Python | apache-2.0 | 3,583 |
# F3AT - Flumotion Asynchronous Autonomous Agent Toolkit
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
# 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... | f3at/feat | src/feat/test/common.py | Python | gpl-2.0 | 22,319 |
import happybase
from StringIO import StringIO
from PIL import Image
def decode_image_PIL(binary_data):
""" Returns PIL image from binary buffer.
"""
f = StringIO(binary_data)
img = Image.open(f)
return img
if __name__=="__main__":
tab_image = 'image_cache'
col_image = dict()
col_imag... | svebk/DeepSentiBank_memex | scripts/tests/deprecated/read_image_from_hbase.py | Python | bsd-2-clause | 875 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: xbuf/skeletons.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as... | xbuf/blender_io_xbuf | modules/xbuf/skeletons_pb2.py | Python | gpl-3.0 | 5,338 |
#!/usr/bin/python
#
version = 'version 0.2'
author = 'duncan@linuxbandwagon.com'
#
# $Id: ringd.py,v 1.17 2002/05/06 14:46:24 master Exp $
#
# Simple re-implementation of the old perl ringd program in python.
#
# Does not do as much logging.
#
# duncan@linuxbandwagon.com
#
# THIS SOFTWARE IS COPYRIGHT 2001,2002 ... | DuncanRobertson/ringd | ringd.py | Python | gpl-2.0 | 13,907 |
# coding: utf-8
"""
Compatibility functions for unified behavior between Python 2.x and 3.x.
:author: Alex Grönholm
"""
from __future__ import unicode_literals, absolute_import
import inspect
import sys
from threading import Thread
if sys.version_info[0] < 3:
def items(d):
return d.items()
def iteri... | fouzelddin/py4j | py4j-python/src/py4j/compat.py | Python | bsd-3-clause | 2,249 |
'''
Copyright 2015 Serendio Inc.
Author - Satish Palaniappan
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 ... | serendio-labs-stage/diskoveror-ml-server | SentimentThrift/SentiHandlers/comments.py | Python | apache-2.0 | 2,344 |
# -*- coding: utf-8 -*-
import recommonmark
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# ht... | jolynch/mit-tab | docs/conf.py | Python | mit | 5,647 |
"""
WSGI config for simple_web_scraper project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("D... | fcv/simple-web-scraper | simple_web_scraper/wsgi.py | Python | mit | 709 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from itertools import groupby
from compas.geometry import Point
from compas.geometry import NurbsCurve
from compas_rhino.conversions import point_to_rhino
from compas_rhino.conversions import point_to_compas
... | compas-dev/compas | src/compas_rhino/geometry/curves/nurbs.py | Python | mit | 9,820 |
'''
Postprocess teensy ouput
~~~~~~~~~~~~~~~~~~~~~~~~
'''
import argparse
import csv
import time
import os
import sys
def create_filename (Kp, Ki, Kd, setpoint):
parts = [
'teensy-output',
'Kp={}'.format(Kp),
'Ki={}'.format(Ki),
'Kd={}'.format(Kd),
time.strftime('%... | blubber/silvia | util/postprocess.py | Python | apache-2.0 | 1,962 |
# -*- coding: cp1251 -*-
# Object umbenennen
import win32com.client
dso = win32com.client.GetObject("LDAP:")
obj = dso.OpenDSObject("LDAP://DC=funkegrp/DC=de", "funkegrp\\p0532", "geheim#15", 0)
print(obj)
#obj.MoveHere("LDAP://DC=ru/DC=domen/OU=podrazdelenie/CN=_TestAdmin", "CN=_CoolAdmin")
| AlexFortLabs/MyPythonLabs | Sammelsurium/AD-Rename-LDAP.py | Python | gpl-3.0 | 299 |
from pylons_common.lib.exceptions import *
from pylons_common.lib.date import convert_date
from pylons_common.lib.log import create_logger
logger = create_logger('pylons_common.lib.decorators')
__all__ = ['zipargs', 'stackable', 'enforce']
def zipargs(decorated_fn):
"""
This will zip up the positional args ... | benogle/pylons_common | pylons_common/lib/decorators.py | Python | mit | 7,740 |
# -*- coding: utf-8 -*-
"""
Django settings for project 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.pa... | mpessanha/projeto-controle | project/settings.py | Python | gpl-2.0 | 3,505 |
# coding: utf8
# Copyright 2015 Vincent Jacques <vincent@vincent-jacques.net>
import unittest
import MockMockMock
def compute_checksum(payload):
return ~(sum(payload)) & 0xFF
# @todo Extract in exceptions.py (Easier to document)
class CommunicationError(Exception):
"""
@todoc
"""
pass
class... | jacquev6/Pynamixel | Pynamixel/bus.py | Python | mit | 4,563 |
import NavigationInstance
from time import localtime, mktime, gmtime
from ServiceReference import ServiceReference
from enigma import iServiceInformation, eServiceCenter, eServiceReference, getBestPlayableServiceReference
from timer import TimerEntry
class TimerSanityCheck:
def __init__(self, timerlist, newtimer=None... | XTAv2/Enigma2 | lib/python/Components/TimerSanityCheck.py | Python | gpl-2.0 | 10,362 |
data = (
' a/c ', # 0x00
' a/s ', # 0x01
'C', # 0x02
'', # 0x03
'', # 0x04
' c/o ', # 0x05
' c/u ', # 0x06
'', # 0x07
'', # 0x08
'', # 0x09
'g', # 0x0a
'H', # 0x0b
'H', # 0x0c
'H', # 0x0d
'h', # 0x0e
'', # 0x0f
'I', # 0x10
'I', # 0x11
'L', # 0x12
'l', # 0x13
'... | wilsonrivera/scalider-v2 | tools/UnidecodeDataCompiler/data/x021.py | Python | apache-2.0 | 4,012 |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^dashboard/', include('dashboard.urls')),
url(r'^manager/', include('manager.urls')),
# Core URLS
url(r'^$', 'dashboard.views.index', name='index'),
url(... | ajrbyers/statpage | src/core/urls.py | Python | gpl-2.0 | 429 |
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import os
import tempfile
import shutil
import itertools
import platform
from nose.tools import raises, assert_raises
import mock
import numpy as np
import PIL.Image
from . import parse_folder as _
class TestUnescape():
def test_hello(self):
... | delectable/DIGITS | tools/test_parse_folder.py | Python | bsd-3-clause | 11,183 |
request = {
"method": "GET",
"uri": uri("/test"),
"version": (1, 1),
"headers": [
("USER-AGENT", "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1"),
("HOST", "0.0.0.0=5000"),
("ACCEPT", "*/*")
],
"body": b""
}
| urbaniak/gunicorn | tests/requests/valid/002.py | Python | mit | 296 |
# -*- coding: utf-8 -*-
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS 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 versio... | ppiotr/Bibedit-some-refactoring | modules/bibformat/lib/elements/bfe_report_numbers.py | Python | gpl-2.0 | 1,519 |
"""
File: email_vsas.py
Author: Levi Bostian (bostianl@uni.edu)
Description: Class for sending emails.
***NOTE***
Can only send with 1 email address.
Following commands to get to work:
emailObj = SendEmail()
emailObj.setRecipient("test@te... | levibostian/VSAS | VSAS system/VSAS/Motion/email_vsas/email_vsas.py | Python | mit | 5,160 |
"""hug/this.py.
The Zen of Hug
Copyright (C) 2019 Timothy Edmund Crosley
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... | timothycrosley/hug | hug/this.py | Python | mit | 1,771 |
#!/usr/bin/python
from distutils.core import setup
setup(name = 'vips8',
version = '7.28.0dev',
description = 'vips-8.x image processing library',
long_description = open('README.txt').read(),
license = 'LGPL'
author = 'John Cupitt',
author_email = 'jcupitt@gmail.com',
url = 'http://www.vi... | Web5design/libvips | python/setup.py | Python | lgpl-2.1 | 390 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
# Based on https://groups.google.com/d/topic/sqlalchemy/cQ9e9IVOykE/discussion
# By David Gardner (dgardne... | mvidalgarcia/indico | indico/core/db/sqlalchemy/custom/static_array.py | Python | mit | 2,413 |
import random
import gmpy2
import binascii
FLAG = b"# Who knows :)"
p = gmpy2.next_prime(random.SystemRandom().getrandbits(512))
q = gmpy2.next_prime(random.SystemRandom().getrandbits(512))
n = p * q
e = 65537
phi = (p-1) * (q-1)
d = gmpy2.invert(e, phi)
print('''
Welcome to our RSA Secure Oracle!
We have anti-hack... | Qwaz/solved-hacking-problem | GoogleCTF/2020 Hackceler8/chals/in-game-ctf-12/chal.py | Python | gpl-2.0 | 1,190 |
# -*- coding: utf-8 -*-
# This file is part of visvalingamwyatt.
# https://github.com/fitnr/visvalingamwyatt
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2015, fitnr <contact@fakeisthenewreal.org>
"""visvalingamwyatt module tests"""
import json
import os
import unit... | fitnr/visvalingamwyatt | tests/test_vw.py | Python | mit | 7,733 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
'''
sota.sha256
'''
from .sha256 import sha256
| sota/lang | sota/sha256/__init__.py | Python | mit | 97 |
import logging
from csirtgsdk.client.http import HTTP as Client
class Search(object):
"""
Search Object class
"""
def __init__(self, client=Client()):
"""
:param client: client.Client object
:return: Search Object
"""
self.logger = logging.getLogger(__name__)
... | csirtgadgets/csirtgsdk-py | csirtgsdk/search.py | Python | mpl-2.0 | 730 |
from setuptools import setup
setup(
name='vmfusion',
version='0.2.0',
author='Mario Steinhoff',
author_email='steinhoff.mario@gmail.com',
packages=['vmfusion'],
url='https://github.com/msteinhoff/vmfusion-python',
license='LICENSE.txt',
description='A python API for the VMware Fusion CL... | msteinhoff/vmfusion-python | setup.py | Python | mit | 438 |
#!/usr/bin/env python
# A tool to parse ASTMatchers.h and update the documentation in
# ../LibASTMatchersReference.html automatically. Run from the
# directory in which this file is located to update the docs.
import collections
import re
import urllib2
MATCHERS_FILE = '../../include/clang/ASTMatchers/ASTMatchers.h'
... | jeltz/rust-debian-package | src/llvm/tools/clang/docs/tools/dump_ast_matchers.py | Python | apache-2.0 | 9,746 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
本测试模块用于测试与 :class:`sqlite4dummy.schema.MetaData` 有关的方法
class, method, func, exception
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from sqlite4dummy import *
from sqlite4dummy.tests.basetest import *
from datetime import dateti... | MacHu-GWU/sqlite4dummy-project | sqlite4dummy/tests/functionality/test_MetaData.py | Python | mit | 5,883 |
'''
Copyright (C) 2013-2014 Robert Powers
This file is part of MikeNetGUI.
MikeNetGUI is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mike... | bopowers/MikenetGUI | lib/tabs.py | Python | gpl-3.0 | 63,418 |
from pandajedi.jedicore.FactoryBase import FactoryBase
from pandajedi.jediconfig import jedi_config
# logger
from pandacommon.pandalogger.PandaLogger import PandaLogger
logger = PandaLogger().getLogger(__name__.split('.')[-1])
# factory class for throttling
class JobThrottler (FactoryBase):
# constructor
de... | RRCKI/panda-jedi | pandajedi/jediorder/JobThrottler.py | Python | apache-2.0 | 1,083 |
import numpy as np
import sys
"""
Module of bandit algorithms
Bandit algorithms should implement the following methods:
1. __init__(B): constructor that takes a Bandit Simulator object.
2. init(T): prepare to run for T rounds, wipe state, etc.
3. updated(x,a,r): update any state using the current interaction
4. get_a... | akshaykr/oracle_cb | Bandits.py | Python | mit | 2,706 |
import tensorflow as tf
"""tf.reduce_logsumexp(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)
功能:沿着维度axis计算log(sum(exp())),除非keep_dims=True,输出tensor保持维度为1。
输入:axis:默认为None,即沿所有维度求和。"""
a = tf.constant([[0, 0, 0], [0, 0, 0]], dtype=tf.float64)
z = tf.reduce_logsumexp(a)
z2 = tf.reduce_log... | Asurada2015/TFAPI_translation | math_ops_advanced_function/tf_reduce_logsumexp.py | Python | apache-2.0 | 674 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.