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 |
|---|---|---|---|---|---|---|---|---|
803201baa32fb847f363b6807f92f2d0b6a51c51 | Test that an error in pre_gen_project aborts generation | audreyr/cookiecutter,stevepiercy/cookiecutter,stevepiercy/cookiecutter,michaeljoseph/cookiecutter,willingc/cookiecutter,Springerle/cookiecutter,hackebrot/cookiecutter,hackebrot/cookiecutter,pjbull/cookiecutter,michaeljoseph/cookiecutter,audreyr/cookiecutter,Springerle/cookiecutter,terryjbates/cookiecutter,terryjbates/c... | tests/test_abort_generate_on_hook_error.py | tests/test_abort_generate_on_hook_error.py | # -*- coding: utf-8 -*-
import pytest
from cookiecutter import generate
from cookiecutter import exceptions
@pytest.mark.usefixtures('clean_system')
def test_pre_gen_hook(tmpdir):
context = {
'cookiecutter': {
"repo_dir": "foobar",
"abort_pre_gen": "yes",
"abort_post_... | bsd-3-clause | Python | |
b079edc37cd8abb68194637ee90b9fecc51b9b98 | Add basic test for document quickcaching | qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/cachehq/tests.py | corehq/apps/cachehq/tests.py | from copy import deepcopy
from mock import patch, MagicMock
from django.test import SimpleTestCase
from dimagi.ext import couchdbkit as couch
from corehq.apps.cachehq.mixins import CachedCouchDocumentMixin
class BlogPost(CachedCouchDocumentMixin, couch.Document):
title = couch.StringProperty()
body = couch.St... | bsd-3-clause | Python | |
fa9421ef98d2dee2b9428d4165f5242aebe51a48 | create cliconf plugin for enos - enos.py (#31509) | thaim/ansible,thaim/ansible | lib/ansible/plugins/cliconf/enos.py | lib/ansible/plugins/cliconf/enos.py | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by
# Ansible still belong to the author of the module, and may assign their own
# license to the complete wo... | mit | Python | |
ce5ba72605e93e4fd83f36cced28d7c813c95e54 | Create myfile.py | iROCKBUNNY/myfile | myfile.py | myfile.py | import os
import re
def searchByExt(rootpath, ext):
print '----- File List -----'
results = []
for root, dirs, files in os.walk(rootpath):
for filename in files:
if re.search(r'.*\.%s' % ext, filename):
result = os.path.join(root, filename)
results.appen... | mit | Python | |
b159433375714c67ac36e58d4323196222759f30 | Add missing migration from 096092b. | cdubz/babybuddy,cdubz/babybuddy,cdubz/babybuddy | babybuddy/migrations/0003_add_refresh_help_text.py | babybuddy/migrations/0003_add_refresh_help_text.py | # Generated by Django 2.0.5 on 2018-07-15 14:16
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('babybuddy', '0002_add_settings'),
]
operations = [
migrations.AlterField(
model_name='settings',
nam... | bsd-2-clause | Python | |
0104f898a4a54027688411dd20d39aeecfc31f6d | Create player.py | Lincoln-Cybernetics/Explore- | player.py | player.py | import pygame
import ss
class Player(pygame.sprite.Sprite):
def __init__(self, level, *groups):
super(Player, self).__init__(*groups)
self.Rimg = pygame.image.load('RangerDanR.png')
self.Limg = pygame.image.load('RangerDanL.png')
self.image = self.Rimg
self.rect = pygame.rect.Rect((100,100), self.image.get_... | unlicense | Python | |
59fa328c62cc7808bce365ddb1e0e1c0d744913b | add a basic reader | towerjoo/RssRolls | reader.py | reader.py | import feedparser
rss_url = "http://towerjoo.github.io/feed.xml"
feed= feedparser.parse(rss_url)
import pdb;pdb.set_trace()
| mit | Python | |
49f8a3de02d2e479232c327a3f78409a2297e173 | Add a basic implementation of screen recording + audio | nirbheek/shell-recorder-enhanced | record.py | record.py | #!/usr/bin/env python3
# vim: set sts=4 sw=4 et tw=0 :
#
# Author: Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
# License: MIT
#
import sys, time
from gi.repository import Gio, GLib
def get_displays():
display_p = Gio.DBusProxy.new_for_bus_sync (Gio.BusType.SESSION,
Gio.DBusProxyFlags.NONE, None,
... | mit | Python | |
021bf311598350e6fa976f72456e218c74bddbc6 | Create mush.py | keithporcaro/mush | mush.py | mush.py | import base64
import os
import pygsm
import gzip #replace with 7zip (LZMA)
import uuid
import random
import string
import fnmatch
import time
import multiprocessing
#Python 2.x
#need modem info
#need to auto-detect modem
#need some sort of interface
#replace x separator with semicolon
#replace with port of GSM Modem
... | mit | Python | |
374f516be38e9630ff1ff6cda4146d0ebd2a9537 | remove model | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sms/migrations/0048_delete_sqlicdsbackend.py | corehq/apps/sms/migrations/0048_delete_sqlicdsbackend.py | # Generated by Django 2.2.13 on 2020-10-28 09:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sms', '0047_merge_20200918_1641'),
]
operations = [
migrations.DeleteModel(
name='SQLICDSBackend',
),
]
| bsd-3-clause | Python | |
536e15458090b88962a0fd906b8f6dabfbad73d4 | Add files via upload | gnublet/py_explorations,gnublet/py_explorations | sklearn/exercise_02_sentiment.py | sklearn/exercise_02_sentiment.py | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | mit | Python | |
0d7e702a5f04f1e9e544b4e99eb57f6a9ddeabbe | cover new utility function for revoked token cleanup | conorsch/securedrop,conorsch/securedrop,ehartsuyker/securedrop,heartsucker/securedrop,conorsch/securedrop,heartsucker/securedrop,ehartsuyker/securedrop,conorsch/securedrop,conorsch/securedrop,ehartsuyker/securedrop,ehartsuyker/securedrop,heartsucker/securedrop,ehartsuyker/securedrop,ehartsuyker/securedrop,heartsucker/s... | securedrop/tests/test_journalist_utils.py | securedrop/tests/test_journalist_utils.py | # -*- coding: utf-8 -*-
from flask import url_for
import os
import pytest
import random
from models import RevokedToken
from sqlalchemy.orm.exc import NoResultFound
from journalist_app.utils import cleanup_expired_revoked_tokens
os.environ['SECUREDROP_ENV'] = 'test' # noqa
from .utils.api_helper import get_api_head... | agpl-3.0 | Python | |
e41b79855e966977c4484efd4ad6a02475833b3e | Add ex4.4: tornado multiple requests with asyncio integration | MA3STR0/PythonAsyncWorkshop | code/ex4.4-tornado_with_asyncio.py | code/ex4.4-tornado_with_asyncio.py | from tornado.platform.asyncio import AsyncIOMainLoop, to_asyncio_future
from tornado.httpclient import AsyncHTTPClient
import asyncio
import time
URL = 'http://127.0.0.1:8000'
@asyncio.coroutine
def get_greetings():
http_client = AsyncHTTPClient()
response = yield from to_asyncio_future(http_client.fetch(UR... | mit | Python | |
a8e66380cb63e52ad57f66cb9e1a652dca5b32b9 | Create __init__.py | Raytone-D/puppet | puppet/__init__.py | puppet/__init__.py | mit | Python | ||
e81426b1f7890c056f926281c5a445bc6e74c80b | Create py-参数传递.py | ganmk/python-prctice | py-参数传递.py | py-参数传递.py | # 包裹关键字传递 dic是一个字典 收集所有的关键字传递给函数func_t
def func_t(**dic):
print type(dic)
print dic
print func_t(a=1, b=2)
print func_t(a=3, b=4, c=5)
| mit | Python | |
4f265b626c9ff5c333ea6c27cb08b45c2cecc7f3 | Add plugin code | aristidesfl/sublime-git-commit-message-auto-save | gitcommitautosave.py | gitcommitautosave.py | """Git Commit Auto Save.
Sublime Text 3 package to auto save commit messages when the window is closed.
This allows the user to close the window without having to save before,
or having to deal with the "Save File" popup.
"""
import sublime_plugin
class GitCommitAutoSave(sublime_plugin.EventListener):
def on_load(s... | mit | Python | |
ac482caafe8c63de2606bb4894462f7b2e2bcb70 | Add initial script to print rosbag files | oliverlee/antlia | python/printbag.py | python/printbag.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convert a rosbag file to legacy lidar binary format.
"""
"""LIDAR datatype format is:
(
timestamp (long),
flag (bool saved as int),
accelerometer[3] (double),
gps[3] (double),
distance[LIDAR_NUM_ANGLES] (long),
)
'int... | bsd-2-clause | Python | |
a74cc0f4c06db4dad3007f52ec4eb062773700be | Create quora_duplicate.py | py-in-the-sky/challenges,py-in-the-sky/challenges,py-in-the-sky/challenges | quora_duplicate.py | quora_duplicate.py | """
see: https://www.hackerrank.com/contests/quora-haqathon/challenges/duplicate
"""
import re
from json import loads
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline
from sklearn.ensemble import BaggingClassifier
from nltk.stem.lancaster import LancasterStemmer
WORD_RE = re.c... | mit | Python | |
5cf2c2c4dcbc9e0cca57a7634e5118c2dc278c75 | Add media compatibility | tysonholub/twilio-python,twilio/twilio-python | twilio/rest/resources/compatibility/media.py | twilio/rest/resources/compatibility/media.py | from twilio.rest.resources import InstanceResource, ListResource
class Media(InstanceResource):
pass
class MediaList(ListResource):
def __call__(self, message_sid):
base_uri = "%s/Messages/%s" % (self.base_uri, message_sid)
return MediaList(base_uri, self.auth, self.timeout)
| mit | Python | |
a2e566cc0b925f80c30602141e890cdf9b13306b | Migrate to latest version of db. | PythonClutch/python-clutch,PythonClutch/python-clutch,PythonClutch/python-clutch | migrations/versions/1003fd6fc47_.py | migrations/versions/1003fd6fc47_.py | """empty message
Revision ID: 1003fd6fc47
Revises: 1a54c4cacbe
Create Date: 2015-03-24 13:33:50.898511
"""
# revision identifiers, used by Alembic.
revision = '1003fd6fc47'
down_revision = '1a54c4cacbe'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
###... | mit | Python | |
38cf6ee407468e192101cbd456411c56cbf09e68 | Add example of distribution fit on any selected feature | lidakanari/NeuroM,BlueBrain/NeuroM,juanchopanza/NeuroM,wizmer/NeuroM,liesbethvanherpe/NeuroM,mgeplf/NeuroM,eleftherioszisis/NeuroM | examples/extract_distribution.py | examples/extract_distribution.py | #!/usr/bin/env python
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fo... | bsd-3-clause | Python | |
4aced6fea8ff8ccd087362cb237a9f00d111d0d8 | Add command to turn on locations flag | dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq | corehq/apps/commtrack/management/commands/toggle_locations.py | corehq/apps/commtrack/management/commands/toggle_locations.py | from django.core.management.base import BaseCommand
from corehq.apps.domain.models import Domain
from corehq.feature_previews import LOCATIONS
from corehq.toggles import NAMESPACE_DOMAIN
from toggle.shortcuts import update_toggle_cache, namespaced_item
from toggle.models import Toggle
class Command(BaseCommand):
... | bsd-3-clause | Python | |
1eaab9f929dc748e57865fb4c8717158e6c47fa5 | Add more index on contact activities | rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport | ureport/stats/migrations/0018_better_indexes.py | ureport/stats/migrations/0018_better_indexes.py | # Generated by Django 3.2.6 on 2021-10-13 12:37
from django.db import migrations
# language=SQL
INDEX_SQL_CONTACTACTIVITY_ORG_DATE_SCHEME_NOT_NULL = """
CREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_scheme_not_null on stats_contactactivity (org_id, date, scheme) WHERE scheme IS NOT NULL;
"""
class Mi... | agpl-3.0 | Python | |
9becada645e9680974dbb18fee10983d204dfd3d | Create low-res cubes, masks, and moment arrays | e-koch/VLA_Lband,e-koch/VLA_Lband | 14B-088/HI/analysis/cube_pipeline_lowres.py | 14B-088/HI/analysis/cube_pipeline_lowres.py |
'''
Convolve the VLA + GBT data to 2 * beam and 5 * beam, then run the
masking and moments pipeline.
Make signal masks and compute the moments.
'''
from astropy import log
import os
from radio_beam import Beam
from spectral_cube import SpectralCube
from cube_analysis import run_pipeline
from paths import (fourteenB... | mit | Python | |
7651b436e9d817ffae7f8c64f6ee8088dd1ae889 | Add hall.py | Stefal/V4MPod,Stefal/V4MPod,Stefal/V4MPod,Stefal/V4MPod | raspberry/hall.py | raspberry/hall.py | import os
import sys
import smbus
import time
import datetime
import RPi.GPIO as GPIO
import PyCmdMessenger
import subprocess
import gpsd
import threading
import Adafruit_Nokia_LCD as LCD
import Adafruit_GPIO.SPI as SPI
import lcd_menu as menu
from queue import Queue
from PIL import Image
from PIL import ImageDraw
fr... | mit | Python | |
8fbd7421e9517ead4293c62086f3305810c93b1b | Add initial manage/fabfile/ci.py (sketch) | rinfo/rdl,rinfo/rdl,rinfo/rdl,rinfo/rdl,rinfo/rdl,rinfo/rdl | manage/fabfile/ci.py | manage/fabfile/ci.py | from fabric.api import *
@task
@role('ci')
def install():
sudo("apt-get install git")
sudo("apt-get install maven2") # TODO: maven3
sudo("apt-get install groovy") # TODO: groovy-1.8, or gradle...
configure_groovy_grapes()
sudo("apt-get install python-dev")
sudo("apt-get install python-pip")
... | bsd-2-clause | Python | |
95d87c541ebf82109b882daebcb5b387f0f1cdb8 | Read the american physics society graph | charanpald/APGL | exp/influence2/ReputationExp2.py | exp/influence2/ReputationExp2.py | import numpy
try:
ctypes.cdll.LoadLibrary("/usr/local/lib/libigraph.so")
except:
pass
import igraph
from apgl.util.PathDefaults import PathDefaults
from exp.util.IdIndexer import IdIndexer
import xml.etree.ElementTree as ET
import array
metadataDir = PathDefaults.getDataDir() + "aps/aps-dataset-metada... | bsd-3-clause | Python | |
8f391cfd541f68a3c4bfc20be68c32d4e2d6798f | Add server script | developius/piometer | server.py | server.py | #!/usr/bin/python3
# import the necessary components
from flask import Flask, request, jsonify
app = Flask(__name__)
# define a dictionary to store our information in
info = {}
# listen for data at /data
@app.route("/data", methods=["GET", "POST"])
def api():
# convert the data to a dict
data = request.get_json(si... | mit | Python | |
a49d1d96b49eb6006e864bbaf2757cd5358b0110 | Create func.py | chapman3/proj5-map,chapman3/proj5-map | func.py | func.py | #it's fun, c?
def read_poi(file):
poi_dict = {}
#taken from project2
for line in file:
line = line.rstrip()
if len(line) == 0:
continue
parts = line.split(' ', 2)
print(parts[0],parts[1],parts[2])
poi_dict[parts[2]] = parts[0],parts[1]
return poi_dic... | artistic-2.0 | Python | |
4810c88d484bc02fe5f7983dbf9cac0be5a440cd | Create reverse_word_order.py | lcnodc/codes,lcnodc/codes | 09-revisao/practice_python/reverse_word_order.py | 09-revisao/practice_python/reverse_word_order.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Exercise 15: Reverse Word Order
Write a program (using functions!) that asks the user for a long string
containing multiple words. Print back to the user the same string,
except with the words in backwards order. For example, say I type the
string:
My name is Mich... | mit | Python | |
c460874436ee087a50f9f7ec06c15ae9a110a656 | Initialize web spider class definition & imports | MaxLikelihood/CODE | spider.py | spider.py | from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
| mit | Python | |
3f6e3d60588dec447fffbfc7e5fc65f34cbd3aa7 | fix bug in version.py subprocess call | jerkos/cobrapy,zakandrewking/cobrapy,aebrahim/cobrapy,JuBra/cobrapy,JuBra/cobrapy,jeicher/cobrapy,jeicher/cobrapy,zakandrewking/cobrapy,jerkos/cobrapy,aebrahim/cobrapy | cobra/version.py | cobra/version.py | #!/usr/bin/env python
"""
Tracks the version number. If git is installed and file script
is located within a git repository, git describe is used to get
the version information. This version string is sanitized to
comply with PEP 386 and stored in the RELEASE-VERSION file.
If git describe can not be run, the RELEASE-... | #!/usr/bin/env python
"""
Tracks the version number. If git is installed and file script
is located within a git repository, git describe is used to get
the version information. This version string is sanitized to
comply with PEP 386 and stored in the RELEASE-VERSION file.
If git describe can not be run, the RELEASE-... | lgpl-2.1 | Python |
10e1866abffadf61f8593159006b8dbf431afd6b | Add convert module tests | orbingol/NURBS-Python,orbingol/NURBS-Python | tests/test_convert.py | tests/test_convert.py | """
Tests for the NURBS-Python package
Released under The MIT License. See LICENSE file for details.
Copyright (c) 2018 Onur Rauf Bingol
Tests B-Spline to NURBS conversions. Requires "pytest" to run.
"""
from geomdl import BSpline
from geomdl import convert
SAMPLE_SIZE = 5
C_DEGREE = 2
C_CTRLPTS = [... | mit | Python | |
957490251e5038d9fb963f0c43ea3973e763c134 | Add test | saketkc/moca,saketkc/moca,saketkc/moca | tests/test_plotter.py | tests/test_plotter.py | from moca.plotter import create_plot
import os
import pytest
@pytest.mark.mpl_image_compare(baseline_dir='data/images',
filename='ENCSR000AKB_PhyloP_1.png')
def join_path(head, leaf):
return os.path.join(head, leaf)
def test_image():
base_path = 'tests/data/ENCSR000AKB/'
me... | isc | Python | |
08047dddf65f44bf4312e639ad0009bd1ab6f837 | Add routing tests (incl. one xfail for nesting) | andrewgodwin/django-channels,django/channels,andrewgodwin/channels | tests/test_routing.py | tests/test_routing.py | from unittest.mock import MagicMock
import django
import pytest
from django.conf.urls import url
from channels.http import AsgiHandler
from channels.routing import ChannelNameRouter, ProtocolTypeRouter, URLRouter
def test_protocol_type_router():
"""
Tests the ProtocolTypeRouter
"""
# Test basic oper... | bsd-3-clause | Python | |
ed0a2a8fc20a44499d9db03d2eb8fcd58c1b0cd3 | Add unit tests | prkumar/uplink | tests/test_session.py | tests/test_session.py | # Local imports
from uplink import session
def test_base_url(uplink_builder_mock):
# Setup
uplink_builder_mock.base_url = "https://api.github.com"
sess = session.Session(uplink_builder_mock)
# Run & Verify
assert uplink_builder_mock.base_url == sess.base_url
def test_headers(uplink_builder_mock... | mit | Python | |
f1b22c952dabb3b66638000078e1ab2d0b7acea2 | Add missing utils file | ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display | homedisplay/homedisplay/utils.py | homedisplay/homedisplay/utils.py | import redis
import json
redis_instance = redis.StrictRedis()
def publish_ws(key, content):
redis_instance.publish("home:broadcast:generic", json.dumps({"key": key, "content": content}))
| bsd-3-clause | Python | |
f338d34e750fd4d06cd0992c7f457c403b1cff3b | add a simple tool to dump the GETLBASTATUS provisioning status | AHelper/python-scsi,AHelper/python-scsi,rosjat/python-scsi | tools/getlbastatus.py | tools/getlbastatus.py | #!/usr/bin/env python
# coding: utf-8
import sys
from pyscsi.pyscsi.scsi import SCSI
from pyscsi.pyscsi.scsi_device import SCSIDevice
from pyscsi.pyscsi.scsi_enum_getlbastatus import P_STATUS
def usage():
print 'Usage: getlbastatus.py [--help] [-l <lba>] <device>'
def main():
i = 1
lba = 0
while i... | lgpl-2.1 | Python | |
46c816f169b29a8fe91f14ab477222873d9bed88 | Add DocTestParser | orenault/TestLink-API-Python-client | robot/docparser.py | robot/docparser.py | import re
class DocTestParser(object):
"""Find all externaltestcaseid's in a test's docstring.
If your externaltestcaseid prefix is abc and the test has 'abc-123' in it's docstring.
`DocTestParser('abc').get_testcases()` would return `['abc-123']`.
"""
def __init__(self, doc_matcher=None, doc_mat... | apache-2.0 | Python | |
4f2c91c06ab13eec02ef0199ef45d0eeaf555ea7 | Add dunder init for lowlevel. | python-astrodynamics/astrodynamics,python-astrodynamics/astrodynamics | astrodynamics/lowlevel/__init__.py | astrodynamics/lowlevel/__init__.py | # coding: utf-8
from __future__ import absolute_import, division, print_function
| mit | Python | |
de10593be3c513d41423dffcedd220c02dd37d6c | Add config_default.py | tranhuucuong91/simple-notebooks,tranhuucuong91/simple-notebooks,tranhuucuong91/simple-notebooks | config_default.py | config_default.py | # -*- coding: utf-8 -*-
"""
Created on 2015-10-23 08:06:00
@author: Tran Huu Cuong <tranhuucuong91@gmail.com>
"""
import os
# Blog configuration values.
# You may consider using a one-way hash to generate the password, and then
# use the hash again in the login view to perform the comparison. This is just
# for sim... | mit | Python | |
95bb2d362e6a41b4e6421b5e8752b5040ea23d3f | Test file | nikhilkalige/flir | main.py | main.py | from flir.stream import Stream
from flir.flir import FLIR
import time
#h = Stream("129.219.136.149", 4000)
#h.connect()
#time.sleep(5)
#h.write("PP-500".encode("ascii"))
x = FLIR("129.219.136.149", 4000)
x.connect()
x.pan(30)
print(x.pan())
x.pan_offset(10)
print(x.pan())
x.stream.close()
| bsd-3-clause | Python | |
e2020af5ccd41f8571a2d0db4f5345ca9a8b561e | Add migration for db changes | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | gmn/src/d1_gmn/app/migrations/0010_auto_20170805_0107.py | gmn/src/d1_gmn/app/migrations/0010_auto_20170805_0107.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-05 01:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0009_auto_20170603_0546'),
]
operations = [... | apache-2.0 | Python | |
a0cd167b9f19e2a4a9d1f2a80bc3586cce15c6ab | Add GMN DB migration to current | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | gmn/src/d1_gmn/app/migrations/0019_auto_20190418_1512.py | gmn/src/d1_gmn/app/migrations/0019_auto_20190418_1512.py | # Generated by Django 2.2 on 2019-04-18 20:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0018_auto_20180901_0115'),
]
operations = [
migrations.AlterModelOptions(
name='eventlog',
options={},
),
... | apache-2.0 | Python | |
9ffc52e4cfabff9ee1bd669d76e25c54a3cafffc | Revert "shit" | inhumanundead/getjams | main.py | main.py | # GetJams - get some new jams for ya mental
import musicbrainzngs as jams
import random,sys,os,wx
jams.set_useragent("GetJams","1.0","inhumanundead@gmail.com")
def GetArtist(genre):
x = jams.search_artists(tag=genre)['artist-list']
y = []
y.append(x[random.randint(0,len(x)-1)]['sort-name'])
y.append(x[random.rand... | bsd-3-clause | Python | |
a6ef1e2456f84b50102c4192984b0c18b9c81a27 | Create scriptGenerator.py | AlexEnriquez/Script-Generator | scriptGenerator.py | scriptGenerator.py | #!/usr/bin/env python
#GENERATE A NEW SCRIPT
def Creation():
fichero=open('generator.py','w')
fichero.close()
def Save():
fichero=open('generator.py','a')
fichero.write('from PyQt4.QtGui import *\n')
fichero.write('import sys\n')
fichero.write('class Window(QWidget):\n')
fichero.write('\tdef __init__(self,parent=None)... | bsd-3-clause | Python | |
f3f07d6e8218d523227c63eea4b088573ca632ef | Add release script | bryanforbes/Erasmus | scripts/release.py | scripts/release.py | #!/usr/bin/env python
from __future__ import annotations
import subprocess
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from typing import TYPE_CHECKING, Literal, overload
from zoneinfo import ZoneInfo
import click
if TYPE_CHECKING:
from typing_extensions import Self
... | bsd-3-clause | Python | |
844810f393724684d855e6e12fd20c392b6f06a0 | check if key even exists before going into os.environ | alex/pyechonest,yuanmeibin/pyechonest,wisperwinter/pyechonest,ruohoruotsi/pyechonest,diegobill/pyechonest,diCaminha/pyechonest,KMikhaylovCTG/pyechonest,wisperwinter/pyechonest,MathieuDuponchelle/pyechonest3,shyamalschandra/pyechonest,EliteScientist/pyechonest,KMikhaylovCTG/pyechonest,DaisukeMiyamoto/pyechonest,andreylh... | src/pyechonest/config.py | src/pyechonest/config.py | """
Global configuration variables for accessing the Echo Nest web API.
"""
ECHO_NEST_API_KEY = None
__version__ = "$Revision: 0 $"
# $Source$
import os
if('ECHO_NEST_API_KEY' in os.environ):
ECHO_NEST_API_KEY = os.environ['ECHO_NEST_API_KEY']
else:
ECHO_NEST_API_KEY = None
API_HOST = 'developer.echonest.... | """
Global configuration variables for accessing the Echo Nest web API.
"""
ECHO_NEST_API_KEY = None
__version__ = "$Revision: 0 $"
# $Source$
import os
if(os.environ['ECHO_NEST_API_KEY']):
ECHO_NEST_API_KEY = os.environ['ECHO_NEST_API_KEY']
else:
ECHO_NEST_API_KEY = None
API_HOST = 'developer.echonest.co... | bsd-3-clause | Python |
1c2ba73eb0405dcfd427574c197e6a0588390f67 | Simplify shipping template tags | WadeYuChen/django-oscar,django-oscar/django-oscar,kapari/django-oscar,bnprk/django-oscar,monikasulik/django-oscar,saadatqadri/django-oscar,Bogh/django-oscar,mexeniz/django-oscar,ka7eh/django-oscar,saadatqadri/django-oscar,solarissmoke/django-oscar,taedori81/django-oscar,bschuon/django-oscar,taedori81/django-oscar,binar... | oscar/templatetags/shipping_tags.py | oscar/templatetags/shipping_tags.py | from django import template
register = template.Library()
@register.assignment_tag
def shipping_charge(method, basket):
"""
Template tag for calculating the shipping charge for a given shipping
method and basket, and injecting it into the template context.
"""
return method.calculate(basket)
@... | from django import template
register = template.Library()
@register.tag
def shipping_charge(parse, token):
"""
Template tag for calculating the shipping charge for a given shipping
method and basket, and injecting it into the template context.
"""
return build_node(ShippingChargeNode, token)
@... | bsd-3-clause | Python |
3ef6a9dbe2916d669d3e7e7cfab86a365237bc19 | Make octane result format match the old v8_benchmark output. | crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,bright-sparks/chromium-spacewalk,bright-sparks/chromium-spacewalk,timopulkkinen/BubbleFish,M4sse/chromium.src,patrickm/chromium.src,ondra-novak/chromium.src,mohamed--abdel-maksoud/chromium.src,Just-D/chromium-1,M4sse/chr... | tools/perf/perf_tools/octane.py | tools/perf/perf_tools/octane.py | # Copyright (c) 2012 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.
from telemetry import multi_page_benchmark
from telemetry import util
class Octane(multi_page_benchmark.MultiPageBenchmark):
def MeasurePage(self, _, ... | # Copyright (c) 2012 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.
from telemetry import multi_page_benchmark
from telemetry import util
class Octane(multi_page_benchmark.MultiPageBenchmark):
def MeasurePage(self, _, ... | bsd-3-clause | Python |
238f5788211ed117ceedbb234e7404bc02716d60 | add serializer.py | zhengze/zblog,zhengze/zblog,zhengze/zblog,zhengze/zblog | apps/zblog/serializers.py | apps/zblog/serializers.py |
from rest_framework import serializers
# Serializers define the API representation.
class ArticleSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Article
#fields = ('title', 'content', 'hits', 'created_time', 'updated_time', 'category', 'tags')
fields = ('title', 'co... | mit | Python | |
9bf9e9ace12fe43c18ef1676681b3b6f5df65d4c | Add example for comparison of two sets of trees based on extracted morphometrics | eleftherioszisis/NeuroM,lidakanari/NeuroM,wizmer/NeuroM,juanchopanza/NeuroM,liesbethvanherpe/NeuroM,BlueBrain/NeuroM,mgeplf/NeuroM | examples/comparison.py | examples/comparison.py | # Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | bsd-3-clause | Python | |
4e962d97b6a9d97db915c92c5a388a3a36573d63 | add 32 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | p032.py | p032.py | import itertools
matches = set()
for i in itertools.permutations('123456789', 9):
for s in xrange(1, 4):
for s2 in xrange(s + 1, (14 - s) / 2):
a = int(''.join(i[:s]))
b = int(''.join(i[s:s2]))
c = int(''.join(i[s2:]))
if a * b == c:
matches.a... | bsd-3-clause | Python | |
691a5873596c487eece704bad991270c6b275dde | Create Game_of_Master_Mind.py | UmassJin/Leetcode | Cracking_Coding_Interview/Game_of_Master_Mind.py | Cracking_Coding_Interview/Game_of_Master_Mind.py | class Result:
def __init__(self):
self.hit = 0
self.pseudohit = 0
def estimate(guess, solution):
if len(guess) != len(solution): return None
result = Result()
idict = {}
for i, char in enumerate(guess):
if char == solution[i]:
result.hit += 1
else:
... | mit | Python | |
b5906545121d4d5229552d3e2243a290810d1c1c | add self-connect.py | chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes | python/self-connect.py | python/self-connect.py | #!/usr/bin/python
import errno
import socket
import sys
import time
if len(sys.argv) < 2:
print "Usage: %s port" % sys.argv[0]
print "port should in net.ipv4.ip_local_port_range"
else:
port = int(sys.argv[1])
for i in range(65536):
try:
sock = socket.create_connection(('localhost', port))
print "connected... | bsd-3-clause | Python | |
6c16f074f273c2f040c3eadcf34307b2fbef4cda | Add transformers.py | KamiyamaKiriko/weechat-scripts | python/transformers.py | python/transformers.py | # -*- encoding: utf-8 -*-
import weechat
import re
stripFormatting = re.compile(r"|\d{0,2}(,\d{0,2})?")
script = {
"name": "transformers",
"author": "KamiyamaKiriko",
"version": "0.2",
"license": "MIT",
"description": "Fancily fancify your fancy messages",
}
replacements = {
":V": u"<̈",
... | mit | Python | |
d4151bf2a30fc8a497f7d4cb3f6eba4b6913447e | Create tester.py | nckswt/LEDframe,nckswt/LEDframe | tester.py | tester.py | print("hey!")
| apache-2.0 | Python | |
e1ceaa62c7e6f0974b21a23105280da49e9657bf | Send push notifications | kfdm/gntp-regrowl | regrowl/bridge/push.py | regrowl/bridge/push.py | """
Send push notifications
Uses pushnotify to send notifications to iOS and Android devices
Requires https://pypi.python.org/pypi/pushnotify
Sample config
[regrowl.bridge.push]
label = prowl,<apikey>
other = nma,<apikey>
example = pushover,<apikey>
"""
from __future__ import absolute_import
try:
import pushn... | mit | Python | |
f423a32dac3b3232a03e6eebdb0664d2b5cdf87e | Add test for ordinal | NewAcropolis/api,NewAcropolis/api,NewAcropolis/api | tests/app/utils/test_time.py | tests/app/utils/test_time.py | from app.utils.time import make_ordinal
class WhenMakingOrdinal:
def it_returns_an_ordinal_correctly(self):
ordinal = make_ordinal(11)
assert ordinal == '11th'
| mit | Python | |
5647dfbf3aa2b2c5cb7f32b60b21a47ad2ee6f20 | add google foobar exercise | congminghaoxue/learn_python | solution_level1.py | solution_level1.py | #!/usr/bin/env python
# encoding: utf-8
def answer(s):
re = ''
a = ord('a')
z = ord('z')
for c in s:
ascii_code = ord(c)
if ascii_code >= a and ascii_code <= z:
tmp = chr(a + z -ascii_code)
re = re + tmp
else:
re = re + c
return re
if __... | apache-2.0 | Python | |
34dca8c90ba650356c19ff7c42d19f09a050bd64 | Add file from previous commit | spMohanty/TranslatorsDesk,ltrc/TranslatorsDesk,spMohanty/TranslatorsDesk,ltrc/TranslatorsDesk,spMohanty/TranslatorsDesk,spMohanty/TranslatorsDesk,ltrc/TranslatorsDesk,ltrc/TranslatorsDesk | translatorsdesk/worker_functions.py | translatorsdesk/worker_functions.py | import subprocess
from rq import Queue
from redis import Redis
redis_conn = Redis()
q = Queue(connection=redis_conn)
#=================================================================
# Process Input File
def extract_xliff(file):
cmd = ["lib/okapi/tikal.sh", "-x", file]
p = subprocess.Popen(cmd, stdout = subproces... | bsd-3-clause | Python | |
e1b23ecf168d397da373c4441c67e655da58e3e9 | Add basic Log class to represent a log record. | 4degrees/mill,4degrees/sawmill | source/bark/log.py | source/bark/log.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
from collections import MutableMapping
class Log(MutableMapping):
'''Hold individual log data.'''
def __init__(self, *args, **kw):
'''Initialise log.'''
super(Log, self).__init__()
... | apache-2.0 | Python | |
6c6214681ee89f2f67b09542fcf7690aa61954b9 | Add maybe_make_dir() | ronrest/convenience_py,ronrest/convenience_py | file/maybe_make_dir.py | file/maybe_make_dir.py | import os
# ==============================================================================
# MAYBE_MAKE_DIR
# ==============================================================================
def maybe_make_dir(path):
""" Checks if a directory path exist... | apache-2.0 | Python | |
c57bfdfae235e7ed7b5f13922a7fbc64dbd112f1 | Add a missing migration | pythonindia/junction,pythonindia/junction,pythonindia/junction,pythonindia/junction | junction/proposals/migrations/0025_auto_20200321_0049.py | junction/proposals/migrations/0025_auto_20200321_0049.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2020-03-20 19:19
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('proposals', '0024_auto_20170610_1857'),
]
operations = [
migrations.AlterIndexTogether... | mit | Python | |
0779277486a6812f5b58e1fc1ab6fe1e5dc35559 | add dummy api tests | OpenDataPolicingNC/Traffic-Stops,OpenDataPolicingNC/Traffic-Stops,OpenDataPolicingNC/Traffic-Stops,OpenDataPolicingNC/Traffic-Stops | nc/tests/test_api.py | nc/tests/test_api.py | from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from nc.models import Agency
class AgencyTests(APITestCase):
def test_list_agencies(self):
"""Test Agency list"""
Agency.objects.create(name="Durham")
url = reverse('... | mit | Python | |
9a983fc4223cedc3c34c53b1241ffc71ac063a5c | Add benchmark | spotify/sparkey-python,pombredanne/sparkey-python | test/bench.py | test/bench.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Spotify AB
#
# 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 ... | apache-2.0 | Python | |
9b68ee1e0ffb60ebffe0bb90da2512da4bbbeb99 | add split_from_listobj_and_tuple_it func | eufat/gender-ml,eufat/gender-ml | utils/split_listobj_and_tuple_it.py | utils/split_listobj_and_tuple_it.py |
def split_from_listobj_and_tuple_it():
return 0 | mit | Python | |
c6d70585e1266e4008e38548404a0bcffccfcecf | Create websocket server | cphyc/andremote,cphyc/andremote,cphyc/andremote | web_ws.py | web_ws.py | #!/usr/bin/env python3
"""Example for aiohttp.web websocket server
"""
import asyncio
import os
from aiohttp.web import Application, Response, MsgType, WebSocketResponse
import argparse
import sys
sys.path.append('../')
from pyxdotool.instruction import Instruction
import json
parser = argparse.ArgumentParser(descri... | mit | Python | |
ece4598e6297ef071b1c928435efb3bee73e3ddb | Backup script. | liuche/prox-server | scripts/backup.py | scripts/backup.py | import json
from app.firebase import db
"""
Backup script for saving contents at the path in Firebase.
"""
def backup(path):
backup = db().child(path).get().val()
with open("out.json", "w") as f: json.dump(backup, f)
if __name__ == '__main__':
# See app/constants for table prefixes and suffixes
path =... | mpl-2.0 | Python | |
2ad0a7f50b6b120c6e769033037c0e1661d2480d | Add spacer/exp_name.py to generate names for experiments | agurfinkel/brunch,agurfinkel/brunch | spacer/exp_name.py | spacer/exp_name.py | #! /usr/bin/env python3
# Name for experiments directory
import sys
import words
import argparse
import os.path
from datetime import datetime
import platform
class ExpNamer(object):
def __init__(self):
self._name = 'exp_name'
self._help = 'Name experiment'
def mk_arg_parser(self, ap):
... | mit | Python | |
8b467efd1f998d05da0272a284773501f0b330ff | Add a test file which was missing from a recent branch | grzes/djangae,grzes/djangae,potatolondon/djangae,grzes/djangae,potatolondon/djangae | djangae/tests/test_meta_queries.py | djangae/tests/test_meta_queries.py | from django.db import models
from djangae.test import TestCase
from djangae.contrib import sleuth
class MetaQueryTestModel(models.Model):
field1 = models.CharField(max_length=32)
class PrimaryKeyFilterTests(TestCase):
def test_pk_in_with_slicing(self):
i1 = MetaQueryTestModel.objects.create();
... | bsd-3-clause | Python | |
62c04b70178f3df8a8c7cbf01de0896d3e808698 | Create __init__.py | OdooCommunityWidgets/mass_mailing_themes_boilerplate,OdooCommunityWidgets/mass_mailing_themes_community | mass_mailing_themes_boilerplate/__init__.py | mass_mailing_themes_boilerplate/__init__.py | mit | Python | ||
615247c28d58fbbff40f5e4122441d77acb19003 | Integrate notification app in settings and add basic structure of files | Fleeg/fleeg-platform,Fleeg/fleeg-platform | notification/urls.py | notification/urls.py | from django.conf.urls import url
from link.views import LinkView, LinkReactionView, LinkCommentView
urlpatterns = [
url(r'^$', LinkView.new, name='link_new'),
url(r'^(?P<post_id>[0-9]+)/add/$', LinkView.add, name='link_add'),
url(r'^(?P<post_id>[0-9]+)/react/$', LinkReactionView.react, name='link_react'),... | agpl-3.0 | Python | |
09c9f6ba56890a2a56eaa77eae47cda92a39965e | Add unit tests for test_url | moreati/pylons,Pylons/pylons,Pylons/pylons,moreati/pylons,Pylons/pylons,moreati/pylons | tests/test_units/test_url.py | tests/test_units/test_url.py | import unittest
from repoze.bfg.testing import cleanUp
class TestRouteUrl(unittest.TestCase):
def setUp(self):
cleanUp()
def tearDown(self):
cleanUp()
def _callFUT(self, *arg, **kw):
from pylons.url import route_url
return route_url(*arg, **kw)
def test_with... | bsd-3-clause | Python | |
ca1cfd2514d382b1187eab880014b6a611d3568d | add some testing for Resources and ResourceAttributesMixin | infoxchange/slumber,ministryofjustice/slumber,CloudNcodeInc/slumber,IAlwaysBeCoding/slumber,zongxiao/slumber,IAlwaysBeCoding/More,futurice/slumber,s-block/slumber,samgiles/slumber,jannon/slumber | tests/resource.py | tests/resource.py | import mock
import unittest
import httplib2
import slumber
class ResourceAttributesMixinTestCase(unittest.TestCase):
def test_attribute_fallback_to_resource(self):
class ResourceMixinTest(slumber.ResourceAttributesMixin, slumber.MetaMixin, object):
class Meta:
authentication =... | bsd-2-clause | Python | |
7f4cfe09a29202475b0941558f8ab722e63cee7e | Add MPL 2.0 to license trove | apache/incubator-allura,Bitergia/allura,apache/allura,lym/allura-git,lym/allura-git,apache/allura,Bitergia/allura,apache/incubator-allura,lym/allura-git,heiths/allura,Bitergia/allura,apache/incubator-allura,Bitergia/allura,heiths/allura,Bitergia/allura,heiths/allura,apache/incubator-allura,heiths/allura,leotrubach/sour... | scripts/migrations/023-add-new-trove-license-category.py | scripts/migrations/023-add-new-trove-license-category.py | import sys
import logging
from ming.orm.ormsession import ThreadLocalORMSession
from allura import model as M
log = logging.getLogger(__name__)
def main():
M.TroveCategory(trove_cat_id=905,
trove_parent_id=14,
shortname='mpl20',
fullname='Mozilla Publi... | apache-2.0 | Python | |
07cccdbb7fdc6919503c5b11bca8604e1f7a0d59 | Create roman_numeral_convert.py | SamGriffith3/PyLearning-Projects,SamGriffith3/PyLearning-Projects | projects/roman_numeral_convert.py | projects/roman_numeral_convert.py |
#Roman numerals are: [i v x l c d m]
def stringer (x):
number_string = str(x)
a = number_string[0]
b = number_string[1]
c = number_string[2]
d = number_string[3]
a_list = [ I, II, III, IV, V, VI, VII, VIII, IX]
b_list = [ X, XX, XXX, XL, L, LX, LXX, LXXX, XC]
c_list = [ C, CC, CCC, CD, D, DC, DCC, DCCC... | mit | Python | |
4e02394f87bec9f73364738550c0b441beb80696 | Build Tower | SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive | Codewars/BuildTower.py | Codewars/BuildTower.py | def tower_builder(n_floors):
return [((n_floors - i)*' ' + (2*i - 1)*'*' + (n_floors - i)*' ') for i in range(1,n_floors+1)]
| unlicense | Python | |
b17c1bf616ad3bc1d56b106bc8a606866b8f3f1a | Create Knapsack01.py | Chasego/codi,cc13ny/Allin,Chasego/cod,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/cod,Chasego/cod,cc13ny/algo,cc13ny/algo,cc13ny/Allin,cc13ny/Allin,Chasego/cod,Chasego/cod,Chasego/codi,Chasego/codirit,Chasego/codirit,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/codirit,Chasego/codi,Chasego/codi,cc... | ap/py/Knapsack01.py | ap/py/Knapsack01.py | '''
You can run it directly to see results.
'''
def knapsack01(sizes, vals, S):
#aux[i][s] is the maximal value given the first (i-1) items under the size limitation: s
aux = [[-1 for _ in range(S + 1)] for _ in vals]
for i in range(len(vals)):
for s in range(S+1):
if i == 0:
... | mit | Python | |
acedeb97935c53d0e7f1e39b2282f8a90bf379ee | add test case | VeryCB/flask-slack | test_flask.py | test_flask.py | from pytest import fixture
from flask import Flask
from flask_slack import Slack
class App(object):
def __init__(self):
self.app = Flask(__name__)
self.app.debug = True
self.slack = Slack(self.app)
self.app.add_url_rule('/', view_func=self.slack.dispatch)
self.client = se... | bsd-3-clause | Python | |
6beccf0c0b4e7788403415c05ae9f31e6c0a89eb | Add tests for Generalized Procrustes Analysis (GPA) | MaxHalford/Prince | tests/test_gpa.py | tests/test_gpa.py | import unittest
import numpy as np
from sklearn import datasets
from sklearn import decomposition
from sklearn.utils import estimator_checks
import prince
class TestGPA(unittest.TestCase):
# def setUp(self):
def __init__(self):
# Create a list of 2-D circles with different locations and rotations
... | mit | Python | |
7ab615aa37263a38ca33fd0d9d8b7f7ec37442ca | add tests for low-level 'nacl.c' API | JackWink/pynacl,reaperhulk/pynacl,pyca/pynacl,hoffmabc/pynacl,lmctv/pynacl,reaperhulk/pynacl,ucoin-io/cutecoin,reaperhulk/pynacl,scholarly/pynacl,reaperhulk/pynacl,lmctv/pynacl,alex/pynacl,pyca/pynacl,xueyumusic/pynacl,pyca/pynacl,JackWink/pynacl,ucoin-io/cutecoin,lmctv/pynacl,JackWink/pynacl,xueyumusic/pynacl,hoffmabc... | tests/test_raw.py | tests/test_raw.py | # Copyright 2013 Donald Stufft and individual contributors
#
# 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... | apache-2.0 | Python | |
f86da5eddec2dd37f4797ea1caf404e8fec82701 | add unit tests for query parsing | vimeo/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer | test_query.py | test_query.py | from query import parse_query
import copy
default_parsed_query = {
'from': '-24hours',
'to': 'now',
'min': None,
'max': None,
'avg_by': {},
'limit_targets': 500,
'avg_over': None,
'patterns': ['target_type=', 'unit='],
'group_by': ['target_type=', 'unit=', 'server'],
'sum_by': {... | apache-2.0 | Python | |
0baca9564c9df7b06645f71abdda0fe3090f46a6 | Add a test-case for lit xunit output | GPUOpen-Drivers/llvm,dslab-epfl/asap,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,apple/swift-llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,dslab-epfl/asap,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,dslab-epfl/asap,dslab-epfl/asap,llvm-mirror/llvm,apple/swift... | utils/lit/tests/xunit-output.py | utils/lit/tests/xunit-output.py | # Check xunit output
# RUN: %{lit} --xunit-xml-output %t.xunit.xml %{inputs}/test-data
# RUN: FileCheck < %t.xunit.xml %s
# CHECK: <?xml version="1.0" encoding="UTF-8" ?>
# CHECK: <testsuites>
# CHECK: <testsuite name='test-data' tests='1' failures='0'>
# CHECK: <testcase classname='test-data.' name='metrics.ini' time... | apache-2.0 | Python | |
aff4fbae6933f33898f1a32511d9e4cc0b44fef5 | Add permissions class (made via builder). | SunDwarf/curious | curious/dataclasses/permissions.py | curious/dataclasses/permissions.py | # I'm far too lazy to type out each permission bit manually.
# So here's a helper method.
def build_permissions_class(name: str="Permissions"):
# Closure methods.
def __init__(self, value: int = 0):
"""
Creates a new Permissions object.
:param value: The bitfield value of the permissi... | mit | Python | |
e818989604ddaf34dd5730cc3b73093744b59a29 | Create themes.py | ollien/Timpani,ollien/Timpani,ollien/Timpani | timpani/themes.py | timpani/themes.py | from . import database
THEME_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../themes"))
| mit | Python | |
2e90787a245d6a30c733699a819a1ff888c308b7 | add simple boot script | squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto | src/japronto/__main__.py | src/japronto/__main__.py | from argparse import ArgumentParser
from importlib import import_module
import sys
from .app import Application
def main():
parser = ArgumentParser(prog='python -m japronto')
parser.add_argument('--host', dest='host', type=str, default='0.0.0.0')
parser.add_argument('--port', dest='port', type=int, defau... | mit | Python | |
bfa84c54166a606e4c7b587aeb10e5e79a2d0e50 | Add __init__ | naveenvhegde/pytmdb3,wagnerrp/pytmdb3 | tmdb3/__init__.py | tmdb3/__init__.py | #!/usr/bin/env python
from tmdb_api import Configuration, searchMovie, searchPerson, Person, \
Movie, Collection, __version__
from request import set_key
from tmdb_exceptions import *
| bsd-3-clause | Python | |
8830c0ae6a35a68cdeebdf8a7411e63f60b22c09 | Add script to host release management tools. Currently performs a single task: makes regexes for all JIRAs included in a release by parsing the CHANGES.txt files | apache/solr,apache/solr,apache/solr,apache/solr,apache/solr | dev-tools/scripts/manageRelease.py | dev-tools/scripts/manageRelease.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache-2.0 | Python | |
772fdb2251b5b8b374f15f43195a5e5f1fe9671e | Create deconvolution.py | google/trax,google/trax | trax/layers/deconvolution.py | trax/layers/deconvolution.py | # coding=utf-8
# Copyright 2020 The Trax 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 a... | apache-2.0 | Python | |
60f5dbe34884683626ca7f045fa79d2c247197fe | add test for class checks | smspillaz/pychecker,smspillaz/pychecker,smspillaz/pychecker | pychecker/pychecker2/tests/class.py | pychecker/pychecker2/tests/class.py | import compiler.ast
class B(compiler.ast.Const):
def x(self):
self.inherited = 1
class A(B):
def __init__(self):
self.x = 1 # define x on A
self.w.q = 1
def f(s, self): # unusual self
print self
s.self = 1
s = 7
... | bsd-3-clause | Python | |
a5e599f4a7c2f20c4f0ed79366db985cba7ae85e | Add template context debugging templatetag | python-dirbtuves/website,python-dirbtuves/website,python-dirbtuves/website | pylab/website/templatetags/debug.py | pylab/website/templatetags/debug.py | from django import template
register = template.Library()
@register.simple_tag(name='pdb', takes_context=True)
def pdb(context, *args, **kwargs):
import ipdb; ipdb.set_trace()
| agpl-3.0 | Python | |
e7852c457da3cea0f8a20773cc3a355f559b845e | Update version to 1.7 | artefactual/archivematica,artefactual/archivematica,artefactual/archivematica,artefactual/archivematica | src/dashboard/src/main/migrations/0047_version_number.py | src/dashboard/src/main/migrations/0047_version_number.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration(apps, schema_editor):
Agent = apps.get_model('main', 'Agent')
Agent.objects \
.filter(identifiertype='preservation system', name='Archivematica') \
.update(identifiervalue='Arch... | agpl-3.0 | Python | |
a4a73ac2e5a15e53a0935987911c5905890bfab8 | Add Overwatch command. | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | orchard/overwatch.py | orchard/overwatch.py | """Get stats for Overwatch."""
from plumeria.command import commands, CommandError
from plumeria.command.parse import Word
from plumeria.message.lists import build_list
from plumeria.util import http
from plumeria.util.http import BadStatusCodeError
from plumeria.util.ratelimit import rate_limit
GENERAL_STATS = (
... | mit | Python | |
010dd0366ddb62e52f295ec1648c1bab38f9e437 | move python wrappers to their own file | ryansb/tremendous,ryansb/tremendous | tremendous/api.py | tremendous/api.py | from tremendous.bindings import lib
from tremendous.bindings import ffi
def apply_format(color, body):
s = lib.apply_format(color, body)
return ffi.string(s)
| mit | Python | |
19c5600486ea7bee68eb1098636b21757938d799 | Add is_prime python | felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecustodio/algorithms,felipecu... | math/is_prime/python/is_prime.py | math/is_prime/python/is_prime.py | import math
def is_prime(number):
if number <= 1: return False
if number == 2: return True
if (number % 2) == 0: return False
for i in range(3, int(math.sqrt(number)) +1,2):
if number % 1 == 0: return False
return True
number = input ("Enter number :")
if is_prime(number):
print("It is prime")
else:
... | mit | Python | |
582128f1061ab74da76d26a366bfd3c8fee8f007 | Add scripts/fill_events.py to generate mock data | thobbs/logsandra | scripts/fill_events.py | scripts/fill_events.py | #!/usr/bin/env python
import sys
import os
sys.path.append(os.path.join(os.path.dirname('__file__'), '..', 'src'))
from random import randint
from datetime import datetime, timedelta
from logsandra.model.client import CassandraClient
client = CassandraClient('test', 'localhost', 9160, 3)
today = datetime.now()
ke... | mit | Python | |
92ed053619e27a538b93e87905c0ccf4599808ae | add a ann investigation script | NeuromorphicProcessorProject/snn_toolbox | tests/investigate_ann.py | tests/investigate_ann.py | """Polting everything for investigating ANN.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
from keras.models import model_from_json
from keras import backend as K
import os
from os.path import join
import matplotlib.pyplot as plt
import numpy as np
from snntoolbox.io_utils.plotting import plot_layer_activity
n... | mit | Python | |
a102fb888b60454d7efbe26e4afb38a59c212769 | Add script to delete spam users. | EuroPython/epcon,EuroPython/epcon,EuroPython/epcon,EuroPython/epcon | p3/management/commands/delete_spam_users.py | p3/management/commands/delete_spam_users.py | # -*- coding: utf-8 -*-
""" Delete users creating by spambots.
"""
import logging as log
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from assopy import models as amodels
###
class Command(BaseCommand):
# Options
option... | bsd-2-clause | Python | |
3ebbdf64ba244097e0c78e229d0c81d393bb4460 | add msct_report file | 3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox | scripts/msct_report.py | scripts/msct_report.py | import os
import shutil
import glob
from collections import OrderedDict
import msct_report_config
import msct_report_util
import msct_report_image
class Report:
def __init__(self, exists, reportDir):
self.dir = os.path.dirname(os.path.realpath(__file__));
self.reportFolder = reportDir
# T... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.