commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
497f1c70d0ecedb904f5b71be494e01246d874f6 | Add weight test | Net-ng/kansha,bcroq/kansha,bcroq/kansha,Net-ng/kansha,bcroq/kansha,bcroq/kansha,Net-ng/kansha,Net-ng/kansha | kansha/card_addons/weight/tests.py | kansha/card_addons/weight/tests.py | # -*- coding:utf-8 -*-
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
from kansha.cardextension.tests import CardExtensionTestCase
from .comp im... | bsd-3-clause | Python | |
6aed81e89e321f45ba2ff95bfb0c78504c0bf79e | add setup_database script (tests) using scripts/import_osm.sh (in progress) | iBis-project/server-python | tests/setup_database.py | tests/setup_database.py | #!/usr/bin/env python
import argparse
import subprocess
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-l", "--osm_url", required=True, help="OSM download URL (*.osm.bz2)", type=str)
parser.add_argument("-p", "--user", required=True, help="PostgreSQL database password", type=str)
... | agpl-3.0 | Python | |
783b04ad8da2b65d9a07a0bdd4f236273f9ad39d | Create test.py | shivarajnesargi/BotOrNot | ProjectMidway/test.py | ProjectMidway/test.py | mit | Python | ||
7383343f7fb77c74455a50490ad2886fcf36bbd5 | Comment test for the moment | Widukind/dlstats,mmalter/dlstats,mmalter/dlstats,MichelJuillard/dlstats,MichelJuillard/dlstats,MichelJuillard/dlstats,mmalter/dlstats,Widukind/dlstats | dlstats/fetchers/test_ecb.py | dlstats/fetchers/test_ecb.py | import unittest
import mongomock
import ulstats
from dlstats.fetchers._skeleton import (Skeleton, Category, Series, BulkSeries,
Dataset, Provider)
import datetime
from bson import ObjectId
#class CategoriesTestCase(unittest.TestCase):
#if __name__ == '__main__':
# unittest.ma... | agpl-3.0 | Python | |
e446ab24ba981b22bf84ae2e09a8ba62cf17528e | Create batch_download.py | kevinkid135/Horriblesubs-Batch-Download | batch_download.py | batch_download.py | import time #used to pause script
import os #library used to open magnet link
from selenium import webdriver #use selenium
#global variables
driverLocation = "C:/Users/Kevin/Downloads/Browsers/chromedriver.exe"
url = "http://horriblesubs.info/shows/shigatsu-wa-kimi-no-uso/"
quality = "1080p"
download_format = "Magnet"... | mit | Python | |
fa0886bdeab19cb326a3e751dff1c46fb7911228 | Apply migration 1160 again | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | migrations/versions/1180_set_framework_datetimes_not_nullable_again.py | migrations/versions/1180_set_framework_datetimes_not_nullable_again.py | """Remove deprecated application_close_date field and set the remaining date fields to non-nullable.
Revision ID: 1180
Revises: 1170
Create Date: 2018-05-08 09:53:43.699711
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import table, column, and_
# r... | mit | Python | |
9167643047c61bae50a7c73775631c7bfe434cc9 | Add a new wrapper class for managing ansible static inventory. | bdastur/spam,bdastur/spam | spam/ansiInventory.py | spam/ansiInventory.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
AnsibleInventory:
INTRO:
USAGE:
"""
import os
import ansible.inventory
class AnsibleInventory(object):
'''
Ansible Inventory wrapper class.
'''
def __init__(self, inventory_filename):
'''
Initialize Inventory
'''
if... | apache-2.0 | Python | |
77eecb7a809a7b4f56d70e6d7e09deb2c7e0188b | add template engine | zenanhu/pluto,zenanhu/pluto,zenanhu/pluto,zenanhu/pluto | template-engine/code/templite.py | template-engine/code/templite.py | #!/usr/bin/env python
# coding: utf-8
class CodeBuilder(object):
INDENT_STEP = 4
def __init__(self, indent=0):
self.code = []
self.indent_level = indent
def add_line(self, line):
self.code.extend([" " * self.indent_level, line, "\n"])
def indent(self):
self.indent_le... | apache-2.0 | Python | |
c8f504c52f9e981b3974f4be1581da890021473a | add new collector for cassandra cfstats | MediaMath/Diamond,MediaMath/Diamond,MediaMath/Diamond,MediaMath/Diamond | src/collectors/mmcassandra/mmcassandra.py | src/collectors/mmcassandra/mmcassandra.py | import subprocess, socket, math
import diamond.collector
def parse_line(line):
metric_name, rhs = line.strip().split(':', 1)
rhs = rhs.strip()
if ' ' in rhs:
str_value, units = rhs.split(' ', 1)
if units not in ('ms', 'ms.'):
raise ValueError("Cannot parse " + repr(line))
... | mit | Python | |
ebd15d9bcf5a46417af7f3d46769716c4d12b793 | rename pre_push hook | kriskavalieri/nodejs-docker-boilerplate,kriskavalieri/nodejs-docker-boilerplate | pre_push.py | pre_push.py | #!/usr/bin/env python
import atexit
import glob
import os
import re
import subprocess
import sys
stable_branch_re = re.compile(r'master|stable|prod|production')
def chain_cmds(cmds, stdin=None):
for cmd in cmds:
p = subprocess.Popen(cmd, stdin=stdin, stdout=subprocess.PIPE)
stdin = p.stdout
re... | mit | Python | |
a123b42eb3aed078aea26109056cf786aec2664a | add link_flair.py for interacting with link flair on submissions | rhots/automation | bin/link_flair.py | bin/link_flair.py | import argparse
import praw
def main():
parser = argparse.ArgumentParser(description='Get or set link flair')
parser.add_argument('action', choices=['get', 'set'], help='get or set')
parser.add_argument('id', help='id of the submission')
parser.add_argument('--text', help='link flair text to set')
... | isc | Python | |
495e9680ae7c1b9c1071c9f840df7881f5d4934b | add a Spider to KFC#15 | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/kfc.py | locations/spiders/kfc.py | import json
import re
import scrapy
from locations.items import GeojsonPointItem
class KFCSpider(scrapy.Spider):
name = "kfc"
allowed_domains = ["www.kfc.com"]
def start_requests(self):
url = 'https://services.kfc.com/services/query/locations'
headers = {
'Accept-Language': 'e... | mit | Python | |
a67a4e15ce25e9e9a795534b4e629d6680fb491b | Implement player choosing a random pawn to move | risteon/ludo_python | ludo/playermoverandom.py | ludo/playermoverandom.py | # Player
from playerbase import PlayerBase, Players
from random import randint
class PlayerMoveRandom(PlayerBase):
def get_desc(self):
""""Return description string"""""
return "Chooses a random pawn to move"
def _choose_move_impl(self, moves):
if not moves:
return None
... | mit | Python | |
298d4e6eaca54defe914530ebdee9ded255cfd79 | add lxc integration tests | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/lxc.py | tests/integration/modules/lxc.py | # -*- coding: utf-8 -*-
'''
Test the lxc module
'''
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath, requires_salt_modules
ensure_in_syspath('../../')
# Import salt libs
import integration
@requires_salt_modules('lxc.list')
class LXCModuleTest(integration.ModuleCase):
'''
Test ... | apache-2.0 | Python | |
c7e7430d76337ef5cfd6779d9a32c2c9d948eb86 | Add guess phred encoding script | jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public | carbon/guess-encoding.py | carbon/guess-encoding.py | """
awk 'NR % 4 == 0' your.fastq | python %prog [options]
guess the encoding of a stream of qual lines.
"""
import sys
import optparse
RANGES = {
'Sanger': (33, 93),
'Solexa': (59, 104),
'Illumina-1.3': (64, 104),
'Illumina-1.5': (67, 104)
}
def get_qual_range(qual_str):
"""
>>> get_qual_... | apache-2.0 | Python | |
7dbec704e0e9011b87940b48d21ab343f4003a8b | Add performance testing script. | Marketcircle/graypy,imankulov/graypy,severb/graypy,severb/graypy,stratosgear/graypy | perftest.py | perftest.py | #! /usr/bin/env python
import argparse
import logging
import logging.config
import sys
import time
def main(argv=sys.argv):
parser = argparse.ArgumentParser(prog="perftest.py")
parser.add_argument('--graylog-host',
help='Graylog2 host. Do not test GELFHandler if not specified.')
parser.add_argument... | bsd-3-clause | Python | |
06092ce552c78de4efdc5845d94146fd5cf6fd38 | add plot tool | ktarrant/options_csv | plot_csv.py | plot_csv.py | import pandas as pd
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go
import argparse
clean_text = lambda s: "".join([c for c in s if c.isalpha() or c.isdigit() or c==' ']).rstrip()
def make_hbar_plot(options_table, symbol, parameter):
data = [
go.Bar(
name=otype,
... | mit | Python | |
dbe71d02a95e65b644a1ac811712a31059975457 | test update | redhat-cip/dci-control-server,redhat-cip/dci-control-server,enovance/dci-control-server,enovance/dci-control-server | tests/api/v1/test_jobs_update.py | tests/api/v1/test_jobs_update.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 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 applicab... | apache-2.0 | Python | |
fdada5e48a13ef5b1c55710a584d281d36a32375 | Add stub for testing `generic_decorators`. | jakirkham/nanshe,jakirkham/nanshe,nanshe-org/nanshe,nanshe-org/nanshe,DudLab/nanshe,DudLab/nanshe | tests/test_generic_decorators.py | tests/test_generic_decorators.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 25, 2015 13:30:52 EDT$"
| bsd-3-clause | Python | |
61e0c6e325a91564250a937c0b1769992f65a7f5 | Add initial unit tests for swarm module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/modules/test_swarm.py | tests/unit/modules/test_swarm.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Libs
import salt.modules.swarm
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import patch
from tests.support.unit import Test... | apache-2.0 | Python | |
2e953f9571d132f2a346351b4593849e5c5bee14 | Add unit tests for download_repo_run_scan.py | spdx/spdx-github | run_scan/unit_test.py | run_scan/unit_test.py | import unittest
import download_repo_run_scan
from os import path, remove
import shutil
#Test that when given a valid zip file url,
#the download_github_zip will result in the creation
#of a local file at the returned location
class downloadFileTestCase(unittest.TestCase):
file_location = ''
url = 'https://github.co... | apache-2.0 | Python | |
a88959202e66d47f032797c2c5790461fe458392 | add tests boilerplates | wikedzit/bucketlist | api/v1/tests/test_api_tokens.py | api/v1/tests/test_api_tokens.py | import unittest
import json
class TestAuthentication(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_validates_user_inputs(self):
self.assertTrue(True)
def test_user_can_register(self):
self.assertTrue(True)
def test_no_ducplicated_use... | mit | Python | |
16850052ced6975ab99c73c2c15497a3f91ccab9 | Add reader back in again.. will use for blender | ndevenish/Blender_ioEDM,ndevenish/Blender_ioEDM | edm/reader.py | edm/reader.py | #!/usr/bin/env python3
import struct
from collections import namedtuple
from .typereader import get_type_reader
import logging
logger = logging.getLogger(__name__)
class Reader(object):
def __init__(self, filename):
self.filename = filename
self.stream = open(filename, "rb")
def tell(self):
return ... | mit | Python | |
8022d7361affddde110a289bc683201ea70af5fe | add weight conversion script | chainer/chainercv,yuyu2172/chainercv,pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv | examples/yolo/darknet2npz.py | examples/yolo/darknet2npz.py | import argparse
import numpy as np
import chainer
from chainer import serializers
from chainercv.links import Conv2DBNActiv
from chainercv.links import YOLOv3
def load(file, link):
if isinstance(link, Conv2DBNActiv):
for param in (
link.bn.beta.array,
link.bn.gamma.array,... | mit | Python | |
7bd4ecf4f0f16ed58f253ca16045c3dd86f0a28c | Test script. | zsiciarz/django-briefcase,zsiciarz/django-briefcase | runtests.py | runtests.py | # -*- coding: utf-8 -*-
import os
from django.conf import settings
def make_absolute_path(path):
return os.path.join(os.path.realpath(os.path.dirname(__file__)), path)
if not settings.configured:
settings.configure(
DATABASES = {
'default': {
'ENGINE': 'django.db.backen... | mit | Python | |
a4d5e88973a25464be26488d17ecc663cce776d7 | Add map example with data generators | jakevdp/altair,altair-viz/altair | altair/examples/world_map.py | altair/examples/world_map.py | """
World Map
---------
This example shows how to create a world map using data generators for
different background layers.
"""
# category: maps
import altair as alt
from vega_datasets import data
# Data generators for the background
sphere = alt.sphere()
graticule = alt.graticule()
# Source of land data
source = a... | bsd-3-clause | Python | |
8cbe2878f5fdca899ec71bc08e7d2de4a3c3caf2 | add python solution to "project euler - problem3" | mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler | problem3.py | problem3.py | number = 600851475143
for divisor in xrange(2,number):
if (number % divisor == 0):
print divisor, " is a divisor"
number = number / divisor
print "new number is", number
| mit | Python | |
f1976ef533d98ac6e423312435bb25692831bfd9 | Create bumper.py | LCAS/teaching,LCAS/teaching,LCAS/teaching,LCAS/teaching,LCAS/teaching | cmp3103m-code-fragments/scripts/bumper.py | cmp3103m-code-fragments/scripts/bumper.py | import rospy
from geometry_msgs.msg import Twist
from kobuki_msgs.msg import BumperEvent
class Chatter:
def __init__(self):
rospy.init_node('chatter')
self.publisher = rospy.Publisher('/mobile_base/commands/velocity', Twist, queue_size=1)
self.scan_sub = rospy.Subscriber('/mobile_base/eve... | mit | Python | |
d571af56293912042846047c88e4a7b2c2f40df9 | add archive command | mralext20/alex-bot | alexBot/cogs/memework.py | alexBot/cogs/memework.py | # -*- coding: utf-8 -*-
from ..tools import Cog
from discord.ext import commands
import discord
from datetime import datetime
class Memework(Cog):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.archive_cat = self.bot.get_channel(355886867285147648)
self.rowboa... | mit | Python | |
4b0656a2581df14bee4ae97da95f68360c24ee82 | Create rrd_export.py | ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station | scripts/rrd_export.py | scripts/rrd_export.py | #-------------------------------------------------------------------------------
#
# The MIT License (MIT)
#
# Copyright (c) 2015 William De Freitas
#
# 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 ... | mit | Python | |
d3166947023283ae6aed9737703c852552cf17f8 | Update app/extensions/allows/allows.py | apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl | app/extensions/allows/allows.py | app/extensions/allows/allows.py | from flask import current_app
from flask import request
from functools import wraps
from werkzeug import LocalProxy
from werkzeug.exceptions import Forbidden
class Allows(object):
def __init__(self, app=None, identity_loader=None,
throws=Forbidden, on_fail=None):
self._identity_loader = ... | mit | Python | |
37dc854c8af69c679f91163355b2a4314d66820b | Add a marker interface | usingnamespace/usingnamespace | usingnamespace/api/interfaces.py | usingnamespace/api/interfaces.py | from zope.interface import Interface
class ISerializer(Interface):
"""Marker Interface"""
| isc | Python | |
b4333af5737b1376452eb0490f4175a1554ba212 | Fix #116 | studio666/gratipay.com,eXcomm/gratipay.com,mccolgst/www.gittip.com,MikeFair/www.gittip.com,mccolgst/www.gittip.com,studio666/gratipay.com,gratipay/gratipay.com,bountysource/www.gittip.com,mccolgst/www.gittip.com,bountysource/www.gittip.com,eXcomm/gratipay.com,bountysource/www.gittip.com,eXcomm/gratipay.com,gratipay/gra... | configure-aspen.py | configure-aspen.py | import os
import gittip
import gittip.wireup
import gittip.authentication
import gittip.csrf
from gittip.networks import github
gittip.wireup.canonical()
gittip.wireup.db()
gittip.wireup.billing()
website.github_client_id = os.environ['GITHUB_CLIENT_ID'].decode('ASCII')
website.github_client_secret = os.environ['G... | import os
import gittip
import gittip.wireup
import gittip.authentication
import gittip.csrf
gittip.wireup.canonical()
gittip.wireup.db()
gittip.wireup.billing()
website.github_client_id = os.environ['GITHUB_CLIENT_ID'].decode('ASCII')
website.github_client_secret = os.environ['GITHUB_CLIENT_SECRET'].decode('ASCII... | cc0-1.0 | Python |
f42d2264917f109b8cee1d641a475934a456aa61 | Add a BaseFrontend | vrs01/mopidy,priestd09/mopidy,swak/mopidy,ZenithDK/mopidy,jcass77/mopidy,dbrgn/mopidy,diandiankan/mopidy,jodal/mopidy,diandiankan/mopidy,hkariti/mopidy,swak/mopidy,woutervanwijk/mopidy,jmarsik/mopidy,bencevans/mopidy,bacontext/mopidy,pacificIT/mopidy,rawdlite/mopidy,hkariti/mopidy,diandiankan/mopidy,tkem/mopidy,rawdlit... | mopidy/frontends/base.py | mopidy/frontends/base.py | class BaseFrontend(object):
"""
Base class for frontends.
:param core_queue: queue for messaging the core
:type core_queue: :class:`multiprocessing.Queue`
:param backend: the backend
:type backend: :class:`mopidy.backends.base.BaseBackend`
"""
def __init__(self, core_queue, backend):
... | apache-2.0 | Python | |
2d6ecb3b5b67539c6ad0f211d7b059ac44df2731 | Make gallery of examples for various bending angles up to 90 degrees | willettk/rgz-analysis,willettk/rgz-analysis,afgaron/rgz-analysis,willettk/rgz-analysis,afgaron/rgz-analysis,afgaron/rgz-analysis | python/bending_examples.py | python/bending_examples.py | # Make a gallery of images showing the RGZ consensus double sources, sorted by bending angle.
from astropy.io import ascii
path = '/Users/willettk/Astronomy/Research/GalaxyZoo'
data = ascii.read('{:}/rgz-analysis/csv/static_catalog3.csv'.format(path),delimiter=' ')
import bending_angles as ba
import numpy as np
pat... | mit | Python | |
93ba6ff584d84255f46ef11fb44e9ae863cd7aed | add demo about reversing arguments | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | python/src/reverse_args.py | python/src/reverse_args.py | # Copyright (c) 2014 ASMlover. 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 above copyright
# notice, this list ofconditions and the fol... | bsd-2-clause | Python | |
10964c0a3a1de2ba8c8d32c7aeed123b5712a759 | Test DbMixin with fake | adi-foundry/nycodex,alanhdu/nycodex,alexander-yu/nycodex,alexander-yu/nycodex,adi-foundry/nycodex | nycodex/tests/test_db.py | nycodex/tests/test_db.py | import pytest
import sqlalchemy
import testing.postgresql
from nycodex import db
class FakeTable(db.Base, db.DbMixin):
__tablename__ = "_fake_table"
id = sqlalchemy.Column(sqlalchemy.CHAR(9), primary_key=True)
name = sqlalchemy.Column(sqlalchemy.TEXT, nullable=False)
description = sqlalchemy.Column(... | import datetime as dt
import pytest
import pytz
import sqlalchemy
import testing.postgresql
from nycodex import db
@pytest.fixture
def engine():
with testing.postgresql.Postgresql() as postgresql:
engine = sqlalchemy.create_engine(postgresql.url())
db.Base.metadata.create_all(engine)
yie... | apache-2.0 | Python |
058eeefdef485595e48dcd0250bcf9dc9664287a | Add Launchpad (fixes #17) | foauth/foauth.org,foauth/foauth.org,foauth/oauth-proxy,foauth/foauth.org | services/launchpad.py | services/launchpad.py | from oauthlib.oauth1.rfc5849 import SIGNATURE_PLAINTEXT, SIGNATURE_TYPE_BODY, SIGNATURE_TYPE_AUTH_HEADER
import requests
import foauth.providers
class Launchpad(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://launchpad.net/'
docs_url = 'https://launchpad.net/+apidoc/1.0... | bsd-3-clause | Python | |
98232fea3f8847aad69ed6af0b37a5624c24488b | Add experiment script to run a dataset through all graph clustering method | studiawan/pygraphc | experiment.py | experiment.py | import fnmatch
import os
from pygraphc.preprocess.PreprocessLog import PreprocessLog
from pygraphc.preprocess.CreateGraph import CreateGraph
from pygraphc.clustering.MajorClust import MajorClust, ImprovedMajorClust
def get_dataset(dataset, dataset_path, file_extension):
# get all log files under dataset directory... | mit | Python | |
aee93802503a19b873299774e351ef883e81356b | Add functions.py to provide comment functions | kensonman/webframe,kensonman/webframe,kensonman/webframe | functions.py | functions.py | #-*- coding: utf-8 -*-
def getClientIP( req ):
'''
Get the client ip address
'''
xForwardedFor=req.META.get('HTTP_X_FORWARDED_FOR')
if xForwardedFor:
ip=xForwardedFor.split(',')[0]
else:
ip=req.META.get('REMOTE_ADDR')
return ip
def getBool( val, trueOpts=['YES', 'Y', '1', 'TRUE', 'T'] ):
'''
Retrieve the... | apache-2.0 | Python | |
f3a43d11f79766c43be6de359762bd37cde49b38 | Complete 3 pointer method | bowen0701/algorithms_data_structures | lc0611_valid_triangle_number.py | lc0611_valid_triangle_number.py | """Leetcode 611. Valid Triangle Number
Medium
URL: https://leetcode.com/problems/valid-triangle-number/
Given an array consists of non-negative integers,
your task is to count the number of triplets chosen from the array that can
make triangles if we take them as side lengths of a triangle.
Example 1:
Input: [2,2,3... | bsd-2-clause | Python | |
45a12a354783845d4f761147f6949797d8f6ffa3 | Add flat type driver unittests | mandeepdhami/neutron,skyddv/neutron,Stavitsky/neutron,aristanetworks/neutron,virtualopensystems/neutron,yamahata/tacker,barnsnake351/neutron,blueboxgroup/neutron,wenhuizhang/neutron,apporc/neutron,SamYaple/neutron,swdream/neutron,jacknjzhou/neutron,dhanunjaya/neutron,gkotton/neutron,blueboxgroup/neutron,watonyweng/neut... | neutron/tests/unit/ml2/test_type_flat.py | neutron/tests/unit/ml2/test_type_flat.py | # Copyright (c) 2014 Thales Services SAS
# 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 r... | apache-2.0 | Python | |
a68198514528773d2368e203491121b5c34f956d | Add tests of compile_ptx and compile_ptx_for_current_device | stuartarchibald/numba,stonebig/numba,seibert/numba,stonebig/numba,seibert/numba,seibert/numba,seibert/numba,sklam/numba,sklam/numba,stuartarchibald/numba,IntelLabs/numba,cpcloud/numba,cpcloud/numba,cpcloud/numba,numba/numba,numba/numba,stonebig/numba,gmarkall/numba,stuartarchibald/numba,cpcloud/numba,sklam/numba,gmarka... | numba/cuda/tests/cudapy/test_compiler.py | numba/cuda/tests/cudapy/test_compiler.py | from math import sqrt
from numba import cuda, float32, void
from numba.cuda import compile_ptx, compile_ptx_for_current_device
from numba.cuda.testing import skip_on_cudasim, unittest
@skip_on_cudasim('Compilation unsupported in the simulator')
class TestCompileToPTX(unittest.TestCase):
def test_global_kernel(se... | bsd-2-clause | Python | |
e2fa74c533b49cb3479d4c75d5b68f6993e33082 | Add new package:linsys-v (#16823) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/linsys-v/package.py | var/spack/repos/builtin/packages/linsys-v/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class LinsysV(MakefilePackage):
"""LINSYS_V: Verified Solution of Linear Systems"""
homepa... | lgpl-2.1 | Python | |
1c0230f7d0add83c36daadcf88bda72500e49015 | add new package (#22648) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/rnaquast/package.py | var/spack/repos/builtin/packages/rnaquast/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
class Rnaquast(Package):
"""Quality assessment of de novo transcriptome assemblies fro... | lgpl-2.1 | Python | |
3c26db43490640e0a98f5c22bb65eecd2c1c5ba9 | Create sudoku_formatter.py | KGHustad/SudokuFormatter | sudoku_formatter.py | sudoku_formatter.py | instructions = """INSTRUCTIONS:
Copy a sudoku puzzle from http://www.menneske.no/sudoku/ to a text file,
and provide this file as the first command line argument and the file for
output as the second command line argument
Remember that box height and width must be added manually (before/after
formatting)"""
import... | mit | Python | |
710fe77b1d03de83cfefa3173b17d2adf5f220fe | Add systemd watchdog | AngryDevelopersLLC/res-core | systemd_watchdog.py | systemd_watchdog.py | # RES Service Package
# Copyright © 2015 InvestGroup, LLC
import asyncio
import logging
def install_watchdog(interval, loop=None):
assert isinstance(interval, (int, float)) and interval > 0
logger = logging.getLogger("systemd-watchdog")
try:
from systemd.daemon import notify as sd_notify
exc... | bsd-3-clause | Python | |
5f0feca62055dafd9931bf68abe3286bda9f41e0 | Create __init__.py | ShashaQin/frappe,ShashaQin/frappe,ShashaQin/frappe,ShashaQin/frappe | frappe/desk/doctype/communication_reconciliation/__init__.py | frappe/desk/doctype/communication_reconciliation/__init__.py | import frappe
@frappe.whitelist(allow_guest=True)
def relink(self,name,reference_doctype,reference_name):
dt = reference_doctype
dn = reference_name
if dt=="" or dt==None or dn == "" or dn == None:
return # is blank maybe try flash missing required
frappe.db.sql("""update `tabCommunication`
set reference_docty... | mit | Python | |
c07609fa140c54572832f4f8f4787d0991495e60 | check in some migrations | xmaruto/mcord,cboling/xos,cboling/xos,cboling/xos,xmaruto/mcord,jermowery/xos,cboling/xos,xmaruto/mcord,cboling/xos,jermowery/xos,xmaruto/mcord,jermowery/xos,jermowery/xos | planetstack/core/migrations/0002_omf_friendly_default_false.py | planetstack/core/migrations/0002_omf_friendly_default_false.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='slice',
name='omf_friend... | apache-2.0 | Python | |
18178108ec569ec959c7cac181fa439d99a0170f | convert a patric tab file to a seed directory | linsalrob/PhiSpy,linsalrob/PhiSpy,linsalrob/PhiSpy,linsalrob/PhiSpy | tab2seed.py | tab2seed.py | """
Convert a tab file from PATRIC to a the SEED files that we need for PhiSpy
We need the following files:
1. assigned_functions - a tab separated list of FIG ID and function
2. contigs - the fasta DNA sequence. Note we may download this separately
3. genome - the name of the genome -- may not be required
4. taxonom... | mit | Python | |
45c20be4027ccb7aa6a1c3e643ca164413bd353f | add management command for commenting on outstanding apps about tos changes. | WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight | TWLight/applications/management/commands/notify_applicants_tou_changes.py | TWLight/applications/management/commands/notify_applicants_tou_changes.py | import logging
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
from TWLight.applications.models import Application
from TWLight.resources.models import Partner
from django_comments.models import Comment
logger = loggi... | mit | Python | |
378e89fd74cfd383c3e1b21fc342194728f66bb7 | Add DogStatsd metrics backend. (#5230) | jean/sentry,JackDanger/sentry,jean/sentry,mvaled/sentry,looker/sentry,mvaled/sentry,ifduyue/sentry,gencer/sentry,ifduyue/sentry,looker/sentry,ifduyue/sentry,beeftornado/sentry,ifduyue/sentry,gencer/sentry,jean/sentry,looker/sentry,looker/sentry,looker/sentry,jean/sentry,mvaled/sentry,mvaled/sentry,beeftornado/sentry,mv... | src/sentry/metrics/dogstatsd.py | src/sentry/metrics/dogstatsd.py | from __future__ import absolute_import
__all__ = ['DogStatsdMetricsBackend']
from datadog import initialize, statsd
from .base import MetricsBackend
class DogStatsdMetricsBackend(MetricsBackend):
def __init__(self, prefix=None, **kwargs):
# TODO(dcramer): it'd be nice if the initialize call wasn't a gl... | bsd-3-clause | Python | |
56f9ea1ba0026bc21eeb904afaf25606a6186125 | Test per veure que no permetem capçaleres multivaluades | UPC/mailtoticket,UPC/mailtoticket | test/test_regles.py | test/test_regles.py | import unittest
import mock
import settings
from soa.tiquets import GestioTiquets
from soa.identitat import GestioIdentitat
from filtres.nou import FiltreNou
from mailticket import MailTicket
from testhelper import llegir_mail
class TestRegles(unittest.TestCase):
def setUp(self):
self.ticket... | agpl-3.0 | Python | |
81ceae0740bba58cff0b410a6af6ff803d0a3b36 | Add Greengenes json parser | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | luigi/json_parser_greengenes.py | luigi/json_parser_greengenes.py | """
Copyright [2009-2014] EMBL-European Bioinformatics Institute
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... | apache-2.0 | Python | |
035540578674d0c731b2921fcf7081acfd2831b5 | Add tests checking equivalence to optimizers.py | google/jax,tensorflow/probability,google/jax,tensorflow/probability,google/jax,google/jax | tests/optix_test.py | tests/optix_test.py | # Copyright 2018 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, ... | apache-2.0 | Python | |
2390a9893374166be6e41f99f17318119014e60d | add unit tests | julien6387/supervisors,julien6387/supvisors,julien6387/supervisors,julien6387/supvisors,julien6387/supervisors,julien6387/supvisors,julien6387/supervisors,julien6387/supvisors | supervisors/tests/test_types.py | supervisors/tests/test_types.py | #!/usr/bin/python
#-*- coding: utf-8 -*-
# ======================================================================
# Copyright 2016 Julien LE CLEACH
#
# 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 Lice... | apache-2.0 | Python | |
ae7f22b5fc606a8415e286ffabd43d3fbb71977c | Add Euler angle conversion tests. | BBN-Q/QGL,BBN-Q/QGL | tests/test_euler.py | tests/test_euler.py | import unittest
from QGL import *
from QGL.Euler import *
from QGL.Cliffords import C1
import QGL.config
try:
from helpers import setup_test_lib
except:
from .helpers import setup_test_lib
class EulerDecompositions(unittest.TestCase):
N_test = 1000
def setUp(self):
pass
#setup_test_lib()
#self.q1 = Qubi... | apache-2.0 | Python | |
329c1d9cd515414fe754385ee302197b93eadd20 | implement 15 (15) ツイッターのユーザー名(例えば@xxxxxxx)を,そのユーザーのページへのリンク(<a href="https://twitter.com/#!/xxxxxxx">@xxxxxxx</a>で囲まれたHTML断片)に置換せよ. | mihyaeru21/nlp100 | set02/15.py | set02/15.py | # -*- coding: utf-8 -*-
# (15) ツイッターのユーザー名(例えば@xxxxxxx)を,そのユーザーのページへのリンク(<a href="https://twitter.com/#!/xxxxxxx">@xxxxxxx</a>で囲まれたHTML断片)に置換せよ.
import sys
import csv
import re
re_name = re.compile(u'@([a-zA-Z0-9_]+)')
for row in csv.reader(sys.stdin):
tweet = row[5].decode('utf-8')
replaced = re_name.sub(ur... | unlicense | Python | |
89ade49695c8961f23879050dda8aa684603c04b | Fix serializer | CTFd/CTFd,LosFuzzys/CTFd,isislab/CTFd,ajvpot/CTFd,CTFd/CTFd,LosFuzzys/CTFd,isislab/CTFd,isislab/CTFd,CTFd/CTFd,LosFuzzys/CTFd,CTFd/CTFd,LosFuzzys/CTFd,ajvpot/CTFd,isislab/CTFd,ajvpot/CTFd,ajvpot/CTFd | CTFd/utils/exports/serializers.py | CTFd/utils/exports/serializers.py | import json
import six
from collections import defaultdict, OrderedDict
from CTFd.utils.exports.encoders import JSONEncoder
class JSONSerializer(object):
def __init__(self, query, fileobj):
self.query = query
self.fileobj = fileobj
self.buckets = defaultdict(list)
def serialize(self)... | import json
import six
from collections import OrderedDict
from CTFd.utils.exports.encoders import JSONEncoder
class JSONSerializer(object):
def __init__(self, query, fileobj):
self.query = query
self.fileobj = fileobj
self.buckets = []
def serialize(self):
for row in self.qu... | apache-2.0 | Python |
933d364981f2b05cbca3325ee92f0696da5de44e | Create settings.py | InfoAgeTech/django-starter | settings.py | settings.py | # -*- coding: utf-8 -*-
| mit | Python | |
7b6b1426015a83b96395f0c7c112dc53d373647f | Add init file for remediation module. | tensorflow/fairness-indicators,tensorflow/fairness-indicators,tensorflow/fairness-indicators | fairness_indicators/remediation/__init__.py | fairness_indicators/remediation/__init__.py | # 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 a... | apache-2.0 | Python | |
205362c2f068ca22fe40cb6399b071849727ee55 | Test cases for style attribute parsing | brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype | tests/test_parse.py | tests/test_parse.py |
import pytest
from rinoh.dimension import DimensionBase, PT, PICA, INCH, MM, CM, PERCENT
from rinoh.style import OptionSet, Bool, Integer
def test_optionset_from_string():
ONE = 'one'
TWO = 'two'
THREE = 'three'
class TestSet1(OptionSet):
values = ONE, TWO, THREE
assert TestSet1.from_s... | agpl-3.0 | Python | |
9112bfe1a4f9253b78c6145f74b12c712cee136b | Create spacewar.py | danielwilson2017/Space-Shooter,HHS-IntroProgramming/Space-Shooter,BautiG/Space-Shooter,eliwoloshin/Space-Shooter,RDanilek/Space-Shooter,voidJeff/Space-Shooter,danielwilson2017/Space-Shooter,WilsonRimberg/Space-Shooter,eliwoloshin/Space-Shooter,VinzentM/Space-Shooter,CriticalD20/Space-Shooter,RDanilek/Space-Shooter,Etha... | spacewar.py | spacewar.py | """
spacewar.py
Author: <your name here>
Credit: <list sources used, if any>
Assignment:
Write and submit a program that implements the sandbox platformer game:
https://github.com/HHS-IntroProgramming/Spacewar
"""
| mit | Python | |
ed793b470e55a0fe1c7a0a4b0cc3d8a2774e4628 | verify that the files are actually images | d-grossman/scrapeCars | scripts/verifyImageType.py | scripts/verifyImageType.py | from resnet50 import ResNet50
from keras.preprocessing import image
from imagenet_utils import preprocess_input, decode_predictions
import numpy as np
import json
import time
import sys
from multiprocessing import Pool
import functools
def readTasking(filename):
tasking = open(filename,'r')
data = list()
... | apache-2.0 | Python | |
12c950c09839ad887d76de9a062e36015534c054 | Create activate-devices.py | JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub | cron/activate-devices.py | cron/activate-devices.py | apache-2.0 | Python | ||
4a8fe168af19517328187b3ff9ea4f7ae4d48eef | Add DHCPv6 rogue server script. | Vladimir-Ivanov-Git/raw-packet,Vladimir-Ivanov-Git/raw-packet | dhcpv6_rogue_server.py | dhcpv6_rogue_server.py | #!/usr/bin/env python
from base import Base
from network import DHCPv6_raw
from sys import exit
from argparse import ArgumentParser
from ipaddress import IPv6Address
from scapy.all import sniff, ICMPv6, DHCPv6
from socket import socket, AF_PACKET, SOCK_RAW, inet_aton
from base64 import b64encode
from struct import pac... | mit | Python | |
4628adc38789f52e8e2ef0cdf600b9fbed7b30ab | Test events (really event __repr__) | python-hyper/wsproto | test/test_events.py | test/test_events.py | import pytest
from h11 import Request
from wsproto.events import (
ConnectionClosed,
ConnectionEstablished,
ConnectionRequested,
)
from wsproto.frame_protocol import CloseReason
def test_connection_requested_repr_no_subprotocol():
method = b'GET'
target = b'/foo'
headers = {
b'host':... | mit | Python | |
60075ecdc73097c39895193a593688cb3cf103dd | add glucose example | maxalbert/bokeh,aiguofer/bokeh,Karel-van-de-Plassche/bokeh,evidation-health/bokeh,percyfal/bokeh,bsipocz/bokeh,satishgoda/bokeh,daodaoliang/bokeh,caseyclements/bokeh,DuCorey/bokeh,lukebarnard1/bokeh,stuart-knock/bokeh,muku42/bokeh,phobson/bokeh,msarahan/bokeh,timsnyder/bokeh,ahmadia/bokeh,srinathv/bokeh,rs2/bokeh,maxal... | examples/plotting/file/glucose.py | examples/plotting/file/glucose.py |
from bokeh.sampledata import glucose
from bokeh.plotting import *
day = glucose.data.ix['2010-10-06']
highs = day[day['glucose'] > 180]
lows = day[day['glucose'] < 80]
output_file("glucose.html", title="glucose.py example")
hold()
line(day.index.astype('int')/1000000, day['glucose'], color='grey', tools="pan,zoom... | bsd-3-clause | Python | |
6f0fdb4d7b1202c7ab07d01cf34954ee725df6fe | add basic-calculator | EdisonAlgorithms/LeetCode,EdisonAlgorithms/LeetCode,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code,zeyuanxy/leet-code,zeyuanxy/leet-code | vol5/basic-calculator/basic-calculator.py | vol5/basic-calculator/basic-calculator.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-11-18 17:21:42
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-11-18 17:21:51
class Solution:
operators = ['+', '-', '*', '/']
def getPriority(self, operator):
return {
'+' : 1,
... | mit | Python | |
54c1028157447233014890419ab869a8c1ca0c3a | Add linux installer | r4mos/youtube-dl-simple-server,r4mos/youtube-dl-simple-server,r4mos/youtube-dl-simple-server | installation/server-linux.py | installation/server-linux.py | #!/usr/bin/env python
#-*- encoding:utf-8 -*-
import os
import sys
import urllib2
import subprocess
installationPath = os.path.expanduser('~') + '/.config/ydlss'
serverLocalLocation = installationPath + '/youtube-dl-simple-server'
serverWebLocation = 'https://github.com/r4mos/youtube-dl-simple-server/raw/master/bin/s... | mit | Python | |
46d6b7451bb8e295751d771228782cfbbcb8ecc7 | Add dask_client_from_ipclient function | clarkfitzg/dask,esc/dask,wiso/dask,dask/dask,pombredanne/dask,PhE/dask,mraspaud/dask,chrisbarber/dask,dask/dask,blaze/dask,gameduell/dask,freeman-lab/dask,jayhetee/dask,simudream/dask,cowlicks/dask,jcrist/dask,mikegraham/dask,pombredanne/dask,clarkfitzg/dask,mraspaud/dask,ContinuumIO/dask,esc/dask,ssanderson/dask,freem... | dask/distributed/ipython_utils.py | dask/distributed/ipython_utils.py | from .scheduler import Scheduler
from .worker import Worker
from .client import Client
def dask_client_from_ipclient(client):
"""
Construct a scheduler from an ipython client.
"""
zmq_context = client._context
scheduler = Scheduler(context=zmq_context)
workers = [Worker(scheduler.address_to_wo... | bsd-3-clause | Python | |
9d88c6f1b0a654a9b89350d475d1a6c46116d917 | Add query | tkem/mopidy-internetarchive | mopidy_internetarchive/query.py | mopidy_internetarchive/query.py | from __future__ import unicode_literals
import collections
import logging
logger = logging.getLogger(__name__)
QUERY_FIELDS = {
'uri',
'track_name',
'track_no',
'album',
'artist',
'composer',
'performer',
'albumartist',
'genre',
'date',
'comment',
'any'
}
DEFAULT_FILT... | apache-2.0 | Python | |
93e19ab50567e045daf0e35d856033303be70192 | Implement first test cases | kfricke/micropython-esp8266uart | test_esp8266uart.py | test_esp8266uart.py | import esp8266uart
esp = esp8266uart.ESP8266(1, 115200)
print('Testing generic methods')
print('=======================')
print('AT startup...')
if esp.test():
print('Success!')
else:
print('Failed!')
#print('Soft-Reset...')
#if esp.reset():
# print('Success!')
#else:
# print('Failed!')
print('Anothe... | mit | Python | |
8ec7492658bab8d6b0fba5d6b49a58b6408f5fa2 | Add framework for graphing temporal time | PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project | src/graph_run_algo.py | src/graph_run_algo.py | import dateutil.parser
import time
import matplotlib.pyplot as plt
from operator import add
from datetime import datetime
from gensim import corpora, models, similarities
minute = 60
hour = 3600
cdict = "%scorpus.dict"
ccorpus = "%scorpus.mm"
corpus_model = "%s.%s"
def gen_graph(figure, x, y, subtitle, xlabel, ylab... | mit | Python | |
87fe0b7ff745e4057e4b60a1a9a75fe57581b2d5 | add exp4 script | ManuelMBaumann/opt_tau,ManuelMBaumann/opt_tau | num_exper/exp4.py | num_exper/exp4.py | import os
import numpy as np
np = 4
fmin = 1.0
fmax = 9.0
df = 0.5
for i in np.arange(fmin+df, fmax, df):
str1 = 'python3 elast_wedge.py --ndims=2 --dx=100.0 --dy=100.0 --dz=100.0 --df=0.1 --degree=1 --damping=0.5 --maxit=300 \
--tol=1e-8 --dg_pp=0 --tau... | mit | Python | |
2fa721b24891fcd8170d87328334c05faec9cb9a | add hamming char dist function | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | cryptography/hamming_distance/python/hamming_char_dist.py | cryptography/hamming_distance/python/hamming_char_dist.py | """
Determine the hamming distance, at the character level, between two equal length strings a and b.
"""
def hamming_char_dist(a,b):
if len(a) != len(b):
raise ValueError("a and b are unequal lengths")
dist = 0
for i in range(len(a)):
if(a[i] != b[i]):
dist += 1
return dist | cc0-1.0 | Python | |
c679b614b638123d846940718bb3fd27ed3078ce | Add test for fftpack. | chadnetzer/numpy-gaurdro,efiring/numpy-work,jasonmccampbell/numpy-refactor-sprint,efiring/numpy-work,teoliphant/numpy-refactor,illume/numpy3k,chadnetzer/numpy-gaurdro,teoliphant/numpy-refactor,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,chadnetzer/numpy-gaurdro,illume/numpy3k,jasonmccampbell/numpy-refactor-... | numpy/fft/tests/test_fftpack.py | numpy/fft/tests/test_fftpack.py | import sys
from numpy.testing import *
set_package_path()
from numpy.fft import *
restore_path()
class test_fftshift(NumpyTestCase):
def check_fft_n(self):
self.failUnlessRaises(ValueError,fft,[1,2,3],0)
if __name__ == "__main__":
NumpyTest().run()
| bsd-3-clause | Python | |
9436af51e8b823fa83358b40f94dcd07970aea6b | test test | adriennekarnoski/data-structures,adriennekarnoski/data-structures | src/test_deque.py | src/test_deque.py | """Test functions for deque module."""
import pytest
def test_queue_is_instance_of_queue_object():
"""Test stack is instance of Stack()."""
from deque import Deque
d = Deque()
assert isinstance(d, Deque)
def test_queue_is_instance_of_doubly_linked_list():
"""Test stack inherits from DoublyLinked... | mit | Python | |
7a3a7a8d5a397c886086cc87fff3f058921d06d2 | add IntegerListField for keeping major selections | jittat/ku-eng-direct-admission,jittat/ku-eng-direct-admission,jittat/ku-eng-direct-admission | application/fields.py | application/fields.py | from django.db import models
class IntegerListField(models.Field):
"""
IntegerListField keeps a list of int as a comma-separated string.
>>> g = IntegerListField()
>>> g.get_db_prep_value([1,2,-1,20,30,40,-100])
'1,2,-1,20,30,40,-100'
>>> g.to_python('1,2,-10,3,4,-100,7')
[1,2,-10,3,4,-10... | agpl-3.0 | Python | |
985129b190cbc26700f4f40e90e0b32984d52ca1 | Add example script for updating useremails. Fixes #1041 | devilry/devilry-django,devilry/devilry-django,devilry/devilry-django,devilry/devilry-django | not_for_deploy/sysadmin_example_scripts/update_all_useremails_example.py | not_for_deploy/sysadmin_example_scripts/update_all_useremails_example.py | #!/usr/bin/env python
import django
import os
from django.contrib.auth import get_user_model
from django.utils import timezone
from django.db import transaction
class ProgressPrintIterator:
"""
Progress print iterator. Useful to print progress of long running scripts.
(Copied from ievv_opensource since ... | bsd-3-clause | Python | |
4cb6b3a3e1b74dd83812469c472accfc22e4d699 | Update consecutive-numbers-sum.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode | Python/consecutive-numbers-sum.py | Python/consecutive-numbers-sum.py | # Time: O(sqrt(n))
# Space: O(1)
# Given a positive integer N,
# how many ways can we write it as a sum of
# consecutive positive integers?
#
# Example 1:
#
# Input: 5
# Output: 2
# Explanation: 5 = 5 = 2 + 3
# Example 2:
#
# Input: 9
# Output: 3
# Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4
# Example 3:
#
# Input: 15
# O... | # Time: O(sqrt(n))
# Space: O(1)
# Given a positive integer N,
# how many ways can we write it as a sum of
# consecutive positive integers?
#
# Example 1:
#
# Input: 5
# Output: 2
# Explanation: 5 = 5 = 2 + 3
# Example 2:
#
# Input: 9
# Output: 3
# Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4
# Example 3:
#
# Input: 15
# O... | mit | Python |
3dc8fde56be2438dae03e5d9d310fa2d19cd1ce2 | Add multi-result testing | klmitch/dtest,klmitch/dtest | tests/test_multi.py | tests/test_multi.py | # Copyright 2011 OpenStack 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 b... | apache-2.0 | Python | |
362c35a1753c908fa7496c0e050b9325420e405e | add missing migrations | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/linked_domain/migrations/0012_auto_20200929_0809.py | corehq/apps/linked_domain/migrations/0012_auto_20200929_0809.py | # Generated by Django 2.2.16 on 2020-09-29 08:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('linked_domain', '0011_auto_20200728_2316'),
]
operations = [
migrations.AlterField(
model_name='domainlinkhistory',
... | bsd-3-clause | Python | |
65b4a1a587c257a1b80d72a6e59d57d5c854f8ed | Add tests | chrisseto/pyjwe | tests/test_pyjwe.py | tests/test_pyjwe.py | import pytest
import jwe
from jwe import validation
from cryptography.exceptions import InvalidTag
class TestValidation:
def test_correct_header(self):
try:
validation.validate_header({
'alg': 'dir',
'enc': 'A256GCM'
})
except Exception as... | apache-2.0 | Python | |
b43aef2a3ebd54a72791ae635dca4d7544c0ad23 | Add Flask test server | Oshlack/scRNA-tools,lazappi/single-cell-software,Oshlack/scRNA-tools | test_server.py | test_server.py | from flask import Flask
app = Flask(__name__, static_folder=".", static_url_path="")
if __name__ == "__main__":
app.run(debug=True, host="127.0.0.1", port=8765)
| mit | Python | |
85bd2d96b97b61d70d610a8b566e70abae14b264 | add example of boolean operations for 2d polygons | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | examples/render/boolean_operations_for_2d_polygons.py | examples/render/boolean_operations_for_2d_polygons.py | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
from pathlib import Path
import ezdxf
from ezdxf.render.forms import gear, translate
from ezdxf.math.clipping import (
greiner_hormann_union,
greiner_hormann_difference,
greiner_hormann_intersection,
)
from ezdxf import zoom
DIR = Path("~/Desktop/... | mit | Python | |
3352cb3f38db4f68decf6de60528ad6ff07ce613 | Create mssql_import.py | jmhwang/personal_utils | database/mssql_import.py | database/mssql_import.py | # -*-coding:cp949-*-
# vim: set et:ts=4:sw=4
import pyodbc
def import_table(file, table):
connection = pyodbc.connect(
r'DRIVER={SQL Server};'
r'SERVER=127.0.0.1\instance;'
r'DATABASE=database;'
r'UID=id;'
r'PWD=passwd')
with open (file, 'r') as f:
lines = f.rea... | mit | Python | |
d67b685340cf2db7cd31b50a4484c29625b8fea5 | Remove pixel test fail expectation | jaruba/chromium.src,Pluto-tv/chromium-crosswalk,ondra-novak/chromium.src,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,Chilledheart/chromium,Chilledheart/chromium,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,PeterW... | content/test/gpu/gpu_tests/pixel_expectations.py | content/test/gpu/gpu_tests/pixel_expectations.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopar... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopar... | bsd-3-clause | Python |
b0116fb3b52e9c9f0cc156bc49f1400261ed879c | ADD mechanism table | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/syft/src/syft/core/node/common/node_table/mechanism.py | packages/syft/src/syft/core/node/common/node_table/mechanism.py | # stdlib
from typing import Any
# third party
from sqlalchemy import Column
from sqlalchemy import LargeBinary
from sqlalchemy import String
from sqlalchemy import Integer
# syft absolute
from syft import deserialize
from syft import serialize
# relative
from . import Base
class Mechanism(Base):
__tablename__ ... | apache-2.0 | Python | |
05e90660ab0072a50dd17a2afa1e08c93cf694e8 | Create reverse_k.py | hs634/algorithms,hs634/algorithms | python/linked_list/reverse_k.py | python/linked_list/reverse_k.py | public ListNode reverseKGroup(ListNode head, int k) {
ListNode curr = head;
int count = 0;
while (curr != null && count != k) { // find the k+1 node
curr = curr.next;
count++;
}
if (count == k) { // if k+1 node is found
curr = reverseKGroup(curr, k); // reverse list with k+1 ... | mit | Python | |
9b05195a0474ba39666e15035aeeacc312d5398e | Manage taboo contracts (#28144) | thaim/ansible,thaim/ansible | lib/ansible/modules/network/aci/aci_taboo_contract.py | lib/ansible/modules/network/aci/aci_taboo_contract.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
... | mit | Python | |
8acc41135419e81bfdb02ba544263453d17788dd | Add simple example | jccriado/matchingtools,jccriado/effective | examples/simple_example.py | examples/simple_example.py | """
Simple example to illustrate some of the features of `effective`
The model has a :math:`SU(2)\times U(1)` simmetry and contains
a complex scalar doublet :math:`\phi` (the Higgs) with hypercharge
:math:`1/2` and a real scalar triplet :math:`\Xi` with zero
hypercharge that couple as:
.. math::
\mathcal{L}_{int} ... | mit | Python | |
f18d70ce9c9e86ca184da939f9ffb193b32d981d | add 135 | EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler | vol3/135.py | vol3/135.py | if __name__ == "__main__":
L = 10 ** 6
sol = [0] * (L + 1)
for u in xrange(1, L + 1):
for v in xrange(1, L + 1):
if u * v > L:
break
if 3 * v <= u:
continue
if (u + v) % 4 == 0 and (3 * v - u) % 4 == 0:
sol[u * v] +=... | mit | Python | |
64b2435b77044c1a258433f8794d9bd0a431b61a | Add accept header | JoeyEremondi/travis-daily | travis-ping.py | travis-ping.py | #Based on https://github.com/FiloSottile/travis-cron
import urllib2
import json
import sys
def api_call(url, token=None, data=None):
print url
if data:
data = json.dumps(data)
req = urllib2.Request(url, data)
if data:
req.add_header('Content-Type', 'application/json; charset=UTF-8')
... | #Based on https://github.com/FiloSottile/travis-cron
import urllib2
import json
import sys
def api_call(url, token=None, data=None):
print url
if data:
data = json.dumps(data)
req = urllib2.Request(url, data)
if data:
req.add_header('Content-Type', 'application/json; charset=UTF-8')
... | mit | Python |
b7d219a5afbf349385dbe9b2712f34f5e756e3e6 | add flask app | chhantyal/scrapd,chhantyal/scrapd | zalando/app.py | zalando/app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run() | bsd-3-clause | Python | |
90b92a1977c32dd660533567c0d5034b93d5c9c7 | Add smarts to cope with slug clashes with other places with the same names. | patricmutwiri/pombola,hzj123/56th,geoffkilpin/pombola,patricmutwiri/pombola,hzj123/56th,ken-muturi/pombola,hzj123/56th,hzj123/56th,mysociety/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,ken-muturi/pombola,hzj123/56th,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,patricmutwiri/pom... | pombola/core/management/commands/core_create_places_from_mapit_entries.py | pombola/core/management/commands/core_create_places_from_mapit_entries.py | # This script will copy areas from mapit to core.places, including creating the
# place kind if required.
# import re
# import sys
from django.core.management.base import LabelCommand
from mapit.models import Type
from pombola.core.models import Place, PlaceKind
from django.template.defaultfilters import slugify
cl... | # This script will copy areas from mapit to core.places, including creating the
# place kind if required.
# import re
# import sys
from django.core.management.base import LabelCommand
from mapit.models import Type
from pombola.core.models import Place, PlaceKind
from django.template.defaultfilters import slugify
cl... | agpl-3.0 | Python |
0be0d20fc667f0734b85d98f1d359130f7ed5b98 | Add failing specs for current/future class names. | plotly/python-api,plotly/python-api,plotly/plotly.py,plotly/plotly.py,plotly/plotly.py,plotly/python-api | plotly/tests/test_core/test_graph_objs/test_graph_objs.py | plotly/tests/test_core/test_graph_objs/test_graph_objs.py | from unittest import TestCase
import plotly.graph_objs as go
import plotly.graph_reference as gr
OLD_CLASS_NAMES = ['AngularAxis', 'Annotation', 'Annotations', 'Area',
'Bar', 'Box', 'ColorBar', 'Contour', 'Contours',
'Data', 'ErrorX', 'ErrorY', 'ErrorZ', 'Figure',
... | mit | Python | |
6b53d081b78d3ea2073bdc13112b146660595b5f | Add tests for resource_renderer | ouvigna/pyramid_restpike | tests/test_resource_renderer.py | tests/test_resource_renderer.py | from nose.tools import assert_true, assert_equals
from pyramid.testing import DummyRequest
from pyramid.response import Response
class SUTResource(object):
def __init__(self):
self.request = DummyRequest()
def index(self):
return {}
class TestResourceRenderer(object):
def _getTargetClas... | mit | Python | |
22b2446546ce59b99980e98e81b3571d81085304 | Test that daily westminster pages load | tdhopper/westminster-daily,olneyhymn/westminster-daily,olneyhymn/westminster-daily,olneyhymn/westminster-daily,olneyhymn/westminster-daily,tdhopper/westminster-daily,tdhopper/westminster-daily | tests/test_westminster_daily.py | tests/test_westminster_daily.py | import datetime as dt
from flask_application import app
def test_daily_westminster_pages_exist():
start_date = dt.date(2015, 01, 01)
with app.test_client() as c:
for days in range(365):
date = start_date + dt.timedelta(days=days)
month, day = date.month, date.day
... | bsd-3-clause | Python | |
68451f2df6a1706993d7da6d7b1ff80092bca9af | Add another ui test | Schevo/kiwi,Schevo/kiwi,Schevo/kiwi | tests/ui/personalinformation.py | tests/ui/personalinformation.py | from kiwi.ui.test.player import Player
player = Player(['examples/validation/personalinformation.py'])
app = player.get_app()
player.wait_for_window("Form")
app.Form.name.set_text("")
app.Form.name.set_text("J")
app.Form.name.set_text("Jo")
app.Form.name.set_text("Joh")
app.Form.name.set_text("Joha")
app.Form.name.se... | lgpl-2.1 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.