commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
ef8d86704c0930091b8b8f07842e46ffff5bfc34 | Correct empty lines in imported files | benzolius/leo-scripts | correct_empty_lines.py | correct_empty_lines.py | print('\n\n\n\n')
print('Now:\n')
for p in c.all_positions():
try:
# Corrects empty lines around @language python\n@tabwidth -4
if p.h.startswith('@clean') and p.h.endswith('py'):
# Corrects empty lines after @first
if p.h == '@clean manage.py':
splited = p.... | mit | Python | |
08e6a7821283da3898d2eeb4418b6e035effb2f0 | Create spelling_bee.py | Kunalpod/codewars,Kunalpod/codewars | spelling_bee.py | spelling_bee.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Spelling Bee
#Problem level: 6 kyu
def how_many_bees(hive):
if not hive: return 0
count = 0
for i in range(len(hive)):
for j in range(len(hive[i])):
try:
if hive[i][j]=='b' and hive[i][j+1]=='e' and hive[i][j+2]=='e'... | mit | Python | |
706f29660c9fe6f21af3544ea7871ffdfd56db4a | Create sprintreport.py | freedom27/jira_sprint_ledstrip_tracker | sprintreport.py | sprintreport.py | from jirawrapper import JIRAWrapper
import sys
import getopt
if __name__ == "__main__":
argv = sys.argv[1:]
print_help = lambda: print('sprintreport.py [-p project] -c <username:password>')
try:
opts, args = getopt.getopt(argv, "p:c:", ["project=", "credentials="])
except getopt.GetoptError:
... | mit | Python | |
729ab39844bcf6700ccdeb28955e90220d2bab86 | convert ip v4 | vvvvcp/NeverMore | base/convert_ip.py | base/convert_ip.py | import socket
from binascii import hexlify
def convert_ip4_address():
for ip_addr in ['127.0.0.1','192.168.0.1']:
packed_ip_addr = socket.inet_aton(ip_addr)
unpacked_ip_addr = socket.inet_ntoa(packed_ip_addr)
print "IP Address : %s => Packed: %s, Unpacked: %s"\
%(ip_addr, hexlify(pa... | apache-2.0 | Python | |
d427012df993dcffb77de05502fcc170cff6cdcb | Add Notebook test | danielfrg/datasciencebox,danielfrg/datasciencebox,danielfrg/datasciencebox,danielfrg/datasciencebox | datasciencebox/tests/salt/test_notebook.py | datasciencebox/tests/salt/test_notebook.py | import pytest
import requests
import utils
def setup_module(module):
utils.invoke('install', 'notebook')
@utils.vagranttest
def test_salt_formulas():
project = utils.get_test_project()
kwargs = {'test': 'true', '--out': 'json', '--out-indent': '-1'}
out = project.salt('state.sls', args=['ipython.n... | apache-2.0 | Python | |
1380ee2a9eff29bd1271eb0e920b75752f7346c7 | Add (transitional?) db_oldrotate.py that finds exif rotate in old posts. | drougge/wellpapp-pyclient | db_oldrotate.py | db_oldrotate.py | #!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
from pyexiv2 import Image as ExivImage
from db_add import exif2rotation
from dbclient import dbclient
client = dbclient()
posts = client._search_post("SPFrotate", ["rotate"])
print len(posts), "posts"
for post in posts:
if post["rotate"] == -1:
m = post["md5"]
e... | mit | Python | |
7da454aafc0821a6692edb9f829d0bd2e841c534 | Add tool support for DIVINE. | sosy-lab/benchexec,IljaZakharov/benchexec,martin-neuhaeusser/benchexec,IljaZakharov/benchexec,ultimate-pa/benchexec,IljaZakharov/benchexec,dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,martin-neuhaeusser/benchexec,martin-neuhaeusser/... | benchexec/tools/divine.py | benchexec/tools/divine.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... | apache-2.0 | Python | |
35eee909fa90d06efa34a39667db6345725bc177 | Add tool _list paging test | lym/allura-git,apache/incubator-allura,heiths/allura,apache/allura,apache/incubator-allura,lym/allura-git,apache/allura,heiths/allura,lym/allura-git,lym/allura-git,lym/allura-git,heiths/allura,apache/incubator-allura,heiths/allura,apache/allura,heiths/allura,apache/incubator-allura,apache/allura,apache/allura | Allura/allura/tests/functional/test_tool_list.py | Allura/allura/tests/functional/test_tool_list.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | apache-2.0 | Python |
64b03bd53f6f494398818199caabe10138469719 | Create couples-holding-hands.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode | Python/couples-holding-hands.py | Python/couples-holding-hands.py | # Time: O(n)
# Space: O(n)
class Solution(object):
def minSwapsCouples(self, row):
"""
:type row: List[int]
:rtype: int
"""
N = len(row)//2
couples = [[] for _ in xrange(N)]
for seat, num in enumerate(row):
couples[num//2].append(seat//2)
... | mit | Python | |
364de0a95b868bba980bfe6445cd80f55b39bb63 | add amber ti estimator test code | alchemistry/alchemlyb | src/alchemlyb/tests/test_ti_estimators_amber.py | src/alchemlyb/tests/test_ti_estimators_amber.py | """Tests for all TI-based estimators in ``alchemlyb``.
"""
import pytest
import pandas as pd
from alchemlyb.parsing import amber
from alchemlyb.estimators import TI
import alchemtest.amber
def amber_simplesolvated_charge_dHdl():
dataset = alchemtest.amber.load_simplesolvated()
dHdl = pd.concat([amber.ext... | bsd-3-clause | Python | |
a8f4d9252016aa9c656ad6d06558b520af06b489 | Create spyne_webservice.py | gvaduha/homebrew,gvaduha/homebrew,gvaduha/homebrew,gvaduha/homebrew,gvaduha/homebrew,gvaduha/homebrew | PythonTests/spyne_webservice.py | PythonTests/spyne_webservice.py | """
USE: Wizdler Chrome Extension
from suds.client import Client
c = Client('http://localhost:8008/...?wsdl')
c.service.SmokeTest('XXX')
"""
response_file = '$RESP_FILE'
from spyne import Application, rpc, ServiceBase, Iterable, Integer, Unicode
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import Wsg... | mit | Python | |
9a6fe771ba03cd64c4f6d764125457ed808feca2 | Add datacite harvester | erinspace/scrapi,alexgarciac/scrapi,CenterForOpenScience/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi,felliott/scrapi,fabianvf/scrapi,mehanig/scrapi,felliott/scrapi,fabianvf/scrapi,mehanig/scrapi,ostwald/scrapi,CenterForOpenScience/scrapi | scrapi/harvesters/datacite.py | scrapi/harvesters/datacite.py | '''
Harvester for the DataCite MDS for the SHARE project
Example API call: http://oai.datacite.org/oai?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
from scrapi.base.helpers import updated_schema, oai_extract_dois
class DataciteHarvester(OAIH... | apache-2.0 | Python | |
c63f2e2993b0c32d7bc2de617dfb147c0f6a2d89 | patch fix | geekroot/erpnext,indictranstech/erpnext,indictranstech/erpnext,gsnbng/erpnext,indictranstech/erpnext,njmube/erpnext,njmube/erpnext,geekroot/erpnext,Aptitudetech/ERPNext,gsnbng/erpnext,geekroot/erpnext,gsnbng/erpnext,indictranstech/erpnext,gsnbng/erpnext,njmube/erpnext,njmube/erpnext,geekroot/erpnext | erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py | erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py | from __future__ import unicode_literals
import frappe
def execute():
for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]:
# convert to 1 or 0
frappe.db.sql("update `tab{doctype}` set is_group = if(is_group='Yes',1,0) "
.format(doctype=doctype))
frappe.db.commit()
# alter field... | import frappe
def execute():
for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]:
frappe.reload_doctype(doctype)
#In MySQL, you can't modify the same table which you use in the SELECT part.
frappe.db.sql(""" update `tab{doctype}` set is_group = 1
where name in (select parent_{fiel... | agpl-3.0 | Python |
70b2fcb7ca85878b2012cab8c476b40f2624e7ee | Add migration new_name | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek | geotrek/trekking/migrations/0003_auto_20181113_1755.py | geotrek/trekking/migrations/0003_auto_20181113_1755.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-11-13 16:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trekking', '0002_trek_pois_excluded'),
]
operations = [
migrations.AlterFi... | bsd-2-clause | Python | |
43fbaa6c109c51a77832d6f09e0543794882b518 | Add scripts printing special:mode.yml from model.npz | marian-nmt/marian-train,marian-nmt/marian-train,emjotde/Marian,marian-nmt/marian-train,emjotde/amunn,emjotde/amunmt,emjotde/Marian,marian-nmt/marian-train,emjotde/amunmt,amunmt/marian,emjotde/amunn,emjotde/amunmt,emjotde/amunn,amunmt/marian,emjotde/amunn,emjotde/amunmt,amunmt/marian,marian-nmt/marian-train | scripts/contrib/model_info.py | scripts/contrib/model_info.py | #!/usr/bin/env python3
import sys
import argparse
import numpy as np
import yaml
DESC = "Prints version and model type from model.npz file."
S2S_SPECIAL_NODE = "special:model.yml"
def main():
args = parse_args()
model = np.load(args.model)
if S2S_SPECIAL_NODE not in model:
print("No special Ma... | mit | Python | |
89aaf8161bb776db672949e9e48f8f9af1b45837 | Delete subscriptions list | GeographicaGS/urbo-pgsql-connector,GeographicaGS/urbo-pgsql-connector,GeographicaGS/urbo-pgsql-connector | scripts/delete_subscr_list.py | scripts/delete_subscr_list.py | # -*- coding: utf-8 -*-
#
# Author: Cayetano Benavent, 2016.
# cayetano.benavent@geographica.gs
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at ... | agpl-3.0 | Python | |
af5e58c2fefdffa8046ecace238a3fd1a2a43387 | Add Naive Bayes base class: | christopherjenness/ML-lib | ML/naivebayes.py | ML/naivebayes.py | """
Naive Bayes Classifier
Includes gaussian, bernoulli and multinomial models
"""
import abc
import numpy as np
class NaiveBayes:
"""
Naive Bayes Classifier
Given class label, assumes features are independent
"""
__metaclass__ = abc.ABCMeta
def __init__(self):
"""
Attributes... | mit | Python | |
9d27a2f2791a26c3ff326d16001363ef48650596 | Rename jokes.py to geek.py and separate explicit jokes | ElectronicsGeek/pyjokes,borjaayerdi/pyjokes,trojjer/pyjokes,Wren6991/pyjokes,bennuttall/pyjokes,gmarkall/pyjokes,pyjokes/pyjokes,birdsarah/pyjokes,martinohanlon/pyjokes | pyjokes/geek.py | pyjokes/geek.py | # -*- coding: utf-8 -*-
"""
Jokes from stackoverflow - provided under CC BY-SA 3.0
http://stackoverflow.com/questions/234075/what-is-your-best-programmer-joke?page=4&tab=votes#tab-top
"""
geek_neutral = [
"A SQL query goes into a bar, walks up to two tables and asks, 'Can I join you?'",
"When your hammer is C... | bsd-3-clause | Python | |
837e9db39b2c9010a5cc43f21821b5dec90a18b1 | add rdds.fileio to setup.py | pearsonlab/thunder,kunallillaney/thunder,pearsonlab/thunder,j-friedrich/thunder,kcompher/thunder,jwittenbach/thunder,thunder-project/thunder,kcompher/thunder,j-friedrich/thunder,kunallillaney/thunder,oliverhuangchao/thunder,broxtronix/thunder,poolio/thunder,poolio/thunder,mikarubi/thunder,broxtronix/thunder,oliverhuang... | python/setup.py | python/setup.py | #!/usr/bin/env python
from setuptools import setup
import thunder
setup(
name='thunder-python',
version=str(thunder.__version__),
description='Large-scale neural data analysis in Spark',
author='The Freeman Lab',
author_email='the.freeman.lab@gmail.com',
url='https://github.com/freeman-lab/thu... | #!/usr/bin/env python
from setuptools import setup
import thunder
setup(
name='thunder-python',
version=str(thunder.__version__),
description='Large-scale neural data analysis in Spark',
author='The Freeman Lab',
author_email='the.freeman.lab@gmail.com',
url='https://github.com/freeman-lab/thu... | apache-2.0 | Python |
ee3b5d0d14403bd5964f0609eb48848833bff2c0 | Add a draft for a backup class | vadmium/python-quilt,bjoernricks/python-quilt | quilt/backup.py | quilt/backup.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | mit | Python | |
3ab998b022ff69c21c470de397f12557a1141168 | Add tests for photo.utils | rjhelms/photo,rjhelms/photo | src/photo/tests/test_utils.py | src/photo/tests/test_utils.py | """
Tests for photo.utils
"""
import uuid
from django.test import TestCase
from photo import utils
# pylint: disable=too-few-public-methods
class DummyInstance:
"""
Dummy instance object for passing into UploadToPathAndRename
"""
pk = None # pylint: disable=invalid-name
class UploadToPathAndRenameT... | mit | Python | |
dea182f5618f7590ee7e8fb6d2872ac60c6b6069 | Add setup.py to afni. | wanderine/nipype,blakedewey/nipype,mick-d/nipype_source,christianbrodbeck/nipype,sgiavasis/nipype,FredLoney/nipype,gerddie/nipype,grlee77/nipype,mick-d/nipype,dgellis90/nipype,fprados/nipype,FCP-INDI/nipype,satra/NiPypeold,fprados/nipype,arokem/nipype,carolFrohlich/nipype,mick-d/nipype,JohnGriffiths/nipype,JohnGriffith... | nipype/interfaces/afni/setup.py | nipype/interfaces/afni/setup.py | def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('afni', parent_package, top_path)
config.add_data_dir('tests')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(**configuration(... | bsd-3-clause | Python | |
fdf6dfbb7f82252cfe1e07719e3658fc529f47aa | Create hello-friend.py | CamFlawless/python_projects | baby-steps/hello-friend.py | baby-steps/hello-friend.py | print "hell0-fr1end"
| mit | Python | |
709ec407d333a624ff4476a81bc0f6ebb86f055a | add comments handle python file | LichAmnesia/MBSCM,LichAmnesia/MBSCM,LichAmnesia/MBSCM,LichAmnesia/MBSCM,LichAmnesia/MBSCM | data/Reddit/moderators_subreddit_comments.py | data/Reddit/moderators_subreddit_comments.py | # -*- coding: utf-8 -*-
# @Author: Lich_
# @Date: 2016-11-26 18:14:52
# @Last Modified by: LichAmnesia
# @Last Modified time: 2016-11-26 13:53:35
import json
import os
# generate the moderators from moderators file. the output is the moderators_subreddit file
def getmoderators():
file = open('moderators_sub... | mit | Python | |
5c278ec8afe7fd97c0f3a4b45c0acc25706afd1e | add python_solve.py | pymor/dune-burgers-demo,pymor/dune-burgers-demo,pymor/dune-burgers-demo | dune-burgers/pymor-wrapper/python_solve.py | dune-burgers/pymor-wrapper/python_solve.py | import sys
from pymor.tools import mpi
from pymor.discretizations.mpi import mpi_wrap_discretization
from pymor.vectorarrays.mpi import MPIVectorArrayAutoComm
from dune_burgers import discretize_dune_burgers
filename = sys.argv[1]
exponent = float(sys.argv[2])
obj_id = mpi.call(mpi.function_call_manage, discretize_... | bsd-2-clause | Python | |
b4729cfbff3bdf11da73436d4f927f0ffb9d1b40 | Add montage func | Eric89GXL/mnefun,drammock/mnefun,kambysese/mnefun,kambysese/mnefun,drammock/mnefun,LABSN/mnefun,ktavabi/mnefun,ktavabi/mnefun,Eric89GXL/mnefun,LABSN/mnefun | mnefun/misc.py | mnefun/misc.py | # -*- coding: utf-8 -*-
"""Miscellaneous utilities."""
import numpy as np
import mne
def make_montage(info, kind, check=False):
from . import _reorder
assert kind in ('mgh60', 'mgh70', 'uw_70', 'uw_60')
picks = mne.pick_types(info, meg=False, eeg=True, exclude=())
if kind in ('mgh60', 'mgh70'):
... | bsd-3-clause | Python | |
ded9c39402ca9cf7adfaaebbf06c196048d48db9 | Add presubmit check for run-bindings-tests | XiaosongWei/blink-crosswalk,PeterWangIntel/blink-crosswalk,crosswalk-project/blink-crosswalk-efl,XiaosongWei/blink-crosswalk,Pluto-tv/blink-crosswalk,Bysmyyr/blink-crosswalk,modulexcite/blink,ondra-novak/blink,nwjs/blink,kurli/blink-crosswalk,PeterWangIntel/blink-crosswalk,Pluto-tv/blink-crosswalk,crosswalk-project/bli... | Source/bindings/PRESUBMIT.py | Source/bindings/PRESUBMIT.py | # Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | bsd-3-clause | Python | |
e94d5f86d983f6b930d41abaed56cba05e5fa030 | test run_async | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/tests/test_async_indicators.py | corehq/apps/userreports/tests/test_async_indicators.py | from django.test import SimpleTestCase
from corehq.apps.userreports.models import DataSourceConfiguration
from corehq.apps.userreports.util import get_indicator_adapter
class RunAsynchronousTest(SimpleTestCase):
def _create_data_source_config(self, indicators=None):
default_indicator = [{
"ty... | bsd-3-clause | Python | |
d9d8e68c92fc808e43cf5ffe897541738f90d428 | Add manage.py to support running project scripts | EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list | manage.py | manage.py | from flask_script import Manager
from app import app
manager = Manager(app)
if __name__ == "__main__":
manager.run() | mit | Python | |
52193599f1f6bc5acded2188c9e2016c52d26188 | Add HTML music table generator | GamerSymphonyOrchestra/gen_tools | music_table.py | music_table.py | #!/usr/bin/env python3
# Written by Michael Younkin in 2014. This work is in the public domain.
HELP_TEXT = '''
music_table.py
--------------
SYNOPSIS
python music_table.py -h
python music_table.py URL_PREFIX
DESCRIPTION
This program generates HTML for the GSO website's "listen" page. It will
accep... | mit | Python | |
fbd179d9d22a2eef6c2fb24152a441b85133e556 | Add missing component of previous commit | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | lowfat/utils.py | lowfat/utils.py | """
This module contains small utility classes and functions which do not clearly belong to one part of the project.
"""
import enum
class ChoicesEnum(enum.Enum):
"""
Abstract Enum class to represent values in a Django CharField choices.
"""
@classmethod
def choices(cls):
"""
Get ... | bsd-3-clause | Python | |
9199563bb21276102ca58dc6b7c99f593db863d4 | Add test for call_actions_during_tree_build | igordejanovic/parglare,igordejanovic/parglare | tests/func/test_build_tree.py | tests/func/test_build_tree.py | import pytest # noqa
from parglare import Grammar, Parser
def test_call_actions_during_tree_build():
grammar = """
Program: "begin" MoveCommand* "end";
MoveCommand: "move" Direction;
Direction: "up" | "down" | "left" | "right";
"""
g = Grammar.from_string(grammar)
code = """
begin
... | mit | Python | |
9140b3249820d0dd86f7f85270327d9264841b50 | Test for selecting mysql search backend | p/wolis-phpbb,p/wolis-phpbb | tests/search_backend_mysql.py | tests/search_backend_mysql.py | from wolis.test_case import WolisTestCase
from wolis import utils
class SearchBackendMysqlTest(WolisTestCase):
@utils.restrict_database('mysql*')
@utils.restrict_phpbb_version('>=3.1.0')
def test_set_search_backend(self):
self.login('morpheus', 'morpheus')
self.acp_login('morpheus', 'morphe... | bsd-2-clause | Python | |
3c3fe1e1f1884df47157c71584b7b6087bde7f10 | add owner check, code borrowed from RoboDanny | mikevb1/lagbot,mikevb1/discordbot | cogs/utils/checks.py | cogs/utils/checks.py | from discord.ext import commands
def is_owner_check(message):
return message.author.id == '103714384802480128'
def is_owner():
return commands.check(lambda ctx: is_owner_check(ctx.message))
| mit | Python | |
ee88f6927dee820318bc821081138374b8f754f2 | Create data_functions.py | BCCN-Prog/database | data_functions.py | data_functions.py | import pandas as pd
import numpy as np
def load_data(path):
'''
(str) -> (pandas.DataFrame)
Loads the database and cleans the whitespace in STATIONS_ID.
IMPORTANT: This function assumes you have the database stored in a text file in the directory.
'''
data = pd.read_csv(path, index_col = 2... | bsd-3-clause | Python | |
82906d8dabfd551c997569f2f36ecdfc1ef3057f | Create duplicates.py | creativcoder/AlgorithmicProblems,creativcoder/AlgorithmicProblems,creativcoder/AlgorithmicProblems,creativcoder/AlgorithmicProblems | Python/duplicates.py | Python/duplicates.py | #The rem_dep method removes the duplicate values while maintaining the original order of the list.
def rem_dup(values):
output=[]
seen=set()
for val in values:
if val not in seen:
output.append(val)
seen.add(val)
return output
#sample list to test code.
values=[... | mit | Python | |
8611ea1e23b8958be98a6d5c15bd66f08e46859f | Handle connection error when sending event to consul. | meerkat-code/meerkat_libs | meerkat_libs/consul_client/__init__.py | meerkat_libs/consul_client/__init__.py | import json
import logging
import jwt
import collections
from os import environ
import backoff as backoff
import requests
from meerkat_libs import authenticate
CONSUL_URL = environ.get("CONSUL_URL", "http://nginx/consul")
SUBMISSIONS_BUFFER_SIZE = environ.get("CONSUL_SUBMISSIONS_BUFFER_SIZE", 1000)
DHIS2_EXPORT_ENAB... | import json
import logging
import jwt
import collections
from os import environ
import backoff as backoff
import requests
from meerkat_libs import authenticate
CONSUL_URL = environ.get("CONSUL_URL", "http://nginx/consul")
SUBMISSIONS_BUFFER_SIZE = environ.get("CONSUL_SUBMISSIONS_BUFFER_SIZE", 1000)
DHIS2_EXPORT_ENAB... | mit | Python |
f666560f9ffa2323b8a125e3ad3d3faf6bd5b3de | add command to grant sms gateway permissions | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/smsbillables/management/commands/add_sms_gateway_permissions.py | corehq/apps/smsbillables/management/commands/add_sms_gateway_permissions.py | from django.contrib.auth.models import User
from django.core.management import BaseCommand
from django_prbac.models import Grant, Role, UserRole
from corehq import privileges
class Command(BaseCommand):
help = 'Grants the user(s) specified the privilege to access global sms gateways'
def add_arguments(self... | bsd-3-clause | Python | |
ff82f56b8ea901a30478b11a61f8ca52b23346bd | Add a test case for guessing the BuildDir associated with a subdirectory argument. | azverkan/scons,datalogics-robb/scons,datalogics/scons,datalogics/scons,datalogics-robb/scons,azverkan/scons,azverkan/scons,azverkan/scons,datalogics-robb/scons,azverkan/scons,datalogics/scons,datalogics/scons,datalogics-robb/scons | test/BuildDir/guess-subdir.py | test/BuildDir/guess-subdir.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit | Python | |
88e5b5117c747f21cc868503d2e5c123ca976585 | Add tests for decorators | indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,learningequality/kolibri,learningequality/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri | kolibri/core/tasks/test/test_decorators.py | kolibri/core/tasks/test/test_decorators.py | import pytest
from kolibri.core.tasks.decorators import task
from kolibri.core.tasks.exceptions import FunctionNotRegisteredAsJob
from kolibri.core.tasks.job import JobRegistry
from kolibri.core.tasks.job import RegisteredJob
from kolibri.core.tasks.utils import stringify_func
@pytest.fixture
def registered_jobs():
... | mit | Python | |
a6be0447e07d388f5dc4942d7f9e391366185c78 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/count_and_say/py/solution.py | leetcode/easy/count_and_say/py/solution.py | class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
s = '1'
while n > 1:
t = ''
cnt = 1
for i in range(len(s)):
if i + 1 < len(s) and s[i] == s[i + 1]:
... | mit | Python | |
ff187730fa1ebd64984dbb6e91a8f04edae84548 | Introduce module for CLI commands; implement data generating command | shudmi/ngx-task | ngx_task/cli.py | ngx_task/cli.py | import os
from concurrent.futures import ThreadPoolExecutor, as_completed
from ngx_task import settings, utils
def generate_data():
if not os.path.exists(settings.DATA_DIR):
os.mkdir(settings.DATA_DIR, 0o755)
files_to_submit = ['arc-{}.zip'.format(arc_num) for arc_num in range(1, 51)]
with Thre... | apache-2.0 | Python | |
4ccf9b6135ca5c6317502ffd663d5de4d180eea3 | Add migration for commit b52f572646f30a8a4f2fc2bec6fc31c8f498f33f | alexandrovteam/curatr,alexandrovteam/curatr,alexandrovteam/curatr,alexandrovteam/curatr,alexandrovteam/curatr | mcf_standard_browser/standards_review/migrations/0032_auto_20160307_1802.py | mcf_standard_browser/standards_review/migrations/0032_auto_20160307_1802.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-03-07 18:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('standards_review', '0031_auto_20160209_1255'),
]
op... | apache-2.0 | Python | |
bc5105d7e8263bcaf0be8cc88bff8438fa1972a4 | add import script for ryedale | chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_ryedale.py | polling_stations/apps/data_collection/management/commands/import_ryedale.py | """
Imports Ryedale
"""
from django.contrib.gis.geos import Point, GEOSGeometry
from data_collection.management.commands import BaseKamlImporter
class Command(BaseKamlImporter):
"""
Imports the Polling Station data from Ryedale Council
"""
council_id = 'E07000167'
districts_name = 'Thirsk_and_... | bsd-3-clause | Python | |
d44bf960aa597e5a38fbc2f8f7dd18fbd704cf7c | add nova start vm to recovery | fs714/drcontroller | drcontroller/recovery/nova_start_vm.py | drcontroller/recovery/nova_start_vm.py | import novaclient.v1_1.client as novaclient
import ConfigParser
def start_vm(server_id):
cf=ConfigParser.ConfigParser()
cf.read("/home/eshufan/projects/drcontroller/drcontroller/conf/set.conf")
drc_ncred={}
drc_ncred['auth_url']= cf.get("drc","auth_url")
drc_ncred['username']= cf.get("drc","user")
... | apache-2.0 | Python | |
cb0a5480a7c198a34069e4e65707c18f0ee6b7b9 | Add catalan_numbers.py (#4455) | TheAlgorithms/Python | dynamic_programming/catalan_numbers.py | dynamic_programming/catalan_numbers.py | """
Print all the Catalan numbers from 0 to n, n being the user input.
* The Catalan numbers are a sequence of positive integers that
* appear in many counting problems in combinatorics [1]. Such
* problems include counting [2]:
* - The number of Dyck words of length 2n
* - The number well-formed expressions with... | mit | Python | |
6d03266160ce95a41b94561d707e399df78aae14 | Add sanity test case comm_wifi_connect | ostroproject/meta-iotqa,wanghongjuan/meta-iotqa-1,daweiwu/meta-iotqa-1,daweiwu/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/meta-iotqa-1,daweiwu/meta-iotqa-1,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,ostroproject/meta-iotqa,ostroproject/meta-iotqa,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,daweiwu/me... | lib/oeqa/runtime/sanity/comm_wifi_connect.py | lib/oeqa/runtime/sanity/comm_wifi_connect.py | import time
from oeqa.oetest import oeRuntimeTest
class CommWiFiTest(oeRuntimeTest):
'''WiFi test by connmanctl'''
def test_wifi_connect_nopassword(self):
'''connmanctl to connect a no-password wifi AP'''
# un-block software rfkill lock
self.target.run('rfkill unblock all')
# En... | mit | Python | |
2cc6edec8295a216261fff09388a35e0805f474c | Add test to validate service names | pplu/botocore,boto/botocore | tests/functional/test_service_names.py | tests/functional/test_service_names.py | # Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | apache-2.0 | Python | |
b63986d2ce2f7ac24cd78c7b5971878d9b1a841a | Add remaining integration tests | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/mac_ports.py | tests/integration/modules/mac_ports.py | # -*- coding: utf-8 -*-
'''
integration tests for mac_ports
'''
# Import python libs
from __future__ import absolute_import, print_function
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils... | apache-2.0 | Python | |
6ad9b8e65562c00607fe0fe9f92cdba3c022ef2b | Add initial version Teach First Oauth2 backend. | proversity-org/edx-platform,proversity-org/edx-platform,proversity-org/edx-platform,proversity-org/edx-platform | lms/djangoapps/student_account/teachfirst.py | lms/djangoapps/student_account/teachfirst.py | from django.conf import settings
from social_core.backends.oauth import BaseOAuth2
import logging
log = logging.getLogger(__name__)
class TeachFirstOAuth2(BaseOAuth2):
"""TeachFirst OAuth2 authentication backend."""
settings_dict = settings.CUSTOM_BACKENDS.get('teachfirst')
name = 'teachfirst-oauth2'
... | agpl-3.0 | Python | |
372469139dc103f75003f96616ac53bce8986274 | Add prediction module | ef-ctx/righter,ef-ctx/righter,ef-ctx/righter,ef-ctx/righter | src/righter/predict.py | src/righter/predict.py | import json
import argparse
import righter
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input-file', help='File with one json per line containing the key text', required=True)
parser.add_argument('-o', '--file-output', help='Save analysis to output file', requ... | apache-2.0 | Python | |
15daff9a7823ddd7dbc3fb6f141d539d6b636301 | Add description field to Config | Xicnet/radioflow-scheduler,Xicnet/radioflow-scheduler,Xicnet/radioflow-scheduler,Xicnet/radioflow-scheduler,Xicnet/radioflow-scheduler | project/timeslot/migrations/0008_auto_20160622_0937.py | project/timeslot/migrations/0008_auto_20160622_0937.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('timeslot', '0007_auto_20160616_0049'),
]
operations = [
migrations.AlterField(
model_name='config',
... | agpl-3.0 | Python | |
757812e63c42f38ad065c31744427c5902a5d322 | Move some Utils outside of the main script. | BrakeValve/dataflow,BrakeValve/brake-valve-server,BrakeValve/brake-valve-server,BrakeValve/dataflow | data-preprocessor/listFile.py | data-preprocessor/listFile.py | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 11 10:23:38 2016
@author: SISQUAKE
"""
import os
def listFilePath(path):
File = [];
Dir = [];
for (dirpath, dirnames, filenames) in os.walk(path):
for name in filenames:
tmp = os.path.join(dirpath, name);
File.app... | mit | Python | |
1bf55df37a12af7984f08eb429e61a2c3a7cd836 | Add initial server states | will-hart/blitz,will-hart/blitz | blitz/io/server_states.py | blitz/io/server_states.py | __author__ = 'Will Hart'
from blitz.constants import *
from blitz.io.client_states import BaseState
def validate_command(tcp, msg, commands):
"""
Helper function which checks to see if a message is in the list of valid commands
and sends an appropriate response over the TCP network
"""
if msg.spl... | agpl-3.0 | Python | |
8e8cb549251b6914a34a729bb06c02462ed95af9 | convert old wizard into osv memory wizard for configuration | waytai/odoo,tangyiyong/odoo,nexiles/odoo,papouso/odoo,nagyistoce/odoo-dev-odoo,aviciimaxwell/odoo,JCA-Developpement/Odoo,VitalPet/odoo,rgeleta/odoo,bobisme/odoo,tvtsoft/odoo8,doomsterinc/odoo,wangjun/odoo,papouso/odoo,massot/odoo,nuncjo/odoo,leoliujie/odoo,CatsAndDogsbvba/odoo,apanju/GMIO_Odoo,acshan/odoo,fuhongliang/o... | bin/addons/base/module/wizard/base_module_configuration.py | bin/addons/base/module/wizard/base_module_configuration.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 | Python | |
90c27c1444f80b6d746c8f92b6b79e38ae5ce87e | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/1a04c55547456cffd9b9d250dc8680eb9d89f750. | paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,paolodedios/tensorflow,k... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "1a04c55547456cffd9b9d250dc8680eb9d89f750"
TFRT_SHA256 = "296130004f8b3ce22b46b9f263c9379dd462eff53c2332... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "5e36ba4f8e42a4022062a10a75684d5a2dfb1b53"
TFRT_SHA256 = "3bf90326b6dd4f938825dd7ab3424abbee7cc86b370f24... | apache-2.0 | Python |
f099d055279abfea2bd58c8e0b28c2fa162ac8cd | modify zqplant crawler script | colddew/mix-python | crawler/DzwBaikeCrawler.py | crawler/DzwBaikeCrawler.py | import hashlib
'''
curl
-H 'Host: api.dzwbaike.xyz'
-H 'Content-Type: text/html;charset=UTF-8'
-H 'Accept: */*' -H 'Accept-Language: zh-cn'
-H 'token: 05e33d91-dd85-40d5-aa67-a90130270a95'
-H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 Mic... | mit | Python | |
32a569f0f6f33ef5cf11031bb359989379582489 | add script to create cloudtrail table in Athena | 1Strategy/security-fairy | create_cloudtrail_table.py | create_cloudtrail_table.py | import boto3
# Create AWS session
try:
session = boto3.session.Session(profile_name='training')
except Exception as e:
session = boto3.session.Session()
# Connect to Athena
athena = session.client('athena', region_name='us-east-1')
def lambda_handler(event, context):
# You must submit the AWS account n... | apache-2.0 | Python | |
f693949a21864938991904ed1503ae5303426c90 | Revert "Remove test stub" | willthames/ansible-lint | test/TestLineNumber.py | test/TestLineNumber.py | # Copyright (c) 2020 Albin Vass <albin.vass@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | mit | Python | |
3bb43f31263cce7ceebab943a1eed9e8c83cb90d | Set dbtable for models to use the "celery_" prefix not "djcelery". | planorama/django-celery,digimarc/django-celery,CloudNcodeInc/django-celery,georgewhewell/django-celery,iris-edu-int/django-celery,celery/django-celery,kanemra/django-celery,digimarc/django-celery,nadios/django-celery,nadios/django-celery,ask/django-celery,ask/django-celery,Amanit/django-celery,alexhayes/django-celery,d... | djcelery/models.py | djcelery/models.py | import django
from django.db import models
from django.utils.translation import ugettext_lazy as _
from picklefield.fields import PickledObjectField
from celery import conf
from celery import states
from djcelery.managers import TaskManager, TaskSetManager
TASK_STATUSES_CHOICES = zip(states.ALL_STATES, states.ALL_S... | import django
from django.db import models
from django.utils.translation import ugettext_lazy as _
from picklefield.fields import PickledObjectField
from celery import conf
from celery import states
from djcelery.managers import TaskManager, TaskSetManager
TASK_STATUSES_CHOICES = zip(states.ALL_STATES, states.ALL_S... | bsd-3-clause | Python |
18f7737f1f187aef7181e6cdd72db774df8eda3d | add transformer test | jubatus/jubakit | jubakit/test/integration/test_model.py | jubakit/test/integration/test_model.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
import os
import json
from jubakit.model import JubaModel
from jubakit.anomaly import Anomaly, Config as AnomalyConfig
from jubakit.classifier import Classifier, Config as Classif... | mit | Python | |
317c74fb6a31aad82f080b3bb8383c4047ae2f63 | Create tests.py | jonathanmarvens/jeeves,jonathanmarvens/jeeves,jonathanmarvens/jeeves,BambooL/jeeves,jonathanmarvens/jeeves,BambooL/jeeves,BambooL/jeeves,jeanqasaur/jeeves,BambooL/jeeves | demo/openmrs/openmrs/tests.py | demo/openmrs/openmrs/tests.py | import unittest
from BaseOpenmrsObject import *
class TestOrderFunctions(unittest.TestCase):
def setUp(self):
self.order = Order()
self.order.setOrderId(9112)
self.order.setOrderNumber('911')
def test_copy_methods(self):
copy1 = self.order.copy()
copy2 = self.o... | mit | Python | |
274d539e0cf08a3417315bd68bc5544dbb21d0ff | Add config test | authmillenon/wakefs | tests/config.py | tests/config.py | import wakefs.config
import os
import unittest
import random
import string
def random_str(N):
''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for x in range(N))
class TestConfigFileCreate(unittest.TestCase):
def test_file_create(self):
testfile = "test.cfg"
... | mit | Python | |
c1c5f58d12ff9a8e532de971c28e3676915a7117 | Add py-cairocffi package (#12161) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-cairocffi/package.py | var/spack/repos/builtin/packages/py-cairocffi/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCairocffi(PythonPackage):
"""cairocffi is a CFFI-based drop-in replacement for Pycairo, ... | lgpl-2.1 | Python | |
eda01c6b45629d6c039785ba502dcde47cabd020 | Add python implementation | juruen/montecarlo-minesweeper | probability.py | probability.py | #!/usr/bin/env python
import random
import sets
BOARD_SIZE = 9
MINES = 10
SAMPLES = 10**5
def generate_mines(board_size, num_of_mines):
mines = sets.Set()
while len(mines) != num_of_mines:
mines.add((random.randint(0, board_size - 1),
random.randint(0, board_size - 1)))
return mi... | apache-2.0 | Python | |
3352236ff27dbfd749b71dd152f6809b2019bee4 | add tests | honzajavorek/czech-holidays | test_czech_holidays.py | test_czech_holidays.py | import re
from datetime import date
import requests
import pytest
from czech_holidays import holidays, Holidays, Holiday
WIKIPEDIA_RE = re.compile(r'Rok\s\d{4}</th>\s<td>(?P<date>\w+)')
WIKIPEDIA_DATE_RE = re.compile(r'(?P<day>\d+)\.\s+(?P<month>\w+)\s+(?P<year>\d{4})')
def fetch_easter_dates():
response = r... | mit | Python | |
0415071808b1bfa659a790e50692dc65d479b627 | add config.sample.py | lynxis/testWrt | tests/config.sample.py | tests/config.sample.py | """
This is the sample config.py
create your own config.py which match your testsetup
It will be imported by device tests
"""
from testWrt import testsetup
TestSetup = testsetup.TestSetup()
TestSetup.set_openwrt("192.168.2.1")
| bsd-3-clause | Python | |
08f147052e19c43e89f3548a10ecc847316e6789 | Add a tool for backend synchronization | rensimlab/rensimlab.github.io,rensimlab/rensimlab.github.io,rensimlab/rensimlab.github.io | tools/syncer.py | tools/syncer.py | def sync():
import os
from bson.objectid import ObjectId
from girder import logger
from girder.models.assetstore import Assetstore
from girder.models.collection import Collection
from girder.models.file import File
from girder.models.folder import Folder
from girder.models.item import It... | mit | Python | |
eb091fc81dc374d0eb0800a596d6e0db95a55687 | Create CombinationSumII_001.py | Chasego/codirit,Chasego/codi,cc13ny/algo,Chasego/codi,cc13ny/Allin,Chasego/codirit,cc13ny/algo,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/codi,Chasego/cod,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/codirit,Chasego/cod,cc13ny/Allin,Chasego/cod,cc13ny/Allin,cc13ny/algo,cc13ny/algo,Chasego/codirit,Ch... | leetcode/040-Combination-Sum-II/CombinationSumII_001.py | leetcode/040-Combination-Sum-II/CombinationSumII_001.py | #Node simplification, improvement & optimization
#How, it's good because it can be done on the original code of "Combination Sum"
class Solution:
# @param {integer[]} candidates
# @param {integer} target
# @return {integer[][]}
def combinationSum2(self, candidates, target):
candidates.sort()
... | mit | Python | |
d3a9a4a300acc204111e19945381a995f0f7cdda | add import script for Dumfries and Galloway | chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_dumfries_and_galloway.py | polling_stations/apps/data_collection/management/commands/import_dumfries_and_galloway.py | from data_collection.management.commands import BaseScotlandSpatialHubImporter
class Command(BaseScotlandSpatialHubImporter):
council_id = 'S12000006'
council_name = 'Dumfries and Galloway'
elections = ['local.dumfries-and-galloway.2017-05-04']
| bsd-3-clause | Python | |
ba5d87ff551df47df2ed4de15058df28ad49fe41 | add error classes. | seikichi/pumblr | pumblr/error.py | pumblr/error.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
class PumblrError(object):
"""Pumblr exception"""
def __init__(self, msg):
self._msg = msg
def __str__(self):
return self._msg
class PumblrAuthError(PumblrError):
"""403 Forbidden exception"""
pass
class PumblrReqestError(PumblrErr... | mit | Python | |
86fe554e8cc67ad346d2ecc532cea6e94461a0c6 | Add support for file session | free-free/pyblog,free-free/pyblog,free-free/pyblog,free-free/pyblog | app/tools/session.py | app/tools/session.py | #-*- coding:utf-8 -*-
import uuid
import time
import os
import json
class Session(dict):
def __init__(self,session_id=None,expire=None,*args,**kw):
if session_id==None:
self._session_id=self._generate_session_id()
else:
self._session_id=session_id
self._expire=expire
super(Session,self).__init__(*args,*... | mit | Python | |
8bfd0031c4a93b644cd8f9892a0cc1a8671a9024 | add build/BuildSpawn.py | tianocore/buildtools-BaseTools,tianocore/buildtools-BaseTools,bitcrystal/buildtools-BaseTools,tianocore/buildtools-BaseTools,bitcrystal/buildtools-BaseTools,bitcrystal/buildtools-BaseTools,bitcrystal/buildtools-BaseTools,tianocore/buildtools-BaseTools,bitcrystal/buildtools-BaseTools,tianocore/buildtools-BaseTools | Source/Python/build/BuildSpawn.py | Source/Python/build/BuildSpawn.py | import os
from threading import *
from subprocess import *
class BuildSpawn(Thread):
def __init__(self, Sem=None, Filename=None, Args=None, Num=0):
Thread.__init__(self)
self.sem=Sem
self.filename=Filename
self.args=Args
self.num=Num
def run(se... | bsd-2-clause | Python | |
00a00621f005e3db3fd25c4c09fb1540ba165fed | Test the VenvBuilder | ionelmc/virtualenv,ionelmc/virtualenv,ionelmc/virtualenv | tests/unit/builders/test_venv.py | tests/unit/builders/test_venv.py | import subprocess
import pretend
import pytest
import virtualenv.builders.venv
from virtualenv.builders.venv import VenvBuilder, _SCRIPT
def test_venv_builder_check_available_success(monkeypatch):
check_output = pretend.call_recorder(lambda *a, **kw: None)
monkeypatch.setattr(
virtualenv.builders.v... | mit | Python | |
efc8d3182f79111b3a1b7df445dafd46fef9862a | Add YAML wrapper allowing conf strings to be used in YAML source files | daemotron/controlbeast,daemotron/controlbeast | controlbeast/utils/yaml.py | controlbeast/utils/yaml.py | # -*- coding: utf-8 -*-
"""
controlbeast.utils.yaml
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2014 by the ControlBeast team, see AUTHORS.
:license: ISC, see LICENSE for details.
"""
import os
import yaml
from controlbeast.conf import CbConf
from controlbeast.utils.dynamic import CbDynamicIterable
f... | isc | Python | |
79f92d050fbf9ebe4f088aeabb5e832abeefe0d5 | Initialize unit tests for Coursera API module | ueg1990/mooc_aggregator_restful_api | tests/test_coursera.py | tests/test_coursera.py | import unittest
from mooc_aggregator_restful_api import coursera
class CourseraTestCase(unittest.TestCase):
'''
Unit Tests for module udacity
'''
def setUp(self):
self.coursera_test_object = coursera.CourseraAPI()
def test_coursera_api_courses_response(self):
self.assertEqual(s... | mit | Python | |
7d65a128ee71bc5c85170b247730ea385ab58d0c | add first handler test | edouard-lopez/rangevoting,guillaumevincent/rangevoting,edouard-lopez/rangevoting,guillaumevincent/rangevoting,edouard-lopez/rangevoting,guillaumevincent/rangevoting | tests/test_handlers.py | tests/test_handlers.py | import unittest
from unittest.mock import Mock
class RangeVotingHandler():
def __init__(self, member_repository):
self.repository = member_repository
def handle(self, command):
self.repository.save()
class RangeVotingRepository():
def save(self, rangevoting):
pass
class RangeV... | mit | Python | |
8415decb4fea7cb8ad3a2800ecd9c9a9190fa331 | Add rename script in python | Diego999/Digit-Dataset,Diego999/Digit-Dataset | rename.py | rename.py | import os
SEPARATOR = '_'
EXT = ".png"
digits = range(1, 10)
for d in digits:
i = 1
for file in os.listdir(str(d)):
if file.endswith(EXT):
filepath = str(d) + '/'
old_filename = filepath + file
new_filename = filepath + str(d) + SEPARATOR + str(i) + EXT
os.rename(old_filename, new_filename)
i +=... | mit | Python | |
96cfe4d55ae6dd34cc30a72f19118aa66c65f7ca | add __main__ file to for python 2.7 entrypoint | petrus-v/selenium-odoo-qunit | selenium_odoo_qunit/__main__.py | selenium_odoo_qunit/__main__.py | if __name__ == '__main__':
from selenium_odoo_qunit import selenium_odoo_qunit as soq
soq.main()
| mpl-2.0 | Python | |
769f350802b78ffa9c74bc5b9a1e912b64ab718d | Add new package: py-asgiref (#16233) | iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-asgiref/package.py | var/spack/repos/builtin/packages/py-asgiref/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyAsgiref(PythonPackage):
"""ASGI specification and utilities."""
homepage = "https:/... | lgpl-2.1 | Python | |
e6e641e3beb2aad3e6d4eb1a37a7ee029006631b | add download_data.py for downloading data from nrao, it is not working yet | caseyjlaw/aws-vla-frb,caseyjlaw/aws-vla-frb | aws/download_data.py | aws/download_data.py | import sys
import os
import urllib
import urllib2
import webbrowser
from mechanize import ParseResponse, urlopen, urljoin, Browser
url = 'https://archive.nrao.edu/archive/advquery.jsp'
def download_with_mech(email, destination, file):
'''
download data from nrao archive. Now it only works for filling the form... | bsd-3-clause | Python | |
f3ed5d434b83d7531aecd1431645267dedfecb45 | Create mqtt_sender.py | c2theg/srvBuilds,c2theg/srvBuilds,c2theg/srvBuilds,c2theg/srvBuilds | raspi/mqtt_sender.py | raspi/mqtt_sender.py | import paho.mqtt.publish as publish
MQTT_SERVER = "192.168.1.10"
MQTT_PATH = "test_channel"
publish.single(MQTT_PATH, "Hello World!", hostname=MQTT_SERVER)
| mit | Python | |
a51a226dc0a134e01915e514e2146a664671d998 | Update dates for CFP | pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017 | pyconcz_2017/proposals/pyconcz2016_config.py | pyconcz_2017/proposals/pyconcz2016_config.py | from datetime import datetime
from django.utils.timezone import get_current_timezone
from pyconcz_2017.proposals.models import Talk, Workshop, FinancialAid
tz = get_current_timezone()
class TalksConfig:
model = Talk
key = 'talks'
title = 'Talks'
cfp_title = 'Submit your talk'
template_about = '... | from datetime import datetime
from django.utils.timezone import get_current_timezone
from pyconcz_2017.proposals.models import Talk, Workshop, FinancialAid
tz = get_current_timezone()
class TalksConfig:
model = Talk
key = 'talks'
title = 'Talks'
cfp_title = 'Submit your talk'
template_about = '... | mit | Python |
ca842aee42fcb149e72a39334035cba81e969c65 | add clock | erroneousboat/dotfiles,erroneousboat/dotfiles,erroneousboat/dotfiles | files/bin/bin/clock.py | files/bin/bin/clock.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
##############################################################################
#
# clock
# -----
#
# This script prints an icon representation of the time of day.
#
# Dependencies: python3, nerd-fonts
#
# :authors: J.P.H. Bruins Slot
# :date: 07-01-2019
# :version: 0.1... | mit | Python | |
0c09a85ff19a48dd69f44720823e8bb2cb75eef8 | add the visualization of the 1st conv layer kernels | frombeijingwithlove/dlcv_for_beginners,frombeijingwithlove/dlcv_for_beginners | chap9/visualize_conv1_kernels.py | chap9/visualize_conv1_kernels.py | import sys
import numpy as np
import matplotlib.pyplot as plt
import cv2
sys.path.append('/path/to/caffe/python')
import caffe
ZOOM_IN_SIZE = 50
PAD_SIZE = 4
WEIGHTS_FILE = 'freq_regression_iter_10000.caffemodel'
DEPLOY_FILE = 'deploy.prototxt'
net = caffe.Net(DEPLOY_FILE, WEIGHTS_FILE, caffe.TEST)
kernels = net.par... | bsd-3-clause | Python | |
65546f4cd97331455a3309509d076825f07a078c | Add set_up file to run all tests | igemsoftware2016/USTC-Software-2016,igemsoftware2016/USTC-Software-2016,igemsoftware2016/USTC-Software-2016 | set_up.py | set_up.py | import os
import unittest2 as unittest
def suite():
return unittest.TestLoader().discover('tests','test_*.py')
if __name__ == '__main__':
unittest.main(defaultTest = 'suite') | agpl-3.0 | Python | |
abea1f4598928fddf750358efcedbfaade019bf4 | Add migration to fix Attachment cache. | kou/zulip,kou/zulip,zulip/zulip,kou/zulip,kou/zulip,zulip/zulip,andersk/zulip,zulip/zulip,andersk/zulip,rht/zulip,rht/zulip,zulip/zulip,rht/zulip,andersk/zulip,rht/zulip,kou/zulip,zulip/zulip,kou/zulip,andersk/zulip,andersk/zulip,zulip/zulip,andersk/zulip,andersk/zulip,rht/zulip,zulip/zulip,rht/zulip,rht/zulip,kou/zuli... | zerver/migrations/0386_fix_attachment_caches.py | zerver/migrations/0386_fix_attachment_caches.py | # Generated by Django 3.2.12 on 2022-03-23 04:32
from django.db import migrations, models
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db.models import Exists, Model, OuterRef
def fix_attachment_caches(apps: StateApps, schema_edito... | apache-2.0 | Python | |
e7232c4050b4cae1302d2c638ed20f3ac69bf22c | comment out ui tests temporarily | miurahr/seahub,madflow/seahub,madflow/seahub,cloudcopy/seahub,miurahr/seahub,madflow/seahub,Chilledheart/seahub,madflow/seahub,miurahr/seahub,cloudcopy/seahub,Chilledheart/seahub,Chilledheart/seahub,cloudcopy/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub,madflow/seahub,Chilledheart/seahub | tests/ui/test_login.py | tests/ui/test_login.py | # import unittest
# from tests.common.common import BASE_URL, USERNAME, PASSWORD
# from selenium import webdriver
# from selenium.webdriver.common.keys import Keys
# LOGIN_URL = BASE_URL + u'/accounts/login/'
# HOME_URL = BASE_URL + u'/home/my/'
# LOGOUT_URL = BASE_URL + u'/accounts/logout/'
# def get_logged_instance... | import unittest
from tests.common.common import BASE_URL, USERNAME, PASSWORD
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
LOGIN_URL = BASE_URL + u'/accounts/login/'
HOME_URL = BASE_URL + u'/home/my/'
LOGOUT_URL = BASE_URL + u'/accounts/logout/'
def get_logged_instance():
browser ... | apache-2.0 | Python |
7b063825ca3fbd8a638d56a477d3b2380b7901be | Add tests for list_max_two | lukin155/skola-programiranja | domaci-zadaci/06/test_list_max_two.py | domaci-zadaci/06/test_list_max_two.py | from solutions import list_max_two
import unittest
import random
class TestListMax(unittest.TestCase):
def test_two_equal_elements(self):
in_list = [random.randint(0, 1000)] * 2
expected = (in_list[0], in_list[1])
actual = list_max_two(in_list)
self.assertEqual(expected, actual)
... | mit | Python | |
bcb3948eea1903dc0127c8aee1b1decf11040496 | Add tolower simproc. | tyb0807/angr,f-prettyland/angr,iamahuman/angr,schieb/angr,angr/angr,schieb/angr,f-prettyland/angr,iamahuman/angr,angr/angr,schieb/angr,angr/angr,tyb0807/angr,f-prettyland/angr,tyb0807/angr,iamahuman/angr | angr/procedures/libc/tolower.py | angr/procedures/libc/tolower.py | import angr
from angr.sim_type import SimTypeInt
import logging
l = logging.getLogger("angr.procedures.libc.tolower")
class tolower(angr.SimProcedure):
def run(self, c):
self.argument_types = {0: SimTypeInt(self.state.arch, True)}
self.return_type = SimTypeInt(self.state.arch, True)
if n... | bsd-2-clause | Python | |
405bef33c1c68029b31ec6cb8f88b1edc28e2a6e | Create extract_wavelength tests module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/hyperspectral/test_extract_wavelength.py | tests/plantcv/hyperspectral/test_extract_wavelength.py | import numpy as np
from plantcv.plantcv.hyperspectral import extract_wavelength
def test_extract_wavelength(hyperspectral_test_data):
new = extract_wavelength(spectral_data=hyperspectral_test_data.load_hsi(), wavelength=500)
assert np.shape(new.array_data) == (1, 1600)
| mit | Python | |
d1abba72b79262c0b1462d7f7e42c798dc30003e | Create twinkle-status | Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot | twinkle-status/edit.py | twinkle-status/edit.py | # -*- coding: utf-8 -*-
import os
import re
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
os.environ['TZ'] = 'UTC'
site = pywikibot.Site()
site.login()
with open('list.txt', 'r') as f:
for user in f:
user = user.strip()
page = pywikibot.Page(site, 'U... | mit | Python | |
af062396637c86e5f12fcbf2a8250d6189ac207b | Create flask_fysql_example.py | Fy-Network/fysql | flask_fysql_example.py | flask_fysql_example.py | # -*- coding: utf-8 -*-
from fysql.databases import MySQLDatabase
from flask import current_app as app
class FySQL(object):
config = {}
name = ""
engine = MySQLDatabase
def __init__(self, app=None):
self.app = None
if app is not None:
self.init_app(app)
def init_app(s... | mit | Python | |
8b7c32f2058ce3c24ef3c19eb7d2d3f8d3154037 | Disable large profile startup benchmarks. | Just-D/chromium-1,PeterWangIntel/chromium-crosswalk,chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,ltilve/chromium,hgl888/chromium-crosswalk,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,ltilve/chromium,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Pluto-t... | tools/perf/benchmarks/startup.py | tools/perf/benchmarks/startup.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import benchmark
from measurements import startup
import page_sets
class _StartupCold(benchmark.Benchmark):
"""Measures cold startup time... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import benchmark
from measurements import startup
import page_sets
class _StartupCold(benchmark.Benchmark):
"""Measures cold startup time... | bsd-3-clause | Python |
e13e714fa179544bef895274baf4f8ddb52ddd4a | add script to separate source columns to 6 columns with boolean values | BD2KGenomics/brca-website,BD2KGenomics/brca-website,BD2KGenomics/brca-website | python_scripts/seperating_source_column.py | python_scripts/seperating_source_column.py | """
seperating the Variant_Source column merged_v4.tsv into six columns:
Variant_in_ENIGMA
Variant_in_ClinVar
Variant_in_1000_Genomes
Variant_in_ExAC
Variant_in_LOVD
Variant_in_BIC
"""
COLUMNS = ["Variant_in_ENIGMA",
"Variant_in_ClinVar",
"Variant_in_1000_Genomes",
"Variant_in_ExAC",
... | apache-2.0 | Python | |
e0ab65f3877da992ac3705475ea0bdc520677cbe | Test CommandObjectMultiword functionality | llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb | packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py | packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py | """
Test multiword commands ('platform' in this case).
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
class MultiwordCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
def test_ambiguous_subcommand(self):
self.e... | apache-2.0 | Python | |
a23e45a65221ec076059bd32cdb1d5bb787e123b | add less filter | amol-/dukpy,amol-/dukpy,amol-/dukpy | dukpy/webassets/lessfilter.py | dukpy/webassets/lessfilter.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
from webassets.filter import Filter
import dukpy
__all__ = ('CompileLess', )
class CompileLess(Filter):
name = 'lessc'
max_debug_level = None
def setup(self):
self.less_includes = self.get_config('LIBSAS... | mit | Python | |
0f251e6c8620e19fc5e16e88b1ffbd5d51f7a7be | Add initial HDF storage class | rnelsonchem/gcmstools | gcmstools/datastore.py | gcmstools/datastore.py | import numpy as np
import pandas as pd
import tables as tb
class HDFStore(object):
def __init__(self, hdfname):
self.pdh5 = pd.HDFStore(hdfname, mode='a', complevel=9,
complib='blosc')
self.h5 = self.pdh5._handle
self._filters = tb.Filters(complevel=9, complib='blosc')
... | bsd-3-clause | Python | |
585a5fa27321134623dcf431ebf80ba1dcd708de | add example script test equality of coefficients in two regression (basic example for onewaygls) | jseabold/statsmodels,rgommers/statsmodels,ChadFulton/statsmodels,kiyoto/statsmodels,wkfwkf/statsmodels,wwf5067/statsmodels,josef-pkt/statsmodels,cbmoore/statsmodels,yarikoptic/pystatsmodels,wdurhamh/statsmodels,kiyoto/statsmodels,adammenges/statsmodels,wzbozon/statsmodels,adammenges/statsmodels,bashtage/statsmodels,ber... | scikits/statsmodels/examples/try_2regress.py | scikits/statsmodels/examples/try_2regress.py | # -*- coding: utf-8 -*-
"""F test for null hypothesis that coefficients in two regressions are the same
see discussion in http://mail.scipy.org/pipermail/scipy-user/2010-March/024851.html
Created on Thu Mar 25 22:56:45 2010
Author: josef-pktd
"""
import numpy as np
from numpy.testing import assert_almost_equal
impor... | bsd-3-clause | Python | |
06945ae360bdab9726ea78757d8e63b10ea252fe | Create cbalusek_02.py | GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017 | Week01/Problem02/cbalusek_02.py | Week01/Problem02/cbalusek_02.py | """
Created on Fri Jul 21 10:17:21 2017
This short program will sum all of the even numbers in the fibonnacci
sequence less than 4 million.
@author: cbalusek3
"""
i1 = 1
i2 = 2
cum = 0
while i2 < 4000000:
itemp = i2
i2 += i1
i1 = itemp
if i2%2 == 0:
cum += i2
print(cum)
| bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.