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 |
|---|---|---|---|---|---|---|---|---|
bd0bdc543ba1e44ddc9d149fbaadd12ab051614d | Add migrations | unt-libraries/django-accession,unt-libraries/django-accession | accession/migrations/0003_auto_20191101_1625.py | accession/migrations/0003_auto_20191101_1625.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.25 on 2019-11-01 16:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accession', '0002_auto_20191031_2139'),
]
operations = [
migrations.AlterF... | bsd-3-clause | Python | |
7b0ebe74cbaad610bb65f24cc2555d82e7d7a750 | read attachments path from settings, catch jpeg/png | SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qed... | apps/photos/views.py | apps/photos/views.py | from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from rapidsms.webui.utils import render_to_response
from photos.models import Photo
import os
import settings
# default page - show all thumbnails by date
@login_required()
def ... | from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from rapidsms.webui.utils import render_to_response
from photos.models import Photo
import os
import settings
# default page - show all thumbnails by date
@login_required()
def ... | bsd-3-clause | Python |
fda4f436bbaea9215efa03648d2df8e413fb47dd | add class loader tests | wolcomm/rptk,wolcomm/rptk | test/test_loader.py | test/test_loader.py | # Copyright (c) 2018 Workonline Communications (Pty) Ltd. All rights reserved.
#
# The contents of this file are licensed under the Apache License version 2.0
# (the "License"); you may not use this file except in compliance with the
# License.
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python | |
dd75e1c5afb05c5d46adae465947fb3f893cdf6b | Create 7kyu_complete_the_pattern4.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/7kyu/7kyu_complete_the_pattern4.py | Solutions/7kyu/7kyu_complete_the_pattern4.py | def pattern(n):
l=list(range(1,n+1))
return '\n'.join(''.join(map(str,l[i:])) for i in range(n))
| mit | Python | |
422b5573b72cc2014893aa15758b9d0bc61baf05 | refactor from core.py | stefanseefeld/synopsis,stefanseefeld/synopsis,stefanseefeld/synopsis,stefanseefeld/synopsis,stefanseefeld/synopsis,stefanseefeld/synopsis | Synopsis/Formatters/HTML/DeclarationStyle.py | Synopsis/Formatters/HTML/DeclarationStyle.py | # $Id: DeclarationStyle.py,v 1.1 2003/11/15 19:55:06 stefan Exp $
#
# Copyright (C) 2000 Stephen Davies
# Copyright (C) 2000 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
class Style:
"""This class just maintains a mappin... | lgpl-2.1 | Python | |
b8cc84245ae7f3ceda0e0cd92b6b2eecb0426ee3 | add start of peg generator | scristopher/paintown,scristopher/paintown,scristopher/paintown,scristopher/paintown,scristopher/paintown,scristopher/paintown,scristopher/paintown,scristopher/paintown | src/mugen/parser/peg.py | src/mugen/parser/peg.py | #!/usr/bin/env python
next_var = 0
def nextVar():
global next_var;
next_var += 1;
return next_var
class Pattern:
def __init__(self):
pass
def generate(self, result):
pass
class PatternNot(Pattern):
def __init__(self, next):
Pattern.__init__(self)
self.next = n... | bsd-3-clause | Python | |
82f15b2dae1b23b75a019362e5925c4a3591fa92 | Create InputNeuronGroup_multiple_inputs_1.py | ricardodeazambuja/BrianConnectUDP | examples/InputNeuronGroup_multiple_inputs_1.py | examples/InputNeuronGroup_multiple_inputs_1.py | '''
Example of a spike generator (only outputs spikes)
In this example spikes are generated and sent through UDP packages. At the end of the simulation a raster plot of the
spikes is created.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
number_of_neurons_total = 40
numbe... | cc0-1.0 | Python | |
765897a05a7aae6a89bfd62d8493fb14aa16048a | Create db_migrate.py | ASpelling/mw-trading,ASpelling/mw-trading,ASpelling/mw-trading | db_migrate.py | db_migrate.py | #!venv/bin/python
import imp
from migrate.versioning import api
from app import db
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
migration = SQLALCHEMY_MIGRATE_REPO + ('/versions/%03d_migration.py' % (v+1))
tmp_... | apache-2.0 | Python | |
c085f9b5af73a50a86d592b3d8b02b1e8e444cde | Create optsimulate.py | OpenPTrack/open_ptrack,OpenPTrack/open_ptrack,chanbrown007/open_ptrack,chanbrown007/open_ptrack,chanbrown007/open_ptrack,OpenPTrack/open_ptrack | docs/assets/optsimulate.py | docs/assets/optsimulate.py |
# OpenPTrack Sender Simulator
# Sept 13, 2015
# jburke@ucla.edu
import socket, time, json, time, random
UDP_IP = "127.0.0.1"
UDP_PORT = 21234
PERIOD = .100 # how often to publish in time
# For the random walk
MAXSTEP_X = 10
MAXSTEP_Y = 10
WOBBLE_Z = 1
Z_NOMINAL = 40
# Increasing packet seq number
_... | bsd-3-clause | Python | |
7e30de04cad1070eb84c1de0c370e950b5e2c783 | Annotate zerver.views.webhooks.pingdom. | mohsenSy/zulip,timabbott/zulip,ahmadassaf/zulip,JPJPJPOPOP/zulip,dhcrzf/zulip,dawran6/zulip,peguin40/zulip,ryanbackman/zulip,grave-w-grave/zulip,AZtheAsian/zulip,christi3k/zulip,ahmadassaf/zulip,verma-varsha/zulip,TigorC/zulip,Galexrt/zulip,arpith/zulip,Diptanshu8/zulip,rht/zulip,mohsenSy/zulip,andersk/zulip,dattatreya... | zerver/views/webhooks/pingdom.py | zerver/views/webhooks/pingdom.py | # Webhooks for external integrations.
from __future__ import absolute_import
from typing import Any
from django.utils.translation import ugettext as _
from django.http import HttpRequest, HttpResponse
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerve... | # Webhooks for external integrations.
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
... | apache-2.0 | Python |
d8c359b27d371f5bd66825202860a0a376a2466c | add script to convert old plans to new ones | jamesmarva/myria,jamesmarva/myria,uwescience/myria,uwescience/myria,bsalimi/myria,bsalimi/myria,bsalimi/myria,uwescience/myria,jamesmarva/myria | jsonQueries/old_to_new_plan.py | jsonQueries/old_to_new_plan.py | #!/usr/bin/env python
import json
import sys
def read_json(filename):
with open(filename, 'r') as f:
return json.load(f)
def uniquify_fragments(query_plan):
fragment_inv = []
for worker in sorted(query_plan.keys()):
worker_plan = query_plan[worker]
for fragment in worker_plan:
... | bsd-3-clause | Python | |
f71ce70330f7dea86820f1d9cdc390ea972aaeca | add 2s-complement | EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper... | algorithms/bit-manipulation/2s-complement.py | algorithms/bit-manipulation/2s-complement.py | import sys
def ones(x):
uCount = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111);
return ((uCount + (uCount >> 3)) & 030707070707) % 63;
def count(x):
if x >= 0:
if x == 0:
return 0
if x % 2 == 0:
return count(x - 1) + ones(x)
return (x + 1) / 2 + ... | mit | Python | |
173565f7f2b9ffa548b355a0cbc8f972f1445a50 | Add test coverage for rdopkg.guess version2tag and tag2version | redhat-openstack/rdopkg,redhat-openstack/rdopkg,openstack-packages/rdopkg,openstack-packages/rdopkg | tests/test_guess.py | tests/test_guess.py | from rdopkg import guess
from collections import namedtuple
import pytest
VersionTestCase = namedtuple('VersionTestCase', ('expected', 'input_data'))
data_table_good = [
VersionTestCase(('1.2.3', None), '1.2.3'),
VersionTestCase(('1.2.3', 'vX.Y.Z'), 'v1.2.3'),
VersionTestCase(('1.2.3', 'VX.Y.Z'), 'V1.2.3... | apache-2.0 | Python | |
e50060ca76c667b77db433ca03ef640140831dc9 | Add migration for dagman_metrics | pegasus-isi/pegasus-metrics,pegasus-isi/pegasus-metrics,pegasus-isi/pegasus-metrics | migrations/004_add_dagman_metrics.py | migrations/004_add_dagman_metrics.py | import migrations
conn = migrations.connect()
cur = conn.cursor()
cur.execute("""
create table dagman_metrics (
id INTEGER UNSIGNED NOT NULL,
ts DOUBLE,
remote_addr VARCHAR(15),
hostname VARCHAR(256),
domain VARCHAR(256),
version VARCHAR(10),
wf_uuid VARCHAR(36),
root_wf_uuid VARCHAR(... | apache-2.0 | Python | |
dc314e50a573f3ecb2cf41d1e08df29ea991d3b6 | Add migrations versions | SerryJohns/bucket-list | migrations/versions/d71a3e9499ef_.py | migrations/versions/d71a3e9499ef_.py | """empty message
Revision ID: d71a3e9499ef
Revises:
Create Date: 2017-11-21 23:19:12.740735
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd71a3e9499ef'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | mit | Python | |
5bac311ac9da94edbd08b0b43c5214ba6b9fc1c8 | add scollable pages | brendonparker/nuimo-py-web | app2.py | app2.py | from webkit import WebView
import pygtk
pygtk.require('2.0')
import gtk, threading, time
from nuimo import NuimoScanner, Nuimo, NuimoDelegate
class App:
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
fixed = gtk.Fixed()
views = [WebView(), WebView(), WebView()]
width =... | mit | Python | |
4933e4ca107516a667ae3449337746bf7e002cc2 | Create bkvm.py | rmx-tools/rmx-internals | bkvm.py | bkvm.py | #!/usr/bin/python
import commands, time
def prepareTarget():
print "prepare backup Target"
print "---------------------"
cmd = "mount -t cifs //10.0.0.9/public/BK\ VM\ XEN -o username=xxx,password=yyy /bak/"
output = commands.getoutput(cmd)
cmd = "ls -lht --time-style=\"long-iso\" /bak/"
output = c... | apache-2.0 | Python | |
e050d9ce4fb4d63ec7857f581033258f87c805b0 | Create pyPdfMerger.py | johnhimics/automations,johnhimics/automations | pyPdfMerger.py | pyPdfMerger.py | # -*- coding: utf-8 -*-
"""
TITLE: pyPdfMerger.py
AUTHOR: John Himics
EMAIL: john@johnhimics.com
TIMEZONE: EST
VERSION: 0
DESCRIPTION: Merges pdf files together
DEPENDANCIES: PyPDF2
"""
from PyPDF2 import PdfFileMerger
#Global Variables
merger = PdfFileMerger()
#Methods
#Program starts here
if... | mit | Python | |
62e65ae978b703b6af0b594e958e79d467e83421 | add 63 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | python/p063.py | python/p063.py | def g(power):
count = 0
i = 1
min = 10**(power - 1)
max = 10**power - 1
while True:
result = i**power
if result >= min:
if result <= max:
count += 1
else:
break
i += 1
return count
count = 0
for i in xrange(1, 100... | bsd-3-clause | Python | |
600bf1bbce7db5f62d55537a33d4586fa2892d8a | Create conf.py | jcketz/PIGAL,jcketz/PIGAL | conf.py | conf.py | #OK
| mit | Python | |
66c8c6f587c49f587901cf6a9cf7e122d110d668 | Add migration to encrypt secrets | jobscore/sync-engine,jobscore/sync-engine,jobscore/sync-engine,jobscore/sync-engine | migrations/versions/3bac7f8ccfdb_encrypt_secrets.py | migrations/versions/3bac7f8ccfdb_encrypt_secrets.py | """encrypt_secrets
Revision ID: 3bac7f8ccfdb
Revises: 291237183b82
Create Date: 2019-01-14 17:35:58.872052
"""
# revision identifiers, used by Alembic.
revision = '3bac7f8ccfdb'
down_revision = '291237183b82'
from alembic import op, context
import sqlalchemy as sa
# def upgrade():
# op.add_column('secret',
# ... | agpl-3.0 | Python | |
45cb6df45df84cb9ae85fc8aa15710bde6a15bad | Add create image functional negative tests | rahulunair/nova,rahulunair/nova,mahak/nova,vmturbo/nova,klmitch/nova,hanlind/nova,openstack/nova,mikalstill/nova,jianghuaw/nova,klmitch/nova,hanlind/nova,vmturbo/nova,Juniper/nova,rajalokan/nova,Juniper/nova,klmitch/nova,gooddata/openstack-nova,rajalokan/nova,Juniper/nova,klmitch/nova,rajalokan/nova,phenoxim/nova,mahak... | nova/tests/functional/test_images.py | nova/tests/functional/test_images.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
# d... | apache-2.0 | Python | |
18e2263a636e97519272a21562cbba4b978fcf49 | Create EmailForm | alchermd/headlines,alchermd/headlines | headlines/forms.py | headlines/forms.py | from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, SubmitField
from wtforms.validators import DataRequired, Email
class EmailForm(FlaskForm):
""" Form used to submit messages to the admin. """
name = StringField('Name')
reply_to = StringField('Email', validators=[Email(), Data... | mit | Python | |
61b21d1ec14e0be683f8da2b92b3ca2aa9fdcf59 | add sample for api caller | inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree | InvenTree/plugin/samples/integration/api_caller.py | InvenTree/plugin/samples/integration/api_caller.py | """
Sample plugin for calling an external API
"""
from django.utils.translation import ugettext_lazy as _
from plugin import IntegrationPluginBase
from plugin.mixins import APICallMixin, SettingsMixin
class SampleApiCallerPlugin(APICallMixin, SettingsMixin, IntegrationPluginBase):
"""
A small api call sample... | mit | Python | |
1a68a1a461a66c4a4aaf3a19a607ab64475cb05c | Create simpleExamples.py | uchouinard/MechDSO | simpleExamples.py | simpleExamples.py | import DSM as dsmx
import random as rnd
import copy
def example1():
myDSM=dsmx.DSM('example')
## adding components
myDSM.addComponent(['c1'])
myDSM.addComponent(['c2'])
myDSM.addComponent(['c3'])
#
myDSM.display()
print "--------"
## adding relations between existing component... | mit | Python | |
d5fcaf05d100d3fe709b34b8f6b839736773a130 | Create dict.py | Myselfminer/nCrypt | dict.py | dict.py | import random
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"\
,"t","u","v","w","x","y","z"]
def create():
dictionary=open("dictionary.py","w")
tablewenn=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"\
,"t","u","v","w","x","y","z"," "]
table... | apache-2.0 | Python | |
2fba29b90156e844d7d61a15c9ad9c37e2b5dfe2 | load template | cathywu/flow,cathywu/flow | examples/aimsun/load_template.py | examples/aimsun/load_template.py | """
Load an already existing Aimsun template and run the simulation
"""
from flow.core.experiment import Experiment
from flow.core.params import AimsunParams, EnvParams, NetParams
from flow.core.params import VehicleParams
from flow.envs import TestEnv
from flow.scenarios.loop import Scenario
from flow.controllers.rlc... | mit | Python | |
c6f6278c1915ef90e8825f94cc33a4dea4124722 | Add http directory listing with content display | dgengtek/scripts,dgengtek/scripts | network/http_server_cat.py | network/http_server_cat.py | #!/bin/env python3
import http.server
import string
import click
import pathlib
import urllib.parse
import os
@click.command()
@click.argument("port", required=False)
@click.option("-s", "--server", default="0.0.0.0")
def main(port, server):
if not port:
port = 8888
http_server = http.server.HTTPServe... | mit | Python | |
8fa81263cfcc63f6bf22ed2ad50103f91bc43b21 | Create hira.py | tomohiko/8946 | hira.py | hira.py | #coding:utf-8
import hashlib
start = ord(u'あ')
end = ord(u'ん')
hira = []
print "Create hiragana"
for i in range(start, end+1, 1):
hira.append(unichr(i).encode('utf-8'))
num = len(hira)
for i4 in range(num):
for i3 in range(num):
for i2 in range(num):
for i1 in range(num):
... | apache-2.0 | Python | |
92bc1ad22b6147f61ef4b51b16e115109bc04596 | add build.gyp | 256481788jianghao/opengl_test,256481788jianghao/opengl_test,256481788jianghao/opengl_test | build.gyp | build.gyp | {
'targets':[
{
'target_name':'start_first',
'type':'executable',
'dependencies':[],
'defines':[],
'include_dirs':[],
'sources':[
'start_first/opengl_first.c',
],
'libraries':[
'-lG... | apache-2.0 | Python | |
45a0b65106f665872f14780e93ab9f09e65bbce3 | add genRandomGraph.py | zhfkt/ComplexCi,zhfkt/ComplexCi,zhfkt/ComplexCi,zhfkt/ComplexCi,zhfkt/ComplexCi | ComplexCiPython/genRandomGraph.py | ComplexCiPython/genRandomGraph.py | import networkx
import sys
if len(sys.argv) < 2:
print ("python genRandomGraph.py [output folder]");
input()
sys.exit(0);
outputPath = sys.argv[1]
G=networkx.erdos_renyi_graph(100000,3/100000)
networkx.write_edgelist(G, outputPath + "/genRandomGraph.csv", data=False , delimiter=',')
| mit | Python | |
3b15fb1d43bad6d6cf2112538d1de8c1710d0272 | add test for within_page_range | ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder | freelancefinder/freelancefinder/tests/test_within_page_range_templatetag.py | freelancefinder/freelancefinder/tests/test_within_page_range_templatetag.py | """Test the within_page_range function."""
from ..templatetags.within_page_range import within_filter
def test_in_range_above():
"""One page above current should be displayed."""
test_page = 5
current_page = 4
result = within_filter(test_page, current_page)
assert result
def test_in_range_belo... | bsd-3-clause | Python | |
0c315f766b31c105c60b39746db977d6702955ca | Remove unneeded model attributes | manhhomienbienthuy/pythondotorg,manhhomienbienthuy/pythondotorg,proevo/pythondotorg,Mariatta/pythondotorg,proevo/pythondotorg,Mariatta/pythondotorg,python/pythondotorg,Mariatta/pythondotorg,manhhomienbienthuy/pythondotorg,manhhomienbienthuy/pythondotorg,python/pythondotorg,python/pythondotorg,python/pythondotorg,proevo... | successstories/views.py | successstories/views.py | from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator
from django.views.generic import CreateView, DetailView, ListView
from honeypot.decorators import check_honeypot
from .forms import StoryForm
from .models import Story, StoryCategory
... | from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator
from django.views.generic import CreateView, DetailView, ListView
from honeypot.decorators import check_honeypot
from .forms import StoryForm
from .models import Story, StoryCategory
... | apache-2.0 | Python |
9abb8108f62451fb993a398c8165a4605e40ec4a | Add tests for JSONPResponseMiddleware | Code4SA/mapit,chris48s/mapit,Sinar/mapit,Code4SA/mapit,chris48s/mapit,opencorato/mapit,chris48s/mapit,Sinar/mapit,opencorato/mapit,opencorato/mapit,Code4SA/mapit | mapit/tests/test_middleware.py | mapit/tests/test_middleware.py | from django.test import TestCase
from django.test.client import RequestFactory
from django.http import HttpResponse, HttpResponsePermanentRedirect
from ..middleware import JSONPMiddleware
class JSONPMiddlewareTest(TestCase):
def setUp(self):
self.middleware = JSONPMiddleware()
self.factory = Req... | agpl-3.0 | Python | |
e20d3ff6147b857cb9a8efa32bfb4ee80610dd34 | Revert "dump" | assassinen/python_training | dump/fastMessageReaderOriginal.py | dump/fastMessageReaderOriginal.py | #!/usr/bin/python
import sys
import re
# ============================================================================
class MessageReader:
messageRegexp = r"s*(\w+)\[\d+\]=(.*?)(?=\s\w+\[\d+\]|$)";
def __init__(self, fileName):
self.fileName = fileName
#self.file = open(fileName, encoding... | apache-2.0 | Python | |
f917c7ccfbe22a50049e76957a05f35eaaa46b2a | migrate child table | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/addressbase/migrations/0010_remove_onsud_ctry_flag.py | polling_stations/apps/addressbase/migrations/0010_remove_onsud_ctry_flag.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-15 14:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("addressbase", "0009_onsud_ced")]
operations = [migrations.RemoveField(model_name="onsud", name="ctry_fl... | bsd-3-clause | Python | |
1553cdda2edc16368ba2281616923e849f09bdee | Create matching_{x,y}.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/matching_{x,y}.py | hacker_rank/regex/repetitions/matching_{x,y}.py | Regex_Pattern = r'^\d{1,2}[a-zA-Z]{3,}\W{0,3}$' # Do not delete 'r'.
| mit | Python | |
527a53ee1e43f59462b94b50ea997058836a7031 | Create voicersss-inmoovservice-test.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/moz4r/Test/voicersss-inmoovservice-test.py | home/moz4r/Test/voicersss-inmoovservice-test.py | i01 = Runtime.createAndStart("i01", "InMoov")
i01.mouth = Runtime.createAndStart("i01.mouth", "voiceRSS")
python.subscribe(i01.mouth.getName(),"publishStartSpeaking")
python.subscribe(i01.mouth.getName(),"publishEndSpeaking")
def onEndSpeaking(text):
print "end speak"
def onStartSpeaking(text):
print "start speak"
... | apache-2.0 | Python | |
75980fc2e2f63e210f1e58e9a1d56c09072aa04e | add play_camera.py | physacco/cv-test,physacco/cv-test,physacco/cv-test,physacco/cv-test | python/video/play_camera.py | python/video/play_camera.py | #!/usr/bin/env python3
# encoding: utf-8
# pylint: disable=no-member
"""Play a video with OpenCV."""
import sys
import cv2
def main():
"""The main function of this module."""
cv2.namedWindow('video', cv2.WINDOW_AUTOSIZE)
cap = cv2.VideoCapture(0)
i = 0
while cap.isOpened():
ret, frame = ... | unlicense | Python | |
6dfc5a3d7845633570b83aac06c47756292cf8ac | Add tests for get_uid() method for common DB models. | dennybaa/st2,StackStorm/st2,pixelrebel/st2,Itxaka/st2,Plexxi/st2,pixelrebel/st2,nzlosh/st2,punalpatel/st2,nzlosh/st2,Itxaka/st2,emedvedev/st2,dennybaa/st2,tonybaloney/st2,Plexxi/st2,punalpatel/st2,peak6/st2,dennybaa/st2,StackStorm/st2,tonybaloney/st2,peak6/st2,StackStorm/st2,StackStorm/st2,armab/st2,alfasin/st2,nzlosh/... | st2common/tests/unit/test_db_model_uids.py | st2common/tests/unit/test_db_model_uids.py | # contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a ... | apache-2.0 | Python | |
5d64acfd475ca0bb0db2ef7c032fc4ee16df4f75 | remove highlight table | pajlada/tyggbot,pajlada/pajbot,pajlada/pajbot,pajlada/pajbot,pajlada/pajbot,pajlada/tyggbot,pajlada/tyggbot,pajlada/tyggbot | alembic/versions/186928676dbc_remove_highlights.py | alembic/versions/186928676dbc_remove_highlights.py | """remove_highlights
Revision ID: 186928676dbc
Revises: f163a00a02aa
Create Date: 2019-06-01 15:14:13.999836
"""
# revision identifiers, used by Alembic.
revision = '186928676dbc'
down_revision = 'f163a00a02aa'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dia... | mit | Python | |
8658ad72c74306617e58ca82ff0f3fdba35bd353 | implement auto build database interface | free-free/pyblog,free-free/pyblog,free-free/pyblog,free-free/pyblog | app/tools/dbautocreat.py | app/tools/dbautocreat.py | #-*- coding:utf-8 -*-
import asyncio
import aiomysql
from tools.config import Config
class AutoCreate(obj):
def __init__(self):
pass
def _create_db(self):
pass
def _create_field_type(self):
pass
def _create_field_primary_key(self):
pass
def _create_field_unique_key(self):
pass
def _create_auto_increme... | mit | Python | |
36b8c44f8c2554109ab4ab09add9ac10fae20781 | add entities orm | clicheio/cliche,item4/cliche,item4/cliche,clicheio/cliche,clicheio/cliche | cliche/services/tvtropes/entities.py | cliche/services/tvtropes/entities.py | from sqlalchemy import Column, DateTime, ForeignKey, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
Base = declarative_base()
__all__ = 'Entity'
class Entity(Base):
namespace = Column(String, primary_key=True)
name = Column(String, primary_key=True)
... | mit | Python | |
ad664a7722da63d783a2b9d73077d91a8a012057 | Create hello.py | WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,... | Python/hello.py | Python/hello.py | print("hello world!!!")
| mit | Python | |
dfed8f837b5fe07445b3914b33c1dab1b0b5741b | add basic UAV object incl. very basic search algo | DakotaNelson/freesearch | uav.py | uav.py | import random
class Uav:
def __init__(x,y, worldMap):
self.x = x
self.y = y
self.worldMap = worldMap
self.sensorStrength = None
def setMap(self, newMap):
self.worldMap = newMap
def nextStep(self):
""" where should we go next tick? """
options = self... | mit | Python | |
8d1946c9656ea6c29d4730a68cbf4610152cd98b | make migrations | sebastianlan/wedfairy-api | poll/migrations/0002_vote_user_id.py | poll/migrations/0002_vote_user_id.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('poll', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='vote',
name='user_id',
... | mit | Python | |
64109dddedb7441456ae8e255c6a4b20ccaa6a73 | Create ReinhardNorm.py | DigitalSlideArchive/HistomicsTK,DigitalSlideArchive/HistomicsTK | ReinhardNorm.py | ReinhardNorm.py | import numpy
def ReinhardNorm(I, TargetMu, TargetSigma):
'''
Performs Reinhard color normalization to transform the color characteristics of an image to
a desired standard. The standard is defined by the mean and standard deviations of
the target image in LAB color space defined by Ruderman. The input image is conver... | apache-2.0 | Python | |
ebabfa0e14bdfd061e248285b8f7b5473f5a676e | Create convert_to_morse.py | clhq/work-tools | morse_code/convert_to_morse.py | morse_code/convert_to_morse.py | from ConfigParser import SafeConfigParser
import string
target = 'target.txt'
def parse_ini():
parser = SafeConfigParser()
parser.read('conversion.ini')
morselist = list(string.ascii_uppercase)
number = 0
for i in morselist:
i = parser.get('CONVERSIONS', i)
morselist[number] = i
... | mit | Python | |
fcb311ffd264821767f58c92e96101aa8086acf5 | rewrite DHKE.py as crypto.py | aburgd/DHKE-py | crypto.py | crypto.py | import random
import time
timestamp = int(time.time())
random.seed(timestamp)
def gen_check(n):
if not isprime(n):
while not isprime(n):
n = random.randint(0, timestamp)
def input_check(n):
if not isprime(n):
n = input("Sorry, that number isn't prime. Please try another: ")
de... | mit | Python | |
81c793870387910cd0c4eda02b2b95588a02cc7f | Add files via upload | I-Spangler/Enigma-Machine | cypher.py | cypher.py | #!/usr/bin/python
import argparse, sys
ALPHABET_SIZE = 26
parser = argparse.ArgumentParser(description='Encrypts a message from a text file.')
parser.add_argument('walzenlage1', metavar='w1', type=int, action='store',
help='')
parser.add_argument('walzenlage2', metavar='w2', type=int, action='stor... | mit | Python | |
47c8aa34eb9f4d2c4f702bc3957c87ef92cf7d28 | add simple learning switch app for OF1.3 | openvapour/ryu,lsqtongxin/ryu,ysywh/ryu,elahejalalpour/ELRyu,takahashiminoru/ryu,alanquillin/ryu,habibiefaried/ryu,jkoelker/ryu,gareging/SDN_Framework,ynkjm/ryu,Tesi-Luca-Davide/ryu,OpenState-SDN/ryu,ntts-clo/mld-ryu,zangree/ryu,lzppp/mylearning,jazzmes/ryu,sivaramakrishnansr/ryu,TakeshiTseng/ryu,ttsubo/ryu,hisaharu/ry... | ryu/app/simple_switch_13.py | ryu/app/simple_switch_13.py | # Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
#
# 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 appli... | apache-2.0 | Python | |
615e51ce1bf15c012a6c7cc2d026cb69bf0ce2b8 | Create MAIN.py | bubblegumwar/Pythagoras-Calculator | MAIN.py | MAIN.py | def pythagoras(SIDE, LEN1, LEN2):
from math import sqrt # This is function is needed to work, it **SHOULD** be included with the default install.
ANSWER = "Error Code 1" # This should not logicaly happen if the user is not an idiot and follows the usage.
if type(LEN1) is str or type(LEN2) is st... | mit | Python | |
cbe0d5b37d4055ea78568838c3fd4cc953342b80 | remove stale data | IQSS/geoconnect,IQSS/geoconnect,IQSS/geoconnect,IQSS/geoconnect | geoconnect/apps/gis_tabular/utils_stale_data.py | geoconnect/apps/gis_tabular/utils_stale_data.py | from datetime import datetime, timedelta
from apps.gis_tabular.models import TabularFileInfo # for testing
from apps.gis_tabular.models import WorldMapTabularLayerInfo,\
WorldMapLatLngInfo, WorldMapJoinLayerInfo
from apps.worldmap_connect.models import WorldMapLayerInfo
DEFAULT_STALE_AGE = 3 * 60 * 60 # 3... | apache-2.0 | Python | |
cb56e0151b37a79e2ba95815555cde0633e167e7 | add client subscribe testing | beerfactory/hbmqtt | samples/client_subscribe.py | samples/client_subscribe.py | import logging
from hbmqtt.client._client import MQTTClient
import asyncio
logger = logging.getLogger(__name__)
C = MQTTClient()
@asyncio.coroutine
def test_coro():
yield from C.connect(uri='mqtt://iot.eclipse.org:1883/', username=None, password=None)
yield from C.subscribe([
{'filter': '$SY... | mit | Python | |
c422b5019c6e638bce40a7fecef6977aa5e63ce0 | add __init__.py | weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016 | python/18-package/parent/__init__.py | python/18-package/parent/__init__.py | #!/usr/bin/env python
#-*- coding=utf-8 -*-
if __name__ == "__main__":
print "Package parent running as main program"
else:
print "Package parent initializing"
| bsd-2-clause | Python | |
8d6a5c4092d4f092416fc39fc7faa8bb20e701c3 | Add a manage command to sync reservations from external hook .. hard coded first product only atm (cherry picked from commit 63a80b711e1be9a6047965b8d0061b676d8c50ed) | jaywink/cartridge-reservable,jaywink/cartridge-reservable,jaywink/cartridge-reservable | cartridge/shop/management/commands/syncreshooks.py | cartridge/shop/management/commands/syncreshooks.py | from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from mezzanine.conf import settings
from cartridge.shop.models import *
class Command(BaseCommand):
help = 'Sync reservations from external hook'
def handle(self, *args, **options):
p = Reservable... | bsd-2-clause | Python | |
afab4bcd795da4395920eab6107bc33e401ed86a | Create PiWS.py | llamafarmer/Pi_Weather_Station,llamafarmer/Pi_Weather_Station,llamafarmer/Pi_Weather_Station | PiWS.py | PiWS.py | import time
import datetime
import csv
from math import log
from flask import Flask, render_template
from sense_hat import SenseHat
app = Flask(__name__)
def weather():
sense = SenseHat()
sense.clear()
celcius = round(sense.get_temperature(), 1)
fahrenheit = round(1.8 * celcius + 32, 1)
humidity ... | mit | Python | |
7e71b21f655ec35bd5ebd79aeb5dbec6945a77a7 | Add purdue harvester | erinspace/scrapi,fabianvf/scrapi,erinspace/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi | scrapi/harvesters/purdue.py | scrapi/harvesters/purdue.py | '''
Harvester for the Purdue University Research Repository for the SHARE project
Example API call: http://purr.purdue.edu/oaipmh?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class PurdueHarvester(OAIHarvester):
short_name = 'purdue'
... | apache-2.0 | Python | |
7ecfe7d20f8708a1dada5761cdc02905b0e370e5 | use correct separator | owlabs/incubator-airflow,opensignal/airflow,hamedhsn/incubator-airflow,DinoCow/airflow,jiwang576/incubator-airflow,rishibarve/incubator-airflow,MetrodataTeam/incubator-airflow,andrewmchen/incubator-airflow,yoziru-desu/airflow,malmiron/incubator-airflow,nathanielvarona/airflow,r39132/airflow,Fokko/incubator-airflow,r391... | scripts/ci/wheel_factory.py | scripts/ci/wheel_factory.py | #!/usr/bin/env python
import requirements
import argparse
import glob
import os
parser = argparse.ArgumentParser()
parser.add_argument('file', help="requirements.txt", type=str)
parser.add_argument('wheeldir', help="wheeldir location", type=str)
args = parser.parse_args()
req_file = open(args.file, 'r')
for req in ... | #!/usr/bin/env python
import requirements
import argparse
import glob
import os
parser = argparse.ArgumentParser()
parser.add_argument('file', help="requirements.txt", type=str)
parser.add_argument('wheeldir', help="wheeldir location", type=str)
args = parser.parse_args()
req_file = open(args.file, 'r')
for req in ... | apache-2.0 | Python |
027a199924ee256170a2e369733a57fcc7483c88 | Add missing numeter namespace in poller | enovance/numeter,redhat-cip/numeter,enovance/numeter,enovance/numeter,redhat-cip/numeter,redhat-cip/numeter,redhat-cip/numeter,enovance/numeter | poller/numeter/__init__.py | poller/numeter/__init__.py | __import__('pkg_resources').declare_namespace(__name__)
| agpl-3.0 | Python | |
7420f49f8e1508fa2017c629d8d11a16a9e28c4a | add abstract biobox class | pbelmann/command-line-interface,bioboxes/command-line-interface,michaelbarton/command-line-interface,michaelbarton/command-line-interface,pbelmann/command-line-interface,bioboxes/command-line-interface | biobox_cli/biobox.py | biobox_cli/biobox.py | from abc import ABCMeta, abstractmethod
import biobox_cli.container as ctn
import biobox_cli.util.misc as util
import tempfile as tmp
class Biobox:
__metaclass__ = ABCMeta
@abstractmethod
def prepare_volumes(opts):
pass
@abstractmethod
def get_doc(self):
pass
@abstractmet... | mit | Python | |
4d1b006e5ba559715d55a88528cdfc0bed755182 | add import script for Weymouth | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_weymouth.py | polling_stations/apps/data_collection/management/commands/import_weymouth.py | from data_collection.management.commands import BaseXpressDCCsvInconsistentPostcodesImporter
class Command(BaseXpressDCCsvInconsistentPostcodesImporter):
council_id = 'E07000053'
addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017WPBC.TSV'
stations_name = 'parl.2017-06-08/Version 1/Democ... | bsd-3-clause | Python | |
2ce80e667de438fca20de7b4ab6847751b683e33 | Add digikey command. | kivhift/qmk,kivhift/qmk | src/commands/digikey.py | src/commands/digikey.py | #
# Copyright (c) 2013 Joshua Hughes <kivhift@gmail.com>
#
import urllib
import webbrowser
import qmk
class DigikeyCommand(qmk.Command):
"""Look up a part on Digi-Key.
A new tab will be opened in the default web browser that contains the
search results.
"""
def __init__(self):
self._name ... | mit | Python | |
8b4bbd23bf37fb946b664f5932e4903f802c6e0d | Add first pass at integration style tests | wdv4758h/flake8,lericson/flake8 | flake8/tests/test_integration.py | flake8/tests/test_integration.py | from __future__ import with_statement
import os
import unittest
try:
from unittest import mock
except ImportError:
import mock # < PY33
from flake8 import engine
class IntegrationTestCase(unittest.TestCase):
"""Integration style tests to exercise different command line options."""
def this_file(se... | mit | Python | |
0d2adfcce21dd2efb5d781babec3e6b03464b6d5 | Add basic tests | gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin | tests/app/main/test_request_header.py | tests/app/main/test_request_header.py | from tests.conftest import set_config_values
def test_route_correct_secret_key(app_, client):
with set_config_values(app_, {
'ROUTE_SECRET_KEY_1': 'key_1',
'ROUTE_SECRET_KEY_2': '',
'DEBUG': False,
}):
response = client.get(
path='/_status',
headers=[
... | mit | Python | |
77af87198d1116b77df431d9139b30f76103dd64 | Add migration for latitute and longitude of event | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/migrations/0023_auto_20160617_1350.py | fellowms/migrations/0023_auto_20160617_1350.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-17 13:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellowms', '0022_event_report_url'),
]
operations = [
migrations.AddField(
... | bsd-3-clause | Python | |
fb07837db870a5fdea3a98aa1381793b1b20d2c0 | Create main.py | jbaum517/jcb2tp-grocery | main.py | main.py | import webapp2
import jinja2
import os
import urllib
from google.appengine.api import users
from google.appengine.ext import ndb
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
def user_key(id):
... | unlicense | Python | |
b920f5aeecf7843fcc699db4a70a9a0f124fa198 | Add unit test for protonate.py | jensengroup/propka | tests/test_protonate.py | tests/test_protonate.py | import propka.atom
import propka.protonate
def test_protonate_atom():
atom = propka.atom.Atom(
"HETATM 4479 V VO4 A1578 -19.097 16.967 0.500 1.00 17.21 V "
)
assert not atom.is_protonated
p = propka.protonate.Protonate()
p.protonate_atom(atom)
assert atom.is_proto... | lgpl-2.1 | Python | |
2bf763e39e91ef989c121bba420e4ae09ea0a569 | Add Diagonal Difference HackerRank Problem | PlattsSEC/HackerRank,PlattsSEC/HackerRank,PlattsSEC/HackerRank,PlattsSEC/HackerRank,PlattsSEC/HackerRank,PlattsSEC/HackerRank | algorithms/diagonal_difference/kevin.py | algorithms/diagonal_difference/kevin.py | #!/usr/bin/env python
def get_matrix_row_from_input():
return [int(index) for index in input().strip().split(' ')]
n = int(input().strip())
primary_diag_sum = 0
secondary_diag_sum = 0
for row_count in range(n):
row = get_matrix_row_from_input()
primary_diag_sum += row[row_count]
secondary_diag_sum +... | mit | Python | |
9098904ffcd47c4327594f8fc6ce8ce8694e5422 | Create getsubinterfaces.py | infobloxopen/netmri-toolkit,infobloxopen/netmri-toolkit,infobloxopen/netmri-toolkit | python/getsubinterfaces.py | python/getsubinterfaces.py | #Device subinterface data retrieval script. Copyright Ingmar Van Glabbeek ingmar@infoblox.com
#Licensed under Apache-2.0
#This script will pull all devices of a given device group and then list the devices management ip as well as the available management ips.
#By default it saves the output to "deviceinterfacedump.js... | mit | Python | |
54a8a77c75660eeae314c410685243e2b5bc59ca | add sw infer wrapper | DLTK/DLTK | dltk/core/utils.py | dltk/core/utils.py | import numpy as np
from dltk.core.io.sliding_window import SlidingWindow
def sliding_window_segmentation_inference(session, ops_list, sample_dict, batch_size=1):
"""
Parameters
----------
session
ops_list
sample_dict
Returns
-------
"""
# TODO: asserts
pl_shape = list(s... | apache-2.0 | Python | |
c262cc4cc18336257972105c1cd6c409da8ed5cd | Create mcmc.py | RonsenbergVI/trendpy,RonsenbergVI/trendpy | mcmc.py | mcmc.py | # MIT License
# Copyright (c) 2017 Rene Jean Corneille
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | mit | Python | |
4b561d710e9ad72ad94ffb1ff3ae37db668899e4 | Add generate_examples script | chunfengh/seq2seq,kontact-chan/seq2seq,shashankrajput/seq2seq,chunfengh/seq2seq,chunfengh/seq2seq,chunfengh/seq2seq,kontact-chan/seq2seq,google/seq2seq,shashankrajput/seq2seq,google/seq2seq,liyi193328/seq2seq,liyi193328/seq2seq,google/seq2seq,liyi193328/seq2seq,liyi193328/seq2seq,shashankrajput/seq2seq,kontact-chan/seq... | seq2seq/scripts/generate_examples.py | seq2seq/scripts/generate_examples.py | #! /usr/bin/env python
"""
Generates a TFRecords file given sequence-aligned source and target files.
Example Usage:
python ./generate_examples.py --source_file <SOURCE_FILE> \
--target_file <TARGET_FILE> \
--output_file <OUTPUT_FILE>
"""
import tensorflow as tf
tf.flags.DEFINE_string('source_file', None,
... | apache-2.0 | Python | |
edb28fffe19e2b0de3113b43aeb075119c9e5830 | Work in progress. Creating new data migration. | EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi | emgapi/migrations/0019_auto_20200110_1455.py | emgapi/migrations/0019_auto_20200110_1455.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2020-01-10 14:55
from __future__ import unicode_literals
from django.db import migrations
def create_download_description(apps, schema_editor):
DownloadDescriptionLabel = apps.get_model("emgapi", "DownloadDescriptionLabel")
downloads = (
("Phyl... | apache-2.0 | Python | |
d41274ce2a54d37c35f23c8c78de196e57667b0a | add google translate plugin | fridim/cabot,fridim/cabot,fridim/cabot,fridim/cabot,fridim/cabot,fridim/cabot | plugins_examples/translate.py | plugins_examples/translate.py | #!/usr/bin/env python
import sys
import re
from googletrans import Translator
translator = Translator()
line = sys.stdin.readline()
while line:
match = re.search('^:([^\s]+) PRIVMSG (#[^\s]+) :(.+)', line)
if not match:
line = sys.stdin.readline()
continue
who = match.group(1)
chan = m... | mit | Python | |
b450734eea74f5f3536a44ed40c006c3da13656c | Add diff.py | jhogan/commonpy,jhogan/epiphany-py | diff.py | diff.py | # vim: set et ts=4 sw=4 fdm=marker
"""
MIT License
Copyright (c) 2016 Jesse Hogan
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 u... | mit | Python | |
176af82121da5282842fd7e77809da9780ac57a5 | implement server pool. | tonyseek/rsocks,tonyseek/rsocks | rsocks/pool.py | rsocks/pool.py | from __future__ import unicode_literals
import logging
import contextlib
from .eventlib import GreenPool
from .utils import debug
__all__ = ['ServerPool']
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG if debug() else logging.INFO)
logger.addHandler(logging.StreamHandler())
class ServerPool(o... | mit | Python | |
416d2b0ffd617c8c6e58360fefe554ad7dc3057b | add example for discovering existing connections | epage/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,PabloCastellano/telepathy-python,epage/telepathy-python,detrout/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,PabloCastellano/telepathy-python,detrout/telepathy-python,max-posedon/telepathy-python,max-posedon/t... | examples/connections.py | examples/connections.py |
"""
Print out a list of existing Telepathy connections.
"""
import dbus.glib
import telepathy
prefix = 'org.freedesktop.Telepathy.Connection.'
if __name__ == '__main__':
for conn in telepathy.client.Connection.get_connections():
conn_iface = conn[telepathy.CONN_INTERFACE]
handle = conn_iface.Ge... | lgpl-2.1 | Python | |
ff53f699ac371266791487f0b863531dd8f5236a | Add hug 'hello_world' using to be developed support for optional URLs | jean/hug,shaunstanislaus/hug,origingod/hug,philiptzou/hug,janusnic/hug,STANAPO/hug,gbn972/hug,giserh/hug,philiptzou/hug,STANAPO/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,giserh/hug,alisaifee/hug,alisaifee/hug,timothycrosley/hug,gbn972/hug,shaunstanislaus/hug,origingod/hug,timothycrosley/hug,yasoob/hug,yasoob/hug,... | examples/hello_world.py | examples/hello_world.py | import hug
@hug.get()
def hello_world():
return "Hello world"
| mit | Python | |
397ab61df61d5acac46cf60ede38fa928fdacd7c | Create solution.py | lilsweetcaligula/Algorithms,lilsweetcaligula/Algorithms,lilsweetcaligula/Algorithms | data_structures/linked_list/problems/pos_num_to_linked_list/solution.py | data_structures/linked_list/problems/pos_num_to_linked_list/solution.py | import LinkedList
# Linked List Node inside the LinkedList module is declared as:
#
# class Node:
# def __init__(self, val, nxt=None):
# self.val = val
# self.nxt = nxt
#
def ConvertPositiveNumToLinkedList(val: int) -> LinkedList.Node:
node = None
while True:
dig = va... | mit | Python | |
724bc46c85e6ea75ac8d786f4d1706b74df8f330 | Create dictid.py | diamontip/pract,diamontip/pract | dictid.py | dictid.py | a = (1,2)
b = [1,2]
c = {a: 1} # outcome: c= {(1,2): 1}
d = {b: 1} # outcome: error
| mit | Python | |
0fb7a5559f525ab1149ac41d4b399442f7649664 | add script to show statistics (number of chunks, data volume) | HumanBrainProject/neuroglancer-scripts | scale_stats.py | scale_stats.py | #! /usr/bin/env python3
#
# Copyright (c) 2016, 2017, Forschungszentrum Juelich GmbH
# Author: Yann Leprince <y.leprince@fz-juelich.de>
#
# This software is made available under the MIT licence, see LICENCE.txt.
import collections
import json
import math
import os
import os.path
import sys
import numpy as np
SI_PRE... | mit | Python | |
7d574c1f6d194df1f2b2009fb2e48fbaacaca873 | Add migration for_insert_base | openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform | oedb_datamodels/versions/6887c442bbee_insert_base.py | oedb_datamodels/versions/6887c442bbee_insert_base.py | """Add _insert_base
Revision ID: 6887c442bbee
Revises: 3886946416ba
Create Date: 2019-04-25 16:09:20.572057
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6887c442bbee'
down_revision = '3886946416ba'
branch_labels = None
depends_on = None
def upgrade():
... | agpl-3.0 | Python | |
2ef707337adc3d0abc33ca638b2adb70a681bd12 | update for new API | vighneshbirodkar/scikit-image,paalge/scikit-image,ajaybhat/scikit-image,ajaybhat/scikit-image,ofgulban/scikit-image,Hiyorimi/scikit-image,rjeli/scikit-image,rjeli/scikit-image,ofgulban/scikit-image,ofgulban/scikit-image,vighneshbirodkar/scikit-image,paalge/scikit-image,rjeli/scikit-image,Hiyorimi/scikit-image,vighneshb... | doc/examples/filters/plot_denoise.py | doc/examples/filters/plot_denoise.py | """
====================
Denoising a picture
====================
In this example, we denoise a noisy version of the picture of the astronaut
Eileen Collins using the total variation and bilateral denoising filter.
These algorithms typically produce "posterized" images with flat domains
separated by sharp edges. It i... | """
====================
Denoising a picture
====================
In this example, we denoise a noisy version of the picture of the astronaut
Eileen Collins using the total variation and bilateral denoising filter.
These algorithms typically produce "posterized" images with flat domains
separated by sharp edges. It i... | bsd-3-clause | Python |
9e6a016c5a59b25199426f6825b2c83571997e68 | Refactor buildbot tests so that they can be used downstream. | ondra-novak/chromium.src,hgl888/chromium-crosswalk,jaruba/chromium.src,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,Pluto-tv/chromium-crosswalk,fujunwei/chromium-crosswalk,markYoungH/chromium.src,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,jaruba/chromium.src,ltilve/chromium,Ch... | build/android/buildbot/tests/bb_run_bot_test.py | build/android/buildbot/tests/bb_run_bot_test.py | #!/usr/bin/env python
# Copyright (c) 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.
import os
import subprocess
import sys
BUILDBOT_DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.append(BUILDBOT_DIR)
... | #!/usr/bin/env python
# Copyright (c) 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.
import os
import subprocess
import sys
BUILDBOT_DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.append(BUILDBOT_DIR)
... | bsd-3-clause | Python |
eb9f9d8bfa5ea278e1fb39c59ed660a223b1f6a9 | Add flask api app creation to init | EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list | api/__init__.py | api/__init__.py | from flask_sqlalchemy import SQLAlchemy
import connexion
from config import config
db = SQLAlchemy()
def create_app(config_name):
app = connexion.FlaskApp(__name__, specification_dir='swagger/')
app.add_api('swagger.yaml')
application = app.app
application.config.from_object(config[config_name])
... | mit | Python | |
c10eb3861daf48c13ec854bd210db5d5e1163b11 | Add LotGroupAutocomplete | 596acres/django-livinglots-lots,596acres/django-livinglots-lots | livinglots_lots/autocomplete_light_registry.py | livinglots_lots/autocomplete_light_registry.py | from autocomplete_light import AutocompleteModelBase, register
from livinglots import get_lotgroup_model
class LotGroupAutocomplete(AutocompleteModelBase):
autocomplete_js_attributes = {'placeholder': 'lot group name',}
search_fields = ('name',)
def choices_for_request(self):
choices = super(Lot... | agpl-3.0 | Python | |
2527683522394c823bc100c75f1ce4885949136e | add paths module for other modules to find paths from one place | aacanakin/glim | glim/paths.py | glim/paths.py | import os
from termcolor import colored
PROJECT_PATH = os.getcwd()
APP_PATH = os.path.join(PROJECT_PATH, 'app')
EXT_PATH = os.path.join(PROJECT_PATH, 'ext')
GLIM_ROOT_PATH = os.path.dirname(os.path.dirname(__file__))
PROTO_PATH = os.path.join(os.path.dirname(__file__), 'prototype')
import sys
from pprint import pprin... | mit | Python | |
24f21146b01ff75a244df40d1626c54883abeb1a | Add helper-lib for json object conversion and split dicts | UngaForskareStockholm/medlem2 | lib/helpers.py | lib/helpers.py | #! /usr/bin/env python2.7
import datetime
def typecast_json(o):
if isinstance(o, datetime.datetime) or isinstance(o, datetime.date):
return o.isoformat()
else:
return o
def split_dict(src, keys):
result = dict()
for k in set(src.keys()) & set(keys):
result[k] = src[k]
return result
| bsd-3-clause | Python | |
0f5c0168b257436882f837e5d521cce46a740ad6 | Add symbol translator to make utf-8 variables compilable | FInAT/FInAT | finat/greek_alphabet.py | finat/greek_alphabet.py | """Translation table from utf-8 to greek variable names, taken from:
https://gist.github.com/piquadrat/765262#file-greek_alphabet-py
"""
def translate_symbol(symbol):
"""Translates utf-8 sub-strings into compilable variable names"""
name = symbol.decode("utf-8")
for k, v in greek_alphabet.iteritems():
... | mit | Python | |
03951a227bfafb0b1017354bdbf3a1247322fc9b | Fix cycler tests | emmagordon/Axelrod,uglyfruitcake/Axelrod,risicle/Axelrod,kathryncrouch/Axelrod,uglyfruitcake/Axelrod,mojones/Axelrod,bootandy/Axelrod,risicle/Axelrod,mojones/Axelrod,kathryncrouch/Axelrod,emmagordon/Axelrod,bootandy/Axelrod | axelrod/tests/unit/test_cycler.py | axelrod/tests/unit/test_cycler.py | """Test for the Cycler strategies."""
import itertools
import axelrod
from .test_player import TestPlayer, test_four_vector
C, D = 'C', 'D'
class TestAntiCycler(TestPlayer):
name = "AntiCycler"
player = axelrod.AntiCycler
expected_classifier = {
'memory_depth': float('inf'),
'stochastic... | """Test for the Cycler strategies."""
import itertools
import axelrod
from .test_player import TestPlayer, test_four_vector
C, D = 'C', 'D'
class TestAntiCycler(TestPlayer):
name = "AntiCycler"
player = axelrod.AntiCycler
expected_classifier = {
'memory_depth': float('inf'),
'stochastic... | mit | Python |
ca2269c5ae568cd63253af7bc614a79d26f7f8ac | Add ns_drop_indexes command. | niwinz/needlestack | needlestack/management/commands/ns_drop_indexes.py | needlestack/management/commands/ns_drop_indexes.py | # -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, unicode_literals
from django.core.management.base import BaseCommand, CommandError
from needlestack import commands
class Command(BaseCommand):
help = 'Sync all defined indexes with a current backend'
option_list = BaseCommand.o... | bsd-3-clause | Python | |
b8a84e612d67f7948d6dec8c202ac8a73390f9dc | make sure all protein ids are unique in a genbank file | linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab | proteins/unique_protein_ids.py | proteins/unique_protein_ids.py | """
Test a genbank file and make sure all the protein_ids are unique
"""
import os
import sys
import argparse
from Bio import SeqIO
__author__ = 'Rob Edwards'
__copyright__ = 'Copyright 2020, Rob Edwards'
__credits__ = ['Rob Edwards']
__license__ = 'MIT'
__maintainer__ = 'Rob Edwards'
__email__ = 'raedwards@gmail.com... | mit | Python | |
61fa404da3eeb3b695b12f398c27f641e1e681e2 | add codegen script for fname.pyf.src -> _fnamemodule.c | matthew-brett/scipy,matthew-brett/scipy,matthew-brett/scipy,matthew-brett/scipy,matthew-brett/scipy | tools/generate_f2pymod.py | tools/generate_f2pymod.py | """
Process f2py template files (`filename.pyf.src` -> `filename.pyf`)
Usage: python generate_pyf.py filename.pyf.src -o filename.pyf
"""
import os
import sys
import subprocess
import argparse
from numpy.distutils.from_template import process_file
def main():
parser = argparse.ArgumentParser()
parser.add_a... | bsd-3-clause | Python | |
0f94251c7cc844042c9e3ce160d78e4d81d895ea | add log module | johnnymo87/simple-db-migrate,guilhermechapiewski/simple-db-migrate | src/log.py | src/log.py | import logging
import os
from datetime import datetime
class LOG(object):
logger = None
def __init__(self, log_dir):
if log_dir:
if not os.path.exists(log_dir):
os.makedirs(log_dir)
self.logger = logging.getLogger('simple-db-migrate')
now = datetime.... | apache-2.0 | Python | |
bc567eda01abcaf23717f5da5f494c1be46f47da | Create ValAnagram_001.py | Chasego/cod,Chasego/codirit,Chasego/codi,Chasego/cod,Chasego/codi,cc13ny/algo,Chasego/codirit,Chasego/codirit,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/codirit,cc13ny/Allin,Chasego/codi,cc13ny/Allin,Chasego/cod,cc13ny/algo,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codi,Ch... | leetcode/242-Valid-Anagram/ValAnagram_001.py | leetcode/242-Valid-Anagram/ValAnagram_001.py | class Solution:
# @param {string} s
# @param {string} t
# @return {boolean}
def anaRepresentation(self, s):
p = {}
for c in s:
if c in p:
p[c] += 1
else:
p[c] = 1
return p
def isAnagram(self, s, t):
if l... | mit | Python | |
682d6b3ca9c4a0dd49f9762ddd20ac746971e3eb | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/find_the_difference/py/solution.py | leetcode/easy/find_the_difference/py/solution.py | class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
import collections
import itertools
c1 = collections.Counter(s)
c2 = collections.Counter(t)
for char in set(itertools... | mit | Python | |
9e128fdd5af0598a233416de5a1e8f2d3a74fdc0 | Enforce unique paths and names | jgillick/Spaces,jgillick/Spaces,jgillick/Spaces,jgillick/Spaces,jgillick/Spaces,jgillick/Spaces | spaces/migrations/0006_unique_space_document.py | spaces/migrations/0006_unique_space_document.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-15 02:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('spaces', '0005_document_space_doc'),
]
operations = [
migrations.AlterField(
... | mit | Python | |
0256868a3b261e598689eebdf5ac5f939ea20a0d | add test cases for mni module | arokem/nipy,nipy/nipy-labs,arokem/nipy,alexis-roche/niseg,alexis-roche/nireg,alexis-roche/niseg,arokem/nipy,alexis-roche/nipy,bthirion/nipy,alexis-roche/nipy,nipy/nipy-labs,nipy/nireg,alexis-roche/nipy,bthirion/nipy,alexis-roche/nipy,alexis-roche/register,bthirion/nipy,nipy/nireg,arokem/nipy,alexis-roche/register,alexi... | lib/neuroimaging/reference/tests/test_mni.py | lib/neuroimaging/reference/tests/test_mni.py | import unittest
import numpy as N
import neuroimaging.reference.mni as mni
class MNITest(unittest.TestCase):
def testMNI(self):
""" ensure all elementes of the interface exist """
m = mni.MNI
g = mni.generic
m_v = mni.MNI_voxel
m_w = mni.MNI_world
m_m = mni... | bsd-3-clause | Python | |
d91adef072e2150edde62a49bea4eecb6a26a6ac | add sns_notify script | pyconjp/pyconjp-cron | sns_notify.py | sns_notify.py | #!/usr/bin/env python
from datetime import datetime, date
from dateutil import parser
from google_sheets import get_service
SHEET_ID = "1lpa9p_dCyTckREf09-oA2C6ZAMACCrgD9W3HQSKeoSI"
def is_valid_period(start, end):
"""
今日が start, end の範囲内かどうかを返す
:params start: 通知開始日の文字列または空文字
:params end: 通知終了日の文... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.