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 |
|---|---|---|---|---|---|---|---|---|
14abb5d5ef5ec4e19969d441fd0f551f5696e883 | Add shadow password generator | dgengtek/scripts,dgengtek/scripts | crypto/encrypt.py | crypto/encrypt.py | #!/bin/env python3
"""
Encrypt password with salt for unix
Usage:
encrypt.py [options] [--sha512 | --sha256 | --md5 | --crypt] [salt] <password>
Options:
--sha512
--sha256
--md5
--crypt
"""
import sys
import crypt
from docopt import docopt
# docopt(doc, argv=None, help=True, version=None, options... | mit | Python | |
031016e21879ad7c0e3a2c1c888e973bfb23c529 | Add unit tests for the HansenLaw implementation | PyAbel/PyAbel,rth/PyAbel,DhrubajyotiDas/PyAbel,stggh/PyAbel,huletlab/PyAbel | abel/tests/test_hansenlaw.py | abel/tests/test_hansenlaw.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import numpy as np
from numpy.testing import assert_allclose
from abel.hansenlaw import iabel_hansenlaw
from abel.analytical import GaussianAnalytical
from abel.benchmark import absolute_ratio... | mit | Python | |
386e6bf0c373691a601891d1b02c1d2130c014fa | Add the `dirty_tar` rule | mlk/thefuck,princeofdarkness76/thefuck,gogobebe2/thefuck,Aeron/thefuck,beni55/thefuck,thesoulkiller/thefuck,lawrencebenson/thefuck,bigplus/thefuck,AntonChankin/thefuck,manashmndl/thefuck,mbbill/thefuck,Clpsplug/thefuck,LawrenceHan/thefuck,levythu/thefuck,ostree/thefuck,zhangzhishan/thefuck,beni55/thefuck,roth1002/thefu... | thefuck/rules/dirty_untar.py | thefuck/rules/dirty_untar.py | from thefuck import shells
import os
import tarfile
def _is_tar_extract(cmd):
if '--extract' in cmd:
return True
cmd = cmd.split()
return len(cmd) > 1 and 'x' in cmd[1]
def _tar_file(cmd):
tar_extentions = ('.tar', '.tar.Z', '.tar.bz2', '.tar.gz', '.tar.lz',
'.tar.lzm... | mit | Python | |
2a6f0f0d67fb4a21fdef1c3fe9a1ed4c5a20cd09 | move get_api template tag from djforms to here in order to share it with other projects. | carthagecollege/django-djtools | djtools/templatetags/get_api.py | djtools/templatetags/get_api.py | from django.conf import settings
from django.db.models import get_model
from django.template import Library, Node, TemplateSyntaxError
import httplib
register = Library()
class ApiObjectNode(Node):
def __init__(self, context_var, app, model, id, format):
self.context_var = context_var
self.app = ... | unlicense | Python | |
fda7c4f13d61ff56fd80799bb6548172848d5926 | Add util module | kemskems/otdet | util.py | util.py | #!/usr/bin/env python
import glob
import os.path
import random
def pick_random(directory, k=None):
"""Pick randomly some files from a directory."""
all_files = glob.glob(os.path.join(directory, '*'))
random.shuffle(all_files)
return all_files if k is None else all_files[:k]
| mit | Python | |
697ff44c450af1c1cb163d3cadb7640377f519d1 | Create RemoveDuplicate.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | Codingame/Python/Clash/RemoveDuplicate.py | Codingame/Python/Clash/RemoveDuplicate.py | l = []
for x in range(int(input())):
y = int(input())
if y not in l:
l.append(y)
for x in l:
print(x)
| mit | Python | |
76c580f04edc1995e2dc9d107f84a714c088c0c2 | Add better solution for nth prime | always-waiting/exercism-python | nth-prime/nth_prime1.py | nth-prime/nth_prime1.py | def nth_prime(n):
if n <= 0:
raise ValueError
for i, prime in enumerate(prime_gen()):
if n == i + 1:
return prime
def prime_gen():
def n_gen():
n = 2
while True:
yield n
n += 1
nonprimes = {}
for n in n_gen():
prime = nonp... | mit | Python | |
9f050cd2d341fa29593483922dbc2cc29d5cf01c | Add 010 solution | byung-u/ProjectEuler | HackerRank/ProjectEuler_plus/euler_010.py | HackerRank/ProjectEuler_plus/euler_010.py | #!/usr/bin/env python3
import sys
import bisect
from math import sqrt
from itertools import count
def prime_sieve(sieveSize):
# Returns a list of prime numbers calculated using
# the Sieve of Eratosthenes algorithm.
sieve = [True] * sieveSize
sieve[0] = False # zero and one are not prime numbers
... | mit | Python | |
b22a1d2a9336aabb74126903a8c806f343968f1d | manage command to create mongo records | jomolinare/kobocat,jomolinare/kobocat,spatialdev/onadata,eHealthAfrica/onadata,smn/onadata,ultimateprogramer/formhub,smn/onadata,eHealthAfrica/onadata,sounay/flaminggo-test,SEL-Columbia/formhub,GeoODK/formhub,ehealthafrica-ci/onadata,mainakibui/kobocat,GeoODK/onadata,mainakibui/kobocat,kobotoolbox/kobocat,piqoni/onadat... | odk_viewer/management/commands/remongo.py | odk_viewer/management/commands/remongo.py | from django.core.management.base import BaseCommand
from django.conf import settings
from odk_viewer.models import ParsedInstance
from utils.model_tools import queryset_iterator
class Command(BaseCommand):
help = "Insert all existing parsed instances into MongoDB"
def handle(self, *args, **kwargs):
f... | bsd-2-clause | Python | |
a3c81698378513ff2a95d91510d3be48ae90b969 | Create unlucky-days.py | Pouf/CodingCompetition,Pouf/CodingCompetition | CiO/unlucky-days.py | CiO/unlucky-days.py | from calendar import Calendar
def checkio(year):
return str(Calendar().yeardays2calendar(year)).count('13, 4')
| mit | Python | |
2e9d87347438560ff0b1915facba8444a0299fd2 | Test cross correlation on phoenix spectra | jason-neal/companion_simulations,jason-neal/companion_simulations | xcorr_phoenix.py | xcorr_phoenix.py |
# Xcorr the phoenix spectra against observation to find RV value.
# Test using the cross correlation function on a spectrum.
import numpy as np
from astropy.io import fits
from PyAstronomy import pyasl
from spectrum_overload.Spectrum import Spectrum
import matplotlib.pyplot as plt
pathwave = "/home/jneal/Phd/data/pho... | mit | Python | |
777708d0c1cc81adf923754ede72a7087f0f18c0 | Add event.notes and site.notes | pbanaszkiewicz/amy,shapiromatron/amy,swcarpentry/amy,vahtras/amy,wking/swc-amy,shapiromatron/amy,wking/swc-amy,pbanaszkiewicz/amy,pbanaszkiewicz/amy,vahtras/amy,shapiromatron/amy,vahtras/amy,swcarpentry/amy,wking/swc-amy,wking/swc-amy,swcarpentry/amy | workshops/migrations/0026_auto_20141220_1537.py | workshops/migrations/0026_auto_20141220_1537.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('workshops', '0025_person_slug'),
]
operations = [
migrations.AlterField(
model_name='event',
name='n... | mit | Python | |
6af1ae2f9dff8f81eb1833c533d81c8fdc39a625 | Add tools/ontology_graph.py | freedesktop-unofficial-mirror/zeitgeist__zeitgeist,freedesktop-unofficial-mirror/zeitgeist__zeitgeist,freedesktop-unofficial-mirror/zeitgeist__zeitgeist,freedesktop-unofficial-mirror/zeitgeist__zeitgeist,freedesktop-unofficial-mirror/zeitgeist__zeitgeist | tools/ontology_graph.py | tools/ontology_graph.py | #! /usr/bin/env python
# -.- coding: utf-8 -.-
# Zeitgeist - Ontology viewer
#
# Copyright © 2012 Collabora Ltd.
# By Siegfried-Angel Gevatter Pujals <siegfried@gevatter.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public ... | lgpl-2.1 | Python | |
ddabc74b357086e7d49adca6f50ee25980a6551f | add coinformation | dit/dit,Autoplectic/dit,dit/dit,Autoplectic/dit,dit/dit,Autoplectic/dit,Autoplectic/dit,chebee7i/dit,chebee7i/dit,dit/dit,chebee7i/dit,dit/dit,chebee7i/dit,Autoplectic/dit | dit/algorithms/coinformation.py | dit/algorithms/coinformation.py | """
The co-information.
"""
from iterutils import flatten, powerset
from .shannon import conditional_entropy as H
def coinformation(dist, rvs=None, crvs=None, rv_names=None):
"""
Parameters
----------
dist : Distribution
The distribution from which the total correlation is calculated.
rvs... | bsd-3-clause | Python | |
1cce098b349eefe9ab23637902c3266f7e52ebfd | Add Recipe class - Created Recipe.py that holds the Recipe class. - The Recipe class represents a recipe for a particular dish which includes a list of ingredients, nutritional information, etc. | VictorLoren/pyRecipeBook | Recipe.py | Recipe.py | # Recipe object
class Recipe:
# Initiate object
def __init__(self,name,info,ingredients=[],steps=[]):
self.name = name #name of recipe
self.info = info #other recipe info (calories,servings,etc.?)
self.steps = steps #list of steps
self.ingredients = in... | mit | Python | |
bedb51e6d22b844b4c1a332e18ada1a514bdd072 | add Program to find LCS | salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook | Algorithms/LCS.py | Algorithms/LCS.py | #Program to find Longest common subsequence
# Input format
# first line of input contains 2 integer length of 2 sequences
# next 2 line each contain n and m integer
# Output format
# output prints the longest common subsequence
def LCS(X, n, Y, m):
list1 = [[0 for i in xrange(m + 1)] for j in xrange(n + 1)]
... | mit | Python | |
2ed4884eeb3b5a30144a24082ae8018d9813ab43 | Add policies module | WeAreCloudar/troposphere,micahhausler/troposphere,ccortezb/troposphere,yxd-hde/troposphere,craigbruce/troposphere,horacio3/troposphere,DualSpark/troposphere,cryptickp/troposphere,johnctitus/troposphere,garnaat/troposphere,ikben/troposphere,horacio3/troposphere,Yipit/troposphere,pas256/troposphere,nicolaka/troposphere,L... | troposphere/policies.py | troposphere/policies.py | from . import AWSProperty, validate_pausetime
from .validators import positive_integer, integer, boolean
class AutoScalingRollingUpdate(AWSProperty):
props = {
'MaxBatchSize': (positive_integer, False),
'MinInstancesInService': (integer, False),
'PauseTime': (validate_pausetime, False),
... | bsd-2-clause | Python | |
cd4380577061bd3e10c72926db80a830f3e90100 | Add initial unit test for openstack cloud module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/cloud/clouds/openstack_test.py | tests/unit/cloud/clouds/openstack_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Bo Maryniuk <bo@suse.de>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import TestCase
from salt.cloud.clouds import openstack
from salttesting.mock import MagicMock, patch
from tests.unit.cloud.clouds ... | apache-2.0 | Python | |
04c2610b9acb25fbce899ed4cc140605c14f0582 | Create AudioFile.py | dabraude/PYSpeechLib | Base/AudioFile.py | Base/AudioFile.py | # Contains file that can be heard, not parameters
class AudioFile:
def self.__init__():
self.name = ''
| apache-2.0 | Python | |
dc977d929802695d158f3b254f71a09c10bcbf26 | Add main program file | PixelSergey/OrganicCompounder | main.py | main.py | print("initializing")
| mit | Python | |
8dff1ee566f2be176a05f9b67a7bf1bdd65bfaad | Add year search support | OrganicIrradiation/scholarly | main.py | main.py | import scholarly
import pandas as pd
from tqdm import tqdm
import time
import random
year_since = 2019 # Format: YYYY
year_to = None # Format: year_to should be no less than year_since
result_items = 20
energy_terms = [
'Wind',
# 'Solar',
# 'Power system',
# 'Energy',
# 'Generator',
# 'Coa... | unlicense | Python | |
2e798d9a5472b4bd948807f3b264fcdbfa2b0fc7 | Add main program | le1ia/slackmoji | main.py | main.py | # pylint: disable = C0103, C0111
# Standard Library
import argparse
# Project Library
from src.slackmoji import download_emojis, list_emojis
# CLI Args
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-f', '--folder', help="Image output folder", default='i... | mit | Python | |
558595dd90df8a1460c5d2797253bb2062518bb3 | Add screen recording tool | SummerLW/Perf-Insight-Report,benschmaus/catapult,catapult-project/catapult-csm,sahiljain/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,catapult-project/catapult-csm,sahiljain/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult,sahiljain/catapult,sahiljain/catapult,benschmaus/catapult,c... | telemetry/telemetry/core/platform/profiler/android_screen_recorder_profiler.py | telemetry/telemetry/core/platform/profiler/android_screen_recorder_profiler.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
from telemetry.core import util
from telemetry.core.backends.chrome import android_browser_finder
from telemetry.core.platform i... | bsd-3-clause | Python | |
40150d9de0a3a618e9def9184644115387095ace | Create main.py | vleseg/chaplin | main.py | main.py | import yaml
from itertools import chain
class Answer:
def __init__(self, source):
self.aid = source["id"]
self.text = source["text"]
self.short = source["short"]
class Question:
def __init__(self, source):
self.aid_to_answer_mapping = {}
self.text = source["tex... | apache-2.0 | Python | |
37c5e1bc43bf8dced596c4749a03bbbf40cf8617 | Create main.py | AALEKH/Image-Search-Engine,AALEKH/Image-Search-Engine | main.py | main.py | import cv2
import sys
import copy
import numpy
import os
import cv
import os.path
#imagePath = "hand.jpeg"
imagePath = sys.argv[1]
# Read the haar cascade classifier file
faceCascade = cv2.CascadeClassifier('haarcascade_hand.xml')
haarFace = cv.Load('haarcascade_frontalface_default.xml')
haarEyes = cv.Load('haarcascad... | mit | Python | |
b0b14c028e32220c99a98b9897b24360795d3439 | Create Search.py | henfredemars/python-personal-projects | PyArchive/Search.py | PyArchive/Search.py | #!/usr/bin/python3
# Tool to help searching the database of emails
import argparse
import sqlite3
import re
# Arguments
parser = argparse.ArgumentParser(description='Interactive SQLite3 Search Tool')
parser.add_argument('fname',action='store',nargs=1,help='Database file',
metavar='FILE')
args = vars(parser.parse_a... | mit | Python | |
aead9477b1e02aa884a284aaabd1bf446f591106 | add file for miscelaneous utilities | idies/pyJHTDB,idies/pyJHTDB,idies/pyJHTDB,idies/pyJHTDB | misc.py | misc.py | import numpy
import scipy
import scipy.spatial
def points_on_sphere(
N,
origin = numpy.zeros(3),
radius = 1.):
""" Generate N evenly distributed points on the unit sphere centered at
the origin. Uses the 'Golden Spiral'.
Code by Chris Colbert from the numpy-discussion list.
... | apache-2.0 | Python | |
b0d03620eb810675b8c2864794e106bfdafd1da1 | Solve p045 | piohhmy/euler | p045.py | p045.py | '''
Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:
Triangle Tn=n(n+1)/2 1, 3, 6, 10, 15, ...
Pentagonal Pn=n(3n−1)/2 1, 5, 12, 22, 35, ...
Hexagonal Hn=n(2n−1) 1, 6, 15, 28, 45, ...
It can be verified that T285 = P165 = H143 = 4075... | mit | Python | |
df5ee98d6a2e39318e76f67afb4b02cd8e48def1 | Add helper for HTTP/2 SSL context | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | py/http2/http2/utils.py | py/http2/http2/utils.py | __all__ = [
'make_ssl_context',
]
import ssl
def make_ssl_context(crt, key):
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
ssl_context.load_cert_chain(crt, key)
if ssl.HAS_ALPN:
ssl_context.set_alpn_protocols(['h2'])
else:
asserts.precond(ssl.HAS_NPN)
ssl_context.set_... | mit | Python | |
4f4c45adeadff930871e06fc2ab58c28402938e1 | Create retrieve_data.py | karanjeets/CSCI-544,karanjeets/CSCI-544 | python/retrieve_data.py | python/retrieve_data.py | import tweepy
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import json
import goslate
import sys
from translate import translator
import urllib2
import jsonpickle
reload(sys)
sys.setdefaultencoding("utf-8")
#consumer key, consumer secret, access token, access s... | apache-2.0 | Python | |
755db337aa41e32bcf7189bff7656e9b99c864cb | add 2 usefull functions | FeodorM/some_code,FeodorM/some_code,FeodorM/some_code | neural_networks/first.py | neural_networks/first.py | #!/usr/bin/env python3
import numpy as np
from numpy.linalg import inv
from urllib.request import urlopen
def data_from_url(url, skiprows=1, delimiter=',' **kwargs):
return laodtxt(
urlopen(url),
skiprows=skiprows,
delimiter=delimiter,
**kwargs
)
def coeffs(x, y):
return i... | mit | Python | |
5a53a089d6c54adeb2303f7ca90913fab0202ee5 | add partial is_unitary method using arrays | cjwfuller/quantum-circuits | gate.py | gate.py | import numpy as np
class QuantumGate:
def __init__(self, matrix):
self.matrix = matrix
if(not self.is_unitary()):
raise Exception("Supplied matrix is not unitary")
def is_unitary(self):
shape = np.shape(self.matrix)
# unitary matrixes should have dimension n * n
... | mit | Python | |
76b7da157e42aa8cd228242e5ecd491a508d6a8d | Add polling test. | yxd-hde/lambda-poll-update-delete,yxd-hde/lambda-poll-update-delete,yxd-hde/lambda-poll-update-delete | py-tornado-botocore/poll-test.py | py-tornado-botocore/poll-test.py | from tornado.ioloop import IOLoop
from tornado_botocore import Botocore
import botocore
from poll import Poll
import logging
logging.getLogger(
'botocore.vendored.requests.packages.urllib3.connectionpool'
).setLevel(logging.CRITICAL)
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
session =... | mit | Python | |
9bfbce5bef479b1cf8242423c6f50ab11a233162 | Add event sample | fbraem/mqweb,fbraem/mqweb,fbraem/mqweb | samples/python/event.py | samples/python/event.py | '''
This sample will read all event messages from queue SYSTEM.ADMIN.CONFIG.EVENT
and show all events that are related to queues.
MQWeb runs on localhost and is listening on port 8081.
'''
import sys
import json
import httplib
import socket
if len(sys.argv) < 2 :
print 'Please pass me the name of a queuemanager ... | mit | Python | |
a8fdd25ff38a2e9419460320089f1bca98197f3c | add tests for add_username_hint_to_login_url | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sso/tests/test_url_helpers.py | corehq/apps/sso/tests/test_url_helpers.py | from django.test import RequestFactory, TestCase
from corehq.apps.sso.models import AuthenticatedEmailDomain
from corehq.apps.sso.tests import generator
from corehq.apps.sso.utils.url_helpers import add_username_hint_to_login_url
class TestAddUsernameHintToLoginUrl(TestCase):
@classmethod
def setUpClass(cls... | bsd-3-clause | Python | |
b3a72c1283ac678b6e7d3b4c3123791fc978d0d9 | Create test_server.py | bigdig/vnpy,bigdig/vnpy,andrewchenshx/vnpy,msincenselee/vnpy,andrewchenshx/vnpy,vnpy/vnpy,msincenselee/vnpy,msincenselee/vnpy,bigdig/vnpy,bigdig/vnpy,andrewchenshx/vnpy,msincenselee/vnpy,andrewchenshx/vnpy,vnpy/vnpy,andrewchenshx/vnpy | vnpy/rpc/test_server.py | vnpy/rpc/test_server.py | from __future__ import print_function
from __future__ import absolute_import
from time import sleep, time
from .vnrpc import RpcServer
class TestServer(RpcServer):
"""
Test RpcServer
"""
def __init__(self, rep_address, pub_address):
"""
Constructor
"""
super(TestS... | mit | Python | |
7e756762510ddb4ce2302e99943f0fa7b69ba0f3 | add serializer for model Tag | 2-B/stickerview,chaostreff-bern/stickerview,2-B/stickerview,chaostreff-bern/stickerview,chaostreff-bern/stickerview | api_v1/serializers.py | api_v1/serializers.py | # -*- coding: utf-8 -*-
from rest_framework_json_api.serializers import ModelSerializer
from api_v1 import models
class TagSerializer(ModelSerializer):
class Meta:
model = models.Tag
fields = [
'name',
]
| agpl-3.0 | Python | |
927373595fb54ff41c54d00291123dca434eb4fd | add alephEntity to relation to distinguish multiple parts. | alephdata/aleph,OpenGazettes/aleph,pudo/aleph,alephdata/aleph,gazeti/aleph,alephdata/aleph,OpenGazettes/aleph,gazeti/aleph,OpenGazettes/aleph,smmbllsm/aleph,gazeti/aleph,smmbllsm/aleph,gazeti/aleph,pudo/aleph,OpenGazettes/aleph,smmbllsm/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph | aleph/graph/entities.py | aleph/graph/entities.py | import logging
import fingerprints
from py2neo import Node, Relationship
from aleph.model import Entity
from aleph.graph.db import get_graph, Vocab
from aleph.graph.collections import load_collection
log = logging.getLogger(__name__)
def load_entities():
tx = get_graph().begin()
for entity in Entity.all():
... | import logging
import fingerprints
from py2neo import Node, Relationship
from aleph.model import Entity
from aleph.graph.db import get_graph, Vocab
from aleph.graph.collections import load_collection
log = logging.getLogger(__name__)
def load_entities():
tx = get_graph().begin()
for entity in Entity.all():
... | mit | Python |
502d75e016e2a700b50002fa43f2a51d8c73df99 | Create first_two.py | dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey | Python/CodingBat/first_two.py | Python/CodingBat/first_two.py | # http://codingbat.com/prob/p184816
def first_two(str):
if len(str) < 2:
return str
else:
return str[0:2]
| mit | Python | |
3a07c4eb4164e7e1376d56f718db3b235ecf912c | Add description to policies in tenant_networks.py | klmitch/nova,klmitch/nova,mahak/nova,rahulunair/nova,jianghuaw/nova,mikalstill/nova,mahak/nova,phenoxim/nova,gooddata/openstack-nova,Juniper/nova,mikalstill/nova,Juniper/nova,Juniper/nova,gooddata/openstack-nova,gooddata/openstack-nova,phenoxim/nova,Juniper/nova,rajalokan/nova,jianghuaw/nova,rajalokan/nova,openstack/no... | nova/policies/tenant_networks.py | nova/policies/tenant_networks.py | # Copyright 2016 Cloudbase Solutions Srl
# 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.org/licenses/LICENSE-2.0
#
# Unless r... | # Copyright 2016 Cloudbase Solutions Srl
# 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.org/licenses/LICENSE-2.0
#
# Unless r... | apache-2.0 | Python |
18c7eccf08e76c5a99400fcf67b6e1a1a25d9f25 | add more logging when there are errors | seatgeek/graphite-pager,ProsperWorks/graphite-pager,ProsperWorks/graphite-pager,seatgeek/graphite-pager | graphitepager/graphite_data_record.py | graphitepager/graphite_data_record.py | """Data record for a single metric of Graphite data"""
class NoDataError(ValueError):
pass
class GraphiteDataRecord(object):
def __init__(self, metric_string):
meta, data = metric_string.split('|')
self.target, start_time, end_time, step = meta.rsplit(',', 3)
self.start_time = int(s... | """Data record for a single metric of Graphite data"""
class NoDataError(ValueError):
pass
class GraphiteDataRecord(object):
def __init__(self, metric_string):
meta, data = metric_string.split('|')
self.target, start_time, end_time, step = meta.rsplit(',', 3)
self.start_time = int(s... | bsd-2-clause | Python |
f7e465e91d1b1a1eeeda7be0a213617a7d19f97d | Add 66-plus-one.py | mvj3/leetcode | 66-plus-one.py | 66-plus-one.py | """
Question:
Plus One
Given a non-negative number represented as an array of digits, plus one to the number.
The digits are stored such that the most significant digit is at the head of the list.
Performance:
1. Total Accepted: 66486 Total Submissions: 216562 Difficulty: Easy
2. Your runtime bea... | mit | Python | |
67591d947ae0addfe93d37c4c2733fd770f73f67 | add system tests for mTLS testing (#88) | googleapis/python-bigquery-datatransfer,googleapis/python-bigquery-datatransfer | tests/system.py | tests/system.py | # -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python | |
80c5c997d25f352defbd733e7c492c0dbb8d1e63 | Update __init__.py | not-napoleon/schematics,promptworks/schematics,kstrauser/schematics,mlyundin/schematics,NerdWallet/schematics,not-napoleon/schematics,ee08b397/schematics,eatfirst/schematics,ee08b397/schematics,promptworks/schematics,kaiix/schematics,openprocurement/schematics,kstrauser/schematics | schematics/__init__.py | schematics/__init__.py |
version_info = ('1', '0', '1')
__version__ = '{0}.{1}-{2}'.format(*version_info)
|
version_info = ('1', '0', '0')
__version__ = '{0}.{1}-{2}'.format(*version_info)
| bsd-3-clause | Python |
a937b0c17228748c9befd16245655d4055d68a1a | Correct allfon usage description text | ValdikSS/aceproxy,pepsik-kiev/aceproxy,cosynus/python | plugins/allfon_plugin.py | plugins/allfon_plugin.py | '''
Allfon.tv Playlist Downloader Plugin
http://ip:port/allfon
'''
import re
import logging
import urllib2
import time
from modules.PluginInterface import AceProxyPlugin
from modules.PlaylistGenerator import PlaylistGenerator
import config.allfon as config
class Allfon(AceProxyPlugin):
# ttvplaylist handler is o... | '''
Allfon.tv Playlist Downloader Plugin
http://ip:port/ttvplaylist
'''
import re
import logging
import urllib2
import time
from modules.PluginInterface import AceProxyPlugin
from modules.PlaylistGenerator import PlaylistGenerator
import config.allfon as config
class Allfon(AceProxyPlugin):
# ttvplaylist handler... | mit | Python |
e49af7696d249851ef1715f30494f8cb043a4a8b | Create poop.py | UmbleC/twitterbot | poop.py | poop.py | import tweepy
from secrets import *
from random import choice
import os
import re
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
tweeted_file = os.path.join(__location__, "tweeted_users.txt")
data = {'like':
{'queries': ['"poop"'],
'responses': ['I like ... | mit | Python | |
2ce051b042d96b03cd5da6844d089ed18b238c7e | Add LoginForm | FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management | precision/accounts/forms.py | precision/accounts/forms.py | from django import forms
class LoginForm(forms.Form):
email = forms.CharField(widget=forms.EmailInput)
password = forms.CharField(widget=forms.PasswordInput)
| mit | Python | |
9244e9d17ed57e1848bf52566d401e19c2cde8b7 | Add tests for some shop POIs | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | integration-test/491-feature-tests.py | integration-test/491-feature-tests.py | from . import FixtureTest
class FeaturesTest(FixtureTest):
def test_shops(self):
self._run_test(
'http://www.openstreetmap.org/node/2893904480',
'16/19299/24631', {'kind': 'bakery'})
self._run_test(
'http://www.openstreetmap.org/node/886395953',
'16/... | mit | Python | |
84ebf3a29d015247f3ee42722a42050f246f4d48 | Make activity report every hour instead of 30 minutes | quasar-analytics/quasar,slamdata/slamengine,quasar-analytics/quasar,djspiewak/quasar,slamdata/slamengine,quasar-analytics/quasar,drostron/quasar,drostron/quasar,quasar-analytics/quasar,drostron/quasar,jedesah/Quasar,slamdata/slamengine,jedesah/Quasar,drostron/quasar,slamdata/quasar,jedesah/Quasar,jedesah/Quasar | scripts/newActivity.py | scripts/newActivity.py | #!/usr/bin/env python
from datetime import datetime
from pymongo import MongoClient
import re
from subprocess import call
import sys
# minutes
window = 60
if len(sys.argv) != 2:
print 'Usage: %s <logfile>' % sys.argv[0]
sys.exit(1)
now = datetime.now()
logformat = re.compile('(\d{4}-\d\d-\d\d \d\d:\d\d:\d\... | #!/usr/bin/env python
from datetime import datetime
from pymongo import MongoClient
import re
from subprocess import call
import sys
# minutes
window = 30
if len(sys.argv) != 2:
print 'Usage: %s <logfile>' % sys.argv[0]
sys.exit(1)
now = datetime.now()
logformat = re.compile('(\d{4}-\d\d-\d\d \d\d:\d\d:\d\... | apache-2.0 | Python |
332bf09d916fac5af66087f2e797752b6bcededf | Create read.py | mduranmustafa/Python,mduranmustafa/Python | read.py | read.py | __author__ = 'mustafaduran'
import numpy
def TSV_Read(Input_File):
dosya=open(Input_File,"r")
indis=0
target=list()
sample=list()
for line in dosya:
satir= line.split()
target.append(satir[0])
sample.append(satir[1])
indis=indis+1
# print Dosya.read()
return (s... | epl-1.0 | Python | |
617b5e012f12ef05c82460ee0e1e55da5d5fb020 | Add a sample self-contained IWikiSyntaxParser plugin, implementing the link revision syntax suggested in #5154. | rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac | sample-plugins/revision_links.py | sample-plugins/revision_links.py | """Sample Wiki syntax extension plugin."""
from genshi.builder import tag
from trac.core import *
from trac.util.text import shorten_line
from trac.versioncontrol.api import NoSuchChangeset
from trac.versioncontrol.web_ui import ChangesetModule
from trac.wiki.api import IWikiSyntaxProvider
class RevisionLinks(Compon... | bsd-3-clause | Python | |
92946362496f950a28357f3dee44b936cc59909a | Add standings checker to prevent friendly fire | lizthegrey/nrds-tools | StandingsCheck.py | StandingsCheck.py | #!/usr/bin/python
from eveapi import eveapi
import ChatKosLookup
import sys
class StandingsChecker:
def __init__(self, keyID, vCode):
self.checker = ChatKosLookup.KosChecker()
self.eveapi = self.checker.eveapi.auth(keyID=keyID, vCode=vCode)
def check(self):
contacts = self.eveapi.char.ContactList()
... | mit | Python | |
edd6233770e24a9b241e7e275c995543b8d7eadc | Create trends.py | Semyonic/RaspberryPi-Projects,Semyonic/RaspberryPi-Projects,Semyonic/RaspberryPi-Projects | Twitter/trends.py | Twitter/trends.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import tweepy
import json
trends = raw_input("Enter hashtag for search : ")
consumerKey = 'yourKey'
consumerSecret = 'yourSecret'
accessKey = 'yourKey'
accessSecret = 'yourSecret'
auth = tweepy.OAuthHandler(consumerKey, consumerSecret)
auth.set_acces... | mit | Python | |
83f544572420c4b175b896dc0d6fb17d0deb6156 | Add some tests | swarmer/fridge,swarmer/fridge | test.py | test.py | import unittest
import io
from json import loads
from fridge import Fridge
class FridgeTest(unittest.TestCase):
def setUp(self):
self.buf = io.StringIO()
def rewind(self):
self.buf.seek(0)
def test_file(self):
with Fridge(file=self.buf) as fridge:
pass
self.... | mit | Python | |
0193455e7d32e685c88d38b7511e0fe3a10c6239 | add 12 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | p012.py | p012.py | from time import time
# FIXME: extremely inefficient (~4 hours)
def triangles():
i = 1
sum = 0
while True:
sum += i
i += 1
yield sum
def divisors(n):
count = 1
for i in xrange(1, n):
if n % i == 0:
count += 1
return count
start = time()
x = triang... | bsd-3-clause | Python | |
9e605e36c0c8c588f3b9ffa12cf8b64b45222199 | Add simple plotter | jonhoo/periscope,jonhoo/periscope | plot.py | plot.py | #!/usr/bin/env python3
import argparse
import numpy
import sys
import os
import os.path
import tempfile
import matplotlib
matplotlib.use('Agg') # avoid the need for X
import seaborn as sns
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('model',
type=argpars... | mit | Python | |
036908ce17a506e6b8eaee8878e2f376be729a80 | Add test module. | awd4/kmeans | test.py | test.py | from kmeans import test_cykmeans, test_kmeans, test_elkan
| mit | Python | |
c8010fd0bf0086b89a1ec5a0ccf0ccbcc87aaaf6 | Add test file | briglx/python-calibrate-sense-hat | test.py | test.py | #!/usr/bin/python
from calibrate_sense_hat import BlxSenseHat
from sense_hat import SenseHat
blxsense = BlxSenseHat()
sense = SenseHat()
for i in range(10):
blxsense.calibrate(i) | mit | Python | |
fac6f5853dad5d0554df5e0ea805d90de88a3073 | Test decision function on high order FM (test fails) | geffy/tffm | test.py | test.py | import unittest
import numpy as np
from tffm import TFFMClassifier
class TestFM(unittest.TestCase):
def setUp(self):
# Reproducibility.
np.random.seed(0)
self.X = np.random.rand(20, 10)
self.linear_weights = np.random.rand(10)
self.y = np.sign(self.X.dot(self.linear_weig... | mit | Python | |
a288086efd7e80d49be16155ad63e85bfd8bde00 | add test.py | xu-wang11/Pyww | test.py | test.py | #import parser
import ast
from llvm import *
from llvm.core import *
from llvm.ee import *
from llvm.passes import *
import sys
#compile function in python
#a function can be compiled directly means:
#(1)this function has no args
#(2)this function won't use variable out of the function block
def canFunctionBeCompiler... | mit | Python | |
40498051d4c5093633177e33e0f90b202275da4b | Create user.py | RgTqUg/lamia | user.py | user.py | import requests
import queries
import dmails
import wiki
from requests.auth import HTTPBasicAuth
class api(object):
def __init__(self, user, key):
self.user = user
self.key = key
def create_image(self, image_id):
image_table = requests.get(("http://danbooru.donmai.us/posts/" + image_id + ".json"), auth=HT... | mit | Python | |
0de3f7459bf3557671cf7d39b8da80743f20c4a1 | add example add_named_argument.py | iglocska/PyMISP,pombredanne/PyMISP | examples/add_named_attribute.py | examples/add_named_attribute.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
# For python2 & 3 compat, a bit dirty, but it seems to be the least bad one
try:
input = raw_input
except NameError:
pass
def init(url, key):
return PyMISP(url, key, True, 'json', ... | bsd-2-clause | Python | |
102855b8d3dc7258c68a1f2bac3bb4c8953732dc | Add utility to create administrative users. | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/scripts/adminuser.py | backend/scripts/adminuser.py | #!/usr/bin/env python
import rethinkdb as r
from optparse import OptionParser
import sys
def create_group(conn):
group = {}
group['name'] = "Admin Group"
group['description'] = "Administration Group for Materials Commons"
group['id'] = 'admin'
group['owner'] = 'admin@materialscommons.org'
grou... | mit | Python | |
39ebef241bcb3c3c02c4c29a4d2c7d28aeda45cf | add t-sne | neohanju/GarbageDumping,neohanju/GarbageDumping,neohanju/GarbageDumping,neohanju/GarbageDumping,neohanju/GarbageDumping | EventEncoder/clustering_latent_vectors.py | EventEncoder/clustering_latent_vectors.py | import os
import glob
import progressbar
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
from sklearn import manifold
from time import time
kLatentPath = '/home/mlpa/data_ssd/workspace/github/GarbageDumping/EventEncoder/training_results/0000-00-00_00-00-00/latents'
if "... | bsd-2-clause | Python | |
a452d21114269b6aab847faec763b8be534a7954 | Create limit-single-record.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | Django/limit-single-record.py | Django/limit-single-record.py | #http://stackoverflow.com/a/8094563
class MyModel(models.Model):
onefield = models.CharField('The field', max_length=100)
class MyModelAdmin(admin.ModelAdmin):
def has_add_permission(self, request):
# if there's already an entry, do not allow adding
count = MyModel.objects.all().count()
if count == ... | agpl-3.0 | Python | |
cd1b1d577d34160a19a77e481ed8dbe8c3366696 | print mandelbrot to console | mfwarren/FreeCoding,mfwarren/FreeCoding,mfwarren/FreeCoding | 2014/11/fc_2014_11_25.py | 2014/11/fc_2014_11_25.py | #!/usr/bin/env python
# imports go here
from __future__ import print_function
import math
#
# Free Coding session for 2014-11-25
# Written by Matt Warren
#
def mandelbrot(z, c, n=40):
if abs(z) > 1000:
return float('nan')
else:
if n > 0:
return mandelbrot(z**4+c, c, n-1)
el... | mit | Python | |
2f5976b2bd3c20b19a1fd63b948ccca741c9f5c4 | Refactor reilemulator module. | amohanta/barf-project,ignaeche/barf-project,bj7/barf-project,egyp7/barf-project,atsuyim/barf-project,gitttt/barf-project,amohanta/barf-project,chubbymaggie/barf-project,programa-stic/barf-project,atsuyim/barf-project,atsuyim/barf-project,programa-stic/barf-project,egyp7/barf-project,cnheitman/barf-project,bj7/barf-proj... | barf/barf/utils/utils.py | barf/barf/utils/utils.py | # Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... | # Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... | bsd-2-clause | Python |
5706398e736a758ff5cc0401b406aa657b195f28 | Add abusehelper.tools.receiver, a counterpart for abusehelper.tools.sender, for receiving events from a channel as JSON. | abusesa/abusehelper | abusehelper/tools/receiver.py | abusehelper/tools/receiver.py | import json
import idiokit
from abusehelper.core import bot, events
class Receiver(bot.XMPPBot):
room = bot.Param("""
The room for receiving events from
""")
@idiokit.stream
def main(self):
xmpp = yield self.xmpp_connect()
room = yield xmpp.muc.join(self.room)
yield i... | mit | Python | |
7e4ce287d20509fda9ae5857c9af42a2a3a0aaa3 | Create FeatureClassesToExcel.py | mitchh300/CustomTools | FeatureClassesToExcel.py | FeatureClassesToExcel.py | """
Date: 9/14/2018
Author: Mitch Holley
Version: 3.6.5
Edits:
Sources: https://joelmccune.com/arcgis-to-pandas-data-frame/
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.rename.html
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame... | unlicense | Python | |
fc1358835e7132f1807b016fe552e943a9b04b03 | Add SpeechMNIST Dataset Preprocesser | googleinterns/audio_synthesis | setup/preprocess_speech_mnist_dataset.py | setup/preprocess_speech_mnist_dataset.py | # Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python | |
059fb95d325ed84fd7faaf8a530d113cc14cbeb1 | Add serializers to user application | Rulox/codefett,Rulox/codefett,Rulox/codefett | codefett/users/serializers.py | codefett/users/serializers.py | from rest_framework import serializers
from .models import CFUser
class CFUserSerializer(serializers.ModelSerializer):
"""
Serializes a CFUser Model
"""
user__password = serializers.CharField(write_only=True, required=False)
class Meta:
model = CFUser
fields = ('id', 'user__email'... | agpl-3.0 | Python | |
a76baa01076c6c9f8e2fd5d21538c75eaa500d4c | add abstract progressbar type to use as base class for other progressbars | cgranade/qutip,anubhavvardhan/qutip,zasdfgbnm/qutip,zasdfgbnm/qutip,qutip/qutip,qutip/qutip,anubhavvardhan/qutip,cgranade/qutip | qutip/gui/progressbar.py | qutip/gui/progressbar.py | # This file is part of QuTiP.
#
# QuTiP 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 3 of the License, or
# (at your option) any later version.
#
# QuTiP is distributed in the ... | # This file is part of QuTiP.
#
# QuTiP 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 3 of the License, or
# (at your option) any later version.
#
# QuTiP is distributed in the ... | bsd-3-clause | Python |
7f404ce543e3c8b5a5d1ecfe025652efb1646b4e | Create 6kyu_transform_to_prime.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/6kyu/6kyu_transform_to_prime.py | Solutions/6kyu/6kyu_transform_to_prime.py | def minimum_number(numbers,add=0):
return add if isprime(sum(numbers)+add) else minimum_number(numbers,add+1)
def isprime(n):
return False if n<2 else True if n==2 else all(n%i!=0 for i in range(2,int(n**0.5)+1))
| mit | Python | |
03453a40aab2d3e7a955c29a3c849a810edd2e65 | Create challenge_1 | mindm/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,m181190/2017Challenges,erocs/2017Challenges,m181190/2017Challenges,mindm/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism... | challenge_1/python/zanetti/challenge_0.py | challenge_1/python/zanetti/challenge_0.py | a=list(input("Insert the you want to invert :")) #input to user choose the characteres to invert - in a list form
print('the choosen world: ', a)
a.reverse() #invert the "a" list
print('reversed: ', a)
| mit | Python | |
3b667787a932efdf2179bb8eb8a1654517e9a3e6 | Add xfailing test for #3289 | spacy-io/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,honnibal/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy | spacy/tests/regression/test_issue3289.py | spacy/tests/regression/test_issue3289.py | # coding: utf-8
from __future__ import unicode_literals
import pytest
from spacy.lang.en import English
@pytest.mark.xfail
def test_issue3289():
"""Test that Language.to_bytes handles serializing a pipeline component
with an uninitialized model."""
nlp = English()
nlp.add_pipe(nlp.create_pipe("textca... | mit | Python | |
ebb9a28063954c408030451c521b16bbd01af6b9 | add script to create metaprofiles with video analysis | Ziggeo/ZiggeoPythonSdk,Ziggeo/ZiggeoPythonSdk | demos/metaprofiles_create_with_video_analysis.py | demos/metaprofiles_create_with_video_analysis.py | import sys
from Ziggeo import Ziggeo
if(len(sys.argv) < 3):
print ("Error\n")
print ("Usage: $>python metaprofiles_create_with_video_analysis.py YOUR_API_TOKEN YOUR_PRIVATE_KEY METAPROFILE_TITLE\n")
sys.exit()
api_token = sys.argv[1]
private_key = sys.argv[2]
metaprofiles_title = sys.argv[3]
ziggeo = Zig... | apache-2.0 | Python | |
1efa9cc368aeff7e41a7962c7a16d9f094a3d6bc | Create employee-importance.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/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/... | Python/employee-importance.py | Python/employee-importance.py | # Time: O(n)
# Space: O(h)
# You are given a data structure of employee information,
# which includes the employee's unique id, his importance value and his direct subordinates' id.
#
# For example, employee 1 is the leader of employee 2, and employee 2 is the leader of employee 3.
# They have importance value 15, 10... | mit | Python | |
e88a02430ba116a1578c2c467a832be8db00be7d | add Python sample | RealityFactory/ogre,RealityFactory/ogre,RealityFactory/ogre,RealityFactory/ogre,RealityFactory/ogre | Samples/Python/sample.py | Samples/Python/sample.py | import Ogre
import OgreRTShader
class SGResolver(Ogre.MaterialManager_Listener):
def __init__(self, shadergen):
Ogre.MaterialManager_Listener.__init__(self)
self.shadergen = shadergen
def handleSchemeNotFound(self, idx, name, mat, lod_idx, rend):
if name != OgreRTShader.cvar.ShaderGene... | mit | Python | |
4ec87c35ed6603f1eafb540840a8f978ea87130c | Create Queue with pop and put | bewt85/jobqueue | argqueue/queue.py | argqueue/queue.py | import sqlite3 as sql
class Queue(object):
def __init__(self, db_filename):
self.con = sql.connect(db_filename)
self._create_tables()
def _create_tables(self):
with self.con:
cur = self.con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS "
"Arguments(Id INTEGER PRIMARY K... | mit | Python | |
3f1396f31c34dc0e929825b8a9e8ae186b9ffd7f | add solution for Implement strStr | zhyu/leetcode,zhyu/leetcode | src/implementStrStr.py | src/implementStrStr.py | class Solution:
# @param haystack, a string
# @param needle, a string
# @return an integer
def strStr(self, haystack, needle):
n, m = len(haystack), len(needle)
if n < m:
return -1
i = j = k = 0
while i+m <= n:
while j < m and haystack[k] == needl... | mit | Python | |
a097aef42255b963b91c54494355d34cdc7c08f7 | Add conversion script for single pop to numpy | rnowling/pop-gen-models | single-pop/singlepop2npy.py | single-pop/singlepop2npy.py | import sys
import numpy as np
def read_phi(flname, n_steps, n_loci):
sampled_phis = np.zeros((n_steps, n_loci))
fl = open(flname)
current_iter_idx = 0 # index used for storage
last_iter_idx = 0 # index used to identify when we finish a step
for ln in fl:
cols = ln.strip().split()
iter_idx = int(cols[0])
loc... | apache-2.0 | Python | |
1c1167edeb4e436aa4b331c4af1e4b5bee796ee8 | Create exec-5.py | rafa-impacta/Exercicio | exec-5.py | exec-5.py | espaco = open ("espaco.txt", "w")
for i in range (1):
espaco.write('''ACME Inc. Uso do espaço em disco pelos usuários
------------------------------------------------------------------------
Nr. Usuário Espaço utilizado % do uso
1 alexandre 434,99 MB 16,85%
2 anderson 1187,99 MB 46,02%
3 antonio 117,73 MB 4,56%
4 c... | apache-2.0 | Python | |
4c5137792f9333f8f7ffd0d8701378d199b5bafd | add random app icon color | typemytype/RoboFontExamples | UI/randomColorAppIcon.py | UI/randomColorAppIcon.py | from AppKit import *
from lib.tools.misc import randomColor
# get the application icon image
icon = NSApp().applicationIconImage()
# get the size
w, h = icon.size()
# make a rect with the size of the image
imageRect = NSMakeRect(0, 0, w, h)
# create a new image with the same size
new = NSImage.alloc().initWithSize_((w... | mit | Python | |
3236e1dc9624a4e4a2770cf463e8f366e4eb7cde | Add a* tree search algorithm using misplaced tiles heuristic | mahdavipanah/pynpuzzle | algorithms/a_star_tree_misplaced_tiles.py | algorithms/a_star_tree_misplaced_tiles.py | """
pynpuzzle - Solve n-puzzle with Python
A* tree search algorithm using misplaced tiles heuristic
Version : 1.0.0
Author : Hamidreza Mahdavipanah
Repository: http://github.com/mahdavipanah/pynpuzzle
License : MIT License
"""
import heapq
from .util import best_first_seach as bfs
def search(state, goal_state):
... | mit | Python | |
af2f840e3f6c97cbdbc3f14589767c2f8674473f | Add Cluster + Node | jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools | problem/amzn/k8s/db/get_nodes.py | problem/amzn/k8s/db/get_nodes.py | #! /usr/bin/env python
# Copyright 2021 John Hanley.
#
# 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, me... | mit | Python | |
56b3225e43530cff8640b0e1d50824f556b839da | add test build | KarrLab/kinetic_datanator,KarrLab/kinetic_datanator | builds/build_test.py | builds/build_test.py | from kinetic_datanator.core import common_schema
cs = common_schema.CommonSchema(load_content=True, clear_content=True, verbose=True, test=True)
| mit | Python | |
9f5e11f789c01e3a6da0ff2c7376c4ead2741a6a | Add tests for the includeme/settings | usingnamespace/pyramid_authsanity | pyramid_authsanity/tests/test_includeme.py | pyramid_authsanity/tests/test_includeme.py | import pytest
from pyramid.authorization import ACLAuthorizationPolicy
import pyramid.testing
from zope.interface import (
Interface,
implementedBy,
providedBy,
)
from zope.interface.verify import (
verifyClass,
verifyObject
)
from pyramid_services import IServiceClassifier
from... | isc | Python | |
9f7730addab91057d2962be08d044680d0b8225f | Add timing system. | N3X15/python-build-tools,N3X15/python-build-tools,N3X15/python-build-tools | buildtools/timing.py | buildtools/timing.py | '''
Created on Mar 26, 2015
@author: Rob
'''
import time, sys, yaml, os, logging, math
def clock():
if sys.platform == 'win32':
return time.clock()
else:
return time.time()
class IDelayer(object):
def __init__(self, id, min_delay=0):
self.id = id
self.minDelay = min_d... | mit | Python | |
a0d96eda30444939a19932fc5053fded775330ad | Add first pass at | sesh/ghostly,sesh/ghostly | fright.py | fright.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import time
import random
from subprocess import Popen, PIPE
@click.command()
@click.argument('ghostly_files', type=str, nargs=-1, required=True)
@click.option('--workers', default=2, type=int)
@click.option('--rand-wait', default=True, type=bool)
def run_f... | isc | Python | |
6999f0e1cf73aeaeaf5548199f38fde1918262bf | add python example to use with --env python *.py | Urucas/cordova-test,Urucas/cordova-test,Urucas/cordova-test | example/tests/python/1_index_test.py | example/tests/python/1_index_test.py | import os
from time import sleep
import unittest
import argparse
import json
import re
from appium import webdriver
PATH = lambda p: os.path.abspath(
os.path.join(os.path.dirname(__file__), p)
)
class CordovaAppTests(unittest.TestCase):
def appiumHost(self, caps):
url=""
if re.match("http:/... | mit | Python | |
b7f3eeb79ced2dd74e1599c0ad13c52d1f0c80a6 | add some "local" database connection | joaoleveiga/django-wsgi-example,joaoleveiga/django-wsgi-example | myproj/myproj/local_settings.py | myproj/myproj/local_settings.py | DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test',
'USER': 'test',
'PASSWORD': 'test'
}
}
| mit | Python | |
b75f2e2c24794e954d36f102a4163e46e78742e0 | add new package : busybox@1.31.1 (#13871) | iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/busybox/package.py | var/spack/repos/builtin/packages/busybox/package.py | # Copyright 2013-2019 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 Busybox(MakefilePackage):
"""BusyBox combines tiny versions of many common UNIX utilities ... | lgpl-2.1 | Python | |
a130e022d85187383f9320ce2abebe4701f5e950 | add unicode helper module with unicode csv readers | DanielNeugebauer/adhocracy,phihag/adhocracy,SysTheron/adhocracy,alkadis/vcv,alkadis/vcv,phihag/adhocracy,alkadis/vcv,liqd/adhocracy,liqd/adhocracy,liqd/adhocracy,phihag/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,SysTheron/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,liqd/adhocracy,DanielNeugebauer/adhocr... | adhocracy/lib/unicode.py | adhocracy/lib/unicode.py | '''
helper module which provides unicode related stuff.
'''
import csv
class UnicodeCsvReader(object):
"""
unicode aware csv.CsvReader.
thanks to http://stackoverflow.com/a/6187936/201743
"""
def __init__(self, f, encoding="utf-8", **kwargs):
self.csv_reader = csv.reader(f, **kwargs)
... | agpl-3.0 | Python | |
8acc4ba5b0536ebf72519bb0480d153cf4c8ed65 | store model params in Params class | mattsmart/biomodels,mattsmart/biomodels,mattsmart/biomodels | oncogenesis_dynamics/python/params.py | oncogenesis_dynamics/python/params.py | import numpy as np
from constants import ODE_SYSTEMS, PARAMS_ID
from data_io import read_params, write_params
class Params(object):
def __init__(self, params, system, init_cond=None):
alpha_plus, alpha_minus, mu, a, b, c, N, v_x, v_y, v_z, mu_base = params
# vector of params
self.params ... | mit | Python | |
6aab268f697a2cbdc39aa6ccf59801bd04068626 | Add example code to use stream from network | benizl/pymoku,liquidinstruments/pymoku | examples/livestream_datalogger.py | examples/livestream_datalogger.py | from pymoku import Moku, MokuException
from pymoku.instruments import *
import time, logging, traceback
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.DEBUG)
# Use Moku.get_by_serial() or get_by_name() if you don't know the IP
m = Moku('192.1... | mit | Python | |
5102823fe7989b03bb63229f05c6be48a3fcffb3 | Add program to calculate minimum number of steps from any cell to the goal: | Deborah-Digges/SDC-ND-term-3,Deborah-Digges/SDC-ND-term-3,Deborah-Digges/SDC-ND-term-3,Deborah-Digges/SDC-ND-term-3,Deborah-Digges/SDC-ND-term-3 | p1-path-planning/class-notes/value.py | p1-path-planning/class-notes/value.py | # ----------
# User Instructions:
#
# Create a function compute_value which returns
# a grid of values. The value of a cell is the minimum
# number of moves required to get from the cell to the goal.
#
# If a cell is a wall or it is impossible to reach the goal from a cell,
# assign that cell a value of 99.
# -------... | apache-2.0 | Python | |
adf46e28322b5653f35f48a7ec41c53deb258a2a | put placeholder in place for mock.brighttime | desihub/desitarget,desihub/desitarget | py/desitarget/mock/brighttime.py | py/desitarget/mock/brighttime.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
===========================
desitarget.mock.brighttime
===========================
Builds target/truth files from already existing mock data
"""
from __future__ import (absolute_import, division)
#
import numpy as np
import fit... | bsd-3-clause | Python | |
de9c73bacc245eecfe398f6b38ee73a4c92dacde | Add base_test which adds a scientific BaseTestCase | scottclowe/python-ci,scottclowe/python-continuous-integration,scottclowe/python-ci,scottclowe/python-continuous-integration | package_name/tests/base_test.py | package_name/tests/base_test.py | """
Provides a base test class for other test classes to inherit from.
Includes the numpy testing functions as methods.
"""
import unittest
import numpy as np
from numpy.testing import (assert_almost_equal,
assert_approx_equal,
assert_array_almost_equal,
... | mit | Python | |
bba193af6d8e47efd3b2145cd9345e1e95e12ff4 | Create classical_variant.py | Strilanc/NP-vs-Quantum-Simulation-Walters-Algorithm | classical_variant.py | classical_variant.py | import math
import random
from collections import namedtuple
Term = namedtuple('Term', ['index', 'target'])
def is_clause_satisfied_by(clause, vars):
return any(vars[term.index] == term.target for term in clause)
def all_clauses_satisfied_by(clauses, vars):
return all(is_clause_satisfied_by(clause, vars) f... | apache-2.0 | Python | |
95aa5c14168ec8193df3518534b0704daaa839e3 | Put greeting in helper class | tahiyasalam/cs3240-labdemo | helper.py | helper.py | def greeting(msg):
print(msg)
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.