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 |
|---|---|---|---|---|---|
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | samsu/neutron | openstack/common/cache/_backends/memory.py | Python | apache-2.0 | 5,240 |
import unittest
import logging
from StringIO import StringIO
from SimpleForwarder import *
from mock import Mock, MagicMock
from botocore.exceptions import ClientError
from test_util import *
import copy
class testSESEmail(unittest.TestCase):
def setUp(self):
self._ses_mock = Mock()
self._ses_mock... | eamonnsullivan/simple-email-forwarder | unittests/test_lambda_handler.py | Python | mit | 1,824 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# WPSeku: Wordpress Security Scanner
#
# @url: https://github.com/m4ll0k/WPSeku
# @author: Momo Outaadi (M4ll0k)
#
# WPSeku 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 Found... | Yukinoshita47/Yuki-Chan-The-Auto-Pentest | Module/WPSeku/modules/discovery/generic/wpcrossdomain.py | Python | mit | 1,415 |
import os
import json
import string
from datetime import datetime
from src.config.config import config
def create_empty_file(filepath):
# Creates an empty file, override the file if it already exists
directory = os.path.dirname(filepath)
if not os.path.exists(directory):
os.makedirs(directory)
... | 901/Gwent-twitch-bot | src/lib/fileHandler.py | Python | gpl-3.0 | 2,644 |
# -*- coding: utf-8 -*-
from Caballero import Caballero
from Orco import Orco
from Choza import Choza
from Funciones import *
import random
import textwrap
class Juego:
def __init__(self):
self.chozas = [] #Inicializamos el número de chozas que tendremos dentro de nuestro juego
self.jugador = None... | tidus747/Tutoriales_juegos_Python | Ataca a los orcos V1.1.0/Ataca_a_los_orcos_V1_0_0.py | Python | gpl-3.0 | 4,063 |
"""
Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... | analogdevicesinc/gnuradio | grc/python/Param.py | Python | gpl-3.0 | 18,960 |
"""
Test cases for codeop.py
Nick Mathewson
"""
import unittest
from test.support import run_unittest, is_jython
from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT
import io
if is_jython:
import sys
def unify_callables(d):
for n,v in d.items():
if hasattr(v, '__call__'):
... | invisiblek/python-for-android | python3-alpha/python3-src/Lib/test/test_codeop.py | Python | apache-2.0 | 7,630 |
#! /usr/bin/env python3
# Copyright (c) 2020, NVIDIA CORPORATION. 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
#
# ... | mlperf/inference_results_v0.7 | open/NVIDIA/scripts/update_results.py | Python | apache-2.0 | 13,020 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright (C) 2012 Travis Shirk <travis@pobox.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | daltonsena/eyed3 | examples/tag_example.py | Python | gpl-2.0 | 6,993 |
import importlib
from collections import defaultdict
from modeful.keymap.common import Common
class Parser(Common):
def parse_keymap(self, keymap_dict):
keymap = {}
for mode, keymap_lines in keymap_dict.items():
keymap[mode] = defaultdict(dict)
for func, s... | Modeful/poc | modeful/keymap/parser.py | Python | gpl-3.0 | 946 |
import datetime
import logging
import json
from pylons import request, response, session, tmpl_context as c
from zkpylons.lib.helpers import redirect_to
from pylons.controllers.util import Response, redirect
from pylons.decorators import validate, jsonify
from pylons.decorators.rest import dispatch_on
from formenco... | neillc/zookeepr | zkpylons/controllers/invoice.py | Python | gpl-2.0 | 16,775 |
##########################################################################
#
# Copyright (c) 2015, Esteban Tovagliari. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribution... | chippey/gaffer | python/GafferAppleseedUITest/DocumentationTest.py | Python | bsd-3-clause | 2,164 |
#!/usr/bin/env python3
import ezpygame
from Box2D import b2World, b2PolygonShape
import random
import shapes
from game import *
class DemoScene(ezpygame.Scene):
def __init__(self):
# Called once per game, when game starts
self.world = b2World() # default gravity is (0,-10) and doSleep is True
... | AndrewJamesTurner/Every-Womans-Ground | demo.py | Python | gpl-3.0 | 2,536 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def data_migration(apps, schema_editor):
MicroServiceChainLink = apps.get_model('main', 'MicroServiceChainLink')
# Update delete bagged files to continue processing if there's an error
MicroServiceChai... | eckardm/archivematica | src/dashboard/src/main/migrations/0014_aic_fixes.py | Python | agpl-3.0 | 806 |
################################################################################
#
# Copyright (c) 2012 The MadGraph Development team and Contributors
#
# This file is a part of the MadGraph 5 project, an application which
# automatically generates Feynman diagrams and matrix elements for arbitrary
# high-energy proce... | cms-externals/sherpa | Examples/UFO_MSSM/MSSM/build_restrict.py | Python | gpl-3.0 | 3,624 |
import gc
from unittest import mock
import pytest
from aiohttp.connector import Connection
@pytest.fixture
def key():
return object()
@pytest.fixture
def loop():
return mock.Mock()
@pytest.fixture
def connector():
return mock.Mock()
@pytest.fixture
def protocol():
return mock.Mock(should_close... | arthurdarcet/aiohttp | tests/test_client_connection.py | Python | apache-2.0 | 3,420 |
#
#
# 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 n... | gouravshenoy/airavata | sandbox/simstream/simstream/pikaproducer.py | Python | apache-2.0 | 7,107 |
from __future__ import print_function
import pandas as pd
from bokeh._legacy_charts import Bar
from bokeh.models import NumeralTickFormatter
from numpy import round
from .utils import write_plot, read_data, fix_nan_inf
@write_plot('culture')
def plot(newest_changes):
df, date_range = read_data(newest_changes, '... | vivekiitkgp/WIGI-website | plots/gender_by_culture.py | Python | mit | 1,845 |
# coding=UTF-8
"""
Short codes - types, a database/allocator object, and so on
"""
from __future__ import print_function, absolute_import, division
import six
import logging
logger = logging.getLogger(__name__)
class ShortCodeType(object):
BITS_8 = 0 # 8 bit short code
BITS_16 = 1 # 16 bit short cod... | smok-serwis/tslf-format | tslfformat/framing/shortcodes.py | Python | mit | 987 |
"""This module holds classes for image loading and manipulation."""
import copy
import io
import pathlib
from collections import Counter, Iterable
from datetime import datetime
from io import BytesIO, BufferedReader
import re
import os.path as osp
import os
from typing import Union, Sequence, List, Any, Tuple, Optional... | jrkerns/pylinac | pylinac/core/image.py | Python | mit | 39,827 |
from collections import OrderedDict
from functools import wraps
from rest_framework import routers, status
from rest_framework.response import Response
from rest_framework.settings import api_settings
def _safe_run(func, *args, **kwargs):
"""
Try to run a function with given arguments. If it raises an excepti... | ycheng-aa/qr_server | apps/common/bulk_operations.py | Python | mit | 5,560 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/models/payment_gateway_accounts_info.py | Python | mit | 3,706 |
import pytest
import uqbar.strings
import supriya.assets.synthdefs
import supriya.nonrealtime
import supriya.patterns
pattern = supriya.patterns.Pgpar(
[
supriya.patterns.Pmono(
amplitude=1.0,
duration=1.0,
frequency=supriya.patterns.Pseq([440, 660, 880, 990], 1),
... | Pulgama/supriya | tests/test_patterns_Pgpar.py | Python | mit | 12,255 |
import pytest
from scoring_engine.models.team import Team
from scoring_engine.models.user import User
from scoring_engine.models.service import Service
from scoring_engine.models.check import Check
from tests.scoring_engine.helpers import generate_sample_model_tree, populate_sample_data
from tests.scoring_engine.unit... | pwnbus/scoring_engine | tests/scoring_engine/models/test_team.py | Python | mit | 6,383 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------
# File Name: __init__.py
# Author: Zhao Yanbai
# Fri Oct 31 14:58:04 2014
# Description: none
# ------------------------------------------------------------------------
| acevest/monitor | core/__init__.py | Python | gpl-2.0 | 310 |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class EdxPipeline(object):
def process_item(self, item, spider):
return item
| cdhekne/My_Thesis | Thesis_WebCrawler/edx/edx/pipelines.py | Python | apache-2.0 | 257 |
# Copyright (C) 2008 Associated Universities, Inc. Washington DC, USA.
#
# 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 3 of the License, or
# (at your option) any later version.... | nrao/guppi-controller | src/update_simulator.py | Python | gpl-3.0 | 2,143 |
import sys, os, copy
sys.path.append("../../")
from utils import Utils, WordDict
import numpy as np
u = Utils()
n_random = 30
in_file = "phrases_00.txt"
out_file = "phrases.txt"
phrases = u.loadText(in_file).replace("\r", "")
phrases = phrases.split('\n')[0:-1]
indices = np.random.randint(low=0, high=(len(phrase... | singleswitch/ticker | experiments/audio_user_trials/random_phrase_select.py | Python | mit | 464 |
import pytest
import hearinglosssimulator as hls
import matplotlib.pyplot as plt
from matplotlib.cm import get_cmap
import numpy as np
def test_cgc_filter():
freqs = [5000.]
#~ freqs = [ 125*2**i for i in range(7) ]
#~ freqs = hls.erbspace(80.,15000., 16.)
#~ compression_degree = [1]
#~ com... | samuelgarcia/HearingLossSimulator | hearinglosssimulator/tests/test_cgcfilter.py | Python | mit | 4,194 |
import warnings
from flask import Flask
from flask.ext.cors import CORS
from flask.ext.sqlalchemy import SQLAlchemy
import sqlalchemy
app = Flask(__name__)
db = SQLAlchemy()
def configure(config):
configure_application(config)
configure_database()
configure_json()
configure_cors()
def configure_ap... | lojban/valis | valis/context.py | Python | gpl-3.0 | 1,078 |
"""
Tests for Django template context processors.
"""
from __future__ import absolute_import
from django.conf import settings
from django.test import TestCase
from django.test.client import RequestFactory
from lms.djangoapps.mobile_api.context_processor import is_from_mobile_app
class MobileContextProcessorTests(Te... | ESOedX/edx-platform | lms/djangoapps/mobile_api/tests/test_context_processor.py | Python | agpl-3.0 | 1,087 |
"""
Master Boot Record
The first sector on disk, contains the partition table, bootloader, et al.
http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
"""
from binascii import unhexlify
from construct import *
mbr = Struct("mbr",
HexDumpAdapter(Bytes("bootloader_code", 446)),
Array(4,
Struct... | gkonstantyno/construct | construct/formats/filesystem/mbr.py | Python | mit | 2,596 |
"""
Form components for working with trees.
"""
from django import forms
from django.forms.forms import NON_FIELD_ERRORS
from django.forms.util import ErrorList
from django.utils.encoding import smart_unicode
from django.utils.html import conditional_escape, mark_safe
from django.utils.translation import ugettext_lazy ... | pjdelport/django-mptt | mptt/forms.py | Python | mit | 7,040 |
__version__ = '0.1.7'
| amikrop/django-uaccounts | uaccounts/__init__.py | Python | bsd-3-clause | 22 |
# -*- coding: utf-8 -*-
"""Wordze.com API python bindings."""
__all__ = ("Api", "ApiError", "HistoryKeyword", "Keyword",
"history", "search", "status", "single")
import urllib
import urllib2
import urlparse
from functools import wraps, partial
from datetime import datetime
from xml.dom.minidom import Elem... | ActiveState/code | recipes/Python/577018_Wordzecom_API_bindings/recipe-577018.py | Python | mit | 8,536 |
"""
If we list all the natural numbers below 10 that are multiples of 3 or 5,
we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
# Only Add Known Multiples, but still O(n)
def quicker_multiples_of_3_and_5(top_limit):
multiplier = 1
multiples = ... | bigfatpanda-training/pandas-practical-python-primer | training/level-1-the-zen-of-python/bfp-reference/multiples_of_3_and_5.py | Python | artistic-2.0 | 1,312 |
__author__ = 'saftophobia'
| Saftophobia/shunting | data/__init__.py | Python | mit | 28 |
from django.conf.urls import patterns, include, url
import test_project.views as views
urlpatterns = [
url(r'^computer/(?P<id>[0-9]+)/license/(?P<field_pk>[0-9]+)$', views.index, name="computer-license-detail"),
]
| mixman/django-js-utils | test_project/urls_api.py | Python | mit | 220 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License... | oeeagle/quantum | neutron/tests/unit/services/vpn/test_vpnaas_extension.py | Python | apache-2.0 | 26,021 |
#
#
# Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012 Google Inc.
#
# 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.
#
... | sarahn/ganeti | lib/bootstrap.py | Python | gpl-2.0 | 36,301 |
# Copyright 2016 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 applicable law or a... | BaluDontu/docker-volume-vsphere | esx_service/utils/auth_data.py | Python | apache-2.0 | 26,778 |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = ""
services_str = ""
pkg_name = "tsim"
dependencies_str = "std_msgs;geometry_msgs"
langs = "gencpp;genlisp;genpy"
dep_include_paths_str = "std_msgs;/opt/ros/groovy/share/std_msgs/cmake/../msg;geometry_msgs;/opt/ros/groovy/share/geometry_msgs/cmake/../m... | rafafigueroa/cws | build/tsim/cmake/tsim-genmsg-context.py | Python | apache-2.0 | 404 |
"""mischia 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='home')
Class-bas... | l-dfa/Mischia | mischia/urls.py | Python | gpl-2.0 | 803 |
import numpy as np
from scipy import optimize
from matplotlib import pyplot as plt, cm, colors
from math import *
def calc_R(x,y, xc, yc):
""" calculate the distance of each 2D points from the center (xc, yc) """
return np.sqrt((x-xc)**2 + (y-yc)**2)
def f(c, x, y):
""" calculate the algebraic distance be... | thomasvdv/flightbit | analysis/least_square_circle.py | Python | gpl-2.0 | 1,345 |
# Copyright (c) 2010 Witchspace <witchspace81@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | XertroV/bitcoin-python3 | src/bitcoinrpc/exceptions.py | Python | mit | 7,464 |
#!/usr/local/django-oscar/oscar/bin/python2.7
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97-01-18 fl Made optimize an option (PNG... | vicky2135/lucious | oscar/bin/pilconvert.py | Python | bsd-3-clause | 2,385 |
"""
------------------------------------------------------------------------------
The MIT License (MIT)
Copyright (c) 2016 Newcastle University
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 wi... | casnortheast/microbit_stub | test_microbit_stub.py | Python | mit | 30,460 |
from __future__ import unicode_literals
from collections import OrderedDict
import hashlib
import os
import posixpath
import re
import json
from django.conf import settings
from django.core.cache import (caches, InvalidCacheBackendError,
cache as default_cache)
from django.core.exception... | simbha/mAngE-Gin | lib/django/contrib/staticfiles/storage.py | Python | mit | 14,803 |
# Copyright 2019 Google LLC. 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 applicable law or ag... | google/glazier | glazier/lib/actions/googet.py | Python | apache-2.0 | 2,611 |
# Copyright 2021 The Pigweed 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 law or agreed to in ... | google/pigweed | pw_symbolizer/py/pw_symbolizer/__init__.py | Python | apache-2.0 | 784 |
'''function Criptografia(Senha: string): string;
var x, y: Integer;
NovaSenha: string;
begin
for x := 1 to Length(Chave) do
begin
NovaSenha := '';
for y := 1 to Length(Senha) do
NovaSenha := NovaSenha + chr((Ord(Chave[x]) xor Ord(Senha[y])));
Senha := NovaSenha;
end;
result := Senha;
end;
'''
import... | gomesar/sec-stuff | extras/cripto.py | Python | mit | 2,321 |
from werkzeug import secure_filename
from flask_wtf import Form
from flask_wtf.file import FileField
from flask import Flask,render_template,request,flash
from forms import ClientForm
from flask.ext.wtf import Form
from comm_client import send_file
app=Flask(__name__)
app.secret_key='wehajfhsdgf3876845FRtff%6@#4'
@ap... | denisshockwave/image_processing_ocr_server | app/client.py | Python | gpl-3.0 | 909 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | polyaxon/polyaxon | core/polyaxon/polyflow/events/__init__.py | Python | apache-2.0 | 6,731 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##This file is part of pySequence
#############################################################################
#############################################################################
## ##
## ... | cedrick-f/pySequence | src/grilles.py | Python | gpl-3.0 | 43,902 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
np.set_printoptions(precision=4)
train_data_name = './dataset/winequality-white.csv'
feature_num = 11
enable_test = True
quadratic = True
def read_data():
train_set = np.genfromtxt(train_data_name, comments='#', delimiter=';')
return (train_set, ... | legendlee1314/ooni | ml/linear_regression.py | Python | mit | 1,332 |
import datetime
import logging
from typing import Dict, Optional, Tuple
from ...RateLimiter import RateLimiter
from . import (
ApplicationRateLimiter,
MethodRateLimiter,
OopsRateLimiter,
InternalLimiter,
)
LOG = logging.getLogger(__name__)
class BasicRateLimiter(RateLimiter):
__application_rat... | pseudonym117/Riot-Watcher | src/riotwatcher/Handlers/RateLimit/BasicRateLimiter.py | Python | mit | 1,851 |
import numpy as np
a = np.array([0, 2, 3, 6])
b = np.array([3, 4, 5, 15])
print(np.gcd(a, b))
# [3 2 1 3]
print(type(np.gcd(a, b)))
# <class 'numpy.ndarray'>
l_a = [0, 2, 3, 6]
l_b = [3, 4, 5, 14]
print(np.gcd(l_a, l_b))
# [3 2 1 2]
print(type(np.gcd(l_a, l_b)))
# <class 'numpy.ndarray'>
print(np.gcd(6, 15))
# 3... | nkmk/python-snippets | notebook/numpy_gcd.py | Python | mit | 807 |
### BEGIN LICENSE
# Copyright (C) 2011 Guillaume Hain <zedtux@zedroot.org>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation
#
# This program is distributed in the hope that it will be... | cemmanouilidis/naturalscrolling | naturalscrolling/indicator.py | Python | gpl-3.0 | 3,094 |
# Using the standard library's xml.etree.ElementTree module.
#
# Eli Bendersky [http://eli.thegreenplace.net]
# This code is in the public domain.
import sys
import xml.etree.ElementTree as ET
count = 0
for event, elem in ET.iterparse(sys.argv[1], events=("end",)):
if event == "end":
if elem.tag == 'locati... | eliben/code-for-blog | 2019/xml-stream/etree-count.py | Python | unlicense | 434 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import sys
import re
from asv.results import iter_results_for_machine
from . import tools
from .tools import dummy_pack... | spacetelescope/asv | test/test_continuous.py | Python | bsd-3-clause | 1,967 |
#!/usr/bin/env python
# -*- noplot -*-
"""
This example demonstrates how to set a hyperlinks on various kinds of elements.
This currently only works with the SVG backend.
"""
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
f = plt.figure()
s = plt.scatter... | bundgus/python-playground | matplotlib-playground/examples/pylab_examples/hyperlinks.py | Python | mit | 874 |
#
# Authors: Travis Oliphant, Ed Schofield, Robert Cimrman, Nathan Bell, and others
""" Test functions for sparse matrices. Each class in the "Matrix class
based tests" section become subclasses of the classes in the "Generic
tests" section. This is done by the functions in the "Tailored base
class for generic tests" ... | nvoron23/scipy | scipy/sparse/tests/test_base.py | Python | bsd-3-clause | 151,696 |
from typing import Any
from django.core.management.base import CommandParser
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.message import maybe_update_first_visible_message_id
from zerver.models import Realm
class Command(ZulipBaseCommand):
help = """Calculate the value of first visible mes... | showell/zulip | zilencer/management/commands/calculate_first_visible_message_id.py | Python | apache-2.0 | 1,074 |
import os
gettext = lambda s: s
DATA_DIR = os.path.dirname(os.path.dirname(__file__))
"""
Django settings for flex project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settin... | samastur/flexlayout | flex/settings.py | Python | mit | 5,343 |
input = """
a :- a.
a | b.
"""
output = """
a :- a.
a | b.
"""
| veltri/DLV2 | tests/parser/bug.40.test.py | Python | apache-2.0 | 67 |
import unittest
import os
import tempfile
import numpy as np
from numpy import ma
from numpy.testing import assert_array_almost_equal
from netCDF4p import Dataset, default_fillvals
# Test automatic scaling of variables (set_auto_scale())
class SetAutoScaleTestBase(unittest.TestCase):
"""Base object for tests c... | mathause/netCDF4p | test/tst_scaled.py | Python | mit | 5,177 |
#!/usr/bin/env python
#
# Copyright (c) 2015 All rights reserved
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
"""Tempest testcases impleme... | mywulin/functest | functest/opnfv_tests/openstack/tempest/tempest.py | Python | apache-2.0 | 20,259 |
from __future__ import unicode_literals
import ctypes
import json
import random
from binascii import a2b_hex, b2a_hex
from io import BytesIO
from django.contrib.gis import memoryview
from django.contrib.gis.geos import (GEOSException, GEOSIndexError, GEOSGeometry,
GeometryCollection, Point, MultiPoint, Polygon, M... | javiergarridomellado/Empresa_django | devcodela/lib/python2.7/site-packages/django/contrib/gis/geos/tests/test_geos.py | Python | gpl-2.0 | 44,442 |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listtransactions API."""
from decimal import Decimal
from test_framework.test_framework impo... | cculianu/bitcoin-abc | test/functional/wallet_listtransactions.py | Python | mit | 4,922 |
###########################################################################
## PyBot ##
## Copyright (C) 2015, Kyle Repinski ##
## Copyright (C) 2015, Andres Preciado (Glitch) ##
## ... | MWisBest/PyBot | Commands/high/high.py | Python | gpl-3.0 | 1,795 |
import urllib2
import urllib
import json
import active_keys
urlbase = "http://api.amp.active.com/v2/search?%s"
def search_query(activity,location):
query_params = urllib.urlencode({"api_key":active_keys.search2_key,"query":query})
req = urllib.urlopen(urlbase%query_params)
print req.geturl()
resp = r... | anirudhranganath/mashventure | app/modules/ActiveInteractor/search.py | Python | gpl-3.0 | 346 |
# Copyright 2021 The Pigweed 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 law or agreed to in ... | google/pigweed | pw_env_setup/py/pw_env_setup/shell_visitor.py | Python | apache-2.0 | 6,987 |
# -*- coding: utf-8 -*-
"""Model unit tests."""
import datetime as dt
import pytest
from martbell.user.models import User, Role
from .factories import UserFactory
@pytest.mark.usefixtures('db')
class TestUser:
def test_get_by_id(self):
user = User('foo', 'foo@bar.com')
user.save()
retri... | tinker20/tinnker-flask | tests/test_models.py | Python | bsd-3-clause | 1,681 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | qiskit/circuit/parameter.py | Python | apache-2.0 | 2,170 |
#!/bin/env python
# mainly for sys.argv[], sys.argv[0] is the name of the program
import sys
import time
# mainly for arrays
import numpy as np
# Time the following methods
def a():
print 'hello'
def b():
print 'hi'
if __name__ == '__main__':
print 'hello'
| ketancmaheshwari/hello-goog | src/python/timeit.py | Python | apache-2.0 | 276 |
"""Token Class"""
class Token:
def __init__(self, lexeme, tCode):
self.lexeme = ""
self.tCode = "" | davidk12/FMAL-Compiler | Token.py | Python | gpl-2.0 | 104 |
import math
import random
import numpy as np
import IMP
import IMP.core
import IMP.test
def _get_beta(N, b):
return 3. / (2. * N * b**2)
def _get_score(z, N, b):
beta = _get_beta(N, b)
return beta * z**2 - math.log(2 * beta * z)
def _get_derv(z, N, b):
beta = _get_beta(N, b)
return 2 * beta *... | shanot/imp | modules/core/test/test_surface_tethered_chain.py | Python | gpl-3.0 | 3,454 |
##
# Copyright 2009-2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | hajgato/easybuild-easyblocks | easybuild/easyblocks/h/hpl.py | Python | gpl-2.0 | 4,729 |
#!/usr/bin/env python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | googleapis/python-vision | samples/snippets/detect/detect.py | Python | apache-2.0 | 38,224 |
from population import Population
from cell import Cell
# Create population for the simulation
p = Population(Cell(drug_resistance=2, can_divide=True))
# Start loop
while True:
action = raw_input('Enter action (tick/kill/quit): ')
if(action == 'tick'):
number_of_ticks = int(raw_input('Enter number o... | sabarjp/ClonalCellSimulation | simulate.py | Python | mit | 715 |
#!C:\Users\Beatriz\Desktop\django\pasta\Scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| beatrizjesus/my-first-blog | pasta/Scripts/django-admin.py | Python | mit | 165 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/test_ones_op.py | Python | apache-2.0 | 3,441 |
# coding=utf-8
"""
Calculs statistiques.
Many function to refactor to python function.
"""
# @Author: Zackary BEAUGELIN <gysco>
# @Date: 2017-04-11T10:01:21+02:00
# @Email: zackary.beaugelin@epitech.eu
# @Project: SSWD
# @Filename: statistics.py
# @Last modified by: gysco
# @Last modified time: 2017-06-16T11:39:... | Gysco/SSWD | pyment/statistics.py | Python | gpl-3.0 | 54,420 |
# This file is part of the Perspectives Notary Server
#
# Copyright (C) 2011 Dan Wendlandt
#
# 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 3 of the License.
#
# This progra... | danwent/Perspectives-Server | client/simple_client.py | Python | gpl-3.0 | 2,821 |
__author__ = 'arobres'
import requests
from nose.tools import assert_equals, assert_true
import ujson
#OK WE NOW CAN SEND MESSAGES TO THE FORUM
THEME_LIST = ['Security', 'Development', 'Automation', 'Testing']
message_body = {}
message_body['theme'] = ''
message_body['subject'] = ''
message_body['message'] = ''
prin... | twiindan/forum | test/demo/demo_3.py | Python | gpl-2.0 | 1,814 |
import json
import gen
from gen.tests.utils import make_arguments, true_false_msg, validate_error, validate_success
dns_forward_zones_str = """\
[["a.contoso.com", [["1.1.1.1", 53], \
["2.2.2.2", 53]]], \
["b.contoso.com", [["3.3.3.3", 53], \
["4.4.4.4", 53]]]] \
"""
bad_dns... | lingmann/dcos | gen/tests/test_validation.py | Python | apache-2.0 | 22,929 |
import json
from django.urls import reverse
from rest_framework.test import APITestCase
from cities.models import State
class StateViewTestCase(APITestCase):
def test_correct_fields_list(self):
"""Verify the correct serializer is being used"""
State.objects.create(code=1, name="State", abbr="st"... | dirtycoder/pets | pets/api/tests/test_view_state.py | Python | mit | 628 |
# -*- coding: utf-8 -*-
"""
Optimization ops.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def optimize(cost,
optimizer,
global_step,
max_grad_norm=5.0):
""" Helper funciton to return... | giancds/attentive_lm | optimization_ops.py | Python | apache-2.0 | 1,569 |
from django.contrib import admin
from django import forms
from models import UserAccess, CharacterAccessRule, CorpAccessRule, AllianceAccessRule, StandingAccessRule
class UserAccessForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(UserAccessForm, self).__init__(*args, **kwargs)
inst... | Adarnof/adarnauth | access/admin.py | Python | gpl-2.0 | 2,180 |
#!/usr/bin/python
# Copyright 2015 Intel corporation
#
# 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 ... | coolsvap/kolla | docker/kolla-toolbox/kolla_sanity.py | Python | apache-2.0 | 2,652 |
from django.core import serializers
from django.shortcuts import render, redirect
from flow.models import *
from django.http import HttpResponse
from json import dumps
def index(request):
f = Flow.objects.all()
return render(request, 'flow/index.html', {'flows': f})
def show(request, id):
f = Flow.objects... | coffenbacher/bjj | flow/views.py | Python | agpl-3.0 | 1,006 |
# coding=utf-8
__author__ = 'litao'
from sqlalchemy import create_engine
import tushare as ts
try:
df = ts.get_hist_data('600848')
engine = create_engine('mysql://root:123456@127.0.0.1/stock?charset=utf8')
df.insert(0,'code','600848')
#df.to_sql('hist_data',engine,if_exists='append')
df = ts.get_s... | nfsli926/stock | python/com/nfs/getStockBytushare.py | Python | apache-2.0 | 1,305 |
#coding:utf-8
'''
1ãæ³åä¸ä¸ªçè§æå¡å¨æ¯å¦è¿è¡çç®åæå¡ï¼ç½ä¸æå°çä¾ç¨ä¸å¤ªå®åï¼å¦æ¢
岿¾ç许ä¹?
æ²¡ææ´æ°ï¼è?ä¸SvcDoRunåå¾ä¸å®æ´ï¼è§http://www.chinaunix.net/jh/55/558190.htmlï¼?
ä¸ç¥éæ¯ä¸æ¯åå§åºå¤ï¼ï¼èmail.python.orgä¸ç没æå®ä¹_svc_name_çå... | ptphp/PyLib | src/devs/winnt.py | Python | apache-2.0 | 3,864 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# 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... | stefanhahmann/pybossa | test/test_model/test_model_taskrun.py | Python | agpl-3.0 | 2,161 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleads/google-ads-python | google/ads/googleads/interceptors/metadata_interceptor.py | Python | apache-2.0 | 5,368 |
# Transcribing DNA into RNA
# rosalind.info/problems/rna
import sys
class rna:
def main(self, dna_seq):
dna_seq = list(dna_seq)
for idx, i in enumerate(dna_seq):
if i == 'T':
dna_seq[idx] = 'U'
print(''.join(dna_seq))
if __name__ == '__main__':
f... | yuriyshapovalov/Prototypes | Rosalind/rna.py | Python | apache-2.0 | 513 |
#!/usr/bin/python3
# -*- coding: utf-8, vim: expandtab:ts=4 -*-
"""
trainer.py is a module of HunTag and is used to train maxent models
"""
import sys
from collections import Counter, defaultdict
import joblib
from scipy.sparse import csr_matrix
import numpy as np
from array import array
from sklearn.linear_model imp... | ppke-nlpg/HunTag3 | huntag/trainer.py | Python | lgpl-3.0 | 15,454 |
#!/usr/bin/env python
import click
import os
import shutil
import uuid
from nlppln.utils import create_dirs, out_file_name
@click.command()
@click.argument('in_file', type=click.Path(exists=True))
@click.option('--rename', type=click.Choice(['random', 'spaces', 'copy']),
default='spaces')
@click.option... | WhatWorksWhenForWhom/nlppln | nlppln/commands/copy_and_rename.py | Python | apache-2.0 | 798 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2008 Albert Astals Cid <aacid@kde.org>
# 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 opt... | jsj2008/kdegames | ktuberling/soundthemecheker.py | Python | gpl-2.0 | 4,415 |
import squeakspace.common.util as ut
import squeakspace.common.util_http as ht
import squeakspace.proxy.server.db_sqlite3 as db
import squeakspace.common.squeak_ex as ex
import config
def post_handler(environ):
query = ht.parse_post_request(environ)
cookies = ht.parse_cookies(environ)
user_id = ht.get_re... | eek6/squeakspace | www/proxy/scripts/local/node_addr.py | Python | gpl-3.0 | 2,510 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.