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 |
|---|---|---|---|---|---|---|---|---|
506ad4d6584cd2e9dc91210b1213f0cfcc8ea906 | package not module | iterati/silverlining | setup.py | setup.py | from setuptools import setup
setup(
name='silverlining',
version='0.1',
packages=['silverlining'],
install_requires=[
'click',
'soundcloud',
'requests',
'fuzzywuzzy',
],
entry_points='''
[console_scripts]
silverlining=silverlining:cli
''',
)
| from setuptools import setup, find_packages
setup(
name='silverlining',
version='0.1',
py_modules=['silverlining'],
install_requires=[
'click',
'soundcloud',
'requests',
'fuzzywuzzy',
],
entry_points='''
[console_scripts]
silverlining=silverlining... | mit | Python |
b4e195b60bb2195e77d9b8d8ce15f5d55799f833 | add moviepy - text_ausblenden.py | openscreencast/video_snippets,openscreencast/video_snippets | moviepy/text_ausblenden.py | moviepy/text_ausblenden.py | #!/usr/bin/env python
# Text ausblenden (mit Hintergrund)
# Einstellungen
text = 'Text' # Text
textgroesse = 150 # Textgroesse in Pixel
textfarbe = 'black' # Textfarbe
textposition = 'center' # Textposition
schrift = 'FreeSans' # Schriftart
hintergrundfarbe = 'white' # Hint... | cc0-1.0 | Python | |
0346679e0947371831fab17f66e4bcf80ca43e1a | Create nth-magical-number.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode | Python/nth-magical-number.py | Python/nth-magical-number.py | # Time: O(logn)
# Space: O(1)
class Solution(object):
def nthMagicalNumber(self, N, A, B):
"""
:type N: int
:type A: int
:type B: int
:rtype: int
"""
def gcd(a, b):
while b:
a, b = b, a % b
return a
def check(... | mit | Python | |
19017f9152a6d33f9c9a3a2dac24acc590100937 | Add a python script to format bench results. [ci skip] | google/fruit,google/fruit,google/fruit | extras/scripts/format_bench_results.py | extras/scripts/format_bench_results.py | #!/usr/bin/python
import sys
import re
from math import floor, log10
# results[benchmark_name][compiler][bench_size] = n
results = {}
percentage_re = re.compile("[0-9]*/[0-9]* \([0-9]*%\)")
bench_size_patterns = {
'fruit_setup_time': '%s classes',
'fruit_request_time': '%s classes',
'new_delete_time': '%s clas... | apache-2.0 | Python | |
7561e95b6fc12852c82ce4d16c38bcb223514358 | Create load balanced function to perform cross validation. Use main block to display best result | MikeDelaney/sentiment | parallel.py | parallel.py | from IPython import parallel
from sklearn.datasets import fetch_20newsgroups_vectorized
def get_results():
# get data
data = fetch_20newsgroups_vectorized(remove=('headers',
'footers',
'quotes'))
alphas = [1E... | mit | Python | |
0eb9144ebf4edc65aad0a0b170074ebd182b27b0 | Solve task #389 | Zmiecer/leetcode,Zmiecer/leetcode | 389.py | 389.py | class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
s = list(s)
for i in range(len(t)):
try:
s.pop(s.index(t[i]))
except ValueError:
return t[i]
| mit | Python | |
00997a5416447ecfb00565bface9ee109a187b61 | Add experiment groups search managers tests | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | tests/test_experiment_groups/test_search_managers.py | tests/test_experiment_groups/test_search_managers.py | from django.test import override_settings
from polyaxon_schemas.settings import SettingsConfig
from experiment_groups.iteration_managers import (
HyperbandIterationManager,
get_search_iteration_manager
)
from experiment_groups.models import ExperimentGroupIteration
from experiment_groups.search_managers import... | apache-2.0 | Python | |
3496ea06ec71637bf7ec8eb0cdffc2914b83b271 | add FM-index based alignment | weiquan/NGSTraining | Alignment/FMindex/fmindex.py | Alignment/FMindex/fmindex.py | import itertools
MAX_INT = 100000
table_leftNt = {'A':'$', 'C':'A', 'G':'C', 'T':'G'}
table_rightNt = {'A':'C', 'C':'G', 'G':'T', '$':'A'}
class FMIdx():
def __init__(self, string=''):
self.string = string
self.sa = None
self.bwt = None
self.occ = None
self.count = None
def buildIdx(self):
self.buildSA()... | mit | Python | |
cfdbc21269afa2a7bf178743b4cfe6b865f49f6c | Add compatibility layer | AnalogJ/lexicon,AnalogJ/lexicon | lexicon/providers/zeit.py | lexicon/providers/zeit.py | """Compatibility layer for Zeit (old name for Vercel)"""
from lexicon.providers.vercel import NAMESERVER_DOMAINS
from lexicon.providers.vercel import provider_parser
from lexicon.providers.vercel import Provider
| mit | Python | |
60b54287e0532f64e994896d5dff871190552b63 | fix pyinstaller for gstreamer/pygame etc. | MiyamotoAkira/kivy,Ramalus/kivy,JohnHowland/kivy,manashmndl/kivy,andnovar/kivy,bhargav2408/kivy,arlowhite/kivy,kived/kivy,bob-the-hamster/kivy,manashmndl/kivy,habibmasuro/kivy,thezawad/kivy,jkankiewicz/kivy,andnovar/kivy,inclement/kivy,bionoid/kivy,eHealthAfrica/kivy,xiaoyanit/kivy,eHealthAfrica/kivy,LogicalDash/kivy,j... | kivy/tools/packaging/pyinstaller_hooks/rt-hook-kivy.py | kivy/tools/packaging/pyinstaller_hooks/rt-hook-kivy.py | from os.path import join, dirname
from os import environ, chdir
import sys
root = 'kivy_install'
if hasattr(sys, '_MEIPASS'):
# PyInstaller >= 1.6
chdir(sys._MEIPASS)
root = join(sys._MEIPASS, root)
elif '_MEIPASS2' in environ:
# PyInstaller < 1.6 (tested on 1.5 only)
chdir(environ['_MEIPASS2'])
... | from os.path import join, dirname
from os import environ, chdir
import sys
root = 'kivy_install'
if hasattr(sys, '_MEIPASS'):
# PyInstaller >= 1.6
chdir(sys._MEIPASS)
root = join(sys._MEIPASS, root)
elif '_MEIPASS2' in environ:
# PyInstaller < 1.6 (tested on 1.5 only)
chdir(environ['_MEIPASS2'])
... | mit | Python |
17e17a9652b1f3ae88c63a22acb08564f606b7e5 | Revert "Remove unused module" | ethereum/pyethereum,ethereum/pyethereum,karlfloersch/pyethereum,karlfloersch/pyethereum,pipermerriam/pyethereum,pipermerriam/pyethereum,shahankhatch/pyethereum,shahankhatch/pyethereum | ethereum/tests/utils.py | ethereum/tests/utils.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# pyethereum is free software: you can redistribute it and/or modify it
# under the terms of the The MIT License
"""Utilities used by more than one test."""
import json
import os
import tempfile
from ethereum.db import DB as DB
from ethereum.confi... | mit | Python | |
3e8a04c06267b56beb160499d741e424e910265a | fix capitalization | fahhem/openhtf,google/openhtf,ShaperTools/openhtf,fahhem/openhtf,grybmadsci/openhtf,grybmadsci/openhtf,google/openhtf,jettisonjoe/openhtf,ShaperTools/openhtf,google/openhtf,jettisonjoe/openhtf,ShaperTools/openhtf,ShaperTools/openhtf,jettisonjoe/openhtf,ShaperTools/openhtf,amyxchen/openhtf,jettisonjoe/openhtf,grybmadsci... | example/example_plug.py | example/example_plug.py | # Copyright 2014 Google Inc. 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 required by applicable law or agre... | # Copyright 2014 Google Inc. 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 required by applicable law or agre... | apache-2.0 | Python |
825f414ecc4f627e607766f153ce9cd18eb6c666 | add import script for Sefton | DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_sefton.py | polling_stations/apps/data_collection/management/commands/import_sefton.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E08000014'
addresses_name = 'Democracy_Club__04May2017 Sefton.tsv'
stations_name = 'Democracy_Club__04May2017 Sefton.tsv'
elections = ['mayor.liverpool-cit... | bsd-3-clause | Python | |
a1e4b7279457100476da7971bc7fb9ee85af2451 | add new package (#15387) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/pinentry/package.py | var/spack/repos/builtin/packages/pinentry/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pinentry(AutotoolsPackage):
"""pinentry is a small collection of dialog programs that allo... | lgpl-2.1 | Python | |
f6e249197c2864de569ec8bdc1080010d4425354 | add tests for last changes | TheVirtualLtd/bda.plone.orders,andreesg/bda.plone.orders,andreesg/bda.plone.orders,TheVirtualLtd/bda.plone.orders,andreesg/bda.plone.orders,TheVirtualLtd/bda.plone.orders | src/bda/plone/orders/tests/test_mailnotify.py | src/bda/plone/orders/tests/test_mailnotify.py | # -*- coding: utf-8 -*-
from bda.plone.orders import mailnotify as MN
import unittest2 as unittest
class TestMailnotifyUnit(unittest.TestCase):
def test_indent_wrap(self):
"""The _indent mehtod should wrap like defined by it's parameters.
"""
txt = u"abcd " * 3
ctrl = ' abcd\n... | bsd-3-clause | Python | |
4e3d8f902ef0273443f106f36202f31e77a9297c | add co-occurrence based approach to calculate the similarity | StackResys/Stack-Resys,StackResys/Stack-Resys,StackResys/Stack-Resys | src/evaluation/basket_analysis.py | src/evaluation/basket_analysis.py | """ BasketEvaluator analyses co-occurrences to get the similarity """
import evaluator
import pickle
import os
from log import LOGGER
def analyse_baskets(baskets):
""" This function analyse the co-occurrance of baskets """
item_counts = {}
item_cooccurrence = {}
total_count = 0
for basket in basket... | bsd-3-clause | Python | |
1af79cb17c2c00525f54963844367f3aa575a613 | Update redundant-connection-ii.py | yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCo... | Python/redundant-connection-ii.py | Python/redundant-connection-ii.py | # Time: O(nlog*n) ~= O(n), n is the length of the positions
# Space: O(n)
# In this problem, a rooted tree is a directed graph such that,
# there is exactly one node (the root) for
# which all other nodes are descendants of this node, plus every node has exactly one parent,
# except for the root node which has no par... | # Time: O(nlog*n) ~= O(n), n is the length of the positions
# Space: O(n)
# In this problem, a rooted tree is a directed graph such that,
# there is exactly one node (the root) for
# which all other nodes are descendants of this node, plus every node has exactly one parent,
# except for the root node which has no par... | mit | Python |
70012691bb90022ecbd92f9dd5df2a8f5eca3b92 | add apw potential | abonaca/gary,abonaca/gary,abonaca/gary | streamteam/potential/apw.py | streamteam/potential/apw.py | # coding: utf-8
""" Potential used in Price-Whelan et al. (in prep.) TODO """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
# Third-party
import numpy as np
from astropy import log as logger
import astropy.units as u
# Project
from ... | mit | Python | |
847c1a879e7208a0db17cbb8cec20a0f3197120c | Add splines | dronir/HG1G2tools-Python,dronir/HG1G2tools-Python | HG1G2tools/spline.py | HG1G2tools/spline.py |
from __future__ import division
class Spline:
def __init__(self, xval, yval, deriv):
N = len(xval)
A = [0.0 for i in xrange(N)]
B = [1.0 for i in xrange(N)]
C = [0.0 for i in xrange(N)]
R = [0.0 for i in xrange(N)]
gamma = [0.0 for i in xrange(N)]
U = [0... | mit | Python | |
f0fd8359436825c559f285ac0a5310078937732a | Create app.py | samuelstevens9/plivo_text_voting,samuelstevens9/plivo_text_voting,samuelstevens9/plivo_text_voting | app.py | app.py | #!/usr/bin/env python
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import urllib.request, urllib.parse, urllib.error
import json
import os
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in glob... | mit | Python | |
f7d54d1de361721a21c7aa38a81601fc38dd3429 | Create app.py | gurramvimal/mbr | app.py | app.py | #!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask impor... | apache-2.0 | Python | |
08c1d713381f6aafe4b29a9ac482160fe40fb9d0 | Create nocaps.py | TingPing/plugins,TingPing/plugins | HexChat/nocaps.py | HexChat/nocaps.py | from __future__ import division
import hexchat
__module_name__ = 'NoCaps'
__module_author__ = 'TingPing'
__module_version__ = '2'
__module_description__ = 'Lowercase all cap messages'
cap_percentage = 0.6
events = ['Channel Message', 'Channel Msg Hillight',
'Channel Action', 'Channel Action Hillight',
'Private... | mit | Python | |
4d66ded6d7f41dcfedfff89544556f8a28dfb290 | add tcp template | dbirchak/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer | graph_templates/tcp.py | graph_templates/tcp.py | from . import GraphTemplate
class TcpTemplate(GraphTemplate):
target_types = {
'rate': {
'match': '^servers\.(?P<server>[^\.]+)\.(?P<protocol>tcp)\.(?P<type>.*)$',
'default_group_by': 'server',
'default_graph_options': {'vtitle': 'per second'}
}
}
# vim: ts... | apache-2.0 | Python | |
22a11a4befe0c877238b2b4948e12424f7073bef | create Post Admin, set slug is title | opps/opps,opps/opps,YACOWS/opps,opps/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,williamroot/opps | opps/core/admin/article.py | opps/core/admin/article.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from opps.core.models import Post
class PostAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("title",)}
admin.site.register(Post, PostAdmin)
| mit | Python | |
afbcc3b563a111a8277886b9c27f26d51e0cc3c1 | Create acg_gamer_link_from_acg_search.py | Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot | my-ACG/import-claims/acg_gamer_link_from_acg_search.py | my-ACG/import-claims/acg_gamer_link_from_acg_search.py | # -*- coding: utf-8 -*-
import argparse
import importlib
import logging
import os
import sys
import requests
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
from bs4 import BeautifulSoup
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s %(levelname)-8s %... | mit | Python | |
692decd6410521f27c27e45b40ded02e9759cd44 | allow for cpu, memory and storage | mnubo/kubernetes-py,sebastienc/kubernetes-py,mnubo/kubernetes-py,sebastienc/kubernetes-py,froch/kubernetes-py,froch/kubernetes-py | kubernetes/models/v1/ResourceRequirements.py | kubernetes/models/v1/ResourceRequirements.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
from kubernetes.utils import filter_model
class ResourceRequirements(object):
"""
http://kubernetes.io/docs/api-reference/v1/definit... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
from kubernetes.utils import filter_model
class ResourceRequirements(object):
"""
http://kubernetes.io/docs/api-reference/v1/definit... | apache-2.0 | Python |
20f97881d14cdadba31df5615233f3d70ad65c41 | use split_words mechanism to clean up prompts | gooofy/zamia-ai,gooofy/zamia-ai | audio-fix-prompts.py | audio-fix-prompts.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 Guenter Bartsch
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | apache-2.0 | Python | |
96d0fe66fb024b3d5e21fea2f6464bc491915d27 | Create searchflight.py | vkmguy/Flights-and-Hotels,VIkramx89/Flights-and-Hotels | functionality/searchflight.py | functionality/searchflight.py | '''
Created on Aug 12, 2015
@author: sahil.singla01
'''
from validations import ViewValidations
from functionality import flight_booking
from exceptions import CustomExceptions
def search_flights():
FLAG=0
try:
source=input("Enter the source:")
ViewValidations.validate_source(... | epl-1.0 | Python | |
e154b9332baf8fc80e50be515de540e14aacf662 | debug prints | VirusTotal/content,demisto/content,demisto/content,VirusTotal/content,demisto/content,demisto/content,VirusTotal/content,VirusTotal/content | Tests/scripts/create_instances.py | Tests/scripts/create_instances.py | import argparse
from Tests.test_utils import str2bool, run_command
from Tests.scripts.constants import FILTER_CONF, RUN_ALL_TESTS_FORMAT
SERVER_GA = "Demisto-Circle-CI-Content-GA*"
SERVER_MASTER = "Demisto-Circle-CI-Content-Master*"
SERVER_ONE_BEFORE_GA = "Demisto-Circle-CI-Content-OneBefore-GA*"
SERVER_TWO_BEFORE_G... | import argparse
from Tests.test_utils import str2bool, run_command
from Tests.scripts.constants import FILTER_CONF, RUN_ALL_TESTS_FORMAT
SERVER_GA = "Demisto-Circle-CI-Content-GA*"
SERVER_MASTER = "Demisto-Circle-CI-Content-Master*"
SERVER_ONE_BEFORE_GA = "Demisto-Circle-CI-Content-OneBefore-GA*"
SERVER_TWO_BEFORE_G... | mit | Python |
8b7d71e24c6d9d04988caa9cc8bd0b645f296f21 | Create __init__.py | invasi0nZ/ActualBotNet | BOT/__assets__/__init__.py | BOT/__assets__/__init__.py | mit | Python | ||
827d4c9840384b4dcc77f008ee5ccf69e26a93c3 | Fix elastic search | szibis/Diamond,skbkontur/Diamond,gg7/diamond,datafiniti/Diamond,janisz/Diamond-1,dcsquared13/Diamond,tellapart/Diamond,mzupan/Diamond,tusharmakkar08/Diamond,thardie/Diamond,Clever/Diamond,Netuitive/Diamond,datafiniti/Diamond,mfriedenhagen/Diamond,tellapart/Diamond,eMerzh/Diamond-1,actmd/Diamond,dcsquared13/Diamond,sign... | src/collectors/elasticsearch/test/testelasticsearch.py | src/collectors/elasticsearch/test/testelasticsearch.py | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from elasticsearch ... | #!/usr/bin/python
# coding=utf-8
################################################################################
from __future__ import with_statement
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collecto... | mit | Python |
4c970f499c31370495d84c91a10319d308d13fb9 | Add regression tests for bug #1889108 | mahak/nova,openstack/nova,openstack/nova,klmitch/nova,klmitch/nova,klmitch/nova,mahak/nova,openstack/nova,mahak/nova,klmitch/nova | nova/tests/functional/regressions/test_bug_1889108.py | nova/tests/functional/regressions/test_bug_1889108.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python | |
6a7f25bd6303fd932632b2bd9dfe9ca010522c00 | Add model/simulation of cache eviction with a Bit-Pseudo-LRU cache | kevinmel2000/rowhammer-test,shekkbuilder/rowhammer-test,kevinmel2000/rowhammer-test,kevinmel2000/rowhammer-test,kevinmel2000/rowhammer-test,shekkbuilder/rowhammer-test,shekkbuilder/rowhammer-test,shekkbuilder/rowhammer-test | cache_analysis/cache_model.py | cache_analysis/cache_model.py | # Copyright 2015, Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | apache-2.0 | Python | |
2f13c13ef1d89d4ed25a3ed756e69bde58b23b53 | add tf repeater for serial tf data | MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI | EmeraldAI/Application/SerialProxy/SerialTFRepeater.py | EmeraldAI/Application/SerialProxy/SerialTFRepeater.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(dirname(dirname(abspath(__file__))))))
reload(sys)
sys.setdefaultencoding('utf-8')
from EmeraldAI.Logic.ROS.Helper.TFLooper import TFLooper
import rospy
import tf2_ros as tf
from geometry_msgs.ms... | apache-2.0 | Python | |
54cfb1bc99f52528430c7d2f59fa8fd42e9aa77a | Make it possible to select notification priority #36 | Nordeus/pushkin,Nordeus/pushkin | pushkin/database/migrations/versions/67b14b57d9e4_notification_priority.py | pushkin/database/migrations/versions/67b14b57d9e4_notification_priority.py | """notification priority
Revision ID: 67b14b57d9e4
Revises: ba3a6442af2b
Create Date: 2016-10-31 09:02:50.930136
"""
# revision identifiers, used by Alembic.
revision = '67b14b57d9e4'
down_revision = 'ba3a6442af2b'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade()... | mit | Python | |
e07eb294a01ce81b094477005e087332b5c20196 | Add some tests in a Massively Parallel Forecasting Architecture #115 | antoinecarme/pyaf,antoinecarme/pyaf,antoinecarme/pyaf | tests/xeon-phi-parallel/test_ozone_too_many_threads.py | tests/xeon-phi-parallel/test_ozone_too_many_threads.py | from __future__ import absolute_import
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
b1 = tsds.load_ozone()
df = b1.mPastData
#df.tail(10)
#df[:-10].tail()
#df[:-10:-1]
#df.describe()
lEngine = autof.cForecastEngine()
lEngine
H = b1.mHorizon;
l... | bsd-3-clause | Python | |
5fdbb45c38c2bf542184ed8e7d750b3cfaa6fbb4 | Add raw data filter plugin | kwikteam/phy,kwikteam/phy,kwikteam/phy | plugins/raw_data_filter.py | plugins/raw_data_filter.py | """Show how to add a custom raw data filter for the TraceView and Waveform View
Use Alt+R in the GUI to toggle the filter.
"""
import numpy as np
from scipy.signal import butter, lfilter
from phy import IPlugin
class RawDataFilterPlugin(IPlugin):
def attach_to_controller(self, controller):
b, a = butt... | bsd-3-clause | Python | |
16f91787e3bd6f2067e1bbf7f0fc549267b34366 | add original keras script | davharris/leafpuppy,davharris/leafpuppy,davharris/leafpuppy | cnn.py | cnn.py | from __future__ import absolute_import
from __future__ import print_function
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolutio... | bsd-3-clause | Python | |
96bb57f81cf244784d35268e49e1e88395f560cb | add transcribe tool | fy2462/apollo,fy2462/apollo,fy2462/apollo,startcode/apollo,startcode/apollo,startcode/apollo,fy2462/apollo,startcode/apollo,fy2462/apollo,startcode/apollo,fy2462/apollo,startcode/apollo | modules/tools/rosbag/transcribe.py | modules/tools/rosbag/transcribe.py | #!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo Authors. 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 ... | apache-2.0 | Python | |
7dd90e8cd37950c8097b93af059fc897a5d1f9c2 | Add modified track utilities. | puchake/creepy-drummer,puchake/bucketnet | midi/track_utils.py | midi/track_utils.py | """
This module contains various track related operations for example: conversion
between note list and midi track, creation of the new track etc.
"""
from mido import Message, MetaMessage
# Numeric boundaries for integers denoting available guitar programs.
FIRST_GUITAR_PROGRAM = 24
LAST_GUITAR_PROGRAM = 31
def i... | mit | Python | |
8ef93cb8c5d8d42faac45a514b2dcbe865b65208 | Add mkerefuse.refuse module | tomislacker/python-mke-trash-pickup,tomislacker/python-mke-trash-pickup | mkerefuse/refuse.py | mkerefuse/refuse.py | unlicense | Python | ||
e22173b8492fefe3d562f7efe684aa560772d757 | Sort a linked list using insertion sort | don7hao/leetcode_oj,don7hao/leetcode_oj | insertion_sort_list.py | insertion_sort_list.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param head, a ListNode
# @return a ListNode
def insertionSortList(self, head):
if None == head:
ret... | apache-2.0 | Python | |
23d88adce743ced171644c2b125b05a24b91d02a | Fix for Python 3. | datadriventests/ddt,edx/ddt,domidimi/ddt,edx/ddt,datadriventests/ddt,domidimi/ddt | ddt.py | ddt.py | from functools import wraps
__version__ = '0.2.0'
MAGIC = '%values' # this value cannot conflict with any real python attribute
def data(*values):
"""
Method decorator to add to your test methods.
Should be added to methods of instances of ``unittest.TestCase``.
"""
def wrapper(func):
... | from functools import wraps
__version__ = '0.2.0'
MAGIC = '%values' # this value cannot conflict with any real python attribute
def data(*values):
"""
Method decorator to add to your test methods.
Should be added to methods of instances of ``unittest.TestCase``.
"""
def wrapper(func):
... | mit | Python |
f8fc041056b612f7f9b538e1802792cca7ced411 | Add a module for interacting with git. | Kortemme-Lab/klab,Kortemme-Lab/klab,Kortemme-Lab/klab,Kortemme-Lab/klab | git.py | git.py | #!/usr/bin/env python2
def get_git_root():
import shlex
from . import process
command = shlex.split('git rev-parse --show-toplevel')
directory = process.check_output(command)
return directory.strip()
| mit | Python | |
42ffa980b8d6d56a7d2d61df5627ee2abc37fe7d | add missing file | caktus/smartmin,nyaruka/smartmin,caktus/smartmin,nyaruka/smartmin,caktus/smartmin,caktus/smartmin,nyaruka/smartmin | smartmin/users/context_processors.py | smartmin/users/context_processors.py | from __future__ import unicode_literals
from django.conf import settings
def links_components(request):
protocol = 'https' if request.is_secure() else 'http'
hostname = getattr(settings, 'HOSTNAME', request.get_host())
return {"protocol": protocol, "hostname": hostname}
| bsd-3-clause | Python | |
bb0a4746ba0cd8088af3b678476c68a1deeb511b | Add webhook authorization tests | PyBossa/pybossa,PyBossa/pybossa,geotagx/pybossa,Scifabric/pybossa,geotagx/pybossa,Scifabric/pybossa | test/test_authorization/test_webhooks_auth.py | test/test_authorization/test_webhooks_auth.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SciFabric LTD.
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | agpl-3.0 | Python | |
6df2413f0207bf800697c430c4e6f1b1c46bbac9 | Add directory to story python plotting scripts. Add script to plot a 3D ellipsoid. | agrawalabhishek/NAOS,agrawalabhishek/NAOS,agrawalabhishek/NAOS | python/ellipsoid3DShape.py | python/ellipsoid3DShape.py | '''
Copyright (c) 2016 Abhishek Agrawal (abhishek.agrawal@protonmail.com)
Distributed under the MIT License.
See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT
'''
# Set up modules and packages
# I/O
import csv
from pprint import pprint
# Numerical
import numpy as np
import pandas as pd
#... | mit | Python | |
a2371ea3dfa7a8bd5c7609079165643d587099a1 | add shuffle_merge | hidu/tool,hidu/tool,hidu/tool,hidu/tool,hidu/tool | bin/shuffle_merge.py | bin/shuffle_merge.py | #!/usr/bin/env python
#coding=utf-8
import argparse
import sys
def parse_args():
description ="shuffle and merge files"
parser = argparse.ArgumentParser(description = description)
parser.add_argument('input_files',nargs = '*')
parser.add_argument('-n',type=int, default=0,help="output file total,0:same... | mit | Python | |
a460a637ddd4e35acc468c01528ead973c50751b | Add legalization patterns. | sunfishcode/cretonne,stoklund/cretonne,stoklund/cretonne,stoklund/cretonne,sunfishcode/cretonne,sunfishcode/cretonne | meta/cretonne/legalize.py | meta/cretonne/legalize.py | """
Patterns for legalizing the `base` instruction set.
The base Cretonne instruction set is 'fat', and many instructions don't have
legal representations in a given target ISA. This module defines legalization
patterns that describe how base instructions can be transformed to other base
instructions that are legal.
"... | apache-2.0 | Python | |
0b15627a9604edb766705dc1234544db2638b692 | allow null values in property_value filters | puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/filters/specs.py | corehq/apps/userreports/filters/specs.py | from jsonobject import JsonObject, StringProperty, ListProperty, DictProperty
from jsonobject.base import DefaultProperty
from corehq.apps.userreports.exceptions import BadSpecError
from corehq.apps.userreports.expressions.getters import getter_from_property_reference
from corehq.apps.userreports.operators import OPERA... | from jsonobject import JsonObject, StringProperty, ListProperty, DictProperty
from jsonobject.base import DefaultProperty
from corehq.apps.userreports.expressions.getters import getter_from_property_reference
from corehq.apps.userreports.operators import OPERATORS
from corehq.apps.userreports.specs import TypeProperty
... | bsd-3-clause | Python |
fead6548b809b1e89ffe4bf42d9fb614eee1a2f4 | Add "good_choices" module | piotrekw/django-good-choices,piotrekio/django-good-choices | good_choices.py | good_choices.py | import inspect
import six
class ChoicesMeta(type):
def __new__(cls, name, bases, attrs):
ch = list()
updated_attrs = dict()
for name, value in six.iteritems(attrs):
if not name.startswith('_'):
try:
index, label = value
except... | mit | Python | |
37121e493af735db0879a514ccb4847d9ac7285b | Create RmDupFrSortedLst2_001.py | cc13ny/Allin,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/codirit,Chasego/cod,Chasego/cod,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,Chasego/codi,Chasego/codi,Chasego/codi,Chasego/codirit,Chasego/cod,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/codi,cc13ny/algo,Chasego/codirit,Chasego/cod,Chasego/codi,cc13ny/algo,cc... | leetcode/082-Remove-Duplicates-from-Sorted-List-II/RmDupFrSortedLst2_001.py | leetcode/082-Remove-Duplicates-from-Sorted-List-II/RmDupFrSortedLst2_001.py | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @return {ListNode}
def deleteDuplicates(self, head):
if head == None:
return None
t = {}
p = h... | mit | Python | |
059fd02afe1149b42120e0ea06fa5516a372fd64 | Create lib.py | milkey-mouse/UDT,milkey-mouse/UDT | lib.py | lib.py |
def recv()
| mit | Python | |
df48f6b57dd2fff8e22c0df95247afb0a630dd76 | Create context manager to lock on ir.config_paramter record | ingadhoc/infrastructure,ingadhoc/odoo-infrastructure,online-sanaullah/odoo-infrastructure | infrastructure/utils/utils.py | infrastructure/utils/utils.py | import contextlib
from openerp import exceptions
@contextlib.contextmanager
def synchronize_on_config_parameter(env, parameter):
param_model = env['ir.config_parameter']
param = param_model.search([('key', '=', parameter)])
if param:
try:
env.cr.execute(
'''select *
... | agpl-3.0 | Python | |
9e7f288ca5b4e39e68dcbb2645d62090e799a886 | Add string formating samples | yoeo/pyhow | src/pyhow/string_format.py | src/pyhow/string_format.py | """ String formating language samples. """
import collections
import locale
# category: exemples
def basic_formating():
""" Simple replacement... """
return "{}".format('infinite')
def deep_formating():
""" Mix of many formating possibilities. """
return "{value.__class__.__bases__[0].__name__!... | mit | Python | |
ba1ceba2b65008f12d747f831b5cfa354cf306af | add script | t-sullivan/rename-TV | renametv.py | renametv.py | import os
import sys
USAGE = "Usage: " + sys.argv[0] +\
" directory \"Name of Series\" season [start] [extentison]\n"\
"Rename video files within specified directory"
episodenames = {}
def main():
if len(sys.argv) < 3:
print(USAGE)
else:
directory = sys.argv[1]
title ... | mit | Python | |
d7b9bf4cbdf5a21162346159ad0e9e2011e89807 | add modules dir | CrazyBBer/Python-Learn-Sample | Modules/modules_BuiltIn.py | Modules/modules_BuiltIn.py | #!/usr/bin/env python3
# -*- coding utf-8 -*-
__Author__ ='eamon'
'Modules Built-In'
from datetime import datetime
now = datetime.now()
print(now)
print(type(now))
dt=datetime(2015,10,5,20,1,20)
print(dt)
print(dt.timestamp())
t=1444046480.0
print(datetime.fromtimestamp(t))
print(datetime.utcfromtimestamp(t... | mit | Python | |
0f86a272840c4363b08800acfc4f9a4438aa6f48 | Add wsgi module. | flupzor/bijgeschaafd,flupzor/newsdiffs,flupzor/newsdiffs,flupzor/bijgeschaafd,flupzor/bijgeschaafd,flupzor/bijgeschaafd,flupzor/newsdiffs,flupzor/newsdiffs | website/wsgi.py | website/wsgi.py | """
WSGI config for newsdiffs project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings_main")
from django... | mit | Python | |
a3e273de64fb2be9bb58e596bcc375945ea18f3d | Add tests for virtool.organize.organize_jobs | virtool/virtool,igboyes/virtool,virtool/virtool,igboyes/virtool | tests/test_organize_jobs.py | tests/test_organize_jobs.py | import virtool.organize
class TestOrganizeJobs:
async def test_unset_archived(self, test_motor):
await test_motor.jobs.insert_many([
{
"_id": 1,
"archived": False
},
{
"_id": 2,
"archived": True
... | mit | Python | |
46f1654a736d3540db1671b0677a729681c3b04f | Copy main.py to old.py | Dperez19279/RecycloTrash | old.py | old.py | import subprocess
from time import sleep
import timeout
python_path="/usr/bin/python"
motion_path="/home/pi/RecycloTrash/motion.py"
dsreader_path="/home/pi/RecycloTrash/QR/dsreader"
sample_dsreader_path="/home/pi/sampledsreader.py"
sh_path="/bin/sh"
motion=[python_path,motion_path]
dsreader=dsreader_path
sample_dsrea... | apache-2.0 | Python | |
dfaae5ee2f8bc371bd17128c28c95c11f28f24c2 | Move new script from soon to be removed dartium_tools | dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lan... | tools/dartium/deploy_aar.py | tools/dartium/deploy_aar.py | #!/usr/bin/env python
#
# Copyright (c) 2014 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 glob
import optparse
import os.path
import re
import subprocess
import sys
import utils
# FIXME: integrate this helper sc... | bsd-3-clause | Python | |
8f82f82ececde2d6381919d334f751554701eb9b | Add a case to test that 'stty -a' displays the same output before and after running the lldb command. | apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb | test/terminal/TestSTTYBeforeAndAfter.py | test/terminal/TestSTTYBeforeAndAfter.py | """
Test that 'stty -a' displays the same output before and after running the lldb command.
"""
import os
import unittest2
import lldb
import pexpect
from lldbtest import *
class CommandLineCompletionTestCase(TestBase):
mydir = os.path.join("functionalities", "completion")
@classmethod
def classCleanup(... | apache-2.0 | Python | |
dd1220b7a46e84e7859cfe11b2650cc7a21cb20e | Create answer.py2.py | neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu/Paiza-POH-MyAnswers,neetsdkasu... | POH6/tsubame/answer.py2.py | POH6/tsubame/answer.py2.py | # coding: utf-8
#
# 結果 https://paiza.jp/poh/joshibato/tsubame/result/aa26ed7d
#
n_str = raw_input()
n = int(n_str)
n1 = int(n_str[1])
n10 = int(n_str[0])
r = n + n1 + n10
print r
| mit | Python | |
1818959519207eb1bd888d8abed096c32bb85b96 | Add a regression test for whitespace normalization in the BibTeX parser. | live-clones/pybtex | pybtex/tests/bibtex_parser_test.py | pybtex/tests/bibtex_parser_test.py | from pybtex.database import BibliographyData
from pybtex.core import Entry
from pybtex.database.input.bibtex import Parser
from cStringIO import StringIO
test_data = [
(
'''
''',
BibliographyData(),
),
(
'''@ARTICLE{
test,
title={Polluted
... | mit | Python | |
f3c546afd159d9a4ba006f448faec1653d974342 | Add missing vouches to employees. | akatsoulas/mozillians,mozilla/mozillians,mozilla/mozillians,mozilla/mozillians,akatsoulas/mozillians,akatsoulas/mozillians,mozilla/mozillians,akatsoulas/mozillians | mozillians/users/migrations/0038_auto_20180815_0108.py | mozillians/users/migrations/0038_auto_20180815_0108.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-15 08:08
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
def add_missing_employee_vouches(apps, schema_editor):
UserProfile = apps.get_model('users', 'UserProfile')
IdpProfile = apps.get... | bsd-3-clause | Python | |
09bb9a917fefd44881ceb46f73f494603797bbbf | Add numpy exercise todo | jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm | python_practice/numpy_exercise1.py | python_practice/numpy_exercise1.py | import numpy as np
# init
matrix_a = np.array([2,3,4])
print matrix_a
# shape
print matrix_a.shape
# reshape
# ndim
print matrix_a.ndim
# dtype
print matrix_a.dtype
# itemsize
print matrix_a.itemsize
# size
print matrix_a.size
| mit | Python | |
3a75f01d6ece9eec332dff1ca7518af4f7c7f462 | Add unit test for barrier | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | test/hoomd_script/test_barrier.py | test/hoomd_script/test_barrier.py | # -*- coding: iso-8859-1 -*-
# Maintainer: jglaser
from hoomd_script import *
init.setup_exec_conf();
import unittest
import os
# unit test to run a simple polymer system with pair and bond potentials
class replicate(unittest.TestCase):
def test_barrier(self):
comm.barrier();
def test_barrier_all(sel... | bsd-3-clause | Python | |
2880731da31dd7dd37d1fab523bc30e68e528f2e | fix an order error in transixor_preproc | Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2 | transiNXOR_modeling/transixor_qv_predictor.py | transiNXOR_modeling/transixor_qv_predictor.py | import sys
sys.path.append('../')
import numpy as np
from itertools import product
from ac_qv_api import predict_qs
import matplotlib.pyplot as plt
import glob
# vds = np.linspace(0, 0.4, 41)
vds = np.linspace(0.4, 0.4, 1)
# vbg = np.linspace(0, 0.4, 41)
vbg = np.linspace(0.0, 0.0, 1)
vtg = np.linspace(0.0, 0.4, 67)
i... | mit | Python | |
6d7f87063b9c326535c5310b6825e449dc2b9bd1 | test mac address usage | sassoftware/jobmaster,sassoftware/jobmaster,sassoftware/jobmaster | test/mactest.py | test/mactest.py | #!/usr/bin/python2.4
#
# Copyright (c) 2007 rPath, Inc.
#
# All rights reserved
#
import testsuite
testsuite.setup()
import os
import tempfile
import jobmaster_helper
from jobmaster import xenmac
class MasterTest(jobmaster_helper.JobMasterHelper):
def testSuperUser(self):
try:
raise xenmac.S... | apache-2.0 | Python | |
2318706dfdf232bec4a0329292aa5e2794ba29f6 | add sherock and pairs | xbfool/hackerrank_xbfool | src/algorithms/arrays_and_sorting/sherock_and_pairs.py | src/algorithms/arrays_and_sorting/sherock_and_pairs.py | from collections import Counter
times = input()
for i in range(times):
n = input()
ar = map(int, raw_input().split())
c = Counter(ar)
l = len(ar)
total = 0
for i in c.values():
total += i * (i - 1)
print total | mit | Python | |
324694ba0b7522ed4d2f7aa2b6691009af1b9055 | add a sprite sheet generator | dev-zzo/Spritesse,dev-zzo/Spritesse | Scripts/gen_spritesheet.py | Scripts/gen_spritesheet.py | import argparse
def generate(texture_name, size, count, offset, spacing):
print('<?xml version="1.0" encoding="utf-8" ?>')
print('<XnaContent>')
print(' <Asset Type="ThreeSheeps.Spritesse.PipelineExts.SpriteSheetContent">')
print(' <TextureName>' + texture_name + '</TextureName>')
print(' <D... | unlicense | Python | |
5f87d3eb56711fe908b01708db2ec54aca71fbb7 | Create yinhang.py | shenyan1/iobenchmark,shenyan1/iobenchmark,shenyan1/iobenchmark,shenyan1/iobenchmark | test/yinhang.py | test/yinhang.py | #coding=gb2312
import string
utype=(5812,5814,5811,5813)
output=[0 for x in range(1,13)]
myfile=open('H:\\ceshi.txt')
for line in myfile.readlines():
elem=line.split('\t')
code=int(elem[5]) % 10000
if int(elem[4]) in utype and code == 2900:
mon_entry=int(elem[2].split(' ')[0].split('-')[1])
money_entry=int(ele... | apache-2.0 | Python | |
c7e7cd1c64fea12b214ec88d9b49c21e983856be | add to centralize globals | pmquang/python-anyconfig,pmquang/python-anyconfig,ssato/python-anyconfig,ssato/python-anyconfig | anyconfig/globals.py | anyconfig/globals.py | #
# Copyright (C) 2013 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
import logging
import os
AUTHOR = 'Satoru SATOH <ssat@redhat.com>'
VERSION = "0.0.3.8"
# For daily snapshot versioning mode:
if os.environ.get("_ANYCONFIG_SNAPSHOT_BUILD", None) is not None:
import datetime
VERSION = VERSION + datetime... | mit | Python | |
b8feab382cc449c41f4b92cc6f25c9ded2d5e472 | Add a bunch of tests for the C extension/library | khaledhosny/psautohint,khaledhosny/psautohint | tests/unittests/test_extension.py | tests/unittests/test_extension.py | import pytest
import sys
from fontTools.misc.py23 import tounicode
from psautohint import _psautohint
INFO = b"FontName Foo"
NAME = b"Foo"
GLYPH = b"""% square
0 500 rb
60 500 ry
sc
560 500 mt
560 0 dt
60 0 dt
60 500 dt
cp
ed
"""
def test_autohint_good_args():
_psautohint.autohint(INFO, GLYPH)
def test_auto... | apache-2.0 | Python | |
94c0edc8f276b356ac3022d378c8230a18642eb6 | Create running_script_for_design_group.py | archonren/similarity | running_script_for_design_group.py | running_script_for_design_group.py | __author__ = 'Archon_ren'
from design_group import *
if __name__ == '__main__':
x = users_data()
x.load_Data()
x.get_design_group_tag()
x.get_tags()
x.get_minimium_model()
#x.clustering()
x.load_clustering_result()
x.vote()
x.final_suggestion()
print(x.out)
| apache-2.0 | Python | |
e39f7fda1037c40758d29d580d8752ed87f7c0bf | Expand Comments limit | torrenegra/ekratia,torrenegra/ekratia,ekratia/ekratia,andresgz/ekratia,ekratia/ekratia,torrenegra/ekratia,andresgz/ekratia,andresgz/ekratia,ekratia/ekratia,torrenegra/ekratia,andresgz/ekratia,ekratia/ekratia | ekratia/threads/migrations/0002_auto_20151009_1557.py | ekratia/threads/migrations/0002_auto_20151009_1557.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('threads', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='comment',
... | bsd-3-clause | Python | |
c8bff113f85738f783fd00dcb1b9dacfa24cf589 | Add unit tests for Emails() | auth0/auth0-python,auth0/auth0-python | auth0/v2/test/test_emails.py | auth0/v2/test/test_emails.py | import unittest
import mock
from ..emails import Emails
class TestEmails(unittest.TestCase):
@mock.patch('auth0.v2.emails.RestClient')
def test_get(self, mock_rc):
mock_instance = mock_rc.return_value
e = Emails(domain='domain', jwt_token='jwttoken')
e.get()
args, kwargs = m... | mit | Python | |
98175081ffb54f98c0bd42ce1823ab16e38dfb88 | add a command to get the last sync time | crateio/crate.io | crate_project/apps/crate/management/commands/get_last_sync.py | crate_project/apps/crate/management/commands/get_last_sync.py | import redis
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
r = redis.StrictRedis(**getattr(settings, "PYPI_DATASTORE_CONFIG", {}))
print r.get("crate:pypi:since")
| bsd-2-clause | Python | |
56ba317406f6743b652bcd21fb04e1ba275841e9 | add testing_facility_name2 | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/enikshay/management/commands/testing_facility_name2.py | custom/enikshay/management/commands/testing_facility_name2.py | from __future__ import print_function
from corehq.apps.locations.models import SQLLocation
from corehq.apps.users.models import CommCareUser
from custom.enikshay.management.commands.utils import (
BaseEnikshayCaseMigration,
get_result_recorded_form,
is_person_public,
)
class Command(BaseEnikshayCaseMigra... | bsd-3-clause | Python | |
6c994807f5e7e79bea579561362aa7a29802d328 | Update Old Data | joshzarrabi/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,yw374cornell/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,yw374cornell/e-mission-server,joshzarrabi/e-mission-server,shankari/e-mission-server,joshzarrabi/e... | CFC_WebApp/utils/migrations/updateExistence.py | CFC_WebApp/utils/migrations/updateExistence.py | from moves import Moves
from pymongo import MongoClient
from pymongo.errors import DuplicateKeyError
from datetime import datetime, timedelta
import logging
import pytz
import json
from dateutil import parser
from get_database import get_mode_db, get_section_db, get_trip_db, get_moves_db
from time import sleep
from col... | bsd-3-clause | Python | |
db11120077783fc3cc539fa919f822004d3ff355 | Send mails to contacts referenced in a csv file. | RuralIndia/pari,RuralIndia/pari,RuralIndia/pari,RuralIndia/pari | pari/user/management/commands/bulk_mailer.py | pari/user/management/commands/bulk_mailer.py | from django.core.management.base import BaseCommand
from django.core.mail import EmailMessage, get_connection
from django.template import Template, Context
from mezzanine.pages.models import Page
import csv
class Command(BaseCommand):
args = "<csv_file_path> [<from>]"
help = "Send mails to contacts on a CSV... | bsd-3-clause | Python | |
e1a37a66cb5c2f73cd5b64c5b0bc1fc77243d17c | fix heap_sort test case | EUNIX-TRIX/al-go-rithms,ZoranPandovski/al-go-rithms,Deepak345/al-go-rithms,Deepak345/al-go-rithms,manikTharaka/al-go-rithms,Cnidarias/al-go-rithms,Cnidarias/al-go-rithms,Deepak345/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-r... | sort/heap_sort/python/heap_sort.py | sort/heap_sort/python/heap_sort.py | # To heapify subtree rooted at index i.
# n is size of heap
def heapify(arr, n, i):
largest = i # Initialize largest as root
l = 2 * i + 1 # left = 2*i + 1
r = 2 * i + 2 # right = 2*i + 2
# See if left child of root exists and is
# greater than root
if l < n and arr[i] < arr[l]:
largest = l
# S... | # To heapify subtree rooted at index i.
# n is size of heap
def heapify(arr, n, i):
largest = i # Initialize largest as root
l = 2 * i + 1 # left = 2*i + 1
r = 2 * i + 2 # right = 2*i + 2
# See if left child of root exists and is
# greater than root
if l < n and arr[i] < arr[l]:
largest = l
# S... | cc0-1.0 | Python |
0ceb8682acacbdebc769cf0f310a10c2b699816d | add missing file | PROSIC/prosic-evaluation,PROSIC/prosic-evaluation | scripts/plot-score-dist.py | scripts/plot-score-dist.py | from itertools import product
import matplotlib
matplotlib.use("agg")
from matplotlib import pyplot as plt
import seaborn as sns
import pandas as pd
import common
vartype = snakemake.wildcards.vartype
colors = common.get_colors(snakemake.config)
def props(callers):
return product(callers, snakemake.params.len_ra... | mit | Python | |
d89251be3651530e190fd3d0e35cda1f9d8eb43c | Create initial-test.py | Raspberrypirate/Pub-Crawl | initial-test.py | initial-test.py | # Set base url as basis on which to make queries
BASE-URL ="https://maps.googleapis.com/maps/api/distancematrix/json?"
# A little confused about the library here: https://github.com/googlemaps/google-maps-services-python
| apache-2.0 | Python | |
add781469f6d5dbd77b2d9e1b75307ac7c925d09 | solve Warmup/Solve Me First problem | sokolowskik/DailyProgrammer,sokolowskik/DailyProgrammer,kamiljsokolowski/DailyProgrammer,kamiljsokolowski/DailyProgrammer | HackerRank/Algorithms/Warmup/solve_me_first.py | HackerRank/Algorithms/Warmup/solve_me_first.py | def solve_me_first(a, b):
""" Scan 2 integers from STDIN and return their sum on STDOUT """
return a + b
num1 = input()
num2 = input()
res = solve_me_first(num1, num2)
print res
| mit | Python | |
41ef2e397b89a32b0643c8fa0d449521e2f9d8b7 | add __about__ | nschloe/maelstrom,nschloe/maelstrom | maelstrom/__about__.py | maelstrom/__about__.py | # -*- coding: utf-8 -*-
#
__version__ = '0.1.0'
__author__ = 'Nico Schlömer'
__author_email__ = 'nico.schloemer@gmail.com'
__website__ = 'https://github.com/nschloe/maelstrom'
__status__ = 'Development Status :: 4 - Beta'
__license__ = 'License :: OSI Approved :: MIT License'
| mit | Python | |
9fa730da2d08bb72bfd6190ff1c727fd8425fe39 | Add jobs admin | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/db/admin/jobs.py | polyaxon/db/admin/jobs.py | from django.contrib import admin
from db.admin.abstract_job import JobStatusAdmin
from db.admin.utils import DiffModelAdmin
from db.models.jobs import Job, JobStatus
class JobAdmin(DiffModelAdmin):
pass
admin.site.register(Job, JobAdmin)
admin.site.register(JobStatus, JobStatusAdmin)
| apache-2.0 | Python | |
8f477cc8024c15ecc5801c2d04c915ebdfa6f093 | add search by organisation | iglocska/PyMISP,grolinet/PyMISP,pombredanne/PyMISP | pymisp/testing.py | pymisp/testing.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from api import PyMISP
from keys import src, dest
url_source = 'https://misp.circl.lu'
url_dest = 'https://misppriv.circl.lu'
source = None
destination = None
def init():
global source
global destination
source = PyMISP(url_source, src, 'xml')
destination =... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from api import PyMISP
from keys import src, dest
url_source = 'https://misp.circl.lu'
url_dest = 'https://misppriv.circl.lu'
source = None
destination = None
def init():
global source
global destination
source = PyMISP(url_source, src, 'xml')
destination =... | bsd-2-clause | Python |
ebcc9aef51d6244e69b5241b49359f8e8d2c0f85 | Add beginning of splinter tests | Estmator/EstmatorApp,Estmator/EstmatorApp,Estmator/EstmatorApp | estmator_project/estmator_project/test_functional.py | estmator_project/estmator_project/test_functional.py | from django.contrib.staticfiles.testing import LiveServerTestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import Client, TestCase
from splinter import Browser
from time import sleep
from .factories import (
UserFactory, ClientFactory, CompanyFactor... | mit | Python | |
8bbcc9f92cd0f21c38ac5a705575a5c989972096 | Solve 1006 in python | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | solutions/uri/1006/1006.py | solutions/uri/1006/1006.py | a = float(input())
b = float(input())
c = float(input())
print("MEDIA = {:.1f}".format((a * 2.0 + b * 3.0 + c * 5.0) / 10.0))
| mit | Python | |
3bf10db29836ebc475940880cc2a4b5f2c12cbd2 | Bring over connector.py from previous work. | jinverar/crits,lakiw/cripts,korrosivesec/crits,davidhdz/crits,korrosivesec/crits,0x3a/crits,seanthegeek/crits,davidhdz/crits,Magicked/crits,DukeOfHazard/crits,DukeOfHazard/crits,seanthegeek/crits,cfossace/crits,0x3a/crits,davidhdz/crits,Lambdanaut/crits,kaoscoach/crits,cfossace/crits,kaoscoach/crits,seanthegeek/crits,D... | crits/services/connector.py | crits/services/connector.py | # (c) 2014, The MITRE Corporation. All rights reserved.
# Source code distributed pursuant to license agreement.
class UnknownConnector(Exception):
"""
Exception for dealing with an unknown connector type.
"""
def __init__(self, value):
self.value = value
def __str__(self):
retur... | mit | Python | |
eefda8baf4a1c3ee78ad1a58eed99bbfb1f3049f | Add constants for infinities and undefined values | jackromo/mathLibPy | mathlibpy/constants.py | mathlibpy/constants.py | # All universal constants in MathLibPy.
# TODO: Make these actually constant.
INFINITY = "infinity"
NEG_INF = "neg_inf" # Negative infinity
UNDEFINED = "undefined"
REAL_CARD = "real_card" # Cardinality of the set of real numbers
NAT_CARD = "nat_card" # Cardinality of the set of natural numbers
| mit | Python | |
9f86f880a2f19820a4e50a18ef2e7d2faffa18dd | Remove groups from django admin | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | custom_registration/admin.py | custom_registration/admin.py | from django.contrib import admin
from django.contrib.auth.models import Group
admin.site.unregister(Group)
| mit | Python | |
5a88660c98511f8cc0a8c210490a60b4805bdc58 | Add unit test for the BaseTrigger.parameters() method | anchore/anchore-engine,anchore/anchore-engine,anchore/anchore-engine | tests/unit/anchore_engine/services/policy_engine/engine/policy/test_gate.py | tests/unit/anchore_engine/services/policy_engine/engine/policy/test_gate.py | import pytest
from anchore_engine.services.policy_engine.engine.policy.gates import PackageCheckGate
from anchore_engine.services.policy_engine.engine.policy.gates.dockerfile import (
EffectiveUserTrigger,
)
from anchore_engine.services.policy_engine.engine.policy.gates.npms import (
PkgMatchTrigger,
)
from an... | apache-2.0 | Python | |
3f2ae3d0efe05389ef5f269f7e3d926d64da8e3e | Test that query results with None IDs (e.g. some outer join cases) are handled correctly, i.e. return None for that object. | drnlm/sqlobject,drnlm/sqlobject,sqlobject/sqlobject,sqlobject/sqlobject | sqlobject/tests/test_NoneValuedResultItem.py | sqlobject/tests/test_NoneValuedResultItem.py | '''Test that selectResults handle NULL values
from, for example, outer joins.'''
from sqlobject import *
from sqlobject.tests.dbtest import *
class TestComposer(SQLObject):
name = StringCol()
class TestWork(SQLObject):
class sqlmeta:
idName = "work_id"
composer = ForeignKey('TestComposer')
t... | lgpl-2.1 | Python | |
e8a0756a3a518a980bc4909e3688429a429fc4d2 | Add top-level convenience aliases | zhurongze/oslo.messaging,magic0704/oslo.messaging,isyippee/oslo.messaging,hkumarmk/oslo.messaging,JioCloud/oslo.messaging,apporc/oslo.messaging,redhat-openstack/oslo.messaging,ozamiatin/oslo.messaging,ozamiatin/oslo.messaging,eayunstack/oslo.messaging,citrix-openstack-build/oslo.messaging,stevei101/oslo.messaging,redha... | openstack/common/messaging/__init__.py | openstack/common/messaging/__init__.py |
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | apache-2.0 | Python |
e1132fb8642a572eb674b69160db6bbd83b52cab | Add migration for descriptor_dirty field in Sample | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | resolwe_bio/migrations/0007_sample_descriptor_dirty.py | resolwe_bio/migrations/0007_sample_descriptor_dirty.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-03 10:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('resolwe_bio', '0006_alter_versionfield'),
]
operations = [
migrations.AddFi... | apache-2.0 | Python | |
a6167aa6f6a64ca7de1a5e1669e2817ba5fb679b | Create patent_to_sql.py | Pletron/Patentor | patent_to_sql.py | patent_to_sql.py | #!/usr/bin/python
# Written by Philip Masek
# More info found at https://www.github.com/pletron
import sys, getopt
import xml.etree.ElementTree as xml
from datetime import datetime
def main(argv):
inputfile = ''
outputfile = ''
try:
opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
except getopt.Geto... | mit | Python | |
eb807ecb3abdf8d16e85f11c25ede0d6f6695ec1 | Add rating comparison script | ceeac/AutoPlayer,ceeac/AutoPlayer | ratingComparison.py | ratingComparison.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
def rating(playCount, skipCount):
#return
return (1-np.exp(-playCount/(0.1+skipCount))) * np.exp(-skipCount/playCount)
def main():
maxPlay = 30
maxS... | mit | Python | |
e3fdf6c03420cd95da33f4e36a0721308107687e | Add automated script for determining which features to suppress | pdarragh/MinSem | suppress_classifier.py | suppress_classifier.py | #!/usr/bin/env python3
import argparse
import subprocess
from itertools import combinations
from sys import executable
parser = argparse.ArgumentParser()
parser.add_argument('classifier', help='path to the classifier module')
parser.add_argument('feature_count', help='the number of features', type=int)
parser.add_ar... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.