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 |
|---|---|---|---|---|---|---|---|---|
91b8da36326be5274adbeeb2979792d5a4e14d3c | add an elasticsearch randomization function | theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs | bulbs/content/search.py | bulbs/content/search.py | from elasticsearch_dsl import function, query
def randomize_es(es_queryset):
"""Randomize an elasticsearch queryset."""
return es_queryset.query(
query.FunctionScore(
functions=[function.RandomScore()]
)
).sort("-_score")
| mit | Python | |
ea442d8e392ee79f66e02bf70a7b5c4b772f7b79 | add ui support | peitaosu/Diplomatist | ui.py | ui.py | from diplomatist import *
import tkinter, thread
os.environ["LOOPBACK_CAPTURE"] = r"LoopbackCapture\win32\csharp\LoopbackCapture\LoopbackCapture\bin\Debug\LoopbackCapture.exe"
opt = get_options()
if opt.credential:
if os.path.isfile(opt.credential):
cred = open(opt.credential, "r").read()
else:
... | mit | Python | |
6c8d58274e5e7f74b077e2ad290d1194cc8fa65f | Add signals file | funkybob/django-rated | rated/signals.py | rated/signals.py |
from django.dispatch import Signal
rate_limited = Signal(providing_args=['client'])
| bsd-3-clause | Python | |
42b11c5a9ac46d59ea7f15c5713abfb26a2d245c | Add duden command. | kivhift/qmk,kivhift/qmk | src/commands/duden.py | src/commands/duden.py | # coding=utf-8
#
# Copyright (c) 2014 Joshua Hughes <kivhift@gmail.com>
#
import urllib
import webbrowser
import qmk
class DudenCommand(qmk.Command):
'''Look up the given argument using Duden's dictionary search. A new tab
will be opened with the results.'''
def __init__(self):
self._name = 'dude... | mit | Python | |
1475a095620d2c9ef47f8bd9ea4363907ff0067b | Remove Duplicates from Sorted List II | don7hao/leetcode_oj,don7hao/leetcode_oj | remove_duplicates_from_sorted_list_ii.py | remove_duplicates_from_sorted_list_ii.py | # 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 deleteDuplicates(self, head):
if None == head:
return None
header = ListNode(-1)
... | apache-2.0 | Python | |
7b3201cecea1f4099fb2e055d9e874b12858b55e | Add framework package integration tests based on dendrites projects RES-2528 | numenta/nupic.research,mrcslws/nupic.research,numenta/nupic.research,subutai/nupic.research,subutai/nupic.research,mrcslws/nupic.research | tests/integration/frameworks/dendrites/dendrite_integration_tests.py | tests/integration/frameworks/dendrites/dendrite_integration_tests.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 | Python | |
dfe756afe9a014adc3c66eff7c121c470aaaeab8 | support for thumbnail | spaam/svtplay-dl,leakim/svtplay-dl,spaam/svtplay-dl,dalgr/svtplay-dl,leakim/svtplay-dl,iwconfig/svtplay-dl,dalgr/svtplay-dl,leakim/svtplay-dl,OakNinja/svtplay-dl,OakNinja/svtplay-dl,olof/svtplay-dl,selepo/svtplay-dl,iwconfig/svtplay-dl,qnorsten/svtplay-dl,qnorsten/svtplay-dl,olof/svtplay-dl,OakNinja/svtplay-dl,selepo/s... | lib/svtplay_dl/service/vimeo.py | lib/svtplay_dl/service/vimeo.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import sys
import json
import re
from svtplay_dl.service import Service, OpenGraphThumbMixin
from svtplay_dl.utils import get_http_data
from svtplay_dl.fetcher.http import download_http
from ... | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import sys
import json
import re
from svtplay_dl.service import Service
from svtplay_dl.utils import get_http_data
from svtplay_dl.fetcher.http import download_http
from svtplay_dl.log import... | mit | Python |
701b3fcd1a9cd661ede2c331266eaf154add234e | add missing yaml include module | vmware/chaperone-ui,vmware/chaperone-ui,vmware/chaperone-ui | chaperone/utils/yaml.py | chaperone/utils/yaml.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | apache-2.0 | Python | |
eb1ada9fef01611bbd81eb29a16027cd76b23e55 | Create 04.py | ezralalonde/cloaked-octo-sansa | 03/qu/04.py | 03/qu/04.py | # We defined:
stooges = ['Moe','Larry','Curly']
# but in some Stooges films, Curly was
# replaced by Shemp.
# Write one line of code that changes
# the value of stooges to be:
['Moe','Larry','Shemp']
# but does not create a new List
# object.
stooges[2] = 'Shemp'
| bsd-2-clause | Python | |
89033b563a905ae21559af8b5fccedeaa964e608 | 更新编程笔记2 | moranzcw/Computer-Networking-A-Top-Down-Approach-NOTES | 《计算机网络:自顶向下方法(原书第6版)》编程笔记/source/UDPPinger.py | 《计算机网络:自顶向下方法(原书第6版)》编程笔记/source/UDPPinger.py | from socket import *
import time
serverName = '191.101.232.165' # 服务器地址,本例中使用一台远程主机
serverPort = 12000 # 服务器指定的端口
clientSocket = socket(AF_INET, SOCK_DGRAM) # 创建UDP套接字,使用IPv4协议
clientSocket.settimeout(1) # 设置套接字超时值1秒
for i in range(0, 10):
sendTime = time.time()
message = ('Ping %d %s' % (i+1, sendTime)).encode() #... | mit | Python | |
b0d8789ea71516169992ccd02354dd57792f01c7 | Add helper layer for bidirectional | spacy-io/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc | thinc/layers/bidirectional.py | thinc/layers/bidirectional.py | from typing import Optional
from ..model import Model
def bidirectional(l2r: Model, r2l: Optional[Model] = None) -> Model:
"""Stitch two RNN models into a bidirectional layer."""
if r2l is None:
r2l = l2r.copy()
return Model(f"bi{l2r.name}", forward, layers=[l2r, r2l])
def forward(model, Xs, is_... | mit | Python | |
69736877d6cfe7f2a13112e08ea0dc6d0943a469 | add script to receive camerastream supported by camerad | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | tools/camerastream/receive.py | tools/camerastream/receive.py | #!/usr/bin/env python
import os
import sys
import numpy as np
os.environ['ZMQ'] = '1'
from common.window import Window
import cereal.messaging as messaging
# start camerad with 'SEND_ROAD=1 SEND_DRIVER=1 SEND_WIDE_ROAD=1 XMIN=771 XMAX=1156 YMIN=483 YMAX=724 ./camerad'
# also start bridge
# then run this "./receive.py... | mit | Python | |
8edaf8d9dd710824350de629104b6ed077797487 | add new file for l10n_br_account.cnae object | akretion/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil | l10n_br_account/models/l10n_br_account_cnae.py | l10n_br_account/models/l10n_br_account_cnae.py | # -*- coding: utf-8 -*-
# Copyright (C) 2009 - TODAY Renato Lima - Akretion
# Copyright (C) 2014 KMEE - www.kmee.com.br
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import models, fields, api
class L10nBrAccountCNAE(models.Model):
"""Classe para cadastro de Código Nacional de Ativid... | agpl-3.0 | Python | |
82e3f0561588ba99123ea351c9494ee5dbc1ccfc | Add jupyter_notebook_config.py | olifre/root,karies/root,root-mirror/root,olifre/root,olifre/root,olifre/root,olifre/root,karies/root,root-mirror/root,karies/root,karies/root,root-mirror/root,olifre/root,olifre/root,root-mirror/root,root-mirror/root,karies/root,olifre/root,root-mirror/root,olifre/root,olifre/root,root-mirror/root,karies/root,root-mirr... | etc/notebook/jupyter_notebook_config.py | etc/notebook/jupyter_notebook_config.py | import os
if 'ROOTSYS' in os.environ:
c.NotebookApp.extra_static_paths.append(os.path.join(os.environ['ROOTSYS'], 'js/'))
| lgpl-2.1 | Python | |
060260c2765db92dad81cf8bf0d0f89db6d4d9b4 | Update down revision | josthkko/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,kr41/ggrc-core,prasannav7/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core... | src/ggrc/migrations/versions/20160314155056_39aec99639d5_add_defintion_id_to_ca_definitions.py | src/ggrc/migrations/versions/20160314155056_39aec99639d5_add_defintion_id_to_ca_definitions.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""
Add definition_id to custom attribute definitions
Create Date: 2016-03-14 1... | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""
Add definition_id to custom attribute definitions
Create Date: 2016-03-14 1... | apache-2.0 | Python |
502adddbe7374831b1fb2851460e57e6a1b7a89c | Create runPlaceJobSchedule.py | MichaelCurrin/twitterverse,MichaelCurrin/twitterverse | app/utils/insert/runPlaceJobSchedule.py | app/utils/insert/runPlaceJobSchedule.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Utility to get trend data, based on a list of required places.
Gets enabled records from PlaceJob table and use the WOEID of each place
to access trend data for that place from Twitter API and store in the
database.
"""
# Make dirs in app dir available for import.
imp... | mit | Python | |
af58c0202df7546d19409bea49c85964df29a53c | Add files via upload | miradel51/preprocess | thulac_seg.py | thulac_seg.py | #!/usr/bin/python
#-*-coding:utf-8 -*-
# author: mld
# email: miradel51@126.com
# date : 2017/9/28
import thulac
import sys
import string
def ch_seg_line(eachline):
seg_line = ""
thu1 = thulac.thulac(seg_only=True) #only split but not tag
seg_line = thu1.cut(eachline,text=True) #splitted input_ch... | mit | Python | |
7e0a8eb899fed8e7794c9ec035016e6a5d0bbd57 | add diagnostics.__init__.py | mrocklin/dask,ssanderson/dask,mrocklin/dask,simudream/dask,dask/dask,mraspaud/dask,chrisbarber/dask,freeman-lab/dask,vikhyat/dask,clarkfitzg/dask,mraspaud/dask,ssanderson/dask,blaze/dask,blaze/dask,gameduell/dask,jcrist/dask,wiso/dask,cpcloud/dask,jayhetee/dask,jakirkham/dask,simudream/dask,jakirkham/dask,pombredanne/d... | dask/diagnostics/__init__.py | dask/diagnostics/__init__.py | from .profile import Profiler
from dask import threaded, multiprocessing
thread_prof = Profiler(threaded.get)
process_prof = Profiler(multiprocessing.get)
| bsd-3-clause | Python | |
4ae69ae3813a79f149f51ad053708d5bb7c562fc | Add tests for the existing sources | usingnamespace/pyramid_authsanity | pyramid_authsanity/tests/test_sources.py | pyramid_authsanity/tests/test_sources.py | import logging
from collections import Iterable
from pyramid_authsanity.interfaces import IAuthSourceService
from pyramid_authsanity import sources
from zope.interface.verify import verifyObject
class _TestAuthSource(object):
def test_verify_object(self):
assert verifyObject(IAuthSourceService, self._mak... | isc | Python | |
a1f539bc898678a23f64280051076187c8156497 | Create __init__.py | Dturati/projetoUFMT,Dturati/projetoUFMT,Dturati/projetoUFMT,Dturati/projetoUFMT,Dturati/projetoUFMT | __init__.py | __init__.py | mit | Python | ||
75d89dd5ac162e8c17744a039369adc40a25db1e | Create __init__.py | bachiraoun/SimpleLogger,bachiraoun/pysimplelog | __init__.py | __init__.py | __version__ = '1.0.0'
from SimpleLog import Logger
| agpl-3.0 | Python | |
8a9b4de36f35416874d10734ae1c08287ebd5c32 | Add simple mrequests GET example | SpotlightKid/micropython-stm-lib | mrequests/examples/get_json.py | mrequests/examples/get_json.py | import mrequests as requests
host = 'http://localhost/'
url = host + "get"
r = requests.get(url, headers={"Accept": "application/json"})
print(r)
print(r.content)
print(r.text)
print(r.json())
r.close()
| mit | Python | |
ad01e44838a39087c7273ee64f4eab6f6e840fec | Migrate protected view decorator from OAuthLib. | ib-lundgren/django-oauthlib | django_oauthlib/decorator.py | django_oauthlib/decorator.py | from __future__ import absolute_import
import functools
from django.http import HttpResponseForbidden
from .utils import extract_params, log
class OAuth2ProviderDecorator(object):
def __init__(self, resource_endpoint):
self._resource_endpoint = resource_endpoint
def protected_resource_view(self, s... | bsd-3-clause | Python | |
373bdc384b46a142fe66d86b162ea296054b2fa2 | Add https://github.com/pkienzle/periodictable/blob/master/doc/sphinx/_extensions/dollarmath.py | kellieotto/permute,pbstark/permute,qqqube/permute,statlab/permute,kellieotto/permute,stefanv/permute,jarrodmillman/permute | doc/_sphinxext/dollarmath.py | doc/_sphinxext/dollarmath.py | # This program is public domain
# Author: Paul Kienzle
r"""
Allow $math$ markup in text and docstrings, ignoring \$.
The $math$ markup should be separated from the surrounding text by spaces. To
embed markup within a word, place backslash-space before and after. For
convenience, the final $ can be followed by punctu... | bsd-2-clause | Python | |
caa37f757a6b7dcc671275fcae062d2c13ebb805 | Create join_reducer.py | sammath/Hadoop-Platform,sammath/Hadoop-Platform | MapReduce_Examples/Join_Python/join_reducer.py | MapReduce_Examples/Join_Python/join_reducer.py | apache-2.0 | Python | ||
71436917f834da1052643da8b592f69c2b619201 | Create tests for helpers | OpenVolunteeringPlatform/django-ovp-core,OpenVolunteeringPlatform/django-ovp-core | ovp_core/tests/test_helpers.py | ovp_core/tests/test_helpers.py | from django.test import TestCase
from django.test.utils import override_settings
from ovp_core.helpers import get_address_model
from ovp_core.models import SimpleAddress, GoogleAddress
class GetAddressModelHelperTestCase(TestCase):
def test_default_model(self):
"""Assert GoogleAddress is the default address mod... | agpl-3.0 | Python | |
960d86338f707e07d6d1d260baae826cff756024 | add xx.py for test | DoraemonShare/yuqing | xx.py | xx.py | ss
| bsd-3-clause | Python | |
ac01f93c7ec35d447586e14c8a1cc2ead3526ede | Add pacemaker wrapper | padthaitofuhot/monitoring-for-openstack,openstack/monitoring-for-openstack,padthaitofuhot/monitoring-for-openstack,magic0704/monitoring-for-openstack,openstack/monitoring-for-openstack,stackforge/monitoring-for-openstack,magic0704/monitoring-for-openstack,stackforge/monitoring-for-openstack,tcpcloud/monitoring-for-open... | scripts/oschecks/pacemaker_host_check.py | scripts/oschecks/pacemaker_host_check.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Openstack Monitoring script for Sensu / Nagios
#
# Copyright © 2013-2014 eNovance <licensing@enovance.com>
#
# Author:Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in c... | apache-2.0 | Python | |
141deed386230111fb177ea02ae3afbb0fc6718b | Create voter_data_download.py | abhishek-malani/python-basic-coding | voter_data_download.py | voter_data_download.py | import urllib2
import os
baseurl = "http://ceoaperms.ap.gov.in/TS_Rolls/PDFGeneration.aspx?urlPath=D:\SSR2016_Final\Telangana\AC_001\English\S29A"
constituencyCount = 0
constituencyTotal = 229
while constituencyCount <= constituencyTotal:
pdfCount = 1
notDone = True
constituencyCount = constituencyCount ... | mit | Python | |
fc87a0aa145a0d27bd65ec7b6dc9f854e4889e14 | Move reindexing code out of dropout-filling script. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | analysis/00-reindex.py | analysis/00-reindex.py | #!/usr/bin/env python
import climate
import joblib
import lmj.cubes
logging = climate.get_logger('reindex')
# this is the set of markers that gets included in our output.
MARKERS = [
'marker00-r-head-back',
'marker01-r-head-front',
'marker02-l-head-front',
'marker03-l-head-back',
'marker06-r-coll... | mit | Python | |
13b835d525f6576bfa047ce3001479d8b81f15b7 | Fix past migration scripts discrepancies | StackStorm/mistral,openstack/mistral,StackStorm/mistral,openstack/mistral | mistral/db/sqlalchemy/migration/alembic_migrations/versions/014_fix_past_scripts_discrepancies.py | mistral/db/sqlalchemy/migration/alembic_migrations/versions/014_fix_past_scripts_discrepancies.py | # Copyright 2016 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python | |
7716f5aecd8a484c45ac77d2aa0f05a361665e1f | Add missing migration for mezzanine.core Slugged (#334) | dsanders11/cartridge,dsanders11/cartridge,stephenmcd/cartridge,dsanders11/cartridge,stephenmcd/cartridge,stephenmcd/cartridge | cartridge/shop/migrations/0009_product_slug.py | cartridge/shop/migrations/0009_product_slug.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-12 05:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0008_product_content_model'),
]
operations = [
migrations.AlterFie... | bsd-2-clause | Python | |
fb325420a52a480f8ce24f9f2fe4750302af87a3 | add change_return.py | mykhamill/Projects-Solutions | change_return.py | change_return.py | #!/usr/bin/python
# -*- coding: latin-1 -*-
# **Change Return Program**
# The user enters a cost and then the amount of money given. The program will
# figure out the change and the number of notes (£5, £10, £20) and
# coins (£1, 50p, 20p, 10p, 5p, 2p, 1p) that are needed for the change.
import argparse
from sys impo... | mit | Python | |
ee05b846612aa5c978949ff90f38290915983385 | Test tool for checking entropy available in a loop | infincia/TokenTools | check-entropy.py | check-entropy.py | #!/usr/bin/env python
import sys
import os
import logging
import time
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
mainHandler = logging.StreamHandler()
mainHandler.setFormatter(logging.Formatter('%(levelname)s %(asctime)s - %(module)s - %(funcName)s: %(message)s'))
log.addHandler(mainHandler)
PROC_... | mit | Python | |
3d8093bd5ab9981bb3a46f364b47568eaa932f54 | add missing files | multipath-rtp/cerbero,GStreamer/cerbero,freedesktop-unofficial-mirror/gstreamer-sdk__cerbero,superdump/cerbero,flexVDI/cerbero,justinjoy/cerbero,justinjoy/cerbero,freedesktop-unofficial-mirror/gstreamer__sdk__cerbero,nicolewu/cerbero,brion/cerbero,centricular/cerbero,GStreamer/cerbero,lubosz/cerbero,shoreflyer/cerbero,... | cerbero/packages/osx_framework_plist.py | cerbero/packages/osx_framework_plist.py |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; ei... | lgpl-2.1 | Python | |
640bbad9caa4539d7c08feb120b3ab5258b755aa | Create __init__.py | brutus333/netmiko,MikeOfNoTrades/netmiko,jinesh-patel/netmiko,shsingh/netmiko,enzzzy/netmiko,shamanu4/netmiko,MikeOfNoTrades/netmiko,ktbyers/netmiko,jumpojoy/netmiko,mileswdavis/netmiko,rumo/netmiko,ivandgreat/netmiko,ivandgreat/netmiko,shamanu4/netmiko,jinesh-patel/netmiko,shsingh/netmiko,rumo/netmiko,ktbyers/netmiko,... | netmiko/f5/__init__.py | netmiko/f5/__init__.py | from f5_ltm_ssh import F5LtmSSH
| mit | Python | |
8a029fb00892c8bf385dae76466ae1e211e27ca6 | Add basic test for profile.Profile. | dseomn/cohydra | cohydra/test_profile.py | cohydra/test_profile.py | import tempfile
import unittest
import unittest.mock
from . import profile
from . import test_helper
@unittest.mock.patch.object(
profile.Profile,
'generate',
autospec=True,
)
@unittest.mock.patch.object(
profile.Profile,
'__abstractmethods__',
new=set(),
)
class TestProfile(unittest.TestCase):
def... | apache-2.0 | Python | |
637dd3211ed4dffa697ae2400206f19287b4bfda | rename example to __init__ | tudo-astroparticlephysics/pydisteval | disteval/scripts/__init__.py | disteval/scripts/__init__.py | #put executables here
| mit | Python | |
3c8ef18ca1bd97308cf0de0371f24c17d0bd8ff2 | add plot_grid_search_min_uncertainty | OPU-Surveillance-System/monitoring,OPU-Surveillance-System/monitoring,OPU-Surveillance-System/monitoring | master/scripts/planner/solvers/hyperparameter_optimization/plot_grid_search_min_uncertainty.py | master/scripts/planner/solvers/hyperparameter_optimization/plot_grid_search_min_uncertainty.py | import matplotlib.pyplot as plt
import operator
with open("memo_min_uncertainty", "r") as f:
data = f.read()
data = data.split("\n")[:-1]
data = [data[i].split(" ") for i in range(len(data))]
data = {(int(data[i][0]), float(data[i][1]), float(data[i][2])):float(data[i][3]) / 100 for i in range(len(data))}
sorted_... | mit | Python | |
414a69b736546b3f5adfb1a6f8dccf5b91160694 | Add xfailing test (see #1971, #2675, #2671) | explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy | spacy/tests/regression/test_issue1971.py | spacy/tests/regression/test_issue1971.py | # coding: utf8
from __future__ import unicode_literals
from spacy.matcher import Matcher
from spacy.tokens import Token, Doc
def test_issue1971(en_vocab):
# Possibly related to #2675 and #2671?
matcher = Matcher(en_vocab)
pattern = [
{"ORTH": "Doe"},
{"ORTH": "!", "OP": "?"},
{"_"... | mit | Python | |
e3e3d72d6ef653ef59d49e667aeed9756578c386 | Add api module | patrickspencer/lytics,patrickspencer/lytics,patrickspencer/lytics,patrickspencer/lytics | api.py | api.py | # -*- coding: utf-8 -*-
"""
api
~~~
Main api declarations lytics app.
:copyright: (c) 2016 by Patrick Spencer.
:license: Apache 2.0, see LICENSE for more details.
"""
from flask.json import jsonify
from flask_restful import Resource, Api, reqparse
import queries
parser = reqparse.RequestParser()
... | apache-2.0 | Python | |
ff62cf00cdad01c1bce3aa705e09a492cfef8132 | add admin setting | happyraul/tv | settings.py | settings.py | environment = {
'DATABASE_PASSWORD': 'tv_password',
'DATABASE_USER': 'tv_user',
'DEV_DATABASE_PASSWORD': 'tv_password',
'DEV_DATABASE_USER': 'tv_user',
'MAIL_PASSWORD': 'example_password',
'MAIL_USERNAME': 'user@example.com',
'SECRET_KEY': 'changeme',
'TEST_DATABASE_PASSWORD': 'tv_password',
'TEST_DATABASE_USE... | apache-2.0 | Python | |
aa936ed1a1ca193f1de2c5641cb1d861362bc176 | Create settings.py | Senmumu/usual_script_template | settings.py | settings.py | # -*- coding: utf-8 -*-
"""相关设置"""
import os
MONGODB_HOST = "some_host_string"
MONGODB_PORT = 27017
MONGODB_DBNAME = 'some_db'
MONGODB_USERNAME = 'username'
MONGO_PASSWORD = os.getenv('MONGO_PASSWORD')
| mit | Python | |
f8daa9d3cb4c9c9680289c9d64d43b4d033c6738 | Add tests for the TimeInterpolator. | csdms/pymt,csdms/coupling,csdms/coupling | tests/framework/test_timeinterp.py | tests/framework/test_timeinterp.py | import numpy as np
import pytest
from pytest import approx, raises
from pymt.framework.timeinterp import TimeInterpolator
def test_timeinterp():
interp = TimeInterpolator(((0., 1.), (1., 2.), (2., 3.)))
assert interp(.5) == approx(1.5)
assert interp(1.75) == approx(2.75)
def test_timeinterp_with_scala... | mit | Python | |
dec551dd6eee5da14112c995402579814e59b6ca | add regression tests | dmaticzka/GraphProt,dmaticzka/GraphProt,dmaticzka/GraphProt,dmaticzka/GraphProt,dmaticzka/GraphProt | tests/test_graphprot_regression.py | tests/test_graphprot_regression.py | from scripttest import TestFileEnvironment
from filecmp import cmp
testdir = "tests/testenv_graphprot_regression/"
env = TestFileEnvironment(testdir)
def test_regression_cv():
"Crossvalidation with regression."
call = """../../GraphProt.pl -mode regression -action cv \
-fasta ../test_data_full... | mit | Python | |
5c0fcfdfb6caaab31b14aee0f09a96da5ed29522 | Add tests for salt.modules.selinux.fcontext_get_policy | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/modules/test_selinux.py | tests/unit/modules/test_selinux.py | # -*- coding: utf-8 -*-
# Import Python libs
import os
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
# Import Salt libs
import salt.modules.... | apache-2.0 | Python | |
201dd8595dd1598044e9f7c12ae23da6df511955 | Create hermes.py | HugoSoaresFontes/robotic-arm-control-lynxmotion | hermes.py | hermes.py | mit | Python | ||
aa7c878516bcc2a28edc397a1ef687835b915225 | add compilator asm to bytecode | firemark/katp91,firemark/katp91,firemark/katp91 | asm.py | asm.py | #!/bin/env python3
import re
import sys
from itertools import chain
math_constant_opcodes = {
'ADD': 0b0000,
'SUB': 0b0010,
'AND': 0b0100,
'OR': 0b0110,
'XOR': 0b1000,
'MOV': 0b1010,
'CMP': 0b1100,
}
math_reg_opcodes = {
'SWP': 0b0011,
}
math_reg_opcodes.update(math_constant_opcodes)
... | mit | Python | |
2708d5af9165cefeb3e4647e492093d51e1758f1 | add solution for Single Number II | zhyu/leetcode,zhyu/leetcode | src/singleNumberII.py | src/singleNumberII.py | class Solution:
# @param A, a list of integer
# @return an integer
def singleNumber(self, A):
one = two = 0
for a in A:
two |= (one & a)
one ^= a
not_three = ~(one & two)
one &= not_three
two &= not_three
return one
| mit | Python | |
c783a43070459c0d8ccc23d5c84dc53f45d0f464 | Add ElectionIDSwitcher | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ynr/apps/elections/helpers.py | ynr/apps/elections/helpers.py | from functools import update_wrapper
from candidates.models import PostExtraElection
class ElectionIDSwitcher:
def __init__(self, ballot_view, election_view, **initkwargs):
self.election_id_kwarg = initkwargs.get("election_id_kwarg", "election")
self.ballot_view = ballot_view
self.electio... | agpl-3.0 | Python | |
9dc4548d035547c6ccd7973b1fc382eaaf0a492c | add 'smart_join' filter | serge-name/myansible,serge-name/myansible,serge-name/myansible | filter_plugins/smart_join.py | filter_plugins/smart_join.py | class FilterModule(object):
''' If input is string, just return the string; if array, merge elements '''
def filters(self):
return {
'smart_join': self.smart_join,
}
def smart_join(self,input_value):
if type(input_value) is str:
return input_value
el... | mit | Python | |
0c7daa282b9b29487d57c6ea829980e8623da1e5 | Add new "samples" subcommand to pysam/samtools.py | pysam-developers/pysam,pysam-developers/pysam,pysam-developers/pysam,pysam-developers/pysam | pysam/samtools.py | pysam/samtools.py | from pysam.utils import PysamDispatcher
# samtools command line options to export in python
SAMTOOLS_DISPATCH = {
# samtools 'documented' commands
"view": ("view", None),
"sort": ("sort", None),
"mpileup": ("mpileup", None),
"depth": ("depth", None),
"faidx": ("faidx", None),
"fqidx": ("fqi... | from pysam.utils import PysamDispatcher
# samtools command line options to export in python
SAMTOOLS_DISPATCH = {
# samtools 'documented' commands
"view": ("view", None),
"sort": ("sort", None),
"mpileup": ("mpileup", None),
"depth": ("depth", None),
"faidx": ("faidx", None),
"fqidx": ("fqi... | mit | Python |
da4ef361ceb3fb6e3e9944fdc84f2e1fcd272812 | add func_geometric.py | mackst/glm | glm/detail/func_geometric.py | glm/detail/func_geometric.py | # -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014 mack stone
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... | mit | Python | |
93e3a03278683ae4cc7dc76bd8d88e162ff3bc70 | Create enrich.py | bazakoskon/labels-on-Amazon-movie-reviews-dataset | enrich.py | enrich.py | import gzip
import csv
import ast
labels_dictionary = {}
with open('labels.csv', mode='r') as infile:
csvreader = csv.reader(infile)
next(csvreader)
for rows in csvreader:
labels_dictionary[rows[0]] = ast.literal_eval(rows[1])
def parse(filename):
f = gzip.open(filename, 'r')
entry = {}
... | bsd-3-clause | Python | |
faec5d62d5cf9e09332ffb6b6b70a0a42ce6a25b | Create Sudhanshu36.py | WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,... | python/Sudhanshu36.py | python/Sudhanshu36.py | def hi():
return ("Hello World")
print(hi())
| mit | Python | |
7bf60d5ef1e6052044ebfedf1e2bf2dddc0940b8 | Implement RTPP_LOG_TSTART and RTPP_LOG_TFORM="rel" env parameters to aid debugging. | sippy/rtp_cluster,sippy/rtp_cluster | python/getmonotime.py | python/getmonotime.py | import getopt, sys
if __name__ == '__main__':
sippy_path = None
try:
opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b')
except getopt.GetoptError:
usage()
for o, a in opts:
if o == '-S':
sippy_path = a.strip()
continue
if sippy_path != None:
... | bsd-2-clause | Python | |
f6b77e9b5768137cad84c0b425c1ffbfb58cb765 | Add translated (Finnish) version of openweather module | rnyberg/pyfibot,rnyberg/pyfibot | pyfibot/modules/module_openweather_fi.py | pyfibot/modules/module_openweather_fi.py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals
import logging
from datetime import datetime, timedelta
from math import ceil
log = logging.getLogger('openweather')
default_location = 'Helsinki'
threshold = 120
def init(bot):
global default_location
global threshold... | bsd-3-clause | Python | |
013c6f389e58e7d19352435cc1a4963d138369cb | Create gui.py | helloworldC2/VirtualRobot | gui.py | gui.py | import time
import client
import threading
import random
import Tile
import pygame
pygame.init()
x = random.randint(0,800)
y = random.randint(0,400)
client.login(raw_input("Enter Username: "),x,y)
size = width, height = 800, 400
screen = pygame.display.set_mode(size)
keys = {}
tiles = [0]*(80*40)
def createLevel():
... | mit | Python | |
871c01115cd331b5522252c000cf875e5e2210c5 | add ex41 | zhaoace/codecraft,zhaoace/codecraft,zhaoace/codecraft,zhaoace/codecraft,zhaoace/codecraft,zhaoace/codecraft,zhaoace/codecraft | python/learnpythonthehardway.org/ex41.py | python/learnpythonthehardway.org/ex41.py | print "ex41.py"
from sys import exit
from random import randint
def death():
quips = ["You died. You kinda suck at this.",
"Nic job, you died ... jackass.",
"Such a luser.",
"I have a small puppy that's better at this."]
print quips[randint(0, len(quips)-1)]
exit(1)
... | unlicense | Python | |
5ee0f309521320f0cc91c61b112fd94c8415f37c | Add helpers to make Jinja2 more like Angular: PermissiveUndefined, JSDict, and JSList. | emosenkis/angular2tmpl | jinja2.py | jinja2.py | from __future__ import (division, absolute_import, print_function,
unicode_literals)
import jinja2
class PermissiveUndefined(jinja2.Undefined):
def __getattr__(self, name):
return PermissiveUndefined(name)
def __getitem__(self, name):
return PermissiveUndefined(name)
... | mit | Python | |
3f02c0be196c5767d68bb7d1e0305845d955e6ef | Allow past server to be launched with python -m librarypaste | yougov/librarypaste,yougov/librarypaste | librarypaste/__main__.py | librarypaste/__main__.py | import librarypaste.librarypaste
if __name__ == '__main__':
librarypaste.librarypaste.main()
| mit | Python | |
7670ab89401c157aa1f80a32ba2ad2e2bd1758fa | Create linear_regression_csv.py | laichunpongben/machine_learning | linear_regression_csv.py | linear_regression_csv.py | import csv
import numpy as np
class TestCase:
def __init__(self):
dataset_file = "dataset.csv"
self.col_count = 47
self.training_data_count = 10000
self.training_set = np.loadtxt(open(dataset_file,"rb"),delimiter=",",skiprows=1)
self.test_set = np.loadtxt(open(dataset_file,"... | apache-2.0 | Python | |
758b55e21035a95c398c38a8c3d0faf277f3d5a5 | Add outputs_timed.py, which acts like outputs.sh but kills the process if it takes too long. | nth10sd/lithium,nth10sd/lithium,MozillaSecurity/lithium,MozillaSecurity/lithium | lithium/outputs_timed.py | lithium/outputs_timed.py | #!/usr/bin/env python
import sys, ntr
def filecontainsloud(f, s):
found = False
for line in file(f):
if line.find(s) != -1:
print line.rstrip()
found = True
return found
def main():
testcase = sys.argv[1]
program = sys.argv[2]
timeout = int(sys.argv[3])
searchF... | mpl-2.0 | Python | |
91029aab8c394ceb9480fc67c9dbbf08eca0364f | FIX version | ClearCorp/account-financial-tools,bmya/odoo-addons,adhoc-dev/account-financial-tools,ingadhoc/sale,sysadminmatmoz/ingadhoc,adhoc-dev/odoo-addons,ingadhoc/sale,adhoc-dev/odoo-addons,ingadhoc/odoo-addons,ingadhoc/account-payment,ingadhoc/partner,adhoc-dev/odoo-addons,bmya/odoo-addons,ingadhoc/account-financial-tools,inga... | stock_transfer_lot_filter/__openerp__.py | stock_transfer_lot_filter/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) Rooms For (Hong Kong) Limited T/A OSCG (<http://www.openerp-asia.net>).
#
# This program is free software: you can redistribute it and/or modify
# ... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) Rooms For (Hong Kong) Limited T/A OSCG (<http://www.openerp-asia.net>).
#
# This program is free software: you can redistribute it and/or modify
# ... | agpl-3.0 | Python |
cac160c1b6916e53d1d2e4576efae6e52e51e6f8 | Add in svnsyncr.py | houtianze/pyutil | svnsyncr.py | svnsyncr.py | import sys
import os
import os.path
import subprocess as sub
import re
import urllib
import inspect
def lineno():
""" Returns the current line number in our program. """
return inspect.currentframe().f_back.f_lineno
def pt(msg):
""" print with trace info """
print (msg + '\nLine: ' + str(inspect.currentframe().f_... | mit | Python | |
05b90dab50281e9b1cb35575d35db5f45d2ba15a | Add pseudo for connected components | stephtzhang/algorithms | connected_components.py | connected_components.py | def get_connected_components():
# assume nodes labeled 1 to n
# connected_components = []
# for i in 1..n
# if i not yet explored
# connected_component = bfs (graph, node i)
# connected_components.append(connected_component)
# return connected_components
| mit | Python | |
2009ff4ef71d752bfcbbe4856ecf0b69fe1b7f4a | Create 010_robot_stefan.py | mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp | micropython/010_robot_stefan.py | micropython/010_robot_stefan.py | # a robot that opens his mouth to say hello when it hears a loud sound
| mit | Python | |
80892478462b283a540f268858e472a3d3a7c8be | create a new decorator that marks a test as slow and skips it in a normal run. | DXCanas/content-curation,fle-internal/content-curation,DXCanas/content-curation,jayoshih/content-curation,fle-internal/content-curation,jayoshih/content-curation,DXCanas/content-curation,jayoshih/content-curation,DXCanas/content-curation,fle-internal/content-curation,jayoshih/content-curation,fle-internal/content-curat... | contentcuration/contentcuration/tests/utils.py | contentcuration/contentcuration/tests/utils.py | #!/usr/bin/env python
import sys
import pytest
# Mark the test class or function as a slow test, where we avoid running it
# in a normal test run due to its long running time.
# Use py.test --includeslowtests to run these kinds of tests.
slowtest = pytest.mark.skipif(
"--includeslowtests" not in sys.argv,
rea... | mit | Python | |
b8b87447b95c5712286864dc75b9eb36ff2bae64 | Add middleware for redirecting from a microcosm subdomain to a custom domain | microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb | microcosm/middleware/redirect.py | microcosm/middleware/redirect.py | import pylibmc as memcache
import logging
from django.http import HttpResponsePermanentRedirect
from microweb import settings
from microcosm.api.resources import Site
from microcosm.api.exceptions import APIException
from requests import RequestException
logger = logging.getLogger('microcosm.middleware')
class D... | agpl-3.0 | Python | |
c09446f758f42fbf00866360e0760f1a0fae0ab7 | Add azure id creation tests | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | tests/test_sso/test_azure_id_creation.py | tests/test_sso/test_azure_id_creation.py | from urllib.parse import urlparse
import pytest
from django.urls import reverse
from tests.utils import BaseViewTest
@pytest.mark.sso_mark
class AzureIdentityTest(BaseViewTest):
def test_wrong_provider_raises_404(self):
auth_path = reverse('oauth:create_identity', kwargs={'provider': 'undefined'})
... | apache-2.0 | Python | |
24bf9cdac46fc1af622c3e0bf38d2d997dcb5fb8 | Implement the PLS-SB method | jhumphry/regressions | regressions/pls_sb.py | regressions/pls_sb.py | # regressions.pls_sb
"""A package which implements the PLS-SB algorithm."""
import random
from . import *
class PLS_SB:
"""Regression using the PLS-SB algorithm."""
def __init__(self, X, Y, g):
if X.shape[0] != Y.shape[0]:
raise ParameterError('X and Y data must have the same '
... | isc | Python | |
62906d37cca8cde2617372f71881dc802f23d6b9 | Define an iterable frame buffer. | vladmunteanu/hyper-h2,vladmunteanu/hyper-h2,python-hyper/hyper-h2,bhavishyagopesh/hyper-h2,Kriechi/hyper-h2,python-hyper/hyper-h2,Kriechi/hyper-h2,mhils/hyper-h2 | h2/frame_buffer.py | h2/frame_buffer.py | # -*- coding: utf-8 -*-
"""
h2/frame_buffer
~~~~~~~~~~~~~~~
A data structure that provides a way to iterate over a byte buffer in terms of
frames.
"""
from hyperframe.frame import Frame
class FrameBuffer(object):
"""
This is a data structure that expects to act as a buffer for HTTP/2 data
that allows ite... | mit | Python | |
6b31dbd9bd69271956c9d5185b788ddccf1a1751 | Add follow followers example | tweepy/tweepy,svven/tweepy | examples/follow_followers.py | examples/follow_followers.py | import tweepy
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
# Follow every follower of the authenticated user
for follower in tweepy.Cursor(a... | mit | Python | |
2b8eb2b4df86e13ea384a73550b3e7d18f4325fd | Add a simple example | stoq/kiwi | examples/framework/simple.py | examples/framework/simple.py | #!/usr/bin/env python
import gtk
from kiwi.ui.delegates import Delegate
class Hello(Delegate):
def __init__(self):
self.index = 0
self.text = ["I've decided to take my work back underground",
"To keep it from falling into the wrong hands."]
topwidget = gtk.Window()
... | lgpl-2.1 | Python | |
69ca37615a2ab202906ec67d0c4711df5b6a6b1a | Handle zeros. | Phoenix1369/site,DMOJ/site,monouno/site,DMOJ/site,monouno/site,monouno/site,Minkov/site,Phoenix1369/site,Minkov/site,monouno/site,monouno/site,DMOJ/site,Phoenix1369/site,Phoenix1369/site,DMOJ/site,Minkov/site,Minkov/site | judge/templatetags/list_processor.py | judge/templatetags/list_processor.py | from operator import itemgetter, attrgetter
from django import template
register = template.Library()
@register.filter(name='list_attr')
def list_getattr(iterable, prop):
result = []
for item in iterable:
if hasattr(item, str(prop)):
result.append(getattr(item, prop))
else:
... | from operator import itemgetter, attrgetter
from django import template
register = template.Library()
@register.filter(name='list_attr')
def list_getattr(iterable, prop):
result = []
for item in iterable:
if hasattr(item, str(prop)):
result.append(getattr(item, prop))
else:
... | agpl-3.0 | Python |
dde3ecdcd6f07969c36f3b840f257e37145ac3f2 | add thisDirToMongodb.py | haikentcode/haios,haikentcode/haios | webhaios/media/thisDirToMongodb.py | webhaios/media/thisDirToMongodb.py |
from pymongo import MongoClient
from descriptor import descriptor as des
import os
import cv2
client = MongoClient()
db = client.haios
coll = db.sampleImages
cdObj=des.ColorDescriptor((8,12,3))
def fileIsImage(file):
imageEx=("jpg","png","JPG","jpeg","JPEG","PNG")
if file.endswith(imageEx):
return True... | mit | Python | |
aead57c037089b3465bf406d0c7c66735df3ad7b | Fix Django 1.4/1.5 issues with RelatedManager code that overrides get_query_set() | pombredanne/django_polymorphic,alexander-alvarez/django_polymorphic,chrisglass/django_polymorphic,danielquinn/django_polymorphic,ixc/django_polymorphic,skirsdeda/django_polymorphic,jonashaag/django_polymorphic,pombredanne/django_polymorphic,hobarrera/django-polymorphic-ng,ixc/django_polymorphic,danielquinn/django_polym... | polymorphic/manager.py | polymorphic/manager.py | # -*- coding: utf-8 -*-
""" PolymorphicManager
Please see README.rst or DOCS.rst or http://chrisglass.github.com/django_polymorphic/
"""
from __future__ import unicode_literals
import warnings
import django
from django.db import models
from polymorphic.query import PolymorphicQuerySet
class PolymorphicManager(mod... | # -*- coding: utf-8 -*-
""" PolymorphicManager
Please see README.rst or DOCS.rst or http://chrisglass.github.com/django_polymorphic/
"""
from __future__ import unicode_literals
import warnings
import django
from django.db import models
from polymorphic.query import PolymorphicQuerySet
class PolymorphicManager(mod... | bsd-3-clause | Python |
595eaf19c1d3a89970b5ebe148f12a5df11807cc | Add module for helmholtz results | thomasgibson/firedrake-hybridization | run_helmholtz.py | run_helmholtz.py | from __future__ import absolute_import, print_function, division
from firedrake import *
from helmholtz import MixedHelmholtzProblem
from meshes import generate_2d_square_mesh
import matplotlib as plt
def run_helmholtz_resolution_test(degree, quadrilateral=False):
"""
"""
params = {'mat_type': 'matfree... | mit | Python | |
01c9bce5131d07888f716eac0608548633fd4a7b | Add conf file for kb_rwa_giz | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ideascube/conf/kb_rwa_giz.py | ideascube/conf/kb_rwa_giz.py | """KoomBook conf"""
from .kb import * # noqa
LANGUAGE_CODE = 'en'
IDEASCUBE_NAME = 'GIZ'
HOME_CARDS = STAFF_HOME_CARDS + [
{
'id': 'blog',
},
{
'id': 'mediacenter',
},
]
| agpl-3.0 | Python | |
e4518cee0ebdb4c1c4fca964c130b2520020ba17 | Implement register command | Heufneutje/txircd | txircd/modules/extra/services/account_register.py | txircd/modules/extra/services/account_register.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
from validate_email import validate_email as validateEmail
irc.ERR_SERVICES = "955" # Custom numeric; 955 <TYPE> <SUBTYPE> <ERR... | bsd-3-clause | Python | |
3ef4e68ae64a46f09103001f391b3d6a3d098e33 | Test using bezier going through 4 specific points | eevee/cocos2d-mirror | test/test_bezier_direct.py | test/test_bezier_direct.py | from __future__ import division
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.actions import Bezier
from cocos.sprite import Sprite
import pyglet
from cocos import path
def direct_bezier(p0, p1, p2, p3):
'''G... | bsd-3-clause | Python | |
3778aa09a8c88d9d94d4b130440d347a1c47be93 | add crowd_tool for resetting and modifying crowd databases | blindsightcorp/rigor-webapp,blindsightcorp/rigor-webapp,blindsightcorp/rigor-webapp | crowd_tool.py | crowd_tool.py | #!/usr/bin/env python
from __future__ import division
import json
import pprint
import calendar
import os
import sys
import tempfile
import subprocess
import psycopg2
from utils import *
import config
import jsonschema
#--------------------------------------------------------------------------------
# DB HELPERS
... | bsd-2-clause | Python | |
0b2eefb82e2ce1daa52d0b2b714799728a7e9039 | Create pearson_Correlation.py | duttashi/Data-Analysis-Visualization | pearson_Correlation.py | pearson_Correlation.py | import warnings
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats
warnings.filterwarnings("ignore")
sns.set(color_codes=True)
# Reading the data where low_memory=False increases the program efficiency
data= pd.read_csv("gapminder.csv", low_memory=False)
# ... | mit | Python | |
9ea7172ee8666166d67f710f94bfdafc7f6ce961 | Add atom_sim | cosmos/cosmos | atom_sim.py | atom_sim.py | print "Compute atoms for validators and delegators over time"
atomsVal = 0.000 # starting atoms for validator
atomsDel = 0.010 # starting atoms delegated to validator
atomsAll = 1.0 #
inflation = 0.3 # 30% inflation
exponential = True # exponential
commission = 0.15 # 15% commission
numBlocksPerYear ... | mit | Python | |
fbca3e1eb52eb35fa4f1bdce30ed744ebd376c0b | Add tests for format.py. | enthought/distarray,enthought/distarray | distarray/localapi/tests/test_format.py | distarray/localapi/tests/test_format.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
im... | bsd-3-clause | Python | |
c1ffde8abf8fc55f68ee19fe7436d0648af88519 | Test util. | matiasbastos/OpenBazaar,mirrax/OpenBazaar,im0rtel/OpenBazaar,tortxof/OpenBazaar,tortxof/OpenBazaar,must-/OpenBazaar,habibmasuro/OpenBazaar,bglassy/OpenBazaar,rllola/OpenBazaar,matiasbastos/OpenBazaar,rllola/OpenBazaar,dionyziz/OpenBazaar,im0rtel/OpenBazaar,mirrax/OpenBazaar,akhavr/OpenBazaar,saltduck/OpenBazaar,akhavr/... | test/test_util.py | test/test_util.py | import os
import platform
import unittest
import webbrowser
import mock
from node import util
class TestUtil(unittest.TestCase):
@mock.patch.object(platform, 'uname', lambda: ['Darwin'])
def test_is_mac_Darwin(self):
self.assertTrue(util.is_mac())
@mock.patch.object(platform, 'uname', lambda: ... | mit | Python | |
43dd1b95676feb43ac5b99770fbe442742e65815 | Create libpng.py | vadimkantorov/wigwam | wigs/libpng.py | wigs/libpng.py | class libpng(Wig):
tarball_uri = 'ftp://ftp-osl.osuosl.org/pub/libpng/src/libpng16/libpng-{RELEASE_VERSION}.tar.gz'
last_release_version = '1.6.30'
git_uri = 'git://git.code.sf.net/p/libpng/code'
| mit | Python | |
6ecc4c65fb6fbc06dcebcd2f1a7615b19cf2ab0b | Create kmk-load-excel.py | Yokan-Study/study,Yokan-Study/study,Yokan-Study/study | 2017/11.28/python/kmk-load-excel.py | 2017/11.28/python/kmk-load-excel.py | mit | Python | ||
ca8d7c3fe21e9e145fd2f65cd2334d139ddab6ed | Create unzip.py | vadimkantorov/wigwam | wigs/unzip.py | wigs/unzip.py | class unzip(Wig):
tarball_uri = 'http://downloads.sourceforge.net/infozip/unzip$RELEASE_VERSION$.tar.gz'
last_release_version = 'v60'
def setup(self):
self.skip('configure')
self.make_flags += ['-f', 'unix/Makefile']
| mit | Python | |
45d62561f767913cb4c4e120bdce0f2397a64800 | add test for the issue | recognai/spaCy,explosion/spaCy,aikramer2/spaCy,aikramer2/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,aikramer2/spaCy,recognai/spaCy,recognai/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,recognai/spaCy,explosion/spaCy,honnibal/sp... | spacy/tests/regression/test_issue1834.py | spacy/tests/regression/test_issue1834.py | from __future__ import unicode_literals
from ...tokens import Doc
from ...vocab import Vocab
def test_issue1834():
"""test if sentence boundaries & parse/tag flags are not lost
during serialization
"""
words = "This is a first sentence . And another one".split()
vocab = Vocab()
doc = Doc(vocab... | mit | Python | |
0b0c71bc95efde29ee88cf1b10c27d6409aba7e5 | add bigreg.py for creating large (greater than 16k registry files) | williballenthin/python-registry,zweger/python-registry,zweger/shellbags,azmikamis/python-registry,NiKiZe/python-registry,williballenthin/shellbags,ohio813/python-registry | testing/bigreg.py | testing/bigreg.py | import _winreg
hreg = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\willi")
print hreg
_winreg.SetValue(hreg, "big", _winreg.REG_SZ, "A" * 1024 * 20 )
| apache-2.0 | Python | |
30de9c9261feececb9b29d16593cd4751571ab75 | correct requirements | cortext/cortext-pytheas,cortext/cortext-pytheas,cortext/cortext-pytheas | html_unescaping.py | html_unescaping.py | import sys
if sys.version_info.major == 3 and sys.version_info.minor >= 4:
# Python 3.4+
from html import unescape
else:
if sys.version_info.major <= 2:
# Python 2
import HTMLParser
html_parser = HTMLParser.HTMLParser()
else:
# Python 3.0 - 3.3
import html.parse... | mit | Python | |
bf415ba39ea3a3069a9f4e124d81c02103a631f7 | Create sklearn_clf_dict.py | mpearmain/gestalt | examples/sklearn_clf_dict.py | examples/sklearn_clf_dict.py | # A time saving utility file set to run against _ALL_ sklearn classifers
# If the daa set is large it may run into memory issues as all final models are stored in memory.
estimators = {RandomForestClassifier(): 'RFC',
ExtraTreesClassifier(): 'ETC',
XGBClassifier(): 'XGB1'}
| mit | Python | |
76f796d234b594d52fde5ef1df4d0e5edfffd28f | Fix the target server | mileswwatkins/pupa,influence-usa/pupa,opencivicdata/pupa,rshorey/pupa,datamade/pupa,rshorey/pupa,mileswwatkins/pupa,datamade/pupa,influence-usa/pupa,opencivicdata/pupa | tools/drop_bad.py | tools/drop_bad.py | #!/usr/bin/env python
from pymongo import Connection
SERVER = "ec2-184-73-58-184.compute-1.amazonaws.com"
DATABASE = "ocd"
connection = Connection(SERVER, 27017)
db = getattr(connection, DATABASE)
def purge_org(org):
for membership in db.memberships.find({"organization_id": org}):
who = db.people.find_o... | #!/usr/bin/env python
from pymongo import Connection
connection = Connection('localhost', 27017)
db = getattr(connection, 'pupa')
def purge_org(org):
for membership in db.memberships.find({"organization_id": org}):
who = db.people.find_one({"_id": membership['person_id']})
if who:
db... | bsd-3-clause | Python |
ce7ffb258b08b15d3c3a224fdd46553fb187d522 | Add lc0416_partition_equal_subset_sum.py | bowen0701/algorithms_data_structures | lc0416_partition_equal_subset_sum.py | lc0416_partition_equal_subset_sum.py | """Leetcode 416. Partition Equal Subset Sum
Medium
URL: https://leetcode.com/problems/partition-equal-subset-sum/
Given a non-empty array containing only positive integers, find if the array
can be partitioned into two subsets such that the sum of elements in both
subsets is equal.
Note:
- Each of the array element ... | bsd-2-clause | Python | |
d0f140e2675705d1c1e7e50064f3c575b515ea79 | Create submission form with url validator. | PythonClutch/python-clutch,PythonClutch/python-clutch,PythonClutch/python-clutch | toolshed/forms.py | toolshed/forms.py | from wtforms.fields.html5 import URLField
from wtforms.validators import url
from flask_wtf import Form
class SubmissionForm(Form):
pypi_url = URLField(validators=[url()]) | mit | Python | |
004bdc87c6fd45d2187620977591affc39d496d8 | add clean idea script | mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs | labs/clean_idea.py | labs/clean_idea.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: mcxiaoke
# @Date: 2015-07-10 14:13:05
import os
import sys
from os import path
import re
import tempfile
import shutil
import time
'''
clean idea project files
param: max_depth -> max depth for recursively, default=3
param: permanently -> move to ... | apache-2.0 | Python | |
a90bbec8b1c5029012e491f04e9b7fb30d6c22e3 | add try-api-limits.py | xflr6/gsheets | try-api-limits.py | try-api-limits.py | #!/usr/bin/env python
# try-api-limits.py - investigate api limits with larger sheets
import logging
from gsheets import Sheets
SHEET_ID = '1lnDyc-Elf_y6_Bz22_9AgTKu4aJCFUoBuPCaxyAFMkA'
logging.basicConfig(format='[%(levelname)s@%(name)s] %(message)s',
level=logging.DEBUG)
sheets = Sheets.from... | mit | Python | |
c159fbffbea0a4e8b70e8898c31c62c7e08a3865 | Remove whitespace in sudoku | jilljenn/tryalgo | tryalgo/sudoku.py | tryalgo/sudoku.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Solving Sudoku
# jill-jenn vie et christoph durr - 2014-2018
from tryalgo.dancing_links import dancing_links
__all__ = ["sudoku"]
# snip{
N = 3 # global constants
N2 = N * N
N4 = N2 * N2
# sets
def assignation(r, c, v): return r * N4 + c * N2 + v
def row(a)... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Solving Sudoku
# jill-jenn vie et christoph durr - 2014-2018
from tryalgo.dancing_links import dancing_links
__all__ = ["sudoku"]
# snip{
N = 3 # global constants
N2 = N * N
N4 = N2 * N2
# sets
def assignation(r, c, v): return r * N4 + c * N2 + v
def row(a... | mit | Python |
b4a932eb8d99f9f4d29d3459c62e0cf81240fbdb | Add script for counting all users count | sevazhidkov/leonard | scripts/stats.py | scripts/stats.py | import os
import telegram
from leonard import Leonard
telegram_client = telegram.Bot(os.environ['BOT_TOKEN'])
bot = Leonard(telegram_client)
bot.collect_plugins()
def main():
count = 0
for key in bot.redis.scan_iter(match='user:*:registered'):
count += 1
print('Total users:', count)
if __name_... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.