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 |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/policies/tf_py_policy_test.py | Python | apache-2.0 | 8,513 |
#!/usr/bin/env python
# Name: wordsworth
# Description: Frequency analysis tool
# Author: autonomoid
# Date: 2014-06-22
# Licence: GPLv3
#
# 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... | Geoion/wordsworth | wordsworth.py | Python | gpl-3.0 | 11,214 |
# -------------------------------------------------------------------------
# * This program reads a (text) data file and computes the mean, minimum,
# * maximum, and standard deviation. The one-pass algorithm used is due to
# * B.P. Welford (Technometrics, vol. 4, no 3, August 1962.)
# *
# * NOTE: the text data... | pdsteele/DES-Python | uvs.py | Python | mit | 2,844 |
#!/usr/bin/env python
import json, sys, struct
length = 64
registers = 128
# fields = {
# "opcode": 7,
# "register": 7,
# "43bit immediate": 43,
# "50bit immediate": 50
# }
# form:
# %i = instruction lexical code (eg. mov, add, mul, shr)
# %r = integer register (eg. r0, r1, r2...)
# %n = integer literal (e... | brgmnn/uob-cpu-simulator | language.py | Python | mit | 7,347 |
# A comment, this is so you can read your program later
# Anything after # is ignored by pyton
print "I Could have code like this" #and the comment after is ignored
# You can also use a comment to "disable" or comment out a piece of code:
# print "This won't run."
print "This will run." | Torugo/learnpythonthehardway | ex2.py | Python | mit | 290 |
import numpy as np
from scipy.misc import imread, imsave
from glob import glob
# This function allows us to place in the
# brightest pixels per x and y position between
# two images. It is similar to PIL's
# ImageChop.Lighter function.
def chop_lighter(image1, image2):
s1 = np.sum(image1, axis=2)
s2 = np.sum(i... | ebressert/ScipyNumpy_book_examples | python_examples/scipy_36_ex2.py | Python | mit | 1,073 |
"""Setup script for the TROLS Stats project.
"""
import setuptools
PACKAGES = [
'configa>=1.0.0',
'dropbox>=7.2.1',
'filer>=1.0.0',
'lxml>=3.7.2',
'pylint>=1.6.4',
'pytest>=2.9.2',
'pytest-cov>=2.3.0',
'sphinx_rtd_theme>=0.1.10a0',
'twine',
'Sphinx>=1.4.5',
]
SETUP_KWARGS = {
... | loum/trols-stats | setup.py | Python | gpl-2.0 | 1,039 |
# Copyright 2014, Doug Wiegley (dougwig), A10 Networks
#
# 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... | dougwig/a10-neutron-lbaas | a10_neutron_lbaas/tests/unit/test_base.py | Python | apache-2.0 | 3,354 |
"""URLs for API and sample views."""
from django.conf.urls import include, patterns, url
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView
from mdn.urls import mdn_urlpatterns
from webplatformcompat.v1.routers import router as v1_router
from webplatformcompat.v2.routers im... | jwhitlock/web-platform-compat | webplatformcompat/urls.py | Python | mpl-2.0 | 1,426 |
class Solution:
def __init__(self, arr):
n, m = len(arr), len(arr[0])
self.arr = arr
self.values = {m*i+j: arr[i][j] for i in range(n) for j in range(m)}
self.visitedEdge = set()
self.visitedNode = [False for i in range(n*m)]
self.ans = -float('inf')
def _in_las... | opethe1st/CompetitiveProgramming | Hackerrank/WeekOfCode/35/matrix_land.py | Python | gpl-3.0 | 1,994 |
from dataArtist.widgets.Tool import Tool
PLOT_SYMBOLS = ['None', 'o', 's', 't', 'd', '+', 'x']
class Symbols(Tool):
'''
change the graphs symbol
'''
icon = 'symbol.svg'
def __init__(self, plotDisplay):
Tool.__init__(self, plotDisplay)
self.setParameterMenu()
self._menu.... | radjkarl/dataArtist | DUMP/Symbols.py | Python | gpl-3.0 | 1,285 |
"""
A manangement command to populate the new available_date field in all CourseCertificates
in credentials. Accomplished by sending the COURSE_CERT_DATE_CHANGE signal accross all
course runs in the LMS to call a new API in credentials that will populate the date if one
is found.
This command is designed to be ran onc... | edx/edx-platform | openedx/core/djangoapps/credentials/management/commands/update_credentials_available_date.py | Python | agpl-3.0 | 894 |
#
# 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... | lyft/incubator-airflow | tests/providers/amazon/aws/hooks/test_s3.py | Python | apache-2.0 | 12,862 |
from distutils.core import setup, Extension
import os
import socket
hnm = socket.gethostname()
# def read(fname):
# return open(os.path.join(os.path.dirname(__file__), fname)).read()
if 'zog' in hnm:
comedi_poll = Extension('comedi_poll',
include_dirs = ['/usr/local/include'],
... | gentnerlab/pyoperant | setup.py | Python | bsd-3-clause | 1,381 |
"""
Slight abstraction of the filesystem calls to allow for other types of storage
"""
import os
def makedirs(dirname):
if dirname.startswith("s3://"):
# S3 will make the directories when we submit the file
return
else:
assert dirname.startswith("/"), "dirname must be absolute"
bi... | callowayproject/Transmogrify | transmogrify/filesystem/__init__.py | Python | apache-2.0 | 1,051 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QAD Quantum Aided Design plugin
comando PLINE per disegnare una linea
-------------------
begin : 2013-07-15
copyright : iiiii
ema... | geosim/QAD | qad_line_cmd.py | Python | gpl-3.0 | 22,677 |
from django.conf.urls import url
from .views import profile, update
from django.contrib.auth.views import password_change
urlpatterns = [
url(r'^profile/resetpassword/$', password_change, name='reset_password'),
url(r'^profile/(?P<id>\d+)/$', profile, name='profile'),
url(r'^update_profile/(?P<id>\d+)/$', u... | revaxl/library | users/urls.py | Python | mit | 344 |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring, PolyRing, QQ
from jas import startLog, terminate
# ideal intersection example
#r = Ring( "Rat(x,y,z) L" );
r = PolyRing( QQ(), "(x,y,z)", PolyRing.lex );
print "Ring: " + str(r);
print;
ps1 = """
(
( x - 1 ),
( y - 1 ),
( z - 1 )
)
""";
p... | breandan/java-algebra-system | examples/intersect.py | Python | gpl-2.0 | 684 |
"""Parallel workflow execution via SGE
"""
import os
import re
import subprocess
from time import sleep
from .base import (SGELikeBatchManagerBase, logger, iflogger, logging)
from nipype.interfaces.base import CommandLine
def qsubSanitizeJobName(testjobname):
""" Ensure that qsub job names must begin with a let... | FredLoney/nipype | nipype/pipeline/plugins/sge.py | Python | bsd-3-clause | 4,364 |
#!/usr/bin/env python
# Copyright 2017 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 applic... | spxtr/test-infra | kettle/stream.py | Python | apache-2.0 | 9,971 |
# this example shows how to create fillets between two lines
import HeeksPython as cad
cad.sketch()
sketch = cad.getlastobj()
cad.line(0,1,4,1)
l1= cad.getlastobj()
cad.line(4,1,4,2)
l2= cad.getlastobj()
cad.line(4,2,0,2)
l3= cad.getlastobj()
cad.line(0,2,0,1)
l4= cad.getlastobj()
cad.add(sketch,l1)
cad.add(sketch,l2)... | JohnyEngine/CNC | deprecated/heekspython/examples/fillets.py | Python | apache-2.0 | 501 |
# file: client/config.py
config = {
"host": "localhost",
"port": 9999,
"sleep": 5
} | vanzhiganov/pySocket | client/config.py | Python | unlicense | 95 |
# :coding: utf-8
import pytest
import champollion.parser.js_class
@pytest.mark.parametrize(
("content", "expected"),
[
(
(
"/**\n"
" * Simple class\n"
" */\n"
"class SimpleClass {}\n"
),
{
... | buddly27/champollion | test/unit/parser/test_parser_js_class.py | Python | apache-2.0 | 22,754 |
#@PydevCodeAnalysisIgnore
'''
Note that this test is run from org.python.pydev.jythontests.JythonTest
(to have the needed eclipse libraries)
'''
import unittest
import sys
IS_JYTHON = sys.platform.find('java') != -1
#===================================================================================================
#... | smkr/pyclipse | plugins/org.python.pydev.jython/jysrc/tests/test_templates.py | Python | epl-1.0 | 6,214 |
import time
import subprocess
import sys
def CheckHaltFile(haltfilename):
halt = 0
with open(haltfilename,'r') as haltfile:
halt = int(haltfile.readline())
return halt
np = sys.argv[1]
#Number of forecasters in the group
num_forecasters = 1
#Filenames
haltfilename = 'examples/fgroup/halt'
timesfilename = 'exam... | ssmall41/FloodForecasters | forecaster_group_example.py | Python | gpl-2.0 | 2,144 |
# Copyright 2015 OpenStack Foundation
# 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 requ... | ddepaoli3/magnum | magnum/tests/unit/db/test_bay.py | Python | apache-2.0 | 11,781 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
self.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************************... | stevenmizuno/QGIS | python/plugins/processing/algs/gdal/warp.py | Python | gpl-2.0 | 10,402 |
import random
class Card(object):
def __init__(self, card_value, suit):
if card_value == 1:
card_value = "Ace"
if card_value == 11:
card_value = "Jack"
if card_value == 12:
card_value = "Queen"
if card_value == 13:
card_value = "King"
self.card_value = card_value
self.suit = suit
self.next =... | caseymacphee/deck_of_cards | Deck.py | Python | mit | 2,790 |
# -*- coding: utf-8 -*-
import pytest
import time
import unittest.mock
from girder import events
class EventsHelper:
def __init__(self):
self.ctr = 0
self.responses = None
def _raiseException(self, event):
raise Exception('Failure condition')
def _increment(self, event):
... | girder/girder | test/test_events.py | Python | apache-2.0 | 5,259 |
#!/usr/bin/env python
#
# Copyright 2009,2010,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your ... | bastibl/gnuradio | gr-filter/python/filter/pfb.py | Python | gpl-3.0 | 20,042 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_files\structure_dialog.ui'
#
# Created: Tue May 09 09:41:16 2017
# by: pyside-uic 0.2.14 running on PySide 1.1.1
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Dialog(object):
... | eoyilmaz/anima | anima/ui/ui_compiled/structure_dialog_UI_pyside.py | Python | mit | 5,265 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SciFabric LTD.
#
# PyBossa 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 the License, or
# (at your op... | geotagx/pybossa | pybossa/extensions.py | Python | agpl-3.0 | 3,249 |
__author__ = 'Stefan Contiu'
# RESULTS LOG : July 7th, 2015
# Accuracy : 0.993837304848
# Confusion Matrix :
# [[3044 11 2 1]
# [ 2 83 0 0]
# [ 0 0 766 13]
# [ 0 0 1 945]]
from time import time
###############################################
# load from csv training and testing set... | stefan-contiu/ml-crops | DecisionTrees/dt_ml_crops.py | Python | mit | 1,585 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'HouseholdMemberGroup.order'
db.alter_column(u'survey_householdmembergroup', 'order', self... | antsmc2/mics | survey/migrations/0057_auto__chg_field_householdmembergroup_order.py | Python | bsd-3-clause | 24,137 |
import numpy as np
from mpi4py import MPI
from veros import runtime_settings as rs, runtime_state as rst
from veros.distributed import gather
if rst.proc_num == 1:
import sys
comm = MPI.COMM_SELF.Spawn(sys.executable, args=["-m", "mpi4py", sys.argv[-1]], maxprocs=4)
res = np.empty((8, 8))
comm.Recv(... | dionhaefner/veros | test/distributed/gather_kernel.py | Python | mit | 1,219 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, _
class AccountPayment(models.Model):
_inherit = 'account.payment'
def action_process_edi_web_services(self):
return self.move_id.action_process_edi_web_services()... | jeremiahyan/odoo | addons/account_edi/models/account_payment.py | Python | gpl-3.0 | 459 |
import collections
import logging
import os
import re
import subprocess
import sys
from scltests import collection, settings, cfg
from scltests.misc import createrepo, rename_logs
logger = logging.getLogger(__name__)
class BuildCollection(object):
dep_config = None
def __init__(self, scl_name, config_name... | sclorg/scltests | scltests/build.py | Python | gpl-2.0 | 5,282 |
"""
A sliding window of the sample readings.
"""
from collections import namedtuple
import numpy as np
Window = namedtuple(
"Window",
["size", "data"]
)
def create_window(capacity, attrs_count):
""" Creates an initial sliding window. """
window = Window(0, np.zeros((capacity, attrs_count)))
retu... | simonrozsival/mff-ai-anomaly-detector | detector/src/window.py | Python | mit | 769 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/renderbase.py
__version__=''' $Id $ '''
__doc__='''Superclass for renderers to factor out common functionality and default implementations.''... | TaskEvolution/Task-Coach-Evolution | taskcoach/taskcoachlib/thirdparty/src/reportlab/graphics/renderbase.py | Python | gpl-3.0 | 12,798 |
import json
from askmath.entities import TextMessage
from askmath.models.discipline import Discipline as DisciplineModel
from askmath.models.lesson import Lesson as LessonModel
from askmath.models.question import Question as QuestionModel
from django.contrib import messages
from django.contrib.auth.decorators import lo... | saraivaufc/askMathPlus | askmath/views/manager/question/proxyquestion.py | Python | gpl-2.0 | 9,799 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10a1 on 2016-06-21 09:08
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):
dependencies = [
('discussions', '0004_post_a... | Udayraj123/dashboard_IITG | Binder/discussions/migrations/0005_auto_20160621_1438.py | Python | mit | 572 |
#!/usr/bin/env python3
import fea
import numpy as np
import stltovoxel
import stltovoxel.stl_reader
from stltovoxel import slice
from stltovoxel import util
def readVoxels(inputFilePath,resolution=90):
mesh = list(stltovoxel.stl_reader.read_stl_verticies(inputFilePath))
(scale, shift, bounding_box) = stlt... | wredenberg/FAME | FAME.py | Python | gpl-3.0 | 12,571 |
import cProfile
import json
import os
import unittest
from pstats import Stats
from typing import Callable
from draftjs_exporter.constants import BLOCK_TYPES, ENTITY_TYPES
from draftjs_exporter.defaults import BLOCK_MAP, STYLE_MAP
from draftjs_exporter.dom import DOM
from draftjs_exporter.html import HTML
from draftjs... | springload/draftjs_exporter | tests/test_exports.py | Python | mit | 3,660 |
#!/usr/bin/env python3
import acm_cli.main
if __name__ == '__main__':
acm_cli.main.main()
| actics/acmcli | acmcli.py | Python | mit | 96 |
#----------------------------------------------------------------------
# Copyright (c) 2010 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including witho... | dana-i2cat/felix | expedient/src/python/expedient/common/federation/geni/ch.py | Python | apache-2.0 | 15,839 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from ckeditor.views import upload, browse
from utils.decorators import subjudge_auth_required
from django.views.decorators.csrf import csrf_exempt
import autocomplete_light
# OP autodiscover
autocomple... | bruce3557/NTHUOJ_web | nthuoj/urls.py | Python | mit | 1,441 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 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.
from __future__ import unicode_literals
from flask import render_template, session
from indico.modules.e... | mic4ael/indico | indico/modules/events/papers/views.py | Python | mit | 2,534 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# This program is distrib... | archilogic-com/three.js | utils/exporters/blender/addons/io_three/__init__.py | Python | mit | 25,909 |
# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r
__requires__ = """%(spec)r"""
from pkg_resources import require; require("""%(spec)r""")
del require
__file__ = """%(dev_path)r"""
execfile(__file__)
| chriskuehl/kloudless-status | venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/script template (dev).py | Python | mit | 202 |
from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns
from views import customer_views, inventory_views, \
shipment_views, user_views, auth_views, contact_view, \
workorder_views
urlpatterns = [
url(r'^users/(?P<pk>[0-9]+)/$', user_views.UserDetail.as_view... | dannysellers/django_orders | tracker/api/urls.py | Python | gpl-2.0 | 1,763 |
# -*- coding: utf-8 -*-
# petgfunctions.py - This python "helper" script holds a lot of functions
# Copyright (c) 2012-2014 Harry van der Wolf. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public Licence as published
# by... | hvdwolf/pyExifToolGUI | scripts/petgfunctions.py | Python | gpl-3.0 | 115,680 |
"""
My purpose in life is to sync the mesosite stations table to other
databases. This will hopefully remove some hackery
"""
import sys
import numpy as np
from pyiem.util import get_dbconn, get_dbconnstr, logger, utc
from pandas import read_sql
LOG = logger()
def sync(df, dbname):
"""
Actually do the syn... | akrherz/iem | scripts/dbutil/sync_stations.py | Python | mit | 3,895 |
#!/usr/bin/python2.4
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2005-2009 Bastian Kleineidam
"""
Print content of an URL.
"""
import httplib
import urlparse
import sys
def _main():
"""
USAGE: scripts/run.sh test/get.py <url>
"""
if len(sys.argv) != 2:
print _main.__doc__.strip()
sys.... | HomeRad/TorCleaner | test/get.py | Python | gpl-2.0 | 733 |
# -*- coding: utf-8 -*-
"""A modulestore wrapper
It will 'unwrap' ccx keys on the way in and re-wrap them on the way out
In practical terms this means that when an object is retrieved from modulestore
using a CCXLocator or CCXBlockUsageLocator as the key, the equivalent
CourseLocator or BlockUsageLocator will actuall... | ahmedaljazzar/edx-platform | lms/djangoapps/ccx/modulestore.py | Python | agpl-3.0 | 13,437 |
# (c) 2012-2018, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... | chouseknecht/galaxy | galaxy/main/fields.py | Python | apache-2.0 | 2,063 |
#!/usr/bin/env python
"""
Returns namedtuples of disk partitions and their usages.
from a comment here by Giampaolo Rodola:
http://stackoverflow.com/questions/4260116/find-size-and-free-space-of-the-filesystem-containing-a-given-file
"""
import os
from collections import namedtuple
disk_ntuple = namedtuple('partition'... | gboling/Raspberry-Bushcam | diskusage.py | Python | gpl-3.0 | 1,899 |
import pymongo
import bson
import unittest
import mock
import cPickle
from datetime import datetime
from mongoengine import *
from mongoengine.base import _document_registry
from mongoengine.connection import _get_db, connect
import mongoengine.connection
from mock import MagicMock, Mock, call
import pymongo
mongoen... | ContextLogic/mongoengine | tests/document.py | Python | mit | 44,899 |
# (c) 2016, James Tanner
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (... | ansible/ansible | lib/ansible/utils/ssh_functions.py | Python | gpl-3.0 | 2,282 |
from __future__ import print_function
import sys
import time
import random
import lasagne
import numpy as np
from objectives import *
from tabulate import tabulate
np.set_printoptions(precision=4, linewidth=150)
def get_functions(net, obj, input_x, target_y, batch_size, train_size, test_size, optimizer='nesterov',... | ars-ashuha/variational-dropout-sparsifies-dnn | nets/utils.py | Python | gpl-3.0 | 9,372 |
# Copyright (C) 2015-2021 Regents of the University of California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | BD2KGenomics/slugflow | src/toil/test/sort/sortTest.py | Python | apache-2.0 | 12,590 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('oracle', '0005_auto_20140921_1050'),
]
operations = [
migrations.AlterField(
model_name='answer',
na... | rolandgeider/pk15-orakel | oracle/migrations/0006_auto_20140921_1059.py | Python | agpl-3.0 | 426 |
import StringIO
import getpass
import json
import os
import requests
import shutil
import zipfile
from pymotion import __version__
API_RELEASES_URL = 'https://api.github.com/repos/LeResKP/pymotion/releases'
def main():
pwd = getpass.getpass('Github password for lereskp: ')
from github3 import login
g... | LeResKP/pymotion | pymotion/scripts/release.py | Python | mit | 1,354 |
"""fusilier URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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='home')
Class-b... | joedborg/fusilier | fusilier/urls.py | Python | agpl-3.0 | 822 |
#Virtual Topology– Chapter 3: Process Based Parallelism
from mpi4py import MPI
import numpy as np
UP = 0
DOWN = 1
LEFT = 2
RIGHT = 3
neighbour_processes = [0,0,0,0]
if __name__ == "__main__":
comm = MPI.COMM_WORLD
rank = comm.rank
size = comm.size
grid_rows = int(np.floor(np.sqrt(comm.size)))
grid... | IdiosyncraticDragon/Reading-Notes | Python Parallel Programming Cookbook_Code/Chapter 3/virtualTopology.py | Python | apache-2.0 | 2,072 |
"""
This sample shows how to update tan item
"""
import arcrest
from arcresthelper import securityhandlerhelper
def trace():
"""
trace finds the line, the filename
and error message and returns it
to the user
"""
import traceback, inspect
tb = sys.exc_info()[2]
tbinfo = tr... | jgravois/ArcREST | samples/update_item.py | Python | apache-2.0 | 2,535 |
from marshmallow import Schema, fields
class PetSchema(Schema):
description = dict(id="Pet id", name="Pet name", password="Password")
id = fields.Int(dump_only=True, metadata={"description": description["id"]})
name = fields.Str(
required=True,
metadata={
"description": descrip... | marshmallow-code/apispec | tests/schemas.py | Python | mit | 2,126 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('rules', '0035_auto_20150202_0937'),
]
operations = [
migrations.CreateModel(
name='SystemSettings',
fields=[
... | StamusNetworks/scirius | rules/migrations/0036_auto_20150203_1421.py | Python | gpl-3.0 | 1,713 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2011, Nicolas Clairon
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the abov... | aquavitae/mongokit-py3 | tests/test_custom_types.py | Python | bsd-3-clause | 19,152 |
"""Tests converting flat XML files to Gettext PO localization files"""
from io import BytesIO
from translate.convert import flatxml2po, test_convert
class TestFlatXML2PO:
def _convert(self, xmlstring, templatestring=None, **kwargs):
"""Helper that converts xml source to po target without requiring files... | miurahr/translate | translate/convert/test_flatxml2po.py | Python | gpl-2.0 | 4,950 |
from dateutil.parser import parse
class Object(object):
"""
Generic object returned by the API.
Each class that derives from this one declares a number of attributes that
are used to navigate the data returned by the API. For example, Droplet
objects contain an embedded Region, which contains one... | nathan-osman/pypail | pypail/objects.py | Python | mit | 4,196 |
# Copyright 2019 Rubén Bravo <rubenred18@gmail.com>
# Copyright 2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo import models
class StockRule(models.Model):
_inherit = "stock.rule"
def _prepare_mo_vals(
self,
product_id,
p... | OCA/manufacture | mrp_sale_info/models/stock_rule.py | Python | agpl-3.0 | 867 |
import sys
import numpy as np
from scipy.fftpack import fft2, ifft2, fftshift
from matplotlib import pylab as pl
# data = []
# with open('data.dat', 'r') as datafile:
# for row in datafile:
# data.append(list(map(complex, row[:-2].split(' '))))
# data = np.array(data)
#
# weight = []
# with open('uvc... | centowen/cudaGrid | show_image.py | Python | gpl-2.0 | 1,212 |
# -*- coding: utf-8 -*-
from appium.webdriver.common.touch_action import TouchAction
from AppiumLibrary.locators import ElementFinder
from .keywordgroup import KeywordGroup
class _TouchKeywords(KeywordGroup):
def __init__(self):
self._element_finder = ElementFinder()
# Public, element... | yahman72/robotframework-appiumlibrary | AppiumLibrary/keywords/_touch.py | Python | apache-2.0 | 5,942 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
#!/usr/bin/env python
from __future__ import division, unicode_literals
"""
#TODO: Write module doc.
"""
__author__ = 'Shyue Ping Ong'
__copyright__ = 'Copyright 2013, The Materials Virtual Lab'
__version__ =... | Bismarrck/pymatgen | pymatgen/io/vaspio/vasp_output.py | Python | mit | 652 |
from ..structure import *
from ..utils import *
# Adaptive parent proposal
class AMCMC_BN(MCMC):
def __init__(self, problem, verbose_int = 100, N = 1000, T = 10000, record_start = 3000):
MCMC.__init__(self, problem, "AMCMC_BN", verbose_int, N, T, record_start)
def particle_to_tuple(self, p):
r... | SsnL/amcmc | inference/amcmc_bn.py | Python | mit | 2,739 |
# coding=utf-8
from elections.tests import VotaInteligenteTestCase as TestCase
from elections.models import Election, QuestionCategory, Candidate
from django.urls import reverse
from candidator.models import TakenPosition, Position
from elections.models import Topic
from popolo.models import Person
from candidator.comp... | lfalvarez/votai | elections/tests/candidatorg_views_tests.py | Python | gpl-3.0 | 8,504 |
"""ProjectFormulario URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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='home'... | Curso-OpenShift/Formulario | OverFlow/ProjectFormulario/ProjectFormulario/urls.py | Python | gpl-3.0 | 852 |
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import timedelta
from django import forms
from django.db.models import Q
from django.db.models.sql.constants import QUERY_TERMS
from django.utils import six
from django.utils.timezone import now
from django.utils.translation... | zoidbergwill/django-filter | django_filters/filters.py | Python | bsd-3-clause | 10,300 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import logging
import jinja2
from django.template.loader import render_to_string
from django_jinja import library
from... | ericawright/bedrock | bedrock/newsletter/templatetags/helpers.py | Python | mpl-2.0 | 2,361 |
class Solution(object):
def myAtoi(self, str):
"""
:type str: str
:rtype: int
"""
strStrip = list(str.strip())
n = len(strStrip)
if n == 0:
return 0
symbol = -1 if strStrip[0]=='-' else 1
if strStrip[0] in ['-','+']: del strStrip[0]... | zhuxiang/LeetCode-Python | src/8-StringToInteger.py | Python | apache-2.0 | 723 |
# -*- coding: utf-8 -*-
"""
Malort Test Helpers
Test Runner: PyTest
"""
import os
import unittest
TEST_FILES_1 = os.path.normpath(os.path.join(os.path.abspath(__file__),
'..', 'tests', 'test_files'))
TEST_FILES_2 = os.path.normpath(os.path.join(os.path.abspath(__file__),
... | wrobstory/malort | malort/test_helpers.py | Python | mit | 1,642 |
import year
import conference
import paper
import author
import affiliation
import resource | riccardodg/lodstuff | lremap/it.cnr.ilc.lremapowl/src/lremapobj/__init__.py | Python | gpl-3.0 | 91 |
##
## This file is part of the sigrok project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
##
## 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... | robacklin/sigrok | decoders/onewire_network/__init__.py | Python | gpl-3.0 | 2,109 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-powerbiembedded/azure/mgmt/powerbiembedded/models/check_name_request.py | Python | mit | 1,018 |
import pytest
from django.urls import reverse
from pythonpro.domain.user_domain import find_user_interactions
from pythonpro.launch.facade import LAUNCH_STATUS_CPL1, LAUNCH_STATUS_OPEN_CART, LAUNCH_STATUS_PPL
@pytest.fixture
def tag_as_mock(mocker):
return mocker.patch('pythonpro.domain.user_domain._email_market... | pythonprobr/pythonpro-website | pythonpro/launch/tests/test_cpl1.py | Python | agpl-3.0 | 1,890 |
import unittest
import sys
sys.path.append("../src")
from remote_controller import *
class TestRemoteController(unittest.TestCase):
class StuntMotion():
def __init__(self):
self.reset()
def forward(self):
self.fward = True
def backward(self):
self.bwa... | IvayloTsankov/carty | tests/test_remote_controller.py | Python | gpl-2.0 | 3,884 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Jack Says - A Web-Based, "Simon Says"-like, multiplayer game.
# Copyright (C) 2015 https://github.com/cedricbonhomme/JackSays
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | cedricbonhomme/JackSays | web/models.py | Python | agpl-3.0 | 1,901 |
# Copyright (C) 2011 OpenStack Foundation
#
# 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... | emonty/burrow | burrow/frontend/wsgi.py | Python | apache-2.0 | 8,110 |
# Lec 3.1, slide 2
x = int(raw_input('Enter your number:'))
ans = 0
i = x
while i > 0:
ans = ans + x
i = i - 1
print(str(x) + '*' + str(x) + '=' + str(ans)) | medifle/python_6.00.1x | Lec3.1.2.py | Python | mit | 173 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Pelix Utilities: Task pool
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.5.7
:status: Beta
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
yo... | isandlaTech/cohorte-runtime | python/src/lib/python/pelix/threadpool.py | Python | apache-2.0 | 10,775 |
input = """
t(Z) :- t0(Z).
t(Z) :- g(X,Y,Z), t(X).
t(Z) :- g(X,Y,Z), not t(Y).
t0(1).
g(1,2,3).
g(2,5,4).
g(2,4,5).
g(5,3,6).
"""
output = """
t(Z) :- t0(Z).
t(Z) :- g(X,Y,Z), t(X).
t(Z) :- g(X,Y,Z), not t(Y).
t0(1).
g(1,2,3).
g(2,5,4).
g(2,4,5).
g(5,3,6).
"""
| veltri/DLV2 | tests/parser/wellfounded.11.test.py | Python | apache-2.0 | 285 |
import os
from io import BytesIO
from translate.convert import html2po, po2html, test_convert
class TestHTML2PO:
def html2po(
self,
markup,
duplicatestyle="msgctxt",
keepcomments=False,
):
"""Helper to convert html to po without a file."""
inputfile = BytesIO(m... | miurahr/translate | translate/convert/test_html2po.py | Python | gpl-2.0 | 28,109 |
from flask import Blueprint
# initialization of the blueprint
um = Blueprint('um', __name__, static_folder='static', template_folder='templates', url_prefix='/contacts')
import views | SNET-Entrance/Entrance-UM | src/um/__init__.py | Python | apache-2.0 | 184 |
#!/usr/bin/env python
#coding=utf-8
#########################################################################
# File Name: lda.py
# Author: Mark Chen
# mail: zhenchentl@gmail.com
# Created Time: 2014年12月14日 星期日 11时07分12秒
#########################################################################
from util.Params import ... | zhenchentl/confRec | topic/lda.py | Python | mit | 2,746 |
"""
dyld emulation
"""
from itertools import chain
import os, sys
from macholib.framework import framework_info
from macholib.dylib import dylib_info
__all__ = [
'dyld_find', 'framework_find',
'framework_info', 'dylib_info',
]
# These are the defaults as per man dyld(1)
#
_DEFAULT_FRAMEWORK_FALLBACK = [
... | timeyyy/PyUpdater | pyupdater/vendor/PyInstaller/lib/macholib/dyld.py | Python | bsd-2-clause | 5,109 |
#-*- coding: utf-8 -*-
from __future__ import division
# Ultimate load of a masonry bridge according to thesis of Alix Grandjean: "Capacité portante de ponts en arc en maçonnerie de pierre naturelle". École Polytechnique Féderale de Lausanne.
#See Annexe 14 page 235
__author__= "Luis C. Pérez Tato (LCPT) and Ana Ort... | lcpt/xc | verif/tests/rough_calculations/masonry_bridge_verif_01.py | Python | gpl-3.0 | 4,218 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 t... | unioslo/cerebrum | Cerebrum/modules/cis/auth.py | Python | gpl-2.0 | 14,400 |
import pytest
try:
from jose.backends.cryptography_backend import CryptographyRSAKey
from jose.backends.rsa_backend import RSAKey as PurePythonRSAKey
except ImportError:
PurePythonRSAKey = CryptographyRSAKey = None
from jose.constants import ALGORITHMS
from jose.exceptions import JWEError
from .test_RSA i... | mpdavis/python-jose | tests/algorithms/test_RSA_compat.py | Python | mit | 5,282 |
# 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... | samwhitlock/mesos-monitoring | src/python/src/mesos.py | Python | apache-2.0 | 3,736 |
import tweepy, re, json, operator
from tweepy import Stream
from tweepy.streaming import StreamListener
#auth information for Twitter API
consumer_key = 'your auth info'
consumer_secret = 'your auth info'
access_token = 'your auth info'
access_token_secret = 'your auth info'
#Tweepy Handler for accessing O... | dbroesch/Heroes-Sentiment-Analysis | twitterFetcher.py | Python | gpl-3.0 | 987 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.