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 |
|---|---|---|---|---|---|---|---|---|
0db094aba5095b63a8f9bfb066afb0048617f87e | add update_GeneAtlas_images.py | SuLab/scheduled-bots,SuLab/scheduled-bots,SuLab/scheduled-bots | scheduled_bots/scripts/update_GeneAtlas_images.py | scheduled_bots/scripts/update_GeneAtlas_images.py | """
One off script to change GeneAtlas images to point to full-sized versions
https://github.com/SuLab/GeneWikiCentral/issues/1
As described at https://www.wikidata.org/wiki/Property_talk:P692#How_about_using_full_size_image_instead_of_small_thumbnail.3F
update all uses of the Gene Atlas Image property to use the full... | mit | Python | |
427a95f0c56facc138448cde7e7b9da1bcdc8ea4 | Add super basic Hypothesis example | dkua/pyconca16-talk | add_example.py | add_example.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Unit Tests
def test_add_zero():
assert 0 + 1 == 1 + 0
def test_add_single_digits():
assert 1 + 2 == 2 + 1
def test_add_double_digits():
assert 10 + 12 == 12 + 10
# Property-based Test
from hypothesis import given
import hypothesis.strategies as st
@giv... | mit | Python | |
3a4cb29e91008225c057feb3811e93b59f99d941 | use flask-mail | voltaire/minecraft-site,voltaire/minecraft-site,voltaire/minecraft-site | application.py | application.py | from flask import Flask
from flask.ext.mail import Mail, Message
mail = Mail()
app = Flask(__name__)
app.config.update(
MAIL_SERVER='smtp.gmail.com',
MAIL_PORT='465',
MAIL_USE_SSL=True,
MAIL_USERNAME='nokbar@voltaire.sh',
MAIL_PASSWORD='H3rpD3rpL0l')
mail.init_app(app)
@app.rou... | bsd-3-clause | Python | |
21a504dce25a1b22bda27cd74a443af98b24ad14 | Add pseudo filter combining pypandoc and panflute | sergiocorreia/panflute-filters | filters/extract_urls.py | filters/extract_urls.py | import io
import pypandoc
import panflute
def prepare(doc):
doc.images = []
doc.links = []
def action(elem, doc):
if isinstance(elem, panflute.Image):
doc.images.append(elem)
elif isinstance(elem, panflute.Link):
doc.links.append(elem)
if __name__ == '__main__':
data = pyp... | bsd-3-clause | Python | |
b811bb9e9469a23921f841d4bfe3b52928a83e14 | Create b.py | xsthunder/a,xsthunder/a,xsthunder/a,xsthunder/acm,xsthunder/acm,xsthunder/acm,xsthunder/a,xsthunder/acm,xsthunder/a | at/abc126/b.py | at/abc126/b.py | read = input
s = read()
a, b = map(int , [s[:2], s[2:]])
YYMM = False
MMYY = False
if 1 <= b and b <= 12:
YYMM = True
if 1 <= a and a <= 12:
MMYY = True
if YYMM and MMYY :
print('AMBIGUOUS')
elif YYMM and not MMYY:
print('YYMM')
elif not YYMM and MMYY:
print('MMYY')
else :
print('NA')
| mit | Python | |
32c025a217f7771be94976fda6ede2d80855b4b6 | Move things to new units module | olemke/pyatmlab,gerritholl/pyatmlab | pyatmlab/units.py | pyatmlab/units.py | """Various units-related things
"""
from pint import (UnitRegistry, Context)
ureg = UnitRegistry()
ureg.define("micro- = 1e-6 = µ-")
# aid conversion between different radiance units
sp2 = Context("radiance")
sp2.add_transformation(
"[length] * [mass] / [time] ** 3",
"[mass] / [time] ** 2",
lambda ureg, x... | bsd-3-clause | Python | |
50494947bdf7fc8fce50cb5f589c84fd48db4b05 | test perm using py.test #1150 | pkimber/login,pkimber/login,pkimber/login | login/tests/fixture.py | login/tests/fixture.py | # -*- encoding: utf-8 -*-
import pytest
from login.tests.factories import (
TEST_PASSWORD,
UserFactory,
)
class PermTest:
def __init__(self, client):
setup_users()
self.client = client
def anon(self, url):
self.client.logout()
response = self.client.get(url)
... | apache-2.0 | Python | |
1a98ccfbff406509d9290e76bbdf8edbb862fc1d | Solve orderred dict | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | python/py-collections-ordereddict.py | python/py-collections-ordereddict.py | from collections import OrderedDict
d = OrderedDict()
number_of_items = int(input().strip())
for i in range(number_of_items):
item, delimeter, price = input().strip().rpartition(" ")
price = int(price)
if (item in d):
previous_total_purchased = d.get(item)
next_total_purchased = previous_to... | mit | Python | |
fa4155114304d1ebc9e3bb04f546ce7d4708c381 | Add simple pipeline | flypy/pykit,ContinuumIO/pykit,ContinuumIO/pykit,Inaimathi/pykit,flypy/pykit,Inaimathi/pykit | pykit/pipeline.py | pykit/pipeline.py | # -*- coding: utf-8 -*-
"""
Pipeline that determines phase ordering and execution.
"""
from __future__ import print_function, division, absolute_import
import types
cpy = {
'lower_convert': lower_convert,
}
lower = {
}
# ______________________________________________________________________
# Execute pipeline... | bsd-3-clause | Python | |
141005c72b1686d73cdc581e9ee8313529e11e4c | Add health check script. | serac/powermon,serac/powermon | tools/health-check.py | tools/health-check.py | #!/usr/bin/python
# Health check script that examines the /status/ URI and sends mail on any
# condition other than 200/OK.
# Configuration is via environment variables:
# * POWERMON_STATUS - absolute URL to /status/ URI
# * POWERMON_SMTPHOST - SMTP host name used to send mail
# * POWERMON_MAILTO - email addres... | apache-2.0 | Python | |
210eba35fc4473e626fc58a8e4ea3cdbb6abdc28 | add undocumented function to display new messages. | yskmt/rtv,shaggytwodope/rtv,TheoPib/rtv,michael-lazar/rtv,shaggytwodope/rtv,yskmt/rtv,michael-lazar/rtv,TheoPib/rtv,bigplus/rtv,5225225/rtv,5225225/rtv,michael-lazar/rtv | rtv/docs.py | rtv/docs.py | from .__version__ import __version__
__all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE',
'SUBMISSION_FILE', 'COMMENT_EDIT_FILE']
AGENT = """\
desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\
""".format(__version__)
SUMMARY = """
Reddit Terminal Viewer is... | from .__version__ import __version__
__all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE',
'SUBMISSION_FILE', 'COMMENT_EDIT_FILE']
AGENT = """\
desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\
""".format(__version__)
SUMMARY = """
Reddit Terminal Viewer is... | mit | Python |
04287120372a6fdb906ed9f27ead4c5f91d5690e | Add a modified version of simple bot | fisadev/tota | tota/heroes/lenovo.py | tota/heroes/lenovo.py | from tota.utils import closest, distance, sort_by_distance, possible_moves
from tota import settings
__author__ = "angvp"
def create():
def lenovo_hero_logic(self, things, t):
# some useful data about the enemies I can see in the map
enemy_team = settings.ENEMY_TEAMS[self.team]
enemies =... | mit | Python | |
2f7d5f30fd6b6cb430c55b21d7cab75800bcfe97 | Add a little hacky highlighter | chourobin/weave-demos,errordeveloper/weave-demos,errordeveloper/weave-demos,chourobin/weave-demos,errordeveloper/weave-demos,chourobin/weave-demos,chourobin/weave-demos,errordeveloper/weave-demos | screencasts/hello-weave/highlight.py | screencasts/hello-weave/highlight.py | import json
prompt = 'ilya@weave-01:~$ '
highlight = [
('weave-01', 'red'),
('weave-02', 'red'),
('docker', 'red'),
('run', 'red'),
('--name', 'red'),
('hello', 'red'),
('netcat', 'red'),
('-lk', 'red'),
('1234', 'red'),
('sudo curl -s -L git.io/weave -o /usr/local/bin/weave', 'red'),
('b4e40e4b... | apache-2.0 | Python | |
6b4733c213046c7a16bf255cfbc92408e2f01423 | Add test for registry model hash | RickyCook/DockCI,sprucedev/DockCI-Agent,RickyCook/DockCI,sprucedev/DockCI,sprucedev/DockCI,sprucedev/DockCI,sprucedev/DockCI,sprucedev/DockCI-Agent,RickyCook/DockCI,RickyCook/DockCI | tests/models/test_authenticated_registry_model.py | tests/models/test_authenticated_registry_model.py | import pytest
from dockci.models.auth import AuthenticatedRegistry
BASE_AUTHENTICATED_REGISTRY = dict(
id=1,
display_name='Display name',
base_name='Base name',
username='Username',
password='Password',
email='Email',
insecure=False,
)
class TestHash(object):
""" Test ``Authenticate... | isc | Python | |
984b8ecd043986877349c6de789842155b8a9fa1 | Add own version of compare script | jorisvanzundert/sfsf | scr_compare_chunks_MK.py | scr_compare_chunks_MK.py | import csv
import string
from nltk import word_tokenize
from sfsf import training_data_factory
#from sfsf import sfsf_config
from collections import defaultdict, Counter
def read_chunk_scores( score_file ):
top_chunk_scores = defaultdict(list)
bottom_chunk_scores = defaultdict(list)
with open(score_file, '... | mit | Python | |
57dc7e58dcfd101c29026c8c07763cba2eb7dd14 | add helper script to inspect comments on released content | alexanderkyte/mitls-f7,alexanderkyte/mitls-f7,alexanderkyte/mitls-f7,alexanderkyte/mitls-f7,alexanderkyte/mitls-f7 | scripts/show_comments.py | scripts/show_comments.py | #!/usr/bin/env python
from __future__ import print_function
import sys
def main():
fs = open(sys.argv[1]).read().splitlines()
fs = map(lambda f: {'name':f, 'contents':open(f).readlines()},fs)
for f in fs:
buffer = ''
multiline = 0
is_first = True
for i,line in enumerate(f['contents'],start=1):
multiline... | apache-2.0 | Python | |
4b83b7a3d286f60454c96ae609ce18c731339877 | add a stub fuse-based fs component | jeffpc/nx01 | src/fs/nomadfs.py | src/fs/nomadfs.py | #!/usr/bin/env python
#
# Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
#
# 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... | mit | Python | |
4efc50f91d2b141270739ea9f8bef9685cc86e7f | add houdini/shelf/fitcam | cineuse/CNCGToolKit,cineuse/CNCGToolKit | houdini/shelf/fitcam.py | houdini/shelf/fitcam.py | # -*- coding: utf-8 -*-
import hou
import toolutils
def setfit(oldCam, resx, resy):
oldCam.setDisplayFlag(False)
oldCam.parm(oldCam.path() + "/resx").set(resx)
oldCam.parm(oldCam.path() + "/resy").set(resy)
camups = oldCam.inputAncestors()
if camups == ():
camu... | mit | Python | |
1886af3e8c96108a8f7bdb320969373e66299bf4 | Create __init__.py | garyelephant/snippets,garyelephant/snippets,garyelephant/snippets,garyelephant/snippets | python/django_standalone_orm/__init__.py | python/django_standalone_orm/__init__.py | mit | Python | ||
f7046ba07a3ec41d26df0b0bce67c6ab8013bfd8 | Fix for the activity whose transcripts are stunted | gnowledge/gstudio,gnowledge/gstudio,gnowledge/gstudio,gnowledge/gstudio,gnowledge/gstudio | doc/release-scripts/Fix_Transcript_Stunted.py | doc/release-scripts/Fix_Transcript_Stunted.py | '''
Issue :Transcript for model comversations stunted
Fix : The CSS used for the transcript part is not same as that of the others (which used the toggler CSS). Have made the required changes for the transcripts
related to the audio and model conversations which come up on click of answer this in Unit 0 :English... | agpl-3.0 | Python | |
88548319d8a7c44d039ce269621f0a9ff4ee8af6 | refactor leslie matrix; add leslie_exe.py | puruckertom/poptox | poptox/leslie/leslie_exe.py | poptox/leslie/leslie_exe.py | import numpy as np
import os.path
import pandas as pd
import sys
#find parent directory and import base (travis)
parentddir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
sys.path.append(parentddir)
from base.uber_model import UberModel, ModelSharedInputs
# print(sys.path)
# print(os.path)
... | unlicense | Python | |
d3d6a6018d55581bf081c93386f6676c8bb105ce | Add module for running the main simulation | JoshuaBrockschmidt/ideal_ANN | simulate.py | simulate.py | import genetic
import sys
output = sys.stdout
def setOutput(out):
output = out
genetic.setOutput(output)
# Test data for a XOR gate
testData = (
(0.1, 0.1, 0.9),
(0.1, 0.9, 0.9),
(0.9, 0.1, 0.9),
(0.9, 0.9, 0.1)
)
def simulate():
sim = genetic.Simulation(2, 1, testData, 100)
sim.simu... | mit | Python | |
2cd1e7fcdf53c312c3db8e6f1d257084a87cccbb | Add migration to update action implementation hashes. | mozilla/normandy,mozilla/normandy,mozilla/normandy,mozilla/normandy | recipe-server/normandy/recipes/migrations/0045_update_action_hashes.py | recipe-server/normandy/recipes/migrations/0045_update_action_hashes.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import hashlib
from base64 import b64encode, urlsafe_b64encode
from django.db import migrations
def make_hashes_urlsafe_sri(apps, schema_editor):
Action = apps.get_model('recipes', 'Action')
for action in Action.objects.all():
data = a... | mpl-2.0 | Python | |
37a181a987e4974d21c3e043d66e0d65468785aa | Check in io module | bkg/greenwich | contones/io.py | contones/io.py | import multiprocessing
import os
import uuid
from osgeo import gdal
import contones.raster
def _run_encoder(path, encoder_cls, geom=None):
encoder = encoder_cls()
with contones.raster.Raster(path) as r:
if geom:
with r.crop(geom) as cropped:
cropped.save(encoder)
el... | bsd-3-clause | Python | |
1253cf2773b510f88b4391e22f0e98b4ef3cdf52 | Create serializers.py | dfurtado/generator-djangospa,dfurtado/generator-djangospa,dfurtado/generator-djangospa | templates/root/main/serializers.py | templates/root/main/serializers.py | from django.contrib.auth.models import User
from rest_framework import serializers
from <%= appName %>.models import Sample
class SampleSerializer(serializers.HyperlinkedModelSerializer):
owner = serializers.ReadOnlyField(source='owner.username')
class Meta:
model = Sample
fields = ('id', 'created', 'name', 'i... | mit | Python | |
c6015e049ab1ce059298af9147851f9a6a1c1e46 | Replace NotImplemented singleton with NotImplementedError exceptin | selahssea/ggrc-core,edofic/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/... | src/ggrc_workflows/services/workflow_cycle_calculator/one_time_cycle_calculator.py | src/ggrc_workflows/services/workflow_cycle_calculator/one_time_cycle_calculator.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: urban@reciprocitylabs.com
# Maintained By: urban@reciprocitylabs.com
import datetime
from ggrc_workflows.services.workflow_cycle_calculator import ... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: urban@reciprocitylabs.com
# Maintained By: urban@reciprocitylabs.com
import datetime
from ggrc_workflows.services.workflow_cycle_calculator import ... | apache-2.0 | Python |
5dc2f523473f4921c3b7f1915966c0ac22b09474 | Create package and metadatas | Fantomas42/mots-vides,Fantomas42/mots-vides | mots_vides/__init__.py | mots_vides/__init__.py | """
Mots-vides
"""
__version__ = '2015.1.21.dev0'
__author__ = 'Fantomas42'
__email__ = 'fantomas42@gmail.com'
__url__ = 'https://github.com/Fantomas42/mots-vides'
| bsd-3-clause | Python | |
02e9602a5723aa3cbe9395290e4c18e439065007 | Remove redundant code | gfyoung/numpy,seberg/numpy,anntzer/numpy,abalkin/numpy,endolith/numpy,jakirkham/numpy,pdebuyl/numpy,WarrenWeckesser/numpy,pbrod/numpy,mattip/numpy,jorisvandenbossche/numpy,charris/numpy,endolith/numpy,jorisvandenbossche/numpy,jorisvandenbossche/numpy,mattip/numpy,ahaldane/numpy,jorisvandenbossche/numpy,simongibbons/num... | numpy/distutils/tests/test_fcompiler.py | numpy/distutils/tests/test_fcompiler.py | from __future__ import division, absolute_import, print_function
from numpy.testing import assert_
import numpy.distutils.fcompiler
customizable_flags = [
('f77', 'F77FLAGS'),
('f90', 'F90FLAGS'),
('free', 'FREEFLAGS'),
('arch', 'FARCH'),
('debug', 'FDEBUG'),
('flags', 'FFLAGS'),
('linker_... | from __future__ import division, absolute_import, print_function
from numpy.testing import assert_
import numpy.distutils.fcompiler
customizable_flags = [
('f77', 'F77FLAGS'),
('f90', 'F90FLAGS'),
('free', 'FREEFLAGS'),
('arch', 'FARCH'),
('debug', 'FDEBUG'),
('flags', 'FFLAGS'),
('linker_... | bsd-3-clause | Python |
b9bb7e36977b757a63015ac3af8b538f0c67f16c | add manage.py | vyacheslav-bezborodov/dvhb | manage.py | manage.py | from argparse import ArgumentParser
def apply_migrates(args):
print('migrate')
def make_parser():
parser = ArgumentParser()
subparsers = parser.add_subparsers()
migrate = subparsers.add_parser('migrate')
migrate.set_defaults(func=apply_migrates)
return parser
if __name__ == '__main__':
... | mit | Python | |
67a3a0050c90c500c0c08a638436799df441c326 | Add markov implementation | greenify/zodiacy,greenify/zodiacy | markov.py | markov.py | from nltk import word_tokenize, pos_tag
import numpy
import random
from copy import deepcopy
def compute_transitions(tokens, precondition=lambda token, last_token: True, order=1):
last_tokens = [tokens[0]]
transitions = dict()
# count the occurences of "present | past"
for token in tokens[1:]:
... | mit | Python | |
58cb5bde9c658e7b5fc7a7c946951e8abaade5e4 | Check against sixtrack in different file | SixTrack/SixTrackLib,SixTrack/SixTrackLib,SixTrack/SixTrackLib,SixTrack/SixTrackLib | examples/python/test_workflow_footprint/001_checks_against_sixtrack.py | examples/python/test_workflow_footprint/001_checks_against_sixtrack.py | import pickle
import numpy as np
import pysixtrack
import sixtracktools
# Load machine
with open('line.pkl', 'rb') as fid:
pbline = pickle.load(fid)
line = pysixtrack.Line.fromline(pbline)
# Load particle on CO
with open('particle_on_CO.pkl', 'rb') as fid:
part_on_CO = pysixtrack.Particles.from_dict(
... | lgpl-2.1 | Python | |
8fa7120606e206d08acbad198e253ea428eef584 | Add tests for inline list compilation | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | tests/compiler/test_inline_list_compilation.py | tests/compiler/test_inline_list_compilation.py | import pytest
from tests.compiler import compile_snippet, internal_call, STATIC_START, LOCAL_START
from thinglang.compiler.errors import NoMatchingOverload, InvalidReference
from thinglang.compiler.opcodes import OpcodePopLocal, OpcodePushStatic
def test_inline_list_compilation():
assert compile_snippet('list<... | mit | Python | |
142cb17be1c024839cd972071b2f9665c87ed5f1 | Update downloadable clang to r338452 | alshedivat/tensorflow,tensorflow/tensorflow,jbedorf/tensorflow,Intel-tensorflow/tensorflow,theflofly/tensorflow,Bismarrck/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,ghchinoy/tensorflow,seanli9jan/tensorflow,kobejean/tensorflow,tensorflow/tensorflow-pywrap_saved_model,renyi533/tensorflow,ghchinoy/tensorflow,te... | third_party/clang_toolchain/download_clang.bzl | third_party/clang_toolchain/download_clang.bzl | """ Helpers to download a recent clang release."""
def _get_platform_folder(os_name):
os_name = os_name.lower()
if os_name.startswith("windows"):
return "Win"
if os_name.startswith("mac os"):
return "Mac"
if not os_name.startswith("linux"):
fail("Unknown platform")
return "L... | """ Helpers to download a recent clang release."""
def _get_platform_folder(os_name):
os_name = os_name.lower()
if os_name.startswith("windows"):
return "Win"
if os_name.startswith("mac os"):
return "Mac"
if not os_name.startswith("linux"):
fail("Unknown platform")
return "L... | apache-2.0 | Python |
3ddf0f0fead6018b5c313253a0df2165452cfb6e | Add shared babel init code | SUNET/eduid-common | src/eduid_common/api/translation.py | src/eduid_common/api/translation.py | # -*- coding: utf-8 -*-
from flask import request
from flask_babel import Babel
__author__ = 'lundberg'
def init_babel(app):
babel = Babel(app)
app.babel = babel
@babel.localeselector
def get_locale():
# if a user is logged in, use the locale from the user settings
# XXX: TODO
... | bsd-3-clause | Python | |
30bca45e1ac9fc6953728950695135b491403215 | Add test for logical constant folding. | mhoffma/micropython,blazewicz/micropython,tobbad/micropython,oopy/micropython,pozetroninc/micropython,swegener/micropython,tralamazza/micropython,tobbad/micropython,mhoffma/micropython,kerneltask/micropython,MrSurly/micropython,Peetz0r/micropython-esp32,tobbad/micropython,dmazzella/micropython,HenrikSolver/micropython,... | tests/basics/logic_constfolding.py | tests/basics/logic_constfolding.py | # tests logical constant folding in parser
def f_true():
print('f_true')
return True
def f_false():
print('f_false')
return False
print(0 or False)
print(1 or foo)
print(f_false() or 1 or foo)
print(f_false() or 1 or f_true())
print(0 and foo)
print(1 and True)
print(f_true() and 0 and foo)
print(f_... | mit | Python | |
5b3863c90d4bc07bbc170fc213b4a4c46b3ddc01 | Test setting selinux context on lost+found (#1038146) | rhinstaller/blivet,AdamWill/blivet,rvykydal/blivet,vpodzime/blivet,rhinstaller/blivet,jkonecny12/blivet,dwlehman/blivet,dwlehman/blivet,vojtechtrefny/blivet,AdamWill/blivet,jkonecny12/blivet,rvykydal/blivet,vpodzime/blivet,vojtechtrefny/blivet | tests/formats_test/selinux_test.py | tests/formats_test/selinux_test.py | #!/usr/bin/python
import os
import selinux
import tempfile
import unittest
from devicelibs_test import baseclass
from blivet.formats import device_formats
import blivet.formats.fs as fs
class SELinuxContextTestCase(baseclass.DevicelibsTestCase):
"""Testing SELinux contexts.
"""
@unittest.skipUnless(os.ge... | lgpl-2.1 | Python | |
68d620d56625c4c1bd30a30f31840d9bd440b29e | Add find_objects test module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/test_find_objects.py | tests/plantcv/test_find_objects.py | import cv2
import numpy as np
from plantcv.plantcv import find_objects
def test_find_objects(test_data):
# Read in test data
img = cv2.imread(test_data.small_rgb_img)
mask = cv2.imread(test_data.small_bin_img, -1)
cnt, _ = test_data.load_contours(test_data.small_contours_file)
contours, _ = find_o... | mit | Python | |
36033be962fcc3e97d14dd06b42bcd3be52a97c5 | Add floting_point.py | daineseh/python_code | parser/sample/floting_point.py | parser/sample/floting_point.py | import logging
from lex_tokens import LexToken
from ply.yacc import yacc
class FloatingPointParser(object):
class FloatingPointSyntaxError(Exception): pass
def __init__(self, debug=False):
if debug:
self._log = logging.getLogger('PhysicalDivideCharParser')
else:
self.... | mit | Python | |
be17cf90b06a118d579c0211dd3bc2d45433fb2d | Write unit tests for _handle_long_response | venmo/slouch | tests/test_handle_long_response.py | tests/test_handle_long_response.py | import context
class TestHandleLongResponse(context.slouch.testing.CommandTestCase):
bot_class = context.TimerBot
config = {'start_fmt': '{:%Y}', 'stop_fmt': '{.days}'}
normal_text = "@genericmention: this is generic mention message contains a URL <http://foo.com/>\n@genericmention: this generic mention me... | mit | Python | |
feafe480d651ee6b58a1631f4eb4533f63ea6ad4 | Add user tests | rhgrant10/Groupy | tests/api/test_user.py | tests/api/test_user.py | from unittest import mock
from groupy.api import user
from .base import get_fake_response
from .base import TestCase
class UserTests(TestCase):
def setUp(self):
self.m_session = mock.Mock()
self.m_session.get.return_value = get_fake_response(data={'id': 'foo'})
self.user = user.User(self.... | apache-2.0 | Python | |
063899021158fe872745b335595b3094db9834d8 | Add a test for 'version. | samth/pycket,krono/pycket,vishesh/pycket,magnusmorton/pycket,vishesh/pycket,vishesh/pycket,magnusmorton/pycket,cderici/pycket,pycket/pycket,pycket/pycket,cderici/pycket,krono/pycket,magnusmorton/pycket,krono/pycket,pycket/pycket,cderici/pycket,samth/pycket,samth/pycket | pycket/test/test_version.py | pycket/test/test_version.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Test the version here.
#
import pytest
from pycket.test.testhelper import check_equal
EXPECTED_VERSION='6.1.1.8'
def test_version():
check_equal('(version)', '"%s"' % EXPECTED_VERSION)
# EOF
| mit | Python | |
e940963a6372a4de1a4a28eff1854716f47471e5 | Add deploy script | dbcollection/dbcollection,farrajota/dbcollection | conda-recipe/deploy.py | conda-recipe/deploy.py | #!/usr/bin/env python
"""
Deploy dbcollection to pypi and conda.
"""
import os
import shutil
import subprocess
# PyPi
print('PyPi: Upload sdist...')
msg1 = subprocess.run(["python", 'setup.py', 'sdist', 'upload'], stdout=subprocess.PIPE)
print('PyPi: Upload bdist_wheel...')
msg2 = subprocess.run(["python", 'setup... | mit | Python | |
b52ba28a8315a0cdeda7593d087607f582f77f18 | Create __init__.py | lyelindustries/IPM | model/__init__.py | model/__init__.py | __version__='0.0.0'
| mit | Python | |
721720b1f4d63f1368714f764794c8d406e4982d | Add to_data test | iwi/linkatos,iwi/linkatos | tests/test_firebase.py | tests/test_firebase.py | import pytest
import linkatos.firebase as fb
def test_to_data():
url = 'https://foo.com'
data = {'url': 'https://foo.com'}
assert fb.to_data(url) == data
| mit | Python | |
fe37335645993ad10c9902aaaaf0ca2c53912d49 | Create Average Movies rating etl | searchs/bigdatabox,searchs/bigdatabox | movies_avg_etl.py | movies_avg_etl.py | import pyspark
spark = (
pyspark.sql.SparkSession.builder.appName("FromDatabase")
.config("spark.driver.extraClassPath", "<driver_location>/postgresql-42.2.18.jar")
.getOrCreate()
)
# Read table from db using Spark JDBC
def extract_movies_to_df():
movies_df = (
spark.read.format("jdbc")
... | mit | Python | |
c95bfb10f87bd0a637d0ad790d484b7957441371 | Add WSGI support. | pydotorg/pypi,pydotorg/pypi,pydotorg/pypi,pydotorg/pypi | pypi.wsgi | pypi.wsgi | #!/usr/bin/python
import sys,os
prefix = os.path.dirname(__file__)
sys.path.insert(0, prefix)
import cStringIO, webui, store, config
store.keep_conn = True
class Request:
def __init__(self, environ, start_response):
self.start_response = start_response
self.rfile = cStringIO.StringIO(environ['wsg... | bsd-3-clause | Python | |
39313cd933e0038b9a9bfa8b6b4cb50e3707d455 | add k_min.py | pepincho/HackBulgaria,pepincho/HackBulgaria,pepincho/Python101-and-Algo1-Courses,pepincho/Python101-and-Algo1-Courses | Algo-1/week2/7-K-Min/k_min.py | Algo-1/week2/7-K-Min/k_min.py | class KMin:
# Quick sort
@staticmethod
def swap(numbers, i, j):
temp = numbers[i]
numbers[i] = numbers[j]
numbers[j] = temp
# The last element is a pivot, all smaller elements are to left of it
# and greater elements to right
@staticmethod
def partition(numbers, l,... | mit | Python | |
f44fd9df7ac7fa5e553e99d98c1376439a33ffc8 | Change device pull to handle root,and renamed local file as well history.db from results.db | bathepawan/workload-automation,ep1cman/workload-automation,Sticklyman1936/workload-automation,ARM-software/workload-automation,Sticklyman1936/workload-automation,bathepawan/workload-automation,bathepawan/workload-automation,bathepawan/workload-automation,bjackman/workload-automation,Sticklyman1936/workload-automation,s... | wlauto/workloads/androbench/__init__.py | wlauto/workloads/androbench/__init__.py | # Copyright 2013-2015 ARM Limited
#
# 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 w... | # Copyright 2013-2015 ARM Limited
#
# 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 w... | apache-2.0 | Python |
f700ca39535c5eb14015dd84f4bc0dad2b086d23 | Add ex_fzf.py | frostidaho/dynmen | examples/ex_fzf.py | examples/ex_fzf.py | #!/usr/bin/env python
import string
import textwrap
import pprint
from dynmen import Menu
fzf = Menu(command=('fzf',))
exampl_inp_dict = vars(string)
exampl_inp_dict = {k:v for k,v in exampl_inp_dict.items() if not k.startswith('_')}
def print_obj(obj, prefix=' '):
txt = pprint.pformat(obj)
lines = []
... | mit | Python | |
45edceb65a9cac9f61215ad77e9c048d092c0b57 | add examples/roster.py | max-posedon/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,detrout/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,PabloCastellano/telepathy-python,PabloCastellano/telepathy-python,epage/telepathy-python,max-posedon/telepathy-python,detrout/telepathy-python,epage/t... | examples/roster.py | examples/roster.py |
import dbus
import dbus.glib
import gobject
import sys
from account import read_account, connect
from telepathy.client.channel import Channel
from telepathy.constants import (
CONNECTION_HANDLE_TYPE_CONTACT, CONNECTION_HANDLE_TYPE_LIST,
CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED)
from telepa... | lgpl-2.1 | Python | |
7d198f3eaca6a91b731b3e25c0285cd46e72935a | Remove duplicates in authorized origins table | SoftwareHeritage/swh-web-ui,SoftwareHeritage/swh-web-ui,SoftwareHeritage/swh-web-ui | swh/web/common/migrations/0005_remove_duplicated_authorized_origins.py | swh/web/common/migrations/0005_remove_duplicated_authorized_origins.py | # Copyright (C) 2019 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from __future__ import unicode_literals
from django.db import mig... | agpl-3.0 | Python | |
91541cf82f435cb261d9debc85a2a8ae6dd74ab1 | Add a function to initialize the logging. | xgfone/xutils,xgfone/pycom | xutils/init_logging.py | xutils/init_logging.py | # encoding: utf-8
from __future__ import print_function, absolute_import, unicode_literals, division
import logging
def init_logging(logger=None, level="DEBUG", log_file="", file_config=None, dict_config=None):
# Initialize the argument logger with the arguments, level and log_file.
if logger:
fmt = "... | mit | Python | |
507e3bad4e877330eea29675dafb8210ab6bada5 | Add tests for file agent | cwahbong/onirim-py | tests/test_agent.py | tests/test_agent.py | """
Tests for a agent.
"""
import io
import os
import pytest
from onirim import action
from onirim import agent
from onirim import component
def file_agent(in_str):
return agent.File(io.StringIO(in_str), open(os.devnull, "w"))
def content():
return component.Content([])
@pytest.mark.parametrize(
"in_... | mit | Python | |
c67e1af4f765f143cb1b8420e053c1a9f00edd05 | Add migrations for new statuses. | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | course_discovery/apps/course_metadata/migrations/0168_auto_20190404_1733.py | course_discovery/apps/course_metadata/migrations/0168_auto_20190404_1733.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-04-04 17:33
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.manager
import djchoices.choices
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0167_auto_20190... | agpl-3.0 | Python | |
d308874989667f36da1638f22d6b2d7e823b5ebd | Add script to extract reads or alignments matching a barcode. | roryk/junkdrawer,roryk/junkdrawer | extract-barcode.py | extract-barcode.py | """
code to extract a single cell from a set of alignments or reads marked via Valentine's umis
repository:
https://github.com/vals/umis
"""
import regex as re
import sys
from argparse import ArgumentParser
from pysam import AlignmentFile
def extract_barcode(sam, barcode):
parser_re = re.compile('.*:CELL_(?P<CB>... | mit | Python | |
048d0d7ce30b66af8bf48bcb0cb7f8bfb90fff0c | Add tests for Part, Pin, Bus and Net iterators. | xesscorp/skidl,xesscorp/skidl | tests/test_iters.py | tests/test_iters.py | import pytest
from skidl import *
from .setup_teardown import *
def test_iters_1():
"""Test bus iterator."""
b_size = 4
b = Bus('chplx', b_size)
for hi in b:
for lo in b:
if hi != lo:
led = Part('device','LED')
hi += led['A']
lo += led... | mit | Python | |
60fbfa0b440a762fd25f19148313f5ba27d619aa | add a testing file | StephAlbArt/DS_Algos | DataStructures/Trees/main.py | DataStructures/Trees/main.py | import BST
#Environent for testing BST
def main():
print 'Testing'
main()
| mit | Python | |
00aad4a302518400dbb936c7e2ce1d7560c5762f | Add files via upload | SeanBeseler/data-structures | src/que_.py | src/que_.py | class our_queue(object):
def __init__(self):
"""initializes queue"""
self.head = self
self.tail = self
self.next_node = None
self.data = None
self.size = 0
def enqueue(self, val):
"""creates new node, pushes it to bottom of the queue and makes it the tail... | mit | Python | |
ccc663b3a96268dcdf2256d461a11d845a1044a1 | Add the original test case of bug #1469629, formatted according to local conventions. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/leakers/test_dictself.py | Lib/test/leakers/test_dictself.py | '''Test case for "self.__dict__ = self" circular reference bug (#1469629)'''
import gc
class LeakyDict(dict):
pass
def leak():
ld = LeakyDict()
ld.__dict__ = ld
del ld
gc.collect(); gc.collect(); gc.collect()
| mit | Python | |
994a956486ff94ea777aa300270ae065d2ea62c6 | Add a script to send the contents of newly created files to STDOUT or a TCP/IP socket | telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform | samson/scripts/file_monitor.py | samson/scripts/file_monitor.py | #!/usr/bin/python
# -*- encoding: utf-8 -*-
# Telefónica Digital - Product Development and Innovation
#
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR ... | apache-2.0 | Python | |
ceaabf80649a8a83c6ddfc548a3fa369c973e5c6 | Complete alg fizzbuzz | bowen0701/algorithms_data_structures | alg_fizzbuzz.py | alg_fizzbuzz.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def fizzbuzz(n):
ls = []
for i in range(1, n + 1):
if i % 15 == 0:
ls.append('fizzbuzz')
elif i % 3 == 0:
ls.append('fizz')
elif i % 5 == 0:
ls.append('buzz')
else:
ls.append(i)
return l... | bsd-2-clause | Python | |
e670901ebaf7422f7a71f78a3dc94730eba5605b | Add a module full of hinting helpers. | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | fmn/lib/hinting.py | fmn/lib/hinting.py | """ Helpers for "datanommer hints" for rules.
Rules can optionally define a "hint" for a datanommer query. For
instance, if a rule has to do with filtering for bodhi messages, then a
provided hint could be {'category': 'bodhi'}. This simply speeds up the
process of looking for potential message matches in the histor... | lgpl-2.1 | Python | |
1d31feb4fadadc377fbb3cf0f18c38f5a8d39aca | disable tray icon when fail | xyuanmu/XX-Net,jt6562/XX-Net,wangyou/XX-Net,zlsun/XX-Net,zlsun/XX-Net,wangyou/XX-Net,qqzwc/XX-Net,xyuanmu/XX-Net,xyuanmu/XX-Net,wangyou/XX-Net,xyuanmu/XX-Net,zlsun/XX-Net,jt6562/XX-Net,Suwmlee/XX-Net,mikedchavez1010/XX-Net,jt6562/XX-Net,wangyou/XX-Net,xyuanmu/XX-Net,mikedchavez1010/XX-Net,mikedchavez1010/XX-Net,Suwmlee... | launcher/1.2.0/start.py | launcher/1.2.0/start.py | #!/usr/bin/env python
# coding:utf-8
import os, sys
current_path = os.path.dirname(os.path.abspath(__file__))
python_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, 'python27', '1.0'))
noarch_lib = os.path.abspath( os.path.join(python_path, 'lib', 'noarch'))
sys.path.append(noarch_lib)
if sy... | #!/usr/bin/env python
# coding:utf-8
import os, sys
current_path = os.path.dirname(os.path.abspath(__file__))
python_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, 'python27', '1.0'))
noarch_lib = os.path.abspath( os.path.join(python_path, 'lib', 'noarch'))
sys.path.append(noarch_lib)
if sy... | bsd-2-clause | Python |
719dd9064904d2e94cacd5c9ab349b0658344294 | Create weather_proc.py | clavicule/keras-exp | tmp/weather_proc.py | tmp/weather_proc.py | import argparse
from datetime import datetime
import numpy as np
# timeslot indexing funtion
def get_time_index(timestamp):
day = int(timestamp.date().day) - 1
slot = int((timestamp.time().hour * 3600 + timestamp.time().minute * 60 + timestamp.time().second) / 600)
return day * 144 + slot
ap = argparse.Ar... | mit | Python | |
9f2e4aad6d3a4004e80378f44aa178b37dd6da57 | add ShellExecError | faycheng/tpl,faycheng/tpl | tpl/errors.py | tpl/errors.py | # -*- coding:utf-8 -*-
from gettext import gettext as _
class BaseError(BaseException):
ERR_MSG = _('')
class ShellExecError(BaseError):
ERR_MSG = _('Command exit code not zero. \nExit Code:\n{}.\nOut:\n{}\nErr:\n{}')
def __init__(self, exit_code, out, err):
self.message = self.ERR_MSG.format(... | mit | Python | |
3d027df005725cbc5dfbba0262b0c52c5392d7f0 | Add whoami resource which decodes token and returns user info from token | brayoh/bucket-list-api | app/resources/check_token.py | app/resources/check_token.py | from flask import make_response, jsonify
from flask_restful import Resource, reqparse, marshal, fields
from app.models import User
from app.common.auth.token import JWT
user_fields = {
"id": fields.Integer,
"username": fields.String,
"created_at": fields.DateTime
}
class WhoAmIResource(Resource):
"""... | mit | Python | |
62484ca423d6adfa19a581d7b74472e8475cf817 | Create findbro.py | jshlbrd/python-drawer | findbro/findbro.py | findbro/findbro.py | # findbro.py v0.1
# Matches Bro logs against a specified list of UIDs
# Can run on N number of Bro logs
# Performs no error checking
# Should only be run on directories that contains only gzip Bro logs
# Best way to collect UIDs is via bro-cut and grep
#
# Josh Liburdi 2016
from os import listdir
import sys
import gz... | apache-2.0 | Python | |
f34dabd23faa7d50e507b829e576c1968bdc2d52 | Print The Message Happy New Year | let42/python-course | src/iterations/exercise3.py | src/iterations/exercise3.py | # Print The Message "Happy new Year" followed by the name of a person
# taken from a list for all people mentioned in the list.
def print_Happy_New_Year_to( listOfPeople ):
for user in listOfPeople:
print 'Happy New Year, ', user
print 'Done!'
def main( ):
listOfPeople=['John', 'Mary', 'Luke']
print_Happy_N... | mit | Python | |
67cb63bcb776b1a89d8e96a7b90c02724ef5b0b6 | update migrations | GNOME/extensions-web,GNOME/extensions-web,GNOME/extensions-web,GNOME/extensions-web | sweettooth/extensions/migrations/0005_auto_20190112_1733.py | sweettooth/extensions/migrations/0005_auto_20190112_1733.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-12 17:33
from __future__ import unicode_literals
import autoslug.fields
from django.db import migrations, models
import sweettooth.extensions.models
class Migration(migrations.Migration):
dependencies = [
('extensions', '0004_auto_20181216... | agpl-3.0 | Python | |
3aa6ba18655a92753f33622ac80be66eb3b69ff6 | Add useful python functions | gordonbrander/device_resolutions | device_resolutions.py | device_resolutions.py | from math import sqrt
import csv
def as_orientation(x, y, is_portrait=False):
if is_portrait:
return (y, x) if x > y else (x, y)
else:
return (x, y) if x > y else (y, x)
def as_portrait(x, y):
"""Given a dimensions, return that pair in portrait orientation"""
return as_orientation(x, y... | mit | Python | |
dad5f0a06dd057eccde5a086c84d5c639bb74ae9 | Add back peaks for backwards compatibility with a deprecation warning. | nilgoyyou/dipy,nilgoyyou/dipy,matthieudumont/dipy,villalonreina/dipy,StongeEtienne/dipy,matthieudumont/dipy,villalonreina/dipy,FrancoisRheaultUS/dipy,FrancoisRheaultUS/dipy,StongeEtienne/dipy | dipy/reconst/peaks.py | dipy/reconst/peaks.py | import warnings
w_s = "The module 'dipy.reconst.peaks' is deprecated."
w_s += " Please use the module 'dipy.direction.peaks' instead"
warnings.warn(w_s, DeprecationWarning)
from dipy.direction.peaks import *
| bsd-3-clause | Python | |
52a8a0c0def2930667155660c8844bb6836f9ff5 | add script for table of orders/country | PythonSanSebastian/ep-tools,EuroPython/ep-tools,PythonSanSebastian/ep-tools,EuroPython/ep-tools,PythonSanSebastian/ep-tools,EuroPython/ep-tools,PythonSanSebastian/ep-tools,EuroPython/ep-tools | scripts/country_order_stats.py | scripts/country_order_stats.py | import sqlite3
import pandas as pd
TICKET_SALE_START_DATE = '2016-01-01'
conn = sqlite3.connect('data/site/p3.db')
c = conn.cursor()
query = c.execute("""
SELECT ORDER_ID, COUNTRY_ID
FROM assopy_orderitem, assopy_order
WHERE assopy_orderitem.order_id == assopy_order.id AND
assopy_order.created >= date(TICKET_SALE_... | mit | Python | |
696b9d1177d24ca6c455052f15e529f4952196a0 | add test | Jasily/jasily-python,Cologler/py.jasily.cologler | @test/test_lang_with.py | @test/test_lang_with.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2018~2999 - Cologler <skyoflw@gmail.com>
# ----------
#
# ----------
from jasily.lang import with_it, with_objattr, with_objattrs
class SomeLock:
def __init__(self):
self.locked = False
def __enter__(self):
self.locked = True
def __exit__(self, *... | mit | Python | |
791ce2275933f16cf483dad1b16948441292e61c | add hook for google-api-python-client (#3965) | dmpetrov/dataversioncontrol,efiop/dvc,dmpetrov/dataversioncontrol,efiop/dvc | scripts/hooks/hook-pydrive2.py | scripts/hooks/hook-pydrive2.py | from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata("pydrive2")
datas += copy_metadata("google-api-python-client")
| apache-2.0 | Python | |
534db68d8f773c459788650590b6585fc0369e19 | create a default permission handler for ObjectOwner | michaelhenry/Localizr,michaelhenry/Localizr,michaelhenry/Localizr,michaelhenry/Localizr | apps/Localizr/permissions.py | apps/Localizr/permissions.py | from rest_framework.permissions import IsAuthenticated, SAFE_METHODS
class IsObjectOwner(IsAuthenticated):
def has_object_permission(self, request, view, obj):
if request.method in SAFE_METHODS:
return True
if hasattr(obj, 'created_by'):
return obj.created_by == request.user
return False | mit | Python | |
f7d3ca5d537140e07ff95d082f2a78e86bc06604 | Add flip | jkoelker/zl.indicators | zl/indicators/flip.py | zl/indicators/flip.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Jason Koelker
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | apache-2.0 | Python | |
e07cc0ea6e56339d117fd5d81c0939b0c658727e | Create cnn.py | AdityaSoni19031997/Machine-Learning,AdityaSoni19031997/Machine-Learning | Classifying_datasets/Convolutional_Neural_Networks/Convolutional_Neural_Networks/cnn.py | Classifying_datasets/Convolutional_Neural_Networks/Convolutional_Neural_Networks/cnn.py | # Convolutional Neural Network
# Part 1 - Building the CNN
# Importing the Keras libraries and packages
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
# Initialising the CNN
classifier = Sequent... | mit | Python | |
5199ee1a544b2aa59895a1b22359d6a9adb765a3 | Add .prepare-commit-msg.py | PyconUK/ConferenceScheduler | .prepare-commit-msg.py | .prepare-commit-msg.py | #!/usr/bin/env python
# This script is an optional git hook and will prepend the issue
# number to a commit message in the correct format for Github to parse.
#
# If you wish to use it, create a shortcut to this file in .git/hooks called
# 'prepare-commit-msg' e.g. from top folder of your project:
# ln -s ../../.pre... | mit | Python | |
ce28c5642c3ab543fc48e2f4f1f0b2f2a62890a2 | Add script to extract information for playbook files | ASaiM/framework,ASaiM/framework | src/misc/parse_tool_playbook_yaml.py | src/misc/parse_tool_playbook_yaml.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import argparse
import re
import yaml
def get_revision_number(yaml_content, tool_name):
for tool in yaml_content['tools']:
if tool["name"] == tool_name:
if tool.has_key("revision"):
print tool["revision"][0]
de... | apache-2.0 | Python | |
f8ee6bcd2742e1afb2645c5195d84bd9d2db06bb | Create utils.py | Esri/raster-functions | functions/utils.py | functions/utils.py | __all__ = ['isProductVersionOK',
'computePixelBlockExtents',
'computeCellSize',
'Projection',
'Trace']
## ----- ## ----- ## ----- ## ----- ## ----- ## ----- ## ----- ## ----- ##
def isProductVersionOK(productInfo, major, minor, build):
v = productInfo['major']*1.e+10 +... | apache-2.0 | Python | |
24c763ead7af8a669ff1055b3f352f513274a47f | Insert a note at a specific position in a linked list | arvinsim/hackerrank-solutions | all-domains/data-structures/linked-lists/insert-a-node-at-a-specific-positin-in-a-linked-list/solution.py | all-domains/data-structures/linked-lists/insert-a-node-at-a-specific-positin-in-a-linked-list/solution.py | # https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list
# Python 2
"""
Insert Node at a specific position in a linked list
head input could be None as well for empty list
Node is defined as
class Node(object):
def __init__(self, data=None, next_node=None):
self.dat... | mit | Python | |
db914944615f16c4b170e7dfd428901d5fc29271 | Add test for image.fromstring - refs #1805 | manz/python-mapnik,mapnik/mapnik,rouault/mapnik,kapouer/mapnik,garnertb/python-mapnik,Uli1/mapnik,Mappy/mapnik,stefanklug/mapnik,qianwenming/mapnik,yohanboniface/python-mapnik,sebastic/python-mapnik,qianwenming/mapnik,naturalatlas/mapnik,pnorman/mapnik,manz/python-mapnik,whuaegeanse/mapnik,tomhughes/python-mapnik,light... | tests/python_tests/image_test.py | tests/python_tests/image_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os, mapnik
from timeit import Timer, time
from nose.tools import *
from utilities import execution_path
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path... | lgpl-2.1 | Python | |
dedcdaf1a55b08c275af29c535a7ae574b8ee5d2 | Add 20150517 question. | fantuanmianshi/Daily,fantuanmianshi/Daily | LeetCode/number_of_islands.py | LeetCode/number_of_islands.py | """
Given a 2d grid map of '1's (land) and '0's (water), count the number of
islands. An island is surrounded by water and is formed by connecting adjacent
lands horizontally or vertically. You may assume all four edges of the grid are
all surrounded by water.
Example 1:
11110
11010
11000
00000
Answer: 1
Example 2:
... | mit | Python | |
681c67381eef9384845e0041214011797be6ea03 | Create text2hex.py | jamokou/text2hex | text2hex.py | text2hex.py | # Program Name : text2hex
# Programmer : The Alpha
# Credits : Iranpython.blog.ir
# Version : 0.91(Beta Version)
# Linted By : Pyflakes
# Info : text2hex is a simple tool that uses to convert strings to hex.
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
import binascii
class T... | mit | Python | |
dce13f074187cb95644b0ac3cfd84d1e0649f93c | Fix bytes/str handling in disqus SSO. | dsanders11/mezzanine,jjz/mezzanine,readevalprint/mezzanine,promil23/mezzanine,ZeroXn/mezzanine,geodesign/mezzanine,damnfine/mezzanine,mush42/mezzanine,sjdines/mezzanine,saintbird/mezzanine,Skytorn86/mezzanine,eino-makitalo/mezzanine,stephenmcd/mezzanine,frankchin/mezzanine,gradel/mezzanine,stephenmcd/mezzanine,adrian-t... | mezzanine/generic/templatetags/disqus_tags.py | mezzanine/generic/templatetags/disqus_tags.py | from __future__ import unicode_literals
from future.builtins import bytes, int
import base64
import hashlib
import hmac
import json
import time
from mezzanine import template
register = template.Library()
@register.simple_tag
def disqus_id_for(obj):
"""
Returns a unique identifier for the object to be use... | from __future__ import unicode_literals
from future.builtins import int, str
import base64
import hashlib
import hmac
import json
import time
from mezzanine import template
register = template.Library()
@register.simple_tag
def disqus_id_for(obj):
"""
Returns a unique identifier for the object to be used ... | bsd-2-clause | Python |
913a77592a9f399820cddbc7753c24182ad21639 | Add options for plots | jvivian/rnaseq-lib,jvivian/rnaseq-lib | src/rnaseq_lib/plot/opts.py | src/rnaseq_lib/plot/opts.py | gene_curves = {
'Curve': {'plot': dict(height=120, width=600, tools=['hover'], invert_xaxis=True, yrotation=45, yaxis='left'),
'style': dict(line_width=1.5)},
'Curve.Percentage_of_Normal_Samples': {'plot': dict(xaxis=None, invert_yaxis=True),
'style': dic... | mit | Python | |
fa1e30635f57aaffdc74eaa307b8c74f89bf50ae | add base gender choices object | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator_abstract/models/base_gender_choices.py | accelerator_abstract/models/base_gender_choices.py | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from django.db import models
from accelerator_abstract.models.accelerator_model import AcceleratorModel
GENDER_MALE_CHOICE = "Male"
GENDER_FEMALE_CHOICE = "Female"
GENDER_CISGENDER_CHOICE = "Cisgender"
GENDER_TRANSGENDER_... | mit | Python | |
b55ef35a68305269e8a49a8afcdf46d94d06361f | add drf module | jeromecc/doctoctocbot | src/common/drf.py | src/common/drf.py | from rest_framework.exceptions import APIException
class ServiceUnavailable(APIException):
status_code = 503
default_detail = 'Service temporarily unavailable, try again later.'
default_code = 'service_unavailable' | mpl-2.0 | Python | |
cdfee7e893564157e2143f20dea0b10c8bd33cfb | Create pythonLock.py | noekleby/TTK4145,noekleby/TTK4145,noekleby/TTK4145 | ving2/pythonLock.py | ving2/pythonLock.py |
from threading import Thread
from threading import Lock
i = 0
def someThreadFunction1(lock):
# Potentially useful thing:
# In Python you "import" a global variable, instead of "export"ing it when you declare it
# (This is probably an effort to make you feel bad about typing the word "global")
global i
... | mit | Python | |
c894e509f14cd671eaa49a5d6608bf773a8838c2 | Create updaterepo.py | chickenmatt5/python-cydia-repo-updater | updaterepo.py | updaterepo.py | from os import system as s # s will serve as an easy way to send a command to the system
from os import path, remove, listdir
import hashlib, shutil, ftplib, gnupg
news = listdir('/REPODIRECTORY/new') # Taking inventory of all new packages, placed in a "/new" directory
for entry in news:
enpath = '/REPODIRECTORY/new/... | mit | Python | |
9266e24e616174cc37b5e6f7926dfda81471abb5 | Initialize PracticeQuestions | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter13/PracticeQuestions.py | books/CrackingCodesWithPython/Chapter13/PracticeQuestions.py | # Chapter 13 Practice Questions
# 1. What do the following expressions evaluate to?
print(17 % 1000)
print(5 % 5)
# 2. What is the GCD of 10 and 15?
# Don't do this - imports should be at the top of the file
from books.CrackingCodesWithPython.Chapter13.cryptomath import gcd
print(gcd(10, 15))
# 3. What does spam con... | mit | Python | |
c9e90ef5413bd560422e915d213df73ad88dffd7 | Add apigateway integration test for PutIntegration | boto/botocore,pplu/botocore | tests/integration/test_apigateway.py | tests/integration/test_apigateway.py | # Copyright 2015 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 | |
4ce7a1932d9cde635263a4fe5a80af57589e1cfa | add NASM 2.13.02 Conan package recipe | ConnectedVision/connectedvision,ConnectedVision/connectedvision,ConnectedVision/connectedvision,ConnectedVision/connectedvision,ConnectedVision/connectedvision,ConnectedVision/connectedvision | build_env/Conan/packages/NASM/2.13.02/conanfile.py | build_env/Conan/packages/NASM/2.13.02/conanfile.py | import os
from conans import ConanFile, AutoToolsBuildEnvironment, tools
class NASM(ConanFile):
name = "NASM"
version = "2.13.02"
url = "http://www.nasm.us"
settings = {"os": ["Linux"]}
def getSubdirectories(self, d):
return [ f for f in os.listdir(d) if os.path.isdir(f) ]
def source(self):
self.outp... | mit | Python | |
9fb564d8f02d92432a62be02c906e3b227f48c10 | Create add_results_new.py | vortex610/mos,vortex610/mos,vortex610/mos,vortex610/mos | run_tests/shaker_run/add_results_new.py | run_tests/shaker_run/add_results_new.py | custom_res1 = [{'status_id': 5, 'content': 'Check [Operations per second Median; iops]', 'expected': '88888', 'actual': '7777'},{'status_id': 5, 'content': 'Check [deviation; %]', 'expected': '5555', 'actual': '9999'}]
res1 = {'test_id': test_4kib_read, 'status_id': 5, 'custom_test_case_steps_results': custom_res1}
res... | apache-2.0 | Python | |
729f1c5147e4d4ce242d73731c8e455b2a50fca3 | add 188 | EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler | vol4/188.py | vol4/188.py | def tetration(a, b, m):
t0 = 1
for i in range(b):
t1 = pow(a, t0, m)
if t0 == t1:
break
t0 = t1
return t0
if __name__ == "__main__":
print tetration(1777, 1855, 10 ** 8)
| mit | Python | |
98c1ff71d57749168f0ca35d97dbe77a8a67e082 | Add module for utilities related to xgboost | rladeira/mltils | mltils/xgboost/utils.py | mltils/xgboost/utils.py |
xgb_to_sklearn = {
'eta': 'learning_rate',
'num_boost_round': 'n_estimators',
'alpha': 'reg_alpha',
'lambda': 'reg_lambda',
'seed': 'random_state',
}
def to_sklearn_api(params):
return {
xgb_to_sklearn.get(key, key): value
for key, value in params.items()
}
| mit | Python | |
bbb10ba41db6f70512fe6bcb5207377606a22455 | Create Mordecai_Output.py | openeventdata/Focus_Locality_Extraction,openeventdata/Focus_Locality_Extraction,openeventdata/Focus_Locality_Extraction,openeventdata/Focus_Locality_Extraction,openeventdata/Focus_Locality_Extraction | Geoparser_Comparison/English/Mordecai_Output.py | Geoparser_Comparison/English/Mordecai_Output.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Download and run Mordecai from following link:
"https://github.com/openeventdata/mordecai"
To change the corpus, just change the name in main function.
"""
import xml.etree.ElementTree as et
import re
import json, sys
import requests
#reload(sys)
#... | mit | Python | |
9d98c3280d4e9dc6dda172d11e02922fc9958471 | add homwork01_v0.2.py | seerjk/reboot06,seerjk/reboot06 | 01/homwork01_v0.2.py | 01/homwork01_v0.2.py | #!/usr/bin/env python
#coding=utf-8
num_list = [1,2,3,2,12,3,1,3,21,2,2,3,4111,22,3333,444,111,4,5,777,65555,45,33,45]
max2 = max1 = num_list[0]
# print max1, max2
# max1 bigger than max2
# 1. n>max1 and n>max2
# 2. n<=max1 and n>max2
# 3. n<max1 and n<=max2
for n in num_list:
if n > max2:
if n > max1:
... | mit | Python | |
73bc2dbfe40db224a38725f4412e33b1b5accac6 | Add script example. | kuujo/active-redis | examples/script.py | examples/script.py | # Copyright (c) 2013 Jordan Halterman <jordan.halterman@gmail.com>
# See LICENSE for details.
import sys, os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
# The Active Redis API provides native support for Redis server-side
# Lua scripting.
from active_redis import Script
class PushMany(Script):
""... | mit | Python | |
68ba389a4b6cefe70864577bcc195f14012e224d | Add UK flag example | samirelanduk/omnicanvas | examples/ukflag.py | examples/ukflag.py | import math
import omnicanvas
def create_union_flag(height):
# The union flag is twice as wide as it is high
canvas = omnicanvas.Canvas(height * 2, height, background_color="#000066")
#This is the length of the diagonal of the flag, with Pythagoras
diagonal_length = math.sqrt((height ** 2) + ((height ... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.