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 |
|---|---|---|---|---|---|---|---|---|
913610bafe6aa98f7b8c550ea2ee896b130310ec | Add VAE code | wiseodd/hipsternet,wiseodd/hipsternet | adhoc/vae.py | adhoc/vae.py | from tensorflow.examples.tutorials.mnist import input_data
from keras.layers import Input, Dense, Lambda
from keras.models import Model
from keras.objectives import binary_crossentropy
from keras.callbacks import LearningRateScheduler
import numpy as np
import matplotlib.pyplot as plt
import keras.backend as K
import ... | unlicense | Python | |
d3f556b6d7da2c67fc9dcc6b7d73a0d1b76d278c | Add tests for valid recipes | mandeep/conda-verify | tests/functional_tests/test_valid_recipes.py | tests/functional_tests/test_valid_recipes.py | import os
import pytest
from conda_verify import utils
from conda_verify.exceptions import RecipeError
from conda_verify.verify import Verify
@pytest.fixture
def recipe_dir():
return os.path.join(os.path.dirname(__file__), 'test-recipes')
@pytest.fixture
def verifier():
recipe_verifier = Verify()
retu... | bsd-3-clause | Python | |
40f4bc4602da9f66c08a6ee7dcdb3af71e891441 | Create Python1.py | computer19810/PythonNew | Python1.py | Python1.py | #!/usr/bin/env python
def main():
print('hello world')
print '------------'
main()
| apache-2.0 | Python | |
0209c363371b0f1a8b570deab4995e83a638222d | Write New Product tests | osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api | whats_fresh/whats_fresh_api/tests/views/entry/test_new_product.py | whats_fresh/whats_fresh_api/tests/views/entry/test_new_product.py | from django.test import TestCase
from django.core.urlresolvers import reverse
from whats_fresh_api.models import *
from django.contrib.gis.db import models
import json
class NewProductTestCase(TestCase):
"""
Test that the New Product page works as expected.
Things tested:
URLs reverse correctly
... | apache-2.0 | Python | |
1de7573b08274646d961e7a667ed48aff5ca2932 | return export path from Rule.do_build() | buildinspace/peru,oconnor663/peru,ierceg/peru,scalp42/peru,nivertech/peru,buildinspace/peru,oconnor663/peru,enzochiau/peru,scalp42/peru,olson-sean-k/peru,nivertech/peru,ierceg/peru,olson-sean-k/peru,enzochiau/peru | peru/rule.py | peru/rule.py | import os
import subprocess
from .cache import compute_key
from .error import PrintableError
class Rule:
def __init__(self, name, build_command, export):
self.name = name
self.build_command = build_command
self.export = export
def cache_key(self, resolver, input_tree):
return... | import os
import subprocess
from .cache import compute_key
from .error import PrintableError
class Rule:
def __init__(self, name, build_command, export):
self.name = name
self.build_command = build_command
self.export = export
def cache_key(self, resolver, input_tree):
return... | mit | Python |
729bed3fd3e7bd3ecabda3ab25525019f3f83661 | Add py-imageio for python3 (#8553) | iulian787/spack,matthiasdiener/spack,mfherbst/spack,krafczyk/spack,iulian787/spack,LLNL/spack,krafczyk/spack,iulian787/spack,matthiasdiener/spack,mfherbst/spack,mfherbst/spack,LLNL/spack,LLNL/spack,matthiasdiener/spack,krafczyk/spack,matthiasdiener/spack,mfherbst/spack,LLNL/spack,matthiasdiener/spack,iulian787/spack,mf... | var/spack/repos/builtin/packages/py-imageio/package.py | var/spack/repos/builtin/packages/py-imageio/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 | |
1cb2855054c40e6de7c6f9bf8efb7c8331009ca8 | add new package (#24702) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-iso8601/package.py | var/spack/repos/builtin/packages/py-iso8601/package.py | # Copyright 2013-2021 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 PyIso8601(PythonPackage):
"""Simple module to parse ISO 8601 dates"""
homepage = "htt... | lgpl-2.1 | Python | |
ace0f80344519a747a71e09faca46c05594dd0d9 | Add examples/req_rep.py | smira/txZMQ | examples/req_rep.py | examples/req_rep.py | #!env/bin/python
"""
Example txzmq client.
examples/req_rep.py --method=connect --endpoint=ipc:///tmp/req_rep_sock --mode=req
examples/req_rep.py --method=bind --endpoint=ipc:///tmp/req_rep_sock --mode=rep
"""
import os
import socket
import sys
import time
import zmq
from optparse import OptionParser
from t... | mpl-2.0 | Python | |
9805f9a4e837f3897fc5146c4a9b4d89a0c3f913 | Revert "deleted" | charman2/rsas | examples/steady2.py | examples/steady2.py | # -*- coding: utf-8 -*-
"""Storage selection (SAS) functions: example with two flux out at steady state
Runs the rSAS model for a synthetic dataset with two flux in and out
and steady state flow
Theory is presented in:
Harman, C. J. (2014), Time-variable transit time distributions and transport:
Theory and applicatio... | mit | Python | |
3513b039b90e4b16d94fedb3f9715918eaa3bc36 | Test cookies | tiangolo/fastapi,tiangolo/fastapi,tiangolo/fastapi | tests/test_tutorial/test_cookie_params/test_tutorial001.py | tests/test_tutorial/test_cookie_params/test_tutorial001.py | import sys
import pytest
from starlette.testclient import TestClient
from cookie_params.tutorial001 import app
client = TestClient(app)
print(sys.path)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "Fast API", "version": "0.1.0"},
"paths": {
"/items/": {
"get": {
... | mit | Python | |
3ed611cebed6c9283b5668a7c237deae265fdd64 | create fedex_cir_import.py | robsuttonjr/public_python | fedex_cir_import.py | fedex_cir_import.py | import os, pdb, psycopg2
print 'begin script - fedex_cir_import.py'
path = '/usr/local/cirdata/'
imported = '/usr/local/cirdata/imported/'
phoenixDB = psycopg2.connect("dbname='database' user='user' host='host' password='password'")
for file in os.listdir(path):
current = os.path.join(path, file)
if os... | mit | Python | |
513df9e9ce48c7877244d5c9ad1dcf220d368386 | Add findexposurehist to finde exposure dist for each country. | c4fcm/WhatWeWatch-Analysis,c4fcm/WhatWeWatch-Analysis,c4fcm/WhatWeWatch-Analysis | findexposurehist.py | findexposurehist.py | from __future__ import division
import ConfigParser
import csv
import time
import datetime
import matplotlib; matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
import scipy.stats as spstats
import exposure
import util
def main():
# Read config
config = ConfigPa... | bsd-3-clause | Python | |
539098d24cb671fe30543917928404a8de0f02e5 | make video using ffmpeg | SNU-sunday/fisspy | fisspy/makemovie.py | fisspy/makemovie.py | """
Makevideo
Using the ffmpeg make a movie file from images
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import subprocess as sp
import platform
from matplotlib.pyplot import imread
from shutil import copy2
import os
__author__="J. Kang: jhkang@astro.snu.ac.kr"
__email__="j... | bsd-2-clause | Python | |
ef20713c0b4b7378fe91aae095258452d01e81ba | Create 1.py | satishgoda/learningqt,satishgoda/learningqt | basics/action/QWidgetAction/1.py | basics/action/QWidgetAction/1.py | class SelectionSetsView(QTableView):
def _onContextMenu(self, widget, pos):
menu = QtGui.QMenu()
colorAction = menu.addAction("Edit Color")
colorAction.triggered.connect(partial(self._editColor, widget, pos))
colorWidgetAction = QtGui.QWidgetAction(menu)
cbg = ColoredButtonGr... | mit | Python | |
2e558cc09729d5e87d13ddea0f19a82dd7e7ac05 | add file at company | zmsch27/Python | Python_FunctionalProgramming.py | Python_FunctionalProgramming.py | #以下来自廖雪峰的Python学习之Python函数式编程
#我们首先要搞明白计算机(Computer)和计算(Compute)的概念。
#在计算机的层次上,CPU执行的是加减乘除的指令代码,以及各种条件判断和跳转指令,所以,汇编语言是最贴近计算机的语言。
#而计算则指数学意义上的计算,越是抽象的计算,离计算机硬件越远。
#对应到编程语言,就是越低级的语言,越贴近计算机,抽象程度低,执行效率高,比如C语言;越高级的语言,越贴近计算,抽象程度高,执行效率低,比如Lisp语言。
#高阶函数///////////////////////////////////
#变量可以指向函数
print('abs(-10) =', abs(-10... | apache-2.0 | Python | |
89615f5ce8d6433721f5b4e1130de2433c16d0eb | Add candidate.py, with candidate_rules a clone of basic_rules in cdr_matrices.py. | jfine2358/py-linhomy | py/linhomy/candidate.py | py/linhomy/candidate.py | '''
>>> candidate_matrices.print_C_stats(10)
0 [(1, 1)]
1 [(0, 1), (1, 1)]
2 [(0, 3), (1, 3)]
3 [(0, 11), (1, 4)]
4 [(0, 33), (1, 7)]
5 [(0, 92), (1, 12)]
6 [(0, 254), (1, 19)]
7 [(0, 682), (1, 32)]
8 [(0, 1818), (1, 52)]
9 [(0, 4810), (1, 85)]
10 [(0, 12677), (1, 139)]
As expected, all zeros and ones.
>>> candidate_m... | mit | Python | |
51b72ace0e0041199c596074718c2f8b22f5de71 | Create stripmanager.py | freedom27/jira_sprint_ledstrip_tracker | stripmanager.py | stripmanager.py | import time
from neopixel import *
import datamanager
# LED strip configuration:
LED_COUNT = 60 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 5 # DMA cha... | mit | Python | |
a19aff3173a85ca8b0035873c3a6315d3dbedba4 | Create main.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | gateway/src/main.py | gateway/src/main.py | #!/usr/bin/env python
#Gateway main script.
#Communicate with end devices via LoRa.
#Communicate with server via MQTT(hbmqtt) and HTTP POST.
#Save data in the sqlite database.
#Parse JSON from MQTT and LoRa protocol.
| mit | Python | |
754a717c8abc0f6b2683071684420240ff0aef17 | add heap | haandol/algorithm_in_python | ds/heap.py | ds/heap.py | class BinHeap:
def __init__(self):
self.heap_list = [0]
self.size = 0
def siftup(self, i):
while i // 2 > 0:
if self.heap_list[i] < self.heap_list[i//2]:
self.heap_list[i//2], self.heap_list[i] = self.heap_list[i], self.heap_list[i//2]
i = i // 2
... | mit | Python | |
58c604a8574ade75aecbd80314004a9539e80c84 | Add ?wv command for encouraging action | smarkets/hal | plugins/volunteers.py | plugins/volunteers.py | __commands__ = '''
?wv [name] - congratulates people on their public sprited gesture
'''
def plugin(bot):
bot.hear(r'^\?wv$', "Well volunteered!")
bot.hear(r'^\?wv\s(.+)$', lambda response: "Well volunteered %s!" % response.match.group(1).strip())
| mit | Python | |
2d1fd9c81ca9f17270ecef6505830cb798632091 | initialize graph test file. | constanthatz/data-structures | test_simple_graph.py | test_simple_graph.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
def test_init(self):
return
def test_nodes():
return nodes
def test_edges():
return edges
def test_add_node(value):
return
def test_add_edge(value1, value2):
return
def test_del_node(value... | mit | Python | |
0f782c2ade2f58641688742d6fc1030f6259df40 | Add code to JSONize the dataset | bassosimone/nadia | nadia/jsonize.py | nadia/jsonize.py | # nadia/jsonize.py
#
# Copyright (c) 2011 Simone Basso <bassosimone@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVI... | isc | Python | |
87eab562e847d7cdde7867c41453b10add376fba | Add test script | ikegami-yukino/madoka-python,ikegami-yukino/madoka-python | test_madoka.py | test_madoka.py | # -*- coding: utf-8 -*-
from nose.tools import eq_, ok_
import madoka
import os
class Test_madoka(object):
def test_inc(self):
sketch = madoka.Sketch()
sketch.inc('mami', 3)
eq_(1, sketch.get('mami', 3))
sketch.inc('mami', 3)
eq_(2, sketch.get('mami', 3))
def test_add... | bsd-3-clause | Python | |
100c2bb05d002c5b07e0d6ae4a242346e1362c2b | Create condition.py | gmambro/colino | colino/condition.py | colino/condition.py | from __future__ import (absolute_import, division,
print_function, unicode_literals)
class Condition(object):
def __init__(self, condition_model):
# used for holding objects like compiled reges
self.init_context = {}
# variables referenced by condition
self.variables = set()
... | apache-2.0 | Python | |
cf6172353ad5f73185b8de0d60510a0713aa9895 | Transform omorfi tagged text into finnpos format. | mpsilfve/FinnPos,mpsilfve/FinnPos,mpsilfve/FinnPos,mpsilfve/FinnPos | bin/omorfi2finnpos.py | bin/omorfi2finnpos.py | from sys import stdin, argv, stderr
from re import findall
def get_lemma(string, convert_type):
if convert_type == 'ftb':
word_id_strs = findall('\[WORD_ID=[^\]]*\]', string)
lemma_parts = [ word_id_str[9:][:-1] for word_id_str in word_id_strs ]
return '#'.join(lemma_parts)
else:
... | apache-2.0 | Python | |
723a7ef13c34bf6e292377db9849753d34b4d0d1 | add new helper to display completion on learner dashboard | appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform | openedx/core/djangoapps/appsembler/html_certificates/helpers.py | openedx/core/djangoapps/appsembler/html_certificates/helpers.py | """
Appsembler Helpers to improve course info in learner dashboard.
We should remove this after Maple, since all the info is in the new course_home_api.
"""
import beeline
from xmodule.modulestore.django import modulestore
from common.djangoapps.student.helpers import cert_info
from lms.djangoapps.course_blocks.api i... | agpl-3.0 | Python | |
898e1692ed87890cf77a7534e3c51afed112a131 | add a top-level __init__.py with imports of the main classes | pyreaclib/pyreaclib | pyreaclib/__init__.py | pyreaclib/__init__.py | """
pyreaclib is a python module that interprets the nuclear reaction rates
cataloged by the JINA ReacLib project:
https://groups.nscl.msu.edu/jina/reaclib/db/
It provides both interactive access to the rates, for use in Jupyter
notebooks as well as methods for writing python and Fortran nuclear
reaction networks, in... | bsd-3-clause | Python | |
a7a20eacc94f1bca2baf5c37632f116e34f2f079 | Create data_cleansed.py | searchs/bigdatabox,searchs/bigdatabox | data_cleansed.py | data_cleansed.py | # Data Cleansing
import pandas as pd
df = pd.DataFrame()
# 1. Explore data: df.head(), df.tail(), df.info(), df.describe()
# Check NULL values totals: df.isna().sum()
# 2. Drop NaValues: df.dropna(inplace=True)
# 3. Deal with Duplicates: df.duplicated().value_counts()
''' A general rule of thumb is to ignore the du... | mit | Python | |
d90bb9ddfbac20fa9ae7d7ecf37064cb8a86b26e | add algorithm which choose the node with largest degree to query | ryaninhust/sampling | degree_largest.py | degree_largest.py | from random import sample,random,choice
from core import Algorithm
from egraphs import FBEgoGraph
class DegreeLargest(Algorithm):
def update_graph(self, start_node, new_node):
g = self.sampled_graph
start_id = g.vs['name'].index(start_node)
if new_node['name'] not in g.vs['name']:
... | mit | Python | |
7b4f3784f3c27e861b2b741fe2a02c82a97e8fb9 | change storage test file name | DvA-leopold/CrAB,DvA-leopold/CrAB | blockchain_storage/tests.py | blockchain_storage/tests.py | import hashlib
import leveldb
database = leveldb.LevelDB('/home/operator/PycharmProjects/CrAB/db', create_if_missing=False)
hash = hashlib.sha256('data'.encode())
print('hash: ', hash.digest())
database.Put(hashlib.sha256('data'.encode()).digest(), 'something'.encode())
print(database.Get(hashlib.sha256('data'.encode(... | mpl-2.0 | Python | |
40ad674ae170347ed69b19434241438bb09e473d | Define decorator for requiring login | ueg1990/customer-info,ueg1990/customer-info | app/decorators.py | app/decorators.py | from functools import wraps
from flask import redirect, session, url_for
def login_required(f):
@wraps(f)
def wrapper(*args, **kwargs):
if session.get('logged_in', False):
return f(*args, **kwargs)
return redirect(url_for('public.login'))
return wrapper
| apache-2.0 | Python | |
855a8550c6bd6e1a16700610e07f9192f9907125 | move sort to its own module | Fiedzia/pyes,HackLinux/pyes,mavarick/pyes,HackLinux/pyes,aparo/pyes,haiwen/pyes,HackLinux/pyes,mavarick/pyes,aparo/pyes,haiwen/pyes,haiwen/pyes,jayzeng/pyes,mavarick/pyes,Fiedzia/pyes,jayzeng/pyes,Fiedzia/pyes,jayzeng/pyes,aparo/pyes | pyes/sort.py | pyes/sort.py | from .exceptions import InvalidSortOrder
from .utils import EqualityComparableUsingAttributeDictionary
class SortOrder(EqualityComparableUsingAttributeDictionary):
"""
Defines sort order
"""
MODE_MIN = 'min'
MODE_MAX = 'max'
MODE_SUM = 'sum' # not available for geo sorting
MODE_AVG = 'avg... | bsd-3-clause | Python | |
f608e18aa9fa2d13ce5a08f63ab44b942678ff5d | convert avg_face_maker from ipynb to .py and commit | andrewjtimmons/selfieexpression | avg_face_maker.py | avg_face_maker.py | """Create an average face from a list of faces"""
import numpy as np
import cv2
import sqlite3
import json
conn = sqlite3.connect("face.db")
c = conn.cursor()
faces_data = c.execute("SELECT * FROM (SELECT * FROM faces) as t1 inner join (select rowid, instagram_id from images) as t2 on t1.image_table_id = t2.rowid").... | mit | Python | |
15dca96debdc04d18ef69e457dc0c41e5288d99b | create fields.py so you don't have to specify trix fields in the admin | istrategylabs/django-trix,istrategylabs/django-trix,istrategylabs/django-trix | trix/fields.py | trix/fields.py | from django.db import models
from trix.widgets import TrixEditor
class TrixField(models.TextField):
def formfield(self, **kwargs):
kwargs.update({'widget': TrixEditor})
return super(TrixField, self).formfield(**kwargs)
| mit | Python | |
2572feea64ee5e4556763132d0663fe4412fe369 | Add fixtures to test_journal.py and add test for write_entry method. | bm5w/learning-journal,bm5w/learning-journal | test_journal.py | test_journal.py | # -*- coding: utf-8 -*-
from contextlib import closing
from pyramid import testing
import pytest
from journal import connect_db
from journal import DB_SCHEMA
TEST_DSN = 'dbname=test_learning_journal user=mark'
def init_db(settings):
with closing(connect_db(settings)) as db:
db.cursor().execute(DB_SCHEM... | mit | Python | |
7ad1c83776c78e39b47792e6a8240686b04d3726 | Create main.v.py | jenerestain/smart-student | contracts/main.v.py | contracts/main.v.py | mit | Python | ||
6cffe1d30c16062e3a0414310aad89e7a04b2df6 | add handler-specific tests | keeprocking/pygelf,keeprocking/pygelf | tests/test_handler_specific.py | tests/test_handler_specific.py | from pygelf import GelfTlsHandler
import pytest
def test_tls_handler_creation():
with pytest.raises(ValueError):
GelfTlsHandler(host='127.0.0.1', port=12204, validate=True)
with pytest.raises(ValueError):
GelfTlsHandler(host='127.0.0.1', port=12204, keyfile='/dev/null')
| mit | Python | |
4121e3502f10f0ca36f696bf32e2dfe64bb19d0e | Create tibrvlisten.py | arienchen/pytibrv | examples/api/tibrvlisten.py | examples/api/tibrvlisten.py |
import sys
import getopt
from tibrv.events import *
def usage() :
print()
print("tibrvlisten.py [-service service] [-network network]")
print(" [-daemon daemon] <subject> ")
print()
sys.exit(1)
def get_params(argv):
try:
opts, args = getopt.getopt(argv, '', ['service'... | bsd-3-clause | Python | |
5d8a9223905117e6b01099c318a2294e148f84b4 | Add rpmgrill check | khardix/coprcheck | coprcheck/checks.py | coprcheck/checks.py | """Checks to run on fetched builds."""
from contextlib import contextmanager
from distutils.spawn import find_executable
from functools import wraps
import fnmatch
import os
from shutil import rmtree
from subprocess import check_call
class MissingBinaryError(OSError):
"""The binary required for this check is no... | agpl-3.0 | Python | |
df227e598aeda7646a6ae24384a1d9e7f9179dc2 | add vcs parsing test | Deepwalker/pundler | tests/test_vcs_requirements.py | tests/test_vcs_requirements.py | from pundle import parse_vcs_requirement
def test_parse_vcs_requirement():
assert parse_vcs_requirement('git+https://github.com/pampam/PKG.git@master#egg=PKG') == \
('pkg', 'git+https://github.com/pampam/PKG.git@master#egg=PKG', None)
| bsd-2-clause | Python | |
5d7e4615657d947ec4a7500433f7008de223b622 | Add test | darkfeline/mir.dlsite,darkfeline/mir.dlsite | tests/test_dllist.py | tests/test_dllist.py | # Copyright (C) 2016, 2017 Allen Li
#
# 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 wr... | apache-2.0 | Python | |
08613bb395b4c964b15307165c7f472b59061da8 | Add tests for encode | tyrannosaurus/termformat | tests/test_encode.py | tests/test_encode.py | import termformat
from unittest import TestCase
class LargeMock:
def __len__(self):
return 4294967296
class LargeAtomMock(LargeMock, str):
pass
class LargeListMock(LargeMock, list):
pass
class LargeTupleMock(LargeMock, tuple):
pass
class LargeStringMock(LargeMock, str):
pass
class TermFormatEncoderT... | mit | Python | |
722b11eab90c6d532ea96209f7632e17181c0b3e | Test if points are in footprint | NLeSC/PattyAnalytics | tests/test_inpoly.py | tests/test_inpoly.py | import unittest
import pcl
import numpy as np
from patty_registration.conversions import loadLas, loadCsvPolygon
from numpy.testing import assert_array_equal, assert_array_almost_equal
from matplotlib import path
class TestInPoly(unittest.TestCase):
def testInPoly(self):
fileLas = 'data/footprints/162.las'... | apache-2.0 | Python | |
01494bfbc15987a2b925ca7990e8704767c9457b | Create secret.py | DmytroLitvinov/kuna | tests/secret.py | tests/secret.py | public_key = 'xxx'
private_key = 'yyy'
| mit | Python | |
6b132720c1f7596db34a2fdab3f6ca0134aaabc9 | create new model to store uploaded images with id | openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform | api/migrations/0001_initial.py | api/migrations/0001_initial.py | # Generated by Django 3.0 on 2020-11-07 13:11
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='UploadedImages',
fields=[
('id', models.AutoF... | agpl-3.0 | Python | |
ca90d083005e1c29b3b394d556296fd8e734c40a | implement top extrapolation module | morgenst/PyAnalysisTools,morgenst/PyAnalysisTools,morgenst/PyAnalysisTools | PyAnalysisTools/AnalysisTools/TopExtrapolationModule.py | PyAnalysisTools/AnalysisTools/TopExtrapolationModule.py | from PyAnalysisTools.base import _logger
import ROOT
class TopExtrapolationModule(object):
def __init__(self, **kwargs):
_logger.debug('Initialising TopExtrapolationModule')
self.build_functions(**kwargs)
self.type = "DataModifier"
def build_functions(self, **kwargs):
def buil... | mit | Python | |
181ca07d3d7bdb3e07b8f9e608ebd8e42235a38c | test module; | terentjew-alexey/market-analysis-system | mas_vae/models.py | mas_vae/models.py | from keras import backend as K
from keras.models import Model, Sequential
from keras.layers import Input, Dense, concatenate
from keras.layers import Flatten, Reshape, BatchNormalization
from keras.layers import Conv2D, MaxPooling2D, Conv2DTranspose
from mas_tools.ml import save_model_arch
def deep_conv2d_ae(input_s... | mit | Python | |
0515cdac701b6fbd4bb9281b6412313ad31072cc | Add file to run flask app | ueg1990/twilix,ueg1990/twilix | app.py | app.py | from flask import Flask, request
from twilio import twiml
import subprocess
from cmd import cmds
app = Flask(__name__)
import os
ACCOUNT_SID = "" #os.environ['ACCOUNT_SID']
AUTH_TOKEN = "" #os.environ['AUTH_TOKEN']
APP_SID = "Twilix" #os.environ['APP_SID']
CALLER_ID = "+14389855700" #os.environ['CALLER_ID']
#CALLER_... | mit | Python | |
a0ee0998457976aa45b3d3a462f2b2aab1bfb15f | add objects module | sandybee/python-crossprocess-transient-object | crossprocess/objects.py | crossprocess/objects.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class SimpleObject(object):
def __init__(self, name):
self.__name = name
def get_name(self):
return self.__name
| mit | Python | |
8c276c8c2e45ff0fe634669ea65d0df40c96463c | Add python example using metadata | mapequation/infomap,mapequation/infomap,mapequation/infomap,mapequation/infomap | examples/python/metadata.py | examples/python/metadata.py | from infomap import infomap
myInfomap = infomap.Infomap("--two-level --meta-data-rate 0.3")
# Add weight as an optional third argument
myInfomap.addLink(0, 1)
myInfomap.addLink(0, 2)
myInfomap.addLink(0, 3)
myInfomap.addLink(1, 0)
myInfomap.addLink(1, 2)
myInfomap.addLink(2, 1)
myInfomap.addLink(2, 0)
myInfomap.addLi... | agpl-3.0 | Python | |
7115d25c57404a42bc29513eb514073747d876ce | Add platform_map to remap Platform.os and arch based on config | nerdvegas/rez,instinct-vfx/rez,nerdvegas/rez,instinct-vfx/rez | src/rez/utils/platform_mapped.py | src/rez/utils/platform_mapped.py | import re
def platform_mapped(func):
"""
Decorates functions for lookups within a config.platform_map dictionary.
The first level key is mapped to the func.__name__ of the decorated function.
Regular expressions are used on the second level key, values.
Note that there is no guaranteed order withi... | apache-2.0 | Python | |
904a37589d8ef0f7b69d9b0f83f41c94fbbfcde6 | Update 1.7 migrations | aldryn/aldryn-categories,aldryn/aldryn-categories | aldryn_categories/migrations/0003_auto_20150128_1359.py | aldryn_categories/migrations/0003_auto_20150128_1359.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('aldryn_categories', '0002_auto_20150109_1415'),
]
operations = [
migrations.AlterField(
model_name='categorytran... | bsd-3-clause | Python | |
8a1448ed3bd426d11f6222d63f77604ec132b2da | Add an example for pre signed URL | openstack/python-zaqarclient | examples/signed_url_auth.py | examples/signed_url_auth.py | # Copyright 2016 Catalyst IT Ltd
#
# 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 ag... | apache-2.0 | Python | |
59f37975bb06edd38bbcdea6f0ea031f079ba2c3 | Add an utility function to load YAML | hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder | lib/hawaiibuildbot/common/utils.py | lib/hawaiibuildbot/common/utils.py | #
# This file is part of Hawaii.
#
# Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
#
# This program 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
# (... | agpl-3.0 | Python | |
e5a7f3fec4dc30273e582ac1a4d0374f42175c76 | Add rough script to import version data from prod API for an add-on (#13869) | bqbn/addons-server,diox/olympia,diox/olympia,eviljeff/olympia,bqbn/addons-server,wagnerand/addons-server,diox/olympia,mozilla/olympia,bqbn/addons-server,mozilla/addons-server,wagnerand/addons-server,diox/olympia,eviljeff/olympia,mozilla/addons-server,mozilla/olympia,mozilla/addons-server,wagnerand/addons-server,mozilla... | src/olympia/landfill/management/commands/fetch_prod_versions.py | src/olympia/landfill/management/commands/fetch_prod_versions.py | import requests
from os.path import basename
from urllib.parse import urlparse
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.management.base import BaseCommand, CommandError
from django.db.transaction import atomic
from olympia import amo
from olymp... | bsd-3-clause | Python | |
275bf9c021c032b72c76010116aa05e0994ce631 | Add a basic test for loading grading records details overview page. | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | tests/app/soc/modules/gsoc/views/test_grading_record_details.py | tests/app/soc/modules/gsoc/views/test_grading_record_details.py | # Copyright 2013 the Melange authors.
#
# 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 wr... | apache-2.0 | Python | |
8e58bf21cf39892df07d42d650619e2292b8efb5 | Create new package (#7796) | EmreAtes/spack,mfherbst/spack,tmerrick1/spack,krafczyk/spack,LLNL/spack,matthiasdiener/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,mfherbst/spack,iulian787/spack,krafczyk/spack,krafczyk/spack,krafczyk/spack,tmerrick1/spack,tmerrick1/spack,mfherbst/spack,EmreAtes/spack,matthiasdiener/spack,EmreAtes/spack,mfher... | var/spack/repos/builtin/packages/perl-statistics-pca/package.py | var/spack/repos/builtin/packages/perl-statistics-pca/package.py | ##############################################################################
# Copyright (c) 2013-2017, 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 | |
f6fc6960bf44c63fd854455efd3d5eff135d5877 | Fix failing build due to missing file | lassoan/SlicerSegmentEditorExtraEffects,lassoan/SlicerSegmentEditorExtraEffects | SegmentEditorSplitVolume/SegmentEditorSplitVolumeLib/__init__.py | SegmentEditorSplitVolume/SegmentEditorSplitVolumeLib/__init__.py | from SegmentEditorEffects.AbstractScriptedSegmentEditorEffect import *
from SegmentEditorEffects.AbstractScriptedSegmentEditorLabelEffect import *
from SegmentEditorEffect import *
| bsd-3-clause | Python | |
c81ecdf74f3e668559ed4c257e3cdfb1d95f376c | Add files via upload | bbarrows89/CSC110_Projects | myFirstPythonProgram.py | myFirstPythonProgram.py | # Bryan Barrows
# CSC 110 - 9830
# January 13th, 2017
# File: myFirstPythonProgram.py
# A simple program illustrating chaotic behavior.
def main():
print("This program illustrates a chaotic function")
x = eval(input("Enter a number between 0 and 1: "))
for i in range(10):
x = 3.9 * x * (1 - x)
... | mit | Python | |
f3eb56111c115e65db6e55fcd1c69d695178b33b | Integrate LLVM at llvm/llvm-project@6144fc2da1b8 | tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,frreiss/tensorflow-fred,Intel-Corporation/tensorflow,Intel-tensorflow/tensorflow... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "6144fc2da1b87dc64ff887d73b60f7708f5cb0a4"
LLVM_SHA256 = "e6fe7c8df75bc1d3fb5f29758431e056406542768dd48333d32675dd4e06f1aa"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "eb03fa1d2c05bad5a5f75a89d47b4b31d84bb90b"
LLVM_SHA256 = "53260f7983218c72b07f905694505188695e94e4e68fb9f2959f89073724feac"
tf_http_archive(
... | apache-2.0 | Python |
62b2c69482d36a7afcdb732dd70a037d2513ba51 | Add script to execute a simple command in a remote server over SSH | inakidelamadrid/bhp_exercises | bh_sshcmd.py | bh_sshcmd.py | import paramiko # pip install paramiko
import os
def ssh_command(ip, user, command):
# you can run this script as
# SSH_PRIV_KEY=[your private key path] python bh_sshcmd.py
key = paramiko.RSAKey.from_private_key_file(os.getenv('SSH_PRIV_KEY'))
client = paramiko.SSHClient()
client.set_missing_hos... | mit | Python | |
cb7b286d1aa9fc10669b1b59afe334995a4c1174 | add missed migration | taigaio/taiga-back,taigaio/taiga-back,taigaio/taiga-back | taiga/projects/userstories/migrations/0021_auto_20201202_0850.py | taiga/projects/userstories/migrations/0021_auto_20201202_0850.py | # Generated by Django 2.2.14 on 2020-12-02 08:50
from django.db import migrations, models
import taiga.base.utils.time
class Migration(migrations.Migration):
dependencies = [
('userstories', '0020_userstory_swimlane'),
]
operations = [
migrations.AlterField(
model_name='user... | agpl-3.0 | Python | |
74d094e1071f4fadffbb5f2351c4e171e528b68e | Update split-array-into-consecutive-subsequences.py | yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/Le... | Python/split-array-into-consecutive-subsequences.py | Python/split-array-into-consecutive-subsequences.py | # Time: O(n)
# Space: O(1)
# You are given an integer array sorted in ascending order (may contain duplicates),
# you need to split them into several subsequences,
# where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split.
#
# Example 1:
# Input: [1,2,3,3,4,5]
# Ou... | # Time: O(n)
# Space: O(1)
# You are given an integer array sorted in ascending order (may contain duplicates),
# you need to split them into several subsequences,
# where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split.
#
# Example 1:
# Input: [1,2,3,3,4,5]
# Ou... | mit | Python |
cea70bf2f04779376b6db1570e9df0c40944782d | Create linux_x86_custom_encoder_real_world.py | rcesecurity/slae,rcesecurity/slae,rcesecurity/slae | assignment-4/linux_x86_custom_encoder_real_world.py | assignment-4/linux_x86_custom_encoder_real_world.py | #!/usr/bin/python
# SLAE - Assignment #4: Custom Shellcode Encoder/Decoder (Linux/x86)
# Author: Julien Ahrens (@MrTuxracer)
# Website: http://www.rcesecurity.com
from random import randint
# powered by Metasploit
# windows/exec CMD=calc.exe
# msfvenom -p windows/exec CMD=calc.exe -f python -e generic/none
# ... | mit | Python | |
615cb67e0082b6a2d2ab1c91623e9b2a20ddedec | create milestone migration for Havana release | glove747/liberty-neutron,CiscoSystems/vespa,antonioUnina/neutron,miyakz1192/neutron,openstack/neutron,vbannai/neutron,NeCTAR-RC/neutron,SamYaple/neutron,JianyuWang/neutron,redhat-openstack/neutron,vijayendrabvs/ssl-neutron,vijayendrabvs/hap,ntt-sic/neutron,Metaswitch/calico-neutron,yuewko/neutron,noironetworks/neutron,... | neutron/db/migration/alembic_migrations/versions/havana_release.py | neutron/db/migration/alembic_migrations/versions/havana_release.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 OpenStack Foundation
#
# 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... | apache-2.0 | Python | |
e5247e1123ecd2e5ea1d98668ceded22d99c1c42 | Create twitter-auth.py | timbennett/twitter-tools | twitter-auth.py | twitter-auth.py | # paste your apps.twitter.com keys in here
access_key = ""
access_secret = ""
consumer_key = ""
consumer_secret = ""
| mit | Python | |
f63747a7e19b82a59d7ff1435725c3f35a4ba61b | Add contex processor to use cart in any template | samitnuk/online_shop,samitnuk/online_shop,samitnuk/online_shop | apps/cart/context_processors.py | apps/cart/context_processors.py | from .cart import Cart
def cart(request):
return {'cart': Cart(request)}
| mit | Python | |
7c6077e107f40a3fcc3e1414f26071ceab0e0cf6 | Create missing migration in taiga.projects.notifications | Rademade/taiga-back,xdevelsistemas/taiga-back-community,dayatz/taiga-back,Rademade/taiga-back,dayatz/taiga-back,Rademade/taiga-back,Rademade/taiga-back,gam-phon/taiga-back,taigaio/taiga-back,taigaio/taiga-back,taigaio/taiga-back,gam-phon/taiga-back,dayatz/taiga-back,xdevelsistemas/taiga-back-community,gam-phon/taiga-ba... | taiga/projects/notifications/migrations/0006_auto_20151103_0954.py | taiga/projects/notifications/migrations/0006_auto_20151103_0954.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notifications', '0005_auto_20151005_1357'),
]
operations = [
migrations.AlterField(
model_name='notifypolicy',
... | agpl-3.0 | Python | |
f10209add7513cba71441b410bf3a52a1d1c816c | add new site PyDéfis | tehron/tehbot | tehbot/plugins/challenge/py.py | tehbot/plugins/challenge/py.py | # -*- coding: utf-8 -*-
from tehbot.plugins.challenge import *
import urllib
import urllib2
import urlparse
import lxml.html
import re
class Site(BaseSite):
def prefix(self):
return u"[PyDéfis]"
def siteurl(self):
return "https://pydefis.callicode.fr"
def userstats(self, user):
re... | mit | Python | |
90a22bf70efbc6b14c697305919f6fca3aae39a1 | Create __init__.py | shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE | __init__.py | __init__.py | apache-2.0 | Python | ||
ad053bd49c0a108ed06df5385a6571b405476bd8 | Create web_browser.py | umangahuja1/Python | web_browser.py | web_browser.py | from webbrowser import *
url="https://www.google.co.in"
open(url)
'''
This script lets you open the given link from terminal directly.
It is made meanwhile learning python.
'''
| apache-2.0 | Python | |
3b29a94a7009c0b652e8eca0b175bb97250e1b33 | Add an extract_features(image, measurements) function returning a feature vector | widoptimization-willett/feature-extraction | feature_extraction/extraction.py | feature_extraction/extraction.py | import numpy as np
"""
Given an image as a Numpy array and a set of measurement objects
implementing a compute method returning a feature vector, return a combined
feature vector.
"""
def extract_features(image, measurements):
# TODO(liam): parallelize multiple measurements on an image by using Celery
return np.rave... | apache-2.0 | Python | |
1ee6e4f99318a065ee6cceaf2ed470bb3513188e | Add py-hstspreload (#19188) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-hstspreload/package.py | var/spack/repos/builtin/packages/py-hstspreload/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 PyHstspreload(PythonPackage):
"""Chromium HSTS Preload list as a Python package and update... | lgpl-2.1 | Python | |
6533ac770ffd97ece23dcaba154a31297be76b04 | add Steam Store helper | mikoim/japanization,mikoim/japanization | reviews/utils.py | reviews/utils.py | import requests
from django.core.cache import cache
class SteamException(Exception):
pass
class SteamStore(object):
l = None
cc = None
def __init__(self, language='en', country='jp'):
self.l = language
self.cc = country
def appdetails(self, app_id: int) -> dict:
url = '... | mit | Python | |
d11491d30a2fb418dd40bf7e97d4d35cc84d6f3f | Move Chuck database query function to another file | trojjer/pyjokes,gmarkall/pyjokes,Wren6991/pyjokes,bennuttall/pyjokes,borjaayerdi/pyjokes,ElectronicsGeek/pyjokes,pyjokes/pyjokes,martinohanlon/pyjokes,birdsarah/pyjokes | pyjokes/chuck.py | pyjokes/chuck.py | # -*- coding: utf-8 -*-
import json
try:
from urllib2 import urlopen
except:
from urllib.request import urlopen
def get_chuck_nerd_jokes():
url = 'http://api.icndb.com/jokes/random?limitTo=[nerdy]'
response = urlopen(url).readall().decode('utf-8')
data = json.loads(response)
d = data['value'... | bsd-3-clause | Python | |
46db4860911e687bf5d3beef5f0b2f96ea145cd2 | FIX lasso_dense_vs_sparse_data.py example needed update. | yyjiang/scikit-learn,pratapvardhan/scikit-learn,joshloyal/scikit-learn,procoder317/scikit-learn,kjung/scikit-learn,tosolveit/scikit-learn,anntzer/scikit-learn,stylianos-kampakis/scikit-learn,mugizico/scikit-learn,Barmaley-exe/scikit-learn,thientu/scikit-learn,vigilv/scikit-learn,AlexRobson/scikit-learn,russel1237/sciki... | examples/linear_model/lasso_dense_vs_sparse_data.py | examples/linear_model/lasso_dense_vs_sparse_data.py | """
==============================
Lasso on dense and sparse data
==============================
We show that linear_model.Lasso and linear_model.sparse.Lasso
provide the same results and that in the case of
sparse data linear_model.sparse.Lasso improves the speed.
"""
print __doc__
from time import time
import nump... | """
==============================
Lasso on dense and sparse data
==============================
We show that linear_model.Lasso and linear_model.sparse.Lasso
provide the same results and that in the case of
sparse data linear_model.sparse.Lasso improves the speed.
"""
print __doc__
from time import time
import nump... | bsd-3-clause | Python |
35e30faabc3fd7ca68b7b28c9fd5b7a4c15b0e21 | add charset compilation script | jaames/kakimasu,jaames/kakimasu,jaames/kakimasu,jaames/kakimasu | util/charset.py | util/charset.py | # charset.py - lazy utility script for compiling character svgs, animation data and details into a single .json
#
# Usage:
# python charset.py [charset directory]
#
# The charset directory should have the following:
# - 'base.json' which contains the data and animation timings for each character in an array format,... | mit | Python | |
0d9613a1410aad150ccaf4b828971ec6f9e31520 | Create lang.py | jmister28/GitZip,jmister28/GitZip | lang.py | lang.py | mit | Python | ||
2f268173e25bee5d671583bb905829e0ffd4f631 | Add management command to clear all matches mostly useful with heroku | maxf/address-matcher,maxf/address-matcher,maxf/address-matcher,maxf/address-matcher | match/management/commands/reset-matches.py | match/management/commands/reset-matches.py | from django.core.management.base import BaseCommand, CommandError
from match.models import Match
import sys
class Command(BaseCommand):
help = 'Reset all match data'
def handle(self, *args, **options):
Match.objects.all().delete()
| mit | Python | |
732eee568f19ed2e63f357b62fa539ff50a1c046 | add program to display light readings in terminal in inf loop | davidbradway/beaglebone-python | light.py | light.py | #!/usr/bin/python
"""
light.py
Read analog values from the photoresistor
=======
run with:
sudo ./light.py
Copyright 2014 David P. Bradway (dpb6@duke.edu)
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... | apache-2.0 | Python | |
591bdcbfb80927d0ffb4922eb684fe7ce17c5456 | Add manage.py | gmuthetatau/zoohackathon2016,gmuthetatau/zoohackathon2016,gmuthetatau/zoohackathon2016 | web/zoohackathon2016/manage.py | web/zoohackathon2016/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zoohackathon2016.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure ... | apache-2.0 | Python | |
cb26da63add95ebf9e7aa84a381293dd80f433cb | add test_db, test is OK | haibo-yu/awesome-python-webapp,haibo-yu/awesome-python-webapp,haibo-yu/awesome-python-webapp | www/test_db.py | www/test_db.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Haibo-Yu'
from models import User, Blog, Comment
from transwarp import db
db.create_engine(user='www-data', password='www-data', database='awesome')
u = User(name='Test', email='test@example.com', password='1234567890', image='about:blank')
u.insert()
p... | unlicense | Python | |
ad5b3a334203394792c90b0d1bfe2dda8efe13b3 | add admin interface for tracking logs | prarthitm/edxplatform,cecep-edu/edx-platform,ferabra/edx-platform,ubc/edx-platform,msegado/edx-platform,louyihua/edx-platform,mjg2203/edx-platform-seas,mjirayu/sit_academy,chrisndodge/edx-platform,utecuy/edx-platform,rationalAgent/edx-platform-custom,kalebhartje/schoolboost,beacloudgenius/edx-platform,SivilTaram/edx-pl... | common/djangoapps/track/admin.py | common/djangoapps/track/admin.py | '''
django admin pages for courseware model
'''
from track.models import *
from django.contrib import admin
admin.site.register(TrackingLog)
| agpl-3.0 | Python | |
0196d9498644223959b4efae4fc084552bec8393 | Add check_tar test. | mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju | check_tar.py | check_tar.py | #!/usr/bin/env python3
from argparse import ArgumentParser
import logging
import os
import tarfile
from textwrap import dedent
import re
import sys
class TarfileNotFound(Exception):
"""Raised when specified tarfile cannot be found."""
class TestedDirNotFound(Exception):
"""Raised when specified tested text ... | agpl-3.0 | Python | |
a0123aad7414ce78be6b0c984f0895bba9568c99 | Solve 50. | klen/euler | 050/solution.py | 050/solution.py | # coding: utf-8
""" Project Euler problem #50. """
import itertools as it
def problem():
u""" Solve the problem.
The prime 41, can be written as the sum of six consecutive primes:
41 = 2 + 3 + 5 + 7 + 11 + 13
This is the longest sum of consecutive primes that adds to a prime below
one-hundred... | mit | Python | |
e3462c036da4030886594082a563b699b296a77c | Test Pool's AddDevs(). | trgill/stratisd,stratis-storage/stratisd,trgill/stratisd,mulkieran/stratisd,stratis-storage/stratisd,stratis-storage/stratisd,stratis-storage/stratisd-client-dbus,mulkieran/stratisd | tests/dbus/pool/test_add_devs.py | tests/dbus/pool/test_add_devs.py | # Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | mpl-2.0 | Python | |
4e7310e8d7485e132c62c85599e2694d228e0747 | Add an example | Lothiraldan/ZeroServices | examples/chat.py | examples/chat.py | from zeroservices import BaseService
from zeroservices import ZeroMQMedium
from time import time
class ChatService(BaseService):
def __init__(self, username):
self.username = username
super(ChatService, self).__init__(ZeroMQMedium(self, port_random=True))
def service_info(self):
ret... | mit | Python | |
8c4833dbf9f4ae32afbfbe6a3cb8e4630abc3d25 | Add test for local login | DannyArends/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,DannyArends/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,... | test/requests/test_login_local.py | test/requests/test_login_local.py | import requests
from wqflask import user_manager
from parametrized_test import ParametrizedTest
class TestLoginLocal(ParametrizedTest):
def setUp(self):
super(TestLoginLocal, self).setUp()
self.login_url = self.gn2_url +"/n/login"
data = {
"es_connection": self.es,
... | agpl-3.0 | Python | |
008711b6d5506aed60a693c296a7a01180c2ea86 | Create dss.py | harisphnx/Distributed_Sytem_Simulator-DSS_py | dss.py | dss.py | from functions import *
import multiprocessing
import time
with open("config.txt") as f:
lines = f.readlines()
max_instances = int(lines[0].split(' ')[1])
class machine():
'Class for the instance of a machine'
q = [multiprocessing.Queue() for i in range(max_instances + 1)]
# q[0] is unused
... | mit | Python | |
c0e7393c5cc3f1095891a35b552e4a69733c83b6 | add a simple example | damoti/python-v8,damoti/python-v8,pombredanne/python-v8,damoti/python-v8,pombredanne/python-v8,pombredanne/python-v8,damoti/python-v8,pombredanne/python-v8 | demos/helloworld.py | demos/helloworld.py | #!/usr/bin/env python
from __future__ import with_statement
import PyV8
class Global(PyV8.JSClass):
def writeln(self, arg):
print arg
with PyV8.JSContext(Global()) as ctxt:
ctxt.eval("writeln('Hello World');")
| apache-2.0 | Python | |
5669960952104b811df34fa9229d7e597407c753 | add basic unit testing for appliance instances (incomplete) | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | tests/test_appliance_instance.py | tests/test_appliance_instance.py | import sys
sys.path.append('..')
import disaggregator as da
import unittest
import pandas as pd
import numpy as np
class ApplianceInstanceTestCase(unittest.TestCase):
def setUp(self):
indices = [pd.date_range('1/1/2013', periods=96, freq='15T'),
pd.date_range('1/2/2013', periods=96, fre... | mit | Python | |
54f7cdf15d3fdbd70a5f06ec38aa84dfd828c7e7 | Add simple gui | dorooleg/cartoon-faces | gui.py | gui.py | from tkinter import Tk, LEFT, SUNKEN, X
from tkinter.ttk import Frame, Button, Style
from PIL import Image, ImageTk
def main():
root = Tk()
root.geometry("300x300")
separator = Frame(root, height=200, relief=SUNKEN)
separator.pack(fill=X, padx=10)
s = Style()
s.configure("Visible.TButton", f... | mit | Python | |
5af36bbe29a8a7a7418fc535c5647c9be511f0b4 | Add script to write user counts to csv. | chebee7i/twitter,chebee7i/twitter,chebee7i/twitter | scripts/userCounts.py | scripts/userCounts.py | """
Script to write user counts for each region to CSV.
"""
import twitterproj
def main():
db = twitterproj.connect()
filenames = ['grids/counties.user_counts.bot_filtered.csv',
'grids/states.user_counts.bot_filtered.csv',
'grids/squares.user_counts.bot_filtered.csv']
... | unlicense | Python | |
fb15c992a286abe066333abfdabbb13646d383d6 | Create final_P7_Frob.py | dyzhangweix/6.00.1x-MITx | final_P7_Frob.py | final_P7_Frob.py | class Frob(object):
def __init__(self, name):
self.name = name
self.before = None
self.after = None
def setBefore(self, before):
# example: a.setBefore(b) sets b before a
self.before = before
def setAfter(self, after):
# example: a.setAfter(b) sets b after a
... | isc | Python | |
0c18bb0993be77059aa75015cc5433eaacbe8999 | Add barebones RFC downloader and renderer. | StefanKopieczek/rfc | rfc.py | rfc.py | import pydoc
import sys
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
def get_rfc(rfc):
url = "http://www.ietf.org/rfc/rfc{0}.txt".format(rfc)
f = urlopen(url)
data = f.read()
if isinstance(data, bytes):
data = data.decode('utf-8')
return... | lgpl-2.1 | Python | |
681c21a5fbf3bc713468e33bb10dfa9bf6d62850 | Add migration to fix admin users with roles | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/migrations/0004_rm_role_id_from_admins.py | corehq/apps/users/migrations/0004_rm_role_id_from_admins.py | from django.db import migrations
from corehq.apps.es import UserES
from corehq.apps.users.models import WebUser
from corehq.util.couch import DocUpdate, iter_update
from corehq.util.django_migrations import skip_on_fresh_install
from corehq.util.log import with_progress_bar
@skip_on_fresh_install
def fix_users(apps,... | bsd-3-clause | Python | |
3134e22eb5da9bd7104c199f788288e0fc823db2 | Add basic endopoints powered by bottle | ciela/chainer-gogh | app.py | app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import bottle
from bottle import route, run, template, request, response
import os
import uuid
@route('/')
def get_simple_form():
"""
Returns simple images upload form
:return:
"""
return ('<form action="/imgs" method="post" enctype="multipart/form-da... | mit | Python | |
07442bd7ddd07635002493bafb6ac16a24fd5d82 | Add script for http live streaming | voidabhi/node-scripts,voidabhi/node-scripts,voidabhi/node-scripts | hls.py | hls.py | var http = require('http');
var fs = require('fs');
var url = require('url');
var path = require('path');
var zlib = require('zlib');
PORT = 8000;
http.createServer(function (req, res) {
var uri = url.parse(req.url).pathname;
if (uri == '/player.html') {
res.writeHead(200, { 'Content-Type': 'text/htm... | mit | Python | |
4596c0a54457ee515d164bafc399010af190eaa9 | Add basic http service to turn a led ON-OFF | andreagrandi/ledrestpi | led.py | led.py | from flask import Flask
import RPi.GPIO as GPIO
app = Flask(__name__)
@app.route("/led/on/")
def led_on():
GPIO.output(11, GPIO.HIGH)
return "Led ON"
@app.route("/led/off/")
def led_off():
GPIO.output(11, GPIO.LOW)
return "Led OFF"
if __name__ == "__main__":
GPIO.setmode(GPIO.BOARD)
GPIO... | mit | Python | |
95a94367a90f6424535b4120bc8e95a34624fc56 | Create util.py | wangtongada/BOA | code/util.py | code/util.py | import pandas as pd
import numpy as np
import math
from itertools import chain, combinations
import itertools
from numpy.random import random
from bisect import bisect_left
from random import sample
from scipy.stats.distributions import poisson, gamma, beta, bernoulli, binom
import time
import operator
from collection... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.