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 |
|---|---|---|---|---|---|---|---|---|
b14d24bd3281cab6e3c7f1e810ec50a0de5fa7eb | Add test for working file routes | cgwire/zou | test/files/test_route_working_files.py | test/files/test_route_working_files.py | from test.base import ApiDBTestCase
class TaskLastWorkingFilesTestCase(ApiDBTestCase):
def setUp(self):
super(TaskLastWorkingFilesTestCase, self).setUp()
self.generate_fixture_project_status()
self.generate_fixture_project()
self.generate_fixture_entity_type()
self.genera... | agpl-3.0 | Python | |
23c9fe71f5f35afa54990a8383b5b6a0e75fb847 | Add tests for app.main.forms.AdminEmailAddressValidator | alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend | tests/app/main/test_form_validators.py | tests/app/main/test_form_validators.py | import mock
import pytest
from flask.ext.wtf import Form
from wtforms.fields.core import Field
from wtforms.validators import StopValidation
from app.main.forms import AdminEmailAddressValidator
@mock.patch('app.main.forms.data_api_client')
class TestAdminEmailAddressValidator(object):
def setup_method(self):
... | mit | Python | |
aa5c4fde763467cae63c205df8e4aaf7328ab713 | Add 'git cl format' presubmit check to src/device | chuan9/chromium-crosswalk,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,PeterWangIntel/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,hgl888/chromium-crosswalk,Just-D/chromium-1,Pluto-tv/chromium-c... | device/PRESUBMIT.py | device/PRESUBMIT.py | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_t... | bsd-3-clause | Python | |
c654034a0da8b898dd55b03a895bf0dfdc6257bf | make vector2d hashable | helloTC/LearnPython | fluent_python/object/vector2d_v2.py | fluent_python/object/vector2d_v2.py | #!/usr/bin/env python
# encoding=utf-8
class vector2d(object):
def __init__(self, x, y):
self.__x = float(x)
self.__y = float(y)
@property
def x(self):
return self.__x
@property
def y(self):
return self.__y
def __iter__(self):
return (i for i in (se... | mit | Python | |
fb3b3d2f9798872742541f7eae2d7b3e2a8a95ab | Add new abstraction with recursion | studiawan/pygraphc | pygraphc/abstraction/AutoAbstractionRecursion.py | pygraphc/abstraction/AutoAbstractionRecursion.py | import networkx as nx
import os
from pygraphc.preprocess.CreateGraphModel import CreateGraphModel
from pygraphc.clustering.Louvain import Louvain
class AutoAbstraction(object):
def __init__(self, log_file):
self.log_file = log_file
self.clusters = []
def __prepare_graph(self, cluster=None):
... | mit | Python | |
80fd2d73f7a206b5b517cb455da457fed9dc6403 | Add Rother District Council logo for letters | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0180_another_letter_org.py | migrations/versions/0180_another_letter_org.py | """empty message
Revision ID: 0180_another_letter_org
Revises: 0179_billing_primary_const
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0180_another_letter_org'
down_revision = '0179_billing_primary_const'
from alembic import op
NEW_ORGANISATIONS = [
('504', ... | mit | Python | |
1f8dd52b6a40b834d459ea356457429969393339 | add migration | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/apps/cms/migrations/0035_remove_project_block_from_homepage.py | meinberlin/apps/cms/migrations/0035_remove_project_block_from_homepage.py | # Generated by Django 2.2.18 on 2021-02-18 10:01
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('meinberlin_cms', '0034_emailformfield_clean_name'),
]
operations = [
... | agpl-3.0 | Python | |
16e52502bf55075c58022fa35e1673a8a0d5f4bc | Add a test for UnionFind fix. | beni55/networkx,jni/networkx,aureooms/networkx,wasade/networkx,RMKD/networkx,dhimmel/networkx,RMKD/networkx,Sixshaman/networkx,sharifulgeo/networkx,blublud/networkx,jfinkels/networkx,harlowja/networkx,dmoliveira/networkx,kernc/networkx,jakevdp/networkx,ghdk/networkx,aureooms/networkx,blublud/networkx,jni/networkx,ghdk/... | networkx/utils/tests/test_unionfind.py | networkx/utils/tests/test_unionfind.py | from nose.tools import *
import networkx as nx
def test_unionfind():
# Fixed by: 2cddd5958689bdecdcd89b91ac9aaf6ce0e4f6b8
# Previously (in 2.x), the UnionFind class could handle mixed types.
# But in Python 3.x, this causes a TypeError such as:
# TypeError: unorderable types: str() > int()
#
... | bsd-3-clause | Python | |
f11957f7b9f60ae1afbaf41fc558b2e600d2822c | Add basic smoketest | ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc | openprescribing/frontend/tests/commands/test_infer_practice_boundaries.py | openprescribing/frontend/tests/commands/test_infer_practice_boundaries.py | from django.core.management import call_command
from django.test import TestCase
from frontend.models import Practice
class InferPracticeBoundariesTestCase(TestCase):
fixtures = ['orgs', 'practices']
def test_basic_smoketest(self):
should_have_boundary = Practice.objects.filter(
setting... | mit | Python | |
81f3466990e4161d500a21a1429b14b8de836f0d | Create main.py | teodors/genertate-cfg | main.py | main.py | #!/usr/bin/python
import os
max_length = 8 # maximum length of a word (words can be < or == )
words = [] # store all words
productions = { # production rules
"E": ("E+E", "E*E", "(E)", "xI"),
"I": ("0I", "1I", "0", "1")
}
terminals = ['0', '1', 'x', '+', '*', '(', ')']
# generate all possible strings
def genera... | cc0-1.0 | Python | |
8ebe878fa4898939f210cf6a6918410781f964a9 | Add skeleton NoteBag.py | Sodel-the-Vociferous/NoteBag | NoteBag.py | NoteBag.py | #!/usr/bin/python -B
# For getting the config file
import configparser
import os.path
from os.path import abspath, dirname, realpath, join as join_path
from sys import argv
# Widgets
from tkinter import Button, Entry, Frame, Label, Listbox, Scrollbar, Tk
# Constants
from tkinter import BOTH, BOTTOM, END, LEFT, N, S, ... | mit | Python | |
b27b6b79871cbf814a2dd255cf47e6b3281f6dfb | add assert_equal() util function | mit-dci/lit,mit-dci/lit,mit-dci/lit,mit-dci/lit | test/utils.py | test/utils.py | #!/usr/bin/env python3
# Copyright (c) 2017 The lit developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""Utils for lit testing"""
def assert_equal(thing1, thing2, *args):
if thing1 != thing2 or any(thing1 != arg for a... | mit | Python | |
6daea04927ff722f03b66f3d101a2b2a2f9b59be | Create Pokedex.py | JacenBoy/ChariCalc | Pokedex.py | Pokedex.py | pokedex = {
"Bulbasaur" : 1,
"Ivysaur" : 2,
"Venusaur" : 3,
"Charmander" : 4,
"Charmeleon" : 5,
"Charizard" : 6,
"Squirtle" : 7,
"Wartortle" : 8,
"Blastoise" : 9,
"Caterpie" : 10,
"Metapod" : 11,
"Butterfree" : 12,
"Weedle" : 13,
"Kakuna" : 14,
"Beedrill" : 15,
"Pidgey" :... | mit | Python | |
4c7d6aef0805356e02a25e2cc70c167e9db5c509 | add new updated (WIP) play.py | raehik/scripts,raehik/scripts | play.py | play.py | #!/usr/bin/env python3
#
# Play a game.
#
import sys, os, argparse, logging
from raehutils import *
class PlayPy:
ERR_MATCH = 3
## __init_logging, run, exit {{{
def __init__(self):
retroarch_cores_dir = os.environ.get("HOME") + "/.config/retroarch/cores"
games_dir = os.environ.get("HOME")... | mit | Python | |
d168599b9167ede2098aa2fe82375aa95e5ab8b3 | Check if hook parameter is passed to the url | nicocoffo/docker-puller,nicocoffo/docker-puller,glowdigitalmedia/docker-puller,glowdigitalmedia/docker-puller | dockerpuller/app.py | dockerpuller/app.py | from flask import Flask
from flask import request
from flask import jsonify
import json
import subprocess
app = Flask(__name__)
config = None
@app.route('/', methods=['POST'])
def hook_listen():
if request.method == 'POST':
token = request.args.get('token')
if token == config['token']:
... | from flask import Flask
from flask import request
from flask import jsonify
import json
import subprocess
app = Flask(__name__)
config = None
@app.route('/', methods=['POST'])
def hook_listen():
if request.method == 'POST':
token = request.args.get('token')
if token == config['token']:
... | mit | Python |
f5b1038062aae983aea6500ae376ad87d4555c30 | allow one-off test runs | pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality | tests_once.py | tests_once.py | #!/usr/bin/env python
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2014 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero Gen... | agpl-3.0 | Python | |
e345aa8deb3f79c100996d445a23d2166fbb2aca | add evolutions | jerkos/hozons,jerkos/hozons,jerkos/be-my-change,jerkos/be-my-change,jerkos/hozons,jerkos/be-my-change | migrations/versions/2f5abd277f57_.py | migrations/versions/2f5abd277f57_.py | """empty message
Revision ID: 2f5abd277f57
Revises: 21d6a9f40991
Create Date: 2017-07-16 22:47:47.460172
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2f5abd277f57'
down_revision = '21d6a9f40991'
branch_labels = None
depends_on = None
def upgrade():
# ... | bsd-3-clause | Python | |
0bc0691c7714b7b5885ce2a9c05eb7eb35738c74 | Add test for sender_callable check | pydanny/webhooks | tests/test_decorators.py | tests/test_decorators.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from webhooks.exceptions import SenderNotCallable
from webhooks import webhook, unhashed_hook
def test_callable_sender():
@webhook(event="example200", sender_callable=123)
def basic(creator="pydanny"):
return {"husband": "Daniel Roy Greenf... | bsd-3-clause | Python | |
749c24ee930d44914970b757cfcadb30bb7a1d1c | Prepare for testcase | slaveofcode/pycrawler,slaveofcode/pycrawler | tests/unit/page_tests.py | tests/unit/page_tests.py | import unittest, os, sys
current_dir = os.path.dirname(__file__)
base_dir = os.path.join(current_dir, os.pardir, os.pardir)
sys.path.append(base_dir)
| mit | Python | |
f7273b6e97e6120fe0f3b0a2c9ea5865685608bd | Create client.py | wallefan/cosmic-encounter | client.py | client.py | """A slightly smarter telnet client that, if available, supports readline."""
import telnetlib
from telnetlib import IAC, WILL, DO, WONT, DONT
try:
import readline
old_readline_callback=readline.get_completer()
except ImportError:
readline=None
def telnet_callback(sock, cmd, option):
if option==OPTION... | mit | Python | |
98a2706909a7f880273080fdc7b4e696b6a600aa | Create 04.py | Pouf/CodingCompetition,Pouf/CodingCompetition | Euler/04.py | Euler/04.py | print(max(a*b for a in range(999, 100, -1) for b in range(999, 100, -1) if str(a*b)==str(a*b)[::-1]))
| mit | Python | |
e2a9f8ae9378c52bcde06863de3445ae89cca0d0 | Create details.py | dsg2806/acti.monash,dsg2806/acti.monash | details.py | details.py | import csv
f = open("data.csv")
out = open("detail.csv","w")
reader = csv.reader(f)
for line in reader:
if line[0][-1] == ":":
out.write(" ".join(line))
f.close()
out.close()
| agpl-3.0 | Python | |
389aa32dae9635bfc0eff192c9f01ab99e04b0f2 | Create main.py | buslovich/raspberry-pi-robotics | main.py | main.py | #controlling a robot with two motors that can avoid obstacles by using a sonar mounted on pan/tilt servos
import motorcontrol, servocontrol, sonarcontrol, auxiliary
import time
#instantiate objects
motor = motorcontrol.MotorControl()
servo = servocontrol.ServoControl()
sonar = sonarcontrol.SonarControl()
aux = auxili... | apache-2.0 | Python | |
cdbc14e6f78ca7b05e291a007c4267dd55d9b96a | add `enums.py` | kokimoribe/todo-api | todo/enums.py | todo/enums.py | """Enums are defined here"""
from enum import Enum, auto
class Status(Enum):
"""Enum for Task status"""
TO_DO = auto()
IN_PROGRESS = auto()
DONE = auto()
| mit | Python | |
f03079f2fd200d9b726c70acec9cdfd8772adb26 | Add support for arm64 as a CR architecture. | krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,fujunwei/chromium-crosswalk,dushu1203/chromium.src,ondra-novak/chromium.src,Just-D/chromium-1,axinging/chromium-crosswalk,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,dednal/chromium.src,M4sse/chromium.src,M4sse/chromium.src,Chilledheart/chromium,fuj... | tools/cr/cr/base/arch.py | tools/cr/cr/base/arch.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A module for the basic architectures supported by cr."""
import cr
DEFAULT = cr.Config.From(
CR_ENVSETUP_ARCH='{CR_ARCH}',
)
class Arch(cr.Plugin,... | # 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.
"""A module for the basic architectures supported by cr."""
import cr
DEFAULT = cr.Config.From(
CR_ENVSETUP_ARCH='{CR_ARCH}',
)
class Arch(cr.Plugin,... | bsd-3-clause | Python |
64140f651b22b4b962368a53723cb4bda86651ba | test branch | ellisztamas/faps | test.py | test.py | #this is a test file
| mit | Python | |
df9122528172c5142160f9804b695d65bd211892 | Create QAStats.py | Nik0l/UTemPro,Nik0l/UTemPro | QAStats.py | QAStats.py | # Calculating statistics on Q&A communities. Includes temporal statistics ( for example, how many questions were asked in a period), spatial statistics, number of users, questions, answers.
| mit | Python | |
8038e27862f4c128168bd656d9e43880359b1a61 | Create Scraper.py | RuyCalderon/CraigslistScraper | Scraper.py | Scraper.py | import requests
from bs4 import BeautifulSoup
from time import sleep
import datetime
import random
def RemoveEncodingSignature(string):
LocalStringCopy = ''
EncodingState = [{'Type': None, 'Active' : False, 'Delimiter' : None, 'StartingIndex': 0}]
for Index in range(0, len(string)):
if EncodingState[len(Encod... | mit | Python | |
c54d73cc3e6a1e868fa2804e51d6b9247bd4c814 | Add player season definition | leaffan/pynhldb | db/player_season.py | db/player_season.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import timedelta
from sqlalchemy import and_
from .common import Base, session_scope
class PlayerSeason(Base):
__tablename__ = 'player_seasons'
__autoload__ = True
STD_STATS = [
'games_played', 'goals', 'assists', 'points',
'p... | mit | Python | |
9add66f49ae0daa28db84e36bf2ac8675125d21c | Remove instructional comments | BryceLohr/authentic,pu239ppy/authentic2,BryceLohr/authentic,incuna/authentic,adieu/authentic2,pu239ppy/authentic2,incuna/authentic,pu239ppy/authentic2,incuna/authentic,pu239ppy/authentic2,adieu/authentic2,BryceLohr/authentic,BryceLohr/authentic,incuna/authentic,adieu/authentic2,adieu/authentic2,incuna/authentic | urls.py | urls.py | from django.conf.urls.defaults import *
from django.contrib import admin
from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^registration/', include('registration.urls')),
(r'^$', direct_to_template,
... | from django.conf.urls.defaults import *
from django.contrib import admin
from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^authentic/', include('authentic.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.adm... | agpl-3.0 | Python |
51e368584d59ad2f308f1c9229fbbbf40c504749 | Create list.py | hsachdevah/aws | list.py | list.py | import argparse
import boto.ec2
access_key = ''
secret_key = ''
def get_ec2_instances(region):
ec2_conn = boto.ec2.connect_to_region(region,
aws_access_key_id=access_key,
aws_secret_access_key=secret_key)
reservations = ec2_conn.get_all_reservations()
for reservation in res... | mit | Python | |
c0bca49a19e4f97663b9f282bb11768457aec89e | Add example of tycho2 usage | lkangas/python-tycho2 | example.py | example.py | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 21 00:17:33 2017
@author: lauri.kangas
"""
import matplotlib.pyplot as plt
import numpy as np
from tycho2 import tycho2
from projections import stereographic, unity
import coordinate_transformations as coord
index = np.load('tyc2index.npy')
catalog = np.load('tyc2.... | mit | Python | |
6dc4d2d1e9ef998ff310c14c54586ca694572801 | Add extract plugin | devzero-xyz/Andromeda-Plugins | extract.py | extract.py | """This plugin extracts the main content of a webpage"""
"""e.g. extracting the article of a url of bbc.co.uk"""
from utils import add_cmd, add_handler
import utils
import requests
from bs4 import BeautifulSoup
name = "extract"
cmds = ["extract"]
def main(irc):
if name not in irc.plugins.keys():
irc.plugins[name]... | mit | Python | |
8c71a177c16762ab50dafe2528d24fab4ccf0925 | Add py solution for 462. Minimum Moves to Equal Array Elements II | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/minimum-moves-to-equal-array-elements-ii.py | py/minimum-moves-to-equal-array-elements-ii.py | class Solution(object):
def minMoves2(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
median = nums[len(nums) / 2]
return sum(abs(x - median) for x in nums)
| apache-2.0 | Python | |
9cd494f526fa49e04bbdbb31dc6d32f444bbbba8 | add a tool to print the content of SEG frames | QIICR/dcmqi,QIICR/dcmqi,QIICR/dcmqi,QIICR/dcmqi,QIICR/dcmqi | util/dumpSEGPixelData.py | util/dumpSEGPixelData.py | import pydicom, sys
from colorama import Fore, Style, init
# colorama
init()
d = pydicom.read_file(sys.argv[1])
if len(sys.argv)>2:
frame = int(sys.argv[2])-1
print("Dumping frame "+str(frame))
else:
frame = None
print(d.Rows)
print(d.Columns)
print(d.NumberOfFrames)
totalPixels = int(d.Rows*d.Columns*d.Number... | bsd-3-clause | Python | |
ec3ef6e8770b9a36f20a05216d8e0964107a8689 | Add a new snippet (Python GTK+3). | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/pygtk/python_gtk3_pygobject/combobox.py | python/pygtk/python_gtk3_pygobject/combobox.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
This is the simplest Python GTK+3 snippet.
See: http://python-gtk-3-tutorial.readthedocs.org/en/latest/combobox.html
"For a simple list of textual choices, the model-view API of Gtk.ComboBox can
be a bit ove... | mit | Python | |
5c3589b295c9b9156a6bbfdcecc81754a76f9e0d | Create url-logger.py | Poorchop/hexchat-scripts,ishan-marikar/hexchat-scripts,ishan-marikar/hexchat-scripts | url-logger.py | url-logger.py | from datetime import datetime
import hexchat
import os
import re
__module_name__ = "URL Logger"
__module_author__ = "Poorchop"
__module_version__ = "0.1"
__module_description__ = "Log URLs from specific channels and PMs to disk"
# channels PMs
watched_channels = ("#hexchat", "TingPing")
event... | mit | Python | |
0fef4f88aa37b221947a22c91a0c5bfe636fcaf1 | Test for adjointness of new point grid models. | ryanvolz/radarmodel,ryanvolz/radarmodel | radarmodel/tests/test_pointgrid_adjointness.py | radarmodel/tests/test_pointgrid_adjointness.py | # ----------------------------------------------------------------------------
# Copyright (c) 2015, 'radarmodel' developers (see AUTHORS file)
# All rights reserved.
#
# Distributed under the terms of the BSD 3-Clause ("BSD New") license.
#
# The full license is in the LICENSE file, distributed with this software.
# -... | mit | Python | |
3c4c06607eb14920cf4b9d0e4fb6d29f37d1d0ec | Add db_add.py, adding a post from a file, with tags from the filename. | drougge/wellpapp-pyclient | db_add.py | db_add.py | #!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
from sys import argv, exit
from dbclient import dbclient
from hashlib import md5
import Image
from cStringIO import StringIO
from pyexiv2 import Image as ExivImage
from os.path import basename
if len(argv) < 2:
print "Usage:", argv[0], "filename [filename [..]]"
ex... | mit | Python | |
7570e757e79c29974afffeee036f056328a06fe9 | Create pull.py | wyongkun/Hello-World | pull.py | pull.py | It's a file to try my first pull derective
| mit | Python | |
5d38ab06fd014241cba7e8cdcfed9887a92460b9 | Add smoke tests aperiodic | voytekresearch/neurodsp | neurodsp/tests/test_aperiodic_dfa.py | neurodsp/tests/test_aperiodic_dfa.py | """Tests for fractal analysis using fluctuation measures."""
from neurodsp.tests.settings import FS
from neurodsp.aperiodic.dfa import *
###################################################################################################
################################################################################... | apache-2.0 | Python | |
3628c21841eea385dbc13e0065ab41138cf102a6 | Add users to the admin | martinogden/djangae,trik/djangae,jscissr/djangae,SiPiggles/djangae,pablorecio/djangae,martinogden/djangae,martinogden/djangae,stucox/djangae,pablorecio/djangae,SiPiggles/djangae,chargrizzle/djangae,stucox/djangae,wangjun/djangae,kirberich/djangae,kirberich/djangae,trik/djangae,nealedj/djangae,armirusco/djangae,leekchan... | djangae/contrib/auth/admin.py | djangae/contrib/auth/admin.py | from django.contrib import admin
from djangae.contrib.auth.models import User
admin.site.register(User) | bsd-3-clause | Python | |
e506a059369b089cb4c163669a04fbb9d05e9884 | add minimal FBO example | swenger/glitter,swenger/glitter,swenger/glitter | examples/minimalframebufferexample.py | examples/minimalframebufferexample.py | from scipy.misc import imsave
from glitter import ShaderProgram, RectangleTexture, Framebuffer, VertexArray
from glitter.contexts.glut import GlutWindow, main_loop
vertex_shader = """
#version 400 core
layout(location=0) in vec4 in_position;
void main() {
gl_Position = in_position;
}
"""
fragment_shader = """
... | mit | Python | |
066c48effb2f2c1534e43687d031e01f823f098f | add common mixins | EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi | emgapi/viewsets.py | emgapi/viewsets.py | # -*- coding: utf-8 -*-
# Copyright 2017 EMBL - European Bioinformatics Institute
#
# 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 requ... | apache-2.0 | Python | |
59ccbc17e7e7f4f75b8f95bb1287b676466068db | Create snake1.py | afeyrer/Final-Project | snake1.py | snake1.py | mit | Python | ||
cf496298c839e63a786bc8b4a934df09beef93ac | Add script to better log time | squaresurf/dotfiles,squaresurf/dotfiles,squaresurf/dotfiles | bin/log.py | bin/log.py | #!/usr/bin/env python
from datetime import date, datetime
from pathlib import Path
import csv
import os
import sys
if len(sys.argv) != 2:
print("Usage: {} 'job to be logged'".format(sys.argv[0]))
exit(1)
log_dir = "{}/time_logs".format(Path.home())
if not os.path.isdir(log_dir):
os.mkdir(log_dir)
csv_fi... | mit | Python | |
6cad1e6f91dd01f8fa36e2c8ca1cf7fe092a5c43 | Adjust init: static route include, double quotes. | hlwsmith/akhet,hlwsmith/akhet,Pylons/akhet,hlwsmith/akhet,Pylons/akhet | akhet/demo/__init__.py | akhet/demo/__init__.py | from pyramid.config import Configurator
import pyramid_beaker
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
# Configure Beaker sessions and caching
session_factory = pyramid_beaker.session_factory_from_settin... | import akhet.static as static
from pyramid.config import Configurator
import pyramid_beaker
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
# Configure Beaker sessions and caching
session_factory = pyramid_beak... | mit | Python |
addb7f342e5c2bc0f1df19bd6d00d50be23a52da | Add Year | JennyWang01/PythonLeaning | year.py | year.py | months=['January','February','March','April','May','June','July','August','September','October','November','December']
endings=['st','nd','rd']+17*['th']+['st','nd','rd']+7*['th']+['st']
year=raw_input('Year:')
month=raw_input('Month(1--12):')
day=raw_input('day(1--31):')
month_number=int(month)
day_number=int(day)
mon... | mit | Python | |
dac398518bac49c6c51d04166c021323cdba9235 | Add unit tests. | NLeSC/ODEX-FAIRDataPoint,DTL-FAIRData/ODEX-FAIRDataPoint,NLeSC/ODEX-FAIRDataPoint,DTL-FAIRData/ODEX-FAIRDataPoint,DTL-FAIRData/ODEX-FAIRDataPoint,NLeSC/ODEX-FAIRDataPoint,DTL-FAIRData/ODEX-FAIRDataPoint,NLeSC/ODEX-FAIRDataPoint | fdp-api/python/tests/test_metadata.py | fdp-api/python/tests/test_metadata.py | from nose import with_setup
from nose.tools import assert_equals, assert_in, assert_true, assert_false
from metadata import FAIRConfigReader, FAIRGraph, FDPath
from urllib2 import urlparse
reader = FAIRConfigReader()
def test_paths():
id = 'abc'
for resource in ['fdp', 'doc']:
assert_equals(FDPath(resour... | apache-2.0 | Python | |
19c94f3bf71c07763dfddd72b867502d765d01db | Add https://gist.github.com/2349756 | hudsonkeithl/scraperwiki-python,openaustralia/scraperwiki-python,tlevine/scraperwiki-python,hudsonkeithl/scraperwiki-python,openaustralia/scraperwiki-python,scraperwiki/scraperwiki-python,scraperwiki/scraperwiki-python,tlevine/scraperwiki-python | sqlite.py | sqlite.py | import scraperwiki
from dumptruck import DumpTruck
dt = DumpTruck()
def execute(sqlquery, data=None, verbose=1):
""" Should return list of lists, but returns list of dicts """
return dt.execute(sqlquery, *data, commit=False)
# other way [ dict(zip(result["keys"], d)) for d in result["data"] ]
def save(u... | bsd-2-clause | Python | |
07e074e662b33713a266777300354e8953ce3b78 | ADD connection class to Azure | fastconnect/cloudify-azure-plugin | plugin/connection.py | plugin/connection.py | from plugin import utils
from azure import servicemanagement
class AzureConnectionClient():
"""Provides functions for getting the Azure Service Management Service
"""
def __init__(self):
self.connection = None
def client(self):
"""Represents the AzureConnection Client
"""
... | apache-2.0 | Python | |
9ceb4f394c19a74d8cd28698eeb9116cf8099117 | add anno | polltooh/traffic_video_analysis | annot_to_densitymap.py | annot_to_densitymap.py | import xml.etree.ElementTree as ET
import numpy as np
import xmltodict
import matplotlib.pyplot as plt
#import cv2
xml_data = 'data/Cam253/[Cam253]-2016_4_21_15h_150f/000150.xml'
with open(xml_data) as xml_d:
doc = xmltodict.parse(xml_d.read())
img = np.zeros((352, 240), np.float32)
def add_to_image(image, bbox):
... | apache-2.0 | Python | |
0b0150ad73c52ea5b23def899edb819bd3318eb1 | fix uncaught analytics exception | lbryio/lbry,zestyr/lbry,lbryio/lbry,lbryio/lbry,zestyr/lbry,zestyr/lbry | lbrynet/analytics/api.py | lbrynet/analytics/api.py | import functools
import json
import logging
from requests import auth
from requests_futures import sessions
from lbrynet.conf import settings
from lbrynet.analytics import utils
log = logging.getLogger(__name__)
def log_response(fn):
def _log(future):
if future.cancelled():
log.warning('Re... | import functools
import json
import logging
from requests import auth
from requests_futures import sessions
from lbrynet.conf import settings
from lbrynet.analytics import utils
log = logging.getLogger(__name__)
def log_response(fn):
def _log(future):
if future.cancelled():
log.warning('Re... | mit | Python |
8088d7061c24ca78df0c92be6e36edb7deca1dac | Remove print | kalail/gutter,kalail/gutter,kalail/gutter,disqus/gutter,disqus/gutter | gargoyle/client/operators/__init__.py | gargoyle/client/operators/__init__.py | import inspect
class GetInitArguments(object):
def __get__(self, obj, obj_type):
args = inspect.getargspec(obj_type.__init__).args
return tuple(args[1:])
class Base(object):
def __init__(self):
pass
arguments = GetInitArguments()
| import inspect
class GetInitArguments(object):
def __get__(self, obj, obj_type):
print obj_type
args = inspect.getargspec(obj_type.__init__).args
return tuple(args[1:])
class Base(object):
def __init__(self):
pass
arguments = GetInitArguments()
| apache-2.0 | Python |
8238d7ad6793f6deef520a46f85d40b0d75d221f | Add placeholder for the parsing code | rambo/python-gpmf,rambo/python-gpmf | gpmf/parse.py | gpmf/parse.py | # TODO: Implement GPMF parsing
# see https://github.com/gopro/gpmf-parser#gmfp-deeper-dive for format details
| mit | Python | |
d7553fd42e3ac0bcdf0ab70468ad314253b64871 | Create parse.py | soyrice/autozoom | zoom/parse.py | zoom/parse.py | parse(geo, df) :
latDict, lonDict = dict(), dict()
# identify extreme most latitude and longitude coordinate pairs in each state
# save coordinate pair of most extreme points for autozoom
for count in range(0,len(usStates['features'])) :
if geo['key'] in [code for code in statePctChange['code']... | mit | Python | |
0f7d6f039930324d77dc23315ed3c9bd10c1f0de | Add missing file | anlthms/sp-2016,anlthms/sp-2016 | util.py | util.py | #
# Copyright 2016 Anil Thomas
#
# 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 t... | apache-2.0 | Python | |
37dabf1c98407602edda25dbb9c24c17bd84f19a | Add timer to builders | henningjp/CoolProp,JonWel/CoolProp,DANA-Laboratory/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,CoolProp/CoolProp,DANA-Laboratory/CoolProp,DANA-Laboratory/CoolProp,JonWel/CoolProp,dcprojects/CoolProp,dcprojects/CoolProp,CoolProp/CoolProp,dcprojects/CoolProp,CoolProp/CoolProp,JonWel/CoolProp,JonWel/CoolProp,CoolProp/Co... | dev/scripts/coolprop_builder_timer.py | dev/scripts/coolprop_builder_timer.py | from __future__ import print_function
import urllib, json
filehandle = urllib.urlopen('http://www.coolprop.dreamhosters.com:8010/json/builders')
jj = json.loads(filehandle.read())
times = []
for key in jj.keys():
filehandle = urllib.urlopen('http://www.coolprop.dreamhosters.com:8010/json/builders/' + key + '/buil... | mit | Python | |
27bbb0dff2ef60008c0bd7615e2607ee8544aeb2 | Add files via upload | sandiegodata/age-friendly-communities | ageDataOver65_v3.py | ageDataOver65_v3.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 19 23:56:12 2016
@author: CC
Using Python 3.5.2; Anaconda 4.2.0; Spyder 3.0.0
Purpose: open a CSV file from https://censusreporter.org/ and recode it with the corresponding JSON file
CSV raw data file containing age census data in San Diego: 'acs... | mit | Python | |
45aacb9d0f5f24600d4796cc5194dfbde1c65222 | Add map/dist/filter demo | precompiler/python-101 | learning-python/ch05/MapExamples.py | learning-python/ch05/MapExamples.py | lst = range(10)
ret = map(lambda *i: i, lst, "abcdefg")
for item in ret:
print(item)
students = [
dict(id=0, credits=dict(math=9, physics=6, history=7)),
dict(id=1, credits=dict(math=6, physics=7, latin=10)),
dict(id=2, credits=dict(history=8, physics=9, chemistry=10)),
dict(id=3, credits=dict(ma... | apache-2.0 | Python | |
efcc5260a8566d41880cddcc54d4f86c8f722153 | Add unit test | WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos | test/unit_test/test_utility_stats/test_utility_stats.py | test/unit_test/test_utility_stats/test_utility_stats.py | from lexos.processors.analyze import information
word_lists = [{"abundant": 40, "actually": 20, "advanced": 15, "alter": 5},
{"hunger": 1, "hunt": 2, "ignore": 3, "illustration": 4,
"ink": 5}]
file_list = ["file_one.txt", "file_two.txt"]
for i in range(len(file_list)):
# because the ... | mit | Python | |
7dc489b393ba293db5cc72c2f9b2bd65d6fe1166 | add command to migrate sheet. | opencivicdata/opencivicdata.org,opencivicdata/opencivicdata.org,opencivicdata/opencivicdata.org | upload/management/commands/import_transaction.py | upload/management/commands/import_transaction.py | import csv
from django.contrib.auth.models import User
from opencivicdata.models import Jurisdiction, Division
from upload.backend.parser import import_stream, people_to_pupa
from upload.backend.importer import do_import
from upload.models import SpreadsheetUpload
from django.core.management.base import BaseCommand, C... | bsd-3-clause | Python | |
35a0832ab372b9519ed7391e166ef8c25456a005 | Bump minor version | gmjosack/pygerduty,dropbox/pygerduty,excelciordan/pygerduty,JohnTheodore/pygerduty,lyft/pygerduty | pygerduty/version.py | pygerduty/version.py | version_info = (0, 28, 2)
__version__ = '.'.join(str(v) for v in version_info)
| version_info = (0, 28, 1)
__version__ = '.'.join(str(v) for v in version_info)
| mit | Python |
7b34a2cc6c8124629ee11a5782a8d9005f80e4b1 | Create downloader-v0.22.py | Keiiko/anime-manga-cz-downloader | downloader-v0.22.py | downloader-v0.22.py | import urllib2
import re
import os
def stahniHtml(url):
f = urllib2.urlopen(url)
obsah = f.read()
f.close()
return obsah
def nahled(url):
global chapter
global currpatch1
odkazy = vyberodkazux(url)
for odkaz in odkazy:
currpatch1 = odkaz.replace("index.html", "")
chapte... | mit | Python | |
b9245a8acf0bed7e19f709490c4ba3788028da93 | Fix error in PoolStatusEntry model | MozillaSecurity/FuzzManager,lazyparser/FuzzManager,MozillaSecurity/FuzzManager,sigma-random/FuzzManager,cihatix/FuzzManager,lazyparser/FuzzManager,lazyparser/FuzzManager,sigma-random/FuzzManager,MozillaSecurity/FuzzManager,lazyparser/FuzzManager,cihatix/FuzzManager,sigma-random/FuzzManager,cihatix/FuzzManager,cihatix/F... | server/ec2spotmanager/migrations/0003_auto_20150504_1440.py | server/ec2spotmanager/migrations/0003_auto_20150504_1440.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ec2spotmanager', '0002_instancestatusentry_poolstatusentry'),
]
operations = [
migrations.RemoveField(
model_nam... | mpl-2.0 | Python | |
d05bdc1a3a343184a02ec12b734a110140e94829 | add persistent decorator of class | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | server/Mars/ServerUtils/PersistentDecorator.py | server/Mars/ServerUtils/PersistentDecorator.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
2f0b290d64aa1f85b60dfce99c39de49f095cbbd | Add script to warn users about imepending deletion | OSGConnect/freesurfer_workflow,OSGConnect/freesurfer_workflow | python/warn_purge.py | python/warn_purge.py | #!/usr/bin/env python
# Copyright 2016 University of Chicago
# Licensed under the APL 2.0 license
import argparse
import getpass
import os
import subprocess
import sys
import logging
from email.mime.text import MIMEText
import psycopg2
import shutil
PARAM_FILE_LOCATION = "/etc/freesurfer/db_info"
FREESURFER_BASE = '... | apache-2.0 | Python | |
7adbfdf409a81a1462073fa97eb3860523e71a13 | Add python lib for queries. | acthp/ucsc-xena-server,acthp/ucsc-xena-server,ucscXena/ucsc-xena-server,ucscXena/ucsc-xena-server,acthp/ucsc-xena-server,ucscXena/ucsc-xena-server,acthp/ucsc-xena-server,ucscXena/ucsc-xena-server,ucscXena/ucsc-xena-server,acthp/ucsc-xena-server | python/xena_query.py | python/xena_query.py | """
Utilities for xena queries.
A basic query example.
Queries are scheme expressions.
>>> import xena_query as xena
>>> xena.post("https://genome-cancer.ucsc.edu/proj/public/xena", "(+ 1 2)")
'3.0'
>>> xena.post("https://genome-cancer.ucsc.edu/proj/public/xena", "(let [x 2 y (+ x 3)] (* x y))")
'10.0'
Looking up s... | apache-2.0 | Python | |
ee21691294e6bf9aacf0dd8591991c33d30c5159 | raise KeyboardInterrupt for backward compatibility | etingof/pysnmp,filippog/pysnmp,etingof/pysnmp,filippog/pysnmp | pysnmp/carrier/asyncore/dispatch.py | pysnmp/carrier/asyncore/dispatch.py | # Implements I/O over asynchronous sockets
from time import time
from sys import exc_info
from asyncore import socket_map
from asyncore import loop
from pysnmp.carrier.base import AbstractTransportDispatcher
from pysnmp.error import PySnmpError
class AsynsockDispatcher(AbstractTransportDispatcher):
def __init__(se... | # Implements I/O over asynchronous sockets
from time import time
from sys import exc_info
from asyncore import socket_map
from asyncore import loop
from pysnmp.carrier.base import AbstractTransportDispatcher
from pysnmp.error import PySnmpError
class AsynsockDispatcher(AbstractTransportDispatcher):
def __init__(se... | bsd-2-clause | Python |
98bd10cdf2c380b17c16a47a8f962dc384b3a18d | Solve py set discard remove pop | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | python/py-set-discard-remove-pop.py | python/py-set-discard-remove-pop.py | num_elements = int(input())
s = set(map(int, input().split()))
num_operations = int(input())
for _ in range(num_operations):
operation = input().split(" ")
if(operation[0] == "pop"):
s.pop()
else:
op, val = operation
s.discard(int(val))
print(sum(s))
| mit | Python | |
a8db812c5a9822f6ea72bf44134ed2219a2c5c74 | Remove print statement. | gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin | app/main/views/dashboard.py | app/main/views/dashboard.py | from flask import (abort, render_template, session)
from flask_login import login_required
from app.main import main
from app.main.dao.services_dao import get_service_by_id
from app.main.dao import templates_dao
from notifications_python_client.errors import HTTPError
from app import job_api_client
from app.utils impo... | from flask import (abort, render_template, session)
from flask_login import login_required
from app.main import main
from app.main.dao.services_dao import get_service_by_id
from app.main.dao import templates_dao
from notifications_python_client.errors import HTTPError
from app import job_api_client
from app.utils impo... | mit | Python |
f3130bde2704008017e1438bf7d6cb1c0bbf3d61 | Create jsonSender.py | edlectrico/Elasticsearch_ELK_IoT,edlectrico/Elasticsearch_ELK_IoT | jsonSender.py | jsonSender.py | import socket
import json
import time
from distancemeter import get_distance,cleanup
# Logstash TCP/JSON Host
JSON_PORT = 5959
JSON_HOST = '127.0.0.1'
if __name__ == '__main__':
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((JSON_HOST, JSON_PORT))
while True:
... | apache-2.0 | Python | |
482c79850a943f77034d376c0d8e8682142b705d | Add init | senthil10/scilifelab,kate-v-stepanova/scilifelab,SciLifeLab/scilifelab,senthil10/scilifelab,kate-v-stepanova/scilifelab,senthil10/scilifelab,kate-v-stepanova/scilifelab,jun-wan/scilifelab,jun-wan/scilifelab,jun-wan/scilifelab,kate-v-stepanova/scilifelab,SciLifeLab/scilifelab,jun-wan/scilifelab,senthil10/scilifelab,SciL... | project_management/pmtools/__init__.py | project_management/pmtools/__init__.py | """
Pipeline Management Tools
Usage: pm command [options]
"""
from cement.core import foundation, controller, handler
## Abstract base controller -- for sharing arguments
class AbstractBaseController(controller.CementBaseController):
class Meta:
arguments = [
(['-n', '--dry_run'], dict(help="... | mit | Python | |
d853fba90a8fc784cdb248923cede6166fe91a8f | remove some field that duplicate | nfco/netforce,sidzan/netforce,bank-netforce/netforce,bank-netforce/netforce,anastue/netforce,sidzan/netforce,sidzan/netforce,bank-netforce/netforce,anastue/netforce,anastue/netforce,anastue/netforce,nfco/netforce,anastue/netforce,sidzan/netforce,nfco/netforce,anastue/netforce,sidzan/netforce,nfco/netforce,nfco/netforce... | netforce_mfg/netforce_mfg/models/stock_barcode.py | netforce_mfg/netforce_mfg/models/stock_barcode.py | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, publi... | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, publi... | mit | Python |
ee7f49a39f0a0d3048c0b83c856982d3b34d1701 | Create anovaTest.py | duttashi/Data-Analysis-Visualization | anovaTest.py | anovaTest.py | # Importing the required libraries
# Note %matplotlib inline works only for ipython notebook. It will not work for PyCharm. It is used to show the plot distributions
#%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.formula.api as smf
imp... | mit | Python | |
f1e2ae06784d759b0f6dbfae1424a2de70353ea9 | add a module used to call platon (software assigning space groups) on a structure in pymatgen | yanikou19/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,ctoher/pymatgen,migueldiascosta/pymatgen,Bismarrck/pymatgen,sonium0/pymatgen,rousseab/pymatgen,rousseab/pymatgen,ctoher/pymatgen,migueldiascosta/pymatgen,Bismarrck/pymatgen,Bismarrck/pymatgen,sonium0/pymatgen,Dioptas/pymatgen,ctoher/pymatgen,yanikou19/pymatgen,mig... | pymatgen/command_line/platon_caller.py | pymatgen/command_line/platon_caller.py | '''
Interface with command line platon
http://aflowlib.org/
Only tested on Linux
inspired by Shyue's qhull_caller
WARNING: you need to have a platon in your path for this to work
'''
__author__="Geoffroy Hautier"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Geoffroy Hau... | mit | Python | |
6cad2d60857e9d8714f679f68ae4887e58092a57 | Add caffe-compute-image-mean. | bamos/python-scripts,bamos/python-scripts | python2.7/caffe-compute-image-mean.py | python2.7/caffe-compute-image-mean.py | #!/usr/bin/env python2
import sys
sys.path.append("/home/bamos/repos/caffe-local/python")
import argparse
import numpy as np
import os
import time
from caffe.proto import caffe_pb2
from caffe.io import array_to_blobproto
from collections import defaultdict
from skimage import io
if __name__ == '__main__':
parse... | mit | Python | |
db2e1a1070e812eaa539b229d128a58a59448317 | create hatenablog-post.py | tadaken3/hatenablog_post | hatenablog-post.py | hatenablog-post.py | #!/usr/bin/env python
#coding=utf-8
import sys
import datetime
import random
import hashlib
import base64
import requests
from chardet.universaldetector import UniversalDetector
username = 'username'
password = 'API key'
blogname = 'yourblogname.hatenablog.com'
def main():
if len(sys.argv) != 2:
... | mit | Python | |
8e94da2cf788115a1562db253c96b1932b495ef3 | Add script for generating chords, used to make some of the sounds. | apendleton/valve-installation,apendleton/valve-installation | make_chord.py | make_chord.py | from collections import OrderedDict
from itertools import cycle
import sys
# build the pitch table
note_names = ['A', 'A#/Bb', 'B', 'C', 'C#/Db', 'D', 'D#/Eb', 'E', 'F', 'F#/Gb', 'G', 'G#/Ab']
note_cycle = cycle(note_names)
piano = []
onumber = 0
for i in range(1, 89):
note = note_cycle.next()
if note == 'C'... | bsd-3-clause | Python | |
56bfc977ea1e7b415e699a82459c917c71fe36df | add app.utils module | iBis-project/iBis-server2,rleh/ocyco-server-python,OpenCycleCompass/ocyco-server-python | app/utils.py | app/utils.py |
def get_city_by_coordinates(lon, lat):
# TODO: determinate city (reverse geocoding...)
return "MyCity"
| agpl-3.0 | Python | |
2b1500419e97b75c7b5bda9d8e226ed8340edb50 | add experimental python proxy | n1kdo/lotw-gridmapper,n1kdo/lotw-gridmapper,n1kdo/lotw-gridmapper | lotwreport.py | lotwreport.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
lotwreport.py: proxy for ARRL LoTW lotwreport.adi web service, which does not
support CORS headers and thus cannot be called from a script that is loaded
from any other server. This CGI must be served from the same host name as
any script that wishes to call it. Becau... | bsd-2-clause | Python | |
2c387a3674a574bcbfa2ebf5dc32d7987988aef5 | Add py-fastavro (#19196) | LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-fastavro/package.py | var/spack/repos/builtin/packages/py-fastavro/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFastavro(PythonPackage):
"""Fastavro for Python."""
homepage = "https://github.com/... | lgpl-2.1 | Python | |
e43ffdc6ce35438b188f84ec34855ac3ff5a4722 | Create immhook.py | abhinavbom/Debugging | immhook.py | immhook.py | #-------------------------------------------------------------------------------
# Name: Immunity debugger Exception Hook
# Purpose: The script throws out values of EIP,ESP when a crash exception occours
#
# Author: darklord
#
# Created: 19/10/2014
# Copyright: (c) darklord 2014
# Licence: <y... | mit | Python | |
9fa0ae7c14bfa0d352bedd5ab7ea92be7736a485 | Create classes.py | SamCD/TestTrainer | classes.py | classes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import notelib
class Student(object):
PassedTests = []
score = 0
def __init__(self,name):
self.name=name
def take_test(self,subject,level):
mo = (subject,level)
tfiles = ["{}questions.txt{}".format(mo[0],mo[1]),
... | apache-2.0 | Python | |
466edb19fbf6fcfc51e671a80d45320bd8e1717c | add linode_api | leonanu/scripts,leonanu/scripts | linode_api/View_Network_Transfer.py | linode_api/View_Network_Transfer.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import json
import math
import sys
from urllib import parse,request
LINODE_ID = ''
LINODE_TOKEN_RO = ''
def getTransfer(linode_id, argv):
url = 'https://api.linode.com/v4/linode/instances/' + linode_id + '/transfer'
header_dict = {
'User-Agent': 'Use... | mit | Python | |
c84e3394ed4829ff9a66167864a11a4ef6a2b62c | Add script to get certificate expiration date | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | scripts/get_saml_cert_expiration.py | scripts/get_saml_cert_expiration.py | from cryptography import x509
from cryptography.hazmat.backends import default_backend
from bluebottle.clients import properties
from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
def run(*args):
for client in Client.objects.all():
with LocalTenant(client):
... | bsd-3-clause | Python | |
3f685e3873c18e1eb28b7a4121c552bbb697e0a4 | Add script for generate events. | Intey/OhMyBank,Intey/OhMyBank,Intey/OhMyBank,Intey/OhMyBank | scripts/generator.py | scripts/generator.py | #!/usr/bin/python3
from random import randint
output = ""
filename = "data"
class Generator:
def gen_date(self):
return str(randint(2013, 2015)) + "-" \
+ str(randint(1, 12)) + "-" \
+ str(randint(1, 31))
def gen_price(self):
return str(10 * randint(10, 100))
d... | mit | Python | |
8be49481990096c7a4735807cc3d9611b4ce0780 | add migration script | UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario | scripts/update_metatable_columns.py | scripts/update_metatable_columns.py | from plenario.settings import DATABASE_CONN
from plenario.database import Base
from plenario.models import MetaTable
from sqlalchemy import create_engine, Table
from sqlalchemy.orm import sessionmaker
from sqlalchemy.exc import NoSuchTableError
def main():
# establish connection to provided database
engine =... | mit | Python | |
f5284cc7da9166a43e3cfbd901205f4446295f7a | Add Consumer Product Safety Commission. | divergentdave/inspectors-general,lukerosiak/inspectors-general | inspectors/cpsc.py | inspectors/cpsc.py | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# https://www.cpsc.gov/en/about-cpsc/inspector-general/
# Oldest report: 2003
# options:
# standard since/year options for a year range to fetch from.
#
... | cc0-1.0 | Python | |
79a81b2d1936cd44caabf5f4e38abdee88a8821a | add missing proxy for kiva.agg.plat_support | enthought/etsproxy | enthought/kiva/agg/plat_support.py | enthought/kiva/agg/plat_support.py | # proxy module
from kiva.agg.plat_support import *
| bsd-3-clause | Python | |
f25a1484892d7b60fb9ffaba033cfb467e1b34f5 | Update random-point-in-non-overlapping-rectangles.py | tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode | Python/random-point-in-non-overlapping-rectangles.py | Python/random-point-in-non-overlapping-rectangles.py | # Time: ctor: O(n)
# pick: O(logn)
# Space: O(n)
# Given a list of non-overlapping axis-aligned rectangles rects,
# write a function pick which randomly and uniformily picks
# an integer point in the space covered by the rectangles.
#
# Note:
# - An integer point is a point that has integer coordinates.
# - A... | # Time: O(logn)
# Space: O(n)
# Given a list of non-overlapping axis-aligned rectangles rects,
# write a function pick which randomly and uniformily picks
# an integer point in the space covered by the rectangles.
#
# Note:
# - An integer point is a point that has integer coordinates.
# - A point on the perimeter of... | mit | Python |
eb8eabd44764dc26fdbd08ef35b3ea8fc0dd7c54 | Add mutt display script | SevereOverfl0w/.files,SevereOverfl0w/.files,SevereOverfl0w/.files | bin/mutt-display.py | bin/mutt-display.py | #!/usr/bin/env python2
"""
Copyright 2011 by Brian C. Lane
"""
import sys
import email
raw_msg = sys.stdin.read()
msg = email.message_from_string(raw_msg)
date = msg.get('Date', None)
if date:
from email.utils import mktime_tz, parsedate_tz, formatdate
try:
# Convert to local TZ
tz_tuple =... | mit | Python | |
2957a0331654a22c6f62544b6ec1ca4a4ee86be9 | Tweak metainfo_series series name detection. | LynxyssCZ/Flexget,ratoaq2/Flexget,jawilson/Flexget,thalamus/Flexget,tarzasai/Flexget,vfrc2/Flexget,tobinjt/Flexget,malkavi/Flexget,poulpito/Flexget,offbyone/Flexget,Danfocus/Flexget,vfrc2/Flexget,jacobmetrick/Flexget,jawilson/Flexget,lildadou/Flexget,malkavi/Flexget,malkavi/Flexget,sean797/Flexget,LynxyssCZ/Flexget,oxc... | flexget/plugins/metainfo_series.py | flexget/plugins/metainfo_series.py | import logging
from flexget.plugin import *
from flexget.utils.titles import SeriesParser
import re
log = logging.getLogger('metanfo_series')
class MetainfoSeries(object):
"""
Check if entry appears to be a series, and populate series info if so.
"""
def validator(self):
from flexget imp... | import logging
from flexget.plugin import *
from flexget.utils.titles import SeriesParser
import re
log = logging.getLogger('metanfo_series')
class MetainfoSeries(object):
"""
Check if entry appears to be a series, and populate series info if so.
"""
def validator(self):
from flexget imp... | mit | Python |
00cc43b3e7a848c17272928f6469beb128e278b4 | add linear_regression | yeatmanlab/BrainTools,yeatmanlab/BrainTools | projects/NLR_MEG/linear_regression.py | projects/NLR_MEG/linear_regression.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 12:08:31 2018
@author: sjjoo
"""
#%%
import numpy as np
from sklearn import linear_model as lm
import statsmodels.api as sm
import statsmodels.formula.api as smf
import pandas as pd
X = np.column_stack((temp_read,temp_raw, temp_age,temp_meg1, t... | bsd-3-clause | Python | |
f20aef828bb7e3a7206cd239ff95c3234391c11c | Add Example 5.1. | jcrist/pydy,skidzo/pydy,oliverlee/pydy,Shekharrajak/pydy,jcrist/pydy,jcrist/pydy,skidzo/pydy,jcrist/pydy,Shekharrajak/pydy,Shekharrajak/pydy,jcrist/pydy,jcrist/pydy,jcrist/pydy,oliverlee/pydy,skidzo/pydy,oliverlee/pydy,skidzo/pydy,Shekharrajak/pydy | Kane1985/Chapter5/Example5.1.py | Kane1985/Chapter5/Example5.1.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Example 5.1 from Kane 1985."""
from __future__ import division
from sympy import Dummy, Matrix
from sympy import expand, solve, symbols, trigsimp
from sympy.physics.mechanics import ReferenceFrame, Point, dot, dynamicsymbols
from util import msprint, subs, partial_veloc... | bsd-3-clause | Python | |
bc691d415d32836f8354582294c6ae11413b0a6a | change version to .dev | dsemi/Flexget,sean797/Flexget,drwyrm/Flexget,poulpito/Flexget,qk4l/Flexget,LynxyssCZ/Flexget,dsemi/Flexget,ianstalk/Flexget,jacobmetrick/Flexget,tarzasai/Flexget,dsemi/Flexget,drwyrm/Flexget,LynxyssCZ/Flexget,Flexget/Flexget,oxc/Flexget,Flexget/Flexget,ianstalk/Flexget,jacobmetrick/Flexget,jacobmetrick/Flexget,poulpito... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
9012cb2aa34d6df32e780555b74581b29cd309b8 | add forgotten new module | zoofIO/flexx,zoofIO/flexx,jrversteegh/flexx,JohnLunzer/flexx,JohnLunzer/flexx,jrversteegh/flexx,JohnLunzer/flexx,kevinlondon/flexx,kevinlondon/flexx | flexx/ui/_iframe.py | flexx/ui/_iframe.py | from .. import react
from . import Widget
class IFrame(Widget):
""" An iframe element, i.e. a container to show web-content. Note
that some websites do not allow themselves to be rendered in a
cross-source iframe.
"""
CSS = '.flx-iframe {border: none;}'
@react.input
def url(v=''... | bsd-2-clause | Python | |
76c7add3a57810d42e6584ddf22acc027f641a0a | Create classes.py | Xsmael/noogger,Xsmael/node-logger,Xsmael/node-logger | classes.py | classes.py | from tkinter import *
class myClass:
def hello(self):
self.label.config(text='HelloO!')
def __init__(self,master): # this function is always called when object is instantiated
frame=Frame(master)
frame.pack()
self.printBtn = Button(frame, text='click', command=self.hello)
... | mit | Python | |
2ccefe090305e815633f92a6f3d13155e46e7711 | Update migrations | teamtaverna/core | app/timetables/migrations/0002_auto_20171005_2209.py | app/timetables/migrations/0002_auto_20171005_2209.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-10-05 22:09
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timetables', '0001_initial'),
]
operations = [
... | mit | Python | |
7f2f0dca532ce3cbcf33720e56a639f78b82e771 | add console utility | vektorlab/multivac,bcicen/slackbot,vektorlab/multivac,bcicen/slackbot | multivac/console.py | multivac/console.py | import sys
from termcolor import colored
from multivac.version import version
from multivac.models import JobsDB
from multivac.util import format_time
class Console(object):
def __init__(self):
self.prompt = colored('multivac> ','cyan',attrs=['bold'])
self.db = JobsDB('localhost', 6379)
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.