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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
# Program Parameters
#
import os
import s... | pinguinkiste/bioconda-recipes | recipes/peptide-shaker/peptide-shaker.py | Python | mit | 3,271 |
#
# convert string to int conversions
#
#
stringvalue = "123456"
Stringvalue2 = "98765"
print(int(stringvalue) + int(Stringvalue2), end="") | defjam903/Google-Interview-prep | Basics/Google4.py | Python | mit | 139 |
"""shaq URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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-based ... | se42/shaq | shaq/urls.py | Python | mit | 1,226 |
import contextlib
import six
# keep this here, so that its exposed as::
#
# import idb.IDAPython
from idb.idapython import IDAPython
if six.PY2:
def memview(buf):
# on py2.7, we get this madness::
#
# bytes(memoryview('foo')) == "<memoryview ...>"
return buf
else:
d... | williballenthin/python-idb | idb/__init__.py | Python | apache-2.0 | 778 |
#!/usr/bin/env python
#
# Co-ordinates and utility functions for simulating
# Whitelees windfarm near Ayr, Scotland
#
# Copyright (c) 2017 DevicePilot Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# i... | DevicePilot/synth | synth/devices/helpers/wind/whitelees.py | Python | mit | 19,038 |
from io import StringIO
import pkg_resources
import pytest
import threading
import bender._main
from bender.backbones.console import BenderConsole
from bender.decorators import backbone_start
from bender.testing import VolatileBrain, DumbMessage
@pytest.mark.timeout(3.0)
def test_main(mock):
stdout = StringIO()
... | bender-bot/bender | bender/_tests/test_main.py | Python | lgpl-3.0 | 2,381 |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsRegressor
from sklearn.metrics import euclidean_distances
from .datasets import make_wave
from .plot_helpers import cm3
def plot_knn_regression(n_neighbors=1):
X, y = make_wave(n_samples=40)
X_test = np.array([[-1.5],... | bgroveben/python3_machine_learning_projects | oreilly_GANs_for_beginners/oreilly_GANs_for_beginners/introduction_to_ml_with_python/mglearn/mglearn/plot_knn_regression.py | Python | mit | 1,285 |
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py | Python | mit | 47,384 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_not_required
@login_not_required
@no_csrf
def index():
return TemplateResponse()
def insertStu... | SamaraCardoso27/eMakeup | backend/appengine/routes/home.py | Python | mit | 492 |
from dec.grid1 import *
import matplotlib.pyplot as plt
N = 4
#g = Grid_1D.periodic(N)
g = Grid_1D.regular(N)
#g = Grid_1D.chebyshev(N)
z = linspace(g.xmin, g.xmax, 100) #+ 1e-16
B0, B1, B0d, B1d = g.basis_fn()
H0, H1, H0d, H1d = hodge_star_matrix(g.projection(), g.basis_fn())
H1d = linalg.inv(H0)
#polynomial fit
#d... | drufat/dec | doc/plot/cheb/basis_forms.py | Python | gpl-3.0 | 1,067 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "games.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | ml394/games | manage.py | Python | gpl-3.0 | 803 |
from __future__ import absolute_import
import numpy as np
from matplotlib import pyplot as plt
import param
from ...core.options import Store
from ...interface.pandas import DFrame, DataFrameView, pd
from .element import ElementPlot
class DFrameViewPlot(ElementPlot):
"""
DFramePlot provides a wrapper aroun... | mjabri/holoviews | holoviews/plotting/mpl/pandas.py | Python | bsd-3-clause | 5,696 |
# Copyright (C) 2016 Institute of Computer Science of the Foundation for Research and Technology - Hellas (FORTH)
# Authors: Michalis Bamiedakis, Dimitris Mavrommatis and George Nomikos
#
# Contact Author: George Nomikos
# Contact Email: gnomikos [at] ics.forth.gr
#
# This file is part of traIXroute.
#
# traIXroute is ... | gnomikos/traIXroute | lib/traixroute/downloader/install_scamper.py | Python | gpl-3.0 | 2,324 |
import tensorflow as tf
import numpy as np
from tensorflow.python.ops.rnn_cell import LSTMStateTuple
from memory import Memory
import utility
import dnc_v2
def sample_gumbel(shape, eps=1e-20):
"""Sample from Gumbel(0, 1)"""
U = tf.random_uniform(shape,minval=0,maxval=1)
return -tf.log(-tf.log(U + eps) + eps)
... | thaihungle/deepexp | gen-dnc/vdnc.py | Python | mit | 51,656 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
A simple example of assisilib usage, spawning two oval arenas
(assumes any CASUs required are spawned externally)
'''
from assisipy import sim
from assisipy_utils import arena
import argparse
from numpy import deg2rad
if __name__ == '__main__':
parser = argpars... | assisi/assisipy-lib | assisipy_utils/examples/exec_sim/demo_deploy/spawn_arenas.py | Python | lgpl-3.0 | 1,348 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-batch/azure/batch/models/file_delete_from_task_options.py | Python | mit | 1,764 |
import logging
from spiders.tools.proxyip import GetIP
logger = logging.getLogger(__name__)
class RandomProxyMiddleware(object):
#动态设置ip代理
def process_request(self, request, spider):
get_ip = GetIP()
request.meta["proxy"] = get_ip.get_random_ip() | LiZoRN/Charlotte | spiders/newhouse/newhouse/middlewares/proxy.py | Python | gpl-3.0 | 283 |
# Copyright 2020 kubeflow.org.
#
# 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,... | kubeflow/kfserving-lts | python/kfserving/test/test_inference_service_client.py | Python | apache-2.0 | 4,040 |
#!/usr/bin/python3
import os, sys
import math
sys.path.append(os.path.join(os.path.dirname(__file__), "codeLibs"))
from utils import calculateInversions, swapInList
from Astar import Astar
if len(sys.argv) != 2:
print('Usage: python NpuzzleAstar "1,2,3,4,5,6,7,8,0"')
exit()
initialState = sys.argv[1]
matrixSize ... | abhipec/academicCodes | NpuzzleAstar.py | Python | gpl-2.0 | 2,309 |
"""TheDoctor class.
/*
* 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... | dubeejw/openwhisk-package-kafka | provider/thedoctor.py | Python | apache-2.0 | 3,464 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the download helper object implementations."""
from __future__ import unicode_literals
import os
import unittest
from l2tdevtools.download_helpers import sourceforge
from tests import test_lib
@unittest.skipIf(
os.environ.get('APPVEYOR', ''), 'Test is... | rgayon/l2tdevtools | tests/download_helpers/sourceforge.py | Python | apache-2.0 | 2,054 |
"""
Django settings for orea project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths i... | acdh-oeaw/defc-app | orea/settings/db_sqlLite.py | Python | mit | 627 |
'''
Created on Jul 21, 2013
@author: nirvam
A number is called lucky if the sum of its digits, as well as the sum of the squares of its digits is a prime number. How many numbers between A and B are lucky?
Input:
The first line contains the number of test cases T. Each of the next T lines contains two integers, A a... | nirvam/hackerrank | algorithms/dynamic_programming/lucky_numbers.py | Python | mit | 2,063 |
"""
Examples of loading all information about an object or set of objects from the
database.
"""
from __future__ import absolute_import
from __future__ import print_function
import PyOpenWorm as P
from PyOpenWorm.connection import Connection
from PyOpenWorm.neuron import Neuron
from PyOpenWorm.context import Context
f... | gsarma/PyOpenWorm | examples/test_bgp.py | Python | mit | 1,886 |
# -*- coding: utf-8 -*-
# Copyright 2015, Dario Blanco
"""
This module provides integration tests for the capablanca project
"""
import pytest
from capablanca.play import play
@pytest.mark.testtype("integration")
def test_8queens_8x8(runner):
"""Should run a game with 8 queens in a 8x8 board"""
result = ru... | sharkerz/capablanca | test/test_capablanca.py | Python | gpl-2.0 | 714 |
from sympy.integrals.transforms import (mellin_transform,
inverse_mellin_transform, laplace_transform, inverse_laplace_transform,
fourier_transform, inverse_fourier_transform,
sine_transform, inverse_sine_transform,
cosine_transform, inverse_cosine_transform,
hankel_transform, inverse_hankel_transfo... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/integrals/tests/test_transforms.py | Python | mit | 31,213 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-27 16:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('evenimente', '0001_initial'),
]
operations = [
migrations.AddField(
... | hiezust/teask | evenimente/migrations/0002_event_topic.py | Python | gpl-3.0 | 488 |
# Copyright 2013 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... | nikolay-fedotov/tempest | tempest/api/network/test_security_groups.py | Python | apache-2.0 | 10,046 |
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Jun 17 2015)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
###########################################################################
impo... | JavaCardOS/pyResMan | pyResMan/BaseDialogs/pyResManCommandDialogBase_REQBWUPB.py | Python | gpl-2.0 | 5,962 |
#from JumpScale import j
# class MetadataHandler():
# def __init__(self,root,usermanager):
# self.root=root.replace("\\","/").strip("/").strip()
# self.usermanager=usermanager
# self.roots=["spaces","buckets","actors","root","stor"]
# self.spaces={}
# def normalizePath(self,pa... | Jumpscale/jumpscale6_core | apps/portalftpgateway/_archive/MetadataHandler.py | Python | bsd-2-clause | 3,621 |
"""
benchmark compression
---------------------
Generate benchmarks for AANDC paper.
"""
import numpy as np
from os.path import join,exists
from shutil import copy2
import os
from fits2hdf import idi
from fits2hdf.io import hdfio, fitsio
import time
import h5py
from astropy.io import fits as pf
def create_image(i... | telegraphic/fits2hdf | aadnc_benchmarks/benchmark_read_speed.py | Python | mit | 3,672 |
from datetime import timedelta
# external
from blessed import Terminal
# django
from django.db import connection
from django.db.models import F, Sum
from django.utils import timezone
from django.utils.translation import gettext as _
from django_q import VERSION, models
from django_q.brokers import get_broker
# loca... | Koed00/django-q | django_q/monitor.py | Python | mit | 17,565 |
# mod_speedtest/neubot_module.py
#
# Copyright (c) 2013
# Nexa Center for Internet & Society, Politecnico di Torino (DAUIN)
# and Simone Basso <bassosimone@gmail.com>
#
# This file is part of Neubot <http://www.neubot.org/>.
#
# Neubot is free software: you can redistribute it and/or modify
# it under the term... | neubot/neubot-server | neubot/mod_speedtest/neubot_module.py | Python | gpl-3.0 | 1,948 |
# -*- test-case-name: xquotient.test.historic.test_inbox3to4filter -*-
"""
Create a stub database for upgrade of L{xquotient.inbox.Inbox} from version 3
to version 4, where there is a L{xquotient.spam.Filter} in the store
"""
from axiom.test.historic.stubloader import saveStub
from xquotient.quotientapp import Quoti... | twisted/quotient | xquotient/test/historic/stub_inbox3to4filter.py | Python | mit | 461 |
"""
The :mod:`sklearn.metrics` module includes score functions, performance metrics
and pairwise metrics and distance computations.
"""
from .ranking import auc
from .ranking import average_precision_score
from .ranking import label_ranking_average_precision_score
from .ranking import precision_recall_curve
from .rank... | soulmachine/scikit-learn | sklearn/metrics/__init__.py | Python | bsd-3-clause | 3,129 |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'shape': [(4,), (2, 3), (2, 3, 2)],
'dtype': [numpy.float16, numpy.float32, numpy.float64],
'metho... | rezoo/chainer | tests/chainer_tests/functions_tests/math_tests/test_fft.py | Python | mit | 3,320 |
#Cálculo do maior e menor entre 3 números
n1 = int(input('Digite o 1º número: '))
n2 = int(input('Digite o 2º número: '))
n3 = int(input('Digite o 3º número: '))
if n1 > n2 and n3:
print ('é o maior número')
if n2 > n1 and n3:
print ('é o maior número')
if n3 > n1 and n2:
print ('é o maior número')
| GiovanniG/atividadesPython | 15calcularMaioreMenorEntreNumeros.py | Python | gpl-3.0 | 328 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-Mimikatz DCsync - Full Hashdump',
'Author': ['@gentilkiwi', 'Vincent Le Toux', '@JosephBialek', "@harmj0y", "@monoxgas"],
'Description': ("Runs PowerSp... | Hackplayers/Empire-mod-Hpys-tests | lib/modules/powershell/credentials/mimikatz/dcsync_hashdump.py | Python | bsd-3-clause | 3,637 |
"""Armis Integration for Cortex XSOAR - Unit Tests file
This file contains the Pytest Tests for the Armis Integration
"""
import json
import pytest
import time
import CommonServerPython
def test_untag_device_success(requests_mock):
from Armis import Client, untag_device_command
mock_token = {
... | VirusTotal/content | Packs/Armis/Integrations/Armis/Armis_test.py | Python | mit | 14,609 |
#!/usr/bin/env python
# encoding: utf-8
"""PGEM test configuration model.
Default connect to configuration.db which save the test items settings.
"""
__version__ = "0.1"
__author__ = "@fanmuzhi, @boqiling"
__all__ = ["PGEMConfig", "TestItem"]
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy imp... | hardanimal/UFT_UPGEM | src/UFT/backend/configuration.py | Python | gpl-3.0 | 3,635 |
from django.shortcuts import render
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field, Submit
from moth.views.base.form_template_view import FormTemplateView
class UploadForm(forms.Form):
_file = forms.FileField()
def __init__(self, * args, **... | andresriancho/django-moth | moth/views/vulnerabilities/core/file_upload.py | Python | gpl-2.0 | 1,388 |
from jinja2 import Environment, PackageLoader
_templates = Environment(loader=PackageLoader('intercom', 'templates'))
def accept(timeout_seconds, phone_number):
template = _templates.get_template('accept.xml')
return template.render(
timeout_seconds=timeout_seconds,
phone_number=phone_number)... | alexhanson/intercom | intercom/responses.py | Python | isc | 552 |
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys ... | gagoncal/Selenium | Selenium with python/Action_chains_send_keys/sendKeys_complete2.py | Python | lgpl-2.1 | 1,333 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/7/23 13:12
# @Author : Tom.lee
# @Site :
# @File : numpy_list_multidimensional.py
# @Software: PyCharm
"""
numpy 多维数组
多维数组的存取和一维数组类似,因为多维数组有多个轴,
因此它的下标需要用多个值来表示,NumPy采用组元(tuple)作为数组的下标
"""
import numpy as np
def split_line():
print '*' * 6 ... | amlyj/pythonStudy | 2.7/data_analysis/study_numpy/numpy_multidimensional.py | Python | mit | 1,483 |
#!/usr/bin/python
# Copyright 2009 Google Inc. Released under the GPL v2
import unittest
try:
import autotest.common as common
except ImportError:
import common
from autotest.mirror import database
from autotest.client.shared.test_utils import mock
class dict_database_unittest(unittest.TestCase):
_path =... | nacc/autotest | mirror/database_unittest.py | Python | gpl-2.0 | 3,905 |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 25 13:08:19 2015
@author: jgimenez
"""
from PyQt4 import QtGui, QtCore
import sys
from numericalSchemes_ui import Ui_numericalSchemesUI
from copy import deepcopy
import os
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
ColumnWidth = 160
dicRo... | jmarcelogimenez/petroSym | petroSym/numericalSchemes.py | Python | gpl-2.0 | 26,126 |
import numpy as np
import matplotlib.pyplot as plt
from shapely.geometry.polygon import Polygon
from shapely.geometry import MultiPolygon
import cell_tree2d
# create a rotated Cartesian grid
xc, yc = np.mgrid[1:10:15j, 1:20:18j]
yc = yc**1.2 + xc**1.5
def rot2d(x, y, ang):
'''rotate vectors by geometric angle''... | pyoceans/gridded | examples/make_test_grid.py | Python | mit | 1,437 |
import csvmapper
# patient mapper
mapper = csvmapper.JSONMapper('patient.json')
parser = csvmapper.CSVParser('patients.csv', mapper)
patients = parser.buildObject()
for patient in patients:
print '( %g ) %s is %d years old, and is suffering from %s' %(patient.ID, patient.Name, patient.Age, patient.Disease) | samarjeet27/CSV-Mapper | examples/json-map/main.py | Python | mit | 312 |
""":mod:`FruitMachine` -- Contains the FruitMachine class
.. module:: FruitMachine
:synopsis: Contains the FruitMachine class
.. moduleauthor:: Joshua Gilman <joshuagilman@gmail.com>
"""
from neolib.daily.Daily import Daily
from neolib.exceptions import dailyAlreadyDone
from neolib.exceptions import parseException... | jmgilman/Neolib | neolib/daily/FruitMachine.py | Python | mit | 1,697 |
import os
import time
import datetime
import random
import Cookie
import logging
from google.appengine.api import memcache
from django.utils import simplejson as json
# Note - please do not use this for production applications
# see: http://code.google.com/p/appengine-utitlies/
COOKIE_NAME = 'appengine-simple-session... | cwyark/v2ex | v2ex/babel/ext/sessions.py | Python | bsd-3-clause | 3,157 |
"""Given a string, return a new string made of 3 copies of the last 2 chars of the original string.
The string length will be at least 2.
"""
def extra_end(snipstring):
triplicate = str(snipstring[-2:] * 3)
return triplicate
print(extra_end('Hello')) # 'lololo'
print(extra_end('ab')) # 'ababab'
print(ext... | Baumelbi/IntroPython2016 | students/sheree/session_01/homework/coding_bat_string-5.py | Python | unlicense | 346 |
# -*- coding: utf-8 -*-
# © 2016 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import hr_employee
| VitalPet/hr | hr_employee_reference/models/__init__.py | Python | agpl-3.0 | 152 |
import queue
import time
from node import *
from search import *
#the solution to 8 puzzle
solution = node([1, 2, 3, 4, 5, 6, 7, 8, 0])
#the places visited
#search takes the initial state of the problem and the search type
#prints all expansions
#returns false if no sol
#returns true if sol found
def search(initial,... | zzhou007/8puzzle | src/8puzzle.py | Python | gpl-2.0 | 1,768 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-05-09 17:20
from __future__ import unicode_literals
import django.db.models.deletion
import filer.fields.file
import filer.fields.folder
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('filer',... | shoopio/shoop | shuup/core/migrations/0044_add_media.py | Python | agpl-3.0 | 1,621 |
#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/pdfgen/pdfgeom.py
__version__=''' $Id: pdfgeom.py 3959 2012-09-27 14:39:39Z robin $ '''
__doc__="""
This module includes any mathematical methods ... | nickpack/reportlab | src/reportlab/pdfgen/pdfgeom.py | Python | bsd-3-clause | 3,119 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "incubator.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| UrLab/incubator | manage.py | Python | agpl-3.0 | 252 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | ctrlaltdel/neutrinator | vendor/openstack/tests/functional/network/v2/test_subnet_pool.py | Python | gpl-3.0 | 3,530 |
import pdf
import pml
import random
import util
import wx
# The watermark tool dialog.
class WatermarkDlg(wx.Dialog):
# sp - screenplay object, from which to generate PDF
# prefix - prefix name for the PDF files (unicode)
def __init__(self, parent, sp, prefix):
wx.Dialog.__init__(self, parent, -1,... | HuBandiT/trelby | src/watermarkdlg.py | Python | gpl-2.0 | 5,281 |
#!/usr/bin/env python
# Copyright (c) 2013 - 2015 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware impleme... | yohanko88/gem5-DC | util/decode_inst_dep_trace.py | Python | bsd-3-clause | 8,514 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any ... | labordoc/labordoc-next | modules/webstyle/lib/webinterface_handler_local.py | Python | gpl-2.0 | 2,714 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name = 'hybra-core',
version = '0.1.2a1',
description = 'Toolkit for data management and analysis.',
keywords = ['data management', 'data analysis'],
url = 'https://github.com/HIIT/hybra-core',
author = 'Matti Nel... | HIIT/hybra-core | setup.py | Python | mit | 1,551 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cloudmeta.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| bencord0/cloudmeta | manage.py | Python | agpl-3.0 | 252 |
import logging
import re
import json
import os
import sys
from typing import Tuple, NoReturn
# import geoip2.database
# geoip_db = 'nonfree/GeoIP.dat'
# if os.path.isfile(geoip_db):
# reader = geoip2.database.Reader(geoip_db)
# else:
# print(f"Could not find {geoip_db}")
# sys.exit(1)
class GameServer()... | gazwald/quake2master | gameserver/__init__.py | Python | gpl-3.0 | 3,475 |
from setuptools import setup, find_packages
setup(
name="accounting-system",
version="0.1",
packages=find_packages(exclude=['tests']),
install_requires=['configparser >= 3.5.0', 'mysqlclient >= 1.3.7',
'pika >= 0.10.0', 'PyMySQL >= 0.7.2',
'mysqlclient >= 1.3... | Stiliyan92/accounting-system | setup.py | Python | gpl-2.0 | 850 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------------... | Ecpy/ecpy | exopy/tasks/utils/__init__.py | Python | bsd-3-clause | 430 |
"""
Instructor API endpoint urls.
"""
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^students_update_enrollment$',
'instructor.views.api.students_update_enrollment', name="students_update_enrollment"),
url(r'^register_and_enroll_students$',
'instructor.views... | JCBarahona/edX | lms/djangoapps/instructor/views/api_urls.py | Python | agpl-3.0 | 7,124 |
from station.measurement import Measurement
from station.spi_sensor import SpiSensor
from station.units.temperature import celsius
class TemperatureSensor(SpiSensor):
def __init__(self, device, **kwargs):
super().__init__(device)
self.temp_units = kwargs['temp_units'] if 'temp_units' in kwargs else... | cberes/raspberry-pi-weather | station/temperature_sensor.py | Python | gpl-3.0 | 661 |
# Generated from T.g4 by ANTLR 4.7.1
from antlr4 import *
if __name__ is not None and "." in __name__:
from .TParser import TParser
else:
from TParser import TParser
# This class defines a complete listener for a parse tree produced by TParser.
class TListener(ParseTreeListener):
# Enter a parse tree prod... | Gagi2k/qface | qface/idl/parser/TListener.py | Python | mit | 8,256 |
import warnings
from django.utils.deprecation import RemovedInDjango19Warning
warnings.warn(
"The django.forms.util module has been renamed. "
"Use django.forms.utils instead.", RemovedInDjango19Warning, stacklevel=2)
from django.forms.utils import * # NOQA isort:skip
| diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/forms/util.py | Python | mit | 290 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, scrub
from frappe.utils import getdate, nowdate, flt, cint
class ReceivablePayableReport(object):
def __init__(self, filters=None):... | MartinEnder/erpnext-de | erpnext/accounts/report/accounts_receivable/accounts_receivable.py | Python | agpl-3.0 | 10,017 |
'''
This module wraps maya.cmds to accept special pymel arguments.
There are a number of pymel objects which must be converted to a "mel-friendly"
representation. For example, in versions prior to 2009, some mel commands (ie, getAttr) which expect
string arguments will simply reject custom classes, even if they have a... | CountZer0/PipelineConstructionSet | python/maya/site-packages/pymel-1.0.5/pymel/internal/pmcmds.py | Python | bsd-3-clause | 6,971 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... | chshu/openthread | tools/harness-automation/cases_R140/leader_5_6_4.py | Python | bsd-3-clause | 1,877 |
from .settings import *
import logging
DEBUG = True
ALLOWED_HOSTS = []
ACCOUNT_ACTIVATION_DAYS=7
# EMAIL_BACKEND = 'email_extras.backends.BrowsableEmailBackend'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
SITE_ID =2
logging.basicConfig(level='DEBUG')
INSTALLED_APPS += ('debug_toolbar', 'pympler... | aronasorman/content-curation | contentcuration/contentcuration/dev_settings.py | Python | mit | 1,376 |
from nose.tools import raises
from mock import Mock, patch, ANY, call
from lxc4u.lxc import *
@patch('__builtin__.open') # Prevent anything from writing to disk
@patch('lxc4u.lxc.LXCService')
def test_create_a_container(mock_service, mock_open):
test1_lxc = create_lxc('test1')
# Assertions
message = "te... | ravenac95/lxc4u | tests/test_lxc.py | Python | mit | 9,166 |
#!/usr/bin/env python3
#!/usr/bin/python3
# Evaluation of number of clusters for different timesteps in a xyz file.
from fnc import *
#from gui import *
ppo = 9
box = 30
conc = 0.05
frameskip = 25
flag_hist = 0
flag_ave = 0
flag_pbc = 1
interval = 250000
RHO = 3
FRAME_COLLECTION = 500
PLURCHAIN = 15
timecounter ... | hermessc/DPDCFD | cluster/code.py | Python | gpl-3.0 | 6,981 |
from django.views.generic import View
from ..endpoints import Server
from ..settings import oauth2_settings
from .mixins import ProtectedResourceMixin, ScopedResourceMixin, ReadWriteScopedResourceMixin
class ProtectedResourceView(ProtectedResourceMixin, View):
"""
Generic view protecting resources by providi... | vmalavolta/django-oauth-toolkit | oauth2_provider/views/generic.py | Python | bsd-2-clause | 967 |
""" test scalar indexing, including at and iat """
from datetime import datetime, timedelta
import numpy as np
import pytest
from pandas import DataFrame, Series, Timedelta, Timestamp, date_range, period_range
import pandas._testing as tm
from pandas.tests.indexing.common import Base
class TestScalar(Base):
@py... | TomAugspurger/pandas | pandas/tests/indexing/test_scalar.py | Python | bsd-3-clause | 13,259 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
""" sha1Hash_test.py
Unit tests for sha1.py
"""
from crypto.hash.sha1Hash import SHA1
import unittest
import struct
assert struct.calcsize('!IIIII') == 20, '5 integers should be 20 bytes'
class SHA1_FIPS180_TestCases(unittest.TestCase):
""" SHA-1... | dknlght/dkodi | src/script.module.cryptopy/lib/crypto/hash/sha1Hash_test.py | Python | gpl-2.0 | 2,199 |
# config.py
import os
import yaml
from configobj import ConfigObj
class Config(object):
def __init__(self):
# our basic program variables
self.config = ConfigObj('./conf/config.ini')
# get user supplied variables
try:
self.config.merge(ConfigObj(os.path.expanduser(self.config['global_... | jlongstaf/aws-deployments | src/f5_aws/config.py | Python | mit | 1,136 |
import argparse
import commands
def initialize():
arguments = argparse.ArgumentParser()
subparsers = arguments.add_subparsers()
run = subparsers.add_parser('run')
run.set_defaults(func=commands.run, help="run a Literate Python script")
run.add_argument('src', nargs=1)
weave = subparsers.add_p... | debrouwere/python-literate | literate/commands/__init__.py | Python | mit | 2,193 |
"""Tests for items views."""
import json
import re
from datetime import datetime, timedelta
from unittest.mock import Mock, PropertyMock, patch
import ddt
from django.conf import settings
from django.http import Http404
from django.test import TestCase
from django.test.client import RequestFactory
from django.urls i... | edx/edx-platform | cms/djangoapps/contentstore/views/tests/test_item.py | Python | agpl-3.0 | 160,015 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
urlpatterns = [
url(r"^$", views.home, name="board"),
url(r"^/all$", views.all_feed, name="board_all"),
url(r"^/course/(?P<course_id>.*)?$", views.course_feed, name="board_course"),
url(r"^/submit/course/(?P<course_id>.*)?$... | jacobajit/ion | intranet/apps/board/urls.py | Python | gpl-2.0 | 1,474 |
##########################################################################
#
# Copyright (c) 2017, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | hradec/gaffer | python/GafferSceneTest/CapsuleTest.py | Python | bsd-3-clause | 2,932 |
#!/usr/bin/pypy
import cProfile
import time
import json
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)-15s %(levelname)s %(filename)s:%(funcName)s:%(lineno)s %(message)s')
# own modules
#from datalogger import DataLogger as DataLogger
from datalogger import DataLoggerWeb as DataLoggerWeb
fro... | gunny26/datalogger | development/test_anomality_lazy.py | Python | apache-2.0 | 8,857 |
import webbrowser
import hashlib
webbrowser.open("https://xkcd.com/353/")
def geohash(latitude, longitude, datedow):
'''Compute geohash() using the Munroe algorithm.
>>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
37.857713 -122.544543
'''
# https://xkcd.com/426/
h = hashlib.md5... | brython-dev/brython | www/src/Lib/antigravity.py | Python | bsd-3-clause | 500 |
# -*- coding: utf-8 -*-
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tseaver/google-cloud-python | vision/google/cloud/vision_v1/types.py | Python | apache-2.0 | 2,229 |
"""
Title: Structured data classification from scratch
Author: [fchollet](https://twitter.com/fchollet)
Date created: 2020/06/09
Last modified: 2020/06/09
Description: Binary classification of structured data including numerical and categorical features.
"""
"""
## Introduction
This example demonstrates how to do stru... | keras-team/keras-io | examples/structured_data/structured_data_classification_from_scratch.py | Python | apache-2.0 | 10,168 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import codecs
import functools
import os
import re
import tempfile
import time
import urlparse
from lib.core.common import Backend
from lib.core.common import getUnicode
from... | goofwear/raspberry_pwn | src/pentest/sqlmap/lib/core/target.py | Python | gpl-3.0 | 28,422 |
#!/usr/bin/env python
#
# Copyright 2010 The Closure Linter 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
#... | lukaszpiotr/gjslint | closure_linter/indentation.py | Python | apache-2.0 | 20,702 |
"""Tests for vusion.persist.HistoryManager"""
from datetime import timedelta, datetime
from pymongo import MongoClient, ASCENDING, DESCENDING
from redis import Redis
from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks
from tests.utils import ObjectMaker, MessageMaker
from v... | texttochange/vusion-backend | vusion/persist/history/tests/test_history_manager.py | Python | bsd-3-clause | 21,007 |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as AddressProvider
class Provider(AddressProvider):
city_formats = ('{{city_name}}', )
street_name_formats = ('{{street_name}}', )
street_address_formats = ('{{street_name}} {{building_number}}', )
address_formats = ('{{s... | deanishe/alfred-fakeum | src/libs/faker/providers/address/sl_SI/__init__.py | Python | mit | 33,654 |
#
# Copyright (c) 2013,2014, Oracle and/or its affiliates. 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; version 2 of the License.
#
# This program is distributed in the... | gmo-media/mikasafabric | mysql/fabric/sharding.py | Python | gpl-2.0 | 70,913 |
# -*- coding: utf8 -*-
"""
This file implements test cases for validation communication with REST endpoint on Btcc-spot. This endpoint offer informations about trades.
"""
__author__ = "Jan Seda"
__copyright__ = "Copyright (C) Jan Seda"
__credits__ = []
__license__ = ""
__version__ = "0.1"
__maintainer__ = "Jan Seda"... | Honzin/ccs | tests/testApi/testPublic/testBtccusd/testTradeHistory.py | Python | agpl-3.0 | 2,277 |
__all__ = ['grid', 'heuristic', 'node', 'util'] | ironsmile/tank4eta | pathfinding/core/__init__.py | Python | mit | 47 |
import time
import io
import threading
import numpy as np
import cv2
class Camera(object):
thread = None
cap = cv2.VideoCapture()
frame = None
width = None
height = None
def __init__(self):
# Get the width and height of frame
self.width = int(self.cap.get(cv2.CAP_PROP_FRAME_WI... | jskrzypek/flask-video-streaming | camera_cap.py | Python | mit | 1,985 |
# -*- coding: utf-'8' "-*-"
import logging
from openerp.osv import osv, fields
from openerp.tools import float_round, float_repr
from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
def _partner_format_address(address1=False, address2=False):
return ' '.join((address1 or '', address2 or ... | jmesteve/saas3 | openerp/addons/payment/models/payment_acquirer.py | Python | agpl-3.0 | 24,488 |
from collections import OrderedDict
import numpy as np
from skimage.measure import compare_ssim as ssim
# TODO: Refactoring
def eval_synthetic(it, gen, data, tag='', sampler=None):
metrics = OrderedDict()
if sampler is not None:
z = sampler(1024)
samples = gen(z) # Feed z
else:
... | sanghoon/tf-exercise-gan | eval_funcs.py | Python | mit | 2,687 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import werkzeug
from odoo import http
from odoo.http import request
class LinkTracker(http.Controller):
@http.route('/r/<string:code>', type='http', auth='none', website=True)
def full_url_redirect(self, code,... | ayepezv/GAD_ERP | addons/link_tracker/controller/main.py | Python | gpl-3.0 | 621 |
# -*- coding: utf-8 -*-
# This file is part of pyGw2Tools.
#
# pyGw2Tools 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.
#
# pyGw2Tools... | zanar/pygw2tools | gw2db/profs/professions.py | Python | gpl-3.0 | 4,586 |
class ReferenceTransferObject:
def __init__(self, p_game):
self.game = p_game
self.debug_info = None
self.timestamp = None
self.team_color_svc = None
def set_timestamp(self, timestamp_ref)->None:
self.timestamp = timestamp_ref
def set_team_color_svc(self, p_team_... | MaximeGLegault/StrategyIA | RULEngine/Util/reference_transfer_object.py | Python | mit | 464 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.