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 |
|---|---|---|---|---|---|---|---|---|
c0f690fe1d43edc4fc5cc4b3aeb40594c1abd674 | Create pollard_rho_algorithm.py | IEEE-NITK/Daedalus,IEEE-NITK/Daedalus,chinmaydd/NITK_IEEE_SaS,IEEE-NITK/Daedalus | daedalus/attacks/pollard_rho_algorithm.py | daedalus/attacks/pollard_rho_algorithm.py | #pollard rho algorithm of integer factorization
def gcd(a,b):
if a is 0:
return b
return gcd(b%a,a)
def pollard_rho(number,x,y):
d = 1
while d is 1:
x = (x**2+1)%number
for i in range(0,2,1):
y = (y**2+1)%number
if x>y:
z = x-y
else:
... | mit | Python | |
c5dfcffdf743e2c26b8dba6e3be8aee7d7aaa608 | Test `write_*` and `join_*` on bytes | jwodder/linesep | test/test_join_bytes.py | test/test_join_bytes.py | import re
import linesep
try:
from StringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO
# Based on <https://pytest.org/latest/example/parametrize.html#a-quick-port-of-testscenarios>
def pytest_generate_tests(metafunc):
idlist = []
argvalues = []
for scenario in meta... | mit | Python | |
a30cd68e77242df4efadc75c4390dd8a3ce68612 | Add data migration for Audit's empty status | AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core | src/ggrc/migrations/versions/20170103101308_42b22b9ca859__fix_audit_empty_status.py | src/ggrc/migrations/versions/20170103101308_42b22b9ca859__fix_audit_empty_status.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Fix audit empty status
Create Date: 2016-12-22 13:53:24.497701
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
import sqlalchemy as sa... | apache-2.0 | Python | |
52eb461f1679f134aed25c221cfcc63abd8d3768 | add test | PyBossa/pybossa,geotagx/pybossa,Scifabric/pybossa,PyBossa/pybossa,Scifabric/pybossa,geotagx/pybossa | test/test_importers/test_youtube_importer.py | test/test_importers/test_youtube_importer.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2016 SciFabric LTD.
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | agpl-3.0 | Python | |
1e9a64fe6324d8b4ac96daafa7427e9f55e6dd38 | add Geom.decompose tests | chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d | tests/gobj/test_geom.py | tests/gobj/test_geom.py | from panda3d import core
empty_format = core.GeomVertexFormat.get_empty()
def test_geom_decompose_in_place():
vertex_data = core.GeomVertexData("", empty_format, core.GeomEnums.UH_static)
prim = core.GeomTristrips(core.GeomEnums.UH_static)
prim.add_vertex(0)
prim.add_vertex(1)
prim.add_vertex(2)
... | bsd-3-clause | Python | |
66b5a1089ed0ce2e615f889f35b5e39db91950ae | Fix serving uploaded files during development. | SoLoHiC/mezzanine,industrydive/mezzanine,jjz/mezzanine,Kniyl/mezzanine,stephenmcd/mezzanine,adrian-the-git/mezzanine,biomassives/mezzanine,emile2016/mezzanine,dekomote/mezzanine-modeltranslation-backport,Cicero-Zhao/mezzanine,nikolas/mezzanine,industrydive/mezzanine,fusionbox/mezzanine,saintbird/mezzanine,douglaskastle... | mezzanine/core/management/commands/runserver.py | mezzanine/core/management/commands/runserver.py |
import os
from django.conf import settings
from django.contrib.staticfiles.management.commands import runserver
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.views.static import serve
class MezzStaticFilesHandler(StaticFilesHandler):
def get_response(self, request):
res... |
import os
from django.conf import settings
from django.contrib.staticfiles.management.commands import runserver
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.http import Http404
from django.views.static import serve
class MezzStaticFilesHandler(StaticFilesHandler):
def get_resp... | bsd-2-clause | Python |
93a7f4cb914de537e477a6c6bd45e0aa28ce2e4f | update model fields | openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform | modelview/migrations/0053_auto_20200408_1442.py | modelview/migrations/0053_auto_20200408_1442.py | # Generated by Django 3.0 on 2020-04-08 12:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('modelview', '0052_auto_20200408_1308'),
]
operations = [
migrations.AddField(
model_name='energyframework',
name='data... | agpl-3.0 | Python | |
bc52778a5ed9ee44f40400cc2693f86318434527 | Add missing file | MiltosD/CEF-ELRC,zeehio/META-SHARE,zeehio/META-SHARE,MiltosD/CEFELRC,MiltosD/CEFELRC,MiltosD/CEF-ELRC,JuliBakagianni/META-SHARE,zeehio/META-SHARE,MiltosD/CEFELRC,JuliBakagianni/META-SHARE,zeehio/META-SHARE,JuliBakagianni/CEF-ELRC,MiltosD/CEFELRC,MiltosD/CEF-ELRC,zeehio/META-SHARE,JuliBakagianni/CEF-ELRC,zeehio/META-SHA... | metashare/repository/editor/lang.py | metashare/repository/editor/lang.py |
from xml.etree.ElementTree import XML
import os
import logging
from metashare.settings import LOG_LEVEL, LOG_HANDLER
import pycountry
# Setup logging support.
logging.basicConfig(level=LOG_LEVEL)
LOGGER = logging.getLogger('metashare.xml_utils')
LOGGER.addHandler(LOG_HANDLER)
def read_langs(filename):
if not os.... | bsd-3-clause | Python | |
e580995de78c3658951b119577a0f7c335352e13 | Create feature_class_info_to_csv.py | jamaps/arcpy_scripts | feature_class_info_to_csv.py | feature_class_info_to_csv.py | import arcpy
import os
import time
import csv
begin_time = time.clock()
arcpy.env.workspace = ws = r"\\192-86\DFSRoot\Data\allenj\Desktop\gdb\test.gdb"
mrcsv = r"\\192-86\DFSRoot\Data\allenj\Desktop\gdb\write.csv"
ls = [1,2,3]
writer = csv.writer(open(mrcsv, 'a'))
writer.writerow(["Feature","Feature_Count","Extent... | mit | Python | |
ae477223f296de9ee6b81a15d56d7140a5bf26ac | Create __init__.py | gauravssnl/PyPastebin-Symbian | requests/packages/urllib3/contrib/packages/ssl_match_hostname/__init__.py | requests/packages/urllib3/contrib/packages/ssl_match_hostname/__init__.py | apache-2.0 | Python | ||
2ef9fce02be94f8c4e9b5c52ca04a05cce1b5ede | Allow to start server as a module | LogicalDash/LiSE,LogicalDash/LiSE | LiSE/LiSE/server/__main__.py | LiSE/LiSE/server/__main__.py | import cherrypy
from argparse import ArgumentParser
from . import LiSEHandleWebService
parser = ArgumentParser()
parser.add_argument('world', action='store', required=True)
parser.add_argument('-c', '--code', action='store')
args = parser.parse_args()
conf = {
'/': {
'request.dispatch': cherrypy.dispatch.M... | agpl-3.0 | Python | |
a0124a990b4afe0cd5fd3971bae1e43f417bc1b2 | Add management command to find domains impacted by 502 bug | puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoft... | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | from django.core.management.base import BaseCommand
from corehq.apps.domain.models import Domain
import csv
class Command(BaseCommand):
help = 'Find domains with secure submissions and image questions'
def handle(self, *args, **options):
with open('domain_results.csv', 'wb+') as csvfile:
... | bsd-3-clause | Python | |
361a075efed0ca4a9877f7268b2e91725ef8be65 | Add encoder.py | danielbreves/auto_encoder | encoder.py | encoder.py | """
Source: https://trac.ffmpeg.org/wiki/Encode/H.264
"""
import os
import sys
import subprocess
FFMPEG_PATH = '/usr/local/bin/ffmpeg'
VIDEO_CODEC = 'h264'
VIDEO_ENCODER = 'h264_omx'
AUDIO_CODEC = 'aac'
AUDIO_ENCODER = 'aac'
BITRATE = '2500k'
SRC_DIR = os.path.expanduser('~/Desktop')
DEST_DIR = os.path.expanduser(... | mit | Python | |
00c7e9a020b60b9bfbc2c8c8e1b3e40869f9a73e | Add unit tests for agent membership | yamt/networking-midonet,yamt/networking-midonet | midonet/neutron/tests/unit/test_extension_agent_membership.py | midonet/neutron/tests/unit/test_extension_agent_membership.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2015 Midokura SARL.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.... | apache-2.0 | Python | |
3344c49bf36a4bd74fb9db079297b98a2e0ee46f | Implement cht.sh release script | chubin/cheat.sh,chubin/cheat.sh,chubin/cheat.sh,chubin/cheat.sh | bin/release.py | bin/release.py | #!/usr/bin/env python
from __future__ import print_function
from datetime import datetime
import os
from os import path
import re
import shutil
import subprocess
from subprocess import Popen
import sys
SHARE_DIR = path.join(path.dirname(__file__), "../share/")
def run(args):
return Popen(args, stdout=sys.stdou... | mit | Python | |
278cd37ada508701896c2669a215365785f5a261 | Add eval dispatch (copied from compyle) | nickdrozd/ecio-lisp,nickdrozd/ecio-lisp | evalExp.py | evalExp.py | from keywords import *
from reg import *
from parse import parse
def evalExp():
expr = parse(fetch(EXPR)) # make dedicated fetch_expr()?
# expr = transformMacros(expr)
evalFunc = getEvalFunc(expr)
# evalFunc()
# reassign next step
def getEvalFunc(expr):
if isVar(expr):
return compVar
if isNum(expr):
retur... | mit | Python | |
5de57ff00037d6f9a04307e60685f47f368cb29f | add example script to test calling the ffi | leethargo/scipcffi | example.py | example.py | import scipcffi.ffi as s
scip_ptr = s.ffi.new('SCIP**')
rc = s.lib.SCIPcreate(scip_ptr)
assert rc == s.lib.SCIP_OKAY
scip = scip_ptr[0]
| mit | Python | |
3a2a311c3c3f8a6bc2f027bfa247d912122e512e | Add test for gaussian | pfnet/chainer,ronekko/chainer,cemoody/chainer,wkentaro/chainer,chainer/chainer,aonotas/chainer,chainer/chainer,truongdq/chainer,keisuke-umezawa/chainer,ktnyt/chainer,laysakura/chainer,minhpqn/chainer,ktnyt/chainer,tscohen/chainer,okuta/chainer,chainer/chainer,t-abe/chainer,muupan/chainer,niboshi/chainer,ytoyama/yans_ch... | tests/functions_tests/test_gaussian.py | tests/functions_tests/test_gaussian.py | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import condition
if cuda.available:
cuda.init()
class TestGaussian(unittest.TestCase):
def setUp(self):
self.m = n... | mit | Python | |
945c2c620634c2c816aa446d91773adb75cb87e3 | Add airmass tool | joshwalawender/KeckUtilities | airmass.py | airmass.py | #!/usr/env/python
import argparse
import numpy as np
from astropy import units as u
##-------------------------------------------------------------------------
## Parse Command Line Arguments
##-------------------------------------------------------------------------
## create a parser object for understanding comman... | bsd-2-clause | Python | |
12f2198a53d474bb69a6b9118fca0638dcce8aac | add data migration | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0088_remove_community_participation_read_more_prompts.py | accelerator/migrations/0088_remove_community_participation_read_more_prompts.py | # Generated by Django 2.2.24 on 2022-03-07 12:10
import re
from django.db import migrations
def remove_community_participation_read_more_prompts(apps, schema_editor):
"""
Target read more prompts:
For more information, read about Judging at Mass Challenge.
Read more about Mentoring at Mass Challenge.... | mit | Python | |
b166cd8cc95ceb56f8d03cacb8903b0936e69210 | Create solution.py | lilsweetcaligula/Algorithms,lilsweetcaligula/Algorithms,lilsweetcaligula/Algorithms | data_structures/linked_list/problems/find_pattern_in_linked_list/py/solution.py | data_structures/linked_list/problems/find_pattern_in_linked_list/py/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 FindPatternInLinkedList(head: LinkedList.Node, pattern: LinkedList.Node) -> int:
if head == None or pattern == ... | mit | Python | |
9bffe981c018213b87d015a20603c092567bbdf4 | Initialize multiple class setup; add remaining APIs | kshvmdn/cobalt-uoft-python | cobaltuoft/cobalt.py | cobaltuoft/cobalt.py | from .endpoints import Endpoints
from .helpers import get, scrape_filters
class Cobalt:
def __init__(self, api_key=None):
self.host = 'http://cobalt.qas.im/api/1.0'
self.headers = {
'Referer': 'Cobalt-UofT-Python'
}
if not api_key or not self._is_valid_key(api_key):
... | mit | Python | |
54864841267c4d2cb53ce581c05d8ba9c15eef0c | Add lexer | balloon-lang/pygments-balloon | balloon.py | balloon.py | from pygments.lexer import *
from pygments.token import *
class CustomLexer(RegexLexer):
name = 'Balloon'
aliases = ['balloon']
filenames = '*.bl'
tokens = {
'root': [
include('keywords'),
(r'[]{}(),:;[]', Punctuation),
(r'#.*?$', Comment),
(r... | mpl-2.0 | Python | |
d0306518dcc395a051460115d7ef9488f26426cc | Add paper shortening tool: input text, output shorter text | smanilov/playground,smanilov/playground,smanilov/playground,smanilov/playground,smanilov/playground,smanilov/playground | shorten-pdf/shorten.py | shorten-pdf/shorten.py | #!/usr/bin/python
import sys
LONG_PARAGRAPH_THRESH = 400
LONG_START_LEN = 197
LONG_END_LEN = 197
if len(sys.argv) < 2:
print 'Give me a text file as an argument.'
sys.exit(0)
f = open(sys.argv[1]) # open file
t = f.read() # read text
ps = t.split('\n\n') # get paragraphs
ps_ = [] ... | mit | Python | |
0267ada9eed8c9759c4fe5ec5b4cd184bc2d5de1 | Create ode.py | imwiththou/PathwayNet | ode.py | ode.py | import sys
def rk4(func, x, y, step, xmax):
"""
Integrates y'=f(x,y) using 4th step-order Runge-Kutta.
@param func: a differential equation
@type func: list
@param x: initial value of x-axis, which is usually starting time
@type x: float
@param y: initial value for y-axis
@type y... | mit | Python | |
316a82c5465a13770404b6a302348f192618cd27 | Add an interface for eagerly evaluating command graph elements | soulchainer/qtile,zordsdavini/qtile,ramnes/qtile,qtile/qtile,tych0/qtile,soulchainer/qtile,qtile/qtile,zordsdavini/qtile,ramnes/qtile,tych0/qtile | libqtile/command_interface.py | libqtile/command_interface.py | # Copyright (c) 2019, Sean Vig. All rights reserved.
#
# 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, mer... | mit | Python | |
dff1f9176d7ce77a242263bfc9a0760cd31f0585 | Add a prototype for cached regex.compile() | Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector | regex_proxy.py | regex_proxy.py | from regex import *
from regex import compile as raw_compile
_cache = {}
# Wrap regex.compile up so we have a global cache
def compile(s, *args, **args):
global _cache
try:
return _cache[s]
except KeyError:
r = raw_compile(s, *args, **kwargs)
_cache[s] = r
return r
| apache-2.0 | Python | |
231e19ed29314bc0d9aad3cd1d69b757364fce7d | Create pms.py | BollMose/daynote | pms.py | pms.py | import serial
# we stop terminal with raspi-config,
# we stop bluethooth from /boot/config.txt first,
# and currently UART device is /dev/ttyAMAO,
# but we still cannot read data from device
# failure devices
#dev = "ttyS0"
# work devices
#dev = "ttyAMA0"
#dev = "serial0"
dev = "ttyUSB0"
ser = serial.Serial(port="/... | apache-2.0 | Python | |
dd1e3a665298a616d9b78f0c019288a9d6d883b8 | Add unit tests for the OfficeAdminExtraGeoLocation model | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite | labonneboite/tests/app/test_models.py | labonneboite/tests/app/test_models.py | # coding: utf8
import unittest
from labonneboite.common.models import OfficeAdminExtraGeoLocation
class OfficeAdminExtraGeoLocationTest(unittest.TestCase):
"""
Tests for the OfficeAdminExtraGeoLocation model.
"""
def test_codes_as_list(self):
codes = u" 57070\n\n\n\n\n\n 75010 \n 54 ... | agpl-3.0 | Python | |
7b1b343c552ee6f124ccceee05f1a6732657c9e1 | Add initial startup program (pox.py) | andiwundsam/_of_normalize,xAKLx/pox,MurphyMc/pox,denovogroup/pox,PrincetonUniversity/pox,PrincetonUniversity/pox,waltznetworks/pox,chenyuntc/pox,chenyuntc/pox,VamsikrishnaNallabothu/pox,pthien92/sdn,kpengboy/pox-exercise,MurphyMc/pox,waltznetworks/pox,PrincetonUniversity/pox,MurphyMc/pox,noxrepo/pox,carlye566/IoT-POX,d... | pox.py | pox.py | #!/usr/bin/python
from pox.core import core
import pox.openflow.openflow
import pox.topology.topology
import pox.openflow.of_01
import pox.dumb_l3_switch.dumb_l3_switch
# Set default log level
import logging
logging.basicConfig(level=logging.DEBUG)
# Turn on extra info for event exceptions
import pox.lib.revent.reve... | apache-2.0 | Python | |
35887b39b0151432423cca7832f1c9bc4ab7d836 | Create OutputNeuronGroup.py | ricardodeazambuja/BrianConnectUDP | examples/OutputNeuronGroup.py | examples/OutputNeuronGroup.py | '''
Example of a spike receptor (only receives spikes)
In this example spikes are received and processed creating a raster plot at the end of the simulation.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
# The main function with the NeuronGroup(s) and Synapse(s) must be na... | cc0-1.0 | Python | |
3834af9b3a6381ac7a2334c7bd2ae6d562e0f20b | Create HR_pythonIsLeap.py | bluewitch/Code-Blue-Python | HR_pythonIsLeap.py | HR_pythonIsLeap.py | def is_leap(year):
leap = False
# Write your logic here
# thought process
#if year%4==0:
# return True
#elif year%100==0:
# return False
#elif year%400==0:
# return True
# Optimized, Python 3
return ((year%4==0)and(year%100!=0)or(year%400==0))
| mit | Python | |
b5cc6ead2e17ef54612b3072c7991166955bee77 | Add user commands | Vultour/dropbox-static-cli | dropbox-cli.py | dropbox-cli.py | #!/usr/bin/env python
import os
import logging
import dropbox
import argparse
APP_NAME = "dropbox-static-cli"
DEFAULT_KEY_PATH = "{}/.dropbox-static-cli-key".format(os.environ["HOME"])
L = None
def parse_arguments():
parser = argparse.ArgumentParser(
prog="dropbox-static-cli",
... | apache-2.0 | Python | |
d160d73740c73e2cab8325179e7f0a9ee4ae8c50 | add disk_usage.py example script | mindw/psutil,mrjefftang/psutil,mindw/psutil,tomprince/psutil,msarahan/psutil,giampaolo/psutil,landryb/psutil,qbit/psutil,cloudbase/psutil,tomprince/psutil,Q-Leap-Networks/psutil,msarahan/psutil,tomprince/psutil,packages/psutil,mindw/psutil,Q-Leap-Networks/psutil,landryb/psutil,landryb/psutil,0-wiz-0/psutil,jorik041/psu... | examples/disk_usage.py | examples/disk_usage.py | #!/usr/bin/env python
"""
List all mounted disk partitions a-la "df" command.
"""
import sys
import psutil
def convert_bytes(n):
if n == 0:
return "0B"
symbols = ('k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
prefix = {}
for i, s in enumerate(symbols):
prefix[s] = 1 << (i+1)*10
for s in... | bsd-3-clause | Python | |
7475b73072f0037fc53bcae59e331c4d5a997e86 | Add auto-fill test cases | verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool | depot/tests/test_checkout.py | depot/tests/test_checkout.py | from django.contrib.auth.models import User
from depot.models import Depot, Organization
from verleihtool.test import ClientTestCase
class AutoFillTestCase(ClientTestCase):
"""
Test cases asserting the auto-fill functionality for checkout-form
:author: Stefan Su
"""
def setUp(self):
super... | agpl-3.0 | Python | |
0caa9035e06e6596a295ed2ed0a6238a2b09f353 | add PCA and TSNE representation | Totoketchup/das,Totoketchup/das | utils/postprocessing/representation.py | utils/postprocessing/representation.py | import numpy as np
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
def PCA_representation(data, n_components):
pca = PCA(n_components=n_components)
return pca.fit_transform(data)
def TSNE_representation(data, n_components):
model = TSNE(n_components=n_compone... | mit | Python | |
3ee47b0adbc379d77f01df51927399ecf3fb24e6 | Add docstring and comment. | lmjohns3/theanets,devdoer/theanets,chrinide/theanets | examples/mnist-autoencoder.py | examples/mnist-autoencoder.py | #!/usr/bin/env python
'''Single-layer autoencoder example using MNIST digit data.
This example shows one way to train a single-layer autoencoder model using the
handwritten MNIST digits.
This example also shows the use of climate command-line arguments.
'''
import climate
import matplotlib.pyplot as plt
import thea... | #!/usr/bin/env python
import climate
import matplotlib.pyplot as plt
import theanets
from utils import load_mnist, plot_layers, plot_images
g = climate.add_group('MNIST Example')
g.add_argument('--features', type=int, default=8, metavar='N',
help='train a model using N^2 hidden-layer features')
def ... | mit | Python |
09112412a4814e3727def2547765546bf44c1e7d | Test joint refinement of 300 cspad images using Brewster 2018 methods. | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | test/algorithms/refinement/test_cspad_refinement.py | test/algorithms/refinement/test_cspad_refinement.py | # Test multiple stills refinement.
from __future__ import absolute_import, division, print_function
import os
from dxtbx.model.experiment_list import ExperimentListFactory
import procrunner
def test1(dials_regression, run_in_tmpdir):
"""
Refinement test of 300 CSPAD images, testing auto_reduction, parameter
f... | bsd-3-clause | Python | |
6bac7268df94d73555c0b594c89b4d5ed0bf53ed | Create NN.py | ghost9023/DeepLearningPythonStudy | DeepLearning/DeepLearning/04_Deep_LeeWJ/NN.py | DeepLearning/DeepLearning/04_Deep_LeeWJ/NN.py | """
mnist데이터 셋은 파일이 크기에, 첫 실행에서 다운 받은 후,
pickle로 로드하여 객체를 보원하는 식으로 속도를 줄일 수 있다.
"""
import sys, os
import numpy as np
from mnist import load_mnist
import pickle
sys.path.append(os.pardir) #부모 디렉터리의 파일을 가져올 수 있도록 설정한다.
#load_mnist 메소드의 3가지 매개변수
#1. flatten --> 입려기미지의 생성 배열 설정 false = 13차원배열, true = 1차원 배열
#1차원 배열저장한 데... | mit | Python | |
99b0aeb3257b8125a30340c06cc1bf834e914461 | add bar_contact.py that was missing | bremond/siconos,siconos/siconos,radarsat1/siconos,bremond/siconos,fperignon/siconos,bremond/siconos,radarsat1/siconos,siconos/siconos,radarsat1/siconos,bremond/siconos,bremond/siconos,siconos/siconos,fperignon/siconos,fperignon/siconos,fperignon/siconos,siconos/siconos,radarsat1/siconos,radarsat1/siconos,fperignon/sico... | examples/Mechanics/ContactDetection/BulletIO/bar_contact.py | examples/Mechanics/ContactDetection/BulletIO/bar_contact.py | import os,sys
import numpy
import math
import pickle
import random
from siconos.mechanics.contact_detection.tools import Contactor
from siconos.io.mechanics_io import Hdf5
#sys.path.append('../..')
#from mechanics_io import Hdf5
import siconos.numerics as Numerics
import siconos.kernel as Kernel
# WARNING : in 3D by... | apache-2.0 | Python | |
fa521b4358a06d1667864a09cd7195d3a6db764d | Add lc206_reverse_linked_list.py | bowen0701/algorithms_data_structures | lc206_reverse_linked_list.py | lc206_reverse_linked_list.py | """206. Reverse Linked List
Easy
Reverse a singly linked list.
Example:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL
Follow up:
A linked list can be reversed either iteratively or recursively. Could you implement both?
"""
# Definition for singly-linked list.
class ListNode(object):
def __init__(self,... | bsd-2-clause | Python | |
2dd6049c1fa9340d14f4b73f843f7ed4408e84f5 | Prepare release script init | AnalogJ/lexicon,AnalogJ/lexicon | utils/create_release.py | utils/create_release.py | #!/usr/bin/env python3
import os
import datetime
import subprocess
from distutils.version import StrictVersion
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def main():
# git_clean = subprocess.check_output(
# "git status --porcelain", shell=True, universal_newlines=True,
... | mit | Python | |
2850713d0add5cb1ae084898bdd6929c0f5bfb3e | add simulated annealing stat script | OPU-Surveillance-System/monitoring,OPU-Surveillance-System/monitoring,OPU-Surveillance-System/monitoring | master/scripts/planner/solvers/hyperparameter_optimization/test_stat_sa.py | master/scripts/planner/solvers/hyperparameter_optimization/test_stat_sa.py | import GPy
import GPyOpt
import numpy as np
from sys import path
import pickle
import time
from tqdm import tqdm
path.append("..")
path.append("../..")
path.append("../../..")
from solver import SimulatedAnnealingSolver, RandomSolver
import map_converter as m
fs = open("../../../webserver/data/serialization/mapper.pi... | mit | Python | |
1d4693b6f5b6f8b3912aae1216665272a36b1411 | Add missing group.py | flexo/evolutron,flexo/evolutron | group.py | group.py | from pygame.sprite import Group as pygame_Group
class Group(pygame_Group):
def draw(self, onto, *args, **kw):
for sprite in self:
sprite.draw(*args, **kw)
super(Group, self).draw(onto)
| mit | Python | |
b680141b9ec5468a5a0890edf25045a6af8b46c2 | Add run.py | kkstu/DNStack,kkstu/DNStack,kkstu/DNStack | run.py | run.py | #!/usr/bin/python
# -*- coding:utf8 -*-
# Powered By KK Studio
from app.DNStack import DNStack
if __name__ == "__main__":
app = DNStack()
app.run()
| mit | Python | |
d3e786b554bfafeb4f0c16635b80f9911acc4bba | add stacked auto encoder file. | nel215/py-sae | sae.py | sae.py | #coding: utf-8
import requests
import random, numpy
from aa import AutoEncoder
class StackedAutoEncoder:
def __init__(self, visible, hiddens):
# TODO: fine-tuning layer
num_of_nodes= [visible] + hiddens
self.auto_encoders = []
for i in xrange(len(num_of_nodes)-1):
self.... | mit | Python | |
13486556a15cdb2dbfe3f390f973942d93338995 | Create TryRecord.py | Larz60p/Python-Record-Structure | TryRecord.py | TryRecord.py | """
Example usage of Record class
The MIT License (MIT)
Copyright (c) <2016> <Larry McCaig (aka: Larz60+ aka: Larz60p)>
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, inclu... | mit | Python | |
8d94bbc272b0b39ea3a561671faf696a4851c1a1 | Create app.py | Fillll/reddit2telegram,Fillll/reddit2telegram | reddit2telegram/channels/MoreTankieChapo/app.py | reddit2telegram/channels/MoreTankieChapo/app.py | #encoding:utf-8
subreddit = 'MoreTankieChapo'
t_channel = '@MoreTankieChapo'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| mit | Python | |
e5ae14b4438fc7ae15156615206453097b8f759b | add wave test | mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets | Python/WaveTest.py | Python/WaveTest.py | import requests
def text2code(text):
'''
convert a string to wave code
'''
ret = None
get_wave_params = {'type' : 'text', 'content' : text}
response = requests.post('http://rest.sinaapp.com/api/post', data=get_wave_params)
if response.status_code == 200:
try:
data = resp... | mit | Python | |
561f595337106c60c55212dd87d90ed3002de07f | disable pretty json (reduces size by 30%) | waiyin21/test123,Mickey32111/pogom,dalim/pogom,favll/pogom,PokeHunterProject/pogom-linux,DenL/pogom-webhook,Mickey32111/pogom,Mickey32111/pogom,waiyin21/test123,DenL/pogom-webhook,favll/pogom,CaptorOfSin/pogom,falau/pogom,dalim/pogom,DenL/pogom-webhook,falau/pogom,dalim/pogom,CaptorOfSin/pogom,falau/pogom,PokeHunterPro... | runserver.py | runserver.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from threading import Thread
from pogom import config
from pogom.app import Pogom
from pogom.search import search_loop, set_cover, set_location
from pogom.utils import get_args, insert_mock_data
from pogom.models import create_tables, SearchConfig
from pogom.p... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from threading import Thread
from pogom import config
from pogom.app import Pogom
from pogom.search import search_loop, set_cover, set_location
from pogom.utils import get_args, insert_mock_data
from pogom.models import create_tables, SearchConfig
from pogom.p... | mit | Python |
fb1498abaca07e3594d2f24edc1596fb03225dea | Add new package: dnsmasq (#16253) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/dnsmasq/package.py | var/spack/repos/builtin/packages/dnsmasq/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 Dnsmasq(MakefilePackage):
"""A lightweight, caching DNS proxy with integrated DHCP server.... | lgpl-2.1 | Python | |
7b71bbd87234c8cbe8c7fa189c0617b4ca191989 | Add tweak_billing_log command | PressLabs/silver,PressLabs/silver,PressLabs/silver | silver/management/commands/tweak_billing_log.py | silver/management/commands/tweak_billing_log.py | import datetime as dt
from datetime import datetime
from optparse import make_option
from django.core.management.base import BaseCommand
from django.utils import timezone
from silver.models import Subscription, BillingLog
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option(... | apache-2.0 | Python | |
1b023e8471dad22bfb6b8de0d30c0796c30e2a40 | Copy hello.py from add_snippet branch | hnakamur/cygroonga | hello.py | hello.py | import cygroonga as grn
import datetime
with grn.Groonga():
with grn.Context() as ctx:
db = ctx.open_or_create_database("test.db")
table1 = ctx.open_or_create_table("table1",
grn.OBJ_TABLE_HASH_KEY | grn.OBJ_PERSISTENT,
ctx.at(grn.DB_SHORT_TEXT))
print("table... | apache-2.0 | Python | |
53b6b1f4b7f58b1a7d748f67e220bd4da147df0e | Create hello.py | BobbyJacobs/cs3240-demo | hello.py | hello.py | def main():
print("Hello!")
| mit | Python | |
708fe9f6765717e1f1dabce1f9ac9ed56a7cc769 | Add a new pacakage: HiC-Pro. (#7858) | matthiasdiener/spack,tmerrick1/spack,krafczyk/spack,matthiasdiener/spack,krafczyk/spack,matthiasdiener/spack,LLNL/spack,EmreAtes/spack,tmerrick1/spack,mfherbst/spack,iulian787/spack,iulian787/spack,EmreAtes/spack,LLNL/spack,iulian787/spack,EmreAtes/spack,mfherbst/spack,tmerrick1/spack,mfherbst/spack,mfherbst/spack,tmer... | var/spack/repos/builtin/packages/hic-pro/package.py | var/spack/repos/builtin/packages/hic-pro/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
033032260a43a416857b7057bd4fc212422abc51 | Add a simple command line skew-T plotter | julienchastang/unidata-python-workshop,julienchastang/unidata-python-workshop,Unidata/unidata-python-workshop | notebooks/Command_Line_Tools/skewt.py | notebooks/Command_Line_Tools/skewt.py | # skewt.py - A simple Skew-T plotting tool
import argparse
from datetime import datetime
import matplotlib.pyplot as plt
import metpy.calc as mpcalc
from metpy.io.upperair import get_upper_air_data
from metpy.plots import Hodograph, SkewT
from metpy.units import units
from mpl_toolkits.axes_grid1.inset_locator import... | mit | Python | |
724e86e31b6584012af5afe458e0823b9a2ca7ab | Create a class named "CreateSpark", which is to solove the problem of "Cannot run multiple SparkContexts at once; existing SparkContext(app=spam-msg-classifier, master=local[8]) created by __init__" | ysh329/spam-msg-classifier | myclass/class_create_spark.py | myclass/class_create_spark.py | # -*- coding: utf-8 -*-
# !/usr/bin/python
################################### PART0 DESCRIPTION #################################
# Filename: class_save_word_to_database.py
# Description:
#
# Author: Shuai Yuan
# E-mail: ysh329@sina.com
# Create: 2015-11-17 20:43:09
# Last:
__author__ = 'yuens'
####################... | apache-2.0 | Python | |
2bd453c4a7402f24cd43b49e73d0b95e371e6654 | add package Feature/sentieon (#9557) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/sentieon-genomics/package.py | var/spack/repos/builtin/packages/sentieon-genomics/package.py | # Copyright 2013-2018 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)
import os.path
from spack import *
class SentieonGenomics(Package):
"""Sentieon provides complete solutions for seco... | lgpl-2.1 | Python | |
8c1cd72d11836ad913af5c3614137358ddf3efee | add mgmt cmd to set related user | greglinch/sourcelist,greglinch/sourcelist | sources/management/commands/set_related_user.py | sources/management/commands/set_related_user.py | from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mail
from django.contrib.auth.models import User
# from sources.models import Person
import random
def set_related_user(email_address, person_id):
obj = Person.objects.get(id=person_id)
try:
user_existi... | mit | Python | |
208077afd9b1ba741df6bccafdd5f008e7b75e38 | Add nftables test | YinThong/intel-iot-refkit,YinThong/intel-iot-refkit,ipuustin/intel-iot-refkit,mythi/intel-iot-refkit,klihub/intel-iot-refkit,mythi/intel-iot-refkit,intel/intel-iot-refkit,jairglez/intel-iot-refkit,YinThong/intel-iot-refkit,ipuustin/intel-iot-refkit,intel/intel-iot-refkit,klihub/intel-iot-refkit,YinThong/intel-iot-refki... | meta-iotqa/lib/oeqa/runtime/sanity/nftables.py | meta-iotqa/lib/oeqa/runtime/sanity/nftables.py | import os
import subprocess
from time import sleep
from oeqa.oetest import oeRuntimeTest
class NftablesTest(oeRuntimeTest):
def check_ssh_connection(self):
'''Check SSH connection to DUT port 2222'''
process = subprocess.Popen(("ssh -o UserKnownHostsFile=/dev/null " \
... | mit | Python | |
3be145af359df5bcf928da1b984af8635ea33c27 | add model for parcels, temp until i figure out psql migrations in flask | codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator | farmsList/farmsList/public/models.py | farmsList/farmsList/public/models.py | # -*- coding: utf-8 -*-
from farmsList.database import (
Column,
db,
Model,
ReferenceCol,
relationship,
SurrogatePK,
)
class Parcel(SurrogatePK, Model):
__tablename__ = 'parcels'
name = Column(db.String(80), unique=True, nullable=False)
def __init__(self, name, **kwargs):
... | bsd-3-clause | Python | |
a5d63ec0f8f192aaeae8b9a7f1cf423d18de25dc | Add test runner to handle issue with import path | ganemone/ontheside,ganemone/ontheside,ganemone/ontheside | server/test.py | server/test.py | import pytest
pytest.main('-x tests/')
| mit | Python | |
8632b60718fa353797ffc53281e57a37caf9452f | Add config command for setting the address of rf sensors. | geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net | set_address.py | set_address.py | import zmq
import time
import sys
print sys.argv[1:]
# ZeroMQ Context
context = zmq.Context()
sock_live = context.socket(zmq.PUB)
sock_live.connect("tcp://"+sys.argv[1])
time.sleep(1)
# Send multipart only allows send byte arrays, so we convert everything to strings before sending
# [TODO] add .encode('UTF-8') when ... | bsd-3-clause | Python | |
f5f6bc0999d5b6f065adb81982ce3a322e1ab987 | add regression test for fit_spectrum() Python 3.x issue | jjhelmus/nmrglue,kaustubhmote/nmrglue,jjhelmus/nmrglue,kaustubhmote/nmrglue | nmrglue/analysis/tests/test_analysis_linesh.py | nmrglue/analysis/tests/test_analysis_linesh.py | import numpy as np
import nmrglue as ng
from nmrglue.analysis.linesh import fit_spectrum
def test_fit_spectrum():
_bb = np.random.uniform(0, 77, size=65536)
lineshapes = ['g']
params = [[(13797.0, 2.2495075273313034)],
[(38979.0, 5.8705185693227664)],
[(39066.0, 5.71259542961... | bsd-3-clause | Python | |
c5a2167a63516c23390263408fcd2c9a4f654fc8 | Add tests for the parse method of the spider | J-CPelletier/webcomix,J-CPelletier/webcomix,J-CPelletier/WebComicToCBZ | webcomix/tests/test_comic_spider.py | webcomix/tests/test_comic_spider.py | from webcomix.comic_spider import ComicSpider
def test_parse_yields_good_page(mocker):
mock_response = mocker.patch('scrapy.http.Response')
mock_response.urljoin.return_value = "http://xkcd.com/3/"
mock_response.url = "http://xkcd.com/2/"
mock_selector = mocker.patch('scrapy.selector.SelectorList')
... | mit | Python | |
fd5da951feee92c055853c63b698b44397ead6be | Add save function for use across the application | brayoh/bucket-list-api | app/db_instance.py | app/db_instance.py | from app import db
def save(data):
try:
print(data)
db.session.add(data)
db.session.commit()
except Exception as e:
raise e
| mit | Python | |
585fec12673ab0207f5b641a9ba0df4a510667ac | Add harvester for mblwhoilibrary | erinspace/scrapi,felliott/scrapi,mehanig/scrapi,jeffreyliu3230/scrapi,felliott/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,alexgarciac/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,fabianvf/scrapi | scrapi/harvesters/mblwhoilibrary.py | scrapi/harvesters/mblwhoilibrary.py | '''
Harvester for the WHOAS at MBLWHOI Library for the SHARE project
Example API call: http://darchive.mblwhoilibrary.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import helpers
from scrapi.base import OAIHarvester
class MblwhoilibraryHarvester(... | apache-2.0 | Python | |
f5cc9c86b1cfbb2cda1b4c1c4c8656a6ca7a2a7f | Create graphingWIP.py | InvisibleTree/highAltBalloon | src/graphingWIP.py | src/graphingWIP.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import matplotlib.dates as md
import dateutil
# create empty dynamic arrays
temp_x = []
x = []
y = []
f = open("temp.log", "r") # open log folder
for line in f: # load x and y values
temp_line = line.split('=')
temp_x.append(temp_line[0][:-1]) # trim spaces
... | mit | Python | |
534fcff9f812df4cef273ca7853df12647b25d06 | Add preliminary metrics file and import some from sklearn | mwojcikowski/opendrugdiscovery | metrics.py | metrics.py | from sklern.metrics import roc_curve as roc, roc_auc_score as auc
def enrichment_factor():
pass
def log_auc():
pass
| bsd-3-clause | Python | |
3c45de2506d6fd86ad96ee9f2e1b5b773aad82d9 | split out common functionality | ArrantSquid/squiddly-dotfiles,johnpneumann/dotfiles | fabfile/common.py | fabfile/common.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Common pieces that work on all Nix OS'
.. module:: common
:platform: Linux, MacOS
.. moduleauthor:: John P. Neumann
.. note::
None
"""
# Built In
import os
import sys
# Third Party
from fabric.api import local, cd, task, execute
# Custom
@task
def setup_de... | mit | Python | |
40e9825ee0a2ccf7c3e92d4fd6599c1976a240a3 | Add deprecated public `graphql` module | carpedm20/fbchat | fbchat/graphql.py | fbchat/graphql.py | # -*- coding: UTF-8 -*-
"""This file is here to maintain backwards compatability."""
from __future__ import unicode_literals
from .models import *
from .utils import *
from ._graphql import (
FLAGS,
WHITESPACE,
ConcatJSONDecoder,
graphql_color_to_enum,
get_customization_info,
graphql_to_sticker... | bsd-3-clause | Python | |
f98aa5f336cd81ad55bc46122821df3ad314a4cb | Add py-dockerpy-creds (#19198) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-dockerpy-creds/package.py | var/spack/repos/builtin/packages/py-dockerpy-creds/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 PyDockerpyCreds(PythonPackage):
"""Python bindings for the docker credentials store API ""... | lgpl-2.1 | Python | |
07a1612250a9c3b2de1ffe53fb916a8cff153c3f | add count of collisions | hchiam/cognateLanguage | findCollisions.py | findCollisions.py | from collections import Counter
def countCollisions(entries):
collisions = [k for k,v in Counter(entries).items() if v>1]
num_collisions = len(collisions)
print(num_collisions,'word collisions:\n',collisions)
return num_collisions
def countCollisionsInFile(filename):
entries = []
with open(fil... | mit | Python | |
4a0fa1028f22944f30e39c65806f0d123e18420f | Create input.py | aniketyevankar/Twitter-Sentiment-Analysis | input.py | input.py | ckey=""
csecret=""
atoken=""
asecret=""
query='' #Add keyword for which you want to start the miner
| mit | Python | |
98499f07c6dcccba3605e9ab9c8eaef9463b0634 | Add some validators | johnbachman/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,sorgerlab/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,sorgerlab/indra,bgyori/indra,bgyori/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,johnbachman/indra | indra/tools/stmt_validator.py | indra/tools/stmt_validator.py | class StatementValidator:
def __init__(self):
class DbRefsEntryValidator:
@staticmethod
def validate(entry):
raise NotImplementedError()
class ChebiPrefix(DbRefsEntryValidator):
@staticmethod
def validate(entry):
return not entry or entry.startswith('CHEBI')
class UniProtIDNot... | bsd-2-clause | Python | |
ba1f04337d0653d4808427b5d07ed8673526b315 | add mygpo.wsgi | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo.wsgi | mygpo.wsgi | #!/usr/bin/python
# -*- coding: utf-8 -*-
# my.gpodder.org FastCGI handler for lighttpd (default setup)
#
# This file is part of my.gpodder.org.
#
# my.gpodder.org is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Fo... | agpl-3.0 | Python | |
1086259090a396b2a2ed40788d1cb8c8ff7c95f3 | fix the fixme | fingeronthebutton/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,robotframework/RIDE,caio2k/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE | src/robotide/plugins/connector.py | src/robotide/plugins/connector.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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 applicab... | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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 applicab... | apache-2.0 | Python |
0d22f1ab7f4c83af280edb799f863fa0f46ea326 | Create generic views for index/login | MarkGalloway/RIS,MarkGalloway/RIS | app/views.py | app/views.py | from flask import render_template, flash, redirect
from app import app
from .forms.login import LoginForm
@app.route('/')
@app.route('/index')
def index():
user = {'nickname': 'Mark'} # fake user
return render_template("index.html",
title='Home',
user=use... | apache-2.0 | Python | |
45939892a21bbf11ddcd1400d26cf2e94fa8ebac | add nox tests. | abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core | noxfile.py | noxfile.py | import nox
PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
PACKAGE = "abilian"
@nox.session(python="python3.6")
def lint(session):
# session.env["LC_ALL"] = "en_US.UTF-8"
session.install("poetry", "psycopg2-binary")
session.run("poetry", "install", "-q")
session.run("yarn", external="True")
session.run("... | lgpl-2.1 | Python | |
5addf2c2992cfdedf06da58861dae93347e02fb9 | Support for nox test runner (alternative to tox), provides a workaround for #80. | heuer/segno | noxfile.py | noxfile.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2020 -- Lars Heuer
# All rights reserved.
#
# License: BSD License
#
"""\
Nox test runner configuration.
"""
import os
from functools import partial
import shutil
import nox
@nox.session(python="3")
def docs(session):
"""\
Build the documentation.
"""
s... | bsd-3-clause | Python | |
510b90d42dbccd0aa1e3ff48ee8dbe7230b65185 | Add script to compute some stats about data from energy consumption measures | SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper | get_stats_from.py | get_stats_from.py | import argparse
import csv
from glob import glob
import re
import statistics
import sys
def get_stats_from(files_names, files_content):
for i in range(len(files_content)):
file_name = files_names[i]
file_content = files_content[i]
print("FILE : {0}".format(files_names[i]))
print("\t... | agpl-3.0 | Python | |
32dcc681a82ef2246d0fad441481d6e68f79ddd6 | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/ln/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/ln/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark ln."""
from __future__ import print_function
import timeit
NAME = "ln"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
... | apache-2.0 | Python | |
20b450c4cd0ff9c57d894fa263056ff4cd2dbf07 | Add a vim version of merge business hours | ealter/vim_turing_machine,ealter/vim_turing_machine | vim_turing_machine/machines/merge_business_hours/vim_merge_business_hours.py | vim_turing_machine/machines/merge_business_hours/vim_merge_business_hours.py | from vim_turing_machine.machines.merge_business_hours.merge_business_hours import merge_business_hours_transitions
from vim_turing_machine.vim_machine import VimTuringMachine
if __name__ == '__main__':
merge_business_hours = VimTuringMachine(merge_business_hours_transitions(), debug=True)
merge_business_hours... | mit | Python | |
9ac5bfb17346f364414f17e3e16ba15ab812f5a0 | tidy up | lsaffre/timtools | src/lino/tools/mail.py | src/lino/tools/mail.py | ## Copyright Luc Saffre 2003-2004.
## This file is part of the Lino project.
## Lino is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later... | bsd-2-clause | Python | |
137a7c6e98e0ba8bd916d4ba696b0f0f4e2cdc56 | Create uptime.py | mc3k/graph-stats,mc3k/graph-stats | plot-uptime/uptime.py | plot-uptime/uptime.py | mit | Python | ||
e90c48ba46d7971386e01b3def9edbb2df5d74e8 | Create mummy.py | airtonix/django-mummy-command | management/commands/mummy.py | management/commands/mummy.py | """
1. Install model-mommy
`pip install model-mommy`
2. Use the command
`./manage mummy someotherapp.HilariousModelName:9000 yetanotherapp.OmgTheseModelNamesLawl:1`
"""
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from model_mommy import mommy
class ... | mit | Python | |
3b7de4dbe3611863620cb528092779d25efde025 | remove dj 3.2 warnings | Christophe31/django-data-exports,Christophe31/django-data-exports | data_exports/apps.py | data_exports/apps.py | #!/usr/bin/env python
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class CsvExportConfig(AppConfig):
name = 'data_exports'
default_auto_field = "django.db.models.AutoField"
| bsd-3-clause | Python | |
85c732e395e3db4ec63a0d8580d895363d82e4a0 | Add the salt.output module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/output.py | salt/output.py | """
A simple way of setting the output format for data from modules
"""
import pprint
# Conditionally import the json and yaml modules
try:
import json
JSON = True
except ImportError:
JSON = False
try:
import yaml
YAML = True
except ImportError:
YAML = False
__all__ = ('get_outputter',)
class... | apache-2.0 | Python | |
380acd0e40ad2924f1434d4ae7f7e0a8a163139f | add script for building the cluster catalog | legacysurvey/legacypipe,legacysurvey/legacypipe | bin/build-cluster-catalog.py | bin/build-cluster-catalog.py | #!/usr/bin/env python
"""Build and write out the NGC-star-clusters.fits catalog.
"""
import os
import numpy as np
import numpy.ma as ma
from astropy.io import ascii
from astropy.table import Table
from astrometry.util.starutil_numpy import hmsstring2ra, dmsstring2dec
from astrometry.libkd.spherematch import match_rad... | bsd-3-clause | Python | |
9b0c335fc956c2d2156d169e3636d862ebfbadc0 | add a scraping script | showa-yojyo/bin,showa-yojyo/bin | hadairopink.py | hadairopink.py | #!/usr/bin/env python
"""
No description.
"""
import sys
from scrapy import cmdline, Request
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
TARGET_DOMAIN = 'hadairopink.com'
XPATH_IMAGE_SRC = '//div[@class="kizi"]//a/img[contains(@src, "/wp-content/uploads/")]/@src'
XPA... | mit | Python | |
285cddc3ed75f70e077738a206c50a57671245ea | add hello world script by pyThon | m60dx/raspiweb | hello_flask.py | hello_flask.py | # -*- coding: utf-8 -*-
from flask import Flask
app = flask(__name__)
@app.route('/')
def hello_flask():
return 'Hello Flask!'
if __name__ == '__main__':
app.run() | mit | Python | |
7478a6605b4d722e2eec9031457fb33ee99857f5 | add geo tools from dingo | openego/eDisGo,openego/eDisGo | edisgo/tools/geo.py | edisgo/tools/geo.py | from geopy.distance import vincenty
import os
if not 'READTHEDOCS' in os.environ:
from shapely.geometry import LineString
from shapely.ops import transform
import logging
logger = logging.getLogger('edisgo')
def calc_geo_branches_in_polygon(mv_grid, polygon, mode, proj):
# TODO: DOCSTRING
branches ... | agpl-3.0 | Python | |
27ea547fbd7c936bd017b64b31ecf09ed991c6c0 | Add index to fixed_ips.address | Juniper/nova,thomasem/nova,varunarya10/nova_test_latest,phenoxim/nova,sridevikoushik31/openstack,maheshp/novatest,mahak/nova,CEG-FYP-OpenStack/scheduler,Brocade-OpenSource/OpenStack-DNRM-Nova,redhat-openstack/nova,eharney/nova,saleemjaveds/https-github.com-openstack-nova,yrobla/nova,gspilio/nova,yrobla/nova,usc-isi/nov... | nova/db/sqlalchemy/migrate_repo/versions/085_add_index_to_fixed_ips_by_address.py | nova/db/sqlalchemy/migrate_repo/versions/085_add_index_to_fixed_ips_by_address.py | # Copyright 2012 IBM
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | apache-2.0 | Python | |
65258cf8d11e8e5c7cce3e07d9a389e5617948dd | Add boilerplate code | Tigge/advent-of-code-2016 | aoc.py | aoc.py | import argparse
import importlib
import sys
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Advent of Code 2016")
parser.add_argument("--day", type=int, dest="days", nargs="+", default=range(1, 25))
parser.add_argument("--stdin", dest='stdin', action='store_true', default=False)
... | mit | Python | |
6db7902e5f78d28b9a00eb801c12d15c91949453 | Add gruneisen script for making figure | atztogo/phonondb,atztogo/phonondb,atztogo/phonondb | phonondb/phonopy/gruneisen.py | phonondb/phonopy/gruneisen.py | import numpy as np
from cogue.crystal.utility import klength2mesh
class ModeGruneisen:
def __init__(self,
phonon_orig,
phonon_plus,
phonon_minus,
distance=100):
self._phonopy_gruneisen = phonopy_gruneisen
self._phonon = phonon
... | bsd-3-clause | Python | |
813eb3b6bdc01906e39f11f93b4a326fc2fb1ee5 | Add kitchen-sink base test | lantiga/pytorch2c,lantiga/pytorch2c,lantiga/pytorch2c | test/base.py | test/base.py | import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import os
import uuid
import torch2c
def base_test():
fc1 = nn.Linear(10,20)
fc1.weight.data.normal_(0.0,1.0)
fc1.bias.data.normal_(0.0,1.0)
fc2 = nn.Linear(20,2)
fc2.weight.data.normal_(0.0,1... | mit | Python | |
407f7fcf8f481c57df59789b7f845928428f1bf9 | Add example script. | killarny/telegram-bot | telegrambot/example.py | telegrambot/example.py | from telegrambot import TelegramBot, main
from telegrambot.commands import GetCommand
class DemoTelegramBot(TelegramBot, GetCommand):
pass
if __name__ == '__main__':
main(bot_class=DemoTelegramBot) | mit | Python | |
9fdd671d9c0b91dc789ebf3b24226edb3e6a072a | Add new migration to load metrics fixtures | sleepers-anonymous/zscore,sleepers-anonymous/zscore,sleepers-anonymous/zscore,sleepers-anonymous/zscore | sleep/migrations/0002_load_metrics.py | sleep/migrations/0002_load_metrics.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.core.management import call_command
def load_metrics():
call_command('loaddata', 'metrics.json')
class Migration(migrations.Migration):
dependencies = [
('sleep', '0001_initial'),
... | mit | Python | |
7ecc619104177c72b69337a35c7604491f2b06ec | Create amman.py | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ideascube/conf/amman.py | ideascube/conf/amman.py | # -*- coding: utf-8 -*-
"""Amman box in Jordan"""
from .base import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"مخيم الأزرق"
COUNTRIES_FIRST = ['SY', 'JO']
TIME_ZONE = 'Asia/Amman'
LANGUAGE_CODE = 'ar'
MONITORING_ENTRY_EXPORT_FIELDS = ['serial', 'refugee_id', 'birth_year',
... | agpl-3.0 | Python | |
ef4d7e4fb43b5db29576f95625fd612c259731be | Create ServoSync.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/Mats/ServoSync.py | home/Mats/ServoSync.py | port = "COM99"
arduino = Runtime.start("arduino","Arduino")
vard = Runtime.start("va","VirtualArduino")
vard.connect(port)
arduino.connect(port)
servo1 = Runtime.start("servo1","Servo")
servo2 = Runtime.start("servo2","Servo")
servo1.attach("arduino",1)
servo2.attach("arduino",2)
servo1.sync(servo2)
| apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.