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 |
|---|---|---|---|---|---|---|---|---|
a683a339ea13f58f0467d4ecc2070e8b77012a8d | Add missing migration from daa1601d681f3474a6a41fc6a7e4c736bc1e165c | d120/pyophase,d120/pyophase,d120/pyophase,d120/pyophase | staff/migrations/0014_auto_20161011_1857.py | staff/migrations/0014_auto_20161011_1857.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-11 16:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('staff', '0013_attendance_phone_status'),
]
operations = [
migrations.AlterF... | agpl-3.0 | Python | |
36652fbfe3e376c9220c30217c80e8192b110cec | Add test script. | setokinto/slack-shogi | test/modules/shogi_parse_test.py | test/modules/shogi_parse_test.py | import unittest
from app.modules.shogi import Shogi
from app.modules.parse_input import ParseInput
class ShogiTest(unittest.TestCase):
def setUp(self):
pass
def test_parse1(self):
shogi = Shogi()
self.assertEqual(ParseInput.parse("76歩", shogi), (2,6, 2,5, False))
self.assertEqu... | mit | Python | |
d01c119841aa95b0e11638d7fb168e34a77ed09a | add exception module | tomviner/chess,tomviner/chess | exception.py | exception.py | class BadMove(Exception):
pass | mit | Python | |
000270bc2fea50789c03ba5d8b1cf4c7ff80e9f6 | Add noise generator example | pyacq/pyacq,pyacq/pyacq | examples/noise_generator.py | examples/noise_generator.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016, French National Center for Scientific Research (CNRS)
# Distributed under the (new) BSD License. See LICENSE for more info.
import numpy as np
from pyacq.core import Node, register_node_type
from pyqtgraph.Qt import QtCore, QtGui
class NoiseGenerator(Node):
"""A sim... | bsd-3-clause | Python | |
2709673ad3f8038a40169140793abd0b9e193d06 | Create Find_Peak_Element.py | UmassJin/Leetcode | Array/Find_Peak_Element.py | Array/Find_Peak_Element.py | '''
A peak element is an element that is greater than its neighbors.
Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.
The array may contain multiple peaks, in that case return the index to any one of the peaks is fine.
You may imagine that num[-1] = num[n] = -∞.
For example, i... | mit | Python | |
d304d636e3a62fbe3e85f5383c4caa506ec1cb8b | Create Assignment4.py | WUSTL-GIS-Programming-spring-2014/classinfo,WUSTL-GIS-Programming-spring-2014/classinfo | Assignments/Assignment4.py | Assignments/Assignment4.py | # (Place your name here in a comment)
# Assignment 4: Using Cursors
# Use the filegeodatabase at https://www.dropbox.com/s/lcjodja7ix8oruh/Assignment4.gdb.zip
#You should only need arcpy for this assignment
import arcpy
def idToSchool(i):
"""When provided a valid district id from '088' to '119', returns the name... | unlicense | Python | |
e8d238f5cd7dadeea5e2d23ef249a00379a3b4a4 | rename relationship | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | corehq/form_processor/migrations/0018_rename_index_relationship.py | corehq/form_processor/migrations/0018_rename_index_relationship.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0017_allow_closed_by_null'),
]
operations = [
migrations.RenameField(
model_name='commcarecase... | bsd-3-clause | Python | |
7f05639b61193af4e524e2aa29f99edc2d118b3a | add new script to test anonymous list creation, only retrieves the session token at the moment | synbiomine/synbiomine-tools,synbiomine/synbiomine-tools,synbiomine/synbiomine-tools | test/test-24h-anon-session-query-to-list.py | test/test-24h-anon-session-query-to-list.py | #!/usr/bin/env python3
import argparse
import jargparse
import requests
############
### MAIN ###
############
parser = jargparse.ArgParser(
'Test query to list creation using an anonymous session token',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog='''QUERY EXAMPLE:
<query view="Gene.prim... | apache-2.0 | Python | |
fd94abbef755e1ff63c82403bb1b0999eb169a42 | Create Problem_1.py | Souloist/Euler-Solutions | Solutions/Problem_1.py | Solutions/Problem_1.py | count = 0
for i in range(1000):
if i%3 == 0 or i%5 == 0:
count+=i
print count
| mit | Python | |
e498a5876638d52dd4849ae7ff719654a05eb395 | Create factorise.py | nick599/PythonMathsAlgorithms | factorise.py | factorise.py | apache-2.0 | Python | ||
fcec2ecbc67b63b357c3fbaaeebbf42764c0bab2 | Update notebook events | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | tests/test_auditor/test_auditor_notebook.py | tests/test_auditor/test_auditor_notebook.py | # pylint:disable=ungrouped-imports
from unittest.mock import patch
from django.test import override_settings
import activitylogs
import auditor
import tracker
from event_manager.events import notebook as notebook_events
from factories.factory_plugins import NotebookJobFactory
from factories.factory_projects import ... | apache-2.0 | Python | |
8e9f9c791c988b7f4b08c0a123e492239cc900b8 | add migration dep for reviewer/0004_is_current | MoveOnOrg/eventroller,MoveOnOrg/eventroller,MoveOnOrg/eventroller | event_store/migrations/0009_auto_20180718_1739.py | event_store/migrations/0009_auto_20180718_1739.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-07-18 17:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('event_store', '0008_auto_20170616_1506'),
]
operations = [
migrations.AlterFi... | mit | Python | |
2ad3cb462469a2d4f3f457e1e520979871410d20 | Add test cases for Pane. | xrloong/Xie | tests/test/xie/graphics/shape.py | tests/test/xie/graphics/shape.py | import unittest
import copy
from xie.graphics.shape import Pane
class PaneTestCase(unittest.TestCase):
def setUp(self):
self.generateTestData()
def tearDown(self):
pass
def generateTestData(self):
self.pane_1=Pane(38, 32, 101, 50)
self.pane_2=Pane(22, 50, 122, 89)
self.pane_3=Pane(5, 20, 31, 32)
self... | apache-2.0 | Python | |
1c574caec82e4e0cc042c8126fac81f4c49c7e40 | Add test_servlet_addrequest | Yelp/pushmanager,asottile/pushmanager,bis12/pushmanager,Yelp/pushmanager,bchess/pushmanager,YelpArchive/pushmanager,YelpArchive/pushmanager,bchess/pushmanager,imbstack/pushmanager,asottile/pushmanager,bis12/pushmanager,Yelp/pushmanager,Yelp/pushmanager,YelpArchive/pushmanager,bchess/pushmanager,bis12/pushmanager,YelpAr... | tests/test_servlet_addrequest.py | tests/test_servlet_addrequest.py | from contextlib import nested
import mock
import urllib
from core import db
from core.util import get_servlet_urlspec
from servlets.addrequest import AddRequestServlet
import testing as T
class AddRequestServletTest(T.TestCase, T.ServletTestMixin):
@T.class_setup_teardown
def mock_servlet_env(self):
... | apache-2.0 | Python | |
f70331be9de428626a6679edc42ef94e28f7e672 | Update logger | PressLabs/gitfs,ksmaheshkumar/gitfs,bussiere/gitfs,rowhit/gitfs,PressLabs/gitfs | gitfs/log.py | gitfs/log.py |
import logging
logging.basicConfig(level=logging.DEBUG,
filename='/tmp/gitfs.log',
format='%(asctime)s %(message)s',
datefmt='%B-%d-%Y %H:%M')
log = logging.getLogger('gitfs')
| apache-2.0 | Python | |
6cad2eff4a95026f519c42d7c37af89019a9e2f2 | Update version | MatrixCrawler/ansible-lint,dataxu/ansible-lint,willthames/ansible-lint | lib/ansiblelint/version.py | lib/ansiblelint/version.py | __version__ = '2.4.1'
| __version__ = '2.4.0'
| mit | Python |
e56e233854036f6603337ebf97a91d4c2a5f3bf2 | add test for rec_to_ndarr | simpeg/simpeg | tests/em/nsem/utils/test_data_utils.py | tests/em/nsem/utils/test_data_utils.py | import numpy as np
from SimPEG.electromagnetics.natural_source.utils.data_utils import rec_to_ndarr
def test_rec_to_ndarr():
sample_rec_arr = np.ma.masked_array(data=[(1, 3), (2, 4)], dtype=[('a', int), ('b', float)])
res = rec_to_ndarr(rec_arr=sample_rec_arr, data_type=float)
exp_nd_array = np.array([[1,... | mit | Python | |
a6fcefd8520c750a98eaa7a6afb84693b9ceecf5 | Create functions.py | ForensicTools/IntegChek-475-2151_Fitzpatrick_Hart,ForensicTools/IntegChek-475-2151_Fitzpatrick_Hart,ForensicTools/IntegChek-475-2151_Fitzpatrick_Hart | functions.py | functions.py | from optparse import OptionParser #depenency for command line options
import os #import os module for os.walk function
import hashlib #import hashlib module for those juicy hash digests
import csv #import csv module for csv formating output file
... | mit | Python | |
efdb0a8c8857ca04614108769e898cc409615b18 | Develop key_proliferate function to create new keys. | paulsbrookes/subcipher | functions.py | functions.py | import numpy as np
from key import Key
def remove_duplicates(values):
output = []
seen = []
for value in values:
if not np.any([np.all(value == x) for x in seen]):
output.append(value)
seen.append(value)
return output
def key_proliferation(input_keys):
dt = np.dtype... | apache-2.0 | Python | |
ab03ce26b2ac377df68aefda8d8d6bbfefc55b8a | Remove System.api_user | amcat/amcat-dashboard,amcat/amcat-dashboard,amcat/amcat-dashboard | dashboard/migrations/0013_remove_system_api_user.py | dashboard/migrations/0013_remove_system_api_user.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0012_auto_20160208_2134'),
]
operations = [
migrations.RemoveField(
model_name='system',
... | agpl-3.0 | Python | |
25f652755d4b7dc22c8379c6af615287d4f9ebca | Add __init__.py file for PySparse sandbox package | lesserwhirls/scipy-cwt,scipy/scipy-svn,lesserwhirls/scipy-cwt,scipy/scipy-svn,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,scipy/scipy-svn,scipy/scipy-svn,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor | Lib/sandbox/pysparse/__init__.py | Lib/sandbox/pysparse/__init__.py | """PySparse
"""
from spmatrix import *
| bsd-3-clause | Python | |
91b4503e1ef9012d86259918743eab1d9a65a67e | make new migration | samitnuk/studentsdb,samitnuk/studentsdb,samitnuk/studentsdb | students/migrations/0001_initial.py | students/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-22 21:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Student... | mit | Python | |
5a2c1cef5b6f008917d33f08a420f04e1172f6a8 | Create partition_monitoring.py | site24x7/plugins,site24x7/plugins,site24x7/plugins | partition_monitoring/partition_monitoring.py | partition_monitoring/partition_monitoring.py | bsd-2-clause | Python | ||
ad97c13986ef648cff6a476a2bcba0371049fce5 | fix typo | sideffect0/django-pipeline,hyperoslo/django-pipeline,Kami/django-pipeline,TwigWorld/django-pipeline,d9pouces/django-pipeline,Kami/django-pipeline,camilonova/django-pipeline,jazzband/django-pipeline,edx/django-pipeline,leonardoo/django-pipeline,tayfun/django-pipeline,lexqt/django-pipeline,d9pouces/django-pipeline,wiencz... | pipeline/management/commands/synccompress.py | pipeline/management/commands/synccompress.py | from optparse import make_option
from django.core.management.base import BaseCommand
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--force',
action='store_true',
default=False,
help='Force update of all files, even if the source fil... | from optparse import make_option
from django.core.management.base import BaseCommand
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--force',
action='store_true',
default=False,
help='Force update of all files, even if the source fil... | mit | Python |
508625e66bacc034f60ed04be4661900e9847dee | Add working coroutine example | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | python3/asyncio-coroutine.py | python3/asyncio-coroutine.py | import asyncio
@asyncio.coroutine
def open_file(name):
print("opening {}".format(name))
return open(name)
@asyncio.coroutine
def close_file(file):
print("closing {}".format(file.name))
file.close()
@asyncio.coroutine
def read_data(file):
print("reading {}".format(file.name))
return file.read(... | mit | Python | |
077b6ea13718d13ceddaeb7ef96c9b0da26a46b9 | Create match_zero_or_more.py | JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking | hacker_rank/regex/repetitions/match_zero_or_more.py | hacker_rank/regex/repetitions/match_zero_or_more.py | Regex_Pattern = r'^\d{2,}[a-z]*[A-Z]*$' # Do not delete 'r'.
| mit | Python | |
7749db1aa968458316faddafbc0c2ed6de5f4c13 | Add migration file! | odtvince/APITaxi,odtvince/APITaxi,odtvince/APITaxi,l-vincent-l/APITaxi,openmaraude/APITaxi,l-vincent-l/APITaxi,openmaraude/APITaxi,odtvince/APITaxi | migrations/versions/450554023cb2_add_zupc_to_ads.py | migrations/versions/450554023cb2_add_zupc_to_ads.py | """Add zupc to ADS
Revision ID: 450554023cb2
Revises: 2e65dbaa935
Create Date: 2015-07-01 16:14:40.817104
"""
# revision identifiers, used by Alembic.
revision = '450554023cb2'
down_revision = '2e65dbaa935'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
... | agpl-3.0 | Python | |
3272a3cd25d71d49d5063d3dd5840cf30f49414b | test for invalid data file | fingeronthebutton/RIDE,robotframework/RIDE,fingeronthebutton/RIDE,HelioGuilherme66/RIDE,caio2k/RIDE,fingeronthebutton/RIDE,caio2k/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE | utest/controller/test_loading.py | utest/controller/test_loading.py | import unittest
from robot.utils.asserts import assert_true, assert_raises
from robotide.application.chiefcontroller import ChiefController
from robotide.namespace import Namespace
from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH
from robot.errors import DataError
class _FakeObserver(object):
def notify... | import unittest
from robot.utils.asserts import assert_true
from robotide.application.chiefcontroller import ChiefController
from robotide.namespace import Namespace
from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH
class _FakeObserver(object):
def notify(self):
pass
def finished(self):
... | apache-2.0 | Python |
556ffc085fe19ec25535bab3188d35f484081f18 | Introduce dataset console print script | MaxLikelihood/CODE | dataset/print.py | dataset/print.py | __author__ = 'fjin1'
| mit | Python | |
ba388774ac7326efae78cfc69768985e71c988f4 | Move get_battery_percentage to module method Add test | MaxNoe/python-ev3,topikachu/python-ev3,topikachu/python-ev3,evz/python-ev3,MaxNoe/python-ev3,evz/python-ev3 | test/test_ev3_battery_percentage.py | test/test_ev3_battery_percentage.py | import ev3.ev3dev
import unittest
from util import get_input
class TestI2CS(unittest.TestCase):
def test_battery(self):
print(ev3.ev3dev.get_battery_percentage())
if __name__ == '__main__':
unittest.main()
| apache-2.0 | Python | |
931dd8903c420272dff8fb0017769941235361fc | Add unit tests for private data APIs. | KevinGoodsell/caduceus | test/test_private_data.py | test/test_private_data.py | # coding=utf-8
import unittest
from STAF import (
add_privacy_delimiters,
remove_privacy_delimiters,
mask_private_data,
escape_privacy_delimiters,
)
class PrivateData(unittest.TestCase):
def testAddDelims(self):
# Basic delimiter addition
self.assertEqual(add_privacy_delimiters(''... | epl-1.0 | Python | |
6e921529455d0e9ed79b1e298a28cddc3f92e962 | add tool to measure per benchmark memory consumption (experimental) | Winand/pandas,DGrady/pandas,harisbal/pandas,dsm054/pandas,gfyoung/pandas,TomAugspurger/pandas,jorisvandenbossche/pandas,Winand/pandas,DGrady/pandas,gfyoung/pandas,harisbal/pandas,pandas-dev/pandas,linebp/pandas,dsm054/pandas,GuessWhoSamFoo/pandas,kdebrab/pandas,cython-testbed/pandas,Winand/pandas,GuessWhoSamFoo/pandas,... | vb_suite/measure_memory_consumption.py | vb_suite/measure_memory_consumption.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
"""Short one-line summary
long summary
"""
def main():
import shutil
import tempfile
import warnings
from pandas import Series
from vbench.api import BenchmarkRunner
from suite import (REPO_PATH, BUILD, DB_... | bsd-3-clause | Python | |
e39f7a21d7d86579fce4194912589336be31543d | Create MIRA_templateFilewriter.py | DidemnumVex/IonTorrentVoucher | MIRA_templateFilewriter.py | MIRA_templateFilewriter.py | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 20 17:09:40 2017
Make config templates for MIRA assemblies
for entire plate and well
This is slowly becoming library of repeatedly used functions
@author: tcampbell
"""
import os
import sys
import re
from FindFastaFiles import findmorphs as dblook
path = '/home/tcampb... | mit | Python | |
4f489296393adc7e32e4599ca1db5009b4079791 | Add integration tests #50 | Michael-F-Bryan/auto-changelog,Michael-F-Bryan/auto-changelog | tests/integration_test.py | tests/integration_test.py | import os
import pytest
import subprocess
from click.testing import CliRunner
from auto_changelog.__main__ import main
@pytest.fixture
def commands():
return ["git init -q"]
@pytest.fixture
def test_repo(tmp_path, commands):
cwd = os.getcwd()
os.chdir(str(tmp_path))
for command in commands:
... | mit | Python | |
d8438b1982582ef74f340d1d9523c22483024479 | add basic tests for DataFiles and Executable package objects. | cournape/Bento,abadger/Bento,cournape/Bento,cournape/Bento,cournape/Bento,abadger/Bento,abadger/Bento,abadger/Bento | tests/test_pkg_objects.py | tests/test_pkg_objects.py | import os
import tempfile
import unittest
import sys
from nose.tools import \
assert_equal
try:
from cStringIO import StringIO
finally:
from StringIO import StringIO
from toydist.core.pkg_objects import \
DataFiles, Executable
class TestDataFiles(unittest.TestCase):
def test_simple(self):
... | bsd-3-clause | Python | |
7626a5316ed3113fc415fba50ad7c9341d980e85 | add sample for advanced args | sourceperl/pyHMI | examples/prj/recorder/recorder-feeder-with-debug.py | examples/prj/recorder/recorder-feeder-with-debug.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import requests
from pyHMI.DS_ModbusTCP import ModbusTCPDevice
from pyHMI.Tag import Tag
# some class
class Devices(object):
# init datasource
# Floboss S600+ API table
fbs_api = ModbusTCPDevice('163.111.182.153', port=502, unit_id=57, timeout=2.... | mit | Python | |
8e43a74bf8d445ae21f6aa2badca9a6319730b22 | test new analyze rewrite | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | lib/neuroimaging/refactoring/tests/test_analyze.py | lib/neuroimaging/refactoring/tests/test_analyze.py | import unittest
from neuroimaging.refactoring.analyze import AnalyzeImage
from neuroimaging.tests.data import repository
from neuroimaging.visualization.arrayview import arrayview
class AnalyzeImageTest(unittest.TestCase):
def setUp(self):
self.image = AnalyzeImage("rho", datasource=repository)
def t... | bsd-3-clause | Python | |
e9c4d4ac30026bd036f5b6fe275ba42770b4f9d5 | Add StoppableThread | tveebot/tracker | tveebot_tracker/stoppable_thread.py | tveebot_tracker/stoppable_thread.py | from threading import Thread, Event
class StoppableThread(Thread):
""" Utility class to create stoppable threads """
def __init__(self, daemon=None):
super().__init__(daemon=daemon)
self._to_stop = Event()
def stop(self):
""" Signals the thread to stop """
self._to_stop.... | mit | Python | |
edf147337027ca9a17e065b5bd52aad586de66c1 | Add harvest_buildbot.py. | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | tools/harvest_buildbot.py | tools/harvest_buildbot.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Harvest data on the Try Server.
Please use sparingly. Large values for horizon will trash the Try Server memory.
"""
import os
imp... | apache-2.0 | Python | |
aee54903a6526046f123acfc970db31d3c251c89 | add memory watch example | WSDC-NITWarangal/gunicorn,pschanely/gunicorn,urbaniak/gunicorn,prezi/gunicorn,gtrdotmcs/gunicorn,harrisonfeng/gunicorn,wong2/gunicorn,zhoucen/gunicorn,tempbottle/gunicorn,wong2/gunicorn,mvaled/gunicorn,GitHublong/gunicorn,zhoucen/gunicorn,1stvamp/gunicorn,keakon/gunicorn,malept/gunicorn,alex/gunicorn,ccl0326/gunicorn,w... | examples/when_ready.conf.py | examples/when_ready.conf.py | import signal
import commands
import threading
import time
max_mem = 100000
class MemoryWatch(threading.Thread):
def __init__(self, server, max_mem):
super(MemoryWatch, self).__init__()
self.daemon = True
self.server = server
self.max_mem = max_mem
self.timeout = serve... | mit | Python | |
9aaf3504683085e68c92de09c610d0a453bc7d63 | add python test script | atupal/oj,atupal/oj,atupal/oj,atupal/oj,atupal/oj,atupal/oj | hackerrank/contests/algorithms/infinitum11/gtest.py | hackerrank/contests/algorithms/infinitum11/gtest.py | #!/bin/sh
# -*- coding: utf-8 -*-
''''which python2 >/dev/null && exec python2 "$0" "$@" # '''
''''which python >/dev/null && exec python "$0" "$@" # '''
n = 10**5
print n
arr = [i+1 for i in xrange(n)]
from random import shuffle
shuffle(arr)
for i in arr:
print i,
print
print n
for i in xrange(n):
print... | mit | Python | |
143a8b41f837cf3e00345b0524c341365cebcb03 | Remove h from currentArch when arch = x86_64h | facebook/chisel,zats/chisel,facebook/chisel,facebook/chisel,gkassabli/chisel,zomeelee/chisel,alexch2000/chisel,dopcn/chisel,dopcn/chisel,dopcn/chisel,ShawnLeee/chisel,iOSDevBlog/chisel,jbinney/chisel,BabyShung/chisel,programming086/chisel,AbooJan/chisel,wrcj12138aaa/chisel | fblldbobjcruntimehelpers.py | fblldbobjcruntimehelpers.py | #!/usr/bin/python
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import lldb
i... | #!/usr/bin/python
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import lldb
i... | mit | Python |
2218763704c840b96cf780cd789ebde831e0d971 | Simplify call to set_radmask() | erykoff/redmapper,erykoff/redmapper | tests/test_cluster_fit.py | tests/test_cluster_fit.py | from __future__ import division, absolute_import, print_function
from past.builtins import xrange
import unittest
import numpy.testing as testing
import numpy as np
import fitsio
import esutil
from numpy import random
from redmapper import Configuration
from redmapper import GalaxyCatalog
from redmapper import HPMask... | apache-2.0 | Python | |
dc1b04727f21038c815119b522ad276ceb01de41 | Add tests for issue types | jespino/python-taiga,nephila/python-taiga,bameda/python-taiga,mlq/python-taiga,bameda/python-taiga,erikw/python-taiga,erikw/python-taiga,mlq/python-taiga,jespino/python-taiga | tests/test_issue_types.py | tests/test_issue_types.py | from taiga.requestmaker import RequestMaker, RequestMakerException
from taiga.models.base import InstanceResource, ListResource
from taiga.models.models import IssueType, IssueTypes
from taiga import TaigaAPI
import taiga.exceptions
import json
import requests
import unittest
from mock import patch
from .tools import c... | mit | Python | |
9c90776eb1da0a348df26af9146dc2916dc92fc9 | update mongohandler | yunkewang/CompanyRankingSystem | MongoHandler.py | MongoHandler.py | from pymongo import MongoClient
import csv
class MongoHandler(object):
def __init__(self):
self.mongo_client = MongoClient()
def insert_csv(self, db_name=None, collection_name=None, csv_filename=None):
# Import data from csv file to MongoDB
db_name = raw_input('Input name ... | apache-2.0 | Python | |
a5a4a339019c1a6022c2b68847b1f3c19a89bf6a | Add leaders base + a few endpoints | seemethere/nba_py,mcdallas/nba_py | nba_py/leaders.py | nba_py/leaders.py | from nba_py import _api_scrape, _get_json
from nba_py.constants import *
class LeagueLeaders:
_endpoint = 'leagueleaders'
def __init__(self,
league_id=League.Default,
per_mode=PerMode.Default,
stat_category=StatCategory.Default,
season=CURRE... | bsd-3-clause | Python | |
bd8c666bb29f43e1f97497dd583a3ebca5353f4b | Add test saber script | OiNutter/microbit-scripts | neopixel/saber.py | neopixel/saber.py | # Add your Python code here. E.g.
from microbit import *
import neopixel
import random
np = neopixel.NeoPixel(pin1, 60)
ROWS = 60
COLS = 1
pos = 0
color = 50
def get_rand_color():
return (
random.randint(0, 255),
random.randint(0, 255),
random.randint(0, 255)
)
while col... | mit | Python | |
b7a6e2f5b9250af1f8d40f51bb1bd27bbc466694 | Create One-Hack-One.py | Sam-Gram/Mystery,Samuel-Graham/Mystery | One-Hack-One.py | One-Hack-One.py | def hackOne(a, b):
parts = []
for i in range(1, b):
parts.append(i)
sum = 0
for i in parts:
sum = sum + i
for i in parts:
if i == a - sum or a - sum < 1:
return "Error"
parts.append(a - sum)
print(parts)+
| mit | Python | |
da8d00cba57286243fd3dca7b3de4c48c0d4fa33 | Test object reindexing. | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | tests/unit/test_search.py | tests/unit/test_search.py | import unittest
from mock import patch
from nose.tools import * # noqa
import arrow
from pmg.models import db, CommitteeMeeting
from pmg.search import Search
class TestSearch(unittest.TestCase):
def setUp(self):
db.create_all()
def tearDown(self):
db.session.remove()
db.drop_all()
... | apache-2.0 | Python | |
fae59339adb5f45de267a60763d539224a08ffd9 | Add pytorch ImageClassifier class | ronrest/convenience_py,ronrest/convenience_py | ml/pytorch/image_classification/image_classifier.py | ml/pytorch/image_classification/image_classifier.py | # %load_ext autoreload
# %autoreload 2
import torch
from torch import nn
from torch.autograd import Variable
def accuracy(preds, labels):
return (preds==labels).mean()
def n_correct(preds, labels):
return (preds==labels).sum()
class ImageClassifier(object):
def __init__(self, net, n_classes):
""... | apache-2.0 | Python | |
7601617233b79787ca18a12cc37b4fc3d28e0fb8 | Check that directory named depot_tools appears to be full checkout | Pluto-tv/chromium-crosswalk,M4sse/chromium.src,Chilledheart/chromium,Fireblend/chromium-crosswalk,Jonekee/chromium.src,markYoungH/chromium.src,ondra-novak/chromium.src,anirudhSK/chromium,markYoungH/chromium.src,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,dushu1203/c... | tools/find_depot_tools.py | tools/find_depot_tools.py | # Copyright (c) 2011 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.
"""Small utility function to find depot_tools and add it to the python path.
Will throw an ImportError exception if depot_tools can't be found since it
i... | # Copyright (c) 2011 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.
"""Small utility function to find depot_tools and add it to the python path.
Will throw an ImportError exception if depot_tools can't be found since it
i... | bsd-3-clause | Python |
99b6ebf6fab6cabcfec1333bbf37e48c178d033d | Add mutool version of diffpdf script | brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype | tests_regression/helpers/diffpdf_mutool.py | tests_regression/helpers/diffpdf_mutool.py | #! /usr/bin/env python
# usage: diffpdf.py file1.pdf file2.pdf
# requirements:
# - ImageMagick (convert)
# - MuPDF's mutool >= 1.13.0
import os
import shutil
import sys
from decimal import Decimal
from functools import partial
from multiprocessing import Pool, cpu_count
from subprocess import Popen, PIPE, DEVNULL
... | agpl-3.0 | Python | |
a6c86b546851d7e40aac210d36c14127cbc506e7 | Create main.py | aattaran/Machine-Learning-with-Python,aattaran/Machine-Learning-with-Python | NetWorthRegression/main.py | NetWorthRegression/main.py | #!/usr/bin/python
import numpy
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from studentRegression import studentReg
from class_vis import prettyPicture, output_image
from ages_net_worths import ageNetWorthData
ages_train, ages_test, net_worths_train, net_worths_test = ageNetWorthData()
... | bsd-3-clause | Python | |
16b6c70884f870461cd3fa7d18daf61faa5c25d0 | Add test that gets all the car params | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | selfdrive/car/tests/test_car_params.py | selfdrive/car/tests/test_car_params.py | #!/usr/bin/env python3
import unittest
from selfdrive.car.fingerprints import all_known_cars
from selfdrive.car.car_helpers import interfaces
from selfdrive.car.fingerprints import _FINGERPRINTS as FINGERPRINTS
class TestCarParam(unittest.TestCase):
def test_creating_car_params(self):
all_cars = all_known_cars(... | mit | Python | |
7a71c771b816639d1d89ae6ea0f828910c816677 | Disable testNoPageDefinedSyntheticDelay on cros | axinging/chromium-crosswalk,Chilledheart/chromium,Pluto-tv/chromium-crosswalk,Chilledheart/chromium,Chilledheart/chromium,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Chilledheart/chromium,Chilledheart/chromium,Just-D/chromium-1,Just-D/chromium-1,axinging/chromium-crosswalk,Just-D/chromium-... | tools/perf/page_sets/story_set_unittest.py | tools/perf/page_sets/story_set_unittest.py | # Copyright 2014 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 os
import page_sets
from telemetry import decorators
from telemetry import page
from telemetry.testing import story_set_smoke_test
class StorySetU... | # Copyright 2014 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 os
import page_sets
from telemetry import decorators
from telemetry import page
from telemetry.testing import story_set_smoke_test
class StorySetU... | bsd-3-clause | Python |
6962805936192b77c2a91e3c383de811b7eb5642 | Initialize P01_selectiveCopy | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter09/PracticeProjects/P01_selectiveCopy.py | books/AutomateTheBoringStuffWithPython/Chapter09/PracticeProjects/P01_selectiveCopy.py | # Write a program that walks through a folder tree and searches for files with a
# certain file extension (such as .pdf or .jpg). Copy these files from whatever
# location they are in to a new folder.
| mit | Python | |
dad76faaa580c0e35c25e236ab9ea40d36883a44 | Add unit tests for folder size | onitu/onitu,onitu/onitu,onitu/onitu | tests/unit/test_referee_folder.py | tests/unit/test_referee_folder.py | from onitu.referee.folder import Folder
def check_size(size, length):
folder = Folder('folder', (), None,
file_size={'min': size, 'max': size})
assert folder.min_size == length
assert folder.max_size == length
def test_init_size():
check_size(10, 10)
check_siz... | mit | Python | |
ead96c2d38f3a65e0960333b20e3f779ea71db44 | Update styles when `landing` Django app is enabled. | WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow | oneflow/settings/snippets/1flow_io_post_common.py | oneflow/settings/snippets/1flow_io_post_common.py | # -*- coding: utf-8 -*-
"""
Copyright 2013-2014 Olivier Cortès <oc@1flow.io>
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either versio... | # -*- coding: utf-8 -*-
"""
Copyright 2013-2014 Olivier Cortès <oc@1flow.io>
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either versio... | agpl-3.0 | Python |
72aed94440f8a62b0ef135dbb19fd401233964ed | store base_class rather than field_instance | icereval/modular-odm,chrisseto/modular-odm,sloria/modular-odm,CenterForOpenScience/modular-odm | modularodm/fields/lists.py | modularodm/fields/lists.py |
class List(list):
def __init__(self, value=None, **kwargs):
super(List, self).__init__()
self._base_class = kwargs.get('base_class', None)
if value is None:
return
for item in value:
self.append(item)
class ForeignList(List):
def _pk(self, value):
... |
class List(list):
def __init__(self, value=None, **kwargs):
super(List, self).__init__()
self._field_instance = kwargs.get('field_instance', None)
if value is None:
return
for item in value:
self.append(value)
class ForeignList(List):
def _pk(self,... | apache-2.0 | Python |
3a2edf57b0cf88c2d916dfa2d5f18f77d3a701cd | Load data files | devinit/grand-bargain-monitoring,devinit/grand-bargain-monitoring,devinit/grand-bargain-monitoring | src/parse_data.py | src/parse_data.py | import csv
import os
# local configuration
data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'data')
data_path_remote = os.path.join(data_path, 'remote')
data_path_static = os.path.join(data_path, 'static')
# TODO: Make the functions that load something from a file more DRY
def load_csv_fil... | mit | Python | |
ddd57f02092c8bc8b816fda85fdbdeb245aa608d | update "Hackerland Radio Transmitters" code | Murillo/Hackerrank-Algorithms | Search/hackerland-radio-transmitters.py | Search/hackerland-radio-transmitters.py | # Hackerland Radio Transmitters
# Developer: Murillo Grubler
# https://www.hackerrank.com/challenges/hackerland-radio-transmitters/problem
# n,k = [int(points) for points in input().strip().split(' ')]
# x = sorted([int(x_temp) for x_temp in input().strip().split(' ')])
n, k = 5, 1
x = [1, 2, 3, 4, 5]
area_k = (k * ... | mit | Python | |
9012d879282441944b793049be6c5489833d0cd8 | add report for BAM pacbio | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | sequana/modules_report/pacbio_input_bam.py | sequana/modules_report/pacbio_input_bam.py | # coding: utf-8
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed under the ... | bsd-3-clause | Python | |
e93f36a7a10e48afb42c1dc3d860a5e2a07cf353 | add __main__.py magic file | relekang/python-semantic-release,relekang/python-semantic-release | semantic_release/__main__.py | semantic_release/__main__.py |
from .cli import entry
if __name__ == "__main__":
entry()
| mit | Python | |
4bd01b36be0cf9d049ec232eba41c0ac25440349 | Add bundle command to bundle all requirements into a pybundle | bretth/woven | woven/management/commands/bundle.py | woven/management/commands/bundle.py | #!/usr/bin/env python
from optparse import make_option
from glob import glob
import os
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from fabric import state
from fabric.operations import local
from fabric.context_managers import hide
from woven.environment imp... | bsd-3-clause | Python | |
2e208d7458a91f08a75bcee39a1cb9134565b857 | Add a sample code for still images | MarekKowalski/DeepAlignmentNetwork | DeepAlignmentNetwork/ImageDemo.py | DeepAlignmentNetwork/ImageDemo.py | from FaceAlignment import FaceAlignment
import numpy as np
import cv2
import utils
model = FaceAlignment(112, 112, 1, 1, True)
model.loadNetwork("../data/DAN-Menpo-tracking.npz")
cascade = cv2.CascadeClassifier("../data/haarcascade_frontalface_alt.xml")
color_img = cv2.imread("../data/jk.jpg")
if len(color_img.shape... | mit | Python | |
ea41c2fee0d3131922da972ea430b3d679dd1c76 | Add titleregexp-plugin | saimn/sigal,xouillet/sigal,xouillet/sigal,saimn/sigal,saimn/sigal,xouillet/sigal | sigal/plugins/titleregexp.py | sigal/plugins/titleregexp.py | # Copyright 2022 - C.Sehrt
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, su... | mit | Python | |
17e757300c780b7a88378b4478a3ee8b5cd8ab31 | add tests for ResourceReader | fonttools/fonttools,googlefonts/fonttools | Lib/fontTools/misc/macRes_test.py | Lib/fontTools/misc/macRes_test.py | from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
import sys
import os
import tempfile
import unittest
from fontTools.misc.textTools import deHexStr
from .macRes import ResourceReader
# test resource data in DeRez notation
"""
data 'TEST' (128, "name1") { $"4865 6C6C 6... | mit | Python | |
c25aaa5ca3734d137ea54aef66f22da671613ddc | Add missing file | kprovost/domotica,kprovost/domotica | domotica/power.py | domotica/power.py | import s7
class PowerPlug:
POWER_DB = 12
POWER_WORD = 0
def __init__(self, ID, name, bit, s7conn):
self._id = ID
self._name = name
self._bit = bit
self._s7conn = s7conn
def getID(self):
return self._id
def getName(self):
return self._name
def ... | bsd-2-clause | Python | |
164b386d97929816eaecbebe7a47164202acad8f | Add a script for profiling the app | reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualisat... | website/profile_run.py | website/profile_run.py | #!/usr/bin/env python3
from werkzeug.contrib.profiler import ProfilerMiddleware
from app import app
app.config['PROFILE'] = True
app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])
app.run(debug = True)
| lgpl-2.1 | Python | |
4bffade653fbd71d79780f7cf0ae070f4d7f1c1e | add hc.config | sorki/hacked_cnc,sorki/hacked_cnc,hackerspace/hacked_cnc,hackerspace/hacked_cnc | hc/config.py | hc/config.py | import os
import ConfigParser
version = "0.0"
bindir = "/usr/bin"
sysconfdir = "/etc"
prefix = "/usr"
datadir = "/usr/share"
libdir = "/usr/lib64"
def config_parser():
config = ConfigParser.SafeConfigParser()
config_list = [os.path.join(sysconfdir, "hc", "config"),
os.path.expanduser("~/.h... | bsd-3-clause | Python | |
c3c822cf4a2159aed7a5940ffa1366d96e10cc38 | test for test loss in research | analysiscenter/dataset | batchflow/tests/test_loss_test.py | batchflow/tests/test_loss_test.py | """ Test for test loss as metric """
# pylint: disable=import-error, no-name-in-module
import numpy as np
import pytest
from batchflow import Dataset, B, V
from batchflow.research import Research
np.random.seed(2020)
NUM_ITEMS = 10
DATA = np.random.sample(NUM_ITEMS)
@pytest.mark.parametrize('batch_size', [4, 5])
... | apache-2.0 | Python | |
bfee3bc78629d5e48aca0c20e207f24e60debd2c | Convert email msg to unicode before saving to mongo | lym/allura-git,heiths/allura,apache/incubator-allura,apache/allura,apache/allura,heiths/allura,lym/allura-git,lym/allura-git,apache/incubator-allura,heiths/allura,lym/allura-git,lym/allura-git,apache/incubator-allura,heiths/allura,apache/allura,heiths/allura,apache/allura,apache/incubator-allura,apache/allura | Allura/allura/command/smtp_server.py | Allura/allura/command/smtp_server.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | apache-2.0 | Python |
d1a9fc8e3e64e3eb4187f7db7c0176f05d68ccef | Add fullstack tests of the resource protectables RESTAPI | openstack/smaug,openstack/smaug | smaug/tests/fullstack/test_protectables.py | smaug/tests/fullstack/test_protectables.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed ... | apache-2.0 | Python | |
63121825efa13e87ad20e877afa875d71ebc8189 | Copy rippconverter.py from kyrsjo/SixtrackTools | SixTrack/SixTrack,SixTrack/SixTrack,SixTrack/SixTrack,SixTrack/SixTrack,SixTrack/SixTrack,SixTrack/SixTrack | SixTrack/pytools/rippconverter.py | SixTrack/pytools/rippconverter.py | #! /usr/bin/env python
#
# This script converts old-style RIPP blocks into new-style DYNK blocks
#
import sys
if len(sys.argv) == 1:
ifilename = "fort.3"
elif len(sys.argv) == 2:
ifilename = sys.argv[1]
else:
print "Usage: python rippconverter.py (<file to convert>)"
ifile = open(ifilename,'r')
ofile = op... | lgpl-2.1 | Python | |
ef856c4d184e4d3b473922874112210638766542 | add solution for Binary Search Tree Iterator | zhyu/leetcode,zhyu/leetcode | src/binarySearchTreeIterator.py | src/binarySearchTreeIterator.py | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class BSTIterator:
# @param root, a binary search tree's root node
def __init__(self, root):
self.stk = []
self.pushLeft(root)
#... | mit | Python | |
883ef8f3c449640d18ace84257c74759cfacae7c | Add Chilis spider; Closes #778 | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/chilis.py | locations/spiders/chilis.py | import html
import json
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
DAY_MAPPING = {
'Monday': 'Mo',
'Tuesday': 'Tu',
'Wednesday': 'We',
'Thursday': 'Th',
'Friday': 'Fr',
'Saturday': 'Sa',
'Sunday': 'Su'
}
class ChilisSpider(scrapy.... | mit | Python | |
580c0e65c841fe88fe8c316da7044a8804293e3c | Add an example runner for easily running the examples. | andreleblanc-wf/furious,mattsanders-wf/furious,beaulyddon-wf/furious,beaulyddon-wf/furious,mattsanders-wf/furious,rosshendrickson-wf/furious,andreleblanc-wf/furious,Workiva/furious,Workiva/furious,rosshendrickson-wf/furious | example/runner.py | example/runner.py | #!/usr/bin/python
import argparse
import sys
def args():
parser = argparse.ArgumentParser(description='Run the Furious Examples.')
parser.add_argument('--gae-sdk-path', metavar='S', dest="gae_lib_path",
default="/usr/local/google_appengine",
help='path to the ... | apache-2.0 | Python | |
dc0bdc6228b586e5f49920b206abc450717bd327 | test socket | vvvvcp/NeverMore | base/test_socket.py | base/test_socket.py | import socket
def test_socket_modes():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setblocking(1)
s.settimeout(0.5)
s.bind(("127.0.0.1",0))
socket_address = s.getsockname()
print "Trivial Server lauched on socket: %s" %str(socket_address)
while (1):
s.listen(1)
if _... | apache-2.0 | Python | |
61d9f394f186b754580c11c40932754072194f72 | Add boilerplate to access youtube api | ipwnponies/youtube-sort-playlist,ipwnponies/youtube-sort-playlist | playlist_updates.py | playlist_updates.py | #! /usr/bin/env python
import os
import sys
import httplib2
from apiclient.discovery import build # pylint: disable=import-error
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import argparser
from oauth2client.tools import run_flow
# The CLIENT... | unlicense | Python | |
9e17cd67012468a8ec45240862b446da29fb180a | add tests | firemark/cc-workshop | modules/test_fib.py | modules/test_fib.py | from modules.fib import fib
def test_fib_zero():
assert fib(0) == 0
def test_fib_one():
assert fib(1) == 1
def test_fib_three():
assert fib(3) == 2
assert fib(3) == fib(1) + fib(2)
assert fib(3) == fib(1) + fib(1) + fib(0)
| mit | Python | |
ee2d147ed75fffeb1e065498fa13b5a6d5a596c2 | add initial prototype for particle in currents module | bluesquall/okeanidanalysis | examples/particle-trajectory-stationary-current.py | examples/particle-trajectory-stationary-current.py | #!/usr/bin/env python
"""
Empirical Orthogonal Functions on OMA surface currents
======================================================
Open Boundary Modal Analysis
"""
import datetime
import numpy as np
import matplotlib.pyplot as plt
import oceanidanalysis as oa
# evaluate EOFs separately for now
u_eof = oa.eof.E... | mit | Python | |
2e572ccaf05ffc624aa5aed0ab73e0fae2a85ad5 | Add io package: - readPointCloudFromPly - readPointAssignementFromFiles | amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt | evaluation/packages/io.py | evaluation/packages/io.py | """@package IO
Generic input/output functions
"""
import numpy as np
def readPointCloudFromPly(path):
f = open(path, 'r')
points = []
headerSkipped = False
for line in f:
if headerSkipped:
points.append(np.float32(np.array(line.split(' ')[0:3])))
else:
... | apache-2.0 | Python | |
7b186b7db4e9b0e282eb4fcfeadf0c7f0fd2e2f3 | Add the application package. | FGtatsuro/flask-boilerplate,FGtatsuro/flask-boilerplate,FGtatsuro/flask-boilerplate | flask_boilerplate/templates/+app_name+/__init__.py | flask_boilerplate/templates/+app_name+/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_debugtoolbar import DebugToolbarExtension
app = Flask(__name__)
app.debug = True
if app.debug:
app.config['SECRET_KEY'] = 'debug_secretkey'
else:
app.config['SECRET_KEY'] = os.environ['FLASK_SECRET_KEY']
DebugToolbarE... | mit | Python | |
174ab765b03d085a4f7faa8101579d4409d77904 | Add script for auto-builing Bible data files | caleb531/youversion-suggest,caleb531/youversion-suggest | yv_suggest/build_bible.py | yv_suggest/build_bible.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyquery import PyQuery as pq
import re
import json
import urllib2
json_params = {
'indent': 2,
'ensure_ascii': False,
'sort_keys': False
}
def language_matches(text, language):
patt = '^({language}) \((\d+)\)... | mit | Python | |
c1006b40c85cc4d51bd852173fb7a8151a2d90fe | Add DB interface object common to other Marcotti schemas | soccermetrics/marcotti-mls | interface.py | interface.py | from contextlib import contextmanager
from sqlalchemy.engine import create_engine
from sqlalchemy.orm.session import Session
from models import BaseSchema
class Marcotti(object):
def __init__(self, config):
self.engine = create_engine(config.DATABASE_URI)
self.connection = self.engine.connect()... | mit | Python | |
430465b9c95eca098492628d73afaf638a4b66d2 | remove tags do banco | dvl/imagefy-web,dvl/imagefy-web,dvl/imagefy-web,dvl/imagefy-web | imagefy/wishes/migrations/0003_remove_wish_tags.py | imagefy/wishes/migrations/0003_remove_wish_tags.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-22 17:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wishes', '0002_wish_buget'),
]
operations = [
migrations.RemoveField(
mo... | mit | Python | |
4bbc974b10e2b1e5be107b9ec70beecea8aa364d | Create upload_to_s3.py | kinshuk4/MoocX,kinshuk4/MoocX,kinshuk4/MoocX,kinshuk4/MoocX,kinshuk4/MoocX,kinshuk4/MoocX | k2/application-dev/DB/backup/upload_to_s3.py | k2/application-dev/DB/backup/upload_to_s3.py | #!/usr/bin/env python
import os
import argparse
import boto
from boto.s3.key import Key
import boto.s3.connection
parser = argparse.ArgumentParser()
parser.add_argument("bucket", help="The S3 bucket for the file upload")
parser.add_argument("filename", help="The file to upload to S3")
parser.add_argument("-r", "--re... | mit | Python | |
67b1e01382b718bc8facbdb48e0c88f716e5a247 | Add integ smoke tests to verify basic service calls | pplu/botocore,boto/botocore | tests/integration/test_smoke.py | tests/integration/test_smoke.py | """Smoke tests to verify basic communication to all AWS services."""
import botocore.session
from nose.tools import assert_equals
REGION = 'us-east-1'
SMOKE_TESTS = {
'autoscaling': {'DescribeAccountLimits': {},
'DescribeAdjustmentTypes': {}},
'cloudformation': {'DescribeStacks': {},
... | apache-2.0 | Python | |
feff0596be4a7f3c05c10078c4275821828f11af | Create seeprotocol.py | zzlyzq/seeprotocol | seeprotocol.py | seeprotocol.py | #coding:utf-8
#!/usr/bin/python
import pcap
import dpkt
import sys
import ethernettype
import ethernetmac
import ethernetip
import binascii
pc = pcap.pcap()
#pc.setfilter('tcp port 80')
pc.setfilter('arp')
for i,j in pc:
#print i
#print pc
tem = dpkt.ethernet.Ethernet(j)
print "Layer... | mit | Python | |
a48fe485bb0df616741bb95d7de8a5d4a899d8c2 | add boolean converter tests | mylokin/schematec | tests/test_converter_boolean.py | tests/test_converter_boolean.py | from __future__ import absolute_import
import pytest
import schematec.converters as converters
import schematec.exc as exc
def test_zero():
assert converters.boolean(0) == False
def test_zero_type():
assert isinstance(converters.boolean(0), bool)
def test_one():
assert converters.boolean(1) == True
... | mit | Python | |
d0c007348cbaf480492c03c965ea76d44af19eb3 | Create rollingxor.py | DeathsPirate/SLAE,DeathsPirate/SLAE | Assignment_4/rollingxor.py | Assignment_4/rollingxor.py | #!/usr/bin/python
shellcode = ("\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80")
out = []
out.append(0x90)
for i in range(0, len(shellcode)):
b1 = ord(shellcode[i]) ^ out[i]
out.append(b1)
print("\nOut Length: ")
print(str(len(out)))
print(", ".join(hex(... | cc0-1.0 | Python | |
7185a213056432d3bfc7d493aa081f6fa343096f | Create ged20telnet-fp.py | digitalbond/Basecamp,digitalbond/Basecamp | ged20telnet-fp.py | ged20telnet-fp.py | import socket
import time
import sys
def hexstr(instr):
out = ""
for b in instr:
out = out + str('%02x' % ord(b))
return out
if len(sys.argv) < 4:
sys.stderr.write("Usage: " + sys.argv[0] + " <ip> <port> <timeout>\n")
sys.exit(1)
host = sys.argv[1]
port = int(sys.argv[2])
timeout = float(sys.argv[3])
bs... | mit | Python | |
d5b312650840bf6f4442b42080319697e95cabe1 | add res.company file | akretion/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil | l10n_br_sale/res_company.py | l10n_br_sale/res_company.py | # -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2014 Renato Lima - Akretion #
# ... | agpl-3.0 | Python | |
a43b89e4ca22ae4cabeb733a6094ae6effdf6075 | Create Add-two-Numbers.py | chengjinlee/leetcode-solution-python,chengjinlee/leetcode | leetcode/Add-two-Numbers.py | leetcode/Add-two-Numbers.py | #Codeing by Utf-8
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
... | mit | Python | |
3ae33eca242bbfe43057bbe0994453762b0a6e5d | Create urls.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | Django/redirect/urls.py | Django/redirect/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^pool/(?P<pk>[0-9a-zA-Z\/]+)/$', views.UserRedirectView.as_view(), name='pool'),
url(r'^pool/(?P<pk>[\d\w_]+)$', views.pool_fix, name='pool_fix'), #allow decimal and words only.
]
| agpl-3.0 | Python | |
d5b366c317e8fefaede6ae34cf25a67b5db1df28 | Add migrations for url and referer length | pinry/pinry,pinry/pinry,pinry/pinry,pinry/pinry | core/migrations/0009_auto_20200825_0800.py | core/migrations/0009_auto_20200825_0800.py | # Generated by Django 2.2.14 on 2020-08-25 08:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0008_board_private'),
]
operations = [
migrations.AlterField(
model_name='pin',
name='referer',
... | bsd-2-clause | Python | |
d2bedbc07192a703f00a04e1fb262048da890f3d | Add role to example deploy. | Fizzadar/pyinfra,Fizzadar/pyinfra | example/roles/bsd_role.py | example/roles/bsd_role.py | from pyinfra.modules import server, pkg
# OpenBSD packages?
pkg.packages(
['py-pip', 'git'],
sudo=True,
op='core_packages' # this and above binds these three operations to run as one
)
# add_pkg does not automatically do this
server.shell(
'ln -sf /usr/local/bin/pip2.7 /usr/local/bin/pip',
sudo=T... | mit | Python | |
aba72a7172dc0760441bd9a8bb9fef4a2c38c70b | Test whether a Cyrillic text correctly appears in a Unicode literal. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_pep263.py | Lib/test/test_pep263.py | #! -*- coding: koi8-r -*-
assert u"".encode("utf-8") == '\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd'
| mit | Python | |
682c63b65867eb7f08c09208937fe3c5ec458a9e | Create Maximal_Rectangle.py | UmassJin/Leetcode | Array/Maximal_Rectangle.py | Array/Maximal_Rectangle.py | Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
# Analysis: maintain a row length of Integer array H recorded its height of '1's,
# and scan and update row by row to find out the largest rectangle of each row.
class Solution:
# @param matrix, ... | mit | Python | |
edf6df21509f6d3030cdfc6d54360fa9b61863e1 | work on example | louiejtaylor/pyViKO,louiejtaylor/pyViKO | examples/getAllViruses.py | examples/getAllViruses.py | #There is a lineage paramater that may be helpful
from Bio import Entrez, SeqIO
import os #TEMP
os.chdir('..')
import pyviko.core as core
def extractJoin(location):
return ((int(location[location.index('[')+1:location.index(':')]),int(location[location.index(':')+1:location.index(']')])),(int(location[location.rindex... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.