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
706a88810abc1be1fcfa799b7bb46a1c8e774d59
add pygithub.login_github()
lsst-sqre/sqre-codekit,lsst-sqre/sqre-codekit
codekit/pygithub.py
codekit/pygithub.py
""" pygithub based functions intended to replace the github3.py based functions in codetools. """ import logging from public import public from github import Github import codekit.codetools as codetools logging.basicConfig() logger = logging.getLogger('codekit') @public def login_github(token_path=None, token=None)...
mit
Python
abc527d4e35b2a0946986575fd6b2ae2a87e0556
Create filter_vcf_deamination.py
ruidlpm/Utils,ruidlpm/Utils
filter_vcf_deamination.py
filter_vcf_deamination.py
#!/usr/bin/python # # filter_vcf_deamination.py # version: 1.1 # Removes potential deamination from vcf file # optional arguments: # -h, --help show this help message and exit # -i VCF_INPUT # -o VCF_OUTPUT # usage: filter_vcf_deamination.py [-h] [-i VCF_INPUT] [-o VCF_OUTPUT] # # Date: 12/11/2015 # Author...
mit
Python
b68c8eab696f5950c4cd528bf60506469c97d08a
Create fixer.py
Godod/utils
fixer.py
fixer.py
from datetime import datetime from typing import List, TypeVar import requests BASE_URL = 'https://api.fixer.io/' CURRENCY_CHOICE = ["EUR", "AUD", "BGN", "BRL", "CAD", "CHF", "CNY", "CZK", "DKK", "GBP", "HKD", "HRK", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN", "MYR", "NOK", ...
mit
Python
16ec8043799c7aac029c5528f1c00f96070434d4
Move build view names function to utils
praekelt/jmbo-foundry,praekelt/jmbo-foundry,praekelt/jmbo-foundry
foundry/utils.py
foundry/utils.py
from django.conf import settings def _build_view_names_recurse(url_patterns=None): """ Returns a tuple of url pattern names suitable for use as field choices """ if not url_patterns: urlconf = settings.ROOT_URLCONF url_patterns = __import__(settings.ROOT_URLCONF, globals(), locals(), \...
bsd-3-clause
Python
26ef831edbb25deaa7f3497c88d329db7ff8db91
Add temporary file interpolate-layout.py
fonttools/fonttools,googlefonts/fonttools
Lib/fontTools/varLib/interpolate-layout.py
Lib/fontTools/varLib/interpolate-layout.py
""" Interpolate OpenType Layout tables (GDEF / GPOS / GSUB). """ from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * from fontTools.ttLib import TTFont from fontTools.ttLib.tables import otTables as ot from fontTools.varLib import designspace, models, builder import os.pat...
mit
Python
f13045b5f933078225b89405a786c14da34d0af5
Add ClamAV script to analyze HTTPS traffic for viruses
mhils/HoneyProxy,mhils/HoneyProxy,mhils/HoneyProxy,mhils/HoneyProxy
scripts/clamav.py
scripts/clamav.py
import pyclamd from libmproxy.flow import decoded #http://www.eicar.org/85-0-Download.html clamd = pyclamd.ClamdUnixSocket() try: # test if server is reachable clamd.ping() except AttributeError, pyclamd.ConnectionError: # if failed, test for network socket clamd = pyclamd.ClamdNetworkSocket() cla...
mit
Python
079b5d26ef01a29a36672495cf794417204d336e
add unit test, check small average mean squared error
jseabold/statsmodels,josef-pkt/statsmodels,jseabold/statsmodels,bashtage/statsmodels,statsmodels/statsmodels,jseabold/statsmodels,statsmodels/statsmodels,bashtage/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,bashtage/statsmodels,josef-pkt/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,statsmodels/stat...
statsmodels/nonparametric/tests/test_asymmetric.py
statsmodels/nonparametric/tests/test_asymmetric.py
# -*- coding: utf-8 -*- """ Created on Mon Mar 8 16:18:21 2021 Author: Josef Perktold License: BSD-3 """ import numpy as np from numpy.testing import assert_array_less from scipy import stats import pytest import statsmodels.nonparametric.kernels_asymmetric as kern kernels_rplus = [("gamma", 0.1), ...
bsd-3-clause
Python
805b393c51d9fa82f0dd28aa502378dfcf80924b
Add a binary demo.
mwhoffman/reggie
reggie/demos/binary.py
reggie/demos/binary.py
import os import numpy as np import mwhutils.plotting as mp import mwhutils.grid as mg import reggie as rg if __name__ == '__main__': cdir = os.path.abspath(os.path.dirname(__file__)) data = np.load(os.path.join(cdir, 'xy.npz')) # create the GP and optimize the model gp1 = rg.make_gp(0.1, 1.0, 0.1) ...
bsd-2-clause
Python
def9592885ab4093973e8547de5deac3b7022515
Create MaxSubarray_003.py
Chasego/codi,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/codirit,cc13ny/Allin,Chasego/codirit,Chasego/cod,Chasego/codi,Chasego/codirit,Chasego/codirit,cc13ny/Allin,cc13ny/algo,cc13ny/algo,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/cod,Chasego/cod,cc13ny/algo,Chasego/cod,cc13ny/Allin,cc13ny/Allin,Chasego/codi,Cha...
leetcode/053-Maximum-Subarray/MaxSubarray_003.py
leetcode/053-Maximum-Subarray/MaxSubarray_003.py
class Solution: # @param {integer[]} nums # @return {integer} def maxSubArray(self, nums): res, tmp = nums[0], nums[0] for i in range(1, len(nums)): tmp = max(tmp + nums[i], nums[i]) res = max(res, tmp) return res
mit
Python
67300787f1f910065a88396f99f0d4dd25bec2d1
apply monkeypatch
vaporry/ethereum-buildbot,ethereum/ethereum-buildbot,vaporry/ethereum-buildbot,vaporry/ethereum-buildbot,ethereum/ethereum-buildbot,ethereum/ethereum-buildbot
buildbot.tac
buildbot.tac
import os from monkeypatch import apply_patches apply_patches() from twisted.application import service from buildbot.master import BuildMaster basedir = '.' rotateLength = 10000000 maxRotatedFiles = 10 configfile = 'master.cfg' # Default umask for server umask = None # if this is a relocatable tac file, get the d...
import os from twisted.application import service from buildbot.master import BuildMaster basedir = '.' rotateLength = 10000000 maxRotatedFiles = 10 configfile = 'master.cfg' # Default umask for server umask = None # if this is a relocatable tac file, get the directory containing the TAC if basedir == '.': impo...
mit
Python
e85bab14ab8058ba14d1f73dd2d47d8c38318c48
Add db_sqlite.py
tricorder42/chapterman
db_sqlite.py
db_sqlite.py
import sqlite3
mit
Python
266a3a3ddb99afc6fa696bdd2b7d3dc770b921ea
Add enroller talking to redis
pglbutt/spanky,pglbutt/spanky,pglbutt/spanky
spanky/lib/enroll.py
spanky/lib/enroll.py
import redis class Enroller(object): def __init__(self, config): self.config = config @property def conn(self): if not hasattr(self, '_conn'): self._conn = redis.StrictRedis(host='localhost', port=6379, db=0) return self._conn def join(self, name, host, port): ...
bsd-3-clause
Python
95ceeb0af4e549e0d211b4e1ba6157d26ad5e44d
Fix race between MQ and mongo setting QueuedAt
cgourlay/tapiriik,cheatos101/tapiriik,cmgrote/tapiriik,abhijit86k/tapiriik,dmschreiber/tapiriik,cpfair/tapiriik,abhijit86k/tapiriik,cpfair/tapiriik,mjnbike/tapiriik,abs0/tapiriik,gavioto/tapiriik,mjnbike/tapiriik,cheatos101/tapiriik,brunoflores/tapiriik,marxin/tapiriik,brunoflores/tapiriik,dlenski/tapiriik,abs0/tapirii...
sync_scheduler.py
sync_scheduler.py
from tapiriik.database import db from tapiriik.messagequeue import mq from tapiriik.sync import Sync from datetime import datetime from pymongo.read_preferences import ReadPreference import kombu import time from tapiriik.settings import MONGO_FULL_WRITE_CONCERN Sync.InitializeWorkerBindings() producer = kombu.Produc...
from tapiriik.database import db from tapiriik.messagequeue import mq from tapiriik.sync import Sync from datetime import datetime from pymongo.read_preferences import ReadPreference import kombu import time Sync.InitializeWorkerBindings() producer = kombu.Producer(Sync._channel, Sync._exchange) while True: queuein...
apache-2.0
Python
e532a4a5ba6706974dc1245b269f18fa0e82cb66
Create duplicates.py
aiskov/storekeeper
module/duplicates.py
module/duplicates.py
import os import sys def search(dir) for root, subdirs, files in os.walk(dir): print('Dir(%s)' % root) for filename in files: print('- File(%s)' % r)
apache-2.0
Python
c8271b02c3636aa9620cce8b85c823ff0ec35c4a
Add a mobile device test of the Skype website
seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase
examples/test_skype_site.py
examples/test_skype_site.py
""" This is a mobile device test for Chromium-based browsers (such as MS Edge) Usage: pytest test_skype_site.py --mobile --browser=edge Default mobile settings for User Agent and Device Metrics if not specifed: User Agent: --agent="Mozilla/5.0 (Linux; Android 9; Pixel 3 XL)" CSS Width, CSS Height, P...
mit
Python
ea54e294d68962ec370dc1dc2381720f53ce6f01
Add local_settings.py stuff
aapris/django-voikko-experiments,aapris/django-voikko-experiments
voiexp/local_settings_example.py
voiexp/local_settings_example.py
SECRET_KEY = '.uadjgfi67&%€yuhgsdfakjhgayv&/%yugjhdfsc$y53' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = ['127.0.0.1', 'some.example.com', ] LANGUAGE_CODE = 'fi-fi' TIME_ZONE = 'Europe/Helsinki'
mit
Python
8daf4237aa84a6b032e7627afb31b29a44f47ddc
Add another .py file for progress bar
vicyangworld/AutoOfficer
ProgressBar.py
ProgressBar.py
import sys, time from CmdFormat import CmdFormat class ProgressBar(CmdFormat): def __init__(self, count = 0, total = 0, width = 80, bWithheader=True, bWithPercent=True,barColor='white'): super(CmdFormat, self).__init__() self.count = count self.total = total self.width = wid...
mit
Python
49070f3ae636c458551ea53b1cb79975dd029a4c
add methods
jfzhang95/lightML
RNN/methods.py
RNN/methods.py
#!usr/bin/env python #-*- coding:utf-8 -*- """ @author: James Zhang @date: """ import numpy as np import theano import theano.tensor as T from theano.ifelse import ifelse from theano.tensor.shared_randomstreams import RandomStreams from collections import OrderedDict import copy import sys sys.setrecursionlimit(10000...
mit
Python
5e3b2ca14c4cc421e47d2709fe52390ee51eee11
Create S3toSQS.py
ndchristian/AWS-Lambda-Functions
SQS/S3toSQS.py
SQS/S3toSQS.py
""" Copyright 2016 Nicholas Christian 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, softwar...
apache-2.0
Python
f0e733a3f62d37dc25d70b334dd3e1e46936477d
Add missing non-important migration
ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display
homedisplay/info_transportation/migrations/0016_auto_20150304_2159.py
homedisplay/info_transportation/migrations/0016_auto_20150304_2159.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('info_transportation', '0015_line_type'), ] operations = [ migrations.AlterField( model_name='line', ...
bsd-3-clause
Python
468a4c181768f0dcfcaa40201c26015b7c94e39e
add random gesture test
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/moz4r/Test/random.py
home/moz4r/Test/random.py
import random from time import sleep i01 = Runtime.createAndStart("i01", "InMoov") i01.startHead("COM3") sleep(1) def MoveHeadRandomize(): if IcanMoveHeadRandom==1: i01.moveHead(random.randint(50,130),random.randint(50,130)) MoveHeadTimer = Runtime.start("MoveHeadTimer","Clock") MoveHeadTimer.setInterval(10...
apache-2.0
Python
bb63af8be9abf1bcc8f3716bbd1a1a375685533f
Add a new feed bot, abusehelper.contrib.abusech.feodoccbot, for catching abuse.ch's Feodo Tracker RSS feed.
abusesa/abusehelper
abusehelper/contrib/abusech/feodoccbot.py
abusehelper/contrib/abusech/feodoccbot.py
from abusehelper.core import bot from . import host_or_ip, split_description, AbuseCHFeedBot class FeodoCcBot(AbuseCHFeedBot): feed_type = "c&c" feeds = bot.ListParam(default=["https://feodotracker.abuse.ch/feodotracker.rss"]) # The timestamp in the title appears to be the firstseen timestamp, # sk...
mit
Python
94c125925b61a57bd29e9265dc993e1d868f2b7f
Create Selenium_Google.py
christieewen/Scripts,christieewen/Scripts,christieewen/Scripts
Selenium_Google.py
Selenium_Google.py
__author__ = 'Christie' # from selenium import webdriver from selenium.webdriver.common.keys import Keys browser = webdriver.Firefox() browser.get('http://www.google.com') assert 'Google' in browser.title #browser.get('http://www.yahoo.com') #assert 'Yahoo' in browser.title #elem = browser.find_element_by_name('p') ...
apache-2.0
Python
b00ae10f9ad841131ead33aa690587b7e2c50976
Add fetch recipe for fletch
hsharsha/depot_tools,hsharsha/depot_tools,duanwujie/depot_tools,aleonliao/depot_tools,hsharsha/depot_tools,duanwujie/depot_tools,aleonliao/depot_tools,primiano/depot_tools,duongbaoduy/gtools,Midrya/chromium,duongbaoduy/gtools,disigma/depot_tools,azureplus/chromium_depot_tools,CoherentLabs/depot_tools,aleonliao/depot_to...
recipes/fletch.py
recipes/fletch.py
# Copyright 2015 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. import sys import recipe_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 clas...
bsd-3-clause
Python
76c25395590aa9dee64ca138633f01b62ac0d26b
Add new provider migration for osf registrations
aaxelb/SHARE,laurenbarker/SHARE,CenterForOpenScience/SHARE,aaxelb/SHARE,zamattiac/SHARE,zamattiac/SHARE,zamattiac/SHARE,laurenbarker/SHARE,aaxelb/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,CenterForOpenScience/SHARE
providers/io/osf/registrations/migrations/0001_initial.py
providers/io/osf/registrations/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-08 16:17 from __future__ import unicode_literals from django.db import migrations import share.robot class Migration(migrations.Migration): dependencies = [ ('share', '0001_initial'), ('djcelery', '0001_initial'), ] operatio...
apache-2.0
Python
81391212d0e0cecfbce14195e1ca8cd1d96a6671
Create Euler_2.py
ANoonan93/Python_code
Euler_2.py
Euler_2.py
fib = 1 fib2 = 2 temp = 0 total = 0 while temp <= 4000000: temp = fib2 if temp % 2 == 0: total += temp temp = fib + fib2 fib = fib2 fib2 = temp print(total)
mit
Python
2c115a1b437aa36b42f74c04136601d9362dd5f6
add cutflow
rootpy/rootpy,kreczko/rootpy,rootpy/rootpy,ndawe/rootpy,ndawe/rootpy,rootpy/rootpy,ndawe/rootpy,kreczko/rootpy,kreczko/rootpy
rootpy/tree/cutflow.py
rootpy/tree/cutflow.py
import struct class Cutflow(object): def __init__(self, names): self.__names = names self.__dict = dict((name, '0') for name in names) def __setitem__(self, item, value): self.__dict[item] = str(int(bool(value))) def bitstring(self): return ''.join([self.__dict...
bsd-3-clause
Python
a5b2db02926573ec1bc338d611af9f0ca363b237
add convoluving response function
berkeley-stat159/project-iota
convoluving_response.py
convoluving_response.py
import numpy as np import matplotlib.pyplot as plt import scipy.stats from scipy.stats import gamma from stimuli import events2neural def hrf(times): """ Return values for HRF at given times """ # Gamma pdf for the peak peak_values = gamma.pdf(times, 6) # Gamma pdf for the undershoot undershoot_val...
bsd-3-clause
Python
7a91235b1d6ed45a5452c455dd86797bbf092d17
Update S3Session.py
Percona-Lab/mongodb_consistent_backup,Percona-Lab/mongodb_consistent_backup,timvaillancourt/mongodb_consistent_backup,timvaillancourt/mongodb_consistent_backup,Percona-Lab/mongodb_consistent_backup,timvaillancourt/mongodb_consistent_backup
mongodb_consistent_backup/Upload/S3/S3Session.py
mongodb_consistent_backup/Upload/S3/S3Session.py
import logging import boto import boto.s3 class S3Session: def __init__(self, access_key, secret_key, s3_host='s3.amazonaws.com', secure=True, num_retries=5, socket_timeout=15): self.access_key = access_key self.secret_key = secret_key self.s3_host = s3_host self.se...
import logging from boto import config from boto.s3 import S3Connection class S3Session: def __init__(self, access_key, secret_key, s3_host='s3.amazonaws.com', secure=True, num_retries=5, socket_timeout=15): self.access_key = access_key self.secret_key = secret_key self.s3_host ...
apache-2.0
Python
7c755e7839f7c602a6c93b1aa2f5011e89d15c85
Create command for generating prices for flavors
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
nodeconductor/iaas/management/commands/addmissingpricelistflavors.py
nodeconductor/iaas/management/commands/addmissingpricelistflavors.py
from __future__ import unicode_literals from django.contrib.contenttypes.models import ContentType from django.core.management.base import BaseCommand from nodeconductor.cost_tracking.models import DefaultPriceListItem from nodeconductor.iaas.models import Flavor, Instance class Command(BaseCommand): def handl...
mit
Python
2616d8f3ef51a8551ac14a9e83b0298b8165093a
Add work-in-progress script to fixup a standalone plugin library.
frizaro/Veloview,frizaro/Veloview,Kitware/VeloView,Kitware/VeloView,Kitware/VeloView,Kitware/VeloView,frizaro/Veloview,frizaro/Veloview,Kitware/VeloView
Superbuild/Projects/apple/fixup_plugin2.py
Superbuild/Projects/apple/fixup_plugin2.py
#!/usr/bin/env python import subprocess import os plugin = 'libVelodyneHDLPlugin.dylib' paraviewBuildDir = '/source/paraview/build' nameprefix = '@executable_path/../Libraries/' prefix = '@executable_path/../Libraries/' # The official ParaView OSX binaries are built with hdf5, not vtkhdf5. # Also, they are built wi...
apache-2.0
Python
735135c5570edd38324fe3e94aa2f4c2f3043627
Migrate data from contact_for_research_via and into contact_for_research_methods many to many field
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py
cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django.db.models import Q def migrate_contact_for_research_via_field_data(apps, schema_editor): ContactResearchMethod = apps.get_model("legalaid", "ContactResearchMethod") research_methods = {method.method: ...
mit
Python
59ac9745064dd02903e35c1c51781505bad505df
add gunicorn config
gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo
gunicorn.conf.py
gunicorn.conf.py
bind = "unix:/tmp/mygpo.sock" workers = 2 worker_class = "gevent" max_requests = 10000
agpl-3.0
Python
830a41911c5a2bc3982f35a6c6da38f6c659e78b
Create /pypardot/objects/tests/__init__.py
mneedham91/PyPardot4
pypardot/objects/tests/__init__.py
pypardot/objects/tests/__init__.py
mit
Python
f740dd60e7a4493269679e469c7f1ee5e24ff5af
add build/errors file
fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary
conary/build/errors.py
conary/build/errors.py
class BuildError(Exception): def __init__(self, msg): self.msg = msg def __repr__(self): return self.msg def __str__(self): return repr(self) class RecipeFileError(BuildError): pass class RecipeDependencyError(RecipeFileError): pass class BadRecipeNameError(RecipeFileError): ...
apache-2.0
Python
18f385de7b287a932192f690cb74ff70a452cf47
test settings file
jarcoal/django-filepicker-urlfield
fpurlfield/test_settings.py
fpurlfield/test_settings.py
# Django settings for test_project project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = () MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', }, } # TIME_ZONE = 'America/Chicago' # LANGUAGE_CODE = 'en-us' # USE_I18N = True # USE_L10N = Tr...
mit
Python
62c85cf12b388411919b86ac498908336bfd5e12
Create password_checker.py
MaximeKjaer/dailyprogrammer-challenges
Challenge-172/02-Intermediate-2/password_checker.py
Challenge-172/02-Intermediate-2/password_checker.py
#!/usr/bin/python import hashlib import uuid password = 'test123' f = open('salt.txt') salt = f.read() f.close() f = open('encrypted.txt') hashed_password = f.read() f.close() if hashlib.sha512(password + salt).hexdigest() == hashed_password: print 'ACCESS GRANTED' else: print 'ACCESS DENIED'
mit
Python
a59a2c3cbd9c8f029ab679f386ab61a6bcfb5108
test py script for multibody
openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro
software/perception/constraint_app/scripts/simulate_mb.py
software/perception/constraint_app/scripts/simulate_mb.py
import sys import os # for bottime: import time import random import numpy import termios, atexit from select import select def kbhit(): dr,dw,de = select([sys.stdin], [], [], 0) return dr <> [] myhome = os.environ.get("HOME") path1 = myhome + "/drc/software/build/lib/python2.7/site-packages" path2 = myhome ...
bsd-3-clause
Python
446984ad7b102587beac03d4329b5d0c061e2095
Add preserve_{current_canvas,batch_state} and invisible_canvas context managers
rootpy/rootpy,kreczko/rootpy,ndawe/rootpy,ndawe/rootpy,kreczko/rootpy,rootpy/rootpy,rootpy/rootpy,ndawe/rootpy,kreczko/rootpy
rootpy/context.py
rootpy/context.py
from contextlib import contextmanager import ROOT @contextmanager def preserve_current_canvas(): """ Context manager which ensures that the current canvas remains the current canvas when the context is left. """ old = ROOT.gPad.func() try: yield finally: if old: ...
bsd-3-clause
Python
7cb77ef66cad41e1b5d4907272b899a24a689c2d
Test for #423
dials/dials,dials/dials,dials/dials,dials/dials,dials/dials
test/algorithms/refinement/tst_dials-423.py
test/algorithms/refinement/tst_dials-423.py
#!/usr/bin/env cctbx.python # # Copyright (C) (2017) STFC Rutherford Appleton Laboratory, UK. # # Author: David Waterman. # # This code is distributed under the BSD license, a copy of which is # included in the root directory of this package. # """ Test the situation that led to https://github.com/dials/dials/iss...
bsd-3-clause
Python
32fcd5393402d868d8741385705f58b9e8eb7703
Update __init__.py
MycroftAI/mycroft-core,aatchison/mycroft-core,linuxipho/mycroft-core,MycroftAI/mycroft-core,aatchison/mycroft-core,forslund/mycroft-core,linuxipho/mycroft-core,Dark5ide/mycroft-core,forslund/mycroft-core,Dark5ide/mycroft-core
mycroft/version/__init__.py
mycroft/version/__init__.py
# Copyright 2016 Mycroft AI, Inc. # # This file is part of Mycroft Core. # # Mycroft Core 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 versio...
# Copyright 2016 Mycroft AI, Inc. # # This file is part of Mycroft Core. # # Mycroft Core 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 versio...
apache-2.0
Python
9cb122793d531690b621b4fa8f91481a105305e3
Add new module: minion.list
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/modules/minion.py
salt/modules/minion.py
# -*- coding: utf-8 -*- ''' Module to provide information about minions ''' # Import Python libs import os # Import Salt libs import salt.utils import salt.key def list(): ''' Return a list of accepted, denied, unaccepted and rejected keys. This is the same output as `salt-key -L` CLI Example: ...
apache-2.0
Python
91645e4abf4fa128a59257584ba385c19b642425
Add @s0undtech's nb_open module
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/utils/nb_popen.py
salt/utils/nb_popen.py
# -*- coding: utf-8 -*- ''' saltcloud.utils.nb_popen ~~~~~~~~~~~~~~~~~~~~~~~~ Non blocking subprocess Popen. :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. ''' ...
apache-2.0
Python
f6e32ae48265232f25866dd9060b7cb80551e333
Create main.py
e-parkinson/starter-naive-bayes-classifier
main.py
main.py
def calcProbPos(bPlus,bMinus,cPlus,cMinus): probPos = ((bPlus/cPlus)*(cPlus/(cPlus+cMinus)))/((bPlus+bMinus)/(cPlus+cMinus)) return probPos def calcMean(t,i): m = t/i return m print('Enter a statement without punctuation:') userStatement = input().lower() print('THINKING...') userStatemen...
mit
Python
87a9769af3d201b925a5a4a259ccbd007257b1d3
add python test: read_pack.py
akalend/hhvm-msgpack,akalend/hhvm-msgpack,akalend/hhvm-msgpack,akalend/hhvm-msgpack
test/read_pack.py
test/read_pack.py
import os import msgpack f = open("/tmp/data.bin", "r") package = f.read(1024) f.close() data = msgpack.unpackb(package) print data
mit
Python
3912416390ebe5df3c883b280cc6acac5169c1f7
Add test to check if elements have at least one owner
amolenaar/gaphor,amolenaar/gaphor
tests/test_elements_have_owner.py
tests/test_elements_have_owner.py
""" For all relevant model elements, check if there is at least one "owner" ("owner" is a derived union). This is needed to display all elements in the tree view. """ import itertools import pytest import gaphor.SysML.diagramitems import gaphor.UML.diagramitems from gaphor import UML from gaphor.core.modeling impor...
lgpl-2.1
Python
5307d1cf69c943f7f5fe9dfd475c93f317e8ebb7
add import script for West Lancashire
chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
polling_stations/apps/data_collection/management/commands/import_west_lancashire.py
polling_stations/apps/data_collection/management/commands/import_west_lancashire.py
from data_collection.management.commands import BaseXpressWebLookupCsvImporter class Command(BaseXpressWebLookupCsvImporter): council_id = 'E07000127' addresses_name = 'West Lancashire - PropertyPostCodePollingStationWebLookup-2017-03-08.TSV' stations_name = 'West Lancashire - PropertyPostCodePolli...
bsd-3-clause
Python
93997e72f63dd586d1a683475f49a466571a9fb0
Create index.py
yize1992/yize1992.github.io
index.py
index.py
#!/usr/bin/python print("Hello, World!");
apache-2.0
Python
4a48b8dd804f9a287d35b697d851a660eec80a75
Add tests for simple enums
adepue/richenum,hearsaycorp/richenum
tests/richenum/test_simple_enums.py
tests/richenum/test_simple_enums.py
import unittest from richenum import EnumConstructionException, enum Breakfast = enum( COFFEE=0, OATMEAL=1, FRUIT=2) class SimpleEnumTestSuite(unittest.TestCase): def test_members_are_accessible_through_attributes(self): self.assertEqual(Breakfast.COFFEE, 0) def test_lookup_by_name(sel...
mit
Python
92075a04b0835b1209eaa806c2aeb44ca371ff2b
Add harfbuzz 0.9.40
BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild
packages/harfbuzz.py
packages/harfbuzz.py
Package ('harfbuzz', '0.9.40', sources = ['http://www.freedesktop.org/software/%{name}/release/%{name}-%{version}.tar.bz2'], configure_flags = [ '--disable-silent-rules', '--without-cairo', '--without-freetype', '--without-glib', '--without-graphite2', '--with-icu', ])
mit
Python
564bf6484347fed1d3346ff42d79e4bba02a3c98
add firs test
nechepurenko/automation
test_add_group.py
test_add_group.py
# -*- coding: utf-8 -*- from selenium.webdriver.firefox.webdriver import WebDriver from selenium.webdriver.common.action_chains import ActionChains import time, unittest def is_alert_present(wd): try: wd.switch_to_alert().text return True except: return False class test_add_group(unitt...
apache-2.0
Python
774b59a2bba95c4b617ac49e279bcbe73d6b6f3b
Add a script to plot timing data
nbigaouette/sorting,nbigaouette/sorting,nbigaouette/sorting,nbigaouette/sorting
profiling/plot.py
profiling/plot.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import glob import numpy as np import matplotlib.pyplot as plt csv_files = glob.glob('*.csv') fig = plt.figure() ax = fig.add_subplot(111) colors = iter(plt.cm.rainbow(np.linspace(0,1,len(csv_files)))) for csv_file in csv_files: data = np.genfromtxt(csv_file, de...
bsd-3-clause
Python
48c4a4fe9531123d6ca2b9af18162c916af09cc9
Create moto_parser.py
aravindvnair99/Motorola-Moto-E-XT1022-condor-unbrick,aravindvnair99/Motorola-Moto-E-XT1022-condor-unbrick,aravindvnair99/Motorola-Moto-E-XT1022-condor-unbrick
Bootloader/moto_parser.py
Bootloader/moto_parser.py
mit
Python
13fdc81cb32842dc5e0f05d2aa84c997cd59daa3
Add test that, if we failed to open the log file, we don't try to write to it.
ipython/ipython,ipython/ipython
IPython/core/tests/test_logger.py
IPython/core/tests/test_logger.py
"""Test IPython.core.logger""" import nose.tools as nt _ip = get_ipython() def test_logstart_inaccessible_file(): try: _ip.logger.logstart(logfname="/") # Opening that filename will fail. except IOError: pass else: nt.assert_true(False) # The try block should never pas...
bsd-3-clause
Python
a8b3af76c1a6cbf61887f5721fd10bf2ef24b2f8
Create A_Salinity_vertical_section_zy_movie.py
Herpinemmanuel/Oceanography
Cas_6/Vertical_sections/A_Salinity_vertical_section_zy_movie.py
Cas_6/Vertical_sections/A_Salinity_vertical_section_zy_movie.py
plt.figure(2) ax = plt.subplot(projection=ccrs.PlateCarree()); ds1['S'].where(ds1.hFacC>0)[nt,:,:,280].plot() plt.title('Vertical Section (yz) of Salinity (XC = 0E)') plt.text(5,5,nt,ha='center',wrap=True) ax.coastlines() gl = ax.gridlines(draw_labels=True, alpha = 0.5, linestyl...
mit
Python
e653cffcd6711113ceb9ce412149e8155f4d6167
add the plot file
ComplexNetTSP/Simulation-Files-for-Large-Scale-Model-for-Information-Dissemination-with-Device-to-Device
plot.py
plot.py
# -*- encoding: utf-8 -*- # ------------------------------------------------------------------------------- # Copyright (c) 2014 Vincent Gauthier Telecom SudParis. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), ...
mit
Python
76e412121b80c39d9facc09a51d9b8aa4cdb9722
Add Check timeouts functionality
robas/data-scraping,robas/data-scraping
OAB/oab_check_timeouts.py
OAB/oab_check_timeouts.py
#!/usr/bin/python import argparse import pycurl import re import csv from StringIO import StringIO from urllib import urlencode from sys import exit # Arguments handling # Setting output filenames inputfile = "lalala_nok.csv" filename_ok = "output_ok.csv" filename_nok = "output_nok.csv" # Variable definitions url ...
mit
Python
a1337ca14fe2f21c849bd27132bdee079ac47e59
Add Session Support
kkstu/Torweb,kkstu/Torweb
app/Session.py
app/Session.py
#!/usr/bin/python # -*- coding:utf-8 -*- # Powered By KK Studio # Session Support For Tornado import hashlib import os import time import json class Session: def __init__(self,prefix='',session_id=None,expires=7200,redis=None): self.redis = redis self.expires = expires self.prefix = pre...
mit
Python
f9f5d2b040618bc7d7c26383218fad390bf9dd0a
add unit test_connection_detail_retriever
QualiSystems/vCenterShell,QualiSystems/vCenterShell
tests/test_common/test_cloudshell/test_connection_detail_retriever.py
tests/test_common/test_cloudshell/test_connection_detail_retriever.py
from unittest import TestCase from mock import Mock from common.cloudshell.conn_details_retriever import ResourceConnectionDetailsRetriever class TestConnectionDetailRetriever(TestCase): def test_connection_detail_retriever(self): helpers = Mock() cs_retriever_service = Mock() session = ...
apache-2.0
Python
f5675a1cebfe6aa0f8dda3b94aa30139e2528c49
Create broadcast.py
WebShark025/TheZigZagProject,WebShark025/TheZigZagProject
plugins/broadcast.py
plugins/broadcast.py
@bot.message_handler(commands=['bc']) def bc_msg(message): if message.from_user.id in ADMINS_IDS: if len(message.text.split()) < 2: bot.reply_to(message, "What should I broadcast?") return bcmsg = message.text.replace("/bc ","") allmembers = list(redisserver.smembers('zigzag_members')) for...
mit
Python
d34d1d50b853d3a205cbc60a75dd3911a9253b4e
update backend
kevmo314/canigraduate.uchicago.edu,kevmo314/canigraduate.uchicago.edu,kelly-shen/canigraduate.uchicago.edu,kevmo314/canigraduate.uchicago.edu,kelly-shen/canigraduate.uchicago.edu,kevmo314/canigraduate.uchicago.edu,kelly-shen/canigraduate.uchicago.edu,kelly-shen/canigraduate.uchicago.edu,kevmo314/canigraduate.uchicago.e...
app/scraper.py
app/scraper.py
import collections import json import httplib2 from oauth2client.client import GoogleCredentials from lib import Term def get_http(): http = httplib2.Http() GoogleCredentials.get_application_default().create_scoped([ 'https://www.googleapis.com/auth/firebase.database', 'https://www.googleapis....
mit
Python
620401abdb33b335452df709a1a1f2c4bc55cd4c
Add challenge day 6
lemming52/white_pawn,lemming52/white_pawn
leetcode/challenge/day06.py
leetcode/challenge/day06.py
""" Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] Note: All inputs will be in lowercase. The order of your output does not matter. """ class Solution: def groupAnagr...
mit
Python
7af8cc6d59a1d52e7decc90ecb9472f1c5825aa3
Create ds_hash_two_sum.py
ngovindaraj/Python
leetcode/ds_hash_two_sum.py
leetcode/ds_hash_two_sum.py
# @file Two Sum # @brief Given an array and target, find 2 nums in array that sum to target # https://leetcode.com/problems/two-sum/ ''' Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: G...
mit
Python
6a84ed3872303aa5b05462982406749d7bd447d4
Create main.py
brennanblue/unit_tests
main.py
main.py
#!/usr/bin/env python # Command line script to convert a single given number to and from several units import argparse from src.convert import kilometers_to_miles, miles_to_kilometers, \ years_to__minutes, minutes_to_years #parse args parse = argparse.ArgumentParser() parse.add_argument('value', type=float, help="Pro...
cc0-1.0
Python
7629a1cd27c80c5ebff91c4d01bf648f9d4c9b3c
Create main.py
m-bee/kgetb
main.py
main.py
agpl-3.0
Python
dbb147018a92426c5c9e19a523e0bd8d4c277035
Create LED_GPIO.py
jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi
setup/gpio/LED_GPIO.py
setup/gpio/LED_GPIO.py
import time import lgpio #17,27,22 LED = 17 # open the gpio chip and set the LED pin as output h = lgpio.gpiochip_open(0) lgpio.gpio_claim_output(h, LED) try: while True: # Turn the GPIO pin on lgpio.gpio_write(h, LED, 1) time.sleep(1) # Turn the GPIO pin off lgpio.gpi...
bsd-2-clause
Python
741dac8a1cc80549c74c231a0a7b598748f9fa4b
Create program.py
madhurilalitha/Python-Projects
ProductInventorySystem/program.py
ProductInventorySystem/program.py
from abc import * class Entity(metaclass = ABCMeta): @abstractproperty def id_number(self): return 0 class Product(Entity): id = 0 #initially no id exist (this is class variable) #Constructor def __init__(self,name = None,value =0,amount =0, scale ='kg'): self._id = Produc...
mit
Python
d856ea5597230b3befeb03049c45f3706bec5844
add kael-crontab cli
360skyeye/kael
kael/cron/cli.py
kael/cron/cli.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @version: @author: @time: 2017/6/15 """ import os import click @click.group() def cli(): pass def _check_task_is_py(command): command = command.strip() head = command.split(' ')[0] if 'py' == head.split('.')[-1]: return True return False...
apache-2.0
Python
599ed110458d5bcf23b74a95c5c472cc376ed702
Create field_notes.py
carthage-college/django-djspace,carthagecollege/django-djspace,carthage-college/django-djspace,carthagecollege/django-djspace,carthage-college/django-djspace,carthage-college/django-djspace,carthagecollege/django-djspace
djspace/application/field_notes.py
djspace/application/field_notes.py
# adding all the fields we need for this form.. #
mit
Python
f4b0135a48ee94d8504ddf24dcc16b8036c05f2c
add test file
cogniteev/logup-factory,cogniteev/logup-factory
tests/app_test.py
tests/app_test.py
import os import app import unittest import tempfile class FlaskrTestCase(unittest.TestCase): def setUp(self): self.db_fd, app.app.config['DATABASE'] = tempfile.mkstemp() app.app.config['TESTING'] = True self.app = app.app.test_client() app.init_db() def tearDown(self): ...
mit
Python
5b83b5e9a4e07af3f3dcd37d4f613039a42336e3
Add salt.modules.container_resource
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/modules/container_resource.py
salt/modules/container_resource.py
# -*- coding: utf-8 -*- ''' Common resources for LXC and systemd-nspawn containers These functions are not designed to be called directly, but instead from the :mod:`lxc <salt.modules.lxc>` and the (future) :mod:`nspawn <salt.modules.nspawn>` execution modules. ''' # Import python libs from __future__ import absolute...
apache-2.0
Python
a4eb209150385ff2f9fea3722c0256fe7ea20b40
Add unit test
Appdynamics/python-langutil,Appdynamics/python-langutil
test.py
test.py
from langutil import php import unittest class TestPHPScalarStringGeneratorFunctions(unittest.TestCase): def test_generate_scalar_int(self): self.assertEqual(php.generate_scalar(2), '2') def test_generate_scalar_float(self): self.assertEqual(php.generate_scalar(2.001), '2.001') def test_...
mit
Python
8c2b90d4d2c9fc8ad759284719eab4dd346ccab2
Add tests
sot/cxotime,sot/cxotime
test.py
test.py
""" Simple test of CxoTime. The base Time object is extremely well tested, so this simply confirms that the add-on in CxoTime works. """ import pytest import numpy as np from cxotime import CxoTime try: from Chandra.Time import DateTime HAS_DATETIME = True except ImportError: HAS_DATETIME = False def t...
bsd-2-clause
Python
815ef4b4b0dce640077e1f8ecd2fbe95598bf539
Create existing comments' owners records
kr41/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,j0gurt/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,josthkko/ggrc-core,plamut/ggrc-core,jo...
src/ggrc/migrations/versions/20160608132526_170e453da661_add_comments_owners_info.py
src/ggrc/migrations/versions/20160608132526_170e453da661_add_comments_owners_info.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: peter@reciprocitylabs.com # Maintained By: peter@reciprocitylabs.com """ Add comments' owners information. Create Date: 2016-06-08 13:25:26.635435...
apache-2.0
Python
b73c75bbafb53864a86f95949d6a028f9e79f718
Add Tile class
supermitch/Island-Gen
tile.py
tile.py
from __future__ import division class Tile(object): def __init__(self, x, y, z): self.x = x self.y = y self.height = z
mit
Python
9cc26c8a95ab4e6ffa9c991b5a575c7e6d62dae4
add pytest for util.location
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
pytests/util/test_location.py
pytests/util/test_location.py
import pytest import json import util.location @pytest.fixture def urllib_req(mocker): util.location.reset() return mocker.patch("util.location.urllib.request") @pytest.fixture def primaryLocation(): return { "country": "Middle Earth", "longitude": "10.0", "latitude": "20.5", ...
mit
Python
c9690cabe3c4d1d02307e3594a2cac505f4a166d
Add new image moments functions
astropy/photutils,larrybradley/photutils
photutils/utils/_moments.py
photutils/utils/_moments.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from ..centroids import centroid_com __all__ = ['_moments_central', '_moments'] def _moments_central(data, center=None, or...
bsd-3-clause
Python
6a3c960640741036c3f444547cada1e1b7a24100
Add first unit test for api
mitre/multiscanner,mitre/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,awest1339/multiscanner,awest1339/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,mitre/multiscanner
tests/test_api.py
tests/test_api.py
import os import sys import json import responses import unittest CWD = os.path.dirname(os.path.abspath(__file__)) MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Allow import of api.py if os.path.join(MS_WD, 'utils') not in sys.path: sys.path.insert(0, os.path.join(MS_WD, 'utils')) # Use mu...
mpl-2.0
Python
d0432f1d3d48634c00027b71eb131c5e36827c4b
Add dropdown element located in widget bar
plamut/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,prasannav7/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,josthkko/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,josthkko/ggrc-core,josthkko/ggrc-core,josthkko/ggrc-core,j0...
src/lib/constants/element/widget_bar/dropdown.py
src/lib/constants/element/widget_bar/dropdown.py
SELECTOR = ".inner-nav-item" CLAUSES = "Clauses" CONTRACTS = "Contracts" DATA_ASSETS = "Data Assets" FACILITIES = "Facilities" MARKETS = "Markets" ORG_GROUPS = "Org Groups" POLICIES = "Policies" PROCESSES = "Processes" PRODUCTS = "Products" PROJECTS = "Projects" STANDARDS = "Standards" SYSTEMS = "Systems" VENDORS = "V...
apache-2.0
Python
763680e57b28a9746050206cd63450bf11c3e512
Fix ProgramEditor permissions to not include Program delete
VinnieJohns/ggrc-core,prasannav7/ggrc-core,prasannav7/ggrc-core,AleksNeStu/ggrc-core,vladan-m/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,prasannav7/ggrc-core,hyperNURb/ggrc-core,selahssea/ggrc-core,hasanalom/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,andrei-karalionak/ggrc-core,uskudnik/ggrc-core,NejcZupec/...
src/ggrc_basic_permissions/migrations/versions/20131010001257_10adeac7b693_fix_programeditor_pe.py
src/ggrc_basic_permissions/migrations/versions/20131010001257_10adeac7b693_fix_programeditor_pe.py
"""Fix ProgramEditor permissions Revision ID: 10adeac7b693 Revises: 8f33d9bd2043 Create Date: 2013-10-10 00:12:57.391754 """ # revision identifiers, used by Alembic. revision = '10adeac7b693' down_revision = '8f33d9bd2043' import json import sqlalchemy as sa from alembic import op from datetime import datetime fro...
apache-2.0
Python
da488fa4505de818a5efcec13fdb7963d5051389
Create util.py
nikohernandiz/TVLineFinder
util.py
util.py
import requests import logging def downloadRedditUrl(url): print "downloadRedditUrl(): Downloading url: {}".format(url) #assert url.startswith('https://www.reddit.com/r/learnprogramming/') headers = { 'User-Agent': 'Searching Reddit bot version 1.0', } r = requests.get(url,headers = headers) if r.stat...
mit
Python
2beac94eb32fc4adb976c4a10018de8518e4bada
Add wsgi file
phantomii/helix
wsgi.py
wsgi.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2016 Eugene Frolov <eugene@frolov.net.ru> # # 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
7c095c82e1b6a16da65b8fcfaf77d9a606321d76
Create sum67.py
dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey
Python/CodingBat/sum67.py
Python/CodingBat/sum67.py
# http://codingbat.com/prob/p108886 def sum67(nums): sum = 0 i = 0 while i < len(nums): if nums[i] == 6: while nums[i] != 7: i += 1 else: sum += nums[i] i += 1 return sum
mit
Python
28f41fcfc80bc562343e510e3e0e5e57d97d27ea
Create Scrap_share_marketdata.py
codepunter/scrap-with-python
Scrap_share_marketdata.py
Scrap_share_marketdata.py
import urllib import re #TItile scrap of any website # regex='<title>(.+?)</title>' # pattern =re.compile(regex) # htmlfile = urllib.urlopen("https://www.cnn.com") # htmltext=htmlfile.read() # titles=re.findall(pattern,htmltext) # print titles # Scrap using finance yahoo.com # symbolfile=open("symbols.txt") # sym...
apache-2.0
Python
1ec2f110c16de75503092df873693e2929baa8cd
add the "Cargos Importantes" field
datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit
candidates/migrations/0018_cr_add_important_posts_field.py
candidates/migrations/0018_cr_add_important_posts_field.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.db import models, migrations def add_extra_field(apps, schema_editor): ExtraField = apps.get_model('candidates', 'ExtraField') if settings.ELECTION_APP == 'cr': ExtraField.objects.create( ...
agpl-3.0
Python
0f5a52a215f8f1e16ab5ddf622a541919ab760ce
Fix up language detector.
alephdata/aleph,alephdata/aleph,OpenGazettes/aleph,OpenGazettes/aleph,OpenGazettes/aleph,smmbllsm/aleph,OpenGazettes/aleph,gazeti/aleph,pudo/aleph,gazeti/aleph,alephdata/aleph,pudo/aleph,smmbllsm/aleph,gazeti/aleph,gazeti/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,smmbllsm/aleph
aleph/analyze/language.py
aleph/analyze/language.py
import logging import langid # https://github.com/saffsd/langid.py from aleph.analyze.analyzer import Analyzer log = logging.getLogger(__name__) THRESHOLD = 0.9 CUTOFF = 30 class LanguageAnalyzer(Analyzer): def analyze_text(self, document, meta): if len(meta.languages): return lang...
import logging import langid # https://github.com/saffsd/langid.py from aleph.analyze.analyzer import Analyzer log = logging.getLogger(__name__) THRESHOLD = 0.9 CUTOFF = 30 class LanguageAnalyzer(Analyzer): def analyze_text(self, document, meta): if len(meta.languages): return lang...
mit
Python
57fe1a44c2285f39cc1454bbd6cfb3ce621348c3
Add a test to validate the user creation
aligot-project/aligot,aligot-project/aligot,aligot-project/aligot,skitoo/aligot
aligot/tests/test_user.py
aligot/tests/test_user.py
# coding: utf-8 from django.core.urlresolvers import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from ..models import User class TestUser(TestCase): def setUp(self): self.client = APIClient() def test_create_without_params(se...
mit
Python
d63235026ec40857d3cbeef67064879d4b180eeb
add pip_upgrade
HongxuChen/dotfiles,HongxuChen/dotfiles,HongxuChen/dotfiles
_bin/pip_upgrade.py
_bin/pip_upgrade.py
#!/usr/bin/env python import pip from subprocess import call for dist in pip.get_installed_distributions(): call("pip install --upgrade " + dist.project_name, shell=True)
mit
Python
cba5577517659e13511dcd45c996fd292cbd1cf8
Add Eq typeclass definition
NicolasT/typeclasses
typeclasses/eq.py
typeclasses/eq.py
# typeclasses, an educational implementation of Haskell-style type # classes, in Python # # Copyright (C) 2010 Nicolas Trangez <eikke eikke 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 published by the Free Software Fou...
lgpl-2.1
Python
2c7a40679e6202446a2e1076e19832589abf9ef9
Add test mobile flatpage
GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin
geotrek/api/tests/test_mobile_flatpage.py
geotrek/api/tests/test_mobile_flatpage.py
from __future__ import unicode_literals import json from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test.testcases import TestCase from geotrek.flatpages.factories import FlatPageFactory from geotrek.flatpages.models import FlatPage FLATPAGE_DETAIL_PROPERTIES_JSO...
bsd-2-clause
Python
4afd2553625db404cdfedfcf336079b3d9d723e3
Add test for auth service pre-run time validation checks.
StackStorm/st2,Plexxi/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,tonybaloney/st2,tonybaloney/st2,nzlosh/st2,nzlosh/st2,tonybaloney/st2
st2auth/tests/unit/test_validation_utils.py
st2auth/tests/unit/test_validation_utils.py
# Licensed to the StackStorm, Inc ('StackStorm') 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 # (the "License"); you may not use th...
apache-2.0
Python
b413af07917f3555edb4b69c4d4a0e4d5c4a629f
Create boolean_logic_from_scratch.py
Kunalpod/codewars,Kunalpod/codewars
boolean_logic_from_scratch.py
boolean_logic_from_scratch.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Boolean Logic from Scratch #Problem level: 7 kyu def func_or(a,b): #your code here - do no be lame and do not use built-in code! if bool(a) or bool(b): return True return False def func_xor(a,b): #your code here - remember to consider trut...
mit
Python
df9c8b2c2e616937afdbf09fc4a76ac7b821c8a5
Add test (which we fail at the moment)
openhatch/oh-bugimporters,openhatch/oh-bugimporters,openhatch/oh-bugimporters
bugimporters/tests/test_spider.py
bugimporters/tests/test_spider.py
import os import bugimporters.main from mock import Mock HERE = os.path.dirname(os.path.abspath(__file__)) # Create a global variable that can be referenced both from inside tests # and from module level functions functions. bug_data_transit = { 'get_fresh_urls': None, 'update': None, 'delete_by_url': ...
agpl-3.0
Python
cde401e95bef16b3bcc815251187af094240b598
Create check_linux.py
applicant1844244/mit-decision-check
check_linux.py
check_linux.py
import cups from twill.commands import * import html2text import subprocess import time ##Emotional words acceptance = ['congratulat', 'enjoy', 'party'] rejection = ['sorry', 'unfortunately', 'disappoint'] ##function to login and save the html def retrieve(): go('https://decisions.mit.edu/decision.php') fv("...
mit
Python
fde083c87f0e2582fbf57415e957b93d116ad67a
Create RequestHandler related to GCI.
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
app/soc/modules/gci/views/base.py
app/soc/modules/gci/views/base.py
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
apache-2.0
Python
e2669eddb9187db9a71095d8ed860f8b25369e78
add new package (#20106)
iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack
var/spack/repos/builtin/packages/py-catkin-pkg/package.py
var/spack/repos/builtin/packages/py-catkin-pkg/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) class PyCatkinPkg(PythonPackage): """Library for retrieving information about catkin packages.""" homepage = "ht...
lgpl-2.1
Python
0106355df43bc35a75aafc6b9070f78131e89bef
Test for switching to postgres search backend
p/wolis-phpbb,p/wolis-phpbb
tests/search_backend_postgres.py
tests/search_backend_postgres.py
from wolis.test_case import WolisTestCase class SearchBackendPostgresTest(WolisTestCase): def test_set_search_backend(self): self.login('morpheus', 'morpheus') self.acp_login('morpheus', 'morpheus') self.change_acp_knob( link_text='Search settings', check_pa...
bsd-2-clause
Python
1f12da3d049527f838ab21c042b8f18e1977af49
Migrate existing platform admin services to not be counted
alphagov/notifications-api,alphagov/notifications-api
migrations/versions/0283_platform_admin_not_live.py
migrations/versions/0283_platform_admin_not_live.py
"""empty message Revision ID: 0283_platform_admin_not_live Revises: 0282_add_count_as_live Create Date: 2016-10-25 17:37:27.660723 """ # revision identifiers, used by Alembic. revision = '0283_platform_admin_not_live' down_revision = '0282_add_count_as_live' from alembic import op import sqlalchemy as sa STATEMEN...
mit
Python
8e0e28c45616479c3d1fea9be78553185126743b
change case_type to location_type to be more clear about what's expected
dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,gmimano/commcaretest,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,gmimano/...
corehq/apps/consumption/models.py
corehq/apps/consumption/models.py
from decimal import Decimal from couchdbkit.ext.django.schema import Document, StringProperty, DecimalProperty TYPE_DOMAIN = 'domain' TYPE_PRODUCT = 'product' TYPE_SUPPLY_POINT_TYPE = 'supply-point-type' TYPE_SUPPLY_POINT = 'supply-point' class DefaultConsumption(Document): """ Model for setting the default ...
from decimal import Decimal from couchdbkit.ext.django.schema import Document, StringProperty, DecimalProperty TYPE_DOMAIN = 'domain' TYPE_PRODUCT = 'product' TYPE_SUPPLY_POINT_TYPE = 'supply-point-type' TYPE_SUPPLY_POINT = 'supply-point' class DefaultConsumption(Document): """ Model for setting the default ...
bsd-3-clause
Python
6857624e9d6633038f0565a520de856ee40def09
Test with many envs and large groups
lhupfeldt/multiconf
test/many_envs_test.py
test/many_envs_test.py
# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT # All rights reserved. This work is under a BSD license, see LICENSE.TXT. from .. import ConfigRoot from ..envs import EnvFactory ef = EnvFactory() envs = [] groups = [] for ii in range(0, 16): local_envs = [] for jj in range(0, 128): local_envs...
bsd-3-clause
Python