commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
1786ebacb85b2ddce816fb21b80285d991761695
poyo/_nodes.py
poyo/_nodes.py
# -*- coding: utf-8 -*- class TreeElement(object): """Helper class to identify internal classes.""" def __init__(self, **kwargs): pass class ContainerMixin(object): """Mixin that can hold TreeElement instances. Containers can be called to return a dict representation. """ def __init...
Implement classes to be used by the deserializer
Implement classes to be used by the deserializer
Python
mit
hackebrot/poyo
--- +++ @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + + +class TreeElement(object): + """Helper class to identify internal classes.""" + def __init__(self, **kwargs): + pass + + +class ContainerMixin(object): + """Mixin that can hold TreeElement instances. + + Containers can be called to return a dic...
d187c51ccd9dc1676b6f16eddecee6dce752d668
distarray/tests/test_client.py
distarray/tests/test_client.py
import unittest from IPython.parallel import Client from distarray.client import DistArrayContext class TestClient(unittest.TestCase): def setUp(self): self.client = Client() self.dv = self.client[:] def testCreateDAC(self): '''Can we create a plain vanilla context?''' dac = ...
import unittest from IPython.parallel import Client from distarray.client import DistArrayContext class TestDistArrayContext(unittest.TestCase): def setUp(self): self.client = Client() self.dv = self.client[:] def test_create_DAC(self): '''Can we create a plain vanilla context?''' ...
Make class test-class name more specific
Make class test-class name more specific ... to make room for more client tests.
Python
bsd-3-clause
RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray
--- +++ @@ -3,18 +3,18 @@ from distarray.client import DistArrayContext -class TestClient(unittest.TestCase): +class TestDistArrayContext(unittest.TestCase): def setUp(self): self.client = Client() self.dv = self.client[:] - def testCreateDAC(self): + def test_create_DAC(self): ...
28944376472130d53a05f7473e7213c917207cd4
apartments/models.py
apartments/models.py
from sqlalchemy import create_engine, Column, DateTime, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Listing(Base): __tablename__ = 'listings' id = Column(Integer, primary_key=True) craigslist_id = Column(Integer, unique=True) name =...
Add model representing a listing
Add model representing a listing
Python
mit
rlucioni/craigbot,rlucioni/craigbot,rlucioni/apartments
--- +++ @@ -0,0 +1,30 @@ +from sqlalchemy import create_engine, Column, DateTime, Float, Integer, String +from sqlalchemy.ext.declarative import declarative_base + +Base = declarative_base() + + +class Listing(Base): + __tablename__ = 'listings' + + id = Column(Integer, primary_key=True) + craigslist_id = Co...
38cbc73f70a9ca896a29d7fa2e000388bbf40d88
DilipadTopicModelling/experiment_get_results.py
DilipadTopicModelling/experiment_get_results.py
import logging import os import pandas as pd from CPTCorpus import CPTCorpus from CPT_Gibbs import GibbsSampler logger = logging.getLogger(__name__) logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO) # select experiment to get parameters from nTopics = 100 start = 80 end = 199 alpha = 50....
Add script to generate data from an experiment
Add script to generate data from an experiment Added a script that generates csv files of estimations of theta, phi_topic and phi_opinion and saves them to disk.
Python
apache-2.0
NLeSC/cptm,NLeSC/cptm
--- +++ @@ -0,0 +1,41 @@ +import logging +import os +import pandas as pd + +from CPTCorpus import CPTCorpus +from CPT_Gibbs import GibbsSampler + +logger = logging.getLogger(__name__) +logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO) + +# select experiment to get parameters from +nTopics ...
656d94c0375f6a96cc3a9d4b3227d8f19afe3dea
control/systems/main.py
control/systems/main.py
import numpy as np Kt = 1.41/89.0 Kv = 5840.0/3.0 G = 10.0 J = 4.0*(2.54**2.0)/2.0 # 4 kg on a 1 inch pully R = 12.0/89.0 A = np.asarray([[0, 1], [0, -(Kt*Kv)/((G**2)*J*R)]]) B = np.asarray([[0], [Kt/(G*J*R)]])
Add lemon drop elevator model
Add lemon drop elevator model
Python
mit
WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox
--- +++ @@ -0,0 +1,12 @@ +import numpy as np + +Kt = 1.41/89.0 +Kv = 5840.0/3.0 +G = 10.0 +J = 4.0*(2.54**2.0)/2.0 # 4 kg on a 1 inch pully +R = 12.0/89.0 + +A = np.asarray([[0, 1], + [0, -(Kt*Kv)/((G**2)*J*R)]]) +B = np.asarray([[0], + [Kt/(G*J*R)]])
3fd4244dbfd33bbf2fa369d81756e82b1cf1c467
src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py
src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py
# Generated by Django 3.2.13 on 2022-10-17 13:47 from django.db import migrations def clear_nlcd2019_gwlfe_results(apps, schema_editor): """ Clear the results for all scenarios belonging to GWLF-E projects made after the release of 1.33.0, which had incorrectly aligned NLCD19 2019 on 2022-01-17: ...
Clear out unaligned NLCD19 GWLF-E results
Clear out unaligned NLCD19 GWLF-E results Adds a migration that clears out all stored results for GWLF-E projects created on or after 2022-01-17, which is when 1.33.0 was released with incorrectly aligned NLCD19 layers, which had also been made the default. Thus, every project made after then had slighly incorrect res...
Python
apache-2.0
WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed
--- +++ @@ -0,0 +1,45 @@ +# Generated by Django 3.2.13 on 2022-10-17 13:47 + +from django.db import migrations + + +def clear_nlcd2019_gwlfe_results(apps, schema_editor): + """ + Clear the results for all scenarios belonging to GWLF-E projects made after + the release of 1.33.0, which had incorrectly aligned...
2cb7e09df0a8ec6fda707cccd1e9f8f00e15083c
migrations/versions/9ef49beab95_.py
migrations/versions/9ef49beab95_.py
"""empty message Revision ID: 9ef49beab95 Revises: 4b7b5a7ddc5c Create Date: 2016-02-07 15:00:45.614000 """ # revision identifiers, used by Alembic. revision = '9ef49beab95' down_revision = '4b7b5a7ddc5c' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - pl...
Adjust the sorting of restaurants.
Adjust the sorting of restaurants.
Python
mit
clementlefevre/hunger-game,clementlefevre/hunger-game,clementlefevre/hunger-game
--- +++ @@ -0,0 +1,26 @@ +"""empty message + +Revision ID: 9ef49beab95 +Revises: 4b7b5a7ddc5c +Create Date: 2016-02-07 15:00:45.614000 + +""" + +# revision identifiers, used by Alembic. +revision = '9ef49beab95' +down_revision = '4b7b5a7ddc5c' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ...
ed20a93e917cfdddc5cd49cc6446b6e80fb4573d
makam/migrations/0007_auto_20150812_1615.py
makam/migrations/0007_auto_20150812_1615.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django_extensions.db.fields class Migration(migrations.Migration): dependencies = [ ('makam', '0006_auto_20150727_1631'), ] operations = [ migrations.AlterField( m...
Migrate symbtr uuid field to django type
Migrate symbtr uuid field to django type
Python
agpl-3.0
MTG/dunya,MTG/dunya,MTG/dunya,MTG/dunya
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django_extensions.db.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('makam', '0006_auto_20150727_1631'), + ] + + operations = [ + ...
52c50ca6e4c5d2ee75300617c5da118fb1136e76
mplstyles/plots.py
mplstyles/plots.py
from matplotlib import cm import matplotlib.pyplot as plt from mplstyles import cmap as colormap import numpy as np def contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='nearest',contour_labelsize=9,contour_opts={},imshow_opts={},clegendlabels=[],label=False): ax = plt.gca() x_delta = float((x[-1]-x...
Add custom plot style contour_image.
Add custom plot style contour_image.
Python
mit
matthewwardrop/python-mplstyles,matthewwardrop/python-mplkit,matthewwardrop/python-mplstyles,matthewwardrop/python-mplkit
--- +++ @@ -0,0 +1,41 @@ +from matplotlib import cm +import matplotlib.pyplot as plt +from mplstyles import cmap as colormap +import numpy as np + +def contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='nearest',contour_labelsize=9,contour_opts={},imshow_opts={},clegendlabels=[],label=False): + ax = plt...
45b789010409e4e2e2afc88cb776c8b70e7768ec
dakota/tests/test_dakota_base.py
dakota/tests/test_dakota_base.py
#!/usr/bin/env python # # Tests for dakota.dakota_base module. # # Call with: # $ nosetests -sv # # Mark Piper (mark.piper@colorado.edu) import os import filecmp from nose.tools import * from dakota.dakota_base import DakotaBase # Fixtures ------------------------------------------------------------- def setup_mo...
Add unit test for DakotaBase
Add unit test for DakotaBase Still need to determine how to test its non-abstract methods.
Python
mit
csdms/dakota,csdms/dakota
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# +# Tests for dakota.dakota_base module. +# +# Call with: +# $ nosetests -sv +# +# Mark Piper (mark.piper@colorado.edu) + +import os +import filecmp +from nose.tools import * +from dakota.dakota_base import DakotaBase + + +# Fixtures --------------------------------...
0ca7d4a20c8a65e45ddb7c61ca72c0e6c464a80e
migrations/versions/0296_template_redacted_fix.py
migrations/versions/0296_template_redacted_fix.py
""" Revision ID: 0296_template_redacted_fix Revises: 0295_api_key_constraint Create Date: 2019-06-07 17:02:14.350064 """ from alembic import op revision = '0296_template_redacted_fix' down_revision = '0295_api_key_constraint' def upgrade(): op.execute(""" INSERT INTO template_redacted (template_id, re...
Create template_redacted entry for templates created by migration
Create template_redacted entry for templates created by migration So that we can edit those templates
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,26 @@ +""" + +Revision ID: 0296_template_redacted_fix +Revises: 0295_api_key_constraint +Create Date: 2019-06-07 17:02:14.350064 + +""" +from alembic import op + + +revision = '0296_template_redacted_fix' +down_revision = '0295_api_key_constraint' + + +def upgrade(): + op.execute(""" + IN...
2611476df6f362cd59e4aad38a243fc8f6cbf8a8
devincachu/purger.py
devincachu/purger.py
# -*- coding: utf-8 -*- import roan from django.contrib.flatpages import models from palestras import models as pmodels def connect(): flatpages = models.FlatPage.objects.all() for f in flatpages: roan.purge(f.url).on_save(models.FlatPage) palestras = pmodels.Palestra.objects.all() for p in...
# -*- coding: utf-8 -*- import roan from django.contrib.flatpages import models from palestras import models as pmodels def connect(): flatpages = models.FlatPage.objects.all() for f in flatpages: roan.purge(f.url).on_save(models.FlatPage) palestras = pmodels.Palestra.objects.all() for p in...
Purge da página de palestra quando salva palestrante
Purge da página de palestra quando salva palestrante
Python
bsd-2-clause
devincachu/devincachu-2013,devincachu/devincachu-2013,devincachu/devincachu-2014,devincachu/devincachu-2014,devincachu/devincachu-2014,devincachu/devincachu-2013,devincachu/devincachu-2013
--- +++ @@ -15,3 +15,5 @@ for p in palestras: roan.purge(p.get_absolute_url_and_link_title()['url']).on_save(pmodels.Palestra) roan.purge(p.get_absolute_url_and_link_title()['url']).on_delete(pmodels.Palestra) + roan.purge(p.get_absolute_url_and_link_title()['url']).on_save(pmodels.Pales...
cdd1f3410b8ae304485f7992ac6048e1277cffe1
parsedatetime/pdt_locales/__init__.py
parsedatetime/pdt_locales/__init__.py
# -*- encoding: utf-8 -*- """ pdt_locales All of the included locale classes shipped with pdt. """ try: import PyICU as pyicu except: pyicu = None def lcase(x): return x.lower() from .base import pdtLocale_base, pdtLocale_icu from .de_DE import * from .en_AU import * from .en_US import * from .es im...
# -*- encoding: utf-8 -*- """ pdt_locales All of the included locale classes shipped with pdt. """ import os try: import PyICU as pyicu except: pyicu = None import yaml def lcase(x): return x.lower() from .base import pdtLocale_base, pdtLocale_icu from .de_DE import * from .en_AU import * from .en_...
Add local locale from file
Add local locale from file
Python
apache-2.0
phoebebright/parsedatetime,bear/parsedatetime,idpaterson/parsedatetime
--- +++ @@ -5,11 +5,14 @@ All of the included locale classes shipped with pdt. """ +import os try: import PyICU as pyicu except: pyicu = None + +import yaml def lcase(x): @@ -25,3 +28,46 @@ from .nl_NL import * from .pt_BR import * from .ru_RU import * + +pdtLocales = [ + 'icu', + 'en_...
b3889f8ff6d66963d4253d6796c3bb20dc9adbb7
scripts/my_Param.py
scripts/my_Param.py
#================================================= # Observation #------------------------------------------------- sstObsPath = '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadISST_sst.nc' tauxObsPath = '/clim_obs/obs/atm/mo/tauu/ERAINT/tauu_ERAINT_198901-200911.nc' sstNameObs = 'sst' tauxNameObs = 'tauu...
Add external driver and parameter file
Add external driver and parameter file
Python
bsd-3-clause
eguil/ENSO_metrics,eguil/ENSO_metrics
--- +++ @@ -0,0 +1,46 @@ +#================================================= +# Observation +#------------------------------------------------- +sstObsPath = '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadISST_sst.nc' +tauxObsPath = '/clim_obs/obs/atm/mo/tauu/ERAINT/tauu_ERAINT_198901-200911.nc' + +sstN...
4ff6b846311a0f7bd6cfcf2e661a7c53061406fe
glaciercmd/command_vault_info.py
glaciercmd/command_vault_info.py
import boto class CommandVaultInfo(object): def execute(self, args, config): glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=config.get('configuration', 'aws_secret')) try: vault = glacier_connection.get_vault(args[2]) pr...
Add command to print vault info
Add command to print vault info
Python
mit
carsonmcdonald/glacier-cmd
--- +++ @@ -0,0 +1,18 @@ +import boto + +class CommandVaultInfo(object): + + def execute(self, args, config): + glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=config.get('configuration', 'aws_secret')) + + try: + vault = glacier_co...
582ebd448508625ed2c9f362aaafc3fc46e60df0
functest/tests/unit/features/test_security_scan.py
functest/tests/unit/features/test_security_scan.py
#!/usr/bin/env python # Copyright (c) 2017 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 # pylint: d...
Add unit tests for security_scan
Add unit tests for security_scan Change-Id: Idda799c01408aa9afd09d573e23f42e011f3fafb Signed-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>
Python
apache-2.0
opnfv/functest,opnfv/functest,mywulin/functest,mywulin/functest
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Orange and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.or...
2ca07d4a8893196bbf304bcdac16688505e6123a
shopify/webhooks/management/commands/webhookregister.py
shopify/webhooks/management/commands/webhookregister.py
from django.core.management.base import NoArgsCommand from webhooks.models import Webhook class Command(NoArgsCommand): help = 'Register all created Shopify webhooks' def handle_noargs(self, **options): Webhook.objects.register()
Add a management command to register webhooks
Add a management command to register webhooks
Python
bsd-3-clause
CorbanU/corban-shopify,CorbanU/corban-shopify
--- +++ @@ -0,0 +1,10 @@ +from django.core.management.base import NoArgsCommand + +from webhooks.models import Webhook + + +class Command(NoArgsCommand): + help = 'Register all created Shopify webhooks' + + def handle_noargs(self, **options): + Webhook.objects.register()
ee859881af0633d4d2d88015c907cfa856516dbe
lintcode/000-000-Two-Sum-II/TwoSumII.py
lintcode/000-000-Two-Sum-II/TwoSumII.py
class Solution: # @param nums, an array of integer # @param target, an integer # @return an integer def twoSum2(self, nums, target): # Write your code here nums.sort() i, j = 0, len(nums) - 1 res = 0 while i < j: if nums[i] + nums[j] <= target: ...
Create TwoSum II for Lint
Create TwoSum II for Lint
Python
mit
Chasego/codi,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/cod,cc13ny/Allin,Chasego/codirit,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/codi,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codirit,cc13ny/algo,cc13ny/Allin,Chasego/cod,Ch...
--- +++ @@ -0,0 +1,16 @@ +class Solution: + # @param nums, an array of integer + # @param target, an integer + # @return an integer + def twoSum2(self, nums, target): + # Write your code here + nums.sort() + i, j = 0, len(nums) - 1 + res = 0 + while i < j: + i...
52e8a378d8a31989c9d93ef83eabbe6df339f915
src/waldur_mastermind/marketplace/migrations/0083_offering_component.py
src/waldur_mastermind/marketplace/migrations/0083_offering_component.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from waldur_mastermind.marketplace_openstack import STORAGE_TYPE, RAM_TYPE, CORES_TYPE, PACKAGE_TYPE def create_category_components(apps, schema_editor): CATEGORY_TITLE = 'Private clouds' Category = apps.get_mo...
Add data migration to add category components for VPC.
Add data migration to add category components for VPC.
Python
mit
opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur
--- +++ @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + +from waldur_mastermind.marketplace_openstack import STORAGE_TYPE, RAM_TYPE, CORES_TYPE, PACKAGE_TYPE + + +def create_category_components(apps, schema_editor): + CATEGORY_TITLE = 'Privat...
1c81643eaed91b4171a4e68699d930e5ef3688db
senlin/tests/tempest/api/policies/test_policy_validate_negative.py
senlin/tests/tempest/api/policies/test_policy_validate_negative.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...
Add negative API tests for policy validation
Add negative API tests for policy validation Add negative API tests for policy validation Change-Id: I0363bfd2165893b713059dc9db5ab9e632522091
Python
apache-2.0
openstack/senlin,openstack/senlin,stackforge/senlin,stackforge/senlin,openstack/senlin
--- +++ @@ -0,0 +1,74 @@ +# 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 writi...
f040351dd3397ba7297b69b2468b2b37589c0d8f
games/management/commands/get_installer_urls.py
games/management/commands/get_installer_urls.py
import json from collections import defaultdict from django.core.management.base import BaseCommand from common.util import load_yaml from games import models class Command(BaseCommand): def handle(self, *args, **kwargs): self.stdout.write("Installer stats\n") installers = models.Installer.object...
Add task to get stats about files
Add task to get stats about files
Python
agpl-3.0
lutris/website,lutris/website,lutris/website,lutris/website
--- +++ @@ -0,0 +1,45 @@ +import json +from collections import defaultdict + +from django.core.management.base import BaseCommand +from common.util import load_yaml +from games import models + + +class Command(BaseCommand): + def handle(self, *args, **kwargs): + self.stdout.write("Installer stats\n") + ...
463502a251111199da130e508929a35b2f126f4e
bookmarks/models.py
bookmarks/models.py
from sqlalchemy import Column, Integer, String from bookmarks.database import Base class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) username = Column(String(50), unique=True, nullable=False) name = Column(String(120)) email = Column(String(256), unique=True, nullabl...
Add columns to User model
Add columns to User model
Python
apache-2.0
byanofsky/bookmarks,byanofsky/bookmarks,byanofsky/bookmarks
--- +++ @@ -0,0 +1,18 @@ +from sqlalchemy import Column, Integer, String +from bookmarks.database import Base + + +class User(Base): + __tablename__ = 'users' + id = Column(Integer, primary_key=True) + username = Column(String(50), unique=True, nullable=False) + name = Column(String(120)) + email = Col...
bb11ab050fe9a7bb0ffe83419eb0e87390f7deac
hopsutil/tensorboard.py
hopsutil/tensorboard.py
""" Utility functions to retrieve information about available services and setting up security for the Hops platform. These utils facilitates development by hiding complexity for programs interacting with Hops services. """ import socket import subprocess import os import hdfs def register(logdir): #find free p...
Add registration method for TB
Add registration method for TB
Python
apache-2.0
hopshadoop/hops-util-py,hopshadoop/hops-util-py
--- +++ @@ -0,0 +1,32 @@ +""" +Utility functions to retrieve information about available services and setting up security for the Hops platform. + +These utils facilitates development by hiding complexity for programs interacting with Hops services. +""" + +import socket +import subprocess +import os +import hdfs + +...
24788b106b9cdd70e7240dc3eccac82fba290c85
tests/util/test_yaml.py
tests/util/test_yaml.py
"""Test Home Assistant yaml loader.""" import io import unittest from homeassistant.util import yaml class TestYaml(unittest.TestCase): """Test util.yaml loader.""" def test_simple_list(self): """Test simple list.""" conf = "config:\n - simple\n - list" with io.StringIO(conf) as f:...
"""Test Home Assistant yaml loader.""" import io import unittest import os from homeassistant.util import yaml class TestYaml(unittest.TestCase): """Test util.yaml loader.""" def test_simple_list(self): """Test simple list.""" conf = "config:\n - simple\n - list" with io.StringIO(c...
Add test for yaml enviroment
Add test for yaml enviroment
Python
mit
lukas-hetzenecker/home-assistant,LinuxChristian/home-assistant,molobrakos/home-assistant,sffjunkie/home-assistant,titilambert/home-assistant,ewandor/home-assistant,emilhetty/home-assistant,mikaelboman/home-assistant,nkgilley/home-assistant,robbiet480/home-assistant,jawilson/home-assistant,molobrakos/home-assistant,devd...
--- +++ @@ -1,6 +1,7 @@ """Test Home Assistant yaml loader.""" import io import unittest +import os from homeassistant.util import yaml @@ -32,3 +33,23 @@ pass else: assert 0 + + def test_enviroment_variable(self): + """Test config file with enviroment variable."""...
96f224a6b80720a88fefc8530aea113f975ef110
new_layout.py
new_layout.py
import sublime, sublime_plugin class NewLayoutCommand(sublime_plugin.TextCommand): def run(self, edit, **args): self.view.window().run_command("set_layout", args) self.view.window().run_command("focus_group", { "group": 0 }) self.view.window().run_command("move_to_group", { "group": 1 } )
Add new layout window command
Add new layout window command
Python
mit
shaochuan/sublime-plugins
--- +++ @@ -0,0 +1,7 @@ +import sublime, sublime_plugin + +class NewLayoutCommand(sublime_plugin.TextCommand): + def run(self, edit, **args): + self.view.window().run_command("set_layout", args) + self.view.window().run_command("focus_group", { "group": 0 }) + self.view.window().run_command("move_to_group",...
325465d18e963400b427f259547d4292a47368c9
oneflow/settings/snippets/common_development.py
oneflow/settings/snippets/common_development.py
# # Include your development machines hostnames here. # # NOTE: this is not strictly needed, as Django doesn't enforce # the check if DEBUG==True. But Just in case you wanted to disable # it temporarily, this could be a good thing to have your hostname # here. # # If you connect via http://localhost:8000/, everything i...
# # Include your development machines hostnames here. # # NOTE: this is not strictly needed, as Django doesn't enforce # the check if DEBUG==True. But Just in case you wanted to disable # it temporarily, this could be a good thing to have your hostname # here. # # If you connect via http://localhost:8000/, everything i...
Use Django nose for tests.
Use Django nose for tests.
Python
agpl-3.0
1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow
--- +++ @@ -19,3 +19,8 @@ 'leto.licorn.org', 'gurney.licorn.org' ] + +INSTALLED_APPS += ('django_nose', ) + +TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' +
8eeb4c2db613c1354c38696ac6691cf79f66a383
locations/spiders/brookdale.py
locations/spiders/brookdale.py
# -*- coding: utf-8 -*- import scrapy import json from locations.items import GeojsonPointItem URL = 'https://www.brookdale.com/bin/brookdale/community-search?care_type_category=resident&loc=&finrpt=&state=' US_STATES = ( "AL", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "ID", "IL", "IN", "IA", "KS"...
Add spider for Brookdale Senior Living
Add spider for Brookdale Senior Living
Python
mit
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
--- +++ @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +import scrapy +import json +from locations.items import GeojsonPointItem + +URL = 'https://www.brookdale.com/bin/brookdale/community-search?care_type_category=resident&loc=&finrpt=&state=' + +US_STATES = ( + "AL", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",...
0403d6f78189be3f3b22f068dad1db0c53687ef7
ptch/__init__.py
ptch/__init__.py
# -*- coding: utf-8 -*- """ PTCH files are a container format for Blizzard patch files. They begin with a 72 byte header containing some metadata, immediately followed by a RLE-packed BSDIFF40. The original BSDIFF40 format is compressed with bzip2 instead of RLE. """ #from hashlib import md5 from struct import unpack ...
Add ptch module and base PatchFile class. This class can unpack RLE-compressed patchfiles.
ptch: Add ptch module and base PatchFile class. This class can unpack RLE-compressed patchfiles.
Python
cc0-1.0
jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow
--- +++ @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +""" +PTCH files are a container format for Blizzard patch files. +They begin with a 72 byte header containing some metadata, immediately +followed by a RLE-packed BSDIFF40. +The original BSDIFF40 format is compressed with bzip2 instead of RLE. +""" + +#from hashlib i...
841e8fe236eab35b803cb9d8bec201306ce4642e
util/repeat_rum_file.py
util/repeat_rum_file.py
from rum_mapping_stats import aln_iter import argparse import sys parser = argparse.ArgumentParser() parser.add_argument('--times', type=int) parser.add_argument('--max-seq', type=int) parser.add_argument('rum_file', type=file) args = parser.parse_args() alns = list(aln_iter(args.rum_file)) for t in range(args.tim...
Add script to generate big RUM_* files
Add script to generate big RUM_* files
Python
mit
itmat/rum,itmat/rum,itmat/rum
--- +++ @@ -0,0 +1,21 @@ +from rum_mapping_stats import aln_iter +import argparse +import sys + +parser = argparse.ArgumentParser() + +parser.add_argument('--times', type=int) +parser.add_argument('--max-seq', type=int) +parser.add_argument('rum_file', type=file) + +args = parser.parse_args() + +alns = list(aln_iter(...
7060b82030d719cdcbdcecdb5eb7d34b405aa805
platforms/migrations/0003_auto_20150718_0050.py
platforms/migrations/0003_auto_20150718_0050.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('platforms', '0002_auto_20150718_0042'), ] operations = [ migrations.AlterField( model_na...
Make the migration for previous commit
Make the migration for previous commit
Python
agpl-3.0
Turupawn/website,lutris/website,lutris/website,Turupawn/website,Turupawn/website,lutris/website,lutris/website,Turupawn/website
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import jsonfield.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('platforms', '0002_auto_20150718_0042'), + ] + + operations = [ + m...
49b1de4a68133e618723f96f2dc922b311bdd982
util/encode_raw.py
util/encode_raw.py
#!/usr/bin/env python # Converts raw RGB565 video to MP4/AVI from sys import argv, exit from array import array from subprocess import call buf=None TMP_FILE = "/tmp/video.raw" if (len(argv) != 4): print("Usage: encode_raw input.raw output.avi fps") exit(1) with open(argv[1], "rb") as f: buf = array("H"...
Add Script to encode raw RGB565
Add Script to encode raw RGB565 * Encodes RGB565 raw stream to MP4/AVI
Python
mit
SmartArduino/openmv,SmartArduino/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,tianzhihen/openmv,kwagyeman/openmv,SmartArduino/openmv,openmv/openmv,openmv/openmv,tianzhihen/openmv,iabdalkader/openmv,kwagyeman/openmv,tianzhihen/openmv,iabdalkader/openmv,iabdalkader/openmv,SmartArduino/openmv,openmv/openmv,...
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# Converts raw RGB565 video to MP4/AVI + +from sys import argv, exit +from array import array +from subprocess import call + +buf=None +TMP_FILE = "/tmp/video.raw" + +if (len(argv) != 4): + print("Usage: encode_raw input.raw output.avi fps") + exit(1) + +with ope...
74354263acb3399295e7fde18d6aeed4b7bb7397
what_transcode/tests.py
what_transcode/tests.py
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase from what_transcode.utils import get_mp3_ids class UtilsTests(TestCase): def test_get_mp3_ids(se...
Fix maybe all flake8 errors. Add first test.
Fix maybe all flake8 errors. Add first test.
Python
mit
grandmasterchef/WhatManager2,MADindustries/WhatManager2,grandmasterchef/WhatManager2,karamanolev/WhatManager2,davols/WhatManager2,MADindustries/WhatManager2,karamanolev/WhatManager2,MADindustries/WhatManager2,grandmasterchef/WhatManager2,davols/WhatManager2,MADindustries/WhatManager2,karamanolev/WhatManager2,grandmaste...
--- +++ @@ -0,0 +1,93 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this with more appropriate tests for your application. +""" + +from django.test import TestCase + +from what_transcode.utils import get_mp3_ids + + +class UtilsTest...
cb9166c4564c4e763e1214355dc76cbe6d466258
books/migrations/0009_auto_20141127_1718.py
books/migrations/0009_auto_20141127_1718.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def add_sections(apps, schema_editor): # Don't just use books.models.Section, that could be out of date Section = apps.get_model('books', 'Section') FRONT_MATTER_CHOICES = [ #('db_value', 'hum...
Add data migration for section
Add data migration for section
Python
mit
supermitch/simple-author
--- +++ @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def add_sections(apps, schema_editor): + # Don't just use books.models.Section, that could be out of date + Section = apps.get_model('books', 'Section') + + FRONT_MATTER...
ebd62eac70d5589b0b7f593009024868f981e658
calvin/actorstore/systemactors/std/ClassicDelay.py
calvin/actorstore/systemactors/std/ClassicDelay.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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 ...
Add actor with behavior similar to old-style Delay
Add actor with behavior similar to old-style Delay
Python
apache-2.0
les69/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,les69/calvin-base
--- +++ @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2015 Ericsson AB +# +# 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....
e363aac46c9a5b607c7b32bcc5546c5a2728d750
climate_data/migrations/0029_auto_20170628_1527.py
climate_data/migrations/0029_auto_20170628_1527.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-28 15:27 from __future__ import unicode_literals from django.db import migrations from datetime import timedelta # noinspection PyUnusedLocal def add_message_id_to_reading(apps, schema_editor): # noinspection PyPep8Naming Reading = apps.get_mod...
Add migration which fixes missing message IDs.
Add migration which fixes missing message IDs.
Python
apache-2.0
qubs/data-centre,qubs/data-centre,qubs/climate-data-api,qubs/climate-data-api
--- +++ @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.2 on 2017-06-28 15:27 +from __future__ import unicode_literals + +from django.db import migrations + +from datetime import timedelta + + +# noinspection PyUnusedLocal +def add_message_id_to_reading(apps, schema_editor): + # noinspection ...
840bc57e7120ae67e84c1c7bca94cfef34c8d2a8
scripts/add_missing_identifiers_to_preprints.py
scripts/add_missing_identifiers_to_preprints.py
import sys import time import logging from scripts import utils as script_utils from django.db import transaction from website.app import setup_django from website.identifiers.utils import request_identifiers_from_ezid, parse_identifiers setup_django() logger = logging.getLogger(__name__) def add_identifiers_to_pre...
Copy old script from @erinspace which added identifiers to existing preprints.
Copy old script from @erinspace which added identifiers to existing preprints.
Python
apache-2.0
erinspace/osf.io,chennan47/osf.io,Johnetordoff/osf.io,cslzchen/osf.io,felliott/osf.io,baylee-d/osf.io,saradbowman/osf.io,leb2dg/osf.io,caseyrollins/osf.io,sloria/osf.io,Johnetordoff/osf.io,TomBaxter/osf.io,crcresearch/osf.io,mattclark/osf.io,brianjgeiger/osf.io,aaxelb/osf.io,felliott/osf.io,mfraezz/osf.io,adlius/osf.io...
--- +++ @@ -0,0 +1,65 @@ +import sys +import time +import logging +from scripts import utils as script_utils +from django.db import transaction + +from website.app import setup_django +from website.identifiers.utils import request_identifiers_from_ezid, parse_identifiers + +setup_django() +logger = logging.getLogger(...
a02a46752d954c29a65bf8bc5b88fa3545315175
lib/svtplay_dl/tests/utils.py
lib/svtplay_dl/tests/utils.py
#!/usr/bin/python # ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- # The unittest framwork doesn't play nice with pylint: # pylint: disable-msg=C0103 from __future__ import absolute_import import unittest import svtplay_dl.utils class timestrTest(unittest.TestCase): def ...
Add unit tests for timestr()
Add unit tests for timestr()
Python
mit
OakNinja/svtplay-dl,qnorsten/svtplay-dl,dalgr/svtplay-dl,iwconfig/svtplay-dl,dalgr/svtplay-dl,leakim/svtplay-dl,selepo/svtplay-dl,spaam/svtplay-dl,olof/svtplay-dl,leakim/svtplay-dl,OakNinja/svtplay-dl,qnorsten/svtplay-dl,selepo/svtplay-dl,iwconfig/svtplay-dl,olof/svtplay-dl,spaam/svtplay-dl,OakNinja/svtplay-dl,leakim/s...
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/python +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- + +# The unittest framwork doesn't play nice with pylint: +# pylint: disable-msg=C0103 + +from __future__ import absolute_import +import unittest +import svtplay_dl.utils + +class t...
a1039c2e38243b64d2027621aa87ee020636f23b
tests/test_views.py
tests/test_views.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys sys.path.insert(0, os.path.abspath('..')) import website import unittest import tempfile class FPOTestCase(unittest.TestCase): def test_homepage(self): self.app = website.app.test_client() resp = self.app.get('/') self.as...
Add initial test for routes.
Add initial test for routes.
Python
mit
jonathanchu/fpo,jonathanchu/fpo
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import sys +sys.path.insert(0, os.path.abspath('..')) + +import website +import unittest +import tempfile + +class FPOTestCase(unittest.TestCase): + + def test_homepage(self): + self.app = website.app.test_client() + ...
278920272efd7ab959d7cad5b5f7d6c17935c7e6
problem_35.py
problem_35.py
from math import sqrt from time import time PRIME_STATUS = {} def is_prime(n): if n == 2: return True if n % 2 == 0 or n <= 1: return False for i in range(3, int(sqrt(n))+1, 2): if n % i == 0: return False return True def check_prime_circles(num): circles = [...
Add problem 35, circular primes
Add problem 35, circular primes
Python
mit
dimkarakostas/project-euler
--- +++ @@ -0,0 +1,42 @@ +from math import sqrt +from time import time + +PRIME_STATUS = {} + + +def is_prime(n): + if n == 2: + return True + if n % 2 == 0 or n <= 1: + return False + for i in range(3, int(sqrt(n))+1, 2): + if n % i == 0: + return False + return True + + +...
dad430fd56b8be22bd1a3b9773f9948c3e305883
stringlike/test/lazy_tests.py
stringlike/test/lazy_tests.py
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) from stringlike.lazy import LazyString, CachedLazyString from unittest import main, TestCase class TestLazyString(TestCase): def test_equality(self): self.assertEqual(LazyString(lambda: 'abc'), ...
Add unit tests for lazy strings
Add unit tests for lazy strings
Python
mit
CovenantEyes/py_stringlike
--- +++ @@ -0,0 +1,53 @@ +import sys +import os +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) + + +from stringlike.lazy import LazyString, CachedLazyString +from unittest import main, TestCase + + +class TestLazyString(TestCase): + def test_equality(self): + self....
e7b6aef4db85c777463d2335107145b60b678ae2
examples/tour_examples/maps_introjs_tour.py
examples/tour_examples/maps_introjs_tour.py
from seleniumbase import BaseCase class MyTourClass(BaseCase): def test_google_maps_tour(self): self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z") self.wait_for_element("#searchboxinput") self.wait_for_element("#minimap") self.wait_for_element("#zoom") s...
Create a new tour example
Create a new tour example
Python
mit
seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase
--- +++ @@ -0,0 +1,34 @@ +from seleniumbase import BaseCase + + +class MyTourClass(BaseCase): + + def test_google_maps_tour(self): + self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z") + self.wait_for_element("#searchboxinput") + self.wait_for_element("#minimap") + self...
d93916b1927f0ae099cee3cf93619d3113db147b
examples/anomaly_detection.py
examples/anomaly_detection.py
import math from peewee import * db = SqliteDatabase(':memory:') class Reg(Model): key = TextField() value = IntegerField() class Meta: database = db db.create_tables([Reg]) # Create a user-defined aggregate function suitable for computing the standard # deviation of a series. @db.aggregate('...
Add small example of basic anomaly detection w/peewee.
Add small example of basic anomaly detection w/peewee.
Python
mit
coleifer/peewee,coleifer/peewee,coleifer/peewee
--- +++ @@ -0,0 +1,64 @@ +import math +from peewee import * + + +db = SqliteDatabase(':memory:') + +class Reg(Model): + key = TextField() + value = IntegerField() + + class Meta: + database = db + + +db.create_tables([Reg]) + +# Create a user-defined aggregate function suitable for computing the stand...
10ccc510deab5c97ce8a6c5ee57232c5e399986e
decision_tree.py
decision_tree.py
import pandas as pd from sklearn import tree # X = [[0, 1], [1, 1]] # Y = [0, 1] #clf = tree.DecisionTreeClassifier() #clf = clf.fit(X, Y) data = pd.read_excel('/home/andre/sandbox/jhu-immuno/journal.pcbi.1003266.s001-2.XLS') resp_cols = [ 'MHC' ] data['y'] = data.Immunogenicity.map({'non-immunogenic': 0, 'immunoge...
Add decision tree classifier attempt.
Add decision tree classifier attempt.
Python
mit
andretadeu/jhu-immuno,andretadeu/jhu-immuno
--- +++ @@ -0,0 +1,24 @@ +import pandas as pd +from sklearn import tree + +# X = [[0, 1], [1, 1]] +# Y = [0, 1] +#clf = tree.DecisionTreeClassifier() +#clf = clf.fit(X, Y) + +data = pd.read_excel('/home/andre/sandbox/jhu-immuno/journal.pcbi.1003266.s001-2.XLS') + +resp_cols = [ 'MHC' ] + +data['y'] = data.Immunogenic...
8adfedd0c30fab796fccac6ec58c09e644a91b2f
shuffle_fastq.py
shuffle_fastq.py
# shuffles the sequences in a fastq file import os import random from Bio import SeqIO import fileinput from argparse import ArgumentParser if __name__ == "__main__": parser = ArgumentParser() parser.add_argument("--fq1", required="True") parser.add_argument("--fq2", required="True") args = parser.pars...
Add script to shuffle paired fastq sequences.
Add script to shuffle paired fastq sequences.
Python
mit
roryk/junkdrawer,roryk/junkdrawer
--- +++ @@ -0,0 +1,25 @@ +# shuffles the sequences in a fastq file +import os +import random +from Bio import SeqIO +import fileinput +from argparse import ArgumentParser + +if __name__ == "__main__": + parser = ArgumentParser() + parser.add_argument("--fq1", required="True") + parser.add_argument("--fq2", r...
ffb5caf83055e734baf711366b6779ecb24a013c
addons/adobe/clone.py
addons/adobe/clone.py
#!/usr/bin/env python from PIL import Image, ImageEnhance import PIL.ImageOps import fnmatch import shutil import os def globPath(path, pattern): result = [] for root, subdirs, files in os.walk(path): for filename in files: if fnmatch.fnmatch(filename, pattern): result.appen...
Add script to generate other adobe themes
Add script to generate other adobe themes
Python
mit
Geequlim/godot-themes
--- +++ @@ -0,0 +1,66 @@ +#!/usr/bin/env python +from PIL import Image, ImageEnhance +import PIL.ImageOps +import fnmatch +import shutil +import os + +def globPath(path, pattern): + result = [] + for root, subdirs, files in os.walk(path): + for filename in files: + if fnmatch.fnmatch(filename,...
c5ecaef62d788b69446181c6ba495cb273bf98ef
altair/examples/scatter_with_rolling_mean.py
altair/examples/scatter_with_rolling_mean.py
""" Scatter Plot with Rolling Mean ------------------------------ A scatter plot with a rolling mean overlay. In this example a 30 day window is used to calculate the mean of the maximum temperature around each date. """ # category: scatter plots import altair as alt from vega_datasets import data source = data.seatt...
Add rolling mean scatter plot example
Add rolling mean scatter plot example
Python
bsd-3-clause
altair-viz/altair,jakevdp/altair
--- +++ @@ -0,0 +1,31 @@ +""" +Scatter Plot with Rolling Mean +------------------------------ +A scatter plot with a rolling mean overlay. In this example a 30 day window +is used to calculate the mean of the maximum temperature around each date. +""" +# category: scatter plots + +import altair as alt +from vega_data...
b3f91806b525ddef50d541f937bed539f9bae20a
mezzanine/project_template/deploy/live_settings.py
mezzanine/project_template/deploy/live_settings.py
DATABASES = { "default": { # Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle". "ENGINE": "django.db.backends.postgresql_psycopg2", # DB name or path to database file if using sqlite3. "NAME": "%(proj_name)s", # Not used with sqlite3. "USER": "%(proj_na...
DATABASES = { "default": { # Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle". "ENGINE": "django.db.backends.postgresql_psycopg2", # DB name or path to database file if using sqlite3. "NAME": "%(proj_name)s", # Not used with sqlite3. "USER": "%(proj_na...
Use cache backend for sessions in deployed settings.
Use cache backend for sessions in deployed settings.
Python
bsd-2-clause
Kniyl/mezzanine,webounty/mezzanine,spookylukey/mezzanine,theclanks/mezzanine,batpad/mezzanine,sjdines/mezzanine,dovydas/mezzanine,readevalprint/mezzanine,eino-makitalo/mezzanine,industrydive/mezzanine,joshcartme/mezzanine,Cajoline/mezzanine,frankier/mezzanine,PegasusWang/mezzanine,biomassives/mezzanine,Skytorn86/mezzan...
--- +++ @@ -26,3 +26,5 @@ "LOCATION": "127.0.0.1:11211", } } + +SESSION_ENGINE = "django.contrib.sessions.backends.cache"
62545500553443863d61d9e5ecc80307c745a227
migrate/20110917T143029-remove-value-dimensions.py
migrate/20110917T143029-remove-value-dimensions.py
import logging from openspending.lib import cubes from openspending import migration, model, mongo log = logging.getLogger(__name__) def up(): group_args = ({'dataset':1}, {}, {'num': 0}, 'function (x, acc) { acc.num += 1 }') before = mongo.db.dimension.group(*group_args) dims = model....
Add migration to remove non-{entity,classifier} dimensions from the database, and to recompute cubes if necessary
Add migration to remove non-{entity,classifier} dimensions from the database, and to recompute cubes if necessary
Python
agpl-3.0
CivicVision/datahub,openspending/spendb,johnjohndoe/spendb,USStateDept/FPA_Core,spendb/spendb,johnjohndoe/spendb,openspending/spendb,nathanhilbert/FPA_Core,pudo/spendb,openspending/spendb,nathanhilbert/FPA_Core,spendb/spendb,CivicVision/datahub,pudo/spendb,USStateDept/FPA_Core,pudo/spendb,nathanhilbert/FPA_Core,USState...
--- +++ @@ -0,0 +1,28 @@ +import logging + +from openspending.lib import cubes +from openspending import migration, model, mongo + +log = logging.getLogger(__name__) + +def up(): + group_args = ({'dataset':1}, {}, {'num': 0}, + 'function (x, acc) { acc.num += 1 }') + + before = mongo.db.dimensi...
c599b5d470cf80b964af1b261a11540516e120df
galpy/potential_src/DehnenSmoothWrapperPotential.py
galpy/potential_src/DehnenSmoothWrapperPotential.py
############################################################################### # DehnenSmoothWrapperPotential.py: Wrapper to smoothly grow a potential ############################################################################### from galpy.potential_src.WrapperPotential import SimpleWrapperPotential class DehnenSm...
Add Dehnen smoothing as a wrapper
Add Dehnen smoothing as a wrapper
Python
bsd-3-clause
jobovy/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy
--- +++ @@ -0,0 +1,58 @@ +############################################################################### +# DehnenSmoothWrapperPotential.py: Wrapper to smoothly grow a potential +############################################################################### +from galpy.potential_src.WrapperPotential import Simple...
bb7bb2e12d3ccbb55f0b0e6db5d0cb79c3ea8079
km_api/know_me/migrations/0013_remove_profileitem_media_resource.py
km_api/know_me/migrations/0013_remove_profileitem_media_resource.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-08-01 14:16 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('know_me', '0012_emergencyitem'), ] operations = [ migrations.RemoveField( ...
Add missing migration for profile items.
Add missing migration for profile items. When we moved profile item image content into a separate model, we missed this migration when rebasing.
Python
apache-2.0
knowmetools/km-api,knowmetools/km-api,knowmetools/km-api,knowmetools/km-api
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.3 on 2017-08-01 14:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('know_me', '0012_emergencyitem'), + ] + + operations = [ ...
26fcbefee171f8d56504a7eba121027f0c5be8b5
lms/djangoapps/grades/migrations/0013_persistentsubsectiongradeoverride.py
lms/djangoapps/grades/migrations/0013_persistentsubsectiongradeoverride.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('grades', '0012_computegradessetting'), ] operations = [ migrations.CreateModel( name='PersistentSubsectionGradeO...
Add migration for new overrides table
Add migration for new overrides table
Python
agpl-3.0
Lektorium-LLC/edx-platform,CredoReference/edx-platform,arbrandes/edx-platform,msegado/edx-platform,pabloborrego93/edx-platform,edx-solutions/edx-platform,TeachAtTUM/edx-platform,gsehub/edx-platform,TeachAtTUM/edx-platform,proversity-org/edx-platform,Lektorium-LLC/edx-platform,stvstnfrd/edx-platform,proversity-org/edx-p...
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('grades', '0012_computegradessetting'), + ] + + operations = [ + migrations.CreateModel( + ...
aff827e9cc02bcee6cf8687e1dff65f39daaf6c6
workshops/test/test_landing_page.py
workshops/test/test_landing_page.py
from django.core.urlresolvers import reverse from django.test import TestCase from mock import patch from datetime import date class FakeDate(date): "A fake replacement for date that can be mocked for testing." pass @classmethod def today(cls): return cls(2013, 12, 7) @patch('workshops.models...
Add a failing test to the landing page to check for upcoming events.
Add a failing test to the landing page to check for upcoming events.
Python
mit
shapiromatron/amy,pbanaszkiewicz/amy,swcarpentry/amy,vahtras/amy,pbanaszkiewicz/amy,pbanaszkiewicz/amy,wking/swc-amy,vahtras/amy,shapiromatron/amy,swcarpentry/amy,swcarpentry/amy,wking/swc-amy,wking/swc-amy,shapiromatron/amy,vahtras/amy,wking/swc-amy
--- +++ @@ -0,0 +1,34 @@ +from django.core.urlresolvers import reverse +from django.test import TestCase +from mock import patch +from datetime import date + +class FakeDate(date): + "A fake replacement for date that can be mocked for testing." + pass + + @classmethod + def today(cls): + return cls...
ea26478495d5aec6925e32c9a87245bf2e1e4bc8
rps/errors.py
rps/errors.py
gestures = ["rock", "paper", "scissors"] def verify_move(player_move): if player_move not in gestures: raise Exception("Wrong input!") return player_move # let's catch an exception try: player_move = verify_move(input("[rock,paper,scissors]: ")) print("The move was correct.") except Exception:...
Add script demonstrating raising and catching Exceptions.
Add script demonstrating raising and catching Exceptions.
Python
mit
kubkon/ee106-additional-material
--- +++ @@ -0,0 +1,13 @@ +gestures = ["rock", "paper", "scissors"] + +def verify_move(player_move): + if player_move not in gestures: + raise Exception("Wrong input!") + return player_move + +# let's catch an exception +try: + player_move = verify_move(input("[rock,paper,scissors]: ")) + print("The...
947c9ef100686fa1ec0acaa10bc49bf6c785665b
ffflash/container.py
ffflash/container.py
from os import path from ffflash import RELEASE, log, now, timeout from ffflash.lib.clock import epoch_repr from ffflash.lib.data import merge_dicts from ffflash.lib.files import read_json_file, write_json_file class Container: def __init__(self, spec, filename): self._spec = spec self._location ...
Use unified class for json output
Use unified class for json output
Python
bsd-3-clause
spookey/ffflash,spookey/ffflash
--- +++ @@ -0,0 +1,37 @@ +from os import path + +from ffflash import RELEASE, log, now, timeout +from ffflash.lib.clock import epoch_repr +from ffflash.lib.data import merge_dicts +from ffflash.lib.files import read_json_file, write_json_file + + +class Container: + def __init__(self, spec, filename): + sel...
c206969facfc0e46d7ec4d3f60ce2e6a07956dbd
14B-088/HI/analysis/run_filfinder.py
14B-088/HI/analysis/run_filfinder.py
from fil_finder import fil_finder_2D from basics import BubbleFinder2D from spectral_cube.lower_dimensional_structures import Projection from astropy.io import fits from radio_beam import Beam from astropy.wcs import WCS import astropy.units as u import matplotlib.pyplot as p ''' Filaments in M33? Why not? ''' mom0_...
Use filfinder to get the average radial width of features in the moment 0
Use filfinder to get the average radial width of features in the moment 0
Python
mit
e-koch/VLA_Lband,e-koch/VLA_Lband
--- +++ @@ -0,0 +1,33 @@ + +from fil_finder import fil_finder_2D +from basics import BubbleFinder2D +from spectral_cube.lower_dimensional_structures import Projection +from astropy.io import fits +from radio_beam import Beam +from astropy.wcs import WCS +import astropy.units as u +import matplotlib.pyplot as p + +'''...
da5fed886d519b271a120820668d21518872f52c
remove_duplicates_from_sorted_array.py
remove_duplicates_from_sorted_array.py
''' Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For example, Given input array A = [1,1,2], Your function should return length = 2, and A is now [...
Remove Duplicates from Sorted Array problem
Remove Duplicates from Sorted Array problem
Python
apache-2.0
zsmountain/leetcode,zsmountain/leetcode,zsmountain/leetcode
--- +++ @@ -0,0 +1,39 @@ +''' +Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. + +Do not allocate extra space for another array, you must do this in place with constant memory. + +For example, +Given input array A = [1,1,2], + +Your function shou...
207116ee7ba8d8da521f497997da90066831a551
django3_codemods/replace_unicode_with_str.py
django3_codemods/replace_unicode_with_str.py
import sys from bowler import Query ( Query(sys.argv[1]) .select_function("__unicode__") .rename('__str__') .idiff() ), ( Query(sys.argv[1]) .select_method("__unicode__") .is_call() .rename('__str__') .idiff() )
Add codemod to replace __unicode__ with __str__
Add codemod to replace __unicode__ with __str__
Python
apache-2.0
edx/repo-tools,edx/repo-tools
--- +++ @@ -0,0 +1,18 @@ +import sys + +from bowler import Query + + +( + Query(sys.argv[1]) + .select_function("__unicode__") + .rename('__str__') + .idiff() +), +( + Query(sys.argv[1]) + .select_method("__unicode__") + .is_call() + .rename('__str__') + .idiff() +)
2d1624f088431e5f71214988499f732695a82b16
lbrynet/__init__.py
lbrynet/__init__.py
import logging __version__ = "0.15.0rc3" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler())
import logging __version__ = "0.15.0rc4" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler())
Bump version 0.15.0rc3 --> 0.15.0rc4
Bump version 0.15.0rc3 --> 0.15.0rc4 Signed-off-by: Jack Robison <40884020c67726395ea162083a125620dc32cdab@lbry.io>
Python
mit
lbryio/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry,zestyr/lbry,zestyr/lbry
--- +++ @@ -1,6 +1,6 @@ import logging -__version__ = "0.15.0rc3" +__version__ = "0.15.0rc4" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler())
4764b5248cf91042a12ce6aef77a04c37360eb4f
pyglab/pyglab.py
pyglab/pyglab.py
import requests class Pyglab(object): def __init__(self, token): self.token = token self.headers = {'PRIVATE-TOKEN', token} self.user = None def sudo(self, user): """Permanently set a different username. Returns the old username.""" previous_user = self.user s...
Add initial shell of Pyglab class.
Add initial shell of Pyglab class.
Python
mit
sloede/pyglab,sloede/pyglab
--- +++ @@ -0,0 +1,15 @@ +import requests + + +class Pyglab(object): + def __init__(self, token): + self.token = token + self.headers = {'PRIVATE-TOKEN', token} + self.user = None + + def sudo(self, user): + """Permanently set a different username. Returns the old username.""" + + ...
70e04b20c5d78b41546aa4ea1a1e2fd82af7527f
comrade/http/__init__.py
comrade/http/__init__.py
from django.core.serializers import json, serialize from django.db.models.query import QuerySet from django.http import HttpResponse from django.utils import simplejson class HttpJsonResponse(HttpResponse): def __init__(self, object, status=None): if isinstance(object, QuerySet): content = seri...
Add JSON HttpResponse that does the encoding for you.
Add JSON HttpResponse that does the encoding for you.
Python
mit
bueda/django-comrade
--- +++ @@ -0,0 +1,14 @@ +from django.core.serializers import json, serialize +from django.db.models.query import QuerySet +from django.http import HttpResponse +from django.utils import simplejson + +class HttpJsonResponse(HttpResponse): + def __init__(self, object, status=None): + if isinstance(object, Qu...
6ad081e91e337e1627b70674109f45ba35248f8c
zou/migrations/versions/e839d6603c09_add_person_id_to_shot_history.py
zou/migrations/versions/e839d6603c09_add_person_id_to_shot_history.py
"""add person id to shot history Revision ID: e839d6603c09 Revises: 346250b5304c Create Date: 2020-12-14 12:00:19.045783 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils import sqlalchemy_utils import uuid # revision identifiers, used by Alembic. revision = 'e839d6603c09' down_revision = '3...
Add missing migration file to the repo
[qa] Add missing migration file to the repo
Python
agpl-3.0
cgwire/zou
--- +++ @@ -0,0 +1,34 @@ +"""add person id to shot history + +Revision ID: e839d6603c09 +Revises: 346250b5304c +Create Date: 2020-12-14 12:00:19.045783 + +""" +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utils +import sqlalchemy_utils +import uuid + +# revision identifiers, used by Alembic. +re...
c25cebf31648466111cb3d576e0a398bb4220ccf
sabnzbd/test_cleanupfilename.py
sabnzbd/test_cleanupfilename.py
import unittest from cleanupfilename import rename class TestRename(unittest.TestCase): files = [] dirs = [] def setUp(self): self.files = [('filename-sample.x264.mp4', 'filename.mp4'), ('filename.mp4', 'filename.mp4')] self.dirs = [('filename sample mp4', 'filename'...
Add test for sabnzbd cleanupfilename.py
Add test for sabnzbd cleanupfilename.py
Python
bsd-3-clause
FreekKalter/linux-scripts,FreekKalter/linux-scripts,FreekKalter/linux-scripts,FreekKalter/linux-scripts
--- +++ @@ -0,0 +1,25 @@ +import unittest +from cleanupfilename import rename + + +class TestRename(unittest.TestCase): + files = [] + dirs = [] + + def setUp(self): + self.files = [('filename-sample.x264.mp4', 'filename.mp4'), + ('filename.mp4', 'filename.mp4')] + self.dir...
31bb487a2f75268cb0b60ef4539935df83b68a84
quiz/3-radixsort.py
quiz/3-radixsort.py
#!/usr/bin/env python3 def make_arr(text): return text.strip().split(' ') def print_arr(arr): for t in arr: print(t, end=' ') print() def solve_q1(arr, time): for t in range(len(arr[0]) - 1, time - 1, -1): arr = sorted(arr, key=lambda x: x[t]) return arr def msd_radix_sort(ar...
Add auto solver for "W3-Radix Sorts".
Add auto solver for "W3-Radix Sorts".
Python
mit
hghwng/mooc-algs2,hghwng/mooc-algs2
--- +++ @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 + + +def make_arr(text): + return text.strip().split(' ') + + +def print_arr(arr): + for t in arr: + print(t, end=' ') + print() + + +def solve_q1(arr, time): + for t in range(len(arr[0]) - 1, time - 1, -1): + arr = sorted(arr, key=lambda x: x...
896270bcd99b26e4128fd35dd3821a59807ae850
doc/model/model_decla.py
doc/model/model_decla.py
#autogenerated by sqlautocode from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relation engine = create_engine('mysql://monty:passwd@localhost/test_dia') DeclarativeBase = declarative_base() metadata = DeclarativeBase.metadata metadata.bind = engine class Me...
Add the model.py file declarative generated from mysql.
Add the model.py file declarative generated from mysql.
Python
mit
mteule/StationMeteo,mteule/StationMeteo
--- +++ @@ -0,0 +1,47 @@ +#autogenerated by sqlautocode + +from sqlalchemy import * +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import relation + +engine = create_engine('mysql://monty:passwd@localhost/test_dia') +DeclarativeBase = declarative_base() +metadata = DeclarativeBase.metad...
7aab44f006a6412d8f169c3f9a801f41a6ea0a95
migrations/versions/880_remove_invalid_draft_dos2_brief_dates_again.py
migrations/versions/880_remove_invalid_draft_dos2_brief_dates_again.py
"""Remove dates from draft dos2 briefs. This is identical to the previous migration but will be run again to cover any draft briefs with invalid dates that could have appeared during the previous API rollout process (after the previous migration but before the code propogated fully to the ec2 instances). Revision ID: ...
Remove start dates for the second time from draft dos2 briefs
Remove start dates for the second time from draft dos2 briefs This is identical to the previous migration but will be run again to cover any draft briefs with invalid dates that could have appeared during the previous API rollout process (after the previous migration but before the code propogated fully to the ec2 ins...
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
--- +++ @@ -0,0 +1,68 @@ +"""Remove dates from draft dos2 briefs. +This is identical to the previous migration but will be run again to cover any draft briefs with invalid +dates that could have appeared during the previous API rollout process (after the previous migration but before +the code propogated fully to the...
3ebae0f57ae3396213eb28b6fc7a23ff3e3c4980
uml-to-cpp.py
uml-to-cpp.py
# Copyright (C) 2017 Bran Seals. All rights reserved. # Created: 2017-06-05 print("== UML to CPP ==") print("Create or modify C++ header and implementation files by plaintext UML.") #print("Enter a UML filename: ") # file import currently disabled # check if file isn't too bonkers #uml = [] # pull UML into memory as s...
Create file and add pseudocode
Create file and add pseudocode
Python
mit
BranSeals/uml-to-cpp
--- +++ @@ -0,0 +1,50 @@ +# Copyright (C) 2017 Bran Seals. All rights reserved. +# Created: 2017-06-05 + +print("== UML to CPP ==") +print("Create or modify C++ header and implementation files by plaintext UML.") +#print("Enter a UML filename: ") # file import currently disabled +# check if file isn't too bonkers +#u...
e2ed635fb3289a5b45f5f15cd1eb543d87fb93d7
wafer/talks/tests/test_review_views.py
wafer/talks/tests/test_review_views.py
"""Tests for wafer.talk review form behaviour.""" from django.test import Client, TestCase from django.urls import reverse from reversion import revisions from reversion.models import Version from wafer.talks.models import (SUBMITTED, UNDER_CONSIDERATION, ReviewAspect, Review) from wa...
Add test for posting a review through the view
Add test for posting a review through the view
Python
isc
CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer
--- +++ @@ -0,0 +1,44 @@ +"""Tests for wafer.talk review form behaviour.""" + +from django.test import Client, TestCase +from django.urls import reverse + +from reversion import revisions +from reversion.models import Version + +from wafer.talks.models import (SUBMITTED, UNDER_CONSIDERATION, + ...
466410249867b3eadbe5e2b59c46c95ecd288c6c
python_scripts/solr_query_fetch_all.py
python_scripts/solr_query_fetch_all.py
#!/usr/bin/python import requests import ipdb import time import csv import sys import pysolr def fetch_all( solr, query ) : documents = [] num_matching_documents = solr.search( query ).hits start = 0 rows = num_matching_documents sys.stderr.write( ' starting fetch for ' + query ) while ( le...
Add script for word counts
Add script for word counts
Python
agpl-3.0
berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter...
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/python + +import requests +import ipdb +import time +import csv +import sys +import pysolr + +def fetch_all( solr, query ) : + documents = [] + num_matching_documents = solr.search( query ).hits + + start = 0 + rows = num_matching_documents + + sys.stderr.write( ' s...
7182af317116db7eb3f7a278b3487ad91a3b3331
high-res-slider.py
high-res-slider.py
import functools import numpy as np import dask.array as da from magicgui.widgets import Slider, Container import napari # stack = ... # your dask array # stack2 = stack[::2, ::2, ::2] # stack4 = stack2[::2, ::2, ::2] # 👆 quick and easy multiscale pyramid, don't do this really # see https://github.com/dask/dask-imag...
Add example for a clunky 3D high resolution loupe for napari
Add example for a clunky 3D high resolution loupe for napari
Python
bsd-3-clause
jni/useful-histories
--- +++ @@ -0,0 +1,77 @@ +import functools +import numpy as np +import dask.array as da +from magicgui.widgets import Slider, Container +import napari + +# stack = ... # your dask array +# stack2 = stack[::2, ::2, ::2] +# stack4 = stack2[::2, ::2, ::2] +# 👆 quick and easy multiscale pyramid, don't do this really +#...
72f32099411644a3fed6103430f7dd78fb0929a5
konstrukteur/ContentParser.py
konstrukteur/ContentParser.py
# # Konstrukteur - Static website generator # Copyright 2013 Sebastian Fastner # import glob, os from jasy.core import Console import konstrukteur.Language import konstrukteur.Util class ContentParser: """ Content parser class for Konstrukteur """ def __init__(self, extensions, fixJasyCommands, defaultLanguage): ...
Add new content parser class (based upon code in Konstruktuer)
Add new content parser class (based upon code in Konstruktuer)
Python
mit
fastner/konstrukteur,fastner/konstrukteur,fastner/konstrukteur
--- +++ @@ -0,0 +1,88 @@ +# +# Konstrukteur - Static website generator +# Copyright 2013 Sebastian Fastner +# + +import glob, os +from jasy.core import Console +import konstrukteur.Language +import konstrukteur.Util + +class ContentParser: + """ Content parser class for Konstrukteur """ + + + def __init__(self, exten...
8939e873f4ea61169f9384eded5b8c603cfde988
crypto/PRESUBMIT.py
crypto/PRESUBMIT.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Chromium presubmit script for src/net. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details on the presubmit ...
Add crypto pre-submit that will add the openssl builder to the default try-bot list.
Add crypto pre-submit that will add the openssl builder to the default try-bot list. BUG=None TEST=git try should run a linux_redux try job too. Review URL: http://codereview.chromium.org/9235031 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@119094 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
ropik/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,gavinp/chromium,yitian134/chromium,yitian134/chromium,gavinp/chromium,gavinp/chromium,ropik/chromium,yitian134/chromium,ropik/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,ropik/chromium,adobe/chromium,ropik/chr...
--- +++ @@ -0,0 +1,14 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Chromium presubmit script for src/net. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts ...
50d05aabc2eb1d5bcb20d457dd05d2882b983afa
install_and_run.py
install_and_run.py
# 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 required by applica...
Add installation script for profiler.
Add installation script for profiler.
Python
apache-2.0
tensorflow/profiler,tensorflow/profiler,tensorflow/profiler,tensorflow/profiler,tensorflow/profiler
--- +++ @@ -0,0 +1,58 @@ +# 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-...
734967196c8f0577b218802c16d9eab31c9e9054
problem_36.py
problem_36.py
from time import time def is_palindrome(s): for idx in range(len(s)/2): if s[idx] != s[-1*idx - 1]: return False return True def main(): palindrom_nums = [num for num in range(int(1e6)) if is_palindrome(str(num)) and is_palindrome(str(bin(num))[2:])] print 'Palindroms:', palindro...
Add problem 36, palindrome binaries
Add problem 36, palindrome binaries
Python
mit
dimkarakostas/project-euler
--- +++ @@ -0,0 +1,20 @@ +from time import time + + +def is_palindrome(s): + for idx in range(len(s)/2): + if s[idx] != s[-1*idx - 1]: + return False + return True + + +def main(): + palindrom_nums = [num for num in range(int(1e6)) if is_palindrome(str(num)) and is_palindrome(str(bin(num))[...
8fddde260af6ea1e6de8491dd99dca671634327c
test/operator/utility_test.py
test/operator/utility_test.py
# Copyright 2014, 2015 The ODL development group # # This file is part of ODL. # # ODL is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. ...
Add test for the matrix representation function.
TST: Add test for the matrix representation function. Add a small test in R3 for the matrix representation function, to see that one gets the same matrix back.
Python
mpl-2.0
odlgroup/odl,odlgroup/odl,kohr-h/odl,kohr-h/odl,aringh/odl,aringh/odl
--- +++ @@ -0,0 +1,70 @@ +# Copyright 2014, 2015 The ODL development group +# +# This file is part of ODL. +# +# ODL is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (...
8b92e55fa202723f7859cd1ea22e835e5c693807
Instanssi/kompomaatti/misc/awesometime.py
Instanssi/kompomaatti/misc/awesometime.py
# -*- coding: utf-8 -*- from datetime import datetime, timedelta def todayhelper(): today = datetime.today() return datetime(day=today.day, year=today.year, month=today.month) def format_single_helper(t): now = datetime.now() today = todayhelper() tomorrow = today + timedelta(days=1) the_day_...
Add some time handling functions
Add some time handling functions
Python
mit
Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +from datetime import datetime, timedelta + +def todayhelper(): + today = datetime.today() + return datetime(day=today.day, year=today.year, month=today.month) + +def format_single_helper(t): + now = datetime.now() + today = todayhelper() + tomorrow =...
bca4a0a0dda95306fe126191166e733c7ccea3ee
nodeconductor/backup/perms.py
nodeconductor/backup/perms.py
from nodeconductor.core.permissions import StaffPermissionLogic PERMISSION_LOGICS = ( ('backup.BackupSchedule', StaffPermissionLogic(any_permission=True)), ('backup.Backup', StaffPermissionLogic(any_permission=True)), )
Add staff permissions for backup models
Add staff permissions for backup models
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
--- +++ @@ -0,0 +1,7 @@ +from nodeconductor.core.permissions import StaffPermissionLogic + + +PERMISSION_LOGICS = ( + ('backup.BackupSchedule', StaffPermissionLogic(any_permission=True)), + ('backup.Backup', StaffPermissionLogic(any_permission=True)), +)
2fda10a83aa5a4d3080a0ce8751e28a18fc9a3e0
examples/two_point.py
examples/two_point.py
""" Demonstrates plotting multiple linear features with a single ``ax.pole`` call. The real purpose of this example is to serve as an implicit regression test for some oddities in the way axes grid lines are handled in matplotlib and mplstereonet. A 2-vertex line can sometimes be confused for an axes grid line, and t...
Add two-point example to serve as a regression test for gridline/plot distinguishing
Add two-point example to serve as a regression test for gridline/plot distinguishing
Python
mit
joferkington/mplstereonet
--- +++ @@ -0,0 +1,18 @@ +""" +Demonstrates plotting multiple linear features with a single ``ax.pole`` call. + +The real purpose of this example is to serve as an implicit regression test for +some oddities in the way axes grid lines are handled in matplotlib and +mplstereonet. A 2-vertex line can sometimes be conf...
ee85acb7f9f3af91db3bfb4bf766636883f07685
opal/tests/test_core_views.py
opal/tests/test_core_views.py
""" Unittests for opal.core.views """ from opal.core import test from opal.core import views class SerializerTestCase(test.OpalTestCase): def test_serializer_default_will_super(self): s = views.OpalSerializer() with self.assertRaises(TypeError): s.default(None)
Add an extra test for the OpalSerializer
Add an extra test for the OpalSerializer
Python
agpl-3.0
khchine5/opal,khchine5/opal,khchine5/opal
--- +++ @@ -0,0 +1,13 @@ +""" +Unittests for opal.core.views +""" +from opal.core import test + +from opal.core import views + +class SerializerTestCase(test.OpalTestCase): + + def test_serializer_default_will_super(self): + s = views.OpalSerializer() + with self.assertRaises(TypeError): + ...
a0a2017e05af986cd0a7207c429e7dc5e8b3fcd2
tests/test_solver_variable.py
tests/test_solver_variable.py
from gaphas.solver import Variable def test_equality(): v = Variable(3) w = Variable(3) o = Variable(2) assert v == 3 assert 3 == v assert v == w assert not v == o assert v != 2 assert 2 != v assert not 3 != v assert v != o def test_add_to_variable(): v = Variable(3...
Add missing tests for Variable
Add missing tests for Variable
Python
lgpl-2.1
amolenaar/gaphas
--- +++ @@ -0,0 +1,108 @@ +from gaphas.solver import Variable + + +def test_equality(): + v = Variable(3) + w = Variable(3) + o = Variable(2) + + assert v == 3 + assert 3 == v + assert v == w + assert not v == o + + assert v != 2 + assert 2 != v + assert not 3 != v + assert v != o + +...
e87982d03edeb7c16d3c183309adfff4be50d168
gui/qt.py
gui/qt.py
from lib.version import AMON_VERSION from lib.keybase import KeybaseUser from lib.gmail import GmailUser from lib.addresses import AddressBook import lib.gpg as gpg import sys import logging import json from PyQt4 import QtGui class Amon(QtGui.QMainWindow): def __init__(self): super(Amon, self).__init__(...
Add Qt4 file to start on creating a Qt-based GUI
Add Qt4 file to start on creating a Qt-based GUI
Python
unlicense
CodingAnarchy/Amon
--- +++ @@ -0,0 +1,18 @@ +from lib.version import AMON_VERSION +from lib.keybase import KeybaseUser +from lib.gmail import GmailUser +from lib.addresses import AddressBook +import lib.gpg as gpg + +import sys +import logging +import json +from PyQt4 import QtGui + + +class Amon(QtGui.QMainWindow): + def __init__(s...
8ae3e44b0a43f382c98194b9caa097b62de899ef
nlpppln/save_ner_data.py
nlpppln/save_ner_data.py
#!/usr/bin/env python import click import os import codecs import json import pandas as pd @click.command() @click.argument('input_dir', type=click.Path(exists=True)) @click.argument('output_file', type=click.Path()) def nerstats(input_dir, output_file): output_dir = os.path.dirname(output_file) if not os.pat...
Add script to save ner data to a csv file
Add script to save ner data to a csv file
Python
apache-2.0
WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/env python +import click +import os +import codecs +import json +import pandas as pd + + +@click.command() +@click.argument('input_dir', type=click.Path(exists=True)) +@click.argument('output_file', type=click.Path()) +def nerstats(input_dir, output_file): + output_dir = os.pat...
59de1a12d44245b69ade0d4703c98bf772681751
user_management/models/tests/test_admin_forms.py
user_management/models/tests/test_admin_forms.py
from django.core.exceptions import ValidationError from django.test import TestCase from .. import admin_forms from . factories import UserFactory class UserCreationFormTest(TestCase): def test_clean_email(self): email = 'test@example.com' form = admin_forms.UserCreationForm() form.clean...
Add tests for User admin_forms
Add tests for User admin_forms
Python
bsd-2-clause
incuna/django-user-management,incuna/django-user-management
--- +++ @@ -0,0 +1,52 @@ +from django.core.exceptions import ValidationError +from django.test import TestCase + +from .. import admin_forms +from . factories import UserFactory + + +class UserCreationFormTest(TestCase): + def test_clean_email(self): + email = 'test@example.com' + + form = admin_form...
bae50495106ce5c9cb39143a58e0e73a4e823d29
loader.py
loader.py
from __future__ import print_function, absolute_import, unicode_literals, division from stackable.stack import Stack from stackable.utils import StackablePickler from stackable.network import StackableSocket, StackablePacketAssembler from sys import modules from types import ModuleType class DispatchLoader(object): d...
Implement DispatchLoader (metapath import hook)
Implement DispatchLoader (metapath import hook)
Python
mit
joushou/dispatch,joushou/dispatch
--- +++ @@ -0,0 +1,41 @@ +from __future__ import print_function, absolute_import, unicode_literals, division +from stackable.stack import Stack +from stackable.utils import StackablePickler +from stackable.network import StackableSocket, StackablePacketAssembler +from sys import modules +from types import ModuleType ...
5d795253180ef11117ae27447fa597fa15b40734
tests/test_graph.py
tests/test_graph.py
import os from click.testing import CliRunner from cli.script import cli def get_graph_code(): return ''' from copy import deepcopy as dc class StringCopier(object): def __init__(self): self.copied_strings = set() def copy(self): string1 = 'this' string2 = dc(string1) s...
Add testing for graphing code
Add testing for graphing code
Python
mit
LaurEars/codegrapher
--- +++ @@ -0,0 +1,49 @@ +import os + +from click.testing import CliRunner + +from cli.script import cli + + +def get_graph_code(): + return ''' +from copy import deepcopy as dc + +class StringCopier(object): + def __init__(self): + self.copied_strings = set() + + def copy(self): + string1 = 't...
5ae58621bd766aeaa6f1838397b045039568887c
platesolve.py
platesolve.py
import babeldix import sys import operator # Print solutions in order of increasing score for plate in sys.argv[1:]: solns = babeldix.Plates.get_solutions(plate) for (soln,score) in sorted(solns.items(), key=operator.itemgetter(1)): print '{0:s} {1:d} {2:s}'.format(plate,score,soln)
Add driver to find plate solutions
Add driver to find plate solutions
Python
mit
dkirkby/babeldix
--- +++ @@ -0,0 +1,11 @@ +import babeldix + +import sys +import operator + +# Print solutions in order of increasing score + +for plate in sys.argv[1:]: + solns = babeldix.Plates.get_solutions(plate) + for (soln,score) in sorted(solns.items(), key=operator.itemgetter(1)): + print '{0:s} {1:d} {2:s}'.form...
c1bfe92878edc3f9598a6d97046775cb8d9b0aa0
depot/migrations/0009_auto_20170330_1342.py
depot/migrations/0009_auto_20170330_1342.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-30 13:42 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('depot', '0008_auto_20170330_0855'), ] operations = [ migrations.AlterField(...
Make migration for item-visibility change
Make migration for item-visibility change
Python
agpl-3.0
verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2017-03-30 13:42 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('depot', '0008_auto_20170330_0855'), + ] + + oper...
0e53f398bf2cf885393865ec1f899308bb56625b
examples/create_a_view_low_level.py
examples/create_a_view_low_level.py
""" A low level example: This is how JenkinsAPI creates views """ import requests import json url = 'http://localhost:8080/newView' str_view_name = "ddsfddfd" params = {}# {'name': str_view_name} headers = {'Content-Type': 'application/x-www-form-urlencoded'} data = { "mode": "hudson.model.ListView", #"Submit"...
Add a low-level example for creating views.
Add a low-level example for creating views.
Python
mit
mistermocha/jenkinsapi,imsardine/jenkinsapi,mistermocha/jenkinsapi,JohnLZeller/jenkinsapi,JohnLZeller/jenkinsapi,aerickson/jenkinsapi,zaro0508/jenkinsapi,imsardine/jenkinsapi,zaro0508/jenkinsapi,jduan/jenkinsapi,domenkozar/jenkinsapi,mistermocha/jenkinsapi,jduan/jenkinsapi,salimfadhley/jenkinsapi,salimfadhley/jenkinsap...
--- +++ @@ -0,0 +1,19 @@ +""" +A low level example: +This is how JenkinsAPI creates views +""" +import requests +import json + +url = 'http://localhost:8080/newView' +str_view_name = "ddsfddfd" +params = {}# {'name': str_view_name} +headers = {'Content-Type': 'application/x-www-form-urlencoded'} +data = { + "mode"...
4c73cad398d5dac85b264187f709a860f356b311
smipyping/_mysqldbmixin.py
smipyping/_mysqldbmixin.py
#!/usr/bin/env python # (C) Copyright 2017 Inova Development Inc. # All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
Add new file with mixin for mysql
Add new file with mixin for mysql
Python
mit
KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping
--- +++ @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# (C) Copyright 2017 Inova Development Inc. +# All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.a...
c57c672aae98fb5b280f70b68ac27fc2d94a243f
tests/estimator/classifier/RandomForestClassifier/RandomForestClassifierGoTest.py
tests/estimator/classifier/RandomForestClassifier/RandomForestClassifierGoTest.py
# -*- coding: utf-8 -*- from unittest import TestCase from sklearn.ensemble import RandomForestClassifier from tests.estimator.classifier.Classifier import Classifier from tests.language.Go import Go class RandomForestClassifierGoTest(Go, Classifier, TestCase): def setUp(self): super(RandomForestClass...
Add test class to cover the RandomForestClassifier in Go
Add test class to cover the RandomForestClassifier in Go
Python
bsd-3-clause
nok/sklearn-porter
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from unittest import TestCase + +from sklearn.ensemble import RandomForestClassifier + +from tests.estimator.classifier.Classifier import Classifier +from tests.language.Go import Go + + +class RandomForestClassifierGoTest(Go, Classifier, TestCase): + + def setU...
ab99f855f708dec213c9eea1489643c01526e0b0
lib/bridgedb/test/test_parse_versions.py
lib/bridgedb/test/test_parse_versions.py
# -*- coding: utf-8 -*- #_____________________________________________________________________________ # # This file is part of BridgeDB, a Tor bridge distribution system. # # :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org> # please also see AUTHORS file # :copyright: (c) 2014, The Tor Proje...
Add unittests for bridgedb.parse.versions module.
Add unittests for bridgedb.parse.versions module.
Python
bsd-3-clause
pagea/bridgedb,pagea/bridgedb
--- +++ @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +#_____________________________________________________________________________ +# +# This file is part of BridgeDB, a Tor bridge distribution system. +# +# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org> +# please also see AUTHORS file +# ...
1a4db50c848a3e7bb1323ae9e6b26c884187c575
training/level-1-the-zen-of-python/dragon-warrior/fibonacci/rwharris-nd_fibonacci.py
training/level-1-the-zen-of-python/dragon-warrior/fibonacci/rwharris-nd_fibonacci.py
def even_fibonacci_sum(a:int,b:int,max:int) -> int: temp = 0 sum = 0 while (b <= max): if (b%2 == 0): sum += b temp = a + b a = b b = temp print(sum) even_fibonacci_sum(1,2,4000000)
Add my fibonacci sequence homework.
Add my fibonacci sequence homework.
Python
artistic-2.0
bigfatpanda-training/pandas-practical-python-primer,bigfatpanda-training/pandas-practical-python-primer
--- +++ @@ -0,0 +1,14 @@ +def even_fibonacci_sum(a:int,b:int,max:int) -> int: + temp = 0 + sum = 0 + + while (b <= max): + if (b%2 == 0): + sum += b + temp = a + b + a = b + b = temp + + print(sum) + +even_fibonacci_sum(1,2,4000000)
f14c483283984b793f1209255e059d7b9deb414c
migrations/versions/8081a5906af_.py
migrations/versions/8081a5906af_.py
"""empty message Revision ID: 8081a5906af Revises: 575d8824e34c Create Date: 2015-08-25 18:04:56.738898 """ # revision identifiers, used by Alembic. revision = '8081a5906af' down_revision = '575d8824e34c' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - pl...
Add in the db migration
Add in the db migration
Python
mit
MaxPresman/cfapi,smalley/cfapi,smalley/cfapi,codeforamerica/cfapi,codeforamerica/cfapi,MaxPresman/cfapi,MaxPresman/cfapi,smalley/cfapi
--- +++ @@ -0,0 +1,26 @@ +"""empty message + +Revision ID: 8081a5906af +Revises: 575d8824e34c +Create Date: 2015-08-25 18:04:56.738898 + +""" + +# revision identifiers, used by Alembic. +revision = '8081a5906af' +down_revision = '575d8824e34c' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ...
a4bc16a375dc30e37034993bd07d3014f3b936e1
migrations/versions/201610041721_8b5ab7da2d5_fix_corrupt_abstract_field_data.py
migrations/versions/201610041721_8b5ab7da2d5_fix_corrupt_abstract_field_data.py
"""Fix corrupt abstract field data Revision ID: 8b5ab7da2d5 Revises: 52d970fb6a74 Create Date: 2016-10-04 17:21:19.186125 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '8b5ab7da2d5' down_revision = '52d970fb6a74' def upgrade(): # We don't want any dicts...
Fix corrupt abstract field data
Fix corrupt abstract field data
Python
mit
pferreir/indico,mic4ael/indico,ThiefMaster/indico,mvidalgarcia/indico,DirkHoffmann/indico,indico/indico,DirkHoffmann/indico,mvidalgarcia/indico,indico/indico,pferreir/indico,indico/indico,ThiefMaster/indico,OmeGak/indico,DirkHoffmann/indico,indico/indico,mic4ael/indico,mic4ael/indico,mic4ael/indico,ThiefMaster/indico,O...
--- +++ @@ -0,0 +1,34 @@ +"""Fix corrupt abstract field data + +Revision ID: 8b5ab7da2d5 +Revises: 52d970fb6a74 +Create Date: 2016-10-04 17:21:19.186125 +""" + +import sqlalchemy as sa +from alembic import op + + +# revision identifiers, used by Alembic. +revision = '8b5ab7da2d5' +down_revision = '52d970fb6a74' + + +...
ef745ed086ebd8e77e158c89b577c77296630320
Python/118_Pascals_Triangle.py
Python/118_Pascals_Triangle.py
class Solution(object): def generate(self, numRows): """ :type numRows: int :rtype: List[List[int]] """ res = [[1],[1,1]] if numRows == 0: return [] elif numRows == 1: return [[1]] else: old = [1,1] for i in xrange(n...
Add solution for 118 pascals triangle
Add solution for 118 pascals triangle
Python
mit
comicxmz001/LeetCode,comicxmz001/LeetCode
--- +++ @@ -0,0 +1,25 @@ +class Solution(object): + def generate(self, numRows): + """ + :type numRows: int + :rtype: List[List[int]] + """ + res = [[1],[1,1]] + if numRows == 0: + return [] + elif numRows == 1: + return [[1]] + else: + ...
a8b524318d7f9d4406193d610b2bb3ef8e56e147
examples/frameless_drag_region.py
examples/frameless_drag_region.py
import webview ''' This example demonstrates a user-provided "drag region" to move a frameless window around, whilst maintaining normal mouse down/move events elsewhere. This roughly replicates `-webkit-drag-region`. ''' html = ''' <head> <style type="text/css"> .pywebview-drag-region { width:...
Add frameless drag region example.
Add frameless drag region example.
Python
bsd-3-clause
r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview
--- +++ @@ -0,0 +1,34 @@ +import webview + +''' +This example demonstrates a user-provided "drag region" to move a frameless window +around, whilst maintaining normal mouse down/move events elsewhere. This roughly +replicates `-webkit-drag-region`. +''' + +html = ''' +<head> + <style type="text/css"> + .pyw...
2a1b46740c4cf14f7db4f344431aced9bf06d1e7
scripts/sync_for_real.py
scripts/sync_for_real.py
#!/usr/bin/env python3 import subprocess import sys from time import time def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def main(): nr_fast = 3 while nr_fast > 0: eprint('syncing... ', end='', flush=True) start_t = time() subprocess.Popen('/usr/bin/sync',...
Add a little program that calls sync until is is done
Add a little program that calls sync until is is done
Python
unlicense
paolobolzoni/useful-conf,paolobolzoni/useful-conf,paolobolzoni/useful-conf
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +import subprocess +import sys +from time import time + + + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + + +def main(): + nr_fast = 3 + while nr_fast > 0: + eprint('syncing... ', end='', flush=True) + start_t = time...
91bb7506bd20ed22b8787e7a8b9975cc07e97175
owners_client.py
owners_client.py
# Copyright (c) 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. class OwnersClient(object): """Interact with OWNERS files in a repository. This class allows you to interact with OWNERS files in a repository both...
Add owners client to depot_tools.
[depot_tools][owners] Add owners client to depot_tools. Add an owners API that will be used by Depot Tools to interact with OWNERS files. The API will be implemented using both owners.py and the Gerrit Code-Owners plugin REST API. All Depot Tools code will be modified to use this API. Change-Id: I7cf059a0895dbae105a...
Python
bsd-3-clause
CoherentLabs/depot_tools,CoherentLabs/depot_tools
--- +++ @@ -0,0 +1,33 @@ +# Copyright (c) 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +class OwnersClient(object): + """Interact with OWNERS files in a repository. + + This class allows you to interact wi...
1be4e6f97b3d062c4fa07f70b05305bf32593fd4
dotbriefs/tests/test_smudge.py
dotbriefs/tests/test_smudge.py
import unittest from dotbriefs.smudge import SmudgeTemplate class TestCleanSecret(unittest.TestCase): def setUp(self): self.secrets = {} self.secrets['password'] = 's3cr3t' self.secrets['question'] = 'h1dd3n 4g3nd4' self.template = [] self.template.append(SmudgeTemplate('...
Add test cases for smudge
Add test cases for smudge
Python
bsd-3-clause
oohlaf/dotsecrets
--- +++ @@ -0,0 +1,36 @@ +import unittest + +from dotbriefs.smudge import SmudgeTemplate + + +class TestCleanSecret(unittest.TestCase): + + def setUp(self): + self.secrets = {} + self.secrets['password'] = 's3cr3t' + self.secrets['question'] = 'h1dd3n 4g3nd4' + self.template = [] + ...
254239102955bb8916aab98530251b5cdd79ce50
cypher/siggen.py
cypher/siggen.py
#!/usr/bin/env python import argparse import subprocess import os import shutil import sys from util import write_signature parser = argparse.ArgumentParser() parser.add_argument( "-l", "--language", help="Source code language.", required=True ) TEMP_DIR = os.path.join(os.getcwd(), "cypher", "temp") ...
Add script to write base signatures
Add script to write base signatures
Python
mit
jdkato/codetype,jdkato/codetype
--- +++ @@ -0,0 +1,52 @@ +#!/usr/bin/env python +import argparse +import subprocess +import os +import shutil +import sys + +from util import write_signature + +parser = argparse.ArgumentParser() +parser.add_argument( + "-l", + "--language", + help="Source code language.", + required=True +) + +TEMP_DIR =...
19b13f0fb9b86ec99025bd1baf2c4d5fe757f809
tests/test_tests.py
tests/test_tests.py
import pytest def test_BeautifulSoup_methods_are_overridden( client_request, mock_get_service_and_organisation_counts, ): client_request.logout() page = client_request.get("main.index", _test_page_title=False) with pytest.raises(AttributeError) as exception: page.find("h1") assert st...
Add a test to make sure exception is raised
Add a test to make sure exception is raised None of our code should be raising this exception, so it’s possible it could stop working without us knowing about it. This commit adds a tests to alert us if the override ever does silently stop working (for example because of a change in `BeautifulSoup`)
Python
mit
alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin
--- +++ @@ -0,0 +1,19 @@ +import pytest + + +def test_BeautifulSoup_methods_are_overridden( + client_request, + mock_get_service_and_organisation_counts, +): + client_request.logout() + page = client_request.get("main.index", _test_page_title=False) + + with pytest.raises(AttributeError) as exception: ...