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 |
|---|---|---|---|---|---|---|---|---|
7c11b350ead718cc2a4e44610ba6e2b66896e7d3 | Fix Attribute error | amalshehu/exercism-python | etl/etl.py | etl/etl.py | # File: etl.py
# Purpose: To do the `Transform` step of an Extract-Transform-Load.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Thursday 22 September 2016, 03:40 PM
def transform(words):
new_words = dict()
for point, letters in words.items():
for letter in letters:
... | # File: etl.py
# Purpose: To do the `Transform` step of an Extract-Transform-Load.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Thursday 22 September 2016, 03:40 PM
def transform(words):
new_words = dict()
for point, letters in words.iteritem():
for letter in letters:
... | mit | Python |
f63f357ff67e34d299bd758f24dd18f27609e745 | remove copy_basis_and_orbitals | SCM-NV/qmworks-namd,SCM-NV/qmworks-namd | test/test_multipole.py | test/test_multipole.py | """Test quadrupole calculation."""
import shutil
from pathlib import Path
import numpy as np
from assertionlib import assertion
from nanoqm.integrals.multipole_matrices import compute_matrix_multipole
from nanoqm.workflows.input_validation import process_input
from qmflows.parsers.xyzParser import readXYZ
from .util... | """Test quadrupole calculation."""
import shutil
from pathlib import Path
import numpy as np
from assertionlib import assertion
from nanoqm.integrals.multipole_matrices import compute_matrix_multipole
from nanoqm.workflows.input_validation import process_input
from qmflows.parsers.xyzParser import readXYZ
from .util... | mit | Python |
a6e3857f0eaedaf894134486d422480f1a246c72 | update init | jlsutherland/doc2text,jlsutherland/doc2text | doc2text/__init__.py | doc2text/__init__.py | import PyPDF2 as pyPdf
import os
from .page import Page
def main():
"""Entry point for the application script"""
print("Call your main application code here")
def Document:
def __init__(self, path):
self.file_ext = os.path.basename(path).split('.')[1]
# see if it is a pdf
# if it's... | import PyPDF2 as pyPdf
from .page import Page
def main():
"""Entry point for the application script"""
print("Call your main application code here")
| mit | Python |
27a75ebb6256fad8a3f30d91dea0c683d4f34ae6 | add polygon to settings for Faker update | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/config/settings/test.py | meinberlin/config/settings/test.py | from .dev import *
if 'meinberlin.apps.servicekonto' not in INSTALLED_APPS:
INSTALLED_APPS += ('meinberlin.apps.servicekonto',)
A4_ORGANISATION_FACTORY = \
'meinberlin.test.factories.organisations.OrganisationFactory'
A4_USER_FACTORY = 'meinberlin.test.factories.UserFactory'
ACCOUNT_EMAIL_VERIFICATION = 'opt... | from .dev import *
if 'meinberlin.apps.servicekonto' not in INSTALLED_APPS:
INSTALLED_APPS += ('meinberlin.apps.servicekonto',)
A4_ORGANISATION_FACTORY = \
'meinberlin.test.factories.organisations.OrganisationFactory'
A4_USER_FACTORY = 'meinberlin.test.factories.UserFactory'
ACCOUNT_EMAIL_VERIFICATION = 'opt... | agpl-3.0 | Python |
8dc60cc03f6a59ab5ca067e9f42a5b23a886fff8 | Support for the new game controller handling | maxfish/Retrofight2,maxfish/Retrofight2 | test_game.py | test_game.py | #!/usr/bin/env python
import logging
from mgl2d.app import App
from mgl2d.graphics.post_processing_step import PostProcessingStep
from mgl2d.graphics.screen import Screen
from mgl2d.graphics.shader import Shader
from mgl2d.input.game_controller_manager import GameControllerManager
from mgl2d.math.rect import Rect
fro... | #!/usr/bin/env python
import logging
from mgl2d.app import App
from mgl2d.graphics.post_processing_step import PostProcessingStep
from mgl2d.graphics.screen import Screen
from mgl2d.graphics.shader import Shader
from mgl2d.input.game_controller import GameController
from mgl2d.input.joystick import Joystick
from mgl2d... | mit | Python |
8a272c746c8b641bd9f318ab21718854f28fc69d | Fix top-level __init__.py package imports | openforcefield/openff-toolkit,open-forcefield-group/openforcefield,open-forcefield-group/openforcefield,openforcefield/openff-toolkit,open-forcefield-group/openforcefield | openforcefield/__init__.py | openforcefield/__init__.py | try:
import openeye
except Exception as e:
print(e)
print('Warning: Cannot import openeye toolkit; not all functionality will be available.')
| try:
import openeye
# These can only be imported if openeye tools are available
from smarty.atomtyper import *
from smarty.forcefield import *
from smarty.forcefield_utils import *
from smarty.sampler import *
from smarty.utils import *
from smarty.environment import *
from smarty.sa... | mit | Python |
c8bbfdbab1e6c162561f0df9463d3ada621e5dc3 | Move data formatting out of Cramer. | e-koch/TurbuStat,Astroua/TurbuStat | turbustat/statistics/threeD_to_twoD.py | turbustat/statistics/threeD_to_twoD.py |
'''
Routines for transforming data cubes to 2D representations
'''
import numpy as np
def intensity_data(cube, p=0.1, noise_lim=0.1):
'''
Clips off channels below the given noise limit and keep the
upper percentile specified.
Parameters
----------
cube : numpy.ndarray
Data cube.
... |
'''
Routines for transforming data cubes to 2D representations
'''
import numpy as np
def intensity_data(cube, p=0.1, noise_lim=0.1):
'''
Clips off channels below the given noise limit and keep the
upper percentile specified.
Parameters
----------
cube : numpy.ndarray
Data cube.
... | mit | Python |
92f6112b8b6f17909dddcd045d765bf939ee9eec | Use __file__ for path. | arkottke/pyrotd | example.py | example.py | #!/usr/bin/env python3
import pathlib
import matplotlib.pyplot as plt
import numpy as np
import pyrotd
# Load the AT2 timeseries
fpath = pathlib.Path(__file__).parent.joinpath(
'test_data', 'RSN8883_14383980_13849360.AT2')
with open(fpath) as fp:
for _ in range(3):
next(fp)
line = next(fp)
... | #!/usr/bin/env python3
import pathlib
import matplotlib.pyplot as plt
import numpy as np
import pyrotd
# Load the AT2 timeseries
fpath = pathlib.Path('test_data', 'RSN8883_14383980_13849360.AT2')
with open(fpath) as fp:
for _ in range(3):
next(fp)
line = next(fp)
time_step = float(line[17:25])
... | mit | Python |
22835dd59b7cf3ce664e08e8047efac8c8554010 | Add a shebang to the example. | hyperpublic/hyperpublic_python | example.py | example.py | #!/usr/bin/env python
from hyperpublic import *
# get these values from http://hyperpublic.com/oauth_clients
CLIENT_ID = "YOUR_ID_HERE"
CLIENT_SECRET = "YOUR_SECRET_HERE"
if __name__ == '__main__':
hp = Hyperpublic(CLIENT_ID, CLIENT_SECRET)
items = hp.places.find(lat=40.7, lon=-74)
print items
| from hyperpublic import *
# get these values from http://hyperpublic.com/oauth_clients
CLIENT_ID = "YOUR_ID_HERE"
CLIENT_SECRET = "YOUR_SECRET_HERE"
if __name__ == '__main__':
hp = Hyperpublic(CLIENT_ID, CLIENT_SECRET)
items = hp.places.find(lat=40.7, lon=-74)
print items
| mit | Python |
29cb1bbd7704333355c92c4ffb76e76bf40c7098 | Convert Ring to CGPM. | probcomp/cgpm,probcomp/cgpm | src/uncorrelated/ring.py | src/uncorrelated/ring.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | apache-2.0 | Python |
8cc963823431ca996ecd16172f1682cef47dfbd1 | Update example.py description | Tijndagamer/ADXL345-Python | example.py | example.py | #!/usr/bin/python
"""
Example script for ADXL345.py
Made by: MrTijn/Tijndagamer
Released under the MIT License
Copyright 2015
"""
from ADXL345 import ADXL345
from time import sleep
#Create an instance of the ADXL345 class
accelerometer = ADXL345(0x53)
while True:
axes = accelerometer.get_all_axes()
print("x... | #!/usr/bin/python
# Made by: MrTijn/Tijndagamer
# Copyright 2015
from ADXL345 import ADXL345
from time import sleep
#Create an instance of the ADXL345 class
accelerometer = ADXL345(0x53)
while True:
axes = accelerometer.get_all_axes()
print("x: %.3f" %(axes['x']))
print("y: %.3f" %(axes['y']))
print... | mit | Python |
11c06a0a9ee8b3cec543475f4453de7ba98afa6f | update to example | lochiiconnectivity/libcloud,t-tran/libcloud,andrewsomething/libcloud,wrigri/libcloud,sgammon/libcloud,sahildua2305/libcloud,DimensionDataCBUSydney/libcloud,ninefold/libcloud,andrewsomething/libcloud,smaffulli/libcloud,munkiat/libcloud,iPlantCollaborativeOpenSource/libcloud,supertom/libcloud,Cloud-Elasticity-Services/as... | example.py | example.py | # Licensed to libcloud.org under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in... | # Licensed to libcloud.org under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in... | apache-2.0 | Python |
cd9b2e375587fdf0bc6b2d61a983ca40e6680218 | Migrate with model from app state - Not from app code | adlius/osf.io,mattclark/osf.io,cslzchen/osf.io,pattisdr/osf.io,brianjgeiger/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,mattclark/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,felliott/osf.io,pattisdr/osf.io,mfraezz/osf.io,adlius/osf.io,baylee-d/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,Johnetordoff/osf.io,bay... | osf/migrations/0139_rename_aspredicted_schema.py | osf/migrations/0139_rename_aspredicted_schema.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-16 20:22
from __future__ import unicode_literals
from django.db import migrations
OLD_NAME = 'AsPredicted Preregistration'
NEW_NAME = 'Preregistration Template from AsPredicted.org'
def rename_schema(model, from_name, to_name):
try:
schema ... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-16 20:22
from __future__ import unicode_literals
from django.db import migrations
from osf.models import RegistrationSchema
OLD_NAME = 'AsPredicted Preregistration'
NEW_NAME = 'Preregistration Template from AsPredicted.org'
def rename_schema(from_name,... | apache-2.0 | Python |
3bb891f0ffa22459927eaac2a05c082cb93c175e | fix tag issue, support multi region | EslamElHusseiny/aws-query | example.py | example.py | #!/usr/bin/env python3
import boto3, prettytable, argparse
parser = argparse.ArgumentParser(description='AWS Query Example.')
parser.add_argument('-t', '--tag', required=True, help='tag')
parser.add_argument('-r', '--regions', required=True, help='comma separated AWS regions')
args = parser.parse_args()
service = 'e... | #!/usr/bin/env python3
import boto3, prettytable, argparse
parser = argparse.ArgumentParser(description='AWS Query Example.')
parser.add_argument('-t', '--tag', required=True, help='tag')
parser.add_argument('-r', '--region', required=True, help='region')
args = parser.parse_args()
regions = []
regions.append(args.r... | apache-2.0 | Python |
06ef4271c0b4ee7dea12b13f5ffc128b13c7cfe9 | Fix issue with newlines in logo | jawilson/pmxbot,jawilson/pmxbot | pmxbot/system.py | pmxbot/system.py | """
System commands
"""
import sys
import operator
import io
import time
import pkg_resources
import pmxbot.core
from pmxbot.core import command, Handler
@command("help", aliases=('h',), doc="Help (this command)")
def help(client, event, channel, nick, rest):
rs = rest.strip()
if rs:
# give help for matching co... | """
System commands
"""
import sys
import operator
import io
import time
import pkg_resources
import pmxbot.core
from pmxbot.core import command, Handler
@command("help", aliases=('h',), doc="Help (this command)")
def help(client, event, channel, nick, rest):
rs = rest.strip()
if rs:
# give help for matching co... | bsd-3-clause | Python |
37f3994f867e0bca81aee99e24a370de1ce420ef | Convert every topic to lower case before creating or getting. | luciferous/edrop,luciferous/edrop | edrop.py | edrop.py | #!/usr/bin/env python
from google.appengine.api import memcache
from google.appengine.api import users
from models import *
import re
import time
import math
import datetime
DAY_SCALE = 4
LOCAL_EPOCH = datetime.datetime(2009, 7, 12)
def extract_tweets(batch):
dec = decoder.JSONDecoder()
feed = dec.decode(batch... | #!/usr/bin/env python
from google.appengine.api import memcache
from google.appengine.api import users
from models import *
import re
import time
import math
import datetime
DAY_SCALE = 4
LOCAL_EPOCH = datetime.datetime(2009, 7, 12)
def extract_tweets(batch):
dec = decoder.JSONDecoder()
feed = dec.decode(batch... | bsd-3-clause | Python |
a82979e20186a8ddfd31b935bb9ff33400561b6e | Add basic tests for cooper world. | EmbodiedCognition/pagoda,EmbodiedCognition/pagoda | test/cooper_test.py | test/cooper_test.py | import pagoda.cooper
def fn(s):
return 'examples/cooper-{}'.format(s)
class Base(object):
def setUp(self):
self.world = pagoda.cooper.World()
class TestMarkers(Base):
def setUp(self):
super(TestMarkers, self).setUp()
self.markers = pagoda.cooper.Markers(self.world)
def tes... | import pagoda.cooper
class Base(object):
def setUp(self):
self.world = pagoda.cooper.World()
class TestMarkers(Base):
def setUp(self):
super(TestMarkers, self).setUp()
self.markers = pagoda.cooper.Markers(self.world)
def test_c3d(self):
self.markers.load_c3d('examples/co... | mit | Python |
a6e14ac538a40fd98db16a98938acfb6a811dc06 | Fix production ID and run command without sudo | prontotools/zendesk-tickets-machine,prontotools/zendesk-tickets-machine,prontotools/zendesk-tickets-machine,prontotools/zendesk-tickets-machine | fabfile.py | fabfile.py | from fabric.api import (
cd,
env,
put,
run,
sudo,
task
)
PRODUCTION_IP = '54.154.235.243'
PROJECT_DIRECTORY = '/home/ubuntu/ztm/'
COMPOSE_FILE = 'compose-production.yml'
@task
def production():
env.run = sudo
env.hosts = [
'ubuntu@' + PRODUCTION_IP + ':22',
]
def create... | from fabric.api import (
cd,
env,
put,
sudo,
task
)
PRODUCTION_IP = ''
PROJECT_DIRECTORY = '/home/ubuntu/ztm/'
COMPOSE_FILE = 'compose-production.yml'
@task
def production():
env.run = sudo
env.hosts = [
'ubuntu@' + PRODUCTION_IP + ':22',
]
def create_project_directory():
... | mit | Python |
cda38daafe58a438d629f00b3c17daf1bdedf3ba | update counters on beta deploy (fix) | fnp/wolnelektury,fnp/wolnelektury,fnp/wolnelektury,fnp/wolnelektury | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
from fnpdeploy import *
try:
from fabfile_local import *
except ImportError:
pass
env.project_name = 'wolnelektury'
@task
def production():
env.hosts = ['giewont.icm.edu.pl']
env.user = 'lektury'
env.app_path = '/srv/wolnelektury.pl'
env.django_root_path = 'src'
... | from fnpdeploy import *
from catalogue.helpers import update_counters
try:
from fabfile_local import *
except ImportError:
pass
env.project_name = 'wolnelektury'
@task
def production():
env.hosts = ['giewont.icm.edu.pl']
env.user = 'lektury'
env.app_path = '/srv/wolnelektury.pl'
env.django... | agpl-3.0 | Python |
e04fcb370813d40c5ea0a4b105e8b05383487222 | Deploy frontend too | RollingBalls/rollingballs-server | fabfile.py | fabfile.py | from fabric.api import local, cd, put, env, shell_env, run
from fabric.context_managers import lcd
from fabric.contrib.project import rsync_project
env.use_ssh_config = True
env.hosts = ['root@server.artquest.ninja']
def deploy(what='all'):
with shell_env(GOOS="linux", GOARCH="amd64"):
local('godep go bu... | from fabric.api import local, cd, put, env, shell_env, run
env.use_ssh_config = True
env.hosts = ['root@server.artquest.ninja']
def deploy(what='all'):
with shell_env(GOOS="linux", GOARCH="amd64"):
local('godep go build')
with cd('/srv/artquest'):
run("stop artquest")
put('rollingbal... | mit | Python |
43ebf3d16858ef37b1163aa917d72fc4660e674d | Add debug output for highstate command | zheli/dev-environment,zheli/dev-environment | fabfile.py | fabfile.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from fabric.api import parallel, run
from fabric.contrib.files import append
from fabric.operations import sudo, put
@parallel
def install_curl():
'''
Installs curl
'''
sudo("apt-get -y install curl")
@parallel
def apt_update():
'''
Ru... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from fabric.api import parallel, run
from fabric.contrib.files import append
from fabric.operations import sudo, put
@parallel
def install_curl():
'''
Installs curl
'''
sudo("apt-get -y install curl")
@parallel
def apt_update():
'''
Ru... | apache-2.0 | Python |
d42c4b360ad820d3f4e32fd0337e2d3813f82850 | Fix error message | datamicroscopes/release,jzf2101/release,datamicroscopes/release,jzf2101/release | fabfile.py | fabfile.py | import sys
import sh
import yaml
from fabric import api as fab
TRAVIS_YAML = 'travis.yml'
WARNING = """
#############################################################
# WARNING: .travis.yml is automatically generated by fabric.
# Please modify travis.yml if you want your changes to stick.
#############################... | import sys
import sh
import yaml
from fabric import api as fab
TRAVIS_YAML = 'travis.yml'
WARNING = """
#############################################################
# WARNING: .travis.yml is automatically generated by fabric.
# Please modify travis.yml if you want your changes to stick.
#############################... | bsd-3-clause | Python |
f6172f3906e231e1a7258e7134459ba2a99076ce | update i18n helpers | davidfischer/readthedocs.org,rtfd/readthedocs.org,davidfischer/readthedocs.org,davidfischer/readthedocs.org,rtfd/readthedocs.org,davidfischer/readthedocs.org,safwanrahman/readthedocs.org,rtfd/readthedocs.org,safwanrahman/readthedocs.org,safwanrahman/readthedocs.org,safwanrahman/readthedocs.org,rtfd/readthedocs.org | fabfile.py | fabfile.py | from fabric.api import lcd, local
from fabric.decorators import runs_once
import os
fabfile_dir = os.path.dirname(__file__)
def i18n_push_source():
"""rebuild and push the source language to transifex"""
with lcd('readthedocs'):
local('rm -rf rtd_tests/tests/builds/')
local('django-admin mak... | from fabric.api import lcd, local
from fabric.decorators import runs_once
import os
fabfile_dir = os.path.dirname(__file__)
def i18n():
with lcd('readthedocs'):
local('rm -rf rtd_tests/tests/builds/')
local('tx pull')
local('django-admin makemessages --all')
local('tx push -s')
... | mit | Python |
2b2603bc8653b76cff1f1ffdaf7d535fdd86fc94 | update fabfile | alexpap/tpch-kit,alexpap/tpch-kit,alexpap/tpch-kit,alexpap/tpch-kit | fabfile.py | fabfile.py | from fabric.api import env, run, cd
tables_options = {
'lineitem' : 'L',
'customers' : 'c',
'nation' : 'n',
'orders' : 'O',
'parts' : 'P',
'region' : 'r',
'suppliers' : 's',
'partsupp' : 'S'
}
def dbgen(sf=1, table=" "):
if not table:
table = "-T {tbl_opt}".format(tbl_opt=ta... | from fabric.api import env, run, cd
tables_options = {
'lineitem' : 'L',
'customers' : 'c',
'nation' : 'n',
'orders' : 'O',
'parts' : 'P',
'region' : 'r',
'suppliers' : 's',
'partsupp' : 'S'
}
def dbgen(sf=1, table=" "):
if not table:
table = "-T {tbl_opt}".format(tbl_opt=ta... | mit | Python |
56d90cdce8ee7893f18a0036b20905b0d311f281 | automate site builds | sokolowskik/sokolowskik.github.io,kamiljsokolowski/kamiljsokolowski.github.io,sokolowskik/sokolowskik.github.io,kamiljsokolowski/kamiljsokolowski.github.io,sokolowskik/sokolowskik.github.io,sokolowskik/sokolowskik.github.io,kamiljsokolowski/kamiljsokolowski.github.io,kamiljsokolowski/kamiljsokolowski.github.io | fabfile.py | fabfile.py | from fabric.api import env, local, run, cd
code_dir = '/vagrant'
def vagrant():
env.user = 'vagrant'
env.hosts = ['127.0.0.1:2222']
result = local('vagrant ssh-config |grep IdentityFile', capture=True)
env.key_filename = result.split()[1]
def build(release="stable"):
run('rvm gemset use blog-%s' ... | from fabric.api import env, local
def vagrant():
env.user = 'vagrant'
env.hosts = ['127.0.0.1:2222']
result = local('vagrant ssh-config |grep IdentityFile', capture=True)
env.key_filename = result.split()[1]
| mit | Python |
a3159985cd61be80e74ef87e7b1b202d5d06baa2 | Fix deploy_dir | svenstaro/cv | fabfile.py | fabfile.py | from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
env.hosts = ["apoc"]
env.use_ssh_config = True
env.colorize_errors = True
def deploy():
code_dir = "/home/svenstaro/prj/cv"
deploy_dir = "/srv/http/pub/customalized.org/"
# clone/pull using keybearer... | from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
env.hosts = ["apoc"]
env.use_ssh_config = True
env.colorize_errors = True
def deploy():
code_dir = "/home/svenstaro/prj/cv"
deploy_dir = "/srv/http/customalized.org/"
# clone/pull using keybearer fir... | mit | Python |
b4c3995f13021a33e8a16b671c836a68e093b032 | Fix import in fabfile. | prateeknitish391/demo,petemaclellan/openxc-android,prateeknitish391/demo,mray19027/openxc-android,dhootha/openxc-android,mray19027/openxc-android,ChernyshovYuriy/openxc-android,prateeknitish391/demo,petemaclellan/openxc-android,openxc/openxc-android,msowka/openxc-android,openxc/openxc-android,dhootha/openxc-android,Che... | fabfile.py | fabfile.py | #!/usr/bin/env python
import os
import boto.s3.key
import boto.s3.connection
from fabric.api import *
from fabric.colors import green
env.aws_access_key = os.environ['AWS_ACCESS_KEY_ID']
env.aws_secret_key = os.environ['AWS_SECRET_ACCESS_KEY']
env.s3_bucket = "openxcplatform.com"
env.root_dir = os.path.abspath(os.pa... | #!/usr/bin/env python
import os
import boto.s3.key
import boto.s3.connection
from fabric.api import *
env.aws_access_key = os.environ['AWS_ACCESS_KEY_ID']
env.aws_secret_key = os.environ['AWS_SECRET_ACCESS_KEY']
env.s3_bucket = "openxcplatform.com"
env.root_dir = os.path.abspath(os.path.dirname(__file__))
env.releas... | bsd-3-clause | Python |
82bd8ced41e2aa4a5f0ca9384c902f7e36fd1005 | Update deployment process to use frozen requirements. | coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am | fabfile.py | fabfile.py | import os
from fabric.api import task, run, local, sudo, cd, env
env.hosts = [
os.environ['TWWEB_HOST'],
]
def virtualenv(command, user=None):
run('source /var/www/envs/twweb/bin/activate && ' + command)
@task
def deploy():
local('git push origin development')
local('git checkout master')
loc... | import os
from fabric.api import task, run, local, sudo, cd, env
env.hosts = [
os.environ['TWWEB_HOST'],
]
def virtualenv(command, user=None):
run('source /var/www/envs/twweb/bin/activate && ' + command)
@task
def deploy():
local('git push origin development')
local('git checkout master')
loc... | agpl-3.0 | Python |
f5143ccb206e5b077f0a80c88555e57064b6acab | Add fab commands to push and pull | kalail/queen,kalail/queen | fabfile.py | fabfile.py | from fabric.api import *
env.hosts = [
'192.168.1.144'
]
env.user = 'pi'
def prepare_raspberry_pi():
pass
def remote_pull():
with cd('virtualenvs/queen/queen'):
run('git pull')
def commit():
local('git commit -a')
def push():
local('git push origin')
def deploy():
commit()
push()
remote_pull()
| from fabric.api import *
env.hosts = [
'192.168.1.144'
]
env.user = 'pi'
def prepare_raspberry_pi():
pass
def remote_pull():
with cd('virtualenvs/queen/queen'):
run('git pull')
def deploy():
local('git commit -a')
local('git push origin')
remote_pull()
| mit | Python |
be1fa4b7f0372ca35526fafbae06dd706f969ec5 | bump to 1.0.0-rc1 | kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,0x... | ooni/__init__.py | ooni/__init__.py | # -*- encoding: utf-8 -*-
__author__ = "Arturo Filastò"
__version__ = "1.0.0-rc1"
__all__ = ['config', 'inputunit', 'kit',
'lib', 'nettest', 'oonicli', 'reporter',
'templates', 'utils']
| # -*- encoding: utf-8 -*-
__author__ = "Arturo Filastò"
__version__ = "0.0.12"
__all__ = ['config', 'inputunit', 'kit',
'lib', 'nettest', 'oonicli', 'reporter',
'templates', 'utils']
| bsd-2-clause | Python |
e44ec91bf4540909a1987760b56b49c914cb511c | add old test | yeastgenome/SGDFrontend,yeastgenome/SGDFrontend,yeastgenome/SGDFrontend,yeastgenome/SGDFrontend | test/search_test.py | test/search_test.py | import unittest
from pyramid import testing
def get_response_with_query(query):
from src.sgd.frontend.yeastgenome.views.misc_views import search
req = testing.DummyRequest(params={ 'q': query, 'is_quick': 'true' })
req.query_string = 'q=' + query + '&is_quick=true'
res = search(req)
return res
cla... | import unittest
from pyramid import testing
def get_response_with_query(query):
from src.sgd.frontend.yeastgenome.views.misc_views import search
req = testing.DummyRequest(params={ 'q': query, 'is_quick': 'true' })
req.query_string = 'q=' + query + '&is_quick=true'
res = search(req)
return res
cla... | mit | Python |
55db3d111403f3f95f51dc9a35f1f7a881f18f04 | support test/test_django.py shell | emory-libraries/eulcore-history,emory-libraries/eulcore-history | test/test_django.py | test/test_django.py | #!/usr/bin/env python
import sys
from django.core.management import setup_environ
def run_django_tests(argv=None, extras=[]):
# this code inlined (with simplifications) from relevant manage.py code
argv = argv or sys.argv[:]
# 0 is script name (is this always true?)
test_apps = argv[1:] #... | #!/usr/bin/env python
import sys
from django.core.management import setup_environ
def setup_test_environ():
from django_tester import settings
setup_environ(settings)
def run_django_tests(argv=None, extras=[]):
# this code inlined (with simplifications) from relevant manage.py code
argv = argv o... | apache-2.0 | Python |
6743111094f25832e47cac0b26900cf08b8e6aa3 | Add first template strings | Moredread/taz-digiabo-linkgen | digiabo.py | digiabo.py | """
Taz digiabo download link generator
Usage: digiabo.py [-d N | --days N]
Options:
-d N --days N number of days in the past to generate download links for [default: 1]
"""
from datetime import date, timedelta
from docopt import docopt
templates = [
"https://dl.taz.de/abo/taz_{}_{:0=2}_{:0=2}.epub",
"... | """
Taz digiabo download link generator
Usage: digiabo.py [-d N | --days N]
Options:
-d N --days N number of days in the past to generate download links for [default: 1]
"""
from datetime import date, datetime, timedelta
from docopt import docopt
def generate_past_dates(d, from_date=None):
"""
Generat... | bsd-2-clause | Python |
d8db2744d45e4478b8a2c9a5f0fa76cda33c9964 | Use the correct "name" for Jinja2 instrumentation. | ticosax/opbeat_python,beniwohli/apm-agent-python,dirtycoder/opbeat_python,beniwohli/apm-agent-python,patrys/opbeat_python,beniwohli/apm-agent-python,ticosax/opbeat_python,dirtycoder/opbeat_python,ticosax/opbeat_python,patrys/opbeat_python,tarkatronic/opbeat_python,tarkatronic/opbeat_python,patrys/opbeat_python,daikeren... | opbeat/instrumentation/packages/jinja2.py | opbeat/instrumentation/packages/jinja2.py | from opbeat.instrumentation.packages.base import AbstractInstrumentedModule
class Jinja2Instrumentation(AbstractInstrumentedModule):
name = 'jinja2'
instrument_list = [
("jinja2", "Template.render"),
]
def call(self, module, method, wrapped, instance, args, kwargs):
signature = insta... | from opbeat.instrumentation.packages.base import AbstractInstrumentedModule
class Jinja2Instrumentation(AbstractInstrumentedModule):
name = 'pylibmc'
instrument_list = [
("jinja2", "Template.render"),
]
def call(self, module, method, wrapped, instance, args, kwargs):
signature = inst... | bsd-3-clause | Python |
8b3132f9aec26d71498a153a29ea8d2049f07da6 | Add applications to study groups | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | studygroups/admin.py | studygroups/admin.py | from django.contrib import admin
# Register your models here.
from studygroups.models import Course, StudyGroup, StudyGroupSignup, Application
class StudyGroupSignupInline(admin.TabularInline):
model = StudyGroupSignup
class ApplicationInline(admin.TabularInline):
model = Application.study_groups.through
... | from django.contrib import admin
# Register your models here.
from studygroups.models import Course, StudyGroup, StudyGroupSignup, Application
class CourseAdmin(admin.ModelAdmin):
pass
class StudyGroupSignupInline(admin.TabularInline):
model = StudyGroupSignup
class StudyGroupAdmin(admin.ModelAdmin):
in... | mit | Python |
2653550334706250a0d9bb8f49baf231fbda1c88 | Enable specifying actions to generate_playthrough. | deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel | open_spiel/python/examples/playthrough.py | open_spiel/python/examples/playthrough.py | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... | apache-2.0 | Python |
b935be31ed20dd7f0ee5d58e67653a3c425494b0 | Fix configuration checks | django-admin-tools/django-admin-tools,glowka/django-admin-tools,glowka/django-admin-tools,eternalfame/django-admin-tools,glowka/django-admin-tools,django-admin-tools/django-admin-tools,eternalfame/django-admin-tools,eternalfame/django-admin-tools,django-admin-tools/django-admin-tools | admin_tools/__init__.py | admin_tools/__init__.py | """
django-admin-tools is a collection of extensions/tools for the default django
administration interface, it includes:
* a full featured and customizable dashboard,
* a customizable menu bar,
* tools to make admin theming easier.
"""
VERSION = '0.6.0'
def check_configuration():
"""
Perform some configu... | """
django-admin-tools is a collection of extensions/tools for the default django
administration interface, it includes:
* a full featured and customizable dashboard,
* a customizable menu bar,
* tools to make admin theming easier.
"""
VERSION = '0.6.0'
from django.conf import settings
from django.core.exceptions... | mit | Python |
b0719311865867638f41eb83f162ae7e466e0d31 | add doc strings to softmax bandit | okkhoy/minecraft-rl | agents/SoftmaxBandit.py | agents/SoftmaxBandit.py | """
Created on May 7, 2017
@author: Akshay Narayan
This code is shared under The MIT License
-----------------------------------------
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated document... | """
Created on May 7, 2017
@author: Akshay Narayan
This code is shared under The MIT License
-----------------------------------------
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated document... | mit | Python |
c036ea60aa7fd18936250d9976efdf925f1f5134 | modify 032 | ufjfeng/leetcode-jf-soln,ufjfeng/leetcode-jf-soln | python/032_longest_valid_parentheses.py | python/032_longest_valid_parentheses.py | """
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()", which has length = 2.
Another example is ")()())", where the longest valid parentheses substring is "()()", which has len... | """
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()", which has length = 2.
Another example is ")()())", where the longest valid parentheses substring is "()()", which has len... | mit | Python |
e5718e372b537357663f2316ea93a07473443766 | load google fonts over https. Fixes frappe/erpnext#5049 | tmimori/frappe,bohlian/frappe,maxtorete/frappe,tmimori/frappe,StrellaGroup/frappe,yashodhank/frappe,elba7r/frameworking,bcornwellmott/frappe,mbauskar/frappe,ESS-LLP/frappe,maxtorete/frappe,frappe/frappe,bcornwellmott/frappe,mhbu50/frappe,drukhil/frappe,elba7r/builder,yashodhank/frappe,adityahase/frappe,manassolanki/fra... | frappe/templates/pages/website_theme.py | frappe/templates/pages/website_theme.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import re
import frappe
from frappe.website.utils import get_shade
from frappe.website.doctype.website_theme.website_theme import get_active_theme
no_sitemap = 1
base_template_pa... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import re
import frappe
from frappe.website.utils import get_shade
from frappe.website.doctype.website_theme.website_theme import get_active_theme
no_sitemap = 1
base_template_pa... | mit | Python |
81ac15e6c1d75041fc8e1ba18f2579203c456c05 | bump to version 0.9.13b4 | PaloAltoNetworks/minemeld-core,PaloAltoNetworks/minemeld-core,PaloAltoNetworks/minemeld-core | minemeld/__init__.py | minemeld/__init__.py | """
minemeld
========
MineMeld core engine
"""
__version__ = '0.9.13b4'
| """
minemeld
========
MineMeld core engine
"""
__version__ = '0.9.13b3'
| apache-2.0 | Python |
e137af94b762b0f9b3563f93cb54647f30ed6454 | Add docs | juliakreutzer/bandit-neuralmonkey,bastings/neuralmonkey,bastings/neuralmonkey,ufal/neuralmonkey,juliakreutzer/bandit-neuralmonkey,ufal/neuralmonkey,bastings/neuralmonkey,juliakreutzer/bandit-neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey,bastings/neuralmonkey,juliakreutzer/bandit-neuralmonkey,juliakreutzer/bandit-neu... | neuralmonkey/processors/alignment.py | neuralmonkey/processors/alignment.py | import re
from typing import List
import numpy as np
# tests: mypy
# pylint: disable=too-few-public-methods
ID_SEP = re.compile(r"[-:]")
class WordAlignmentPreprocessor(object):
"""A preprocessor for word alignments in a text format.
One of the following formats is expected:
s1-t1 s2-t2 ...
... | import re
from typing import List
import numpy as np
# tests: mypy
# pylint: disable=too-few-public-methods
ID_SEP = re.compile(r"[-:]")
class WordAlignmentPreprocessor(object):
def __init__(self, source_len, target_len, dtype=np.float32,
normalize=True, zero_based=True):
self._source_... | bsd-3-clause | Python |
e65b7f8ebfe62feb95205e5fc4da559e4eabe88d | make importlib_importer recognize .pyc cache (#13239) | LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack | lib/spack/spack/util/imp/importlib_importer.py | lib/spack/spack/util/imp/importlib_importer.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)
"""Implementation of Spack imports that uses importlib underneath.
``importlib`` is only fully implemented in Python 3.
"... | # 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)
"""Implementation of Spack imports that uses importlib underneath.
``importlib`` is only fully implemented in Python 3.
"... | lgpl-2.1 | Python |
7715f74271818a483df7f25a8bed90aa47480711 | Use django cache instead of global variable to fix issue from Django 1.6 | stored/django-celery-transactions,roverdotcom/django-celery-transactions,fellowshipofone/django-celery-transactions | tests/test/tests.py | tests/test/tests.py | import django, os
from djcelery_transactions import task
from django.test import TransactionTestCase
if django.VERSION < (1,7):
from django.core.cache import cache
else:
from django.core.cache import caches
cache = caches['tests']
if django.VERSION > (1,6):
from django.db.transaction import atomic
else... | import django, os
from djcelery_transactions import task
from django.test import TransactionTestCase
if django.VERSION > (1,6):
from django.db.transaction import atomic
else:
from django.db import transaction
atomic = transaction.commit_on_success
my_global = []
marker = object()
@task
def my_task():
... | bsd-2-clause | Python |
42e17593dd9fdbeac02f2b71beebae3b1a7f94c8 | Add hack experiment for issues and labels | willingc/openhatch-issues,willingc/openhatch-issues | openhatch-issues/openhatch-issues.py | openhatch-issues/openhatch-issues.py | # -*- coding: utf-8 -*-
from github3 import login
mytoken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
gh = login('xxxxx', token=mytoken)
user = gh.user()
print(user.name)
print(user.login)
print(user.followers)
for f in gh.iter_followers():
print(str(f))
print(gh.zen())
issue = gh.issue('openhatch', 'oh-main... | # -*- coding: utf-8 -*-
from github3 import login
mytoken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
gh = login('xxxxx', token=mytoken)
user = gh.user()
print(user.name)
print(user.login)
print(user.followers)
for f in gh.iter_followers():
print(str(f))
print(gh.zen())
| bsd-3-clause | Python |
3d7f9f19b753adfd17ce3852e7c927f25daa18ec | Expand parser test_empty. | probcomp/bayeslite,probcomp/bayeslite | tests/test_parse.py | tests/test_parse.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2014, MIT Probabilistic Computing Project
#
# 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/LICENS... | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2014, MIT Probabilistic Computing Project
#
# 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/LICENS... | apache-2.0 | Python |
9c7b1428832a013040b63b903b7e8a886cb93ad8 | add test for phony targets | dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol,dataversioncontrol/dvc,efiop/dvc,efiop/dvc,dataversioncontrol/dvc | tests/test_repro.py | tests/test_repro.py | import os
import stat
import shutil
import filecmp
from tests.basic_env import TestDvc
class TestRepro(TestDvc):
def setUp(self):
super(TestRepro, self).setUp()
self.dvc.add(self.FOO)
self.file1 = 'file1'
self.file1_stage = self.file1 + '.dvc'
self.dvc.run(fname=self.file... | import os
import stat
import shutil
import filecmp
from tests.basic_env import TestDvc
class TestRepro(TestDvc):
def setUp(self):
super(TestRepro, self).setUp()
self.dvc.add(self.FOO)
self.file1 = 'file1'
self.file1_stage = self.file1 + '.dvc'
self.dvc.run(fname=self.file... | apache-2.0 | Python |
d4a62e256a2bd5c661252b713dcf647084359396 | format test_spell.py | PyThaiNLP/pythainlp | tests/test_spell.py | tests/test_spell.py | # -*- coding: utf-8 -*-
import datetime
import os
import sys
import unittest
from pythainlp.spell import NorvigSpellChecker, correct, spell
class TestSpellPackage(unittest.TestCase):
def test_spell(self):
self.assertEqual(spell(None), [""])
self.assertEqual(spell(""), [""])
result = sp... | # -*- coding: utf-8 -*-
import datetime
import os
import sys
import unittest
from pythainlp.spell import NorvigSpellChecker, correct, spell
class TestSpellPackage(unittest.TestCase):
def test_spell(self):
self.assertEqual(spell(None), [""])
self.assertEqual(spell(""), [""])
result = sp... | apache-2.0 | Python |
53081341a565fdb6dd5ae0a49b75b7a258e581cc | fix tests | sibson/ghinbox | tests/test_tasks.py | tests/test_tasks.py | from mock import patch
from ghinbox import app, tasks
from basecase import GHInboxTestCase
class CreateIssueTestCase(GHInboxTestCase):
@patch('ghinbox.tasks.login')
def test_create_issue(self, login):
tasks.create_issue('test subject', 'test body')
login.assert_called_with('testuser', 'te... | from mock import patch
from ghinbox import app, actions
from basecase import GHInboxTestCase
class CreateIssueTestCase(GHInboxTestCase):
@patch('ghinbox.actions.login')
def test_create_issue(self, login):
actions.create_issue('test subject', 'test body')
login.assert_called_with('testuser... | mit | Python |
1d621aedec9f83811830082f1dc4bd4c75e48be3 | make itertree() more compact with enumerate | xflr6/graphviz | tests/test_tools.py | tests/test_tools.py | # test_tools.py
import os
import functools
import pytest
from graphviz.tools import mkdirs
def itertree(root):
for path, dirs, files in os.walk(root):
base = os.path.relpath(path, root)
rel_path = functools.partial(os.path.join, base if base != '.' else '')
for is_file, names in enumera... | # test_tools.py
import os
import functools
import pytest
from graphviz.tools import mkdirs
def itertree(root):
for path, dirs, files in os.walk(root):
base = os.path.relpath(path, root)
rel_path = functools.partial(os.path.join, base if base != '.' else '')
for is_file, names in [(False... | mit | Python |
23dbe159fb4a6d5f745d3abfb6ee48ea5c27f49c | Refactor `test_isolate_method` | incuna/incuna-test-utils,incuna/incuna-test-utils | tests/test_utils.py | tests/test_utils.py | from incuna_test_utils import utils
class Parent:
def method(self):
return {'foo'}
class Mixin:
def method(self):
data = super().method()
data.add('bar')
return data
class Child(Mixin, Parent):
pass
def test_next_mro_class():
assert utils.next_mro_class(Child, Mix... | from incuna_test_utils import utils
class Parent:
def method(self):
return {'foo'}
class Mixin:
def method(self):
data = super().method()
data.add('bar')
return data
class Child(Mixin, Parent):
pass
def test_next_mro_class():
assert utils.next_mro_class(Child, Mix... | bsd-2-clause | Python |
daf29f52c01d83619585a1f2fa2e6f03a397e1cc | Fix test_writable_stream failing in Python 3.3 and 3.4 | althonos/fs.archive | tests/test_utils.py | tests/test_utils.py | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import os
import unittest
import tempfile
try:
from unittest import mock
except ImportError:
import mock
from fs.archive import _utils
class TestUtils(unittest.TestCase):
@unittest.skipUnless(os.na... | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import os
import unittest
import tempfile
try:
from unittest import mock
except ImportError:
import mock
from fs.archive import _utils
class TestUtils(unittest.TestCase):
@unittest.skipUnless(os.na... | mit | Python |
3a5dc4332e7f13119563e2190e6ef7d66b464054 | Add knot vector normalization test | orbingol/NURBS-Python,orbingol/NURBS-Python | tests/test_utils.py | tests/test_utils.py | """
Tests for the NURBS-Python package
Released under The MIT License. See LICENSE file for details.
Copyright (c) 2018 Onur Rauf Bingol
Tests geomdl.utilities module. Requires "pytest" to run.
"""
from geomdl import utilities
def test_autogen_knot_vector():
degree = 4
num_ctrlpts = 12
au... | """
Tests for the NURBS-Python package
Released under The MIT License. See LICENSE file for details.
Copyright (c) 2018 Onur Rauf Bingol
Tests geomdl.utilities module. Requires "pytest" to run.
"""
from geomdl import utilities
def test_autogen_knotvector():
degree = 4
num_ctrlpts = 12
aut... | mit | Python |
17b2a6fa84aeab120c2310fa532ceb8d7a638db5 | Fix import in test_utils.py | Lodifice/mfnf-pdf-export,Lodifice/mfnf-pdf-export,Lodifice/mfnf-pdf-export | tests/test_utils.py | tests/test_utils.py | from unittest import TestCase
from mfnf.utils import add_dict, lookup, remove_prefix
class TestUtilsFunctions(TestCase):
def test_remove_prefix(self):
self.assertEqual(remove_prefix("aa", "a"), "a")
self.assertEqual(remove_prefix("aa", ""), "aa")
self.assertEqual(remove_prefix("aa", "aaa")... | from unittest import TestCase
from parser.utils import add_dict, lookup, remove_prefix
class TestUtilsFunctions(TestCase):
def test_remove_prefix(self):
self.assertEqual(remove_prefix("aa", "a"), "a")
self.assertEqual(remove_prefix("aa", ""), "aa")
self.assertEqual(remove_prefix("aa", "aaa... | apache-2.0 | Python |
d2d1e26a029a5a3724704487aab56a31322d0b58 | use absolute-path | igortg/staged-recipes,ReimarBauer/staged-recipes,scopatz/staged-recipes,igortg/staged-recipes,chrisburr/staged-recipes,jochym/staged-recipes,jochym/staged-recipes,scopatz/staged-recipes,conda-forge/staged-recipes,ReimarBauer/staged-recipes,kwilcox/staged-recipes,SylvainCorlay/staged-recipes,hadim/staged-recipes,kwilcox... | recipes/appimage-updater-bridge/test.py | recipes/appimage-updater-bridge/test.py | import sys
import os
from PySide2 import QtCore
loader = QtCore.QPluginLoader()
loader.setFileName("{}/plugins/libAppImageUpdaterBridge.so".format(os.environ["PREFIX"]))
loaded = loader.load()
print("plugin loaded: {}".format(loaded))
if not loaded:
sys.exit(1)
| import sys
from PySide2 import QtCore
loader = QtCore.QPluginLoader()
loader.setFileName("libAppImageUpdaterBridge")
loaded = loader.load()
print("plugin loaded: {}".format(loaded))
if not loaded:
sys.exit(1) | bsd-3-clause | Python |
f87d2c1df7e4c0e41a4570f6122863b68ee02ab0 | Fix incorrect return code for 'update-wpt' mach command | anthgur/servo,rnestler/servo,nnethercote/servo,splav/servo,ConnorGBrewster/servo,SimonSapin/servo,mbrubeck/servo,fiji-flo/servo,sadmansk/servo,cbrewster/servo,szeged/servo,cbrewster/servo,CJ8664/servo,splav/servo,notriddle/servo,paulrouget/servo,dati91/servo,canaltinova/servo,anthgur/servo,KiChjang/servo,anthgur/servo,... | tests/wpt/update.py | tests/wpt/update.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
from wptrunner import wptcommandline
here = os.path.split(__file__)[0]
def wpt_path(*args):
... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
from wptrunner import wptcommandline
here = os.path.split(__file__)[0]
def wpt_path(*args):
... | mpl-2.0 | Python |
c07e2f6131e002a06ccde36dac757225ccc680b7 | delete all files created during each test | vperron/django-storages,vperron/django-storages | storages/tests/s3boto.py | storages/tests/s3boto.py | from django.test import TestCase
from django.core.files.base import ContentFile
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from uuid import uuid4
import os
from storages.backends.s3boto import S3BotoStorage
class S3BotoStorageTests(TestCase):
def setUp(self):
... | from django.test import TestCase
from django.core.files.base import ContentFile
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from uuid import uuid4
import os
from storages.backends.s3boto import S3BotoStorage
class S3BotoStorageTests(TestCase):
def setUp(self)... | bsd-3-clause | Python |
5d8c1f6fd62230f967a7df6915178ebbd5b807a8 | Fix GUI dumbness of matplotlib on headless server? | liffiton/ATLeS,liffiton/ATLeS,liffiton/ATLeS,liffiton/ATLeS | fishweb.py | fishweb.py | from bottle import post, redirect, request, route, run, static_file, view
import glob
# Import matplotlib ourselves and make it use agg (not any GUI anything)
# before the analyze module pulls it in.
import matplotlib
matplotlib.use('Agg')
import analyze
@route('/')
@view('index')
def index():
tracks = glob.glo... | from bottle import post, redirect, request, route, run, static_file, view
import glob
import analyze
@route('/')
@view('index')
def index():
tracks = glob.glob("logs/*-track.csv")
img_counts = []
for track in tracks:
name = track.split('/')[-1]
imgs = glob.glob("logs/img/%s*" % name)
... | mit | Python |
a2bdc710bd4076f677d6e270247bfc9aae06e281 | Make prepare method private | Ghostkeeper/Luna | plugins/configuration/preferences/preferences.py | plugins/configuration/preferences/preferences.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | cc0-1.0 | Python |
d18f595b771ce68730cc5fea099f57dda6690157 | Use M-Lab project number for BigQuery access. | opentechinstitute/piecewise,critzo/piecewise,critzo/piecewise,opentechinstitute/piecewise,opentechinstitute/piecewise,opentechinstitute/piecewise,critzo/piecewise,critzo/piecewise | piecewise/piecewise/bigquery.py | piecewise/piecewise/bigquery.py | import httplib2
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client import tools
import os
PROJECT_NUMBER = '233384409938'
PARENT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRETS_FILE = os.path.... | import httplib2
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client import tools
import os
PROJECT_NUMBER = '422648324111'
PARENT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRETS_FILE = os.path.... | apache-2.0 | Python |
8326ca53d59c5fa0f165b78f8999957b6b62b257 | Update config.py | LiorAbitbol/vmwvro | vmwvro/config.py | vmwvro/config.py | """
Configuration parameters.
Copyright (c) 2017, Lior P. Abitbol <liorabitbol@gmail.com>
"""
#
# vRO Default TCP Port
#
VRO_TCP_PORT = 8281
#
# vRO URL templates
#
URL_GET_WORKFLOW_BY_ID = "{{base_url}}/vco/api/workflows/{{id}}"
URL_RUN_WORKFLOW_BY_ID = "{{base_url}}/vco/api/workflows/{{id}}/executio... | """
Configuration parameters.
Copyright (c) 2017, Lior P. Abitbol <liorabitbol@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation ... | mit | Python |
c8fa6d6cc86676aeff448d7091aa3d6cbd6b405b | Clarify documentation for SchemaAddition. | geggo/pyface,geggo/pyface,brett-patterson/pyface,enthought/traitsgui,pankajp/pyface | enthought/pyface/tasks/action/schema_addition.py | enthought/pyface/tasks/action/schema_addition.py | # Enthought library imports.
from enthought.traits.api import Callable, HasTraits, Str, Trait
class SchemaAddition(HasTraits):
""" An addition to an existing menu bar or tool bar schema.
"""
# The schema addition's identifier. This optional, but if left unspecified,
# other schema additions will be u... | # Enthought library imports.
from enthought.traits.api import Callable, HasTraits, Str, Trait
class SchemaAddition(HasTraits):
""" An addition to an existing menu bar or tool bar schema.
"""
# The schema addition's identifier. This optional, but if it is left
# unspecified, other schema additions wil... | bsd-3-clause | Python |
d5a81bcae489b0a23dd62a824f932f6ee26265d8 | update version | rssalessio/PythonVRFT | vrft/__init__.py | vrft/__init__.py | # Copyright [2017-2020] [Alessio Russo - alessior@kth.se]
# This file is part of PythonVRFT.
# PythonVRFT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
# PythonVRFT is distributed... | # Copyright [2017-2020] [Alessio Russo - alessior@kth.se]
# This file is part of PythonVRFT.
# PythonVRFT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
# PythonVRFT is distributed... | mit | Python |
08ce6d34b1b44a7e10af1944437a8c4dec4c90d1 | Use right source for lookups | twirrim/friendcheck | friends.py | friends.py | #!/usr/bin/env python
import twitter
import os.path
import sys
import ConfigParser
import cPickle
config = ConfigParser.RawConfigParser()
config.read("/path/to/friends.cfg")
conkey = config.get("twitter","consumer_key")
consec = config.get("twitter","consumer_secret")
accesstok = config.get("twitter","access_token")
... | #!/usr/bin/env python
import twitter
import os.path
import sys
import ConfigParser
import cPickle
config = ConfigParser.RawConfigParser()
config.read("/path/to/friends.cfg")
conkey = config.get("twitter","consumer_key")
consec = config.get("twitter","consumer_secret")
accesstok = config.get("twitter","access_token")
... | bsd-3-clause | Python |
bb5b18c7cb5c2d3e4a11762ff8c9c542bc639ad9 | use new config in test_server | PHLF/rasa_nlu,PHLF/rasa_nlu,RasaHQ/rasa_nlu,beeva-fernandocerezal/rasa_nlu,RasaHQ/rasa_nlu,verloop/rasa_nlu,RasaHQ/rasa_nlu,verloop/rasa_nlu,beeva-fernandocerezal/rasa_nlu | _pytest/test_server.py | _pytest/test_server.py | import pytest
import requests
import os
from rasa_nlu.server import RasaNLUServer
from rasa_nlu.config import RasaNLUConfig
from multiprocessing import Process
import time
import json
import codecs
@pytest.fixture
def http_server():
def url(port):
return "http://localhost:{0}".format(port)
# basic con... | import pytest
import requests
import os
from rasa_nlu.server import RasaNLUServer
from multiprocessing import Process
import time
import json
import codecs
@pytest.fixture
def http_server():
def url(port):
return "http://localhost:{0}".format(port)
# basic conf
config = {
'logfile': os.pat... | apache-2.0 | Python |
60a60ec981918d9baeae56e25552204ca52979b3 | Update render method to return a File object | benwilber/honcho-export-systemd | honcho_export_systemd/export_systemd.py | honcho_export_systemd/export_systemd.py | from itertools import groupby
from jinja2 import PackageLoader
from honcho.export.base import BaseExport
from honcho.export.base import dashrepl
from honcho.export.base import File
__all__ = ('Export',)
class Export(BaseExport):
def get_template_loader(self):
return PackageLoader(__name__, 'templates/sy... | from itertools import groupby
from jinja2 import PackageLoader
from honcho.export.base import BaseExport
from honcho.export.base import dashrepl
__all__ = ('Export',)
class Export(BaseExport):
def get_template_loader(self):
return PackageLoader(__name__, 'templates/systemd')
def render(self, proces... | apache-2.0 | Python |
eb5d16469de12c9c994e618987dfaa6947cf31ee | Update __init__.py | odb9402/OPPA,odb9402/OPPA,odb9402/OPPA,odb9402/OPPA | pfc/moe/optimal-learning/__init__.py | pfc/moe/optimal-learning/__init__.py | """moe_optimal_learning"""
## from https://github.com/Yelp/MOE
| """moe_optimal_learning"""
| mit | Python |
e0d70414a84679bab154c07140c3ca97533ffebc | add the imgs collection code for args input | weiy1991/face_recognition | gen_pic.py | gen_pic.py | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import face_recognition
import cv2
import csv
import numpy as np
from datetime import datetime
import os,sys
# Get a reference to webcam #0 (the default one)
video_capture = cv2.VideoCapture(0)
# Initialize some variables
face_locations =... | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import face_recognition
import cv2
import csv
import numpy as np
from datetime import datetime
# Get a reference to webcam #0 (the default one)
video_capture = cv2.VideoCapture(0)
# Load a sample picture and learn how to recognize it.
#fo... | mit | Python |
c307e388ac291f25977d1d0db3eb0d27d26e910e | fix issue #43 | grokzen/pykwalify | pykwalify/cli.py | pykwalify/cli.py | # -*- coding: utf-8 -*-
""" pyKwalify - cli.py """
# python std lib
import logging
import logging.config
import sys
# 3rd party imports
from docopt import docopt
def parse_cli():
"""
The outline of this function needs to be like this:
1. parse arguments
2. validate arguments only, dont go into oth... | # -*- coding: utf-8 -*-
""" pyKwalify - cli.py """
# python std lib
import logging
import logging.config
import sys
# 3rd party imports
from docopt import docopt
def parse_cli():
"""
The outline of this function needs to be like this:
1. parse arguments
2. validate arguments only, dont go into oth... | mit | Python |
dd9d1080c4b4bfa4c3fe8c4add0d90e94ce9c53b | Fix 'read_file' function | pylp/pylp | pylp/lib/file.py | pylp/lib/file.py | """
Store the contents of a file.
Copyright (C) 2017 The Pylp Authors.
This file is under the MIT License.
"""
import os
import asyncio
from concurrent.futures import ThreadPoolExecutor
from pylp.lib.transformer import Transformer
# Infinity value for file order
_inf = float('Inf')
def read_file(path):
"""Read... | """
Store the contents of a file.
Copyright (C) 2017 The Pylp Authors.
This file is under the MIT License.
"""
import os
import asyncio
from concurrent.futures import ThreadPoolExecutor
from pylp.lib.transformer import Transformer
# Infinity value for file order
_inf = float('Inf')
def read_file(self, path):
"... | mit | Python |
febaa6894e6a90dbbac7e4c8fbf93eccd8c089e8 | Update urls.py | yuge83/JobInfo,yuge83/JobInfo | jobProject/job/urls.py | jobProject/job/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
#/job/
url(r'^$', views.index, name='index'),
#/job/jobquery
url(r'jobquery/', views.jobquery, name = 'jobquery'),
#/job/jobsearch_result
url(r'jobsearch_result/',views.search_job, name='jobsearch_result'),
]
| from django.conf.urls import url
from . import views
urlpatterns = [
#/job/
url(r'^$', views.index, name='index'),
url(r'^jobquery/', views.jobquery, name='jobquery'),
]
| apache-2.0 | Python |
1a3b101ae9a93a543d1c89640fe095863dc8dbab | FIX adhoc setup repositories data | csrocha/account_check,csrocha/account_check | adhoc_base_setup/__openerp__.py | adhoc_base_setup/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': 'ADHOC Modules Configuration',
'version': '1.0',
'category': 'ADHOC Modules',
'summary': 'extra, addons, modules',
'description': """
ADHOC Modules Configuration
===============================================================================
Here, you can configure ... | # -*- coding: utf-8 -*-
{
'name': 'ADHOC Modules Configuration',
'version': '1.0',
'category': 'ADHOC Modules',
'summary': 'extra, addons, modules',
'description': """
ADHOC Modules Configuration
===============================================================================
Here, you can configure ... | agpl-3.0 | Python |
1b0a5ffc81fdbe4b7a6869507a068e881eb53a1e | Add in documentation | thomasyu888/synapsePythonClient | synapseutils/walk.py | synapseutils/walk.py | from synapseclient.entity import is_container
import os
def walk(syn, synId, includeTypes=["folder", "file", "table", "link", "entityview", "dockerrepo",
"submissionview", "dataset", "materializedview"]):
"""
Traverse through the hierarchy of files and folders stored under t... | from synapseclient.entity import is_container
import os
def walk(syn, synId, includeTypes=["folder", "file", "table", "link", "entityview", "dockerrepo"]):
"""
Traverse through the hierarchy of files and folders stored under the synId. Has the same behavior as os.walk()
:param syn: A synapse object: ... | apache-2.0 | Python |
606f0c1b11b1a349818d2001f3b9abfa5540f9f5 | increase timeout max 60 secs till cluster forms | jarpy/elasticsearch-docker,jarpy/elasticsearch-docker | tests/es_acceptance.py | tests/es_acceptance.py | import requests
from retrying import retry
from pytest import fixture
class DockerStackError(Exception):
pass
def cluster_health():
response = requests.get(
"http://elasticsearch:9200/_cluster/health").json()
return response
def query_all():
response = requests.get(
"http://elastic... | import requests
from retrying import retry
from pytest import fixture
class DockerStackError(Exception):
pass
def cluster_health():
response = requests.get(
"http://elasticsearch:9200/_cluster/health").json()
return response
def query_all():
response = requests.get(
"http://elastic... | apache-2.0 | Python |
0aa6f7522d5ff6c46c83285cd68c992201a1243e | add loop param to paco.interval() | h2non/paco | paco/interval.py | paco/interval.py | # -*- coding: utf-8 -*-
import asyncio
from .decorator import decorate
from .assertions import assert_corofunction
try:
ensure_future = asyncio.ensure_future
except:
ensure_future = getattr(asyncio, 'async')
@decorate
def interval(coro, interval=1, times=None, loop=None):
"""
Schedules the execution ... | # -*- coding: utf-8 -*-
import asyncio
from .decorator import decorate
from .assertions import assert_corofunction
try:
ensure_future = asyncio.ensure_future
except:
ensure_future = getattr(asyncio, 'async')
@decorate
def interval(coro, interval=1, times=None):
"""
Schedules the execution of a corout... | mit | Python |
2292a55e385c2c22ee4b0cf2e34fa4f5304b6241 | Fix GCS mirror typo | google/skia,google/skia,google/skia,google/skia,google/skia,google/skia,google/skia,google/skia,google/skia,google/skia | toolchain/utils.bzl | toolchain/utils.bzl | """This module provides the gcs_mirror_url macro."""
# Set to True to force the macro to only return the mirror URL.
_TEST_GCS_MIRROR = False
# Must be kept in sync with the suffixes supported by gcs_mirror (e.g.
# https://skia.googlesource.com/skia/+/8ad66c2340713234df6b249e793415233337a103/bazel/gcs_mirror/gcs_mirr... | """This module provides the gcs_mirror_url macro."""
# Set to True to force the macro to only return the mirror URL.
_TEST_GCS_MIRROR = False
# Must be kept in sync with the suffixes supported by gcs_mirror (e.g.
# https://skia.googlesource.com/skia/+/8ad66c2340713234df6b249e793415233337a103/bazel/gcs_mirror/gcs_mirr... | bsd-3-clause | Python |
3e8def3a9fce095deda059ea276cccb76026d005 | change http library to requests. - adjust same code python2 and python3. | dictoss/osmmarkerstorage,dictoss/osmmarkerstorage,dictoss/osmmarkerstorage,dictoss/osmmarkerstorage | tools/marker_put.py | tools/marker_put.py | #!/usr/bin/env python
import sys
import json
import datetime
import time
import requests
MP_URL = 'http://192.168.22.102:8000/markerstorage/markerdata/0/'
#MP_URL = 'http://192.168.22.30/osmproj1/markerstorage/markerdata/0/'
MP_POST_PASS = 'qWjJjNeiv.Bvc'
def put_markerobject():
_seq = 0
payload = {'id': _s... | #!/usr/bin/python3
import sys
import json
import datetime
import time
import urllib.request
import urllib.parse
import urllib.error
MP_URL = 'http://192.168.22.102:8000/markerstorage/markerdata/0/'
#MP_URL = 'http://192.168.22.30/osmproj1/markerstorage/markerdata/0/'
MP_POST_PASS = 'qWjJjNeiv.Bvc'
def put_markerobje... | bsd-2-clause | Python |
053d81056c0e0883aad9d29a5bafea91fc51e907 | Set mantle target in blink test in case someone calls it directly with python | phanrahan/magmathon,phanrahan/magmathon | tests/blink.py | tests/blink.py | from magma import wire, set_mantle_target
set_mantle_target("ice40")
from mantle import Counter
from loam.boards.icestick import IceStick
icestick = IceStick()
icestick.Clock.on()
icestick.D5.on()
main = icestick.main()
N = 22
counter = Counter(N)
wire(counter.O[N-1], main.D5)
| from magma import wire
from mantle import Counter
from loam.boards.icestick import IceStick
icestick = IceStick()
icestick.Clock.on()
icestick.D5.on()
main = icestick.main()
N = 22
counter = Counter(N)
wire(counter.O[N-1], main.D5)
| mit | Python |
6c7d8ae2b2c4b27d5005d856b238a824f941a759 | Add dummy evaluate routine | NewForester/apl-py,NewForester/apl-py | rep.py | rep.py | """
The top level of the APL Read-Evaluate-Print loop
UNDER DEVELOPMENT
This version adds a dummy evaluate routine.
"""
import sys
# ------------------------------
def evaluate(expression):
"""
Evaluate an APL expression - dummy version
"""
return (expression)
def read_evaluate... | """
The top level of the APL Read-Evaluate-Print loop
UNDER DEVELOPMENT
This version adds trivial apl_quit() and apl_exit() routines to the read-evaluate-print loop.
"""
import sys
def read_evaluate_print (prompt):
"""
Read input, echo input
"""
try:
while True:
p... | apache-2.0 | Python |
85a814c21a356a8d003f1dbf9730f92c20b5500c | Allow dot in manifest example name | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/package/manifest/model.py | platformio/package/manifest/model.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 | Python |
ef83d7946341efd1be6460b22d25b37c687d1092 | Add tests for conversions | mnaberez/py65,mkeller0815/py65 | py65/tests/utils/test_conversions.py | py65/tests/utils/test_conversions.py | import sys
import unittest
from py65.utils.conversions import itoa, convert_to_bin, convert_to_bcd
class ConversionsTopLevelTests(unittest.TestCase):
def test_itoa_decimal_output(self):
self.assertEqual('10', itoa(10, base=10))
self.assertEqual('-10', itoa(-10, base=10))
def test_itoa_hex_out... | import sys
import unittest
from py65.utils.conversions import itoa
class ConversionsTopLevelTests(unittest.TestCase):
def test_itoa_decimal_output(self):
self.assertEqual('10', itoa(10, base=10))
def test_itoa_hex_output(self):
self.assertEqual('a', itoa(10, base=16))
def test_itoa_bin_o... | bsd-3-clause | Python |
8aab3ca42ed0030ead70fe0bf0f4d1f22b47b7b1 | test if file exists | iancze/DiskJockey,iancze/JudithExcalibur,iancze/JudithExcalibur | hostgen.py | hostgen.py | #!/usr/bin/env python
# Create a list of all the CPU's we've been allocated, in addition to the one
# currently running.
from subprocess import check_output
import os
check = lambda cmd: check_output(cmd, shell=True, universal_newlines=True)
slurm_job_nodelist = check("echo $SLURM_JOB_NODELIST")
hostlist = check("s... | #!/usr/bin/env python
# Create a list of all the CPU's we've been allocated, in addition to the one
# currently running.
from subprocess import check_output
import os
check = lambda cmd: check_output(cmd, shell=True, universal_newlines=True)
slurm_job_nodelist = check("echo $SLURM_JOB_NODELIST")
hostlist = check("s... | mit | Python |
99800acaf03ca2045647a64ffab12f0ee7974dd2 | update health and es URL | joedanz/flask-elasticsearch,joedanz/flask-elasticsearch,joedanz/flask-elasticsearch | run.py | run.py | import os
import json
import urllib2
from flask import Flask
from flask import g, render_template, request
from flask_esclient import ESClient
app = Flask(__name__)
#app.config['ELASTICSEARCH_URL'] = 'http://127.0.0.1:9200/'
app.config['ELASTICSEARCH_URL'] = 'http://Hackerati-ES-LB-US-East-741975459.us-east-1.elb.amaz... | import os
import json
import urllib2
from flask import Flask
from flask import g, render_template, request
from flask_esclient import ESClient
app = Flask(__name__)
app.config['ELASTICSEARCH_URL'] = 'http://127.0.0.1:9200/'
esclient = ESClient(app)
@app.route("/")
def home():
return render_template('index.html')
... | apache-2.0 | Python |
de25f76cdc57c0f5e13a02013fc2d1f9c636d66e | Rename test class | djkartsa/django-filebrowser-no-grappelli,michalwerner/django-filebrowser-tinymce4,michalwerner/django-filebrowser,michalwerner/django-filebrowser,djkartsa/django-filebrowser-no-grappelli,michalwerner/django-filebrowser-tinymce4,djkartsa/django-filebrowser-no-grappelli,michalwerner/django-filebrowser,michalwerner/django... | tests/test_commands.py | tests/test_commands.py | # coding: utf-8
import os
import sys
from django.conf import settings
from django.core.management import call_command
from django.utils.six import StringIO
from filebrowser.settings import DIRECTORY
from tests import FilebrowserTestCase as TestCase
class VersionGenerateCommandTests(TestCase):
def setUp(self):... | # coding: utf-8
import os
import sys
from django.conf import settings
from django.core.management import call_command
from django.utils.six import StringIO
from filebrowser.settings import DIRECTORY
from tests import FilebrowserTestCase as TestCase
class CommandsTests(TestCase):
def setUp(self):
self.... | bsd-3-clause | Python |
d0613f3e77b87ad8df92730e5aa50aebf651ccc6 | Use fixture for robot_arm test | JakobGM/robotarm-optimization | tests/test_plotting.py | tests/test_plotting.py | import unittest
import numpy as np
from plotting import path_figure
from fixtures import robot_arm1
class TestPlotting(unittest.TestCase):
def setUp(self):
self.robot_arm = robot_arm1
n = len(self.robot_arm.lengths)
s = len(self.robot_arm.destinations[0])
total_joints = n * s
... | import unittest
import numpy as np
from numpy import pi
import matplotlib.pyplot as plt
from robot_arm import RobotArm
from plotting import path_figure
class TestPlotting(unittest.TestCase):
def setUp(self):
lengths = (3, 2, 2,)
destinations = (
(5, 4, 6, 4, 5),
(0, 2, 0.5,... | mit | Python |
7f84a5b8e3c9e202fea99cda50744d4d38b70ada | add test with quicksum for quadratic | mattmilten/PySCIPOpt,mattmilten/PySCIPOpt,SCIP-Interfaces/PySCIPOpt,SCIP-Interfaces/PySCIPOpt | tests/test_quicksum.py | tests/test_quicksum.py | from pyscipopt import Model, quicksum
def test_quicksum():
m = Model("quicksum")
x = m.addVar("x")
y = m.addVar("y")
z = m.addVar("z")
c = 2.3
q = quicksum([x,y,z,c]) == 0.0
s = sum([x,y,z,c]) == 0.0
assert(q.expr.terms == s.expr.terms)
def test_largequadratic():
# inspired ... | from pyscipopt import Model, quicksum
def test_quicksum():
m = Model("quicksum")
x = m.addVar("x")
y = m.addVar("y")
z = m.addVar("z")
c = 2.3
q = quicksum([x,y,z,c]) == 0.0
s = sum([x,y,z,c]) == 0.0
assert(q.expr.terms == s.expr.terms)
| mit | Python |
d36d9d4653d35f24d80b8f4b7210884f29ddfe7f | add new unit tests | WeKeyPedia/toolkit-python | tests/test_scrapper.py | tests/test_scrapper.py | from wekeypedia.wikipedia.page import WikipediaPage
# def test_fetch():
# page = WikipediaPage("unit testing")
# assert page.problem == None
# def test_ambiguity():
# page = WikipediaPage("transformation")
# assert page.problem == "ambiguity"
# def test_no_match():
# page = WikipediaPage("utin testgni")
... | from wekeypedia.wikipedia.page import WikipediaPage
# def test_fetch():
# page = WikipediaPage("unit testing")
# assert page.problem == None
# def test_ambiguity():
# page = WikipediaPage("transformation")
# assert page.problem == "ambiguity"
# def test_no_match():
# page = WikipediaPage("utin testgni")
... | mit | Python |
3c5e708961e336f71805d79465944e6503b83538 | Fix tests broken by new log configuration option | xia2/i19 | tests/test_screen19.py | tests/test_screen19.py | from __future__ import absolute_import, division, print_function
import pytest
from screen19.screen import Screen19
def test_screen19_command_line_help_does_not_crash():
Screen19().run([])
def test_screen19(dials_data, tmpdir):
data_dir = dials_data("x4wide").strpath
with tmpdir.as_cwd():
Scree... | from __future__ import absolute_import, division, print_function
import pytest
from screen19.screen import Screen19
def test_screen19_command_line_help_does_not_crash():
Screen19().run([])
def test_screen19(dials_data, tmpdir):
data_dir = dials_data("x4wide").strpath
with tmpdir.as_cwd():
Scree... | bsd-3-clause | Python |
04b090b3b3d93ccba80dddc7535d2cff94b84fdf | make tests more robust | thomwiggers/httpserver | tests/test_selenium.py | tests/test_selenium.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_selenium
----------------------------------
Tests the http server with a real browser.
"""
import os
import unittest
import multiprocessing
import time
from httpserver import _start_server
from selenium import webdriver
_host = 'localhost'
_ip = '127.0.0.1'
_p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_selenium
----------------------------------
Tests the http server with a real browser.
"""
import os
import unittest
import multiprocessing
import time
from httpserver import _start_server
from selenium import webdriver
_host = 'localhost'
_ip = '127.0.0.1'
_p... | bsd-3-clause | Python |
464d06dafd9e804cc1a1f46a68b3a037bddf103f | Add tests for context | imom0/django-plim | tests/test_template.py | tests/test_template.py | #!/usr/bin/env python
#-*- coding: UTF-8 -*-
from unittest import TestCase
from django_plim.template import Template
class TemplateTestCase(TestCase):
def test_template_render(self):
t = Template('h1 hello')
self.assertEqual(t.render(), '<h1>hello</h1>')
def test_context(self):
t =... | #!/usr/bin/env python
#-*- coding: UTF-8 -*-
from unittest import TestCase
from django_plim.template import Template
class TemplateTestCase(TestCase):
def test_template_render(self):
t = Template('h1 hello')
self.assertEqual(t.render(), '<h1>hello</h1>')
| mit | Python |
63b01f1553161564abdc6ee1384287daa38613d0 | fix tests | snower/TorMySQL,snower/TorMySQL | tests/test_warnings.py | tests/test_warnings.py | # encoding: utf-8
import uuid
from tornado.testing import gen_test
from . import BaseTestCase
class TestWarnings(BaseTestCase):
@gen_test
def test0(self):
connection = yield self.pool.Connection()
warnings = yield connection.show_warnings()
connection.close()
self.assertEqual(w... | # encoding: utf-8
import uuid
from tornado.testing import gen_test
from . import BaseTestCase
class TestWarnings(BaseTestCase):
@gen_test
def test0(self):
connection = yield self.pool.Connection()
warnings = yield connection.show_warnings()
self.assertEqual(warnings, (), "No warnings")... | mit | Python |
7e4e4b63f2f715d0ae5a7dd05cb82a1f7438c4c7 | optimize code | tcler/argparse-getopt-examples,tcler/argparse-getopt-examples,tcler/argparse-getopt-examples,tcler/argparse-getopt-examples,tcler/argparse-getopt-examples | python/erase-pdf-wartermark-image.py | python/erase-pdf-wartermark-image.py | #!/usr/bin/env python3
#ref: https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/image-replacement/remover.py
import fitz #python3 pymupdf module
import io,os,sys
from PIL import Image
path = sys.argv[1]
pdfname = path.split(".")[0]
pdf = fitz.open(path)
for index in range(len(pdf)):
#print(f"page-{index}:... | #!/usr/bin/env python3
#ref: https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/image-replacement/remover.py
import fitz #python3 pymupdf module
import io,os,sys
from PIL import Image
path = sys.argv[1]
pdfname = path.split(".")[0]
pdf = fitz.open(path)
for page_index in range(len(pdf)):
#print(f"page-{pa... | mit | Python |
30ca4ae2e6133bbfa0120feeda2066647132a19e | Update is_symmetric.py (#396) | keon/algorithms,amaozhao/algorithms | algorithms/tree/is_symmetric.py | algorithms/tree/is_symmetric.py | """
Given a binary tree, check whether it is a mirror of
itself (ie, symmetric around its center).
For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following [1,2,2,null,3,null,3] is not:
1
/ \
2 2
\ \
3 3
Note:
Bonus points if you could... | """
Given a binary tree, check whether it is a mirror of
itself (ie, symmetric around its center).
For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following [1,2,2,null,3,null,3] is not:
1
/ \
2 2
\ \
3 3
Note:
Bonus points if you could... | mit | Python |
1dc374483f3c5da871a5a0b7b52acffa209fdfee | Add filter for FxA accounts in admin. | anushbmx/kitsune,mozilla/kitsune,anushbmx/kitsune,anushbmx/kitsune,mozilla/kitsune,anushbmx/kitsune,mozilla/kitsune,mozilla/kitsune | kitsune/users/admin.py | kitsune/users/admin.py | from django import forms
from django.contrib import admin
from kitsune.users import monkeypatch
from kitsune.users.models import Profile
class ProfileAdminForm(forms.ModelForm):
delete_avatar = forms.BooleanField(required=False, help_text=(
"Check to remove the user's avatar."))
class Meta(object):
... | from django import forms
from django.contrib import admin
from kitsune.users import monkeypatch
from kitsune.users.models import Profile
class ProfileAdminForm(forms.ModelForm):
delete_avatar = forms.BooleanField(required=False, help_text=(
"Check to remove the user's avatar."))
class Meta(object):
... | bsd-3-clause | Python |
cbe93c6da290f9e38e2eaaf5a661a83bc4db0b8a | Bump version | reillysiemens/wb2k | wb2k/__init__.py | wb2k/__init__.py | __author__ = 'Reilly Tucker Siemens'
__email__ = 'reilly@tuckersiemens.com'
__version__ = '0.1.1-still-dont-expect-much'
| __author__ = 'Reilly Tucker Siemens'
__email__ = 'reilly@tuckersiemens.com'
__version__ = '0.1.0-dont-expect-much'
| isc | Python |
55a0b3f679d448da1c654d8ad2277243b05f5f33 | Remove md5 hasher for testing | keybar/keybar | src/keybar/conf/test.py | src/keybar/conf/test.py | from keybar.conf.base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'keybar_test',
}
}
certificates_dir = os.path.join(BASE_DIR, 'tests', 'resources', 'certificates')
KEYBAR_SERVER_CERTIFICATE = os.path.join(certificates_dir, 'KEYBAR-intermed... | from keybar.conf.base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'keybar_test',
}
}
certificates_dir = os.path.join(BASE_DIR, 'tests', 'resources', 'certificates')
KEYBAR_SERVER_CERTIFICATE = os.path.join(certificates_dir, 'KEYBAR-intermed... | bsd-3-clause | Python |
a21b02b93b8b92693be6dbdfe9c8d454ee233cc1 | Add details of demo EC2 server. | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | fabdefs.py | fabdefs.py | from fabric.api import *
"""
Define the server environments that this app will be deployed to.
Ensure that you have SSH access to the servers for the scripts in 'fabfile.py' to work.
"""
def production():
"""
Env parameters for the production environment.
"""
env.host_string = 'ubuntu@54.76.117.251'... | from fabric.api import *
"""
Define the server environments that this app will be deployed to.
Ensure that you have SSH access to the servers for the scripts in 'fabfile.py' to work.
"""
def production():
"""
Env parameters for the production environment.
"""
env.host_string = 'ubuntu@xxx'
env.k... | apache-2.0 | Python |
6794e23e86e9a1b9af26e5bf9f6f6faeda3ccd02 | Update __init__.py | bittracker/krempelair,KrempelEv/krempelair,KrempelEv/krempelair,bittracker/krempelair,bittracker/krempelair,KrempelEv/krempelair | krempelair/__init__.py | krempelair/__init__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import jinja2
import flask
import views
class Krempelair(flask.Flask):
jinja_options = {
'extensions': ['jinja2.ext.autoescape'],
'undefined': jinja2.StrictUndefined
}
def __init__(self):
"""(See `make_app` for parameter descripti... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import jinja2
import flask
import views
class Krempelair(flask.Flask):
jinja_options = {
'extensions': ['jinja2.ext.autoescape'],
'undefined': jinja2.StrictUndefined
}
def __init__(self):
"""(See `make_app` for parameter descripti... | agpl-3.0 | Python |
b89bd64916656d248fcadd6ceac64a769b5e01e8 | Remove 'is_add_validate' field | OCA/account-fiscal-rule,OCA/account-fiscal-rule | account_avatax_sale/models/account_move.py | account_avatax_sale/models/account_move.py | from odoo import api, models
class AccountMove(models.Model):
_inherit = "account.move"
@api.onchange("partner_id")
def _onchange_partner_id(self):
res = super(AccountMove, self)._onchange_partner_id()
self._onchange_partner_shipping_id()
return res
@api.onchange("partner_shi... | from odoo import api, models
class AccountMove(models.Model):
_inherit = "account.move"
@api.onchange("partner_id")
def _onchange_partner_id(self):
res = super(AccountMove, self)._onchange_partner_id()
self._onchange_partner_shipping_id()
return res
@api.onchange("partner_shi... | agpl-3.0 | Python |
5030a4111d206ba18c1aff2d990b967cca012eb4 | fix resource show and list | openstack/vitrage,openstack/vitrage,openstack/vitrage | vitrage/api/controllers/v1/resource.py | vitrage/api/controllers/v1/resource.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.