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 |
|---|---|---|---|---|---|---|---|---|
88e4e99c06c26e3840eb305fe69ee9772f51787b | Add migration to actually rename `Production` to production (#34) | CanopyTax/toggle-meister,CanopyTax/toggle-meister,CanopyTax/toggle-meister,CanopyTax/toggle-meister | migrations/versions/fa2cd0ecc30f_lower_case_production.py | migrations/versions/fa2cd0ecc30f_lower_case_production.py | """lower case production
Revision ID: fa2cd0ecc30f
Revises: 1693a9b29733
Create Date: 2019-04-23 10:01:13.744020
"""
# revision identifiers, used by Alembic.
revision = 'fa2cd0ecc30f'
down_revision = '1693a9b29733'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade()... | apache-2.0 | Python | |
35362f6bd46f0a602c3ec5756ba08ccf8cd209c0 | add pdu cred checker script | DiData/pdumgr,DiData/pdumgr | check_pdu_creds.py | check_pdu_creds.py | #!/usr/bin/env python
from requests import get as reqget, post as reqpost
from json import loads as jsonloads, dumps as jsondumps
from config import configSystem
from threading import Thread
from ftplib import FTP
import time, sys, os
cfg = configSystem('config.cfg')
# Check PDU credentials and update our DB with the... | mit | Python | |
d4bfe2f59d2552d211caddf90ceefcf27a06f08a | Add YAML documents creating capability. | spdx/tools-python | spdx/writers/yaml.py | spdx/writers/yaml.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import ruamel.yaml as yaml
from spdx.writers.tagvalue import InvalidDocumentError
from spdx.writers.jsonyaml import Writer
import rdflib
def write_document(document, out, validate=True):
if valida... | apache-2.0 | Python | |
5d2ef4ec151c01088d9983b142c4bab4cd20bcbc | Add analytics migration | Nesiehr/osf.io,crcresearch/osf.io,chennan47/osf.io,brianjgeiger/osf.io,cwisecarver/osf.io,binoculars/osf.io,erinspace/osf.io,felliott/osf.io,aaxelb/osf.io,leb2dg/osf.io,HalcyonChimera/osf.io,monikagrabowska/osf.io,acshi/osf.io,acshi/osf.io,laurenrevere/osf.io,monikagrabowska/osf.io,sloria/osf.io,monikagrabowska/osf.io,... | osf/migrations/0005_pagecounter_useractivitycounter.py | osf/migrations/0005_pagecounter_useractivitycounter.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-10-12 21:05
from __future__ import unicode_literals
from django.db import migrations, models
import osf.utils.datetime_aware_jsonfield
class Migration(migrations.Migration):
dependencies = [
('osf', '0004_auto_20161012_1459'),
]
operatio... | apache-2.0 | Python | |
079be3496b22d1ac08408dcee13bca02bb20babd | Add migration for blank kicker | thepoly/Pipeline,thepoly/Pipeline,thepoly/Pipeline,thepoly/Pipeline,thepoly/Pipeline | articles/migrations/0010_auto_20180817_2321.py | articles/migrations/0010_auto_20180817_2321.py | # Generated by Django 2.0.8 on 2018-08-17 23:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('articles', '0009_auto_20180727_1437'),
]
operations = [
migrations.AlterField(
model_name='arti... | mit | Python | |
4807bbd25f075932fbd5e1c8cb5b37633c484505 | Add mallet exporter example. | SeNeReKo/TCFlib | tcflib/examples/mallet_exporter.py | tcflib/examples/mallet_exporter.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Frederik Elwert <frederik.elwert@web.de>
#
# 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... | mit | Python | |
237ce6e8bc8534411825c9477f7cc8d6f3bfa570 | Add Contact Page functional tests | andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop,andela-kndungu/compshop,andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop,andela-kndungu/compshop | tests/functional/test_contact_page.py | tests/functional/test_contact_page.py | from .base import FunctionalTest
class ContactPageTest(FunctionalTest):
def test_contact_page_navigation(self):
self.browser.get(self.live_server_url)
self.browser.set_window_size(1024, 768)
contact_link = self.browser.find_element_by_link_text('CONTACT US')
contact_link.click(... | bsd-3-clause | Python | |
efab6129c7474bff26cf82e8879ab3f31a6a954f | Add image downloading | dansbecker/motion-tracking | download_images.py | download_images.py | import concurrent.futures
import itertools
import json
import pandas as pd
import socket
import urllib.request
import os
from os.path import join, exists
class ImageDownloader(object):
def __init__(self, image_url_df, target_path='data/images', nb_workers=64):
self._failed_to_capture_path = 'work/failed_t... | mit | Python | |
2c24151868c507b8a807019cd0bf3c61f7f236ca | add example script for working with ISO Code List Catalogue | KeyproOy/OWSLib,dblodgett-usgs/OWSLib,geopython/OWSLib,bird-house/OWSLib,ocefpaf/OWSLib,daf/OWSLib,robmcmullen/OWSLib,daf/OWSLib,b-cube/OWSLib,datagovuk/OWSLib,jaygoldfinch/OWSLib,mbertrand/OWSLib,JuergenWeichand/OWSLib,Jenselme/OWSLib,kalxas/OWSLib,gfusca/OWSLib,kwilcox/OWSLib,menegon/OWSLib,jachym/OWSLib,jaygoldfinch... | examples/iso-getcodelist.py | examples/iso-getcodelist.py | #!/usr/bin/python
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2010 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@hotmail.com>
#
# Contact email: tomkralidis@hotmail.com
# ============================================================... | bsd-3-clause | Python | |
3228a98310ac31174e893e7ed3aabe28ca55be0b | add pop table | nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN | script/population_table.py | script/population_table.py | class PopulationTable:
def __init__(self,coverage=range(30,61)):
def add_event(self,x):
for i in coverage:
if x*10 >= i:
above[i] =
| mit | Python | |
40a360eb0c490e28a4cbad47a6e7d638de180e0b | Create guestbook.py | saptarshighosh9/online-shooting--game | guestbook.py | guestbook.py | import cgi
import urllib
import os
from google.appengine.api import users
from google.appengine.ext import ndb
import jinja2
import webapp2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'])
DEFAULT_GUESTBOOK_NAME = 'Scor... | unlicense | Python | |
a50d5b91cc2fe36ddcf78b3743e930047d7a610f | Refactor photometric redshift regression. | chengsoonong/mclass-sky,chengsoonong/mclass-sky,alasdairtran/mclearn,chengsoonong/mclass-sky,chengsoonong/mclass-sky,alasdairtran/mclearn,alasdairtran/mclearn,alasdairtran/mclearn | projects/jakub/gaussian_processes/photometric_redshift.py | projects/jakub/gaussian_processes/photometric_redshift.py | import argparse
import csv
import matplotlib.pyplot as plt
import numpy as np
import sklearn.dummy
import sklearn.gaussian_process
import sklearn.linear_model
LABEL_COL = 4
INPUT_COLS = 7, 9, 11, 13, 15
INPUT_DIM = len(INPUT_COLS)
INPUT_ROW_VALID = lambda row: row[2] == "Galaxy"
DEFAULT_TRAINING_SAMPLES_NUM = 1000
... | bsd-3-clause | Python | |
42fc7eda507037de7df4bc148b3d798b2871bba5 | Add script to make a user the global admin | liqd/adhocracy,liqd/adhocracy,SysTheron/adhocracy,phihag/adhocracy,phihag/adhocracy,alkadis/vcv,alkadis/vcv,SysTheron/adhocracy,SysTheron/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,liqd/adhocracy,alkadis/vcv,phihag/adhocracy,phihag/adhocracy,phihag/adhocracy,liqd/adhocracy,DanielNeugebauer/adhocracy,DanielNeugeba... | scripts/make_user_admin.py | scripts/make_user_admin.py | #!/usr/bin/env python
"""
Extract email adresses from adhocracy. Emails from deleted users won't be
exported.
"""
from datetime import datetime
from sqlalchemy import and_, or_
from adhocracy.model import Group, Membership, meta, User
# boilerplate code. copy that
import os
import sys
sys.path.insert(0, os.path.abs... | agpl-3.0 | Python | |
d56765be8b8a90273308dd27d57115ca6836a7cd | Create Robot.py | Syriamanal/Robot-In-Python | Robot.py | Robot.py | Here
| agpl-3.0 | Python | |
4298875e567fb5f816afc29ab762674010b3ee94 | Add the missing baseserver | cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO | baseserver.py | baseserver.py |
from tornado.web import Application, RequestHandler
from tornado.ioloop import IOLoop
class SimpleHandler(RequestHandler):
def __init__(self, output, *args):
self.output = output
RequestHandler.__init__(self, *args)
def get(self):
self.write(self.output)
class BaseServer(Application)... | agpl-3.0 | Python | |
1692e53b86f830cdde631437de3ad746d5225fc6 | Add shim for clover package name and deprecation warning | consbio/clover,consbio/clover | clover/__init__.py | clover/__init__.py | # This is here simply to aid migration to trefoil. It will be removed in a future version!
import sys
import warnings
import trefoil
warnings.simplefilter('always', DeprecationWarning)
warnings.warn(
"the package name 'clover' has been deprecated; use 'trefoil' instead",
DeprecationWarning)
sys.modules['cl... | bsd-3-clause | Python | |
099078eac6360c547ec7c9c9fe5ff4e5535f96fa | Add SEPA Creditor identifier (AT-02) | holvi/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum,holvi/python-stdnum,tonyseek/python-stdnum,dchoruzy/python-stdnum,arthurdejong/python-stdnum,t0mk/python-stdnum,holvi/python-stdnum | stdnum/at_02.py | stdnum/at_02.py | # at_02.py - functions for handling AT-02 (SEPA Creditor identifier)
#
# Copyright (C) 2014 Sergi Almacellas Abellana
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.... | lgpl-2.1 | Python | |
ce31b68b98802291c2d6e6871ba20f4711617f45 | Add integration test for switching interfaces | Yubico/yubikey-manager,Yubico/yubikey-manager | test/on_yubikey/test_interfaces.py | test/on_yubikey/test_interfaces.py | from .util import DestructiveYubikeyTestCase
from ykman import driver_fido, driver_otp, driver_ccid
class TestInterfaces(DestructiveYubikeyTestCase):
def test_switch_interfaces(self):
next(driver_fido.open_devices()).read_config()
next(driver_otp.open_devices()).read_config()
next(driver_... | bsd-2-clause | Python | |
20d1332f3716cd06b0f35392b5778cd4f902d10b | add test for #132 | kinverarity1/lasio,kinverarity1/las-reader,kwinkunks/lasio | tests/test_serialization.py | tests/test_serialization.py | import os, sys; sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import fnmatch
import numpy
import pytest
import pickle
from lasio import las, read, exceptions
test_dir = os.path.dirname(__file__)
egfn = lambda fn: os.path.join(os.path.dirname(__file__), "examples", fn)
stegfn = lambda vers, fn: os... | mit | Python | |
a8baba08a9d08a2ecd32afc0bcfe5c4b73d10c05 | Add simple queryset tests | Yipit/pyeqs | tests/unit/test_queryset.py | tests/unit/test_queryset.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyeqs import QuerySet, Filter
from pyeqs.dsl import Term, Sort
from tests.helpers import compare
def test_create_queryset():
"""
Create Default QuerySet
"""
# When create a queryset
t = QuerySet("http://foobar:9200")
# Then... | mit | Python | |
d0516691491e3f6c005fd81624a95189050de9a8 | create new test module for req_file.py and stub out the classes | prasaianooz/pip,jmagnusson/pip,blarghmatey/pip,rbtcollins/pip,yati-sagade/pip,atdaemon/pip,rouge8/pip,luzfcb/pip,yati-sagade/pip,fiber-space/pip,tdsmith/pip,supriyantomaftuh/pip,luzfcb/pip,jythontools/pip,mindw/pip,sigmavirus24/pip,wkeyword/pip,rbtcollins/pip,natefoo/pip,ChristopherHogan/pip,techtonik/pip,fiber-space/p... | tests/unit/test_req_file.py | tests/unit/test_req_file.py | from pip.req.req_file import (parse_requirement_options, parse_content,
parse_line, join_lines, ignore_comments,
partition_line, REQUIREMENT_EDITABLE, REQUIREMENT,
FLAG, OPTION)
class TestIgnoreComments(object):
"""tests for... | mit | Python | |
887a81f21033a0694bccec9ac07470b95569646b | Add basic query string tests | spaceone/httoop,spaceone/httoop,spaceone/httoop | tests/uri/test_uri_query.py | tests/uri/test_uri_query.py | import pytest
from httoop import URI
@pytest.mark.parametrize('query_string,query', [
(b'', ()),
(b'&', ()),
(b'&&', ()),
# (b'=', ((u'', u''),)),
# (b'=a', ((u'', u'a'),)),
(b'a', ((u'a', u''),)),
(b'a=', ((u'a', u''),)),
(b'&a=b', ((u'a', u'b'),)),
(b'&&a=b&&b=c&d=f&', ((u'a', u'b'), (u'b', u'c'), (u'd', u'f... | mit | Python | |
2d1fbddebe6eea3662dd8c6471a92cf21677ae13 | Add new package. (#21828) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-dask-glm/package.py | var/spack/repos/builtin/packages/py-dask-glm/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)
from spack import *
class PyDaskGlm(PythonPackage):
"""Dask-glm is a library for fitting Generalized Linear Models o... | lgpl-2.1 | Python | |
a3f0646b9f9519113252002d73bc96ac1d177b2c | solve k86 | WatsonDNA/nlp100,WatsonDNA/nlp100,wtsnjp/nlp100,wtsnjp/nlp100 | chap09/k86.py | chap09/k86.py | #
# usage: python k86.py {model file}
#
import sys
def word_vec(fn, w):
for l in open(fn):
tmp = l.split(' ')
if tmp[0] == w:
return [float(i) for i in tmp[1:]]
return None
if __name__ == '__main__':
fn = sys.argv[1]
w = 'United_States'
vec = word_vec(fn, w)
if ve... | unlicense | Python | |
15434737ba26dbd7c42f792d4afc8d7273b8fff4 | Create FakeAPIHandler.py | emeric254/microservice-squeleton,emeric254/microservice-squeleton | handlers/FakeAPIHandler.py | handlers/FakeAPIHandler.py | # -*- coding: utf-8 -*-
import logging
import tornado.web
logger = logging.getLogger(__name__)
class FakeAPIHandler(tornado.web.RequestHandler):
def get(self, path_request):
if path_request == '' or path_request == '/':
logger.info('user did not write anything')
self.write('You ... | mit | Python | |
ef70a5e17f8a5be740453284a35c4a3fee102cdf | Add migration merge | llazzaro/django-scheduler,llazzaro/django-scheduler,llazzaro/django-scheduler | schedule/migrations/0009_merge_20180108_2303.py | schedule/migrations/0009_merge_20180108_2303.py | # Generated by Django 2.0 on 2018-01-09 05:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('schedule', '0008_calendar_slug_unique'),
('schedule', '0008_gfk_index'),
]
operations = [
]
| bsd-3-clause | Python | |
31ac93bcf50198742643529059fc29da307c3a02 | Test /swagger/ route | openfisca/openfisca-core,openfisca/openfisca-core | tests/web_api/test_openAPI.py | tests/web_api/test_openAPI.py | # -*- coding: utf-8 -*-
import json
from httplib import OK
from nose.tools import assert_equal, assert_items_equal
from . import subject
openAPI_response = subject.get('/swagger')
def test_return_code():
assert_equal(openAPI_response.status_code, OK)
def test_paths():
assert_items_equal(
json.loa... | agpl-3.0 | Python | |
bd4f6cbdc33870a5143ffa024b52de09eaec7f8c | add upload script | brettatoms/belizeorchids,brettatoms/belizeorchids | bin/upload.py | bin/upload.py | #!/usr/bin/env python
#import argparse
import hashlib
import os
import sys
import boto
BUILD_DIR="dist"
bucket_name="belizeorchids.com"
s3 = boto.connect_s3()
bucket = s3.get_bucket(bucket_name)
#keys = bucket.get_all_keys()
keys = [key for key in bucket.list()]
key_map = { key.name.encode(): key for key in keys } ... | agpl-3.0 | Python | |
b7c60476ade0c3647dab2860a3520702af284da4 | Create robot.py | iPoul/Monicas | robot.py | robot.py | import os
import time
import logging
from slackclient import SlackClient
from duckduckpy import query
import wolframalpha
| mit | Python | |
e3bcb49cd274f78fa29f479dc4e8aff979579d60 | Add start of project matchup script | jbrudvik/yahoo-fantasy-basketball | project-matchup.py | project-matchup.py | """
Project results of the current matchup
"""
| mit | Python | |
99f3b80438378c5bfed355a58058797d6964de7d | add - threading 模块用例: event 机制. | hhstore/learning-notes,hhstore/learning-notes,hhstore/learning-notes,hhstore/iPyScript | python/src/exercise/py35/threading_usage/ex05_event.py | python/src/exercise/py35/threading_usage/ex05_event.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import threading
from random import randint
"""
5. Event
- 一个线程发送/传递事件,
- 另外的线程等待事件的触发。
- 同样用「生产者/消费者」模型举例:
- 可以看到事件, 被2个消费者, 比较平均的接收并处理了。
- 如果使用了wait方法,线程就会等待我们设置事件,这有助于保证任务完成。
- 处理过程:
- 生产者产生数据:
- 产生数据, 并发给消费者(append 到缓冲区)
- 消费者处理数据... | mit | Python | |
0096a2ed7ef6e40a3f4ceaba784de6e5e8dfe2c9 | Add script to list user-provided services with syslog URLs | alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf | scripts/all_syslog_service_instances.py | scripts/all_syslog_service_instances.py | """
Usage as a script:
cf oauth-token | python3 all_syslog_service_instances.py https://my.api.base.url.example.com/
"""
import csv
import sys
from urllib.parse import urljoin
import requests
def get_all_resources_iter(resource_name, api_base_url, headers):
all_resources = []
resources_page_resp = ... | mit | Python | |
d46488ac42f380419f41547ee4e1ebee74af6699 | add setup.py | hoersuppe/hoerapi.py,becm/hoerapi.py | setup.py | setup.py | from setuptools import setup
setup(name='hoerapi',
version='1.0',
description='',
author='luto',
author_email='m@luto.at',
url='https://github.com/hoersuppe/hoerapi.py',
packages=['hoerapi'],
) | mit | Python | |
068ef7cc06af9d616cfd52570e732ea0e4a3d40e | Make textractor pip-installable | kirberich/textractor | setup.py | setup.py | from setuptools import setup
setup(
name='textractor',
version='1.0',
description='Minimalistic HTML text extraction library',
url='https://github.com/kirberich/textractor',
author='Robert Kirberich',
license='MIT',
py_modules=['textractor'],
zip_safe=False,
install_requires=[
... | mit | Python | |
53856bddeb763352bd6d2b61a934a2cacd8e1ebf | Add setup.py. | rrueth/app-store,rrueth/app-store | setup.py | setup.py | import codecs
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
# Get the long description from the README file
with codecs.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='App Store',
version='1... | mit | Python | |
523e98fd4d91beff0f3e1b25bf5e61209bcc00ee | Add a set of tests for the network module | sangoma/pytestlab | unittests/test_networking.py | unittests/test_networking.py | import pytest
import ipaddress
from lab import network
@pytest.mark.parametrize('ip', [
'127.0.0.1',
'::1'
])
def test_ping(ip):
network.ping(ip)
@pytest.mark.parametrize('ip, expected', [
('127.0.0.1', 4),
('::1', 6)
])
def test_addr_version_detection(ip, expected):
assert network.get_addr_... | mpl-2.0 | Python | |
ffb4c8a7a05df338f2b20720220856584fb39435 | Remove debug statements | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/ota/decorators.py | corehq/apps/ota/decorators.py | from corehq import toggles
from corehq.apps.users.decorators import require_permission
from corehq.apps.users.models import Permissions
from dimagi.utils.couch.cache.cache_core import get_redis_client
from functools import wraps
from django.http import HttpResponseBadRequest, HttpResponseForbidden
ORIGIN_TOKEN_HEAD... | from corehq import toggles
from corehq.apps.users.decorators import require_permission
from corehq.apps.users.models import Permissions
from dimagi.utils.couch.cache.cache_core import get_redis_client
from functools import wraps
from django.http import HttpResponseBadRequest, HttpResponseForbidden
ORIGIN_TOKEN_HEAD... | bsd-3-clause | Python |
fe8a9a3b19f7fce3038f9684d236de29531bd07d | Create dom_helpers.py | kylewm/mf2py,kylewm/mf2py,tommorris/mf2py,tommorris/mf2py | mf2py/dom_helpers.py | mf2py/dom_helpers.py | from bs4 import Tag as bs4Tag
## function to check if an element is a Tag or not.
def is_tag(el):
return isinstance(el,bs4Tag)
| mit | Python | |
17c39350788c9d371b6810dcc0bf82dd1fd93be1 | Test `brew uninstall --force` suggestion | Clpsplug/thefuck,SimenB/thefuck,SimenB/thefuck,mlk/thefuck,scorphus/thefuck,nvbn/thefuck,Clpsplug/thefuck,mlk/thefuck,nvbn/thefuck,scorphus/thefuck | tests/rules/test_brew_uninstall.py | tests/rules/test_brew_uninstall.py | import pytest
from tests.utils import Command
from thefuck.rules.brew_uninstall import get_new_command, match
@pytest.fixture
def stdout():
return ("Uninstalling /usr/local/Cellar/tbb/4.4-20160916... (118 files, 1.9M)\n"
"tbb 4.4-20160526, 4.4-20160722 are still installed.\n"
"Remove all v... | mit | Python | |
a172b75587f4ab185efb47a9a31f1e0e7c158932 | Add manage.py script | mahak/nova,openstack/nova,openstack/nova,mahak/nova,openstack/nova,mahak/nova | nova/db/sqlalchemy/api_migrations/migrate_repo/manage.py | nova/db/sqlalchemy/api_migrations/migrate_repo/manage.py | #!/usr/bin/env python
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | apache-2.0 | Python | |
c44ce1e29e8af7808dda8f80e65a92842dd8144a | Add py solution for 401. Binary Watch | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/binary-watch.py | py/binary-watch.py | from operator import mul
class Solution(object):
def dfs(self, rem, cur, depth):
if depth == 10:
h = sum(map(mul, cur[:4], [1, 2, 4, 8]))
m = sum(map(mul, cur[4:], [1, 2, 4, 8, 16, 32]))
if h < 12 and m < 60:
yield '{}:{:02d}'.format(h, m)
else:
... | apache-2.0 | Python | |
ec1e269460f222b89666a3e5593ffe18f928a82d | add Adaptive linear neurons2 | vvvvcp/NeverMore | pyml/adalineGD2.py | pyml/adalineGD2.py | from numpy.random import seed
import numpy as np
class AdalineSGD(object):
"""ADAptive LInear NEuron classifier.
Parameters
------------
eta : float
Learning rate (between 0.0 and 1.0)
n_iter : int
Passes over the training dataset.
Attributes
-----------
w_ : 1d-array
... | apache-2.0 | Python | |
8f383886b3703d9b0ed887d7a115be4c82234093 | Add template for the config file | finnp/squarewheel,finnp/squarewheel | config.template.py | config.template.py | WHEELMAP_API_KEY = ""
# If you want to use the same Key for visitor edits and calls,
# then set this to False
WHEELMAP_API_KEY_VISITOR_EDITS = ""
FOURSQUARE_CLIENT_ID = ""
FOURSQUARE_CLIENT_SECRET = ""
FOURSQUARE_CALLBACK_URL = ""
# Set this to a fixed random value, e.g. os.urandom(24)
FLASK_SECRET_KEY = ""
# Mongo... | mit | Python | |
97259cec637445c00e47f32d1cd9de3ee9446c92 | add basic test for sdist. | cournape/Bento,cournape/Bento,cournape/Bento,cournape/Bento | bento/commands/tests/test_sdist.py | bento/commands/tests/test_sdist.py | import os
import os.path as op
import unittest
import tempfile
import shutil
import zipfile
from bento.core.package \
import \
PackageDescription
from bento.core.node \
import \
create_root_with_source_tree
from bento.commands.options \
import \
OptionsContext
from bento.commands.cm... | bsd-3-clause | Python | |
4946272ce898eafb68ecca666a34f7f7229f6ff6 | test ares code | darknight-007/Firmware,darknight-007/Firmware,darknight-007/Firmware,darknight-007/Firmware,darknight-007/Firmware | testScripts/testARESswarm.py | testScripts/testARESswarm.py | import rospy
import roslaunch
import subprocess
import os
import sys
from sensor_msgs.msg import LaserScan, NavSatFix
from std_msgs.msg import Float64;
from gazebo_msgs.msg import ModelStates
from mavros_msgs.srv import CommandBool, CommandTOL, SetMode
from geometry_msgs.msg import PoseStamped,Pose,Vector3,Twist,Twis... | mit | Python | |
6f3266172b8125a853de1181336ba4cd348ea0b3 | Add reference problem | thomasgibson/firedrake-hybridization | testing/reference_problem.py | testing/reference_problem.py | from __future__ import absolute_import, print_function, division
from firedrake import *
qflag = False
degree = 1
hybrid = True
mesh = UnitSquareMesh(2, 2, quadrilateral=qflag)
n = FacetNormal(mesh)
if qflag:
RT = FiniteElement("RTCF", quadrilateral, degree)
DG = FiniteElement("DQ", quadrilateral, degree - ... | mit | Python | |
1d340a6d01a4ef5c91c446fcd1bbe969cbe46dd9 | Create test_b64.py | nfschmidt/cryptopals,nfschmidt/cryptopals | python/test_b64.py | python/test_b64.py | import pytest
import b64
@pytest.mark.parametrize("bytes_input,expected", [
(b'123', b'MTIz'),
(b'7Zg', b'N1pn'),
(b'AzU', b'QXpV'),
])
def test__from_bytes__with_3_bytes(bytes_input, expected):
out = b64.from_bytes(bytes_input)
result = b''.join(bytes([b]) for b in out)
assert expected == re... | mit | Python | |
28f8e49f059031d85711b57f8a564a7f10a769fc | rename script to change underscores in filename to dashes, for consistency | Bitcoin-com/BUcash,BTCfork/hardfork_prototype_1_mvf-bu,Bitcoin-com/BUcash,BTCfork/hardfork_prototype_1_mvf-bu,Bitcoin-com/BUcash,ftrader-bitcoinunlimited/hardfork_prototype_1_mvf-bu,BTCfork/hardfork_prototype_1_mvf-bu,ftrader-bitcoinunlimited/hardfork_prototype_1_mvf-bu,ftrader-bitcoinunlimited/hardfork_prototype_1_mvf... | contrib/devtools/remove-trailing-space.py | contrib/devtools/remove-trailing-space.py | #!/usr/bin/env python
'''
This tool removes trailing whitespace from files passed on command line.
Usage: remove_trailing_space.py [filepath ...]
Limitations:
- makes no backups of modified files
- modifies in place
- does not care what files you pass to it
- assumes it can keep the entire stripped file in memory
A... | mit | Python | |
12de165415f71023bb52f17d8e176ad4c7af0cfe | Create lmgtfy.py | WebShark025/TheZigZagProject,WebShark025/TheZigZagProject | plugins/lmgtfy.py | plugins/lmgtfy.py | mit | Python | ||
4ff6205a77aa70585c8428fb2cfff392ef73639f | Write test in Python | chemfiles/chemfiles,chemfiles/chemfiles,lscalfi/chemfiles,Luthaf/Chemharp,lscalfi/chemfiles,Luthaf/Chemharp,chemfiles/chemfiles,lscalfi/chemfiles,lscalfi/chemfiles,chemfiles/chemfiles,Luthaf/Chemharp | bindings/python/tests/write.py | bindings/python/tests/write.py | #!/usr/bin/env python
# -* coding: utf-8 -*
from chemharp import *
import os
FILENAME = "test-python.xyz"
CONTENT = """4
Written by Chemharp
He 0 0 0
He 0 0 0
He 0 0 0
He 0 0 0
"""
if __name__ == "__main__":
traj = Trajectory(FILENAME, "w")
top = Topology()
for _ in range(4):
top.append(Atom("H... | bsd-3-clause | Python | |
befcb5c64ef39dbc6fe5dce8fb8accdffa87cd0c | Add custom generics RetrieveUpdateAPIView | jessamynsmith/boards-backend,jessamynsmith/boards-backend,GetBlimp/boards-backend | blimp_boards/utils/generics.py | blimp_boards/utils/generics.py | from rest_framework import generics, mixins
from .mixins import UpdateModelMixin
class RetrieveUpdateAPIView(mixins.RetrieveModelMixin,
UpdateModelMixin,
generics.GenericAPIView):
"""
Concrete view for retrieving, updating a model instance.
"""
... | agpl-3.0 | Python | |
ce2fe4828f0253dce0b2ff633f5985a3c4ed8e7e | add test for the removal of tags | fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID | django/applications/catmaid/tests/test_tags.py | django/applications/catmaid/tests/test_tags.py | from django.test import TestCase
from django.test.client import Client
from catmaid.models import Class, ClassInstance, TreenodeClassInstance, Relation
from catmaid.models import Treenode
from catmaid.control.label import remove_label
from catmaid.tests.common import CatmaidTestCase
class TagCreationAndRemovalTest(Ca... | agpl-3.0 | Python | |
262dad3d70b17642964304cb8f25955dc70ca477 | Add flickrpc.py | rossburton/flickrest | flickrpc.py | flickrpc.py | #! /usr/bin/python
from twisted.internet import reactor, defer
from twisted.web.xmlrpc import Proxy
from elementtree import ElementTree
import os, md5
class FlickRPC:
def __init__(self, api_key, secret, perms="read"):
self.proxy = Proxy("http://api.flickr.com/services/xmlrpc/")
self.api_key = ... | lgpl-2.1 | Python | |
f8e8ab49d38bb5397de75b8c5dee7c593bb4ca79 | add code for singleton decorator | areski/sms-khomp-api,areski/sms-khomp-api | sms_khomp_api/singleton.py | sms_khomp_api/singleton.py | """ This module provides a decorator for adding the sigleton feature to classes.
Example usage:
>>> @singleton
... class SpamaTon(object):
... def __init__(self, adjunct):
... self.adjunct = adjunct
...
... def spam_adjunct(self):
... return self.adjunct
...
... | mpl-2.0 | Python | |
c83ec7a33334c253362f93b991c396d3d1338ea4 | Add test with single rule with three nonterminals for chromsky normal form transformation | PatrikValkovic/grammpy | tests/ChromskyForm/OneRuleWithMultipleNonterminalsTest.py | tests/ChromskyForm/OneRuleWithMultipleNonterminalsTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 28.08.2017 14:37
:Licence GNUv3
Part of grammpy-transforms
"""
from unittest import TestCase, main
from grammpy import *
from grammpy_transforms import ContextFree
class S(Nonterminal): pass
class A(Nonterminal): pass
class B(Nonterminal): pass
class C(Nonte... | mit | Python | |
62ef8f6c90d3d1ed0d850a893e9711d410dfeb16 | Add migration to fix groupcontent foreign key | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | entities/migrations/0045_auto_20160922_1330.py | entities/migrations/0045_auto_20160922_1330.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-22 11:30
from __future__ import unicode_literals
from django.db import migrations
def set_groupcontent_group(apps, schema_editor):
Group1 = apps.get_model('entities.Group')
Group2 = apps.get_model('groups.Group')
GroupContent = apps.get_mode... | agpl-3.0 | Python | |
ea8fb0cd933a9c0e0310c14536c2ee00c8889247 | Add support for KVM virtual machines managed by python-carrier | clusto/clusto,motivator/clusto,sloppyfocus/clusto,sloppyfocus/clusto,JTCunning/clusto,rongoro/clusto,thekad/clusto,JTCunning/clusto,thekad/clusto,rongoro/clusto,clusto/clusto,motivator/clusto,rongoro/clusto | src/clusto/drivers/devices/servers/kvmvirtualserver.py | src/clusto/drivers/devices/servers/kvmvirtualserver.py | from traceback import format_exc
from urlparse import urlparse
import httplib
import sys
try:
import simplejson as json
except ImportError:
import json
from basicserver import BasicVirtualServer
from clusto.exceptions import DriverException
class KVMVirtualServer(BasicVirtualServer):
_driver_name = "kvmv... | bsd-3-clause | Python | |
e1a8b68ec23eab2fa7644f856b5740b29993a76b | add single-file dump script | sqs/freequery,sqs/freequery | bin/import-dump.py | bin/import-dump.py | import sys
from freequery.repository.document import Document
from freequery.repository.repository import Repository
if len(sys.argv) != 3:
print "Usage: %s <repos> <dump>" % sys.argv[0]
exit(1)
repospath = sys.argv[1]
dumppath = sys.argv[2]
repos = Repository(repospath)
dumpfile = open(dumppath, 'rb')
DEL... | agpl-3.0 | Python | |
966354af720e49993a3481971da63d92f0d83eda | add unit tests for get_odata_property_from_export_item | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/api/odata/tests/test_utils.py | corehq/apps/api/odata/tests/test_utils.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.test import SimpleTestCase
from corehq.apps.api.odata.utils import get_odata_property_from_export_item
from corehq.apps.export.models import ExportItem, PathNode
class TestOdataFromExportItem(SimpleTestCase):
def test_ge... | bsd-3-clause | Python | |
475b641654cd95e0bfeed5c36db6dec2d963c786 | add custom exceptions | looker-open-source/henry | henry/modules/exceptions.py | henry/modules/exceptions.py | class NotFoundError(Exception):
pass
| mit | Python | |
eb5f3db33bf607b21dfc132127e873c9722c687e | Add script to get all brazilian state with their respective type and coverage | novafloss/workalendar,novapost/workalendar,jaraco/calendra | workalendar/brazil_holidays_set.py | workalendar/brazil_holidays_set.py | from .registry import registry
from workalendar.america import Brazil, BrazilBankCalendar
# Commemorative holidays list
COMMEMORATIVE_HOLIDAYS = [
'Consciência Negra',
]
def brazil_all_holidays_set(year):
"Returns all holidays in brazil with their respective type and coverage"
holidays_set = []
# ... | mit | Python | |
79c28331d2fe61569b73b60464671a94bdb415cc | Add py-codecov package (#13383) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-codecov/package.py | var/spack/repos/builtin/packages/py-codecov/package.py | # Copyright 2013-2019 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 PyCodecov(PythonPackage):
"""Hosted coverage reports for Github, Bitbucket and Gitlab."""
... | lgpl-2.1 | Python | |
e302e5e9876d2979f9d59d79d63243cef18715cf | add publishReports | Eylrid/BMaggregator | publishReports.py | publishReports.py | #!/usr/bin/python
from BMaggregator import *
bma = Aggregator()
bma.publishAllReports()
| mit | Python | |
b679064f9f455a788de3bad9360cbfbf52a97a02 | add helper for creating documents | ebroecker/pyreqif,ebroecker/pyreqif | pyreqif/create.py | pyreqif/create.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import pyreqif
import rif
import uuid
def createDocument(id, title="title", comment="created by pyreqif"):
mydoc = pyreqif.doc()
mydoc.addHeader({"identifier":id,"sourceToolId":"pyreqif", "comment": comment, "title":title, "creationTime": str(dateti... | bsd-2-clause | Python | |
36e0cf9510a6cfaf7253e473caac988c04551838 | Create filtering_timeline_status.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | tweepy/filtering_timeline_status.py | tweepy/filtering_timeline_status.py | """
See tutorial:
- https://python.web.id/blog/cara-menggunakan-tweepy/
- https://python.web.id/blog/filter-timeline-twitter-menggunakan-tweepy/
"""
import tweepy
import requests
from tweepy.auth import OAuthHandler
requests.packages.urllib3.disable_warnings()
# Consumer keys and access tokens, used for OAuth
consu... | agpl-3.0 | Python | |
03328088a29763a30e45da95cae357bd396dddec | add missing migrations | SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree | InvenTree/order/migrations/0065_alter_purchaseorderlineitem_part.py | InvenTree/order/migrations/0065_alter_purchaseorderlineitem_part.py | # Generated by Django 3.2.12 on 2022-03-28 22:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('company', '0042_supplierpricebreak_updated'),
('order', '0064_purchaseorderextraline_salesorderextraline'),
]
... | mit | Python | |
4569ece7ba6a26969e8d6f253427835ad4fe3682 | Add generate images example | qiuwch/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv | client/examples/generate-images.py | client/examples/generate-images.py | from ipynb_util import *
def get_image(client, mode, frame_index):
# return client.request('vget /camera/0/%s %s' % (mode, os.path.abspath('%s.png' % mode)))
return client.request('vget /camera/0/%s %s' % (mode, ('%d_%s.png' % (frame_index, mode))))
def render_frame(client, camera_pos, frame_index):
pos =... | mit | Python | |
0bbb0b043f42ef99c5d04a6caf265270a80efaae | add views/helper.py | vicalloy/django-lb-workflow,vicalloy/django-lb-workflow,vicalloy/django-lb-workflow | lbworkflow/views/helper.py | lbworkflow/views/helper.py | from django.utils import timezone
from django.db.models import Q
from lbworkflow.models import WorkItem
def user_wf_info_as_dict(wf_obj, user):
ctx = {}
instance = wf_obj.pinstance
is_wf_admin = instance.is_wf_admin(user)
in_process = instance.cur_activity.status == 'in progress'
workitems = Work... | mit | Python | |
aea1d02c7375ed48f1689b14994154865eb8f547 | add pickle01.py | devlights/try-python | trypython/stdlib/pickle01.py | trypython/stdlib/pickle01.py | # coding: utf-8
"""
pickleモジュールについてのサンプルです。
"""
import collections
import functools
import os
import pickle
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
Test02 = collections.namedtuple('Test02', ['val1', 'val2'])
class Sample(SampleBase):
def exec(self):
... | mit | Python | |
60428b4626b1b798f2773737309289dd66544b08 | Add manage.py | seekuoitdc/clubcheckout | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "clubcheckout.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mit | Python | |
a8fa60c54a3f307ded88e87a04ad21ceb7e13ceb | add manage.py to launches the application | michaelgichia/Twezana,michaelgichia/Twezana | manage.py | manage.py | #!/usr/bin/env python
import os
from app import create_app
app = create_app(os.getenv('TWEZANA_CONFIG') or 'default')
manager = Manager(app)
if __name__ == '__main__':
manager.run() | mit | Python | |
a3a83ef528eb70a939c8ea40c4d9c4362f6cbc6f | add cached_db | jmp0xf/django-user-sessions,jmp0xf/django-user-sessions | user_sessions/backends/cached_db.py | user_sessions/backends/cached_db.py | from __future__ import absolute_import
import logging
from django.conf import settings
from django.core.cache import caches
from django.core.exceptions import SuspiciousOperation
from django.utils import timezone
from django.utils.encoding import force_text
from .db import SessionStore as DBStore
KEY_PREFIX = "user_... | mit | Python | |
aae60670a7c2de09661e93d49e50d127388ab115 | Update __init__.py | ioos/compliance-checker,abirger/compliance-checker,DanielJMaher/compliance-checker,petejan/compliance-checker,aodn/compliance-checker,ocefpaf/compliance-checker,duncombe/compliance-checker,webtrike/compliance-checker,lukecampbell/compliance-checker | compliance_checker/__init__.py | compliance_checker/__init__.py | __version__="1.0.2"
| __version__="1.0.0"
| apache-2.0 | Python |
fe68f0ae5b6234405327d205df2f94577c9a1b20 | Update grid search test after fixing convergence based stopping logic. | spennihana/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,h2oai/h2o-dev,michalkurka/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,spennihana/h2o-3,jangorecki/h2o-3,h2oai/h2o-dev,michalkurka/h2o-3,jangorecki/h2o-3,mathemage/h2o-3,h2oai/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,YzPaul3/h2o-3,h2oai/h2o-dev,jangore... | h2o-py/tests/testdir_algos/glm/pyunit_benign_glm_grid.py | h2o-py/tests/testdir_algos/glm/pyunit_benign_glm_grid.py | from __future__ import print_function
from builtins import range
import sys
sys.path.insert(1,"../../../")
from h2o.grid.grid_search import H2OGridSearch
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
import h2o
from tests import pyunit_utils
def benign_grid():
training_data = h2o.import_file(pyunit_u... | from __future__ import print_function
from builtins import range
import sys
sys.path.insert(1,"../../../")
from h2o.grid.grid_search import H2OGridSearch
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
import h2o
from tests import pyunit_utils
def benign_grid():
training_data = h2o.import_file(pyunit_u... | apache-2.0 | Python |
0fad202ba67b454e7f47421e13abca26f1ca8ef3 | Create create_template.py | sickbock/python_scripts | create_template.py | create_template.py | #!/usr/bin/python
################################################################################
# Usage: 'create_template.py <dokuwiki_root>/<wiki_dir> "tag1 tag2 .."'
# https://www.dokuwiki.org/namespace_templates#template_files
# Creates a page template in all name spaces without one
# (Resulting pages rely on a f... | bsd-2-clause | Python | |
6bacd6656ae6a78a73b256287212fa37309f6c71 | Create personalpronoment.py | vickydasta/grammarripper | kernel/personalpronoment.py | kernel/personalpronoment.py | #!/usr/bin/python
#personal pronoment in english
#usage :
#>>> from personalpronoment import *
#>>> x=personal()
#>>> x.pronoment[0]
#>>> 'i'
#and so on
class personal:
pronoment=['i','you','she','he','it','we','they']
| cc0-1.0 | Python | |
89919ad6eaae9d1080f4ef3b4cb47883ed9ba9d4 | Make a plot of kmer shannon and evenness | linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab | kmers/plot_kmer_evenness.py | kmers/plot_kmer_evenness.py | """
Plot the shannon and evennes of the kmer profiles. Uses the output from kmer_entropy.py code, but
requires that you add headers.
"""
import os
import sys
import argparse
import os, sys
import numpy as np
import pandas as pd
import seaborn as sns
sns.set(rc={'figure.figsize':(11.7,8.27)})
sns.set_style("white")
im... | mit | Python | |
8ff927da95e34dd6d2f0cd00b6696232825ba60d | add doc/article/figures-code with a script | yardencsGitHub/tf_syllable_segmentation_annotation | doc/article/figures-code/Birdsong-Recognition-learncurve.py | doc/article/figures-code/Birdsong-Recognition-learncurve.py | #!/usr/bin/env python
# coding: utf-8
# In[7]:
from pathlib import Path
import article
# In[2]:
config_dir = Path('../../../src/configs/')
config_files = config_dir.glob('*BirdsongRecognition*ini')
config_files = sorted([config_file for config_file in config_files])
data_dir = Path('../../../data/')
test_dirs ... | bsd-3-clause | Python | |
ce0bc1697acfde41fe4bf7be7241898e38cdb2b9 | Create __init__.py | PyThaiNLP/pythainlp | pythainlp/__init__.py | pythainlp/__init__.py | apache-2.0 | Python | ||
f3c433993841e2475f0369fbc82e94c0fe572a28 | add prize class | zhzhussupovkz/taxi-py | core/prize.py | core/prize.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Zhassulan Zhussupov
# Author zhzhussupovkz@gmail.com
# Prize class
import random
class Prize:
def __init__(self, pygame, screen):
self.pygame = pygame
self.screen = screen
self.image = self.pygame.image.load("./images/env/present.png")
s... | mit | Python | |
4e98a8be8f87e390920735d683e299ff52f1c364 | Add tests for WarehouseForm | mociepka/saleor,mociepka/saleor,mociepka/saleor | tests/dashboard/test_warehouses.py | tests/dashboard/test_warehouses.py | import pytest
from django.db.utils import IntegrityError
from saleor.dashboard.warehouse.forms import WarehouseForm
from saleor.warehouse.models import Warehouse
def test_warehouse_form_will_fail_when_no_address(shipping_zone):
data = {
"name": "Test",
"shipping_zones": [shipping_zone],
"... | bsd-3-clause | Python | |
5a9b24d1d3f481519873d5607d8745d410d45202 | Add instance.py skeleton | Neurita/darwin | darwin/instance.py | darwin/instance.py | """
YAML Class Instantiator
"""
import yaml
def import_module(module_path):
"""Import any module to the global Python environment
Parameters
----------
module_path: str
Path to the module to be imported
"""
class Instantiator():
"""
YAML Class Instantiator for classifiers and ... | bsd-3-clause | Python | |
0dcf941e2f4297c1d3020160144f0c16f1adf9ab | Create homework-5-cryptanalysis.py | JohnDvorak/general-cryptanalysis | homework-5-cryptanalysis.py | homework-5-cryptanalysis.py | #! usr/bin/env python3
import sys
# Binary shortcuts, to save myself time
x1 = [0]*32 + [1]*32
x2 = ([0]*16 + [1]*16) * 2
x3 = ([0]*8 + [1]*8) * 4
x4 = ([0]*4 + [1]*4) * 8
x5 = ([0]*2 + [1]*2) * 16
x6 = [0,1]*32
# Hard-coded using the DES S-box 2 table Understanding Cryptography
y1 = [1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1... | mit | Python | |
3492c308708f76599186239b0adf24189800f9de | Add releases subcommand for quering for releases. | yougov/rapt,yougov/rapt | rapt/cmds/releases.py | rapt/cmds/releases.py | import click
from rapt.connection import get_vr
from rapt.models import query
@click.command()
@click.option('--app-name', '-a')
@click.option('--limit', '-l', default=20)
def releases(app_name, limit):
"""List releases and print the compiled name.
The `compiled_name` includes the app, build version and app... | bsd-3-clause | Python | |
760bf22f0f5580e7a0ead052c21d234c8355abec | Revert "Delete patch_camelyon.py" | tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets | tensorflow_datasets/image/patch_camelyon.py | tensorflow_datasets/image/patch_camelyon.py | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 | Python | |
3134a061d9bd1d80fd99d223537f6c046a862d31 | Add script to id missing CHANGELOG entries | Kitware/girder,Xarthisius/girder,Xarthisius/girder,girder/girder,data-exp-lab/girder,manthey/girder,manthey/girder,jbeezley/girder,RafaelPalomar/girder,Kitware/girder,kotfic/girder,girder/girder,girder/girder,RafaelPalomar/girder,kotfic/girder,Xarthisius/girder,Xarthisius/girder,manthey/girder,data-exp-lab/girder,Kitwa... | release_notes_prep.py | release_notes_prep.py | # Find head of current branch and merge commit of last release
# Get merges in between
current_branch_head = '8dfeae34'
last_release_head = '3550d330'
cmd = 'git log --oneline --merges %s ^%s' % (current_branch_head, last_release_head)
import subprocess
merge_commits = subprocess.check_output(cmd, shell=True).split('\n... | apache-2.0 | Python | |
b6c19867d6ef4ef69f6ed5688eaf92c4a3145b79 | Add an __init__.py file to make the module importable in generate_lib.py | tensorflow/docs,tensorflow/docs,tensorflow/docs | tools/tensorflow_docs/api_generator/report/__init__.py | tools/tensorflow_docs/api_generator/report/__init__.py | # Lint as: python3
# Copyright 2020 The TensorFlow 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 ... | apache-2.0 | Python | |
f926e7a1537897ccbbf3f3876a6896cb07a4a842 | create migration file to fix tests errors | ioO/billjobs | billjobs/migrations/0009_auto_20190114_2126.py | billjobs/migrations/0009_auto_20190114_2126.py | # Generated by Django 2.1.3 on 2019-01-14 21:26
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('billjobs', '0008_auto_20180308_1312'),
]
operations = [
migrations.AlterFi... | mit | Python | |
090a7f480f27b2a72fa1abe19d69a6faf42ddb55 | Return breakdown; #536 | Phoenix1369/site,monouno/site,Phoenix1369/site,Phoenix1369/site,monouno/site,Minkov/site,monouno/site,DMOJ/site,monouno/site,monouno/site,Minkov/site,Phoenix1369/site,DMOJ/site,DMOJ/site,Minkov/site,DMOJ/site,Minkov/site | judge/performance_points.py | judge/performance_points.py | from django.conf import settings
from django.db.models import Max
from judge.models import Problem
from collections import namedtuple
PP_STEP = getattr(settings, 'PP_STEP', 0.95)
PP_ENTRIES = getattr(settings, 'PP_ENTRIES', 100)
PP_WEIGHT_TABLE = [pow(PP_STEP, i) for i in xrange(PP_ENTRIES)]
PPBreakdown = namedtupl... | from django.conf import settings
from django.db.models import Max
from judge.models import Problem
from collections import namedtuple
PP_STEP = getattr(settings, 'PP_STEP', 0.95)
PP_ENTRIES = getattr(settings, 'PP_ENTRIES', 100)
PP_WEIGHT_TABLE = [pow(PP_STEP, i) for i in xrange(PP_ENTRIES)]
PPBreakdown = namedtupl... | agpl-3.0 | Python |
99265b22ac158d59d197cc00838b2f49b6948dd3 | Add simple render script. | naturalatlas/mapnik,Airphrame/mapnik,pramsey/mapnik,strk/mapnik,qianwenming/mapnik,whuaegeanse/mapnik,pnorman/mapnik,mbrukman/mapnik,strk/mapnik,strk/mapnik,jwomeara/mapnik,jwomeara/mapnik,CartoDB/mapnik,tomhughes/mapnik,pnorman/mapnik,pramsey/mapnik,qianwenming/mapnik,stefanklug/mapnik,mapycz/python-mapnik,naturalatla... | demo/simple-renderer/render.py | demo/simple-renderer/render.py | #!/usr/bin/env python
import sys
import mapnik
def render(input_file, output_file, width=800, height=800, bbox=None):
m = mapnik.Map(width, height)
mapnik.load_map(m, input_file, False)
if bbox is not None:
m.zoom_to_box(bbox)
else:
m.zoom_all()
mapnik.render_to_file(m, output_file... | lgpl-2.1 | Python | |
48d5d46f6c2ecff33e5cfe02a9e24362be08fde4 | Add transtermhp.py | konrad/kufpybio | kufpybio/transtermhp.py | kufpybio/transtermhp.py | class TranstermHPBAGReader(object):
def entries(self, input_fh):
for line in input_fh:
if "NONE" in line:
continue
yield(TranstermHPBAGEntry(line))
class TranstermHPBAGEntry(object):
def __init__(self, line):
row = line.strip().split()
assert(le... | isc | Python | |
2dc32c8cd17dbda41cf0c252c4c8cec6982f873e | Create better_bet_test.py | michigan-nii/skills | BasicPython/better_bet_test.py | BasicPython/better_bet_test.py | #!/usr/bin/env python
import subprocess
import os
my_home = os.path.expanduser('~')
data_dir = os.path.join(my_home, 'nipype_tutorial', 'data')
os.chdir(data_dir)
id = 1
subject = 'sub' + str(id).zfill(3)
top_dir = os.getcwd()
os.chdir(subject)
if not os.path.isfile('struct_bet.nii.gz') \
or os.path.getmtime('str... | mit | Python | |
86df90413e231a4dade58ea56a01aad3d4d76227 | Add reissue_activation_keys | enjaz/enjaz,enjaz/enjaz,osamak/student-portal,osamak/student-portal,osamak/student-portal,osamak/student-portal,enjaz/enjaz,enjaz/enjaz,osamak/student-portal,enjaz/enjaz | accounts/management/commands/reissue_activation_keys.py | accounts/management/commands/reissue_activation_keys.py | from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from userena.models import UserenaSignup
class Command(BaseCommand):
help = "Notify users to update."
def handle(self, *args, **options):
for user in User.objects.filter(is_active=False, userena_signup__i... | agpl-3.0 | Python | |
268b75df19185af6630ced80a270fcd688743099 | test Tunnel.tunnel_request_received() | XKNX/xknx,XKNX/xknx | test/io_tests/tunnel_test.py | test/io_tests/tunnel_test.py | """Unit test for KNX/IP Tunnelling Request/Response."""
import asyncio
import unittest
from unittest.mock import Mock, patch
from xknx import XKNX
from xknx.io import Tunnel
from xknx.knxip import CEMIFrame
from xknx.telegram import TelegramDirection
class TestTunnelling(unittest.TestCase):
"""Test class for xkn... | mit | Python | |
e7d922ea43e05d938ec1ac0df93e3975599099b3 | Test runner: even if yaml parsing fails, write the response out. | guard163/tarantool,nvoron23/tarantool,condor-the-bird/tarantool,vasilenkomike/tarantool,rtsisyk/tarantool,ocelot-inc/tarantool,rtsisyk/tarantool,ocelot-inc/tarantool,dkorolev/tarantool,vasilenkomike/tarantool,nvoron23/tarantool,KlonD90/tarantool,ocelot-inc/tarantool,mejedi/tarantool,condor-the-bird/tarantool,guard163/t... | test/lib/admin_connection.py | test/lib/admin_connection.py | __author__ = "Konstantin Osipov <kostja.osipov@gmail.com>"
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | __author__ = "Konstantin Osipov <kostja.osipov@gmail.com>"
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | bsd-2-clause | Python |
4d2e5493aa999202af2b409be752ac531a7c41ab | Add tvthek.ORF.at spider. | nblock/feeds,Lukas0907/feeds,nblock/feeds,Lukas0907/feeds | feeds/spiders/tvthek_orf_at.py | feeds/spiders/tvthek_orf_at.py | #!/usr/bin/python3
import json
import pytz
from datetime import datetime
from scrapy.spiders import Spider
from scrapy import Request
from feeds.loaders import FeedEntryItemLoader
from feeds.loaders import FeedItemLoader
class TvthekOrfAtSpider(Spider):
name = 'tvthek.orf.at'
allowed_domains = ['tvthek.or... | agpl-3.0 | Python | |
441785415f2ac99b009846046966b61ac43ce6bb | Add simple counter test | tjake/cassandra-dtest,bdeggleston/cassandra-dtest,bdeggleston/cassandra-dtest,snazy/cassandra-dtest,aweisberg/cassandra-dtest,stef1927/cassandra-dtest,spodkowinski/cassandra-dtest,yukim/cassandra-dtest,blerer/cassandra-dtest,pauloricardomg/cassandra-dtest,beobal/cassandra-dtest,spodkowinski/cassandra-dtest,carlyeks/cas... | counter_tests.py | counter_tests.py | from time import sleep
from dtest import Tester
from assertions import *
from tools import *
class TestCounters(Tester):
def simple_increment_test(self):
""" Simple incrementation test (Created for #3465, that wasn't a bug) """
cluster = self.cluster
cluster.populate(3).start()
no... | apache-2.0 | Python | |
98f37bb6fff90d9a4385ceea5454f0b5146e6dee | Remove bare except in unnecessary try block | mikedingjan/wagtail,Toshakins/wagtail,nutztherookie/wagtail,quru/wagtail,mayapurmedia/wagtail,iansprice/wagtail,mixxorz/wagtail,zerolab/wagtail,iansprice/wagtail,takeflight/wagtail,gogobook/wagtail,mixxorz/wagtail,hamsterbacke23/wagtail,FlipperPA/wagtail,kurtw/wagtail,davecranwell/wagtail,chrxr/wagtail,nrsimha/wagtail,... | wagtail/wagtailimages/rich_text.py | wagtail/wagtailimages/rich_text.py | from wagtail.wagtailimages.models import get_image_model
from wagtail.wagtailimages.formats import get_image_format
class ImageEmbedHandler(object):
"""
ImageEmbedHandler will be invoked whenever we encounter an element in HTML content
with an attribute of data-embedtype="image". The resulting element in ... | from wagtail.wagtailimages.models import get_image_model
from wagtail.wagtailimages.formats import get_image_format
class ImageEmbedHandler(object):
"""
ImageEmbedHandler will be invoked whenever we encounter an element in HTML content
with an attribute of data-embedtype="image". The resulting element in ... | bsd-3-clause | Python |
936b28b9788d50aad9376f808effe1445ef5550c | add management command for running multiple import scripts at once | andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import.py | polling_stations/apps/data_collection/management/commands/import.py | import glob, os
from importlib.machinery import SourceFileLoader
from django.core.management.base import BaseCommand
"""
Run all of the import scripts relating to a particular election or elections
"""
class Command(BaseCommand):
summary = []
def add_arguments(self, parser):
parser.add_argument(
... | bsd-3-clause | Python | |
571f64d1e97ef78ce788d1594a1a5eccf7b34e72 | add "Matt's very rationally designed mutants" in mutants_database.py | mattsmart/uwaterloo-igem-2015,smile4life/uwaterloo-igem-2015,smile4life/uwaterloo-igem-2015,smile4life/uwaterloo-igem-2015,rjgoodin/uwaterloo-igem-2015,JeffGoldblum/uwaterloo-igem-2015,smile4life/uwaterloo-igem-2015,smile4life/uwaterloo-igem-2015,mattsmart/uwaterloo-igem-2015,smile4life/uwaterloo-igem-2015,rjgoodin/uwa... | models/tridimensional/docking_validation/mutant_database.py | models/tridimensional/docking_validation/mutant_database.py | mutants = {
0: {'label': 'original',
'mutations': []},
1: {'label': 'fake1',
'mutations': [(1135, 'V')]},
2: {'label': 'fake2',
'mutations': [(1135, 'E')]},
3: {'label': 'fake3',
'mutations': [(1135, 'Q')]},
4: {'label': 'fake4',
'mutations': [(1135, 'R')]},
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.